curseofstraht_Grau/.obsidian/plugins/obsidian-5e-statblocks/main.js

440 lines
856 KiB
JavaScript
Raw Permalink Normal View History

2023-02-19 18:10:19 +00:00
/*
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:/
`)})}function p(){return Promise.resolve(e.asArray(document.styleSheets)).then(M).then(v).then(function(T){return T.map(N)});function v(T){return T.filter(function(P){return P.type===CSSRule.FONT_FACE_RULE}).filter(function(P){return t.shouldProcess(P.style.getPropertyValue("src"))})}function M(T){var P=[];return T.forEach(function(L){try{e.asArray(L.cssRules||[]).forEach(P.push.bind(P))}catch(G){console.log("Error while reading CSS rules from "+L.href,G.toString())}}),P}function N(T){return{resolve:function(){var L=(T.parentStyleSheet||{}).href;return t.inlineAll(T.cssText,L)},src:function(){return T.style.getPropertyValue("src")}}}}}function y(){return{inlineAll:p,impl:{newImage:g}};function g(v){return{inline:M};function M(N){return e.isDataUrl(v.src)?Promise.resolve():Promise.resolve(v.src).then(N||e.getAndEncode).then(function(T){return e.dataAsUrl(T,e.mimeType(v.src))}).then(function(T){return new Promise(function(P,L){v.onload=P,v.onerror=L,v.src=T})})}}function p(v){if(!(v instanceof Element))return Promise.resolve(v);return M(v).then(function(){return v instanceof HTMLImageElement?g(v).inline():Promise.all(e.asArray(v.childNodes).map(function(N){return p(N)}))});function M(N){var T=N.style.getPropertyValue("background");return T?t.inlineAll(T).then(function(P){N.style.setProperty("background",P,N.style.getPropertyPriority("background"))}).then(function(){return N}):Promise.resolve(N)}}}})(Ls)});var xa=Ns((Ei,Mi)=>{(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;P<L;++P)G=T[P],l.call(y,G)&&(M[G]=p(y[G],v));return M},f=function(y,g,p,v){var M=h(y,g);v.set(y,M);for(var N=d?i(y).concat(s(y)):i(y),T=0,P=N.length,L=void 0,G=void 0;T<P;++T)if(L=N[T],L!=="callee"&&L!=="caller")if(G=n(y,L),G){!G.get&&!G.set&&(G.value=p(y[L],v));try{t(M,L,G)}catch{M[L]=G.value}}else M[L]=p(y[L],v);return M},k=function(y){var g="";return y.global&&(g+="g"),y.ignoreCase&&(g+="i"),y.multiline&&(g+="m"),y.unicode&&(g+="u"),y.sticky&&(g+="y"),g},C=Array.isArray,w=Object.getPrototypeOf,W=function(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:(console&&console.error&&console.error('Unable to locate global object, returning "this".'),this)}();function E(y,g){var p=!!(g&&g.isStrict),v=g&&g.realm||W,M=p?f:b,N=function(T,P){if(!T||typeof T!="object")return T;if(P.has(T))return P.get(T);var L=T.__proto__||w(T),G=L&&L.constructor;if(!G||G===v.Object)return M(T,v,N,P);var B;if(C(T)){if(p)return f(T,v,N,P);B=new G,P.set(T,B);for(var te=0,F=T.length;te<F;++te)B[te]=N(T[te],P);return B}if(T instanceof v.Date)return new G(T.getTime());if(T instanceof v.RegExp)return B=new G(T.source,T.flags||k(T)),B.lastIndex=T.lastIndex,B;if(v.Map&&T instanceof v.Map)return B=new G,P.set(T,B),T.forEach(function(fe,oe){B.set(oe,N(fe,P))}),B;if(v.Set&&T instanceof v.Set)return B=new G,P.set(T,B),T.forEach(function(fe){B.add(N(fe,P))}),B;if(v.Blob&&T insta
"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;t<a.length;t+=1)a[t]&&a[t].d(e)}function A(a){return document.createElement(a)}function de(a){return document.createTextNode(a)}function R(){return de(" ")}function re(){return de("")}function ue(a,e,t,n){return a.addEventListener(e,t,n),()=>a.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<ea.length;){let e=ea[Qt];Qt++,kt(e),rl(e.$$)}}catch(e){throw ea.length=0,Qt=0,e}for(kt(null),ea.length=0,Qt=0;rt.length;)rt.pop()();for(let e=0;e<Ya.length;e+=1){let t=Ya[e];Vn.has(t)||(Vn.add(t),t())}Ya.length=0}while(ea.length);for(;Kn.length;)Kn.pop()();Yn=!1,Vn.clear(),kt(a)}function rl(a){if(a.fragment!==null){a.update(),me(a.before_update);let e=a.dirty;a.dirty=[-1],a.fragment&&a.fragment.p(a.ctx,e),a.after_update.forEach(Jn)}}var Ja=new Set,Wt;function ie(){Wt={r:0,c:[],p:Wt}}function se(){Wt.r||me(Wt.c),Wt=Wt.p}function I(a,e){a&&a.i&&(Ja.delete(a),a.i(e))}function O(a,e,t,n){if(a&&a.o){if(Ja.has(a))return;Ja.add(a),Wt.c.push(()=>{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].ke
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<t.length;i+=1)n[i]=nr(ar(a,t,i));return{c(){for(let i=0;i<n.length;i+=1)n[i].c();e=re()},m(i,s){for(let r=0;r<n.length;r+=1)n[r].m(i,s);x(i,e,s)},p(i,s){if(s&5){t=i[2](i[0]);let r;for(r=0;r<t.length;r+=1){let c=ar(i,t,r);n[r]?n[r].p(c,s):(n[r]=nr(c),n[r].c(),n[r].m(e.parentNode,e))}for(;r<n.length;r+=1)n[r].d(1);n.length=t.length}},d(i){Ve(n,i),i&&S(e)}}}function gl(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 fl(a){let e=a[5].text+"",t;return{c(){t=de(e)},m(n,i){x(n,t,i)},p(n,i){i&1&&e!==(e=n[5].text+"")&&ve(t,e)},d(n){n&&S(t)}}}function pl(a){let e;function t(s,r){return s[5].isAlias?kl:bl}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 bl(a){let e,t=a[5].text+"",n,i,s,r;return{c(){e=A("a"),n=de(t),i=R(),_(e,"data-href",s=a[5].href),_(e,"href",r=a[5].href),_(e,"class","internal-link"),_(e,"target","_blank"),_(e,"rel","noopener")},m(c,o){x(c,e,o),D(e,n),D(e,i)},p(c,o){o&1&&t!==(t=c[5].text+"")&&ve(n,t),o&1&&s!==(s=c[5].href)&&_(e,"data-href",s),o&1&&r!==(r=c[5].href)&&_(e,"href",r)},d(c){c&&S(e)}}}function kl(a){let e,t=a[5].title+"",n,i,s,r,c;return{c(){e=A("a"),n=de(t),i=R(),_(e,"data-href",s=a[5].href),_(e,"href",r=a[5].href),_(e,"class","internal-link"),_(e,"target","_blank"),_(e,"rel","noreferrer"),_(e,"aria-label",c=a[5].href),_(e,"aria-label-position","top")},m(o,l){x(o,e,l),D(e,n),D(e,i)},p(o,l){l&1&&t!==(t=o[5].title+"")&&ve(n,t),l&1&&s!==(s=o[5].href)&&_(e,"data-href",s),l&1&&r!==(r=o[5].href)&&_(e,"href",r),l&1&&c!==(c=o[5].href)&&_(e,"aria-label",c)},d(o){o&&S(e)}}}function nr(a){let e;function t(s,r){return s[5].isLink?pl:fl}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 vl(a){let e;function t(s,r){return s[1]?ml:gl}let i=t(a,-1)(a);return{c(){e=A("div"),i.c(),_(e,"class","statblock-rendered-text-content inline svelte-1lnliuc")},m(s,r){x(s,e,r),i.m(e,null)},p(s,[r]){i.p(s,r)},i:H,o:H,d(s){s&&S(e),i.d()}}}function yl(a,e,t){let{textToRender:n}=e,i=ge("tryToRenderLinks"),s=ge("context"),r=o=>{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(/(<STATBLOCK-LINK>[\s\S]+?<\/STATBLOCK-LINK>)/).filter(l=>l&&l.length).map(l=>{if(/<STATBLOCK-LINK>([\s\S]+?)<\/STATBLOCK-LINK>/.test(l)){let d=l.match(/<STATBLOCK-LINK>([\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)}}}funct
${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(/<STATBLOCK-LINK>/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],prop
${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<t.length;i+=1)n[i]=Mr(Dr(a,t,i));return{c(){e=A("div");for(let i=0;i<n.length;i+=1)n[i].c();_(e,"class","table svelte-18uixe9")},m(i,s){x(i,e,s);for(let r=0;r<n.length;r+=1)n[r].m(e,null)},p(i,[s]){if(s&15){t=i[1].slice(0,i[3].length);let r;for(r=0;r<t.length;r+=1){let c=Dr(i,t,r);n[r]?n[r].p(c,s):(n[r]=Mr(c),n[r].c(),n[r].m(e,null))}for(;r<n.length;r+=1
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.childElementCount<r&&W.clientHeight+y.get(p)>g&&(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}
${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,'"<STATBLOCK-LINK>$1</STATBLOCK-LINK>"').replace(/\[\[([^"]+?)\]\]/g,(n,i)=>`<STATBLOCK-LINK>${i}</STATBLOCK-LINK>`).replace(/\[([^"]*?)\]\(([^"]+?)\)/g,(n,i,s)=>i.length?`<STATBLOCK-LINK>${s}|${i}</STATBLOCK-LINK>`:`<STATBLOCK-LINK>${s}</STATBLOCK-LINK>`)),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.plug
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Xd(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function yn(a,e){var t=typeof Symbol<"u"&&a[Symbol.iterator]||a["@@iterator"];if(!t){if(Array.isArray(a)||(t=Fi(a))||e&&a&&typeof a.length=="number"){t&&(a=t);var n=0,i=function(){};return{s:i,n:function(){return n>=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;i<t.length;i++)if(Yr(a,t[i])){var s=zt.has(e)&&zt.get(e).get(i);return s&&!Gi(Pa(a),s)?{index:n,isProximityBased:!1}:{index:i,isProximityBased:!1}}for(var r=Number.MAX_VALUE,c=void 0,o=0;o<t.length;o++){var l=ou(a,t[o]);l<r&&(r=l,c=o)}return{index:c,isProximityBased:!0}}var Ea=25;function ho(){var a;function e(){a={directionObj:void 0,step
${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:"\\u039
${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
${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("O
`).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",'<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="grip-lines-vertical" class="svg-inline--fa fa-grip-lines-vertical fa-w-8" role="img" viewBox="0 0 256 512"><path fill="currentColor" d="M96 496V16c0-8.8-7.2-16-16-16H48c-8.8 0-16 7.2-16 16v480c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16zm128 0V16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v480c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16z"/></svg>'),(0,je.addIcon)("statblock-conditioned",'<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="far" data-icon="question-circle" class="svg-inline--fa fa-question-circle fa-w-16" role="img" viewBox="0 0 512 512"><path fill="currentColor" d="M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 448c-110.532 0-200-89.431-200-200 0-110.495 89.472-200 200-200 110.491 0 200 89.471 200 200 0 110.53-89.431 200-200 200zm107.244-255.2c0 67.052-72.421 68.084-72.421 92.863V300c0 6.627-5.373 12-12 12h-45.647c-6.627 0-12-5.373-12-12v-8.659c0-35.745 27.1-50.034 47.579-61.516 17.561-9.845 28.324-16.541 28.324-29.579 0-17.246-21.999-28.693-39.784-28.693-23.189 0-33.894 10.977-48.942 29.969-4.057 5.12-11.46 6.071-16.666 2.124l-27.824-21.098c-5.107-3.872-6.251-11.066-2.644-16.363C184.846 131.491 214.94 112 261.794 112c49.071 0 101.45 38.304 101.45 88.8zM298 368c0 23.159-18.841 42-42 42s-42-18.841-42-42 18.841-42 42-42 42 18.841 42 42z"/></svg>'),(0,je.addIcon)("dice-roller-dice",'<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="dice" class="svg-inline--fa fa-dice fa-w-20" role="img" viewBox="0 0 640 512"><path fill="currentColor" d="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-24s2
${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,"<STATBLOCK-LINK>$1</STATBLOCK-LINK>").replace(/\[([\s\S]*?)\]\(([\s\S]+?)\)/g,(c,o,l)=>o.length?`<STATBLOCK-LINK>${l}|${o}</STATBLOCK-LINK>`:`<STATBLOCK-LINK>${l}</STATBLOCK-LINK>`);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}};