commit 5269ba3215534e22fd5b55397a13053f6fddfac4 Author: James@SCF-GC Date: Sun Feb 19 19:10:19 2023 +0100 first commit diff --git a/.obsidian/app.json b/.obsidian/app.json new file mode 100644 index 0000000..8231f71 --- /dev/null +++ b/.obsidian/app.json @@ -0,0 +1,5 @@ +{ + "showUnsupportedFiles": true, + "promptDelete": false, + "alwaysUpdateLinks": true +} \ No newline at end of file diff --git a/.obsidian/appearance.json b/.obsidian/appearance.json new file mode 100644 index 0000000..30f1355 --- /dev/null +++ b/.obsidian/appearance.json @@ -0,0 +1,4 @@ +{ + "accentColor": "", + "baseFontSize": 30 +} \ No newline at end of file diff --git a/.obsidian/community-plugins.json b/.obsidian/community-plugins.json new file mode 100644 index 0000000..6d0ffba --- /dev/null +++ b/.obsidian/community-plugins.json @@ -0,0 +1,4 @@ +[ + "obsidian-5e-statblocks", + "obsidian-dice-roller" +] \ No newline at end of file diff --git a/.obsidian/core-plugins-migration.json b/.obsidian/core-plugins-migration.json new file mode 100644 index 0000000..3106ebd --- /dev/null +++ b/.obsidian/core-plugins-migration.json @@ -0,0 +1,29 @@ +{ + "file-explorer": true, + "global-search": true, + "switcher": true, + "graph": true, + "backlink": true, + "canvas": true, + "outgoing-link": true, + "tag-pane": true, + "page-preview": true, + "daily-notes": true, + "templates": true, + "note-composer": true, + "command-palette": true, + "slash-command": false, + "editor-status": true, + "starred": true, + "markdown-importer": false, + "zk-prefixer": false, + "random-note": false, + "outline": true, + "word-count": true, + "slides": false, + "audio-recorder": false, + "workspaces": false, + "file-recovery": true, + "publish": false, + "sync": false +} \ No newline at end of file diff --git a/.obsidian/core-plugins.json b/.obsidian/core-plugins.json new file mode 100644 index 0000000..086a8e4 --- /dev/null +++ b/.obsidian/core-plugins.json @@ -0,0 +1,20 @@ +[ + "file-explorer", + "global-search", + "switcher", + "graph", + "backlink", + "canvas", + "outgoing-link", + "tag-pane", + "page-preview", + "daily-notes", + "templates", + "note-composer", + "command-palette", + "editor-status", + "starred", + "outline", + "word-count", + "file-recovery" +] \ No newline at end of file diff --git a/.obsidian/graph.json b/.obsidian/graph.json new file mode 100644 index 0000000..e21a18d --- /dev/null +++ b/.obsidian/graph.json @@ -0,0 +1,22 @@ +{ + "collapse-filter": true, + "search": "", + "showTags": false, + "showAttachments": false, + "hideUnresolved": false, + "showOrphans": true, + "collapse-color-groups": true, + "colorGroups": [], + "collapse-display": true, + "showArrow": false, + "textFadeMultiplier": 0, + "nodeSizeMultiplier": 1, + "lineSizeMultiplier": 1, + "collapse-forces": true, + "centerStrength": 0.518713248970312, + "repelStrength": 10, + "linkStrength": 1, + "linkDistance": 250, + "scale": 1, + "close": false +} \ No newline at end of file diff --git a/.obsidian/hotkeys.json b/.obsidian/hotkeys.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/.obsidian/hotkeys.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/.obsidian/plugins/obsidian-5e-statblocks/data.json b/.obsidian/plugins/obsidian-5e-statblocks/data.json new file mode 100644 index 0000000..2be5f0f --- /dev/null +++ b/.obsidian/plugins/obsidian-5e-statblocks/data.json @@ -0,0 +1,21 @@ +{ + "monsters": [], + "layouts": [], + "default": "Basic 5e Layout", + "useDice": true, + "renderDice": false, + "export": true, + "showAdvanced": false, + "version": { + "major": 2, + "minor": 24, + "patch": 20 + }, + "paths": [ + "/" + ], + "autoParse": false, + "disableSRD": false, + "tryToRenderLinks": true, + "debug": false +} \ No newline at end of file diff --git a/.obsidian/plugins/obsidian-5e-statblocks/main.js b/.obsidian/plugins/obsidian-5e-statblocks/main.js new file mode 100644 index 0000000..4c736f4 --- /dev/null +++ b/.obsidian/plugins/obsidian-5e-statblocks/main.js @@ -0,0 +1,439 @@ +/* +THIS IS A GENERATED/BUNDLED FILE BY ESBUILD +if you want to view the source, please visit the github repository of this plugin +*/ + +var Wc=Object.create;var Ua=Object.defineProperty;var Nc=Object.getOwnPropertyDescriptor;var Hc=Object.getOwnPropertyNames;var Lc=Object.getPrototypeOf,Rc=Object.prototype.hasOwnProperty;var Ns=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),Bc=(a,e)=>{for(var t in e)Ua(a,t,{get:e[t],enumerable:!0})},Hs=(a,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Hc(e))!Rc.call(a,i)&&i!==t&&Ua(a,i,{get:()=>e[i],enumerable:!(n=Nc(e,i))||n.enumerable});return a};var _a=(a,e,t)=>(t=a!=null?Wc(Lc(a)):{},Hs(e||!a||!a.__esModule?Ua(t,"default",{value:a,enumerable:!0}):t,a)),Fc=a=>Hs(Ua({},"__esModule",{value:!0}),a);var Rs=Ns((Ls,Un)=>{(function(a){"use strict";var e=w(),t=W(),n=E(),i=y(),s={imagePlaceholder:void 0,cacheBust:!1},r={toSvg:c,toPng:l,toJpeg:d,toBlob:u,toPixelData:o,impl:{fontFaces:n,images:i,util:e,inliner:t,options:{}}};typeof Un<"u"?Un.exports=r:a.domtoimage=r;function c(g,p){return p=p||{},m(p),Promise.resolve(g).then(function(M){return b(M,p.filter,!0)}).then(f).then(k).then(v).then(function(M){return C(M,p.width||e.width(g),p.height||e.height(g))});function v(M){return p.bgcolor&&(M.style.backgroundColor=p.bgcolor),p.width&&(M.style.width=p.width+"px"),p.height&&(M.style.height=p.height+"px"),p.style&&Object.keys(p.style).forEach(function(N){M.style[N]=p.style[N]}),M}}function o(g,p){return h(g,p||{}).then(function(v){return v.getContext("2d").getImageData(0,0,e.width(g),e.height(g)).data})}function l(g,p){return h(g,p||{}).then(function(v){return v.toDataURL()})}function d(g,p){return p=p||{},h(g,p).then(function(v){return v.toDataURL("image/jpeg",p.quality||1)})}function u(g,p){return h(g,p||{}).then(e.canvasToBlob)}function m(g){typeof g.imagePlaceholder>"u"?r.impl.options.imagePlaceholder=s.imagePlaceholder:r.impl.options.imagePlaceholder=g.imagePlaceholder,typeof g.cacheBust>"u"?r.impl.options.cacheBust=s.cacheBust:r.impl.options.cacheBust=g.cacheBust}function h(g,p){return c(g,p).then(e.makeImage).then(e.delay(100)).then(function(M){var N=v(g);return N.getContext("2d").drawImage(M,0,0),N});function v(M){var N=document.createElement("canvas");if(N.width=p.width||e.width(M),N.height=p.height||e.height(M),p.bgcolor){var T=N.getContext("2d");T.fillStyle=p.bgcolor,T.fillRect(0,0,N.width,N.height)}return N}}function b(g,p,v){if(!v&&p&&!p(g))return Promise.resolve();return Promise.resolve(g).then(M).then(function(P){return N(g,P,p)}).then(function(P){return T(g,P)});function M(P){return P instanceof HTMLCanvasElement?e.makeImage(P.toDataURL()):P.cloneNode(!1)}function N(P,L,G){var B=P.childNodes;if(B.length===0)return Promise.resolve(L);return te(L,e.asArray(B),G).then(function(){return L});function te(F,fe,oe){var he=Promise.resolve();return fe.forEach(function(pe){he=he.then(function(){return b(pe,oe)}).then(function(we){we&&F.appendChild(we)})}),he}}function T(P,L){if(!(L instanceof Element))return L;return Promise.resolve().then(G).then(B).then(te).then(F).then(function(){return L});function G(){fe(window.getComputedStyle(P),L.style);function fe(oe,he){oe.cssText?he.cssText=oe.cssText:pe(oe,he);function pe(we,qe){e.asArray(we).forEach(function($){qe.setProperty($,we.getPropertyValue($),we.getPropertyPriority($))})}}}function B(){[":before",":after"].forEach(function(oe){fe(oe)});function fe(oe){var he=window.getComputedStyle(P,oe),pe=he.getPropertyValue("content");if(pe===""||pe==="none")return;var we=e.uid();L.className=L.className+" "+we;var qe=document.createElement("style");qe.appendChild($(we,oe,he)),L.appendChild(qe);function $(Q,ce,ne){var ke="."+Q+":"+ce,Ge=ne.cssText?ya(ne):It(ne);return document.createTextNode(ke+"{"+Ge+"}");function ya(st){var Je=st.getPropertyValue("content");return st.cssText+" content: "+Je+";"}function It(st){return e.asArray(st).map(Je).join("; ")+";";function Je(Pt){return Pt+": "+st.getPropertyValue(Pt)+(st.getPropertyPriority(Pt)?" !important":"")}}}}}function te(){P instanceof HTMLTextAreaElement&&(L.innerHTML=P.value),P instanceof HTMLInputElement&&L.setAttribute("value",P.value)}function F(){L instanceof SVGElement&&(L.setAttribute("xmlns","http://www.w3.org/2000/svg"),L instanceof SVGRectElement&&["width","height"].forEach(function(fe){var oe=L.getAttribute(fe);!oe||L.style.setProperty(fe,oe)}))}}}function f(g){return n.resolveAll().then(function(p){var v=document.createElement("style");return g.appendChild(v),v.appendChild(document.createTextNode(p)),g})}function k(g){return i.inlineAll(g).then(function(){return g})}function C(g,p,v){return Promise.resolve(g).then(function(M){return M.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),new XMLSerializer().serializeToString(M)}).then(e.escapeXhtml).then(function(M){return''+M+""}).then(function(M){return''+M+""}).then(function(M){return"data:image/svg+xml;charset=utf-8,"+M})}function w(){return{escape:F,parseExtension:p,mimeType:v,dataAsUrl:te,isDataUrl:M,canvasToBlob:T,resolveUrl:P,getAndEncode:B,uid:L(),delay:fe,asArray:oe,escapeXhtml:he,makeImage:G,width:pe,height:we};function g(){var $="application/font-woff",Q="image/jpeg";return{woff:$,woff2:$,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:Q,jpeg:Q,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml"}}function p($){var Q=/\.([^\.\/]*?)$/g.exec($);return Q?Q[1]:""}function v($){var Q=p($).toLowerCase();return g()[Q]||""}function M($){return $.search(/^(data:)/)!==-1}function N($){return new Promise(function(Q){for(var ce=window.atob($.toDataURL().split(",")[1]),ne=ce.length,ke=new Uint8Array(ne),Ge=0;Ge{(function(a,e){typeof Ei=="object"&&typeof Mi<"u"?Mi.exports=e():typeof define=="function"&&define.amd?define(e):(a=typeof globalThis<"u"?globalThis:a||self,a["fast-copy"]=e())})(Ei,function(){"use strict";var a=Function.prototype.toString,e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,s=Object.getOwnPropertySymbols,r=Object.getPrototypeOf,c=Object.prototype,o=c.hasOwnProperty,l=c.propertyIsEnumerable,d=typeof s=="function",u=typeof WeakMap=="function",m=function(){if(u)return function(){return new WeakMap};var y=function(){function g(){this._keys=[],this._values=[]}return g.prototype.has=function(p){return!!~this._keys.indexOf(p)},g.prototype.get=function(p){return this._values[this._keys.indexOf(p)]},g.prototype.set=function(p,v){this._keys.push(p),this._values.push(v)},g}();return function(){return new y}}(),h=function(y,g){var p=y.__proto__||r(y);if(!p)return e(null);var v=p.constructor;if(v===g.Object)return p===g.Object.prototype?{}:e(p);if(~a.call(v).indexOf("[native code]"))try{return new v}catch{}return e(p)},b=function(y,g,p,v){var M=h(y,g);v.set(y,M);for(var N in y)o.call(y,N)&&(M[N]=p(y[N],v));if(d)for(var T=s(y),P=0,L=T.length,G=void 0;Pqn});module.exports=Fc(lm);var je=require("obsidian"),Mc=_a(Rs());var zc=[{name:"Aboleth",size:"Large",type:"aberration",subtype:"",alignment:"lawful evil",ac:17,hp:135,hit_dice:"18d10 + 36",speed:"10 ft., swim 40 ft.",stats:[21,9,15,18,15,18],saves:[{constitution:6},{intelligence:8},{wisdom:6}],skillsaves:[{history:12},{perception:10}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 120 ft., passive Perception 20",languages:"Deep Speech, telepathy 120 ft.",cr:"10",traits:[{name:"Amphibious",desc:"The aboleth can breathe air and water.",attack_bonus:0},{name:"Mucous Cloud",desc:"While underwater, the aboleth is surrounded by transformative mucus. A creature that touches the aboleth or that hits it with a melee attack while within 5 ft. of it must make a DC 14 Constitution saving throw. On a failure, the creature is diseased for 1d4 hours. The diseased creature can breathe only underwater.",attack_bonus:0},{name:"Probing Telepathy",desc:"If a creature communicates telepathically with the aboleth, the aboleth learns the creature's greatest desires if the aboleth can see the creature.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The aboleth makes three tentacle attacks.",attack_bonus:0},{name:"Tentacle",desc:"Melee Weapon Attack: +9 to hit, reach 10 ft., one target. Hit: 12 (2d6 + 5) bludgeoning damage. If the target is a creature, it must succeed on a DC 14 Constitution saving throw or become diseased. The disease has no effect for 1 minute and can be removed by any magic that cures disease. After 1 minute, the diseased creature's skin becomes translucent and slimy, the creature can't regain hit points unless it is underwater, and the disease can be removed only by heal or another disease-curing spell of 6th level or higher. When the creature is outside a body of water, it takes 6 (1d12) acid damage every 10 minutes unless moisture is applied to the skin before 10 minutes have passed.",attack_bonus:9,damage_dice:"2d6",damage_bonus:5},{name:"Tail",desc:"Melee Weapon Attack: +9 to hit, reach 10 ft. one target. Hit: 15 (3d6 + 5) bludgeoning damage.",attack_bonus:9,damage_dice:"3d6",damage_bonus:5},{name:"Enslave (3/day)",desc:"The aboleth targets one creature it can see within 30 ft. of it. The target must succeed on a DC 14 Wisdom saving throw or be magically charmed by the aboleth until the aboleth dies or until it is on a different plane of existence from the target. The charmed target is under the aboleth's control and can't take reactions, and the aboleth and the target can communicate telepathically with each other over any distance.\\nWhenever the charmed target takes damage, the target can repeat the saving throw. On a success, the effect ends. No more than once every 24 hours, the target can also repeat the saving throw when it is at least 1 mile away from the aboleth.",attack_bonus:0}],legendary_actions:[{name:"Detect",desc:"The aboleth makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Swipe",desc:"The aboleth makes one tail attack.",attack_bonus:0},{name:"Psychic Drain (Costs 2 Actions)",desc:"One creature charmed by the aboleth takes 10 (3d6) psychic damage, and the aboleth regains hit points equal to the damage the creature takes.",attack_bonus:0}]},{name:"Acolyte",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any alignment",ac:10,hp:9,hit_dice:"2d8",speed:"30 ft.",stats:[10,10,10,10,14,11],skillsaves:[{medicine:4},{religion:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 12",languages:"any one language (usually Common)",cr:"1/4",traits:[],actions:[{name:"Club",desc:"Melee Weapon Attack: +2 to hit, reach 5 ft., one target. Hit: 2 (1d4) bludgeoning damage.",attack_bonus:2,damage_dice:"1d4"}],spells:["The acolyte is a 1st-level spellcaster. Its spellcasting ability is Wisdom (spell save DC 12, +4 to hit with spell attacks). The acolyte has following cleric spells prepared:",{"Cantrips (at will)":"light, sacred flame, thaumaturgy"},{"1st level (3 slots)":"bless, cure wounds, sanctuary"}]},{name:"Adult Black Dragon",size:"Huge",type:"dragon",subtype:"",alignment:"chaotic evil",ac:19,hp:195,hit_dice:"17d12 + 84",speed:"40 ft., fly 80 ft., swim 40 ft.",stats:[23,14,21,14,13,17],saves:[{dexterity:7},{constitution:10},{wisdom:6},{charisma:8}],skillsaves:[null,{perception:11},{stealth:7}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"acid",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 21",languages:"Common, Draconic",cr:"14",traits:[{name:"Amphibious",desc:"The dragon can breathe air and water.",attack_bonus:0},{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +11 to hit, reach 10 ft., one target. Hit: 17 (2d10 + 6) piercing damage plus 4 (1d8) acid damage.",attack_bonus:11,damage_dice:"2d10 + 1d8",damage_bonus:6},{name:"Claw",desc:"Melee Weapon Attack: +11 to hit, reach 5 ft., one target. Hit: 13 (2d6 + 6) slashing damage.",attack_bonus:11,damage_dice:"2d6",damage_bonus:6},{name:"Tail",desc:"Melee Weapon Attack: +11 to hit, reach 15 ft., one target. Hit: 15 (2d8 + 6) bludgeoning damage.",attack_bonus:11,damage_dice:"2d8",damage_bonus:6},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 16 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Acid Breath (Recharge 5-6)",desc:"The dragon exhales acid in a 60-foot line that is 5 feet wide. Each creature in that line must make a DC 18 Dexterity saving throw, taking 54 (12d8) acid damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"12d8"}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 10 ft. of the dragon must succeed on a DC 19 Dexterity saving throw or take 13 (2d6 + 6) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Adult Blue Dracolich",size:"Huge",type:"undead",subtype:"",alignment:"lawful evil",ac:19,hp:225,hit_dice:"18d12 + 108",speed:"40 ft., burrow 30 ft., fly 80 ft.",stats:[25,10,23,16,15,19],skillsaves:[{perception:12}],damage_vulnerabilities:"",damage_resistances:"necrotic",damage_immunities:"lightning, poison",condition_immunities:"charmed, exhaustion, frightened, paralyzed, poisoned",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 22",languages:"Common, Draconic",cr:"17",traits:[{name:"Legendary Resistance (3/Day)",desc:"If the dracolich fails a saving throw, it can choose to succeed instead.",attack_bonus:0},{name:"Magic Resistance",desc:"The dracolich has advantage on saving throws against spells and other magical effects.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dracolich can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +12 to hit, reach 10 ft., one target. Hit: 18 (2d10 + 7) piercing damage plus 5 (1d10) lightning damage.",attack_bonus:12,damage_dice:"2d10 + 1d10",damage_bonus:7},{name:"Claw",desc:"Melee Weapon Attack: +12 to hit, reach 5 ft., one target. Hit: 14 (2d6 + 7) slashing damage.",attack_bonus:12,damage_dice:"2d6",damage_bonus:7},{name:"Tail",desc:"Melee Weapon Attack: +12 to hit, reach 15 ft., one target. Hit: 16 (2d8 + 7) bludgeoning damage.",attack_bonus:12,damage_dice:"2d8",damage_bonus:7},{name:"Frightful Presence",desc:"Each creature of the dracolich's choice that is within 120 feet of the dracolich and aware of it must succeed on a DC 18 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dracolich's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Lightning Breath (Recharge 5-6)",desc:"The dracolich exhales lightning in a 90-foot line that is 5 feet wide. Each creature in that line must make a DC 20 Dexterity saving throw, taking 66 (12d10) lightning damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"12d10"}],legendary_actions:[{name:"Detect",desc:"The dracolich makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dracolich makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dracolich beats its tattered wings. Each creature within 10 ft. of the dracolich must succeed on a DC 21 Dexterity saving throw or take 14 (2d6 + 7) bludgeoning damage and be knocked prone. After beating its wings this way, the dracolich can fly up to half its flying speed.",attack_bonus:0}]},{name:"Adult Blue Dragon",size:"Huge",type:"dragon",subtype:"",alignment:"lawful evil",ac:19,hp:225,hit_dice:"18d12 + 108",speed:"40 ft., burrow 30 ft., fly 80 ft.",stats:[25,10,23,16,15,19],saves:[{dexterity:5},{constitution:11},{wisdom:7},{charisma:9}],skillsaves:[null,{perception:12},{stealth:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"lightning",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 22",languages:"Common, Draconic",cr:"16",traits:[{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +12 to hit, reach 10 ft., one target. Hit: 18 (2d10 + 7) piercing damage plus 5 (1d10) lightning damage.",attack_bonus:12,damage_dice:"2d10 + 1d10",damage_bonus:7},{name:"Claw",desc:"Melee Weapon Attack: +12 to hit, reach 5 ft., one target. Hit: 14 (2d6 + 7) slashing damage.",attack_bonus:12,damage_dice:"2d6",damage_bonus:7},{name:"Tail",desc:"Melee Weapon Attack: +12 to hit, reach 15 ft., one target. Hit: 16 (2d8 + 7) bludgeoning damage.",attack_bonus:12,damage_dice:"2d8",damage_bonus:7},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 ft. of the dragon and aware of it must succeed on a DC 17 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Lightning Breath (Recharge 5-6)",desc:"The dragon exhales lightning in a 90-foot line that is 5 ft. wide. Each creature in that line must make a DC 19 Dexterity saving throw, taking 66 (12d10) lightning damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"12d10"}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 10 ft. of the dragon must succeed on a DC 20 Dexterity saving throw or take 14 (2d6 + 7) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Adult Brass Dragon",size:"Huge",type:"dragon",subtype:"",alignment:"chaotic good",ac:18,hp:172,hit_dice:"15d12 + 74",speed:"40 ft., burrow 40 ft., fly 80 ft.",stats:[23,10,21,14,13,17],saves:[{dexterity:5},{constitution:10},{wisdom:6},{charisma:8}],skillsaves:[null,{history:7},{persuasion:8},{perception:11},{stealth:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 21",languages:"Common, Draconic",cr:"13",traits:[{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +11 to hit, reach,.0 ft., one target. Hit: 17 (2d10 + 6) piercing damage.",attack_bonus:11,damage_dice:"2d10",damage_bonus:6},{name:"Claw",desc:"Melee Weapon Attack: +11 to hit, reach 5 ft., one target. Hit: 13 (2d6 + 6) slashing damage.",attack_bonus:11,damage_dice:"2d6",damage_bonus:6},{name:"Tail",desc:"Melee Weapon Attack: +11 to hit, reach 15 ft., one target. Hit: 15 (2d8 + 6) bludgeoning damage.",attack_bonus:11,damage_dice:"2d8",damage_bonus:6},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 16 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Breath Weapons (Recharge 5-6)",desc:"The dragon uses one of the following breath weapons.\\nFire Breath. The dragon exhales fire in an 60-foot line that is 5 feet wide. Each creature in that line must make a DC 18 Dexterity saving throw, taking 45 (13d6) fire damage on a failed save, or half as much damage on a successful one.\\nSleep Breath. The dragon exhales sleep gas in a 60-foot cone. Each creature in that area must succeed on a DC 18 Constitution saving throw or fall unconscious for 10 minutes. This effect ends for a creature if the creature takes damage or someone uses an action to wake it.",attack_bonus:0,damage_dice:"13d6"}]},{name:"Adult Bronze Dragon",size:"Huge",type:"dragon",subtype:"",alignment:"lawful good",ac:19,hp:212,hit_dice:"17d12 + 101",speed:"40 ft., fly 80 ft., swim 40 ft.",stats:[25,10,23,16,15,19],saves:[{dexterity:5},{constitution:11},{wisdom:7},{charisma:9}],skillsaves:[{insight:7},{perception:12},{stealth:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"lightning",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 22",languages:"Common, Draconic",cr:"15",traits:[{name:"Amphibious",desc:"The dragon can breathe air and water.",attack_bonus:0},{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +12 to hit, reach 10 ft., one target. Hit: 18 (2d10 + 7) piercing damage.",attack_bonus:12,damage_dice:"2d10",damage_bonus:7},{name:"Claw",desc:"Melee Weapon Attack: +12 to hit, reach 5 ft., one target. Hit: 14 (2d6 + 7) slashing damage.",attack_bonus:12,damage_dice:"2d6",damage_bonus:7},{name:"Tail",desc:"Melee Weapon Attack: +12 to hit, reach 15 ft., one target. Hit: 16 (2d8 + 7) bludgeoning damage.",attack_bonus:12,damage_dice:"2d8",damage_bonus:7},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 17 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Breath Weapons (Recharge 5-6)",desc:"The dragon uses one of the following breath weapons.\\nLightning Breath. The dragon exhales lightning in a 90-foot line that is 5 feet wide. Each creature in that line must make a DC 19 Dexterity saving throw, taking 66 (12d10) lightning damage on a failed save, or half as much damage on a successful one.\\nRepulsion Breath. The dragon exhales repulsion energy in a 30-foot cone. Each creature in that area must succeed on a DC 19 Strength saving throw. On a failed save, the creature is pushed 60 feet away from the dragon.",attack_bonus:0,damage_dice:"12d10"}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 10 ft. of the dragon must succeed on a DC 20 Dexterity saving throw or take 14 (2d6 + 7) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Adult Copper Dragon",size:"Huge",type:"dragon",subtype:"",alignment:"chaotic good",ac:18,hp:184,hit_dice:"16d12 + 80",speed:"40 ft., climb 40 ft., fly 80 ft.",stats:[23,12,21,18,15,17],saves:[{dexterity:6},{constitution:10},{wisdom:7},{charisma:8}],skillsaves:[{deception:8},{perception:12},{stealth:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"acid",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 22",languages:"Common, Draconic",cr:"14",traits:[{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +11 to hit, reach 10 ft., one target. Hit: 17 (2d10 + 6) piercing damage.",attack_bonus:11,damage_dice:"2d10",damage_bonus:6},{name:"Claw",desc:"Melee Weapon Attack: +11 to hit, reach 5 ft., one target. Hit: 13 (2d6 + 6) slashing damage.",attack_bonus:11,damage_dice:"2d6",damage_bonus:6},{name:"Tail",desc:"Melee Weapon Attack: +11 to hit, reach 15 ft., one target. Hit: 15 (2d8 + 6) bludgeoning damage.",attack_bonus:11,damage_dice:"2d8",damage_bonus:6},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 16 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Breath Weapons (Recharge 5-6)",desc:"The dragon uses one of the following breath weapons.\\nAcid Breath. The dragon exhales acid in an 60-foot line that is 5 feet wide. Each creature in that line must make a DC 18 Dexterity saving throw, taking 54 (12d8) acid damage on a failed save, or half as much damage on a successful one.\\nSlowing Breath. The dragon exhales gas in a 60-foot cone. Each creature in that area must succeed on a DC 18 Constitution saving throw. On a failed save, the creature can't use reactions, its speed is halved, and it can't make more than one attack on its turn. In addition, the creature can use either an action or a bonus action on its turn, but not both. These effects last for 1 minute. The creature can repeat the saving throw at the end of each of its turns, ending the effect on itself with a successful save.",attack_bonus:0,damage_dice:"12d8"}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 10 ft. of the dragon must succeed on a DC 19 Dexterity saving throw or take 13 (2d6 + 6) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Adult Gold Dragon",size:"Huge",type:"dragon",subtype:"",alignment:"lawful good",ac:19,hp:256,hit_dice:"19d12 + 132",speed:"40 ft., fly 80 ft., swim 40 ft.",stats:[27,14,25,16,15,24],saves:[{dexterity:8},{constitution:13},{wisdom:8},{charisma:13}],skillsaves:[{insight:8},{persuasion:13},{perception:14},{stealth:8}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 24",languages:"Common, Draconic",cr:"17",traits:[{name:"Amphibious",desc:"The dragon can breathe air and water.",attack_bonus:0},{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +14 to hit, reach 10 ft., one target. Hit: 19 (2d10 + 8) piercing damage.",attack_bonus:14,damage_dice:"2d10",damage_bonus:8},{name:"Claw",desc:"Melee Weapon Attack: +14 to hit, reach 5 ft., one target. Hit: 15 (2d6 + 8) slashing damage.",attack_bonus:14,damage_dice:"2d6",damage_bonus:8},{name:"Tail",desc:"Melee Weapon Attack: +14 to hit, reach 15 ft., one target. Hit: 17 (2d8 + 8) bludgeoning damage.",attack_bonus:14,damage_dice:"2d8",damage_bonus:8},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 21 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Breath Weapons (Recharge 5-6)",desc:"The dragon uses one of the following breath weapons.\\nFire Breath. The dragon exhales fire in a 60-foot cone. Each creature in that area must make a DC 21 Dexterity saving throw, taking 66 (12d10) fire damage on a failed save, or half as much damage on a successful one.\\nWeakening Breath. The dragon exhales gas in a 60-foot cone. Each creature in that area must succeed on a DC 21 Strength saving throw or have disadvantage on Strength-based attack rolls, Strength checks, and Strength saving throws for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",attack_bonus:0,damage_dice:"12d10"}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 10 ft. of the dragon must succeed on a DC 22 Dexterity saving throw or take 15 (2d6 + 8) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Adult Green Dragon",size:"Huge",type:"dragon",subtype:"",alignment:"lawful evil",ac:19,hp:207,hit_dice:"18d12 + 90",speed:"40 ft., fly 80 ft., swim 40 ft.",stats:[23,12,21,18,15,17],saves:[{dexterity:6},{constitution:10},{wisdom:7},{charisma:8}],skillsaves:[{deception:8},{insight:7},{persuasion:8},{perception:12},{stealth:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"poison",condition_immunities:"poisoned",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 22",languages:"Common, Draconic",cr:"15",traits:[{name:"Amphibious",desc:"The dragon can breathe air and water.",attack_bonus:0},{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +11 to hit, reach 10 ft., one target. Hit: 17 (2d10 + 6) piercing damage plus 7 (2d6) poison damage.",attack_bonus:11,damage_dice:"2d10 + 2d6",damage_bonus:6},{name:"Claw",desc:"Melee Weapon Attack: +11 to hit, reach 5 ft., one target. Hit: 13 (2d6 + 6) slashing damage.",attack_bonus:11,damage_dice:"2d6",damage_bonus:6},{name:"Tail",desc:"Melee Weapon Attack: +11 to hit, reach 15 ft., one target. Hit: 15 (2d8 + 6) bludgeoning damage.",attack_bonus:11,damage_dice:"2d8",damage_bonus:6},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 16 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours .",attack_bonus:0},{name:"Poison Breath (Recharge 5-6)",desc:"The dragon exhales poisonous gas in a 60-foot cone. Each creature in that area must make a DC 18 Constitution saving throw, taking 56 (16d6) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"16d6"}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 10 ft. of the dragon must succeed on a DC 19 Dexterity saving throw or take 13 (2d6 + 6) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Adult Red Dragon",size:"Huge",type:"dragon",subtype:"",alignment:"chaotic evil",ac:19,hp:256,hit_dice:"19d12 + 132",speed:"40 ft., climb 40 ft., fly 80 ft.",stats:[27,10,25,16,13,21],saves:[{dexterity:6},{constitution:13},{wisdom:7},{charisma:11}],skillsaves:[{perception:13},{stealth:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 23",languages:"Common, Draconic",cr:"17",traits:[{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +14 to hit, reach 10 ft., one target. Hit: 19 (2d10 + 8) piercing damage plus 7 (2d6) fire damage.",attack_bonus:14,damage_dice:"2d10 + 2d6",damage_bonus:8},{name:"Claw",desc:"Melee Weapon Attack: +14 to hit, reach 5 ft., one target. Hit: 15 (2d6 + 8) slashing damage.",attack_bonus:14,damage_dice:"2d6",damage_bonus:8},{name:"Tail",desc:"Melee Weapon Attack: +14 to hit, reach 15 ft., one target. Hit: 17 (2d8 + 8) bludgeoning damage.",attack_bonus:14,damage_dice:"2d8",damage_bonus:8},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 ft. of the dragon and aware of it must succeed on a DC 19 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Fire Breath (Recharge 5-6)",desc:"The dragon exhales fire in a 60-foot cone. Each creature in that area must make a DC 21 Dexterity saving throw, taking 63 (18d6) fire damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"18d6"},{name:"Lair Actions",desc:"On initiative count 20 (losing initiative ties), the dragon takes a lair action to cause one of the following effects: the dragon can't use the same effect two rounds in a row:\\n\u2022 Magma erupts from a point on the ground the dragon can see within 120 feet of it, creating a 20-foot-high, 5-foot-radius geyser. Each creature in the geyser's area must make a DC 15 Dexterity saving throw, taking 21 (6d6) fire damage on a failed save, or half as much damage on a successful one.\\n\u2022 A tremor shakes the lair in a 60-foot-radius around the dragon. Each creature other than the dragon on the ground in that area must succeed on a DC 15 Dexterity saving throw or be knocked prone.\\n\u2022 Volcanic gases form a cloud in a 20-foot-radius sphere centered on a point the dragon can see within 120 feet of it. The sphere spreads around corners, and its area is lightly obscured. It lasts until initiative count 20 on the next round. Each creature that starts its turn in the cloud must succeed on a DC 13 Constitution saving throw or be poisoned until the end of its turn. While poisoned in this way, a creature is incapacitated.",attack_bonus:0,damage_dice:"6d6"}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 10 ft. of the dragon must succeed on a DC 22 Dexterity saving throw or take 15 (2d6 + 8) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Adult Silver Dragon",size:"Huge",type:"dragon",subtype:"",alignment:"lawful good",ac:19,hp:243,hit_dice:"18d12 + 126",speed:"40 ft., fly 80 ft.",stats:[27,10,25,16,13,21],saves:[{dexterity:5},{constitution:12},{wisdom:6},{charisma:10}],skillsaves:[{arcana:8},{history:8},{perception:11},{stealth:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"cold",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 21",languages:"Common, Draconic",cr:"16",traits:[{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +13 to hit, reach 10 ft., one target. Hit: 19 (2d10 + 8) piercing damage.",attack_bonus:13,damage_dice:"2d10",damage_bonus:8},{name:"Claw",desc:"Melee Weapon Attack: +13 to hit, reach 5 ft., one target. Hit: 15 (2d6 + 8) slashing damage.",attack_bonus:13,damage_dice:"2d6",damage_bonus:8},{name:"Tail",desc:"Melee Weapon Attack: +13 to hit, reach 15 ft., one target. Hit: 17 (2d8 + 8) bludgeoning damage.",attack_bonus:13,damage_dice:"2d8",damage_bonus:8},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 18 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Breath Weapons (Recharge 5-6)",desc:"The dragon uses one of the following breath weapons.\\nCold Breath. The dragon exhales an icy blast in a 60-foot cone. Each creature in that area must make a DC 20 Constitution saving throw, taking 58 (13d8) cold damage on a failed save, or half as much damage on a successful one.\\nParalyzing Breath. The dragon exhales paralyzing gas in a 60-foot cone. Each creature in that area must succeed on a DC 20 Constitution saving throw or be paralyzed for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",attack_bonus:0,damage_dice:"13d8"}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 10 ft. of the dragon must succeed on a DC 22 Dexterity saving throw or take 15 (2d6 + 8) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Adult White Dragon",size:"Huge",type:"dragon",subtype:"",alignment:"chaotic evil",ac:18,hp:200,hit_dice:"16d12 + 96",speed:"40 ft., burrow 30 ft., fly 80 ft., swim 40 ft.",stats:[22,10,22,8,12,12],saves:[{dexterity:5},{constitution:11},{wisdom:6},{charisma:6}],skillsaves:[{perception:11},{stealth:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"cold",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 21",languages:"Common, Draconic",cr:"13",traits:[{name:"Ice Walk",desc:"The dragon can move across and climb icy surfaces without needing to make an ability check. Additionally, difficult terrain composed of ice or snow doesn't cost it extra moment.",attack_bonus:0},{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +11 to hit, reach 10 ft., one target. Hit: 17 (2d10 + 6) piercing damage plus 4 (1d8) cold damage.",attack_bonus:11,damage_dice:"2d10 + 1d8",damage_bonus:6},{name:"Claw",desc:"Melee Weapon Attack: +11 to hit, reach 5 ft., one target. Hit: 13 (2d6 + 6) slashing damage.",attack_bonus:11,damage_dice:"2d6",damage_bonus:6},{name:"Tail",desc:"Melee Weapon Attack: +11 to hit, reach 15 ft., one target. Hit: 15 (2d8 + 6) bludgeoning damage.",attack_bonus:11,damage_dice:"2d8",damage_bonus:6},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 ft. of the dragon and aware of it must succeed on a DC 14 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Cold Breath (Recharge 5-6)",desc:"The dragon exhales an icy blast in a 60-foot cone. Each creature in that area must make a DC 19 Constitution saving throw, taking 54 (12d8) cold damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"12d8"}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 10 ft. of the dragon must succeed on a DC 19 Dexterity saving throw or take 13 (2d6 + 6) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Air Elemental",size:"Large",type:"elemental",subtype:"",alignment:"neutral",ac:15,hp:90,hit_dice:"12d10 + 24",speed:"fly 90 ft. (hover)",stats:[14,20,14,6,10,6],damage_vulnerabilities:"",damage_resistances:"lightning; thunder; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"poison",condition_immunities:"exhaustion, grappled, paralyzed, petrified, poisoned, prone, restrained, unconscious",senses:"darkvision 60 ft., passive Perception 10",languages:"Auran",cr:"5",traits:[{name:"Air Form",desc:"The elemental can enter a hostile creature's space and stop there. It can move through a space as narrow as 1 inch wide without squeezing.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The elemental makes two slam attacks.",attack_bonus:0},{name:"Slam",desc:"Melee Weapon Attack: +8 to hit, reach 5 ft., one target. Hit: 14 (2d8 + 5) bludgeoning damage.",attack_bonus:8,damage_dice:"2d8",damage_bonus:5},{name:"Whirlwind (Recharge 4-6)",desc:"Each creature in the elemental's space must make a DC 13 Strength saving throw. On a failure, a target takes 15 (3d8 + 2) bludgeoning damage and is flung up 20 feet away from the elemental in a random direction and knocked prone. If a thrown target strikes an object, such as a wall or floor, the target takes 3 (1d6) bludgeoning damage for every 10 feet it was thrown. If the target is thrown at another creature, that creature must succeed on a DC 13 Dexterity saving throw or take the same damage and be knocked prone.\\nIf the saving throw is successful, the target takes half the bludgeoning damage and isn't flung away or knocked prone.",attack_bonus:0}]},{name:"Ancient Black Dragon",size:"Gargantuan",type:"dragon",subtype:"",alignment:"chaotic evil",ac:22,hp:367,hit_dice:"21d20 + 146",speed:"40 ft., fly 80 ft., swim 40 ft.",stats:[27,14,25,16,15,19],saves:[{dexterity:9},{constitution:14},{wisdom:9},{charisma:11}],skillsaves:[{perception:16},{stealth:9}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"acid",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 26",languages:"Common, Draconic",cr:"21",traits:[{name:"Amphibious",desc:"The dragon can breathe air and water.",attack_bonus:0},{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack:+ 15 to hit, reach 15 ft., one target. Hit: 19 (2d10 + 8) piercing damage plus 9 (2d8) acid damage.",attack_bonus:15,damage_dice:"2d10 + 2d8",damage_bonus:8},{name:"Claw",desc:"Melee Weapon Attack: +15 to hit, reach 10 ft., one target. Hit: 15 (2d6 + 8) slashing damage.",attack_bonus:15,damage_dice:"2d6",damage_bonus:8},{name:"Tail",desc:"Melee Weapon Attack: +15 to hit, reach 20 ft ., one target. Hit: 17 (2d8 + 8) bludgeoning damage.",attack_bonus:15,damage_dice:"2d8",damage_bonus:8},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 19 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Acid Breath (Recharge 5-6)",desc:"The dragon exhales acid in a 90-foot line that is 10 feet wide. Each creature in that line must make a DC 22 Dexterity saving throw, taking 67 (15d8) acid damage on a failed save, or half as much damage on a successful one.",attack_bonus:0}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 15 ft. of the dragon must succeed on a DC 23 Dexterity saving throw or take 15 (2d6 + 8) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Ancient Blue Dragon",size:"Gargantuan",type:"dragon",subtype:"",alignment:"lawful evil",ac:22,hp:481,hit_dice:"26d20 + 208",speed:"40 ft., burrow 40 ft., fly 80 ft.",stats:[29,10,27,18,17,21],saves:[{dexterity:7},{constitution:15},{wisdom:10},{charisma:12}],skillsaves:[{perception:17},{stealth:7}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"lightning",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 27",languages:"Common, Draconic",cr:"23",actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +16 to hit, reach 15 ft., one target. Hit: 20 (2d10 + 9) piercing damage plus 11 (2d10) lightning damage.",attack_bonus:16,damage_dice:"2d10 + 2d10",damage_bonus:9},{name:"Claw",desc:"Melee Weapon Attack: +16 to hit, reach 10 ft., one target. Hit: 16 (2d6 + 9) slashing damage.",attack_bonus:16,damage_dice:"2d6",damage_bonus:9},{name:"Tail",desc:"Melee Weapon Attack: +16 to hit, reach 20 ft., one target. Hit: 18 (2d8 + 9) bludgeoning damage.",attack_bonus:16,damage_dice:"2d8",damage_bonus:9},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 20 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Lightning Breath (Recharge 5-6)",desc:"The dragon exhales lightning in a 120-foot line that is 10 feet wide. Each creature in that line must make a DC 23 Dexterity saving throw, taking 88 (16d10) lightning damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"16d10"}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 15 ft. of the dragon must succeed on a DC 24 Dexterity saving throw or take 16 (2d6 + 9) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Ancient Brass Dragon",size:"Gargantuan",type:"dragon",subtype:"",alignment:"chaotic good",ac:20,hp:297,hit_dice:"17d20 + 118",speed:"40 ft., burrow 40 ft., fly 80 ft.",stats:[27,10,25,16,15,19],saves:[{dexterity:6},{constitution:13},{wisdom:8},{charisma:10}],skillsaves:[{history:9},{persuasion:10},{perception:14},{stealth:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 24",languages:"Common, Draconic",cr:"20",traits:[{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +14 to hit, reach 15 ft., one target. Hit: 19 (2d10 + 8) piercing damage.",attack_bonus:14,damage_dice:"2d10",damage_bonus:8},{name:"Claw",desc:"Melee Weapon Attack: +14 to hit, reach 10 ft., one target. Hit: 15 (2d6 + 8) slashing damage.",attack_bonus:14,damage_dice:"2d6",damage_bonus:8},{name:"Tail",desc:"Melee Weapon Attack: +14 to hit, reach 20 ft., one target. Hit: 17 (2d8 + 8) bludgeoning damage.",attack_bonus:14,damage_dice:"2d8",damage_bonus:8},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 18 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Breath Weapons (Recharge 5-6)",desc:"The dragon uses one of the following breath weapons:\\nFire Breath. The dragon exhales fire in an 90-foot line that is 10 feet wide. Each creature in that line must make a DC 21 Dexterity saving throw, taking 56 (16d6) fire damage on a failed save, or half as much damage on a successful one.\\nSleep Breath. The dragon exhales sleep gas in a 90-foot cone. Each creature in that area must succeed on a DC 21 Constitution saving throw or fall unconscious for 10 minutes. This effect ends for a creature if the creature takes damage or someone uses an action to wake it.",attack_bonus:0,damage_dice:"16d6"},{name:"Change Shape",desc:"The dragon magically polymorphs into a humanoid or beast that has a challenge rating no higher than its own, or back into its true form. It reverts to its true form if it dies. Any equipment it is wearing or carrying is absorbed or borne by the new form (the dragon's choice).\\nIn a new form, the dragon retains its alignment, hit points, Hit Dice, ability to speak, proficiencies, Legendary Resistance, lair actions, and Intelligence, Wisdom, and Charisma scores, as well as this action. Its statistics and capabilities are otherwise replaced by those of the new form, except any class features or legendary actions of that form.",attack_bonus:0}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 15 ft. of the dragon must succeed on a DC 22 Dexterity saving throw or take 15 (2d6 + 8) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Ancient Bronze Dragon",size:"Gargantuan",type:"dragon",subtype:"",alignment:"lawful good",ac:22,hp:444,hit_dice:"24d20 + 192",speed:"40 ft., fly 80 ft., swim 40 ft.",stats:[29,10,27,18,17,21],saves:[{dexterity:7},{constitution:15},{wisdom:10},{charisma:12}],skillsaves:[{insight:10},{perception:17},{stealth:7}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"lightning",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 27",languages:"Common, Draconic",cr:"22",traits:[{name:"Amphibious",desc:"The dragon can breathe air and water.",attack_bonus:0},{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +16 to hit, reach 15 ft., one target. Hit: 20 (2d10 + 9) piercing damage.",attack_bonus:16,damage_dice:"2d10",damage_bonus:9},{name:"Claw",desc:"Melee Weapon Attack: +16 to hit, reach 10 ft., one target. Hit: 16 (2d6 + 9) slashing damage.",attack_bonus:16,damage_dice:"1d6",damage_bonus:9},{name:"Tail",desc:"Melee Weapon Attack: +16 to hit, reach 20 ft., one target. Hit: 18 (2d8 + 9) bludgeoning damage.",attack_bonus:0,damage_dice:"2d8",damage_bonus:9},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 20 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Breath Weapons (Recharge 5-6)",desc:"The dragon uses one of the following breath weapons.\\nLightning Breath. The dragon exhales lightning in a 120-foot line that is 10 feet wide. Each creature in that line must make a DC 23 Dexterity saving throw, taking 88 (16d10) lightning damage on a failed save, or half as much damage on a successful one.\\nRepulsion Breath. The dragon exhales repulsion energy in a 30-foot cone. Each creature in that area must succeed on a DC 23 Strength saving throw. On a failed save, the creature is pushed 60 feet away from the dragon.",attack_bonus:0,damage_dice:"16d10"},{name:"Change Shape",desc:"The dragon magically polymorphs into a humanoid or beast that has a challenge rating no higher than its own, or back into its true form. It reverts to its true form if it dies. Any equipment it is wearing or carrying is absorbed or borne by the new form (the dragon's choice).\\nIn a new form, the dragon retains its alignment, hit points, Hit Dice, ability to speak, proficiencies, Legendary Resistance, lair actions, and Intelligence, Wisdom, and Charisma scores, as well as this action. Its statistics and capabilities are otherwise replaced by those of the new form, except any class features or legendary actions of that form.",attack_bonus:0}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 15 ft. of the dragon must succeed on a DC 24 Dexterity saving throw or take 16 (2d6 + 9) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Ancient Copper Dragon",size:"Gargantuan",type:"dragon",subtype:"",alignment:"chaotic good",ac:21,hp:350,hit_dice:"20d20 + 140",speed:"40 ft., climb 40 ft., fly 80 ft.",stats:[27,12,25,20,17,19],saves:[{dexterity:8},{constitution:14},{wisdom:10},{charisma:11}],skillsaves:[{stealth:8},{perception:17},{deception:11}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"acid",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 27",languages:"Common, Draconic",cr:"21",traits:[{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +15 to hit, reach 15 ft., one target. Hit: 19 (2d10 + 8) piercing damage.",attack_bonus:15,damage_dice:"2d10",damage_bonus:8},{name:"Claw",desc:"Melee Weapon Attack: +15 to hit, reach 10 ft., one target. Hit: 15 (2d6 + 8) slashing damage.",attack_bonus:15,damage_dice:"2d6",damage_bonus:8},{name:"Tail",desc:"Melee Weapon Attack: +15 to hit, reach 20 ft., one target. Hit: 17 (2d8 + 8) bludgeoning damage.",attack_bonus:15,damage_dice:"2d8",damage_bonus:8},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 19 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Breath Weapons (Recharge 5-6)",desc:"The dragon uses one of the following breath weapons.\\nAcid Breath. The dragon exhales acid in an 90-foot line that is 10 feet wide. Each creature in that line must make a DC 22 Dexterity saving throw, taking 63 (14d8) acid damage on a failed save, or half as much damage on a successful one.\\nSlowing Breath. The dragon exhales gas in a 90-foot cone. Each creature in that area must succeed on a DC 22 Constitution saving throw. On a failed save, the creature can't use reactions, its speed is halved, and it can't make more than one attack on its turn. In addition, the creature can use either an action or a bonus action on its turn, but not both. These effects last for 1 minute. The creature can repeat the saving throw at the end of each of its turns, ending the effect on itself with a successful save.",attack_bonus:0,damage_dice:"14d8"},{name:"Change Shape",desc:"The dragon magically polymorphs into a humanoid or beast that has a challenge rating no higher than its own, or back into its true form. It reverts to its true form if it dies. Any equipment it is wearing or carrying is absorbed or borne by the new form (the dragon's choice).\\nIn a new form, the dragon retains its alignment, hit points, Hit Dice, ability to speak, proficiencies, Legendary Resistance, lair actions, and Intelligence, Wisdom, and Charisma scores, as well as this action. Its statistics and capabilities are otherwise replaced by those of the new form, except any class features or legendary actions of that form.",attack_bonus:0}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 15 ft. of the dragon must succeed on a DC 23 Dexterity saving throw or take 15 (2d6 + 8) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Ancient Gold Dragon",size:"Gargantuan",type:"dragon",subtype:"",alignment:"lawful good",ac:22,hp:546,hit_dice:"28d20 + 252",speed:"40 ft., fly 80 ft., swim 40 ft.",stats:[30,14,29,18,17,28],saves:[{dexterity:9},{constitution:16},{wisdom:10},{charisma:16}],skillsaves:[{persuasion:16},{stealth:9},{perception:17},{insight:10}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 27",languages:"Common, Draconic",cr:"24",traits:[{name:"Amphibious",desc:"The dragon can breathe air and water.",attack_bonus:0},{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +17 to hit, reach 15 ft., one target. Hit: 21 (2d10 + 10) piercing damage.",attack_bonus:17,damage_dice:"2d10",damage_bonus:10},{name:"Claw",desc:"Melee Weapon Attack: +17 to hit, reach 10 ft., one target. Hit: 17 (2d6 + 10) slashing damage.",attack_bonus:17,damage_dice:"2d6",damage_bonus:10},{name:"Tail",desc:"Melee Weapon Attack: +17 to hit, reach 20 ft., one target. Hit: 19 (2d8 + 10) bludgeoning damage.",attack_bonus:17,damage_dice:"2d8",damage_bonus:10},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 24 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Breath Weapons (Recharge 5-6)",desc:"The dragon uses one of the following breath weapons.\\nFire Breath. The dragon exhales fire in a 90-foot cone. Each creature in that area must make a DC 24 Dexterity saving throw, taking 71 (13d10) fire damage on a failed save, or half as much damage on a successful one.\\nWeakening Breath. The dragon exhales gas in a 90-foot cone. Each creature in that area must succeed on a DC 24 Strength saving throw or have disadvantage on Strength-based attack rolls, Strength checks, and Strength saving throws for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",attack_bonus:0,damage_dice:"13d10"},{name:"Change Shape",desc:"The dragon magically polymorphs into a humanoid or beast that has a challenge rating no higher than its own, or back into its true form. It reverts to its true form if it dies. Any equipment it is wearing or carrying is absorbed or borne by the new form (the dragon's choice).\\nIn a new form, the dragon retains its alignment, hit points, Hit Dice, ability to speak, proficiencies, Legendary Resistance, lair actions, and Intelligence, Wisdom, and Charisma scores, as well as this action. Its statistics and capabilities are otherwise replaced by those of the new form, except any class features or legendary actions of that form.",attack_bonus:0}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 15 ft. of the dragon must succeed on a DC 25 Dexterity saving throw or take 17 (2d6 + 10) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Ancient Green Dragon",size:"Gargantuan",type:"dragon",subtype:"",alignment:"lawful evil",ac:21,hp:385,hit_dice:"22d20 + 154",speed:"40 ft., fly 80 ft., swim 40 ft.",stats:[27,12,25,20,17,19],saves:[{dexterity:8},{constitution:14},{wisdom:10},{charisma:11}],skillsaves:[{deception:11},{insight:10},{perception:17},{persuasion:11},{stealth:8}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"poison",condition_immunities:"poisoned",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 27",languages:"Common, Draconic",cr:"22",traits:[{name:"Amphibious",desc:"The dragon can breathe air and water.",attack_bonus:0},{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +15 to hit, reach 15 ft., one target. Hit: 19 (2d10 + 8) piercing damage plus 10 (3d6) poison damage.",attack_bonus:15,damage_dice:"2d10 + 3d6",damage_bonus:9},{name:"Claw",desc:"Melee Weapon Attack: +15 to hit, reach 10 ft., one target. Hit: 22 (4d6 + 8) slashing damage.",attack_bonus:15,damage_dice:"4d6",damage_bonus:8},{name:"Tail",desc:"Melee Weapon Attack: +15 to hit, reach 20 ft., one target. Hit: 17 (2d8 + 8) bludgeoning damage.",attack_bonus:16,damage_dice:"2d8",damage_bonus:8},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 19 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Poison Breath (Recharge 5-6)",desc:"The dragon exhales poisonous gas in a 90-foot cone. Each creature in that area must make a DC 22 Constitution saving throw, taking 77 (22d6) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"22d6"}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 15 ft. of the dragon must succeed on a DC 23 Dexterity saving throw or take 15 (2d6 + 8) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Ancient Red Dragon",size:"Gargantuan",type:"dragon",subtype:"",alignment:"chaotic evil",ac:22,hp:546,hit_dice:"28d20 + 252",speed:"40 ft., climb 40 ft., fly 80 ft.",stats:[30,10,29,18,15,23],saves:[{dexterity:7},{constitution:16},{wisdom:9},{charisma:13}],skillsaves:[{perception:16},{stealth:7}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 26",languages:"Common, Draconic",cr:"24",traits:[{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +17 to hit, reach 15 ft., one target. Hit: 21 (2d10 + 10) piercing damage plus 14 (4d6) fire damage.",attack_bonus:17,damage_dice:"2d10 + 4d6",damage_bonus:10},{name:"Claw",desc:"Melee Weapon Attack: +17 to hit, reach 10 ft., one target. Hit: 17 (2d6 + 10) slashing damage.",attack_bonus:17,damage_dice:"2d6",damage_bonus:10},{name:"Tail",desc:"Melee Weapon Attack: +17 to hit, reach 20 ft., one target. Hit: 19 (2d8 + 10) bludgeoning damage.",attack_bonus:17,damage_dice:"2d8",damage_bonus:10},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 21 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Fire Breath (Recharge 5-6)",desc:"The dragon exhales fire in a 90-foot cone. Each creature in that area must make a DC 24 Dexterity saving throw, taking 91 (26d6) fire damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"26d6"}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 15 ft. of the dragon must succeed on a DC 25 Dexterity saving throw or take 17 (2d6 + 10) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Ancient Silver Dragon",size:"Gargantuan",type:"dragon",subtype:"",alignment:"lawful good",ac:22,hp:487,hit_dice:"25d20 + 224",speed:"40 ft., fly 80 ft.",stats:[30,10,29,18,15,23],saves:[{dexterity:7},{constitution:16},{wisdom:9},{charisma:13}],skillsaves:[{arcana:11},{perception:16},{history:11},{stealth:7}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"cold",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 26",languages:"Common, Draconic",cr:"23",traits:[{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +17 to hit, reach 15 ft., one target. Hit: 21 (2d10 + 10) piercing damage.",attack_bonus:17,damage_dice:"2d10",damage_bonus:10},{name:"Claw",desc:"Melee Weapon Attack: +17 to hit, reach 10 ft., one target. Hit: 17 (2d6 + 10) slashing damage.",attack_bonus:17,damage_dice:"2d6",damage_bonus:10},{name:"Tail",desc:"Melee Weapon Attack: +17 to hit, reach 20 ft., one target. Hit: 19 (2d8 + 10) bludgeoning damage.",attack_bonus:17,damage_dice:"2d8",damage_bonus:10},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 21 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Breath Weapons (Recharge 5-6)",desc:"The dragon uses one of the following breath weapons.\\nCold Breath. The dragon exhales an icy blast in a 90-foot cone. Each creature in that area must make a DC 24 Constitution saving throw, taking 67 (15d8) cold damage on a failed save, or half as much damage on a successful one.\\nParalyzing Breath. The dragon exhales paralyzing gas in a 90- foot cone. Each creature in that area must succeed on a DC 24 Constitution saving throw or be paralyzed for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",attack_bonus:0,damage_dice:"15d8"},{name:"Change Shape",desc:"The dragon magically polymorphs into a humanoid or beast that has a challenge rating no higher than its own, or back into its true form. It reverts to its true form if it dies. Any equipment it is wearing or carrying is absorbed or borne by the new form (the dragon's choice).\\nIn a new form, the dragon retains its alignment, hit points, Hit Dice, ability to speak, proficiencies, Legendary Resistance, lair actions, and Intelligence, Wisdom, and Charisma scores, as well as this action. Its statistics and capabilities are otherwise replaced by those of the new form, except any class features or legendary actions of that form.",attack_bonus:0}],legendary_actions:[{name:"Detect",desc:"The dragon makes a Wisdom (Perception) check.",attack_bonus:0},{name:"Tail Attack",desc:"The dragon makes a tail attack.",attack_bonus:0},{name:"Wing Attack (Costs 2 Actions)",desc:"The dragon beats its wings. Each creature within 15 ft. of the dragon must succeed on a DC 25 Dexterity saving throw or take 17 (2d6 + 10) bludgeoning damage and be knocked prone. The dragon can then fly up to half its flying speed.",attack_bonus:0}]},{name:"Ancient White Dragon",size:"Gargantuan",type:"dragon",subtype:"",alignment:"chaotic evil",ac:20,hp:333,hit_dice:"18d20 + 144",speed:"40 ft., burrow 40 ft., fly 80 ft., swim 40 ft.",stats:[26,10,26,10,13,14],saves:[{dexterity:6},{constitution:14},{wisdom:7},{charisma:8}],skillsaves:[{perception:13},{stealth:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"cold",condition_immunities:"",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 23",languages:"Common, Draconic",cr:"20",traits:[{name:"Ice Walk",desc:"The dragon can move across and climb icy surfaces without needing to make an ability check. Additionally, difficult terrain composed of ice or snow doesn't cost it extra moment.",attack_bonus:0},{name:"Legendary Resistance (3/Day)",desc:"If the dragon fails a saving throw, it can choose to succeed instead.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon can use its Frightful Presence. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +14 to hit, reach 15 ft., one target. Hit: 19 (2d10 + 8) piercing damage plus 9 (2d8) cold damage.",attack_bonus:14,damage_dice:"2d10 + 2d8",damage_bonus:8},{name:"Claw",desc:"Melee Weapon Attack: +14 to hit, reach 10 ft., one target. Hit: 15 (2d6 + 8) slashing damage.",attack_bonus:14,damage_dice:"2d6",damage_bonus:8},{name:"Tail",desc:"Melee Weapon Attack: +14 to hit, reach 20 ft., one target. Hit: 17 (2d8 + 8) bludgeoning damage.",attack_bonus:14,damage_dice:"2d8",damage_bonus:8},{name:"Frightful Presence",desc:"Each creature of the dragon's choice that is within 120 feet of the dragon and aware of it must succeed on a DC 16 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the dragon's Frightful Presence for the next 24 hours .",attack_bonus:0},{name:"Cold Breath (Recharge 5-6)",desc:"The dragon exhales an icy blast in a 90-foot cone. Each creature in that area must make a DC 22 Constitution saving throw, taking 72 (l6d8) cold damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"16d8"}]},{name:"Androsphinx",size:"Large",type:"monstrosity",subtype:"",alignment:"lawful neutral",ac:17,hp:199,hit_dice:"19d10 + 94",speed:"40 ft., fly 60 ft.",stats:[22,10,20,16,18,23],saves:[{dexterity:6},{constitution:11},{intelligence:9},{wisdom:10}],skillsaves:[{religion:15},{perception:10},{arcana:9}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"psychic; bludgeoning, piercing, and slashing from nonmagical weapons",condition_immunities:"charmed, frightened",senses:"truesight 120 ft., passive Perception 20",languages:"Common, Sphinx",cr:"17",traits:[{name:"Inscrutable",desc:"The sphinx is immune to any effect that would sense its emotions or read its thoughts, as well as any divination spell that it refuses. Wisdom (Insight) checks made to ascertain the sphinx's intentions or sincerity have disadvantage.",attack_bonus:0},{name:"Magic Weapons",desc:"The sphinx's weapon attacks are magical.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The sphinx makes two claw attacks.",attack_bonus:0},{name:"Claw",desc:"Melee Weapon Attack: +12 to hit, reach 5 ft., one target. Hit: 17 (2d10 + 6) slashing damage.",attack_bonus:12,damage_dice:"2d10",damage_bonus:6},{name:"Roar (3/Day)",desc:"The sphinx emits a magical roar. Each time it roars before finishing a long rest, the roar is louder and the effect is different, as detailed below. Each creature within 500 feet of the sphinx and able to hear the roar must make a saving throw.\\n\\nFirst Roar. Each creature that fails a DC 18 Wisdom saving throw is frightened for 1 minute. A frightened creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.\\n\\nSecond Roar. Each creature that fails a DC 18 Wisdom saving throw is deafened and frightened for 1 minute. A frightened creature is paralyzed and can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.\\n\\nThird Roar. Each creature makes a DC 18 Constitution saving throw. On a failed save, a creature takes 44 (8d10) thunder damage and is knocked prone. On a successful save, the creature takes half as much damage and isn't knocked prone.",attack_bonus:0}],legendary_actions:[{name:"Claw Attack",desc:"The sphinx makes one claw attack.",attack_bonus:0},{name:"Teleport (Costs 2 Actions)",desc:"The sphinx magically teleports, along with any equipment it is wearing or carrying, up to 120 feet to an unoccupied space it can see.",attack_bonus:0},{name:"Cast a Spell (Costs 3 Actions)",desc:"The sphinx casts a spell from its list of prepared spells, using a spell slot as normal.",attack_bonus:0}],spells:["The sphinx is a 12th-level spellcaster. Its spellcasting ability is Wisdom (spell save DC 18, +10 to hit with spell attacks). It requires no material components to cast its spells. The sphinx has the following cleric spells prepared:",{"Cantrips (at will)":"sacred flame, spare the dying, thaumaturgy"},{"1st level (4 slots)":"command, detect evil and good, detect magic"},{"2nd level (3 slots)":"lesser restoration, zone of truth"},{"3rd level (3 slots)":"dispel magic, tongues"},{"4th level (3 slots)":"banishment, freedom of movement"},{"5th level (2 slots)":"flame strike, greater restoration"},{"6th level (1 slot)":"heroes' feast"}]},{name:"Animated Armor",size:"Medium",type:"construct",subtype:"",alignment:"unaligned",ac:18,hp:33,hit_dice:"6d8 + 6",speed:"25 ft.",stats:[14,11,13,1,3,1],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"poison, psychic",condition_immunities:"blinded, charmed, deafened, exhaustion, frightened, paralyzed, petrified, poisoned",senses:"blindsight 60 ft. (blind beyond this radius), passive Perception 6",languages:"",cr:"1",traits:[{name:"Antimagic Susceptibility",desc:"The armor is incapacitated while in the area of an antimagic field. If targeted by dispel magic, the armor must succeed on a Constitution saving throw against the caster's spell save DC or fall unconscious for 1 minute.",attack_bonus:0},{name:"False Appearance",desc:"While the armor remains motionless, it is indistinguishable from a normal suit of armor.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The armor makes two melee attacks.",attack_bonus:0},{name:"Slam",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) bludgeoning damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2}]},{name:"Ankheg",size:"Large",type:"monstrosity",subtype:"",alignment:"unaligned",ac:14,hp:39,hit_dice:"6d10 + 6",speed:"30 ft., burrow 10 ft.",stats:[17,11,13,1,13,6],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., tremorsense 60 ft., passive Perception 11",languages:"",cr:"2",actions:[{name:"Bite",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) slashing damage plus 3 (1d6) acid damage. If the target is a Large or smaller creature, it is grappled (escape DC 13). Until this grapple ends, the ankheg can bite only the grappled creature and has advantage on attack rolls to do so.",attack_bonus:5,damage_dice:"2d6 + 1d6",damage_bonus:3},{name:"Acid Spray (Recharge 6)",desc:"The ankheg spits acid in a line that is 30 ft. long and 5 ft. wide, provided that it has no creature grappled. Each creature in that line must make a DC 13 Dexterity saving throw, taking 10 (3d6) acid damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"3d6"}]},{name:"Ape",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:19,hit_dice:"3d8 + 5",speed:"30 ft., climb 30 ft.",stats:[16,14,14,6,12,7],skillsaves:[{athletics:5},{perception:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"",cr:"1/2",actions:[{name:"Multiattack",desc:"The ape makes two fist attacks.",attack_bonus:0},{name:"Fist",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) bludgeoning damage.",attack_bonus:5,damage_dice:"1d6",damage_bonus:3},{name:"Rock",desc:"Ranged Weapon Attack: +5 to hit, range 25/50 ft., one target. Hit: 6 (1d6 + 3) bludgeoning damage.",attack_bonus:5,damage_dice:"1d6",damage_bonus:3}]},{name:"Archmage",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any alignment",ac:12,hp:99,hit_dice:"18d8 + 18",speed:"30 ft.",stats:[10,14,12,20,15,16],saves:[{intelligence:9},{wisdom:6}],skillsaves:[{arcana:13},{history:13}],damage_vulnerabilities:"",damage_resistances:"damage from spells; non magical bludgeoning, piercing, and slashing (from stoneskin)",damage_immunities:"",condition_immunities:"",senses:"passive Perception 12",languages:"any six languages",cr:"12",traits:[{name:"Magic Resistance",desc:"The archmage has advantage on saving throws against spells and other magical effects.",attack_bonus:0}],actions:[{name:"Dagger",desc:"Melee or Ranged Weapon Attack: +6 to hit, reach 5 ft. or range 20/60 ft., one target. Hit: 4 (1d4 + 2) piercing damage.",attack_bonus:6,damage_dice:"1d4",damage_bonus:2}],spells:["The archmage is an 18th-level spellcaster. Its spellcasting ability is Intelligence (spell save DC 17, +9 to hit with spell attacks). The archmage can cast disguise self and invisibility at will and has the following wizard spells prepared:",{"Cantrips (at will)":"fire bolt, light, mage hand, prestidigitation, shocking grasp"},{"1st level (4 slots)":"detect magic, identify, mage armor*, magic missile"},{"2nd level (3 slots)":"detect thoughts, mirror image, misty step"},{"3rd level (3 slots)":"counterspell,fly, lightning bolt"},{"4th level (3 slots)":"banishment, fire shield, stoneskin*"},{"5th level (3 slots)":"cone of cold, scrying, wall of force"},{"6th level (1 slot)":"globe of invulnerability"},{"7th level (1 slot)":"teleport"},{"8th level (1 slot)":"mind blank*"},{"9th level (1 slot)":"time stop"},"* The archmage casts these spells on itself before combat."]},{name:"Assassin",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any non-good alignment",ac:15,hp:78,hit_dice:"12d8 + 24",speed:"30 ft.",stats:[11,16,14,13,11,10],saves:[{dexterity:6},{intelligence:4}],skillsaves:[{acrobatics:6},{deception:3},{perception:3},{stealth:9}],damage_vulnerabilities:"",damage_resistances:"poison",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"Thieves' cant plus any two languages",cr:"8",traits:[{name:"Assassinate",desc:"During its first turn, the assassin has advantage on attack rolls against any creature that hasn't taken a turn. Any hit the assassin scores against a surprised creature is a critical hit.",attack_bonus:0},{name:"Evasion",desc:"If the assassin is subjected to an effect that allows it to make a Dexterity saving throw to take only half damage, the assassin instead takes no damage if it succeeds on the saving throw, and only half damage if it fails.",attack_bonus:0},{name:"Sneak Attack (1/Turn)",desc:"The assassin deals an extra 13 (4d6) damage when it hits a target with a weapon attack and has advantage on the attack roll, or when the target is within 5 ft. of an ally of the assassin that isn't incapacitated and the assassin doesn't have disadvantage on the attack roll.",attack_bonus:0,damage_dice:"4d6"}],actions:[{name:"Multiattack",desc:"The assassin makes two shortsword attacks.",attack_bonus:0},{name:"Shortsword",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) piercing damage, and the target must make a DC 15 Constitution saving throw, taking 24 (7d6) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:6,damage_dice:"1d6",damage_bonus:3},{name:"Light Crossbow",desc:"Ranged Weapon Attack: +6 to hit, range 80/320 ft., one target. Hit: 7 (1d8 + 3) piercing damage, and the target must make a DC 15 Constitution saving throw, taking 24 (7d6) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:6,damage_dice:"1d8",damage_bonus:3}]},{name:"Awakened Shrub",size:"Small",type:"plant",subtype:"",alignment:"unaligned",ac:9,hp:10,hit_dice:"3d6 + -1",speed:"20 ft.",stats:[3,8,11,10,10,6],damage_vulnerabilities:"fire",damage_resistances:"piercing",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"one language known by its creator",cr:"0",traits:[{name:"False Appearance",desc:"While the shrub remains motionless, it is indistinguishable from a normal shrub.",attack_bonus:0}],actions:[{name:"Rake",desc:"Melee Weapon Attack: +1 to hit, reach 5 ft., one target. Hit: 1 (1d4 \u2014 1) slashing damage.",attack_bonus:1,damage_dice:"1d4",damage_bonus:-1}]},{name:"Awakened Tree",size:"Huge",type:"plant",subtype:"",alignment:"unaligned",ac:13,hp:59,hit_dice:"7d12 + 13",speed:"20 ft.",stats:[19,6,15,10,10,7],damage_vulnerabilities:"fire",damage_resistances:"bludgeoning, piercing",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"one language known by its creator",cr:"2",traits:[{name:"False Appearance",desc:"While the tree remains motionless, it is indistinguishable from a normal tree.",attack_bonus:0}],actions:[{name:"Slam",desc:"Melee Weapon Attack: +6 to hit, reach 10 ft., one target. Hit: 14 (3d6 + 4) bludgeoning damage.",attack_bonus:6,damage_dice:"3d6",damage_bonus:4}]},{name:"Axe Beak",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:11,hp:19,hit_dice:"3d10 + 2",speed:"50 ft.",stats:[14,12,12,2,10,5],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"",cr:"1/4",actions:[{name:"Beak",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 6 (1d8 + 2) slashing damage.",attack_bonus:4,damage_dice:"1d8",damage_bonus:2}]},{name:"Azer",size:"Medium",type:"elemental",subtype:"",alignment:"lawful neutral",ac:17,hp:39,hit_dice:"6d8 + 12",speed:"30 ft.",stats:[17,12,15,12,13,10],saves:[{constitution:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire, poison",condition_immunities:"poisoned",senses:"passive Perception 11",languages:"Ignan",cr:"2",traits:[{name:"Heated Body",desc:"A creature that touches the azer or hits it with a melee attack while within 5 ft. of it takes 5 (1d10) fire damage.",attack_bonus:0,damage_dice:"1d10"},{name:"Heated Weapons",desc:"When the azer hits with a metal melee weapon, it deals an extra 3 (1d6) fire damage (included in the attack).",attack_bonus:0},{name:"Illumination",desc:"The azer sheds bright light in a 10-foot radius and dim light for an additional 10 ft..",attack_bonus:0}],actions:[{name:"Warhammer",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 7 (1d8 + 3) bludgeoning damage, or 8 (1d10 + 3) bludgeoning damage if used with two hands to make a melee attack, plus 3 (1d6) fire damage.",attack_bonus:5,damage_dice:"1d8 + 1d6",damage_bonus:3}]},{name:"Baboon",size:"Small",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:3,hit_dice:"1d6 + -1",speed:"30 ft., climb 30 ft.",stats:[8,14,11,4,12,6],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 11",languages:"",cr:"0",traits:[{name:"Pack Tactics",desc:"The baboon has advantage on an attack roll against a creature if at least one of the baboon's allies is within 5 ft. of the creature and the ally isn't incapacitated.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +1 to hit, reach 5 ft., one target. Hit: 1 (1d4 \u2014 1) piercing damage.",attack_bonus:1,damage_dice:"1d4",damage_bonus:-1}]},{name:"Badger",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:10,hp:3,hit_dice:"1d4",speed:"20 ft., burrow 5 ft.",stats:[4,11,12,2,12,5],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 30 ft., passive Perception 11",languages:"",cr:"0",traits:[{name:"Keen Smell",desc:"The badger has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +2 to hit, reach 5 ft., one target. Hit: 1 piercing damage.",attack_bonus:2,damage_bonus:1}]},{name:"Balor",size:"Huge",type:"fiend",subtype:"demon",alignment:"chaotic evil",ac:19,hp:262,hit_dice:"21d12 + 125",speed:"40 ft., fly 80 ft.",stats:[26,15,22,20,16,22],saves:[{strength:14},{constitution:12},{wisdom:9},{charisma:12}],damage_vulnerabilities:"",damage_resistances:"cold, lightning; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"fire, poison",condition_immunities:"poisoned",senses:"truesight 120 ft., passive Perception 13",languages:"Abyssal, telepathy 120 ft.",cr:"19",traits:[{name:"Death Throes",desc:"When the balor dies, it explodes, and each creature within 30 feet of it must make a DC 20 Dexterity saving throw, taking 70 (20d6) fire damage on a failed save, or half as much damage on a successful one. The explosion ignites flammable objects in that area that aren't being worn or carried, and it destroys the balor's weapons.",attack_bonus:0,damage_dice:"20d6"},{name:"Fire Aura",desc:"At the start of each of the balor's turns, each creature within 5 feet of it takes 10 (3d6) fire damage, and flammable objects in the aura that aren't being worn or carried ignite. A creature that touches the balor or hits it with a melee attack while within 5 feet of it takes 10 (3d6) fire damage.",attack_bonus:0,damage_dice:"3d6"},{name:"Magic Resistance",desc:"The balor has advantage on saving throws against spells and other magical effects.",attack_bonus:0},{name:"Magic Weapons",desc:"The balor's weapon attacks are magical.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The balor makes two attacks: one with its longsword and one with its whip.",attack_bonus:0},{name:"Longsword",desc:"Melee Weapon Attack: +14 to hit, reach 10 ft., one target. Hit: 21 (3d8 + 8) slashing damage plus 13 (3d8) lightning damage. If the balor scores a critical hit, it rolls damage dice three times, instead of twice.",attack_bonus:14,damage_dice:"3d8 + 3d8",damage_bonus:8},{name:"Whip",desc:"Melee Weapon Attack: +14 to hit, reach 30 ft., one target. Hit: 15 (2d6 + 8) slashing damage plus 10 (3d6) fire damage, and the target must succeed on a DC 20 Strength saving throw or be pulled up to 25 feet toward the balor.",attack_bonus:14,damage_dice:"2d6 + 3d6",damage_bonus:8},{name:"Teleport",desc:"The balor magically teleports, along with any equipment it is wearing or carrying, up to 120 feet to an unoccupied space it can see.",attack_bonus:0},{name:"Variant: Summon Demon (1/Day)",desc:"The demon chooses what to summon and attempts a magical summoning.\\nA balor has a 50 percent chance of summoning 1d8 vrocks, 1d6 hezrous, 1d4 glabrezus, 1d3 nalfeshnees, 1d2 mariliths, or one goristro.\\nA summoned demon appears in an unoccupied space within 60 feet of its summoner, acts as an ally of its summoner, and can't summon other demons. It remains for 1 minute, until it or its summoner dies, or until its summoner dismisses it as an action.",attack_bonus:0}]},{name:"Bandit",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any non-lawful alignment",ac:12,hp:11,hit_dice:"2d8 + 2",speed:"30 ft.",stats:[11,12,12,10,10,10],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"any one language (usually Common)",cr:"1/8",actions:[{name:"Scimitar",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 4 (1d6 + 1) slashing damage.",attack_bonus:3,damage_dice:"1d6",damage_bonus:1},{name:"Light Crossbow",desc:"Ranged Weapon Attack: +3 to hit, range 80 ft./320 ft., one target. Hit: 5 (1d8 + 1) piercing damage.",attack_bonus:3,damage_dice:"1d8",damage_bonus:1}]},{name:"Bandit Captain",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any non-lawful alignment",ac:15,hp:65,hit_dice:"10d8 + 20",speed:"30 ft.",stats:[15,16,14,14,11,14],saves:[{strength:4},{dexterity:5},{wisdom:2}],skillsaves:[{athletics:4},{deception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"any two languages",cr:"2",actions:[{name:"Multiattack",desc:"The captain makes three melee attacks: two with its scimitar and one with its dagger. Or the captain makes two ranged attacks with its daggers.",attack_bonus:0},{name:"Scimitar",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) slashing damage.",attack_bonus:5,damage_dice:"1d6",damage_bonus:3},{name:"Dagger",desc:"Melee or Ranged Weapon Attack: +5 to hit, reach 5 ft. or range 20/60 ft., one target. Hit: 5 (1d4 + 3) piercing damage.",attack_bonus:5,damage_dice:"1d4",damage_bonus:3}],reactions:[{name:"Parry",desc:"The captain adds 2 to its AC against one melee attack that would hit it. To do so, the captain must see the attacker and be wielding a melee weapon.",attack_bonus:0}]},{name:"Barbed Devil",size:"Medium",type:"fiend",subtype:"devil",alignment:"lawful evil",ac:15,hp:110,hit_dice:"13d8 + 51",speed:"30 ft.",stats:[16,17,18,12,14,14],saves:[{strength:6},{constitution:7},{wisdom:5},{charisma:5}],skillsaves:[{deception:5},{insight:5},{perception:8}],damage_vulnerabilities:"",damage_resistances:"cold; bludgeoning, piercing, and slashing from nonmagical weapons that aren't silvered",damage_immunities:"fire, poison",condition_immunities:"poisoned",senses:"darkvision 120 ft., passive Perception 18",languages:"Infernal, telepathy 120 ft.",cr:"5",traits:[{name:"Barbed Hide",desc:"At the start of each of its turns, the barbed devil deals 5 (1d10) piercing damage to any creature grappling it.",attack_bonus:0,damage_dice:"1d10"},{name:"Devil's Sight",desc:"Magical darkness doesn't impede the devil's darkvision.",attack_bonus:0},{name:"Magic Resistance",desc:"The devil has advantage on saving throws against spells and other magical effects.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The devil makes three melee attacks: one with its tail and two with its claws. Alternatively, it can use Hurl Flame twice.",attack_bonus:0},{name:"Claw",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft ., one target. Hit: 6 (1d6 + 3) piercing damage.",attack_bonus:6,damage_dice:"1d6",damage_bonus:3},{name:"Tail",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) piercing damage.",attack_bonus:6,damage_dice:"2d6",damage_bonus:3},{name:"Hurl Flame",desc:"Ranged Spell Attack: +5 to hit, range 150 ft., one target. Hit: 10 (3d6) fire damage. If the target is a flammable object that isn't being worn or carried, it also catches fire.",attack_bonus:5,damage_dice:"3d6"}]},{name:"Basilisk",size:"Medium",type:"monstrosity",subtype:"",alignment:"unaligned",ac:12,hp:52,hit_dice:"8d8 + 16",speed:"20 ft.",stats:[16,8,15,2,8,7],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 9",languages:"",cr:"3",traits:[{name:"Petrifying Gaze",desc:"If a creature starts its turn within 30 ft. of the basilisk and the two of them can see each other, the basilisk can force the creature to make a DC 12 Constitution saving throw if the basilisk isn't incapacitated. On a failed save, the creature magically begins to turn to stone and is restrained. It must repeat the saving throw at the end of its next turn. On a success, the effect ends. On a failure, the creature is petrified until freed by the greater restoration spell or other magic.\\nA creature that isn't surprised can avert its eyes to avoid the saving throw at the start of its turn. If it does so, it can't see the basilisk until the start of its next turn, when it can avert its eyes again. If it looks at the basilisk in the meantime, it must immediately make the save.\\nIf the basilisk sees its reflection within 30 ft. of it in bright light, it mistakes itself for a rival and targets itself with its gaze.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) piercing damage plus 7 (2d6) poison damage.",attack_bonus:5,damage_dice:"2d6 + 2d6",damage_bonus:3}]},{name:"Bat",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:1,hit_dice:"1d4 + -2",speed:"5 ft., fly 30 ft.",stats:[2,15,8,2,12,4],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 60 ft., passive Perception 11",languages:"",cr:"0",traits:[{name:"Echolocation",desc:"The bat can't use its blindsight while deafened.",attack_bonus:0},{name:"Keen Hearing",desc:"The bat has advantage on Wisdom (Perception) checks that rely on hearing.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +0 to hit, reach 5 ft., one creature. Hit: 1 piercing damage.",attack_bonus:0,damage_bonus:1}]},{name:"Bearded Devil",size:"Medium",type:"fiend",subtype:"devil",alignment:"lawful evil",ac:13,hp:52,hit_dice:"8d8 + 16",speed:"30 ft.",stats:[16,15,15,9,11,11],saves:[{strength:5},{constitution:4},{wisdom:2}],damage_vulnerabilities:"",damage_resistances:"cold; bludgeoning, piercing, and slashing from nonmagical weapons that aren't silvered",damage_immunities:"fire, poison",condition_immunities:"poisoned",senses:"darkvision 120 ft., passive Perception 10",languages:"Infernal, telepathy 120 ft.",cr:"3",traits:[{name:"Devil's Sight",desc:"Magical darkness doesn't impede the devil's darkvision.",attack_bonus:0},{name:"Magic Resistance",desc:"The devil has advantage on saving throws against spells and other magical effects.",attack_bonus:0},{name:"Steadfast",desc:"The devil can't be frightened while it can see an allied creature within 30 feet of it.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The devil makes two attacks: one with its beard and one with its glaive.",attack_bonus:0},{name:"Beard",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one creature. Hit: 6 (1d8 + 2) piercing damage, and the target must succeed on a DC 12 Constitution saving throw or be poisoned for 1 minute. While poisoned in this way, the target can't regain hit points. The target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",attack_bonus:5,damage_dice:"1d8",damage_bonus:2},{name:"Glaive",desc:"Melee Weapon Attack: +5 to hit, reach 10 ft., one target. Hit: 8 (1d10 + 3) slashing damage. If the target is a creature other than an undead or a construct, it must succeed on a DC 12 Constitution saving throw or lose 5 (1d10) hit points at the start of each of its turns due to an infernal wound. Each time the devil hits the wounded target with this attack, the damage dealt by the wound increases by 5 (1d10). Any creature can take an action to stanch the wound with a successful DC 12 Wisdom (Medicine) check. The wound also closes if the target receives magical healing.",attack_bonus:5,damage_dice:"1d10",damage_bonus:3}]},{name:"Behir",size:"Huge",type:"monstrosity",subtype:"",alignment:"neutral evil",ac:17,hp:168,hit_dice:"16d12 + 64",speed:"50 ft., climb 40 ft.",stats:[23,16,18,7,14,12],skillsaves:[{perception:6},{stealth:7}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"lightning",condition_immunities:"",senses:"darkvision 90 ft., passive Perception 16",languages:"Draconic",cr:"11",actions:[{name:"Multiattack",desc:"The behir makes two attacks: one with its bite and one to constrict.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +10 to hit, reach 10 ft., one target. Hit: 22 (3d10 + 6) piercing damage.",attack_bonus:10,damage_dice:"3d10",damage_bonus:6},{name:"Constrict",desc:"Melee Weapon Attack: +10 to hit, reach 5 ft., one Large or smaller creature. Hit: 17 (2d10 + 6) bludgeoning damage plus 17 (2d10 + 6) slashing damage. The target is grappled (escape DC 16) if the behir isn't already constricting a creature, and the target is restrained until this grapple ends.",attack_bonus:10,damage_dice:"2d10 + 2d10",damage_bonus:6},{name:"Lightning Breath (Recharge 5-6)",desc:"The behir exhales a line of lightning that is 20 ft. long and 5 ft. wide. Each creature in that line must make a DC 16 Dexterity saving throw, taking 66 (12d10) lightning damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"12d10"},{name:"Swallow",desc:"The behir makes one bite attack against a Medium or smaller target it is grappling. If the attack hits, the target is also swallowed, and the grapple ends. While swallowed, the target is blinded and restrained, it has total cover against attacks and other effects outside the behir, and it takes 21 (6d6) acid damage at the start of each of the behir's turns. A behir can have only one creature swallowed at a time.\\nIf the behir takes 30 damage or more on a single turn from the swallowed creature, the behir must succeed on a DC 14 Constitution saving throw at the end of that turn or regurgitate the creature, which falls prone in a space within 10 ft. of the behir. If the behir dies, a swallowed creature is no longer restrained by it and can escape from the corpse by using 15 ft. of movement, exiting prone.",attack_bonus:0,damage_dice:"6d6"}]},{name:"Berserker",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any chaotic alignment",ac:13,hp:67,hit_dice:"9d8 + 26",speed:"30 ft.",stats:[16,12,17,9,11,9],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"any one language (usually Common)",cr:"2",traits:[{name:"Reckless",desc:"At the start of its turn, the berserker can gain advantage on all melee weapon attack rolls during that turn, but attack rolls against it have advantage until the start of its next turn.",attack_bonus:0}],actions:[{name:"Greataxe",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 9 (1d12 + 3) slashing damage.",attack_bonus:5,damage_dice:"1d12",damage_bonus:3}]},{name:"Black Bear",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:11,hp:19,hit_dice:"3d8 + 5",speed:"40 ft., climb 30 ft.",stats:[15,10,14,2,12,7],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"",cr:"1/2",traits:[{name:"Keen Smell",desc:"The bear has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The bear makes two attacks: one with its bite and one with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:3,damage_dice:"1d6",damage_bonus:2},{name:"Claws",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 7 (2d4 + 2) slashing damage.",attack_bonus:3,damage_dice:"2d4",damage_bonus:2}]},{name:"Black Dragon Wyrmling",size:"Medium",type:"dragon",subtype:"",alignment:"chaotic evil",ac:17,hp:33,hit_dice:"6d8 + 6",speed:"30 ft., fly 60 ft., swim 30 ft.",stats:[15,14,13,10,11,13],saves:[{dexterity:4},{constitution:3},{wisdom:2},{charisma:3}],skillsaves:[{perception:4},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"acid",condition_immunities:"",senses:"blindsight 10 ft., darkvision 60 ft., passive Perception 14",languages:"Draconic",cr:"2",traits:[{name:"Amphibious",desc:"The dragon can breathe air and water.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (1d10 + 2) piercing damage plus 2 (1d4) acid damage.",attack_bonus:4,damage_dice:"1d10",damage_bonus:2},{name:"Acid Breath (Recharge 5-6)",desc:"The dragon exhales acid in a 15-foot line that is 5 feet wide. Each creature in that line must make a DC 11 Dexterity saving throw, taking 22 (Sd8) acid damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"5d8"}]},{name:"Black Pudding",size:"Large",type:"ooze",subtype:"",alignment:"unaligned",ac:7,hp:85,hit_dice:"10d10 + 30",speed:"20 ft., climb 20 ft.",stats:[16,5,16,1,6,1],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"acid, cold, lightning, slashing",condition_immunities:"blinded, charmed, deafened, exhaustion, frightened, prone",senses:"blindsight 60 ft. (blind beyond this radius), passive Perception 8",languages:"",cr:"4",traits:[{name:"Amorphous",desc:"The pudding can move through a space as narrow as 1 inch wide without squeezing.",attack_bonus:0},{name:"Corrosive Form",desc:"A creature that touches the pudding or hits it with a melee attack while within 5 feet of it takes 4 (1d8) acid damage. Any nonmagical weapon made of metal or wood that hits the pudding corrodes. After dealing damage, the weapon takes a permanent and cumulative -1 penalty to damage rolls. If its penalty drops to -5, the weapon is destroyed. Nonmagical ammunition made of metal or wood that hits the pudding is destroyed after dealing damage. The pudding can eat through 2-inch-thick, nonmagical wood or metal in 1 round.",attack_bonus:0,damage_dice:"1d8"},{name:"Spider Climb",desc:"The pudding can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",attack_bonus:0}],actions:[{name:"Pseudopod",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) bludgeoning damage plus 18 (4d8) acid damage. In addition, nonmagical armor worn by the target is partly dissolved and takes a permanent and cumulative -1 penalty to the AC it offers. The armor is destroyed if the penalty reduces its AC to 10.",attack_bonus:5,damage_dice:"1d6 + 4d8",damage_bonus:3}],reactions:[{name:"Split",desc:"When a pudding that is Medium or larger is subjected to lightning or slashing damage, it splits into two new puddings if it has at least 10 hit points. Each new pudding has hit points equal to half the original pudding's, rounded down. New puddings are one size smaller than the original pudding.",attack_bonus:0}]},{name:"Blink Dog",size:"Medium",type:"fey",subtype:"",alignment:"lawful good",ac:13,hp:22,hit_dice:"4d8 + 4",speed:"40 ft.",stats:[12,17,12,10,13,11],skillsaves:[{perception:3},{stealth:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"Blink Dog, understands Sylvan but can't speak it",cr:"1/4",traits:[{name:"Keen Hearing and Smell",desc:"The dog has advantage on Wisdom (Perception) checks that rely on hearing or smell.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 4 (1d6 + 1) piercing damage.",attack_bonus:3,damage_dice:"1d6",damage_bonus:1},{name:"Teleport (Recharge 4-6)",desc:"The dog magically teleports, along with any equipment it is wearing or carrying, up to 40 ft. to an unoccupied space it can see. Before or after teleporting, the dog can make one bite attack.",attack_bonus:0}]},{name:"Blood Hawk",size:"Small",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:7,hit_dice:"2d6",speed:"10 ft., fly 60 ft.",stats:[6,14,10,3,14,5],skillsaves:[{perception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 14",languages:"",cr:"1/8",traits:[{name:"Keen Sight",desc:"The hawk has advantage on Wisdom (Perception) checks that rely on sight.",attack_bonus:0},{name:"Pack Tactics",desc:"The hawk has advantage on an attack roll against a creature if at least one of the hawk's allies is within 5 ft. of the creature and the ally isn't incapacitated.",attack_bonus:0}],actions:[{name:"Beak",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 4 (1d4 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d4",damage_bonus:2}]},{name:"Blue Dragon Wyrmling",size:"Medium",type:"dragon",subtype:"",alignment:"lawful evil",ac:17,hp:52,hit_dice:"8d8 + 16",speed:"30 ft., burrow 15 ft., fly 60 ft.",stats:[17,10,15,12,11,15],saves:[{dexterity:2},{constitution:4},{wisdom:2},{charisma:4}],skillsaves:[{perception:4},{stealth:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"lightning",condition_immunities:"",senses:"blindsight 10 ft., darkvision 60 ft., passive Perception 14",languages:"Draconic",cr:"3",actions:[{name:"Bite",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 8 (1d10 + 3) piercing damage plus 3 (1d6) lightning damage.",attack_bonus:5,damage_dice:"1d10 + 1d6",damage_bonus:3},{name:"Lightning Breath (Recharge 5-6)",desc:"The dragon exhales lightning in a 30-foot line that is 5 feet wide. Each creature in that line must make a DC 12 Dexterity saving throw, taking 22 (4d10) lightning damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"4d10"}]},{name:"Boar",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:11,hp:11,hit_dice:"2d8 + 2",speed:"40 ft.",stats:[13,11,12,2,9,5],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 9",languages:"",cr:"1/4",traits:[{name:"Charge",desc:"If the boar moves at least 20 ft. straight toward a target and then hits it with a tusk attack on the same turn, the target takes an extra 3 (1d6) slashing damage. If the target is a creature, it must succeed on a DC 11 Strength saving throw or be knocked prone.",attack_bonus:0,damage_dice:"1d6"},{name:"Relentless (Recharges after a Short or Long Rest)",desc:"If the boar takes 7 damage or less that would reduce it to 0 hit points, it is reduced to 1 hit point instead.",attack_bonus:0}],actions:[{name:"Tusk",desc:"Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 4 (1d6 + 1) slashing damage.",attack_bonus:3,damage_dice:"1d6",damage_bonus:1}]},{name:"Bone Devil",size:"Large",type:"fiend",subtype:"devil",alignment:"lawful evil",ac:19,hp:142,hit_dice:"15d10 + 59",speed:"40 ft., fly 40 ft.",stats:[18,16,18,13,14,16],saves:[{intelligence:5},{wisdom:6},{charisma:7}],skillsaves:[{deception:7},{insight:6}],damage_vulnerabilities:"",damage_resistances:"cold; bludgeoning, piercing, and slashing from nonmagical weapons that aren't silvered",damage_immunities:"fire, poison",condition_immunities:"poisoned",senses:"darkvision 120 ft., passive Perception 9",languages:"Infernal, telepathy 120 ft.",cr:"12",traits:[{name:"Devil's Sight",desc:"Magical darkness doesn't impede the devil's darkvision.",attack_bonus:0},{name:"Magic Resistance",desc:"The devil has advantage on saving throws against spells and other magical effects.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The devil makes three attacks: two with its claws and one with its sting.",attack_bonus:0},{name:"Multiattack",desc:"The devil makes three attacks: two with its claws and one with its sting.",attack_bonus:0},{name:"Claw",desc:"Melee Weapon Attack: +8 to hit, reach 10 ft., one target. Hit: 8 (1d8 + 4) slashing damage.",attack_bonus:8,damage_dice:"1d8",damage_bonus:4},{name:"Claw",desc:"Melee Weapon Attack: +8 to hit, reach 10 ft., one target. Hit: 8 (1d8 + 4) slashing damage.",attack_bonus:8,damage_dice:"1d8",damage_bonus:4},{name:"Sting",desc:"Melee Weapon Attack: +8 to hit, reach 10 ft., one target. Hit: 13 (2d8 + 4) piercing damage plus 17 (5d6) poison damage, and the target must succeed on a DC 14 Constitution saving throw or become poisoned for 1 minute. The target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success .",attack_bonus:8,damage_dice:"2d8",damage_bonus:4},{name:"Sting",desc:"Melee Weapon Attack: +8 to hit, reach 10 ft., one target. Hit: 13 (2d8 + 4) piercing damage plus 17 (5d6) poison damage, and the target must succeed on a DC 14 Constitution saving throw or become poisoned for 1 minute. The target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success .",attack_bonus:8,damage_dice:"2d8",damage_bonus:4}]},{name:"Brass Dragon Wyrmling",size:"Medium",type:"dragon",subtype:"",alignment:"chaotic good",ac:16,hp:16,hit_dice:"3d8 + 2",speed:"30 ft., burrow 15 ft., fly 60 ft.",stats:[15,10,13,10,11,13],saves:[{dexterity:2},{constitution:3},{wisdom:2},{charisma:3}],skillsaves:[{perception:4},{stealth:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire",condition_immunities:"",senses:"blindsight 10 ft., darkvision 60 ft., passive Perception 14",languages:"Draconic",cr:"1",actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (1d10 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d10",damage_bonus:2},{name:"Breath Weapons (Recharge 5-6)",desc:"The dragon uses one of the following breath weapons.\\nFire Breath. The dragon exhales fire in an 20-foot line that is 5 feet wide. Each creature in that line must make a DC 11 Dexterity saving throw, taking 14 (4d6) fire damage on a failed save, or half as much damage on a successful one.\\nSleep Breath. The dragon exhales sleep gas in a 15-foot cone. Each creature in that area must succeed on a DC 11 Constitution saving throw or fall unconscious for 1 minute. This effect ends for a creature if the creature takes damage or someone uses an action to wake it.",attack_bonus:0,damage_dice:"4d6"}]},{name:"Bronze Dragon Wyrmling",size:"Medium",type:"dragon",subtype:"",alignment:"lawful good",ac:17,hp:32,hit_dice:"5d8 + 9",speed:"30 ft., fly 60 ft., swim 30 ft.",stats:[17,10,15,12,11,15],saves:[{dexterity:2},{constitution:4},{wisdom:2},{charisma:4}],skillsaves:[{perception:4},{stealth:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"lightning",condition_immunities:"",senses:"blindsight 10 ft., darkvision 60 ft., passive Perception 14",languages:"Draconic",cr:"2",traits:[{name:"Amphibious",desc:"The dragon can breathe air and water.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 8 (1d10 + 3) piercing damage.",attack_bonus:5,damage_dice:"1d10",damage_bonus:3},{name:"Breath Weapons (Recharge 5-6)",desc:"The dragon uses one of the following breath weapons.\\nLightning Breath. The dragon exhales lightning in a 40-foot line that is 5 feet wide. Each creature in that line must make a DC 12 Dexterity saving throw, taking 16 (3d10) lightning damage on a failed save, or half as much damage on a successful one.\\nRepulsion Breath. The dragon exhales repulsion energy in a 30-foot cone. Each creature in that area must succeed on a DC 12 Strength saving throw. On a failed save, the creature is pushed 30 feet away from the dragon.",attack_bonus:0,damage_dice:"3d10"}]},{name:"Brown Bear",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:11,hp:34,hit_dice:"4d10 + 12",speed:"40 ft., climb 30 ft.",stats:[19,10,16,2,13,7],skillsaves:[{perception:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"",cr:"1",traits:[{name:"Keen Smell",desc:"The bear has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The bear makes two attacks: one with its bite and one with its claws.",attack_bonus:0},{name:"Bite",desc:"Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 8 (1d8 + 4) piercing damage.",attack_bonus:5,damage_dice:"1d8",damage_bonus:4},{name:"Claws",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) slashing damage.",attack_bonus:5,damage_dice:"2d6",damage_bonus:4}]},{name:"Bugbear",size:"Medium",type:"humanoid",subtype:"goblinoid",alignment:"chaotic evil",ac:16,hp:27,hit_dice:"5d8 + 4",speed:"30 ft.",stats:[15,14,13,8,11,9],skillsaves:[{stealth:6},{survival:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 10",languages:"Common, Goblin",cr:"1",traits:[{name:"Brute",desc:"A melee weapon deals one extra die of its damage when the bugbear hits with it (included in the attack).",attack_bonus:0},{name:"Surprise Attack",desc:"If the bugbear surprises a creature and hits it with an attack during the first round of combat, the target takes an extra 7 (2d6) damage from the attack.",attack_bonus:0,damage_dice:"2d6"}],actions:[{name:"Morningstar",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 11 (2d8 + 2) piercing damage.",attack_bonus:4,damage_dice:"2d8",damage_bonus:2},{name:"Javelin",desc:"Melee or Ranged Weapon Attack: +4 to hit, reach 5 ft. or range 30/120 ft., one target. Hit: 9 (2d6 + 2) piercing damage in melee or 5 (1d6 + 2) piercing damage at range.",attack_bonus:4,damage_dice:"2d6",damage_bonus:2}]},{name:"Bulette",size:"Large",type:"monstrosity",subtype:"",alignment:"unaligned",ac:17,hp:94,hit_dice:"9d10 + 44",speed:"40 ft., burrow 40 ft.",stats:[19,11,21,2,10,5],skillsaves:[{perception:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., tremorsense 60 ft., passive Perception 16",languages:"",cr:"5",traits:[{name:"Standing Leap",desc:"The bulette's long jump is up to 30 ft. and its high jump is up to 15 ft., with or without a running start.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 30 (4d12 + 4) piercing damage.",attack_bonus:7,damage_dice:"4d12",damage_bonus:4},{name:"Deadly Leap",desc:"If the bulette jumps at least 15 ft. as part of its movement, it can then use this action to land on its ft. in a space that contains one or more other creatures. Each of those creatures must succeed on a DC 16 Strength or Dexterity saving throw (target's choice) or be knocked prone and take 14 (3d6 + 4) bludgeoning damage plus 14 (3d6 + 4) slashing damage. On a successful save, the creature takes only half the damage, isn't knocked prone, and is pushed 5 ft. out of the bulette's space into an unoccupied space of the creature's choice. If no unoccupied space is within range, the creature instead falls prone in the bulette's space.",attack_bonus:0}]},{name:"Camel",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:9,hp:15,hit_dice:"2d10 + 4",speed:"50 ft.",stats:[16,8,14,2,8,5],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 9",languages:"",cr:"1/8",actions:[{name:"Bite",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 2 (1d4) bludgeoning damage.",attack_bonus:5,damage_dice:"1d4"}]},{name:"Carrion Crawler",size:"Large",type:"monstrosity",subtype:"",alignment:"unaligned",ac:13,hp:51,hit_dice:"6d10 + 18",speed:"30 ft., climb 30 ft.",stats:[14,13,16,1,12,5],skillsaves:[{perception:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 13",languages:"",cr:"2",traits:[{name:"Keen Smell",desc:"The carrion crawler has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0},{name:"Spider Climb",desc:"The carrion crawler can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The carrion crawler makes two attacks: one with its tentacles and one with its bite.",attack_bonus:0},{name:"Tentacles",desc:"Melee Weapon Attack: +8 to hit, reach 10 ft., one creature. Hit: 4 (1d4 + 2) poison damage, and the target must succeed on a DC 13 Constitution saving throw or be poisoned for 1 minute. Until this poison ends, the target is paralyzed. The target can repeat the saving throw at the end of each of its turns, ending the poison on itself on a success.",attack_bonus:8,damage_dice:"1d4",damage_bonus:2},{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (2d4 + 2) piercing damage.",attack_bonus:4,damage_dice:"2d4",damage_bonus:2}]},{name:"Cat",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:2,hit_dice:"1d4 + -1",speed:"40 ft., climb 30 ft.",stats:[3,15,10,3,12,7],skillsaves:[{perception:3},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"",cr:"0",traits:[{name:"Keen Smell",desc:"The cat has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0}],actions:[{name:"Claws",desc:"Melee Weapon Attack: +0 to hit, reach 5 ft., one target. Hit: 1 slashing damage.",attack_bonus:0,damage_bonus:1}]},{name:"Cave Bear",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:42,hit_dice:"5d10 + 14",speed:"40 ft., swim 30 ft.",stats:[20,10,16,2,13,7],skillsaves:[{perception:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 13",languages:"",cr:"2",traits:[{name:"Keen Smell",desc:"The bear has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The bear makes two attacks: one with its bite and one with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 9 (1d8 + 5) piercing damage.",attack_bonus:7,damage_dice:"1d8",damage_bonus:5},{name:"Claws",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 12 (2d6 + 5) slashing damage.",attack_bonus:7,damage_dice:"2d6",damage_bonus:5}]},{name:"Centaur",size:"Large",type:"monstrosity",subtype:"",alignment:"neutral good",ac:12,hp:45,hit_dice:"6d10 + 12",speed:"50 ft.",stats:[18,14,14,9,13,11],skillsaves:[{athletics:6},{perception:3},{survival:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"Elvish, Sylvan",cr:"2",traits:[{name:"Charge",desc:"If the centaur moves at least 30 ft. straight toward a target and then hits it with a pike attack on the same turn, the target takes an extra 10 (3d6) piercing damage.",attack_bonus:0,damage_dice:"3d6"}],actions:[{name:"Multiattack",desc:"The centaur makes two attacks: one with its pike and one with its hooves or two with its longbow.",attack_bonus:0},{name:"Pike",desc:"Melee Weapon Attack: +6 to hit, reach 10 ft., one target. Hit: 9 (1d10 + 4) piercing damage.",attack_bonus:6,damage_dice:"1d10",damage_bonus:4},{name:"Hooves",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) bludgeoning damage.",attack_bonus:6,damage_dice:"2d6",damage_bonus:4},{name:"Longbow",desc:"Ranged Weapon Attack: +4 to hit, range 150/600 ft., one target. Hit: 6 (1d8 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d8",damage_bonus:2}]},{name:"Chain Devil",size:"Medium",type:"fiend",subtype:"devil",alignment:"lawful evil",ac:16,hp:85,hit_dice:"10d8 + 40",speed:"30 ft.",stats:[18,15,18,11,12,14],damage_vulnerabilities:"",damage_resistances:"cold; bludgeoning, piercing, and slashing from nonmagical weapons that aren't silvered",damage_immunities:"fire, poison",condition_immunities:"poisoned",senses:"darkvision 120 ft., passive Perception 8",languages:"Infernal, telepathy 120 ft.",cr:"11",traits:[{name:"Devil's Sight",desc:"Magical darkness doesn't impede the devil's darkvision.",attack_bonus:0},{name:"Magic Resistance",desc:"The devil has advantage on saving throws against spells and other magical effects.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The devil makes two attacks with its chains.",attack_bonus:0},{name:"Chain",desc:"Melee Weapon Attack: +8 to hit, reach 10 ft., one target. Hit: 11 (2d6 + 4) slashing damage. The target is grappled (escape DC 14) if the devil isn't already grappling a creature. Until this grapple ends, the target is restrained and takes 7 (2d6) piercing damage at the start of each of its turns.",attack_bonus:8,damage_dice:"2d6",damage_bonus:4},{name:"Animate Chains (Recharges after a Short or Long Rest)",desc:"Up to four chains the devil can see within 60 feet of it magically sprout razor-edged barbs and animate under the devil's control, provided that the chains aren't being worn or carried.\\nEach animated chain is an object with AC 20, 20 hit points, resistance to piercing damage, and immunity to psychic and thunder damage. When the devil uses Multiattack on its turn, it can use each animated chain to make one additional chain attack. An animated chain can grapple one creature of its own but can't make attacks while grappling. An animated chain reverts to its inanimate state if reduced to 0 hit points or if the devil is incapacitated or dies.",attack_bonus:0}],reactions:[{name:"Unnerving Mask",desc:"When a creature the devil can see starts its turn within 30 feet of the devil, the devil can create the illusion that it looks like one of the creature's departed loved ones or bitter enemies. If the creature can see the devil, it must succeed on a DC 14 Wisdom saving throw or be frightened until the end of its turn.",attack_bonus:0}]},{name:"Chimera",size:"Large",type:"monstrosity",subtype:"",alignment:"chaotic evil",ac:14,hp:114,hit_dice:"12d10 + 48",speed:"30 ft., fly 60 ft.",stats:[19,11,19,3,14,10],skillsaves:[{perception:8}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 18",languages:"understands Draconic but can't speak",cr:"6",actions:[{name:"Multiattack",desc:"The chimera makes three attacks: one with its bite, one with its horns, and one with its claws. When its fire breath is available, it can use the breath in place of its bite or horns.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) piercing damage.",attack_bonus:7,damage_dice:"2d6",damage_bonus:4},{name:"Horns",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 10 (1d12 + 4) bludgeoning damage.",attack_bonus:7,damage_dice:"1d12",damage_bonus:4},{name:"Claws",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) slashing damage.",attack_bonus:7,damage_dice:"2d6",damage_bonus:4},{name:"Fire Breath (Recharge 5-6)",desc:"The dragon head exhales fire in a 15-foot cone. Each creature in that area must make a DC 15 Dexterity saving throw, taking 31 (7d8) fire damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"7d8"}]},{name:"Chuul",size:"Large",type:"aberration",subtype:"",alignment:"chaotic evil",ac:16,hp:93,hit_dice:"11d10 + 32",speed:"30 ft., swim 30 ft.",stats:[19,10,16,5,11,5],skillsaves:[{perception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"poison",condition_immunities:"poisoned",senses:"darkvision 60 ft., passive Perception 14",languages:"understands Deep Speech but can't speak",cr:"4",traits:[{name:"Amphibious",desc:"The chuul can breathe air and water.",attack_bonus:0},{name:"Sense Magic",desc:"The chuul senses magic within 120 feet of it at will. This trait otherwise works like the detect magic spell but isn't itself magical.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The chuul makes two pincer attacks. If the chuul is grappling a creature, the chuul can also use its tentacles once.",attack_bonus:0},{name:"Pincer",desc:"Melee Weapon Attack: +6 to hit, reach 10 ft., one target. Hit: 11 (2d6 + 4) bludgeoning damage. The target is grappled (escape DC 14) if it is a Large or smaller creature and the chuul doesn't have two other creatures grappled.",attack_bonus:6,damage_dice:"2d6",damage_bonus:4},{name:"Tentacles",desc:"One creature grappled by the chuul must succeed on a DC 13 Constitution saving throw or be poisoned for 1 minute. Until this poison ends, the target is paralyzed. The target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",attack_bonus:0}]},{name:"Clay Golem",size:"Large",type:"construct",subtype:"",alignment:"unaligned",ac:14,hp:133,hit_dice:"14d10 + 56",speed:"20 ft.",stats:[20,9,18,3,8,1],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"acid, poison, psychic; bludgeoning, piercing, and slashing from nonmagical weapons that aren't adamantine",condition_immunities:"charmed, exhaustion, frightened, paralyzed, petrified, poisoned",senses:"darkvision 60 ft., passive Perception 9",languages:"understands the languages of its creator but can't speak",cr:"9",traits:[{name:"Acid Absorption",desc:"Whenever the golem is subjected to acid damage, it takes no damage and instead regains a number of hit points equal to the acid damage dealt.",attack_bonus:0},{name:"Berserk",desc:"Whenever the golem starts its turn with 60 hit points or fewer, roll a d6. On a 6, the golem goes berserk. On each of its turns while berserk, the golem attacks the nearest creature it can see. If no creature is near enough to move to and attack, the golem attacks an object, with preference for an object smaller than itself. Once the golem goes berserk, it continues to do so until it is destroyed or regains all its hit points.",attack_bonus:0},{name:"Immutable Form",desc:"The golem is immune to any spell or effect that would alter its form.",attack_bonus:0},{name:"Magic Resistance",desc:"The golem has advantage on saving throws against spells and other magical effects.",attack_bonus:0},{name:"Magic Weapons",desc:"The golem's weapon attacks are magical.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The golem makes two slam attacks.",attack_bonus:0},{name:"Slam",desc:"Melee Weapon Attack: +8 to hit, reach 5 ft., one target. Hit: 16 (2d10 + 5) bludgeoning damage. If the target is a creature, it must succeed on a DC 15 Constitution saving throw or have its hit point maximum reduced by an amount equal to the damage taken. The target dies if this attack reduces its hit point maximum to 0. The reduction lasts until removed by the greater restoration spell or other magic.",attack_bonus:8,damage_dice:"2d10",damage_bonus:5},{name:"Haste (Recharge 5-6)",desc:"Until the end of its next turn, the golem magically gains a +2 bonus to its AC, has advantage on Dexterity saving throws, and can use its slam attack as a bonus action.",attack_bonus:0}]},{name:"Cloaker",size:"Large",type:"aberration",subtype:"",alignment:"chaotic neutral",ac:14,hp:78,hit_dice:"12d10 + 12",speed:"10 ft., fly 40 ft.",stats:[17,15,12,13,12,14],skillsaves:[{stealth:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 11",languages:"Deep Speech, Undercommon",cr:"8",traits:[{name:"Damage Transfer",desc:"While attached to a creature, the cloaker takes only half the damage dealt to it (rounded down). and that creature takes the other half.",attack_bonus:0},{name:"False Appearance",desc:"While the cloaker remains motionless without its underside exposed, it is indistinguishable from a dark leather cloak.",attack_bonus:0},{name:"Light Sensitivity",desc:"While in bright light, the cloaker has disadvantage on attack rolls and Wisdom (Perception) checks that rely on sight.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The cloaker makes two attacks: one with its bite and one with its tail.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one creature. Hit: 10 (2d6 + 3) piercing damage, and if the target is Large or smaller, the cloaker attaches to it. If the cloaker has advantage against the target, the cloaker attaches to the target's head, and the target is blinded and unable to breathe while the cloaker is attached. While attached, the cloaker can make this attack only against the target and has advantage on the attack roll. The cloaker can detach itself by spending 5 feet of its movement. A creature, including the target, can take its action to detach the cloaker by succeeding on a DC 16 Strength check.",attack_bonus:6,damage_dice:"2d6",damage_bonus:3},{name:"Tail",desc:"Melee Weapon Attack: +6 to hit, reach 10 ft., one creature. Hit: 7 (1d8 + 3) slashing damage.",attack_bonus:6,damage_dice:"1d8",damage_bonus:3},{name:"Moan",desc:"Each creature within 60 feet of the cloaker that can hear its moan and that isn't an aberration must succeed on a DC 13 Wisdom saving throw or become frightened until the end of the cloaker's next turn. If a creature's saving throw is successful, the creature is immune to the cloaker's moan for the next 24 hours.",attack_bonus:0},{name:"Phantasms (Recharges after a Short or Long Rest)",desc:"The cloaker magically creates three illusory duplicates of itself if it isn't in bright light. The duplicates move with it and mimic its actions, shifting position so as to make it impossible to track which cloaker is the real one. If the cloaker is ever in an area of bright light, the duplicates disappear.\\nWhenever any creature targets the cloaker with an attack or a harmful spell while a duplicate remains, that creature rolls randomly to determine whether it targets the cloaker or one of the duplicates. A creature is unaffected by this magical effect if it can't see or if it relies on senses other than sight.\\nA duplicate has the cloaker's AC and uses its saving throws. If an attack hits a duplicate, or if a duplicate fails a saving throw against an effect that deals damage, the duplicate disappears.",attack_bonus:0}]},{name:"Cloud Giant",size:"Huge",type:"giant",subtype:"",alignment:"neutral good (50%) or neutral evil (50%)",ac:14,hp:200,hit_dice:"16d12 + 96",speed:"40 ft.",stats:[27,10,22,12,16,16],saves:[{constitution:10},{wisdom:7},{charisma:7}],skillsaves:[{insight:7},{perception:7}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 17",languages:"Common, Giant",cr:"9",traits:[{name:"Keen Smell",desc:"The giant has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0},{name:"Innate Spellcasting",desc:"The giant's innate spellcasting ability is Charisma. It can innately cast the following spells, requiring no material components:\\n\\nAt will: detect magic, fog cloud, light\\n3/day each: feather fall, fly, misty step, telekinesis\\n1/day each: control weather, gaseous form",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The giant makes two morningstar attacks.",attack_bonus:0},{name:"Morningstar",desc:"Melee Weapon Attack: +12 to hit, reach 10 ft., one target. Hit: 21 (3d8 + 8) piercing damage.",attack_bonus:12,damage_dice:"3d8",damage_bonus:8},{name:"Rock",desc:"Ranged Weapon Attack: +12 to hit, range 60/240 ft., one target. Hit: 30 (4d10 + 8) bludgeoning damage.",attack_bonus:12,damage_dice:"4d10",damage_bonus:8}]},{name:"Cockatrice",size:"Small",type:"monstrosity",subtype:"",alignment:"unaligned",ac:11,hp:27,hit_dice:"6d6 + 6",speed:"20 ft., fly 40 ft.",stats:[6,12,12,2,13,5],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 11",languages:"",cr:"1/2",actions:[{name:"Bite",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one creature. Hit: 3 (1d4 + 1) piercing damage, and the target must succeed on a DC 11 Constitution saving throw against being magically petrified. On a failed save, the creature begins to turn to stone and is restrained. It must repeat the saving throw at the end of its next turn. On a success, the effect ends. On a failure, the creature is petrified for 24 hours.",attack_bonus:3,damage_dice:"1d4",damage_bonus:1}]},{name:"Commoner",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any alignment",ac:10,hp:4,hit_dice:"1d8 + -1",speed:"30 ft.",stats:[10,10,10,10,10,10],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"any one language (usually Common)",cr:"0",actions:[{name:"Club",desc:"Melee Weapon Attack: +2 to hit, reach 5 ft., one target. Hit: 2 (1d4) bludgeoning damage.",attack_bonus:2,damage_dice:"1d4"}]},{name:"Constrictor Snake",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:13,hit_dice:"2d10 + 2",speed:"30 ft., swim 30 ft.",stats:[15,14,12,1,10,3],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 10 ft., passive Perception 10",languages:"",cr:"1/4",actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2},{name:"Constrict",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 6 (1d8 + 2) bludgeoning damage, and the target is grappled (escape DC 14). Until this grapple ends, the creature is restrained, and the snake can't constrict another target.",attack_bonus:4,damage_dice:"1d8",damage_bonus:2}]},{name:"Copper Dragon Wyrmling",size:"Medium",type:"dragon",subtype:"",alignment:"chaotic good",ac:16,hp:22,hit_dice:"4d8 + 4",speed:"30 ft., climb 30 ft., fly 60 ft.",stats:[15,12,13,14,11,13],saves:[{dexterity:3},{constitution:3},{wisdom:2},{charisma:3}],skillsaves:[{perception:4},{stealth:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"acid",condition_immunities:"",senses:"blindsight 10 ft., darkvision 60 ft., passive Perception 14",languages:"Draconic",cr:"1",actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (1d10 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d10",damage_bonus:2},{name:"Breath Weapons (Recharge 5-6)",desc:"The dragon uses one of the following breath weapons.\\nAcid Breath. The dragon exhales acid in an 20-foot line that is 5 feet wide. Each creature in that line must make a DC 11 Dexterity saving throw, taking 18 (4d8) acid damage on a failed save, or half as much damage on a successful one.\\nSlowing Breath. The dragon exhales gas in a 1 5-foot cone. Each creature in that area must succeed on a DC 11 Constitution saving throw. On a failed save, the creature can't use reactions, its speed is halved, and it can't make more than one attack on its turn. In addition, the creature can use either an action or a bonus action on its turn, but not both. These effects last for 1 minute. The creature can repeat the saving throw at the end of each of its turns, ending the effect on itself with a successful save.",attack_bonus:0,damage_dice:"4d8"}]},{name:"Couatl",size:"Medium",type:"celestial",subtype:"",alignment:"lawful good",ac:19,hp:97,hit_dice:"13d8 + 38",speed:"30 ft., fly 90 ft.",stats:[16,20,17,18,20,18],saves:[{constitution:5},{wisdom:7},{charisma:6}],damage_vulnerabilities:"",damage_resistances:"radiant",damage_immunities:"psychic; bludgeoning, piercing, and slashing from nonmagical weapons",condition_immunities:"",senses:"truesight 120 ft., passive Perception 15",languages:"all, telepathy 120 ft.",cr:"4",traits:[{name:"Innate Spellcasting",desc:"The couatl's spellcasting ability is Charisma (spell save DC 14). It can innately cast the following spells, requiring only verbal components:\\n\\nAt will: detect evil and good, detect magic, detect thoughts\\n3/day each: bless, create food and water, cure wounds, lesser restoration, protection from poison, sanctuary, shield\\n1/day each: dream, greater restoration, scrying",attack_bonus:0},{name:"Magic Weapons",desc:"The couatl's weapon attacks are magical.",attack_bonus:0},{name:"Shielded Mind",desc:"The couatl is immune to scrying and to any effect that would sense its emotions, read its thoughts, or detect its location.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +8 to hit, reach 5 ft., one creature. Hit: 8 (1d6 + 5) piercing damage, and the target must succeed on a DC 13 Constitution saving throw or be poisoned for 24 hours. Until this poison ends, the target is unconscious. Another creature can use an action to shake the target awake.",attack_bonus:8,damage_dice:"1d6",damage_bonus:5},{name:"Constrict",desc:"Melee Weapon Attack: +6 to hit, reach 10 ft., one Medium or smaller creature. Hit: 10 (2d6 + 3) bludgeoning damage, and the target is grappled (escape DC 15). Until this grapple ends, the target is restrained, and the couatl can't constrict another target.",attack_bonus:6,damage_dice:"2d6",damage_bonus:3},{name:"Change Shape",desc:"The couatl magically polymorphs into a humanoid or beast that has a challenge rating equal to or less than its own, or back into its true form. It reverts to its true form if it dies. Any equipment it is wearing or carrying is absorbed or borne by the new form (the couatl's choice).\\nIn a new form, the couatl retains its game statistics and ability to speak, but its AC, movement modes, Strength, Dexterity, and other actions are replaced by those of the new form, and it gains any statistics and capabilities (except class features, legendary actions, and lair actions) that the new form has but that it lacks. If the new form has a bite attack, the couatl can use its bite in that form.",attack_bonus:0}]},{name:"Crab",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:11,hp:2,hit_dice:"1d4",speed:"20 ft., swim 20 ft.",stats:[2,11,10,1,8,2],skillsaves:[{stealth:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 30 ft., passive Perception 9",languages:"",cr:"0",traits:[{name:"Amphibious",desc:"The crab can breathe air and water.",attack_bonus:0}],actions:[{name:"Claw",desc:"Melee Weapon Attack: +0 to hit, reach 5 ft., one target. Hit: 1 bludgeoning damage.",attack_bonus:0,damage_bonus:1}]},{name:"Crocodile",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:19,hit_dice:"3d10 + 2",speed:"20 ft., swim 20 ft.",stats:[15,10,13,2,10,5],skillsaves:[{stealth:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"",cr:"1/2",traits:[{name:"Hold Breath",desc:"The crocodile can hold its breath for 15 minutes.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 7 (1d10 + 2) piercing damage, and the target is grappled (escape DC 12). Until this grapple ends, the target is restrained, and the crocodile can't bite another target",attack_bonus:4,damage_dice:"1d10",damage_bonus:2}]},{name:"Cult Fanatic",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any non-good alignment",ac:13,hp:22,hit_dice:"6d8 + -5",speed:"30 ft.",stats:[11,14,12,10,13,14],skillsaves:[{deception:4},{persuasion:4},{religion:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 11",languages:"any one language (usually Common)",cr:"2",traits:[{name:"Dark Devotion",desc:"The fanatic has advantage on saving throws against being charmed or frightened.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The fanatic makes two melee attacks.",attack_bonus:0},{name:"Dagger",desc:"Melee or Ranged Weapon Attack: +4 to hit, reach 5 ft. or range 20/60 ft., one creature. Hit: 4 (1d4 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d4",damage_bonus:2}],spells:["The fanatic is a 4th-level spellcaster. Its spell casting ability is Wisdom (spell save DC 11, +3 to hit with spell attacks). The fanatic has the following cleric spells prepared:","Cantrips (at will): light, sacred flame, thaumaturgy",{"1st level (4 slots)":"command, inflict wounds, shield of faith"},{"2nd level (3 slots)":"hold person, spiritual weapon"}]},{name:"Cultist",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any non-good alignment",ac:12,hp:9,hit_dice:"2d8",speed:"30 ft.",stats:[11,12,10,10,11,10],skillsaves:[{deception:2},{religion:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"any one language (usually Common)",cr:"1/8",traits:[{name:"Dark Devotion",desc:"The cultist has advantage on saving throws against being charmed or frightened.",attack_bonus:0}],actions:[{name:"Scimitar",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one creature. Hit: 4 (1d6 + 1) slashing damage.",attack_bonus:3,damage_dice:"1d6",damage_bonus:1}]},{name:"Darkmantle",size:"Small",type:"monstrosity",subtype:"",alignment:"unaligned",ac:11,hp:22,hit_dice:"5d6 + 4",speed:"10 ft., fly 30 ft.",stats:[16,12,13,2,10,5],skillsaves:[{stealth:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 60 ft., passive Perception 10",languages:"",cr:"1/2",traits:[{name:"Echolocation",desc:"The darkmantle can't use its blindsight while deafened.",attack_bonus:0},{name:"False Appearance",desc:"While the darkmantle remains motionless, it is indistinguishable from a cave formation such as a stalactite or stalagmite.",attack_bonus:0}],actions:[{name:"Crush",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one creature. Hit: 6 (1d6 + 3) bludgeoning damage, and the darkmantle attaches to the target. If the target is Medium or smaller and the darkmantle has advantage on the attack roll, it attaches by engulfing the target's head, and the target is also blinded and unable to breathe while the darkmantle is attached in this way.\\nWhile attached to the target, the darkmantle can attack no other creature except the target but has advantage on its attack rolls. The darkmantle's speed also becomes 0, it can't benefit from any bonus to its speed, and it moves with the target.\\nA creature can detach the darkmantle by making a successful DC 13 Strength check as an action. On its turn, the darkmantle can detach itself from the target by using 5 feet of movement.",attack_bonus:5,damage_dice:"1d6",damage_bonus:3},{name:"Darkness Aura (1/day)",desc:"A 15-foot radius of magical darkness extends out from the darkmantle, moves with it, and spreads around corners. The darkness lasts as long as the darkmantle maintains concentration, up to 10 minutes (as if concentrating on a spell). Darkvision can't penetrate this darkness, and no natural light can illuminate it. If any of the darkness overlaps with an area of light created by a spell of 2nd level or lower, the spell creating the light is dispelled.",attack_bonus:0}]},{name:"Death Dog",size:"Medium",type:"monstrosity",subtype:"",alignment:"neutral evil",ac:12,hp:39,hit_dice:"6d8 + 12",speed:"40 ft.",stats:[15,14,14,3,13,6],skillsaves:[{perception:5},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 120 ft., passive Perception 15",languages:"",cr:"1",traits:[{name:"Two-Headed",desc:"The dog has advantage on Wisdom (Perception) checks and on saving throws against being blinded, charmed, deafened, frightened, stunned, or knocked unconscious.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dog makes two bite attacks.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage. If the target is a creature, it must succeed on a DC 12 Constitution saving throw against disease or become poisoned until the disease is cured. Every 24 hours that elapse, the creature must repeat the saving throw, reducing its hit point maximum by 5 (1d10) on a failure. This reduction lasts until the disease is cured. The creature dies if the disease reduces its hit point maximum to 0.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2}]},{name:"Deep Gnome (Svirfneblin)",size:"Small",type:"humanoid",subtype:"gnome",alignment:"neutral good",ac:15,hp:16,hit_dice:"3d6 + 5",speed:"20 ft.",stats:[15,14,14,12,10,9],skillsaves:[{perception:2},{investigation:3},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 120 ft., passive Perception 12",languages:"Gnomish, Terran, Undercommon",cr:"1/2",traits:[{name:"Stone Camouflage",desc:"The gnome has advantage on Dexterity (Stealth) checks made to hide in rocky terrain.",attack_bonus:0},{name:"Gnome Cunning",desc:"The gnome has advantage on Intelligence, Wisdom, and Charisma saving throws against magic.",attack_bonus:0},{name:"Innate Spellcasting",desc:"The gnome's innate spellcasting ability is Intelligence (spell save DC 11). It can innately cast the following spells, requiring no material components:\\nAt will: nondetection (self only)\\n1/day each: blindness/deafness, blur, disguise self",attack_bonus:0}],actions:[{name:"War Pick",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 6 (1d8 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d8",damage_bonus:2},{name:"Poisoned Dart",desc:"Ranged Weapon Attack: +4 to hit, range 30/120 ft., one creature. Hit: 4 (1d4 + 2) piercing damage, and the target must succeed on a DC 12 Constitution saving throw or be poisoned for 1 minute. The target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success",attack_bonus:4,damage_dice:"1d4",damage_bonus:2}]},{name:"Deer",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:13,hp:4,hit_dice:"1d8 + -1",speed:"50 ft.",stats:[11,16,11,2,14,5],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 12",languages:"",cr:"0",actions:[{name:"Bite",desc:"Melee Weapon Attack: +2 to hit, reach 5 ft., one target. Hit: 2 (1d4) piercing damage.",attack_bonus:2,damage_dice:"1d4"}]},{name:"Deva",size:"Medium",type:"celestial",subtype:"",alignment:"lawful good",ac:17,hp:136,hit_dice:"16d8 + 64",speed:"30 ft., fly 90 ft.",stats:[18,18,18,17,20,20],saves:[{wisdom:9},{charisma:9}],skillsaves:[{insight:9},{perception:9}],damage_vulnerabilities:"",damage_resistances:"radiant; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"",condition_immunities:"charmed, exhaustion, frightened",senses:"darkvision 120 ft., passive Perception 19",languages:"all, telepathy 120 ft.",cr:"10",traits:[{name:"Angelic Weapons",desc:"The deva's weapon attacks are magical. When the deva hits with any weapon, the weapon deals an extra 4d8 radiant damage (included in the attack).",attack_bonus:0},{name:"Innate Spellcasting",desc:"The deva's spellcasting ability is Charisma (spell save DC 17). The deva can innately cast the following spells, requiring only verbal components:\\nAt will: detect evil and good\\n1/day each: commune, raise dead",attack_bonus:0},{name:"Magic Resistance",desc:"The deva has advantage on saving throws against spells and other magical effects.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The deva makes two melee attacks.",attack_bonus:0},{name:"Mace",desc:"Melee Weapon Attack: +8 to hit, reach 5 ft., one target. Hit: 7 (1d6 + 4) bludgeoning damage plus 18 (4d8) radiant damage.",attack_bonus:8,damage_dice:"1d6 + 4d8",damage_bonus:4},{name:"Healing Touch (3/Day)",desc:"The deva touches another creature. The target magically regains 20 (4d8 + 2) hit points and is freed from any curse, disease, poison, blindness, or deafness.",attack_bonus:0},{name:"Change Shape",desc:"The deva magically polymorphs into a humanoid or beast that has a challenge rating equal to or less than its own, or back into its true form. It reverts to its true form if it dies. Any equipment it is wearing or carrying is absorbed or borne by the new form (the deva's choice).\\nIn a new form, the deva retains its game statistics and ability to speak, but its AC, movement modes, Strength, Dexterity, and special senses are replaced by those of the new form, and it gains any statistics and capabilities (except class features, legendary actions, and lair actions) that the new form has but that it lacks.",attack_bonus:0}]},{name:"Dire Wolf",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:14,hp:37,hit_dice:"5d10 + 9",speed:"50 ft.",stats:[17,15,15,3,12,7],skillsaves:[{perception:3},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"",cr:"1",traits:[{name:"Keen Hearing and Smell",desc:"The wolf has advantage on Wisdom (Perception) checks that rely on hearing or smell.",attack_bonus:0},{name:"Pack Tactics",desc:"The wolf has advantage on an attack roll against a creature if at least one of the wolf's allies is within 5 ft. of the creature and the ally isn't incapacitated.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) piercing damage. If the target is a creature, it must succeed on a DC 13 Strength saving throw or be knocked prone.",attack_bonus:5,damage_dice:"2d6",damage_bonus:3}]},{name:"Djinni",size:"Large",type:"elemental",subtype:"",alignment:"chaotic good",ac:17,hp:161,hit_dice:"14d10 + 84",speed:"30 ft., fly 90 ft.",stats:[21,15,22,15,16,20],saves:[{dexterity:6},{wisdom:7},{charisma:9}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"lightning, thunder",condition_immunities:"",senses:"darkvision 120 ft., passive Perception 13",languages:"Auran",cr:"11",traits:[{name:"Elemental Demise",desc:"If the djinni dies, its body disintegrates into a warm breeze, leaving behind only equipment the djinni was wearing or carrying.",attack_bonus:0},{name:"Innate Spellcasting",desc:"The djinni's innate spellcasting ability is Charisma (spell save DC 17, +9 to hit with spell attacks). It can innately cast the following spells, requiring no material components:\\n\\nAt will: detect evil and good, detect magic, thunderwave 3/day each: create food and water (can create wine instead of water), tongues, wind walk\\n1/day each: conjure elemental (air elemental only), creation, gaseous form, invisibility, major image, plane shift",attack_bonus:0},{name:"Variant: Genie Powers",desc:"Genies have a variety of magical capabilities, including spells. A few have even greater powers that allow them to alter their appearance or the nature of reality.\\n\\nDisguises.\\nSome genies can veil themselves in illusion to pass as other similarly shaped creatures. Such genies can innately cast the disguise self spell at will, often with a longer duration than is normal for that spell. Mightier genies can cast the true polymorph spell one to three times per day, possibly with a longer duration than normal. Such genies can change only their own shape, but a rare few can use the spell on other creatures and objects as well.\\nWishes.\\nThe genie power to grant wishes is legendary among mortals. Only the most potent genies, such as those among the nobility, can do so. A particular genie that has this power can grant one to three wishes to a creature that isn't a genie. Once a genie has granted its limit of wishes, it can't grant wishes again for some amount of time (usually 1 year). and cosmic law dictates that the same genie can expend its limit of wishes on a specific creature only once in that creature's existence.\\nTo be granted a wish, a creature within 60 feet of the genie states a desired effect to it. The genie can then cast the wish spell on the creature's behalf to bring about the effect. Depending on the genie's nature, the genie might try to pervert the intent of the wish by exploiting the wish's poor wording. The perversion of the wording is usually crafted to be to the genie's benefit.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The djinni makes three scimitar attacks.",attack_bonus:0},{name:"Scimitar",desc:"Melee Weapon Attack: +9 to hit, reach 5 ft., one target. Hit: 12 (2d6 + 5) slashing damage plus 3 (1d6) lightning or thunder damage (djinni's choice).",attack_bonus:9,damage_dice:"2d6 + 1d6",damage_bonus:5},{name:"Create Whirlwind",desc:"A 5-foot-radius, 30-foot-tall cylinder of swirling air magically forms on a point the djinni can see within 120 feet of it. The whirlwind lasts as long as the djinni maintains concentration (as if concentrating on a spell). Any creature but the djinni that enters the whirlwind must succeed on a DC 18 Strength saving throw or be restrained by it. The djinni can move the whirlwind up to 60 feet as an action, and creatures restrained by the whirlwind move with it. The whirlwind ends if the djinni loses sight of it.\\nA creature can use its action to free a creature restrained by the whirlwind, including itself, by succeeding on a DC 18 Strength check. If the check succeeds, the creature is no longer restrained and moves to the nearest space outside the whirlwind.",attack_bonus:0}]},{name:"Doppelganger",size:"Medium",type:"monstrosity",subtype:"shapechanger",alignment:"unaligned",ac:14,hp:52,hit_dice:"8d8 + 16",speed:"30 ft.",stats:[11,18,14,11,12,14],skillsaves:[{deception:6},{insight:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"charmed",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 11",languages:"Common",cr:"3",traits:[{name:"Shapechanger",desc:"The doppelganger can use its action to polymorph into a Small or Medium humanoid it has seen, or back into its true form. Its statistics, other than its size, are the same in each form. Any equipment it is wearing or carrying isn't transformed. It reverts to its true form if it dies.",attack_bonus:0},{name:"Ambusher",desc:"The doppelganger has advantage on attack rolls against any creature it has surprised.",attack_bonus:0},{name:"Surprise Attack",desc:"If the doppelganger surprises a creature and hits it with an attack during the first round of combat, the target takes an extra 10 (3d6) damage from the attack.",attack_bonus:0,damage_dice:"3d6"}],actions:[{name:"Multiattack",desc:"The doppelganger makes two melee attacks.",attack_bonus:0},{name:"Slam",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 7 (1d6 + 4) bludgeoning damage.",attack_bonus:6,damage_dice:"1d6",damage_bonus:4},{name:"Read Thoughts",desc:"The doppelganger magically reads the surface thoughts of one creature within 60 ft. of it. The effect can penetrate barriers, but 3 ft. of wood or dirt, 2 ft. of stone, 2 inches of metal, or a thin sheet of lead blocks it. While the target is in range, the doppelganger can continue reading its thoughts, as long as the doppelganger's concentration isn't broken (as if concentrating on a spell). While reading the target's mind, the doppelganger has advantage on Wisdom (Insight) and Charisma (Deception, Intimidation, and Persuasion) checks against the target.",attack_bonus:0}]},{name:"Draft Horse",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:10,hp:19,hit_dice:"3d10 + 2",speed:"40 ft.",stats:[18,10,12,2,11,7],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"",cr:"1/4",actions:[{name:"Hooves",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 9 (2d4 + 4) bludgeoning damage.",attack_bonus:6,damage_dice:"2d4",damage_bonus:4}]},{name:"Dragon Turtle",size:"Gargantuan",type:"dragon",subtype:"",alignment:"neutral",ac:20,hp:341,hit_dice:"22d20 + 110",speed:"20 ft., swim 40 ft.",stats:[25,10,20,10,12,12],saves:[{dexterity:6},{constitution:11},{wisdom:7}],damage_vulnerabilities:"",damage_resistances:"fire",damage_immunities:"",condition_immunities:"",senses:"darkvision 120 ft., passive Perception 11",languages:"Aquan, Draconic",cr:"17",traits:[{name:"Amphibious",desc:"The dragon turtle can breathe air and water.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon turtle makes three attacks: one with its bite and two with its claws. It can make one tail attack in place of its two claw attacks.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +13 to hit, reach 15 ft., one target. Hit: 26 (3d12 + 7) piercing damage.",attack_bonus:13,damage_dice:"3d12",damage_bonus:7},{name:"Claw",desc:"Melee Weapon Attack: +13 to hit, reach 10 ft., one target. Hit: 16 (2d8 + 7) slashing damage.",attack_bonus:13,damage_dice:"2d8",damage_bonus:7},{name:"Tail",desc:"Melee Weapon Attack: +13 to hit, reach 15 ft., one target. Hit: 26 (3d12 + 7) bludgeoning damage. If the target is a creature, it must succeed on a DC 20 Strength saving throw or be pushed up to 10 feet away from the dragon turtle and knocked prone.",attack_bonus:13,damage_dice:"3d12",damage_bonus:7},{name:"Steam Breath (Recharge 5-6)",desc:"The dragon turtle exhales scalding steam in a 60-foot cone. Each creature in that area must make a DC 18 Constitution saving throw, taking 52 (15d6) fire damage on a failed save, or half as much damage on a successful one. Being underwater doesn't grant resistance against this damage.",attack_bonus:0,damage_dice:"15d6"}]},{name:"Dretch",size:"Small",type:"fiend",subtype:"demon",alignment:"chaotic evil",ac:11,hp:18,hit_dice:"4d6 + 4",speed:"20 ft.",stats:[11,11,12,5,8,3],damage_vulnerabilities:"",damage_resistances:"cold, fire, lightning",damage_immunities:"poison",condition_immunities:"poisoned",senses:"darkvision 60 ft., passive Perception 9",languages:"Abyssal, telepathy 60 ft. (works only with creatures that understand Abyssal)",cr:"1/4",actions:[{name:"Multiattack",desc:"The dretch makes two attacks: one with its bite and one with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +2 to hit, reach 5 ft., one target. Hit: 3 (1d6) piercing damage.",attack_bonus:2,damage_dice:"1d6"},{name:"Claws",desc:"Melee Weapon Attack: +2 to hit, reach 5 ft., one target. Hit: 5 (2d4) slashing damage.",attack_bonus:2,damage_dice:"2d4"},{name:"Fetid Cloud (1/Day)",desc:"A 10-foot radius of disgusting green gas extends out from the dretch. The gas spreads around corners, and its area is lightly obscured. It lasts for 1 minute or until a strong wind disperses it. Any creature that starts its turn in that area must succeed on a DC 11 Constitution saving throw or be poisoned until the start of its next turn. While poisoned in this way, the target can take either an action or a bonus action on its turn, not both, and can't take reactions.",attack_bonus:0}]},{name:"Drider",size:"Large",type:"monstrosity",subtype:"",alignment:"chaotic evil",ac:19,hp:123,hit_dice:"13d10 + 51",speed:"30 ft., climb 30 ft.",stats:[16,16,18,13,14,12],skillsaves:[{perception:5},{stealth:9}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 120 ft., passive Perception 15",languages:"Elvish, Undercommon",cr:"6",traits:[{name:"Fey Ancestry",desc:"The drider has advantage on saving throws against being charmed, and magic can't put the drider to sleep.",attack_bonus:0},{name:"Innate Spellcasting",desc:"The drider's innate spellcasting ability is Wisdom (spell save DC 13). The drider can innately cast the following spells, requiring no material components:\\nAt will: dancing lights\\n1/day each: darkness, faerie fire",attack_bonus:0},{name:"Spider Climb",desc:"The drider can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",attack_bonus:0},{name:"Sunlight Sensitivity",desc:"While in sunlight, the drider has disadvantage on attack rolls, as well as on Wisdom (Perception) checks that rely on sight.",attack_bonus:0},{name:"Web Walker",desc:"The drider ignores movement restrictions caused by webbing.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The drider makes three attacks, either with its longsword or its longbow. It can replace one of those attacks with a bite attack.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one creature. Hit: 2 (1d4) piercing damage plus 9 (2d8) poison damage.",attack_bonus:6,damage_dice:"1d4",damage_bonus:2},{name:"Longsword",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 7 (1d8 + 3) slashing damage, or 8 (1d10 + 3) slashing damage if used with two hands.",attack_bonus:6,damage_dice:"1d8",damage_bonus:3},{name:"Longbow",desc:"Ranged Weapon Attack: +6 to hit, range 150/600 ft., one target. Hit: 7 (1d8 + 3) piercing damage plus 4 (1d8) poison damage.",attack_bonus:6,damage_dice:"1d8",damage_bonus:3}]},{name:"Drow",size:"Medium",type:"humanoid",subtype:"elf",alignment:"neutral evil",ac:15,hp:13,hit_dice:"3d8 + -1",speed:"30 ft.",stats:[10,14,10,11,11,12],skillsaves:[{perception:2},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 120 ft., passive Perception 12",languages:"Elvish, Undercommon",cr:"1/4",traits:[{name:"Fey Ancestry",desc:"The drow has advantage on saving throws against being charmed, and magic can't put the drow to sleep.",attack_bonus:0},{name:"Innate Spellcasting",desc:"The drow's spellcasting ability is Charisma (spell save DC 11). It can innately cast the following spells, requiring no material components:\\nAt will: dancing lights\\n1/day each: darkness, faerie fire",attack_bonus:0},{name:"Sunlight Sensitivity",desc:"While in sunlight, the drow has disadvantage on attack rolls, as well as on Wisdom (Perception) checks that rely on sight.",attack_bonus:0}],actions:[{name:"Shortsword",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2},{name:"Hand Crossbow",desc:"Ranged Weapon Attack: +4 to hit, range 30/120 ft., one target. Hit: 5 (1d6 + 2) piercing damage, and the target must succeed on a DC 13 Constitution saving throw or be poisoned for 1 hour. If the saving throw fails by 5 or more, the target is also unconscious while poisoned in this way. The target wakes up if it takes damage or if another creature takes an action to shake it awake.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2}]},{name:"Druid",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any alignment",ac:11,hp:27,hit_dice:"5d8 + 4",speed:"30 ft.",stats:[10,12,13,12,15,11],skillsaves:[{nature:3},{medicine:4},{perception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 14",languages:"Druidic plus any two languages",cr:"2",traits:[],actions:[{name:"Quarterstaff",desc:"Melee Weapon Attack: +2 to hit (+4 to hit with shillelagh), reach 5 ft., one target. Hit: 3 (1d6) bludgeoning damage, or 6 (1d8 + 2) bludgeoning damage with shillelagh or if wielded with two hands.",attack_bonus:2,damage_dice:"1d6"}],spells:["The druid is a 4th-level spellcaster. Its spellcasting ability is Wisdom (spell save DC 12, +4 to hit with spell attacks). It has the following druid spells prepared:",{"Cantrips (at will)":"druidcraft, produce flame, shillelagh"},{"1st level (4 slots)":"entangle, longstrider, speak with animals, thunderwave"},{"2nd level (3 slots)":"animal messenger, barkskin"}]},{name:"Dryad",size:"Medium",type:"fey",subtype:"",alignment:"neutral",ac:11,hp:22,hit_dice:"5d8 + -1",speed:"30 ft.",stats:[10,12,11,14,15,18],skillsaves:[{perception:4},{stealth:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 14",languages:"Elvish, Sylvan",cr:"1",traits:[{name:"Innate Spellcasting",desc:"The dryad's innate spellcasting ability is Charisma (spell save DC 14). The dryad can innately cast the following spells, requiring no material components:\\n\\nAt will: druidcraft\\n3/day each: entangle, goodberry\\n1/day each: barkskin, pass without trace, shillelagh",attack_bonus:0},{name:"Magic Resistance",desc:"The dryad has advantage on saving throws against spells and other magical effects.",attack_bonus:0},{name:"Speak with Beasts and Plants",desc:"The dryad can communicate with beasts and plants as if they shared a language.",attack_bonus:0},{name:"Tree Stride",desc:"Once on her turn, the dryad can use 10 ft. of her movement to step magically into one living tree within her reach and emerge from a second living tree within 60 ft. of the first tree, appearing in an unoccupied space within 5 ft. of the second tree. Both trees must be large or bigger.",attack_bonus:0}],actions:[{name:"Club",desc:"Melee Weapon Attack: +2 to hit (+6 to hit with shillelagh), reach 5 ft., one target. Hit: 2 (1 d4) bludgeoning damage, or 8 (1d8 + 4) bludgeoning damage with shillelagh.",attack_bonus:2,damage_dice:"1d4"},{name:"Fey Charm",desc:"The dryad targets one humanoid or beast that she can see within 30 feet of her. If the target can see the dryad, it must succeed on a DC 14 Wisdom saving throw or be magically charmed. The charmed creature regards the dryad as a trusted friend to be heeded and protected. Although the target isn't under the dryad's control, it takes the dryad's requests or actions in the most favorable way it can.\\nEach time the dryad or its allies do anything harmful to the target, it can repeat the saving throw, ending the effect on itself on a success. Otherwise, the effect lasts 24 hours or until the dryad dies, is on a different plane of existence from the target, or ends the effect as a bonus action. If a target's saving throw is successful, the target is immune to the dryad's Fey Charm for the next 24 hours.\\nThe dryad can have no more than one humanoid and up to three beasts charmed at a time.",attack_bonus:0}]},{name:"Duergar",size:"Medium",type:"humanoid",subtype:"dwarf",alignment:"lawful evil",ac:16,hp:26,hit_dice:"4d8 + 8",speed:"25 ft.",stats:[14,11,14,11,10,9],damage_vulnerabilities:"",damage_resistances:"poison",damage_immunities:"",condition_immunities:"",senses:"darkvision 120 ft., passive Perception 10",languages:"Dwarvish, Undercommon",cr:"1",traits:[{name:"Duergar Resilience",desc:"The duergar has advantage on saving throws against poison, spells, and illusions, as well as to resist being charmed or paralyzed.",attack_bonus:0},{name:"Sunlight Sensitivity",desc:"While in sunlight, the duergar has disadvantage on attack rolls, as well as on Wisdom (Perception) checks that rely on sight.",attack_bonus:0}],actions:[{name:"Enlarge (Recharges after a Short or Long Rest)",desc:"For 1 minute, the duergar magically increases in size, along with anything it is wearing or carrying. While enlarged, the duergar is Large, doubles its damage dice on Strength-based weapon attacks (included in the attacks), and makes Strength checks and Strength saving throws with advantage. If the duergar lacks the room to become Large, it attains the maximum size possible in the space available.",attack_bonus:0},{name:"War Pick",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 6 (1d8 + 2) piercing damage, or 11 (2d8 + 2) piercing damage while enlarged.",attack_bonus:4,damage_dice:"1d8",damage_bonus:2},{name:"Javelin",desc:"Melee or Ranged Weapon Attack: +4 to hit, reach 5 ft. or range 30/120 ft., one target. Hit: 5 (1d6 + 2) piercing damage, or 9 (2d6 + 2) piercing damage while enlarged.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2},{name:"Invisibility (Recharges after a Short or Long Rest)",desc:"The duergar magically turns invisible until it attacks, casts a spell, or uses its Enlarge, or until its concentration is broken, up to 1 hour (as if concentrating on a spell). Any equipment the duergar wears or carries is invisible with it .",attack_bonus:0}]},{name:"Dust Mephit",size:"Small",type:"elemental",subtype:"",alignment:"neutral evil",ac:12,hp:17,hit_dice:"5d6 + -1",speed:"30 ft., fly 30 ft.",stats:[5,14,10,9,11,10],skillsaves:[{perception:2},{stealth:4}],damage_vulnerabilities:"fire",damage_resistances:"",damage_immunities:"poison",condition_immunities:"poisoned",senses:"darkvision 60 ft., passive Perception 12",languages:"Auran, Terran",cr:"1/2",traits:[{name:"Death Burst",desc:"When the mephit dies, it explodes in a burst of dust. Each creature within 5 ft. of it must then succeed on a DC 10 Constitution saving throw or be blinded for 1 minute. A blinded creature can repeat the saving throw on each of its turns, ending the effect on itself on a success.",attack_bonus:0},{name:"Innate Spellcasting (1/Day)",desc:"The mephit can innately cast sleep, requiring no material components. Its innate spellcasting ability is Charisma.",attack_bonus:0}],actions:[{name:"Claws",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 4 (1d4 + 2) slashing damage.",attack_bonus:4,damage_dice:"1d4",damage_bonus:2},{name:"Blinding Breath (Recharge 6)",desc:"The mephit exhales a 15-foot cone of blinding dust. Each creature in that area must succeed on a DC 10 Dexterity saving throw or be blinded for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",attack_bonus:0},{name:"Variant: Summon Mephits (1/Day)",desc:"The mephit has a 25 percent chance of summoning 1d4 mephits of its kind. A summoned mephit appears in an unoccupied space within 60 feet of its summoner, acts as an ally of its summoner, and can't summon other mephits. It remains for 1 minute, until it or its summoner dies, or until its summoner dismisses it as an action.",attack_bonus:0}]},{name:"Eagle",size:"Small",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:3,hit_dice:"1d6 + -1",speed:"10 ft., fly 60 ft.",stats:[6,15,10,2,14,7],skillsaves:[{perception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 14",languages:"",cr:"0",traits:[{name:"Keen Sight",desc:"The eagle has advantage on Wisdom (Perception) checks that rely on sight.",attack_bonus:0}],actions:[{name:"Talons",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 4 (1d4 + 2) slashing damage.",attack_bonus:4,damage_dice:"1d4",damage_bonus:2}]},{name:"Earth Elemental",size:"Large",type:"elemental",subtype:"",alignment:"neutral",ac:17,hp:126,hit_dice:"12d10 + 60",speed:"30 ft., burrow 30 ft.",stats:[20,8,20,5,10,5],damage_vulnerabilities:"thunder",damage_resistances:"bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"poison",condition_immunities:"exhaustion, paralyzed, petrified, poisoned, unconscious",senses:"darkvision 60 ft., tremorsense 60 ft., passive Perception 10",languages:"Terran",cr:"5",traits:[{name:"Earth Glide",desc:"The elemental can burrow through nonmagical, unworked earth and stone. While doing so, the elemental doesn't disturb the material it moves through.",attack_bonus:0},{name:"Siege Monster",desc:"The elemental deals double damage to objects and structures.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The elemental makes two slam attacks.",attack_bonus:0},{name:"Slam",desc:"Melee Weapon Attack: +8 to hit, reach 10 ft., one target. Hit: 14 (2d8 + 5) bludgeoning damage.",attack_bonus:8,damage_dice:"2d8",damage_bonus:5}]},{name:"Efreeti",size:"Large",type:"elemental",subtype:"",alignment:"lawful evil",ac:17,hp:200,hit_dice:"16d10 + 112",speed:"40 ft., fly 60 ft.",stats:[22,12,24,16,15,16],saves:[{intelligence:7},{wisdom:6},{charisma:7}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire",condition_immunities:"",senses:"darkvision 120 ft., passive Perception 12",languages:"Ignan",cr:"11",traits:[{name:"Elemental Demise",desc:"If the efreeti dies, its body disintegrates in a flash of fire and puff of smoke, leaving behind only equipment the djinni was wearing or carrying.",attack_bonus:0},{name:"Innate Spellcasting",desc:"The efreeti's innate spell casting ability is Charisma (spell save DC 15, +7 to hit with spell attacks). It can innately cast the following spells, requiring no material components:\\n\\nAt will: detect magic\\n3/day: enlarge/reduce, tongues\\n1/day each: conjure elemental (fire elemental only), gaseous form, invisibility, major image, plane shift, wall of fire",attack_bonus:0},{name:"Variant: Genie Powers",desc:"Genies have a variety of magical capabilities, including spells. A few have even greater powers that allow them to alter their appearance or the nature of reality.\\n\\nDisguises.\\nSome genies can veil themselves in illusion to pass as other similarly shaped creatures. Such genies can innately cast the disguise self spell at will, often with a longer duration than is normal for that spell. Mightier genies can cast the true polymorph spell one to three times per day, possibly with a longer duration than normal. Such genies can change only their own shape, but a rare few can use the spell on other creatures and objects as well.\\nWishes.\\nThe genie power to grant wishes is legendary among mortals. Only the most potent genies, such as those among the nobility, can do so. A particular genie that has this power can grant one to three wishes to a creature that isn't a genie. Once a genie has granted its limit of wishes, it can't grant wishes again for some amount of time (usually 1 year). and cosmic law dictates that the same genie can expend its limit of wishes on a specific creature only once in that creature's existence.\\nTo be granted a wish, a creature within 60 feet of the genie states a desired effect to it. The genie can then cast the wish spell on the creature's behalf to bring about the effect. Depending on the genie's nature, the genie might try to pervert the intent of the wish by exploiting the wish's poor wording. The perversion of the wording is usually crafted to be to the genie's benefit.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The efreeti makes two scimitar attacks or uses its Hurl Flame twice.",attack_bonus:0},{name:"Scimitar",desc:"Melee Weapon Attack: +10 to hit, reach 5 ft., one target. Hit: 13 (2d6 + 6) slashing damage plus 7 (2d6) fire damage.",attack_bonus:10,damage_dice:"2d6 + 2d6",damage_bonus:6},{name:"Hurl Flame",desc:"Ranged Spell Attack: +7 to hit, range 120 ft., one target. Hit: 17 (5d6) fire damage.",attack_bonus:7,damage_dice:"5d6"}]},{name:"Elephant",size:"Huge",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:76,hit_dice:"8d12 + 24",speed:"40 ft.",stats:[22,9,17,3,11,6],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"",cr:"4",traits:[{name:"Trampling Charge",desc:"If the elephant moves at least 20 ft. straight toward a creature and then hits it with a gore attack on the same turn, that target must succeed on a DC 12 Strength saving throw or be knocked prone. If the target is prone, the elephant can make one stomp attack against it as a bonus action.",attack_bonus:0}],actions:[{name:"Gore",desc:"Melee Weapon Attack: +8 to hit, reach 5 ft., one target. Hit: 19 (3d8 + 6) piercing damage.",attack_bonus:8,damage_dice:"3d8",damage_bonus:6},{name:"Stomp",desc:"Melee Weapon Attack: +8 to hit, reach 5 ft., one prone creature. Hit: 22 (3d10 + 6) bludgeoning damage.",attack_bonus:8,damage_dice:"3d10",damage_bonus:6}]},{name:"Elk",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:10,hp:13,hit_dice:"2d10 + 2",speed:"50 ft.",stats:[16,10,12,2,10,6],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"",cr:"1/4",traits:[{name:"Charge",desc:"If the elk moves at least 20 ft. straight toward a target and then hits it with a ram attack on the same turn, the target takes an extra 7 (2d6) damage. If the target is a creature, it must succeed on a DC 13 Strength saving throw or be knocked prone.",attack_bonus:0,damage_dice:"2d6"}],actions:[{name:"Ram",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) bludgeoning damage.",attack_bonus:0},{name:"Hooves",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one prone creature. Hit: 8 (2d4 + 3) bludgeoning damage.",attack_bonus:0}]},{name:"Erinyes",size:"Medium",type:"fiend",subtype:"devil",alignment:"lawful evil",ac:18,hp:153,hit_dice:"18d8 + 72",speed:"30 ft., fly 60 ft.",stats:[18,16,18,14,14,18],saves:[{dexterity:7},{constitution:8},{wisdom:6},{charisma:8}],damage_vulnerabilities:"",damage_resistances:"cold; bludgeoning, piercing, and slashing from nonmagical weapons that aren't silvered",damage_immunities:"fire, poison",condition_immunities:"poisoned",senses:"truesight 120 ft., passive Perception 12",languages:"Infernal, telepathy 120 ft.",cr:"12",traits:[{name:"Hellish Weapons",desc:"The erinyes's weapon attacks are magical and deal an extra 13 (3d8) poison damage on a hit (included in the attacks).",attack_bonus:0},{name:"Magic Resistance",desc:"The erinyes has advantage on saving throws against spells and other magical effects.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The erinyes makes three attacks",attack_bonus:0},{name:"Longsword",desc:"Melee Weapon Attack: +8 to hit, reach 5 ft., one target. Hit: 8 (1d8 + 4) slashing damage, or 9 (1d10 + 4) slashing damage if used with two hands, plus 13 (3d8) poison damage.",attack_bonus:8,damage_dice:"1d8 + 3d8",damage_bonus:4},{name:"Longbow",desc:"Ranged Weapon Attack: +7 to hit, range 150/600 ft., one target. Hit: 7 (1d8 + 3) piercing damage plus 13 (3d8) poison damage, and the target must succeed on a DC 14 Constitution saving throw or be poisoned. The poison lasts until it is removed by the lesser restoration spell or similar magic.",attack_bonus:7,damage_dice:"1d8 + 3d8",damage_bonus:3},{name:"Variant: Rope of Entanglement",desc:"Some erinyes carry a rope of entanglement (detailed in the Dungeon Master's Guide). When such an erinyes uses its Multiattack, the erinyes can use the rope in place of two of the attacks.",attack_bonus:0}],reactions:[{name:"Parry",desc:"The erinyes adds 4 to its AC against one melee attack that would hit it. To do so, the erinyes must see the attacker and be wielding a melee weapon.",attack_bonus:0}]},{name:"Ettercap",size:"Medium",type:"monstrosity",subtype:"",alignment:"neutral evil",ac:13,hp:44,hit_dice:"8d8 + 8",speed:"30 ft., climb 30 ft.",stats:[14,15,13,7,12,8],skillsaves:[{perception:3},{stealth:4},{survival:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 13",languages:"",cr:"2",traits:[{name:"Spider Climb",desc:"The ettercap can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",attack_bonus:0},{name:"Web Sense",desc:"While in contact with a web, the ettercap knows the exact location of any other creature in contact with the same web.",attack_bonus:0},{name:"Web Walker",desc:"The ettercap ignores movement restrictions caused by webbing.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The ettercap makes two attacks: one with its bite and one with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 6 (1d8 + 2) piercing damage plus 4 (1d8) poison damage. The target must succeed on a DC 11 Constitution saving throw or be poisoned for 1 minute. The creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",attack_bonus:4,damage_dice:"1d8",damage_bonus:2},{name:"Claws",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (2d4 + 2) slashing damage.",attack_bonus:4,damage_dice:"2d4",damage_bonus:2},{name:"Web (Recharge 5-6)",desc:"Ranged Weapon Attack: +4 to hit, range 30/60 ft., one Large or smaller creature. Hit: The creature is restrained by webbing. As an action, the restrained creature can make a DC 11 Strength check, escaping from the webbing on a success. The effect ends if the webbing is destroyed. The webbing has AC 10, 5 hit points, is vulnerable to fire damage and immune to bludgeoning damage.",attack_bonus:0},{name:"Variant: Web Garrote",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one Medium or Small creature against which the ettercap has advantage on the attack roll. Hit: 4 (1d4 + 2) bludgeoning damage, and the target is grappled (escape DC 12). Until this grapple ends, the target can't breathe, and the ettercap has advantage on attack rolls against it.",attack_bonus:4,damage_dice:"1d4",damage_bonus:2}]},{name:"Ettin",size:"Large",type:"giant",subtype:"",alignment:"chaotic evil",ac:12,hp:85,hit_dice:"10d10 + 30",speed:"40 ft.",stats:[21,8,17,6,10,8],skillsaves:[{perception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 14",languages:"Giant, Orc",cr:"4",traits:[{name:"Two Heads",desc:"The ettin has advantage on Wisdom (Perception) checks and on saving throws against being blinded, charmed, deafened, frightened, stunned, and knocked unconscious.",attack_bonus:0},{name:"Wakeful",desc:"When one of the ettin's heads is asleep, its other head is awake.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The ettin makes two attacks: one with its battleaxe and one with its morningstar.",attack_bonus:0},{name:"Battleaxe",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 14 (2d8 + 5) slashing damage.",attack_bonus:7,damage_dice:"2d8",damage_bonus:5},{name:"Morningstar",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 14 (2d8 + 5) piercing damage.",attack_bonus:7,damage_dice:"2d8",damage_bonus:5}]},{name:"Fire Elemental",size:"Large",type:"elemental",subtype:"",alignment:"neutral",ac:13,hp:102,hit_dice:"12d10 + 36",speed:"50 ft.",stats:[10,17,16,6,10,7],damage_vulnerabilities:"",damage_resistances:"bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"fire, poison",condition_immunities:"exhaustion, grappled, paralyzed, petrified, poisoned, prone, restrained, unconscious",senses:"darkvision 60 ft., passive Perception 10",languages:"Ignan",cr:"5",traits:[{name:"Fire Form",desc:"The elemental can move through a space as narrow as 1 inch wide without squeezing. A creature that touches the elemental or hits it with a melee attack while within 5 ft. of it takes 5 (1d10) fire damage. In addition, the elemental can enter a hostile creature's space and stop there. The first time it enters a creature's space on a turn, that creature takes 5 (1d10) fire damage and catches fire; until someone takes an action to douse the fire, the creature takes 5 (1d10) fire damage at the start of each of its turns.",attack_bonus:0,damage_dice:"5d10"},{name:"Illumination",desc:"The elemental sheds bright light in a 30-foot radius and dim light in an additional 30 ft..",attack_bonus:0},{name:"Water Susceptibility",desc:"For every 5 ft. the elemental moves in water, or for every gallon of water splashed on it, it takes 1 cold damage.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The elemental makes two touch attacks.",attack_bonus:0},{name:"Touch",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) fire damage. If the target is a creature or a flammable object, it ignites. Until a creature takes an action to douse the fire, the target takes 5 (1d10) fire damage at the start of each of its turns.",attack_bonus:6,damage_dice:"2d6",damage_bonus:3}]},{name:"Fire Giant",size:"Huge",type:"giant",subtype:"",alignment:"lawful evil",ac:18,hp:162,hit_dice:"13d12 + 77",speed:"30 ft.",stats:[25,9,23,10,14,13],saves:[{dexterity:3},{constitution:10},{charisma:5}],skillsaves:[{athletics:11},{perception:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire",condition_immunities:"",senses:"passive Perception 16",languages:"Giant",cr:"9",actions:[{name:"Multiattack",desc:"The giant makes two greatsword attacks.",attack_bonus:0},{name:"Greatsword",desc:"Melee Weapon Attack: +11 to hit, reach 10 ft., one target. Hit: 28 (6d6 + 7) slashing damage.",attack_bonus:11,damage_dice:"6d6",damage_bonus:7},{name:"Rock",desc:"Ranged Weapon Attack: +11 to hit, range 60/240 ft., one target. Hit: 29 (4d10 + 7) bludgeoning damage.",attack_bonus:11,damage_dice:"4d10",damage_bonus:7}]},{name:"Flesh Golem",size:"Medium",type:"construct",subtype:"",alignment:"neutral",ac:9,hp:93,hit_dice:"11d8 + 43",speed:"30 ft.",stats:[19,9,18,6,10,5],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"lightning, poison; bludgeoning, piercing, and slashing from nonmagical weapons that aren't adamantine",condition_immunities:"charmed, exhaustion, frightened, paralyzed, petrified, poisoned",senses:"darkvision 60 ft., passive Perception 10",languages:"understands the languages of its creator but can't speak",cr:"5",traits:[{name:"Berserk",desc:"Whenever the golem starts its turn with 40 hit points or fewer, roll a d6. On a 6, the golem goes berserk. On each of its turns while berserk, the golem attacks the nearest creature it can see. If no creature is near enough to move to and attack, the golem attacks an object, with preference for an object smaller than itself. Once the golem goes berserk, it continues to do so until it is destroyed or regains all its hit points.\\nThe golem's creator, if within 60 feet of the berserk golem, can try to calm it by speaking firmly and persuasively. The golem must be able to hear its creator, who must take an action to make a DC 15 Charisma (Persuasion) check. If the check succeeds, the golem ceases being berserk. If it takes damage while still at 40 hit points or fewer, the golem might go berserk again.",attack_bonus:0},{name:"Aversion of Fire",desc:"If the golem takes fire damage, it has disadvantage on attack rolls and ability checks until the end of its next turn.",attack_bonus:0},{name:"Immutable Form",desc:"The golem is immune to any spell or effect that would alter its form.",attack_bonus:0},{name:"Lightning Absorption",desc:"Whenever the golem is subjected to lightning damage, it takes no damage and instead regains a number of hit points equal to the lightning damage dealt.",attack_bonus:0},{name:"Magic Resistance",desc:"The golem has advantage on saving throws against spells and other magical effects.",attack_bonus:0},{name:"Magic Weapons",desc:"The golem's weapon attacks are magical.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The golem makes two slam attacks.",attack_bonus:0},{name:"Slam",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) bludgeoning damage.",attack_bonus:7,damage_dice:"2d8",damage_bonus:4}]},{name:"Flying Snake",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:14,hp:5,hit_dice:"2d4",speed:"30 ft., fly 60 ft., swim 30 ft.",stats:[4,18,11,2,12,5],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 10 ft., passive Perception 11",languages:"",cr:"1/8",traits:[{name:"Flyby",desc:"The snake doesn't provoke opportunity attacks when it flies out of an enemy's reach.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 1 piercing damage plus 7 (3d4) poison damage.",attack_bonus:6,damage_bonus:1}]},{name:"Flying Sword",size:"Small",type:"construct",subtype:"",alignment:"unaligned",ac:17,hp:17,hit_dice:"5d6 + -1",speed:"0 ft., fly 50 ft. It can hover.",stats:[12,15,11,1,5,1],saves:[{dexterity:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"poison, psychic",condition_immunities:"blinded, charmed, deafened, frightened, paralyzed, petrified, poisoned",senses:"blindsight 60 ft. (blind beyond this radius), passive Perception 7",languages:"",cr:"1/4",traits:[{name:"Antimagic Susceptibility",desc:"The sword is incapacitated while in the area of an antimagic field. If targeted by dispel magic, the sword must succeed on a Constitution saving throw against the caster's spell save DC or fall unconscious for 1 minute.",attack_bonus:0},{name:"False Appearance",desc:"While the sword remains motionless and isn't flying, it is indistinguishable from a normal sword.",attack_bonus:0}],actions:[{name:"Longsword",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 5 (1d8 + 1) slashing damage.",attack_bonus:3,damage_dice:"1d8",damage_bonus:1}]},{name:"Frog",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:11,hp:1,hit_dice:"1d4 + -2",speed:"20 ft., swim 20 ft.",stats:[1,13,8,1,8,3],skillsaves:[{perception:1},{stealth:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 30 ft., passive Perception 11",languages:"",cr:"0",traits:[{name:"Amphibious",desc:"The frog can breathe air and water",attack_bonus:0},{name:"Standing Leap",desc:"The frog's long jump is up to 10 ft. and its high jump is up to 5 ft., with or without a running start.",attack_bonus:0}]},{name:"Frost Giant",size:"Huge",type:"giant",subtype:"",alignment:"neutral evil",ac:15,hp:138,hit_dice:"12d12 + 60",speed:"40 ft.",stats:[23,9,21,9,10,12],saves:[{constitution:8},{wisdom:3},{charisma:4}],skillsaves:[{athletics:9},{perception:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"cold",condition_immunities:"",senses:"passive Perception 13",languages:"Giant",cr:"8",actions:[{name:"Multiattack",desc:"The giant makes two greataxe attacks.",attack_bonus:0},{name:"Greataxe",desc:"Melee Weapon Attack: +9 to hit, reach 10 ft., one target. Hit: 25 (3d12 + 6) slashing damage.",attack_bonus:9,damage_dice:"3d12",damage_bonus:6},{name:"Rock",desc:"Ranged Weapon Attack: +9 to hit, range 60/240 ft., one target. Hit: 28 (4d10 + 6) bludgeoning damage.",attack_bonus:9,damage_dice:"4d10",damage_bonus:6}]},{name:"Gargoyle",size:"Medium",type:"elemental",subtype:"",alignment:"chaotic evil",ac:15,hp:52,hit_dice:"7d8 + 20",speed:"30 ft., fly 60 ft.",stats:[15,11,16,6,11,7],damage_vulnerabilities:"",damage_resistances:"bludgeoning, piercing, and slashing from nonmagical weapons that aren't adamantine",damage_immunities:"poison",condition_immunities:"exhaustion, petrified, poisoned",senses:"darkvision 60 ft., passive Perception 10",languages:"Terran",cr:"2",traits:[{name:"False Appearance",desc:"While the gargoyle remains motion less, it is indistinguishable from an inanimate statue.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The gargoyle makes two attacks: one with its bite and one with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2},{name:"Claws",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) slashing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2}]},{name:"Gelatinous Cube",size:"Large",type:"ooze",subtype:"",alignment:"unaligned",ac:6,hp:84,hit_dice:"8d10 + 40",speed:"15 ft.",stats:[14,3,20,1,6,1],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"blinded, charmed, deafened, exhaustion, frightened, prone",senses:"blindsight 60 ft. (blind beyond this radius), passive Perception 8",languages:"",cr:"2",traits:[{name:"Ooze Cube",desc:"The cube takes up its entire space. Other creatures can enter the space, but a creature that does so is subjected to the cube's Engulf and has disadvantage on the saving throw.\\nCreatures inside the cube can be seen but have total cover.\\nA creature within 5 feet of the cube can take an action to pull a creature or object out of the cube. Doing so requires a successful DC 12 Strength check, and the creature making the attempt takes 10 (3d6) acid damage.\\nThe cube can hold only one Large creature or up to four Medium or smaller creatures inside it at a time.",attack_bonus:0},{name:"Transparent",desc:"Even when the cube is in plain sight, it takes a successful DC 15 Wisdom (Perception) check to spot a cube that has neither moved nor attacked. A creature that tries to enter the cube's space while unaware of the cube is surprised by the cube.",attack_bonus:0}],actions:[{name:"Pseudopod",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 10 (3d6) acid damage.",attack_bonus:4,damage_dice:"3d6"},{name:"Engulf",desc:"The cube moves up to its speed. While doing so, it can enter Large or smaller creatures' spaces. Whenever the cube enters a creature's space, the creature must make a DC 12 Dexterity saving throw.\\nOn a successful save, the creature can choose to be pushed 5 feet back or to the side of the cube. A creature that chooses not to be pushed suffers the consequences of a failed saving throw.\\nOn a failed save, the cube enters the creature's space, and the creature takes 10 (3d6) acid damage and is engulfed. The engulfed creature can't breathe, is restrained, and takes 21 (6d6) acid damage at the start of each of the cube's turns. When the cube moves, the engulfed creature moves with it.\\nAn engulfed creature can try to escape by taking an action to make a DC 12 Strength check. On a success, the creature escapes and enters a space of its choice within 5 feet of the cube.",attack_bonus:0}]},{name:"Ghast",size:"Medium",type:"undead",subtype:"",alignment:"chaotic evil",ac:13,hp:36,hit_dice:"8d8",speed:"30 ft.",stats:[16,17,10,11,10,8],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"necrotic",condition_immunities:"poisoned",senses:"darkvision 60 ft., passive Perception 10",languages:"Common",cr:"2",traits:[{name:"Stench",desc:"Any creature that starts its turn within 5 ft. of the ghast must succeed on a DC 10 Constitution saving throw or be poisoned until the start of its next turn. On a successful saving throw, the creature is immune to the ghast's Stench for 24 hours.",attack_bonus:0},{name:"Turn Defiance",desc:"The ghast and any ghouls within 30 ft. of it have advantage on saving throws against effects that turn undead.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one creature. Hit: 12 (2d8 + 3) piercing damage.",attack_bonus:3,damage_dice:"2d8",damage_bonus:3},{name:"Claws",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) slashing damage. If the target is a creature other than an undead, it must succeed on a DC 10 Constitution saving throw or be paralyzed for 1 minute. The target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",attack_bonus:5,damage_dice:"2d6",damage_bonus:3}]},{name:"Ghost",size:"Medium",type:"undead",subtype:"",alignment:"any alignment",ac:11,hp:45,hit_dice:"10d8",speed:"0 ft., fly 40 ft. It can hover.",stats:[7,13,10,10,12,17],damage_vulnerabilities:"",damage_resistances:"acid, fire, lightning, thunder; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"cold, necrotic, poison",condition_immunities:"charmed, exhaustion, frightened, grappled, paralyzed, petrified, poisoned, prone, restrained",senses:"darkvision 60 ft., passive Perception 11",languages:"any languages it knew in life",cr:"4",traits:[{name:"Ethereal Sight",desc:"The ghost can see 60 ft. into the Ethereal Plane when it is on the Material Plane, and vice versa.",attack_bonus:0},{name:"Incorporeal Movement",desc:"The ghost can move through other creatures and objects as if they were difficult terrain. It takes 5 (1d10) force damage if it ends its turn inside an object.",attack_bonus:0}],actions:[{name:"Withering Touch",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 17 (4d6 + 3) necrotic damage.",attack_bonus:5,damage_dice:"4d6",damage_bonus:3},{name:"Etherealness",desc:"The ghost enters the Ethereal Plane from the Material Plane, or vice versa. It is visible on the Material Plane while it is in the Border Ethereal, and vice versa, yet it can't affect or be affected by anything on the other plane.",attack_bonus:0},{name:"Horrifying Visage",desc:"Each non-undead creature within 60 ft. of the ghost that can see it must succeed on a DC 13 Wisdom saving throw or be frightened for 1 minute. If the save fails by 5 or more, the target also ages 1d4 _ 10 years. A frightened target can repeat the saving throw at the end of each of its turns, ending the frightened condition on itself on a success. If a target's saving throw is successful or the effect ends for it, the target is immune to this ghost's Horrifying Visage for the next 24 hours. The aging effect can be reversed with a greater restoration spell, but only within 24 hours of it occurring.",attack_bonus:0},{name:"Possession (Recharge 6)",desc:"One humanoid that the ghost can see within 5 ft. of it must succeed on a DC 13 Charisma saving throw or be possessed by the ghost; the ghost then disappears, and the target is incapacitated and loses control of its body. The ghost now controls the body but doesn't deprive the target of awareness. The ghost can't be targeted by any attack, spell, or other effect, except ones that turn undead, and it retains its alignment, Intelligence, Wisdom, Charisma, and immunity to being charmed and frightened. It otherwise uses the possessed target's statistics, but doesn't gain access to the target's knowledge, class features, or proficiencies.\\nThe possession lasts until the body drops to 0 hit points, the ghost ends it as a bonus action, or the ghost is turned or forced out by an effect like the dispel evil and good spell. When the possession ends, the ghost reappears in an unoccupied space within 5 ft. of the body. The target is immune to this ghost's Possession for 24 hours after succeeding on the saving throw or after the possession ends.",attack_bonus:0}]},{name:"Ghoul",size:"Medium",type:"undead",subtype:"",alignment:"chaotic evil",ac:12,hp:22,hit_dice:"5d8 + -1",speed:"30 ft.",stats:[13,15,10,7,10,6],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"poisoned",senses:"darkvision 60 ft., passive Perception 10",languages:"Common",cr:"1",actions:[{name:"Bite",desc:"Melee Weapon Attack: +2 to hit, reach 5 ft., one creature. Hit: 9 (2d6 + 2) piercing damage.",attack_bonus:2,damage_dice:"2d6",damage_bonus:2},{name:"Claws",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (2d4 + 2) slashing damage. If the target is a creature other than an elf or undead, it must succeed on a DC 10 Constitution saving throw or be paralyzed for 1 minute. The target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",attack_bonus:0}]},{name:"Giant Ape",size:"Huge",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:157,hit_dice:"15d12 + 59",speed:"40 ft., climb 40 ft.",stats:[23,14,18,7,12,7],skillsaves:[{athletics:9},{perception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 14",languages:"",cr:"7",actions:[{name:"Multiattack",desc:"The ape makes two fist attacks.",attack_bonus:0},{name:"Fist",desc:"Melee Weapon Attack: +9 to hit, reach 10 ft., one target. Hit: 22 (3d10 + 6) bludgeoning damage.",attack_bonus:9,damage_dice:"3d10",damage_bonus:6},{name:"Rock",desc:"Ranged Weapon Attack: +9 to hit, range 50/100 ft., one target. Hit: 30 (7d6 + 6) bludgeoning damage.",attack_bonus:9,damage_dice:"7d6",damage_bonus:6}]},{name:"Giant Badger",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:10,hp:13,hit_dice:"2d8 + 4",speed:"30 ft., burrow 10 ft.",stats:[13,10,15,2,12,5],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 30 ft., passive Perception 11",languages:"",cr:"1/4",traits:[{name:"Keen Smell",desc:"The badger has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The badger makes two attacks: one with its bite and one with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 4 (1d6 + 1) piercing damage.",attack_bonus:3,damage_dice:"1d6",damage_bonus:1},{name:"Claws",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 6 (2d4 + 1) slashing damage.",attack_bonus:3,damage_dice:"2d4",damage_bonus:1}]},{name:"Giant Bat",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:13,hp:22,hit_dice:"4d10",speed:"10 ft., fly 60 ft.",stats:[15,16,11,2,12,6],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 60 ft., passive Perception 11",languages:"",cr:"1/4",traits:[{name:"Echolocation",desc:"The bat can't use its blindsight while deafened.",attack_bonus:0},{name:"Keen Hearing",desc:"The bat has advantage on Wisdom (Perception) checks that rely on hearing.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2}]},{name:"Giant Boar",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:42,hit_dice:"5d10 + 14",speed:"40 ft.",stats:[17,10,16,2,7,5],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 8",languages:"",cr:"2",traits:[{name:"Charge",desc:"If the boar moves at least 20 ft. straight toward a target and then hits it with a tusk attack on the same turn, the target takes an extra 7 (2d6) slashing damage. If the target is a creature, it must succeed on a DC 13 Strength saving throw or be knocked prone.",attack_bonus:0,damage_dice:"2d6"},{name:"Relentless (Recharges after a Short or Long Rest)",desc:"If the boar takes 10 damage or less that would reduce it to 0 hit points, it is reduced to 1 hit point instead.",attack_bonus:0}],actions:[{name:"Tusk",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) slashing damage.",attack_bonus:5,damage_dice:"2d6",damage_bonus:3}]},{name:"Giant Centipede",size:"Small",type:"beast",subtype:"",alignment:"unaligned",ac:13,hp:4,hit_dice:"1d6",speed:"30 ft., climb 30 ft.",stats:[5,14,12,1,7,3],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 30 ft., passive Perception 8",languages:"",cr:"1/4",actions:[{name:"Bite",desc:"Bite. Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 4 (1d4 + 2) piercing damage, and the target must succeed on a DC 11 Constitution saving throw or take 10 (3d6) poison damage. If the poison damage reduces the target to 0 hit points, the target is stable but poisoned for 1 hour, even after regaining hit points, and is paralyzed while poisoned in this way.",attack_bonus:4,damage_dice:"1d4",damage_bonus:2}]},{name:"Giant Constrictor Snake",size:"Huge",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:60,hit_dice:"8d12 + 8",speed:"30 ft., swim 30 ft.",stats:[19,14,12,1,10,3],skillsaves:[{perception:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 10 ft., passive Perception 12",languages:"",cr:"2",actions:[{name:"Bite",desc:"Melee Weapon Attack: +6 to hit, reach 10 ft., one creature. Hit: 11 (2d6 + 4) piercing damage.",attack_bonus:6,damage_dice:"2d6",damage_bonus:4},{name:"Constrict",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one creature. Hit: 13 (2d8 + 4) bludgeoning damage, and the target is grappled (escape DC 16). Until this grapple ends, the creature is restrained, and the snake can't constrict another target.",attack_bonus:6,damage_dice:"2d8",damage_bonus:4}]},{name:"Giant Crab",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:15,hp:13,hit_dice:"3d8 + -1",speed:"30 ft., swim 30 ft.",stats:[13,15,11,1,9,3],skillsaves:[{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 30 ft., passive Perception 9",languages:"",cr:"1/8",traits:[{name:"Amphibious",desc:"The crab can breathe air and water.",attack_bonus:0}],actions:[{name:"Claw",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 4 (1d6 + 1) bludgeoning damage, and the target is grappled (escape DC 11). The crab has two claws, each of which can grapple only one target.",attack_bonus:3,damage_dice:"1d6",damage_bonus:1}]},{name:"Giant Crocodile",size:"Huge",type:"beast",subtype:"",alignment:"unaligned",ac:14,hp:85,hit_dice:"9d12 + 26",speed:"30 ft., swim 50 ft.",stats:[21,9,17,2,10,7],skillsaves:[{stealth:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"",cr:"5",traits:[{name:"Hold Breath",desc:"The crocodile can hold its breath for 30 minutes.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The crocodile makes two attacks: one with its bite and one with its tail.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +8 to hit, reach 5 ft., one target. Hit: 21 (3d10 + 5) piercing damage, and the target is grappled (escape DC 16). Until this grapple ends, the target is restrained, and the crocodile can't bite another target.",attack_bonus:8,damage_dice:"3d10",damage_bonus:5},{name:"Tail",desc:"Melee Weapon Attack: +8 to hit, reach 10 ft., one target not grappled by the crocodile. Hit: 14 (2d8 + 5) bludgeoning damage. If the target is a creature, it must succeed on a DC 16 Strength saving throw or be knocked prone.",attack_bonus:8,damage_dice:"2d8",damage_bonus:5}]},{name:"Giant Eagle",size:"Large",type:"beast",subtype:"",alignment:"neutral good",ac:13,hp:26,hit_dice:"4d10 + 4",speed:"10 ft., fly 80 ft.",stats:[16,17,13,8,14,10],skillsaves:[{perception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 14",languages:"Giant Eagle, understands Common and Auran but can't speak",cr:"1",traits:[{name:"Keen Sight",desc:"The eagle has advantage on Wisdom (Perception) checks that rely on sight.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The eagle makes two attacks: one with its beak and one with its talons.",attack_bonus:0},{name:"Beak",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) piercing damage.",attack_bonus:5,damage_dice:"1d6",damage_bonus:3},{name:"Talons",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) slashing damage.",attack_bonus:5,damage_dice:"2d6",damage_bonus:3}]},{name:"Giant Elk",size:"Huge",type:"beast",subtype:"",alignment:"unaligned",ac:15,hp:42,hit_dice:"5d12 + 9",speed:"60 ft.",stats:[19,16,14,7,14,10],skillsaves:[{perception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 14",languages:"Giant Elk, understands Common, Elvish, and Sylvan but can't speak",cr:"2",traits:[{name:"Charge",desc:"If the elk moves at least 20 ft. straight toward a target and then hits it with a ram attack on the same turn, the target takes an extra 7 (2d6) damage. If the target is a creature, it must succeed on a DC 14 Strength saving throw or be knocked prone.",attack_bonus:0,damage_dice:"2d6"}],actions:[{name:"Ram",desc:"Melee Weapon Attack: +6 to hit, reach 10 ft., one target. Hit: 11 (2d6 + 4) bludgeoning damage.",attack_bonus:6,damage_dice:"2d6",damage_bonus:4},{name:"Hooves",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one prone creature. Hit: 22 (4d8 + 4) bludgeoning damage.",attack_bonus:6,damage_dice:"4d8",damage_bonus:4}]},{name:"Giant Fire Beetle",size:"Small",type:"beast",subtype:"",alignment:"unaligned",ac:13,hp:4,hit_dice:"1d6",speed:"30 ft.",stats:[8,10,12,1,7,3],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 30 ft., passive Perception 8",languages:"",cr:"0",traits:[{name:"Illumination",desc:"The beetle sheds bright light in a 10-foot radius and dim light for an additional 10 ft..",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +1 to hit, reach 5 ft., one target. Hit: 2 (1d6 \u2014 1) slashing damage.",attack_bonus:1,damage_dice:"1d6",damage_bonus:-1}]},{name:"Giant Frog",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:11,hp:18,hit_dice:"4d8",speed:"30 ft., swim 30 ft.",stats:[12,13,11,2,10,3],skillsaves:[{perception:2},{stealth:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 30 ft., passive Perception 12",languages:"",cr:"1/4",traits:[{name:"Amphibious",desc:"The frog can breathe air and water",attack_bonus:0},{name:"Standing Leap",desc:"The frog's long jump is up to 20 ft. and its high jump is up to 10 ft., with or without a running start.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 4 (1d6 + 1) piercing damage, and the target is grappled (escape DC 11). Until this grapple ends, the target is restrained, and the frog can't bite another target.",attack_bonus:3,damage_dice:"1d6",damage_bonus:1},{name:"Swallow",desc:"The frog makes one bite attack against a Small or smaller target it is grappling. If the attack hits, the target is swallowed, and the grapple ends. The swallowed target is blinded and restrained, it has total cover against attacks and other effects outside the frog, and it takes 5 (2d4) acid damage at the start of each of the frog's turns. The frog can have only one target swallowed at a time. If the frog dies, a swallowed creature is no longer restrained by it and can escape from the corpse using 5 ft. of movement, exiting prone.",attack_bonus:0}]},{name:"Giant Goat",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:11,hp:19,hit_dice:"3d10 + 2",speed:"40 ft.",stats:[17,11,12,3,12,6],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 11",languages:"",cr:"1/2",traits:[{name:"Charge",desc:"If the goat moves at least 20 ft. straight toward a target and then hits it with a ram attack on the same turn, the target takes an extra 5 (2d4) bludgeoning damage. If the target is a creature, it must succeed on a DC 13 Strength saving throw or be knocked prone.",attack_bonus:0,damage_dice:"2d4"},{name:"Sure-Footed",desc:"The goat has advantage on Strength and Dexterity saving throws made against effects that would knock it prone.",attack_bonus:0}],actions:[{name:"Ram",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 8 (2d4 + 3) bludgeoning damage.",attack_bonus:5,damage_dice:"2d4",damage_bonus:3}]},{name:"Giant Hyena",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:45,hit_dice:"6d10 + 12",speed:"50 ft.",stats:[16,14,14,2,12,7],skillsaves:[{perception:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"",cr:"1",traits:[{name:"Rampage",desc:"When the hyena reduces a creature to 0 hit points with a melee attack on its turn, the hyena can take a bonus action to move up to half its speed and make a bite attack.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) piercing damage.",attack_bonus:5,damage_dice:"1d6",damage_bonus:3}]},{name:"Giant Lizard",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:19,hit_dice:"3d10 + 2",speed:"30 ft., climb 30 ft.",stats:[15,12,13,2,10,5],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 30 ft., passive Perception 10",languages:"",cr:"1/4",traits:[{name:"Variant: Hold Breath",desc:"The lizard can hold its breath for 15 minutes. (A lizard that has this trait also has a swimming speed of 30 feet.)",attack_bonus:0},{name:"Variant: Spider Climb",desc:"The lizard can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 6 (1d8 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d8",damage_bonus:2}]},{name:"Giant Octopus",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:11,hp:52,hit_dice:"8d10 + 8",speed:"10 ft., swim 60 ft.",stats:[17,13,13,4,10,4],skillsaves:[{perception:4},{stealth:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 14",languages:"",cr:"1",traits:[{name:"Hold Breath",desc:"While out of water, the octopus can hold its breath for 1 hour.",attack_bonus:0},{name:"Underwater Camouflage",desc:"The octopus has advantage on Dexterity (Stealth) checks made while underwater.",attack_bonus:0},{name:"Water Breathing",desc:"The octopus can breathe only underwater.",attack_bonus:0}],actions:[{name:"Tentacles",desc:"Melee Weapon Attack: +5 to hit, reach 15 ft., one target. Hit: 10 (2d6 + 3) bludgeoning damage. If the target is a creature, it is grappled (escape DC 16). Until this grapple ends, the target is restrained, and the octopus can't use its tentacles on another target.",attack_bonus:5,damage_dice:"2d6",damage_bonus:3},{name:"Ink Cloud (Recharges after a Short or Long Rest)",desc:"A 20-foot-radius cloud of ink extends all around the octopus if it is underwater. The area is heavily obscured for 1 minute, although a significant current can disperse the ink. After releasing the ink, the octopus can use the Dash action as a bonus action.",attack_bonus:0}]},{name:"Giant Owl",size:"Large",type:"beast",subtype:"",alignment:"neutral",ac:12,hp:19,hit_dice:"3d10 + 2",speed:"5 ft., fly 60 ft.",stats:[13,15,12,8,13,10],skillsaves:[{perception:5},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 120 ft., passive Perception 15",languages:"Giant Owl, understands Common, Elvish, and Sylvan but can't speak",cr:"1/4",traits:[{name:"Flyby",desc:"The owl doesn't provoke opportunity attacks when it flies out of an enemy's reach.",attack_bonus:0},{name:"Keen Hearing and Sight",desc:"The owl has advantage on Wisdom (Perception) checks that rely on hearing or sight.",attack_bonus:0}],actions:[{name:"Talons",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 8 (2d6 + 1) slashing damage.",attack_bonus:3,damage_dice:"2d6",damage_bonus:1}]},{name:"Giant Poisonous Snake",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:14,hp:11,hit_dice:"2d8 + 2",speed:"30 ft., swim 30 ft.",stats:[10,18,13,2,10,3],skillsaves:[{perception:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 10 ft., passive Perception 12",languages:"",cr:"1/4",actions:[{name:"Bite",desc:"Melee Weapon Attack: +6 to hit, reach 10 ft., one target. Hit: 6 (1d4 + 4) piercing damage, and the target must make a DC 11 Constitution saving throw, taking 10 (3d6) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:6,damage_dice:"1d4",damage_bonus:4}]},{name:"Giant Rat",size:"Small",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:7,hit_dice:"2d6",speed:"30 ft.",stats:[7,15,11,2,10,4],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 10",languages:"",cr:"1/8",traits:[{name:"Keen Smell",desc:"The rat has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0},{name:"Pack Tactics",desc:"The rat has advantage on an attack roll against a creature if at least one of the rat's allies is within 5 ft. of the creature and the ally isn't incapacitated.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 4 (1d4 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d4",damage_bonus:2}]},{name:"Giant Rat (Diseased)",size:"Small",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:7,hit_dice:"2d6",speed:"30 ft.",stats:[7,15,11,2,10,4],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 10",languages:"",cr:"1/8",actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 3 (1d4 + 2) piercing damage. If the target is a creature, it must succeed on a DC 10 Constitution saving throw or contract a disease. Until the disease is cured, the target can't regain hit points except by magical means, and the target's hit point maximum decreases by 3 (1d6) every 24 hours. If the target's hit point maximum drops to 0 as a result of this disease, the target dies.",attack_bonus:4,damage_dice:"1d4",damage_bonus:2}]},{name:"Giant Scorpion",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:15,hp:52,hit_dice:"7d10 + 13",speed:"40 ft.",stats:[15,13,15,1,9,3],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 60 ft., passive Perception 9",languages:"",cr:"3",actions:[{name:"Claw",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 6 (1d8 + 2) bludgeoning damage, and the target is grappled (escape DC 12). The scorpion has two claws, each of which can grapple only one target.",attack_bonus:4,damage_dice:"1d8",damage_bonus:2},{name:"Multiattack",desc:"The scorpion makes three attacks: two with its claws and one with its sting.",attack_bonus:0},{name:"Sting",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 7 (1d10 + 2) piercing damage, and the target must make a DC 12 Constitution saving throw, taking 22 (4d10) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:4,damage_dice:"1d10",damage_bonus:2}]},{name:"Giant Sea Horse",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:13,hp:16,hit_dice:"3d10 + -1",speed:"0 ft., swim 40 ft.",stats:[12,15,11,2,12,5],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 11",languages:"",cr:"1/2",traits:[{name:"Charge",desc:"If the sea horse moves at least 20 ft. straight toward a target and then hits it with a ram attack on the same turn, the target takes an extra 7 (2d6) bludgeoning damage. If the target is a creature, it must succeed on a DC 11 Strength saving throw or be knocked prone.",attack_bonus:0,damage_dice:"2d6"},{name:"Water Breathing",desc:"The sea horse can breathe only underwater.",attack_bonus:0}],actions:[{name:"Ram",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 4 (1d6 + 1) bludgeoning damage.",attack_bonus:3,damage_dice:"1d6",damage_bonus:1}]},{name:"Giant Shark",size:"Huge",type:"beast",subtype:"",alignment:"unaligned",ac:13,hp:126,hit_dice:"11d12 + 54",speed:"swim 50 ft.",stats:[23,11,21,1,10,5],skillsaves:[{perception:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 60 ft., passive Perception 13",languages:"",cr:"5",traits:[{name:"Blood Frenzy",desc:"The shark has advantage on melee attack rolls against any creature that doesn't have all its hit points.",attack_bonus:0},{name:"Water Breathing",desc:"The shark can breathe only underwater.",attack_bonus:0}],actions:[{name:"Bite",desc:"Weapon Attack: +9 to hit, reach 5 ft., one target. Hit: 22 (3d10 + 6) piercing damage.",attack_bonus:9,damage_dice:"3d10",damage_bonus:6}]},{name:"Giant Spider",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:14,hp:26,hit_dice:"4d10 + 4",speed:"30 ft., climb 30 ft.",stats:[14,16,12,2,11,4],skillsaves:[{stealth:7}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 10 ft., darkvision 60 ft., passive Perception 10",languages:"",cr:"1",traits:[{name:"Spider Climb",desc:"The spider can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",attack_bonus:0},{name:"Web Sense",desc:"While in contact with a web, the spider knows the exact location of any other creature in contact with the same web.",attack_bonus:0},{name:"Web Walker",desc:"The spider ignores movement restrictions caused by webbing.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one creature. Hit: 7 (1d8 + 3) piercing damage, and the target must make a DC 11 Constitution saving throw, taking 9 (2d8) poison damage on a failed save, or half as much damage on a successful one. If the poison damage reduces the target to 0 hit points, the target is stable but poisoned for 1 hour, even after regaining hit points, and is paralyzed while poisoned in this way.",attack_bonus:5,damage_dice:"1d8",damage_bonus:3},{name:"Web (Recharge 5-6)",desc:"Ranged Weapon Attack: +5 to hit, range 30/60 ft., one creature. Hit: The target is restrained by webbing. As an action, the restrained target can make a DC 12 Strength check, bursting the webbing on a success. The webbing can also be attacked and destroyed (AC 10; hp 5; vulnerability to fire damage; immunity to bludgeoning, poison, and psychic damage).",attack_bonus:5}]},{name:"Giant Toad",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:11,hp:39,hit_dice:"6d10 + 6",speed:"20 ft., swim 40 ft.",stats:[15,13,13,2,10,3],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 30 ft., passive Perception 10",languages:"",cr:"1",traits:[{name:"Amphibious",desc:"The toad can breathe air and water",attack_bonus:0},{name:"Standing Leap",desc:"The toad's long jump is up to 20 ft. and its high jump is up to 10 ft., with or without a running start.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (1d10 + 2) piercing damage plus 5 (1d10) poison damage, and the target is grappled (escape DC 13). Until this grapple ends, the target is restrained, and the toad can't bite another target.",attack_bonus:4,damage_dice:"1d10",damage_bonus:2},{name:"Swallow",desc:"The toad makes one bite attack against a Medium or smaller target it is grappling. If the attack hits, the target is swallowed, and the grapple ends. The swallowed target is blinded and restrained, it has total cover against attacks and other effects outside the toad, and it takes 10 (3d6) acid damage at the start of each of the toad's turns. The toad can have only one target swallowed at a time.\\nIf the toad dies, a swallowed creature is no longer restrained by it and can escape from the corpse using 5 feet of movement, exiting prone.",attack_bonus:0}]},{name:"Giant Vulture",size:"Large",type:"beast",subtype:"",alignment:"neutral evil",ac:10,hp:22,hit_dice:"3d10 + 5",speed:"10 ft., fly 60 ft.",stats:[15,10,15,6,12,7],skillsaves:[{perception:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"understands Common but can't speak",cr:"1",traits:[{name:"Keen Sight and Smell",desc:"The vulture has advantage on Wisdom (Perception) checks that rely on sight or smell.",attack_bonus:0},{name:"Pack Tactics",desc:"The vulture has advantage on an attack roll against a creature if at least one of the vulture's allies is within 5 ft. of the creature and the ally isn't incapacitated.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The vulture makes two attacks: one with its beak and one with its talons.",attack_bonus:0},{name:"Beak",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (2d4 + 2) piercing damage.",attack_bonus:4,damage_dice:"2d4",damage_bonus:2},{name:"Talons",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 9 (2d6 + 2) slashing damage.",attack_bonus:4,damage_dice:"2d6",damage_bonus:2}]},{name:"Giant Wasp",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:13,hit_dice:"3d8 + -1",speed:"10 ft., fly 50 ft., swim 50 ft.",stats:[10,14,10,1,10,3],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"",cr:"1/2",actions:[{name:"Sting",desc:"Sting. Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 5 (1d6 + 2) piercing damage, and the target must make a DC 11 Constitution saving throw, taking 10 (3d6) poison damage on a failed save, or half as much damage on a successful one. If the poison damage reduces the target to 0 hit points, the target is stable but poisoned for 1 hour, even after regaining hit points, and is paralyzed while poisoned in this way.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2}]},{name:"Giant Weasel",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:13,hp:9,hit_dice:"2d8",speed:"40 ft.",stats:[11,16,10,4,12,5],skillsaves:[{perception:3},{stealth:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 13",languages:"",cr:"1/8",traits:[{name:"Keen Hearing and Smell",desc:"The weasel has advantage on Wisdom (Perception) checks that rely on hearing or smell.",attack_bonus:0}],actions:[{name:"Bite",desc:"Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 5 (1d4 + 3) piercing damage.",attack_bonus:5,damage_dice:"1d4",damage_bonus:3}]},{name:"Giant Wolf Spider",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:13,hp:11,hit_dice:"2d8 + 2",speed:"40 ft., climb 40 ft.",stats:[12,16,13,3,12,4],skillsaves:[{perception:3},{stealth:7}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 10 ft., darkvision 60 ft., passive Perception 13",languages:"",cr:"1/4",traits:[{name:"Spider Climb",desc:"The spider can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",attack_bonus:0},{name:"Web Sense",desc:"While in contact with a web, the spider knows the exact location of any other creature in contact with the same web.",attack_bonus:0},{name:"Web Walker",desc:"The spider ignores movement restrictions caused by webbing.",attack_bonus:0}],actions:[{name:"Bite",desc:"Weapon Attack: +3 to hit, reach 5 ft., one creature. Hit: 4 (1d6 + 1) piercing damage, and the target must make a DC 11 Constitution saving throw, taking 7 (2d6) poison damage on a failed save, or half as much damage on a successful one. If the poison damage reduces the target to 0 hit points, the target is stable but poisoned for 1 hour, even after regaining hit points, and is paralyzed while poisoned in this way.",attack_bonus:3,damage_dice:"1d6",damage_bonus:1}]},{name:"Gibbering Mouther",size:"Medium",type:"aberration",subtype:"",alignment:"neutral",ac:9,hp:67,hit_dice:"9d8 + 26",speed:"10 ft., swim 10 ft.",stats:[10,8,16,3,10,6],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"prone",senses:"darkvision 60 ft., passive Perception 10",languages:"",cr:"2",traits:[{name:"Aberrant Ground",desc:"The ground in a 10-foot radius around the mouther is doughlike difficult terrain. Each creature that starts its turn in that area must succeed on a DC 10 Strength saving throw or have its speed reduced to 0 until the start of its next turn.",attack_bonus:0},{name:"Gibbering",desc:"The mouther babbles incoherently while it can see any creature and isn't incapacitated. Each creature that starts its turn within 20 feet of the mouther and can hear the gibbering must succeed on a DC 10 Wisdom saving throw. On a failure, the creature can't take reactions until the start of its next turn and rolls a d8 to determine what it does during its turn. On a 1 to 4, the creature does nothing. On a 5 or 6, the creature takes no action or bonus action and uses all its movement to move in a randomly determined direction. On a 7 or 8, the creature makes a melee attack against a randomly determined creature within its reach or does nothing if it can't make such an attack.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The gibbering mouther makes one bite attack and, if it can, uses its Blinding Spittle.",attack_bonus:0},{name:"Bites",desc:"Melee Weapon Attack: +2 to hit, reach 5 ft., one creature. Hit: 17 (5d6) piercing damage. If the target is Medium or smaller, it must succeed on a DC 10 Strength saving throw or be knocked prone. If the target is killed by this damage, it is absorbed into the mouther.",attack_bonus:2,damage_dice:"5d6"},{name:"Blinding Spittle (Recharge 5-6)",desc:"The mouther spits a chemical glob at a point it can see within 15 feet of it. The glob explodes in a blinding flash of light on impact. Each creature within 5 feet of the flash must succeed on a DC 13 Dexterity saving throw or be blinded until the end of the mouther's next turn.",attack_bonus:0}]},{name:"Glabrezu",size:"Large",type:"fiend",subtype:"demon",alignment:"chaotic evil",ac:17,hp:157,hit_dice:"15d10 + 74",speed:"40 ft.",stats:[20,15,21,19,17,16],saves:[{strength:9},{constitution:9},{wisdom:7},{charisma:7}],damage_vulnerabilities:"",damage_resistances:"cold, fire, lightning; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"poison",condition_immunities:"poisoned",senses:"truesight 120 ft., passive Perception 13",languages:"Abyssal, telepathy 120 ft.",cr:"9",traits:[{name:"Innate Spellcasting",desc:"The glabrezu's spellcasting ability is Intelligence (spell save DC 16). The glabrezu can innately cast the following spells, requiring no material components:\\nAt will: darkness, detect magic, dispel magic\\n1/day each: confusion, fly, power word stun",attack_bonus:0},{name:"Magic Resistance",desc:"The glabrezu has advantage on saving throws against spells and other magical effects.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The glabrezu makes four attacks: two with its pincers and two with its fists. Alternatively, it makes two attacks with its pincers and casts one spell.",attack_bonus:0},{name:"Pincer",desc:"Melee Weapon Attack: +9 to hit, reach 10 ft., one target. Hit: 16 (2d10 + 5) bludgeoning damage. If the target is a Medium or smaller creature, it is grappled (escape DC 15). The glabrezu has two pincers, each of which can grapple only one target.",attack_bonus:9,damage_dice:"2d10",damage_bonus:5},{name:"Fist",desc:"Melee Weapon Attack: +9 to hit, reach 5 ft., one target. Hit: 7 (2d4 + 2) bludgeoning damage.",attack_bonus:9,damage_dice:"2d4",damage_bonus:2},{name:"Variant: Summon Demon (1/Day)",desc:"The demon chooses what to summon and attempts a magical summoning.\\nA glabrezu has a 30 percent chance of summoning 1d3 vrocks, 1d2 hezrous, or one glabrezu.\\nA summoned demon appears in an unoccupied space within 60 feet of its summoner, acts as an ally of its summoner, and can't summon other demons. It remains for 1 minute, until it or its summoner dies, or until its summoner dismisses it as an action.",attack_bonus:0}]},{name:"Gladiator",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any alignment",ac:16,hp:112,hit_dice:"15d8 + 44",speed:"30 ft.",stats:[18,15,16,10,12,15],saves:[{strength:7},{dexterity:5},{constitution:6}],skillsaves:[{intimidation:5},{athletics:10}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 11",languages:"any one language (usually Common)",cr:"5",traits:[{name:"Brave",desc:"The gladiator has advantage on saving throws against being frightened.",attack_bonus:0},{name:"Brute",desc:"A melee weapon deals one extra die of its damage when the gladiator hits with it (included in the attack).",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The gladiator makes three melee attacks or two ranged attacks.",attack_bonus:0},{name:"Spear",desc:"Melee or Ranged Weapon Attack: +7 to hit, reach 5 ft. and range 20/60 ft., one target. Hit: 11 (2d6 + 4) piercing damage, or 13 (2d8 + 4) piercing damage if used with two hands to make a melee attack.",attack_bonus:7,damage_dice:"2d6",damage_bonus:4},{name:"Shield Bash",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one creature. Hit: 9 (2d4 + 4) bludgeoning damage. If the target is a Medium or smaller creature, it must succeed on a DC 15 Strength saving throw or be knocked prone.",attack_bonus:7,damage_dice:"2d4",damage_bonus:4}],reactions:[{name:"Parry",desc:"The gladiator adds 3 to its AC against one melee attack that would hit it. To do so, the gladiator must see the attacker and be wielding a melee weapon.",attack_bonus:0}]},{name:"Gnoll",size:"Medium",type:"humanoid",subtype:"gnoll",alignment:"chaotic evil",ac:15,hp:22,hit_dice:"5d8 + -1",speed:"30 ft.",stats:[14,12,11,6,10,7],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 10",languages:"Gnoll",cr:"1/2",traits:[{name:"Rampage",desc:"When the gnoll reduces a creature to 0 hit points with a melee attack on its turn, the gnoll can take a bonus action to move up to half its speed and make a bite attack.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 4 (1d4 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d4",damage_bonus:2},{name:"Spear",desc:"Melee or Ranged Weapon Attack: +4 to hit, reach 5 ft. or range 20/60 ft., one target. Hit: 5 (1d6 + 2) piercing damage, or 6 (1d8 + 2) piercing damage if used with two hands to make a melee attack.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2},{name:"Longbow",desc:"Ranged Weapon Attack: +3 to hit, range 150/600 ft., one target. Hit: 5 (1d8 + 1) piercing damage.",attack_bonus:3,damage_dice:"1d8",damage_bonus:1}]},{name:"Goat",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:10,hp:4,hit_dice:"1d8 + -1",speed:"40 ft.",stats:[12,10,11,2,10,5],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"",cr:"0",traits:[{name:"Charge",desc:"If the goat moves at least 20 ft. straight toward a target and then hits it with a ram attack on the same turn, the target takes an extra 2 (1d4) bludgeoning damage. If the target is a creature, it must succeed on a DC 10 Strength saving throw or be knocked prone.",attack_bonus:0,damage_dice:"1d4"},{name:"Sure-Footed",desc:"The goat has advantage on Strength and Dexterity saving throws made against effects that would knock it prone.",attack_bonus:0}],actions:[{name:"Ram",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 3 (1d4 + 1) bludgeoning damage.",attack_bonus:3,damage_dice:"1d4",damage_bonus:1}]},{name:"Goblin",size:"Small",type:"humanoid",subtype:"goblinoid",alignment:"neutral evil",ac:15,hp:7,hit_dice:"2d6",speed:"30 ft.",stats:[8,14,10,10,8,8],skillsaves:[{stealth:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 9",languages:"Common, Goblin",cr:"1/4",traits:[{name:"Nimble Escape",desc:"The goblin can take the Disengage or Hide action as a bonus action on each of its turns.",attack_bonus:0}],actions:[{name:"Scimitar",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) slashing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2},{name:"Shortbow",desc:"Ranged Weapon Attack: +4 to hit, range 80/320 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2}]},{name:"Gold Dragon Wyrmling",size:"Medium",type:"dragon",subtype:"",alignment:"lawful good",ac:17,hp:60,hit_dice:"8d8 + 24",speed:"30 ft., fly 60 ft., swim 30 ft.",stats:[19,14,17,14,11,16],saves:[{dexterity:4},{constitution:5},{wisdom:2},{charisma:5}],skillsaves:[{perception:4},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire",condition_immunities:"",senses:"blindsight 10 ft., darkvision 60 ft., passive Perception 14",languages:"Draconic",cr:"3",traits:[{name:"Amphibious",desc:"The dragon can breathe air and water.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 9 (1d10 + 4) piercing damage.",attack_bonus:6,damage_dice:"1d10",damage_bonus:4},{name:"Breath Weapons (Recharge 5-6)",desc:"The dragon uses one of the following breath weapons.\\nFire Breath. The dragon exhales fire in a 15-foot cone. Each creature in that area must make a DC 13 Dexterity saving throw, taking 22 (4d10) fire damage on a failed save, or half as much damage on a successful one.\\nWeakening Breath. The dragon exhales gas in a 15-foot cone. Each creature in that area must succeed on a DC 13 Strength saving throw or have disadvantage on Strength-based attack rolls, Strength checks, and Strength saving throws for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",attack_bonus:0,damage_dice:"4d10"}]},{name:"Gorgon",size:"Large",type:"monstrosity",subtype:"",alignment:"unaligned",ac:19,hp:114,hit_dice:"12d10 + 48",speed:"40 ft.",stats:[20,11,18,2,12,7],skillsaves:[{perception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"petrified",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 14",languages:"",cr:"5",traits:[{name:"Trampling Charge",desc:"If the gorgon moves at least 20 feet straight toward a creature and then hits it with a gore attack on the same turn, that target must succeed on a DC 16 Strength saving throw or be knocked prone. If the target is prone, the gorgon can make one attack with its hooves against it as a bonus action.",attack_bonus:0}],actions:[{name:"Gore",desc:"Melee Weapon Attack: +8 to hit, reach 5 ft., one target. Hit: 18 (2d12 + 5) piercing damage.",attack_bonus:8,damage_dice:"2d12",damage_bonus:5},{name:"Hooves",desc:"Melee Weapon Attack: +8 to hit, reach 5 ft., one target. Hit: 16 (2d10 + 5) bludgeoning damage.",attack_bonus:8,damage_dice:"2d10",damage_bonus:5},{name:"Petrifying Breath (Recharge 5-6)",desc:"The gorgon exhales petrifying gas in a 30-foot cone. Each creature in that area must succeed on a DC 13 Constitution saving throw. On a failed save, a target begins to turn to stone and is restrained. The restrained target must repeat the saving throw at the end of its next turn. On a success, the effect ends on the target. On a failure, the target is petrified until freed by the greater restoration spell or other magic.",attack_bonus:0}]},{name:"Gray Ooze",size:"Medium",type:"ooze",subtype:"",alignment:"unaligned",ac:8,hp:22,hit_dice:"3d8 + 8",speed:"10 ft., climb 10 ft.",stats:[12,6,16,1,6,2],skillsaves:[{stealth:2}],damage_vulnerabilities:"",damage_resistances:"acid, cold, fire",damage_immunities:"",condition_immunities:"blinded, charmed, deafened, exhaustion, frightened, prone",senses:"blindsight 60 ft. (blind beyond this radius), passive Perception 8",languages:"",cr:"1/2",traits:[{name:"Amorphous",desc:"The ooze can move through a space as narrow as 1 inch wide without squeezing.",attack_bonus:0},{name:"Corrode Metal",desc:"Any nonmagical weapon made of metal that hits the ooze corrodes. After dealing damage, the weapon takes a permanent and cumulative -1 penalty to damage rolls. If its penalty drops to -5, the weapon is destroyed. Nonmagical ammunition made of metal that hits the ooze is destroyed after dealing damage.\\nThe ooze can eat through 2-inch-thick, nonmagical metal in 1 round.",attack_bonus:0},{name:"False Appearance",desc:"While the ooze remains motionless, it is indistinguishable from an oily pool or wet rock.",attack_bonus:0}],actions:[{name:"Pseudopod",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 4 (1d6 + 1) bludgeoning damage plus 7 (2d6) acid damage, and if the target is wearing nonmagical metal armor, its armor is partly corroded and takes a permanent and cumulative -1 penalty to the AC it offers. The armor is destroyed if the penalty reduces its AC to 10.",attack_bonus:3,damage_dice:"1d6",damage_bonus:1}]},{name:"Green Dragon Wyrmling",size:"Medium",type:"dragon",subtype:"",alignment:"lawful evil",ac:17,hp:38,hit_dice:"7d8 + 6",speed:"30 ft., fly 60 ft., swim 30 ft.",stats:[15,12,13,14,11,13],saves:[{dexterity:3},{constitution:3},{wisdom:2},{charisma:3}],skillsaves:[{perception:4},{stealth:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"poison",condition_immunities:"poisoned",senses:"blindsight 10 ft., darkvision 60 ft., passive Perception 14",languages:"Draconic",cr:"2",traits:[{name:"Amphibious",desc:"The dragon can breathe air and water.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (1d10 + 2) piercing damage plus 3 (1d6) poison damage.",attack_bonus:4,damage_dice:"1d10 + 1d6",damage_bonus:3},{name:"Poison Breath (Recharge 5-6)",desc:"The dragon exhales poisonous gas in a 15-foot cone. Each creature in that area must make a DC 11 Constitution saving throw, taking 21 (6d6) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"6d6"}]},{name:"Green Hag",size:"Medium",type:"fey",subtype:"",alignment:"neutral evil",ac:17,hp:82,hit_dice:"11d8 + 32",speed:"30 ft.",stats:[18,12,16,13,14,14],skillsaves:[{arcana:3},{deception:4},{perception:4},{stealth:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 14",languages:"Common, Draconic, Sylvan",cr:"3",traits:[{name:"Amphibious",desc:"The hag can breathe air and water.",attack_bonus:0},{name:"Innate Spellcasting",desc:"The hag's innate spellcasting ability is Charisma (spell save DC 12). She can innately cast the following spells, requiring no material components:\\n\\nAt will: dancing lights, minor illusion, vicious mockery",attack_bonus:0},{name:"Mimicry",desc:"The hag can mimic animal sounds and humanoid voices. A creature that hears the sounds can tell they are imitations with a successful DC 14 Wisdom (Insight) check.",attack_bonus:0},{name:"Hag Coven",desc:"When hags must work together, they form covens, in spite of their selfish natures. A coven is made up of hags of any type, all of whom are equals within the group. However, each of the hags continues to desire more personal power.\\nA coven consists of three hags so that any arguments between two hags can be settled by the third. If more than three hags ever come together, as might happen if two covens come into conflict, the result is usually chaos.",attack_bonus:0},{name:"Shared Spellcasting (Coven Only)",desc:"While all three members of a hag coven are within 30 feet of one another, they can each cast the following spells from the wizard's spell list but must share the spell slots among themselves:\\n\\n\u2022 1st level (4 slots): identify, ray of sickness\\n\u2022 2nd level (3 slots): hold person, locate object\\n\u2022 3rd level (3 slots): bestow curse, counterspell, lightning bolt\\n\u2022 4th level (3 slots): phantasmal killer, polymorph\\n\u2022 5th level (2 slots): contact other plane, scrying\\n\u2022 6th level (1 slot): eye bite\\n\\nFor casting these spells, each hag is a 12th-level spellcaster that uses Intelligence as her spellcasting ability. The spell save DC is 12+the hag's Intelligence modifier, and the spell attack bonus is 4+the hag's Intelligence modifier.",attack_bonus:0},{name:"Hag Eye (Coven Only)",desc:"A hag coven can craft a magic item called a hag eye, which is made from a real eye coated in varnish and often fitted to a pendant or other wearable item. The hag eye is usually entrusted to a minion for safekeeping and transport. A hag in the coven can take an action to see what the hag eye sees if the hag eye is on the same plane of existence. A hag eye has AC 10, 1 hit point, and darkvision with a radius of 60 feet. If it is destroyed, each coven member takes 3d10 psychic damage and is blinded for 24 hours.\\nA hag coven can have only one hag eye at a time, and creating a new one requires all three members of the coven to perform a ritual. The ritual takes 1 hour, and the hags can't perform it while blinded. During the ritual, if the hags take any action other than performing the ritual, they must start over.",attack_bonus:0}],actions:[{name:"Claws",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) slashing damage.",attack_bonus:6,damage_dice:"2d8",damage_bonus:4},{name:"Illusory Appearance",desc:"The hag covers herself and anything she is wearing or carrying with a magical illusion that makes her look like another creature of her general size and humanoid shape. The illusion ends if the hag takes a bonus action to end it or if she dies.\\nThe changes wrought by this effect fail to hold up to physical inspection. For example, the hag could appear to have smooth skin, but someone touching her would feel her rough flesh. Otherwise, a creature must take an action to visually inspect the illusion and succeed on a DC 20 Intelligence (Investigation) check to discern that the hag is disguised.",attack_bonus:0},{name:"Invisible Passage",desc:"The hag magically turns invisible until she attacks or casts a spell, or until her concentration ends (as if concentrating on a spell). While invisible, she leaves no physical evidence of her passage, so she can be tracked only by magic. Any equipment she wears or carries is invisible with her.",attack_bonus:0}]},{name:"Grick",size:"Medium",type:"monstrosity",subtype:"",alignment:"neutral",ac:14,hp:27,hit_dice:"6d8",speed:"30 ft., climb 30 ft.",stats:[14,14,11,3,14,5],damage_vulnerabilities:"",damage_resistances:"bludgeoning, piercing, and slashing damage from nonmagical weapons",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 12",languages:"",cr:"2",traits:[{name:"Stone Camouflage",desc:"The grick has advantage on Dexterity (Stealth) checks made to hide in rocky terrain.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The grick makes one attack with its tentacles. If that attack hits, the grick can make one beak attack against the same target.",attack_bonus:0},{name:"Tentacles",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 9 (2d6 + 2) slashing damage.",attack_bonus:4,damage_dice:"2d6",damage_bonus:2},{name:"Beak",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2}]},{name:"Griffon",size:"Large",type:"monstrosity",subtype:"",alignment:"unaligned",ac:12,hp:59,hit_dice:"7d10 + 20",speed:"30 ft., fly 80 ft.",stats:[18,15,16,2,13,8],skillsaves:[{perception:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 15",languages:"",cr:"2",traits:[{name:"Keen Sight",desc:"The griffon has advantage on Wisdom (Perception) checks that rely on sight.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The griffon makes two attacks: one with its beak and one with its claws.",attack_bonus:0},{name:"Beak",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 8 (1d8 + 4) piercing damage.",attack_bonus:6,damage_dice:"1d8",damage_bonus:4},{name:"Claws",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) slashing damage.",attack_bonus:6,damage_dice:"2d6",damage_bonus:4}]},{name:"Grimlock",size:"Medium",type:"humanoid",subtype:"grimlock",alignment:"neutral evil",ac:11,hp:11,hit_dice:"2d8 + 2",speed:"30 ft.",stats:[16,12,12,9,8,6],skillsaves:[{athletics:5},{perception:3},{stealth:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"blinded",condition_immunities:"",senses:"blindsight 30 ft. or 10 ft. while deafened (blind beyond this radius), passive Perception 13",languages:"Undercommon",cr:"1/4",traits:[{name:"Blind Senses",desc:"The grimlock can't use its blindsight while deafened and unable to smell.",attack_bonus:0},{name:"Keen Hearing and Smell",desc:"The grimlock has advantage on Wisdom (Perception) checks that rely on hearing or smell.",attack_bonus:0},{name:"Stone Camouflage",desc:"The grimlock has advantage on Dexterity (Stealth) checks made to hide in rocky terrain.",attack_bonus:0}],actions:[{name:"Spiked Bone Club",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 5 (1d4 + 3) bludgeoning damage plus 2 (1d4) piercing damage.",attack_bonus:5,damage_dice:"1d4 + 1d4",damage_bonus:5}]},{name:"Guard",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any alignment",ac:16,hp:11,hit_dice:"2d8 + 2",speed:"30 ft.",stats:[13,12,12,10,11,10],skillsaves:[{perception:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 12",languages:"any one language (usually Common)",cr:"1/8",actions:[{name:"Spear",desc:"Melee or Ranged Weapon Attack: +3 to hit, reach 5 ft. or range 20/60 ft., one target. Hit: 4 (1d6 + 1) piercing damage or 5 (1d8 + 1) piercing damage if used with two hands to make a melee attack.",attack_bonus:3,damage_dice:"1d6",damage_bonus:1}]},{name:"Guardian Naga",size:"Large",type:"monstrosity",subtype:"",alignment:"lawful good",ac:18,hp:127,hit_dice:"15d10 + 44",speed:"40 ft.",stats:[19,18,16,16,19,18],saves:[{dexterity:8},{constitution:7},{intelligence:7},{wisdom:8},{charisma:8}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"poison",condition_immunities:"charmed, poisoned",senses:"darkvision 60 ft., passive Perception 14",languages:"Celestial, Common",cr:"10",traits:[{name:"Rejuvenation",desc:"If it dies, the naga returns to life in 1d6 days and regains all its hit points. Only a wish spell can prevent this trait from functioning.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +8 to hit, reach 10 ft., one creature. Hit: 8 (1d8 + 4) piercing damage, and the target must make a DC 15 Constitution saving throw, taking 45 (10d8) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:8,damage_dice:"1d8",damage_bonus:4},{name:"Spit Poison",desc:"Ranged Weapon Attack: +8 to hit, range 15/30 ft., one creature. Hit: The target must make a DC 15 Constitution saving throw, taking 45 (10d8) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:8,damage_dice:"10d8"}],spells:["The naga is an 11th-level spellcaster. Its spellcasting ability is Wisdom (spell save DC 16, +8 to hit with spell attacks), and it needs only verbal components to cast its spells. It has the following cleric spells prepared:",{"Cantrips (at will)":"mending, sacred flame, thaumaturgy"},{"1st level (4 slots)":"command, cure wounds, shield of faith"},{"2nd level (3 slots)":"calm emotions, hold person"},{"3rd level (3 slots)":"bestow curse, clairvoyance"},{"4th level (3 slots)":"banishment, freedom of movement"},{"5th level (2 slots)":"flame strike, geas"},{"6th level (1 slot)":"true seeing"}]},{name:"Gynosphinx",size:"Large",type:"monstrosity",subtype:"",alignment:"lawful neutral",ac:17,hp:136,hit_dice:"16d10 + 48",speed:"40 ft., fly 60 ft.",stats:[18,15,16,18,18,18],skillsaves:[{arcana:12},{history:12},{perception:8},{religion:8}],damage_vulnerabilities:"",damage_resistances:"bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"psychic",condition_immunities:"charmed, frightened",senses:"truesight 120 ft., passive Perception 18",languages:"Common, Sphinx",cr:"11",traits:[{name:"Inscrutable",desc:"The sphinx is immune to any effect that would sense its emotions or read its thoughts, as well as any divination spell that it refuses. Wisdom (Insight) checks made to ascertain the sphinx's intentions or sincerity have disadvantage.",attack_bonus:0},{name:"Magic Weapons",desc:"The sphinx's weapon attacks are magical.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The sphinx makes two claw attacks.",attack_bonus:0},{name:"Claw",desc:"Melee Weapon Attack: +9 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) slashing damage.",attack_bonus:9,damage_dice:"2d8",damage_bonus:4}],legendary_actions:[{name:"Claw Attack",desc:"The sphinx makes one claw attack.",attack_bonus:0},{name:"Teleport (Costs 2 Actions)",desc:"The sphinx magically teleports, along with any equipment it is wearing or carrying, up to 120 feet to an unoccupied space it can see.",attack_bonus:0},{name:"Cast a Spell (Costs 3 Actions)",desc:"The sphinx casts a spell from its list of prepared spells, using a spell slot as normal.",attack_bonus:0}],spells:["The sphinx is a 9th-level spellcaster. Its spellcasting ability is Intelligence (spell save DC 16, +8 to hit with spell attacks). It requires no material components to cast its spells. The sphinx has the following wizard spells prepared:",{"Cantrips (at will)":"mage hand, minor illusion, prestidigitation"},{"1st level (4 slots)":"detect magic, identify, shield"},{"2nd level (3 slots)":"darkness, locate object, suggestion"},{"3rd level (3 slots)":"dispel magic, remove curse, tongues"},{"4th level (3 slots)":"banishment, greater invisibility"},{"5th level (1 slot)":"legend lore"}]},{name:"Half-Red Dragon Veteran",size:"Medium",type:"humanoid",subtype:"human",alignment:"any alignment",ac:18,hp:65,hit_dice:"10d8 + 20",speed:"30 ft.",stats:[16,13,14,10,11,10],damage_vulnerabilities:"",damage_resistances:"fire",damage_immunities:"",condition_immunities:"",senses:"blindsight 10 ft., darkvision 60 ft., passive Perception 12",languages:"Common, Draconic",cr:"5",actions:[{name:"Multiattack",desc:"The veteran makes two longsword attacks. If it has a shortsword drawn, it can also make a shortsword attack.",attack_bonus:0},{name:"Longsword",desc:"Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 7 (1d8 + 3) slashing damage, or 8 (1d10 + 3) slashing damage if used with two hands.",attack_bonus:5,damage_dice:"1d8",damage_bonus:3},{name:"Shortsword",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) piercing damage.",attack_bonus:5,damage_dice:"1d6",damage_bonus:3},{name:"Heavy Crossbow",desc:"Ranged Weapon Attack: +3 to hit, range 100/400 ft., one target. Hit: 6 (1d10 + 1) piercing damage.",attack_bonus:3,damage_dice:"1d10",damage_bonus:1},{name:"Fire Breath (Recharge 5-6)",desc:"The veteran exhales fire in a 15-foot cone. Each creature in that area must make a DC 15 Dexterity saving throw, taking 24 (7d6) fire damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"7d6"}]},{name:"Harpy",size:"Medium",type:"monstrosity",subtype:"",alignment:"chaotic evil",ac:11,hp:38,hit_dice:"7d8 + 6",speed:"20 ft., fly 40 ft.",stats:[12,13,12,7,10,13],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"Common",cr:"1",actions:[{name:"Multiattack",desc:"The harpy makes two attacks: one with its claws and one with its club.",attack_bonus:0},{name:"Claws",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 6 (2d4 + 1) slashing damage.",attack_bonus:3,damage_dice:"2d4",damage_bonus:1},{name:"Club",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 3 (1d4 + 1) bludgeoning damage.",attack_bonus:3,damage_dice:"1d4",damage_bonus:1},{name:"Luring Song",desc:"The harpy sings a magical melody. Every humanoid and giant within 300 ft. of the harpy that can hear the song must succeed on a DC 11 Wisdom saving throw or be charmed until the song ends. The harpy must take a bonus action on its subsequent turns to continue singing. It can stop singing at any time. The song ends if the harpy is incapacitated.\\nWhile charmed by the harpy, a target is incapacitated and ignores the songs of other harpies. If the charmed target is more than 5 ft. away from the harpy, the must move on its turn toward the harpy by the most direct route. It doesn't avoid opportunity attacks, but before moving into damaging terrain, such as lava or a pit, and whenever it takes damage from a source other than the harpy, a target can repeat the saving throw. A creature can also repeat the saving throw at the end of each of its turns. If a creature's saving throw is successful, the effect ends on it.\\nA target that successfully saves is immune to this harpy's song for the next 24 hours.",attack_bonus:0}]},{name:"Hawk",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:13,hp:1,hit_dice:"1d4 + -2",speed:"10 ft., fly 60 ft.",stats:[5,16,8,2,14,6],skillsaves:[{perception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 14",languages:"",cr:"0",traits:[{name:"Keen Sight",desc:"The hawk has advantage on Wisdom (Perception) checks that rely on sight.",attack_bonus:0}],actions:[{name:"Talons",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 1 slashing damage.",attack_bonus:5,damage_bonus:1}]},{name:"Hell Hound",size:"Medium",type:"fiend",subtype:"",alignment:"lawful evil",ac:15,hp:45,hit_dice:"7d8 + 13",speed:"50 ft.",stats:[17,12,14,6,13,6],skillsaves:[{perception:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 15",languages:"understands Infernal but can't speak it",cr:"3",traits:[{name:"Keen Hearing and Smell",desc:"The hound has advantage on Wisdom (Perception) checks that rely on hearing or smell.",attack_bonus:0},{name:"Pack Tactics",desc:"The hound has advantage on an attack roll against a creature if at least one of the hound's allies is within 5 ft. of the creature and the ally isn't incapacitated.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 7 (1d8 + 3) piercing damage plus 7 (2d6) fire damage.",attack_bonus:5,damage_dice:"1d8",damage_bonus:3},{name:"Fire Breath (Recharge 5-6)",desc:"The hound exhales fire in a 15-foot cone. Each creature in that area must make a DC 12 Dexterity saving throw, taking 21 (6d6) fire damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"6d6"}]},{name:"Hezrou",size:"Large",type:"fiend",subtype:"demon",alignment:"chaotic evil",ac:16,hp:136,hit_dice:"13d10 + 64",speed:"30 ft.",stats:[19,17,20,5,12,13],saves:[{strength:7},{constitution:8},{wisdom:4}],damage_vulnerabilities:"",damage_resistances:"cold, fire, lightning; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"poison",condition_immunities:"poisoned",senses:"darkvision 120 ft., passive Perception 11",languages:"Abyssal, telepathy 120 ft.",cr:"8",traits:[{name:"Magic Resistance",desc:"The hezrou has advantage on saving throws against spells and other magical effects.",attack_bonus:0},{name:"Stench",desc:"Any creature that starts its turn within 10 feet of the hezrou must succeed on a DC 14 Constitution saving throw or be poisoned until the start of its next turn. On a successful saving throw, the creature is immune to the hezrou's stench for 24 hours.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The hezrou makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 15 (2d10 + 4) piercing damage.",attack_bonus:7,damage_dice:"2d10",damage_bonus:4},{name:"Claws",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) slashing damage.",attack_bonus:7,damage_dice:"2d6",damage_bonus:4},{name:"Variant: Summon Demon (1/Day)",desc:"The demon chooses what to summon and attempts a magical summoning.\\nA hezrou has a 30 percent chance of summoning 2d6 dretches or one hezrou.\\nA summoned demon appears in an unoccupied space within 60 feet of its summoner, acts as an ally of its summoner, and can't summon other demons. It remains for 1 minute, until it or its summoner dies, or until its summoner dismisses it as an action.",attack_bonus:0}]},{name:"Hill Giant",size:"Huge",type:"giant",subtype:"",alignment:"chaotic evil",ac:13,hp:105,hit_dice:"10d12 + 40",speed:"40 ft.",stats:[21,8,19,5,9,6],skillsaves:[{perception:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 12",languages:"Giant",cr:"5",actions:[{name:"Multiattack",desc:"The giant makes two greatclub attacks.",attack_bonus:0},{name:"Greatclub",desc:"Melee Weapon Attack: +8 to hit, reach 10 ft., one target. Hit: 18 (3d8 + 5) bludgeoning damage.",attack_bonus:8,damage_dice:"3d8",damage_bonus:5},{name:"Rock",desc:"Ranged Weapon Attack: +8 to hit, range 60/240 ft., one target. Hit: 21 (3d10 + 5) bludgeoning damage.",attack_bonus:8,damage_dice:"3d10",damage_bonus:5}]},{name:"Hippogriff",size:"Large",type:"monstrosity",subtype:"",alignment:"unaligned",ac:11,hp:19,hit_dice:"3d10 + 2",speed:"40 ft, fly 60 ft.",stats:[17,13,13,2,12,8],skillsaves:[{perception:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 15",languages:"",cr:"1",traits:[{name:"Keen Sight",desc:"The hippogriff has advantage on Wisdom (Perception) checks that rely on sight.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The hippogriff makes two attacks: one with its beak and one with its claws.",attack_bonus:0},{name:"Beak",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 8 (1d10 + 3) piercing damage.",attack_bonus:5,damage_dice:"1d10",damage_bonus:3},{name:"Claws",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) slashing damage.",attack_bonus:5,damage_dice:"2d6",damage_bonus:3}]},{name:"Hobgoblin",size:"Medium",type:"humanoid",subtype:"goblinoid",alignment:"lawful evil",ac:18,hp:11,hit_dice:"2d8 + 2",speed:"30 ft.",stats:[13,12,12,10,10,9],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 10",languages:"Common, Goblin",cr:"1/2",traits:[{name:"Martial Advantage",desc:"Once per turn, the hobgoblin can deal an extra 7 (2d6) damage to a creature it hits with a weapon attack if that creature is within 5 ft. of an ally of the hobgoblin that isn't incapacitated.",attack_bonus:0,damage_dice:"2d6"}],actions:[{name:"Longsword",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 5 (1d8 + 1) slashing damage, or 6 (1d10 + 1) slashing damage if used with two hands.",attack_bonus:3,damage_dice:"1d8",damage_bonus:1},{name:"Longbow",desc:"Ranged Weapon Attack: +3 to hit, range 150/600 ft., one target. Hit: 5 (1d8 + 1) piercing damage.",attack_bonus:3,damage_dice:"1d8",damage_bonus:1}]},{name:"Homunculus",size:"Tiny",type:"construct",subtype:"",alignment:"neutral",ac:13,hp:5,hit_dice:"2d4",speed:"20 ft., fly 40 ft.",stats:[4,15,11,10,10,7],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"poison",condition_immunities:"charmed, poisoned",senses:"darkvision 60 ft., passive Perception 10",languages:"understands the languages of its creator but can't speak",cr:"0",traits:[{name:"Telepathic Bond",desc:"While the homunculus is on the same plane of existence as its master, it can magically convey what it senses to its master, and the two can communicate telepathically.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 1 piercing damage, and the target must succeed on a DC 10 Constitution saving throw or be poisoned for 1 minute. If the saving throw fails by 5 or more, the target is instead poisoned for 5 (1d10) minutes and unconscious while poisoned in this way.",attack_bonus:4,damage_bonus:1}]},{name:"Horned Devil",size:"Large",type:"fiend",subtype:"devil",alignment:"lawful evil",ac:18,hp:148,hit_dice:"17d10 + 54",speed:"20 ft., fly 60 ft.",stats:[22,17,21,12,16,17],saves:[{strength:10},{dexterity:7},{wisdom:7},{charisma:7}],damage_vulnerabilities:"",damage_resistances:"cold; bludgeoning, piercing, and slashing from nonmagical weapons that aren't silvered",damage_immunities:"fire, poison",condition_immunities:"poisoned",senses:"darkvision 120 ft., passive Perception 13",languages:"Infernal, telepathy 120 ft.",cr:"11",traits:[{name:"Devil's Sight",desc:"Magical darkness doesn't impede the devil's darkvision.",attack_bonus:0},{name:"Magic Resistance",desc:"The devil has advantage on saving throws against spells and other magical effects.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The devil makes three melee attacks: two with its fork and one with its tail. It can use Hurl Flame in place of any melee attack.",attack_bonus:0},{name:"Fork",desc:"Melee Weapon Attack: +10 to hit, reach 10 ft., one target. Hit: 15 (2d8 + 6) piercing damage.",attack_bonus:10,damage_dice:"2d8",damage_bonus:6},{name:"Tail",desc:"Melee Weapon Attack: +10 to hit, reach 10 ft., one target. Hit: 10 (1d8 + 6) piercing damage. If the target is a creature other than an undead or a construct, it must succeed on a DC 17 Constitution saving throw or lose 10 (3d6) hit points at the start of each of its turns due to an infernal wound. Each time the devil hits the wounded target with this attack, the damage dealt by the wound increases by 10 (3d6). Any creature can take an action to stanch the wound with a successful DC 12 Wisdom (Medicine) check. The wound also closes if the target receives magical healing.",attack_bonus:10,damage_dice:"1d8",damage_bonus:6},{name:"Hurl Flame",desc:"Ranged Spell Attack: +7 to hit, range 150 ft., one target. Hit: 14 (4d6) fire damage. If the target is a flammable object that isn't being worn or carried, it also catches fire.",attack_bonus:7,damage_dice:"4d6"}]},{name:"Hunter Shark",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:45,hit_dice:"6d10 + 12",speed:"swim 40 ft.",stats:[18,13,15,1,10,4],skillsaves:[{perception:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 30 ft., passive Perception 12",languages:"",cr:"2",traits:[{name:"Blood Frenzy",desc:"The shark has advantage on melee attack rolls against any creature that doesn't have all its hit points.",attack_bonus:0},{name:"Water Breathing",desc:"The shark can breathe only underwater.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) piercing damage.",attack_bonus:6,damage_dice:"2d8",damage_bonus:4}]},{name:"Hydra",size:"Huge",type:"monstrosity",subtype:"",alignment:"unaligned",ac:15,hp:172,hit_dice:"15d12 + 74",speed:"30 ft., swim 30 ft.",stats:[20,12,20,2,10,7],skillsaves:[{perception:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 16",languages:"",cr:"8",traits:[{name:"Hold Breath",desc:"The hydra can hold its breath for 1 hour.",attack_bonus:0},{name:"Multiple Heads",desc:"The hydra has five heads. While it has more than one head, the hydra has advantage on saving throws against being blinded, charmed, deafened, frightened, stunned, and knocked unconscious.\\nWhenever the hydra takes 25 or more damage in a single turn, one of its heads dies. If all its heads die, the hydra dies.\\nAt the end of its turn, it grows two heads for each of its heads that died since its last turn, unless it has taken fire damage since its last turn. The hydra regains 10 hit points for each head regrown in this way.",attack_bonus:0},{name:"Reactive Heads",desc:"For each head the hydra has beyond one, it gets an extra reaction that can be used only for opportunity attacks.",attack_bonus:0},{name:"Wakeful",desc:"While the hydra sleeps, at least one of its heads is awake.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The hydra makes as many bite attacks as it has heads.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +8 to hit, reach 10 ft., one target. Hit: 10 (1d10 + 5) piercing damage.",attack_bonus:8,damage_dice:"1d10",damage_bonus:5}]},{name:"Hyena",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:11,hp:5,hit_dice:"1d8",speed:"50 ft.",stats:[11,13,12,2,12,5],skillsaves:[{perception:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"",cr:"0",traits:[{name:"Pack Tactics",desc:"The hyena has advantage on an attack roll against a creature if at least one of the hyena's allies is within 5 ft. of the creature and the ally isn't incapacitated.",attack_bonus:0}],actions:[{name:"Bite",desc:"Weapon Attack: +2 to hit, reach 5 ft., one target. Hit: 3 (1d6) piercing damage.",attack_bonus:2,damage_dice:"1d6"}]},{name:"Ice Devil",size:"Large",type:"fiend",subtype:"devil",alignment:"lawful evil",ac:18,hp:180,hit_dice:"19d10 + 75",speed:"40 ft.",stats:[21,14,18,18,15,18],saves:[{dexterity:7},{constitution:9},{wisdom:7},{charisma:9}],damage_vulnerabilities:"",damage_resistances:"bludgeoning, piercing, and slashing from nonmagical weapons that aren't silvered",damage_immunities:"fire, poison",condition_immunities:"poisoned",senses:"blindsight 60 ft., darkvision 120 ft., passive Perception 12",languages:"Infernal, telepathy 120 ft.",cr:"14",traits:[{name:"Devil's Sight",desc:"Magical darkness doesn't impede the devil's darkvision.",attack_bonus:0},{name:"Magic Resistance",desc:"The devil has advantage on saving throws against spells and other magical effects.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The devil makes three attacks: one with its bite, one with its claws, and one with its tail.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +10 to hit, reach 5 ft., one target. Hit: 12 (2d6 + 5) piercing damage plus 10 (3d6) cold damage.",attack_bonus:10,damage_dice:"2d6 + 3d6",damage_bonus:5},{name:"Claws",desc:"Melee Weapon Attack: +10 to hit, reach 5 ft., one target. Hit: 10 (2d4 + 5) slashing damage plus 10 (3d6) cold damage.",attack_bonus:10,damage_dice:"2d4 + 3d6",damage_bonus:5},{name:"Tail",desc:"Melee Weapon Attack:+10 to hit, reach 10 ft., one target. Hit: 12 (2d6 + 5) bludgeoning damage plus 10 (3d6) cold damage.",attack_bonus:10,damage_dice:"2d6 + 3d6",damage_bonus:5},{name:"Wall of Ice",desc:"The devil magically forms an opaque wall of ice on a solid surface it can see within 60 feet of it. The wall is 1 foot thick and up to 30 feet long and 10 feet high, or it's a hemispherical dome up to 20 feet in diameter.\\nWhen the wall appears, each creature in its space is pushed out of it by the shortest route. The creature chooses which side of the wall to end up on, unless the creature is incapacitated. The creature then makes a DC 17 Dexterity saving throw, taking 35 (10d6) cold damage on a failed save, or half as much damage on a successful one.\\nThe wall lasts for 1 minute or until the devil is incapacitated or dies. The wall can be damaged and breached; each 10-foot section has AC 5, 30 hit points, vulnerability to fire damage, and immunity to acid, cold, necrotic, poison, and psychic damage. If a section is destroyed, it leaves behind a sheet of frigid air in the space the wall occupied. Whenever a creature finishes moving through the frigid air on a turn, willingly or otherwise, the creature must make a DC 17 Constitution saving throw, taking 17 (5d6) cold damage on a failed save, or half as much damage on a successful one. The frigid air dissipates when the rest of the wall vanishes.",attack_bonus:0}]},{name:"Ice Mephit",size:"Small",type:"elemental",subtype:"",alignment:"neutral evil",ac:11,hp:21,hit_dice:"6d6",speed:"30 ft., fly 30 ft.",stats:[7,13,10,9,11,12],skillsaves:[{perception:2},{stealth:3}],damage_vulnerabilities:"bludgeoning, fire",damage_resistances:"",damage_immunities:"cold, poison",condition_immunities:"poisoned",senses:"darkvision 60 ft., passive Perception 12",languages:"Aquan, Auran",cr:"1/2",traits:[{name:"Death Burst",desc:"When the mephit dies, it explodes in a burst of jagged ice. Each creature within 5 ft. of it must make a DC 10 Dexterity saving throw, taking 4 (1d8) slashing damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"1d8"},{name:"False Appearance",desc:"While the mephit remains motionless, it is indistinguishable from an ordinary shard of ice.",attack_bonus:0},{name:"Innate Spellcasting (1/Day)",desc:"The mephit can innately cast fog cloud, requiring no material components. Its innate spellcasting ability is Charisma.",attack_bonus:0}],actions:[{name:"Claws",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one creature. Hit: 3 (1d4 + 1) slashing damage plus 2 (1d4) cold damage.",attack_bonus:3,damage_dice:"1d4",damage_bonus:1},{name:"Frost Breath (Recharge 6)",desc:"The mephit exhales a 15-foot cone of cold air. Each creature in that area must succeed on a DC 10 Dexterity saving throw, taking 5 (2d4) cold damage on a failed save, or half as much damage on a successful one.",attack_bonus:0},{name:"Variant: Summon Mephits (1/Day)",desc:"The mephit has a 25 percent chance of summoning 1d4 mephits of its kind. A summoned mephit appears in an unoccupied space within 60 feet of its summoner, acts as an ally of its summoner, and can't summon other mephits. It remains for 1 minute, until it or its summoner dies, or until its summoner dismisses it as an action.",attack_bonus:0}]},{name:"Imp",size:"Tiny",type:"fiend",subtype:"devil",alignment:"lawful evil",ac:13,hp:10,hit_dice:"3d4 + 2",speed:"20 ft., fly 40 ft.",stats:[6,17,13,11,12,14],skillsaves:[{deception:4},{insight:3},{persuasion:4},{stealth:5}],damage_vulnerabilities:"",damage_resistances:"cold; bludgeoning, piercing, and slashing from nonmagical/nonsilver weapons",damage_immunities:"fire, poison",condition_immunities:"poisoned",senses:"darkvision 120 ft., passive Perception 11",languages:"Infernal, Common",cr:"1",traits:[{name:"Shapechanger",desc:"The imp can use its action to polymorph into a beast form that resembles a rat (speed 20 ft.), a raven (20 ft., fly 60 ft.), or a spider (20 ft., climb 20 ft.), or back into its true form. Its statistics are the same in each form, except for the speed changes noted. Any equipment it is wearing or carrying isn't transformed. It reverts to its true form if it dies.",attack_bonus:0},{name:"Devil's Sight",desc:"Magical darkness doesn't impede the imp's darkvision.",attack_bonus:0},{name:"Magic Resistance",desc:"The imp has advantage on saving throws against spells and other magical effects.",attack_bonus:0},{name:"Variant: Familiar",desc:"The imp can serve another creature as a familiar, forming a telepathic bond with its willing master. While the two are bonded, the master can sense what the quasit senses as long as they are within 1 mile of each other. While the imp is within 10 feet of its master, the master shares the quasit's Magic Resistance trait. At any time and for any reason, the imp can end its service as a familiar, ending the telepathic bond.",attack_bonus:0}],actions:[{name:"Sting (Bite in Beast Form)",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft ., one target. Hit: 5 (1d4 + 3) piercing damage, and the target must make on a DC 11 Constitution saving throw, taking 10 (3d6) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:5,damage_dice:"1d4",damage_bonus:3},{name:"Invisibility",desc:"The imp magically turns invisible until it attacks, or until its concentration ends (as if concentrating on a spell). Any equipment the imp wears or carries is invisible with it.",attack_bonus:0}]},{name:"Invisible Stalker",size:"Medium",type:"elemental",subtype:"",alignment:"neutral",ac:14,hp:104,hit_dice:"16d8 + 32",speed:"50 ft., fly 50 ft. (hover)",stats:[16,19,14,10,15,11],skillsaves:[{perception:8},{stealth:10}],damage_vulnerabilities:"",damage_resistances:"bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"poison",condition_immunities:"exhaustion, grappled, paralyzed, petrified, poisoned, prone, restrained, unconscious",senses:"darkvision 60 ft., passive Perception 18",languages:"Auran, understands Common but doesn't speak it",cr:"6",traits:[{name:"Invisibility",desc:"The stalker is invisible.",attack_bonus:0},{name:"Faultless Tracker",desc:"The stalker is given a quarry by its summoner. The stalker knows the direction and distance to its quarry as long as the two of them are on the same plane of existence. The stalker also knows the location of its summoner.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The stalker makes two slam attacks.",attack_bonus:0},{name:"Slam",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) bludgeoning damage.",attack_bonus:6,damage_dice:"2d6",damage_bonus:3}]},{name:"Iron Golem",size:"Large",type:"construct",subtype:"",alignment:"unaligned",ac:20,hp:210,hit_dice:"20d10 + 100",speed:"30 ft.",stats:[24,9,20,3,11,1],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire, poison, psychic; bludgeoning, piercing, and slashing from nonmagical weapons that aren't adamantine",condition_immunities:"charmed, exhaustion, frightened, paralyzed, petrified, poisoned",senses:"darkvision 120 ft., passive Perception 10",languages:"understands the languages of its creator but can't speak",cr:"16",traits:[{name:"Fire Absorption",desc:"Whenever the golem is subjected to fire damage, it takes no damage and instead regains a number of hit points equal to the fire damage dealt.",attack_bonus:0},{name:"Immutable Form",desc:"The golem is immune to any spell or effect that would alter its form.",attack_bonus:0},{name:"Magic Resistance",desc:"The golem has advantage on saving throws against spells and other magical effects.",attack_bonus:0},{name:"Magic Weapons",desc:"The golem's weapon attacks are magical.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The golem makes two melee attacks.",attack_bonus:0},{name:"Slam",desc:"Melee Weapon Attack: +13 to hit, reach 5 ft., one target. Hit: 20 (3d8 + 7) bludgeoning damage.",attack_bonus:13,damage_dice:"3d8",damage_bonus:7},{name:"Sword",desc:"Melee Weapon Attack: +13 to hit, reach 10 ft., one target. Hit: 23 (3d10 + 7) slashing damage.",attack_bonus:13,damage_dice:"3d10",damage_bonus:7},{name:"Poison Breath (Recharge 5-6)",desc:"The golem exhales poisonous gas in a 15-foot cone. Each creature in that area must make a DC 19 Constitution saving throw, taking 45 (l0d8) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"10d8"}]},{name:"Jackal",size:"Small",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:3,hit_dice:"1d6 + -1",speed:"40 ft.",stats:[8,15,11,3,12,6],skillsaves:[{perception:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"",cr:"0",traits:[{name:"Keen Hearing and Smell",desc:"The jackal has advantage on Wisdom (Perception) checks that rely on hearing or smell.",attack_bonus:0},{name:"Pack Tactics",desc:"The jackal has advantage on an attack roll against a creature if at least one of the jackal's allies is within 5 ft. of the creature and the ally isn't incapacitated.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +1 to hit, reach 5 ft., one target. Hit: 1 (1d4 \u2014 1) piercing damage.",attack_bonus:1,damage_dice:"1d4",damage_bonus:-1}]},{name:"Killer Whale",size:"Huge",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:90,hit_dice:"12d12 + 12",speed:"swim 60 ft.",stats:[19,10,13,3,12,7],skillsaves:[{perception:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 120 ft., passive Perception 13",languages:"",cr:"3",traits:[{name:"Echolocation",desc:"The whale can't use its blindsight while deafened.",attack_bonus:0},{name:"Hold Breath",desc:"The whale can hold its breath for 30 minutes",attack_bonus:0},{name:"Keen Hearing",desc:"The whale has advantage on Wisdom (Perception) checks that rely on hearing.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 21 (5d6 + 4) piercing damage.",attack_bonus:0}]},{name:"Knight",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any alignment",ac:18,hp:52,hit_dice:"8d8 + 16",speed:"30 ft.",stats:[16,11,14,11,11,15],saves:[{constitution:4},{wisdom:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"any one language (usually Common)",cr:"3",traits:[{name:"Brave",desc:"The knight has advantage on saving throws against being frightened.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The knight makes two melee attacks.",attack_bonus:0},{name:"Greatsword",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) slashing damage.",attack_bonus:5,damage_dice:"2d6",damage_bonus:3},{name:"Heavy Crossbow",desc:"Ranged Weapon Attack: +2 to hit, range 100/400 ft., one target. Hit: 5 (1d10) piercing damage.",attack_bonus:2,damage_dice:"1d10"},{name:"Leadership (Recharges after a Short or Long Rest)",desc:"For 1 minute, the knight can utter a special command or warning whenever a nonhostile creature that it can see within 30 ft. of it makes an attack roll or a saving throw. The creature can add a d4 to its roll provided it can hear and understand the knight. A creature can benefit from only one Leadership die at a time. This effect ends if the knight is incapacitated.",attack_bonus:0}],reactions:[{name:"Parry",desc:"The knight adds 2 to its AC against one melee attack that would hit it. To do so, the knight must see the attacker and be wielding a melee weapon.",attack_bonus:0}]},{name:"Kobold",size:"Small",type:"humanoid",subtype:"kobold",alignment:"lawful evil",ac:12,hp:5,hit_dice:"2d6 + -2",speed:"30 ft.",stats:[7,15,9,8,7,8],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 8",languages:"Common, Draconic",cr:"1/8",traits:[{name:"Sunlight Sensitivity",desc:"While in sunlight, the kobold has disadvantage on attack rolls, as well as on Wisdom (Perception) checks that rely on sight.",attack_bonus:0},{name:"Pack Tactics",desc:"The kobold has advantage on an attack roll against a creature if at least one of the kobold's allies is within 5 ft. of the creature and the ally isn't incapacitated.",attack_bonus:0}],actions:[{name:"Dagger",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 4 (1d4 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d4",damage_bonus:2},{name:"Sling",desc:"Ranged Weapon Attack: +4 to hit, range 30/120 ft., one target. Hit: 4 (1d4 + 2) bludgeoning damage.",attack_bonus:4,damage_dice:"1d4",damage_bonus:2}]},{name:"Kraken",size:"Gargantuan",type:"monstrosity",subtype:"titan",alignment:"chaotic evil",ac:18,hp:472,hit_dice:"27d20 + 188",speed:"20 ft., swim 60 ft.",stats:[30,11,25,22,18,20],saves:[{strength:17},{dexterity:7},{constitution:14},{intelligence:13},{wisdom:11}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"lightning; bludgeoning, piercing, and slashing from nonmagical weapons",condition_immunities:"frightened, paralyzed",senses:"truesight 120 ft., passive Perception 14",languages:"understands Abyssal, Celestial, Infernal, and Primordial but can't speak, telepathy 120 ft.",cr:"23",traits:[{name:"Amphibious",desc:"The kraken can breathe air and water.",attack_bonus:0},{name:"Freedom of Movement",desc:"The kraken ignores difficult terrain, and magical effects can't reduce its speed or cause it to be restrained. It can spend 5 feet of movement to escape from nonmagical restraints or being grappled.",attack_bonus:0},{name:"Siege Monster",desc:"The kraken deals double damage to objects and structures.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The kraken makes three tentacle attacks, each of which it can replace with one use of Fling.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 23 (3d8 + 10) piercing damage. If the target is a Large or smaller creature grappled by the kraken, that creature is swallowed, and the grapple ends. While swallowed, the creature is blinded and restrained, it has total cover against attacks and other effects outside the kraken, and it takes 42 (12d6) acid damage at the start of each of the kraken's turns. If the kraken takes 50 damage or more on a single turn from a creature inside it, the kraken must succeed on a DC 25 Constitution saving throw at the end of that turn or regurgitate all swallowed creatures, which fall prone in a space within 10 feet of the kraken. If the kraken dies, a swallowed creature is no longer restrained by it and can escape from the corpse using 15 feet of movement, exiting prone.",attack_bonus:7,damage_dice:"3d8",damage_bonus:10},{name:"Tentacle",desc:"Melee Weapon Attack: +7 to hit, reach 30 ft., one target. Hit: 20 (3d6 + 10) bludgeoning damage, and the target is grappled (escape DC 18). Until this grapple ends, the target is restrained. The kraken has ten tentacles, each of which can grapple one target.",attack_bonus:7,damage_dice:"3d6",damage_bonus:10},{name:"Fling",desc:"One Large or smaller object held or creature grappled by the kraken is thrown up to 60 feet in a random direction and knocked prone. If a thrown target strikes a solid surface, the target takes 3 (1d6) bludgeoning damage for every 10 feet it was thrown. If the target is thrown at another creature, that creature must succeed on a DC 18 Dexterity saving throw or take the same damage and be knocked prone.",attack_bonus:0},{name:"Lightning Storm",desc:"The kraken magically creates three bolts of lightning, each of which can strike a target the kraken can see within 120 feet of it. A target must make a DC 23 Dexterity saving throw, taking 22 (4d10) lightning damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"4d10"}],legendary_actions:[{name:"Tentacle Attack or Fling",desc:"The kraken makes one tentacle attack or uses its Fling.",attack_bonus:0},{name:"Lightning Storm (Costs 2 Actions)",desc:"The kraken uses Lightning Storm.",attack_bonus:0},{name:"Ink Cloud (Costs 3 Actions)",desc:"While underwater, the kraken expels an ink cloud in a 60-foot radius. The cloud spreads around corners, and that area is heavily obscured to creatures other than the kraken. Each creature other than the kraken that ends its turn there must succeed on a DC 23 Constitution saving throw, taking 16 (3d10) poison damage on a failed save, or half as much damage on a successful one. A strong current disperses the cloud, which otherwise disappears at the end of the kraken's next turn.",attack_bonus:0}]},{name:"Lamia",size:"Large",type:"monstrosity",subtype:"",alignment:"chaotic evil",ac:13,hp:97,hit_dice:"13d10 + 25",speed:"30 ft.",stats:[16,13,15,14,15,16],skillsaves:[{deception:7},{insight:4},{stealth:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 12",languages:"Abyssal, Common",cr:"4",traits:[{name:"Innate Spellcasting",desc:"The lamia's innate spellcasting ability is Charisma (spell save DC 13). It can innately cast the following spells, requiring no material components. At will: disguise self (any humanoid form), major image 3/day each: charm person, mirror image, scrying, suggestion 1/day: geas",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The lamia makes two attacks: one with its claws and one with its dagger or Intoxicating Touch.",attack_bonus:0},{name:"Claws",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 14 (2d10 + 3) slashing damage.",attack_bonus:5,damage_dice:"2d10",damage_bonus:3},{name:"Dagger",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 5 (1d4 + 3) piercing damage.",attack_bonus:5,damage_dice:"1d4",damage_bonus:3},{name:"Intoxicating Touch",desc:"Melee Spell Attack: +5 to hit, reach 5 ft., one creature. Hit: The target is magically cursed for 1 hour. Until the curse ends, the target has disadvantage on Wisdom saving throws and all ability checks.",attack_bonus:0}]},{name:"Lemure",size:"Medium",type:"fiend",subtype:"devil",alignment:"lawful evil",ac:7,hp:13,hit_dice:"3d8 + -1",speed:"15 ft.",stats:[10,5,11,1,11,3],damage_vulnerabilities:"",damage_resistances:"cold",damage_immunities:"fire, poison",condition_immunities:"charmed, frightened, poisoned",senses:"darkvision 120 ft., passive Perception 10",languages:"understands infernal but can't speak",cr:"0",traits:[{name:"Devil's Sight",desc:"Magical darkness doesn't impede the lemure's darkvision.",attack_bonus:0},{name:"Hellish Rejuvenation",desc:"A lemure that dies in the Nine Hells comes back to life with all its hit points in 1d10 days unless it is killed by a good-aligned creature with a bless spell cast on that creature or its remains are sprinkled with holy water.",attack_bonus:0}],actions:[{name:"Fist",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 2 (1d4) bludgeoning damage",attack_bonus:3,damage_dice:"1d4"}]},{name:"Lich",size:"Medium",type:"undead",subtype:"",alignment:"any evil alignment",ac:17,hp:135,hit_dice:"18d8 + 54",speed:"30 ft.",stats:[11,16,16,20,14,16],saves:[{constitution:10},{intelligence:12},{wisdom:9}],skillsaves:[{arcana:18},{history:12},{insight:9},{perception:9}],damage_vulnerabilities:"",damage_resistances:"cold, lightning, necrotic",damage_immunities:"poison; bludgeoning, piercing, and slashing from nonmagical weapons",condition_immunities:"charmed, exhaustion, frightened, paralyzed, poisoned",senses:"truesight 120 ft., passive Perception 19",languages:"Common plus up to five other languages",cr:"21",traits:[{name:"Legendary Resistance (3/Day)",desc:"If the lich fails a saving throw, it can choose to succeed instead.",attack_bonus:0},{name:"Rejuvenation",desc:"If it has a phylactery, a destroyed lich gains a new body in 1d10 days, regaining all its hit points and becoming active again. The new body appears within 5 feet of the phylactery.",attack_bonus:0},{name:"Turn Resistance",desc:"The lich has advantage on saving throws against any effect that turns undead.",attack_bonus:0}],actions:[{name:"Paralyzing Touch",desc:"Melee Spell Attack: +12 to hit, reach 5 ft., one creature. Hit: 10 (3d6) cold damage. The target must succeed on a DC 18 Constitution saving throw or be paralyzed for 1 minute. The target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",attack_bonus:12,damage_dice:"3d6"}],legendary_actions:[{name:"Cantrip",desc:"The lich casts a cantrip.",attack_bonus:0},{name:"Paralyzing Touch (Costs 2 Actions)",desc:"The lich uses its Paralyzing Touch.",attack_bonus:0},{name:"Frightening Gaze (Costs 2 Actions)",desc:"The lich fixes its gaze on one creature it can see within 10 feet of it. The target must succeed on a DC 18 Wisdom saving throw against this magic or become frightened for 1 minute. The frightened target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a target's saving throw is successful or the effect ends for it, the target is immune to the lich's gaze for the next 24 hours.",attack_bonus:0},{name:"Disrupt Life (Costs 3 Actions)",desc:"Each living creature within 20 feet of the lich must make a DC 18 Constitution saving throw against this magic, taking 21 (6d6) necrotic damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"6d6"}],spells:["The lich is an 18th-level spellcaster. Its spellcasting ability is Intelligence (spell save DC 20, +12 to hit with spell attacks). The lich has the following wizard spells prepared:",{"Cantrips (at will)":"mage hand, prestidigitation, ray of frost"},{"1st level (4 slots)":"detect magic, magic missile, shield, thunderwave"},{"2nd level (3 slots)":"detect thoughts, invisibility, Melf's acid arrow, mirror image"},{"3rd level (3 slots)":"animate dead, counterspell, dispel magic, fireball"},{"4th level (3 slots)":"blight, dimension door"},{"5th level (3 slots)":"cloudkill, scrying"},{"6th level (1 slot)":"disintegrate, globe of invulnerability"},{"7th level (1 slot)":"finger of death, plane shift"},{"8th level (1 slot)":"dominate monster, power word stun"},{"9th level (1 slot)":"power word kill"}]},{name:"Lion",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:26,hit_dice:"4d10 + 4",speed:"50 ft.",stats:[17,15,13,3,12,8],skillsaves:[{perception:3},{stealth:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"",cr:"1",traits:[{name:"Keen Smell",desc:"The lion has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0},{name:"Pack Tactics",desc:"The lion has advantage on an attack roll against a creature if at least one of the lion's allies is within 5 ft. of the creature and the ally isn't incapacitated.",attack_bonus:0},{name:"Pounce",desc:"If the lion moves at least 20 ft. straight toward a creature and then hits it with a claw attack on the same turn, that target must succeed on a DC 13 Strength saving throw or be knocked prone. If the target is prone, the lion can make one bite attack against it as a bonus action.",attack_bonus:0},{name:"Running Leap",desc:"With a 10-foot running start, the lion can long jump up to 25 ft..",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 7 (1d8 + 3) piercing damage.",attack_bonus:5,damage_dice:"1d8",damage_bonus:3},{name:"Claw",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) slashing damage.",attack_bonus:5,damage_dice:"1d6",damage_bonus:3}]},{name:"Lizard",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:10,hp:2,hit_dice:"1d4 + -1",speed:"20 ft., climb 20 ft.",stats:[2,11,10,1,8,3],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 30 ft., passive Perception 9",languages:"",cr:"0",actions:[{name:"Bite",desc:"Melee Weapon Attack: +0 to hit, reach 5 ft., one target. Hit: 1 piercing damage.",attack_bonus:0,damage_bonus:1}]},{name:"Lizardfolk",size:"Medium",type:"humanoid",subtype:"lizardfolk",alignment:"neutral",ac:15,hp:22,hit_dice:"4d8 + 4",speed:"30 ft., swim 30 ft.",stats:[15,10,13,7,12,7],skillsaves:[{perception:3},{stealth:4},{survival:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"Draconic",cr:"1/2",traits:[{name:"Hold Breath",desc:"The lizardfolk can hold its breath for 15 minutes.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The lizardfolk makes two melee attacks, each one with a different weapon.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2},{name:"Heavy Club",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) bludgeoning damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2},{name:"Javelin",desc:"Melee or Ranged Weapon Attack: +4 to hit, reach 5 ft. or range 30/120 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2},{name:"Spiked Shield",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2}]},{name:"Mage",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any alignment",ac:12,hp:40,hit_dice:"9d8 + -1",speed:"30 ft.",stats:[9,14,11,17,12,11],saves:[{intelligence:6},{wisdom:4}],skillsaves:[{arcana:6},{history:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 11",languages:"any four languages",cr:"6",traits:[],actions:[{name:"Dagger",desc:"Melee or Ranged Weapon Attack: +5 to hit, reach 5 ft. or range 20/60 ft., one target. Hit: 4 (1d4 + 2) piercing damage.",attack_bonus:5,damage_dice:"1d4",damage_bonus:2}],spells:["The mage is a 9th-level spellcaster. Its spellcasting ability is Intelligence (spell save DC 14, +6 to hit with spell attacks). The mage has the following wizard spells prepared:",{"Cantrips (at will)":"fire bolt, light, mage hand, prestidigitation"},{"1st level (4 slots)":"detect magic, mage armor, magic missile, shield"},{"2nd level (3 slots)":"misty step, suggestion"},{"3rd level (3 slots)":"counterspell, fireball, fly"},{"4th level (3 slots)":"greater invisibility, ice storm"},{"5th level (1 slot)":"cone of cold"}]},{name:"Magma Mephit",size:"Small",type:"elemental",subtype:"",alignment:"neutral evil",ac:11,hp:22,hit_dice:"5d6 + 4",speed:"30 ft., fly 30 ft.",stats:[8,12,12,7,10,10],skillsaves:[{stealth:3}],damage_vulnerabilities:"cold",damage_resistances:"",damage_immunities:"fire, poison",condition_immunities:"poisoned",senses:"darkvision 60 ft., passive Perception 10",languages:"Ignan, Terran",cr:"1/2",traits:[{name:"Death Burst",desc:"When the mephit dies, it explodes in a burst of lava. Each creature within 5 ft. of it must make a DC 11 Dexterity saving throw, taking 7 (2d6) fire damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"2d6"},{name:"False Appearance",desc:"While the mephit remains motionless, it is indistinguishable from an ordinary mound of magma.",attack_bonus:0},{name:"Innate Spellcasting (1/Day)",desc:"The mephit can innately cast heat metal (spell save DC 10), requiring no material components. Its innate spellcasting ability is Charisma.",attack_bonus:0}],actions:[{name:"Claws",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft ., one creature. Hit: 3 (1d4 + 1) slashing damage plus 2 (1d4) fire damage.",attack_bonus:3,damage_dice:"1d4",damage_bonus:1},{name:"Fire Breath (Recharge 6)",desc:"The mephit exhales a 15-foot cone of fire. Each creature in that area must make a DC 11 Dexterity saving throw, taking 7 (2d6) fire damage on a failed save, or half as much damage on a successful one.",attack_bonus:0},{name:"Variant: Summon Mephits (1/Day)",desc:"The mephit has a 25 percent chance of summoning 1d4 mephits of its kind. A summoned mephit appears in an unoccupied space within 60 feet of its summoner, acts as an ally of its summoner, and can't summon other mephits. It remains for 1 minute, until it or its summoner dies, or until its summoner dismisses it as an action.",attack_bonus:0}]},{name:"Magmin",size:"Small",type:"elemental",subtype:"",alignment:"chaotic neutral",ac:14,hp:9,hit_dice:"2d6 + 2",speed:"30 ft.",stats:[7,15,12,8,11,10],damage_vulnerabilities:"",damage_resistances:"bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"fire",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 10",languages:"Ignan",cr:"1/2",traits:[{name:"Death Burst",desc:"When the magmin dies, it explodes in a burst of fire and magma. Each creature within 10 ft. of it must make a DC 11 Dexterity saving throw, taking 7 (2d6) fire damage on a failed save, or half as much damage on a successful one. Flammable objects that aren't being worn or carried in that area are ignited.",attack_bonus:0,damage_dice:"2d6"},{name:"Ignited Illumination",desc:"As a bonus action, the magmin can set itself ablaze or extinguish its flames. While ablaze, the magmin sheds bright light in a 10-foot radius and dim light for an additional 10 ft.",attack_bonus:0}],actions:[{name:"Touch",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (2d6) fire damage. If the target is a creature or a flammable object, it ignites. Until a target takes an action to douse the fire, the target takes 3 (1d6) fire damage at the end of each of its turns.",attack_bonus:4,damage_dice:"2d6"}]},{name:"Mammoth",size:"Huge",type:"beast",subtype:"",alignment:"unaligned",ac:13,hp:126,hit_dice:"11d12 + 54",speed:"40 ft.",stats:[24,9,21,3,11,6],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"",cr:"6",traits:[{name:"Trampling Charge",desc:"If the mammoth moves at least 20 ft. straight toward a creature and then hits it with a gore attack on the same turn, that target must succeed on a DC 18 Strength saving throw or be knocked prone. If the target is prone, the mammoth can make one stomp attack against it as a bonus action.",attack_bonus:0}],actions:[{name:"Gore",desc:"Melee Weapon Attack: +10 to hit, reach 10 ft., one target. Hit: 25 (4d8 + 7) piercing damage.",attack_bonus:10,damage_dice:"4d8",damage_bonus:7},{name:"Stomp",desc:"Melee Weapon Attack: +10 to hit, reach 5 ft., one prone creature. Hit: 29 (4d10 + 7) bludgeoning damage.",attack_bonus:10,damage_dice:"4d10",damage_bonus:7}]},{name:"Manticore",size:"Large",type:"monstrosity",subtype:"",alignment:"lawful evil",ac:14,hp:68,hit_dice:"8d10 + 24",speed:"30 ft., fly 50 ft.",stats:[17,16,17,7,12,8],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 11",languages:"",cr:"3",traits:[{name:"Tail Spike Regrowth",desc:"The manticore has twenty-four tail spikes. Used spikes regrow when the manticore finishes a long rest.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The manticore makes three attacks: one with its bite and two with its claws or three with its tail spikes.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 7 (1d8 + 3) piercing damage.",attack_bonus:5,damage_dice:"1d8",damage_bonus:3},{name:"Claw",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) slashing damage.",attack_bonus:5,damage_dice:"1d6",damage_bonus:3},{name:"Tail Spike",desc:"Ranged Weapon Attack: +5 to hit, range 100/200 ft., one target. Hit: 7 (1d8 + 3) piercing damage.",attack_bonus:5,damage_dice:"1d8",damage_bonus:3}]},{name:"Marilith",size:"Large",type:"fiend",subtype:"demon",alignment:"chaotic evil",ac:18,hp:189,hit_dice:"18d10 + 90",speed:"40 ft.",stats:[18,20,20,18,16,20],saves:[{strength:9},{constitution:10},{wisdom:8},{charisma:10}],damage_vulnerabilities:"",damage_resistances:"cold, fire, lightning; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"poison",condition_immunities:"poisoned",senses:"truesight 120 ft., passive Perception 13",languages:"Abyssal, telepathy 120 ft.",cr:"16",traits:[{name:"Magic Resistance",desc:"The marilith has advantage on saving throws against spells and other magical effects.",attack_bonus:0},{name:"Magic Weapons",desc:"The marilith's weapon attacks are magical.",attack_bonus:0},{name:"Reactive",desc:"The marilith can take one reaction on every turn in combat.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The marilith can make seven attacks: six with its longswords and one with its tail.",attack_bonus:0},{name:"Longsword",desc:"Melee Weapon Attack: +9 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) slashing damage.",attack_bonus:9,damage_dice:"2d8",damage_bonus:4},{name:"Tail",desc:"Melee Weapon Attack: +9 to hit, reach 10 ft., one creature. Hit: 15 (2d10 + 4) bludgeoning damage. If the target is Medium or smaller, it is grappled (escape DC 19). Until this grapple ends, the target is restrained, the marilith can automatically hit the target with its tail, and the marilith can't make tail attacks against other targets.",attack_bonus:9,damage_dice:"2d10",damage_bonus:4},{name:"Teleport",desc:"The marilith magically teleports, along with any equipment it is wearing or carrying, up to 120 feet to an unoccupied space it can see.",attack_bonus:0},{name:"Variant: Summon Demon (1/Day)",desc:"The demon chooses what to summon and attempts a magical summoning.\\nA marilith has a 50 percent chance of summoning 1d6 vrocks, 1d4 hezrous, 1d3 glabrezus, 1d2 nalfeshnees, or one marilith.\\nA summoned demon appears in an unoccupied space within 60 feet of its summoner, acts as an ally of its summoner, and can't summon other demons. It remains for 1 minute, until it or its summoner dies, or until its summoner dismisses it as an action.",attack_bonus:0}],reactions:[{name:"Parry",desc:"The marilith adds 5 to its AC against one melee attack that would hit it. To do so, the marilith must see the attacker and be wielding a melee weapon.",attack_bonus:0}]},{name:"Mastiff",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:5,hit_dice:"1d8",speed:"40 ft.",stats:[13,14,12,3,12,7],skillsaves:[{perception:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"",cr:"1/8",traits:[{name:"Keen Hearing and Smell",desc:"The mastiff has advantage on Wisdom (Perception) checks that rely on hearing or smell.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 4 (1d6 + 1) piercing damage. If the target is a creature, it must succeed on a DC 11 Strength saving throw or be knocked prone.",attack_bonus:3,damage_dice:"1d6",damage_bonus:1}]},{name:"Medusa",size:"Medium",type:"monstrosity",subtype:"",alignment:"lawful evil",ac:15,hp:127,hit_dice:"17d8 + 50",speed:"30 ft.",stats:[10,15,16,12,13,15],skillsaves:[{deception:5},{insight:4},{perception:4},{stealth:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 14",languages:"Common",cr:"6",traits:[{name:"Petrifying Gaze",desc:"When a creature that can see the medusa's eyes starts its turn within 30 ft. of the medusa, the medusa can force it to make a DC 14 Constitution saving throw if the medusa isn't incapacitated and can see the creature. If the saving throw fails by 5 or more, the creature is instantly petrified. Otherwise, a creature that fails the save begins to turn to stone and is restrained. The restrained creature must repeat the saving throw at the end of its next turn, becoming petrified on a failure or ending the effect on a success. The petrification lasts until the creature is freed by the greater restoration spell or other magic.\\nUnless surprised, a creature can avert its eyes to avoid the saving throw at the start of its turn. If the creature does so, it can't see the medusa until the start of its next turn, when it can avert its eyes again. If the creature looks at the medusa in the meantime, it must immediately make the save.\\nIf the medusa sees itself reflected on a polished surface within 30 ft. of it and in an area of bright light, the medusa is, due to its curse, affected by its own gaze.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The medusa makes either three melee attacks \u2014 one with its snake hair and two with its shortsword \u2014 or two ranged attacks with its longbow.",attack_bonus:0},{name:"Snake Hair",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one creature. Hit: 4 (1d4 + 2) piercing damage plus 14 (4d6) poison damage.",attack_bonus:5,damage_dice:"1d4",damage_bonus:2},{name:"Shortsword",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:5,damage_dice:"1d6",damage_bonus:2},{name:"Longbow",desc:"Ranged Weapon Attack: +5 to hit, range 150/600 ft., one target. Hit: 6 (1d8 + 2) piercing damage plus 7 (2d6) poison damage.",attack_bonus:5,damage_dice:"2d6"}]},{name:"Merfolk",size:"Medium",type:"humanoid",subtype:"merfolk",alignment:"neutral",ac:11,hp:11,hit_dice:"2d8 + 2",speed:"10 ft., swim 40 ft.",stats:[10,13,12,11,11,12],skillsaves:[{perception:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 12",languages:"Aquan, Common",cr:"1/8",traits:[{name:"Amphibious",desc:"The merfolk can breathe air and water.",attack_bonus:0}],actions:[{name:"Spear",desc:"Melee or Ranged Weapon Attack: +2 to hit, reach 5 ft. or range 20/60 ft., one target. Hit: 3 (1d6) piercing damage, or 4 (1d8) piercing damage if used with two hands to make a melee attack.",attack_bonus:2,damage_dice:"1d6"}]},{name:"Merrow",size:"Large",type:"monstrosity",subtype:"",alignment:"chaotic evil",ac:13,hp:45,hit_dice:"6d10 + 12",speed:"10 ft., swim 40 ft.",stats:[18,10,15,8,10,9],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 10",languages:"Abyssal, Aquan",cr:"2",traits:[{name:"Amphibious",desc:"The merrow can breathe air and water.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The merrow makes two attacks: one with its bite and one with its claws or harpoon.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 8 (1d8 + 4) piercing damage.",attack_bonus:6,damage_dice:"1d8",damage_bonus:4},{name:"Claws",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 9 (2d4 + 4) slashing damage.",attack_bonus:6,damage_dice:"2d4",damage_bonus:4},{name:"Harpoon",desc:"Melee or Ranged Weapon Attack: +6 to hit, reach 5 ft. or range 20/60 ft., one target. Hit: 11 (2d6 + 4) piercing damage. If the target is a Huge or smaller creature, it must succeed on a Strength contest against the merrow or be pulled up to 20 feet toward the merrow.",attack_bonus:6,damage_dice:"2d6",damage_bonus:4}]},{name:"Mimic",size:"Medium",type:"monstrosity",subtype:"shapechanger",alignment:"neutral",ac:12,hp:58,hit_dice:"9d8 + 17",speed:"15 ft.",stats:[17,12,15,5,13,8],skillsaves:[{stealth:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"acid",condition_immunities:"prone",senses:"darkvision 60 ft., passive Perception 11",languages:"",cr:"2",traits:[{name:"Shapechanger",desc:"The mimic can use its action to polymorph into an object or back into its true, amorphous form. Its statistics are the same in each form. Any equipment it is wearing or carrying isn 't transformed. It reverts to its true form if it dies.",attack_bonus:0},{name:"Adhesive (Object Form Only)",desc:"The mimic adheres to anything that touches it. A Huge or smaller creature adhered to the mimic is also grappled by it (escape DC 13). Ability checks made to escape this grapple have disadvantage.",attack_bonus:0},{name:"False Appearance (Object Form Only)",desc:"While the mimic remains motionless, it is indistinguishable from an ordinary object.",attack_bonus:0},{name:"Grappler",desc:"The mimic has advantage on attack rolls against any creature grappled by it.",attack_bonus:0}],actions:[{name:"Pseudopod",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 7 (1d8 + 3) bludgeoning damage. If the mimic is in object form, the target is subjected to its Adhesive trait.",attack_bonus:5,damage_dice:"1d8",damage_bonus:3},{name:"Bite",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 7 (1d8 + 3) piercing damage plus 4 (1d8) acid damage.",attack_bonus:5,damage_dice:"1d8 + 1d8",damage_bonus:3}]},{name:"Minotaur",size:"Large",type:"monstrosity",subtype:"",alignment:"chaotic evil",ac:14,hp:76,hit_dice:"9d10 + 26",speed:"40 ft.",stats:[18,11,16,6,16,9],skillsaves:[{perception:7}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 17",languages:"Abyssal",cr:"3",traits:[{name:"Charge",desc:"If the minotaur moves at least 10 ft. straight toward a target and then hits it with a gore attack on the same turn, the target takes an extra 9 (2d8) piercing damage. If the target is a creature, it must succeed on a DC 14 Strength saving throw or be pushed up to 10 ft. away and knocked prone.",attack_bonus:0,damage_dice:"2d8"},{name:"Labyrinthine Recall",desc:"The minotaur can perfectly recall any path it has traveled.",attack_bonus:0},{name:"Reckless",desc:"At the start of its turn, the minotaur can gain advantage on all melee weapon attack rolls it makes during that turn, but attack rolls against it have advantage until the start of its next turn.",attack_bonus:0}],actions:[{name:"Greataxe",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 17 (2d12 + 4) slashing damage.",attack_bonus:6,damage_dice:"2d12",damage_bonus:4},{name:"Gore",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) piercing damage.",attack_bonus:6,damage_dice:"2d8",damage_bonus:4}]},{name:"Minotaur Skeleton",size:"Large",type:"undead",subtype:"",alignment:"lawful evil",ac:12,hp:67,hit_dice:"9d10 + 17",speed:"40 ft.",stats:[18,11,15,6,8,5],damage_vulnerabilities:"bludgeoning",damage_resistances:"",damage_immunities:"poison",condition_immunities:"exhaustion, poisoned",senses:"darkvision 60 ft., passive Perception 9",languages:"understands Abyssal but can't speak",cr:"2",traits:[{name:"Charge",desc:"If the skeleton moves at least 10 feet straight toward a target and then hits it with a gore attack on the same turn, the target takes an extra 9 (2d8) piercing damage. If the target is a creature, it must succeed on a DC 14 Strength saving throw or be pushed up to 10 feet away and knocked prone.",attack_bonus:0,damage_dice:"2d8"}],actions:[{name:"Greataxe",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 17 (2d12 + 4) slashing damage.",attack_bonus:6,damage_dice:"2d12",damage_bonus:4},{name:"Gore",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) piercing damage.",attack_bonus:6,damage_dice:"2d8",damage_bonus:4}]},{name:"Mule",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:10,hp:11,hit_dice:"2d8 + 2",speed:"40 ft.",stats:[14,10,13,2,10,5],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"",cr:"1/8",traits:[{name:"Beast of Burden",desc:"The mule is considered to be a Large animal for the purpose of determining its carrying capacity.",attack_bonus:0},{name:"Sure-Footed",desc:"The mule has advantage on Strength and Dexterity saving throws made against effects that would knock it prone.",attack_bonus:0}],actions:[{name:"Hooves",desc:"Melee Weapon Attack: +2 to hit, reach 5 ft., one target. Hit: 4 (1d4 + 2) bludgeoning damage.",attack_bonus:4,damage_dice:"1d4",damage_bonus:2}]},{name:"Mummy",size:"Medium",type:"undead",subtype:"",alignment:"lawful evil",ac:11,hp:58,hit_dice:"9d8 + 17",speed:"20 ft.",stats:[16,8,15,6,10,12],saves:[{wisdom:2}],damage_vulnerabilities:"fire",damage_resistances:"",damage_immunities:"bludgeoning, piercing, and slashing from nonmagical weapons",condition_immunities:"necrotic, poisoned",senses:"darkvision 60 ft., passive Perception 10",languages:"the languages it knew in life",cr:"3",actions:[{name:"Multiattack",desc:"The mummy can use its Dreadful Glare and makes one attack with its rotting fist.",attack_bonus:0},{name:"Rotting Fist",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) bludgeoning damage plus 10 (3d6) necrotic damage. If the target is a creature, it must succeed on a DC 12 Constitution saving throw or be cursed with mummy rot. The cursed target can't regain hit points, and its hit point maximum decreases by 10 (3d6) for every 24 hours that elapse. If the curse reduces the target's hit point maximum to 0, the target dies, and its body turns to dust. The curse lasts until removed by the remove curse spell or other magic.",attack_bonus:5,damage_dice:"2d6",damage_bonus:3},{name:"Dreadful Glare",desc:"The mummy targets one creature it can see within 60 ft. of it. If the target can see the mummy, it must succeed on a DC 11 Wisdom saving throw against this magic or become frightened until the end of the mummy's next turn. If the target fails the saving throw by 5 or more, it is also paralyzed for the same duration. A target that succeeds on the saving throw is immune to the Dreadful Glare of all mummies (but not mummy lords) for the next 24 hours.",attack_bonus:0}]},{name:"Mummy Lord",size:"Medium",type:"undead",subtype:"",alignment:"lawful evil",ac:17,hp:97,hit_dice:"13d8 + 38",speed:"20 ft.",stats:[18,10,17,11,18,16],saves:[{constitution:8},{intelligence:5},{wisdom:9},{charisma:8}],skillsaves:[{history:5},{religion:5}],damage_vulnerabilities:"bludgeoning",damage_resistances:"",damage_immunities:"necrotic, poison; bludgeoning, piercing, and slashing from nonmagical weapons",condition_immunities:"charmed, exhaustion, frightened, paralyzed, poisoned",senses:"darkvision 60 ft., passive Perception 14",languages:"the languages it knew in life",cr:"15",traits:[{name:"Magic Resistance",desc:"The mummy lord has advantage on saving throws against spells and other magical effects.",attack_bonus:0},{name:"Rejuvenation",desc:"A destroyed mummy lord gains a new body in 24 hours if its heart is intact, regaining all its hit points and becoming active again. The new body appears within 5 feet of the mummy lord's heart.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The mummy can use its Dreadful Glare and makes one attack with its rotting fist.",attack_bonus:0},{name:"Rotting Fist",desc:"Melee Weapon Attack: +9 to hit, reach 5 ft., one target. Hit: 14 (3d6 + 4) bludgeoning damage plus 21 (6d6) necrotic damage. If the target is a creature, it must succeed on a DC 16 Constitution saving throw or be cursed with mummy rot. The cursed target can't regain hit points, and its hit point maximum decreases by 10 (3d6) for every 24 hours that elapse. If the curse reduces the target's hit point maximum to 0, the target dies, and its body turns to dust. The curse lasts until removed by the remove curse spell or other magic.",attack_bonus:9,damage_dice:"3d6 + 6d6",damage_bonus:4},{name:"Dreadful Glare",desc:"The mummy lord targets one creature it can see within 60 feet of it. If the target can see the mummy lord, it must succeed on a DC 16 Wisdom saving throw against this magic or become frightened until the end of the mummy's next turn. If the target fails the saving throw by 5 or more, it is also paralyzed for the same duration. A target that succeeds on the saving throw is immune to the Dreadful Glare of all mummies and mummy lords for the next 24 hours.",attack_bonus:0}],legendary_actions:[{name:"Attack",desc:"The mummy lord makes one attack with its rotting fist or uses its Dreadful Glare.",attack_bonus:0},{name:"Blinding Dust",desc:"Blinding dust and sand swirls magically around the mummy lord. Each creature within 5 feet of the mummy lord must succeed on a DC 16 Constitution saving throw or be blinded until the end of the creature's next turn.",attack_bonus:0},{name:"Blasphemous Word (Costs 2 Actions)",desc:"The mummy lord utters a blasphemous word. Each non-undead creature within 10 feet of the mummy lord that can hear the magical utterance must succeed on a DC 16 Constitution saving throw or be stunned until the end of the mummy lord's next turn.",attack_bonus:0},{name:"Channel Negative Energy (Costs 2 Actions)",desc:"The mummy lord magically unleashes negative energy. Creatures within 60 feet of the mummy lord, including ones behind barriers and around corners, can't regain hit points until the end of the mummy lord's next turn.",attack_bonus:0},{name:"Whirlwind of Sand (Costs 2 Actions)",desc:"The mummy lord magically transforms into a whirlwind of sand, moves up to 60 feet, and reverts to its normal form. While in whirlwind form, the mummy lord is immune to all damage, and it can't be grappled, petrified, knocked prone, restrained, or stunned. Equipment worn or carried by the mummy lord remain in its possession.",attack_bonus:0}],spells:["The mummy lord is a 10th-level spellcaster. Its spellcasting ability is Wisdom (spell save DC 17, +9 to hit with spell attacks). The mummy lord has the following cleric spells prepared:",{"Cantrips (at will)":"sacred flame, thaumaturgy"},{"1st level (4 slots)":"command, guiding bolt, shield of faith"},{"2nd level (3 slots)":"hold person, silence, spiritual weapon"},{"3rd level (3 slots)":"animate dead, dispel magic"},{"4th level (3 slots)":"divination, guardian of faith"},{"5th level (2 slots)":"contagion, insect plague"},{"6th level (1 slot)":"harm"}]},{name:"Nalfeshnee",size:"Large",type:"fiend",subtype:"demon",alignment:"chaotic evil",ac:18,hp:184,hit_dice:"16d10 + 96",speed:"20 ft., fly 30 ft.",stats:[21,10,22,19,12,15],saves:[{constitution:11},{intelligence:9},{wisdom:6},{charisma:7}],damage_vulnerabilities:"",damage_resistances:"cold, fire, lightning; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"poison",condition_immunities:"poisoned",senses:"truesight 120 ft., passive Perception 11",languages:"Abyssal, telepathy 120 ft.",cr:"13",traits:[{name:"Magic Resistance",desc:"The nalfeshnee has advantage on saving throws against spells and other magical effects.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The nalfeshnee uses Horror Nimbus if it can. It then makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +10 to hit, reach 5 ft., one target. Hit: 32 (5d10 + 5) piercing damage.",attack_bonus:10,damage_dice:"5d10",damage_bonus:5},{name:"Claw",desc:"Melee Weapon Attack: +10 to hit, reach 10 ft., one target. Hit: 15 (3d6 + 5) slashing damage.",attack_bonus:10,damage_dice:"3d6",damage_bonus:5},{name:"Horror Nimbus (Recharge 5-6)",desc:"The nalfeshnee magically emits scintillating, multicolored light. Each creature within 15 feet of the nalfeshnee that can see the light must succeed on a DC 15 Wisdom saving throw or be frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the nalfeshnee's Horror Nimbus for the next 24 hours.",attack_bonus:0},{name:"Teleport",desc:"The nalfeshnee magically teleports, along with any equipment it is wearing or carrying, up to 120 feet to an unoccupied space it can see.",attack_bonus:0},{name:"Variant: Summon Demon (1/Day)",desc:"The demon chooses what to summon and attempts a magical summoning.\\nA nalfeshnee has a 50 percent chance of summoning 1d4 vrocks, 1d3 hezrous, 1d2 glabrezus, or one nalfeshnee.\\nA summoned demon appears in an unoccupied space within 60 feet of its summoner, acts as an ally of its summoner, and can't summon other demons. It remains for 1 minute, until it or its summoner dies, or until its summoner dismisses it as an action.",attack_bonus:0}]},{name:"Night Hag",size:"Medium",type:"fiend",subtype:"",alignment:"neutral evil",ac:17,hp:112,hit_dice:"15d8 + 44",speed:"30 ft.",stats:[18,15,16,16,14,16],skillsaves:[{deception:7},{insight:6},{perception:6},{stealth:6}],damage_vulnerabilities:"",damage_resistances:"cold, fire; bludgeoning, piercing, and slashing from nonmagical weapons that aren't silvered",damage_immunities:"",condition_immunities:"charmed",senses:"darkvision 120 ft., passive Perception 16",languages:"Abyssal, Common, Infernal, Primordial",cr:"5",traits:[{name:"Innate Spellcasting",desc:"The hag's innate spellcasting ability is Charisma (spell save DC 14, +6 to hit with spell attacks). She can innately cast the following spells, requiring no material components:\\n\\nAt will: detect magic, magic missile\\n2/day each: plane shift (self only), ray of enfeeblement, sleep",attack_bonus:0},{name:"Magic Resistance",desc:"The hag has advantage on saving throws against spells and other magical effects.",attack_bonus:0},{name:"Night Hag Items",desc:"A night hag carries two very rare magic items that she must craft for herself If either object is lost, the night hag will go to great lengths to retrieve it, as creating a new tool takes time and effort.\\nHeartstone: This lustrous black gem allows a night hag to become ethereal while it is in her possession. The touch of a heartstone also cures any disease. Crafting a heartstone takes 30 days.\\nSoul Bag: When an evil humanoid dies as a result of a night hag's Nightmare Haunting, the hag catches the soul in this black sack made of stitched flesh. A soul bag can hold only one evil soul at a time, and only the night hag who crafted the bag can catch a soul with it. Crafting a soul bag takes 7 days and a humanoid sacrifice (whose flesh is used to make the bag).",attack_bonus:0},{name:"Hag Coven",desc:"When hags must work together, they form covens, in spite of their selfish natures. A coven is made up of hags of any type, all of whom are equals within the group. However, each of the hags continues to desire more personal power.\\nA coven consists of three hags so that any arguments between two hags can be settled by the third. If more than three hags ever come together, as might happen if two covens come into conflict, the result is usually chaos.",attack_bonus:0},{name:"Shared Spellcasting (Coven Only)",desc:"While all three members of a hag coven are within 30 feet of one another, they can each cast the following spells from the wizard's spell list but must share the spell slots among themselves:\\n\\n\u2022 1st level (4 slots): identify, ray of sickness\\n\u2022 2nd level (3 slots): hold person, locate object\\n\u2022 3rd level (3 slots): bestow curse, counterspell, lightning bolt\\n\u2022 4th level (3 slots): phantasmal killer, polymorph\\n\u2022 5th level (2 slots): contact other plane, scrying\\n\u2022 6th level (1 slot): eye bite\\n\\nFor casting these spells, each hag is a 12th-level spellcaster that uses Intelligence as her spellcasting ability. The spell save DC is 12+the hag's Intelligence modifier, and the spell attack bonus is 4+the hag's Intelligence modifier.",attack_bonus:0},{name:"Hag Eye (Coven Only)",desc:"A hag coven can craft a magic item called a hag eye, which is made from a real eye coated in varnish and often fitted to a pendant or other wearable item. The hag eye is usually entrusted to a minion for safekeeping and transport. A hag in the coven can take an action to see what the hag eye sees if the hag eye is on the same plane of existence. A hag eye has AC 10, 1 hit point, and darkvision with a radius of 60 feet. If it is destroyed, each coven member takes 3d10 psychic damage and is blinded for 24 hours.\\nA hag coven can have only one hag eye at a time, and creating a new one requires all three members of the coven to perform a ritual. The ritual takes 1 hour, and the hags can't perform it while blinded. During the ritual, if the hags take any action other than performing the ritual, they must start over.",attack_bonus:0}],actions:[{name:"Claws (Hag Form Only)",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) slashing damage.",attack_bonus:7,damage_dice:"2d8",damage_bonus:4},{name:"Change Shape",desc:"The hag magically polymorphs into a Small or Medium female humanoid, or back into her true form. Her statistics are the same in each form. Any equipment she is wearing or carrying isn't transformed. She reverts to her true form if she dies.",attack_bonus:0},{name:"Etherealness",desc:"The hag magically enters the Ethereal Plane from the Material Plane, or vice versa. To do so, the hag must have a heartstone in her possession.",attack_bonus:0},{name:"Nightmare Haunting (1/Day)",desc:"While on the Ethereal Plane, the hag magically touches a sleeping humanoid on the Material Plane. A protection from evil and good spell cast on the target prevents this contact, as does a magic circle. As long as the contact persists, the target has dreadful visions. If these visions last for at least 1 hour, the target gains no benefit from its rest, and its hit point maximum is reduced by 5 (1d10). If this effect reduces the target's hit point maximum to 0, the target dies, and if the target was evil, its soul is trapped in the hag's soul bag. The reduction to the target's hit point maximum lasts until removed by the greater restoration spell or similar magic.",attack_bonus:0}]},{name:"Nightmare",size:"Large",type:"fiend",subtype:"",alignment:"neutral evil",ac:13,hp:68,hit_dice:"8d10 + 24",speed:"60 ft., fly 90 ft.",stats:[18,15,16,10,13,15],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire",condition_immunities:"",senses:"passive Perception 11",languages:"understands Abyssal, Common, and Infernal but can't speak",cr:"3",traits:[{name:"Confer Fire Resistance",desc:"The nightmare can grant resistance to fire damage to anyone riding it.",attack_bonus:0},{name:"Illumination",desc:"The nightmare sheds bright light in a 10-foot radius and dim light for an additional 10 feet.",attack_bonus:0}],actions:[{name:"Hooves",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) bludgeoning damage plus 7 (2d6) fire damage.",attack_bonus:6,damage_dice:"2d8 + 2d6",damage_bonus:4},{name:"Ethereal Stride",desc:"The nightmare and up to three willing creatures within 5 feet of it magically enter the Ethereal Plane from the Material Plane, or vice versa.",attack_bonus:0}]},{name:"Noble",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any alignment",ac:15,hp:9,hit_dice:"2d8",speed:"30 ft.",stats:[11,12,11,12,14,16],skillsaves:[{deception:5},{insight:4},{persuasion:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 12",languages:"any two languages",cr:"1/8",actions:[{name:"Rapier",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 5 (1d8 + 1) piercing damage.",attack_bonus:3,damage_dice:"1d8",damage_bonus:1}],reactions:[{name:"Parry",desc:"The noble adds 2 to its AC against one melee attack that would hit it. To do so, the noble must see the attacker and be wielding a melee weapon.",attack_bonus:0}]},{name:"Ochre Jelly",size:"Large",type:"ooze",subtype:"",alignment:"unaligned",ac:8,hp:45,hit_dice:"6d10 + 12",speed:"10 ft., climb 10 ft.",stats:[15,6,14,2,6,1],damage_vulnerabilities:"",damage_resistances:"acid",damage_immunities:"lightning, slashing",condition_immunities:"blinded, charmed, deafened, exhaustion, frightened, prone",senses:"blindsight 60 ft. (blind beyond this radius), passive Perception 8",languages:"",cr:"2",traits:[{name:"Amorphous",desc:"The jelly can move through a space as narrow as 1 inch wide without squeezing.",attack_bonus:0},{name:"Spider Climb",desc:"The jelly can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",attack_bonus:0}],actions:[{name:"Pseudopod",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 9 (2d6 + 2) bludgeoning damage plus 3 (1d6) acid damage.",attack_bonus:4,damage_dice:"2d6",damage_bonus:2}],reactions:[{name:"Split",desc:"When a jelly that is Medium or larger is subjected to lightning or slashing damage, it splits into two new jellies if it has at least 10 hit points. Each new jelly has hit points equal to half the original jelly's, rounded down. New jellies are one size smaller than the original jelly.",attack_bonus:0}]},{name:"Octopus",size:"Small",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:3,hit_dice:"1d6 + -1",speed:"5 ft., swim 30 ft.",stats:[4,15,11,3,10,4],skillsaves:[{perception:2},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 30 ft., passive Perception 12",languages:"",cr:"0",traits:[{name:"Hold Breath",desc:"While out of water, the octopus can hold its breath for 30 minutes.",attack_bonus:0},{name:"Underwater Camouflage",desc:"The octopus has advantage on Dexterity (Stealth) checks made while underwater.",attack_bonus:0},{name:"Water Breathing",desc:"The octopus can breathe only underwater.",attack_bonus:0}],actions:[{name:"Tentacles",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 1 bludgeoning damage, and the target is grappled (escape DC 10). Until this grapple ends, the octopus can't use its tentacles on another target.",attack_bonus:4,damage_bonus:1},{name:"Ink Cloud (Recharges after a Short or Long Rest)",desc:"A 5-foot-radius cloud of ink extends all around the octopus if it is underwater. The area is heavily obscured for 1 minute, although a significant current can disperse the ink. After releasing the ink, the octopus can use the Dash action as a bonus action.",attack_bonus:0}]},{name:"Ogre",size:"Large",type:"giant",subtype:"",alignment:"chaotic evil",ac:11,hp:59,hit_dice:"7d10 + 20",speed:"40 ft.",stats:[19,8,16,5,7,7],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 8",languages:"Common, Giant",cr:"2",actions:[{name:"Greatclub",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) bludgeoning damage.",attack_bonus:6,damage_dice:"2d8",damage_bonus:4},{name:"Javelin",desc:"Melee or Ranged Weapon Attack: +6 to hit, reach 5 ft. or range 30/120 ft., one target. Hit: 11 (2d6 + 4) piercing damage.",attack_bonus:6,damage_dice:"2d6",damage_bonus:4}]},{name:"Ogre Zombie",size:"Large",type:"undead",subtype:"",alignment:"neutral evil",ac:8,hp:85,hit_dice:"9d10 + 35",speed:"30 ft.",stats:[19,6,18,3,6,5],saves:[{wisdom:0}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"poison",condition_immunities:"poisoned",senses:"darkvision 60 ft., passive Perception 8",languages:"understands Common and Giant but can't speak",cr:"2",traits:[{name:"Undead Fortitude",desc:"If damage reduces the zombie to 0 hit points, it must make a Constitution saving throw with a DC of 5+the damage taken, unless the damage is radiant or from a critical hit. On a success, the zombie drops to 1 hit point instead.",attack_bonus:0}],actions:[{name:"Morningstar",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) bludgeoning damage.",attack_bonus:6,damage_dice:"2d8",damage_bonus:4}]},{name:"Oni",size:"Large",type:"giant",subtype:"",alignment:"lawful evil",ac:16,hp:110,hit_dice:"13d10 + 38",speed:"30 ft., fly 30 ft.",stats:[19,11,16,14,12,15],saves:[{dexterity:3},{constitution:6},{wisdom:4},{charisma:5}],skillsaves:[{arcana:5},{deception:8},{perception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 14",languages:"Common, Giant",cr:"7",traits:[{name:"Innate Spellcasting",desc:"The oni's innate spellcasting ability is Charisma (spell save DC 13). The oni can innately cast the following spells, requiring no material components:\\n\\nAt will: darkness, invisibility\\n1/day each: charm person, cone of cold, gaseous form, sleep",attack_bonus:0},{name:"Magic Weapons",desc:"The oni's weapon attacks are magical.",attack_bonus:0},{name:"Regeneration",desc:"The oni regains 10 hit points at the start of its turn if it has at least 1 hit point.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The oni makes two attacks, either with its claws or its glaive.",attack_bonus:0},{name:"Claw (Oni Form Only)",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 8 (1d8 + 4) slashing damage.",attack_bonus:7,damage_dice:"1d8",damage_bonus:4},{name:"Glaive",desc:"Melee Weapon Attack: +7 to hit, reach 10 ft., one target. Hit: 15 (2d10 + 4) slashing damage, or 9 (1d10 + 4) slashing damage in Small or Medium form.",attack_bonus:7,damage_dice:"2d10",damage_bonus:4},{name:"Change Shape",desc:"The oni magically polymorphs into a Small or Medium humanoid, into a Large giant, or back into its true form. Other than its size, its statistics are the same in each form. The only equipment that is transformed is its glaive, which shrinks so that it can be wielded in humanoid form. If the oni dies, it reverts to its true form, and its glaive reverts to its normal size.",attack_bonus:0}]},{name:"Orc",size:"Medium",type:"humanoid",subtype:"orc",alignment:"chaotic evil",ac:13,hp:15,hit_dice:"2d8 + 6",speed:"30 ft.",stats:[16,12,16,7,11,10],skillsaves:[{intimidation:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 10",languages:"Common, Orc",cr:"1/2",traits:[{name:"Aggressive",desc:"As a bonus action, the orc can move up to its speed toward a hostile creature that it can see.",attack_bonus:0}],actions:[{name:"Greataxe",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 9 (1d12 + 3) slashing damage.",attack_bonus:5,damage_dice:"1d12",damage_bonus:3},{name:"Javelin",desc:"Melee or Ranged Weapon Attack: +5 to hit, reach 5 ft. or range 30/120 ft., one target. Hit: 6 (1d6 + 3) piercing damage.",attack_bonus:5,damage_dice:"1d6",damage_bonus:3}]},{name:"Otyugh",size:"Large",type:"aberration",subtype:"",alignment:"neutral",ac:14,hp:114,hit_dice:"12d10 + 48",speed:"30 ft.",stats:[16,11,19,6,13,6],saves:[{constitution:7}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 120 ft., passive Perception 11",languages:"Otyugh",cr:"5",traits:[{name:"Limited Telepathy",desc:"The otyugh can magically transmit simple messages and images to any creature within 120 ft. of it that can understand a language. This form of telepathy doesn't allow the receiving creature to telepathically respond.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The otyugh makes three attacks: one with its bite and two with its tentacles.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 12 (2d8 + 3) piercing damage. If the target is a creature, it must succeed on a DC 15 Constitution saving throw against disease or become poisoned until the disease is cured. Every 24 hours that elapse, the target must repeat the saving throw, reducing its hit point maximum by 5 (1d10) on a failure. The disease is cured on a success. The target dies if the disease reduces its hit point maximum to 0. This reduction to the target's hit point maximum lasts until the disease is cured.",attack_bonus:6,damage_dice:"2d8",damage_bonus:3},{name:"Tentacle",desc:"Melee Weapon Attack: +6 to hit, reach 10 ft., one target. Hit: 7 (1d8 + 3) bludgeoning damage plus 4 (1d8) piercing damage. If the target is Medium or smaller, it is grappled (escape DC 13) and restrained until the grapple ends. The otyugh has two tentacles, each of which can grapple one target.",attack_bonus:6,damage_dice:"1d8",damage_bonus:3},{name:"Tentacle Slam",desc:"The otyugh slams creatures grappled by it into each other or a solid surface. Each creature must succeed on a DC 14 Constitution saving throw or take 10 (2d6 + 3) bludgeoning damage and be stunned until the end of the otyugh's next turn. On a successful save, the target takes half the bludgeoning damage and isn't stunned.",attack_bonus:0}]},{name:"Owl",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:11,hp:1,hit_dice:"1d4 + -2",speed:"5 ft., fly 60 ft.",stats:[3,13,8,2,12,7],skillsaves:[{perception:3},{stealth:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 120 ft., passive Perception 13",languages:"",cr:"0",traits:[{name:"Flyby",desc:"The owl doesn't provoke opportunity attacks when it flies out of an enemy's reach.",attack_bonus:0},{name:"Keen Hearing and Sight",desc:"The owl has advantage on Wisdom (Perception) checks that rely on hearing or sight.",attack_bonus:0}],actions:[{name:"Talons",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 1 slashing damage.",attack_bonus:3,damage_bonus:1}]},{name:"Owlbear",size:"Large",type:"monstrosity",subtype:"",alignment:"unaligned",ac:13,hp:59,hit_dice:"7d10 + 20",speed:"40 ft.",stats:[20,12,17,3,12,7],skillsaves:[{perception:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 13",languages:"",cr:"3",traits:[{name:"Keen Sight and Smell",desc:"The owlbear has advantage on Wisdom (Perception) checks that rely on sight or smell.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The owlbear makes two attacks: one with its beak and one with its claws.",attack_bonus:0},{name:"Beak",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one creature. Hit: 10 (1d10 + 5) piercing damage.",attack_bonus:7,damage_dice:"1d10",damage_bonus:5},{name:"Claws",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 14 (2d8 + 5) slashing damage.",attack_bonus:7,damage_dice:"2d8",damage_bonus:5}]},{name:"Panther",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:13,hit_dice:"3d8 + -1",speed:"50 ft., climb 40 ft.",stats:[14,15,10,3,14,7],skillsaves:[{perception:4},{stealth:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 14",languages:"",cr:"1/4",traits:[{name:"Keen Smell",desc:"The panther has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0},{name:"Pounce",desc:"If the panther moves at least 20 ft. straight toward a creature and then hits it with a claw attack on the same turn, that target must succeed on a DC 12 Strength saving throw or be knocked prone. If the target is prone, the panther can make one bite attack against it as a bonus action.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2},{name:"Claw",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 4 (1d4 + 2) slashing damage.",attack_bonus:4,damage_dice:"1d4",damage_bonus:2}]},{name:"Pegasus",size:"Large",type:"celestial",subtype:"",alignment:"chaotic good",ac:12,hp:59,hit_dice:"7d10 + 20",speed:"60 ft., fly 90 ft.",stats:[18,15,16,10,15,13],saves:[{dexterity:4},{wisdom:4},{charisma:3}],skillsaves:[{perception:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 16",languages:"understands Celestial, Common, Elvish, and Sylvan but can't speak",cr:"2",actions:[{name:"Hooves",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) bludgeoning damage.",attack_bonus:6,damage_dice:"2d6",damage_bonus:4}]},{name:"Phase Spider",size:"Large",type:"monstrosity",subtype:"",alignment:"unaligned",ac:13,hp:32,hit_dice:"5d10 + 4",speed:"30 ft., climb 30 ft.",stats:[15,15,12,6,10,6],skillsaves:[{stealth:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 10",languages:"",cr:"3",traits:[{name:"Ethereal Jaunt",desc:"As a bonus action, the spider can magically shift from the Material Plane to the Ethereal Plane, or vice versa.",attack_bonus:0},{name:"Spider Climb",desc:"The spider can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",attack_bonus:0},{name:"Web Walker",desc:"The spider ignores movement restrictions caused by webbing.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 7 (1d10 + 2) piercing damage, and the target must make a DC 11 Constitution saving throw, taking 18 (4d8) poison damage on a failed save, or half as much damage on a successful one. If the poison damage reduces the target to 0 hit points, the target is stable but poisoned for 1 hour, even after regaining hit points, and is paralyzed while poisoned in this way.",attack_bonus:4,damage_dice:"1d10",damage_bonus:2}]},{name:"Pit Fiend",size:"Large",type:"fiend",subtype:"devil",alignment:"lawful evil",ac:19,hp:300,hit_dice:"24d10 + 168",speed:"30 ft., fly 60 ft.",stats:[26,14,24,22,18,24],saves:[{dexterity:8},{constitution:13},{wisdom:10}],damage_vulnerabilities:"",damage_resistances:"cold; bludgeoning, piercing, and slashing from nonmagical weapons that aren't silvered",damage_immunities:"fire, poison",condition_immunities:"poisoned",senses:"truesight 120 ft., passive Perception 14",languages:"Infernal, telepathy 120 ft.",cr:"20",traits:[{name:"Fear Aura",desc:"Any creature hostile to the pit fiend that starts its turn within 20 feet of the pit fiend must make a DC 21 Wisdom saving throw, unless the pit fiend is incapacitated. On a failed save, the creature is frightened until the start of its next turn. If a creature's saving throw is successful, the creature is immune to the pit fiend's Fear Aura for the next 24 hours.",attack_bonus:0},{name:"Magic Resistance",desc:"The pit fiend has advantage on saving throws against spells and other magical effects.",attack_bonus:0},{name:"Magic Weapons",desc:"The pit fiend's weapon attacks are magical.",attack_bonus:0},{name:"Innate Spellcasting",desc:"The pit fiend's spellcasting ability is Charisma (spell save DC 21). The pit fiend can innately cast the following spells, requiring no material components:\\nAt will: detect magic, fireball\\n3/day each: hold monster, wall of fire",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The pit fiend makes four attacks: one with its bite, one with its claw, one with its mace, and one with its tail.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +14 to hit, reach 5 ft., one target. Hit: 22 (4d6 + 8) piercing damage. The target must succeed on a DC 21 Constitution saving throw or become poisoned. While poisoned in this way, the target can't regain hit points, and it takes 21 (6d6) poison damage at the start of each of its turns. The poisoned target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",attack_bonus:14,damage_dice:"4d6",damage_bonus:8},{name:"Claw",desc:"Melee Weapon Attack: +14 to hit, reach 10 ft. , one target. Hit: 17 (2d8 + 8) slashing damage.",attack_bonus:14,damage_dice:"2d8",damage_bonus:8},{name:"Mace",desc:"Melee Weapon Attack: +14 to hit, reach 10ft., one target. Hit: 15 (2d6 + 8) bludgeoning damage plus 21 (6d6) fire damage.",attack_bonus:14,damage_dice:"2d6",damage_bonus:8},{name:"Tail",desc:"Melee Weapon Attack: +14 to hit, reach 10ft., one target. Hit: 24 (3d1O + 8) bludgeoning damage.",attack_bonus:14,damage_dice:"3d10",damage_bonus:8}]},{name:"Planetar",size:"Large",type:"celestial",subtype:"",alignment:"lawful good",ac:19,hp:200,hit_dice:"16d10 + 112",speed:"40 ft., fly 120 ft.",stats:[24,20,24,19,22,25],saves:[{constitution:12},{wisdom:11},{charisma:12}],skillsaves:[{perception:11}],damage_vulnerabilities:"",damage_resistances:"radiant; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"",condition_immunities:"charmed, exhaustion, frightened",senses:"truesight 120 ft., passive Perception 21",languages:"all, telepathy 120 ft.",cr:"16",traits:[{name:"Angelic Weapons",desc:"The planetar's weapon attacks are magical. When the planetar hits with any weapon, the weapon deals an extra 5d8 radiant damage (included in the attack).",attack_bonus:0},{name:"Divine Awareness",desc:"The planetar knows if it hears a lie.",attack_bonus:0},{name:"Innate Spellcasting",desc:"The planetar's spellcasting ability is Charisma (spell save DC 20). The planetar can innately cast the following spells, requiring no material components:\\nAt will: detect evil and good, invisibility (self only)\\n3/day each: blade barrier, dispel evil and good, flame strike, raise dead\\n1/day each: commune, control weather, insect plague",attack_bonus:0},{name:"Magic Resistance",desc:"The planetar has advantage on saving throws against spells and other magical effects.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The planetar makes two melee attacks.",attack_bonus:0},{name:"Greatsword",desc:"Melee Weapon Attack: +12 to hit, reach 5 ft., one target. Hit: 21 (4d6 + 7) slashing damage plus 22 (5d8) radiant damage.",attack_bonus:12,damage_dice:"4d6 + 5d8",damage_bonus:7},{name:"Healing Touch (4/Day)",desc:"The planetar touches another creature. The target magically regains 30 (6d8 + 3) hit points and is freed from any curse, disease, poison, blindness, or deafness.",attack_bonus:0}]},{name:"Plesiosaurus",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:13,hp:68,hit_dice:"8d10 + 24",speed:"20 ft., swim 40 ft.",stats:[18,15,16,2,12,5],skillsaves:[{perception:3},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"",cr:"2",traits:[{name:"Hold Breath",desc:"The plesiosaurus can hold its breath for 1 hour.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +6 to hit, reach 10 ft., one target. Hit: 14 (3d6 + 4) piercing damage.",attack_bonus:6,damage_dice:"3d6",damage_bonus:4}]},{name:"Poisonous Snake",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:13,hp:2,hit_dice:"1d4 + -1",speed:"30 ft., swim 30 ft.",stats:[2,16,11,1,10,3],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 10 ft., passive Perception 10",languages:"",cr:"1/8",actions:[{name:"Bite",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 1 piercing damage, and the target must make a DC 10 Constitution saving throw, taking 5 (2d4) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:5,damage_bonus:1}]},{name:"Polar Bear",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:42,hit_dice:"5d10 + 14",speed:"40 ft., swim 30 ft.",stats:[20,10,16,2,13,7],skillsaves:[{perception:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"",cr:"2",traits:[{name:"Keen Smell",desc:"The bear has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The bear makes two attacks: one with its bite and one with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 9 (1d8 + 5) piercing damage.",attack_bonus:7,damage_dice:"1d8",damage_bonus:5},{name:"Claws",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 12 (2d6 + 5) slashing damage.",attack_bonus:7,damage_dice:"2d6",damage_bonus:5}]},{name:"Pony",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:10,hp:11,hit_dice:"2d8 + 2",speed:"40 ft.",stats:[15,10,13,2,11,7],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"",cr:"1/8",actions:[{name:"Hooves",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (2d4 + 2) bludgeoning damage.",attack_bonus:4,damage_dice:"2d4",damage_bonus:2}]},{name:"Priest",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any alignment",ac:13,hp:27,hit_dice:"5d8 + 4",speed:"25 ft.",stats:[10,10,12,13,16,13],skillsaves:[{medicine:7},{persuasion:3},{religion:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"any two languages",cr:"2",traits:[{name:"Divine Eminence",desc:"As a bonus action, the priest can expend a spell slot to cause its melee weapon attacks to magically deal an extra 10 (3d6) radiant damage to a target on a hit. This benefit lasts until the end of the turn. If the priest expends a spell slot of 2nd level or higher, the extra damage increases by 1d6 for each level above 1st.",attack_bonus:0,damage_dice:"3d6"}],actions:[{name:"Mace",desc:"Melee Weapon Attack: +2 to hit, reach 5 ft., one target. Hit: 3 (1d6) bludgeoning damage.",attack_bonus:2,damage_dice:"1d6"}],spells:["The priest is a 5th-level spellcaster. Its spellcasting ability is Wisdom (spell save DC 13, +5 to hit with spell attacks). The priest has the following cleric spells prepared:",{"Cantrips (at will)":"light, sacred flame, thaumaturgy"},{"1st level (4 slots)":"cure wounds, guiding bolt, sanctuary"},{"2nd level (3 slots)":"lesser restoration, spiritual weapon"},{"3rd level (2 slots)":"dispel magic, spirit guardians"}]},{name:"Pseudodragon",size:"Tiny",type:"dragon",subtype:"",alignment:"neutral good",ac:13,hp:7,hit_dice:"2d4 + 2",speed:"15 ft., fly 60 ft.",stats:[6,15,13,10,12,10],skillsaves:[{perception:3},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 10 ft., darkvision 60 ft., passive Perception 13",languages:"understands Common and Draconic but can't speak",cr:"1/4",traits:[{name:"Keen Senses",desc:"The pseudodragon has advantage on Wisdom (Perception) checks that rely on sight, hearing, or smell.",attack_bonus:0},{name:"Magic Resistance",desc:"The pseudodragon has advantage on saving throws against spells and other magical effects.",attack_bonus:0},{name:"Limited Telepathy",desc:"The pseudodragon can magically communicate simple ideas, emotions, and images telepathically with any creature within 100 ft. of it that can understand a language.",attack_bonus:0},{name:"Variant: Familiar",desc:"The pseudodragon can serve another creature as a familiar, forming a magic, telepathic bond with that willing companion. While the two are bonded, the companion can sense what the pseudodragon senses as long as they are within 1 mile of each other. While the pseudodragon is within 10 feet of its companion, the companion shares the pseudodragon's Magic Resistance trait. At any time and for any reason, the pseudodragon can end its service as a familiar, ending the telepathic bond.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 4 (1d4 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d4",damage_bonus:2},{name:"Sting",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 4 (1d4 + 2) piercing damage, and the target must succeed on a DC 11 Constitution saving throw or become poisoned for 1 hour. If the saving throw fails by 5 or more, the target falls unconscious for the same duration, or until it takes damage or another creature uses an action to shake it awake.",attack_bonus:4,damage_dice:"1d4",damage_bonus:2}]},{name:"Purple Worm",size:"Gargantuan",type:"monstrosity",subtype:"",alignment:"unaligned",ac:18,hp:247,hit_dice:"15d20 + 89",speed:"50 ft., burrow 30 ft.",stats:[28,7,22,1,8,4],saves:[{constitution:11},{wisdom:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 30 ft., tremorsense 60 ft., passive Perception 9",languages:"",cr:"15",traits:[{name:"Tunneler",desc:"The worm can burrow through solid rock at half its burrow speed and leaves a 10-foot-diameter tunnel in its wake.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The worm makes two attacks: one with its bite and one with its stinger.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +9 to hit, reach 10 ft., one target. Hit: 22 (3d8 + 9) piercing damage. If the target is a Large or smaller creature, it must succeed on a DC 19 Dexterity saving throw or be swallowed by the worm. A swallowed creature is blinded and restrained, it has total cover against attacks and other effects outside the worm, and it takes 21 (6d6) acid damage at the start of each of the worm's turns.\\nIf the worm takes 30 damage or more on a single turn from a creature inside it, the worm must succeed on a DC 21 Constitution saving throw at the end of that turn or regurgitate all swallowed creatures, which fall prone in a space within 10 feet of the worm. If the worm dies, a swallowed creature is no longer restrained by it and can escape from the corpse by using 20 feet of movement, exiting prone.",attack_bonus:9,damage_dice:"3d8",damage_bonus:9},{name:"Tail Stinger",desc:"Melee Weapon Attack: +9 to hit, reach 10 ft., one creature. Hit: 19 (3d6 + 9) piercing damage, and the target must make a DC 19 Constitution saving throw, taking 42 (12d6) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:9,damage_dice:"3d6",damage_bonus:9}]},{name:"Quasit",size:"Tiny",type:"fiend",subtype:"demon",alignment:"chaotic evil",ac:13,hp:7,hit_dice:"3d4 + -1",speed:"40 ft.",stats:[5,17,10,7,10,10],skillsaves:[{stealth:5}],damage_vulnerabilities:"",damage_resistances:"cold; fire; lightning; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"poison",condition_immunities:"poisoned",senses:"darkvision 120 ft., passive Perception 10",languages:"Abyssal, Common",cr:"1",traits:[{name:"Shapechanger",desc:"The quasit can use its action to polymorph into a beast form that resembles a bat (speed 10 ft. fly 40 ft.), a centipede (40 ft., climb 40 ft.), or a toad (40 ft., swim 40 ft.), or back into its true form . Its statistics are the same in each form, except for the speed changes noted. Any equipment it is wearing or carrying isn't transformed . It reverts to its true form if it dies.",attack_bonus:0},{name:"Magic Resistance",desc:"The quasit has advantage on saving throws against spells and other magical effects.",attack_bonus:0},{name:"Variant: Familiar",desc:"The quasit can serve another creature as a familiar, forming a telepathic bond with its willing master. While the two are bonded, the master can sense what the quasit senses as long as they are within 1 mile of each other. While the quasit is within 10 feet of its master, the master shares the quasit's Magic Resistance trait. At any time and for any reason, the quasit can end its service as a familiar, ending the telepathic bond.",attack_bonus:0}],actions:[{name:"Claw (Bite in Beast Form)",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft ., one target. Hit: 5 (1d4 + 3) piercing damage, and the target must succeed on a DC 10 Constitution saving throw or take 5 (2d4) poison damage and become poisoned for 1 minute. The target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",attack_bonus:4,damage_dice:"1d4",damage_bonus:3},{name:"Scare (1/day)",desc:"One creature of the quasit's choice within 20 ft. of it must succeed on a DC 10 Wisdom saving throw or be frightened for 1 minute. The target can repeat the saving throw at the end of each of its turns, with disadvantage if the quasit is within line of sight, ending the effect on itself on a success.",attack_bonus:0},{name:"Invisibility",desc:"The quasit magically turns invisible until it attacks or uses Scare, or until its concentration ends (as if concentrating on a spell). Any equipment the quasit wears or carries is invisible with it.",attack_bonus:0}]},{name:"Quipper",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:13,hp:1,hit_dice:"1d4 + -2",speed:"swim 40 ft.",stats:[2,16,9,1,7,2],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 8",languages:"",cr:"0",traits:[{name:"Blood Frenzy",desc:"The quipper has advantage on melee attack rolls against any creature that doesn't have all its hit points.",attack_bonus:0},{name:"Water Breathing",desc:"The quipper can breathe only underwater.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 1 piercing damage.",attack_bonus:5,damage_bonus:1}]},{name:"Rakshasa",size:"Medium",type:"fiend",subtype:"",alignment:"lawful evil",ac:16,hp:110,hit_dice:"13d8 + 51",speed:"40 ft.",stats:[14,17,18,13,16,20],skillsaves:[{deception:10},{insight:8}],damage_vulnerabilities:"piercing from magic weapons wielded by good creatures",damage_resistances:"",damage_immunities:"bludgeoning, piercing, and slashing from nonmagical weapons",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 13",languages:"Common, Infernal",cr:"13",traits:[{name:"Limited Magic Immunity",desc:"The rakshasa can't be affected or detected by spells of 6th level or lower unless it wishes to be. It has advantage on saving throws against all other spells and magical effects.",attack_bonus:0},{name:"Innate Spellcasting",desc:"The rakshasa's innate spellcasting ability is Charisma (spell save DC 18, +10 to hit with spell attacks). The rakshasa can innately cast the following spells, requiring no material components:\\n\\nAt will: detect thoughts, disguise self, mage hand, minor illusion\\n3/day each: charm person, detect magic, invisibility, major image, suggestion\\n1/day each: dominate person, fly, plane shift, true seeing",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The rakshasa makes two claw attacks",attack_bonus:0},{name:"Claw",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 9 (2d6 + 2) slashing damage, and the target is cursed if it is a creature. The magical curse takes effect whenever the target takes a short or long rest, filling the target's thoughts with horrible images and dreams. The cursed target gains no benefit from finishing a short or long rest. The curse lasts until it is lifted by a remove curse spell or similar magic.",attack_bonus:7,damage_dice:"2d6",damage_bonus:2}]},{name:"Rat",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:10,hp:1,hit_dice:"1d4 + -2",speed:"20 ft.",stats:[2,11,9,2,10,4],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 30 ft., passive Perception 10",languages:"",cr:"0",traits:[{name:"Keen Smell",desc:"The rat has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +0 to hit, reach 5 ft., one target. Hit: 1 piercing damage.",attack_bonus:0,damage_bonus:1}]},{name:"Raven",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:1,hit_dice:"1d4 + -2",speed:"10 ft., fly 50 ft.",stats:[2,14,8,2,12,6],skillsaves:[{perception:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"",cr:"0",traits:[{name:"Mimicry",desc:"The raven can mimic simple sounds it has heard, such as a person whispering, a baby crying, or an animal chittering. A creature that hears the sounds can tell they are imitations with a successful DC 10 Wisdom (Insight) check.",attack_bonus:0}],actions:[{name:"Beak",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 1 piercing damage.",attack_bonus:0}]},{name:"Red Dragon Wyrmling",size:"Medium",type:"dragon",subtype:"",alignment:"chaotic evil",ac:17,hp:75,hit_dice:"10d8 + 30",speed:"30 ft., climb 30 ft., fly 60 ft.",stats:[19,10,17,12,11,15],saves:[{dexterity:2},{constitution:5},{wisdom:2},{charisma:4}],skillsaves:[{perception:4},{stealth:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire",condition_immunities:"",senses:"blindsight 10 ft., darkvision 60 ft., passive Perception 14",languages:"Draconic",cr:"4",actions:[{name:"Bite",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 9 (1d10 + 4) piercing damage plus 3 (1d6) fire damage.",attack_bonus:6,damage_dice:"1d10 + 1d6",damage_bonus:4},{name:"Fire Breath (Recharge 5-6)",desc:"The dragon exhales fire in a 15-foot cone. Each creature in that area must make a DC 13 Dexterity saving throw, taking 24 (7d6) fire damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"7d6"}]},{name:"Reef Shark",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:22,hit_dice:"4d8 + 4",speed:"swim 40 ft.",stats:[14,13,13,1,10,4],skillsaves:[{perception:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 30 ft., passive Perception 12",languages:"",cr:"1/2",traits:[{name:"Pack Tactics",desc:"The shark has advantage on an attack roll against a creature if at least one of the shark's allies is within 5 ft. of the creature and the ally isn't incapacitated.",attack_bonus:0},{name:"Water Breathing",desc:"The shark can breathe only underwater.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 6 (1d8 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d8",damage_bonus:2}]},{name:"Remorhaz",size:"Huge",type:"monstrosity",subtype:"",alignment:"unaligned",ac:17,hp:195,hit_dice:"17d12 + 84",speed:"30 ft., burrow 20 ft.",stats:[24,13,21,4,10,5],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"cold, fire",condition_immunities:"",senses:"darkvision 60 ft., tremorsense 60 ft., passive Perception 10",languages:"",cr:"11",traits:[{name:"Heated Body",desc:"A creature that touches the remorhaz or hits it with a melee attack while within 5 feet of it takes 10 (3d6) fire damage.",attack_bonus:0,damage_dice:"3d6"}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +11 to hit, reach 10 ft., one target. Hit: 40 (6d10 + 7) piercing damage plus 10 (3d6) fire damage. If the target is a creature, it is grappled (escape DC 17). Until this grapple ends, the target is restrained, and the remorhaz can't bite another target.",attack_bonus:11,damage_dice:"6d10 + 3d6",damage_bonus:7},{name:"Swallow",desc:"The remorhaz makes one bite attack against a Medium or smaller creature it is grappling. If the attack hits, that creature takes the bite's damage and is swallowed, and the grapple ends. While swallowed, the creature is blinded and restrained, it has total cover against attacks and other effects outside the remorhaz, and it takes 21 (6d6) acid damage at the start of each of the remorhaz's turns.\\nIf the remorhaz takes 30 damage or more on a single turn from a creature inside it, the remorhaz must succeed on a DC 15 Constitution saving throw at the end of that turn or regurgitate all swallowed creatures, which fall prone in a space within 10 feet oft he remorhaz. If the remorhaz dies, a swallowed creature is no longer restrained by it and can escape from the corpse using 15 feet of movement, exiting prone.",attack_bonus:0}]},{name:"Rhinoceros",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:11,hp:45,hit_dice:"6d10 + 12",speed:"40 ft.",stats:[21,8,15,2,12,6],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 11",languages:"",cr:"2",traits:[{name:"Charge",desc:"If the rhinoceros moves at least 20 ft. straight toward a target and then hits it with a gore attack on the same turn, the target takes an extra 9 (2d8) bludgeoning damage. If the target is a creature, it must succeed on a DC 15 Strength saving throw or be knocked prone.",attack_bonus:0,damage_dice:"2d8"}],actions:[{name:"Gore",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 14 (2d8 + 5) bludgeoning damage.",attack_bonus:7,damage_dice:"2d8",damage_bonus:5}]},{name:"Riding Horse",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:10,hp:13,hit_dice:"2d10 + 2",speed:"60 ft.",stats:[16,10,12,2,11,7],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"",cr:"1/4",actions:[{name:"Hooves",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 8 (2d4 + 3) bludgeoning damage.",attack_bonus:5,damage_dice:"2d4",damage_bonus:3}]},{name:"Roc",size:"Gargantuan",type:"monstrosity",subtype:"",alignment:"unaligned",ac:15,hp:248,hit_dice:"16d20 + 80",speed:"20 ft., fly 120 ft.",stats:[28,10,20,3,10,9],saves:[{dexterity:4},{constitution:9},{wisdom:4},{charisma:3}],skillsaves:[{perception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 14",languages:"",cr:"11",traits:[{name:"Keen Sight",desc:"The roc has advantage on Wisdom (Perception) checks that rely on sight.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The roc makes two attacks: one with its beak and one with its talons.",attack_bonus:0},{name:"Beak",desc:"Melee Weapon Attack: +13 to hit, reach 10 ft., one target. Hit: 27 (4d8 + 9) piercing damage.",attack_bonus:13,damage_dice:"4d8",damage_bonus:9},{name:"Talons",desc:"Melee Weapon Attack: +13 to hit, reach 5 ft., one target. Hit: 23 (4d6 + 9) slashing damage, and the target is grappled (escape DC 19). Until this grapple ends, the target is restrained, and the roc can't use its talons on another target.",attack_bonus:13,damage_dice:"4d6",damage_bonus:9}]},{name:"Roper",size:"Large",type:"monstrosity",subtype:"",alignment:"neutral evil",ac:20,hp:93,hit_dice:"11d10 + 32",speed:"10 ft., climb 10 ft.",stats:[18,8,17,7,16,6],skillsaves:[{perception:6},{stealth:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 16",languages:"",cr:"5",traits:[{name:"False Appearance",desc:"While the roper remains motionless, it is indistinguishable from a normal cave formation, such as a stalagmite.",attack_bonus:0},{name:"Grasping Tendrils",desc:"The roper can have up to six tendrils at a time. Each tendril can be attacked (AC 20; 10 hit points; immunity to poison and psychic damage). Destroying a tendril deals no damage to the roper, which can extrude a replacement tendril on its next turn. A tendril can also be broken if a creature takes an action and succeeds on a DC 15 Strength check against it.",attack_bonus:0},{name:"Spider Climb",desc:"The roper can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The roper makes four attacks with its tendrils, uses Reel, and makes one attack with its bite.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 22 (4d8 + 4) piercing damage.",attack_bonus:7,damage_dice:"4d8",damage_bonus:4},{name:"Tendril",desc:"Melee Weapon Attack: +7 to hit, reach 50 ft., one creature. Hit: The target is grappled (escape DC 15). Until the grapple ends, the target is restrained and has disadvantage on Strength checks and Strength saving throws, and the roper can't use the same tendril on another target.",attack_bonus:7},{name:"Reel",desc:"The roper pulls each creature grappled by it up to 25 ft. straight toward it.",attack_bonus:0}]},{name:"Rug of Smothering",size:"Large",type:"construct",subtype:"",alignment:"unaligned",ac:12,hp:33,hit_dice:"6d10",speed:"10 ft.",stats:[17,14,10,1,3,1],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"poison, psychic",condition_immunities:"blinded, charmed, deafened, frightened, paralyzed, petrified, poisoned",senses:"blindsight 60 ft. (blind beyond this radius), passive Perception 6",languages:"",cr:"2",traits:[{name:"Antimagic Susceptibility",desc:"The rug is incapacitated while in the area of an antimagic field. If targeted by dispel magic, the rug must succeed on a Constitution saving throw against the caster's spell save DC or fall unconscious for 1 minute.",attack_bonus:0},{name:"Damage Transfer",desc:"While it is grappling a creature, the rug takes only half the damage dealt to it, and the creature grappled by the rug takes the other half.",attack_bonus:0},{name:"False Appearance",desc:"While the rug remains motionless, it is indistinguishable from a normal rug.",attack_bonus:0}],actions:[{name:"Smother",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one Medium or smaller creature. Hit: The creature is grappled (escape DC 13). Until this grapple ends, the target is restrained, blinded, and at risk of suffocating, and the rug can't smother another target. In addition, at the start of each of the target's turns, the target takes 10 (2d6 + 3) bludgeoning damage.",attack_bonus:0,damage_dice:"2d6",damage_bonus:3}]},{name:"Rust Monster",size:"Medium",type:"monstrosity",subtype:"",alignment:"unaligned",ac:14,hp:27,hit_dice:"5d8 + 4",speed:"40 ft.",stats:[13,12,13,2,13,6],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 11",languages:"",cr:"1/2",traits:[{name:"Iron Scent",desc:"The rust monster can pinpoint, by scent, the location of ferrous metal within 30 feet of it.",attack_bonus:0},{name:"Rust Metal",desc:"Any nonmagical weapon made of metal that hits the rust monster corrodes. After dealing damage, the weapon takes a permanent and cumulative -1 penalty to damage rolls. If its penalty drops to -5, the weapon is destroyed. Non magical ammunition made of metal that hits the rust monster is destroyed after dealing damage.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 5 (1d8 + 1) piercing damage.",attack_bonus:3,damage_dice:"1d8",damage_bonus:1},{name:"Antennae",desc:"The rust monster corrodes a nonmagical ferrous metal object it can see within 5 feet of it. If the object isn't being worn or carried, the touch destroys a 1-foot cube of it. If the object is being worn or carried by a creature, the creature can make a DC 11 Dexterity saving throw to avoid the rust monster's touch.\\nIf the object touched is either metal armor or a metal shield being worn or carried, its takes a permanent and cumulative -1 penalty to the AC it offers. Armor reduced to an AC of 10 or a shield that drops to a +0 bonus is destroyed. If the object touched is a held metal weapon, it rusts as described in the Rust Metal trait.",attack_bonus:0}]},{name:"Saber-Toothed Tiger",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:52,hit_dice:"7d10 + 13",speed:"40 ft.",stats:[18,14,15,3,12,8],skillsaves:[{perception:3},{stealth:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"",cr:"2",traits:[{name:"Keen Smell",desc:"The tiger has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0},{name:"Pounce",desc:"If the tiger moves at least 20 ft. straight toward a creature and then hits it with a claw attack on the same turn, that target must succeed on a DC 14 Strength saving throw or be knocked prone. If the target is prone, the tiger can make one bite attack against it as a bonus action.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 10 (1d10 + 5) piercing damage.",attack_bonus:6,damage_dice:"1d10",damage_bonus:5},{name:"Claw",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 12 (2d6 + 5) slashing damage.",attack_bonus:6,damage_dice:"2d6",damage_bonus:5}]},{name:"Sahuagin",size:"Medium",type:"humanoid",subtype:"sahuagin",alignment:"lawful evil",ac:12,hp:22,hit_dice:"4d8 + 4",speed:"30 ft., swim 40 ft.",stats:[13,11,12,12,13,9],skillsaves:[{perception:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 120 ft., passive Perception 15",languages:"Sahuagin",cr:"1/2",traits:[{name:"Blood Frenzy",desc:"The sahuagin has advantage on melee attack rolls against any creature that doesn't have all its hit points.",attack_bonus:0},{name:"Limited Amphibiousness",desc:"The sahuagin can breathe air and water, but it needs to be submerged at least once every 4 hours to avoid suffocating.",attack_bonus:0},{name:"Shark Telepathy",desc:"The sahuagin can magically command any shark within 120 feet of it, using a limited telepathy.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The sahuagin makes two melee attacks: one with its bite and one with its claws or spear.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 3 (1d4 + 1) piercing damage.",attack_bonus:3,damage_dice:"1d4",damage_bonus:1},{name:"Claws",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 3 (1d4 + 1) slashing damage.",attack_bonus:3,damage_dice:"1d4",damage_bonus:1},{name:"Spear",desc:"Melee or Ranged Weapon Attack: +3 to hit, reach 5 ft. or range 20/60 ft., one target. Hit: 4 (1d6 + 1) piercing damage, or 5 (1d8 + 1) piercing damage if used with two hands to make a melee attack.",attack_bonus:3,damage_dice:"1d6",damage_bonus:1}]},{name:"Salamander",size:"Large",type:"elemental",subtype:"",alignment:"neutral evil",ac:15,hp:90,hit_dice:"12d10 + 24",speed:"30 ft.",stats:[18,14,15,11,10,12],damage_vulnerabilities:"cold",damage_resistances:"bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"fire",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 10",languages:"Ignan",cr:"5",traits:[{name:"Heated Body",desc:"A creature that touches the salamander or hits it with a melee attack while within 5 ft. of it takes 7 (2d6) fire damage.",attack_bonus:0,damage_dice:"2d6"},{name:"Heated Weapons",desc:"Any metal melee weapon the salamander wields deals an extra 3 (1d6) fire damage on a hit (included in the attack).",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The salamander makes two attacks: one with its spear and one with its tail.",attack_bonus:0},{name:"Spear",desc:"Melee or Ranged Weapon Attack: +7 to hit, reach 5 ft. or range 20 ft./60 ft., one target. Hit: 11 (2d6 + 4) piercing damage, or 13 (2d8 + 4) piercing damage if used with two hands to make a melee attack, plus 3 (1d6) fire damage.",attack_bonus:7,damage_dice:"2d6",damage_bonus:4},{name:"Tail",desc:"Melee Weapon Attack: +7 to hit, reach 10 ft., one target. Hit: 11 (2d6 + 4) bludgeoning damage plus 7 (2d6) fire damage, and the target is grappled (escape DC 14). Until this grapple ends, the target is restrained, the salamander can automatically hit the target with its tail, and the salamander can't make tail attacks against other targets.",attack_bonus:7,damage_dice:"2d6 + 2d6",damage_bonus:4}]},{name:"Satyr",size:"Medium",type:"fey",subtype:"",alignment:"chaotic neutral",ac:14,hp:31,hit_dice:"7d8 + -1",speed:"40 ft.",stats:[12,16,11,12,10,14],skillsaves:[{perception:2},{performance:6},{stealth:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 12",languages:"Common, Elvish, Sylvan",cr:"1/2",traits:[{name:"Magic Resistance",desc:"The satyr has advantage on saving throws against spells and other magical effects.",attack_bonus:0}],actions:[{name:"Ram",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 6 (2d4 + 1) bludgeoning damage.",attack_bonus:3,damage_dice:"2d4",damage_bonus:1},{name:"Shortsword",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1 d6 + 3) piercing damage.",attack_bonus:5,damage_dice:"1d6",damage_bonus:3},{name:"Shortbow",desc:"Ranged Weapon Attack: +5 to hit, range 80/320 ft., one target. Hit: 6 (1d6 + 3) piercing damage.",attack_bonus:5,damage_dice:"1d6",damage_bonus:3},{name:"Variant: Panpipes",desc:"Gentle Lullaby. The creature falls asleep and is unconscious for 1 minute. The effect ends if the creature takes damage or if someone takes an action to shake the creature awake.",attack_bonus:0}]},{name:"Scorpion",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:11,hp:1,hit_dice:"1d4 + -2",speed:"10 ft.",stats:[2,11,8,1,8,2],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"blindsight 10 ft., passive Perception 9",languages:"",cr:"0",actions:[{name:"Sting",desc:"Melee Weapon Attack: +2 to hit, reach 5 ft., one creature. Hit: 1 piercing damage, and the target must make a DC 9 Constitution saving throw, taking 4 (1d8) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:2,damage_bonus:1}]},{name:"Scout",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any alignment",ac:13,hp:16,hit_dice:"3d8 + 2",speed:"30 ft.",stats:[11,14,12,11,13,11],skillsaves:[{nature:4},{perception:5},{stealth:6},{survival:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 15",languages:"any one language (usually Common)",cr:"1/2",traits:[{name:"Keen Hearing and Sight",desc:"The scout has advantage on Wisdom (Perception) checks that rely on hearing or sight.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The scout makes two melee attacks or two ranged attacks.",attack_bonus:0},{name:"Shortsword",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2},{name:"Longbow",desc:"Ranged Weapon Attack: +4 to hit, ranged 150/600 ft., one target. Hit: 6 (1d8 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d8",damage_bonus:2}]},{name:"Sea Hag",size:"Medium",type:"fey",subtype:"",alignment:"chaotic evil",ac:14,hp:52,hit_dice:"7d8 + 20",speed:"30 ft., swim 40 ft.",stats:[16,13,16,12,12,13],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 11",languages:"Aquan, Common, Giant",cr:"2",traits:[{name:"Amphibious",desc:"The hag can breathe air and water.",attack_bonus:0},{name:"Horrific Appearance",desc:"Any humanoid that starts its turn within 30 feet of the hag and can see the hag's true form must make a DC 11 Wisdom saving throw. On a failed save, the creature is frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, with disadvantage if the hag is within line of sight, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the hag's Horrific Appearance for the next 24 hours.\\nUnless the target is surprised or the revelation of the hag's true form is sudden, the target can avert its eyes and avoid making the initial saving throw. Until the start of its next turn, a creature that averts its eyes has disadvantage on attack rolls against the hag.",attack_bonus:0},{name:"Hag Coven",desc:"When hags must work together, they form covens, in spite of their selfish natures. A coven is made up of hags of any type, all of whom are equals within the group. However, each of the hags continues to desire more personal power.\\nA coven consists of three hags so that any arguments between two hags can be settled by the third. If more than three hags ever come together, as might happen if two covens come into conflict, the result is usually chaos.",attack_bonus:0},{name:"Shared Spellcasting (Coven Only)",desc:"While all three members of a hag coven are within 30 feet of one another, they can each cast the following spells from the wizard's spell list but must share the spell slots among themselves:\\n\\n\u2022 1st level (4 slots): identify, ray of sickness\\n\u2022 2nd level (3 slots): hold person, locate object\\n\u2022 3rd level (3 slots): bestow curse, counterspell, lightning bolt\\n\u2022 4th level (3 slots): phantasmal killer, polymorph\\n\u2022 5th level (2 slots): contact other plane, scrying\\n\u2022 6th level (1 slot): eye bite\\n\\nFor casting these spells, each hag is a 12th-level spellcaster that uses Intelligence as her spellcasting ability. The spell save DC is 12+the hag's Intelligence modifier, and the spell attack bonus is 4+the hag's Intelligence modifier.",attack_bonus:0},{name:"Hag Eye (Coven Only)",desc:"A hag coven can craft a magic item called a hag eye, which is made from a real eye coated in varnish and often fitted to a pendant or other wearable item. The hag eye is usually entrusted to a minion for safekeeping and transport. A hag in the coven can take an action to see what the hag eye sees if the hag eye is on the same plane of existence. A hag eye has AC 10, 1 hit point, and darkvision with a radius of 60 feet. If it is destroyed, each coven member takes 3d10 psychic damage and is blinded for 24 hours.\\nA hag coven can have only one hag eye at a time, and creating a new one requires all three members of the coven to perform a ritual. The ritual takes 1 hour, and the hags can't perform it while blinded. During the ritual, if the hags take any action other than performing the ritual, they must start over.",attack_bonus:0}],actions:[{name:"Claws",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) slashing damage.",attack_bonus:5,damage_dice:"2d6",damage_bonus:3},{name:"Death Glare",desc:"The hag targets one frightened creature she can see within 30 ft. of her. If the target can see the hag, it must succeed on a DC 11 Wisdom saving throw against this magic or drop to 0 hit points.",attack_bonus:0},{name:"Illusory Appearance",desc:"The hag covers herself and anything she is wearing or carrying with a magical illusion that makes her look like an ugly creature of her general size and humanoid shape. The effect ends if the hag takes a bonus action to end it or if she dies.\\nThe changes wrought by this effect fail to hold up to physical inspection. For example, the hag could appear to have no claws, but someone touching her hand might feel the claws. Otherwise, a creature must take an action to visually inspect the illusion and succeed on a DC 16 Intelligence (Investigation) check to discern that the hag is disguised.",attack_bonus:0}]},{name:"Sea Horse",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:11,hp:1,hit_dice:"1d4 + -2",speed:"swim 20 ft.",stats:[1,12,8,1,10,2],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"",cr:"0",traits:[{name:"Water Breathing",desc:"The sea horse can breathe only underwater.",attack_bonus:0}]},{name:"Shadow",size:"Medium",type:"undead",subtype:"",alignment:"chaotic evil",ac:12,hp:16,hit_dice:"3d8 + 2",speed:"40 ft.",stats:[6,14,13,6,10,8],skillsaves:[{stealth:4}],damage_vulnerabilities:"radiant",damage_resistances:"acid, cold, fire, lightning, thunder; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"necrotic, poison",condition_immunities:"exhaustion, frightened, grappled, paralyzed, petrified, poisoned, prone, restrained",senses:"darkvision 60 ft., passive Perception 10",languages:"",cr:"1/2",traits:[{name:"Amorphous",desc:"The shadow can move through a space as narrow as 1 inch wide without squeezing.",attack_bonus:0},{name:"Shadow Stealth",desc:"While in dim light or darkness, the shadow can take the Hide action as a bonus action. Its stealth bonus is also improved to +6.",attack_bonus:0},{name:"Sunlight Weakness",desc:"While in sunlight, the shadow has disadvantage on attack rolls, ability checks, and saving throws.",attack_bonus:0}],actions:[{name:"Strength Drain",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 9 (2d6 + 2) necrotic damage, and the target's Strength score is reduced by 1d4. The target dies if this reduces its Strength to 0. Otherwise, the reduction lasts until the target finishes a short or long rest.\\nIf a non-evil humanoid dies from this attack, a new shadow rises from the corpse 1d4 hours later.",attack_bonus:4,damage_dice:"2d6",damage_bonus:2}]},{name:"Shambling Mound",size:"Large",type:"plant",subtype:"",alignment:"unaligned",ac:15,hp:136,hit_dice:"16d10 + 48",speed:"20 ft., swim 20 ft.",stats:[18,8,16,5,10,5],skillsaves:[{stealth:2}],damage_vulnerabilities:"",damage_resistances:"cold, fire",damage_immunities:"lightning",condition_immunities:"blinded, deafened, exhaustion",senses:"blindsight 60 ft. (blind beyond this radius), passive Perception 10",languages:"",cr:"5",traits:[{name:"Lightning Absorption",desc:"Whenever the shambling mound is subjected to lightning damage, it takes no damage and regains a number of hit points equal to the lightning damage dealt.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The shambling mound makes two slam attacks. If both attacks hit a Medium or smaller target, the target is grappled (escape DC 14), and the shambling mound uses its Engulf on it.",attack_bonus:0},{name:"Slam",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) bludgeoning damage.",attack_bonus:7,damage_dice:"2d8",damage_bonus:4},{name:"Engulf",desc:"The shambling mound engulfs a Medium or smaller creature grappled by it. The engulfed target is blinded, restrained, and unable to breathe, and it must succeed on a DC 14 Constitution saving throw at the start of each of the mound's turns or take 13 (2d8 + 4) bludgeoning damage. If the mound moves, the engulfed target moves with it. The mound can have only one creature engulfed at a time.",attack_bonus:0}]},{name:"Shield Guardian",size:"Large",type:"construct",subtype:"",alignment:"unaligned",ac:17,hp:142,hit_dice:"15d10 + 59",speed:"30 ft.",stats:[18,8,18,7,10,3],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"poison",condition_immunities:"charmed, exhaustion, frightened, paralyzed, poisoned",senses:"blindsight 10 ft., darkvision 60 ft., passive Perception 10",languages:"understands commands given in any language but can't speak",cr:"7",traits:[{name:"Bound",desc:"The shield guardian is magically bound to an amulet. As long as the guardian and its amulet are on the same plane of existence, the amulet's wearer can telepathically call the guardian to travel to it, and the guardian knows the distance and direction to the amulet. If the guardian is within 60 feet of the amulet's wearer, half of any damage the wearer takes (rounded up) is transferred to the guardian.",attack_bonus:0},{name:"Regeneration",desc:"The shield guardian regains 10 hit points at the start of its turn if it has at least 1 hit. point.",attack_bonus:0},{name:"Spell Storing",desc:"A spellcaster who wears the shield guardian's amulet can cause the guardian to store one spell of 4th level or lower. To do so, the wearer must cast the spell on the guardian. The spell has no effect but is stored within the guardian. When commanded to do so by the wearer or when a situation arises that was predefined by the spellcaster, the guardian casts the stored spell with any parameters set by the original caster, requiring no components. When the spell is cast or a new spell is stored, any previously stored spell is lost.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The guardian makes two fist attacks.",attack_bonus:0},{name:"Fist",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) bludgeoning damage.",attack_bonus:7,damage_dice:"2d6",damage_bonus:4}],reactions:[{name:"Shield",desc:"When a creature makes an attack against the wearer of the guardian's amulet, the guardian grants a +2 bonus to the wearer's AC if the guardian is within 5 feet of the wearer.",attack_bonus:0}]},{name:"Shrieker",size:"Medium",type:"plant",subtype:"",alignment:"unaligned",ac:5,hp:13,hit_dice:"3d8 + -1",speed:"0 ft.",stats:[1,1,10,1,3,1],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"blinded, deafened, frightened",senses:"blindsight 30 ft. (blind beyond this radius), passive Perception 6",languages:"",cr:"0",traits:[{name:"False Appearance",desc:"While the shrieker remains motionless, it is indistinguishable from an ordinary fungus.",attack_bonus:0}],actions:[{name:"Shriek",desc:"When bright light or a creature is within 30 feet of the shrieker, it emits a shriek audible within 300 feet of it. The shrieker continues to shriek until the disturbance moves out of range and for 1d4 of the shrieker's turns afterward",attack_bonus:0}]},{name:"Silver Dragon Wyrmling",size:"Medium",type:"dragon",subtype:"",alignment:"lawful good",ac:17,hp:45,hit_dice:"6d8 + 18",speed:"30 ft., fly 60 ft.",stats:[19,10,17,12,11,15],saves:[{dexterity:2},{constitution:5},{wisdom:2},{charisma:4}],skillsaves:[{perception:4},{stealth:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"cold",condition_immunities:"",senses:"blindsight 10 ft., darkvision 60 ft., passive Perception 14",languages:"Draconic",cr:"2",actions:[{name:"Bite",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 9 (1d10 + 4) piercing damage.",attack_bonus:6,damage_dice:"1d10",damage_bonus:4},{name:"Breath Weapons (Recharge 5-6)",desc:"The dragon uses one of the following breath weapons.\\nCold Breath. The dragon exhales an icy blast in a 15-foot cone. Each creature in that area must make a DC 13 Constitution saving throw, taking 18 (4d8) cold damage on a failed save, or half as much damage on a successful one.\\nParalyzing Breath. The dragon exhales paralyzing gas in a 15-foot cone. Each creature in that area must succeed on a DC 13 Constitution saving throw or be paralyzed for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",attack_bonus:0,damage_dice:"4d8"}]},{name:"Skeleton",size:"Medium",type:"undead",subtype:"",alignment:"lawful evil",ac:13,hp:13,hit_dice:"2d8 + 4",speed:"30 ft.",stats:[10,14,15,6,8,5],damage_vulnerabilities:"bludgeoning",damage_resistances:"",damage_immunities:"",condition_immunities:"poisoned",senses:"darkvision 60 ft., passive Perception 9",languages:"understands all languages it spoke in life but can't speak",cr:"1/4",actions:[{name:"Shortsword",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2},{name:"Shortbow",desc:"Ranged Weapon Attack: +4 to hit, range 80/320 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2}]},{name:"Solar",size:"Large",type:"celestial",subtype:"",alignment:"lawful good",ac:21,hp:243,hit_dice:"18d10 + 144",speed:"50 ft., fly 150 ft.",stats:[26,22,26,25,25,30],saves:[{intelligence:14},{wisdom:14},{charisma:17}],skillsaves:[{perception:14}],damage_vulnerabilities:"",damage_resistances:"radiant; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"necrotic, poison",condition_immunities:"charmed, exhaustion, frightened, poisoned",senses:"truesight 120 ft., passive Perception 24",languages:"all, telepathy 120 ft.",cr:"21",traits:[{name:"Angelic Weapons",desc:"The solar's weapon attacks are magical. When the solar hits with any weapon, the weapon deals an extra 6d8 radiant damage (included in the attack).",attack_bonus:0},{name:"Divine Awareness",desc:"The solar knows if it hears a lie.",attack_bonus:0},{name:"Innate Spellcasting",desc:"The solar's spell casting ability is Charisma (spell save DC 25). It can innately cast the following spells, requiring no material components:\\nAt will: detect evil and good, invisibility (self only)\\n3/day each: blade barrier, dispel evil and good, resurrection\\n1/day each: commune, control weather",attack_bonus:0},{name:"Magic Resistance",desc:"The solar has advantage on saving throws against spells and other magical effects.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The solar makes two greatsword attacks.",attack_bonus:0},{name:"Greatsword",desc:"Melee Weapon Attack: +15 to hit, reach 5 ft., one target. Hit: 22 (4d6 + 8) slashing damage plus 27 (6d8) radiant damage.",attack_bonus:15,damage_dice:"4d6 + 6d8",damage_bonus:8},{name:"Slaying Longbow",desc:"Ranged Weapon Attack: +13 to hit, range 150/600 ft., one target. Hit: 15 (2d8 + 6) piercing damage plus 27 (6d8) radiant damage. If the target is a creature that has 190 hit points or fewer, it must succeed on a DC 15 Constitution saving throw or die.",attack_bonus:13,damage_dice:"2d8 + 6d8",damage_bonus:6},{name:"Flying Sword",desc:"The solar releases its greatsword to hover magically in an unoccupied space within 5 ft. of it. If the solar can see the sword, the solar can mentally command it as a bonus action to fly up to 50 ft. and either make one attack against a target or return to the solar's hands. If the hovering sword is targeted by any effect, the solar is considered to be holding it. The hovering sword falls if the solar dies.",attack_bonus:0},{name:"Healing Touch (4/Day)",desc:"The solar touches another creature. The target magically regains 40 (8d8 + 4) hit points and is freed from any curse, disease, poison, blindness, or deafness.",attack_bonus:0}],legendary_actions:[{name:"Teleport",desc:"The solar magically teleports, along with any equipment it is wearing or carrying, up to 120 ft. to an unoccupied space it can see.",attack_bonus:0},{name:"Searing Burst (Costs 2 Actions)",desc:"The solar emits magical, divine energy. Each creature of its choice in a 10 -foot radius must make a DC 23 Dexterity saving throw, taking 14 (4d6) fire damage plus 14 (4d6) radiant damage on a failed save, or half as much damage on a successful one.",attack_bonus:0},{name:"Blinding Gaze (Costs 3 Actions)",desc:"The solar targets one creature it can see within 30 ft. of it. If the target can see it, the target must succeed on a DC 15 Constitution saving throw or be blinded until magic such as the lesser restoration spell removes the blindness.",attack_bonus:0}]},{name:"Specter",size:"Medium",type:"undead",subtype:"",alignment:"chaotic evil",ac:12,hp:22,hit_dice:"5d8 + -1",speed:"0 ft., fly 50 ft. (hover)",stats:[1,14,11,10,10,11],damage_vulnerabilities:"",damage_resistances:"acid, cold, fire, lightning, thunder; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"necrotic, poison",condition_immunities:"charmed, exhaustion, grappled, paralyzed, petrified, poisoned, prone, restrained, unconscious",senses:"darkvision 60 ft., passive Perception 10",languages:"understands all languages it knew in life but can't speak",cr:"1",traits:[{name:"Incorporeal Movement",desc:"The specter can move through other creatures and objects as if they were difficult terrain. It takes 5 (1d10) force damage if it ends its turn inside an object.",attack_bonus:0},{name:"Sunlight Sensitivity",desc:"While in sunlight, the specter has disadvantage on attack rolls, as well as on Wisdom (Perception) checks that rely on sight.",attack_bonus:0}],actions:[{name:"Life Drain",desc:"Melee Spell Attack: +4 to hit, reach 5 ft., one creature. Hit: 10 (3d6) necrotic damage. The target must succeed on a DC 10 Constitution saving throw or its hit point maximum is reduced by an amount equal to the damage taken. This reduction lasts until the creature finishes a long rest. The target dies if this effect reduces its hit point maximum to 0.",attack_bonus:4,damage_dice:"3d6"}]},{name:"Spider",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:1,hit_dice:"1d4 + -2",speed:"20 ft., climb 20 ft.",stats:[2,14,8,1,10,2],skillsaves:[{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 30 ft., passive Perception 12",languages:"",cr:"0",traits:[{name:"Spider Climb",desc:"The spider can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",attack_bonus:0},{name:"Web Sense",desc:"While in contact with a web, the spider knows the exact location of any other creature in contact with the same web.",attack_bonus:0},{name:"Web Walker",desc:"The spider ignores movement restrictions caused by webbing.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 1 piercing damage, and the target must succeed on a DC 9 Constitution saving throw or take 2 (1d4) poison damage.",attack_bonus:4,damage_bonus:1}]},{name:"Spirit Naga",size:"Large",type:"monstrosity",subtype:"",alignment:"chaotic evil",ac:15,hp:75,hit_dice:"10d10 + 20",speed:"40 ft.",stats:[18,17,14,16,15,16],saves:[{dexterity:6},{constitution:5},{wisdom:5},{charisma:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"poison",condition_immunities:"charmed, poisoned",senses:"darkvision 60 ft., passive Perception 12",languages:"Abyssal, Common",cr:"8",traits:[{name:"Rejuvenation",desc:"If it dies, the naga returns to life in 1d6 days and regains all its hit points. Only a wish spell can prevent this trait from functioning.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +7 to hit, reach 10 ft., one creature. Hit: 7 (1d6 + 4) piercing damage, and the target must make a DC 13 Constitution saving throw, taking 31 (7d8) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:7,damage_dice:"1d6",damage_bonus:4}],spells:["The naga is a 10th-level spellcaster. Its spellcasting ability is Intelligence (spell save DC 14, +6 to hit with spell attacks), and it needs only verbal components to cast its spells. It has the following wizard spells prepared:",{"Cantrips (at will)":"mage hand, minor illusion, ray of frost"},{"1st level (4 slots)":"charm person, detect magic, sleep"},{"2nd level (3 slots)":"detect thoughts, hold person"},{"3rd level (3 slots)":"lightning bolt, water breathing"},{"4th level (3 slots)":"blight, dimension door"},{"5th level (2 slots)":"dominate person"}]},{name:"Sprite",size:"Tiny",type:"fey",subtype:"",alignment:"neutral good",ac:15,hp:2,hit_dice:"1d4 + -1",speed:"10 ft., fly 40 ft.",stats:[3,18,10,14,13,11],skillsaves:[{perception:3},{stealth:8}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"Common, Elvish, Sylvan",cr:"1/4",actions:[{name:"Longsword",desc:"Melee Weapon Attack: +2 to hit, reach 5 ft., one target. Hit: 1 slashing damage.",attack_bonus:2,damage_bonus:1},{name:"Shortbow",desc:"Ranged Weapon Attack: +6 to hit, range 40/160 ft., one target. Hit: 1 piercing damage, and the target must succeed on a DC 10 Constitution saving throw or become poisoned for 1 minute. If its saving throw result is 5 or lower, the poisoned target falls unconscious for the same duration, or until it takes damage or another creature takes an action to shake it awake.",attack_bonus:6,damage_bonus:1},{name:"Heart Sight",desc:"The sprite touches a creature and magically knows the creature's current emotional state. If the target fails a DC 10 Charisma saving throw, the sprite also knows the creature's alignment. Celestials, fiends, and undead automatically fail the saving throw.",attack_bonus:0},{name:"Invisibility",desc:"The sprite magically turns invisible until it attacks or casts a spell, or until its concentration ends (as if concentrating on a spell). Any equipment the sprite wears or carries is invisible with it.",attack_bonus:0}]},{name:"Spy",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any alignment",ac:12,hp:27,hit_dice:"6d8",speed:"30 ft.",stats:[10,15,10,12,14,16],skillsaves:[{deception:5},{insight:4},{investigation:5},{perception:6},{persuasion:5},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 16",languages:"any two languages",cr:"1",traits:[{name:"Cunning Action",desc:"On each of its turns, the spy can use a bonus action to take the Dash, Disengage, or Hide action.",attack_bonus:0},{name:"Sneak Attack (1/Turn)",desc:"The spy deals an extra 7 (2d6) damage when it hits a target with a weapon attack and has advantage on the attack roll, or when the target is within 5 ft. of an ally of the spy that isn't incapacitated and the spy doesn't have disadvantage on the attack roll.",attack_bonus:0,damage_dice:"2d6"}],actions:[{name:"Multiattack",desc:"The spy makes two melee attacks.",attack_bonus:0},{name:"Shortsword",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2},{name:"Hand Crossbow",desc:"Ranged Weapon Attack: +4 to hit, range 30/120 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2}]},{name:"Steam Mephit",size:"Small",type:"elemental",subtype:"",alignment:"neutral evil",ac:10,hp:21,hit_dice:"6d6",speed:"30 ft., fly 30 ft.",stats:[5,11,10,11,10,12],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire, poison",condition_immunities:"poisoned",senses:"darkvision 60 ft., passive Perception 10",languages:"Aquan, Ignan",cr:"1/4",traits:[{name:"Death Burst",desc:"When the mephit dies, it explodes in a cloud of steam. Each creature within 5 ft. of the mephit must succeed on a DC 10 Dexterity saving throw or take 4 (1d8) fire damage.",attack_bonus:0,damage_dice:"1d8"},{name:"Innate Spellcasting (1/Day)",desc:"The mephit can innately cast blur, requiring no material components. Its innate spellcasting ability is Charisma.",attack_bonus:0}],actions:[{name:"Claws",desc:"Melee Weapon Attack: +2 to hit, reach 5 ft., one creature. Hit: 2 (1d4) slashing damage plus 2 (1d4) fire damage.",attack_bonus:2,damage_dice:"2d4"},{name:"Steam Breath (Recharge 6)",desc:"The mephit exhales a 15-foot cone of scalding steam. Each creature in that area must succeed on a DC 10 Dexterity saving throw, taking 4 (1d8) fire damage on a failed save, or half as much damage on a successful one.",attack_bonus:0},{name:"Variant: Summon Mephits (1/Day)",desc:"The mephit has a 25 percent chance of summoning 1d4 mephits of its kind. A summoned mephit appears in an unoccupied space within 60 feet of its summoner, acts as an ally of its summoner, and can't summon other mephits. It remains for 1 minute, until it or its summoner dies, or until its summoner dismisses it as an action.",attack_bonus:0}]},{name:"Stirge",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:14,hp:2,hit_dice:"1d4 + -1",speed:"10 ft., fly 40 ft.",stats:[4,16,11,2,8,6],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 9",languages:"",cr:"1/8",actions:[{name:"Blood Drain",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one creature. Hit: 5 (1d4 + 3) piercing damage, and the stirge attaches to the target. While attached, the stirge doesn't attack. Instead, at the start of each of the stirge's turns, the target loses 5 (1d4 + 3) hit points due to blood loss.\\nThe stirge can detach itself by spending 5 feet of its movement. It does so after it drains 10 hit points of blood from the target or the target dies. A creature, including the target, can use its action to detach the stirge.",attack_bonus:5,damage_dice:"1d4",damage_bonus:3}]},{name:"Stone Giant",size:"Huge",type:"giant",subtype:"",alignment:"neutral",ac:17,hp:126,hit_dice:"11d12 + 54",speed:"40 ft.",stats:[23,15,20,10,12,9],saves:[{dexterity:5},{constitution:8},{wisdom:4}],skillsaves:[{athletics:12},{perception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 14",languages:"Giant",cr:"7",traits:[{name:"Stone Camouflage",desc:"The giant has advantage on Dexterity (Stealth) checks made to hide in rocky terrain.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The giant makes two greatclub attacks.",attack_bonus:0},{name:"Greatclub",desc:"Melee Weapon Attack: +9 to hit, reach 15 ft., one target. Hit: 19 (3d8 + 6) bludgeoning damage.",attack_bonus:9,damage_dice:"3d8",damage_bonus:6},{name:"Rock",desc:"Ranged Weapon Attack: +9 to hit, range 60/240 ft., one target. Hit: 28 (4d10 + 6) bludgeoning damage. If the target is a creature, it must succeed on a DC 17 Strength saving throw or be knocked prone.",attack_bonus:9,damage_dice:"4d10",damage_bonus:6}],reactions:[{name:"Rock Catching",desc:"If a rock or similar object is hurled at the giant, the giant can, with a successful DC 10 Dexterity saving throw, catch the missile and take no bludgeoning damage from it.",attack_bonus:0}]},{name:"Stone Golem",size:"Large",type:"construct",subtype:"",alignment:"unaligned",ac:17,hp:178,hit_dice:"17d10 + 84",speed:"30 ft.",stats:[22,9,20,3,11,1],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"poison, psychic; bludgeoning, piercing, and slashing from nonmagical weapons that aren't adamantine",condition_immunities:"charmed, exhaustion, frightened, paralyzed, petrified, poisoned",senses:"darkvision 120 ft., passive Perception 10",languages:"understands the languages of its creator but can't speak",cr:"10",traits:[{name:"Immutable Form",desc:"The golem is immune to any spell or effect that would alter its form.",attack_bonus:0},{name:"Magic Resistance",desc:"The golem has advantage on saving throws against spells and other magical effects.",attack_bonus:0},{name:"Magic Weapons",desc:"The golem's weapon attacks are magical.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The golem makes two slam attacks.",attack_bonus:0},{name:"Slam",desc:"Melee Weapon Attack: +10 to hit, reach 5 ft., one target. Hit: 19 (3d8 + 6) bludgeoning damage.",attack_bonus:10,damage_dice:"3d8",damage_bonus:6},{name:"Slow (Recharge 5-6)",desc:"The golem targets one or more creatures it can see within 10 ft. of it. Each target must make a DC 17 Wisdom saving throw against this magic. On a failed save, a target can't use reactions, its speed is halved, and it can't make more than one attack on its turn. In addition, the target can take either an action or a bonus action on its turn, not both. These effects last for 1 minute. A target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",attack_bonus:0}]},{name:"Storm Giant",size:"Huge",type:"giant",subtype:"",alignment:"chaotic good",ac:16,hp:230,hit_dice:"20d12 + 100",speed:"50 ft., swim 50 ft.",stats:[29,14,20,16,18,18],saves:[{strength:14},{constitution:10},{wisdom:9},{charisma:9}],skillsaves:[{arcana:8},{athletics:14},{history:8},{perception:9}],damage_vulnerabilities:"",damage_resistances:"cold",damage_immunities:"lightning, thunder",condition_immunities:"",senses:"passive Perception 19",languages:"Common, Giant",cr:"13",traits:[{name:"Amphibious",desc:"The giant can breathe air and water.",attack_bonus:0},{name:"Innate Spellcasting",desc:"The giant's innate spellcasting ability is Charisma (spell save DC 17). It can innately cast the following spells, requiring no material components:\\n\\nAt will: detect magic, feather fall, levitate, light\\n3/day each: control weather, water breathing",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The giant makes two greatsword attacks.",attack_bonus:0},{name:"Greatsword",desc:"Melee Weapon Attack: +14 to hit, reach 10 ft., one target. Hit: 30 (6d6 + 9) slashing damage.",attack_bonus:14,damage_dice:"6d6",damage_bonus:9},{name:"Rock",desc:"Ranged Weapon Attack: +14 to hit, range 60/240 ft., one target. Hit: 35 (4d12 + 9) bludgeoning damage.",attack_bonus:14,damage_dice:"4d12",damage_bonus:9},{name:"Lightning Strike (Recharge 5-6)",desc:"The giant hurls a magical lightning bolt at a point it can see within 500 feet of it. Each creature within 10 feet of that point must make a DC 17 Dexterity saving throw, taking 54 (12d8) lightning damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"12d8"}]},{name:"Succubus/Incubus",size:"Medium",type:"fiend",subtype:"shapechanger",alignment:"neutral evil",ac:15,hp:66,hit_dice:"12d8 + 12",speed:"30 ft., fly 60 ft.",stats:[8,17,13,15,12,20],skillsaves:[{deception:9},{insight:5},{perception:5},{persuasion:9},{stealth:7}],damage_vulnerabilities:"",damage_resistances:"cold, fire, lightning, poison; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 15",languages:"Abyssal, Common, Infernal, telepathy 60 ft.",cr:"4",traits:[{name:"Telepathic Bond",desc:"The fiend ignores the range restriction on its telepathy when communicating with a creature it has charmed. The two don't even need to be on the same plane of existence.",attack_bonus:0},{name:"Shapechanger",desc:"The fiend can use its action to polymorph into a Small or Medium humanoid, or back into its true form. Without wings, the fiend loses its flying speed. Other than its size and speed, its statistics are the same in each form. Any equipment it is wearing or carrying isn't transformed. It reverts to its true form if it dies.",attack_bonus:0}],actions:[{name:"Claw (Fiend Form Only)",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) slashing damage.",attack_bonus:5,damage_dice:"1d6",damage_bonus:3},{name:"Charm",desc:"One humanoid the fiend can see within 30 feet of it must succeed on a DC 15 Wisdom saving throw or be magically charmed for 1 day. The charmed target obeys the fiend's verbal or telepathic commands. If the target suffers any harm or receives a suicidal command, it can repeat the saving throw, ending the effect on a success. If the target successfully saves against the effect, or if the effect on it ends, the target is immune to this fiend's Charm for the next 24 hours.\\nThe fiend can have only one target charmed at a time. If it charms another, the effect on the previous target ends.",attack_bonus:0},{name:"Draining Kiss",desc:"The fiend kisses a creature charmed by it or a willing creature. The target must make a DC 15 Constitution saving throw against this magic, taking 32 (5d10 + 5) psychic damage on a failed save, or half as much damage on a successful one. The target's hit point maximum is reduced by an amount equal to the damage taken. This reduction lasts until the target finishes a long rest. The target dies if this effect reduces its hit point maximum to 0.",attack_bonus:0,damage_dice:"5d10",damage_bonus:5},{name:"Etherealness",desc:"The fiend magically enters the Ethereal Plane from the Material Plane, or vice versa.",attack_bonus:0}]},{name:"Swarm of Bats",size:"Medium",type:"swarm of Tiny beasts",subtype:"",alignment:"unaligned",ac:12,hp:22,hit_dice:"5d8 + -1",speed:"0 ft., fly 30 ft.",stats:[5,15,10,2,12,4],damage_vulnerabilities:"",damage_resistances:"bludgeoning, piercing, slashing",damage_immunities:"",condition_immunities:"charmed, frightened, grappled, paralyzed, petrified, prone, restrained, stunned",senses:"blindsight 60 ft., passive Perception 11",languages:"",cr:"1/4",traits:[{name:"Echolocation",desc:"The swarm can't use its blindsight while deafened.",attack_bonus:0},{name:"Keen Hearing",desc:"The swarm has advantage on Wisdom (Perception) checks that rely on hearing.",attack_bonus:0},{name:"Swarm",desc:"The swarm can occupy another creature's space and vice versa, and the swarm can move through any opening large enough for a Tiny bat. The swarm can't regain hit points or gain temporary hit points.",attack_bonus:0}],actions:[{name:"Bites",desc:"Melee Weapon Attack: +4 to hit, reach 0 ft., one creature in the swarm's space. Hit: 5 (2d4) piercing damage, or 2 (1d4) piercing damage if the swarm has half of its hit points or fewer.",attack_bonus:4,damage_dice:"2d4"}]},{name:"Swarm of Beetles",size:"Medium",type:"swarm of Tiny beasts",subtype:"",alignment:"unaligned",ac:12,hp:22,hit_dice:"5d8 + -1",speed:"20 ft., burrow 5 ft., climb 20 ft.",stats:[3,13,10,1,7,1],damage_vulnerabilities:"",damage_resistances:"bludgeoning, piercing, slashing",damage_immunities:"",condition_immunities:"charmed, frightened, grappled, paralyzed, petrified, prone, restrained, stunned",senses:"blindsight 10 ft., passive Perception 8",languages:"",cr:"1/2",traits:[{name:"Swarm",desc:"The swarm can occupy another creature's space and vice versa, and the swarm can move through any opening large enough for a Tiny insect. The swarm can't regain hit points or gain temporary hit points.",attack_bonus:0}],actions:[{name:"Bites",desc:"Melee Weapon Attack: +3 to hit, reach 0 ft., one target in the swarm's space. Hit: 10 (4d4) piercing damage, or 5 (2d4) piercing damage if the swarm has half of its hit points or fewer.",attack_bonus:3,damage_dice:"4d4"}]},{name:"Swarm of Centipedes",size:"Medium",type:"swarm of Tiny beasts",subtype:"",alignment:"unaligned",ac:12,hp:22,hit_dice:"5d8 + -1",speed:"20 ft., climb 20 ft.",stats:[3,13,10,1,7,1],damage_vulnerabilities:"",damage_resistances:"bludgeoning, piercing, slashing",damage_immunities:"",condition_immunities:"charmed, frightened, grappled, paralyzed, petrified, prone, restrained, stunned",senses:"blindsight 10 ft., passive Perception 8",languages:"",cr:"1/2",traits:[{name:"Swarm",desc:"The swarm can occupy another creature's space and vice versa, and the swarm can move through any opening large enough for a Tiny insect. The swarm can't regain hit points or gain temporary hit points.",attack_bonus:0}],actions:[{name:"Bites",desc:"Melee Weapon Attack: +3 to hit, reach 0 ft., one target in the swarm's space. Hit: 10 (4d4) piercing damage, or 5 (2d4) piercing damage if the swarm has half of its hit points or fewer.\\nA creature reduced to 0 hit points by a swarm of centipedes is stable but poisoned for 1 hour, even after regaining hit points, and paralyzed while poisoned in this way.",attack_bonus:3,damage_dice:"4d4"}]},{name:"Swarm of Insects",size:"Medium",type:"swarm of Tiny beasts",subtype:"",alignment:"unaligned",ac:12,hp:22,hit_dice:"5d8 + -1",speed:"20 ft., climb 20 ft.",stats:[3,13,10,1,7,1],damage_vulnerabilities:"",damage_resistances:"bludgeoning, piercing, slashing",damage_immunities:"",condition_immunities:"charmed, frightened, grappled, paralyzed, petrified, prone, restrained, stunned",senses:"blindsight 10 ft., passive Perception 8",languages:"",cr:"1/2",traits:[{name:"Swarm",desc:"The swarm can occupy another creature's space and vice versa, and the swarm can move through any opening large enough for a Tiny insect. The swarm can't regain hit points or gain temporary hit points.",attack_bonus:0}],actions:[{name:"Bites",desc:"Melee Weapon Attack: +3 to hit, reach 0 ft., one target in the swarm's space. Hit: 10 (4d4) piercing damage, or 5 (2d4) piercing damage if the swarm has half of its hit points or fewer.",attack_bonus:3,damage_dice:"4d4"}]},{name:"Swarm of Poisonous Snakes",size:"Medium",type:"swarm of Tiny beasts",subtype:"",alignment:"unaligned",ac:14,hp:36,hit_dice:"8d8",speed:"30 ft., swim 30 ft.",stats:[8,18,11,1,10,3],damage_vulnerabilities:"",damage_resistances:"bludgeoning, piercing, slashing",damage_immunities:"",condition_immunities:"charmed, frightened, grappled, paralyzed, petrified, prone, restrained, stunned",senses:"blindsight 10 ft., passive Perception 10",languages:"",cr:"2",traits:[{name:"Swarm",desc:"The swarm can occupy another creature's space and vice versa, and the swarm can move through any opening large enough for a Tiny snake. The swarm can't regain hit points or gain temporary hit points.",attack_bonus:0}],actions:[{name:"Bites",desc:"Melee Weapon Attack: +6 to hit, reach 0 ft., one creature in the swarm's space. Hit: 7 (2d6) piercing damage, or 3 (1d6) piercing damage if the swarm has half of its hit points or fewer. The target must make a DC 10 Constitution saving throw, taking 14 (4d6) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:6,damage_dice:"2d6"}]},{name:"Swarm of Quippers",size:"Medium",type:"swarm of Tiny beasts",subtype:"",alignment:"unaligned",ac:13,hp:28,hit_dice:"8d8 + -8",speed:"0 ft., swim 40 ft.",stats:[13,16,9,1,7,2],damage_vulnerabilities:"",damage_resistances:"bludgeoning, piercing, slashing",damage_immunities:"",condition_immunities:"charmed, frightened, grappled, paralyzed, petrified, prone, restrained, stunned",senses:"darkvision 60 ft., passive Perception 8",languages:"",cr:"1",traits:[{name:"Blood Frenzy",desc:"The swarm has advantage on melee attack rolls against any creature that doesn't have all its hit points.",attack_bonus:0},{name:"Swarm",desc:"The swarm can occupy another creature's space and vice versa, and the swarm can move through any opening large enough for a Tiny quipper. The swarm can't regain hit points or gain temporary hit points.",attack_bonus:0},{name:"Water Breathing",desc:"The swarm can breathe only underwater.",attack_bonus:0}],actions:[{name:"Bites",desc:"Melee Weapon Attack: +5 to hit, reach 0 ft., one creature in the swarm's space. Hit: 14 (4d6) piercing damage, or 7 (2d6) piercing damage if the swarm has half of its hit points or fewer.",attack_bonus:5,damage_dice:"4d6"}]},{name:"Swarm of Rats",size:"Medium",type:"swarm of Tiny beasts",subtype:"",alignment:"unaligned",ac:10,hp:24,hit_dice:"7d8 + -8",speed:"30 ft.",stats:[9,11,9,2,10,3],damage_vulnerabilities:"",damage_resistances:"bludgeoning, piercing, slashing",damage_immunities:"",condition_immunities:"charmed, frightened, grappled, paralyzed, petrified, prone, restrained, stunned",senses:"darkvision 30 ft., passive Perception 10",languages:"",cr:"1/4",traits:[{name:"Keen Smell",desc:"The swarm has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0},{name:"Swarm",desc:"The swarm can occupy another creature's space and vice versa, and the swarm can move through any opening large enough for a Tiny rat. The swarm can't regain hit points or gain temporary hit points.",attack_bonus:0}],actions:[{name:"Bites",desc:"Melee Weapon Attack: +2 to hit, reach 0 ft., one target in the swarm's space. Hit: 7 (2d6) piercing damage, or 3 (1d6) piercing damage if the swarm has half of its hit points or fewer.",attack_bonus:2,damage_dice:"2d6"}]},{name:"Swarm of Ravens",size:"Medium",type:"swarm of Tiny beasts",subtype:"",alignment:"unaligned",ac:12,hp:24,hit_dice:"7d8 + -8",speed:"10 ft., fly 50 ft.",stats:[6,14,8,3,12,6],damage_vulnerabilities:"",damage_resistances:"bludgeoning, piercing, slashing",damage_immunities:"",condition_immunities:"charmed, frightened, grappled, paralyzed, petrified, prone, restrained, stunned",senses:"passive Perception 15",languages:"",cr:"1/4",traits:[{name:"Swarm",desc:"The swarm can occupy another creature's space and vice versa, and the swarm can move through any opening large enough for a Tiny raven. The swarm can't regain hit points or gain temporary hit points.",attack_bonus:0}],actions:[{name:"Beaks",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target in the swarm's space. Hit: 7 (2d6) piercing damage, or 3 (1d6) piercing damage if the swarm has half of its hit points or fewer.",attack_bonus:4,damage_dice:"2d6"}]},{name:"Swarm of Spiders",size:"Medium",type:"swarm of Tiny beasts",subtype:"",alignment:"unaligned",ac:12,hp:22,hit_dice:"5d8 + -1",speed:"20 ft., climb 20 ft.",stats:[3,13,10,1,7,1],damage_vulnerabilities:"",damage_resistances:"bludgeoning, piercing, slashing",damage_immunities:"",condition_immunities:"charmed, frightened, paralyzed, petrified, prone, restrained, stunned",senses:"blindsight 10 ft., passive Perception 8",languages:"",cr:"1/2",traits:[{name:"Swarm",desc:"The swarm can occupy another creature's space and vice versa, and the swarm can move through any opening large enough for a Tiny insect. The swarm can't regain hit points or gain temporary hit points.",attack_bonus:0},{name:"Spider Climb",desc:"The swarm can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",attack_bonus:0},{name:"Web Sense",desc:"While in contact with a web, the swarm knows the exact location of any other creature in contact with the same web.",attack_bonus:0},{name:"Web Walker",desc:"The swarm ignores movement restrictions caused by webbing.",attack_bonus:0}],actions:[{name:"Bites",desc:"Melee Weapon Attack: +3 to hit, reach 0 ft., one target in the swarm's space. Hit: 10 (4d4) piercing damage, or 5 (2d4) piercing damage if the swarm has half of its hit points or fewer.",attack_bonus:3,damage_dice:"4d4"}]},{name:"Swarm of Wasps",size:"Medium",type:"swarm of Tiny beasts",subtype:"",alignment:"unaligned",ac:12,hp:22,hit_dice:"5d8 + -1",speed:"5 ft., fly 30 ft.",stats:[3,13,10,1,7,1],damage_vulnerabilities:"",damage_resistances:"bludgeoning, piercing, slashing",damage_immunities:"",condition_immunities:"charmed, frightened, grappled, paralyzed, petrified, prone, restrained, stunned",senses:"blindsight 10 ft., passive Perception 8",languages:"",cr:"1/2",traits:[{name:"Swarm",desc:"The swarm can occupy another creature's space and vice versa, and the swarm can move through any opening large enough for a Tiny insect. The swarm can't regain hit points or gain temporary hit points.",attack_bonus:0}],actions:[{name:"Bites",desc:"Melee Weapon Attack: +3 to hit, reach 0 ft., one target in the swarm's space. Hit: 10 (4d4) piercing damage, or 5 (2d4) piercing damage if the swarm has half of its hit points or fewer.",attack_bonus:3,damage_dice:"4d4"}]},{name:"Tarrasque",size:"Gargantuan",type:"monstrosity",subtype:"titan",alignment:"unaligned",ac:25,hp:676,hit_dice:"33d20 + 329",speed:"40 ft.",stats:[30,11,30,3,11,11],saves:[{intelligence:5},{wisdom:9},{charisma:9}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire, poison; bludgeoning, piercing, and slashing from nonmagical weapons",condition_immunities:"charmed, frightened, paralyzed, poisoned",senses:"blindsight 120 ft., passive Perception 10",languages:"",cr:"30",traits:[{name:"Legendary Resistance (3/Day)",desc:"If the tarrasque fails a saving throw, it can choose to succeed instead.",attack_bonus:0},{name:"Magic Resistance",desc:"The tarrasque has advantage on saving throws against spells and other magical effects.",attack_bonus:0},{name:"Reflective Carapace",desc:"Any time the tarrasque is targeted by a magic missile spell, a line spell, or a spell that requires a ranged attack roll, roll a d6. On a 1 to 5, the tarrasque is unaffected. On a 6, the tarrasque is unaffected, and the effect is reflected back at the caster as though it originated from the tarrasque, turning the caster into the target.",attack_bonus:0},{name:"Siege Monster",desc:"The tarrasque deals double damage to objects and structures.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The tarrasque can use its Frightful Presence. It then makes five attacks: one with its bite, two with its claws, one with its horns, and one with its tai l. It can use its Swallow instead of its bite.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +19 to hit, reach 10 ft., one target. Hit: 36 (4d12 + 10) piercing damage. If the target is a creature, it is grappled (escape DC 20). Until this grapple ends, the target is restrained, and the tarrasque can't bite another target.",attack_bonus:19,damage_dice:"4d12",damage_bonus:10},{name:"Claw",desc:"Melee Weapon Attack: +19 to hit, reach 15 ft., one target. Hit: 28 (4d8 + 10) slashing damage.",attack_bonus:19,damage_dice:"4d8",damage_bonus:10},{name:"Horns",desc:"Melee Weapon Attack: +19 to hit, reach 10 ft., one target. Hit: 32 (4d10 + 10) piercing damage.",attack_bonus:19,damage_dice:"4d10",damage_bonus:10},{name:"Tail",desc:"Melee Weapon Attack: +19 to hit, reach 20 ft., one target. Hit: 24 (4d6 + 10) bludgeoning damage. If the target is a creature, it must succeed on a DC 20 Strength saving throw or be knocked prone.",attack_bonus:19,damage_dice:"4d6",damage_bonus:10},{name:"Frightful Presence",desc:"Each creature of the tarrasque's choice within 120 feet of it and aware of it must succeed on a DC 17 Wisdom saving throw or become frightened for 1 minute. A creature can repeat the saving throw at the end of each of its turns, with disadvantage if the tarrasque is within line of sight, ending the effect on itself on a success. If a creature's saving throw is successful or the effect ends for it, the creature is immune to the tarrasque's Frightful Presence for the next 24 hours.",attack_bonus:0},{name:"Swallow",desc:"The tarrasque makes one bite attack against a Large or smaller creature it is grappling. If the attack hits, the target takes the bite's damage, the target is swallowed, and the grapple ends. While swallowed, the creature is blinded and restrained, it has total cover against attacks and other effects outside the tarrasque, and it takes 56 (16d6) acid damage at the start of each of the tarrasque's turns.\\nIf the tarrasque takes 60 damage or more on a single turn from a creature inside it, the tarrasque must succeed on a DC 20 Constitution saving throw at the end of that turn or regurgitate all swallowed creatures, which fall prone in a space within 10 feet of the tarrasque. If the tarrasque dies, a swallowed creature is no longer restrained by it and can escape from the corpse by using 30 feet of movement, exiting prone.",attack_bonus:0}],legendary_actions:[{name:"Attack",desc:"The tarrasque makes one claw attack or tail attack.",attack_bonus:0},{name:"Move",desc:"The tarrasque moves up to half its speed.",attack_bonus:0},{name:"Chomp (Costs 2 Actions)",desc:"The tarrasque makes one bite attack or uses its Swallow.",attack_bonus:0}]},{name:"Thug",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any non-good alignment",ac:11,hp:32,hit_dice:"5d8 + 9",speed:"30 ft.",stats:[15,11,14,10,10,11],skillsaves:[{intimidation:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"any one language (usually Common)",cr:"1/2",traits:[{name:"Pack Tactics",desc:"The thug has advantage on an attack roll against a creature if at least one of the thug's allies is within 5 ft. of the creature and the ally isn't incapacitated.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The thug makes two melee attacks.",attack_bonus:0},{name:"Mace",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 5 (1d6 + 2) bludgeoning damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2},{name:"Heavy Crossbow",desc:"Ranged Weapon Attack: +2 to hit, range 100/400 ft., one target. Hit: 5 (1d10) piercing damage.",attack_bonus:2,damage_dice:"1d10"}]},{name:"Tiger",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:12,hp:37,hit_dice:"5d10 + 9",speed:"40 ft.",stats:[17,15,14,3,12,8],skillsaves:[{perception:3},{stealth:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 13",languages:"",cr:"1",traits:[{name:"Keen Smell",desc:"The tiger has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0},{name:"Pounce",desc:"If the tiger moves at least 20 ft. straight toward a creature and then hits it with a claw attack on the same turn, that target must succeed on a DC 13 Strength saving throw or be knocked prone. If the target is prone, the tiger can make one bite attack against it as a bonus action.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 8 (1d10 + 3) piercing damage.",attack_bonus:5,damage_dice:"1d10",damage_bonus:3},{name:"Claw",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 7 (1d8 + 3) slashing damage.",attack_bonus:0}]},{name:"Treant",size:"Huge",type:"plant",subtype:"",alignment:"chaotic good",ac:16,hp:138,hit_dice:"12d12 + 60",speed:"30 ft.",stats:[23,8,21,12,16,12],damage_vulnerabilities:"fire",damage_resistances:"bludgeoning, piercing",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"Common, Druidic, Elvish, Sylvan",cr:"9",traits:[{name:"False Appearance",desc:"While the treant remains motionless, it is indistinguishable from a normal tree.",attack_bonus:0},{name:"Siege Monster",desc:"The treant deals double damage to objects and structures.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The treant makes two slam attacks.",attack_bonus:0},{name:"Slam",desc:"Melee Weapon Attack: +10 to hit, reach 5 ft., one target. Hit: 16 (3d6 + 6) bludgeoning damage.",attack_bonus:10,damage_dice:"3d6",damage_bonus:6},{name:"Rock",desc:"Ranged Weapon Attack: +10 to hit, range 60/180 ft., one target. Hit: 28 (4d10 + 6) bludgeoning damage.",attack_bonus:10,damage_dice:"4d10",damage_bonus:6},{name:"Animate Trees (1/Day)",desc:"The treant magically animates one or two trees it can see within 60 feet of it. These trees have the same statistics as a treant, except they have Intelligence and Charisma scores of 1, they can't speak, and they have only the Slam action option. An animated tree acts as an ally of the treant. The tree remains animate for 1 day or until it dies; until the treant dies or is more than 120 feet from the tree; or until the treant takes a bonus action to turn it back into an inanimate tree. The tree then takes root if possible.",attack_bonus:0}]},{name:"Tribal Warrior",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any alignment",ac:12,hp:11,hit_dice:"2d8 + 2",speed:"30 ft.",stats:[13,11,12,8,11,8],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"any one language",cr:"1/8",traits:[{name:"Pack Tactics",desc:"The warrior has advantage on an attack roll against a creature if at least one of the warrior's allies is within 5 ft. of the creature and the ally isn't incapacitated.",attack_bonus:0}],actions:[{name:"Spear",desc:"Melee or Ranged Weapon Attack: +3 to hit, reach 5 ft. or range 20/60 ft., one target. Hit: 4 (1d6 + 1) piercing damage, or 5 (1d8 + 1) piercing damage if used with two hands to make a melee attack.",attack_bonus:3,damage_dice:"1d6",damage_bonus:1}]},{name:"Triceratops",size:"Huge",type:"beast",subtype:"",alignment:"unaligned",ac:13,hp:95,hit_dice:"10d12 + 30",speed:"50 ft.",stats:[22,9,17,2,11,5],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 10",languages:"",cr:"5",traits:[{name:"Trampling Charge",desc:"If the triceratops moves at least 20 ft. straight toward a creature and then hits it with a gore attack on the same turn, that target must succeed on a DC 13 Strength saving throw or be knocked prone. If the target is prone, the triceratops can make one stomp attack against it as a bonus action.",attack_bonus:0}],actions:[{name:"Gore",desc:"Melee Weapon Attack: +9 to hit, reach 5 ft., one target. Hit: 24 (4d8 + 6) piercing damage.",attack_bonus:9,damage_dice:"4d8",damage_bonus:6},{name:"Stomp",desc:"Melee Weapon Attack: +9 to hit, reach 5 ft., one prone creature. Hit: 22 (3d10 + 6) bludgeoning damage",attack_bonus:9,damage_dice:"3d10",damage_bonus:6}]},{name:"Troll",size:"Large",type:"giant",subtype:"",alignment:"chaotic evil",ac:15,hp:84,hit_dice:"8d10 + 40",speed:"30 ft.",stats:[18,13,20,7,9,7],skillsaves:[{perception:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 12",languages:"Giant",cr:"5",traits:[{name:"Keen Smell",desc:"The troll has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0},{name:"Regeneration",desc:"The troll regains 10 hit points at the start of its turn. If the troll takes acid or fire damage, this trait doesn't function at the start of the troll's next turn. The troll dies only if it starts its turn with 0 hit points and doesn't regenerate.",attack_bonus:0},{name:"Variant: Loathsome Limbs",desc:"Whenever the troll takes at least 15 slashing damage at one time, roll a d20 to determine what else happens to it:\\n1-10: Nothing else happens.\\n11-14: One leg is severed from the troll if it has any legs left.\\n15- 18: One arm is severed from the troll if it has any arms left.\\n19-20: The troll is decapitated, but the troll dies only if it can't regenerate. If it dies, so does the severed head.\\nIf the troll finishes a short or long rest without reattaching a severed limb or head, the part regrows. At that point, the severed part dies. Until then, a severed part acts on the troll's initiative and has its own action and movement. A severed part has AC 13, 10 hit points, and the troll's Regeneration trait.\\nA severed leg is unable to attack and has a speed of 5 feet.\\nA severed arm has a speed of 5 feet and can make one claw attack on its turn, with disadvantage on the attack roll unless the troll can see the arm and its target. Each time the troll loses an arm, it loses a claw attack.\\nIf its head is severed, the troll loses its bite attack and its body is blinded unless the head can see it. The severed head has a speed of 0 feet and the troll's Keen Smell trait. It can make a bite attack but only against a target in its space.\\nThe troll's speed is halved if it's missing a leg. If it loses both legs, it falls prone. If it has both arms, it can crawl. With only one arm, it can still crawl, but its speed is halved. With no arms or legs, its speed is 0, and it can't benefit from bonuses to speed.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The troll makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 7 (1d6 + 4) piercing damage.",attack_bonus:7,damage_dice:"1d6",damage_bonus:4},{name:"Claw",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) slashing damage.",attack_bonus:7,damage_dice:"2d6",damage_bonus:4}]},{name:"Tyrannosaurus Rex",size:"Huge",type:"beast",subtype:"",alignment:"unaligned",ac:13,hp:136,hit_dice:"13d12 + 51",speed:"50 ft.",stats:[25,10,19,2,12,9],skillsaves:[{perception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 14",languages:"",cr:"8",actions:[{name:"Multiattack",desc:"The tyrannosaurus makes two attacks: one with its bite and one with its tail. It can't make both attacks against the same target.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +10 to hit, reach 10 ft., one target. Hit: 33 (4d12 + 7) piercing damage. If the target is a Medium or smaller creature, it is grappled (escape DC 17). Until this grapple ends, the target is restrained, and the tyrannosaurus can't bite another target.",attack_bonus:10,damage_dice:"4d12",damage_bonus:7},{name:"Tail",desc:"Melee Weapon Attack: +10 to hit, reach 10 ft., one target. Hit: 20 (3d8 + 7) bludgeoning damage.",attack_bonus:10,damage_dice:"3d8",damage_bonus:7}]},{name:"Unicorn",size:"Large",type:"celestial",subtype:"",alignment:"lawful good",ac:12,hp:67,hit_dice:"9d10 + 17",speed:"50 ft.",stats:[18,14,15,11,17,16],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"poison",condition_immunities:"charmed, paralyzed, poisoned",senses:"darkvision 60 ft., passive Perception 13",languages:"Celestial, Elvish, Sylvan, telepathy 60 ft.",cr:"5",traits:[{name:"Charge",desc:"If the unicorn moves at least 20 ft. straight toward a target and then hits it with a horn attack on the same turn, the target takes an extra 9 (2d8) piercing damage. If the target is a creature, it must succeed on a DC 15 Strength saving throw or be knocked prone.",attack_bonus:0,damage_dice:"2d8"},{name:"Innate Spellcasting",desc:"The unicorn's innate spellcasting ability is Charisma (spell save DC 14). The unicorn can innately cast the following spells, requiring no components:\\n\\nAt will: detect evil and good, druidcraft, pass without trace\\n1/day each: calm emotions, dispel evil and good, entangle",attack_bonus:0},{name:"Magic Resistance",desc:"The unicorn has advantage on saving throws against spells and other magical effects.",attack_bonus:0},{name:"Magic Weapons",desc:"The unicorn's weapon attacks are magical.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The unicorn makes two attacks: one with its hooves and one with its horn.",attack_bonus:0},{name:"Hooves",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft ., one target. Hit: 11 (2d6 + 4) bludgeoning damage.",attack_bonus:7,damage_dice:"2d6",damage_bonus:4},{name:"Horn",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft ., one target. Hit: 8 (1d8 + 4) piercing damage.",attack_bonus:7,damage_dice:"1d8",damage_bonus:4},{name:"Healing Touch (3/Day)",desc:"The unicorn touches another creature with its horn. The target magically regains 11 (2d8 + 2) hit points. In addition, the touch removes all diseases and neutralizes all poisons afflicting the target.",attack_bonus:0},{name:"Teleport (1/Day)",desc:"The unicorn magically teleports itself and up to three willing creatures it can see within 5 ft. of it, along with any equipment they are wearing or carrying, to a location the unicorn is familiar with, up to 1 mile away.",attack_bonus:0}],legendary_actions:[{name:"Hooves",desc:"The unicorn makes one attack with its hooves.",attack_bonus:0},{name:"Shimmering Shield (Costs 2 Actions)",desc:"The unicorn creates a shimmering, magical field around itself or another creature it can see within 60 ft. of it. The target gains a +2 bonus to AC until the end of the unicorn's next turn.",attack_bonus:0},{name:"Heal Self (Costs 3 Actions)",desc:"The unicorn magically regains 11 (2d8 + 2) hit points.",attack_bonus:0}]},{name:"Vampire",size:"Medium",type:"undead",subtype:"shapechanger",alignment:"lawful evil",ac:16,hp:144,hit_dice:"17d8 + 67",speed:"30 ft.",stats:[18,18,18,17,15,18],saves:[{dexterity:9},{wisdom:7},{charisma:9}],skillsaves:[{perception:7},{stealth:9}],damage_vulnerabilities:"",damage_resistances:"necrotic; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"",condition_immunities:"",senses:"darkvision 120 ft., passive Perception 17",languages:"the languages it knew in life",cr:"13",traits:[{name:"Shapechanger",desc:"If the vampire isn't in sun light or running water, it can use its action to polymorph into a Tiny bat or a Medium cloud of mist, or back into its true form.\\nWhile in bat form, the vampire can't speak, its walking speed is 5 feet, and it has a flying speed of 30 feet. Its statistics, other than its size and speed, are unchanged. Anything it is wearing transforms with it, but nothing it is carrying does. It reverts to its true form if it dies.\\nWhile in mist form, the vampire can't take any actions, speak, or manipulate objects. It is weightless, has a flying speed of 20 feet, can hover, and can enter a hostile creature's space and stop there. In addition, if air can pass through a space, the mist can do so without squeezing, and it can't pass through water. It has advantage on Strength, Dexterity, and Constitution saving throws, and it is immune to all nonmagical damage, except the damage it takes from sunlight.",attack_bonus:0},{name:"Legendary Resistance (3/Day)",desc:"If the vampire fails a saving throw, it can choose to succeed instead.",attack_bonus:0},{name:"Misty Escape",desc:"When it drops to 0 hit points outside its resting place, the vampire transforms into a cloud of mist (as in the Shapechanger trait) instead of falling unconscious, provided that it isn't in sunlight or running water. If it can't transform, it is destroyed.\\nWhile it has 0 hit points in mist form, it can't revert to its vampire form, and it must reach its resting place within 2 hours or be destroyed. Once in its resting place, it reverts to its vampire form. It is then paralyzed until it regains at least 1 hit point. After spending 1 hour in its resting place with 0 hit points, it regains 1 hit point.",attack_bonus:0},{name:"Regeneration",desc:"The vampire regains 20 hit points at the start of its turn if it has at least 1 hit point and isn't in sunlight or running water. If the vampire takes radiant damage or damage from holy water, this trait doesn't function at the start of the vampire's next turn.",attack_bonus:0},{name:"Spider Climb",desc:"The vampire can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",attack_bonus:0},{name:"Vampire Weaknesses",desc:"The vampire has the following flaws:\\nForbiddance. The vampire can't enter a residence without an invitation from one of the occupants.\\nHarmed by Running Water. The vampire takes 20 acid damage if it ends its turn in running water.\\nStake to the Heart. If a piercing weapon made of wood is driven into the vampire's heart while the vampire is incapacitated in its resting place, the vampire is paralyzed until the stake is removed.\\nSunlight Hypersensitivity. The vampire takes 20 radiant damage when it starts its turn in sunlight. While in sunlight, it has disadvantage on attack rolls and ability checks.",attack_bonus:0}],actions:[{name:"Multiattack (Vampire Form Only)",desc:"The vampire makes two attacks, only one of which can be a bite attack.",attack_bonus:0},{name:"Unarmed Strike (Vampire Form Only)",desc:"Melee Weapon Attack: +9 to hit, reach 5 ft., one creature. Hit: 8 (1d8 + 4) bludgeoning damage. Instead of dealing damage, the vampire can grapple the target (escape DC 18).",attack_bonus:9,damage_dice:"1d8",damage_bonus:4},{name:"Bite (Bat or Vampire Form Only)",desc:"Melee Weapon Attack: +9 to hit, reach 5 ft., one willing creature, or a creature that is grappled by the vampire, incapacitated, or restrained. Hit: 7 (1d6 + 4) piercing damage plus 10 (3d6) necrotic damage. The target's hit point maximum is reduced by an amount equal to the necrotic damage taken, and the vampire regains hit points equal to that amount. The reduction lasts until the target finishes a long rest. The target dies if this effect reduces its hit point maximum to 0. A humanoid slain in this way and then buried in the ground rises the following night as a vampire spawn under the vampire's control.",attack_bonus:9,damage_dice:"1d6 + 3d6",damage_bonus:4},{name:"Charm",desc:"The vampire targets one humanoid it can see within 30 ft. of it. If the target can see the vampire, the target must succeed on a DC 17 Wisdom saving throw against this magic or be charmed by the vampire. The charmed target regards the vampire as a trusted friend to be heeded and protected. Although the target isn't under the vampire's control, it takes the vampire's requests or actions in the most favorable way it can, and it is a willing target for the vampire's bit attack.\\nEach time the vampire or the vampire's companions do anything harmful to the target, it can repeat the saving throw, ending the effect on itself on a success. Otherwise, the effect lasts 24 hours or until the vampire is destroyed, is on a different plane of existence than the target, or takes a bonus action to end the effect.",attack_bonus:0},{name:"Children of the Night (1/Day)",desc:"The vampire magically calls 2d4 swarms of bats or rats, provided that the sun isn't up. While outdoors, the vampire can call 3d6 wolves instead. The called creatures arrive in 1d4 rounds, acting as allies of the vampire and obeying its spoken commands. The beasts remain for 1 hour, until the vampire dies, or until the vampire dismisses them as a bonus action.",attack_bonus:0}],legendary_actions:[{name:"Move",desc:"The vampire moves up to its speed without provoking opportunity attacks.",attack_bonus:0},{name:"Unarmed Strike",desc:"The vampire makes one unarmed strike.",attack_bonus:0},{name:"Bite (Costs 2 Actions)",desc:"The vampire makes one bite attack.",attack_bonus:0}]},{name:"Vampire Spawn",size:"Medium",type:"undead",subtype:"",alignment:"neutral evil",ac:15,hp:82,hit_dice:"11d8 + 32",speed:"30 ft.",stats:[16,16,16,11,10,12],saves:[{dexterity:6},{wisdom:3}],skillsaves:[{perception:3},{stealth:6}],damage_vulnerabilities:"",damage_resistances:"necrotic; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 13",languages:"the languages it knew in life",cr:"5",traits:[{name:"Regeneration",desc:"The vampire regains 10 hit points at the start of its turn if it has at least 1 hit point and isn't in sunlight or running water. If the vampire takes radiant damage or damage from holy water, this trait doesn't function at the start of the vampire's next turn.",attack_bonus:0},{name:"Spider Climb",desc:"The vampire can climb difficult surfaces, including upside down on ceilings, without needing to make an ability check.",attack_bonus:0},{name:"Vampire Weaknesses",desc:"The vampire has the following flaws:\\nForbiddance. The vampire can't enter a residence without an invitation from one of the occupants.\\nHarmed by Running Water. The vampire takes 20 acid damage when it ends its turn in running water.\\nStake to the Heart. The vampire is destroyed if a piercing weapon made of wood is driven into its heart while it is incapacitated in its resting place.\\nSunlight Hypersensitivity. The vampire takes 20 radiant damage when it starts its turn in sunlight. While in sunlight, it has disadvantage on attack rolls and ability checks.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The vampire makes two attacks, only one of which can be a bite attack.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one willing creature, or a creature that is grappled by the vampire, incapacitated, or restrained. Hit: 6 (1d6 + 3) piercing damage plus 7 (2d6) necrotic damage. The target's hit point maximum is reduced by an amount equal to the necrotic damage taken, and the vampire regains hit points equal to that amount. The reduction lasts until the target finishes a long rest. The target dies if this effect reduces its hit point maximum to 0.",attack_bonus:61},{name:"Claws",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one creature. Hit: 8 (2d4 + 3) slashing damage. Instead of dealing damage, the vampire can grapple the target (escape DC 13).",attack_bonus:6,damage_dice:"2d4",damage_bonus:3}]},{name:"Veteran",size:"Medium",type:"humanoid",subtype:"any race",alignment:"any alignment",ac:17,hp:58,hit_dice:"9d8 + 17",speed:"30 ft.",stats:[16,13,14,10,11,10],skillsaves:[{athletics:5},{perception:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 12",languages:"any one language (usually Common)",cr:"3",actions:[{name:"Multiattack",desc:"The veteran makes two longsword attacks. If it has a shortsword drawn, it can also make a shortsword attack.",attack_bonus:0},{name:"Longsword",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 7 (1d8 + 3) slashing damage, or 8 (1d10 + 3) slashing damage if used with two hands.",attack_bonus:5,damage_dice:"1d8",damage_bonus:3},{name:"Shortsword",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) piercing damage.",attack_bonus:5,damage_dice:"1d6",damage_bonus:3},{name:"Heavy Crossbow",desc:"Ranged Weapon Attack: +3 to hit, range 100/400 ft., one target. Hit: 6 (1d10 + 1) piercing damage.",attack_bonus:3,damage_dice:"1d10",damage_bonus:1}]},{name:"Violet Fungus",size:"Medium",type:"plant",subtype:"",alignment:"unaligned",ac:5,hp:18,hit_dice:"4d8",speed:"5 ft.",stats:[3,1,10,1,3,1],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"blinded, deafened, frightened",senses:"blindsight 30 ft. (blind beyond this radius), passive Perception 6",languages:"",cr:"1/4",traits:[{name:"False Appearance",desc:"While the violet fungus remains motionless, it is indistinguishable from an ordinary fungus.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The fungus makes 1d4 Rotting Touch attacks.",attack_bonus:0},{name:"Rotting Touch",desc:"Melee Weapon Attack: +2 to hit, reach 10 ft., one creature. Hit: 4 (1d8) necrotic damage.",attack_bonus:2,damage_dice:"1d8"}]},{name:"Vrock",size:"Large",type:"fiend",subtype:"demon",alignment:"chaotic evil",ac:15,hp:104,hit_dice:"11d10 + 43",speed:"40 ft., fly 60 ft.",stats:[17,15,18,8,13,8],saves:[{dexterity:5},{wisdom:4},{charisma:2}],damage_vulnerabilities:"",damage_resistances:"cold, fire, lightning; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"poison",condition_immunities:"poisoned",senses:"darkvision 120 ft., passive Perception 11",languages:"Abyssal, telepathy 120 ft.",cr:"6",traits:[{name:"Magic Resistance",desc:"The vrock has advantage on saving throws against spells and other magical effects.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The vrock makes two attacks: one with its beak and one with its talons.",attack_bonus:0},{name:"Beak",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) piercing damage.",attack_bonus:6,damage_dice:"2d6",damage_bonus:3},{name:"Talons",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 14 (2d10 + 3) slashing damage.",attack_bonus:6,damage_dice:"2d10",damage_bonus:3},{name:"Spores (Recharge 6)",desc:"A 15-foot-radius cloud of toxic spores extends out from the vrock. The spores spread around corners. Each creature in that area must succeed on a DC 14 Constitution saving throw or become poisoned. While poisoned in this way, a target takes 5 (1d10) poison damage at the start of each of its turns. A target can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success. Emptying a vial of holy water on the target also ends the effect on it.",attack_bonus:0},{name:"Stunning Screech (1/Day)",desc:"The vrock emits a horrific screech. Each creature within 20 feet of it that can hear it and that isn't a demon must succeed on a DC 14 Constitution saving throw or be stunned until the end of the vrock's next turn .",attack_bonus:0},{name:"Variant: Summon Demon (1/Day)",desc:"The demon chooses what to summon and attempts a magical summoning.\\nA vrock has a 30 percent chance of summoning 2d4 dretches or one vrock.\\nA summoned demon appears in an unoccupied space within 60 feet of its summoner, acts as an ally of its summoner, and can't summon other demons. It remains for 1 minute, until it or its summoner dies, or until its summoner dismisses it as an action.",attack_bonus:0}]},{name:"Vulture",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:10,hp:5,hit_dice:"1d8",speed:"10 ft., fly 50 ft.",stats:[7,10,13,2,12,4],skillsaves:[{perception:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"",cr:"0",traits:[{name:"Keen Sight and Smell",desc:"The vulture has advantage on Wisdom (Perception) checks that rely on sight or smell.",attack_bonus:0},{name:"Pack Tactics",desc:"The vulture has advantage on an attack roll against a creature if at least one of the vulture's allies is within 5 ft. of the creature and the ally isn't incapacitated.",attack_bonus:0}],actions:[{name:"Beak",desc:"Melee Weapon Attack: +2 to hit, reach 5 ft., one target. Hit: 2 (1d4) piercing damage.",attack_bonus:2,damage_dice:"1d4"}]},{name:"Warhorse",size:"Large",type:"beast",subtype:"",alignment:"unaligned",ac:11,hp:19,hit_dice:"3d10 + 2",speed:"60 ft.",stats:[18,12,13,2,12,7],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 11",languages:"",cr:"1/2",traits:[{name:"Trampling Charge",desc:"If the horse moves at least 20 ft. straight toward a creature and then hits it with a hooves attack on the same turn, that target must succeed on a DC 14 Strength saving throw or be knocked prone. If the target is prone, the horse can make another attack with its hooves against it as a bonus action.",attack_bonus:0}],actions:[{name:"Hooves",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) bludgeoning damage.",attack_bonus:6,damage_dice:"2d6",damage_bonus:4}]},{name:"Warhorse Skeleton",size:"Large",type:"undead",subtype:"",alignment:"lawful evil",ac:13,hp:22,hit_dice:"3d10 + 5",speed:"60 ft.",stats:[18,12,15,2,8,5],damage_vulnerabilities:"bludgeoning",damage_resistances:"",damage_immunities:"poison",condition_immunities:"exhaustion, poisoned",senses:"darkvision 60 ft., passive Perception 9",languages:"",cr:"1/2",actions:[{name:"Hooves",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) bludgeoning damage.",attack_bonus:6,damage_dice:"2d6",damage_bonus:4}]},{name:"Water Elemental",size:"Large",type:"elemental",subtype:"",alignment:"neutral",ac:14,hp:114,hit_dice:"12d10 + 48",speed:"30 ft., swim 90 ft.",stats:[18,14,18,5,10,8],damage_vulnerabilities:"",damage_resistances:"acid; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"poison",condition_immunities:"exhaustion, grappled, paralyzed, petrified, poisoned, prone, restrained, unconscious",senses:"darkvision 60 ft., passive Perception 10",languages:"Aquan",cr:"5",traits:[{name:"Water Form",desc:"The elemental can enter a hostile creature's space and stop there. It can move through a space as narrow as 1 inch wide without squeezing.",attack_bonus:0},{name:"Freeze",desc:"If the elemental takes cold damage, it partially freezes; its speed is reduced by 20 ft. until the end of its next turn.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The elemental makes two slam attacks.",attack_bonus:0},{name:"Slam",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) bludgeoning damage.",attack_bonus:7,damage_dice:"2d8",damage_bonus:4},{name:"Whelm (Recharge 4-6)",desc:"Each creature in the elemental's space must make a DC 15 Strength saving throw. On a failure, a target takes 13 (2d8 + 4) bludgeoning damage. If it is Large or smaller, it is also grappled (escape DC 14). Until this grapple ends, the target is restrained and unable to breathe unless it can breathe water. If the saving throw is successful, the target is pushed out of the elemental's space.\\nThe elemental can grapple one Large creature or up to two Medium or smaller creatures at one time. At the start of each of the elemental's turns, each target grappled by it takes 13 (2d8 + 4) bludgeoning damage. A creature within 5 feet of the elemental can pull a creature or object out of it by taking an action to make a DC 14 Strength and succeeding.",attack_bonus:0}]},{name:"Weasel",size:"Tiny",type:"beast",subtype:"",alignment:"unaligned",ac:13,hp:1,hit_dice:"1d4 + -2",speed:"30 ft.",stats:[3,16,8,2,12,3],skillsaves:[{perception:3},{stealth:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"",cr:"0",traits:[{name:"Keen Hearing and Smell",desc:"The weasel has advantage on Wisdom (Perception) checks that rely on hearing or smell.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one creature. Hit: 1 piercing damage.",attack_bonus:5,damage_bonus:1}]},{name:"Werebear",size:"Medium",type:"humanoid",subtype:"human",alignment:"neutral good",ac:10,hp:135,hit_dice:"18d8 + 54",speed:"30 ft. (40 ft., climb 30 ft. in bear or hybrid form)",stats:[19,10,17,11,12,12],skillsaves:[{perception:7}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"bludgeoning, piercing, and slashing damage from nonmagical weapons that aren't silvered",condition_immunities:"",senses:"passive Perception 17",languages:"Common (can't speak in bear form)",cr:"5",traits:[{name:"Shapechanger",desc:"The werebear can use its action to polymorph into a Large bear-humanoid hybrid or into a Large bear, or back into its true form, which is humanoid. Its statistics, other than its size and AC, are the same in each form. Any equipment it. is wearing or carrying isn't transformed. It reverts to its true form if it dies.",attack_bonus:0},{name:"Keen Smell",desc:"The werebear has advantage on WisGlom (Perception) checks that rely on smell.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"In bear form, the werebear makes two claw attacks. In humanoid form, it makes two greataxe attacks. In hybrid form, it can attack like a bear or a humanoid.",attack_bonus:0},{name:"Bite (Bear or Hybrid Form Only)",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 15 (2d10 + 4) piercing damage. If the target is a humanoid, it must succeed on a DC 14 Constitution saving throw or be cursed with were bear lycanthropy.",attack_bonus:7,damage_dice:"2d10",damage_bonus:4},{name:"Claw (Bear or Hybrid Form Only)",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) slashing damage.",attack_bonus:7,damage_dice:"2d8",damage_bonus:4},{name:"Greataxe (Humanoid or Hybrid Form Only)",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 10 (1d12 + 4) slashing damage.",attack_bonus:7,damage_dice:"1d12",damage_bonus:4}]},{name:"Wereboar",size:"Medium",type:"humanoid",subtype:"human",alignment:"neutral evil",ac:10,hp:78,hit_dice:"12d8 + 24",speed:"30 ft. (40 ft. in boar form)",stats:[17,10,15,10,11,8],skillsaves:[{perception:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"bludgeoning, piercing, and slashing damage from nonmagical weapons that aren't silvered",condition_immunities:"",senses:"passive Perception 12",languages:"Common (can't speak in boar form)",cr:"4",traits:[{name:"Shapechanger",desc:"The wereboar can use its action to polymorph into a boar-humanoid hybrid or into a boar, or back into its true form, which is humanoid. Its statistics, other than its AC, are the same in each form. Any equipment it is wearing or carrying isn't transformed. It reverts to its true form if it dies.",attack_bonus:0},{name:"Charge (Boar or Hybrid Form Only)",desc:"If the wereboar moves at least 15 feet straight toward a target and then hits it with its tusks on the same turn, the target takes an extra 7 (2d6) slashing damage. If the target is a creature, it must succeed on a DC 13 Strength saving throw or be knocked prone.",attack_bonus:0,damage_dice:"2d6"},{name:"Relentless (Recharges after a Short or Long Rest)",desc:"If the wereboar takes 14 damage or less that would reduce it to 0 hit points, it is reduced to 1 hit point instead.",attack_bonus:0}],actions:[{name:"Multiattack (Humanoid or Hybrid Form Only)",desc:"The wereboar makes two attacks, only one of which can be with its tusks.",attack_bonus:0},{name:"Maul (Humanoid or Hybrid Form Only)",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) bludgeoning damage.",attack_bonus:5,damage_dice:"2d6",damage_bonus:3},{name:"Tusks (Boar or Hybrid Form Only)",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) slashing damage. If the target is a humanoid, it must succeed on a DC 12 Constitution saving throw or be cursed with wereboar lycanthropy.",attack_bonus:5,damage_dice:"2d6",damage_bonus:3}]},{name:"Wererat",size:"Medium",type:"humanoid",subtype:"human",alignment:"lawful evil",ac:12,hp:33,hit_dice:"6d8 + 6",speed:"30 ft.",stats:[10,15,12,11,10,8],skillsaves:[{perception:2},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"bludgeoning, piercing, and slashing damage from nonmagical weapons that aren't silvered",condition_immunities:"",senses:"darkvision 60 ft. (rat form only), passive Perception 12",languages:"Common (can't speak in rat form)",cr:"2",traits:[{name:"Shapechanger",desc:"The wererat can use its action to polymorph into a rat-humanoid hybrid or into a giant rat, or back into its true form, which is humanoid. Its statistics, other than its size, are the same in each form. Any equipment it is wearing or carrying isn't transformed. It reverts to its true form if it dies.",attack_bonus:0},{name:"Keen Smell",desc:"The wererat has advantage on Wisdom (Perception) checks that rely on smell.",attack_bonus:0}],actions:[{name:"Multiattack (Humanoid or Hybrid Form Only)",desc:"The wererat makes two attacks, only one of which can be a bite.",attack_bonus:0},{name:"Bite (Rat or Hybrid Form Only).",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 4 (1d4 + 2) piercing damage. If the target is a humanoid, it must succeed on a DC 11 Constitution saving throw or be cursed with wererat lycanthropy.",attack_bonus:4,damage_dice:"1d4",damage_bonus:2},{name:"Shortsword (Humanoid or Hybrid Form Only)",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2},{name:"Hand Crossbow (Humanoid or Hybrid Form Only)",desc:"Ranged Weapon Attack: +4 to hit, range 30/120 ft., one target. Hit: 5 (1d6 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2}]},{name:"Weretiger",size:"Medium",type:"humanoid",subtype:"human",alignment:"neutral",ac:12,hp:120,hit_dice:"16d8 + 48",speed:"30 ft. (40 ft. in tiger form)",stats:[17,15,16,10,13,11],skillsaves:[{perception:5},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"bludgeoning, piercing, and slashing damage from nonmagical weapons that aren't silvered",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 15",languages:"Common (can't speak in tiger form)",cr:"4",traits:[{name:"Shapechanger",desc:"The weretiger can use its action to polymorph into a tiger-humanoid hybrid or into a tiger, or back into its true form, which is humanoid. Its statistics, other than its size, are the same in each form. Any equipment it is wearing or carrying isn't transformed. It reverts to its true form if it dies.",attack_bonus:0},{name:"Keen Hearing and Smell",desc:"The weretiger has advantage on Wisdom (Perception) checks that rely on hearing or smell.",attack_bonus:0},{name:"Pounce (Tiger or Hybrid Form Only)",desc:"If the weretiger moves at least 15 feet straight toward a creature and then hits it with a claw attack on the same turn, that target must succeed on a DC 14 Strength saving throw or be knocked prone. If the target is prone, the weretiger can make one bite attack against it as a bonus action.",attack_bonus:0}],actions:[{name:"Multiattack (Humanoid or Hybrid Form Only)",desc:"In humanoid form, the weretiger makes two scimitar attacks or two longbow attacks. In hybrid form, it can attack like a humanoid or make two claw attacks.",attack_bonus:0},{name:"Bite (Tiger or Hybrid Form Only)",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 8 (1d10 + 3) piercing damage. If the target is a humanoid, it must succeed on a DC 13 Constitution saving throw or be cursed with weretiger lycanthropy.",attack_bonus:5,damage_dice:"1d10",damage_bonus:3},{name:"Claw (Tiger or Hybrid Form Only)",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 7 (1d8 + 3) slashing damage.",attack_bonus:5,damage_dice:"1d8",damage_bonus:3},{name:"Scimitar (Humanoid or Hybrid Form Only)",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) slashing damage.",attack_bonus:5,damage_dice:"1d6",damage_bonus:3},{name:"Longbow (Humanoid or Hybrid Form Only)",desc:"Ranged Weapon Attack: +4 to hit, range 150/600 ft., one target. Hit: 6 (1d8 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d8",damage_bonus:2}]},{name:"Werewolf",size:"Medium",type:"humanoid",subtype:"human",alignment:"chaotic evil",ac:11,hp:58,hit_dice:"9d8 + 17",speed:"30 ft. (40 ft. in wolf form)",stats:[15,13,14,10,11,10],skillsaves:[{perception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"bludgeoning, piercing, and slashing damage from nonmagical weapons that aren't silvered",condition_immunities:"",senses:"passive Perception 14",languages:"Common (can't speak in wolf form)",cr:"3",traits:[{name:"Shapechanger",desc:"The werewolf can use its action to polymorph into a wolf-humanoid hybrid or into a wolf, or back into its true form, which is humanoid. Its statistics, other than its AC, are the same in each form. Any equipment it is wearing or carrying isn't transformed. It reverts to its true form if it dies.",attack_bonus:0},{name:"Keen Hearing and Smell",desc:"The werewolf has advantage on Wisdom (Perception) checks that rely on hearing or smell.",attack_bonus:0}],actions:[{name:"Multiattack (Humanoid or Hybrid Form Only)",desc:"The werewolf makes two attacks: one with its bite and one with its claws or spear.",attack_bonus:0},{name:"Bite (Wolf or Hybrid Form Only)",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 6 (1d8 + 2) piercing damage. If the target is a humanoid, it must succeed on a DC 12 Constitution saving throw or be cursed with werewolf lycanthropy.",attack_bonus:4,damage_dice:"1d8",damage_bonus:2},{name:"Claws (Hybrid Form Only)",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 7 (2d4 + 2) slashing damage.",attack_bonus:4,damage_dice:"2d4",damage_bonus:2},{name:"Spear (Humanoid Form Only)",desc:"Melee or Ranged Weapon Attack: +4 to hit, reach 5 ft. or range 20/60 ft., one creature. Hit: 5 (1d6 + 2) piercing damage, or 6 (1d8 + 2) piercing damage if used with two hands to make a melee attack.",attack_bonus:4,damage_dice:"1d6",damage_bonus:-2}]},{name:"White Dragon Wyrmling",size:"Medium",type:"dragon",subtype:"",alignment:"chaotic evil",ac:16,hp:32,hit_dice:"5d8 + 9",speed:"30 ft., burrow 15 ft., fly 60 ft., swim 30 ft.",stats:[14,10,14,5,10,11],saves:[{dexterity:2},{constitution:4},{wisdom:2},{charisma:2}],skillsaves:[{perception:4},{stealth:2}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"cold",condition_immunities:"",senses:"blindsight 10 ft., darkvision 60 ft., passive Perception 14",languages:"Draconic",cr:"2",actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (1d10 + 2) piercing damage plus 2 (1d4) cold damage.",attack_bonus:4,damage_dice:"1d10 + 1d4",damage_bonus:2},{name:"Cold Breath (Recharge 5-6)",desc:"The dragon exhales an icy blast of hail in a 15-foot cone. Each creature in that area must make a DC 12 Constitution saving throw, taking 22 (5d8) cold damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"5d8"}]},{name:"Wight",size:"Medium",type:"undead",subtype:"",alignment:"neutral evil",ac:14,hp:45,hit_dice:"6d8 + 18",speed:"30 ft.",stats:[15,14,16,10,13,15],skillsaves:[{perception:3},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"necrotic; bludgeoning, piercing, and slashing from nonmagical weapons that aren't silvered",condition_immunities:"poisoned",senses:"darkvision 60 ft., passive Perception 13",languages:"the languages it knew in life",cr:"3",traits:[{name:"Sunlight Sensitivity",desc:"While in sunlight, the wight has disadvantage on attack rolls, as well as on Wisdom (Perception) checks that rely on sight.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The wight makes two longsword attacks or two longbow attacks. It can use its Life Drain in place of one longsword attack.",attack_bonus:0},{name:"Life Drain",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one creature. Hit: 5 (1d6 + 2) necrotic damage. The target must succeed on a DC 13 Constitution saving throw or its hit point maximum is reduced by an amount equal to the damage taken. This reduction lasts until the target finishes a long rest. The target dies if this effect reduces its hit point maximum to 0.\\nA humanoid slain by this attack rises 24 hours later as a zombie under the wight's control, unless the humanoid is restored to life or its body is destroyed. The wight can have no more than twelve zombies under its control at one time.",attack_bonus:4,damage_dice:"1d6",damage_bonus:2},{name:"Longsword",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 6 (1d8 + 2) slashing damage, or 7 (1d10 + 2) slashing damage if used with two hands.",attack_bonus:4,damage_dice:"1d8",damage_bonus:2},{name:"Longbow",desc:"Ranged Weapon Attack: +4 to hit, range 150/600 ft., one target. Hit: 6 (1d8 + 2) piercing damage.",attack_bonus:4,damage_dice:"1d8",damage_bonus:2}]},{name:"Will-o'-Wisp",size:"Tiny",type:"undead",subtype:"",alignment:"chaotic evil",ac:19,hp:22,hit_dice:"9d4 + -1",speed:"0 ft., fly 50 ft. (hover)",stats:[1,28,10,13,14,11],damage_vulnerabilities:"",damage_resistances:"acid, cold, fire, necrotic, thunder; bludgeoning, piercing, and slashing from nonmagical weapons",damage_immunities:"lightning, poison",condition_immunities:"exhaustion, grappled, paralyzed, poisoned, prone, restrained, unconscious",senses:"darkvision 120 ft., passive Perception 12",languages:"the languages it knew in life",cr:"2",traits:[{name:"Consume Life",desc:"As a bonus action, the will-o'-wisp can target one creature it can see within 5 ft. of it that has 0 hit points and is still alive. The target must succeed on a DC 10 Constitution saving throw against this magic or die. If the target dies, the will-o'-wisp regains 10 (3d6) hit points.",attack_bonus:0},{name:"Ephemeral",desc:"The will-o'-wisp can't wear or carry anything.",attack_bonus:0},{name:"Incorporeal Movement",desc:"The will-o'-wisp can move through other creatures and objects as if they were difficult terrain. It takes 5 (1d10) force damage if it ends its turn inside an object.",attack_bonus:0},{name:"Variable Illumination",desc:"The will-o'-wisp sheds bright light in a 5- to 20-foot radius and dim light for an additional number of ft. equal to the chosen radius. The will-o'-wisp can alter the radius as a bonus action.",attack_bonus:0}],actions:[{name:"Shock",desc:"Melee Spell Attack: +4 to hit, reach 5 ft., one creature. Hit: 9 (2d8) lightning damage.",attack_bonus:4,damage_dice:"2d8"},{name:"Invisibility",desc:"The will-o'-wisp and its light magically become invisible until it attacks or uses its Consume Life, or until its concentration ends (as if concentrating on a spell).",attack_bonus:0}]},{name:"Winter Wolf",size:"Large",type:"monstrosity",subtype:"",alignment:"neutral evil",ac:13,hp:75,hit_dice:"10d10 + 20",speed:"50 ft.",stats:[18,13,14,7,12,8],skillsaves:[{perception:5},{stealth:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"cold",condition_immunities:"",senses:"passive Perception 15",languages:"Common, Giant, Winter Wolf",cr:"3",traits:[{name:"Keen Hearing and Smell",desc:"The wolf has advantage on Wisdom (Perception) checks that rely on hearing or smell.",attack_bonus:0},{name:"Pack Tactics",desc:"The wolf has advantage on an attack roll against a creature if at least one of the wolf's allies is within 5 ft. of the creature and the ally isn't incapacitated.",attack_bonus:0},{name:"Snow Camouflage",desc:"The wolf has advantage on Dexterity (Stealth) checks made to hide in snowy terrain.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) piercing damage. If the target is a creature, it must succeed on a DC 14 Strength saving throw or be knocked prone.",attack_bonus:6,damage_dice:"2d6",damage_bonus:4},{name:"Cold Breath (Recharge 5-6)",desc:"The wolf exhales a blast of freezing wind in a 15-foot cone. Each creature in that area must make a DC 12 Dexterity saving throw, taking 18 (4d8) cold damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"4d8"}]},{name:"Wolf",size:"Medium",type:"beast",subtype:"",alignment:"unaligned",ac:13,hp:11,hit_dice:"2d8 + 2",speed:"40 ft.",stats:[12,15,12,3,12,6],skillsaves:[{perception:3},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"passive Perception 13",languages:"",cr:"1/4",traits:[{name:"Keen Hearing and Smell",desc:"The wolf has advantage on Wisdom (Perception) checks that rely on hearing or smell.",attack_bonus:0},{name:"Pack Tactics",desc:"The wolf has advantage on an attack roll against a creature if at least one of the wolf's allies is within 5 ft. of the creature and the ally isn't incapacitated.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 7 (2d4 + 2) piercing damage. If the target is a creature, it must succeed on a DC 11 Strength saving throw or be knocked prone.",attack_bonus:4,damage_dice:"2d4",damage_bonus:2}]},{name:"Worg",size:"Large",type:"monstrosity",subtype:"",alignment:"neutral evil",ac:13,hp:26,hit_dice:"4d10 + 4",speed:"50 ft.",stats:[16,13,13,7,11,8],skillsaves:[{perception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 14",languages:"Goblin, Worg",cr:"1/2",traits:[{name:"Keen Hearing and Smell",desc:"The worg has advantage on Wisdom (Perception) checks that rely on hearing or smell.",attack_bonus:0}],actions:[{name:"Bite",desc:"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 10 (2d6 + 3) piercing damage. If the target is a creature, it must succeed on a DC 13 Strength saving throw or be knocked prone.",attack_bonus:5,damage_dice:"2d6",damage_bonus:3}]},{name:"Wraith",size:"Medium",type:"undead",subtype:"",alignment:"neutral evil",ac:13,hp:67,hit_dice:"9d8 + 26",speed:"0 ft., fly 60 ft. (hover)",stats:[6,16,16,12,14,15],damage_vulnerabilities:"",damage_resistances:"acid, cold, fire, lightning, thunder; bludgeoning, piercing, and slashing from nonmagical weapons that aren't silvered",damage_immunities:"necrotic, poison",condition_immunities:"charmed, exhaustion, grappled, paralyzed, petrified, poisoned, prone, restrained",senses:"darkvision 60 ft., passive Perception 12",languages:"the languages it knew in life",cr:"5",traits:[{name:"Incorporeal Movement",desc:"The wraith can move through other creatures and objects as if they were difficult terrain. It takes 5 (1d10) force damage if it ends its turn inside an object.",attack_bonus:0},{name:"Sunlight Sensitivity",desc:"While in sunlight, the wraith has disadvantage on attack rolls, as well as on Wisdom (Perception) checks that rely on sight.",attack_bonus:0}],actions:[{name:"Life Drain",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one creature. Hit: 21 (4d8 + 3) necrotic damage. The target must succeed on a DC 14 Constitution saving throw or its hit point maximum is reduced by an amount equal to the damage taken. This reduction lasts until the target finishes a long rest. The target dies if this effect reduces its hit point maximum to 0.",attack_bonus:6,damage_dice:"4d8",damage_bonus:3},{name:"Create Specter",desc:"The wraith targets a humanoid within 10 feet of it that has been dead for no longer than 1 minute and died violently. The target's spirit rises as a specter in the space of its corpse or in the nearest unoccupied space. The specter is under the wraith's control. The wraith can have no more than seven specters under its control at one time.",attack_bonus:0}]},{name:"Wyvern",size:"Large",type:"dragon",subtype:"",alignment:"unaligned",ac:13,hp:110,hit_dice:"13d10 + 38",speed:"20 ft., fly 80 ft.",stats:[19,10,16,5,12,6],skillsaves:[{perception:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., passive Perception 14",languages:"",cr:"6",actions:[{name:"Multiattack",desc:"The wyvern makes two attacks: one with its bite and one with its stinger. While flying, it can use its claws in place of one other attack.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +7 to hit, reach 10 ft., one creature. Hit: 11 (2d6 + 4) piercing damage.",attack_bonus:7,damage_dice:"2d6",damage_bonus:4},{name:"Claws",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 13 (2d8 + 4) slashing damage.",attack_bonus:7,damage_dice:"2d8",damage_bonus:4},{name:"Stinger",desc:"Melee Weapon Attack: +7 to hit, reach 10 ft., one creature. Hit: 11 (2d6 + 4) piercing damage. The target must make a DC 15 Constitution saving throw, taking 24 (7d6) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:7,damage_dice:"2d6",damage_bonus:4}]},{name:"Xorn",size:"Medium",type:"elemental",subtype:"",alignment:"neutral",ac:19,hp:73,hit_dice:"7d8 + 41",speed:"20 ft., burrow 20 ft.",stats:[17,10,22,11,10,11],skillsaves:[{perception:6},{stealth:3}],damage_vulnerabilities:"",damage_resistances:"piercing and slashing from nonmagical weapons that aren't adamantine",damage_immunities:"",condition_immunities:"",senses:"darkvision 60 ft., tremorsense 60 ft., passive Perception 16",languages:"Terran",cr:"5",traits:[{name:"Earth Glide",desc:"The xorn can burrow through nonmagical, unworked earth and stone. While doing so, the xorn doesn't disturb the material it moves through.",attack_bonus:0},{name:"Stone Camouflage",desc:"The xorn has advantage on Dexterity (Stealth) checks made to hide in rocky terrain.",attack_bonus:0},{name:"Treasure Sense",desc:"The xorn can pinpoint, by scent, the location of precious metals and stones, such as coins and gems, within 60 ft. of it.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The xorn makes three claw attacks and one bite attack.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 13 (3d6 + 3) piercing damage.",attack_bonus:6,damage_dice:"3d6",damage_bonus:3},{name:"Claw",desc:"Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 6 (1d6 + 3) slashing damage.",attack_bonus:6,damage_dice:"1d6",damage_bonus:3}]},{name:"Young Black Dragon",size:"Large",type:"dragon",subtype:"",alignment:"chaotic evil",ac:18,hp:127,hit_dice:"15d10 + 44",speed:"40 ft., fly 80 ft., swim 40 ft.",stats:[19,14,17,12,11,15],saves:[{dexterity:5},{constitution:6},{wisdom:3},{charisma:5}],skillsaves:[{perception:6},{stealth:5}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"acid",condition_immunities:"",senses:"blindsight 30 ft., darkvision 120 ft., passive Perception 16",languages:"Common, Draconic",cr:"7",traits:[{name:"Amphibious",desc:"The dragon can breathe air and water.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +7 to hit, reach 10 ft., one target. Hit: 15 (2d10 + 4) piercing damage plus 4 (1d8) acid damage.",attack_bonus:7,damage_dice:"2d10 + 1d8",damage_bonus:4},{name:"Claw",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) slashing damage.",attack_bonus:7,damage_dice:"2d6",damage_bonus:4},{name:"Acid Breath (Recharge 5-6)",desc:"The dragon exhales acid in a 30-foot line that is 5 feet wide. Each creature in that line must make a DC 14 Dexterity saving throw, taking 49 (11d8) acid damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"11d8"}]},{name:"Young Blue Dragon",size:"Large",type:"dragon",subtype:"",alignment:"lawful evil",ac:18,hp:152,hit_dice:"16d10 + 64",speed:"40 ft., burrow 40 ft., fly 80 ft.",stats:[21,10,19,14,13,17],saves:[{dexterity:4},{constitution:8},{wisdom:5},{charisma:7}],skillsaves:[{perception:9},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"lightning",condition_immunities:"",senses:"blindsight 30 ft., darkvision 120 ft., passive Perception 19",languages:"Common, Draconic",cr:"9",actions:[{name:"Multiattack",desc:"The dragon makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +9 to hit, reach 10 ft., one target. Hit: 16 (2d10 + 5) piercing damage plus 5 (1d10) lightning damage.",attack_bonus:9,damage_dice:"2d10 + 1d10",damage_bonus:5},{name:"Claw",desc:"Melee Weapon Attack: +9 to hit, reach 5 ft., one target. Hit: 12 (2d6 + 5) slashing damage.",attack_bonus:9,damage_dice:"2d6",damage_bonus:5},{name:"Lightning Breath (Recharge 5-6)",desc:"The dragon exhales lightning in an 60-foot line that is 5 feet wide. Each creature in that line must make a DC 16 Dexterity saving throw, taking 55 (10d10) lightning damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"10d10"}]},{name:"Young Brass Dragon",size:"Large",type:"dragon",subtype:"",alignment:"chaotic good",ac:17,hp:110,hit_dice:"13d10 + 38",speed:"40 ft., burrow 20 ft., fly 80 ft.",stats:[19,10,17,12,11,15],saves:[{dexterity:3},{constitution:6},{wisdom:3},{charisma:5}],skillsaves:[{perception:6},{persuasion:5},{stealth:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire",condition_immunities:"",senses:"blindsight 30 ft., darkvision 120 ft., passive Perception 16",languages:"Common, Draconic",cr:"6",actions:[{name:"Multiattack",desc:"The dragon makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +7 to hit, reach 10 ft., one target. Hit: 15 (2d10 + 4) piercing damage.",attack_bonus:7,damage_dice:"2d10",damage_bonus:4},{name:"Claw",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) slashing damage.",attack_bonus:7,damage_dice:"2d6",damage_bonus:4},{name:"Breath Weapons (Recharge 5-6)",desc:"The dragon uses one of the following breath weapons.\\nFire Breath. The dragon exhales fire in a 40-foot line that is 5 feet wide. Each creature in that line must make a DC 14 Dexterity saving throw, taking 42 (12d6) fire damage on a failed save, or half as much damage on a successful one.\\nSleep Breath. The dragon exhales sleep gas in a 30-foot cone. Each creature in that area must succeed on a DC 14 Constitution saving throw or fall unconscious for 5 minutes. This effect ends for a creature if the creature takes damage or someone uses an action to wake it.",attack_bonus:0,damage_dice:"12d6"}]},{name:"Young Bronze Dragon",size:"Large",type:"dragon",subtype:"",alignment:"lawful good",ac:18,hp:142,hit_dice:"15d10 + 59",speed:"40 ft., fly 80 ft., swim 40 ft.",stats:[21,10,19,14,13,17],saves:[{dexterity:3},{constitution:7},{wisdom:4},{charisma:6}],skillsaves:[{insight:4},{perception:7},{stealth:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"lightning",condition_immunities:"",senses:"blindsight 30 ft., darkvision 120 ft., passive Perception 17",languages:"Common, Draconic",cr:"8",traits:[{name:"Amphibious",desc:"The dragon can breathe air and water.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +8 to hit, reach 10 ft., one target. Hit: 16 (2d10 + 5) piercing damage.",attack_bonus:8,damage_dice:"2d10",damage_bonus:5},{name:"Claw",desc:"Melee Weapon Attack: +8 to hit, reach 5 ft., one target. Hit: 12 (2d6 + 5) slashing damage.",attack_bonus:8,damage_dice:"2d6",damage_bonus:5},{name:"Breath Weapons (Recharge 5-6)",desc:"The dragon uses one of the following breath weapons.\\nLightning Breath. The dragon exhales lightning in a 60-foot line that is 5 feet wide. Each creature in that line must make a DC 15 Dexterity saving throw, taking 55 (10d10) lightning damage on a failed save, or half as much damage on a successful one.\\nRepulsion Breath. The dragon exhales repulsion energy in a 30-foot cone. Each creature in that area must succeed on a DC 15 Strength saving throw. On a failed save, the creature is pushed 40 feet away from the dragon.",attack_bonus:0,damage_dice:"10d10"}]},{name:"Young Copper Dragon",size:"Large",type:"dragon",subtype:"",alignment:"chaotic good",ac:17,hp:119,hit_dice:"14d10 + 42",speed:"40 ft., climb 40 ft., fly 80 ft.",stats:[19,12,17,16,13,15],saves:[{dexterity:4},{constitution:6},{wisdom:4},{charisma:5}],skillsaves:[{deception:5},{perception:7},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"acid",condition_immunities:"",senses:"blindsight 30 ft., darkvision 120 ft., passive Perception 17",languages:"Common, Draconic",cr:"7",actions:[{name:"Multiattack",desc:"The dragon makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +7 to hit, reach 10 ft., one target. Hit: 15 (2d10 + 4) piercing damage.",attack_bonus:7,damage_dice:"2d10",damage_bonus:4},{name:"Claw",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) slashing damage.",attack_bonus:7,damage_dice:"2d6",damage_bonus:4},{name:"Breath Weapons (Recharge 5-6)",desc:"The dragon uses one of the following breath weapons.\\nAcid Breath. The dragon exhales acid in an 40-foot line that is 5 feet wide. Each creature in that line must make a DC 14 Dexterity saving throw, taking 40 (9d8) acid damage on a failed save, or half as much damage on a successful one.\\nSlowing Breath. The dragon exhales gas in a 30-foot cone. Each creature in that area must succeed on a DC 14 Constitution saving throw. On a failed save, the creature can't use reactions, its speed is halved, and it can't make more than one attack on its turn. In addition, the creature can use either an action or a bonus action on its turn, but not both. These effects last for 1 minute. The creature can repeat the saving throw at the end of each of its turns, ending the effect on itself with a successful save.",attack_bonus:0,damage_dice:"9d8"}]},{name:"Young Gold Dragon",size:"Large",type:"dragon",subtype:"",alignment:"lawful good",ac:18,hp:178,hit_dice:"17d10 + 84",speed:"40 ft., fly 80 ft., swim 40 ft.",stats:[23,14,21,16,13,20],saves:[{dexterity:6},{constitution:9},{wisdom:5},{charisma:9}],skillsaves:[{insight:5},{perception:9},{persuasion:9},{stealth:6}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire",condition_immunities:"",senses:"blindsight 30 ft., darkvision 120 ft., passive Perception 19",languages:"Common, Draconic",cr:"10",traits:[{name:"Amphibious",desc:"The dragon can breathe air and water.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +10 to hit, reach 10 ft., one target. Hit: 17 (2d10 + 6) piercing damage.",attack_bonus:10,damage_dice:"2d10",damage_bonus:6},{name:"Claw",desc:"Melee Weapon Attack: +10 to hit, reach 5 ft., one target. Hit: 13 (2d6 + 6) slashing damage.",attack_bonus:10,damage_dice:"2d6",damage_bonus:6},{name:"Breath Weapons (Recharge 5-6)",desc:"The dragon uses one of the following breath weapons.\\nFire Breath. The dragon exhales fire in a 30-foot cone. Each creature in that area must make a DC 17 Dexterity saving throw, taking 55 (10d10) fire damage on a failed save, or half as much damage on a successful one.\\nWeakening Breath. The dragon exhales gas in a 30-foot cone. Each creature in that area must succeed on a DC 17 Strength saving throw or have disadvantage on Strength-based attack rolls, Strength checks, and Strength saving throws for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",attack_bonus:0,damage_dice:"10d10"}]},{name:"Young Green Dragon",size:"Large",type:"dragon",subtype:"",alignment:"lawful evil",ac:18,hp:136,hit_dice:"16d10 + 48",speed:"40 ft., fly 80 ft., swim 40 ft.",stats:[19,12,17,16,13,15],saves:[{dexterity:4},{constitution:6},{wisdom:4},{charisma:5}],skillsaves:[{deception:5},{perception:7},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"poison",condition_immunities:"poisoned",senses:"blindsight 30 ft., darkvision 120 ft., passive Perception 17",languages:"Common, Draconic",cr:"8",traits:[{name:"Amphibious",desc:"The dragon can breathe air and water.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +7 to hit, reach 10 ft., one target. Hit: 15 (2d10 + 4) piercing damage plus 7 (2d6) poison damage.",attack_bonus:7,damage_dice:"2d10 + 2d6",damage_bonus:4},{name:"Claw",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) slashing damage.",attack_bonus:7,damage_dice:"2d6",damage_bonus:4},{name:"Poison Breath (Recharge 5-6)",desc:"The dragon exhales poisonous gas in a 30-foot cone. Each creature in that area must make a DC 14 Constitution saving throw, taking 42 (12d6) poison damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"12d6"}]},{name:"Young Red Dragon",size:"Large",type:"dragon",subtype:"",alignment:"chaotic evil",ac:18,hp:178,hit_dice:"17d10 + 84",speed:"40 ft., climb 40 ft., fly 80 ft.",stats:[23,10,21,14,11,19],saves:[{dexterity:4},{constitution:9},{wisdom:4},{charisma:8}],skillsaves:[{perception:8},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"fire",condition_immunities:"",senses:"blindsight 30 ft., darkvision 120 ft., passive Perception 18",languages:"Common, Draconic",cr:"10",actions:[{name:"Multiattack",desc:"The dragon makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +10 to hit, reach 10 ft., one target. Hit: 17 (2d10 + 6) piercing damage plus 3 (1d6) fire damage.",attack_bonus:10,damage_dice:"2d10 + 1d6",damage_bonus:6},{name:"Claw",desc:"Melee Weapon Attack: +10 to hit, reach 5 ft., one target. Hit: 13 (2d6 + 6) slashing damage.",attack_bonus:10,damage_dice:"2d6",damage_bonus:6},{name:"Fire Breath (Recharge 5-6)",desc:"The dragon exhales fire in a 30-foot cone. Each creature in that area must make a DC 17 Dexterity saving throw, taking 56 (16d6) fire damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"16d6"}]},{name:"Young Silver Dragon",size:"Large",type:"dragon",subtype:"",alignment:"lawful good",ac:18,hp:168,hit_dice:"16d10 + 80",speed:"40 ft., fly 80 ft.",stats:[23,10,21,14,11,19],saves:[{dexterity:4},{constitution:9},{wisdom:4},{charisma:8}],skillsaves:[{arcana:6},{history:6},{perception:8},{stealth:4}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"cold",condition_immunities:"",senses:"blindsight 30 ft., darkvision 120 ft., passive Perception 18",languages:"Common, Draconic",cr:"9",actions:[{name:"Multiattack",desc:"The dragon makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +10 to hit, reach 10 ft., one target. Hit: 17 (2d10 + 6) piercing damage.",attack_bonus:10,damage_dice:"2d10",damage_bonus:6},{name:"Claw",desc:"Melee Weapon Attack: +10 to hit, reach 5 ft., one target. Hit: 13 (2d6 + 6) slashing damage.",attack_bonus:10,damage_dice:"2d6",damage_bonus:6},{name:"Breath Weapons (Recharge 5-6)",desc:"The dragon uses one of the following breath weapons.\\nCold Breath. The dragon exhales an icy blast in a 30-foot cone. Each creature in that area must make a DC 17 Constitution saving throw, taking 54 (12d8) cold damage on a failed save, or half as much damage on a successful one.\\nParalyzing Breath. The dragon exhales paralyzing gas in a 30-foot cone. Each creature in that area must succeed on a DC 17 Constitution saving throw or be paralyzed for 1 minute. A creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.",attack_bonus:0,damage_dice:"12d8"}]},{name:"Young White Dragon",size:"Large",type:"dragon",subtype:"",alignment:"chaotic evil",ac:17,hp:133,hit_dice:"14d10 + 56",speed:"40 ft., burrow 20 ft., fly 80 ft., swim 40 ft.",stats:[18,10,18,6,11,12],saves:[{dexterity:3},{constitution:7},{wisdom:3},{charisma:4}],skillsaves:[{perception:6},{stealth:3}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"cold",condition_immunities:"",senses:"blindsight 30 ft., darkvision 120 ft., passive Perception 16",languages:"Common, Draconic",cr:"6",traits:[{name:"Ice Walk",desc:"The dragon can move across and climb icy surfaces without needing to make an ability check. Additionally, difficult terrain composed of ice or snow doesn't cost it extra moment.",attack_bonus:0}],actions:[{name:"Multiattack",desc:"The dragon makes three attacks: one with its bite and two with its claws.",attack_bonus:0},{name:"Bite",desc:"Melee Weapon Attack: +7 to hit, reach 10 ft., one target. Hit: 15 (2d10 + 4) piercing damage plus 4 (1d8) cold damage.",attack_bonus:7,damage_dice:"2d10 + 1d8",damage_bonus:4},{name:"Claw",desc:"Melee Weapon Attack: +7 to hit, reach 5 ft., one target. Hit: 11 (2d6 + 4) slashing damage.",attack_bonus:7,damage_dice:"2d6",damage_bonus:4},{name:"Cold Breath (Recharge 5-6)",desc:"The dragon exhales an icy blast in a 30-foot cone. Each creature in that area must make a DC 15 Constitution saving throw, taking 45 (10d8) cold damage on a failed save, or half as much damage on a successful one.",attack_bonus:0,damage_dice:"10d8"}]},{name:"Zombie",size:"Medium",type:"undead",subtype:"",alignment:"neutral evil",ac:8,hp:22,hit_dice:"3d8 + 8",speed:"20 ft.",stats:[13,6,16,3,6,5],saves:[{wisdom:0}],damage_vulnerabilities:"",damage_resistances:"",damage_immunities:"",condition_immunities:"poisoned",senses:"darkvision 60 ft., passive Perception 8",languages:"understands all languages it spoke in life but can't speak",cr:"1/4",traits:[{name:"Undead Fortitude",desc:"If damage reduces the zombie to 0 hit points, it must make a Constitution saving throw with a DC of 5+the damage taken, unless the damage is radiant or from a critical hit. On a success, the zombie drops to 1 hit point instead.",attack_bonus:0}],actions:[{name:"Slam",desc:"Melee Weapon Attack: +3 to hit, reach 5 ft., one target. Hit: 4 (1d6 + 1) bludgeoning damage.",attack_bonus:3,damage_dice:"1d6",damage_bonus:1}]}];function wa(a){return a?new Map:$c}var $c=new Map(zc.map(a=>[a.name,a]));var Ht=require("obsidian");function pt(a){return a?a.toLowerCase().replace(/[^A-Za-z0-9\s]/g,"").replace(/\s+/g,"-"):""}function Va(a){return a[0].toUpperCase()+a.slice(1).toLowerCase()}function z(){return"xyxyxyxyxyxy".replace(/[xy]/g,function(a){var e=Math.random()*16|0,t=a=="x"?e:e&3|8;return t.toString(16)})}function Z(a,e=0,t=" ",n=!0){let i=[];if(e==5||a==null)return"";if(typeof a=="string")return a;if(typeof a=="number")return`${a}`;if(Array.isArray(a))i.push(`${n?"(":""}${a.map(s=>Z(s,e++)).join(t)}${n?")":""}`);else if(typeof a=="object")for(let s of Object.values(a))i.push(Z(s,e++));return i.join(" ")}var Ta=(a,e=0)=>{let t=[];if(e==5||!a||a==null)return"";if(typeof a=="string")return a;if(typeof a=="number")return`${a}`;if(Array.isArray(a))t.push(`${a.map(n=>Ta(n,e++)).join(" ")}`);else if(typeof a=="object")for(let[n,i]of Object.entries(a))t.push(Ta(n,e++),Ta(i,e++));return t.join(" ")};function Bs(a=[],e=[]){a||(a=[]),Array.isArray(a)||(a=[a]),e||(e=[]),Array.isArray(e)||(e=[e]);for(let t of e??[])if(!!t)if(Array.isArray(t)){let n=Ta(t.slice(1));a=a.filter(i=>i.name!=t[0]&&i.desc!=n),a.push({name:t[0],desc:n})}else typeof t=="object"&&("name"in t||"desc"in t)&&(a=a.filter(n=>n.name!=t.name||n.desc!=t.desc),a.push({name:t.name,desc:Ta(t.desc)}));return a}var jc=[{type:"inline",id:z(),properties:[],hasRule:!0,nested:[{type:"group",id:z(),properties:["name","size","type","subtype","alignment"],nested:[{type:"heading",id:z(),properties:["name"],conditioned:!0,size:1},{type:"subheading",id:z(),properties:["size","type","subtype","alignment"],conditioned:!0}],conditioned:!0},{type:"image",id:z(),properties:["image"]}]},{type:"group",id:z(),properties:["ac","hp","speed"],nested:[{type:"property",id:z(),properties:["ac"],display:"Armor Class",conditioned:!0},{type:"property",id:z(),properties:["hp"],display:"Hit Points",dice:!0,diceProperty:"hit_dice",diceCallback:'return [{ text: monster["hit_dice"] }]',conditioned:!0},{type:"property",id:z(),display:"Speed",properties:["speed"],conditioned:!0}],hasRule:!0,conditioned:!0},{type:"table",id:z(),properties:["stats"],headers:["Str","Dex","Con","Int","Wis","Cha"],calculate:!0,hasRule:!0,conditioned:!0},{type:"table",id:z(),properties:["fage_stats"],headers:["Accuracy","Communication","Constitution","Dexterity","Fighting","Intelligence","Perception","Strength","Willpower"],calculate:!1,hasRule:!0,conditioned:!0},{type:"group",id:z(),properties:["saves","skillsaves","damage_immunities","damage_resistances","damage_vulnerabilities","condition_immunities","cr","languages","senses"],nested:[{type:"saves",id:z(),display:"Saves",properties:["saves"],conditioned:!0},{type:"saves",id:z(),display:"Skills",properties:["skillsaves"],conditioned:!0},{type:"property",id:z(),display:"Damage Resistances",properties:["damage_resistances"],conditioned:!0},{type:"property",id:z(),display:"Damage Immunities",properties:["damage_immunities"],conditioned:!0},{type:"property",id:z(),display:"Condition Immunities",properties:["condition_immunities"],conditioned:!0},{type:"property",id:z(),display:"Damage Vulnerabilities",properties:["damage_vulnerabilities"],conditioned:!0},{type:"property",id:z(),display:"Senses",properties:["senses"],conditioned:!0},{type:"property",id:z(),display:"Languages",properties:["languages"],fallback:"-"},{type:"inline",id:z(),properties:[],conditioned:!0,nested:[{type:"property",id:z(),display:"Challenge",properties:["cr"],callback:`const CR = { + "0": { + cr: "0", + value: 0, + xp: 0 + }, + "1/8": { + cr: "1/8", + value: 0.125, + xp: 25 + }, + "1/4": { + cr: "1/4", + + value: 0.25, + xp: 50 + }, + "1/2": { + cr: "1/2", + value: 0.5, + xp: 100 + }, + "0.125": { + cr: "1/8", + value: 0.125, + xp: 25 + }, + "0.25": { + cr: "1/4", + + value: 0.25, + xp: 50 + }, + "0.5": { + cr: "1/2", + value: 0.5, + xp: 100 + }, + "1": { + cr: "1", + value: 1, + xp: 200 + }, + "2": { + cr: "2", + value: 2, + xp: 450 + }, + "3": { + cr: "3", + value: 3, + xp: 700 + }, + "4": { + cr: "4", + value: 4, + xp: 1100 + }, + "5": { + cr: "5", + value: 5, + xp: 1800 + }, + "6": { + cr: "6", + value: 6, + xp: 2300 + }, + "7": { + cr: "7", + value: 7, + xp: 2900 + }, + "8": { + cr: "8", + value: 8, + xp: 3900 + }, + "9": { + cr: "9", + value: 9, + xp: 5000 + }, + "10": { + cr: "10", + value: 10, + xp: 5900 + }, + "11": { + cr: "11", + value: 11, + xp: 7200 + }, + "12": { + cr: "12", + value: 12, + xp: 8400 + }, + "13": { + cr: "13", + value: 13, + xp: 10000 + }, + "14": { + cr: "14", + value: 14, + xp: 11500 + }, + "15": { + cr: "15", + value: 15, + xp: 13000 + }, + "16": { + cr: "16", + value: 16, + xp: 15000 + }, + "17": { + cr: "17", + value: 17, + xp: 18000 + }, + "18": { + cr: "18", + value: 18, + xp: 20000 + }, + "19": { + cr: "19", + value: 19, + xp: 22000 + }, + "20": { + cr: "20", + value: 20, + xp: 25000 + }, + "21": { + cr: "21", + value: 21, + xp: 33000 + }, + "22": { + cr: "22", + value: 22, + xp: 41000 + }, + "23": { + cr: "23", + value: 23, + xp: 50000 + }, + "24": { + cr: "24", + value: 24, + xp: 62000 + }, + "25": { + cr: "25", + value: 25, + xp: 75000 + }, + "26": { + cr: "26", + value: 26, + xp: 90000 + }, + "27": { + cr: "27", + value: 27, + xp: 105000 + }, + "28": { + cr: "28", + value: 28, + xp: 120000 + }, + "29": { + cr: "29", + value: 29, + xp: 135000 + }, + "30": { + cr: "30", + value: 30, + xp: 155000 + } +}; +if ("cr" in monster && monster.cr in CR) { + return \`\${CR[ + monster.cr + ].cr} (\${CR[ + monster.cr + ].xp.toLocaleString()} XP)\`; +} +return "";`},{type:"property",id:z(),display:"Proficiency Bonus",properties:["cr"],callback:`const CR = { + "0": { + cr: "0", + value: 0, + xp: 0 + }, + "1/8": { + cr: "1/8", + value: 0.125, + xp: 25 + }, + "1/4": { + cr: "1/4", + + value: 0.25, + xp: 50 + }, + "1/2": { + cr: "1/2", + value: 0.5, + xp: 100 + }, + "0.125": { + cr: "1/8", + value: 0.125, + xp: 25 + }, + "0.25": { + cr: "1/4", + + value: 0.25, + xp: 50 + }, + "0.5": { + cr: "1/2", + value: 0.5, + xp: 100 + }, + "1": { + cr: "1", + value: 1, + xp: 200 + }, + "2": { + cr: "2", + value: 2, + xp: 450 + }, + "3": { + cr: "3", + value: 3, + xp: 700 + }, + "4": { + cr: "4", + value: 4, + xp: 1100 + }, + "5": { + cr: "5", + value: 5, + xp: 1800 + }, + "6": { + cr: "6", + value: 6, + xp: 2300 + }, + "7": { + cr: "7", + value: 7, + xp: 2900 + }, + "8": { + cr: "8", + value: 8, + xp: 3900 + }, + "9": { + cr: "9", + value: 9, + xp: 5000 + }, + "10": { + cr: "10", + value: 10, + xp: 5900 + }, + "11": { + cr: "11", + value: 11, + xp: 7200 + }, + "12": { + cr: "12", + value: 12, + xp: 8400 + }, + "13": { + cr: "13", + value: 13, + xp: 10000 + }, + "14": { + cr: "14", + value: 14, + xp: 11500 + }, + "15": { + cr: "15", + value: 15, + xp: 13000 + }, + "16": { + cr: "16", + value: 16, + xp: 15000 + }, + "17": { + cr: "17", + value: 17, + xp: 18000 + }, + "18": { + cr: "18", + value: 18, + xp: 20000 + }, + "19": { + cr: "19", + value: 19, + xp: 22000 + }, + "20": { + cr: "20", + value: 20, + xp: 25000 + }, + "21": { + cr: "21", + value: 21, + xp: 33000 + }, + "22": { + cr: "22", + value: 22, + xp: 41000 + }, + "23": { + cr: "23", + value: 23, + xp: 50000 + }, + "24": { + cr: "24", + value: 24, + xp: 62000 + }, + "25": { + cr: "25", + value: 25, + xp: 75000 + }, + "26": { + cr: "26", + value: 26, + xp: 90000 + }, + "27": { + cr: "27", + value: 27, + xp: 105000 + }, + "28": { + cr: "28", + value: 28, + xp: 120000 + }, + "29": { + cr: "29", + value: 29, + xp: 135000 + }, + "30": { + cr: "30", + value: 30, + xp: 155000 + } +}; +if ("cr" in monster && monster.cr in CR) { + return \`+\${Math.max( + Math.floor(2 + ((CR[monster.cr]?.value ?? 0) - 1) / 4), + 2 + )}\`; +} +return "";`}]}],conditioned:!0,hasRule:!0},{type:"traits",id:z(),properties:["traits"],conditioned:!0,dice:!0},{type:"spells",id:z(),properties:["spells"],conditioned:!0,dice:!0},{type:"text",id:z(),properties:["spellsNotes"],conditioned:!0,text:null},{type:"traits",id:z(),properties:["actions"],heading:"Actions",conditioned:!0,dice:!0},{type:"traits",id:z(),properties:["bonus_actions"],heading:"Bonus Actions",conditioned:!0,dice:!0},{type:"traits",id:z(),properties:["legendary_actions"],heading:"Legendary Actions",conditioned:!0,dice:!0},{type:"traits",id:z(),properties:["reactions"],heading:"Reactions",conditioned:!0,dice:!0},{type:"traits",id:z(),properties:["lair_actions"],heading:"Lair Actions",conditioned:!0,dice:!0}],bt={blocks:jc,name:"Basic 5e Layout"};var Gr=require("obsidian");function H(){}var zs=a=>a;function qc(a){return!!a&&(typeof a=="object"||typeof a=="function")&&typeof a.then=="function"}function Xn(a){return a()}function Fs(){return Object.create(null)}function me(a){a.forEach(Xn)}function ze(a){return typeof a=="function"}function j(a,e){return a!=a?e==e:a!==e||a&&typeof a=="object"||typeof a=="function"}var Ka;function $s(a,e){return Ka||(Ka=document.createElement("a")),Ka.href=e,a===Ka.href}function js(a){return Object.keys(a).length===0}function qs(a){return a??""}function ae(a){return a&&ze(a.destroy)?a.destroy:H}var Gs=typeof window<"u",Gc=Gs?()=>window.performance.now():()=>Date.now(),Zn=Gs?a=>requestAnimationFrame(a):H;var ta=new Set;function Us(a){ta.forEach(e=>{e.c(a)||(ta.delete(e),e.f())}),ta.size!==0&&Zn(Us)}function Uc(a){let e;return ta.size===0&&Zn(Us),{promise:new Promise(t=>{ta.add(e={c:a,f:t})}),abort(){ta.delete(e)}}}var Vs=!1;function Vc(){Vs=!0}function Kc(){Vs=!1}function D(a,e){a.appendChild(e)}function K(a,e,t){let n=Qn(a);if(!n.getElementById(e)){let i=A("style");i.id=e,i.textContent=t,Ks(n,i)}}function Qn(a){if(!a)return document;let e=a.getRootNode?a.getRootNode():a.ownerDocument;return e&&e.host?e:a.ownerDocument}function Yc(a){let e=A("style");return Ks(Qn(a),e),e.sheet}function Ks(a,e){return D(a.head||a,e),e.sheet}function x(a,e,t){a.insertBefore(e,t||null)}function S(a){a.parentNode&&a.parentNode.removeChild(a)}function Ve(a,e){for(let t=0;ta.removeEventListener(e,t,n)}function _(a,e,t){t==null?a.removeAttribute(e):a.getAttribute(e)!==t&&a.setAttribute(e,t)}function Jc(a){return Array.from(a.childNodes)}function ve(a,e){e=""+e,a.wholeText!==e&&(a.data=e)}function ei(a,e){a.value=e??""}function ti(a,e,t,n){t===null?a.style.removeProperty(e):a.style.setProperty(e,t,n?"important":"")}function Re(a,e,t){a.classList[t?"add":"remove"](e)}function Xc(a,e,{bubbles:t=!1,cancelable:n=!1}={}){let i=document.createEvent("CustomEvent");return i.initCustomEvent(a,t,n,e),i}var Xa=new Map,Za=0;function Zc(a){let e=5381,t=a.length;for(;t--;)e=(e<<5)-e^a.charCodeAt(t);return e>>>0}function Qc(a,e){let t={stylesheet:Yc(e),rules:{}};return Xa.set(a,t),t}function el(a,e,t,n,i,s,r,c=0){let o=16.666/n,l=`{ +`;for(let k=0;k<=1;k+=o){let C=e+(t-e)*s(k);l+=k*100+`%{${r(C,1-C)}} +`}let d=l+`100% {${r(t,1-t)}} +}`,u=`__svelte_${Zc(d)}_${c}`,m=Qn(a),{stylesheet:h,rules:b}=Xa.get(m)||Qc(m,a);b[u]||(b[u]=!0,h.insertRule(`@keyframes ${u} ${d}`,h.cssRules.length));let f=a.style.animation||"";return a.style.animation=`${f?`${f}, `:""}${u} ${n}ms linear ${i}ms 1 both`,Za+=1,u}function tl(a,e){let t=(a.style.animation||"").split(", "),n=t.filter(e?s=>s.indexOf(e)<0:s=>s.indexOf("__svelte")===-1),i=t.length-n.length;i&&(a.style.animation=n.join(", "),Za-=i,Za||al())}function al(){Zn(()=>{Za||(Xa.forEach(a=>{let{ownerNode:e}=a.stylesheet;e&&S(e)}),Xa.clear())})}function Qa(a,e,t,n){if(!e)return H;let i=a.getBoundingClientRect();if(e.left===i.left&&e.right===i.right&&e.top===i.top&&e.bottom===i.bottom)return H;let{delay:s=0,duration:r=300,easing:c=zs,start:o=Gc()+s,end:l=o+r,tick:d=H,css:u}=t(a,{from:e,to:i},n),m=!0,h=!1,b;function f(){u&&(b=el(a,0,1,r,s,c,u)),s||(h=!0)}function k(){u&&tl(a,b),m=!1}return Uc(C=>{if(!h&&C>=o&&(h=!0),h&&C>=l&&(d(1,0),k()),!m)return!1;if(h){let w=C-o,W=0+1*c(w/r);d(W,1-W)}return!0}),f(),d(0,1),k}function en(a){let e=getComputedStyle(a);if(e.position!=="absolute"&&e.position!=="fixed"){let{width:t,height:n}=e,i=a.getBoundingClientRect();a.style.position="absolute",a.style.width=t,a.style.height=n,nl(a,i)}}function nl(a,e){let t=a.getBoundingClientRect();if(e.left!==t.left||e.top!==t.top){let n=getComputedStyle(a),i=n.transform==="none"?"":n.transform;a.style.transform=`${i} translate(${e.left-t.left}px, ${e.top-t.top}px)`}}var Aa;function kt(a){Aa=a}function Nt(){if(!Aa)throw new Error("Function called outside component initialization");return Aa}function Ca(a){Nt().$$.on_mount.push(a)}function ai(a){Nt().$$.on_destroy.push(a)}function We(){let a=Nt();return(e,t,{cancelable:n=!1}={})=>{let i=a.$$.callbacks[e];if(i){let s=Xc(e,t,{cancelable:n});return i.slice().forEach(r=>{r.call(a,s)}),!s.defaultPrevented}return!0}}function gt(a,e){return Nt().$$.context.set(a,e),e}function ge(a){return Nt().$$.context.get(a)}function ni(){return Nt().$$.context}function ii(a,e){let t=a.$$.callbacks[e.type];t&&t.slice().forEach(n=>n.call(this,e))}var ea=[];var rt=[],Ya=[],Kn=[],il=Promise.resolve(),Yn=!1;function sl(){Yn||(Yn=!0,il.then(ri))}function Jn(a){Ya.push(a)}function si(a){Kn.push(a)}var Vn=new Set,Qt=0;function ri(){if(Qt!==0)return;let a=Aa;do{try{for(;Qt{Ja.delete(a),n&&(t&&a.d(1),n())}),a.o(e)}else n&&n()}function Ys(a,e){let t=e.token={};function n(i,s,r,c){if(e.token!==t)return;e.resolved=c;let o=e.ctx;r!==void 0&&(o=o.slice(),o[r]=c);let l=i&&(e.current=i)(o),d=!1;e.block&&(e.blocks?e.blocks.forEach((u,m)=>{m!==s&&u&&(ie(),O(u,1,1,()=>{e.blocks[m]===u&&(e.blocks[m]=null)}),se())}):e.block.d(1),l.c(),I(l,1),l.m(e.mount(),e.anchor),d=!0),e.block=l,e.blocks&&(e.blocks[s]=l),d&&ri()}if(qc(a)){let i=Nt();if(a.then(s=>{kt(i),n(e.then,1,e.value,s),kt(null)},s=>{if(kt(i),n(e.catch,2,e.error,s),kt(null),!e.hasCatch)throw s}),e.current!==e.pending)return n(e.pending,0),!0}else{if(e.current!==e.then)return n(e.then,1,e.value,a),!0;e.resolved=a}}function Js(a,e,t){let n=e.slice(),{resolved:i}=a;a.current===a.then&&(n[a.value]=i),a.current===a.catch&&(n[a.error]=i),a.block.p(n,t)}var fm=typeof window<"u"?window:typeof globalThis<"u"?globalThis:global;function oi(a,e){a.d(1),e.delete(a.key)}function ol(a,e){O(a,1,1,()=>{e.delete(a.key)})}function Xs(a,e){a.f(),oi(a,e)}function Zs(a,e){a.f(),ol(a,e)}function aa(a,e,t,n,i,s,r,c,o,l,d,u){let m=a.length,h=s.length,b=m,f={};for(;b--;)f[a[b].key]=b;let k=[],C=new Map,w=new Map;for(b=h;b--;){let g=u(i,s,b),p=t(g),v=r.get(p);v?n&&v.p(g,e):(v=l(p,g),v.c()),C.set(p,k[b]=v),p in f&&w.set(p,Math.abs(b-f[p]))}let W=new Set,E=new Set;function y(g){I(g,1),g.m(c,d),r.set(g.key,g),d=g.first,h--}for(;m&&h;){let g=k[h-1],p=a[m-1],v=g.key,M=p.key;g===p?(d=g.first,m--,h--):C.has(M)?!r.has(v)||W.has(v)?y(g):E.has(M)?m--:w.get(v)>w.get(M)?(E.add(v),y(g)):(W.add(M),m--):(o(p,r),m--)}for(;m--;){let g=a[m];C.has(g.key)||o(g,r)}for(;h;)y(k[h-1]);return k}function ci(a,e,t){let n=a.$$.props[e];n!==void 0&&(a.$$.bound[n]=t,t(a.$$.ctx[n]))}function X(a){a&&a.c()}function J(a,e,t,n){let{fragment:i,after_update:s}=a.$$;i&&i.m(e,t),n||Jn(()=>{let r=a.$$.on_mount.map(Xn).filter(ze);a.$$.on_destroy?a.$$.on_destroy.push(...r):me(r),a.$$.on_mount=[]}),s.forEach(Jn)}function Y(a,e){let t=a.$$;t.fragment!==null&&(me(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function cl(a,e){a.$$.dirty[0]===-1&&(ea.push(a),sl(),a.$$.dirty.fill(0)),a.$$.dirty[e/31|0]|=1<{let b=h.length?h[0]:m;return l.ctx&&i(l.ctx[u],l.ctx[u]=b)&&(!l.skip_bound&&l.bound[u]&&l.bound[u](b),d&&cl(a,u)),m}):[],l.update(),d=!0,me(l.before_update),l.fragment=n?n(l.ctx):!1,e.target){if(e.hydrate){Vc();let u=Jc(e.target);l.fragment&&l.fragment.l(u),u.forEach(S)}else l.fragment&&l.fragment.c();e.intro&&I(a.$$.fragment),J(a,e.target,e.anchor,e.customElement),Kc(),ri()}kt(o)}var ll;typeof HTMLElement=="function"&&(ll=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){let{on_mount:a}=this.$$;this.$$.on_disconnect=a.map(Xn).filter(ze);for(let e in this.$$.slotted)this.appendChild(this.$$.slotted[e])}attributeChangedCallback(a,e,t){this[a]=t}disconnectedCallback(){me(this.$$.on_disconnect)}$destroy(){Y(this,1),this.$destroy=H}$on(a,e){if(!ze(e))return H;let t=this.$$.callbacks[a]||(this.$$.callbacks[a]=[]);return t.push(e),()=>{let n=t.indexOf(e);n!==-1&&t.splice(n,1)}}$set(a){this.$$set&&!js(a)&&(this.$$.skip_bound=!0,this.$$set(a),this.$$.skip_bound=!1)}});var q=class{$destroy(){Y(this,1),this.$destroy=H}$on(e,t){if(!ze(t))return H;let n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{let i=n.indexOf(t);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!js(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}};var ot=require("obsidian"),rf=require("querystring");var Qs='',tn="statblock-save",er='',an="statblock-export-as-png";var na=[];function tr(a,e=H){let t,n=new Set;function i(c){if(j(a,c)&&(a=c,t)){let o=!na.length;for(let l of n)l[1](),na.push(l,a);if(o){for(let l=0;l{n.delete(l),n.size===0&&(t(),t=null)}}return{set:i,update:s,subscribe:r}}function dl(a){K(a,"svelte-ilp5y8",`.bar.svelte-ilp5y8{height:5px;background:var(--statblock-bar-color);border:var(--statblock-bar-border-size) solid + var(--statblock-bar-border-color);z-index:1;width:auto}`)}function ul(a){let e;return{c(){e=A("div"),_(e,"class","bar svelte-ilp5y8")},m(t,n){x(t,e,n)},p:H,i:H,o:H,d(t){t&&S(e)}}}var li=class extends q{constructor(e){super(),U(this,e,null,ul,j,{},dl)}},di=li;function hl(a){K(a,"svelte-1lnliuc",".inline.svelte-1lnliuc{display:inline}")}function ar(a,e,t){let n=a.slice();return n[5]=e[t],n}function ml(a){let e,t=a[2](a[0]),n=[];for(let i=0;i{let l="",d=o.indexOf("|");return d>0?(l=o.slice(d+1),o=o.slice(0,d)):l=o.split("#").filter(function(u){return!!u}).join(" > "),o.endsWith("\\")&&(o=o.slice(0,o.length-1)),{href:o=o.replace(/\u00A0/g," "),title:l,isAlias:d>0}},c=o=>o.split(/([\s\S]+?<\/STATBLOCK-LINK>)/).filter(l=>l&&l.length).map(l=>{if(/([\s\S]+?)<\/STATBLOCK-LINK>/.test(l)){let d=l.match(/([\s\S]+?)<\/STATBLOCK-LINK>/)[1],{href:u,title:m,isAlias:h}=r(d);return{isLink:!0,text:d,href:u,isAlias:h,title:m}}return{isLink:!1,text:l}});return a.$$set=o=>{"textToRender"in o&&t(0,n=o.textToRender)},[n,i,c]}var ui=class extends q{constructor(e){super(),U(this,e,yl,vl,j,{textToRender:0},hl)}},Be=ui;var lr=require("obsidian");function _l(a){K(a,"svelte-l05x30",".roller-result.svelte-l05x30{font-weight:var(--statblock-font-weight)}")}function wl(a){let e,t,n,i,s,r,c=(typeof a[1]=="number"||a[1]&&a[1].length)&&ir(a);return{c(){e=A("span"),n=R(),c&&c.c(),i=re(),_(e,"class","roller-result svelte-l05x30")},m(o,l){x(o,e,l),x(o,n,l),c&&c.m(o,l),x(o,i,l),s||(r=ae(t=a[4].call(null,e)),s=!0)},p(o,l){typeof o[1]=="number"||o[1]&&o[1].length?c?c.p(o,l):(c=ir(o),c.c(),c.m(i.parentNode,i)):c&&(c.d(1),c=null)},d(o){o&&S(e),o&&S(n),c&&c.d(o),o&&S(i),s=!1,r()}}}function Tl(a){let e;return{c(){e=de(a[0])},m(t,n){x(t,e,n)},p(t,n){n&1&&ve(e,t[0])},d(t){t&&S(e)}}}function ir(a){let e,t,n,i;return{c(){e=A("span"),t=de("("),n=de(a[1]),i=de(")"),_(e,"class","dice-original")},m(s,r){x(s,e,r),D(e,t),D(e,n),D(e,i)},p(s,r){r&2&&ve(n,s[1])},d(s){s&&S(e)}}}function sr(a){let e;function t(s,r){return s[2]||!s[3]?Tl:wl}let n=t(a,-1),i=n(a);return{c(){i.c(),e=re()},m(s,r){i.m(s,r),x(s,e,r)},p(s,r){n===(n=t(s,r))&&i?i.p(s,r):(i.d(1),i=n(s),i&&(i.c(),i.m(e.parentNode,e)))},d(s){i.d(s),s&&S(e)}}}function Al(a){let e=a[2],t,n=sr(a);return{c(){n.c(),t=re()},m(i,s){n.m(i,s),x(i,t,s)},p(i,[s]){s&4&&j(e,e=i[2])?(n.d(1),n=sr(i),n.c(),n.m(t.parentNode,t)):n.p(i,s)},i:H,o:H,d(i){i&&S(t),n.d(i)}}}function Cl(a,e,t){let{text:n}=e,{original:i=n}=e,s=ge("dice"),r=ge("plugin"),c=ge("render");ge("reset").subscribe(async h=>{h&&await l.applyResult({type:"dice",result:u,tooltip:"Average"})});let l=null,d=!1;if(!l&&s)try{l=r.getRoller(`${n}`)}catch(h){console.error(h),d=!0}let u=0;Ca(async()=>{if(l)try{await l.roll(),u=l.dice.reduce((h,b)=>h+(b.static?b.result:Math.floor((b.faces.min+b.faces.max)/2*b.rolls)),0),await l.applyResult({type:"dice",result:u,tooltip:"Average"}),l.shouldRender=c}catch{t(2,d=!0)}});let m=h=>{!l||!l.containerEl?h.setText(`${i}`):h.appendChild(l.containerEl)};return a.$$set=h=>{"text"in h&&t(0,n=h.text),"original"in h&&t(1,i=h.original)},[n,i,d,s,m]}var hi=class extends q{constructor(e){super(),U(this,e,Cl,Al,j,{text:0,original:1},_l)}},rr=hi;function Sl(a){K(a,"svelte-12rzfyk",".property-text.svelte-12rzfyk{display:inline;white-space:pre-line;text-indent:0}.property-text.svelte-12rzfyk{display:inline;margin:0}")}function or(a,e,t){let n=a.slice();return n[6]=e[t],n}function xl(a){let e,t,n=a[1],i=[];for(let r=0;rO(i[r],1,1,()=>{i[r]=null});return{c(){for(let r=0;r{r[d]=null}),se(),t=r[e],t?t.p(o,l):(t=r[e]=s[e](o),t.c()),I(t,1),t.m(n.parentNode,n))},i(o){i||(I(t),i=!0)},o(o){O(t),i=!1},d(o){r[e].d(o),o&&S(n)}}}function Il(a){let e,t,n,i,s=[Dl,xl],r=[];function c(o,l){return o[2]?1:0}return e=c(a,-1),t=r[e]=s[e](a),{c(){t.c(),n=re()},m(o,l){r[e].m(o,l),x(o,n,l),i=!0},p(o,[l]){t.p(o,l)},i(o){i||(I(t),i=!0)},o(o){O(t),i=!1},d(o){r[e].d(o),o&&S(n)}}}function Pl(a,e,t){let{property:n}=e,i=ge("item"),s=ge("dice")&&i.dice,r=ge("monster"),c=ge("plugin"),o=[n];if(s)if(i.diceProperty&&i.diceProperty in r&&typeof r[i.diceProperty]=="string")o=[{text:r[i.diceProperty]}];else if(i.diceCallback)try{let l=document.body.createEl("iframe"),d=l.contentWindow.Function,m=new d("monster","property",i.diceCallback).call(void 0,r,n)??n;document.body.removeChild(l),Array.isArray(m)?o=m:o=[m]}catch(l){new lr.Notice(`There was an error executing the provided dice callback for [${i.properties.join(", ")}] + +${l.message}`),console.error(l)}else{let l=c.parseForDice(n);Array.isArray(l)?o=l:o=[l]}return a.$$set=l=>{"property"in l&&t(0,n=l.property)},[n,o,s]}var mi=class extends q{constructor(e){super(),U(this,e,Pl,Il,j,{property:0},Sl)}},dr=mi;var nn=require("obsidian");function Ol(a){K(a,"svelte-4lp5jt",".statblock-markdown.svelte-4lp5jt{display:inline}.statblock-markdown.svelte-4lp5jt p{display:inline}")}function Wl(a){let e,t,n,i;return{c(){e=A("div"),_(e,"class","statblock-markdown svelte-4lp5jt")},m(s,r){x(s,e,r),n||(i=ae(t=a[0].call(null,e)),n=!0)},p:H,i:H,o:H,d(s){s&&S(e),n=!1,i()}}}function Nl(a,e,t){let{property:n}=e;n=n.replace(//g,"[[").replace(/<\/STATBLOCK-LINK>/g,"]]");let i=ge("context"),s=ge("renderer"),r=ge("item"),c=ge("dice")&&r.dice,o=ge("monster"),l=ge("plugin"),d=[n];if(c)if(r.diceProperty&&r.diceProperty in o&&typeof o[r.diceProperty]=="string")d=[{text:o[r.diceProperty]}];else if(r.diceCallback)try{let h=document.body.createEl("iframe"),b=h.contentWindow.Function,k=new b("monster","property",r.diceCallback).call(void 0,o,n)??n;document.body.removeChild(h),Array.isArray(k)?d=k:d=[k]}catch(h){new nn.Notice(`There was an error executing the provided dice callback for [${r.properties.join(", ")}] + +${h.message}`),console.error(h)}else{let h=l.parseForDice(n);Array.isArray(h)?d=h:d=[h]}let u=0;for(let h of d)if(typeof h!="string"){let b=h.original??h.text,f;h.original?f=`${h.original} (\`dice: ${h.text}\`)`:f=`\`dice: ${h.text}\``;let k=n.slice(u).indexOf(b);n=n.slice(0,u)+n.slice(u).replace(b,f),u=n.slice(0,u).length+k+f.length+1}else u+=h.length;let m=h=>{nn.MarkdownRenderer.renderMarkdown(n,h,i,s)};return a.$$set=h=>{"property"in h&&t(1,n=h.property)},[m,n]}var gi=class extends q{constructor(e){super(),U(this,e,Nl,Wl,j,{property:1},Ol)}},ur=gi;function Hl(a){let e,t;return e=new dr({props:{property:a[0]}}),{c(){X(e.$$.fragment)},m(n,i){J(e,n,i),t=!0},p(n,i){let s={};i&1&&(s.property=n[0]),e.$set(s)},i(n){t||(I(e.$$.fragment,n),t=!0)},o(n){O(e.$$.fragment,n),t=!1},d(n){Y(e,n)}}}function Ll(a){let e,t;return e=new ur({props:{property:a[0]}}),{c(){X(e.$$.fragment)},m(n,i){J(e,n,i),t=!0},p(n,i){let s={};i&1&&(s.property=n[0]),e.$set(s)},i(n){t||(I(e.$$.fragment,n),t=!0)},o(n){O(e.$$.fragment,n),t=!1},d(n){Y(e,n)}}}function Rl(a){let e,t,n,i,s=[Ll,Hl],r=[];function c(o,l){return o[1]?0:1}return e=c(a,-1),t=r[e]=s[e](a),{c(){t.c(),n=re()},m(o,l){r[e].m(o,l),x(o,n,l),i=!0},p(o,[l]){let d=e;e=c(o,l),e===d?r[e].p(o,l):(ie(),O(r[d],1,1,()=>{r[d]=null}),se(),t=r[e],t?t.p(o,l):(t=r[e]=s[e](o),t.c()),I(t,1),t.m(n.parentNode,n))},i(o){i||(I(t),i=!0)},o(o){O(t),i=!1},d(o){r[e].d(o),o&&S(n)}}}function Bl(a,e,t){let{property:n}=e,{render:i=!1}=e;return a.$$set=s=>{"property"in s&&t(0,n=s.property),"render"in s&&t(1,i=s.render)},[n,i]}var fi=class extends q{constructor(e){super(),U(this,e,Bl,Rl,j,{property:0,render:1})}},Xe=fi;function Fl(a){K(a,"svelte-17sj2ks",".property-name.svelte-17sj2ks{margin:0;margin-right:0.25em;display:inline;font-weight:var(--statblock-traits-font-weight);font-style:var(--statblock-traits-font-style)}")}function hr(a){let e,t,n;return t=new Be({props:{textToRender:a[0]}}),{c(){e=A("div"),X(t.$$.fragment),_(e,"class","property-name svelte-17sj2ks")},m(i,s){x(i,e,s),J(t,e,null),n=!0},p(i,s){let r={};s&1&&(r.textToRender=i[0]),t.$set(r)},i(i){n||(I(t.$$.fragment,i),n=!0)},o(i){O(t.$$.fragment,i),n=!1},d(i){i&&S(e),Y(t)}}}function zl(a){let e,t,n,i,s,r=a[0]&&hr(a);return n=new Xe({props:{render:a[3],property:a[1]}}),{c(){e=A("div"),r&&r.c(),t=R(),X(n.$$.fragment),_(e,"class",i="property "+pt(a[0])+" "+pt(a[2])+" svelte-17sj2ks")},m(c,o){x(c,e,o),r&&r.m(e,null),D(e,t),J(n,e,null),s=!0},p(c,[o]){c[0]?r?(r.p(c,o),o&1&&I(r,1)):(r=hr(c),r.c(),I(r,1),r.m(e,t)):r&&(ie(),O(r,1,1,()=>{r=null}),se());let l={};o&8&&(l.render=c[3]),o&2&&(l.property=c[1]),n.$set(l),(!s||o&5&&i!==(i="property "+pt(c[0])+" "+pt(c[2])+" svelte-17sj2ks"))&&_(e,"class",i)},i(c){s||(I(r),I(n.$$.fragment,c),s=!0)},o(c){O(r),O(n.$$.fragment,c),s=!1},d(c){c&&S(e),r&&r.d(),Y(n)}}}function $l(a,e,t){let{name:n}=e,{desc:i}=e,{property:s=""}=e,{render:r=!1}=e;return a.$$set=c=>{"name"in c&&t(0,n=c.name),"desc"in c&&t(1,i=c.desc),"property"in c&&t(2,s=c.property),"render"in c&&t(3,r=c.render)},[n,i,s,r]}var pi=class extends q{constructor(e){super(),U(this,e,$l,zl,j,{name:0,desc:1,property:2,render:3},Fl)}},Sa=pi;var ig=require("obsidian");function jl(a){K(a,"svelte-1kk02hm",".spell-line.svelte-1kk02hm .spells.svelte-1kk02hm{font-style:var(--statblock-spells-font-style)}")}function mr(a,e,t){let n=a.slice();return n[5]=e[t],n[7]=t,n}function gr(a,e,t){let n=a.slice();return n[8]=e[t],n[10]=t,n}function ql(a){let e,t;return e=new Sa({props:{name:"",desc:a[5].header,property:a[1]}}),{c(){X(e.$$.fragment)},m(n,i){J(e,n,i),t=!0},p(n,i){let s={};i&2&&(s.property=n[1]),e.$set(s)},i(n){t||(I(e.$$.fragment,n),t=!0)},o(n){O(e.$$.fragment,n),t=!1},d(n){Y(e,n)}}}function Gl(a){let e,t;return e=new Sa({props:{name:"Spellcasting",desc:a[5].header,property:a[1]}}),{c(){X(e.$$.fragment)},m(n,i){J(e,n,i),t=!0},p(n,i){let s={};i&2&&(s.property=n[1]),e.$set(s)},i(n){t||(I(e.$$.fragment,n),t=!0)},o(n){O(e.$$.fragment,n),t=!1},d(n){Y(e,n)}}}function Ul(a){let e,t,n,i,s,r,c;return n=new Xe({props:{render:a[0],property:`${a[8].level}:`}}),r=new Xe({props:{render:a[0],property:a[8].spells}}),{c(){e=A("li"),t=A("span"),X(n.$$.fragment),i=R(),s=A("span"),X(r.$$.fragment),_(t,"class","spell-level"),_(s,"class","spells svelte-1kk02hm"),_(e,"class","spell-line svelte-1kk02hm")},m(o,l){x(o,e,l),D(e,t),J(n,t,null),D(e,i),D(e,s),J(r,s,null),c=!0},p(o,l){let d={};l&1&&(d.render=o[0]),n.$set(d);let u={};l&1&&(u.render=o[0]),r.$set(u)},i(o){c||(I(n.$$.fragment,o),I(r.$$.fragment,o),c=!0)},o(o){O(n.$$.fragment,o),O(r.$$.fragment,o),c=!1},d(o){o&&S(e),Y(n),Y(r)}}}function Vl(a){let e,t,n;return t=new Xe({props:{render:a[0],property:a[8].spells}}),{c(){e=A("span"),X(t.$$.fragment),_(e,"class","spell-line")},m(i,s){x(i,e,s),J(t,e,null),n=!0},p(i,s){let r={};s&1&&(r.render=i[0]),t.$set(r)},i(i){n||(I(t.$$.fragment,i),n=!0)},o(i){O(t.$$.fragment,i),n=!1},d(i){i&&S(e),Y(t)}}}function fr(a){let e,t,n,i,s=[Vl,Ul],r=[];function c(o,l){return o[8].level?1:0}return e=c(a,-1),t=r[e]=s[e](a),{c(){t.c(),n=re()},m(o,l){r[e].m(o,l),x(o,n,l),i=!0},p(o,l){t.p(o,l)},i(o){i||(I(t),i=!0)},o(o){O(t),i=!1},d(o){r[e].d(o),o&&S(n)}}}function pr(a){let e,t,n,i,s,r,c=[Gl,ql],o=[];function l(h,b){return h[7]===0?0:1}e=l(a,-1),t=o[e]=c[e](a);let d=a[5].spells,u=[];for(let h=0;hO(u[h],1,1,()=>{u[h]=null});return{c(){t.c(),n=R(),i=A("ul");for(let h=0;hO(i[r],1,1,()=>{i[r]=null});return{c(){e=A("div");for(let r=0;r/[^a-zA-Z0-9]$/.test(o)?o:`${o}:`,c=i.spells.reduce((o,l)=>{if(typeof l=="string"&&(l.charAt(l.length-1)==":"||!l.includes(":"))){let m={header:r(l),spells:[]};return o.push(m),o}let d=o[o.length-1],u;if(typeof l=="string")u={spells:l};else try{u={level:Object.keys(l).shift(),spells:Z(Object.values(l).shift())}}catch{return o}if(d)d.spells.push(u);else{let m={header:`${i.name} knows the following spells:`,spells:[u]};o.push(m)}return o},[]);return a.$$set=o=>{"render"in o&&t(0,n=o.render),"monster"in o&&t(3,i=o.monster),"property"in o&&t(1,s=o.property)},[n,s,c,i]}var bi=class extends q{constructor(e){super(),U(this,e,Yl,Kl,j,{render:0,monster:3,property:1},jl)}},br=bi;function Jl(a){K(a,"svelte-1hofvsi",".flex-container.svelte-1hofvsi{display:flex;justify-content:space-between;align-items:center}.heading.svelte-1hofvsi{font-family:var(--statblock-heading-font);color:var(--statblock-heading-font-color);font-weight:var(--statblock-heading-font-weight);margin:0px;letter-spacing:1px;font-variant:var(--statblock-heading-font-variant);display:flex;justify-content:space-between;align-items:center;line-height:var(--statblock-heading-line-height)}")}function kr(a,e,t){let n=a.slice();return n[2]=e[t],n}function vr(a){let e,t,n,i,s=[ad,td,ed,Ql,Zl,Xl],r=[];function c(o,l){return!o[1].size||o[1].size==1?0:o[1].size==2?1:o[1].size==3?2:o[1].size==4?3:o[1].size==5?4:5}return e=c(a,-1),t=r[e]=s[e](a),{c(){t.c(),n=re()},m(o,l){r[e].m(o,l),x(o,n,l),i=!0},p(o,l){let d=e;e=c(o,l),e===d?r[e].p(o,l):(ie(),O(r[d],1,1,()=>{r[d]=null}),se(),t=r[e],t?t.p(o,l):(t=r[e]=s[e](o),t.c()),I(t,1),t.m(n.parentNode,n))},i(o){i||(I(t),i=!0)},o(o){O(t),i=!1},d(o){r[e].d(o),o&&S(n)}}}function Xl(a){let e,t,n,i,s;return t=new Be({props:{textToRender:Z(a[0][a[2]])}}),{c(){e=A("h6"),X(t.$$.fragment),n=R(),_(e,"class",i="heading statblock-heading "+Z(a[2])+" svelte-1hofvsi")},m(r,c){x(r,e,c),J(t,e,null),D(e,n),s=!0},p(r,c){let o={};c&3&&(o.textToRender=Z(r[0][r[2]])),t.$set(o),(!s||c&2&&i!==(i="heading statblock-heading "+Z(r[2])+" svelte-1hofvsi"))&&_(e,"class",i)},i(r){s||(I(t.$$.fragment,r),s=!0)},o(r){O(t.$$.fragment,r),s=!1},d(r){r&&S(e),Y(t)}}}function Zl(a){let e,t,n,i,s;return t=new Be({props:{textToRender:Z(a[0][a[2]])}}),{c(){e=A("h5"),X(t.$$.fragment),n=R(),_(e,"class",i="heading statblock-heading "+Z(a[2])+" svelte-1hofvsi")},m(r,c){x(r,e,c),J(t,e,null),D(e,n),s=!0},p(r,c){let o={};c&3&&(o.textToRender=Z(r[0][r[2]])),t.$set(o),(!s||c&2&&i!==(i="heading statblock-heading "+Z(r[2])+" svelte-1hofvsi"))&&_(e,"class",i)},i(r){s||(I(t.$$.fragment,r),s=!0)},o(r){O(t.$$.fragment,r),s=!1},d(r){r&&S(e),Y(t)}}}function Ql(a){let e,t,n,i,s;return t=new Be({props:{textToRender:Z(a[0][a[2]])}}),{c(){e=A("h4"),X(t.$$.fragment),n=R(),_(e,"class",i="heading statblock-heading "+Z(a[2])+" svelte-1hofvsi")},m(r,c){x(r,e,c),J(t,e,null),D(e,n),s=!0},p(r,c){let o={};c&3&&(o.textToRender=Z(r[0][r[2]])),t.$set(o),(!s||c&2&&i!==(i="heading statblock-heading "+Z(r[2])+" svelte-1hofvsi"))&&_(e,"class",i)},i(r){s||(I(t.$$.fragment,r),s=!0)},o(r){O(t.$$.fragment,r),s=!1},d(r){r&&S(e),Y(t)}}}function ed(a){let e,t,n,i,s;return t=new Be({props:{textToRender:Z(a[0][a[2]])}}),{c(){e=A("h3"),X(t.$$.fragment),n=R(),_(e,"class",i="heading statblock-heading "+Z(a[2])+" svelte-1hofvsi")},m(r,c){x(r,e,c),J(t,e,null),D(e,n),s=!0},p(r,c){let o={};c&3&&(o.textToRender=Z(r[0][r[2]])),t.$set(o),(!s||c&2&&i!==(i="heading statblock-heading "+Z(r[2])+" svelte-1hofvsi"))&&_(e,"class",i)},i(r){s||(I(t.$$.fragment,r),s=!0)},o(r){O(t.$$.fragment,r),s=!1},d(r){r&&S(e),Y(t)}}}function td(a){let e,t,n,i,s;return t=new Be({props:{textToRender:Z(a[0][a[2]])}}),{c(){e=A("h2"),X(t.$$.fragment),n=R(),_(e,"class",i="heading statblock-heading "+Z(a[2])+" svelte-1hofvsi")},m(r,c){x(r,e,c),J(t,e,null),D(e,n),s=!0},p(r,c){let o={};c&3&&(o.textToRender=Z(r[0][r[2]])),t.$set(o),(!s||c&2&&i!==(i="heading statblock-heading "+Z(r[2])+" svelte-1hofvsi"))&&_(e,"class",i)},i(r){s||(I(t.$$.fragment,r),s=!0)},o(r){O(t.$$.fragment,r),s=!1},d(r){r&&S(e),Y(t)}}}function ad(a){let e,t,n,i,s;return t=new Be({props:{textToRender:Z(a[0][a[2]])}}),{c(){e=A("h1"),X(t.$$.fragment),n=R(),_(e,"class",i="heading statblock-heading "+Z(a[2])+" svelte-1hofvsi")},m(r,c){x(r,e,c),J(t,e,null),D(e,n),s=!0},p(r,c){let o={};c&3&&(o.textToRender=Z(r[0][r[2]])),t.$set(o),(!s||c&2&&i!==(i="heading statblock-heading "+Z(r[2])+" svelte-1hofvsi"))&&_(e,"class",i)},i(r){s||(I(t.$$.fragment,r),s=!0)},o(r){O(t.$$.fragment,r),s=!1},d(r){r&&S(e),Y(t)}}}function yr(a){let e,t,n=a[2]in a[0]&&vr(a);return{c(){n&&n.c(),e=re()},m(i,s){n&&n.m(i,s),x(i,e,s),t=!0},p(i,s){i[2]in i[0]?n?(n.p(i,s),s&3&&I(n,1)):(n=vr(i),n.c(),I(n,1),n.m(e.parentNode,e)):n&&(ie(),O(n,1,1,()=>{n=null}),se())},i(i){t||(I(n),t=!0)},o(i){O(n),t=!1},d(i){n&&n.d(i),i&&S(e)}}}function nd(a){let e,t,n=a[1].properties,i=[];for(let r=0;rO(i[r],1,1,()=>{i[r]=null});return{c(){e=A("div");for(let r=0;r{"monster"in s&&t(0,n=s.monster),"item"in s&&t(1,i=s.item)},[n,i]}var ki=class extends q{constructor(e){super(),U(this,e,id,nd,j,{monster:0,item:1},Jl)}},_r=ki;var Tr=require("obsidian");function sd(a){K(a,"svelte-151kcqm",".line.svelte-151kcqm{line-height:var(--statblock-property-line-height);display:block;color:var(--statblock-property-font-color)}.property-name.svelte-151kcqm{margin:0;margin-right:0.25em;display:inline;color:var(--statblock-property-name-font-color);font-weight:var(--statblock-property-name-font-weight)}")}function wr(a){let e,t,n,i,s,r;return i=new Xe({props:{render:a[0].markdown,property:a[1]}}),{c(){e=A("div"),t=A("span"),t.textContent=`${a[2]}`,n=R(),X(i.$$.fragment),_(t,"class","property-name svelte-151kcqm"),_(e,"class",s="line "+a[0].properties[0]+" svelte-151kcqm")},m(c,o){x(c,e,o),D(e,t),D(e,n),J(i,e,null),r=!0},p(c,o){let l={};o&1&&(l.render=c[0].markdown),o&2&&(l.property=c[1]),i.$set(l),(!r||o&1&&s!==(s="line "+c[0].properties[0]+" svelte-151kcqm"))&&_(e,"class",s)},i(c){r||(I(i.$$.fragment,c),r=!0)},o(c){O(i.$$.fragment,c),r=!1},d(c){c&&S(e),Y(i)}}}function rd(a){let e,t,n=(!a[0].conditioned||a[0].conditioned&&`${a[1]}`.length)&&wr(a);return{c(){n&&n.c(),e=re()},m(i,s){n&&n.m(i,s),x(i,e,s),t=!0},p(i,[s]){!i[0].conditioned||i[0].conditioned&&`${i[1]}`.length?n?(n.p(i,s),s&3&&I(n,1)):(n=wr(i),n.c(),I(n,1),n.m(e.parentNode,e)):n&&(ie(),O(n,1,1,()=>{n=null}),se())},i(i){t||(I(n),t=!0)},o(i){O(n),t=!1},d(i){n&&n.d(i),i&&S(e)}}}function od(a,e,t){let{monster:n}=e,{item:i}=e,s=Z(n[i.properties[0]]),r=i.display??i.properties[0];if(i.callback)try{let c=document.body.createEl("iframe"),o=c.contentWindow.Function;s=new o("monster",i.callback).call(void 0,n)??s,document.body.removeChild(c)}catch(c){new Tr.Notice(`There was an error executing the provided callback for [${i.properties.join(", ")}] + +${c.message}`),console.error(c)}return!i.conditioned&&!`${s}`.length&&(s=i.fallback??"-"),a.$$set=c=>{"monster"in c&&t(3,n=c.monster),"item"in c&&t(0,i=c.item)},[i,s,r,n]}var vi=class extends q{constructor(e){super(),U(this,e,od,rd,j,{monster:3,item:0},sd)}},Ar=vi;function cd(a){K(a,"svelte-sujd32",`.tapered-rule.svelte-sujd32{width:auto;margin:0.5em 0;height:5px;background:-webkit-linear-gradient( + 0deg, + var(--statblock-rule-color) 0%, + var(--statblock-rule-color) 50%, + var(--statblock-background-color) 95%, + var(--statblock-background-color) 100% + );clip-path:polygon(0 0, 0 100%, 95% 50%);-webkit-clip-path:polygon(0 0, 0 100%, 95% 50%)}`)}function ld(a){let e;return{c(){e=A("div"),_(e,"class","tapered-rule svelte-sujd32")},m(t,n){x(t,e,n)},p:H,i:H,o:H,d(t){t&&S(e)}}}var yi=class extends q{constructor(e){super(),U(this,e,null,ld,j,{},cd)}},sn=yi;function dd(a){K(a,"svelte-sgnocl",".line.svelte-sgnocl{line-height:var(--statblock-saves-line-height);display:block;color:var(--statblock-font-color)}.property-name.svelte-sgnocl{margin:0;margin-right:0.25em;display:inline;font-weight:bold}.property-text.svelte-sgnocl{display:inline;margin:0}")}function ud(a){let e,t,n,i=(a[0].display??Va(a[0].properties[0]))+"",s,r,c,o,l;return o=new Xe({props:{render:a[0].markdown,property:a[1]}}),{c(){e=A("div"),t=A("div"),n=A("span"),s=de(i),r=R(),c=A("div"),X(o.$$.fragment),_(n,"class","property-name svelte-sgnocl"),_(c,"class","property-text svelte-sgnocl"),_(t,"class","line svelte-sgnocl"),_(e,"class","info")},m(d,u){x(d,e,u),D(e,t),D(t,n),D(n,s),D(t,r),D(t,c),J(o,c,null),l=!0},p(d,[u]){(!l||u&1)&&i!==(i=(d[0].display??Va(d[0].properties[0]))+"")&&ve(s,i);let m={};u&1&&(m.render=d[0].markdown),o.$set(m)},i(d){l||(I(o.$$.fragment,d),l=!0)},o(d){O(o.$$.fragment,d),l=!1},d(d){d&&S(e),Y(o)}}}function hd(a){return`${a>0?"+":""}${a}`}function md(a,e,t){let{monster:n}=e,{item:i}=e,s=n[i.properties[0]];Array.isArray(s)||(s=[]);let r=s.map(o=>{if(typeof o!="object"||o==null)return null;let l=Object.keys(o)[0];if(!l)return null;let d=Object.values(o)[0];return!d||isNaN(Number(d))?null:`${Va(l)} ${hd(d)}`}).filter(o=>o).join(", "),c=ge("dice");return a.$$set=o=>{"monster"in o&&t(2,n=o.monster),"item"in o&&t(0,i=o.item)},[i,r,n]}var _i=class extends q{constructor(e){super(),U(this,e,md,ud,j,{monster:2,item:0},dd)}},Cr=_i;function gd(a){K(a,"svelte-1x5mdf",`.section-header.svelte-1x5mdf{border-bottom:var(--statblock-section-heading-border-size) solid + var(--statblock-section-heading-border-color);color:var(--statblock-section-heading-font-color);font-size:var(--statblock-section-heading-font-size);font-variant:var(--statblock-section-heading-font-variant);font-weight:var(--statblock-section-heading-font-weight);letter-spacing:1px;margin:0;margin-bottom:0.3em;break-inside:avoid-column;break-after:avoid-column}`)}function Sr(a){let e,t,n,i;return t=new Be({props:{textToRender:a[0]}}),{c(){e=A("h3"),X(t.$$.fragment),_(e,"class",n="section-header "+a[1](a[0])+" svelte-1x5mdf")},m(s,r){x(s,e,r),J(t,e,null),i=!0},p(s,r){let c={};r&1&&(c.textToRender=s[0]),t.$set(c),(!i||r&1&&n!==(n="section-header "+s[1](s[0])+" svelte-1x5mdf"))&&_(e,"class",n)},i(s){i||(I(t.$$.fragment,s),i=!0)},o(s){O(t.$$.fragment,s),i=!1},d(s){s&&S(e),Y(t)}}}function fd(a){let e,t,n=a[0]&&a[0].length&&Sr(a);return{c(){n&&n.c(),e=re()},m(i,s){n&&n.m(i,s),x(i,e,s),t=!0},p(i,[s]){i[0]&&i[0].length?n?(n.p(i,s),s&1&&I(n,1)):(n=Sr(i),n.c(),I(n,1),n.m(e.parentNode,e)):n&&(ie(),O(n,1,1,()=>{n=null}),se())},i(i){t||(I(n),t=!0)},o(i){O(n),t=!1},d(i){n&&n.d(i),i&&S(e)}}}function pd(a,e,t){let{monster:n}=e,{item:i}=e,s;if(i.headingProp){if(i.heading in n){let c=Z(n[i.heading]);c.length&&(s=c)}}else i.heading?.length&&(s=i.heading);let r=c=>c.toLowerCase().replace(/[^A-Za-z0-9\s]/g,"").replace(/\s+/g,"-");return a.$$set=c=>{"monster"in c&&t(2,n=c.monster),"item"in c&&t(3,i=c.item)},[s,r,n,i]}var wi=class extends q{constructor(e){super(),U(this,e,pd,fd,j,{monster:2,item:3},gd)}},rn=wi;function bd(a){K(a,"svelte-1186gko",".subheading.svelte-1186gko{font-weight:var(--statblock-subheading-font-weight);font-style:var(--statblock-subheading-font-style);font-size:var(--statblock-subheading-font-size);margin:0}")}function kd(a){let e,t,n;return t=new Be({props:{textToRender:a[1].join(a[0].separator??" ")}}),{c(){e=A("div"),X(t.$$.fragment),_(e,"class","subheading svelte-1186gko")},m(i,s){x(i,e,s),J(t,e,null),n=!0},p(i,s){let r={};s&1&&(r.textToRender=i[1].join(i[0].separator??" ")),t.$set(r)},i(i){n||(I(t.$$.fragment,i),n=!0)},o(i){O(t.$$.fragment,i),n=!1},d(i){i&&S(e),Y(t)}}}function vd(a){let e,t,n=a[1].length&&kd(a);return{c(){n&&n.c(),e=re()},m(i,s){n&&n.m(i,s),x(i,e,s),t=!0},p(i,[s]){i[1].length&&n.p(i,s)},i(i){t||(I(n),t=!0)},o(i){O(n),t=!1},d(i){n&&n.d(i),i&&S(e)}}}function yd(a,e,t){let{monster:n}=e,{item:i}=e,s=[];for(let r of i.properties)r in n&&s.push(`${Z(n[r])}`);return a.$$set=r=>{"monster"in r&&t(2,n=r.monster),"item"in r&&t(0,i=r.item)},[i,s,n]}var Ti=class extends q{constructor(e){super(),U(this,e,yd,vd,j,{monster:2,item:0},bd)}},xr=Ti;function _d(a){K(a,"svelte-18uixe9",".statblock-table-header.svelte-18uixe9{font-weight:var(--statblock-table-header-font-weight)}.table.svelte-18uixe9{display:flex;justify-content:space-evenly;align-items:center;flex-wrap:wrap}.table-item.svelte-18uixe9{display:flex;justify-content:center;align-items:center;flex-flow:column nowrap}")}function Dr(a,e,t){let n=a.slice();return n[6]=e[t],n[8]=t,n}function Er(a){let e,t=a[2](a[6])+"",n;return{c(){e=A("span"),n=de(t)},m(i,s){x(i,e,s),D(e,n)},p(i,s){s&2&&t!==(t=i[2](i[6])+"")&&ve(n,t)},d(i){i&&S(e)}}}function Mr(a){let e,t,n=`${a[3][a[8]]}`.toUpperCase()+"",i,s,r,c=Z(a[6])+"",o,l,d,u=a[0].calculate&&Er(a);return{c(){e=A("div"),t=A("span"),i=de(n),s=R(),r=A("span"),o=de(c),l=R(),u&&u.c(),d=R(),_(t,"class","statblock-table-header svelte-18uixe9"),_(e,"class","table-item svelte-18uixe9")},m(m,h){x(m,e,h),D(e,t),D(t,i),D(e,s),D(e,r),D(r,o),D(r,l),u&&u.m(r,null),D(e,d)},p(m,h){h&2&&c!==(c=Z(m[6])+"")&&ve(o,c),m[0].calculate?u?u.p(m,h):(u=Er(m),u.c(),u.m(r,null)):u&&(u.d(1),u=null)},d(m){m&&S(e),u&&u.d()}}}function wd(a){let e,t=a[1].slice(0,a[3].length),n=[];for(let i=0;i=0?"+":"-"}${Math.abs(d)})`}let c=n[i.properties[0]];Array.isArray(c)||(c=[]);let o=i.headers??[...Array(c.length>0?c.length:1).keys()];return a.$$set=l=>{"monster"in l&&t(4,n=l.monster),"item"in l&&t(0,i=l.item)},[i,c,r,o,n]}var Ai=class extends q{constructor(e){super(),U(this,e,Td,wd,j,{monster:4,item:0},_d)}},Ir=Ai;function Pr(a){let e,t,n,i,s=a[1].heading&&Or(a);return n=new Xe({props:{render:a[1].markdown,property:a[2]}}),{c(){s&&s.c(),e=R(),t=A("div"),X(n.$$.fragment),_(t,"class","line")},m(r,c){s&&s.m(r,c),x(r,e,c),x(r,t,c),J(n,t,null),i=!0},p(r,c){r[1].heading?s?(s.p(r,c),c&2&&I(s,1)):(s=Or(r),s.c(),I(s,1),s.m(e.parentNode,e)):s&&(ie(),O(s,1,1,()=>{s=null}),se());let o={};c&2&&(o.render=r[1].markdown),c&4&&(o.property=r[2]),n.$set(o)},i(r){i||(I(s),I(n.$$.fragment,r),i=!0)},o(r){O(s),O(n.$$.fragment,r),i=!1},d(r){s&&s.d(r),r&&S(e),r&&S(t),Y(n)}}}function Or(a){let e,t;return e=new rn({props:{item:a[1],monster:a[0]}}),{c(){X(e.$$.fragment)},m(n,i){J(e,n,i),t=!0},p(n,i){let s={};i&2&&(s.item=n[1]),i&1&&(s.monster=n[0]),e.$set(s)},i(n){t||(I(e.$$.fragment,n),t=!0)},o(n){O(e.$$.fragment,n),t=!1},d(n){Y(e,n)}}}function Ad(a){let e,t,n=(!a[1].conditioned||a[1].conditioned&&`${a[2]}`.length)&&Pr(a);return{c(){n&&n.c(),e=re()},m(i,s){n&&n.m(i,s),x(i,e,s),t=!0},p(i,[s]){!i[1].conditioned||i[1].conditioned&&`${i[2]}`.length?n?(n.p(i,s),s&6&&I(n,1)):(n=Pr(i),n.c(),I(n,1),n.m(e.parentNode,e)):n&&(ie(),O(n,1,1,()=>{n=null}),se())},i(i){t||(I(n),t=!0)},o(i){O(n),t=!1},d(i){n&&n.d(i),i&&S(e)}}}function Cd(a,e,t){let{monster:n}=e,{item:i}=e,s=i.text&&i.text.length?i.text:Z(n[i.properties[0]]);return!i.conditioned&&!`${s}`.length&&(s=i.fallback??"-"),a.$$set=r=>{"monster"in r&&t(0,n=r.monster),"item"in r&&t(1,i=r.item)},[n,i,s]}var Ci=class extends q{constructor(e){super(),U(this,e,Cd,Ad,j,{monster:0,item:1})}},Wr=Ci;var Br=require("obsidian");function Sd(a){K(a,"svelte-gdz2l0",".image.svelte-gdz2l0{width:var(--statblock-image-width);height:var(--statblock-image-height)}.image.pointer.svelte-gdz2l0{cursor:pointer}img.svelte-gdz2l0{object-fit:cover;width:100%;height:100%;border-radius:100%;border:var(--statblock-image-border-size) solid var(--statblock-image-border-color);object-position:center}")}function Nr(a,e,t){let n=a.slice();return n[13]=e[t],n}function Hr(a){let e,t,n={ctx:a,current:null,token:null,hasCatch:!1,pending:Md,then:Dd,catch:xd,value:16};return Ys(t=a[3],n),{c(){e=re(),n.block.c()},m(i,s){x(i,e,s),n.block.m(i,n.anchor=s),n.mount=()=>e.parentNode,n.anchor=e},p(i,s){a=i,Js(n,a,s)},d(i){i&&S(e),n.block.d(i),n.token=null,n=null}}}function xd(a){return{c:H,m:H,p:H,d:H}}function Dd(a){let e,t=a[16]&&Ed(a);return{c(){t&&t.c(),e=R()},m(n,i){t&&t.m(n,i),x(n,e,i)},p(n,i){n[16]&&t.p(n,i)},d(n){t&&t.d(n),n&&S(e)}}}function Ed(a){let e,t,n,i,s,r;return{c(){e=A("div"),t=A("img"),$s(t.src,n=a[16])||_(t,"src",n),_(t,"alt",i=a[0].name),_(t,"class","svelte-gdz2l0"),_(e,"class","image svelte-gdz2l0"),Re(e,"pointer",a[2]!=null)},m(c,o){x(c,e,o),D(e,t),s||(r=[ue(e,"click",a[6]),ue(e,"mouseenter",a[7])],s=!0)},p(c,o){o&1&&i!==(i=c[0].name)&&_(t,"alt",i),o&4&&Re(e,"pointer",c[2]!=null)},d(c){c&&S(e),s=!1,me(r)}}}function Md(a){return{c:H,m:H,p:H,d:H}}function Lr(a){let e,t=a[13]in a[0]&&Hr(a);return{c(){t&&t.c(),e=re()},m(n,i){t&&t.m(n,i),x(n,e,i)},p(n,i){n[13]in n[0]?t?t.p(n,i):(t=Hr(n),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},d(n){t&&t.d(n),n&&S(e)}}}function Id(a){let e,t=a[1].properties,n=[];for(let i=0;i/g,""),r)),!c)throw new Error;C=s.app.vault.getResourcePath(c)}}catch(w){console.error(w)}return C}let d=(async()=>{if(i.properties.length&&i.properties.some(k=>k in n&&typeof n[k]=="string")){let k=i.properties.filter(w=>w in n&&typeof n[w]=="string");k.length>1&&console.log("TTRPG Statblocks: Multiple image properties provided, using first.");let C=n[k[0]];return o(C)}})(),u=Br.Platform.isMacOS?"Meta":"Control";function m(k){if(!c)return;s.app.workspace.getLeaf(k.getModifierState(u)?"window":"split").openFile(c)}function h(k){s.app.workspace.trigger("link-hover",{},k.currentTarget,c.path,r)}let b=k=>m(k),f=k=>h(k);return a.$$set=k=>{"monster"in k&&t(0,n=k.monster),"item"in k&&t(1,i=k.item)},[n,i,c,d,m,h,b,f]}var Si=class extends q{constructor(e){super(),U(this,e,Pd,Id,j,{monster:0,item:1},Sd)}},Fr=Si;function Od(a){K(a,"svelte-9gi3x8",`.statblock-content.svelte-9gi3x8{font-family:var(--statblock-content-font);font-size:var(--statblock-content-font-size);color:var(--statblock-font-color);background-color:var(--statblock-background-color);padding:0.5em;border:var(--statblock-border-size) var(--statblock-border-color) solid;box-shadow:var(--statblock-box-shadow-x-offset) + var(--statblock-box-shadow-y-offset) + var(--statblock-box-shadow-blur) var(--statblock-box-shadow-color);margin-left:2px;margin-right:2px;display:flex;gap:1rem}.statblock-content.svelte-9gi3x8>.column{width:var(--statblock-column-width)}@media screen and (max-width: 400px){.statblock-content.svelte-9gi3x8>.column{width:75vw}}.statblock-item-container{margin-bottom:0.25rem}.statblock-detached{position:absolute;top:-9999px}.statblock-item-inline{display:flex;justify-content:space-between}`)}function Wd(a){let e,t;return{c(){e=A("div"),t=A("div"),_(t,"class","statblock-content svelte-9gi3x8"),_(e,"class","statblock-content-container"),ti(e,"--statblock-column-width",a[1])},m(n,i){x(n,e,i),D(e,t),a[6](t)},p(n,[i]){i&2&&ti(e,"--statblock-column-width",n[1])},i:H,o:H,d(n){n&&S(e),a[6](null)}}}function Nd(a,e,t){let n,i=We(),{statblock:s}=e,{columns:r=1}=e,{ready:c}=e,{maxColumns:o=r}=e,l=ge("monster"),d=w=>w.conditioned==null||!w.conditioned?!0:"nested"in w?w.nested.some(W=>d(W)):w.properties.length?w.properties.some(W=>!!(W in l&&(Array.isArray(l[W])&&l[W].length||typeof l[W]=="string"&&l[W].length||typeof l[W]=="number"))):!0,u=ni(),m=(w,W)=>{if(!d(w))return[];let E=[],y=W?W.createDiv(`statblock-item-container ${pt(w.type)}-container`):createDiv(`statblock-item-container ${pt(w.type)}-container`);switch(u.set("item",w),E.push(y),w.type){case"group":{for(let g of w.nested??[]){let p=m(g,y);E.push(...p)}break}case"heading":{let g=new _r({target:y,props:{monster:l,item:w},context:u});g.$on("save",p=>i("save",p.detail)),g.$on("export",p=>i("export",p.detail));break}case"inline":{let g=y.createDiv("statblock-item-inline");for(let p of w.nested??[])m(p,g.createDiv(`statblock-inline-item ${pt(p.type)}-container`));E.push(g);break}case"image":{new Fr({target:y,props:{monster:l,item:w},context:u});break}case"property":{new Ar({target:y,props:{monster:l,item:w},context:u});break}case"saves":{new Cr({target:y,props:{monster:l,item:w},context:u});break}case"spells":{let g=l[w.properties[0]];if(!Array.isArray(g)||!g.length)return;new br({target:y,props:{property:w.properties[0],monster:l,render:w.markdown},context:u});break}case"subheading":{new xr({target:y,props:{monster:l,item:w},context:u});break}case"table":{new Ir({target:y,props:{monster:l,item:w},context:u});break}case"text":{new Wr({target:y,props:{monster:l,item:w}});break}case"traits":{let g=l[w.properties[0]];if(!Array.isArray(g)||!g.length)return[];w.heading&&new rn({target:y,props:{monster:l,item:w},context:u});try{for(let p of g){let v=createDiv("statblock-item-container statblock-trait-prop");new Sa({target:v,props:{name:p.name,desc:p.desc,property:w.properties[0],render:w.markdown},context:u}),E.push(v)}}catch{return[]}break}}if(w.hasRule){let g=createDiv("statblock-item-container rule-container");new sn({target:g}),E.push(g)}return E},h=[];for(let w of s){let W=m(w);h.push(...W)}let b=w=>{w.empty();let W=w.createDiv("column");if(r==1){h.forEach(p=>W.appendChild(p));return}let E=document.body.createDiv("statblock-detached"),y=new Map;for(let p of h)E.appendChild(p),y.set(p,Math.floor(p.clientHeight));E.style.width=k;let g;l.forceColumns?g=E.clientHeight/o:l.columns&&l.columns>0?g=Math.max(E.clientHeight/l.columns,E.clientHeight/r):g=Math.max(600,Math.min(E.clientHeight/r,n)),E.empty(),E.detach();for(let p of h)w.childElementCountg&&(W=w.createDiv("column")),W.appendChild(p)},f,k="400px";l.columnWidth&&(typeof l.columnWidth=="number"&&(k=`${l.columnWidth}px`),typeof l.columnWidth=="string"&&(k=l.columnWidth));function C(w){rt[w?"unshift":"push"](()=>{f=w,t(0,f)})}a.$$set=w=>{"statblock"in w&&t(2,s=w.statblock),"columns"in w&&t(3,r=w.columns),"ready"in w&&t(4,c=w.ready),"maxColumns"in w&&t(5,o=w.maxColumns)},a.$$.update=()=>{if(a.$$.dirty&17){e:c&&f&&b(f)}};e:n=!isNaN(Number(l.columnHeight))&&l.columnHeight>0?l.columnHeight:1/0;return[f,k,s,r,c,o,C]}var xi=class extends q{constructor(e){super(),U(this,e,Nd,Wd,j,{statblock:2,columns:3,ready:4,maxColumns:5},Od)}},zr=xi;function Hd(a){K(a,"svelte-1r5gl1g",".container.svelte-1r5gl1g{display:flex;width:100%;margin:0.25rem 0}.statblock.svelte-1r5gl1g{margin:0 auto;position:relative}.icons.svelte-1r5gl1g{position:absolute;right:0}")}function $r(a){let e,t,n,i,s,r,c,o,l,d,u=[Rd,Ld],m=[];function h(b,f){return b[0]?0:1}return t=h(a,-1),n=m[t]=u[t](a),{c(){e=A("div"),n.c(),s=R(),r=A("div"),_(e,"class",i=qs(a[8].join(" "))+" svelte-1r5gl1g"),Re(e,"obsidian-statblock-plugin",!0),Re(e,"statblock",!0),_(r,"class","icons svelte-1r5gl1g")},m(b,f){x(b,e,f),m[t].m(e,null),x(b,s,f),x(b,r,f),o=!0,l||(d=[ae(c=a[6].call(null,r)),ue(r,"keypress",a[7]),ue(r,"click",a[7])],l=!0)},p(b,f){let k=t;t=h(b,f),t===k?m[t].p(b,f):(ie(),O(m[k],1,1,()=>{m[k]=null}),se(),n=m[t],n?n.p(b,f):(n=m[t]=u[t](b),n.c()),I(n,1),n.m(e,null))},i(b){o||(I(n),o=!0)},o(b){O(n),o=!1},d(b){b&&S(e),m[t].d(),b&&S(s),b&&S(r),l=!1,me(d)}}}function Ld(a){let e;return{c(){e=A("span"),e.textContent="Invalid monster."},m(t,n){x(t,e,n)},p:H,i:H,o:H,d(t){t&&S(e)}}}function Rd(a){let e,t,n=a[3],i,s,r;e=new di({});let c=jr(a);return s=new di({}),{c(){X(e.$$.fragment),t=R(),c.c(),i=R(),X(s.$$.fragment)},m(o,l){J(e,o,l),x(o,t,l),c.m(o,l),x(o,i,l),J(s,o,l),r=!0},p(o,l){l&8&&j(n,n=o[3])?(ie(),O(c,1,1,H),se(),c=jr(o),c.c(),I(c,1),c.m(i.parentNode,i)):c.p(o,l)},i(o){r||(I(e.$$.fragment,o),I(c),I(s.$$.fragment,o),r=!0)},o(o){O(e.$$.fragment,o),O(c),O(s.$$.fragment,o),r=!1},d(o){Y(e,o),o&&S(t),c.d(o),o&&S(i),Y(s,o)}}}function jr(a){let e,t;return e=new zr({props:{columns:a[3],maxColumns:a[5],statblock:a[1],ready:a[4]}}),e.$on("save",a[15]),e.$on("export",a[16]),{c(){X(e.$$.fragment)},m(n,i){J(e,n,i),t=!0},p(n,i){let s={};i&8&&(s.columns=n[3]),i&2&&(s.statblock=n[1]),i&16&&(s.ready=n[4]),e.$set(s)},i(n){t||(I(e.$$.fragment,n),t=!0)},o(n){O(e.$$.fragment,n),t=!1},d(n){Y(e,n)}}}function Bd(a){let e,t,n=a[4]&&$r(a);return{c(){e=A("div"),n&&n.c(),_(e,"class","container svelte-1r5gl1g")},m(i,s){x(i,e,s),n&&n.m(e,null),a[17](e),t=!0},p(i,[s]){i[4]?n?(n.p(i,s),s&16&&I(n,1)):(n=$r(i),n.c(),I(n,1),n.m(e,null)):n&&(ie(),O(n,1,1,()=>{n=null}),se())},i(i){t||(I(n),t=!0)},o(i){O(n),t=!1},d(i){i&&S(e),n&&n.d(),a[17](null)}}}function Fd(a,e,t){let n,i,s=We(),{monster:r}=e,{context:c}=e,{plugin:o}=e,{statblock:l}=e,{renderer:d}=e,{layout:u}=e,{canSave:m=!0}=e,h=!isNaN(Number(r.columns))&&Number(r.columns)>0?Number(r.columns):2,b=r.export??o.settings.export,f=o.canUseDiceRoller&&(r.dice??o.settings.useDice),k=r.render??o.settings.renderDice;gt("plugin",o),gt("tryToRenderLinks",o.settings.tryToRenderLinks),gt("context",c),gt("monster",r),gt("dice",f),gt("render",k),gt("renderer",d);let C=tr(!1);gt("reset",C);let w,W=h,E=!1,y=()=>{if(r.forceColumns){t(3,W=h),p.disconnect();return}let F=w.clientWidth;t(3,W=Math.min(Math.max(Math.floor(F/i),1),h))},g=(0,ot.debounce)(()=>{y(),E||t(4,E=!0)},100,!1),p=new ResizeObserver(g);Ca(()=>{y(),p.observe(w)}),ai(()=>{p.disconnect()});let v=F=>{new ot.ExtraButtonComponent(F).setIcon("vertical-three-dots")},M=new ot.Menu;M.addItem(F=>F.setIcon(tn).setTitle("Save to Bestiary").setDisabled(!m).onClick(()=>s("save"))),M.addItem(F=>{F.setTitle("Copy YAML").setIcon("code").onClick(async()=>{try{await navigator.clipboard.writeText((0,ot.stringifyYaml)(r)),new ot.Notice("Creature YAML copied to clipboard")}catch(fe){new ot.Notice(`There was an issue copying the yaml: + +${fe.message}`)}})}),b&&M.addItem(F=>F.setIcon(an).setTitle("Export as PNG").onClick(()=>s("export"))),f&&M.addItem(F=>F.setIcon("reset").setTitle("Reset Dice").onClick(()=>{C.set(!0),C.set(!1)}));let N=F=>{M.showAtMouseEvent(F)},T=r?.name?.toLowerCase().replace(/[^A-Za-z0-9\s]/g,"").replace(/\s+/g,"-")??"no-name",P=u.toLowerCase().replace(/[^A-Za-z0-9\s]/g,"").replace(/\s+/g,"-")??"no-layout",L=[T,P].filter(F=>F?.length);function G(F){ii.call(this,a,F)}function B(F){ii.call(this,a,F)}function te(F){rt[F?"unshift":"push"](()=>{w=F,t(2,w)})}return a.$$set=F=>{"monster"in F&&t(0,r=F.monster),"context"in F&&t(9,c=F.context),"plugin"in F&&t(10,o=F.plugin),"statblock"in F&&t(1,l=F.statblock),"renderer"in F&&t(11,d=F.renderer),"layout"in F&&t(12,u=F.layout),"canSave"in F&&t(13,m=F.canSave)},a.$$.update=()=>{if(a.$$.dirty&1){e:t(14,n=Number(`${r.columnWidth}`.replace(/\D/g,"")))}if(a.$$.dirty&16384){e:i=!isNaN(n)&&n>0?n:400}},[r,l,w,W,E,h,v,N,L,c,o,d,u,m,n,G,B,te]}var Di=class extends q{constructor(e){super(),U(this,e,Fd,Bd,j,{monster:0,context:9,plugin:10,statblock:1,renderer:11,layout:12,canSave:13},Hd)}},qr=Di;var on=_a(xa());var Tt=class extends Gr.MarkdownRenderChild{constructor(t){super(t.container);this.rendererParameters=t;this.loaded=!1;this.container=t.container,this.plugin=t.plugin,this.context=t.context??"","params"in t?(this.params=t.params,this.monster=Object.assign({},this.plugin.bestiary.get(this.params.monster)??this.plugin.bestiary.get(this.params.creature))):(this.params={},this.monster=t.monster),this.setLayout(),this.init()}setLayout(){this.layout=this.plugin.layouts.find(t=>t.name==(this.params.layout??this.monster.layout)||t.name==(this.params.statblock??this.monster.statblock))??this.plugin.defaultLayout}get canSave(){return"name"in this.params}async build(){let t=Object.assign({},this.monster??{},this.params??{});if(Object.values(t).length||(t=Object.assign({},t,{note:this.context})),t.note){let n=Array.isArray(t.note)?t.note.flat(1/0).pop():t.note,i=await app.metadataCache.getFirstLinkpathDest(`${n}`,this.context??"");if(i&&i instanceof Ht.TFile){let s=await app.metadataCache.getFileCache(i);Object.assign(t,(0,on.default)(s.frontmatter)??{})}}"image"in t&&Array.isArray(t.image)&&(t.image=t.image.flat(2).join(""));for(let n of this.getBlocksToTransform(this.layout.blocks))for(let i of n.properties){if(!(i in t))continue;let s=t[i];n.type=="traits"?s=Bs([],t[i]??[]):n.type=="saves"&&!Array.isArray(t[i])&&typeof t[i]=="object"&&(s=Object.entries(t[i]??{}).map(([r,c])=>({[r]:c}))),Object.assign(t,{[i]:s})}return t=JSON.parse(JSON.stringify(t).replace(/\\#/g,"#").replace(/\[\["(.+?)"\]\]/g,'"$1"').replace(/\[\[([^"]+?)\]\]/g,(n,i)=>`${i}`).replace(/\[([^"]*?)\]\(([^"]+?)\)/g,(n,i,s)=>i.length?`${s}|${i}`:`${s}`)),this.monster=t,t}getBlocksToTransform(t){let n=[];for(let i of t)switch(i.type){case"group":case"inline":{n.push(...this.getBlocksToTransform(i.nested));break}case"saves":case"traits":{n.push(i);break}default:continue}return n}async init(){let t=new qr({target:this.containerEl,props:{context:this.context,monster:await this.build(),statblock:this.layout.blocks,layout:this.layout.name,plugin:this.plugin,renderer:this,canSave:this.canSave}});t.$on("save",async()=>{this.plugin.bestiary.has(this.monster.name)&&!await zd(this.plugin.app,"This will overwrite an existing monster in settings. Are you sure?")||this.plugin.saveMonster({...(0,on.default)(this.monster),source:"Homebrew",layout:this.layout.name})}),t.$on("export",()=>{this.plugin.exportAsPng(this.monster.name,this.containerEl.firstElementChild)})}transform(){if(!("extends"in this.monster)||!(Array.isArray(this.monster.extends)||typeof this.monster.extends=="string")||!this.monster.extends.length)return this.monster;let t=this.getExtensions(this.monster);return Object.assign({},...t,this.monster)}getExtensions(t){let n=[(0,on.default)(t)];if(t.extends&&t.extends.length)for(let i of[t.extends].flat()){let s=this.plugin.bestiary.get(i);!s||n.push(...this.getExtensions(s))}return n}};async function zd(a,e,t={cta:"Yes",secondary:"No"}){return new Promise((n,i)=>{let s=new Ii(a,e,t);s.onClose=()=>{n(s.confirmed)},s.open()})}var Ii=class extends Ht.Modal{constructor(t,n,i){super(t);this.text=n;this.buttons=i;this.confirmed=!1}async display(){new Promise(t=>{this.contentEl.empty(),this.contentEl.addClass("confirm-modal"),this.contentEl.createEl("p",{text:this.text});let n=this.contentEl.createDiv("fantasy-calendar-confirm-buttons");new Ht.ButtonComponent(n).setButtonText(this.buttons.cta).setCta().onClick(()=>{this.confirmed=!0,this.close()}),new Ht.ButtonComponent(n).setButtonText(this.buttons.secondary).onClick(()=>{this.close()})})}onOpen(){this.display()}};var V=require("obsidian");var et=require("obsidian");var Da=[["group","Group"],["heading","Heading"],["image","Image"],["inline","Inline Group"],["property","Property Line"],["saves","Saves"],["spells","Spells"],["subheading","Subheading"],["table","Table"],["text","Text"],["traits","Traits"]],Ur=["property","traits","spells","text","saves"];var $d=require("obsidian");function cn(a){switch(a){case"inline":case"group":return{type:a,id:z(),properties:[],nested:[]};case"heading":return{type:"heading",id:z(),properties:[],size:1};case"property":return{type:"property",id:z(),properties:[]};case"saves":return{type:"saves",id:z(),properties:[]};case"traits":return{type:"traits",id:z(),properties:[]};case"spells":return{type:"spells",id:z(),properties:[]};case"subheading":return{type:"subheading",id:z(),properties:[]};case"image":return{type:"image",id:z(),properties:[]};case"table":return{type:"table",id:z(),properties:[],headers:[],calculate:!0};case"text":return{type:"text",id:z(),properties:[],text:null}}}function Vr(a){let e=a-1;return e*e*e+1}function ln(a,{from:e,to:t},n={}){let i=getComputedStyle(a),s=i.transform==="none"?"":i.transform,[r,c]=i.transformOrigin.split(" ").map(parseFloat),o=e.left+e.width*r/t.width-(t.left+r),l=e.top+e.height*c/t.height-(t.top+c),{delay:d=0,duration:u=h=>Math.sqrt(h)*120,easing:m=Vr}=n;return{delay:d,duration:ze(u)?u(Math.sqrt(o*o+l*l)):u,easing:m,css:(h,b)=>{let f=b*o,k=b*l,C=h+b*e.width/t.width,w=h+b*e.height/t.height;return`transform: ${s} translate(${f}px, ${k}px) scale(${C}, ${w});`}}}function Kr(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(a);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(a,i).enumerable})),t.push.apply(t,n)}return t}function Rt(a){for(var e=1;e=0)&&(t[i]=a[i]);return t}function qd(a,e){if(a==null)return{};var t=jd(a,e),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(a);for(i=0;i=0)&&(!Object.prototype.propertyIsEnumerable.call(a,n)||(t[n]=a[n]))}return t}function Gd(a,e){return Vd(a)||Yd(a,e)||Fi(a,e)||Xd()}function sa(a){return Ud(a)||Kd(a)||Fi(a)||Jd()}function Ud(a){if(Array.isArray(a))return Oi(a)}function Vd(a){if(Array.isArray(a))return a}function Kd(a){if(typeof Symbol<"u"&&a[Symbol.iterator]!=null||a["@@iterator"]!=null)return Array.from(a)}function Yd(a,e){var t=a==null?null:typeof Symbol<"u"&&a[Symbol.iterator]||a["@@iterator"];if(t!=null){var n=[],i=!0,s=!1,r,c;try{for(t=t.call(a);!(i=(r=t.next()).done)&&(n.push(r.value),!(e&&n.length===e));i=!0);}catch(o){s=!0,c=o}finally{try{!i&&t.return!=null&&t.return()}finally{if(s)throw c}}return n}}function Fi(a,e){if(!!a){if(typeof a=="string")return Oi(a,e);var t=Object.prototype.toString.call(a).slice(8,-1);if(t==="Object"&&a.constructor&&(t=a.constructor.name),t==="Map"||t==="Set")return Array.from(a);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Oi(a,e)}}function Oi(a,e){(e==null||e>a.length)&&(e=a.length);for(var t=0,n=new Array(e);t=a.length?{done:!0}:{done:!1,value:a[n++]}},e:function(o){throw o},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s=!0,r=!1,c;return{s:function(){t=t.call(a)},n:function(){var o=t.next();return s=o.done,o},e:function(o){r=!0,c=o},f:function(){try{!s&&t.return!=null&&t.return()}finally{if(r)throw c}}}}var Zd="finalize",Qd="consider";function ra(a,e,t){a.dispatchEvent(new CustomEvent(Zd,{detail:{items:e,info:t}}))}function St(a,e,t){a.dispatchEvent(new CustomEvent(Qd,{detail:{items:e,info:t}}))}var _n="draggedEntered",Wa="draggedLeft",wn="draggedOverIndex",zi="draggedLeftDocument",mn={LEFT_FOR_ANOTHER:"leftForAnother",OUTSIDE_OF_ANY:"outsideOfAny"};function eu(a,e,t){a.dispatchEvent(new CustomEvent(_n,{detail:{indexObj:e,draggedEl:t}}))}function tu(a,e,t){a.dispatchEvent(new CustomEvent(Wa,{detail:{draggedEl:e,type:mn.LEFT_FOR_ANOTHER,theOtherDz:t}}))}function au(a,e){a.dispatchEvent(new CustomEvent(Wa,{detail:{draggedEl:e,type:mn.OUTSIDE_OF_ANY}}))}function nu(a,e,t){a.dispatchEvent(new CustomEvent(wn,{detail:{indexObj:e,draggedEl:t}}))}function iu(a){window.dispatchEvent(new CustomEvent(zi,{detail:{draggedEl:a}}))}var De={DRAG_STARTED:"dragStarted",DRAGGED_ENTERED:_n,DRAGGED_ENTERED_ANOTHER:"dragEnteredAnother",DRAGGED_OVER_INDEX:wn,DRAGGED_LEFT:Wa,DRAGGED_LEFT_ALL:"draggedLeftAll",DROPPED_INTO_ZONE:"droppedIntoZone",DROPPED_INTO_ANOTHER:"droppedIntoAnother",DROPPED_OUTSIDE_OF_ANY:"droppedOutsideOfAny",DRAG_STOPPED:"dragStopped"},Se={POINTER:"pointer",KEYBOARD:"keyboard"},Tn="isDndShadowItem",$i="data-is-dnd-shadow-item",xt="id:dnd-shadow-placeholder-0000",su="dnd-action-dragged-el",Ie="id",Wi=0;function ro(){Wi++}function oo(){if(Wi===0)throw new Error("Bug! trying to decrement when there are no dropzones");Wi--}var ji=typeof window>"u",ee=function(){};function co(a){var e,t=a.getBoundingClientRect(),n=getComputedStyle(a),i=n.transform;if(i){var s,r,c,o;if(i.startsWith("matrix3d("))e=i.slice(9,-1).split(/, /),s=+e[0],r=+e[5],c=+e[12],o=+e[13];else if(i.startsWith("matrix("))e=i.slice(7,-1).split(/, /),s=+e[0],r=+e[3],c=+e[4],o=+e[5];else return t;var l=n.transformOrigin,d=t.x-c-(1-s)*parseFloat(l),u=t.y-o-(1-r)*parseFloat(l.slice(l.indexOf(" ")+1)),m=s?t.width/s:a.offsetWidth,h=r?t.height/r:a.offsetHeight;return{x:d,y:u,width:m,height:h,top:u,right:d+m,bottom:u+h,left:d}}else return t}function lo(a){var e=co(a);return{top:e.top+window.scrollY,bottom:e.bottom+window.scrollY,left:e.left+window.scrollX,right:e.right+window.scrollX}}function qi(a){var e=a.getBoundingClientRect();return{top:e.top+window.scrollY,bottom:e.bottom+window.scrollY,left:e.left+window.scrollX,right:e.right+window.scrollX}}function uo(a){return{x:(a.left+a.right)/2,y:(a.top+a.bottom)/2}}function ru(a,e){return Math.sqrt(Math.pow(a.x-e.x,2)+Math.pow(a.y-e.y,2))}function Gi(a,e){return a.y<=e.bottom&&a.y>=e.top&&a.x>=e.left&&a.x<=e.right}function Pa(a){return uo(qi(a))}function Yr(a,e){var t=Pa(a),n=lo(e);return Gi(t,n)}function ou(a,e){var t=Pa(a),n=Pa(e);return ru(t,n)}function cu(a){var e=qi(a);return e.right<0||e.left>document.documentElement.scrollWidth||e.bottom<0||e.top>document.documentElement.scrollHeight}function lu(a,e){var t=qi(e);return Gi(a,t)?{top:a.y-t.top,bottom:t.bottom-a.y,left:a.x-t.left,right:Math.min(t.right,document.documentElement.clientWidth)-a.x}:null}var zt;function Ui(){ee(function(){return"resetting indexes cache"}),zt=new Map}Ui();function du(a){ee(function(){return"resetting indexes cache for dz"}),zt.delete(a)}function uu(a){var e=Array.from(a.children).findIndex(function(t){return t.getAttribute($i)});if(e>=0)return zt.has(a)||zt.set(a,new Map),zt.get(a).set(e,lo(a.children[e])),e}function hu(a,e){if(!Yr(a,e))return null;var t=e.children;if(t.length===0)return{index:0,isProximityBased:!0};for(var n=uu(e),i=0;ir.clientHeight&&(c.bottomr.clientWidth&&(c.right1&&arguments[1]!==void 0?arguments[1]:0;return a.parentElement?mo(a.parentElement,e+1):e-1}function mu(a,e){if(Object.keys(a).length!==Object.keys(e).length)return!1;for(var t in a)if(!{}.hasOwnProperty.call(e,t)||e[t]!==a[t])return!1;return!0}function gu(a,e){if(a.length!==e.length)return!1;for(var t=0;t2&&arguments[2]!==void 0?arguments[2]:fu,n,i,s=!1,r,c=Array.from(e).sort(function(l,d){return Jr(d)-Jr(l)});function o(){var l=Pa(a),d=pu(l,n);if(!d&&r&&Math.abs(r.x-l.x)1&&arguments[1]!==void 0?arguments[1]:function(){},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){return[]};a.forEach(function(n){var i=e(n);Object.keys(i).forEach(function(s){n.style[s]=i[s]}),t(n).forEach(function(s){return n.classList.add(s)})})}function pn(a){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){return[]};a.forEach(function(n){var i=e(n);Object.keys(i).forEach(function(s){n.style[s]=""}),t(n).forEach(function(s){return n.classList.contains(s)&&n.classList.remove(s)})})}function Ou(a){var e=a.style.minHeight;a.style.minHeight=window.getComputedStyle(a).getPropertyValue("height");var t=a.style.minWidth;return a.style.minWidth=window.getComputedStyle(a).getPropertyValue("width"),function(){a.style.minHeight=e,a.style.minWidth=t}}var Wu="--any--",Nu=100,Zr=3,Qr={outline:"rgba(255, 255, 102, 0.7) solid 2px"},ft,He,Ke,An,Ce,Cn,oa,Ue,At,Ze,Ft=!1,Vi=!1,Ki,Na=!1,Ma=[],dt=new Map,Ae=new Map,Pi=new WeakMap;function Hu(a,e){ee(function(){return"registering drop-zone if absent"}),dt.has(e)||dt.set(e,new Set),dt.get(e).has(a)||(dt.get(e).add(a),ro())}function eo(a,e){dt.get(e).delete(a),oo(),dt.get(e).size===0&&dt.delete(e)}function Lu(){ee(function(){return"watching dragged element"}),Tu();var a=dt.get(An),e=yn(a),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;n.addEventListener(_n,yo),n.addEventListener(Wa,_o),n.addEventListener(wn,wo)}}catch(s){e.e(s)}finally{e.f()}window.addEventListener(zi,ca);var i=Math.max.apply(Math,[Nu].concat(sa(Array.from(a.keys()).map(function(s){return Ae.get(s).dropAnimationDurationMs}))));ku(He,a,i*1.07)}function Ru(){ee(function(){return"unwatching dragged element"}),Au();var a=dt.get(An),e=yn(a),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;n.removeEventListener(_n,yo),n.removeEventListener(Wa,_o),n.removeEventListener(wn,wo)}}catch(i){e.e(i)}finally{e.f()}window.removeEventListener(zi,ca),vu()}function Bu(a){return a.findIndex(function(e){return e[Ie]===xt})}function Sn(a){return a.findIndex(function(e){return!!e[Tn]&&e[Ie]!==xt})}function yo(a){ee(function(){return["dragged entered",a.currentTarget,a.detail]});var e=Ae.get(a.currentTarget),t=e.items,n=e.dropFromOthersDisabled;if(n&&a.currentTarget!==Ce){ee(function(){return"ignoring dragged entered because drop is currently disabled"});return}if(Na=!1,t=t.filter(function(u){return u[Ie]!==oa[Ie]}),ee(function(){return"dragged entered items ".concat(vt(t))}),Ce!==a.currentTarget){var i=Ae.get(Ce).items,s=i.filter(function(u){return!u[Tn]});St(Ce,s,{trigger:De.DRAGGED_ENTERED_ANOTHER,id:Ke[Ie],source:Se.POINTER})}else{var r=Bu(t);r!==-1&&(ee(function(){return"removing placeholder item from origin dz"}),t.splice(r,1))}var c=a.detail.indexObj,o=c.index,l=c.isProximityBased,d=l&&o===a.currentTarget.children.length-1?o+1:o;Ue=a.currentTarget,t.splice(d,0,oa),St(a.currentTarget,t,{trigger:De.DRAGGED_ENTERED,id:Ke[Ie],source:Se.POINTER})}function _o(a){if(!!Ft){ee(function(){return["dragged left",a.currentTarget,a.detail]});var e=Ae.get(a.currentTarget),t=e.items,n=e.dropFromOthersDisabled;if(n&&a.currentTarget!==Ce&&a.currentTarget!==Ue){ee(function(){return"drop is currently disabled"});return}var i=Sn(t),s=t.splice(i,1)[0];Ue=void 0;var r=a.detail,c=r.type,o=r.theOtherDz;if(c===mn.OUTSIDE_OF_ANY||c===mn.LEFT_FOR_ANOTHER&&o!==Ce&&Ae.get(o).dropFromOthersDisabled){ee(function(){return"dragged left all, putting shadow element back in the origin dz"}),Na=!0,Ue=Ce;var l=Ae.get(Ce).items;l.splice(Cn,0,s),St(Ce,l,{trigger:De.DRAGGED_LEFT_ALL,id:Ke[Ie],source:Se.POINTER})}St(a.currentTarget,t,{trigger:De.DRAGGED_LEFT,id:Ke[Ie],source:Se.POINTER})}}function wo(a){ee(function(){return["dragged is over index",a.currentTarget,a.detail]});var e=Ae.get(a.currentTarget),t=e.items,n=e.dropFromOthersDisabled;if(n&&a.currentTarget!==Ce){ee(function(){return"drop is currently disabled"});return}Na=!1;var i=a.detail.indexObj.index,s=Sn(t);t.splice(s,1),t.splice(i,0,oa),St(a.currentTarget,t,{trigger:De.DRAGGED_OVER_INDEX,id:Ke[Ie],source:Se.POINTER})}function bn(a){a.preventDefault();var e=a.touches?a.touches[0]:a;Ze={x:e.clientX,y:e.clientY},He.style.transform="translate3d(".concat(Ze.x-At.x,"px, ").concat(Ze.y-At.y,"px, 0)")}function ca(){ee(function(){return"dropped"}),Vi=!0,window.removeEventListener("mousemove",bn),window.removeEventListener("touchmove",bn),window.removeEventListener("mouseup",ca),window.removeEventListener("touchend",ca),Ru(),Du(He),Ue||(ee(function(){return"element was dropped right after it left origin but before entering somewhere else"}),Ue=Ce),ee(function(){return["dropped in dz",Ue]});var a=Ae.get(Ue),e=a.items,t=a.type;pn(dt.get(t),function(s){return Ae.get(s).dropTargetStyle},function(s){return Ae.get(s).dropTargetClasses});var n=Sn(e);n===-1&&(n=Cn),e=e.map(function(s){return s[Tn]?Ke:s});function i(){Ki(),ra(Ue,e,{trigger:Na?De.DROPPED_OUTSIDE_OF_ANY:De.DROPPED_INTO_ZONE,id:Ke[Ie],source:Se.POINTER}),Ue!==Ce&&ra(Ce,Ae.get(Ce).items,{trigger:De.DROPPED_INTO_ANOTHER,id:Ke[Ie],source:Se.POINTER}),Pu(Ue.children[n]),$u()}Fu(n,i)}function Fu(a,e){var t=co(Ue.children[a]),n={x:t.left-parseFloat(He.style.left),y:t.top-parseFloat(He.style.top)},i=Ae.get(Ue),s=i.dropAnimationDurationMs,r="transform ".concat(s,"ms ease");He.style.transition=He.style.transition?He.style.transition+","+r:r,He.style.transform="translate3d(".concat(n.x,"px, ").concat(n.y,"px, 0)"),window.setTimeout(e,s)}function zu(a,e){Ma.push({dz:a,destroy:e}),window.requestAnimationFrame(function(){vo(a),document.body.appendChild(a)})}function $u(){He.remove(),ft.remove(),Ma.length&&(ee(function(){return["will destroy zones that were removed during drag",Ma]}),Ma.forEach(function(a){var e=a.dz,t=a.destroy;t(),e.remove()}),Ma=[]),He=void 0,ft=void 0,Ke=void 0,An=void 0,Ce=void 0,Cn=void 0,oa=void 0,Ue=void 0,At=void 0,Ze=void 0,Ft=!1,Vi=!1,Ki=void 0,Na=!1}function ju(a,e){var t=!1,n={items:void 0,type:void 0,flipDurationMs:0,dragDisabled:!1,morphDisabled:!1,dropFromOthersDisabled:!1,dropTargetStyle:Qr,dropTargetClasses:[],transformDraggedElement:function(){},centreDraggedOnCursor:!1};ee(function(){return["dndzone good to go options: ".concat(vt(e),", config: ").concat(vt(n)),{node:a}]});var i=new Map;function s(){window.addEventListener("mousemove",o,{passive:!1}),window.addEventListener("touchmove",o,{passive:!1,capture:!1}),window.addEventListener("mouseup",c,{passive:!1}),window.addEventListener("touchend",c,{passive:!1})}function r(){window.removeEventListener("mousemove",o),window.removeEventListener("touchmove",o),window.removeEventListener("mouseup",c),window.removeEventListener("touchend",c)}function c(){r(),ft=void 0,At=void 0,Ze=void 0}function o(m){m.preventDefault();var h=m.touches?m.touches[0]:m;Ze={x:h.clientX,y:h.clientY},(Math.abs(Ze.x-At.x)>=Zr||Math.abs(Ze.y-At.y)>=Zr)&&(r(),d())}function l(m){if(m.target!==m.currentTarget&&(m.target.value!==void 0||m.target.isContentEditable)){ee(function(){return"won't initiate drag on a nested input element"});return}if(m.button){ee(function(){return"ignoring none left click button: ".concat(m.button)});return}if(Ft){ee(function(){return"cannot start a new drag before finalizing previous one"});return}m.stopPropagation();var h=m.touches?m.touches[0]:m;At={x:h.clientX,y:h.clientY},Ze=Rt({},At),ft=m.currentTarget,s()}function d(){ee(function(){return["drag start config: ".concat(vt(n)),ft]}),Ft=!0;var m=i.get(ft);Cn=m,Ce=ft.parentElement;var h=Ce.getRootNode(),b=h.body||h,f=n.items,k=n.type,C=n.centreDraggedOnCursor;Ke=Rt({},f[m]),An=k,oa=Rt(Rt({},Ke),{},Ia({},Tn,!0));var w=Rt(Rt({},oa),{},Ia({},Ie,xt));He=xu(ft,C&&Ze);function W(){He.parentElement?window.requestAnimationFrame(W):(b.appendChild(He),He.focus(),Lu(),vo(ft),b.appendChild(ft))}window.requestAnimationFrame(W),un(Array.from(dt.get(n.type)).filter(function(E){return E===Ce||!Ae.get(E).dropFromOthersDisabled}),function(E){return Ae.get(E).dropTargetStyle},function(E){return Ae.get(E).dropTargetClasses}),f.splice(m,1,w),Ki=Ou(Ce),St(Ce,f,{trigger:De.DRAG_STARTED,id:Ke[Ie],source:Se.POINTER}),window.addEventListener("mousemove",bn,{passive:!1}),window.addEventListener("touchmove",bn,{passive:!1,capture:!1}),window.addEventListener("mouseup",ca,{passive:!1}),window.addEventListener("touchend",ca,{passive:!1})}function u(m){var h=m.items,b=h===void 0?void 0:h,f=m.flipDurationMs,k=f===void 0?0:f,C=m.type,w=C===void 0?Wu:C,W=m.dragDisabled,E=W===void 0?!1:W,y=m.morphDisabled,g=y===void 0?!1:y,p=m.dropFromOthersDisabled,v=p===void 0?!1:p,M=m.dropTargetStyle,N=M===void 0?Qr:M,T=m.dropTargetClasses,P=T===void 0?[]:T,L=m.transformDraggedElement,G=L===void 0?function(){}:L,B=m.centreDraggedOnCursor,te=B===void 0?!1:B;n.dropAnimationDurationMs=k,n.type&&w!==n.type&&eo(a,n.type),n.type=w,Hu(a,w),n.items=sa(b),n.dragDisabled=E,n.morphDisabled=g,n.transformDraggedElement=G,n.centreDraggedOnCursor=te,t&&Ft&&!Vi&&(!mu(N,n.dropTargetStyle)||!gu(P,n.dropTargetClasses))&&(pn([a],function(){return n.dropTargetStyle},function(){return P}),un([a],function(){return N},function(){return P})),n.dropTargetStyle=N,n.dropTargetClasses=sa(P);function F(pe,we){return Ae.get(pe)?Ae.get(pe)[we]:n[we]}t&&Ft&&n.dropFromOthersDisabled!==v&&(v?pn([a],function(pe){return F(pe,"dropTargetStyle")},function(pe){return F(pe,"dropTargetClasses")}):un([a],function(pe){return F(pe,"dropTargetStyle")},function(pe){return F(pe,"dropTargetClasses")})),n.dropFromOthersDisabled=v,Ae.set(a,n);for(var fe=Sn(n.items),oe=0;oe".concat(e,"

"),t.style.display="none",t.style.position="fixed",t.style.zIndex="-5",t}function ia(a){if(!ji){Te||Li(),Te.innerHTML="";var e=document.createTextNode(a);Te.appendChild(e),Te.style.display="none",Te.style.display="inline"}}var Ku="--any--",to={outline:"rgba(255, 255, 102, 0.7) solid 2px"},Qe=!1,Ri,Fe,$t="",Bt,ct,Ct="",kn=new WeakSet,ao=new WeakMap,no=new WeakMap,Bi=new Map,Ne=new Map,lt=new Map,vn;function Yu(a,e){ee(function(){return"registering drop-zone if absent"}),lt.size===0&&(ee(function(){return"adding global keydown and click handlers"}),vn=Gu(),window.addEventListener("keydown",Ao),window.addEventListener("click",Co)),lt.has(e)||lt.set(e,new Set),lt.get(e).has(a)||(lt.get(e).add(a),ro())}function io(a,e){ee(function(){return"unregistering drop-zone"}),Fe===a&&Oa(),lt.get(e).delete(a),oo(),lt.get(e).size===0&<.delete(e),lt.size===0&&(ee(function(){return"removing global keydown and click handlers"}),window.removeEventListener("keydown",Ao),window.removeEventListener("click",Co),vn=void 0,Uu())}function Ao(a){if(!!Qe)switch(a.key){case"Escape":{Oa();break}}}function Co(){!Qe||kn.has(document.activeElement)||(ee(function(){return"clicked outside of any draggable"}),Oa())}function Ju(a){if(ee(function(){return"zone focus"}),!!Qe){var e=a.currentTarget;if(e!==Fe){$t=e.getAttribute("aria-label")||"";var t=Ne.get(Fe),n=t.items,i=n.find(function(u){return u[Ie]===ct}),s=n.indexOf(i),r=n.splice(s,1)[0],c=Ne.get(e),o=c.items,l=c.autoAriaDisabled;e.getBoundingClientRect().top0&&arguments[0]!==void 0?arguments[0]:!0;ee(function(){return"drop"}),Ne.get(Fe).autoAriaDisabled||ia("Stopped dragging item ".concat(Ct)),kn.has(document.activeElement)&&document.activeElement.blur(),a&&St(Fe,Ne.get(Fe).items,{trigger:De.DRAG_STOPPED,id:ct,source:Se.KEYBOARD}),pn(lt.get(Ri),function(e){return Ne.get(e).dropTargetStyle},function(e){return Ne.get(e).dropTargetClasses}),Bt=null,ct=null,Ct="",Ri=null,Fe=null,$t="",Qe=!1,So()}function Xu(a,e){var t={items:void 0,type:void 0,dragDisabled:!1,zoneTabIndex:0,dropFromOthersDisabled:!1,dropTargetStyle:to,dropTargetClasses:[],autoAriaDisabled:!1};function n(d,u,m){d.length<=1||d.splice(m,1,d.splice(u,1,d[m])[0])}function i(d){switch(ee(function(){return["handling key down",d.key]}),d.key){case"Enter":case" ":{if((d.target.disabled!==void 0||d.target.href||d.target.isContentEditable)&&!kn.has(d.target))return;d.preventDefault(),d.stopPropagation(),Qe?Oa():s(d);break}case"ArrowDown":case"ArrowRight":{if(!Qe)return;d.preventDefault(),d.stopPropagation();var u=Ne.get(a),m=u.items,h=Array.from(a.children),b=h.indexOf(d.currentTarget);ee(function(){return["arrow down",b]}),b0&&(t.autoAriaDisabled||ia("Moved item ".concat(Ct," to position ").concat(w," in the list ").concat($t)),n(k,w,w-1),ra(a,k,{trigger:De.DROPPED_INTO_ZONE,id:ct,source:Se.KEYBOARD}));break}}}function s(d){ee(function(){return"drag start"}),c(d.currentTarget),Fe=a,Ri=t.type,Qe=!0;var u=Array.from(lt.get(t.type)).filter(function(h){return h===Fe||!Ne.get(h).dropFromOthersDisabled});if(un(u,function(h){return Ne.get(h).dropTargetStyle},function(h){return Ne.get(h).dropTargetClasses}),!t.autoAriaDisabled){var m="Started dragging item ".concat(Ct,". Use the arrow keys to move it within its list ").concat($t);u.length>1&&(m+=", or tab to another list in order to move the item into it"),ia(m)}St(a,Ne.get(a).items,{trigger:De.DRAG_STARTED,id:ct,source:Se.KEYBOARD}),So()}function r(d){!Qe||d.currentTarget!==Bt&&(d.stopPropagation(),Oa(!1),s(d))}function c(d){var u=Ne.get(a),m=u.items,h=Array.from(a.children),b=h.indexOf(d);Bt=d,Bt.tabIndex=0,ct=m[b][Ie],Ct=h[b].getAttribute("aria-label")||""}function o(d){var u=d.items,m=u===void 0?[]:u,h=d.type,b=h===void 0?Ku:h,f=d.dragDisabled,k=f===void 0?!1:f,C=d.zoneTabIndex,w=C===void 0?0:C,W=d.dropFromOthersDisabled,E=W===void 0?!1:W,y=d.dropTargetStyle,g=y===void 0?to:y,p=d.dropTargetClasses,v=p===void 0?[]:p,M=d.autoAriaDisabled,N=M===void 0?!1:M;t.items=sa(m),t.dragDisabled=k,t.dropFromOthersDisabled=E,t.zoneTabIndex=w,t.dropTargetStyle=g,t.dropTargetClasses=v,t.autoAriaDisabled=N,t.type&&b!==t.type&&io(a,t.type),t.type=b,Yu(a,b),N||(a.setAttribute("aria-disabled",k),a.setAttribute("role","list"),a.setAttribute("aria-describedby",k?vn.DND_ZONE_DRAG_DISABLED:vn.DND_ZONE_ACTIVE)),Ne.set(a,t),Qe?a.tabIndex=a===Fe||Bt.contains(a)||t.dropFromOthersDisabled||Fe&&t.type!==Ne.get(Fe).type?-1:0:a.tabIndex=t.zoneTabIndex,a.addEventListener("focus",Ju);for(var T=function(G){var B=a.children[G];kn.add(B),B.tabIndex=Qe?-1:0,N||B.setAttribute("role","listitem"),B.removeEventListener("keydown",ao.get(B)),B.removeEventListener("click",no.get(B)),k||(B.addEventListener("keydown",i),ao.set(B,i),B.addEventListener("click",r),no.set(B,r)),Qe&&t.items[G][Ie]===ct&&(ee(function(){return["focusing on",{i:G,focusedItemId:ct}]}),Bt=B,Bt.tabIndex=0,B.focus())},P=0;P0&&console.warn("dndzone will ignore unknown options",h),!e)throw new Error("no 'items' key provided to dndzone");var b=e.find(function(f){return!{}.hasOwnProperty.call(f,Ie)});if(b)throw new Error("missing '".concat(Ie,"' property for item ").concat(vt(b)));if(l&&!Array.isArray(l))throw new Error("dropTargetClasses should be an array but instead it is a ".concat(hn(l),", ").concat(vt(l)));if(c&&!Qu(c))throw new Error("zoneTabIndex should be a number but instead it is a ".concat(hn(c),", ").concat(vt(c)))}function Qu(a){return!isNaN(a)&&function(e){return(e|0)===e}(parseFloat(a))}var da=require("obsidian");function eh(a){K(a,"svelte-r3p86y",".property-block-container.svelte-r3p86y{display:flex;justify-content:space-between;align-items:center}.info.svelte-r3p86y{display:flex;flex-flow:column}.context.svelte-r3p86y{display:flex;align-items:center;gap:0.25rem;color:var(--text-muted)}.context-item.svelte-r3p86y{display:flex;align-items:center}")}function xo(a){let e,t,n=a[0].size+"",i,s;return{c(){e=A("span"),t=de("(H"),i=de(n),s=de(")")},m(r,c){x(r,e,c),D(e,t),D(e,i),D(e,s)},p(r,c){c&1&&n!==(n=r[0].size+"")&&ve(i,n)},d(r){r&&S(e)}}}function Do(a){let e,t,n=a[0].headers.join(" | ")+"",i,s;return{c(){e=A("strong"),t=de("("),i=de(n),s=de(")")},m(r,c){x(r,e,c),D(e,t),D(e,i),D(e,s)},p(r,c){c&1&&n!==(n=r[0].headers.join(" | ")+"")&&ve(i,n)},d(r){r&&S(e)}}}function Eo(a){let e,t,n,i;return{c(){e=A("div"),_(e,"class","context-item heading svelte-r3p86y"),_(e,"aria-label","Has Heading")},m(s,r){x(s,e,r),n||(i=ae(t=a[5].call(null,e)),n=!0)},d(s){s&&S(e),n=!1,i()}}}function Mo(a){let e,t,n,i;return{c(){e=A("div"),_(e,"class","context-item conditioned svelte-r3p86y"),_(e,"aria-label","Conditioned")},m(s,r){x(s,e,r),n||(i=ae(t=a[2].call(null,e)),n=!0)},d(s){s&&S(e),n=!1,i()}}}function Io(a){let e,t,n,i;return{c(){e=A("div"),_(e,"class","context-item callback svelte-r3p86y"),_(e,"aria-label","Has Callback")},m(s,r){x(s,e,r),n||(i=ae(t=a[6].call(null,e)),n=!0)},d(s){s&&S(e),n=!1,i()}}}function Po(a){let e,t,n,i;return{c(){e=A("div"),_(e,"class","context-item dice svelte-r3p86y"),_(e,"aria-label","Will Parse for Dice Rolls")},m(s,r){x(s,e,r),n||(i=ae(t=a[3].call(null,e)),n=!0)},d(s){s&&S(e),n=!1,i()}}}function Oo(a){let e,t,n,i;return{c(){e=A("div"),_(e,"class","context-item dice svelte-r3p86y"),_(e,"aria-label","Render markdown enabled")},m(s,r){x(s,e,r),n||(i=ae(t=a[4].call(null,e)),n=!0)},d(s){s&&S(e),n=!1,i()}}}function th(a){let e,t,n,i,s=a[1](a[0].type)+"",r,c,o,l,d,u,m=a[0].properties.join(", ")+"",h,b,f,k,C,w,W,E=a[0].type=="heading"&&xo(a),y=a[0].type=="table"&&a[0].headers?.length&&Do(a),g="heading"in a[0]&&Eo(a),p=a[0].conditioned&&Mo(a),v="callback"in a[0]&&Io(a),M="dice"in a[0]&&a[0].dice&&Po(a),N="markdown"in a[0]&&a[0].markdown&&Oo(a);return{c(){e=A("div"),t=A("div"),n=A("div"),i=A("span"),r=de(s),c=R(),E&&E.c(),o=R(),y&&y.c(),l=R(),d=A("small"),u=A("em"),h=de(m),b=R(),f=A("small"),g&&g.c(),k=R(),p&&p.c(),C=R(),v&&v.c(),w=R(),M&&M.c(),W=R(),N&&N.c(),_(t,"class","info svelte-r3p86y"),_(f,"class","context svelte-r3p86y"),_(e,"class","property-block-container svelte-r3p86y")},m(T,P){x(T,e,P),D(e,t),D(t,n),D(n,i),D(i,r),D(n,c),E&&E.m(n,null),D(n,o),y&&y.m(n,null),D(t,l),D(t,d),D(d,u),D(u,h),D(e,b),D(e,f),g&&g.m(f,null),D(f,k),p&&p.m(f,null),D(f,C),v&&v.m(f,null),D(f,w),M&&M.m(f,null),D(f,W),N&&N.m(f,null)},p(T,[P]){P&1&&s!==(s=T[1](T[0].type)+"")&&ve(r,s),T[0].type=="heading"?E?E.p(T,P):(E=xo(T),E.c(),E.m(n,o)):E&&(E.d(1),E=null),T[0].type=="table"&&T[0].headers?.length?y?y.p(T,P):(y=Do(T),y.c(),y.m(n,null)):y&&(y.d(1),y=null),P&1&&m!==(m=T[0].properties.join(", ")+"")&&ve(h,m),"heading"in T[0]?g||(g=Eo(T),g.c(),g.m(f,k)):g&&(g.d(1),g=null),T[0].conditioned?p||(p=Mo(T),p.c(),p.m(f,C)):p&&(p.d(1),p=null),"callback"in T[0]?v||(v=Io(T),v.c(),v.m(f,w)):v&&(v.d(1),v=null),"dice"in T[0]&&T[0].dice?M||(M=Po(T),M.c(),M.m(f,W)):M&&(M.d(1),M=null),"markdown"in T[0]&&T[0].markdown?N||(N=Oo(T),N.c(),N.m(f,null)):N&&(N.d(1),N=null)},i:H,o:H,d(T){T&&S(e),E&&E.d(),y&&y.d(),g&&g.d(),p&&p.d(),v&&v.d(),M&&M.d(),N&&N.d()}}}function ah(a,e,t){let{block:n}=e;n.type=="heading"&&!n.size&&(n.size=1);let i=d=>"display"in n?`${n.display} (${d[0].toUpperCase()+d.slice(1).toLowerCase()})`:d[0].toUpperCase()+d.slice(1).toLowerCase(),s=d=>{(0,da.setIcon)(d,"statblock-conditioned")},r=d=>{(0,da.setIcon)(d,"dice-roller-dice")},c=d=>{(0,da.setIcon)(d,"markdown-icon")},o=d=>{(0,da.setIcon)(d,"heading-glyph")},l=d=>{(0,da.setIcon)(d,"code-glyph")};return a.$$set=d=>{"block"in d&&t(0,n=d.block)},[n,i,s,r,c,o,l]}var Yi=class extends q{constructor(e){super(),U(this,e,ah,th,j,{block:0},eh)}},Wo=Yi;var Qi=require("obsidian");var $o=_a(xa()),le=require("obsidian");var xn=require("obsidian");function nh(a){K(a,"svelte-1blh0v3",".creator-zone.svelte-1blh0v3{display:flex;justify-content:space-evenly;gap:1rem;flex-flow:row wrap}.header-container.svelte-1blh0v3{display:flex;align-items:center}")}function No(a,e,t){let n=a.slice();return n[12]=e[t],n}function Ho(a,e){let t,n,i=e[12].name+"",s,r,c,o,l,d,u=H,m,h;function b(){return e[8](e[12])}return{key:a,first:null,c(){t=A("div"),n=A("span"),s=de(i),r=R(),c=A("div"),l=R(),_(n,"class","table-header"),_(t,"class","header-container svelte-1blh0v3"),this.first=t},m(f,k){x(f,t,k),D(t,n),D(n,s),D(t,r),D(t,c),D(t,l),m||(h=[ae(o=e[5].call(null,c)),ue(c,"click",b)],m=!0)},p(f,k){e=f,k&1&&i!==(i=e[12].name+"")&&ve(s,i)},r(){d=t.getBoundingClientRect()},f(){en(t),u()},a(){u(),u=Qa(t,d,ln,{duration:Ji})},d(f){f&&S(t),m=!1,me(h)}}}function ih(a){let e,t,n=[],i=new Map,s,r,c,o=a[0].filter(a[7]),l=d=>d[12].id;for(let d=0;d({name:f,id:z()})),r=!1;function c(f){let{items:k,info:{source:C,trigger:w}}=f.detail;t(0,s=[...k])}function o(f){let{items:k,info:{source:C}}=f.detail;t(0,s=[...k]),n("sorted",s)}let l=f=>{(0,xn.setIcon)(f,"dropzone-grip")};function d(f){f.preventDefault(),t(1,r=!1)}let u=f=>{t(0,s=s.filter(k=>k.id!=f.id)),n("sorted",s)},m=f=>{new xn.ExtraButtonComponent(f).setIcon("cross-in-box")},h=f=>f.id!==xt,b=f=>u(f);return a.$$set=f=>{"headers"in f&&t(6,i=f.headers)},[s,r,c,o,u,m,i,h,b]}var Xi=class extends q{constructor(e){super(),U(this,e,sh,ih,j,{headers:6},nh)}},Lo=Xi;var ua=require("obsidian");function rh(a){K(a,"svelte-mn2hp8",".setting-item.svelte-mn2hp8{align-items:center}.icon.svelte-mn2hp8{display:flex;align-items:center}")}function Ro(a,e,t){let n=a.slice();return n[19]=e[t],n[20]=e,n[21]=t,n}function oh(a){let e,t=a[19].prop+"",n;return{c(){e=A("div"),n=de(t),_(e,"class","setting-item-name")},m(i,s){x(i,e,s),D(e,n)},p(i,s){s&4&&t!==(t=i[19].prop+"")&&ve(n,t)},d(i){i&&S(e)}}}function ch(a){let e,t,n,i;function s(){a[14].call(e,a[20],a[21])}return{c(){e=A("input"),_(e,"type","text"),_(e,"placeholder",t=a[19].prop)},m(r,c){x(r,e,c),ei(e,a[19].prop),n||(i=ue(e,"input",s),n=!0)},p(r,c){a=r,c&4&&t!==(t=a[19].prop)&&_(e,"placeholder",t),c&4&&e.value!==a[19].prop&&ei(e,a[19].prop)},d(r){r&&S(e),n=!1,i()}}}function lh(a){let e,t,n,i;function s(){return a[16](a[19])}return{c(){e=A("div"),_(e,"class","edit")},m(r,c){x(r,e,c),n||(i=[ue(e,"click",s),ae(t=a[11].call(null,e))],n=!0)},p(r,c){a=r},d(r){r&&S(e),n=!1,me(i)}}}function dh(a){let e,t,n,i;function s(){return a[15](a[19])}return{c(){e=A("div"),_(e,"class","done")},m(r,c){x(r,e,c),n||(i=[ue(e,"click",s),ae(t=a[12].call(null,e))],n=!0)},p(r,c){a=r},d(r){r&&S(e),n=!1,me(i)}}}function Bo(a,e){let t,n,i,s,r,c,o,l,d,u,m,h,b,f;function k(p,v){return p[1]==p[19].id?ch:oh}let C=k(e,-1),w=C(e);function W(p,v){return p[1]==p[19].id?dh:lh}let E=W(e,-1),y=E(e);function g(){return e[17](e[19])}return{key:a,first:null,c(){t=A("div"),n=A("div"),r=R(),c=A("div"),w.c(),o=R(),l=A("div"),y.c(),d=R(),u=A("div"),h=R(),_(n,"class","icon svelte-mn2hp8"),_(n,"style",i=e[0]?"cursor: grab":"cursor: grabbing"),_(c,"class","setting-item-info"),_(u,"class","delete"),_(l,"class","setting-item-control"),_(t,"class","setting-item svelte-mn2hp8"),this.first=t},m(p,v){x(p,t,v),D(t,n),D(t,r),D(t,c),w.m(c,null),D(t,o),D(t,l),y.m(l,null),D(l,d),D(l,u),D(t,h),b||(f=[ae(s=e[5].call(null,n)),ue(n,"mousedown",e[6]),ue(n,"touchstart",e[6]),ue(u,"click",g),ae(m=e[8].call(null,u))],b=!0)},p(p,v){e=p,v&1&&i!==(i=e[0]?"cursor: grab":"cursor: grabbing")&&_(n,"style",i),C===(C=k(e,v))&&w?w.p(e,v):(w.d(1),w=C(e),w&&(w.c(),w.m(c,null))),E===(E=W(e,v))&&y?y.p(e,v):(y.d(1),y=E(e),y&&(y.c(),y.m(l,d)))},d(p){p&&S(t),w.d(),y.d(),b=!1,me(f)}}}function uh(a){let e,t=[],n=new Map,i,s,r,c=a[2],o=l=>l[19].id;for(let l=0;lM)),v===Se.POINTER&&t(0,r=!0)}let l=g=>{(0,ua.setIcon)(g,"dropzone-grip")};function d(g){g.preventDefault(),t(0,r=!1)}let u=g=>{t(2,n=n.filter(p=>p.id!=g.id)),s("sorted",n.map(({prop:p})=>p))},m=g=>{new ua.ExtraButtonComponent(g).setIcon("trash")},h,b=g=>{t(1,h=g.id)},f=g=>{t(2,n=n.map(p=>p.id==g.id?{id:g.id,prop:g.prop}:p)),t(1,h=null),s("sorted",n.map(({prop:p})=>p))},k=g=>{new ua.ExtraButtonComponent(g).setIcon("pencil")},C=g=>{new ua.ExtraButtonComponent(g).setIcon("check")};function w(g,p){g[p].prop=this.value,t(2,n),t(13,i)}let W=g=>f(g),E=g=>b(g),y=g=>u(g);return a.$$set=g=>{"properties"in g&&t(13,i=g.properties)},a.$$.update=()=>{if(a.$$.dirty&8192){e:t(2,n=[...i])}},[r,h,n,c,o,l,d,u,m,b,f,k,C,i,w,W,E,y]}var Zi=class extends q{constructor(e){super(),U(this,e,hh,uh,j,{properties:13},rh)}},zo=Zi;var ha=class extends le.Modal{constructor(t,n){super(t.app);this.plugin=t;this.advanced=this.plugin.settings.showAdvanced,n&&(this.block=(0,$o.default)(n)),this.containerEl.addClass("statblock-edit-block")}get group(){return["group","inline"].contains(this.block.type)}onOpen(){this.titleEl.setText("Edit Block"),this.display()}buildProperties(t){if(t.empty(),!this.group){if(this.block.type=="subheading"){let n=t.createDiv("statblock-additional-container"),i="";new le.Setting(n).setHeading().setName("Link Monster Properties").addText(c=>c.setPlaceholder("property").setValue(i).onChange(o=>i=o)).addExtraButton(c=>c.setIcon("plus-with-circle").onClick(()=>{if(!i||!i.length){new le.Notice("A valid property must be supplied.");return}this.block.properties.push(i),this.buildProperties(t)}));let s=n.createDiv("additional");new zo({target:s,props:{properties:this.block.properties.map(c=>({prop:c,id:z()}))}}).$on("sorted",c=>{this.block.properties=[...c.detail]})}else new le.Setting(t).setName("Link Monster Property").addText(n=>n.setValue(this.block.properties[0]).onChange(i=>{this.block.properties[0]=i}));if((this.block.type=="property"||this.block.type=="saves")&&new le.Setting(this.contentEl).setName("Display Text").setDesc("This text will be used for the property name.").addText(n=>{n.setValue(this.block.display).onChange(i=>this.block.display=i)}),(this.block.type=="traits"||this.block.type=="text")&&(new le.Setting(this.contentEl).setName("Use Monster Property for Heading").setDesc("The Section heading will be set to the value of the specified property.").addToggle(n=>{n.setValue(this.block.headingProp).onChange(i=>{this.block.headingProp=i,this.display()})}),new le.Setting(this.contentEl).setName("Section Heading").setDesc(this.block.headingProp?"The section will use this property for the section heading. If the property does not exist or is blank, the section heading will not appear.":"This text will be used for the section heading. Can be left blank.").addText(n=>{n.setValue(this.block.heading).onChange(i=>this.block.heading=i)})),this.block.type=="table"){let n=t.createDiv("statblock-additional-container"),i="";new le.Setting(n).setHeading().setName("Table Headers").addText(r=>r.setPlaceholder("header").setValue(i).onChange(c=>i=c)).addExtraButton(r=>r.setIcon("plus-with-circle").onClick(()=>{if(!i||!i.length){new le.Notice("A valid property must be supplied.");return}this.block.headers.push(i),this.buildProperties(t)}));let s=n.createDiv("additional");new Lo({target:s,props:{headers:this.block.headers}}).$on("sorted",r=>{this.block.headers=[...r.detail?.map(c=>c.name)??[]]}),new le.Setting(t).setName("Calculate Modifiers").setDesc("The block will not attempt to calculate modifiers for table values.").addToggle(r=>{r.setValue(this.block.calculate).onChange(c=>{this.block.calculate=c})})}if(this.block.type=="heading"&&new le.Setting(this.contentEl).setName("Header Size").setDesc("The heading will use this size.").addDropdown(n=>{this.block.size||this.block.size==1,n.addOptions({1:"H1",2:"H2",3:"H3",4:"H4",5:"H5",6:"H6"}).setValue(`${this.block.size}`).onChange(i=>this.block.size=Number(i))}),!this.advanced)return;Ur.includes(this.block.type)&&new le.Setting(t).setName("Render as Markdown").setDesc(createFragment(n=>{n.createSpan({text:"The block will attempt to render as markdown."})})).addToggle(n=>{n.setValue(this.block.markdown).onChange(i=>{this.block.markdown=i})}),this.block.type=="text"&&(new le.Setting(t).setHeading().setName("Text to Show").setDesc(createFragment(n=>{n.createSpan({text:"The block will "}),n.createEl("strong",{text:"always"}),n.createSpan({text:" display the text entered here."})})),new le.TextAreaComponent(t).setValue(this.block.text).onChange(n=>{this.block.text=n})),this.block.type=="property"&&(new le.Setting(t).setHeading().setName("Callback").setDesc(createFragment(n=>{n.createSpan({text:"The block will run the callback and use the returned string as the property."}),n.createEl("br"),n.createSpan({text:"The callback will receive the "}),n.createEl("code",{text:"monster"}),n.createSpan({text:" parameter."})})),new le.TextAreaComponent(t).setValue(this.block.callback).onChange(n=>{this.block.callback=n})),this.block.type=="table"&&(new le.Setting(t).setHeading().setName("Ability Modifier Calculation").setDesc(createFragment(n=>{n.createSpan({text:"Allows a custom modifier for the stat."}),n.createEl("br"),n.createSpan({text:"Variable "}),n.createEl("code",{text:"stat"}),n.createSpan({text:"is accessible, use this to calculate the modifier."})})),new le.TextAreaComponent(t).setValue(this.block.modifier).onChange(n=>{this.block.modifier=n}))}}buildSeparator(t){t.empty(),this.block.type=="subheading"&&new le.Setting(t).setName("Separator").setDesc("Text separating properties").addText(n=>{this.block.type=="subheading"&&(this.block.separator||(this.block.separator=" "),n.setValue(this.block.separator).onChange(i=>{this.block.type=="subheading"&&(this.block.separator=i)}))})}buildConditions(t){t.empty(),new le.Setting(t).setName("Conditional").setDesc("The block will not be added if the associated properties are not present.").addToggle(n=>{n.setValue(this.block.conditioned).onChange(i=>{this.block.conditioned=i,this.buildConditions(t)})}),!this.block.conditioned&&!this.group&&new le.Setting(t).setName("Fallback").setDesc("If not present, this text will be displayed.").addText(n=>{this.block.fallback||(this.block.fallback="-"),n.setValue(this.block.fallback).onChange(i=>{this.block.fallback=i})}),new le.Setting(t).setName("Has Rule").setDesc("If present, the block will have a horizontal rule placed after it.").addToggle(n=>{n.setValue(this.block.hasRule).onChange(i=>this.block.hasRule=i)})}buildDice(t){t.empty(),!this.group&&this.plugin.canUseDiceRoller&&(new le.Setting(t).setName("Parse for Dice").setDesc("The plugin will attempt to add dice rollers as specified.").addToggle(n=>n.setValue(this.block.dice).onChange(i=>{this.block.dice=i,this.buildDice(t)})),this.block.dice&&new le.Setting(t.createDiv()).setName("Link Dice to Property").setDesc("The dice roller will parse this property instead of the original.").addText(n=>{n.setValue(this.block.diceProperty).onChange(i=>{this.block.diceProperty=i})})),this.advanced&&(new le.Setting(t).setHeading().setName("Dice Callback").setDesc(createFragment(n=>{n.createSpan({text:"The block will run the callback and use the returned values for the dice strings."}),n.createEl("br"),n.createSpan({text:"The callback will receive the "}),n.createEl("code",{text:"monster"}),n.createSpan({text:" and "}),n.createEl("code",{text:"property"}),n.createSpan({text:"parameters."})})),new le.TextAreaComponent(t).setValue(this.block.diceCallback).onChange(n=>{this.block.diceCallback=n}))}async display(){this.contentEl.empty(),new le.Setting(this.contentEl).setName("Show Advanced Options").addToggle(t=>{t.setValue(this.advanced??this.plugin.settings.showAdvanced).onChange(n=>{this.advanced=n,this.display()})}),this.buildProperties(this.contentEl.createDiv()),this.buildSeparator(this.contentEl.createDiv()),this.buildConditions(this.contentEl.createDiv()),this.buildDice(this.contentEl.createDiv()),this.buildButtons(this.contentEl.createDiv())}buildButtons(t){t.empty(),new le.Setting(t).addButton(n=>n.setCta().setIcon("checkmark").setTooltip("Save").onClick(()=>{this.saved=!0,this.close()})).addExtraButton(n=>n.setIcon("cross").setTooltip("Cancel").onClick(()=>{this.close()}))}buildProperty(t){}};function mh(a){K(a,"svelte-e4nza4",".statblock-creator-container.svelte-e4nza4.svelte-e4nza4{display:flex;justify-content:space-between;width:100%;height:100%}body:not(.is-mobile) .statblock-creator-container.svelte-e4nza4:not(:hover)>.icons.svelte-e4nza4{visibility:hidden}.statblock-creator-block.svelte-e4nza4.svelte-e4nza4{width:100%}.icons.svelte-e4nza4.svelte-e4nza4{display:flex;justify-content:flex-end}.statblock-creator-container.svelte-e4nza4 .icons.svelte-e4nza4{align-items:center}.icon.svelte-e4nza4:not(:first-child) .clickable-icon{margin-left:0}")}function jo(a){let e,t,n;return t=new Wo({props:{block:a[0]}}),{c(){e=A("div"),X(t.$$.fragment),_(e,"class","statblock-creator-block svelte-e4nza4")},m(i,s){x(i,e,s),J(t,e,null),n=!0},p(i,s){let r={};s&1&&(r.block=i[0]),t.$set(r)},i(i){n||(I(t.$$.fragment,i),n=!0)},o(i){O(t.$$.fragment,i),n=!1},d(i){i&&S(e),Y(t)}}}function gh(a){let e,t=a[0],n,i,s,r,c,o,l,d,u,m,h=jo(a);return{c(){e=A("div"),h.c(),n=R(),i=A("div"),s=A("div"),c=R(),o=A("div"),_(s,"class","icon svelte-e4nza4"),_(o,"class","icon svelte-e4nza4"),_(i,"class","icons svelte-e4nza4"),_(e,"class","statblock-creator-container svelte-e4nza4")},m(b,f){x(b,e,f),h.m(e,null),D(e,n),D(e,i),D(i,s),D(i,c),D(i,o),d=!0,u||(m=[ae(r=a[1].call(null,s)),ae(l=a[2].call(null,o))],u=!0)},p(b,[f]){f&1&&j(t,t=b[0])?(ie(),O(h,1,1,H),se(),h=jo(b),h.c(),I(h,1),h.m(e,n)):h.p(b,f)},i(b){d||(I(h),d=!0)},o(b){O(h),d=!1},d(b){b&&S(e),h.d(b),u=!1,me(m)}}}function fh(a,e,t){let{block:n}=e,{plugin:i}=e,s=We(),r=()=>{let l=new ha(i,n);l.onClose=()=>{!l.saved||s("edited",l.block)},l.open()},c=l=>{new Qi.ExtraButtonComponent(l).setIcon("pencil").setTooltip("Edit Block").onClick(()=>{r()})},o=l=>{new Qi.ExtraButtonComponent(l).setIcon("trash").setTooltip("Delete Block").onClick(()=>s("trash",n))};return a.$$set=l=>{"block"in l&&t(0,n=l.block),"plugin"in l&&t(3,i=l.plugin)},[n,c,o,i]}var es=class extends q{constructor(e){super(),U(this,e,fh,gh,j,{block:0,plugin:3},mh)}},qo=es;var jt=require("obsidian");function ph(a){K(a,"svelte-fhevgs","body:not(.is-mobile) .creator-zone.svelte-fhevgs:not(.nested){max-width:75vw;max-height:65vh;overflow:auto}.inline.svelte-fhevgs{display:flex;justify-content:space-between}.block.svelte-fhevgs{display:flex;justify-content:flex-start;align-items:center}.item.svelte-fhevgs{display:flex;flex-flow:column;width:100%;padding:2px;margin:2px}.group.svelte-fhevgs{display:grid;grid-template-columns:1fr;border:2px dashed grey;min-height:2rem}.dropdown-icon.svelte-fhevgs{align-self:flex-start}.inline.svelte-fhevgs{display:inline-flex;width:100%;height:100%;min-width:2rem}.icon.svelte-fhevgs{display:flex}")}function Go(a,e,t){let n=a.slice();return n[20]=e[t],n[21]=e,n[22]=t,n}function bh(a){let e,t,n,i,s,r=a[20],c,o;function l(h){a[15](h,a[20])}function d(h){a[16](h)}let u={inline:a[20].type=="inline"};a[20].nested!==void 0&&(u.blocks=a[20].nested),a[1]!==void 0&&(u.plugin=a[1]),t=new Dn({props:u}),rt.push(()=>ci(t,"blocks",l)),rt.push(()=>ci(t,"plugin",d));let m=Uo(a);return{c(){e=A("div"),X(t.$$.fragment),s=R(),m.c(),c=re(),_(e,"class","item svelte-fhevgs"),Re(e,"group",a[20].type=="group"||a[20].type=="inline")},m(h,b){x(h,e,b),J(t,e,null),x(h,s,b),m.m(h,b),x(h,c,b),o=!0},p(h,b){a=h;let f={};b&9&&(f.inline=a[20].type=="inline"),!n&&b&9&&(n=!0,f.blocks=a[20].nested,si(()=>n=!1)),!i&&b&2&&(i=!0,f.plugin=a[1],si(()=>i=!1)),t.$set(f),(!o||b&9)&&Re(e,"group",a[20].type=="group"||a[20].type=="inline"),b&9&&j(r,r=a[20])?(m.d(1),m=Uo(a),m.c(),m.m(c.parentNode,c)):m.p(a,b)},i(h){o||(I(t.$$.fragment,h),o=!0)},o(h){O(t.$$.fragment,h),o=!1},d(h){h&&S(e),Y(t),h&&S(s),h&&S(c),m.d(h)}}}function kh(a){let e,t,n;return t=new qo({props:{plugin:a[1],block:a[20]}}),t.$on("trash",a[13]),t.$on("edited",a[14]),{c(){e=A("div"),X(t.$$.fragment),_(e,"class","item svelte-fhevgs")},m(i,s){x(i,e,s),J(t,e,null),n=!0},p(i,s){let r={};s&2&&(r.plugin=i[1]),s&9&&(r.block=i[20]),t.$set(r)},i(i){n||(I(t.$$.fragment,i),n=!0)},o(i){O(t.$$.fragment,i),n=!1},d(i){i&&S(e),Y(t)}}}function Uo(a){let e,t,n,i;return{c(){e=A("div"),_(e,"class","dropdown-icon svelte-fhevgs")},m(s,r){x(s,e,r),n||(i=ae(t=a[11].call(null,e,a[20])),n=!0)},p(s,r){a=s,t&&ze(t.update)&&r&9&&t.update.call(null,a[20])},d(s){s&&S(e),n=!1,i()}}}function Vo(a){let e,t,n;return t=new sn({}),{c(){e=A("div"),X(t.$$.fragment),_(e,"aria-label","Block Has Rule")},m(i,s){x(i,e,s),J(t,e,null),n=!0},i(i){n||(I(t.$$.fragment,i),n=!0)},o(i){O(t.$$.fragment,i),n=!1},d(i){i&&S(e),Y(t)}}}function Ko(a,e){let t,n,i,s,r,c,o,l,d,u,m,h,b=H,f,k,C,w=[kh,bh],W=[];function E(g,p){return g[20].type!="group"&&g[20].type!="inline"?0:1}l=E(e,-1),d=W[l]=w[l](e);let y=e[20].hasRule&&Vo(e);return{key:a,first:null,c(){t=A("div"),n=A("div"),i=A("div"),s=A("div"),o=R(),d.c(),u=R(),y&&y.c(),m=R(),_(s,"class","icon svelte-fhevgs"),_(s,"style",r=e[4]?"cursor: grab":"cursor: grabbing"),_(i,"class","block svelte-fhevgs"),_(n,"class","block-container"),this.first=t},m(g,p){x(g,t,p),D(t,n),D(n,i),D(i,s),D(i,o),W[l].m(i,null),D(n,u),y&&y.m(n,null),D(t,m),f=!0,k||(C=[ae(c=e[7].call(null,s)),ue(s,"mousedown",e[8]),ue(s,"touchstart",e[8])],k=!0)},p(g,p){e=g,(!f||p&16&&r!==(r=e[4]?"cursor: grab":"cursor: grabbing"))&&_(s,"style",r);let v=l;l=E(e,p),l===v?W[l].p(e,p):(ie(),O(W[v],1,1,()=>{W[v]=null}),se(),d=W[l],d?d.p(e,p):(d=W[l]=w[l](e),d.c()),I(d,1),d.m(i,null)),e[20].hasRule?y?p&9&&I(y,1):(y=Vo(e),y.c(),I(y,1),y.m(n,null)):y&&(ie(),O(y,1,1,()=>{y=null}),se())},r(){h=t.getBoundingClientRect()},f(){en(t),b()},a(){b(),b=Qa(t,h,ln,{duration:ts})},i(g){f||(I(d),I(y),f=!0)},o(g){O(d),O(y),f=!1},d(g){g&&S(t),W[l].d(),y&&y.d(),k=!1,me(C)}}}function vh(a){let e,t,n=[],i=new Map,s,r,c,o,l=a[0].filter(a[12]),d=u=>u[20].id;for(let u=0;u{(0,jt.setIcon)(g,"dropzone-grip")};function u(g){g.preventDefault(),t(4,c=!1)}let m=g=>{t(0,i=i.filter(p=>p.id!=g.id)),n("sorted",i)},h=g=>{let p=i.findIndex(v=>v.id==g.id);i.splice(p,1,g),t(0,i)},b=g=>{let p=new ha(r,g);p.onClose=()=>{!p.saved||h(p.block)},p.open()},f=async(g,p)=>{if(!("nested"in g))return;let v=new jt.Menu().setNoIcon();Da.forEach(M=>{v.addItem(N=>{N.setTitle(M[1]).onClick(()=>{let T=cn(M[0]);v.unload(),T&&(g.nested=[...g.nested,T],t(0,i),n("sorted",i))})})}),v.showAtMouseEvent(p)},k=(g,p)=>{new jt.ExtraButtonComponent(g).setIcon("vertical-three-dots"),g.onclick=v=>{new jt.Menu().addItem(M=>{M.setTitle("Add").setIcon("plus-with-circle").onClick(N=>{f(p,v)})}).addItem(M=>M.setTitle("Edit").setIcon("pencil").onClick(()=>{b(p)})).addItem(M=>M.setTitle("Delete").setIcon("trash").onClick(()=>m(p))).showAtMouseEvent(v)}},C=g=>g.id!==xt,w=g=>m(g.detail),W=g=>h(g.detail);function E(g,p){a.$$.not_equal(p.nested,g)&&(p.nested=g,t(0,i))}function y(g){r=g,t(1,r)}return a.$$set=g=>{"blocks"in g&&t(0,i=g.blocks),"inline"in g&&t(2,s=g.inline),"plugin"in g&&t(1,r=g.plugin)},[i,r,s,xt,c,o,l,d,u,m,h,k,C,w,W,E,y]}var Dn=class extends q{constructor(e){super(),U(this,e,yh,vh,j,{blocks:0,inline:2,plugin:1},ph)}},Yo=Dn;function _h(a){K(a,"svelte-fktbyg",".top.svelte-fktbyg{display:flex;align-items:center;justify-content:space-between}.name.svelte-fktbyg{display:flex;align-items:center}.name.svelte-fktbyg .buttons{display:flex;justify-content:flex-end;align-items:center}.bottom.svelte-fktbyg{display:flex;justify-content:flex-end;align-items:center;margin-top:0.5rem}")}function Jo(a){let e,t;return e=new Yo({props:{blocks:a[2],plugin:a[1]}}),e.$on("sorted",a[3]),{c(){X(e.$$.fragment)},m(n,i){J(e,n,i),t=!0},p(n,i){let s={};i&4&&(s.blocks=n[2]),i&2&&(s.plugin=n[1]),e.$set(s)},i(n){t||(I(e.$$.fragment,n),t=!0)},o(n){O(e.$$.fragment,n),t=!1},d(n){Y(e,n)}}}function wh(a){let e,t,n,i,s,r,c,o,l=a[0],d,u,m,h,b,f,k,C,w,W,E=Jo(a);return{c(){e=A("div"),t=A("div"),i=R(),s=A("div"),c=R(),o=A("div"),E.c(),d=R(),u=A("div"),m=A("div"),b=R(),f=A("div"),_(t,"class","name svelte-fktbyg"),_(s,"class","add"),_(e,"class","top svelte-fktbyg"),_(o,"class","creator-container"),_(m,"class","save"),_(f,"class","cancel"),_(u,"class","bottom svelte-fktbyg")},m(y,g){x(y,e,g),D(e,t),D(e,i),D(e,s),x(y,c,g),x(y,o,g),E.m(o,null),x(y,d,g),x(y,u,g),D(u,m),D(u,b),D(u,f),C=!0,w||(W=[ae(n=a[4].call(null,t)),ae(r=a[8].call(null,s)),ue(s,"click",a[9]),ae(h=a[5].call(null,m)),ae(k=a[6].call(null,f))],w=!0)},p(y,[g]){g&1&&j(l,l=y[0])?(ie(),O(E,1,1,H),se(),E=Jo(y),E.c(),I(E,1),E.m(o,null)):E.p(y,g)},i(y){C||(I(E),C=!0)},o(y){O(E),C=!1},d(y){y&&S(e),y&&S(c),y&&S(o),E.d(y),y&&S(d),y&&S(u),w=!1,me(W)}}}function Th(a,e,t){let n,{layout:i}=e,{plugin:s}=e,r=k=>[...k.map(C=>"nested"in C?[C.id,r(C.nested)].flat():[C.id]).flat()],c=We(),o=k=>{t(0,i.blocks=[...k.detail],i)},l=!1,d=k=>{if(k.empty(),l){let C=i.name;new et.TextComponent(k).setValue(C).onChange(W=>{C=W});let w=k.createDiv("buttons");new et.ExtraButtonComponent(w).setIcon("checkmark").setTooltip("Save").onClick(()=>{l=!1,t(0,i.name=C,i),d(k)}),new et.ExtraButtonComponent(w).setIcon("cross-in-box").setTooltip("Cancel").onClick(()=>{l=!1,d(k)})}else k.createEl("h3",{text:i.name}),new et.ExtraButtonComponent(k.createDiv("buttons")).setIcon("pencil").setTooltip("Edit Name").onClick(()=>{l=!0,d(k)})},u=k=>{new et.ButtonComponent(k).setIcon("checkmark").setCta().setTooltip("Save").onClick(()=>{c("saved")})},m=k=>{new et.ExtraButtonComponent(k).setIcon("cross").setTooltip("Cancel").onClick(()=>{c("cancel")})},h=async k=>{let C=new et.Menu().setNoIcon();Da.forEach(w=>{C.addItem(W=>{W.setTitle(w[1]).onClick(()=>{let E=cn(w[0]);C.unload(),E&&t(0,i.blocks=[...i.blocks,E],i)})})}),C.showAtMouseEvent(k)},b=k=>{new et.ExtraButtonComponent(k).setIcon("plus-with-circle").setTooltip("Add Block")},f=k=>h(k);return a.$$set=k=>{"layout"in k&&t(0,i=k.layout),"plugin"in k&&t(1,s=k.plugin)},a.$$.update=()=>{if(a.$$.dirty&1){e:t(2,n=i.blocks)}},[i,s,n,o,d,u,m,h,b,f]}var as=class extends q{constructor(e){super(),U(this,e,Th,wh,j,{layout:0,plugin:1},_h)}},Xo=as;var qt=require("obsidian");var En=require("obsidian");var Ye=require("obsidian");function Ah(a){K(a,"svelte-1m3i208",".top-level.svelte-1m3i208.svelte-1m3i208{display:flex;flex-flow:column nowrap}textarea.svelte-1m3i208.svelte-1m3i208{flex-grow:1;height:500px;max-height:50vh}.json.svelte-1m3i208.svelte-1m3i208{margin-bottom:1rem;display:flex;justify-content:flex-start;align-items:center}.json.svelte-1m3i208>div.svelte-1m3i208{border-radius:4px;margin:5px 0px}.active.svelte-1m3i208.svelte-1m3i208{background-color:var(--background-secondary-alt)}.buttons.svelte-1m3i208.svelte-1m3i208{margin-top:1rem;display:flex;justify-content:flex-end;align-items:center}")}function Zo(a){let e,t,n,i;return{c(){e=A("textarea"),e.value=t=a[6](),_(e,"class","svelte-1m3i208")},m(s,r){x(s,e,r),a[11](e),n||(i=ue(e,"blur",a[12]),n=!0)},p:H,d(s){s&&S(e),a[11](null),n=!1,i()}}}function Ch(a){let e,t,n,i,s,r,c,o,l,d,u,m=a[0],h,b,f,k,C,w,W,E,y,g=Zo(a);return{c(){e=A("div"),t=A("h2"),t.textContent="Edit Monster",n=R(),i=A("div"),s=A("div"),r=A("div"),o=R(),l=A("div"),u=R(),g.c(),h=R(),b=A("div"),f=A("div"),C=R(),w=A("div"),_(r,"class","svelte-1m3i208"),Re(r,"active",!a[0]),_(l,"class","svelte-1m3i208"),Re(l,"active",a[0]),_(s,"class","json svelte-1m3i208"),_(i,"class","top-level svelte-1m3i208"),_(b,"class","buttons svelte-1m3i208"),_(e,"class","edit-monster-modal")},m(p,v){x(p,e,v),D(e,t),D(e,n),D(e,i),D(i,s),D(s,r),D(s,o),D(s,l),D(i,u),g.m(i,null),D(e,h),D(e,b),D(b,f),D(b,C),D(b,w),E||(y=[ae(c=a[3].call(null,r)),ue(r,"click",a[9]),ae(d=a[2].call(null,l)),ue(l,"click",a[10]),ae(k=a[4].call(null,f)),ae(W=a[5].call(null,w))],E=!0)},p(p,[v]){v&1&&Re(r,"active",!p[0]),v&1&&Re(l,"active",p[0]),v&1&&j(m,m=p[0])?(g.d(1),g=Zo(p),g.c(),g.m(i,null)):g.p(p,v)},i:H,o:H,d(p){p&&S(e),g.d(p),E=!1,me(y)}}}function Sh(a,e,t){let n=We(),{monster:i={}}=e,s=!1,r,c=C=>{new Ye.ExtraButtonComponent(C).setIcon("code-glyph").setTooltip("JSON")},o=C=>{new Ye.ExtraButtonComponent(C).setIcon("lines-of-text").setTooltip("YAML")},l=C=>{new Ye.ButtonComponent(C).setIcon("checkmark").setTooltip("Save Changes").onClick(()=>{if(s)try{s?t(8,i=JSON.parse(r.value)):t(8,i=(0,Ye.parseYaml)(r.value))}catch(w){console.error(w),new Ye.Notice(`There was an error saving the creaturen + +${w.message}`);return}n("save",i)})},d=C=>{new Ye.ExtraButtonComponent(C).setIcon("cross").setTooltip("Cancel").onClick(()=>{n("cancel")})};function u(){return s?JSON.stringify(i,null,2):!i||!Object.keys(i??{})?.length?"":(0,Ye.stringifyYaml)(i).trim()}function m(){try{s?t(8,i=JSON.parse(r.value)):t(8,i=(0,Ye.parseYaml)(r.value))}catch(C){console.error(C)}}let h=()=>t(0,s=!1),b=()=>t(0,s=!0);function f(C){rt[C?"unshift":"push"](()=>{r=C,t(1,r)})}let k=()=>m();return a.$$set=C=>{"monster"in C&&t(8,i=C.monster)},[s,r,c,o,l,d,u,m,i,h,b,f,k]}var ns=class extends q{constructor(e){super(),U(this,e,Sh,Ch,j,{monster:8},Ah)}},Qo=ns;var ma=class extends En.Modal{constructor(t,n={}){super(t.app);this.plugin=t;this.monster=n}onOpen(){this._instance=new Qo({target:this.contentEl,props:{monster:this.monster}}),this._instance.$on("cancel",()=>{this.close()}),this._instance.$on("save",async({detail:t})=>{if(!t.name){new En.Notice("Creatures must be given a name.");return}await this.plugin.updateMonster(this.monster,t),this.close()})}onClose(){}close(){this._instance&&this._instance.$destroy(),super.close()}};var Mn=class extends qt.Modal{constructor(t,n){super(t.app);this.plugin=t;this.monster=n}async display(){qt.Platform.isMobile||(this.contentEl.style.maxWidth="85vw"),new Tt({container:this.contentEl,monster:this.monster,plugin:this.plugin})}onOpen(){this.display()}};var ws=_a(xa());function Ha(a){let e=new Blob([a],{type:"text/javascript"}),t=URL.createObjectURL(e),n=new Worker(t);return URL.revokeObjectURL(t),n}function is(){return Ha('var yn=Object.create;var At=Object.defineProperty;var Rn=Object.getOwnPropertyDescriptor;var Cn=Object.getOwnPropertyNames;var En=Object.getPrototypeOf,_n=Object.prototype.hasOwnProperty;var Ne=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var An=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Cn(e))!_n.call(t,i)&&i!==n&&At(t,i,{get:()=>e[i],enumerable:!(r=Rn(e,i))||r.enumerable});return t};var Tn=(t,e,n)=>(n=t!=null?yn(En(t)):{},An(e||!t||!t.__esModule?At(n,"default",{value:t,enumerable:!0}):n,t));var bt=Ne(Tt=>{Tt.entityMap={lt:"<",gt:">",amp:"&",quot:\'"\',apos:"\'",Agrave:"\\xC0",Aacute:"\\xC1",Acirc:"\\xC2",Atilde:"\\xC3",Auml:"\\xC4",Aring:"\\xC5",AElig:"\\xC6",Ccedil:"\\xC7",Egrave:"\\xC8",Eacute:"\\xC9",Ecirc:"\\xCA",Euml:"\\xCB",Igrave:"\\xCC",Iacute:"\\xCD",Icirc:"\\xCE",Iuml:"\\xCF",ETH:"\\xD0",Ntilde:"\\xD1",Ograve:"\\xD2",Oacute:"\\xD3",Ocirc:"\\xD4",Otilde:"\\xD5",Ouml:"\\xD6",Oslash:"\\xD8",Ugrave:"\\xD9",Uacute:"\\xDA",Ucirc:"\\xDB",Uuml:"\\xDC",Yacute:"\\xDD",THORN:"\\xDE",szlig:"\\xDF",agrave:"\\xE0",aacute:"\\xE1",acirc:"\\xE2",atilde:"\\xE3",auml:"\\xE4",aring:"\\xE5",aelig:"\\xE6",ccedil:"\\xE7",egrave:"\\xE8",eacute:"\\xE9",ecirc:"\\xEA",euml:"\\xEB",igrave:"\\xEC",iacute:"\\xED",icirc:"\\xEE",iuml:"\\xEF",eth:"\\xF0",ntilde:"\\xF1",ograve:"\\xF2",oacute:"\\xF3",ocirc:"\\xF4",otilde:"\\xF5",ouml:"\\xF6",oslash:"\\xF8",ugrave:"\\xF9",uacute:"\\xFA",ucirc:"\\xFB",uuml:"\\xFC",yacute:"\\xFD",thorn:"\\xFE",yuml:"\\xFF",nbsp:"\\xA0",iexcl:"\\xA1",cent:"\\xA2",pound:"\\xA3",curren:"\\xA4",yen:"\\xA5",brvbar:"\\xA6",sect:"\\xA7",uml:"\\xA8",copy:"\\xA9",ordf:"\\xAA",laquo:"\\xAB",not:"\\xAC",shy:"\\xAD\\xAD",reg:"\\xAE",macr:"\\xAF",deg:"\\xB0",plusmn:"\\xB1",sup2:"\\xB2",sup3:"\\xB3",acute:"\\xB4",micro:"\\xB5",para:"\\xB6",middot:"\\xB7",cedil:"\\xB8",sup1:"\\xB9",ordm:"\\xBA",raquo:"\\xBB",frac14:"\\xBC",frac12:"\\xBD",frac34:"\\xBE",iquest:"\\xBF",times:"\\xD7",divide:"\\xF7",forall:"\\u2200",part:"\\u2202",exist:"\\u2203",empty:"\\u2205",nabla:"\\u2207",isin:"\\u2208",notin:"\\u2209",ni:"\\u220B",prod:"\\u220F",sum:"\\u2211",minus:"\\u2212",lowast:"\\u2217",radic:"\\u221A",prop:"\\u221D",infin:"\\u221E",ang:"\\u2220",and:"\\u2227",or:"\\u2228",cap:"\\u2229",cup:"\\u222A",int:"\\u222B",there4:"\\u2234",sim:"\\u223C",cong:"\\u2245",asymp:"\\u2248",ne:"\\u2260",equiv:"\\u2261",le:"\\u2264",ge:"\\u2265",sub:"\\u2282",sup:"\\u2283",nsub:"\\u2284",sube:"\\u2286",supe:"\\u2287",oplus:"\\u2295",otimes:"\\u2297",perp:"\\u22A5",sdot:"\\u22C5",Alpha:"\\u0391",Beta:"\\u0392",Gamma:"\\u0393",Delta:"\\u0394",Epsilon:"\\u0395",Zeta:"\\u0396",Eta:"\\u0397",Theta:"\\u0398",Iota:"\\u0399",Kappa:"\\u039A",Lambda:"\\u039B",Mu:"\\u039C",Nu:"\\u039D",Xi:"\\u039E",Omicron:"\\u039F",Pi:"\\u03A0",Rho:"\\u03A1",Sigma:"\\u03A3",Tau:"\\u03A4",Upsilon:"\\u03A5",Phi:"\\u03A6",Chi:"\\u03A7",Psi:"\\u03A8",Omega:"\\u03A9",alpha:"\\u03B1",beta:"\\u03B2",gamma:"\\u03B3",delta:"\\u03B4",epsilon:"\\u03B5",zeta:"\\u03B6",eta:"\\u03B7",theta:"\\u03B8",iota:"\\u03B9",kappa:"\\u03BA",lambda:"\\u03BB",mu:"\\u03BC",nu:"\\u03BD",xi:"\\u03BE",omicron:"\\u03BF",pi:"\\u03C0",rho:"\\u03C1",sigmaf:"\\u03C2",sigma:"\\u03C3",tau:"\\u03C4",upsilon:"\\u03C5",phi:"\\u03C6",chi:"\\u03C7",psi:"\\u03C8",omega:"\\u03C9",thetasym:"\\u03D1",upsih:"\\u03D2",piv:"\\u03D6",OElig:"\\u0152",oelig:"\\u0153",Scaron:"\\u0160",scaron:"\\u0161",Yuml:"\\u0178",fnof:"\\u0192",circ:"\\u02C6",tilde:"\\u02DC",ensp:"\\u2002",emsp:"\\u2003",thinsp:"\\u2009",zwnj:"\\u200C",zwj:"\\u200D",lrm:"\\u200E",rlm:"\\u200F",ndash:"\\u2013",mdash:"\\u2014",lsquo:"\\u2018",rsquo:"\\u2019",sbquo:"\\u201A",ldquo:"\\u201C",rdquo:"\\u201D",bdquo:"\\u201E",dagger:"\\u2020",Dagger:"\\u2021",bull:"\\u2022",hellip:"\\u2026",permil:"\\u2030",prime:"\\u2032",Prime:"\\u2033",lsaquo:"\\u2039",rsaquo:"\\u203A",oline:"\\u203E",euro:"\\u20AC",trade:"\\u2122",larr:"\\u2190",uarr:"\\u2191",rarr:"\\u2192",darr:"\\u2193",harr:"\\u2194",crarr:"\\u21B5",lceil:"\\u2308",rceil:"\\u2309",lfloor:"\\u230A",rfloor:"\\u230B",loz:"\\u25CA",spades:"\\u2660",clubs:"\\u2663",hearts:"\\u2665",diams:"\\u2666"}});var It=Ne(Le=>{var Ue=/[A-Z_a-z\\xC0-\\xD6\\xD8-\\xF6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/,Nt=new RegExp("[\\\\-\\\\.0-9"+Ue.source.slice(1,-1)+"\\\\u00B7\\\\u0300-\\\\u036F\\\\u203F-\\\\u2040]"),wt=new RegExp("^"+Ue.source+Nt.source+"*(?::"+Ue.source+Nt.source+"*)?$"),he=0,q=1,ne=2,ge=3,re=4,ie=5,de=6,we=7;function se(t,e){this.message=t,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,se)}se.prototype=new Error;se.prototype.name=se.name;function xt(){}xt.prototype={parse:function(t,e,n){var r=this.domBuilder;r.startDocument(),Mt(e,e={}),bn(t,e,n,r,this.errorHandler),r.endDocument()}};function bn(t,e,n,r,i){function s(A){if(A>65535){A-=65536;var g=55296+(A>>10),ee=56320+(A&1023);return String.fromCharCode(g,ee)}else return String.fromCharCode(A)}function o(A){var g=A.slice(1,-1);return g in n?n[g]:g.charAt(0)==="#"?s(parseInt(g.substr(1).replace("x","0x"))):(i.error("entity not found:"+A),A)}function l(A){if(A>C){var g=t.substring(C,A).replace(/&#?\\w+;/g,o);S&&u(C),r.characters(g,0,A-C),C=A}}function u(A,g){for(;A>=f&&(g=h.exec(t));)a=g.index,f=a+g[0].length,S.lineNumber++;S.columnNumber=A-a+1}for(var a=0,f=0,h=/.*(?:\\r\\n?|\\n)|.*$/g,S=r.locator,_=[{currentNSMap:e}],y={},C=0;;){try{var v=t.indexOf("<",C);if(v<0){if(!t.substr(C).match(/^\\s*$/)){var M=r.doc,P=M.createTextNode(t.substr(C));M.appendChild(P),r.currentElement=P}return}switch(v>C&&l(v),t.charAt(v+1)){case"/":var b=t.indexOf(">",v+3),R=t.substring(v+2,b),w=_.pop();b<0?(R=t.substring(v+2).replace(/[\\s<].*/,""),i.error("end tag name: "+R+" is not complete:"+w.tagName),b=v+1+R.length):R.match(/\\sC?C=b:l(Math.max(v,C)+1)}}function Dt(t,e){return e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber,e}function Nn(t,e,n,r,i,s){function o(_,y,C){_ in n.attributeNames&&s.fatalError("Attribute "+_+" redefined"),n.addValue(_,y,C)}for(var l,u,a=++e,f=he;;){var h=t.charAt(a);switch(h){case"=":if(f===q)l=t.slice(e,a),f=ge;else if(f===ne)f=ge;else throw new Error("attribute equal must after attrName");break;case"\'":case\'"\':if(f===ge||f===q)if(f===q&&(s.warning(\'attribute value must after "="\'),l=t.slice(e,a)),e=a+1,a=t.indexOf(h,e),a>0)u=t.slice(e,a).replace(/&#?\\w+;/g,i),o(l,u,e-1),f=ie;else throw new Error("attribute value no end \'"+h+"\' match");else if(f==re)u=t.slice(e,a).replace(/&#?\\w+;/g,i),o(l,u,e),s.warning(\'attribute "\'+l+\'" missed start quot(\'+h+")!!"),e=a+1,f=ie;else throw new Error(\'attribute value must after "="\');break;case"/":switch(f){case he:n.setTagName(t.slice(e,a));case ie:case de:case we:f=we,n.closed=!0;case re:case q:case ne:break;default:throw new Error("attribute invalid close char(\'/\')")}break;case"":return s.error("unexpected end of input"),f==he&&n.setTagName(t.slice(e,a)),a;case">":switch(f){case he:n.setTagName(t.slice(e,a));case ie:case de:case we:break;case re:case q:u=t.slice(e,a),u.slice(-1)==="/"&&(n.closed=!0,u=u.slice(0,-1));case ne:f===ne&&(u=l),f==re?(s.warning(\'attribute "\'+u+\'" missed quot(")!\'),o(l,u.replace(/&#?\\w+;/g,i),e)):((r[""]!=="http://www.w3.org/1999/xhtml"||!u.match(/^(?:disabled|checked|selected)$/i))&&s.warning(\'attribute "\'+u+\'" missed value!! "\'+u+\'" instead!!\'),o(u,u,e));break;case ge:throw new Error("attribute value missed!!")}return a;case"\\x80":h=" ";default:if(h<=" ")switch(f){case he:n.setTagName(t.slice(e,a)),f=de;break;case q:l=t.slice(e,a),f=ne;break;case re:var u=t.slice(e,a).replace(/&#?\\w+;/g,i);s.warning(\'attribute "\'+u+\'" missed quot(")!!\'),o(l,u,e);case ie:f=de;break}else switch(f){case ne:var S=n.tagName;(r[""]!=="http://www.w3.org/1999/xhtml"||!l.match(/^(?:disabled|checked|selected)$/i))&&s.warning(\'attribute "\'+l+\'" missed value!! "\'+l+\'" instead2!!\'),o(l,l,e),e=a,f=q;break;case ie:s.warning(\'attribute space is required"\'+l+\'"!!\');case de:f=q,e=a;break;case ge:f=re,e=a;break;case we:throw new Error("elements closed character \'/\' and \'>\' must be connected to")}}a++}}function $t(t,e,n){for(var r=t.tagName,i=null,h=t.length;h--;){var s=t[h],o=s.qName,l=s.value,S=o.indexOf(":");if(S>0)var u=s.prefix=o.slice(0,S),a=o.slice(S+1),f=u==="xmlns"&&a;else a=o,u=null,f=o==="xmlns"&&"";s.localName=a,f!==!1&&(i==null&&(i={},Mt(n,n={})),n[f]=i[f]=l,s.uri="http://www.w3.org/2000/xmlns/",e.startPrefixMapping(f,l))}for(var h=t.length;h--;){s=t[h];var u=s.prefix;u&&(u==="xml"&&(s.uri="http://www.w3.org/XML/1998/namespace"),u!=="xmlns"&&(s.uri=n[u||""]))}var S=r.indexOf(":");S>0?(u=t.prefix=r.slice(0,S),a=t.localName=r.slice(S+1)):(u=null,a=t.localName=r);var _=t.uri=n[u||""];if(e.startElement(_,a,r,t),t.closed){if(e.endElement(_,a,r),i)for(u in i)e.endPrefixMapping(u)}else return t.currentNSMap=n,t.localNSMap=i,!0}function wn(t,e,n,r,i){if(/^(?:script|textarea)$/i.test(n)){var s=t.indexOf("",e),o=t.substring(e+1,s);if(/[&<]/.test(o))return/^script$/i.test(n)?(i.characters(o,0,o.length),s):(o=o.replace(/&#?\\w+;/g,r),i.characters(o,0,o.length),s)}return e+1}function Dn(t,e,n,r){var i=r[n];return i==null&&(i=t.lastIndexOf(""),i",e+4);return s>e?(n.comment(t,e+4,s-e-4),s+3):(r.error("Unclosed comment"),-1)}else return-1;default:if(t.substr(e+3,6)=="CDATA["){var s=t.indexOf("]]>",e+9);return n.startCDATA(),n.characters(t,e+9,s-e-9),n.endCDATA(),s+3}var o=Mn(t,e),l=o.length;if(l>1&&/!doctype/i.test(o[0][0])){var u=o[1][0],a=!1,f=!1;l>3&&(/^public$/i.test(o[2][0])?(a=o[3][0],f=l>4&&o[4][0]):/^system$/i.test(o[2][0])&&(f=o[3][0]));var h=o[l-1];return n.startDTD(u,a,f),n.endDTD(),h.index+h[0].length}}return-1}function xn(t,e,n){var r=t.indexOf("?>",e);if(r){var i=t.substring(e,r).match(/^<\\?(\\S*)\\s*([\\s\\S]*?)\\s*$/);if(i){var s=i[0].length;return n.processingInstruction(i[1],i[2]),r+2}else return-1}return-1}function Ot(){this.attributeNames={}}Ot.prototype={setTagName:function(t){if(!wt.test(t))throw new Error("invalid tagName:"+t);this.tagName=t},addValue:function(t,e,n){if(!wt.test(t))throw new Error("invalid attribute:"+t);this.attributeNames[t]=this.length,this[this.length++]={qName:t,value:e,offset:n}},length:0,getLocalName:function(t){return this[t].localName},getLocator:function(t){return this[t].locator},getQName:function(t){return this[t].qName},getURI:function(t){return this[t].uri},getValue:function(t){return this[t].value}};function Mn(t,e){var n,r=[],i=/\'[^\']+\'|"[^"]+"|[^\\s<>\\/=]+=?|(\\/?\\s*>|<)/g;for(i.lastIndex=e,i.exec(t);n=i.exec(t);)if(r.push(n),n[1])return r}Le.XMLReader=xt;Le.ParseError=se});var Xe=Ne(Ce=>{function ve(t,e){for(var n in t)e[n]=t[n]}function F(t,e){var n=t.prototype;if(!(n instanceof e)){let i=function(){};var r=i;i.prototype=e.prototype,i=new i,ve(n,i),t.prototype=n=i}n.constructor!=t&&(typeof t!="function"&&console.error("unknow Class:"+t),n.constructor=t)}var On="http://www.w3.org/1999/xhtml",U={},j=U.ELEMENT_NODE=1,oe=U.ATTRIBUTE_NODE=2,De=U.TEXT_NODE=3,Wt=U.CDATA_SECTION_NODE=4,Gt=U.ENTITY_REFERENCE_NODE=5,In=U.ENTITY_NODE=6,jt=U.PROCESSING_INSTRUCTION_NODE=7,Bt=U.COMMENT_NODE=8,Vt=U.DOCUMENT_NODE=9,zt=U.DOCUMENT_TYPE_NODE=10,z=U.DOCUMENT_FRAGMENT_NODE=11,Pn=U.NOTATION_NODE=12,O={},$={},Sa=O.INDEX_SIZE_ERR=($[1]="Index size error",1),va=O.DOMSTRING_SIZE_ERR=($[2]="DOMString size error",2),kn=O.HIERARCHY_REQUEST_ERR=($[3]="Hierarchy request error",3),ya=O.WRONG_DOCUMENT_ERR=($[4]="Wrong document",4),Ra=O.INVALID_CHARACTER_ERR=($[5]="Invalid character",5),Ca=O.NO_DATA_ALLOWED_ERR=($[6]="No data allowed",6),Ea=O.NO_MODIFICATION_ALLOWED_ERR=($[7]="No modification allowed",7),Fn=O.NOT_FOUND_ERR=($[8]="Not found",8),_a=O.NOT_SUPPORTED_ERR=($[9]="Not supported",9),Pt=O.INUSE_ATTRIBUTE_ERR=($[10]="Attribute in use",10),Aa=O.INVALID_STATE_ERR=($[11]="Invalid state",11),Ta=O.SYNTAX_ERR=($[12]="Syntax error",12),ba=O.INVALID_MODIFICATION_ERR=($[13]="Invalid modification",13),Na=O.NAMESPACE_ERR=($[14]="Invalid namespace",14),wa=O.INVALID_ACCESS_ERR=($[15]="Invalid access",15);function te(t,e){if(e instanceof Error)var n=e;else n=this,Error.call(this,$[t]),this.message=$[t],Error.captureStackTrace&&Error.captureStackTrace(this,te);return n.code=t,e&&(this.message=this.message+": "+e),n}te.prototype=Error.prototype;ve(O,te);function Z(){}Z.prototype={length:0,item:function(t){return this[t]||null},toString:function(t,e){for(var n=[],r=0;r=0){for(var i=e.length-1;r0},lookupPrefix:function(t){for(var e=this;e;){var n=e._nsMap;if(n){for(var r in n)if(n[r]==t)return r}e=e.nodeType==oe?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(t){for(var e=this;e;){var n=e._nsMap;if(n&&t in n)return n[t];e=e.nodeType==oe?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(t){var e=this.lookupPrefix(t);return e==null}};function Ut(t){return t=="<"&&"<"||t==">"&&">"||t=="&"&&"&"||t==\'"\'&&"""||"&#"+t.charCodeAt()+";"}ve(U,I);ve(U,I.prototype);function Se(t,e){if(e(t))return!0;if(t=t.firstChild)do if(Se(t,e))return!0;while(t=t.nextSibling)}function ye(){}function Un(t,e,n){t&&t._inc++;var r=n.namespaceURI;r=="http://www.w3.org/2000/xmlns/"&&(e._nsMap[n.prefix?n.localName:""]=n.value)}function Yt(t,e,n,r){t&&t._inc++;var i=n.namespaceURI;i=="http://www.w3.org/2000/xmlns/"&&delete e._nsMap[n.prefix?n.localName:""]}function je(t,e,n){if(t&&t._inc){t._inc++;var r=e.childNodes;if(n)r[r.length++]=n;else{for(var i=e.firstChild,s=0;i;)r[s++]=i,i=i.nextSibling;r.length=s}}}function Xt(t,e){var n=e.previousSibling,r=e.nextSibling;return n?n.nextSibling=r:t.firstChild=r,r?r.previousSibling=n:t.lastChild=n,je(t.ownerDocument,t),e}function qt(t,e,n){var r=e.parentNode;if(r&&r.removeChild(e),e.nodeType===z){var i=e.firstChild;if(i==null)return e;var s=e.lastChild}else i=s=e;var o=n?n.previousSibling:t.lastChild;i.previousSibling=o,s.nextSibling=n,o?o.nextSibling=i:t.firstChild=i,n==null?t.lastChild=s:n.previousSibling=s;do i.parentNode=t;while(i!==s&&(i=i.nextSibling));return je(t.ownerDocument||t,t),e.nodeType==z&&(e.firstChild=e.lastChild=null),e}function Ln(t,e){var n=e.parentNode;if(n){var r=t.lastChild;n.removeChild(e);var r=t.lastChild}var r=t.lastChild;return e.parentNode=t,e.previousSibling=r,e.nextSibling=null,r?r.nextSibling=e:t.firstChild=e,t.lastChild=e,je(t.ownerDocument,t,e),e}ye.prototype={nodeName:"#document",nodeType:Vt,doctype:null,documentElement:null,_inc:1,insertBefore:function(t,e){if(t.nodeType==z){for(var n=t.firstChild;n;){var r=n.nextSibling;this.insertBefore(n,e),n=r}return t}return this.documentElement==null&&t.nodeType==j&&(this.documentElement=t),qt(this,t,e),t.ownerDocument=this,t},removeChild:function(t){return this.documentElement==t&&(this.documentElement=null),Xt(this,t)},importNode:function(t,e){return tn(this,t,e)},getElementById:function(t){var e=null;return Se(this.documentElement,function(n){if(n.nodeType==j&&n.getAttribute("id")==t)return e=n,!0}),e},getElementsByClassName:function(t){var e=new RegExp("(^|\\\\s)"+t+"(\\\\s|$)");return new ce(this,function(n){var r=[];return Se(n.documentElement,function(i){i!==n&&i.nodeType==j&&e.test(i.getAttribute("class"))&&r.push(i)}),r})},createElement:function(t){var e=new le;e.ownerDocument=this,e.nodeName=t,e.tagName=t,e.childNodes=new Z;var n=e.attributes=new $e;return n._ownerElement=e,e},createDocumentFragment:function(){var t=new Me;return t.ownerDocument=this,t.childNodes=new Z,t},createTextNode:function(t){var e=new Be;return e.ownerDocument=this,e.appendData(t),e},createComment:function(t){var e=new Ve;return e.ownerDocument=this,e.appendData(t),e},createCDATASection:function(t){var e=new ze;return e.ownerDocument=this,e.appendData(t),e},createProcessingInstruction:function(t,e){var n=new Ye;return n.ownerDocument=this,n.tagName=n.target=t,n.nodeValue=n.data=e,n},createAttribute:function(t){var e=new xe;return e.ownerDocument=this,e.name=t,e.nodeName=t,e.localName=t,e.specified=!0,e},createEntityReference:function(t){var e=new Ke;return e.ownerDocument=this,e.nodeName=t,e},createElementNS:function(t,e){var n=new le,r=e.split(":"),i=n.attributes=new $e;return n.childNodes=new Z,n.ownerDocument=this,n.nodeName=e,n.tagName=e,n.namespaceURI=t,r.length==2?(n.prefix=r[0],n.localName=r[1]):n.localName=e,i._ownerElement=n,n},createAttributeNS:function(t,e){var n=new xe,r=e.split(":");return n.ownerDocument=this,n.nodeName=e,n.name=e,n.namespaceURI=t,n.specified=!0,r.length==2?(n.prefix=r[0],n.localName=r[1]):n.localName=e,n}};F(ye,I);function le(){this._nsMap={}}le.prototype={nodeType:j,hasAttribute:function(t){return this.getAttributeNode(t)!=null},getAttribute:function(t){var e=this.getAttributeNode(t);return e&&e.value||""},getAttributeNode:function(t){return this.attributes.getNamedItem(t)},setAttribute:function(t,e){var n=this.ownerDocument.createAttribute(t);n.value=n.nodeValue=""+e,this.setAttributeNode(n)},removeAttribute:function(t){var e=this.getAttributeNode(t);e&&this.removeAttributeNode(e)},appendChild:function(t){return t.nodeType===z?this.insertBefore(t,null):Ln(this,t)},setAttributeNode:function(t){return this.attributes.setNamedItem(t)},setAttributeNodeNS:function(t){return this.attributes.setNamedItemNS(t)},removeAttributeNode:function(t){return this.attributes.removeNamedItem(t.nodeName)},removeAttributeNS:function(t,e){var n=this.getAttributeNodeNS(t,e);n&&this.removeAttributeNode(n)},hasAttributeNS:function(t,e){return this.getAttributeNodeNS(t,e)!=null},getAttributeNS:function(t,e){var n=this.getAttributeNodeNS(t,e);return n&&n.value||""},setAttributeNS:function(t,e,n){var r=this.ownerDocument.createAttributeNS(t,e);r.value=r.nodeValue=""+n,this.setAttributeNode(r)},getAttributeNodeNS:function(t,e){return this.attributes.getNamedItemNS(t,e)},getElementsByTagName:function(t){return new ce(this,function(e){var n=[];return Se(e,function(r){r!==e&&r.nodeType==j&&(t==="*"||r.tagName==t)&&n.push(r)}),n})},getElementsByTagNameNS:function(t,e){return new ce(this,function(n){var r=[];return Se(n,function(i){i!==n&&i.nodeType===j&&(t==="*"||i.namespaceURI===t)&&(e==="*"||i.localName==e)&&r.push(i)}),r})}};ye.prototype.getElementsByTagName=le.prototype.getElementsByTagName;ye.prototype.getElementsByTagNameNS=le.prototype.getElementsByTagNameNS;F(le,I);function xe(){}xe.prototype.nodeType=oe;F(xe,I);function Re(){}Re.prototype={data:"",substringData:function(t,e){return this.data.substring(t,t+e)},appendData:function(t){t=this.data+t,this.nodeValue=this.data=t,this.length=t.length},insertData:function(t,e){this.replaceData(t,0,e)},appendChild:function(t){throw new Error($[kn])},deleteData:function(t,e){this.replaceData(t,e,"")},replaceData:function(t,e,n){var r=this.data.substring(0,t),i=this.data.substring(t+e);n=r+n+i,this.nodeValue=this.data=n,this.length=n.length}};F(Re,I);function Be(){}Be.prototype={nodeName:"#text",nodeType:De,splitText:function(t){var e=this.data,n=e.substring(t);e=e.substring(0,t),this.data=this.nodeValue=e,this.length=e.length;var r=this.ownerDocument.createTextNode(n);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}};F(Be,Re);function Ve(){}Ve.prototype={nodeName:"#comment",nodeType:Bt};F(Ve,Re);function ze(){}ze.prototype={nodeName:"#cdata-section",nodeType:Wt};F(ze,Re);function He(){}He.prototype.nodeType=zt;F(He,I);function Zt(){}Zt.prototype.nodeType=Pn;F(Zt,I);function Qt(){}Qt.prototype.nodeType=In;F(Qt,I);function Ke(){}Ke.prototype.nodeType=Gt;F(Ke,I);function Me(){}Me.prototype.nodeName="#document-fragment";Me.prototype.nodeType=z;F(Me,I);function Ye(){}Ye.prototype.nodeType=jt;F(Ye,I);function Jt(){}Jt.prototype.serializeToString=function(t,e,n){return en.call(t,e,n)};I.prototype.toString=en;function en(t,e){var n=[],r=this.nodeType==9&&this.documentElement||this,i=r.prefix,s=r.namespaceURI;if(s&&i==null){var i=r.lookupPrefix(s);if(i==null)var o=[{namespace:s,prefix:null}]}return ae(this,n,t,e,o),n.join("")}function Lt(t,e,n){var r=t.prefix||"",i=t.namespaceURI;if(!r&&!i||r==="xml"&&i==="http://www.w3.org/XML/1998/namespace"||i=="http://www.w3.org/2000/xmlns/")return!1;for(var s=n.length;s--;){var o=n[s];if(o.prefix==r)return o.namespace!=i}return!0}function ae(t,e,n,r,i){if(r)if(t=r(t),t){if(typeof t=="string"){e.push(t);return}}else return;switch(t.nodeType){case j:i||(i=[]);var s=i.length,o=t.attributes,l=o.length,y=t.firstChild,u=t.tagName;n=On===t.namespaceURI||n,e.push("<",u);for(var a=0;a"),n&&/^script$/i.test(u))for(;y;)y.data?e.push(y.data):ae(y,e,n,r,i),y=y.nextSibling;else for(;y;)ae(y,e,n,r,i),y=y.nextSibling;e.push("")}else e.push("/>");return;case Vt:case z:for(var y=t.firstChild;y;)ae(y,e,n,r,i),y=y.nextSibling;return;case oe:return e.push(" ",t.name,\'="\',t.value.replace(/[<&"]/g,Ut),\'"\');case De:return e.push(t.data.replace(/[<&]/g,Ut).replace(/]]>/g,"]]>"));case Wt:return e.push("");case Bt:return e.push("");case zt:var C=t.publicId,v=t.systemId;if(e.push("");else if(v&&v!=".")e.push(" SYSTEM ",v,">");else{var M=t.internalSubset;M&&e.push(" [",M,"]"),e.push(">")}return;case jt:return e.push("");case Gt:return e.push("&",t.nodeName,";");default:e.push("??",t.nodeName)}}function tn(t,e,n){var r;switch(e.nodeType){case j:r=e.cloneNode(!1),r.ownerDocument=t;case z:break;case oe:n=!0;break}if(r||(r=e.cloneNode(!1)),r.ownerDocument=t,r.parentNode=null,n)for(var i=e.firstChild;i;)r.appendChild(tn(t,i,n)),i=i.nextSibling;return r}function We(t,e,n){var r=new e.constructor;for(var i in e){var s=e[i];typeof s!="object"&&s!=r[i]&&(r[i]=s)}switch(e.childNodes&&(r.childNodes=new Z),r.ownerDocument=t,r.nodeType){case j:var o=e.attributes,l=r.attributes=new $e,u=o.length;l._ownerElement=r;for(var a=0;a{function sn(t){this.options=t||{locator:{}}}sn.prototype.parseFromString=function(t,e){var n=this.options,r=new jn,i=n.domBuilder||new Ee,s=n.errorHandler,o=n.locator,l=n.xmlns||{},u=/\\/x?html?$/.test(e),a=u?Gn.entityMap:{lt:"<",gt:">",amp:"&",quot:\'"\',apos:"\'"};return o&&i.setDocumentLocator(o),r.errorHandler=Wn(s,i,o),r.domBuilder=n.domBuilder||i,u&&(l[""]="http://www.w3.org/1999/xhtml"),l.xml=l.xml||"http://www.w3.org/XML/1998/namespace",t&&typeof t=="string"?r.parse(t,l,a):r.errorHandler.error("invalid doc source"),i.doc};function Wn(t,e,n){if(!t){if(e instanceof Ee)return e;t=e}var r={},i=t instanceof Function;n=n||{};function s(o){var l=t[o];!l&&i&&(l=t.length==2?function(u){t(o,u)}:t),r[o]=l&&function(u){l("[xmldom "+o+"] "+u+qe(n))}||function(){}}return s("warning"),s("error"),s("fatalError"),r}function Ee(){this.cdata=!1}function ue(t,e){e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber}Ee.prototype={startDocument:function(){this.doc=new Vn().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(t,e,n,r){var i=this.doc,s=i.createElementNS(t,n||e),o=r.length;Oe(this,s),this.currentElement=s,this.locator&&ue(this.locator,s);for(var l=0;l=e+n||e?new java.lang.String(t,e,n)+"":t}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\\w+/g,function(t){Ee.prototype[t]=function(){return null}});function Oe(t,e){t.currentElement?t.currentElement.appendChild(e):t.doc.appendChild(e)}var Gn=bt(),an=It(),jn=an.XMLReader,Bn=an.ParseError,Vn=_e.DOMImplementation=Xe().DOMImplementation;_e.XMLSerializer=Xe().XMLSerializer;_e.DOMParser=sn;_e.__DOMHandler=Ee});var ln=Tn(on());async function un(t){return new Promise((e,n)=>{let r=new FileReader;r.onload=async i=>{let s=i.target.result,l=new ln.DOMParser().parseFromString(s,"application/xml").getElementsByTagName("monster"),u=[];if(l.length){for(let a of Array.from(l))try{let f={image:null,name:x(a,"name"),size:qn(a),type:x(a,"type"),subtype:x(a,"subtype"),alignment:x(a,"alignment"),ac:Zn(a),hp:Number(cn(a,"hp")),hit_dice:cn(a,"hit_dice"),speed:x(a,"speed"),stats:[Number(x(a,"str")),Number(x(a,"dex")),Number(x(a,"con")),Number(x(a,"int")),Number(x(a,"wis")),Number(x(a,"cha"))],saves:Yn(a),skillsaves:Hn(a),damage_vulnerabilities:x(a,"vulnerable"),damage_resistances:x(a,"resist"),damage_immunities:x(a,"immune"),condition_immunities:x(a,"conditionImmune"),senses:x(a,"senses"),languages:x(a,"languages"),cr:x(a,"cr"),traits:Ie(a,"trait"),spells:zn(a),actions:Ie(a,"action"),legendary_actions:Ie(a,"legendary"),reactions:Ie(a,"reaction"),source:Qn(a)};u.push(f)}catch(f){console.error(f);continue}e(u)}},r.readAsText(t)})}function x(t,e){let n=t.getElementsByTagName(e);if(n&&n.length)return n[0].textContent}function Ie(t,e){var i;if(!((i=t.getElementsByTagName(e))!=null&&i.length))return[];let n=t.getElementsByTagName(e),r=[];for(let s of Array.from(n)){let o=s.getElementsByTagName("name");if(!o||!o.length||!o[0].textContent||o[0].textContent.includes("Spellcasting"))continue;let l=[],u=s.getElementsByTagName("text");for(let a of Array.from(u))l.push(a.textContent);r.push({name:o[0].textContent,desc:l.join(" ")})}return r}function zn(t){var r;if(!((r=t.getElementsByTagName("trait"))!=null&&r.length))return[];let n=Array.from(t.getElementsByTagName("trait")).find(i=>{var s;return(s=i.getElementsByTagName("name")[0])==null?void 0:s.textContent.includes("Spellcasting")});return n?Array.from(n.getElementsByTagName("text")).map(i=>i.textContent.replace(/(•|\u2022)/u,"").trim()).filter(i=>i.length):[]}function Hn(t){var r;if(!((r=t.getElementsByTagName("skill"))!=null&&r.length))return[];let e=t.getElementsByTagName("skill")[0].textContent.split(", "),n=[];return e.forEach(i=>{let s=i.split(/\\s[\\+\\-]/);n.push({[s[0]]:Number(s[1])})}),n}var Kn={Str:"strength",Dex:"dexterity",Con:"constitution",Int:"intelligence",Wis:"wisdom",Cha:"charisma"};function Yn(t){var r;if(!((r=t.getElementsByTagName("save"))!=null&&r.length))return[];let e=t.getElementsByTagName("save")[0].textContent.split(", "),n=[];return e.forEach(i=>{let s=i.split(/\\s[\\+\\-]/);n.push({[Kn[s[0]]]:Number(s[1])})}),n}function cn(t,e){var s,o;if(!((s=t.getElementsByTagName("hp"))!=null&&s.length))return"";let n=t.getElementsByTagName("hp")[0].textContent,[,r,i]=(o=n.match(/(\\d+) \\(([\\s\\S]+)\\)/))!=null?o:[,"",""];return{hp:r,hit_dice:i}[e]}var Xn={T:"tiny",S:"small",M:"medium",L:"large",H:"huge",G:"gargantuan"};function qn(t){var e;return t.getElementsByTagName("size")&&(e=Xn[t.getElementsByTagName("size")[0].textContent])!=null?e:""}function Zn(t){var e;if(t.getElementsByTagName("ac")){let[,n]=(e=t.getElementsByTagName("ac")[0])==null?void 0:e.textContent.match(/(\\d+)/);return Number(n)}return 0}function Qn(t){var n,r,i,s,o,l;let e="Unknown";if((n=t.getElementsByTagName("source"))!=null&&n.length)e=t.getElementsByTagName("source")[0].textContent;else if((r=t.getElementsByTagName("trait"))!=null&&r.length&&Array.from(t.getElementsByTagName("trait")).find(u=>{var a;return((a=u.getElementsByTagName("name"))==null?void 0:a[0].textContent)=="Source"})){let u=Array.from(t.getElementsByTagName("trait")).find(a=>{var f,h;return((h=(f=a.getElementsByTagName("name"))==null?void 0:f[0])==null?void 0:h.textContent)=="Source"});e=(o=(s=(i=u==null?void 0:u.getElementsByTagName("text"))==null?void 0:i[0])==null?void 0:s.textContent)==null?void 0:o.replace(/p. \\d+/,"").trim()}else if((l=t.getElementsByTagName("description"))!=null&&l.length){let u=t.getElementsByTagName("description"),a="Source: ";if(u[0].textContent.includes(a)){let f=u[0].textContent.lastIndexOf(a);e=u[0].textContent.slice(f+a.length).split(/, ?/)[0]}}return e}var Jn={STR:"strength",DEX:"dexterity",CON:"constitution",INT:"intelligence",WIS:"wisdom",CHA:"charisma"};async function fn(t){return new Promise((e,n)=>{let r=new FileReader,i=[];r.onload=async s=>{var o,l,u,a,f,h,S,_,y,C,v,M,P,R,w,W,d,G,k,N,L,b,Y,J,V,B,A,g,ee,E,X,nt,rt,it,st,at,ot,ct,lt,ut,ft,mt,pt,ht,gt,dt,St,vt,yt,Rt,Ct,Et,_t;try{let Pe=JSON.parse(s.target.result),Sn=Object.keys(Pe).filter(ke=>/^Creatures\\./.test(ke));for(let ke of Sn)try{let T=Pe[ke],vn={name:T.Name,source:(o=T.Source)!=null&&o.trim().length?(l=T.Source)==null?void 0:l.trim():"Unknown",type:(f=(a=(u=T.Type)==null?void 0:u.split(/,\\s?/))==null?void 0:a[0])==null?void 0:f.trim(),subtype:"",size:"",alignment:(_=(S=(h=T.Type)==null?void 0:h.split(/,\\s?/))==null?void 0:S[1])==null?void 0:_.trim(),hp:(y=T.HP)==null?void 0:y.Value,hit_dice:(M=(v=(C=T.HP)==null?void 0:C.Notes)==null?void 0:v.replace(/([()])/g,""))==null?void 0:M.trim(),ac:T.AC.Value,speed:(R=(P=T.Speed)==null?void 0:P.join(", "))==null?void 0:R.trim(),stats:Object.values((w=T.Abilities)!=null?w:{}),damage_immunities:(k=(G=(d=(W=T.DamageImmunities)==null?void 0:W.join("; "))==null?void 0:d.toLowerCase())==null?void 0:G.trim())!=null?k:"",damage_resistances:(Y=(b=(L=(N=T.DamageResistances)==null?void 0:N.join(", "))==null?void 0:L.toLowerCase())==null?void 0:b.trim())!=null?Y:"",damage_vulnerabilities:(A=(B=(V=(J=T.DamageVulnerabilities)==null?void 0:J.join(", "))==null?void 0:V.toLowerCase())==null?void 0:B.trim())!=null?A:"",condition_immunities:(X=(E=(ee=(g=T.ConditionImmunities)==null?void 0:g.join(", "))==null?void 0:ee.toLowerCase())==null?void 0:E.trim())!=null?X:"",saves:(rt=(nt=T.Saves)==null?void 0:nt.map(({Name:D,Modifier:Fe})=>({[Jn[D]]:Fe})))!=null?rt:[],skillsaves:(st=(it=T.Skills)==null?void 0:it.map(({Name:D,Modifier:Fe})=>({[D]:Fe})))!=null?st:[],senses:(ct=(ot=(at=T.Senses)==null?void 0:at.join(", "))==null?void 0:ot.trim())!=null?ct:"",languages:(ft=(ut=(lt=T.Languages)==null?void 0:lt.join(", "))==null?void 0:ut.trim())!=null?ft:"",cr:(pt=(mt=T.Challenge)==null?void 0:mt.trim())!=null?pt:"",traits:(gt=(ht=T.Traits)==null?void 0:ht.map(D=>({name:D.Name,desc:D.Content})))!=null?gt:[],actions:(St=(dt=T.Actions)==null?void 0:dt.map(D=>({name:D.Name,desc:D.Content})))!=null?St:[],bonus_actions:(yt=(vt=T.BonusActions)==null?void 0:vt.map(D=>({name:D.Name,desc:D.Content})))!=null?yt:[],reactions:(Ct=(Rt=T.Reactions)==null?void 0:Rt.map(D=>({name:D.Name,desc:D.Content})))!=null?Ct:[],legendary_actions:(_t=(Et=T.LegendaryActions)==null?void 0:Et.map(D=>({name:D.Name,desc:D.Content})))!=null?_t:[],image:null};i.push(vn)}catch(T){continue}e(i)}catch(Pe){n()}},r.readAsText(t)})}async function mn(t){return new Promise((e,n)=>{let r=new FileReader;r.onload=async i=>{var o,l,u,a,f,h,S,_,y,C,v,M,P,R,w,W,d,G,k,N,L,b,Y,J,V;let s=[];try{let B=JSON.parse(i.target.result),A=[];B.creatures?A=B.creatures:A=[B];for(let g of A)try{let ee={image:null,name:g.name,source:"CritterDB",type:g.stats.race,subtype:"",size:g.stats.size,alignment:g.stats.alignment,hp:g.stats.hitPoints,hit_dice:`${Math.floor(g.stats.extraHealthFromConstitution/g.stats.abilityScoreModifiers.constitution)}d${g.stats.hitDieSize} + ${g.stats.extraHealthFromConstitution}`,ac:g.stats.armorClass,speed:g.stats.speed,stats:[g.stats.abilityScores.strength,g.stats.abilityScores.dexterity,g.stats.abilityScores.constitution,g.stats.abilityScores.intelligence,g.stats.abilityScores.wisdom,g.stats.abilityScores.charisma],damage_immunities:(l=(o=g.stats.damageImmunities)==null?void 0:o.join("; ").toLowerCase().trim())!=null?l:"",damage_resistances:(a=(u=g.stats.damageResistances)==null?void 0:u.join(", ").toLowerCase().trim())!=null?a:"",damage_vulnerabilities:(h=(f=g.stats.damageVulnerabilities)==null?void 0:f.join(", ").toLowerCase().trim())!=null?h:"",condition_immunities:(_=(S=g.stats.conditionImmunities)==null?void 0:S.join(", ").toLowerCase().trim())!=null?_:"",saves:(C=(y=g.stats.savingThrows)==null?void 0:y.map(E=>{var X;if(!(!("value"in E)&&!("modifier"in E)))return{[E.ability]:(X=E.value)!=null?X:E.modifier}}).filter(E=>E))!=null?C:[],skillsaves:(M=(v=g.stats.skills)==null?void 0:v.map(E=>{var X;if(!(!("value"in E)&&!("modifier"in E)))return{[E.name]:(X=E.value)!=null?X:E.modifier}}).filter(E=>E))!=null?M:[],senses:(R=(P=g.stats.senses)==null?void 0:P.join(", ").trim())!=null?R:"",languages:(W=(w=g.stats.languages)==null?void 0:w.join(", ").trim())!=null?W:"",cr:(d=g.stats.challengeRating)!=null?d:"",traits:(k=(G=g.stats.additionalAbilities)==null?void 0:G.map(E=>({name:E.name,desc:E.description.replace(/<[^>]*>/g,"")})))!=null?k:[],actions:(L=(N=g.stats.actions)==null?void 0:N.map(E=>({name:E.name,desc:E.description.replace(/<[^>]*>/g,"")})))!=null?L:[],reactions:(Y=(b=g.stats.reactions)==null?void 0:b.map(E=>({name:E.name,desc:E.description.replace(/<[^>]*>/g,"")})))!=null?Y:[],legendary_actions:(V=(J=g.stats.legendaryActions)==null?void 0:J.map(E=>({name:E.name,desc:E.description.replace(/<[^>]*>/g,"")})))!=null?V:[]};s.push(ee)}catch(ee){continue}e(s)}catch(B){n()}},r.readAsText(t)})}function Ae(t,e=0,n=" ",r=!0){let i=[];if(e==5||t==null)return"";if(typeof t=="string")return t;if(typeof t=="number")return`${t}`;if(Array.isArray(t))i.push(`${r?"(":""}${t.map(s=>Ae(s,e++)).join(n)}${r?")":""}`);else if(typeof t=="object")for(let s of Object.values(t))i.push(Ae(s,e++));return i.join(" ")}var er={str:"strength",dex:"dexterity",con:"constitution",wis:"wisdom",int:"intelligence",cha:"charisma"};function H(t){return t?t.replace(/{@condition (.+?)}/g,"$1").replace(/{@item (.+?)}/g,"$1").replace(/{@spell ([\\s\\S]+?)}/g,"$1").replace(/{@recharge (.+?)}/g,"(Recharge $1-6)").replace(/{@recharge}/g,"(Recharge 6)").replace(/{@h}/g,"").replace(/{@damage (.+?)}/g,"$1").replace(/{@atk ms}/g,"Melee Spell Attack").replace(/{@atk rs}/g,"Ranged Spell Attack").replace(/{@atk mw}/g,"Melee Weapon Attack").replace(/{@atk rw}/g,"Ranged Weapon Attack").replace(/{@atk mw,rw}/g,"Melee / Ranged Weapon Attack").replace(/{@creature (.+?)}/g,"$1").replace(/{@skill (.+?)}/g,"$1").replace(/{@dice (.+?)}/g,"$1").replace(/{@hit (\\d+?)}/g,"+$1").replace(/{@dc (\\d+?)}/g,"$1").replace(/{@quickref (.+?)\\|\\|.+?}/,"$1"):""}async function pn(t){return new Promise((e,n)=>{let r=new FileReader;r.onload=async i=>{var s,o,l,u,a,f,h,S,_,y,C,v,M,P;try{let R=JSON.parse(i.target.result),w;"monster"in R?w=R.monster:Array.isArray(R)?w=R:typeof R=="object"?w=[R]:n("Invalid monster JSON provided.");let W=[];for(let d of w)try{let G={image:null,name:d.name,source:mr(d),type:tr(d.type),subtype:"",size:_r[(s=d.size)==null?void 0:s[0]],alignment:lr(d),hp:d.hp&&"average"in d.hp?(o=d.hp)==null?void 0:o.average:null,hit_dice:d.hp&&"formula"in d.hp?(l=d.hp)==null?void 0:l.formula:"",ac:ir(d.ac),speed:ur(d),stats:[d.str,d.dex,d.con,d.int,d.wis,d.cha],damage_immunities:H(fe(d.immune)),damage_resistances:H(fe(d.resist)),damage_vulnerabilities:H(fe(d.vulnerable)),condition_immunities:H(fe(d.conditionImmune)),saves:Object.entries((u=d.save)!=null?u:{}).map(k=>{var L,b;if(!k||!k[1])return;let[,N]=(b=(L=k[1])==null?void 0:L.match(/.*?(\\d+)/))!=null?b:[];if(N)return{[er[k[0]]]:N}}).filter(k=>k),skillsaves:ma(d),senses:fr(d),languages:Ae(d.languages,0,", ",!1),cr:nr(d.cr),traits:(f=(a=d.trait)==null?void 0:a.flatMap(Te))!=null?f:[],actions:(S=(h=d.action)==null?void 0:h.flatMap(Te))!=null?S:[],bonus_actions:(y=(_=d.bonus)==null?void 0:_.flatMap(Te))!=null?y:[],reactions:(v=(C=d.reaction)==null?void 0:C.flatMap(Te))!=null?v:[],legendary_actions:(P=(M=d.legendary)==null?void 0:M.flatMap(Te))!=null?P:[],spells:cr(d),spellsNotes:rr(d).join(" ")};W.push(G)}catch(G){console.error(G);continue}e(W)}catch(R){console.error("reject!!!",R),n(R)}},r.readAsText(t)})}function tr(t){if(t)return typeof t=="string"?t:t.type}function nr(t){if(t)return typeof t=="string"?t:t.cr}function rr(t){let e=[];for(let n in t.spellcasting)e.push(Ae(t.spellcasting[n].footerEntries,0,", ",!1));return e}function fe(t){if(!t)return"";let e=[];for(let n of t){if(typeof n=="string"){e.push(n);continue}if("special"in n){e.push(n.special);continue}if("immune"in n){e.push(`${fe(n.immune)}${n.note?" ":""}${n.note?n.note:""}`);continue}if("resist"in n){e.push(`${fe(n.resist)}${n.note?" ":""}${n.note?n.note:""}`);continue}}return e.join(", ")}function ir(t=[]){var n;let[e]=t;if(e){if(typeof e=="number")return e;if(typeof e=="string"){let[r,i]=(n=e.match(/(\\d+)/))!=null?n:[];return i?Number(i):null}if(typeof e=="object")return"special"in e?null:e.ac}}var sr={0:"Cantrips (at will)",1:"1st level",2:"2nd level",3:"3rd level",4:"4th level",5:"5th level",6:"6th level",7:"7th level",8:"8th level",9:"9th level"};function Ze(t){let e=[];for(let n of t){if(typeof n=="string"){e.push(n);continue}!n.hidden&&n.entry&&n.entry.length&&e.push(n.entry)}return H(e.join(", "))}function ar(t){let e=[];for(let n of Object.keys(t)){let r=t[n],i=Number(n.replace(/[^0-9]/,""));e.push([i,Ze(r)])}return e}function or(t){var i,s;let e=[H(((i=t.headerEntries)!=null?i:[]).join(`\n`))];if("spells"in t)try{for(let o in(s=t.spells)!=null?s:{}){let l=t.spells[o],{spells:u}=l,a=`${sr[o]}`;a+="slots"in l?` (${l.slots} slots)`:"";let f=H(u.join(", "));e.push({[a]:f})}}catch(o){throw new Error("There was an error parsing the spells.")}if("will"in t&&t.will.length>0)try{e.push({"At will":Ze(t.will)})}catch(o){throw new Error("There was an error parsing the at-will spells.")}if("ritual"in t&&t.ritual.length>0)try{e.push({Rituals:Ze(t.ritual)})}catch(o){throw new Error("There was an error parsing the ritual spells.")}let n=["rest","daily","weekly","yearly","charges"],r={rest:"/rest each",daily:"/day each",weekly:"/week each",yearly:"/year each",charges:" charges"};for(let o of n)if(o in t){let l=ar(t[o]);for(let u of l.sort((a,f)=>f[0]-a[0]))e.push({[`${u[0]}${r[o]}`]:u[1]})}return e}function cr(t){return!t.spellcasting||!t.spellcasting.length?[]:t.spellcasting.flatMap(or)}function lr(t){return t.alignment?Qe(t.alignment):null}function Qe(t){var n;if(!t)return null;let e=[];if(Array.isArray(t))for(let r of t)e.push(Qe(r));else if(typeof t=="object"){if("special"in t&&t.special!=null)return t.special;if("alignment"in t)return`${((n=t.alignment)!=null?n:[]).map(r=>Qe(r)).join(" ")}${t.chance?` (${t.chance}%)`:""}${t.note?` (${t.note})`:""}`}else{switch(t.toUpperCase()){case"L":return"lawful";case"N":return"neutral";case"NX":return"neutral (law/chaos axis)";case"NY":return"neutral (good/evil axis)";case"C":return"chaotic";case"G":return"good";case"E":return"evil";case"U":return"unaligned";case"A":return"any alignment"}return t}return e.join(" or ")}function ur(t){var l,u;let e=t.speed;if(!e)return"\\u2014";if(typeof e=="number")return`${e}`;function n(a){return typeof a=="number"?a:a.number!=null?a.number:a}function r(a){var f;return typeof a=="number"?"":(f=a==null?void 0:a.condition)!=null?f:""}let i=[],s=["walk","burrow","climb","fly","swim"];for(let a of s){if(a!="walk"&&!(a in e)&&!(a in((l=e.alternate)!=null?l:{})))continue;let f=[];i.push(`${a==="walk"?"":`${a} `}${n((u=e[a])!=null?u:0)} ft. ${r(e[a])}`.trim()),e.alternate&&e.alternate[a]&&e.alternate[a].forEach(h=>{i.push(`${a==="walk"?"":`${a} `}${n(h!=null?h:0)} ft. ${r(h)}`.trim())})}let o=", ";if(e.choose){o="; ";let a=e.choose.from.sort();a.length>1?(`${a.slice(0,a.length-1).join(", ")}${a[a.length-1]}${e.choose.amount}`,e.choose.note&&`${e.choose.note}`):i.push(`${a} ${e.choose.amount} ft.${e.choose.note?` ${e.choose.note}`:""}`)}return i.join(o)}function fr(t){var n,r;if(typeof t.senses=="string")return t.senses;let e=[(r=(n=t.senses)==null?void 0:n.join(", ").trim())!=null?r:""];return t.passive&&e.push(`passive Perception ${t.passive}`),e.join(", ")}function mr(t){var n,r,i;let e=[];return(n=t.source)!=null&&n.length&&e.push((r=c[t.source])!=null?r:t.source),(i=t.otherSources)!=null&&i.length&&e.push(...t.otherSources.map(s=>{var o;return(o=c[s.source])!=null?o:s.source})),e}function Te(t){return t.entries.reduce((n,r)=>{var s;if(typeof r!="string"){let o=(s=r.items)==null?void 0:s.map(l=>typeof l=="string"?{name:l,entries:[]}:"entry"in l?{name:l.name,entries:[l.entry]}:{name:l.name,entries:l.entries});return n.concat(o!=null?o:[])}return n.length>1||n[0].entries.push(r),n},[{name:t.name,entries:[]}]).map(({name:n,entries:r})=>({name:H(n),desc:H(r.join(`\n`))}))}var pr="F",hr="D",gr="T",dr="S",Sr="M",vr="L",yr="H",Rr="G",Cr="C",Er="V",_r={[pr]:"Fine",[hr]:"Diminutive",[gr]:"Tiny",[dr]:"Small",[Sr]:"Medium",[vr]:"Large",[yr]:"Huge",[Rr]:"Gargantuan",[Cr]:"Colossal",[Er]:"Varies"},Ar="CoS",Tr="DMG",br="EEPC",Nr="EET",wr="HotDQ",Dr="LMoP",$r="Mag",xr="MM",Mr="OotA",Or="PHB",Ir="PotA",Pr="RoT",kr="RoTOS",Fr="SCAG",Ur="SKT",Lr="ToA",Wr="ToD",Gr="TTP",jr="TftYP",Br="TftYP-AtG",Vr="TftYP-DiT",zr="TftYP-TFoF",Hr="TftYP-THSoT",Kr="TftYP-TSC",Yr="TftYP-ToH",Xr="TftYP-WPM",qr="VGM",Zr="XGE",Qr="OGA",Jr="MTF",ei="WDH",ti="WDMM",ni="GGR",ri="KKW",ii="LLK",si="GoS",ai="AI",oi="OoW",ci="ESK",li="DIP",ui="HftT",fi="DC",mi="SLW",pi="SDW",hi="BGDIA",gi="LR",di="AL",Si="SAC",vi="ERLW",yi="EFR",Ri="RMBRE",Ci="RMR",Ei="MFF",_i="AWM",Ai="IMR",Ti="SADS",bi="EGW",Ni="ToR",wi="DD",Di="FS",$i="US",xi="MOT",Mi="IDRotF",Oi="TCE",Ii="VRGR",Pi="HoL",ki="Screen",Fi="ScreenWildernessKit",Ui="HF",Li="CM",Wi="WBtW",Gi="CRCotN",Je="AL",ji=`${Je}CurseOfStrahd`,Bi=`${Je}ElementalEvil`,Vi=`${Je}RageOfDemons`,me="PS",zi=`${me}A`,Hi=`${me}I`,Ki=`${me}K`,Yi=`${me}Z`,Xi=`${me}X`,qi=`${me}D`,m="UA",Zi=`${m}Artificer`,Qi=`${m}EladrinAndGith`,Ji=`${m}Eberron`,es=`${m}FeatsForRaces`,ts=`${m}FeatsForSkills`,ns=`${m}FiendishOptions`,rs=`${m}Feats`,is=`${m}GothicHeroes`,ss=`${m}ModernMagic`,as=`${m}StarterSpells`,os=`${m}TheMysticClass`,cs=`${m}ThatOldBlackMagic`,ls=`${m}TheRangerRevised`,us=`${m}WaterborneAdventures`,fs=`${m}VariantRules`,ms=`${m}LightDarkUnderdark`,ps=`${m}RangerAndRogue`,hs=`${m}ATrioOfSubclasses`,gs=`${m}BarbarianPrimalPaths`,ds=`${m}RevisedSubclasses`,Ss=`${m}KitsOfOld`,vs=`${m}BardBardColleges`,ys=`${m}ClericDivineDomains`,Rs=`${m}Druid`,Cs=`${m}RevisedClassOptions`,Es=`${m}Fighter`,_s=`${m}Monk`,As=`${m}Paladin`,Ts=`${m}ModifyingClasses`,bs=`${m}Sorcerer`,Ns=`${m}WarlockAndWizard`,ws=`${m}TheFaithful`,Ds=`${m}WizardRevisited`,$s=`${m}ElfSubraces`,xs=`${m}MassCombat`,Ms=`${m}ThreePillarExperience`,Os=`${m}GreyhawkInitiative`,Is=`${m}ThreeSubclasses`,Ps=`${m}OrderDomain`,ks=`${m}CentaursMinotaurs`,Fs=`${m}GiantSoulSorcerer`,Us=`${m}RacesOfEberron`,Ls=`${m}RacesOfRavnica`,Ws=`${m}WGE`,Gs=`${m}OfShipsAndSea`,js=`${m}Sidekicks`,Bs=`${m}ArtificerRevisited`,Vs=`${m}BarbarianAndMonk`,zs=`${m}SorcererAndWarlock`,Hs=`${m}BardAndPaladin`,Ks=`${m}ClericDruidWizard`,Ys=`${m}FighterRangerRogue`,Xs=`${m}ClassFeatureVariants`,qs=`${m}FighterRogueWizard`,Zs=`${m}PrestigeClassesRunMagic`,Qs=`${m}Ranger`,Js=`${m}2020SubclassesPt1`,ea=`${m}2020SubclassesPt2`,ta=`${m}2020SubclassesPt3`,na=`${m}2020SubclassesPt4`,ra=`${m}2020SubclassesPt5`,ia=`${m}2020SpellsAndMagicTattoos`,sa=`${m}2020PsionicOptionsRevisited`,aa=`${m}2020SubclassesRevisited`,oa=`${m}2020Feats`,ca=`${m}2021GothicLineages`,la=`${m}2021FolkOfTheFeywild`,ua=`${m}2021DraconicOptions`,fa=`${m}2021MagesOfStrixhaven`,et="Adventurers League: ",pe="Plane Shift: ",p="Unearthed Arcana: ",Q="Tales from the Yawning Portal",c={};c[Ar]="Curse of Strahd";c[Tr]="Dungeon Master\'s Guide";c[br]="Elemental Evil Player\'s Companion";c[Nr]="Elemental Evil: Trinkets";c[wr]="Hoard of the Dragon Queen";c[Dr]="Lost Mine of Phandelver";c[$r]="Dragon Magazine";c[xr]="Monster Manual";c[Mr]="Out of the Abyss";c[Or]="Player\'s Handbook";c[Ir]="Princes of the Apocalypse";c[Pr]="The Rise of Tiamat";c[kr]="The Rise of Tiamat Online Supplement";c[Fr]="Sword Coast Adventurer\'s Guide";c[Ur]="Storm King\'s Thunder";c[Lr]="Tomb of Annihilation";c[Wr]="Tyranny of Dragons";c[Gr]="The Tortle Package";c[jr]=Q;c[Br]=`${Q}: Against the Giants`;c[Vr]=`${Q}: Dead in Thay`;c[zr]=`${Q}: The Forge of Fury`;c[Hr]=`${Q}: The Hidden Shrine of Tamoachan`;c[Kr]=`${Q}: The Sunless Citadel`;c[Yr]=`${Q}: Tomb of Horrors`;c[Xr]=`${Q}: White Plume Mountain`;c[qr]="Volo\'s Guide to Monsters";c[Zr]="Xanathar\'s Guide to Everything";c[Qr]="One Grung Above";c[Jr]="Mordenkainen\'s Tome of Foes";c[ei]="Waterdeep: Dragon Heist";c[ti]="Waterdeep: Dungeon of the Mad Mage";c[ni]="Guildmasters\' Guide to Ravnica";c[ri]="Krenko\'s Way";c[ii]="Lost Laboratory of Kwalish";c[si]="Ghosts of Saltmarsh";c[ai]="Acquisitions Incorporated";c[oi]="The Orrery of the Wanderer";c[ci]="Essentials Kit";c[li]="Dragon of Icespire Peak";c[ui]="Hunt for the Thessalhydra";c[fi]="Divine Contention";c[mi]="Storm Lord\'s Wrath";c[pi]="Sleeping Dragon\'s Wake";c[hi]="Baldur\'s Gate: Descent Into Avernus";c[gi]="Locathah Rising";c[di]="Adventurers\' League";c[Si]="Sage Advice Compendium";c[vi]="Eberron: Rising from the Last War";c[yi]="Eberron: Forgotten Relics";c[Ri]="The Lost Dungeon of Rickedness: Big Rick Energy";c[Ci]="Dungeons & Dragons vs. Rick and Morty: Basic Rules";c[Ei]="Mordenkainen\'s Fiendish Folio";c[_i]="Adventure with Muk";c[Ai]="Infernal Machine Rebuild";c[Ti]="Sapphire Anniversary Dice Set";c[bi]="Explorer\'s Guide to Wildemount";c[Ni]="Tide of Retribution";c[wi]="Dangerous Designs";c[Di]="Frozen Sick";c[$i]="Unwelcome Spirits";c[xi]="Mythic Odysseys of Theros";c[Mi]="Icewind Dale: Rime of the Frostmaiden";c[Oi]="Tasha\'s Cauldron of Everything";c[Ii]="Van Richten\'s Guide to Ravenloft";c[Pi]="The House of Lament";c[ki]="Dungeon Master\'s Screen";c[Fi]="Dungeon Master\'s Screen: Wilderness Kit";c[Ui]="Heroes\' Feast";c[Li]="Candlekeep Mysteries";c[ji]=`${et}Curse of Strahd`;c[Bi]=`${et}Elemental Evil`;c[Vi]=`${et}Rage of Demons`;c[zi]=`${pe}Amonkhet`;c[Hi]=`${pe}Innistrad`;c[Ki]=`${pe}Kaladesh`;c[Yi]=`${pe}Zendikar`;c[Xi]=`${pe}Ixalan`;c[qi]=`${pe}Dominaria`;c[Zi]=`${p}Artificer`;c[Qi]=`${p}Eladrin and Gith`;c[Ji]=`${p}Eberron`;c[es]=`${p}Feats for Races`;c[ts]=`${p}Feats for Skills`;c[ns]=`${p}Fiendish Options`;c[rs]=`${p}Feats`;c[is]=`${p}Gothic Heroes`;c[ss]=`${p}Modern Magic`;c[as]=`${p}Starter Spells`;c[os]=`${p}The Mystic Class`;c[cs]=`${p}That Old Black Magic`;c[ls]=`${p}The Ranger, Revised`;c[us]=`${p}Waterborne Adventures`;c[fs]=`${p}Variant Rules`;c[ms]=`${p}Light, Dark, Underdark!`;c[ps]=`${p}Ranger and Rogue`;c[hs]=`${p}A Trio of Subclasses`;c[gs]=`${p}Barbarian Primal Paths`;c[ds]=`${p}Revised Subclasses`;c[Ss]=`${p}Kits of Old`;c[vs]=`${p}Bard: Bard Colleges`;c[ys]=`${p}Cleric: Divine Domains`;c[Rs]=`${p}Druid`;c[Cs]=`${p}Revised Class Options`;c[Es]=`${p}Fighter`;c[_s]=`${p}Monk`;c[As]=`${p}Paladin`;c[Ts]=`${p}Modifying Classes`;c[bs]=`${p}Sorcerer`;c[Ns]=`${p}Warlock and Wizard`;c[ws]=`${p}The Faithful`;c[Ds]=`${p}Wizard Revisited`;c[$s]=`${p}Elf Subraces`;c[xs]=`${p}Mass Combat`;c[Ms]=`${p}Three-Pillar Experience`;c[Os]=`${p}Greyhawk Initiative`;c[Is]=`${p}Three Subclasses`;c[Ps]=`${p}Order Domain`;c[ks]=`${p}Centaurs and Minotaurs`;c[Fs]=`${p}Giant Soul Sorcerer`;c[Us]=`${p}Races of Eberron`;c[Ls]=`${p}Races of Ravnica`;c[Ws]="Wayfinder\'s Guide to Eberron";c[Gs]=`${p}Of Ships and the Sea`;c[js]=`${p}Sidekicks`;c[Bs]=`${p}Artificer Revisited`;c[Vs]=`${p}Barbarian and Monk`;c[zs]=`${p}Sorcerer and Warlock`;c[Hs]=`${p}Bard and Paladin`;c[Ks]=`${p}Cleric, Druid, and Wizard`;c[Ys]=`${p}Fighter, Ranger, and Rogue`;c[Xs]=`${p}Class Feature Variants`;c[qs]=`${p}Fighter, Rogue, and Wizard`;c[Zs]=`${p}Prestige Classes and Rune Magic`;c[Qs]=`${p}Ranger`;c[Js]=`${p}2020 Subclasses, Part 1`;c[ea]=`${p}2020 Subclasses, Part 2`;c[ta]=`${p}2020 Subclasses, Part 3`;c[na]=`${p}2020 Subclasses, Part 4`;c[ra]=`${p}2020 Subclasses, Part 5`;c[ia]=`${p}2020 Spells and Magic Tattoos`;c[sa]=`${p}2020 Psionic Options Revisited`;c[aa]=`${p}2020 Subclasses Revisited`;c[oa]=`${p}2020 Feats`;c[ca]=`${p}2021 Gothic Lineages`;c[la]=`${p}2021 Folk of the Feywild`;c[ua]=`${p}2021 Draconic Options`;c[fa]=`${p}2021 Mages of Strixhaven`;c[Wi]="The Wild Beyond the Witchlight";c[Gi]="Critical Role: Call of the Netherdeep";function ma(t){var i,s,o;let e=t.skill;if(!e)return[];let n=[],r=[];for(let l of Object.keys(e)){if(l=="other"){let f=e[l];for(let h of f){let S=h.oneOf;if(!S)continue;let _=Object.keys(S).sort(),y=_.shift(),C=S[y],[,v]=(i=C==null?void 0:C.match(/.*?(\\d+)/))!=null?i:[];r.push({[`plus one of the following: ${y.charAt(0).toUpperCase()+y.slice(1)}`]:v});for(let M of _.slice(1)){let P=S[M],[,R]=(s=P==null?void 0:P.match(/.*?(\\d+)/))!=null?s:[];R&&r.push({[M]:R})}}continue}let u=e[l],[,a]=(o=u==null?void 0:u.match(/.*?(\\d+)/))!=null?o:[];a&&n.push({[l]:a})}return[...n.filter(l=>l),...r.filter(l=>l)]}var hn={0:{cr:"0",value:0,xp:0},"1/8":{cr:"1/8",value:.125,xp:25},"1/4":{cr:"1/4",value:.25,xp:50},"1/2":{cr:"1/2",value:.5,xp:100},"0.125":{cr:"1/8",value:.125,xp:25},"0.25":{cr:"1/4",value:.25,xp:50},"0.5":{cr:"1/2",value:.5,xp:100},1:{cr:"1",value:1,xp:200},2:{cr:"2",value:2,xp:450},3:{cr:"3",value:3,xp:700},4:{cr:"4",value:4,xp:1100},5:{cr:"5",value:5,xp:1800},6:{cr:"6",value:6,xp:2300},7:{cr:"7",value:7,xp:2900},8:{cr:"8",value:8,xp:3900},9:{cr:"9",value:9,xp:5e3},10:{cr:"10",value:10,xp:5900},11:{cr:"11",value:11,xp:7200},12:{cr:"12",value:12,xp:8400},13:{cr:"13",value:13,xp:1e4},14:{cr:"14",value:14,xp:11500},15:{cr:"15",value:15,xp:13e3},16:{cr:"16",value:16,xp:15e3},17:{cr:"17",value:17,xp:18e3},18:{cr:"18",value:18,xp:2e4},19:{cr:"19",value:19,xp:22e3},20:{cr:"20",value:20,xp:25e3},21:{cr:"21",value:21,xp:33e3},22:{cr:"22",value:22,xp:41e3},23:{cr:"23",value:23,xp:5e4},24:{cr:"24",value:24,xp:62e3},25:{cr:"25",value:25,xp:75e3},26:{cr:"26",value:26,xp:9e4},27:{cr:"27",value:27,xp:105e3},28:{cr:"28",value:28,xp:12e4},29:{cr:"29",value:29,xp:135e3},30:{cr:"30",value:30,xp:155e3}};function K(t){return Math.floor(((t!=null?t:10)-10)/2)}var gn={tiny:4,small:6,medium:8,large:10,huge:12,gargantuan:20},pa={str:"strength",dex:"dexterity",con:"constitution",int:"intelligence",wis:"wisdom",cha:"charisma"},be=class{constructor(e){this.monster=e;this.proficiency=this.getProf(this.monster);this.stats={str:this.monster.strPoints,dex:this.monster.dexPoints,con:this.monster.conPoints,int:this.monster.intPoints,wis:this.monster.wisPoints,cha:this.monster.chaPoints};this.modifiers={str:K(this.stats.str),dex:K(this.stats.dex),con:K(this.stats.con),int:K(this.stats.int),wis:K(this.stats.wis),cha:K(this.stats.cha)}}static parse(e){var i,s,o,l,u,a;let n=new be(e);return{image:null,name:e.name,source:"TetraCube",type:e.type,subtype:"",size:e.size,alignment:e.alignment,hp:(i=n.getHP(e))==null?void 0:i.hp,hit_dice:(s=n.getHP(e))==null?void 0:s.dice,ac:(u=(l=((o=e.ac)!=null?o:[])[0])==null?void 0:l.ac)!=null?u:"",speed:n.getSpeedString(e),stats:[e.strPoints,e.dexPoints,e.conPoints,e.intPoints,e.wisPoints,e.chaPoints],damage_immunities:n.parseImmune(e,"i"),damage_resistances:n.parseImmune(e,"r"),damage_vulnerabilities:n.parseImmune(e,"v"),condition_immunities:n.parseConditions(e),saves:n.getSaves(e),skillsaves:n.getSkills(e),senses:n.getSenses(e),languages:n.getLanguages(e),cr:(a=e.cr)!=null?a:"",traits:n.getTraits(e.abilities),actions:n.getTraits(e.actions),reactions:n.getTraits(e.reactions),legendary_actions:n.getTraits(e.legendaries),spells:n.getSpells(e.abilities)}}getHP(e){var n,r;if(e.customHP||e.hitDice&&/(\\d+) \\((.+)\\)/.test(e.hpText)){let[i,s,o]=(n=e.hpText.match(/(\\d+) \\((.+)\\)/))!=null?n:[];return{hp:s,dice:o}}if(e.hitDice){let i=Number(e.hitDice),s=(r=gn[e.size])!=null?r:gn.medium,o=this.modifiers.con,l=i*s/(2+.5)+o*i,u=o>0?"+":"-",a=o==0?"":` ${u} ${o*i}`;return{hp:l,dice:`${i}d${s}${a}`}}}getSpeedString(e){if(e.customSpeed)return e.speedDesc;let n=[e.speed+" ft."];return e.burrowSpeed>0&&n.push("burrow "+e.burrowSpeed+" ft."),e.climbSpeed>0&&n.push("climb "+e.climbSpeed+" ft."),e.flySpeed>0&&n.push("fly "+e.flySpeed+" ft."+(e.hover?" (hover)":"")),e.swimSpeed>0&&n.push("swim "+e.swimSpeed+" ft."),n.join(", ")}parseImmune(e,n){let r=[];"damagetypes"in e&&Array.isArray(e.damagetypes)&&r.push(...e.damagetypes.filter(s=>s.type==n).map(s=>s.name));let i=[];return"specialdamage"in e&&Array.isArray(e.specialdamage)&&i.push(...e.specialdamage.filter(s=>s.type==n).map(s=>s.name)),[r.join(", "),i.join(", ")].filter(s=>s&&s.length).join("; ")}getLanguages(e){let n=[],r=[],i=[];for(let s=0;s0&&n.push([r.slice(0,r.length-2).map(s=>s.name).join(", "),r.slice(-1).map(s=>s.name)].filter(s=>s).join(" and ")),i.length>0&&n.push([i.slice(0,i.length-2).map(s=>s.name).join(", "),i.slice(-1).map(s=>s.name)].filter(s=>s).join(" and ")),e.telepathy>0&&n.push("telepathy "+e.telepathy+" ft."),n.length==0&&n.push("—"),n.join("; ")}getSenses(e){let n=[];e.blindsight>0&&n.push("blindsight "+e.blindsight+" ft."+(e.blind?" (blind beyond this radius)":"")),e.darkvision>0&&n.push("darkvision "+e.darkvision+" ft."),e.tremorsense>0&&n.push("tremorsense "+e.tremorsense+" ft."),e.truesight>0&&n.push("truesight "+e.truesight+" ft.");let r=e.skills.find(s=>s.name=="perception"),i=10+K(e.wisPoints);return r!=null&&(i+=this.proficiency*("note"in r?2:1)),n.push("passive Perception "+i),n.join(", ")}transformString(e){return e.replace(/(_|\\*|\\s*>\\s*)/g,"").replace(/\\[MON(S)?\\]/g,`${this.monster.shortName&&this.monster.shortName.length?this.monster.shortName:this.monster.name}$1`).replace(/\\[(\\w+)\\]/g,(n,r)=>{if(r=r.toLowerCase(),!(r in this.modifiers))return n;let i=this.modifiers[r];return`${i>=0?"+":""}${i}`}).replace(/\\[(\\w+) (ATK|SAVE)\\s?(?:([+-])\\s?(\\d+))?\\]/g,(n,r,i="ATK",s="+",o=0)=>{if(r=r.toLowerCase(),!(r in this.modifiers))return n;o=s=="+"?Number(o):-Number(o);let l=(i=="ATK"?0:8)+this.modifiers[r]+this.proficiency+o;return`${l>=0?"+":""}${l}`}).replace(/\\[(\\w+)?\\s?(\\d*[dD]\\d+)\\s?(?:([+-])\\s?(\\d+))?\\]/g,(n,r,i,s="+",o=0)=>{var h;r=r.toLowerCase();let[,l=1,u]=(h=i.match(/(\\d*)[dD](\\d+)/))!=null?h:[];if(l||(l=1),!u)return n;o=s=="+"?Number(o):-Number(o),r in this.modifiers&&(o+=this.modifiers[r]);let a=Math.floor((u/2+.5)*l)+o,f=[`${l}d${u}`];return o&&o!=0&&(f.push(o>=0?"+":"-"),f.push(o)),`${a} (${f.join(" ")})`})}getTraits(e){return!e||!e.length?void 0:e.filter(r=>r.name!="Spellcasting").map(r=>({name:r.name,desc:this.transformString(r.desc)}))}getSpells(e){var i;if(!e.abilities||!e.abilities.length)return;let{desc:n}=(i=e.abilities.find(s=>s.name=="Spellcasting"))!=null?i:{};return n?this.transformString(n).trim().split(`\n`).filter(s=>s.length):void 0}getSaves(e){if(!("sthrows"in e)||!Array.isArray(e.sthrows)||!e.sthrows.length)return[];let n=this.proficiency,r=[];for(let i of e.sthrows){let s=i.name,o=K(Number(e[`${s}Points`]));isNaN(o)||r.push({[pa[s]]:o+n})}return r}getSkills(e){if(!("skills"in e)||!Array.isArray(e.skills)||!e.skills.length)return[];let n=[],r=this.proficiency;for(let i of e.skills){let s=i.stat,o=K(Number(e[`${s}Points`]));if(isNaN(o))continue;let l="note"in i;n.push({[i.name]:r+o+o*Number(l)})}return n}getProf(e){var r,i;let n=0;return e.cr=="*"&&(n=e.customProf),"cr"in e&&e.cr in hn&&(n=Math.max(Math.floor(2+(((i=(r=hn[e.cr])==null?void 0:r.value)!=null?i:0)-1)/4),2)),isNaN(Number(n))?0:Number(n)}parseConditions(e){if("conditions"in e&&Array.isArray(e.conditions))return e.conditions.map(n=>n.name).join(", ")}};async function dn(t){return new Promise((e,n)=>{let r=new FileReader,i=[];r.onload=async s=>{try{let o=JSON.parse(s.target.result),l;"monster"in o?l=o.monster:Array.isArray(o)?l=o:typeof o=="object"?l=[o]:n("Invalid monster JSON provided.");let u=[];for(let a of l)try{let f=be.parse(a);u.push(f)}catch(f){console.error(f);continue}e(u)}catch(o){console.error("reject!!!",o),n(o)}},r.readAsText(t)})}var tt=self;tt.onmessage=async t=>{if(!t.data)return;let{files:e,source:n}=t.data,r=[];for(let i of e)switch(n){case"5e":{let s=await pn(i);r.push(...s!=null?s:[]);break}case"critter":{let s=await mn(i);r.push(...s!=null?s:[]);break}case"improved":{let s=await fn(i);r.push(...s!=null?s:[]);break}case"appfile":{let s=await un(i);r.push(...s!=null?s:[]);break}case"tetra":{let s=await dn(i);r.push(...s!=null?s:[]);break}}tt.postMessage({monsters:r})};tt.addEventListener("unhandledrejection",function(t){throw t.reason});\n')}var Dt=require("obsidian");var ss=class extends Dt.Modal{constructor(){super(...arguments);this.saved=!1}display(){this.titleEl.createSpan({text:"Set Sources"}),new Dt.Setting(this.contentEl).setName("A source could not be found for some imported monsters. Do you wish to manually add one?").addText(t=>{t.setPlaceholder("Unknown").onChange(n=>{this.source=n})}),this.buildButtons(this.contentEl)}buildButtons(t){new Dt.Setting(t).addButton(n=>n.setCta().setIcon("checkmark").setTooltip("Save").onClick(()=>{this.saved=!0,this.close()})).addExtraButton(n=>n.setIcon("cross").setTooltip("Cancel").onClick(()=>{this.close()}))}onOpen(){this.display()}},xh=async a=>new Promise(e=>{let t=new ss(a);t.onClose=()=>{t.saved||e(null),e(t.source)},t.open()}),La=class{constructor(e){this.plugin=e;this.workers=new Map}async import(e,t){return new Promise(n=>{let i=new is,s=z();this.workers.set(s,i),i.onmessage=async r=>{let{monsters:c}=r.data??{monsters:[]};if(c){new Dt.Notice(`Successfully imported ${c.length} Monsters`);let o=c.filter(d=>d.source=="Unknown"||!d.source),l;o.length&&(l=await xh(this.plugin.app))&&o.forEach(d=>d.source=l)}i.terminate(),this.workers.delete(s),n(c)},i.onerror=r=>{new Dt.Notice(`There was an error importing the file. + +${r.message}`),i.terminate(),this.workers.delete(s),n([])},i.postMessage({files:e,source:t})})}};var _c=require("obsidian");var Rn=require("obsidian");var ye="top",Ee="bottom",xe="right",_e="left",In="auto",Et=[ye,Ee,xe,_e],yt="start",Gt="end",ec="clippingParents",Pn="viewport",ga="popper",tc="reference",rs=Et.reduce(function(a,e){return a.concat([e+"-"+yt,e+"-"+Gt])},[]),On=[].concat(Et,[In]).reduce(function(a,e){return a.concat([e,e+"-"+yt,e+"-"+Gt])},[]),Dh="beforeRead",Eh="read",Mh="afterRead",Ih="beforeMain",Ph="main",Oh="afterMain",Wh="beforeWrite",Nh="write",Hh="afterWrite",ac=[Dh,Eh,Mh,Ih,Ph,Oh,Wh,Nh,Hh];function Pe(a){return a?(a.nodeName||"").toLowerCase():null}function be(a){if(a==null)return window;if(a.toString()!=="[object Window]"){var e=a.ownerDocument;return e&&e.defaultView||window}return a}function tt(a){var e=be(a).Element;return a instanceof e||a instanceof Element}function Me(a){var e=be(a).HTMLElement;return a instanceof e||a instanceof HTMLElement}function fa(a){if(typeof ShadowRoot>"u")return!1;var e=be(a).ShadowRoot;return a instanceof e||a instanceof ShadowRoot}function Lh(a){var e=a.state;Object.keys(e.elements).forEach(function(t){var n=e.styles[t]||{},i=e.attributes[t]||{},s=e.elements[t];!Me(s)||!Pe(s)||(Object.assign(s.style,n),Object.keys(i).forEach(function(r){var c=i[r];c===!1?s.removeAttribute(r):s.setAttribute(r,c===!0?"":c)}))})}function Rh(a){var e=a.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(n){var i=e.elements[n],s=e.attributes[n]||{},r=Object.keys(e.styles.hasOwnProperty(n)?e.styles[n]:t[n]),c=r.reduce(function(o,l){return o[l]="",o},{});!Me(i)||!Pe(i)||(Object.assign(i.style,c),Object.keys(s).forEach(function(o){i.removeAttribute(o)}))})}}var nc={name:"applyStyles",enabled:!0,phase:"write",fn:Lh,effect:Rh,requires:["computeStyles"]};function Oe(a){return a.split("-")[0]}var ut=Math.max,Ut=Math.min,_t=Math.round;function pa(){var a=navigator.userAgentData;return a!=null&&a.brands?a.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function Ra(){return!/^((?!chrome|android).)*safari/i.test(pa())}function at(a,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var n=a.getBoundingClientRect(),i=1,s=1;e&&Me(a)&&(i=a.offsetWidth>0&&_t(n.width)/a.offsetWidth||1,s=a.offsetHeight>0&&_t(n.height)/a.offsetHeight||1);var r=tt(a)?be(a):window,c=r.visualViewport,o=!Ra()&&t,l=(n.left+(o&&c?c.offsetLeft:0))/i,d=(n.top+(o&&c?c.offsetTop:0))/s,u=n.width/i,m=n.height/s;return{width:u,height:m,top:d,right:l+u,bottom:d+m,left:l,x:l,y:d}}function Vt(a){var e=at(a),t=a.offsetWidth,n=a.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-n)<=1&&(n=e.height),{x:a.offsetLeft,y:a.offsetTop,width:t,height:n}}function Ba(a,e){var t=e.getRootNode&&e.getRootNode();if(a.contains(e))return!0;if(t&&fa(t)){var n=e;do{if(n&&a.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function $e(a){return be(a).getComputedStyle(a)}function os(a){return["table","td","th"].indexOf(Pe(a))>=0}function Le(a){return((tt(a)?a.ownerDocument:a.document)||window.document).documentElement}function wt(a){return Pe(a)==="html"?a:a.assignedSlot||a.parentNode||(fa(a)?a.host:null)||Le(a)}function ic(a){return!Me(a)||$e(a).position==="fixed"?null:a.offsetParent}function Bh(a){var e=/firefox/i.test(pa()),t=/Trident/i.test(pa());if(t&&Me(a)){var n=$e(a);if(n.position==="fixed")return null}var i=wt(a);for(fa(i)&&(i=i.host);Me(i)&&["html","body"].indexOf(Pe(i))<0;){var s=$e(i);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||e&&s.willChange==="filter"||e&&s.filter&&s.filter!=="none")return i;i=i.parentNode}return null}function ht(a){for(var e=be(a),t=ic(a);t&&os(t)&&$e(t).position==="static";)t=ic(t);return t&&(Pe(t)==="html"||Pe(t)==="body"&&$e(t).position==="static")?e:t||Bh(a)||e}function Kt(a){return["top","bottom"].indexOf(a)>=0?"x":"y"}function Yt(a,e,t){return ut(a,Ut(e,t))}function sc(a,e,t){var n=Yt(a,e,t);return n>t?t:n}function Fa(){return{top:0,right:0,bottom:0,left:0}}function za(a){return Object.assign({},Fa(),a)}function $a(a,e){return e.reduce(function(t,n){return t[n]=a,t},{})}var Fh=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,za(typeof e!="number"?e:$a(e,Et))};function zh(a){var e,t=a.state,n=a.name,i=a.options,s=t.elements.arrow,r=t.modifiersData.popperOffsets,c=Oe(t.placement),o=Kt(c),l=[_e,xe].indexOf(c)>=0,d=l?"height":"width";if(!(!s||!r)){var u=Fh(i.padding,t),m=Vt(s),h=o==="y"?ye:_e,b=o==="y"?Ee:xe,f=t.rects.reference[d]+t.rects.reference[o]-r[o]-t.rects.popper[d],k=r[o]-t.rects.reference[o],C=ht(s),w=C?o==="y"?C.clientHeight||0:C.clientWidth||0:0,W=f/2-k/2,E=u[h],y=w-m[d]-u[b],g=w/2-m[d]/2+W,p=Yt(E,g,y),v=o;t.modifiersData[n]=(e={},e[v]=p,e.centerOffset=p-g,e)}}function $h(a){var e=a.state,t=a.options,n=t.element,i=n===void 0?"[data-popper-arrow]":n;i!=null&&(typeof i=="string"&&(i=e.elements.popper.querySelector(i),!i)||!Ba(e.elements.popper,i)||(e.elements.arrow=i))}var rc={name:"arrow",enabled:!0,phase:"main",fn:zh,effect:$h,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function nt(a){return a.split("-")[1]}var jh={top:"auto",right:"auto",bottom:"auto",left:"auto"};function qh(a){var e=a.x,t=a.y,n=window,i=n.devicePixelRatio||1;return{x:_t(e*i)/i||0,y:_t(t*i)/i||0}}function oc(a){var e,t=a.popper,n=a.popperRect,i=a.placement,s=a.variation,r=a.offsets,c=a.position,o=a.gpuAcceleration,l=a.adaptive,d=a.roundOffsets,u=a.isFixed,m=r.x,h=m===void 0?0:m,b=r.y,f=b===void 0?0:b,k=typeof d=="function"?d({x:h,y:f}):{x:h,y:f};h=k.x,f=k.y;var C=r.hasOwnProperty("x"),w=r.hasOwnProperty("y"),W=_e,E=ye,y=window;if(l){var g=ht(t),p="clientHeight",v="clientWidth";if(g===be(t)&&(g=Le(t),$e(g).position!=="static"&&c==="absolute"&&(p="scrollHeight",v="scrollWidth")),g=g,i===ye||(i===_e||i===xe)&&s===Gt){E=Ee;var M=u&&g===y&&y.visualViewport?y.visualViewport.height:g[p];f-=M-n.height,f*=o?1:-1}if(i===_e||(i===ye||i===Ee)&&s===Gt){W=xe;var N=u&&g===y&&y.visualViewport?y.visualViewport.width:g[v];h-=N-n.width,h*=o?1:-1}}var T=Object.assign({position:c},l&&jh),P=d===!0?qh({x:h,y:f}):{x:h,y:f};if(h=P.x,f=P.y,o){var L;return Object.assign({},T,(L={},L[E]=w?"0":"",L[W]=C?"0":"",L.transform=(y.devicePixelRatio||1)<=1?"translate("+h+"px, "+f+"px)":"translate3d("+h+"px, "+f+"px, 0)",L))}return Object.assign({},T,(e={},e[E]=w?f+"px":"",e[W]=C?h+"px":"",e.transform="",e))}function Gh(a){var e=a.state,t=a.options,n=t.gpuAcceleration,i=n===void 0?!0:n,s=t.adaptive,r=s===void 0?!0:s,c=t.roundOffsets,o=c===void 0?!0:c;if(!1)var l;var d={placement:Oe(e.placement),variation:nt(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,oc(Object.assign({},d,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:r,roundOffsets:o})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,oc(Object.assign({},d,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:o})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}var cc={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Gh,data:{}};var Wn={passive:!0};function Uh(a){var e=a.state,t=a.instance,n=a.options,i=n.scroll,s=i===void 0?!0:i,r=n.resize,c=r===void 0?!0:r,o=be(e.elements.popper),l=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&l.forEach(function(d){d.addEventListener("scroll",t.update,Wn)}),c&&o.addEventListener("resize",t.update,Wn),function(){s&&l.forEach(function(d){d.removeEventListener("scroll",t.update,Wn)}),c&&o.removeEventListener("resize",t.update,Wn)}}var lc={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Uh,data:{}};var Vh={left:"right",right:"left",bottom:"top",top:"bottom"};function ba(a){return a.replace(/left|right|bottom|top/g,function(e){return Vh[e]})}var Kh={start:"end",end:"start"};function Nn(a){return a.replace(/start|end/g,function(e){return Kh[e]})}function Jt(a){var e=be(a),t=e.pageXOffset,n=e.pageYOffset;return{scrollLeft:t,scrollTop:n}}function Xt(a){return at(Le(a)).left+Jt(a).scrollLeft}function cs(a,e){var t=be(a),n=Le(a),i=t.visualViewport,s=n.clientWidth,r=n.clientHeight,c=0,o=0;if(i){s=i.width,r=i.height;var l=Ra();(l||!l&&e==="fixed")&&(c=i.offsetLeft,o=i.offsetTop)}return{width:s,height:r,x:c+Xt(a),y:o}}function ls(a){var e,t=Le(a),n=Jt(a),i=(e=a.ownerDocument)==null?void 0:e.body,s=ut(t.scrollWidth,t.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),r=ut(t.scrollHeight,t.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),c=-n.scrollLeft+Xt(a),o=-n.scrollTop;return $e(i||t).direction==="rtl"&&(c+=ut(t.clientWidth,i?i.clientWidth:0)-s),{width:s,height:r,x:c,y:o}}function Zt(a){var e=$e(a),t=e.overflow,n=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+i+n)}function Hn(a){return["html","body","#document"].indexOf(Pe(a))>=0?a.ownerDocument.body:Me(a)&&Zt(a)?a:Hn(wt(a))}function Mt(a,e){var t;e===void 0&&(e=[]);var n=Hn(a),i=n===((t=a.ownerDocument)==null?void 0:t.body),s=be(n),r=i?[s].concat(s.visualViewport||[],Zt(n)?n:[]):n,c=e.concat(r);return i?c:c.concat(Mt(wt(r)))}function ka(a){return Object.assign({},a,{left:a.x,top:a.y,right:a.x+a.width,bottom:a.y+a.height})}function Yh(a,e){var t=at(a,!1,e==="fixed");return t.top=t.top+a.clientTop,t.left=t.left+a.clientLeft,t.bottom=t.top+a.clientHeight,t.right=t.left+a.clientWidth,t.width=a.clientWidth,t.height=a.clientHeight,t.x=t.left,t.y=t.top,t}function dc(a,e,t){return e===Pn?ka(cs(a,t)):tt(e)?Yh(e,t):ka(ls(Le(a)))}function Jh(a){var e=Mt(wt(a)),t=["absolute","fixed"].indexOf($e(a).position)>=0,n=t&&Me(a)?ht(a):a;return tt(n)?e.filter(function(i){return tt(i)&&Ba(i,n)&&Pe(i)!=="body"}):[]}function ds(a,e,t,n){var i=e==="clippingParents"?Jh(a):[].concat(e),s=[].concat(i,[t]),r=s[0],c=s.reduce(function(o,l){var d=dc(a,l,n);return o.top=ut(d.top,o.top),o.right=Ut(d.right,o.right),o.bottom=Ut(d.bottom,o.bottom),o.left=ut(d.left,o.left),o},dc(a,r,n));return c.width=c.right-c.left,c.height=c.bottom-c.top,c.x=c.left,c.y=c.top,c}function ja(a){var e=a.reference,t=a.element,n=a.placement,i=n?Oe(n):null,s=n?nt(n):null,r=e.x+e.width/2-t.width/2,c=e.y+e.height/2-t.height/2,o;switch(i){case ye:o={x:r,y:e.y-t.height};break;case Ee:o={x:r,y:e.y+e.height};break;case xe:o={x:e.x+e.width,y:c};break;case _e:o={x:e.x-t.width,y:c};break;default:o={x:e.x,y:e.y}}var l=i?Kt(i):null;if(l!=null){var d=l==="y"?"height":"width";switch(s){case yt:o[l]=o[l]-(e[d]/2-t[d]/2);break;case Gt:o[l]=o[l]+(e[d]/2-t[d]/2);break;default:}}return o}function mt(a,e){e===void 0&&(e={});var t=e,n=t.placement,i=n===void 0?a.placement:n,s=t.strategy,r=s===void 0?a.strategy:s,c=t.boundary,o=c===void 0?ec:c,l=t.rootBoundary,d=l===void 0?Pn:l,u=t.elementContext,m=u===void 0?ga:u,h=t.altBoundary,b=h===void 0?!1:h,f=t.padding,k=f===void 0?0:f,C=za(typeof k!="number"?k:$a(k,Et)),w=m===ga?tc:ga,W=a.rects.popper,E=a.elements[b?w:m],y=ds(tt(E)?E:E.contextElement||Le(a.elements.popper),o,d,r),g=at(a.elements.reference),p=ja({reference:g,element:W,strategy:"absolute",placement:i}),v=ka(Object.assign({},W,p)),M=m===ga?v:g,N={top:y.top-M.top+C.top,bottom:M.bottom-y.bottom+C.bottom,left:y.left-M.left+C.left,right:M.right-y.right+C.right},T=a.modifiersData.offset;if(m===ga&&T){var P=T[i];Object.keys(N).forEach(function(L){var G=[xe,Ee].indexOf(L)>=0?1:-1,B=[ye,Ee].indexOf(L)>=0?"y":"x";N[L]+=P[B]*G})}return N}function us(a,e){e===void 0&&(e={});var t=e,n=t.placement,i=t.boundary,s=t.rootBoundary,r=t.padding,c=t.flipVariations,o=t.allowedAutoPlacements,l=o===void 0?On:o,d=nt(n),u=d?c?rs:rs.filter(function(b){return nt(b)===d}):Et,m=u.filter(function(b){return l.indexOf(b)>=0});m.length===0&&(m=u);var h=m.reduce(function(b,f){return b[f]=mt(a,{placement:f,boundary:i,rootBoundary:s,padding:r})[Oe(f)],b},{});return Object.keys(h).sort(function(b,f){return h[b]-h[f]})}function Xh(a){if(Oe(a)===In)return[];var e=ba(a);return[Nn(a),e,Nn(e)]}function Zh(a){var e=a.state,t=a.options,n=a.name;if(!e.modifiersData[n]._skip){for(var i=t.mainAxis,s=i===void 0?!0:i,r=t.altAxis,c=r===void 0?!0:r,o=t.fallbackPlacements,l=t.padding,d=t.boundary,u=t.rootBoundary,m=t.altBoundary,h=t.flipVariations,b=h===void 0?!0:h,f=t.allowedAutoPlacements,k=e.options.placement,C=Oe(k),w=C===k,W=o||(w||!b?[ba(k)]:Xh(k)),E=[k].concat(W).reduce(function($,Q){return $.concat(Oe(Q)===In?us(e,{placement:Q,boundary:d,rootBoundary:u,padding:l,flipVariations:b,allowedAutoPlacements:f}):Q)},[]),y=e.rects.reference,g=e.rects.popper,p=new Map,v=!0,M=E[0],N=0;N=0,B=G?"width":"height",te=mt(e,{placement:T,boundary:d,rootBoundary:u,altBoundary:m,padding:l}),F=G?L?xe:_e:L?Ee:ye;y[B]>g[B]&&(F=ba(F));var fe=ba(F),oe=[];if(s&&oe.push(te[P]<=0),c&&oe.push(te[F]<=0,te[fe]<=0),oe.every(function($){return $})){M=T,v=!1;break}p.set(T,oe)}if(v)for(var he=b?3:1,pe=function(Q){var ce=E.find(function(ne){var ke=p.get(ne);if(ke)return ke.slice(0,Q).every(function(Ge){return Ge})});if(ce)return M=ce,"break"},we=he;we>0;we--){var qe=pe(we);if(qe==="break")break}e.placement!==M&&(e.modifiersData[n]._skip=!0,e.placement=M,e.reset=!0)}}var uc={name:"flip",enabled:!0,phase:"main",fn:Zh,requiresIfExists:["offset"],data:{_skip:!1}};function hc(a,e,t){return t===void 0&&(t={x:0,y:0}),{top:a.top-e.height-t.y,right:a.right-e.width+t.x,bottom:a.bottom-e.height+t.y,left:a.left-e.width-t.x}}function mc(a){return[ye,xe,Ee,_e].some(function(e){return a[e]>=0})}function Qh(a){var e=a.state,t=a.name,n=e.rects.reference,i=e.rects.popper,s=e.modifiersData.preventOverflow,r=mt(e,{elementContext:"reference"}),c=mt(e,{altBoundary:!0}),o=hc(r,n),l=hc(c,i,s),d=mc(o),u=mc(l);e.modifiersData[t]={referenceClippingOffsets:o,popperEscapeOffsets:l,isReferenceHidden:d,hasPopperEscaped:u},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":u})}var gc={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Qh};function em(a,e,t){var n=Oe(a),i=[_e,ye].indexOf(n)>=0?-1:1,s=typeof t=="function"?t(Object.assign({},e,{placement:a})):t,r=s[0],c=s[1];return r=r||0,c=(c||0)*i,[_e,xe].indexOf(n)>=0?{x:c,y:r}:{x:r,y:c}}function tm(a){var e=a.state,t=a.options,n=a.name,i=t.offset,s=i===void 0?[0,0]:i,r=On.reduce(function(d,u){return d[u]=em(u,e.rects,s),d},{}),c=r[e.placement],o=c.x,l=c.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=o,e.modifiersData.popperOffsets.y+=l),e.modifiersData[n]=r}var fc={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:tm};function am(a){var e=a.state,t=a.name;e.modifiersData[t]=ja({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}var pc={name:"popperOffsets",enabled:!0,phase:"read",fn:am,data:{}};function hs(a){return a==="x"?"y":"x"}function nm(a){var e=a.state,t=a.options,n=a.name,i=t.mainAxis,s=i===void 0?!0:i,r=t.altAxis,c=r===void 0?!1:r,o=t.boundary,l=t.rootBoundary,d=t.altBoundary,u=t.padding,m=t.tether,h=m===void 0?!0:m,b=t.tetherOffset,f=b===void 0?0:b,k=mt(e,{boundary:o,rootBoundary:l,padding:u,altBoundary:d}),C=Oe(e.placement),w=nt(e.placement),W=!w,E=Kt(C),y=hs(E),g=e.modifiersData.popperOffsets,p=e.rects.reference,v=e.rects.popper,M=typeof f=="function"?f(Object.assign({},e.rects,{placement:e.placement})):f,N=typeof M=="number"?{mainAxis:M,altAxis:M}:Object.assign({mainAxis:0,altAxis:0},M),T=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,P={x:0,y:0};if(!!g){if(s){var L,G=E==="y"?ye:_e,B=E==="y"?Ee:xe,te=E==="y"?"height":"width",F=g[E],fe=F+k[G],oe=F-k[B],he=h?-v[te]/2:0,pe=w===yt?p[te]:v[te],we=w===yt?-v[te]:-p[te],qe=e.elements.arrow,$=h&&qe?Vt(qe):{width:0,height:0},Q=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Fa(),ce=Q[G],ne=Q[B],ke=Yt(0,p[te],$[te]),Ge=W?p[te]/2-he-ke-ce-N.mainAxis:pe-ke-ce-N.mainAxis,ya=W?-p[te]/2+he+ke+ne+N.mainAxis:we+ke+ne+N.mainAxis,It=e.elements.arrow&&ht(e.elements.arrow),st=It?E==="y"?It.clientTop||0:It.clientLeft||0:0,Je=(L=T?.[E])!=null?L:0,Pt=F+Ge-Je-st,Ic=F+ya-Je,xs=Yt(h?Ut(fe,Pt):fe,F,h?ut(oe,Ic):oe);g[E]=xs,P[E]=xs-F}if(c){var Ds,Pc=E==="x"?ye:_e,Oc=E==="x"?Ee:xe,Ot=g[y],Ga=y==="y"?"height":"width",Es=Ot+k[Pc],Ms=Ot-k[Oc],Gn=[ye,_e].indexOf(C)!==-1,Is=(Ds=T?.[y])!=null?Ds:0,Ps=Gn?Es:Ot-p[Ga]-v[Ga]-Is+N.altAxis,Os=Gn?Ot+p[Ga]+v[Ga]-Is-N.altAxis:Ms,Ws=h&&Gn?sc(Ps,Ot,Os):Yt(h?Ps:Es,Ot,h?Os:Ms);g[y]=Ws,P[y]=Ws-Ot}e.modifiersData[n]=P}}var bc={name:"preventOverflow",enabled:!0,phase:"main",fn:nm,requiresIfExists:["offset"]};function ms(a){return{scrollLeft:a.scrollLeft,scrollTop:a.scrollTop}}function gs(a){return a===be(a)||!Me(a)?Jt(a):ms(a)}function im(a){var e=a.getBoundingClientRect(),t=_t(e.width)/a.offsetWidth||1,n=_t(e.height)/a.offsetHeight||1;return t!==1||n!==1}function fs(a,e,t){t===void 0&&(t=!1);var n=Me(e),i=Me(e)&&im(e),s=Le(e),r=at(a,i,t),c={scrollLeft:0,scrollTop:0},o={x:0,y:0};return(n||!n&&!t)&&((Pe(e)!=="body"||Zt(s))&&(c=gs(e)),Me(e)?(o=at(e,!0),o.x+=e.clientLeft,o.y+=e.clientTop):s&&(o.x=Xt(s))),{x:r.left+c.scrollLeft-o.x,y:r.top+c.scrollTop-o.y,width:r.width,height:r.height}}function sm(a){var e=new Map,t=new Set,n=[];a.forEach(function(s){e.set(s.name,s)});function i(s){t.add(s.name);var r=[].concat(s.requires||[],s.requiresIfExists||[]);r.forEach(function(c){if(!t.has(c)){var o=e.get(c);o&&i(o)}}),n.push(s)}return a.forEach(function(s){t.has(s.name)||i(s)}),n}function ps(a){var e=sm(a);return ac.reduce(function(t,n){return t.concat(e.filter(function(i){return i.phase===n}))},[])}function bs(a){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(a())})})),e}}function ks(a){var e=a.reduce(function(t,n){var i=t[n.name];return t[n.name]=i?Object.assign({},i,n,{options:Object.assign({},i.options,n.options),data:Object.assign({},i.data,n.data)}):n,t},{});return Object.keys(e).map(function(t){return e[t]})}var kc={placement:"bottom",modifiers:[],strategy:"absolute"};function vc(){for(var a=arguments.length,e=new Array(a),t=0;t(this.setSelectedItem(this.selectedItem-1,!0),!1)),n.register([],"ArrowDown",()=>(this.setSelectedItem(this.selectedItem+1,!0),!1)),n.register([],"Enter",i=>(this.useSelectedItem(i),!1)),n.register([],"Tab",i=>(this.chooseSuggestion(i),!1))}chooseSuggestion(e){if(!this.items||!this.items.length)return;let t=this.items[this.selectedItem];t&&this.owner.onChooseSuggestion(t,e)}onSuggestionClick(e,t){if(e.preventDefault(),!this.suggestions||!this.suggestions.length)return;let n=this.suggestions.indexOf(t);this.setSelectedItem(n,!1),this.useSelectedItem(e)}onSuggestionMouseover(e,t){if(!this.suggestions||!this.suggestions.length)return;let n=this.suggestions.indexOf(t);this.setSelectedItem(n,!1)}empty(){this.containerEl.empty()}setSuggestions(e){this.containerEl.empty();let t=[];e.forEach(n=>{let i=this.containerEl.createDiv("suggestion-item");this.owner.renderSuggestion(n,i),t.push(i)}),this.items=e,this.suggestions=t,this.setSelectedItem(0,!1)}useSelectedItem(e){if(!this.items||!this.items.length)return;let t=this.items[this.selectedItem];t&&this.owner.selectSuggestion(t,e)}wrap(e,t){return(e%t+t)%t}setSelectedItem(e,t){let n=this.wrap(e,this.suggestions.length),i=this.suggestions[this.selectedItem],s=this.suggestions[n];i&&i.removeClass("is-selected"),s&&s.addClass("is-selected"),this.selectedItem=n,t&&s&&s.scrollIntoView(!1)}},Ln=class extends Rn.FuzzySuggestModal{constructor(t,n,i){super(t);this.items=[];this.scope=new Rn.Scope;this.emptyStateText="No match found";this.limit=100;this.inputEl=n,this.items=i,this.suggestEl=createDiv("suggestion-container"),this.contentEl=this.suggestEl.createDiv("suggestion"),this.suggester=new ys(this,this.contentEl,this.scope),this.scope.register([],"Escape",this.onEscape.bind(this)),this.inputEl.addEventListener("input",this.onInputChanged.bind(this)),this.inputEl.addEventListener("focus",this.onFocus.bind(this)),this.inputEl.addEventListener("blur",this.close.bind(this)),this.suggestEl.on("mousedown",".suggestion-container",s=>{s.preventDefault()})}empty(){this.suggester.empty()}onInputChanged(){if(this.shouldNotOpen)return;let t=this.modifyInput(this.inputEl.value),n=this.getSuggestions(t);n.length>0?this.suggester.setSuggestions(n.slice(0,this.limit)):this.onNoSuggestion(),this.open()}onFocus(){this.shouldNotOpen=!1,this.onInputChanged()}modifyInput(t){return t}onNoSuggestion(){this.empty(),this.renderSuggestion(null,this.contentEl.createDiv("suggestion-item"))}open(){this.app.keymap.pushScope(this.scope),document.body.appendChild(this.suggestEl),this.popper=vs(this.inputEl,this.suggestEl,{placement:"bottom-start",modifiers:[{name:"offset",options:{offset:[0,10]}},{name:"flip",options:{fallbackPlacements:["top"]}}]})}onEscape(){this.close(),this.shouldNotOpen=!0}close(){this.app.keymap.popScope(this.scope),this.suggester.setSuggestions([]),this.popper&&this.popper.destroy(),this.suggestEl.detach()}createPrompt(t){this.promptEl||(this.promptEl=this.suggestEl.createDiv("prompt-instructions"));let n=this.promptEl.createDiv("prompt-instruction");for(let i of t)n.appendChild(i)}};var Bn=class extends Ln{constructor(t,n,i){super(t,n.inputEl,i);this.folders=[...i],this.text=n,this.inputEl.addEventListener("input",()=>this.getFolder())}getFolder(){let t=this.inputEl.value,n=this.app.vault.getAbstractFileByPath(t);n!=this.folder&&n instanceof _c.TFolder&&(this.folder=n,this.onInputChanged())}getItemText(t){return t.path}onChooseItem(t){this.text.setValue(t.path),this.folder=t}selectSuggestion({item:t}){let n=t.path;this.text.setValue(n),this.onClose(),this.close()}renderSuggestion(t,n){let{item:i,match:s}=t||{},r=n.createDiv({cls:"suggestion-content"});if(!i){r.setText(this.emptyStateText),r.parentElement.addClass("is-selected");return}let c=i.path.length-i.name.length,o=s.matches.map(l=>createSpan("suggestion-highlight"));for(let l=c;lu[0]===l);if(d){let u=o[s.matches.indexOf(d)];r.appendChild(u),u.appendText(i.path.substring(d[0],d[1])),l+=d[1]-d[0]-1;continue}r.appendText(i.path[l])}n.createDiv({cls:"suggestion-note",text:i.path})}getItems(){return this.folders}};var om=[{type:"inline",id:z(),properties:[],hasRule:!0,nested:[{type:"group",id:z(),properties:["name","description","aspects","temporaryAspects"],nested:[{type:"heading",id:z(),properties:["name"],conditioned:!0,size:1},{type:"text",id:z(),properties:["description"],conditioned:!0,markdown:!0,text:null,dice:!1},{type:"text",id:z(),properties:["aspects"],markdown:!0,text:null,dice:!1,conditioned:!0,heading:"Aspects"},{type:"text",id:z(),properties:["temporaryAspects"],markdown:!0,text:null,dice:!1,conditioned:!0,heading:"Temporary Aspects"}],conditioned:!0},{type:"image",id:z(),properties:["image"],conditioned:!0}]},{type:"table",id:z(),properties:["stress"],headers:["Physical","Mental"],calculate:!1,hasRule:!0,conditioned:!0},{type:"traits",id:z(),properties:["consequences"],conditioned:!0,heading:"Consequences"},{type:"traits",id:z(),properties:["skills"],conditioned:!0,hasRule:!1,heading:"Skills"},{type:"traits",id:z(),properties:["stunts"],markdown:!0,dice:!1,conditioned:!0,heading:"Stunts"},{type:"traits",id:z(),properties:["items"],heading:"Items",conditioned:!0,markdown:!0,dice:!1},{type:"traits",id:z(),properties:["extras"],heading:"Extras",conditioned:!0,markdown:!0,dice:!1}],wc={blocks:om,name:"Basic Fate Core Layout"};var Fn=[bt,wc];var qa=class extends V.PluginSettingTab{constructor(t,n){super(t,n);this.plugin=n;this.results=[];this.displayed=new Set(this.plugin.sources);this.importer=new La(this.plugin)}async display(){try{let{containerEl:t}=this;t.empty(),t.addClass("statblock-settings"),t.createEl("h2",{text:"TTRPG Statblock Settings"}),this.generateTopSettings(t.createDiv()),this.generateParseSettings(t.createDiv()),this.generateLayouts(t.createDiv()),this.generateImports(t.createDiv()),this.generateMonsters(t.createDiv()),t.createDiv("coffee").createEl("a",{href:"https://www.buymeacoffee.com/valentine195"}).createEl("img",{attr:{src:"https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=\u2615&slug=valentine195&button_colour=e3e7ef&font_colour=262626&font_family=Inter&outline_colour=262626&coffee_colour=ff0000"}})}catch(t){console.error(t),new V.Notice("There was an error displaying the settings tab for 5e Statblocks.")}}generateTopSettings(t){t.empty(),new V.Setting(t).setHeading().setName("General Settings"),new V.Setting(t).setName("Enable Export to PNG").setDesc(createFragment(n=>{n.createSpan({text:'Add "Export to PNG" button by default. Use '}),n.createEl("code",{text:"export: false"}),n.createSpan({text:" to disable per-statblock."})})).setDisabled(!this.plugin.canUseDiceRoller).addToggle(n=>n.setValue(this.plugin.settings.useDice).onChange(async i=>{this.plugin.settings.useDice=i,await this.plugin.saveSettings()})),new V.Setting(t).setName("Integrate Dice Roller").setDesc(createFragment(n=>{this.plugin.canUseDiceRoller?(n.createSpan({text:"Add Dice Roller dice to statblocks by default. Use "}),n.createEl("code",{text:"dice: false"}),n.createSpan({text:" to disable per-statblock."})):n.createSpan({text:"This setting is only usable with the Dice Roller plugin enabled."})})).setDisabled(!this.plugin.canUseDiceRoller).addToggle(n=>n.setValue(this.plugin.settings.useDice).onChange(async i=>{this.plugin.settings.useDice=i,await this.plugin.saveSettings()})),new V.Setting(t).setName("Render Dice Rolls").setDesc(createFragment(n=>{this.plugin.canUseDiceRoller?(n.createSpan({text:"Roll graphical dice inside statblocks by default. Use "}),n.createEl("code",{text:"render: false"}),n.createSpan({text:" to disable per-statblock."})):n.createSpan({text:"This setting is only usable with the Dice Roller plugin enabled."})})).setDisabled(!this.plugin.canUseDiceRoller).addToggle(n=>n.setValue(this.plugin.settings.renderDice).onChange(async i=>{this.plugin.settings.renderDice=i,await this.plugin.saveSettings()})),new V.Setting(t).setName("Try to Render Wikilinks").setDesc(createFragment(n=>{n.createSpan({text:"The plugin will attempt to detect wikilinks inside Statblocks."}),n.createEl("br"),n.createEl("strong",{text:"Please note: these links will not be added to the graph."})})).addToggle(n=>n.setValue(this.plugin.settings.tryToRenderLinks).onChange(async i=>{this.plugin.settings.tryToRenderLinks=i,await this.plugin.saveSettings()})),new V.Setting(t).setName("Disable 5e SRD").setDesc(createFragment(n=>{n.createSpan({text:"Disable the Dungeons & Dragons 5th Edition System Reference Document monsters."})})).addToggle(n=>n.setValue(this.plugin.settings.disableSRD).onChange(async i=>{this.plugin.settings.disableSRD=i,await this.plugin.saveSettings()}))}generateParseSettings(t){t.empty();let n=t.createDiv("statblock-additional-container");new V.Setting(n).setHeading().setName("Note Parsing"),new V.Setting(n).setName("Parse Frontmatter for Creatures").setDesc(createFragment(r=>{r.createSpan({text:"The plugin will watch the vault for creatures defined in note frontmatter."}),r.createEl("br"),r.createEl("br"),r.createSpan({text:'The "Parse Frontmatter for Creatures" command can also be used.'})})).addToggle(r=>{r.setValue(this.plugin.settings.autoParse).onChange(async c=>{this.plugin.settings.autoParse=c,c&&this.plugin.watcher.start(),await this.plugin.saveSettings()})}),new V.Setting(n).setName("Enable Debug Messages").setDesc(createFragment(r=>{r.createSpan({text:"Debug messages will be displayed by the file parser."})})).addToggle(r=>r.setValue(this.plugin.settings.debug).onChange(async c=>{this.plugin.settings.debug=c,this.plugin.watcher.setDebug(),await this.plugin.saveSettings()}));let i;new V.Setting(n).setName("Bestiary Folder").setDesc("The plugin will only parse notes inside these folders and their children.").addText(async r=>{let c=this.app.vault.getAllLoadedFiles().filter(l=>l instanceof V.TFolder&&!this.plugin.settings.paths.includes(l.path));r.setPlaceholder("/");let o=new Bn(this.app,r,[...c]);o.onClose=async()=>{let l=r.inputEl.value?.trim()?r.inputEl.value.trim():"/";i=(0,V.normalizePath)(l)},r.inputEl.onblur=async()=>{let l=r.inputEl.value?.trim()?r.inputEl.value.trim():"/";i=(0,V.normalizePath)(l)}}).addExtraButton(r=>{r.setIcon("plus-with-circle").onClick(async()=>{!i||!i.length||(this.plugin.settings.paths.push((0,V.normalizePath)(i)),await this.plugin.saveSettings(),await this.plugin.watcher.reparseVault(),await this.generateParseSettings(t))})});let s=n.createDiv("additional");for(let r of this.plugin.settings.paths)new V.Setting(s).setName(r).addExtraButton(c=>c.setIcon("trash").onClick(async()=>{this.plugin.settings.paths=this.plugin.settings.paths.filter(o=>o!=r),await this.plugin.saveSettings(),await this.plugin.watcher.reparseVault(),await this.generateParseSettings(t)}))}generateLayouts(t){t.empty(),new V.Setting(t).setHeading().setName("Layouts");let n=t.createDiv("statblock-additional-container");n.createDiv("setting-item").createDiv().appendChild(createFragment(o=>{o.createSpan({text:"New statblock layouts can be created and managed here. A specific statblock can be used for a creature using the "}),o.createEl("code",{text:"statblock"}),o.createSpan({text:" parameter."})}));let i=new V.Setting(n).setName("Import From JSON").setDesc("Import a custom layout from a JSON file."),s=createEl("input",{attr:{type:"file",name:"layout",accept:".json",multiple:!0}});s.onchange=async()=>{let{files:o}=s;if(!!o.length)try{let{files:l}=s;if(!l.length)return;for(let d of Array.from(l))await new Promise((u,m)=>{let h=new FileReader;h.onload=b=>{try{let f=JSON.parse(b.target.result);if(!f){m(new Error("Invalid layout imported"));return}if(!f?.name){m(new Error("Invalid layout imported: layout does not have a name"));return}if(!f?.blocks){m(new Error("Invalid layout imported: no blocks defined in layout."));return}this.plugin.settings.layouts.push(this.getDuplicate(f)),u()}catch(f){m(f)}},h.readAsText(d)}).catch(u=>{new V.Notice(`There was an error importing the layout: + +${u}`),console.error(u)});await this.plugin.saveSettings(),this.buildCustomLayouts(c)}catch{}},i.addButton(o=>{o.setIcon("upload"),o.buttonEl.addClass("statblock-file-upload"),o.buttonEl.appendChild(s),o.onClick(()=>s.click())}),new V.Setting(n).setName("Add New Layout").addButton(o=>o.setIcon("plus-with-circle").setTooltip("Add New Statblock").onClick(()=>{let l=new zn(this.plugin);l.onClose=async()=>{!l.saved||(this.plugin.settings.layouts.push(this.getDuplicate(l.layout)),await this.plugin.saveSettings(),this.buildCustomLayouts(c))},l.open()}));let r=n.createDiv("additional");new V.Setting(r).setName("Default Layout").setDesc("Change the default statblock layout used, if not specified.").addDropdown(async o=>{for(let l of this.plugin.layouts)o.addOption(l.name,l.name);(!this.plugin.settings.default||!this.plugin.layouts.find(({name:l})=>l==this.plugin.settings.default))&&(this.plugin.settings.default=bt.name,await this.plugin.saveSettings()),o.setValue(this.plugin.settings.default??bt.name),o.onChange(async l=>{this.plugin.settings.default=l,await this.plugin.saveSettings()})}),new V.Setting(r).setName("Show Advanced Options").setDesc("Show advanced options when editing layout blocks.").addToggle(o=>o.setValue(this.plugin.settings.showAdvanced).onChange(async l=>{this.plugin.settings.showAdvanced=l,await this.plugin.saveSettings()}));let c=n.createDiv("additional");this.buildCustomLayouts(c)}getDuplicate(t){if(!this.plugin.layouts.find(c=>c.name==t.name)&&t.name!=bt.name)return t;let n=this.plugin.layouts.filter(c=>c.name.contains(`${t.name} Copy`)).map(c=>c.name),i=`${t.name} Copy`,s=i,r=1;for(;n.includes(s);)s=`${i} (${r})`,r++;return{blocks:(0,ws.default)(t.blocks),name:s}}buildCustomLayouts(t){t.empty();for(let n of Fn)new V.Setting(t).setName(n.name).addExtraButton(i=>{i.setIcon("duplicate-glyph").setTooltip("Create Copy").onClick(async()=>{this.plugin.settings.layouts.push(this.getDuplicate(n)),await this.plugin.saveSettings(),this.buildCustomLayouts(t)})});for(let n of this.plugin.settings.layouts)new V.Setting(t).setName(n.name).addExtraButton(i=>{i.setIcon("pencil").setTooltip("Edit").onClick(()=>{let s=new zn(this.plugin,n);s.onClose=async()=>{!s.saved||(this.plugin.settings.layouts.splice(this.plugin.settings.layouts.indexOf(n),1,s.layout),await this.plugin.saveSettings(),this.buildCustomLayouts(t))},s.open()})}).addExtraButton(i=>{i.setIcon("duplicate-glyph").setTooltip("Create Copy").onClick(async()=>{this.plugin.settings.layouts.push(this.getDuplicate(n)),await this.plugin.saveSettings(),this.buildCustomLayouts(t)})}).addExtraButton(i=>{i.setIcon("import-glyph").setTooltip("Export as JSON").onClick(()=>{let s=createEl("a"),r=new Blob([JSON.stringify(n)],{type:"json"}),c=URL.createObjectURL(r);s.href=c,s.download=`${n.name}.json`,s.click(),URL.revokeObjectURL(c)})}).addExtraButton(i=>{i.setIcon("trash").setTooltip("Delete").onClick(async()=>{this.plugin.settings.layouts=this.plugin.settings.layouts.filter(s=>s.name!==n.name),await this.plugin.saveSettings(),this.buildCustomLayouts(t)})})}generateImports(t){t.empty(),new V.Setting(t).setHeading().setName("Import Homebrew Creatures");let n=t.createDiv("statblock-additional-container");new V.Setting(n).setDesc("Import creatures from creature files. Monsters are stored by name, so only the last creature by that name will be saved. This is destructive - any saved creature will be overwritten.");let i=n.createDiv("additional"),s=new V.Setting(i).setName("Import DnDAppFile").setDesc("Only import content that you own."),r=createEl("input",{attr:{type:"file",name:"dndappfile",accept:".xml",multiple:!0}});r.onchange=async()=>{let{files:f}=r;if(!!f.length)try{let{files:k}=r;if(!k.length)return;let C=await this.importer.import(k,"appfile");C&&C.length&&await this.plugin.saveMonsters(C),this.display()}catch{}},s.addButton(f=>{f.setButtonText("Choose File(s)").setTooltip("Import DnDAppFile Data"),f.buttonEl.addClass("statblock-file-upload"),f.buttonEl.appendChild(r),f.onClick(()=>r.click())});let c=new V.Setting(i).setName("Import Improved Initiative Data").setDesc("Only import content that you own."),o=createEl("input",{attr:{type:"file",name:"improvedinitiative",accept:".json",multiple:!0}});o.onchange=async()=>{let{files:f}=o;if(!!f.length)try{let{files:k}=o;if(!k.length)return;let C=await this.importer.import(k,"improved");C&&C.length&&await this.plugin.saveMonsters(C),this.display()}catch{}},c.addButton(f=>{f.setButtonText("Choose File(s)").setTooltip("Import Improved Initiative Data"),f.buttonEl.addClass("statblock-file-upload"),f.buttonEl.appendChild(o),f.onClick(()=>o.click())});let l=new V.Setting(i).setName("Import CritterDB Data").setDesc("Only import content that you own."),d=createEl("input",{attr:{type:"file",name:"critterdb",accept:".json",multiple:!0}});d.onchange=async()=>{let{files:f}=d;if(!!f.length)try{let{files:k}=d;if(!k.length)return;let C=await this.importer.import(k,"critter");C&&C.length&&await this.plugin.saveMonsters(C),this.display()}catch{}},l.addButton(f=>{f.setButtonText("Choose File(s)").setTooltip("Import CritterDB Data"),f.buttonEl.addClass("statblock-file-upload"),f.buttonEl.appendChild(d),f.onClick(()=>d.click())});let u=new V.Setting(i).setName("Import 5e.tools Data").setDesc("Only import content that you own."),m=createEl("input",{attr:{type:"file",name:"fivetools",accept:".json",multiple:!0}});m.onchange=async()=>{let{files:f}=m;if(!f.length)return;let k=await this.importer.import(f,"5e");k&&k.length&&await this.plugin.saveMonsters(k),this.display()},u.addButton(f=>{f.setButtonText("Choose File(s)").setTooltip("Import 5e.tools Data"),f.buttonEl.addClass("statblock-file-upload"),f.buttonEl.appendChild(m),f.onClick(()=>m.click())});let h=new V.Setting(i).setName("Import TetraCube Data").setDesc("Only import content that you own."),b=createEl("input",{attr:{type:"file",name:"tetra",accept:".json, .monster",multiple:!0}});b.onchange=async()=>{let{files:f}=b;if(!f.length)return;let k=await this.importer.import(f,"tetra");k&&k.length&&await this.plugin.saveMonsters(k),this.display()},h.addButton(f=>{f.setButtonText("Choose File(s)").setTooltip("Import TetraCube Data"),f.buttonEl.addClass("statblock-file-upload"),f.buttonEl.appendChild(b),f.onClick(()=>b.click())})}generateMonsters(t){t.empty(),new V.Setting(t).setHeading().setName("Homebrew Creatures");let n=t.createDiv("statblock-additional-container statblock-monsters");new V.Setting(n).setName("Add Creature").addButton(u=>{u.setIcon("plus-with-circle").onClick(()=>{let m=new ma(this.plugin);m.onClose=()=>{this.generateMonsters(t)},m.open()})});let i=this.containerEl.closest(".statblock-settings"),{backgroundColor:s,paddingTop:r}=getComputedStyle(i),c=n.createDiv({cls:"statblock-monster-filter",attr:{style:`--statblock-filter-offset: ${r}; --statblock-filter-bg: ${s}`}});this.filter=new V.Setting(c).setClass("statblock-filter-container").addSearch(u=>{u.setPlaceholder("Search Monsters").onChange((0,V.debounce)(m=>{this.showSearchResults(d,m)},100))}).addExtraButton(u=>{u.setIcon("trash").setTooltip("Delete All Filtered Monsters").onClick(()=>{let m=new _s(this.results.length,this.plugin.app);m.onClose=async()=>{m.saved&&(await this.plugin.deleteMonsters(...this.results?.map(h=>h.name)??[]),this.generateMonsters(t))},m.open()})}),this.setFilterDesc();let o=c.createEl("details");o.createEl("summary",{text:"Filter Sources"});let l=o.createEl("ul","contains-task-list task-list-inline markdown-preview-view");for(let u of this.plugin.sources){let m=l.createEl("li","task-list-item");m.createEl("input",{attr:{id:"input_"+u,checked:!0},type:"checkbox",cls:"task-list-item-checkbox"}).onclick=h=>{h.target.checked?this.displayed.add(u):this.displayed.delete(u),this.showSearchResults(d,"")},m.createEl("label",{attr:{for:"input_"+u},text:u})}let d=n.createDiv("additional");if(!this.plugin.data.size){d.createDiv({attr:{style:"display: flex; justify-content: center; padding-bottom: 18px;"}}).createSpan({text:"No saved creatures! Create one to see it here."});return}setTimeout(()=>this.showSearchResults(d,""))}setFilterDesc(){this.filter.setDesc(createFragment(t=>{t.createSpan({text:`Managing ${this.plugin.settings.monsters.length} homebrew creature${this.plugin.settings.monsters.length==1?"":"s"}.`}),t.createEl("p",{attr:{style:"margin: 0;"}}).createEl("small",{text:`Displaying: ${this.results.length} homebrew creatures.`})}))}showSearchResults(t,n){t.empty();for(let i of this.performFuzzySearch(n)){let s=new V.Setting(t).setName(i.name),r,c=!1;if(Array.isArray(i.source)){let o=i.source.slice(0,4);i.source.length>4&&(o.push(`and ${i.source.length-4} more`),c=!0),r=Z(o,0,", ",!1)}else r=i.source;s.setDesc(r),c&&s.descEl.setAttr("aria-label",Z(i.source,0,", ",!1)),s.addExtraButton(o=>{o.setIcon("info").setTooltip("View").onClick(()=>{new Mn(this.plugin,i).open()})}).addExtraButton(o=>{o.setIcon("pencil").setTooltip("Edit").onClick(()=>{let l=new ma(this.plugin,i);l.open(),l.onClose=()=>{this.showSearchResults(t,n)}})}).addExtraButton(o=>{o.setIcon("trash").setTooltip("Delete").onClick(async()=>{await this.plugin.deleteMonster(i.name),this.showSearchResults(t,n)})})}this.setFilterDesc()}performFuzzySearch(t){let n=[];for(let i of this.plugin.sorted){if(!i.name&&!i.source||typeof i.source=="string"&&!this.displayed.has(i.source)||Array.isArray(i.source)&&!i.source.find(c=>this.displayed.has(c)))continue;let s=(0,V.prepareSimpleSearch)(t),r=s(i.name);!r&&i.source!=null&&(r=s(Z(i.source))),r&&n.push(i)}return this.results=n.slice(0,100),this.results}},zn=class extends V.Modal{constructor(t,n={name:"Layout",blocks:[]}){super(t.app);this.plugin=t;this.saved=!1;this.layout=(0,ws.default)(n)}onOpen(){this.display()}display(){this.titleEl.createSpan({text:"Create Layout"}),this.creator=new Xo({target:this.contentEl,props:{layout:this.layout,plugin:this.plugin}}),this.creator.$on("saved",()=>{this.saved=!0,this.close()}),this.creator.$on("cancel",()=>{this.close()})}},_s=class extends V.Modal{constructor(t,n){super(n);this.filtered=t;this.saved=!1}onOpen(){this.titleEl.setText("Are you sure?"),this.contentEl.createEl("p",{text:`This will delete ${this.filtered} creatures. This cannot be undone.`}),new V.Setting(this.contentEl).setClass("no-border-top").addButton(t=>{t.setIcon("checkmark").setCta().onClick(()=>{this.saved=!0,this.close()})}).addExtraButton(t=>t.setIcon("cross").onClick(()=>{this.saved=!0,this.close()}))}};var Ss=_a(xa());var Tc=function(a){return function(e,t,n){return a(e,t,n)*n}},As=function(a,e){if(a)throw Error("Invalid sort config: "+e)},Ac=function(a){var e=a||{},t=e.asc,n=e.desc,i=t?1:-1,s=t||n;As(!s,"Expected `asc` or `desc` property"),As(t&&n,"Ambiguous object with `asc` and `desc` config properties");var r=a.comparer&&Tc(a.comparer);return{order:i,sortBy:s,comparer:r}},cm=function(a){return function e(t,n,i,s,r,c,o){var l,d;if(typeof t=="string")l=c[t],d=o[t];else if(typeof t=="function")l=t(c),d=t(o);else{var u=Ac(t);return e(u.sortBy,n,i,u.order,u.comparer||a,c,o)}var m=r(l,d,s);return(m===0||l==null&&d==null)&&n.length>i?e(n[i],n,i+1,s,r,c,o):m}};function Cc(a,e,t){if(a===void 0||a===!0)return function(s,r){return e(s,r,t)};if(typeof a=="string")return As(a.includes("."),"String syntax not allowed for nested properties."),function(s,r){return e(s[a],r[a],t)};if(typeof a=="function")return function(s,r){return e(a(s),a(r),t)};if(Array.isArray(a)){var n=cm(e);return function(s,r){return n(a[0],a,1,t,e,s,r)}}var i=Ac(a);return Cc(i.sortBy,i.comparer||e,i.order)}var Ts=function(a,e,t,n){var i;return Array.isArray(e)?(Array.isArray(t)&&t.length<2&&(i=t,t=i[0]),e.sort(Cc(t,n,a))):e};function Sc(a){var e=Tc(a.comparer);return function(t){var n=Array.isArray(t)&&!a.inPlaceSorting?t.slice():t;return{asc:function(i){return Ts(1,n,i,e)},desc:function(i){return Ts(-1,n,i,e)},by:function(i){return Ts(1,n,i,e)}}}}var xc=function(a,e,t){return a==null?t:e==null?-t:ae?1:0},va=Sc({comparer:xc}),ev=Sc({comparer:xc,inPlaceSorting:!0});var it=require("obsidian");function Cs(){return Ha('var Nn=Object.create;var xt=Object.defineProperty;var On=Object.getOwnPropertyDescriptor;var An=Object.getOwnPropertyNames;var En=Object.getPrototypeOf,Ln=Object.prototype.hasOwnProperty;var In=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports),bs=(s,e)=>{for(var t in e)xt(s,t,{get:e[t],enumerable:!0})},Tn=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of An(e))!Ln.call(s,i)&&i!==t&&xt(s,i,{get:()=>e[i],enumerable:!(n=On(e,i))||n.enumerable});return s};var Cn=(s,e,t)=>(t=s!=null?Nn(En(s)):{},Tn(e||!s||!s.__esModule?xt(t,"default",{value:s,enumerable:!0}):t,s));var ws=In((Ut,Vt)=>{(function(s,e){typeof Ut=="object"&&typeof Vt!="undefined"?Vt.exports=e():typeof define=="function"&&define.amd?define(e):(s=typeof globalThis!="undefined"?globalThis:s||self,s["fast-copy"]=e())})(Ut,function(){"use strict";var s=Function.prototype.toString,e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,r=Object.getOwnPropertySymbols,o=Object.getPrototypeOf,a=Object.prototype,l=a.hasOwnProperty,c=a.propertyIsEnumerable,u=typeof r=="function",f=typeof WeakMap=="function",h=function(){if(f)return function(){return new WeakMap};var y=function(){function m(){this._keys=[],this._values=[]}return m.prototype.has=function(L){return!!~this._keys.indexOf(L)},m.prototype.get=function(L){return this._values[this._keys.indexOf(L)]},m.prototype.set=function(L,E){this._keys.push(L),this._values.push(E)},m}();return function(){return new y}}(),d=function(y,m){var L=y.__proto__||o(y);if(!L)return e(null);var E=L.constructor;if(E===m.Object)return L===m.Object.prototype?{}:e(L);if(~s.call(E).indexOf("[native code]"))try{return new E}catch(_){}return e(L)},w=function(y,m,L,E){var _=d(y,m);E.set(y,_);for(var B in y)l.call(y,B)&&(_[B]=L(y[B],E));if(u)for(var S=r(y),D=0,q=S.length,$=void 0;D{let t=[];if(e==5||!s||s==null)return"";if(typeof s=="string")return s;if(typeof s=="number")return`${s}`;if(Array.isArray(s))t.push(`${s.map(n=>xe(n,e++)).join(" ")}`);else if(typeof s=="object")for(let[n,i]of Object.entries(s))t.push(xe(n,e++),xe(i,e++));return t.join(" ")};function Ie(s=[],e=[]){s||(s=[]),Array.isArray(s)||(s=[s]),e||(e=[]),Array.isArray(e)||(e=[e]);for(let t of e!=null?e:[])if(t)if(Array.isArray(t)){let n=xe(t.slice(1));s=s.filter(i=>i.name!=t[0]&&i.desc!=n),s.push({name:t[0],desc:n})}else typeof t=="object"&&("name"in t||"desc"in t)&&(s=s.filter(n=>n.name!=t.name||n.desc!=t.desc),s.push({name:t.name,desc:xe(t.desc)}));return s}var gs={};bs(gs,{Alias:()=>ae,CST:()=>hs,Composer:()=>Ee,Document:()=>z,Lexer:()=>qe,LineCounter:()=>Ke,Pair:()=>v,Parser:()=>Le,Scalar:()=>N,Schema:()=>ke,YAMLError:()=>De,YAMLMap:()=>j,YAMLParseError:()=>Y,YAMLSeq:()=>x,YAMLWarning:()=>je,isAlias:()=>G,isCollection:()=>M,isDocument:()=>ge,isMap:()=>V,isNode:()=>C,isPair:()=>T,isScalar:()=>I,isSeq:()=>Q,parse:()=>gn,parseAllDocuments:()=>mn,parseDocument:()=>ms,stringify:()=>yn,visit:()=>H,visitAsync:()=>Ue});var at=Symbol.for("yaml.alias"),lt=Symbol.for("yaml.document"),ee=Symbol.for("yaml.map"),Jt=Symbol.for("yaml.pair"),W=Symbol.for("yaml.scalar"),fe=Symbol.for("yaml.seq"),U=Symbol.for("yaml.node.type"),G=s=>!!s&&typeof s=="object"&&s[U]===at,ge=s=>!!s&&typeof s=="object"&&s[U]===lt,V=s=>!!s&&typeof s=="object"&&s[U]===ee,T=s=>!!s&&typeof s=="object"&&s[U]===Jt,I=s=>!!s&&typeof s=="object"&&s[U]===W,Q=s=>!!s&&typeof s=="object"&&s[U]===fe;function M(s){if(s&&typeof s=="object")switch(s[U]){case ee:case fe:return!0}return!1}function C(s){if(s&&typeof s=="object")switch(s[U]){case at:case ee:case W:case fe:return!0}return!1}var Ss=s=>(I(s)||M(s))&&!!s.anchor,me=class{constructor(e){Object.defineProperty(this,U,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}};var J=Symbol("break visit"),ks=Symbol("skip children"),oe=Symbol("remove node");function H(s,e){let t=Ns(e);ge(s)?Te(null,s.contents,t,Object.freeze([s]))===oe&&(s.contents=null):Te(null,s,t,Object.freeze([]))}H.BREAK=J;H.SKIP=ks;H.REMOVE=oe;function Te(s,e,t,n){let i=Os(s,e,t,n);if(C(i)||T(i))return As(s,n,i),Te(s,i,t,n);if(typeof i!="symbol"){if(M(e)){n=Object.freeze(n.concat(e));for(let r=0;rs.replace(/[!,[\\]{}]/g,e=>Mn[e]),F=class{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},F.defaultYaml,e),this.tags=Object.assign({},F.defaultTags,t)}clone(){let e=new F(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new F(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:F.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},F.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:F.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},F.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \\t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[r,o]=n;return this.tags[r]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;let[r]=n;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{let o=/^\\d+\\.\\d+$/.test(r);return t(6,`Unsupported YAML version ${r}`,o),!1}}default:return t(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(t(`Verbatim tags aren\'t resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),o)}let[,n,i]=e.match(/^(.*!)([^!]*)$/);i||t(`The ${e} tag has no suffix`);let r=this.tags[n];return r?r+decodeURIComponent(i):n==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+$n(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&C(e.contents)){let r={};H(e.contents,(o,a)=>{C(a)&&a.tag&&(r[a.tag]=!0)}),i=Object.keys(r)}else i=[];for(let[r,o]of n)r==="!!"&&o==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(o)))&&t.push(`%TAG ${r} ${o}`);return t.join(`\n`)}};F.defaultYaml={explicit:!1,version:"1.2"};F.defaultTags={"!!":"tag:yaml.org,2002:"};function ct(s){if(/[\\x00-\\x19\\s,[\\]{}]/.test(s)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(t)}return!0}function Yt(s){let e=new Set;return H(s,{Value(t,n){n.anchor&&e.add(n.anchor)}}),e}function Wt(s,e){for(let t=1;;++t){let n=`${s}${t}`;if(!e.has(n))return n}}function Es(s,e){let t=[],n=new Map,i=null;return{onAnchor:r=>{t.push(r),i||(i=Yt(s));let o=Wt(e,i);return i.add(o),o},setAnchors:()=>{for(let r of t){let o=n.get(r);if(typeof o=="object"&&o.anchor&&(I(o.node)||M(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=r,a}}},sourceObjects:n}}var ae=class extends me{constructor(e){super(at),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e){let t;return H(e,{Node:(n,i)=>{if(i===this)return H.BREAK;i.anchor===this.source&&(t=i)}}),t}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:r}=t,o=this.resolve(i);if(!o){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=n.get(o);if(!a||a.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(r>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=ft(i,o,n)),a.count*a.aliasCount>r)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(e,t,n){let i=`*${this.source}`;if(e){if(ct(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(e.implicitKey)return`${i} `}return i}};function ft(s,e,t){if(G(e)){let n=e.resolve(s),i=t&&n&&t.get(n);return i?i.count*i.aliasCount:0}else if(M(e)){let n=0;for(let i of e.items){let r=ft(s,i,t);r>n&&(n=r)}return n}else if(T(e)){let n=ft(s,e.key,t),i=ft(s,e.value,t);return Math.max(n,i)}return 1}function R(s,e,t){if(Array.isArray(s))return s.map((n,i)=>R(n,String(i),t));if(s&&typeof s.toJSON=="function"){if(!t||!Ss(s))return s.toJSON(e,t);let n={aliasCount:0,count:1,res:void 0};t.anchors.set(s,n),t.onCreate=r=>{n.res=r,delete t.onCreate};let i=s.toJSON(e,t);return t.onCreate&&t.onCreate(i),i}return typeof s=="bigint"&&!(t!=null&&t.keep)?Number(s):s}var ut=s=>!s||typeof s!="function"&&typeof s!="object",N=class extends me{constructor(e){super(W),this.value=e}toJSON(e,t){return t!=null&&t.keep?this.value:R(this.value,e,t)}toString(){return String(this.value)}};N.BLOCK_FOLDED="BLOCK_FOLDED";N.BLOCK_LITERAL="BLOCK_LITERAL";N.PLAIN="PLAIN";N.QUOTE_DOUBLE="QUOTE_DOUBLE";N.QUOTE_SINGLE="QUOTE_SINGLE";var _n="tag:yaml.org,2002:";function Pn(s,e,t){var n;if(e){let i=t.filter(o=>o.tag===e),r=(n=i.find(o=>!o.format))!=null?n:i[0];if(!r)throw new Error(`Tag ${e} not found`);return r}return t.find(i=>{var r;return((r=i.identify)==null?void 0:r.call(i,s))&&!i.format})}function ue(s,e,t){var f,h;if(ge(s)&&(s=s.contents),C(s))return s;if(T(s)){let d=(h=(f=t.schema[ee]).createNode)==null?void 0:h.call(f,t.schema,null,t);return d.items.push(s),d}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt!="undefined"&&s instanceof BigInt)&&(s=s.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:r,schema:o,sourceObjects:a}=t,l;if(n&&s&&typeof s=="object"){if(l=a.get(s),l)return l.anchor||(l.anchor=i(s)),new ae(l.anchor);l={anchor:null,node:null},a.set(s,l)}e!=null&&e.startsWith("!!")&&(e=_n+e.slice(2));let c=Pn(s,e,o.tags);if(!c){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){let d=new N(s);return l&&(l.node=d),d}c=s instanceof Map?o[ee]:Symbol.iterator in Object(s)?o[fe]:o[ee]}r&&(r(c),delete t.onTagObj);let u=c!=null&&c.createNode?c.createNode(t.schema,s,t):new N(s);return e&&(u.tag=e),l&&(l.node=u),u}function Ve(s,e,t){let n=t;for(let i=e.length-1;i>=0;--i){let r=e[i];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){let o=[];o[r]=n,n=o}else n=new Map([[r,n]])}return ue(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:s,sourceObjects:new Map})}var Me=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done,he=class extends me{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(n=>C(n)||T(n)?n.clone(e):n),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Me(e))this.add(t);else{let[n,...i]=e,r=this.get(n,!0);if(M(r))r.addIn(i,t);else if(r===void 0&&this.schema)this.set(n,Ve(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let i=this.get(t,!0);if(M(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...i]=e,r=this.get(n,!0);return i.length===0?!t&&I(r)?r.value:r:M(r)?r.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!T(t))return!1;let n=t.value;return n==null||e&&I(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let i=this.get(t,!0);return M(i)?i.hasIn(n):!1}setIn(e,t){let[n,...i]=e;if(i.length===0)this.set(n,t);else{let r=this.get(n,!0);if(M(r))r.setIn(i,t);else if(r===void 0&&this.schema)this.set(n,Ve(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};he.maxFlowStringSingleLineLength=60;var Ls=s=>s.replace(/^(?!$)(?: $)?/gm,"#");function X(s,e){return/^\\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}var te=(s,e,t)=>s.endsWith(`\n`)?X(t,e):t.includes(`\n`)?`\n`+X(t,e):(s.endsWith(" ")?"":" ")+t;var Gt="flow",ht="block",Je="quoted";function Ye(s,e,t="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:r=20,onFold:o,onOverflow:a}={}){if(!i||i<0)return s;let l=Math.max(1+r,1+i-e.length);if(s.length<=l)return s;let c=[],u={},f=i-e.length;typeof n=="number"&&(n>i-Math.max(2,r)?c.push(0):f=i-n);let h,d,w=!1,p=-1,g=-1,k=-1;t===ht&&(p=Is(s,p),p!==-1&&(f=p+l));for(let O;O=s[p+=1];){if(t===Je&&O==="\\\\"){switch(g=p,s[p+1]){case"x":p+=3;break;case"u":p+=5;break;case"U":p+=9;break;default:p+=1}k=p}if(O===`\n`)t===ht&&(p=Is(s,p)),f=p+l,h=void 0;else{if(O===" "&&d&&d!==" "&&d!==`\n`&&d!==" "){let A=s[p+1];A&&A!==" "&&A!==`\n`&&A!==" "&&(h=p)}if(p>=f)if(h)c.push(h),f=h+l,h=void 0;else if(t===Je){for(;d===" "||d===" ";)d=O,O=s[p+=1],w=!0;let A=p>k+1?p-2:g-1;if(u[A])return s;c.push(A),u[A]=!0,f=A+l,h=void 0}else w=!0}d=O}if(w&&a&&a(),c.length===0)return s;o&&o();let b=s.slice(0,c[0]);for(let O=0;O({indentAtStart:s.indentAtStart,lineWidth:s.options.lineWidth,minContentWidth:s.options.minContentWidth}),mt=s=>/^(%|---|\\.\\.\\.)/m.test(s);function vn(s,e,t){if(!e||e<0)return!1;let n=e-t,i=s.length;if(i<=n)return!1;for(let r=0,o=0;rn)return!0;if(o=r+1,i-o<=n)return!1}return!0}function We(s,e){let t=JSON.stringify(s);if(e.options.doubleQuotedAsJSON)return t;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,r=e.indent||(mt(s)?" ":""),o="",a=0;for(let l=0,c=t[l];c;c=t[++l])if(c===" "&&t[l+1]==="\\\\"&&t[l+2]==="n"&&(o+=t.slice(a,l)+"\\\\ ",l+=1,a=l,c="\\\\"),c==="\\\\")switch(t[l+1]){case"u":{o+=t.slice(a,l);let u=t.substr(l+2,4);switch(u){case"0000":o+="\\\\0";break;case"0007":o+="\\\\a";break;case"000b":o+="\\\\v";break;case"001b":o+="\\\\e";break;case"0085":o+="\\\\N";break;case"00a0":o+="\\\\_";break;case"2028":o+="\\\\L";break;case"2029":o+="\\\\P";break;default:u.substr(0,2)==="00"?o+="\\\\x"+u.substr(2):o+=t.substr(l,6)}l+=5,a=l+1}break;case"n":if(n||t[l+2]===\'"\'||t.length\n`;let f,h;for(h=t.length;h>0;--h){let m=t[h-1];if(m!==`\n`&&m!==" "&&m!==" ")break}let d=t.substring(h),w=d.indexOf(`\n`);w===-1?f="-":t===d||w!==d.length-1?(f="+",r&&r()):f="",d&&(t=t.slice(0,-d.length),d[d.length-1]===`\n`&&(d=d.slice(0,-1)),d=d.replace(/\\n+(?!\\n|$)/g,`$&${c}`));let p=!1,g,k=-1;for(g=0;g")+(p?c?"2":"1":"")+f;if(s&&(A+=" "+a(s.replace(/ ?[\\r\\n]+/g," ")),i&&i()),u)return t=t.replace(/\\n+/g,`$&${c}`),`${A}\n${c}${b}${t}${d}`;t=t.replace(/\\n+/g,`\n$&`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,"$1$2").replace(/\\n+/g,`$&${c}`);let y=Ye(`${b}${t}${d}`,c,ht,dt(n));return`${A}\n${c}${y}`}function Bn(s,e,t,n){let{type:i,value:r}=s,{actualString:o,implicitKey:a,indent:l,indentStep:c,inFlow:u}=e;if(a&&/[\\n[\\]{},]/.test(r)||u&&/[[\\]{},]/.test(r))return $e(r,e);if(!r||/^[\\n\\t ,[\\]{}#&*!|>\'"%@`]|^[?-]$|^[?-][ \\t]|[\\n:][ \\t]|[ \\t]\\n|[\\n\\t ]#|[\\n\\t :]$/.test(r))return a||u||!r.includes(`\n`)?$e(r,e):pt(s,e,t,n);if(!a&&!u&&i!==N.PLAIN&&r.includes(`\n`))return pt(s,e,t,n);if(mt(r)){if(l==="")return e.forceBlockIndent=!0,pt(s,e,t,n);if(a&&l===c)return $e(r,e)}let f=r.replace(/\\n+/g,`$&\n${l}`);if(o){let h=p=>{var g;return p.default&&p.tag!=="tag:yaml.org,2002:str"&&((g=p.test)==null?void 0:g.test(f))},{compat:d,tags:w}=e.doc.schema;if(w.some(h)||d!=null&&d.some(h))return $e(r,e)}return a?f:Ye(f,l,Gt,dt(e))}function pe(s,e,t,n){let{implicitKey:i,inFlow:r}=e,o=typeof s.value=="string"?s:Object.assign({},s,{value:String(s.value)}),{type:a}=s;a!==N.QUOTE_DOUBLE&&/[\\x00-\\x08\\x0b-\\x1f\\x7f-\\x9f\\u{D800}-\\u{DFFF}]/u.test(o.value)&&(a=N.QUOTE_DOUBLE);let l=u=>{switch(u){case N.BLOCK_FOLDED:case N.BLOCK_LITERAL:return i||r?$e(o.value,e):pt(o,e,t,n);case N.QUOTE_DOUBLE:return We(o.value,e);case N.QUOTE_SINGLE:return Qt(o.value,e);case N.PLAIN:return Bn(o,e,t,n);default:return null}},c=l(a);if(c===null){let{defaultKeyType:u,defaultStringType:f}=e.options,h=i&&u||f;if(c=l(h),c===null)throw new Error(`Unsupported default string type ${h}`)}return c}function gt(s,e){let t=Object.assign({blockQuote:!0,commentString:Ls,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trueStr:"true",verifyAliasOrder:!0},s.schema.toStringOptions,e),n;switch(t.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:s,flowCollectionPadding:t.flowCollectionPadding?" ":"",indent:"",indentStep:typeof t.indent=="number"?" ".repeat(t.indent):" ",inFlow:n,options:t}}function Dn(s,e){var i,r,o,a;if(e.tag){let l=s.filter(c=>c.tag===e.tag);if(l.length>0)return(i=l.find(c=>c.format===e.format))!=null?i:l[0]}let t,n;if(I(e)){n=e.value;let l=s.filter(c=>{var u;return(u=c.identify)==null?void 0:u.call(c,n)});t=(r=l.find(c=>c.format===e.format))!=null?r:l.find(c=>!c.format)}else n=e,t=s.find(l=>l.nodeClass&&n instanceof l.nodeClass);if(!t){let l=(a=(o=n==null?void 0:n.constructor)==null?void 0:o.name)!=null?a:typeof n;throw new Error(`Tag not resolved for ${l} value`)}return t}function jn(s,e,{anchors:t,doc:n}){if(!n.directives)return"";let i=[],r=(I(s)||M(s))&&s.anchor;r&&ct(r)&&(t.add(r),i.push(`&${r}`));let o=s.tag?s.tag:e.default?null:e.tag;return o&&i.push(n.directives.tagString(o)),i.join(" ")}function se(s,e,t,n){var l,c;if(T(s))return s.toString(e,t,n);if(G(s)){if(e.doc.directives)return s.toString(e);if((l=e.resolvedAliases)!=null&&l.has(s))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(s):e.resolvedAliases=new Set([s]),s=s.resolve(e.doc)}let i,r=C(s)?s:e.doc.createNode(s,{onTagObj:u=>i=u});i||(i=Dn(e.doc.schema.tags,r));let o=jn(r,i,e);o.length>0&&(e.indentAtStart=((c=e.indentAtStart)!=null?c:0)+o.length+1);let a=typeof i.stringify=="function"?i.stringify(r,e,t,n):I(r)?pe(r,e,t,n):r.toString(e,t,n);return o?I(r)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}\n${e.indent}${a}`:a}function Ts({key:s,value:e},t,n,i){var L,E;let{allNullValues:r,doc:o,indent:a,indentStep:l,options:{commentString:c,indentSeq:u,simpleKeys:f}}=t,h=C(s)&&s.comment||null;if(f){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(M(s)){let _="With simple keys, collection cannot be used as a key value";throw new Error(_)}}let d=!f&&(!s||h&&e==null&&!t.inFlow||M(s)||(I(s)?s.type===N.BLOCK_FOLDED||s.type===N.BLOCK_LITERAL:typeof s=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!d&&(f||!r),indent:a+l});let w=!1,p=!1,g=se(s,t,()=>w=!0,()=>p=!0);if(!d&&!t.inFlow&&g.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");d=!0}if(t.inFlow){if(r||e==null)return w&&n&&n(),g===""?"?":d?`? ${g}`:g}else if(r&&!f||e==null&&d)return g=`? ${g}`,h&&!w?g+=te(g,t.indent,c(h)):p&&i&&i(),g;w&&(h=null),d?(h&&(g+=te(g,t.indent,c(h))),g=`? ${g}\n${a}:`):(g=`${g}:`,h&&(g+=te(g,t.indent,c(h))));let k,b,O;C(e)?(k=!!e.spaceBefore,b=e.commentBefore,O=e.comment):(k=!1,b=null,O=null,e&&typeof e=="object"&&(e=o.createNode(e))),t.implicitKey=!1,!d&&!h&&I(e)&&(t.indentAtStart=g.length+1),p=!1,!u&&l.length>=2&&!t.inFlow&&!d&&Q(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let A=!1,y=se(e,t,()=>A=!0,()=>p=!0),m=" ";if(h||k||b){if(m=k?`\n`:"",b){let _=c(b);m+=`\n${X(_,t.indent)}`}y===""&&!t.inFlow?m===`\n`&&(m=`\n\n`):m+=`\n${t.indent}`}else if(!d&&M(e)){let _=y[0],B=y.indexOf(`\n`),S=B!==-1,D=(E=(L=t.inFlow)!=null?L:e.flow)!=null?E:e.items.length===0;if(S||!D){let q=!1;if(S&&(_==="&"||_==="!")){let $=y.indexOf(" ");_==="&"&&$!==-1&&$s===Cs||I(s)&&s.value===Cs&&(!s.type||s.type===N.PLAIN);function Ht(s,e,t){let n=s&&G(t)?t.resolve(s.doc):t;if(!V(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,s,Map);for(let[r,o]of i)e instanceof Map?e.has(r)||e.set(r,o):e instanceof Set?e.add(r):Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function qn(s,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(C(s)&&t&&t.doc){let n=gt(t.doc,{});n.anchors=new Set;for(let r of t.anchors.keys())n.anchors.add(r.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=s.toString(n);if(!t.mapKeyWarned){let r=JSON.stringify(i);r.length>40&&(r=r.substring(0,36)+\'..."\'),yt(t.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),t.mapKeyWarned=!0}return i}return JSON.stringify(e)}function _e(s,e,t){let n=ue(s,void 0,t),i=ue(e,void 0,t);return new v(n,i)}var v=class{constructor(e,t=null){Object.defineProperty(this,U,{value:Jt}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return C(t)&&(t=t.clone(e)),C(n)&&(n=n.clone(e)),new v(t,n)}toJSON(e,t){let n=t!=null&&t.mapAsMap?new Map:{};return bt(t,n,this)}toString(e,t,n){return e!=null&&e.doc?Ts(this,e,t,n):JSON.stringify(this)}};function St(s,e,t){var r;return(((r=e.inFlow)!=null?r:s.flow)?Rn:Kn)(s,e,t)}function Kn({comment:s,items:e},t,{blockItemPrefix:n,flowChars:i,itemIndent:r,onChompKeep:o,onComment:a}){let{indent:l,options:{commentString:c}}=t,u=Object.assign({},t,{indent:r,type:null}),f=!1,h=[];for(let w=0;wg=null,()=>f=!0);g&&(k+=te(k,r,c(g))),f&&g&&(f=!1),h.push(n+k)}let d;if(h.length===0)d=i.start+i.end;else{d=h[0];for(let w=1;wO=null);kh||A.includes(`\n`))&&(f=!0),d.push(A),h=d.length}let w,{start:p,end:g}=n;if(d.length===0)w=p+g;else if(f||(f=d.reduce((b,O)=>b+O.length+2,2)>he.maxFlowStringSingleLineLength),f){w=p;for(let k of d)w+=k?`\n${a}${o}${k}`:`\n`;w+=`\n${o}${g}`}else w=`${p}${l}${d.join(" ")}${l}${g}`;return s&&(w+=te(w,c(s),o),r&&r()),w}function wt({indent:s,options:{commentString:e}},t,n,i){if(n&&i&&(n=n.replace(/^\\n+/,"")),n){let r=X(e(n),s);t.push(r.trimStart())}}function ye(s,e){let t=I(e)?e.value:e;for(let n of s)if(T(n)&&(n.key===e||n.key===t||I(n.key)&&n.key.value===t))return n}var j=class extends he{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(ee,e),this.items=[]}add(e,t){var o;let n;T(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new v(e,e==null?void 0:e.value):n=new v(e.key,e.value);let i=ye(this.items,n.key),r=(o=this.schema)==null?void 0:o.sortMapEntries;if(i){if(!t)throw new Error(`Key ${n.key} already set`);I(i.value)&&ut(n.value)?i.value.value=n.value:i.value=n.value}else if(r){let a=this.items.findIndex(l=>r(n,l)<0);a===-1?this.items.push(n):this.items.splice(a,0,n)}else this.items.push(n)}delete(e){let t=ye(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){var r;let n=ye(this.items,e),i=n==null?void 0:n.value;return(r=!t&&I(i)?i.value:i)!=null?r:void 0}has(e){return!!ye(this.items,e)}set(e,t){this.add(new v(e,t),!0)}toJSON(e,t,n){let i=n?new n:t!=null&&t.mapAsMap?new Map:{};t!=null&&t.onCreate&&t.onCreate(i);for(let r of this.items)bt(t,i,r);return i}toString(e,t,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!T(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),St(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:t})}};function xn(s,e,t){let{keepUndefined:n,replacer:i}=t,r=new j(s),o=(a,l)=>{if(typeof i=="function")l=i.call(e,a,l);else if(Array.isArray(i)&&!i.includes(a))return;(l!==void 0||n)&&r.items.push(_e(a,l,t))};if(e instanceof Map)for(let[a,l]of e)o(a,l);else if(e&&typeof e=="object")for(let a of Object.keys(e))o(a,e[a]);return typeof s.sortMapEntries=="function"&&r.items.sort(s.sortMapEntries),r}var ne={collection:"map",createNode:xn,default:!0,nodeClass:j,tag:"tag:yaml.org,2002:map",resolve(s,e){return V(s)||e("Expected a mapping for this tag"),s}};var x=class extends he{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(fe,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=kt(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){let n=kt(e);if(typeof n!="number")return;let i=this.items[n];return!t&&I(i)?i.value:i}has(e){let t=kt(e);return typeof t=="number"&&t=0?e:null}function Un(s,e,t){let{replacer:n}=t,i=new x(s);if(e&&Symbol.iterator in Object(e)){let r=0;for(let o of e){if(typeof n=="function"){let a=e instanceof Set?o:String(r++);o=n.call(e,a,o)}i.items.push(ue(o,void 0,t))}}return i}var ie={collection:"seq",createNode:Un,default:!0,nodeClass:x,tag:"tag:yaml.org,2002:seq",resolve(s,e){return Q(s)||e("Expected a sequence for this tag"),s}};var be={identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify(s,e,t,n){return e=Object.assign({actualString:!0},e),pe(s,e,t,n)}};var Ae={identify:s=>s==null,createNode:()=>new N(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new N(null),stringify:({source:s},e)=>typeof s=="string"&&Ae.test.test(s)?s:e.options.nullStr};var Ge={identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:s=>new N(s[0]==="t"||s[0]==="T"),stringify({source:s,value:e},t){if(s&&Ge.test.test(s)){let n=s[0]==="t"||s[0]==="T";if(e===n)return s}return e?t.options.trueStr:t.options.falseStr}};function K({format:s,minFractionDigits:e,tag:t,value:n}){if(typeof n=="bigint")return String(n);let i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let r=JSON.stringify(n);if(!s&&e&&(!t||t==="tag:yaml.org,2002:float")&&/^\\d/.test(r)){let o=r.indexOf(".");o<0&&(o=r.length,r+=".");let a=e-(r.length-o-1);for(;a-- >0;)r+="0"}return r}var Nt={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\\.(?:inf|Inf|INF|nan|NaN|NAN))$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:K},Ot={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\\.[0-9]+|[0-9]+(?:\\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s),stringify(s){let e=Number(s.value);return isFinite(e)?e.toExponential():K(s)}},At={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\\.[0-9]+|[0-9]+\\.[0-9]*)$/,resolve(s){let e=new N(parseFloat(s)),t=s.indexOf(".");return t!==-1&&s[s.length-1]==="0"&&(e.minFractionDigits=s.length-t-1),e},stringify:K};var Et=s=>typeof s=="bigint"||Number.isInteger(s),Xt=(s,e,t,{intAsBigInt:n})=>n?BigInt(s):parseInt(s.substring(e),t);function Ms(s,e,t){let{value:n}=s;return Et(n)&&n>=0?t+n.toString(e):K(s)}var Lt={identify:s=>Et(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(s,e,t)=>Xt(s,2,8,t),stringify:s=>Ms(s,8,"0o")},It={identify:Et,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(s,e,t)=>Xt(s,0,10,t),stringify:K},Tt={identify:s=>Et(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(s,e,t)=>Xt(s,2,16,t),stringify:s=>Ms(s,16,"0x")};var $s=[ne,ie,be,Ae,Ge,Lt,It,Tt,Nt,Ot,At];function _s(s){return typeof s=="bigint"||Number.isInteger(s)}var Ct=({value:s})=>JSON.stringify(s),Vn=[{identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify:Ct},{identify:s=>s==null,createNode:()=>new N(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Ct},{identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true|false$/,resolve:s=>s==="true",stringify:Ct},{identify:_s,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(s,e,{intAsBigInt:t})=>t?BigInt(s):parseInt(s,10),stringify:({value:s})=>_s(s)?s.toString():JSON.stringify(s)},{identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:s=>parseFloat(s),stringify:Ct}],Jn={default:!0,tag:"",test:/^/,resolve(s,e){return e(`Unresolved plain scalar ${JSON.stringify(s)}`),s}},Ps=[ne,ie].concat(Vn,Jn);var Qe={identify:s=>s instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(s,e){if(typeof Buffer=="function")return Buffer.from(s,"base64");if(typeof atob=="function"){let t=atob(s.replace(/[\\n\\r]/g,"")),n=new Uint8Array(t.length);for(let i=0;i1&&e("Each pair must have its own sequence indicator");let r=i.items[0]||new v(new N(null));if(i.commentBefore&&(r.key.commentBefore=r.key.commentBefore?`${i.commentBefore}\n${r.key.commentBefore}`:i.commentBefore),i.comment){let o=(t=r.value)!=null?t:r.key;o.comment=o.comment?`${i.comment}\n${o.comment}`:i.comment}i=r}s.items[n]=T(i)?i:new v(i)}}else e("Expected a sequence for this tag");return s}function Zt(s,e,t){let{replacer:n}=t,i=new x(s);i.tag="tag:yaml.org,2002:pairs";let r=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n=="function"&&(o=n.call(e,String(r++),o));let a,l;if(Array.isArray(o))if(o.length===2)a=o[0],l=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let c=Object.keys(o);if(c.length===1)a=c[0],l=o[a];else throw new TypeError(`Expected { key: value } tuple: ${o}`)}else a=o;i.items.push(_e(a,l,t))}return i}var He={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:zt,createNode:Zt};var we=class extends x{constructor(){super(),this.add=j.prototype.add.bind(this),this.delete=j.prototype.delete.bind(this),this.get=j.prototype.get.bind(this),this.has=j.prototype.has.bind(this),this.set=j.prototype.set.bind(this),this.tag=we.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t!=null&&t.onCreate&&t.onCreate(n);for(let i of this.items){let r,o;if(T(i)?(r=R(i.key,"",t),o=R(i.value,r,t)):r=R(i,"",t),n.has(r))throw new Error("Ordered maps must not include duplicate keys");n.set(r,o)}return n}};we.tag="tag:yaml.org,2002:omap";var Xe={collection:"seq",identify:s=>s instanceof Map,nodeClass:we,default:!1,tag:"tag:yaml.org,2002:omap",resolve(s,e){let t=zt(s,e),n=[];for(let{key:i}of t.items)I(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new we,t)},createNode(s,e,t){let n=Zt(s,e,t),i=new we;return i.items=n.items,i}};function vs({value:s,source:e},t){return e&&(s?es:ts).test.test(e)?e:s?t.options.trueStr:t.options.falseStr}var es={identify:s=>s===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new N(!0),stringify:vs},ts={identify:s=>s===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i,resolve:()=>new N(!1),stringify:vs};var Bs={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?\\.(?:inf|Inf|INF|nan|NaN|NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:K},Ds={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s.replace(/_/g,"")),stringify(s){let e=Number(s.value);return isFinite(e)?e.toExponential():K(s)}},js={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\\.[0-9_]*$/,resolve(s){let e=new N(parseFloat(s.replace(/_/g,""))),t=s.indexOf(".");if(t!==-1){let n=s.substring(t+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:K};var ze=s=>typeof s=="bigint"||Number.isInteger(s);function Mt(s,e,t,{intAsBigInt:n}){let i=s[0];if((i==="-"||i==="+")&&(e+=1),s=s.substring(e).replace(/_/g,""),n){switch(t){case 2:s=`0b${s}`;break;case 8:s=`0o${s}`;break;case 16:s=`0x${s}`;break}let o=BigInt(s);return i==="-"?BigInt(-1)*o:o}let r=parseInt(s,t);return i==="-"?-1*r:r}function ss(s,e,t){let{value:n}=s;if(ze(n)){let i=n.toString(e);return n<0?"-"+t+i.substr(1):t+i}return K(s)}var Fs={identify:ze,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(s,e,t)=>Mt(s,2,2,t),stringify:s=>ss(s,2,"0b")},qs={identify:ze,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(s,e,t)=>Mt(s,1,8,t),stringify:s=>ss(s,8,"0")},Ks={identify:ze,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(s,e,t)=>Mt(s,0,10,t),stringify:K},Rs={identify:ze,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(s,e,t)=>Mt(s,2,16,t),stringify:s=>ss(s,16,"0x")};var Se=class extends j{constructor(e){super(e),this.tag=Se.tag}add(e){let t;T(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new v(e.key,null):t=new v(e,null),ye(this.items,t.key)||this.items.push(t)}get(e,t){let n=ye(this.items,e);return!t&&T(n)?I(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=ye(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new v(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw new Error("Set items must all have null values")}};Se.tag="tag:yaml.org,2002:set";var Ze={collection:"map",identify:s=>s instanceof Set,nodeClass:Se,default:!1,tag:"tag:yaml.org,2002:set",resolve(s,e){if(V(s)){if(s.hasAllNullValues(!0))return Object.assign(new Se,s);e("Set items must all have null values")}else e("Expected a mapping for this tag");return s},createNode(s,e,t){let{replacer:n}=t,i=new Se(s);if(e&&Symbol.iterator in Object(e))for(let r of e)typeof n=="function"&&(r=n.call(e,r,r)),i.items.push(_e(r,null,t));return i}};function ns(s,e){let t=s[0],n=t==="-"||t==="+"?s.substring(1):s,i=o=>e?BigInt(o):Number(o),r=n.replace(/_/g,"").split(":").reduce((o,a)=>o*i(60)+i(a),i(0));return t==="-"?i(-1)*r:r}function xs(s){let{value:e}=s,t=o=>o;if(typeof e=="bigint")t=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return K(s);let n="";e<0&&(n="-",e*=t(-1));let i=t(60),r=[e%i];return e<60?r.unshift(0):(e=(e-r[0])/i,r.unshift(e%i),e>=60&&(e=(e-r[0])/i,r.unshift(e))),n+r.map(o=>o<10?"0"+String(o):String(o)).join(":").replace(/000000\\d*$/,"")}var $t={identify:s=>typeof s=="bigint"||Number.isInteger(s),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(s,e,{intAsBigInt:t})=>ns(s,t),stringify:xs},_t={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*$/,resolve:s=>ns(s,!1),stringify:xs},Pe={identify:s=>s instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\\\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\\\.[0-9]+)?)(?:[ \\\\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(s){let e=s.match(Pe.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,t,n,i,r,o,a]=e.map(Number),l=e[7]?Number((e[7]+"00").substr(1,3)):0,c=Date.UTC(t,n-1,i,r||0,o||0,a||0,l),u=e[8];if(u&&u!=="Z"){let f=ns(u,!1);Math.abs(f)<30&&(f*=60),c-=6e4*f}return new Date(c)},stringify:({value:s})=>s.toISOString().replace(/((T00:00)?:00)?\\.000Z$/,"")};var is=[ne,ie,be,Ae,es,ts,Fs,qs,Ks,Rs,Bs,Ds,js,Qe,Xe,He,Ze,$t,_t,Pe];var Us=new Map([["core",$s],["failsafe",[ne,ie,be]],["json",Ps],["yaml11",is],["yaml-1.1",is]]),Vs={binary:Qe,bool:Ge,float:At,floatExp:Ot,floatNaN:Nt,floatTime:_t,int:It,intHex:Tt,intOct:Lt,intTime:$t,map:ne,null:Ae,omap:Xe,pairs:He,seq:ie,set:Ze,timestamp:Pe},Js={"tag:yaml.org,2002:binary":Qe,"tag:yaml.org,2002:omap":Xe,"tag:yaml.org,2002:pairs":He,"tag:yaml.org,2002:set":Ze,"tag:yaml.org,2002:timestamp":Pe};function Pt(s,e){let t=Us.get(e);if(!t)if(Array.isArray(s))t=[];else{let n=Array.from(Us.keys()).filter(i=>i!=="yaml11").map(i=>JSON.stringify(i)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${n} or define customTags array`)}if(Array.isArray(s))for(let n of s)t=t.concat(n);else typeof s=="function"&&(t=s(t.slice()));return t.map(n=>{if(typeof n!="string")return n;let i=Vs[n];if(i)return i;let r=Object.keys(Vs).map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown custom tag "${n}"; use one of ${r}`)})}var Yn=(s,e)=>s.keye.key?1:0,ke=class{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:i,schema:r,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?Pt(e,"compat"):e?Pt(null,e):null,this.merge=!!n,this.name=typeof r=="string"&&r||"core",this.knownTags=i?Js:{},this.tags=Pt(t,this.name),this.toStringOptions=a!=null?a:null,Object.defineProperty(this,ee,{value:ne}),Object.defineProperty(this,W,{value:be}),Object.defineProperty(this,fe,{value:ie}),this.sortMapEntries=typeof o=="function"?o:o===!0?Yn:null}clone(){let e=Object.create(ke.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};function Ys(s,e){var l;let t=[],n=e.directives===!0;if(e.directives!==!1&&s.directives){let c=s.directives.toString(s);c?(t.push(c),n=!0):s.directives.docStart&&(n=!0)}n&&t.push("---");let i=gt(s,e),{commentString:r}=i.options;if(s.commentBefore){t.length!==1&&t.unshift("");let c=r(s.commentBefore);t.unshift(X(c,""))}let o=!1,a=null;if(s.contents){if(C(s.contents)){if(s.contents.spaceBefore&&n&&t.push(""),s.contents.commentBefore){let f=r(s.contents.commentBefore);t.push(X(f,""))}i.forceBlockIndent=!!s.comment,a=s.contents.comment}let c=a?void 0:()=>o=!0,u=se(s.contents,i,()=>a=null,c);a&&(u+=te(u,"",r(a))),(u[0]==="|"||u[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${u}`:t.push(u)}else t.push(se(s.contents,i));if((l=s.directives)!=null&&l.docEnd)if(s.comment){let c=r(s.comment);c.includes(`\n`)?(t.push("..."),t.push(X(c,""))):t.push(`... ${c}`)}else t.push("...");else{let c=s.comment;c&&o&&(c=c.replace(/^\\n+/,"")),c&&((!o||a)&&t[t.length-1]!==""&&t.push(""),t.push(X(r(c),"")))}return t.join(`\n`)+`\n`}function ve(s,e,t,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,r=n.length;itypeof b=="number"||b instanceof String||b instanceof Number,k=t.filter(g).map(String);k.length>0&&(t=t.concat(k)),i=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:r,anchorPrefix:o,flow:a,keepUndefined:l,onTagObj:c,tag:u}=n!=null?n:{},{onAnchor:f,setAnchors:h,sourceObjects:d}=Es(this,o||"a"),w={aliasDuplicateObjects:r!=null?r:!0,keepUndefined:l!=null?l:!1,onAnchor:f,onTagObj:c,replacer:i,schema:this.schema,sourceObjects:d},p=ue(e,u,w);return a&&M(p)&&(p.flow=!0),h(),p}createPair(e,t,n={}){let i=this.createNode(e,null,n),r=this.createNode(t,null,n);return new v(i,r)}delete(e){return Be(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Me(e)?this.contents==null?!1:(this.contents=null,!0):Be(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return M(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return Me(e)?!t&&I(this.contents)?this.contents.value:this.contents:M(this.contents)?this.contents.getIn(e,t):void 0}has(e){return M(this.contents)?this.contents.has(e):!1}hasIn(e){return Me(e)?this.contents!==void 0:M(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=Ve(this.schema,[e],t):Be(this.contents)&&this.contents.set(e,t)}setIn(e,t){Me(e)?this.contents=t:this.contents==null?this.contents=Ve(this.schema,Array.from(e),t):Be(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new F({version:"1.1"}),n={merge:!0,resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new F({version:e}),n={merge:!1,resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected \'1.1\', \'1.2\' or null as first argument, but found: ${i}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new ke(Object.assign(n,t));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:i,onAnchor:r,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100,stringify:se},l=R(this.contents,t!=null?t:"",a);if(typeof r=="function")for(let{count:c,res:u}of a.anchors.values())r(u,c);return typeof o=="function"?ve(o,{"":l},"",l):l}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${t}`)}return Ys(this,e)}};function Be(s){if(M(s))return!0;throw new Error("Expected a YAML collection as document contents")}var De=class extends Error{constructor(e,t,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=t}},Y=class extends De{constructor(e,t,n){super("YAMLParseError",e,t,n)}},je=class extends De{constructor(e,t,n){super("YAMLWarning",e,t,n)}},et=(s,e)=>t=>{if(t.pos[0]===-1)return;t.linePos=t.pos.map(a=>e.linePos(a));let{line:n,col:i}=t.linePos[0];t.message+=` at line ${n}, column ${i}`;let r=i-1,o=s.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\\n\\r]+$/,"");if(r>=60&&o.length>80){let a=Math.min(r-39,o.length-79);o="\\u2026"+o.substring(a),r-=a-1}if(o.length>80&&(o=o.substring(0,79)+"\\u2026"),n>1&&/^ *$/.test(o.substring(0,r))){let a=s.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\\u2026\n`),o=a+o}if(/[^ ]/.test(o)){let a=1,l=t.linePos[1];l&&l.line===n&&l.col>i&&(a=Math.min(l.col-i,80-r));let c=" ".repeat(r)+"^".repeat(a);t.message+=`:\n\n${o}\n${c}\n`}};function le(s,{flow:e,indicator:t,next:n,offset:i,onError:r,startOnNewline:o}){let a=!1,l=o,c=o,u="",f="",h=!1,d=!1,w=!1,p=null,g=null,k=null,b=null,O=null;for(let m of s)switch(w&&(m.type!=="space"&&m.type!=="newline"&&m.type!=="comma"&&r(m.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),w=!1),m.type){case"space":!e&&l&&t!=="doc-start"&&m.source[0]===" "&&r(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),c=!0;break;case"comment":{c||r(m,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let L=m.source.substring(1)||" ";u?u+=f+L:u=L,f="",l=!1;break}case"newline":l?u?u+=m.source:a=!0:f+=m.source,l=!0,h=!0,(p||g)&&(d=!0),c=!0;break;case"anchor":p&&r(m,"MULTIPLE_ANCHORS","A node can have at most one anchor"),m.source.endsWith(":")&&r(m.offset+m.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),p=m,O===null&&(O=m.offset),l=!1,c=!1,w=!0;break;case"tag":{g&&r(m,"MULTIPLE_TAGS","A node can have at most one tag"),g=m,O===null&&(O=m.offset),l=!1,c=!1,w=!0;break}case t:(p||g)&&r(m,"BAD_PROP_ORDER",`Anchors and tags must be after the ${m.source} indicator`),b&&r(m,"UNEXPECTED_TOKEN",`Unexpected ${m.source} in ${e!=null?e:"collection"}`),b=m,l=!1,c=!1;break;case"comma":if(e){k&&r(m,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),k=m,l=!1,c=!1;break}default:r(m,"UNEXPECTED_TOKEN",`Unexpected ${m.type} token`),l=!1,c=!1}let A=s[s.length-1],y=A?A.offset+A.source.length:i;return w&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&r(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),{comma:k,found:b,spaceBefore:a,comment:u,hasNewline:h,hasNewlineAfterProp:d,anchor:p,tag:g,end:y,start:O!=null?O:y}}function Ne(s){if(!s)return null;switch(s.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(s.source.includes(`\n`))return!0;if(s.end){for(let e of s.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of s.items){for(let t of e.start)if(t.type==="newline")return!0;if(e.sep){for(let t of e.sep)if(t.type==="newline")return!0}if(Ne(e.key)||Ne(e.value))return!0}return!1;default:return!0}}function tt(s,e,t){if((e==null?void 0:e.type)==="flow-collection"){let n=e.end[0];n.indent===s&&(n.source==="]"||n.source==="}")&&Ne(e)&&t(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function vt(s,e,t){let{uniqueKeys:n}=s.options;if(n===!1)return!1;let i=typeof n=="function"?n:(r,o)=>r===o||I(r)&&I(o)&&r.value===o.value&&!(r.value==="<<"&&s.schema.merge);return e.some(r=>i(r.key,t))}var Ws="All mapping items must start at the same column";function Gs({composeNode:s,composeEmptyNode:e},t,n,i){var l;let r=new j(t.schema);t.atRoot&&(t.atRoot=!1);let o=n.offset,a=null;for(let c of n.items){let{start:u,key:f,sep:h,value:d}=c,w=le(u,{indicator:"explicit-key-ind",next:f!=null?f:h==null?void 0:h[0],offset:o,onError:i,startOnNewline:!0}),p=!w.found;if(p){if(f&&(f.type==="block-seq"?i(o,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==n.indent&&i(o,"BAD_INDENT",Ws)),!w.anchor&&!w.tag&&!h){a=w.end,w.comment&&(r.comment?r.comment+=`\n`+w.comment:r.comment=w.comment);continue}(w.hasNewlineAfterProp||Ne(f))&&i(f!=null?f:u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else((l=w.found)==null?void 0:l.indent)!==n.indent&&i(o,"BAD_INDENT",Ws);let g=w.end,k=f?s(t,f,w,i):e(t,g,u,null,w,i);t.schema.compat&&tt(n.indent,f,i),vt(t,r.items,k)&&i(g,"DUPLICATE_KEY","Map keys must be unique");let b=le(h!=null?h:[],{indicator:"map-value-ind",next:d,offset:k.range[2],onError:i,startOnNewline:!f||f.type==="block-scalar"});if(o=b.end,b.found){p&&((d==null?void 0:d.type)==="block-map"&&!b.hasNewline&&i(o,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&w.starts&&(s.type==="block-map"||s.type==="block-seq");function Hs({composeNode:s,composeEmptyNode:e},t,n,i){var w;let r=n.start.source==="{",o=r?"flow map":"flow sequence",a=r?new j(t.schema):new x(t.schema);a.flow=!0;let l=t.atRoot;l&&(t.atRoot=!1);let c=n.offset+n.start.source.length;for(let p=0;p0){let p=ce(h,d,t.options.strict,i);p.comment&&(a.comment?a.comment+=`\n`+p.comment:a.comment=p.comment),a.range=[n.offset,d,p.offset]}else a.range=[n.offset,d,d];return a}function Xs(s,e,t,n,i){let r;switch(t.type){case"block-map":{r=Gs(s,e,t,i);break}case"block-seq":{r=Qs(s,e,t,i);break}case"flow-collection":{r=Hs(s,e,t,i);break}}if(!n)return r;let o=e.directives.tagName(n.source,h=>i(n,"TAG_RESOLVE_FAILED",h));if(!o)return r;let a=r.constructor;if(o==="!"||o===a.tagName)return r.tag=a.tagName,r;let l=V(r)?"map":"seq",c=e.schema.tags.find(h=>h.collection===l&&h.tag===o);if(!c){let h=e.schema.knownTags[o];if(h&&h.collection===l)e.schema.tags.push(Object.assign({},h,{default:!1})),c=h;else return i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),r.tag=o,r}let u=c.resolve(r,h=>i(n,"TAG_RESOLVE_FAILED",h),e.options),f=C(u)?u:new N(u);return f.range=r.range,f.tag=o,c!=null&&c.format&&(f.format=c.format),f}function Bt(s,e,t){let n=s.offset,i=Wn(s,e,t);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let r=i.mode===">"?N.BLOCK_FOLDED:N.BLOCK_LITERAL,o=s.source?Gn(s.source):[],a=o.length;for(let p=o.length-1;p>=0;--p){let g=o[p][1];if(g===""||g==="\\r")a=p;else break}if(a===0){let p=i.chomp==="+"&&o.length>0?`\n`.repeat(Math.max(1,o.length-1)):"",g=n+i.length;return s.source&&(g+=s.source.length),{value:p,type:r,comment:i.comment,range:[n,g,g]}}let l=s.indent+i.indent,c=s.offset+i.length,u=0;for(let p=0;pl&&(l=g.length);else{if(g.length=a;--p)o[p][0].length>l&&(a=p+1);let f="",h="",d=!1;for(let p=0;pl||k[0]===" "?(h===" "?h=`\n`:!d&&h===`\n`&&(h=`\n\n`),f+=h+g.slice(l)+k,h=`\n`,d=!0):k===""?h===`\n`?f+=`\n`:h=`\n`:(f+=h+k,h=" ",d=!1)}switch(i.chomp){case"-":break;case"+":for(let p=a;pt(n+h,d,w);switch(i){case"scalar":a=N.PLAIN,l=Qn(r,c);break;case"single-quoted-scalar":a=N.QUOTE_SINGLE,l=Hn(r,c);break;case"double-quoted-scalar":a=N.QUOTE_DOUBLE,l=Xn(r,c);break;default:return t(s,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+r.length,n+r.length]}}let u=n+r.length,f=ce(o,u,e,t);return{value:l,type:a,comment:f.comment,range:[n,u,f.offset]}}function Qn(s,e){let t="";switch(s[0]){case" ":t="a tab character";break;case",":t="flow indicator character ,";break;case"%":t="directive indicator character %";break;case"|":case">":{t=`block scalar indicator ${s[0]}`;break}case"@":case"`":{t=`reserved character ${s[0]}`;break}}return t&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${t}`),zs(s)}function Hn(s,e){return(s[s.length-1]!=="\'"||s.length===1)&&e(s.length,"MISSING_CHAR","Missing closing \'quote"),zs(s.slice(1,-1)).replace(/\'\'/g,"\'")}function zs(s){var l;let e,t;try{e=new RegExp(`(.*?)(?r?s.slice(r,n+1):i)}else t+=i}return(s[s.length-1]!==\'"\'||s.length===1)&&e(s.length,"MISSING_CHAR",\'Missing closing "quote\'),t}function zn(s,e){let t="",n=s[e+1];for(;(n===" "||n===" "||n===`\n`||n==="\\r")&&!(n==="\\r"&&s[e+2]!==`\n`);)n===`\n`&&(t+=`\n`),e+=1,n=s[e+1];return t||(t=" "),{fold:t,offset:e}}var Zn={0:"\\0",a:"\\x07",b:"\\b",e:"\\x1B",f:"\\f",n:`\n`,r:"\\r",t:" ",v:"\\v",N:"\\x85",_:"\\xA0",L:"\\u2028",P:"\\u2029"," ":" ",\'"\':\'"\',"/":"/","\\\\":"\\\\"," ":" "};function ei(s,e,t,n){let i=s.substr(e,t),o=i.length===t&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;if(isNaN(o)){let a=s.substr(e-2,t+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}return String.fromCodePoint(o)}function as(s,e,t,n){let{value:i,type:r,comment:o,range:a}=e.type==="block-scalar"?Bt(e,s.options.strict,n):Dt(e,s.options.strict,n),l=t?s.directives.tagName(t.source,f=>n(t,"TAG_RESOLVE_FAILED",f)):null,c=t&&l?ti(s.schema,i,l,t,n):e.type==="scalar"?si(s,i,e,n):s.schema[W],u;try{let f=c.resolve(i,h=>n(t!=null?t:e,"TAG_RESOLVE_FAILED",h),s.options);u=I(f)?f:new N(f)}catch(f){let h=f instanceof Error?f.message:String(f);n(t!=null?t:e,"TAG_RESOLVE_FAILED",h),u=new N(i)}return u.range=a,u.source=i,r&&(u.type=r),l&&(u.tag=l),c.format&&(u.format=c.format),o&&(u.comment=o),u}function ti(s,e,t,n,i){var a;if(t==="!")return s[W];let r=[];for(let l of s.tags)if(!l.collection&&l.tag===t)if(l.default&&l.test)r.push(l);else return l;for(let l of r)if((a=l.test)!=null&&a.test(e))return l;let o=s.knownTags[t];return o&&!o.collection?(s.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${t}`,t!=="tag:yaml.org,2002:str"),s[W])}function si({directives:s,schema:e},t,n,i){var o;let r=e.tags.find(a=>{var l;return a.default&&((l=a.test)==null?void 0:l.test(t))})||e[W];if(e.compat){let a=(o=e.compat.find(l=>{var c;return l.default&&((c=l.test)==null?void 0:c.test(t))}))!=null?o:e[W];if(r.tag!==a.tag){let l=s.tagString(r.tag),c=s.tagString(a.tag),u=`Value may be parsed as either ${l} or ${c}`;i(n,"TAG_RESOLVE_FAILED",u,!0)}}return r}function Zs(s,e,t){if(e){t===null&&(t=e.length);for(let n=t-1;n>=0;--n){let i=e[n];switch(i.type){case"space":case"comment":case"newline":s-=i.source.length;continue}for(i=e[++n];(i==null?void 0:i.type)==="space";)s+=i.source.length,i=e[++n];break}}return s}var ni={composeNode:ls,composeEmptyNode:jt};function ls(s,e,t,n){let{spaceBefore:i,comment:r,anchor:o,tag:a}=t,l,c=!0;switch(e.type){case"alias":l=ii(s,e,n),(o||a)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=as(s,e,a,n),o&&(l.anchor=o.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":l=Xs(ni,s,e,a,n),o&&(l.anchor=o.source.substring(1));break;default:{let u=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",u),l=jt(s,e.offset,void 0,null,t,n),c=!1}}return o&&l.anchor===""&&n(o,"BAD_ALIAS","Anchor cannot be an empty string"),i&&(l.spaceBefore=!0),r&&(e.type==="scalar"&&e.source===""?l.comment=r:l.commentBefore=r),s.options.keepSourceTokens&&c&&(l.srcToken=e),l}function jt(s,e,t,n,{spaceBefore:i,comment:r,anchor:o,tag:a,end:l},c){let u={type:"scalar",offset:Zs(e,t,n),indent:-1,source:""},f=as(s,u,a,c);return o&&(f.anchor=o.source.substring(1),f.anchor===""&&c(o,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(f.spaceBefore=!0),r&&(f.comment=r,f.range[2]=l),f}function ii({options:s},{offset:e,source:t,end:n},i){let r=new ae(t.substring(1));r.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),r.source.endsWith(":")&&i(e+t.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+t.length,a=ce(n,o,s.strict,i);return r.range=[e,o,a.offset],a.comment&&(r.comment=a.comment),r}function en(s,e,{offset:t,start:n,value:i,end:r},o){let a=Object.assign({_directives:e},s),l=new z(void 0,a),c={atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},u=le(n,{indicator:"doc-start",next:i!=null?i:r==null?void 0:r[0],offset:t,onError:o,startOnNewline:!0});u.found&&(l.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&o(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=i?ls(c,i,u,o):jt(c,u.end,n,null,u,o);let f=l.contents.range[2],h=ce(r,f,!1,o);return h.comment&&(l.comment=h.comment),l.range=[t,f,h.offset],l}function st(s){if(typeof s=="number")return[s,s+1];if(Array.isArray(s))return s.length===2?s:[s[0],s[1]];let{offset:e,source:t}=s;return[e,e+(typeof t=="string"?t.length:1)]}function tn(s){var i;let e="",t=!1,n=!1;for(let r=0;r{let o=st(t);r?this.warnings.push(new je(o,n,i)):this.errors.push(new Y(o,n,i))},this.directives=new F({version:e.version||"1.2"}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:i}=tn(this.prelude);if(n){let r=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(i||e.directives.docStart||!r)e.commentBefore=n;else if(M(r)&&!r.flow&&r.items.length>0){let o=r.items[0];T(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${n}\n${a}`:n}else{let o=r.commentBefore;r.commentBefore=o?`${n}\n${o}`:n}}t?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:tn(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let i of e)yield*this.next(i);yield*this.end(t,n)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(t,n,i)=>{let r=st(e);r[0]+=t,this.onError(r,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=en(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new Y(st(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new Y(st(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let t=ce(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let n=this.doc.comment;this.doc.comment=n?`${n}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new Y(st(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),i=new z(void 0,n);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,t,t],this.decorate(i,!1),yield i}}};var hs={};bs(hs,{BOM:()=>nt,DOCUMENT:()=>it,FLOW_END:()=>rt,SCALAR:()=>Fe,createScalarToken:()=>nn,isCollection:()=>ai,isScalar:()=>li,prettyToken:()=>ci,resolveAsScalar:()=>sn,setScalarValue:()=>rn,stringify:()=>an,tokenType:()=>us,visit:()=>Oe});function sn(s,e=!0,t){if(s){let n=(i,r,o)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(t)t(a,r,o);else throw new Y([a,a+1],r,o)};switch(s.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Dt(s,e,n);case"block-scalar":return Bt(s,e,n)}}return null}function nn(s,e){var c;let{implicitKey:t=!1,indent:n,inFlow:i=!1,offset:r=-1,type:o="PLAIN"}=e,a=pe({type:o,value:s},{implicitKey:t,indent:n>0?" ".repeat(n):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),l=(c=e.end)!=null?c:[{type:"newline",offset:-1,indent:n,source:`\n`}];switch(a[0]){case"|":case">":{let u=a.indexOf(`\n`),f=a.substring(0,u),h=a.substring(u+1)+`\n`,d=[{type:"block-scalar-header",offset:r,indent:n,source:f}];return on(d,l)||d.push({type:"newline",offset:-1,indent:n,source:`\n`}),{type:"block-scalar",offset:r,indent:n,props:d,source:h}}case\'"\':return{type:"double-quoted-scalar",offset:r,indent:n,source:a,end:l};case"\'":return{type:"single-quoted-scalar",offset:r,indent:n,source:a,end:l};default:return{type:"scalar",offset:r,indent:n,source:a,end:l}}}function rn(s,e,t={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:r=!1,type:o}=t,a="indent"in s?s.indent:null;if(n&&typeof a=="number"&&(a+=2),!o)switch(s.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let c=s.props[0];if(c.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=c.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let l=pe({type:o,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":ri(s,l);break;case\'"\':cs(s,l,"double-quoted-scalar");break;case"\'":cs(s,l,"single-quoted-scalar");break;default:cs(s,l,"scalar")}}function ri(s,e){let t=e.indexOf(`\n`),n=e.substring(0,t),i=e.substring(t+1)+`\n`;if(s.type==="block-scalar"){let r=s.props[0];if(r.type!=="block-scalar-header")throw new Error("Invalid block scalar header");r.source=n,s.source=i}else{let{offset:r}=s,o="indent"in s?s.indent:-1,a=[{type:"block-scalar-header",offset:r,indent:o,source:n}];on(a,"end"in s?s.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:`\n`});for(let l of Object.keys(s))l!=="type"&&l!=="offset"&&delete s[l];Object.assign(s,{type:"block-scalar",indent:o,props:a,source:i})}}function on(s,e){if(e)for(let t of e)switch(t.type){case"space":case"comment":s.push(t);break;case"newline":return s.push(t),!0}return!1}function cs(s,e,t){switch(s.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":s.type=t,s.source=e;break;case"block-scalar":{let n=s.props.slice(1),i=e.length;s.props[0].type==="block-scalar-header"&&(i-=s.props[0].source.length);for(let r of n)r.offset+=i;delete s.props,Object.assign(s,{type:t,source:e,end:n});break}case"block-map":case"block-seq":{let i={type:"newline",offset:s.offset+e.length,indent:s.indent,source:`\n`};delete s.items,Object.assign(s,{type:t,source:e,end:[i]});break}default:{let n="indent"in s?s.indent:-1,i="end"in s&&Array.isArray(s.end)?s.end.filter(r=>r.type==="space"||r.type==="comment"||r.type==="newline"):[];for(let r of Object.keys(s))r!=="type"&&r!=="offset"&&delete s[r];Object.assign(s,{type:t,indent:n,source:e,end:i})}}}var an=s=>"type"in s?qt(s):Ft(s);function qt(s){switch(s.type){case"block-scalar":{let e="";for(let t of s.props)e+=qt(t);return e+s.source}case"block-map":case"block-seq":{let e="";for(let t of s.items)e+=Ft(t);return e}case"flow-collection":{let e=s.start.source;for(let t of s.items)e+=Ft(t);for(let t of s.end)e+=t.source;return e}case"document":{let e=Ft(s);if(s.end)for(let t of s.end)e+=t.source;return e}default:{let e=s.source;if("end"in s&&s.end)for(let t of s.end)e+=t.source;return e}}}function Ft({start:s,key:e,sep:t,value:n}){let i="";for(let r of s)i+=r.source;if(e&&(i+=qt(e)),t)for(let r of t)i+=r.source;return n&&(i+=qt(n)),i}var fs=Symbol("break visit"),oi=Symbol("skip children"),ln=Symbol("remove item");function Oe(s,e){"type"in s&&s.type==="document"&&(s={start:s.start,value:s.value}),cn(Object.freeze([]),s,e)}Oe.BREAK=fs;Oe.SKIP=oi;Oe.REMOVE=ln;Oe.itemAtPath=(s,e)=>{let t=s;for(let[n,i]of e){let r=t==null?void 0:t[n];if(r&&"items"in r)t=r.items[i];else return}return t};Oe.parentCollection=(s,e)=>{let t=Oe.itemAtPath(s,e.slice(0,-1)),n=e[e.length-1][0],i=t==null?void 0:t[n];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function cn(s,e,t){let n=t(e,s);if(typeof n=="symbol")return n;for(let i of["key","value"]){let r=e[i];if(r&&"items"in r){for(let o=0;o!!s&&"items"in s,li=s=>!!s&&(s.type==="scalar"||s.type==="single-quoted-scalar"||s.type==="double-quoted-scalar"||s.type==="block-scalar");function ci(s){switch(s){case nt:return"";case it:return"";case rt:return"";case Fe:return"";default:return JSON.stringify(s)}}function us(s){switch(s){case nt:return"byte-order-mark";case it:return"doc-mode";case rt:return"flow-error-end";case Fe:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`\n`:case`\\r\n`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(s[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"\'":return"single-quoted-scalar";case\'"\':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function Z(s){switch(s){case void 0:case" ":case`\n`:case"\\r":case" ":return!0;default:return!1}}var fn="0123456789ABCDEFabcdef".split(""),fi="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*\'()".split(""),ps=",[]{}".split(""),ui=` ,[]{}\n\\r `.split(""),ds=s=>!s||ui.includes(s),qe=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){var i;e&&(this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null),this.atEnd=!t;let n=(i=this.next)!=null?i:"stream";for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t===" ";)t=this.buffer[++e];return!t||t==="#"||t===`\n`?!0:t==="\\r"?this.buffer[e+1]===`\n`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===" ";)t=this.buffer[++n+e];if(t==="\\r"){let i=this.buffer[n+e+1];if(i===`\n`||!i&&!this.atEnd)return e+n+1}return t===`\n`||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t==="-"||t==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&Z(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!Z(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Z(t)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(ds),"doc";case\'"\':case"\'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((n!==-1&&n"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if(t!=="-")break}return yield*this.pushUntil(t=>Z(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,n;e:for(let i=this.pos;n=this.buffer[i];++i)switch(n){case" ":t+=1;break;case`\n`:e=i,t=0;break;case"\\r":{let r=this.buffer[i+1];if(!r&&!this.atEnd)return this.setNext("block-scalar");if(r===`\n`)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(t>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=t:this.indentNext+=this.blockScalarIndent;do{let i=this.continueScalar(e+1);if(i===-1)break;e=this.buffer.indexOf(`\n`,i)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}if(!this.blockScalarKeep)do{let i=e-1,r=this.buffer[i];r==="\\r"&&(r=this.buffer[--i]);let o=i;for(;r===" "||r===" ";)r=this.buffer[--i];if(r===`\n`&&i>=this.pos&&i+1+t>o)e=i;else break}while(!0);return yield Fe,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){let r=this.buffer[n+1];if(Z(r)||e&&r===",")break;t=n}else if(Z(i)){let r=this.buffer[n+1];if(i==="\\r"&&(r===`\n`?(n+=1,i=`\n`,r=this.buffer[n+1]):t=n),r==="#"||e&&ps.includes(r))break;if(i===`\n`){let o=this.continueScalar(n+1);if(o===-1)break;n=Math.max(n,o-2)}}else{if(e&&ps.includes(i))break;t=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Fe,yield*this.pushToIndex(t+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(ds))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let e=this.flowLevel>0,t=this.charAt(1);if(Z(t)||e&&ps.includes(t))return e?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];for(;!Z(t)&&t!==">";)t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(fi.includes(t))t=this.buffer[++e];else if(t==="%"&&fn.includes(this.buffer[e+1])&&fn.includes(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`\n`?yield*this.pushCount(1):e==="\\r"&&this.charAt(1)===`\n`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===" "||e&&n===" ");let i=t-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=t),i}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}};var Ke=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t>1;this.lineStarts[r]=0;)switch(s[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;((t=s[++e])==null?void 0:t.type)==="space";);return s.splice(e,s.length)}function hn(s){if(s.start.type==="flow-seq-start")for(let e of s.items)e.sep&&!e.value&&!re(e.start,"explicit-key-ind")&&!re(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,pn(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}var Le=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new qe,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=us(e);if(t)if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let n=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:n,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&(!e||e.type!=="doc-end")){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e!=null?e:this.stack.pop();if(t)if(this.stack.length===0)yield t;else{let n=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in n?n.indent:0:t.type==="flow-collection"&&n.type==="document"&&(t.indent=0),t.type==="flow-collection"&&hn(t),n.type){case"document":n.value=t;break;case"block-scalar":n.props.push(t);break;case"block-map":{let i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=t;else{Object.assign(i,{key:t,sep:[]}),this.onKeyLine=!re(i.start,"explicit-key-ind");return}break}case"block-seq":{let i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:t}):i.value=t;break}case"flow-collection":{let i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:t,sep:[]}):i.sep?i.value=t:Object.assign(i,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){let i=t.items[t.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&un(i.start)===-1&&(t.indent===0||i.start.every(r=>r.type!=="comment"||r.indent=e.indent){let i=!this.onKeyLine&&this.indent===e.indent&&t.sep,r=[];if(i&&t.sep&&!t.value){let o=[];for(let a=0;ae.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(r=t.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":i||t.value?(r.push(this.sourceToken),e.items.push({start:r}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!re(t.start,"explicit-key-ind")?t.start.push(this.sourceToken):i||t.value?(r.push(this.sourceToken),e.items.push({start:r})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]}),this.onKeyLine=!0;return;case"map-value-ind":if(re(t.start,"explicit-key-ind"))if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(re(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]});else if(pn(t.key)&&!re(t.sep,"newline")){let o=Re(t.start),a=t.key,l=t.sep;l.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:l}]})}else r.length>0?t.sep=t.sep.concat(r,this.sourceToken):t.sep.push(this.sourceToken);else if(re(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let o=Re(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||i?e.items.push({start:r,key:null,sep:[this.sourceToken]}):re(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);i||t.value?(e.items.push({start:r,key:o,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(o):(Object.assign(t,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){i&&o.type!=="block-seq"&&re(t.start,"explicit-key-ind")&&e.items.push({start:r}),this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){var n;let t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){let i="end"in t.value?t.value.end:void 0,r=Array.isArray(i)?i[i.length-1]:void 0;(r==null?void 0:r.type)==="comment"?i==null||i.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let i=e.items[e.items.length-2],r=(n=i==null?void 0:i.value)==null?void 0:n.end;if(Array.isArray(r)){Array.prototype.push.apply(r,t.start),r.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;t.value||re(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let i=this.startBlockValue(e);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n&&n.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:i,sep:[]}):t.sep?this.stack.push(i):Object.assign(t,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let i=Kt(n),r=Re(i);hn(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`\n`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`\n`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=Kt(e),n=Re(t);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n}]}}case"map-value-ind":{this.onKeyLine=!0;let t=Kt(e),n=Re(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};function dn(s){let e=s.prettyErrors!==!1;return{lineCounter:s.lineCounter||e&&new Ke||null,prettyErrors:e}}function mn(s,e={}){let{lineCounter:t,prettyErrors:n}=dn(e),i=new Le(t==null?void 0:t.addNewLine),r=new Ee(e),o=Array.from(r.compose(i.parse(s)));if(n&&t)for(let a of o)a.errors.forEach(et(s,t)),a.warnings.forEach(et(s,t));return o.length>0?o:Object.assign([],{empty:!0},r.streamInfo())}function ms(s,e={}){let{lineCounter:t,prettyErrors:n}=dn(e),i=new Le(t==null?void 0:t.addNewLine),r=new Ee(e),o=null;for(let a of r.compose(i.parse(s),!0,s.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new Y(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&t&&(o.errors.forEach(et(s,t)),o.warnings.forEach(et(s,t))),o}function gn(s,e,t){let n;typeof e=="function"?n=e:t===void 0&&e&&typeof e=="object"&&(t=e);let i=ms(s,t);if(!i)return null;if(i.warnings.forEach(r=>yt(i.options.logLevel,r)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},t))}function yn(s,e,t){var i;let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:t===void 0&&e&&(t=e),typeof t=="string"&&(t=t.length),typeof t=="number"){let r=Math.round(t);t=r<1?void 0:r>8?{indent:8}:{indent:r}}if(s===void 0){let{keepUndefined:r}=(i=t!=null?t:e)!=null?i:{};if(!r)return}return new z(s,n,t).toString(t)}var bn=gs;var de=self,ys=class{constructor(){this.queue=[];this.pendingContentProcessing=new Map;this.parsing=!1;de.addEventListener("message",e=>{e.data.type=="queue"&&(this.add(...e.data.paths),this.debug&&console.debug(`TTRPG: Received queue message for ${e.data.paths.length} paths`))}),de.addEventListener("message",e=>{e.data.type=="debug"&&(this.debug=e.data.debug)}),de.addEventListener("message",e=>{e.data.type=="content"&&this.processContent(e.data.path,e.data.content)})}add(...e){this.debug&&console.debug(`TTRPG: Adding ${e.length} paths to queue`),this.queue.push(...e),this.parsing||this.parse()}processContent(e,t){this.debug&&console.debug(`TTRPG: Process Content: ${e}`);let n=this.pendingContentProcessing.get(e),i=this.findFirstStatBlock(t);if(i){this.debug&&console.debug(`TTRPG: found Statblock: ${JSON.stringify(i)}`);let r=Object.assign({},bn.parse(i),{note:e,mtime:n.mtime});this.debug&&console.debug(`TTRPG: ${JSON.stringify(r)}`),this.processMonster(r,n)}this.pendingContentProcessing.delete(e),this.checkForWorkComplete()}findFirstStatBlock(e){let t=e.match(/^```[^\\S\\r\\n]*statblock\\s?\\n([\\s\\S]+?)^```/m);return t?t[1]:null}async parse(){for(this.parsing=!0;this.queue.length;){let e=this.queue.shift();if(!e.endsWith(".md"))continue;this.debug&&console.debug(`TTRPG: Parsing ${e} for statblocks (${this.queue.length} to go)`);let{file:t,cache:n}=await this.getFileData(e);this.parseFileForCreatures(t,n),de.postMessage({type:"done",path:e})}this.checkForWorkComplete()}checkForWorkComplete(){this.pendingContentProcessing.size==0&&(this.parsing=!1,de.postMessage({type:"save"}))}async getFileData(e){return new Promise(t=>{de.addEventListener("message",n=>{n.data.type=="file"&&t(n.data)}),de.postMessage({path:e,type:"get"})})}parseFileForCreatures(e,t){if(!t||!t.frontmatter||!t.frontmatter.statblock)return;if(t.frontmatter.statblock==="inline"){de.postMessage({type:"read",path:e.path}),this.pendingContentProcessing.set(e.path,e);return}if(!t.frontmatter.name)return;let n=this.validate(Object.assign({},(0,wn.default)(t.frontmatter),{note:e.path,mtime:e.mtime}));n.traits&&(n.traits=Ie([],n.traits)),this.processMonster(n,e)}processMonster(e,t){e.actions&&(e.actions=Ie([],e.actions)),e.bonus_actions&&(e.bonus_actions=Ie([],e.bonus_actions)),e.reactions&&(e.reactions=Ie([],e.reactions)),e.legendary_actions&&(e.legendary_actions=Ie([],e.legendary_actions)),e["statblock-link"]&&e["statblock-link"].startsWith("#")&&(e["statblock-link"]=`[${e.name}](${t.path}${e["statblock-link"]})`),this.debug&&console.debug(`TTRPG: Adding ${e.name} to bestiary from ${t.basename}`),de.postMessage({type:"update",monster:e,path:t.path})}validate(e){return e}};new ys;\n')}var $n=class extends it.Component{constructor(t){super();this.plugin=t;this.watchPaths=new Map;this.worker=new Cs}get metadataCache(){return this.plugin.app.metadataCache}get vault(){return this.plugin.app.vault}setDebug(){this.worker.postMessage({type:"debug",debug:this.plugin.settings.debug})}onload(){this.setDebug(),this.registerEvent(this.metadataCache.on("changed",async t=>{if(!this.plugin.settings.autoParse)return;let{frontmatter:n}=this.metadataCache.getFileCache(t)??{};if(!n||!n.statblock){this.watchPaths.has(t.path)&&this.delete(t.path);return}this.plugin.settings.debug&&console.debug(`TTRPG: Reparsing ${t.name}`),this.parsePath(t)})),this.registerEvent(this.vault.on("rename",async(t,n)=>{!this.plugin.settings.autoParse||t instanceof it.TFile&&(!this.watchPaths.has(n)||(this.plugin.settings.debug&&console.debug(`TTRPG: Handling rename of ${n} to ${t.path}`),await this.delete(n),this.parsePath(t)))})),this.registerEvent(this.vault.on("delete",t=>{!this.plugin.settings.autoParse||t instanceof it.TFile&&(!this.watchPaths.has(t.path)||this.delete(t.path))})),this.worker.addEventListener("message",t=>{if(t.data.type=="get"){let{path:n}=t.data,i=this.getFileInformation(n);this.worker.postMessage({type:"file",path:n,...i})}}),this.worker.addEventListener("message",async t=>{if(t.data.type=="update"){let{monster:n,path:i}=t.data,s=!1;if(this.watchPaths.has(i)){let r=this.watchPaths.get(i);await this.plugin.deleteMonster(r),s=!0,this.plugin.settings.debug&&console.debug(`TTRPG: Updating ${n.name}`)}this.watchPaths.set(i,n.name),await this.plugin.saveMonster(n,!1,!1),this.plugin.settings.debug&&console.debug(`TTRPG: ${s?"Updated":"Added"} ${n.name}`)}}),this.worker.addEventListener("message",async t=>{t.data.type=="save"&&await this.save()}),this.worker.addEventListener("message",async t=>{if(t.data.type=="read"){let n=this.plugin.app.vault.getAbstractFileByPath(t.data.path);if(!(n instanceof it.TFile))return"";await this.plugin.app.vault.read(n).then(i=>{this.worker.postMessage({type:"content",path:t.data.path,content:i})})}}),this.plugin.app.workspace.onLayoutReady(()=>{for(let[t,n]of this.plugin.settings.monsters.filter(([i,s])=>s.note))this.watchPaths.has(n.note)&&this.plugin.deleteMonster(n.name),this.watchPaths.set(n.note,n.name);!this.plugin.settings.autoParse||this.start()})}async save(){await this.plugin.saveSettings(),this.startTime&&(console.info(`TTRPG Statblocks: Frontmatter Parsing Complete in ${((Date.now()-this.startTime)/1e3).toLocaleString()} seconds.`),this.startTime=0),this.announce&&(new it.Notice("TTRPG Statblocks: Frontmatter Parsing complete."),this.announce=!1)}async delete(t){await this.plugin.deleteMonster(this.watchPaths.get(t)),this.watchPaths.delete(t),this.plugin.settings.debug&&console.debug(`TTRPG: Removing '${t}' from bestiary`)}start(t=!1){this.announce=t,this.startTime=Date.now(),console.info("TTRPG Statblocks: Starting Frontmatter Parsing."),this.plugin.settings.paths?.length||(this.plugin.settings.paths=["/"]);let n=!1;for(let i of this.plugin.settings.paths){let s=this.vault.getAbstractFileByPath(i);!s||(n=!0,this.parsePath(s))}n||this.save()}pathContainsFile(t){if(!this.plugin.settings.paths.length||this.plugin.settings.paths.contains("/"))return!0;for(let n of this.plugin.settings.paths)if(t.path.includes(n))return!0;return!1}parsePath(t){if(!this.pathContainsFile(t))return;let n=new Set;for(let i of this.getFiles(t))n.add(i);this.startParsing([...n])}startParsing(t){t.length&&this.worker.postMessage({type:"queue",paths:t})}getFileInformation(t){let n=this.plugin.app.vault.getAbstractFileByPath(t);if(!(n instanceof it.TFile))return{};if(this.watchPaths.has(n.path)){let s=this.plugin.bestiary.get(this.watchPaths.get(n.path));if(s&&s.mtime&&s.mtime==n.stat.mtime)return{}}return{cache:this.metadataCache.getFileCache(n),file:{path:n.path,basename:n.basename,mtime:n.stat.mtime}}}getFiles(t){let n=[];if(t instanceof it.TFolder)for(let i of t.children)n.push(...this.getFiles(i));return t instanceof it.TFile&&n.push(t.path),n}async reparseVault(){for(let t of this.watchPaths.values())this.plugin.deleteMonster(t,!1,!1);this.start(!1)}onunload(){this.worker.terminate(),this.worker=null}};var Dc=require("obsidian"),jn=class extends Dc.EditorSuggest{constructor(t){super(t.app);this.plugin=t}getSuggestions(t){return this.plugin.getBestiaryNames().filter(n=>n.toLowerCase().contains(t.query.toLowerCase()))}renderSuggestion(t,n){n.createSpan({text:t})}selectSuggestion(t,n){if(!this.context)return;let i=this.context.editor.getLine(this.context.end.line).slice(this.context.end.ch),[s,r]=i.match(/^(\] ?)/)??[];this.context.editor.replaceRange(`${t}`,this.context.start,{...this.context.end,ch:this.context.start.ch+this.context.query.length+(r?.length??0)},"statblocks"),this.context.editor.setCursor(this.context.start.line,this.context.start.ch+t.length),this.close()}onTrigger(t,n,i){let s=n.getRange({line:0,ch:0},t);if(s.indexOf("```statblock\n")===-1)return;let r=s.split(` +`).reverse(),c=!1;for(let b of r){if(/^```$/.test(b))return;if(/^```statblock/.test(b)){c=!0;break}}if(!c)return;let o=n.getLine(t.line);if(!/^(monster|creature):/m.test(o.slice(0,t.ch)))return null;let l=o.match(/^(monster|creature): (.+)\n?/);if(!l)return null;let[d,u,m]=l;return!m||this.plugin.getBestiaryNames().find(b=>b.toLowerCase()==m.toLowerCase())?null:{end:t,start:{ch:u.length+2,line:t.line},query:m}}};var Ec={monsters:[],layouts:[],default:bt.name,useDice:!0,renderDice:!1,export:!0,showAdvanced:!1,version:{major:null,minor:null,patch:null},paths:["/"],autoParse:!1,disableSRD:!1,tryToRenderLinks:!0,debug:!1},qn=class extends je.Plugin{constructor(){super(...arguments);this.namesHaveChanged=!0;this.watcher=new $n(this);this._sorted=[]}getBestiaryNames(){return this.namesHaveChanged&&(this.names=[...this.bestiary.keys()]),this.names}getRoller(t){return this.canUseDiceRoller?this.app.plugins.getPlugin("obsidian-dice-roller").getRollerSync(t,"statblock",!0):void 0}get canUseDiceRoller(){if(this.app.plugins.getPlugin("obsidian-dice-roller")!=null)if(!this.app.plugins.getPlugin("obsidian-dice-roller").getRollerSync)new je.Notice("Please update Dice Roller to the latest version to use with Initiative Tracker.");else return!0;return!1}get sorted(){let t=Array.from(this.data.values());return this._sorted.length!=t.length&&(this._sorted=va(t).asc(n=>n.name)),this._sorted}get sources(){return new Set(Array.from(this.data.values()).map(t=>t.source).flat())}async onload(){console.log("TTRPG StatBlocks loaded"),await this.loadSettings(),await this.loadMonsterData(),await this.saveSettings(),this.watcher.load(),this.addCommand({id:"parse-frontmatter",name:"Parse Frontmatter for Creatures",callback:()=>{this.watcher.start(!0)}}),(0,je.addIcon)("dropzone-grip",''),(0,je.addIcon)("statblock-conditioned",''),(0,je.addIcon)("dice-roller-dice",''),(0,je.addIcon)("markdown-icon",''),this.addSettingTab(new qa(this.app,this)),(0,je.addIcon)(tn,Qs),(0,je.addIcon)(an,er),this.bestiary=new Map([...wa(this.settings.disableSRD),...this.data]),Object.defineProperty(window,"bestiary",{value:this.bestiary,writable:!1,configurable:!0}),this.registerMarkdownCodeBlockProcessor("statblock",this.postprocessor.bind(this)),this.registerEditorSuggest(new jn(this)),this.registerEvent(this.app.workspace.on("dice-roller:unload",()=>{this.settings.useDice=!1}))}async loadSettings(){let t=await this.loadData();t!=null&&!("version"in t)?(this.settings={...Ec},this.settings.monsters=t,await this.loadMonsterData(),new je.Notice("5e Statblocks is now TTRPG Statblocks. Check out the ReadMe for more information!")):this.settings={...Ec,...t};let n=this.manifest.version.split(".");this.settings.version={major:Number(n[0]),minor:Number(n[1]),patch:Number(n[2])}}async saveSettings(){this.settings.monsters=this._transformData(this.data),this.bestiary=new Map([...wa(this.settings.disableSRD),...this.data]),await this.saveData(this.settings)}async loadMonsterData(){let t=this.settings.monsters;t||(this.data=new Map),this.data=new Map(t?.map(([n,i])=>[n,(0,Ss.default)(i)])??[])}async saveMonster(t,n=!0,i=!0){!t.name||(this.data.set(t.name,t),this.bestiary.set(t.name,t),this.namesHaveChanged=!0,i&&await this.saveSettings(),n&&(this._sorted=va(Array.from(this.data.values())).asc(s=>s.name)))}async saveMonsters(t){for(let n of t)await this.saveMonster(n,!1,!1);this._sorted=va(Array.from(this.data.values())).asc(n=>n.name),await this.saveSettings()}async updateMonster(t,n){this.data.delete(t.name),await this.saveMonster(n)}async deleteMonsters(...t){for(let n of t)!this.data.has(n)||(this.data.delete(n),this.bestiary.delete(n),this.namesHaveChanged=!0);await this.saveSettings(),this._sorted=va(Array.from(this.data.values())).asc(n=>n.name)}async deleteMonster(t,n=!0,i=!0){!this.data.has(t)||(this.data.delete(t),this.bestiary.delete(t),wa(this.settings.disableSRD).has(t)&&this.bestiary.set(t,wa(this.settings.disableSRD).get(t)),this.namesHaveChanged=!0,i&&await this.saveSettings(),n&&(this._sorted=va(Array.from(this.data.values())).asc(s=>s.name)))}_transformData(t){return[...t??[]].map(([n,i])=>[n,(0,Ss.default)(i)])}onunload(){delete window.bestiary,this.watcher.unload(),console.log("TTRPG StatBlocks unloaded")}exportAsPng(t,n){function i(r){return!r.hasClass||!r.hasClass("clickable-icon")}let s=n.querySelector(".statblock-content");s&&delete s.style.boxShadow,Mc.default.toPng(n,{filter:i,style:{height:"100%"}}).then(r=>{let c=document.createElement("a");c.download=t+".png",c.href=r,c.click(),c.detach()}).catch(r=>{new je.Notice(`There was an error creating the image: + +${r.message}`),console.error(r)})}parseForDice(t){let n=s=>{let r,c;if(/\w+ [\+\-]\d+/.test(s)){let[,o,l,d]=s.match(/(\w+) ([\+\-])(\d+)/)??[],u=1;l==="-"&&(u=-1),isNaN(Number(d))||(r=`1d20+${u*Number(d)}`,c=`${o} ${l}${d}`)}else if(/[\+\-]\d+ to hit/.test(s)){let[,o,l]=s.match(/([\+\-])(\d+)/)??[],d=1;o==="-"&&(d=-1),isNaN(Number(l))||(r=`1d20+${d*Number(l)}`,c=s)}else if(/\d+\s\(\d+d\d+(?:\s*[+\-]\s*\d+)?\)/.test(s)){let[,o,l]=s.match(/(\d+)\s\((\d+d\d+(?:\s*[+\-]\s*\d+)?)\)/)??[];!isNaN(Number(o))&&l&&(r=l)}return{text:r,original:c}},i=s=>/\w+ [\+\-]\d+/.test(s)||/[\+\-]\d+ to hit/.test(s)||/\d+\s\(\d+d\d+(?:\s*[+\-]\s*\d+)?\)/.test(s);return t.split(/([\+\-]\d+ to hit|\d+\s\(\d+d\d+(?:\s*[+\-]\s*\d+)?\)|\w+ [\+\-]\d+)/).map(s=>i(s)?n(s):s)}get layouts(){return[...Fn,...this.settings.layouts]}get defaultLayout(){return this.layouts?.find(t=>t.name==this.settings.default)??bt}async postprocessor(t,n,i){try{t=t.replace(/^image: (?:\[\[([\s\S]+?)\]\]|\[[\s\S]*?\]\(([\s\S]+?)\))\n/gm,(c,o,l)=>l?.length?`image: ${l} +`:`image: ${o} +`).replace(/\[\[([\s\S]+?)\]\]/g,"$1").replace(/\[([\s\S]*?)\]\(([\s\S]+?)\)/g,(c,o,l)=>o.length?`${l}|${o}`:`${l}`);let s=(0,je.parseYaml)(t);n.addClass("statblock-plugin-container"),n.parentElement?.addClass("statblock-plugin-parent");let r=new Tt({container:n,plugin:this,params:s,context:i.sourcePath});i.addChild(r)}catch(s){console.error(`Obsidian Statblock Error: +${s}`),createEl("pre").setText(`\`\`\`statblock +There was an error rendering the statblock: +${s.stack.split(` +`).filter(c=>!/^at/.test(c?.trim())).join(` +`)} +\`\`\``)}}render(t,n,i){let s=Object.assign(this.bestiary.get(t.name)??{},{...t});return s?(i&&(s.name=i),new Tt({container:n,monster:s,plugin:this,context:"STATBLOCK_RENDERER"})):null}getLayoutOrDefault(t){return this.layouts.find(n=>n.name==t?.layout)??this.defaultLayout}}; diff --git a/.obsidian/plugins/obsidian-5e-statblocks/manifest.json b/.obsidian/plugins/obsidian-5e-statblocks/manifest.json new file mode 100644 index 0000000..47504c2 --- /dev/null +++ b/.obsidian/plugins/obsidian-5e-statblocks/manifest.json @@ -0,0 +1,11 @@ +{ + "id": "obsidian-5e-statblocks", + "name": "TTRPG Statblocks", + "version": "2.24.20", + "description": "Create 5e styled statblocks in Obsidian.md", + "minAppVersion": "0.12.0", + "author": "Jeremy Valentine", + "authorUrl": "", + "fundingUrl": "https://www.buymeacoffee.com/valentine195", + "isDesktopOnly": false +} diff --git a/.obsidian/plugins/obsidian-5e-statblocks/styles.css b/.obsidian/plugins/obsidian-5e-statblocks/styles.css new file mode 100644 index 0000000..96936a4 --- /dev/null +++ b/.obsidian/plugins/obsidian-5e-statblocks/styles.css @@ -0,0 +1 @@ +:root{--statblock-primary-color: #7a200d;--statblock-rule-color: #922610;--statblock-background-color: #fdf1dc;--statblock-bar-color: #e69a28;--statblock-bar-border-size: 1px;--statblock-bar-border-color: #000;--statblock-image-width: 75px;--statblock-image-height: 75px;--statblock-image-border-size: 2px;--statblock-image-border-color: var(--statblock-primary-color);--statblock-border-size: 1px;--statblock-border-color: #ddd;--statblock-box-shadow-color: #ddd;--statblock-box-shadow-x-offset: 0;--statblock-box-shadow-y-offset: 0;--statblock-box-shadow-blur: 1.5em;--statblock-font-color: var(--statblock-primary-color);--statblock-font-weight: 700;--statblock-content-font: "Noto Sans", "Myriad Pro", Calibri, Helvetica, Arial, sans-serif;--statblock-content-font-size: 14px;--statblock-heading-font: "Libre Baskerville", "Lora", "Calisto MT", "Bookman Old Style", Bookman, "Goudy Old Style", Garamond, "Hoefler Text", "Bitstream Charter", Georgia, serif;--statblock-heading-font-color: var(--statblock-font-color);--statblock-heading-font-size: 23px;--statblock-heading-font-variant: small-caps;--statblock-heading-font-weight: var(--statblock-font-weight);--statblock-heading-line-height: inherit;--statblock-property-line-height: 1.4;--statblock-property-font-color: var(--statblock-font-color);--statblock-property-name-font-color: var(--statblock-font-color);--statblock-property-name-font-weight: bold;--statblock-section-heading-border-size: 1px;--statblock-section-heading-border-color: var(--statblock-primary-color);--statblock-section-heading-font-color: var(--statblock-font-color);--statblock-section-heading-font-size: 21px;--statblock-section-heading-font-variant: small-caps;--statblock-section-heading-font-weight: normal;--statblock-saves-line-height: 1.4;--statblock-spells-font-style: italic;--statblock-subheading-font-size: 12px;--statblock-subheading-font-style: italic;--statblock-subheading-font-weight: normal;--statblock-table-header-font-weight: bold;--statblock-traits-font-weight: bold;--statblock-traits-font-style: italic}.statblock-filter-container .search-input-container{margin-bottom:0}.no-border-top{border-top:0}.statblock-edit-block .statblock-additional-container>.additional>.setting-item .setting-item-name{font-size:small;font-style:italic}.statblock-edit-block .statblock-additional-container>.additional>.setting-item{color:var(--text-muted)}.statblock-edit-block .statblock-additional-container>:not(.additional){padding-bottom:0}.statblock-edit-block .setting-item{border:0;padding-top:0rem}.statblock-edit-block textarea{width:100%;resize:vertical;overflow:hidden}.statblock-additional-container.statblock-monsters button{margin-right:0}.statblock-file-upload>input[type=file]{display:none}.statblock-additional-container{border-top:1px solid var(--background-modifier-border);border-bottom:0px solid var(--background-modifier-border);padding:18px 0 0;background-color:inherit}.statblock-additional-container details{padding:18px 0}.statblock-additional-container .clickable-icon{margin:0 6px}.statblock-additional-container .task-list-inline{display:grid;grid-template-columns:1fr 1fr;gap:0 3em;padding-bottom:0;margin:0}.statblock-monster-filter{position:sticky;top:calc(-1 * var(--statblock-filter-offset));background-color:var(--statblock-filter-bg);z-index:99999}.statblock-additional-container>.setting-item-heading:only-child{padding-bottom:18px}.statblock-additional-container>.additional{margin:6px 12px}.statblock-additional-container .setting-item{border-top:0}.statblock-additional-container>.additional>.setting-item{padding-top:9px}.statblock-additional-container>.additional>.setting-item>.setting-item-control>*:first-child{margin:0 6px}.statblock-settings .coffee{width:60%;color:var(--text-faint);margin:1rem auto;text-align:center}.statblock-settings .coffee img{height:30px} diff --git a/.obsidian/plugins/obsidian-dice-roller/data.json b/.obsidian/plugins/obsidian-dice-roller/data.json new file mode 100644 index 0000000..bc8991f --- /dev/null +++ b/.obsidian/plugins/obsidian-dice-roller/data.json @@ -0,0 +1,22 @@ +{ + "returnAllTags": true, + "rollLinksForTags": false, + "copyContentButton": true, + "customFormulas": [], + "displayFormulaForMod": true, + "displayResultsInline": true, + "displayLookupRoll": true, + "formulas": {}, + "persistResults": false, + "results": {}, + "defaultRoll": 1, + "defaultFace": 100, + "renderer": false, + "renderAllDice": false, + "renderTime": 2000, + "diceColor": "#202020", + "textColor": "#ffffff", + "showLeafOnStartup": true, + "showDice": true, + "round": "None" +} \ No newline at end of file diff --git a/.obsidian/plugins/obsidian-dice-roller/main.js b/.obsidian/plugins/obsidian-dice-roller/main.js new file mode 100644 index 0000000..b360979 --- /dev/null +++ b/.obsidian/plugins/obsidian-dice-roller/main.js @@ -0,0 +1,5746 @@ +/* +THIS IS A GENERATED/BUNDLED FILE BY ESBUILD +if you want to view the source, please visit the github repository of this plugin +*/ + +var Bo=Object.create;var Kt=Object.defineProperty;var Po=Object.getOwnPropertyDescriptor;var Io=Object.getOwnPropertyNames;var ko=Object.getPrototypeOf,Uo=Object.prototype.hasOwnProperty;var Fi=n=>Kt(n,"__esModule",{value:!0});var M0=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Oo=(n,e)=>{Fi(n);for(var t in e)Kt(n,t,{get:e[t],enumerable:!0})},Go=(n,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Io(e))!Uo.call(n,i)&&i!=="default"&&Kt(n,i,{get:()=>e[i],enumerable:!(t=Po(e,i))||t.enumerable});return n},w2=n=>Go(Fi(Kt(n!=null?Bo(ko(n)):{},"default",n&&n.__esModule&&"default"in n?{get:()=>n.default,enumerable:!0}:{value:n,enumerable:!0})),n);var Bi=M0(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});require("obsidian");var qo=n=>{var e;return n?(e=n.plugins.plugins.dataview)===null||e===void 0?void 0:e.api:window.DataviewAPI},Wo=n=>n.plugins.enabledPlugins.has("dataview");Jt.getAPI=qo;Jt.isPluginEnabled=Wo});var Ma=M0((s6,bt)=>{(function(n){var e=typeof s6=="object"&&s6,t=typeof bt=="object"&&bt&&bt.exports==e&&bt,i=typeof global=="object"&&global;(i.global===i||i.window===i)&&(n=i);var a=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,r=/[\x01-\x7F]/g,s=/[\x01-\t\x0B\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,o=/<\u20D2|=\u20E5|>\u20D2|\u205F\u200A|\u219D\u0338|\u2202\u0338|\u2220\u20D2|\u2229\uFE00|\u222A\uFE00|\u223C\u20D2|\u223D\u0331|\u223E\u0333|\u2242\u0338|\u224B\u0338|\u224D\u20D2|\u224E\u0338|\u224F\u0338|\u2250\u0338|\u2261\u20E5|\u2264\u20D2|\u2265\u20D2|\u2266\u0338|\u2267\u0338|\u2268\uFE00|\u2269\uFE00|\u226A\u0338|\u226A\u20D2|\u226B\u0338|\u226B\u20D2|\u227F\u0338|\u2282\u20D2|\u2283\u20D2|\u228A\uFE00|\u228B\uFE00|\u228F\u0338|\u2290\u0338|\u2293\uFE00|\u2294\uFE00|\u22B4\u20D2|\u22B5\u20D2|\u22D8\u0338|\u22D9\u0338|\u22DA\uFE00|\u22DB\uFE00|\u22F5\u0338|\u22F9\u0338|\u2933\u0338|\u29CF\u0338|\u29D0\u0338|\u2A6D\u0338|\u2A70\u0338|\u2A7D\u0338|\u2A7E\u0338|\u2AA1\u0338|\u2AA2\u0338|\u2AAC\uFE00|\u2AAD\uFE00|\u2AAF\u0338|\u2AB0\u0338|\u2AC5\u0338|\u2AC6\u0338|\u2ACB\uFE00|\u2ACC\uFE00|\u2AFD\u20E5|[\xA0-\u0113\u0116-\u0122\u0124-\u012B\u012E-\u014D\u0150-\u017E\u0192\u01B5\u01F5\u0237\u02C6\u02C7\u02D8-\u02DD\u0311\u0391-\u03A1\u03A3-\u03A9\u03B1-\u03C9\u03D1\u03D2\u03D5\u03D6\u03DC\u03DD\u03F0\u03F1\u03F5\u03F6\u0401-\u040C\u040E-\u044F\u0451-\u045C\u045E\u045F\u2002-\u2005\u2007-\u2010\u2013-\u2016\u2018-\u201A\u201C-\u201E\u2020-\u2022\u2025\u2026\u2030-\u2035\u2039\u203A\u203E\u2041\u2043\u2044\u204F\u2057\u205F-\u2063\u20AC\u20DB\u20DC\u2102\u2105\u210A-\u2113\u2115-\u211E\u2122\u2124\u2127-\u2129\u212C\u212D\u212F-\u2131\u2133-\u2138\u2145-\u2148\u2153-\u215E\u2190-\u219B\u219D-\u21A7\u21A9-\u21AE\u21B0-\u21B3\u21B5-\u21B7\u21BA-\u21DB\u21DD\u21E4\u21E5\u21F5\u21FD-\u2205\u2207-\u2209\u220B\u220C\u220F-\u2214\u2216-\u2218\u221A\u221D-\u2238\u223A-\u2257\u2259\u225A\u225C\u225F-\u2262\u2264-\u228B\u228D-\u229B\u229D-\u22A5\u22A7-\u22B0\u22B2-\u22BB\u22BD-\u22DB\u22DE-\u22E3\u22E6-\u22F7\u22F9-\u22FE\u2305\u2306\u2308-\u2310\u2312\u2313\u2315\u2316\u231C-\u231F\u2322\u2323\u232D\u232E\u2336\u233D\u233F\u237C\u23B0\u23B1\u23B4-\u23B6\u23DC-\u23DF\u23E2\u23E7\u2423\u24C8\u2500\u2502\u250C\u2510\u2514\u2518\u251C\u2524\u252C\u2534\u253C\u2550-\u256C\u2580\u2584\u2588\u2591-\u2593\u25A1\u25AA\u25AB\u25AD\u25AE\u25B1\u25B3-\u25B5\u25B8\u25B9\u25BD-\u25BF\u25C2\u25C3\u25CA\u25CB\u25EC\u25EF\u25F8-\u25FC\u2605\u2606\u260E\u2640\u2642\u2660\u2663\u2665\u2666\u266A\u266D-\u266F\u2713\u2717\u2720\u2736\u2758\u2772\u2773\u27C8\u27C9\u27E6-\u27ED\u27F5-\u27FA\u27FC\u27FF\u2902-\u2905\u290C-\u2913\u2916\u2919-\u2920\u2923-\u292A\u2933\u2935-\u2939\u293C\u293D\u2945\u2948-\u294B\u294E-\u2976\u2978\u2979\u297B-\u297F\u2985\u2986\u298B-\u2996\u299A\u299C\u299D\u29A4-\u29B7\u29B9\u29BB\u29BC\u29BE-\u29C5\u29C9\u29CD-\u29D0\u29DC-\u29DE\u29E3-\u29E5\u29EB\u29F4\u29F6\u2A00-\u2A02\u2A04\u2A06\u2A0C\u2A0D\u2A10-\u2A17\u2A22-\u2A27\u2A29\u2A2A\u2A2D-\u2A31\u2A33-\u2A3C\u2A3F\u2A40\u2A42-\u2A4D\u2A50\u2A53-\u2A58\u2A5A-\u2A5D\u2A5F\u2A66\u2A6A\u2A6D-\u2A75\u2A77-\u2A9A\u2A9D-\u2AA2\u2AA4-\u2AB0\u2AB3-\u2AC8\u2ACB\u2ACC\u2ACF-\u2ADB\u2AE4\u2AE6-\u2AE9\u2AEB-\u2AF3\u2AFD\uFB00-\uFB04]|\uD835[\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDCCF\uDD04\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDD6B]/g,c={"\xAD":"shy","\u200C":"zwnj","\u200D":"zwj","\u200E":"lrm","\u2063":"ic","\u2062":"it","\u2061":"af","\u200F":"rlm","\u200B":"ZeroWidthSpace","\u2060":"NoBreak","\u0311":"DownBreve","\u20DB":"tdot","\u20DC":"DotDot"," ":"Tab","\n":"NewLine","\u2008":"puncsp","\u205F":"MediumSpace","\u2009":"thinsp","\u200A":"hairsp","\u2004":"emsp13","\u2002":"ensp","\u2005":"emsp14","\u2003":"emsp","\u2007":"numsp","\xA0":"nbsp","\u205F\u200A":"ThickSpace","\u203E":"oline",_:"lowbar","\u2010":"dash","\u2013":"ndash","\u2014":"mdash","\u2015":"horbar",",":"comma",";":"semi","\u204F":"bsemi",":":"colon","\u2A74":"Colone","!":"excl","\xA1":"iexcl","?":"quest","\xBF":"iquest",".":"period","\u2025":"nldr","\u2026":"mldr","\xB7":"middot","'":"apos","\u2018":"lsquo","\u2019":"rsquo","\u201A":"sbquo","\u2039":"lsaquo","\u203A":"rsaquo",'"':"quot","\u201C":"ldquo","\u201D":"rdquo","\u201E":"bdquo","\xAB":"laquo","\xBB":"raquo","(":"lpar",")":"rpar","[":"lsqb","]":"rsqb","{":"lcub","}":"rcub","\u2308":"lceil","\u2309":"rceil","\u230A":"lfloor","\u230B":"rfloor","\u2985":"lopar","\u2986":"ropar","\u298B":"lbrke","\u298C":"rbrke","\u298D":"lbrkslu","\u298E":"rbrksld","\u298F":"lbrksld","\u2990":"rbrkslu","\u2991":"langd","\u2992":"rangd","\u2993":"lparlt","\u2994":"rpargt","\u2995":"gtlPar","\u2996":"ltrPar","\u27E6":"lobrk","\u27E7":"robrk","\u27E8":"lang","\u27E9":"rang","\u27EA":"Lang","\u27EB":"Rang","\u27EC":"loang","\u27ED":"roang","\u2772":"lbbrk","\u2773":"rbbrk","\u2016":"Vert","\xA7":"sect","\xB6":"para","@":"commat","*":"ast","/":"sol",undefined:null,"&":"amp","#":"num","%":"percnt","\u2030":"permil","\u2031":"pertenk","\u2020":"dagger","\u2021":"Dagger","\u2022":"bull","\u2043":"hybull","\u2032":"prime","\u2033":"Prime","\u2034":"tprime","\u2057":"qprime","\u2035":"bprime","\u2041":"caret","`":"grave","\xB4":"acute","\u02DC":"tilde","^":"Hat","\xAF":"macr","\u02D8":"breve","\u02D9":"dot","\xA8":"die","\u02DA":"ring","\u02DD":"dblac","\xB8":"cedil","\u02DB":"ogon","\u02C6":"circ","\u02C7":"caron","\xB0":"deg","\xA9":"copy","\xAE":"reg","\u2117":"copysr","\u2118":"wp","\u211E":"rx","\u2127":"mho","\u2129":"iiota","\u2190":"larr","\u219A":"nlarr","\u2192":"rarr","\u219B":"nrarr","\u2191":"uarr","\u2193":"darr","\u2194":"harr","\u21AE":"nharr","\u2195":"varr","\u2196":"nwarr","\u2197":"nearr","\u2198":"searr","\u2199":"swarr","\u219D":"rarrw","\u219D\u0338":"nrarrw","\u219E":"Larr","\u219F":"Uarr","\u21A0":"Rarr","\u21A1":"Darr","\u21A2":"larrtl","\u21A3":"rarrtl","\u21A4":"mapstoleft","\u21A5":"mapstoup","\u21A6":"map","\u21A7":"mapstodown","\u21A9":"larrhk","\u21AA":"rarrhk","\u21AB":"larrlp","\u21AC":"rarrlp","\u21AD":"harrw","\u21B0":"lsh","\u21B1":"rsh","\u21B2":"ldsh","\u21B3":"rdsh","\u21B5":"crarr","\u21B6":"cularr","\u21B7":"curarr","\u21BA":"olarr","\u21BB":"orarr","\u21BC":"lharu","\u21BD":"lhard","\u21BE":"uharr","\u21BF":"uharl","\u21C0":"rharu","\u21C1":"rhard","\u21C2":"dharr","\u21C3":"dharl","\u21C4":"rlarr","\u21C5":"udarr","\u21C6":"lrarr","\u21C7":"llarr","\u21C8":"uuarr","\u21C9":"rrarr","\u21CA":"ddarr","\u21CB":"lrhar","\u21CC":"rlhar","\u21D0":"lArr","\u21CD":"nlArr","\u21D1":"uArr","\u21D2":"rArr","\u21CF":"nrArr","\u21D3":"dArr","\u21D4":"iff","\u21CE":"nhArr","\u21D5":"vArr","\u21D6":"nwArr","\u21D7":"neArr","\u21D8":"seArr","\u21D9":"swArr","\u21DA":"lAarr","\u21DB":"rAarr","\u21DD":"zigrarr","\u21E4":"larrb","\u21E5":"rarrb","\u21F5":"duarr","\u21FD":"loarr","\u21FE":"roarr","\u21FF":"hoarr","\u2200":"forall","\u2201":"comp","\u2202":"part","\u2202\u0338":"npart","\u2203":"exist","\u2204":"nexist","\u2205":"empty","\u2207":"Del","\u2208":"in","\u2209":"notin","\u220B":"ni","\u220C":"notni","\u03F6":"bepsi","\u220F":"prod","\u2210":"coprod","\u2211":"sum","+":"plus","\xB1":"pm","\xF7":"div","\xD7":"times","<":"lt","\u226E":"nlt","<\u20D2":"nvlt","=":"equals","\u2260":"ne","=\u20E5":"bne","\u2A75":"Equal",">":"gt","\u226F":"ngt",">\u20D2":"nvgt","\xAC":"not","|":"vert","\xA6":"brvbar","\u2212":"minus","\u2213":"mp","\u2214":"plusdo","\u2044":"frasl","\u2216":"setmn","\u2217":"lowast","\u2218":"compfn","\u221A":"Sqrt","\u221D":"prop","\u221E":"infin","\u221F":"angrt","\u2220":"ang","\u2220\u20D2":"nang","\u2221":"angmsd","\u2222":"angsph","\u2223":"mid","\u2224":"nmid","\u2225":"par","\u2226":"npar","\u2227":"and","\u2228":"or","\u2229":"cap","\u2229\uFE00":"caps","\u222A":"cup","\u222A\uFE00":"cups","\u222B":"int","\u222C":"Int","\u222D":"tint","\u2A0C":"qint","\u222E":"oint","\u222F":"Conint","\u2230":"Cconint","\u2231":"cwint","\u2232":"cwconint","\u2233":"awconint","\u2234":"there4","\u2235":"becaus","\u2236":"ratio","\u2237":"Colon","\u2238":"minusd","\u223A":"mDDot","\u223B":"homtht","\u223C":"sim","\u2241":"nsim","\u223C\u20D2":"nvsim","\u223D":"bsim","\u223D\u0331":"race","\u223E":"ac","\u223E\u0333":"acE","\u223F":"acd","\u2240":"wr","\u2242":"esim","\u2242\u0338":"nesim","\u2243":"sime","\u2244":"nsime","\u2245":"cong","\u2247":"ncong","\u2246":"simne","\u2248":"ap","\u2249":"nap","\u224A":"ape","\u224B":"apid","\u224B\u0338":"napid","\u224C":"bcong","\u224D":"CupCap","\u226D":"NotCupCap","\u224D\u20D2":"nvap","\u224E":"bump","\u224E\u0338":"nbump","\u224F":"bumpe","\u224F\u0338":"nbumpe","\u2250":"doteq","\u2250\u0338":"nedot","\u2251":"eDot","\u2252":"efDot","\u2253":"erDot","\u2254":"colone","\u2255":"ecolon","\u2256":"ecir","\u2257":"cire","\u2259":"wedgeq","\u225A":"veeeq","\u225C":"trie","\u225F":"equest","\u2261":"equiv","\u2262":"nequiv","\u2261\u20E5":"bnequiv","\u2264":"le","\u2270":"nle","\u2264\u20D2":"nvle","\u2265":"ge","\u2271":"nge","\u2265\u20D2":"nvge","\u2266":"lE","\u2266\u0338":"nlE","\u2267":"gE","\u2267\u0338":"ngE","\u2268\uFE00":"lvnE","\u2268":"lnE","\u2269":"gnE","\u2269\uFE00":"gvnE","\u226A":"ll","\u226A\u0338":"nLtv","\u226A\u20D2":"nLt","\u226B":"gg","\u226B\u0338":"nGtv","\u226B\u20D2":"nGt","\u226C":"twixt","\u2272":"lsim","\u2274":"nlsim","\u2273":"gsim","\u2275":"ngsim","\u2276":"lg","\u2278":"ntlg","\u2277":"gl","\u2279":"ntgl","\u227A":"pr","\u2280":"npr","\u227B":"sc","\u2281":"nsc","\u227C":"prcue","\u22E0":"nprcue","\u227D":"sccue","\u22E1":"nsccue","\u227E":"prsim","\u227F":"scsim","\u227F\u0338":"NotSucceedsTilde","\u2282":"sub","\u2284":"nsub","\u2282\u20D2":"vnsub","\u2283":"sup","\u2285":"nsup","\u2283\u20D2":"vnsup","\u2286":"sube","\u2288":"nsube","\u2287":"supe","\u2289":"nsupe","\u228A\uFE00":"vsubne","\u228A":"subne","\u228B\uFE00":"vsupne","\u228B":"supne","\u228D":"cupdot","\u228E":"uplus","\u228F":"sqsub","\u228F\u0338":"NotSquareSubset","\u2290":"sqsup","\u2290\u0338":"NotSquareSuperset","\u2291":"sqsube","\u22E2":"nsqsube","\u2292":"sqsupe","\u22E3":"nsqsupe","\u2293":"sqcap","\u2293\uFE00":"sqcaps","\u2294":"sqcup","\u2294\uFE00":"sqcups","\u2295":"oplus","\u2296":"ominus","\u2297":"otimes","\u2298":"osol","\u2299":"odot","\u229A":"ocir","\u229B":"oast","\u229D":"odash","\u229E":"plusb","\u229F":"minusb","\u22A0":"timesb","\u22A1":"sdotb","\u22A2":"vdash","\u22AC":"nvdash","\u22A3":"dashv","\u22A4":"top","\u22A5":"bot","\u22A7":"models","\u22A8":"vDash","\u22AD":"nvDash","\u22A9":"Vdash","\u22AE":"nVdash","\u22AA":"Vvdash","\u22AB":"VDash","\u22AF":"nVDash","\u22B0":"prurel","\u22B2":"vltri","\u22EA":"nltri","\u22B3":"vrtri","\u22EB":"nrtri","\u22B4":"ltrie","\u22EC":"nltrie","\u22B4\u20D2":"nvltrie","\u22B5":"rtrie","\u22ED":"nrtrie","\u22B5\u20D2":"nvrtrie","\u22B6":"origof","\u22B7":"imof","\u22B8":"mumap","\u22B9":"hercon","\u22BA":"intcal","\u22BB":"veebar","\u22BD":"barvee","\u22BE":"angrtvb","\u22BF":"lrtri","\u22C0":"Wedge","\u22C1":"Vee","\u22C2":"xcap","\u22C3":"xcup","\u22C4":"diam","\u22C5":"sdot","\u22C6":"Star","\u22C7":"divonx","\u22C8":"bowtie","\u22C9":"ltimes","\u22CA":"rtimes","\u22CB":"lthree","\u22CC":"rthree","\u22CD":"bsime","\u22CE":"cuvee","\u22CF":"cuwed","\u22D0":"Sub","\u22D1":"Sup","\u22D2":"Cap","\u22D3":"Cup","\u22D4":"fork","\u22D5":"epar","\u22D6":"ltdot","\u22D7":"gtdot","\u22D8":"Ll","\u22D8\u0338":"nLl","\u22D9":"Gg","\u22D9\u0338":"nGg","\u22DA\uFE00":"lesg","\u22DA":"leg","\u22DB":"gel","\u22DB\uFE00":"gesl","\u22DE":"cuepr","\u22DF":"cuesc","\u22E6":"lnsim","\u22E7":"gnsim","\u22E8":"prnsim","\u22E9":"scnsim","\u22EE":"vellip","\u22EF":"ctdot","\u22F0":"utdot","\u22F1":"dtdot","\u22F2":"disin","\u22F3":"isinsv","\u22F4":"isins","\u22F5":"isindot","\u22F5\u0338":"notindot","\u22F6":"notinvc","\u22F7":"notinvb","\u22F9":"isinE","\u22F9\u0338":"notinE","\u22FA":"nisd","\u22FB":"xnis","\u22FC":"nis","\u22FD":"notnivc","\u22FE":"notnivb","\u2305":"barwed","\u2306":"Barwed","\u230C":"drcrop","\u230D":"dlcrop","\u230E":"urcrop","\u230F":"ulcrop","\u2310":"bnot","\u2312":"profline","\u2313":"profsurf","\u2315":"telrec","\u2316":"target","\u231C":"ulcorn","\u231D":"urcorn","\u231E":"dlcorn","\u231F":"drcorn","\u2322":"frown","\u2323":"smile","\u232D":"cylcty","\u232E":"profalar","\u2336":"topbot","\u233D":"ovbar","\u233F":"solbar","\u237C":"angzarr","\u23B0":"lmoust","\u23B1":"rmoust","\u23B4":"tbrk","\u23B5":"bbrk","\u23B6":"bbrktbrk","\u23DC":"OverParenthesis","\u23DD":"UnderParenthesis","\u23DE":"OverBrace","\u23DF":"UnderBrace","\u23E2":"trpezium","\u23E7":"elinters","\u2423":"blank","\u2500":"boxh","\u2502":"boxv","\u250C":"boxdr","\u2510":"boxdl","\u2514":"boxur","\u2518":"boxul","\u251C":"boxvr","\u2524":"boxvl","\u252C":"boxhd","\u2534":"boxhu","\u253C":"boxvh","\u2550":"boxH","\u2551":"boxV","\u2552":"boxdR","\u2553":"boxDr","\u2554":"boxDR","\u2555":"boxdL","\u2556":"boxDl","\u2557":"boxDL","\u2558":"boxuR","\u2559":"boxUr","\u255A":"boxUR","\u255B":"boxuL","\u255C":"boxUl","\u255D":"boxUL","\u255E":"boxvR","\u255F":"boxVr","\u2560":"boxVR","\u2561":"boxvL","\u2562":"boxVl","\u2563":"boxVL","\u2564":"boxHd","\u2565":"boxhD","\u2566":"boxHD","\u2567":"boxHu","\u2568":"boxhU","\u2569":"boxHU","\u256A":"boxvH","\u256B":"boxVh","\u256C":"boxVH","\u2580":"uhblk","\u2584":"lhblk","\u2588":"block","\u2591":"blk14","\u2592":"blk12","\u2593":"blk34","\u25A1":"squ","\u25AA":"squf","\u25AB":"EmptyVerySmallSquare","\u25AD":"rect","\u25AE":"marker","\u25B1":"fltns","\u25B3":"xutri","\u25B4":"utrif","\u25B5":"utri","\u25B8":"rtrif","\u25B9":"rtri","\u25BD":"xdtri","\u25BE":"dtrif","\u25BF":"dtri","\u25C2":"ltrif","\u25C3":"ltri","\u25CA":"loz","\u25CB":"cir","\u25EC":"tridot","\u25EF":"xcirc","\u25F8":"ultri","\u25F9":"urtri","\u25FA":"lltri","\u25FB":"EmptySmallSquare","\u25FC":"FilledSmallSquare","\u2605":"starf","\u2606":"star","\u260E":"phone","\u2640":"female","\u2642":"male","\u2660":"spades","\u2663":"clubs","\u2665":"hearts","\u2666":"diams","\u266A":"sung","\u2713":"check","\u2717":"cross","\u2720":"malt","\u2736":"sext","\u2758":"VerticalSeparator","\u27C8":"bsolhsub","\u27C9":"suphsol","\u27F5":"xlarr","\u27F6":"xrarr","\u27F7":"xharr","\u27F8":"xlArr","\u27F9":"xrArr","\u27FA":"xhArr","\u27FC":"xmap","\u27FF":"dzigrarr","\u2902":"nvlArr","\u2903":"nvrArr","\u2904":"nvHarr","\u2905":"Map","\u290C":"lbarr","\u290D":"rbarr","\u290E":"lBarr","\u290F":"rBarr","\u2910":"RBarr","\u2911":"DDotrahd","\u2912":"UpArrowBar","\u2913":"DownArrowBar","\u2916":"Rarrtl","\u2919":"latail","\u291A":"ratail","\u291B":"lAtail","\u291C":"rAtail","\u291D":"larrfs","\u291E":"rarrfs","\u291F":"larrbfs","\u2920":"rarrbfs","\u2923":"nwarhk","\u2924":"nearhk","\u2925":"searhk","\u2926":"swarhk","\u2927":"nwnear","\u2928":"toea","\u2929":"tosa","\u292A":"swnwar","\u2933":"rarrc","\u2933\u0338":"nrarrc","\u2935":"cudarrr","\u2936":"ldca","\u2937":"rdca","\u2938":"cudarrl","\u2939":"larrpl","\u293C":"curarrm","\u293D":"cularrp","\u2945":"rarrpl","\u2948":"harrcir","\u2949":"Uarrocir","\u294A":"lurdshar","\u294B":"ldrushar","\u294E":"LeftRightVector","\u294F":"RightUpDownVector","\u2950":"DownLeftRightVector","\u2951":"LeftUpDownVector","\u2952":"LeftVectorBar","\u2953":"RightVectorBar","\u2954":"RightUpVectorBar","\u2955":"RightDownVectorBar","\u2956":"DownLeftVectorBar","\u2957":"DownRightVectorBar","\u2958":"LeftUpVectorBar","\u2959":"LeftDownVectorBar","\u295A":"LeftTeeVector","\u295B":"RightTeeVector","\u295C":"RightUpTeeVector","\u295D":"RightDownTeeVector","\u295E":"DownLeftTeeVector","\u295F":"DownRightTeeVector","\u2960":"LeftUpTeeVector","\u2961":"LeftDownTeeVector","\u2962":"lHar","\u2963":"uHar","\u2964":"rHar","\u2965":"dHar","\u2966":"luruhar","\u2967":"ldrdhar","\u2968":"ruluhar","\u2969":"rdldhar","\u296A":"lharul","\u296B":"llhard","\u296C":"rharul","\u296D":"lrhard","\u296E":"udhar","\u296F":"duhar","\u2970":"RoundImplies","\u2971":"erarr","\u2972":"simrarr","\u2973":"larrsim","\u2974":"rarrsim","\u2975":"rarrap","\u2976":"ltlarr","\u2978":"gtrarr","\u2979":"subrarr","\u297B":"suplarr","\u297C":"lfisht","\u297D":"rfisht","\u297E":"ufisht","\u297F":"dfisht","\u299A":"vzigzag","\u299C":"vangrt","\u299D":"angrtvbd","\u29A4":"ange","\u29A5":"range","\u29A6":"dwangle","\u29A7":"uwangle","\u29A8":"angmsdaa","\u29A9":"angmsdab","\u29AA":"angmsdac","\u29AB":"angmsdad","\u29AC":"angmsdae","\u29AD":"angmsdaf","\u29AE":"angmsdag","\u29AF":"angmsdah","\u29B0":"bemptyv","\u29B1":"demptyv","\u29B2":"cemptyv","\u29B3":"raemptyv","\u29B4":"laemptyv","\u29B5":"ohbar","\u29B6":"omid","\u29B7":"opar","\u29B9":"operp","\u29BB":"olcross","\u29BC":"odsold","\u29BE":"olcir","\u29BF":"ofcir","\u29C0":"olt","\u29C1":"ogt","\u29C2":"cirscir","\u29C3":"cirE","\u29C4":"solb","\u29C5":"bsolb","\u29C9":"boxbox","\u29CD":"trisb","\u29CE":"rtriltri","\u29CF":"LeftTriangleBar","\u29CF\u0338":"NotLeftTriangleBar","\u29D0":"RightTriangleBar","\u29D0\u0338":"NotRightTriangleBar","\u29DC":"iinfin","\u29DD":"infintie","\u29DE":"nvinfin","\u29E3":"eparsl","\u29E4":"smeparsl","\u29E5":"eqvparsl","\u29EB":"lozf","\u29F4":"RuleDelayed","\u29F6":"dsol","\u2A00":"xodot","\u2A01":"xoplus","\u2A02":"xotime","\u2A04":"xuplus","\u2A06":"xsqcup","\u2A0D":"fpartint","\u2A10":"cirfnint","\u2A11":"awint","\u2A12":"rppolint","\u2A13":"scpolint","\u2A14":"npolint","\u2A15":"pointint","\u2A16":"quatint","\u2A17":"intlarhk","\u2A22":"pluscir","\u2A23":"plusacir","\u2A24":"simplus","\u2A25":"plusdu","\u2A26":"plussim","\u2A27":"plustwo","\u2A29":"mcomma","\u2A2A":"minusdu","\u2A2D":"loplus","\u2A2E":"roplus","\u2A2F":"Cross","\u2A30":"timesd","\u2A31":"timesbar","\u2A33":"smashp","\u2A34":"lotimes","\u2A35":"rotimes","\u2A36":"otimesas","\u2A37":"Otimes","\u2A38":"odiv","\u2A39":"triplus","\u2A3A":"triminus","\u2A3B":"tritime","\u2A3C":"iprod","\u2A3F":"amalg","\u2A40":"capdot","\u2A42":"ncup","\u2A43":"ncap","\u2A44":"capand","\u2A45":"cupor","\u2A46":"cupcap","\u2A47":"capcup","\u2A48":"cupbrcap","\u2A49":"capbrcup","\u2A4A":"cupcup","\u2A4B":"capcap","\u2A4C":"ccups","\u2A4D":"ccaps","\u2A50":"ccupssm","\u2A53":"And","\u2A54":"Or","\u2A55":"andand","\u2A56":"oror","\u2A57":"orslope","\u2A58":"andslope","\u2A5A":"andv","\u2A5B":"orv","\u2A5C":"andd","\u2A5D":"ord","\u2A5F":"wedbar","\u2A66":"sdote","\u2A6A":"simdot","\u2A6D":"congdot","\u2A6D\u0338":"ncongdot","\u2A6E":"easter","\u2A6F":"apacir","\u2A70":"apE","\u2A70\u0338":"napE","\u2A71":"eplus","\u2A72":"pluse","\u2A73":"Esim","\u2A77":"eDDot","\u2A78":"equivDD","\u2A79":"ltcir","\u2A7A":"gtcir","\u2A7B":"ltquest","\u2A7C":"gtquest","\u2A7D":"les","\u2A7D\u0338":"nles","\u2A7E":"ges","\u2A7E\u0338":"nges","\u2A7F":"lesdot","\u2A80":"gesdot","\u2A81":"lesdoto","\u2A82":"gesdoto","\u2A83":"lesdotor","\u2A84":"gesdotol","\u2A85":"lap","\u2A86":"gap","\u2A87":"lne","\u2A88":"gne","\u2A89":"lnap","\u2A8A":"gnap","\u2A8B":"lEg","\u2A8C":"gEl","\u2A8D":"lsime","\u2A8E":"gsime","\u2A8F":"lsimg","\u2A90":"gsiml","\u2A91":"lgE","\u2A92":"glE","\u2A93":"lesges","\u2A94":"gesles","\u2A95":"els","\u2A96":"egs","\u2A97":"elsdot","\u2A98":"egsdot","\u2A99":"el","\u2A9A":"eg","\u2A9D":"siml","\u2A9E":"simg","\u2A9F":"simlE","\u2AA0":"simgE","\u2AA1":"LessLess","\u2AA1\u0338":"NotNestedLessLess","\u2AA2":"GreaterGreater","\u2AA2\u0338":"NotNestedGreaterGreater","\u2AA4":"glj","\u2AA5":"gla","\u2AA6":"ltcc","\u2AA7":"gtcc","\u2AA8":"lescc","\u2AA9":"gescc","\u2AAA":"smt","\u2AAB":"lat","\u2AAC":"smte","\u2AAC\uFE00":"smtes","\u2AAD":"late","\u2AAD\uFE00":"lates","\u2AAE":"bumpE","\u2AAF":"pre","\u2AAF\u0338":"npre","\u2AB0":"sce","\u2AB0\u0338":"nsce","\u2AB3":"prE","\u2AB4":"scE","\u2AB5":"prnE","\u2AB6":"scnE","\u2AB7":"prap","\u2AB8":"scap","\u2AB9":"prnap","\u2ABA":"scnap","\u2ABB":"Pr","\u2ABC":"Sc","\u2ABD":"subdot","\u2ABE":"supdot","\u2ABF":"subplus","\u2AC0":"supplus","\u2AC1":"submult","\u2AC2":"supmult","\u2AC3":"subedot","\u2AC4":"supedot","\u2AC5":"subE","\u2AC5\u0338":"nsubE","\u2AC6":"supE","\u2AC6\u0338":"nsupE","\u2AC7":"subsim","\u2AC8":"supsim","\u2ACB\uFE00":"vsubnE","\u2ACB":"subnE","\u2ACC\uFE00":"vsupnE","\u2ACC":"supnE","\u2ACF":"csub","\u2AD0":"csup","\u2AD1":"csube","\u2AD2":"csupe","\u2AD3":"subsup","\u2AD4":"supsub","\u2AD5":"subsub","\u2AD6":"supsup","\u2AD7":"suphsub","\u2AD8":"supdsub","\u2AD9":"forkv","\u2ADA":"topfork","\u2ADB":"mlcp","\u2AE4":"Dashv","\u2AE6":"Vdashl","\u2AE7":"Barv","\u2AE8":"vBar","\u2AE9":"vBarv","\u2AEB":"Vbar","\u2AEC":"Not","\u2AED":"bNot","\u2AEE":"rnmid","\u2AEF":"cirmid","\u2AF0":"midcir","\u2AF1":"topcir","\u2AF2":"nhpar","\u2AF3":"parsim","\u2AFD":"parsl","\u2AFD\u20E5":"nparsl","\u266D":"flat","\u266E":"natur","\u266F":"sharp","\xA4":"curren","\xA2":"cent",$:"dollar","\xA3":"pound","\xA5":"yen","\u20AC":"euro","\xB9":"sup1","\xBD":"half","\u2153":"frac13","\xBC":"frac14","\u2155":"frac15","\u2159":"frac16","\u215B":"frac18","\xB2":"sup2","\u2154":"frac23","\u2156":"frac25","\xB3":"sup3","\xBE":"frac34","\u2157":"frac35","\u215C":"frac38","\u2158":"frac45","\u215A":"frac56","\u215D":"frac58","\u215E":"frac78","\u{1D4B6}":"ascr","\u{1D552}":"aopf","\u{1D51E}":"afr","\u{1D538}":"Aopf","\u{1D504}":"Afr","\u{1D49C}":"Ascr",\u00AA:"ordf",\u00E1:"aacute",\u00C1:"Aacute",\u00E0:"agrave",\u00C0:"Agrave",\u0103:"abreve",\u0102:"Abreve",\u00E2:"acirc",\u00C2:"Acirc",\u00E5:"aring",\u00C5:"angst",\u00E4:"auml",\u00C4:"Auml",\u00E3:"atilde",\u00C3:"Atilde",\u0105:"aogon",\u0104:"Aogon",\u0101:"amacr",\u0100:"Amacr",\u00E6:"aelig",\u00C6:"AElig","\u{1D4B7}":"bscr","\u{1D553}":"bopf","\u{1D51F}":"bfr","\u{1D539}":"Bopf",\u212C:"Bscr","\u{1D505}":"Bfr","\u{1D520}":"cfr","\u{1D4B8}":"cscr","\u{1D554}":"copf",\u212D:"Cfr","\u{1D49E}":"Cscr",\u2102:"Copf",\u0107:"cacute",\u0106:"Cacute",\u0109:"ccirc",\u0108:"Ccirc",\u010D:"ccaron",\u010C:"Ccaron",\u010B:"cdot",\u010A:"Cdot",\u00E7:"ccedil",\u00C7:"Ccedil","\u2105":"incare","\u{1D521}":"dfr","\u2146":"dd","\u{1D555}":"dopf","\u{1D4B9}":"dscr","\u{1D49F}":"Dscr","\u{1D507}":"Dfr","\u2145":"DD","\u{1D53B}":"Dopf",\u010F:"dcaron",\u010E:"Dcaron",\u0111:"dstrok",\u0110:"Dstrok",\u00F0:"eth",\u00D0:"ETH","\u2147":"ee",\u212F:"escr","\u{1D522}":"efr","\u{1D556}":"eopf",\u2130:"Escr","\u{1D508}":"Efr","\u{1D53C}":"Eopf",\u00E9:"eacute",\u00C9:"Eacute",\u00E8:"egrave",\u00C8:"Egrave",\u00EA:"ecirc",\u00CA:"Ecirc",\u011B:"ecaron",\u011A:"Ecaron",\u00EB:"euml",\u00CB:"Euml",\u0117:"edot",\u0116:"Edot",\u0119:"eogon",\u0118:"Eogon",\u0113:"emacr",\u0112:"Emacr","\u{1D523}":"ffr","\u{1D557}":"fopf","\u{1D4BB}":"fscr","\u{1D509}":"Ffr","\u{1D53D}":"Fopf",\u2131:"Fscr",\uFB00:"fflig",\uFB03:"ffilig",\uFB04:"ffllig",\uFB01:"filig",fj:"fjlig",\uFB02:"fllig",\u0192:"fnof",\u210A:"gscr","\u{1D558}":"gopf","\u{1D524}":"gfr","\u{1D4A2}":"Gscr","\u{1D53E}":"Gopf","\u{1D50A}":"Gfr",\u01F5:"gacute",\u011F:"gbreve",\u011E:"Gbreve",\u011D:"gcirc",\u011C:"Gcirc",\u0121:"gdot",\u0120:"Gdot",\u0122:"Gcedil","\u{1D525}":"hfr",\u210E:"planckh","\u{1D4BD}":"hscr","\u{1D559}":"hopf",\u210B:"Hscr",\u210C:"Hfr",\u210D:"Hopf",\u0125:"hcirc",\u0124:"Hcirc",\u210F:"hbar",\u0127:"hstrok",\u0126:"Hstrok","\u{1D55A}":"iopf","\u{1D526}":"ifr","\u{1D4BE}":"iscr","\u2148":"ii","\u{1D540}":"Iopf",\u2110:"Iscr",\u2111:"Im",\u00ED:"iacute",\u00CD:"Iacute",\u00EC:"igrave",\u00CC:"Igrave",\u00EE:"icirc",\u00CE:"Icirc",\u00EF:"iuml",\u00CF:"Iuml",\u0129:"itilde",\u0128:"Itilde",\u0130:"Idot",\u012F:"iogon",\u012E:"Iogon",\u012B:"imacr",\u012A:"Imacr",\u0133:"ijlig",\u0132:"IJlig",\u0131:"imath","\u{1D4BF}":"jscr","\u{1D55B}":"jopf","\u{1D527}":"jfr","\u{1D4A5}":"Jscr","\u{1D50D}":"Jfr","\u{1D541}":"Jopf",\u0135:"jcirc",\u0134:"Jcirc","\u0237":"jmath","\u{1D55C}":"kopf","\u{1D4C0}":"kscr","\u{1D528}":"kfr","\u{1D4A6}":"Kscr","\u{1D542}":"Kopf","\u{1D50E}":"Kfr",\u0137:"kcedil",\u0136:"Kcedil","\u{1D529}":"lfr","\u{1D4C1}":"lscr",\u2113:"ell","\u{1D55D}":"lopf",\u2112:"Lscr","\u{1D50F}":"Lfr","\u{1D543}":"Lopf",\u013A:"lacute",\u0139:"Lacute",\u013E:"lcaron",\u013D:"Lcaron",\u013C:"lcedil",\u013B:"Lcedil",\u0142:"lstrok",\u0141:"Lstrok",\u0140:"lmidot",\u013F:"Lmidot","\u{1D52A}":"mfr","\u{1D55E}":"mopf","\u{1D4C2}":"mscr","\u{1D510}":"Mfr","\u{1D544}":"Mopf",\u2133:"Mscr","\u{1D52B}":"nfr","\u{1D55F}":"nopf","\u{1D4C3}":"nscr",\u2115:"Nopf","\u{1D4A9}":"Nscr","\u{1D511}":"Nfr",\u0144:"nacute",\u0143:"Nacute",\u0148:"ncaron",\u0147:"Ncaron",\u00F1:"ntilde",\u00D1:"Ntilde",\u0146:"ncedil",\u0145:"Ncedil","\u2116":"numero",\u014B:"eng",\u014A:"ENG","\u{1D560}":"oopf","\u{1D52C}":"ofr",\u2134:"oscr","\u{1D4AA}":"Oscr","\u{1D512}":"Ofr","\u{1D546}":"Oopf",\u00BA:"ordm",\u00F3:"oacute",\u00D3:"Oacute",\u00F2:"ograve",\u00D2:"Ograve",\u00F4:"ocirc",\u00D4:"Ocirc",\u00F6:"ouml",\u00D6:"Ouml",\u0151:"odblac",\u0150:"Odblac",\u00F5:"otilde",\u00D5:"Otilde",\u00F8:"oslash",\u00D8:"Oslash",\u014D:"omacr",\u014C:"Omacr",\u0153:"oelig",\u0152:"OElig","\u{1D52D}":"pfr","\u{1D4C5}":"pscr","\u{1D561}":"popf",\u2119:"Popf","\u{1D513}":"Pfr","\u{1D4AB}":"Pscr","\u{1D562}":"qopf","\u{1D52E}":"qfr","\u{1D4C6}":"qscr","\u{1D4AC}":"Qscr","\u{1D514}":"Qfr",\u211A:"Qopf",\u0138:"kgreen","\u{1D52F}":"rfr","\u{1D563}":"ropf","\u{1D4C7}":"rscr",\u211B:"Rscr",\u211C:"Re",\u211D:"Ropf",\u0155:"racute",\u0154:"Racute",\u0159:"rcaron",\u0158:"Rcaron",\u0157:"rcedil",\u0156:"Rcedil","\u{1D564}":"sopf","\u{1D4C8}":"sscr","\u{1D530}":"sfr","\u{1D54A}":"Sopf","\u{1D516}":"Sfr","\u{1D4AE}":"Sscr","\u24C8":"oS",\u015B:"sacute",\u015A:"Sacute",\u015D:"scirc",\u015C:"Scirc",\u0161:"scaron",\u0160:"Scaron",\u015F:"scedil",\u015E:"Scedil",\u00DF:"szlig","\u{1D531}":"tfr","\u{1D4C9}":"tscr","\u{1D565}":"topf","\u{1D4AF}":"Tscr","\u{1D517}":"Tfr","\u{1D54B}":"Topf",\u0165:"tcaron",\u0164:"Tcaron",\u0163:"tcedil",\u0162:"Tcedil","\u2122":"trade",\u0167:"tstrok",\u0166:"Tstrok","\u{1D4CA}":"uscr","\u{1D566}":"uopf","\u{1D532}":"ufr","\u{1D54C}":"Uopf","\u{1D518}":"Ufr","\u{1D4B0}":"Uscr",\u00FA:"uacute",\u00DA:"Uacute",\u00F9:"ugrave",\u00D9:"Ugrave",\u016D:"ubreve",\u016C:"Ubreve",\u00FB:"ucirc",\u00DB:"Ucirc",\u016F:"uring",\u016E:"Uring",\u00FC:"uuml",\u00DC:"Uuml",\u0171:"udblac",\u0170:"Udblac",\u0169:"utilde",\u0168:"Utilde",\u0173:"uogon",\u0172:"Uogon",\u016B:"umacr",\u016A:"Umacr","\u{1D533}":"vfr","\u{1D567}":"vopf","\u{1D4CB}":"vscr","\u{1D519}":"Vfr","\u{1D54D}":"Vopf","\u{1D4B1}":"Vscr","\u{1D568}":"wopf","\u{1D4CC}":"wscr","\u{1D534}":"wfr","\u{1D4B2}":"Wscr","\u{1D54E}":"Wopf","\u{1D51A}":"Wfr",\u0175:"wcirc",\u0174:"Wcirc","\u{1D535}":"xfr","\u{1D4CD}":"xscr","\u{1D569}":"xopf","\u{1D54F}":"Xopf","\u{1D51B}":"Xfr","\u{1D4B3}":"Xscr","\u{1D536}":"yfr","\u{1D4CE}":"yscr","\u{1D56A}":"yopf","\u{1D4B4}":"Yscr","\u{1D51C}":"Yfr","\u{1D550}":"Yopf",\u00FD:"yacute",\u00DD:"Yacute",\u0177:"ycirc",\u0176:"Ycirc",\u00FF:"yuml",\u0178:"Yuml","\u{1D4CF}":"zscr","\u{1D537}":"zfr","\u{1D56B}":"zopf",\u2128:"Zfr",\u2124:"Zopf","\u{1D4B5}":"Zscr",\u017A:"zacute",\u0179:"Zacute",\u017E:"zcaron",\u017D:"Zcaron",\u017C:"zdot",\u017B:"Zdot",\u01B5:"imped",\u00FE:"thorn",\u00DE:"THORN",\u0149:"napos",\u03B1:"alpha",\u0391:"Alpha",\u03B2:"beta",\u0392:"Beta",\u03B3:"gamma",\u0393:"Gamma",\u03B4:"delta",\u0394:"Delta",\u03B5:"epsi","\u03F5":"epsiv",\u0395:"Epsilon",\u03DD:"gammad",\u03DC:"Gammad",\u03B6:"zeta",\u0396:"Zeta",\u03B7:"eta",\u0397:"Eta",\u03B8:"theta",\u03D1:"thetav",\u0398:"Theta",\u03B9:"iota",\u0399:"Iota",\u03BA:"kappa",\u03F0:"kappav",\u039A:"Kappa",\u03BB:"lambda",\u039B:"Lambda",\u03BC:"mu",\u00B5:"micro",\u039C:"Mu",\u03BD:"nu",\u039D:"Nu",\u03BE:"xi",\u039E:"Xi",\u03BF:"omicron",\u039F:"Omicron",\u03C0:"pi",\u03D6:"piv",\u03A0:"Pi",\u03C1:"rho",\u03F1:"rhov",\u03A1:"Rho",\u03C3:"sigma",\u03A3:"Sigma",\u03C2:"sigmaf",\u03C4:"tau",\u03A4:"Tau",\u03C5:"upsi",\u03A5:"Upsilon",\u03D2:"Upsi",\u03C6:"phi",\u03D5:"phiv",\u03A6:"Phi",\u03C7:"chi",\u03A7:"Chi",\u03C8:"psi",\u03A8:"Psi",\u03C9:"omega",\u03A9:"ohm",\u0430:"acy",\u0410:"Acy",\u0431:"bcy",\u0411:"Bcy",\u0432:"vcy",\u0412:"Vcy",\u0433:"gcy",\u0413:"Gcy",\u0453:"gjcy",\u0403:"GJcy",\u0434:"dcy",\u0414:"Dcy",\u0452:"djcy",\u0402:"DJcy",\u0435:"iecy",\u0415:"IEcy",\u0451:"iocy",\u0401:"IOcy",\u0454:"jukcy",\u0404:"Jukcy",\u0436:"zhcy",\u0416:"ZHcy",\u0437:"zcy",\u0417:"Zcy",\u0455:"dscy",\u0405:"DScy",\u0438:"icy",\u0418:"Icy",\u0456:"iukcy",\u0406:"Iukcy",\u0457:"yicy",\u0407:"YIcy",\u0439:"jcy",\u0419:"Jcy",\u0458:"jsercy",\u0408:"Jsercy",\u043A:"kcy",\u041A:"Kcy",\u045C:"kjcy",\u040C:"KJcy",\u043B:"lcy",\u041B:"Lcy",\u0459:"ljcy",\u0409:"LJcy",\u043C:"mcy",\u041C:"Mcy",\u043D:"ncy",\u041D:"Ncy",\u045A:"njcy",\u040A:"NJcy",\u043E:"ocy",\u041E:"Ocy",\u043F:"pcy",\u041F:"Pcy",\u0440:"rcy",\u0420:"Rcy",\u0441:"scy",\u0421:"Scy",\u0442:"tcy",\u0422:"Tcy",\u045B:"tshcy",\u040B:"TSHcy",\u0443:"ucy",\u0423:"Ucy",\u045E:"ubrcy",\u040E:"Ubrcy",\u0444:"fcy",\u0424:"Fcy",\u0445:"khcy",\u0425:"KHcy",\u0446:"tscy",\u0426:"TScy",\u0447:"chcy",\u0427:"CHcy",\u045F:"dzcy",\u040F:"DZcy",\u0448:"shcy",\u0428:"SHcy",\u0449:"shchcy",\u0429:"SHCHcy",\u044A:"hardcy",\u042A:"HARDcy",\u044B:"ycy",\u042B:"Ycy",\u044C:"softcy",\u042C:"SOFTcy",\u044D:"ecy",\u042D:"Ecy",\u044E:"yucy",\u042E:"YUcy",\u044F:"yacy",\u042F:"YAcy",\u2135:"aleph",\u2136:"beth",\u2137:"gimel",\u2138:"daleth"},l=/["&'<>`]/g,u={'"':""","&":"&","'":"'","<":"<",">":">","`":"`"},f=/&#(?:[xX][^a-fA-F0-9]|[^0-9xX])/,h=/[\0-\x08\x0B\x0E-\x1F\x7F-\x9F\uFDD0-\uFDEF\uFFFE\uFFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDFFE\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,m=/&(CounterClockwiseContourIntegral|DoubleLongLeftRightArrow|ClockwiseContourIntegral|NotNestedGreaterGreater|NotSquareSupersetEqual|DiacriticalDoubleAcute|NotRightTriangleEqual|NotSucceedsSlantEqual|NotPrecedesSlantEqual|CloseCurlyDoubleQuote|NegativeVeryThinSpace|DoubleContourIntegral|FilledVerySmallSquare|CapitalDifferentialD|OpenCurlyDoubleQuote|EmptyVerySmallSquare|NestedGreaterGreater|DoubleLongRightArrow|NotLeftTriangleEqual|NotGreaterSlantEqual|ReverseUpEquilibrium|DoubleLeftRightArrow|NotSquareSubsetEqual|NotDoubleVerticalBar|RightArrowLeftArrow|NotGreaterFullEqual|NotRightTriangleBar|SquareSupersetEqual|DownLeftRightVector|DoubleLongLeftArrow|leftrightsquigarrow|LeftArrowRightArrow|NegativeMediumSpace|blacktriangleright|RightDownVectorBar|PrecedesSlantEqual|RightDoubleBracket|SucceedsSlantEqual|NotLeftTriangleBar|RightTriangleEqual|SquareIntersection|RightDownTeeVector|ReverseEquilibrium|NegativeThickSpace|longleftrightarrow|Longleftrightarrow|LongLeftRightArrow|DownRightTeeVector|DownRightVectorBar|GreaterSlantEqual|SquareSubsetEqual|LeftDownVectorBar|LeftDoubleBracket|VerticalSeparator|rightleftharpoons|NotGreaterGreater|NotSquareSuperset|blacktriangleleft|blacktriangledown|NegativeThinSpace|LeftDownTeeVector|NotLessSlantEqual|leftrightharpoons|DoubleUpDownArrow|DoubleVerticalBar|LeftTriangleEqual|FilledSmallSquare|twoheadrightarrow|NotNestedLessLess|DownLeftTeeVector|DownLeftVectorBar|RightAngleBracket|NotTildeFullEqual|NotReverseElement|RightUpDownVector|DiacriticalTilde|NotSucceedsTilde|circlearrowright|NotPrecedesEqual|rightharpoondown|DoubleRightArrow|NotSucceedsEqual|NonBreakingSpace|NotRightTriangle|LessEqualGreater|RightUpTeeVector|LeftAngleBracket|GreaterFullEqual|DownArrowUpArrow|RightUpVectorBar|twoheadleftarrow|GreaterEqualLess|downharpoonright|RightTriangleBar|ntrianglerighteq|NotSupersetEqual|LeftUpDownVector|DiacriticalAcute|rightrightarrows|vartriangleright|UpArrowDownArrow|DiacriticalGrave|UnderParenthesis|EmptySmallSquare|LeftUpVectorBar|leftrightarrows|DownRightVector|downharpoonleft|trianglerighteq|ShortRightArrow|OverParenthesis|DoubleLeftArrow|DoubleDownArrow|NotSquareSubset|bigtriangledown|ntrianglelefteq|UpperRightArrow|curvearrowright|vartriangleleft|NotLeftTriangle|nleftrightarrow|LowerRightArrow|NotHumpDownHump|NotGreaterTilde|rightthreetimes|LeftUpTeeVector|NotGreaterEqual|straightepsilon|LeftTriangleBar|rightsquigarrow|ContourIntegral|rightleftarrows|CloseCurlyQuote|RightDownVector|LeftRightVector|nLeftrightarrow|leftharpoondown|circlearrowleft|SquareSuperset|OpenCurlyQuote|hookrightarrow|HorizontalLine|DiacriticalDot|NotLessGreater|ntriangleright|DoubleRightTee|InvisibleComma|InvisibleTimes|LowerLeftArrow|DownLeftVector|NotSubsetEqual|curvearrowleft|trianglelefteq|NotVerticalBar|TildeFullEqual|downdownarrows|NotGreaterLess|RightTeeVector|ZeroWidthSpace|looparrowright|LongRightArrow|doublebarwedge|ShortLeftArrow|ShortDownArrow|RightVectorBar|GreaterGreater|ReverseElement|rightharpoonup|LessSlantEqual|leftthreetimes|upharpoonright|rightarrowtail|LeftDownVector|Longrightarrow|NestedLessLess|UpperLeftArrow|nshortparallel|leftleftarrows|leftrightarrow|Leftrightarrow|LeftRightArrow|longrightarrow|upharpoonleft|RightArrowBar|ApplyFunction|LeftTeeVector|leftarrowtail|NotEqualTilde|varsubsetneqq|varsupsetneqq|RightTeeArrow|SucceedsEqual|SucceedsTilde|LeftVectorBar|SupersetEqual|hookleftarrow|DifferentialD|VerticalTilde|VeryThinSpace|blacktriangle|bigtriangleup|LessFullEqual|divideontimes|leftharpoonup|UpEquilibrium|ntriangleleft|RightTriangle|measuredangle|shortparallel|longleftarrow|Longleftarrow|LongLeftArrow|DoubleLeftTee|Poincareplane|PrecedesEqual|triangleright|DoubleUpArrow|RightUpVector|fallingdotseq|looparrowleft|PrecedesTilde|NotTildeEqual|NotTildeTilde|smallsetminus|Proportional|triangleleft|triangledown|UnderBracket|NotHumpEqual|exponentiale|ExponentialE|NotLessTilde|HilbertSpace|RightCeiling|blacklozenge|varsupsetneq|HumpDownHump|GreaterEqual|VerticalLine|LeftTeeArrow|NotLessEqual|DownTeeArrow|LeftTriangle|varsubsetneq|Intersection|NotCongruent|DownArrowBar|LeftUpVector|LeftArrowBar|risingdotseq|GreaterTilde|RoundImplies|SquareSubset|ShortUpArrow|NotSuperset|quaternions|precnapprox|backepsilon|preccurlyeq|OverBracket|blacksquare|MediumSpace|VerticalBar|circledcirc|circleddash|CircleMinus|CircleTimes|LessGreater|curlyeqprec|curlyeqsucc|diamondsuit|UpDownArrow|Updownarrow|RuleDelayed|Rrightarrow|updownarrow|RightVector|nRightarrow|nrightarrow|eqslantless|LeftCeiling|Equilibrium|SmallCircle|expectation|NotSucceeds|thickapprox|GreaterLess|SquareUnion|NotPrecedes|NotLessLess|straightphi|succnapprox|succcurlyeq|SubsetEqual|sqsupseteq|Proportion|Laplacetrf|ImaginaryI|supsetneqq|NotGreater|gtreqqless|NotElement|ThickSpace|TildeEqual|TildeTilde|Fouriertrf|rmoustache|EqualTilde|eqslantgtr|UnderBrace|LeftVector|UpArrowBar|nLeftarrow|nsubseteqq|subsetneqq|nsupseteqq|nleftarrow|succapprox|lessapprox|UpTeeArrow|upuparrows|curlywedge|lesseqqgtr|varepsilon|varnothing|RightFloor|complement|CirclePlus|sqsubseteq|Lleftarrow|circledast|RightArrow|Rightarrow|rightarrow|lmoustache|Bernoullis|precapprox|mapstoleft|mapstodown|longmapsto|dotsquare|downarrow|DoubleDot|nsubseteq|supsetneq|leftarrow|nsupseteq|subsetneq|ThinSpace|ngeqslant|subseteqq|HumpEqual|NotSubset|triangleq|NotCupCap|lesseqgtr|heartsuit|TripleDot|Leftarrow|Coproduct|Congruent|varpropto|complexes|gvertneqq|LeftArrow|LessTilde|supseteqq|MinusPlus|CircleDot|nleqslant|NotExists|gtreqless|nparallel|UnionPlus|LeftFloor|checkmark|CenterDot|centerdot|Mellintrf|gtrapprox|bigotimes|OverBrace|spadesuit|therefore|pitchfork|rationals|PlusMinus|Backslash|Therefore|DownBreve|backsimeq|backprime|DownArrow|nshortmid|Downarrow|lvertneqq|eqvparsl|imagline|imagpart|infintie|integers|Integral|intercal|LessLess|Uarrocir|intlarhk|sqsupset|angmsdaf|sqsubset|llcorner|vartheta|cupbrcap|lnapprox|Superset|SuchThat|succnsim|succneqq|angmsdag|biguplus|curlyvee|trpezium|Succeeds|NotTilde|bigwedge|angmsdah|angrtvbd|triminus|cwconint|fpartint|lrcorner|smeparsl|subseteq|urcorner|lurdshar|laemptyv|DDotrahd|approxeq|ldrushar|awconint|mapstoup|backcong|shortmid|triangle|geqslant|gesdotol|timesbar|circledR|circledS|setminus|multimap|naturals|scpolint|ncongdot|RightTee|boxminus|gnapprox|boxtimes|andslope|thicksim|angmsdaa|varsigma|cirfnint|rtriltri|angmsdab|rppolint|angmsdac|barwedge|drbkarow|clubsuit|thetasym|bsolhsub|capbrcup|dzigrarr|doteqdot|DotEqual|dotminus|UnderBar|NotEqual|realpart|otimesas|ulcorner|hksearow|hkswarow|parallel|PartialD|elinters|emptyset|plusacir|bbrktbrk|angmsdad|pointint|bigoplus|angmsdae|Precedes|bigsqcup|varkappa|notindot|supseteq|precneqq|precnsim|profalar|profline|profsurf|leqslant|lesdotor|raemptyv|subplus|notnivb|notnivc|subrarr|zigrarr|vzigzag|submult|subedot|Element|between|cirscir|larrbfs|larrsim|lotimes|lbrksld|lbrkslu|lozenge|ldrdhar|dbkarow|bigcirc|epsilon|simrarr|simplus|ltquest|Epsilon|luruhar|gtquest|maltese|npolint|eqcolon|npreceq|bigodot|ddagger|gtrless|bnequiv|harrcir|ddotseq|equivDD|backsim|demptyv|nsqsube|nsqsupe|Upsilon|nsubset|upsilon|minusdu|nsucceq|swarrow|nsupset|coloneq|searrow|boxplus|napprox|natural|asympeq|alefsym|congdot|nearrow|bigstar|diamond|supplus|tritime|LeftTee|nvinfin|triplus|NewLine|nvltrie|nvrtrie|nwarrow|nexists|Diamond|ruluhar|Implies|supmult|angzarr|suplarr|suphsub|questeq|because|digamma|Because|olcross|bemptyv|omicron|Omicron|rotimes|NoBreak|intprod|angrtvb|orderof|uwangle|suphsol|lesdoto|orslope|DownTee|realine|cudarrl|rdldhar|OverBar|supedot|lessdot|supdsub|topfork|succsim|rbrkslu|rbrksld|pertenk|cudarrr|isindot|planckh|lessgtr|pluscir|gesdoto|plussim|plustwo|lesssim|cularrp|rarrsim|Cayleys|notinva|notinvb|notinvc|UpArrow|Uparrow|uparrow|NotLess|dwangle|precsim|Product|curarrm|Cconint|dotplus|rarrbfs|ccupssm|Cedilla|cemptyv|notniva|quatint|frac35|frac38|frac45|frac56|frac58|frac78|tridot|xoplus|gacute|gammad|Gammad|lfisht|lfloor|bigcup|sqsupe|gbreve|Gbreve|lharul|sqsube|sqcups|Gcedil|apacir|llhard|lmidot|Lmidot|lmoust|andand|sqcaps|approx|Abreve|spades|circeq|tprime|divide|topcir|Assign|topbot|gesdot|divonx|xuplus|timesd|gesles|atilde|solbar|SOFTcy|loplus|timesb|lowast|lowbar|dlcorn|dlcrop|softcy|dollar|lparlt|thksim|lrhard|Atilde|lsaquo|smashp|bigvee|thinsp|wreath|bkarow|lsquor|lstrok|Lstrok|lthree|ltimes|ltlarr|DotDot|simdot|ltrPar|weierp|xsqcup|angmsd|sigmav|sigmaf|zeetrf|Zcaron|zcaron|mapsto|vsupne|thetav|cirmid|marker|mcomma|Zacute|vsubnE|there4|gtlPar|vsubne|bottom|gtrarr|SHCHcy|shchcy|midast|midcir|middot|minusb|minusd|gtrdot|bowtie|sfrown|mnplus|models|colone|seswar|Colone|mstpos|searhk|gtrsim|nacute|Nacute|boxbox|telrec|hairsp|Tcedil|nbumpe|scnsim|ncaron|Ncaron|ncedil|Ncedil|hamilt|Scedil|nearhk|hardcy|HARDcy|tcedil|Tcaron|commat|nequiv|nesear|tcaron|target|hearts|nexist|varrho|scedil|Scaron|scaron|hellip|Sacute|sacute|hercon|swnwar|compfn|rtimes|rthree|rsquor|rsaquo|zacute|wedgeq|homtht|barvee|barwed|Barwed|rpargt|horbar|conint|swarhk|roplus|nltrie|hslash|hstrok|Hstrok|rmoust|Conint|bprime|hybull|hyphen|iacute|Iacute|supsup|supsub|supsim|varphi|coprod|brvbar|agrave|Supset|supset|igrave|Igrave|notinE|Agrave|iiiint|iinfin|copysr|wedbar|Verbar|vangrt|becaus|incare|verbar|inodot|bullet|drcorn|intcal|drcrop|cularr|vellip|Utilde|bumpeq|cupcap|dstrok|Dstrok|CupCap|cupcup|cupdot|eacute|Eacute|supdot|iquest|easter|ecaron|Ecaron|ecolon|isinsv|utilde|itilde|Itilde|curarr|succeq|Bumpeq|cacute|ulcrop|nparsl|Cacute|nprcue|egrave|Egrave|nrarrc|nrarrw|subsup|subsub|nrtrie|jsercy|nsccue|Jsercy|kappav|kcedil|Kcedil|subsim|ulcorn|nsimeq|egsdot|veebar|kgreen|capand|elsdot|Subset|subset|curren|aacute|lacute|Lacute|emptyv|ntilde|Ntilde|lagran|lambda|Lambda|capcap|Ugrave|langle|subdot|emsp13|numero|emsp14|nvdash|nvDash|nVdash|nVDash|ugrave|ufisht|nvHarr|larrfs|nvlArr|larrhk|larrlp|larrpl|nvrArr|Udblac|nwarhk|larrtl|nwnear|oacute|Oacute|latail|lAtail|sstarf|lbrace|odblac|Odblac|lbrack|udblac|odsold|eparsl|lcaron|Lcaron|ograve|Ograve|lcedil|Lcedil|Aacute|ssmile|ssetmn|squarf|ldquor|capcup|ominus|cylcty|rharul|eqcirc|dagger|rfloor|rfisht|Dagger|daleth|equals|origof|capdot|equest|dcaron|Dcaron|rdquor|oslash|Oslash|otilde|Otilde|otimes|Otimes|urcrop|Ubreve|ubreve|Yacute|Uacute|uacute|Rcedil|rcedil|urcorn|parsim|Rcaron|Vdashl|rcaron|Tstrok|percnt|period|permil|Exists|yacute|rbrack|rbrace|phmmat|ccaron|Ccaron|planck|ccedil|plankv|tstrok|female|plusdo|plusdu|ffilig|plusmn|ffllig|Ccedil|rAtail|dfisht|bernou|ratail|Rarrtl|rarrtl|angsph|rarrpl|rarrlp|rarrhk|xwedge|xotime|forall|ForAll|Vvdash|vsupnE|preceq|bigcap|frac12|frac13|frac14|primes|rarrfs|prnsim|frac15|Square|frac16|square|lesdot|frac18|frac23|propto|prurel|rarrap|rangle|puncsp|frac25|Racute|qprime|racute|lesges|frac34|abreve|AElig|eqsim|utdot|setmn|urtri|Equal|Uring|seArr|uring|searr|dashv|Dashv|mumap|nabla|iogon|Iogon|sdote|sdotb|scsim|napid|napos|equiv|natur|Acirc|dblac|erarr|nbump|iprod|erDot|ucirc|awint|esdot|angrt|ncong|isinE|scnap|Scirc|scirc|ndash|isins|Ubrcy|nearr|neArr|isinv|nedot|ubrcy|acute|Ycirc|iukcy|Iukcy|xutri|nesim|caret|jcirc|Jcirc|caron|twixt|ddarr|sccue|exist|jmath|sbquo|ngeqq|angst|ccaps|lceil|ngsim|UpTee|delta|Delta|rtrif|nharr|nhArr|nhpar|rtrie|jukcy|Jukcy|kappa|rsquo|Kappa|nlarr|nlArr|TSHcy|rrarr|aogon|Aogon|fflig|xrarr|tshcy|ccirc|nleqq|filig|upsih|nless|dharl|nlsim|fjlig|ropar|nltri|dharr|robrk|roarr|fllig|fltns|roang|rnmid|subnE|subne|lAarr|trisb|Ccirc|acirc|ccups|blank|VDash|forkv|Vdash|langd|cedil|blk12|blk14|laquo|strns|diams|notin|vDash|larrb|blk34|block|disin|uplus|vdash|vBarv|aelig|starf|Wedge|check|xrArr|lates|lbarr|lBarr|notni|lbbrk|bcong|frasl|lbrke|frown|vrtri|vprop|vnsup|gamma|Gamma|wedge|xodot|bdquo|srarr|doteq|ldquo|boxdl|boxdL|gcirc|Gcirc|boxDl|boxDL|boxdr|boxdR|boxDr|TRADE|trade|rlhar|boxDR|vnsub|npart|vltri|rlarr|boxhd|boxhD|nprec|gescc|nrarr|nrArr|boxHd|boxHD|boxhu|boxhU|nrtri|boxHu|clubs|boxHU|times|colon|Colon|gimel|xlArr|Tilde|nsime|tilde|nsmid|nspar|THORN|thorn|xlarr|nsube|nsubE|thkap|xhArr|comma|nsucc|boxul|boxuL|nsupe|nsupE|gneqq|gnsim|boxUl|boxUL|grave|boxur|boxuR|boxUr|boxUR|lescc|angle|bepsi|boxvh|varpi|boxvH|numsp|Theta|gsime|gsiml|theta|boxVh|boxVH|boxvl|gtcir|gtdot|boxvL|boxVl|boxVL|crarr|cross|Cross|nvsim|boxvr|nwarr|nwArr|sqsup|dtdot|Uogon|lhard|lharu|dtrif|ocirc|Ocirc|lhblk|duarr|odash|sqsub|Hacek|sqcup|llarr|duhar|oelig|OElig|ofcir|boxvR|uogon|lltri|boxVr|csube|uuarr|ohbar|csupe|ctdot|olarr|olcir|harrw|oline|sqcap|omacr|Omacr|omega|Omega|boxVR|aleph|lneqq|lnsim|loang|loarr|rharu|lobrk|hcirc|operp|oplus|rhard|Hcirc|orarr|Union|order|ecirc|Ecirc|cuepr|szlig|cuesc|breve|reals|eDDot|Breve|hoarr|lopar|utrif|rdquo|Umacr|umacr|efDot|swArr|ultri|alpha|rceil|ovbar|swarr|Wcirc|wcirc|smtes|smile|bsemi|lrarr|aring|parsl|lrhar|bsime|uhblk|lrtri|cupor|Aring|uharr|uharl|slarr|rbrke|bsolb|lsime|rbbrk|RBarr|lsimg|phone|rBarr|rbarr|icirc|lsquo|Icirc|emacr|Emacr|ratio|simne|plusb|simlE|simgE|simeq|pluse|ltcir|ltdot|empty|xharr|xdtri|iexcl|Alpha|ltrie|rarrw|pound|ltrif|xcirc|bumpe|prcue|bumpE|asymp|amacr|cuvee|Sigma|sigma|iiint|udhar|iiota|ijlig|IJlig|supnE|imacr|Imacr|prime|Prime|image|prnap|eogon|Eogon|rarrc|mdash|mDDot|cuwed|imath|supne|imped|Amacr|udarr|prsim|micro|rarrb|cwint|raquo|infin|eplus|range|rangd|Ucirc|radic|minus|amalg|veeeq|rAarr|epsiv|ycirc|quest|sharp|quot|zwnj|Qscr|race|qscr|Qopf|qopf|qint|rang|Rang|Zscr|zscr|Zopf|zopf|rarr|rArr|Rarr|Pscr|pscr|prop|prod|prnE|prec|ZHcy|zhcy|prap|Zeta|zeta|Popf|popf|Zdot|plus|zdot|Yuml|yuml|phiv|YUcy|yucy|Yscr|yscr|perp|Yopf|yopf|part|para|YIcy|Ouml|rcub|yicy|YAcy|rdca|ouml|osol|Oscr|rdsh|yacy|real|oscr|xvee|andd|rect|andv|Xscr|oror|ordm|ordf|xscr|ange|aopf|Aopf|rHar|Xopf|opar|Oopf|xopf|xnis|rhov|oopf|omid|xmap|oint|apid|apos|ogon|ascr|Ascr|odot|odiv|xcup|xcap|ocir|oast|nvlt|nvle|nvgt|nvge|nvap|Wscr|wscr|auml|ntlg|ntgl|nsup|nsub|nsim|Nscr|nscr|nsce|Wopf|ring|npre|wopf|npar|Auml|Barv|bbrk|Nopf|nopf|nmid|nLtv|beta|ropf|Ropf|Beta|beth|nles|rpar|nleq|bnot|bNot|nldr|NJcy|rscr|Rscr|Vscr|vscr|rsqb|njcy|bopf|nisd|Bopf|rtri|Vopf|nGtv|ngtr|vopf|boxh|boxH|boxv|nges|ngeq|boxV|bscr|scap|Bscr|bsim|Vert|vert|bsol|bull|bump|caps|cdot|ncup|scnE|ncap|nbsp|napE|Cdot|cent|sdot|Vbar|nang|vBar|chcy|Mscr|mscr|sect|semi|CHcy|Mopf|mopf|sext|circ|cire|mldr|mlcp|cirE|comp|shcy|SHcy|vArr|varr|cong|copf|Copf|copy|COPY|malt|male|macr|lvnE|cscr|ltri|sime|ltcc|simg|Cscr|siml|csub|Uuml|lsqb|lsim|uuml|csup|Lscr|lscr|utri|smid|lpar|cups|smte|lozf|darr|Lopf|Uscr|solb|lopf|sopf|Sopf|lneq|uscr|spar|dArr|lnap|Darr|dash|Sqrt|LJcy|ljcy|lHar|dHar|Upsi|upsi|diam|lesg|djcy|DJcy|leqq|dopf|Dopf|dscr|Dscr|dscy|ldsh|ldca|squf|DScy|sscr|Sscr|dsol|lcub|late|star|Star|Uopf|Larr|lArr|larr|uopf|dtri|dzcy|sube|subE|Lang|lang|Kscr|kscr|Kopf|kopf|KJcy|kjcy|KHcy|khcy|DZcy|ecir|edot|eDot|Jscr|jscr|succ|Jopf|jopf|Edot|uHar|emsp|ensp|Iuml|iuml|eopf|isin|Iscr|iscr|Eopf|epar|sung|epsi|escr|sup1|sup2|sup3|Iota|iota|supe|supE|Iopf|iopf|IOcy|iocy|Escr|esim|Esim|imof|Uarr|QUOT|uArr|uarr|euml|IEcy|iecy|Idot|Euml|euro|excl|Hscr|hscr|Hopf|hopf|TScy|tscy|Tscr|hbar|tscr|flat|tbrk|fnof|hArr|harr|half|fopf|Fopf|tdot|gvnE|fork|trie|gtcc|fscr|Fscr|gdot|gsim|Gscr|gscr|Gopf|gopf|gneq|Gdot|tosa|gnap|Topf|topf|geqq|toea|GJcy|gjcy|tint|gesl|mid|Sfr|ggg|top|ges|gla|glE|glj|geq|gne|gEl|gel|gnE|Gcy|gcy|gap|Tfr|tfr|Tcy|tcy|Hat|Tau|Ffr|tau|Tab|hfr|Hfr|ffr|Fcy|fcy|icy|Icy|iff|ETH|eth|ifr|Ifr|Eta|eta|int|Int|Sup|sup|ucy|Ucy|Sum|sum|jcy|ENG|ufr|Ufr|eng|Jcy|jfr|els|ell|egs|Efr|efr|Jfr|uml|kcy|Kcy|Ecy|ecy|kfr|Kfr|lap|Sub|sub|lat|lcy|Lcy|leg|Dot|dot|lEg|leq|les|squ|div|die|lfr|Lfr|lgE|Dfr|dfr|Del|deg|Dcy|dcy|lne|lnE|sol|loz|smt|Cup|lrm|cup|lsh|Lsh|sim|shy|map|Map|mcy|Mcy|mfr|Mfr|mho|gfr|Gfr|sfr|cir|Chi|chi|nap|Cfr|vcy|Vcy|cfr|Scy|scy|ncy|Ncy|vee|Vee|Cap|cap|nfr|scE|sce|Nfr|nge|ngE|nGg|vfr|Vfr|ngt|bot|nGt|nis|niv|Rsh|rsh|nle|nlE|bne|Bfr|bfr|nLl|nlt|nLt|Bcy|bcy|not|Not|rlm|wfr|Wfr|npr|nsc|num|ocy|ast|Ocy|ofr|xfr|Xfr|Ofr|ogt|ohm|apE|olt|Rho|ape|rho|Rfr|rfr|ord|REG|ang|reg|orv|And|and|AMP|Rcy|amp|Afr|ycy|Ycy|yen|yfr|Yfr|rcy|par|pcy|Pcy|pfr|Pfr|phi|Phi|afr|Acy|acy|zcy|Zcy|piv|acE|acd|zfr|Zfr|pre|prE|psi|Psi|qfr|Qfr|zwj|Or|ge|Gg|gt|gg|el|oS|lt|Lt|LT|Re|lg|gl|eg|ne|Im|it|le|DD|wp|wr|nu|Nu|dd|lE|Sc|sc|pi|Pi|ee|af|ll|Ll|rx|gE|xi|pm|Xi|ic|pr|Pr|in|ni|mp|mu|ac|Mu|or|ap|Gt|GT|ii);|&(Aacute|Agrave|Atilde|Ccedil|Eacute|Egrave|Iacute|Igrave|Ntilde|Oacute|Ograve|Oslash|Otilde|Uacute|Ugrave|Yacute|aacute|agrave|atilde|brvbar|ccedil|curren|divide|eacute|egrave|frac12|frac14|frac34|iacute|igrave|iquest|middot|ntilde|oacute|ograve|oslash|otilde|plusmn|uacute|ugrave|yacute|AElig|Acirc|Aring|Ecirc|Icirc|Ocirc|THORN|Ucirc|acirc|acute|aelig|aring|cedil|ecirc|icirc|iexcl|laquo|micro|ocirc|pound|raquo|szlig|thorn|times|ucirc|Auml|COPY|Euml|Iuml|Ouml|QUOT|Uuml|auml|cent|copy|euml|iuml|macr|nbsp|ordf|ordm|ouml|para|quot|sect|sup1|sup2|sup3|uuml|yuml|AMP|ETH|REG|amp|deg|eth|not|reg|shy|uml|yen|GT|LT|gt|lt)(?!;)([=a-zA-Z0-9]?)|&#([0-9]+)(;?)|&#[xX]([a-fA-F0-9]+)(;?)|&([0-9a-zA-Z]+)/g,v={aacute:"\xE1",Aacute:"\xC1",abreve:"\u0103",Abreve:"\u0102",ac:"\u223E",acd:"\u223F",acE:"\u223E\u0333",acirc:"\xE2",Acirc:"\xC2",acute:"\xB4",acy:"\u0430",Acy:"\u0410",aelig:"\xE6",AElig:"\xC6",af:"\u2061",afr:"\u{1D51E}",Afr:"\u{1D504}",agrave:"\xE0",Agrave:"\xC0",alefsym:"\u2135",aleph:"\u2135",alpha:"\u03B1",Alpha:"\u0391",amacr:"\u0101",Amacr:"\u0100",amalg:"\u2A3F",amp:"&",AMP:"&",and:"\u2227",And:"\u2A53",andand:"\u2A55",andd:"\u2A5C",andslope:"\u2A58",andv:"\u2A5A",ang:"\u2220",ange:"\u29A4",angle:"\u2220",angmsd:"\u2221",angmsdaa:"\u29A8",angmsdab:"\u29A9",angmsdac:"\u29AA",angmsdad:"\u29AB",angmsdae:"\u29AC",angmsdaf:"\u29AD",angmsdag:"\u29AE",angmsdah:"\u29AF",angrt:"\u221F",angrtvb:"\u22BE",angrtvbd:"\u299D",angsph:"\u2222",angst:"\xC5",angzarr:"\u237C",aogon:"\u0105",Aogon:"\u0104",aopf:"\u{1D552}",Aopf:"\u{1D538}",ap:"\u2248",apacir:"\u2A6F",ape:"\u224A",apE:"\u2A70",apid:"\u224B",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224A",aring:"\xE5",Aring:"\xC5",ascr:"\u{1D4B6}",Ascr:"\u{1D49C}",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224D",atilde:"\xE3",Atilde:"\xC3",auml:"\xE4",Auml:"\xC4",awconint:"\u2233",awint:"\u2A11",backcong:"\u224C",backepsilon:"\u03F6",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",Backslash:"\u2216",Barv:"\u2AE7",barvee:"\u22BD",barwed:"\u2305",Barwed:"\u2306",barwedge:"\u2305",bbrk:"\u23B5",bbrktbrk:"\u23B6",bcong:"\u224C",bcy:"\u0431",Bcy:"\u0411",bdquo:"\u201E",becaus:"\u2235",because:"\u2235",Because:"\u2235",bemptyv:"\u29B0",bepsi:"\u03F6",bernou:"\u212C",Bernoullis:"\u212C",beta:"\u03B2",Beta:"\u0392",beth:"\u2136",between:"\u226C",bfr:"\u{1D51F}",Bfr:"\u{1D505}",bigcap:"\u22C2",bigcirc:"\u25EF",bigcup:"\u22C3",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",bigvee:"\u22C1",bigwedge:"\u22C0",bkarow:"\u290D",blacklozenge:"\u29EB",blacksquare:"\u25AA",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",blacktriangleright:"\u25B8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20E5",bnequiv:"\u2261\u20E5",bnot:"\u2310",bNot:"\u2AED",bopf:"\u{1D553}",Bopf:"\u{1D539}",bot:"\u22A5",bottom:"\u22A5",bowtie:"\u22C8",boxbox:"\u29C9",boxdl:"\u2510",boxdL:"\u2555",boxDl:"\u2556",boxDL:"\u2557",boxdr:"\u250C",boxdR:"\u2552",boxDr:"\u2553",boxDR:"\u2554",boxh:"\u2500",boxH:"\u2550",boxhd:"\u252C",boxhD:"\u2565",boxHd:"\u2564",boxHD:"\u2566",boxhu:"\u2534",boxhU:"\u2568",boxHu:"\u2567",boxHU:"\u2569",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",boxul:"\u2518",boxuL:"\u255B",boxUl:"\u255C",boxUL:"\u255D",boxur:"\u2514",boxuR:"\u2558",boxUr:"\u2559",boxUR:"\u255A",boxv:"\u2502",boxV:"\u2551",boxvh:"\u253C",boxvH:"\u256A",boxVh:"\u256B",boxVH:"\u256C",boxvl:"\u2524",boxvL:"\u2561",boxVl:"\u2562",boxVL:"\u2563",boxvr:"\u251C",boxvR:"\u255E",boxVr:"\u255F",boxVR:"\u2560",bprime:"\u2035",breve:"\u02D8",Breve:"\u02D8",brvbar:"\xA6",bscr:"\u{1D4B7}",Bscr:"\u212C",bsemi:"\u204F",bsim:"\u223D",bsime:"\u22CD",bsol:"\\",bsolb:"\u29C5",bsolhsub:"\u27C8",bull:"\u2022",bullet:"\u2022",bump:"\u224E",bumpe:"\u224F",bumpE:"\u2AAE",bumpeq:"\u224F",Bumpeq:"\u224E",cacute:"\u0107",Cacute:"\u0106",cap:"\u2229",Cap:"\u22D2",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",capcup:"\u2A47",capdot:"\u2A40",CapitalDifferentialD:"\u2145",caps:"\u2229\uFE00",caret:"\u2041",caron:"\u02C7",Cayleys:"\u212D",ccaps:"\u2A4D",ccaron:"\u010D",Ccaron:"\u010C",ccedil:"\xE7",Ccedil:"\xC7",ccirc:"\u0109",Ccirc:"\u0108",Cconint:"\u2230",ccups:"\u2A4C",ccupssm:"\u2A50",cdot:"\u010B",Cdot:"\u010A",cedil:"\xB8",Cedilla:"\xB8",cemptyv:"\u29B2",cent:"\xA2",centerdot:"\xB7",CenterDot:"\xB7",cfr:"\u{1D520}",Cfr:"\u212D",chcy:"\u0447",CHcy:"\u0427",check:"\u2713",checkmark:"\u2713",chi:"\u03C7",Chi:"\u03A7",cir:"\u25CB",circ:"\u02C6",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",CircleDot:"\u2299",circledR:"\xAE",circledS:"\u24C8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cire:"\u2257",cirE:"\u29C3",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201D",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",colon:":",Colon:"\u2237",colone:"\u2254",Colone:"\u2A74",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2A6D",Congruent:"\u2261",conint:"\u222E",Conint:"\u222F",ContourIntegral:"\u222E",copf:"\u{1D554}",Copf:"\u2102",coprod:"\u2210",Coproduct:"\u2210",copy:"\xA9",COPY:"\xA9",copysr:"\u2117",CounterClockwiseContourIntegral:"\u2233",crarr:"\u21B5",cross:"\u2717",Cross:"\u2A2F",cscr:"\u{1D4B8}",Cscr:"\u{1D49E}",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",ctdot:"\u22EF",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22DE",cuesc:"\u22DF",cularr:"\u21B6",cularrp:"\u293D",cup:"\u222A",Cup:"\u22D3",cupbrcap:"\u2A48",cupcap:"\u2A46",CupCap:"\u224D",cupcup:"\u2A4A",cupdot:"\u228D",cupor:"\u2A45",cups:"\u222A\uFE00",curarr:"\u21B7",curarrm:"\u293C",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curlyvee:"\u22CE",curlywedge:"\u22CF",curren:"\xA4",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",cuvee:"\u22CE",cuwed:"\u22CF",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232D",dagger:"\u2020",Dagger:"\u2021",daleth:"\u2138",darr:"\u2193",dArr:"\u21D3",Darr:"\u21A1",dash:"\u2010",dashv:"\u22A3",Dashv:"\u2AE4",dbkarow:"\u290F",dblac:"\u02DD",dcaron:"\u010F",Dcaron:"\u010E",dcy:"\u0434",Dcy:"\u0414",dd:"\u2146",DD:"\u2145",ddagger:"\u2021",ddarr:"\u21CA",DDotrahd:"\u2911",ddotseq:"\u2A77",deg:"\xB0",Del:"\u2207",delta:"\u03B4",Delta:"\u0394",demptyv:"\u29B1",dfisht:"\u297F",dfr:"\u{1D521}",Dfr:"\u{1D507}",dHar:"\u2965",dharl:"\u21C3",dharr:"\u21C2",DiacriticalAcute:"\xB4",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",DiacriticalGrave:"`",DiacriticalTilde:"\u02DC",diam:"\u22C4",diamond:"\u22C4",Diamond:"\u22C4",diamondsuit:"\u2666",diams:"\u2666",die:"\xA8",DifferentialD:"\u2146",digamma:"\u03DD",disin:"\u22F2",div:"\xF7",divide:"\xF7",divideontimes:"\u22C7",divonx:"\u22C7",djcy:"\u0452",DJcy:"\u0402",dlcorn:"\u231E",dlcrop:"\u230D",dollar:"$",dopf:"\u{1D555}",Dopf:"\u{1D53B}",dot:"\u02D9",Dot:"\xA8",DotDot:"\u20DC",doteq:"\u2250",doteqdot:"\u2251",DotEqual:"\u2250",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22A1",doublebarwedge:"\u2306",DoubleContourIntegral:"\u222F",DoubleDot:"\xA8",DoubleDownArrow:"\u21D3",DoubleLeftArrow:"\u21D0",DoubleLeftRightArrow:"\u21D4",DoubleLeftTee:"\u2AE4",DoubleLongLeftArrow:"\u27F8",DoubleLongLeftRightArrow:"\u27FA",DoubleLongRightArrow:"\u27F9",DoubleRightArrow:"\u21D2",DoubleRightTee:"\u22A8",DoubleUpArrow:"\u21D1",DoubleUpDownArrow:"\u21D5",DoubleVerticalBar:"\u2225",downarrow:"\u2193",Downarrow:"\u21D3",DownArrow:"\u2193",DownArrowBar:"\u2913",DownArrowUpArrow:"\u21F5",DownBreve:"\u0311",downdownarrows:"\u21CA",downharpoonleft:"\u21C3",downharpoonright:"\u21C2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295E",DownLeftVector:"\u21BD",DownLeftVectorBar:"\u2956",DownRightTeeVector:"\u295F",DownRightVector:"\u21C1",DownRightVectorBar:"\u2957",DownTee:"\u22A4",DownTeeArrow:"\u21A7",drbkarow:"\u2910",drcorn:"\u231F",drcrop:"\u230C",dscr:"\u{1D4B9}",Dscr:"\u{1D49F}",dscy:"\u0455",DScy:"\u0405",dsol:"\u29F6",dstrok:"\u0111",Dstrok:"\u0110",dtdot:"\u22F1",dtri:"\u25BF",dtrif:"\u25BE",duarr:"\u21F5",duhar:"\u296F",dwangle:"\u29A6",dzcy:"\u045F",DZcy:"\u040F",dzigrarr:"\u27FF",eacute:"\xE9",Eacute:"\xC9",easter:"\u2A6E",ecaron:"\u011B",Ecaron:"\u011A",ecir:"\u2256",ecirc:"\xEA",Ecirc:"\xCA",ecolon:"\u2255",ecy:"\u044D",Ecy:"\u042D",eDDot:"\u2A77",edot:"\u0117",eDot:"\u2251",Edot:"\u0116",ee:"\u2147",efDot:"\u2252",efr:"\u{1D522}",Efr:"\u{1D508}",eg:"\u2A9A",egrave:"\xE8",Egrave:"\xC8",egs:"\u2A96",egsdot:"\u2A98",el:"\u2A99",Element:"\u2208",elinters:"\u23E7",ell:"\u2113",els:"\u2A95",elsdot:"\u2A97",emacr:"\u0113",Emacr:"\u0112",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25FB",emptyv:"\u2205",EmptyVerySmallSquare:"\u25AB",emsp:"\u2003",emsp13:"\u2004",emsp14:"\u2005",eng:"\u014B",ENG:"\u014A",ensp:"\u2002",eogon:"\u0119",Eogon:"\u0118",eopf:"\u{1D556}",Eopf:"\u{1D53C}",epar:"\u22D5",eparsl:"\u29E3",eplus:"\u2A71",epsi:"\u03B5",epsilon:"\u03B5",Epsilon:"\u0395",epsiv:"\u03F5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2A96",eqslantless:"\u2A95",Equal:"\u2A75",equals:"=",EqualTilde:"\u2242",equest:"\u225F",Equilibrium:"\u21CC",equiv:"\u2261",equivDD:"\u2A78",eqvparsl:"\u29E5",erarr:"\u2971",erDot:"\u2253",escr:"\u212F",Escr:"\u2130",esdot:"\u2250",esim:"\u2242",Esim:"\u2A73",eta:"\u03B7",Eta:"\u0397",eth:"\xF0",ETH:"\xD0",euml:"\xEB",Euml:"\xCB",euro:"\u20AC",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",exponentiale:"\u2147",ExponentialE:"\u2147",fallingdotseq:"\u2252",fcy:"\u0444",Fcy:"\u0424",female:"\u2640",ffilig:"\uFB03",fflig:"\uFB00",ffllig:"\uFB04",ffr:"\u{1D523}",Ffr:"\u{1D509}",filig:"\uFB01",FilledSmallSquare:"\u25FC",FilledVerySmallSquare:"\u25AA",fjlig:"fj",flat:"\u266D",fllig:"\uFB02",fltns:"\u25B1",fnof:"\u0192",fopf:"\u{1D557}",Fopf:"\u{1D53D}",forall:"\u2200",ForAll:"\u2200",fork:"\u22D4",forkv:"\u2AD9",Fouriertrf:"\u2131",fpartint:"\u2A0D",frac12:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044",frown:"\u2322",fscr:"\u{1D4BB}",Fscr:"\u2131",gacute:"\u01F5",gamma:"\u03B3",Gamma:"\u0393",gammad:"\u03DD",Gammad:"\u03DC",gap:"\u2A86",gbreve:"\u011F",Gbreve:"\u011E",Gcedil:"\u0122",gcirc:"\u011D",Gcirc:"\u011C",gcy:"\u0433",Gcy:"\u0413",gdot:"\u0121",Gdot:"\u0120",ge:"\u2265",gE:"\u2267",gel:"\u22DB",gEl:"\u2A8C",geq:"\u2265",geqq:"\u2267",geqslant:"\u2A7E",ges:"\u2A7E",gescc:"\u2AA9",gesdot:"\u2A80",gesdoto:"\u2A82",gesdotol:"\u2A84",gesl:"\u22DB\uFE00",gesles:"\u2A94",gfr:"\u{1D524}",Gfr:"\u{1D50A}",gg:"\u226B",Gg:"\u22D9",ggg:"\u22D9",gimel:"\u2137",gjcy:"\u0453",GJcy:"\u0403",gl:"\u2277",gla:"\u2AA5",glE:"\u2A92",glj:"\u2AA4",gnap:"\u2A8A",gnapprox:"\u2A8A",gne:"\u2A88",gnE:"\u2269",gneq:"\u2A88",gneqq:"\u2269",gnsim:"\u22E7",gopf:"\u{1D558}",Gopf:"\u{1D53E}",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22DB",GreaterFullEqual:"\u2267",GreaterGreater:"\u2AA2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2A7E",GreaterTilde:"\u2273",gscr:"\u210A",Gscr:"\u{1D4A2}",gsim:"\u2273",gsime:"\u2A8E",gsiml:"\u2A90",gt:">",Gt:"\u226B",GT:">",gtcc:"\u2AA7",gtcir:"\u2A7A",gtdot:"\u22D7",gtlPar:"\u2995",gtquest:"\u2A7C",gtrapprox:"\u2A86",gtrarr:"\u2978",gtrdot:"\u22D7",gtreqless:"\u22DB",gtreqqless:"\u2A8C",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\uFE00",gvnE:"\u2269\uFE00",Hacek:"\u02C7",hairsp:"\u200A",half:"\xBD",hamilt:"\u210B",hardcy:"\u044A",HARDcy:"\u042A",harr:"\u2194",hArr:"\u21D4",harrcir:"\u2948",harrw:"\u21AD",Hat:"^",hbar:"\u210F",hcirc:"\u0125",Hcirc:"\u0124",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22B9",hfr:"\u{1D525}",Hfr:"\u210C",HilbertSpace:"\u210B",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21FF",homtht:"\u223B",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",hopf:"\u{1D559}",Hopf:"\u210D",horbar:"\u2015",HorizontalLine:"\u2500",hscr:"\u{1D4BD}",Hscr:"\u210B",hslash:"\u210F",hstrok:"\u0127",Hstrok:"\u0126",HumpDownHump:"\u224E",HumpEqual:"\u224F",hybull:"\u2043",hyphen:"\u2010",iacute:"\xED",Iacute:"\xCD",ic:"\u2063",icirc:"\xEE",Icirc:"\xCE",icy:"\u0438",Icy:"\u0418",Idot:"\u0130",iecy:"\u0435",IEcy:"\u0415",iexcl:"\xA1",iff:"\u21D4",ifr:"\u{1D526}",Ifr:"\u2111",igrave:"\xEC",Igrave:"\xCC",ii:"\u2148",iiiint:"\u2A0C",iiint:"\u222D",iinfin:"\u29DC",iiota:"\u2129",ijlig:"\u0133",IJlig:"\u0132",Im:"\u2111",imacr:"\u012B",Imacr:"\u012A",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",imof:"\u22B7",imped:"\u01B5",Implies:"\u21D2",in:"\u2208",incare:"\u2105",infin:"\u221E",infintie:"\u29DD",inodot:"\u0131",int:"\u222B",Int:"\u222C",intcal:"\u22BA",integers:"\u2124",Integral:"\u222B",intercal:"\u22BA",Intersection:"\u22C2",intlarhk:"\u2A17",intprod:"\u2A3C",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",iocy:"\u0451",IOcy:"\u0401",iogon:"\u012F",Iogon:"\u012E",iopf:"\u{1D55A}",Iopf:"\u{1D540}",iota:"\u03B9",Iota:"\u0399",iprod:"\u2A3C",iquest:"\xBF",iscr:"\u{1D4BE}",Iscr:"\u2110",isin:"\u2208",isindot:"\u22F5",isinE:"\u22F9",isins:"\u22F4",isinsv:"\u22F3",isinv:"\u2208",it:"\u2062",itilde:"\u0129",Itilde:"\u0128",iukcy:"\u0456",Iukcy:"\u0406",iuml:"\xEF",Iuml:"\xCF",jcirc:"\u0135",Jcirc:"\u0134",jcy:"\u0439",Jcy:"\u0419",jfr:"\u{1D527}",Jfr:"\u{1D50D}",jmath:"\u0237",jopf:"\u{1D55B}",Jopf:"\u{1D541}",jscr:"\u{1D4BF}",Jscr:"\u{1D4A5}",jsercy:"\u0458",Jsercy:"\u0408",jukcy:"\u0454",Jukcy:"\u0404",kappa:"\u03BA",Kappa:"\u039A",kappav:"\u03F0",kcedil:"\u0137",Kcedil:"\u0136",kcy:"\u043A",Kcy:"\u041A",kfr:"\u{1D528}",Kfr:"\u{1D50E}",kgreen:"\u0138",khcy:"\u0445",KHcy:"\u0425",kjcy:"\u045C",KJcy:"\u040C",kopf:"\u{1D55C}",Kopf:"\u{1D542}",kscr:"\u{1D4C0}",Kscr:"\u{1D4A6}",lAarr:"\u21DA",lacute:"\u013A",Lacute:"\u0139",laemptyv:"\u29B4",lagran:"\u2112",lambda:"\u03BB",Lambda:"\u039B",lang:"\u27E8",Lang:"\u27EA",langd:"\u2991",langle:"\u27E8",lap:"\u2A85",Laplacetrf:"\u2112",laquo:"\xAB",larr:"\u2190",lArr:"\u21D0",Larr:"\u219E",larrb:"\u21E4",larrbfs:"\u291F",larrfs:"\u291D",larrhk:"\u21A9",larrlp:"\u21AB",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21A2",lat:"\u2AAB",latail:"\u2919",lAtail:"\u291B",late:"\u2AAD",lates:"\u2AAD\uFE00",lbarr:"\u290C",lBarr:"\u290E",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298B",lbrksld:"\u298F",lbrkslu:"\u298D",lcaron:"\u013E",Lcaron:"\u013D",lcedil:"\u013C",Lcedil:"\u013B",lceil:"\u2308",lcub:"{",lcy:"\u043B",Lcy:"\u041B",ldca:"\u2936",ldquo:"\u201C",ldquor:"\u201E",ldrdhar:"\u2967",ldrushar:"\u294B",ldsh:"\u21B2",le:"\u2264",lE:"\u2266",LeftAngleBracket:"\u27E8",leftarrow:"\u2190",Leftarrow:"\u21D0",LeftArrow:"\u2190",LeftArrowBar:"\u21E4",LeftArrowRightArrow:"\u21C6",leftarrowtail:"\u21A2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27E6",LeftDownTeeVector:"\u2961",LeftDownVector:"\u21C3",LeftDownVectorBar:"\u2959",LeftFloor:"\u230A",leftharpoondown:"\u21BD",leftharpoonup:"\u21BC",leftleftarrows:"\u21C7",leftrightarrow:"\u2194",Leftrightarrow:"\u21D4",LeftRightArrow:"\u2194",leftrightarrows:"\u21C6",leftrightharpoons:"\u21CB",leftrightsquigarrow:"\u21AD",LeftRightVector:"\u294E",LeftTee:"\u22A3",LeftTeeArrow:"\u21A4",LeftTeeVector:"\u295A",leftthreetimes:"\u22CB",LeftTriangle:"\u22B2",LeftTriangleBar:"\u29CF",LeftTriangleEqual:"\u22B4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVector:"\u21BF",LeftUpVectorBar:"\u2958",LeftVector:"\u21BC",LeftVectorBar:"\u2952",leg:"\u22DA",lEg:"\u2A8B",leq:"\u2264",leqq:"\u2266",leqslant:"\u2A7D",les:"\u2A7D",lescc:"\u2AA8",lesdot:"\u2A7F",lesdoto:"\u2A81",lesdotor:"\u2A83",lesg:"\u22DA\uFE00",lesges:"\u2A93",lessapprox:"\u2A85",lessdot:"\u22D6",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",LessEqualGreater:"\u22DA",LessFullEqual:"\u2266",LessGreater:"\u2276",lessgtr:"\u2276",LessLess:"\u2AA1",lesssim:"\u2272",LessSlantEqual:"\u2A7D",LessTilde:"\u2272",lfisht:"\u297C",lfloor:"\u230A",lfr:"\u{1D529}",Lfr:"\u{1D50F}",lg:"\u2276",lgE:"\u2A91",lHar:"\u2962",lhard:"\u21BD",lharu:"\u21BC",lharul:"\u296A",lhblk:"\u2584",ljcy:"\u0459",LJcy:"\u0409",ll:"\u226A",Ll:"\u22D8",llarr:"\u21C7",llcorner:"\u231E",Lleftarrow:"\u21DA",llhard:"\u296B",lltri:"\u25FA",lmidot:"\u0140",Lmidot:"\u013F",lmoust:"\u23B0",lmoustache:"\u23B0",lnap:"\u2A89",lnapprox:"\u2A89",lne:"\u2A87",lnE:"\u2268",lneq:"\u2A87",lneqq:"\u2268",lnsim:"\u22E6",loang:"\u27EC",loarr:"\u21FD",lobrk:"\u27E6",longleftarrow:"\u27F5",Longleftarrow:"\u27F8",LongLeftArrow:"\u27F5",longleftrightarrow:"\u27F7",Longleftrightarrow:"\u27FA",LongLeftRightArrow:"\u27F7",longmapsto:"\u27FC",longrightarrow:"\u27F6",Longrightarrow:"\u27F9",LongRightArrow:"\u27F6",looparrowleft:"\u21AB",looparrowright:"\u21AC",lopar:"\u2985",lopf:"\u{1D55D}",Lopf:"\u{1D543}",loplus:"\u2A2D",lotimes:"\u2A34",lowast:"\u2217",lowbar:"_",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",loz:"\u25CA",lozenge:"\u25CA",lozf:"\u29EB",lpar:"(",lparlt:"\u2993",lrarr:"\u21C6",lrcorner:"\u231F",lrhar:"\u21CB",lrhard:"\u296D",lrm:"\u200E",lrtri:"\u22BF",lsaquo:"\u2039",lscr:"\u{1D4C1}",Lscr:"\u2112",lsh:"\u21B0",Lsh:"\u21B0",lsim:"\u2272",lsime:"\u2A8D",lsimg:"\u2A8F",lsqb:"[",lsquo:"\u2018",lsquor:"\u201A",lstrok:"\u0142",Lstrok:"\u0141",lt:"<",Lt:"\u226A",LT:"<",ltcc:"\u2AA6",ltcir:"\u2A79",ltdot:"\u22D6",lthree:"\u22CB",ltimes:"\u22C9",ltlarr:"\u2976",ltquest:"\u2A7B",ltri:"\u25C3",ltrie:"\u22B4",ltrif:"\u25C2",ltrPar:"\u2996",lurdshar:"\u294A",luruhar:"\u2966",lvertneqq:"\u2268\uFE00",lvnE:"\u2268\uFE00",macr:"\xAF",male:"\u2642",malt:"\u2720",maltese:"\u2720",map:"\u21A6",Map:"\u2905",mapsto:"\u21A6",mapstodown:"\u21A7",mapstoleft:"\u21A4",mapstoup:"\u21A5",marker:"\u25AE",mcomma:"\u2A29",mcy:"\u043C",Mcy:"\u041C",mdash:"\u2014",mDDot:"\u223A",measuredangle:"\u2221",MediumSpace:"\u205F",Mellintrf:"\u2133",mfr:"\u{1D52A}",Mfr:"\u{1D510}",mho:"\u2127",micro:"\xB5",mid:"\u2223",midast:"*",midcir:"\u2AF0",middot:"\xB7",minus:"\u2212",minusb:"\u229F",minusd:"\u2238",minusdu:"\u2A2A",MinusPlus:"\u2213",mlcp:"\u2ADB",mldr:"\u2026",mnplus:"\u2213",models:"\u22A7",mopf:"\u{1D55E}",Mopf:"\u{1D544}",mp:"\u2213",mscr:"\u{1D4C2}",Mscr:"\u2133",mstpos:"\u223E",mu:"\u03BC",Mu:"\u039C",multimap:"\u22B8",mumap:"\u22B8",nabla:"\u2207",nacute:"\u0144",Nacute:"\u0143",nang:"\u2220\u20D2",nap:"\u2249",napE:"\u2A70\u0338",napid:"\u224B\u0338",napos:"\u0149",napprox:"\u2249",natur:"\u266E",natural:"\u266E",naturals:"\u2115",nbsp:"\xA0",nbump:"\u224E\u0338",nbumpe:"\u224F\u0338",ncap:"\u2A43",ncaron:"\u0148",Ncaron:"\u0147",ncedil:"\u0146",Ncedil:"\u0145",ncong:"\u2247",ncongdot:"\u2A6D\u0338",ncup:"\u2A42",ncy:"\u043D",Ncy:"\u041D",ndash:"\u2013",ne:"\u2260",nearhk:"\u2924",nearr:"\u2197",neArr:"\u21D7",nearrow:"\u2197",nedot:"\u2250\u0338",NegativeMediumSpace:"\u200B",NegativeThickSpace:"\u200B",NegativeThinSpace:"\u200B",NegativeVeryThinSpace:"\u200B",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",NestedGreaterGreater:"\u226B",NestedLessLess:"\u226A",NewLine:` +`,nexist:"\u2204",nexists:"\u2204",nfr:"\u{1D52B}",Nfr:"\u{1D511}",nge:"\u2271",ngE:"\u2267\u0338",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",nGg:"\u22D9\u0338",ngsim:"\u2275",ngt:"\u226F",nGt:"\u226B\u20D2",ngtr:"\u226F",nGtv:"\u226B\u0338",nharr:"\u21AE",nhArr:"\u21CE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",njcy:"\u045A",NJcy:"\u040A",nlarr:"\u219A",nlArr:"\u21CD",nldr:"\u2025",nle:"\u2270",nlE:"\u2266\u0338",nleftarrow:"\u219A",nLeftarrow:"\u21CD",nleftrightarrow:"\u21AE",nLeftrightarrow:"\u21CE",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2A7D\u0338",nles:"\u2A7D\u0338",nless:"\u226E",nLl:"\u22D8\u0338",nlsim:"\u2274",nlt:"\u226E",nLt:"\u226A\u20D2",nltri:"\u22EA",nltrie:"\u22EC",nLtv:"\u226A\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xA0",nopf:"\u{1D55F}",Nopf:"\u2115",not:"\xAC",Not:"\u2AEC",NotCongruent:"\u2262",NotCupCap:"\u226D",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226F",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226B\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2A7E\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224E\u0338",NotHumpEqual:"\u224F\u0338",notin:"\u2209",notindot:"\u22F5\u0338",notinE:"\u22F9\u0338",notinva:"\u2209",notinvb:"\u22F7",notinvc:"\u22F6",NotLeftTriangle:"\u22EA",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangleEqual:"\u22EC",NotLess:"\u226E",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226A\u0338",NotLessSlantEqual:"\u2A7D\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2AA2\u0338",NotNestedLessLess:"\u2AA1\u0338",notni:"\u220C",notniva:"\u220C",notnivb:"\u22FE",notnivc:"\u22FD",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2AAF\u0338",NotPrecedesSlantEqual:"\u22E0",NotReverseElement:"\u220C",NotRightTriangle:"\u22EB",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangleEqual:"\u22ED",NotSquareSubset:"\u228F\u0338",NotSquareSubsetEqual:"\u22E2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22E3",NotSubset:"\u2282\u20D2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2AB0\u0338",NotSucceedsSlantEqual:"\u22E1",NotSucceedsTilde:"\u227F\u0338",NotSuperset:"\u2283\u20D2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",npar:"\u2226",nparallel:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",npre:"\u2AAF\u0338",nprec:"\u2280",npreceq:"\u2AAF\u0338",nrarr:"\u219B",nrArr:"\u21CF",nrarrc:"\u2933\u0338",nrarrw:"\u219D\u0338",nrightarrow:"\u219B",nRightarrow:"\u21CF",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",nscr:"\u{1D4C3}",Nscr:"\u{1D4A9}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsube:"\u2288",nsubE:"\u2AC5\u0338",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupe:"\u2289",nsupE:"\u2AC6\u0338",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",ntilde:"\xF1",Ntilde:"\xD1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",nu:"\u03BD",Nu:"\u039D",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224D\u20D2",nvdash:"\u22AC",nvDash:"\u22AD",nVdash:"\u22AE",nVDash:"\u22AF",nvge:"\u2265\u20D2",nvgt:">\u20D2",nvHarr:"\u2904",nvinfin:"\u29DE",nvlArr:"\u2902",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvltrie:"\u22B4\u20D2",nvrArr:"\u2903",nvrtrie:"\u22B5\u20D2",nvsim:"\u223C\u20D2",nwarhk:"\u2923",nwarr:"\u2196",nwArr:"\u21D6",nwarrow:"\u2196",nwnear:"\u2927",oacute:"\xF3",Oacute:"\xD3",oast:"\u229B",ocir:"\u229A",ocirc:"\xF4",Ocirc:"\xD4",ocy:"\u043E",Ocy:"\u041E",odash:"\u229D",odblac:"\u0151",Odblac:"\u0150",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",oelig:"\u0153",OElig:"\u0152",ofcir:"\u29BF",ofr:"\u{1D52C}",Ofr:"\u{1D512}",ogon:"\u02DB",ograve:"\xF2",Ograve:"\xD2",ogt:"\u29C1",ohbar:"\u29B5",ohm:"\u03A9",oint:"\u222E",olarr:"\u21BA",olcir:"\u29BE",olcross:"\u29BB",oline:"\u203E",olt:"\u29C0",omacr:"\u014D",Omacr:"\u014C",omega:"\u03C9",Omega:"\u03A9",omicron:"\u03BF",Omicron:"\u039F",omid:"\u29B6",ominus:"\u2296",oopf:"\u{1D560}",Oopf:"\u{1D546}",opar:"\u29B7",OpenCurlyDoubleQuote:"\u201C",OpenCurlyQuote:"\u2018",operp:"\u29B9",oplus:"\u2295",or:"\u2228",Or:"\u2A54",orarr:"\u21BB",ord:"\u2A5D",order:"\u2134",orderof:"\u2134",ordf:"\xAA",ordm:"\xBA",origof:"\u22B6",oror:"\u2A56",orslope:"\u2A57",orv:"\u2A5B",oS:"\u24C8",oscr:"\u2134",Oscr:"\u{1D4AA}",oslash:"\xF8",Oslash:"\xD8",osol:"\u2298",otilde:"\xF5",Otilde:"\xD5",otimes:"\u2297",Otimes:"\u2A37",otimesas:"\u2A36",ouml:"\xF6",Ouml:"\xD6",ovbar:"\u233D",OverBar:"\u203E",OverBrace:"\u23DE",OverBracket:"\u23B4",OverParenthesis:"\u23DC",par:"\u2225",para:"\xB6",parallel:"\u2225",parsim:"\u2AF3",parsl:"\u2AFD",part:"\u2202",PartialD:"\u2202",pcy:"\u043F",Pcy:"\u041F",percnt:"%",period:".",permil:"\u2030",perp:"\u22A5",pertenk:"\u2031",pfr:"\u{1D52D}",Pfr:"\u{1D513}",phi:"\u03C6",Phi:"\u03A6",phiv:"\u03D5",phmmat:"\u2133",phone:"\u260E",pi:"\u03C0",Pi:"\u03A0",pitchfork:"\u22D4",piv:"\u03D6",planck:"\u210F",planckh:"\u210E",plankv:"\u210F",plus:"+",plusacir:"\u2A23",plusb:"\u229E",pluscir:"\u2A22",plusdo:"\u2214",plusdu:"\u2A25",pluse:"\u2A72",PlusMinus:"\xB1",plusmn:"\xB1",plussim:"\u2A26",plustwo:"\u2A27",pm:"\xB1",Poincareplane:"\u210C",pointint:"\u2A15",popf:"\u{1D561}",Popf:"\u2119",pound:"\xA3",pr:"\u227A",Pr:"\u2ABB",prap:"\u2AB7",prcue:"\u227C",pre:"\u2AAF",prE:"\u2AB3",prec:"\u227A",precapprox:"\u2AB7",preccurlyeq:"\u227C",Precedes:"\u227A",PrecedesEqual:"\u2AAF",PrecedesSlantEqual:"\u227C",PrecedesTilde:"\u227E",preceq:"\u2AAF",precnapprox:"\u2AB9",precneqq:"\u2AB5",precnsim:"\u22E8",precsim:"\u227E",prime:"\u2032",Prime:"\u2033",primes:"\u2119",prnap:"\u2AB9",prnE:"\u2AB5",prnsim:"\u22E8",prod:"\u220F",Product:"\u220F",profalar:"\u232E",profline:"\u2312",profsurf:"\u2313",prop:"\u221D",Proportion:"\u2237",Proportional:"\u221D",propto:"\u221D",prsim:"\u227E",prurel:"\u22B0",pscr:"\u{1D4C5}",Pscr:"\u{1D4AB}",psi:"\u03C8",Psi:"\u03A8",puncsp:"\u2008",qfr:"\u{1D52E}",Qfr:"\u{1D514}",qint:"\u2A0C",qopf:"\u{1D562}",Qopf:"\u211A",qprime:"\u2057",qscr:"\u{1D4C6}",Qscr:"\u{1D4AC}",quaternions:"\u210D",quatint:"\u2A16",quest:"?",questeq:"\u225F",quot:'"',QUOT:'"',rAarr:"\u21DB",race:"\u223D\u0331",racute:"\u0155",Racute:"\u0154",radic:"\u221A",raemptyv:"\u29B3",rang:"\u27E9",Rang:"\u27EB",rangd:"\u2992",range:"\u29A5",rangle:"\u27E9",raquo:"\xBB",rarr:"\u2192",rArr:"\u21D2",Rarr:"\u21A0",rarrap:"\u2975",rarrb:"\u21E5",rarrbfs:"\u2920",rarrc:"\u2933",rarrfs:"\u291E",rarrhk:"\u21AA",rarrlp:"\u21AC",rarrpl:"\u2945",rarrsim:"\u2974",rarrtl:"\u21A3",Rarrtl:"\u2916",rarrw:"\u219D",ratail:"\u291A",rAtail:"\u291C",ratio:"\u2236",rationals:"\u211A",rbarr:"\u290D",rBarr:"\u290F",RBarr:"\u2910",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298C",rbrksld:"\u298E",rbrkslu:"\u2990",rcaron:"\u0159",Rcaron:"\u0158",rcedil:"\u0157",Rcedil:"\u0156",rceil:"\u2309",rcub:"}",rcy:"\u0440",Rcy:"\u0420",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201D",rdquor:"\u201D",rdsh:"\u21B3",Re:"\u211C",real:"\u211C",realine:"\u211B",realpart:"\u211C",reals:"\u211D",rect:"\u25AD",reg:"\xAE",REG:"\xAE",ReverseElement:"\u220B",ReverseEquilibrium:"\u21CB",ReverseUpEquilibrium:"\u296F",rfisht:"\u297D",rfloor:"\u230B",rfr:"\u{1D52F}",Rfr:"\u211C",rHar:"\u2964",rhard:"\u21C1",rharu:"\u21C0",rharul:"\u296C",rho:"\u03C1",Rho:"\u03A1",rhov:"\u03F1",RightAngleBracket:"\u27E9",rightarrow:"\u2192",Rightarrow:"\u21D2",RightArrow:"\u2192",RightArrowBar:"\u21E5",RightArrowLeftArrow:"\u21C4",rightarrowtail:"\u21A3",RightCeiling:"\u2309",RightDoubleBracket:"\u27E7",RightDownTeeVector:"\u295D",RightDownVector:"\u21C2",RightDownVectorBar:"\u2955",RightFloor:"\u230B",rightharpoondown:"\u21C1",rightharpoonup:"\u21C0",rightleftarrows:"\u21C4",rightleftharpoons:"\u21CC",rightrightarrows:"\u21C9",rightsquigarrow:"\u219D",RightTee:"\u22A2",RightTeeArrow:"\u21A6",RightTeeVector:"\u295B",rightthreetimes:"\u22CC",RightTriangle:"\u22B3",RightTriangleBar:"\u29D0",RightTriangleEqual:"\u22B5",RightUpDownVector:"\u294F",RightUpTeeVector:"\u295C",RightUpVector:"\u21BE",RightUpVectorBar:"\u2954",RightVector:"\u21C0",RightVectorBar:"\u2953",ring:"\u02DA",risingdotseq:"\u2253",rlarr:"\u21C4",rlhar:"\u21CC",rlm:"\u200F",rmoust:"\u23B1",rmoustache:"\u23B1",rnmid:"\u2AEE",roang:"\u27ED",roarr:"\u21FE",robrk:"\u27E7",ropar:"\u2986",ropf:"\u{1D563}",Ropf:"\u211D",roplus:"\u2A2E",rotimes:"\u2A35",RoundImplies:"\u2970",rpar:")",rpargt:"\u2994",rppolint:"\u2A12",rrarr:"\u21C9",Rrightarrow:"\u21DB",rsaquo:"\u203A",rscr:"\u{1D4C7}",Rscr:"\u211B",rsh:"\u21B1",Rsh:"\u21B1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22CC",rtimes:"\u22CA",rtri:"\u25B9",rtrie:"\u22B5",rtrif:"\u25B8",rtriltri:"\u29CE",RuleDelayed:"\u29F4",ruluhar:"\u2968",rx:"\u211E",sacute:"\u015B",Sacute:"\u015A",sbquo:"\u201A",sc:"\u227B",Sc:"\u2ABC",scap:"\u2AB8",scaron:"\u0161",Scaron:"\u0160",sccue:"\u227D",sce:"\u2AB0",scE:"\u2AB4",scedil:"\u015F",Scedil:"\u015E",scirc:"\u015D",Scirc:"\u015C",scnap:"\u2ABA",scnE:"\u2AB6",scnsim:"\u22E9",scpolint:"\u2A13",scsim:"\u227F",scy:"\u0441",Scy:"\u0421",sdot:"\u22C5",sdotb:"\u22A1",sdote:"\u2A66",searhk:"\u2925",searr:"\u2198",seArr:"\u21D8",searrow:"\u2198",sect:"\xA7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",sfr:"\u{1D530}",Sfr:"\u{1D516}",sfrown:"\u2322",sharp:"\u266F",shchcy:"\u0449",SHCHcy:"\u0429",shcy:"\u0448",SHcy:"\u0428",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xAD",sigma:"\u03C3",Sigma:"\u03A3",sigmaf:"\u03C2",sigmav:"\u03C2",sim:"\u223C",simdot:"\u2A6A",sime:"\u2243",simeq:"\u2243",simg:"\u2A9E",simgE:"\u2AA0",siml:"\u2A9D",simlE:"\u2A9F",simne:"\u2246",simplus:"\u2A24",simrarr:"\u2972",slarr:"\u2190",SmallCircle:"\u2218",smallsetminus:"\u2216",smashp:"\u2A33",smeparsl:"\u29E4",smid:"\u2223",smile:"\u2323",smt:"\u2AAA",smte:"\u2AAC",smtes:"\u2AAC\uFE00",softcy:"\u044C",SOFTcy:"\u042C",sol:"/",solb:"\u29C4",solbar:"\u233F",sopf:"\u{1D564}",Sopf:"\u{1D54A}",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\uFE00",sqcup:"\u2294",sqcups:"\u2294\uFE00",Sqrt:"\u221A",sqsub:"\u228F",sqsube:"\u2291",sqsubset:"\u228F",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",squ:"\u25A1",square:"\u25A1",Square:"\u25A1",SquareIntersection:"\u2293",SquareSubset:"\u228F",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25AA",squf:"\u25AA",srarr:"\u2192",sscr:"\u{1D4C8}",Sscr:"\u{1D4AE}",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22C6",star:"\u2606",Star:"\u22C6",starf:"\u2605",straightepsilon:"\u03F5",straightphi:"\u03D5",strns:"\xAF",sub:"\u2282",Sub:"\u22D0",subdot:"\u2ABD",sube:"\u2286",subE:"\u2AC5",subedot:"\u2AC3",submult:"\u2AC1",subne:"\u228A",subnE:"\u2ACB",subplus:"\u2ABF",subrarr:"\u2979",subset:"\u2282",Subset:"\u22D0",subseteq:"\u2286",subseteqq:"\u2AC5",SubsetEqual:"\u2286",subsetneq:"\u228A",subsetneqq:"\u2ACB",subsim:"\u2AC7",subsub:"\u2AD5",subsup:"\u2AD3",succ:"\u227B",succapprox:"\u2AB8",succcurlyeq:"\u227D",Succeeds:"\u227B",SucceedsEqual:"\u2AB0",SucceedsSlantEqual:"\u227D",SucceedsTilde:"\u227F",succeq:"\u2AB0",succnapprox:"\u2ABA",succneqq:"\u2AB6",succnsim:"\u22E9",succsim:"\u227F",SuchThat:"\u220B",sum:"\u2211",Sum:"\u2211",sung:"\u266A",sup:"\u2283",Sup:"\u22D1",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",supdot:"\u2ABE",supdsub:"\u2AD8",supe:"\u2287",supE:"\u2AC6",supedot:"\u2AC4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27C9",suphsub:"\u2AD7",suplarr:"\u297B",supmult:"\u2AC2",supne:"\u228B",supnE:"\u2ACC",supplus:"\u2AC0",supset:"\u2283",Supset:"\u22D1",supseteq:"\u2287",supseteqq:"\u2AC6",supsetneq:"\u228B",supsetneqq:"\u2ACC",supsim:"\u2AC8",supsub:"\u2AD4",supsup:"\u2AD6",swarhk:"\u2926",swarr:"\u2199",swArr:"\u21D9",swarrow:"\u2199",swnwar:"\u292A",szlig:"\xDF",Tab:" ",target:"\u2316",tau:"\u03C4",Tau:"\u03A4",tbrk:"\u23B4",tcaron:"\u0165",Tcaron:"\u0164",tcedil:"\u0163",Tcedil:"\u0162",tcy:"\u0442",Tcy:"\u0422",tdot:"\u20DB",telrec:"\u2315",tfr:"\u{1D531}",Tfr:"\u{1D517}",there4:"\u2234",therefore:"\u2234",Therefore:"\u2234",theta:"\u03B8",Theta:"\u0398",thetasym:"\u03D1",thetav:"\u03D1",thickapprox:"\u2248",thicksim:"\u223C",ThickSpace:"\u205F\u200A",thinsp:"\u2009",ThinSpace:"\u2009",thkap:"\u2248",thksim:"\u223C",thorn:"\xFE",THORN:"\xDE",tilde:"\u02DC",Tilde:"\u223C",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",times:"\xD7",timesb:"\u22A0",timesbar:"\u2A31",timesd:"\u2A30",tint:"\u222D",toea:"\u2928",top:"\u22A4",topbot:"\u2336",topcir:"\u2AF1",topf:"\u{1D565}",Topf:"\u{1D54B}",topfork:"\u2ADA",tosa:"\u2929",tprime:"\u2034",trade:"\u2122",TRADE:"\u2122",triangle:"\u25B5",triangledown:"\u25BF",triangleleft:"\u25C3",trianglelefteq:"\u22B4",triangleq:"\u225C",triangleright:"\u25B9",trianglerighteq:"\u22B5",tridot:"\u25EC",trie:"\u225C",triminus:"\u2A3A",TripleDot:"\u20DB",triplus:"\u2A39",trisb:"\u29CD",tritime:"\u2A3B",trpezium:"\u23E2",tscr:"\u{1D4C9}",Tscr:"\u{1D4AF}",tscy:"\u0446",TScy:"\u0426",tshcy:"\u045B",TSHcy:"\u040B",tstrok:"\u0167",Tstrok:"\u0166",twixt:"\u226C",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",uacute:"\xFA",Uacute:"\xDA",uarr:"\u2191",uArr:"\u21D1",Uarr:"\u219F",Uarrocir:"\u2949",ubrcy:"\u045E",Ubrcy:"\u040E",ubreve:"\u016D",Ubreve:"\u016C",ucirc:"\xFB",Ucirc:"\xDB",ucy:"\u0443",Ucy:"\u0423",udarr:"\u21C5",udblac:"\u0171",Udblac:"\u0170",udhar:"\u296E",ufisht:"\u297E",ufr:"\u{1D532}",Ufr:"\u{1D518}",ugrave:"\xF9",Ugrave:"\xD9",uHar:"\u2963",uharl:"\u21BF",uharr:"\u21BE",uhblk:"\u2580",ulcorn:"\u231C",ulcorner:"\u231C",ulcrop:"\u230F",ultri:"\u25F8",umacr:"\u016B",Umacr:"\u016A",uml:"\xA8",UnderBar:"_",UnderBrace:"\u23DF",UnderBracket:"\u23B5",UnderParenthesis:"\u23DD",Union:"\u22C3",UnionPlus:"\u228E",uogon:"\u0173",Uogon:"\u0172",uopf:"\u{1D566}",Uopf:"\u{1D54C}",uparrow:"\u2191",Uparrow:"\u21D1",UpArrow:"\u2191",UpArrowBar:"\u2912",UpArrowDownArrow:"\u21C5",updownarrow:"\u2195",Updownarrow:"\u21D5",UpDownArrow:"\u2195",UpEquilibrium:"\u296E",upharpoonleft:"\u21BF",upharpoonright:"\u21BE",uplus:"\u228E",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",upsi:"\u03C5",Upsi:"\u03D2",upsih:"\u03D2",upsilon:"\u03C5",Upsilon:"\u03A5",UpTee:"\u22A5",UpTeeArrow:"\u21A5",upuparrows:"\u21C8",urcorn:"\u231D",urcorner:"\u231D",urcrop:"\u230E",uring:"\u016F",Uring:"\u016E",urtri:"\u25F9",uscr:"\u{1D4CA}",Uscr:"\u{1D4B0}",utdot:"\u22F0",utilde:"\u0169",Utilde:"\u0168",utri:"\u25B5",utrif:"\u25B4",uuarr:"\u21C8",uuml:"\xFC",Uuml:"\xDC",uwangle:"\u29A7",vangrt:"\u299C",varepsilon:"\u03F5",varkappa:"\u03F0",varnothing:"\u2205",varphi:"\u03D5",varpi:"\u03D6",varpropto:"\u221D",varr:"\u2195",vArr:"\u21D5",varrho:"\u03F1",varsigma:"\u03C2",varsubsetneq:"\u228A\uFE00",varsubsetneqq:"\u2ACB\uFE00",varsupsetneq:"\u228B\uFE00",varsupsetneqq:"\u2ACC\uFE00",vartheta:"\u03D1",vartriangleleft:"\u22B2",vartriangleright:"\u22B3",vBar:"\u2AE8",Vbar:"\u2AEB",vBarv:"\u2AE9",vcy:"\u0432",Vcy:"\u0412",vdash:"\u22A2",vDash:"\u22A8",Vdash:"\u22A9",VDash:"\u22AB",Vdashl:"\u2AE6",vee:"\u2228",Vee:"\u22C1",veebar:"\u22BB",veeeq:"\u225A",vellip:"\u22EE",verbar:"|",Verbar:"\u2016",vert:"|",Vert:"\u2016",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200A",vfr:"\u{1D533}",Vfr:"\u{1D519}",vltri:"\u22B2",vnsub:"\u2282\u20D2",vnsup:"\u2283\u20D2",vopf:"\u{1D567}",Vopf:"\u{1D54D}",vprop:"\u221D",vrtri:"\u22B3",vscr:"\u{1D4CB}",Vscr:"\u{1D4B1}",vsubne:"\u228A\uFE00",vsubnE:"\u2ACB\uFE00",vsupne:"\u228B\uFE00",vsupnE:"\u2ACC\uFE00",Vvdash:"\u22AA",vzigzag:"\u299A",wcirc:"\u0175",Wcirc:"\u0174",wedbar:"\u2A5F",wedge:"\u2227",Wedge:"\u22C0",wedgeq:"\u2259",weierp:"\u2118",wfr:"\u{1D534}",Wfr:"\u{1D51A}",wopf:"\u{1D568}",Wopf:"\u{1D54E}",wp:"\u2118",wr:"\u2240",wreath:"\u2240",wscr:"\u{1D4CC}",Wscr:"\u{1D4B2}",xcap:"\u22C2",xcirc:"\u25EF",xcup:"\u22C3",xdtri:"\u25BD",xfr:"\u{1D535}",Xfr:"\u{1D51B}",xharr:"\u27F7",xhArr:"\u27FA",xi:"\u03BE",Xi:"\u039E",xlarr:"\u27F5",xlArr:"\u27F8",xmap:"\u27FC",xnis:"\u22FB",xodot:"\u2A00",xopf:"\u{1D569}",Xopf:"\u{1D54F}",xoplus:"\u2A01",xotime:"\u2A02",xrarr:"\u27F6",xrArr:"\u27F9",xscr:"\u{1D4CD}",Xscr:"\u{1D4B3}",xsqcup:"\u2A06",xuplus:"\u2A04",xutri:"\u25B3",xvee:"\u22C1",xwedge:"\u22C0",yacute:"\xFD",Yacute:"\xDD",yacy:"\u044F",YAcy:"\u042F",ycirc:"\u0177",Ycirc:"\u0176",ycy:"\u044B",Ycy:"\u042B",yen:"\xA5",yfr:"\u{1D536}",Yfr:"\u{1D51C}",yicy:"\u0457",YIcy:"\u0407",yopf:"\u{1D56A}",Yopf:"\u{1D550}",yscr:"\u{1D4CE}",Yscr:"\u{1D4B4}",yucy:"\u044E",YUcy:"\u042E",yuml:"\xFF",Yuml:"\u0178",zacute:"\u017A",Zacute:"\u0179",zcaron:"\u017E",Zcaron:"\u017D",zcy:"\u0437",Zcy:"\u0417",zdot:"\u017C",Zdot:"\u017B",zeetrf:"\u2128",ZeroWidthSpace:"\u200B",zeta:"\u03B6",Zeta:"\u0396",zfr:"\u{1D537}",Zfr:"\u2128",zhcy:"\u0436",ZHcy:"\u0416",zigrarr:"\u21DD",zopf:"\u{1D56B}",Zopf:"\u2124",zscr:"\u{1D4CF}",Zscr:"\u{1D4B5}",zwj:"\u200D",zwnj:"\u200C"},g={aacute:"\xE1",Aacute:"\xC1",acirc:"\xE2",Acirc:"\xC2",acute:"\xB4",aelig:"\xE6",AElig:"\xC6",agrave:"\xE0",Agrave:"\xC0",amp:"&",AMP:"&",aring:"\xE5",Aring:"\xC5",atilde:"\xE3",Atilde:"\xC3",auml:"\xE4",Auml:"\xC4",brvbar:"\xA6",ccedil:"\xE7",Ccedil:"\xC7",cedil:"\xB8",cent:"\xA2",copy:"\xA9",COPY:"\xA9",curren:"\xA4",deg:"\xB0",divide:"\xF7",eacute:"\xE9",Eacute:"\xC9",ecirc:"\xEA",Ecirc:"\xCA",egrave:"\xE8",Egrave:"\xC8",eth:"\xF0",ETH:"\xD0",euml:"\xEB",Euml:"\xCB",frac12:"\xBD",frac14:"\xBC",frac34:"\xBE",gt:">",GT:">",iacute:"\xED",Iacute:"\xCD",icirc:"\xEE",Icirc:"\xCE",iexcl:"\xA1",igrave:"\xEC",Igrave:"\xCC",iquest:"\xBF",iuml:"\xEF",Iuml:"\xCF",laquo:"\xAB",lt:"<",LT:"<",macr:"\xAF",micro:"\xB5",middot:"\xB7",nbsp:"\xA0",not:"\xAC",ntilde:"\xF1",Ntilde:"\xD1",oacute:"\xF3",Oacute:"\xD3",ocirc:"\xF4",Ocirc:"\xD4",ograve:"\xF2",Ograve:"\xD2",ordf:"\xAA",ordm:"\xBA",oslash:"\xF8",Oslash:"\xD8",otilde:"\xF5",Otilde:"\xD5",ouml:"\xF6",Ouml:"\xD6",para:"\xB6",plusmn:"\xB1",pound:"\xA3",quot:'"',QUOT:'"',raquo:"\xBB",reg:"\xAE",REG:"\xAE",sect:"\xA7",shy:"\xAD",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",szlig:"\xDF",thorn:"\xFE",THORN:"\xDE",times:"\xD7",uacute:"\xFA",Uacute:"\xDA",ucirc:"\xFB",Ucirc:"\xDB",ugrave:"\xF9",Ugrave:"\xD9",uml:"\xA8",uuml:"\xFC",Uuml:"\xDC",yacute:"\xFD",Yacute:"\xDD",yen:"\xA5",yuml:"\xFF"},x={"0":"\uFFFD","128":"\u20AC","130":"\u201A","131":"\u0192","132":"\u201E","133":"\u2026","134":"\u2020","135":"\u2021","136":"\u02C6","137":"\u2030","138":"\u0160","139":"\u2039","140":"\u0152","142":"\u017D","145":"\u2018","146":"\u2019","147":"\u201C","148":"\u201D","149":"\u2022","150":"\u2013","151":"\u2014","152":"\u02DC","153":"\u2122","154":"\u0161","155":"\u203A","156":"\u0153","158":"\u017E","159":"\u0178"},p=[1,2,3,4,5,6,7,8,11,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,64976,64977,64978,64979,64980,64981,64982,64983,64984,64985,64986,64987,64988,64989,64990,64991,64992,64993,64994,64995,64996,64997,64998,64999,65e3,65001,65002,65003,65004,65005,65006,65007,65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111],d=String.fromCharCode,A={},b=A.hasOwnProperty,C=function(N,U){return b.call(N,U)},E=function(N,U){for(var Z=-1,O=N.length;++Z=55296&&N<=57343||N>1114111?(U&&M("character reference outside the permissible Unicode range"),"\uFFFD"):C(x,N)?(U&&M("disallowed character reference"),x[N]):(U&&E(p,N)&&M("disallowed character reference"),N>65535&&(N-=65536,Z+=d(N>>>10&1023|55296),N=56320|N&1023),Z+=d(N),Z)},P=function(N){return"&#x"+N.toString(16).toUpperCase()+";"},F=function(N){return"&#"+N+";"},M=function(N){throw Error("Parse error: "+N)},D=function(N,U){U=T(U,D.options);var Z=U.strict;Z&&h.test(N)&&M("forbidden code point");var O=U.encodeEverything,W=U.useNamedReferences,X=U.allowUnsafeSymbols,Q=U.decimal?F:P,a1=function(B){return Q(B.charCodeAt(0))};return O?(N=N.replace(r,function(B){return W&&C(c,B)?"&"+c[B]+";":a1(B)}),W&&(N=N.replace(/>\u20D2/g,">⃒").replace(/<\u20D2/g,"<⃒").replace(/fj/g,"fj")),W&&(N=N.replace(o,function(B){return"&"+c[B]+";"}))):W?(X||(N=N.replace(l,function(B){return"&"+c[B]+";"})),N=N.replace(/>\u20D2/g,">⃒").replace(/<\u20D2/g,"<⃒"),N=N.replace(o,function(B){return"&"+c[B]+";"})):X||(N=N.replace(l,a1)),N.replace(a,function(B){var M1=B.charCodeAt(0),u1=B.charCodeAt(1),v1=(M1-55296)*1024+u1-56320+65536;return Q(v1)}).replace(s,a1)};D.options={allowUnsafeSymbols:!1,encodeEverything:!1,strict:!1,useNamedReferences:!1,decimal:!1};var z=function(N,U){U=T(U,z.options);var Z=U.strict;return Z&&f.test(N)&&M("malformed character reference"),N.replace(m,function(O,W,X,Q,a1,B,M1,u1,v1){var n1,T1,A1,C1,h2,K1;return W?(h2=W,v[h2]):X?(h2=X,K1=Q,K1&&U.isAttributeValue?(Z&&K1=="="&&M("`&` did not start a character reference"),O):(Z&&M("named character reference was not terminated by a semicolon"),g[h2]+(K1||""))):a1?(A1=a1,T1=B,Z&&!T1&&M("character reference was not terminated by a semicolon"),n1=parseInt(A1,10),S(n1,Z)):M1?(C1=M1,T1=u1,Z&&!T1&&M("character reference was not terminated by a semicolon"),n1=parseInt(C1,16),S(n1,Z)):(Z&&M("named character reference was not terminated by a semicolon"),O)})};z.options={isAttributeValue:!1,strict:!1};var H=function(N){return N.replace(l,function(U){return u[U]})},V={version:"1.2.0",encode:D,decode:z,escape:H,unescape:z};if(typeof define=="function"&&typeof define.amd=="object"&&define.amd)define(function(){return V});else if(e&&!e.nodeType)if(t)t.exports=V;else for(var L in V)C(V,L)&&(e[L]=V[L]);else n.he=V})(s6)});var _o=M0((wo,v0)=>{(function(n,e){typeof define=="function"&&define.amd?define([],e):typeof v0=="object"&&v0.exports?v0.exports=e():n.moo=e()})(wo,function(){"use strict";var n=Object.prototype.hasOwnProperty,e=Object.prototype.toString,t=typeof new RegExp().sticky=="boolean";function i(S){return S&&e.call(S)==="[object RegExp]"}function a(S){return S&&typeof S=="object"&&!i(S)&&!Array.isArray(S)}function r(S){return S.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function s(S){var P=new RegExp("|"+S);return P.exec("").length-1}function o(S){return"("+S+")"}function c(S){if(!S.length)return"(?!)";var P=S.map(function(F){return"(?:"+F+")"}).join("|");return"(?:"+P+")"}function l(S){if(typeof S=="string")return"(?:"+r(S)+")";if(i(S)){if(S.ignoreCase)throw new Error("RegExp /i flag not allowed");if(S.global)throw new Error("RegExp /g flag is implied");if(S.sticky)throw new Error("RegExp /y flag is implied");if(S.multiline)throw new Error("RegExp /m flag is implied");return S.source}else throw new Error("Not a pattern: "+S)}function u(S){for(var P=Object.getOwnPropertyNames(S),F=[],M=0;M0)throw new Error("RegExp has capture groups: "+Q+` +Use (?: \u2026 ) instead`);if(!N.lineBreaks&&Q.test(` +`))throw new Error("Rule should declare lineBreaks: "+Q);V.push(o(X))}}var B=F&&F.fallback,M1=t&&!B?"ym":"gm",u1=t||B?"":"|";z===!0&&(M1+="u");var v1=new RegExp(c(V)+u1,M1);return{regexp:v1,groups:H,fast:M,error:F||v}}function x(S){var P=g(m(S));return new b({start:P},"start")}function p(S,P,F){var M=S&&(S.push||S.next);if(M&&!F[M])throw new Error("Missing state '"+M+"' (in token '"+S.defaultType+"' of state '"+P+"')");if(S&&S.pop&&+S.pop!=1)throw new Error("pop must be 1 (in token '"+S.defaultType+"' of state '"+P+"')")}function d(S,P){var F=S.$all?m(S.$all):[];delete S.$all;var M=Object.getOwnPropertyNames(S);P||(P=M[0]);for(var D=Object.create(null),z=0;zh6,default:()=>Ni});var e2=w2(require("obsidian")),Ho=w2(Bi());var Pi={prefix:"fas",iconName:"dice",icon:[640,512,[],"f522","M592 192H473.26c12.69 29.59 7.12 65.2-17 89.32L320 417.58V464c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48V240c0-26.51-21.49-48-48-48zM480 376c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24zm-46.37-186.7L258.7 14.37c-19.16-19.16-50.23-19.16-69.39 0L14.37 189.3c-19.16 19.16-19.16 50.23 0 69.39L189.3 433.63c19.16 19.16 50.23 19.16 69.39 0L433.63 258.7c19.16-19.17 19.16-50.24 0-69.4zM96 248c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24zm128 128c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24zm0-128c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24zm0-128c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24zm128 128c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24z"]};var Ii={prefix:"far",iconName:"copy",icon:[448,512,[],"f0c5","M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z"]};function gt(n){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?gt=function(e){return typeof e}:gt=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gt(n)}function jo(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function ki(n,e){for(var t=0;t-1;a--){var r=t[a],s=(r.tagName||"").toUpperCase();["STYLE","LINK"].indexOf(s)>-1&&(i=r)}return C2.head.insertBefore(e,i),n}}var mc="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";function r6(){for(var n=12,e="";n-- >0;)e+=mc[Math.random()*62|0];return e}function ra(n){return"".concat(n).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">")}function vc(n){return Object.keys(n||{}).reduce(function(e,t){return e+"".concat(t,'="').concat(ra(n[t]),'" ')},"").trim()}function na(n){return Object.keys(n||{}).reduce(function(e,t){return e+"".concat(t,": ").concat(n[t],";")},"")}function sa(n){return n.size!==F4.size||n.x!==F4.x||n.y!==F4.y||n.rotate!==F4.rotate||n.flipX||n.flipY}function oa(n){var e=n.transform,t=n.containerWidth,i=n.iconWidth,a={transform:"translate(".concat(t/2," 256)")},r="translate(".concat(e.x*32,", ").concat(e.y*32,") "),s="scale(".concat(e.size/16*(e.flipX?-1:1),", ").concat(e.size/16*(e.flipY?-1:1),") "),o="rotate(".concat(e.rotate," 0 0)"),c={transform:"".concat(r," ").concat(s," ").concat(o)},l={transform:"translate(".concat(i/2*-1," -256)")};return{outer:a,inner:c,path:l}}var S0={x:0,y:0,width:"100%",height:"100%"};function ca(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return n.attributes&&(n.attributes.fill||e)&&(n.attributes.fill="black"),n}function gc(n){return n.tag==="g"?n.children:[n]}function xc(n){var e=n.children,t=n.attributes,i=n.main,a=n.mask,r=n.maskId,s=n.transform,o=i.width,c=i.icon,l=a.width,u=a.icon,f=oa({transform:s,containerWidth:l,iconWidth:o}),h={tag:"rect",attributes:F1({},S0,{fill:"white"})},m=c.children?{children:c.children.map(ca)}:{},v={tag:"g",attributes:F1({},f.inner),children:[ca(F1({tag:c.tag,attributes:F1({},c.attributes,f.path)},m))]},g={tag:"g",attributes:F1({},f.outer),children:[v]},x="mask-".concat(r||r6()),p="clip-".concat(r||r6()),d={tag:"mask",attributes:F1({},S0,{id:x,maskUnits:"userSpaceOnUse",maskContentUnits:"userSpaceOnUse"}),children:[h,g]},A={tag:"defs",children:[{tag:"clipPath",attributes:{id:p},children:gc(u)},d]};return e.push(A,{tag:"rect",attributes:F1({fill:"currentColor","clip-path":"url(#".concat(p,")"),mask:"url(#".concat(x,")")},S0)}),{children:e,attributes:t}}function Mc(n){var e=n.children,t=n.attributes,i=n.main,a=n.transform,r=n.styles,s=na(r);if(s.length>0&&(t.style=s),sa(a)){var o=oa({transform:a,containerWidth:i.width,iconWidth:i.width});e.push({tag:"g",attributes:F1({},o.outer),children:[{tag:"g",attributes:F1({},o.inner),children:[{tag:i.icon.tag,children:i.icon.children,attributes:F1({},i.icon.attributes,o.path)}]}]})}else e.push(i.icon);return{children:e,attributes:t}}function bc(n){var e=n.children,t=n.main,i=n.mask,a=n.attributes,r=n.styles,s=n.transform;if(sa(s)&&t.found&&!i.found){var o=t.width,c=t.height,l={x:o/c/2,y:.5};a.style=na(F1({},r,{"transform-origin":"".concat(l.x+s.x/16,"em ").concat(l.y+s.y/16,"em")}))}return[{tag:"svg",attributes:a,children:e}]}function yc(n){var e=n.prefix,t=n.iconName,i=n.children,a=n.attributes,r=n.symbol,s=r===!0?"".concat(e,"-").concat(V2.familyPrefix,"-").concat(t):r;return[{tag:"svg",attributes:{style:"display: none;"},children:[{tag:"symbol",attributes:F1({},a,{id:s}),children:i}]}]}function Cc(n){var e=n.icons,t=e.main,i=e.mask,a=n.prefix,r=n.iconName,s=n.transform,o=n.symbol,c=n.title,l=n.maskId,u=n.titleId,f=n.extra,h=n.watchable,m=h===void 0?!1:h,v=i.found?i:t,g=v.width,x=v.height,p=a==="fak",d=p?"":"fa-w-".concat(Math.ceil(g/x*16)),A=[V2.replacementClass,r?"".concat(V2.familyPrefix,"-").concat(r):"",d].filter(function(F){return f.classes.indexOf(F)===-1}).filter(function(F){return F!==""||!!F}).concat(f.classes).join(" "),b={children:[],attributes:F1({},f.attributes,{"data-prefix":a,"data-icon":r,class:A,role:f.attributes.role||"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 ".concat(g," ").concat(x)})},C=p&&!~f.classes.indexOf("fa-fw")?{width:"".concat(g/x*16*.0625,"em")}:{};m&&(b.attributes[ec]=""),c&&b.children.push({tag:"title",attributes:{id:b.attributes["aria-labelledby"]||"title-".concat(u||r6())},children:[c]});var E=F1({},b,{prefix:a,iconName:r,main:t,mask:i,maskId:l,transform:s,symbol:o,styles:F1({},C,f.styles)}),T=i.found&&t.found?xc(E):Mc(E),S=T.children,P=T.attributes;return E.children=S,E.attributes=P,o?yc(E):bc(E)}var la=function(){},Mh=V2.measurePerformance&&e6&&e6.mark&&e6.measure?e6:{mark:la,measure:la};var zc=function(e,t){return function(i,a,r,s){return e.call(t,i,a,r,s)}},E0=function(e,t,i,a){var r=Object.keys(e),s=r.length,o=a!==void 0?zc(t,a):t,c,l,u;for(i===void 0?(c=1,u=e[r[0]]):(c=0,u=i);c2&&arguments[2]!==void 0?arguments[2]:{},i=t.skipHooks,a=i===void 0?!1:i,r=Object.keys(e).reduce(function(s,o){var c=e[o],l=!!c.icon;return l?s[c.iconName]=c.icon:s[o]=c,s},{});typeof fe.hooks.addPack=="function"&&!a?fe.hooks.addPack(n,r):fe.styles[n]=F1({},fe.styles[n]||{},r),n==="fas"&&ua("fa",e)}var ha=fe.styles,Ac=fe.shims,wc={},_c={},Sc={},fa=function(){var e=function(a){return E0(ha,function(r,s,o){return r[o]=E0(s,a,{}),r},{})};wc=e(function(i,a,r){return a[3]&&(i[a[3]]=r),i}),_c=e(function(i,a,r){var s=a[2];return i[r]=r,s.forEach(function(o){i[o]=r}),i});var t="far"in ha;Sc=E0(Ac,function(i,a){var r=a[0],s=a[1],o=a[2];return s==="far"&&!t&&(s="fas"),i[r]={prefix:s,iconName:o},i},{})};fa();var bh=fe.styles;function da(n,e,t){if(n&&n[e]&&n[e][t])return{prefix:e,iconName:t,icon:n[e][t]}}function pa(n){var e=n.tag,t=n.attributes,i=t===void 0?{}:t,a=n.children,r=a===void 0?[]:a;return typeof n=="string"?ra(n):"<".concat(e," ").concat(vc(i),">").concat(r.map(pa).join(""),"")}function L0(n){this.name="MissingIcon",this.message=n||"Icon unavailable",this.stack=new Error().stack}L0.prototype=Object.create(Error.prototype);L0.prototype.constructor=L0;var n6={fill:"currentColor"},ma={attributeType:"XML",repeatCount:"indefinite",dur:"2s"},yh={tag:"path",attributes:F1({},n6,{d:"M156.5,447.7l-12.6,29.5c-18.7-9.5-35.9-21.2-51.5-34.9l22.7-22.7C127.6,430.5,141.5,440,156.5,447.7z M40.6,272H8.5 c1.4,21.2,5.4,41.7,11.7,61.1L50,321.2C45.1,305.5,41.8,289,40.6,272z M40.6,240c1.4-18.8,5.2-37,11.1-54.1l-29.5-12.6 C14.7,194.3,10,216.7,8.5,240H40.6z M64.3,156.5c7.8-14.9,17.2-28.8,28.1-41.5L69.7,92.3c-13.7,15.6-25.5,32.8-34.9,51.5 L64.3,156.5z M397,419.6c-13.9,12-29.4,22.3-46.1,30.4l11.9,29.8c20.7-9.9,39.8-22.6,56.9-37.6L397,419.6z M115,92.4 c13.9-12,29.4-22.3,46.1-30.4l-11.9-29.8c-20.7,9.9-39.8,22.6-56.8,37.6L115,92.4z M447.7,355.5c-7.8,14.9-17.2,28.8-28.1,41.5 l22.7,22.7c13.7-15.6,25.5-32.9,34.9-51.5L447.7,355.5z M471.4,272c-1.4,18.8-5.2,37-11.1,54.1l29.5,12.6 c7.5-21.1,12.2-43.5,13.6-66.8H471.4z M321.2,462c-15.7,5-32.2,8.2-49.2,9.4v32.1c21.2-1.4,41.7-5.4,61.1-11.7L321.2,462z M240,471.4c-18.8-1.4-37-5.2-54.1-11.1l-12.6,29.5c21.1,7.5,43.5,12.2,66.8,13.6V471.4z M462,190.8c5,15.7,8.2,32.2,9.4,49.2h32.1 c-1.4-21.2-5.4-41.7-11.7-61.1L462,190.8z M92.4,397c-12-13.9-22.3-29.4-30.4-46.1l-29.8,11.9c9.9,20.7,22.6,39.8,37.6,56.9 L92.4,397z M272,40.6c18.8,1.4,36.9,5.2,54.1,11.1l12.6-29.5C317.7,14.7,295.3,10,272,8.5V40.6z M190.8,50 c15.7-5,32.2-8.2,49.2-9.4V8.5c-21.2,1.4-41.7,5.4-61.1,11.7L190.8,50z M442.3,92.3L419.6,115c12,13.9,22.3,29.4,30.5,46.1 l29.8-11.9C470,128.5,457.3,109.4,442.3,92.3z M397,92.4l22.7-22.7c-15.6-13.7-32.8-25.5-51.5-34.9l-12.6,29.5 C370.4,72.1,384.4,81.5,397,92.4z"})},D0=F1({},ma,{attributeName:"opacity"}),Ch={tag:"circle",attributes:F1({},n6,{cx:"256",cy:"364",r:"28"}),children:[{tag:"animate",attributes:F1({},ma,{attributeName:"r",values:"28;14;28;28;14;28;"})},{tag:"animate",attributes:F1({},D0,{values:"1;0;1;1;0;1;"})}]},zh={tag:"path",attributes:F1({},n6,{opacity:"1",d:"M263.7,312h-16c-6.6,0-12-5.4-12-12c0-71,77.4-63.9,77.4-107.8c0-20-17.8-40.2-57.4-40.2c-29.1,0-44.3,9.6-59.2,28.7 c-3.9,5-11.1,6-16.2,2.4l-13.1-9.2c-5.6-3.9-6.9-11.8-2.6-17.2c21.2-27.2,46.4-44.7,91.2-44.7c52.3,0,97.4,29.8,97.4,80.2 c0,67.6-77.4,63.5-77.4,107.8C275.7,306.6,270.3,312,263.7,312z"}),children:[{tag:"animate",attributes:F1({},D0,{values:"1;0;0;0;0;1;"})}]},Ah={tag:"path",attributes:F1({},n6,{opacity:"0",d:"M232.5,134.5l7,168c0.3,6.4,5.6,11.5,12,11.5h9c6.4,0,11.7-5.1,12-11.5l7-168c0.3-6.8-5.2-12.5-12-12.5h-23 C237.7,122,232.2,127.7,232.5,134.5z"}),children:[{tag:"animate",attributes:F1({},D0,{values:"0;0;1;1;0;0;"})}]};var wh=fe.styles;function va(n){var e=n[0],t=n[1],i=n.slice(4),a=Ui(i,1),r=a[0],s=null;return Array.isArray(r)?s={tag:"g",attributes:{class:"".concat(V2.familyPrefix,"-").concat(m4.GROUP)},children:[{tag:"path",attributes:{class:"".concat(V2.familyPrefix,"-").concat(m4.SECONDARY),fill:"currentColor",d:r[0]}},{tag:"path",attributes:{class:"".concat(V2.familyPrefix,"-").concat(m4.PRIMARY),fill:"currentColor",d:r[1]}}]}:s={tag:"path",attributes:{fill:"currentColor",d:r}},{found:!0,width:e,height:t,icon:s}}var _h=fe.styles;var Ec=`svg:not(:root).svg-inline--fa { + overflow: visible; +} + +.svg-inline--fa { + display: inline-block; + font-size: inherit; + height: 1em; + overflow: visible; + vertical-align: -0.125em; +} +.svg-inline--fa.fa-lg { + vertical-align: -0.225em; +} +.svg-inline--fa.fa-w-1 { + width: 0.0625em; +} +.svg-inline--fa.fa-w-2 { + width: 0.125em; +} +.svg-inline--fa.fa-w-3 { + width: 0.1875em; +} +.svg-inline--fa.fa-w-4 { + width: 0.25em; +} +.svg-inline--fa.fa-w-5 { + width: 0.3125em; +} +.svg-inline--fa.fa-w-6 { + width: 0.375em; +} +.svg-inline--fa.fa-w-7 { + width: 0.4375em; +} +.svg-inline--fa.fa-w-8 { + width: 0.5em; +} +.svg-inline--fa.fa-w-9 { + width: 0.5625em; +} +.svg-inline--fa.fa-w-10 { + width: 0.625em; +} +.svg-inline--fa.fa-w-11 { + width: 0.6875em; +} +.svg-inline--fa.fa-w-12 { + width: 0.75em; +} +.svg-inline--fa.fa-w-13 { + width: 0.8125em; +} +.svg-inline--fa.fa-w-14 { + width: 0.875em; +} +.svg-inline--fa.fa-w-15 { + width: 0.9375em; +} +.svg-inline--fa.fa-w-16 { + width: 1em; +} +.svg-inline--fa.fa-w-17 { + width: 1.0625em; +} +.svg-inline--fa.fa-w-18 { + width: 1.125em; +} +.svg-inline--fa.fa-w-19 { + width: 1.1875em; +} +.svg-inline--fa.fa-w-20 { + width: 1.25em; +} +.svg-inline--fa.fa-pull-left { + margin-right: 0.3em; + width: auto; +} +.svg-inline--fa.fa-pull-right { + margin-left: 0.3em; + width: auto; +} +.svg-inline--fa.fa-border { + height: 1.5em; +} +.svg-inline--fa.fa-li { + width: 2em; +} +.svg-inline--fa.fa-fw { + width: 1.25em; +} + +.fa-layers svg.svg-inline--fa { + bottom: 0; + left: 0; + margin: auto; + position: absolute; + right: 0; + top: 0; +} + +.fa-layers { + display: inline-block; + height: 1em; + position: relative; + text-align: center; + vertical-align: -0.125em; + width: 1em; +} +.fa-layers svg.svg-inline--fa { + -webkit-transform-origin: center center; + transform-origin: center center; +} + +.fa-layers-counter, .fa-layers-text { + display: inline-block; + position: absolute; + text-align: center; +} + +.fa-layers-text { + left: 50%; + top: 50%; + -webkit-transform: translate(-50%, -50%); + transform: translate(-50%, -50%); + -webkit-transform-origin: center center; + transform-origin: center center; +} + +.fa-layers-counter { + background-color: #ff253a; + border-radius: 1em; + -webkit-box-sizing: border-box; + box-sizing: border-box; + color: #fff; + height: 1.5em; + line-height: 1; + max-width: 5em; + min-width: 1.5em; + overflow: hidden; + padding: 0.25em; + right: 0; + text-overflow: ellipsis; + top: 0; + -webkit-transform: scale(0.25); + transform: scale(0.25); + -webkit-transform-origin: top right; + transform-origin: top right; +} + +.fa-layers-bottom-right { + bottom: 0; + right: 0; + top: auto; + -webkit-transform: scale(0.25); + transform: scale(0.25); + -webkit-transform-origin: bottom right; + transform-origin: bottom right; +} + +.fa-layers-bottom-left { + bottom: 0; + left: 0; + right: auto; + top: auto; + -webkit-transform: scale(0.25); + transform: scale(0.25); + -webkit-transform-origin: bottom left; + transform-origin: bottom left; +} + +.fa-layers-top-right { + right: 0; + top: 0; + -webkit-transform: scale(0.25); + transform: scale(0.25); + -webkit-transform-origin: top right; + transform-origin: top right; +} + +.fa-layers-top-left { + left: 0; + right: auto; + top: 0; + -webkit-transform: scale(0.25); + transform: scale(0.25); + -webkit-transform-origin: top left; + transform-origin: top left; +} + +.fa-lg { + font-size: 1.3333333333em; + line-height: 0.75em; + vertical-align: -0.0667em; +} + +.fa-xs { + font-size: 0.75em; +} + +.fa-sm { + font-size: 0.875em; +} + +.fa-1x { + font-size: 1em; +} + +.fa-2x { + font-size: 2em; +} + +.fa-3x { + font-size: 3em; +} + +.fa-4x { + font-size: 4em; +} + +.fa-5x { + font-size: 5em; +} + +.fa-6x { + font-size: 6em; +} + +.fa-7x { + font-size: 7em; +} + +.fa-8x { + font-size: 8em; +} + +.fa-9x { + font-size: 9em; +} + +.fa-10x { + font-size: 10em; +} + +.fa-fw { + text-align: center; + width: 1.25em; +} + +.fa-ul { + list-style-type: none; + margin-left: 2.5em; + padding-left: 0; +} +.fa-ul > li { + position: relative; +} + +.fa-li { + left: -2em; + position: absolute; + text-align: center; + width: 2em; + line-height: inherit; +} + +.fa-border { + border: solid 0.08em #eee; + border-radius: 0.1em; + padding: 0.2em 0.25em 0.15em; +} + +.fa-pull-left { + float: left; +} + +.fa-pull-right { + float: right; +} + +.fa.fa-pull-left, +.fas.fa-pull-left, +.far.fa-pull-left, +.fal.fa-pull-left, +.fab.fa-pull-left { + margin-right: 0.3em; +} +.fa.fa-pull-right, +.fas.fa-pull-right, +.far.fa-pull-right, +.fal.fa-pull-right, +.fab.fa-pull-right { + margin-left: 0.3em; +} + +.fa-spin { + -webkit-animation: fa-spin 2s infinite linear; + animation: fa-spin 2s infinite linear; +} + +.fa-pulse { + -webkit-animation: fa-spin 1s infinite steps(8); + animation: fa-spin 1s infinite steps(8); +} + +@-webkit-keyframes fa-spin { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} + +@keyframes fa-spin { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} +.fa-rotate-90 { + -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=1)"; + -webkit-transform: rotate(90deg); + transform: rotate(90deg); +} + +.fa-rotate-180 { + -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2)"; + -webkit-transform: rotate(180deg); + transform: rotate(180deg); +} + +.fa-rotate-270 { + -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=3)"; + -webkit-transform: rotate(270deg); + transform: rotate(270deg); +} + +.fa-flip-horizontal { + -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)"; + -webkit-transform: scale(-1, 1); + transform: scale(-1, 1); +} + +.fa-flip-vertical { + -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)"; + -webkit-transform: scale(1, -1); + transform: scale(1, -1); +} + +.fa-flip-both, .fa-flip-horizontal.fa-flip-vertical { + -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)"; + -webkit-transform: scale(-1, -1); + transform: scale(-1, -1); +} + +:root .fa-rotate-90, +:root .fa-rotate-180, +:root .fa-rotate-270, +:root .fa-flip-horizontal, +:root .fa-flip-vertical, +:root .fa-flip-both { + -webkit-filter: none; + filter: none; +} + +.fa-stack { + display: inline-block; + height: 2em; + position: relative; + width: 2.5em; +} + +.fa-stack-1x, +.fa-stack-2x { + bottom: 0; + left: 0; + margin: auto; + position: absolute; + right: 0; + top: 0; +} + +.svg-inline--fa.fa-stack-1x { + height: 1em; + width: 1.25em; +} +.svg-inline--fa.fa-stack-2x { + height: 2em; + width: 2.5em; +} + +.fa-inverse { + color: #fff; +} + +.sr-only { + border: 0; + clip: rect(0, 0, 0, 0); + height: 1px; + margin: -1px; + overflow: hidden; + padding: 0; + position: absolute; + width: 1px; +} + +.sr-only-focusable:active, .sr-only-focusable:focus { + clip: auto; + height: auto; + margin: 0; + overflow: visible; + position: static; + width: auto; +} + +.svg-inline--fa .fa-primary { + fill: var(--fa-primary-color, currentColor); + opacity: 1; + opacity: var(--fa-primary-opacity, 1); +} + +.svg-inline--fa .fa-secondary { + fill: var(--fa-secondary-color, currentColor); + opacity: 0.4; + opacity: var(--fa-secondary-opacity, 0.4); +} + +.svg-inline--fa.fa-swap-opacity .fa-primary { + opacity: 0.4; + opacity: var(--fa-secondary-opacity, 0.4); +} + +.svg-inline--fa.fa-swap-opacity .fa-secondary { + opacity: 1; + opacity: var(--fa-primary-opacity, 1); +} + +.svg-inline--fa mask .fa-primary, +.svg-inline--fa mask .fa-secondary { + fill: black; +} + +.fad.fa-inverse { + color: #fff; +}`;function Lc(){var n=Xi,e=Zi,t=V2.familyPrefix,i=V2.replacementClass,a=Ec;if(t!==n||i!==e){var r=new RegExp("\\.".concat(n,"\\-"),"g"),s=new RegExp("\\--".concat(n,"\\-"),"g"),o=new RegExp("\\.".concat(e),"g");a=a.replace(r,".".concat(t,"-")).replace(s,"--".concat(t,"-")).replace(o,".".concat(i))}return a}var Dc=function(){function n(){jo(this,n),this.definitions={}}return Xo(n,[{key:"add",value:function(){for(var t=this,i=arguments.length,a=new Array(i),r=0;r1&&arguments[1]!==void 0?arguments[1]:{},i=(e||{}).icon?e:ga(e||{}),a=t.mask;return a&&(a=(a||{}).icon?a:ga(a||{})),n(i,F1({},t,{mask:a}))}}var Nc=new Dc;var xa=!1;var T0=Vc(function(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.transform,i=t===void 0?F4:t,a=e.symbol,r=a===void 0?!1:a,s=e.mask,o=s===void 0?null:s,c=e.maskId,l=c===void 0?null:c,u=e.title,f=u===void 0?null:u,h=e.titleId,m=h===void 0?null:h,v=e.classes,g=v===void 0?[]:v,x=e.attributes,p=x===void 0?{}:x,d=e.styles,A=d===void 0?{}:d;if(!!n){var b=n.prefix,C=n.iconName,E=n.icon;return Hc(F1({type:"icon"},n),function(){return Tc(),V2.autoA11y&&(f?p["aria-labelledby"]="".concat(V2.replacementClass,"-title-").concat(m||r6()):(p["aria-hidden"]="true",p.focusable="false")),Cc({icons:{main:va(E),mask:o?va(o.icon):{found:!1,width:null,height:null,icon:{}}},prefix:b,iconName:C,transform:F1({},F4,i),symbol:r,title:f,maskId:l,titleId:m,extra:{attributes:p,styles:A,classes:g}})})}});function H0(n,e){let t=Object.keys(e).map(i=>Rc(n,i,e[i]));return t.length===1?t[0]:function(){t.forEach(i=>i())}}function Rc(n,e,t){let i=n[e],a=n.hasOwnProperty(e),r=t(i);return i&&Object.setPrototypeOf(r,i),Object.setPrototypeOf(s,r),n[e]=s,o;function s(...c){return r===i&&n[e]===s&&o(),r.apply(this,c)}function o(){n[e]===s&&(a?n[e]=i:delete n[e]),r!==i&&(r=i,Object.setPrototypeOf(s,i||Function))}}var Vi=w2(Ma());var V0=/(?:(?\d+)[Dd])?#(?[\p{Letter}\p{Emoji_Presentation}\w/-]+)(?:\|(?[\+-]))?(?:\|(?[^\+-]+))?/u,ba=/(?.*)?(?:\[.*\]\(|\[\[)(?.+?)#?\^(?.+?)(?:\]\]|\))(?:\|(?
.+))?/,N0=/(?:(?\d+)[Dd])?(?:\[.*\]\(|\[\[)(?.+)(?:\]\]|\))\|?(?.+)?/;var De="dice-roller-icon",Te="dice-roller-copy";var g4=w2(require("obsidian"));var de=(a=>(a.None="None",a.Normal="Normal",a.Up="Up",a.Down="Down",a))(de||{}),f2=(i=>(i.None="None",i.Average="Average",i.Roll="Roll",i))(f2||{});function ya(n,e,t){[...n].slice(e).reverse().forEach(([a,r])=>{n.set(a+1,r)}),n.set(e,t)}var B4=w2(require("obsidian"));var R0=class extends B4.Events{constructor(e,t="",i=e.data.showDice){super();this.plugin=e;this.original=t;this.loaded=!1;this.containerEl=createSpan({cls:"dice-roller",attr:{"aria-label-position":"top","data-dice":this.original}});this.resultEl=this.containerEl.createSpan("dice-roller-result");if(i){let a=this.containerEl.createSpan({cls:"dice-roller-button"});(0,B4.setIcon)(a,De),a.onclick=this.onClick.bind(this)}else this.containerEl.addClass("no-icon");this.containerEl.onclick=this.onClick.bind(this)}setTooltip(){this.plugin.data.displayResultsInline||this.containerEl.setAttrs({"aria-label":this.tooltip})}getRandomBetween(e,t){let i=new Uint32Array(1);crypto.getRandomValues(i);let a=i[0]/(4294967295+1);return Math.floor(a*(t-e+1))+e}async render(){this.setTooltip(),await this.build()}async onClick(e){e.stopPropagation(),e.stopImmediatePropagation(),window.getSelection()?.isCollapsed&&await this.roll()}},Ca=class extends R0{constructor(e,t,i,a=e.data.showDice){super(e,t,a);this.plugin=e;this.original=t;this.lexemes=i;this.showDice=a;this.save=!1}get inlineText(){return`${this.tooltip.split(` +`).join(" -> ")} -> `}},v4=class extends Ca{},P4=class extends v4{constructor(e,t,i,a,r=e.data.showDice){super(e,t,[i],r);this.plugin=e;this.original=t;this.lexeme=i;this.source=a;this.watch=!0;this.getPath(),this.init=this.getFile()}async getFile(){if(this.file=this.plugin.app.metadataCache.getFirstLinkpathDest(this.path,this.source),!this.file||!(this.file instanceof B4.TFile))throw new Error("Could not load file.");await this.load()}},F0=class extends R0{constructor(e,t,i){super(e,"");this.options=t;this.rolls=i}get tooltip(){return`${this.options.toString()} + +${this.results.toString()}`}async roll(){let e=[...this.options];return this.results=[...Array(this.rolls)].map(()=>{let t=e[this.getRandomBetween(0,e.length-1)];return e.splice(e.indexOf(t),1),t}).filter(t=>t),this.render(),this.trigger("new-result"),this.result=this.results[0],this.results[0]}async build(){this.resultEl.empty(),this.resultEl.setText(this.results.toString())}};var k2=class{constructor(e,t={value:e,conditions:[],type:"dice"}){this.lexeme=t;this.modifiers=new Map;this.modifiersAllowed=!0;this.static=!1;this.conditions=[];this.fudge=!1;if(!/(\-?\d+)[dD]?(\d+|%|\[\d+,\s?\d+\])?/.test(e))throw new Error("Non parseable dice string passed to DiceRoll.");this.dice=e.split(" ").join(""),/^-?\d+(?:\.\d+)?$/.test(this.dice)&&(this.static=!0,this.modifiersAllowed=!1);let[,i,a=null,r=1]=this.dice.match(/(\-?\d+)[dD]\[?(?:(-?\d+)\s?,)?\s?(-?\d+|%|F)\]?/)||[,1,null,1];this.multiplier=i<0?-1:1,this.rolls=Math.abs(Number(i))||1,Number(r)<0&&!a&&(a=-1),r==="%"&&(r=100),r==="F"&&(r=1,a=-1,this.fudge=!0),Number(r)[o,{usable:!0,value:s,display:`${s}`,modifiers:new Set}]))}get text(){return`${this.result}`}get result(){return this.static?Number(this.dice):[...this.results].map(([,{usable:t,value:i}])=>t?i:0).reduce((t,i)=>t+i,0)}get display(){return this.static?`${this.result}`:`[${[...this.results].map(([,{modifiers:e,display:t}])=>`${t}${[...e].join("")}`).join(", ")}]`}get modifierText(){if(!this.modifiers.size)return"";let e=[...this.conditions].map(({value:i})=>i).join(""),t=[...this.modifiers].map(([i,{conditionals:a,value:r}])=>{let s=a.map(o=>o.value);return`${r}${s.join("")}`}).join("");return`${e}${t}`}keepLow(e=1){if(!this.modifiersAllowed){new g4.Notice("Modifiers are only allowed on dice rolls.");return}[...this.results].sort((t,i)=>t[1].value-i[1].value).slice(e-this.results.size).forEach(([t])=>{let i=this.results.get(t);i.usable=!1,i.modifiers.add("d"),this.results.set(t,{...i})})}keepHigh(e=1){if(!this.modifiersAllowed){new g4.Notice("Modifiers are only allowed on dice rolls.");return}[...this.results].sort((t,i)=>i[1].value-t[1].value).slice(e).forEach(([t])=>{let i=this.results.get(t);i.usable=!1,i.modifiers.add("d"),this.results.set(t,{...i})})}reroll(e,t){if(!this.modifiersAllowed){new g4.Notice("Modifiers are only allowed on dice rolls.");return}t.length||t.push({operator:"=",comparer:this.faces.min,value:""});let i=0,a=[...this.results].filter(([,{value:r}])=>this.checkCondition(r,t));for(;ithis.checkCondition(r,t)).length>0;)i++,a.map(([,r])=>{r.modifiers.add("r"),r.value=this.getRandomBetween(this.faces.min,this.faces.max)});a.forEach(([r,s])=>{this.results.set(r,s)})}explodeAndCombine(e,t){if(!this.modifiersAllowed){new g4.Notice("Modifiers are only allowed on dice rolls.");return}t.length||t.push({operator:"=",comparer:this.faces.max,value:""});let i=0;[...this.results].filter(([,{value:r}])=>this.checkCondition(r,t)).forEach(([r,s])=>{let o=this.getRandomBetween(this.faces.min,this.faces.max);for(i++,s.modifiers.add("!"),s.value+=o,s.display=`${s.value}`,this.results.set(r,s);ithis.checkCondition(r,t)),a=0;i.forEach(([r,s])=>{let o=s.value,c=0;for(;cthis.multiplier*this.getRandomBetween(this.faces.min,this.faces.max))}setResults(e){this.results=new Map([...e].map((t,i)=>[i,{usable:!0,value:t,display:`${t}`,modifiers:new Set}]))}applyModifiers(){for(let[e,t]of this.modifiers)this.applyModifier(e,t)}roll(){let e=this._roll();return this.results=new Map([...e].map((t,i)=>[i,{usable:!0,value:t,display:`${t}`,modifiers:new Set}])),this.applyModifiers(),this.conditions?.length&&this.applyConditions(),e}applyConditions(){for(let[e,t]of this.results){let i=this.conditions.find(({operator:r})=>r==="-="||r==="=-");if(i&&t.value===i.comparer){t.value=-1,t.modifiers.add("-");continue}this.checkCondition(t.value,this.conditions)?(t.modifiers.add("*"),t.value=1):t.usable=!1}}applyModifier(e,t){switch(e){case"sort":{let i;t.value=="sa"?i=[...this.results.values()].sort((a,r)=>a.value-r.value):i=[...this.results.values()].sort((a,r)=>r.value-a.value),this.results=new Map([...this.results.keys()].map(a=>[a,i[a]]));break}case"kh":{this.keepHigh(t.data);break}case"kl":{this.keepLow(t.data);break}case"!":{this.explode(t.data,t.conditionals);break}case"!!":{this.explodeAndCombine(t.data,t.conditionals);break}case"r":{this.reroll(t.data,t.conditionals);break}case"condition":}}checkCondition(e,t){return!t||!t.length?e:t.some(({operator:i,comparer:a})=>{if(Number.isNaN(e)||Number.isNaN(a))return!1;let r=!1;switch(i){case"=":r=e===a;break;case"!=":case"=!":r=e!==a;break;case"<":r=e":r=e>a;break;case">=":r=e>=a;break}return r})}allowAverage(){return!0}average(){return(this.faces.min+this.faces.max)/2}getRandomBetween(e,t){return Math.floor(Math.random()*(t-e+1))+e}},yt=class extends k2{constructor(e,t){super("3d6",t);this.dice=e;this.lexeme=t}get doubles(){return new Set([...this.results].map(([,{usable:e,value:t}])=>e?t:0)).size<3}get result(){return this.static?Number(this.dice):[...this.results].map(([,{usable:t,value:i}])=>t?i:0).reduce((t,i)=>t+i,0)}get display(){let e=[];for(let t of this.results){if(t[0]==0&&this.doubles){e.push(`${t[1].value}S`);continue}e.push(`${t[1].value}`)}return`[${e.join(", ")}]`}allowAverage(){return!1}},za=class extends k2{constructor(e,t){super(e,t);this.dice=e;this.lexeme=t;this.stack=[];let i=`${this.faces.max}`.split("");for(let a=0;aNumber(e.map(t=>t.result).join(""))).reduce((e,t)=>e+t)}get display(){return this.stack.map(e=>e.map(t=>t.result).join(",")).join("|")}roll(){return!this.stack||!this.stack.length?super.roll():(this.stack.forEach(e=>e.map(t=>t.roll())),[...this.stack.map(e=>e.map(t=>t.result)).flat()])}allowAverage(){return!1}},_2=class extends v4{constructor(e,t,i,a=e.data.showDice,r,s){super(e,t,i,a);this.plugin=e;this.original=t;this.lexemes=i;this.displayFixedText=!1;this.stunted="";this.shouldRender=!1;this.showFormula=!1;this.operators={"+":(e,t)=>e+t,"-":(e,t)=>e-t,"*":(e,t)=>e*t,"/":(e,t)=>e/t,"^":(e,t)=>Math.pow(e,t)};this.stack=[];this.stackCopy=[];this.dice=[];this.hasRunOnce=!1;this.fixedText=r,this.expectedValue=s,this.displayFixedText=this.fixedText!=="",this.loaded=!0,this.trigger("loaded")}get replacer(){return`${this.result}`}get resultText(){let e=[],t=0;return this.dice.forEach(i=>{let a=this.original.slice(t);e.push(a.slice(0,a.indexOf(i.lexeme.text)),i.display),t+=a.indexOf(i.lexeme.text)+i.lexeme.text.length+i.modifierText.length}),e.push(this.original.slice(t)),e.join("")}get tooltip(){return this._tooltip?this._tooltip:this.expectedValue===f2.Roll||this.shouldRender?this.displayFixedText?`${this.original} +${this.result} = ${this.resultText}`:`${this.original} +${this.resultText}`:this.expectedValue===f2.Average?this.displayFixedText?`${this.original} +${this.result} = average: ${this.resultText}`:`${this.original} +average: ${this.resultText}`:`${this.original} +empty`}allowAverage(){let e=t=>t.allowAverage();return this.dynamic.every(e)}async build(){if(this.expectedValue===f2.Average&&!this.shouldRender){if(this.allowAverage())for(let a of this.dynamic){let r=a.average();var e=Array(a.rolls).fill(r);a.setResults(e),this.recalculate()}else this.expectedValue=f2.Roll;this.result=Math.floor(this.result),this.setTooltip()}let t=this.result;switch(this.plugin.data.round){case de.None:{t=Math.trunc(t*100)/100;break}case de.Normal:{t=Math.round(t);break}case de.Up:{t=Math.ceil(t);break}case de.Down:{t=Math.floor(t);break}}let i;this.expectedValue===f2.None&&!this.shouldRender?(this.showDice?i=[""]:i=["\xA0"],this.showFormula&&i.unshift(this.original+" -> ")):(i=[`${t}`],this.showFormula&&i.unshift(this.inlineText)),this.expectedValue=f2.Roll,this.displayFixedText?this.resultEl.setText(this.fixedText):this.resultEl.setText(i.join("")+this.stunted)}async onClick(e){e.stopPropagation(),e.stopImmediatePropagation(),e.getModifierState("Alt")?this.expectedValue=f2.Average:e.getModifierState("Control")&&(this.expectedValue=f2.None),window.getSelection()?.isCollapsed&&await this.roll()}get dynamic(){return this.dice.filter(e=>!e.static)}get static(){return this.dice.filter(e=>e.static)}get isStatic(){return this.dice.every(e=>e.static)}async roll(){let e=0;this.stunted="";for(let t of this.lexemes)switch(t.type){case"+":case"-":case"*":case"/":case"^":case"math":let i=this.stack.pop(),a=this.stack.pop();if(!a){t.value==="-"&&(i=new k2(`-${i.dice}`,i.lexeme)),this.stackCopy.push(t.value),this.stack.push(i);continue}i.roll(),i instanceof yt&&i.doubles&&(this.stunted=` - ${i.results.get(0).value} Stunt Points`),a.roll(),a instanceof yt&&a.doubles&&(this.stunted=` - ${a.results.get(0).value} Stunt Points`);let r=this.operators[t.value](a.result,i.result);this.stackCopy.push(t.value),this.stack.push(new k2(`${r}`,t));break;case"kh":{let s=this.dice[e-1],o=t.value?Number(t.value):1;s.modifiers.set("kh",{data:o,conditionals:[],value:t.text});break}case"dl":{let s=this.dice[e-1],o=t.value?Number(t.value):1;o=s.results.size-o,s.modifiers.set("kh",{data:o,conditionals:[],value:t.text});break}case"kl":{let s=this.dice[e-1],o=t.value?Number(t.value):1;s.modifiers.set("kl",{data:o,conditionals:[],value:t.text});break}case"dh":{let s=this.dice[e-1],o=t.value?Number(t.value):1;o=s.results.size-o,s.modifiers.set("kl",{data:o,conditionals:[],value:t.text});break}case"!":{let s=this.dice[e-1],o=Number(t.value)||1;s.modifiers.set("!",{data:o,conditionals:t.conditions??[],value:t.text});break}case"!!":{let s=this.dice[e-1],o=Number(t.value)||1;s.modifiers.set("!!",{data:o,conditionals:t.conditions??[],value:t.text});break}case"r":{let s=this.dice[e-1],o=Number(t.value)||1;s.modifiers.set("r",{data:o,conditionals:t.conditions??[],value:t.text});break}case"sort":{let s=this.dice[e-1],o=Number(t.value);s.modifiers.set("sort",{data:o,conditionals:t.conditions??[],value:t.value});break}case"dice":{if(t.parenedDice&&/^d/.test(t.value)&&this.stack.length){let s=this.stack.pop();t.value=`${s.result}${t.value}`,this.dice[e]=new k2(t.value,t)}this.dice[e]||(this.dice[e]=new k2(t.value,t)),this.stack.push(this.dice[e]),this.stackCopy.push(this.dice[e]),e++;break}case"stunt":{this.dice[e]||(this.dice[e]=new yt(t.value,t)),this.stack.push(this.dice[e]),this.stackCopy.push(this.dice[e]),e++;break}case"%":{this.dice[e]||(this.dice[e]=new za(t.value,t)),this.stack.push(this.dice[e]),this.stackCopy.push(this.dice[e]),e++;break}}if(this.shouldRender&&this.hasRunOnce)await this.plugin.renderRoll(this),new g4.Notice(`${this.tooltip} + +Result: ${this.result}`);else{let t=this.stack.pop();t.roll(),t instanceof yt&&t.doubles&&(this.stunted=` - ${t.results.get(0).value} Stunt Points`),this.result=t.result,this._tooltip=null}return this.render(),this.trigger("new-result"),this.hasRunOnce=!0,this.result}recalculate(){let e=[],t=0;for(let i of this.stackCopy)if(typeof i=="string"){let a=e.pop(),r=e.pop();if(!r){i==="-"&&(a=new k2(`-${a.result}`,a.lexeme)),e.push(a);continue}let s=this.operators[i](r.result,a.result);e.push(new k2(`${s}`))}else e.push(i),i instanceof k2&&i.applyModifiers();e.length&&e[0]instanceof k2&&(e[0].applyModifiers(),t+=e[0].result),this.result=t}toResult(){return{type:"dice",result:this.result,tooltip:this.tooltip}}async applyResult(e){e.type==="dice"&&(e.result&&(this.result=e.result),e.tooltip&&(this._tooltip=e.tooltip),await this.render())}setResult(e){}};var s2=w2(require("obsidian"));function Fc(n){let e="",t="abcdefghijklmnopqrstuvwxyz0123456789",i=t.length;for(let a=0;a{o.stopPropagation(),navigator.clipboard.writeText(this.displayFromCache(...this.results).trim()).then(async()=>{new s2.Notice("Result copied to clipboard.")})}),(0,s2.setIcon)(this.copy,Te)}get replacer(){let e=this.getBlockId(this.result);return e?`![[${this.path}#^${e}]]`:""}get tooltip(){return`${this.original} +${this.path}`}async build(){if(this.resultEl.empty(),this.plugin.data.displayResultsInline&&this.inline&&this.resultEl.createSpan({text:this.inlineText}),!this.results||!this.results.length){this.resultEl.createDiv({cls:"dice-no-results",text:"No results."});return}this.plugin.data.copyContentButton&&this.copy.removeClass("no-show");for(let e of this.results){this.resultEl.onclick=async i=>{if(i&&i.getModifierState("Control")||i.getModifierState("Meta")){i.stopPropagation();return}};let t=this.resultEl.createDiv({cls:"markdown-embed"});if(!this.plugin.data.displayResultsInline){let i="type"in e?e.type:"List Item";t.setAttrs({"aria-label":`${this.file.basename}: ${i}`})}if(!e){t.createDiv({cls:"dice-no-results",text:"No results."});continue}if(s2.MarkdownRenderer.renderMarkdown(this.displayFromCache(e),t.createDiv(),this.source,null),this.plugin.data.copyContentButton&&this.results.length>1){let i=t.createDiv({cls:"dice-content-copy dice-roller-button",attr:{"aria-label":"Copy Contents"}});i.addEventListener("click",a=>{a.stopPropagation(),navigator.clipboard.writeText(this.displayFromCache(e).trim()).then(async()=>{new s2.Notice("Result copied to clipboard.")})}),(0,s2.setIcon)(i,Te)}}}async load(){await this.getOptions()}displayFromCache(...e){let t=[];for(let i of e)t.push(this.content.slice(i.position.start.offset,i.position.end.offset));return t.join(` + +`)}getBlockId(e){let t=this.cache.blocks??{},i=Object.entries(t).find(([a,r])=>Aa(r.position,e.position));if(!i){let a=`${Bc(4)}`,r=`${this.content.slice(0,this.result.position.end.offset+1)}^${a}${this.content.slice(this.result.position.end.offset)}`;return this.watch=!1,this.plugin.app.vault.modify(this.file,r),a}return i[0]}getPath(){let{groups:e}=this.lexeme.value.match(N0),{roll:t=1,link:i,types:a}=e;if(!i)throw new Error("Could not parse link.");this.rolls=(t&&!isNaN(Number(t))&&Number(t))??1,this.path=decodeURIComponent(i.replace(/(\[|\]|\(|\))/g,"")),this.types=a?.split(","),this.levels=a?.split(",").map(r=>/heading\-\d+/.test(r)?r.split("-").pop():null).filter(r=>r),this.types=a?.split(",").map(r=>/heading\-\d+/.test(r)?r.split("-").shift():r)}async getOptions(){if(this.cache=this.plugin.app.metadataCache.getFileCache(this.file),!this.cache||!this.cache.sections)throw new Error("Could not read file cache.");this.content=await this.plugin.app.vault.cachedRead(this.file),this.options=this.cache.sections.filter(({type:e,position:t})=>this.types?e=="heading"&&this.types.includes(e)&&this.levels.length?(this.cache.headings??[]).filter(({level:a})=>this.levels.includes(`${a}`)).some(({position:a})=>Aa(a,t)):this.types.includes(e):!["yaml","thematicBreak"].includes(e)),this.types&&this.types.includes("listItem")&&this.options.push(...this.cache.listItems),this.loaded=!0,this.trigger("loaded")}async roll(){return new Promise((e,t)=>{if(!this.loaded)this.on("loaded",()=>{let i=[...this.options];this.results=[...Array(this.rolls)].map(()=>{let a=i[this.getRandomBetween(0,i.length-1)];return i.splice(i.indexOf(a),1),a}).filter(a=>a),this.render(),this.trigger("new-result"),this.result=this.results[0],e(this.results[0])});else{let i=[...this.options];this.results=[...Array(this.rolls)].map(()=>{let a=i[this.getRandomBetween(0,i.length-1)];return i.splice(i.indexOf(a),1),a}).filter(a=>a),this.render(),this.trigger("new-result"),this.result=this.results[0],e(this.results[0])}})}toResult(){return{type:"section",result:this.results}}async applyResult(e){e.type==="section"&&(e.result&&(this.results=e.result),await this.render())}},o6=class extends v4{constructor(e,t,i,a,r=e.data.showDice){super(e,t,[i],r);this.plugin=e;this.original=t;this.lexeme=i;this.source=a;this.loaded=!1;if(!this.plugin.canUseDataview)throw new s2.Notice("A tag can only be rolled with the Dataview plugin enabled."),new Error("A tag can only be rolled with the Dataview plugin enabled.");this.containerEl.addClasses(["has-embed","markdown-embed"]);let{roll:s=1,tag:o,collapse:c,types:l}=i.value.match(V0).groups;this.collapse=c==="-"?!0:c==="+"?!1:!this.plugin.data.returnAllTags,this.tag=`#${o}`,this.rolls=Number(s),this.types=l,this.getFiles()}get replacer(){return this.result.replacer}get typeText(){return this.types?.length?`|${this.types}`:""}async getFiles(){if(!this.plugin.dataviewAPI){new s2.Notice("Dice Roller: Dataview must be installed and enabled to use tag rollers.");return}await this.plugin.dataviewReady();let e=await this.plugin.dataviewAPI.query(`list from ${this.tag}`);if(!e.successful)throw new Error(`No files found with that tag. Is the tag correct? + +`+this.tag);let t=new Set(e.value.values.reduce((a,r)=>(r.type=="file"&&a.push(r.path),a),[]));if(t&&t.delete(this.source),!t||!t.size)throw new Error(`No files found with that tag. Is the tag correct? + +`+this.tag);let i=Array.from(t).map(a=>`${this.rolls}d[[${a}]]${this.typeText}`);this.results=i.map(a=>new Ct(this.plugin,a,{...this.lexeme,value:a,type:"section"},this.source,!1)),this.loaded=!0,this.trigger("loaded")}async build(){if(this.resultEl.empty(),this.plugin.data.displayResultsInline&&this.resultEl.createSpan({text:this.inlineText}),this.collapse){this.chosen=this.random??this.getRandomBetween(0,this.results.length-1);let e=this.results[this.chosen];this.random=null;let t=this.resultEl.createDiv();t.createEl("h5",{cls:"dice-file-name",text:e.file.basename}),t.appendChild(e.containerEl)}else for(let e of this.results){let t=this.resultEl.createDiv();t.createEl("h5",{cls:"dice-file-name",text:e.file.basename}),t.appendChild(e.containerEl)}}async roll(){return new Promise((e,t)=>{this.loaded?(this.results.forEach(async i=>await i.roll()),this.render(),this.trigger("new-result"),this.result=this.results[0],e(this.result)):this.on("loaded",()=>{this.results.forEach(async i=>await i.roll()),this.render(),this.trigger("new-result"),this.result=this.results[0],e(this.result)})})}get tooltip(){return this.original}toResult(){return{type:"tag",random:this.chosen,result:Object.fromEntries(this.results.map(e=>[e.path,e.toResult()]))}}async applyResult(e){if(e.type==="tag"){if(e.result)for(let t in e.result){let i=this.results.find(a=>a.path===t);!i||i.applyResult(e.result[t])}e.random&&(this.random=e.random),await this.render()}}},c6=class extends v4{constructor(e,t,i,a,r=e.data.showDice){super(e,t,[i],r);this.plugin=e;this.original=t;this.lexeme=i;this.source=a;let{roll:s=1,tag:o}=i.value.match(V0).groups;this.tag=`#${o}`,this.rolls=(s&&!isNaN(Number(s))&&Number(s))??1,this.getFiles()}get replacer(){return`[[${this.result.basename}]]`}get tooltip(){return`${this.original} +${this.result.basename}`}async roll(){return new Promise((e,t)=>{this.loaded?(this.result=this.links[this.getRandomBetween(0,this.links.length-1)],this.render(),this.trigger("new-result"),e(this.result)):this.on("loaded",()=>{this.result=this.links[this.getRandomBetween(0,this.links.length-1)],this.render(),this.trigger("new-result"),e(this.result)})})}async build(){this.resultEl.empty(),this.plugin.data.displayResultsInline&&this.resultEl.createSpan({text:this.inlineText});let e=this.resultEl.createEl("a",{cls:"internal-link",text:this.result.basename});e.onclick=async t=>{t.stopPropagation(),this.plugin.app.workspace.openLinkText(this.result.path,this.plugin.app.workspace.getActiveFile()?.path,t.getModifierState("Control"))},e.onmouseenter=async t=>{this.plugin.app.workspace.trigger("link-hover",this,e,this.result.path,this.plugin.app.workspace.getActiveFile()?.path)}}async getFiles(){if(!this.plugin.dataviewAPI){new s2.Notice("Dice Roller: Dataview must be installed and enabled to use tag rollers.");return}await this.plugin.dataviewReady();let e=await this.plugin.dataviewAPI.query(`list from ${this.tag}`);if(!e.successful)throw new Error(`No files found with that tag. Is the tag correct? + +`+this.tag);let t=new Set(e.value.values.reduce((i,a)=>(a.type=="file"&&i.push(a.path),i),[]));if(t&&t.delete(this.source),!t||!t.size)throw new Error(`No files found with that tag. Is the tag correct? + +`+this.tag);this.links=Array.from(t).map(i=>this.plugin.app.metadataCache.getFirstLinkpathDest(i,this.source)),this.loaded=!0,this.trigger("loaded")}toResult(){return{type:"link",result:this.result.path}}async applyResult(e){if(e.type==="link"){if(e.result){let t=this.plugin.app.vault.getAbstractFileByPath(e.result);t&&t instanceof s2.TFile&&(this.result=t)}await this.render()}}},l6=class extends P4{constructor(e,t,i,a,r=!0,s=e.data.showDice){super(e,t,i,a,s);this.plugin=e;this.original=t;this.lexeme=i;this.inline=r;this.containerEl.addClasses(["has-embed","markdown-embed"]),this.resultEl.addClass("internal-embed"),this.resultEl.setAttrs({src:a}),this.copy=this.containerEl.createDiv({cls:"dice-content-copy dice-roller-button no-show",attr:{"aria-label":"Copy Contents"}}),this.copy.addEventListener("click",o=>{o.stopPropagation(),navigator.clipboard.writeText(this.results.join(` +`)).then(async()=>{new s2.Notice("Result copied to clipboard.")})}),(0,s2.setIcon)(this.copy,Te)}get replacer(){return this.result}get tooltip(){return`${this.original} +${this.path}`}async build(){if(this.resultEl.empty(),this.plugin.data.displayResultsInline&&this.inline&&this.resultEl.createSpan({text:this.inlineText}),!this.results||!this.results.length){this.resultEl.createDiv({cls:"dice-no-results",text:"No results."});return}this.plugin.data.copyContentButton&&this.copy.removeClass("no-show");for(let e of this.results){this.resultEl.onclick=async i=>{if(i&&i.getModifierState("Control")||i.getModifierState("Meta")){i.stopPropagation();return}};let t=this.resultEl.createDiv({cls:"markdown-embed"});if(!e){t.createDiv({cls:"dice-no-results",text:"No results."});continue}if(s2.MarkdownRenderer.renderMarkdown(e,t.createDiv(),this.source,null),this.plugin.data.copyContentButton&&this.results.length>1){let i=t.createDiv({cls:"dice-content-copy dice-roller-button",attr:{"aria-label":"Copy Contents"}});i.addEventListener("click",a=>{a.stopPropagation(),navigator.clipboard.writeText(e).then(async()=>{new s2.Notice("Result copied to clipboard.")})}),(0,s2.setIcon)(i,Te)}}}async load(){await this.getOptions()}getPath(){let{groups:e}=this.lexeme.value.match(N0),{roll:t=1,link:i,types:a}=e;if(!i)throw new Error("Could not parse link.");this.rolls=(t&&!isNaN(Number(t))&&Number(t))??1,this.path=i.replace(/(\[|\])/g,""),this.types=a?.split(",")}async getOptions(){if(this.content=await this.plugin.app.vault.cachedRead(this.file),!this.content)throw new Error("Could not read file cache.");this.options=this.content.trim().split(` +`).map(e=>e.trim()).filter(e=>e&&e.length),this.loaded=!0,this.trigger("loaded")}async roll(){return new Promise((e,t)=>{if(!this.loaded)this.on("loaded",()=>{let i=[...this.options];this.results=[...Array(this.rolls)].map(()=>{let a=i[this.getRandomBetween(0,i.length-1)];return i.splice(i.indexOf(a),1),a}).filter(a=>a),this.render(),this.trigger("new-result"),e(this.results[0])});else{let i=[...this.options];this.results=[...Array(this.rolls)].map(()=>{let a=i[this.getRandomBetween(0,i.length-1)];return i.splice(i.indexOf(a),1),a}).filter(a=>a),this.render(),this.trigger("new-result"),e(this.results[0])}})}toResult(){return{type:"section",result:this.results}}async applyResult(e){e.type==="section"&&(e.result&&(this.results=e.result),await this.render())}},Aa=(n,e)=>n.start.col==e.start.col&&n.start.line==e.start.line&&n.start.offset==e.start.offset;var x4=w2(require("obsidian"));var wa=class{constructor(){this.result="";this.combinedTooltip=""}},I4=class extends P4{constructor(){super(...arguments);this.combinedTooltip="";this.prettyTooltip=""}getPath(){let{groups:e}=this.lexeme.value.match(ba),{diceRoll:t="1",link:i,block:a,header:r}=e;if(!i||!a)throw new Error("Could not parse link.");let s=t.match(/(\d*?)[Dd]$/);if(s){let[,o="1"]=s;this.rollsFormula=o}else this.rollsFormula=t;this.rolls=1,this.path=decodeURIComponent(i.replace(/(\[|\]|\(|\))/g,"")),this.block=a.replace(/(\^|#)/g,"").trim().toLowerCase(),this.header=r}get tooltip(){return this.prettyTooltip}get replacer(){return this.result}async build(){this.resultEl.empty();let e=[this.result];this.plugin.data.displayResultsInline&&e.unshift(this.inlineText);let t=createSpan();await x4.MarkdownRenderer.renderMarkdown(e.join(""),t,this.source,null);let i=this.resultEl.createSpan("embedded-table-result");t.childElementCount==1&&t.firstElementChild instanceof HTMLParagraphElement?i.append(...Array.from(t.firstElementChild.childNodes)):i.append(...Array.from(t.childNodes))}prettify(e){let t=/(.*?)(\(|\)|;|\|\|)(.*)/,i=" ",a=0,r="",s=e,o;for(;o=s.match(t);){let[,c,l,u]=o;r+=c,l==")"?(a--,r+=` +`,r+=i.repeat(a),r+=")"):(l=="("?(a++,r+="("):l==";"?r+=",":l=="||"&&(r+="|"),r+=` +`,r+=i.repeat(a)),s=u}return r+=s,r}async getSubResult(e){let t=new wa;typeof e=="number"?t.result=e.toString():t.result=e;let i=[];if(typeof e=="string"){let a=/(?:\`dice:)(.*?)(?:\`)/g,r=e.matchAll(a);for(let s of r){let o=s[1].trim(),c=await this.plugin.getRoller(o,this.source);await c.roll();let l=await this.getSubResult(c.result),u;if(l.result instanceof x4.TFile?u=l.result.basename:u=l.result,t.result=t.result.replace(s[0],u),c instanceof I4)i.push(c.combinedTooltip);else{let[f,h]=c.tooltip.split(` +`);i.push(f+" --> "+h)}}}return t.combinedTooltip=i.join(";"),t}async getResult(){let e=[],t=[],i=this.original;if(this.rollsFormula)try{let a=await this.plugin.getRoller(this.rollsFormula,this.source);if(!(a instanceof _2))return this.prettyTooltip="TableRoller only supports dice rolls to select multiple elements.",new x4.Notice(this.prettyTooltip),"ERROR";let r=a;await r.roll(),this.rolls=r.result,r.isStatic||(i=i.replace(this.rollsFormula,`${this.rollsFormula.trim()} --> ${r.resultText} > `))}catch{return this.prettyTooltip=`TableRoller: '${this.rollsFormula}' is not a valid dice roll.`,new x4.Notice(this.prettyTooltip),"ERROR"}for(let a=0;au[1]===void 0&&c===u[0]||c>=u[0]&&u[1]>=c);l&&(r=this.lookupRoller.original.trim()+" --> "+`${this.lookupRoller.resultText}${this.header?" | "+this.header:""}`.trim(),o=l[1])}else{let c=[...this.options],l=this.getRandomBetween(0,c.length-1);r=c.length+" rows --> [row "+(l+1)+"]",o=c[l]}s=await this.getSubResult(o),e.push(s.result),s.combinedTooltip&&(r+=" > ("+s.combinedTooltip+")"),t.push(r)}return t.length==0?this.combinedTooltip=i:t.length==1?this.combinedTooltip=i+" "+t.join(""):this.combinedTooltip=i+" ==> ("+t.join(" ||")+")",this.prettyTooltip=this.prettify(this.combinedTooltip),e.join("||")}async roll(){return new Promise(async e=>{this.loaded?(this.result=await this.getResult(),this.render(),this.trigger("new-result"),e(this.result)):this.on("loaded",async()=>{this.result=await this.getResult(),this.render(),this.trigger("new-result"),e(this.result)})})}async load(){await this.getOptions()}async getOptions(){if(this.cache=this.plugin.app.metadataCache.getFileCache(this.file),!this.cache||!this.cache.blocks||!(this.block in this.cache.blocks))throw new Error(`Could not read file cache. Does the block reference exist? + +${this.path} > ${this.block}`);let e=this.cache.sections?.find(t=>t.position==this.cache.blocks[this.block].position);if(this.position=this.cache.blocks[this.block].position,this.content=(await this.plugin.app.vault.cachedRead(this.file))?.slice(this.position.start.offset,this.position.end.offset),e&&e.type==="list")this.options=this.content.split(` +`);else{let t=Ic(this.content);if(Object.keys(t.columns).length===2&&/dice:\s*([\s\S]+)\s*?/.test(Object.keys(t.columns)[0])){let i=await this.plugin.getRoller(Object.keys(t.columns)[0].split(":").pop(),this.source);i instanceof _2&&(this.lookupRoller=i,this.lookupRanges=t.rows.map(a=>{let[r,s]=a.replace(/\\\|/g,"{ESCAPED_PIPE}").split("|").map(l=>l.replace(/{ESCAPED_PIPE}/g,"\\|")).map(l=>l.trim()),[,o,c]=r.match(/(\d+)(?:[^\d]+?(\d+))?/)??[];if(!(!o&&!c))return[[Number(o),c?Number(c):void 0],s]}),this.isLookup=!0)}if(this.header&&t.columns[this.header])this.options=t.columns[this.header];else{if(this.header)throw new Error(`Header ${this.header} was not found in table ${this.path} > ${this.block}.`);this.options=t.rows}}this.loaded=!0,this.trigger("loaded")}toResult(){return{type:"table",result:this.result}}async applyResult(e){e.type==="table"&&(e.result&&(this.result=e.result),await this.render())}},Pc=/^\|?([\s\S]+?)\|?$/,_a=/\|/g;function Ic(n){let e=n.split(` +`),i=e.map(s=>(s.trim().match(Pc)??[,s.trim()])[1])[0].replace("\\|","{ESCAPED_PIPE}").split(_a),a=[],r=[];for(let s in i){let o=i[s];o.trim().length||(o=s),r.push([o.trim(),[]])}for(let s of e.slice(2)){let o=s.trim().replace(/\\\|/g,"{ESCAPED_PIPE}").split(_a).map(c=>c.replace(/{ESCAPED_PIPE}/g,"\\|")).map(c=>c.trim()).filter(c=>c.length);a.push(o.join(" | "));for(let c in o){let l=o[c].trim();!l.length||!r[c]||r[c][1].push(l)}}return{columns:Object.fromEntries(r),rows:a}}var D1=w2(require("obsidian"));var u6=class extends D1.PluginSettingTab{constructor(e,t){super(e,t);this.plugin=t;this.plugin=t}async display(){let{containerEl:e}=this;e.empty(),e.addClass("dice-roller-settings"),e.createEl("h2",{text:"Dice Roller Settings"}),this.buildGenerics(e.createDiv()),this.buildDisplay(e.createDiv()),this.buildDice(e.createDiv()),this.buildTables(e.createDiv()),this.buildSections(e.createDiv()),this.buildTags(e.createDiv()),this.buildView(e.createDiv()),this.buildRender(e.createDiv()),this.buildFormulaSettings(e.createDiv("dice-roller-setting-additional-container")),e.createDiv("coffee").createEl("a",{href:"https://www.buymeacoffee.com/valentine195"}).createEl("img",{attr:{src:"https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=\u2615&slug=valentine195&button_colour=e3e7ef&font_colour=262626&font_family=Inter&outline_colour=262626&coffee_colour=ff0000"}})}buildGenerics(e){e.empty(),new D1.Setting(e).setName("Globally Save Results").setDesc(createFragment(t=>{t.createSpan({text:"Dice results will be saved by default. This can be overridden using "}),t.createEl("code",{text:"dice-: formula"}),t.createEl("p",{text:"Please note that the plugin will attempt to save the result but may not be able to."})})).addToggle(t=>{t.setValue(this.plugin.data.persistResults),t.onChange(async i=>{this.plugin.data.persistResults=i,await this.plugin.saveSettings()})})}buildDisplay(e){e.empty(),new D1.Setting(e).setHeading().setName("Dice Display"),new D1.Setting(e).setName("Display Formula With Results").setDesc("Both the formula and the results will both be displayed in preview mode.").addToggle(t=>{t.setValue(this.plugin.data.displayResultsInline),t.onChange(async i=>{this.plugin.data.displayResultsInline=i,await this.plugin.saveSettings()})}),new D1.Setting(e).setName("Display Dice Button With Results").setDesc("A dice button will appear next to results.").addToggle(t=>{t.setValue(this.plugin.data.showDice),t.onChange(async i=>{this.plugin.data.showDice=i,await this.plugin.saveSettings()})}),new D1.Setting(e).setName("Add Formula When Using Modify Dice").setDesc(createFragment(t=>{t.createSpan({text:"Both the formula and the results will both be added to the note when using "}),t.createEl("code",{text:"dice-mod"}),t.createSpan({text:"."})})).addToggle(t=>{t.setValue(this.plugin.data.displayFormulaForMod),t.onChange(async i=>{this.plugin.data.displayFormulaForMod=i,await this.plugin.saveSettings()})})}buildDice(e){e.empty(),new D1.Setting(e).setHeading().setName("Dice Rollers"),new D1.Setting(e).setName("Default Face").setDesc("Use this as the number of faces when it is omitted.").addText(t=>{t.setValue(`${this.plugin.data.defaultFace}`),t.inputEl.onblur=async()=>{isNaN(Number(t.inputEl.value))&&new D1.Notice("The default face must be a number."),this.plugin.data.defaultFace=Number(t.inputEl.value),await this.plugin.saveSettings()}}),new D1.Setting(e).setName("Round Results").setDesc("Determine the rounding behavior for dice results.").addDropdown(t=>{t.addOptions(de).setValue(this.plugin.data.round).onChange(i=>{this.plugin.data.round=i,this.plugin.saveSettings()})}),new D1.Setting(e).setName("Always Render Dice").setDesc(createFragment(t=>{t.createSpan({text:"Dice rolled in notes will always be rendered. Use the "}),t.createEl("code",{text:"|norender"}),t.createSpan({text:" flag to prevent it."})})).addToggle(t=>{t.setValue(this.plugin.data.renderAllDice).onChange(i=>{this.plugin.data.renderAllDice=i,this.plugin.saveSettings()})})}buildTables(e){e.empty(),new D1.Setting(e).setHeading().setName("Table Rollers"),new D1.Setting(e).setName("Display Lookup Table Roll").setDesc("Lookup table rolls will display the rolled number along with the result.").addToggle(t=>{t.setValue(this.plugin.data.displayLookupRoll),t.onChange(async i=>{this.plugin.data.displayLookupRoll=i,await this.plugin.saveSettings()})})}buildSections(e){e.empty(),new D1.Setting(e).setHeading().setName("Section Rollers"),new D1.Setting(e).setName("Add Copy Button to Section Results").setDesc("Randomly rolled sections will have a copy-content button to easy add result to clipboard.").addToggle(t=>{t.setValue(this.plugin.data.copyContentButton),t.onChange(async i=>{this.plugin.data.copyContentButton=i,await this.plugin.saveSettings()})})}buildTags(e){e.empty(),new D1.Setting(e).setHeading().setName("Tag Rollers"),new D1.Setting(e).setName("Roll All Files for Tags").setDesc("Return a result for each file when rolling tags.").addToggle(t=>{t.setValue(this.plugin.data.returnAllTags),t.onChange(async i=>{this.plugin.data.returnAllTags=i,await this.plugin.saveSettings()})}),new D1.Setting(e).setName("Always Return Links for Tags").setDesc("Enables random link rolling with the link parameter. Override by specifying a section type.").addToggle(t=>{t.setValue(this.plugin.data.rollLinksForTags),t.onChange(async i=>{this.plugin.data.rollLinksForTags=i,await this.plugin.saveSettings()})})}buildView(e){e.empty(),new D1.Setting(e).setHeading().setName("Dice View"),new D1.Setting(e).setName("Open Dice View on Startup").setDesc("The dice view can always be opened using the command from the command palette.").addToggle(t=>{t.setValue(this.plugin.data.showLeafOnStartup),t.onChange(async i=>{this.plugin.data.showLeafOnStartup=i,await this.plugin.saveSettings()})})}buildRender(e){e.empty(),new D1.Setting(e).setHeading().setName("Graphical Dice"),new D1.Setting(e).setName("Display graphics for Dice View Rolls").setDesc("Dice rolls from dice view will be displayed on screen.").addToggle(a=>{a.setValue(this.plugin.data.renderer),a.onChange(async r=>{this.plugin.data.renderer=r,await this.plugin.saveSettings()})}),new D1.Setting(e).setName("Display Time for Dice Graphics").setDesc("Rendered dice will stay on screen for this number of milliseconds. Leave blank to require a click to clear dice.").addText(a=>{a.inputEl.setAttr("type","number"),a.inputEl.onblur=r=>{Number(a.getValue())<0&&(new D1.Notice("Render time cannot be less than 0."),a.setValue("0"))},a.setValue(`${this.plugin.data.renderTime}`),a.onChange(async r=>{r&&Number(r)<0||isNaN(Number(r))||(this.plugin.data.renderTime=Number(r),await this.plugin.saveSettings())})}).addExtraButton(a=>{a.setIcon("reset").setTooltip("Reset to Default").onClick(async()=>{this.plugin.data.renderTime=h6.renderTime,await this.plugin.saveSettings(),this.buildRender(e)})}),new D1.Setting(e).setName("Dice Base Color").setDesc("Rendered dice will be this color.").controlEl.createEl("input",{type:"color",value:this.plugin.data.diceColor},a=>{a.value=this.plugin.data.diceColor,a.onchange=async({target:r})=>{let s=r.value;this.plugin.data.diceColor=s,await this.plugin.saveSettings(),this.plugin.app.workspace.trigger("dice-roller:update-colors")}}),new D1.Setting(e).setName("Dice Text Color").setDesc("Rendered dice will use this color for their numbers.").controlEl.createEl("input",{type:"color",value:this.plugin.data.textColor},a=>{a.value=this.plugin.data.textColor,a.onchange=async({target:r})=>{let s=r.value;!s||(this.plugin.data.textColor=s,await this.plugin.saveSettings(),this.plugin.app.workspace.trigger("dice-roller:update-colors"))}})}buildFormulaSettings(e){e.empty(),new D1.Setting(e).setHeading().setName("Saved Formulas");let t=e.createDiv();new D1.Setting(t).setName("Add Formula").setDesc("Add a new formula shortcut.").addButton(r=>r.setTooltip("Add Formula").setButtonText("+").onClick(async()=>{let o=await this.buildFormulaForm(t);o&&(this.plugin.data.formulas[o.alias]=o.formula,this.buildFormulaSettings(e),await this.plugin.saveSettings())}));let i=e.createDiv("additional"),a=this.plugin.data.formulas;for(let[r,s]of Object.entries(a)){let o=new D1.Setting(i).setName(r);o.controlEl.createSpan({text:s}),o.addExtraButton(c=>c.setIcon("pencil").setTooltip("Edit").onClick(async()=>{let l=await this.buildFormulaForm(t,{alias:r,formula:s});l&&(delete this.plugin.data.formulas[r],this.plugin.data.formulas[l.alias]=l.formula,this.buildFormulaSettings(e),await this.plugin.saveSettings())})).addExtraButton(c=>c.setIcon("trash").setTooltip("Delete").onClick(async()=>{delete this.plugin.data.formulas[r],await this.plugin.saveSettings(),this.buildFormulaSettings(e)}))}Object.values(a).length||i.createSpan({text:"Create a formula to see it here!",cls:"no-formulas"})}async buildFormulaForm(e,t={alias:null,formula:null}){return new Promise(i=>{let a=e.createDiv("add-new-formula"),r=a.createDiv("formula-data");new D1.Setting(r).setName("Alias").addText(o=>{o.setValue(t.alias).onChange(c=>t.alias=c)}),new D1.Setting(r).setName("Formula").addText(o=>{o.setValue(t.formula).onChange(c=>t.formula=c)});let s=a.createDiv("formula-buttons");new D1.Setting(s).addButton(o=>o.setCta().setButtonText("Save").onClick(async()=>{a.detach(),i(t)})).addExtraButton(o=>o.setIcon("cross").setTooltip("Cancel").onClick(()=>{a.detach(),i(null)}))})}};var E1=w2(require("obsidian"));var M4="DICE_ROLLER_VIEW",kc='',Uc='',Oc='',Gc='',qc='',Wc='',jc='';(0,E1.addIcon)("d4",kc);(0,E1.addIcon)("d6",Uc);(0,E1.addIcon)("d8",Oc);(0,E1.addIcon)("d10",Gc);(0,E1.addIcon)("d12",qc);(0,E1.addIcon)("d20",Wc);(0,E1.addIcon)("d100",jc);(0,E1.addIcon)("dice-roller-save",'');(0,E1.addIcon)("dice-roller-plus",'');(0,E1.addIcon)("dice-roller-minus",'');var Je=class extends E1.ItemView{constructor(e,t){super(t);this.plugin=e;this.leaf=t;this.dice=Je.DICE();this.custom="";this.adv=!1;this.dis=!1;this.add=0;this.contentEl.addClass("dice-roller-view"),this.registerEvent(this.plugin.app.workspace.on("dice-roller:update-colors",()=>{this.renderer.factory.updateColors()}))}static DICE(){return{d4:0,d6:0,d8:0,d10:0,d12:0,d20:0,d100:0}}get customFormulas(){return this.plugin.data.customFormulas}get renderer(){return this.plugin.renderer}async onOpen(){this.display()}async display(){this.contentEl.empty(),this.gridEl=this.contentEl.createDiv("dice-roller-grid"),this.formulaEl=this.contentEl.createDiv("dice-roller-formula");let e=this.contentEl.createDiv("dice-roller-results-container"),t=e.createDiv("dice-roller-results-header");t.createEl("h4",{text:"Results"}),new E1.ExtraButtonComponent(t.createDiv("clear-all")).setIcon("trash").setTooltip("Clear All").onClick(()=>{this.resultEl.empty(),this.resultEl.append(this.noResultsEl)}),this.resultEl=e.createDiv("dice-roller-results"),this.noResultsEl=this.resultEl.createSpan({text:"No results yet! Roll some dice to get started :)"}),this.buildButtons(),this.buildFormula()}buildButtons(){this.gridEl.empty();let e=this.gridEl.createDiv("dice-buttons");for(let o in this.dice){let c=new E1.ExtraButtonComponent(e.createDiv("dice-button")).setIcon(o);c.extraSettingsEl.onclick=async l=>{let u=l.getModifierState("Shift")?-1:1;this.dice[o]+=u,this.setFormula();let f=await this.plugin.getRoller(this.formulaComponent.inputEl.value,"view");f instanceof _2&&(this.stack=f)}}let t=this.gridEl.createDiv("advantage-disadvantage"),i=new E1.ButtonComponent(t).setButtonText("ADV").onClick(()=>{this.adv=!this.adv,this.dis=!1,this.adv?(i.setCta(),a.removeCta()):i.removeCta(),this.setFormula()}),a=new E1.ButtonComponent(t).setButtonText("DIS").onClick(()=>{this.dis=!this.dis,this.dis?(a.setCta(),i.removeCta()):a.removeCta(),this.adv=!1,this.setFormula()}),r=this.gridEl.createDiv("dice-context").createDiv("add-subtract");new E1.ExtraButtonComponent(r).setIcon("dice-roller-minus").onClick(()=>{this.add-=1,s.setValue(`${this.add}`),this.setFormula()});let s=new E1.TextComponent(r).setValue(`${this.add?this.add:""}`).onChange(o=>{isNaN(Number(o))||(this.add=Number(o)),this.setFormula()});if(new E1.ExtraButtonComponent(r).setIcon("dice-roller-plus").onClick(()=>{this.add+=1,s.setValue(`${this.add}`),this.setFormula()}),this.customFormulas.length){let o=this.gridEl.createDiv("dice-roller-results-container");o.createDiv("dice-roller-results-header").createEl("h4",{text:"Saved Formulas"});for(let l of this.customFormulas){let u=o.createDiv("dice-custom-formula-container"),f=u.createDiv("dice-custom-formula");new E1.ExtraButtonComponent(f).setIcon(De).setTooltip("Roll").onClick(()=>this.roll(l)),f.createSpan({text:l}),new E1.ExtraButtonComponent(u).setIcon("trash").setTooltip("Remove").onClick(()=>{this.plugin.data.customFormulas=this.plugin.data.customFormulas.filter(h=>h!=l),this.plugin.saveSettings(),this.buildButtons()})}}}async roll(e=this.formulaComponent.inputEl.value){if(!e)return;this.rollButton.setDisabled(!0);let t=await this.plugin.getRoller(e,"view");if(!(t instanceof _2)){new E1.Notice("The Dice View only supports dice rolls.");return}if(await t.roll(),!t.dice.length){new E1.Notice("Invalid formula.");return}try{this.plugin.data.renderer&&(this.addChild(this.renderer),this.renderer.setDice(t),await this.renderer.start(),t.recalculate())}catch(i){new E1.Notice("There was an error rendering the roll."),console.error(i)}this.rollButton.setDisabled(!1),this.addResult({result:t.result,original:t.original,resultText:t.resultText}),this.dice=Je.DICE(),this.add=null,this.adv=!1,this.dis=!1,this.buildButtons(),this.setFormula()}buildFormula(){this.formulaEl.empty(),this.formulaComponent=new E1.TextAreaComponent(this.formulaEl).setPlaceholder("Dice Formula"),this.formulaComponent.onChange((0,E1.debounce)(async t=>{},500,!0));let e=this.formulaEl.createDiv("action-buttons");this.saveButton=new E1.ButtonComponent(e).setIcon("plus-with-circle").setCta().setTooltip("Save Formula").onClick(()=>this.save()),this.saveButton.buttonEl.addClass("dice-roller-roll"),this.rollButton=new E1.ButtonComponent(e).setIcon(De).setCta().setTooltip("Roll").onClick(()=>this.roll()),this.rollButton.buttonEl.addClass("dice-roller-roll")}save(){!this.formulaComponent.inputEl.value||(this.plugin.data.customFormulas.push(this.formulaComponent.inputEl.value),this.buildButtons(),this.plugin.saveSettings())}addResult(e){this.noResultsEl&&this.noResultsEl.detach();let t=createDiv("view-result");t.createSpan({text:e.original}),t.createEl("strong",{text:`${e.result}`,attr:{"aria-label":e.resultText}});let i=t.createDiv("result-context");i.createEl("em",{text:new Date().toLocaleString()}),new E1.ExtraButtonComponent(i).setIcon("trash").onClick(()=>{t.detach(),this.resultEl.children.length===0&&this.resultEl.prepend(this.noResultsEl)}),new E1.ExtraButtonComponent(i).setIcon(Te).setTooltip("Copy Result").onClick(async()=>{await navigator.clipboard.writeText(`${e.result}`)}).extraSettingsEl.addClass("dice-content-copy"),new E1.ExtraButtonComponent(i).setIcon(De).setTooltip("Roll Again").onClick(()=>this.roll(e.original)).extraSettingsEl.addClass("dice-result-reroll"),this.resultEl.prepend(t)}get formulaString(){let e=[],t=Object.entries(this.dice).filter(([a,r])=>r!=0);if(!t.length)return"";t.sort((a,r)=>Number(r[0].slice(1))-Number(a[0].slice(1)));let i=t.shift();return e.push(`${i[1]}${i[0]}`),this.adv?e.push("kh"):this.dis&&e.push("dh"),t.length&&e.push(...t.map(([a,r])=>`${r>0?"+":"-"}${Math.abs(r)}${a}`)),this.add&&this.add!=0&&(e.push(this.add>0?"+":"-"),e.push(Math.abs(this.add))),e.join("")}setFormula(){this.formulaComponent.setValue(this.formulaString)}getDisplayText(){return"Dice Roller"}getViewType(){return M4}getIcon(){return De}async onClose(){await super.onClose(),this.renderer.unload()}};var Xt=w2(require("obsidian"));var S2=class{constructor(e=[0,0,0,0,0,0,0,0,0]){this.elements=void 0,this.elements=e}identity(){let e=this.elements;e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1}setZero(){let e=this.elements;e[0]=0,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=0,e[6]=0,e[7]=0,e[8]=0}setTrace(e){let t=this.elements;t[0]=e.x,t[4]=e.y,t[8]=e.z}getTrace(e=new y){let t=this.elements;return e.x=t[0],e.y=t[4],e.z=t[8],e}vmult(e,t=new y){let i=this.elements,a=e.x,r=e.y,s=e.z;return t.x=i[0]*a+i[1]*r+i[2]*s,t.y=i[3]*a+i[4]*r+i[5]*s,t.z=i[6]*a+i[7]*r+i[8]*s,t}smult(e){for(let t=0;t0){let r=1/a;this.x*=r,this.y*=r,this.z*=r}else this.x=0,this.y=0,this.z=0;return a}unit(e=new y){let t=this.x,i=this.y,a=this.z,r=Math.sqrt(t*t+i*i+a*a);return r>0?(r=1/r,e.x=t*r,e.y=i*r,e.z=a*r):(e.x=1,e.y=0,e.z=0),e}length(){let e=this.x,t=this.y,i=this.z;return Math.sqrt(e*e+t*t+i*i)}lengthSquared(){return this.dot(this)}distanceTo(e){let t=this.x,i=this.y,a=this.z,r=e.x,s=e.y,o=e.z;return Math.sqrt((r-t)*(r-t)+(s-i)*(s-i)+(o-a)*(o-a))}distanceSquared(e){let t=this.x,i=this.y,a=this.z,r=e.x,s=e.y,o=e.z;return(r-t)*(r-t)+(s-i)*(s-i)+(o-a)*(o-a)}scale(e,t=new y){let i=this.x,a=this.y,r=this.z;return t.x=e*i,t.y=e*a,t.z=e*r,t}vmul(e,t=new y){return t.x=e.x*this.x,t.y=e.y*this.y,t.z=e.z*this.z,t}addScaledVector(e,t,i=new y){return i.x=this.x+e*t.x,i.y=this.y+e*t.y,i.z=this.z+e*t.z,i}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}isZero(){return this.x===0&&this.y===0&&this.z===0}negate(e=new y){return e.x=-this.x,e.y=-this.y,e.z=-this.z,e}tangents(e,t){let i=this.length();if(i>0){let a=Zc,r=1/i;a.set(this.x*r,this.y*r,this.z*r);let s=Yc;Math.abs(a.x)<.9?(s.set(1,0,0),a.cross(s,e)):(s.set(0,1,0),a.cross(s,e)),a.cross(e,t)}else e.set(1,0,0),t.set(0,1,0)}toString(){return this.x+","+this.y+","+this.z}toArray(){return[this.x,this.y,this.z]}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}lerp(e,t,i){let a=this.x,r=this.y,s=this.z;i.x=a+(e.x-a)*t,i.y=r+(e.y-r)*t,i.z=s+(e.z-s)*t}almostEquals(e,t=1e-6){return!(Math.abs(this.x-e.x)>t||Math.abs(this.y-e.y)>t||Math.abs(this.z-e.z)>t)}almostZero(e=1e-6){return!(Math.abs(this.x)>e||Math.abs(this.y)>e||Math.abs(this.z)>e)}isAntiparallelTo(e,t){return this.negate(Sa),Sa.almostEquals(e,t)}clone(){return new y(this.x,this.y,this.z)}};y.ZERO=void 0;y.UNIT_X=void 0;y.UNIT_Y=void 0;y.UNIT_Z=void 0;y.ZERO=new y(0,0,0);y.UNIT_X=new y(1,0,0);y.UNIT_Y=new y(0,1,0);y.UNIT_Z=new y(0,0,1);var Zc=new y,Yc=new y,Sa=new y,E2=class{constructor(e={}){this.lowerBound=void 0,this.upperBound=void 0,this.lowerBound=new y,this.upperBound=new y,e.lowerBound&&this.lowerBound.copy(e.lowerBound),e.upperBound&&this.upperBound.copy(e.upperBound)}setFromPoints(e,t,i,a){let r=this.lowerBound,s=this.upperBound,o=i;r.copy(e[0]),o&&o.vmult(r,r),s.copy(r);for(let c=1;cs.x&&(s.x=l.x),l.xs.y&&(s.y=l.y),l.ys.z&&(s.z=l.z),l.z=r.x&&t.y<=a.y&&i.y>=r.y&&t.z<=a.z&&i.z>=r.z}getCorners(e,t,i,a,r,s,o,c){let l=this.lowerBound,u=this.upperBound;e.copy(l),t.set(u.x,l.y,l.z),i.set(u.x,u.y,l.z),a.set(l.x,u.y,u.z),r.set(u.x,l.y,u.z),s.set(l.x,u.y,l.z),o.set(l.x,l.y,u.z),c.copy(u)}toLocalFrame(e,t){let i=La,a=i[0],r=i[1],s=i[2],o=i[3],c=i[4],l=i[5],u=i[6],f=i[7];this.getCorners(a,r,s,o,c,l,u,f);for(let h=0;h!==8;h++){let m=i[h];e.pointToLocal(m,m)}return t.setFromPoints(i)}toWorldFrame(e,t){let i=La,a=i[0],r=i[1],s=i[2],o=i[3],c=i[4],l=i[5],u=i[6],f=i[7];this.getCorners(a,r,s,o,c,l,u,f);for(let h=0;h!==8;h++){let m=i[h];e.pointToWorld(m,m)}return t.setFromPoints(i)}overlapsRay(e){let{direction:t,from:i}=e,a=1/t.x,r=1/t.y,s=1/t.z,o=(this.lowerBound.x-i.x)*a,c=(this.upperBound.x-i.x)*a,l=(this.lowerBound.y-i.y)*r,u=(this.upperBound.y-i.y)*r,f=(this.lowerBound.z-i.z)*s,h=(this.upperBound.z-i.z)*s,m=Math.max(Math.max(Math.min(o,c),Math.min(l,u)),Math.min(f,h)),v=Math.min(Math.min(Math.max(o,c),Math.max(l,u)),Math.max(f,h));return!(v<0||m>v)}},Ea=new y,La=[new y,new y,new y,new y,new y,new y,new y,new y],B0=class{constructor(){this.matrix=void 0,this.matrix=[]}get(e,t){let{index:i}=e,{index:a}=t;if(a>i){let r=a;a=i,i=r}return this.matrix[(i*(i+1)>>1)+a-1]}set(e,t,i){let{index:a}=e,{index:r}=t;if(r>a){let s=r;r=a,a=s}this.matrix[(a*(a+1)>>1)+r-1]=i?1:0}reset(){for(let e=0,t=this.matrix.length;e!==t;e++)this.matrix[e]=0}setNumObjects(e){this.matrix.length=e*(e-1)>>1}},P0=class{constructor(){this._listeners=void 0}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let i=this._listeners;return i[e]===void 0&&(i[e]=[]),i[e].includes(t)||i[e].push(t),this}hasEventListener(e,t){if(this._listeners===void 0)return!1;let i=this._listeners;return!!(i[e]!==void 0&&i[e].includes(t))}hasAnyEventListener(e){return this._listeners===void 0?!1:this._listeners[e]!==void 0}removeEventListener(e,t){if(this._listeners===void 0)return this;let i=this._listeners;if(i[e]===void 0)return this;let a=i[e].indexOf(t);return a!==-1&&i[e].splice(a,1),this}dispatchEvent(e){if(this._listeners===void 0)return this;let i=this._listeners[e.type];if(i!==void 0){e.target=this;for(let a=0,r=i.length;a.499&&(i=2*Math.atan2(s,l),a=Math.PI/2,r=0),u<-.499&&(i=-2*Math.atan2(s,l),a=-Math.PI/2,r=0),i===void 0){let f=s*s,h=o*o,m=c*c;i=Math.atan2(2*o*l-2*s*c,1-2*h-2*m),a=Math.asin(2*u),r=Math.atan2(2*s*l-2*o*c,1-2*f-2*m)}break;default:throw new Error("Euler order "+t+" not supported yet.")}e.y=i,e.z=a,e.x=r}setFromEuler(e,t,i,a="XYZ"){let r=Math.cos(e/2),s=Math.cos(t/2),o=Math.cos(i/2),c=Math.sin(e/2),l=Math.sin(t/2),u=Math.sin(i/2);return a==="XYZ"?(this.x=c*s*o+r*l*u,this.y=r*l*o-c*s*u,this.z=r*s*u+c*l*o,this.w=r*s*o-c*l*u):a==="YXZ"?(this.x=c*s*o+r*l*u,this.y=r*l*o-c*s*u,this.z=r*s*u-c*l*o,this.w=r*s*o+c*l*u):a==="ZXY"?(this.x=c*s*o-r*l*u,this.y=r*l*o+c*s*u,this.z=r*s*u+c*l*o,this.w=r*s*o-c*l*u):a==="ZYX"?(this.x=c*s*o-r*l*u,this.y=r*l*o+c*s*u,this.z=r*s*u-c*l*o,this.w=r*s*o+c*l*u):a==="YZX"?(this.x=c*s*o+r*l*u,this.y=r*l*o+c*s*u,this.z=r*s*u-c*l*o,this.w=r*s*o-c*l*u):a==="XZY"&&(this.x=c*s*o-r*l*u,this.y=r*l*o-c*s*u,this.z=r*s*u+c*l*o,this.w=r*s*o+c*l*u),this}clone(){return new O1(this.x,this.y,this.z,this.w)}slerp(e,t,i=new O1){let a=this.x,r=this.y,s=this.z,o=this.w,c=e.x,l=e.y,u=e.z,f=e.w,h,m,v,g,x;return m=a*c+r*l+s*u+o*f,m<0&&(m=-m,c=-c,l=-l,u=-u,f=-f),1-m>1e-6?(h=Math.acos(m),v=Math.sin(h),g=Math.sin((1-t)*h)/v,x=Math.sin(t*h)/v):(g=1-t,x=t),i.x=g*a+x*c,i.y=g*r+x*l,i.z=g*s+x*u,i.w=g*o+x*f,i}integrate(e,t,i,a=new O1){let r=e.x*i.x,s=e.y*i.y,o=e.z*i.z,c=this.x,l=this.y,u=this.z,f=this.w,h=t*.5;return a.x+=h*(r*f+s*u-o*l),a.y+=h*(s*f+o*c-r*u),a.z+=h*(o*f+r*l-s*c),a.w+=h*(-r*c-s*l-o*u),a}},$c=new y,Kc=new y,Jc={SPHERE:1,PLANE:2,BOX:4,COMPOUND:8,CONVEXPOLYHEDRON:16,HEIGHTFIELD:32,PARTICLE:64,CYLINDER:128,TRIMESH:256},c1=class{constructor(e={}){this.id=void 0,this.type=void 0,this.boundingSphereRadius=void 0,this.collisionResponse=void 0,this.collisionFilterGroup=void 0,this.collisionFilterMask=void 0,this.material=void 0,this.body=void 0,this.id=c1.idCounter++,this.type=e.type||0,this.boundingSphereRadius=0,this.collisionResponse=e.collisionResponse?e.collisionResponse:!0,this.collisionFilterGroup=e.collisionFilterGroup!==void 0?e.collisionFilterGroup:1,this.collisionFilterMask=e.collisionFilterMask!==void 0?e.collisionFilterMask:-1,this.material=e.material?e.material:null,this.body=null}updateBoundingSphereRadius(){throw"computeBoundingSphereRadius() not implemented for shape type "+this.type}volume(){throw"volume() not implemented for shape type "+this.type}calculateLocalInertia(e,t){throw"calculateLocalInertia() not implemented for shape type "+this.type}calculateWorldAABB(e,t,i,a){throw"calculateWorldAABB() not implemented for shape type "+this.type}};c1.idCounter=0;c1.types=Jc;var N1=class{constructor(e={}){this.position=void 0,this.quaternion=void 0,this.position=new y,this.quaternion=new O1,e.position&&this.position.copy(e.position),e.quaternion&&this.quaternion.copy(e.quaternion)}pointToLocal(e,t){return N1.pointToLocalFrame(this.position,this.quaternion,e,t)}pointToWorld(e,t){return N1.pointToWorldFrame(this.position,this.quaternion,e,t)}vectorToWorldFrame(e,t=new y){return this.quaternion.vmult(e,t),t}static pointToLocalFrame(e,t,i,a=new y){return i.vsub(e,a),t.conjugate(Da),Da.vmult(a,a),a}static pointToWorldFrame(e,t,i,a=new y){return t.vmult(i,a),a.vadd(e,a),a}static vectorToWorldFrame(e,t,i=new y){return e.vmult(t,i),i}static vectorToLocalFrame(e,t,i,a=new y){return t.w*=-1,t.vmult(i,a),t.w*=-1,a}},Da=new O1,Qe=class extends c1{constructor(e={}){let{vertices:t=[],faces:i=[],normals:a=[],axes:r,boundingSphereRadius:s}=e;super({type:c1.types.CONVEXPOLYHEDRON});this.vertices=void 0,this.faces=void 0,this.faceNormals=void 0,this.worldVertices=void 0,this.worldVerticesNeedsUpdate=void 0,this.worldFaceNormals=void 0,this.worldFaceNormalsNeedsUpdate=void 0,this.uniqueAxes=void 0,this.uniqueEdges=void 0,this.vertices=t,this.faces=i,this.faceNormals=a,this.faceNormals.length===0&&this.computeNormals(),s?this.boundingSphereRadius=s:this.updateBoundingSphereRadius(),this.worldVertices=[],this.worldVerticesNeedsUpdate=!0,this.worldFaceNormals=[],this.worldFaceNormalsNeedsUpdate=!0,this.uniqueAxes=r?r.slice():null,this.uniqueEdges=[],this.computeEdges()}computeEdges(){let e=this.faces,t=this.vertices,i=this.uniqueEdges;i.length=0;let a=new y;for(let r=0;r!==e.length;r++){let s=e[r],o=s.length;for(let c=0;c!==o;c++){let l=(c+1)%o;t[s[c]].vsub(t[s[l]],a),a.normalize();let u=!1;for(let f=0;f!==i.length;f++)if(i[f].almostEquals(a)||i[f].almostEquals(a)){u=!0;break}u||i.push(a.clone())}}}computeNormals(){this.faceNormals.length=this.faces.length;for(let e=0;eh&&(h=g,f=v)}let m=[];for(let v=0;v=0&&this.clipFaceAgainstHull(s,e,t,m,o,c,l)}findSeparatingAxis(e,t,i,a,r,s,o,c){let l=new y,u=new y,f=new y,h=new y,m=new y,v=new y,g=Number.MAX_VALUE,x=this;if(x.uniqueAxes)for(let p=0;p!==x.uniqueAxes.length;p++){i.vmult(x.uniqueAxes[p],l);let d=x.testSepAxis(l,e,t,i,a,r);if(d===!1)return!1;d0&&s.negate(s),!0}testSepAxis(e,t,i,a,r,s){let o=this;Qe.project(o,e,i,a,I0),Qe.project(t,e,r,s,k0);let c=I0[0],l=I0[1],u=k0[0],f=k0[1];if(c0?1/t:0,this.material=e.material||null,this.linearDamping=typeof e.linearDamping=="number"?e.linearDamping:.01,this.type=t<=0?i1.STATIC:i1.DYNAMIC,typeof e.type==typeof i1.STATIC&&(this.type=e.type),this.allowSleep=typeof e.allowSleep!="undefined"?e.allowSleep:!0,this.sleepState=i1.AWAKE,this.sleepSpeedLimit=typeof e.sleepSpeedLimit!="undefined"?e.sleepSpeedLimit:.1,this.sleepTimeLimit=typeof e.sleepTimeLimit!="undefined"?e.sleepTimeLimit:1,this.timeLastSleepy=0,this.wakeUpAfterNarrowphase=!1,this.torque=new y,this.quaternion=new O1,this.initQuaternion=new O1,this.previousQuaternion=new O1,this.interpolatedQuaternion=new O1,e.quaternion&&(this.quaternion.copy(e.quaternion),this.initQuaternion.copy(e.quaternion),this.previousQuaternion.copy(e.quaternion),this.interpolatedQuaternion.copy(e.quaternion)),this.angularVelocity=new y,e.angularVelocity&&this.angularVelocity.copy(e.angularVelocity),this.initAngularVelocity=new y,this.shapes=[],this.shapeOffsets=[],this.shapeOrientations=[],this.inertia=new y,this.invInertia=new y,this.invInertiaWorld=new S2,this.invMassSolve=0,this.invInertiaSolve=new y,this.invInertiaWorldSolve=new S2,this.fixedRotation=typeof e.fixedRotation!="undefined"?e.fixedRotation:!1,this.angularDamping=typeof e.angularDamping!="undefined"?e.angularDamping:.01,this.linearFactor=new y(1,1,1),e.linearFactor&&this.linearFactor.copy(e.linearFactor),this.angularFactor=new y(1,1,1),e.angularFactor&&this.angularFactor.copy(e.angularFactor),this.aabb=new E2,this.aabbNeedsUpdate=!0,this.boundingRadius=0,this.wlambda=new y,this.isTrigger=Boolean(e.isTrigger),e.shape&&this.addShape(e.shape),this.updateMassProperties()}wakeUp(){let e=this.sleepState;this.sleepState=i1.AWAKE,this.wakeUpAfterNarrowphase=!1,e===i1.SLEEPING&&this.dispatchEvent(i1.wakeupEvent)}sleep(){this.sleepState=i1.SLEEPING,this.velocity.set(0,0,0),this.angularVelocity.set(0,0,0),this.wakeUpAfterNarrowphase=!1}sleepTick(e){if(this.allowSleep){let t=this.sleepState,i=this.velocity.lengthSquared()+this.angularVelocity.lengthSquared(),a=this.sleepSpeedLimit**2;t===i1.AWAKE&&ia?this.wakeUp():t===i1.SLEEPY&&e-this.timeLastSleepy>this.sleepTimeLimit&&(this.sleep(),this.dispatchEvent(i1.sleepEvent))}}updateSolveMassProperties(){this.sleepState===i1.SLEEPING||this.type===i1.KINEMATIC?(this.invMassSolve=0,this.invInertiaSolve.setZero(),this.invInertiaWorldSolve.setZero()):(this.invMassSolve=this.invMass,this.invInertiaSolve.copy(this.invInertia),this.invInertiaWorldSolve.copy(this.invInertiaWorld))}pointToLocalFrame(e,t=new y){return e.vsub(this.position,t),this.quaternion.conjugate().vmult(t,t),t}vectorToLocalFrame(e,t=new y){return this.quaternion.conjugate().vmult(e,t),t}pointToWorldFrame(e,t=new y){return this.quaternion.vmult(e,t),t.vadd(this.position,t),t}vectorToWorldFrame(e,t=new y){return this.quaternion.vmult(e,t),t}addShape(e,t,i){let a=new y,r=new O1;return t&&a.copy(t),i&&r.copy(i),this.shapes.push(e),this.shapeOffsets.push(a),this.shapeOrientations.push(r),this.updateMassProperties(),this.updateBoundingRadius(),this.aabbNeedsUpdate=!0,e.body=this,this}removeShape(e){let t=this.shapes.indexOf(e);return t===-1?(console.warn("Shape does not belong to the body"),this):(this.shapes.splice(t,1),this.shapeOffsets.splice(t,1),this.shapeOrientations.splice(t,1),this.updateMassProperties(),this.updateBoundingRadius(),this.aabbNeedsUpdate=!0,e.body=null,this)}updateBoundingRadius(){let e=this.shapes,t=this.shapeOffsets,i=e.length,a=0;for(let r=0;r!==i;r++){let s=e[r];s.updateBoundingSphereRadius();let o=t[r].length(),c=s.boundingSphereRadius;o+c>a&&(a=o+c)}this.boundingRadius=a}updateAABB(){let e=this.shapes,t=this.shapeOffsets,i=this.shapeOrientations,a=e.length,r=t7,s=i7,o=this.quaternion,c=this.aabb,l=a7;for(let u=0;u!==a;u++){let f=e[u];o.vmult(t[u],r),r.vadd(this.position,r),o.mult(i[u],s),f.calculateWorldAABB(r,s,l.lowerBound,l.upperBound),u===0?c.copy(l):c.extend(l)}this.aabbNeedsUpdate=!1}updateInertiaWorld(e){let t=this.invInertia;if(!(t.x===t.y&&t.y===t.z&&!e)){let i=r7,a=n7;i.setRotationFromQuaternion(this.quaternion),i.transpose(a),i.scale(t,i),i.mmult(a,this.invInertiaWorld)}}applyForce(e,t=new y){if(this.type!==i1.DYNAMIC)return;this.sleepState===i1.SLEEPING&&this.wakeUp();let i=s7;t.cross(e,i),this.force.vadd(e,this.force),this.torque.vadd(i,this.torque)}applyLocalForce(e,t=new y){if(this.type!==i1.DYNAMIC)return;let i=o7,a=c7;this.vectorToWorldFrame(e,i),this.vectorToWorldFrame(t,a),this.applyForce(i,a)}applyTorque(e){this.type===i1.DYNAMIC&&(this.sleepState===i1.SLEEPING&&this.wakeUp(),this.torque.vadd(e,this.torque))}applyImpulse(e,t=new y){if(this.type!==i1.DYNAMIC)return;this.sleepState===i1.SLEEPING&&this.wakeUp();let i=t,a=l7;a.copy(e),a.scale(this.invMass,a),this.velocity.vadd(a,this.velocity);let r=u7;i.cross(e,r),this.invInertiaWorld.vmult(r,r),this.angularVelocity.vadd(r,this.angularVelocity)}applyLocalImpulse(e,t=new y){if(this.type!==i1.DYNAMIC)return;let i=h7,a=f7;this.vectorToWorldFrame(e,i),this.vectorToWorldFrame(t,a),this.applyImpulse(i,a)}updateMassProperties(){let e=d7;this.invMass=this.mass>0?1/this.mass:0;let t=this.inertia,i=this.fixedRotation;this.updateAABB(),e.set((this.aabb.upperBound.x-this.aabb.lowerBound.x)/2,(this.aabb.upperBound.y-this.aabb.lowerBound.y)/2,(this.aabb.upperBound.z-this.aabb.lowerBound.z)/2),f6.calculateInertia(e,this.mass,t),this.invInertia.set(t.x>0&&!i?1/t.x:0,t.y>0&&!i?1/t.y:0,t.z>0&&!i?1/t.z:0),this.updateInertiaWorld(!0)}getVelocityAtWorldPoint(e,t){let i=new y;return e.vsub(this.position,i),this.angularVelocity.cross(i,t),this.velocity.vadd(t,t),t}integrate(e,t,i){if(this.previousPosition.copy(this.position),this.previousQuaternion.copy(this.quaternion),!(this.type===i1.DYNAMIC||this.type===i1.KINEMATIC)||this.sleepState===i1.SLEEPING)return;let a=this.velocity,r=this.angularVelocity,s=this.position,o=this.force,c=this.torque,l=this.quaternion,u=this.invMass,f=this.invInertiaWorld,h=this.linearFactor,m=u*e;a.x+=o.x*m*h.x,a.y+=o.y*m*h.y,a.z+=o.z*m*h.z;let v=f.elements,g=this.angularFactor,x=c.x*g.x,p=c.y*g.y,d=c.z*g.z;r.x+=e*(v[0]*x+v[1]*p+v[2]*d),r.y+=e*(v[3]*x+v[4]*p+v[5]*d),r.z+=e*(v[6]*x+v[7]*p+v[8]*d),s.x+=a.x*e,s.y+=a.y*e,s.z+=a.z*e,l.integrate(this.angularVelocity,e,this.angularFactor,l),t&&(i?l.normalizeFast():l.normalize()),this.aabbNeedsUpdate=!0,this.updateInertiaWorld()}};i1.idCounter=0;i1.COLLIDE_EVENT_NAME="collide";i1.DYNAMIC=U0.DYNAMIC;i1.STATIC=U0.STATIC;i1.KINEMATIC=U0.KINEMATIC;i1.AWAKE=O0.AWAKE;i1.SLEEPY=O0.SLEEPY;i1.SLEEPING=O0.SLEEPING;i1.wakeupEvent={type:"wakeup"};i1.sleepyEvent={type:"sleepy"};i1.sleepEvent={type:"sleep"};var t7=new y,i7=new O1,a7=new E2,r7=new S2,n7=new S2,s7=new y,o7=new y,c7=new y,l7=new y,u7=new y,h7=new y,f7=new y,d7=new y,Ta=class{constructor(){this.world=void 0,this.useBoundingBoxes=void 0,this.dirty=void 0,this.world=null,this.useBoundingBoxes=!1,this.dirty=!0}collisionPairs(e,t,i){throw new Error("collisionPairs not implemented for this BroadPhase class!")}needBroadphaseCollision(e,t){return!((e.collisionFilterGroup&t.collisionFilterMask)==0||(t.collisionFilterGroup&e.collisionFilterMask)==0||((e.type&i1.STATIC)!=0||e.sleepState===i1.SLEEPING)&&((t.type&i1.STATIC)!=0||t.sleepState===i1.SLEEPING))}intersectionTest(e,t,i,a){this.useBoundingBoxes?this.doBoundingBoxBroadphase(e,t,i,a):this.doBoundingSphereBroadphase(e,t,i,a)}doBoundingSphereBroadphase(e,t,i,a){let r=p7;t.position.vsub(e.position,r);let s=(e.boundingRadius+t.boundingRadius)**2;r.lengthSquared()i.lengthSquared()}aabbQuery(e,t,i){return console.warn(".aabbQuery is not implemented in this Broadphase subclass."),[]}},p7=new y,m7={keys:[]},v7=[],g7=[];var xf=new y,d6=class extends Ta{constructor(){super()}collisionPairs(e,t,i){let a=e.bodies,r=a.length,s,o;for(let c=0;c!==r;c++)for(let l=0;l!==c;l++)s=a[c],o=a[l],!!this.needBroadphaseCollision(s,o)&&this.intersectionTest(s,o,t,i)}aabbQuery(e,t,i=[]){for(let a=0;a{}}intersectWorld(e,t){return this.mode=t.mode||J1.ANY,this.result=t.result||new p6,this.skipBackfaces=!!t.skipBackfaces,this.collisionFilterMask=typeof t.collisionFilterMask!="undefined"?t.collisionFilterMask:-1,this.collisionFilterGroup=typeof t.collisionFilterGroup!="undefined"?t.collisionFilterGroup:-1,this.checkCollisionResponse=typeof t.checkCollisionResponse!="undefined"?t.checkCollisionResponse:!0,t.from&&this.from.copy(t.from),t.to&&this.to.copy(t.to),this.callback=t.callback||(()=>{}),this.hasHit=!1,this.result.reset(),this.updateDirection(),this.getAABB(Ia),q0.length=0,e.broadphase.aabbQuery(e,Ia,q0),this.intersectBodies(q0),this.hasHit}intersectBody(e,t){t&&(this.result=t,this.updateDirection());let i=this.checkCollisionResponse;if(i&&!e.collisionResponse||(this.collisionFilterGroup&e.collisionFilterMask)==0||(e.collisionFilterGroup&this.collisionFilterMask)==0)return;let a=x7,r=M7;for(let s=0,o=e.shapes.length;se.boundingSphereRadius)return;let o=this[e.type];o&&o.call(this,e,t,i,a,e)}_intersectBox(e,t,i,a,r){return this._intersectConvex(e.convexPolyhedronRepresentation,t,i,a,r)}_intersectPlane(e,t,i,a,r){let s=this.from,o=this.to,c=this.direction,l=new y(0,0,1);t.vmult(l,l);let u=new y;s.vsub(i,u);let f=u.dot(l);o.vsub(i,u);let h=u.dot(l);if(f*h>0||s.distanceTo(o)=0&&g<=1&&(s.lerp(o,g,m),m.vsub(i,v),v.normalize(),this.reportIntersection(v,m,r,a,-1)),this.result.shouldStop)return;x>=0&&x<=1&&(s.lerp(o,x,m),m.vsub(i,v),v.normalize(),this.reportIntersection(v,m,r,a,-1))}}_intersectConvex(e,t,i,a,r,s){let o=A7,c=Ua,l=s&&s.faceList||null,u=e.faces,f=e.vertices,h=e.faceNormals,m=this.direction,v=this.from,g=this.to,x=v.distanceTo(g),p=l?l.length:u.length,d=this.result;for(let A=0;!d.shouldStop&&Ax||this.reportIntersection(o,L2,r,a,b)}}}}_intersectTrimesh(e,t,i,a,r,s){let o=w7,c=T7,l=H7,u=Ua,f=_7,h=S7,m=E7,v=D7,g=L7,x=e.indices;e.vertices;let p=this.from,d=this.to,A=this.direction;l.position.copy(i),l.quaternion.copy(t),N1.vectorToLocalFrame(i,t,A,f),N1.pointToLocalFrame(i,t,p,h),N1.pointToLocalFrame(i,t,d,m),m.x*=e.scale.x,m.y*=e.scale.y,m.z*=e.scale.z,h.x*=e.scale.x,h.y*=e.scale.y,h.z*=e.scale.z,m.vsub(h,f),f.normalize();let b=h.distanceSquared(m);e.tree.rayQuery(this,l,c);for(let C=0,E=c.length;!this.result.shouldStop&&C!==E;C++){let T=c[C];e.getNormal(T,o),e.getVertex(x[T*3],Y2),Y2.vsub(h,u);let S=f.dot(o),P=o.dot(u)/S;if(P<0)continue;f.scale(P,L2),L2.vadd(h,L2),e.getVertex(x[T*3+1],me),e.getVertex(x[T*3+2],ve);let F=L2.distanceSquared(h);!(J1.pointInTriangle(L2,me,Y2,ve)||J1.pointInTriangle(L2,Y2,me,ve))||F>b||(N1.vectorToWorldFrame(t,o,g),N1.pointToWorldFrame(i,t,L2,v),this.reportIntersection(g,v,r,a,T))}c.length=0}reportIntersection(e,t,i,a,r){let s=this.from,o=this.to,c=s.distanceTo(t),l=this.result;if(!(this.skipBackfaces&&e.dot(this.direction)>0))switch(l.hitFaceIndex=typeof r!="undefined"?r:-1,this.mode){case J1.ALL:this.hasHit=!0,l.set(s,o,e,t,i,a,c),l.hasHit=!0,this.callback(l);break;case J1.CLOSEST:(c=0&&(f=r*l-s*o)>=0&&u+fT.maxForce&&(m=T.maxForce-x),A[E]+=m,v+=m>0?m:-m,T.addToWlambda(m)}if(v*ve;)t.pop();for(;t.length=0&&u.restitution>=0&&(o.restitution=l.restitution*u.restitution),o.si=r||i,o.sj=s||a,o}createFrictionEquationsFromContact(e,t){let i=e.bi,a=e.bj,r=e.si,s=e.sj,o=this.world,c=this.currentContactMaterial,l=c.friction,u=r.material||i.material,f=s.material||a.material;if(u&&f&&u.friction>=0&&f.friction>=0&&(l=u.friction*f.friction),l>0){let h=l*o.gravity.length(),m=i.invMass+a.invMass;m>0&&(m=1/m);let v=this.frictionEquationPool,g=v.length?v.pop():new Z0(i,a,h*m),x=v.length?v.pop():new Z0(i,a,h*m);return g.bi=x.bi=i,g.bj=x.bj=a,g.minForce=x.minForce=-h*m,g.maxForce=x.maxForce=h*m,g.ri.copy(e.ri),g.rj.copy(e.rj),x.ri.copy(e.ri),x.rj.copy(e.rj),e.ni.tangents(g.t,x.t),g.setSpookParams(c.frictionEquationStiffness,c.frictionEquationRelaxation,o.dt),x.setSpookParams(c.frictionEquationStiffness,c.frictionEquationRelaxation,o.dt),g.enabled=x.enabled=e.enabled,t.push(g,x),!0}return!1}createFrictionFromAverage(e){let t=this.result[this.result.length-1];if(!this.createFrictionEquationsFromContact(t,this.frictionResult)||e===1)return;let i=this.frictionResult[this.frictionResult.length-2],a=this.frictionResult[this.frictionResult.length-1];y4.setZero(),U4.setZero(),O4.setZero();let r=t.bi;t.bj;for(let o=0;o!==e;o++)t=this.result[this.result.length-1-o],t.bi!==r?(y4.vadd(t.ni,y4),U4.vadd(t.ri,U4),O4.vadd(t.rj,O4)):(y4.vsub(t.ni,y4),U4.vadd(t.rj,U4),O4.vadd(t.ri,O4));let s=1/e;U4.scale(s,i.ri),O4.scale(s,i.rj),a.ri.copy(i.ri),a.rj.copy(i.rj),y4.normalize(),y4.tangents(i.t,a.t)}getContacts(e,t,i,a,r,s,o){this.contactPointPool=r,this.frictionEquationPool=o,this.result=a,this.frictionResult=s;let c=$7,l=K7,u=Z7,f=Y7;for(let h=0,m=e.length;h!==m;h++){let v=e[h],g=t[h],x=null;v.material&&g.material&&(x=i.getContactMaterial(v.material,g.material)||null);let p=v.type&i1.KINEMATIC&&g.type&i1.STATIC||v.type&i1.STATIC&&g.type&i1.KINEMATIC||v.type&i1.KINEMATIC&&g.type&i1.KINEMATIC;for(let d=0;dA.boundingSphereRadius+C.boundingSphereRadius)continue;let E=null;A.material&&C.material&&(E=i.getContactMaterial(A.material,C.material)||null),this.currentContactMaterial=E||x||i.defaultContactMaterial;let T=A.type|C.type,S=this[T];if(S){let P=!1;A.type0){let W=yl,X=Cl;W.copy(m[(L+1)%3]),X.copy(m[(L+2)%3]);let Q=W.length(),a1=X.length();W.normalize(),X.normalize();let B=b6.dot(W),M1=b6.dot(X);if(B-Q&&M1-a1){let u1=Math.abs(O-Z-v);if((T===null||u1e.boundingSphereRadius+t.boundingSphereRadius)&&e.findSeparatingAxis(t,i,r,a,s,v,h,m)){let g=[],x=Gl;e.clipAgainstHull(i,r,t,a,s,v,-100,100,g);let p=0;for(let d=0;d!==g.length;d++){if(f)return!0;let A=this.createContactEquation(o,c,e,t,l,u),b=A.ri,C=A.rj;v.negate(A.ni),g[d].normal.negate(x),x.scale(g[d].depth,x),g[d].point.vadd(x,b),C.copy(g[d].point),b.vsub(i,b),C.vsub(a,C),b.vadd(i,b),b.vsub(o.position,b),C.vadd(a,C),C.vsub(c.position,C),this.result.push(A),p++,this.enableFrictionReduction||this.createFrictionEquationsFromContact(A,this.frictionResult)}this.enableFrictionReduction&&p&&this.createFrictionFromAverage(p)}}sphereConvex(e,t,i,a,r,s,o,c,l,u,f){let h=this.v3pool;i.vsub(a,El);let m=t.faceNormals,v=t.faces,g=t.vertices,x=e.radius,p=!1;for(let d=0;d!==g.length;d++){let A=g[d],b=Hl;s.vmult(A,b),a.vadd(b,b);let C=Tl;if(b.vsub(i,C),C.lengthSquared()0){let D=[];for(let z=0,H=C.length;z!==H;z++){let V=h.get();s.vmult(g[C[z]],V),a.vadd(V,V),D.push(V)}if(Ml(D,E,i)){if(f)return!0;p=!0;let z=this.createContactEquation(o,c,e,t,l,u);E.scale(-x,z.ri),E.negate(z.ni);let H=h.get();E.scale(-F,H);let V=h.get();E.scale(-x,V),i.vsub(a,z.rj),z.rj.vadd(V,z.rj),z.rj.vadd(H,z.rj),z.rj.vadd(a,z.rj),z.rj.vsub(c.position,z.rj),z.ri.vadd(i,z.ri),z.ri.vsub(o.position,z.ri),h.release(H),h.release(V),this.result.push(z),this.createFrictionEquationsFromContact(z,this.frictionResult);for(let L=0,N=D.length;L!==N;L++)h.release(D[L]);return}else for(let z=0;z!==C.length;z++){let H=h.get(),V=h.get();s.vmult(g[C[(z+1)%C.length]],H),s.vmult(g[C[(z+2)%C.length]],V),a.vadd(H,H),a.vadd(V,V);let L=Ll;V.vsub(H,L);let N=Dl;L.unit(N);let U=h.get(),Z=h.get();i.vsub(H,Z);let O=Z.dot(N);N.scale(O,U),U.vadd(H,U);let W=h.get();if(U.vsub(i,W),O>0&&O*Oh.length||A>h[0].length)return;p<0&&(p=0),d<0&&(d=0),A<0&&(A=0),b<0&&(b=0),p>=h.length&&(p=h.length-1),d>=h.length&&(d=h.length-1),b>=h[0].length&&(b=h[0].length-1),A>=h[0].length&&(A=h[0].length-1);let C=[];t.getRectMinMax(p,A,d,b,C);let E=C[0],T=C[1];if(x.z-m>T||x.z+m2)return}}boxHeightfield(e,t,i,a,r,s,o,c,l,u,f){return e.convexPolyhedronRepresentation.material=e.material,e.convexPolyhedronRepresentation.collisionResponse=e.collisionResponse,this.convexHeightfield(e.convexPolyhedronRepresentation,t,i,a,r,s,o,c,e,t,f)}convexHeightfield(e,t,i,a,r,s,o,c,l,u,f){let h=t.data,m=t.elementSize,v=e.boundingSphereRadius,g=Jl,x=Ql,p=Kl;N1.pointToLocalFrame(a,s,i,p);let d=Math.floor((p.x-v)/m)-1,A=Math.ceil((p.x+v)/m)+1,b=Math.floor((p.y-v)/m)-1,C=Math.ceil((p.y+v)/m)+1;if(A<0||C<0||d>h.length||b>h[0].length)return;d<0&&(d=0),A<0&&(A=0),b<0&&(b=0),C<0&&(C=0),d>=h.length&&(d=h.length-1),A>=h.length&&(A=h.length-1),C>=h[0].length&&(C=h[0].length-1),b>=h[0].length&&(b=h[0].length-1);let E=[];t.getRectMinMax(d,b,A,C,E);let T=E[0],S=E[1];if(!(p.z-v>S||p.z+v0&&V<0&&(x.vsub(h,p),g.copy(v),g.normalize(),L=p.dot(g),g.scale(L,p),p.vadd(h,p),p.distanceTo(x)0&&i===!0||u<=0&&i===!1){i===null&&(i=u>0);continue}else return!1}return!0}var b6=new y,bl=new y,yl=new y,Cl=new y,zl=[new y,new y,new y,new y,new y,new y],Al=new y,wl=new y,_l=new y,Sl=new y,El=new y,Ll=new y,Dl=new y,Tl=new y,Hl=new y,Vl=new y,Nl=new y,Rl=new y,Fl=new y,Bl=new y,Pl=new y,Il=new y,kl=new y,Ul=new y,Ol=new y,Gl=new y,ql=new y,Wl=new y,jl=new y,Xl=new y,Ar=new O1,Zl=new y,Yl=new y,wr=new y,$l=new y,Kl=new y,Jl=new y,Ql=[0],e9=new y,t9=new y,Y0=class{constructor(){this.current=void 0,this.previous=void 0,this.current=[],this.previous=[]}getKey(e,t){if(ta[r];)r++;if(i!==a[r]){for(let s=a.length-1;s>=r;s--)a[s+1]=a[s];a[r]=i}}tick(){let e=this.current;this.current=this.previous,this.previous=e,this.current.length=0}getDiff(e,t){let i=this.current,a=this.previous,r=i.length,s=a.length,o=0;for(let c=0;ca[o];)o++;l=u===a[o],l||_r(e,u)}o=0;for(let c=0;ci[o];)o++;l=i[o]===u,l||_r(t,u)}}};function _r(n,e){n.push((e&4294901760)>>16,e&65535)}var Sr=class{constructor(){this.data={keys:[]}}get(e,t){if(e>t){let i=t;t=e,e=i}return this.data[e+"-"+t]}set(e,t,i){if(e>t){let r=t;t=e,e=r}let a=e+"-"+t;this.get(e,t)||this.data.keys.push(a),this.data[a]=i}reset(){let e=this.data,t=e.keys;for(;t.length>0;){let i=t.pop();delete e[i]}}},$0=class extends P0{constructor(e={}){super();this.dt=void 0,this.allowSleep=void 0,this.contacts=void 0,this.frictionEquations=void 0,this.quatNormalizeSkip=void 0,this.quatNormalizeFast=void 0,this.time=void 0,this.stepnumber=void 0,this.default_dt=void 0,this.nextId=void 0,this.gravity=void 0,this.broadphase=void 0,this.bodies=void 0,this.hasActiveBodies=void 0,this.solver=void 0,this.constraints=void 0,this.narrowphase=void 0,this.collisionMatrix=void 0,this.collisionMatrixPrevious=void 0,this.bodyOverlapKeeper=void 0,this.shapeOverlapKeeper=void 0,this.materials=void 0,this.contactmaterials=void 0,this.contactMaterialTable=void 0,this.defaultMaterial=void 0,this.defaultContactMaterial=void 0,this.doProfiling=void 0,this.profile=void 0,this.accumulator=void 0,this.subsystems=void 0,this.addBodyEvent=void 0,this.removeBodyEvent=void 0,this.idToBodyMap=void 0,this.dt=-1,this.allowSleep=!!e.allowSleep,this.contacts=[],this.frictionEquations=[],this.quatNormalizeSkip=e.quatNormalizeSkip!==void 0?e.quatNormalizeSkip:0,this.quatNormalizeFast=e.quatNormalizeFast!==void 0?e.quatNormalizeFast:!1,this.time=0,this.stepnumber=0,this.default_dt=1/60,this.nextId=0,this.gravity=new y,e.gravity&&this.gravity.copy(e.gravity),this.broadphase=e.broadphase!==void 0?e.broadphase:new d6,this.bodies=[],this.hasActiveBodies=!1,this.solver=e.solver!==void 0?e.solver:new Za,this.constraints=[],this.narrowphase=new Cr(this),this.collisionMatrix=new B0,this.collisionMatrixPrevious=new B0,this.bodyOverlapKeeper=new Y0,this.shapeOverlapKeeper=new Y0,this.materials=[],this.contactmaterials=[],this.contactMaterialTable=new Sr,this.defaultMaterial=new Ve("default"),this.defaultContactMaterial=new He(this.defaultMaterial,this.defaultMaterial,{friction:.3,restitution:0}),this.doProfiling=!1,this.profile={solve:0,makeContactConstraints:0,broadphase:0,integrate:0,narrowphase:0},this.accumulator=0,this.subsystems=[],this.addBodyEvent={type:"addBody",body:null},this.removeBodyEvent={type:"removeBody",body:null},this.idToBodyMap={},this.broadphase.setWorld(this)}getContactMaterial(e,t){return this.contactMaterialTable.get(e.id,t.id)}numObjects(){return this.bodies.length}collisionMatrixTick(){let e=this.collisionMatrixPrevious;this.collisionMatrixPrevious=this.collisionMatrix,this.collisionMatrix=e,this.collisionMatrix.reset(),this.bodyOverlapKeeper.tick(),this.shapeOverlapKeeper.tick()}addConstraint(e){this.constraints.push(e)}removeConstraint(e){let t=this.constraints.indexOf(e);t!==-1&&this.constraints.splice(t,1)}rayTest(e,t,i){i instanceof p6?this.raycastClosest(e,t,{skipBackfaces:!0},i):this.raycastAll(e,t,{skipBackfaces:!0},i)}raycastAll(e,t,i={},a){return i.mode=J1.ALL,i.from=e,i.to=t,i.callback=a,K0.intersectWorld(this,i)}raycastAny(e,t,i={},a){return i.mode=J1.ANY,i.from=e,i.to=t,i.result=a,K0.intersectWorld(this,i)}raycastClosest(e,t,i={},a){return i.mode=J1.CLOSEST,i.from=e,i.to=t,i.result=a,K0.intersectWorld(this,i)}addBody(e){this.bodies.includes(e)||(e.index=this.bodies.length,this.bodies.push(e),e.world=this,e.initPosition.copy(e.position),e.initVelocity.copy(e.velocity),e.timeLastSleepy=this.time,e instanceof i1&&(e.initAngularVelocity.copy(e.angularVelocity),e.initQuaternion.copy(e.quaternion)),this.collisionMatrix.setNumObjects(this.bodies.length),this.addBodyEvent.body=e,this.idToBodyMap[e.id]=e,this.dispatchEvent(this.addBodyEvent))}removeBody(e){e.world=null;let t=this.bodies.length-1,i=this.bodies,a=i.indexOf(e);if(a!==-1){i.splice(a,1);for(let r=0;r!==i.length;r++)i[r].index=r;this.collisionMatrix.setNumObjects(t),this.removeBodyEvent.body=e,delete this.idToBodyMap[e.id],this.dispatchEvent(this.removeBodyEvent)}}getBodyById(e){return this.idToBodyMap[e]}getShapeById(e){let t=this.bodies;for(let i=0;i=e&&re*1e3)););this.accumulator=this.accumulator%e;let s=this.accumulator/e;for(let o=0;o!==this.bodies.length;o++){let c=this.bodies[o];c.previousPosition.lerp(c.position,s,c.interpolatedPosition),c.previousQuaternion.slerp(c.quaternion,s,c.interpolatedQuaternion),c.previousQuaternion.normalize()}this.time+=t}}internalStep(e){this.dt=e;let t=this.contacts,i=s9,a=o9,r=this.numObjects(),s=this.bodies,o=this.solver,c=this.gravity,l=this.doProfiling,u=this.profile,f=i1.DYNAMIC,h=-1/0,m=this.constraints,v=n9;c.length();let g=c.x,x=c.y,p=c.z,d=0;for(l&&(h=o2.now()),d=0;d!==r;d++){let z=s[d];if(z.type===f){let H=z.force,V=z.mass;H.x+=V*g,H.y+=V*x,H.z+=V*p}}for(let z=0,H=this.subsystems.length;z!==H;z++)this.subsystems[z].update();l&&(h=o2.now()),i.length=0,a.length=0,this.broadphase.collisionPairs(this,i,a),l&&(u.broadphase=o2.now()-h);let A=m.length;for(d=0;d!==A;d++){let z=m[d];if(!z.collideConnected)for(let H=i.length-1;H>=0;H-=1)(z.bodyA===i[H]&&z.bodyB===a[H]||z.bodyB===i[H]&&z.bodyA===a[H])&&(i.splice(H,1),a.splice(H,1))}this.collisionMatrixTick(),l&&(h=o2.now());let b=r9,C=t.length;for(d=0;d!==C;d++)b.push(t[d]);t.length=0;let E=this.frictionEquations.length;for(d=0;d!==E;d++)v.push(this.frictionEquations[d]);for(this.frictionEquations.length=0,this.narrowphase.getContacts(i,a,this,t,b,this.frictionEquations,v),l&&(u.narrowphase=o2.now()-h),l&&(h=o2.now()),d=0;d=0&&L.material.friction>=0&&V.material.friction*L.material.friction,V.material.restitution>=0&&L.material.restitution>=0&&(H.restitution=V.material.restitution*L.material.restitution)),o.addEquation(H),V.allowSleep&&V.type===i1.DYNAMIC&&V.sleepState===i1.SLEEPING&&L.sleepState===i1.AWAKE&&L.type!==i1.STATIC){let O=L.velocity.lengthSquared()+L.angularVelocity.lengthSquared(),W=L.sleepSpeedLimit**2;O>=W*2&&(V.wakeUpAfterNarrowphase=!0)}if(L.allowSleep&&L.type===i1.DYNAMIC&&L.sleepState===i1.SLEEPING&&V.sleepState===i1.AWAKE&&V.type!==i1.STATIC){let O=V.velocity.lengthSquared()+V.angularVelocity.lengthSquared(),W=V.sleepSpeedLimit**2;O>=W*2&&(L.wakeUpAfterNarrowphase=!0)}this.collisionMatrix.set(V,L,!0),this.collisionMatrixPrevious.get(V,L)||(At.body=L,At.contact=H,V.dispatchEvent(At),At.body=V,L.dispatchEvent(At)),this.bodyOverlapKeeper.set(V.id,L.id),this.shapeOverlapKeeper.set(N.id,U.id)}for(this.emitContactEvents(),l&&(u.makeContactConstraints=o2.now()-h,h=o2.now()),d=0;d!==r;d++){let z=s[d];z.wakeUpAfterNarrowphase&&(z.wakeUp(),z.wakeUpAfterNarrowphase=!1)}for(A=m.length,d=0;d!==A;d++){let z=m[d];z.update();for(let H=0,V=z.equations.length;H!==V;H++){let L=z.equations[H];o.addEquation(L)}}o.solve(e,this),l&&(u.solve=o2.now()-h),o.removeAllEquations();let S=Math.pow;for(d=0;d!==r;d++){let z=s[d];if(z.type&f){let H=S(1-z.linearDamping,e),V=z.velocity;V.scale(H,V);let L=z.angularVelocity;if(L){let N=S(1-z.angularDamping,e);L.scale(N,L)}}}for(this.dispatchEvent(a9),d=0;d!==r;d++){let z=s[d];z.preStep&&z.preStep.call(z)}l&&(h=o2.now());let F=this.stepnumber%(this.quatNormalizeSkip+1)==0,M=this.quatNormalizeFast;for(d=0;d!==r;d++)s[d].integrate(e,F,M);for(this.clearForces(),this.broadphase.dirty=!0,l&&(u.integrate=o2.now()-h),this.stepnumber+=1,this.dispatchEvent(i9),d=0;d!==r;d++){let z=s[d],H=z.postStep;H&&H.call(z)}let D=!0;if(this.allowSleep)for(D=!1,d=0;d!==r;d++){let z=s[d];z.sleepTick(this.time),z.sleepState!==i1.SLEEPING&&(D=!0)}this.hasActiveBodies=D}emitContactEvents(){let e=this.hasAnyEventListener("beginContact"),t=this.hasAnyEventListener("endContact");if((e||t)&&this.bodyOverlapKeeper.getDiff(Re,Fe),e){for(let r=0,s=Re.length;rDate.now()-n}var i9={type:"postStep"},a9={type:"preStep"},At={type:i1.COLLIDE_EVENT_NAME,body:null,contact:null},r9=[],n9=[],s9=[],o9=[],Re=[],Fe=[],wt={type:"beginContact",bodyA:null,bodyB:null},_t={type:"endContact",bodyA:null,bodyB:null},Be={type:"beginShapeContact",bodyA:null,bodyB:null,shapeA:null,shapeB:null},Pe={type:"endShapeContact",bodyA:null,bodyB:null,shapeA:null,shapeB:null};var q1=class{constructor(e=0,t=0,i=0,a=1){this.x=e,this.y=t,this.z=i,this.w=a}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,a){return this.x=e,this.y=t,this.z=i,this.w=a,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e,t){return t!==void 0?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e,t){return t!==void 0?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,i=this.y,a=this.z,r=this.w,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*a+s[12]*r,this.y=s[1]*t+s[5]*i+s[9]*a+s[13]*r,this.z=s[2]*t+s[6]*i+s[10]*a+s[14]*r,this.w=s[3]*t+s[7]*i+s[11]*a+s[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,a,r,s=.01,o=.1,c=e.elements,l=c[0],u=c[4],f=c[8],h=c[1],m=c[5],v=c[9],g=c[2],x=c[6],p=c[10];if(Math.abs(u-h)b&&A>C?AC?b>8&255]+d2[n>>16&255]+d2[n>>24&255]+"-"+d2[e&255]+d2[e>>8&255]+"-"+d2[e>>16&15|64]+d2[e>>24&255]+"-"+d2[t&63|128]+d2[t>>8&255]+"-"+d2[t>>16&255]+d2[t>>24&255]+d2[i&255]+d2[i>>8&255]+d2[i>>16&255]+d2[i>>24&255]).toUpperCase()}function D2(n,e,t){return Math.max(e,Math.min(t,n))}function Er(n,e){return(n%e+e)%e}function C6(n,e,t){return(1-t)*n+t*e}function J0(n){return(n&n-1)==0&&n!==0}function Lr(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}var xe=class{constructor(e=0,t=0,i=0,a=1){this._x=e,this._y=t,this._z=i,this._w=a}static slerp(e,t,i,a){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),i.slerpQuaternions(e,t,a)}static slerpFlat(e,t,i,a,r,s,o){let c=i[a+0],l=i[a+1],u=i[a+2],f=i[a+3],h=r[s+0],m=r[s+1],v=r[s+2],g=r[s+3];if(o===0){e[t+0]=c,e[t+1]=l,e[t+2]=u,e[t+3]=f;return}if(o===1){e[t+0]=h,e[t+1]=m,e[t+2]=v,e[t+3]=g;return}if(f!==g||c!==h||l!==m||u!==v){let x=1-o,p=c*h+l*m+u*v+f*g,d=p>=0?1:-1,A=1-p*p;if(A>Number.EPSILON){let C=Math.sqrt(A),E=Math.atan2(C,p*d);x=Math.sin(x*E)/C,o=Math.sin(o*E)/C}let b=o*d;if(c=c*x+h*b,l=l*x+m*b,u=u*x+v*b,f=f*x+g*b,x===1-o){let C=1/Math.sqrt(c*c+l*l+u*u+f*f);c*=C,l*=C,u*=C,f*=C}}e[t]=c,e[t+1]=l,e[t+2]=u,e[t+3]=f}static multiplyQuaternionsFlat(e,t,i,a,r,s){let o=i[a],c=i[a+1],l=i[a+2],u=i[a+3],f=r[s],h=r[s+1],m=r[s+2],v=r[s+3];return e[t]=o*v+u*f+c*m-l*h,e[t+1]=c*v+u*h+l*f-o*m,e[t+2]=l*v+u*m+o*h-c*f,e[t+3]=u*v-o*f-c*h-l*m,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,a){return this._x=e,this._y=t,this._z=i,this._w=a,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){if(!(e&&e.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");let i=e._x,a=e._y,r=e._z,s=e._order,o=Math.cos,c=Math.sin,l=o(i/2),u=o(a/2),f=o(r/2),h=c(i/2),m=c(a/2),v=c(r/2);switch(s){case"XYZ":this._x=h*u*f+l*m*v,this._y=l*m*f-h*u*v,this._z=l*u*v+h*m*f,this._w=l*u*f-h*m*v;break;case"YXZ":this._x=h*u*f+l*m*v,this._y=l*m*f-h*u*v,this._z=l*u*v-h*m*f,this._w=l*u*f+h*m*v;break;case"ZXY":this._x=h*u*f-l*m*v,this._y=l*m*f+h*u*v,this._z=l*u*v+h*m*f,this._w=l*u*f-h*m*v;break;case"ZYX":this._x=h*u*f-l*m*v,this._y=l*m*f+h*u*v,this._z=l*u*v-h*m*f,this._w=l*u*f+h*m*v;break;case"YZX":this._x=h*u*f+l*m*v,this._y=l*m*f+h*u*v,this._z=l*u*v-h*m*f,this._w=l*u*f-h*m*v;break;case"XZY":this._x=h*u*f-l*m*v,this._y=l*m*f-h*u*v,this._z=l*u*v+h*m*f,this._w=l*u*f+h*m*v;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let i=t/2,a=Math.sin(i);return this._x=e.x*a,this._y=e.y*a,this._z=e.z*a,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,i=t[0],a=t[4],r=t[8],s=t[1],o=t[5],c=t[9],l=t[2],u=t[6],f=t[10],h=i+o+f;if(h>0){let m=.5/Math.sqrt(h+1);this._w=.25/m,this._x=(u-c)*m,this._y=(r-l)*m,this._z=(s-a)*m}else if(i>o&&i>f){let m=2*Math.sqrt(1+i-o-f);this._w=(u-c)/m,this._x=.25*m,this._y=(a+s)/m,this._z=(r+l)/m}else if(o>f){let m=2*Math.sqrt(1+o-i-f);this._w=(r-l)/m,this._x=(a+s)/m,this._y=.25*m,this._z=(c+u)/m}else{let m=2*Math.sqrt(1+f-i-o);this._w=(s-a)/m,this._x=(r+l)/m,this._y=(c+u)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return iMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(D2(this.dot(e),-1,1)))}rotateTowards(e,t){let i=this.angleTo(e);if(i===0)return this;let a=Math.min(1,t/i);return this.slerp(e,a),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e,t){return t!==void 0?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let i=e._x,a=e._y,r=e._z,s=e._w,o=t._x,c=t._y,l=t._z,u=t._w;return this._x=i*u+s*o+a*l-r*c,this._y=a*u+s*c+r*o-i*l,this._z=r*u+s*l+i*c-a*o,this._w=s*u-i*o-a*c-r*l,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);let i=this._x,a=this._y,r=this._z,s=this._w,o=s*e._w+i*e._x+a*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=s,this._x=i,this._y=a,this._z=r,this;let c=1-o*o;if(c<=Number.EPSILON){let m=1-t;return this._w=m*s+t*this._w,this._x=m*i+t*this._x,this._y=m*a+t*this._y,this._z=m*r+t*this._z,this.normalize(),this._onChangeCallback(),this}let l=Math.sqrt(c),u=Math.atan2(l,o),f=Math.sin((1-t)*u)/l,h=Math.sin(t*u)/l;return this._w=s*f+this._w*h,this._x=i*f+this._x*h,this._y=a*f+this._y*h,this._z=r*f+this._z*h,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){let e=Math.random(),t=Math.sqrt(1-e),i=Math.sqrt(e),a=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(t*Math.cos(a),i*Math.sin(r),i*Math.cos(r),t*Math.sin(a))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}};xe.prototype.isQuaternion=!0;var k=class{constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e,t){return t!==void 0?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e,t){return t!==void 0?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e,t){return t!==void 0?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Dr.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Dr.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,i=this.y,a=this.z,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6]*a,this.y=r[1]*t+r[4]*i+r[7]*a,this.z=r[2]*t+r[5]*i+r[8]*a,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,i=this.y,a=this.z,r=e.elements,s=1/(r[3]*t+r[7]*i+r[11]*a+r[15]);return this.x=(r[0]*t+r[4]*i+r[8]*a+r[12])*s,this.y=(r[1]*t+r[5]*i+r[9]*a+r[13])*s,this.z=(r[2]*t+r[6]*i+r[10]*a+r[14])*s,this}applyQuaternion(e){let t=this.x,i=this.y,a=this.z,r=e.x,s=e.y,o=e.z,c=e.w,l=c*t+s*a-o*i,u=c*i+o*t-r*a,f=c*a+r*i-s*t,h=-r*t-s*i-o*a;return this.x=l*c+h*-r+u*-o-f*-s,this.y=u*c+h*-s+f*-r-l*-o,this.z=f*c+h*-o+l*-s-u*-r,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,i=this.y,a=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*a,this.y=r[1]*t+r[5]*i+r[9]*a,this.z=r[2]*t+r[6]*i+r[10]*a,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e,t){return t!==void 0?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)}crossVectors(e,t){let i=e.x,a=e.y,r=e.z,s=t.x,o=t.y,c=t.z;return this.x=a*c-r*o,this.y=r*s-i*c,this.z=i*o-a*s,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Q0.copy(this).projectOnVector(e),this.sub(Q0)}reflect(e){return this.sub(Q0.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let i=this.dot(e)/t;return Math.acos(D2(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y,a=this.z-e.z;return t*t+i*i+a*a}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){let a=Math.sin(t)*e;return this.x=a*Math.sin(i),this.y=Math.cos(t)*e,this.z=a*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),a=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=a,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t,i){return i!==void 0&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(t),this.y=i*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};k.prototype.isVector3=!0;var Q0=new k,Dr=new xe;var z1=class{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e,t){return t!==void 0?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e,t){return t!==void 0?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,i=this.y,a=e.elements;return this.x=a[0]*t+a[3]*i+a[6],this.y=a[1]*t+a[4]*i+a[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t,i){return i!==void 0&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let i=Math.cos(t),a=Math.sin(t),r=this.x-e.x,s=this.y-e.y;return this.x=r*i-s*a+e.x,this.y=r*a+s*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};z1.prototype.isVector2=!0;var Tr={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},$2={h:0,s:0,l:0},z6={h:0,s:0,l:0};function e3(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}function C4(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function t3(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}var x1=class{constructor(e,t,i){return t===void 0&&i===void 0?this.set(e):this.setRGB(e,t,i)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,this}setRGB(e,t,i){return this.r=e,this.g=t,this.b=i,this}setHSL(e,t,i){if(e=Er(e,1),t=D2(t,0,1),i=D2(i,0,1),t===0)this.r=this.g=this.b=i;else{let a=i<=.5?i*(1+t):i+t-i*t,r=2*i-a;this.r=e3(r,a,e+1/3),this.g=e3(r,a,e),this.b=e3(r,a,e-1/3)}return this}setStyle(e){function t(a){a!==void 0&&parseFloat(a)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let a,r=i[1],s=i[2];switch(r){case"rgb":case"rgba":if(a=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.r=Math.min(255,parseInt(a[1],10))/255,this.g=Math.min(255,parseInt(a[2],10))/255,this.b=Math.min(255,parseInt(a[3],10))/255,t(a[4]),this;if(a=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.r=Math.min(100,parseInt(a[1],10))/100,this.g=Math.min(100,parseInt(a[2],10))/100,this.b=Math.min(100,parseInt(a[3],10))/100,t(a[4]),this;break;case"hsl":case"hsla":if(a=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s)){let o=parseFloat(a[1])/360,c=parseInt(a[2],10)/100,l=parseInt(a[3],10)/100;return t(a[4]),this.setHSL(o,c,l)}break}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){let a=i[1],r=a.length;if(r===3)return this.r=parseInt(a.charAt(0)+a.charAt(0),16)/255,this.g=parseInt(a.charAt(1)+a.charAt(1),16)/255,this.b=parseInt(a.charAt(2)+a.charAt(2),16)/255,this;if(r===6)return this.r=parseInt(a.charAt(0)+a.charAt(1),16)/255,this.g=parseInt(a.charAt(2)+a.charAt(3),16)/255,this.b=parseInt(a.charAt(4)+a.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this}setColorName(e){let t=Tr[e.toLowerCase()];return t!==void 0?this.setHex(t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=C4(e.r),this.g=C4(e.g),this.b=C4(e.b),this}copyLinearToSRGB(e){return this.r=t3(e.r),this.g=t3(e.g),this.b=t3(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return this.r*255<<16^this.g*255<<8^this.b*255<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(e){let t=this.r,i=this.g,a=this.b,r=Math.max(t,i,a),s=Math.min(t,i,a),o,c,l=(s+r)/2;if(s===r)o=0,c=0;else{let u=r-s;switch(c=l<=.5?u/(r+s):u/(2-r-s),r){case t:o=(i-a)/u+(ir&&(r=u),f>s&&(s=f),h>o&&(o=h)}return this.min.set(t,i,a),this.max.set(r,s,o),this}setFromBufferAttribute(e){let t=1/0,i=1/0,a=1/0,r=-1/0,s=-1/0,o=-1/0;for(let c=0,l=e.count;cr&&(r=u),f>s&&(s=f),h>o&&(o=h)}return this.min.set(t,i,a),this.max.set(r,s,o),this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,w4),w4.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Bt),R6.subVectors(this.max,Bt),W4.subVectors(e.a,Bt),j4.subVectors(e.b,Bt),X4.subVectors(e.c,Bt),n4.subVectors(j4,W4),s4.subVectors(X4,j4),_4.subVectors(W4,X4);let t=[0,-n4.z,n4.y,0,-s4.z,s4.y,0,-_4.z,_4.y,n4.z,0,-n4.x,s4.z,0,-s4.x,_4.z,0,-_4.x,-n4.y,n4.x,0,-s4.y,s4.x,0,-_4.y,_4.x,0];return!R3(t,W4,j4,X4,R6)||(t=[1,0,0,0,1,0,0,0,1],!R3(t,W4,j4,X4,R6))?!1:(F6.crossVectors(n4,s4),t=[F6.x,F6.y,F6.z],R3(t,W4,j4,X4,R6))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return w4.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=this.getSize(w4).length()*.5,e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(qe[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),qe[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),qe[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),qe[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),qe[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),qe[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),qe[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),qe[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(qe),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}};Ge.prototype.isBox3=!0;var qe=[new k,new k,new k,new k,new k,new k,new k,new k],w4=new k,N3=new Ge,W4=new k,j4=new k,X4=new k,n4=new k,s4=new k,_4=new k,Bt=new k,R6=new k,F6=new k,S4=new k;function R3(n,e,t,i,a){for(let r=0,s=n.length-3;r<=s;r+=3){S4.fromArray(n,r);let o=a.x*Math.abs(S4.x)+a.y*Math.abs(S4.y)+a.z*Math.abs(S4.z),c=e.dot(S4),l=t.dot(S4),u=i.dot(S4);if(Math.max(-Math.max(c,l,u),Math.min(c,l,u))>o)return!1}return!0}var F2=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;let i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;let a=this._listeners[e];if(a!==void 0){let r=a.indexOf(t);r!==-1&&a.splice(r,1)}}dispatchEvent(e){if(this._listeners===void 0)return;let i=this._listeners[e.type];if(i!==void 0){e.target=this;let a=i.slice(0);for(let r=0,s=a.length;rthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){F3.subVectors(e,this.center);let t=F3.lengthSq();if(t>this.radius*this.radius){let i=Math.sqrt(t),a=(i-this.radius)*.5;this.center.add(F3.multiplyScalar(a/i)),this.radius+=a}return this}union(e){return this.center.equals(e.center)===!0?B6.set(0,0,1).multiplyScalar(e.radius):B6.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(E8.copy(e.center).add(B6)),this.expandByPoint(E8.copy(e.center).sub(B6)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}};var k1=class{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(e,t,i,a,r,s,o,c,l,u,f,h,m,v,g,x){let p=this.elements;return p[0]=e,p[4]=t,p[8]=i,p[12]=a,p[1]=r,p[5]=s,p[9]=o,p[13]=c,p[2]=l,p[6]=u,p[10]=f,p[14]=h,p[3]=m,p[7]=v,p[11]=g,p[15]=x,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new k1().fromArray(this.elements)}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){let t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,i=e.elements,a=1/Z4.setFromMatrixColumn(e,0).length(),r=1/Z4.setFromMatrixColumn(e,1).length(),s=1/Z4.setFromMatrixColumn(e,2).length();return t[0]=i[0]*a,t[1]=i[1]*a,t[2]=i[2]*a,t[3]=0,t[4]=i[4]*r,t[5]=i[5]*r,t[6]=i[6]*r,t[7]=0,t[8]=i[8]*s,t[9]=i[9]*s,t[10]=i[10]*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");let t=this.elements,i=e.x,a=e.y,r=e.z,s=Math.cos(i),o=Math.sin(i),c=Math.cos(a),l=Math.sin(a),u=Math.cos(r),f=Math.sin(r);if(e.order==="XYZ"){let h=s*u,m=s*f,v=o*u,g=o*f;t[0]=c*u,t[4]=-c*f,t[8]=l,t[1]=m+v*l,t[5]=h-g*l,t[9]=-o*c,t[2]=g-h*l,t[6]=v+m*l,t[10]=s*c}else if(e.order==="YXZ"){let h=c*u,m=c*f,v=l*u,g=l*f;t[0]=h+g*o,t[4]=v*o-m,t[8]=s*l,t[1]=s*f,t[5]=s*u,t[9]=-o,t[2]=m*o-v,t[6]=g+h*o,t[10]=s*c}else if(e.order==="ZXY"){let h=c*u,m=c*f,v=l*u,g=l*f;t[0]=h-g*o,t[4]=-s*f,t[8]=v+m*o,t[1]=m+v*o,t[5]=s*u,t[9]=g-h*o,t[2]=-s*l,t[6]=o,t[10]=s*c}else if(e.order==="ZYX"){let h=s*u,m=s*f,v=o*u,g=o*f;t[0]=c*u,t[4]=v*l-m,t[8]=h*l+g,t[1]=c*f,t[5]=g*l+h,t[9]=m*l-v,t[2]=-l,t[6]=o*c,t[10]=s*c}else if(e.order==="YZX"){let h=s*c,m=s*l,v=o*c,g=o*l;t[0]=c*u,t[4]=g-h*f,t[8]=v*f+m,t[1]=f,t[5]=s*u,t[9]=-o*u,t[2]=-l*u,t[6]=m*f+v,t[10]=h-g*f}else if(e.order==="XZY"){let h=s*c,m=s*l,v=o*c,g=o*l;t[0]=c*u,t[4]=-f,t[8]=l*u,t[1]=h*f+g,t[5]=s*u,t[9]=m*f-v,t[2]=v*f-m,t[6]=o*u,t[10]=g*f+h}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(l9,e,u9)}lookAt(e,t,i){let a=this.elements;return B2.subVectors(e,t),B2.lengthSq()===0&&(B2.z=1),B2.normalize(),o4.crossVectors(i,B2),o4.lengthSq()===0&&(Math.abs(i.z)===1?B2.x+=1e-4:B2.z+=1e-4,B2.normalize(),o4.crossVectors(i,B2)),o4.normalize(),P6.crossVectors(B2,o4),a[0]=o4.x,a[4]=P6.x,a[8]=B2.x,a[1]=o4.y,a[5]=P6.y,a[9]=B2.y,a[2]=o4.z,a[6]=P6.z,a[10]=B2.z,this}multiply(e,t){return t!==void 0?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,a=t.elements,r=this.elements,s=i[0],o=i[4],c=i[8],l=i[12],u=i[1],f=i[5],h=i[9],m=i[13],v=i[2],g=i[6],x=i[10],p=i[14],d=i[3],A=i[7],b=i[11],C=i[15],E=a[0],T=a[4],S=a[8],P=a[12],F=a[1],M=a[5],D=a[9],z=a[13],H=a[2],V=a[6],L=a[10],N=a[14],U=a[3],Z=a[7],O=a[11],W=a[15];return r[0]=s*E+o*F+c*H+l*U,r[4]=s*T+o*M+c*V+l*Z,r[8]=s*S+o*D+c*L+l*O,r[12]=s*P+o*z+c*N+l*W,r[1]=u*E+f*F+h*H+m*U,r[5]=u*T+f*M+h*V+m*Z,r[9]=u*S+f*D+h*L+m*O,r[13]=u*P+f*z+h*N+m*W,r[2]=v*E+g*F+x*H+p*U,r[6]=v*T+g*M+x*V+p*Z,r[10]=v*S+g*D+x*L+p*O,r[14]=v*P+g*z+x*N+p*W,r[3]=d*E+A*F+b*H+C*U,r[7]=d*T+A*M+b*V+C*Z,r[11]=d*S+A*D+b*L+C*O,r[15]=d*P+A*z+b*N+C*W,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[4],a=e[8],r=e[12],s=e[1],o=e[5],c=e[9],l=e[13],u=e[2],f=e[6],h=e[10],m=e[14],v=e[3],g=e[7],x=e[11],p=e[15];return v*(+r*c*f-a*l*f-r*o*h+i*l*h+a*o*m-i*c*m)+g*(+t*c*m-t*l*h+r*s*h-a*s*m+a*l*u-r*c*u)+x*(+t*l*f-t*o*m-r*s*f+i*s*m+r*o*u-i*l*u)+p*(-a*o*u-t*c*f+t*o*h+a*s*f-i*s*h+i*c*u)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){let a=this.elements;return e.isVector3?(a[12]=e.x,a[13]=e.y,a[14]=e.z):(a[12]=e,a[13]=t,a[14]=i),this}invert(){let e=this.elements,t=e[0],i=e[1],a=e[2],r=e[3],s=e[4],o=e[5],c=e[6],l=e[7],u=e[8],f=e[9],h=e[10],m=e[11],v=e[12],g=e[13],x=e[14],p=e[15],d=f*x*l-g*h*l+g*c*m-o*x*m-f*c*p+o*h*p,A=v*h*l-u*x*l-v*c*m+s*x*m+u*c*p-s*h*p,b=u*g*l-v*f*l+v*o*m-s*g*m-u*o*p+s*f*p,C=v*f*c-u*g*c-v*o*h+s*g*h+u*o*x-s*f*x,E=t*d+i*A+a*b+r*C;if(E===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let T=1/E;return e[0]=d*T,e[1]=(g*h*r-f*x*r-g*a*m+i*x*m+f*a*p-i*h*p)*T,e[2]=(o*x*r-g*c*r+g*a*l-i*x*l-o*a*p+i*c*p)*T,e[3]=(f*c*r-o*h*r-f*a*l+i*h*l+o*a*m-i*c*m)*T,e[4]=A*T,e[5]=(u*x*r-v*h*r+v*a*m-t*x*m-u*a*p+t*h*p)*T,e[6]=(v*c*r-s*x*r-v*a*l+t*x*l+s*a*p-t*c*p)*T,e[7]=(s*h*r-u*c*r+u*a*l-t*h*l-s*a*m+t*c*m)*T,e[8]=b*T,e[9]=(v*f*r-u*g*r-v*i*m+t*g*m+u*i*p-t*f*p)*T,e[10]=(s*g*r-v*o*r+v*i*l-t*g*l-s*i*p+t*o*p)*T,e[11]=(u*o*r-s*f*r-u*i*l+t*f*l+s*i*m-t*o*m)*T,e[12]=C*T,e[13]=(u*g*a-v*f*a+v*i*h-t*g*h-u*i*x+t*f*x)*T,e[14]=(v*o*a-s*g*a-v*i*c+t*g*c+s*i*x-t*o*x)*T,e[15]=(s*f*a-u*o*a+u*i*c-t*f*c-s*i*h+t*o*h)*T,this}scale(e){let t=this.elements,i=e.x,a=e.y,r=e.z;return t[0]*=i,t[4]*=a,t[8]*=r,t[1]*=i,t[5]*=a,t[9]*=r,t[2]*=i,t[6]*=a,t[10]*=r,t[3]*=i,t[7]*=a,t[11]*=r,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],a=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,a))}makeTranslation(e,t,i){return this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let i=Math.cos(t),a=Math.sin(t),r=1-i,s=e.x,o=e.y,c=e.z,l=r*s,u=r*o;return this.set(l*s+i,l*o-a*c,l*c+a*o,0,l*o+a*c,u*o+i,u*c-a*s,0,l*c-a*o,u*c+a*s,r*c*c+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,a,r,s){return this.set(1,i,r,0,e,1,s,0,t,a,1,0,0,0,0,1),this}compose(e,t,i){let a=this.elements,r=t._x,s=t._y,o=t._z,c=t._w,l=r+r,u=s+s,f=o+o,h=r*l,m=r*u,v=r*f,g=s*u,x=s*f,p=o*f,d=c*l,A=c*u,b=c*f,C=i.x,E=i.y,T=i.z;return a[0]=(1-(g+p))*C,a[1]=(m+b)*C,a[2]=(v-A)*C,a[3]=0,a[4]=(m-b)*E,a[5]=(1-(h+p))*E,a[6]=(x+d)*E,a[7]=0,a[8]=(v+A)*T,a[9]=(x-d)*T,a[10]=(1-(h+g))*T,a[11]=0,a[12]=e.x,a[13]=e.y,a[14]=e.z,a[15]=1,this}decompose(e,t,i){let a=this.elements,r=Z4.set(a[0],a[1],a[2]).length(),s=Z4.set(a[4],a[5],a[6]).length(),o=Z4.set(a[8],a[9],a[10]).length();this.determinant()<0&&(r=-r),e.x=a[12],e.y=a[13],e.z=a[14],ee.copy(this);let l=1/r,u=1/s,f=1/o;return ee.elements[0]*=l,ee.elements[1]*=l,ee.elements[2]*=l,ee.elements[4]*=u,ee.elements[5]*=u,ee.elements[6]*=u,ee.elements[8]*=f,ee.elements[9]*=f,ee.elements[10]*=f,t.setFromRotationMatrix(ee),i.x=r,i.y=s,i.z=o,this}makePerspective(e,t,i,a,r,s){s===void 0&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");let o=this.elements,c=2*r/(t-e),l=2*r/(i-a),u=(t+e)/(t-e),f=(i+a)/(i-a),h=-(s+r)/(s-r),m=-2*s*r/(s-r);return o[0]=c,o[4]=0,o[8]=u,o[12]=0,o[1]=0,o[5]=l,o[9]=f,o[13]=0,o[2]=0,o[6]=0,o[10]=h,o[14]=m,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(e,t,i,a,r,s){let o=this.elements,c=1/(t-e),l=1/(i-a),u=1/(s-r),f=(t+e)*c,h=(i+a)*l,m=(s+r)*u;return o[0]=2*c,o[4]=0,o[8]=0,o[12]=-f,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-h,o[2]=0,o[6]=0,o[10]=-2*u,o[14]=-m,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(e){let t=this.elements,i=e.elements;for(let a=0;a<16;a++)if(t[a]!==i[a])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}};k1.prototype.isMatrix4=!0;var Z4=new k,ee=new k1,l9=new k(0,0,0),u9=new k(1,1,1),o4=new k,P6=new k,B2=new k;var L8=new k1,D8=new xe,c4=class{constructor(e=0,t=0,i=0,a=c4.DefaultOrder){this._x=e,this._y=t,this._z=i,this._order=a}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,a=this._order){return this._x=e,this._y=t,this._z=i,this._order=a,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){let a=e.elements,r=a[0],s=a[4],o=a[8],c=a[1],l=a[5],u=a[9],f=a[2],h=a[6],m=a[10];switch(t){case"XYZ":this._y=Math.asin(D2(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,m),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-D2(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,m),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-f,r),this._z=0);break;case"ZXY":this._x=Math.asin(D2(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-f,m),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(c,r));break;case"ZYX":this._y=Math.asin(-D2(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(h,m),this._z=Math.atan2(c,r)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(D2(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-f,r)):(this._x=0,this._y=Math.atan2(o,m));break;case"XZY":this._z=Math.asin(-D2(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(h,l),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-u,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return L8.makeRotationFromQuaternion(e),this.setFromRotationMatrix(L8,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return D8.setFromEuler(this),this.setFromQuaternion(D8,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}toVector3(e){return e?e.set(this._x,this._y,this._z):new k(this._x,this._y,this._z)}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}};c4.prototype.isEuler=!0;c4.DefaultOrder="XYZ";c4.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];var Pt=class{constructor(){this.mask=1|0}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(e,t,i,a,r,s,o,c,l){let u=this.elements;return u[0]=e,u[1]=a,u[2]=o,u[3]=t,u[4]=r,u[5]=c,u[6]=i,u[7]=s,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,a=t.elements,r=this.elements,s=i[0],o=i[3],c=i[6],l=i[1],u=i[4],f=i[7],h=i[2],m=i[5],v=i[8],g=a[0],x=a[3],p=a[6],d=a[1],A=a[4],b=a[7],C=a[2],E=a[5],T=a[8];return r[0]=s*g+o*d+c*C,r[3]=s*x+o*A+c*E,r[6]=s*p+o*b+c*T,r[1]=l*g+u*d+f*C,r[4]=l*x+u*A+f*E,r[7]=l*p+u*b+f*T,r[2]=h*g+m*d+v*C,r[5]=h*x+m*A+v*E,r[8]=h*p+m*b+v*T,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[1],a=e[2],r=e[3],s=e[4],o=e[5],c=e[6],l=e[7],u=e[8];return t*s*u-t*o*l-i*r*u+i*o*c+a*r*l-a*s*c}invert(){let e=this.elements,t=e[0],i=e[1],a=e[2],r=e[3],s=e[4],o=e[5],c=e[6],l=e[7],u=e[8],f=u*s-o*l,h=o*c-u*r,m=l*r-s*c,v=t*f+i*h+a*m;if(v===0)return this.set(0,0,0,0,0,0,0,0,0);let g=1/v;return e[0]=f*g,e[1]=(a*l-u*i)*g,e[2]=(o*i-a*s)*g,e[3]=h*g,e[4]=(u*t-a*c)*g,e[5]=(a*r-o*t)*g,e[6]=m*g,e[7]=(i*c-l*t)*g,e[8]=(s*t-i*r)*g,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,a,r,s,o){let c=Math.cos(r),l=Math.sin(r);return this.set(i*c,i*l,-i*(c*s+l*o)+s+e,-a*l,a*c,-a*(-l*s+c*o)+o+t,0,0,1),this}scale(e,t){let i=this.elements;return i[0]*=e,i[3]*=e,i[6]*=e,i[1]*=t,i[4]*=t,i[7]*=t,this}rotate(e){let t=Math.cos(e),i=Math.sin(e),a=this.elements,r=a[0],s=a[3],o=a[6],c=a[1],l=a[4],u=a[7];return a[0]=t*r+i*c,a[3]=t*s+i*l,a[6]=t*o+i*u,a[1]=-i*r+t*c,a[4]=-i*s+t*l,a[7]=-i*o+t*u,this}translate(e,t){let i=this.elements;return i[0]+=e*i[2],i[3]+=e*i[5],i[6]+=e*i[8],i[1]+=t*i[2],i[4]+=t*i[5],i[7]+=t*i[8],this}equals(e){let t=this.elements,i=e.elements;for(let a=0;a<9;a++)if(t[a]!==i[a])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}};n2.prototype.isMatrix3=!0;var h9=0,T8=new k,Y4=new xe,je=new k1,I6=new k,It=new k,f9=new k,d9=new xe,H8=new k(1,0,0),V8=new k(0,1,0),N8=new k(0,0,1),p9={type:"added"},R8={type:"removed"},j1=class extends F2{constructor(){super();Object.defineProperty(this,"id",{value:h9++}),this.uuid=Ie(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=j1.DefaultUp.clone();let e=new k,t=new c4,i=new xe,a=new k(1,1,1);function r(){i.setFromEuler(t,!1)}function s(){t.setFromQuaternion(i,void 0,!1)}t._onChange(r),i._onChange(s),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:a},modelViewMatrix:{value:new k1},normalMatrix:{value:new n2}}),this.matrix=new k1,this.matrixWorld=new k1,this.matrixAutoUpdate=j1.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Pt,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Y4.setFromAxisAngle(e,t),this.quaternion.multiply(Y4),this}rotateOnWorldAxis(e,t){return Y4.setFromAxisAngle(e,t),this.quaternion.premultiply(Y4),this}rotateX(e){return this.rotateOnAxis(H8,e)}rotateY(e){return this.rotateOnAxis(V8,e)}rotateZ(e){return this.rotateOnAxis(N8,e)}translateOnAxis(e,t){return T8.copy(e).applyQuaternion(this.quaternion),this.position.add(T8.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(H8,e)}translateY(e){return this.translateOnAxis(V8,e)}translateZ(e){return this.translateOnAxis(N8,e)}localToWorld(e){return e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return e.applyMatrix4(je.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?I6.copy(e):I6.set(e,t,i);let a=this.parent;this.updateWorldMatrix(!0,!1),It.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?je.lookAt(It,I6,this.up):je.lookAt(I6,It,this.up),this.quaternion.setFromRotationMatrix(je),a&&(je.extractRotation(a.matrixWorld),Y4.setFromRotationMatrix(je),this.quaternion.premultiply(Y4.invert()))}add(e){if(arguments.length>1){for(let t=0;t1){for(let i=0;i0){a.children=[];for(let o=0;o0){a.animations=[];for(let o=0;o0&&(i.geometries=o),c.length>0&&(i.materials=c),l.length>0&&(i.textures=l),u.length>0&&(i.images=u),f.length>0&&(i.shapes=f),h.length>0&&(i.skeletons=h),m.length>0&&(i.animations=m)}return i.object=a,i;function s(o){let c=[];for(let l in o){let u=o[l];delete u.metadata,c.push(u)}return c}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i=0;--e)if(n[e]>65535)return!0;return!1}function E4(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}var m9=0,G2=new k1,B3=new j1,$4=new k,P2=new Ge,kt=new Ge,l2=new k,b2=class extends F2{constructor(){super();Object.defineProperty(this,"id",{value:m9++}),this.uuid=Ie(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(k6(e)?Ft:Rt)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let i=this.attributes.normal;if(i!==void 0){let r=new n2().getNormalMatrix(e);i.applyNormalMatrix(r),i.needsUpdate=!0}let a=this.attributes.tangent;return a!==void 0&&(a.transformDirection(e),a.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return G2.makeRotationFromQuaternion(e),this.applyMatrix4(G2),this}rotateX(e){return G2.makeRotationX(e),this.applyMatrix4(G2),this}rotateY(e){return G2.makeRotationY(e),this.applyMatrix4(G2),this}rotateZ(e){return G2.makeRotationZ(e),this.applyMatrix4(G2),this}translate(e,t,i){return G2.makeTranslation(e,t,i),this.applyMatrix4(G2),this}scale(e,t,i){return G2.makeScale(e,t,i),this.applyMatrix4(G2),this}lookAt(e){return B3.lookAt(e),B3.updateMatrix(),this.applyMatrix4(B3.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter($4).negate(),this.translate($4.x,$4.y,$4.z),this}setFromPoints(e){let t=[];for(let i=0,a=e.length;i0&&(e.userData=this.userData),this.parameters!==void 0){let c=this.parameters;for(let l in c)c[l]!==void 0&&(e[l]=c[l]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let i=this.attributes;for(let c in i){let l=i[c];e.data.attributes[c]=l.toJSON(e.data)}let a={},r=!1;for(let c in this.morphAttributes){let l=this.morphAttributes[c],u=[];for(let f=0,h=l.length;f0&&(a[c]=u,r=!0)}r&&(e.data.morphAttributes=a,e.data.morphTargetsRelative=this.morphTargetsRelative);let s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));let o=this.boundingSphere;return o!==null&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let i=e.index;i!==null&&this.setIndex(i.clone(t));let a=e.attributes;for(let l in a){let u=a[l];this.setAttribute(l,u.clone(t))}let r=e.morphAttributes;for(let l in r){let u=[],f=r[l];for(let h=0,m=f.length;h0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let i=e[t];if(i===void 0){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}if(t==="shading"){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=i===Rr;continue}let a=this[t];if(a===void 0){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}a&&a.isColor?a.set(i):a&&a.isVector3&&i&&i.isVector3?a.copy(i):this[t]=i}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==A4&&(i.blending=this.blending),this.side!==ke&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.alphaWrite=this.alphaWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,this.rotation&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(i.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=this.flatShading),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),JSON.stringify(this.userData)!=="{}"&&(i.userData=this.userData);function a(r){let s=[];for(let o in r){let c=r[o];delete c.metadata,s.push(c)}return s}if(t){let r=a(e.textures),s=a(e.images);r.length>0&&(i.textures=r),s.length>0&&(i.images=s)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,i=null;if(t!==null){let a=t.length;i=new Array(a);for(let r=0;r!==a;++r)i[r]=t[r].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.alphaWrite=e.alphaWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}};T2.prototype.isMaterial=!0;var Ut=class extends T2{constructor(e){super();this.type="MeshPhongMaterial",this.color=new x1(16777215),this.specular=new x1(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new x1(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=H6,this.normalScale=new z1(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=G4,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this}};Ut.prototype.isMeshPhongMaterial=!0;var Xe=new k,P3=new k,U6=new k,l4=new k,I3=new k,O6=new k,k3=new k,U3=class{constructor(e=new k,t=new k(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Xe)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(i).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=Xe.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Xe.copy(this.direction).multiplyScalar(t).add(this.origin),Xe.distanceToSquared(e))}distanceSqToSegment(e,t,i,a){P3.copy(e).add(t).multiplyScalar(.5),U6.copy(t).sub(e).normalize(),l4.copy(this.origin).sub(P3);let r=e.distanceTo(t)*.5,s=-this.direction.dot(U6),o=l4.dot(this.direction),c=-l4.dot(U6),l=l4.lengthSq(),u=Math.abs(1-s*s),f,h,m,v;if(u>0)if(f=s*c-o,h=s*o-c,v=r*u,f>=0)if(h>=-v)if(h<=v){let g=1/u;f*=g,h*=g,m=f*(f+s*h+2*o)+h*(s*f+h+2*c)+l}else h=r,f=Math.max(0,-(s*h+o)),m=-f*f+h*(h+2*c)+l;else h=-r,f=Math.max(0,-(s*h+o)),m=-f*f+h*(h+2*c)+l;else h<=-v?(f=Math.max(0,-(-s*r+o)),h=f>0?-r:Math.min(Math.max(-r,-c),r),m=-f*f+h*(h+2*c)+l):h<=v?(f=0,h=Math.min(Math.max(-r,-c),r),m=h*(h+2*c)+l):(f=Math.max(0,-(s*r+o)),h=f>0?r:Math.min(Math.max(-r,-c),r),m=-f*f+h*(h+2*c)+l);else h=s>0?-r:r,f=Math.max(0,-(s*h+o)),m=-f*f+h*(h+2*c)+l;return i&&i.copy(this.direction).multiplyScalar(f).add(this.origin),a&&a.copy(U6).multiplyScalar(h).add(P3),m}intersectSphere(e,t){Xe.subVectors(e.center,this.origin);let i=Xe.dot(this.direction),a=Xe.dot(Xe)-i*i,r=e.radius*e.radius;if(a>r)return null;let s=Math.sqrt(r-a),o=i-s,c=i+s;return o<0&&c<0?null:o<0?this.at(c,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){let i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,a,r,s,o,c,l=1/this.direction.x,u=1/this.direction.y,f=1/this.direction.z,h=this.origin;return l>=0?(i=(e.min.x-h.x)*l,a=(e.max.x-h.x)*l):(i=(e.max.x-h.x)*l,a=(e.min.x-h.x)*l),u>=0?(r=(e.min.y-h.y)*u,s=(e.max.y-h.y)*u):(r=(e.max.y-h.y)*u,s=(e.min.y-h.y)*u),i>s||r>a||((r>i||i!==i)&&(i=r),(s=0?(o=(e.min.z-h.z)*f,c=(e.max.z-h.z)*f):(o=(e.max.z-h.z)*f,c=(e.min.z-h.z)*f),i>c||o>a)||((o>i||i!==i)&&(i=o),(c=0?i:a,t)}intersectsBox(e){return this.intersectBox(e,Xe)!==null}intersectTriangle(e,t,i,a,r){I3.subVectors(t,e),O6.subVectors(i,e),k3.crossVectors(I3,O6);let s=this.direction.dot(k3),o;if(s>0){if(a)return null;o=1}else if(s<0)o=-1,s=-s;else return null;l4.subVectors(this.origin,e);let c=o*this.direction.dot(O6.crossVectors(l4,O6));if(c<0)return null;let l=o*this.direction.dot(I3.cross(l4));if(l<0||c+l>s)return null;let u=-o*l4.dot(k3);return u<0?null:this.at(u/s,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}};var te=new k,Ze=new k,O3=new k,Ye=new k,K4=new k,J4=new k,F8=new k,G3=new k,q3=new k,W3=new k,ie=class{constructor(e=new k,t=new k,i=new k){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,a){a.subVectors(i,t),te.subVectors(e,t),a.cross(te);let r=a.lengthSq();return r>0?a.multiplyScalar(1/Math.sqrt(r)):a.set(0,0,0)}static getBarycoord(e,t,i,a,r){te.subVectors(a,t),Ze.subVectors(i,t),O3.subVectors(e,t);let s=te.dot(te),o=te.dot(Ze),c=te.dot(O3),l=Ze.dot(Ze),u=Ze.dot(O3),f=s*l-o*o;if(f===0)return r.set(-2,-1,-1);let h=1/f,m=(l*c-o*u)*h,v=(s*u-o*c)*h;return r.set(1-m-v,v,m)}static containsPoint(e,t,i,a){return this.getBarycoord(e,t,i,a,Ye),Ye.x>=0&&Ye.y>=0&&Ye.x+Ye.y<=1}static getUV(e,t,i,a,r,s,o,c){return this.getBarycoord(e,t,i,a,Ye),c.set(0,0),c.addScaledVector(r,Ye.x),c.addScaledVector(s,Ye.y),c.addScaledVector(o,Ye.z),c}static isFrontFacing(e,t,i,a){return te.subVectors(i,t),Ze.subVectors(e,t),te.cross(Ze).dot(a)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,a){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[a]),this}setFromAttributeAndIndices(e,t,i,a){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,a),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return te.subVectors(this.c,this.b),Ze.subVectors(this.a,this.b),te.cross(Ze).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return ie.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return ie.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,a,r){return ie.getUV(e,this.a,this.b,this.c,t,i,a,r)}containsPoint(e){return ie.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return ie.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let i=this.a,a=this.b,r=this.c,s,o;K4.subVectors(a,i),J4.subVectors(r,i),G3.subVectors(e,i);let c=K4.dot(G3),l=J4.dot(G3);if(c<=0&&l<=0)return t.copy(i);q3.subVectors(e,a);let u=K4.dot(q3),f=J4.dot(q3);if(u>=0&&f<=u)return t.copy(a);let h=c*f-u*l;if(h<=0&&c>=0&&u<=0)return s=c/(c-u),t.copy(i).addScaledVector(K4,s);W3.subVectors(e,r);let m=K4.dot(W3),v=J4.dot(W3);if(v>=0&&m<=v)return t.copy(r);let g=m*l-c*v;if(g<=0&&l>=0&&v<=0)return o=l/(l-v),t.copy(i).addScaledVector(J4,o);let x=u*v-m*f;if(x<=0&&f-u>=0&&m-v>=0)return F8.subVectors(r,a),o=(f-u)/(f-u+(m-v)),t.copy(a).addScaledVector(F8,o);let p=1/(x+g+h);return s=g*p,o=h*p,t.copy(i).addScaledVector(K4,s).addScaledVector(J4,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}};var Q4=class extends T2{constructor(e){super();this.type="MeshBasicMaterial",this.color=new x1(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=G4,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}};Q4.prototype.isMeshBasicMaterial=!0;var B8=new k1,et=new U3,j3=new We,u4=new k,h4=new k,f4=new k,X3=new k,Z3=new k,Y3=new k,G6=new k,q6=new k,W6=new k,j6=new z1,X6=new z1,Z6=new z1,$3=new k,Y6=new k,u2=class extends j1{constructor(e=new b2,t=new Q4){super();this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry;if(e.isBufferGeometry){let t=e.morphAttributes,i=Object.keys(t);if(i.length>0){let a=t[i[0]];if(a!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,s=a.length;r0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(e,t){let i=this.geometry,a=this.material,r=this.matrixWorld;if(a===void 0||(i.boundingSphere===null&&i.computeBoundingSphere(),j3.copy(i.boundingSphere),j3.applyMatrix4(r),e.ray.intersectsSphere(j3)===!1)||(B8.copy(r).invert(),et.copy(e.ray).applyMatrix4(B8),i.boundingBox!==null&&et.intersectsBox(i.boundingBox)===!1))return;let s;if(i.isBufferGeometry){let o=i.index,c=i.attributes.position,l=i.morphAttributes.position,u=i.morphTargetsRelative,f=i.attributes.uv,h=i.attributes.uv2,m=i.groups,v=i.drawRange;if(o!==null)if(Array.isArray(a))for(let g=0,x=m.length;gt.far?null:{distance:l,point:Y6.clone(),object:n}}function $6(n,e,t,i,a,r,s,o,c,l,u,f){u4.fromBufferAttribute(a,l),h4.fromBufferAttribute(a,u),f4.fromBufferAttribute(a,f);let h=n.morphTargetInfluences;if(r&&h){G6.set(0,0,0),q6.set(0,0,0),W6.set(0,0,0);for(let v=0,g=r.length;v2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement!="undefined"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&e instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&e instanceof ImageBitmap){let t=E4("canvas");t.width=e.width,t.height=e.height;let i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);let a=i.getImageData(0,0,e.width,e.height),r=a.data;for(let s=0;s1)switch(this.wrapS){case Ht:e.x=e.x-Math.floor(e.x);break;case c2:e.x=e.x<0?0:1;break;case Vt:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Ht:e.y=e.y-Math.floor(e.y);break;case c2:e.y=e.y<0?0:1;break;case Vt:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&this.version++}};$1.DEFAULT_IMAGE=void 0;$1.DEFAULT_MAPPING=c3;$1.prototype.isTexture=!0;function K3(n){return typeof HTMLImageElement!="undefined"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&n instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&n instanceof ImageBitmap?Ot.getDataURL(n):n.data?{data:Array.prototype.slice.call(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var P8={specular:1515554,color:15790320,shininess:60,flatShading:!0},q2={diceColor:"#202020",textColor:"#ffffff"},ae=class{constructor(e,t,i={diceColor:"#202020",textColor:"#aaaaaa"}){this.w=e;this.h=t;this.options=i;this.scale=50;this.labels=[" ","0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20"];this.fontFace="Arial";this.options={...q2,...i}}setColor({diceColor:e,textColor:t}){e&&(this.options.diceColor=e),t&&(this.options.textColor=t)}get radius(){return this.scale*this.scaleFactor}get diceColor(){return this.options.diceColor}get textColor(){return this.options.textColor}get buffer(){return this.geometry.geometry}create(){this.textureSize=this.calculateTextureSize(this.scale/2+this.scale*this.margin)*2;let e=this.getGeometry(),t=this.getMaterials();return this.geometry=new u2(e,t),this.geometry.receiveShadow=!0,this.geometry.castShadow=!0,this.body.position.set(0+this.radius*2*Math.random(),0+this.radius*2*Math.random(),0+this.radius*4),this.body.velocity.x=500*Math.random()*2-1,this.body.velocity.y=500*Math.random()*2-1,this.body.angularVelocity.x=100*Math.random(),this.body.angularVelocity.y=100*Math.random(),this}getGeometry(){let e=new Array(this.vertices.length);for(let i=0;i=0&&u=0&&l!==c+1?o.unshift([r,l],[s,u]):o.push([r,l],[s,u]),c=l)}o.length===4&&i.push([i[o[0][0]][o[0][1]],i[o[1][0]][o[1][1]],i[o[3][0]][o[3][1]],i[o[2][0]][o[2][1]],-1])}for(let r=0;r=0&&u<4){--u==-1&&(u=3);let f=i[l][u];if(s.indexOf(f)>=0){o.push(f);break}}}--c}o.push(-1),i.push(o)}return{vectors:t,faces:i}}makeGeometry(e,t){let i=new b2;for(let f=0;f1&&(o=o/l.length,s.font=`${o}pt '${this.fontFace}'`,c=s.measureText("M").width*1.2,a-=c*l.length/2);for(let f=0,h=l.length;f0?-1:1)*.9,y:this.h*(r.y>0?-1:1)*.9,z:Math.random()*200+200},o=Math.abs(r.x/r.y);o>1?s.y/=o:s.x*=o;let c=this.makeRandomVector(a),l={x:c.x*i,y:c.y*i,z:-10},u={x:-(Math.random()*r.y*5+this.inertia*r.y),y:Math.random()*r.x*5+this.inertia*r.x,z:0},f={x:Math.random(),y:Math.random(),z:Math.random(),w:Math.random()};return{pos:s,velocity:l,angular:u,axis:f}}makeRandomVector(e){let t=Math.random()*Math.PI/5-Math.PI/5/2,i={x:e.x*Math.cos(t)-e.y*Math.sin(t),y:e.x*Math.sin(t)+e.y*Math.cos(t)};return i.x==0&&(i.x=.01),i.y==0&&(i.y=.01),i}get buffer(){return this.geometry.geometry}get result(){return this.getUpsideValue()}getUpsideValue(){let e=new k(0,0,this.sides==4?-1:1),t,i=Math.PI*2,a=this.buffer.getAttribute("normal").array;for(let s=0,o=this.buffer.groups.length;sthis.sides;)s-=this.sides;for(;s<1;)s+=this.sides;t.groups[a].materialIndex=s+1}}this.updateMaterialsForValue(e-i),this.geometry.geometry=t}resetBody(){this.body.vlambda=new y,this.body.position=new y,this.body.previousPosition=new y,this.body.initPosition=new y,this.body.velocity=new y,this.body.initVelocity=new y,this.body.force=new y,this.body.torque=new y,this.body.quaternion=new O1,this.body.initQuaternion=new O1,this.body.angularVelocity=new y,this.body.initAngularVelocity=new y,this.body.interpolatedPosition=new y,this.body.interpolatedQuaternion=new O1,this.body.inertia=new y,this.body.invInertia=new y,this.body.invInertiaWorld=new S2,this.body.invInertiaSolve=new y,this.body.invInertiaWorldSolve=new S2,this.body.wlambda=new y,this.body.updateMassProperties()}updateMaterialsForValue(e){}set(){this.geometry.position.set(this.body.position.x,this.body.position.y,this.body.position.z),this.geometry.quaternion.set(this.body.quaternion.x,this.body.quaternion.y,this.body.quaternion.z,this.body.quaternion.w)}create(){this.body.position.set(this.vector.pos.x,this.vector.pos.y,this.vector.pos.z),this.body.quaternion.setFromAxisAngle(new y(this.vector.axis.x,this.vector.axis.y,this.vector.axis.z),this.vector.axis.w*Math.PI*2),this.body.angularVelocity.set(this.vector.angular.x,this.vector.angular.y,this.vector.angular.z),this.body.velocity.set(this.vector.velocity.x,this.vector.velocity.y,this.vector.velocity.z),this.body.linearDamping=.1,this.body.angularDamping=.1}},mi=class extends L4{constructor(e,t,i,a){super(e,t,i);this.w=e;this.h=t;this.data=i;this.sides=20;this.inertia=6;a&&(this.vector=this.generateVector(a)),this.create()}},vi=class extends L4{constructor(e,t,i,a){super(e,t,i);this.w=e;this.h=t;this.data=i;this.sides=12;this.inertia=8;a&&(this.vector=this.generateVector(a)),this.create()}},D4=class extends L4{constructor(e,t,i,a,r=!1){super(e,t,i);this.w=e;this.h=t;this.data=i;this.isPercentile=r;this.sides=10;this.inertia=9;a&&(this.vector=this.generateVector(a)),this.create()}},gi=class extends L4{constructor(e,t,i,a){super(e,t,i);this.w=e;this.h=t;this.data=i;this.sides=8;this.inertia=10;a&&(this.vector=this.generateVector(a)),this.create()}},xi=class extends L4{constructor(e,t,i,a){super(e,t,i);this.w=e;this.h=t;this.data=i;this.sides=6;this.inertia=13;a&&(this.vector=this.generateVector(a)),this.create()}},Mi=class extends L4{constructor(e,t,i,a){super(e,t,i);this.w=e;this.h=t;this.data=i;this.sides=4;this.inertia=5;a&&(this.vector=this.generateVector(a)),this.create()}};var bi=new k,b9=new k,y9=new n2,re=class{constructor(e=new k(1,0,0),t=0){this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,a){return this.normal.set(e,t,i),this.constant=a,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){let a=bi.subVectors(i,t).cross(b9.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(a,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){let i=e.delta(bi),a=this.normal.dot(i);if(a===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let r=-(e.start.dot(this.normal)+this.constant)/a;return r<0||r>1?null:t.copy(i).multiplyScalar(r).add(e.start)}intersectsLine(e){let t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let i=t||y9.getNormalMatrix(e),a=this.coplanarPoint(bi).applyMatrix4(e),r=this.normal.applyMatrix3(i).normalize();return this.constant=-a.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}};re.prototype.isPlane=!0;var it=new We,J6=new k,T4=class{constructor(e=new re,t=new re,i=new re,a=new re,r=new re,s=new re){this.planes=[e,t,i,a,r,s]}set(e,t,i,a,r,s){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(i),o[3].copy(a),o[4].copy(r),o[5].copy(s),this}copy(e){let t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e){let t=this.planes,i=e.elements,a=i[0],r=i[1],s=i[2],o=i[3],c=i[4],l=i[5],u=i[6],f=i[7],h=i[8],m=i[9],v=i[10],g=i[11],x=i[12],p=i[13],d=i[14],A=i[15];return t[0].setComponents(o-a,f-c,g-h,A-x).normalize(),t[1].setComponents(o+a,f+c,g+h,A+x).normalize(),t[2].setComponents(o+r,f+l,g+m,A+p).normalize(),t[3].setComponents(o-r,f-l,g-m,A-p).normalize(),t[4].setComponents(o-s,f-u,g-v,A-d).normalize(),t[5].setComponents(o+s,f+u,g+v,A+d).normalize(),this}intersectsObject(e){let t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),it.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(it)}intersectsSprite(e){return it.center.set(0,0,0),it.radius=.7071067811865476,it.applyMatrix4(e.matrixWorld),this.intersectsSphere(it)}intersectsSphere(e){let t=this.planes,i=e.center,a=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(i)0?e.max.x:e.min.x,J6.y=a.normal.y>0?e.max.y:e.min.y,J6.z=a.normal.z>0?e.max.z:e.min.z,a.distanceToPoint(J6)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}};function Q6(){let n=null,e=!1,t=null,i=null;function a(r,s){t(r,s),i=n.requestAnimationFrame(a)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(a),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(r){t=r},setContext:function(r){n=r}}}function I8(n,e){let t=e.isWebGL2,i=new WeakMap;function a(l,u){let f=l.array,h=l.usage,m=n.createBuffer();n.bindBuffer(u,m),n.bufferData(u,f,h),l.onUploadCallback();let v=n.FLOAT;return f instanceof Float32Array?v=n.FLOAT:f instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):f instanceof Uint16Array?l.isFloat16BufferAttribute?t?v=n.HALF_FLOAT:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):v=n.UNSIGNED_SHORT:f instanceof Int16Array?v=n.SHORT:f instanceof Uint32Array?v=n.UNSIGNED_INT:f instanceof Int32Array?v=n.INT:f instanceof Int8Array?v=n.BYTE:(f instanceof Uint8Array||f instanceof Uint8ClampedArray)&&(v=n.UNSIGNED_BYTE),{buffer:m,type:v,bytesPerElement:f.BYTES_PER_ELEMENT,version:l.version}}function r(l,u,f){let h=u.array,m=u.updateRange;n.bindBuffer(f,l),m.count===-1?n.bufferSubData(f,0,h):(t?n.bufferSubData(f,m.offset*h.BYTES_PER_ELEMENT,h,m.offset,m.count):n.bufferSubData(f,m.offset*h.BYTES_PER_ELEMENT,h.subarray(m.offset,m.offset+m.count)),m.count=-1)}function s(l){return l.isInterleavedBufferAttribute&&(l=l.data),i.get(l)}function o(l){l.isInterleavedBufferAttribute&&(l=l.data);let u=i.get(l);u&&(n.deleteBuffer(u.buffer),i.delete(l))}function c(l,u){if(l.isGLBufferAttribute){let h=i.get(l);(!h||h.version0?1:-1,u.push(Z.x,Z.y,Z.z),f.push(X/T),f.push(1-O/S),N+=1}}for(let O=0;O0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;let i={};for(let a in this.extensions)this.extensions[a]===!0&&(i[a]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}};ne.prototype.isShaderMaterial=!0;var G8=` +#ifdef USE_ALPHAMAP + + diffuseColor.a *= texture2D( alphaMap, vUv ).g; + +#endif +`;var q8=` +#ifdef USE_ALPHAMAP + + uniform sampler2D alphaMap; + +#endif +`;var W8=` +#ifdef USE_ALPHATEST + + if ( diffuseColor.a < alphaTest ) discard; + +#endif +`;var j8=` +#ifdef USE_ALPHATEST + uniform float alphaTest; +#endif +`;var X8=` +#ifdef USE_AOMAP + + // reads channel R, compatible with a combined OcclusionRoughnessMetallic (RGB) texture + float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0; + + reflectedLight.indirectDiffuse *= ambientOcclusion; + + #if defined( USE_ENVMAP ) && defined( STANDARD ) + + float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) ); + + reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); + + #endif + +#endif +`;var Z8=` +#ifdef USE_AOMAP + + uniform sampler2D aoMap; + uniform float aoMapIntensity; + +#endif +`;var Y8=` +vec3 transformed = vec3( position ); +`;var $8=` +vec3 objectNormal = vec3( normal ); + +#ifdef USE_TANGENT + + vec3 objectTangent = vec3( tangent.xyz ); + +#endif +`;var K8=` + +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + + return RECIPROCAL_PI * diffuseColor; + +} // validated + +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + + // Original approximation by Christophe Schlick '94 + // float fresnel = pow( 1.0 - dotVH, 5.0 ); + + // Optimized variant (presented by Epic at SIGGRAPH '13) + // https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); + +} // validated + +// Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2 +// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf +float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { + + float a2 = pow2( alpha ); + + float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); + float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); + + return 0.5 / max( gv + gl, EPSILON ); + +} + +// Microfacet Models for Refraction through Rough Surfaces - equation (33) +// http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html +// alpha is "roughness squared" in Disney\u2019s reparameterization +float D_GGX( const in float alpha, const in float dotNH ) { + + float a2 = pow2( alpha ); + + float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; // avoid alpha = 0 with dotNH = 1 + + return RECIPROCAL_PI * a2 / pow2( denom ); + +} + +// GGX Distribution, Schlick Fresnel, GGX_SmithCorrelated Visibility +vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) { + + float alpha = pow2( roughness ); // UE4's roughness + + vec3 halfDir = normalize( lightDir + viewDir ); + + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + + vec3 F = F_Schlick( f0, f90, dotVH ); + + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + + float D = D_GGX( alpha, dotNH ); + + return F * ( V * D ); + +} + +// Rect Area Light + +// Real-Time Polygonal-Light Shading with Linearly Transformed Cosines +// by Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt +// code: https://github.com/selfshadow/ltc_code/ + +vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { + + const float LUT_SIZE = 64.0; + const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; + const float LUT_BIAS = 0.5 / LUT_SIZE; + + float dotNV = saturate( dot( N, V ) ); + + // texture parameterized by sqrt( GGX alpha ) and sqrt( 1 - cos( theta ) ) + vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); + + uv = uv * LUT_SCALE + LUT_BIAS; + + return uv; + +} + +float LTC_ClippedSphereFormFactor( const in vec3 f ) { + + // Real-Time Area Lighting: a Journey from Research to Production (p.102) + // An approximation of the form factor of a horizon-clipped rectangle. + + float l = length( f ); + + return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); + +} + +vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { + + float x = dot( v1, v2 ); + + float y = abs( x ); + + // rational polynomial approximation to theta / sin( theta ) / 2PI + float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; + float b = 3.4175940 + ( 4.1616724 + y ) * y; + float v = a / b; + + float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; + + return cross( v1, v2 ) * theta_sintheta; + +} + +vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { + + // bail if point is on back side of plane of light + // assumes ccw winding order of light vertices + vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; + vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; + vec3 lightNormal = cross( v1, v2 ); + + if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); + + // construct orthonormal basis around N + vec3 T1, T2; + T1 = normalize( V - N * dot( V, N ) ); + T2 = - cross( N, T1 ); // negated from paper; possibly due to a different handedness of world coordinate system + + // compute transform + mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); + + // transform rect + vec3 coords[ 4 ]; + coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); + coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); + coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); + coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); + + // project rect onto sphere + coords[ 0 ] = normalize( coords[ 0 ] ); + coords[ 1 ] = normalize( coords[ 1 ] ); + coords[ 2 ] = normalize( coords[ 2 ] ); + coords[ 3 ] = normalize( coords[ 3 ] ); + + // calculate vector form factor + vec3 vectorFormFactor = vec3( 0.0 ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); + + // adjust for horizon clipping + float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); + +/* + // alternate method of adjusting for horizon clipping (see referece) + // refactoring required + float len = length( vectorFormFactor ); + float z = vectorFormFactor.z / len; + + const float LUT_SIZE = 64.0; + const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; + const float LUT_BIAS = 0.5 / LUT_SIZE; + + // tabulated horizon-clipped sphere, apparently... + vec2 uv = vec2( z * 0.5 + 0.5, len ); + uv = uv * LUT_SCALE + LUT_BIAS; + + float scale = texture2D( ltc_2, uv ).w; + + float result = len * scale; +*/ + + return vec3( result ); + +} + +// End Rect Area Light + + +float G_BlinnPhong_Implicit( /* const in float dotNL, const in float dotNV */ ) { + + // geometry term is (n dot l)(n dot v) / 4(n dot l)(n dot v) + return 0.25; + +} + +float D_BlinnPhong( const in float shininess, const in float dotNH ) { + + return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); + +} + +vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { + + vec3 halfDir = normalize( lightDir + viewDir ); + + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + + vec3 F = F_Schlick( specularColor, 1.0, dotVH ); + + float G = G_BlinnPhong_Implicit( /* dotNL, dotNV */ ); + + float D = D_BlinnPhong( shininess, dotNH ); + + return F * ( G * D ); + +} // validated + +#if defined( USE_SHEEN ) + +// https://github.com/google/filament/blob/master/shaders/src/brdf.fs +float D_Charlie( float roughness, float dotNH ) { + + float alpha = pow2( roughness ); + + // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF" + float invAlpha = 1.0 / alpha; + float cos2h = dotNH * dotNH; + float sin2h = max( 1.0 - cos2h, 0.0078125 ); // 2^(-14/2), so sin2h^2 > 0 in fp16 + + return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); + +} + +// https://github.com/google/filament/blob/master/shaders/src/brdf.fs +float V_Neubelt( float dotNV, float dotNL ) { + + // Neubelt and Pettineo 2013, "Crafting a Next-gen Material Pipeline for The Order: 1886" + return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); + +} + +vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { + + vec3 halfDir = normalize( lightDir + viewDir ); + + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + + float D = D_Charlie( sheenRoughness, dotNH ); + float V = V_Neubelt( dotNV, dotNL ); + + return sheenColor * ( D * V ); + +} + +#endif +`;var J8=` +#ifdef USE_BUMPMAP + + uniform sampler2D bumpMap; + uniform float bumpScale; + + // Bump Mapping Unparametrized Surfaces on the GPU by Morten S. Mikkelsen + // https://mmikk.github.io/papers3d/mm_sfgrad_bump.pdf + + // Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2) + + vec2 dHdxy_fwd() { + + vec2 dSTdx = dFdx( vUv ); + vec2 dSTdy = dFdy( vUv ); + + float Hll = bumpScale * texture2D( bumpMap, vUv ).x; + float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll; + float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll; + + return vec2( dBx, dBy ); + + } + + vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { + + // Workaround for Adreno 3XX dFd*( vec3 ) bug. See #9988 + + vec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) ); + vec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) ); + vec3 vN = surf_norm; // normalized + + vec3 R1 = cross( vSigmaY, vN ); + vec3 R2 = cross( vN, vSigmaX ); + + float fDet = dot( vSigmaX, R1 ) * faceDirection; + + vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); + return normalize( abs( fDet ) * surf_norm - vGrad ); + + } + +#endif +`;var Q8=` +#if NUM_CLIPPING_PLANES > 0 + + vec4 plane; + + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + + plane = clippingPlanes[ i ]; + if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; + + } + #pragma unroll_loop_end + + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + + bool clipped = true; + + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + + plane = clippingPlanes[ i ]; + clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; + + } + #pragma unroll_loop_end + + if ( clipped ) discard; + + #endif + +#endif +`;var en=` +#if NUM_CLIPPING_PLANES > 0 + + varying vec3 vClipPosition; + + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; + +#endif +`;var tn=` +#if NUM_CLIPPING_PLANES > 0 + + varying vec3 vClipPosition; + +#endif +`;var an=` +#if NUM_CLIPPING_PLANES > 0 + + vClipPosition = - mvPosition.xyz; + +#endif +`;var rn=` +#if defined( USE_COLOR_ALPHA ) + + diffuseColor *= vColor; + +#elif defined( USE_COLOR ) + + diffuseColor.rgb *= vColor; + +#endif +`;var nn=` +#if defined( USE_COLOR_ALPHA ) + + varying vec4 vColor; + +#elif defined( USE_COLOR ) + + varying vec3 vColor; + +#endif +`;var sn=` +#if defined( USE_COLOR_ALPHA ) + + varying vec4 vColor; + +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) + + varying vec3 vColor; + +#endif +`;var on=` +#if defined( USE_COLOR_ALPHA ) + + vColor = vec4( 1.0 ); + +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) + + vColor = vec3( 1.0 ); + +#endif + +#ifdef USE_COLOR + + vColor *= color; + +#endif + +#ifdef USE_INSTANCING_COLOR + + vColor.xyz *= instanceColor.xyz; + +#endif +`;var cn=` +#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 + +#ifndef saturate +// may have defined saturate() already +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) + +float pow2( const in float x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); } + +// expects values in the range of [0,1]x[0,1], returns values in the [0,1] range. +// do not collapse into a single function per: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/ +highp float rand( const in vec2 uv ) { + + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + + return fract( sin( sn ) * c ); + +} + +#ifdef HIGH_PRECISION + float precisionSafeLength( vec3 v ) { return length( v ); } +#else + float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; + } +#endif + +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; + +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; + +struct GeometricContext { + vec3 position; + vec3 normal; + vec3 viewDir; +#ifdef USE_CLEARCOAT + vec3 clearcoatNormal; +#endif +}; + +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); + +} + +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + + // dir can be either a direction vector or a normal vector + // upper-left 3x3 of matrix is assumed to be orthogonal + + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); + +} + +mat3 transposeMat3( const in mat3 m ) { + + mat3 tmp; + + tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); + tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); + tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); + + return tmp; + +} + +// https://en.wikipedia.org/wiki/Relative_luminance +float linearToRelativeLuminance( const in vec3 color ) { + + vec3 weights = vec3( 0.2126, 0.7152, 0.0722 ); + + return dot( weights, color.rgb ); + +} + +bool isPerspectiveMatrix( mat4 m ) { + + return m[ 2 ][ 3 ] == - 1.0; + +} + +vec2 equirectUv( in vec3 dir ) { + + // dir is assumed to be unit length + + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + + return vec2( u, v ); + +} +`;var ln=` +#ifdef ENVMAP_TYPE_CUBE_UV + + #define cubeUV_maxMipLevel 8.0 + #define cubeUV_minMipLevel 4.0 + #define cubeUV_maxTileSize 256.0 + #define cubeUV_minTileSize 16.0 + + // These shader functions convert between the UV coordinates of a single face of + // a cubemap, the 0-5 integer index of a cube face, and the direction vector for + // sampling a textureCube (not generally normalized ). + + float getFace( vec3 direction ) { + + vec3 absDirection = abs( direction ); + + float face = - 1.0; + + if ( absDirection.x > absDirection.z ) { + + if ( absDirection.x > absDirection.y ) + + face = direction.x > 0.0 ? 0.0 : 3.0; + + else + + face = direction.y > 0.0 ? 1.0 : 4.0; + + } else { + + if ( absDirection.z > absDirection.y ) + + face = direction.z > 0.0 ? 2.0 : 5.0; + + else + + face = direction.y > 0.0 ? 1.0 : 4.0; + + } + + return face; + + } + + // RH coordinate system; PMREM face-indexing convention + vec2 getUV( vec3 direction, float face ) { + + vec2 uv; + + if ( face == 0.0 ) { + + uv = vec2( direction.z, direction.y ) / abs( direction.x ); // pos x + + } else if ( face == 1.0 ) { + + uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); // pos y + + } else if ( face == 2.0 ) { + + uv = vec2( - direction.x, direction.y ) / abs( direction.z ); // pos z + + } else if ( face == 3.0 ) { + + uv = vec2( - direction.z, direction.y ) / abs( direction.x ); // neg x + + } else if ( face == 4.0 ) { + + uv = vec2( - direction.x, direction.z ) / abs( direction.y ); // neg y + + } else { + + uv = vec2( direction.x, direction.y ) / abs( direction.z ); // neg z + + } + + return 0.5 * ( uv + 1.0 ); + + } + + vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { + + float face = getFace( direction ); + + float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); + + mipInt = max( mipInt, cubeUV_minMipLevel ); + + float faceSize = exp2( mipInt ); + + float texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize ); + + vec2 uv = getUV( direction, face ) * ( faceSize - 1.0 ) + 0.5; + + if ( face > 2.0 ) { + + uv.y += faceSize; + + face -= 3.0; + + } + + uv.x += face * faceSize; + + if ( mipInt < cubeUV_maxMipLevel ) { + + uv.y += 2.0 * cubeUV_maxTileSize; + + } + + uv.y += filterInt * 2.0 * cubeUV_minTileSize; + + uv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize ); + + uv *= texelSize; + + return texture2D( envMap, uv ).rgb; + + } + + // These defines must match with PMREMGenerator + + #define r0 1.0 + #define v0 0.339 + #define m0 - 2.0 + #define r1 0.8 + #define v1 0.276 + #define m1 - 1.0 + #define r4 0.4 + #define v4 0.046 + #define m4 2.0 + #define r5 0.305 + #define v5 0.016 + #define m5 3.0 + #define r6 0.21 + #define v6 0.0038 + #define m6 4.0 + + float roughnessToMip( float roughness ) { + + float mip = 0.0; + + if ( roughness >= r1 ) { + + mip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0; + + } else if ( roughness >= r4 ) { + + mip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1; + + } else if ( roughness >= r5 ) { + + mip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4; + + } else if ( roughness >= r6 ) { + + mip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5; + + } else { + + mip = - 2.0 * log2( 1.16 * roughness ); // 1.16 = 1.79^0.25 + } + + return mip; + + } + + vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { + + float mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel ); + + float mipF = fract( mip ); + + float mipInt = floor( mip ); + + vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); + + if ( mipF == 0.0 ) { + + return vec4( color0, 1.0 ); + + } else { + + vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); + + return vec4( mix( color0, color1, mipF ), 1.0 ); + + } + + } + +#endif +`;var un=` +vec3 transformedNormal = objectNormal; + +#ifdef USE_INSTANCING + + // this is in lieu of a per-instance normal-matrix + // shear transforms in the instance matrix are not supported + + mat3 m = mat3( instanceMatrix ); + + transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) ); + + transformedNormal = m * transformedNormal; + +#endif + +transformedNormal = normalMatrix * transformedNormal; + +#ifdef FLIP_SIDED + + transformedNormal = - transformedNormal; + +#endif + +#ifdef USE_TANGENT + + vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz; + + #ifdef FLIP_SIDED + + transformedTangent = - transformedTangent; + + #endif + +#endif +`;var hn=` +#ifdef USE_DISPLACEMENTMAP + + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; + +#endif +`;var fn=` +#ifdef USE_DISPLACEMENTMAP + + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias ); + +#endif +`;var dn=` +#ifdef USE_EMISSIVEMAP + + vec4 emissiveColor = texture2D( emissiveMap, vUv ); + + totalEmissiveRadiance *= emissiveColor.rgb; + +#endif +`;var pn=` +#ifdef USE_EMISSIVEMAP + + uniform sampler2D emissiveMap; + +#endif +`;var mn=` +gl_FragColor = linearToOutputTexel( gl_FragColor ); +`;var vn=` + +vec4 LinearToLinear( in vec4 value ) { + return value; +} + +vec4 LinearTosRGB( in vec4 value ) { + return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); +} + +`;var gn=` +#ifdef USE_ENVMAP + + #ifdef ENV_WORLDPOS + + vec3 cameraToFrag; + + if ( isOrthographic ) { + + cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + + } else { + + cameraToFrag = normalize( vWorldPosition - cameraPosition ); + + } + + // Transforming Normal Vectors with the Inverse Transformation + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + + #ifdef ENVMAP_MODE_REFLECTION + + vec3 reflectVec = reflect( cameraToFrag, worldNormal ); + + #else + + vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); + + #endif + + #else + + vec3 reflectVec = vReflect; + + #endif + + #ifdef ENVMAP_TYPE_CUBE + + vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); + + #elif defined( ENVMAP_TYPE_CUBE_UV ) + + vec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 ); + + #else + + vec4 envColor = vec4( 0.0 ); + + #endif + + #ifdef ENVMAP_BLENDING_MULTIPLY + + outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); + + #elif defined( ENVMAP_BLENDING_MIX ) + + outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); + + #elif defined( ENVMAP_BLENDING_ADD ) + + outgoingLight += envColor.xyz * specularStrength * reflectivity; + + #endif + +#endif +`;var xn=` +#ifdef USE_ENVMAP + + uniform float envMapIntensity; + uniform float flipEnvMap; + + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif + +#endif +`;var Mn=` +#ifdef USE_ENVMAP + + uniform float reflectivity; + + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) + + #define ENV_WORLDPOS + + #endif + + #ifdef ENV_WORLDPOS + + varying vec3 vWorldPosition; + uniform float refractionRatio; + #else + varying vec3 vReflect; + #endif + +#endif +`;var bn=` +#ifdef USE_ENVMAP + + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG ) + + #define ENV_WORLDPOS + + #endif + + #ifdef ENV_WORLDPOS + + varying vec3 vWorldPosition; + + #else + + varying vec3 vReflect; + uniform float refractionRatio; + + #endif + +#endif +`;var yn=` +#ifdef USE_ENVMAP + + #ifdef ENV_WORLDPOS + + vWorldPosition = worldPosition.xyz; + + #else + + vec3 cameraToVertex; + + if ( isOrthographic ) { + + cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + + } else { + + cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); + + } + + vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + + #ifdef ENVMAP_MODE_REFLECTION + + vReflect = reflect( cameraToVertex, worldNormal ); + + #else + + vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); + + #endif + + #endif + +#endif +`;var Cn=` +#ifdef USE_FOG + + vFogDepth = - mvPosition.z; + +#endif +`;var zn=` +#ifdef USE_FOG + + varying float vFogDepth; + +#endif +`;var An=` +#ifdef USE_FOG + + #ifdef FOG_EXP2 + + float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); + + #else + + float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); + + #endif + + gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); + +#endif +`;var wn=` +#ifdef USE_FOG + + uniform vec3 fogColor; + varying float vFogDepth; + + #ifdef FOG_EXP2 + + uniform float fogDensity; + + #else + + uniform float fogNear; + uniform float fogFar; + + #endif + +#endif +`;var _n=` + +#ifdef USE_GRADIENTMAP + + uniform sampler2D gradientMap; + +#endif + +vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { + + // dotNL will be from -1.0 to 1.0 + float dotNL = dot( normal, lightDirection ); + vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); + + #ifdef USE_GRADIENTMAP + + return vec3( texture2D( gradientMap, coord ).r ); + + #else + + return ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 ); + + #endif + +} +`;var Sn=` +#ifdef USE_LIGHTMAP + + vec4 lightMapTexel = texture2D( lightMap, vUv2 ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + + #ifndef PHYSICALLY_CORRECT_LIGHTS + + lightMapIrradiance *= PI; + + #endif + + reflectedLight.indirectDiffuse += lightMapIrradiance; + +#endif +`;var En=` +#ifdef USE_LIGHTMAP + + uniform sampler2D lightMap; + uniform float lightMapIntensity; + +#endif +`;var Ln=` +vec3 diffuse = vec3( 1.0 ); + +GeometricContext geometry; +geometry.position = mvPosition.xyz; +geometry.normal = normalize( transformedNormal ); +geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz ); + +GeometricContext backGeometry; +backGeometry.position = geometry.position; +backGeometry.normal = -geometry.normal; +backGeometry.viewDir = geometry.viewDir; + +vLightFront = vec3( 0.0 ); +vIndirectFront = vec3( 0.0 ); +#ifdef DOUBLE_SIDED + vLightBack = vec3( 0.0 ); + vIndirectBack = vec3( 0.0 ); +#endif + +IncidentLight directLight; +float dotNL; +vec3 directLightColor_Diffuse; + +vIndirectFront += getAmbientLightIrradiance( ambientLightColor ); + +vIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal ); + +#ifdef DOUBLE_SIDED + + vIndirectBack += getAmbientLightIrradiance( ambientLightColor ); + + vIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal ); + +#endif + +#if NUM_POINT_LIGHTS > 0 + + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { + + getPointLightInfo( pointLights[ i ], geometry, directLight ); + + dotNL = dot( geometry.normal, directLight.direction ); + directLightColor_Diffuse = directLight.color; + + vLightFront += saturate( dotNL ) * directLightColor_Diffuse; + + #ifdef DOUBLE_SIDED + + vLightBack += saturate( - dotNL ) * directLightColor_Diffuse; + + #endif + + } + #pragma unroll_loop_end + +#endif + +#if NUM_SPOT_LIGHTS > 0 + + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { + + getSpotLightInfo( spotLights[ i ], geometry, directLight ); + + dotNL = dot( geometry.normal, directLight.direction ); + directLightColor_Diffuse = directLight.color; + + vLightFront += saturate( dotNL ) * directLightColor_Diffuse; + + #ifdef DOUBLE_SIDED + + vLightBack += saturate( - dotNL ) * directLightColor_Diffuse; + + #endif + } + #pragma unroll_loop_end + +#endif + +#if NUM_DIR_LIGHTS > 0 + + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { + + getDirectionalLightInfo( directionalLights[ i ], geometry, directLight ); + + dotNL = dot( geometry.normal, directLight.direction ); + directLightColor_Diffuse = directLight.color; + + vLightFront += saturate( dotNL ) * directLightColor_Diffuse; + + #ifdef DOUBLE_SIDED + + vLightBack += saturate( - dotNL ) * directLightColor_Diffuse; + + #endif + + } + #pragma unroll_loop_end + +#endif + +#if NUM_HEMI_LIGHTS > 0 + + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + + vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal ); + + #ifdef DOUBLE_SIDED + + vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal ); + + #endif + + } + #pragma unroll_loop_end + +#endif +`;var Dn=` +uniform bool receiveShadow; +uniform vec3 ambientLightColor; +uniform vec3 lightProbe[ 9 ]; + +// get the irradiance (radiance convolved with cosine lobe) at the point 'normal' on the unit sphere +// source: https://graphics.stanford.edu/papers/envmap/envmap.pdf +vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { + + // normal is assumed to have unit length + + float x = normal.x, y = normal.y, z = normal.z; + + // band 0 + vec3 result = shCoefficients[ 0 ] * 0.886227; + + // band 1 + result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; + result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; + result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; + + // band 2 + result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; + result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; + result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); + result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; + result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); + + return result; + +} + +vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { + + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + + vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); + + return irradiance; + +} + +vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { + + vec3 irradiance = ambientLightColor; + + return irradiance; + +} + +float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { + + #if defined ( PHYSICALLY_CORRECT_LIGHTS ) + + // based upon Frostbite 3 Moving to Physically-based Rendering + // page 32, equation 26: E[window1] + // https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf + float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); + + if ( cutoffDistance > 0.0 ) { + + distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); + + } + + return distanceFalloff; + + #else + + if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) { + + return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent ); + + } + + return 1.0; + + #endif + +} + +float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { + + return smoothstep( coneCosine, penumbraCosine, angleCosine ); + +} + +#if NUM_DIR_LIGHTS > 0 + + struct DirectionalLight { + vec3 direction; + vec3 color; + }; + + uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; + + void getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) { + + light.color = directionalLight.color; + light.direction = directionalLight.direction; + light.visible = true; + + } + +#endif + + +#if NUM_POINT_LIGHTS > 0 + + struct PointLight { + vec3 position; + vec3 color; + float distance; + float decay; + }; + + uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; + + // light is an out parameter as having it as a return value caused compiler errors on some devices + void getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) { + + vec3 lVector = pointLight.position - geometry.position; + + light.direction = normalize( lVector ); + + float lightDistance = length( lVector ); + + light.color = pointLight.color; + light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + + } + +#endif + + +#if NUM_SPOT_LIGHTS > 0 + + struct SpotLight { + vec3 position; + vec3 direction; + vec3 color; + float distance; + float decay; + float coneCos; + float penumbraCos; + }; + + uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; + + // light is an out parameter as having it as a return value caused compiler errors on some devices + void getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) { + + vec3 lVector = spotLight.position - geometry.position; + + light.direction = normalize( lVector ); + + float angleCos = dot( light.direction, spotLight.direction ); + + float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); + + if ( spotAttenuation > 0.0 ) { + + float lightDistance = length( lVector ); + + light.color = spotLight.color * spotAttenuation; + light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + + } else { + + light.color = vec3( 0.0 ); + light.visible = false; + + } + + } + +#endif + + +#if NUM_RECT_AREA_LIGHTS > 0 + + struct RectAreaLight { + vec3 color; + vec3 position; + vec3 halfWidth; + vec3 halfHeight; + }; + + // Pre-computed values of LinearTransformedCosine approximation of BRDF + // BRDF approximation Texture is 64x64 + uniform sampler2D ltc_1; // RGBA Float + uniform sampler2D ltc_2; // RGBA Float + + uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; + +#endif + + +#if NUM_HEMI_LIGHTS > 0 + + struct HemisphereLight { + vec3 direction; + vec3 skyColor; + vec3 groundColor; + }; + + uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; + + vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { + + float dotNL = dot( normal, hemiLight.direction ); + float hemiDiffuseWeight = 0.5 * dotNL + 0.5; + + vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); + + return irradiance; + + } + +#endif +`;var Tn=` +#if defined( USE_ENVMAP ) + + #ifdef ENVMAP_MODE_REFRACTION + + uniform float refractionRatio; + + #endif + + vec3 getIBLIrradiance( const in vec3 normal ) { + + #if defined( ENVMAP_TYPE_CUBE_UV ) + + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + + vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 ); + + return PI * envMapColor.rgb * envMapIntensity; + + #else + + return vec3( 0.0 ); + + #endif + + } + + vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { + + #if defined( ENVMAP_TYPE_CUBE_UV ) + + vec3 reflectVec; + + #ifdef ENVMAP_MODE_REFLECTION + + reflectVec = reflect( - viewDir, normal ); + + // Mixing the reflection with the normal is more accurate and keeps rough objects from gathering light from behind their tangent plane. + reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); + + #else + + reflectVec = refract( - viewDir, normal, refractionRatio ); + + #endif + + reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); + + vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness ); + + return envMapColor.rgb * envMapIntensity; + + #else + + return vec3( 0.0 ); + + #endif + + } + +#endif +`;var Hn=` +ToonMaterial material; +material.diffuseColor = diffuseColor.rgb; +`;var Vn=` +varying vec3 vViewPosition; + +struct ToonMaterial { + + vec3 diffuseColor; + +}; + +void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + + vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color; + + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + +} + +void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + +} + +#define RE_Direct RE_Direct_Toon +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon + +#define Material_LightProbeLOD( material ) (0) +`;var Nn=` +BlinnPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength; +`;var Rn=` +varying vec3 vViewPosition; + +struct BlinnPhongMaterial { + + vec3 diffuseColor; + vec3 specularColor; + float specularShininess; + float specularStrength; + +}; + +void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + + float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + + reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength; + +} + +void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + +} + +#define RE_Direct RE_Direct_BlinnPhong +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong + +#define Material_LightProbeLOD( material ) (0) +`;var Fn=` +PhysicalMaterial material; +material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); + +vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) ); +float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); + +material.roughness = max( roughnessFactor, 0.0525 );// 0.0525 corresponds to the base mip of a 256 cubemap. +material.roughness += geometryRoughness; +material.roughness = min( material.roughness, 1.0 ); + +#ifdef IOR + + #ifdef SPECULAR + + float specularIntensityFactor = specularIntensity; + vec3 specularColorFactor = specularColor; + + #ifdef USE_SPECULARINTENSITYMAP + + specularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a; + + #endif + + #ifdef USE_SPECULARCOLORMAP + + specularColorFactor *= texture2D( specularColorMap, vUv ).rgb; + + #endif + + material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); + + #else + + float specularIntensityFactor = 1.0; + vec3 specularColorFactor = vec3( 1.0 ); + material.specularF90 = 1.0; + + #endif + + material.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); + +#else + + material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); + material.specularF90 = 1.0; + +#endif + +#ifdef USE_CLEARCOAT + + material.clearcoat = clearcoat; + material.clearcoatRoughness = clearcoatRoughness; + material.clearcoatF0 = vec3( 0.04 ); + material.clearcoatF90 = 1.0; + + #ifdef USE_CLEARCOATMAP + + material.clearcoat *= texture2D( clearcoatMap, vUv ).x; + + #endif + + #ifdef USE_CLEARCOAT_ROUGHNESSMAP + + material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y; + + #endif + + material.clearcoat = saturate( material.clearcoat ); // Burley clearcoat model + material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); + material.clearcoatRoughness += geometryRoughness; + material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); + +#endif + +#ifdef USE_SHEEN + + material.sheenColor = sheenColor; + + #ifdef USE_SHEENCOLORMAP + + material.sheenColor *= texture2D( sheenColorMap, vUv ).rgb; + + #endif + + material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); + + #ifdef USE_SHEENROUGHNESSMAP + + material.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a; + + #endif + +#endif +`;var Bn=` +struct PhysicalMaterial { + + vec3 diffuseColor; + float roughness; + vec3 specularColor; + float specularF90; + + #ifdef USE_CLEARCOAT + float clearcoat; + float clearcoatRoughness; + vec3 clearcoatF0; + float clearcoatF90; + #endif + + #ifdef USE_SHEEN + vec3 sheenColor; + float sheenRoughness; + #endif + +}; + +// temporary +vec3 clearcoatSpecular = vec3( 0.0 ); +vec3 sheenSpecular = vec3( 0.0 ); + +// This is a curve-fit approxmation to the "Charlie sheen" BRDF integrated over the hemisphere from +// Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF". The analysis can be found +// in the Sheen section of https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing +float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness) { + + float dotNV = saturate( dot( normal, viewDir ) ); + + float r2 = roughness * roughness; + + float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; + + float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; + + float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); + + return saturate( DG * RECIPROCAL_PI ); + +} + +// Analytical approximation of the DFG LUT, one half of the +// split-sum approximation used in indirect specular lighting. +// via 'environmentBRDF' from "Physically Based Shading on Mobile" +// https://www.unrealengine.com/blog/physically-based-shading-on-mobile +vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + + float dotNV = saturate( dot( normal, viewDir ) ); + + const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); + + const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); + + vec4 r = roughness * c0 + c1; + + float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; + + vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; + + return fab; + +} + +vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { + + vec2 fab = DFGApprox( normal, viewDir, roughness ); + + return specularColor * fab.x + specularF90 * fab.y; + +} + +// Fdez-Ag\xFCera's "Multiple-Scattering Microfacet Model for Real-Time Image Based Lighting" +// Approximates multiscattering in order to preserve energy. +// http://www.jcgt.org/published/0008/01/03/ +void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { + + vec2 fab = DFGApprox( normal, viewDir, roughness ); + + vec3 FssEss = specularColor * fab.x + specularF90 * fab.y; + + float Ess = fab.x + fab.y; + float Ems = 1.0 - Ess; + + vec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619; // 1/21 + vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); + + singleScatter += FssEss; + multiScatter += Fms * Ems; + +} + +#if NUM_RECT_AREA_LIGHTS > 0 + + void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + + vec3 normal = geometry.normal; + vec3 viewDir = geometry.viewDir; + vec3 position = geometry.position; + vec3 lightPos = rectAreaLight.position; + vec3 halfWidth = rectAreaLight.halfWidth; + vec3 halfHeight = rectAreaLight.halfHeight; + vec3 lightColor = rectAreaLight.color; + float roughness = material.roughness; + + vec3 rectCoords[ 4 ]; + rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; // counterclockwise; light shines in local neg z direction + rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; + rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; + rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; + + vec2 uv = LTC_Uv( normal, viewDir, roughness ); + + vec4 t1 = texture2D( ltc_1, uv ); + vec4 t2 = texture2D( ltc_2, uv ); + + mat3 mInv = mat3( + vec3( t1.x, 0, t1.y ), + vec3( 0, 1, 0 ), + vec3( t1.z, 0, t1.w ) + ); + + // LTC Fresnel Approximation by Stephen Hill + // http://blog.selfshadow.com/publications/s2016-advances/s2016_ltc_fresnel.pdf + vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); + + reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); + + reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); + + } + +#endif + +void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + + float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); + + vec3 irradiance = dotNL * directLight.color; + + #ifdef USE_CLEARCOAT + + float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) ); + + vec3 ccIrradiance = dotNLcc * directLight.color; + + clearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); + + #endif + + #ifdef USE_SHEEN + + sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness ); + + #endif + + reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness ); + + + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} + +void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + +} + +void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { + + #ifdef USE_CLEARCOAT + + clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); + + #endif + + #ifdef USE_SHEEN + + sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness ); + + #endif + + // Both indirect specular and indirect diffuse light accumulate here + + vec3 singleScattering = vec3( 0.0 ); + vec3 multiScattering = vec3( 0.0 ); + vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; + + computeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); + + vec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) ); + + reflectedLight.indirectSpecular += radiance * singleScattering; + reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; + + reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; + +} + +#define RE_Direct RE_Direct_Physical +#define RE_Direct_RectArea RE_Direct_RectArea_Physical +#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical +#define RE_IndirectSpecular RE_IndirectSpecular_Physical + +// ref: https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf +float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { + + return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); + +} +`;var Pn=` +/** + * This is a template that can be used to light a material, it uses pluggable + * RenderEquations (RE)for specific lighting scenarios. + * + * Instructions for use: + * - Ensure that both RE_Direct, RE_IndirectDiffuse and RE_IndirectSpecular are defined + * - If you have defined an RE_IndirectSpecular, you need to also provide a Material_LightProbeLOD. <---- ??? + * - Create a material parameter that is to be passed as the third parameter to your lighting functions. + * + * TODO: + * - Add area light support. + * - Add sphere light support. + * - Add diffuse light probe (irradiance cubemap) support. + */ + +GeometricContext geometry; + +geometry.position = - vViewPosition; +geometry.normal = normal; +geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); + +#ifdef USE_CLEARCOAT + + geometry.clearcoatNormal = clearcoatNormal; + +#endif + +IncidentLight directLight; + +#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) + + PointLight pointLight; + #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLightShadow; + #endif + + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { + + pointLight = pointLights[ i ]; + + getPointLightInfo( pointLight, geometry, directLight ); + + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) + pointLightShadow = pointLightShadows[ i ]; + directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + #endif + + RE_Direct( directLight, geometry, material, reflectedLight ); + + } + #pragma unroll_loop_end + +#endif + +#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) + + SpotLight spotLight; + #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLightShadow; + #endif + + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { + + spotLight = spotLights[ i ]; + + getSpotLightInfo( spotLight, geometry, directLight ); + + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + spotLightShadow = spotLightShadows[ i ]; + directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0; + #endif + + RE_Direct( directLight, geometry, material, reflectedLight ); + + } + #pragma unroll_loop_end + +#endif + +#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) + + DirectionalLight directionalLight; + #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLightShadow; + #endif + + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { + + directionalLight = directionalLights[ i ]; + + getDirectionalLightInfo( directionalLight, geometry, directLight ); + + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) + directionalLightShadow = directionalLightShadows[ i ]; + directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + #endif + + RE_Direct( directLight, geometry, material, reflectedLight ); + + } + #pragma unroll_loop_end + +#endif + +#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) + + RectAreaLight rectAreaLight; + + #pragma unroll_loop_start + for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { + + rectAreaLight = rectAreaLights[ i ]; + RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight ); + + } + #pragma unroll_loop_end + +#endif + +#if defined( RE_IndirectDiffuse ) + + vec3 iblIrradiance = vec3( 0.0 ); + + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + + irradiance += getLightProbeIrradiance( lightProbe, geometry.normal ); + + #if ( NUM_HEMI_LIGHTS > 0 ) + + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal ); + + } + #pragma unroll_loop_end + + #endif + +#endif + +#if defined( RE_IndirectSpecular ) + + vec3 radiance = vec3( 0.0 ); + vec3 clearcoatRadiance = vec3( 0.0 ); + +#endif +`;var In=` +#if defined( RE_IndirectDiffuse ) + + #ifdef USE_LIGHTMAP + + vec4 lightMapTexel = texture2D( lightMap, vUv2 ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + + #ifndef PHYSICALLY_CORRECT_LIGHTS + + lightMapIrradiance *= PI; + + #endif + + irradiance += lightMapIrradiance; + + #endif + + #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) + + iblIrradiance += getIBLIrradiance( geometry.normal ); + + #endif + +#endif + +#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) + + radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness ); + + #ifdef USE_CLEARCOAT + + clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness ); + + #endif + +#endif +`;var kn=` +#if defined( RE_IndirectDiffuse ) + + RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); + +#endif + +#if defined( RE_IndirectSpecular ) + + RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight ); + +#endif +`;var Un=` +#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) + + // Doing a strict comparison with == 1.0 can cause noise artifacts + // on some platforms. See issue #17623. + gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; + +#endif +`;var On=` +#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) + + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; + +#endif +`;var Gn=` +#ifdef USE_LOGDEPTHBUF + + #ifdef USE_LOGDEPTHBUF_EXT + + varying float vFragDepth; + varying float vIsPerspective; + + #else + + uniform float logDepthBufFC; + + #endif + +#endif +`;var qn=` +#ifdef USE_LOGDEPTHBUF + + #ifdef USE_LOGDEPTHBUF_EXT + + vFragDepth = 1.0 + gl_Position.w; + vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); + + #else + + if ( isPerspectiveMatrix( projectionMatrix ) ) { + + gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0; + + gl_Position.z *= gl_Position.w; + + } + + #endif + +#endif +`;var Wn=` +#ifdef USE_MAP + + vec4 sampledDiffuseColor = texture2D( map, vUv ); + + #ifdef DECODE_VIDEO_TEXTURE + + // inline sRGB decode (TODO: Remove this code when https://crbug.com/1256340 is solved) + + sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w ); + + #endif + + diffuseColor *= sampledDiffuseColor; + +#endif +`;var jn=` +#ifdef USE_MAP + + uniform sampler2D map; + +#endif +`;var Xn=` +#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + + vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; + +#endif + +#ifdef USE_MAP + + diffuseColor *= texture2D( map, uv ); + +#endif + +#ifdef USE_ALPHAMAP + + diffuseColor.a *= texture2D( alphaMap, uv ).g; + +#endif +`;var Zn=` +#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + + uniform mat3 uvTransform; + +#endif + +#ifdef USE_MAP + + uniform sampler2D map; + +#endif + +#ifdef USE_ALPHAMAP + + uniform sampler2D alphaMap; + +#endif +`;var Yn=` +float metalnessFactor = metalness; + +#ifdef USE_METALNESSMAP + + vec4 texelMetalness = texture2D( metalnessMap, vUv ); + + // reads channel B, compatible with a combined OcclusionRoughnessMetallic (RGB) texture + metalnessFactor *= texelMetalness.b; + +#endif +`;var $n=` +#ifdef USE_METALNESSMAP + + uniform sampler2D metalnessMap; + +#endif +`;var Kn=` +#ifdef USE_MORPHNORMALS + + // morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value: + // When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in normal = sum((target - base) * influence) + // When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting + objectNormal *= morphTargetBaseInfluence; + + #ifdef MORPHTARGETS_TEXTURE + + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + + if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1, 2 ) * morphTargetInfluences[ i ]; + + } + + #else + + objectNormal += morphNormal0 * morphTargetInfluences[ 0 ]; + objectNormal += morphNormal1 * morphTargetInfluences[ 1 ]; + objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; + objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; + + #endif + +#endif +`;var Jn=` +#ifdef USE_MORPHTARGETS + + uniform float morphTargetBaseInfluence; + + #ifdef MORPHTARGETS_TEXTURE + + uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + uniform sampler2DArray morphTargetsTexture; + uniform vec2 morphTargetsTextureSize; + + vec3 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset, const in int stride ) { + + float texelIndex = float( vertexIndex * stride + offset ); + float y = floor( texelIndex / morphTargetsTextureSize.x ); + float x = texelIndex - y * morphTargetsTextureSize.x; + + vec3 morphUV = vec3( ( x + 0.5 ) / morphTargetsTextureSize.x, y / morphTargetsTextureSize.y, morphTargetIndex ); + return texture( morphTargetsTexture, morphUV ).xyz; + + } + + #else + + #ifndef USE_MORPHNORMALS + + uniform float morphTargetInfluences[ 8 ]; + + #else + + uniform float morphTargetInfluences[ 4 ]; + + #endif + + #endif + +#endif +`;var Qn=` +#ifdef USE_MORPHTARGETS + + // morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value: + // When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in position = sum((target - base) * influence) + // When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting + transformed *= morphTargetBaseInfluence; + + #ifdef MORPHTARGETS_TEXTURE + + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + + #ifndef USE_MORPHNORMALS + + if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 1 ) * morphTargetInfluences[ i ]; + + #else + + if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 2 ) * morphTargetInfluences[ i ]; + + #endif + + } + + #else + + transformed += morphTarget0 * morphTargetInfluences[ 0 ]; + transformed += morphTarget1 * morphTargetInfluences[ 1 ]; + transformed += morphTarget2 * morphTargetInfluences[ 2 ]; + transformed += morphTarget3 * morphTargetInfluences[ 3 ]; + + #ifndef USE_MORPHNORMALS + + transformed += morphTarget4 * morphTargetInfluences[ 4 ]; + transformed += morphTarget5 * morphTargetInfluences[ 5 ]; + transformed += morphTarget6 * morphTargetInfluences[ 6 ]; + transformed += morphTarget7 * morphTargetInfluences[ 7 ]; + + #endif + + #endif + +#endif +`;var es=` +float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; + +#ifdef FLAT_SHADED + + // Workaround for Adreno GPUs not able to do dFdx( vViewPosition ) + + vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) ); + vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) ); + vec3 normal = normalize( cross( fdx, fdy ) ); + +#else + + vec3 normal = normalize( vNormal ); + + #ifdef DOUBLE_SIDED + + normal = normal * faceDirection; + + #endif + + #ifdef USE_TANGENT + + vec3 tangent = normalize( vTangent ); + vec3 bitangent = normalize( vBitangent ); + + #ifdef DOUBLE_SIDED + + tangent = tangent * faceDirection; + bitangent = bitangent * faceDirection; + + #endif + + #if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP ) + + mat3 vTBN = mat3( tangent, bitangent, normal ); + + #endif + + #endif + +#endif + +// non perturbed normal for clearcoat among others + +vec3 geometryNormal = normal; + +`;var ts=` + +#ifdef OBJECTSPACE_NORMALMAP + + normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; // overrides both flatShading and attribute normals + + #ifdef FLIP_SIDED + + normal = - normal; + + #endif + + #ifdef DOUBLE_SIDED + + normal = normal * faceDirection; + + #endif + + normal = normalize( normalMatrix * normal ); + +#elif defined( TANGENTSPACE_NORMALMAP ) + + vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; + mapN.xy *= normalScale; + + #ifdef USE_TANGENT + + normal = normalize( vTBN * mapN ); + + #else + + normal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection ); + + #endif + +#elif defined( USE_BUMPMAP ) + + normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); + +#endif +`;var is=` +#ifndef FLAT_SHADED + + varying vec3 vNormal; + + #ifdef USE_TANGENT + + varying vec3 vTangent; + varying vec3 vBitangent; + + #endif + +#endif +`;var as=` +#ifndef FLAT_SHADED + + varying vec3 vNormal; + + #ifdef USE_TANGENT + + varying vec3 vTangent; + varying vec3 vBitangent; + + #endif + +#endif +`;var rs=` +#ifndef FLAT_SHADED // normal is computed with derivatives when FLAT_SHADED + + vNormal = normalize( transformedNormal ); + + #ifdef USE_TANGENT + + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + + #endif + +#endif +`;var ns=` +#ifdef USE_NORMALMAP + + uniform sampler2D normalMap; + uniform vec2 normalScale; + +#endif + +#ifdef OBJECTSPACE_NORMALMAP + + uniform mat3 normalMatrix; + +#endif + +#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) ) + + // Normal Mapping Without Precomputed Tangents + // http://www.thetenthplanet.de/archives/1180 + + vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) { + + // Workaround for Adreno 3XX dFd*( vec3 ) bug. See #9988 + + vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) ); + vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) ); + vec2 st0 = dFdx( vUv.st ); + vec2 st1 = dFdy( vUv.st ); + + vec3 N = surf_norm; // normalized + + vec3 q1perp = cross( q1, N ); + vec3 q0perp = cross( N, q0 ); + + vec3 T = q1perp * st0.x + q0perp * st1.x; + vec3 B = q1perp * st0.y + q0perp * st1.y; + + float det = max( dot( T, T ), dot( B, B ) ); + float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det ); + + return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z ); + + } + +#endif +`;var ss=` +#ifdef USE_CLEARCOAT + + vec3 clearcoatNormal = geometryNormal; + +#endif +`;var os=` +#ifdef USE_CLEARCOAT_NORMALMAP + + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + + #ifdef USE_TANGENT + + clearcoatNormal = normalize( vTBN * clearcoatMapN ); + + #else + + clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection ); + + #endif + +#endif +`;var cs=` + +#ifdef USE_CLEARCOATMAP + + uniform sampler2D clearcoatMap; + +#endif + +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + + uniform sampler2D clearcoatRoughnessMap; + +#endif + +#ifdef USE_CLEARCOAT_NORMALMAP + + uniform sampler2D clearcoatNormalMap; + uniform vec2 clearcoatNormalScale; + +#endif +`;var ls=` +#ifdef OPAQUE +diffuseColor.a = 1.0; +#endif + +// https://github.com/mrdoob/three.js/pull/22425 +#ifdef USE_TRANSMISSION +diffuseColor.a *= transmissionAlpha + 0.1; +#endif + +gl_FragColor = vec4( outgoingLight, diffuseColor.a ); +`;var us=` +vec3 packNormalToRGB( const in vec3 normal ) { + return normalize( normal ) * 0.5 + 0.5; +} + +vec3 unpackRGBToNormal( const in vec3 rgb ) { + return 2.0 * rgb.xyz - 1.0; +} + +const float PackUpscale = 256. / 255.; // fraction -> 0..1 (including 1) +const float UnpackDownscale = 255. / 256.; // 0..1 -> fraction (excluding 1) + +const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. ); +const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. ); + +const float ShiftRight8 = 1. / 256.; + +vec4 packDepthToRGBA( const in float v ) { + vec4 r = vec4( fract( v * PackFactors ), v ); + r.yzw -= r.xyz * ShiftRight8; // tidy overflow + return r * PackUpscale; +} + +float unpackRGBAToDepth( const in vec4 v ) { + return dot( v, UnpackFactors ); +} + +vec4 pack2HalfToRGBA( vec2 v ) { + vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); + return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); +} + +vec2 unpackRGBATo2Half( vec4 v ) { + return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); +} + +// NOTE: viewZ/eyeZ is < 0 when in front of the camera per OpenGL conventions + +float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { + return ( viewZ + near ) / ( near - far ); +} +float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) { + return linearClipZ * ( near - far ) - near; +} + +// NOTE: https://twitter.com/gonnavis/status/1377183786949959682 + +float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { + return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); +} +float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) { + return ( near * far ) / ( ( far - near ) * invClipZ - far ); +} +`;var hs=` +#ifdef PREMULTIPLIED_ALPHA + + // Get get normal blending with premultipled, use with CustomBlending, OneFactor, OneMinusSrcAlphaFactor, AddEquation. + gl_FragColor.rgb *= gl_FragColor.a; + +#endif +`;var fs=` +vec4 mvPosition = vec4( transformed, 1.0 ); + +#ifdef USE_INSTANCING + + mvPosition = instanceMatrix * mvPosition; + +#endif + +mvPosition = modelViewMatrix * mvPosition; + +gl_Position = projectionMatrix * mvPosition; +`;var ds=` +#ifdef DITHERING + + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); + +#endif +`;var ps=` +#ifdef DITHERING + + // based on https://www.shadertoy.com/view/MslGR8 + vec3 dithering( vec3 color ) { + //Calculate grid position + float grid_position = rand( gl_FragCoord.xy ); + + //Shift the individual colors differently, thus making it even harder to see the dithering pattern + vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); + + //modify shift acording to grid position. + dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); + + //shift the color by dither_shift + return color + dither_shift_RGB; + } + +#endif +`;var ms=` +float roughnessFactor = roughness; + +#ifdef USE_ROUGHNESSMAP + + vec4 texelRoughness = texture2D( roughnessMap, vUv ); + + // reads channel G, compatible with a combined OcclusionRoughnessMetallic (RGB) texture + roughnessFactor *= texelRoughness.g; + +#endif +`;var vs=` +#ifdef USE_ROUGHNESSMAP + + uniform sampler2D roughnessMap; + +#endif +`;var gs=` +#ifdef USE_SHADOWMAP + + #if NUM_DIR_LIGHT_SHADOWS > 0 + + uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + + struct DirectionalLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + + #endif + + #if NUM_SPOT_LIGHT_SHADOWS > 0 + + uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ]; + + struct SpotLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + + #endif + + #if NUM_POINT_LIGHT_SHADOWS > 0 + + uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + + struct PointLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + + #endif + + /* + #if NUM_RECT_AREA_LIGHTS > 0 + + // TODO (abelnation): create uniforms for area light shadows + + #endif + */ + + float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { + + return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); + + } + + vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { + + return unpackRGBATo2Half( texture2D( shadow, uv ) ); + + } + + float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ + + float occlusion = 1.0; + + vec2 distribution = texture2DDistribution( shadow, uv ); + + float hard_shadow = step( compare , distribution.x ); // Hard Shadow + + if (hard_shadow != 1.0 ) { + + float distance = compare - distribution.x ; + float variance = max( 0.00000, distribution.y * distribution.y ); + float softness_probability = variance / (variance + distance * distance ); // Chebeyshevs inequality + softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); // 0.3 reduces light bleed + occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); + + } + return occlusion; + + } + + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + + float shadow = 1.0; + + shadowCoord.xyz /= shadowCoord.w; + shadowCoord.z += shadowBias; + + // if ( something && something ) breaks ATI OpenGL shader compiler + // if ( all( something, something ) ) using this instead + + bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 ); + bool inFrustum = all( inFrustumVec ); + + bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 ); + + bool frustumTest = all( frustumTestVec ); + + if ( frustumTest ) { + + #if defined( SHADOWMAP_TYPE_PCF ) + + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + + float dx0 = - texelSize.x * shadowRadius; + float dy0 = - texelSize.y * shadowRadius; + float dx1 = + texelSize.x * shadowRadius; + float dy1 = + texelSize.y * shadowRadius; + float dx2 = dx0 / 2.0; + float dy2 = dy0 / 2.0; + float dx3 = dx1 / 2.0; + float dy3 = dy1 / 2.0; + + shadow = ( + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) + ) * ( 1.0 / 17.0 ); + + #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) + + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float dx = texelSize.x; + float dy = texelSize.y; + + vec2 uv = shadowCoord.xy; + vec2 f = fract( uv * shadowMapSize + 0.5 ); + uv -= f * texelSize; + + shadow = ( + texture2DCompare( shadowMap, uv, shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), + f.x ), + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), + f.x ), + f.y ) + ) * ( 1.0 / 9.0 ); + + #elif defined( SHADOWMAP_TYPE_VSM ) + + shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); + + #else // no percentage-closer filtering: + + shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); + + #endif + + } + + return shadow; + + } + + // cubeToUV() maps a 3D direction vector suitable for cube texture mapping to a 2D + // vector suitable for 2D texture mapping. This code uses the following layout for the + // 2D texture: + // + // xzXZ + // y Y + // + // Y - Positive y direction + // y - Negative y direction + // X - Positive x direction + // x - Negative x direction + // Z - Positive z direction + // z - Negative z direction + // + // Source and test bed: + // https://gist.github.com/tschw/da10c43c467ce8afd0c4 + + vec2 cubeToUV( vec3 v, float texelSizeY ) { + + // Number of texels to avoid at the edge of each square + + vec3 absV = abs( v ); + + // Intersect unit cube + + float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); + absV *= scaleToCube; + + // Apply scale to avoid seams + + // two texels less per square (one texel will do for NEAREST) + v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); + + // Unwrap + + // space: -1 ... 1 range for each square + // + // #X## dim := ( 4 , 2 ) + // # # center := ( 1 , 1 ) + + vec2 planar = v.xy; + + float almostATexel = 1.5 * texelSizeY; + float almostOne = 1.0 - almostATexel; + + if ( absV.z >= almostOne ) { + + if ( v.z > 0.0 ) + planar.x = 4.0 - v.x; + + } else if ( absV.x >= almostOne ) { + + float signX = sign( v.x ); + planar.x = v.z * signX + 2.0 * signX; + + } else if ( absV.y >= almostOne ) { + + float signY = sign( v.y ); + planar.x = v.x + 2.0 * signY + 2.0; + planar.y = v.z * signY - 2.0; + + } + + // Transform to UV space + + // scale := 0.5 / dim + // translate := ( center + 0.5 ) / dim + return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); + + } + + float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + + vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); + + // for point lights, the uniform @vShadowCoord is re-purposed to hold + // the vector from the light to the world-space position of the fragment. + vec3 lightToPosition = shadowCoord.xyz; + + // dp = normalized distance from light to fragment position + float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); // need to clamp? + dp += shadowBias; + + // bd3D = base direction 3D + vec3 bd3D = normalize( lightToPosition ); + + #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) + + vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; + + return ( + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) + ) * ( 1.0 / 9.0 ); + + #else // no percentage-closer filtering + + return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); + + #endif + + } + +#endif +`;var xs=` +#ifdef USE_SHADOWMAP + + #if NUM_DIR_LIGHT_SHADOWS > 0 + + uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + + struct DirectionalLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + + #endif + + #if NUM_SPOT_LIGHT_SHADOWS > 0 + + uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ]; + varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ]; + + struct SpotLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + + #endif + + #if NUM_POINT_LIGHT_SHADOWS > 0 + + uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + + struct PointLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + + #endif + + /* + #if NUM_RECT_AREA_LIGHTS > 0 + + // TODO (abelnation): uniforms for area light shadows + + #endif + */ + +#endif +`;var Ms=` +#ifdef USE_SHADOWMAP + + #if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 + + // Offsetting the position used for querying occlusion along the world normal can be used to reduce shadow acne. + vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + vec4 shadowWorldPosition; + + #endif + + #if NUM_DIR_LIGHT_SHADOWS > 0 + + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); + vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; + + } + #pragma unroll_loop_end + + #endif + + #if NUM_SPOT_LIGHT_SHADOWS > 0 + + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { + + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 ); + vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition; + + } + #pragma unroll_loop_end + + #endif + + #if NUM_POINT_LIGHT_SHADOWS > 0 + + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); + vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; + + } + #pragma unroll_loop_end + + #endif + + /* + #if NUM_RECT_AREA_LIGHTS > 0 + + // TODO (abelnation): update vAreaShadowCoord with area light info + + #endif + */ + +#endif +`;var bs=` +float getShadowMask() { + + float shadow = 1.0; + + #ifdef USE_SHADOWMAP + + #if NUM_DIR_LIGHT_SHADOWS > 0 + + DirectionalLightShadow directionalLight; + + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + + directionalLight = directionalLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + + } + #pragma unroll_loop_end + + #endif + + #if NUM_SPOT_LIGHT_SHADOWS > 0 + + SpotLightShadow spotLight; + + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { + + spotLight = spotLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0; + + } + #pragma unroll_loop_end + + #endif + + #if NUM_POINT_LIGHT_SHADOWS > 0 + + PointLightShadow pointLight; + + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + + pointLight = pointLightShadows[ i ]; + shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + + } + #pragma unroll_loop_end + + #endif + + /* + #if NUM_RECT_AREA_LIGHTS > 0 + + // TODO (abelnation): update shadow for Area light + + #endif + */ + + #endif + + return shadow; + +} +`;var ys=` +#ifdef USE_SKINNING + + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); + +#endif +`;var Cs=` +#ifdef USE_SKINNING + + uniform mat4 bindMatrix; + uniform mat4 bindMatrixInverse; + + #ifdef BONE_TEXTURE + + uniform highp sampler2D boneTexture; + uniform int boneTextureSize; + + mat4 getBoneMatrix( const in float i ) { + + float j = i * 4.0; + float x = mod( j, float( boneTextureSize ) ); + float y = floor( j / float( boneTextureSize ) ); + + float dx = 1.0 / float( boneTextureSize ); + float dy = 1.0 / float( boneTextureSize ); + + y = dy * ( y + 0.5 ); + + vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) ); + vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) ); + vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) ); + vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) ); + + mat4 bone = mat4( v1, v2, v3, v4 ); + + return bone; + + } + + #else + + uniform mat4 boneMatrices[ MAX_BONES ]; + + mat4 getBoneMatrix( const in float i ) { + + mat4 bone = boneMatrices[ int(i) ]; + return bone; + + } + + #endif + +#endif +`;var zs=` +#ifdef USE_SKINNING + + vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); + + vec4 skinned = vec4( 0.0 ); + skinned += boneMatX * skinVertex * skinWeight.x; + skinned += boneMatY * skinVertex * skinWeight.y; + skinned += boneMatZ * skinVertex * skinWeight.z; + skinned += boneMatW * skinVertex * skinWeight.w; + + transformed = ( bindMatrixInverse * skinned ).xyz; + +#endif +`;var As=` +#ifdef USE_SKINNING + + mat4 skinMatrix = mat4( 0.0 ); + skinMatrix += skinWeight.x * boneMatX; + skinMatrix += skinWeight.y * boneMatY; + skinMatrix += skinWeight.z * boneMatZ; + skinMatrix += skinWeight.w * boneMatW; + skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; + + objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; + + #ifdef USE_TANGENT + + objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; + + #endif + +#endif +`;var ws=` +float specularStrength; + +#ifdef USE_SPECULARMAP + + vec4 texelSpecular = texture2D( specularMap, vUv ); + specularStrength = texelSpecular.r; + +#else + + specularStrength = 1.0; + +#endif +`;var _s=` +#ifdef USE_SPECULARMAP + + uniform sampler2D specularMap; + +#endif +`;var Ss=` +#if defined( TONE_MAPPING ) + + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); + +#endif +`;var Es=` +#ifndef saturate +// may have defined saturate() already +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif + +uniform float toneMappingExposure; + +// exposure only +vec3 LinearToneMapping( vec3 color ) { + + return toneMappingExposure * color; + +} + +// source: https://www.cs.utah.edu/docs/techreports/2002/pdf/UUCS-02-001.pdf +vec3 ReinhardToneMapping( vec3 color ) { + + color *= toneMappingExposure; + return saturate( color / ( vec3( 1.0 ) + color ) ); + +} + +// source: http://filmicworlds.com/blog/filmic-tonemapping-operators/ +vec3 OptimizedCineonToneMapping( vec3 color ) { + + // optimized filmic operator by Jim Hejl and Richard Burgess-Dawson + color *= toneMappingExposure; + color = max( vec3( 0.0 ), color - 0.004 ); + return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); + +} + +// source: https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs +vec3 RRTAndODTFit( vec3 v ) { + + vec3 a = v * ( v + 0.0245786 ) - 0.000090537; + vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; + return a / b; + +} + +// this implementation of ACES is modified to accommodate a brighter viewing environment. +// the scale factor of 1/0.6 is subjective. see discussion in #19621. + +vec3 ACESFilmicToneMapping( vec3 color ) { + + // sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT + const mat3 ACESInputMat = mat3( + vec3( 0.59719, 0.07600, 0.02840 ), // transposed from source + vec3( 0.35458, 0.90834, 0.13383 ), + vec3( 0.04823, 0.01566, 0.83777 ) + ); + + // ODT_SAT => XYZ => D60_2_D65 => sRGB + const mat3 ACESOutputMat = mat3( + vec3( 1.60475, -0.10208, -0.00327 ), // transposed from source + vec3( -0.53108, 1.10813, -0.07276 ), + vec3( -0.07367, -0.00605, 1.07602 ) + ); + + color *= toneMappingExposure / 0.6; + + color = ACESInputMat * color; + + // Apply RRT and ODT + color = RRTAndODTFit( color ); + + color = ACESOutputMat * color; + + // Clamp to [0, 1] + return saturate( color ); + +} + +vec3 CustomToneMapping( vec3 color ) { return color; } +`;var Ls=` +#ifdef USE_TRANSMISSION + + float transmissionAlpha = 1.0; + float transmissionFactor = transmission; + float thicknessFactor = thickness; + + #ifdef USE_TRANSMISSIONMAP + + transmissionFactor *= texture2D( transmissionMap, vUv ).r; + + #endif + + #ifdef USE_THICKNESSMAP + + thicknessFactor *= texture2D( thicknessMap, vUv ).g; + + #endif + + vec3 pos = vWorldPosition; + vec3 v = normalize( cameraPosition - pos ); + vec3 n = inverseTransformDirection( normal, viewMatrix ); + + vec4 transmission = getIBLVolumeRefraction( + n, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90, + pos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor, + attenuationColor, attenuationDistance ); + + totalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor ); + transmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor ); +#endif +`;var Ds=` +#ifdef USE_TRANSMISSION + + // Transmission code is based on glTF-Sampler-Viewer + // https://github.com/KhronosGroup/glTF-Sample-Viewer + + uniform float transmission; + uniform float thickness; + uniform float attenuationDistance; + uniform vec3 attenuationColor; + + #ifdef USE_TRANSMISSIONMAP + + uniform sampler2D transmissionMap; + + #endif + + #ifdef USE_THICKNESSMAP + + uniform sampler2D thicknessMap; + + #endif + + uniform vec2 transmissionSamplerSize; + uniform sampler2D transmissionSamplerMap; + + uniform mat4 modelMatrix; + uniform mat4 projectionMatrix; + + varying vec3 vWorldPosition; + + vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { + + // Direction of refracted light. + vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); + + // Compute rotation-independant scaling of the model matrix. + vec3 modelScale; + modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); + modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); + modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); + + // The thickness is specified in local space. + return normalize( refractionVector ) * thickness * modelScale; + + } + + float applyIorToRoughness( const in float roughness, const in float ior ) { + + // Scale roughness with IOR so that an IOR of 1.0 results in no microfacet refraction and + // an IOR of 1.5 results in the default amount of microfacet refraction. + return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); + + } + + vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { + + float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); + + #ifdef TEXTURE_LOD_EXT + + return texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod ); + + #else + + return texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod ); + + #endif + + } + + vec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { + + if ( attenuationDistance == 0.0 ) { + + // Attenuation distance is +\u221E (which we indicate by zero), i.e. the transmitted color is not attenuated at all. + return radiance; + + } else { + + // Compute light attenuation using Beer's law. + vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; + vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); // Beer's law + return transmittance * radiance; + + } + + } + + vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, + const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, + const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness, + const in vec3 attenuationColor, const in float attenuationDistance ) { + + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + + // Project refracted vector on the framebuffer, while mapping to normalized device coordinates. + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + + // Sample framebuffer to get pixel the refracted ray hits. + vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); + + vec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance ); + + // Get the specular component. + vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); + + return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a ); + + } +#endif +`;var Ts=` +#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) ) + + varying vec2 vUv; + +#endif +`;var Hs=` +#ifdef USE_UV + + #ifdef UVS_VERTEX_ONLY + + vec2 vUv; + + #else + + varying vec2 vUv; + + #endif + + uniform mat3 uvTransform; + +#endif +`;var Vs=` +#ifdef USE_UV + + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + +#endif +`;var Ns=` +#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) + + varying vec2 vUv2; + +#endif +`;var Rs=` +#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) + + attribute vec2 uv2; + varying vec2 vUv2; + + uniform mat3 uv2Transform; + +#endif +`;var Fs=` +#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) + + vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy; + +#endif +`;var Bs=` +#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) + + vec4 worldPosition = vec4( transformed, 1.0 ); + + #ifdef USE_INSTANCING + + worldPosition = instanceMatrix * worldPosition; + + #endif + + worldPosition = modelMatrix * worldPosition; + +#endif +`;var Ps=` +varying vec2 vUv; +uniform mat3 uvTransform; + +void main() { + + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + + gl_Position = vec4( position.xy, 1.0, 1.0 ); + +} +`,Is=` +uniform sampler2D t2D; + +varying vec2 vUv; + +void main() { + + gl_FragColor = texture2D( t2D, vUv ); + + #include + #include + +} +`;var ks=` +varying vec3 vWorldDirection; + +#include + +void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + gl_Position.z = gl_Position.w; // set z to camera.far + +} +`,Us=` +#include +uniform float opacity; + +varying vec3 vWorldDirection; + +#include + +void main() { + + vec3 vReflect = vWorldDirection; + #include + + gl_FragColor = envColor; + gl_FragColor.a *= opacity; + + #include + #include + +} +`;var Os=` +#include +#include +#include +#include +#include +#include +#include + +// This is used for computing an equivalent of gl_FragCoord.z that is as high precision as possible. +// Some platforms compute gl_FragCoord at a lower precision which makes the manually computed value better for +// depth-based postprocessing effects. Reproduced on iPad with A10 processor / iPadOS 13.3.1. +varying vec2 vHighPrecisionZW; + +void main() { + + #include + + #include + + #ifdef USE_DISPLACEMENTMAP + + #include + #include + #include + + #endif + + #include + #include + #include + #include + #include + #include + #include + + vHighPrecisionZW = gl_Position.zw; + +} +`,Gs=` +#if DEPTH_PACKING == 3200 + + uniform float opacity; + +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +varying vec2 vHighPrecisionZW; + +void main() { + + #include + + vec4 diffuseColor = vec4( 1.0 ); + + #if DEPTH_PACKING == 3200 + + diffuseColor.a = opacity; + + #endif + + #include + #include + #include + + #include + + // Higher precision equivalent of gl_FragCoord.z. This assumes depthRange has been left to its default values. + float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; + + #if DEPTH_PACKING == 3200 + + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); + + #elif DEPTH_PACKING == 3201 + + gl_FragColor = packDepthToRGBA( fragCoordZ ); + + #endif + +} +`;var qs=` +#define DISTANCE + +varying vec3 vWorldPosition; + +#include +#include +#include +#include +#include +#include + +void main() { + + #include + + #include + + #ifdef USE_DISPLACEMENTMAP + + #include + #include + #include + + #endif + + #include + #include + #include + #include + #include + #include + #include + + vWorldPosition = worldPosition.xyz; + +} +`,Ws=` +#define DISTANCE + +uniform vec3 referencePosition; +uniform float nearDistance; +uniform float farDistance; +varying vec3 vWorldPosition; + +#include +#include +#include +#include +#include +#include +#include + +void main () { + + #include + + vec4 diffuseColor = vec4( 1.0 ); + + #include + #include + #include + + float dist = length( vWorldPosition - referencePosition ); + dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); + dist = saturate( dist ); // clamp to [ 0, 1 ] + + gl_FragColor = packDepthToRGBA( dist ); + +} +`;var js=` +varying vec3 vWorldDirection; + +#include + +void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + +} +`,Xs=` +uniform sampler2D tEquirect; + +varying vec3 vWorldDirection; + +#include + +void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + #include + #include + +} +`;var Zs=` +uniform float scale; +attribute float lineDistance; + +varying float vLineDistance; + +#include +#include +#include +#include +#include +#include + +void main() { + + vLineDistance = scale * lineDistance; + + #include + #include + #include + #include + #include + #include + #include + +} +`,Ys=` +uniform vec3 diffuse; +uniform float opacity; + +uniform float dashSize; +uniform float totalSize; + +varying float vLineDistance; + +#include +#include +#include +#include +#include + +void main() { + + #include + + if ( mod( vLineDistance, totalSize ) > dashSize ) { + + discard; + + } + + vec3 outgoingLight = vec3( 0.0 ); + vec4 diffuseColor = vec4( diffuse, opacity ); + + #include + #include + + outgoingLight = diffuseColor.rgb; // simple shader + + #include + #include + #include + #include + #include + +} +`;var $s=` +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + #include + #include + + #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) + + #include + #include + #include + #include + #include + + #endif + + #include + #include + #include + #include + #include + #include + + #include + #include + #include + +} +`,Ks=` +uniform vec3 diffuse; +uniform float opacity; + +#ifndef FLAT_SHADED + + varying vec3 vNormal; + +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + + vec4 diffuseColor = vec4( diffuse, opacity ); + + #include + #include + #include + #include + #include + #include + + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + + // accumulation (baked indirect lighting only) + #ifdef USE_LIGHTMAP + + vec4 lightMapTexel= texture2D( lightMap, vUv2 ); + reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity; + + #else + + reflectedLight.indirectDiffuse += vec3( 1.0 ); + + #endif + + // modulation + #include + + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + + vec3 outgoingLight = reflectedLight.indirectDiffuse; + + #include + + #include + #include + #include + #include + #include + #include + +} +`;var Js=` +#define LAMBERT + +varying vec3 vLightFront; +varying vec3 vIndirectFront; + +#ifdef DOUBLE_SIDED + varying vec3 vLightBack; + varying vec3 vIndirectBack; +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + #include + #include + + #include + #include + #include + #include + #include + + #include + #include + #include + #include + #include + #include + + #include + #include + #include + #include + #include +} +`,Qs=` +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; + +varying vec3 vLightFront; +varying vec3 vIndirectFront; + +#ifdef DOUBLE_SIDED + varying vec3 vLightBack; + varying vec3 vIndirectBack; +#endif + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + + vec4 diffuseColor = vec4( diffuse, opacity ); + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + + #include + #include + #include + #include + #include + #include + #include + + // accumulation + + #ifdef DOUBLE_SIDED + + reflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack; + + #else + + reflectedLight.indirectDiffuse += vIndirectFront; + + #endif + + #include + + reflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb ); + + #ifdef DOUBLE_SIDED + + reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack; + + #else + + reflectedLight.directDiffuse = vLightFront; + + #endif + + reflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask(); + + // modulation + + #include + + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + + #include + + #include + #include + #include + #include + #include + #include +} +`;var e5=` +#define MATCAP + +varying vec3 vViewPosition; + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +void main() { + + #include + #include + #include + #include + #include + #include + #include + #include + + #include + #include + #include + #include + #include + + #include + #include + #include + + vViewPosition = - mvPosition.xyz; + +} +`,t5=` +#define MATCAP + +uniform vec3 diffuse; +uniform float opacity; +uniform sampler2D matcap; + +varying vec3 vViewPosition; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + + vec4 diffuseColor = vec4( diffuse, opacity ); + + #include + #include + #include + #include + #include + #include + #include + + vec3 viewDir = normalize( vViewPosition ); + vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); + vec3 y = cross( viewDir, x ); + vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; // 0.495 to remove artifacts caused by undersized matcap disks + + #ifdef USE_MATCAP + + vec4 matcapColor = texture2D( matcap, uv ); + + #else + + vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); // default if matcap is missing + + #endif + + vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; + + #include + #include + #include + #include + #include + #include + +} +`;var i5=` +#define NORMAL + +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) + + varying vec3 vViewPosition; + +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + + #include + #include + #include + #include + #include + #include + + #include + #include + #include + #include + #include + #include + #include + +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) + + vViewPosition = - mvPosition.xyz; + +#endif + +} +`,a5=` +#define NORMAL + +uniform float opacity; + +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) + + varying vec3 vViewPosition; + +#endif + +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + #include + #include + #include + + gl_FragColor = vec4( packNormalToRGB( normal ), opacity ); + +} +`;var r5=` +#define PHONG + +varying vec3 vViewPosition; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + #include + #include + + #include + #include + #include + #include + #include + #include + + #include + #include + #include + #include + #include + #include + #include + + vViewPosition = - mvPosition.xyz; + + #include + #include + #include + #include + +} +`,n5=` +#define PHONG + +uniform vec3 diffuse; +uniform vec3 emissive; +uniform vec3 specular; +uniform float shininess; +uniform float opacity; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + + vec4 diffuseColor = vec4( diffuse, opacity ); + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + + #include + #include + #include + #include + #include + #include + #include + #include + #include + + // accumulation + #include + #include + #include + #include + + // modulation + #include + + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; + + #include + #include + #include + #include + #include + #include + #include + +} +`;var s5=` +#define STANDARD + +varying vec3 vViewPosition; + +#ifdef USE_TRANSMISSION + + varying vec3 vWorldPosition; + +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + #include + #include + + #include + #include + #include + #include + #include + #include + + #include + #include + #include + #include + #include + #include + #include + + vViewPosition = - mvPosition.xyz; + + #include + #include + #include + +#ifdef USE_TRANSMISSION + + vWorldPosition = worldPosition.xyz; + +#endif +} +`,o5=` +#define STANDARD + +#ifdef PHYSICAL + #define IOR + #define SPECULAR +#endif + +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; + +#ifdef IOR + uniform float ior; +#endif + +#ifdef SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + + #ifdef USE_SPECULARINTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif + + #ifdef USE_SPECULARCOLORMAP + uniform sampler2D specularColorMap; + #endif +#endif + +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif + +#ifdef USE_SHEEN + uniform vec3 sheenColor; + uniform float sheenRoughness; + + #ifdef USE_SHEENCOLORMAP + uniform sampler2D sheenColorMap; + #endif + + #ifdef USE_SHEENROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif + +varying vec3 vViewPosition; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + + vec4 diffuseColor = vec4( diffuse, opacity ); + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + + // accumulation + #include + #include + #include + #include + + // modulation + #include + + vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; + vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; + + #include + + vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; + + #ifdef USE_SHEEN + + // Sheen energy compensation approximation calculation can be found at the end of + // https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing + float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); + + outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular; + + #endif + + #ifdef USE_CLEARCOAT + + float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) ); + + vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); + + outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat; + + #endif + + #include + #include + #include + #include + #include + #include + +} +`;var c5=` +#define TOON + +varying vec3 vViewPosition; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + #include + #include + + #include + #include + #include + #include + #include + #include + + #include + #include + #include + #include + #include + #include + #include + + vViewPosition = - mvPosition.xyz; + + #include + #include + #include + +} +`,l5=` +#define TOON + +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + + vec4 diffuseColor = vec4( diffuse, opacity ); + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + + #include + #include + #include + #include + #include + #include + #include + #include + + // accumulation + #include + #include + #include + #include + + // modulation + #include + + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + + #include + #include + #include + #include + #include + #include + +} +`;var u5=` +uniform float size; +uniform float scale; + +#include +#include +#include +#include +#include +#include + +void main() { + + #include + #include + #include + #include + + gl_PointSize = size; + + #ifdef USE_SIZEATTENUATION + + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + + if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); + + #endif + + #include + #include + #include + #include + +} +`,h5=` +uniform vec3 diffuse; +uniform float opacity; + +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + + vec3 outgoingLight = vec3( 0.0 ); + vec4 diffuseColor = vec4( diffuse, opacity ); + + #include + #include + #include + #include + + outgoingLight = diffuseColor.rgb; + + #include + #include + #include + #include + #include + +} +`;var f5=` +#include +#include +#include +#include +#include + +void main() { + + #include + #include + #include + #include + #include + + #include + #include + #include + #include + + #include + #include + #include + +} +`,d5=` +uniform vec3 color; +uniform float opacity; + +#include +#include +#include +#include +#include +#include +#include + +void main() { + + gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); + + #include + #include + #include + +} +`;var p5=` +uniform float rotation; +uniform vec2 center; + +#include +#include +#include +#include +#include + +void main() { + + #include + + vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); + + vec2 scale; + scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); + scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); + + #ifndef USE_SIZEATTENUATION + + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + + if ( isPerspective ) scale *= - mvPosition.z; + + #endif + + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; + + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; + + mvPosition.xy += rotatedPosition; + + gl_Position = projectionMatrix * mvPosition; + + #include + #include + #include + +} +`,m5=` +uniform vec3 diffuse; +uniform float opacity; + +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + + vec3 outgoingLight = vec3( 0.0 ); + vec4 diffuseColor = vec4( diffuse, opacity ); + + #include + #include + #include + #include + + outgoingLight = diffuseColor.rgb; + + #include + #include + #include + #include + +} +`;var _1={alphamap_fragment:G8,alphamap_pars_fragment:q8,alphatest_fragment:W8,alphatest_pars_fragment:j8,aomap_fragment:X8,aomap_pars_fragment:Z8,begin_vertex:Y8,beginnormal_vertex:$8,bsdfs:K8,bumpmap_pars_fragment:J8,clipping_planes_fragment:Q8,clipping_planes_pars_fragment:en,clipping_planes_pars_vertex:tn,clipping_planes_vertex:an,color_fragment:rn,color_pars_fragment:nn,color_pars_vertex:sn,color_vertex:on,common:cn,cube_uv_reflection_fragment:ln,defaultnormal_vertex:un,displacementmap_pars_vertex:hn,displacementmap_vertex:fn,emissivemap_fragment:dn,emissivemap_pars_fragment:pn,encodings_fragment:mn,encodings_pars_fragment:vn,envmap_fragment:gn,envmap_common_pars_fragment:xn,envmap_pars_fragment:Mn,envmap_pars_vertex:bn,envmap_physical_pars_fragment:Tn,envmap_vertex:yn,fog_vertex:Cn,fog_pars_vertex:zn,fog_fragment:An,fog_pars_fragment:wn,gradientmap_pars_fragment:_n,lightmap_fragment:Sn,lightmap_pars_fragment:En,lights_lambert_vertex:Ln,lights_pars_begin:Dn,lights_toon_fragment:Hn,lights_toon_pars_fragment:Vn,lights_phong_fragment:Nn,lights_phong_pars_fragment:Rn,lights_physical_fragment:Fn,lights_physical_pars_fragment:Bn,lights_fragment_begin:Pn,lights_fragment_maps:In,lights_fragment_end:kn,logdepthbuf_fragment:Un,logdepthbuf_pars_fragment:On,logdepthbuf_pars_vertex:Gn,logdepthbuf_vertex:qn,map_fragment:Wn,map_pars_fragment:jn,map_particle_fragment:Xn,map_particle_pars_fragment:Zn,metalnessmap_fragment:Yn,metalnessmap_pars_fragment:$n,morphnormal_vertex:Kn,morphtarget_pars_vertex:Jn,morphtarget_vertex:Qn,normal_fragment_begin:es,normal_fragment_maps:ts,normal_pars_fragment:is,normal_pars_vertex:as,normal_vertex:rs,normalmap_pars_fragment:ns,clearcoat_normal_fragment_begin:ss,clearcoat_normal_fragment_maps:os,clearcoat_pars_fragment:cs,output_fragment:ls,packing:us,premultiplied_alpha_fragment:hs,project_vertex:fs,dithering_fragment:ds,dithering_pars_fragment:ps,roughnessmap_fragment:ms,roughnessmap_pars_fragment:vs,shadowmap_pars_fragment:gs,shadowmap_pars_vertex:xs,shadowmap_vertex:Ms,shadowmask_pars_fragment:bs,skinbase_vertex:ys,skinning_pars_vertex:Cs,skinning_vertex:zs,skinnormal_vertex:As,specularmap_fragment:ws,specularmap_pars_fragment:_s,tonemapping_fragment:Ss,tonemapping_pars_fragment:Es,transmission_fragment:Ls,transmission_pars_fragment:Ds,uv_pars_fragment:Ts,uv_pars_vertex:Hs,uv_vertex:Vs,uv2_pars_fragment:Ns,uv2_pars_vertex:Rs,uv2_vertex:Fs,worldpos_vertex:Bs,background_vert:Ps,background_frag:Is,cube_vert:ks,cube_frag:Us,depth_vert:Os,depth_frag:Gs,distanceRGBA_vert:qs,distanceRGBA_frag:Ws,equirect_vert:js,equirect_frag:Xs,linedashed_vert:Zs,linedashed_frag:Ys,meshbasic_vert:$s,meshbasic_frag:Ks,meshlambert_vert:Js,meshlambert_frag:Qs,meshmatcap_vert:e5,meshmatcap_frag:t5,meshnormal_vert:i5,meshnormal_frag:a5,meshphong_vert:r5,meshphong_frag:n5,meshphysical_vert:s5,meshphysical_frag:o5,meshtoon_vert:c5,meshtoon_frag:l5,points_vert:u5,points_frag:h5,shadow_vert:f5,shadow_frag:d5,sprite_vert:p5,sprite_frag:m5};var e1={common:{diffuse:{value:new x1(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new n2},uv2Transform:{value:new n2},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new z1(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new x1(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new x1(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new n2}},sprite:{diffuse:{value:new x1(16777215)},opacity:{value:1},center:{value:new z1(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new n2}}};var W2={basic:{uniforms:p2([e1.common,e1.specularmap,e1.envmap,e1.aomap,e1.lightmap,e1.fog]),vertexShader:_1.meshbasic_vert,fragmentShader:_1.meshbasic_frag},lambert:{uniforms:p2([e1.common,e1.specularmap,e1.envmap,e1.aomap,e1.lightmap,e1.emissivemap,e1.fog,e1.lights,{emissive:{value:new x1(0)}}]),vertexShader:_1.meshlambert_vert,fragmentShader:_1.meshlambert_frag},phong:{uniforms:p2([e1.common,e1.specularmap,e1.envmap,e1.aomap,e1.lightmap,e1.emissivemap,e1.bumpmap,e1.normalmap,e1.displacementmap,e1.fog,e1.lights,{emissive:{value:new x1(0)},specular:{value:new x1(1118481)},shininess:{value:30}}]),vertexShader:_1.meshphong_vert,fragmentShader:_1.meshphong_frag},standard:{uniforms:p2([e1.common,e1.envmap,e1.aomap,e1.lightmap,e1.emissivemap,e1.bumpmap,e1.normalmap,e1.displacementmap,e1.roughnessmap,e1.metalnessmap,e1.fog,e1.lights,{emissive:{value:new x1(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:_1.meshphysical_vert,fragmentShader:_1.meshphysical_frag},toon:{uniforms:p2([e1.common,e1.aomap,e1.lightmap,e1.emissivemap,e1.bumpmap,e1.normalmap,e1.displacementmap,e1.gradientmap,e1.fog,e1.lights,{emissive:{value:new x1(0)}}]),vertexShader:_1.meshtoon_vert,fragmentShader:_1.meshtoon_frag},matcap:{uniforms:p2([e1.common,e1.bumpmap,e1.normalmap,e1.displacementmap,e1.fog,{matcap:{value:null}}]),vertexShader:_1.meshmatcap_vert,fragmentShader:_1.meshmatcap_frag},points:{uniforms:p2([e1.points,e1.fog]),vertexShader:_1.points_vert,fragmentShader:_1.points_frag},dashed:{uniforms:p2([e1.common,e1.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:_1.linedashed_vert,fragmentShader:_1.linedashed_frag},depth:{uniforms:p2([e1.common,e1.displacementmap]),vertexShader:_1.depth_vert,fragmentShader:_1.depth_frag},normal:{uniforms:p2([e1.common,e1.bumpmap,e1.normalmap,e1.displacementmap,{opacity:{value:1}}]),vertexShader:_1.meshnormal_vert,fragmentShader:_1.meshnormal_frag},sprite:{uniforms:p2([e1.sprite,e1.fog]),vertexShader:_1.sprite_vert,fragmentShader:_1.sprite_frag},background:{uniforms:{uvTransform:{value:new n2},t2D:{value:null}},vertexShader:_1.background_vert,fragmentShader:_1.background_frag},cube:{uniforms:p2([e1.envmap,{opacity:{value:1}}]),vertexShader:_1.cube_vert,fragmentShader:_1.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:_1.equirect_vert,fragmentShader:_1.equirect_frag},distanceRGBA:{uniforms:p2([e1.common,e1.displacementmap,{referencePosition:{value:new k},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:_1.distanceRGBA_vert,fragmentShader:_1.distanceRGBA_frag},shadow:{uniforms:p2([e1.lights,e1.fog,{color:{value:new x1(0)},opacity:{value:1}}]),vertexShader:_1.shadow_vert,fragmentShader:_1.shadow_frag}};W2.physical={uniforms:p2([W2.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new z1(1,1)},clearcoatNormalMap:{value:null},sheen:{value:0},sheenColor:{value:new x1(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new z1},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new x1(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new x1(1,1,1)},specularColorMap:{value:null}}]),vertexShader:_1.meshphysical_vert,fragmentShader:_1.meshphysical_frag};function v5(n,e,t,i,a,r){let s=new x1(0),o=a===!0?0:1,c,l,u=null,f=0,h=null;function m(g,x){let p=!1,d=x.isScene===!0?x.background:null;d&&d.isTexture&&(d=e.get(d));let A=n.xr,b=A.getSession&&A.getSession();b&&b.environmentBlendMode==="additive"&&(d=null),d===null?v(s,o):d&&d.isColor&&(v(d,1),p=!0),(n.autoClear||p)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),d&&(d.isCubeTexture||d.mapping===a4)?(l===void 0&&(l=new u2(new $e(1,1,1),new ne({name:"BackgroundCubeMaterial",uniforms:Ke(W2.cube.uniforms),vertexShader:W2.cube.vertexShader,fragmentShader:W2.cube.fragmentShader,side:P1,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(C,E,T){this.matrixWorld.copyPosition(T.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(l)),l.material.uniforms.envMap.value=d,l.material.uniforms.flipEnvMap.value=d.isCubeTexture&&d.isRenderTargetTexture===!1?-1:1,(u!==d||f!==d.version||h!==n.toneMapping)&&(l.material.needsUpdate=!0,u=d,f=d.version,h=n.toneMapping),g.unshift(l,l.geometry,l.material,0,0,null)):d&&d.isTexture&&(c===void 0&&(c=new u2(new H4(2,2),new ne({name:"BackgroundMaterial",uniforms:Ke(W2.background.uniforms),vertexShader:W2.background.vertexShader,fragmentShader:W2.background.fragmentShader,side:ke,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=d,d.matrixAutoUpdate===!0&&d.updateMatrix(),c.material.uniforms.uvTransform.value.copy(d.matrix),(u!==d||f!==d.version||h!==n.toneMapping)&&(c.material.needsUpdate=!0,u=d,f=d.version,h=n.toneMapping),g.unshift(c,c.geometry,c.material,0,0,null))}function v(g,x){t.buffers.color.setClear(g.r,g.g,g.b,x,r)}return{getClearColor:function(){return s},setClearColor:function(g,x=1){s.set(g),o=x,v(s,o)},getClearAlpha:function(){return o},setClearAlpha:function(g){o=g,v(s,o)},render:m}}function g5(n,e,t,i){let a=n.getParameter(n.MAX_VERTEX_ATTRIBS),r=i.isWebGL2?null:e.get("OES_vertex_array_object"),s=i.isWebGL2||r!==null,o={},c=g(null),l=c;function u(z,H,V,L,N){let U=!1;if(s){let Z=v(L,V,H);l!==Z&&(l=Z,h(l.object)),U=x(L,N),U&&p(L,N)}else{let Z=H.wireframe===!0;(l.geometry!==L.id||l.program!==V.id||l.wireframe!==Z)&&(l.geometry=L.id,l.program=V.id,l.wireframe=Z,U=!0)}z.isInstancedMesh===!0&&(U=!0),N!==null&&t.update(N,n.ELEMENT_ARRAY_BUFFER),U&&(T(z,H,V,L),N!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t.get(N).buffer))}function f(){return i.isWebGL2?n.createVertexArray():r.createVertexArrayOES()}function h(z){return i.isWebGL2?n.bindVertexArray(z):r.bindVertexArrayOES(z)}function m(z){return i.isWebGL2?n.deleteVertexArray(z):r.deleteVertexArrayOES(z)}function v(z,H,V){let L=V.wireframe===!0,N=o[z.id];N===void 0&&(N={},o[z.id]=N);let U=N[H.id];U===void 0&&(U={},N[H.id]=U);let Z=U[L];return Z===void 0&&(Z=g(f()),U[L]=Z),Z}function g(z){let H=[],V=[],L=[];for(let N=0;N=0){let X=N[O];if(X===void 0&&(O==="instanceMatrix"&&z.instanceMatrix&&(X=z.instanceMatrix),O==="instanceColor"&&z.instanceColor&&(X=z.instanceColor)),X!==void 0){let Q=X.normalized,a1=X.itemSize,B=t.get(X);if(B===void 0)continue;let M1=B.buffer,u1=B.type,v1=B.bytesPerElement;if(X.isInterleavedBufferAttribute){let n1=X.data,T1=n1.stride,A1=X.offset;if(n1&&n1.isInstancedInterleavedBuffer){for(let C1=0;C10&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";T="mediump"}return T==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let s=typeof WebGL2RenderingContext!="undefined"&&n instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext!="undefined"&&n instanceof WebGL2ComputeRenderingContext,o=t.precision!==void 0?t.precision:"highp",c=r(o);c!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",c,"instead."),o=c);let l=s||e.has("WEBGL_draw_buffers"),u=t.logarithmicDepthBuffer===!0,f=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),h=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),m=n.getParameter(n.MAX_TEXTURE_SIZE),v=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),g=n.getParameter(n.MAX_VERTEX_ATTRIBS),x=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),p=n.getParameter(n.MAX_VARYING_VECTORS),d=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),A=h>0,b=s||e.has("OES_texture_float"),C=A&&b,E=s?n.getParameter(n.MAX_SAMPLES):0;return{isWebGL2:s,drawBuffers:l,getMaxAnisotropy:a,getMaxPrecision:r,precision:o,logarithmicDepthBuffer:u,maxTextures:f,maxVertexTextures:h,maxTextureSize:m,maxCubemapSize:v,maxAttributes:g,maxVertexUniforms:x,maxVaryings:p,maxFragmentUniforms:d,vertexTextures:A,floatFragmentTextures:b,floatVertexTextures:C,maxSamples:E}}function b5(n){let e=this,t=null,i=0,a=!1,r=!1,s=new re,o=new n2,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(f,h,m){let v=f.length!==0||h||i!==0||a;return a=h,t=u(f,m,0),i=f.length,v},this.beginShadows=function(){r=!0,u(null)},this.endShadows=function(){r=!1,l()},this.setState=function(f,h,m){let v=f.clippingPlanes,g=f.clipIntersection,x=f.clipShadows,p=n.get(f);if(!a||v===null||v.length===0||r&&!x)r?u(null):l();else{let d=r?0:i,A=d*4,b=p.clippingState||null;c.value=b,b=u(v,h,A,m);for(let C=0;C!==A;++C)b[C]=t[C];p.clippingState=b,this.numIntersection=g?this.numPlanes:0,this.numPlanes+=d}};function l(){c.value!==t&&(c.value=t,c.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(f,h,m,v){let g=f!==null?f.length:0,x=null;if(g!==0){if(x=c.value,v!==!0||x===null){let p=m+g*4,d=h.matrixWorldInverse;o.getNormalMatrix(d),(x===null||x.length + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + } + `},a=new $e(5,5,5),r=new ne({name:"CubemapFromEquirect",uniforms:Ke(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:P1,blending:U2});r.uniforms.tEquirect.value=t;let s=new u2(a,r),o=t.minFilter;return t.minFilter===r4&&(t.minFilter=t2),new yi(1,10,this).update(e,s),t.minFilter=o,s.geometry.dispose(),s.material.dispose(),this}clear(e,t,i,a){let r=e.getRenderTarget();for(let s=0;s<6;s++)e.setRenderTarget(this,s),e.clear(t,i,a);e.setRenderTarget(r)}};e0.prototype.isWebGLCubeRenderTarget=!0;function y5(n){let e=new WeakMap;function t(s,o){return o===Lt?s.mapping=Me:o===Dt&&(s.mapping=Ue),s}function i(s){if(s&&s.isTexture&&s.isRenderTargetTexture===!1){let o=s.mapping;if(o===Lt||o===Dt)if(e.has(s)){let c=e.get(s).texture;return t(c,s.mapping)}else{let c=s.image;if(c&&c.height>0){let l=new e0(c.height/2);return l.fromEquirectangularTexture(n,s),e.set(s,l),s.addEventListener("dispose",a),t(l.texture,s.mapping)}else return null}}return s}function a(s){let o=s.target;o.removeEventListener("dispose",a);let c=e.get(o);c!==void 0&&(e.delete(o),c.dispose())}function r(){e=new WeakMap}return{get:i,dispose:r}}var t0=class extends at{constructor(e=-1,t=1,i=1,a=-1,r=.1,s=2e3){super();this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=a,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,a,r,s){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=a,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,a=(this.top+this.bottom)/2,r=i-e,s=i+e,o=a+t,c=a-t;if(this.view!==null&&this.view.enabled){let l=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=l*this.view.offsetX,s=r+l*this.view.width,o-=u*this.view.offsetY,c=o-u*this.view.height}this.projectionMatrix.makeOrthographic(r,s,o,c,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}};t0.prototype.isOrthographicCamera=!0;var ot=class extends ne{constructor(e){super(e);this.type="RawShaderMaterial"}};ot.prototype.isRawShaderMaterial=!0;var ct=4,d4=8,ze=Math.pow(2,d4),C5=[.125,.215,.35,.446,.526,.582],z5=d4-ct+1+C5.length,lt=20,Ci=new t0,{_lodPlanes:Gt,_sizeLods:A5,_sigmas:i0}=P9(),w5=new x1,zi=null,V4=(1+Math.sqrt(5))/2,ut=1/V4,_5=[new k(1,1,1),new k(-1,1,1),new k(1,1,-1),new k(-1,1,-1),new k(0,V4,ut),new k(0,V4,-ut),new k(ut,0,V4),new k(-ut,0,V4),new k(V4,ut,0),new k(-V4,ut,0)],a0=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=I9(lt),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,a=100){zi=this._renderer.getRenderTarget();let r=this._allocateTargets();return this._sceneToCubeUV(e,i,a,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapShader===null&&(this._cubemapShader=L5(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){this._equirectShader===null&&(this._equirectShader=E5(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose(),this._cubemapShader!==null&&this._cubemapShader.dispose(),this._equirectShader!==null&&this._equirectShader.dispose();for(let e=0;e2?ze:0,ze,ze),u.setRenderTarget(a),g&&u.render(v,o),u.render(e,o)}v.geometry.dispose(),v.material.dispose(),u.toneMapping=h,u.autoClear=f,e.background=x}_textureToCubeUV(e,t){let i=this._renderer,a=e.mapping===Me||e.mapping===Ue;a?(this._cubemapShader===null&&(this._cubemapShader=L5()),this._cubemapShader.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectShader===null&&(this._equirectShader=E5());let r=a?this._cubemapShader:this._equirectShader,s=new u2(Gt[0],r),o=r.uniforms;o.envMap.value=e,a||o.texelSize.value.set(1/e.image.width,1/e.image.height),r0(t,0,0,3*ze,2*ze),i.setRenderTarget(t),i.render(s,Ci)}_applyPMREM(e){let t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let a=1;alt&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${x} samples when the maximum is set to ${lt}`);let p=[],d=0;for(let E=0;Ed4-ct?a-d4+ct:0);r0(t,b,C,3*A,2*A),c.setRenderTarget(t),c.render(f,Ci)}};function P9(){let n=[],e=[],t=[],i=d4;for(let a=0;ad4-ct?s=C5[a-d4+ct-1]:a===0&&(s=0),t.push(s);let o=1/(r-1),c=-o/2,l=1+o/2,u=[c,c,l,c,l,l,c,c,l,l,c,l],f=6,h=6,m=3,v=2,g=1,x=new Float32Array(m*h*f),p=new Float32Array(v*h*f),d=new Float32Array(g*h*f);for(let b=0;b2?0:-1,T=[C,E,0,C+2/3,E,0,C+2/3,E+1,0,C,E,0,C+2/3,E+1,0,C,E+1,0];x.set(T,m*h*b),p.set(u,v*h*b);let S=[b,b,b,b,b,b];d.set(S,g*h*b)}let A=new b2;A.setAttribute("position",new M2(x,m)),A.setAttribute("uv",new M2(p,v)),A.setAttribute("faceIndex",new M2(d,g)),n.push(A),i>ct&&i--}return{_lodPlanes:n,_sizeLods:e,_sigmas:t}}function S5(n){let e=new m2(3*ze,3*ze,n);return e.texture.mapping=a4,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function r0(n,e,t,i,a){n.viewport.set(e,t,i,a),n.scissor.set(e,t,i,a)}function I9(n){let e=new Float32Array(n),t=new k(0,1,0);return new ot({name:"SphericalGaussianBlur",defines:{n},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:e},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:t}},vertexShader:Ai(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform int samples; + uniform float weights[ n ]; + uniform bool latitudinal; + uniform float dTheta; + uniform float mipInt; + uniform vec3 poleAxis; + + #define ENVMAP_TYPE_CUBE_UV + #include + + vec3 getSample( float theta, vec3 axis ) { + + float cosTheta = cos( theta ); + // Rodrigues' axis-angle rotation + vec3 sampleDirection = vOutputDirection * cosTheta + + cross( axis, vOutputDirection ) * sin( theta ) + + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); + + return bilinearCubeUV( envMap, sampleDirection, mipInt ); + + } + + void main() { + + vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); + + if ( all( equal( axis, vec3( 0.0 ) ) ) ) { + + axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); + + } + + axis = normalize( axis ); + + gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); + + for ( int i = 1; i < n; i++ ) { + + if ( i >= samples ) { + + break; + + } + + float theta = dTheta * float( i ); + gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); + gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); + + } + + } + `,blending:U2,depthTest:!1,depthWrite:!1})}function E5(){let n=new z1(1,1);return new ot({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:n}},vertexShader:Ai(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform vec2 texelSize; + + #include + + void main() { + + gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + + vec3 outputDirection = normalize( vOutputDirection ); + vec2 uv = equirectUv( outputDirection ); + + vec2 f = fract( uv / texelSize - 0.5 ); + uv -= f * texelSize; + vec3 tl = texture2D ( envMap, uv ).rgb; + uv.x += texelSize.x; + vec3 tr = texture2D ( envMap, uv ).rgb; + uv.y += texelSize.y; + vec3 br = texture2D ( envMap, uv ).rgb; + uv.x -= texelSize.x; + vec3 bl = texture2D ( envMap, uv ).rgb; + + vec3 tm = mix( tl, tr, f.x ); + vec3 bm = mix( bl, br, f.x ); + gl_FragColor.rgb = mix( tm, bm, f.y ); + + } + `,blending:U2,depthTest:!1,depthWrite:!1})}function L5(){return new ot({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Ai(),fragmentShader:` + + precision mediump float; + precision mediump int; + + uniform float flipEnvMap; + + varying vec3 vOutputDirection; + + uniform samplerCube envMap; + + void main() { + + gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); + + } + `,blending:U2,depthTest:!1,depthWrite:!1})}function Ai(){return` + + precision mediump float; + precision mediump int; + + attribute vec3 position; + attribute vec2 uv; + attribute float faceIndex; + + varying vec3 vOutputDirection; + + // RH coordinate system; PMREM face-indexing convention + vec3 getDirection( vec2 uv, float face ) { + + uv = 2.0 * uv - 1.0; + + vec3 direction = vec3( uv, 1.0 ); + + if ( face == 0.0 ) { + + direction = direction.zyx; // ( 1, v, u ) pos x + + } else if ( face == 1.0 ) { + + direction = direction.xzy; + direction.xz *= -1.0; // ( -u, 1, -v ) pos y + + } else if ( face == 2.0 ) { + + direction.x *= -1.0; // ( -u, v, 1 ) pos z + + } else if ( face == 3.0 ) { + + direction = direction.zyx; + direction.xz *= -1.0; // ( -1, v, -u ) neg x + + } else if ( face == 4.0 ) { + + direction = direction.xzy; + direction.xy *= -1.0; // ( -u, -1, v ) neg y + + } else if ( face == 5.0 ) { + + direction.z *= -1.0; // ( u, v, -1 ) neg z + + } + + return direction; + + } + + void main() { + + vOutputDirection = getDirection( uv, faceIndex ); + gl_Position = vec4( position, 1.0 ); + + } + `}function D5(n){let e=new WeakMap,t=null;function i(o){if(o&&o.isTexture){let c=o.mapping,l=c===Lt||c===Dt,u=c===Me||c===Ue;if(l||u)if(o.isRenderTargetTexture&&o.needsPMREMUpdate===!0){o.needsPMREMUpdate=!1;let f=e.get(o);return t===null&&(t=new a0(n)),f=l?t.fromEquirectangular(o,f):t.fromCubemap(o,f),e.set(o,f),f.texture}else{if(e.has(o))return e.get(o).texture;{let f=o.image;if(l&&f&&f.height>0||u&&f&&a(f)){t===null&&(t=new a0(n));let h=l?t.fromEquirectangular(o):t.fromCubemap(o);return e.set(o,h),o.addEventListener("dispose",r),h.texture}else return null}}}return o}function a(o){let c=0,l=6;for(let u=0;ue.maxTextureSize&&(S=Math.ceil(T/e.maxTextureSize),T=e.maxTextureSize);let P=new Float32Array(T*S*4*v),F=new ht(P,T,S,v);F.format=W1,F.type=J2,F.needsUpdate=!0;let M=E*4;for(let z=0;z0)return n;let a=e*t,r=O5[a];if(r===void 0&&(r=new Float32Array(a),O5[a]=r),e!==0){i.toArray(r,0);for(let s=1,o=0;s!==e;++s)o+=t,n[s].toArray(r,o)}return r}function A2(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t/gm;function Si(n){return n.replace(Pu,Iu)}function Iu(n,e){let t=_1[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return Si(t)}var ku=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Uu=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Q5(n){return n.replace(Uu,eo).replace(ku,Ou)}function Ou(n,e,t,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),eo(n,e,t,i)}function eo(n,e,t,i){let a="";for(let r=parseInt(e);r0&&(g+=` +`),x=[h,m].filter(qt).join(` +`),x.length>0&&(x+=` +`)):(g=[to(t),"#define SHADER_NAME "+t.shaderName,m,t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define MAX_BONES "+t.maxBones,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.displacementMap&&t.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.useVertexTexture?"#define BONE_TEXTURE":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphTargets&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargets&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` +`].filter(qt).join(` +`),x=[h,to(t),"#define SHADER_NAME "+t.shaderName,m,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+l:"",t.envMap?"#define "+u:"",t.envMap?"#define "+f:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(t.extensionShaderTextureLOD||t.envMap)&&t.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==O2?"#define TONE_MAPPING":"",t.toneMapping!==O2?_1.tonemapping_pars_fragment:"",t.toneMapping!==O2?Nu("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.alphaWrite?"":"#define OPAQUE",_1.encodings_pars_fragment,Vu("linearToOutputTexel",t.outputEncoding),t.depthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`].filter(qt).join(` +`)),s=Si(s),s=K5(s,t),s=J5(s,t),o=Si(o),o=K5(o,t),o=J5(o,t),s=Q5(s),o=Q5(o),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(p=`#version 300 es +`,g=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` +`)+` +`+g,x=["#define varying in",t.glslVersion===V3?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===V3?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` +`)+` +`+x);let d=p+g+s,A=p+x+o,b=_i(a,a.VERTEX_SHADER,d),C=_i(a,a.FRAGMENT_SHADER,A);if(a.attachShader(v,b),a.attachShader(v,C),t.index0AttributeName!==void 0?a.bindAttribLocation(v,0,t.index0AttributeName):t.morphTargets===!0&&a.bindAttribLocation(v,0,"position"),a.linkProgram(v),n.debug.checkShaderErrors){let S=a.getProgramInfoLog(v).trim(),P=a.getShaderInfoLog(b).trim(),F=a.getShaderInfoLog(C).trim(),M=!0,D=!0;if(a.getProgramParameter(v,a.LINK_STATUS)===!1){M=!1;let z=$5(a,b,"vertex"),H=$5(a,C,"fragment");console.error("THREE.WebGLProgram: Shader Error "+a.getError()+" - VALIDATE_STATUS "+a.getProgramParameter(v,a.VALIDATE_STATUS)+` + +Program Info Log: `+S+` +`+z+` +`+H)}else S!==""?console.warn("THREE.WebGLProgram: Program Info Log:",S):(P===""||F==="")&&(D=!1);D&&(this.diagnostics={runnable:M,programLog:S,vertexShader:{log:P,prefix:g},fragmentShader:{log:F,prefix:x}})}a.deleteShader(b),a.deleteShader(C);let E;this.getUniforms=function(){return E===void 0&&(E=new Ae(a,v)),E};let T;return this.getAttributes=function(){return T===void 0&&(T=Bu(a,v)),T},this.destroy=function(){i.releaseStatesOfProgram(this),a.deleteProgram(v),this.program=void 0},this.name=t.shaderName,this.id=Du++,this.cacheKey=e,this.usedTimes=1,this.program=v,this.vertexShader=b,this.fragmentShader=C,this}var Xu=0,Ei=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,i=e.fragmentShader,a=this._getShaderStage(t),r=this._getShaderStage(i),s=this._getShaderCacheForMaterial(e);return s.has(a)===!1&&(s.add(a),a.usedTimes++),s.has(r)===!1&&(s.add(r),r.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache;return t.has(e)===!1&&t.set(e,new Set),t.get(e)}_getShaderStage(e){let t=this.shaderCache;if(t.has(e)===!1){let i=new ao;t.set(e,i)}return t.get(e)}},ao=class{constructor(){this.id=Xu++,this.usedTimes=0}};function ro(n,e,t,i,a,r,s){let o=new Pt,c=new Ei,l=[],u=a.isWebGL2,f=a.logarithmicDepthBuffer,h=a.floatVertexTextures,m=a.maxVertexUniforms,v=a.vertexTextures,g=a.precision,x={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function p(M){let z=M.skeleton.bones;if(h)return 1024;{let V=Math.floor((m-20)/4),L=Math.min(V,z.length);return L0,u1=M.clearcoat>0;return{isWebGL2:u,shaderID:Z,shaderName:M.type,vertexShader:W,fragmentShader:X,defines:M.defines,customVertexShaderID:Q,customFragmentShaderID:a1,isRawShaderMaterial:M.isRawShaderMaterial===!0,glslVersion:M.glslVersion,precision:g,instancing:V.isInstancedMesh===!0,instancingColor:V.isInstancedMesh===!0&&V.instanceColor!==null,supportsVertexTextures:v,outputEncoding:B===null?n.outputEncoding:B.isXRRenderTarget===!0?B.texture.encoding:R2,map:!!M.map,matcap:!!M.matcap,envMap:!!U,envMapMode:U&&U.mapping,envMapCubeUV:!!U&&(U.mapping===a4||U.mapping===Tt),lightMap:!!M.lightMap,aoMap:!!M.aoMap,emissiveMap:!!M.emissiveMap,bumpMap:!!M.bumpMap,normalMap:!!M.normalMap,objectSpaceNormalMap:M.normalMapType===w8,tangentSpaceNormalMap:M.normalMapType===H6,decodeVideoTexture:!!M.map&&M.map.isVideoTexture===!0&&M.map.encoding===I1,clearcoat:u1,clearcoatMap:u1&&!!M.clearcoatMap,clearcoatRoughnessMap:u1&&!!M.clearcoatRoughnessMap,clearcoatNormalMap:u1&&!!M.clearcoatNormalMap,displacementMap:!!M.displacementMap,roughnessMap:!!M.roughnessMap,metalnessMap:!!M.metalnessMap,specularMap:!!M.specularMap,specularIntensityMap:!!M.specularIntensityMap,specularColorMap:!!M.specularColorMap,alphaMap:!!M.alphaMap,alphaTest:M1,alphaWrite:M.alphaWrite||M.transparent,gradientMap:!!M.gradientMap,sheen:M.sheen>0,sheenColorMap:!!M.sheenColorMap,sheenRoughnessMap:!!M.sheenRoughnessMap,transmission:M.transmission>0,transmissionMap:!!M.transmissionMap,thicknessMap:!!M.thicknessMap,combine:M.combine,vertexTangents:!!M.normalMap&&!!V.geometry&&!!V.geometry.attributes.tangent,vertexColors:M.vertexColors,vertexAlphas:M.vertexColors===!0&&!!V.geometry&&!!V.geometry.attributes.color&&V.geometry.attributes.color.itemSize===4,vertexUvs:!!M.map||!!M.bumpMap||!!M.normalMap||!!M.specularMap||!!M.alphaMap||!!M.emissiveMap||!!M.roughnessMap||!!M.metalnessMap||!!M.clearcoatMap||!!M.clearcoatRoughnessMap||!!M.clearcoatNormalMap||!!M.displacementMap||!!M.transmissionMap||!!M.thicknessMap||!!M.specularIntensityMap||!!M.specularColorMap||!!M.sheenColorMap||!!M.sheenRoughnessMap,uvsVertexOnly:!(!!M.map||!!M.bumpMap||!!M.normalMap||!!M.specularMap||!!M.alphaMap||!!M.emissiveMap||!!M.roughnessMap||!!M.metalnessMap||!!M.clearcoatNormalMap||M.transmission>0||!!M.transmissionMap||!!M.thicknessMap||!!M.specularIntensityMap||!!M.specularColorMap||M.sheen>0||!!M.sheenColorMap||!!M.sheenRoughnessMap)&&!!M.displacementMap,fog:!!L,useFog:M.fog,fogExp2:L&&L.isFogExp2,flatShading:!!M.flatShading,sizeAttenuation:M.sizeAttenuation,logarithmicDepthBuffer:f,skinning:V.isSkinnedMesh===!0&&O>0,maxBones:O,useVertexTexture:h,morphTargets:!!V.geometry&&!!V.geometry.morphAttributes.position,morphNormals:!!V.geometry&&!!V.geometry.morphAttributes.normal,morphTargetsCount:!!V.geometry&&!!V.geometry.morphAttributes.position?V.geometry.morphAttributes.position.length:0,numDirLights:D.directional.length,numPointLights:D.point.length,numSpotLights:D.spot.length,numRectAreaLights:D.rectArea.length,numHemiLights:D.hemi.length,numDirLightShadows:D.directionalShadowMap.length,numPointLightShadows:D.pointShadowMap.length,numSpotLightShadows:D.spotShadowMap.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:M.dithering,shadowMapEnabled:n.shadowMap.enabled&&z.length>0,shadowMapType:n.shadowMap.type,toneMapping:M.toneMapped?n.toneMapping:O2,physicallyCorrectLights:n.physicallyCorrectLights,premultipliedAlpha:M.premultipliedAlpha,doubleSided:M.side===K2,flipSided:M.side===P1,depthPacking:M.depthPacking!==void 0?M.depthPacking:!1,index0AttributeName:M.index0AttributeName,extensionDerivatives:M.extensions&&M.extensions.derivatives,extensionFragDepth:M.extensions&&M.extensions.fragDepth,extensionDrawBuffers:M.extensions&&M.extensions.drawBuffers,extensionShaderTextureLOD:M.extensions&&M.extensions.shaderTextureLOD,rendererExtensionFragDepth:u||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||i.has("EXT_shader_texture_lod"),customProgramCacheKey:M.customProgramCacheKey()}}function A(M){let D=[];if(M.shaderID?D.push(M.shaderID):(D.push(M.customVertexShaderID),D.push(M.customFragmentShaderID)),M.defines!==void 0)for(let z in M.defines)D.push(z),D.push(M.defines[z]);return M.isRawShaderMaterial===!1&&(b(D,M),C(D,M),D.push(n.outputEncoding)),D.push(M.customProgramCacheKey),D.join()}function b(M,D){M.push(D.precision),M.push(D.outputEncoding),M.push(D.envMapMode),M.push(D.combine),M.push(D.vertexUvs),M.push(D.fogExp2),M.push(D.sizeAttenuation),M.push(D.maxBones),M.push(D.morphTargetsCount),M.push(D.numDirLights),M.push(D.numPointLights),M.push(D.numSpotLights),M.push(D.numHemiLights),M.push(D.numRectAreaLights),M.push(D.numDirLightShadows),M.push(D.numPointLightShadows),M.push(D.numSpotLightShadows),M.push(D.shadowMapType),M.push(D.toneMapping),M.push(D.numClippingPlanes),M.push(D.numClipIntersection),M.push(D.alphaWrite)}function C(M,D){o.disableAll(),D.isWebGL2&&o.enable(0),D.supportsVertexTextures&&o.enable(1),D.instancing&&o.enable(2),D.instancingColor&&o.enable(3),D.map&&o.enable(4),D.matcap&&o.enable(5),D.envMap&&o.enable(6),D.envMapCubeUV&&o.enable(7),D.lightMap&&o.enable(8),D.aoMap&&o.enable(9),D.emissiveMap&&o.enable(10),D.bumpMap&&o.enable(11),D.normalMap&&o.enable(12),D.objectSpaceNormalMap&&o.enable(13),D.tangentSpaceNormalMap&&o.enable(14),D.clearcoat&&o.enable(15),D.clearcoatMap&&o.enable(16),D.clearcoatRoughnessMap&&o.enable(17),D.clearcoatNormalMap&&o.enable(18),D.displacementMap&&o.enable(19),D.specularMap&&o.enable(20),D.roughnessMap&&o.enable(21),D.metalnessMap&&o.enable(22),D.gradientMap&&o.enable(23),D.alphaMap&&o.enable(24),D.alphaTest&&o.enable(25),D.vertexColors&&o.enable(26),D.vertexAlphas&&o.enable(27),D.vertexUvs&&o.enable(28),D.vertexTangents&&o.enable(29),D.uvsVertexOnly&&o.enable(30),D.fog&&o.enable(31),M.push(o.mask),o.disableAll(),D.useFog&&o.enable(0),D.flatShading&&o.enable(1),D.logarithmicDepthBuffer&&o.enable(2),D.skinning&&o.enable(3),D.useVertexTexture&&o.enable(4),D.morphTargets&&o.enable(5),D.morphNormals&&o.enable(6),D.premultipliedAlpha&&o.enable(7),D.shadowMapEnabled&&o.enable(8),D.physicallyCorrectLights&&o.enable(9),D.doubleSided&&o.enable(10),D.flipSided&&o.enable(11),D.depthPacking&&o.enable(12),D.dithering&&o.enable(13),D.specularIntensityMap&&o.enable(14),D.specularColorMap&&o.enable(15),D.transmission&&o.enable(16),D.transmissionMap&&o.enable(17),D.thicknessMap&&o.enable(18),D.sheen&&o.enable(19),D.sheenColorMap&&o.enable(20),D.sheenRoughnessMap&&o.enable(21),D.decodeVideoTexture&&o.enable(22),M.push(o.mask)}function E(M){let D=x[M.type],z;if(D){let H=W2[D];z=k8.clone(H.uniforms)}else z=M.uniforms;return z}function T(M,D){let z;for(let H=0,V=l.length;H0?i.push(p):m.transparent===!0?a.push(p):t.push(p)}function c(f,h,m,v,g,x){let p=s(f,h,m,v,g,x);m.transmission>0?i.unshift(p):m.transparent===!0?a.unshift(p):t.unshift(p)}function l(f,h){t.length>1&&t.sort(f||Zu),i.length>1&&i.sort(h||so),a.length>1&&a.sort(h||so)}function u(){for(let f=e,h=n.length;f=n.get(i).length?(r=new oo,n.get(i).push(r)):r=n.get(i)[a],r}function t(){n=new WeakMap}return{get:e,dispose:t}}function Yu(){let n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new k,color:new x1};break;case"SpotLight":t={position:new k,direction:new k,color:new x1,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new k,color:new x1,distance:0,decay:0};break;case"HemisphereLight":t={direction:new k,skyColor:new x1,groundColor:new x1};break;case"RectAreaLight":t={color:new x1,position:new k,halfWidth:new k,halfHeight:new k};break}return n[e.id]=t,t}}}function $u(){let n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new z1};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new z1};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new z1,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}var Ku=0;function Ju(n,e){return(e.castShadow?1:0)-(n.castShadow?1:0)}function lo(n,e){let t=new Yu,i=$u(),a={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let u=0;u<9;u++)a.probe.push(new k);let r=new k,s=new k1,o=new k1;function c(u,f){let h=0,m=0,v=0;for(let P=0;P<9;P++)a.probe[P].set(0,0,0);let g=0,x=0,p=0,d=0,A=0,b=0,C=0,E=0;u.sort(Ju);let T=f!==!0?Math.PI:1;for(let P=0,F=u.length;P0&&(e.isWebGL2?(a.rectAreaLTC1=e1.LTC_FLOAT_1,a.rectAreaLTC2=e1.LTC_FLOAT_2):n.has("OES_texture_float_linear")===!0?(a.rectAreaLTC1=e1.LTC_FLOAT_1,a.rectAreaLTC2=e1.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(a.rectAreaLTC1=e1.LTC_HALF_1,a.rectAreaLTC2=e1.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),a.ambient[0]=h,a.ambient[1]=m,a.ambient[2]=v;let S=a.hash;(S.directionalLength!==g||S.pointLength!==x||S.spotLength!==p||S.rectAreaLength!==d||S.hemiLength!==A||S.numDirectionalShadows!==b||S.numPointShadows!==C||S.numSpotShadows!==E)&&(a.directional.length=g,a.spot.length=p,a.rectArea.length=d,a.point.length=x,a.hemi.length=A,a.directionalShadow.length=b,a.directionalShadowMap.length=b,a.pointShadow.length=C,a.pointShadowMap.length=C,a.spotShadow.length=E,a.spotShadowMap.length=E,a.directionalShadowMatrix.length=b,a.pointShadowMatrix.length=C,a.spotShadowMatrix.length=E,S.directionalLength=g,S.pointLength=x,S.spotLength=p,S.rectAreaLength=d,S.hemiLength=A,S.numDirectionalShadows=b,S.numPointShadows=C,S.numSpotShadows=E,a.version=Ku++)}function l(u,f){let h=0,m=0,v=0,g=0,x=0,p=f.matrixWorldInverse;for(let d=0,A=u.length;d=t.get(r).length?(o=new uo(n,e),t.get(r).push(o)):o=t.get(r)[s],o}function a(){t=new WeakMap}return{get:i,dispose:a}}var o0=class extends T2{constructor(e){super();this.type="MeshDepthMaterial",this.depthPacking=z8,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}};o0.prototype.isMeshDepthMaterial=!0;var c0=class extends T2{constructor(e){super();this.type="MeshDistanceMaterial",this.referencePosition=new k,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}};c0.prototype.isMeshDistanceMaterial=!0;var fo=` +void main() { + + gl_Position = vec4( position, 1.0 ); + +} +`,po=` +uniform sampler2D shadow_pass; +uniform vec2 resolution; +uniform float radius; + +#include + +void main() { + + const float samples = float( VSM_SAMPLES ); + + float mean = 0.0; + float squared_mean = 0.0; + + // This seems totally useless but it's a crazy work around for a Adreno compiler bug + // float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) ); + + float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); + float uvStart = samples <= 1.0 ? 0.0 : - 1.0; + for ( float i = 0.0; i < samples; i ++ ) { + + float uvOffset = uvStart + i * uvStride; + + #ifdef HORIZONTAL_PASS + + vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); + mean += distribution.x; + squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; + + #else + + float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); + mean += depth; + squared_mean += depth * depth; + + #endif + + } + + mean = mean / samples; + squared_mean = squared_mean / samples; + + float std_dev = sqrt( squared_mean - mean * mean ); + + gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); + +} +`;function mo(n,e,t){let i=new T4,a=new z1,r=new z1,s=new q1,o=new o0({depthPacking:A8}),c=new c0,l={},u=t.maxTextureSize,f={0:P1,1:ke,2:K2},h=new ne({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new z1},radius:{value:4}},vertexShader:fo,fragmentShader:po}),m=h.clone();m.defines.HORIZONTAL_PASS=1;let v=new b2;v.setAttribute("position",new M2(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let g=new u2(v,h),x=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=A6,this.render=function(b,C,E){if(x.enabled===!1||x.autoUpdate===!1&&x.needsUpdate===!1||b.length===0)return;let T=n.getRenderTarget(),S=n.getActiveCubeFace(),P=n.getActiveMipmapLevel(),F=n.state;F.setBlending(U2),F.buffers.color.setClear(1,1,1,1),F.buffers.depth.setTest(!0),F.setScissorTest(!1);for(let M=0,D=b.length;Mu||a.y>u)&&(a.x>u&&(r.x=Math.floor(u/V.x),a.x=r.x*V.x,H.mapSize.x=r.x),a.y>u&&(r.y=Math.floor(u/V.y),a.y=r.y*V.y,H.mapSize.y=r.y)),H.map===null&&!H.isPointLightShadow&&this.type===z4){let N={minFilter:t2,magFilter:t2,format:W1};H.map=new m2(a.x,a.y,N),H.map.texture.name=z.name+".shadowMap",H.mapPass=new m2(a.x,a.y,N),H.camera.updateProjectionMatrix()}if(H.map===null){let N={minFilter:Q1,magFilter:Q1,format:W1};H.map=new m2(a.x,a.y,N),H.map.texture.name=z.name+".shadowMap",H.camera.updateProjectionMatrix()}n.setRenderTarget(H.map),n.clear();let L=H.getViewportCount();for(let N=0;N0){let z=M.uuid,H=E.uuid,V=l[z];V===void 0&&(V={},l[z]=V);let L=V[H];L===void 0&&(L=M.clone(),V[H]=L),M=L}return M.visible=E.visible,M.wireframe=E.wireframe,F===z4?M.side=E.shadowSide!==null?E.shadowSide:E.side:M.side=E.shadowSide!==null?E.shadowSide:f[E.side],M.alphaMap=E.alphaMap,M.alphaTest=E.alphaTest,M.clipShadows=E.clipShadows,M.clippingPlanes=E.clippingPlanes,M.clipIntersection=E.clipIntersection,M.displacementMap=E.displacementMap,M.displacementScale=E.displacementScale,M.displacementBias=E.displacementBias,M.wireframeLinewidth=E.wireframeLinewidth,M.linewidth=E.linewidth,T.isPointLight===!0&&M.isMeshDistanceMaterial===!0&&(M.referencePosition.setFromMatrixPosition(T.matrixWorld),M.nearDistance=S,M.farDistance=P),M}function A(b,C,E,T,S){if(b.visible===!1)return;if(b.layers.test(C.layers)&&(b.isMesh||b.isLine||b.isPoints)&&(b.castShadow||b.receiveShadow&&S===z4)&&(!b.frustumCulled||i.intersectsObject(b))){b.modelViewMatrix.multiplyMatrices(E.matrixWorldInverse,b.matrixWorld);let M=e.update(b),D=b.material;if(Array.isArray(D)){let z=M.groups;for(let H=0,V=z.length;H=1):L.indexOf("OpenGL ES")!==-1&&(V=parseFloat(/^OpenGL ES (\d)/.exec(L)[1]),H=V>=2);let N=null,U={},Z=n.getParameter(n.SCISSOR_BOX),O=n.getParameter(n.VIEWPORT),W=new q1().fromArray(Z),X=new q1().fromArray(O);function Q(I,l1,o1){let m1=new Uint8Array(4),$=n.createTexture();n.bindTexture(I,$),n.texParameteri(I,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(I,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let p1=0;p1t1||R.height>t1)&&(h1=t1/Math.max(R.width,R.height)),h1<1||w===!0)if(typeof HTMLImageElement!="undefined"&&R instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&R instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&R instanceof ImageBitmap){let Y=w?Lr:Math.floor,d1=Y(h1*R.width),f1=Y(h1*R.height);g===void 0&&(g=p(d1,f1));let s1=J?p(d1,f1):g;return s1.width=d1,s1.height=f1,s1.getContext("2d").drawImage(R,0,0,d1,f1),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+R.width+"x"+R.height+") to ("+d1+"x"+f1+")."),s1}else return"data"in R&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+R.width+"x"+R.height+")."),R;return R}function A(R){return J0(R.width)&&J0(R.height)}function b(R){return o?!1:R.wrapS!==c2||R.wrapT!==c2||R.minFilter!==Q1&&R.minFilter!==t2}function C(R,w){return R.generateMipmaps&&w&&R.minFilter!==Q1&&R.minFilter!==t2}function E(R){n.generateMipmap(R)}function T(R,w,J,t1,h1=!1){if(o===!1)return w;if(R!==null){if(n[R]!==void 0)return n[R];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+R+"'")}let Y=w;return w===n.RED&&(J===n.FLOAT&&(Y=n.R32F),J===n.HALF_FLOAT&&(Y=n.R16F),J===n.UNSIGNED_BYTE&&(Y=n.R8)),w===n.RG&&(J===n.FLOAT&&(Y=n.RG32F),J===n.HALF_FLOAT&&(Y=n.RG16F),J===n.UNSIGNED_BYTE&&(Y=n.RG8)),w===n.RGBA&&(J===n.FLOAT&&(Y=n.RGBA32F),J===n.HALF_FLOAT&&(Y=n.RGBA16F),J===n.UNSIGNED_BYTE&&(Y=t1===I1&&h1===!1?n.SRGB8_ALPHA8:n.RGBA8),J===n.UNSIGNED_SHORT_4_4_4_4&&(Y=n.RGBA4),J===n.UNSIGNED_SHORT_5_5_5_1&&(Y=n.RGB5_A1)),(Y===n.R16F||Y===n.R32F||Y===n.RG16F||Y===n.RG32F||Y===n.RGBA16F||Y===n.RGBA32F)&&e.get("EXT_color_buffer_float"),Y}function S(R,w,J){return C(R,J)===!0||R.isFramebufferTexture&&R.minFilter!==Q1&&R.minFilter!==t2?Math.log2(Math.max(w.width,w.height))+1:R.mipmaps!==void 0&&R.mipmaps.length>0?R.mipmaps.length:R.isCompressedTexture&&Array.isArray(R.image)?w.mipmaps.length:1}function P(R){return R===Q1||R===l3||R===u3?n.NEAREST:n.LINEAR}function F(R){let w=R.target;w.removeEventListener("dispose",F),D(w),w.isVideoTexture&&v.delete(w),s.memory.textures--}function M(R){let w=R.target;w.removeEventListener("dispose",M),z(w)}function D(R){let w=i.get(R);w.__webglInit!==void 0&&(n.deleteTexture(w.__webglTexture),i.remove(R))}function z(R){let w=R.texture,J=i.get(R),t1=i.get(w);if(!!R){if(t1.__webglTexture!==void 0&&(n.deleteTexture(t1.__webglTexture),s.memory.textures--),R.depthTexture&&R.depthTexture.dispose(),R.isWebGLCubeRenderTarget)for(let h1=0;h1<6;h1++)n.deleteFramebuffer(J.__webglFramebuffer[h1]),J.__webglDepthbuffer&&n.deleteRenderbuffer(J.__webglDepthbuffer[h1]);else n.deleteFramebuffer(J.__webglFramebuffer),J.__webglDepthbuffer&&n.deleteRenderbuffer(J.__webglDepthbuffer),J.__webglMultisampledFramebuffer&&n.deleteFramebuffer(J.__webglMultisampledFramebuffer),J.__webglColorRenderbuffer&&n.deleteRenderbuffer(J.__webglColorRenderbuffer),J.__webglDepthRenderbuffer&&n.deleteRenderbuffer(J.__webglDepthRenderbuffer);if(R.isWebGLMultipleRenderTargets)for(let h1=0,Y=w.length;h1=c&&console.warn("THREE.WebGLTextures: Trying to use "+R+" texture units while this GPU supports only "+c),H+=1,R}function N(R,w){let J=i.get(R);if(R.isVideoTexture&&j2(R),R.version>0&&J.__version!==R.version){let t1=R.image;if(t1===void 0)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else if(t1.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{B(J,R,w);return}}t.activeTexture(n.TEXTURE0+w),t.bindTexture(n.TEXTURE_2D,J.__webglTexture)}function U(R,w){let J=i.get(R);if(R.version>0&&J.__version!==R.version){B(J,R,w);return}t.activeTexture(n.TEXTURE0+w),t.bindTexture(n.TEXTURE_2D_ARRAY,J.__webglTexture)}function Z(R,w){let J=i.get(R);if(R.version>0&&J.__version!==R.version){B(J,R,w);return}t.activeTexture(n.TEXTURE0+w),t.bindTexture(n.TEXTURE_3D,J.__webglTexture)}function O(R,w){let J=i.get(R);if(R.version>0&&J.__version!==R.version){M1(J,R,w);return}t.activeTexture(n.TEXTURE0+w),t.bindTexture(n.TEXTURE_CUBE_MAP,J.__webglTexture)}let W={[Ht]:n.REPEAT,[c2]:n.CLAMP_TO_EDGE,[Vt]:n.MIRRORED_REPEAT},X={[Q1]:n.NEAREST,[l3]:n.NEAREST_MIPMAP_NEAREST,[u3]:n.NEAREST_MIPMAP_LINEAR,[t2]:n.LINEAR,[c8]:n.LINEAR_MIPMAP_NEAREST,[r4]:n.LINEAR_MIPMAP_LINEAR};function Q(R,w,J){if(J?(n.texParameteri(R,n.TEXTURE_WRAP_S,W[w.wrapS]),n.texParameteri(R,n.TEXTURE_WRAP_T,W[w.wrapT]),(R===n.TEXTURE_3D||R===n.TEXTURE_2D_ARRAY)&&n.texParameteri(R,n.TEXTURE_WRAP_R,W[w.wrapR]),n.texParameteri(R,n.TEXTURE_MAG_FILTER,X[w.magFilter]),n.texParameteri(R,n.TEXTURE_MIN_FILTER,X[w.minFilter])):(n.texParameteri(R,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(R,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),(R===n.TEXTURE_3D||R===n.TEXTURE_2D_ARRAY)&&n.texParameteri(R,n.TEXTURE_WRAP_R,n.CLAMP_TO_EDGE),(w.wrapS!==c2||w.wrapT!==c2)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(R,n.TEXTURE_MAG_FILTER,P(w.magFilter)),n.texParameteri(R,n.TEXTURE_MIN_FILTER,P(w.minFilter)),w.minFilter!==Q1&&w.minFilter!==t2&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){let t1=e.get("EXT_texture_filter_anisotropic");if(w.type===J2&&e.has("OES_texture_float_linear")===!1||o===!1&&w.type===be&&e.has("OES_texture_half_float_linear")===!1)return;(w.anisotropy>1||i.get(w).__currentAnisotropy)&&(n.texParameterf(R,t1.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(w.anisotropy,a.getMaxAnisotropy())),i.get(w).__currentAnisotropy=w.anisotropy)}}function a1(R,w){R.__webglInit===void 0&&(R.__webglInit=!0,w.addEventListener("dispose",F),R.__webglTexture=n.createTexture(),s.memory.textures++)}function B(R,w,J){let t1=n.TEXTURE_2D;w.isDataTexture2DArray&&(t1=n.TEXTURE_2D_ARRAY),w.isDataTexture3D&&(t1=n.TEXTURE_3D),a1(R,w),t.activeTexture(n.TEXTURE0+J),t.bindTexture(t1,R.__webglTexture),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,w.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,w.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,w.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,n.NONE);let h1=b(w)&&A(w.image)===!1,Y=d(w.image,h1,!1,u);Y=v2(w,Y);let d1=A(Y)||o,f1=r.convert(w.format,w.encoding),s1=r.convert(w.type),r1=T(w.internalFormat,f1,s1,w.encoding,w.isVideoTexture);Q(t1,w,d1);let b1,I=w.mipmaps,l1=o&&w.isVideoTexture!==!0,o1=R.__version===void 0,m1=S(w,Y,d1);if(w.isDepthTexture)r1=n.DEPTH_COMPONENT,o?w.type===J2?r1=n.DEPTH_COMPONENT32F:w.type===q4?r1=n.DEPTH_COMPONENT24:w.type===ye?r1=n.DEPTH24_STENCIL8:r1=n.DEPTH_COMPONENT16:w.type===J2&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),w.format===Q2&&r1===n.DEPTH_COMPONENT&&w.type!==Oe&&w.type!==q4&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),w.type=Oe,s1=r.convert(w.type)),w.format===Ce&&r1===n.DEPTH_COMPONENT&&(r1=n.DEPTH_STENCIL,w.type!==ye&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),w.type=ye,s1=r.convert(w.type))),l1&&o1?t.texStorage2D(n.TEXTURE_2D,1,r1,Y.width,Y.height):t.texImage2D(n.TEXTURE_2D,0,r1,Y.width,Y.height,0,f1,s1,null);else if(w.isDataTexture)if(I.length>0&&d1){l1&&o1&&t.texStorage2D(n.TEXTURE_2D,m1,r1,I[0].width,I[0].height);for(let $=0,p1=I.length;$0&&d1){l1&&o1&&t.texStorage2D(n.TEXTURE_2D,m1,r1,I[0].width,I[0].height);for(let $=0,p1=I.length;$0&&o1++,t.texStorage2D(n.TEXTURE_CUBE_MAP,o1,b1,Y[0].width,Y[0].height));for(let $=0;$<6;$++)if(h1){I?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,0,0,Y[$].width,Y[$].height,s1,r1,Y[$].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,b1,Y[$].width,Y[$].height,0,s1,r1,Y[$].data);for(let p1=0;p1m+v?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&h<=m-v&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,i),r!==null&&(c.matrix.fromArray(r.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),r.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(r.linearVelocity)):c.hasLinearVelocity=!1,r.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(r.angularVelocity)):c.hasAngularVelocity=!1));return o!==null&&(o.visible=a!==null),c!==null&&(c.visible=r!==null),l!==null&&(l.visible=s!==null),this}};var jt=class extends $1{constructor(e,t,i,a,r,s,o,c,l,u){if(u=u!==void 0?u:Q2,u!==Q2&&u!==Ce)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&u===Q2&&(i=Oe),i===void 0&&u===Ce&&(i=ye);super(null,a,r,s,o,c,u,i,l);this.image={width:e,height:t},this.magFilter=o!==void 0?o:Q1,this.minFilter=c!==void 0?c:Q1,this.flipY=!1,this.generateMipmaps=!1}};jt.prototype.isDepthTexture=!0;var Li=class extends F2{constructor(e,t){super();let i=this,a=null,r=1,s=null,o="local-floor",c=e.extensions.has("WEBGL_multisampled_render_to_texture"),l=null,u=null,f=null,h=null,m=!1,v=null,g=t.getContextAttributes(),x=null,p=null,d=[],A=new Map,b=new i2;b.layers.enable(1),b.viewport=new q1;let C=new i2;C.layers.enable(2),C.viewport=new q1;let E=[b,C],T=new l0;T.layers.enable(1),T.layers.enable(2);let S=null,P=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(O){let W=d[O];return W===void 0&&(W=new Wt,d[O]=W),W.getTargetRaySpace()},this.getControllerGrip=function(O){let W=d[O];return W===void 0&&(W=new Wt,d[O]=W),W.getGripSpace()},this.getHand=function(O){let W=d[O];return W===void 0&&(W=new Wt,d[O]=W),W.getHandSpace()};function F(O){let W=A.get(O.inputSource);W&&W.dispatchEvent({type:O.type,data:O.inputSource})}function M(){A.forEach(function(O,W){O.disconnect(W)}),A.clear(),S=null,P=null,e.setRenderTarget(x),h=null,f=null,u=null,a=null,p=null,Z.stop(),i.isPresenting=!1,i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(O){r=O,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(O){o=O,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return s},this.getBaseLayer=function(){return f!==null?f:h},this.getBinding=function(){return u},this.getFrame=function(){return v},this.getSession=function(){return a},this.setSession=async function(O){if(a=O,a!==null){if(x=e.getRenderTarget(),a.addEventListener("select",F),a.addEventListener("selectstart",F),a.addEventListener("selectend",F),a.addEventListener("squeeze",F),a.addEventListener("squeezestart",F),a.addEventListener("squeezeend",F),a.addEventListener("end",M),a.addEventListener("inputsourceschange",D),g.xrCompatible!==!0&&await t.makeXRCompatible(),a.renderState.layers===void 0||e.capabilities.isWebGL2===!1){let W={antialias:a.renderState.layers===void 0?g.antialias:!0,alpha:g.alpha,depth:g.depth,stencil:g.stencil,framebufferScaleFactor:r};h=new XRWebGLLayer(a,t,W),a.updateRenderState({baseLayer:h}),p=new m2(h.framebufferWidth,h.framebufferHeight,{format:W1,type:N2,encoding:e.outputEncoding})}else{m=g.antialias;let W=null,X=null,Q=null;g.depth&&(Q=g.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,W=g.stencil?Ce:Q2,X=g.stencil?ye:Oe);let a1={colorFormat:e.outputEncoding===I1?t.SRGB8_ALPHA8:t.RGBA8,depthFormat:Q,scaleFactor:r};u=new XRWebGLBinding(a,t),f=u.createProjectionLayer(a1),a.updateRenderState({layers:[f]}),m?p=new ft(f.textureWidth,f.textureHeight,{format:W1,type:N2,depthTexture:new jt(f.textureWidth,f.textureHeight,X,void 0,void 0,void 0,void 0,void 0,void 0,W),stencilBuffer:g.stencil,ignoreDepth:f.ignoreDepthValues,useRenderToTexture:c,encoding:e.outputEncoding}):p=new m2(f.textureWidth,f.textureHeight,{format:W1,type:N2,depthTexture:new jt(f.textureWidth,f.textureHeight,X,void 0,void 0,void 0,void 0,void 0,void 0,W),stencilBuffer:g.stencil,ignoreDepth:f.ignoreDepthValues,encoding:e.outputEncoding})}p.isXRRenderTarget=!0,this.setFoveation(1),s=await a.requestReferenceSpace(o),Z.setContext(a),Z.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}};function D(O){let W=a.inputSources;for(let X=0;X0&&(p.alphaTest.value=d.alphaTest);let A=n.get(d).envMap;A&&(p.envMap.value=A,p.flipEnvMap.value=A.isCubeTexture&&A.isRenderTargetTexture===!1?-1:1,p.reflectivity.value=d.reflectivity,p.ior.value=d.ior,p.refractionRatio.value=d.refractionRatio),d.lightMap&&(p.lightMap.value=d.lightMap,p.lightMapIntensity.value=d.lightMapIntensity),d.aoMap&&(p.aoMap.value=d.aoMap,p.aoMapIntensity.value=d.aoMapIntensity);let b;d.map?b=d.map:d.specularMap?b=d.specularMap:d.displacementMap?b=d.displacementMap:d.normalMap?b=d.normalMap:d.bumpMap?b=d.bumpMap:d.roughnessMap?b=d.roughnessMap:d.metalnessMap?b=d.metalnessMap:d.alphaMap?b=d.alphaMap:d.emissiveMap?b=d.emissiveMap:d.clearcoatMap?b=d.clearcoatMap:d.clearcoatNormalMap?b=d.clearcoatNormalMap:d.clearcoatRoughnessMap?b=d.clearcoatRoughnessMap:d.specularIntensityMap?b=d.specularIntensityMap:d.specularColorMap?b=d.specularColorMap:d.transmissionMap?b=d.transmissionMap:d.thicknessMap?b=d.thicknessMap:d.sheenColorMap?b=d.sheenColorMap:d.sheenRoughnessMap&&(b=d.sheenRoughnessMap),b!==void 0&&(b.isWebGLRenderTarget&&(b=b.texture),b.matrixAutoUpdate===!0&&b.updateMatrix(),p.uvTransform.value.copy(b.matrix));let C;d.aoMap?C=d.aoMap:d.lightMap&&(C=d.lightMap),C!==void 0&&(C.isWebGLRenderTarget&&(C=C.texture),C.matrixAutoUpdate===!0&&C.updateMatrix(),p.uv2Transform.value.copy(C.matrix))}function a(p,d){p.diffuse.value.copy(d.color),p.opacity.value=d.opacity}function r(p,d){p.dashSize.value=d.dashSize,p.totalSize.value=d.dashSize+d.gapSize,p.scale.value=d.scale}function s(p,d,A,b){p.diffuse.value.copy(d.color),p.opacity.value=d.opacity,p.size.value=d.size*A,p.scale.value=b*.5,d.map&&(p.map.value=d.map),d.alphaMap&&(p.alphaMap.value=d.alphaMap),d.alphaTest>0&&(p.alphaTest.value=d.alphaTest);let C;d.map?C=d.map:d.alphaMap&&(C=d.alphaMap),C!==void 0&&(C.matrixAutoUpdate===!0&&C.updateMatrix(),p.uvTransform.value.copy(C.matrix))}function o(p,d){p.diffuse.value.copy(d.color),p.opacity.value=d.opacity,p.rotation.value=d.rotation,d.map&&(p.map.value=d.map),d.alphaMap&&(p.alphaMap.value=d.alphaMap),d.alphaTest>0&&(p.alphaTest.value=d.alphaTest);let A;d.map?A=d.map:d.alphaMap&&(A=d.alphaMap),A!==void 0&&(A.matrixAutoUpdate===!0&&A.updateMatrix(),p.uvTransform.value.copy(A.matrix))}function c(p,d){d.emissiveMap&&(p.emissiveMap.value=d.emissiveMap)}function l(p,d){p.specular.value.copy(d.specular),p.shininess.value=Math.max(d.shininess,1e-4),d.emissiveMap&&(p.emissiveMap.value=d.emissiveMap),d.bumpMap&&(p.bumpMap.value=d.bumpMap,p.bumpScale.value=d.bumpScale,d.side===P1&&(p.bumpScale.value*=-1)),d.normalMap&&(p.normalMap.value=d.normalMap,p.normalScale.value.copy(d.normalScale),d.side===P1&&p.normalScale.value.negate()),d.displacementMap&&(p.displacementMap.value=d.displacementMap,p.displacementScale.value=d.displacementScale,p.displacementBias.value=d.displacementBias)}function u(p,d){d.gradientMap&&(p.gradientMap.value=d.gradientMap),d.emissiveMap&&(p.emissiveMap.value=d.emissiveMap),d.bumpMap&&(p.bumpMap.value=d.bumpMap,p.bumpScale.value=d.bumpScale,d.side===P1&&(p.bumpScale.value*=-1)),d.normalMap&&(p.normalMap.value=d.normalMap,p.normalScale.value.copy(d.normalScale),d.side===P1&&p.normalScale.value.negate()),d.displacementMap&&(p.displacementMap.value=d.displacementMap,p.displacementScale.value=d.displacementScale,p.displacementBias.value=d.displacementBias)}function f(p,d){p.roughness.value=d.roughness,p.metalness.value=d.metalness,d.roughnessMap&&(p.roughnessMap.value=d.roughnessMap),d.metalnessMap&&(p.metalnessMap.value=d.metalnessMap),d.emissiveMap&&(p.emissiveMap.value=d.emissiveMap),d.bumpMap&&(p.bumpMap.value=d.bumpMap,p.bumpScale.value=d.bumpScale,d.side===P1&&(p.bumpScale.value*=-1)),d.normalMap&&(p.normalMap.value=d.normalMap,p.normalScale.value.copy(d.normalScale),d.side===P1&&p.normalScale.value.negate()),d.displacementMap&&(p.displacementMap.value=d.displacementMap,p.displacementScale.value=d.displacementScale,p.displacementBias.value=d.displacementBias),n.get(d).envMap&&(p.envMapIntensity.value=d.envMapIntensity)}function h(p,d,A){f(p,d),p.ior.value=d.ior,d.sheen>0&&(p.sheenColor.value.copy(d.sheenColor).multiplyScalar(d.sheen),p.sheenRoughness.value=d.sheenRoughness,d.sheenColorMap&&(p.sheenColorMap.value=d.sheenColorMap),d.sheenRoughnessMap&&(p.sheenRoughnessMap.value=d.sheenRoughnessMap)),d.clearcoat>0&&(p.clearcoat.value=d.clearcoat,p.clearcoatRoughness.value=d.clearcoatRoughness,d.clearcoatMap&&(p.clearcoatMap.value=d.clearcoatMap),d.clearcoatRoughnessMap&&(p.clearcoatRoughnessMap.value=d.clearcoatRoughnessMap),d.clearcoatNormalMap&&(p.clearcoatNormalScale.value.copy(d.clearcoatNormalScale),p.clearcoatNormalMap.value=d.clearcoatNormalMap,d.side===P1&&p.clearcoatNormalScale.value.negate())),d.transmission>0&&(p.transmission.value=d.transmission,p.transmissionSamplerMap.value=A.texture,p.transmissionSamplerSize.value.set(A.width,A.height),d.transmissionMap&&(p.transmissionMap.value=d.transmissionMap),p.thickness.value=d.thickness,d.thicknessMap&&(p.thicknessMap.value=d.thicknessMap),p.attenuationDistance.value=d.attenuationDistance,p.attenuationColor.value.copy(d.attenuationColor)),p.specularIntensity.value=d.specularIntensity,p.specularColor.value.copy(d.specularColor),d.specularIntensityMap&&(p.specularIntensityMap.value=d.specularIntensityMap),d.specularColorMap&&(p.specularColorMap.value=d.specularColorMap)}function m(p,d){d.matcap&&(p.matcap.value=d.matcap),d.bumpMap&&(p.bumpMap.value=d.bumpMap,p.bumpScale.value=d.bumpScale,d.side===P1&&(p.bumpScale.value*=-1)),d.normalMap&&(p.normalMap.value=d.normalMap,p.normalScale.value.copy(d.normalScale),d.side===P1&&p.normalScale.value.negate()),d.displacementMap&&(p.displacementMap.value=d.displacementMap,p.displacementScale.value=d.displacementScale,p.displacementBias.value=d.displacementBias)}function v(p,d){d.displacementMap&&(p.displacementMap.value=d.displacementMap,p.displacementScale.value=d.displacementScale,p.displacementBias.value=d.displacementBias)}function g(p,d){d.displacementMap&&(p.displacementMap.value=d.displacementMap,p.displacementScale.value=d.displacementScale,p.displacementBias.value=d.displacementBias),p.referencePosition.value.copy(d.referencePosition),p.nearDistance.value=d.nearDistance,p.farDistance.value=d.farDistance}function x(p,d){d.bumpMap&&(p.bumpMap.value=d.bumpMap,p.bumpScale.value=d.bumpScale,d.side===P1&&(p.bumpScale.value*=-1)),d.normalMap&&(p.normalMap.value=d.normalMap,p.normalScale.value.copy(d.normalScale),d.side===P1&&p.normalScale.value.negate()),d.displacementMap&&(p.displacementMap.value=d.displacementMap,p.displacementScale.value=d.displacementScale,p.displacementBias.value=d.displacementBias)}return{refreshFogUniforms:e,refreshMaterialUniforms:t}}function th(){let n=E4("canvas");return n.style.display="block",n}function Di(n={}){let e=n.canvas!==void 0?n.canvas:th(),t=n.context!==void 0?n.context:null,i=n.alpha!==void 0?n.alpha:!1,a=n.depth!==void 0?n.depth:!0,r=n.stencil!==void 0?n.stencil:!0,s=n.antialias!==void 0?n.antialias:!1,o=n.premultipliedAlpha!==void 0?n.premultipliedAlpha:!0,c=n.preserveDrawingBuffer!==void 0?n.preserveDrawingBuffer:!1,l=n.powerPreference!==void 0?n.powerPreference:"default",u=n.failIfMajorPerformanceCaveat!==void 0?n.failIfMajorPerformanceCaveat:!1,f=null,h=null,m=[],v=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=R2,this.physicallyCorrectLights=!1,this.toneMapping=O2,this.toneMappingExposure=1;let g=this,x=!1,p=0,d=0,A=null,b=-1,C=null,E=new q1,T=new q1,S=null,P=e.width,F=e.height,M=1,D=null,z=null,H=new q1(0,0,P,F),V=new q1(0,0,P,F),L=!1,N=new T4,U=!1,Z=!1,O=null,W=new k1,X=new k,Q={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function a1(){return A===null?M:1}let B=t;function M1(_,G){for(let j=0;j<_.length;j++){let q=_[j],K=e.getContext(q,G);if(K!==null)return K}return null}try{let _={alpha:!0,depth:a,stencil:r,antialias:s,premultipliedAlpha:o,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:u};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Hr}`),e.addEventListener("webglcontextlost",b1,!1),e.addEventListener("webglcontextrestored",I,!1),B===null){let G=["webgl2","webgl","experimental-webgl"];if(g.isWebGL1Renderer===!0&&G.shift(),B=M1(G,_),B===null)throw M1(G)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}B.getShaderPrecisionFormat===void 0&&(B.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(_){throw console.error("THREE.WebGLRenderer: "+_.message),_}let u1,v1,n1,T1,A1,C1,h2,K1,a2,j2,v2,g2,X2,se,oe,R,w,J,t1,h1,Y,d1,f1;function s1(){u1=new T5(B),v1=new M5(B,u1,n),u1.init(v1),d1=new xo(B,u1,v1),n1=new vo(B,u1,v1),T1=new N5(B),A1=new no,C1=new go(B,u1,n1,A1,v1,d1,T1),h2=new y5(g),K1=new D5(g),a2=new I8(B,v1),f1=new g5(B,u1,a2,v1),j2=new H5(B,a2,T1,f1),v2=new B5(B,j2,a2,T1),t1=new F5(B,v1,C1),R=new b5(A1),g2=new ro(g,h2,K1,u1,v1,f1,R),X2=new Mo(A1),se=new co,oe=new ho(u1,v1),J=new v5(g,h2,n1,v2,i,o),w=new mo(g,v2,v1),h1=new x5(B,u1,T1,v1),Y=new V5(B,u1,T1,v1),T1.programs=g2.programs,g.capabilities=v1,g.extensions=u1,g.properties=A1,g.renderLists=se,g.shadowMap=w,g.state=n1,g.info=T1}s1();let r1=new Li(g,B);this.xr=r1,this.getContext=function(){return B},this.getContextAttributes=function(){return B.getContextAttributes()},this.forceContextLoss=function(){let _=u1.get("WEBGL_lose_context");_&&_.loseContext()},this.forceContextRestore=function(){let _=u1.get("WEBGL_lose_context");_&&_.restoreContext()},this.getPixelRatio=function(){return M},this.setPixelRatio=function(_){_!==void 0&&(M=_,this.setSize(P,F,!1))},this.getSize=function(_){return _.set(P,F)},this.setSize=function(_,G,j){if(r1.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}P=_,F=G,e.width=Math.floor(_*M),e.height=Math.floor(G*M),j!==!1&&(e.style.width=_+"px",e.style.height=G+"px"),this.setViewport(0,0,_,G)},this.getDrawingBufferSize=function(_){return _.set(P*M,F*M).floor()},this.setDrawingBufferSize=function(_,G,j){P=_,F=G,M=j,e.width=Math.floor(_*j),e.height=Math.floor(G*j),this.setViewport(0,0,_,G)},this.getCurrentViewport=function(_){return _.copy(E)},this.getViewport=function(_){return _.copy(H)},this.setViewport=function(_,G,j,q){_.isVector4?H.set(_.x,_.y,_.z,_.w):H.set(_,G,j,q),n1.viewport(E.copy(H).multiplyScalar(M).floor())},this.getScissor=function(_){return _.copy(V)},this.setScissor=function(_,G,j,q){_.isVector4?V.set(_.x,_.y,_.z,_.w):V.set(_,G,j,q),n1.scissor(T.copy(V).multiplyScalar(M).floor())},this.getScissorTest=function(){return L},this.setScissorTest=function(_){n1.setScissorTest(L=_)},this.setOpaqueSort=function(_){D=_},this.setTransparentSort=function(_){z=_},this.getClearColor=function(_){return _.copy(J.getClearColor())},this.setClearColor=function(){J.setClearColor.apply(J,arguments)},this.getClearAlpha=function(){return J.getClearAlpha()},this.setClearAlpha=function(){J.setClearAlpha.apply(J,arguments)},this.clear=function(_,G,j){let q=0;(_===void 0||_)&&(q|=B.COLOR_BUFFER_BIT),(G===void 0||G)&&(q|=B.DEPTH_BUFFER_BIT),(j===void 0||j)&&(q|=B.STENCIL_BUFFER_BIT),B.clear(q)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",b1,!1),e.removeEventListener("webglcontextrestored",I,!1),se.dispose(),oe.dispose(),A1.dispose(),h2.dispose(),K1.dispose(),v2.dispose(),f1.dispose(),g2.dispose(),r1.dispose(),r1.removeEventListener("sessionstart",L1),r1.removeEventListener("sessionend",X1),O&&(O.dispose(),O=null),H2.stop()};function b1(_){_.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),x=!0}function I(){console.log("THREE.WebGLRenderer: Context Restored."),x=!1;let _=T1.autoReset,G=w.enabled,j=w.autoUpdate,q=w.needsUpdate,K=w.type;s1(),T1.autoReset=_,w.enabled=G,w.autoUpdate=j,w.needsUpdate=q,w.type=K}function l1(_){let G=_.target;G.removeEventListener("dispose",l1),o1(G)}function o1(_){m1(_),A1.remove(_)}function m1(_){let G=A1.get(_).programs;G!==void 0&&(G.forEach(function(j){g2.releaseProgram(j)}),_.isShaderMaterial&&g2.releaseShaderCache(_))}this.renderBufferDirect=function(_,G,j,q,K,g1){G===null&&(G=Q);let y1=K.isMesh&&K.matrixWorld.determinant()<0,S1=No(_,G,j,q,K);n1.setMaterial(q,y1);let w1=j.index,B1=j.attributes.position;if(w1===null){if(B1===void 0||B1.count===0)return}else if(w1.count===0)return;let H1=1;q.wireframe===!0&&(w1=j2.getWireframeAttribute(j),H1=2),f1.setup(K,q,S1,j,w1);let V1,Y1=h1;w1!==null&&(V1=a2.get(w1),Y1=Y,Y1.setIndex(V1));let p4=w1!==null?w1.count:B1.count,R4=j.drawRange.start*H1,R1=j.drawRange.count*H1,le=g1!==null?g1.start*H1:0,r2=g1!==null?g1.count*H1:1/0,ue=Math.max(R4,le),$t=Math.min(p4,R4+R1,le+r2)-1,he=Math.max(0,$t-ue+1);if(he!==0){if(K.isMesh)q.wireframe===!0?(n1.setLineWidth(q.wireframeLinewidth*a1()),Y1.setMode(B.LINES)):Y1.setMode(B.TRIANGLES);else if(K.isLine){let Se=q.linewidth;Se===void 0&&(Se=1),n1.setLineWidth(Se*a1()),K.isLineSegments?Y1.setMode(B.LINES):K.isLineLoop?Y1.setMode(B.LINE_LOOP):Y1.setMode(B.LINE_STRIP)}else K.isPoints?Y1.setMode(B.POINTS):K.isSprite&&Y1.setMode(B.TRIANGLES);if(K.isInstancedMesh)Y1.renderInstances(ue,he,K.count);else if(j.isInstancedBufferGeometry){let Se=Math.min(j.instanceCount,j._maxInstanceCount);Y1.renderInstances(ue,he,Se)}else Y1.render(ue,he)}},this.compile=function(_,G){h=oe.get(_),h.init(),v.push(h),_.traverseVisible(function(j){j.isLight&&j.layers.test(G.layers)&&(h.pushLight(j),j.castShadow&&h.pushShadow(j))}),h.setupLights(g.physicallyCorrectLights),_.traverse(function(j){let q=j.material;if(q)if(Array.isArray(q))for(let K=0;K0?h=v[v.length-1]:h=null,m.pop(),m.length>0?f=m[m.length-1]:f=null};function Z1(_,G,j,q){if(_.visible===!1)return;if(_.layers.test(G.layers)){if(_.isGroup)j=_.renderOrder;else if(_.isLOD)_.autoUpdate===!0&&_.update(G);else if(_.isLight)h.pushLight(_),_.castShadow&&h.pushShadow(_);else if(_.isSprite){if(!_.frustumCulled||N.intersectsSprite(_)){q&&X.setFromMatrixPosition(_.matrixWorld).applyMatrix4(W);let y1=v2.update(_),S1=_.material;S1.visible&&f.push(_,y1,S1,j,X.z,null)}}else if((_.isMesh||_.isLine||_.isPoints)&&(_.isSkinnedMesh&&_.skeleton.frame!==T1.render.frame&&(_.skeleton.update(),_.skeleton.frame=T1.render.frame),!_.frustumCulled||N.intersectsObject(_))){q&&X.setFromMatrixPosition(_.matrixWorld).applyMatrix4(W);let y1=v2.update(_),S1=_.material;if(Array.isArray(S1)){let w1=y1.groups;for(let B1=0,H1=w1.length;B10&&_e(K,G,j),q&&n1.viewport(E.copy(q)),K.length>0&&Yt(K,G,j),g1.length>0&&Yt(g1,G,j),y1.length>0&&Yt(y1,G,j)}function _e(_,G,j){if(O===null){let y1=s===!0&&v1.isWebGL2===!0?ft:m2;O=new y1(1024,1024,{generateMipmaps:!0,type:d1.convert(be)!==null?be:N2,minFilter:r4,magFilter:Q1,wrapS:c2,wrapT:c2,useRenderToTexture:u1.has("WEBGL_multisampled_render_to_texture")})}let q=g.getRenderTarget();g.setRenderTarget(O),g.clear();let K=g.toneMapping;g.toneMapping=O2,Yt(_,G,j),g.toneMapping=K,C1.updateMultisampleRenderTarget(O),C1.updateRenderTargetMipmap(O),g.setRenderTarget(q)}function Yt(_,G,j){let q=G.isScene===!0?G.overrideMaterial:null;for(let K=0,g1=_.length;K=0&&G<=_.width-q&&j>=0&&j<=_.height-K&&B.readPixels(G,j,q,K,d1.convert(B1),d1.convert(H1),g1):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{let w1=A!==null?A1.get(A).__webglFramebuffer:null;n1.bindFramebuffer(B.FRAMEBUFFER,w1)}}},this.copyFramebufferToTexture=function(_,G,j=0){if(G.isFramebufferTexture!==!0){console.error("THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.");return}let q=Math.pow(2,-j),K=Math.floor(G.image.width*q),g1=Math.floor(G.image.height*q);C1.setTexture2D(G,0),B.copyTexSubImage2D(B.TEXTURE_2D,j,0,0,_.x,_.y,K,g1),n1.unbindTexture()},this.copyTextureToTexture=function(_,G,j,q=0){let K=G.image.width,g1=G.image.height,y1=d1.convert(j.format),S1=d1.convert(j.type);C1.setTexture2D(j,0),B.pixelStorei(B.UNPACK_FLIP_Y_WEBGL,j.flipY),B.pixelStorei(B.UNPACK_PREMULTIPLY_ALPHA_WEBGL,j.premultiplyAlpha),B.pixelStorei(B.UNPACK_ALIGNMENT,j.unpackAlignment),G.isDataTexture?B.texSubImage2D(B.TEXTURE_2D,q,_.x,_.y,K,g1,y1,S1,G.image.data):G.isCompressedTexture?B.compressedTexSubImage2D(B.TEXTURE_2D,q,_.x,_.y,G.mipmaps[0].width,G.mipmaps[0].height,y1,G.mipmaps[0].data):B.texSubImage2D(B.TEXTURE_2D,q,_.x,_.y,y1,S1,G.image),q===0&&j.generateMipmaps&&B.generateMipmap(B.TEXTURE_2D),n1.unbindTexture()},this.copyTextureToTexture3D=function(_,G,j,q,K=0){if(g.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let g1=_.max.x-_.min.x+1,y1=_.max.y-_.min.y+1,S1=_.max.z-_.min.z+1,w1=d1.convert(q.format),B1=d1.convert(q.type),H1;if(q.isDataTexture3D)C1.setTexture3D(q,0),H1=B.TEXTURE_3D;else if(q.isDataTexture2DArray)C1.setTexture2DArray(q,0),H1=B.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}B.pixelStorei(B.UNPACK_FLIP_Y_WEBGL,q.flipY),B.pixelStorei(B.UNPACK_PREMULTIPLY_ALPHA_WEBGL,q.premultiplyAlpha),B.pixelStorei(B.UNPACK_ALIGNMENT,q.unpackAlignment);let V1=B.getParameter(B.UNPACK_ROW_LENGTH),Y1=B.getParameter(B.UNPACK_IMAGE_HEIGHT),p4=B.getParameter(B.UNPACK_SKIP_PIXELS),R4=B.getParameter(B.UNPACK_SKIP_ROWS),R1=B.getParameter(B.UNPACK_SKIP_IMAGES),le=j.isCompressedTexture?j.mipmaps[0]:j.image;B.pixelStorei(B.UNPACK_ROW_LENGTH,le.width),B.pixelStorei(B.UNPACK_IMAGE_HEIGHT,le.height),B.pixelStorei(B.UNPACK_SKIP_PIXELS,_.min.x),B.pixelStorei(B.UNPACK_SKIP_ROWS,_.min.y),B.pixelStorei(B.UNPACK_SKIP_IMAGES,_.min.z),j.isDataTexture||j.isDataTexture3D?B.texSubImage3D(H1,K,G.x,G.y,G.z,g1,y1,S1,w1,B1,le.data):j.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),B.compressedTexSubImage3D(H1,K,G.x,G.y,G.z,g1,y1,S1,w1,le.data)):B.texSubImage3D(H1,K,G.x,G.y,G.z,g1,y1,S1,w1,B1,le),B.pixelStorei(B.UNPACK_ROW_LENGTH,V1),B.pixelStorei(B.UNPACK_IMAGE_HEIGHT,Y1),B.pixelStorei(B.UNPACK_SKIP_PIXELS,p4),B.pixelStorei(B.UNPACK_SKIP_ROWS,R4),B.pixelStorei(B.UNPACK_SKIP_IMAGES,R1),K===0&&q.generateMipmaps&&B.generateMipmap(H1),n1.unbindTexture()},this.initTexture=function(_){C1.setTexture2D(_,0),n1.unbindTexture()},this.resetState=function(){p=0,d=0,A=null,n1.reset(),f1.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}Di.prototype.isWebGLRenderer=!0;var u0=class extends j1{constructor(){super();this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),t}};u0.prototype.isScene=!0;var pt=class extends j1{constructor(e,t=1){super();this.type="Light",this.color=new x1(e),this.intensity=t}dispose(){}copy(e){return super.copy(e),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}};pt.prototype.isLight=!0;var h0=class extends pt{constructor(e,t){super(e,t);this.type="AmbientLight"}};h0.prototype.isAmbientLight=!0;var bo=new k1,yo=new k,Co=new k,Ti=class{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new z1(512,512),this.map=null,this.mapPass=null,this.matrix=new k1,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new T4,this._frameExtents=new z1(1,1),this._viewportCount=1,this._viewports=[new q1(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,i=this.matrix;yo.setFromMatrixPosition(e.matrixWorld),t.position.copy(yo),Co.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Co),t.updateMatrixWorld(),bo.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(bo),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(t.projectionMatrix),i.multiply(t.matrixWorldInverse)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}};var f0=class extends Ti{constructor(){super(new i2(50,1,.5,500));this.focus=1}updateMatrices(e){let t=this.camera,i=St*2*e.angle*this.focus,a=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;(i!==t.fov||a!==t.aspect||r!==t.far)&&(t.fov=i,t.aspect=a,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}};f0.prototype.isSpotLightShadow=!0;var d0=class extends pt{constructor(e,t,i=0,a=Math.PI/3,r=0,s=1){super(e,t);this.type="SpotLight",this.position.copy(j1.DefaultUp),this.updateMatrix(),this.target=new j1,this.distance=i,this.angle=a,this.penumbra=r,this.decay=s,this.shadow=new f0}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}};d0.prototype.isSpotLight=!0;var p0=class extends T2{constructor(e){super();this.type="ShadowMaterial",this.color=new x1(0),this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this}};p0.prototype.isShadowMaterial=!0;var m0=class extends Xt.Component{constructor(e){super();this.plugin=e;this.event=new Xt.Events;this.container=createDiv("renderer-container");this.shadows=!0;this.iterations=0;this.frame_rate=1/60;this.animating=!1;this.factory=new Ao(this.WIDTH,this.HEIGHT,this.plugin);this.colors={ambient:16777215,spotlight:16777215};this.display={currentWidth:null,currentHeight:null,containerWidth:null,containerHeight:null,aspect:null,scale:null};this.cameraHeight={max:null,close:null,medium:null,far:null};this.extraFrames=m0.DEFAULT_EXTRA_FRAMES;this.renderer=new Di({alpha:!0,antialias:!0})}get WIDTH(){return this.container.clientWidth/2}get HEIGHT(){return this.container.clientHeight/2}get ASPECT(){return this.WIDTH/this.HEIGHT}get scale(){return(this.WIDTH*this.WIDTH+this.HEIGHT*this.HEIGHT)/13}get canvasEl(){return this.renderer?this.renderer.domElement:null}setDice(e){this.animating&&(this.unload(),this.load()),this.stack=e,this.current=this.factory.getDice(this.stack,{x:(Math.random()*2-1)*this.WIDTH,y:-(Math.random()*2-1)*this.HEIGHT}),this.scene.add(...[...this.current.values()].flat().map(t=>t.geometry)),this.world.add(...[...this.current.values()].flat())}onload(){this.addChild(this.factory),this.container.empty(),this.container.style.opacity="1",document.body.appendChild(this.container),this.renderer.shadowMap.enabled=this.shadows,this.renderer.shadowMap.type=w6,this.container.appendChild(this.renderer.domElement),this.renderer.setClearColor(0,0),this.scene=new u0,this.initScene(),this.registerDomEvent(window,"resize",()=>{this.initScene()}),this.initWorld()}async start(){return new Promise(async(e,t)=>{this.current.size||t(),this.event.on("throw-finished",i=>{e(i)}),this.event.on("error",i=>{t(i)}),this.animating=!0,this.extraFrames=m0.DEFAULT_EXTRA_FRAMES,this.render()})}enableShadows(){this.shadows=!0,this.renderer&&(this.renderer.shadowMap.enabled=this.shadows),this.light&&(this.light.castShadow=this.shadows),this.desk&&(this.desk.receiveShadow=this.shadows)}disableShadows(){this.shadows=!1,this.renderer&&(this.renderer.shadowMap.enabled=this.shadows),this.light&&(this.light.castShadow=this.shadows),this.desk&&(this.desk.receiveShadow=this.shadows)}get mw(){return Math.max(this.WIDTH,this.HEIGHT)}setDimensions(e){this.display.currentWidth=this.container.clientWidth/2,this.display.currentHeight=this.container.clientHeight/2,e?(this.display.containerWidth=e.w,this.display.containerHeight=e.h):(this.display.containerWidth=this.display.currentWidth,this.display.containerHeight=this.display.currentHeight),this.display.aspect=Math.min(this.display.currentWidth/this.display.containerWidth,this.display.currentHeight/this.display.containerHeight),this.display.scale=Math.sqrt(this.display.containerWidth*this.display.containerWidth+this.display.containerHeight*this.display.containerHeight)/13,this.renderer.setSize(this.display.currentWidth*2,this.display.currentHeight*2),this.cameraHeight.max=this.display.currentHeight/this.display.aspect/Math.tan(10*Math.PI/180),this.factory.width=this.display.currentWidth,this.factory.height=this.display.currentHeight,this.cameraHeight.medium=this.cameraHeight.max/1.5,this.cameraHeight.far=this.cameraHeight.max,this.cameraHeight.close=this.cameraHeight.max/2}initCamera(){this.camera&&this.scene.remove(this.camera),this.camera=new i2(20,this.display.currentWidth/this.display.currentHeight,1,this.cameraHeight.max*1.3),this.camera.position.z=this.cameraHeight.far,this.camera.lookAt(new k(0,0,0))}initLighting(){let e=Math.max(this.display.containerWidth,this.display.containerHeight);this.light&&this.scene.remove(this.light),this.ambientLight&&this.scene.remove(this.ambientLight),this.light=new d0(this.colors.spotlight,.25),this.light.position.set(-e/2,e/2,e*3),this.light.target.position.set(0,0,0),this.light.distance=e*5,this.light.angle=Math.PI/4,this.light.castShadow=this.shadows,this.light.shadow.camera.near=e/10,this.light.shadow.camera.far=e*5,this.light.shadow.camera.fov=50,this.light.shadow.bias=.001,this.light.shadow.mapSize.width=1024,this.light.shadow.mapSize.height=1024,this.scene.add(this.light),this.ambientLight=new h0(16777215,.9),this.scene.add(this.ambientLight)}initDesk(){this.desk&&this.scene.remove(this.desk);let e=new p0;e.opacity=.5,this.desk=new u2(new H4(this.display.containerWidth*6,this.display.containerHeight*6,1,1),e),this.desk.receiveShadow=this.shadows,this.scene.add(this.desk)}initScene(){this.setDimensions(),this.initCamera(),this.initLighting(),this.initDesk(),this.camera.updateProjectionMatrix(),this.renderer.render(this.scene,this.camera)}initWorld(){this.world=new zo(this.WIDTH,this.HEIGHT),this.iterations=0}getResultsForRoller(e){let t=this.current.get(e),i=t.filter(s=>s instanceof D4&&s.isPercentile),a=[];for(let s=0;s!(s instanceof D4&&s.isPercentile)).map(s=>s.getUpsideValue()).filter(s=>s),...a.map(([s,o])=>{let c=s.getUpsideValue();if(!o)return c;let l=o.getUpsideValue();return c===10&&l==10?100:(l==10&&(l=0),c==10&&(c=0),c*10+l)}).filter(s=>s)]}returnResult(){for(let e of this.stack.dynamic){if(!this.current.has(e))continue;let t=this.getResultsForRoller(e);!t||e.setResults(t)}this.event.trigger("throw-finished",this.stack)}unrender(e=this){e.container.style.opacity="0",e.registerInterval(window.setTimeout(()=>{e.animating=!1,e.unload()},1e3))}render(){if(this.throwFinished())if(this.extraFrames>10)this.extraFrames--;else{try{for(let[e,t]of this.current)if(!(!e.modifiers.size||!this.getResultsForRoller(e))&&e.modifiers.has("r")){let a=t.filter(r=>(e.conditions.length||e.conditions.push({operator:"=",comparer:e.faces.min,value:""}),e.checkCondition(r.result,e.conditions)&&r.rerolled{r.rerolled++;let s={x:(Math.random()*2-1)*this.WIDTH,y:-(Math.random()*2-1)*this.HEIGHT};r.vector=r.generateVector(s),r.create(),r.set(),r.stopped=!1}),this.animation=requestAnimationFrame(()=>this.render());return}}if(this.returnResult(),this.plugin.data.renderTime)this.registerInterval(window.setTimeout(()=>this.unrender(),this.plugin.data.renderTime));else{let t=function(){e.unrender(e),document.body.removeEventListener("click",t)},e=this;this.registerDomEvent(document.body,"click",t)}}catch(e){this.event.trigger("error",e)}return}this.animation=requestAnimationFrame(()=>this.render()),this.world.step(this.frame_rate),this.iterations++,this.current.forEach(e=>{e.map(t=>t.set())}),this.renderer.render(this.scene,this.camera)}dispose(...e){e.forEach(t=>{"dispose"in t&&t.dispose(),t.children&&this.dispose(...t.children)})}detach(){}onunload(){cancelAnimationFrame(this.animation),this.container.detach(),this.container.empty(),this.renderer.domElement.detach(),this.renderer.dispose(),this.factory.dispose(),this.ambientLight.dispose(),this.light.dispose(),this.scene.children.forEach(e=>this.dispose(e)),this.scene.remove(this.scene,...this.scene.children,...[...this.current.values()].flat().map(e=>e.geometry)),this.current.forEach(e=>{e.forEach(t=>{[...Array.isArray(t.geometry.material)?t.geometry.material:[t.geometry.material]].forEach(a=>a&&a.dispose()),this.world.world.removeBody(t.body)})}),this.current=new Map}onThrowFinished(){}throwFinished(){let e=!0,t=4;if(this.iterations<10/this.frame_rate)for(let i of this.current.values())for(let a of i){if(a.stopped===!0)continue;let r=a.body.angularVelocity,s=a.body.velocity;if(Math.abs(r.x)3){a.stopped=!0;continue}}else a.stopped=this.iterations;e=!1}else a.stopped=void 0,e=!1}return e}},Zt=m0;Zt.DEFAULT_EXTRA_FRAMES=30;var zo=class{constructor(e,t){this.WIDTH=e;this.HEIGHT=t;this.world=new $0({gravity:new y(0,0,-9.82*400)});this.ground=this.getPlane();this.diceMaterial=new Ve;this.deskMaterial=new Ve;this.barrierMaterial=new Ve;this.world.broadphase=new d6,this.world.allowSleep=!0,this.ground.position.set(0,0,0),this.world.addBody(this.ground),this.buildWalls()}add(...e){e.forEach(t=>{this.world.addBody(t.body)})}step(e=1/60){let t=performance.now()/1e3;if(!this.lastCallTime)this.world.step(e);else{let i=t-this.lastCallTime;this.world.step(e,i)}this.lastCallTime=t}buildWalls(){this.world.addContactMaterial(new He(this.deskMaterial,this.diceMaterial,{friction:.01,restitution:.5,contactEquationRelaxation:3,contactEquationStiffness:1e8})),this.world.addContactMaterial(new He(this.barrierMaterial,this.diceMaterial,{friction:.01,restitution:1,contactEquationRelaxation:3,contactEquationStiffness:1e8})),this.world.addContactMaterial(new He(this.diceMaterial,this.diceMaterial,{friction:.1,restitution:.5,contactEquationRelaxation:3,contactEquationStiffness:1e8})),this.world.addBody(new i1({allowSleep:!1,mass:0,shape:new t4,material:this.deskMaterial}));let e=new i1({allowSleep:!1,mass:0,shape:new t4,material:this.barrierMaterial});e.quaternion.setFromAxisAngle(new y(1,0,0),Math.PI/2),e.position.set(0,this.HEIGHT*.93,0),this.world.addBody(e),e=new i1({allowSleep:!1,mass:0,shape:new t4,material:this.barrierMaterial}),e.quaternion.setFromAxisAngle(new y(1,0,0),-Math.PI/2),e.position.set(0,-this.HEIGHT*.93,0),this.world.addBody(e),e=new i1({allowSleep:!1,mass:0,shape:new t4,material:this.barrierMaterial}),e.quaternion.setFromAxisAngle(new y(0,1,0),-Math.PI/2),e.position.set(this.WIDTH*.93,0,0),this.world.addBody(e),e=new i1({allowSleep:!1,mass:0,shape:new t4,material:this.barrierMaterial}),e.quaternion.setFromAxisAngle(new y(0,1,0),Math.PI/2),e.position.set(-this.WIDTH*.93,0,0),this.world.addBody(e)}getPlane(){return new i1({type:i1.STATIC,shape:new t4})}},Ao=class extends Xt.Component{constructor(e,t,i){super();this.width=e;this.height=t;this.plugin=i;this.dice={};this.buildDice()}get colors(){return{diceColor:this.plugin.data.diceColor,textColor:this.plugin.data.textColor}}updateColors(){this.dispose(),this.buildDice()}onunload(){this.dispose()}disposeChildren(...e){e.forEach(t=>{"dispose"in t&&t.dispose(),t.children&&this.disposeChildren(...t.children)})}dispose(){for(let e of Object.values(this.dice))this.disposeChildren(e.geometry.children)}getDiceForRoller(e,t){let i=[];switch(e.faces.max){case 4:{i.push(...new Array(e.rolls).fill(0).map(a=>new Mi(this.width,this.height,this.clone("d4"),t)));break}case 1:case 6:{i.push(...new Array(e.rolls).fill(0).map(a=>new xi(this.width,this.height,e.fudge?this.clone("fudge"):this.clone("d6"),t)));break}case 8:{i.push(...new Array(e.rolls).fill(0).map(a=>new gi(this.width,this.height,this.clone("d8"),t)));break}case 10:{i.push(...new Array(e.rolls).fill(0).map(a=>new D4(this.width,this.height,this.clone("d10"),t)));break}case 12:{i.push(...new Array(e.rolls).fill(0).map(a=>new vi(this.width,this.height,this.clone("d12"),t)));break}case 20:{i.push(...new Array(e.rolls).fill(0).map(a=>new mi(this.width,this.height,this.clone("d20"),t)));break}case 100:{i.push(...new Array(e.rolls).fill(0).map(a=>[new D4(this.width,this.height,this.clone("d100"),t,!0),new D4(this.width,this.height,this.clone("d10"),t,!0)]).flat());break}}return i}getDice(e,t){let i=new Map;for(let a of e.dynamic){let r=this.getDiceForRoller(a,t);r.length&&i.set(a,r)}return i}clone(e){if(!(e in this.dice))throw new Error("That dice type does not exist!");return this.dice[e].clone()}buildDice(){this.dice.d100=new ti(this.width,this.height,this.colors).create(),this.dice.d20=new J3(this.width,this.height,this.colors).create(),this.dice.d12=new Q3(this.width,this.height,this.colors).create(),this.dice.d10=new ei(this.width,this.height,this.colors).create(),this.dice.d8=new ii(this.width,this.height,this.colors).create(),this.dice.d6=new ai(this.width,this.height,this.colors).create(),this.dice.d4=new ni(this.width,this.height,this.colors).create(),this.dice.fudge=new ri(this.width,this.height,this.colors).create(),this.dice.boost=new di(this.width,this.height,this.colors).create(),this.dice.ability=new ui(this.width,this.height,this.colors).create(),this.dice.difficulty=new hi(this.width,this.height,this.colors).create(),this.dice.challenge=new ci(this.width,this.height,this.colors).create(),this.dice.proficiency=new oi(this.width,this.height,this.colors).create(),this.dice.setback=new pi(this.width,this.height,this.colors).create()}};var So=w2(_o());var Hi=class{constructor(e){this.table=e}parse(e){let t=e.length,i=this.table,a=[],r=[],s=0;for(;sf||u===f&&l.associativity==="right")break;a.push(r.shift())}r.unshift(o)}else a.push(o)}}for(;r.length;){let o=r.shift();if(o.value!=="(")a.push(o);else throw new Error("Mismatched parentheses.")}return a}};var ih=/(?:\d+[Dd])?#(?:[\p{Letter}\p{Emoji_Presentation}\w/-]+)(?:\|(?:[+-]))?(?:\|(?:[^+-]+))?/u,ah=/(?:\d+[Dd])?#(?:[\p{Letter}\p{Emoji_Presentation}\w/-]+)(?:\|(?:[+-]))?\|link/u,rh=/(?:.*)?(?:\[.*\]\(|\[\[)(?:.+?)#?\^(?:.+?)(?:\)|\]\])\|?(?:.+)?/u,nh=/(?:\d+[Dd])?(?:\[.*\]\(|\[\[)(?:.+)(?:\)|\]\])\|?(?:.+)?/u,sh=/(?:\d+[Dd])?(?:\[.*\]\(|\[\[)(?:.+)(?:\)|\]\])\|line/u,oh=/[\(\^\+\-\*\/\)]/u,ch=/(?:\d+|\b)[Dd](?:\[?(?:-?\d+[ \t]?,)?[ \t]?(?:-?\d+|%|F)\]?|\b)/u,lh=/(?:=|=!|<|>|<=|>=|=<|=>|-=|=-)\d+/u,g0=class{constructor(e){this.plugin=e;this.lexer=So.compile({WS:[{match:/[ \t]+/u},{match:/[{}]+/u}],table:rh,line:sh,section:nh,link:ah,tag:ih,condition:lh,kl:{match:/kl\d*/u,value:this.clampInfinite},kh:[{match:/kh\d*/u,value:this.clampInfinite},{match:/k\d*/u,value:this.clampInfinite}],dh:{match:/dh\d*/u,value:this.clampInfinite},dl:[{match:/dl\d*/u,value:this.clampInfinite}],"!!":{match:/!!(?:i|\d+)?/u,value:this.clampInfinite},"!":{match:/!(?:i|\d+)?/u,value:this.clampInfinite},r:{match:/r(?:i|\d+)?/u,value:this.clampInfinite},stunt:/1[Dd]S/u,"%":/\d+[Dd]\d+%/u,dice:[{match:ch,value:e=>{let{roll:t=this.plugin.data.defaultRoll,faces:i=this.plugin.data.defaultFace}=e.match(/(?\d+)?[Dd](?\[?(?:-?\d+[ \t]?,)?[ \t]?(?:-?\d+|%|F)\]?)?/).groups;return`${t}d${i}`}},{match:/\d+/u},{match:/\b[A-Za-z][A-Za-z0-9_]+\b/u,value:e=>this.plugin.inline.has(e)?`${this.plugin.inline.get(e)}`:e}],sort:[{match:/s(?:a|d)*/u,value:e=>e=="s"||e=="sa"?"sa":"sd"}],math:oh});let t={precedence:3,associativity:"right"},i={precedence:2,associativity:"left"},a={precedence:1,associativity:"left"};this.parser=new Hi({"+":a,"-":a,"*":i,"/":i,"^":t})}clampInfinite(e){return/i$/.test(e)?"100":e.replace(/^\D+/g,"")}parse(e){let t=Array.from(this.lexer.reset(e));return this.lexer.reset(),this.parser.parse(this.transform(t))}transform(e){e=e.filter(i=>i.type!="WS");let t=[];for(let i of e)if(i.type=="condition"&&t.length>0){let a=t[t.length-1];a.conditions||(a.conditions=[]);let[r,s,o]=i.value.match(/(?=|=!|<|>|<=|>=|=<|=>|\-=|=\-)(?\d+)/)??[];a.conditions.push({operator:s,comparer:Number(o),value:i.value})}else t.push(i);return t}getTypeFromLexemes(e){return e.some(({type:t})=>t==="table")?"table":e.some(({type:t})=>t==="section")?"section":e.some(({type:t})=>t==="tag")?"tag":e.some(({type:t})=>t==="link")?"link":e.some(({type:t})=>t==="line")?"line":"dice"}};var we=w2(require("@codemirror/view")),Eo=w2(require("@codemirror/language")),mt=w2(require("obsidian"));function uh(n,e,t){for(let i of n.ranges)if(i.from<=t&&i.to>=e)return!0;return!1}function Lo(n,e){let t=app.workspace.getActiveFile();if(!t)return;let i=[],a=n.state.selection,r=new RegExp(".*?_?inline-code_?.*");for(let{from:s,to:o}of n.visibleRanges)(0,Eo.syntaxTree)(n.state).iterate({from:s,to:o,enter:({node:c})=>{let l=c.type;if(l.name.includes("formatting")||!r.test(l.name))return;let u=c.from,f=c.to;if(uh(a,u,f+1))return;let h=n.state.doc.sliceString(u,f).trim();if(/^dice-mod:\s*([\s\S]+)\s*?/.test(h)){let[,g]=h.match(/dice-mod:\s*([\s\S]+)\s*?/),x=app.workspace.getActiveFile(),p=e.getRollerSync(g,x.path);p.roll().then(d=>{let A=e.data.displayFormulaForMod?`${p.inlineText} **${p.replacer}**`:`${p.replacer}`,b={from:u-1,to:f+1,insert:A},C=n.state.update({changes:b});n.dispatch(C)});return}if(!/^dice(?:\+|\-)?:\s*([\s\S]+)\s*?/.test(h))return;let[,m]=h.match(/^dice(?:\+|\-)?:\s*([\s\S]+)\s*?/),v=e.getRollerSync(m,t.path);i.push(we.Decoration.replace({widget:new Do(h,v,n),inclusive:!1,block:!1}).range(u-1,f+1))}});return we.Decoration.set(i,!0)}var Do=class extends we.WidgetType{constructor(e,t,i){super();this.rawQuery=e;this.roller=t;this.view=i}eq(e){return e.rawQuery===this.rawQuery}toDOM(e){return this.roller.roll(),this.roller.containerEl}ignoreEvent(e){if(e.type==="mousedown"){let t=this.view.posAtCoords({x:e.x,y:e.y});if(e.shiftKey){if(t){let{editor:i}=this.view.state.field(mt.editorEditorField).state.field(mt.editorViewField);i.setCursor(i.offsetToPos(t))}return!1}}return!0}};function To(n){return we.ViewPlugin.fromClass(class{constructor(e){this.decorations=Lo(e,n)??we.Decoration.none}update(e){if(!e.state.field(mt.editorLivePreviewField)){this.decorations=we.Decoration.none;return}(e.docChanged||e.viewportChanged||e.selectionSet)&&(this.decorations=Lo(e.view,n)??we.Decoration.none)}},{decorations:e=>e.decorations})}String.prototype.matchAll=String.prototype.matchAll||function*(e){let t=e.global?e.flags:e.flags+"g",i=new RegExp(e,t),a;for(;a=i.exec(this);)yield a};var h6={returnAllTags:!0,rollLinksForTags:!1,copyContentButton:!0,customFormulas:[],displayFormulaForMod:!0,displayResultsInline:!1,displayLookupRoll:!0,formulas:{},persistResults:!1,results:{},defaultRoll:1,defaultFace:100,renderer:!1,renderAllDice:!1,renderTime:2e3,diceColor:"#202020",textColor:"#ffffff",showLeafOnStartup:!0,showDice:!0,round:de.None},Ni=class extends e2.Plugin{constructor(){super(...arguments);this.fileMap=new Map;this.inline=new Map;this.operators={"+":(e,t)=>e+t,"-":(e,t)=>e-t,"*":(e,t)=>e*t,"/":(e,t)=>e/t,"^":(e,t)=>Math.pow(e,t)};this.parser=new g0(this);this.persistingFiles=new Set}async onload(){console.log("DiceRoller plugin loaded"),this.data=Object.assign({},h6,await this.loadData()),this.renderer=new Zt(this),this.addSettingTab(new u6(this.app,this)),this.registerView(M4,i=>new Je(this,i)),this.app.workspace.onLayoutReady(()=>this.addDiceView(!0)),this.registerEvent(this.app.workspace.on("dice-roller:update-colors",()=>{this.renderer.factory.updateColors()})),this.registerEvent(this.app.workspace.on("dice-roller:render-dice",async i=>{let a=await this.getRoller(i,"external");if(!(a instanceof _2)){new e2.Notice("The Dice View only supports dice rolls.");return}if(await a.roll(),!a.dice.length){new e2.Notice("Invalid formula.");return}try{this.renderRoll(a)}catch(r){new e2.Notice("There was an error rendering the roll."),console.error(r)}this.app.workspace.trigger("dice-roller:rendered-result",a.result)})),this.addCommand({id:"open-view",name:"Open Dice View",callback:()=>{this.view?this.app.workspace.revealLeaf(this.view.leaf):this.addDiceView()}}),this.addCommand({id:"reroll",name:"Re-roll Dice",checkCallback:i=>{let a=this.app.workspace.getActiveViewOfType(e2.MarkdownView);if(a&&a.getMode()==="preview"&&this.fileMap.has(a.file))return i||this.fileMap.get(a.file).forEach(s=>{s.roll()}),!0}});let e=T0(Pi).html[0];(0,e2.addIcon)(De,e);let t=T0(Ii).html[0];(0,e2.addIcon)(Te,t),this.registerMarkdownPostProcessor(this.postprocessor.bind(this)),this.registerEditorExtension([To(this)]),this.app.workspace.onLayoutReady(async()=>{await this.registerDataviewInlineFields()})}async postprocessor(e,t){let i=e.querySelectorAll("code");if(!i.length)return;let a=t.sourcePath,r=t.getSectionInfo(e),s=t.getSectionInfo(e)?.lineStart,o=this.app.vault.getAbstractFileByPath(t.sourcePath);if((!o||!(o instanceof e2.TFile))&&a!="STATBLOCK_RENDERER")return;let c={},l,u=!1,f=[];for(let h=0;h{p.on("new-result",async()=>{let b=l.slice(r.lineStart,r.lineEnd+1),C=p.replacer;if(!C){new e2.Notice("Dice Roller: There was an issue modifying the file.");return}let E=x?`${p.inlineText} ${C}`:`${C}`;b=b.join(` +`).replace(`\`${v}\``,E).split(` +`),l.splice(r.lineStart,r.lineEnd-r.lineStart+1,...b),d()})})),await p.roll();continue}catch(v){console.error(v)}if(!!/^dice(?:\+|\-|\-mod)?:\s*([\s\S]+)\s*?/.test(m.innerText))try{let[,v]=m.innerText.match(/^dice(?:\+|\-|\-mod)?:\s*([\s\S]+)\s*?/),g=await this.getRoller(v,t.sourcePath),x=this.data.results?.[a]?.[s]?.[h]??null;(this.data.persistResults&&!/dice\-/.test(m.innerText)||/dice\+/.test(m.innerText))&&(this.persistingFiles.add(t.sourcePath),c[h]=g,g.save=!0);let p=this.data.renderAllDice;v.includes("|render")&&(p=!0),v.includes("|norender")&&(p=!1);let d=async()=>{await g.roll(),g.save&&x&&await g.applyResult(x),g instanceof _2&&(g.shouldRender=p),m.replaceWith(g.containerEl)};if(g.loaded?await d():g.on("loaded",async()=>{await d()}),!o||!(o instanceof e2.TFile))continue;this.fileMap.has(o)||this.fileMap.set(o,[]),this.fileMap.set(o,[...this.fileMap.get(o),g]);let A=this.app.workspace.getActiveViewOfType(e2.MarkdownView);if(A&&this.fileMap.has(o)&&this.fileMap.get(o).length===1){let b=this,C=H0(A,{onUnloadFile:function(E){return async function(T){return T==o&&(b.fileMap.delete(o),C()),await E.call(this,T)}}});A.register(C),A.register(()=>this.fileMap.delete(o))}}catch(v){console.error(v),new e2.Notice(`There was an error parsing the dice string: ${m.innerText}. + +${v}`,5e3);continue}}if(!(!o||!(o instanceof e2.TFile))&&(u&&f.length&&(await Promise.all(f),await this.app.vault.modify(o,l.join(` +`))),a in this.data.results&&(this.data.results[a][s]={}),Object.entries(c).length)){let h=this.app.workspace.getActiveViewOfType(e2.MarkdownView);if(h){let m=this,v=H0(h,{onUnloadFile:function(g){return async function(x){if(x=o){m.persistingFiles.has(a)&&(m.persistingFiles.delete(a),m.data.results[a]={});for(let p in c){let d=c[p],A=t.getSectionInfo(e)?.lineStart;if(A==null)continue;let b={[A]:{...m.data.results[a]?.[A]??{},[p]:d.toResult()}};m.data.results[a]={...m.data.results[a]??{},...b},await m.saveSettings()}}return v(),await g.call(this,x)}}});h.register(v),h.register(async()=>{this.persistingFiles.has(a)&&(this.persistingFiles.delete(a),this.data.results[a]={});for(let g in c){let x=c[g],p=t.getSectionInfo(e)?.lineStart;if(p==null)continue;let d={[p]:{...this.data.results[a]?.[p]??{},[g]:x.toResult()}};this.data.results[a]={...this.data.results[a]??{},...d},await this.saveSettings()}})}}}get canUseDataview(){return this.app.plugins.getPlugin("dataview")!=null}get dataview(){return this.app.plugins.getPlugin("dataview")}get dataviewAPI(){return(0,Ho.getAPI)()}async dataviewReady(){return new Promise(e=>{this.canUseDataview||e(!1),this.dataview.api&&e(!0),this.registerEvent(this.app.metadataCache.on("dataview:api-ready",()=>{e(!0)}))})}get view(){let e=this.app.workspace.getLeavesOfType(M4),t=e.length?e[0]:null;if(t&&t.view&&t.view instanceof Je)return t.view}async getArrayRoller(e,t=1){let i=new F0(this,e,t);return await i.roll(),i}async addDiceView(e=!1){e&&!this.data.showLeafOnStartup||this.app.workspace.getLeavesOfType(M4).length||await this.app.workspace.getRightLeaf(!1).setViewState({type:M4})}async registerDataviewInlineFields(){if(!this.canUseDataview)return;await this.dataviewReady(),this.dataview.index.pages.forEach(({fields:t})=>{for(let[i,a]of t)typeof a!="number"||Number.isNaN(a)||a==null||this.inline.set(i,a)}),this.registerEvent(this.app.metadataCache.on("dataview:metadata-change",(t,i)=>{if(t==="update"){let a=this.dataview.api.page(i.path);if(!a)return;for(let r in a){let s=a[r];typeof s!="number"||Number.isNaN(s)||s==null||this.inline.set(r,s)}}}))}async renderRoll(e){if(!(e instanceof _2)||!e?.dice?.length){new e2.Notice(`This dice roll can't be rendered: ${e.original}`);return}this.addChild(this.renderer),this.renderer.setDice(e),await this.renderer.start(),e.recalculate()}async parseDice(e,t){let i=await this.getRoller(e,t);return{result:await i.roll(),roller:i}}parseDiceSync(e,t){let i=this.getRollerSync(e,t);if(i instanceof _2)return{result:i.result,roller:i}}clearEmpties(e){for(var t in e)!e[t]||typeof e[t]!="object"||(this.clearEmpties(e[t]),Object.keys(e[t]).length===0&&delete e[t])}async saveSettings(){this.clearEmpties(this.data.results),await this.saveData(this.data)}get dataview_regex(){let e=Array.from(this.inline.keys());return e.length?new RegExp(`(${e.join("|")})`,"g"):null}async getRoller(e,t="",i=this.data.showDice){e=e.replace(/\\\|/g,"|");let a=e.includes("|nodice")?!1:i,r=this.data.displayResultsInline,s=f2.Roll,o="",c=/\|text\((.*)\)/;if(e.includes("|form")&&(r=!0),e.includes("|noform")&&(r=!1),e.includes("|avg")&&(s=f2.Average),e.includes("|none")&&(s=f2.None),e.includes("|text(")){let[,f]=e.match(c)??[null,""];o=f}e=(0,Vi.decode)(e.replace("|nodice","").replace("|render","").replace("|norender","").replace("|noform","").replace("|form","").replace("|avg","").replace("|none","").replace(c,"")),e in this.data.formulas&&(e=this.data.formulas[e]);let l=this.parse(e);switch(this.getTypeFromLexemes(l)){case"dice":{let f=new _2(this,e,l,a,o,s);return f.showFormula=r,f}case"table":{let f=new I4(this,e,l[0],t,a);return await f.init,f}case"section":return new Ct(this,e,l[0],t,a);case"tag":{if(!this.canUseDataview)throw new Error("Tags are only supported with the Dataview plugin installed.");return new o6(this,e,l[0],t,a)}case"link":return new c6(this,e,l[0],t,a);case"line":return new l6(this,e,l[0],t,a)}}getRollerSync(e,t,i=this.data.showDice){e=e.replace(/\\\|/g,"|");let a=e.includes("|nodice")?!1:i,r=this.data.renderAllDice,s=!1,o=f2.Roll,c="",l=/\|text\((.*)\)/;if(e.includes("|render")&&(r=!0),e.includes("|norender")&&(r=!1),e.includes("|form")&&(s=!0),e.includes("|noform")&&(s=!1),e.includes("|avg")&&(o=f2.Average),e.includes("|none")&&(o=f2.None),e.includes("|text(")){let[,h]=e.match(l)??[null,""];c=h}e=(0,Vi.decode)(e.replace("|nodice","").replace("|render","").replace("|norender","").replace("|noform","").replace("|form","").replace("|avg","").replace("|none","").replace(l,"")),e in this.data.formulas&&(e=this.data.formulas[e]);let u=this.parse(e);switch(this.getTypeFromLexemes(u)){case"dice":{let h=new _2(this,e,u,a,c,o);return h.shouldRender=r,h.showFormula=s,h}case"table":{let h=new I4(this,e,u[0],t,a);return h.init,h}case"section":return new Ct(this,e,u[0],t,a);case"tag":{if(!this.canUseDataview)throw new Error("Tags are only supported with the Dataview plugin installed.");return new o6(this,e,u[0],t,a)}case"link":return new c6(this,e,u[0],t,a);case"line":return new l6(this,e,u[0],t,a)}}getTypeFromLexemes(e){return e.some(({type:t})=>t==="table")?"table":e.some(({type:t})=>t==="section")?"section":e.some(({type:t})=>t==="tag")?"tag":e.some(({type:t})=>t==="link")?"link":e.some(({type:t})=>t==="line")?"line":"dice"}onunload(){console.log("DiceRoller unloaded"),this.app.workspace.getLeavesOfType(M4).forEach(e=>e.detach()),"__THREE__"in window&&delete window.__THREE__,this.renderer.unload(),this.app.workspace.trigger("dice-roller:unload")}parse(e){return this.parser.parse(e)}}; +/*! + * Font Awesome Free 5.15.3 by @fontawesome - https://fontawesome.com + * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) + */ +/*! + * Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com + * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) + */ +/*! https://mths.be/he v1.2.0 by @mathias | MIT license */ diff --git a/.obsidian/plugins/obsidian-dice-roller/manifest.json b/.obsidian/plugins/obsidian-dice-roller/manifest.json new file mode 100644 index 0000000..559b4d7 --- /dev/null +++ b/.obsidian/plugins/obsidian-dice-roller/manifest.json @@ -0,0 +1,10 @@ +{ + "id": "obsidian-dice-roller", + "name": "Dice Roller", + "version": "8.8.3", + "minAppVersion": "0.12.15", + "description": "Inline dice rolling for Obsidian.md", + "author": "Jeremy Valentine", + "authorUrl": "", + "isDesktopOnly": false +} diff --git a/.obsidian/plugins/obsidian-dice-roller/styles.css b/.obsidian/plugins/obsidian-dice-roller/styles.css new file mode 100644 index 0000000..091b694 --- /dev/null +++ b/.obsidian/plugins/obsidian-dice-roller/styles.css @@ -0,0 +1 @@ +.dice-roller{position:relative;display:inline-flex;align-items:flex-start;cursor:pointer;margin:0 .25em 0 0;vertical-align:top}.dice-roller.no-icon{margin:0}.dice-roller>div{display:inline-block}.dice-roller span{font-weight:700}.dice-roller>.dice-roller-button{display:inline-block;position:relative;font-size:inherit;margin-left:.25em}.dice-roller.has-embed .dice-roller-result{width:100%;padding:1rem}.dice-roller.has-embed .dice-roller-result .markdown-embed{display:flex;margin-top:.5rem;padding-right:0}.dice-roller.has-embed .dice-roller-button{padding-top:.5rem}.dice.tooltip{max-width:unset!important}.workspace .markdown-preview-view .dice-roller.has-embed{display:flex;padding-right:.25rem;margin:.25rem 0}.dice-no-results{font-style:italic;text-align:center}.dice-roller.has-embed .internal-embed{width:100%}.dice-roller.has-embed .internal-embed .dice-roller>.dice-roller-button,.dice-roller.has-embed .internal-embed .dice-roller>.dice-roller-result{display:inline;padding:0}.dice-roller.has-embed .internal-embed .dice-roller>.dice-roller-result .embedded-table-result{margin-bottom:0}.dice-roller.has-embed .internal-embed *:last-child:not(svg):not(.dice-content-copy):not(.markdown-embed .dice-roller):not(.dice-roller-result > .embedded-table-result *){margin-bottom:15px}.dice-roller.has-embed .dice-file-name{font-style:italic}.dice-section-result{position:relative}.dice-content-copy{color:var(--text-faint);cursor:pointer;height:fit-content}.dice-content-copy.no-show{display:none}.dice-content-copy:hover{color:var(--text-normal)}.dice-roller.has-embed .dice-section-result .dice-content-copy,.dice-content-copy:hover{opacity:1}.dice-roller-result{position:relative}.dice-roller-result .embedded-table-result p{margin:0}.dice-roller-settings .coffee{width:60%;color:var(--text-faint);margin:.5rem auto;text-align:center}.dice-roller-settings .coffee img{height:30px}.dice-roller-setting-additional-container>.setting-item:not(.setting-item-heading){border:0px}.dice-roller-setting-additional-container{border-bottom:1px solid var(--background-modifier-border);border-top:1px solid var(--background-modifier-border);padding:18px 0}.dice-roller-setting-additional-container>.setting-item-heading:only-child{padding-bottom:18px}.dice-roller-setting-additional-container>.additional .no-formulas{width:auto;display:block;text-align:center}.dice-roller-setting-additional-container>.additional>.setting-item{border-top:0;padding-top:9px}.dice-roller-setting-additional-container>.additional>.setting-item>.setting-item-control>*:first-child{margin:0 6px}.dice-roller-setting-additional-container .add-new-formula{margin:0 1rem;padding:1rem 1rem 0;border-radius:.5rem;box-shadow:0 0 .25rem var(--background-modifier-box-shadow)}.dice-roller-setting-additional-container .add-new-formula .formula-data .setting-item{border:0}.renderer-container{position:absolute;top:0;left:0;width:100vw;height:100vh;pointer-events:none;z-index:9999999;transition:opacity 1s ease-out}.dice-roller-view .dice-roller-roll:disabled{cursor:not-allowed;opacity:.75}.workspace-split.mod-right-split .view-content.dice-roller-view{padding:.5rem;display:flex;flex-flow:column nowrap;justify-content:flex-start;gap:12px}.dice-roller-view .dice-roller-grid{display:grid;grid-template-rows:auto auto;justify-content:center;gap:6px}.dice-roller-view .dice-roller-grid .dice-buttons{display:flex;flex-flow:row wrap;align-items:center;justify-content:center;width:fit-content}.dice-roller-view .dice-roller-grid .dice-custom-formula-container{display:flex;justify-content:space-between;align-items:center}.dice-roller-view .dice-roller-grid .dice-custom-formula{display:flex;justify-content:flex-start;align-items:center}.dice-roller-view .setting-editor-extra-setting-button{width:fit-content}.dice-roller-view .dice-button .clickable-icon>svg{width:36px;height:36px}.dice-roller-view .dice-context{display:grid;grid-template-columns:1fr auto}.dice-roller-view .dice-context .add-subtract{display:flex;align-items:center}.dice-roller-view input,.dice-roller-view textarea{width:100%}.dice-roller-view .dice-roller-grid .advantage-disadvantage{display:flex;justify-content:center;align-items:center;gap:.5rem}.dice-roller-view .dice-roller-grid .advantage-disadvantage button{margin:0;min-width:66px}.dice-roller-view .dice-roller-formula{display:flex;flex-flow:column nowrap;justify-content:space-between;align-items:flex-end;gap:12px}.dice-roller-view .dice-roller-formula .action-buttons{display:flex;justify-content:flex-end}.dice-roller-view .dice-roller-formula button{margin-right:0;margin-left:12px}.dice-roller-view hr{margin-bottom:0}.dice-roller-view .dice-roller-results-container .dice-roller-results-header{display:flex;justify-content:space-between;align-items:center;margin:6px 0;width:100%;border-bottom:1px solid var(--background-modifier-border)}.dice-roller-view .dice-roller-results-container .dice-roller-results-header h4{margin:0}.dice-roller-view .dice-roller-results{display:flex;flex-flow:column nowrap;gap:6px}.dice-roller-view .dice-roller-results .view-result{display:flex;flex-flow:column nowrap;justify-content:center;align-items:center;border:1px solid var(--background-modifier-border);border-radius:.25rem;position:relative}.dice-roller-view .dice-roller-results .view-result .dice-content-copy{position:absolute;top:0;right:0;padding:.25rem}.dice-roller-view .dice-roller-results .view-result .dice-result-reroll{position:absolute;top:0;left:0;padding:.25rem;margin:0}.dice-roller-view .dice-roller-results .view-result strong{font-size:x-large}.dice-roller-view .dice-roller-results .view-result .result-context{align-self:flex-end;width:100%;display:flex;align-items:center;justify-content:space-between;padding:.25rem;font-size:x-small}.dice-roller-view .dice-roller-results .view-result .result-context .clickable-icon{margin-right:0}.dice-roller-view .dice-roller-results>span{color:var(--text-muted);margin:0 auto}.dice-renderer{position:absolute;top:0;left:0} diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json new file mode 100644 index 0000000..eb4db45 --- /dev/null +++ b/.obsidian/workspace.json @@ -0,0 +1,186 @@ +{ + "main": { + "id": "cade60a22c6dc7d7", + "type": "split", + "children": [ + { + "id": "cba1aae80e9e8606", + "type": "tabs", + "children": [ + { + "id": "d972188d2f679094", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "Die Aussicht.md", + "mode": "source", + "source": false + } + } + }, + { + "id": "9aee527eaa7a8ec4", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "Barovia (Land).md", + "mode": "source", + "source": false + } + } + }, + { + "id": "311f74d7cd4a942b", + "type": "leaf", + "state": { + "type": "graph", + "state": {} + } + } + ] + } + ], + "direction": "vertical" + }, + "left": { + "id": "00212f740ec84f10", + "type": "split", + "children": [ + { + "id": "91c8c6ba8621d306", + "type": "tabs", + "children": [ + { + "id": "569e019b8e6581eb", + "type": "leaf", + "state": { + "type": "file-explorer", + "state": { + "sortOrder": "alphabetical" + } + } + }, + { + "id": "dac699cf0aa64ad1", + "type": "leaf", + "state": { + "type": "search", + "state": { + "query": "tag:#rast", + "matchingCase": true, + "explainSearch": false, + "collapseAll": true, + "extraContext": false, + "sortOrder": "alphabetical" + } + } + }, + { + "id": "0c7d9abaca3988bd", + "type": "leaf", + "state": { + "type": "starred", + "state": {} + } + } + ] + } + ], + "direction": "horizontal", + "width": 300 + }, + "right": { + "id": "4264c84078ea359d", + "type": "split", + "children": [ + { + "id": "d43b99769c65228b", + "type": "tabs", + "children": [ + { + "id": "19b0de0d62eb64c6", + "type": "leaf", + "state": { + "type": "backlink", + "state": { + "collapseAll": false, + "extraContext": false, + "sortOrder": "alphabetical", + "showSearch": false, + "searchQuery": "", + "backlinkCollapsed": false, + "unlinkedCollapsed": true + } + } + }, + { + "id": "f99c8cdefa4613bc", + "type": "leaf", + "state": { + "type": "outgoing-link", + "state": { + "linksCollapsed": false, + "unlinkedCollapsed": true + } + } + }, + { + "id": "0dc4f13e577c6610", + "type": "leaf", + "state": { + "type": "tag", + "state": { + "sortOrder": "frequency", + "useHierarchy": true + } + } + }, + { + "id": "75521776a5d3b8fe", + "type": "leaf", + "state": { + "type": "outline", + "state": {} + } + }, + { + "id": "b32deb806707e5d1", + "type": "leaf", + "state": { + "type": "DICE_ROLLER_VIEW", + "state": {} + } + } + ] + } + ], + "direction": "horizontal", + "width": 300, + "collapsed": true + }, + "left-ribbon": { + "hiddenItems": { + "switcher:Open quick switcher": false, + "graph:Open graph view": false, + "canvas:Create new canvas": false, + "daily-notes:Open today's daily note": false, + "templates:Insert template": false, + "command-palette:Open command palette": false + } + }, + "active": "d972188d2f679094", + "lastOpenFiles": [ + "Was geschieht.canvas", + "Ismark.md", + "Nikolai Waart.md", + "Der andere Waart.md", + "Valaki.md", + "Barovia (Land).md", + "Barovia (Stadt).md", + "Straht.md", + "Madamme Eva.md", + "Tsersee.md" + ] +} \ No newline at end of file diff --git a/Angriff von einem Irren.md b/Angriff von einem Irren.md new file mode 100644 index 0000000..8f3aa84 --- /dev/null +++ b/Angriff von einem Irren.md @@ -0,0 +1,3 @@ +#encounter #fight Ein komischer Kauz ist gerade hier, hat geschnüffelt und komisch gelacht. Macht den Boden zwischenuns und ihm zu Gegnern,. + +Wir haben diesen verklopft, jedoch hat dieser bei der Befragung selbst erledigt. \ No newline at end of file diff --git a/Barovia (Land).md b/Barovia (Land).md new file mode 100644 index 0000000..61c56de --- /dev/null +++ b/Barovia (Land).md @@ -0,0 +1 @@ +Das Land des [[Straht]] \ No newline at end of file diff --git a/Barovia (Stadt).md b/Barovia (Stadt).md new file mode 100644 index 0000000..54afe31 --- /dev/null +++ b/Barovia (Stadt).md @@ -0,0 +1 @@ +Was ein dreckskaff.... Gehört [[Ismark]] \ No newline at end of file diff --git a/Beerdigung des Bürgermeisters.md b/Beerdigung des Bürgermeisters.md new file mode 100644 index 0000000..8d9be8b --- /dev/null +++ b/Beerdigung des Bürgermeisters.md @@ -0,0 +1 @@ +Diese lief nahtlos, aber als wir uns nach [[Valaki]] begaben, ass ich einen der Traumküchlein. Es war... schön alles war wie vor [[Mythis Infelicis]] in das land gefallen ist... \ No newline at end of file diff --git a/Beim Bürgermeister.md b/Beim Bürgermeister.md new file mode 100644 index 0000000..063ece9 --- /dev/null +++ b/Beim Bürgermeister.md @@ -0,0 +1 @@ +Der Bürgermeister hat uns die Quest aufgegeben, die Schwester nach Valaki zu bringen \ No newline at end of file diff --git a/Callaradaranana.md b/Callaradaranana.md new file mode 100644 index 0000000..b76d0e6 --- /dev/null +++ b/Callaradaranana.md @@ -0,0 +1 @@ +Call.... call \ No newline at end of file diff --git a/Der Fallensteller nahe Tserpool.md b/Der Fallensteller nahe Tserpool.md new file mode 100644 index 0000000..b8f115c --- /dev/null +++ b/Der Fallensteller nahe Tserpool.md @@ -0,0 +1 @@ +#encounter diff --git a/Der andere Waart.md b/Der andere Waart.md new file mode 100644 index 0000000..cc5098d --- /dev/null +++ b/Der andere Waart.md @@ -0,0 +1,5 @@ +Komischer kauz + +Scheint etwas zu Sagen zu haben in [[Valaki]] + +Der Bruter ist [[Nikolai Waart]] \ No newline at end of file diff --git a/Die Aussicht.md b/Die Aussicht.md new file mode 100644 index 0000000..5bbef23 --- /dev/null +++ b/Die Aussicht.md @@ -0,0 +1,2 @@ +Die Aussicht ist genial! +Wir sehen [[Valaki]] von hier aus, sowie den Zarchovich. \ No newline at end of file diff --git a/Die Götter.md b/Die Götter.md new file mode 100644 index 0000000..8c4464f --- /dev/null +++ b/Die Götter.md @@ -0,0 +1,5 @@ +# Morninglord +Der Gott des Morgens + +# Mothernight +Die Göttin der Nacht... lol \ No newline at end of file diff --git a/Die Windmühle!.md b/Die Windmühle!.md new file mode 100644 index 0000000..0dedc0e --- /dev/null +++ b/Die Windmühle!.md @@ -0,0 +1,5 @@ +Wir erkenne ein Wagen der Küchleinverkäuferin bei einer Windmühle und gehen da hin. Dort ziehen die Raaben ab und scheinen uns zu Warnen. + +Es scheint, als würden wir hier das Geheimniss der Muffins kennenlernen.... + +Hier scheint die [[]] \ No newline at end of file diff --git a/Die heulende tocherlose Mutter.md b/Die heulende tocherlose Mutter.md new file mode 100644 index 0000000..107f8a0 --- /dev/null +++ b/Die heulende tocherlose Mutter.md @@ -0,0 +1 @@ +Unser team ist \ No newline at end of file diff --git a/In der Taverne.md b/In der Taverne.md new file mode 100644 index 0000000..3bdb7ce --- /dev/null +++ b/In der Taverne.md @@ -0,0 +1 @@ +[[Versira]] konnte eine Quest ausmachen, um eine eskortmission einzuholen \ No newline at end of file diff --git a/Ismark.md b/Ismark.md new file mode 100644 index 0000000..e69de29 diff --git a/Madamme Eva.md b/Madamme Eva.md new file mode 100644 index 0000000..93a51aa --- /dev/null +++ b/Madamme Eva.md @@ -0,0 +1,21 @@ +# Zur Person +Eine Wahrsagerin welche uns weiterhelfen könnte. +Sie befindet sich ausserhalb der Stadt in einem Camp beim + +Sie lebt an einem kleinen Lager am [[Tsersee]] + +# Das Treffen +Kommentare zu [[Versira]] +Suche nach familie, Willentlich hier? + +Kommentar zur [[Havli]] +Auf der Suche zum Auftrag. Hat sie prinzipien? + +Kommentar zu [[Eric |Eric Lavendershield]] +Suche nach dem Gott? What? + +... toll... die alte ist nicht hilfreich :( + + +Sie hat uns komische karten gezeigt! + diff --git a/Madamme Evas Kolonie.md b/Madamme Evas Kolonie.md new file mode 100644 index 0000000..7a62a32 --- /dev/null +++ b/Madamme Evas Kolonie.md @@ -0,0 +1 @@ +Der Ort von Madamme Eva diff --git a/Nikolai Waart.md b/Nikolai Waart.md new file mode 100644 index 0000000..2e75109 --- /dev/null +++ b/Nikolai Waart.md @@ -0,0 +1,3 @@ +Scheint eine grössere Person zu sein, welche ETWAS zu tun hat... keine Ahnung... Lebt in [[Valaki]] + +Bruter ist [[Der andere Waart]] \ No newline at end of file diff --git a/Player/Die Zusammenkunft der Kämpfer.md b/Player/Die Zusammenkunft der Kämpfer.md new file mode 100644 index 0000000..857b772 --- /dev/null +++ b/Player/Die Zusammenkunft der Kämpfer.md @@ -0,0 +1,6 @@ +Als die unbekannten Personen von der Klippe gefallen sind, flog [[Mythis Infelicis]] diesen nach. Ihre Kraft reichte leider nur für 3 der Vier Personen. Der letzte.... nun ja.... er war ein Held. + +Nun liegen die Helden bewustlos am Boden... + +# Ein komisches erwachen +Die personen scheinen mir nicht zu glauben... Verdammt. diff --git a/Player/Eric (Gomati)/Eric.md b/Player/Eric (Gomati)/Eric.md new file mode 100644 index 0000000..0aef39e --- /dev/null +++ b/Player/Eric (Gomati)/Eric.md @@ -0,0 +1,7 @@ +![Eric](https://media.discordapp.net/attachments/1057374125955481631/1066331041175978034/gomati2.png) + +# Eigene Gedanken +Ist halt eine Maschine. Was kann ich zu ihm sagen... Nunja ich mag wie gläubisch er ist! Er kann mir sicherlich mehr über diese Welt erzählen... + +# Bittet Gott Helm +Er ist der Gott der Gerechtigkeit \ No newline at end of file diff --git a/Player/Havil (Mona)/Havli.md b/Player/Havil (Mona)/Havli.md new file mode 100644 index 0000000..7121d64 --- /dev/null +++ b/Player/Havil (Mona)/Havli.md @@ -0,0 +1,7 @@ +![Havil](https://dnd.james-things.com/grau/ddb-images/characters/90706724-Havli.jpeg) +# Eigene Gedanken +Sehr Geld orientiert... Aber wenn Sie ein Team hat scheint sie definitiv für Ihr team zu kämpfen. (Beispielsweise bei der Dame die ich versucht habe zu retten.) + +Minimal Empathish +# Geschichte der drei Vampire +[[Havli]] erzählte uns diese Geschichte als wir über Wein geredet hatten.. Irgendwas von wegen Jungfernblut... was für ein Tier das wohl sein mag? \ No newline at end of file diff --git a/Player/InfelicisManra Infelicis/Infelicis.png b/Player/InfelicisManra Infelicis/Infelicis.png new file mode 100644 index 0000000..7809d36 Binary files /dev/null and b/Player/InfelicisManra Infelicis/Infelicis.png differ diff --git a/Player/InfelicisManra Infelicis/Infelicis_t.png b/Player/InfelicisManra Infelicis/Infelicis_t.png new file mode 100644 index 0000000..e4320c8 Binary files /dev/null and b/Player/InfelicisManra Infelicis/Infelicis_t.png differ diff --git a/Player/InfelicisManra Infelicis/Mythis Infelicis.md b/Player/InfelicisManra Infelicis/Mythis Infelicis.md new file mode 100644 index 0000000..a45b34a --- /dev/null +++ b/Player/InfelicisManra Infelicis/Mythis Infelicis.md @@ -0,0 +1,19 @@ +"Vom Glauben verlassen und vom Pech verfolgt." +# Zusammenfassung +Mythis Infelicis welche sich aber nur als Manra zu zeigen gibt, ist eine knapp 26 Jahre alte [Kalashtar](https://www.worldanvil.com/w/asfreiya-silverlance/a/kalashtar-article#:~:text=The%20typical%20kalashtar%20only%20lives,to%20live%20beyond%20100%20years.). Sie ist die Göttin des Pechs und schaut, dass Ihre gläubiger kein Pech mehr haben. Nicht viele kennen den vollen Namen der Göttin Infelicis. +# Aussehen + +# Wie ich da hin kam +Mythis hatte seit langem kein unglück mehr auf sich nehmen müssen. Es fühlt sich an, als hätte ich mein Leben noch nie richtig gelebt, und ich kann gott spielen wie ich will. + +Ich hörte einen Hilferuf, welcher für meinen Schutz plädierte. Diesem bin ich nachgegangen und flog richtung Erde. + +In der nähe von [[Valaki]] in einem Wald welcher zum grössten Teil aus grossen Tannen besteht. + +Die Bäume versperren mir leicht die sicht, aber am schlimmsten ist der Nebel. Weiterhin folgte sie dem Ruf, bis sie überall Wolfsgehäul hörte. Sie kam näher und sah, wie eine Gruppe aus knapp 15 Leuten kampfbereit in eine Richtung weitersetzen. Um die Gruppe rennen wolfsähnliche viecher welche konstant von den Wölfen abgefangen werden. + +Es werden weniger und weniger... + +Ab vier verbleibenden bemerke ich, wie 2 Menschen, ein Elfähnlicher und ein Warforged an einen Abgrund gedrängt werden. Unbekannt ist, wer nach der Hilfe schreit. + +Die Wölfe schienen den Ambush vorbereitet zu haben und die Helden fallen. Mir war es nur möglich, drei Personen das Pech zu entziehen. Dem Warforged, einem Mensch sowie dem Elfen. diff --git a/Player/InfelicisManra Infelicis/Mythis Infelicis.xcf b/Player/InfelicisManra Infelicis/Mythis Infelicis.xcf new file mode 100644 index 0000000..53e1ae9 Binary files /dev/null and b/Player/InfelicisManra Infelicis/Mythis Infelicis.xcf differ diff --git a/Player/InfelicisManra Infelicis/Mythis.png b/Player/InfelicisManra Infelicis/Mythis.png new file mode 100644 index 0000000..50cca12 Binary files /dev/null and b/Player/InfelicisManra Infelicis/Mythis.png differ diff --git a/Player/InfelicisManra Infelicis/MythisInfelicis_token.xcf b/Player/InfelicisManra Infelicis/MythisInfelicis_token.xcf new file mode 100644 index 0000000..58e1507 Binary files /dev/null and b/Player/InfelicisManra Infelicis/MythisInfelicis_token.xcf differ diff --git a/Player/InfelicisManra Infelicis/Mythis_Infelicis_t.zip b/Player/InfelicisManra Infelicis/Mythis_Infelicis_t.zip new file mode 100644 index 0000000..59168de Binary files /dev/null and b/Player/InfelicisManra Infelicis/Mythis_Infelicis_t.zip differ diff --git a/Player/InfelicisManra Infelicis/Mythis_t.png b/Player/InfelicisManra Infelicis/Mythis_t.png new file mode 100644 index 0000000..81be895 Binary files /dev/null and b/Player/InfelicisManra Infelicis/Mythis_t.png differ diff --git a/Player/InfelicisManra Infelicis/a.png b/Player/InfelicisManra Infelicis/a.png new file mode 100644 index 0000000..7809d36 Binary files /dev/null and b/Player/InfelicisManra Infelicis/a.png differ diff --git a/Player/InfelicisManra Infelicis/b.png b/Player/InfelicisManra Infelicis/b.png new file mode 100644 index 0000000..50cca12 Binary files /dev/null and b/Player/InfelicisManra Infelicis/b.png differ diff --git a/Player/Versira (Svart)/Versira.md b/Player/Versira (Svart)/Versira.md new file mode 100644 index 0000000..34a5508 --- /dev/null +++ b/Player/Versira (Svart)/Versira.md @@ -0,0 +1,6 @@ +![Versira](https://dnd.james-things.com/grau/ddb-images/characters/90742080-Versira-Dant-s.jpeg) + +# Eigene Gedanken +Was ne blöde kuh... Hat die dame überhaubt empathie? + +Sucht ihre Eltern? Beim [[Tsersee]] haben wir herausgefunden, dass sie noch Eltern irgendwo in [[Barovia (Land)]] hat \ No newline at end of file diff --git a/Steinkreis! (bei der Mühle).md b/Steinkreis! (bei der Mühle).md new file mode 100644 index 0000000..dafc49e --- /dev/null +++ b/Steinkreis! (bei der Mühle).md @@ -0,0 +1,3 @@ +Steinkreis! + + diff --git a/Straht.md b/Straht.md new file mode 100644 index 0000000..9a92fe6 --- /dev/null +++ b/Straht.md @@ -0,0 +1 @@ +Der grosse böse Mann :( \ No newline at end of file diff --git a/Tsersee.md b/Tsersee.md new file mode 100644 index 0000000..2fef366 --- /dev/null +++ b/Tsersee.md @@ -0,0 +1,2 @@ +Ort an dem [[Madamme Eva]] lebt +![](https://dnd.james-things.com/grau/worlds/curse-of-strahd/Bilder/c01336e3afee65d696eb95ba7edbbc38.webp) diff --git a/Valaki.md b/Valaki.md new file mode 100644 index 0000000..78d367c --- /dev/null +++ b/Valaki.md @@ -0,0 +1,5 @@ +Der Ort, wo wir die Schwester von Bürgermeister [[Ismark]] hingebracht werden muss. + +Funfact, [[Ismark]] muss NICHT da hin, sondern nach [[]] :/ + +[[Nikolai Waart]] und [[Der andere Waart]] haben **schätze ich** etwas da zu sagen... ㄟ( ▔, ▔ )ㄏ \ No newline at end of file diff --git a/Was geschieht.canvas b/Was geschieht.canvas new file mode 100644 index 0000000..d4bbceb --- /dev/null +++ b/Was geschieht.canvas @@ -0,0 +1,112 @@ +{ + "nodes":[ + {"id":"8a317cf591eac17d","x":-1210,"y":491,"width":250,"height":109,"type":"text","text":"Meeting zum Werwölfe jagen"}, + {"id":"36b1db182086d4a7","x":-781,"y":-1366,"width":608,"height":1428,"type":"file","file":"Player/Eric (Gomati)/Eric.md"}, + {"id":"727c87e4232d27c8","x":-1389,"y":-1366,"width":608,"height":1428,"type":"file","file":"Player/Havil (Mona)/Havli.md"}, + {"id":"71349b608c964c40","x":-1997,"y":-1371,"width":608,"height":1433,"type":"file","file":"Player/Versira (Svart)/Versira.md"}, + {"id":"b22e04debe76d92a","x":-960,"y":600,"width":1487,"height":753,"type":"file","file":"Player/InfelicisManra Infelicis/Mythis Infelicis.md","subpath":"#Wie ich da hin kam"}, + {"id":"bb0fd579678e33cb","x":639,"y":811,"width":692,"height":333,"type":"file","file":"Player/InfelicisManra Infelicis/Mythis Infelicis.md","subpath":"#Zusammenfassung"}, + {"id":"c44b83fdccee9021","x":1540,"y":777,"width":384,"height":400,"type":"file","file":"Player/InfelicisManra Infelicis/Infelicis_t.png"}, + {"id":"de9923f3cfe6b834","x":1540,"y":272,"width":384,"height":400,"type":"file","file":"Player/InfelicisManra Infelicis/Mythis_t.png"}, + {"id":"1870ce968c2e3da6","x":2084,"y":777,"width":400,"height":400,"type":"file","file":"Player/InfelicisManra Infelicis/Infelicis.png"}, + {"id":"62076bbbab9d7134","x":2084,"y":272,"width":400,"height":400,"type":"file","file":"Player/InfelicisManra Infelicis/Mythis.png"}, + {"id":"02ef86debe19f2e3","x":-960,"y":1402,"width":1487,"height":419,"type":"file","file":"Player/Die Zusammenkunft der Kämpfer.md"}, + {"id":"300e713da4f18340","x":673,"y":1419,"width":573,"height":386,"type":"file","file":"Die Götter.md"}, + {"id":"aef7cb3ace59c7a7","x":193,"y":1866,"width":2280,"height":1206,"color":"4","type":"group","label":"Barovia"}, + {"id":"32e9747ea0e7f5b7","x":946,"y":1989,"width":400,"height":400,"type":"file","file":"In der Taverne.md"}, + {"id":"a32d602b0aa321dd","x":233,"y":2204,"width":354,"height":308,"type":"file","file":"Barovia (Stadt).md"}, + {"id":"1ccb38f288f34f77","x":1820,"y":2233,"width":400,"height":400,"type":"file","file":"Beim Bürgermeister.md"}, + {"id":"513155026a50a12f","x":3033,"y":2243,"width":400,"height":395,"type":"file","file":"Tsersee.md"}, + {"id":"1a582d55e82d6cc3","x":1067,"y":2536,"width":452,"height":240,"type":"file","file":"Valaki.md"}, + {"id":"baa1b7fdfff2d7b5","x":3517,"y":2306,"width":742,"height":269,"type":"file","file":"Madamme Eva.md","subpath":"#Zur Person"}, + {"id":"63ad86b43e10d749","x":268,"y":2702,"width":442,"height":314,"type":"file","file":"Die heulende tocherlose Mutter.md"}, + {"id":"cf3a1dd1be1e1681","x":1620,"y":2776,"width":800,"height":240,"type":"file","file":"Beerdigung des Bürgermeisters.md"}, + {"id":"dff25e39079583ca","x":1041,"y":3169,"width":650,"height":216,"color":"3","type":"text","text":"# Das Treffen von Straht\n#encounter\nAm Fluss trafen wir auf Straht. Er schienrelativ chill"}, + {"id":"0e7c5e9962ce46df","x":928,"y":3451,"width":876,"height":346,"color":"3","type":"text","text":"#encounter \n# Der Fallensteller nahe Tserpool\n## Erstes Treffen\nWir haben einen Fallensteller getroffen er scheint nach nützlichen Waffen gegen Werwölfe zu suchen. Etwas scheien komisch zu sein."}, + {"id":"c8ce0e4fef527307","x":1675,"y":7869,"width":443,"height":544,"color":"3","type":"file","file":"Die Windmühle!.md"}, + {"id":"e9f99d2f00d6f7c3","x":2345,"y":8054,"width":753,"height":175,"color":"5","type":"file","file":"Steinkreis! (bei der Mühle).md"}, + {"id":"727add681abfd8a8","x":1126,"y":7500,"width":481,"height":319,"type":"file","file":"Die Aussicht.md"}, + {"id":"b40e10a5117a2342","x":1038,"y":7115,"width":658,"height":238,"color":"3","type":"text","text":"#encounter #landmark\nWir erreichen ein Grosses Tor. Die Toore öffnen sich automatisch wieder. Wir haben von [[Ismark]] mitbekommen, dass das Tor im Osten uns in die Welt von [[Barovia (Land)]]"}, + {"id":"9b32391d8ada2d29","x":1044,"y":6859,"width":645,"height":212,"color":"3","type":"text","text":"#encounter #landmark\nWir erreichen eine Kreuzung! (scary)\n\nrechte Seite \"Castle Ravenloft\"\nlinke Seite \"Valaki\""}, + {"id":"de9676da36705ed3","x":1172,"y":6634,"width":389,"height":139,"color":"4","type":"text","text":"#longrest\nERSTE RAST IM FREIEN\nNicht viel ist passiert..."}, + {"id":"457f80849b4d3de1","x":1098,"y":6075,"width":537,"height":279,"color":"3","type":"text","text":"#encounter\nRaaben sind uns gefolgt, sie scheinen kein Problem zu machen und sollten eventuell nicht angegriffen werden. Wer weis... ob die wohl mit der Raabenkönigin von [[Havli]] zu tun haben?"}, + {"id":"d719ea8424b3a958","x":1098,"y":6396,"width":537,"height":193,"color":"3","type":"text","text":"#encounter\nEs wurde ein Kind von den Werwölfen getötet... [[Havli]] schätzt, dass dies vor etwa einem Tag passierte."}, + {"id":"a103eeb730f8e8d8","x":1098,"y":5506,"width":537,"height":527,"color":"3","type":"text","text":"#encounter\nEin Vogelkäfig im nichts, er liegt einfach da... MENACINGLY!\n![](https://media.tenor.com/YrRklqOSCtgAAAAC/patrick-menacingly.gif)"}, + {"id":"6f8c3034c99beae6","x":-2238,"y":4325,"width":3010,"height":1369,"color":"1","type":"group","label":"Die Karten!"}, + {"id":"01a2dc070a5fd6af","x":-677,"y":5264,"width":400,"height":400,"color":"6","type":"text","text":"# Innocent\nDiese Karte wirft ein Licht auf jemanden, der im Kampf gegen die Dunkelheit sehr helfen wird. (Blick richtung Zelteingang) Die Braut des Bösen ist diejenige die Ihr sucht. (Sie schaut Irina an)"}, + {"id":"4428b340a55fd07f","x":1098,"y":5325,"width":537,"height":146,"color":"4","type":"text","text":"#longrest\nALKOHOL!\nT.T\n"}, + {"id":"4a36a511e6b4be30","x":-1077,"y":4808,"width":400,"height":400,"color":"6","type":"link","url":"https://dnd.james-things.com/grau/worlds/curse-of-strahd/Bilder/Tarokka%20Deck/Darklord.png"}, + {"id":"515b159175fefa59","x":-677,"y":4808,"width":533,"height":400,"color":"6","type":"text","text":"# DER DUNKLE LORD!\nDer Feind ist eine Kreatur der Dunkelheit, wessen Kräfte jenseits der DUnkelheit wahren\n\nEr lauert in den Tiefen der DUnkelheit, an dem einen Ort zu dem er immer wieder zurück ziehen muss."}, + {"id":"b81bea1aa703cc56","x":-63,"y":4808,"width":400,"height":400,"color":"6","type":"link","url":"https://dnd.james-things.com/grau/worlds/curse-of-strahd/Bilder/Tarokka%20Deck/Merchant.png"}, + {"id":"80f65e6ccfcdd308","x":337,"y":4808,"width":428,"height":400,"color":"6","type":"text","text":"# The Merchant\nDies ist eine Karte der Macht und Stärke, von einer Waffe der Rache. Einem Schwert aus Sonnenlicht. Sucht ein Fass, welches den BESTEN Wein enthielt, von dem kein Tropfen mehr übrig ist."}, + {"id":"cdd6d2676ef71f9b","x":1036,"y":4736,"width":660,"height":544,"type":"file","file":"Madamme Eva.md","subpath":"#Das Treffen"}, + {"id":"2364f44915b426be","x":-1077,"y":5264,"width":400,"height":400,"color":"6","type":"link","url":"https://dnd.james-things.com/grau/worlds/curse-of-strahd/Bilder/Tarokka%20Deck/Innocent.png"}, + {"id":"4348680610f593b8","x":-1077,"y":4335,"width":400,"height":400,"color":"6","type":"link","url":"https://dnd.james-things.com/grau/worlds/curse-of-strahd/Bilder/Tarokka%20Deck/Conjurer.png"}, + {"id":"a6498cd0b45a9b01","x":-1811,"y":4799,"width":656,"height":400,"color":"6","type":"text","text":"# The hooded one\nDiese Karte erzählt die geschichte, die Kenntniss der Antique wird uns helfen, den Feind besser zu verstehen.\n\nIch sehe einen Gesichtslosen Gott\nEr ist am Ende einer Kurvenreichen Strasse tief in den Bergen"}, + {"id":"9993f727770797a7","x":1036,"y":4172,"width":660,"height":517,"type":"file","file":"Tsersee.md"}, + {"id":"5f438eddbbc53ee4","x":-677,"y":4335,"width":400,"height":400,"color":"6","type":"text","text":"# The Conjourer\nDiese Karte erzählt von einer machtigen Kraft und Schutz. Ein Totes Dorf versunken in einem Fluss regiert von einem, der Grosses, Böses über die Welt gebracht hat."}, + {"id":"7eef234175296ea0","x":2134,"y":4632,"width":524,"height":206,"type":"file","file":"Wizards of Winery.md"}, + {"id":"25b88183d13a4226","x":2134,"y":4260,"width":524,"height":342,"type":"file","file":"Player/Havil (Mona)/Havli.md","subpath":"#Geschichte der drei Vampire"}, + {"id":"8c6e9e6230ff0eb2","x":-2211,"y":4799,"width":400,"height":400,"color":"6","type":"link","url":"https://dnd.james-things.com/grau/worlds/curse-of-strahd/Bilder/Tarokka%20Deck/Hooded%20One.png"}, + {"id":"f63dd223d84cb4ce","x":2134,"y":4020,"width":453,"height":206,"type":"text","text":"Kampf des Zauberers welcher gegen Straht kämpft?\nDumm gelaufen. LOL"}, + {"id":"35ff718ccbb9fe54","x":928,"y":3855,"width":876,"height":268,"color":"3","type":"text","text":"#encounter\n# Wegweiser nach Barovia\nWir haben einen wegweiser mit einem Galgen richtung Tser-See Ravenloft / Valaki"}, + {"id":"a8292ef6fb23f792","x":990,"y":9618,"width":754,"height":311,"type":"text","text":"Valaki Taverne\n\nWurde von [[Nikolai Waart]] und [[Der andere Waart]] angegriffen? Also wortwörtlich gegriffen. Hä?\n\nIch werde mit [[Versira]] im Zimmer übernachten."}, + {"id":"cddb908040a9dadd","x":2120,"y":9181,"width":937,"height":1185,"type":"text","text":"Sessionnotes\n\n# DM\nDanke dass du den YEET erlaubt hattest\n\n# Mona\n\n# Svart\nDu bist nicht der Protagonist! Wenn DM sagt nein, akzeptiere ein Nein.... Musste ich auch bei meinem Moonbeam :/\n\n# Gomati\n\n# .Self\n\n\n# Die Mühle (SPIELER)\nBitte prüft eure allignments und wie ihr zu was steht. Ihr müsst nicht hingehen nur weil ihr hingehen wollt. Will euer Spieler nicht so will er nicht.\n\n# NACH DER NACHBESPRECHUNG\n## Moonbeam anschauen. (Mythis)\n![](https://thinkdm.files.wordpress.com/2021/12/moonbeam-sage-advice.png)\n## Two weapon Fighting (Svart)\nUhoh? Nerf this?"}, + {"id":"9a3825e875643f87","x":1655,"y":7849,"width":1463,"height":1149,"type":"group","label":"Detour!"}, + {"id":"2a8aae40841b8208","x":1675,"y":8495,"width":655,"height":483,"color":"2","type":"file","file":"Angriff von einem Irren.md"}, + {"id":"65caee2bb37a0d52","x":1006,"y":9304,"width":738,"height":293,"type":"file","file":"Valaki.md"}, + {"id":"e454abc960fb51a5","x":1209,"y":8954,"width":332,"height":270,"type":"text","text":"Weiterlaufen, yay!\n\n(Wir haben dafür abgestummen)"}, + {"id":"be452d91ea6b5a83","x":1031,"y":10058,"width":672,"height":78,"type":"text","text":"Und es geht weiter nach Cal... cal... da halt"}, + {"id":"915ee0964b8d98df","x":339,"y":10279,"width":614,"height":232,"type":"file","file":"Callaradaranana.md"} + ], + "edges":[ + {"id":"02d6a0307ae0b197","fromNode":"c44b83fdccee9021","fromSide":"left","toNode":"bb0fd579678e33cb","toSide":"right"}, + {"id":"5b2963470f13b5b4","fromNode":"bb0fd579678e33cb","fromSide":"left","toNode":"b22e04debe76d92a","toSide":"right"}, + {"id":"8bbe070e36c23667","fromNode":"de9923f3cfe6b834","fromSide":"left","toNode":"bb0fd579678e33cb","toSide":"right"}, + {"id":"dfeb15ceeae8a7cf","fromNode":"b22e04debe76d92a","fromSide":"bottom","toNode":"02ef86debe19f2e3","toSide":"top"}, + {"id":"3d58ebea5594f221","fromNode":"36b1db182086d4a7","fromSide":"bottom","toNode":"8a317cf591eac17d","toSide":"top"}, + {"id":"a61cfb2436504a11","fromNode":"8a317cf591eac17d","fromSide":"bottom","toNode":"b22e04debe76d92a","toSide":"left"}, + {"id":"f257d36d6d9feb5c","fromNode":"02ef86debe19f2e3","fromSide":"bottom","toNode":"a32d602b0aa321dd","toSide":"left"}, + {"id":"e1030707358fba44","fromNode":"a32d602b0aa321dd","fromSide":"right","toNode":"32e9747ea0e7f5b7","toSide":"left"}, + {"id":"1a6c945ed0537cc9","fromNode":"32e9747ea0e7f5b7","fromSide":"right","toNode":"1ccb38f288f34f77","toSide":"left","label":"Durch Quest"}, + {"id":"130395ff1a4d9e97","fromNode":"1ccb38f288f34f77","fromSide":"left","toNode":"1a582d55e82d6cc3","toSide":"top","label":"Alter Plan"}, + {"id":"fb2b4c7e07011174","fromNode":"1ccb38f288f34f77","fromSide":"right","toNode":"513155026a50a12f","toSide":"left","label":"Information"}, + {"id":"89f027475903ddc7","fromNode":"513155026a50a12f","fromSide":"right","toNode":"baa1b7fdfff2d7b5","toSide":"left"}, + {"id":"4324e3f9076d259b","fromNode":"300e713da4f18340","fromSide":"left","toNode":"02ef86debe19f2e3","toSide":"right"}, + {"id":"5d458d08469b7e1e","fromNode":"300e713da4f18340","fromSide":"right","toNode":"1ccb38f288f34f77","toSide":"top","label":"Angebetet"}, + {"id":"91836a8c55f2a7c8","fromNode":"1ccb38f288f34f77","fromSide":"bottom","toNode":"cf3a1dd1be1e1681","toSide":"top","label":"Kurze Detour"}, + {"id":"3a9756375783ea58","fromNode":"cf3a1dd1be1e1681","fromSide":"left","toNode":"1a582d55e82d6cc3","toSide":"bottom","label":"Neuer Plan... wait"}, + {"id":"a1f72ee07ed39cdb","fromNode":"727c87e4232d27c8","fromSide":"bottom","toNode":"8a317cf591eac17d","toSide":"top"}, + {"id":"6d3e5b5787dea10c","fromNode":"62076bbbab9d7134","fromSide":"left","toNode":"de9923f3cfe6b834","toSide":"right"}, + {"id":"92b821725b720344","fromNode":"1870ce968c2e3da6","fromSide":"left","toNode":"c44b83fdccee9021","toSide":"right"}, + {"id":"83d3984ae27a586d","fromNode":"a32d602b0aa321dd","fromSide":"bottom","toNode":"63ad86b43e10d749","toSide":"top","label":"Eingebrochen"}, + {"id":"5e2865835346ac67","fromNode":"cf3a1dd1be1e1681","fromSide":"bottom","toNode":"dff25e39079583ca","toSide":"right","label":"SESSION 2"}, + {"id":"9c25fc9a8c810724","fromNode":"9993f727770797a7","fromSide":"right","toNode":"7eef234175296ea0","toSide":"left","label":"Informationen von\nBarney_Klon#42"}, + {"id":"71befae2f079424e","fromNode":"9993f727770797a7","fromSide":"right","toNode":"f63dd223d84cb4ce","toSide":"left","label":"Geschichte! :D"}, + {"id":"b53b823b581dfe73","fromNode":"9993f727770797a7","fromSide":"right","toNode":"25b88183d13a4226","toSide":"left","label":"Von Havli erzählt"}, + {"id":"398443ec9b2ee7f5","fromNode":"9993f727770797a7","fromSide":"bottom","toNode":"cdd6d2676ef71f9b","toSide":"top"}, + {"id":"26975027fadc3f9b","fromNode":"cdd6d2676ef71f9b","fromSide":"left","toNode":"6f8c3034c99beae6","toSide":"right","label":"Laberlaber"}, + {"id":"3e642f3afeedd56c","fromNode":"cdd6d2676ef71f9b","fromSide":"bottom","toNode":"4428b340a55fd07f","toSide":"top"}, + {"id":"a89e24dbeb40276f","fromNode":"4428b340a55fd07f","fromSide":"bottom","toNode":"a103eeb730f8e8d8","toSide":"top"}, + {"id":"3eda4d65e07e96c1","fromNode":"a103eeb730f8e8d8","fromSide":"bottom","toNode":"457f80849b4d3de1","toSide":"top"}, + {"id":"066936e10ff2df3f","fromNode":"457f80849b4d3de1","fromSide":"bottom","toNode":"d719ea8424b3a958","toSide":"top"}, + {"id":"4ff9b3bd48dabcae","fromNode":"d719ea8424b3a958","fromSide":"bottom","toNode":"de9676da36705ed3","toSide":"top"}, + {"id":"73e317d095d5c764","fromNode":"de9676da36705ed3","fromSide":"bottom","toNode":"9b32391d8ada2d29","toSide":"top","label":"SESSION 3"}, + {"id":"5507bd0281249633","fromNode":"dff25e39079583ca","fromSide":"bottom","toNode":"0e7c5e9962ce46df","toSide":"top"}, + {"id":"f7558c4bad6706eb","fromNode":"0e7c5e9962ce46df","fromSide":"bottom","toNode":"35ff718ccbb9fe54","toSide":"top"}, + {"id":"33e3a7228fc73263","fromNode":"1a582d55e82d6cc3","fromSide":"left","toNode":"dff25e39079583ca","toSide":"left","label":"Session 2"}, + {"id":"6308271eea6be143","fromNode":"35ff718ccbb9fe54","fromSide":"bottom","toNode":"9993f727770797a7","toSide":"top"}, + {"id":"66d5da2e7ccdfdd6","fromNode":"9b32391d8ada2d29","fromSide":"bottom","toNode":"b40e10a5117a2342","toSide":"top"}, + {"id":"068d6b25a7d045f5","fromNode":"b40e10a5117a2342","fromSide":"bottom","toNode":"727add681abfd8a8","toSide":"top"}, + {"id":"c3df207136d8e23d","fromNode":"727add681abfd8a8","fromSide":"right","toNode":"c8ce0e4fef527307","toSide":"top","label":"Kurze Detour (Oh no)"}, + {"id":"b294ca3c8e60b382","fromNode":"71349b608c964c40","fromSide":"bottom","toNode":"8a317cf591eac17d","toSide":"top"}, + {"id":"586706605ba5b152","fromNode":"c8ce0e4fef527307","fromSide":"right","toNode":"e9f99d2f00d6f7c3","toSide":"left","label":"Gesehen"}, + {"id":"0264e8a44ce4332a","fromNode":"c8ce0e4fef527307","fromSide":"bottom","toNode":"2a8aae40841b8208","toSide":"top"}, + {"id":"507fe74b988cdc24","fromNode":"2a8aae40841b8208","fromSide":"bottom","toNode":"e454abc960fb51a5","toSide":"right"}, + {"id":"da2995007f68b948","fromNode":"e454abc960fb51a5","fromSide":"bottom","toNode":"65caee2bb37a0d52","toSide":"top"}, + {"id":"f9aa84533b8b3b9c","fromNode":"65caee2bb37a0d52","fromSide":"bottom","toNode":"a8292ef6fb23f792","toSide":"top"}, + {"id":"84ba8f9a6bed011c","fromNode":"a8292ef6fb23f792","fromSide":"bottom","toNode":"be452d91ea6b5a83","toSide":"top","label":"Session 4"}, + {"id":"9d3c018ed8a137d3","fromNode":"a8292ef6fb23f792","fromSide":"right","toNode":"cddb908040a9dadd","toSide":"left","label":"Zusammenfassung"}, + {"id":"75065da21557c81a","fromNode":"be452d91ea6b5a83","fromSide":"bottom","toNode":"915ee0964b8d98df","toSide":"right"} + ] +} \ No newline at end of file diff --git a/Wizards of Winery.md b/Wizards of Winery.md new file mode 100644 index 0000000..c01f9cc --- /dev/null +++ b/Wizards of Winery.md @@ -0,0 +1 @@ +Nach [[Valaki]]... irgendwas da... Habs vergessen :) * *hicks* * \ No newline at end of file