nexsight 0.6.7 → 0.6.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/insight4.nxs CHANGED
@@ -2,37 +2,37 @@
2
2
  "type": "group",
3
3
  "name": "insight4",
4
4
  "enabled": true,
5
- "description": "Insight4 — probabilistic opponent affliction tracker for Achaea on the Nexus client. (generated package v0.6.7 — do not edit)",
5
+ "description": "Insight4 — probabilistic opponent affliction tracker for Achaea on the Nexus client. (generated package v0.6.9 — do not edit)",
6
6
  "items": [
7
7
  {
8
8
  "type": "function",
9
9
  "name": "__meta",
10
10
  "enabled": true,
11
- "code": "{\n \"description\": \"Insight4 — probabilistic opponent affliction tracker for Achaea on the Nexus client.\",\n \"version\": \"0.6.7\",\n \"website\": \"https://github.com/Log-Wall/insight\",\n \"dependencies\": [\n \"eventStream3\"\n ]\n}"
11
+ "code": "{\n \"description\": \"Insight4 — probabilistic opponent affliction tracker for Achaea on the Nexus client.\",\n \"version\": \"0.6.9\",\n \"website\": \"https://github.com/Log-Wall/insight\",\n \"dependencies\": [\n \"eventStream3\"\n ]\n}"
12
12
  },
13
13
  {
14
14
  "type": "function",
15
15
  "name": "README",
16
16
  "enabled": true,
17
- "code": "/*\nInsight4 — probabilistic opponent affliction tracker for Achaea.\n\nThis package is a loader and nothing more. Every trigger, every cure table and all of the\ninference live in the published bundle (nexsight@0.6.7); the reflexes here declare the\npackage, load that exact version, and tear it down again on uninstall.\n\n Requires eventStream3 — it supplies eventStream, nexAction and nexSkills.\n Public API insight.state / insight.api / insight.events\n Docs https://github.com/Log-Wall/insight\n\nUpgrades are explicit: import the newer versioned insight4.nxs. Nothing here self-updates,\nand the opt-in update check only ever prints a notice (ADR-0020).\n*/"
17
+ "code": "/*\nInsight4 — probabilistic opponent affliction tracker for Achaea.\n\nThis package is a loader and nothing more. Every trigger, every cure table and all of the\ninference live in the published bundle (nexsight@0.6.9); the reflexes here declare the\npackage, load that exact version, and tear it down again on uninstall.\n\n Requires eventStream3 — it supplies eventStream, nexAction and nexSkills.\n Public API insight.state / insight.api / insight.events\n Docs https://github.com/Log-Wall/insight\n\nUpgrades are explicit: import the newer versioned insight4.nxs. Nothing here self-updates,\nand the opt-in update check only ever prints a notice (ADR-0020).\n*/"
18
18
  },
19
19
  {
20
20
  "type": "function",
21
21
  "name": "onInstall",
22
22
  "enabled": true,
23
- "code": "// Generated by scripts/generateNxsStub.js for insight4@0.6.7. Do not edit.\n// Nexus runs this once, at import. Every later session loads through eventStream's\n// esLoad sweep; this covers the install itself, so a player who imports the package\n// while logged in gets a running tracker without reloading the client.\nnexusclient.display_notice(\"[insight4] installed — version 0.6.7.\", \"#00ccff\");\nnexusclient.reflexes().run_function(\"esLoad\", {}, \"insight4\");"
23
+ "code": "// Generated by scripts/generateNxsStub.js for insight4@0.6.9. Do not edit.\n// Nexus runs this once, at import. Every later session loads through eventStream's\n// esLoad sweep; this covers the install itself, so a player who imports the package\n// while logged in gets a running tracker without reloading the client.\nnexusclient.display_notice(\"[insight4] installed — version 0.6.9.\", \"#00ccff\");\nnexusclient.reflexes().run_function(\"esLoad\", {}, \"insight4\");"
24
24
  },
25
25
  {
26
26
  "type": "function",
27
27
  "name": "esLoad",
28
28
  "enabled": true,
29
- "code": "// Generated by scripts/generateNxsStub.js for insight4@0.6.7. Do not edit.\n// Load, then raise. The pinned bundle self-boots as it evaluates (ADR-0024), so nothing\n// here calls into it — and nothing here carries combat logic (charter §9, F7).\n//\n// eventStream runs esLoad in every installed package once its own bundle and nexAction\n// are up, but it imports nexSkills from its own esLoad, concurrently with this one. All\n// three globals must exist at the instant the bundle evaluates, so the load waits for\n// them. Past the grace window it loads anyway whenever eventStream is present: a host\n// package that is genuinely absent is insight's own DEGRADED diagnostic to report\n// (ADR-0017), not the loader's to hide (ADR-0030).\nconst RETRY_MS = 100;\nconst MAX_ATTEMPTS = 100;\n\n// Named individually, not looked up on globalThis: the host injects some of these into\n// reflex scope as bindings rather than as global properties.\nconst missingHosts = () =>\n [\n typeof eventStream === \"undefined\" ? \"eventStream\" : \"\",\n typeof nexAction === \"undefined\" ? \"nexAction\" : \"\",\n typeof nexSkills === \"undefined\" ? \"nexSkills\" : \"\",\n ].filter(Boolean);\n\nconst load = () =>\n import(\"https://unpkg.com/nexsight@0.6.7/insight4.min.js\")\n .then(() => eventStream.raiseEvent(\"insightLoaded\", {}))\n .catch((error) =>\n nexusclient.display_notice(`[insight4] failed to load: ${error.message}`, \"red\"),\n );\n\nconst attempt = (n) => {\n const missing = missingHosts();\n if (missing.length === 0) return load();\n if (n < MAX_ATTEMPTS) return setTimeout(() => attempt(n + 1), RETRY_MS);\n if (typeof eventStream !== \"undefined\") return load();\n return nexusclient.display_notice(\n `[insight4] not loaded — missing host package(s): ${missing.join(\", \")}. Install eventStream3, then reload the client.`,\n \"red\",\n );\n};\n\nattempt(0);"
29
+ "code": "// Generated by scripts/generateNxsStub.js for insight4@0.6.9. Do not edit.\n// Load, then raise. The pinned bundle self-boots as it evaluates (ADR-0024), so nothing\n// here calls into it — and nothing here carries combat logic (charter §9, F7).\n//\n// eventStream runs esLoad in every installed package once its own bundle and nexAction\n// are up, but it imports nexSkills from its own esLoad, concurrently with this one. All\n// three globals must exist at the instant the bundle evaluates, so the load waits for\n// them. Past the grace window it loads anyway whenever eventStream is present: a host\n// package that is genuinely absent is insight's own DEGRADED diagnostic to report\n// (ADR-0017), not the loader's to hide (ADR-0030).\nconst RETRY_MS = 100;\nconst MAX_ATTEMPTS = 100;\n\n// Named individually, not looked up on globalThis: the host injects some of these into\n// reflex scope as bindings rather than as global properties.\nconst missingHosts = () =>\n [\n typeof eventStream === \"undefined\" ? \"eventStream\" : \"\",\n typeof nexAction === \"undefined\" ? \"nexAction\" : \"\",\n typeof nexSkills === \"undefined\" ? \"nexSkills\" : \"\",\n ].filter(Boolean);\n\nconst load = () =>\n import(\"https://unpkg.com/nexsight@0.6.9/insight4.min.js\")\n .then(() => eventStream.raiseEvent(\"insightLoaded\", {}))\n .catch((error) =>\n nexusclient.display_notice(`[insight4] failed to load: ${error.message}`, \"red\"),\n );\n\nconst attempt = (n) => {\n const missing = missingHosts();\n if (missing.length === 0) return load();\n if (n < MAX_ATTEMPTS) return setTimeout(() => attempt(n + 1), RETRY_MS);\n if (typeof eventStream !== \"undefined\") return load();\n return nexusclient.display_notice(\n `[insight4] not loaded — missing host package(s): ${missing.join(\", \")}. Install eventStream3, then reload the client.`,\n \"red\",\n );\n};\n\nattempt(0);"
30
30
  },
31
31
  {
32
32
  "type": "function",
33
33
  "name": "onUninstall",
34
34
  "enabled": true,
35
- "code": "// Generated by scripts/generateNxsStub.js for insight4@0.6.7. Do not edit.\n// Removing the package removes these reflexes, but the bundle stays evaluated in the\n// page. Without this, host subscriptions, nexAction triggers and scheduler timers would\n// outlive the uninstall until the client reloads. dispose() is the instance handle\n// boot() parks in the realm's symbol registry (ADR-0024): idempotent, and it unmounts\n// globalThis.insight.\nglobalThis[Symbol.for(\"insight4.instance\")]?.dispose();"
35
+ "code": "// Generated by scripts/generateNxsStub.js for insight4@0.6.9. Do not edit.\n// Removing the package removes these reflexes, but the bundle stays evaluated in the\n// page. Without this, host subscriptions, nexAction triggers and scheduler timers would\n// outlive the uninstall until the client reloads. dispose() is the instance handle\n// boot() parks in the realm's symbol registry (ADR-0024): idempotent, and it unmounts\n// globalThis.insight.\nglobalThis[Symbol.for(\"insight4.instance\")]?.dispose();"
36
36
  }
37
37
  ]
38
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexsight",
3
- "version": "0.6.7",
3
+ "version": "0.6.9",
4
4
  "description": "Insight4 — probabilistic opponent affliction tracker for Achaea on the Nexus client.",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://github.com/Log-Wall/insight",
package/insight.min.js DELETED
@@ -1 +0,0 @@
1
- (()=>{var e={72:()=>{eventStream.registerEvent("insight.aeonics.timeloop",(function timeloop(e){insight.addAff({id:"timeloop",player:e.target});const t=insight.depthswalker.timeloop;insight.checkBlock("You have now aged yourself")?t.max=4:t.max=3,t.count=0})),eventStream.registerEvent("insight.aeonics.timeloopProc",(function timeloopProc(e){switch(insight.depthswalker.shadowInstill){case"leach":insight.smartAffs({ids:["parasite","healthleech","manaleech"],player:e.target,ordered:!0});break;case"madness":insight.smartAffs({ids:["shadowmadness","vertigo","hallucinations"],player:e.target,ordered:!0});break;case"retribution":insight.smartAffs({ids:["retribution","justice"],player:e.target,ordered:!0});break;case"degeneration":insight.smartAffs({ids:["clumsiness","weariness","paralysis"],player:e.target,ordered:!0});break;case"depression":insight.smartAffs({ids:["depression","nausea","hypochondria"],player:e.target,ordered:!0});break;default:console.log("Invalid Timeloop instill:",insight.state.shadowInstill)}const t=insight.depthswalker.timeloop;t.count++,t.count>=t.max&&(t.count=0,insight.removeAff({id:"timeloop",player:e.target}))}))},518:()=>{eventStream.registerEvent("insight.artificing.efreeti",(function efreeti(e){insight.addAff({id:"burning",player:e.target})})),eventStream.registerEvent("insight.artificing.stoneback",(function stoneback(e){insight.addDef({id:"shield",player:e.target})}))},994:()=>{eventStream.registerEvent("insight.crystalism.destabilise",(function destabilise(e){switch(e.info.toLowerCase()){case"dissipate":insight.adjustMana({id:"percentage",value:-.15,player:e.target});break;case"palpitation":insight.adjustHp({id:"percentage",value:-.15,player:e.target});break;case"heat":insight.addAff({id:"burning",player:e.target});break;case"creeps":insight.addAff({id:"agoraphobia",player:e.target}),insight.addAff({id:"claustrophobia",player:e.target});break;case"oscillate":insight.addAff({id:"stupidity",player:e.target}),insight.addAff({id:"epilepsy",player:e.target});break;case"disorientation":insight.addAff({id:"prone",player:e.target}),insight.addAff({id:"dizziness",player:e.target});break;case"dissonance":insight.removeDef({id:"shield",player:e.target});break;case"plauge":insight.addAff({id:"brokenrightarm",player:e.target}),insight.addAff({id:"brokenrightleg",player:e.target}),insight.addAff({id:"brokenleftleg",player:e.target});break;case"lullaby":insight.removeDef({id:"insomnia",player:e.target});break;case"retardation":insight.removeDef({id:"speed",player:e.target}),insight.addAff({id:"aeon",player:e.target})}}))},430:()=>{function firelash(e){insight.addAff({id:"burning",player:e.target})}eventStream.registerEvent("insight.elementalism.shalestormTick",(function shalestormTick(e){insight.addAff({id:`brokens${e.limb}`,player:e.target})})),eventStream.registerEvent("insight.elementalism.shalestormRaze",(function shalestormRaze(e){insight.removeDef({id:"shield",player:e.target})})),eventStream.registerEvent("insight.elementalism.firelash",firelash),eventStream.registerEvent("insight.elementalism.firelashLOS",firelash),eventStream.registerEvent("insight.elementalism.freeze",(function freeze(e){insight.hasDef({id:"insulation",player:e.target})?insight.removeDef({id:"insulation",player:e.target}):insight.smartAffs({ids:["shivering","frozen"],player:e.target,ordered:!0})})),eventStream.registerEvent("insight.elementalism.dehydrate",(function dehydrate(e){insight.addAff({id:"nausea",player:e.target}),insight.addAff({id:"weariness",player:e.target})})),eventStream.registerEvent("insight.elementalism.fulminate",(function fulminate(e){insight.smartAffs({ids:["fulminated","epilepsy","paralysis"],player:e.target,ordered:!0})})),eventStream.registerEvent("insight.elementalism.bombard",(function bombard(e){insight.addAff({id:"clumsiness",player:e.target})})),eventStream.registerEvent("insight.elementalism.mudslide",(function mudslide(e){insight.addAff({id:"slickness",player:e.target}),insight.addAff({id:"prone",player:e.target})})),eventStream.registerEvent("insight.elementalism.magma",(function magma(e){insight.addAff({id:"scalded",player:e.target})})),eventStream.registerEvent("insight.elementalism.emanationFire",(function emanationFire(e){insight.addAff({id:"burning",player:e.target}),insight.addAff({id:"burning",player:e.target})})),eventStream.registerEvent("insight.elementalism.emanationAir",(function emanationAir(e){insight.addAff({id:"paralysis",player:e.target}),insight.addAff({id:"dizziness",player:e.target})})),eventStream.registerEvent("insight.elementalism.emanationEarth",(function emanationEarth(e){insight.addAff({id:"calcifiedtorso",player:e.target})})),eventStream.registerEvent("insight.elementalism.emanationWater",(function emanationWater(e){insight.hasDef({id:"insulation",player:e.target})?insight.removeDef({id:"insulation",player:e.target}):insight.smartAffs({ids:["shivering","frozen"],player:e.target,ordered:!0})})),eventStream.registerEvent("insight.elementalism.resonanceAirMinor",(function resonanceAirMinor(e){insight.addAff({id:"asthma",player:e.target})})),eventStream.registerEvent("insight.elementalism.resonanceAirModerate",(function resonanceAirModerate(e){insight.hasAff({id:"undeaf",player:e.target})?insight.addAff({id:"sensitivity",player:e.target}):insight.addAff({id:"undeaf",player:e.target})})),eventStream.registerEvent("insight.elementalism.resonanceAirMajor",(function resonanceAirMajor(e){insight.addAff({id:"healthleech",player:e.target})})),eventStream.registerEvent("insight.elementalism.resonanceEarthMinor",(function resonanceEarthMinor(e){insight.addAff({id:`broken${e.limb}`,player:e.target})})),eventStream.registerEvent("insight.elementalism.resonanceEarthModerate",(function resonanceEarthModerate(e){insight.addAff({id:"paralysis",player:e.target})})),eventStream.registerEvent("insight.elementalism.resonanceEarthMajor",(function resonanceEarthMajor(e){insight.addAff({id:"crackedribs",player:e.target})})),eventStream.registerEvent("insight.elementalism.resonanceFireMinor",(function resonanceFireMinor(e){insight.removeDef({id:"temperence",player:e.target}),setTimeout((()=>{insight.addDef({id:"temperence",player:e.target})}),2e4)})),eventStream.registerEvent("insight.elementalism.resonanceFireModerate",(function resonanceFireModerate(e){insight.hasAff({id:"scalded",player:e.target})?insight.addAff({id:"burning",player:e.target}):insight.addAff({id:"scalded",player:e.target})})),eventStream.registerEvent("insight.elementalism.resonanceFireMajor",(function resonanceFireMajor(e){insight.hasAff({id:"blistered",player:e.target})?insight.addAff({id:"burning",player:e.target}):insight.addAff({id:"blistered",player:e.target})})),eventStream.registerEvent("insight.elementalism.resonanceWaterMinor",(function resonanceWaterMinor(e){insight.addAff({id:"frostbite",player:e.target})})),eventStream.registerEvent("insight.elementalism.resonanceWaterModerate",(function resonanceWaterModerate(e){insight.addAff({id:"stuttering",player:e.target})})),eventStream.registerEvent("insight.elementalism.resonanceWaterMajor",(function resonanceWaterMajor(e){insight.addAff({id:"anorexia",player:e.target})}))},389:()=>{eventStream.registerEvent("insight.occultism.ague",(function ague(e){insight.hasDef({id:"insulation",player:e.target})?insight.removeDef({id:"insulation",player:e.target}):insight.smartAffs({ids:["shivering","frozen"],player:e.target,ordered:!0})})),eventStream.registerEvent("insight.occultism.instill",(function instill(e){insight.adjustHp({id:"percentage",player:e.target,value:-.03}),insight.adjustMana({id:"percentage",player:e.target,value:-.03}),"sensitivity"===e.affs[0]?insight.hasAff({id:"undeaf",player:e.target})?insight.addAff({id:"sensitivity",player:e.target}):insight.addAff({id:"undeaf",player:e.target}):insight.addAff({id:e.affs[0],player:e.target})})),eventStream.registerEvent("insight.occultism.enervate",(function enervate(e){insight.adjustMana({id:"percentage",player:e.target,value:-.2})})),eventStream.registerEvent("insight.occultism.attend",(function attend(e){insight.addAff({id:"undeaf",player:e.target}),insight.addAff({id:"unblind",player:e.target})})),eventStream.registerEvent("insight.occultism.shrivelTargeted",(function shrivelTargeted(e){insight.addAff({id:e.affs[0],player:e.target})})),eventStream.registerEvent("insight.occultism.shrivelArms",(function shrivelArms(e){insight.smartAffs({ids:["brokenrightarm","brokenleftarm"],player:e.target})})),eventStream.registerEvent("insight.occultism.shrivelLegs",(function shrivelLegs(e){insight.smartAffs({ids:["brokenrightarm","brokenleftarm"],player:e.target})})),eventStream.registerEvent("insight.occultism.shrivelRehit",(function shrivelRehit(e){const t=e.groups.limb.replace(" ","").toLowerCase();"arm"===t?(insight.confirmAff({id:"brokenleftarm",player:e.target,state:!0}),insight.confirmAff({id:"brokenrightarm",player:e.target,state:!0})):"leg"===t?(insight.confirmAff({id:"brokenleftleg",player:e.target,state:!0}),insight.confirmAff({id:"brokenrightleg",player:e.target,state:!0})):insight.confirmAff({id:`broken${t}`,player:e.target,state:!0})})),eventStream.registerEvent("insight.occultism.unnamableSpeak",(function unnamableSpeak(e){let t=GMCP.RoomPlayers.map((e=>e.name));nexAction.triggers.add({id:"insight.occultism.unnamableSpeak",tags:["insight"],regex:/^(\w+) pales as the blood drains from \w+ face\.$/,action:e=>{insight.addAff({id:"undeaf",player:e[1]}),t=t.filter((t=>t!==e[1]))},onRemove:()=>{console.log("onremove player",t),t.forEach((e=>insight.removeAff({id:"undeaf",player:e})))}}),eventStream.registerEvent("PromptEvent",(()=>{nexAction.triggers.remove("insight.occultism.unnamableSpeak")}),!0)})),eventStream.registerEvent("insight.occultism.unnamableVision",(function unnamableVision(e){let t=GMCP.RoomPlayers.map((e=>e.name));nexAction.triggers.add({id:"insight.occultism.unnamableVision",tags:["insight"],regex:/^(\w+) pales as the blood drains from \w+ face\.$/,action:e=>{insight.addAff({id:"unblind",player:e[1]}),t=t.filter((t=>t!==e[1]))},onRemove:()=>{t.forEach((e=>insight.removeAff({id:"unblind",player:e})))}}),eventStream.registerEvent("PromptEvent",(()=>{nexAction.triggers.remove("insight.occultism.unnamableVision")}),!0)})),eventStream.registerEvent("insight.occultism.devolve",(function devolve(e){insight.addAff({id:"shyness",player:e.target}),insight.addAff({id:"disloyalty",player:e.target})})),eventStream.registerEvent("insight.occultism.whisperingmadness",(function whisperingmadness(e){insight.addAff({id:"whisperingmadness",player:e.target})})),eventStream.registerEvent("insight.occultism.whisperingmadnessMiss",(function whisperingmadnessMiss(e){insight.occultist.whisperingmadness.forEach((t=>insight.removeAff({id:t,player:e.target})))})),eventStream.registerEvent("insight.occultism.cleanseaura",(function cleanseaura(e){insight.checkBlock("A look of sudden concern")?insight.addAff({id:"cleanseaura",player:e.target}):insight.removeAff({id:"cleanseaura",player:e.target})}))},718:()=>{eventStream.registerEvent("insight.shadowmancy.reap",(function reap(e){!insight.checkBlock("you corrupt the weapon's timestream.")&&insight.state.envenom1&&(insight.addAff({id:insight.state.envenom1,player:e.target}),insight.state.envenom1=!1)})),eventStream.registerEvent("insight.shadowmancy.cull",(function cull(e){insight.state.envenom1&&(insight.addAff({id:insight.state.envenom1,player:e.target}),insight.state.envenom1=!1)})),eventStream.registerEvent("insight.shadowmancy.degeneration",(function degeneration(e){insight.smartAffs({ids:["clumsiness","weariness","paralysis"],player:e.target,ordered:!0})})),eventStream.registerEvent("insight.shadowmancy.degenerationFull",(function degenerationFull(e){insight.confirmAffs({ids:["clumsiness","weariness","paralysis"],player:e.target,state:!0})})),eventStream.registerEvent("insight.shadowmancy.depression",(function depression(e){insight.smartAffs({ids:["depression","nausea","hypochondria"],player:e.target,ordered:!0})})),eventStream.registerEvent("insight.shadowmancy.depressionFull",(function depressionFull(e){insight.confirmAffs({ids:["depression","nausea","hypochondria"],player:e.target,state:!0}),insight.addAff({id:"anorexia",player:e.target}),insight.addAff({id:"masochism",player:e.target})})),eventStream.registerEvent("insight.shadowmancy.retribution",(function retribution(e){insight.smartAffs({ids:["retribution","justice"],player:e.target,ordered:!0})})),eventStream.registerEvent("insight.shadowmancy.retributionFull",(function retributionFull(e){insight.confirmAffs({ids:["retribution","justice"],player:e.target,state:!0}),insight.addAff({id:"anorexia",player:e.target}),insight.addAff({id:"masochism",player:e.target});const t=insight.countAffs({ids:["depression","retribution","madness","parasite"],player:e.target});insight.adjustMana({id:"percentage",value:-.05*t,player:e.target})})),eventStream.registerEvent("insight.shadowmancy.madness",(function madness(e){insight.smartAffs({ids:["shadowmadness","vertigo","hallucinations"],player:e.target,ordered:!0})})),eventStream.registerEvent("insight.shadowmancy.madnessFull",(function madnessFull(e){insight.confirmAffs({ids:["shadowmadness","vertigo","hallucinations"],player:e.target,state:!0})})),eventStream.registerEvent("insight.shadowmancy.leach",(function leach(e){insight.smartAffs({ids:["parasite","healthleech","manaleech"],player:e.target,ordered:!0})})),eventStream.registerEvent("insight.shadowmancy.leachFull",(function leachFull(e){insight.confirmAffs({ids:["parasite","healthleech","manaleech"],player:e.target,state:!0})})),eventStream.registerEvent("insight.shadowmancy.consume",(function consume(e){insight.adjustMana({id:"percentage",value:-.1,player:e.target})})),eventStream.registerEvent("insight.shadowmancy.mutilate",(function mutilate(e){insight.adjustMana({id:"percentage",value:-.4,player:e.target}),insight.adjustHp({id:"percentage",value:-.4,player:e.target})}))},473:()=>{eventStream.registerEvent("insight.tarot.magician",(function magician(e){insight.adjustMana({id:"percentage",player:e.target,value:.25})})),eventStream.registerEvent("insight.tarot.priestess",(function priestess(e){insight.adjustHp({id:"percentage",player:e.target,value:.25})})),eventStream.registerEvent("insight.tarot.lovers",(function lovers(e){insight.addAff({id:"lovers",player:e.target})})),eventStream.registerEvent("insight.tarot.aeon",(function aeon(e){insight.removeDef({id:"speed",player:e.target}),insight.addAff({id:"aeon",player:e.target})})),eventStream.registerEvent("insight.tarot.aeonStrip",(function aeonStrip(e){insight.removeDef({id:"speed",player:e.target}),setTimeout((()=>{insight.addDef({id:"speed",player:e.target})}),4250)})),eventStream.registerEvent("insight.tarot.justice",(function justice(e){insight.addAff({id:"justice",player:e.target})})),eventStream.registerEvent("insight.tarot.deathRub",(function deathRub(e){insight.hasDef({id:"insulation",player:e.target})?insight.removeDef({id:"insulation",player:e.target}):insight.addAff({id:"shivering",player:e.target})})),eventStream.registerEvent("insight.tarot.ruinateLovers",(function ruinateLovers(e){insight.addAff({id:"manaleech",player:e.target})})),eventStream.registerEvent("insight.tarot.ruinateJustice",(function ruinateJustice(e){insight.nextLine("violently spasms")||["paralysis","asthma","healthleech","haemophilia","sensitivity","clumsiness","weariness"].forEach((e=>insight.confirmAff({id:e,state:!1})))})),eventStream.registerEvent("insight.tarot.moon",(function moon(e){console.log(JSON.stringify(insight.state.queues[insight.state.lastQueue]));const t=insight.state.queues[insight.state.lastQueue].match(/FLING MOON AT \w+ (\w+)/);t?insight.addAff({id:t[1].toLowerCase(),player:e.target}):insight.smartAffs({ids:["stupidity","masochism","hallucinations","hypersomnia","confusion","epilepsy"],player:e.target})}))}},t={};function __webpack_require__(i){var r=t[i];if(void 0!==r)return r.exports;var s=t[i]={exports:{}};return e[i](s,s.exports,__webpack_require__),s.exports}(()=>{"use strict";const e=["itching","paralysis","fear","brokenrightarm","brokenleftarm","brokenrightleg","brokenleftleg","lapsingconsciousness","aeon","lovers","confusion","epilepsy","pacified","blackout","dazed","justice","slashedthroat","hellsight","peace","dazzled","shyness","dizziness","slickness","asthma","nausea","selarnia","weariness","scytherus","haemophilia","clumsiness","hallucinations","healthleech","dementia","recklessness","anorexia","masochism","impatience","stupidity","generosity","addiction","deadening","manaleech","stuttering","paranoia","agoraphobia","loneliness","claustrophobia","vertigo","hypersomnia","shivering","frozen","burning","sensitivity","hypochondria","lethargy","disloyalty","darkshade","voyria","dissonance","phlogisticated","silver","spiritburn","tenderskin","guilt","skullfractures","wristfractures","crackedribs","torntendons","indifference","retribution","shadowmadness","parasite","depression","timeloop","crushedthroat","tension","unweavingspirit","grievouswounds","pyramides","flushings","rebbies","mycalium","sandfever","crescendo","fulminated","frostbite"],t={ferrum:{bals_used:["herb"],bals_req:["herb"],blocks:["death","anorexia","sleeping"],command:"eat ferrum",order:["darkshade","haemophilia","lethargy","addiction","scytherus","nausea","flushings","unweavingbody"],prio:0},magnesium:{bals_used:["herb"],bals_req:["herb"],blocks:["death","anorexia","sleeping"],command:"eat magnesium",order:["paralysis","slickness","pyramides"],prio:0},aurum:{bals_used:["herb"],bals_req:["herb"],blocks:["death","anorexia","sleeping"],command:"eat aurum",order:["clumsiness","healthleech","sensitivity","weariness","asthma","hypochondria","rebbies","parasite"],prio:0},calamine:{bals_used:["herb"],bals_req:["herb"],blocks:["death","anorexia","sleeping"],command:"eat calamine",order:["undeaf","deafness"],delay:2.5,prio:0},argentum:{bals_used:["herb"],bals_req:["herb"],blocks:["death","anorexia","sleeping"],command:"eat argentum",order:["masochism","loneliness","vertigo","recklessness","agoraphobia","guilt","whisperingmadness","spiritburn","tenderskin"],prio:0},cuprum:{bals_used:["herb"],bals_req:["herb"],blocks:["death","anorexia","sleeping"],command:"eat cuprum",order:["pacified","peace","lovers","justice","generosity","indifference","retribution","pyre","timeloop","diminished","stridulating"],prio:0},antimony:{bals_used:["herb"],bals_req:["herb"],blocks:["death","anorexia","sleeping"],command:"eat antimony",order:["temperedcholeric","temperedmelancholic","temperedphlegmatic","temperedsanguine"],prio:0},arsenic:{bals_used:["herb"],bals_req:["herb"],blocks:["death","anorexia","sleeping"],command:"eat arsenic",order:["unblind","blindness"],prio:0},stannum:{bals_used:["herb"],bals_req:["herb"],blocks:["death","anorexia","sleeping"],command:"eat stannum",order:["claustrophobia","paranoia","confusion","hypersomnia","hallucinations","dementia","crescendo"],prio:0},plumbum:{bals_used:["herb"],bals_req:["herb"],blocks:["death","anorexia","sleeping"],order:["horror","stupidity","epilepsy","dizziness","shyness","impatience","dissonance","depression","sandfever","mycalium","shadowmadness","unweavingmind","fulminated"],command:"eat plumbum",prio:0},calcite:{bals_used:["herb"],bals_req:["herb"],blocks:["death","anorexia","sleeping"],order:["pressure"],command:"eat calcite",prio:0},ginseng:{bals_used:["herb"],bals_req:["herb"],blocks:["death","anorexia","sleeping"],command:"eat ginseng",order:["darkshade","haemophilia","lethargy","addiction","scytherus","nausea","flushings","unweavingbody"],prio:0},bloodroot:{bals_used:["herb"],bals_req:["herb"],blocks:["death","anorexia","sleeping"],command:"eat bloodroot",order:["paralysis","slickness","pyramides"],prio:0},kelp:{bals_used:["herb"],bals_req:["herb"],blocks:["death","anorexia","sleeping"],command:"eat kelp",order:["clumsiness","healthleech","sensitivity","weariness","asthma","hypochondria","rebbies","parasite"],prio:0},hawthorn:{bals_used:["herb"],bals_req:["herb"],blocks:["death","anorexia","sleeping"],command:"eat hawthorn",order:["undeaf","deafness"],delay:2.5,prio:0},lobelia:{bals_used:["herb"],bals_req:["herb"],blocks:["death","anorexia","sleeping"],command:"eat lobelia",order:["masochism","loneliness","vertigo","recklessness","agoraphobia","guilt","whisperingmadness","spiritburn","tenderskin"],prio:0},bellwort:{bals_used:["herb"],bals_req:["herb"],blocks:["death","anorexia","sleeping"],command:"eat bellwort",order:["pacified","peace","lovers","justice","generosity","indifference","retribution","pyre","timeloop","diminished","stridulating"],prio:0},ginger:{bals_used:["herb"],bals_req:["herb"],blocks:["death","anorexia","sleeping"],command:"eat ginger",order:["temperedcholeric","temperedmelancholic","temperedphlegmatic","temperedsanguine"],prio:0},bayberry:{bals_used:["herb"],bals_req:["herb"],blocks:["death","anorexia","sleeping"],command:"eat bayberry",order:["unblind","blindness"],prio:0},ash:{bals_used:["herb"],bals_req:["herb"],blocks:["death","anorexia","sleeping"],command:"eat ash",order:["claustrophobia","paranoia","confusion","hypersomnia","hallucinations","dementia","crescendo"],prio:0},goldenseal:{bals_used:["herb"],bals_req:["herb"],blocks:["death","anorexia","sleeping"],command:"eat goldenseal",order:["horror","stupidity","epilepsy","dizziness","shyness","impatience","dissonance","depression","sandfever","mycalium","shadowmadness","unweavingmind","fulminated"],prio:0},pear:{bals_used:["herb"],bals_req:["herb"],blocks:["death","anorexia","sleeping"],order:["pressure"],command:"eat pear",prio:0},smoke:{bals_used:["smoke"],bals_req:["smoke"],blocks:["death","asthma","sleeping"],command:"smoke cinnabar",order:["aeon","disloyalty","hellsight","manaleech","slickness","deadening","tension","unweavingspirit","earworm"],prio:0},cinnabar:{bals_used:["smoke"],bals_req:["smoke"],blocks:["death","asthma","sleeping"],command:"smoke cinnabar",order:["aeon","deadening","tension","unweavingspirit","earworm"],prio:0},malachite:{bals_used:["smoke"],bals_req:["smoke"],blocks:["death","asthma","sleeping"],command:"smoke malachite",prio:0},realgar:{bals_used:["smoke"],bals_req:["smoke"],blocks:["death","asthma","sleeping"],command:"smoke realgar",order:["disloyalty","hellsight","manaleech","slickness"],prio:0},elm:{bals_used:["smoke"],bals_req:["smoke"],blocks:["death","asthma","sleeping"],command:"smoke elm",order:["aeon","deadening","tension","unweavingspirit","earworm"],prio:0},skullcap:{bals_used:["smoke"],bals_req:["smoke"],blocks:["death","asthma","sleeping"],command:"smoke skullcap",prio:0},valerian:{bals_used:["smoke"],bals_req:["smoke"],blocks:["death","asthma","sleeping"],command:"smoke valerian",order:["disloyalty","hellsight","manaleech","slickness"],prio:0},caloric:{bals_used:["salve"],bals_req:["salve","restoration"],blocks:["death","slickness","sleeping"],command:"apply caloric",order:["frozen","shivering","frostbite"],prio:0},"epidermal to body":{bals_used:["salve"],bals_req:["salve","restoration"],blocks:["death","slickness","sleeping"],command:"apply epidermal to body",order:["anorexia"],prio:0},"epidermal to head":{bals_used:["salve"],bals_req:["salve","restoration"],blocks:["death","slickness","sleeping"],command:"apply epidermal to head",order:["stuttering","blindness","deafness"],prio:0},"epidermal to ears":{bals_used:["salve"],bals_req:["salve","restoration"],blocks:["death","slickness","sleeping"],command:"apply epidermal to ears",order:["deafness"],prio:0},"mending to head":{bals_used:["salve"],bals_req:["salve","restoration"],blocks:["death","slickness","sleeping"],command:"apply mending to head",order:["crushedthroat","dazzled"],prio:0},"mending to arms":{bals_used:["salve"],bals_req:["salve","restoration"],blocks:["death","slickness","sleeping"],command:"apply mending to arms",order:["brokenleftarm","brokenrightarm"],ordered:!0,prio:0},"mending to legs":{bals_used:["salve"],bals_req:["salve","restoration"],blocks:["death","slickness","sleeping"],command:"apply mending to legs",order:["brokenleftleg","brokenrightleg"],ordered:!0,prio:0},"mending to body":{bals_used:["salve"],bals_req:["salve","restoration"],blocks:["death","slickness","sleeping"],command:"apply mending to body",order:["burning"],prio:0},"restoration to head":{bals_used:["restoration"],bals_req:["salve","restoration"],blocks:["death","slickness","sleeping"],command:"apply restoration to head",order:["mangledhead","damagedhead","calcifiedskull","concussion","tonguetied"],delay:4,prio:0},"restoration to torso":{bals_used:["restoration"],bals_req:["salve","restoration"],blocks:["death","slickness","sleeping"],command:"apply restoration to torso",order:["hypothermia","heartseed","serioustrauma","mildtrauma","calcifiedtorso"],delay:4,prio:0},"restoration to arms":{bals_used:["restoration"],bals_req:["salve","restoration"],blocks:["death","slickness","sleeping"],command:"apply restoration to arms",order:["mangledleftarm","mangledrightarm","damagedleftarm","damagedrightarm"],delay:4,prio:0},"restoration to legs":{bals_used:["restoration"],bals_req:["salve","restoration"],blocks:["death","slickness","sleeping"],command:"apply restoration to legs",order:["mangledleftleg","mangledrightleg","damagedleftleg","damagedrightleg"],delay:4,prio:0},health:{bals_req:["sip"],bals_used:["sip"],blocks:["death","sleeping","anorexia"],command:"sip health",prio:0},mana:{bals_req:["sip"],bals_used:["sip"],blocks:["death","sleeping","anorexia"],command:"sip mana",prio:0},"health to head":{bals_req:["sip"],bals_used:["sip"],command:"apply health to head",order:["skullfractures"],prio:0},"health to torso":{bals_req:["sip"],bals_used:["sip"],command:"apply health to torso",order:["crackedribs","grievouswounds"],prio:0},"health to arms":{bals_req:["sip"],bals_used:["sip"],command:"apply health to arms",order:["wristfractures"],prio:0},"health to legs":{bals_req:["sip"],bals_used:["sip"],command:"apply health to legs",order:["torntendons","latched","kkractlebrand"],prio:0},fitness:{bals_req:["equilibrium","balance","fitness"],bals_used:["balance","fitness"],blocks:["death","weariness","sleeping"],skills:["Monk","Runewarden"],command:"fitness",order:["asthma"],prio:0},bloodboil:{bals_req:["equilibrium","balance","bloodboil"],bals_used:["equilibrium","bloodboil"],blocks:["death","haemophilia","sleeping",["brokenleftarm","brokenrightarm"],["brokenleftarm","damagedrightarm"],["brokenleftarm","mangledrightarm"],["damagedleftarm","brokenrightarm"],["damagedleftarm","damagedrightarm"],["damagedleftarm","mangledrightarm"],["mangledleftarm","brokenrightarm"],["mangledleftarm","damagedrightarm"],["mangledleftarm","mangledrightarm"],"entangled","transfixation","impaled","webbed","bound"],skills:["Magi"],command:"cast bloodboil",order:e,prio:0},dragonflex:{bals_req:["balance"],bals_used:["balance"],command:"dragonflex",skills:["Dragon"],order:["webbed","entangled"],prio:0},dragonheal:{bals_req:["balance","equilibrium"],bals_used:["dragonheal","equilibrium"],command:"dragonheal",skills:["Dragon"],blocks:["death","sleeping",["recklessness","weariness"]],order:e,prio:0},dwinnu:{bals_req:["voice"],bals_used:["voice"],command:"chant dwinnu",skills:["Bard"],order:["webbed","entangled"],prio:0},rage:{bals_req:["rage"],bals_used:["rage"],command:"rage",skills:["Runewarden"],order:["pacified","peace","lovers","generosity","stridulating"],prio:95},salt:{bals_req:["equilibrium","salt"],bals_used:["salt","equilibrium"],blocks:["death","stupidity","sleeping"],skills:["Alchemist"],command:"educe salt",order:e,prio:0},siphon:{bals_req:["angel"],bals_used:["angel"],blocks:["death","sleeping"],skills:["Apostate","Priest"],command:"educe salt",order:e,prio:0},shrugging:{bals_req:["equilibrium","balance","shrugging"],bals_used:["shrugging"],blocks:["death","weariness","sleeping"],skills:["Serpent"],command:"shrugging",order:e,prio:0},slough:{bals_req:["equilibrium","balance","slough"],bals_used:["slough","balance"],blocks:["death","weariness","sleeping"],skills:["Fire Elemental Lord"],command:"slough impurities",order:e,prio:0},fool:{bals_req:["equilibrium","balance","fool"],bals_used:["fool","balance"],blocks:["death","prone","paralysis","sleeping",["brokenleftarm","brokenrightarm"],["brokenleftarm","damagedrightarm"],["brokenleftarm","mangledrightarm"],["damagedleftarm","brokenrightarm"],["damagedleftarm","damagedrightarm"],["damagedleftarm","mangledrightarm"],["mangledleftarm","brokenrightarm"],["mangledleftarm","damagedrightarm"],["mangledleftarm","mangledrightarm"],"entangled","transfixation","impaled","webbed","bound"],skills:["Occultist"],command:"fling fool at me",order:e,prio:0},accelerate:{bals_req:["equilibrium","balance","accelerate"],bals_used:["accelerate","balance"],blocks:["death","sleeping","recklessness"],skills:["Depthswalker"],command:"chrono accelerate",order:e,prio:0},alleviate:{bals_req:["equilibrium","balance","alleviate"],bals_used:["alleviate","balance"],blocks:["death","paralysis","sleeping"],skills:["Blademaster"],command:"alleviate",order:e,prio:0},dagaz:{bals_req:[],bals_used:["dagaz"],blocks:["death"],skills:["Runewarden"],command:"sketch dagaz on ground",order:e,prio:0},insomnia:{bals_req:[],bals_used:[],blocks:["death","hypersomnia","sleeping"],command:"insomnia",order:["insomnia"],prio:0},focus:{bals_req:["focus"],bals_used:["focus"],blocks:["death","impatience","sleeping"],command:"focus",order:["stupidity","epilepsy","dizziness","shyness","claustrophobia","paranoia","confusion","hallucinations","dementia","pacified","peace","lovers","generosity","masochism","loneliness","vertigo","recklessness","agoraphobia","anorexia","stuttering"],prio:0},concentrate:{blocks:["death","sleeping","confusion"],command:"concentrate",order:["disrupted"],prio:0},immunity:{bals_req:["immunity"],bals_used:["immunity"],blocks:["death","sleeping","anorexia"],command:"sip immunity",order:["voyria"],prio:0},stand:{bals_req:["balance","equilibrium"],bals_used:[],blocks:["death","sleeping","paralysis","brokenrightleg","brokenleftleg","damagedleftleg","damagedrightleg","mangledrightleg","mangledleftleg","entangled","transfixation","impaled","webbed","bound"],command:"stand",order:["prone"],prio:0},tree:{bals_used:["tree"],bals_req:["tree"],blocks:["death","sleeping","paralysis",["brokenleftarm","brokenrightarm"],["brokenleftarm","damagedrightarm"],["brokenleftarm","mangledrightarm"],["damagedleftarm","brokenrightarm"],["damagedleftarm","damagedrightarm"],["damagedleftarm","mangledrightarm"],["mangledleftarm","brokenrightarm"],["mangledleftarm","damagedrightarm"],["mangledleftarm","mangledrightarm"],"entangled","transfixation","impaled","webbed","bound"],command:"touch tree",order:e,prio:0},potash:{bals_req:["moss"],bals_used:["moss"],blocks:["death","sleeping","anorexia"],command:"eat potash",prio:0},moss:{bals_req:["moss"],bals_used:["moss"],blocks:["death","sleeping","anorexia"],command:"eat moss",prio:0},restore:{bals_req:["balance","equilibrium"],bals_used:["equilibrium"],command:"restore",order:["brokenleftarm","brokenrightarm","brokenleftleg","brokenrightleg","skullfractures","torntendons","wristfractures","crackedribs"],prio:0},"touch soul":{bals_req:[],bals_used:[],command:"touch soul",blocks:["death"],order:["amnesia"],prio:101}},nextLine=e=>{let t=!1;for(let i=nexusclient.current_line.index+1;i<nexusclient.current_block.length;i++){const r=nexusclient.current_block[i];if(r.html_text||r.is_prompt||void 0===r.line)continue;const s=r.parsed_line.text();return e instanceof RegExp?t=e.test(s):"string"==typeof e&&(t=s.includes(e)),t}},capitalize=e=>e.charAt(0).toUpperCase()+e.slice(1);class Timer{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this._id=e,this._enabled=!1,this._startTime=0,this._endTime=0,this._timerId=0,this._defaultLength=t,this.setLength(t),this._callbacks=[]}get length(){return this._length}get id(){return this._id}get enabled(){return this._enabled}setLength(e){if(e<0)throw new Error("Timer length cannot be negative");this._length=e}reset(){clearTimeout(this._timerId),this._enabled=!1,this.setLength(this._defaultLength),this._endTime=performance.now()/1e3,eventStream.raiseEvent(`timerReset${this._id}`)}start(){clearTimeout(this._timerId),this._startTimer(),eventStream.raiseEvent(`timerStarted${this._id}`)}_startTimer(){this._timerId=setTimeout(this.stop.bind(this),1e3*this._length),this._enabled=!0,this._startTime=performance.now()/1e3}stop(){this._enabled&&(clearTimeout(this._timerId),this._endTime=performance.now()/1e3,this._enabled=!1,eventStream.raiseEvent(`timerStopped${this._id}`),this._callbacks.forEach((e=>e())))}duration(){return this._enabled?this.elapsed():this._endTime-this._startTime}elapsed(){return this._enabled?performance.now()/1e3-this._startTime:0}remaining(){return this._enabled?this._length-this.elapsed():this._length}addCallback(e){if("function"!=typeof e)throw new Error("Callback must be a function");this._callbacks.push(e)}clearCallbacks(){this._callbacks=[]}static createTimer(e){return new Timer(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0)}}const i=Timer.createTimer;class Affliction{constructor(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.id=e,this.player=t,this._probability=0,this._cures=Array.isArray(i)?i.slice():Array.isArray(i?.[e])?i[e].slice():[],this._have=!1}get cures(){return this._cures}get probability(){return this._probability}set probability(e){this._probability=e}set have(e){this._have=e}get have(){return this._have}setPresence(e){const t=!1!==(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).emit;this._have!==e&&(this._have=e,t&&(e?(eventStream.raiseEvent("insightGotAff",this),eventStream.raiseEvent(`insightGotAff${this.id}`,this)):(eventStream.raiseEvent("insightLostAff",this),eventStream.raiseEvent(`insightLostAff${this.id}`,this))))}got(){this._probability=1,this.setPresence(!0)}lost(){this._probability=0,this.setPresence(!1)}reset(){this._have=!1,this._probability=0}}class AffTimed extends Affliction{constructor(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;super(e,t,arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}),this.timer=i(`insightTimer${e}`,r),this.timer.addCallback((()=>{t.timeline.remove(this.id)}))}got(){const e=this.player?.runtime?.config?.disableTimers;e||this.timer.start(),super.got()}lost(){this.timer.stop(),super.lost()}reset(){this.timer.stop(),super.reset()}}class AffCountable extends Affliction{constructor(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;super(e,t,arguments.length>4&&void 0!==arguments[4]?arguments[4]:{}),this._min=i,this._max=r,this._count=i,this._prev=i}get count(){return this._count}get prev(){return this._prev}get min(){return this._min}get max(){return this._max}set count(e){this._prev=this._count,this._count=e}lost(){this.count=this._min,super.lost()}reset(){this.count=this._min,super.reset()}checkLimits(e){return e>this._max?this._max:e<this._min?this._min:e}add(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;this.count=this.checkLimits(this._count+e),this.count>this.min&&!this.have&&this.got()}subtract(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;this.count=this.checkLimits(this._count-e),this.count===this.min&&this.lost()}}const r={airfisted:0,asphyxiating:0,blistered:0,bloodfire:0,bruisedribs:0,cadmuscurse:0,coldfate:0,condemned:0,conflagration:0,constricted:0,corruption:0,cremated:0,death:0,deathsickness:0,deepsleep:0,degenerate:0,dehydrated:0,demonstain:0,deteriorate:0,empoweredloshre:0,empoweredmannaz:0,enlightenment:0,enmesh:0,ensorcelled:0,flamefisted:0,hamstrung:0,hatred:0,hecatecurse:0,hindered:0,homunculusmercury:0,icefisted:0,inquisition:0,isolation:0,kaisurge:0,lightbind:0,lullaby:0,mindclamp:0,mindravaged:0,muddled:0,numbedleftarm:0,numbedrightarm:0,palpatarfeed:0,petrified:0,phlogisticated:0,pinshot:0,revealed:0,scalded:0,scrambledbrains:0,silenced:0,silver:0,slimeobscure:0,solarburn:0,stun:0,timeflux:0,trueblind:0,vinewreathed:0,vitiated:0,vitrified:0,voidfisted:0,waterbonds:0,weakenedmind:0,unconsciousness:0,aeon:2,concussion:2,crushedthroat:2,paralysis:2,peace:2,sleeping:3,grievouswounds:3,latched:3,dazzled:3,unweavingbody:3,unweavingbody2:3,unweavingbody3:3,unweavingbody4:3,unweavingbody5:3,unweavingmind:3,unweavingmind2:3,unweavingmind3:3,unweavingmind4:3,unweavingmind5:3,unweavingspirit:3,unweavingspirit2:3,unweavingspirit3:3,unweavingspirit4:3,unweavingspirit5:3,weariness:3,prone:3,timeloop:3,fulminated:3,spiritburn:4,heartseed:4,guilt:4,tenderskin:4,pyramides:4,parasite:4,hypochondria:4,pacified:4,depression:4,confusion:4,retribution:4,shadowmadness:4,whisperingmadness:4,hellsight:4,anorexia:5,mycalium:5,flushings:5,rebbies:5,sandfever:5,asthma:5,healthleech:5,pyre3:5,impatience:6,itching:6,scytherus:6,clumsiness:6,kkractlebrand:6,damagedleftleg:6,darkshade:6,slickness:6,recklessness:6,dementia:6,pyre2:6,bound:7,daeggerimpale:7,entangled:7,sensitivity:7,transfixation:7,webbed:7,tonguetied:7,haemophilia:7,lethargy:7,manaleech:7,dissonance:7,pyre:7,skullfractures:8,skullfractures2:8,skullfractures3:8,skullfractures4:8,skullfractures5:8,skullfractures6:8,damagedrightleg:8,hypersomnia:8,earworm:8,crescendo:8,crescendo2:8,crescendo3:8,crescendo4:8,crescendo5:8,diminished:8,torntendons:9,torntendons2:9,torntendons3:9,torntendons4:9,torntendons5:9,torntendons6:9,brokenleftleg:9,brokenrightleg:9,hallucinations:9,calcifiedskull:10,calcifiedtorso:10,mangledleftleg:10,mangledrightleg:10,disrupted:10,mangledhead:10,voyria:10,crackedribs:10,crackedribs2:10,crackedribs3:10,crackedribs4:10,crackedribs5:10,crackedribs6:10,hypothermia:11,impaled:11,brokenleftarm:11,brokenrightarm:11,indifference:11,addiction:11,nausea:11,deadening:11,frozen:11,shivering:11,mildtrauma:11,internalbleeding:11,stupidity:12,wristfractures:12,wristfractures2:12,wristfractures3:12,wristfractures4:12,wristfractures5:12,wristfractures6:12,damagedleftarm:12,disloyalty:12,tension:13,damagedhead:13,dazed:13,burning:13,burning2:13,burning3:13,burning4:13,burning5:13,lovers:14,pressure:14,pressure2:14,pressure3:14,pressure4:14,pressure5:14,damagedrightarm:14,temperedcholeric:14,temperedmelancholic:14,temperedphlegmatic:14,temperedsanguine:14,mangledleftarm:15,mangledrightarm:15,agoraphobia:16,claustrophobia:16,generosity:16,justice:16,loneliness:16,vertigo:16,paranoia:17,serioustrauma:18,epilepsy:18,laceratedthroat:20,slashedthroat:20,stuttering:20,selarnia:21,fear:21,masochism:21,dizziness:23,shyness:23,horror:26,horror2:26,horror3:26,horror4:26,horror5:26,bleeding:30,amnesia:30,blackout:30,insomnia:0,deafness:0,blindness:0,harmonic:100,bop:100,spiritwrack:100,bedevil:100,loki:100,moon:100,evileye:100,dragoncurse:100,swiftcurse:100},s={...r},a=s,generateChunk=(e,t,i)=>{let r=document.createElement("span");return r.style.color=t,r.style.backgroundColor=i,r.textContent=e,r},n={antimony:{fg:"olive",bg:""},argentum:{fg:"royalblue",bg:""},arsenic:{fg:"",bg:""},aurum:{fg:"ForestGreen",bg:""},azurite:{fg:"",bg:""},calamine:{fg:"",bg:""},calcite:{fg:"slategray",bg:""},cinnabar:{fg:"greenyellow",bg:""},cuprum:{fg:"DeepSkyBlue",bg:""},ferrum:{fg:"DarkOrange",bg:""},gypsum:{fg:"",bg:""},magnesium:{fg:"Red",bg:""},plumbum:{fg:"Gold",bg:""},quartz:{fg:"",bg:""},quicksilver:{fg:"",bg:""},realgar:{fg:"firebrick",bg:""},stannum:{fg:"Tan",bg:""},caloric:{fg:"darkseagreen",bg:""},mending:{fg:"orchid",bg:""},epidermal:{fg:"sienna",bg:""},restoration:{fg:"darkviolet",bg:""},health:{fg:"lightpink",bg:""},writhe:{fg:"paleyellow",bg:"darkslategray"}},o={addiction:{shortName:"add",...n.ferrum},aeon:{shortName:"ae",...n.cinnabar},agoraphobia:{shortName:"agor",...n.argentum},amnesia:{shortName:"amn",fg:"",bg:""},anorexia:{shortName:"ANO",...n.epidermal},asthma:{shortName:"AST",...n.aurum},blackout:{shortName:"bo",fg:"",bg:""},blindness:{shortName:"unb",...n.arsenic},bound:{shortName:"bnd",...n.writhe},brokenleftarm:{shortName:"la1",...n.mending},brokenleftleg:{shortName:"ll1",...n.mending},brokenrightarm:{shortName:"ra1",...n.mending},brokenrightleg:{shortName:"rl1",...n.mending},bruisedribs:{shortName:"ribs",fg:"",bg:""},burning:{shortName:"burn",...n.mending},calcifiedskull:{shortName:"calh",...n.restoration},calcifiedtorso:{shortName:"calt",...n.restoration},claustrophobia:{shortName:"clau",...n.stannum},cleanseaura:{shortName:"cleanse",fg:"",bg:""},clumsiness:{shortName:"clu",...n.aurum},concussion:{shortName:"conc",...n.restoration},confusion:{shortName:"con",...n.stannum},corruption:{shortName:"corr",fg:"",bg:""},crackedribs:{shortName:"cr",...n.health},crushedthroat:{shortName:"cru",...n.mending},daeggerimpale:{shortName:"daeg",...n.writhe},damage:{shortName:"dmg",fg:"tomato",bg:""},damagedleftarm:{shortName:"la2",...n.restoration},damagedleftleg:{shortName:"ll2",...n.restoration},damagedrightarm:{shortName:"ra2",...n.restoration},damagedrightleg:{shortName:"rl2",...n.restoration},damagedhead:{shortName:"hd2",...n.restoration},darkshade:{shortName:"dark",...n.ferrum},dazed:{shortName:"dzd",...n.cinnabar},dazzled:{shortName:"dzl",...n.mending},deadening:{shortName:"dea",...n.cinnabar},deafness:{shortName:"und",...n.calamine},dehydrated:{shortName:"deh",fg:"",bg:""},dementia:{shortName:"dem",...n.stannum},depression:{shortName:"dep",...n.plumbum},deteriorate:{shortName:"det",fg:"",bg:""},disloyalty:{shortName:"disl",...n.realgar},disrupted:{shortName:"disr",fg:"",bg:""},dissonance:{shortName:"disso",...n.plumbum},dizziness:{shortName:"diz",...n.plumbum},enmesh:{text:"enmsh",...n.writhe},enscorcelled:{shortName:"ensor",fg:"",bg:""},entangled:{shortName:"entgl",...n.writhe},epilepsy:{shortName:"epi",...n.plumbum},fear:{shortName:"fear",fg:"",bg:""},flushings:{shortName:"flush",...n.ferrum},frostbite:{shortName:"frost",...n.caloric},frozen:{shortName:"frz",...n.caloric},fulminated:{shortName:"fulm",...n.plumbum},generosity:{shortName:"gen",...n.cuprum},grievouswounds:{shortName:"grv",...n.health},guilt:{shortName:"gui",...n.argentum},haemophilia:{shortName:"haem",...n.ferrum},hallucinations:{shortName:"hall",...n.stannum},hamstrung:{shortName:"hms",fg:"",bg:""},healthleech:{shortName:"hthl",...n.aurum},heartseed:{shortName:"heart",...n.restoration},hellsight:{shortName:"hell",...n.realgar},horror:{shortName:"hor",...n.plumbum},hypersomnia:{shortName:"hypers",...n.stannum},hypochondria:{shortName:"hypoch",...n.aurum},hypothermia:{shortName:"hypoth",...n.restoration},icefisted:{shortName:"ice",fg:"",bg:""},impaled:{shortName:"impl",...n.writhe},impatience:{shortName:"IMPAT",...n.plumbum},indifference:{shortName:"ind",...n.cuprum},itching:{shortName:"itch",...n.epidermal},justice:{shortName:"just",...n.cuprum},kkractlebrand:{shortName:"kkr",...n.health},laceratedthroat:{shortName:"lac2",...n.restoration},latched:{shortName:"latch",...n.health},lethargy:{shortName:"let",...n.ferrum},lightbind:{shortName:"light",fg:"",bg:""},loneliness:{shortName:"lon",...n.argentum},lovers:{shortName:"love",...n.cuprum},manaleech:{shortName:"man",...n.realgar},mangledleftarm:{shortName:"la3",...n.restoration},mangledleftleg:{shortName:"ll3",...n.restoration},mangledrightarm:{shortName:"ra3",...n.restoration},mangledrightleg:{shortName:"rl3",...n.restoration},mangledhead:{shortName:"hd3",...n.restoration},masochism:{shortName:"maso",...n.argentum},mildtrauma:{shortName:"tor1",...n.restoration},mycalium:{shortName:"myc",...n.plumbum},nausea:{shortName:"nau",...n.ferrum},numbedleftarm:{shortName:"nbla",fg:"",bg:""},numbedrightarm:{shortName:"nbra",fg:"",bg:""},pacified:{shortName:"pac",...n.cuprum},palpatarfeed:{shortName:"worm",fg:"",bg:""},paralysis:{shortName:"PAR",...n.magnesium},paranoia:{shortName:"prn",...n.stannum},parasite:{shortName:"prs",...n.aurum},peace:{shortName:"pea",...n.cuprum},phlogisticated:{shortName:"phlog",fg:"",bg:""},pinshot:{shortName:"psh",fg:"",bg:""},pressure:{shortName:"pres",...n.calcite},prone:{shortName:"pr",fg:"",bg:""},pyramides:{shortName:"pyra",...n.magnesium},pyre:{shortName:"pyre",...n.cuprum},rebbies:{shortName:"reb",...n.aurum},recklessness:{shortName:"reck",...n.argentum},retardation:{shortName:"ret",fg:"",bg:""},retribution:{shortName:"retr",...n.cuprum},revealed:{shortName:"rev",fg:"",bg:""},sandfever:{shortName:"sand",...n.plumbum},scalded:{shortName:"scald",...n.epidermal},scytherus:{shortName:"scy",...n.ferrum},selarnia:{shortName:"sel",...n.mending},sensitivity:{shortName:"sen",...n.aurum},serioustrauma:{shortName:"tor2",...n.restoration},shadowmadness:{shortName:"shad",...n.plumbum},shivering:{shortName:"shiv",...n.caloric},shyness:{shortName:"shy",...n.plumbum},skullfractures:{shortName:"sf",...n.health},slashedthroat:{shortName:"lac1",...n.epidermal},sleeping:{shortName:"slp",fg:"",bg:""},slickness:{shortName:"SLI",...n.magnesium},slimeobscure:{shortName:"slime",fg:"",bg:""},spiritburn:{shortName:"spirB",...n.argentum},spiritwrack:{shortName:"spirW",fg:"",bg:""},stupidity:{shortName:"st",...n.plumbum},stuttering:{shortName:"stut",...n.epidermal},homunculusmercury:{shortName:"merc",fg:"",bg:""},temperedcholeric:{shortName:"choH",...n.antimony},temperedmelancholic:{shortName:"melaH",...n.antimony},temperedphlegmatic:{shortName:"phleH",...n.antimony},temperedsanguine:{shortName:"sanH",...n.antimony},tenderskin:{shortName:"tend",...n.argentum},tension:{shortName:"tens",...n.cinnabar},timeflux:{shortName:"tmfx",fg:"",bg:""},timeloop:{shortName:"tmlp",...n.cuprum},tonguetied:{shortName:"tngt",...n.restoration},torntendons:{shortName:"tt",...n.health},transfixation:{shortName:"trfx",...n.writhe},unweavingbody:{shortName:"unwM",...n.ferrum},unweavingspirit:{shortName:"unwS",...n.cinnabar},unweavingmind:{shortName:"unwM",...n.plumbum},unblind:{shortName:"unB",fg:"",bg:""},undeaf:{shortName:"unD",fg:"",bg:""},vertigo:{shortName:"vert",...n.argentum},vitrified:{shortName:"vitri",fg:"",bg:""},voidfisted:{shortName:"void",fg:"",bg:""},voyria:{shortName:"voy",fg:"",bg:""},weariness:{shortName:"wea",...n.aurum},webbed:{shortName:"web",...n.writhe},whisperingmadness:{shortName:"wmad",...n.argentum},wristfractures:{shortName:"wf",...n.health}},colorGradation=e=>`hsl(${1.2*e}, 100%, ${e<75?50:Math.abs(e-100)/2+25}%)`,l={notice:function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i="#784695",r="#CBCE91FF",s="#FFF2D7";let a=document.createElement("span");a.setAttribute("class","mono"),a.appendChild(Object.assign(document.createElement("span"),{style:`color:${i}`,innerHTML:"<<"})),a.appendChild(Object.assign(document.createElement("span"),{style:`color:${r}`,innerHTML:"insight"})),a.appendChild(Object.assign(document.createElement("span"),{style:`color:${i}`,innerHTML:">> "})),t?a.insertAdjacentHTML("beforeend",e):a.appendChild(Object.assign(document.createElement("span"),{style:`color:${s}`,innerHTML:e})),nexusclient.add_html_line(a.outerHTML)},affUpdate:(e,t)=>{const i=document.createElement("span");let r,s;return i.setAttribute("class","mono"),r=t?generateChunk("+aff ","lime"):generateChunk("-aff ","red"),i.appendChild(r),o[e]?s=generateChunk(capitalize(e),o[e].fg||"",o[e].bg||""):(s=generateChunk(capitalize(e)),console.error("Insight.display.affUpdate() no affAbrev entry",e)),i.appendChild(s),i.outerHTML},defUpdate:(e,t)=>{const i=document.createElement("span");let r;i.setAttribute("class","mono"),r=t?generateChunk("+def ","lime"):generateChunk("-def ","red"),i.appendChild(r);const s=generateChunk(capitalize(e));return i.appendChild(s),i.outerHTML},currentAffDisplayHTML:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=document.createElement("span");t.setAttribute("class","mono"),t.appendChild(generateChunk("[","LightGoldenRodYellow"));const i=insight.currentAffs().sort(((e,t)=>(a[e]||99)-(a[t]||99)));for(let r=0;r<i.length;r++){const s=i[r],a=insight.target.affs[s].probability;if(a<e)continue;const n=!!(insight.target.affs[s]instanceof AffCountable)&&`${parseFloat(insight.target.affs[s].count.toFixed(1))}`;let l;o[s]?insight.reporting.shortNames?t.appendChild(generateChunk(`${o[s].shortName}${n||""}`,o[s].fg,o[s].bg)):t.appendChild(generateChunk(`${s}${n||""}`,o[s].fg,o[s].bg)):t.appendChild(generateChunk(s)),l=insight.currentAffs().length>1&&r!=insight.currentAffs().length-1?`: ${a}, `:`: ${a}`,t.appendChild(generateChunk(l))}return t.appendChild(generateChunk("]","LightGoldenRodYellow")),t.outerHTML},currentStatsDisplayHTML:()=>{const e={...insight.target.stats};let t=document.createElement("span");t.setAttribute("class","mono");const i=generateChunk(""+100*e.hp.percentage,colorGradation(100*e.hp.percentage));t.appendChild(i);const r=generateChunk("|");t.appendChild(r);const s=generateChunk(""+100*e.mana.percentage,colorGradation(100*e.mana.percentage));return t.appendChild(s),t.outerHTML},cureColors:n,affAbbrev:o},d={mentals:["claustrophobia","agoraphobia","lovers","dementia","epilepsy","hallucinations","confusion","stupidity","paranoia","vertigo","shyness","addiction","recklessness","masochism"],physicals:["asthma","paralysis","slickness","haemophilia","clumsiness","healthleech","sensitivity","darkshade"],bubonis:["vertigo","recklessness","confusion","masochism","paranoia","shyness","claustrophobia"],chimera:["confusion","hallucinations","agoraphobia","claustrophobia","dementia"],moon:["stupidity","masochism","hallucinations","hypersomnia","confusion","epilepsy","claustrophobia","agoraphobia"],whisperingmadness:["dementia","stupidity","confusion","hypersomnia","paranoia","hallucinations","impatience","addiction","agoraphobia","lovers","loneliness","recklessness","masochism"],justice:["paralysis","sensitivity","healthleech","haemophilia","weariness","asthma","clumsiness"]},h=["undeaf","unblind","cleanseaura","addiction","aeon","agoraphobia","airfisted","amnesia","anorexia","asphyxiating","asthma","betrayal","blackout","blindness","blistered","bloodfire","bound","breathless","brokenleftarm","brokenrightarm","brokenleftleg","brokenrightleg","bruisedribs","burning","cadmuscurse","calcifiedskull","calcifiedtorso","claustrophobia","clumsiness","coldfate","concussion","condemned","conflagration","confusion","constricted","corruption","crackedribs","cremated","crescendo","crushedthroat","daeggerimpale","damagedhead","damagedleftarm","damagedleftleg","damagedrightarm","damagedrightleg","darkshade","dazed","dazzled","deadening","deafness","death","deathsickness","deepsleep","degenerate","dehydrated","dementia","demonstain","depression","deteriorate","diminished","disloyalty","disrupted","dissonance","dizziness","earworm","empoweredmannaz","empoweredloshre","enlightenment","enmesh","ensorcelled","entangled","epilepsy","fear","flamefisted","flushings","frostbite","frozen","fulminated","generosity","grievouswounds","guilt","hamstrung","haemophilia","hallucinations","hatred","healthleech","heartseed","hecatecurse","hellsight","hindered","homunculusmercury","horror","hypersomnia","hypochondria","hypothermia","icefisted","impaled","impatience","indifference","inquisition","insomnia","internalbleeding","isolation","itching","justice","kaisurge","kkractlebrand","laceratedthroat","lapsingconsciousness","latched","lethargy","lightbind","loneliness","lovers","lovestruck","lullaby","manaleech","masochism","mildtrauma","mangledleftarm","mangledleftleg","mangledrightarm","mangledrightleg","mangledhead","mindclamp","mindravaged","muddled","mycalium","nausea","numbedleftarm","numbedrightarm","pacified","palpatarfeed","paralysis","paranoia","parasite","peace","penitence","petrified","phlogisticated","pinshot","pressure","prone","pyramides","pyre","rebbies","recklessness","reeling","retribution","revealed","sandfever","scalded","scrambledbrains","scytherus","selarnia","sensitivity","serioustrauma","shadowmadness","shivering","shyness","silenced","silver","skullfractures","slashedthroat","sleeping","slickness","slimeobscure","snared","solarburn","speechless","spiritburn","stridulating","stun","stupidity","stuttering","succumbed","temperedcholeric","temperedmelancholic","temperedphlegmatic","temperedsanguine","tenderskin","tension","timeflux","timeloop","tonguetied","torntendons","transfixation","trueblind","unweavingbody","unweavingmind","unweavingspirit","vertigo","vinewreathed","vitiated","vitrified","voidfisted","voyria","waterbonds","weakenedmind","weariness","webbed","woeconstrained","whisperingmadness","wristfractures","unconsciousness","harmonic","bop","spiritwrack","bedevil","loki","moon","evileye","dragoncurse","swiftcurse"],m={aeon:{length:16},airfisted:{length:16},betrayal:{length:15},blackout:{length:4},blistered:{length:15},breathless:{length:3},bruisedribs:{length:30},cadmuscurse:{length:20},condemned:{length:20},constricted:{length:30},corruption:{length:45},dazzled:{length:60},dehydrated:{length:60},demonstain:{length:120},empoweredloshre:{length:12},empoweredmannaz:{length:20},enmesh:{length:5},ensorcelled:{length:20},flamefisted:{length:30},hamstrung:{length:9},heartseed:{length:11},hecatecurse:{length:16},icefisted:{length:30},internalbleeding:{length:30},inquisition:{length:30},kaisurge:{length:15},lightbind:{length:22},lovestruck:{length:5},mindravaged:{length:20},muddled:{length:12},numbedleftarm:{length:7.5},numbedrightarm:{length:7.5},petrified:{length:10},palpatarfeed:{length:19},phlogisticated:{length:45},pinshot:{length:18},reeling:{length:20},revealed:{length:60},scalded:{length:20},scrambledbrains:{length:60},silenced:{length:20},silver:{length:180},slimeobscure:{length:60},solarburn:{length:5},snared:{length:20},speechless:{length:300},stridulating:{length:15},stun:{length:3},succumbed:{length:30},timeflux:{length:60},trueblind:{length:6},unconsciousness:{length:10},vinewreathed:{length:30},vitrified:{length:45},voidfisted:{length:5},waterbonds:{length:30},weakenedmind:{length:60},woeconstrained:{length:30}},g={pressure:{min:0,max:5},crescendo:{min:0,max:5},unweavingbody:{min:0,max:5},unweavingspirit:{min:0,max:5},unweavingmind:{min:0,max:5},burning:{min:0,max:5},horror:{min:0,max:5},pyre:{min:0,max:3},temperedcholeric:{min:0,max:8},temperedmelancholic:{min:0,max:8},temperedphlegmatic:{min:0,max:8},temperedsanguine:{min:0,max:8},torntendons:{min:0,max:6},crackedribs:{min:0,max:6},skullfractures:{min:0,max:6},wristfractures:{min:0,max:6}},c=new Set;for(let e in t){const i=t[e];i.bals_used?.includes("herb")&&i.order&&i.order.forEach((e=>c.add(e)))}const f=new Set;for(let e in t){const i=t[e];i.order&&(i.bals_used?.includes("salve")||i.bals_used?.includes("restoration"))&&i.order.forEach((e=>f.add(e)))}const u=new Set;for(let e in t){const i=t[e];i.bals_used?.includes("smoke")&&i.order&&i.order.forEach((e=>u.add(e)))}const p=new Set(t.focus.order),b=(()=>{const e={};return Object.keys(t).forEach((i=>{const r=t[i].order;Array.isArray(r)&&r.forEach((t=>{e[t]||(e[t]=[]),e[t].push(i)}))})),e})(),y={lovers:/^(\w+) shakes \w+ head and a look of clarity returns to \w+ eyes\.$/,shadowmadness:/^Lucidity returns to the eyes of (\w+)\.$/,whisperingmadness:/^(\w+) ceases \w+ violent trembling\.$/};class Balance{constructor(e,t,r){this.id=e,this.player=t,this.have=!0,this.timer=i(`insightTimer${e}`,r),this.timer.addCallback(this.got.bind(this))}got(){this.have=!0,eventStream.raiseEvent("insightGotBal",this),eventStream.raiseEvent(`insightGotBal${this.id}`,this),this.timer.stop()}lost(){this.have=!1,eventStream.raiseEvent("insightLostBal",this),eventStream.raiseEvent(`insightLostBal${this.id}`,this),this.timer?.start()}reset(){this.have=!0,this.timer.reset()}}const v=[{id:"balance",duration:2},{id:"equilibrium",duration:2},{id:"sip",duration:4.5},{id:"herb",duration:1.5},{id:"smoke",duration:1.5},{id:"salve",duration:1},{id:"restoration",duration:4},{id:"focus",duration:2.5},{id:"tree",duration:15},{id:"accelerate",duration:10},{id:"alleviate",duration:10},{id:"bloodboil",duration:10},{id:"dragonheal",duration:20},{id:"fitness",duration:10},{id:"fool",duration:30},{id:"salt",duration:10},{id:"shrugging",duration:12},{id:"slough",duration:10},{id:"dagaz",duration:20},{id:"generic",duration:12}],k=v.map((e=>({id:e.id,duration:.75*e.duration}))),A=(k.reduce(((e,t)=>(e[t.id]=t.duration,e)),{}),v.reduce(((e,t)=>(e[t.id]=t.duration,e)),{}));class Defence{constructor(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.id=e,this.player=t,this.have=i,this.defaultValue=i}got(){this.have?this.have=!0:(this.have=!0,eventStream.raiseEvent("insightGotDef",this),eventStream.raiseEvent(`insightGotDef${this.id}`,this))}lost(){this.have?(this.have=!1,eventStream.raiseEvent("insightLostDef",this),eventStream.raiseEvent(`insightLostDef${this.id}`,this)):this.have=!1}reset(){this.have=this.defaultValue}}class DefTimed extends Defence{constructor(e,t){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;super(e,t,!(arguments.length>2&&void 0!==arguments[2])||arguments[2]),this.timer=i(`insightTimer${e}`,r),this.timer.addCallback(this.lost.bind(this))}got(){this.timer.start(),super.got()}lost(){this.timer.stop(),super.lost()}reset(){this.timer.stop(),super.reset()}}const w={insomnia:!0,insulation:!0,temperence:!0,frost:!0,kola:!0,speed:!0,shield:!1,rebounding:!0,prismatic:!1,cloak:!0,fangbarrier:!0,curseward:!1,selfishness:!0},_={tentacles:{have:!1,length:180}};class Stat{constructor(e){let{id:t,player:i,value:r}=e;this.id=t,this.player=i,this._value=r,this._max=r,this._percentage=1}get value(){return this._value}get max(){return this._max}get percentage(){return this._percentage}set value(e){this._value=e,this._percentage=parseFloat((this._value/this._max).toFixed(3))}set max(e){this._max=e,this._percentage=parseFloat((this._value/this._max).toFixed(3))}set percentage(e){this._percentage=e,this._value=parseInt(this._max*this._percentage)}reset(){this._value=this._max,this._percentage=1}}const E={hp:8e3,mana:8e3};class Limb{constructor(e){let{id:t,player:r}=e;this.id=t,this.player=r,this.percent=0,this.timer=i(`insightTimer${t}`,180),this.timer.addCallback(this.reset.bind(this))}hit(e){this.percent+=e,this.percent>=100?this.break():this.timer.start(),eventStream.raiseEvent("insightLimbHit",this),eventStream.raiseEvent(`insightLimbHit${this.id}`,this)}break(){this.percent=0,eventStream.raiseEvent("insightLimbBreak",this),eventStream.raiseEvent(`insightLimbBreak${this.id}`,this),this.timer.stop()}reset(){this.percent=0,this.timer.stop(),eventStream.raiseEvent("insightLimbReset",this),eventStream.raiseEvent(`insightLimbReset${this.id}`,this)}set(e){this.percent=e,this.percent>=100?this.break():this.timer.start()}}const S=["head","torso","leftleg","leftarm","rightleg","rightarm"];class Fork{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.probability=e,this.affs=t}}const matchesConditional=(e,t,i)=>{switch(t){case">=":return e>=i;case"<=":return e<=i;case"<":return e<i;case"=":return e==i;case">":return e>i;case"!=":return e!==i;default:return console.error(`Invalid conditional: ${t}`),!0}};class Timeline{constructor(e){let{affs:t,player:i,runtime:r}=e;this.player=i,this.affs=t,this.runtime=r,this.present=[new Fork],this.currentAffs=[],this.history=[],this.maxCountKey=this.calculateMaxCountKey()}log(e){if(this.runtime?.state?.logging){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];console.log(e,...i)}}calculateMaxCountKey(){let e=1;return Object.values(this.affs).forEach((t=>{t instanceof AffCountable&&(e=Math.max(e,t.max||1))})),Math.max(2,e+1)}reset(){this.present=[new Fork],this.currentAffs=[],this.history=[]}add(e){this.runtime?.state?.logging&&this.log(`add(${e})`);const t=this.affs[e];if(!t)return;const i=t instanceof AffCountable;for(const r of this.present)if(i){const i=r.affs[e]||t.min;r.affs[e]=t.checkLimits(i+1)}else r.affs[e]=!0;t.got(),this.history.push(e),this.updateAffs()}remove(e){this.runtime?.state?.logging&&this.log(`remove(${e})`);const t=this.affs[e];t&&(t.lost(),this.present.forEach((t=>{delete t.affs[e]})),this.pruneDuplicates(),this.updateAffs())}random(e){if(this.runtime?.state?.logging&&this.log(`random(${e})`),!Array.isArray(e))return;const t=[];e.forEach((e=>{for(const i of this.present){const r=new Fork(i.probability,{...i.affs});if(!r.affs[e]){const t=this.affs[e];t&&t.setPresence(!0,{emit:!1}),r.affs[e]=!0}t.push(r)}})),this.present=t.length>0?t:[new Fork],this.pruneDuplicates(),this.updateAffs()}smart(e){if(this.runtime?.state?.logging&&this.log(`smart(${e})`),!Array.isArray(e))return;const t=[];e.forEach((e=>{for(const i of this.present)if(!i.affs[e]){const r=this.affs[e];r&&r.setPresence(!0,{emit:!1}),t.push(new Fork(i.probability,{...i.affs,[e]:!0}))}})),this.present.forEach((i=>{e.every((e=>i.affs[e]))&&t.push(i)})),t.length>0&&(this.present=t),this.pruneDuplicates(),this.updateAffs()}ordered(e){if(this.runtime?.state?.logging&&this.log(`ordered(${e})`),!Array.isArray(e))return;const t=[];for(const i of this.present)for(const r of e)if(!i.affs[r]){const e=this.affs[r];e&&e.setPresence(!0,{emit:!1}),t.push(new Fork(i.probability,{...i.affs,[r]:!0}));break}this.present.forEach((i=>{e.every((e=>i.affs[e]))&&t.push(new Fork(i.probability,{...i.affs}))})),t.length>0&&(this.present=t),this.pruneDuplicates(),this.updateAffs()}applyCureToForks(e,i){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const s=t[i];if(!s||!Array.isArray(s.order))return{forks:e,applied:!1};const a=!0===r.ignoreConfirmations,n=r.forcedAffId,o=s.order,l=[];let d=!1;return e.forEach((e=>{let r;r=o.length>50||o.includes("dissonance")?(e=>{const i=t.caloric?.order||[],r=i.find((t=>e.includes(t)));let s;if(r){let t=!1;s=e.filter((e=>e!==r||t?!i.includes(e):(t=!0,!0)))}else s=e;if(!s.includes("dissonance"))return s;const a=t.goldenseal?.order?.find((e=>s.includes(e)));return a?s.filter((e=>"dissonance"!==e)):s})(Object.keys(e.affs)):s.ordered?((e,i)=>{const r=t[i]?.order||[],s=r.find((t=>e.includes(t)));if(!s)return e;let a=!1;return e.filter((e=>e!==s||a?!r.includes(e):(a=!0,!0)))})(Object.keys(e.affs),i):Object.keys(e.affs);let h=r.filter((e=>o.includes(e)));if(a||(h=h.filter((e=>!(y[e]&&!nextLine(y[e]))))),n){if(!h.includes(n))return;h=[n]}if(this.runtime?.state?.logging&&this.log("curableAffs",h),0!==h.length){d=!0;for(const t of h){const i=this.affs[t];if(!i)continue;const r=i instanceof AffCountable,s={...e.affs};if(r){const e=s[t]||i.min,r=i.checkLimits(e-1);r<=i.min?delete s[t]:s[t]=r}else delete s[t];l.push(new Fork(e.probability/h.length,s))}}})),{forks:d?l:e,applied:d}}cure(e){this.runtime?.state?.logging&&this.log(`cure(${e})`);const t=this.applyCureToForks(this.present,e);t.applied&&(this.present=t.forks),this.pruneDuplicates(),this.updateAffs(),this.history.push(e)}confirm(e,t){this.runtime?.state?.logging&&this.log(`confirm(${e}, ${t})`);const i=this.affs[e];if(!i)return;const{probability:r}=i;if(t&&1===r||!t&&0===r)return;if(t&&0===r)return void this.add(e);if(!t&&1===r)return void this.remove(e);const s=this.present.filter((i=>Object.prototype.hasOwnProperty.call(i.affs,e)===t));this.present=s.length>0?s:[new Fork],this.history.push(`${e}:${t}`),this.pruneDuplicates(),this.updateAffs()}confirmMultiple(e,t){if(this.runtime?.state?.logging&&this.log(`confirmMultiple(${e}, ${t})`),!Array.isArray(e))return;const i=this.present.filter((i=>t?e.every((e=>Object.prototype.hasOwnProperty.call(i.affs,e))):e.every((e=>!Object.prototype.hasOwnProperty.call(i.affs,e)))));this.present=i.length>0?i:[new Fork],this.pruneDuplicates(),this.updateAffs()}confirmByAfflictionPoolCount(e){let{ids:t,count:i,conditional:r}=e;if(this.runtime?.state?.logging&&this.log(`confirmByAfflictionPoolCount({ affIds: ${t}, count: ${i}, conditional: ${r}})`),!Array.isArray(t))return;const s=[];let a=0;for(const e of this.present){let n=0;for(const i of t)e.affs[i]&&(n+=1);matchesConditional(n,r,i)&&(s.push(e),a+=e.probability)}s.length>0&&a>0?(s.forEach((e=>{e.probability/=a})),this.present=s):this.present=[new Fork],this.pruneDuplicates(),this.updateAffs()}confirmAfflictionLevel(e){let{id:t,count:i,conditional:r}=e;this.runtime?.state?.logging&&this.log(`confirmAfflictionLevel({ affId: ${t}, count: ${i}, conditional: ${r}})`);const s=[];let a=0;for(const e of this.present){let n=0;e.affs[t]>0&&(n=e.affs[t]);matchesConditional(n,r,i)&&(s.push(e),a+=e.probability)}s.length>0&&a>0?(s.forEach((e=>{e.probability/=a})),this.present=s):this.present=[new Fork],this.pruneDuplicates(),this.updateAffs()}convert(e,t){this.runtime?.state?.logging&&this.log(`convert(${e}, ${t})`),this.affs[e]&&this.affs[t]&&this.affs[e].have&&(this.affs[t].got(),this.present.forEach((i=>{i.affs[e]&&(i.affs[t]=i.affs[e],delete i.affs[e])})),this.pruneDuplicates(),this.updateAffs())}pruneDuplicates(){if(this.runtime?.state?.logging&&this.log("pruneDuplicates()",JSON.stringify(this.present)),1===this.present.length)return void(this.present[0].probability=1);const e=new Map;for(const t of this.present){const i=Object.entries(t.affs).map((e=>{let[t,i]=e;const r=!0===i?1:i;return(this.affs[t]?.index??0)*this.maxCountKey+r}));i.sort(((e,t)=>e-t));const r=i.join(",");if(e.has(r)){e.get(r).probability+=t.probability}else e.set(r,new Fork(t.probability,{...t.affs}))}let t=Array.from(e.values()),i=t.reduce(((e,t)=>e+t.probability),0);i>0&&(t=t.map((e=>new Fork(e.probability/i,e.affs))));const r=this.runtime?.config?.pruneThreshold??0;if(r>0){const e=t.filter((e=>e.probability>=r));e.length>0&&(t=e),i=t.reduce(((e,t)=>e+t.probability),0),i>0&&(t=t.map((e=>new Fork(e.probability/i,e.affs))))}this.present=t.length>0?t:[new Fork]}updateAffs(){this.runtime?.state?.logging&&this.log("updateAffs()");const e={};for(const t of this.present)for(const[i]of Object.entries(t.affs))e[i]=(e[i]||0)+t.probability;const t=new Set(Object.keys(e)),i=this.currentAffs.filter((e=>!t.has(e)));this.currentAffs=Array.from(t).sort(((e,t)=>(this.affs[e]?.index??0)-(this.affs[t]?.index??0)));const r=this.runtime?.config?.probabilityPrecision??2;for(const t of this.currentAffs){const i=this.affs[t];if(i&&(i.have||i.setPresence(!0),i.probability=parseFloat(e[t].toFixed(r)),i instanceof AffCountable)){let r=0;for(const e of this.present)if(e.affs[t]){const i=e.affs[t];r+=(!0===i?1:i)*e.probability}i.count=r/e[t]}}for(const e of i){const t=this.affs[e];t&&t.lost()}this.runtime?.queueAffUpdate?this.runtime.queueAffUpdate(this.player):eventStream.raiseEvent("insightAffsUpdated")}}class Player{constructor(e,t){this.runtime=t,this._id=e.toLowerCase(),this._properName=capitalize(e.toLowerCase()),this._class=null,this._affs=(e=>{const t={};let i=0;return h.forEach((r=>{let s;s=m[r]?new AffTimed(r,e,m[r].length,b[r]):g[r]?new AffCountable(r,e,g[r].min,g[r].max,b[r]):new Affliction(r,e,b[r]),s.index=i,t[r]=s,i++})),t})(this),this._defs=(e=>{const t={};for(const i in w)Object.hasOwnProperty.call(w,i)&&(t[i]=new Defence(i,e,w[i]));for(const i in _)Object.hasOwnProperty.call(_,i)&&(t[i]=new DefTimed(i,e,_[i].have,_[i].length));return t})(this),this._stats=(e=>{const t={};for(const i in E)Object.hasOwnProperty.call(E,i)&&(t[i]=new Stat({id:i,value:E[i],player:e}));return t})(this),this._bals=(e=>{const t={};return k.forEach((i=>t[i.id]=new Balance(i.id,e,i.duration))),t.restoration.location="restoration to torso",t.restoration.timer.addCallback((function restorationCure(){e.timeline.cure(e.bals.restoration.location)})),t})(this),this._limbs=(e=>{const t={};return S.forEach((i=>t[i]=new Limb({id:i,player:e}))),t})(this),this._timeline=new Timeline({affs:this._affs,player:this,runtime:this.runtime})}get id(){return this._id}get properName(){return this._properName}get class(){return this._class}set class(e){this._class=e??null}get affs(){return this._affs}get defs(){return this._defs}get stats(){return this._stats}get bals(){return this._bals}get limbs(){return this._limbs}get timeline(){return this._timeline}get currentAffs(){return this.timeline.currentAffs}get present(){return this.timeline.present}reset(){this.timeline.reset();for(const e in this.stats)this.stats[e].reset();for(const e in this.defs)this.defs[e].reset();for(const e in this.bals)this.bals[e].reset();for(const e in this.limbs)this.limbs[e].reset();for(const e in this.affs)Object.prototype.hasOwnProperty.call(this.affs,e)&&this.affs[e].reset()}}const x=["focus","herb","smoke","salve","restoration","sip","tree","balance","equilibrium"],normalizeClass=e=>{if("string"!=typeof e)return null;const t=e.trim();return t?t.toLowerCase():null},forkHasAff=(e,t)=>{const i=e.affs[t];return"number"==typeof i?i>0:!!i},forkHasBlocker=(e,t)=>!(!Array.isArray(t)||0===t.length)&&t.some((t=>Array.isArray(t)?t.every((t=>forkHasAff(e,t))):forkHasAff(e,t))),pickAffsForCure=(e,t,i,r)=>{const a=i[t];if(!a)return null;const n=r[t]||{};let o=null,l=null;return Object.keys(e.affs).forEach((e=>{if(!a.has(e))return;const t=(e=>{const t=s[e];return"number"==typeof t?t:99})(e),i=n[e]??Number.MAX_SAFE_INTEGER;(!o||t<o.prio||t===o.prio&&i<o.orderIndex)&&(o={affId:e,prio:t,orderIndex:i}),(!l||t>l.prio||t===l.prio&&i>l.orderIndex)&&(l={affId:e,prio:t,orderIndex:i})})),o&&l?{best:o,worst:l}:null},formatElapsed=e=>"number"!=typeof e||Number.isNaN(e)?"?":e.toFixed(1);class PredictiveCuring{constructor(e){this.runtime=e;const i=(()=>{const e={},i={},r={};Object.keys(t).forEach((s=>{if("generic"===s)return;const a=t[s];if(!Array.isArray(a.order))return;if(!Array.isArray(a.bals_used)||0===a.bals_used.length)return;const n=a.bals_used[0];e[n]||(e[n]=[]),e[n].push(s);const o=new Set,l={};a.order.forEach(((e,t)=>{o.add(e),l[e]=t})),i[s]=o,r[s]=l}));const s={};return Object.entries(e).forEach((e=>{let[i,r]=e,a=null;r.forEach((e=>{const i=t[e],r=(Array.isArray(i?.blocks)?i.blocks:[]).filter((e=>"string"==typeof e));if(!a)return void(a=new Set(r));const s=new Set;a.forEach((e=>{r.includes(e)&&s.add(e)})),a=s})),s[i]=a||new Set})),{curesByBalance:e,commonBlockersByBalance:s,cureAffSets:i,cureOrderIndexes:r}})();this.curesByBalance=i.curesByBalance,this.commonBlockersByBalance=i.commonBlockersByBalance,this.cureAffSets=i.cureAffSets,this.cureOrderIndexes=i.cureOrderIndexes,this.balanceOrder=((e,t)=>{const i=Array.isArray(e)?e.slice():x.slice(),r=new Set,s=[];return i.forEach((e=>{t[e]&&!r.has(e)&&(s.push(e),r.add(e))})),Object.keys(t).forEach((e=>{r.has(e)||(s.push(e),r.add(e))})),s})(e?.config?.predictiveBalanceOrder,this.curesByBalance),this.idleDelayMs=e?.config?.predictiveIdleDelayMs??250,this.enabled=!1,this.active=new Map}now(){const e=this.runtime?.config?.predictiveNow;return"function"==typeof e?e():"undefined"!=typeof performance&&performance.now?performance.now()/1e3:Date.now()/1e3}isActive(e){return this.active.has(e)}createState(e,t){const i={};return Object.keys(A).forEach((r=>{const s=e.bals?.[r],a=A[r];let n=a;if(s?.have)n=0;else if(s?.timer?.enabled){const e=Math.max(0,s.timer.duration());n=Math.max(0,a-e)}i[r]={duration:a,readyAt:t+n}})),{player:e,balances:i,timerId:null,startTime:t}}ensureState(e,t){const i=this.active.get(e.id);if(i)return i;const r=this.createState(e,t);return this.active.set(e.id,r),r}start(e){const t=this.runtime?.ensurePlayer(e);if(!t)return;this.enabled=!0;const i=this.now(),r=this.active.get(t.id);r&&(clearTimeout(r.timerId),this.active.delete(t.id));const s=this.createState(t,i);this.active.set(t.id,s),this.schedule(s)}startAll(){this.enabled=!0,Object.values(this.runtime.players).forEach((e=>{this.start(e.id)}))}stop(e){const t=this.runtime.normalizePlayerId(e);if(!t)return;const i=this.active.get(t);i&&(clearTimeout(i.timerId),this.active.delete(t))}stopAll(){this.enabled=!1,this.active.forEach((e=>{clearTimeout(e.timerId)})),this.active.clear()}schedule(e){if(clearTimeout(e.timerId),!this.enabled)return;const t=e.player;if(!t||0===t.currentAffs.length)return void this.stop(t?.id);const i=this.now();let r=1/0;if(this.balanceOrder.forEach((t=>{const i=e.balances[t];i&&(r=Math.min(r,i.readyAt))})),!Number.isFinite(r))return;const s=Math.max(0,1e3*(r-i));e.timerId=setTimeout((()=>this.step(e)),s)}step(e){if(!this.enabled)return;const t=e.player;if(!t||0===t.currentAffs.length)return void this.stop(t?.id);const i=this.now();this.stepAt(e,i,{schedule:!0})}stepNow(e,t){const i=this.runtime?.ensurePlayer(e);if(!i)return null;const r="number"!=typeof t||Number.isNaN(t)?this.now():t,s=this.ensureState(i,r);return this.stepAt(s,r,{schedule:!1,force:!0})}stepAt(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=e.player;if(!r||0===r.currentAffs.length)return i.schedule&&this.stop(r?.id),{time:t,elapsed:0,applied:[],updated:!1};const s=t-e.startTime;let a=!1;const n=[];if(this.balanceOrder.forEach((i=>{const o=e.balances[i];if(!o||o.readyAt>t)return;const l=this.buildPlanForBalance(r,i,e,t);if(!l||0===l.size)return;if(l.size>1){console.error(`[predictive] ERROR: plan has ${l.size} cures for balance ${i}:`,Array.from(l.keys()));const e=Array.from(l.keys())[0],t=l.get(e);l.clear(),l.set(e,t)}const d=this.applyPlan(r,l,{elapsed:s,balanceId:i});d?.applied?.length&&n.push(...d.applied),this.consumeBalances(l,e,t),a=!0})),a)r.timeline.pruneDuplicates(),r.timeline.updateAffs();else if(i.schedule)return this.scheduleWithIdle(e),{time:t,elapsed:s,applied:n,updated:!1};i.schedule&&this.schedule(e);const o={};return Object.keys(e.balances).forEach((t=>{o[t]=e.balances[t].readyAt})),{time:t,elapsed:s,applied:n,balances:o,updated:!0}}scheduleWithIdle(e){if(clearTimeout(e.timerId),!this.enabled)return;const t=Math.max(0,this.idleDelayMs);e.timerId=setTimeout((()=>this.step(e)),t)}applyPlan(e,i){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const s=e.timeline.present,a=new Set,n=[],o=this.runtime?.config?.predictiveCureMode||"random",l=r.elapsed,d=r.balanceId,h=[];i.forEach(((i,r)=>{if("random"===o){const m=i,g=t[r]?.command||r;console.log(`[predictive] ${e.id} ${formatElapsed(l)}s ${g}${d?` (${d})`:""}`);const c=m.map((e=>s[e])),f=e.timeline.applyCureToForks(c,r,{ignoreConfirmations:!0});return f.applied?n.push(...f.forks):n.push(...c),h.push({cureId:r,action:g,affId:null,balanceId:d,mode:o}),void m.forEach((e=>a.add(e)))}i.forEach(((i,m)=>{const g=t[r]?.command||r;console.log(`[predictive] ${e.id} ${formatElapsed(l)}s ${g} -> ${m}${d?` (${d})`:""}`);const c=i.map((e=>s[e])),f=e.timeline.applyCureToForks(c,r,{ignoreConfirmations:!0,forcedAffId:m});f.applied?n.push(...f.forks):n.push(...c),h.push({cureId:r,action:g,affId:m,balanceId:d,mode:o}),i.forEach((e=>a.add(e)))}))}));for(let e=0;e<s.length;e+=1)a.has(e)||n.push(s[e]);return e.timeline.present=n,{applied:h}}consumeBalances(e,i,r){const s=new Set;e.forEach(((e,i)=>{const r=t[i];Array.isArray(r?.bals_used)&&r.bals_used.forEach((e=>s.add(e)))})),s.forEach((e=>{const t=i.balances[e];t&&(t.readyAt=r+this.getBalanceDuration(i,e),"focus"===e&&i.player?.flags?.focusSycophant&&delete i.player.flags.focusSycophant)}))}getBalanceDuration(e,t){const i=e.balances?.[t]?.duration??0;if("focus"!==t)return i;const r=e.player;return r?.flags?.focusSycophant?5:r?.affs?.whisperingmadness?.have?4:i}buildPlanForBalance(e,i,r,s){const a=this.curesByBalance[i];if(!Array.isArray(a)||0===a.length)return null;const n=e.timeline.present,o=this.commonBlockersByBalance[i],l=new Map,d=this.runtime?.config?.predictiveCureMode||"random";let h=null;return n.forEach(((i,n)=>{if(o&&o.size>0)for(const e of o)if(forkHasAff(i,e))return;let l=null;a.forEach((a=>{const o=t[a];if(!o)return;if(!((e,t)=>{if(!Array.isArray(e?.skills)||0===e.skills.length)return!0;const i=normalizeClass(t?.class);return!!i&&e.skills.some((e=>normalizeClass(e)===i))})(o,e))return;if(forkHasBlocker(i,o.blocks))return;if(!this.areBalancesReady(o,r,s))return;const d=pickAffsForCure(i,a,this.cureAffSets,this.cureOrderIndexes);if(!d)return;const{best:h,worst:m}=d;(!l||h.prio<l.best.prio||h.prio===l.best.prio&&h.orderIndex<l.best.orderIndex||h.prio===l.best.prio&&h.orderIndex===l.best.orderIndex&&a<l.cureId)&&(l={cureId:a,best:h,worst:m,forkIndex:n})})),l&&(!h||l.best.prio<h.best.prio||l.best.prio===h.best.prio&&l.best.orderIndex<h.best.orderIndex||l.best.prio===h.best.prio&&l.best.orderIndex===h.best.orderIndex&&l.cureId<h.cureId)&&(h=l)})),h?(console.log(`[predictive] buildPlanForBalance(${i}): selected ${h.cureId}`),n.forEach(((e,i)=>{if(o&&o.size>0)for(const t of o)if(forkHasAff(e,t))return;const r=t[h.cureId];if(!r)return;if(forkHasBlocker(e,r.blocks))return;const s=pickAffsForCure(e,h.cureId,this.cureAffSets,this.cureOrderIndexes);if(!s)return;if("random"===d)return l.has(h.cureId)||l.set(h.cureId,[]),void l.get(h.cureId).push(i);const{best:a,worst:n}=s,m="worst"===d?n.affId:a.affId;l.has(h.cureId)||l.set(h.cureId,new Map);const g=l.get(h.cureId);g.has(m)||g.set(m,[]),g.get(m).push(i)})),l):null}areBalancesReady(e,t,i){return!Array.isArray(e.bals_req)||e.bals_req.every((e=>{const r=t.balances[e];return r&&r.readyAt<=i}))}}const N={pruneThreshold:0,probabilityPrecision:2,batchAffUpdatesOnPrompt:!0,affUpdateSafetyFlushMs:200,predictiveEnabled:!1,predictiveCureMode:"random",predictiveBalanceOrder:null,predictiveIdleDelayMs:250,disableTimers:!1},createReporting=()=>({promptDisplay:!0,shouldShow:!1,notices:!1,shortNames:!0,colors:!0,logging:!1,probabilityThreshold:0,log(e){this.logging&&console.log(e)}}),C=/^[A-Za-z]+$/;const $=new class InsightRuntime{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.config={...N,...e},this.players={},this.target=null,this.state={emoteColor:"#afffff",lastQueue:!1,queues:{},serverAliases:{},logging:!1},this.reporting=createReporting(),this.pendingAffUpdate=!1,this.pendingAffUpdateTimer=null,this.predictive=new PredictiveCuring(this),this.config.predictiveEnabled&&this.predictive.startAll()}normalizePlayerId(e){if("string"!=typeof e)return null;const t=e.trim();return t&&C.test(t)?t.toLowerCase():null}getPlayer(e){const t=this.normalizePlayerId(e);return t&&this.players[t]||null}ensurePlayer(e){const t=this.normalizePlayerId(e);return t?(this.players[t]||(this.players[t]=new Player(t,this),this.predictive?.enabled&&this.predictive.start(t)),this.players[t]):null}setTarget(e){const t=this.ensurePlayer(e);return t&&(this.target=t),t}reset(e){if("string"==typeof e&&"all"===e.toLowerCase())return Object.values(this.players).forEach((e=>e.reset())),void this.predictive?.stopAll();const t="string"==typeof e?this.ensurePlayer(e):this.target;t?.reset(),this.predictive?.stop(t?.id)}queueAffUpdate(e){if(this.config.batchAffUpdatesOnPrompt){if(!this.pendingAffUpdate){this.pendingAffUpdate=!0;const e=this.config.affUpdateSafetyFlushMs;"number"==typeof e&&e>0&&(clearTimeout(this.pendingAffUpdateTimer),this.pendingAffUpdateTimer=setTimeout((()=>this.flushAffUpdates()),e))}}else"undefined"!=typeof eventStream&&eventStream.raiseEvent("insightAffsUpdated")}flushAffUpdates(){this.config.batchAffUpdatesOnPrompt&&this.pendingAffUpdate&&(this.pendingAffUpdate=!1,clearTimeout(this.pendingAffUpdateTimer),this.pendingAffUpdateTimer=null,"undefined"!=typeof eventStream&&eventStream.raiseEvent("insightAffsUpdated"))}},playerCheck=e=>{if(void 0===e)return $.target;const t=(e=>"string"==typeof e?$.normalizePlayerId(e):e&&"object"==typeof e&&"string"==typeof e.id?$.normalizePlayerId(e.id):null)(e);return!!t&&$.ensurePlayer(t)},hasAff=e=>{let{id:t,player:i,probability:r=0}=e;const s=playerCheck(i);if(!s)return;r>1&&(r/=100);const a=s.affs[t];return!!a&&(a.have&&a.probability>=r)},hasAffs=e=>{let{ids:t,probability:i=0,player:r}=e;const s=playerCheck(r);if(!s)return;i>1&&(i/=100);let a=!1;return Array.isArray(t)&&(a=t.every((e=>s.currentAffs.includes(e)&&s.affs[e]&&s.affs[e].probability>=i))),a},addAff=e=>{let{id:t,player:i}=e;const r=playerCheck(i);r&&r.affs[t]&&r.timeline.add(t)},confirmAff=e=>{let{id:t,state:i=!0,player:r}=e;const s=playerCheck(r);s&&s.timeline.confirm(t,i)},randomAffs=e=>{let{ids:t,player:i}=e;if(void 0===t||!Array.isArray(t))return;const r=playerCheck(i);r&&r.timeline.random(t)},smartAffs=e=>{let{ids:t,player:i,ordered:r=!1}=e;if(void 0===t||!Array.isArray(t))return;const s=playerCheck(i);s&&(r?s.timeline.ordered(t):s.timeline.smart(t))},q={shadowInstill:!1,timeloop:{count:0,max:3}},T={resonance:{air:0,earth:0,fire:0,water:0}},M={blast:["impatience","stupidity","blackout","dizziness","epilepsy","unweavingmind"]};__webpack_require__(72),__webpack_require__(518),__webpack_require__(994);function croneCommand(e){insight.addAff({id:`broken${affs[0]}`,player:e.target})}function gremlinCommand(e){insight.removeDef({id:"shield",player:e.target})}eventStream.registerEvent("insight.domination.humbugCommand",(function humbugCommand(e){insight.addAff({id:"addiction",player:e.target})})),eventStream.registerEvent("insight.domination.houndCommand",(function houndCommand(e){insight.addAff({id:"weariness",player:e.target})})),eventStream.registerEvent("insight.domination.stormCommand",(function stormCommand(e){insight.addAff({id:"clumsiness",player:e.target})})),eventStream.registerEvent("insight.domination.stormCommand2",(function stormCommand2(e){insight.confirmAff({id:"clumsiness",state:!0,player:e.target})})),eventStream.registerEvent("insight.domination.bloodleechCommand",(function bloodleechCommand(e){insight.addAff({id:"haemophilia",player:e.target})})),eventStream.registerEvent("insight.domination.sycophantCommand",(function sycophantCommand(e){insight.addAff({id:"weakenedmind",player:e.target})})),eventStream.registerEvent("insight.domination.slimeCommand",(function slimeCommand(e){insight.addAff({id:"slimeobscure",player:e.target}),insight.confirmAff({id:"asthma",player:e.target,state:insight.checkBlock(/^Horror overcomes \w+'s face as \w+ body stiffens into paralysis\.$/)})})),eventStream.registerEvent("insight.domination.chimeraCommandDeaf",(function chimeraCommandDeaf(e){insight.confirmAff({id:"undeaf",state:!1,player:e.target})})),eventStream.registerEvent("insight.domination.chimeraCommand",(function chimeraCommand(e){insight.confirmAff({id:"undeaf",state:!0,player:e.target}),insight.checkBlock(capitalize(insight.target.id))||insight.addAff({id:"hallucinations",player:e.target})})),eventStream.registerEvent("insight.domination.bubonisCommand",(function bubonisCommand(e){insight.hasDef({id:"fangbarrier",player:e.target})?insight.nextLine("The protective coating covering the skin of")?(insight.confirmAff({id:"asthma",player:e.target,state:!0}),insight.addAff({id:"slickness",player:e.target})):insight.addAff({id:"asthma",player:e.target,state:!0}):insight.hasAff({id:"asthma",player:e.target,probability:.49})?insight.addAff({id:"slickness",player:e.target}):insight.addAff({id:"asthma",player:e.target,state:!0})})),eventStream.registerEvent("insight.domination.wormCommand",(function wormCommand(e){insight.addAff({id:"palpatarfeed",player:e.target})})),eventStream.registerEvent("insight.domination.wormTick",(function wormTick(e){insight.addAff({id:"healthleech",player:e.target})})),eventStream.registerEvent("insight.domination.croneCommand",croneCommand),eventStream.registerEvent("insight.domination.cronePrimebond",croneCommand),eventStream.registerEvent("insight.domination.abominationCommandFail",(function abominationCommandFail(e){insight.removeAff({id:"cleanseaura",player:e.target})})),eventStream.registerEvent("insight.domination.gremlinCommand",gremlinCommand),eventStream.registerEvent("insight.domination.gremlinCommandFail",gremlinCommand),eventStream.registerEvent("insight.domination.firelordCommand",(function firelordCommand(e){const t=insight.state.queues["c!p!w!t"].match(/COMMAND FIRELORD AT \w+ (\w+)/)[1];"MANALEECH"==t?(insight.confirmAff({id:"manaleech",state:!0,player:e.target}),insight.removeAff({id:"manaleech",player:e.target}),insight.addAff({id:"anorexia",player:e.target})):"HEALTHLEECH"==t?insight.confirmAff({id:"healthleech",state:!0,player:e.target}):"WHISPERINGMADNESS"==t&&(insight.confirmAff({id:"whisperingmadness",state:!0,player:e.target}),insight.removeAff({id:"whisperingmadness",player:e.target}),insight.addAff({id:"recklessness",player:e.target}))})),eventStream.registerEvent("insight.domination.firelordCommandFail",(function firelordCommandFail(e){console.log(insight.state.queues["c!p!w!t"]);const t=insight.state.queues["c!p!w!t"].match(/COMMAND FIRELORD AT \w+ (\w+)/)[1];t&&insight.confirmAff({id:t.toLowerCase(),state:!1,player:e.target})})),eventStream.registerEvent("insight.domination.wormPrimebond",(function wormPrimebond(e){insight.addAff({id:"nausea",player:e.target})})),eventStream.registerEvent("insight.domination.gremlinPrimebond",(function gremlinPrimebond(e){insight.addAff({id:"dizziness",player:e.target})})),eventStream.registerEvent("insight.domination.gremlinPrimebond2",(function gremlinPrimebond2(e){insight.confirmAff({id:"dizziness",state:!0,player:e.target})})),eventStream.registerEvent("insight.domination.humbugPrimebond",(function humbugPrimebond(e){insight.hasAff({id:"addiction",player:e.target,probability:.49})?(insight.adjustHp({id:"percentage",player:e.target,value:-.1}),insight.adjustMana({id:"percentage",player:e.target,value:-.1})):(insight.adjustHp({id:"percentage",player:e.target,value:-.05}),insight.adjustMana({id:"percentage",player:e.target,value:-.05}))})),eventStream.registerEvent("insight.domination.bubonisPrimebond",(function bubonisPrimebond(e){insight.smartAffs({ids:insight.occultist.bubonis,player:e.target})})),eventStream.registerEvent("insight.domination.chimeraPrimebondGas",(function chimeraPrimebondGas(e){insight.removeDef({id:"insomnia",player:e.target})})),eventStream.registerEvent("insight.domination.chimeraPrimebondRam",(function chimeraPrimebondRam(e){insight.addAff({id:"prone",player:e.target})})),eventStream.registerEvent("insight.domination.chimeraPrimebondRoar",(function chimeraPrimebondRoar(e){insight.addAff({id:"undeaf",player:e.target}),insight.addAff({id:"prone",player:e.target})})),eventStream.registerEvent("insight.domination.chimeraPrimebondUndeaf",(function chimeraPrimebondUndeaf(e){insight.addAff({id:"undeaf",player:e.target})}));__webpack_require__(430),__webpack_require__(389);eventStream.registerEvent("insight.weaving.splinterHit",(function splinterHit(e){insight.removeDef({id:"shield",player:e.target})})),eventStream.registerEvent("insight.weaving.splinterMiss",(function splinterMiss(e){insight.removeDef({id:"shield"})})),eventStream.registerEvent("insight.weaving.expand",(function expand(e){insight.adjustMana({id:"percentage",value:.15,player:e.target})})),eventStream.registerEvent("insight.weaving.combustion",(function combustion(e){insight.addAff({id:"bloodfire",player:e.target})})),eventStream.registerEvent("insight.weaving.blastMiss",(function blastMiss(e){insight.confirmByAfflictionPoolCount({ids:M.blast,count:3,condition:"<",player:e.target})})),eventStream.registerEvent("insight.weaving.invert",(function invert(e){insight.convertAff({id:`unweaving${e.old}`,to:`unweaving${e.new}`,player:e.target})}));__webpack_require__(718),__webpack_require__(473);function disruption(e){insight.addAff({id:"paralysis",player:e.target})}function laceration(e){insight.addAff({id:"haemophilia",player:e.target})}eventStream.registerEvent("insight.weaving.cleaveHit",(function cleaveHit(e){insight.addAff({id:"prone",player:e.target}),insight.removeDef({id:"shield",player:e.target})})),eventStream.registerEvent("insight.weaving.cleaveMiss",(function cleaveMiss(e){insight.removeDef({id:"shield",player:e.target})})),eventStream.registerEvent("insight.weaving.overhand",(function overhand(e){insight.hasAff({id:"prone",player:e.target})||insight.getLimb({id:"head",player:e.target}).percent>=87.6?insight.addAff({id:"impatience",player:e.target}):(insight.addAff({id:"stupidity",player:e.target}),insight.addAff({id:"prone",player:e.target}))})),eventStream.registerEvent("insight.weaving.hamstring",(function hamstring(e){insight.addAff({id:`broken${e.limb.replace(" ","")}`,player:e.target}),"thirdPerson"==e.matchType&&(insight.hitLimb({id:e.limb,player:e.target,value:22.1}),insight.checkBlock(/^(\w+) stumbles, falling to the ground\.$/)&&(insight.hasAff({id:`damaged${e.limb}`})||insight.breakLimb({id:e.limb,player:e.target})))})),eventStream.registerEvent("insight.weaving.entwineProne",(function entwineProne(e){insight.addAff({id:"prone",player:e.target})})),eventStream.registerEvent("insight.weaving.entwineEntangle",(function entwineEntangle(e){insight.addAff({id:"entangled",player:e.target})})),eventStream.registerEvent("insight.weaving.puncture",(function puncture(e){insight.addAff({id:"weariness",player:e.target})})),eventStream.registerEvent("insight.weaving.sever",(function sever(e){insight.addAff({id:"clumsiness",player:e.target})})),eventStream.registerEvent("insight.weaving.unweave",(function unweave(e){e.info&&insight.addAff({id:`unweaving${e.info}`,player:e.target})})),eventStream.registerEvent("insight.weaving.deathblow",(function deathblow(e){insight.addAff({id:"asthma",player:e.target})})),eventStream.registerEvent("insight.weaving.backhand",(function backhand(e){insight.addAff({id:"stupidity",player:e.target}),insight.addAff({id:"dizziness",player:e.target})})),eventStream.registerEvent("insight.weaving.exsanguinate",(function exsanguinate(e){insight.addAff({id:"nausea",player:e.target})})),eventStream.registerEvent("insight.weaving.disruption",disruption),eventStream.registerEvent("insight.weaving.disruption2",disruption),eventStream.registerEvent("insight.weaving.laceration",laceration),eventStream.registerEvent("insight.weaving.laceration2",laceration),eventStream.registerEvent("insight.weaving.dazzle",(function dazzle(e){insight.addAff({id:"clumsiness",player:e.target})})),eventStream.registerEvent("insight.weaving.rattle",(function rattle(e){insight.addAff({id:"epilepsy",player:e.target})})),eventStream.registerEvent("insight.weaving.vapours",(function vapours(e){insight.addAff({id:"asthma",player:e.target})}));const L={version:"0.5.7",reset:e=>{let t;if(e&&"all"===e.toLowerCase())$.reset("all"),t="Reset ALL";else{const i=e?$.ensurePlayer(e):$.target;if(!i)return;i.reset(),t=`Reset ${capitalize(i.id)}`}$.reporting.notices&&l.notice(t)},setTarget:e=>{$.setTarget(e)},registerInsightEvents:()=>{function limbCures(e){const t={brokenleftleg:"mangledleftleg",brokenleftarm:"mangledleftarm",brokenrightleg:"mangledrightleg",brokenrightarm:"mangledrightarm"};console.log(e);const i={mangledleftleg:"damagedleftleg",mangledleftarm:"damagedleftarm",mangledrightleg:"damagedrightleg",mangledrightarm:"damagedrightarm",mangledhead:"damagedhead",serioustrauma:"mildtrauma",damagedleftleg:"brokenleftleg",damagedleftarm:"brokenleftarm",damagedrightleg:"brokenrightleg",damagedrightarm:"brokenrightarm"}[e.id];void 0!==t[i]&&insight.hasAff({id:t[i],player:e.player.id})||insight.addAff({id:i,player:e.player.id})}function asthmaConfirmOnCure(e){if(insight.hasAff({id:"asthma",player:e.id})&&insight.hasBal({id:"smoke",player:e.id})&&e.currentAffs.some((e=>u.has(e)))){let t=/^\w+ takes a long drag off \w+ pipe\.$/;if(!insight.checkBlock(t)){const t=e.timeline.present.filter((e=>{const t=Object.keys(e.affs);return!!t.includes("asthma")||!t.some((e=>u.has(e)))}));t.length!==e.timeline.present.length&&(e.timeline.present=t,insight.target.timeline.pruneDuplicates(),insight.target.timeline.updateAffs())}}}function anorexiaConfirmOnCure(e){if(insight.hasAff({id:"anorexia",player:e.id})&&insight.hasBal({id:"herb",player:e.id})&&e.currentAffs.some((e=>c.has(e)))){let t=/^\w+ eats a.+\.$/;if(!insight.checkBlock(t)){const t=e.timeline.present.filter((e=>{const t=Object.keys(e.affs);return!!t.includes("anorexia")||!t.some((e=>c.has(e)))}));t.length!==e.timeline.present.length&&(e.timeline.present=t,insight.target.timeline.pruneDuplicates(),insight.target.timeline.updateAffs())}}}eventStream.registerEvent("insightLostAff",(function noticeLostAff(e){insight.reporting.notices&&insight.target.id===e.player.id&&l.notice(l.affUpdate(e.id,!1))})),eventStream.registerEvent("insightGotAff",(function noticeGotAff(e){insight.reporting.notices&&insight.target.id===e.player.id&&l.notice(l.affUpdate(e.id,!0))})),eventStream.registerEvent("insightLostDef",(function noticeLostDef(e){insight.reporting.notices&&insight.target.id===e.player.id&&l.notice(l.defUpdate(e.id,!1))})),eventStream.registerEvent("insightGotDef",(function noticeGotDef(e){insight.reporting.notices&&insight.target.id===e.player.id&&l.notice(l.defUpdate(e.id,!0))})),eventStream.registerEvent("IRE.Target.Set",(function insightTarget(e){"number"!=typeof e&&insight.setTarget(e)})),eventStream.registerEvent("insightAffsUpdated",(function insightDisplayShow(){insight.reporting.shouldShow=!0})),eventStream.registerEvent("PromptEvent",(function insightFlushUpdates(){insight.core?.flushAffUpdates&&insight.core.flushAffUpdates()})),eventStream.registerEvent("PromptEvent",(function insightDisplay(){insight.reporting.promptDisplay&&insight.reporting.shouldShow&&insight.currentAffs().length>0&&(nexusclient.add_html_line(l.currentAffDisplayHTML(insight.reporting.probabilityThreshold)),insight.reporting.shouldShow=!1)})),eventStream.registerEvent("nexSkillMatch",(function insightSkills(e){"secondPerson"!==e.match&&eventStream.raiseEvent(`insight.${e.skill}.${e.id}`,e)})),eventStream.registerEvent("insightLimbBreak",(function limbBreaks(e){switch(e.id){case"leftleg":case"rightleg":case"rightarm":case"leftarm":insight.hasAff({id:`damaged${e.id}`,player:e.player.id})?insight.convertAff({id:`damaged${e.id}`,to:`mangled${e.id}`,player:e.player.id}):insight.hasAff({id:`mangled${e.id}`,player:e.player.id})||(insight.removeAff({id:`broken${e.id}`,player:e.player.id}),insight.addAff({id:`damaged${e.id}`,player:e.player.id}));break;case"head":insight.hasAff({id:`damaged${e.id}`,player:e.player.id})?(insight.convertAff({id:`damaged${e.id}`,to:`mangled${e.id}`,player:e.player.id}),insight.addAff({id:"stuttering",player:e.player.id}),insight.addAff({id:"clumsiness",player:e.player.id})):insight.hasAff({id:`mangled${e.id}`,player:e.player.id})||(insight.addAff({id:`damaged${e.id}`,player:e.player.id}),insight.addAff({id:"stupidity",player:e.player.id}));break;case"torso":insight.hasAff({id:"mildtrauma",player:e.player.id})?insight.convertAff({id:"mildtrauma",to:"serioustrauma",player:e.player.id}):insight.addAff({id:"mildtrauma",player:e.player.id});break;default:console.error("insight event limbBreak no case found",e)}})),eventStream.registerEvent("insightLostAffmangledleftleg",limbCures),eventStream.registerEvent("insightLostAffmangledleftarm",limbCures),eventStream.registerEvent("insightLostAffmangledrightleg",limbCures),eventStream.registerEvent("insightLostAffmangledrightarm",limbCures),eventStream.registerEvent("insightLostAffmangledhead",limbCures),eventStream.registerEvent("insightLostAffserioustrauma",limbCures),eventStream.registerEvent("insightLostAffdamagedleftleg",limbCures),eventStream.registerEvent("insightLostAffdamagedleftarm",limbCures),eventStream.registerEvent("insightLostAffdamagedrightleg",limbCures),eventStream.registerEvent("insightLostAffdamagedrightarm",limbCures),eventStream.registerEvent("insightGotAffscalded",(function scaldedGot(e){e.player.bals.restoration.timer.setLength(5.7),e.player.bals.salve.timer.setLength(1.2)})),eventStream.registerEvent("insightLostAffscalded",(function scaldedLost(e){e.player.bals.restoration.timer.setLength(3.7),e.player.bals.salve.timer.setLength(.7)})),eventStream.registerEvent("insightUsedCureaurum",asthmaConfirmOnCure),eventStream.registerEvent("insightUsedCurekelp",asthmaConfirmOnCure),eventStream.registerEvent("insightUsedCuretree",asthmaConfirmOnCure),eventStream.registerEvent("insightUsedCurefocus",anorexiaConfirmOnCure),eventStream.registerEvent("insightUsedCuresalve",anorexiaConfirmOnCure),eventStream.registerEvent("insightUsedCuretree",anorexiaConfirmOnCure),eventStream.registerEvent("insightUsedCurefocus",(function fulminateOnFocus(e){if(insight.hasAff({id:"fulminated",player:e.id})&&!insight.hasAff({id:"paralysis",player:e.id})){let t=/^Horror overcomes \w+'s face as \w+ body stiffens into paralysis\.$/;insight.checkBlock(t)&&insight.confirmAff({id:"fulminated",player:e.id,state:!0})}}))},addAff,getAff:e=>{let{id:t,player:i}=e;const r=playerCheck(i);if(r)return r.affs[t]},removeAff:e=>{let{id:t,player:i}=e;const r=playerCheck(i);r&&r.timeline.remove(t)},usedCure:e=>{let{id:i,player:r}=e;const s=playerCheck(r);s&&t[i]&&((e,i)=>{const r=t[e].bals_req.find((e=>!i.bals[e].have));return!r||($.reporting.logging&&console.error("insight usedCure() off balance",e,i.bals[r]),!1)})(i,s)&&(((e,i)=>{const r=t[e].blocks;void 0!==r&&r.forEach((e=>{Array.isArray(e)?hasAffs({ids:e,player:i.id})&&e.forEach((e=>i.timeline.confirm(e,!1))):hasAff({id:e,player:i.id})&&i.timeline.confirm(e,!1)}))})(i,s),i.includes("restoration")?s.bals.restoration.location=i:s.timeline.cure(i),t[i].bals_used.forEach((e=>{"free"!==e&&s.bals[e].lost()})),eventStream.raiseEvent("insightUsedCure",{id:i,person:s}),eventStream.raiseEvent(`insightUsedCure${i}`,s))},cure:e=>{let{id:i,player:r}=e;const s=playerCheck(r);s&&t[i]&&s.timeline.cure(i)},confirmAff,confirmAffs:e=>{let{ids:t,state:i,player:r}=e;if(void 0===t||!Array.isArray(t))return;const s=playerCheck(r);s&&s.timeline.confirmMultiple(t,i)},confirmByAfflictionPoolCount:e=>{let{ids:t,count:i,conditional:r,player:s}=e;const a=playerCheck(s);a&&a.timeline.confirmByAfflictionPoolCount({ids:t,count:i,conditional:r})},confirmAfflictionLevel:e=>{let{id:t,count:i,conditional:r,player:s}=e;const a=playerCheck(s);a&&a.timeline.confirmAfflictionLevel({id:t,count:i,conditional:r})},randomAffs,readAuraConfirm:e=>{let{p:t,m:i,player:r}=e;const s=playerCheck(r);s&&(s.timeline.confirmByAfflictionPoolCount({ids:d.physicals,count:t,conditional:"="}),s.timeline.confirmByAfflictionPoolCount({ids:d.mentals,count:i,conditional:"="}))},smartAffs,convertAff:e=>{let{id:t,to:i,player:r}=e;if(void 0===t||void 0===i)return;const s=playerCheck(r);s&&s.timeline.convert(t,i)},countAffs:e=>{let{ids:t,player:i}=e;const r=playerCheck(i);if(!r)return;let s=0;for(const e of t)r.affs[e]?.have&&s++;return s},addDef:e=>{let{id:t,player:i}=e;const r=playerCheck(i);r&&r.defs[t].got()},removeDef:e=>{let{id:t,player:i}=e;const r=playerCheck(i);r&&r.defs[t].lost()},hasAff,hasAffs,hasAnAff:e=>{let{ids:t,player:i,probability:r=0}=e;const s=playerCheck(i);if(!s)return;r>1&&(r/=100);let a=!1;return Array.isArray(t)&&(a=t.some((e=>s.currentAffs.includes(e)&&s.affs[e]&&s.affs[e].probability>=r))),a},hasDef:e=>{let{id:t,player:i}=e;const r=playerCheck(i);if(r)return r.defs[t].have},hasBal:e=>{let{id:t,player:i}=e;const r=playerCheck(i);if(r)return r.bals[t].have},lostBal:e=>{let{id:t,player:i}=e;const r=playerCheck(i);r&&r.bals[t].lost()},balRemaining:e=>{let{id:t,player:i}=e;const r=playerCheck(i);if(r)return r.bals[t].timer.remaining()},setState:e=>{let{id:t,value:i,player:r}=e;const s=playerCheck(r);if(!s)return;const a=s.state?.[t]||s.stats?.[t];a&&a.value!==i&&(a.value=i)},getStat:e=>{let{id:t,player:i}=e;const r=playerCheck(i);if(r)return r.stats[t]},adjustHp:e=>{let{id:t,value:i,player:r}=e;const s=playerCheck(r);s&&(s.stats.hp[t]+=i)},adjustMana:e=>{let{id:t,value:i,player:r}=e;const s=playerCheck(r);s&&(s.stats.mana[t]+=i)},getLimb:e=>{let{id:t,player:i}=e;const r=playerCheck(i);if(r)return r.limbs[t]},hitLimb:e=>{let{id:t,player:i,value:r}=e;const s=playerCheck(i);s&&s.limbs[t].hit(r)},resetLimb:e=>{let{id:t,player:i}=e;const r=playerCheck(i);if(r)return r.limbs[t].reset()},breakLimb:e=>{let{id:t,player:i}=e;const r=playerCheck(i);if(r)return r.limbs[t].break()},currentAffs:()=>$.target?$.target.currentAffs:[],display:l,nextLine,checkBlock:e=>{const t=nexusclient.current_block;let i=!1;return e instanceof RegExp?i=!!t.find((t=>void 0!==t.line&&e.test(t.line))):"string"==typeof e&&(i=!!t.find((t=>void 0!==t.line&&t.line.includes(e)))),i},venomToAff:{xentio:"clumsiness",eurypteria:"recklessness",kalmia:"asthma",digitalis:"shyness",darkshade:"darkshade",curare:"paralysis",epteth:"",prefarar:"sensitivity",monkshood:"disloyalty",euphorbia:"nausea",oculus:"unblind",vernalius:"weariness",epseth:"",larkspur:"dizziness",slike:"anorexia",delphinium:"sleep",notechis:"haemophilia",vardrax:"addiction",loki:"loki",aconite:"stupidity",selarnia:"",gecko:"slickness",scytherus:"scytherus",nechamadra:"shivering"},cures:t,herbAffs:c,salveAffs:f,focusAffs:p,smokeAffs:u,players:$.players,state:$.state,reporting:$.reporting,config:$.config,core:$,predictive:$.predictive,depthswalker:q,occultist:d,magi:T,psion:M,stupidityEmotes:[/^(\w+) makes a strangled meowing noise and quickly shuts up, blushing\.$/,/^(\w+) attempts to do a standing backflip, but merely stumbles over \w+ own feet\.$/,/^Tears fill (\w+)'s eyes and begin to slowly run down \w+ face\.$/,/^(\w+) sweeps across the floor, leaping and twirling like a true master\.$/,/^(\w+) gets down on one knee and serenades the world\.$/,/^(\w+) grunts a bit and then lets out a loud "OINK!"$/,/^(\w+) lets out a loud, long "MOOOOOOOOOOO!"$/,/^(\w+) breaks down and sobs uncontrollably\.$/,/^(\w+) pulls down \w+ pants and moons the world\.$/,/^(\w+) looks around vainly for a partner to tango with\.$/,/^(\w+) waggles \w+ eyebrows comically\.$/,/^(\w+) falls to \w+ knees in worship\.$/,/^(\w+) picks \w+ nose absently\.$/,/^(\w+) gives up a round of applause\.$/,/^(\w+) flaps \w+ arms madly\.$/,/^(\w+) giggles happily\.$/,/^(\w+) drops to one knee\.$/,/^(\w+) wails like an old woman\.$/,/^(\w+) twitches spasmodically\.$/,/^(\w+) burps obscenely\.$/,/^(\w+) blinks\.$/,/^(\w+) hugs \w+ compassionately\.$/,/^(\w+) stumbles and pokes \w+ in the eye\.$/],debug:()=>{insight.display.notice(`Version: ${insight.version}`),console.log(`Version: ${insight.version}`),insight.display.notice(`Target: ${insight.target.id}`),console.log(`Target: ${insight.target.id}`),insight.display.notice(`Display settings: ${JSON.stringify(insight.reporting)}`),console.log(`Display settings: ${JSON.stringify(insight.reporting)}`),insight.display.notice(`Display event: ${eventStream.stream.PromptEvent.has("insightDisplay")}`),console.log(`Display event: ${eventStream.stream.PromptEvent.has("insightDisplay")}`),insight.display.notice(`Skill event: ${eventStream.stream.nexSkillMatch.has("insightSkills")}`),console.log(`Skill event: ${eventStream.stream.nexSkillMatch.has("insightSkills")}`),insight.display.notice(`Affs: ${insight.currentAffs()}`),console.log(`Affs: ${insight.currentAffs()}`),insight.display.notice('Simulating affliction "asthma"...');const e=insight.target.id;insight.setTarget("Khaseem"),console.log('Simulating affliction "asthma"...'),insight.addAff({id:"asthma"}),console.log(`Affs: ${insight.currentAffs()}`),nexusclient.send_commands("x"),insight.display.notice(`Affs: ${insight.currentAffs()}`),insight.setTarget(e)},currentAffDisplay:()=>{let e=[];return $.target?($.target.currentAffs.forEach((t=>{const i=$.target.affs[t]instanceof AffCountable?`${t}${parseFloat($.target.affs[t].count.toFixed(1))}`:t;e.push(`${i}: ${$.target.affs[t].probability}`)})),e):e},startPredictive:function(){let{player:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=playerCheck(e);t&&$.predictive?.start(t.id)},stopPredictive:function(){let{player:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=playerCheck(e);t&&$.predictive?.stop(t.id)},startPredictiveAll:()=>{$.predictive?.startAll()},stopPredictiveAll:()=>{$.predictive?.stopAll()},isPredictiveActive:function(){let{player:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=playerCheck(e);return!!t&&($.predictive?.isActive(t.id)??!1)},setPredictiveMode:e=>!!new Set(["random","best","worst"]).has(e)&&($.config.predictiveCureMode=e,!0),setPlayerClass:e=>{let{player:t,class:i}=e;const r=playerCheck(t);r&&(r.class=i)},stepPredictiveNow:function(){let{player:e,now:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const i=playerCheck(e);return i?$.predictive?.stepNow(i.id,t)??null:null}};Object.defineProperty(L,"target",{get:()=>$.target,enumerable:!0}),L.add=(e,t)=>addAff({id:e,player:t}),L.confirm=function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;return confirmAff({id:e,state:t,player:i})},L.smart=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return smartAffs({ids:e,player:t,ordered:i})},L.random=(e,t)=>randomAffs({ids:e,player:t}),globalThis.insight=L,globalThis.insight.setTarget("khaseem"),globalThis.insight.reset(),"undefined"!=typeof nexusclient&&(globalThis.insight.registerInsightEvents(),L.reporting.notices=!0,"khaseem"!==nexusclient.charname?fetch("https://unpkg.com/nexsight/insight3.nxs",{cache:"no-store"}).then((e=>e.json())).then((e=>{nexusclient.packages().get("insight3").apply(e,nexusclient.reflexes()),console.log("insight package update successful"),eventStream.raiseEvent("insightLoaded")})).catch((e=>{nexusclient.display_notice("[Error]: Insight package update failed.","red"),console.error("Insight package update failed.",e)})):eventStream.raiseEvent("insightLoaded"))})()})();