diff --git a/CHANGELOG.md b/CHANGELOG.md index b9f47b0..1dbbbd8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,18 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [2.0.0](https://github.com/derikb/hadleyville-online/compare/v1.0.0...v2.0.0) (2022-01-13) + + +### Features + +* Focus management improvements ([8156b0e](https://github.com/derikb/hadleyville-online/commit/8156b0eba1826eb9ead4c3e5d04f7f33dbeb3f36)) +* New table items, new rules ([817dbcd](https://github.com/derikb/hadleyville-online/commit/817dbcdfd0e57b5106f97c0d7dd7008ec1817ad2)) +* **notes:** Delete notes that are new and empty ([4204849](https://github.com/derikb/hadleyville-online/commit/42048499f980d6757fb42a98da5a4d4926789202)), closes [#10](https://github.com/derikb/hadleyville-online/issues/10) +* **npcs:** Allow markdown in notes property ([902609a](https://github.com/derikb/hadleyville-online/commit/902609a78c0687b3e2e0758802fc4a54b3ed7201)) +* **tabledrawer:** Click outside to close ([1a4b131](https://github.com/derikb/hadleyville-online/commit/1a4b131891f38fe07155f90dd10a56fb33705613)), closes [#11](https://github.com/derikb/hadleyville-online/issues/11) +* **ui:** Collapse all button for npcs/notes ([3356b12](https://github.com/derikb/hadleyville-online/commit/3356b12d986d7b85bc989c8211251a07bab5fd5e)) + ## 1.0.0 (2021-06-27) diff --git a/dist/index.js b/dist/index.js index 0cdc064..e610e24 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,27 +1,27 @@ -(()=>{var tc=Object.create;var tn=Object.defineProperty;var rc=Object.getOwnPropertyDescriptor;var nc=Object.getOwnPropertyNames;var ic=Object.getPrototypeOf,oc=Object.prototype.hasOwnProperty;var ac=t=>tn(t,"__esModule",{value:!0});var E=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var sc=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of nc(e))!oc.call(t,i)&&(r||i!=="default")&&tn(t,i,{get:()=>e[i],enumerable:!(n=rc(e,i))||n.enumerable});return t},Qt=(t,e)=>sc(ac(tn(t!=null?tc(ic(t)):{},"default",!e&&t&&t.__esModule?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var Po=E((te,Fo)=>{"use strict";Object.defineProperty(te,"__esModule",{value:!0});te.isPlainObject=te.clone=te.recursive=te.merge=te.main=void 0;Fo.exports=te=pt;te.default=pt;function pt(){for(var t=[],e=0;e{"use strict";var Zc=Xc(Po());Object.defineProperty(bt,"__esModule",{value:!0}),bt.save=ld,bt.load=ud,bt.combineLoads=cd,bt.clear=dd;function Xc(t){return t&&t.__esModule?t:{default:t}}function Qc(t,e){return nd(t)||rd(t,e)||td(t,e)||ed()}function ed(){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 td(t,e){if(t){if(typeof t=="string")return qo(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?qo(t,e):void 0}}function qo(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r{_d.exports={Aacute:"\xC1",aacute:"\xE1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223E",acd:"\u223F",acE:"\u223E\u0333",Acirc:"\xC2",acirc:"\xE2",acute:"\xB4",Acy:"\u0410",acy:"\u0430",AElig:"\xC6",aelig:"\xE6",af:"\u2061",Afr:"\u{1D504}",afr:"\u{1D51E}",Agrave:"\xC0",agrave:"\xE0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03B1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2A3F",amp:"&",AMP:"&",andand:"\u2A55",And:"\u2A53",and:"\u2227",andd:"\u2A5C",andslope:"\u2A58",andv:"\u2A5A",ang:"\u2220",ange:"\u29A4",angle:"\u2220",angmsdaa:"\u29A8",angmsdab:"\u29A9",angmsdac:"\u29AA",angmsdad:"\u29AB",angmsdae:"\u29AC",angmsdaf:"\u29AD",angmsdag:"\u29AE",angmsdah:"\u29AF",angmsd:"\u2221",angrt:"\u221F",angrtvb:"\u22BE",angrtvbd:"\u299D",angsph:"\u2222",angst:"\xC5",angzarr:"\u237C",Aogon:"\u0104",aogon:"\u0105",Aopf:"\u{1D538}",aopf:"\u{1D552}",apacir:"\u2A6F",ap:"\u2248",apE:"\u2A70",ape:"\u224A",apid:"\u224B",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224A",Aring:"\xC5",aring:"\xE5",Ascr:"\u{1D49C}",ascr:"\u{1D4B6}",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224D",Atilde:"\xC3",atilde:"\xE3",Auml:"\xC4",auml:"\xE4",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:"\u0411",bcy:"\u0431",bdquo:"\u201E",becaus:"\u2235",because:"\u2235",Because:"\u2235",bemptyv:"\u29B0",bepsi:"\u03F6",bernou:"\u212C",Bernoullis:"\u212C",Beta:"\u0392",beta:"\u03B2",beth:"\u2136",between:"\u226C",Bfr:"\u{1D505}",bfr:"\u{1D51F}",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:"\u2AED",bnot:"\u2310",Bopf:"\u{1D539}",bopf:"\u{1D553}",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:"\u2564",boxhD:"\u2565",boxHD:"\u2566",boxhu:"\u2534",boxHu:"\u2567",boxhU:"\u2568",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",bsolb:"\u29C5",bsol:"\\",bsolhsub:"\u27C8",bull:"\u2022",bullet:"\u2022",bump:"\u224E",bumpE:"\u2AAE",bumpe:"\u224F",Bumpeq:"\u224E",bumpeq:"\u224F",Cacute:"\u0106",cacute:"\u0107",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",cap:"\u2229",Cap:"\u22D2",capcup:"\u2A47",capdot:"\u2A40",CapitalDifferentialD:"\u2145",caps:"\u2229\uFE00",caret:"\u2041",caron:"\u02C7",Cayleys:"\u212D",ccaps:"\u2A4D",Ccaron:"\u010C",ccaron:"\u010D",Ccedil:"\xC7",ccedil:"\xE7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2A4C",ccupssm:"\u2A50",Cdot:"\u010A",cdot:"\u010B",cedil:"\xB8",Cedilla:"\xB8",cemptyv:"\u29B2",cent:"\xA2",centerdot:"\xB7",CenterDot:"\xB7",cfr:"\u{1D520}",Cfr:"\u212D",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03A7",chi:"\u03C7",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",cir:"\u25CB",cirE:"\u29C3",cire:"\u2257",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201D",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",colon:":",Colon:"\u2237",Colone:"\u2A74",colone:"\u2254",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{1D49E}",cscr:"\u{1D4B8}",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",ctdot:"\u22EF",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22DE",cuesc:"\u22DF",cularr:"\u21B6",cularrp:"\u293D",cupbrcap:"\u2A48",cupcap:"\u2A46",CupCap:"\u224D",cup:"\u222A",Cup:"\u22D3",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:"\u21A1",dArr:"\u21D3",dash:"\u2010",Dashv:"\u2AE4",dashv:"\u22A3",dbkarow:"\u290F",dblac:"\u02DD",Dcaron:"\u010E",dcaron:"\u010F",Dcy:"\u0414",dcy:"\u0434",ddagger:"\u2021",ddarr:"\u21CA",DD:"\u2145",dd:"\u2146",DDotrahd:"\u2911",ddotseq:"\u2A77",deg:"\xB0",Del:"\u2207",Delta:"\u0394",delta:"\u03B4",demptyv:"\u29B1",dfisht:"\u297F",Dfr:"\u{1D507}",dfr:"\u{1D521}",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:"\u0402",djcy:"\u0452",dlcorn:"\u231E",dlcrop:"\u230D",dollar:"$",Dopf:"\u{1D53B}",dopf:"\u{1D555}",Dot:"\xA8",dot:"\u02D9",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",DownArrowBar:"\u2913",downarrow:"\u2193",DownArrow:"\u2193",Downarrow:"\u21D3",DownArrowUpArrow:"\u21F5",DownBreve:"\u0311",downdownarrows:"\u21CA",downharpoonleft:"\u21C3",downharpoonright:"\u21C2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295E",DownLeftVectorBar:"\u2956",DownLeftVector:"\u21BD",DownRightTeeVector:"\u295F",DownRightVectorBar:"\u2957",DownRightVector:"\u21C1",DownTeeArrow:"\u21A7",DownTee:"\u22A4",drbkarow:"\u2910",drcorn:"\u231F",drcrop:"\u230C",Dscr:"\u{1D49F}",dscr:"\u{1D4B9}",DScy:"\u0405",dscy:"\u0455",dsol:"\u29F6",Dstrok:"\u0110",dstrok:"\u0111",dtdot:"\u22F1",dtri:"\u25BF",dtrif:"\u25BE",duarr:"\u21F5",duhar:"\u296F",dwangle:"\u29A6",DZcy:"\u040F",dzcy:"\u045F",dzigrarr:"\u27FF",Eacute:"\xC9",eacute:"\xE9",easter:"\u2A6E",Ecaron:"\u011A",ecaron:"\u011B",Ecirc:"\xCA",ecirc:"\xEA",ecir:"\u2256",ecolon:"\u2255",Ecy:"\u042D",ecy:"\u044D",eDDot:"\u2A77",Edot:"\u0116",edot:"\u0117",eDot:"\u2251",ee:"\u2147",efDot:"\u2252",Efr:"\u{1D508}",efr:"\u{1D522}",eg:"\u2A9A",Egrave:"\xC8",egrave:"\xE8",egs:"\u2A96",egsdot:"\u2A98",el:"\u2A99",Element:"\u2208",elinters:"\u23E7",ell:"\u2113",els:"\u2A95",elsdot:"\u2A97",Emacr:"\u0112",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25FB",emptyv:"\u2205",EmptyVerySmallSquare:"\u25AB",emsp13:"\u2004",emsp14:"\u2005",emsp:"\u2003",ENG:"\u014A",eng:"\u014B",ensp:"\u2002",Eogon:"\u0118",eogon:"\u0119",Eopf:"\u{1D53C}",eopf:"\u{1D556}",epar:"\u22D5",eparsl:"\u29E3",eplus:"\u2A71",epsi:"\u03B5",Epsilon:"\u0395",epsilon:"\u03B5",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:"\u2A73",esim:"\u2242",Eta:"\u0397",eta:"\u03B7",ETH:"\xD0",eth:"\xF0",Euml:"\xCB",euml:"\xEB",euro:"\u20AC",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",exponentiale:"\u2147",ExponentialE:"\u2147",fallingdotseq:"\u2252",Fcy:"\u0424",fcy:"\u0444",female:"\u2640",ffilig:"\uFB03",fflig:"\uFB00",ffllig:"\uFB04",Ffr:"\u{1D509}",ffr:"\u{1D523}",filig:"\uFB01",FilledSmallSquare:"\u25FC",FilledVerySmallSquare:"\u25AA",fjlig:"fj",flat:"\u266D",fllig:"\uFB02",fltns:"\u25B1",fnof:"\u0192",Fopf:"\u{1D53D}",fopf:"\u{1D557}",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:"\u0393",gamma:"\u03B3",Gammad:"\u03DC",gammad:"\u03DD",gap:"\u2A86",Gbreve:"\u011E",gbreve:"\u011F",Gcedil:"\u0122",Gcirc:"\u011C",gcirc:"\u011D",Gcy:"\u0413",gcy:"\u0433",Gdot:"\u0120",gdot:"\u0121",ge:"\u2265",gE:"\u2267",gEl:"\u2A8C",gel:"\u22DB",geq:"\u2265",geqq:"\u2267",geqslant:"\u2A7E",gescc:"\u2AA9",ges:"\u2A7E",gesdot:"\u2A80",gesdoto:"\u2A82",gesdotol:"\u2A84",gesl:"\u22DB\uFE00",gesles:"\u2A94",Gfr:"\u{1D50A}",gfr:"\u{1D524}",gg:"\u226B",Gg:"\u22D9",ggg:"\u22D9",gimel:"\u2137",GJcy:"\u0403",gjcy:"\u0453",gla:"\u2AA5",gl:"\u2277",glE:"\u2A92",glj:"\u2AA4",gnap:"\u2A8A",gnapprox:"\u2A8A",gne:"\u2A88",gnE:"\u2269",gneq:"\u2A88",gneqq:"\u2269",gnsim:"\u22E7",Gopf:"\u{1D53E}",gopf:"\u{1D558}",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22DB",GreaterFullEqual:"\u2267",GreaterGreater:"\u2AA2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2A7E",GreaterTilde:"\u2273",Gscr:"\u{1D4A2}",gscr:"\u210A",gsim:"\u2273",gsime:"\u2A8E",gsiml:"\u2A90",gtcc:"\u2AA7",gtcir:"\u2A7A",gt:">",GT:">",Gt:"\u226B",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:"\u042A",hardcy:"\u044A",harrcir:"\u2948",harr:"\u2194",hArr:"\u21D4",harrw:"\u21AD",Hat:"^",hbar:"\u210F",Hcirc:"\u0124",hcirc:"\u0125",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:"\u0126",hstrok:"\u0127",HumpDownHump:"\u224E",HumpEqual:"\u224F",hybull:"\u2043",hyphen:"\u2010",Iacute:"\xCD",iacute:"\xED",ic:"\u2063",Icirc:"\xCE",icirc:"\xEE",Icy:"\u0418",icy:"\u0438",Idot:"\u0130",IEcy:"\u0415",iecy:"\u0435",iexcl:"\xA1",iff:"\u21D4",ifr:"\u{1D526}",Ifr:"\u2111",Igrave:"\xCC",igrave:"\xEC",ii:"\u2148",iiiint:"\u2A0C",iiint:"\u222D",iinfin:"\u29DC",iiota:"\u2129",IJlig:"\u0132",ijlig:"\u0133",Imacr:"\u012A",imacr:"\u012B",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",Im:"\u2111",imof:"\u22B7",imped:"\u01B5",Implies:"\u21D2",incare:"\u2105",in:"\u2208",infin:"\u221E",infintie:"\u29DD",inodot:"\u0131",intcal:"\u22BA",int:"\u222B",Int:"\u222C",integers:"\u2124",Integral:"\u222B",intercal:"\u22BA",Intersection:"\u22C2",intlarhk:"\u2A17",intprod:"\u2A3C",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",IOcy:"\u0401",iocy:"\u0451",Iogon:"\u012E",iogon:"\u012F",Iopf:"\u{1D540}",iopf:"\u{1D55A}",Iota:"\u0399",iota:"\u03B9",iprod:"\u2A3C",iquest:"\xBF",iscr:"\u{1D4BE}",Iscr:"\u2110",isin:"\u2208",isindot:"\u22F5",isinE:"\u22F9",isins:"\u22F4",isinsv:"\u22F3",isinv:"\u2208",it:"\u2062",Itilde:"\u0128",itilde:"\u0129",Iukcy:"\u0406",iukcy:"\u0456",Iuml:"\xCF",iuml:"\xEF",Jcirc:"\u0134",jcirc:"\u0135",Jcy:"\u0419",jcy:"\u0439",Jfr:"\u{1D50D}",jfr:"\u{1D527}",jmath:"\u0237",Jopf:"\u{1D541}",jopf:"\u{1D55B}",Jscr:"\u{1D4A5}",jscr:"\u{1D4BF}",Jsercy:"\u0408",jsercy:"\u0458",Jukcy:"\u0404",jukcy:"\u0454",Kappa:"\u039A",kappa:"\u03BA",kappav:"\u03F0",Kcedil:"\u0136",kcedil:"\u0137",Kcy:"\u041A",kcy:"\u043A",Kfr:"\u{1D50E}",kfr:"\u{1D528}",kgreen:"\u0138",KHcy:"\u0425",khcy:"\u0445",KJcy:"\u040C",kjcy:"\u045C",Kopf:"\u{1D542}",kopf:"\u{1D55C}",Kscr:"\u{1D4A6}",kscr:"\u{1D4C0}",lAarr:"\u21DA",Lacute:"\u0139",lacute:"\u013A",laemptyv:"\u29B4",lagran:"\u2112",Lambda:"\u039B",lambda:"\u03BB",lang:"\u27E8",Lang:"\u27EA",langd:"\u2991",langle:"\u27E8",lap:"\u2A85",Laplacetrf:"\u2112",laquo:"\xAB",larrb:"\u21E4",larrbfs:"\u291F",larr:"\u2190",Larr:"\u219E",lArr:"\u21D0",larrfs:"\u291D",larrhk:"\u21A9",larrlp:"\u21AB",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21A2",latail:"\u2919",lAtail:"\u291B",lat:"\u2AAB",late:"\u2AAD",lates:"\u2AAD\uFE00",lbarr:"\u290C",lBarr:"\u290E",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298B",lbrksld:"\u298F",lbrkslu:"\u298D",Lcaron:"\u013D",lcaron:"\u013E",Lcedil:"\u013B",lcedil:"\u013C",lceil:"\u2308",lcub:"{",Lcy:"\u041B",lcy:"\u043B",ldca:"\u2936",ldquo:"\u201C",ldquor:"\u201E",ldrdhar:"\u2967",ldrushar:"\u294B",ldsh:"\u21B2",le:"\u2264",lE:"\u2266",LeftAngleBracket:"\u27E8",LeftArrowBar:"\u21E4",leftarrow:"\u2190",LeftArrow:"\u2190",Leftarrow:"\u21D0",LeftArrowRightArrow:"\u21C6",leftarrowtail:"\u21A2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27E6",LeftDownTeeVector:"\u2961",LeftDownVectorBar:"\u2959",LeftDownVector:"\u21C3",LeftFloor:"\u230A",leftharpoondown:"\u21BD",leftharpoonup:"\u21BC",leftleftarrows:"\u21C7",leftrightarrow:"\u2194",LeftRightArrow:"\u2194",Leftrightarrow:"\u21D4",leftrightarrows:"\u21C6",leftrightharpoons:"\u21CB",leftrightsquigarrow:"\u21AD",LeftRightVector:"\u294E",LeftTeeArrow:"\u21A4",LeftTee:"\u22A3",LeftTeeVector:"\u295A",leftthreetimes:"\u22CB",LeftTriangleBar:"\u29CF",LeftTriangle:"\u22B2",LeftTriangleEqual:"\u22B4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVectorBar:"\u2958",LeftUpVector:"\u21BF",LeftVectorBar:"\u2952",LeftVector:"\u21BC",lEg:"\u2A8B",leg:"\u22DA",leq:"\u2264",leqq:"\u2266",leqslant:"\u2A7D",lescc:"\u2AA8",les:"\u2A7D",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{1D50F}",lfr:"\u{1D529}",lg:"\u2276",lgE:"\u2A91",lHar:"\u2962",lhard:"\u21BD",lharu:"\u21BC",lharul:"\u296A",lhblk:"\u2584",LJcy:"\u0409",ljcy:"\u0459",llarr:"\u21C7",ll:"\u226A",Ll:"\u22D8",llcorner:"\u231E",Lleftarrow:"\u21DA",llhard:"\u296B",lltri:"\u25FA",Lmidot:"\u013F",lmidot:"\u0140",lmoustache:"\u23B0",lmoust:"\u23B0",lnap:"\u2A89",lnapprox:"\u2A89",lne:"\u2A87",lnE:"\u2268",lneq:"\u2A87",lneqq:"\u2268",lnsim:"\u22E6",loang:"\u27EC",loarr:"\u21FD",lobrk:"\u27E6",longleftarrow:"\u27F5",LongLeftArrow:"\u27F5",Longleftarrow:"\u27F8",longleftrightarrow:"\u27F7",LongLeftRightArrow:"\u27F7",Longleftrightarrow:"\u27FA",longmapsto:"\u27FC",longrightarrow:"\u27F6",LongRightArrow:"\u27F6",Longrightarrow:"\u27F9",looparrowleft:"\u21AB",looparrowright:"\u21AC",lopar:"\u2985",Lopf:"\u{1D543}",lopf:"\u{1D55D}",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:"\u0141",lstrok:"\u0142",ltcc:"\u2AA6",ltcir:"\u2A79",lt:"<",LT:"<",Lt:"\u226A",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:"\u2905",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",mapstoleft:"\u21A4",mapstoup:"\u21A5",marker:"\u25AE",mcomma:"\u2A29",Mcy:"\u041C",mcy:"\u043C",mdash:"\u2014",mDDot:"\u223A",measuredangle:"\u2221",MediumSpace:"\u205F",Mellintrf:"\u2133",Mfr:"\u{1D510}",mfr:"\u{1D52A}",mho:"\u2127",micro:"\xB5",midast:"*",midcir:"\u2AF0",mid:"\u2223",middot:"\xB7",minusb:"\u229F",minus:"\u2212",minusd:"\u2238",minusdu:"\u2A2A",MinusPlus:"\u2213",mlcp:"\u2ADB",mldr:"\u2026",mnplus:"\u2213",models:"\u22A7",Mopf:"\u{1D544}",mopf:"\u{1D55E}",mp:"\u2213",mscr:"\u{1D4C2}",Mscr:"\u2133",mstpos:"\u223E",Mu:"\u039C",mu:"\u03BC",multimap:"\u22B8",mumap:"\u22B8",nabla:"\u2207",Nacute:"\u0143",nacute:"\u0144",nang:"\u2220\u20D2",nap:"\u2249",napE:"\u2A70\u0338",napid:"\u224B\u0338",napos:"\u0149",napprox:"\u2249",natural:"\u266E",naturals:"\u2115",natur:"\u266E",nbsp:"\xA0",nbump:"\u224E\u0338",nbumpe:"\u224F\u0338",ncap:"\u2A43",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2A6D\u0338",ncup:"\u2A42",Ncy:"\u041D",ncy:"\u043D",ndash:"\u2013",nearhk:"\u2924",nearr:"\u2197",neArr:"\u21D7",nearrow:"\u2197",ne:"\u2260",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{1D511}",nfr:"\u{1D52B}",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",nGg:"\u22D9\u0338",ngsim:"\u2275",nGt:"\u226B\u20D2",ngt:"\u226F",ngtr:"\u226F",nGtv:"\u226B\u0338",nharr:"\u21AE",nhArr:"\u21CE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",NJcy:"\u040A",njcy:"\u045A",nlarr:"\u219A",nlArr:"\u21CD",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",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:"\u226A\u20D2",nlt:"\u226E",nltri:"\u22EA",nltrie:"\u22EC",nLtv:"\u226A\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xA0",nopf:"\u{1D55F}",Nopf:"\u2115",Not:"\u2AEC",not:"\xAC",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",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangle:"\u22EA",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",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangle:"\u22EB",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",nparallel:"\u2226",npar:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",nprec:"\u2280",npreceq:"\u2AAF\u0338",npre:"\u2AAF\u0338",nrarrc:"\u2933\u0338",nrarr:"\u219B",nrArr:"\u21CF",nrarrw:"\u219D\u0338",nrightarrow:"\u219B",nRightarrow:"\u21CF",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",Nscr:"\u{1D4A9}",nscr:"\u{1D4C3}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsubE:"\u2AC5\u0338",nsube:"\u2288",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupE:"\u2AC6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",Ntilde:"\xD1",ntilde:"\xF1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",Nu:"\u039D",nu:"\u03BD",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:"\xD3",oacute:"\xF3",oast:"\u229B",Ocirc:"\xD4",ocirc:"\xF4",ocir:"\u229A",Ocy:"\u041E",ocy:"\u043E",odash:"\u229D",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",OElig:"\u0152",oelig:"\u0153",ofcir:"\u29BF",Ofr:"\u{1D512}",ofr:"\u{1D52C}",ogon:"\u02DB",Ograve:"\xD2",ograve:"\xF2",ogt:"\u29C1",ohbar:"\u29B5",ohm:"\u03A9",oint:"\u222E",olarr:"\u21BA",olcir:"\u29BE",olcross:"\u29BB",oline:"\u203E",olt:"\u29C0",Omacr:"\u014C",omacr:"\u014D",Omega:"\u03A9",omega:"\u03C9",Omicron:"\u039F",omicron:"\u03BF",omid:"\u29B6",ominus:"\u2296",Oopf:"\u{1D546}",oopf:"\u{1D560}",opar:"\u29B7",OpenCurlyDoubleQuote:"\u201C",OpenCurlyQuote:"\u2018",operp:"\u29B9",oplus:"\u2295",orarr:"\u21BB",Or:"\u2A54",or:"\u2228",ord:"\u2A5D",order:"\u2134",orderof:"\u2134",ordf:"\xAA",ordm:"\xBA",origof:"\u22B6",oror:"\u2A56",orslope:"\u2A57",orv:"\u2A5B",oS:"\u24C8",Oscr:"\u{1D4AA}",oscr:"\u2134",Oslash:"\xD8",oslash:"\xF8",osol:"\u2298",Otilde:"\xD5",otilde:"\xF5",otimesas:"\u2A36",Otimes:"\u2A37",otimes:"\u2297",Ouml:"\xD6",ouml:"\xF6",ovbar:"\u233D",OverBar:"\u203E",OverBrace:"\u23DE",OverBracket:"\u23B4",OverParenthesis:"\u23DC",para:"\xB6",parallel:"\u2225",par:"\u2225",parsim:"\u2AF3",parsl:"\u2AFD",part:"\u2202",PartialD:"\u2202",Pcy:"\u041F",pcy:"\u043F",percnt:"%",period:".",permil:"\u2030",perp:"\u22A5",pertenk:"\u2031",Pfr:"\u{1D513}",pfr:"\u{1D52D}",Phi:"\u03A6",phi:"\u03C6",phiv:"\u03D5",phmmat:"\u2133",phone:"\u260E",Pi:"\u03A0",pi:"\u03C0",pitchfork:"\u22D4",piv:"\u03D6",planck:"\u210F",planckh:"\u210E",plankv:"\u210F",plusacir:"\u2A23",plusb:"\u229E",pluscir:"\u2A22",plus:"+",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",prap:"\u2AB7",Pr:"\u2ABB",pr:"\u227A",prcue:"\u227C",precapprox:"\u2AB7",prec:"\u227A",preccurlyeq:"\u227C",Precedes:"\u227A",PrecedesEqual:"\u2AAF",PrecedesSlantEqual:"\u227C",PrecedesTilde:"\u227E",preceq:"\u2AAF",precnapprox:"\u2AB9",precneqq:"\u2AB5",precnsim:"\u22E8",pre:"\u2AAF",prE:"\u2AB3",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",Proportional:"\u221D",Proportion:"\u2237",propto:"\u221D",prsim:"\u227E",prurel:"\u22B0",Pscr:"\u{1D4AB}",pscr:"\u{1D4C5}",Psi:"\u03A8",psi:"\u03C8",puncsp:"\u2008",Qfr:"\u{1D514}",qfr:"\u{1D52E}",qint:"\u2A0C",qopf:"\u{1D562}",Qopf:"\u211A",qprime:"\u2057",Qscr:"\u{1D4AC}",qscr:"\u{1D4C6}",quaternions:"\u210D",quatint:"\u2A16",quest:"?",questeq:"\u225F",quot:'"',QUOT:'"',rAarr:"\u21DB",race:"\u223D\u0331",Racute:"\u0154",racute:"\u0155",radic:"\u221A",raemptyv:"\u29B3",rang:"\u27E9",Rang:"\u27EB",rangd:"\u2992",range:"\u29A5",rangle:"\u27E9",raquo:"\xBB",rarrap:"\u2975",rarrb:"\u21E5",rarrbfs:"\u2920",rarrc:"\u2933",rarr:"\u2192",Rarr:"\u21A0",rArr:"\u21D2",rarrfs:"\u291E",rarrhk:"\u21AA",rarrlp:"\u21AC",rarrpl:"\u2945",rarrsim:"\u2974",Rarrtl:"\u2916",rarrtl:"\u21A3",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:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",rceil:"\u2309",rcub:"}",Rcy:"\u0420",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201D",rdquor:"\u201D",rdsh:"\u21B3",real:"\u211C",realine:"\u211B",realpart:"\u211C",reals:"\u211D",Re:"\u211C",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:"\u03A1",rho:"\u03C1",rhov:"\u03F1",RightAngleBracket:"\u27E9",RightArrowBar:"\u21E5",rightarrow:"\u2192",RightArrow:"\u2192",Rightarrow:"\u21D2",RightArrowLeftArrow:"\u21C4",rightarrowtail:"\u21A3",RightCeiling:"\u2309",RightDoubleBracket:"\u27E7",RightDownTeeVector:"\u295D",RightDownVectorBar:"\u2955",RightDownVector:"\u21C2",RightFloor:"\u230B",rightharpoondown:"\u21C1",rightharpoonup:"\u21C0",rightleftarrows:"\u21C4",rightleftharpoons:"\u21CC",rightrightarrows:"\u21C9",rightsquigarrow:"\u219D",RightTeeArrow:"\u21A6",RightTee:"\u22A2",RightTeeVector:"\u295B",rightthreetimes:"\u22CC",RightTriangleBar:"\u29D0",RightTriangle:"\u22B3",RightTriangleEqual:"\u22B5",RightUpDownVector:"\u294F",RightUpTeeVector:"\u295C",RightUpVectorBar:"\u2954",RightUpVector:"\u21BE",RightVectorBar:"\u2953",RightVector:"\u21C0",ring:"\u02DA",risingdotseq:"\u2253",rlarr:"\u21C4",rlhar:"\u21CC",rlm:"\u200F",rmoustache:"\u23B1",rmoust:"\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:"\u015A",sacute:"\u015B",sbquo:"\u201A",scap:"\u2AB8",Scaron:"\u0160",scaron:"\u0161",Sc:"\u2ABC",sc:"\u227B",sccue:"\u227D",sce:"\u2AB0",scE:"\u2AB4",Scedil:"\u015E",scedil:"\u015F",Scirc:"\u015C",scirc:"\u015D",scnap:"\u2ABA",scnE:"\u2AB6",scnsim:"\u22E9",scpolint:"\u2A13",scsim:"\u227F",Scy:"\u0421",scy:"\u0441",sdotb:"\u22A1",sdot:"\u22C5",sdote:"\u2A66",searhk:"\u2925",searr:"\u2198",seArr:"\u21D8",searrow:"\u2198",sect:"\xA7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",Sfr:"\u{1D516}",sfr:"\u{1D530}",sfrown:"\u2322",sharp:"\u266F",SHCHcy:"\u0429",shchcy:"\u0449",SHcy:"\u0428",shcy:"\u0448",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xAD",Sigma:"\u03A3",sigma:"\u03C3",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:"\u042C",softcy:"\u044C",solbar:"\u233F",solb:"\u29C4",sol:"/",Sopf:"\u{1D54A}",sopf:"\u{1D564}",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",square:"\u25A1",Square:"\u25A1",SquareIntersection:"\u2293",SquareSubset:"\u228F",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25AA",squ:"\u25A1",squf:"\u25AA",srarr:"\u2192",Sscr:"\u{1D4AE}",sscr:"\u{1D4C8}",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22C6",Star:"\u22C6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03F5",straightphi:"\u03D5",strns:"\xAF",sub:"\u2282",Sub:"\u22D0",subdot:"\u2ABD",subE:"\u2AC5",sube:"\u2286",subedot:"\u2AC3",submult:"\u2AC1",subnE:"\u2ACB",subne:"\u228A",subplus:"\u2ABF",subrarr:"\u2979",subset:"\u2282",Subset:"\u22D0",subseteq:"\u2286",subseteqq:"\u2AC5",SubsetEqual:"\u2286",subsetneq:"\u228A",subsetneqq:"\u2ACB",subsim:"\u2AC7",subsub:"\u2AD5",subsup:"\u2AD3",succapprox:"\u2AB8",succ:"\u227B",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",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",sup:"\u2283",Sup:"\u22D1",supdot:"\u2ABE",supdsub:"\u2AD8",supE:"\u2AC6",supe:"\u2287",supedot:"\u2AC4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27C9",suphsub:"\u2AD7",suplarr:"\u297B",supmult:"\u2AC2",supnE:"\u2ACC",supne:"\u228B",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:"\u03A4",tau:"\u03C4",tbrk:"\u23B4",Tcaron:"\u0164",tcaron:"\u0165",Tcedil:"\u0162",tcedil:"\u0163",Tcy:"\u0422",tcy:"\u0442",tdot:"\u20DB",telrec:"\u2315",Tfr:"\u{1D517}",tfr:"\u{1D531}",there4:"\u2234",therefore:"\u2234",Therefore:"\u2234",Theta:"\u0398",theta:"\u03B8",thetasym:"\u03D1",thetav:"\u03D1",thickapprox:"\u2248",thicksim:"\u223C",ThickSpace:"\u205F\u200A",ThinSpace:"\u2009",thinsp:"\u2009",thkap:"\u2248",thksim:"\u223C",THORN:"\xDE",thorn:"\xFE",tilde:"\u02DC",Tilde:"\u223C",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",timesbar:"\u2A31",timesb:"\u22A0",times:"\xD7",timesd:"\u2A30",tint:"\u222D",toea:"\u2928",topbot:"\u2336",topcir:"\u2AF1",top:"\u22A4",Topf:"\u{1D54B}",topf:"\u{1D565}",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{1D4AF}",tscr:"\u{1D4C9}",TScy:"\u0426",tscy:"\u0446",TSHcy:"\u040B",tshcy:"\u045B",Tstrok:"\u0166",tstrok:"\u0167",twixt:"\u226C",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",Uacute:"\xDA",uacute:"\xFA",uarr:"\u2191",Uarr:"\u219F",uArr:"\u21D1",Uarrocir:"\u2949",Ubrcy:"\u040E",ubrcy:"\u045E",Ubreve:"\u016C",ubreve:"\u016D",Ucirc:"\xDB",ucirc:"\xFB",Ucy:"\u0423",ucy:"\u0443",udarr:"\u21C5",Udblac:"\u0170",udblac:"\u0171",udhar:"\u296E",ufisht:"\u297E",Ufr:"\u{1D518}",ufr:"\u{1D532}",Ugrave:"\xD9",ugrave:"\xF9",uHar:"\u2963",uharl:"\u21BF",uharr:"\u21BE",uhblk:"\u2580",ulcorn:"\u231C",ulcorner:"\u231C",ulcrop:"\u230F",ultri:"\u25F8",Umacr:"\u016A",umacr:"\u016B",uml:"\xA8",UnderBar:"_",UnderBrace:"\u23DF",UnderBracket:"\u23B5",UnderParenthesis:"\u23DD",Union:"\u22C3",UnionPlus:"\u228E",Uogon:"\u0172",uogon:"\u0173",Uopf:"\u{1D54C}",uopf:"\u{1D566}",UpArrowBar:"\u2912",uparrow:"\u2191",UpArrow:"\u2191",Uparrow:"\u21D1",UpArrowDownArrow:"\u21C5",updownarrow:"\u2195",UpDownArrow:"\u2195",Updownarrow:"\u21D5",UpEquilibrium:"\u296E",upharpoonleft:"\u21BF",upharpoonright:"\u21BE",uplus:"\u228E",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",upsi:"\u03C5",Upsi:"\u03D2",upsih:"\u03D2",Upsilon:"\u03A5",upsilon:"\u03C5",UpTeeArrow:"\u21A5",UpTee:"\u22A5",upuparrows:"\u21C8",urcorn:"\u231D",urcorner:"\u231D",urcrop:"\u230E",Uring:"\u016E",uring:"\u016F",urtri:"\u25F9",Uscr:"\u{1D4B0}",uscr:"\u{1D4CA}",utdot:"\u22F0",Utilde:"\u0168",utilde:"\u0169",utri:"\u25B5",utrif:"\u25B4",uuarr:"\u21C8",Uuml:"\xDC",uuml:"\xFC",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:"\u0412",vcy:"\u0432",vdash:"\u22A2",vDash:"\u22A8",Vdash:"\u22A9",VDash:"\u22AB",Vdashl:"\u2AE6",veebar:"\u22BB",vee:"\u2228",Vee:"\u22C1",veeeq:"\u225A",vellip:"\u22EE",verbar:"|",Verbar:"\u2016",vert:"|",Vert:"\u2016",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200A",Vfr:"\u{1D519}",vfr:"\u{1D533}",vltri:"\u22B2",vnsub:"\u2282\u20D2",vnsup:"\u2283\u20D2",Vopf:"\u{1D54D}",vopf:"\u{1D567}",vprop:"\u221D",vrtri:"\u22B3",Vscr:"\u{1D4B1}",vscr:"\u{1D4CB}",vsubnE:"\u2ACB\uFE00",vsubne:"\u228A\uFE00",vsupnE:"\u2ACC\uFE00",vsupne:"\u228B\uFE00",Vvdash:"\u22AA",vzigzag:"\u299A",Wcirc:"\u0174",wcirc:"\u0175",wedbar:"\u2A5F",wedge:"\u2227",Wedge:"\u22C0",wedgeq:"\u2259",weierp:"\u2118",Wfr:"\u{1D51A}",wfr:"\u{1D534}",Wopf:"\u{1D54E}",wopf:"\u{1D568}",wp:"\u2118",wr:"\u2240",wreath:"\u2240",Wscr:"\u{1D4B2}",wscr:"\u{1D4CC}",xcap:"\u22C2",xcirc:"\u25EF",xcup:"\u22C3",xdtri:"\u25BD",Xfr:"\u{1D51B}",xfr:"\u{1D535}",xharr:"\u27F7",xhArr:"\u27FA",Xi:"\u039E",xi:"\u03BE",xlarr:"\u27F5",xlArr:"\u27F8",xmap:"\u27FC",xnis:"\u22FB",xodot:"\u2A00",Xopf:"\u{1D54F}",xopf:"\u{1D569}",xoplus:"\u2A01",xotime:"\u2A02",xrarr:"\u27F6",xrArr:"\u27F9",Xscr:"\u{1D4B3}",xscr:"\u{1D4CD}",xsqcup:"\u2A06",xuplus:"\u2A04",xutri:"\u25B3",xvee:"\u22C1",xwedge:"\u22C0",Yacute:"\xDD",yacute:"\xFD",YAcy:"\u042F",yacy:"\u044F",Ycirc:"\u0176",ycirc:"\u0177",Ycy:"\u042B",ycy:"\u044B",yen:"\xA5",Yfr:"\u{1D51C}",yfr:"\u{1D536}",YIcy:"\u0407",yicy:"\u0457",Yopf:"\u{1D550}",yopf:"\u{1D56A}",Yscr:"\u{1D4B4}",yscr:"\u{1D4CE}",YUcy:"\u042E",yucy:"\u044E",yuml:"\xFF",Yuml:"\u0178",Zacute:"\u0179",zacute:"\u017A",Zcaron:"\u017D",zcaron:"\u017E",Zcy:"\u0417",zcy:"\u0437",Zdot:"\u017B",zdot:"\u017C",zeetrf:"\u2128",ZeroWidthSpace:"\u200B",Zeta:"\u0396",zeta:"\u03B6",zfr:"\u{1D537}",Zfr:"\u2128",ZHcy:"\u0416",zhcy:"\u0436",zigrarr:"\u21DD",zopf:"\u{1D56B}",Zopf:"\u2124",Zscr:"\u{1D4B5}",zscr:"\u{1D4CF}",zwj:"\u200D",zwnj:"\u200C"}});var Rn=E((bg,Uo)=>{"use strict";Uo.exports=Go()});var br=E((vg,$o)=>{$o.exports=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4E\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDF55-\uDF59]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD806[\uDC3B\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/});var Wo=E((yg,Ko)=>{"use strict";var Jo={};function wd(t){var e,r,n=Jo[t];if(n)return n;for(n=Jo[t]=[],e=0;e<128;e++)r=String.fromCharCode(e),/^[0-9a-z]$/i.test(r)?n.push(r):n.push("%"+("0"+e.toString(16).toUpperCase()).slice(-2));for(e=0;e=55296&&o<=57343){if(o>=55296&&o<=56319&&n+1=56320&&a<=57343)){l+=encodeURIComponent(t[n]+t[n+1]),n++;continue}l+="%EF%BF%BD";continue}l+=encodeURIComponent(t[n])}return l}vr.defaultChars=";/?:@&=+$,-_.!~*'()#";vr.componentChars="-_.!~*'()";Ko.exports=vr});var Xo=E((_g,Zo)=>{"use strict";var Yo={};function Ed(t){var e,r,n=Yo[t];if(n)return n;for(n=Yo[t]=[],e=0;e<128;e++)r=String.fromCharCode(e),n.push(r);for(e=0;e=55296&&c<=57343?d+="\uFFFD\uFFFD\uFFFD":d+=String.fromCharCode(c),i+=6;continue}if((a&248)===240&&i+91114111?d+="\uFFFD\uFFFD\uFFFD\uFFFD":(c-=65536,d+=String.fromCharCode(55296+(c>>10),56320+(c&1023))),i+=9;continue}d+="\uFFFD"}return d})}yr.defaultChars=";/?:@&=+$,#";yr.componentChars="";Zo.exports=yr});var ea=E((wg,Qo)=>{"use strict";Qo.exports=function(e){var r="";return r+=e.protocol||"",r+=e.slashes?"//":"",r+=e.auth?e.auth+"@":"",e.hostname&&e.hostname.indexOf(":")!==-1?r+="["+e.hostname+"]":r+=e.hostname||"",r+=e.port?":"+e.port:"",r+=e.pathname||"",r+=e.search||"",r+=e.hash||"",r}});var sa=E((Eg,aa)=>{"use strict";function _r(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}var xd=/^([a-z0-9.+-]+:)/i,kd=/:[0-9]*$/,Cd=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,Ad=["<",">",'"',"`"," ","\r",` -`," "],Sd=["{","}","|","\\","^","`"].concat(Ad),Dd=["'"].concat(Sd),ta=["%","/","?",";","#"].concat(Dd),ra=["/","?","#"],Td=255,na=/^[+a-z0-9A-Z_-]{0,63}$/,Nd=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,ia={javascript:!0,"javascript:":!0},oa={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Od(t,e){if(t&&t instanceof _r)return t;var r=new _r;return r.parse(t,e),r}_r.prototype.parse=function(t,e){var r,n,i,o,a,s=t;if(s=s.trim(),!e&&t.split("#").length===1){var l=Cd.exec(s);if(l)return this.pathname=l[1],l[2]&&(this.search=l[2]),this}var u=xd.exec(s);if(u&&(u=u[0],i=u.toLowerCase(),this.protocol=u,s=s.substr(u.length)),(e||u||s.match(/^\/\/[^@\/]+@[^@\/]+/))&&(a=s.substr(0,2)==="//",a&&!(u&&ia[u])&&(s=s.substr(2),this.slashes=!0)),!ia[u]&&(a||u&&!oa[u])){var c=-1;for(r=0;r127?b+="x":b+=v[g];if(!b.match(na)){var x=m.slice(0,r),A=m.slice(r+1),y=v.match(Nd);y&&(x.push(y[1]),A.unshift(y[2])),A.length&&(s=A.join(".")+s),this.hostname=x.join(".");break}}}}this.hostname.length>Td&&(this.hostname=""),p&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}var D=s.indexOf("#");D!==-1&&(this.hash=s.substr(D),s=s.slice(0,D));var F=s.indexOf("?");return F!==-1&&(this.search=s.substr(F),s=s.slice(0,F)),s&&(this.pathname=s),oa[i]&&this.hostname&&!this.pathname&&(this.pathname=""),this};_r.prototype.parseHost=function(t){var e=kd.exec(t);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};aa.exports=Od});var Fn=E((xg,Ht)=>{"use strict";Ht.exports.encode=Wo();Ht.exports.decode=Xo();Ht.exports.format=ea();Ht.exports.parse=sa()});var Pn=E((kg,la)=>{la.exports=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/});var qn=E((Cg,ua)=>{ua.exports=/[\0-\x1F\x7F-\x9F]/});var da=E((Ag,ca)=>{ca.exports=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/});var In=E((Sg,fa)=>{fa.exports=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/});var ha=E(vt=>{"use strict";vt.Any=Pn();vt.Cc=qn();vt.Cf=da();vt.P=br();vt.Z=In()});var N=E(H=>{"use strict";function Md(t){return Object.prototype.toString.call(t)}function Rd(t){return Md(t)==="[object String]"}var Fd=Object.prototype.hasOwnProperty;function pa(t,e){return Fd.call(t,e)}function Pd(t){var e=Array.prototype.slice.call(arguments,1);return e.forEach(function(r){if(!!r){if(typeof r!="object")throw new TypeError(r+"must be object");Object.keys(r).forEach(function(n){t[n]=r[n]})}}),t}function qd(t,e,r){return[].concat(t.slice(0,e),r,t.slice(e+1))}function ma(t){return!(t>=55296&&t<=57343||t>=64976&&t<=65007||(t&65535)===65535||(t&65535)===65534||t>=0&&t<=8||t===11||t>=14&&t<=31||t>=127&&t<=159||t>1114111)}function ga(t){if(t>65535){t-=65536;var e=55296+(t>>10),r=56320+(t&1023);return String.fromCharCode(e,r)}return String.fromCharCode(t)}var ba=/\\([!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~])/g,Id=/&([a-z#][a-z0-9]{1,31});/gi,Ld=new RegExp(ba.source+"|"+Id.source,"gi"),Bd=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i,va=Rn();function zd(t,e){var r=0;return pa(va,e)?va[e]:e.charCodeAt(0)===35&&Bd.test(e)&&(r=e[1].toLowerCase()==="x"?parseInt(e.slice(2),16):parseInt(e.slice(1),10),ma(r))?ga(r):t}function jd(t){return t.indexOf("\\")<0?t:t.replace(ba,"$1")}function Hd(t){return t.indexOf("\\")<0&&t.indexOf("&")<0?t:t.replace(Ld,function(e,r,n){return r||zd(e,n)})}var Vd=/[&<>"]/,Gd=/[&<>"]/g,Ud={"&":"&","<":"<",">":">",'"':"""};function $d(t){return Ud[t]}function Jd(t){return Vd.test(t)?t.replace(Gd,$d):t}var Kd=/[.?*+^$[\]\\(){}|-]/g;function Wd(t){return t.replace(Kd,"\\$&")}function Yd(t){switch(t){case 9:case 32:return!0}return!1}function Zd(t){if(t>=8192&&t<=8202)return!0;switch(t){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}var Xd=br();function Qd(t){return Xd.test(t)}function ef(t){switch(t){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function tf(t){return t=t.trim().replace(/\s+/g," "),"\u1E9E".toLowerCase()==="\u1E7E"&&(t=t.replace(/ẞ/g,"\xDF")),t.toLowerCase().toUpperCase()}H.lib={};H.lib.mdurl=Fn();H.lib.ucmicro=ha();H.assign=Pd;H.isString=Rd;H.has=pa;H.unescapeMd=jd;H.unescapeAll=Hd;H.isValidEntityCode=ma;H.fromCodePoint=ga;H.escapeHtml=Jd;H.arrayReplaceAt=qd;H.isSpace=Yd;H.isWhiteSpace=Zd;H.isMdAsciiPunct=ef;H.isPunctChar=Qd;H.escapeRE=Wd;H.normalizeReference=tf});var _a=E((Ng,ya)=>{"use strict";ya.exports=function(e,r,n){var i,o,a,s,l=-1,u=e.posMax,c=e.pos;for(e.pos=r+1,i=1;e.pos{"use strict";var wa=N().unescapeAll;Ea.exports=function(e,r,n){var i,o,a=0,s=r,l={ok:!1,pos:0,lines:0,str:""};if(e.charCodeAt(r)===60){for(r++;r32))return l;if(i===41){if(o===0)break;o--}r++}return s===r||o!==0||(l.str=wa(e.slice(s,r)),l.lines=a,l.pos=r,l.ok=!0),l}});var Ca=E((Mg,ka)=>{"use strict";var rf=N().unescapeAll;ka.exports=function(e,r,n){var i,o,a=0,s=r,l={ok:!1,pos:0,lines:0,str:""};if(r>=n||(o=e.charCodeAt(r),o!==34&&o!==39&&o!==40))return l;for(r++,o===40&&(o=41);r{"use strict";wr.parseLinkLabel=_a();wr.parseLinkDestination=xa();wr.parseLinkTitle=Ca()});var Da=E((Fg,Sa)=>{"use strict";var nf=N().assign,of=N().unescapeAll,Xe=N().escapeHtml,ve={};ve.code_inline=function(t,e,r,n,i){var o=t[e];return""+Xe(t[e].content)+""};ve.code_block=function(t,e,r,n,i){var o=t[e];return""+Xe(t[e].content)+` -`};ve.fence=function(t,e,r,n,i){var o=t[e],a=o.info?of(o.info).trim():"",s="",l="",u,c,d,f,h;return a&&(d=a.split(/(\s+)/g),s=d[0],l=d.slice(2).join("")),r.highlight?u=r.highlight(o.content,s,l)||Xe(o.content):u=Xe(o.content),u.indexOf("{var rc=Object.create;var or=Object.defineProperty;var nc=Object.getOwnPropertyDescriptor;var ic=Object.getOwnPropertyNames;var oc=Object.getPrototypeOf,ac=Object.prototype.hasOwnProperty;var sc=t=>or(t,"__esModule",{value:!0});var E=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ri=(t,e)=>{for(var r in e)or(t,r,{get:e[r],enumerable:!0})},lc=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ic(e))!ac.call(t,i)&&(r||i!=="default")&&or(t,i,{get:()=>e[i],enumerable:!(n=nc(e,i))||n.enumerable});return t},ar=(t,e)=>lc(sc(or(t!=null?rc(oc(t)):{},"default",!e&&t&&t.__esModule?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var Go=E((te,Vo)=>{"use strict";Object.defineProperty(te,"__esModule",{value:!0});te.isPlainObject=te.clone=te.recursive=te.merge=te.main=void 0;Vo.exports=te=Et;te.default=Et;function Et(){for(var t=[],e=0;e{"use strict";var Xc=Qc(Go());Object.defineProperty(St,"__esModule",{value:!0}),St.save=ud,St.load=cd,St.combineLoads=dd,St.clear=fd;function Qc(t){return t&&t.__esModule?t:{default:t}}function ed(t,e){return id(t)||nd(t,e)||rd(t,e)||td()}function td(){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 rd(t,e){if(t){if(typeof t=="string")return Uo(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Uo(t,e):void 0}}function Uo(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r{wd.exports={Aacute:"\xC1",aacute:"\xE1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223E",acd:"\u223F",acE:"\u223E\u0333",Acirc:"\xC2",acirc:"\xE2",acute:"\xB4",Acy:"\u0410",acy:"\u0430",AElig:"\xC6",aelig:"\xE6",af:"\u2061",Afr:"\u{1D504}",afr:"\u{1D51E}",Agrave:"\xC0",agrave:"\xE0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03B1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2A3F",amp:"&",AMP:"&",andand:"\u2A55",And:"\u2A53",and:"\u2227",andd:"\u2A5C",andslope:"\u2A58",andv:"\u2A5A",ang:"\u2220",ange:"\u29A4",angle:"\u2220",angmsdaa:"\u29A8",angmsdab:"\u29A9",angmsdac:"\u29AA",angmsdad:"\u29AB",angmsdae:"\u29AC",angmsdaf:"\u29AD",angmsdag:"\u29AE",angmsdah:"\u29AF",angmsd:"\u2221",angrt:"\u221F",angrtvb:"\u22BE",angrtvbd:"\u299D",angsph:"\u2222",angst:"\xC5",angzarr:"\u237C",Aogon:"\u0104",aogon:"\u0105",Aopf:"\u{1D538}",aopf:"\u{1D552}",apacir:"\u2A6F",ap:"\u2248",apE:"\u2A70",ape:"\u224A",apid:"\u224B",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224A",Aring:"\xC5",aring:"\xE5",Ascr:"\u{1D49C}",ascr:"\u{1D4B6}",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224D",Atilde:"\xC3",atilde:"\xE3",Auml:"\xC4",auml:"\xE4",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:"\u0411",bcy:"\u0431",bdquo:"\u201E",becaus:"\u2235",because:"\u2235",Because:"\u2235",bemptyv:"\u29B0",bepsi:"\u03F6",bernou:"\u212C",Bernoullis:"\u212C",Beta:"\u0392",beta:"\u03B2",beth:"\u2136",between:"\u226C",Bfr:"\u{1D505}",bfr:"\u{1D51F}",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:"\u2AED",bnot:"\u2310",Bopf:"\u{1D539}",bopf:"\u{1D553}",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:"\u2564",boxhD:"\u2565",boxHD:"\u2566",boxhu:"\u2534",boxHu:"\u2567",boxhU:"\u2568",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",bsolb:"\u29C5",bsol:"\\",bsolhsub:"\u27C8",bull:"\u2022",bullet:"\u2022",bump:"\u224E",bumpE:"\u2AAE",bumpe:"\u224F",Bumpeq:"\u224E",bumpeq:"\u224F",Cacute:"\u0106",cacute:"\u0107",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",cap:"\u2229",Cap:"\u22D2",capcup:"\u2A47",capdot:"\u2A40",CapitalDifferentialD:"\u2145",caps:"\u2229\uFE00",caret:"\u2041",caron:"\u02C7",Cayleys:"\u212D",ccaps:"\u2A4D",Ccaron:"\u010C",ccaron:"\u010D",Ccedil:"\xC7",ccedil:"\xE7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2A4C",ccupssm:"\u2A50",Cdot:"\u010A",cdot:"\u010B",cedil:"\xB8",Cedilla:"\xB8",cemptyv:"\u29B2",cent:"\xA2",centerdot:"\xB7",CenterDot:"\xB7",cfr:"\u{1D520}",Cfr:"\u212D",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03A7",chi:"\u03C7",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",cir:"\u25CB",cirE:"\u29C3",cire:"\u2257",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201D",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",colon:":",Colon:"\u2237",Colone:"\u2A74",colone:"\u2254",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{1D49E}",cscr:"\u{1D4B8}",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",ctdot:"\u22EF",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22DE",cuesc:"\u22DF",cularr:"\u21B6",cularrp:"\u293D",cupbrcap:"\u2A48",cupcap:"\u2A46",CupCap:"\u224D",cup:"\u222A",Cup:"\u22D3",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:"\u21A1",dArr:"\u21D3",dash:"\u2010",Dashv:"\u2AE4",dashv:"\u22A3",dbkarow:"\u290F",dblac:"\u02DD",Dcaron:"\u010E",dcaron:"\u010F",Dcy:"\u0414",dcy:"\u0434",ddagger:"\u2021",ddarr:"\u21CA",DD:"\u2145",dd:"\u2146",DDotrahd:"\u2911",ddotseq:"\u2A77",deg:"\xB0",Del:"\u2207",Delta:"\u0394",delta:"\u03B4",demptyv:"\u29B1",dfisht:"\u297F",Dfr:"\u{1D507}",dfr:"\u{1D521}",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:"\u0402",djcy:"\u0452",dlcorn:"\u231E",dlcrop:"\u230D",dollar:"$",Dopf:"\u{1D53B}",dopf:"\u{1D555}",Dot:"\xA8",dot:"\u02D9",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",DownArrowBar:"\u2913",downarrow:"\u2193",DownArrow:"\u2193",Downarrow:"\u21D3",DownArrowUpArrow:"\u21F5",DownBreve:"\u0311",downdownarrows:"\u21CA",downharpoonleft:"\u21C3",downharpoonright:"\u21C2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295E",DownLeftVectorBar:"\u2956",DownLeftVector:"\u21BD",DownRightTeeVector:"\u295F",DownRightVectorBar:"\u2957",DownRightVector:"\u21C1",DownTeeArrow:"\u21A7",DownTee:"\u22A4",drbkarow:"\u2910",drcorn:"\u231F",drcrop:"\u230C",Dscr:"\u{1D49F}",dscr:"\u{1D4B9}",DScy:"\u0405",dscy:"\u0455",dsol:"\u29F6",Dstrok:"\u0110",dstrok:"\u0111",dtdot:"\u22F1",dtri:"\u25BF",dtrif:"\u25BE",duarr:"\u21F5",duhar:"\u296F",dwangle:"\u29A6",DZcy:"\u040F",dzcy:"\u045F",dzigrarr:"\u27FF",Eacute:"\xC9",eacute:"\xE9",easter:"\u2A6E",Ecaron:"\u011A",ecaron:"\u011B",Ecirc:"\xCA",ecirc:"\xEA",ecir:"\u2256",ecolon:"\u2255",Ecy:"\u042D",ecy:"\u044D",eDDot:"\u2A77",Edot:"\u0116",edot:"\u0117",eDot:"\u2251",ee:"\u2147",efDot:"\u2252",Efr:"\u{1D508}",efr:"\u{1D522}",eg:"\u2A9A",Egrave:"\xC8",egrave:"\xE8",egs:"\u2A96",egsdot:"\u2A98",el:"\u2A99",Element:"\u2208",elinters:"\u23E7",ell:"\u2113",els:"\u2A95",elsdot:"\u2A97",Emacr:"\u0112",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25FB",emptyv:"\u2205",EmptyVerySmallSquare:"\u25AB",emsp13:"\u2004",emsp14:"\u2005",emsp:"\u2003",ENG:"\u014A",eng:"\u014B",ensp:"\u2002",Eogon:"\u0118",eogon:"\u0119",Eopf:"\u{1D53C}",eopf:"\u{1D556}",epar:"\u22D5",eparsl:"\u29E3",eplus:"\u2A71",epsi:"\u03B5",Epsilon:"\u0395",epsilon:"\u03B5",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:"\u2A73",esim:"\u2242",Eta:"\u0397",eta:"\u03B7",ETH:"\xD0",eth:"\xF0",Euml:"\xCB",euml:"\xEB",euro:"\u20AC",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",exponentiale:"\u2147",ExponentialE:"\u2147",fallingdotseq:"\u2252",Fcy:"\u0424",fcy:"\u0444",female:"\u2640",ffilig:"\uFB03",fflig:"\uFB00",ffllig:"\uFB04",Ffr:"\u{1D509}",ffr:"\u{1D523}",filig:"\uFB01",FilledSmallSquare:"\u25FC",FilledVerySmallSquare:"\u25AA",fjlig:"fj",flat:"\u266D",fllig:"\uFB02",fltns:"\u25B1",fnof:"\u0192",Fopf:"\u{1D53D}",fopf:"\u{1D557}",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:"\u0393",gamma:"\u03B3",Gammad:"\u03DC",gammad:"\u03DD",gap:"\u2A86",Gbreve:"\u011E",gbreve:"\u011F",Gcedil:"\u0122",Gcirc:"\u011C",gcirc:"\u011D",Gcy:"\u0413",gcy:"\u0433",Gdot:"\u0120",gdot:"\u0121",ge:"\u2265",gE:"\u2267",gEl:"\u2A8C",gel:"\u22DB",geq:"\u2265",geqq:"\u2267",geqslant:"\u2A7E",gescc:"\u2AA9",ges:"\u2A7E",gesdot:"\u2A80",gesdoto:"\u2A82",gesdotol:"\u2A84",gesl:"\u22DB\uFE00",gesles:"\u2A94",Gfr:"\u{1D50A}",gfr:"\u{1D524}",gg:"\u226B",Gg:"\u22D9",ggg:"\u22D9",gimel:"\u2137",GJcy:"\u0403",gjcy:"\u0453",gla:"\u2AA5",gl:"\u2277",glE:"\u2A92",glj:"\u2AA4",gnap:"\u2A8A",gnapprox:"\u2A8A",gne:"\u2A88",gnE:"\u2269",gneq:"\u2A88",gneqq:"\u2269",gnsim:"\u22E7",Gopf:"\u{1D53E}",gopf:"\u{1D558}",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22DB",GreaterFullEqual:"\u2267",GreaterGreater:"\u2AA2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2A7E",GreaterTilde:"\u2273",Gscr:"\u{1D4A2}",gscr:"\u210A",gsim:"\u2273",gsime:"\u2A8E",gsiml:"\u2A90",gtcc:"\u2AA7",gtcir:"\u2A7A",gt:">",GT:">",Gt:"\u226B",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:"\u042A",hardcy:"\u044A",harrcir:"\u2948",harr:"\u2194",hArr:"\u21D4",harrw:"\u21AD",Hat:"^",hbar:"\u210F",Hcirc:"\u0124",hcirc:"\u0125",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:"\u0126",hstrok:"\u0127",HumpDownHump:"\u224E",HumpEqual:"\u224F",hybull:"\u2043",hyphen:"\u2010",Iacute:"\xCD",iacute:"\xED",ic:"\u2063",Icirc:"\xCE",icirc:"\xEE",Icy:"\u0418",icy:"\u0438",Idot:"\u0130",IEcy:"\u0415",iecy:"\u0435",iexcl:"\xA1",iff:"\u21D4",ifr:"\u{1D526}",Ifr:"\u2111",Igrave:"\xCC",igrave:"\xEC",ii:"\u2148",iiiint:"\u2A0C",iiint:"\u222D",iinfin:"\u29DC",iiota:"\u2129",IJlig:"\u0132",ijlig:"\u0133",Imacr:"\u012A",imacr:"\u012B",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",Im:"\u2111",imof:"\u22B7",imped:"\u01B5",Implies:"\u21D2",incare:"\u2105",in:"\u2208",infin:"\u221E",infintie:"\u29DD",inodot:"\u0131",intcal:"\u22BA",int:"\u222B",Int:"\u222C",integers:"\u2124",Integral:"\u222B",intercal:"\u22BA",Intersection:"\u22C2",intlarhk:"\u2A17",intprod:"\u2A3C",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",IOcy:"\u0401",iocy:"\u0451",Iogon:"\u012E",iogon:"\u012F",Iopf:"\u{1D540}",iopf:"\u{1D55A}",Iota:"\u0399",iota:"\u03B9",iprod:"\u2A3C",iquest:"\xBF",iscr:"\u{1D4BE}",Iscr:"\u2110",isin:"\u2208",isindot:"\u22F5",isinE:"\u22F9",isins:"\u22F4",isinsv:"\u22F3",isinv:"\u2208",it:"\u2062",Itilde:"\u0128",itilde:"\u0129",Iukcy:"\u0406",iukcy:"\u0456",Iuml:"\xCF",iuml:"\xEF",Jcirc:"\u0134",jcirc:"\u0135",Jcy:"\u0419",jcy:"\u0439",Jfr:"\u{1D50D}",jfr:"\u{1D527}",jmath:"\u0237",Jopf:"\u{1D541}",jopf:"\u{1D55B}",Jscr:"\u{1D4A5}",jscr:"\u{1D4BF}",Jsercy:"\u0408",jsercy:"\u0458",Jukcy:"\u0404",jukcy:"\u0454",Kappa:"\u039A",kappa:"\u03BA",kappav:"\u03F0",Kcedil:"\u0136",kcedil:"\u0137",Kcy:"\u041A",kcy:"\u043A",Kfr:"\u{1D50E}",kfr:"\u{1D528}",kgreen:"\u0138",KHcy:"\u0425",khcy:"\u0445",KJcy:"\u040C",kjcy:"\u045C",Kopf:"\u{1D542}",kopf:"\u{1D55C}",Kscr:"\u{1D4A6}",kscr:"\u{1D4C0}",lAarr:"\u21DA",Lacute:"\u0139",lacute:"\u013A",laemptyv:"\u29B4",lagran:"\u2112",Lambda:"\u039B",lambda:"\u03BB",lang:"\u27E8",Lang:"\u27EA",langd:"\u2991",langle:"\u27E8",lap:"\u2A85",Laplacetrf:"\u2112",laquo:"\xAB",larrb:"\u21E4",larrbfs:"\u291F",larr:"\u2190",Larr:"\u219E",lArr:"\u21D0",larrfs:"\u291D",larrhk:"\u21A9",larrlp:"\u21AB",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21A2",latail:"\u2919",lAtail:"\u291B",lat:"\u2AAB",late:"\u2AAD",lates:"\u2AAD\uFE00",lbarr:"\u290C",lBarr:"\u290E",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298B",lbrksld:"\u298F",lbrkslu:"\u298D",Lcaron:"\u013D",lcaron:"\u013E",Lcedil:"\u013B",lcedil:"\u013C",lceil:"\u2308",lcub:"{",Lcy:"\u041B",lcy:"\u043B",ldca:"\u2936",ldquo:"\u201C",ldquor:"\u201E",ldrdhar:"\u2967",ldrushar:"\u294B",ldsh:"\u21B2",le:"\u2264",lE:"\u2266",LeftAngleBracket:"\u27E8",LeftArrowBar:"\u21E4",leftarrow:"\u2190",LeftArrow:"\u2190",Leftarrow:"\u21D0",LeftArrowRightArrow:"\u21C6",leftarrowtail:"\u21A2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27E6",LeftDownTeeVector:"\u2961",LeftDownVectorBar:"\u2959",LeftDownVector:"\u21C3",LeftFloor:"\u230A",leftharpoondown:"\u21BD",leftharpoonup:"\u21BC",leftleftarrows:"\u21C7",leftrightarrow:"\u2194",LeftRightArrow:"\u2194",Leftrightarrow:"\u21D4",leftrightarrows:"\u21C6",leftrightharpoons:"\u21CB",leftrightsquigarrow:"\u21AD",LeftRightVector:"\u294E",LeftTeeArrow:"\u21A4",LeftTee:"\u22A3",LeftTeeVector:"\u295A",leftthreetimes:"\u22CB",LeftTriangleBar:"\u29CF",LeftTriangle:"\u22B2",LeftTriangleEqual:"\u22B4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVectorBar:"\u2958",LeftUpVector:"\u21BF",LeftVectorBar:"\u2952",LeftVector:"\u21BC",lEg:"\u2A8B",leg:"\u22DA",leq:"\u2264",leqq:"\u2266",leqslant:"\u2A7D",lescc:"\u2AA8",les:"\u2A7D",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{1D50F}",lfr:"\u{1D529}",lg:"\u2276",lgE:"\u2A91",lHar:"\u2962",lhard:"\u21BD",lharu:"\u21BC",lharul:"\u296A",lhblk:"\u2584",LJcy:"\u0409",ljcy:"\u0459",llarr:"\u21C7",ll:"\u226A",Ll:"\u22D8",llcorner:"\u231E",Lleftarrow:"\u21DA",llhard:"\u296B",lltri:"\u25FA",Lmidot:"\u013F",lmidot:"\u0140",lmoustache:"\u23B0",lmoust:"\u23B0",lnap:"\u2A89",lnapprox:"\u2A89",lne:"\u2A87",lnE:"\u2268",lneq:"\u2A87",lneqq:"\u2268",lnsim:"\u22E6",loang:"\u27EC",loarr:"\u21FD",lobrk:"\u27E6",longleftarrow:"\u27F5",LongLeftArrow:"\u27F5",Longleftarrow:"\u27F8",longleftrightarrow:"\u27F7",LongLeftRightArrow:"\u27F7",Longleftrightarrow:"\u27FA",longmapsto:"\u27FC",longrightarrow:"\u27F6",LongRightArrow:"\u27F6",Longrightarrow:"\u27F9",looparrowleft:"\u21AB",looparrowright:"\u21AC",lopar:"\u2985",Lopf:"\u{1D543}",lopf:"\u{1D55D}",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:"\u0141",lstrok:"\u0142",ltcc:"\u2AA6",ltcir:"\u2A79",lt:"<",LT:"<",Lt:"\u226A",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:"\u2905",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",mapstoleft:"\u21A4",mapstoup:"\u21A5",marker:"\u25AE",mcomma:"\u2A29",Mcy:"\u041C",mcy:"\u043C",mdash:"\u2014",mDDot:"\u223A",measuredangle:"\u2221",MediumSpace:"\u205F",Mellintrf:"\u2133",Mfr:"\u{1D510}",mfr:"\u{1D52A}",mho:"\u2127",micro:"\xB5",midast:"*",midcir:"\u2AF0",mid:"\u2223",middot:"\xB7",minusb:"\u229F",minus:"\u2212",minusd:"\u2238",minusdu:"\u2A2A",MinusPlus:"\u2213",mlcp:"\u2ADB",mldr:"\u2026",mnplus:"\u2213",models:"\u22A7",Mopf:"\u{1D544}",mopf:"\u{1D55E}",mp:"\u2213",mscr:"\u{1D4C2}",Mscr:"\u2133",mstpos:"\u223E",Mu:"\u039C",mu:"\u03BC",multimap:"\u22B8",mumap:"\u22B8",nabla:"\u2207",Nacute:"\u0143",nacute:"\u0144",nang:"\u2220\u20D2",nap:"\u2249",napE:"\u2A70\u0338",napid:"\u224B\u0338",napos:"\u0149",napprox:"\u2249",natural:"\u266E",naturals:"\u2115",natur:"\u266E",nbsp:"\xA0",nbump:"\u224E\u0338",nbumpe:"\u224F\u0338",ncap:"\u2A43",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2A6D\u0338",ncup:"\u2A42",Ncy:"\u041D",ncy:"\u043D",ndash:"\u2013",nearhk:"\u2924",nearr:"\u2197",neArr:"\u21D7",nearrow:"\u2197",ne:"\u2260",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{1D511}",nfr:"\u{1D52B}",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",nGg:"\u22D9\u0338",ngsim:"\u2275",nGt:"\u226B\u20D2",ngt:"\u226F",ngtr:"\u226F",nGtv:"\u226B\u0338",nharr:"\u21AE",nhArr:"\u21CE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",NJcy:"\u040A",njcy:"\u045A",nlarr:"\u219A",nlArr:"\u21CD",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",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:"\u226A\u20D2",nlt:"\u226E",nltri:"\u22EA",nltrie:"\u22EC",nLtv:"\u226A\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xA0",nopf:"\u{1D55F}",Nopf:"\u2115",Not:"\u2AEC",not:"\xAC",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",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangle:"\u22EA",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",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangle:"\u22EB",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",nparallel:"\u2226",npar:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",nprec:"\u2280",npreceq:"\u2AAF\u0338",npre:"\u2AAF\u0338",nrarrc:"\u2933\u0338",nrarr:"\u219B",nrArr:"\u21CF",nrarrw:"\u219D\u0338",nrightarrow:"\u219B",nRightarrow:"\u21CF",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",Nscr:"\u{1D4A9}",nscr:"\u{1D4C3}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsubE:"\u2AC5\u0338",nsube:"\u2288",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupE:"\u2AC6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",Ntilde:"\xD1",ntilde:"\xF1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",Nu:"\u039D",nu:"\u03BD",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:"\xD3",oacute:"\xF3",oast:"\u229B",Ocirc:"\xD4",ocirc:"\xF4",ocir:"\u229A",Ocy:"\u041E",ocy:"\u043E",odash:"\u229D",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",OElig:"\u0152",oelig:"\u0153",ofcir:"\u29BF",Ofr:"\u{1D512}",ofr:"\u{1D52C}",ogon:"\u02DB",Ograve:"\xD2",ograve:"\xF2",ogt:"\u29C1",ohbar:"\u29B5",ohm:"\u03A9",oint:"\u222E",olarr:"\u21BA",olcir:"\u29BE",olcross:"\u29BB",oline:"\u203E",olt:"\u29C0",Omacr:"\u014C",omacr:"\u014D",Omega:"\u03A9",omega:"\u03C9",Omicron:"\u039F",omicron:"\u03BF",omid:"\u29B6",ominus:"\u2296",Oopf:"\u{1D546}",oopf:"\u{1D560}",opar:"\u29B7",OpenCurlyDoubleQuote:"\u201C",OpenCurlyQuote:"\u2018",operp:"\u29B9",oplus:"\u2295",orarr:"\u21BB",Or:"\u2A54",or:"\u2228",ord:"\u2A5D",order:"\u2134",orderof:"\u2134",ordf:"\xAA",ordm:"\xBA",origof:"\u22B6",oror:"\u2A56",orslope:"\u2A57",orv:"\u2A5B",oS:"\u24C8",Oscr:"\u{1D4AA}",oscr:"\u2134",Oslash:"\xD8",oslash:"\xF8",osol:"\u2298",Otilde:"\xD5",otilde:"\xF5",otimesas:"\u2A36",Otimes:"\u2A37",otimes:"\u2297",Ouml:"\xD6",ouml:"\xF6",ovbar:"\u233D",OverBar:"\u203E",OverBrace:"\u23DE",OverBracket:"\u23B4",OverParenthesis:"\u23DC",para:"\xB6",parallel:"\u2225",par:"\u2225",parsim:"\u2AF3",parsl:"\u2AFD",part:"\u2202",PartialD:"\u2202",Pcy:"\u041F",pcy:"\u043F",percnt:"%",period:".",permil:"\u2030",perp:"\u22A5",pertenk:"\u2031",Pfr:"\u{1D513}",pfr:"\u{1D52D}",Phi:"\u03A6",phi:"\u03C6",phiv:"\u03D5",phmmat:"\u2133",phone:"\u260E",Pi:"\u03A0",pi:"\u03C0",pitchfork:"\u22D4",piv:"\u03D6",planck:"\u210F",planckh:"\u210E",plankv:"\u210F",plusacir:"\u2A23",plusb:"\u229E",pluscir:"\u2A22",plus:"+",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",prap:"\u2AB7",Pr:"\u2ABB",pr:"\u227A",prcue:"\u227C",precapprox:"\u2AB7",prec:"\u227A",preccurlyeq:"\u227C",Precedes:"\u227A",PrecedesEqual:"\u2AAF",PrecedesSlantEqual:"\u227C",PrecedesTilde:"\u227E",preceq:"\u2AAF",precnapprox:"\u2AB9",precneqq:"\u2AB5",precnsim:"\u22E8",pre:"\u2AAF",prE:"\u2AB3",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",Proportional:"\u221D",Proportion:"\u2237",propto:"\u221D",prsim:"\u227E",prurel:"\u22B0",Pscr:"\u{1D4AB}",pscr:"\u{1D4C5}",Psi:"\u03A8",psi:"\u03C8",puncsp:"\u2008",Qfr:"\u{1D514}",qfr:"\u{1D52E}",qint:"\u2A0C",qopf:"\u{1D562}",Qopf:"\u211A",qprime:"\u2057",Qscr:"\u{1D4AC}",qscr:"\u{1D4C6}",quaternions:"\u210D",quatint:"\u2A16",quest:"?",questeq:"\u225F",quot:'"',QUOT:'"',rAarr:"\u21DB",race:"\u223D\u0331",Racute:"\u0154",racute:"\u0155",radic:"\u221A",raemptyv:"\u29B3",rang:"\u27E9",Rang:"\u27EB",rangd:"\u2992",range:"\u29A5",rangle:"\u27E9",raquo:"\xBB",rarrap:"\u2975",rarrb:"\u21E5",rarrbfs:"\u2920",rarrc:"\u2933",rarr:"\u2192",Rarr:"\u21A0",rArr:"\u21D2",rarrfs:"\u291E",rarrhk:"\u21AA",rarrlp:"\u21AC",rarrpl:"\u2945",rarrsim:"\u2974",Rarrtl:"\u2916",rarrtl:"\u21A3",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:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",rceil:"\u2309",rcub:"}",Rcy:"\u0420",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201D",rdquor:"\u201D",rdsh:"\u21B3",real:"\u211C",realine:"\u211B",realpart:"\u211C",reals:"\u211D",Re:"\u211C",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:"\u03A1",rho:"\u03C1",rhov:"\u03F1",RightAngleBracket:"\u27E9",RightArrowBar:"\u21E5",rightarrow:"\u2192",RightArrow:"\u2192",Rightarrow:"\u21D2",RightArrowLeftArrow:"\u21C4",rightarrowtail:"\u21A3",RightCeiling:"\u2309",RightDoubleBracket:"\u27E7",RightDownTeeVector:"\u295D",RightDownVectorBar:"\u2955",RightDownVector:"\u21C2",RightFloor:"\u230B",rightharpoondown:"\u21C1",rightharpoonup:"\u21C0",rightleftarrows:"\u21C4",rightleftharpoons:"\u21CC",rightrightarrows:"\u21C9",rightsquigarrow:"\u219D",RightTeeArrow:"\u21A6",RightTee:"\u22A2",RightTeeVector:"\u295B",rightthreetimes:"\u22CC",RightTriangleBar:"\u29D0",RightTriangle:"\u22B3",RightTriangleEqual:"\u22B5",RightUpDownVector:"\u294F",RightUpTeeVector:"\u295C",RightUpVectorBar:"\u2954",RightUpVector:"\u21BE",RightVectorBar:"\u2953",RightVector:"\u21C0",ring:"\u02DA",risingdotseq:"\u2253",rlarr:"\u21C4",rlhar:"\u21CC",rlm:"\u200F",rmoustache:"\u23B1",rmoust:"\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:"\u015A",sacute:"\u015B",sbquo:"\u201A",scap:"\u2AB8",Scaron:"\u0160",scaron:"\u0161",Sc:"\u2ABC",sc:"\u227B",sccue:"\u227D",sce:"\u2AB0",scE:"\u2AB4",Scedil:"\u015E",scedil:"\u015F",Scirc:"\u015C",scirc:"\u015D",scnap:"\u2ABA",scnE:"\u2AB6",scnsim:"\u22E9",scpolint:"\u2A13",scsim:"\u227F",Scy:"\u0421",scy:"\u0441",sdotb:"\u22A1",sdot:"\u22C5",sdote:"\u2A66",searhk:"\u2925",searr:"\u2198",seArr:"\u21D8",searrow:"\u2198",sect:"\xA7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",Sfr:"\u{1D516}",sfr:"\u{1D530}",sfrown:"\u2322",sharp:"\u266F",SHCHcy:"\u0429",shchcy:"\u0449",SHcy:"\u0428",shcy:"\u0448",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xAD",Sigma:"\u03A3",sigma:"\u03C3",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:"\u042C",softcy:"\u044C",solbar:"\u233F",solb:"\u29C4",sol:"/",Sopf:"\u{1D54A}",sopf:"\u{1D564}",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",square:"\u25A1",Square:"\u25A1",SquareIntersection:"\u2293",SquareSubset:"\u228F",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25AA",squ:"\u25A1",squf:"\u25AA",srarr:"\u2192",Sscr:"\u{1D4AE}",sscr:"\u{1D4C8}",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22C6",Star:"\u22C6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03F5",straightphi:"\u03D5",strns:"\xAF",sub:"\u2282",Sub:"\u22D0",subdot:"\u2ABD",subE:"\u2AC5",sube:"\u2286",subedot:"\u2AC3",submult:"\u2AC1",subnE:"\u2ACB",subne:"\u228A",subplus:"\u2ABF",subrarr:"\u2979",subset:"\u2282",Subset:"\u22D0",subseteq:"\u2286",subseteqq:"\u2AC5",SubsetEqual:"\u2286",subsetneq:"\u228A",subsetneqq:"\u2ACB",subsim:"\u2AC7",subsub:"\u2AD5",subsup:"\u2AD3",succapprox:"\u2AB8",succ:"\u227B",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",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",sup:"\u2283",Sup:"\u22D1",supdot:"\u2ABE",supdsub:"\u2AD8",supE:"\u2AC6",supe:"\u2287",supedot:"\u2AC4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27C9",suphsub:"\u2AD7",suplarr:"\u297B",supmult:"\u2AC2",supnE:"\u2ACC",supne:"\u228B",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:"\u03A4",tau:"\u03C4",tbrk:"\u23B4",Tcaron:"\u0164",tcaron:"\u0165",Tcedil:"\u0162",tcedil:"\u0163",Tcy:"\u0422",tcy:"\u0442",tdot:"\u20DB",telrec:"\u2315",Tfr:"\u{1D517}",tfr:"\u{1D531}",there4:"\u2234",therefore:"\u2234",Therefore:"\u2234",Theta:"\u0398",theta:"\u03B8",thetasym:"\u03D1",thetav:"\u03D1",thickapprox:"\u2248",thicksim:"\u223C",ThickSpace:"\u205F\u200A",ThinSpace:"\u2009",thinsp:"\u2009",thkap:"\u2248",thksim:"\u223C",THORN:"\xDE",thorn:"\xFE",tilde:"\u02DC",Tilde:"\u223C",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",timesbar:"\u2A31",timesb:"\u22A0",times:"\xD7",timesd:"\u2A30",tint:"\u222D",toea:"\u2928",topbot:"\u2336",topcir:"\u2AF1",top:"\u22A4",Topf:"\u{1D54B}",topf:"\u{1D565}",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{1D4AF}",tscr:"\u{1D4C9}",TScy:"\u0426",tscy:"\u0446",TSHcy:"\u040B",tshcy:"\u045B",Tstrok:"\u0166",tstrok:"\u0167",twixt:"\u226C",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",Uacute:"\xDA",uacute:"\xFA",uarr:"\u2191",Uarr:"\u219F",uArr:"\u21D1",Uarrocir:"\u2949",Ubrcy:"\u040E",ubrcy:"\u045E",Ubreve:"\u016C",ubreve:"\u016D",Ucirc:"\xDB",ucirc:"\xFB",Ucy:"\u0423",ucy:"\u0443",udarr:"\u21C5",Udblac:"\u0170",udblac:"\u0171",udhar:"\u296E",ufisht:"\u297E",Ufr:"\u{1D518}",ufr:"\u{1D532}",Ugrave:"\xD9",ugrave:"\xF9",uHar:"\u2963",uharl:"\u21BF",uharr:"\u21BE",uhblk:"\u2580",ulcorn:"\u231C",ulcorner:"\u231C",ulcrop:"\u230F",ultri:"\u25F8",Umacr:"\u016A",umacr:"\u016B",uml:"\xA8",UnderBar:"_",UnderBrace:"\u23DF",UnderBracket:"\u23B5",UnderParenthesis:"\u23DD",Union:"\u22C3",UnionPlus:"\u228E",Uogon:"\u0172",uogon:"\u0173",Uopf:"\u{1D54C}",uopf:"\u{1D566}",UpArrowBar:"\u2912",uparrow:"\u2191",UpArrow:"\u2191",Uparrow:"\u21D1",UpArrowDownArrow:"\u21C5",updownarrow:"\u2195",UpDownArrow:"\u2195",Updownarrow:"\u21D5",UpEquilibrium:"\u296E",upharpoonleft:"\u21BF",upharpoonright:"\u21BE",uplus:"\u228E",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",upsi:"\u03C5",Upsi:"\u03D2",upsih:"\u03D2",Upsilon:"\u03A5",upsilon:"\u03C5",UpTeeArrow:"\u21A5",UpTee:"\u22A5",upuparrows:"\u21C8",urcorn:"\u231D",urcorner:"\u231D",urcrop:"\u230E",Uring:"\u016E",uring:"\u016F",urtri:"\u25F9",Uscr:"\u{1D4B0}",uscr:"\u{1D4CA}",utdot:"\u22F0",Utilde:"\u0168",utilde:"\u0169",utri:"\u25B5",utrif:"\u25B4",uuarr:"\u21C8",Uuml:"\xDC",uuml:"\xFC",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:"\u0412",vcy:"\u0432",vdash:"\u22A2",vDash:"\u22A8",Vdash:"\u22A9",VDash:"\u22AB",Vdashl:"\u2AE6",veebar:"\u22BB",vee:"\u2228",Vee:"\u22C1",veeeq:"\u225A",vellip:"\u22EE",verbar:"|",Verbar:"\u2016",vert:"|",Vert:"\u2016",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200A",Vfr:"\u{1D519}",vfr:"\u{1D533}",vltri:"\u22B2",vnsub:"\u2282\u20D2",vnsup:"\u2283\u20D2",Vopf:"\u{1D54D}",vopf:"\u{1D567}",vprop:"\u221D",vrtri:"\u22B3",Vscr:"\u{1D4B1}",vscr:"\u{1D4CB}",vsubnE:"\u2ACB\uFE00",vsubne:"\u228A\uFE00",vsupnE:"\u2ACC\uFE00",vsupne:"\u228B\uFE00",Vvdash:"\u22AA",vzigzag:"\u299A",Wcirc:"\u0174",wcirc:"\u0175",wedbar:"\u2A5F",wedge:"\u2227",Wedge:"\u22C0",wedgeq:"\u2259",weierp:"\u2118",Wfr:"\u{1D51A}",wfr:"\u{1D534}",Wopf:"\u{1D54E}",wopf:"\u{1D568}",wp:"\u2118",wr:"\u2240",wreath:"\u2240",Wscr:"\u{1D4B2}",wscr:"\u{1D4CC}",xcap:"\u22C2",xcirc:"\u25EF",xcup:"\u22C3",xdtri:"\u25BD",Xfr:"\u{1D51B}",xfr:"\u{1D535}",xharr:"\u27F7",xhArr:"\u27FA",Xi:"\u039E",xi:"\u03BE",xlarr:"\u27F5",xlArr:"\u27F8",xmap:"\u27FC",xnis:"\u22FB",xodot:"\u2A00",Xopf:"\u{1D54F}",xopf:"\u{1D569}",xoplus:"\u2A01",xotime:"\u2A02",xrarr:"\u27F6",xrArr:"\u27F9",Xscr:"\u{1D4B3}",xscr:"\u{1D4CD}",xsqcup:"\u2A06",xuplus:"\u2A04",xutri:"\u25B3",xvee:"\u22C1",xwedge:"\u22C0",Yacute:"\xDD",yacute:"\xFD",YAcy:"\u042F",yacy:"\u044F",Ycirc:"\u0176",ycirc:"\u0177",Ycy:"\u042B",ycy:"\u044B",yen:"\xA5",Yfr:"\u{1D51C}",yfr:"\u{1D536}",YIcy:"\u0407",yicy:"\u0457",Yopf:"\u{1D550}",yopf:"\u{1D56A}",Yscr:"\u{1D4B4}",yscr:"\u{1D4CE}",YUcy:"\u042E",yucy:"\u044E",yuml:"\xFF",Yuml:"\u0178",Zacute:"\u0179",zacute:"\u017A",Zcaron:"\u017D",zcaron:"\u017E",Zcy:"\u0417",zcy:"\u0437",Zdot:"\u017B",zdot:"\u017C",zeetrf:"\u2128",ZeroWidthSpace:"\u200B",Zeta:"\u0396",zeta:"\u03B6",zfr:"\u{1D537}",Zfr:"\u2128",ZHcy:"\u0416",zhcy:"\u0436",zigrarr:"\u21DD",zopf:"\u{1D56B}",Zopf:"\u2124",Zscr:"\u{1D4B5}",zscr:"\u{1D4CF}",zwj:"\u200D",zwnj:"\u200C"}});var qn=E((Dg,ea)=>{"use strict";ea.exports=Qo()});var Er=E((Tg,ta)=>{ta.exports=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4E\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDF55-\uDF59]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD806[\uDC3B\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/});var ia=E((Og,na)=>{"use strict";var ra={};function Ed(t){var e,r,n=ra[t];if(n)return n;for(n=ra[t]=[],e=0;e<128;e++)r=String.fromCharCode(e),/^[0-9a-z]$/i.test(r)?n.push(r):n.push("%"+("0"+e.toString(16).toUpperCase()).slice(-2));for(e=0;e=55296&&o<=57343){if(o>=55296&&o<=56319&&n+1=56320&&a<=57343)){l+=encodeURIComponent(t[n]+t[n+1]),n++;continue}l+="%EF%BF%BD";continue}l+=encodeURIComponent(t[n])}return l}xr.defaultChars=";/?:@&=+$,-_.!~*'()#";xr.componentChars="-_.!~*'()";na.exports=xr});var sa=E((Ng,aa)=>{"use strict";var oa={};function xd(t){var e,r,n=oa[t];if(n)return n;for(n=oa[t]=[],e=0;e<128;e++)r=String.fromCharCode(e),n.push(r);for(e=0;e=55296&&c<=57343?d+="\uFFFD\uFFFD\uFFFD":d+=String.fromCharCode(c),i+=6;continue}if((a&248)===240&&i+91114111?d+="\uFFFD\uFFFD\uFFFD\uFFFD":(c-=65536,d+=String.fromCharCode(55296+(c>>10),56320+(c&1023))),i+=9;continue}d+="\uFFFD"}return d})}kr.defaultChars=";/?:@&=+$,#";kr.componentChars="";aa.exports=kr});var ua=E((Rg,la)=>{"use strict";la.exports=function(e){var r="";return r+=e.protocol||"",r+=e.slashes?"//":"",r+=e.auth?e.auth+"@":"",e.hostname&&e.hostname.indexOf(":")!==-1?r+="["+e.hostname+"]":r+=e.hostname||"",r+=e.port?":"+e.port:"",r+=e.pathname||"",r+=e.search||"",r+=e.hash||"",r}});var ga=E((Mg,ma)=>{"use strict";function Sr(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}var kd=/^([a-z0-9.+-]+:)/i,Sd=/:[0-9]*$/,Cd=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,Ad=["<",">",'"',"`"," ","\r",` +`," "],Dd=["{","}","|","\\","^","`"].concat(Ad),Td=["'"].concat(Dd),ca=["%","/","?",";","#"].concat(Td),da=["/","?","#"],Od=255,fa=/^[+a-z0-9A-Z_-]{0,63}$/,Nd=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,ha={javascript:!0,"javascript:":!0},pa={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Rd(t,e){if(t&&t instanceof Sr)return t;var r=new Sr;return r.parse(t,e),r}Sr.prototype.parse=function(t,e){var r,n,i,o,a,s=t;if(s=s.trim(),!e&&t.split("#").length===1){var l=Cd.exec(s);if(l)return this.pathname=l[1],l[2]&&(this.search=l[2]),this}var u=kd.exec(s);if(u&&(u=u[0],i=u.toLowerCase(),this.protocol=u,s=s.substr(u.length)),(e||u||s.match(/^\/\/[^@\/]+@[^@\/]+/))&&(a=s.substr(0,2)==="//",a&&!(u&&ha[u])&&(s=s.substr(2),this.slashes=!0)),!ha[u]&&(a||u&&!pa[u])){var c=-1;for(r=0;r127?b+="x":b+=v[g];if(!b.match(fa)){var x=m.slice(0,r),C=m.slice(r+1),y=v.match(Nd);y&&(x.push(y[1]),C.unshift(y[2])),C.length&&(s=C.join(".")+s),this.hostname=x.join(".");break}}}}this.hostname.length>Od&&(this.hostname=""),p&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}var D=s.indexOf("#");D!==-1&&(this.hash=s.substr(D),s=s.slice(0,D));var F=s.indexOf("?");return F!==-1&&(this.search=s.substr(F),s=s.slice(0,F)),s&&(this.pathname=s),pa[i]&&this.hostname&&!this.pathname&&(this.pathname=""),this};Sr.prototype.parseHost=function(t){var e=Sd.exec(t);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};ma.exports=Rd});var In=E((Fg,$t)=>{"use strict";$t.exports.encode=ia();$t.exports.decode=sa();$t.exports.format=ua();$t.exports.parse=ga()});var Ln=E((Pg,ba)=>{ba.exports=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/});var Bn=E((qg,va)=>{va.exports=/[\0-\x1F\x7F-\x9F]/});var _a=E((Ig,ya)=>{ya.exports=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/});var zn=E((Lg,wa)=>{wa.exports=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/});var Ea=E(Ct=>{"use strict";Ct.Any=Ln();Ct.Cc=Bn();Ct.Cf=_a();Ct.P=Er();Ct.Z=zn()});var O=E(j=>{"use strict";function Md(t){return Object.prototype.toString.call(t)}function Fd(t){return Md(t)==="[object String]"}var Pd=Object.prototype.hasOwnProperty;function xa(t,e){return Pd.call(t,e)}function qd(t){var e=Array.prototype.slice.call(arguments,1);return e.forEach(function(r){if(!!r){if(typeof r!="object")throw new TypeError(r+"must be object");Object.keys(r).forEach(function(n){t[n]=r[n]})}}),t}function Id(t,e,r){return[].concat(t.slice(0,e),r,t.slice(e+1))}function ka(t){return!(t>=55296&&t<=57343||t>=64976&&t<=65007||(t&65535)===65535||(t&65535)===65534||t>=0&&t<=8||t===11||t>=14&&t<=31||t>=127&&t<=159||t>1114111)}function Sa(t){if(t>65535){t-=65536;var e=55296+(t>>10),r=56320+(t&1023);return String.fromCharCode(e,r)}return String.fromCharCode(t)}var Ca=/\\([!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~])/g,Ld=/&([a-z#][a-z0-9]{1,31});/gi,Bd=new RegExp(Ca.source+"|"+Ld.source,"gi"),zd=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i,Aa=qn();function jd(t,e){var r=0;return xa(Aa,e)?Aa[e]:e.charCodeAt(0)===35&&zd.test(e)&&(r=e[1].toLowerCase()==="x"?parseInt(e.slice(2),16):parseInt(e.slice(1),10),ka(r))?Sa(r):t}function Hd(t){return t.indexOf("\\")<0?t:t.replace(Ca,"$1")}function Vd(t){return t.indexOf("\\")<0&&t.indexOf("&")<0?t:t.replace(Bd,function(e,r,n){return r||jd(e,n)})}var Gd=/[&<>"]/,Ud=/[&<>"]/g,$d={"&":"&","<":"<",">":">",'"':"""};function Jd(t){return $d[t]}function Kd(t){return Gd.test(t)?t.replace(Ud,Jd):t}var Wd=/[.?*+^$[\]\\(){}|-]/g;function Yd(t){return t.replace(Wd,"\\$&")}function Zd(t){switch(t){case 9:case 32:return!0}return!1}function Xd(t){if(t>=8192&&t<=8202)return!0;switch(t){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}var Qd=Er();function ef(t){return Qd.test(t)}function tf(t){switch(t){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function rf(t){return t=t.trim().replace(/\s+/g," "),"\u1E9E".toLowerCase()==="\u1E7E"&&(t=t.replace(/ẞ/g,"\xDF")),t.toLowerCase().toUpperCase()}j.lib={};j.lib.mdurl=In();j.lib.ucmicro=Ea();j.assign=qd;j.isString=Fd;j.has=xa;j.unescapeMd=Hd;j.unescapeAll=Vd;j.isValidEntityCode=ka;j.fromCodePoint=Sa;j.escapeHtml=Kd;j.arrayReplaceAt=Id;j.isSpace=Zd;j.isWhiteSpace=Xd;j.isMdAsciiPunct=tf;j.isPunctChar=ef;j.escapeRE=Yd;j.normalizeReference=rf});var Ta=E((jg,Da)=>{"use strict";Da.exports=function(e,r,n){var i,o,a,s,l=-1,u=e.posMax,c=e.pos;for(e.pos=r+1,i=1;e.pos{"use strict";var Oa=O().unescapeAll;Na.exports=function(e,r,n){var i,o,a=0,s=r,l={ok:!1,pos:0,lines:0,str:""};if(e.charCodeAt(r)===60){for(r++;r32))return l;if(i===41){if(o===0)break;o--}r++}return s===r||o!==0||(l.str=Oa(e.slice(s,r)),l.lines=a,l.pos=r,l.ok=!0),l}});var Fa=E((Vg,Ma)=>{"use strict";var nf=O().unescapeAll;Ma.exports=function(e,r,n){var i,o,a=0,s=r,l={ok:!1,pos:0,lines:0,str:""};if(r>=n||(o=e.charCodeAt(r),o!==34&&o!==39&&o!==40))return l;for(r++,o===40&&(o=41);r{"use strict";Cr.parseLinkLabel=Ta();Cr.parseLinkDestination=Ra();Cr.parseLinkTitle=Fa()});var Ia=E((Ug,qa)=>{"use strict";var of=O().assign,af=O().unescapeAll,it=O().escapeHtml,ye={};ye.code_inline=function(t,e,r,n,i){var o=t[e];return""+it(t[e].content)+""};ye.code_block=function(t,e,r,n,i){var o=t[e];return""+it(t[e].content)+` +`};ye.fence=function(t,e,r,n,i){var o=t[e],a=o.info?af(o.info).trim():"",s="",l="",u,c,d,f,h;return a&&(d=a.split(/(\s+)/g),s=d[0],l=d.slice(2).join("")),r.highlight?u=r.highlight(o.content,s,l)||it(o.content):u=it(o.content),u.indexOf(""+u+` `):"
"+u+`
-`};ve.image=function(t,e,r,n,i){var o=t[e];return o.attrs[o.attrIndex("alt")][1]=i.renderInlineAsText(o.children,r,n),i.renderToken(t,e,r)};ve.hardbreak=function(t,e,r){return r.xhtmlOut?`
+`};ye.image=function(t,e,r,n,i){var o=t[e];return o.attrs[o.attrIndex("alt")][1]=i.renderInlineAsText(o.children,r,n),i.renderToken(t,e,r)};ye.hardbreak=function(t,e,r){return r.xhtmlOut?`
`:`
-`};ve.softbreak=function(t,e,r){return r.breaks?r.xhtmlOut?`
+`};ye.softbreak=function(t,e,r){return r.breaks?r.xhtmlOut?`
`:`
`:` -`};ve.text=function(t,e){return Xe(t[e].content)};ve.html_block=function(t,e){return t[e].content};ve.html_inline=function(t,e){return t[e].content};function yt(){this.rules=nf({},ve)}yt.prototype.renderAttrs=function(e){var r,n,i;if(!e.attrs)return"";for(i="",r=0,n=e.attrs.length;r -`:">",o)};yt.prototype.renderInline=function(t,e,r){for(var n,i="",o=this.rules,a=0,s=t.length;a{"use strict";function pe(){this.__rules__=[],this.__cache__=null}pe.prototype.__find__=function(t){for(var e=0;e{"use strict";var af=/\r\n?|\n/g,sf=/\0/g;Na.exports=function(e){var r;r=e.src.replace(af,` -`),r=r.replace(sf,"\uFFFD"),e.src=r}});var Ra=E((Ig,Ma)=>{"use strict";Ma.exports=function(e){var r;e.inlineMode?(r=new e.Token("inline","",0),r.content=e.src,r.map=[0,1],r.children=[],e.tokens.push(r)):e.md.block.parse(e.src,e.md,e.env,e.tokens)}});var Pa=E((Lg,Fa)=>{"use strict";Fa.exports=function(e){var r=e.tokens,n,i,o;for(i=0,o=r.length;i{"use strict";var lf=N().arrayReplaceAt;function uf(t){return/^\s]/i.test(t)}function cf(t){return/^<\/a\s*>/i.test(t)}qa.exports=function(e){var r,n,i,o,a,s,l,u,c,d,f,h,p,m,v,b,g=e.tokens,w;if(!!e.md.options.linkify){for(n=0,i=g.length;n=0;r--){if(s=o[r],s.type==="link_close"){for(r--;o[r].level!==s.level&&o[r].type!=="link_open";)r--;continue}if(s.type==="html_inline"&&(uf(s.content)&&p>0&&p--,cf(s.content)&&p++),!(p>0)&&s.type==="text"&&e.md.linkify.test(s.content)){for(c=s.content,w=e.md.linkify.match(c),l=[],h=s.level,f=0,u=0;uf&&(a=new e.Token("text","",0),a.content=c.slice(f,d),a.level=h,l.push(a)),a=new e.Token("link_open","a",1),a.attrs=[["href",v]],a.level=h++,a.markup="linkify",a.info="auto",l.push(a),a=new e.Token("text","",0),a.content=b,a.level=h,l.push(a),a=new e.Token("link_close","a",-1),a.level=--h,a.markup="linkify",a.info="auto",l.push(a),f=w[u].lastIndex);f{"use strict";var La=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,df=/\((c|tm|r|p)\)/i,ff=/\((c|tm|r|p)\)/ig,hf={c:"\xA9",r:"\xAE",p:"\xA7",tm:"\u2122"};function pf(t,e){return hf[e.toLowerCase()]}function mf(t){var e,r,n=0;for(e=t.length-1;e>=0;e--)r=t[e],r.type==="text"&&!n&&(r.content=r.content.replace(ff,pf)),r.type==="link_open"&&r.info==="auto"&&n--,r.type==="link_close"&&r.info==="auto"&&n++}function gf(t){var e,r,n=0;for(e=t.length-1;e>=0;e--)r=t[e],r.type==="text"&&!n&&La.test(r.content)&&(r.content=r.content.replace(/\+-/g,"\xB1").replace(/\.{2,}/g,"\u2026").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/mg,"$1\u2014").replace(/(^|\s)--(?=\s|$)/mg,"$1\u2013").replace(/(^|[^-\s])--(?=[^-\s]|$)/mg,"$1\u2013")),r.type==="link_open"&&r.info==="auto"&&n--,r.type==="link_close"&&r.info==="auto"&&n++}Ba.exports=function(e){var r;if(!!e.md.options.typographer)for(r=e.tokens.length-1;r>=0;r--)e.tokens[r].type==="inline"&&(df.test(e.tokens[r].content)&&mf(e.tokens[r].children),La.test(e.tokens[r].content)&&gf(e.tokens[r].children))}});var Ja=E((jg,$a)=>{"use strict";var ja=N().isWhiteSpace,Ha=N().isPunctChar,Va=N().isMdAsciiPunct,bf=/['"]/,Ga=/['"]/g,Ua="\u2019";function xr(t,e,r){return t.substr(0,e)+r+t.substr(e+1)}function vf(t,e){var r,n,i,o,a,s,l,u,c,d,f,h,p,m,v,b,g,w,x,A,y;for(x=[],r=0;r=0&&!(x[g].level<=l);g--);if(x.length=g+1,n.type!=="text")continue;i=n.content,a=0,s=i.length;e:for(;a=0)c=i.charCodeAt(o.index-1);else for(g=r-1;g>=0&&!(t[g].type==="softbreak"||t[g].type==="hardbreak");g--)if(!!t[g].content){c=t[g].content.charCodeAt(t[g].content.length-1);break}if(d=32,a=48&&c<=57&&(b=v=!1),v&&b&&(v=f,b=h),!v&&!b){w&&(n.content=xr(n.content,o.index,Ua));continue}if(b){for(g=x.length-1;g>=0&&(u=x[g],!(x[g].level=0;r--)e.tokens[r].type!=="inline"||!bf.test(e.tokens[r].content)||vf(e.tokens[r].children,e)}});var kr=E((Hg,Ka)=>{"use strict";function _t(t,e,r){this.type=t,this.tag=e,this.attrs=null,this.map=null,this.nesting=r,this.level=0,this.children=null,this.content="",this.markup="",this.info="",this.meta=null,this.block=!1,this.hidden=!1}_t.prototype.attrIndex=function(e){var r,n,i;if(!this.attrs)return-1;for(r=this.attrs,n=0,i=r.length;n=0&&(n=this.attrs[r][1]),n};_t.prototype.attrJoin=function(e,r){var n=this.attrIndex(e);n<0?this.attrPush([e,r]):this.attrs[n][1]=this.attrs[n][1]+" "+r};Ka.exports=_t});var Za=E((Vg,Ya)=>{"use strict";var yf=kr();function Wa(t,e,r){this.src=t,this.env=r,this.tokens=[],this.inlineMode=!1,this.md=e}Wa.prototype.Token=yf;Ya.exports=Wa});var Qa=E((Gg,Xa)=>{"use strict";var _f=Er(),Ln=[["normalize",Oa()],["block",Ra()],["inline",Pa()],["linkify",Ia()],["replacements",za()],["smartquotes",Ja()]];function Bn(){this.ruler=new _f;for(var t=0;t{"use strict";var zn=N().isSpace;function jn(t,e){var r=t.bMarks[e]+t.tShift[e],n=t.eMarks[e];return t.src.substr(r,n-r)}function es(t){var e=[],r=0,n=t.length,i,o=!1,a=0,s="";for(i=t.charCodeAt(r);rn||(c=r+1,e.sCount[c]=4||(s=e.bMarks[c]+e.tShift[c],s>=e.eMarks[c])||(A=e.src.charCodeAt(s++),A!==124&&A!==45&&A!==58)||s>=e.eMarks[c]||(y=e.src.charCodeAt(s++),y!==124&&y!==45&&y!==58&&!zn(y))||A===45&&zn(y))return!1;for(;s=4||(d=es(a),d.length&&d[0]===""&&d.shift(),d.length&&d[d.length-1]===""&&d.pop(),f=d.length,f===0||f!==p.length))return!1;if(i)return!0;for(g=e.parentType,e.parentType="table",x=e.md.block.ruler.getRules("blockquote"),h=e.push("table_open","table",1),h.map=v=[r,0],h=e.push("thead_open","thead",1),h.map=[r,r+1],h=e.push("tr_open","tr",1),h.map=[r,r+1],l=0;l=4)break;for(d=es(a),d.length&&d[0]===""&&d.shift(),d.length&&d[d.length-1]===""&&d.pop(),c===r+2&&(h=e.push("tbody_open","tbody",1),h.map=b=[r+2,0]),h=e.push("tr_open","tr",1),h.map=[c,c+1],l=0;l{"use strict";ns.exports=function(e,r,n){var i,o,a;if(e.sCount[r]-e.blkIndent<4)return!1;for(o=i=r+1;i=4){i++,o=i;continue}break}return e.line=o,a=e.push("code_block","code",0),a.content=e.getLines(r,o,4+e.blkIndent,!1)+` -`,a.map=[r,e.line],!0}});var as=E((Jg,os)=>{"use strict";os.exports=function(e,r,n,i){var o,a,s,l,u,c,d,f=!1,h=e.bMarks[r]+e.tShift[r],p=e.eMarks[r];if(e.sCount[r]-e.blkIndent>=4||h+3>p||(o=e.src.charCodeAt(h),o!==126&&o!==96)||(u=h,h=e.skipChars(h,o),a=h-u,a<3)||(d=e.src.slice(u,h),s=e.src.slice(h,p),o===96&&s.indexOf(String.fromCharCode(o))>=0))return!1;if(i)return!0;for(l=r;l++,!(l>=n||(h=u=e.bMarks[l]+e.tShift[l],p=e.eMarks[l],h=4)&&(h=e.skipChars(h,o),!(h-u{"use strict";var ss=N().isSpace;ls.exports=function(e,r,n,i){var o,a,s,l,u,c,d,f,h,p,m,v,b,g,w,x,A,y,D,F,$=e.lineMax,T=e.bMarks[r]+e.tShift[r],O=e.eMarks[r];if(e.sCount[r]-e.blkIndent>=4||e.src.charCodeAt(T++)!==62)return!1;if(i)return!0;for(l=h=e.sCount[r]+1,e.src.charCodeAt(T)===32?(T++,l++,h++,o=!1,x=!0):e.src.charCodeAt(T)===9?(x=!0,(e.bsCount[r]+h)%4===3?(T++,l++,h++,o=!1):o=!0):x=!1,p=[e.bMarks[r]],e.bMarks[r]=T;T=O,g=[e.sCount[r]],e.sCount[r]=h-l,w=[e.tShift[r]],e.tShift[r]=T-e.bMarks[r],y=e.md.block.ruler.getRules("blockquote"),b=e.parentType,e.parentType="blockquote",f=r+1;f=O));f++){if(e.src.charCodeAt(T++)===62&&!F){for(l=h=e.sCount[f]+1,e.src.charCodeAt(T)===32?(T++,l++,h++,o=!1,x=!0):e.src.charCodeAt(T)===9?(x=!0,(e.bsCount[f]+h)%4===3?(T++,l++,h++,o=!1):o=!0):x=!1,p.push(e.bMarks[f]),e.bMarks[f]=T;T=O,m.push(e.bsCount[f]),e.bsCount[f]=e.sCount[f]+1+(x?1:0),g.push(e.sCount[f]),e.sCount[f]=h-l,w.push(e.tShift[f]),e.tShift[f]=T-e.bMarks[f];continue}if(c)break;for(A=!1,s=0,u=y.length;s",D.map=d=[r,0],e.md.block.tokenize(e,r,f),D=e.push("blockquote_close","blockquote",-1),D.markup=">",e.lineMax=$,e.parentType=b,d[1]=e.line,s=0;s{"use strict";var wf=N().isSpace;cs.exports=function(e,r,n,i){var o,a,s,l,u=e.bMarks[r]+e.tShift[r],c=e.eMarks[r];if(e.sCount[r]-e.blkIndent>=4||(o=e.src.charCodeAt(u++),o!==42&&o!==45&&o!==95))return!1;for(a=1;u{"use strict";var fs=N().isSpace;function hs(t,e){var r,n,i,o;return n=t.bMarks[e]+t.tShift[e],i=t.eMarks[e],r=t.src.charCodeAt(n++),r!==42&&r!==45&&r!==43||n=o||(r=t.src.charCodeAt(i++),r<48||r>57))return-1;for(;;){if(i>=o)return-1;if(r=t.src.charCodeAt(i++),r>=48&&r<=57){if(i-n>=10)return-1;continue}if(r===41||r===46)break;return-1}return i=4||e.listIndent>=0&&e.sCount[r]-e.listIndent>=4&&e.sCount[r]=e.blkIndent&&(Re=!0),(O=ps(e,r))>=0){if(d=!0,X=e.bMarks[r]+e.tShift[r],b=Number(e.src.slice(X,O-1)),Re&&b!==1)return!1}else if((O=hs(e,r))>=0)d=!1;else return!1;if(Re&&e.skipSpaces(O)>=e.eMarks[r])return!1;if(v=e.src.charCodeAt(O-1),i)return!0;for(m=e.tokens.length,d?(L=e.push("ordered_list_open","ol",1),b!==1&&(L.attrs=[["start",b]])):L=e.push("bullet_list_open","ul",1),L.map=p=[r,0],L.markup=String.fromCharCode(v),w=r,Ce=!1,Ae=e.md.block.ruler.getRules("list"),y=e.parentType,e.parentType="list";w=g?u=1:u=x-c,u>4&&(u=1),l=c+u,L=e.push("list_item_open","li",1),L.markup=String.fromCharCode(v),L.map=f=[r,0],d&&(L.info=e.src.slice(X,O-1)),$=e.tight,F=e.tShift[r],D=e.sCount[r],A=e.listIndent,e.listIndent=e.blkIndent,e.blkIndent=l,e.tight=!0,e.tShift[r]=a-e.bMarks[r],e.sCount[r]=x,a>=g&&e.isEmpty(r+1)?e.line=Math.min(e.line+2,n):e.md.block.tokenize(e,r,n,!0),(!e.tight||Ce)&&(Fe=!1),Ce=e.line-r>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=A,e.tShift[r]=F,e.sCount[r]=D,e.tight=$,L=e.push("list_item_close","li",-1),L.markup=String.fromCharCode(v),w=r=e.line,f[1]=w,a=e.bMarks[r],w>=n||e.sCount[w]=4)break;for(he=!1,s=0,h=Ae.length;s{"use strict";var xf=N().normalizeReference,Cr=N().isSpace;bs.exports=function(e,r,n,i){var o,a,s,l,u,c,d,f,h,p,m,v,b,g,w,x,A=0,y=e.bMarks[r]+e.tShift[r],D=e.eMarks[r],F=r+1;if(e.sCount[r]-e.blkIndent>=4||e.src.charCodeAt(y)!==91)return!1;for(;++y3)&&!(e.sCount[F]<0)){for(g=!1,c=0,d=w.length;c{"use strict";ys.exports=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","section","source","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"]});var Vn=E((Qg,Hn)=>{"use strict";var kf="[a-zA-Z_:][a-zA-Z0-9:._-]*",Cf="[^\"'=<>`\\x00-\\x20]+",Af="'[^']*'",Sf='"[^"]*"',Df="(?:"+Cf+"|"+Af+"|"+Sf+")",Tf="(?:\\s+"+kf+"(?:\\s*=\\s*"+Df+")?)",ws="<[A-Za-z][A-Za-z0-9\\-]*"+Tf+"*\\s*\\/?>",Es="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",Nf="|",Of="<[?][\\s\\S]*?[?]>",Mf="]*>",Rf="",Ff=new RegExp("^(?:"+ws+"|"+Es+"|"+Nf+"|"+Of+"|"+Mf+"|"+Rf+")"),Pf=new RegExp("^(?:"+ws+"|"+Es+")");Hn.exports.HTML_TAG_RE=Ff;Hn.exports.HTML_OPEN_CLOSE_TAG_RE=Pf});var ks=E((eb,xs)=>{"use strict";var qf=_s(),If=Vn().HTML_OPEN_CLOSE_TAG_RE,wt=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^/,!0],[/^<\?/,/\?>/,!0],[/^/,!0],[/^/,!0],[new RegExp("^|$))","i"),/^$/,!0],[new RegExp(If.source+"\\s*$"),/^$/,!1]];xs.exports=function(e,r,n,i){var o,a,s,l,u=e.bMarks[r]+e.tShift[r],c=e.eMarks[r];if(e.sCount[r]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(u)!==60)return!1;for(l=e.src.slice(u,c),o=0;o{"use strict";var Cs=N().isSpace;As.exports=function(e,r,n,i){var o,a,s,l,u=e.bMarks[r]+e.tShift[r],c=e.eMarks[r];if(e.sCount[r]-e.blkIndent>=4||(o=e.src.charCodeAt(u),o!==35||u>=c))return!1;for(a=1,o=e.src.charCodeAt(++u);o===35&&u6||uu&&Cs(e.src.charCodeAt(s-1))&&(c=s),e.line=r+1,l=e.push("heading_open","h"+String(a),1),l.markup="########".slice(0,a),l.map=[r,e.line],l=e.push("inline","",0),l.content=e.src.slice(u,c).trim(),l.map=[r,e.line],l.children=[],l=e.push("heading_close","h"+String(a),-1),l.markup="########".slice(0,a)),!0)}});var Ts=E((rb,Ds)=>{"use strict";Ds.exports=function(e,r,n){var i,o,a,s,l,u,c,d,f,h=r+1,p,m=e.md.block.ruler.getRules("paragraph");if(e.sCount[r]-e.blkIndent>=4)return!1;for(p=e.parentType,e.parentType="paragraph";h3)){if(e.sCount[h]>=e.blkIndent&&(u=e.bMarks[h]+e.tShift[h],c=e.eMarks[h],u=c)))){d=f===61?1:2;break}if(!(e.sCount[h]<0)){for(o=!1,a=0,s=m.length;a{"use strict";Ns.exports=function(e,r){var n,i,o,a,s,l,u=r+1,c=e.md.block.ruler.getRules("paragraph"),d=e.lineMax;for(l=e.parentType,e.parentType="paragraph";u3)&&!(e.sCount[u]<0)){for(i=!1,o=0,a=c.length;o{"use strict";var Ms=kr(),Ar=N().isSpace;function ye(t,e,r,n){var i,o,a,s,l,u,c,d;for(this.src=t,this.md=e,this.env=r,this.tokens=n,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.listIndent=-1,this.parentType="root",this.level=0,this.result="",o=this.src,d=!1,a=s=u=c=0,l=o.length;s0&&this.level++,this.tokens.push(n),n};ye.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]};ye.prototype.skipEmptyLines=function(e){for(var r=this.lineMax;er;)if(!Ar(this.src.charCodeAt(--e)))return e+1;return e};ye.prototype.skipChars=function(e,r){for(var n=this.src.length;en;)if(r!==this.src.charCodeAt(--e))return e+1;return e};ye.prototype.getLines=function(e,r,n,i){var o,a,s,l,u,c,d,f=e;if(e>=r)return"";for(c=new Array(r-e),o=0;fn?c[o]=new Array(a-n+1).join(" ")+this.src.slice(l,u):c[o]=this.src.slice(l,u)}return c.join("")};ye.prototype.Token=Ms;Rs.exports=ye});var qs=E((ob,Ps)=>{"use strict";var Lf=Er(),Sr=[["table",rs(),["paragraph","reference"]],["code",is()],["fence",as(),["paragraph","reference","blockquote","list"]],["blockquote",us(),["paragraph","reference","blockquote","list"]],["hr",ds(),["paragraph","reference","blockquote","list"]],["list",gs(),["paragraph","reference","blockquote"]],["reference",vs()],["html_block",ks(),["paragraph","reference","blockquote"]],["heading",Ss(),["paragraph","reference","blockquote"]],["lheading",Ts()],["paragraph",Os()]];function Dr(){this.ruler=new Lf;for(var t=0;t=r||t.sCount[s]=u){t.line=r;break}for(i=0;i{"use strict";function Bf(t){switch(t){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}Is.exports=function(e,r){for(var n=e.pos;n{"use strict";var zf=N().isSpace;Bs.exports=function(e,r){var n,i,o=e.pos;if(e.src.charCodeAt(o)!==10)return!1;for(n=e.pending.length-1,i=e.posMax,r||(n>=0&&e.pending.charCodeAt(n)===32?n>=1&&e.pending.charCodeAt(n-1)===32?(e.pending=e.pending.replace(/ +$/,""),e.push("hardbreak","br",0)):(e.pending=e.pending.slice(0,-1),e.push("softbreak","br",0)):e.push("softbreak","br",0)),o++;o{"use strict";var jf=N().isSpace,Gn=[];for(Un=0;Un<256;Un++)Gn.push(0);var Un;"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(t){Gn[t.charCodeAt(0)]=1});js.exports=function(e,r){var n,i=e.pos,o=e.posMax;if(e.src.charCodeAt(i)!==92)return!1;if(i++,i{"use strict";Vs.exports=function(e,r){var n,i,o,a,s,l,u,c,d=e.pos,f=e.src.charCodeAt(d);if(f!==96)return!1;for(n=d,d++,i=e.posMax;d{"use strict";$n.exports.tokenize=function(e,r){var n,i,o,a,s,l=e.pos,u=e.src.charCodeAt(l);if(r||u!==126||(i=e.scanDelims(e.pos,!0),a=i.length,s=String.fromCharCode(u),a<2))return!1;for(a%2&&(o=e.push("text","",0),o.content=s,a--),n=0;n{"use strict";Kn.exports.tokenize=function(e,r){var n,i,o,a=e.pos,s=e.src.charCodeAt(a);if(r||s!==95&&s!==42)return!1;for(i=e.scanDelims(e.pos,s===42),n=0;n=0;r--)n=e[r],!(n.marker!==95&&n.marker!==42)&&n.end!==-1&&(i=e[n.end],s=r>0&&e[r-1].end===n.end+1&&e[r-1].marker===n.marker&&e[r-1].token===n.token-1&&e[n.end+1].token===i.token+1,a=String.fromCharCode(n.marker),o=t.tokens[n.token],o.type=s?"strong_open":"em_open",o.tag=s?"strong":"em",o.nesting=1,o.markup=s?a+a:a,o.content="",o=t.tokens[i.token],o.type=s?"strong_close":"em_close",o.tag=s?"strong":"em",o.nesting=-1,o.markup=s?a+a:a,o.content="",s&&(t.tokens[e[r-1].token].content="",t.tokens[e[n.end+1].token].content="",r--))}Kn.exports.postProcess=function(e){var r,n=e.tokens_meta,i=e.tokens_meta.length;for($s(e,e.delimiters),r=0;r{"use strict";var Hf=N().normalizeReference,Yn=N().isSpace;Js.exports=function(e,r){var n,i,o,a,s,l,u,c,d,f="",h="",p=e.pos,m=e.posMax,v=e.pos,b=!0;if(e.src.charCodeAt(e.pos)!==91||(s=e.pos+1,a=e.md.helpers.parseLinkLabel(e,e.pos,!0),a<0))return!1;if(l=a+1,l=m)return!1;if(v=l,u=e.md.helpers.parseLinkDestination(e.src,l,e.posMax),u.ok){for(f=e.md.normalizeLink(u.str),e.md.validateLink(f)?l=u.pos:f="",v=l;l=m||e.src.charCodeAt(l)!==41)&&(b=!0),l++}if(b){if(typeof e.env.references=="undefined")return!1;if(l=0?o=e.src.slice(v,l++):l=a+1):l=a+1,o||(o=e.src.slice(s,a)),c=e.env.references[Hf(o)],!c)return e.pos=p,!1;f=c.href,h=c.title}return r||(e.pos=s,e.posMax=a,d=e.push("link_open","a",1),d.attrs=n=[["href",f]],h&&n.push(["title",h]),e.md.inline.tokenize(e),d=e.push("link_close","a",-1)),e.pos=l,e.posMax=m,!0}});var Ys=E((hb,Ws)=>{"use strict";var Vf=N().normalizeReference,Zn=N().isSpace;Ws.exports=function(e,r){var n,i,o,a,s,l,u,c,d,f,h,p,m,v="",b=e.pos,g=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91||(l=e.pos+2,s=e.md.helpers.parseLinkLabel(e,e.pos+1,!1),s<0))return!1;if(u=s+1,u=g)return!1;for(m=u,d=e.md.helpers.parseLinkDestination(e.src,u,e.posMax),d.ok&&(v=e.md.normalizeLink(d.str),e.md.validateLink(v)?u=d.pos:v=""),m=u;u=g||e.src.charCodeAt(u)!==41)return e.pos=b,!1;u++}else{if(typeof e.env.references=="undefined")return!1;if(u=0?a=e.src.slice(m,u++):u=s+1):u=s+1,a||(a=e.src.slice(l,s)),c=e.env.references[Vf(a)],!c)return e.pos=b,!1;v=c.href,f=c.title}return r||(o=e.src.slice(l,s),e.md.inline.parse(o,e.md,e.env,p=[]),h=e.push("image","img",0),h.attrs=n=[["src",v],["alt",""]],h.children=p,h.content=o,f&&n.push(["title",f])),e.pos=u,e.posMax=g,!0}});var Xs=E((pb,Zs)=>{"use strict";var Gf=/^([a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,Uf=/^([a-zA-Z][a-zA-Z0-9+.\-]{1,31}):([^<>\x00-\x20]*)$/;Zs.exports=function(e,r){var n,i,o,a,s,l,u=e.pos;if(e.src.charCodeAt(u)!==60)return!1;for(s=e.pos,l=e.posMax;;){if(++u>=l||(a=e.src.charCodeAt(u),a===60))return!1;if(a===62)break}return n=e.src.slice(s+1,u),Uf.test(n)?(i=e.md.normalizeLink(n),e.md.validateLink(i)?(r||(o=e.push("link_open","a",1),o.attrs=[["href",i]],o.markup="autolink",o.info="auto",o=e.push("text","",0),o.content=e.md.normalizeLinkText(n),o=e.push("link_close","a",-1),o.markup="autolink",o.info="auto"),e.pos+=n.length+2,!0):!1):Gf.test(n)?(i=e.md.normalizeLink("mailto:"+n),e.md.validateLink(i)?(r||(o=e.push("link_open","a",1),o.attrs=[["href",i]],o.markup="autolink",o.info="auto",o=e.push("text","",0),o.content=e.md.normalizeLinkText(n),o=e.push("link_close","a",-1),o.markup="autolink",o.info="auto"),e.pos+=n.length+2,!0):!1):!1}});var el=E((mb,Qs)=>{"use strict";var $f=Vn().HTML_TAG_RE;function Jf(t){var e=t|32;return e>=97&&e<=122}Qs.exports=function(e,r){var n,i,o,a,s=e.pos;return!e.md.options.html||(o=e.posMax,e.src.charCodeAt(s)!==60||s+2>=o)||(n=e.src.charCodeAt(s+1),n!==33&&n!==63&&n!==47&&!Jf(n))||(i=e.src.slice(s).match($f),!i)?!1:(r||(a=e.push("html_inline","",0),a.content=e.src.slice(s,s+i[0].length)),e.pos+=i[0].length,!0)}});var il=E((gb,nl)=>{"use strict";var tl=Rn(),Kf=N().has,Wf=N().isValidEntityCode,rl=N().fromCodePoint,Yf=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,Zf=/^&([a-z][a-z0-9]{1,31});/i;nl.exports=function(e,r){var n,i,o,a=e.pos,s=e.posMax;if(e.src.charCodeAt(a)!==38)return!1;if(a+1{"use strict";function ol(t,e){var r,n,i,o,a,s,l,u,c={},d=e.length;if(!!d){var f=0,h=-2,p=[];for(r=0;ra;n-=p[n]+1)if(o=e[n],o.marker===i.marker&&o.open&&o.end<0&&(l=!1,(o.close||i.open)&&(o.length+i.length)%3===0&&(o.length%3!==0||i.length%3!==0)&&(l=!0),!l)){u=n>0&&!e[n-1].open?p[n-1]+1:0,p[r]=r-n+u,p[n]=u,i.open=!1,o.end=r,o.close=!1,s=-1,h=-2;break}s!==-1&&(c[i.marker][(i.open?3:0)+(i.length||0)%3]=s)}}}al.exports=function(e){var r,n=e.tokens_meta,i=e.tokens_meta.length;for(ol(e,e.delimiters),r=0;r{"use strict";ll.exports=function(e){var r,n,i=0,o=e.tokens,a=e.tokens.length;for(r=n=0;r0&&i++,o[r].type==="text"&&r+1{"use strict";var Xn=kr(),cl=N().isWhiteSpace,dl=N().isPunctChar,fl=N().isMdAsciiPunct;function Vt(t,e,r,n){this.src=t,this.env=r,this.md=e,this.tokens=n,this.tokens_meta=Array(n.length),this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache={},this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1}Vt.prototype.pushPending=function(){var t=new Xn("text","",0);return t.content=this.pending,t.level=this.pendingLevel,this.tokens.push(t),this.pending="",t};Vt.prototype.push=function(t,e,r){this.pending&&this.pushPending();var n=new Xn(t,e,r),i=null;return r<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),n.level=this.level,r>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],i={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(n),this.tokens_meta.push(i),n};Vt.prototype.scanDelims=function(t,e){var r=t,n,i,o,a,s,l,u,c,d,f=!0,h=!0,p=this.posMax,m=this.src.charCodeAt(t);for(n=t>0?this.src.charCodeAt(t-1):32;r{"use strict";var ml=Er(),Qn=[["text",Ls()],["newline",zs()],["escape",Hs()],["backticks",Gs()],["strikethrough",Jn().tokenize],["emphasis",Wn().tokenize],["link",Ks()],["image",Ys()],["autolink",Xs()],["html_inline",el()],["entity",il()]],ei=[["balance_pairs",sl()],["strikethrough",Jn().postProcess],["emphasis",Wn().postProcess],["text_collapse",ul()]];function Gt(){var t;for(this.ruler=new ml,t=0;t=o)break;continue}t.pending+=t.src[t.pos++]}t.pending&&t.pushPending()};Gt.prototype.parse=function(t,e,r,n){var i,o,a,s=new this.State(t,e,r,n);for(this.tokenize(s),o=this.ruler2.getRules(""),a=o.length,i=0;i{"use strict";vl.exports=function(t){var e={};e.src_Any=Pn().source,e.src_Cc=qn().source,e.src_Z=In().source,e.src_P=br().source,e.src_ZPCc=[e.src_Z,e.src_P,e.src_Cc].join("|"),e.src_ZCc=[e.src_Z,e.src_Cc].join("|");var r="[><\uFF5C]";return e.src_pseudo_letter="(?:(?!"+r+"|"+e.src_ZPCc+")"+e.src_Any+")",e.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",e.src_auth="(?:(?:(?!"+e.src_ZCc+"|[@/\\[\\]()]).)+@)?",e.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",e.src_host_terminator="(?=$|"+r+"|"+e.src_ZPCc+")(?!-|_|:\\d|\\.-|\\.(?!$|"+e.src_ZPCc+"))",e.src_path="(?:[/?#](?:(?!"+e.src_ZCc+"|"+r+`|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!`+e.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+e.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+e.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+e.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+e.src_ZCc+"|[']).)+\\'|\\'(?="+e.src_pseudo_letter+"|[-]).|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!"+e.src_ZCc+"|[.]).|"+(t&&t["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+",(?!"+e.src_ZCc+").|;(?!"+e.src_ZCc+").|\\!+(?!"+e.src_ZCc+"|[!]).|\\?(?!"+e.src_ZCc+"|[?]).)+|\\/)?",e.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',e.src_xn="xn--[a-z0-9\\-]{1,59}",e.src_domain_root="(?:"+e.src_xn+"|"+e.src_pseudo_letter+"{1,63})",e.src_domain="(?:"+e.src_xn+"|(?:"+e.src_pseudo_letter+")|(?:"+e.src_pseudo_letter+"(?:-|"+e.src_pseudo_letter+"){0,61}"+e.src_pseudo_letter+"))",e.src_host="(?:(?:(?:(?:"+e.src_domain+")\\.)*"+e.src_domain+"))",e.tpl_host_fuzzy="(?:"+e.src_ip4+"|(?:(?:(?:"+e.src_domain+")\\.)+(?:%TLDS%)))",e.tpl_host_no_ip_fuzzy="(?:(?:(?:"+e.src_domain+")\\.)+(?:%TLDS%))",e.src_host_strict=e.src_host+e.src_host_terminator,e.tpl_host_fuzzy_strict=e.tpl_host_fuzzy+e.src_host_terminator,e.src_host_port_strict=e.src_host+e.src_port+e.src_host_terminator,e.tpl_host_port_fuzzy_strict=e.tpl_host_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_port_no_ip_fuzzy_strict=e.tpl_host_no_ip_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+e.src_ZPCc+"|>|$))",e.tpl_email_fuzzy="(^|"+r+'|"|\\(|'+e.src_ZCc+")("+e.src_email_name+"@"+e.tpl_host_fuzzy_strict+")",e.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|\uFF5C]|"+e.src_ZPCc+"))((?![$+<=>^`|\uFF5C])"+e.tpl_host_port_fuzzy_strict+e.src_path+")",e.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|\uFF5C]|"+e.src_ZPCc+"))((?![$+<=>^`|\uFF5C])"+e.tpl_host_port_no_ip_fuzzy_strict+e.src_path+")",e}});var Cl=E((Eb,kl)=>{"use strict";function ti(t){var e=Array.prototype.slice.call(arguments,1);return e.forEach(function(r){!r||Object.keys(r).forEach(function(n){t[n]=r[n]})}),t}function Tr(t){return Object.prototype.toString.call(t)}function Xf(t){return Tr(t)==="[object String]"}function Qf(t){return Tr(t)==="[object Object]"}function eh(t){return Tr(t)==="[object RegExp]"}function _l(t){return Tr(t)==="[object Function]"}function th(t){return t.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}var wl={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function rh(t){return Object.keys(t||{}).reduce(function(e,r){return e||wl.hasOwnProperty(r)},!1)}var nh={"http:":{validate:function(t,e,r){var n=t.slice(e);return r.re.http||(r.re.http=new RegExp("^\\/\\/"+r.re.src_auth+r.re.src_host_port_strict+r.re.src_path,"i")),r.re.http.test(n)?n.match(r.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(t,e,r){var n=t.slice(e);return r.re.no_http||(r.re.no_http=new RegExp("^"+r.re.src_auth+"(?:localhost|(?:(?:"+r.re.src_domain+")\\.)+"+r.re.src_domain_root+")"+r.re.src_port+r.re.src_host_terminator+r.re.src_path,"i")),r.re.no_http.test(n)?e>=3&&t[e-3]===":"||e>=3&&t[e-3]==="/"?0:n.match(r.re.no_http)[0].length:0}},"mailto:":{validate:function(t,e,r){var n=t.slice(e);return r.re.mailto||(r.re.mailto=new RegExp("^"+r.re.src_email_name+"@"+r.re.src_host_strict,"i")),r.re.mailto.test(n)?n.match(r.re.mailto)[0].length:0}}},ih="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",oh="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|\u0440\u0444".split("|");function ah(t){t.__index__=-1,t.__text_cache__=""}function sh(t){return function(e,r){var n=e.slice(r);return t.test(n)?n.match(t)[0].length:0}}function El(){return function(t,e){e.normalize(t)}}function Nr(t){var e=t.re=yl()(t.__opts__),r=t.__tlds__.slice();t.onCompile(),t.__tlds_replaced__||r.push(ih),r.push(e.src_xn),e.src_tlds=r.join("|");function n(s){return s.replace("%TLDS%",e.src_tlds)}e.email_fuzzy=RegExp(n(e.tpl_email_fuzzy),"i"),e.link_fuzzy=RegExp(n(e.tpl_link_fuzzy),"i"),e.link_no_ip_fuzzy=RegExp(n(e.tpl_link_no_ip_fuzzy),"i"),e.host_fuzzy_test=RegExp(n(e.tpl_host_fuzzy_test),"i");var i=[];t.__compiled__={};function o(s,l){throw new Error('(LinkifyIt) Invalid schema "'+s+'": '+l)}Object.keys(t.__schemas__).forEach(function(s){var l=t.__schemas__[s];if(l!==null){var u={validate:null,link:null};if(t.__compiled__[s]=u,Qf(l)){eh(l.validate)?u.validate=sh(l.validate):_l(l.validate)?u.validate=l.validate:o(s,l),_l(l.normalize)?u.normalize=l.normalize:l.normalize?o(s,l):u.normalize=El();return}if(Xf(l)){i.push(s);return}o(s,l)}}),i.forEach(function(s){!t.__compiled__[t.__schemas__[s]]||(t.__compiled__[s].validate=t.__compiled__[t.__schemas__[s]].validate,t.__compiled__[s].normalize=t.__compiled__[t.__schemas__[s]].normalize)}),t.__compiled__[""]={validate:null,normalize:El()};var a=Object.keys(t.__compiled__).filter(function(s){return s.length>0&&t.__compiled__[s]}).map(th).join("|");t.re.schema_test=RegExp("(^|(?!_)(?:[><\uFF5C]|"+e.src_ZPCc+"))("+a+")","i"),t.re.schema_search=RegExp("(^|(?!_)(?:[><\uFF5C]|"+e.src_ZPCc+"))("+a+")","ig"),t.re.pretest=RegExp("("+t.re.schema_test.source+")|("+t.re.host_fuzzy_test.source+")|@","i"),ah(t)}function lh(t,e){var r=t.__index__,n=t.__last_index__,i=t.__text_cache__.slice(r,n);this.schema=t.__schema__.toLowerCase(),this.index=r+e,this.lastIndex=n+e,this.raw=i,this.text=i,this.url=i}function xl(t,e){var r=new lh(t,e);return t.__compiled__[r.schema].normalize(r,t),r}function ce(t,e){if(!(this instanceof ce))return new ce(t,e);e||rh(t)&&(e=t,t={}),this.__opts__=ti({},wl,e),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=ti({},nh,t),this.__compiled__={},this.__tlds__=oh,this.__tlds_replaced__=!1,this.re={},Nr(this)}ce.prototype.add=function(e,r){return this.__schemas__[e]=r,Nr(this),this};ce.prototype.set=function(e){return this.__opts__=ti(this.__opts__,e),this};ce.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;var r,n,i,o,a,s,l,u,c;if(this.re.schema_test.test(e)){for(l=this.re.schema_search,l.lastIndex=0;(r=l.exec(e))!==null;)if(o=this.testSchemaAt(e,r[2],l.lastIndex),o){this.__schema__=r[2],this.__index__=r.index+r[1].length,this.__last_index__=r.index+r[0].length+o;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(u=e.search(this.re.host_fuzzy_test),u>=0&&(this.__index__<0||u=0&&(i=e.match(this.re.email_fuzzy))!==null&&(a=i.index+i[1].length,s=i.index+i[0].length,(this.__index__<0||athis.__last_index__)&&(this.__schema__="mailto:",this.__index__=a,this.__last_index__=s))),this.__index__>=0};ce.prototype.pretest=function(e){return this.re.pretest.test(e)};ce.prototype.testSchemaAt=function(e,r,n){return this.__compiled__[r.toLowerCase()]?this.__compiled__[r.toLowerCase()].validate(e,n,this):0};ce.prototype.match=function(e){var r=0,n=[];this.__index__>=0&&this.__text_cache__===e&&(n.push(xl(this,r)),r=this.__last_index__);for(var i=r?e.slice(r):e;this.test(i);)n.push(xl(this,r)),i=i.slice(this.__last_index__),r+=this.__last_index__;return n.length?n:null};ce.prototype.tlds=function(e,r){return e=Array.isArray(e)?e:[e],r?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(n,i,o){return n!==o[i-1]}).reverse(),Nr(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,Nr(this),this)};ce.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),e.schema==="mailto:"&&!/^mailto:/i.test(e.url)&&(e.url="mailto:"+e.url)};ce.prototype.onCompile=function(){};kl.exports=ce});var ql=E((xb,Pl)=>{"use strict";var Et=2147483647,_e=36,ri=1,Ut=26,uh=38,ch=700,Al=72,Sl=128,Dl="-",dh=/^xn--/,fh=/[^\0-\x7E]/,hh=/[\x2E\u3002\uFF0E\uFF61]/g,ph={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},ni=_e-ri,we=Math.floor,ii=String.fromCharCode;function Qe(t){throw new RangeError(ph[t])}function mh(t,e){let r=[],n=t.length;for(;n--;)r[n]=e(t[n]);return r}function Tl(t,e){let r=t.split("@"),n="";r.length>1&&(n=r[0]+"@",t=r[1]),t=t.replace(hh,".");let i=t.split("."),o=mh(i,e).join(".");return n+o}function Nl(t){let e=[],r=0,n=t.length;for(;r=55296&&i<=56319&&rString.fromCodePoint(...t),bh=function(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:_e},Ol=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},Ml=function(t,e,r){let n=0;for(t=r?we(t/ch):t>>1,t+=we(t/e);t>ni*Ut>>1;n+=_e)t=we(t/ni);return we(n+(ni+1)*t/(t+uh))},Rl=function(t){let e=[],r=t.length,n=0,i=Sl,o=Al,a=t.lastIndexOf(Dl);a<0&&(a=0);for(let s=0;s=128&&Qe("not-basic"),e.push(t.charCodeAt(s));for(let s=a>0?a+1:0;s=r&&Qe("invalid-input");let f=bh(t.charCodeAt(s++));(f>=_e||f>we((Et-n)/c))&&Qe("overflow"),n+=f*c;let h=d<=o?ri:d>=o+Ut?Ut:d-o;if(fwe(Et/p)&&Qe("overflow"),c*=p}let u=e.length+1;o=Ml(n-l,u,l==0),we(n/u)>Et-i&&Qe("overflow"),i+=we(n/u),n%=u,e.splice(n++,0,i)}return String.fromCodePoint(...e)},Fl=function(t){let e=[];t=Nl(t);let r=t.length,n=Sl,i=0,o=Al;for(let l of t)l<128&&e.push(ii(l));let a=e.length,s=a;for(a&&e.push(Dl);s=n&&cwe((Et-i)/u)&&Qe("overflow"),i+=(l-n)*u,n=l;for(let c of t)if(cEt&&Qe("overflow"),c==n){let d=i;for(let f=_e;;f+=_e){let h=f<=o?ri:f>=o+Ut?Ut:f-o;if(d{"use strict";Il.exports={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"\u201C\u201D\u2018\u2019",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}}});var zl=E((Cb,Bl)=>{"use strict";Bl.exports={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"\u201C\u201D\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","text_collapse"]}}}});var Hl=E((Ab,jl)=>{"use strict";jl.exports={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"\u201C\u201D\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","text_collapse"]}}}});var Or=E((Sb,Ul)=>{"use strict";var $t=N(),wh=Aa(),Eh=Da(),xh=Qa(),kh=qs(),Ch=bl(),Ah=Cl(),et=Fn(),Vl=ql(),Sh={default:Ll(),zero:zl(),commonmark:Hl()},Dh=/^(vbscript|javascript|file|data):/,Th=/^data:image\/(gif|png|jpeg|webp);/;function Nh(t){var e=t.trim().toLowerCase();return Dh.test(e)?!!Th.test(e):!0}var Gl=["http:","https:","mailto:"];function Oh(t){var e=et.parse(t,!0);if(e.hostname&&(!e.protocol||Gl.indexOf(e.protocol)>=0))try{e.hostname=Vl.toASCII(e.hostname)}catch{}return et.encode(et.format(e))}function Mh(t){var e=et.parse(t,!0);if(e.hostname&&(!e.protocol||Gl.indexOf(e.protocol)>=0))try{e.hostname=Vl.toUnicode(e.hostname)}catch{}return et.decode(et.format(e),et.decode.defaultChars+"%")}function de(t,e){if(!(this instanceof de))return new de(t,e);e||$t.isString(t)||(e=t||{},t="default"),this.inline=new Ch,this.block=new kh,this.core=new xh,this.renderer=new Eh,this.linkify=new Ah,this.validateLink=Nh,this.normalizeLink=Oh,this.normalizeLinkText=Mh,this.utils=$t,this.helpers=$t.assign({},wh),this.options={},this.configure(t),e&&this.set(e)}de.prototype.set=function(t){return $t.assign(this.options,t),this};de.prototype.configure=function(t){var e=this,r;if($t.isString(t)&&(r=t,t=Sh[r],!t))throw new Error('Wrong `markdown-it` preset "'+r+'", check name');if(!t)throw new Error("Wrong `markdown-it` preset, can't be empty");return t.options&&e.set(t.options),t.components&&Object.keys(t.components).forEach(function(n){t.components[n].rules&&e[n].ruler.enableOnly(t.components[n].rules),t.components[n].rules2&&e[n].ruler2.enableOnly(t.components[n].rules2)}),this};de.prototype.enable=function(t,e){var r=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(i){r=r.concat(this[i].ruler.enable(t,!0))},this),r=r.concat(this.inline.ruler2.enable(t,!0));var n=t.filter(function(i){return r.indexOf(i)<0});if(n.length&&!e)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+n);return this};de.prototype.disable=function(t,e){var r=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(i){r=r.concat(this[i].ruler.disable(t,!0))},this),r=r.concat(this.inline.ruler2.disable(t,!0));var n=t.filter(function(i){return r.indexOf(i)<0});if(n.length&&!e)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+n);return this};de.prototype.use=function(t){var e=[this].concat(Array.prototype.slice.call(arguments,1));return t.apply(t,e),this};de.prototype.parse=function(t,e){if(typeof t!="string")throw new Error("Input data should be a String");var r=new this.core.State(t,this,e);return this.core.process(r),r.tokens};de.prototype.render=function(t,e){return e=e||{},this.renderer.render(this.parse(t,e),this.options,e)};de.prototype.parseInline=function(t,e){var r=new this.core.State(t,this,e);return r.inlineMode=!0,this.core.process(r),r.tokens};de.prototype.renderInline=function(t,e){return e=e||{},this.renderer.render(this.parseInline(t,e),this.options,e)};Ul.exports=de});var Jl=E((Db,$l)=>{"use strict";$l.exports=Or()});var j=function(t){return t==null?!0:Array.isArray(t)||Rt(t)?t.length===0:Object.keys(t).length===0},Rt=function(t){return toString.call(t)==="[object String]"},Ft=function(t){let e=typeof t;return(e==="function"||e==="object")&&!!t},rn=function(t){return t===void 0},Pe=function(t){return j(t)?t:t.charAt(0).toUpperCase()+t.slice(1)},Q=function(){let t={};for(let e in this){let r=this[e];if(r instanceof Map){if(r.size===0)continue;t[e]=Object.fromEntries(r.entries());continue}j(r)||(t[e]=r)}return t};var Pt=class{constructor({table:e="",hide_table:r=!1,hide_result:n=!1,hide_desc:i=!1}){this.table=e,this.hide_table=r===!0||r==="1"||r===1,this.hide_result=n===!0||n==="1"||n===1,this.hide_desc=i===!0||i==="1"||i===1}toJSON(){let e={table:this.table};return this.hide_table&&(e.hide_table=!0),this.hide_result&&(e.hide_result=!0),this.hide_desc&&(e.hide_desc=!0),e}};var qe=class{constructor({label:e="",print:r=!0,description:n="",subtable:i=[],weight:o=1}){this.label=e,this.print=!(r===!1||r==="0"||r===0),this.description=n,this.weight=parseInt(o,10),this.weight<=0&&(this.weight=1),Rt(i)?this.subtable=[i]:Array.isArray(i)&&(this.subtable=i.map(a=>a.toString()))}toJSON(){return Q.call(this)}};var lc=function(t){let e=0;for(let r=0;r=n));i++);return t[i]},Ie=function(t){let e=[],r=[];return!Array.isArray(t)||t.length===0?null:(t.forEach(n=>{r.push(1),e.push(n)}),on(e,r))};var Se=class{constructor({id:e=0,key:r=null,title:n="",author:i="",description:o="",source:a="",tags:s=[],sequence:l=[],tables:u={},macro:c=[],dependencies:d=null,table:f=null,display_opt:h=[]}){this.id=e,this.key=r||this.id,this.title=n,this.author=i,this.description=o,this.source=a,this.tags=s,this.sequence=l,this.macro=c,this.dependencies=d,this._normalizeTables(u,f),this.display_opt=new Map,h.forEach(p=>{let m=p.table||"";if(m){if(p instanceof Pt){this.display_opt.set(m,p);return}let v=new Pt(p);this.display_opt.set(m,v)}})}toString(){return this.title}_normalizeTable(e){let r=[];return e.forEach(n=>{if(!j(n)){if(Rt(n)){r.push(new qe({label:n}));return}if(n instanceof qe){r.push(n);return}Ft(n)&&r.push(new qe(n))}}),r}_normalizeTables(e,r){j(e)&&j(r)||(this.tables={},!j(r)&&Array.isArray(r)&&(this.tables.default=this._normalizeTable(r)),Ft(e)&&Object.keys(e).forEach(i=>{let o=e[i];!Array.isArray(o)||(this.tables[i]=this._normalizeTable(o))}))}validate(e){let r={fields:[],general:""};return e.title===""&&(r.fields.push({field:"title",message:"Title cannot be blank"}),r.general+="Title cannot be blank. "),j(e.tables)&&j(e.macro)&&(r.fields.push({field:"tables",message:"Both Tables and Macro cannot be empty"}),r.general+="Both Tables and Macro cannot be empty. "),!j(r.fields)||!j(r.general)?r:!0}getSequence(e=""){return e!==""?[e]:this.sequence.length===0?this.tables.default?["default"]:[this.subtableNames[0]]:this.sequence[0]==="rollall"?this.subtableNames:this.sequence}get subtableNames(){return Object.keys(this.tables)}getSubtableEntries(e="default"){return this.tables[e]||[]}getRandomEntry(e){let r=this.getSubtableEntries(e);if(r.length===0)return null;let n=[],i=[];return r.forEach((o,a,s)=>{i.push(o.weight),n.push(o)}),on(n,i)}findEntry(e,r="default"){let n=this.tables[r];if(!n)return null;let i=n.find(o=>o.label===e);return i||null}findDependencies(){if(this.dependencies!==null)return this.dependencies;let e=[];this.macro.forEach(i=>{let o=i.split(":");o.length>0&&o[0]!=="this"&&e.push(o[0])});let r=/({{2}.+?}{2})/g;return Object.keys(this.tables).forEach(i=>{this.tables[i].forEach(a=>{let s=a.label.match(r);s!==null&&s.forEach(l=>{let u=l.replace("{{","").replace("}}","").split(":");u.length>1&&u[0]==="table"&&u[1]!=="this"&&e.push(u[1])})})}),e=e.reduce((i,o)=>(i.indexOf(o)<0&&i.push(o),i),[]),this.dependencies=e,e}toJSON(){return Q.call(this)}};var De=class{constructor({table:e="",result:r="",desc:n=""}){this.table=e,this.result=r,this.desc=n}get isDefault(){return this.table==="default"}get isError(){return!1}toString(){return this.result}toJSON(){return Q.call(this)}};var ot=class{constructor({title:e="",results:r=[],displayOptions:n=new Map}){this.title=e,this.results=[],r.forEach(i=>{this.addResult(i)}),n instanceof Map?this.displayOptions=n:this.displayOptions=new Map}addResult(e){if(e instanceof De){this.results.push(e);return}this.results.push(new De(e))}get isSimple(){return this.results.length===1}findResultByTable(e="default"){let r=this.results.find(n=>n.table===e);return r||null}niceString(e=!1){if(this.results.length===0)return"";if(e)return this.results.map(n=>n.toString()).join(" ");let r="";return this.results.forEach(n=>{if(n.isError){r+=`Error: ${n.result} -`;return}let i=this.displayOptions.get(n.table);if(i){i.hide_table||(r+=`${Pe(n.table)}: `),i.hide_result||(r+=`${Pe(n.result)} +`:">",o)};At.prototype.renderInline=function(t,e,r){for(var n,i="",o=this.rules,a=0,s=t.length;a{"use strict";function me(){this.__rules__=[],this.__cache__=null}me.prototype.__find__=function(t){for(var e=0;e{"use strict";var sf=/\r\n?|\n/g,lf=/\0/g;Ba.exports=function(e){var r;r=e.src.replace(sf,` +`),r=r.replace(lf,"\uFFFD"),e.src=r}});var Ha=E((Kg,ja)=>{"use strict";ja.exports=function(e){var r;e.inlineMode?(r=new e.Token("inline","",0),r.content=e.src,r.map=[0,1],r.children=[],e.tokens.push(r)):e.md.block.parse(e.src,e.md,e.env,e.tokens)}});var Ga=E((Wg,Va)=>{"use strict";Va.exports=function(e){var r=e.tokens,n,i,o;for(i=0,o=r.length;i{"use strict";var uf=O().arrayReplaceAt;function cf(t){return/^\s]/i.test(t)}function df(t){return/^<\/a\s*>/i.test(t)}Ua.exports=function(e){var r,n,i,o,a,s,l,u,c,d,f,h,p,m,v,b,g=e.tokens,w;if(!!e.md.options.linkify){for(n=0,i=g.length;n=0;r--){if(s=o[r],s.type==="link_close"){for(r--;o[r].level!==s.level&&o[r].type!=="link_open";)r--;continue}if(s.type==="html_inline"&&(cf(s.content)&&p>0&&p--,df(s.content)&&p++),!(p>0)&&s.type==="text"&&e.md.linkify.test(s.content)){for(c=s.content,w=e.md.linkify.match(c),l=[],h=s.level,f=0,u=0;uf&&(a=new e.Token("text","",0),a.content=c.slice(f,d),a.level=h,l.push(a)),a=new e.Token("link_open","a",1),a.attrs=[["href",v]],a.level=h++,a.markup="linkify",a.info="auto",l.push(a),a=new e.Token("text","",0),a.content=b,a.level=h,l.push(a),a=new e.Token("link_close","a",-1),a.level=--h,a.markup="linkify",a.info="auto",l.push(a),f=w[u].lastIndex);f{"use strict";var Ja=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,ff=/\((c|tm|r|p)\)/i,hf=/\((c|tm|r|p)\)/ig,pf={c:"\xA9",r:"\xAE",p:"\xA7",tm:"\u2122"};function mf(t,e){return pf[e.toLowerCase()]}function gf(t){var e,r,n=0;for(e=t.length-1;e>=0;e--)r=t[e],r.type==="text"&&!n&&(r.content=r.content.replace(hf,mf)),r.type==="link_open"&&r.info==="auto"&&n--,r.type==="link_close"&&r.info==="auto"&&n++}function bf(t){var e,r,n=0;for(e=t.length-1;e>=0;e--)r=t[e],r.type==="text"&&!n&&Ja.test(r.content)&&(r.content=r.content.replace(/\+-/g,"\xB1").replace(/\.{2,}/g,"\u2026").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/mg,"$1\u2014").replace(/(^|\s)--(?=\s|$)/mg,"$1\u2013").replace(/(^|[^-\s])--(?=[^-\s]|$)/mg,"$1\u2013")),r.type==="link_open"&&r.info==="auto"&&n--,r.type==="link_close"&&r.info==="auto"&&n++}Ka.exports=function(e){var r;if(!!e.md.options.typographer)for(r=e.tokens.length-1;r>=0;r--)e.tokens[r].type==="inline"&&(ff.test(e.tokens[r].content)&&gf(e.tokens[r].children),Ja.test(e.tokens[r].content)&&bf(e.tokens[r].children))}});var rs=E((Xg,ts)=>{"use strict";var Ya=O().isWhiteSpace,Za=O().isPunctChar,Xa=O().isMdAsciiPunct,vf=/['"]/,Qa=/['"]/g,es="\u2019";function Dr(t,e,r){return t.substr(0,e)+r+t.substr(e+1)}function yf(t,e){var r,n,i,o,a,s,l,u,c,d,f,h,p,m,v,b,g,w,x,C,y;for(x=[],r=0;r=0&&!(x[g].level<=l);g--);if(x.length=g+1,n.type!=="text")continue;i=n.content,a=0,s=i.length;e:for(;a=0)c=i.charCodeAt(o.index-1);else for(g=r-1;g>=0&&!(t[g].type==="softbreak"||t[g].type==="hardbreak");g--)if(!!t[g].content){c=t[g].content.charCodeAt(t[g].content.length-1);break}if(d=32,a=48&&c<=57&&(b=v=!1),v&&b&&(v=f,b=h),!v&&!b){w&&(n.content=Dr(n.content,o.index,es));continue}if(b){for(g=x.length-1;g>=0&&(u=x[g],!(x[g].level=0;r--)e.tokens[r].type!=="inline"||!vf.test(e.tokens[r].content)||yf(e.tokens[r].children,e)}});var Tr=E((Qg,ns)=>{"use strict";function Dt(t,e,r){this.type=t,this.tag=e,this.attrs=null,this.map=null,this.nesting=r,this.level=0,this.children=null,this.content="",this.markup="",this.info="",this.meta=null,this.block=!1,this.hidden=!1}Dt.prototype.attrIndex=function(e){var r,n,i;if(!this.attrs)return-1;for(r=this.attrs,n=0,i=r.length;n=0&&(n=this.attrs[r][1]),n};Dt.prototype.attrJoin=function(e,r){var n=this.attrIndex(e);n<0?this.attrPush([e,r]):this.attrs[n][1]=this.attrs[n][1]+" "+r};ns.exports=Dt});var as=E((eb,os)=>{"use strict";var _f=Tr();function is(t,e,r){this.src=t,this.env=r,this.tokens=[],this.inlineMode=!1,this.md=e}is.prototype.Token=_f;os.exports=is});var ls=E((tb,ss)=>{"use strict";var wf=Ar(),jn=[["normalize",za()],["block",Ha()],["inline",Ga()],["linkify",$a()],["replacements",Wa()],["smartquotes",rs()]];function Hn(){this.ruler=new wf;for(var t=0;t{"use strict";var Vn=O().isSpace;function Gn(t,e){var r=t.bMarks[e]+t.tShift[e],n=t.eMarks[e];return t.src.substr(r,n-r)}function us(t){var e=[],r=0,n=t.length,i,o=!1,a=0,s="";for(i=t.charCodeAt(r);rn||(c=r+1,e.sCount[c]=4||(s=e.bMarks[c]+e.tShift[c],s>=e.eMarks[c])||(C=e.src.charCodeAt(s++),C!==124&&C!==45&&C!==58)||s>=e.eMarks[c]||(y=e.src.charCodeAt(s++),y!==124&&y!==45&&y!==58&&!Vn(y))||C===45&&Vn(y))return!1;for(;s=4||(d=us(a),d.length&&d[0]===""&&d.shift(),d.length&&d[d.length-1]===""&&d.pop(),f=d.length,f===0||f!==p.length))return!1;if(i)return!0;for(g=e.parentType,e.parentType="table",x=e.md.block.ruler.getRules("blockquote"),h=e.push("table_open","table",1),h.map=v=[r,0],h=e.push("thead_open","thead",1),h.map=[r,r+1],h=e.push("tr_open","tr",1),h.map=[r,r+1],l=0;l=4)break;for(d=us(a),d.length&&d[0]===""&&d.shift(),d.length&&d[d.length-1]===""&&d.pop(),c===r+2&&(h=e.push("tbody_open","tbody",1),h.map=b=[r+2,0]),h=e.push("tr_open","tr",1),h.map=[c,c+1],l=0;l{"use strict";fs.exports=function(e,r,n){var i,o,a;if(e.sCount[r]-e.blkIndent<4)return!1;for(o=i=r+1;i=4){i++,o=i;continue}break}return e.line=o,a=e.push("code_block","code",0),a.content=e.getLines(r,o,4+e.blkIndent,!1)+` +`,a.map=[r,e.line],!0}});var ms=E((ib,ps)=>{"use strict";ps.exports=function(e,r,n,i){var o,a,s,l,u,c,d,f=!1,h=e.bMarks[r]+e.tShift[r],p=e.eMarks[r];if(e.sCount[r]-e.blkIndent>=4||h+3>p||(o=e.src.charCodeAt(h),o!==126&&o!==96)||(u=h,h=e.skipChars(h,o),a=h-u,a<3)||(d=e.src.slice(u,h),s=e.src.slice(h,p),o===96&&s.indexOf(String.fromCharCode(o))>=0))return!1;if(i)return!0;for(l=r;l++,!(l>=n||(h=u=e.bMarks[l]+e.tShift[l],p=e.eMarks[l],h=4)&&(h=e.skipChars(h,o),!(h-u{"use strict";var gs=O().isSpace;bs.exports=function(e,r,n,i){var o,a,s,l,u,c,d,f,h,p,m,v,b,g,w,x,C,y,D,F,U=e.lineMax,T=e.bMarks[r]+e.tShift[r],N=e.eMarks[r];if(e.sCount[r]-e.blkIndent>=4||e.src.charCodeAt(T++)!==62)return!1;if(i)return!0;for(l=h=e.sCount[r]+1,e.src.charCodeAt(T)===32?(T++,l++,h++,o=!1,x=!0):e.src.charCodeAt(T)===9?(x=!0,(e.bsCount[r]+h)%4===3?(T++,l++,h++,o=!1):o=!0):x=!1,p=[e.bMarks[r]],e.bMarks[r]=T;T=N,g=[e.sCount[r]],e.sCount[r]=h-l,w=[e.tShift[r]],e.tShift[r]=T-e.bMarks[r],y=e.md.block.ruler.getRules("blockquote"),b=e.parentType,e.parentType="blockquote",f=r+1;f=N));f++){if(e.src.charCodeAt(T++)===62&&!F){for(l=h=e.sCount[f]+1,e.src.charCodeAt(T)===32?(T++,l++,h++,o=!1,x=!0):e.src.charCodeAt(T)===9?(x=!0,(e.bsCount[f]+h)%4===3?(T++,l++,h++,o=!1):o=!0):x=!1,p.push(e.bMarks[f]),e.bMarks[f]=T;T=N,m.push(e.bsCount[f]),e.bsCount[f]=e.sCount[f]+1+(x?1:0),g.push(e.sCount[f]),e.sCount[f]=h-l,w.push(e.tShift[f]),e.tShift[f]=T-e.bMarks[f];continue}if(c)break;for(C=!1,s=0,u=y.length;s",D.map=d=[r,0],e.md.block.tokenize(e,r,f),D=e.push("blockquote_close","blockquote",-1),D.markup=">",e.lineMax=U,e.parentType=b,d[1]=e.line,s=0;s{"use strict";var Ef=O().isSpace;ys.exports=function(e,r,n,i){var o,a,s,l,u=e.bMarks[r]+e.tShift[r],c=e.eMarks[r];if(e.sCount[r]-e.blkIndent>=4||(o=e.src.charCodeAt(u++),o!==42&&o!==45&&o!==95))return!1;for(a=1;u{"use strict";var ws=O().isSpace;function Es(t,e){var r,n,i,o;return n=t.bMarks[e]+t.tShift[e],i=t.eMarks[e],r=t.src.charCodeAt(n++),r!==42&&r!==45&&r!==43||n=o||(r=t.src.charCodeAt(i++),r<48||r>57))return-1;for(;;){if(i>=o)return-1;if(r=t.src.charCodeAt(i++),r>=48&&r<=57){if(i-n>=10)return-1;continue}if(r===41||r===46)break;return-1}return i=4||e.listIndent>=0&&e.sCount[r]-e.listIndent>=4&&e.sCount[r]=e.blkIndent&&(Pe=!0),(N=xs(e,r))>=0){if(d=!0,X=e.bMarks[r]+e.tShift[r],b=Number(e.src.slice(X,N-1)),Pe&&b!==1)return!1}else if((N=Es(e,r))>=0)d=!1;else return!1;if(Pe&&e.skipSpaces(N)>=e.eMarks[r])return!1;if(v=e.src.charCodeAt(N-1),i)return!0;for(m=e.tokens.length,d?(L=e.push("ordered_list_open","ol",1),b!==1&&(L.attrs=[["start",b]])):L=e.push("bullet_list_open","ul",1),L.map=p=[r,0],L.markup=String.fromCharCode(v),w=r,Ce=!1,Ae=e.md.block.ruler.getRules("list"),y=e.parentType,e.parentType="list";w=g?u=1:u=x-c,u>4&&(u=1),l=c+u,L=e.push("list_item_open","li",1),L.markup=String.fromCharCode(v),L.map=f=[r,0],d&&(L.info=e.src.slice(X,N-1)),U=e.tight,F=e.tShift[r],D=e.sCount[r],C=e.listIndent,e.listIndent=e.blkIndent,e.blkIndent=l,e.tight=!0,e.tShift[r]=a-e.bMarks[r],e.sCount[r]=x,a>=g&&e.isEmpty(r+1)?e.line=Math.min(e.line+2,n):e.md.block.tokenize(e,r,n,!0),(!e.tight||Ce)&&(qe=!1),Ce=e.line-r>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=C,e.tShift[r]=F,e.sCount[r]=D,e.tight=U,L=e.push("list_item_close","li",-1),L.markup=String.fromCharCode(v),w=r=e.line,f[1]=w,a=e.bMarks[r],w>=n||e.sCount[w]=4)break;for(pe=!1,s=0,h=Ae.length;s{"use strict";var kf=O().normalizeReference,Or=O().isSpace;Cs.exports=function(e,r,n,i){var o,a,s,l,u,c,d,f,h,p,m,v,b,g,w,x,C=0,y=e.bMarks[r]+e.tShift[r],D=e.eMarks[r],F=r+1;if(e.sCount[r]-e.blkIndent>=4||e.src.charCodeAt(y)!==91)return!1;for(;++y3)&&!(e.sCount[F]<0)){for(g=!1,c=0,d=w.length;c{"use strict";Ds.exports=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","section","source","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"]});var $n=E((cb,Un)=>{"use strict";var Sf="[a-zA-Z_:][a-zA-Z0-9:._-]*",Cf="[^\"'=<>`\\x00-\\x20]+",Af="'[^']*'",Df='"[^"]*"',Tf="(?:"+Cf+"|"+Af+"|"+Df+")",Of="(?:\\s+"+Sf+"(?:\\s*=\\s*"+Tf+")?)",Os="<[A-Za-z][A-Za-z0-9\\-]*"+Of+"*\\s*\\/?>",Ns="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",Nf="|",Rf="<[?][\\s\\S]*?[?]>",Mf="]*>",Ff="",Pf=new RegExp("^(?:"+Os+"|"+Ns+"|"+Nf+"|"+Rf+"|"+Mf+"|"+Ff+")"),qf=new RegExp("^(?:"+Os+"|"+Ns+")");Un.exports.HTML_TAG_RE=Pf;Un.exports.HTML_OPEN_CLOSE_TAG_RE=qf});var Ms=E((db,Rs)=>{"use strict";var If=Ts(),Lf=$n().HTML_OPEN_CLOSE_TAG_RE,Tt=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^/,!0],[/^<\?/,/\?>/,!0],[/^/,!0],[/^/,!0],[new RegExp("^|$))","i"),/^$/,!0],[new RegExp(Lf.source+"\\s*$"),/^$/,!1]];Rs.exports=function(e,r,n,i){var o,a,s,l,u=e.bMarks[r]+e.tShift[r],c=e.eMarks[r];if(e.sCount[r]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(u)!==60)return!1;for(l=e.src.slice(u,c),o=0;o{"use strict";var Fs=O().isSpace;Ps.exports=function(e,r,n,i){var o,a,s,l,u=e.bMarks[r]+e.tShift[r],c=e.eMarks[r];if(e.sCount[r]-e.blkIndent>=4||(o=e.src.charCodeAt(u),o!==35||u>=c))return!1;for(a=1,o=e.src.charCodeAt(++u);o===35&&u6||uu&&Fs(e.src.charCodeAt(s-1))&&(c=s),e.line=r+1,l=e.push("heading_open","h"+String(a),1),l.markup="########".slice(0,a),l.map=[r,e.line],l=e.push("inline","",0),l.content=e.src.slice(u,c).trim(),l.map=[r,e.line],l.children=[],l=e.push("heading_close","h"+String(a),-1),l.markup="########".slice(0,a)),!0)}});var Ls=E((hb,Is)=>{"use strict";Is.exports=function(e,r,n){var i,o,a,s,l,u,c,d,f,h=r+1,p,m=e.md.block.ruler.getRules("paragraph");if(e.sCount[r]-e.blkIndent>=4)return!1;for(p=e.parentType,e.parentType="paragraph";h3)){if(e.sCount[h]>=e.blkIndent&&(u=e.bMarks[h]+e.tShift[h],c=e.eMarks[h],u=c)))){d=f===61?1:2;break}if(!(e.sCount[h]<0)){for(o=!1,a=0,s=m.length;a{"use strict";Bs.exports=function(e,r){var n,i,o,a,s,l,u=r+1,c=e.md.block.ruler.getRules("paragraph"),d=e.lineMax;for(l=e.parentType,e.parentType="paragraph";u3)&&!(e.sCount[u]<0)){for(i=!1,o=0,a=c.length;o{"use strict";var js=Tr(),Nr=O().isSpace;function _e(t,e,r,n){var i,o,a,s,l,u,c,d;for(this.src=t,this.md=e,this.env=r,this.tokens=n,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.listIndent=-1,this.parentType="root",this.level=0,this.result="",o=this.src,d=!1,a=s=u=c=0,l=o.length;s0&&this.level++,this.tokens.push(n),n};_e.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]};_e.prototype.skipEmptyLines=function(e){for(var r=this.lineMax;er;)if(!Nr(this.src.charCodeAt(--e)))return e+1;return e};_e.prototype.skipChars=function(e,r){for(var n=this.src.length;en;)if(r!==this.src.charCodeAt(--e))return e+1;return e};_e.prototype.getLines=function(e,r,n,i){var o,a,s,l,u,c,d,f=e;if(e>=r)return"";for(c=new Array(r-e),o=0;fn?c[o]=new Array(a-n+1).join(" ")+this.src.slice(l,u):c[o]=this.src.slice(l,u)}return c.join("")};_e.prototype.Token=js;Hs.exports=_e});var Us=E((gb,Gs)=>{"use strict";var Bf=Ar(),Rr=[["table",ds(),["paragraph","reference"]],["code",hs()],["fence",ms(),["paragraph","reference","blockquote","list"]],["blockquote",vs(),["paragraph","reference","blockquote","list"]],["hr",_s(),["paragraph","reference","blockquote","list"]],["list",Ss(),["paragraph","reference","blockquote"]],["reference",As()],["html_block",Ms(),["paragraph","reference","blockquote"]],["heading",qs(),["paragraph","reference","blockquote"]],["lheading",Ls()],["paragraph",zs()]];function Mr(){this.ruler=new Bf;for(var t=0;t=r||t.sCount[s]=u){t.line=r;break}for(i=0;i{"use strict";function zf(t){switch(t){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}$s.exports=function(e,r){for(var n=e.pos;n{"use strict";var jf=O().isSpace;Ks.exports=function(e,r){var n,i,o,a=e.pos;if(e.src.charCodeAt(a)!==10)return!1;if(n=e.pending.length-1,i=e.posMax,!r)if(n>=0&&e.pending.charCodeAt(n)===32)if(n>=1&&e.pending.charCodeAt(n-1)===32){for(o=n-1;o>=1&&e.pending.charCodeAt(o-1)===32;)o--;e.pending=e.pending.slice(0,o),e.push("hardbreak","br",0)}else e.pending=e.pending.slice(0,-1),e.push("softbreak","br",0);else e.push("softbreak","br",0);for(a++;a{"use strict";var Hf=O().isSpace,Jn=[];for(Kn=0;Kn<256;Kn++)Jn.push(0);var Kn;"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(t){Jn[t.charCodeAt(0)]=1});Ys.exports=function(e,r){var n,i=e.pos,o=e.posMax;if(e.src.charCodeAt(i)!==92)return!1;if(i++,i{"use strict";Xs.exports=function(e,r){var n,i,o,a,s,l,u,c,d=e.pos,f=e.src.charCodeAt(d);if(f!==96)return!1;for(n=d,d++,i=e.posMax;d{"use strict";Wn.exports.tokenize=function(e,r){var n,i,o,a,s,l=e.pos,u=e.src.charCodeAt(l);if(r||u!==126||(i=e.scanDelims(e.pos,!0),a=i.length,s=String.fromCharCode(u),a<2))return!1;for(a%2&&(o=e.push("text","",0),o.content=s,a--),n=0;n{"use strict";Zn.exports.tokenize=function(e,r){var n,i,o,a=e.pos,s=e.src.charCodeAt(a);if(r||s!==95&&s!==42)return!1;for(i=e.scanDelims(e.pos,s===42),n=0;n=0;r--)n=e[r],!(n.marker!==95&&n.marker!==42)&&n.end!==-1&&(i=e[n.end],s=r>0&&e[r-1].end===n.end+1&&e[r-1].marker===n.marker&&e[r-1].token===n.token-1&&e[n.end+1].token===i.token+1,a=String.fromCharCode(n.marker),o=t.tokens[n.token],o.type=s?"strong_open":"em_open",o.tag=s?"strong":"em",o.nesting=1,o.markup=s?a+a:a,o.content="",o=t.tokens[i.token],o.type=s?"strong_close":"em_close",o.tag=s?"strong":"em",o.nesting=-1,o.markup=s?a+a:a,o.content="",s&&(t.tokens[e[r-1].token].content="",t.tokens[e[n.end+1].token].content="",r--))}Zn.exports.postProcess=function(e){var r,n=e.tokens_meta,i=e.tokens_meta.length;for(tl(e,e.delimiters),r=0;r{"use strict";var Vf=O().normalizeReference,Qn=O().isSpace;rl.exports=function(e,r){var n,i,o,a,s,l,u,c,d,f="",h="",p=e.pos,m=e.posMax,v=e.pos,b=!0;if(e.src.charCodeAt(e.pos)!==91||(s=e.pos+1,a=e.md.helpers.parseLinkLabel(e,e.pos,!0),a<0))return!1;if(l=a+1,l=m)return!1;if(v=l,u=e.md.helpers.parseLinkDestination(e.src,l,e.posMax),u.ok){for(f=e.md.normalizeLink(u.str),e.md.validateLink(f)?l=u.pos:f="",v=l;l=m||e.src.charCodeAt(l)!==41)&&(b=!0),l++}if(b){if(typeof e.env.references=="undefined")return!1;if(l=0?o=e.src.slice(v,l++):l=a+1):l=a+1,o||(o=e.src.slice(s,a)),c=e.env.references[Vf(o)],!c)return e.pos=p,!1;f=c.href,h=c.title}return r||(e.pos=s,e.posMax=a,d=e.push("link_open","a",1),d.attrs=n=[["href",f]],h&&n.push(["title",h]),e.md.inline.tokenize(e),d=e.push("link_close","a",-1)),e.pos=l,e.posMax=m,!0}});var ol=E((kb,il)=>{"use strict";var Gf=O().normalizeReference,ei=O().isSpace;il.exports=function(e,r){var n,i,o,a,s,l,u,c,d,f,h,p,m,v="",b=e.pos,g=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91||(l=e.pos+2,s=e.md.helpers.parseLinkLabel(e,e.pos+1,!1),s<0))return!1;if(u=s+1,u=g)return!1;for(m=u,d=e.md.helpers.parseLinkDestination(e.src,u,e.posMax),d.ok&&(v=e.md.normalizeLink(d.str),e.md.validateLink(v)?u=d.pos:v=""),m=u;u=g||e.src.charCodeAt(u)!==41)return e.pos=b,!1;u++}else{if(typeof e.env.references=="undefined")return!1;if(u=0?a=e.src.slice(m,u++):u=s+1):u=s+1,a||(a=e.src.slice(l,s)),c=e.env.references[Gf(a)],!c)return e.pos=b,!1;v=c.href,f=c.title}return r||(o=e.src.slice(l,s),e.md.inline.parse(o,e.md,e.env,p=[]),h=e.push("image","img",0),h.attrs=n=[["src",v],["alt",""]],h.children=p,h.content=o,f&&n.push(["title",f])),e.pos=u,e.posMax=g,!0}});var sl=E((Sb,al)=>{"use strict";var Uf=/^([a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,$f=/^([a-zA-Z][a-zA-Z0-9+.\-]{1,31}):([^<>\x00-\x20]*)$/;al.exports=function(e,r){var n,i,o,a,s,l,u=e.pos;if(e.src.charCodeAt(u)!==60)return!1;for(s=e.pos,l=e.posMax;;){if(++u>=l||(a=e.src.charCodeAt(u),a===60))return!1;if(a===62)break}return n=e.src.slice(s+1,u),$f.test(n)?(i=e.md.normalizeLink(n),e.md.validateLink(i)?(r||(o=e.push("link_open","a",1),o.attrs=[["href",i]],o.markup="autolink",o.info="auto",o=e.push("text","",0),o.content=e.md.normalizeLinkText(n),o=e.push("link_close","a",-1),o.markup="autolink",o.info="auto"),e.pos+=n.length+2,!0):!1):Uf.test(n)?(i=e.md.normalizeLink("mailto:"+n),e.md.validateLink(i)?(r||(o=e.push("link_open","a",1),o.attrs=[["href",i]],o.markup="autolink",o.info="auto",o=e.push("text","",0),o.content=e.md.normalizeLinkText(n),o=e.push("link_close","a",-1),o.markup="autolink",o.info="auto"),e.pos+=n.length+2,!0):!1):!1}});var ul=E((Cb,ll)=>{"use strict";var Jf=$n().HTML_TAG_RE;function Kf(t){var e=t|32;return e>=97&&e<=122}ll.exports=function(e,r){var n,i,o,a,s=e.pos;return!e.md.options.html||(o=e.posMax,e.src.charCodeAt(s)!==60||s+2>=o)||(n=e.src.charCodeAt(s+1),n!==33&&n!==63&&n!==47&&!Kf(n))||(i=e.src.slice(s).match(Jf),!i)?!1:(r||(a=e.push("html_inline","",0),a.content=e.src.slice(s,s+i[0].length)),e.pos+=i[0].length,!0)}});var hl=E((Ab,fl)=>{"use strict";var cl=qn(),Wf=O().has,Yf=O().isValidEntityCode,dl=O().fromCodePoint,Zf=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,Xf=/^&([a-z][a-z0-9]{1,31});/i;fl.exports=function(e,r){var n,i,o,a=e.pos,s=e.posMax;if(e.src.charCodeAt(a)!==38)return!1;if(a+1{"use strict";function pl(t,e){var r,n,i,o,a,s,l,u,c={},d=e.length;if(!!d){var f=0,h=-2,p=[];for(r=0;ra;n-=p[n]+1)if(o=e[n],o.marker===i.marker&&o.open&&o.end<0&&(l=!1,(o.close||i.open)&&(o.length+i.length)%3===0&&(o.length%3!==0||i.length%3!==0)&&(l=!0),!l)){u=n>0&&!e[n-1].open?p[n-1]+1:0,p[r]=r-n+u,p[n]=u,i.open=!1,o.end=r,o.close=!1,s=-1,h=-2;break}s!==-1&&(c[i.marker][(i.open?3:0)+(i.length||0)%3]=s)}}}ml.exports=function(e){var r,n=e.tokens_meta,i=e.tokens_meta.length;for(pl(e,e.delimiters),r=0;r{"use strict";bl.exports=function(e){var r,n,i=0,o=e.tokens,a=e.tokens.length;for(r=n=0;r0&&i++,o[r].type==="text"&&r+1{"use strict";var ti=Tr(),yl=O().isWhiteSpace,_l=O().isPunctChar,wl=O().isMdAsciiPunct;function Jt(t,e,r,n){this.src=t,this.env=r,this.md=e,this.tokens=n,this.tokens_meta=Array(n.length),this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache={},this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1}Jt.prototype.pushPending=function(){var t=new ti("text","",0);return t.content=this.pending,t.level=this.pendingLevel,this.tokens.push(t),this.pending="",t};Jt.prototype.push=function(t,e,r){this.pending&&this.pushPending();var n=new ti(t,e,r),i=null;return r<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),n.level=this.level,r>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],i={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(n),this.tokens_meta.push(i),n};Jt.prototype.scanDelims=function(t,e){var r=t,n,i,o,a,s,l,u,c,d,f=!0,h=!0,p=this.posMax,m=this.src.charCodeAt(t);for(n=t>0?this.src.charCodeAt(t-1):32;r{"use strict";var kl=Ar(),ri=[["text",Js()],["newline",Ws()],["escape",Zs()],["backticks",Qs()],["strikethrough",Yn().tokenize],["emphasis",Xn().tokenize],["link",nl()],["image",ol()],["autolink",sl()],["html_inline",ul()],["entity",hl()]],ni=[["balance_pairs",gl()],["strikethrough",Yn().postProcess],["emphasis",Xn().postProcess],["text_collapse",vl()]];function Kt(){var t;for(this.ruler=new kl,t=0;t=o)break;continue}t.pending+=t.src[t.pos++]}t.pending&&t.pushPending()};Kt.prototype.parse=function(t,e,r,n){var i,o,a,s=new this.State(t,e,r,n);for(this.tokenize(s),o=this.ruler2.getRules(""),a=o.length,i=0;i{"use strict";Al.exports=function(t){var e={};e.src_Any=Ln().source,e.src_Cc=Bn().source,e.src_Z=zn().source,e.src_P=Er().source,e.src_ZPCc=[e.src_Z,e.src_P,e.src_Cc].join("|"),e.src_ZCc=[e.src_Z,e.src_Cc].join("|");var r="[><\uFF5C]";return e.src_pseudo_letter="(?:(?!"+r+"|"+e.src_ZPCc+")"+e.src_Any+")",e.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",e.src_auth="(?:(?:(?!"+e.src_ZCc+"|[@/\\[\\]()]).)+@)?",e.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",e.src_host_terminator="(?=$|"+r+"|"+e.src_ZPCc+")(?!-|_|:\\d|\\.-|\\.(?!$|"+e.src_ZPCc+"))",e.src_path="(?:[/?#](?:(?!"+e.src_ZCc+"|"+r+`|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!`+e.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+e.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+e.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+e.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+e.src_ZCc+"|[']).)+\\'|\\'(?="+e.src_pseudo_letter+"|[-]).|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!"+e.src_ZCc+"|[.]).|"+(t&&t["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+",(?!"+e.src_ZCc+").|;(?!"+e.src_ZCc+").|\\!+(?!"+e.src_ZCc+"|[!]).|\\?(?!"+e.src_ZCc+"|[?]).)+|\\/)?",e.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',e.src_xn="xn--[a-z0-9\\-]{1,59}",e.src_domain_root="(?:"+e.src_xn+"|"+e.src_pseudo_letter+"{1,63})",e.src_domain="(?:"+e.src_xn+"|(?:"+e.src_pseudo_letter+")|(?:"+e.src_pseudo_letter+"(?:-|"+e.src_pseudo_letter+"){0,61}"+e.src_pseudo_letter+"))",e.src_host="(?:(?:(?:(?:"+e.src_domain+")\\.)*"+e.src_domain+"))",e.tpl_host_fuzzy="(?:"+e.src_ip4+"|(?:(?:(?:"+e.src_domain+")\\.)+(?:%TLDS%)))",e.tpl_host_no_ip_fuzzy="(?:(?:(?:"+e.src_domain+")\\.)+(?:%TLDS%))",e.src_host_strict=e.src_host+e.src_host_terminator,e.tpl_host_fuzzy_strict=e.tpl_host_fuzzy+e.src_host_terminator,e.src_host_port_strict=e.src_host+e.src_port+e.src_host_terminator,e.tpl_host_port_fuzzy_strict=e.tpl_host_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_port_no_ip_fuzzy_strict=e.tpl_host_no_ip_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+e.src_ZPCc+"|>|$))",e.tpl_email_fuzzy="(^|"+r+'|"|\\(|'+e.src_ZCc+")("+e.src_email_name+"@"+e.tpl_host_fuzzy_strict+")",e.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|\uFF5C]|"+e.src_ZPCc+"))((?![$+<=>^`|\uFF5C])"+e.tpl_host_port_fuzzy_strict+e.src_path+")",e.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|\uFF5C]|"+e.src_ZPCc+"))((?![$+<=>^`|\uFF5C])"+e.tpl_host_port_no_ip_fuzzy_strict+e.src_path+")",e}});var Fl=E((Mb,Ml)=>{"use strict";function ii(t){var e=Array.prototype.slice.call(arguments,1);return e.forEach(function(r){!r||Object.keys(r).forEach(function(n){t[n]=r[n]})}),t}function Fr(t){return Object.prototype.toString.call(t)}function Qf(t){return Fr(t)==="[object String]"}function eh(t){return Fr(t)==="[object Object]"}function th(t){return Fr(t)==="[object RegExp]"}function Tl(t){return Fr(t)==="[object Function]"}function rh(t){return t.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}var Ol={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function nh(t){return Object.keys(t||{}).reduce(function(e,r){return e||Ol.hasOwnProperty(r)},!1)}var ih={"http:":{validate:function(t,e,r){var n=t.slice(e);return r.re.http||(r.re.http=new RegExp("^\\/\\/"+r.re.src_auth+r.re.src_host_port_strict+r.re.src_path,"i")),r.re.http.test(n)?n.match(r.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(t,e,r){var n=t.slice(e);return r.re.no_http||(r.re.no_http=new RegExp("^"+r.re.src_auth+"(?:localhost|(?:(?:"+r.re.src_domain+")\\.)+"+r.re.src_domain_root+")"+r.re.src_port+r.re.src_host_terminator+r.re.src_path,"i")),r.re.no_http.test(n)?e>=3&&t[e-3]===":"||e>=3&&t[e-3]==="/"?0:n.match(r.re.no_http)[0].length:0}},"mailto:":{validate:function(t,e,r){var n=t.slice(e);return r.re.mailto||(r.re.mailto=new RegExp("^"+r.re.src_email_name+"@"+r.re.src_host_strict,"i")),r.re.mailto.test(n)?n.match(r.re.mailto)[0].length:0}}},oh="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",ah="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|\u0440\u0444".split("|");function sh(t){t.__index__=-1,t.__text_cache__=""}function lh(t){return function(e,r){var n=e.slice(r);return t.test(n)?n.match(t)[0].length:0}}function Nl(){return function(t,e){e.normalize(t)}}function Pr(t){var e=t.re=Dl()(t.__opts__),r=t.__tlds__.slice();t.onCompile(),t.__tlds_replaced__||r.push(oh),r.push(e.src_xn),e.src_tlds=r.join("|");function n(s){return s.replace("%TLDS%",e.src_tlds)}e.email_fuzzy=RegExp(n(e.tpl_email_fuzzy),"i"),e.link_fuzzy=RegExp(n(e.tpl_link_fuzzy),"i"),e.link_no_ip_fuzzy=RegExp(n(e.tpl_link_no_ip_fuzzy),"i"),e.host_fuzzy_test=RegExp(n(e.tpl_host_fuzzy_test),"i");var i=[];t.__compiled__={};function o(s,l){throw new Error('(LinkifyIt) Invalid schema "'+s+'": '+l)}Object.keys(t.__schemas__).forEach(function(s){var l=t.__schemas__[s];if(l!==null){var u={validate:null,link:null};if(t.__compiled__[s]=u,eh(l)){th(l.validate)?u.validate=lh(l.validate):Tl(l.validate)?u.validate=l.validate:o(s,l),Tl(l.normalize)?u.normalize=l.normalize:l.normalize?o(s,l):u.normalize=Nl();return}if(Qf(l)){i.push(s);return}o(s,l)}}),i.forEach(function(s){!t.__compiled__[t.__schemas__[s]]||(t.__compiled__[s].validate=t.__compiled__[t.__schemas__[s]].validate,t.__compiled__[s].normalize=t.__compiled__[t.__schemas__[s]].normalize)}),t.__compiled__[""]={validate:null,normalize:Nl()};var a=Object.keys(t.__compiled__).filter(function(s){return s.length>0&&t.__compiled__[s]}).map(rh).join("|");t.re.schema_test=RegExp("(^|(?!_)(?:[><\uFF5C]|"+e.src_ZPCc+"))("+a+")","i"),t.re.schema_search=RegExp("(^|(?!_)(?:[><\uFF5C]|"+e.src_ZPCc+"))("+a+")","ig"),t.re.pretest=RegExp("("+t.re.schema_test.source+")|("+t.re.host_fuzzy_test.source+")|@","i"),sh(t)}function uh(t,e){var r=t.__index__,n=t.__last_index__,i=t.__text_cache__.slice(r,n);this.schema=t.__schema__.toLowerCase(),this.index=r+e,this.lastIndex=n+e,this.raw=i,this.text=i,this.url=i}function Rl(t,e){var r=new uh(t,e);return t.__compiled__[r.schema].normalize(r,t),r}function de(t,e){if(!(this instanceof de))return new de(t,e);e||nh(t)&&(e=t,t={}),this.__opts__=ii({},Ol,e),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=ii({},ih,t),this.__compiled__={},this.__tlds__=ah,this.__tlds_replaced__=!1,this.re={},Pr(this)}de.prototype.add=function(e,r){return this.__schemas__[e]=r,Pr(this),this};de.prototype.set=function(e){return this.__opts__=ii(this.__opts__,e),this};de.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;var r,n,i,o,a,s,l,u,c;if(this.re.schema_test.test(e)){for(l=this.re.schema_search,l.lastIndex=0;(r=l.exec(e))!==null;)if(o=this.testSchemaAt(e,r[2],l.lastIndex),o){this.__schema__=r[2],this.__index__=r.index+r[1].length,this.__last_index__=r.index+r[0].length+o;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(u=e.search(this.re.host_fuzzy_test),u>=0&&(this.__index__<0||u=0&&(i=e.match(this.re.email_fuzzy))!==null&&(a=i.index+i[1].length,s=i.index+i[0].length,(this.__index__<0||athis.__last_index__)&&(this.__schema__="mailto:",this.__index__=a,this.__last_index__=s))),this.__index__>=0};de.prototype.pretest=function(e){return this.re.pretest.test(e)};de.prototype.testSchemaAt=function(e,r,n){return this.__compiled__[r.toLowerCase()]?this.__compiled__[r.toLowerCase()].validate(e,n,this):0};de.prototype.match=function(e){var r=0,n=[];this.__index__>=0&&this.__text_cache__===e&&(n.push(Rl(this,r)),r=this.__last_index__);for(var i=r?e.slice(r):e;this.test(i);)n.push(Rl(this,r)),i=i.slice(this.__last_index__),r+=this.__last_index__;return n.length?n:null};de.prototype.tlds=function(e,r){return e=Array.isArray(e)?e:[e],r?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(n,i,o){return n!==o[i-1]}).reverse(),Pr(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,Pr(this),this)};de.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),e.schema==="mailto:"&&!/^mailto:/i.test(e.url)&&(e.url="mailto:"+e.url)};de.prototype.onCompile=function(){};Ml.exports=de});var Ul=E((Fb,Gl)=>{"use strict";var Ot=2147483647,we=36,oi=1,Wt=26,ch=38,dh=700,Pl=72,ql=128,Il="-",fh=/^xn--/,hh=/[^\0-\x7E]/,ph=/[\x2E\u3002\uFF0E\uFF61]/g,mh={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},ai=we-oi,Ee=Math.floor,si=String.fromCharCode;function ot(t){throw new RangeError(mh[t])}function gh(t,e){let r=[],n=t.length;for(;n--;)r[n]=e(t[n]);return r}function Ll(t,e){let r=t.split("@"),n="";r.length>1&&(n=r[0]+"@",t=r[1]),t=t.replace(ph,".");let i=t.split("."),o=gh(i,e).join(".");return n+o}function Bl(t){let e=[],r=0,n=t.length;for(;r=55296&&i<=56319&&rString.fromCodePoint(...t),vh=function(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:we},zl=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},jl=function(t,e,r){let n=0;for(t=r?Ee(t/dh):t>>1,t+=Ee(t/e);t>ai*Wt>>1;n+=we)t=Ee(t/ai);return Ee(n+(ai+1)*t/(t+ch))},Hl=function(t){let e=[],r=t.length,n=0,i=ql,o=Pl,a=t.lastIndexOf(Il);a<0&&(a=0);for(let s=0;s=128&&ot("not-basic"),e.push(t.charCodeAt(s));for(let s=a>0?a+1:0;s=r&&ot("invalid-input");let f=vh(t.charCodeAt(s++));(f>=we||f>Ee((Ot-n)/c))&&ot("overflow"),n+=f*c;let h=d<=o?oi:d>=o+Wt?Wt:d-o;if(fEe(Ot/p)&&ot("overflow"),c*=p}let u=e.length+1;o=jl(n-l,u,l==0),Ee(n/u)>Ot-i&&ot("overflow"),i+=Ee(n/u),n%=u,e.splice(n++,0,i)}return String.fromCodePoint(...e)},Vl=function(t){let e=[];t=Bl(t);let r=t.length,n=ql,i=0,o=Pl;for(let l of t)l<128&&e.push(si(l));let a=e.length,s=a;for(a&&e.push(Il);s=n&&cEe((Ot-i)/u)&&ot("overflow"),i+=(l-n)*u,n=l;for(let c of t)if(cOt&&ot("overflow"),c==n){let d=i;for(let f=we;;f+=we){let h=f<=o?oi:f>=o+Wt?Wt:f-o;if(d{"use strict";$l.exports={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"\u201C\u201D\u2018\u2019",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}}});var Wl=E((qb,Kl)=>{"use strict";Kl.exports={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"\u201C\u201D\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","text_collapse"]}}}});var Zl=E((Ib,Yl)=>{"use strict";Yl.exports={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"\u201C\u201D\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","text_collapse"]}}}});var qr=E((Lb,eu)=>{"use strict";var Yt=O(),Eh=Pa(),xh=Ia(),kh=ls(),Sh=Us(),Ch=Cl(),Ah=Fl(),at=In(),Xl=Ul(),Dh={default:Jl(),zero:Wl(),commonmark:Zl()},Th=/^(vbscript|javascript|file|data):/,Oh=/^data:image\/(gif|png|jpeg|webp);/;function Nh(t){var e=t.trim().toLowerCase();return Th.test(e)?!!Oh.test(e):!0}var Ql=["http:","https:","mailto:"];function Rh(t){var e=at.parse(t,!0);if(e.hostname&&(!e.protocol||Ql.indexOf(e.protocol)>=0))try{e.hostname=Xl.toASCII(e.hostname)}catch{}return at.encode(at.format(e))}function Mh(t){var e=at.parse(t,!0);if(e.hostname&&(!e.protocol||Ql.indexOf(e.protocol)>=0))try{e.hostname=Xl.toUnicode(e.hostname)}catch{}return at.decode(at.format(e),at.decode.defaultChars+"%")}function fe(t,e){if(!(this instanceof fe))return new fe(t,e);e||Yt.isString(t)||(e=t||{},t="default"),this.inline=new Ch,this.block=new Sh,this.core=new kh,this.renderer=new xh,this.linkify=new Ah,this.validateLink=Nh,this.normalizeLink=Rh,this.normalizeLinkText=Mh,this.utils=Yt,this.helpers=Yt.assign({},Eh),this.options={},this.configure(t),e&&this.set(e)}fe.prototype.set=function(t){return Yt.assign(this.options,t),this};fe.prototype.configure=function(t){var e=this,r;if(Yt.isString(t)&&(r=t,t=Dh[r],!t))throw new Error('Wrong `markdown-it` preset "'+r+'", check name');if(!t)throw new Error("Wrong `markdown-it` preset, can't be empty");return t.options&&e.set(t.options),t.components&&Object.keys(t.components).forEach(function(n){t.components[n].rules&&e[n].ruler.enableOnly(t.components[n].rules),t.components[n].rules2&&e[n].ruler2.enableOnly(t.components[n].rules2)}),this};fe.prototype.enable=function(t,e){var r=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(i){r=r.concat(this[i].ruler.enable(t,!0))},this),r=r.concat(this.inline.ruler2.enable(t,!0));var n=t.filter(function(i){return r.indexOf(i)<0});if(n.length&&!e)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+n);return this};fe.prototype.disable=function(t,e){var r=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(i){r=r.concat(this[i].ruler.disable(t,!0))},this),r=r.concat(this.inline.ruler2.disable(t,!0));var n=t.filter(function(i){return r.indexOf(i)<0});if(n.length&&!e)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+n);return this};fe.prototype.use=function(t){var e=[this].concat(Array.prototype.slice.call(arguments,1));return t.apply(t,e),this};fe.prototype.parse=function(t,e){if(typeof t!="string")throw new Error("Input data should be a String");var r=new this.core.State(t,this,e);return this.core.process(r),r.tokens};fe.prototype.render=function(t,e){return e=e||{},this.renderer.render(this.parse(t,e),this.options,e)};fe.prototype.parseInline=function(t,e){var r=new this.core.State(t,this,e);return r.inlineMode=!0,this.core.process(r),r.tokens};fe.prototype.renderInline=function(t,e){return e=e||{},this.renderer.render(this.parseInline(t,e),this.options,e)};eu.exports=fe});var ru=E((Bb,tu)=>{"use strict";tu.exports=qr()});var Q=function(t){return t==null?!0:Array.isArray(t)||dt(t)?t.length===0:Object.keys(t).length===0},dt=function(t){return toString.call(t)==="[object String]"},et=function(t){let e=typeof t;return(e==="function"||e==="object")&&!!t},on=function(t){return t===void 0},Ie=function(t){return Q(t)?t:t.charAt(0).toUpperCase()+t.slice(1)},an=function(t){if(!(t===null||typeof t=="undefined")){if(dt(t)||typeof t=="number")return t;if(Array.isArray(t))return t.map(e=>an(e));if(typeof t.toJSON=="function")return t.toJSON();if(t instanceof Map){let e={};return t.forEach(function(r,n){e[n]=an(r)}),e}if(typeof t!="function"&&typeof t!="undefined")return t}},K=function(){let t={};for(let e in this){let r=this[e],n=an(r);typeof n!="undefined"&&(t[e]=n)}return t};var Le=class{constructor({table:e="",hide_table:r=!1,hide_result:n=!1,hide_desc:i=!1}){this.table=e,this.hide_table=r===!0||r==="1"||r===1,this.hide_result=n===!0||n==="1"||n===1,this.hide_desc=i===!0||i==="1"||i===1}toJSON(){let e={className:"DisplayOptions",table:this.table};return this.hide_table&&(e.hide_table=!0),this.hide_result&&(e.hide_result=!0),this.hide_desc&&(e.hide_desc=!0),e}};var Be=class{constructor({label:e="",print:r=!0,description:n="",subtable:i=[],weight:o=1}){this.label=e,this.print=!(r===!1||r==="0"||r===0),this.description=n,this.weight=parseInt(o,10),this.weight<=0&&(this.weight=1),dt(i)?this.subtable=[i]:Array.isArray(i)&&(this.subtable=i.map(a=>a.toString()))}toJSON(){let e=K.call(this);return e.className="RandomTableEntry",e}};var uc=function(t){let e=0;for(let r=0;r=n));i++);return t[i]},ze=function(t){let e=[],r=[];return!Array.isArray(t)||t.length===0?null:(t.forEach(n=>{r.push(1),e.push(n)}),ln(e,r))};var De=class{constructor({id:e=0,key:r=null,title:n="",author:i="",description:o="",source:a="",tags:s=[],sequence:l=[],tables:u={},macro:c=[],dependencies:d=null,table:f=null,display_opt:h=[]}){this.id=e,this.key=r||this.id,this.title=n,this.author=i,this.description=o,this.source=a,this.tags=s,this.sequence=l,this.macro=c,this.dependencies=d,this._normalizeTables(u,f),this.display_opt=new Map,h.forEach(p=>{let m=p.table||"";if(m){if(p instanceof Le){this.display_opt.set(m,p);return}let v=new Le(p);this.display_opt.set(m,v)}})}toString(){return this.title}_normalizeTable(e){let r=[];return e.forEach(n=>{if(!Q(n)){if(dt(n)){r.push(new Be({label:n}));return}if(n instanceof Be){r.push(n);return}et(n)&&r.push(new Be(n))}}),r}_normalizeTables(e,r){Q(e)&&Q(r)||(this.tables={},!Q(r)&&Array.isArray(r)&&(this.tables.default=this._normalizeTable(r)),et(e)&&Object.keys(e).forEach(i=>{let o=e[i];!Array.isArray(o)||(this.tables[i]=this._normalizeTable(o))}))}getSequence(e=""){return e!==""?[e]:this.sequence.length===0?this.tables.default?["default"]:[this.subtableNames[0]]:this.sequence[0]==="rollall"?this.subtableNames:this.sequence}get subtableNames(){return Object.keys(this.tables)}getSubtableEntries(e="default"){return this.tables[e]||[]}getRandomEntry(e){let r=this.getSubtableEntries(e);if(r.length===0)return null;let n=[],i=[];return r.forEach((o,a,s)=>{i.push(o.weight),n.push(o)}),ln(n,i)}findEntry(e,r="default"){let n=this.tables[r];if(!n)return null;let i=n.find(o=>o.label===e);return i||null}findDependencies(){if(this.dependencies!==null)return this.dependencies;let e=[];this.macro.forEach(i=>{let o=i.split(":");o.length>0&&o[0]!=="this"&&e.push(o[0])});let r=/({{2}.+?}{2})/g;return Object.keys(this.tables).forEach(i=>{this.tables[i].forEach(a=>{let s=a.label.match(r);s!==null&&s.forEach(l=>{let u=l.replace("{{","").replace("}}","").split(":");u.length>1&&u[0]==="table"&&u[1]!=="this"&&e.push(u[1])})})}),e=e.reduce((i,o)=>(i.indexOf(o)<0&&i.push(o),i),[]),this.dependencies=e,e}toJSON(){let e=K.call(this);return e.className="RandomTable",e}};var se=class{constructor({table:e="",result:r="",desc:n=""}){this.table=e,this.result=r,this.desc=n}get isDefault(){return this.table==="default"}get isError(){return!1}toString(){return this.result}toJSON(){let e=K.call(this);return e.className="RandomTableResult",e}};var be=class extends se{get isError(){return!0}toJSON(){let e=super.toJSON();return e.className="TableErrorResult",e}};var Te=class{constructor({title:e="",results:r=[],displayOptions:n=new Map}){this.title=e,this.results=[],r.forEach(i=>{this.addResult(i)}),n instanceof Map?this.displayOptions=n:(this.displayOptions=new Map,Object.keys(n).forEach(i=>{let o=n[i],a=o.table||"";if(a){if(o instanceof Le){this.displayOptions.set(a,o);return}this.displayOptions.set(a,new Le(o))}}))}addResult(e){if(e instanceof se||e instanceof be){this.results.push(e);return}if(e.className==="TableErrorResult"){this.results.push(new be(e));return}this.results.push(new se(e))}get isSimple(){return this.results.length===1}findResultByTable(e="default"){let r=this.results.find(n=>n.table===e);return r||null}niceString(e=!1){if(this.results.length===0)return"";if(e)return this.results.map(n=>n.toString()).join(" ");let r="";return this.results.forEach(n=>{if(n.isError){r+=`Error: ${n.result} +`;return}let i=this.displayOptions.get(n.table);if(i){i.hide_table||(r+=`${Ie(n.table)}: `),i.hide_result||(r+=`${Ie(n.result)} `),i.hide_desc||n.desc!==""&&(r+=`(${n.desc}) -`);return}n.isDefault?r+=`${Pe(n.result)} -`:r+=`${Pe(n.table)}: ${Pe(n.result)} +`);return}n.isDefault?r+=`${Ie(n.result)} +`:r+=`${Ie(n.table)}: ${Ie(n.result)} `,n.desc!==""&&(r+=`${n.desc} -`)}),r.trim()}toString(){return this.niceString()}toJSON(){return Q.call(this)}};var wi=class{constructor({die:e="",value:r=0}){this.die=e,this.value=r}toString(){return this.value}},uc=function(t=6,e=1,r=0,n="+"){r=parseInt(r,10),t=parseInt(t,10),e<=0?e=1:e=parseInt(e,10);let i=0;for(let o=1;o<=e;o++)i=i+nn(1,t);if(r===0)return i;switch(n){case"*":i=i*r;break;case"-":i=i-r;break;case"/":i=i/r;break;case"+":default:i=i+r;break}return Math.round(i)},er=function(t=""){t=t.trim();let e=t.match(/^([0-9]*)d([0-9]+)(?:([\+\-\*\/])([0-9]+))*$/);return e?uc(e[2],e[1],e[4],e[3]):""},Ei=function(t=""){return new wi({die:t,value:er(t)})};var xi=class extends Error{constructor(e){super(e);this.name="TableError"}},Ye=xi;var tr=class extends De{get isError(){return!0}};var cc=/({{2}.+?}{2})/g,ki=class{constructor({token_types:e={}}){this.token_types={roll:this._defaultRollToken.bind(this),table:this._defaultTableToken.bind(this)},Object.keys(e).forEach(r=>{this.token_types[r]=e[r]})}_getErrorResult(e="",r=""){return new tr({table:r,result:e})}_getErrorResultSet(e=""){return new ot({results:[this._getErrorResult(e)]})}_selectFromTable(e,r){if(!(e instanceof Se))return[this._getErrorResult("Invalid table.")];let n=[],i=e.getRandomEntry(r);if(i===null||!(i instanceof qe))return[this._getErrorResult("Invalid subtable name.",r)];if(i.print){let o=this.findToken(i.label,e);n.push(new De({table:r,result:o,desc:i.description}))}return i.subtable.length===0||i.subtable.forEach(o=>{let a=this._selectFromTable(e,o);n=n.concat(a)}),n}_getTableMacroResult(e){let r=[];try{e.macro.forEach(n=>{let i=n.split(":"),o=i[0],a=i[1]||"";if(o===e.key)throw new Ye("Macros can't self reference.");try{let s=this.getTableByKey(o),l=this.getTableResult(s,a);r=r.concat(l)}catch(s){if(s instanceof Ye)r.push(this._getErrorResult(s.message,o));else throw s}})}catch(n){if(n instanceof RangeError)r.push(this._getErrorResult(n.message));else throw n}return r}getTableResult(e,r=""){if(!(e instanceof Se))return[this._getErrorResult("No table found to roll on.")];let n=[];if(e.macro.length>0)return this._getTableMacroResult(e);let i=e.getSequence(r);if(i.length===0)return n;try{i.forEach(o=>{let a=this._selectFromTable(e,o);n=n.concat(a)})}catch(o){if(o instanceof RangeError)n.push(this._getErrorResult(o.message));else throw o}return n}getTableResultSetByKey(e,r=""){try{let n=this.getTableByKey(e),i=this.getTableResult(n,r);return new ot({title:n.title,results:i,displayOptions:n.display_opt})}catch(n){if(n instanceof Ye)return this._getErrorResultSet(n.message);throw n}}getResultSetForTable(e,r=""){if(!(e instanceof Se))return this._getErrorResultSet("Invalid table data.");let n=this.getTableResult(e,r);return new ot({title:e.title,results:n,displayOptions:e.display_opt})}convertToken(e,r=null){let n=e.replace("{{","").replace("}}","").split(":");if(n=n.map(i=>i.trim()),n.length===0)return e;try{return this.token_types[n[0]]?this.token_types[n[0]](n,e,r):e}catch(i){if(i instanceof RangeError)return this._getErrorResultSet(i.message);throw i}}findToken(e,r=null){return j(e)?"":e.replace(cc,i=>this.convertToken(i,r).toString())}setTableKeyLookup(e){this._customGetTableByKey=e}_customGetTableByKey(e){return null}getTableByKey(e){if(!e)throw new Ye("No table key.");let r=this._customGetTableByKey(e);if(!r||!(r instanceof Se))throw new Ye(`No table found for key: ${e}`);return r}registerTokenType(e,r){this.token_types[e]=r}_defaultRollToken(e,r="",n=null){return Ei(e[1])}_defaultTableToken(e,r,n=null){if(rn(e[1]))return r;let i=1;if(e[1].indexOf("*")!==-1){let l=e[1].split("*");e[1]=l[0],i=l[1]}let o=null;if(e[1]==="this"){if(!n)return r;o=n}else try{o=this.getTableByKey(e[1])}catch(l){if(l instanceof Ye)return r;throw l}if(typeof e[2]!="undefined"&&e[2].indexOf("*")!==-1){let l=e[2].split("*");e[2]=l[0],i=l[1]}let a=rn(e[2])?"":e[2],s=[];for(let l=1;l<=i;l++)s.push(this.getResultSetForTable(o,a));return s.length===1?s[0]:s}},Ci=ki;var Ai=class{constructor({memory:e={},separator:r="",order:n=2}){this.memory=e,this.separator=r,this.order=n}isMemoryKeySet(e){return!!this.memory[e]}genInitial(){return Array(this.order).fill("")}getRandomValue(e){return e[Math.floor(Math.random()*e.length)]}breakText(e,r){let n=e.split(this.separator),i=this.genInitial();n.forEach(o=>{o=o.toLowerCase(),r(i,o),i.shift(),i.push(o)}),r(i,"")}learn(e,r){let n=this.memory[e]?this.memory[e]:{};this.breakText(r,(i,o)=>(n[i]||(n[i]=[]),n[i].push(o),n)),this.memory[e]=n}step(e,r){let n=this.memory[this.cur_key][e]||[""],i=this.getRandomValue(n);if(!i)return r;r.push(i);let o=e.slice(1);return o.push(i),this.step(o,r)}generate(e,r){return r||(r=this.genInitial()),this.cur_key=e,r.concat(this.step(r,[])).join(this.separator)}},Si=Ai;var Di=class extends Error{constructor(e){super(e);this.name="RandomNameError"}},ee=Di;var Ti=class{constructor({key:e="",label:r="",male:n=[],female:i=[],surname:o=[]}){this.key=e,this.label=r||e,this.male=Array.isArray(n)?n:[],this.female=Array.isArray(i)?i:[],this.surname=Array.isArray(o)?o:[]}getAllPersonalNames(){return Array.prototype.concat(this.male,this.female)}getPersonalNameList(e="random"){if(e==="mixed"||e==="")return this.getAllPersonalNames();if(e==="male")return this.male;if(e==="female")return this.female;let r=[];return this.male.length>0&&r.push("male"),this.female.length>0&&r.push("female"),r.length===0?[]:(e=Ie(r),this[e])}},rr=Ti;var at=function(t){let e=["of","the","from","de","le","la"];return t.split(" ").map(i=>e.indexOf(i)>=0?i:`${Pe(i)}`).join(" ")},Ni=class{constructor({namedata:e=[],markovOrder:r=3}){this.nameTypes=new Map,Array.isArray(e)&&e.forEach(n=>{this.registerNameType(n)}),this._markov=new Si({order:r})}registerNameType(e){if(!(e instanceof rr))throw new ee("Must be instance of RandomNameType");if(!e.key)throw new ee("RandomNameType must have key set.");if(e.key==="random")throw new ee(`RandomNameType key ${e.key} is reserved.`);if(e.male.length===0&&e.female.length===0&&e.surname.length===0)throw new ee(`RandomNameType ${e.key} must include male, female, or surname lists.`);this.nameTypes.set(e.key,e)}_validateNameType(e,r=""){let n=this.nameTypes.get(e);if(!n)throw new ee("Invalid name type.");if(!!r&&(!Array.isArray(n[r])||n[r].length===0))throw new ee(`${e} type does not have subtype ${r}`)}getValidNameTypes(){return Array.from(this.nameTypes.keys())}getRandomNameType(){return Ie(Array.from(this.nameTypes.keys()))}_getNameType(e){e==="random"&&(e=this.getRandomNameType());let r=this.nameTypes.get(e);if(!r)throw new ee("Invalid name type.");return r}_getNameList(e="random",r="mixed"){let n=this._getNameType(e);if(r==="surname"){if(n.surname.length===0)throw new ee(`${e} type does not have subtype ${r}`);return n.surname}let i=n.getPersonalNameList(r);if(i.length===0)throw new ee(`${e} type does not have subtype ${r}`);return i}selectPersonalName(e="random",r="random"){let n=this._getNameList(e,r);return at(Ie(n))}selectSurname(e="random"){let r=this._getNameList(e,"surname");return at(Ie(r))}selectName(e="random",r="random",n=""){let i=this._getNameType(e),o=i.getPersonalNameList(r);if(o.length===0)throw new ee(`${i.key} does not have list for ${r}`);let a=at(Ie(o));return n!=="first"&&(a+=` ${at(Ie(i.surname))}`),a.trim()}createPersonalName(e="random",r="random"){let n=this._getNameType(e),i=n.getPersonalNameList(r);if(i.length===0)throw new ee("Starting name list is empty.");let o=`${n.key}_${r}`;return this._markov.isMemoryKeySet(o)||i.forEach(a=>{this._markov.learn(o,a)}),at(this._markov.generate(o).trim())}createSurName(e="random"){let r=this._getNameType(e),n=r.surname;if(n.length===0)throw new ee("Starting name list is empty.");let i=`${r.key}_surname`;return this._markov.isMemoryKeySet(i)||n.forEach(o=>{this._markov.learn(i,o)}),at(this._markov.generate(i).trim())}createName(e="random",r="random",n=""){e==="random"&&(e=this.getRandomNameType());let i=this.createPersonalName(e,r);return n!=="first"&&(i=`${i} ${this.createSurName(e)}`),i.trim()}generateList(e=10,r="random",n=!1){let i={male:[],female:[]};for(let o=1;o<=e;o++){let a=o<=Math.ceil(e/2)?"male":"female";n?i[a].push(this.createName(r,a)):i[a].push(this.selectName(r,a))}return i}nameTokenCallback(e,r="",n=null){let i="";e[1]||(e[1]="random"),(!e[3]||e[3]!=="first")&&(e[3]=""),e[2]||(e[2]="random");try{i=this.selectName(e[1],e[2],e[3])}catch(o){if(o instanceof ee)return"";throw o}return i}},Oi=Ni;var Mi=[{id:3,key:"npcs",title:"NPC Characteristics",sequence:["size","manner","physical_trait","quirk","speech"],tables:{size:["Short","Thin","Average","Tall","Large","Pick Two"],dress:["Cleancut","Filthy","Fancy","Practical","Rich","Uniform"],manner:["Gregarious","Icy","Pious","Flirtacious / Obsequious","Aggressive / Critical","Reserved"],physical_trait:["Missing Limb","Hairy","Unusual hair","Muscular","Unusually Attractive","Unusually Ugly"],quirk:["Touchy","Fingers Talisman [crucifix/ring/gun]","Ticket/Fidgety","Bad Sense [sight/hearing]","Drinks/Smokes Profusely","Gestures a lot"],speech:["Stutters","Florid","Terse","Curses excessively","Laughs a lot","Meandering"]}},{id:4,key:"jobs",title:"NPC Jobs",display_opt:[{table:"worker",hide_table:!0},{table:"merchant",hide_table:!0},{table:"craftsman",hide_table:!0},{table:"professional",hide_table:!0},{table:"wealthy",hide_table:!0},{table:"neer_do_well",hide_table:!0}],tables:{default:[{label:"Worker",subtable:"worker",print:!1},{label:"Merchant",subtable:"merchant",print:!1},{label:"Craftsman",subtable:"craftsman",print:!1},{label:"Professional",subtable:"professional",print:!1},{label:"Wealthy",subtable:"wealthy",print:!1},{label:"Ne'er Do Well",subtable:"neer_do_well",print:!1}],worker:["Farmer","Bartender","Clerk","Cowboy","Soldier","Laundress","Prostitute","Logger","Parent","Miner","Trapper","Unemployed"],merchant:["General Store","Bathhouse","Hotel/Boarding","Saloon","Pimp","Hardware","Livery","Foreman/Manager","Food/Cafe","Freight","Haberdasher","Feed Barn"],craftsman:["Blacksmith","Wainwright","Brewer/Distiller","Saddler","Tailor","Barber","Cook","Butcher","Gunsmith","Sawmill","Carpenter","?"],professional:["Doctor","Lawyer","Newspaper Editor","Teacher","Sheriff","Army Officer","Preacher","Telegraph Operator","Conductor","Assayer","Surveyor","Marshal"],wealthy:["Mine Owner","Cattle Baron","Trust Fund Child","Banker","Politician","Nouveau Riche"],neer_do_well:["Gambler","Addict","Gunfighter","Actor","Musician","Dancer","Thug","Gossip","Thief","Gigolo","Hermit","Vigilante"]}},{id:5,key:"goals",title:"NPC Goals",display_opt:[{table:"long_term",hide_table:!0},{table:"short_term",hide_table:!0},{table:"secrets",hide_table:!0}],tables:{long_term:["Wealth","Safety [family/self]","Civic Good","Knowledge/Skill/Craft","Piety/Charity","Status/Power","Peace & Quiet","Passion"],short_term:["Business Deal","Pleasure/Addiction","Property","Specific Object","Money","Job/Work","Love/Lust/Desire","Revenge/Hate"],secrets:["Love\u2019s another\u2019s spouse [mutual/unrequited/unexpressed]","Fled a murder rap [innocent/guilty]","Fraud at profession","Hidden vice [dope/alcohol/sex]","Secret child in town","Ran with a bad bunch of hombres","Owes a lot of money / Broke","Hallucinatory visions [religious/psychotic]"]}},{id:6,key:"relationships",title:"NPC Relationships",tables:{default:[{label:"Hate",weight:1},{label:"Dislike",weight:5},{label:"Suspicious",weight:7},{label:"Neutral",weight:10},{label:"Like",weight:7},{label:"Friend",weight:5},{label:"Love",weight:1}],specific:["Lovers [current/former]","Enemies [long term/recent/former]","Rivalry [business/love]","Loaner/Debtor","Comrades [current/former] [business/army/mines/banditry/cowboys]","Employer/Employee [current/former]","Family [happy/secret/estranged]"],faction:["Community leaders (business owners)","Pious church goers","Miners/Loggers [union]","Ranchers","The Law (sheriff, deputies, judges, posse members, etc.)","Homesteaders","Bandits"]}},{id:7,key:"events",title:"Events",tables:{regular:["Wedding [jealousy/drunken revelry]","Funeral [murder/inheritance]","Market day [theft/rivalry/strangers]","Holiday","Arrival [stage/train]","Sunday services","Payday at the [mine/ranch/camp]"],crimes:["Drunken brawl","Murder","Theft","Kidnapping","Bandit raid","Shootout","[Stage/train] ambushed","Arson"],natural:["Resource Depletion","Sickness","Rainstorm","Windstorm","Fire","Wild animals"],other:["Territorial dispute [ranchers/farmers/both]","Heartless capitalist tries to run thing","A dark past catches up with someone","Mine collapse/Logging accident","Election","Workers strike","Lynch mob","New business opens","Square dance"]}},{id:8,key:"stranger",title:"A Stranger Comes to Town",tables:{default:["Gunslinger","Pinkerton Detective","Itinerant Preacher","[Son/father/daughter/lover] thought to be dead","Family member with a [problem/past/secret]","Ex-con [stranger/relative/old friend]","Snake Oil Salesman","Rabblerouser","Swindler [man/woman/couple/family]","Rich [worldly/naive] [man/couple/woman] from back East","Bandit [with/out] his gang","Family looking to settle","Destitute men looking for work","Former soldiers [hungry/crazed/in pursuit/pursued]","Bounty hunter with a [recent/old] warrant for [townsperson/bandit/gunslinger]","Traveling salesman","[Troublesome/pitiful] [man/woman] comes to get [family/friend] out of jail","Politician [campaigning/canvassing]","Woman fleeing [fiance/husband]","Travelling Troupe of Actors"]}},{id:10,key:"items",title:"Items",tables:{default:[{label:"weapons",subtable:"weapons",print:!0},{label:"valuables",subtable:"valuables",print:!0},{label:"clothes",subtable:"clothes",print:!0},{label:"consumables",subtable:"consumables",print:!0},{label:"papers",subtable:"papers",print:!0},{label:"other",subtable:"other",print:!0}],weapons:["Famous gunslinger\u2019s pistol","Knife","Gun [shotgun/pistol/rifle]","Bandolier of bullets","Cavalry Sword","Ax","Whip"],valuables:["Wedding band of [live/dead] spouse","Thoroughbred horse","Unopened bottle of imported liquor","Wallet of bills","Pouch of gold","Combination to safe on a photo","Crucifix"],clothes:["Hat [lady\u2019s/man\u2019s] [fine/plain]","Boots [new/muddy/decorative]","Dress [fancy/torn/bloodied]","Shirt [fancy/bloodstained/torn]","Gun belt","Earrings [plain/bejeweled]"],consumables:["Bottle of whisky","Jerky","Tobacco pouch and rolling papers","Canned peaches","Sweet buns","Wine bottle"],papers:["Newspaper [local/nearby /far]","Deed to mines","Arrest warrant","Letter [incriminating/sentimental]","Dime novel","Daguerrotype"],other:["Dice [loaded]","Playing cards [fresh/used]","Keys to [house/business/lockbox/jail]","Hammer [nails]","Pipe and matches","Lantern"]}},{id:9,key:"town_landscape",title:"Landscape Prominent Feature",tables:{default:["Town build on the banks of a winding stream crossed by makeshift bridges.","Town build upon rocky outcrops, street(s) wind back and forth, buildings are all at different levels.","Town grew around a single giant tree, the rest of the land is flat and barren.","Town sits in a narrow valley, overlooked by ridges, main road snakes down to town and then back up and out.","Town built at foot of cliff where the first mine was found.","Town expanded from a small waterfall and pool amongst tall evergreens."]}},{id:11,key:"dressing",title:"Set Dressing",display_opt:[{table:"outside",hide_table:!0},{table:"inside",hide_table:!0}],tables:{outside:["Balconies","Boardwalks","Hitching posts","Water troughs","Fences","Barrels","Mud Puddles","Hand scrawled signs","Water wagon","Log bridges","Water wheels","Framed out buildings","Tents","Horses and Wagons","Posters (Wanted, Ads, Broadsheets)"],inside:["Piano","Billiard table","Dart board","Music box","Spittoons","Bed pans","Paintings [landscape/pretty woman/historical figure]","Mismatched chairs","Makeshift tables","Ladders","Heavy curtains","Wash tubs","Valise filled with dresses","Old Clock","Brightly upholstered chair/couch","Crystal decanter filled with whiskey"]}},{id:1,key:"locations",title:"Locations Outside of Town",tables:{default:["Train [in motion/broken down/stopped by blocked tracks]","Family Farm [abandoned/prospering/failing]","Cattle Ranch","Mine [abandoned/active]","Grazing land [disputed]","River [rapids]","Rocky hills","Deep woods","Religious camp","Bandit camp","Log cabin [abandoned/hideout/hermit]"]}},{id:2,key:"resources",title:"Settlement Resources",tables:{default:["Gold","Lumber","Farmland","Water","Railway","Furs/Game"]}},{id:12,key:"town_name",title:"Town Names",display_opt:[{table:"main",hide_table:!0},{table:"ending1",hide_table:!0},{table:"ending2",hide_table:!0}],tables:{default:[{label:"{{table:this:main}}{{table:this:ending1}}",weight:4},{label:"{{table:this:main}} {{table:this:ending2}}",weight:4},{label:"Fort {{table:this:main}}",weight:1}],main:["Hadley","Smith","Adams","Snake","Elk","Fire","Coal","Oak","Maple","Elm","Wilder","Jackson","Washington","Revere","Franklin","Shallow","Rapid","Gold","Summer","Spring","Nugget","Mary"],ending1:["ville","town","berg","woods"],ending2:["Hollow","Hills","City","Falls","Rapids"]}}];var Ri=[{key:"western",label:"Western",male:["Alan","Conan","Daveth","Denzel","Derrick","Hammitt","Jermyn","Jory","Merryn","Pasco","Tomas","Trelawney","Tremayne","Tristan","Abel","Abraham","Adam","Alan","Albert","Alex","Alexandre","Alfred","Alphonse","Anatole","Andr\xE9","Anselme","Armand","Arthur","Auguste","Barnabus","Benjamin","Bernard","Bertrand","Blaise","Brice","Bruno","C\xE9sar","Charles","Christian","Christophe","Claude","Cyril","Damien","Dan","Daniel","David","Denis","Didier","Dorian","Edgar","\xC9mile","Emmanuel","Ernest","Ethan","\xC9tienne","Eug\xE8ne","Fabien","F\xE9lix","Ferdinand","Florent","Francis","Frank","Fred","Gabriel","Gaspard","Geoffrey","Georges","G\xE9rard","Gilbert","Guillaume","Gustave","Guy","Hector","Hercule","Horace","Jason","Jean","J\xE9r\xE9mie","J\xE9r\xF4me","Jess\xE9","Jonathan","Joseph","Jules","Kevin","Laurent","L\xE9o","L\xE9on","L\xE9onard","Lionel","Lou","Louis","Lucas","Manuel","Marc","Marcel","Martin","Maurice","Maxime","Micha\xEBl","Morgan","Nathan","Nicolas","Odilon","Oscar","Pascal","Patrick","Paul","Philippe","Pierre","Raoul","Rapha\xEBl","Raymond","R\xE9gis","Richard","Robert","Roger","Roland","Ruben","Samson","Samuel","S\xE9bastien","Serge","Simon","Th\xE9o","Th\xE9odore","Th\xE9ophile","Thomas","Tristan","Ulysse","Valentin","Victor","Vincent","Xavier","Yves","Abe","Abraham","Adam","Albert","Alex","Alexander","Alfred","Aloysius","Andreas","Anton","Arthur","Augustus","Bart","Ben","Benjamin","Bernhard","Bert","Bob","Bram","Brecht","Casper","Chris","Christiaan","Cornelius","Damian","Dani\xEBl","David","Dennis","Dick","Dirk","Ed","Edwin","Erik","Ernst","Erwin","Fabian","Felix","Ferdinand","Filip","Frank","Fred","Frederik","Gerard","Gerhard","Gerrit","Gerry","Gilbert","Gustaaf","Hans","Hendrik","Herman","Hieronymus","Hubert","Hugo","Jacob","Jan","Jasper","Jef","Jesse","Jonas","Jonathan","Jordan","Karel","Kasper","Kevin","Lambert","Lars","Leo","Leonard","Leopold","Levi","Louis","Lucas","Marcel","Marco","Mark","Martin","Max","Michael","Mick","Nick","Nico","Olaf","Oliver","Otto","Pascal","Paul","Peter","Philip","Rembrandt","Richard","Rob","Robert","Robin","Roy","Ruben","Rudolf","Rupert","Rutger","Sebastian","Simon","Stefan","Steven","Sven","Theo","Thomas","Tim","Tom","Vincent","Werner","Willem","Willy","Xander","Adam","Adolf","Arnold","Bern","Baldwin","Conrad","Constantin","Egmund","Eric","Finn","Franco","Gerald","Gregorio","Gunther","Henryk","Herman","Hubert","Isaac","Johannes","Knut","Norbert","Otto","Rainer","Richard","Rupert","Rutger","Simon","Stefan","Waldo","Walther","Willem","akira","goro","haruki","ichiro","jiro","ken","ren","shin","shiro","takashi","Aar\xF3n","Abel","Alberto","Albino","Alcides","Alejandro","Alejo","\xC1lex","Alexis","Alfonso","Alfredo","Alonso","\xC1lvaro","Amado","Amador","Anastacio","Andr\xE9s","\xC1ngel","Armando","Arsenio","Arturo","Baldo","Bartolom\xE9","Bautista","Benito","Benjam\xEDn","Bernardo","Berto","Bol\xEDvar","Bonifacio","Bruno","Buenaventura","Carlito","Carlos","Carmelo","C\xE9sar","Che","Chuy","Clemente","Crist\xF3bal","Dar\xEDo","Diego","Domingo","Edgardo","Eduardo","Eladio","El\xEDas","Emiliano","Emilio","Enrique","Esteban","Evaristo","Fabio","Fabricio","Faustino","Feliciano","Felipe","F\xE9lix","Fernando","Fidel","Flavio","Flori\xE1n","Francisco","Gabriel","Gast\xF3n","Geraldo","Gerardo","Gonzalo","Guadalupe","Guillermo","Gustavo","Gutierre","H\xE9ctor","Hern\xE1n","Hernando","Hugo","Ignacio","Isaac","Isidoro","Jaime","Javier","Jes\xFAs","Joaquin","Joel","Jorge","Jose","Jos\xE9 Antonio","Jos\xE9 Luis","Jos\xE9 Manuel","Juan","Juan Carlos","Juan Manuel","Juan Pablo","Julio","Leonardo","Lorenzo","Luciano","Lucio","Luis","Lupe","Manolo","Manuel","Marco","Mariano","Mario","Mateo","Miguel","Nacho","N\xE9stor","Octavio","\xD3scar","Pablo","Paco","Pancho","Pedro","Pepe","Pl\xE1cido","Rafael","Ram\xF3n","Ra\xFAl","Reynaldo","Ricardo","Roberto","Rodrigo","Salvador","Samuel","Sancho","Santos","Sergio","Severino","Silvio","Sim\xF3n","Tito","Tom\xE1s","Valent\xEDn","Vicente","V\xEDctor","Wilfredo"],female:["Adela","Agatha","Agnes","Ava","Benedicta","Berta","Gertrude","Helena","Olge","Sophia","Susanne","Yolande","Agnes","Albertina","Alexandra","Amanda","Amber","Amelia","Angela","Angelina","Angelique","Anita","Anna","Annabel","Anne","Annemarie","Antonia","Augusta","Beatrix","Brigitta","Carla","Caroline","Catharina","Cecilia","Charlotte","Christina","Christine","Claudia","C\xE9cile","Daphne","Debora","Denise","Diana","Dora","Dorothea","Edith","Elisabeth","Elise","Ellen","Emma","Esther","Eva","Eveline","Felicia","Georgina","Gertie","Gertrude","Hanna","Hannah","Helena","Henrietta","Henriette","Hilda","Hilde","Ida","Irena","Iris","Isabella","Isabelle","Jetta","Johanna","Julia","Juliana","Justine","Karen","Katrina","Lara","Laura","Laurie","Linda","Lisa","Louisa","Louise","Magda","Magdalena","Maria","Marianne","Marilou","Maud","Melissa","Mia","Michelle","Mina","Nicole","Nicolet","Nora","Paula","Petra","Rachel","Rebekka","Renate","Ren\xE9e","Rosa","Rosanne","Samantha","Sandra","Sara","Saskia","Sophie","Susanna","Tina","Trudy","Ursula","Vanessa","Vera","Willemina","Wilma","Yvonne","Zo\xEB","Eva","Jenna","Gwen","Gwenneth","Gwynne","Jena","Kerra","Lowenna","Merryn","Pasca","Tamsin","Tressa","Ad\xE9la\xEFde","Adeline","Agn\xE8s","Alberte","Albertine","Alex","Alexandra","Alexandrine","Alexis","Alice","Alix","Ana\xEFs","Anastasie","Angeline","Ang\xE9lique","Anna","Annabelle","Anne","Annette","Annie","Antoinette","Ariel","Astrid","Augustine","Aurore","Babette","Barbara","B\xE9atrice","B\xE9r\xE9nice","Bernadette","Berthe","Blanche","Brigitte","Camille","Caroline","Cassandra","Catherine","C\xE9cile","C\xE9leste","Charlotte","Chlo\xE9","Christine","Claire","Clarisse","Claudette","Cl\xE9mentine","Colette","Constance","Danielle","Daphn\xE9","Daphn\xE9e","Denise","Diane","Dominique","\xC9dith","El\xE9onore","\xC9lisabeth","\xC9lo\xEFse","Emma","Emmanuelle","Ernestine","Estelle","Esther","\xC8ve","Eveline","Fanny","F\xE9licit\xE9","Fifi","Florence","Florentine","Francine","Francis","Gabrielle","Genevi\xE8ve","Georgette","Georgine","Gigi","Gilberte","Gwendoline","Hannah","Henriette","Hortense","Ir\xE8ne","Iris","Isabelle","Jacqueline","Jeanette","Jeanine","Jessica","Joanne","Jos\xE9phine","Judith","Juliane","Julie","Juliette","Justine","Lili","Lilian","Linda","Louise","Lucille","Madeleine","Margot","Marianne","Marie","Marilou","Marthe","M\xE9lissa","M\xE9lody","Michelle","Modeste","Monique","Muriel","Nadine","Nathalie","Nicole","Nina","Pauline","P\xE9n\xE9lope","Rachel","R\xE9becca","Ren\xE9e","Rosalie","Rose","Rosette","Roxanne","Sandra","Sara","Sarah","Sophie","St\xE9phanie","Suzanne","Suzette","Sylvie","Valentine","Violette","Virginie","Wanda","akemi","aki","akiko","akira","aya","chiyo","hana","hanako","haruka","hitomi","kasumi","keiko","mai","mariko","michiko","mitsuko","nana","naomi","natsumi","noriko","ren","rina","sakura","setsuko","yoko","Abiga\xEDl","Adelaida","Adriana","Alexandra","Alexis","Alicia","Alma","Amada","Amanda","Am\xE9rica","Ana","Anabel","Ana Mar\xEDa","Ana Sof\xEDa","Anastasia","Andrea","\xC1ngela","Ang\xE9lica","Angelina","Anita","Ariel","Aurelia","Beatriz","Berta","Blanca","Camila","Carla","Carmen","Carolina","Clara","Clementina","Conchita","Consuela","Cristina","Dalia","Delia","Diana","Dolores","Dominga","Dora","Dulce","Elena","Elisa","Elodia","Elo\xEDsa","Emilia","Emma","Encarnita","Esmeralda","Esperanza","Esther","Eulalia","Eva","Eva Mar\xEDa","Evangelina","Evita","Fanny","F\xE1tima","Felicia","Felipa","Flora","Florentina","Fran","Francisca","Gabriela","Georgina","Gertrudis","Gisela","Gloria","Guadalupe","Hayd\xE9e","Hilda","In\xE9s","Irene","Iris","Irma","Isabela","Isidora","Jenifer","Jennifer","Jenny","Jessica","Johana","Josefina","Juanita","Judith","Julia","Julieta","Justina","Laura","Leandra","Leticia","Liliana","Lola","Lolita","Luna","Lupe","Magdalena","Marcela","Marcia","Margarita","Mar\xEDa","Mar\xEDa Carmen","Mar\xEDa Cristina","Mar\xEDa Dolores","Mar\xEDa Fernanda","Mar\xEDa Guadalupe","Mar\xEDa Jes\xFAs","Mar\xEDa Jos\xE9","Mar\xEDa Luisa","Mar\xEDa Manuela","Mariana","Mar\xEDa Teresa","Marisa","Maritza","Marta","Matilde","Mercedes","Miriam","Modesta","M\xF3nica","Nadia","Natalia","Octavia","Ofelia","Olga","Olivia","Oriana","Paloma","Paola","Patricia","Paula","Paulina","Paz","Perla","Perlita","Pilar","Priscila","Ramona","Raquel","Regina","Remedios","Renata","Rita","Roberta","Rosa","Rosario","Ruth","Sandra","Sara","Selena","Silvia","Sof\xEDa","Soledad","Susana","Tamara","Teresa","\xDArsula","Valentina","Valeria","Vera","Ver\xF3nica","Victoria","Violeta","Virginia","Viviana","Yasmina","Yolanda"],surname:["Ahearn","Bell","Berryman","Boden","Bray","Brock","Burrows","Connor","Craddick","Crocker","Deane","Drew","Evans","Fry","Gay","Godden","Goldsworthy","Hancock","Hart","Harvey","Hawke","Hoskins","Hutchens","James","Jewell","Johns","Kemp","Kent","Kinsey","Kirby","Lowry","Lean","Lyon","May","Moon","Nance","Nicholls","Oates","Pawley","Perrin","Phillips","Quick","Rickard","Roach","Roberts","Rodgers","Sanders","Symons","Stevens","Thorne","Warren","Franke","Peeters","Aaldenberg","Aalders","Abram","Abrams","Acker","Addens","Adema","Ahlers","Akkerman","Alberda","Alberdink","Albers","Alberts","Alders","Alting","Arntz","Baker","Banner","Beringer","Beulens","Boer","Boon","Bosch","Brams","Brinkerhoff","Carman","Clark","Cuyper","Dahl","Dahlman","De Witte","Dirks","Dreyer","Dykstra","Evers","Franke","Haas","Hansen","Hendrix","Herberts","Herman","Heyman","Holt","Hummel","Jacobs","Jacobson","Jansen","Jansing","Karl","King","Klein","Koning","Krantz","Lucas","Lyon","Michel","Miller","Moore","Nagel","Peeters","Peters","Philips","Richard","Robert","Roosevelt","Samson","Schneider","Schuyler","Schwarzenberg","Seeger","Smith","Snyder","Thomas","Van Aalsburg","Van Buren","Van Der Beek","Van Der Veen","Van Hassel","Van Horn","Van Houte","fujimoto","hayashi","kimura","kurosawa","matsumoto","minami","suzuki","yamaguchi","Babineaux","Barre","Beaufort","Beaumont","Bellamy","Belmont","Berger","Bernard","Blanchard","Bonhomme","Borde","Charpentier","Chevalier","Colbert","Coste","David","Deforest","Delacroix","Desroches","Dubois","Duchamps","Dupont","Fabian","Favreau","Fontaine","Forest","Forestier","Fran\xE7ois","Garcon","Germain","Giles","Granger","Hardy","Harman","Herbert","Jordan","Labelle","Lachance","Lachapelle","Lane","Lapointe","Larue","Laurent","Lebeau","Leblanc","Leclair","Leroy","Lyon","Marchand","Martel","Martin","Montagne","Mullins","Olivier","Page","Pettigrew","Pierre","Renaud","Robert","Roche","Rose","Roy","Salmon","Samson","Sargent","Sauvage","Segal","S\xE9verin","Simon","Thayer","Thomas","Tolbert","Travers","Tremblay","Vincent","Abel","Abraham","Acosta","Aguilar","Alfaro","Alonso","Alvarado","\xC1lvarez","Amador","Antonio","Ant\xFAnez","Armando","Arriola","Asturias","Banderas","Bautista","Bello","Belmonte","Blanco","Bol\xEDvar","Bustos","Caballero","Cabrera","Campo","Campos","Carrasco","Castellano","Castilla","Castillo","Castro","Cervantes","Col\xF3n","Cortez","Cruz","De la Cruz","De Le\xF3n","Delgado","Del R\xEDo","D\xEDaz","Dom\xEDnguez","Escarr\xE0","Espinosa","Espinoza","Esteban","Est\xE9vez","Feliciano","Fern\xE1ndez","Fierro","Figueroa","Flores","Fontana","Franco","Fuentes","Garc\xEDa","Gaspar","Gim\xE9nez","G\xF3mez","Gonzales","Gonz\xE1lez","Guti\xE9rrez","Hern\xE1ndez","Herrera","Hidalgo","Ibarra","Ju\xE1rez","Le\xF3n","Lopez","Lorenzo","Loyola","Lucas","Luna","Machado","Marino","M\xE1rquez","Mart\xEDn","Mart\xEDnez","Martinez","M\xE9ndez","Mendoza","Molina","Montero","Morales","Moralez","Mu\xF1oz","Navarro","Olmos","Ortega","Padilla","Paz","P\xE9rez","Perez","Quesada","Ram\xEDrez","Ramos","Reyes","R\xEDos","Rivera","Rodr\xEDguez","Rodriquez","Romero","Rosales","Rosario","Rubio","Ruiz","Salamanca","Salinas","S\xE1nchez","Sanchez","Santana","Santiago","Santos","Sierra","Silva","Torres","Valencia","Vega","Vel\xE1squez","Vidal"]}];var Le=class{constructor(){this.events={},this.debug=!1}listenerIndex(e,r){return this.events[e].findIndex(n=>n.listener===r)}on(e,r,n=null){if(typeof r=="function"){if(this.events[e]=this.events[e]||[],this.events[e].length>0){let i=this.listenerIndex(e,r);i>-1&&this.events[e].splice(i,1)}this.events[e].push({listener:r,boundObj:n})}}off(e,r){if(Array.isArray(this.events[e])){let n=this.listenerIndex(e,r);if(n===-1)return;this.events[e].splice(n,1),this.events[e].length===0&&delete this.events[e]}}once(e,r,n){this.on(e,function i(){this.off(e,i);let o=typeof n=="undefined"?this:n;r.apply(o,arguments)})}trigger(e){this.debug&&console&&console.log(`EventEmitter triggered: ${e}`);let r=[].slice.call(arguments,1);Array.isArray(this.events[e])&&this.events[e].forEach(n=>{let i=n.boundObj===null?this:n.boundObj;n.listener.apply(i,r)})}};var Be=new Le,nr=new Ci({}),qt={},Fi=[];Ri.forEach(t=>{Fi.push(new rr(t))});var Pi=new Oi({namedata:Fi});nr.registerTokenType("name",Pi.nameTokenCallback.bind(Pi));Mi.forEach(t=>{let e=t.key;!e||(qt[e]=new Se(t))});var dc=function(t){return qt[t]?qt[t]:null};nr.setTableKeyLookup(dc);var qi=function(){let t=[];return Object.keys(qt).forEach(e=>{let r=qt[e];t.push(r)}),t};var Ii=function(t,e=""){return nr.getResultSetForTable(t,e)};var ge=function(t){return nr.convertToken(t)};var Li=document.createElement("template");Li.innerHTML=` +`)}),r.trim()}toString(){return this.niceString()}toJSON(){let e=K.call(this);return e.className="RandomTableResultSet",e}};var Bt=class{constructor({die:e="",value:r=0}){this.die=e,this.value=r}toString(){return this.value}toJSON(){return{className:"DiceResult",die:this.die,value:this.value}}},cc=function(t=6,e=1,r=0,n="+"){r=parseInt(r,10),t=parseInt(t,10),e<=0?e=1:e=parseInt(e,10);let i=0;for(let o=1;o<=e;o++)i=i+sn(1,t);if(r===0)return i;switch(n){case"*":i=i*r;break;case"-":i=i-r;break;case"/":i=i/r;break;case"+":default:i=i+r;break}return Math.round(i)},sr=function(t=""){t=t.trim();let e=t.match(/^([0-9]*)d([0-9]+)(?:([\+\-\*\/])([0-9]+))*$/);return e?cc(e[2],e[1],e[4],e[3]):""},Mi=function(t=""){return new Bt({die:t,value:sr(t)})};var Fi=class extends Error{constructor(e){super(e);this.name="TableError"}},tt=Fi;var dc=/({{2}.+?}{2})/g,Pi=class{constructor({token_types:e={}}){this.token_types={roll:this._defaultRollToken.bind(this),table:this._defaultTableToken.bind(this)},Object.keys(e).forEach(r=>{this.token_types[r]=e[r]})}_getErrorResult(e="",r=""){return new be({table:r,result:e})}_getErrorResultSet(e=""){return new Te({results:[this._getErrorResult(e)]})}_selectFromTable(e,r){if(!(e instanceof De))return[this._getErrorResult("Invalid table.")];let n=[],i=e.getRandomEntry(r);if(i===null||!(i instanceof Be))return[this._getErrorResult("Invalid subtable name.",r)];if(i.print){let o=this.findToken(i.label,e);n.push(new se({table:r,result:o,desc:i.description}))}return i.subtable.length===0||i.subtable.forEach(o=>{let a=this._selectFromTable(e,o);n=n.concat(a)}),n}_getTableMacroResult(e){let r=[];try{e.macro.forEach(n=>{let i=n.split(":"),o=i[0],a=i[1]||"";if(o===e.key)throw new tt("Macros can't self reference.");try{let s=this.getTableByKey(o),l=this.getTableResult(s,a);r=r.concat(l)}catch(s){if(s instanceof tt)r.push(this._getErrorResult(s.message,o));else throw s}})}catch(n){if(n instanceof RangeError)r.push(this._getErrorResult(n.message));else throw n}return r}getTableResult(e,r=""){if(!(e instanceof De))return[this._getErrorResult("No table found to roll on.")];let n=[];if(e.macro.length>0)return this._getTableMacroResult(e);let i=e.getSequence(r);if(i.length===0)return n;try{i.forEach(o=>{let a=this._selectFromTable(e,o);n=n.concat(a)})}catch(o){if(o instanceof RangeError)n.push(this._getErrorResult(o.message));else throw o}return n}getTableResultSetByKey(e,r=""){try{let n=this.getTableByKey(e),i=this.getTableResult(n,r);return new Te({title:n.title,results:i,displayOptions:n.display_opt})}catch(n){if(n instanceof tt)return this._getErrorResultSet(n.message);throw n}}getResultSetForTable(e,r=""){if(!(e instanceof De))return this._getErrorResultSet("Invalid table data.");let n=this.getTableResult(e,r);return new Te({title:e.title,results:n,displayOptions:e.display_opt})}convertToken(e,r=null){let n=e.replace("{{","").replace("}}","").split(":");if(n=n.map(i=>i.trim()),n.length===0)return e;try{return this.token_types[n[0]]?this.token_types[n[0]](n,e,r):e}catch(i){if(i instanceof RangeError)return this._getErrorResultSet(i.message);throw i}}findToken(e,r=null){return Q(e)?"":e.replace(dc,i=>this.convertToken(i,r).toString())}setTableKeyLookup(e){this._customGetTableByKey=e}_customGetTableByKey(e){return null}getTableByKey(e){if(!e)throw new tt("No table key.");let r=this._customGetTableByKey(e);if(!r||!(r instanceof De))throw new tt(`No table found for key: ${e}`);return r}registerTokenType(e,r){this.token_types[e]=r}_defaultRollToken(e,r="",n=null){return Mi(e[1])}_defaultTableToken(e,r,n=null){if(on(e[1]))return r;let i=1;if(e[1].indexOf("*")!==-1){let l=e[1].split("*");e[1]=l[0],i=l[1]}let o=null;if(e[1]==="this"){if(!n)return r;o=n}else try{o=this.getTableByKey(e[1])}catch(l){if(l instanceof tt)return r;throw l}if(typeof e[2]!="undefined"&&e[2].indexOf("*")!==-1){let l=e[2].split("*");e[2]=l[0],i=l[1]}let a=on(e[2])?"":e[2],s=[];for(let l=1;l<=i;l++)s.push(this.getResultSetForTable(o,a));return s.length===1?s[0]:s}},lr=Pi;var qi=class{constructor({memory:e={},separator:r="",order:n=2}){this.memory=e,this.separator=r,this.order=n}isMemoryKeySet(e){return!!this.memory[e]}genInitial(){return Array(this.order).fill("")}getRandomValue(e){return e[Math.floor(Math.random()*e.length)]}breakText(e,r){let n=e.split(this.separator),i=this.genInitial();n.forEach(o=>{o=o.toLowerCase(),r(i,o),i.shift(),i.push(o)}),r(i,"")}learn(e,r){let n=this.memory[e]?this.memory[e]:{};this.breakText(r,(i,o)=>(n[i]||(n[i]=[]),n[i].push(o),n)),this.memory[e]=n}step(e,r){let n=this.memory[this.cur_key][e]||[""],i=this.getRandomValue(n);if(!i)return r;r.push(i);let o=e.slice(1);return o.push(i),this.step(o,r)}generate(e,r){return r||(r=this.genInitial()),this.cur_key=e,r.concat(this.step(r,[])).join(this.separator)}},Ii=qi;var Li=class extends Error{constructor(e){super(e);this.name="RandomNameError"}},ee=Li;var ft=class{constructor({key:e="",label:r="",male:n=[],female:i=[],surname:o=[]}){this.key=e,this.label=r||e,this.male=Array.isArray(n)?n:[],this.female=Array.isArray(i)?i:[],this.surname=Array.isArray(o)?o:[]}getAllPersonalNames(){return Array.prototype.concat(this.male,this.female)}getPersonalNameList(e="random"){if(e==="mixed"||e==="")return this.getAllPersonalNames();if(e==="male")return this.male;if(e==="female")return this.female;let r=[];return this.male.length>0&&r.push("male"),this.female.length>0&&r.push("female"),r.length===0?[]:(e=ze(r),this[e])}toJSON(){let e=K.call(this);return e.className="RandomNameType",e}};var ht=function(t){if(!t)return"";let e=["of","the","from","de","le","la"];return t.split(" ").map(i=>e.indexOf(i)>=0?i:`${Ie(i)}`).join(" ")},Bi=class{constructor({namedata:e=[],markovOrder:r=3}){this.nameTypes=new Map,Array.isArray(e)&&e.forEach(n=>{this.registerNameType(n)}),this._markov=new Ii({order:r})}registerNameType(e){if(!(e instanceof ft))throw new ee("Must be instance of RandomNameType");if(!e.key)throw new ee("RandomNameType must have key set.");if(e.key==="random")throw new ee(`RandomNameType key ${e.key} is reserved.`);if(e.male.length===0&&e.female.length===0&&e.surname.length===0)throw new ee(`RandomNameType ${e.key} must include male, female, or surname lists.`);this.nameTypes.set(e.key,e)}_validateNameType(e,r=""){let n=this.nameTypes.get(e);if(!n)throw new ee("Invalid name type.");if(!!r&&(!Array.isArray(n[r])||n[r].length===0))throw new ee(`${e} type does not have subtype ${r}`)}getValidNameTypes(){return Array.from(this.nameTypes.keys())}getRandomNameType(){return ze(Array.from(this.nameTypes.keys()))||""}_getNameType(e){e==="random"&&(e=this.getRandomNameType());let r=this.nameTypes.get(e);if(!r)throw new ee("Invalid name type.");return r}_getNameList(e="random",r="mixed"){let n=this._getNameType(e);if(r==="surname"){if(n.surname.length===0)throw new ee(`${e} type does not have subtype ${r}`);return n.surname}let i=n.getPersonalNameList(r);if(i.length===0)throw new ee(`${e} type does not have subtype ${r}`);return i}selectPersonalName(e="random",r="random"){let n=this._getNameList(e,r);return ht(ze(n))}selectSurname(e="random"){let r=this._getNameList(e,"surname");return ht(ze(r))}selectName(e="random",r="random",n=""){let i=this._getNameType(e),o=i.getPersonalNameList(r);if(o.length===0)throw new ee(`${i.key} does not have list for ${r}`);let a=ht(ze(o));return n!=="first"&&i.surname.length>0&&(a+=` ${ht(ze(i.surname))}`),a.trim()}createPersonalName(e="random",r="random"){let n=this._getNameType(e),i=n.getPersonalNameList(r);if(i.length===0)throw new ee("Starting name list is empty.");let o=`${n.key}_${r}`;return this._markov.isMemoryKeySet(o)||i.forEach(a=>{this._markov.learn(o,a)}),ht(this._markov.generate(o).trim())}createSurName(e="random"){let r=this._getNameType(e),n=r.surname;if(n.length===0)throw new ee("Starting name list is empty.");let i=`${r.key}_surname`;return this._markov.isMemoryKeySet(i)||n.forEach(o=>{this._markov.learn(i,o)}),ht(this._markov.generate(i).trim())}createName(e="random",r="random",n=""){e==="random"&&(e=this.getRandomNameType());let i=this.createPersonalName(e,r);return n!=="first"&&(i=`${i} ${this.createSurName(e)}`),i.trim()}generateList(e=10,r="random",n=!1){let i={male:[],female:[]};for(let o=1;o<=e;o++){let a=o<=Math.ceil(e/2)?"male":"female";n?i[a].push(this.createName(r,a)):i[a].push(this.selectName(r,a))}return i}nameTokenCallback(e,r="",n=null){let i="";e[1]||(e[1]="random"),(!e[3]||e[3]!=="first")&&(e[3]=""),e[2]||(e[2]="random");try{i=this.selectName(e[1],e[2],e[3])}catch(o){if(o instanceof ee)return"";throw o}return i}},zi=Bi;var ji=[{id:3,key:"npcs",title:"NPC Characteristics",sequence:["size","manner","physical_trait","quirk","speech"],tables:{size:["Short","Thin","Average","Tall","Large","Pick Two"],dress:["Cleancut","Filthy","Fancy","Practical","Rich","Uniform"],manner:["Gregarious","Icy","Pious","Flirtacious / Obsequious","Aggressive / Critical","Reserved"],physical_trait:["Missing Limb","Hairy","Unusual hair","Muscular","Unusually Attractive","Unusually Ugly"],quirk:["Touchy","Fingers Talisman [crucifix/ring/gun]","Ticket/Fidgety","Bad Sense [sight/hearing]","Drinks/Smokes Profusely","Gestures a lot"],speech:["Stutters","Florid","Terse","Curses excessively","Laughs a lot","Meandering"]}},{id:4,key:"jobs",title:"NPC Jobs",display_opt:[{table:"worker",hide_table:!0},{table:"merchant",hide_table:!0},{table:"craftsman",hide_table:!0},{table:"professional",hide_table:!0},{table:"wealthy",hide_table:!0},{table:"neer_do_well",hide_table:!0}],tables:{default:[{label:"Worker",subtable:"worker",print:!1},{label:"Merchant",subtable:"merchant",print:!1},{label:"Craftsman",subtable:"craftsman",print:!1},{label:"Professional",subtable:"professional",print:!1},{label:"Wealthy",subtable:"wealthy",print:!1},{label:"Ne'er Do Well",subtable:"neer_do_well",print:!1}],worker:["Farmer","Bartender","Clerk","Cowboy","Soldier","Laundress","Prostitute","Logger","Parent","Miner","Trapper","Unemployed"],merchant:["General Store","Bathhouse","Hotel/Boarding","Saloon","Pimp","Hardware","Livery","Foreman/Manager","Food/Cafe","Freight","Haberdasher","Feed Barn"],craftsman:["Blacksmith","Wainwright","Brewer/Distiller","Saddler","Tailor","Barber","Cook","Butcher","Gunsmith","Sawmill","Carpenter","?"],professional:["Doctor","Lawyer","Newspaper Editor","Teacher","Sheriff","Army Officer","Preacher","Telegraph Operator","Conductor","Assayer","Surveyor","Marshal"],wealthy:["Mine Owner","Cattle Baron","Trust Fund Child","Banker","Politician","Nouveau Riche"],neer_do_well:["Gambler","Addict","Gunfighter","Actor","Musician","Dancer","Thug","Gossip","Thief","Gigolo","Hermit","Vigilante"]}},{id:5,key:"goals",title:"NPC Goals",display_opt:[{table:"long_term",hide_table:!0},{table:"short_term",hide_table:!0},{table:"secrets",hide_table:!0}],tables:{long_term:["Wealth","Safety [family/self]","Civic Good","Knowledge/Skill/Craft","Piety/Charity","Status/Power","Peace & Quiet","Passion"],short_term:["Business Deal","Pleasure/Addiction","Property","Specific Object","Money","Job/Work","Love/Lust/Desire","Revenge/Hate"],secrets:["Love\u2019s another\u2019s spouse [mutual/unrequited/unexpressed]","Fled a murder rap [innocent/guilty]","Fraud at profession","Hidden vice [dope/alcohol/sex]","Secret child in town","Ran with a bad bunch of hombres","Owes a lot of money / Broke","Hallucinatory visions [religious/psychotic]"]}},{id:6,key:"relationships",title:"NPC Relationships",tables:{default:[{label:"Hate",weight:1},{label:"Dislike",weight:5},{label:"Suspicious",weight:7},{label:"Neutral",weight:10},{label:"Like",weight:7},{label:"Friend",weight:5},{label:"Love",weight:1}],specific:["Lovers [current/former]","Enemies [long term/recent/former]","Rivalry [business/love]","Loaner/Debtor","Comrades [current/former] [business/army/mines/banditry/cowboys]","Employer/Employee [current/former]","Family [happy/secret/estranged]"],faction:["Community leaders (business owners)","Pious church goers","Miners/Loggers [union]","Ranchers","The Law (sheriff, deputies, judges, posse members, etc.)","Homesteaders","Bandits"]}},{id:7,key:"events",title:"Events",tables:{regular:["Wedding [jealousy/drunken revelry]","Funeral [murder/inheritance]","Market day [theft/rivalry/strangers]","Holiday","Arrival [stage/train]","Sunday services","Payday at the [mine/ranch/camp]"],crimes:["Drunken brawl","Murder","Theft","Kidnapping","Bandit raid","Shootout","[Stage/train] ambushed","Arson"],natural:["Resource Depletion","Sickness","Rainstorm","Windstorm","Fire","Wild animals"],other:["Territorial dispute [ranchers/farmers/both]","Heartless capitalist tries to run thing","A dark past catches up with someone","Mine collapse/Logging accident","Election","Workers strike","Lynch mob","New business opens","Square dance"]}},{id:8,key:"stranger",title:"A Stranger Comes to Town",tables:{default:["Gunslinger","Pinkerton Detective","Itinerant Preacher","[Son/father/daughter/lover] thought to be dead","Family member with a [problem/past/secret]","Ex-con [stranger/relative/old friend]","Snake Oil Salesman","Rabblerouser","Swindler [man/woman/couple/family]","Rich [worldly/naive] [man/couple/woman] from back East","Bandit [with/out] his gang","Family looking to settle","Destitute men looking for work","Former soldiers [hungry/crazed/in pursuit/pursued]","Bounty hunter with a [recent/old] warrant for [townsperson/bandit/gunslinger]","Traveling salesman","[Troublesome/pitiful] [man/woman] comes to get [family/friend] out of jail","Politician [campaigning/canvassing]","Woman fleeing [fiance/husband]","Travelling Troupe of Actors"]}},{id:10,key:"items",title:"Items",tables:{default:[{label:"weapons",subtable:"weapons",print:!0},{label:"valuables",subtable:"valuables",print:!0},{label:"clothes",subtable:"clothes",print:!0},{label:"consumables",subtable:"consumables",print:!0},{label:"papers",subtable:"papers",print:!0},{label:"other",subtable:"other",print:!0}],weapons:["Famous gunslinger\u2019s pistol","Knife","Gun [shotgun/pistol/rifle]","Bandolier of bullets","Cavalry Sword","Ax","Whip"],valuables:["Wedding band of [live/dead] spouse","Thoroughbred horse","Unopened bottle of imported liquor","Wallet of bills","Pouch of gold","Combination to safe on a photo","Crucifix"],clothes:["Hat [lady\u2019s/man\u2019s] [fine/plain]","Boots [new/muddy/decorative]","Dress [fancy/torn/bloodied]","Shirt [fancy/bloodstained/torn]","Gun belt","Earrings [plain/bejeweled]"],consumables:["Bottle of whisky","Jerky","Tobacco pouch and rolling papers","Canned peaches","Sweet buns","Wine bottle"],papers:["Newspaper [local/nearby /far]","Deed to mines","Arrest warrant","Letter [incriminating/sentimental]","Dime novel","Daguerrotype"],other:["Dice [loaded]","Playing cards [fresh/used]","Keys to [house/business/lockbox/jail]","Hammer [nails]","Pipe and matches","Lantern"]}},{id:9,key:"town_landscape",title:"Landscape Prominent Feature",tables:{default:["Town build on the banks of a winding stream crossed by makeshift bridges.","Town build upon rocky outcrops, street(s) wind back and forth, buildings are all at different levels.","Town grew around a single giant tree, the rest of the land is flat and barren.","Town sits in a narrow valley, overlooked by ridges, main road snakes down to town and then back up and out.","Town built at foot of cliff where the first mine was found.","Town expanded from a small waterfall and pool amongst tall evergreens."]}},{id:11,key:"dressing",title:"Set Dressing",display_opt:[{table:"outside",hide_table:!0},{table:"inside",hide_table:!0}],tables:{outside:["Balconies","Boardwalks","Hitching posts","Water troughs","Fences","Barrels","Mud Puddles","Hand scrawled signs","Water wagon","Log bridges","Water wheels","Framed out buildings","Tents","Horses and Wagons","Posters (Wanted, Ads, Broadsheets)"],inside:["Piano","Billiard table","Dart board","Music box","Spittoons","Bed pans","Paintings [landscape/pretty woman/historical figure]","Mismatched chairs","Makeshift tables","Ladders","Heavy curtains","Wash tubs","Valise filled with dresses","Old Clock","Brightly upholstered chair/couch","Crystal decanter filled with whiskey"]}},{id:1,key:"locations",title:"Locations Outside of Town",tables:{default:["Train [in motion/broken down/stopped by blocked tracks]","Family Farm [abandoned/prospering/failing]","Cattle Ranch","Mine [abandoned/active]","Grazing land [disputed]","River [rapids]","Rocky hills","Deep woods","Religious camp","Bandit camp","Log cabin [abandoned/hideout/hermit]"]}},{id:2,key:"resources",title:"Settlement Resources",tables:{default:["Gold","Lumber","Farmland","Water","Railway","Furs/Game"]}},{id:12,key:"town_name",title:"Town Names",display_opt:[{table:"main",hide_table:!0},{table:"ending1",hide_table:!0},{table:"ending2",hide_table:!0}],tables:{default:[{label:"{{table:this:main}}{{table:this:ending1}}",weight:4},{label:"{{table:this:main}} {{table:this:ending2}}",weight:4},{label:"Fort {{table:this:main}}",weight:1}],main:["Hadley","Smith","Adams","Snake","Elk","Fire","Coal","Oak","Maple","Elm","Wilder","Jackson","Washington","Revere","Franklin","Shallow","Rapid","Gold","Summer","Spring","Nugget","Mary"],ending1:["ville","town","berg","woods"],ending2:["Hollow","Hills","City","Falls","Rapids"]}}];var Hi=[{key:"western",label:"Western",male:["Alan","Conan","Daveth","Denzel","Derrick","Hammitt","Jermyn","Jory","Merryn","Pasco","Tomas","Trelawney","Tremayne","Tristan","Abel","Abraham","Adam","Alan","Albert","Alex","Alexandre","Alfred","Alphonse","Anatole","Andr\xE9","Anselme","Armand","Arthur","Auguste","Barnabus","Benjamin","Bernard","Bertrand","Blaise","Brice","Bruno","C\xE9sar","Charles","Christian","Christophe","Claude","Cyril","Damien","Dan","Daniel","David","Denis","Didier","Dorian","Edgar","\xC9mile","Emmanuel","Ernest","Ethan","\xC9tienne","Eug\xE8ne","Fabien","F\xE9lix","Ferdinand","Florent","Francis","Frank","Fred","Gabriel","Gaspard","Geoffrey","Georges","G\xE9rard","Gilbert","Guillaume","Gustave","Guy","Hector","Hercule","Horace","Jason","Jean","J\xE9r\xE9mie","J\xE9r\xF4me","Jess\xE9","Jonathan","Joseph","Jules","Kevin","Laurent","L\xE9o","L\xE9on","L\xE9onard","Lionel","Lou","Louis","Lucas","Manuel","Marc","Marcel","Martin","Maurice","Maxime","Micha\xEBl","Morgan","Nathan","Nicolas","Odilon","Oscar","Pascal","Patrick","Paul","Philippe","Pierre","Raoul","Rapha\xEBl","Raymond","R\xE9gis","Richard","Robert","Roger","Roland","Ruben","Samson","Samuel","S\xE9bastien","Serge","Simon","Th\xE9o","Th\xE9odore","Th\xE9ophile","Thomas","Tristan","Ulysse","Valentin","Victor","Vincent","Xavier","Yves","Abe","Abraham","Adam","Albert","Alex","Alexander","Alfred","Aloysius","Andreas","Anton","Arthur","Augustus","Bart","Ben","Benjamin","Bernhard","Bert","Bob","Bram","Brecht","Casper","Chris","Christiaan","Cornelius","Damian","Dani\xEBl","David","Dennis","Dick","Dirk","Ed","Edwin","Erik","Ernst","Erwin","Fabian","Felix","Ferdinand","Filip","Frank","Fred","Frederik","Gerard","Gerhard","Gerrit","Gerry","Gilbert","Gustaaf","Hans","Hendrik","Herman","Hieronymus","Hubert","Hugo","Jacob","Jan","Jasper","Jef","Jesse","Jonas","Jonathan","Jordan","Karel","Kasper","Kevin","Lambert","Lars","Leo","Leonard","Leopold","Levi","Louis","Lucas","Marcel","Marco","Mark","Martin","Max","Michael","Mick","Nick","Nico","Olaf","Oliver","Otto","Pascal","Paul","Peter","Philip","Rembrandt","Richard","Rob","Robert","Robin","Roy","Ruben","Rudolf","Rupert","Rutger","Sebastian","Simon","Stefan","Steven","Sven","Theo","Thomas","Tim","Tom","Vincent","Werner","Willem","Willy","Xander","Adam","Adolf","Arnold","Bern","Baldwin","Conrad","Constantin","Egmund","Eric","Finn","Franco","Gerald","Gregorio","Gunther","Henryk","Herman","Hubert","Isaac","Johannes","Knut","Norbert","Otto","Rainer","Richard","Rupert","Rutger","Simon","Stefan","Waldo","Walther","Willem","akira","goro","haruki","ichiro","jiro","ken","ren","shin","shiro","takashi","Aar\xF3n","Abel","Alberto","Albino","Alcides","Alejandro","Alejo","\xC1lex","Alexis","Alfonso","Alfredo","Alonso","\xC1lvaro","Amado","Amador","Anastacio","Andr\xE9s","\xC1ngel","Armando","Arsenio","Arturo","Baldo","Bartolom\xE9","Bautista","Benito","Benjam\xEDn","Bernardo","Berto","Bol\xEDvar","Bonifacio","Bruno","Buenaventura","Carlito","Carlos","Carmelo","C\xE9sar","Che","Chuy","Clemente","Crist\xF3bal","Dar\xEDo","Diego","Domingo","Edgardo","Eduardo","Eladio","El\xEDas","Emiliano","Emilio","Enrique","Esteban","Evaristo","Fabio","Fabricio","Faustino","Feliciano","Felipe","F\xE9lix","Fernando","Fidel","Flavio","Flori\xE1n","Francisco","Gabriel","Gast\xF3n","Geraldo","Gerardo","Gonzalo","Guadalupe","Guillermo","Gustavo","Gutierre","H\xE9ctor","Hern\xE1n","Hernando","Hugo","Ignacio","Isaac","Isidoro","Jaime","Javier","Jes\xFAs","Joaquin","Joel","Jorge","Jose","Jos\xE9 Antonio","Jos\xE9 Luis","Jos\xE9 Manuel","Juan","Juan Carlos","Juan Manuel","Juan Pablo","Julio","Leonardo","Lorenzo","Luciano","Lucio","Luis","Lupe","Manolo","Manuel","Marco","Mariano","Mario","Mateo","Miguel","Nacho","N\xE9stor","Octavio","\xD3scar","Pablo","Paco","Pancho","Pedro","Pepe","Pl\xE1cido","Rafael","Ram\xF3n","Ra\xFAl","Reynaldo","Ricardo","Roberto","Rodrigo","Salvador","Samuel","Sancho","Santos","Sergio","Severino","Silvio","Sim\xF3n","Tito","Tom\xE1s","Valent\xEDn","Vicente","V\xEDctor","Wilfredo"],female:["Adela","Agatha","Agnes","Ava","Benedicta","Berta","Gertrude","Helena","Olge","Sophia","Susanne","Yolande","Agnes","Albertina","Alexandra","Amanda","Amber","Amelia","Angela","Angelina","Angelique","Anita","Anna","Annabel","Anne","Annemarie","Antonia","Augusta","Beatrix","Brigitta","Carla","Caroline","Catharina","Cecilia","Charlotte","Christina","Christine","Claudia","C\xE9cile","Daphne","Debora","Denise","Diana","Dora","Dorothea","Edith","Elisabeth","Elise","Ellen","Emma","Esther","Eva","Eveline","Felicia","Georgina","Gertie","Gertrude","Hanna","Hannah","Helena","Henrietta","Henriette","Hilda","Hilde","Ida","Irena","Iris","Isabella","Isabelle","Jetta","Johanna","Julia","Juliana","Justine","Karen","Katrina","Lara","Laura","Laurie","Linda","Lisa","Louisa","Louise","Magda","Magdalena","Maria","Marianne","Marilou","Maud","Melissa","Mia","Michelle","Mina","Nicole","Nicolet","Nora","Paula","Petra","Rachel","Rebekka","Renate","Ren\xE9e","Rosa","Rosanne","Samantha","Sandra","Sara","Saskia","Sophie","Susanna","Tina","Trudy","Ursula","Vanessa","Vera","Willemina","Wilma","Yvonne","Zo\xEB","Eva","Jenna","Gwen","Gwenneth","Gwynne","Jena","Kerra","Lowenna","Merryn","Pasca","Tamsin","Tressa","Ad\xE9la\xEFde","Adeline","Agn\xE8s","Alberte","Albertine","Alex","Alexandra","Alexandrine","Alexis","Alice","Alix","Ana\xEFs","Anastasie","Angeline","Ang\xE9lique","Anna","Annabelle","Anne","Annette","Annie","Antoinette","Ariel","Astrid","Augustine","Aurore","Babette","Barbara","B\xE9atrice","B\xE9r\xE9nice","Bernadette","Berthe","Blanche","Brigitte","Camille","Caroline","Cassandra","Catherine","C\xE9cile","C\xE9leste","Charlotte","Chlo\xE9","Christine","Claire","Clarisse","Claudette","Cl\xE9mentine","Colette","Constance","Danielle","Daphn\xE9","Daphn\xE9e","Denise","Diane","Dominique","\xC9dith","El\xE9onore","\xC9lisabeth","\xC9lo\xEFse","Emma","Emmanuelle","Ernestine","Estelle","Esther","\xC8ve","Eveline","Fanny","F\xE9licit\xE9","Fifi","Florence","Florentine","Francine","Francis","Gabrielle","Genevi\xE8ve","Georgette","Georgine","Gigi","Gilberte","Gwendoline","Hannah","Henriette","Hortense","Ir\xE8ne","Iris","Isabelle","Jacqueline","Jeanette","Jeanine","Jessica","Joanne","Jos\xE9phine","Judith","Juliane","Julie","Juliette","Justine","Lili","Lilian","Linda","Louise","Lucille","Madeleine","Margot","Marianne","Marie","Marilou","Marthe","M\xE9lissa","M\xE9lody","Michelle","Modeste","Monique","Muriel","Nadine","Nathalie","Nicole","Nina","Pauline","P\xE9n\xE9lope","Rachel","R\xE9becca","Ren\xE9e","Rosalie","Rose","Rosette","Roxanne","Sandra","Sara","Sarah","Sophie","St\xE9phanie","Suzanne","Suzette","Sylvie","Valentine","Violette","Virginie","Wanda","akemi","aki","akiko","akira","aya","chiyo","hana","hanako","haruka","hitomi","kasumi","keiko","mai","mariko","michiko","mitsuko","nana","naomi","natsumi","noriko","ren","rina","sakura","setsuko","yoko","Abiga\xEDl","Adelaida","Adriana","Alexandra","Alexis","Alicia","Alma","Amada","Amanda","Am\xE9rica","Ana","Anabel","Ana Mar\xEDa","Ana Sof\xEDa","Anastasia","Andrea","\xC1ngela","Ang\xE9lica","Angelina","Anita","Ariel","Aurelia","Beatriz","Berta","Blanca","Camila","Carla","Carmen","Carolina","Clara","Clementina","Conchita","Consuela","Cristina","Dalia","Delia","Diana","Dolores","Dominga","Dora","Dulce","Elena","Elisa","Elodia","Elo\xEDsa","Emilia","Emma","Encarnita","Esmeralda","Esperanza","Esther","Eulalia","Eva","Eva Mar\xEDa","Evangelina","Evita","Fanny","F\xE1tima","Felicia","Felipa","Flora","Florentina","Fran","Francisca","Gabriela","Georgina","Gertrudis","Gisela","Gloria","Guadalupe","Hayd\xE9e","Hilda","In\xE9s","Irene","Iris","Irma","Isabela","Isidora","Jenifer","Jennifer","Jenny","Jessica","Johana","Josefina","Juanita","Judith","Julia","Julieta","Justina","Laura","Leandra","Leticia","Liliana","Lola","Lolita","Luna","Lupe","Magdalena","Marcela","Marcia","Margarita","Mar\xEDa","Mar\xEDa Carmen","Mar\xEDa Cristina","Mar\xEDa Dolores","Mar\xEDa Fernanda","Mar\xEDa Guadalupe","Mar\xEDa Jes\xFAs","Mar\xEDa Jos\xE9","Mar\xEDa Luisa","Mar\xEDa Manuela","Mariana","Mar\xEDa Teresa","Marisa","Maritza","Marta","Matilde","Mercedes","Miriam","Modesta","M\xF3nica","Nadia","Natalia","Octavia","Ofelia","Olga","Olivia","Oriana","Paloma","Paola","Patricia","Paula","Paulina","Paz","Perla","Perlita","Pilar","Priscila","Ramona","Raquel","Regina","Remedios","Renata","Rita","Roberta","Rosa","Rosario","Ruth","Sandra","Sara","Selena","Silvia","Sof\xEDa","Soledad","Susana","Tamara","Teresa","\xDArsula","Valentina","Valeria","Vera","Ver\xF3nica","Victoria","Violeta","Virginia","Viviana","Yasmina","Yolanda"],surname:["Ahearn","Bell","Berryman","Boden","Bray","Brock","Burrows","Connor","Craddick","Crocker","Deane","Drew","Evans","Fry","Gay","Godden","Goldsworthy","Hancock","Hart","Harvey","Hawke","Hoskins","Hutchens","James","Jewell","Johns","Kemp","Kent","Kinsey","Kirby","Lowry","Lean","Lyon","May","Moon","Nance","Nicholls","Oates","Pawley","Perrin","Phillips","Quick","Rickard","Roach","Roberts","Rodgers","Sanders","Symons","Stevens","Thorne","Warren","Franke","Peeters","Aaldenberg","Aalders","Abram","Abrams","Acker","Addens","Adema","Ahlers","Akkerman","Alberda","Alberdink","Albers","Alberts","Alders","Alting","Arntz","Baker","Banner","Beringer","Beulens","Boer","Boon","Bosch","Brams","Brinkerhoff","Carman","Clark","Cuyper","Dahl","Dahlman","De Witte","Dirks","Dreyer","Dykstra","Evers","Franke","Haas","Hansen","Hendrix","Herberts","Herman","Heyman","Holt","Hummel","Jacobs","Jacobson","Jansen","Jansing","Karl","King","Klein","Koning","Krantz","Lucas","Lyon","Michel","Miller","Moore","Nagel","Peeters","Peters","Philips","Richard","Robert","Roosevelt","Samson","Schneider","Schuyler","Schwarzenberg","Seeger","Smith","Snyder","Thomas","Van Aalsburg","Van Buren","Van Der Beek","Van Der Veen","Van Hassel","Van Horn","Van Houte","fujimoto","hayashi","kimura","kurosawa","matsumoto","minami","suzuki","yamaguchi","Babineaux","Barre","Beaufort","Beaumont","Bellamy","Belmont","Berger","Bernard","Blanchard","Bonhomme","Borde","Charpentier","Chevalier","Colbert","Coste","David","Deforest","Delacroix","Desroches","Dubois","Duchamps","Dupont","Fabian","Favreau","Fontaine","Forest","Forestier","Fran\xE7ois","Garcon","Germain","Giles","Granger","Hardy","Harman","Herbert","Jordan","Labelle","Lachance","Lachapelle","Lane","Lapointe","Larue","Laurent","Lebeau","Leblanc","Leclair","Leroy","Lyon","Marchand","Martel","Martin","Montagne","Mullins","Olivier","Page","Pettigrew","Pierre","Renaud","Robert","Roche","Rose","Roy","Salmon","Samson","Sargent","Sauvage","Segal","S\xE9verin","Simon","Thayer","Thomas","Tolbert","Travers","Tremblay","Vincent","Abel","Abraham","Acosta","Aguilar","Alfaro","Alonso","Alvarado","\xC1lvarez","Amador","Antonio","Ant\xFAnez","Armando","Arriola","Asturias","Banderas","Bautista","Bello","Belmonte","Blanco","Bol\xEDvar","Bustos","Caballero","Cabrera","Campo","Campos","Carrasco","Castellano","Castilla","Castillo","Castro","Cervantes","Col\xF3n","Cortez","Cruz","De la Cruz","De Le\xF3n","Delgado","Del R\xEDo","D\xEDaz","Dom\xEDnguez","Escarr\xE0","Espinosa","Espinoza","Esteban","Est\xE9vez","Feliciano","Fern\xE1ndez","Fierro","Figueroa","Flores","Fontana","Franco","Fuentes","Garc\xEDa","Gaspar","Gim\xE9nez","G\xF3mez","Gonzales","Gonz\xE1lez","Guti\xE9rrez","Hern\xE1ndez","Herrera","Hidalgo","Ibarra","Ju\xE1rez","Le\xF3n","Lopez","Lorenzo","Loyola","Lucas","Luna","Machado","Marino","M\xE1rquez","Mart\xEDn","Mart\xEDnez","Martinez","M\xE9ndez","Mendoza","Molina","Montero","Morales","Moralez","Mu\xF1oz","Navarro","Olmos","Ortega","Padilla","Paz","P\xE9rez","Perez","Quesada","Ram\xEDrez","Ramos","Reyes","R\xEDos","Rivera","Rodr\xEDguez","Rodriquez","Romero","Rosales","Rosario","Rubio","Ruiz","Salamanca","Salinas","S\xE1nchez","Sanchez","Santana","Santiago","Santos","Sierra","Silva","Torres","Valencia","Vega","Vel\xE1squez","Vidal"]}];var je=class{constructor(){this.events={},this.debug=!1}listenerIndex(e,r){return this.events[e].findIndex(n=>n.listener===r)}on(e,r,n=null){if(typeof r=="function"){if(this.events[e]=this.events[e]||[],this.events[e].length>0){let i=this.listenerIndex(e,r);i>-1&&this.events[e].splice(i,1)}this.events[e].push({listener:r,boundObj:n})}}off(e,r){if(Array.isArray(this.events[e])){let n=this.listenerIndex(e,r);if(n===-1)return;this.events[e].splice(n,1),this.events[e].length===0&&delete this.events[e]}}once(e,r,n){this.on(e,function i(){this.off(e,i);let o=typeof n=="undefined"?this:n;r.apply(o,arguments)})}trigger(e){this.debug&&console&&console.log(`EventEmitter triggered: ${e}`);let r=[].slice.call(arguments,1);Array.isArray(this.events[e])&&this.events[e].forEach(n=>{let i=n.boundObj===null?this:n.boundObj;n.listener.apply(i,r)})}};var Oe=new je,pt=new lr({}),zt={},Vi=[];Hi.forEach(t=>{Vi.push(new ft(t))});var Gi=new zi({namedata:Vi});pt.registerTokenType("name",Gi.nameTokenCallback.bind(Gi));ji.forEach(t=>{let e=t.key;!e||(zt[e]=new De(t))});var fc=function(t){return zt[t]?zt[t]:null};pt.setTableKeyLookup(fc);var Ui=function(){let t=[];return Object.keys(zt).forEach(e=>{let r=zt[e];t.push(r)}),t};var $i=function(t,e=""){return pt.getResultSetForTable(t,e)};var rt=function(t){return pt.convertToken(t)};var Ji=document.createElement("template");Ji.innerHTML=`

Written in Mar-Apr 2021 by Derik A. Badman https://derikbadman.com Game info and updates at https://madinkbeard.itch.io/hadleyville

-`;var ji=class extends HTMLElement{constructor(){super();this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(zi.content.cloneNode(!0)),this.setAttribute("role","footer")}connectedCallback(){}disconnectedCallback(){}};window.customElements.define("had-footer",ji);var fc=['a[href]:not([tabindex^="-"])','area[href]:not([tabindex^="-"])','input:not([type="hidden"]):not([type="radio"]):not([disabled]):not([tabindex^="-"])','input[type="radio"]:not([disabled]):not([tabindex^="-"])','select:not([disabled]):not([tabindex^="-"])','textarea:not([disabled]):not([tabindex^="-"])','button:not([disabled]):not([tabindex^="-"])','iframe:not([tabindex^="-"])','audio[controls]:not([tabindex^="-"])','video[controls]:not([tabindex^="-"])','[contenteditable]:not([tabindex^="-"])','[tabindex]:not([tabindex^="-"])'],hc=9,pc=27;function se(t){this._show=this.show.bind(this),this._hide=this.hide.bind(this),this._maintainFocus=this._maintainFocus.bind(this),this._bindKeypress=this._bindKeypress.bind(this),this.$el=t,this.shown=!1,this._id=this.$el.getAttribute("data-a11y-dialog")||this.$el.id,this._previouslyFocused=null,this._listeners={},this.create()}se.prototype.create=function(){return this.$el.setAttribute("aria-hidden",!0),this.$el.setAttribute("aria-modal",!0),this.$el.setAttribute("tabindex",-1),this.$el.hasAttribute("role")||this.$el.setAttribute("role","dialog"),this._openers=It('[data-a11y-dialog-show="'+this._id+'"]'),this._openers.forEach(function(t){t.addEventListener("click",this._show)}.bind(this)),this._closers=It("[data-a11y-dialog-hide]",this.$el).concat(It('[data-a11y-dialog-hide="'+this._id+'"]')),this._closers.forEach(function(t){t.addEventListener("click",this._hide)}.bind(this)),this._fire("create"),this};se.prototype.show=function(t){return this.shown?this:(this._previouslyFocused=document.activeElement,this.$el.removeAttribute("aria-hidden"),this.shown=!0,Hi(this.$el),document.body.addEventListener("focus",this._maintainFocus,!0),document.addEventListener("keydown",this._bindKeypress),this._fire("show",t),this)};se.prototype.hide=function(t){return this.shown?(this.shown=!1,this.$el.setAttribute("aria-hidden","true"),this._previouslyFocused&&this._previouslyFocused.focus&&this._previouslyFocused.focus(),document.body.removeEventListener("focus",this._maintainFocus,!0),document.removeEventListener("keydown",this._bindKeypress),this._fire("hide",t),this):this};se.prototype.destroy=function(){return this.hide(),this._openers.forEach(function(t){t.removeEventListener("click",this._show)}.bind(this)),this._closers.forEach(function(t){t.removeEventListener("click",this._hide)}.bind(this)),this._fire("destroy"),this._listeners={},this};se.prototype.on=function(t,e){return typeof this._listeners[t]=="undefined"&&(this._listeners[t]=[]),this._listeners[t].push(e),this};se.prototype.off=function(t,e){var r=(this._listeners[t]||[]).indexOf(e);return r>-1&&this._listeners[t].splice(r,1),this};se.prototype._fire=function(t,e){var r=this._listeners[t]||[],n=new CustomEvent(t,{detail:e});this.$el.dispatchEvent(n),r.forEach(function(i){i(this.$el,e)}.bind(this))};se.prototype._bindKeypress=function(t){!this.$el.contains(document.activeElement)||(this.shown&&t.which===pc&&this.$el.getAttribute("role")!=="alertdialog"&&(t.preventDefault(),this.hide(t)),this.shown&&t.which===hc&&bc(this.$el,t))};se.prototype._maintainFocus=function(t){this.shown&&!t.target.closest('[aria-modal="true"]')&&!t.target.closest("[data-a11y-dialog-ignore-focus-trap]")&&Hi(this.$el)};function mc(t){return Array.prototype.slice.call(t)}function It(t,e){return mc((e||document).querySelectorAll(t))}function Hi(t){var e=t.querySelector("[autofocus]")||t;e.focus()}function gc(t){return It(fc.join(","),t).filter(function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)})}function bc(t,e){var r=gc(t),n=r.indexOf(document.activeElement);e.shiftKey&&n===0?(r[r.length-1].focus(),e.preventDefault()):!e.shiftKey&&n===r.length-1&&(r[0].focus(),e.preventDefault())}function an(){It("[data-a11y-dialog]").forEach(function(t){new se(t)})}typeof document!="undefined"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",an):window.requestAnimationFrame?window.requestAnimationFrame(an):window.setTimeout(an,16));function le(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n3?e.i-4:e.i:Array.isArray(t)?1:sn(t)?2:ln(t)?3:0}function lt(t,e){return st(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function vc(t,e){return st(t)===2?t.get(e):t[e]}function Vi(t,e,r){var n=st(t);n===2?t.set(e,r):n===3?(t.delete(e),t.add(r)):t[e]=r}function Gi(t,e){return t===e?t!==0||1/t==1/e:t!=t&&e!=e}function sn(t){return Ec&&t instanceof Map}function ln(t){return xc&&t instanceof Set}function ze(t){return t.o||t.t}function un(t){if(Array.isArray(t))return Array.prototype.slice.call(t);var e=to(t);delete e[P];for(var r=ut(e),n=0;n1&&(t.set=t.add=t.clear=t.delete=yc),Object.freeze(t),e&&Ze(t,function(r,n){return ir(n,!0)},!0)),t}function yc(){le(2)}function cn(t){return t==null||typeof t!="object"||Object.isFrozen(t)}function Ne(t){var e=yn[t];return e||le(18,t),e}function _c(t,e){yn[t]||(yn[t]=e)}function dn(){return Lt}function fn(t,e){e&&(Ne("Patches"),t.u=[],t.s=[],t.v=e)}function or(t){hn(t),t.p.forEach(wc),t.p=null}function hn(t){t===Lt&&(Lt=t.l)}function Ui(t){return Lt={p:[],l:Lt,h:t,m:!0,_:0}}function wc(t){var e=t[P];e.i===0||e.i===1?e.j():e.O=!0}function pn(t,e){e._=e.p.length;var r=e.p[0],n=t!==void 0&&t!==r;return e.h.g||Ne("ES5").S(e,t,n),n?(r[P].P&&(or(e),le(4)),Te(t)&&(t=ar(e,t),e.l||sr(e,t)),e.u&&Ne("Patches").M(r[P],t,e.u,e.s)):t=ar(e,r,[]),or(e),e.u&&e.v(e.u,e.s),t!==Qi?t:void 0}function ar(t,e,r){if(cn(e))return e;var n=e[P];if(!n)return Ze(e,function(o,a){return $i(t,n,e,o,a,r)},!0),e;if(n.A!==t)return e;if(!n.P)return sr(t,n.t,!0),n.t;if(!n.I){n.I=!0,n.A._--;var i=n.i===4||n.i===5?n.o=un(n.k):n.o;Ze(n.i===3?new Set(i):i,function(o,a){return $i(t,n,i,o,a,r)}),sr(t,i,!1),r&&t.u&&Ne("Patches").R(n,r,t.u,t.s)}return n.o}function $i(t,e,r,n,i,o){if(be(i)){var a=ar(t,i,o&&e&&e.i!==3&&!lt(e.D,n)?o.concat(n):void 0);if(Vi(r,n,a),!be(a))return;t.m=!1}if(Te(i)&&!cn(i)){if(!t.h.F&&t._<1)return;ar(t,i),e&&e.A.l||sr(t,i)}}function sr(t,e,r){r===void 0&&(r=!1),t.h.F&&t.m&&ir(e,r)}function mn(t,e){var r=t[P];return(r?ze(r):t)[e]}function Ji(t,e){if(e in t)for(var r=Object.getPrototypeOf(t);r;){var n=Object.getOwnPropertyDescriptor(r,e);if(n)return n;r=Object.getPrototypeOf(r)}}function je(t){t.P||(t.P=!0,t.l&&je(t.l))}function gn(t){t.o||(t.o=un(t.t))}function bn(t,e,r){var n=sn(e)?Ne("MapSet").N(e,r):ln(e)?Ne("MapSet").T(e,r):t.g?function(i,o){var a=Array.isArray(i),s={i:a?1:0,A:o?o.A:dn(),P:!1,I:!1,D:{},l:o,t:i,k:null,o:null,j:null,C:!1},l=s,u=ct;a&&(l=[s],u=lr);var c=Proxy.revocable(l,u),d=c.revoke,f=c.proxy;return s.k=f,s.j=d,f}(e,r):Ne("ES5").J(e,r);return(r?r.A:dn()).p.push(n),n}function Ki(t){return be(t)||le(22,t),function e(r){if(!Te(r))return r;var n,i=r[P],o=st(r);if(i){if(!i.P&&(i.i<4||!Ne("ES5").K(i)))return i.t;i.I=!0,n=Wi(r,o),i.I=!1}else n=Wi(r,o);return Ze(n,function(a,s){i&&vc(i.t,a)===s||Vi(n,a,e(s))}),o===3?new Set(n):n}(t)}function Wi(t,e){switch(e){case 2:return new Map(t);case 3:return Array.from(t)}return un(t)}function Yi(){function t(a,s){var l=o[a];return l?l.enumerable=s:o[a]=l={configurable:!0,enumerable:s,get:function(){var u=this[P];return ct.get(u,a)},set:function(u){var c=this[P];ct.set(c,a,u)}},l}function e(a){for(var s=a.length-1;s>=0;s--){var l=a[s][P];if(!l.P)switch(l.i){case 5:n(l)&&je(l);break;case 4:r(l)&&je(l)}}}function r(a){for(var s=a.t,l=a.k,u=ut(l),c=u.length-1;c>=0;c--){var d=u[c];if(d!==P){var f=s[d];if(f===void 0&&!lt(s,d))return!0;var h=l[d],p=h&&h[P];if(p?p.t!==f:!Gi(h,f))return!0}}var m=!!s[P];return u.length!==ut(s).length+(m?0:1)}function n(a){var s=a.k;if(s.length!==a.t.length)return!0;var l=Object.getOwnPropertyDescriptor(s,s.length-1);return!(!l||l.get)}function i(a){a.O&&le(3,JSON.stringify(ze(a)))}var o={};_c("ES5",{J:function(a,s){var l=Array.isArray(a),u=function(d,f){if(d){for(var h=Array(f.length),p=0;p1?m-1:0),b=1;b1?u-1:0),d=1;d=0;i--){var o=n[i];if(o.path.length===0&&o.op==="replace"){r=o.value;break}}i>-1&&(n=n.slice(i+1));var a=Ne("Patches").$;return be(r)?a(r,n):this.produce(r,function(s){return a(s,n)})},t}(),ne=new Cc,Ac=ne.produce,Em=ne.produceWithPatches.bind(ne),xm=ne.setAutoFreeze.bind(ne),km=ne.setUseProxies.bind(ne),Cm=ne.applyPatches.bind(ne),Am=ne.createDraft.bind(ne),Sm=ne.finishDraft.bind(ne),dt=Ac;function _n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ro(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function ur(t){for(var e=1;ei.uuid===r)>-1||t.push(e.payload.note)},updateNote(t,e){let r=e.payload.note.uuid;if(!r)return;let n=t.findIndex(i=>i.uuid===r);n!==-1?t.splice(n,1,e.payload.note):t.push(e.payload.note)},deleteNote(t,e){let r=e.payload.uuid;if(!r)return;let n=t.findIndex(i=>i.uuid===r);n!==-1&&t.splice(n,1)},sortNotes(t,e){let r=e.payload.sortUuids;!Array.isArray(r)||r.length===0||t.sort((n,i)=>{let o=r.indexOf(n.uuid),a=r.indexOf(i.uuid);return o-a})},clearNotes(){return[]},importNotes(t,e){e.payload.notes.forEach(n=>{if(!n.uuid)return;let i=t.findIndex(o=>o.uuid===n.uuid);i!==-1?t.splice(i,1,n):t.push(n)})}}}),{actions:Vc,reducer:Gc}=Hc,{createNote:po,updateNote:mo,deleteNote:go,sortNotes:bo,clearNotes:vo,importNotes:yo}=Vc,_o=Gc;var Uc=ht({name:"npcs",initialState:[],reducers:{createNPC(t,e){let r=e.payload.npc.id;!r||t.findIndex(i=>i.id===r)>-1||t.push(e.payload.npc)},updateNPC(t,e){let r=e.payload.npc.id;if(!r)return;let n=t.findIndex(i=>i.id===r);n!==-1?t.splice(n,1,e.payload.npc):t.push(e.payload.npc)},deleteNPC(t,e){let r=e.payload.id;if(!r)return;let n=t.findIndex(i=>i.id===r);n!==-1&&t.splice(n,1)},sortNPCs(t,e){let r=e.payload.sortUuids;!Array.isArray(r)||r.length===0||t.sort((n,i)=>{let o=r.indexOf(n.id),a=r.indexOf(i.id);return o-a})},clearNPCs(t){return[]},importNPCs(t,e){e.payload.npcs.forEach(n=>{if(!n.id)return;let i=t.findIndex(o=>o.id===n.id);i!==-1?t.splice(i,1,n):t.push(n)})}}}),{actions:$c,reducer:Jc}=Uc,{createNPC:wo,updateNPC:Eo,deleteNPC:xo,sortNPCs:ko,clearNPCs:Co,importNPCs:Ao}=$c,So=Jc;var Kc=ht({name:"town",initialState:[],reducers:{updateTown(t,e){t.splice(0,1,e.payload.town)},clearTown(){return[]}}}),{actions:Wc,reducer:Yc}=Kc,{updateTown:Cn,clearTown:Do}=Wc,To=Yc;var pr=Qt(zo()),md=co({reducer:{notes:_o,npcs:So,town:To},preloadedState:(0,pr.load)(),middleware:t=>t().concat((0,pr.save)())}),q=md;var mr,gd=new Uint8Array(16);function Mn(){if(!mr&&(mr=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!mr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return mr(gd)}var jo=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function bd(t){return typeof t=="string"&&jo.test(t)}var Ho=bd;var J=[];for(gr=0;gr<256;++gr)J.push((gr+256).toString(16).substr(1));var gr;function vd(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=(J[t[e+0]]+J[t[e+1]]+J[t[e+2]]+J[t[e+3]]+"-"+J[t[e+4]]+J[t[e+5]]+"-"+J[t[e+6]]+J[t[e+7]]+"-"+J[t[e+8]]+J[t[e+9]]+"-"+J[t[e+10]]+J[t[e+11]]+J[t[e+12]]+J[t[e+13]]+J[t[e+14]]+J[t[e+15]]).toLowerCase();if(!Ho(r))throw TypeError("Stringified UUID is invalid");return r}var Vo=vd;function yd(t,e,r){t=t||{};var n=t.random||(t.rng||Mn)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(var i=0;i<16;++i)e[r+i]=n[i];return e}return Vo(n)}var jt=yd;var Kl=Qt(Jl()),Ee=class{constructor({uuid:e=null,title:r="",content:n="",collapse:i=!1}){this.title=r,this.content=n,this.collapse=i,e?this.uuid=e:this.uuid=jt()}get id(){return this.uuid}get contentHtml(){return new Kl.default().render(this.content)}toJSON(){let e={};return Object.keys(this).forEach(r=>{let n=this[r];n.length!==0&&(e[r]=n)}),e}};var Ge=new Le,Mr=function(){return q.getState().notes.map(e=>new Ee(e))},Wl=function(t){let r=q.getState().notes.find(n=>n.uuid===t);return r?new Ee(r):null},Rr=function(t,e="view"){return q.dispatch(po({note:t.toJSON()})),Ge.trigger("note:add",{note:t,mode:e}),t},Jt=function(t){q.dispatch(mo({note:t.toJSON()})),Ge.trigger("note:edit",{note:t})},Yl=function(t){q.dispatch(go({uuid:t})),Ge.trigger("note:delete",{id:t})},Zl=function(t){q.dispatch(bo({sortUuids:t}))},Xl=function(){q.dispatch(vo())},Ql=function(t){q.dispatch(yo({notes:t})),t.forEach(e=>{if(!e.uuid)return;let r=new Ee(e);Ge.trigger("note:add",{note:r})})};var eu=document.createElement("template");eu.innerHTML=` +`;var Yi=class extends HTMLElement{constructor(){super();this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Wi.content.cloneNode(!0)),this.setAttribute("role","footer")}connectedCallback(){}disconnectedCallback(){}};window.customElements.define("had-footer",Yi);var hc=['a[href]:not([tabindex^="-"])','area[href]:not([tabindex^="-"])','input:not([type="hidden"]):not([type="radio"]):not([disabled]):not([tabindex^="-"])','input[type="radio"]:not([disabled]):not([tabindex^="-"])','select:not([disabled]):not([tabindex^="-"])','textarea:not([disabled]):not([tabindex^="-"])','button:not([disabled]):not([tabindex^="-"])','iframe:not([tabindex^="-"])','audio[controls]:not([tabindex^="-"])','video[controls]:not([tabindex^="-"])','[contenteditable]:not([tabindex^="-"])','[tabindex]:not([tabindex^="-"])'],pc=9,mc=27;function le(t){this._show=this.show.bind(this),this._hide=this.hide.bind(this),this._maintainFocus=this._maintainFocus.bind(this),this._bindKeypress=this._bindKeypress.bind(this),this.$el=t,this.shown=!1,this._id=this.$el.getAttribute("data-a11y-dialog")||this.$el.id,this._previouslyFocused=null,this._listeners={},this.create()}le.prototype.create=function(){return this.$el.setAttribute("aria-hidden",!0),this.$el.setAttribute("aria-modal",!0),this.$el.setAttribute("tabindex",-1),this.$el.hasAttribute("role")||this.$el.setAttribute("role","dialog"),this._openers=jt('[data-a11y-dialog-show="'+this._id+'"]'),this._openers.forEach(function(t){t.addEventListener("click",this._show)}.bind(this)),this._closers=jt("[data-a11y-dialog-hide]",this.$el).concat(jt('[data-a11y-dialog-hide="'+this._id+'"]')),this._closers.forEach(function(t){t.addEventListener("click",this._hide)}.bind(this)),this._fire("create"),this};le.prototype.show=function(t){return this.shown?this:(this._previouslyFocused=document.activeElement,this.$el.removeAttribute("aria-hidden"),this.shown=!0,Zi(this.$el),document.body.addEventListener("focus",this._maintainFocus,!0),document.addEventListener("keydown",this._bindKeypress),this._fire("show",t),this)};le.prototype.hide=function(t){return this.shown?(this.shown=!1,this.$el.setAttribute("aria-hidden","true"),this._previouslyFocused&&this._previouslyFocused.focus&&this._previouslyFocused.focus(),document.body.removeEventListener("focus",this._maintainFocus,!0),document.removeEventListener("keydown",this._bindKeypress),this._fire("hide",t),this):this};le.prototype.destroy=function(){return this.hide(),this._openers.forEach(function(t){t.removeEventListener("click",this._show)}.bind(this)),this._closers.forEach(function(t){t.removeEventListener("click",this._hide)}.bind(this)),this._fire("destroy"),this._listeners={},this};le.prototype.on=function(t,e){return typeof this._listeners[t]=="undefined"&&(this._listeners[t]=[]),this._listeners[t].push(e),this};le.prototype.off=function(t,e){var r=(this._listeners[t]||[]).indexOf(e);return r>-1&&this._listeners[t].splice(r,1),this};le.prototype._fire=function(t,e){var r=this._listeners[t]||[],n=new CustomEvent(t,{detail:e});this.$el.dispatchEvent(n),r.forEach(function(i){i(this.$el,e)}.bind(this))};le.prototype._bindKeypress=function(t){!this.$el.contains(document.activeElement)||(this.shown&&t.which===mc&&this.$el.getAttribute("role")!=="alertdialog"&&(t.preventDefault(),this.hide(t)),this.shown&&t.which===pc&&vc(this.$el,t))};le.prototype._maintainFocus=function(t){this.shown&&!t.target.closest('[aria-modal="true"]')&&!t.target.closest("[data-a11y-dialog-ignore-focus-trap]")&&Zi(this.$el)};function gc(t){return Array.prototype.slice.call(t)}function jt(t,e){return gc((e||document).querySelectorAll(t))}function Zi(t){var e=t.querySelector("[autofocus]")||t;e.focus()}function bc(t){return jt(hc.join(","),t).filter(function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)})}function vc(t,e){var r=bc(t),n=r.indexOf(document.activeElement);e.shiftKey&&n===0?(r[r.length-1].focus(),e.preventDefault()):!e.shiftKey&&n===r.length-1&&(r[0].focus(),e.preventDefault())}function un(){jt("[data-a11y-dialog]").forEach(function(t){new le(t)})}typeof document!="undefined"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",un):window.requestAnimationFrame?window.requestAnimationFrame(un):window.setTimeout(un,16));var Zt={};Ri(Zt,{create:()=>fi,deleteAll:()=>hi,emitter:()=>Xt,getAll:()=>ci,getById:()=>di,getDisplay:()=>Ph,importAll:()=>pi,remove:()=>ui,save:()=>Nt,sort:()=>Fh});function ue(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n3?e.i-4:e.i:Array.isArray(t)?1:cn(t)?2:dn(t)?3:0}function gt(t,e){return mt(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function yc(t,e){return mt(t)===2?t.get(e):t[e]}function Xi(t,e,r){var n=mt(t);n===2?t.set(e,r):n===3?(t.delete(e),t.add(r)):t[e]=r}function Qi(t,e){return t===e?t!==0||1/t==1/e:t!=t&&e!=e}function cn(t){return xc&&t instanceof Map}function dn(t){return kc&&t instanceof Set}function He(t){return t.o||t.t}function fn(t){if(Array.isArray(t))return Array.prototype.slice.call(t);var e=co(t);delete e[q];for(var r=bt(e),n=0;n1&&(t.set=t.add=t.clear=t.delete=_c),Object.freeze(t),e&&nt(t,function(r,n){return ur(n,!0)},!0)),t}function _c(){ue(2)}function hn(t){return t==null||typeof t!="object"||Object.isFrozen(t)}function Re(t){var e=En[t];return e||ue(18,t),e}function wc(t,e){En[t]||(En[t]=e)}function pn(){return Ht}function mn(t,e){e&&(Re("Patches"),t.u=[],t.s=[],t.v=e)}function cr(t){gn(t),t.p.forEach(Ec),t.p=null}function gn(t){t===Ht&&(Ht=t.l)}function eo(t){return Ht={p:[],l:Ht,h:t,m:!0,_:0}}function Ec(t){var e=t[q];e.i===0||e.i===1?e.j():e.O=!0}function bn(t,e){e._=e.p.length;var r=e.p[0],n=t!==void 0&&t!==r;return e.h.g||Re("ES5").S(e,t,n),n?(r[q].P&&(cr(e),ue(4)),Ne(t)&&(t=dr(e,t),e.l||fr(e,t)),e.u&&Re("Patches").M(r[q],t,e.u,e.s)):t=dr(e,r,[]),cr(e),e.u&&e.v(e.u,e.s),t!==lo?t:void 0}function dr(t,e,r){if(hn(e))return e;var n=e[q];if(!n)return nt(e,function(o,a){return to(t,n,e,o,a,r)},!0),e;if(n.A!==t)return e;if(!n.P)return fr(t,n.t,!0),n.t;if(!n.I){n.I=!0,n.A._--;var i=n.i===4||n.i===5?n.o=fn(n.k):n.o;nt(n.i===3?new Set(i):i,function(o,a){return to(t,n,i,o,a,r)}),fr(t,i,!1),r&&t.u&&Re("Patches").R(n,r,t.u,t.s)}return n.o}function to(t,e,r,n,i,o){if(ve(i)){var a=dr(t,i,o&&e&&e.i!==3&&!gt(e.D,n)?o.concat(n):void 0);if(Xi(r,n,a),!ve(a))return;t.m=!1}if(Ne(i)&&!hn(i)){if(!t.h.F&&t._<1)return;dr(t,i),e&&e.A.l||fr(t,i)}}function fr(t,e,r){r===void 0&&(r=!1),t.h.F&&t.m&&ur(e,r)}function vn(t,e){var r=t[q];return(r?He(r):t)[e]}function ro(t,e){if(e in t)for(var r=Object.getPrototypeOf(t);r;){var n=Object.getOwnPropertyDescriptor(r,e);if(n)return n;r=Object.getPrototypeOf(r)}}function Ve(t){t.P||(t.P=!0,t.l&&Ve(t.l))}function yn(t){t.o||(t.o=fn(t.t))}function _n(t,e,r){var n=cn(e)?Re("MapSet").N(e,r):dn(e)?Re("MapSet").T(e,r):t.g?function(i,o){var a=Array.isArray(i),s={i:a?1:0,A:o?o.A:pn(),P:!1,I:!1,D:{},l:o,t:i,k:null,o:null,j:null,C:!1},l=s,u=vt;a&&(l=[s],u=hr);var c=Proxy.revocable(l,u),d=c.revoke,f=c.proxy;return s.k=f,s.j=d,f}(e,r):Re("ES5").J(e,r);return(r?r.A:pn()).p.push(n),n}function no(t){return ve(t)||ue(22,t),function e(r){if(!Ne(r))return r;var n,i=r[q],o=mt(r);if(i){if(!i.P&&(i.i<4||!Re("ES5").K(i)))return i.t;i.I=!0,n=io(r,o),i.I=!1}else n=io(r,o);return nt(n,function(a,s){i&&yc(i.t,a)===s||Xi(n,a,e(s))}),o===3?new Set(n):n}(t)}function io(t,e){switch(e){case 2:return new Map(t);case 3:return Array.from(t)}return fn(t)}function oo(){function t(a,s){var l=o[a];return l?l.enumerable=s:o[a]=l={configurable:!0,enumerable:s,get:function(){var u=this[q];return vt.get(u,a)},set:function(u){var c=this[q];vt.set(c,a,u)}},l}function e(a){for(var s=a.length-1;s>=0;s--){var l=a[s][q];if(!l.P)switch(l.i){case 5:n(l)&&Ve(l);break;case 4:r(l)&&Ve(l)}}}function r(a){for(var s=a.t,l=a.k,u=bt(l),c=u.length-1;c>=0;c--){var d=u[c];if(d!==q){var f=s[d];if(f===void 0&&!gt(s,d))return!0;var h=l[d],p=h&&h[q];if(p?p.t!==f:!Qi(h,f))return!0}}var m=!!s[q];return u.length!==bt(s).length+(m?0:1)}function n(a){var s=a.k;if(s.length!==a.t.length)return!0;var l=Object.getOwnPropertyDescriptor(s,s.length-1);return!(!l||l.get)}function i(a){a.O&&ue(3,JSON.stringify(He(a)))}var o={};wc("ES5",{J:function(a,s){var l=Array.isArray(a),u=function(d,f){if(d){for(var h=Array(f.length),p=0;p1?m-1:0),b=1;b1?u-1:0),d=1;d=0;i--){var o=n[i];if(o.path.length===0&&o.op==="replace"){r=o.value;break}}i>-1&&(n=n.slice(i+1));var a=Re("Patches").$;return ve(r)?a(r,n):this.produce(r,function(s){return a(s,n)})},t}(),ne=new Cc,Ac=ne.produce,Mm=ne.produceWithPatches.bind(ne),Fm=ne.setAutoFreeze.bind(ne),Pm=ne.setUseProxies.bind(ne),qm=ne.applyPatches.bind(ne),Im=ne.createDraft.bind(ne),Lm=ne.finishDraft.bind(ne),yt=Ac;function xn(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function fo(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function pr(t){for(var e=1;ei.uuid===r)>-1||t.push(e.payload.note)},updateNote(t,e){let r=e.payload.note.uuid;if(!r)return;let n=t.findIndex(i=>i.uuid===r);n!==-1?t.splice(n,1,e.payload.note):t.push(e.payload.note)},deleteNote(t,e){let r=e.payload.uuid;if(!r)return;let n=t.findIndex(i=>i.uuid===r);n!==-1&&t.splice(n,1)},sortNotes(t,e){let r=e.payload.sortUuids;!Array.isArray(r)||r.length===0||t.sort((n,i)=>{let o=r.indexOf(n.uuid),a=r.indexOf(i.uuid);return o-a})},clearNotes(){return[]},importNotes(t,e){e.payload.notes.forEach(n=>{if(!n.uuid)return;let i=t.findIndex(o=>o.uuid===n.uuid);i!==-1?t.splice(i,1,n):t.push(n)})}}}),{actions:Gc,reducer:Uc}=Vc,{createNote:xo,updateNote:ko,deleteNote:So,sortNotes:Co,clearNotes:Ao,importNotes:Do}=Gc,To=Uc;var $c=wt({name:"npcs",initialState:[],reducers:{createNPC(t,e){let r=e.payload.npc.id;!r||t.findIndex(i=>i.id===r)>-1||t.push(e.payload.npc)},updateNPC(t,e){let r=e.payload.npc.id;if(!r)return;let n=t.findIndex(i=>i.id===r);n!==-1?t.splice(n,1,e.payload.npc):t.push(e.payload.npc)},deleteNPC(t,e){let r=e.payload.id;if(!r)return;let n=t.findIndex(i=>i.id===r);n!==-1&&t.splice(n,1)},sortNPCs(t,e){let r=e.payload.sortUuids;!Array.isArray(r)||r.length===0||t.sort((n,i)=>{let o=r.indexOf(n.id),a=r.indexOf(i.id);return o-a})},clearNPCs(t){return[]},importNPCs(t,e){e.payload.npcs.forEach(n=>{if(!n.id)return;let i=t.findIndex(o=>o.id===n.id);i!==-1?t.splice(i,1,n):t.push(n)})}}}),{actions:Jc,reducer:Kc}=$c,{createNPC:Oo,updateNPC:No,deleteNPC:Ro,sortNPCs:Mo,clearNPCs:Fo,importNPCs:Po}=Jc,qo=Kc;var Wc=wt({name:"town",initialState:[],reducers:{updateTown(t,e){t.splice(0,1,e.payload.town)},clearTown(){return[]}}}),{actions:Yc,reducer:Zc}=Wc,{updateTown:Dn,clearTown:Io}=Yc,Lo=Zc;var yr=ar(Wo()),gd=_o({reducer:{notes:To,npcs:qo,town:Lo},preloadedState:(0,yr.load)(),middleware:t=>t().concat((0,yr.save)())}),P=gd;var _r,bd=new Uint8Array(16);function Pn(){if(!_r&&(_r=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!_r))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return _r(bd)}var Yo=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function vd(t){return typeof t=="string"&&Yo.test(t)}var Zo=vd;var $=[];for(wr=0;wr<256;++wr)$.push((wr+256).toString(16).substr(1));var wr;function yd(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=($[t[e+0]]+$[t[e+1]]+$[t[e+2]]+$[t[e+3]]+"-"+$[t[e+4]]+$[t[e+5]]+"-"+$[t[e+6]]+$[t[e+7]]+"-"+$[t[e+8]]+$[t[e+9]]+"-"+$[t[e+10]]+$[t[e+11]]+$[t[e+12]]+$[t[e+13]]+$[t[e+14]]+$[t[e+15]]).toLowerCase();if(!Zo(r))throw TypeError("Stringified UUID is invalid");return r}var Xo=yd;function _d(t,e,r){t=t||{};var n=t.random||(t.rng||Pn)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(var i=0;i<16;++i)e[r+i]=n[i];return e}return Xo(n)}var Ut=_d;var nu=ar(ru()),xe=class{constructor({uuid:e=null,title:r="",content:n="",collapse:i=!1}){this.title=r,this.content=n,this.collapse=i,e?this.uuid=e:this.uuid=Ut()}get id(){return this.uuid}get contentHtml(){return new nu.default().render(this.content)}toJSON(){let e={};return Object.keys(this).forEach(r=>{let n=this[r];n.length!==0&&(e[r]=n)}),e}};var iu=document.createElement("template");iu.innerHTML=` + + +
+ +
{{ note.title }}
+
+ +
+
+ +
+
+
+
+`;var ou=document.createElement("template");ou.innerHTML=` +
+
+ + +
+
+ + +
+
+ + + +
+
+`;var li=class extends HTMLElement{constructor(){super();this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(iu.content.cloneNode(!0)),this._isEdit=!1,this.editButton=this.shadowRoot.querySelector(".btn-edit")}connectedCallback(){this.shadowRoot.querySelector("details").addEventListener("toggle",this._setCollapse.bind(this)),this.editButton.addEventListener("click",this._toggleEdit.bind(this))}disconnectedCallback(){this.shadowRoot.querySelector("details").removeEventListener("toggle",this._setCollapse.bind(this)),this.editButton.removeEventListener("click",this._toggleEdit.bind(this))}setItem(e){this.note=e,this.id=`note_${this.note.id}`,this.dataset.id=this.note.id,this.shadowRoot.querySelector("#summary-title").innerText=e.title,e.collapse?this.shadowRoot.querySelector("details").open=!1:this.shadowRoot.querySelector("details").open=!0,this.shadowRoot.querySelector(".content").innerHTML=this.note.contentHtml}_setCollapse(e){if(this._isEdit)return;let r=!e.target.open;this.note.collapse!==r&&(this.note.collapse=r,Nt(this.note))}collapse(){this.shadowRoot.querySelector("details").open=!1}_toggleEdit(e){if(this._isEdit){this._disableEdit();return}this._enableEdit()}_enableEdit(){if(this._isEdit)return;this._isEdit=!0,this.shadowRoot.querySelector(".body").innerHTML="";let e=ou.content.cloneNode(!0);e.querySelector("input[name=title").value=this.note.title,e.querySelector("textarea[name=content").value=this.note.content,this.shadowRoot.querySelector(".body").appendChild(e),e=this.shadowRoot.querySelector("form"),e.addEventListener("submit",this._saveEdit.bind(this)),e.querySelector(".btn-cancel").addEventListener("click",this._cancelEdit.bind(this)),e.querySelector(".btn-delete").addEventListener("click",this._deleteNote.bind(this))}_cancelEdit(){if(this.note.title===""&&this.note.content===""){this._deleteNote();return}this._toggleEdit()}_disableEdit(){if(!this._isEdit)return;this._isEdit=!1;let e=this.shadowRoot.querySelector("form");e.removeEventListener("submit",this._saveEdit.bind(this)),e.querySelector(".btn-cancel").removeEventListener("click",this._cancelEdit.bind(this)),e.querySelector(".btn-delete").removeEventListener("click",this._deleteNote.bind(this)),this.shadowRoot.querySelector("#summary-title").innerText=this.note.title,this.shadowRoot.querySelector(".body").innerHTML=`
${this.note.contentHtml}
`,this._refocus()}_saveEdit(e){e.preventDefault();let r=new FormData(e.target);this.note.title=r.get("title").toString(),this.note.content=r.get("content").toString(),this._disableEdit(),Nt(this.note)}_deleteNote(){ui(this.note.id)}_refocus(){this.shadowRoot.querySelector("summary").focus()}};window.customElements.define("had-note",li);var au=li;var Xt=new je,ci=function(){return P.getState().notes.map(e=>new xe(e))},di=function(t){let r=P.getState().notes.find(n=>n.uuid===t);return r?new xe(r):null},fi=function(t="view",e=null){return e instanceof xe||(e=new xe({})),P.dispatch(xo({note:e.toJSON()})),Xt.trigger("note:add",{item:e,mode:t}),e},Nt=function(t){P.dispatch(ko({note:t.toJSON()})),Xt.trigger("note:edit",{item:t})},ui=function(t){P.dispatch(So({uuid:t})),Xt.trigger("note:delete",{id:t})},Fh=function(t){P.dispatch(Co({sortUuids:t}))},hi=function(){P.dispatch(Ao())},pi=function(t){P.dispatch(Do({notes:t})),t.forEach(e=>{if(!e.uuid)return;let r=new xe(e);Xt.trigger("note:add",{item:r})})},Ph=function(){return new au};var su=document.createElement("template");su.innerHTML=`
-

Tables

+

Tables

-`;var iu=class extends HTMLElement{constructor(){super();this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(nu.content.cloneNode(!0)),this.setAttribute("role","region"),this.closeButton=this.shadowRoot.querySelector(".btn-close"),qi().forEach(e=>{let r=new ru;r.setTable(e),this.shadowRoot.appendChild(r)})}connectedCallback(){Be.on("table:drawer",this._toggle.bind(this)),this.closeButton.addEventListener("click",this._toggleClick.bind(this))}disconnectedCallback(){Be.off("table:drawer",this._toggle.bind(this)),this.closeButton.removeEventListener("click",this._toggleClick.bind(this))}_toggleClick(e){let r=!0;this.getAttribute("aria-expanded")==="true"&&(r=!1),Be.trigger("table:drawer",{open:r})}_toggle({open:e}){if(e){this.setAttribute("aria-expanded","true");return}this.setAttribute("aria-expanded","false")}};window.customElements.define("had-tabledrawer",iu);var xt=class{constructor({id:e=null,schema:r="",fields:n=new Map}){e===null?this.id=jt():this.id=e,this.schema=r,n instanceof Map?this.fields=n:Ft(n)&&(this.fields=new Map(Object.entries(n)))}getFieldKeys(){return Array.from(this.fields.keys())}getFieldValue(e){return this.fields.get(e)||""}toJSON(){return Q.call(this)}};var V=class{constructor({key:e="",label:r="",type:n="string",source:i="",count:o=1,starting_value:a=null}){this.key=e,this.label=r,this.type=n,this.source=i,this.count=o,a!==null&&(this.starting_value=a)}get defaultEmpty(){switch(this.type){case"string":case"text":return"";case"array":return[];case"number":case"modifier":return 0}return null}toJSON(){return Q.call(this)}};var kt=class{constructor({key:e="",name:r="",author:n="",fields:i=[]}){this.key=e,this.name=r,this.author=n,this.fields=new Map,Array.isArray(i)&&i.forEach(o=>{if(o instanceof V){this.fields.set(o.key,o);return}let a=new V(o);this.fields.set(a.key,a)})}getFieldByKey(e){return this.fields.get(e)}getFieldLabelByKey(e){let r=this.getFieldByKey(e);return r?r.label:""}toJSON(){return Q.call(this)}};var ou=Qt(Or()),tt=new kt({key:"town",name:"Town",fields:[new V({key:"townName",label:"Name",source:"{{table:town_name}}"}),new V({key:"landscape",label:"Prominent Landscape",source:"{{table:town_landscape}}"}),new V({key:"resource",label:"Primary Resource",source:"{{table:resources}}"}),new V({key:"dressing",label:"Set Dressing",source:"{{table:dressing:outside}}",type:"long"}),new V({key:"locations",label:"Location Near Town",source:"{{table:locations}}"}),new V({key:"recent_event",label:"Recent Event",source:"{{table:events}}"}),new V({key:"current_event",label:"Current Event",source:"{{table:events}}"})]}),Ct=class extends xt{constructor({id:e=null,fields:r=new Map}){super({id:e,schema:"town",fields:r})}get name(){return this.getFieldValue("townName").toString()}getFieldDisplay(e){return e==="notes"?this.noteHtml:this.fields.get(e)}setFieldValue(e,r){typeof this.fields.get(e)!="undefined"&&this.fields.set(e,r)}get noteHtml(){return new ou.default().render(this.notes)}};var Rh=function(){let t=new Map;return tt.fields.forEach(e=>{let r=e.key;if(!j(e.starting_value)){t.set(r,e.starting_value);return}if(!j(e.source)){if(e.type==="array"){let n=[],i=e.count?e.count:1;for(let o=0;o{let r=new uu;r.setTable(e),this.shadowRoot.appendChild(r)})}connectedCallback(){this.setAttribute("tabindex",0),Oe.on("table:drawer",this._toggle.bind(this)),this.closeButton.addEventListener("click",this._toggleClick.bind(this)),this.addEventListener("focus",e=>{this.focus(),this.setAttribute("tabindex",-1)}),this.addEventListener("blur",e=>{this.setAttribute("tabindex",0)})}disconnectedCallback(){Oe.off("table:drawer",this._toggle.bind(this)),this.closeButton.removeEventListener("click",this._toggleClick.bind(this))}_toggleClick(e){let r=!0;this.getAttribute("aria-expanded")==="true"&&(r=!1),Oe.trigger("table:drawer",{open:r})}_addOverlay(){this.overlay||(this.overlay=document.createElement("div"),this.overlay.classList.add("overlay"),this.overlay.style.cssText=` + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + background-color: transparent; + z-index: 9;`,this.parentNode.appendChild(this.overlay),this.overlay.addEventListener("click",e=>{Oe.trigger("table:drawer",{open:!1})},{once:!0}))}_removeOverlay(){this.overlay&&(this.overlay.parentNode.removeChild(this.overlay),this.overlay=null)}_toggle({open:e}){if(e){this._addOverlay(),this.setAttribute("aria-expanded","true"),setTimeout(()=>{this.focus()},500);return}this.setAttribute("aria-expanded","false"),this._removeOverlay()}focus(){this.shadowRoot.querySelector("h2").focus()}};window.customElements.define("had-tabledrawer",du);var $e=class{constructor({id:e=null,schema:r="",fields:n=new Map}){if(e===null?this.id=Ut():this.id=e,this.schema=r,n instanceof Map)this.fields=n;else if(et(n)){this.fields=new Map;for(let[i,o]of Object.entries(n))this.fields.set(i,this._convertFieldValue(o))}}_convertFieldValue(e){return typeof e=="undefined"?"":typeof e=="string"?e:Array.isArray("value")?e.map(r=>this._convertFieldValue(r)):e instanceof Te||e instanceof se||e instanceof be||e instanceof Bt?e:e.className==="RandomTableResultSet"?new Te(e):e.className==="RandomTableResult"?new se(e):e.className==="TableErrorResult"?new be(e):e.className==="DiceResult"?new Bt(e):e}setFieldValue(e,r){this.fields.set(e,this._convertFieldValue(r))}getFieldKeys(){return Array.from(this.fields.keys())}getFieldValue(e){return this.fields.get(e)||""}toJSON(){let e=K.call(this);return e.className="NPC",e}};var H=class{constructor({key:e="",label:r="",type:n="string",source:i="",count:o=1,starting_value:a=null}){this.key=e,this.label=r,this.type=n,this.source=i,this.count=o,a!==null&&(this.starting_value=a)}get defaultEmpty(){switch(this.type){case"string":case"text":return"";case"array":return[];case"number":case"modifier":return 0}return null}toJSON(){let e=K.call(this);return e.className="NPCSchemaField",e}};var Je=class{constructor({key:e="",name:r="",author:n="",fields:i=[]}){this.key=e,this.name=r,this.author=n,this.fields=new Map,Array.isArray(i)?i.forEach(o=>{this._convertField(o)}):Object.keys(i).forEach(o=>{this._convertField(i[o])})}_convertField(e){if(e instanceof H){this.fields.set(e.key,e);return}if(et(e)){let r=new H(e);this.fields.set(r.key,r)}}getFieldKeys(){return Array.from(this.fields.keys())}getFieldByKey(e){return this.fields.get(e)}getFieldLabelByKey(e){let r=this.getFieldByKey(e);return r?r.label:""}toJSON(){let e=K.call(this);return e.className="NPCSchema",e}};var fu=ar(qr()),st=new Je({key:"town",name:"Town",fields:[new H({key:"townName",label:"Name",source:"{{table:town_name}}"}),new H({key:"landscape",label:"Prominent Landscape",source:"{{table:town_landscape}}"}),new H({key:"resource",label:"Primary Resource",source:"{{table:resources}}"}),new H({key:"dressing",label:"Set Dressing",source:"{{table:dressing:outside}}",type:"long"}),new H({key:"locations",label:"Location Near Town",source:"{{table:locations}}"}),new H({key:"recent_event",label:"Recent Event",source:"{{table:events}}"}),new H({key:"current_event",label:"Current Event",source:"{{table:events}}"})]}),Rt=class extends $e{constructor({id:e=null,fields:r=new Map}){super({id:e,schema:"town",fields:r})}get name(){return this.getFieldValue("townName").toString()}getFieldDisplay(e){return e==="notes"?this.noteHtml:this.fields.get(e)}setFieldValue(e,r){typeof this.fields.get(e)!="undefined"&&this.fields.set(e,r)}get noteHtml(){return new fu.default().render(this.notes)}};var qh=function(){let t=new Map;return st.fields.forEach(e=>{let r=e.key;if(!Q(e.starting_value)){t.set(r,e.starting_value);return}if(!Q(e.source)){if(e.type==="array"){let n=[],i=e.count?e.count:1;for(let o=0;o -
- -
{{ note.title }}
-
- -
-
- -
-
-
-
-`;var fu=document.createElement("template");fu.innerHTML=` -
-
- - -
-
- - -
-
- - - -
-
-`;var ai=class extends HTMLElement{constructor(){super();this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(du.content.cloneNode(!0)),this._isEdit=!1,this.editButton=this.shadowRoot.querySelector(".btn-edit")}connectedCallback(){this.shadowRoot.querySelector("details").addEventListener("toggle",this._setCollapse.bind(this)),this.editButton.addEventListener("click",this._toggleEdit.bind(this))}disconnectedCallback(){this.shadowRoot.querySelector("details").removeEventListener("toggle",this._setCollapse.bind(this)),this.editButton.removeEventListener("click",this._toggleEdit.bind(this))}setNote(e){this.note=e,this.id=`note_${this.note.id}`,this.dataset.id=this.note.id,this.shadowRoot.querySelector("#summary-title").innerText=e.title,e.collapse?this.shadowRoot.querySelector("details").open=!1:this.shadowRoot.querySelector("details").open=!0,this.shadowRoot.querySelector(".content").innerHTML=this.note.contentHtml}_setCollapse(e){let r=!e.target.open;this.note.collapse!==r&&(this.note.collapse=r,Jt(this.note))}collapse(){this.shadowRoot.querySelector("details").open=!1}_toggleEdit(e){if(this._isEdit){this._disableEdit();return}this._enableEdit()}_enableEdit(){if(this._isEdit)return;this._isEdit=!0,this.shadowRoot.querySelector(".body").innerHTML="";let e=fu.content.cloneNode(!0);e.querySelector("input[name=title").value=this.note.title,e.querySelector("textarea[name=content").value=this.note.content,this.shadowRoot.querySelector(".body").appendChild(e),e=this.shadowRoot.querySelector("form"),e.addEventListener("submit",this._saveEdit.bind(this)),e.querySelector(".btn-cancel").addEventListener("click",this._toggleEdit.bind(this)),e.querySelector(".btn-delete").addEventListener("click",this._deleteNote.bind(this))}_disableEdit(){if(!this._isEdit)return;this._isEdit=!1;let e=this.shadowRoot.querySelector("form");e.removeEventListener("submit",this._saveEdit.bind(this)),e.querySelector(".btn-cancel").removeEventListener("click",this._toggleEdit.bind(this)),e.querySelector(".btn-delete").removeEventListener("click",this._deleteNote.bind(this)),this.shadowRoot.querySelector("#summary-title").innerText=this.note.title,this.shadowRoot.querySelector(".body").innerHTML=`
${this.note.contentHtml}
`}_saveEdit(e){e.preventDefault();let r=new FormData(e.target);this.note.title=r.get("title").toString(),this.note.content=r.get("content").toString(),this._disableEdit(),Jt(this.note)}_deleteNote(){Yl(this.note.id)}};window.customElements.define("had-note",ai);var si=ai;function hu(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function xe(t){for(var e=1;e=0)&&(r[i]=t[i]);return r}function qh(t,e){if(t==null)return{};var r=Ph(t,e),n,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&(!Object.prototype.propertyIsEnumerable.call(t,n)||(r[n]=t[n]))}return r}var Ih="1.14.0";function Oe(t){if(typeof window!="undefined"&&window.navigator)return!!navigator.userAgent.match(t)}var $e=Oe(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),qr=Oe(/Edge/i),pu=Oe(/firefox/i),Ir=Oe(/safari/i)&&!Oe(/chrome/i)&&!Oe(/android/i),mu=Oe(/iP(ad|od|hone)/i),Lh=Oe(/chrome/i)&&Oe(/android/i),gu={capture:!1,passive:!1};function R(t,e,r){t.addEventListener(e,r,!$e&&gu)}function M(t,e,r){t.removeEventListener(e,r,!$e&&gu)}function Lr(t,e){if(!!e){if(e[0]===">"&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch{return!1}return!1}}function Bh(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function ke(t,e,r,n){if(t){r=r||document;do{if(e!=null&&(e[0]===">"?t.parentNode===r&&Lr(t,e):Lr(t,e))||n&&t===r)return t;if(t===r)break}while(t=Bh(t))}return null}var bu=/\s+/g;function ie(t,e,r){if(t&&e)if(t.classList)t.classList[r?"add":"remove"](e);else{var n=(" "+t.className+" ").replace(bu," ").replace(" "+e+" "," ");t.className=(n+(r?" "+e:"")).replace(bu," ")}}function k(t,e,r){var n=t&&t.style;if(n){if(r===void 0)return document.defaultView&&document.defaultView.getComputedStyle?r=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(r=t.currentStyle),e===void 0?r:r[e];!(e in n)&&e.indexOf("webkit")===-1&&(e="-webkit-"+e),n[e]=r+(typeof r=="string"?"":"px")}}function At(t,e){var r="";if(typeof t=="string")r=t;else do{var n=k(t,"transform");n&&n!=="none"&&(r=n+" "+r)}while(!e&&(t=t.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(r)}function vu(t,e,r){if(t){var n=t.getElementsByTagName(e),i=0,o=n.length;if(r)for(;i=o:a=i<=o,!a)return n;if(n===Me())break;n=Br(n,!1)}return!1}function St(t,e,r,n){for(var i=0,o=0,a=t.children;o2&&arguments[2]!==void 0?arguments[2]:{},i=n.evt,o=qh(n,$h);Kt.pluginEvent.bind(C)(e,r,xe({dragEl:_,parentEl:B,ghostEl:S,rootEl:I,nextEl:rt,lastDownEl:zr,cloneEl:z,cloneHidden:Je,dragStarted:Yt,putSortable:K,activeSortable:C.active,originalEvent:i,oldIndex:Tt,oldDraggableIndex:Wt,newIndex:ae,newDraggableIndex:Ke,hideGhostForTarget:Nu,unhideGhostForTarget:Ou,cloneNowHidden:function(){Je=!0},cloneNowShown:function(){Je=!1},dispatchSortableEvent:function(s){Z({sortable:r,name:s,originalEvent:i})}},o))};function Z(t){Uh(xe({putSortable:K,cloneEl:z,targetEl:_,rootEl:I,oldIndex:Tt,oldDraggableIndex:Wt,newIndex:ae,newDraggableIndex:Ke},t))}var _,B,S,I,rt,zr,z,Je,Tt,ae,Wt,Ke,jr,K,Nt=!1,Hr=!1,Vr=[],nt,me,fi,hi,ku,Cu,Yt,Ot,Zt,Xt=!1,Gr=!1,Ur,Y,pi=[],mi=!1,$r=[],Jr=typeof document!="undefined",Kr=mu,Au=qr||$e?"cssFloat":"float",Jh=Jr&&!Lh&&!mu&&"draggable"in document.createElement("div"),Su=function(){if(!!Jr){if($e)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto",t.style.pointerEvents==="auto"}}(),Du=function(e,r){var n=k(e),i=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),o=St(e,0,r),a=St(e,1,r),s=o&&k(o),l=a&&k(a),u=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+G(o).width,c=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+G(a).width;if(n.display==="flex")return n.flexDirection==="column"||n.flexDirection==="column-reverse"?"vertical":"horizontal";if(n.display==="grid")return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(o&&s.float&&s.float!=="none"){var d=s.float==="left"?"left":"right";return a&&(l.clear==="both"||l.clear===d)?"vertical":"horizontal"}return o&&(s.display==="block"||s.display==="flex"||s.display==="table"||s.display==="grid"||u>=i&&n[Au]==="none"||a&&n[Au]==="none"&&u+c>i)?"vertical":"horizontal"},Kh=function(e,r,n){var i=n?e.left:e.top,o=n?e.right:e.bottom,a=n?e.width:e.height,s=n?r.left:r.top,l=n?r.right:r.bottom,u=n?r.width:r.height;return i===s||o===l||i+a/2===s+u/2},Wh=function(e,r){var n;return Vr.some(function(i){var o=i[oe].options.emptyInsertThreshold;if(!(!o||li(i))){var a=G(i),s=e>=a.left-o&&e<=a.right+o,l=r>=a.top-o&&r<=a.bottom+o;if(s&&l)return n=i}}),n},Tu=function(e){function r(o,a){return function(s,l,u,c){var d=s.options.group.name&&l.options.group.name&&s.options.group.name===l.options.group.name;if(o==null&&(a||d))return!0;if(o==null||o===!1)return!1;if(a&&o==="clone")return o;if(typeof o=="function")return r(o(s,l,u,c),a)(s,l,u,c);var f=(a?s:l).options.group.name;return o===!0||typeof o=="string"&&o===f||o.join&&o.indexOf(f)>-1}}var n={},i=e.group;(!i||Pr(i)!="object")&&(i={name:i}),n.name=i.name,n.checkPull=r(i.pull,!0),n.checkPut=r(i.put),n.revertClone=i.revertClone,e.group=n},Nu=function(){!Su&&S&&k(S,"display","none")},Ou=function(){!Su&&S&&k(S,"display","")};Jr&&document.addEventListener("click",function(t){if(Hr)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),Hr=!1,!1},!0);var it=function(e){if(_){e=e.touches?e.touches[0]:e;var r=Wh(e.clientX,e.clientY);if(r){var n={};for(var i in e)e.hasOwnProperty(i)&&(n[i]=e[i]);n.target=n.rootEl=r,n.preventDefault=void 0,n.stopPropagation=void 0,r[oe]._onDragOver(n)}}},Yh=function(e){_&&_.parentNode[oe]._isOutsideThisEl(e.target)};function C(t,e){if(!(t&&t.nodeType&&t.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=Ue({},e),t[oe]=this;var r={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Du(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(a,s){a.setData("Text",s.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:C.supportPointer!==!1&&"PointerEvent"in window&&!Ir,emptyInsertThreshold:5};Kt.initializePlugins(this,t,r);for(var n in r)!(n in e)&&(e[n]=r[n]);Tu(e);for(var i in this)i.charAt(0)==="_"&&typeof this[i]=="function"&&(this[i]=this[i].bind(this));this.nativeDraggable=e.forceFallback?!1:Jh,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?R(t,"pointerdown",this._onTapStart):(R(t,"mousedown",this._onTapStart),R(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(R(t,"dragover",this),R(t,"dragenter",this)),Vr.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),Ue(this,Hh())}C.prototype={constructor:C,_isOutsideThisEl:function(e){!this.el.contains(e)&&e!==this.el&&(Ot=null)},_getDirection:function(e,r){return typeof this.options.direction=="function"?this.options.direction.call(this,e,r,_):this.options.direction},_onTapStart:function(e){if(!!e.cancelable){var r=this,n=this.el,i=this.options,o=i.preventOnFilter,a=e.type,s=e.touches&&e.touches[0]||e.pointerType&&e.pointerType==="touch"&&e,l=(s||e).target,u=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||l,c=i.filter;if(ip(n),!_&&!(/mousedown|pointerdown/.test(a)&&e.button!==0||i.disabled)&&!u.isContentEditable&&!(!this.nativeDraggable&&Ir&&l&&l.tagName.toUpperCase()==="SELECT")&&(l=ke(l,i.draggable,n,!1),!(l&&l.animated)&&zr!==l)){if(Tt=fe(l),Wt=fe(l,i.draggable),typeof c=="function"){if(c.call(this,e,l,this)){Z({sortable:r,rootEl:u,name:"filter",targetEl:l,toEl:n,fromEl:n}),re("filter",r,{evt:e}),o&&e.cancelable&&e.preventDefault();return}}else if(c&&(c=c.split(",").some(function(d){if(d=ke(u,d.trim(),n,!1),d)return Z({sortable:r,rootEl:d,name:"filter",targetEl:l,fromEl:n,toEl:n}),re("filter",r,{evt:e}),!0}),c)){o&&e.cancelable&&e.preventDefault();return}i.handle&&!ke(u,i.handle,n,!1)||this._prepareDragStart(e,s,l)}}},_prepareDragStart:function(e,r,n){var i=this,o=i.el,a=i.options,s=o.ownerDocument,l;if(n&&!_&&n.parentNode===o){var u=G(n);if(I=o,_=n,B=_.parentNode,rt=_.nextSibling,zr=n,jr=a.group,C.dragged=_,nt={target:_,clientX:(r||e).clientX,clientY:(r||e).clientY},ku=nt.clientX-u.left,Cu=nt.clientY-u.top,this._lastX=(r||e).clientX,this._lastY=(r||e).clientY,_.style["will-change"]="all",l=function(){if(re("delayEnded",i,{evt:e}),C.eventCanceled){i._onDrop();return}i._disableDelayedDragEvents(),!pu&&i.nativeDraggable&&(_.draggable=!0),i._triggerDragStart(e,r),Z({sortable:i,name:"choose",originalEvent:e}),ie(_,a.chosenClass,!0)},a.ignore.split(",").forEach(function(c){vu(_,c.trim(),gi)}),R(s,"dragover",it),R(s,"mousemove",it),R(s,"touchmove",it),R(s,"mouseup",i._onDrop),R(s,"touchend",i._onDrop),R(s,"touchcancel",i._onDrop),pu&&this.nativeDraggable&&(this.options.touchStartThreshold=4,_.draggable=!0),re("delayStart",this,{evt:e}),a.delay&&(!a.delayOnTouchOnly||r)&&(!this.nativeDraggable||!(qr||$e))){if(C.eventCanceled){this._onDrop();return}R(s,"mouseup",i._disableDelayedDrag),R(s,"touchend",i._disableDelayedDrag),R(s,"touchcancel",i._disableDelayedDrag),R(s,"mousemove",i._delayedDragTouchMoveHandler),R(s,"touchmove",i._delayedDragTouchMoveHandler),a.supportPointer&&R(s,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(l,a.delay)}else l()}},_delayedDragTouchMoveHandler:function(e){var r=e.touches?e.touches[0]:e;Math.max(Math.abs(r.clientX-this._lastX),Math.abs(r.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){_&&gi(_),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;M(e,"mouseup",this._disableDelayedDrag),M(e,"touchend",this._disableDelayedDrag),M(e,"touchcancel",this._disableDelayedDrag),M(e,"mousemove",this._delayedDragTouchMoveHandler),M(e,"touchmove",this._delayedDragTouchMoveHandler),M(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,r){r=r||e.pointerType=="touch"&&e,!this.nativeDraggable||r?this.options.supportPointer?R(document,"pointermove",this._onTouchMove):r?R(document,"touchmove",this._onTouchMove):R(document,"mousemove",this._onTouchMove):(R(_,"dragend",this),R(I,"dragstart",this._onDragStart));try{document.selection?Yr(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(e,r){if(Nt=!1,I&&_){re("dragStarted",this,{evt:r}),this.nativeDraggable&&R(document,"dragover",Yh);var n=this.options;!e&&ie(_,n.dragClass,!1),ie(_,n.ghostClass,!0),C.active=this,e&&this._appendGhost(),Z({sortable:this,name:"start",originalEvent:r})}else this._nulling()},_emulateDragOver:function(){if(me){this._lastX=me.clientX,this._lastY=me.clientY,Nu();for(var e=document.elementFromPoint(me.clientX,me.clientY),r=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(me.clientX,me.clientY),e!==r);)r=e;if(_.parentNode[oe]._isOutsideThisEl(e),r)do{if(r[oe]){var n=void 0;if(n=r[oe]._onDragOver({clientX:me.clientX,clientY:me.clientY,target:e,rootEl:r}),n&&!this.options.dragoverBubble)break}e=r}while(r=r.parentNode);Ou()}},_onTouchMove:function(e){if(nt){var r=this.options,n=r.fallbackTolerance,i=r.fallbackOffset,o=e.touches?e.touches[0]:e,a=S&&At(S,!0),s=S&&a&&a.a,l=S&&a&&a.d,u=Kr&&Y&&_u(Y),c=(o.clientX-nt.clientX+i.x)/(s||1)+(u?u[0]-pi[0]:0)/(s||1),d=(o.clientY-nt.clientY+i.y)/(l||1)+(u?u[1]-pi[1]:0)/(l||1);if(!C.active&&!Nt){if(n&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))=0&&(Z({rootEl:B,name:"add",toEl:B,fromEl:I,originalEvent:e}),Z({sortable:this,name:"remove",toEl:B,originalEvent:e}),Z({rootEl:B,name:"sort",toEl:B,fromEl:I,originalEvent:e}),Z({sortable:this,name:"sort",toEl:B,originalEvent:e})),K&&K.save()):ae!==Tt&&ae>=0&&(Z({sortable:this,name:"update",toEl:B,originalEvent:e}),Z({sortable:this,name:"sort",toEl:B,originalEvent:e})),C.active&&((ae==null||ae===-1)&&(ae=Tt,Ke=Wt),Z({sortable:this,name:"end",toEl:B,originalEvent:e}),this.save()))),this._nulling()},_nulling:function(){re("nulling",this),I=_=B=S=rt=z=zr=Je=nt=me=Yt=ae=Ke=Tt=Wt=Ot=Zt=K=jr=C.dragged=C.ghost=C.clone=C.active=null,$r.forEach(function(e){e.checked=!0}),$r.length=fi=hi=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":_&&(this._onDragOver(e),Zh(e));break;case"selectstart":e.preventDefault();break}},toArray:function(){for(var e=[],r,n=this.el.children,i=0,o=n.length,a=this.options;in.right+i||t.clientX<=n.right&&t.clientY>n.bottom&&t.clientX>=n.left:t.clientX>n.right&&t.clientY>n.top||t.clientX<=n.right&&t.clientY>n.bottom+i}function tp(t,e,r,n,i,o,a,s){var l=n?t.clientY:t.clientX,u=n?r.height:r.width,c=n?r.top:r.left,d=n?r.bottom:r.right,f=!1;if(!a){if(s&&Urc+u*o/2:ld-Ur)return-Zt}else if(l>c+u*(1-i)/2&&ld-u*o/2)?l>c+u/2?1:-1:0}function rp(t){return fe(_){if(r==="townName")return;let n=st.getFieldByKey(r),i=document.createElement("DIV"),o=document.createElement("DT");o.innerHTML=n.label;let a=document.createElement("DD");a.innerHTML=this.town.getFieldValue(r).toString(),i.appendChild(o),i.appendChild(a),e.appendChild(i)}),this.shadowRoot.querySelector(".body").appendChild(e)}_toggleEdit(e){if(this._isEdit){this._disableEdit();return}this._enableEdit()}_createFormField(e,r=""){let n=e.key,i=document.createElement("div");i.classList.add("formField");let o=document.createElement("label");o.setAttribute("for",n),o.innerHTML=e.label,i.appendChild(o);let a=document.createElement("div");a.classList.add("fieldReroll");let s=null;e.type==="long"?s=document.createElement("textarea"):(s=document.createElement("input"),s.setAttribute("type","text")),s.id=n,s.setAttribute("name",n),s.setAttribute("autocomplete","off"),s.value=r,a.appendChild(s);let l=document.createElement("button");return l.classList.add("btn-reroll"),l.dataset.field=n,l.dataset.append=e.type==="long"?"true":"false",l.setAttribute("type","button"),l.setAttribute("aria-label","Reroll"),l.setAttribute("aria-controls",n),l.innerHTML="⚅",a.appendChild(l),i.appendChild(a),i}_enableEdit(){if(this._isEdit)return;this._isEdit=!0,this.shadowRoot.querySelector(".body").innerHTML="";let e=gu.content.cloneNode(!0),r=e.querySelector(".formFields");Array.from(st.fields.keys()).forEach(n=>{let i=st.getFieldByKey(n),o=this.town.getFieldDisplay(n),a=this._createFormField(i,o);r.appendChild(a)}),this.shadowRoot.querySelector(".body").appendChild(e),e=this.shadowRoot.querySelector("form"),e.addEventListener("submit",this._saveEdit.bind(this)),e.querySelector(".btn-cancel").addEventListener("click",this._toggleEdit.bind(this)),e.querySelectorAll(".btn-reroll").forEach(n=>{n.addEventListener("click",this._reroll.bind(this))})}_disableEdit(){if(!this._isEdit)return;this._isEdit=!1;let e=this.shadowRoot.querySelector("form");e.removeEventListener("submit",this._saveEdit.bind(this)),e.querySelector(".btn-cancel").removeEventListener("click",this._toggleEdit.bind(this)),e.querySelectorAll(".btn-reroll").forEach(r=>{r.removeEventListener("click",this._reroll.bind(this))}),this.setTownDisplay(),this._refocus()}_saveEdit(e){e.preventDefault();let r=new FormData(e.target);this.town.getFieldKeys().forEach(n=>{this.town.setFieldValue(n,r.get(n).toString())}),Ir(this.town),this._disableEdit()}_reroll(e){let r=e.target.dataset.field||"";if(r==="")return;let n=e.target.dataset.append==="true",i=st.getFieldByKey(r),o=rt(i.source),a=this.shadowRoot.querySelector(`#${r}`);n?a.value+=` +${o.toString()}`:a.value=o.toString()}_refocus(){this.shadowRoot.querySelector("summary").focus()}};window.customElements.define("had-town",bu);function vu(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function ke(t){for(var e=1;e=0)&&(r[i]=t[i]);return r}function zh(t,e){if(t==null)return{};var r=Bh(t,e),n,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&(!Object.prototype.propertyIsEnumerable.call(t,n)||(r[n]=t[n]))}return r}var jh="1.14.0";function Me(t){if(typeof window!="undefined"&&window.navigator)return!!navigator.userAgent.match(t)}var We=Me(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Br=Me(/Edge/i),yu=Me(/firefox/i),zr=Me(/safari/i)&&!Me(/chrome/i)&&!Me(/android/i),_u=Me(/iP(ad|od|hone)/i),Hh=Me(/chrome/i)&&Me(/android/i),wu={capture:!1,passive:!1};function M(t,e,r){t.addEventListener(e,r,!We&&wu)}function R(t,e,r){t.removeEventListener(e,r,!We&&wu)}function jr(t,e){if(!!e){if(e[0]===">"&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch{return!1}return!1}}function Vh(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function Se(t,e,r,n){if(t){r=r||document;do{if(e!=null&&(e[0]===">"?t.parentNode===r&&jr(t,e):jr(t,e))||n&&t===r)return t;if(t===r)break}while(t=Vh(t))}return null}var Eu=/\s+/g;function ie(t,e,r){if(t&&e)if(t.classList)t.classList[r?"add":"remove"](e);else{var n=(" "+t.className+" ").replace(Eu," ").replace(" "+e+" "," ");t.className=(n+(r?" "+e:"")).replace(Eu," ")}}function k(t,e,r){var n=t&&t.style;if(n){if(r===void 0)return document.defaultView&&document.defaultView.getComputedStyle?r=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(r=t.currentStyle),e===void 0?r:r[e];!(e in n)&&e.indexOf("webkit")===-1&&(e="-webkit-"+e),n[e]=r+(typeof r=="string"?"":"px")}}function Mt(t,e){var r="";if(typeof t=="string")r=t;else do{var n=k(t,"transform");n&&n!=="none"&&(r=n+" "+r)}while(!e&&(t=t.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(r)}function xu(t,e,r){if(t){var n=t.getElementsByTagName(e),i=0,o=n.length;if(r)for(;i=o:a=i<=o,!a)return n;if(n===Fe())break;n=Hr(n,!1)}return!1}function Ft(t,e,r,n){for(var i=0,o=0,a=t.children;o2&&arguments[2]!==void 0?arguments[2]:{},i=n.evt,o=zh(n,Yh);Qt.pluginEvent.bind(S)(e,r,ke({dragEl:_,parentEl:B,ghostEl:A,rootEl:I,nextEl:lt,lastDownEl:Vr,cloneEl:z,cloneHidden:Ye,dragStarted:tr,putSortable:J,activeSortable:S.active,originalEvent:i,oldIndex:qt,oldDraggableIndex:er,newIndex:ae,newDraggableIndex:Ze,hideGhostForTarget:Pu,unhideGhostForTarget:qu,cloneNowHidden:function(){Ye=!0},cloneNowShown:function(){Ye=!1},dispatchSortableEvent:function(s){Z({sortable:r,name:s,originalEvent:i})}},o))};function Z(t){Wh(ke({putSortable:J,cloneEl:z,targetEl:_,rootEl:I,oldIndex:qt,oldDraggableIndex:er,newIndex:ae,newDraggableIndex:Ze},t))}var _,B,A,I,lt,Vr,z,Ye,qt,ae,er,Ze,Gr,J,It=!1,Ur=!1,$r=[],ut,ge,_i,wi,Tu,Ou,tr,Lt,rr,nr=!1,Jr=!1,Kr,Y,Ei=[],xi=!1,Wr=[],Yr=typeof document!="undefined",Zr=_u,Nu=Br||We?"cssFloat":"float",Zh=Yr&&!Hh&&!_u&&"draggable"in document.createElement("div"),Ru=function(){if(!!Yr){if(We)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto",t.style.pointerEvents==="auto"}}(),Mu=function(e,r){var n=k(e),i=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),o=Ft(e,0,r),a=Ft(e,1,r),s=o&&k(o),l=a&&k(a),u=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+V(o).width,c=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+V(a).width;if(n.display==="flex")return n.flexDirection==="column"||n.flexDirection==="column-reverse"?"vertical":"horizontal";if(n.display==="grid")return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(o&&s.float&&s.float!=="none"){var d=s.float==="left"?"left":"right";return a&&(l.clear==="both"||l.clear===d)?"vertical":"horizontal"}return o&&(s.display==="block"||s.display==="flex"||s.display==="table"||s.display==="grid"||u>=i&&n[Nu]==="none"||a&&n[Nu]==="none"&&u+c>i)?"vertical":"horizontal"},Xh=function(e,r,n){var i=n?e.left:e.top,o=n?e.right:e.bottom,a=n?e.width:e.height,s=n?r.left:r.top,l=n?r.right:r.bottom,u=n?r.width:r.height;return i===s||o===l||i+a/2===s+u/2},Qh=function(e,r){var n;return $r.some(function(i){var o=i[oe].options.emptyInsertThreshold;if(!(!o||gi(i))){var a=V(i),s=e>=a.left-o&&e<=a.right+o,l=r>=a.top-o&&r<=a.bottom+o;if(s&&l)return n=i}}),n},Fu=function(e){function r(o,a){return function(s,l,u,c){var d=s.options.group.name&&l.options.group.name&&s.options.group.name===l.options.group.name;if(o==null&&(a||d))return!0;if(o==null||o===!1)return!1;if(a&&o==="clone")return o;if(typeof o=="function")return r(o(s,l,u,c),a)(s,l,u,c);var f=(a?s:l).options.group.name;return o===!0||typeof o=="string"&&o===f||o.join&&o.indexOf(f)>-1}}var n={},i=e.group;(!i||Lr(i)!="object")&&(i={name:i}),n.name=i.name,n.checkPull=r(i.pull,!0),n.checkPut=r(i.put),n.revertClone=i.revertClone,e.group=n},Pu=function(){!Ru&&A&&k(A,"display","none")},qu=function(){!Ru&&A&&k(A,"display","")};Yr&&document.addEventListener("click",function(t){if(Ur)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),Ur=!1,!1},!0);var ct=function(e){if(_){e=e.touches?e.touches[0]:e;var r=Qh(e.clientX,e.clientY);if(r){var n={};for(var i in e)e.hasOwnProperty(i)&&(n[i]=e[i]);n.target=n.rootEl=r,n.preventDefault=void 0,n.stopPropagation=void 0,r[oe]._onDragOver(n)}}},ep=function(e){_&&_.parentNode[oe]._isOutsideThisEl(e.target)};function S(t,e){if(!(t&&t.nodeType&&t.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=Ke({},e),t[oe]=this;var r={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Mu(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(a,s){a.setData("Text",s.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:S.supportPointer!==!1&&"PointerEvent"in window&&!zr,emptyInsertThreshold:5};Qt.initializePlugins(this,t,r);for(var n in r)!(n in e)&&(e[n]=r[n]);Fu(e);for(var i in this)i.charAt(0)==="_"&&typeof this[i]=="function"&&(this[i]=this[i].bind(this));this.nativeDraggable=e.forceFallback?!1:Zh,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?M(t,"pointerdown",this._onTapStart):(M(t,"mousedown",this._onTapStart),M(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(M(t,"dragover",this),M(t,"dragenter",this)),$r.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),Ke(this,$h())}S.prototype={constructor:S,_isOutsideThisEl:function(e){!this.el.contains(e)&&e!==this.el&&(Lt=null)},_getDirection:function(e,r){return typeof this.options.direction=="function"?this.options.direction.call(this,e,r,_):this.options.direction},_onTapStart:function(e){if(!!e.cancelable){var r=this,n=this.el,i=this.options,o=i.preventOnFilter,a=e.type,s=e.touches&&e.touches[0]||e.pointerType&&e.pointerType==="touch"&&e,l=(s||e).target,u=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||l,c=i.filter;if(lp(n),!_&&!(/mousedown|pointerdown/.test(a)&&e.button!==0||i.disabled)&&!u.isContentEditable&&!(!this.nativeDraggable&&zr&&l&&l.tagName.toUpperCase()==="SELECT")&&(l=Se(l,i.draggable,n,!1),!(l&&l.animated)&&Vr!==l)){if(qt=he(l),er=he(l,i.draggable),typeof c=="function"){if(c.call(this,e,l,this)){Z({sortable:r,rootEl:u,name:"filter",targetEl:l,toEl:n,fromEl:n}),re("filter",r,{evt:e}),o&&e.cancelable&&e.preventDefault();return}}else if(c&&(c=c.split(",").some(function(d){if(d=Se(u,d.trim(),n,!1),d)return Z({sortable:r,rootEl:d,name:"filter",targetEl:l,fromEl:n,toEl:n}),re("filter",r,{evt:e}),!0}),c)){o&&e.cancelable&&e.preventDefault();return}i.handle&&!Se(u,i.handle,n,!1)||this._prepareDragStart(e,s,l)}}},_prepareDragStart:function(e,r,n){var i=this,o=i.el,a=i.options,s=o.ownerDocument,l;if(n&&!_&&n.parentNode===o){var u=V(n);if(I=o,_=n,B=_.parentNode,lt=_.nextSibling,Vr=n,Gr=a.group,S.dragged=_,ut={target:_,clientX:(r||e).clientX,clientY:(r||e).clientY},Tu=ut.clientX-u.left,Ou=ut.clientY-u.top,this._lastX=(r||e).clientX,this._lastY=(r||e).clientY,_.style["will-change"]="all",l=function(){if(re("delayEnded",i,{evt:e}),S.eventCanceled){i._onDrop();return}i._disableDelayedDragEvents(),!yu&&i.nativeDraggable&&(_.draggable=!0),i._triggerDragStart(e,r),Z({sortable:i,name:"choose",originalEvent:e}),ie(_,a.chosenClass,!0)},a.ignore.split(",").forEach(function(c){xu(_,c.trim(),ki)}),M(s,"dragover",ct),M(s,"mousemove",ct),M(s,"touchmove",ct),M(s,"mouseup",i._onDrop),M(s,"touchend",i._onDrop),M(s,"touchcancel",i._onDrop),yu&&this.nativeDraggable&&(this.options.touchStartThreshold=4,_.draggable=!0),re("delayStart",this,{evt:e}),a.delay&&(!a.delayOnTouchOnly||r)&&(!this.nativeDraggable||!(Br||We))){if(S.eventCanceled){this._onDrop();return}M(s,"mouseup",i._disableDelayedDrag),M(s,"touchend",i._disableDelayedDrag),M(s,"touchcancel",i._disableDelayedDrag),M(s,"mousemove",i._delayedDragTouchMoveHandler),M(s,"touchmove",i._delayedDragTouchMoveHandler),a.supportPointer&&M(s,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(l,a.delay)}else l()}},_delayedDragTouchMoveHandler:function(e){var r=e.touches?e.touches[0]:e;Math.max(Math.abs(r.clientX-this._lastX),Math.abs(r.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){_&&ki(_),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;R(e,"mouseup",this._disableDelayedDrag),R(e,"touchend",this._disableDelayedDrag),R(e,"touchcancel",this._disableDelayedDrag),R(e,"mousemove",this._delayedDragTouchMoveHandler),R(e,"touchmove",this._delayedDragTouchMoveHandler),R(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,r){r=r||e.pointerType=="touch"&&e,!this.nativeDraggable||r?this.options.supportPointer?M(document,"pointermove",this._onTouchMove):r?M(document,"touchmove",this._onTouchMove):M(document,"mousemove",this._onTouchMove):(M(_,"dragend",this),M(I,"dragstart",this._onDragStart));try{document.selection?Qr(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(e,r){if(It=!1,I&&_){re("dragStarted",this,{evt:r}),this.nativeDraggable&&M(document,"dragover",ep);var n=this.options;!e&&ie(_,n.dragClass,!1),ie(_,n.ghostClass,!0),S.active=this,e&&this._appendGhost(),Z({sortable:this,name:"start",originalEvent:r})}else this._nulling()},_emulateDragOver:function(){if(ge){this._lastX=ge.clientX,this._lastY=ge.clientY,Pu();for(var e=document.elementFromPoint(ge.clientX,ge.clientY),r=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(ge.clientX,ge.clientY),e!==r);)r=e;if(_.parentNode[oe]._isOutsideThisEl(e),r)do{if(r[oe]){var n=void 0;if(n=r[oe]._onDragOver({clientX:ge.clientX,clientY:ge.clientY,target:e,rootEl:r}),n&&!this.options.dragoverBubble)break}e=r}while(r=r.parentNode);qu()}},_onTouchMove:function(e){if(ut){var r=this.options,n=r.fallbackTolerance,i=r.fallbackOffset,o=e.touches?e.touches[0]:e,a=A&&Mt(A,!0),s=A&&a&&a.a,l=A&&a&&a.d,u=Zr&&Y&&Su(Y),c=(o.clientX-ut.clientX+i.x)/(s||1)+(u?u[0]-Ei[0]:0)/(s||1),d=(o.clientY-ut.clientY+i.y)/(l||1)+(u?u[1]-Ei[1]:0)/(l||1);if(!S.active&&!It){if(n&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))=0&&(Z({rootEl:B,name:"add",toEl:B,fromEl:I,originalEvent:e}),Z({sortable:this,name:"remove",toEl:B,originalEvent:e}),Z({rootEl:B,name:"sort",toEl:B,fromEl:I,originalEvent:e}),Z({sortable:this,name:"sort",toEl:B,originalEvent:e})),J&&J.save()):ae!==qt&&ae>=0&&(Z({sortable:this,name:"update",toEl:B,originalEvent:e}),Z({sortable:this,name:"sort",toEl:B,originalEvent:e})),S.active&&((ae==null||ae===-1)&&(ae=qt,Ze=er),Z({sortable:this,name:"end",toEl:B,originalEvent:e}),this.save()))),this._nulling()},_nulling:function(){re("nulling",this),I=_=B=A=lt=z=Vr=Ye=ut=ge=tr=ae=Ze=qt=er=Lt=rr=J=Gr=S.dragged=S.ghost=S.clone=S.active=null,Wr.forEach(function(e){e.checked=!0}),Wr.length=_i=wi=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":_&&(this._onDragOver(e),tp(e));break;case"selectstart":e.preventDefault();break}},toArray:function(){for(var e=[],r,n=this.el.children,i=0,o=n.length,a=this.options;in.right+i||t.clientX<=n.right&&t.clientY>n.bottom&&t.clientX>=n.left:t.clientX>n.right&&t.clientY>n.top||t.clientX<=n.right&&t.clientY>n.bottom+i}function op(t,e,r,n,i,o,a,s){var l=n?t.clientY:t.clientX,u=n?r.height:r.width,c=n?r.top:r.left,d=n?r.bottom:r.right,f=!1;if(!a){if(s&&Krc+u*o/2:ld-Kr)return-rr}else if(l>c+u*(1-i)/2&&ld-u*o/2)?l>c+u/2?1:-1:0}function ap(t){return he(_)
-

Notes

+

- +
-
+
-`;var Lu=class extends HTMLElement{constructor(){super();this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Iu.content.cloneNode(!0)),this.noteList=this.shadowRoot.querySelector("#note-list"),this.setAttribute("role","region"),Mr().forEach(e=>{let r=new si;r.setNote(e),this.noteList.appendChild(r)}),Ge.on("note:add",this._addNote.bind(this)),Ge.on("note:delete",this._removeNote.bind(this)),Ge.on("note:edit",this._updateNote.bind(this))}connectedCallback(){this.shadowRoot.querySelector(".btn-collapse").addEventListener("click",this._collapseAll.bind(this)),this.shadowRoot.querySelector(".btn-create").addEventListener("click",this._createNote.bind(this)),this.sortable=new Xr(this.noteList,{draggable:"had-note",dataIdAttr:"data-id",store:{set:function(e){let r=e.toArray();Zl(r)}}})}disconnectedCallback(){this.shadowRoot.querySelector(".btn-collapse").removeEventListener("click",this._collapseAll.bind(this)),this.shadowRoot.querySelector(".btn-create").removeEventListener("click",this._createNote.bind(this)),this.sortable.destroy()}_collapseAll(){this.shadowRoot.querySelectorAll("had-note").forEach(e=>{e.collapse()})}_createNote(){Rr(new Ee({}),"edit")}_addNote({note:e,mode:r}){let n=e.id;if(this.shadowRoot.querySelector(`#note_${n}`))return;let i=new si;i.setNote(e),r==="edit"&&i._enableEdit(),this.noteList.appendChild(i),r==="edit"&&i.shadowRoot.querySelector("input[name=title]").focus()}_updateNote({note:e}){let r=e.id,n=this.shadowRoot.querySelector(`#note_${r}`);!n||n.setNote(e)}_removeNote({id:e}){let r=this.shadowRoot.querySelector(`#note_${e}`);r&&r.parentElement.removeChild(r)}};window.customElements.define("had-noteslist",Lu);var Bu=document.createElement("template");Bu.innerHTML=` +`;var Ci=class extends HTMLElement{constructor({type:e="",header:r="",createButton:n="",service:i={}}){super();this.type=e,this.service=i,this.header=r,this.createButton=n,this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Vu.content.cloneNode(!0)),this.itemList=this.shadowRoot.querySelector("#item-list"),this.setAttribute("role","region"),this.shadowRoot.querySelector("h2").innerHTML=this.header,this.shadowRoot.querySelector(".btn-create").innerHTML=this.createButton,this._getAll()}connectedCallback(){this.shadowRoot.querySelector(".btn-collapse").addEventListener("click",this._collapseAll.bind(this)),this.shadowRoot.querySelector(".btn-create").addEventListener("click",this._createItem.bind(this)),this.sortable=new Hu(this.itemList,{draggable:"#item-list > *",dataIdAttr:"data-id",store:{set:e=>{let r=e.toArray();this._sortItems(r)}}}),this.service.emitter.on(`${this.type}:add`,this._addItem.bind(this)),this.service.emitter.on(`${this.type}:delete`,this._removeItem.bind(this)),this.service.emitter.on(`${this.type}:edit`,this._updateItem.bind(this))}disconnectedCallback(){this.shadowRoot.querySelector(".btn-collapse").removeEventListener("click",this._collapseAll.bind(this)),this.shadowRoot.querySelector(".btn-create").removeEventListener("click",this._createItem.bind(this)),this.sortable.destroy(),this.service.emitter.off(`${this.type}:add`,this._addItem.bind(this)),this.service.emitter.off(`${this.type}:delete`,this._removeItem.bind(this)),this.service.emitter.off(`${this.type}:edit`,this._updateItem.bind(this))}_getAll(){this.service.getAll().forEach(e=>{let r=this.service.getDisplay();r.setItem(e),this.itemList.appendChild(r)})}_collapseAll(){this.shadowRoot.querySelectorAll("#item-list > *").forEach(e=>{e.collapse()})}_sortItems(e){this.service.sort(e)}_createItem(){this.service.create("edit")}_addItem({item:e,mode:r}){let n=e.id;if(this.shadowRoot.querySelector(`#${this.type}_${n}`))return;let i=this.service.getDisplay();i.setItem(e),r==="edit"&&i._enableEdit(),this.itemList.appendChild(i),r==="edit"&&i.shadowRoot.querySelector("input").focus()}_updateItem({item:e}){let r=e.id,n=this.shadowRoot.querySelector(`#${this.type}_${r}`);!n||n.setItem(e)}_removeItem({id:e}){let r=this.shadowRoot.querySelector(`[data-id="${e}"]`);r&&(this.shadowRoot.querySelector("h2").focus(),r.parentElement.removeChild(r))}};window.customElements.define("had-itemlist",Ci);var tn=Ci;var Gu=class extends tn{constructor(){super({type:"note",header:"Notes",createButton:"Create Note",service:Zt})}};window.customElements.define("had-noteslist",Gu);var Uu=document.createElement("template");Uu.innerHTML=` -`;var zu=class extends HTMLElement{constructor(){super();this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Bu.content.cloneNode(!0)),this.result=this.shadowRoot.querySelector(".result"),this.button=this.shadowRoot.querySelector("button")}connectedCallback(){this.button.addEventListener("click",this._roll.bind(this))}disconnectedCallback(){this.button.removeEventListener("click",this._roll.bind(this))}_roll(){let e=er("2d6");this.result.innerHTML=e}};window.customElements.define("had-diceroller",zu);var sp=new V({key:"npcName",label:"Name",type:"string",source:"name:western",count:1}),lp=new V({key:"job",label:"Occupation",type:"string",source:"table:jobs",count:1}),up=new V({key:"long_goal",label:"Goal (Long term)",type:"string",source:"table:goals:long_term",count:1}),cp=new V({key:"short_goal",label:"Goal (Short term)",type:"string",source:"table:goals:short_term",count:1}),dp=new V({key:"secret",label:"Secret",type:"string",source:"table:goals:secrets",count:1}),fp=new kt({key:"hadleyville",name:"Hadleyville NPC",fields:[sp,lp,up,cp,dp]}),We=fp;var ju=Qt(Or()),Mt=class extends xt{constructor({id:e=null,schema:r="hadleyville",fields:n=new Map,notes:i="",collapse:o=!1}){super({id:e,schema:r,fields:n});this.notes=i,this.collapse=!!o}get name(){return this.getFieldValue("npcName")}get job(){return this.getFieldValue("job")}get longGoal(){return this.getFieldValue("long_goal")}get shortGoal(){return this.getFieldValue("short_goal")}get secret(){return this.getFieldValue("secret")}setFieldValue(e,r){typeof this.fields.get(e)!="undefined"&&this.fields.set(e,r)}getFieldDisplay(e){return e==="notes"?this.noteHtml:this.fields.get(e)}get noteHtml(){return new ju.default().render(this.notes)}};var Qr=new Le,hp=function(){let t=new Map;return We.fields.forEach(e=>{let r=e.key;if(!j(e.starting_value)){t.set(r,e.starting_value);return}if(!j(e.source)){if(e.type==="array"){let n=[],i=e.count?e.count:1;for(let o=0;onew Mt(e))},Vu=function(){let t=hp();return q.dispatch(wo({npc:t.toJSON()})),t};var vi=function(t){q.dispatch(Eo({npc:t.toJSON()}));let e=this.getNPCById(t.id);this.npcs$.next(e)},Gu=function(t){q.dispatch(xo({id:t})),Qr.trigger("npc:delete",{id:t})},Uu=function(t){q.dispatch(ko({sortUuids:t}))},$u=function(){q.dispatch(Co())},Ju=function(t){q.dispatch(Ao({npcs:t})),t.forEach(e=>{if(!e.id)return;let r=new Mt(e);Qr.trigger("npc:add",{npc:r})})};var Ku=document.createElement("template");Ku.innerHTML=` +`;var $u=class extends HTMLElement{constructor(){super();this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Uu.content.cloneNode(!0)),this.result=this.shadowRoot.querySelector(".result"),this.button=this.shadowRoot.querySelector("button")}connectedCallback(){this.button.addEventListener("click",this._roll.bind(this))}disconnectedCallback(){this.button.removeEventListener("click",this._roll.bind(this))}_roll(){let e=sr("2d6");this.result.innerHTML=e}};window.customElements.define("had-diceroller",$u);var nn={};Ri(nn,{create:()=>yp,deleteAll:()=>Ti,emitter:()=>ir,getAll:()=>bp,getById:()=>vp,getDisplay:()=>wp,importAll:()=>Oi,remove:()=>Di,save:()=>rn,sort:()=>_p});var dp=new H({key:"npcName",label:"Name",type:"string",source:"name:western",count:1}),fp=new H({key:"job",label:"Occupation",type:"string",source:"table:jobs",count:1}),hp=new H({key:"long_goal",label:"Goal (Long term)",type:"string",source:"table:goals:long_term",count:1}),pp=new H({key:"short_goal",label:"Goal (Short term)",type:"string",source:"table:goals:short_term",count:1}),mp=new H({key:"secret",label:"Secret",type:"string",source:"table:goals:secrets",count:1}),gp=new Je({key:"hadleyville",name:"Hadleyville NPC",fields:[dp,fp,hp,pp,mp]}),Xe=gp;var Ju=ar(qr()),Qe=class extends $e{constructor({id:e=null,schema:r="hadleyville",fields:n=new Map,notes:i="",collapse:o=!1}){super({id:e,schema:r,fields:n});this.notes=i,this.collapse=!!o}get name(){return this.getFieldValue("npcName")}get job(){return this.getFieldValue("job")}get longGoal(){return this.getFieldValue("long_goal")}get shortGoal(){return this.getFieldValue("short_goal")}get secret(){return this.getFieldValue("secret")}getFieldDisplay(e){return e==="notes"?this.noteHtml:this.fields.get(e)}get noteHtml(){return new Ju.default().render(this.notes)}};var Ku=function(t,e,r){if(!(r instanceof $e))throw Error("npc object must be or inherit from NPC class.");if(!(t instanceof Je))throw Error("schema object must be or inherit from NPCSchema class.");if(!(e instanceof lr))throw Error("Invalid tableRoller");if(r.schema===""&&(r.schema=t.key),r.schema!==t.key)throw Error("npc already has schema set.");t.fields.forEach(n=>{let i=n.key;if(!Q(n.starting_value)){r.setFieldValue(i,n.starting_value);return}if(!Q(n.source)){if(n.type==="array"){let o=[],a=n.count?n.count:1;for(let s=0;s -
-

NPCs

-
- - -
-
-
-
-`;var Zu=class extends HTMLElement{constructor(){super();this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Yu.content.cloneNode(!0)),this.npcList=this.shadowRoot.querySelector("#npc-list"),this.setAttribute("role","region"),Hu().forEach(e=>{let r=new en;r.setNPC(e),this.npcList.appendChild(r)}),Qr.on("npc:delete",this._removeNPC.bind(this))}connectedCallback(){this.shadowRoot.querySelector(".btn-collapse").addEventListener("click",this._collapseAll.bind(this)),this.shadowRoot.querySelector(".btn-create").addEventListener("click",this._createNPC.bind(this)),this.sortable=new Xr(this.npcList,{draggable:"had-npc",dataIdAttr:"data-id",store:{set:function(e){let r=e.toArray();Uu(r)}}})}disconnectedCallback(){this.shadowRoot.querySelector(".btn-collapse").removeEventListener("click",this._collapseAll.bind(this)),this.shadowRoot.querySelector(".btn-create").removeEventListener("click",this._createNPC.bind(this)),this.sortable.destroy()}_collapseAll(){this.shadowRoot.querySelectorAll("had-npc").forEach(e=>{e.collapse()})}_createNPC(){let e=Vu(),r=new en;r.setNPC(e),r._enableEdit(),this.npcList.appendChild(r),r.shadowRoot.querySelector("input[name=npcName]").focus()}_addNPC({npc:e}){let r=new en;r.setNPC(e),this.npcList.appendChild(r)}_removeNPC({id:e}){let r=this.shadowRoot.querySelector(`#npc_${e}`);r&&r.parentElement.removeChild(r)}};window.customElements.define("had-npcslist",Zu);var pp=function(t){setTimeout(()=>{window.URL.revokeObjectURL(t.target.href),document.getElementById("export-output").innerHTML="",document.getElementById("export-button").hidden=!1},1e3)},mp=function(t){let e=q.getState(),r=new Date,n=new Blob([JSON.stringify(e)],{type:"application/json"}),i=URL.createObjectURL(n),o=`Hadleyville__${r.getFullYear()}_${r.getMonth()+1}_${r.getDate()}`,a=document.createElement("a");a.href=i,a.setAttribute("download",o),a.innerText="Download Export",a.addEventListener("click",pp),document.getElementById("export-output").appendChild(a),document.getElementById("export-button").hidden=!0},gp=function(t){t.preventDefault();let r=t.target.querySelector("input[type=file]");!r.files||(Array.from(r.files).forEach(n=>{let i=new FileReader;i.onload=(o=>a=>{let s={};try{s=JSON.parse(a.target.result)}catch{return}let l=s.notes||[];l&&Array.isArray(l)&&l.length>0&&Ql(l);let u=s.npcs||[];u&&Array.isArray(u)&&u.length>0&&Ju(u);let c=s.town||[];if(Array.isArray(c)){let d=c.find(Boolean);d&&d.id&&Fr(new Ct(d))}})(n),i.readAsText(n)}),r.value="")},bp=function(t){!confirm("Are you really sure?")||(Xl(),$u(),su())},Xu=function(){document.getElementById("btn-export").addEventListener("click",mp),document.getElementById("importForm").addEventListener("submit",gp),document.getElementById("btn-delete").addEventListener("click",bp)};document.body.id==="page-settings"&&Xu();})(); +`;var Ai=class extends HTMLElement{constructor(){super();this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Wu.content.cloneNode(!0)),this._isEdit=!1,this.editButton=this.shadowRoot.querySelector(".btn-edit")}connectedCallback(){this.shadowRoot.querySelector("details").addEventListener("toggle",this._setCollapse.bind(this)),this.editButton.addEventListener("click",this._toggleEdit.bind(this))}disconnectedCallback(){this.shadowRoot.querySelector("details").removeEventListener("toggle",this._setCollapse.bind(this)),this.editButton.removeEventListener("click",this._toggleEdit.bind(this))}setItem(e){this.npc=e,this.id=`npc_${this.npc.id}`,this.dataset.id=this.npc.id,e.collapse?this.shadowRoot.querySelector("details").open=!1:this.shadowRoot.querySelector("details").open=!0,this._setNPCOutput()}_setNPCOutput(){this.shadowRoot.querySelector("#summary-title").innerText=this.npc.name,this.shadowRoot.querySelector(".body").innerHTML="";let e=document.createElement("ul");Array.from(Xe.fields.keys()).forEach(n=>{let i=document.createElement("li"),o=Xe.getFieldLabelByKey(n),a=this.npc.getFieldDisplay(n);i.innerHTML=`${o}: ${a}`,e.appendChild(i)});let r=document.createElement("li");r.innerHTML=`Notes: ${this.npc.getFieldDisplay("notes")}`,e.appendChild(r),this.shadowRoot.querySelector(".body").appendChild(e)}_setCollapse(e){if(this._isEdit)return;let r=!e.target.open;this.npc.collapse!==r&&(this.npc.collapse=r,rn(this.npc))}collapse(){this.shadowRoot.querySelector("details").open=!1}_toggleEdit(e){if(this._isEdit){this._disableEdit();return}this._enableEdit()}_createFormField(e,r,n=""){let i=document.createElement("div");i.classList.add("formField");let o=document.createElement("label");o.setAttribute("for",e),o.innerHTML=r,i.appendChild(o);let a=document.createElement("div");a.classList.add("fieldReroll");let s=document.createElement("input");s.id=e,s.setAttribute("type","text"),s.setAttribute("name",e),s.setAttribute("autocomplete","off"),s.value=n,a.appendChild(s);let l=document.createElement("button");return l.classList.add("btn-reroll"),l.dataset.field=e,l.setAttribute("type","button"),l.setAttribute("aria-label","Reroll"),l.setAttribute("aria-controls",e),l.innerHTML="⚅",a.appendChild(l),i.appendChild(a),i}_enableEdit(){if(this._isEdit)return;this._isEdit=!0,this.shadowRoot.querySelector(".body").innerHTML="";let e=Yu.content.cloneNode(!0),r=e.querySelector(".formFields");Array.from(Xe.fields.keys()).forEach(n=>{let i=Xe.getFieldLabelByKey(n),o=this.npc.getFieldDisplay(n),a=this._createFormField(n,i,o);r.appendChild(a)}),e.querySelector("textarea[name=notes").value=this.npc.notes,this.shadowRoot.querySelector(".body").appendChild(e),e=this.shadowRoot.querySelector("form"),e.addEventListener("submit",this._saveEdit.bind(this)),e.querySelector(".btn-cancel").addEventListener("click",this._toggleEdit.bind(this)),e.querySelector(".btn-delete").addEventListener("click",this._deleteNPC.bind(this)),e.querySelectorAll(".btn-reroll").forEach(n=>{n.addEventListener("click",this._reroll.bind(this))})}_disableEdit(){if(!this._isEdit)return;this._isEdit=!1;let e=this.shadowRoot.querySelector("form");e.removeEventListener("submit",this._saveEdit.bind(this)),e.querySelector(".btn-cancel").removeEventListener("click",this._toggleEdit.bind(this)),e.querySelector(".btn-delete").removeEventListener("click",this._deleteNPC.bind(this)),e.querySelectorAll(".btn-reroll").forEach(r=>{r.removeEventListener("click",this._reroll.bind(this))}),this._setNPCOutput(),this._refocus()}_saveEdit(e){e.preventDefault();let r=new FormData(e.target);this.npc.getFieldKeys().forEach(n=>{this.npc.setFieldValue(n,r.get(n).toString())}),this.npc.notes=r.get("notes").toString(),rn(this.npc),this._disableEdit()}_deleteNPC(){Di(this.npc.id)}_reroll(e){let r=e.target.dataset.field||"";if(r==="")return;let n=Xe.getFieldByKey(r),i=rt(n.source),o=this.shadowRoot.querySelector(`#${r}`);o.value=i.toString()}_refocus(){this.shadowRoot.querySelector("summary").focus()}};window.customElements.define("had-npc",Ai);var Zu=Ai;var ir=new je,bp=function(){return P.getState().npcs.map(e=>new Qe(e))},vp=function(t){let r=P.getState().npcs.find(n=>n.id===t);return r?new Qe(r):null},yp=function(t="view",e=null){return e instanceof Qe||(e=new Qe({}),Ku(Xe,pt,e)),P.dispatch(Oo({npc:e.toJSON()})),ir.trigger("npc:add",{item:e,mode:t}),e},rn=function(t){P.dispatch(No({npc:t.toJSON()})),ir.trigger("npc:edit",{item:t})},Di=function(t){P.dispatch(Ro({id:t})),ir.trigger("npc:delete",{id:t})},_p=function(t){P.dispatch(Mo({sortUuids:t}))},Ti=function(){P.dispatch(Fo())},Oi=function(t){P.dispatch(Po({npcs:t})),t.forEach(e=>{if(!e.id)return;let r=new Qe(e);ir.trigger("npc:add",{item:r})})},wp=function(){return new Zu};var Xu=class extends tn{constructor(){super({type:"npc",header:"NPCs",createButton:"Create NPC",service:nn})}_updateItem(){}};window.customElements.define("had-npcslist",Xu);var Ep=function(t){setTimeout(()=>{window.URL.revokeObjectURL(t.target.href),document.getElementById("export-output").innerHTML="",document.getElementById("export-button").hidden=!1},1e3)},xp=function(t){let e=P.getState(),r=new Date,n=new Blob([JSON.stringify(e)],{type:"application/json"}),i=URL.createObjectURL(n),o=`Hadleyville__${r.getFullYear()}_${r.getMonth()+1}_${r.getDate()}`,a=document.createElement("a");a.href=i,a.setAttribute("download",o),a.innerText="Download Export",a.addEventListener("click",Ep),document.getElementById("export-output").appendChild(a),document.getElementById("export-button").hidden=!0},kp=function(t){t.preventDefault();let r=t.target.querySelector("input[type=file]");!r.files||(Array.from(r.files).forEach(n=>{let i=new FileReader;i.onload=(o=>a=>{let s={};try{s=JSON.parse(a.target.result)}catch{return}let l=s.notes||[];l&&Array.isArray(l)&&l.length>0&&pi(l);let u=s.npcs||[];u&&Array.isArray(u)&&u.length>0&&Oi(u);let c=s.town||[];if(Array.isArray(c)){let d=c.find(Boolean);d&&d.id&&Ir(new Rt(d))}})(n),i.readAsText(n)}),r.value="")},Sp=function(t){!confirm("Are you really sure?")||(hi(),Ti(),pu())},Qu=function(){document.getElementById("btn-export").addEventListener("click",xp),document.getElementById("importForm").addEventListener("submit",kp),document.getElementById("btn-delete").addEventListener("click",Sp)};document.body.id==="page-settings"&&Qu();})(); /**! * Sortable 1.14.0 * @author RubaXa diff --git a/dist/index.js.map b/dist/index.js.map index a5dc825..262e792 100644 --- a/dist/index.js.map +++ b/dist/index.js.map @@ -1,7 +1,7 @@ { "version": 3, - "sources": ["../node_modules/merge/lib/src/index.js", "../node_modules/redux-localstorage-simple/dist/index.js", "../node_modules/markdown-it/lib/common/entities.js", "../node_modules/uc.micro/categories/P/regex.js", "../node_modules/mdurl/encode.js", "../node_modules/mdurl/decode.js", "../node_modules/mdurl/format.js", "../node_modules/mdurl/parse.js", "../node_modules/mdurl/index.js", "../node_modules/uc.micro/properties/Any/regex.js", "../node_modules/uc.micro/categories/Cc/regex.js", "../node_modules/uc.micro/categories/Cf/regex.js", "../node_modules/uc.micro/categories/Z/regex.js", "../node_modules/uc.micro/index.js", "../node_modules/markdown-it/lib/common/utils.js", "../node_modules/markdown-it/lib/helpers/parse_link_label.js", "../node_modules/markdown-it/lib/helpers/parse_link_destination.js", "../node_modules/markdown-it/lib/helpers/parse_link_title.js", "../node_modules/markdown-it/lib/helpers/index.js", "../node_modules/markdown-it/lib/renderer.js", "../node_modules/markdown-it/lib/ruler.js", "../node_modules/markdown-it/lib/rules_core/normalize.js", "../node_modules/markdown-it/lib/rules_core/block.js", "../node_modules/markdown-it/lib/rules_core/inline.js", "../node_modules/markdown-it/lib/rules_core/linkify.js", "../node_modules/markdown-it/lib/rules_core/replacements.js", "../node_modules/markdown-it/lib/rules_core/smartquotes.js", "../node_modules/markdown-it/lib/token.js", "../node_modules/markdown-it/lib/rules_core/state_core.js", "../node_modules/markdown-it/lib/parser_core.js", "../node_modules/markdown-it/lib/rules_block/table.js", "../node_modules/markdown-it/lib/rules_block/code.js", "../node_modules/markdown-it/lib/rules_block/fence.js", "../node_modules/markdown-it/lib/rules_block/blockquote.js", "../node_modules/markdown-it/lib/rules_block/hr.js", "../node_modules/markdown-it/lib/rules_block/list.js", "../node_modules/markdown-it/lib/rules_block/reference.js", "../node_modules/markdown-it/lib/common/html_blocks.js", "../node_modules/markdown-it/lib/common/html_re.js", "../node_modules/markdown-it/lib/rules_block/html_block.js", "../node_modules/markdown-it/lib/rules_block/heading.js", "../node_modules/markdown-it/lib/rules_block/lheading.js", "../node_modules/markdown-it/lib/rules_block/paragraph.js", "../node_modules/markdown-it/lib/rules_block/state_block.js", "../node_modules/markdown-it/lib/parser_block.js", "../node_modules/markdown-it/lib/rules_inline/text.js", "../node_modules/markdown-it/lib/rules_inline/newline.js", "../node_modules/markdown-it/lib/rules_inline/escape.js", "../node_modules/markdown-it/lib/rules_inline/backticks.js", "../node_modules/markdown-it/lib/rules_inline/strikethrough.js", "../node_modules/markdown-it/lib/rules_inline/emphasis.js", "../node_modules/markdown-it/lib/rules_inline/link.js", "../node_modules/markdown-it/lib/rules_inline/image.js", "../node_modules/markdown-it/lib/rules_inline/autolink.js", "../node_modules/markdown-it/lib/rules_inline/html_inline.js", "../node_modules/markdown-it/lib/rules_inline/entity.js", "../node_modules/markdown-it/lib/rules_inline/balance_pairs.js", "../node_modules/markdown-it/lib/rules_inline/text_collapse.js", "../node_modules/markdown-it/lib/rules_inline/state_inline.js", "../node_modules/markdown-it/lib/parser_inline.js", "../node_modules/linkify-it/lib/re.js", "../node_modules/linkify-it/index.js", "../node_modules/punycode/punycode.js", "../node_modules/markdown-it/lib/presets/default.js", "../node_modules/markdown-it/lib/presets/zero.js", "../node_modules/markdown-it/lib/presets/commonmark.js", "../node_modules/markdown-it/lib/index.js", "../node_modules/markdown-it/index.js", "../node_modules/rpg-table-randomizer/src/r_helpers.js", "../node_modules/rpg-table-randomizer/src/DisplayOptions.js", "../node_modules/rpg-table-randomizer/src/RandomTableEntry.js", "../node_modules/rpg-table-randomizer/src/randomizer.js", "../node_modules/rpg-table-randomizer/src/RandomTable.js", "../node_modules/rpg-table-randomizer/src/RandomTableResult.js", "../node_modules/rpg-table-randomizer/src/RandomTableResultSet.js", "../node_modules/rpg-table-randomizer/src/dice_roller.js", "../node_modules/rpg-table-randomizer/src/TableError.js", "../node_modules/rpg-table-randomizer/src/TableErrorResult.js", "../node_modules/rpg-table-randomizer/src/TableRoller.js", "../node_modules/rpg-table-randomizer/src/MarkovGenerator.js", "../node_modules/rpg-table-randomizer/src/RandomNameError.js", "../node_modules/rpg-table-randomizer/src/RandomNameType.js", "../node_modules/rpg-table-randomizer/src/RandomNameGenerator.js", "../src/data/tables.js", "../src/data/names.js", "../src/models/EventEmitter.js", "../src/services/randomTableService.js", "../src/components/header.js", "../src/components/footer.js", "../node_modules/a11y-dialog/dist/a11y-dialog.esm.js", "../node_modules/immer/src/utils/errors.ts", "../node_modules/immer/src/utils/common.ts", "../node_modules/immer/src/utils/plugins.ts", "../node_modules/immer/src/core/scope.ts", "../node_modules/immer/src/core/finalize.ts", "../node_modules/immer/src/core/proxy.ts", "../node_modules/immer/src/core/immerClass.ts", "../node_modules/immer/src/core/current.ts", "../node_modules/immer/src/plugins/es5.ts", "../node_modules/immer/src/plugins/patches.ts", "../node_modules/immer/src/plugins/mapset.ts", "../node_modules/immer/src/plugins/all.ts", "../node_modules/immer/src/immer.ts", "../node_modules/immer/src/utils/env.ts", "../node_modules/@babel/runtime/helpers/esm/defineProperty.js", "../node_modules/@babel/runtime/helpers/esm/objectSpread2.js", "../node_modules/redux/es/redux.js", "../node_modules/redux-thunk/es/index.js", "../node_modules/@reduxjs/toolkit/src/index.ts", "../node_modules/@reduxjs/toolkit/src/createDraftSafeSelector.ts", "../node_modules/@reduxjs/toolkit/src/configureStore.ts", "../node_modules/@reduxjs/toolkit/src/devtoolsExtension.ts", "../node_modules/@reduxjs/toolkit/src/isPlainObject.ts", "../node_modules/@reduxjs/toolkit/src/getDefaultMiddleware.ts", "../node_modules/@reduxjs/toolkit/src/utils.ts", "../node_modules/@reduxjs/toolkit/src/immutableStateInvariantMiddleware.ts", "../node_modules/@reduxjs/toolkit/src/serializableStateInvariantMiddleware.ts", "../node_modules/@reduxjs/toolkit/src/createAction.ts", "../node_modules/@reduxjs/toolkit/src/createReducer.ts", "../node_modules/@reduxjs/toolkit/src/mapBuilders.ts", "../node_modules/@reduxjs/toolkit/src/createSlice.ts", "../node_modules/@reduxjs/toolkit/src/entities/entity_state.ts", "../node_modules/@reduxjs/toolkit/src/entities/state_selectors.ts", "../node_modules/@reduxjs/toolkit/src/entities/state_adapter.ts", "../node_modules/@reduxjs/toolkit/src/entities/utils.ts", "../node_modules/@reduxjs/toolkit/src/entities/unsorted_state_adapter.ts", "../node_modules/@reduxjs/toolkit/src/entities/sorted_state_adapter.ts", "../node_modules/@reduxjs/toolkit/src/entities/create_adapter.ts", "../node_modules/@reduxjs/toolkit/src/nanoid.ts", "../node_modules/@reduxjs/toolkit/src/createAsyncThunk.ts", "../node_modules/@reduxjs/toolkit/src/tsHelpers.ts", "../node_modules/@reduxjs/toolkit/src/matchers.ts", "../node_modules/@reduxjs/toolkit/dist/redux-toolkit.esm.js", "../src/store/notes-reducer.js", "../src/store/npcs-reducer.js", "../src/store/town-reducer.js", "../src/store/store.js", "../node_modules/uuid/dist/esm-browser/rng.js", "../node_modules/uuid/dist/esm-browser/regex.js", "../node_modules/uuid/dist/esm-browser/validate.js", "../node_modules/uuid/dist/esm-browser/stringify.js", "../node_modules/uuid/dist/esm-browser/v4.js", "../src/models/note.js", "../src/services/notesService.js", "../src/components/rtabledisplay.js", "../src/components/tabledrawer.js", "../node_modules/rpg-table-randomizer/src/NPC.js", "../node_modules/rpg-table-randomizer/src/NPCSchemaField.js", "../node_modules/rpg-table-randomizer/src/NPCSchema.js", "../src/models/town.js", "../src/services/townService.js", "../src/components/towndisplay.js", "../src/components/notedisplay.js", "../node_modules/sortablejs/modular/sortable.core.esm.js", "../src/components/noteslist.js", "../src/components/diceroller.js", "../src/models/npcSchema.js", "../src/models/npc.js", "../src/services/npcService.js", "../src/components/npcdisplay.js", "../src/components/npcslist.js", "../src/services/importExportService.js", "../src/index.js"], - "sourcesContent": ["\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.isPlainObject = exports.clone = exports.recursive = exports.merge = exports.main = void 0;\r\nmodule.exports = exports = main;\r\nexports.default = main;\r\nfunction main() {\r\n var items = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n items[_i] = arguments[_i];\r\n }\r\n return merge.apply(void 0, items);\r\n}\r\nexports.main = main;\r\nmain.clone = clone;\r\nmain.isPlainObject = isPlainObject;\r\nmain.recursive = recursive;\r\nfunction merge() {\r\n var items = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n items[_i] = arguments[_i];\r\n }\r\n return _merge(items[0] === true, false, items);\r\n}\r\nexports.merge = merge;\r\nfunction recursive() {\r\n var items = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n items[_i] = arguments[_i];\r\n }\r\n return _merge(items[0] === true, true, items);\r\n}\r\nexports.recursive = recursive;\r\nfunction clone(input) {\r\n if (Array.isArray(input)) {\r\n var output = [];\r\n for (var index = 0; index < input.length; ++index)\r\n output.push(clone(input[index]));\r\n return output;\r\n }\r\n else if (isPlainObject(input)) {\r\n var output = {};\r\n for (var index in input)\r\n output[index] = clone(input[index]);\r\n return output;\r\n }\r\n else {\r\n return input;\r\n }\r\n}\r\nexports.clone = clone;\r\nfunction isPlainObject(input) {\r\n return input && typeof input === 'object' && !Array.isArray(input);\r\n}\r\nexports.isPlainObject = isPlainObject;\r\nfunction _recursiveMerge(base, extend) {\r\n if (!isPlainObject(base))\r\n return extend;\r\n for (var key in extend) {\r\n if (key === '__proto__' || key === 'constructor' || key === 'prototype')\r\n continue;\r\n base[key] = (isPlainObject(base[key]) && isPlainObject(extend[key])) ?\r\n _recursiveMerge(base[key], extend[key]) :\r\n extend[key];\r\n }\r\n return base;\r\n}\r\nfunction _merge(isClone, isRecursive, items) {\r\n var result;\r\n if (isClone || !isPlainObject(result = items.shift()))\r\n result = {};\r\n for (var index = 0; index < items.length; ++index) {\r\n var item = items[index];\r\n if (!isPlainObject(item))\r\n continue;\r\n for (var key in item) {\r\n if (key === '__proto__' || key === 'constructor' || key === 'prototype')\r\n continue;\r\n var value = isClone ? clone(item[key]) : item[key];\r\n result[key] = isRecursive ? _recursiveMerge(result[key], value) : value;\r\n }\r\n }\r\n return result;\r\n}\r\n", "'use strict';var _merge=_interopRequireDefault(require(\"merge\"));Object.defineProperty(exports,\"__esModule\",{value:!0}),exports.save=save,exports.load=load,exports.combineLoads=combineLoads,exports.clear=clear;function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _slicedToArray(a,b){return _arrayWithHoles(a)||_iterableToArrayLimit(a,b)||_unsupportedIterableToArray(a,b)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")}function _unsupportedIterableToArray(a,b){if(a){if(\"string\"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return\"Object\"===c&&a.constructor&&(c=a.constructor.name),\"Map\"===c||\"Set\"===c?Array.from(a):\"Arguments\"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c utf16string }\n//\n'use strict';\n\n/*eslint quotes:0*/\nmodule.exports = require('entities/lib/maps/entities.json');\n", "module.exports=/[!-#%-\\*,-\\/:;\\?@\\[-\\]_\\{\\}\\xA1\\xA7\\xAB\\xB6\\xB7\\xBB\\xBF\\u037E\\u0387\\u055A-\\u055F\\u0589\\u058A\\u05BE\\u05C0\\u05C3\\u05C6\\u05F3\\u05F4\\u0609\\u060A\\u060C\\u060D\\u061B\\u061E\\u061F\\u066A-\\u066D\\u06D4\\u0700-\\u070D\\u07F7-\\u07F9\\u0830-\\u083E\\u085E\\u0964\\u0965\\u0970\\u09FD\\u0A76\\u0AF0\\u0C84\\u0DF4\\u0E4F\\u0E5A\\u0E5B\\u0F04-\\u0F12\\u0F14\\u0F3A-\\u0F3D\\u0F85\\u0FD0-\\u0FD4\\u0FD9\\u0FDA\\u104A-\\u104F\\u10FB\\u1360-\\u1368\\u1400\\u166D\\u166E\\u169B\\u169C\\u16EB-\\u16ED\\u1735\\u1736\\u17D4-\\u17D6\\u17D8-\\u17DA\\u1800-\\u180A\\u1944\\u1945\\u1A1E\\u1A1F\\u1AA0-\\u1AA6\\u1AA8-\\u1AAD\\u1B5A-\\u1B60\\u1BFC-\\u1BFF\\u1C3B-\\u1C3F\\u1C7E\\u1C7F\\u1CC0-\\u1CC7\\u1CD3\\u2010-\\u2027\\u2030-\\u2043\\u2045-\\u2051\\u2053-\\u205E\\u207D\\u207E\\u208D\\u208E\\u2308-\\u230B\\u2329\\u232A\\u2768-\\u2775\\u27C5\\u27C6\\u27E6-\\u27EF\\u2983-\\u2998\\u29D8-\\u29DB\\u29FC\\u29FD\\u2CF9-\\u2CFC\\u2CFE\\u2CFF\\u2D70\\u2E00-\\u2E2E\\u2E30-\\u2E4E\\u3001-\\u3003\\u3008-\\u3011\\u3014-\\u301F\\u3030\\u303D\\u30A0\\u30FB\\uA4FE\\uA4FF\\uA60D-\\uA60F\\uA673\\uA67E\\uA6F2-\\uA6F7\\uA874-\\uA877\\uA8CE\\uA8CF\\uA8F8-\\uA8FA\\uA8FC\\uA92E\\uA92F\\uA95F\\uA9C1-\\uA9CD\\uA9DE\\uA9DF\\uAA5C-\\uAA5F\\uAADE\\uAADF\\uAAF0\\uAAF1\\uABEB\\uFD3E\\uFD3F\\uFE10-\\uFE19\\uFE30-\\uFE52\\uFE54-\\uFE61\\uFE63\\uFE68\\uFE6A\\uFE6B\\uFF01-\\uFF03\\uFF05-\\uFF0A\\uFF0C-\\uFF0F\\uFF1A\\uFF1B\\uFF1F\\uFF20\\uFF3B-\\uFF3D\\uFF3F\\uFF5B\\uFF5D\\uFF5F-\\uFF65]|\\uD800[\\uDD00-\\uDD02\\uDF9F\\uDFD0]|\\uD801\\uDD6F|\\uD802[\\uDC57\\uDD1F\\uDD3F\\uDE50-\\uDE58\\uDE7F\\uDEF0-\\uDEF6\\uDF39-\\uDF3F\\uDF99-\\uDF9C]|\\uD803[\\uDF55-\\uDF59]|\\uD804[\\uDC47-\\uDC4D\\uDCBB\\uDCBC\\uDCBE-\\uDCC1\\uDD40-\\uDD43\\uDD74\\uDD75\\uDDC5-\\uDDC8\\uDDCD\\uDDDB\\uDDDD-\\uDDDF\\uDE38-\\uDE3D\\uDEA9]|\\uD805[\\uDC4B-\\uDC4F\\uDC5B\\uDC5D\\uDCC6\\uDDC1-\\uDDD7\\uDE41-\\uDE43\\uDE60-\\uDE6C\\uDF3C-\\uDF3E]|\\uD806[\\uDC3B\\uDE3F-\\uDE46\\uDE9A-\\uDE9C\\uDE9E-\\uDEA2]|\\uD807[\\uDC41-\\uDC45\\uDC70\\uDC71\\uDEF7\\uDEF8]|\\uD809[\\uDC70-\\uDC74]|\\uD81A[\\uDE6E\\uDE6F\\uDEF5\\uDF37-\\uDF3B\\uDF44]|\\uD81B[\\uDE97-\\uDE9A]|\\uD82F\\uDC9F|\\uD836[\\uDE87-\\uDE8B]|\\uD83A[\\uDD5E\\uDD5F]/", "\n'use strict';\n\n\nvar encodeCache = {};\n\n\n// Create a lookup array where anything but characters in `chars` string\n// and alphanumeric chars is percent-encoded.\n//\nfunction getEncodeCache(exclude) {\n var i, ch, cache = encodeCache[exclude];\n if (cache) { return cache; }\n\n cache = encodeCache[exclude] = [];\n\n for (i = 0; i < 128; i++) {\n ch = String.fromCharCode(i);\n\n if (/^[0-9a-z]$/i.test(ch)) {\n // always allow unencoded alphanumeric characters\n cache.push(ch);\n } else {\n cache.push('%' + ('0' + i.toString(16).toUpperCase()).slice(-2));\n }\n }\n\n for (i = 0; i < exclude.length; i++) {\n cache[exclude.charCodeAt(i)] = exclude[i];\n }\n\n return cache;\n}\n\n\n// Encode unsafe characters with percent-encoding, skipping already\n// encoded sequences.\n//\n// - string - string to encode\n// - exclude - list of characters to ignore (in addition to a-zA-Z0-9)\n// - keepEscaped - don't encode '%' in a correct escape sequence (default: true)\n//\nfunction encode(string, exclude, keepEscaped) {\n var i, l, code, nextCode, cache,\n result = '';\n\n if (typeof exclude !== 'string') {\n // encode(string, keepEscaped)\n keepEscaped = exclude;\n exclude = encode.defaultChars;\n }\n\n if (typeof keepEscaped === 'undefined') {\n keepEscaped = true;\n }\n\n cache = getEncodeCache(exclude);\n\n for (i = 0, l = string.length; i < l; i++) {\n code = string.charCodeAt(i);\n\n if (keepEscaped && code === 0x25 /* % */ && i + 2 < l) {\n if (/^[0-9a-f]{2}$/i.test(string.slice(i + 1, i + 3))) {\n result += string.slice(i, i + 3);\n i += 2;\n continue;\n }\n }\n\n if (code < 128) {\n result += cache[code];\n continue;\n }\n\n if (code >= 0xD800 && code <= 0xDFFF) {\n if (code >= 0xD800 && code <= 0xDBFF && i + 1 < l) {\n nextCode = string.charCodeAt(i + 1);\n if (nextCode >= 0xDC00 && nextCode <= 0xDFFF) {\n result += encodeURIComponent(string[i] + string[i + 1]);\n i++;\n continue;\n }\n }\n result += '%EF%BF%BD';\n continue;\n }\n\n result += encodeURIComponent(string[i]);\n }\n\n return result;\n}\n\nencode.defaultChars = \";/?:@&=+$,-_.!~*'()#\";\nencode.componentChars = \"-_.!~*'()\";\n\n\nmodule.exports = encode;\n", "\n'use strict';\n\n\n/* eslint-disable no-bitwise */\n\nvar decodeCache = {};\n\nfunction getDecodeCache(exclude) {\n var i, ch, cache = decodeCache[exclude];\n if (cache) { return cache; }\n\n cache = decodeCache[exclude] = [];\n\n for (i = 0; i < 128; i++) {\n ch = String.fromCharCode(i);\n cache.push(ch);\n }\n\n for (i = 0; i < exclude.length; i++) {\n ch = exclude.charCodeAt(i);\n cache[ch] = '%' + ('0' + ch.toString(16).toUpperCase()).slice(-2);\n }\n\n return cache;\n}\n\n\n// Decode percent-encoded string.\n//\nfunction decode(string, exclude) {\n var cache;\n\n if (typeof exclude !== 'string') {\n exclude = decode.defaultChars;\n }\n\n cache = getDecodeCache(exclude);\n\n return string.replace(/(%[a-f0-9]{2})+/gi, function(seq) {\n var i, l, b1, b2, b3, b4, chr,\n result = '';\n\n for (i = 0, l = seq.length; i < l; i += 3) {\n b1 = parseInt(seq.slice(i + 1, i + 3), 16);\n\n if (b1 < 0x80) {\n result += cache[b1];\n continue;\n }\n\n if ((b1 & 0xE0) === 0xC0 && (i + 3 < l)) {\n // 110xxxxx 10xxxxxx\n b2 = parseInt(seq.slice(i + 4, i + 6), 16);\n\n if ((b2 & 0xC0) === 0x80) {\n chr = ((b1 << 6) & 0x7C0) | (b2 & 0x3F);\n\n if (chr < 0x80) {\n result += '\\ufffd\\ufffd';\n } else {\n result += String.fromCharCode(chr);\n }\n\n i += 3;\n continue;\n }\n }\n\n if ((b1 & 0xF0) === 0xE0 && (i + 6 < l)) {\n // 1110xxxx 10xxxxxx 10xxxxxx\n b2 = parseInt(seq.slice(i + 4, i + 6), 16);\n b3 = parseInt(seq.slice(i + 7, i + 9), 16);\n\n if ((b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80) {\n chr = ((b1 << 12) & 0xF000) | ((b2 << 6) & 0xFC0) | (b3 & 0x3F);\n\n if (chr < 0x800 || (chr >= 0xD800 && chr <= 0xDFFF)) {\n result += '\\ufffd\\ufffd\\ufffd';\n } else {\n result += String.fromCharCode(chr);\n }\n\n i += 6;\n continue;\n }\n }\n\n if ((b1 & 0xF8) === 0xF0 && (i + 9 < l)) {\n // 111110xx 10xxxxxx 10xxxxxx 10xxxxxx\n b2 = parseInt(seq.slice(i + 4, i + 6), 16);\n b3 = parseInt(seq.slice(i + 7, i + 9), 16);\n b4 = parseInt(seq.slice(i + 10, i + 12), 16);\n\n if ((b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80 && (b4 & 0xC0) === 0x80) {\n chr = ((b1 << 18) & 0x1C0000) | ((b2 << 12) & 0x3F000) | ((b3 << 6) & 0xFC0) | (b4 & 0x3F);\n\n if (chr < 0x10000 || chr > 0x10FFFF) {\n result += '\\ufffd\\ufffd\\ufffd\\ufffd';\n } else {\n chr -= 0x10000;\n result += String.fromCharCode(0xD800 + (chr >> 10), 0xDC00 + (chr & 0x3FF));\n }\n\n i += 9;\n continue;\n }\n }\n\n result += '\\ufffd';\n }\n\n return result;\n });\n}\n\n\ndecode.defaultChars = ';/?:@&=+$,#';\ndecode.componentChars = '';\n\n\nmodule.exports = decode;\n", "\n'use strict';\n\n\nmodule.exports = function format(url) {\n var result = '';\n\n result += url.protocol || '';\n result += url.slashes ? '//' : '';\n result += url.auth ? url.auth + '@' : '';\n\n if (url.hostname && url.hostname.indexOf(':') !== -1) {\n // ipv6 address\n result += '[' + url.hostname + ']';\n } else {\n result += url.hostname || '';\n }\n\n result += url.port ? ':' + url.port : '';\n result += url.pathname || '';\n result += url.search || '';\n result += url.hash || '';\n\n return result;\n};\n", "// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n//\n// Changes from joyent/node:\n//\n// 1. No leading slash in paths,\n// e.g. in `url.parse('http://foo?bar')` pathname is ``, not `/`\n//\n// 2. Backslashes are not replaced with slashes,\n// so `http:\\\\example.org\\` is treated like a relative path\n//\n// 3. Trailing colon is treated like a part of the path,\n// i.e. in `http://example.org:foo` pathname is `:foo`\n//\n// 4. Nothing is URL-encoded in the resulting object,\n// (in joyent/node some chars in auth and paths are encoded)\n//\n// 5. `url.parse()` does not have `parseQueryString` argument\n//\n// 6. Removed extraneous result properties: `host`, `path`, `query`, etc.,\n// which can be constructed using other parts of the url.\n//\n\n\nfunction Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.pathname = null;\n}\n\n// Reference: RFC 3986, RFC 1808, RFC 2396\n\n// define these here so at least they only have to be\n// compiled once on the first module load.\nvar protocolPattern = /^([a-z0-9.+-]+:)/i,\n portPattern = /:[0-9]*$/,\n\n // Special case for a simple path URL\n simplePathPattern = /^(\\/\\/?(?!\\/)[^\\?\\s]*)(\\?[^\\s]*)?$/,\n\n // RFC 2396: characters reserved for delimiting URLs.\n // We actually just auto-escape these.\n delims = [ '<', '>', '\"', '`', ' ', '\\r', '\\n', '\\t' ],\n\n // RFC 2396: characters not allowed for various reasons.\n unwise = [ '{', '}', '|', '\\\\', '^', '`' ].concat(delims),\n\n // Allowed by RFCs, but cause of XSS attacks. Always escape these.\n autoEscape = [ '\\'' ].concat(unwise),\n // Characters that are never ever allowed in a hostname.\n // Note that any invalid chars are also handled, but these\n // are the ones that are *expected* to be seen, so we fast-path\n // them.\n nonHostChars = [ '%', '/', '?', ';', '#' ].concat(autoEscape),\n hostEndingChars = [ '/', '?', '#' ],\n hostnameMaxLen = 255,\n hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,\n hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,\n // protocols that can allow \"unsafe\" and \"unwise\" chars.\n /* eslint-disable no-script-url */\n // protocols that never have a hostname.\n hostlessProtocol = {\n 'javascript': true,\n 'javascript:': true\n },\n // protocols that always contain a // bit.\n slashedProtocol = {\n 'http': true,\n 'https': true,\n 'ftp': true,\n 'gopher': true,\n 'file': true,\n 'http:': true,\n 'https:': true,\n 'ftp:': true,\n 'gopher:': true,\n 'file:': true\n };\n /* eslint-enable no-script-url */\n\nfunction urlParse(url, slashesDenoteHost) {\n if (url && url instanceof Url) { return url; }\n\n var u = new Url();\n u.parse(url, slashesDenoteHost);\n return u;\n}\n\nUrl.prototype.parse = function(url, slashesDenoteHost) {\n var i, l, lowerProto, hec, slashes,\n rest = url;\n\n // trim before proceeding.\n // This is to support parse stuff like \" http://foo.com \\n\"\n rest = rest.trim();\n\n if (!slashesDenoteHost && url.split('#').length === 1) {\n // Try fast path regexp\n var simplePath = simplePathPattern.exec(rest);\n if (simplePath) {\n this.pathname = simplePath[1];\n if (simplePath[2]) {\n this.search = simplePath[2];\n }\n return this;\n }\n }\n\n var proto = protocolPattern.exec(rest);\n if (proto) {\n proto = proto[0];\n lowerProto = proto.toLowerCase();\n this.protocol = proto;\n rest = rest.substr(proto.length);\n }\n\n // figure out if it's got a host\n // user@server is *always* interpreted as a hostname, and url\n // resolution will treat //foo/bar as host=foo,path=bar because that's\n // how the browser resolves relative URLs.\n if (slashesDenoteHost || proto || rest.match(/^\\/\\/[^@\\/]+@[^@\\/]+/)) {\n slashes = rest.substr(0, 2) === '//';\n if (slashes && !(proto && hostlessProtocol[proto])) {\n rest = rest.substr(2);\n this.slashes = true;\n }\n }\n\n if (!hostlessProtocol[proto] &&\n (slashes || (proto && !slashedProtocol[proto]))) {\n\n // there's a hostname.\n // the first instance of /, ?, ;, or # ends the host.\n //\n // If there is an @ in the hostname, then non-host chars *are* allowed\n // to the left of the last @ sign, unless some host-ending character\n // comes *before* the @-sign.\n // URLs are obnoxious.\n //\n // ex:\n // http://a@b@c/ => user:a@b host:c\n // http://a@b?@c => user:a host:c path:/?@c\n\n // v0.12 TODO(isaacs): This is not quite how Chrome does things.\n // Review our test case against browsers more comprehensively.\n\n // find the first instance of any hostEndingChars\n var hostEnd = -1;\n for (i = 0; i < hostEndingChars.length; i++) {\n hec = rest.indexOf(hostEndingChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) {\n hostEnd = hec;\n }\n }\n\n // at this point, either we have an explicit point where the\n // auth portion cannot go past, or the last @ char is the decider.\n var auth, atSign;\n if (hostEnd === -1) {\n // atSign can be anywhere.\n atSign = rest.lastIndexOf('@');\n } else {\n // atSign must be in auth portion.\n // http://a@b/c@d => host:b auth:a path:/c@d\n atSign = rest.lastIndexOf('@', hostEnd);\n }\n\n // Now we have a portion which is definitely the auth.\n // Pull that off.\n if (atSign !== -1) {\n auth = rest.slice(0, atSign);\n rest = rest.slice(atSign + 1);\n this.auth = auth;\n }\n\n // the host is the remaining to the left of the first non-host char\n hostEnd = -1;\n for (i = 0; i < nonHostChars.length; i++) {\n hec = rest.indexOf(nonHostChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) {\n hostEnd = hec;\n }\n }\n // if we still have not hit it, then the entire thing is a host.\n if (hostEnd === -1) {\n hostEnd = rest.length;\n }\n\n if (rest[hostEnd - 1] === ':') { hostEnd--; }\n var host = rest.slice(0, hostEnd);\n rest = rest.slice(hostEnd);\n\n // pull out port.\n this.parseHost(host);\n\n // we've indicated that there is a hostname,\n // so even if it's empty, it has to be present.\n this.hostname = this.hostname || '';\n\n // if hostname begins with [ and ends with ]\n // assume that it's an IPv6 address.\n var ipv6Hostname = this.hostname[0] === '[' &&\n this.hostname[this.hostname.length - 1] === ']';\n\n // validate a little.\n if (!ipv6Hostname) {\n var hostparts = this.hostname.split(/\\./);\n for (i = 0, l = hostparts.length; i < l; i++) {\n var part = hostparts[i];\n if (!part) { continue; }\n if (!part.match(hostnamePartPattern)) {\n var newpart = '';\n for (var j = 0, k = part.length; j < k; j++) {\n if (part.charCodeAt(j) > 127) {\n // we replace non-ASCII char with a temporary placeholder\n // we need this to make sure size of hostname is not\n // broken by replacing non-ASCII by nothing\n newpart += 'x';\n } else {\n newpart += part[j];\n }\n }\n // we test again with ASCII char only\n if (!newpart.match(hostnamePartPattern)) {\n var validParts = hostparts.slice(0, i);\n var notHost = hostparts.slice(i + 1);\n var bit = part.match(hostnamePartStart);\n if (bit) {\n validParts.push(bit[1]);\n notHost.unshift(bit[2]);\n }\n if (notHost.length) {\n rest = notHost.join('.') + rest;\n }\n this.hostname = validParts.join('.');\n break;\n }\n }\n }\n }\n\n if (this.hostname.length > hostnameMaxLen) {\n this.hostname = '';\n }\n\n // strip [ and ] from the hostname\n // the host field still retains them, though\n if (ipv6Hostname) {\n this.hostname = this.hostname.substr(1, this.hostname.length - 2);\n }\n }\n\n // chop off from the tail first.\n var hash = rest.indexOf('#');\n if (hash !== -1) {\n // got a fragment string.\n this.hash = rest.substr(hash);\n rest = rest.slice(0, hash);\n }\n var qm = rest.indexOf('?');\n if (qm !== -1) {\n this.search = rest.substr(qm);\n rest = rest.slice(0, qm);\n }\n if (rest) { this.pathname = rest; }\n if (slashedProtocol[lowerProto] &&\n this.hostname && !this.pathname) {\n this.pathname = '';\n }\n\n return this;\n};\n\nUrl.prototype.parseHost = function(host) {\n var port = portPattern.exec(host);\n if (port) {\n port = port[0];\n if (port !== ':') {\n this.port = port.substr(1);\n }\n host = host.substr(0, host.length - port.length);\n }\n if (host) { this.hostname = host; }\n};\n\nmodule.exports = urlParse;\n", "'use strict';\n\n\nmodule.exports.encode = require('./encode');\nmodule.exports.decode = require('./decode');\nmodule.exports.format = require('./format');\nmodule.exports.parse = require('./parse');\n", "module.exports=/[\\0-\\uD7FF\\uE000-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF]/", "module.exports=/[\\0-\\x1F\\x7F-\\x9F]/", "module.exports=/[\\xAD\\u0600-\\u0605\\u061C\\u06DD\\u070F\\u08E2\\u180E\\u200B-\\u200F\\u202A-\\u202E\\u2060-\\u2064\\u2066-\\u206F\\uFEFF\\uFFF9-\\uFFFB]|\\uD804[\\uDCBD\\uDCCD]|\\uD82F[\\uDCA0-\\uDCA3]|\\uD834[\\uDD73-\\uDD7A]|\\uDB40[\\uDC01\\uDC20-\\uDC7F]/", "module.exports=/[ \\xA0\\u1680\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000]/", "'use strict';\n\nexports.Any = require('./properties/Any/regex');\nexports.Cc = require('./categories/Cc/regex');\nexports.Cf = require('./categories/Cf/regex');\nexports.P = require('./categories/P/regex');\nexports.Z = require('./categories/Z/regex');\n", "// Utilities\n//\n'use strict';\n\n\nfunction _class(obj) { return Object.prototype.toString.call(obj); }\n\nfunction isString(obj) { return _class(obj) === '[object String]'; }\n\nvar _hasOwnProperty = Object.prototype.hasOwnProperty;\n\nfunction has(object, key) {\n return _hasOwnProperty.call(object, key);\n}\n\n// Merge objects\n//\nfunction assign(obj /*from1, from2, from3, ...*/) {\n var sources = Array.prototype.slice.call(arguments, 1);\n\n sources.forEach(function (source) {\n if (!source) { return; }\n\n if (typeof source !== 'object') {\n throw new TypeError(source + 'must be object');\n }\n\n Object.keys(source).forEach(function (key) {\n obj[key] = source[key];\n });\n });\n\n return obj;\n}\n\n// Remove element from array and put another array at those position.\n// Useful for some operations with tokens\nfunction arrayReplaceAt(src, pos, newElements) {\n return [].concat(src.slice(0, pos), newElements, src.slice(pos + 1));\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\nfunction isValidEntityCode(c) {\n /*eslint no-bitwise:0*/\n // broken sequence\n if (c >= 0xD800 && c <= 0xDFFF) { return false; }\n // never used\n if (c >= 0xFDD0 && c <= 0xFDEF) { return false; }\n if ((c & 0xFFFF) === 0xFFFF || (c & 0xFFFF) === 0xFFFE) { return false; }\n // control codes\n if (c >= 0x00 && c <= 0x08) { return false; }\n if (c === 0x0B) { return false; }\n if (c >= 0x0E && c <= 0x1F) { return false; }\n if (c >= 0x7F && c <= 0x9F) { return false; }\n // out of range\n if (c > 0x10FFFF) { return false; }\n return true;\n}\n\nfunction fromCodePoint(c) {\n /*eslint no-bitwise:0*/\n if (c > 0xffff) {\n c -= 0x10000;\n var surrogate1 = 0xd800 + (c >> 10),\n surrogate2 = 0xdc00 + (c & 0x3ff);\n\n return String.fromCharCode(surrogate1, surrogate2);\n }\n return String.fromCharCode(c);\n}\n\n\nvar UNESCAPE_MD_RE = /\\\\([!\"#$%&'()*+,\\-.\\/:;<=>?@[\\\\\\]^_`{|}~])/g;\nvar ENTITY_RE = /&([a-z#][a-z0-9]{1,31});/gi;\nvar UNESCAPE_ALL_RE = new RegExp(UNESCAPE_MD_RE.source + '|' + ENTITY_RE.source, 'gi');\n\nvar DIGITAL_ENTITY_TEST_RE = /^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i;\n\nvar entities = require('./entities');\n\nfunction replaceEntityPattern(match, name) {\n var code = 0;\n\n if (has(entities, name)) {\n return entities[name];\n }\n\n if (name.charCodeAt(0) === 0x23/* # */ && DIGITAL_ENTITY_TEST_RE.test(name)) {\n code = name[1].toLowerCase() === 'x' ?\n parseInt(name.slice(2), 16) : parseInt(name.slice(1), 10);\n\n if (isValidEntityCode(code)) {\n return fromCodePoint(code);\n }\n }\n\n return match;\n}\n\n/*function replaceEntities(str) {\n if (str.indexOf('&') < 0) { return str; }\n\n return str.replace(ENTITY_RE, replaceEntityPattern);\n}*/\n\nfunction unescapeMd(str) {\n if (str.indexOf('\\\\') < 0) { return str; }\n return str.replace(UNESCAPE_MD_RE, '$1');\n}\n\nfunction unescapeAll(str) {\n if (str.indexOf('\\\\') < 0 && str.indexOf('&') < 0) { return str; }\n\n return str.replace(UNESCAPE_ALL_RE, function (match, escaped, entity) {\n if (escaped) { return escaped; }\n return replaceEntityPattern(match, entity);\n });\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\nvar HTML_ESCAPE_TEST_RE = /[&<>\"]/;\nvar HTML_ESCAPE_REPLACE_RE = /[&<>\"]/g;\nvar HTML_REPLACEMENTS = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"'\n};\n\nfunction replaceUnsafeChar(ch) {\n return HTML_REPLACEMENTS[ch];\n}\n\nfunction escapeHtml(str) {\n if (HTML_ESCAPE_TEST_RE.test(str)) {\n return str.replace(HTML_ESCAPE_REPLACE_RE, replaceUnsafeChar);\n }\n return str;\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\nvar REGEXP_ESCAPE_RE = /[.?*+^$[\\]\\\\(){}|-]/g;\n\nfunction escapeRE(str) {\n return str.replace(REGEXP_ESCAPE_RE, '\\\\$&');\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\nfunction isSpace(code) {\n switch (code) {\n case 0x09:\n case 0x20:\n return true;\n }\n return false;\n}\n\n// Zs (unicode class) || [\\t\\f\\v\\r\\n]\nfunction isWhiteSpace(code) {\n if (code >= 0x2000 && code <= 0x200A) { return true; }\n switch (code) {\n case 0x09: // \\t\n case 0x0A: // \\n\n case 0x0B: // \\v\n case 0x0C: // \\f\n case 0x0D: // \\r\n case 0x20:\n case 0xA0:\n case 0x1680:\n case 0x202F:\n case 0x205F:\n case 0x3000:\n return true;\n }\n return false;\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\n/*eslint-disable max-len*/\nvar UNICODE_PUNCT_RE = require('uc.micro/categories/P/regex');\n\n// Currently without astral characters support.\nfunction isPunctChar(ch) {\n return UNICODE_PUNCT_RE.test(ch);\n}\n\n\n// Markdown ASCII punctuation characters.\n//\n// !, \", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \\, ], ^, _, `, {, |, }, or ~\n// http://spec.commonmark.org/0.15/#ascii-punctuation-character\n//\n// Don't confuse with unicode punctuation !!! It lacks some chars in ascii range.\n//\nfunction isMdAsciiPunct(ch) {\n switch (ch) {\n case 0x21/* ! */:\n case 0x22/* \" */:\n case 0x23/* # */:\n case 0x24/* $ */:\n case 0x25/* % */:\n case 0x26/* & */:\n case 0x27/* ' */:\n case 0x28/* ( */:\n case 0x29/* ) */:\n case 0x2A/* * */:\n case 0x2B/* + */:\n case 0x2C/* , */:\n case 0x2D/* - */:\n case 0x2E/* . */:\n case 0x2F/* / */:\n case 0x3A/* : */:\n case 0x3B/* ; */:\n case 0x3C/* < */:\n case 0x3D/* = */:\n case 0x3E/* > */:\n case 0x3F/* ? */:\n case 0x40/* @ */:\n case 0x5B/* [ */:\n case 0x5C/* \\ */:\n case 0x5D/* ] */:\n case 0x5E/* ^ */:\n case 0x5F/* _ */:\n case 0x60/* ` */:\n case 0x7B/* { */:\n case 0x7C/* | */:\n case 0x7D/* } */:\n case 0x7E/* ~ */:\n return true;\n default:\n return false;\n }\n}\n\n// Hepler to unify [reference labels].\n//\nfunction normalizeReference(str) {\n // Trim and collapse whitespace\n //\n str = str.trim().replace(/\\s+/g, ' ');\n\n // In node v10 '\u1E9E'.toLowerCase() === '\u1E7E', which is presumed to be a bug\n // fixed in v12 (couldn't find any details).\n //\n // So treat this one as a special case\n // (remove this when node v10 is no longer supported).\n //\n if ('\u1E9E'.toLowerCase() === '\u1E7E') {\n str = str.replace(/\u1E9E/g, '\u00DF');\n }\n\n // .toLowerCase().toUpperCase() should get rid of all differences\n // between letter variants.\n //\n // Simple .toLowerCase() doesn't normalize 125 code points correctly,\n // and .toUpperCase doesn't normalize 6 of them (list of exceptions:\n // \u0130, \u03F4, \u1E9E, \u2126, \u212A, \u212B - those are already uppercased, but have differently\n // uppercased versions).\n //\n // Here's an example showing how it happens. Lets take greek letter omega:\n // uppercase U+0398 (\u0398), U+03f4 (\u03F4) and lowercase U+03b8 (\u03B8), U+03d1 (\u03D1)\n //\n // Unicode entries:\n // 0398;GREEK CAPITAL LETTER THETA;Lu;0;L;;;;;N;;;;03B8;\n // 03B8;GREEK SMALL LETTER THETA;Ll;0;L;;;;;N;;;0398;;0398\n // 03D1;GREEK THETA SYMBOL;Ll;0;L; 03B8;;;;N;GREEK SMALL LETTER SCRIPT THETA;;0398;;0398\n // 03F4;GREEK CAPITAL THETA SYMBOL;Lu;0;L; 0398;;;;N;;;;03B8;\n //\n // Case-insensitive comparison should treat all of them as equivalent.\n //\n // But .toLowerCase() doesn't change \u03D1 (it's already lowercase),\n // and .toUpperCase() doesn't change \u03F4 (already uppercase).\n //\n // Applying first lower then upper case normalizes any character:\n // '\\u0398\\u03f4\\u03b8\\u03d1'.toLowerCase().toUpperCase() === '\\u0398\\u0398\\u0398\\u0398'\n //\n // Note: this is equivalent to unicode case folding; unicode normalization\n // is a different step that is not required here.\n //\n // Final result should be uppercased, because it's later stored in an object\n // (this avoid a conflict with Object.prototype members,\n // most notably, `__proto__`)\n //\n return str.toLowerCase().toUpperCase();\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\n// Re-export libraries commonly used in both markdown-it and its plugins,\n// so plugins won't have to depend on them explicitly, which reduces their\n// bundled size (e.g. a browser build).\n//\nexports.lib = {};\nexports.lib.mdurl = require('mdurl');\nexports.lib.ucmicro = require('uc.micro');\n\nexports.assign = assign;\nexports.isString = isString;\nexports.has = has;\nexports.unescapeMd = unescapeMd;\nexports.unescapeAll = unescapeAll;\nexports.isValidEntityCode = isValidEntityCode;\nexports.fromCodePoint = fromCodePoint;\n// exports.replaceEntities = replaceEntities;\nexports.escapeHtml = escapeHtml;\nexports.arrayReplaceAt = arrayReplaceAt;\nexports.isSpace = isSpace;\nexports.isWhiteSpace = isWhiteSpace;\nexports.isMdAsciiPunct = isMdAsciiPunct;\nexports.isPunctChar = isPunctChar;\nexports.escapeRE = escapeRE;\nexports.normalizeReference = normalizeReference;\n", "// Parse link label\n//\n// this function assumes that first character (\"[\") already matches;\n// returns the end of the label\n//\n'use strict';\n\nmodule.exports = function parseLinkLabel(state, start, disableNested) {\n var level, found, marker, prevPos,\n labelEnd = -1,\n max = state.posMax,\n oldPos = state.pos;\n\n state.pos = start + 1;\n level = 1;\n\n while (state.pos < max) {\n marker = state.src.charCodeAt(state.pos);\n if (marker === 0x5D /* ] */) {\n level--;\n if (level === 0) {\n found = true;\n break;\n }\n }\n\n prevPos = state.pos;\n state.md.inline.skipToken(state);\n if (marker === 0x5B /* [ */) {\n if (prevPos === state.pos - 1) {\n // increase level if we find text `[`, which is not a part of any token\n level++;\n } else if (disableNested) {\n state.pos = oldPos;\n return -1;\n }\n }\n }\n\n if (found) {\n labelEnd = state.pos;\n }\n\n // restore old state\n state.pos = oldPos;\n\n return labelEnd;\n};\n", "// Parse link destination\n//\n'use strict';\n\n\nvar unescapeAll = require('../common/utils').unescapeAll;\n\n\nmodule.exports = function parseLinkDestination(str, pos, max) {\n var code, level,\n lines = 0,\n start = pos,\n result = {\n ok: false,\n pos: 0,\n lines: 0,\n str: ''\n };\n\n if (str.charCodeAt(pos) === 0x3C /* < */) {\n pos++;\n while (pos < max) {\n code = str.charCodeAt(pos);\n if (code === 0x0A /* \\n */) { return result; }\n if (code === 0x3C /* < */) { return result; }\n if (code === 0x3E /* > */) {\n result.pos = pos + 1;\n result.str = unescapeAll(str.slice(start + 1, pos));\n result.ok = true;\n return result;\n }\n if (code === 0x5C /* \\ */ && pos + 1 < max) {\n pos += 2;\n continue;\n }\n\n pos++;\n }\n\n // no closing '>'\n return result;\n }\n\n // this should be ... } else { ... branch\n\n level = 0;\n while (pos < max) {\n code = str.charCodeAt(pos);\n\n if (code === 0x20) { break; }\n\n // ascii control characters\n if (code < 0x20 || code === 0x7F) { break; }\n\n if (code === 0x5C /* \\ */ && pos + 1 < max) {\n if (str.charCodeAt(pos + 1) === 0x20) { break; }\n pos += 2;\n continue;\n }\n\n if (code === 0x28 /* ( */) {\n level++;\n if (level > 32) { return result; }\n }\n\n if (code === 0x29 /* ) */) {\n if (level === 0) { break; }\n level--;\n }\n\n pos++;\n }\n\n if (start === pos) { return result; }\n if (level !== 0) { return result; }\n\n result.str = unescapeAll(str.slice(start, pos));\n result.lines = lines;\n result.pos = pos;\n result.ok = true;\n return result;\n};\n", "// Parse link title\n//\n'use strict';\n\n\nvar unescapeAll = require('../common/utils').unescapeAll;\n\n\nmodule.exports = function parseLinkTitle(str, pos, max) {\n var code,\n marker,\n lines = 0,\n start = pos,\n result = {\n ok: false,\n pos: 0,\n lines: 0,\n str: ''\n };\n\n if (pos >= max) { return result; }\n\n marker = str.charCodeAt(pos);\n\n if (marker !== 0x22 /* \" */ && marker !== 0x27 /* ' */ && marker !== 0x28 /* ( */) { return result; }\n\n pos++;\n\n // if opening marker is \"(\", switch it to closing marker \")\"\n if (marker === 0x28) { marker = 0x29; }\n\n while (pos < max) {\n code = str.charCodeAt(pos);\n if (code === marker) {\n result.pos = pos + 1;\n result.lines = lines;\n result.str = unescapeAll(str.slice(start + 1, pos));\n result.ok = true;\n return result;\n } else if (code === 0x28 /* ( */ && marker === 0x29 /* ) */) {\n return result;\n } else if (code === 0x0A) {\n lines++;\n } else if (code === 0x5C /* \\ */ && pos + 1 < max) {\n pos++;\n if (str.charCodeAt(pos) === 0x0A) {\n lines++;\n }\n }\n\n pos++;\n }\n\n return result;\n};\n", "// Just a shortcut for bulk export\n'use strict';\n\n\nexports.parseLinkLabel = require('./parse_link_label');\nexports.parseLinkDestination = require('./parse_link_destination');\nexports.parseLinkTitle = require('./parse_link_title');\n", "/**\n * class Renderer\n *\n * Generates HTML from parsed token stream. Each instance has independent\n * copy of rules. Those can be rewritten with ease. Also, you can add new\n * rules if you create plugin and adds new token types.\n **/\n'use strict';\n\n\nvar assign = require('./common/utils').assign;\nvar unescapeAll = require('./common/utils').unescapeAll;\nvar escapeHtml = require('./common/utils').escapeHtml;\n\n\n////////////////////////////////////////////////////////////////////////////////\n\nvar default_rules = {};\n\n\ndefault_rules.code_inline = function (tokens, idx, options, env, slf) {\n var token = tokens[idx];\n\n return '' +\n escapeHtml(tokens[idx].content) +\n '';\n};\n\n\ndefault_rules.code_block = function (tokens, idx, options, env, slf) {\n var token = tokens[idx];\n\n return '' +\n escapeHtml(tokens[idx].content) +\n '\\n';\n};\n\n\ndefault_rules.fence = function (tokens, idx, options, env, slf) {\n var token = tokens[idx],\n info = token.info ? unescapeAll(token.info).trim() : '',\n langName = '',\n langAttrs = '',\n highlighted, i, arr, tmpAttrs, tmpToken;\n\n if (info) {\n arr = info.split(/(\\s+)/g);\n langName = arr[0];\n langAttrs = arr.slice(2).join('');\n }\n\n if (options.highlight) {\n highlighted = options.highlight(token.content, langName, langAttrs) || escapeHtml(token.content);\n } else {\n highlighted = escapeHtml(token.content);\n }\n\n if (highlighted.indexOf(''\n + highlighted\n + '\\n';\n }\n\n\n return '
'\n        + highlighted\n        + '
\\n';\n};\n\n\ndefault_rules.image = function (tokens, idx, options, env, slf) {\n var token = tokens[idx];\n\n // \"alt\" attr MUST be set, even if empty. Because it's mandatory and\n // should be placed on proper position for tests.\n //\n // Replace content with actual value\n\n token.attrs[token.attrIndex('alt')][1] =\n slf.renderInlineAsText(token.children, options, env);\n\n return slf.renderToken(tokens, idx, options);\n};\n\n\ndefault_rules.hardbreak = function (tokens, idx, options /*, env */) {\n return options.xhtmlOut ? '
\\n' : '
\\n';\n};\ndefault_rules.softbreak = function (tokens, idx, options /*, env */) {\n return options.breaks ? (options.xhtmlOut ? '
\\n' : '
\\n') : '\\n';\n};\n\n\ndefault_rules.text = function (tokens, idx /*, options, env */) {\n return escapeHtml(tokens[idx].content);\n};\n\n\ndefault_rules.html_block = function (tokens, idx /*, options, env */) {\n return tokens[idx].content;\n};\ndefault_rules.html_inline = function (tokens, idx /*, options, env */) {\n return tokens[idx].content;\n};\n\n\n/**\n * new Renderer()\n *\n * Creates new [[Renderer]] instance and fill [[Renderer#rules]] with defaults.\n **/\nfunction Renderer() {\n\n /**\n * Renderer#rules -> Object\n *\n * Contains render rules for tokens. Can be updated and extended.\n *\n * ##### Example\n *\n * ```javascript\n * var md = require('markdown-it')();\n *\n * md.renderer.rules.strong_open = function () { return ''; };\n * md.renderer.rules.strong_close = function () { return ''; };\n *\n * var result = md.renderInline(...);\n * ```\n *\n * Each rule is called as independent static function with fixed signature:\n *\n * ```javascript\n * function my_token_render(tokens, idx, options, env, renderer) {\n * // ...\n * return renderedHTML;\n * }\n * ```\n *\n * See [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.js)\n * for more details and examples.\n **/\n this.rules = assign({}, default_rules);\n}\n\n\n/**\n * Renderer.renderAttrs(token) -> String\n *\n * Render token attributes to string.\n **/\nRenderer.prototype.renderAttrs = function renderAttrs(token) {\n var i, l, result;\n\n if (!token.attrs) { return ''; }\n\n result = '';\n\n for (i = 0, l = token.attrs.length; i < l; i++) {\n result += ' ' + escapeHtml(token.attrs[i][0]) + '=\"' + escapeHtml(token.attrs[i][1]) + '\"';\n }\n\n return result;\n};\n\n\n/**\n * Renderer.renderToken(tokens, idx, options) -> String\n * - tokens (Array): list of tokens\n * - idx (Numbed): token index to render\n * - options (Object): params of parser instance\n *\n * Default token renderer. Can be overriden by custom function\n * in [[Renderer#rules]].\n **/\nRenderer.prototype.renderToken = function renderToken(tokens, idx, options) {\n var nextToken,\n result = '',\n needLf = false,\n token = tokens[idx];\n\n // Tight list paragraphs\n if (token.hidden) {\n return '';\n }\n\n // Insert a newline between hidden paragraph and subsequent opening\n // block-level tag.\n //\n // For example, here we should insert a newline before blockquote:\n // - a\n // >\n //\n if (token.block && token.nesting !== -1 && idx && tokens[idx - 1].hidden) {\n result += '\\n';\n }\n\n // Add token name, e.g. ``.\n //\n needLf = false;\n }\n }\n }\n }\n\n result += needLf ? '>\\n' : '>';\n\n return result;\n};\n\n\n/**\n * Renderer.renderInline(tokens, options, env) -> String\n * - tokens (Array): list on block tokens to render\n * - options (Object): params of parser instance\n * - env (Object): additional data from parsed input (references, for example)\n *\n * The same as [[Renderer.render]], but for single token of `inline` type.\n **/\nRenderer.prototype.renderInline = function (tokens, options, env) {\n var type,\n result = '',\n rules = this.rules;\n\n for (var i = 0, len = tokens.length; i < len; i++) {\n type = tokens[i].type;\n\n if (typeof rules[type] !== 'undefined') {\n result += rules[type](tokens, i, options, env, this);\n } else {\n result += this.renderToken(tokens, i, options);\n }\n }\n\n return result;\n};\n\n\n/** internal\n * Renderer.renderInlineAsText(tokens, options, env) -> String\n * - tokens (Array): list on block tokens to render\n * - options (Object): params of parser instance\n * - env (Object): additional data from parsed input (references, for example)\n *\n * Special kludge for image `alt` attributes to conform CommonMark spec.\n * Don't try to use it! Spec requires to show `alt` content with stripped markup,\n * instead of simple escaping.\n **/\nRenderer.prototype.renderInlineAsText = function (tokens, options, env) {\n var result = '';\n\n for (var i = 0, len = tokens.length; i < len; i++) {\n if (tokens[i].type === 'text') {\n result += tokens[i].content;\n } else if (tokens[i].type === 'image') {\n result += this.renderInlineAsText(tokens[i].children, options, env);\n } else if (tokens[i].type === 'softbreak') {\n result += '\\n';\n }\n }\n\n return result;\n};\n\n\n/**\n * Renderer.render(tokens, options, env) -> String\n * - tokens (Array): list on block tokens to render\n * - options (Object): params of parser instance\n * - env (Object): additional data from parsed input (references, for example)\n *\n * Takes token stream and generates HTML. Probably, you will never need to call\n * this method directly.\n **/\nRenderer.prototype.render = function (tokens, options, env) {\n var i, len, type,\n result = '',\n rules = this.rules;\n\n for (i = 0, len = tokens.length; i < len; i++) {\n type = tokens[i].type;\n\n if (type === 'inline') {\n result += this.renderInline(tokens[i].children, options, env);\n } else if (typeof rules[type] !== 'undefined') {\n result += rules[tokens[i].type](tokens, i, options, env, this);\n } else {\n result += this.renderToken(tokens, i, options, env);\n }\n }\n\n return result;\n};\n\nmodule.exports = Renderer;\n", "/**\n * class Ruler\n *\n * Helper class, used by [[MarkdownIt#core]], [[MarkdownIt#block]] and\n * [[MarkdownIt#inline]] to manage sequences of functions (rules):\n *\n * - keep rules in defined order\n * - assign the name to each rule\n * - enable/disable rules\n * - add/replace rules\n * - allow assign rules to additional named chains (in the same)\n * - cacheing lists of active rules\n *\n * You will not need use this class directly until write plugins. For simple\n * rules control use [[MarkdownIt.disable]], [[MarkdownIt.enable]] and\n * [[MarkdownIt.use]].\n **/\n'use strict';\n\n\n/**\n * new Ruler()\n **/\nfunction Ruler() {\n // List of added rules. Each element is:\n //\n // {\n // name: XXX,\n // enabled: Boolean,\n // fn: Function(),\n // alt: [ name2, name3 ]\n // }\n //\n this.__rules__ = [];\n\n // Cached rule chains.\n //\n // First level - chain name, '' for default.\n // Second level - diginal anchor for fast filtering by charcodes.\n //\n this.__cache__ = null;\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// Helper methods, should not be used directly\n\n\n// Find rule index by name\n//\nRuler.prototype.__find__ = function (name) {\n for (var i = 0; i < this.__rules__.length; i++) {\n if (this.__rules__[i].name === name) {\n return i;\n }\n }\n return -1;\n};\n\n\n// Build rules lookup cache\n//\nRuler.prototype.__compile__ = function () {\n var self = this;\n var chains = [ '' ];\n\n // collect unique names\n self.__rules__.forEach(function (rule) {\n if (!rule.enabled) { return; }\n\n rule.alt.forEach(function (altName) {\n if (chains.indexOf(altName) < 0) {\n chains.push(altName);\n }\n });\n });\n\n self.__cache__ = {};\n\n chains.forEach(function (chain) {\n self.__cache__[chain] = [];\n self.__rules__.forEach(function (rule) {\n if (!rule.enabled) { return; }\n\n if (chain && rule.alt.indexOf(chain) < 0) { return; }\n\n self.__cache__[chain].push(rule.fn);\n });\n });\n};\n\n\n/**\n * Ruler.at(name, fn [, options])\n * - name (String): rule name to replace.\n * - fn (Function): new rule function.\n * - options (Object): new rule options (not mandatory).\n *\n * Replace rule by name with new function & options. Throws error if name not\n * found.\n *\n * ##### Options:\n *\n * - __alt__ - array with names of \"alternate\" chains.\n *\n * ##### Example\n *\n * Replace existing typographer replacement rule with new one:\n *\n * ```javascript\n * var md = require('markdown-it')();\n *\n * md.core.ruler.at('replacements', function replace(state) {\n * //...\n * });\n * ```\n **/\nRuler.prototype.at = function (name, fn, options) {\n var index = this.__find__(name);\n var opt = options || {};\n\n if (index === -1) { throw new Error('Parser rule not found: ' + name); }\n\n this.__rules__[index].fn = fn;\n this.__rules__[index].alt = opt.alt || [];\n this.__cache__ = null;\n};\n\n\n/**\n * Ruler.before(beforeName, ruleName, fn [, options])\n * - beforeName (String): new rule will be added before this one.\n * - ruleName (String): name of added rule.\n * - fn (Function): rule function.\n * - options (Object): rule options (not mandatory).\n *\n * Add new rule to chain before one with given name. See also\n * [[Ruler.after]], [[Ruler.push]].\n *\n * ##### Options:\n *\n * - __alt__ - array with names of \"alternate\" chains.\n *\n * ##### Example\n *\n * ```javascript\n * var md = require('markdown-it')();\n *\n * md.block.ruler.before('paragraph', 'my_rule', function replace(state) {\n * //...\n * });\n * ```\n **/\nRuler.prototype.before = function (beforeName, ruleName, fn, options) {\n var index = this.__find__(beforeName);\n var opt = options || {};\n\n if (index === -1) { throw new Error('Parser rule not found: ' + beforeName); }\n\n this.__rules__.splice(index, 0, {\n name: ruleName,\n enabled: true,\n fn: fn,\n alt: opt.alt || []\n });\n\n this.__cache__ = null;\n};\n\n\n/**\n * Ruler.after(afterName, ruleName, fn [, options])\n * - afterName (String): new rule will be added after this one.\n * - ruleName (String): name of added rule.\n * - fn (Function): rule function.\n * - options (Object): rule options (not mandatory).\n *\n * Add new rule to chain after one with given name. See also\n * [[Ruler.before]], [[Ruler.push]].\n *\n * ##### Options:\n *\n * - __alt__ - array with names of \"alternate\" chains.\n *\n * ##### Example\n *\n * ```javascript\n * var md = require('markdown-it')();\n *\n * md.inline.ruler.after('text', 'my_rule', function replace(state) {\n * //...\n * });\n * ```\n **/\nRuler.prototype.after = function (afterName, ruleName, fn, options) {\n var index = this.__find__(afterName);\n var opt = options || {};\n\n if (index === -1) { throw new Error('Parser rule not found: ' + afterName); }\n\n this.__rules__.splice(index + 1, 0, {\n name: ruleName,\n enabled: true,\n fn: fn,\n alt: opt.alt || []\n });\n\n this.__cache__ = null;\n};\n\n/**\n * Ruler.push(ruleName, fn [, options])\n * - ruleName (String): name of added rule.\n * - fn (Function): rule function.\n * - options (Object): rule options (not mandatory).\n *\n * Push new rule to the end of chain. See also\n * [[Ruler.before]], [[Ruler.after]].\n *\n * ##### Options:\n *\n * - __alt__ - array with names of \"alternate\" chains.\n *\n * ##### Example\n *\n * ```javascript\n * var md = require('markdown-it')();\n *\n * md.core.ruler.push('my_rule', function replace(state) {\n * //...\n * });\n * ```\n **/\nRuler.prototype.push = function (ruleName, fn, options) {\n var opt = options || {};\n\n this.__rules__.push({\n name: ruleName,\n enabled: true,\n fn: fn,\n alt: opt.alt || []\n });\n\n this.__cache__ = null;\n};\n\n\n/**\n * Ruler.enable(list [, ignoreInvalid]) -> Array\n * - list (String|Array): list of rule names to enable.\n * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.\n *\n * Enable rules with given names. If any rule name not found - throw Error.\n * Errors can be disabled by second param.\n *\n * Returns list of found rule names (if no exception happened).\n *\n * See also [[Ruler.disable]], [[Ruler.enableOnly]].\n **/\nRuler.prototype.enable = function (list, ignoreInvalid) {\n if (!Array.isArray(list)) { list = [ list ]; }\n\n var result = [];\n\n // Search by name and enable\n list.forEach(function (name) {\n var idx = this.__find__(name);\n\n if (idx < 0) {\n if (ignoreInvalid) { return; }\n throw new Error('Rules manager: invalid rule name ' + name);\n }\n this.__rules__[idx].enabled = true;\n result.push(name);\n }, this);\n\n this.__cache__ = null;\n return result;\n};\n\n\n/**\n * Ruler.enableOnly(list [, ignoreInvalid])\n * - list (String|Array): list of rule names to enable (whitelist).\n * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.\n *\n * Enable rules with given names, and disable everything else. If any rule name\n * not found - throw Error. Errors can be disabled by second param.\n *\n * See also [[Ruler.disable]], [[Ruler.enable]].\n **/\nRuler.prototype.enableOnly = function (list, ignoreInvalid) {\n if (!Array.isArray(list)) { list = [ list ]; }\n\n this.__rules__.forEach(function (rule) { rule.enabled = false; });\n\n this.enable(list, ignoreInvalid);\n};\n\n\n/**\n * Ruler.disable(list [, ignoreInvalid]) -> Array\n * - list (String|Array): list of rule names to disable.\n * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.\n *\n * Disable rules with given names. If any rule name not found - throw Error.\n * Errors can be disabled by second param.\n *\n * Returns list of found rule names (if no exception happened).\n *\n * See also [[Ruler.enable]], [[Ruler.enableOnly]].\n **/\nRuler.prototype.disable = function (list, ignoreInvalid) {\n if (!Array.isArray(list)) { list = [ list ]; }\n\n var result = [];\n\n // Search by name and disable\n list.forEach(function (name) {\n var idx = this.__find__(name);\n\n if (idx < 0) {\n if (ignoreInvalid) { return; }\n throw new Error('Rules manager: invalid rule name ' + name);\n }\n this.__rules__[idx].enabled = false;\n result.push(name);\n }, this);\n\n this.__cache__ = null;\n return result;\n};\n\n\n/**\n * Ruler.getRules(chainName) -> Array\n *\n * Return array of active functions (rules) for given chain name. It analyzes\n * rules configuration, compiles caches if not exists and returns result.\n *\n * Default chain name is `''` (empty string). It can't be skipped. That's\n * done intentionally, to keep signature monomorphic for high speed.\n **/\nRuler.prototype.getRules = function (chainName) {\n if (this.__cache__ === null) {\n this.__compile__();\n }\n\n // Chain can be empty, if rules disabled. But we still have to return Array.\n return this.__cache__[chainName] || [];\n};\n\nmodule.exports = Ruler;\n", "// Normalize input string\n\n'use strict';\n\n\n// https://spec.commonmark.org/0.29/#line-ending\nvar NEWLINES_RE = /\\r\\n?|\\n/g;\nvar NULL_RE = /\\0/g;\n\n\nmodule.exports = function normalize(state) {\n var str;\n\n // Normalize newlines\n str = state.src.replace(NEWLINES_RE, '\\n');\n\n // Replace NULL characters\n str = str.replace(NULL_RE, '\\uFFFD');\n\n state.src = str;\n};\n", "'use strict';\n\n\nmodule.exports = function block(state) {\n var token;\n\n if (state.inlineMode) {\n token = new state.Token('inline', '', 0);\n token.content = state.src;\n token.map = [ 0, 1 ];\n token.children = [];\n state.tokens.push(token);\n } else {\n state.md.block.parse(state.src, state.md, state.env, state.tokens);\n }\n};\n", "'use strict';\n\nmodule.exports = function inline(state) {\n var tokens = state.tokens, tok, i, l;\n\n // Parse inlines\n for (i = 0, l = tokens.length; i < l; i++) {\n tok = tokens[i];\n if (tok.type === 'inline') {\n state.md.inline.parse(tok.content, state.md, state.env, tok.children);\n }\n }\n};\n", "// Replace link-like texts with link nodes.\n//\n// Currently restricted by `md.validateLink()` to http/https/ftp\n//\n'use strict';\n\n\nvar arrayReplaceAt = require('../common/utils').arrayReplaceAt;\n\n\nfunction isLinkOpen(str) {\n return /^\\s]/i.test(str);\n}\nfunction isLinkClose(str) {\n return /^<\\/a\\s*>/i.test(str);\n}\n\n\nmodule.exports = function linkify(state) {\n var i, j, l, tokens, token, currentToken, nodes, ln, text, pos, lastPos,\n level, htmlLinkLevel, url, fullUrl, urlText,\n blockTokens = state.tokens,\n links;\n\n if (!state.md.options.linkify) { return; }\n\n for (j = 0, l = blockTokens.length; j < l; j++) {\n if (blockTokens[j].type !== 'inline' ||\n !state.md.linkify.pretest(blockTokens[j].content)) {\n continue;\n }\n\n tokens = blockTokens[j].children;\n\n htmlLinkLevel = 0;\n\n // We scan from the end, to keep position when new tags added.\n // Use reversed logic in links start/end match\n for (i = tokens.length - 1; i >= 0; i--) {\n currentToken = tokens[i];\n\n // Skip content of markdown links\n if (currentToken.type === 'link_close') {\n i--;\n while (tokens[i].level !== currentToken.level && tokens[i].type !== 'link_open') {\n i--;\n }\n continue;\n }\n\n // Skip content of html tag links\n if (currentToken.type === 'html_inline') {\n if (isLinkOpen(currentToken.content) && htmlLinkLevel > 0) {\n htmlLinkLevel--;\n }\n if (isLinkClose(currentToken.content)) {\n htmlLinkLevel++;\n }\n }\n if (htmlLinkLevel > 0) { continue; }\n\n if (currentToken.type === 'text' && state.md.linkify.test(currentToken.content)) {\n\n text = currentToken.content;\n links = state.md.linkify.match(text);\n\n // Now split string to nodes\n nodes = [];\n level = currentToken.level;\n lastPos = 0;\n\n for (ln = 0; ln < links.length; ln++) {\n\n url = links[ln].url;\n fullUrl = state.md.normalizeLink(url);\n if (!state.md.validateLink(fullUrl)) { continue; }\n\n urlText = links[ln].text;\n\n // Linkifier might send raw hostnames like \"example.com\", where url\n // starts with domain name. So we prepend http:// in those cases,\n // and remove it afterwards.\n //\n if (!links[ln].schema) {\n urlText = state.md.normalizeLinkText('http://' + urlText).replace(/^http:\\/\\//, '');\n } else if (links[ln].schema === 'mailto:' && !/^mailto:/i.test(urlText)) {\n urlText = state.md.normalizeLinkText('mailto:' + urlText).replace(/^mailto:/, '');\n } else {\n urlText = state.md.normalizeLinkText(urlText);\n }\n\n pos = links[ln].index;\n\n if (pos > lastPos) {\n token = new state.Token('text', '', 0);\n token.content = text.slice(lastPos, pos);\n token.level = level;\n nodes.push(token);\n }\n\n token = new state.Token('link_open', 'a', 1);\n token.attrs = [ [ 'href', fullUrl ] ];\n token.level = level++;\n token.markup = 'linkify';\n token.info = 'auto';\n nodes.push(token);\n\n token = new state.Token('text', '', 0);\n token.content = urlText;\n token.level = level;\n nodes.push(token);\n\n token = new state.Token('link_close', 'a', -1);\n token.level = --level;\n token.markup = 'linkify';\n token.info = 'auto';\n nodes.push(token);\n\n lastPos = links[ln].lastIndex;\n }\n if (lastPos < text.length) {\n token = new state.Token('text', '', 0);\n token.content = text.slice(lastPos);\n token.level = level;\n nodes.push(token);\n }\n\n // replace current node\n blockTokens[j].children = tokens = arrayReplaceAt(tokens, i, nodes);\n }\n }\n }\n};\n", "// Simple typographic replacements\n//\n// (c) (C) \u2192 \u00A9\n// (tm) (TM) \u2192 \u2122\n// (r) (R) \u2192 \u00AE\n// +- \u2192 \u00B1\n// (p) (P) -> \u00A7\n// ... \u2192 \u2026 (also ?.... \u2192 ?.., !.... \u2192 !..)\n// ???????? \u2192 ???, !!!!! \u2192 !!!, `,,` \u2192 `,`\n// -- \u2192 –, --- \u2192 —\n//\n'use strict';\n\n// TODO:\n// - fractionals 1/2, 1/4, 3/4 -> \u00BD, \u00BC, \u00BE\n// - miltiplication 2 x 4 -> 2 \u00D7 4\n\nvar RARE_RE = /\\+-|\\.\\.|\\?\\?\\?\\?|!!!!|,,|--/;\n\n// Workaround for phantomjs - need regex without /g flag,\n// or root check will fail every second time\nvar SCOPED_ABBR_TEST_RE = /\\((c|tm|r|p)\\)/i;\n\nvar SCOPED_ABBR_RE = /\\((c|tm|r|p)\\)/ig;\nvar SCOPED_ABBR = {\n c: '\u00A9',\n r: '\u00AE',\n p: '\u00A7',\n tm: '\u2122'\n};\n\nfunction replaceFn(match, name) {\n return SCOPED_ABBR[name.toLowerCase()];\n}\n\nfunction replace_scoped(inlineTokens) {\n var i, token, inside_autolink = 0;\n\n for (i = inlineTokens.length - 1; i >= 0; i--) {\n token = inlineTokens[i];\n\n if (token.type === 'text' && !inside_autolink) {\n token.content = token.content.replace(SCOPED_ABBR_RE, replaceFn);\n }\n\n if (token.type === 'link_open' && token.info === 'auto') {\n inside_autolink--;\n }\n\n if (token.type === 'link_close' && token.info === 'auto') {\n inside_autolink++;\n }\n }\n}\n\nfunction replace_rare(inlineTokens) {\n var i, token, inside_autolink = 0;\n\n for (i = inlineTokens.length - 1; i >= 0; i--) {\n token = inlineTokens[i];\n\n if (token.type === 'text' && !inside_autolink) {\n if (RARE_RE.test(token.content)) {\n token.content = token.content\n .replace(/\\+-/g, '\u00B1')\n // .., ..., ....... -> \u2026\n // but ?..... & !..... -> ?.. & !..\n .replace(/\\.{2,}/g, '\u2026').replace(/([?!])\u2026/g, '$1..')\n .replace(/([?!]){4,}/g, '$1$1$1').replace(/,{2,}/g, ',')\n // em-dash\n .replace(/(^|[^-])---(?=[^-]|$)/mg, '$1\\u2014')\n // en-dash\n .replace(/(^|\\s)--(?=\\s|$)/mg, '$1\\u2013')\n .replace(/(^|[^-\\s])--(?=[^-\\s]|$)/mg, '$1\\u2013');\n }\n }\n\n if (token.type === 'link_open' && token.info === 'auto') {\n inside_autolink--;\n }\n\n if (token.type === 'link_close' && token.info === 'auto') {\n inside_autolink++;\n }\n }\n}\n\n\nmodule.exports = function replace(state) {\n var blkIdx;\n\n if (!state.md.options.typographer) { return; }\n\n for (blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) {\n\n if (state.tokens[blkIdx].type !== 'inline') { continue; }\n\n if (SCOPED_ABBR_TEST_RE.test(state.tokens[blkIdx].content)) {\n replace_scoped(state.tokens[blkIdx].children);\n }\n\n if (RARE_RE.test(state.tokens[blkIdx].content)) {\n replace_rare(state.tokens[blkIdx].children);\n }\n\n }\n};\n", "// Convert straight quotation marks to typographic ones\n//\n'use strict';\n\n\nvar isWhiteSpace = require('../common/utils').isWhiteSpace;\nvar isPunctChar = require('../common/utils').isPunctChar;\nvar isMdAsciiPunct = require('../common/utils').isMdAsciiPunct;\n\nvar QUOTE_TEST_RE = /['\"]/;\nvar QUOTE_RE = /['\"]/g;\nvar APOSTROPHE = '\\u2019'; /* \u2019 */\n\n\nfunction replaceAt(str, index, ch) {\n return str.substr(0, index) + ch + str.substr(index + 1);\n}\n\nfunction process_inlines(tokens, state) {\n var i, token, text, t, pos, max, thisLevel, item, lastChar, nextChar,\n isLastPunctChar, isNextPunctChar, isLastWhiteSpace, isNextWhiteSpace,\n canOpen, canClose, j, isSingle, stack, openQuote, closeQuote;\n\n stack = [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n\n thisLevel = tokens[i].level;\n\n for (j = stack.length - 1; j >= 0; j--) {\n if (stack[j].level <= thisLevel) { break; }\n }\n stack.length = j + 1;\n\n if (token.type !== 'text') { continue; }\n\n text = token.content;\n pos = 0;\n max = text.length;\n\n /*eslint no-labels:0,block-scoped-var:0*/\n OUTER:\n while (pos < max) {\n QUOTE_RE.lastIndex = pos;\n t = QUOTE_RE.exec(text);\n if (!t) { break; }\n\n canOpen = canClose = true;\n pos = t.index + 1;\n isSingle = (t[0] === \"'\");\n\n // Find previous character,\n // default to space if it's the beginning of the line\n //\n lastChar = 0x20;\n\n if (t.index - 1 >= 0) {\n lastChar = text.charCodeAt(t.index - 1);\n } else {\n for (j = i - 1; j >= 0; j--) {\n if (tokens[j].type === 'softbreak' || tokens[j].type === 'hardbreak') break; // lastChar defaults to 0x20\n if (!tokens[j].content) continue; // should skip all tokens except 'text', 'html_inline' or 'code_inline'\n\n lastChar = tokens[j].content.charCodeAt(tokens[j].content.length - 1);\n break;\n }\n }\n\n // Find next character,\n // default to space if it's the end of the line\n //\n nextChar = 0x20;\n\n if (pos < max) {\n nextChar = text.charCodeAt(pos);\n } else {\n for (j = i + 1; j < tokens.length; j++) {\n if (tokens[j].type === 'softbreak' || tokens[j].type === 'hardbreak') break; // nextChar defaults to 0x20\n if (!tokens[j].content) continue; // should skip all tokens except 'text', 'html_inline' or 'code_inline'\n\n nextChar = tokens[j].content.charCodeAt(0);\n break;\n }\n }\n\n isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar));\n isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar));\n\n isLastWhiteSpace = isWhiteSpace(lastChar);\n isNextWhiteSpace = isWhiteSpace(nextChar);\n\n if (isNextWhiteSpace) {\n canOpen = false;\n } else if (isNextPunctChar) {\n if (!(isLastWhiteSpace || isLastPunctChar)) {\n canOpen = false;\n }\n }\n\n if (isLastWhiteSpace) {\n canClose = false;\n } else if (isLastPunctChar) {\n if (!(isNextWhiteSpace || isNextPunctChar)) {\n canClose = false;\n }\n }\n\n if (nextChar === 0x22 /* \" */ && t[0] === '\"') {\n if (lastChar >= 0x30 /* 0 */ && lastChar <= 0x39 /* 9 */) {\n // special case: 1\"\" - count first quote as an inch\n canClose = canOpen = false;\n }\n }\n\n if (canOpen && canClose) {\n // Replace quotes in the middle of punctuation sequence, but not\n // in the middle of the words, i.e.:\n //\n // 1. foo \" bar \" baz - not replaced\n // 2. foo-\"-bar-\"-baz - replaced\n // 3. foo\"bar\"baz - not replaced\n //\n canOpen = isLastPunctChar;\n canClose = isNextPunctChar;\n }\n\n if (!canOpen && !canClose) {\n // middle of word\n if (isSingle) {\n token.content = replaceAt(token.content, t.index, APOSTROPHE);\n }\n continue;\n }\n\n if (canClose) {\n // this could be a closing quote, rewind the stack to get a match\n for (j = stack.length - 1; j >= 0; j--) {\n item = stack[j];\n if (stack[j].level < thisLevel) { break; }\n if (item.single === isSingle && stack[j].level === thisLevel) {\n item = stack[j];\n\n if (isSingle) {\n openQuote = state.md.options.quotes[2];\n closeQuote = state.md.options.quotes[3];\n } else {\n openQuote = state.md.options.quotes[0];\n closeQuote = state.md.options.quotes[1];\n }\n\n // replace token.content *before* tokens[item.token].content,\n // because, if they are pointing at the same token, replaceAt\n // could mess up indices when quote length != 1\n token.content = replaceAt(token.content, t.index, closeQuote);\n tokens[item.token].content = replaceAt(\n tokens[item.token].content, item.pos, openQuote);\n\n pos += closeQuote.length - 1;\n if (item.token === i) { pos += openQuote.length - 1; }\n\n text = token.content;\n max = text.length;\n\n stack.length = j;\n continue OUTER;\n }\n }\n }\n\n if (canOpen) {\n stack.push({\n token: i,\n pos: t.index,\n single: isSingle,\n level: thisLevel\n });\n } else if (canClose && isSingle) {\n token.content = replaceAt(token.content, t.index, APOSTROPHE);\n }\n }\n }\n}\n\n\nmodule.exports = function smartquotes(state) {\n /*eslint max-depth:0*/\n var blkIdx;\n\n if (!state.md.options.typographer) { return; }\n\n for (blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) {\n\n if (state.tokens[blkIdx].type !== 'inline' ||\n !QUOTE_TEST_RE.test(state.tokens[blkIdx].content)) {\n continue;\n }\n\n process_inlines(state.tokens[blkIdx].children, state);\n }\n};\n", "// Token class\n\n'use strict';\n\n\n/**\n * class Token\n **/\n\n/**\n * new Token(type, tag, nesting)\n *\n * Create new token and fill passed properties.\n **/\nfunction Token(type, tag, nesting) {\n /**\n * Token#type -> String\n *\n * Type of the token (string, e.g. \"paragraph_open\")\n **/\n this.type = type;\n\n /**\n * Token#tag -> String\n *\n * html tag name, e.g. \"p\"\n **/\n this.tag = tag;\n\n /**\n * Token#attrs -> Array\n *\n * Html attributes. Format: `[ [ name1, value1 ], [ name2, value2 ] ]`\n **/\n this.attrs = null;\n\n /**\n * Token#map -> Array\n *\n * Source map info. Format: `[ line_begin, line_end ]`\n **/\n this.map = null;\n\n /**\n * Token#nesting -> Number\n *\n * Level change (number in {-1, 0, 1} set), where:\n *\n * - `1` means the tag is opening\n * - `0` means the tag is self-closing\n * - `-1` means the tag is closing\n **/\n this.nesting = nesting;\n\n /**\n * Token#level -> Number\n *\n * nesting level, the same as `state.level`\n **/\n this.level = 0;\n\n /**\n * Token#children -> Array\n *\n * An array of child nodes (inline and img tokens)\n **/\n this.children = null;\n\n /**\n * Token#content -> String\n *\n * In a case of self-closing tag (code, html, fence, etc.),\n * it has contents of this tag.\n **/\n this.content = '';\n\n /**\n * Token#markup -> String\n *\n * '*' or '_' for emphasis, fence string for fence, etc.\n **/\n this.markup = '';\n\n /**\n * Token#info -> String\n *\n * Additional information:\n *\n * - Info string for \"fence\" tokens\n * - The value \"auto\" for autolink \"link_open\" and \"link_close\" tokens\n * - The string value of the item marker for ordered-list \"list_item_open\" tokens\n **/\n this.info = '';\n\n /**\n * Token#meta -> Object\n *\n * A place for plugins to store an arbitrary data\n **/\n this.meta = null;\n\n /**\n * Token#block -> Boolean\n *\n * True for block-level tokens, false for inline tokens.\n * Used in renderer to calculate line breaks\n **/\n this.block = false;\n\n /**\n * Token#hidden -> Boolean\n *\n * If it's true, ignore this element when rendering. Used for tight lists\n * to hide paragraphs.\n **/\n this.hidden = false;\n}\n\n\n/**\n * Token.attrIndex(name) -> Number\n *\n * Search attribute index by name.\n **/\nToken.prototype.attrIndex = function attrIndex(name) {\n var attrs, i, len;\n\n if (!this.attrs) { return -1; }\n\n attrs = this.attrs;\n\n for (i = 0, len = attrs.length; i < len; i++) {\n if (attrs[i][0] === name) { return i; }\n }\n return -1;\n};\n\n\n/**\n * Token.attrPush(attrData)\n *\n * Add `[ name, value ]` attribute to list. Init attrs if necessary\n **/\nToken.prototype.attrPush = function attrPush(attrData) {\n if (this.attrs) {\n this.attrs.push(attrData);\n } else {\n this.attrs = [ attrData ];\n }\n};\n\n\n/**\n * Token.attrSet(name, value)\n *\n * Set `name` attribute to `value`. Override old value if exists.\n **/\nToken.prototype.attrSet = function attrSet(name, value) {\n var idx = this.attrIndex(name),\n attrData = [ name, value ];\n\n if (idx < 0) {\n this.attrPush(attrData);\n } else {\n this.attrs[idx] = attrData;\n }\n};\n\n\n/**\n * Token.attrGet(name)\n *\n * Get the value of attribute `name`, or null if it does not exist.\n **/\nToken.prototype.attrGet = function attrGet(name) {\n var idx = this.attrIndex(name), value = null;\n if (idx >= 0) {\n value = this.attrs[idx][1];\n }\n return value;\n};\n\n\n/**\n * Token.attrJoin(name, value)\n *\n * Join value to existing attribute via space. Or create new attribute if not\n * exists. Useful to operate with token classes.\n **/\nToken.prototype.attrJoin = function attrJoin(name, value) {\n var idx = this.attrIndex(name);\n\n if (idx < 0) {\n this.attrPush([ name, value ]);\n } else {\n this.attrs[idx][1] = this.attrs[idx][1] + ' ' + value;\n }\n};\n\n\nmodule.exports = Token;\n", "// Core state object\n//\n'use strict';\n\nvar Token = require('../token');\n\n\nfunction StateCore(src, md, env) {\n this.src = src;\n this.env = env;\n this.tokens = [];\n this.inlineMode = false;\n this.md = md; // link to parser instance\n}\n\n// re-export Token class to use in core rules\nStateCore.prototype.Token = Token;\n\n\nmodule.exports = StateCore;\n", "/** internal\n * class Core\n *\n * Top-level rules executor. Glues block/inline parsers and does intermediate\n * transformations.\n **/\n'use strict';\n\n\nvar Ruler = require('./ruler');\n\n\nvar _rules = [\n [ 'normalize', require('./rules_core/normalize') ],\n [ 'block', require('./rules_core/block') ],\n [ 'inline', require('./rules_core/inline') ],\n [ 'linkify', require('./rules_core/linkify') ],\n [ 'replacements', require('./rules_core/replacements') ],\n [ 'smartquotes', require('./rules_core/smartquotes') ]\n];\n\n\n/**\n * new Core()\n **/\nfunction Core() {\n /**\n * Core#ruler -> Ruler\n *\n * [[Ruler]] instance. Keep configuration of core rules.\n **/\n this.ruler = new Ruler();\n\n for (var i = 0; i < _rules.length; i++) {\n this.ruler.push(_rules[i][0], _rules[i][1]);\n }\n}\n\n\n/**\n * Core.process(state)\n *\n * Executes core chain rules.\n **/\nCore.prototype.process = function (state) {\n var i, l, rules;\n\n rules = this.ruler.getRules('');\n\n for (i = 0, l = rules.length; i < l; i++) {\n rules[i](state);\n }\n};\n\nCore.prototype.State = require('./rules_core/state_core');\n\n\nmodule.exports = Core;\n", "// GFM table, https://github.github.com/gfm/#tables-extension-\n\n'use strict';\n\nvar isSpace = require('../common/utils').isSpace;\n\n\nfunction getLine(state, line) {\n var pos = state.bMarks[line] + state.tShift[line],\n max = state.eMarks[line];\n\n return state.src.substr(pos, max - pos);\n}\n\nfunction escapedSplit(str) {\n var result = [],\n pos = 0,\n max = str.length,\n ch,\n isEscaped = false,\n lastPos = 0,\n current = '';\n\n ch = str.charCodeAt(pos);\n\n while (pos < max) {\n if (ch === 0x7c/* | */) {\n if (!isEscaped) {\n // pipe separating cells, '|'\n result.push(current + str.substring(lastPos, pos));\n current = '';\n lastPos = pos + 1;\n } else {\n // escaped pipe, '\\|'\n current += str.substring(lastPos, pos - 1);\n lastPos = pos;\n }\n }\n\n isEscaped = (ch === 0x5c/* \\ */);\n pos++;\n\n ch = str.charCodeAt(pos);\n }\n\n result.push(current + str.substring(lastPos));\n\n return result;\n}\n\n\nmodule.exports = function table(state, startLine, endLine, silent) {\n var ch, lineText, pos, i, l, nextLine, columns, columnCount, token,\n aligns, t, tableLines, tbodyLines, oldParentType, terminate,\n terminatorRules, firstCh, secondCh;\n\n // should have at least two lines\n if (startLine + 2 > endLine) { return false; }\n\n nextLine = startLine + 1;\n\n if (state.sCount[nextLine] < state.blkIndent) { return false; }\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[nextLine] - state.blkIndent >= 4) { return false; }\n\n // first character of the second line should be '|', '-', ':',\n // and no other characters are allowed but spaces;\n // basically, this is the equivalent of /^[-:|][-:|\\s]*$/ regexp\n\n pos = state.bMarks[nextLine] + state.tShift[nextLine];\n if (pos >= state.eMarks[nextLine]) { return false; }\n\n firstCh = state.src.charCodeAt(pos++);\n if (firstCh !== 0x7C/* | */ && firstCh !== 0x2D/* - */ && firstCh !== 0x3A/* : */) { return false; }\n\n if (pos >= state.eMarks[nextLine]) { return false; }\n\n secondCh = state.src.charCodeAt(pos++);\n if (secondCh !== 0x7C/* | */ && secondCh !== 0x2D/* - */ && secondCh !== 0x3A/* : */ && !isSpace(secondCh)) {\n return false;\n }\n\n // if first character is '-', then second character must not be a space\n // (due to parsing ambiguity with list)\n if (firstCh === 0x2D/* - */ && isSpace(secondCh)) { return false; }\n\n while (pos < state.eMarks[nextLine]) {\n ch = state.src.charCodeAt(pos);\n\n if (ch !== 0x7C/* | */ && ch !== 0x2D/* - */ && ch !== 0x3A/* : */ && !isSpace(ch)) { return false; }\n\n pos++;\n }\n\n lineText = getLine(state, startLine + 1);\n\n columns = lineText.split('|');\n aligns = [];\n for (i = 0; i < columns.length; i++) {\n t = columns[i].trim();\n if (!t) {\n // allow empty columns before and after table, but not in between columns;\n // e.g. allow ` |---| `, disallow ` ---||--- `\n if (i === 0 || i === columns.length - 1) {\n continue;\n } else {\n return false;\n }\n }\n\n if (!/^:?-+:?$/.test(t)) { return false; }\n if (t.charCodeAt(t.length - 1) === 0x3A/* : */) {\n aligns.push(t.charCodeAt(0) === 0x3A/* : */ ? 'center' : 'right');\n } else if (t.charCodeAt(0) === 0x3A/* : */) {\n aligns.push('left');\n } else {\n aligns.push('');\n }\n }\n\n lineText = getLine(state, startLine).trim();\n if (lineText.indexOf('|') === -1) { return false; }\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n columns = escapedSplit(lineText);\n if (columns.length && columns[0] === '') columns.shift();\n if (columns.length && columns[columns.length - 1] === '') columns.pop();\n\n // header row will define an amount of columns in the entire table,\n // and align row should be exactly the same (the rest of the rows can differ)\n columnCount = columns.length;\n if (columnCount === 0 || columnCount !== aligns.length) { return false; }\n\n if (silent) { return true; }\n\n oldParentType = state.parentType;\n state.parentType = 'table';\n\n // use 'blockquote' lists for termination because it's\n // the most similar to tables\n terminatorRules = state.md.block.ruler.getRules('blockquote');\n\n token = state.push('table_open', 'table', 1);\n token.map = tableLines = [ startLine, 0 ];\n\n token = state.push('thead_open', 'thead', 1);\n token.map = [ startLine, startLine + 1 ];\n\n token = state.push('tr_open', 'tr', 1);\n token.map = [ startLine, startLine + 1 ];\n\n for (i = 0; i < columns.length; i++) {\n token = state.push('th_open', 'th', 1);\n if (aligns[i]) {\n token.attrs = [ [ 'style', 'text-align:' + aligns[i] ] ];\n }\n\n token = state.push('inline', '', 0);\n token.content = columns[i].trim();\n token.children = [];\n\n token = state.push('th_close', 'th', -1);\n }\n\n token = state.push('tr_close', 'tr', -1);\n token = state.push('thead_close', 'thead', -1);\n\n for (nextLine = startLine + 2; nextLine < endLine; nextLine++) {\n if (state.sCount[nextLine] < state.blkIndent) { break; }\n\n terminate = false;\n for (i = 0, l = terminatorRules.length; i < l; i++) {\n if (terminatorRules[i](state, nextLine, endLine, true)) {\n terminate = true;\n break;\n }\n }\n\n if (terminate) { break; }\n lineText = getLine(state, nextLine).trim();\n if (!lineText) { break; }\n if (state.sCount[nextLine] - state.blkIndent >= 4) { break; }\n columns = escapedSplit(lineText);\n if (columns.length && columns[0] === '') columns.shift();\n if (columns.length && columns[columns.length - 1] === '') columns.pop();\n\n if (nextLine === startLine + 2) {\n token = state.push('tbody_open', 'tbody', 1);\n token.map = tbodyLines = [ startLine + 2, 0 ];\n }\n\n token = state.push('tr_open', 'tr', 1);\n token.map = [ nextLine, nextLine + 1 ];\n\n for (i = 0; i < columnCount; i++) {\n token = state.push('td_open', 'td', 1);\n if (aligns[i]) {\n token.attrs = [ [ 'style', 'text-align:' + aligns[i] ] ];\n }\n\n token = state.push('inline', '', 0);\n token.content = columns[i] ? columns[i].trim() : '';\n token.children = [];\n\n token = state.push('td_close', 'td', -1);\n }\n token = state.push('tr_close', 'tr', -1);\n }\n\n if (tbodyLines) {\n token = state.push('tbody_close', 'tbody', -1);\n tbodyLines[1] = nextLine;\n }\n\n token = state.push('table_close', 'table', -1);\n tableLines[1] = nextLine;\n\n state.parentType = oldParentType;\n state.line = nextLine;\n return true;\n};\n", "// Code block (4 spaces padded)\n\n'use strict';\n\n\nmodule.exports = function code(state, startLine, endLine/*, silent*/) {\n var nextLine, last, token;\n\n if (state.sCount[startLine] - state.blkIndent < 4) { return false; }\n\n last = nextLine = startLine + 1;\n\n while (nextLine < endLine) {\n if (state.isEmpty(nextLine)) {\n nextLine++;\n continue;\n }\n\n if (state.sCount[nextLine] - state.blkIndent >= 4) {\n nextLine++;\n last = nextLine;\n continue;\n }\n break;\n }\n\n state.line = last;\n\n token = state.push('code_block', 'code', 0);\n token.content = state.getLines(startLine, last, 4 + state.blkIndent, false) + '\\n';\n token.map = [ startLine, state.line ];\n\n return true;\n};\n", "// fences (``` lang, ~~~ lang)\n\n'use strict';\n\n\nmodule.exports = function fence(state, startLine, endLine, silent) {\n var marker, len, params, nextLine, mem, token, markup,\n haveEndMarker = false,\n pos = state.bMarks[startLine] + state.tShift[startLine],\n max = state.eMarks[startLine];\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n\n if (pos + 3 > max) { return false; }\n\n marker = state.src.charCodeAt(pos);\n\n if (marker !== 0x7E/* ~ */ && marker !== 0x60 /* ` */) {\n return false;\n }\n\n // scan marker length\n mem = pos;\n pos = state.skipChars(pos, marker);\n\n len = pos - mem;\n\n if (len < 3) { return false; }\n\n markup = state.src.slice(mem, pos);\n params = state.src.slice(pos, max);\n\n if (marker === 0x60 /* ` */) {\n if (params.indexOf(String.fromCharCode(marker)) >= 0) {\n return false;\n }\n }\n\n // Since start is found, we can report success here in validation mode\n if (silent) { return true; }\n\n // search end of block\n nextLine = startLine;\n\n for (;;) {\n nextLine++;\n if (nextLine >= endLine) {\n // unclosed block should be autoclosed by end of document.\n // also block seems to be autoclosed by end of parent\n break;\n }\n\n pos = mem = state.bMarks[nextLine] + state.tShift[nextLine];\n max = state.eMarks[nextLine];\n\n if (pos < max && state.sCount[nextLine] < state.blkIndent) {\n // non-empty line with negative indent should stop the list:\n // - ```\n // test\n break;\n }\n\n if (state.src.charCodeAt(pos) !== marker) { continue; }\n\n if (state.sCount[nextLine] - state.blkIndent >= 4) {\n // closing fence should be indented less than 4 spaces\n continue;\n }\n\n pos = state.skipChars(pos, marker);\n\n // closing code fence must be at least as long as the opening one\n if (pos - mem < len) { continue; }\n\n // make sure tail has spaces only\n pos = state.skipSpaces(pos);\n\n if (pos < max) { continue; }\n\n haveEndMarker = true;\n // found!\n break;\n }\n\n // If a fence has heading spaces, they should be removed from its inner block\n len = state.sCount[startLine];\n\n state.line = nextLine + (haveEndMarker ? 1 : 0);\n\n token = state.push('fence', 'code', 0);\n token.info = params;\n token.content = state.getLines(startLine + 1, nextLine, len, true);\n token.markup = markup;\n token.map = [ startLine, state.line ];\n\n return true;\n};\n", "// Block quotes\n\n'use strict';\n\nvar isSpace = require('../common/utils').isSpace;\n\n\nmodule.exports = function blockquote(state, startLine, endLine, silent) {\n var adjustTab,\n ch,\n i,\n initial,\n l,\n lastLineEmpty,\n lines,\n nextLine,\n offset,\n oldBMarks,\n oldBSCount,\n oldIndent,\n oldParentType,\n oldSCount,\n oldTShift,\n spaceAfterMarker,\n terminate,\n terminatorRules,\n token,\n isOutdented,\n oldLineMax = state.lineMax,\n pos = state.bMarks[startLine] + state.tShift[startLine],\n max = state.eMarks[startLine];\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n\n // check the block quote marker\n if (state.src.charCodeAt(pos++) !== 0x3E/* > */) { return false; }\n\n // we know that it's going to be a valid blockquote,\n // so no point trying to find the end of it in silent mode\n if (silent) { return true; }\n\n // set offset past spaces and \">\"\n initial = offset = state.sCount[startLine] + 1;\n\n // skip one optional space after '>'\n if (state.src.charCodeAt(pos) === 0x20 /* space */) {\n // ' > test '\n // ^ -- position start of line here:\n pos++;\n initial++;\n offset++;\n adjustTab = false;\n spaceAfterMarker = true;\n } else if (state.src.charCodeAt(pos) === 0x09 /* tab */) {\n spaceAfterMarker = true;\n\n if ((state.bsCount[startLine] + offset) % 4 === 3) {\n // ' >\\t test '\n // ^ -- position start of line here (tab has width===1)\n pos++;\n initial++;\n offset++;\n adjustTab = false;\n } else {\n // ' >\\t test '\n // ^ -- position start of line here + shift bsCount slightly\n // to make extra space appear\n adjustTab = true;\n }\n } else {\n spaceAfterMarker = false;\n }\n\n oldBMarks = [ state.bMarks[startLine] ];\n state.bMarks[startLine] = pos;\n\n while (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (isSpace(ch)) {\n if (ch === 0x09) {\n offset += 4 - (offset + state.bsCount[startLine] + (adjustTab ? 1 : 0)) % 4;\n } else {\n offset++;\n }\n } else {\n break;\n }\n\n pos++;\n }\n\n oldBSCount = [ state.bsCount[startLine] ];\n state.bsCount[startLine] = state.sCount[startLine] + 1 + (spaceAfterMarker ? 1 : 0);\n\n lastLineEmpty = pos >= max;\n\n oldSCount = [ state.sCount[startLine] ];\n state.sCount[startLine] = offset - initial;\n\n oldTShift = [ state.tShift[startLine] ];\n state.tShift[startLine] = pos - state.bMarks[startLine];\n\n terminatorRules = state.md.block.ruler.getRules('blockquote');\n\n oldParentType = state.parentType;\n state.parentType = 'blockquote';\n\n // Search the end of the block\n //\n // Block ends with either:\n // 1. an empty line outside:\n // ```\n // > test\n //\n // ```\n // 2. an empty line inside:\n // ```\n // >\n // test\n // ```\n // 3. another tag:\n // ```\n // > test\n // - - -\n // ```\n for (nextLine = startLine + 1; nextLine < endLine; nextLine++) {\n // check if it's outdented, i.e. it's inside list item and indented\n // less than said list item:\n //\n // ```\n // 1. anything\n // > current blockquote\n // 2. checking this line\n // ```\n isOutdented = state.sCount[nextLine] < state.blkIndent;\n\n pos = state.bMarks[nextLine] + state.tShift[nextLine];\n max = state.eMarks[nextLine];\n\n if (pos >= max) {\n // Case 1: line is not inside the blockquote, and this line is empty.\n break;\n }\n\n if (state.src.charCodeAt(pos++) === 0x3E/* > */ && !isOutdented) {\n // This line is inside the blockquote.\n\n // set offset past spaces and \">\"\n initial = offset = state.sCount[nextLine] + 1;\n\n // skip one optional space after '>'\n if (state.src.charCodeAt(pos) === 0x20 /* space */) {\n // ' > test '\n // ^ -- position start of line here:\n pos++;\n initial++;\n offset++;\n adjustTab = false;\n spaceAfterMarker = true;\n } else if (state.src.charCodeAt(pos) === 0x09 /* tab */) {\n spaceAfterMarker = true;\n\n if ((state.bsCount[nextLine] + offset) % 4 === 3) {\n // ' >\\t test '\n // ^ -- position start of line here (tab has width===1)\n pos++;\n initial++;\n offset++;\n adjustTab = false;\n } else {\n // ' >\\t test '\n // ^ -- position start of line here + shift bsCount slightly\n // to make extra space appear\n adjustTab = true;\n }\n } else {\n spaceAfterMarker = false;\n }\n\n oldBMarks.push(state.bMarks[nextLine]);\n state.bMarks[nextLine] = pos;\n\n while (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (isSpace(ch)) {\n if (ch === 0x09) {\n offset += 4 - (offset + state.bsCount[nextLine] + (adjustTab ? 1 : 0)) % 4;\n } else {\n offset++;\n }\n } else {\n break;\n }\n\n pos++;\n }\n\n lastLineEmpty = pos >= max;\n\n oldBSCount.push(state.bsCount[nextLine]);\n state.bsCount[nextLine] = state.sCount[nextLine] + 1 + (spaceAfterMarker ? 1 : 0);\n\n oldSCount.push(state.sCount[nextLine]);\n state.sCount[nextLine] = offset - initial;\n\n oldTShift.push(state.tShift[nextLine]);\n state.tShift[nextLine] = pos - state.bMarks[nextLine];\n continue;\n }\n\n // Case 2: line is not inside the blockquote, and the last line was empty.\n if (lastLineEmpty) { break; }\n\n // Case 3: another tag found.\n terminate = false;\n for (i = 0, l = terminatorRules.length; i < l; i++) {\n if (terminatorRules[i](state, nextLine, endLine, true)) {\n terminate = true;\n break;\n }\n }\n\n if (terminate) {\n // Quirk to enforce \"hard termination mode\" for paragraphs;\n // normally if you call `tokenize(state, startLine, nextLine)`,\n // paragraphs will look below nextLine for paragraph continuation,\n // but if blockquote is terminated by another tag, they shouldn't\n state.lineMax = nextLine;\n\n if (state.blkIndent !== 0) {\n // state.blkIndent was non-zero, we now set it to zero,\n // so we need to re-calculate all offsets to appear as\n // if indent wasn't changed\n oldBMarks.push(state.bMarks[nextLine]);\n oldBSCount.push(state.bsCount[nextLine]);\n oldTShift.push(state.tShift[nextLine]);\n oldSCount.push(state.sCount[nextLine]);\n state.sCount[nextLine] -= state.blkIndent;\n }\n\n break;\n }\n\n oldBMarks.push(state.bMarks[nextLine]);\n oldBSCount.push(state.bsCount[nextLine]);\n oldTShift.push(state.tShift[nextLine]);\n oldSCount.push(state.sCount[nextLine]);\n\n // A negative indentation means that this is a paragraph continuation\n //\n state.sCount[nextLine] = -1;\n }\n\n oldIndent = state.blkIndent;\n state.blkIndent = 0;\n\n token = state.push('blockquote_open', 'blockquote', 1);\n token.markup = '>';\n token.map = lines = [ startLine, 0 ];\n\n state.md.block.tokenize(state, startLine, nextLine);\n\n token = state.push('blockquote_close', 'blockquote', -1);\n token.markup = '>';\n\n state.lineMax = oldLineMax;\n state.parentType = oldParentType;\n lines[1] = state.line;\n\n // Restore original tShift; this might not be necessary since the parser\n // has already been here, but just to make sure we can do that.\n for (i = 0; i < oldTShift.length; i++) {\n state.bMarks[i + startLine] = oldBMarks[i];\n state.tShift[i + startLine] = oldTShift[i];\n state.sCount[i + startLine] = oldSCount[i];\n state.bsCount[i + startLine] = oldBSCount[i];\n }\n state.blkIndent = oldIndent;\n\n return true;\n};\n", "// Horizontal rule\n\n'use strict';\n\nvar isSpace = require('../common/utils').isSpace;\n\n\nmodule.exports = function hr(state, startLine, endLine, silent) {\n var marker, cnt, ch, token,\n pos = state.bMarks[startLine] + state.tShift[startLine],\n max = state.eMarks[startLine];\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n\n marker = state.src.charCodeAt(pos++);\n\n // Check hr marker\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x5F/* _ */) {\n return false;\n }\n\n // markers can be mixed with spaces, but there should be at least 3 of them\n\n cnt = 1;\n while (pos < max) {\n ch = state.src.charCodeAt(pos++);\n if (ch !== marker && !isSpace(ch)) { return false; }\n if (ch === marker) { cnt++; }\n }\n\n if (cnt < 3) { return false; }\n\n if (silent) { return true; }\n\n state.line = startLine + 1;\n\n token = state.push('hr', 'hr', 0);\n token.map = [ startLine, state.line ];\n token.markup = Array(cnt + 1).join(String.fromCharCode(marker));\n\n return true;\n};\n", "// Lists\n\n'use strict';\n\nvar isSpace = require('../common/utils').isSpace;\n\n\n// Search `[-+*][\\n ]`, returns next pos after marker on success\n// or -1 on fail.\nfunction skipBulletListMarker(state, startLine) {\n var marker, pos, max, ch;\n\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1;\n }\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" -test \" - is not a list item\n return -1;\n }\n }\n\n return pos;\n}\n\n// Search `\\d+[.)][\\n ]`, returns next pos after marker on success\n// or -1 on fail.\nfunction skipOrderedListMarker(state, startLine) {\n var ch,\n start = state.bMarks[startLine] + state.tShift[startLine],\n pos = start,\n max = state.eMarks[startLine];\n\n // List marker should have at least 2 chars (digit + dot)\n if (pos + 1 >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n for (;;) {\n // EOL -> fail\n if (pos >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n\n // List marker should have no more than 9 digits\n // (prevents integer overflow in browsers)\n if (pos - start >= 10) { return -1; }\n\n continue;\n }\n\n // found valid marker\n if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n break;\n }\n\n return -1;\n }\n\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n }\n return pos;\n}\n\nfunction markTightParagraphs(state, idx) {\n var i, l,\n level = state.level + 2;\n\n for (i = idx + 2, l = state.tokens.length - 2; i < l; i++) {\n if (state.tokens[i].level === level && state.tokens[i].type === 'paragraph_open') {\n state.tokens[i + 2].hidden = true;\n state.tokens[i].hidden = true;\n i += 2;\n }\n }\n}\n\n\nmodule.exports = function list(state, startLine, endLine, silent) {\n var ch,\n contentStart,\n i,\n indent,\n indentAfterMarker,\n initial,\n isOrdered,\n itemLines,\n l,\n listLines,\n listTokIdx,\n markerCharCode,\n markerValue,\n max,\n nextLine,\n offset,\n oldListIndent,\n oldParentType,\n oldSCount,\n oldTShift,\n oldTight,\n pos,\n posAfterMarker,\n prevEmptyEnd,\n start,\n terminate,\n terminatorRules,\n token,\n isTerminatingParagraph = false,\n tight = true;\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n\n // Special case:\n // - item 1\n // - item 2\n // - item 3\n // - item 4\n // - this one is a paragraph continuation\n if (state.listIndent >= 0 &&\n state.sCount[startLine] - state.listIndent >= 4 &&\n state.sCount[startLine] < state.blkIndent) {\n return false;\n }\n\n // limit conditions when list can interrupt\n // a paragraph (validation mode only)\n if (silent && state.parentType === 'paragraph') {\n // Next list item should still terminate previous list item;\n //\n // This code can fail if plugins use blkIndent as well as lists,\n // but I hope the spec gets fixed long before that happens.\n //\n if (state.tShift[startLine] >= state.blkIndent) {\n isTerminatingParagraph = true;\n }\n }\n\n // Detect list type and position after marker\n if ((posAfterMarker = skipOrderedListMarker(state, startLine)) >= 0) {\n isOrdered = true;\n start = state.bMarks[startLine] + state.tShift[startLine];\n markerValue = Number(state.src.slice(start, posAfterMarker - 1));\n\n // If we're starting a new ordered list right after\n // a paragraph, it should start with 1.\n if (isTerminatingParagraph && markerValue !== 1) return false;\n\n } else if ((posAfterMarker = skipBulletListMarker(state, startLine)) >= 0) {\n isOrdered = false;\n\n } else {\n return false;\n }\n\n // If we're starting a new unordered list right after\n // a paragraph, first line should not be empty.\n if (isTerminatingParagraph) {\n if (state.skipSpaces(posAfterMarker) >= state.eMarks[startLine]) return false;\n }\n\n // We should terminate list on style change. Remember first one to compare.\n markerCharCode = state.src.charCodeAt(posAfterMarker - 1);\n\n // For validation mode we can terminate immediately\n if (silent) { return true; }\n\n // Start list\n listTokIdx = state.tokens.length;\n\n if (isOrdered) {\n token = state.push('ordered_list_open', 'ol', 1);\n if (markerValue !== 1) {\n token.attrs = [ [ 'start', markerValue ] ];\n }\n\n } else {\n token = state.push('bullet_list_open', 'ul', 1);\n }\n\n token.map = listLines = [ startLine, 0 ];\n token.markup = String.fromCharCode(markerCharCode);\n\n //\n // Iterate list items\n //\n\n nextLine = startLine;\n prevEmptyEnd = false;\n terminatorRules = state.md.block.ruler.getRules('list');\n\n oldParentType = state.parentType;\n state.parentType = 'list';\n\n while (nextLine < endLine) {\n pos = posAfterMarker;\n max = state.eMarks[nextLine];\n\n initial = offset = state.sCount[nextLine] + posAfterMarker - (state.bMarks[startLine] + state.tShift[startLine]);\n\n while (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (ch === 0x09) {\n offset += 4 - (offset + state.bsCount[nextLine]) % 4;\n } else if (ch === 0x20) {\n offset++;\n } else {\n break;\n }\n\n pos++;\n }\n\n contentStart = pos;\n\n if (contentStart >= max) {\n // trimming space in \"- \\n 3\" case, indent is 1 here\n indentAfterMarker = 1;\n } else {\n indentAfterMarker = offset - initial;\n }\n\n // If we have more than 4 spaces, the indent is 1\n // (the rest is just indented code block)\n if (indentAfterMarker > 4) { indentAfterMarker = 1; }\n\n // \" - test\"\n // ^^^^^ - calculating total length of this thing\n indent = initial + indentAfterMarker;\n\n // Run subparser & write tokens\n token = state.push('list_item_open', 'li', 1);\n token.markup = String.fromCharCode(markerCharCode);\n token.map = itemLines = [ startLine, 0 ];\n if (isOrdered) {\n token.info = state.src.slice(start, posAfterMarker - 1);\n }\n\n // change current state, then restore it after parser subcall\n oldTight = state.tight;\n oldTShift = state.tShift[startLine];\n oldSCount = state.sCount[startLine];\n\n // - example list\n // ^ listIndent position will be here\n // ^ blkIndent position will be here\n //\n oldListIndent = state.listIndent;\n state.listIndent = state.blkIndent;\n state.blkIndent = indent;\n\n state.tight = true;\n state.tShift[startLine] = contentStart - state.bMarks[startLine];\n state.sCount[startLine] = offset;\n\n if (contentStart >= max && state.isEmpty(startLine + 1)) {\n // workaround for this case\n // (list item is empty, list terminates before \"foo\"):\n // ~~~~~~~~\n // -\n //\n // foo\n // ~~~~~~~~\n state.line = Math.min(state.line + 2, endLine);\n } else {\n state.md.block.tokenize(state, startLine, endLine, true);\n }\n\n // If any of list item is tight, mark list as tight\n if (!state.tight || prevEmptyEnd) {\n tight = false;\n }\n // Item become loose if finish with empty line,\n // but we should filter last element, because it means list finish\n prevEmptyEnd = (state.line - startLine) > 1 && state.isEmpty(state.line - 1);\n\n state.blkIndent = state.listIndent;\n state.listIndent = oldListIndent;\n state.tShift[startLine] = oldTShift;\n state.sCount[startLine] = oldSCount;\n state.tight = oldTight;\n\n token = state.push('list_item_close', 'li', -1);\n token.markup = String.fromCharCode(markerCharCode);\n\n nextLine = startLine = state.line;\n itemLines[1] = nextLine;\n contentStart = state.bMarks[startLine];\n\n if (nextLine >= endLine) { break; }\n\n //\n // Try to check if list is terminated or continued.\n //\n if (state.sCount[nextLine] < state.blkIndent) { break; }\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { break; }\n\n // fail if terminating block found\n terminate = false;\n for (i = 0, l = terminatorRules.length; i < l; i++) {\n if (terminatorRules[i](state, nextLine, endLine, true)) {\n terminate = true;\n break;\n }\n }\n if (terminate) { break; }\n\n // fail if list has another type\n if (isOrdered) {\n posAfterMarker = skipOrderedListMarker(state, nextLine);\n if (posAfterMarker < 0) { break; }\n start = state.bMarks[nextLine] + state.tShift[nextLine];\n } else {\n posAfterMarker = skipBulletListMarker(state, nextLine);\n if (posAfterMarker < 0) { break; }\n }\n\n if (markerCharCode !== state.src.charCodeAt(posAfterMarker - 1)) { break; }\n }\n\n // Finalize list\n if (isOrdered) {\n token = state.push('ordered_list_close', 'ol', -1);\n } else {\n token = state.push('bullet_list_close', 'ul', -1);\n }\n token.markup = String.fromCharCode(markerCharCode);\n\n listLines[1] = nextLine;\n state.line = nextLine;\n\n state.parentType = oldParentType;\n\n // mark paragraphs tight if needed\n if (tight) {\n markTightParagraphs(state, listTokIdx);\n }\n\n return true;\n};\n", "'use strict';\n\n\nvar normalizeReference = require('../common/utils').normalizeReference;\nvar isSpace = require('../common/utils').isSpace;\n\n\nmodule.exports = function reference(state, startLine, _endLine, silent) {\n var ch,\n destEndPos,\n destEndLineNo,\n endLine,\n href,\n i,\n l,\n label,\n labelEnd,\n oldParentType,\n res,\n start,\n str,\n terminate,\n terminatorRules,\n title,\n lines = 0,\n pos = state.bMarks[startLine] + state.tShift[startLine],\n max = state.eMarks[startLine],\n nextLine = startLine + 1;\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n\n if (state.src.charCodeAt(pos) !== 0x5B/* [ */) { return false; }\n\n // Simple check to quickly interrupt scan on [link](url) at the start of line.\n // Can be useful on practice: https://github.com/markdown-it/markdown-it/issues/54\n while (++pos < max) {\n if (state.src.charCodeAt(pos) === 0x5D /* ] */ &&\n state.src.charCodeAt(pos - 1) !== 0x5C/* \\ */) {\n if (pos + 1 === max) { return false; }\n if (state.src.charCodeAt(pos + 1) !== 0x3A/* : */) { return false; }\n break;\n }\n }\n\n endLine = state.lineMax;\n\n // jump line-by-line until empty one or EOF\n terminatorRules = state.md.block.ruler.getRules('reference');\n\n oldParentType = state.parentType;\n state.parentType = 'reference';\n\n for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {\n // this would be a code block normally, but after paragraph\n // it's considered a lazy continuation regardless of what's there\n if (state.sCount[nextLine] - state.blkIndent > 3) { continue; }\n\n // quirk for blockquotes, this line should already be checked by that rule\n if (state.sCount[nextLine] < 0) { continue; }\n\n // Some tags can terminate paragraph without empty line.\n terminate = false;\n for (i = 0, l = terminatorRules.length; i < l; i++) {\n if (terminatorRules[i](state, nextLine, endLine, true)) {\n terminate = true;\n break;\n }\n }\n if (terminate) { break; }\n }\n\n str = state.getLines(startLine, nextLine, state.blkIndent, false).trim();\n max = str.length;\n\n for (pos = 1; pos < max; pos++) {\n ch = str.charCodeAt(pos);\n if (ch === 0x5B /* [ */) {\n return false;\n } else if (ch === 0x5D /* ] */) {\n labelEnd = pos;\n break;\n } else if (ch === 0x0A /* \\n */) {\n lines++;\n } else if (ch === 0x5C /* \\ */) {\n pos++;\n if (pos < max && str.charCodeAt(pos) === 0x0A) {\n lines++;\n }\n }\n }\n\n if (labelEnd < 0 || str.charCodeAt(labelEnd + 1) !== 0x3A/* : */) { return false; }\n\n // [label]: destination 'title'\n // ^^^ skip optional whitespace here\n for (pos = labelEnd + 2; pos < max; pos++) {\n ch = str.charCodeAt(pos);\n if (ch === 0x0A) {\n lines++;\n } else if (isSpace(ch)) {\n /*eslint no-empty:0*/\n } else {\n break;\n }\n }\n\n // [label]: destination 'title'\n // ^^^^^^^^^^^ parse this\n res = state.md.helpers.parseLinkDestination(str, pos, max);\n if (!res.ok) { return false; }\n\n href = state.md.normalizeLink(res.str);\n if (!state.md.validateLink(href)) { return false; }\n\n pos = res.pos;\n lines += res.lines;\n\n // save cursor state, we could require to rollback later\n destEndPos = pos;\n destEndLineNo = lines;\n\n // [label]: destination 'title'\n // ^^^ skipping those spaces\n start = pos;\n for (; pos < max; pos++) {\n ch = str.charCodeAt(pos);\n if (ch === 0x0A) {\n lines++;\n } else if (isSpace(ch)) {\n /*eslint no-empty:0*/\n } else {\n break;\n }\n }\n\n // [label]: destination 'title'\n // ^^^^^^^ parse this\n res = state.md.helpers.parseLinkTitle(str, pos, max);\n if (pos < max && start !== pos && res.ok) {\n title = res.str;\n pos = res.pos;\n lines += res.lines;\n } else {\n title = '';\n pos = destEndPos;\n lines = destEndLineNo;\n }\n\n // skip trailing spaces until the rest of the line\n while (pos < max) {\n ch = str.charCodeAt(pos);\n if (!isSpace(ch)) { break; }\n pos++;\n }\n\n if (pos < max && str.charCodeAt(pos) !== 0x0A) {\n if (title) {\n // garbage at the end of the line after title,\n // but it could still be a valid reference if we roll back\n title = '';\n pos = destEndPos;\n lines = destEndLineNo;\n while (pos < max) {\n ch = str.charCodeAt(pos);\n if (!isSpace(ch)) { break; }\n pos++;\n }\n }\n }\n\n if (pos < max && str.charCodeAt(pos) !== 0x0A) {\n // garbage at the end of the line\n return false;\n }\n\n label = normalizeReference(str.slice(1, labelEnd));\n if (!label) {\n // CommonMark 0.20 disallows empty labels\n return false;\n }\n\n // Reference can not terminate anything. This check is for safety only.\n /*istanbul ignore if*/\n if (silent) { return true; }\n\n if (typeof state.env.references === 'undefined') {\n state.env.references = {};\n }\n if (typeof state.env.references[label] === 'undefined') {\n state.env.references[label] = { title: title, href: href };\n }\n\n state.parentType = oldParentType;\n\n state.line = startLine + lines + 1;\n return true;\n};\n", "// List of valid html blocks names, accorting to commonmark spec\n// http://jgm.github.io/CommonMark/spec.html#html-blocks\n\n'use strict';\n\n\nmodule.exports = [\n 'address',\n 'article',\n 'aside',\n 'base',\n 'basefont',\n 'blockquote',\n 'body',\n 'caption',\n 'center',\n 'col',\n 'colgroup',\n 'dd',\n 'details',\n 'dialog',\n 'dir',\n 'div',\n 'dl',\n 'dt',\n 'fieldset',\n 'figcaption',\n 'figure',\n 'footer',\n 'form',\n 'frame',\n 'frameset',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'head',\n 'header',\n 'hr',\n 'html',\n 'iframe',\n 'legend',\n 'li',\n 'link',\n 'main',\n 'menu',\n 'menuitem',\n 'nav',\n 'noframes',\n 'ol',\n 'optgroup',\n 'option',\n 'p',\n 'param',\n 'section',\n 'source',\n 'summary',\n 'table',\n 'tbody',\n 'td',\n 'tfoot',\n 'th',\n 'thead',\n 'title',\n 'tr',\n 'track',\n 'ul'\n];\n", "// Regexps to match html elements\n\n'use strict';\n\nvar attr_name = '[a-zA-Z_:][a-zA-Z0-9:._-]*';\n\nvar unquoted = '[^\"\\'=<>`\\\\x00-\\\\x20]+';\nvar single_quoted = \"'[^']*'\";\nvar double_quoted = '\"[^\"]*\"';\n\nvar attr_value = '(?:' + unquoted + '|' + single_quoted + '|' + double_quoted + ')';\n\nvar attribute = '(?:\\\\s+' + attr_name + '(?:\\\\s*=\\\\s*' + attr_value + ')?)';\n\nvar open_tag = '<[A-Za-z][A-Za-z0-9\\\\-]*' + attribute + '*\\\\s*\\\\/?>';\n\nvar close_tag = '<\\\\/[A-Za-z][A-Za-z0-9\\\\-]*\\\\s*>';\nvar comment = '|';\nvar processing = '<[?][\\\\s\\\\S]*?[?]>';\nvar declaration = ']*>';\nvar cdata = '';\n\nvar HTML_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + '|' + comment +\n '|' + processing + '|' + declaration + '|' + cdata + ')');\nvar HTML_OPEN_CLOSE_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + ')');\n\nmodule.exports.HTML_TAG_RE = HTML_TAG_RE;\nmodule.exports.HTML_OPEN_CLOSE_TAG_RE = HTML_OPEN_CLOSE_TAG_RE;\n", "// HTML block\n\n'use strict';\n\n\nvar block_names = require('../common/html_blocks');\nvar HTML_OPEN_CLOSE_TAG_RE = require('../common/html_re').HTML_OPEN_CLOSE_TAG_RE;\n\n// An array of opening and corresponding closing sequences for html tags,\n// last argument defines whether it can terminate a paragraph or not\n//\nvar HTML_SEQUENCES = [\n [ /^<(script|pre|style|textarea)(?=(\\s|>|$))/i, /<\\/(script|pre|style|textarea)>/i, true ],\n [ /^/, true ],\n [ /^<\\?/, /\\?>/, true ],\n [ /^/, true ],\n [ /^/, true ],\n [ new RegExp('^|$))', 'i'), /^$/, true ],\n [ new RegExp(HTML_OPEN_CLOSE_TAG_RE.source + '\\\\s*$'), /^$/, false ]\n];\n\n\nmodule.exports = function html_block(state, startLine, endLine, silent) {\n var i, nextLine, token, lineText,\n pos = state.bMarks[startLine] + state.tShift[startLine],\n max = state.eMarks[startLine];\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n\n if (!state.md.options.html) { return false; }\n\n if (state.src.charCodeAt(pos) !== 0x3C/* < */) { return false; }\n\n lineText = state.src.slice(pos, max);\n\n for (i = 0; i < HTML_SEQUENCES.length; i++) {\n if (HTML_SEQUENCES[i][0].test(lineText)) { break; }\n }\n\n if (i === HTML_SEQUENCES.length) { return false; }\n\n if (silent) {\n // true if this sequence can be a terminator, false otherwise\n return HTML_SEQUENCES[i][2];\n }\n\n nextLine = startLine + 1;\n\n // If we are here - we detected HTML block.\n // Let's roll down till block end.\n if (!HTML_SEQUENCES[i][1].test(lineText)) {\n for (; nextLine < endLine; nextLine++) {\n if (state.sCount[nextLine] < state.blkIndent) { break; }\n\n pos = state.bMarks[nextLine] + state.tShift[nextLine];\n max = state.eMarks[nextLine];\n lineText = state.src.slice(pos, max);\n\n if (HTML_SEQUENCES[i][1].test(lineText)) {\n if (lineText.length !== 0) { nextLine++; }\n break;\n }\n }\n }\n\n state.line = nextLine;\n\n token = state.push('html_block', '', 0);\n token.map = [ startLine, nextLine ];\n token.content = state.getLines(startLine, nextLine, state.blkIndent, true);\n\n return true;\n};\n", "// heading (#, ##, ...)\n\n'use strict';\n\nvar isSpace = require('../common/utils').isSpace;\n\n\nmodule.exports = function heading(state, startLine, endLine, silent) {\n var ch, level, tmp, token,\n pos = state.bMarks[startLine] + state.tShift[startLine],\n max = state.eMarks[startLine];\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n\n ch = state.src.charCodeAt(pos);\n\n if (ch !== 0x23/* # */ || pos >= max) { return false; }\n\n // count heading level\n level = 1;\n ch = state.src.charCodeAt(++pos);\n while (ch === 0x23/* # */ && pos < max && level <= 6) {\n level++;\n ch = state.src.charCodeAt(++pos);\n }\n\n if (level > 6 || (pos < max && !isSpace(ch))) { return false; }\n\n if (silent) { return true; }\n\n // Let's cut tails like ' ### ' from the end of string\n\n max = state.skipSpacesBack(max, pos);\n tmp = state.skipCharsBack(max, 0x23, pos); // #\n if (tmp > pos && isSpace(state.src.charCodeAt(tmp - 1))) {\n max = tmp;\n }\n\n state.line = startLine + 1;\n\n token = state.push('heading_open', 'h' + String(level), 1);\n token.markup = '########'.slice(0, level);\n token.map = [ startLine, state.line ];\n\n token = state.push('inline', '', 0);\n token.content = state.src.slice(pos, max).trim();\n token.map = [ startLine, state.line ];\n token.children = [];\n\n token = state.push('heading_close', 'h' + String(level), -1);\n token.markup = '########'.slice(0, level);\n\n return true;\n};\n", "// lheading (---, ===)\n\n'use strict';\n\n\nmodule.exports = function lheading(state, startLine, endLine/*, silent*/) {\n var content, terminate, i, l, token, pos, max, level, marker,\n nextLine = startLine + 1, oldParentType,\n terminatorRules = state.md.block.ruler.getRules('paragraph');\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n\n oldParentType = state.parentType;\n state.parentType = 'paragraph'; // use paragraph to match terminatorRules\n\n // jump line-by-line until empty one or EOF\n for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {\n // this would be a code block normally, but after paragraph\n // it's considered a lazy continuation regardless of what's there\n if (state.sCount[nextLine] - state.blkIndent > 3) { continue; }\n\n //\n // Check for underline in setext header\n //\n if (state.sCount[nextLine] >= state.blkIndent) {\n pos = state.bMarks[nextLine] + state.tShift[nextLine];\n max = state.eMarks[nextLine];\n\n if (pos < max) {\n marker = state.src.charCodeAt(pos);\n\n if (marker === 0x2D/* - */ || marker === 0x3D/* = */) {\n pos = state.skipChars(pos, marker);\n pos = state.skipSpaces(pos);\n\n if (pos >= max) {\n level = (marker === 0x3D/* = */ ? 1 : 2);\n break;\n }\n }\n }\n }\n\n // quirk for blockquotes, this line should already be checked by that rule\n if (state.sCount[nextLine] < 0) { continue; }\n\n // Some tags can terminate paragraph without empty line.\n terminate = false;\n for (i = 0, l = terminatorRules.length; i < l; i++) {\n if (terminatorRules[i](state, nextLine, endLine, true)) {\n terminate = true;\n break;\n }\n }\n if (terminate) { break; }\n }\n\n if (!level) {\n // Didn't find valid underline\n return false;\n }\n\n content = state.getLines(startLine, nextLine, state.blkIndent, false).trim();\n\n state.line = nextLine + 1;\n\n token = state.push('heading_open', 'h' + String(level), 1);\n token.markup = String.fromCharCode(marker);\n token.map = [ startLine, state.line ];\n\n token = state.push('inline', '', 0);\n token.content = content;\n token.map = [ startLine, state.line - 1 ];\n token.children = [];\n\n token = state.push('heading_close', 'h' + String(level), -1);\n token.markup = String.fromCharCode(marker);\n\n state.parentType = oldParentType;\n\n return true;\n};\n", "// Paragraph\n\n'use strict';\n\n\nmodule.exports = function paragraph(state, startLine/*, endLine*/) {\n var content, terminate, i, l, token, oldParentType,\n nextLine = startLine + 1,\n terminatorRules = state.md.block.ruler.getRules('paragraph'),\n endLine = state.lineMax;\n\n oldParentType = state.parentType;\n state.parentType = 'paragraph';\n\n // jump line-by-line until empty one or EOF\n for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {\n // this would be a code block normally, but after paragraph\n // it's considered a lazy continuation regardless of what's there\n if (state.sCount[nextLine] - state.blkIndent > 3) { continue; }\n\n // quirk for blockquotes, this line should already be checked by that rule\n if (state.sCount[nextLine] < 0) { continue; }\n\n // Some tags can terminate paragraph without empty line.\n terminate = false;\n for (i = 0, l = terminatorRules.length; i < l; i++) {\n if (terminatorRules[i](state, nextLine, endLine, true)) {\n terminate = true;\n break;\n }\n }\n if (terminate) { break; }\n }\n\n content = state.getLines(startLine, nextLine, state.blkIndent, false).trim();\n\n state.line = nextLine;\n\n token = state.push('paragraph_open', 'p', 1);\n token.map = [ startLine, state.line ];\n\n token = state.push('inline', '', 0);\n token.content = content;\n token.map = [ startLine, state.line ];\n token.children = [];\n\n token = state.push('paragraph_close', 'p', -1);\n\n state.parentType = oldParentType;\n\n return true;\n};\n", "// Parser state class\n\n'use strict';\n\nvar Token = require('../token');\nvar isSpace = require('../common/utils').isSpace;\n\n\nfunction StateBlock(src, md, env, tokens) {\n var ch, s, start, pos, len, indent, offset, indent_found;\n\n this.src = src;\n\n // link to parser instance\n this.md = md;\n\n this.env = env;\n\n //\n // Internal state vartiables\n //\n\n this.tokens = tokens;\n\n this.bMarks = []; // line begin offsets for fast jumps\n this.eMarks = []; // line end offsets for fast jumps\n this.tShift = []; // offsets of the first non-space characters (tabs not expanded)\n this.sCount = []; // indents for each line (tabs expanded)\n\n // An amount of virtual spaces (tabs expanded) between beginning\n // of each line (bMarks) and real beginning of that line.\n //\n // It exists only as a hack because blockquotes override bMarks\n // losing information in the process.\n //\n // It's used only when expanding tabs, you can think about it as\n // an initial tab length, e.g. bsCount=21 applied to string `\\t123`\n // means first tab should be expanded to 4-21%4 === 3 spaces.\n //\n this.bsCount = [];\n\n // block parser variables\n this.blkIndent = 0; // required block content indent (for example, if we are\n // inside a list, it would be positioned after list marker)\n this.line = 0; // line index in src\n this.lineMax = 0; // lines count\n this.tight = false; // loose/tight mode for lists\n this.ddIndent = -1; // indent of the current dd block (-1 if there isn't any)\n this.listIndent = -1; // indent of the current list block (-1 if there isn't any)\n\n // can be 'blockquote', 'list', 'root', 'paragraph' or 'reference'\n // used in lists to determine if they interrupt a paragraph\n this.parentType = 'root';\n\n this.level = 0;\n\n // renderer\n this.result = '';\n\n // Create caches\n // Generate markers.\n s = this.src;\n indent_found = false;\n\n for (start = pos = indent = offset = 0, len = s.length; pos < len; pos++) {\n ch = s.charCodeAt(pos);\n\n if (!indent_found) {\n if (isSpace(ch)) {\n indent++;\n\n if (ch === 0x09) {\n offset += 4 - offset % 4;\n } else {\n offset++;\n }\n continue;\n } else {\n indent_found = true;\n }\n }\n\n if (ch === 0x0A || pos === len - 1) {\n if (ch !== 0x0A) { pos++; }\n this.bMarks.push(start);\n this.eMarks.push(pos);\n this.tShift.push(indent);\n this.sCount.push(offset);\n this.bsCount.push(0);\n\n indent_found = false;\n indent = 0;\n offset = 0;\n start = pos + 1;\n }\n }\n\n // Push fake entry to simplify cache bounds checks\n this.bMarks.push(s.length);\n this.eMarks.push(s.length);\n this.tShift.push(0);\n this.sCount.push(0);\n this.bsCount.push(0);\n\n this.lineMax = this.bMarks.length - 1; // don't count last fake line\n}\n\n// Push new token to \"stream\".\n//\nStateBlock.prototype.push = function (type, tag, nesting) {\n var token = new Token(type, tag, nesting);\n token.block = true;\n\n if (nesting < 0) this.level--; // closing tag\n token.level = this.level;\n if (nesting > 0) this.level++; // opening tag\n\n this.tokens.push(token);\n return token;\n};\n\nStateBlock.prototype.isEmpty = function isEmpty(line) {\n return this.bMarks[line] + this.tShift[line] >= this.eMarks[line];\n};\n\nStateBlock.prototype.skipEmptyLines = function skipEmptyLines(from) {\n for (var max = this.lineMax; from < max; from++) {\n if (this.bMarks[from] + this.tShift[from] < this.eMarks[from]) {\n break;\n }\n }\n return from;\n};\n\n// Skip spaces from given position.\nStateBlock.prototype.skipSpaces = function skipSpaces(pos) {\n var ch;\n\n for (var max = this.src.length; pos < max; pos++) {\n ch = this.src.charCodeAt(pos);\n if (!isSpace(ch)) { break; }\n }\n return pos;\n};\n\n// Skip spaces from given position in reverse.\nStateBlock.prototype.skipSpacesBack = function skipSpacesBack(pos, min) {\n if (pos <= min) { return pos; }\n\n while (pos > min) {\n if (!isSpace(this.src.charCodeAt(--pos))) { return pos + 1; }\n }\n return pos;\n};\n\n// Skip char codes from given position\nStateBlock.prototype.skipChars = function skipChars(pos, code) {\n for (var max = this.src.length; pos < max; pos++) {\n if (this.src.charCodeAt(pos) !== code) { break; }\n }\n return pos;\n};\n\n// Skip char codes reverse from given position - 1\nStateBlock.prototype.skipCharsBack = function skipCharsBack(pos, code, min) {\n if (pos <= min) { return pos; }\n\n while (pos > min) {\n if (code !== this.src.charCodeAt(--pos)) { return pos + 1; }\n }\n return pos;\n};\n\n// cut lines range from source.\nStateBlock.prototype.getLines = function getLines(begin, end, indent, keepLastLF) {\n var i, lineIndent, ch, first, last, queue, lineStart,\n line = begin;\n\n if (begin >= end) {\n return '';\n }\n\n queue = new Array(end - begin);\n\n for (i = 0; line < end; line++, i++) {\n lineIndent = 0;\n lineStart = first = this.bMarks[line];\n\n if (line + 1 < end || keepLastLF) {\n // No need for bounds check because we have fake entry on tail.\n last = this.eMarks[line] + 1;\n } else {\n last = this.eMarks[line];\n }\n\n while (first < last && lineIndent < indent) {\n ch = this.src.charCodeAt(first);\n\n if (isSpace(ch)) {\n if (ch === 0x09) {\n lineIndent += 4 - (lineIndent + this.bsCount[line]) % 4;\n } else {\n lineIndent++;\n }\n } else if (first - lineStart < this.tShift[line]) {\n // patched tShift masked characters to look like spaces (blockquotes, list markers)\n lineIndent++;\n } else {\n break;\n }\n\n first++;\n }\n\n if (lineIndent > indent) {\n // partially expanding tabs in code blocks, e.g '\\t\\tfoobar'\n // with indent=2 becomes ' \\tfoobar'\n queue[i] = new Array(lineIndent - indent + 1).join(' ') + this.src.slice(first, last);\n } else {\n queue[i] = this.src.slice(first, last);\n }\n }\n\n return queue.join('');\n};\n\n// re-export Token class to use in block rules\nStateBlock.prototype.Token = Token;\n\n\nmodule.exports = StateBlock;\n", "/** internal\n * class ParserBlock\n *\n * Block-level tokenizer.\n **/\n'use strict';\n\n\nvar Ruler = require('./ruler');\n\n\nvar _rules = [\n // First 2 params - rule name & source. Secondary array - list of rules,\n // which can be terminated by this one.\n [ 'table', require('./rules_block/table'), [ 'paragraph', 'reference' ] ],\n [ 'code', require('./rules_block/code') ],\n [ 'fence', require('./rules_block/fence'), [ 'paragraph', 'reference', 'blockquote', 'list' ] ],\n [ 'blockquote', require('./rules_block/blockquote'), [ 'paragraph', 'reference', 'blockquote', 'list' ] ],\n [ 'hr', require('./rules_block/hr'), [ 'paragraph', 'reference', 'blockquote', 'list' ] ],\n [ 'list', require('./rules_block/list'), [ 'paragraph', 'reference', 'blockquote' ] ],\n [ 'reference', require('./rules_block/reference') ],\n [ 'html_block', require('./rules_block/html_block'), [ 'paragraph', 'reference', 'blockquote' ] ],\n [ 'heading', require('./rules_block/heading'), [ 'paragraph', 'reference', 'blockquote' ] ],\n [ 'lheading', require('./rules_block/lheading') ],\n [ 'paragraph', require('./rules_block/paragraph') ]\n];\n\n\n/**\n * new ParserBlock()\n **/\nfunction ParserBlock() {\n /**\n * ParserBlock#ruler -> Ruler\n *\n * [[Ruler]] instance. Keep configuration of block rules.\n **/\n this.ruler = new Ruler();\n\n for (var i = 0; i < _rules.length; i++) {\n this.ruler.push(_rules[i][0], _rules[i][1], { alt: (_rules[i][2] || []).slice() });\n }\n}\n\n\n// Generate tokens for input range\n//\nParserBlock.prototype.tokenize = function (state, startLine, endLine) {\n var ok, i,\n rules = this.ruler.getRules(''),\n len = rules.length,\n line = startLine,\n hasEmptyLines = false,\n maxNesting = state.md.options.maxNesting;\n\n while (line < endLine) {\n state.line = line = state.skipEmptyLines(line);\n if (line >= endLine) { break; }\n\n // Termination condition for nested calls.\n // Nested calls currently used for blockquotes & lists\n if (state.sCount[line] < state.blkIndent) { break; }\n\n // If nesting level exceeded - skip tail to the end. That's not ordinary\n // situation and we should not care about content.\n if (state.level >= maxNesting) {\n state.line = endLine;\n break;\n }\n\n // Try all possible rules.\n // On success, rule should:\n //\n // - update `state.line`\n // - update `state.tokens`\n // - return true\n\n for (i = 0; i < len; i++) {\n ok = rules[i](state, line, endLine, false);\n if (ok) { break; }\n }\n\n // set state.tight if we had an empty line before current tag\n // i.e. latest empty line should not count\n state.tight = !hasEmptyLines;\n\n // paragraph might \"eat\" one newline after it in nested lists\n if (state.isEmpty(state.line - 1)) {\n hasEmptyLines = true;\n }\n\n line = state.line;\n\n if (line < endLine && state.isEmpty(line)) {\n hasEmptyLines = true;\n line++;\n state.line = line;\n }\n }\n};\n\n\n/**\n * ParserBlock.parse(str, md, env, outTokens)\n *\n * Process input string and push block tokens into `outTokens`\n **/\nParserBlock.prototype.parse = function (src, md, env, outTokens) {\n var state;\n\n if (!src) { return; }\n\n state = new this.State(src, md, env, outTokens);\n\n this.tokenize(state, state.line, state.lineMax);\n};\n\n\nParserBlock.prototype.State = require('./rules_block/state_block');\n\n\nmodule.exports = ParserBlock;\n", "// Skip text characters for text token, place those to pending buffer\n// and increment current pos\n\n'use strict';\n\n\n// Rule to skip pure text\n// '{}$%@~+=:' reserved for extentions\n\n// !, \", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \\, ], ^, _, `, {, |, }, or ~\n\n// !!!! Don't confuse with \"Markdown ASCII Punctuation\" chars\n// http://spec.commonmark.org/0.15/#ascii-punctuation-character\nfunction isTerminatorChar(ch) {\n switch (ch) {\n case 0x0A/* \\n */:\n case 0x21/* ! */:\n case 0x23/* # */:\n case 0x24/* $ */:\n case 0x25/* % */:\n case 0x26/* & */:\n case 0x2A/* * */:\n case 0x2B/* + */:\n case 0x2D/* - */:\n case 0x3A/* : */:\n case 0x3C/* < */:\n case 0x3D/* = */:\n case 0x3E/* > */:\n case 0x40/* @ */:\n case 0x5B/* [ */:\n case 0x5C/* \\ */:\n case 0x5D/* ] */:\n case 0x5E/* ^ */:\n case 0x5F/* _ */:\n case 0x60/* ` */:\n case 0x7B/* { */:\n case 0x7D/* } */:\n case 0x7E/* ~ */:\n return true;\n default:\n return false;\n }\n}\n\nmodule.exports = function text(state, silent) {\n var pos = state.pos;\n\n while (pos < state.posMax && !isTerminatorChar(state.src.charCodeAt(pos))) {\n pos++;\n }\n\n if (pos === state.pos) { return false; }\n\n if (!silent) { state.pending += state.src.slice(state.pos, pos); }\n\n state.pos = pos;\n\n return true;\n};\n\n// Alternative implementation, for memory.\n//\n// It costs 10% of performance, but allows extend terminators list, if place it\n// to `ParcerInline` property. Probably, will switch to it sometime, such\n// flexibility required.\n\n/*\nvar TERMINATOR_RE = /[\\n!#$%&*+\\-:<=>@[\\\\\\]^_`{}~]/;\n\nmodule.exports = function text(state, silent) {\n var pos = state.pos,\n idx = state.src.slice(pos).search(TERMINATOR_RE);\n\n // first char is terminator -> empty text\n if (idx === 0) { return false; }\n\n // no terminator -> text till end of string\n if (idx < 0) {\n if (!silent) { state.pending += state.src.slice(pos); }\n state.pos = state.src.length;\n return true;\n }\n\n if (!silent) { state.pending += state.src.slice(pos, pos + idx); }\n\n state.pos += idx;\n\n return true;\n};*/\n", "// Proceess '\\n'\n\n'use strict';\n\nvar isSpace = require('../common/utils').isSpace;\n\n\nmodule.exports = function newline(state, silent) {\n var pmax, max, pos = state.pos;\n\n if (state.src.charCodeAt(pos) !== 0x0A/* \\n */) { return false; }\n\n pmax = state.pending.length - 1;\n max = state.posMax;\n\n // ' \\n' -> hardbreak\n // Lookup in pending chars is bad practice! Don't copy to other rules!\n // Pending string is stored in concat mode, indexed lookups will cause\n // convertion to flat mode.\n if (!silent) {\n if (pmax >= 0 && state.pending.charCodeAt(pmax) === 0x20) {\n if (pmax >= 1 && state.pending.charCodeAt(pmax - 1) === 0x20) {\n state.pending = state.pending.replace(/ +$/, '');\n state.push('hardbreak', 'br', 0);\n } else {\n state.pending = state.pending.slice(0, -1);\n state.push('softbreak', 'br', 0);\n }\n\n } else {\n state.push('softbreak', 'br', 0);\n }\n }\n\n pos++;\n\n // skip heading spaces for next line\n while (pos < max && isSpace(state.src.charCodeAt(pos))) { pos++; }\n\n state.pos = pos;\n return true;\n};\n", "// Process escaped chars and hardbreaks\n\n'use strict';\n\nvar isSpace = require('../common/utils').isSpace;\n\nvar ESCAPED = [];\n\nfor (var i = 0; i < 256; i++) { ESCAPED.push(0); }\n\n'\\\\!\"#$%&\\'()*+,./:;<=>?@[]^_`{|}~-'\n .split('').forEach(function (ch) { ESCAPED[ch.charCodeAt(0)] = 1; });\n\n\nmodule.exports = function escape(state, silent) {\n var ch, pos = state.pos, max = state.posMax;\n\n if (state.src.charCodeAt(pos) !== 0x5C/* \\ */) { return false; }\n\n pos++;\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (ch < 256 && ESCAPED[ch] !== 0) {\n if (!silent) { state.pending += state.src[pos]; }\n state.pos += 2;\n return true;\n }\n\n if (ch === 0x0A) {\n if (!silent) {\n state.push('hardbreak', 'br', 0);\n }\n\n pos++;\n // skip leading whitespaces from next line\n while (pos < max) {\n ch = state.src.charCodeAt(pos);\n if (!isSpace(ch)) { break; }\n pos++;\n }\n\n state.pos = pos;\n return true;\n }\n }\n\n if (!silent) { state.pending += '\\\\'; }\n state.pos++;\n return true;\n};\n", "// Parse backticks\n\n'use strict';\n\n\nmodule.exports = function backtick(state, silent) {\n var start, max, marker, token, matchStart, matchEnd, openerLength, closerLength,\n pos = state.pos,\n ch = state.src.charCodeAt(pos);\n\n if (ch !== 0x60/* ` */) { return false; }\n\n start = pos;\n pos++;\n max = state.posMax;\n\n // scan marker length\n while (pos < max && state.src.charCodeAt(pos) === 0x60/* ` */) { pos++; }\n\n marker = state.src.slice(start, pos);\n openerLength = marker.length;\n\n if (state.backticksScanned && (state.backticks[openerLength] || 0) <= start) {\n if (!silent) state.pending += marker;\n state.pos += openerLength;\n return true;\n }\n\n matchStart = matchEnd = pos;\n\n // Nothing found in the cache, scan until the end of the line (or until marker is found)\n while ((matchStart = state.src.indexOf('`', matchEnd)) !== -1) {\n matchEnd = matchStart + 1;\n\n // scan marker length\n while (matchEnd < max && state.src.charCodeAt(matchEnd) === 0x60/* ` */) { matchEnd++; }\n\n closerLength = matchEnd - matchStart;\n\n if (closerLength === openerLength) {\n // Found matching closer length.\n if (!silent) {\n token = state.push('code_inline', 'code', 0);\n token.markup = marker;\n token.content = state.src.slice(pos, matchStart)\n .replace(/\\n/g, ' ')\n .replace(/^ (.+) $/, '$1');\n }\n state.pos = matchEnd;\n return true;\n }\n\n // Some different length found, put it in cache as upper limit of where closer can be found\n state.backticks[closerLength] = matchStart;\n }\n\n // Scanned through the end, didn't find anything\n state.backticksScanned = true;\n\n if (!silent) state.pending += marker;\n state.pos += openerLength;\n return true;\n};\n", "// ~~strike through~~\n//\n'use strict';\n\n\n// Insert each marker as a separate text token, and add it to delimiter list\n//\nmodule.exports.tokenize = function strikethrough(state, silent) {\n var i, scanned, token, len, ch,\n start = state.pos,\n marker = state.src.charCodeAt(start);\n\n if (silent) { return false; }\n\n if (marker !== 0x7E/* ~ */) { return false; }\n\n scanned = state.scanDelims(state.pos, true);\n len = scanned.length;\n ch = String.fromCharCode(marker);\n\n if (len < 2) { return false; }\n\n if (len % 2) {\n token = state.push('text', '', 0);\n token.content = ch;\n len--;\n }\n\n for (i = 0; i < len; i += 2) {\n token = state.push('text', '', 0);\n token.content = ch + ch;\n\n state.delimiters.push({\n marker: marker,\n length: 0, // disable \"rule of 3\" length checks meant for emphasis\n token: state.tokens.length - 1,\n end: -1,\n open: scanned.can_open,\n close: scanned.can_close\n });\n }\n\n state.pos += scanned.length;\n\n return true;\n};\n\n\nfunction postProcess(state, delimiters) {\n var i, j,\n startDelim,\n endDelim,\n token,\n loneMarkers = [],\n max = delimiters.length;\n\n for (i = 0; i < max; i++) {\n startDelim = delimiters[i];\n\n if (startDelim.marker !== 0x7E/* ~ */) {\n continue;\n }\n\n if (startDelim.end === -1) {\n continue;\n }\n\n endDelim = delimiters[startDelim.end];\n\n token = state.tokens[startDelim.token];\n token.type = 's_open';\n token.tag = 's';\n token.nesting = 1;\n token.markup = '~~';\n token.content = '';\n\n token = state.tokens[endDelim.token];\n token.type = 's_close';\n token.tag = 's';\n token.nesting = -1;\n token.markup = '~~';\n token.content = '';\n\n if (state.tokens[endDelim.token - 1].type === 'text' &&\n state.tokens[endDelim.token - 1].content === '~') {\n\n loneMarkers.push(endDelim.token - 1);\n }\n }\n\n // If a marker sequence has an odd number of characters, it's splitted\n // like this: `~~~~~` -> `~` + `~~` + `~~`, leaving one marker at the\n // start of the sequence.\n //\n // So, we have to move all those markers after subsequent s_close tags.\n //\n while (loneMarkers.length) {\n i = loneMarkers.pop();\n j = i + 1;\n\n while (j < state.tokens.length && state.tokens[j].type === 's_close') {\n j++;\n }\n\n j--;\n\n if (i !== j) {\n token = state.tokens[j];\n state.tokens[j] = state.tokens[i];\n state.tokens[i] = token;\n }\n }\n}\n\n\n// Walk through delimiter list and replace text tokens with tags\n//\nmodule.exports.postProcess = function strikethrough(state) {\n var curr,\n tokens_meta = state.tokens_meta,\n max = state.tokens_meta.length;\n\n postProcess(state, state.delimiters);\n\n for (curr = 0; curr < max; curr++) {\n if (tokens_meta[curr] && tokens_meta[curr].delimiters) {\n postProcess(state, tokens_meta[curr].delimiters);\n }\n }\n};\n", "// Process *this* and _that_\n//\n'use strict';\n\n\n// Insert each marker as a separate text token, and add it to delimiter list\n//\nmodule.exports.tokenize = function emphasis(state, silent) {\n var i, scanned, token,\n start = state.pos,\n marker = state.src.charCodeAt(start);\n\n if (silent) { return false; }\n\n if (marker !== 0x5F /* _ */ && marker !== 0x2A /* * */) { return false; }\n\n scanned = state.scanDelims(state.pos, marker === 0x2A);\n\n for (i = 0; i < scanned.length; i++) {\n token = state.push('text', '', 0);\n token.content = String.fromCharCode(marker);\n\n state.delimiters.push({\n // Char code of the starting marker (number).\n //\n marker: marker,\n\n // Total length of these series of delimiters.\n //\n length: scanned.length,\n\n // A position of the token this delimiter corresponds to.\n //\n token: state.tokens.length - 1,\n\n // If this delimiter is matched as a valid opener, `end` will be\n // equal to its position, otherwise it's `-1`.\n //\n end: -1,\n\n // Boolean flags that determine if this delimiter could open or close\n // an emphasis.\n //\n open: scanned.can_open,\n close: scanned.can_close\n });\n }\n\n state.pos += scanned.length;\n\n return true;\n};\n\n\nfunction postProcess(state, delimiters) {\n var i,\n startDelim,\n endDelim,\n token,\n ch,\n isStrong,\n max = delimiters.length;\n\n for (i = max - 1; i >= 0; i--) {\n startDelim = delimiters[i];\n\n if (startDelim.marker !== 0x5F/* _ */ && startDelim.marker !== 0x2A/* * */) {\n continue;\n }\n\n // Process only opening markers\n if (startDelim.end === -1) {\n continue;\n }\n\n endDelim = delimiters[startDelim.end];\n\n // If the previous delimiter has the same marker and is adjacent to this one,\n // merge those into one strong delimiter.\n //\n // `whatever` -> `whatever`\n //\n isStrong = i > 0 &&\n delimiters[i - 1].end === startDelim.end + 1 &&\n // check that first two markers match and adjacent\n delimiters[i - 1].marker === startDelim.marker &&\n delimiters[i - 1].token === startDelim.token - 1 &&\n // check that last two markers are adjacent (we can safely assume they match)\n delimiters[startDelim.end + 1].token === endDelim.token + 1;\n\n ch = String.fromCharCode(startDelim.marker);\n\n token = state.tokens[startDelim.token];\n token.type = isStrong ? 'strong_open' : 'em_open';\n token.tag = isStrong ? 'strong' : 'em';\n token.nesting = 1;\n token.markup = isStrong ? ch + ch : ch;\n token.content = '';\n\n token = state.tokens[endDelim.token];\n token.type = isStrong ? 'strong_close' : 'em_close';\n token.tag = isStrong ? 'strong' : 'em';\n token.nesting = -1;\n token.markup = isStrong ? ch + ch : ch;\n token.content = '';\n\n if (isStrong) {\n state.tokens[delimiters[i - 1].token].content = '';\n state.tokens[delimiters[startDelim.end + 1].token].content = '';\n i--;\n }\n }\n}\n\n\n// Walk through delimiter list and replace text tokens with tags\n//\nmodule.exports.postProcess = function emphasis(state) {\n var curr,\n tokens_meta = state.tokens_meta,\n max = state.tokens_meta.length;\n\n postProcess(state, state.delimiters);\n\n for (curr = 0; curr < max; curr++) {\n if (tokens_meta[curr] && tokens_meta[curr].delimiters) {\n postProcess(state, tokens_meta[curr].delimiters);\n }\n }\n};\n", "// Process [link]( \"stuff\")\n\n'use strict';\n\nvar normalizeReference = require('../common/utils').normalizeReference;\nvar isSpace = require('../common/utils').isSpace;\n\n\nmodule.exports = function link(state, silent) {\n var attrs,\n code,\n label,\n labelEnd,\n labelStart,\n pos,\n res,\n ref,\n token,\n href = '',\n title = '',\n oldPos = state.pos,\n max = state.posMax,\n start = state.pos,\n parseReference = true;\n\n if (state.src.charCodeAt(state.pos) !== 0x5B/* [ */) { return false; }\n\n labelStart = state.pos + 1;\n labelEnd = state.md.helpers.parseLinkLabel(state, state.pos, true);\n\n // parser failed to find ']', so it's not a valid link\n if (labelEnd < 0) { return false; }\n\n pos = labelEnd + 1;\n if (pos < max && state.src.charCodeAt(pos) === 0x28/* ( */) {\n //\n // Inline link\n //\n\n // might have found a valid shortcut link, disable reference parsing\n parseReference = false;\n\n // [link]( \"title\" )\n // ^^ skipping these spaces\n pos++;\n for (; pos < max; pos++) {\n code = state.src.charCodeAt(pos);\n if (!isSpace(code) && code !== 0x0A) { break; }\n }\n if (pos >= max) { return false; }\n\n // [link]( \"title\" )\n // ^^^^^^ parsing link destination\n start = pos;\n res = state.md.helpers.parseLinkDestination(state.src, pos, state.posMax);\n if (res.ok) {\n href = state.md.normalizeLink(res.str);\n if (state.md.validateLink(href)) {\n pos = res.pos;\n } else {\n href = '';\n }\n\n // [link]( \"title\" )\n // ^^ skipping these spaces\n start = pos;\n for (; pos < max; pos++) {\n code = state.src.charCodeAt(pos);\n if (!isSpace(code) && code !== 0x0A) { break; }\n }\n\n // [link]( \"title\" )\n // ^^^^^^^ parsing link title\n res = state.md.helpers.parseLinkTitle(state.src, pos, state.posMax);\n if (pos < max && start !== pos && res.ok) {\n title = res.str;\n pos = res.pos;\n\n // [link]( \"title\" )\n // ^^ skipping these spaces\n for (; pos < max; pos++) {\n code = state.src.charCodeAt(pos);\n if (!isSpace(code) && code !== 0x0A) { break; }\n }\n }\n }\n\n if (pos >= max || state.src.charCodeAt(pos) !== 0x29/* ) */) {\n // parsing a valid shortcut link failed, fallback to reference\n parseReference = true;\n }\n pos++;\n }\n\n if (parseReference) {\n //\n // Link reference\n //\n if (typeof state.env.references === 'undefined') { return false; }\n\n if (pos < max && state.src.charCodeAt(pos) === 0x5B/* [ */) {\n start = pos + 1;\n pos = state.md.helpers.parseLinkLabel(state, pos);\n if (pos >= 0) {\n label = state.src.slice(start, pos++);\n } else {\n pos = labelEnd + 1;\n }\n } else {\n pos = labelEnd + 1;\n }\n\n // covers label === '' and label === undefined\n // (collapsed reference link and shortcut reference link respectively)\n if (!label) { label = state.src.slice(labelStart, labelEnd); }\n\n ref = state.env.references[normalizeReference(label)];\n if (!ref) {\n state.pos = oldPos;\n return false;\n }\n href = ref.href;\n title = ref.title;\n }\n\n //\n // We found the end of the link, and know for a fact it's a valid link;\n // so all that's left to do is to call tokenizer.\n //\n if (!silent) {\n state.pos = labelStart;\n state.posMax = labelEnd;\n\n token = state.push('link_open', 'a', 1);\n token.attrs = attrs = [ [ 'href', href ] ];\n if (title) {\n attrs.push([ 'title', title ]);\n }\n\n state.md.inline.tokenize(state);\n\n token = state.push('link_close', 'a', -1);\n }\n\n state.pos = pos;\n state.posMax = max;\n return true;\n};\n", "// Process ![image]( \"title\")\n\n'use strict';\n\nvar normalizeReference = require('../common/utils').normalizeReference;\nvar isSpace = require('../common/utils').isSpace;\n\n\nmodule.exports = function image(state, silent) {\n var attrs,\n code,\n content,\n label,\n labelEnd,\n labelStart,\n pos,\n ref,\n res,\n title,\n token,\n tokens,\n start,\n href = '',\n oldPos = state.pos,\n max = state.posMax;\n\n if (state.src.charCodeAt(state.pos) !== 0x21/* ! */) { return false; }\n if (state.src.charCodeAt(state.pos + 1) !== 0x5B/* [ */) { return false; }\n\n labelStart = state.pos + 2;\n labelEnd = state.md.helpers.parseLinkLabel(state, state.pos + 1, false);\n\n // parser failed to find ']', so it's not a valid link\n if (labelEnd < 0) { return false; }\n\n pos = labelEnd + 1;\n if (pos < max && state.src.charCodeAt(pos) === 0x28/* ( */) {\n //\n // Inline link\n //\n\n // [link]( \"title\" )\n // ^^ skipping these spaces\n pos++;\n for (; pos < max; pos++) {\n code = state.src.charCodeAt(pos);\n if (!isSpace(code) && code !== 0x0A) { break; }\n }\n if (pos >= max) { return false; }\n\n // [link]( \"title\" )\n // ^^^^^^ parsing link destination\n start = pos;\n res = state.md.helpers.parseLinkDestination(state.src, pos, state.posMax);\n if (res.ok) {\n href = state.md.normalizeLink(res.str);\n if (state.md.validateLink(href)) {\n pos = res.pos;\n } else {\n href = '';\n }\n }\n\n // [link]( \"title\" )\n // ^^ skipping these spaces\n start = pos;\n for (; pos < max; pos++) {\n code = state.src.charCodeAt(pos);\n if (!isSpace(code) && code !== 0x0A) { break; }\n }\n\n // [link]( \"title\" )\n // ^^^^^^^ parsing link title\n res = state.md.helpers.parseLinkTitle(state.src, pos, state.posMax);\n if (pos < max && start !== pos && res.ok) {\n title = res.str;\n pos = res.pos;\n\n // [link]( \"title\" )\n // ^^ skipping these spaces\n for (; pos < max; pos++) {\n code = state.src.charCodeAt(pos);\n if (!isSpace(code) && code !== 0x0A) { break; }\n }\n } else {\n title = '';\n }\n\n if (pos >= max || state.src.charCodeAt(pos) !== 0x29/* ) */) {\n state.pos = oldPos;\n return false;\n }\n pos++;\n } else {\n //\n // Link reference\n //\n if (typeof state.env.references === 'undefined') { return false; }\n\n if (pos < max && state.src.charCodeAt(pos) === 0x5B/* [ */) {\n start = pos + 1;\n pos = state.md.helpers.parseLinkLabel(state, pos);\n if (pos >= 0) {\n label = state.src.slice(start, pos++);\n } else {\n pos = labelEnd + 1;\n }\n } else {\n pos = labelEnd + 1;\n }\n\n // covers label === '' and label === undefined\n // (collapsed reference link and shortcut reference link respectively)\n if (!label) { label = state.src.slice(labelStart, labelEnd); }\n\n ref = state.env.references[normalizeReference(label)];\n if (!ref) {\n state.pos = oldPos;\n return false;\n }\n href = ref.href;\n title = ref.title;\n }\n\n //\n // We found the end of the link, and know for a fact it's a valid link;\n // so all that's left to do is to call tokenizer.\n //\n if (!silent) {\n content = state.src.slice(labelStart, labelEnd);\n\n state.md.inline.parse(\n content,\n state.md,\n state.env,\n tokens = []\n );\n\n token = state.push('image', 'img', 0);\n token.attrs = attrs = [ [ 'src', href ], [ 'alt', '' ] ];\n token.children = tokens;\n token.content = content;\n\n if (title) {\n attrs.push([ 'title', title ]);\n }\n }\n\n state.pos = pos;\n state.posMax = max;\n return true;\n};\n", "// Process autolinks ''\n\n'use strict';\n\n\n/*eslint max-len:0*/\nvar EMAIL_RE = /^([a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/;\nvar AUTOLINK_RE = /^([a-zA-Z][a-zA-Z0-9+.\\-]{1,31}):([^<>\\x00-\\x20]*)$/;\n\n\nmodule.exports = function autolink(state, silent) {\n var url, fullUrl, token, ch, start, max,\n pos = state.pos;\n\n if (state.src.charCodeAt(pos) !== 0x3C/* < */) { return false; }\n\n start = state.pos;\n max = state.posMax;\n\n for (;;) {\n if (++pos >= max) return false;\n\n ch = state.src.charCodeAt(pos);\n\n if (ch === 0x3C /* < */) return false;\n if (ch === 0x3E /* > */) break;\n }\n\n url = state.src.slice(start + 1, pos);\n\n if (AUTOLINK_RE.test(url)) {\n fullUrl = state.md.normalizeLink(url);\n if (!state.md.validateLink(fullUrl)) { return false; }\n\n if (!silent) {\n token = state.push('link_open', 'a', 1);\n token.attrs = [ [ 'href', fullUrl ] ];\n token.markup = 'autolink';\n token.info = 'auto';\n\n token = state.push('text', '', 0);\n token.content = state.md.normalizeLinkText(url);\n\n token = state.push('link_close', 'a', -1);\n token.markup = 'autolink';\n token.info = 'auto';\n }\n\n state.pos += url.length + 2;\n return true;\n }\n\n if (EMAIL_RE.test(url)) {\n fullUrl = state.md.normalizeLink('mailto:' + url);\n if (!state.md.validateLink(fullUrl)) { return false; }\n\n if (!silent) {\n token = state.push('link_open', 'a', 1);\n token.attrs = [ [ 'href', fullUrl ] ];\n token.markup = 'autolink';\n token.info = 'auto';\n\n token = state.push('text', '', 0);\n token.content = state.md.normalizeLinkText(url);\n\n token = state.push('link_close', 'a', -1);\n token.markup = 'autolink';\n token.info = 'auto';\n }\n\n state.pos += url.length + 2;\n return true;\n }\n\n return false;\n};\n", "// Process html tags\n\n'use strict';\n\n\nvar HTML_TAG_RE = require('../common/html_re').HTML_TAG_RE;\n\n\nfunction isLetter(ch) {\n /*eslint no-bitwise:0*/\n var lc = ch | 0x20; // to lower case\n return (lc >= 0x61/* a */) && (lc <= 0x7a/* z */);\n}\n\n\nmodule.exports = function html_inline(state, silent) {\n var ch, match, max, token,\n pos = state.pos;\n\n if (!state.md.options.html) { return false; }\n\n // Check start\n max = state.posMax;\n if (state.src.charCodeAt(pos) !== 0x3C/* < */ ||\n pos + 2 >= max) {\n return false;\n }\n\n // Quick fail on second char\n ch = state.src.charCodeAt(pos + 1);\n if (ch !== 0x21/* ! */ &&\n ch !== 0x3F/* ? */ &&\n ch !== 0x2F/* / */ &&\n !isLetter(ch)) {\n return false;\n }\n\n match = state.src.slice(pos).match(HTML_TAG_RE);\n if (!match) { return false; }\n\n if (!silent) {\n token = state.push('html_inline', '', 0);\n token.content = state.src.slice(pos, pos + match[0].length);\n }\n state.pos += match[0].length;\n return true;\n};\n", "// Process html entity - {, ¯, ", ...\n\n'use strict';\n\nvar entities = require('../common/entities');\nvar has = require('../common/utils').has;\nvar isValidEntityCode = require('../common/utils').isValidEntityCode;\nvar fromCodePoint = require('../common/utils').fromCodePoint;\n\n\nvar DIGITAL_RE = /^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i;\nvar NAMED_RE = /^&([a-z][a-z0-9]{1,31});/i;\n\n\nmodule.exports = function entity(state, silent) {\n var ch, code, match, pos = state.pos, max = state.posMax;\n\n if (state.src.charCodeAt(pos) !== 0x26/* & */) { return false; }\n\n if (pos + 1 < max) {\n ch = state.src.charCodeAt(pos + 1);\n\n if (ch === 0x23 /* # */) {\n match = state.src.slice(pos).match(DIGITAL_RE);\n if (match) {\n if (!silent) {\n code = match[1][0].toLowerCase() === 'x' ? parseInt(match[1].slice(1), 16) : parseInt(match[1], 10);\n state.pending += isValidEntityCode(code) ? fromCodePoint(code) : fromCodePoint(0xFFFD);\n }\n state.pos += match[0].length;\n return true;\n }\n } else {\n match = state.src.slice(pos).match(NAMED_RE);\n if (match) {\n if (has(entities, match[1])) {\n if (!silent) { state.pending += entities[match[1]]; }\n state.pos += match[0].length;\n return true;\n }\n }\n }\n }\n\n if (!silent) { state.pending += '&'; }\n state.pos++;\n return true;\n};\n", "// For each opening emphasis-like marker find a matching closing one\n//\n'use strict';\n\n\nfunction processDelimiters(state, delimiters) {\n var closerIdx, openerIdx, closer, opener, minOpenerIdx, newMinOpenerIdx,\n isOddMatch, lastJump,\n openersBottom = {},\n max = delimiters.length;\n\n if (!max) return;\n\n // headerIdx is the first delimiter of the current (where closer is) delimiter run\n var headerIdx = 0;\n var lastTokenIdx = -2; // needs any value lower than -1\n var jumps = [];\n\n for (closerIdx = 0; closerIdx < max; closerIdx++) {\n closer = delimiters[closerIdx];\n\n jumps.push(0);\n\n // markers belong to same delimiter run if:\n // - they have adjacent tokens\n // - AND markers are the same\n //\n if (delimiters[headerIdx].marker !== closer.marker || lastTokenIdx !== closer.token - 1) {\n headerIdx = closerIdx;\n }\n\n lastTokenIdx = closer.token;\n\n // Length is only used for emphasis-specific \"rule of 3\",\n // if it's not defined (in strikethrough or 3rd party plugins),\n // we can default it to 0 to disable those checks.\n //\n closer.length = closer.length || 0;\n\n if (!closer.close) continue;\n\n // Previously calculated lower bounds (previous fails)\n // for each marker, each delimiter length modulo 3,\n // and for whether this closer can be an opener;\n // https://github.com/commonmark/cmark/commit/34250e12ccebdc6372b8b49c44fab57c72443460\n if (!openersBottom.hasOwnProperty(closer.marker)) {\n openersBottom[closer.marker] = [ -1, -1, -1, -1, -1, -1 ];\n }\n\n minOpenerIdx = openersBottom[closer.marker][(closer.open ? 3 : 0) + (closer.length % 3)];\n\n openerIdx = headerIdx - jumps[headerIdx] - 1;\n\n newMinOpenerIdx = openerIdx;\n\n for (; openerIdx > minOpenerIdx; openerIdx -= jumps[openerIdx] + 1) {\n opener = delimiters[openerIdx];\n\n if (opener.marker !== closer.marker) continue;\n\n if (opener.open && opener.end < 0) {\n\n isOddMatch = false;\n\n // from spec:\n //\n // If one of the delimiters can both open and close emphasis, then the\n // sum of the lengths of the delimiter runs containing the opening and\n // closing delimiters must not be a multiple of 3 unless both lengths\n // are multiples of 3.\n //\n if (opener.close || closer.open) {\n if ((opener.length + closer.length) % 3 === 0) {\n if (opener.length % 3 !== 0 || closer.length % 3 !== 0) {\n isOddMatch = true;\n }\n }\n }\n\n if (!isOddMatch) {\n // If previous delimiter cannot be an opener, we can safely skip\n // the entire sequence in future checks. This is required to make\n // sure algorithm has linear complexity (see *_*_*_*_*_... case).\n //\n lastJump = openerIdx > 0 && !delimiters[openerIdx - 1].open ?\n jumps[openerIdx - 1] + 1 :\n 0;\n\n jumps[closerIdx] = closerIdx - openerIdx + lastJump;\n jumps[openerIdx] = lastJump;\n\n closer.open = false;\n opener.end = closerIdx;\n opener.close = false;\n newMinOpenerIdx = -1;\n // treat next token as start of run,\n // it optimizes skips in **<...>**a**<...>** pathological case\n lastTokenIdx = -2;\n break;\n }\n }\n }\n\n if (newMinOpenerIdx !== -1) {\n // If match for this delimiter run failed, we want to set lower bound for\n // future lookups. This is required to make sure algorithm has linear\n // complexity.\n //\n // See details here:\n // https://github.com/commonmark/cmark/issues/178#issuecomment-270417442\n //\n openersBottom[closer.marker][(closer.open ? 3 : 0) + ((closer.length || 0) % 3)] = newMinOpenerIdx;\n }\n }\n}\n\n\nmodule.exports = function link_pairs(state) {\n var curr,\n tokens_meta = state.tokens_meta,\n max = state.tokens_meta.length;\n\n processDelimiters(state, state.delimiters);\n\n for (curr = 0; curr < max; curr++) {\n if (tokens_meta[curr] && tokens_meta[curr].delimiters) {\n processDelimiters(state, tokens_meta[curr].delimiters);\n }\n }\n};\n", "// Clean up tokens after emphasis and strikethrough postprocessing:\n// merge adjacent text nodes into one and re-calculate all token levels\n//\n// This is necessary because initially emphasis delimiter markers (*, _, ~)\n// are treated as their own separate text tokens. Then emphasis rule either\n// leaves them as text (needed to merge with adjacent text) or turns them\n// into opening/closing tags (which messes up levels inside).\n//\n'use strict';\n\n\nmodule.exports = function text_collapse(state) {\n var curr, last,\n level = 0,\n tokens = state.tokens,\n max = state.tokens.length;\n\n for (curr = last = 0; curr < max; curr++) {\n // re-calculate levels after emphasis/strikethrough turns some text nodes\n // into opening/closing tags\n if (tokens[curr].nesting < 0) level--; // closing tag\n tokens[curr].level = level;\n if (tokens[curr].nesting > 0) level++; // opening tag\n\n if (tokens[curr].type === 'text' &&\n curr + 1 < max &&\n tokens[curr + 1].type === 'text') {\n\n // collapse two adjacent text nodes\n tokens[curr + 1].content = tokens[curr].content + tokens[curr + 1].content;\n } else {\n if (curr !== last) { tokens[last] = tokens[curr]; }\n\n last++;\n }\n }\n\n if (curr !== last) {\n tokens.length = last;\n }\n};\n", "// Inline parser state\n\n'use strict';\n\n\nvar Token = require('../token');\nvar isWhiteSpace = require('../common/utils').isWhiteSpace;\nvar isPunctChar = require('../common/utils').isPunctChar;\nvar isMdAsciiPunct = require('../common/utils').isMdAsciiPunct;\n\n\nfunction StateInline(src, md, env, outTokens) {\n this.src = src;\n this.env = env;\n this.md = md;\n this.tokens = outTokens;\n this.tokens_meta = Array(outTokens.length);\n\n this.pos = 0;\n this.posMax = this.src.length;\n this.level = 0;\n this.pending = '';\n this.pendingLevel = 0;\n\n // Stores { start: end } pairs. Useful for backtrack\n // optimization of pairs parse (emphasis, strikes).\n this.cache = {};\n\n // List of emphasis-like delimiters for current tag\n this.delimiters = [];\n\n // Stack of delimiter lists for upper level tags\n this._prev_delimiters = [];\n\n // backtick length => last seen position\n this.backticks = {};\n this.backticksScanned = false;\n}\n\n\n// Flush pending text\n//\nStateInline.prototype.pushPending = function () {\n var token = new Token('text', '', 0);\n token.content = this.pending;\n token.level = this.pendingLevel;\n this.tokens.push(token);\n this.pending = '';\n return token;\n};\n\n\n// Push new token to \"stream\".\n// If pending text exists - flush it as text token\n//\nStateInline.prototype.push = function (type, tag, nesting) {\n if (this.pending) {\n this.pushPending();\n }\n\n var token = new Token(type, tag, nesting);\n var token_meta = null;\n\n if (nesting < 0) {\n // closing tag\n this.level--;\n this.delimiters = this._prev_delimiters.pop();\n }\n\n token.level = this.level;\n\n if (nesting > 0) {\n // opening tag\n this.level++;\n this._prev_delimiters.push(this.delimiters);\n this.delimiters = [];\n token_meta = { delimiters: this.delimiters };\n }\n\n this.pendingLevel = this.level;\n this.tokens.push(token);\n this.tokens_meta.push(token_meta);\n return token;\n};\n\n\n// Scan a sequence of emphasis-like markers, and determine whether\n// it can start an emphasis sequence or end an emphasis sequence.\n//\n// - start - position to scan from (it should point at a valid marker);\n// - canSplitWord - determine if these markers can be found inside a word\n//\nStateInline.prototype.scanDelims = function (start, canSplitWord) {\n var pos = start, lastChar, nextChar, count, can_open, can_close,\n isLastWhiteSpace, isLastPunctChar,\n isNextWhiteSpace, isNextPunctChar,\n left_flanking = true,\n right_flanking = true,\n max = this.posMax,\n marker = this.src.charCodeAt(start);\n\n // treat beginning of the line as a whitespace\n lastChar = start > 0 ? this.src.charCodeAt(start - 1) : 0x20;\n\n while (pos < max && this.src.charCodeAt(pos) === marker) { pos++; }\n\n count = pos - start;\n\n // treat end of the line as a whitespace\n nextChar = pos < max ? this.src.charCodeAt(pos) : 0x20;\n\n isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar));\n isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar));\n\n isLastWhiteSpace = isWhiteSpace(lastChar);\n isNextWhiteSpace = isWhiteSpace(nextChar);\n\n if (isNextWhiteSpace) {\n left_flanking = false;\n } else if (isNextPunctChar) {\n if (!(isLastWhiteSpace || isLastPunctChar)) {\n left_flanking = false;\n }\n }\n\n if (isLastWhiteSpace) {\n right_flanking = false;\n } else if (isLastPunctChar) {\n if (!(isNextWhiteSpace || isNextPunctChar)) {\n right_flanking = false;\n }\n }\n\n if (!canSplitWord) {\n can_open = left_flanking && (!right_flanking || isLastPunctChar);\n can_close = right_flanking && (!left_flanking || isNextPunctChar);\n } else {\n can_open = left_flanking;\n can_close = right_flanking;\n }\n\n return {\n can_open: can_open,\n can_close: can_close,\n length: count\n };\n};\n\n\n// re-export Token class to use in block rules\nStateInline.prototype.Token = Token;\n\n\nmodule.exports = StateInline;\n", "/** internal\n * class ParserInline\n *\n * Tokenizes paragraph content.\n **/\n'use strict';\n\n\nvar Ruler = require('./ruler');\n\n\n////////////////////////////////////////////////////////////////////////////////\n// Parser rules\n\nvar _rules = [\n [ 'text', require('./rules_inline/text') ],\n [ 'newline', require('./rules_inline/newline') ],\n [ 'escape', require('./rules_inline/escape') ],\n [ 'backticks', require('./rules_inline/backticks') ],\n [ 'strikethrough', require('./rules_inline/strikethrough').tokenize ],\n [ 'emphasis', require('./rules_inline/emphasis').tokenize ],\n [ 'link', require('./rules_inline/link') ],\n [ 'image', require('./rules_inline/image') ],\n [ 'autolink', require('./rules_inline/autolink') ],\n [ 'html_inline', require('./rules_inline/html_inline') ],\n [ 'entity', require('./rules_inline/entity') ]\n];\n\nvar _rules2 = [\n [ 'balance_pairs', require('./rules_inline/balance_pairs') ],\n [ 'strikethrough', require('./rules_inline/strikethrough').postProcess ],\n [ 'emphasis', require('./rules_inline/emphasis').postProcess ],\n [ 'text_collapse', require('./rules_inline/text_collapse') ]\n];\n\n\n/**\n * new ParserInline()\n **/\nfunction ParserInline() {\n var i;\n\n /**\n * ParserInline#ruler -> Ruler\n *\n * [[Ruler]] instance. Keep configuration of inline rules.\n **/\n this.ruler = new Ruler();\n\n for (i = 0; i < _rules.length; i++) {\n this.ruler.push(_rules[i][0], _rules[i][1]);\n }\n\n /**\n * ParserInline#ruler2 -> Ruler\n *\n * [[Ruler]] instance. Second ruler used for post-processing\n * (e.g. in emphasis-like rules).\n **/\n this.ruler2 = new Ruler();\n\n for (i = 0; i < _rules2.length; i++) {\n this.ruler2.push(_rules2[i][0], _rules2[i][1]);\n }\n}\n\n\n// Skip single token by running all rules in validation mode;\n// returns `true` if any rule reported success\n//\nParserInline.prototype.skipToken = function (state) {\n var ok, i, pos = state.pos,\n rules = this.ruler.getRules(''),\n len = rules.length,\n maxNesting = state.md.options.maxNesting,\n cache = state.cache;\n\n\n if (typeof cache[pos] !== 'undefined') {\n state.pos = cache[pos];\n return;\n }\n\n if (state.level < maxNesting) {\n for (i = 0; i < len; i++) {\n // Increment state.level and decrement it later to limit recursion.\n // It's harmless to do here, because no tokens are created. But ideally,\n // we'd need a separate private state variable for this purpose.\n //\n state.level++;\n ok = rules[i](state, true);\n state.level--;\n\n if (ok) { break; }\n }\n } else {\n // Too much nesting, just skip until the end of the paragraph.\n //\n // NOTE: this will cause links to behave incorrectly in the following case,\n // when an amount of `[` is exactly equal to `maxNesting + 1`:\n //\n // [[[[[[[[[[[[[[[[[[[[[foo]()\n //\n // TODO: remove this workaround when CM standard will allow nested links\n // (we can replace it by preventing links from being parsed in\n // validation mode)\n //\n state.pos = state.posMax;\n }\n\n if (!ok) { state.pos++; }\n cache[pos] = state.pos;\n};\n\n\n// Generate tokens for input range\n//\nParserInline.prototype.tokenize = function (state) {\n var ok, i,\n rules = this.ruler.getRules(''),\n len = rules.length,\n end = state.posMax,\n maxNesting = state.md.options.maxNesting;\n\n while (state.pos < end) {\n // Try all possible rules.\n // On success, rule should:\n //\n // - update `state.pos`\n // - update `state.tokens`\n // - return true\n\n if (state.level < maxNesting) {\n for (i = 0; i < len; i++) {\n ok = rules[i](state, false);\n if (ok) { break; }\n }\n }\n\n if (ok) {\n if (state.pos >= end) { break; }\n continue;\n }\n\n state.pending += state.src[state.pos++];\n }\n\n if (state.pending) {\n state.pushPending();\n }\n};\n\n\n/**\n * ParserInline.parse(str, md, env, outTokens)\n *\n * Process input string and push inline tokens into `outTokens`\n **/\nParserInline.prototype.parse = function (str, md, env, outTokens) {\n var i, rules, len;\n var state = new this.State(str, md, env, outTokens);\n\n this.tokenize(state);\n\n rules = this.ruler2.getRules('');\n len = rules.length;\n\n for (i = 0; i < len; i++) {\n rules[i](state);\n }\n};\n\n\nParserInline.prototype.State = require('./rules_inline/state_inline');\n\n\nmodule.exports = ParserInline;\n", "'use strict';\n\n\nmodule.exports = function (opts) {\n var re = {};\n\n // Use direct extract instead of `regenerate` to reduse browserified size\n re.src_Any = require('uc.micro/properties/Any/regex').source;\n re.src_Cc = require('uc.micro/categories/Cc/regex').source;\n re.src_Z = require('uc.micro/categories/Z/regex').source;\n re.src_P = require('uc.micro/categories/P/regex').source;\n\n // \\p{\\Z\\P\\Cc\\CF} (white spaces + control + format + punctuation)\n re.src_ZPCc = [ re.src_Z, re.src_P, re.src_Cc ].join('|');\n\n // \\p{\\Z\\Cc} (white spaces + control)\n re.src_ZCc = [ re.src_Z, re.src_Cc ].join('|');\n\n // Experimental. List of chars, completely prohibited in links\n // because can separate it from other part of text\n var text_separators = '[><\\uff5c]';\n\n // All possible word characters (everything without punctuation, spaces & controls)\n // Defined via punctuation & spaces to save space\n // Should be something like \\p{\\L\\N\\S\\M} (\\w but without `_`)\n re.src_pseudo_letter = '(?:(?!' + text_separators + '|' + re.src_ZPCc + ')' + re.src_Any + ')';\n // The same as abothe but without [0-9]\n // var src_pseudo_letter_non_d = '(?:(?![0-9]|' + src_ZPCc + ')' + src_Any + ')';\n\n ////////////////////////////////////////////////////////////////////////////////\n\n re.src_ip4 =\n\n '(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)';\n\n // Prohibit any of \"@/[]()\" in user/pass to avoid wrong domain fetch.\n re.src_auth = '(?:(?:(?!' + re.src_ZCc + '|[@/\\\\[\\\\]()]).)+@)?';\n\n re.src_port =\n\n '(?::(?:6(?:[0-4]\\\\d{3}|5(?:[0-4]\\\\d{2}|5(?:[0-2]\\\\d|3[0-5])))|[1-5]?\\\\d{1,4}))?';\n\n re.src_host_terminator =\n\n '(?=$|' + text_separators + '|' + re.src_ZPCc + ')(?!-|_|:\\\\d|\\\\.-|\\\\.(?!$|' + re.src_ZPCc + '))';\n\n re.src_path =\n\n '(?:' +\n '[/?#]' +\n '(?:' +\n '(?!' + re.src_ZCc + '|' + text_separators + '|[()[\\\\]{}.,\"\\'?!\\\\-;]).|' +\n '\\\\[(?:(?!' + re.src_ZCc + '|\\\\]).)*\\\\]|' +\n '\\\\((?:(?!' + re.src_ZCc + '|[)]).)*\\\\)|' +\n '\\\\{(?:(?!' + re.src_ZCc + '|[}]).)*\\\\}|' +\n '\\\\\"(?:(?!' + re.src_ZCc + '|[\"]).)+\\\\\"|' +\n \"\\\\'(?:(?!\" + re.src_ZCc + \"|[']).)+\\\\'|\" +\n \"\\\\'(?=\" + re.src_pseudo_letter + '|[-]).|' + // allow `I'm_king` if no pair found\n '\\\\.{2,}[a-zA-Z0-9%/&]|' + // google has many dots in \"google search\" links (#66, #81).\n // github has ... in commit range links,\n // Restrict to\n // - english\n // - percent-encoded\n // - parts of file path\n // - params separator\n // until more examples found.\n '\\\\.(?!' + re.src_ZCc + '|[.]).|' +\n (opts && opts['---'] ?\n '\\\\-(?!--(?:[^-]|$))(?:-*)|' // `---` => long dash, terminate\n :\n '\\\\-+|'\n ) +\n ',(?!' + re.src_ZCc + ').|' + // allow `,,,` in paths\n ';(?!' + re.src_ZCc + ').|' + // allow `;` if not followed by space-like char\n '\\\\!+(?!' + re.src_ZCc + '|[!]).|' + // allow `!!!` in paths, but not at the end\n '\\\\?(?!' + re.src_ZCc + '|[?]).' +\n ')+' +\n '|\\\\/' +\n ')?';\n\n // Allow anything in markdown spec, forbid quote (\") at the first position\n // because emails enclosed in quotes are far more common\n re.src_email_name =\n\n '[\\\\-;:&=\\\\+\\\\$,\\\\.a-zA-Z0-9_][\\\\-;:&=\\\\+\\\\$,\\\\\"\\\\.a-zA-Z0-9_]*';\n\n re.src_xn =\n\n 'xn--[a-z0-9\\\\-]{1,59}';\n\n // More to read about domain names\n // http://serverfault.com/questions/638260/\n\n re.src_domain_root =\n\n // Allow letters & digits (http://test1)\n '(?:' +\n re.src_xn +\n '|' +\n re.src_pseudo_letter + '{1,63}' +\n ')';\n\n re.src_domain =\n\n '(?:' +\n re.src_xn +\n '|' +\n '(?:' + re.src_pseudo_letter + ')' +\n '|' +\n '(?:' + re.src_pseudo_letter + '(?:-|' + re.src_pseudo_letter + '){0,61}' + re.src_pseudo_letter + ')' +\n ')';\n\n re.src_host =\n\n '(?:' +\n // Don't need IP check, because digits are already allowed in normal domain names\n // src_ip4 +\n // '|' +\n '(?:(?:(?:' + re.src_domain + ')\\\\.)*' + re.src_domain/*_root*/ + ')' +\n ')';\n\n re.tpl_host_fuzzy =\n\n '(?:' +\n re.src_ip4 +\n '|' +\n '(?:(?:(?:' + re.src_domain + ')\\\\.)+(?:%TLDS%))' +\n ')';\n\n re.tpl_host_no_ip_fuzzy =\n\n '(?:(?:(?:' + re.src_domain + ')\\\\.)+(?:%TLDS%))';\n\n re.src_host_strict =\n\n re.src_host + re.src_host_terminator;\n\n re.tpl_host_fuzzy_strict =\n\n re.tpl_host_fuzzy + re.src_host_terminator;\n\n re.src_host_port_strict =\n\n re.src_host + re.src_port + re.src_host_terminator;\n\n re.tpl_host_port_fuzzy_strict =\n\n re.tpl_host_fuzzy + re.src_port + re.src_host_terminator;\n\n re.tpl_host_port_no_ip_fuzzy_strict =\n\n re.tpl_host_no_ip_fuzzy + re.src_port + re.src_host_terminator;\n\n\n ////////////////////////////////////////////////////////////////////////////////\n // Main rules\n\n // Rude test fuzzy links by host, for quick deny\n re.tpl_host_fuzzy_test =\n\n 'localhost|www\\\\.|\\\\.\\\\d{1,3}\\\\.|(?:\\\\.(?:%TLDS%)(?:' + re.src_ZPCc + '|>|$))';\n\n re.tpl_email_fuzzy =\n\n '(^|' + text_separators + '|\"|\\\\(|' + re.src_ZCc + ')' +\n '(' + re.src_email_name + '@' + re.tpl_host_fuzzy_strict + ')';\n\n re.tpl_link_fuzzy =\n // Fuzzy link can't be prepended with .:/\\- and non punctuation.\n // but can start with > (markdown blockquote)\n '(^|(?![.:/\\\\-_@])(?:[$+<=>^`|\\uff5c]|' + re.src_ZPCc + '))' +\n '((?![$+<=>^`|\\uff5c])' + re.tpl_host_port_fuzzy_strict + re.src_path + ')';\n\n re.tpl_link_no_ip_fuzzy =\n // Fuzzy link can't be prepended with .:/\\- and non punctuation.\n // but can start with > (markdown blockquote)\n '(^|(?![.:/\\\\-_@])(?:[$+<=>^`|\\uff5c]|' + re.src_ZPCc + '))' +\n '((?![$+<=>^`|\\uff5c])' + re.tpl_host_port_no_ip_fuzzy_strict + re.src_path + ')';\n\n return re;\n};\n", "'use strict';\n\n\n////////////////////////////////////////////////////////////////////////////////\n// Helpers\n\n// Merge objects\n//\nfunction assign(obj /*from1, from2, from3, ...*/) {\n var sources = Array.prototype.slice.call(arguments, 1);\n\n sources.forEach(function (source) {\n if (!source) { return; }\n\n Object.keys(source).forEach(function (key) {\n obj[key] = source[key];\n });\n });\n\n return obj;\n}\n\nfunction _class(obj) { return Object.prototype.toString.call(obj); }\nfunction isString(obj) { return _class(obj) === '[object String]'; }\nfunction isObject(obj) { return _class(obj) === '[object Object]'; }\nfunction isRegExp(obj) { return _class(obj) === '[object RegExp]'; }\nfunction isFunction(obj) { return _class(obj) === '[object Function]'; }\n\n\nfunction escapeRE(str) { return str.replace(/[.?*+^$[\\]\\\\(){}|-]/g, '\\\\$&'); }\n\n////////////////////////////////////////////////////////////////////////////////\n\n\nvar defaultOptions = {\n fuzzyLink: true,\n fuzzyEmail: true,\n fuzzyIP: false\n};\n\n\nfunction isOptionsObj(obj) {\n return Object.keys(obj || {}).reduce(function (acc, k) {\n return acc || defaultOptions.hasOwnProperty(k);\n }, false);\n}\n\n\nvar defaultSchemas = {\n 'http:': {\n validate: function (text, pos, self) {\n var tail = text.slice(pos);\n\n if (!self.re.http) {\n // compile lazily, because \"host\"-containing variables can change on tlds update.\n self.re.http = new RegExp(\n '^\\\\/\\\\/' + self.re.src_auth + self.re.src_host_port_strict + self.re.src_path, 'i'\n );\n }\n if (self.re.http.test(tail)) {\n return tail.match(self.re.http)[0].length;\n }\n return 0;\n }\n },\n 'https:': 'http:',\n 'ftp:': 'http:',\n '//': {\n validate: function (text, pos, self) {\n var tail = text.slice(pos);\n\n if (!self.re.no_http) {\n // compile lazily, because \"host\"-containing variables can change on tlds update.\n self.re.no_http = new RegExp(\n '^' +\n self.re.src_auth +\n // Don't allow single-level domains, because of false positives like '//test'\n // with code comments\n '(?:localhost|(?:(?:' + self.re.src_domain + ')\\\\.)+' + self.re.src_domain_root + ')' +\n self.re.src_port +\n self.re.src_host_terminator +\n self.re.src_path,\n\n 'i'\n );\n }\n\n if (self.re.no_http.test(tail)) {\n // should not be `://` & `///`, that protects from errors in protocol name\n if (pos >= 3 && text[pos - 3] === ':') { return 0; }\n if (pos >= 3 && text[pos - 3] === '/') { return 0; }\n return tail.match(self.re.no_http)[0].length;\n }\n return 0;\n }\n },\n 'mailto:': {\n validate: function (text, pos, self) {\n var tail = text.slice(pos);\n\n if (!self.re.mailto) {\n self.re.mailto = new RegExp(\n '^' + self.re.src_email_name + '@' + self.re.src_host_strict, 'i'\n );\n }\n if (self.re.mailto.test(tail)) {\n return tail.match(self.re.mailto)[0].length;\n }\n return 0;\n }\n }\n};\n\n/*eslint-disable max-len*/\n\n// RE pattern for 2-character tlds (autogenerated by ./support/tlds_2char_gen.js)\nvar tlds_2ch_src_re = 'a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]';\n\n// DON'T try to make PRs with changes. Extend TLDs with LinkifyIt.tlds() instead\nvar tlds_default = 'biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|\u0440\u0444'.split('|');\n\n/*eslint-enable max-len*/\n\n////////////////////////////////////////////////////////////////////////////////\n\nfunction resetScanCache(self) {\n self.__index__ = -1;\n self.__text_cache__ = '';\n}\n\nfunction createValidator(re) {\n return function (text, pos) {\n var tail = text.slice(pos);\n\n if (re.test(tail)) {\n return tail.match(re)[0].length;\n }\n return 0;\n };\n}\n\nfunction createNormalizer() {\n return function (match, self) {\n self.normalize(match);\n };\n}\n\n// Schemas compiler. Build regexps.\n//\nfunction compile(self) {\n\n // Load & clone RE patterns.\n var re = self.re = require('./lib/re')(self.__opts__);\n\n // Define dynamic patterns\n var tlds = self.__tlds__.slice();\n\n self.onCompile();\n\n if (!self.__tlds_replaced__) {\n tlds.push(tlds_2ch_src_re);\n }\n tlds.push(re.src_xn);\n\n re.src_tlds = tlds.join('|');\n\n function untpl(tpl) { return tpl.replace('%TLDS%', re.src_tlds); }\n\n re.email_fuzzy = RegExp(untpl(re.tpl_email_fuzzy), 'i');\n re.link_fuzzy = RegExp(untpl(re.tpl_link_fuzzy), 'i');\n re.link_no_ip_fuzzy = RegExp(untpl(re.tpl_link_no_ip_fuzzy), 'i');\n re.host_fuzzy_test = RegExp(untpl(re.tpl_host_fuzzy_test), 'i');\n\n //\n // Compile each schema\n //\n\n var aliases = [];\n\n self.__compiled__ = {}; // Reset compiled data\n\n function schemaError(name, val) {\n throw new Error('(LinkifyIt) Invalid schema \"' + name + '\": ' + val);\n }\n\n Object.keys(self.__schemas__).forEach(function (name) {\n var val = self.__schemas__[name];\n\n // skip disabled methods\n if (val === null) { return; }\n\n var compiled = { validate: null, link: null };\n\n self.__compiled__[name] = compiled;\n\n if (isObject(val)) {\n if (isRegExp(val.validate)) {\n compiled.validate = createValidator(val.validate);\n } else if (isFunction(val.validate)) {\n compiled.validate = val.validate;\n } else {\n schemaError(name, val);\n }\n\n if (isFunction(val.normalize)) {\n compiled.normalize = val.normalize;\n } else if (!val.normalize) {\n compiled.normalize = createNormalizer();\n } else {\n schemaError(name, val);\n }\n\n return;\n }\n\n if (isString(val)) {\n aliases.push(name);\n return;\n }\n\n schemaError(name, val);\n });\n\n //\n // Compile postponed aliases\n //\n\n aliases.forEach(function (alias) {\n if (!self.__compiled__[self.__schemas__[alias]]) {\n // Silently fail on missed schemas to avoid errons on disable.\n // schemaError(alias, self.__schemas__[alias]);\n return;\n }\n\n self.__compiled__[alias].validate =\n self.__compiled__[self.__schemas__[alias]].validate;\n self.__compiled__[alias].normalize =\n self.__compiled__[self.__schemas__[alias]].normalize;\n });\n\n //\n // Fake record for guessed links\n //\n self.__compiled__[''] = { validate: null, normalize: createNormalizer() };\n\n //\n // Build schema condition\n //\n var slist = Object.keys(self.__compiled__)\n .filter(function (name) {\n // Filter disabled & fake schemas\n return name.length > 0 && self.__compiled__[name];\n })\n .map(escapeRE)\n .join('|');\n // (?!_) cause 1.5x slowdown\n self.re.schema_test = RegExp('(^|(?!_)(?:[><\\uff5c]|' + re.src_ZPCc + '))(' + slist + ')', 'i');\n self.re.schema_search = RegExp('(^|(?!_)(?:[><\\uff5c]|' + re.src_ZPCc + '))(' + slist + ')', 'ig');\n\n self.re.pretest = RegExp(\n '(' + self.re.schema_test.source + ')|(' + self.re.host_fuzzy_test.source + ')|@',\n 'i'\n );\n\n //\n // Cleanup\n //\n\n resetScanCache(self);\n}\n\n/**\n * class Match\n *\n * Match result. Single element of array, returned by [[LinkifyIt#match]]\n **/\nfunction Match(self, shift) {\n var start = self.__index__,\n end = self.__last_index__,\n text = self.__text_cache__.slice(start, end);\n\n /**\n * Match#schema -> String\n *\n * Prefix (protocol) for matched string.\n **/\n this.schema = self.__schema__.toLowerCase();\n /**\n * Match#index -> Number\n *\n * First position of matched string.\n **/\n this.index = start + shift;\n /**\n * Match#lastIndex -> Number\n *\n * Next position after matched string.\n **/\n this.lastIndex = end + shift;\n /**\n * Match#raw -> String\n *\n * Matched string.\n **/\n this.raw = text;\n /**\n * Match#text -> String\n *\n * Notmalized text of matched string.\n **/\n this.text = text;\n /**\n * Match#url -> String\n *\n * Normalized url of matched string.\n **/\n this.url = text;\n}\n\nfunction createMatch(self, shift) {\n var match = new Match(self, shift);\n\n self.__compiled__[match.schema].normalize(match, self);\n\n return match;\n}\n\n\n/**\n * class LinkifyIt\n **/\n\n/**\n * new LinkifyIt(schemas, options)\n * - schemas (Object): Optional. Additional schemas to validate (prefix/validator)\n * - options (Object): { fuzzyLink|fuzzyEmail|fuzzyIP: true|false }\n *\n * Creates new linkifier instance with optional additional schemas.\n * Can be called without `new` keyword for convenience.\n *\n * By default understands:\n *\n * - `http(s)://...` , `ftp://...`, `mailto:...` & `//...` links\n * - \"fuzzy\" links and emails (example.com, foo@bar.com).\n *\n * `schemas` is an object, where each key/value describes protocol/rule:\n *\n * - __key__ - link prefix (usually, protocol name with `:` at the end, `skype:`\n * for example). `linkify-it` makes shure that prefix is not preceeded with\n * alphanumeric char and symbols. Only whitespaces and punctuation allowed.\n * - __value__ - rule to check tail after link prefix\n * - _String_ - just alias to existing rule\n * - _Object_\n * - _validate_ - validator function (should return matched length on success),\n * or `RegExp`.\n * - _normalize_ - optional function to normalize text & url of matched result\n * (for example, for @twitter mentions).\n *\n * `options`:\n *\n * - __fuzzyLink__ - recognige URL-s without `http(s):` prefix. Default `true`.\n * - __fuzzyIP__ - allow IPs in fuzzy links above. Can conflict with some texts\n * like version numbers. Default `false`.\n * - __fuzzyEmail__ - recognize emails without `mailto:` prefix.\n *\n **/\nfunction LinkifyIt(schemas, options) {\n if (!(this instanceof LinkifyIt)) {\n return new LinkifyIt(schemas, options);\n }\n\n if (!options) {\n if (isOptionsObj(schemas)) {\n options = schemas;\n schemas = {};\n }\n }\n\n this.__opts__ = assign({}, defaultOptions, options);\n\n // Cache last tested result. Used to skip repeating steps on next `match` call.\n this.__index__ = -1;\n this.__last_index__ = -1; // Next scan position\n this.__schema__ = '';\n this.__text_cache__ = '';\n\n this.__schemas__ = assign({}, defaultSchemas, schemas);\n this.__compiled__ = {};\n\n this.__tlds__ = tlds_default;\n this.__tlds_replaced__ = false;\n\n this.re = {};\n\n compile(this);\n}\n\n\n/** chainable\n * LinkifyIt#add(schema, definition)\n * - schema (String): rule name (fixed pattern prefix)\n * - definition (String|RegExp|Object): schema definition\n *\n * Add new rule definition. See constructor description for details.\n **/\nLinkifyIt.prototype.add = function add(schema, definition) {\n this.__schemas__[schema] = definition;\n compile(this);\n return this;\n};\n\n\n/** chainable\n * LinkifyIt#set(options)\n * - options (Object): { fuzzyLink|fuzzyEmail|fuzzyIP: true|false }\n *\n * Set recognition options for links without schema.\n **/\nLinkifyIt.prototype.set = function set(options) {\n this.__opts__ = assign(this.__opts__, options);\n return this;\n};\n\n\n/**\n * LinkifyIt#test(text) -> Boolean\n *\n * Searches linkifiable pattern and returns `true` on success or `false` on fail.\n **/\nLinkifyIt.prototype.test = function test(text) {\n // Reset scan cache\n this.__text_cache__ = text;\n this.__index__ = -1;\n\n if (!text.length) { return false; }\n\n var m, ml, me, len, shift, next, re, tld_pos, at_pos;\n\n // try to scan for link with schema - that's the most simple rule\n if (this.re.schema_test.test(text)) {\n re = this.re.schema_search;\n re.lastIndex = 0;\n while ((m = re.exec(text)) !== null) {\n len = this.testSchemaAt(text, m[2], re.lastIndex);\n if (len) {\n this.__schema__ = m[2];\n this.__index__ = m.index + m[1].length;\n this.__last_index__ = m.index + m[0].length + len;\n break;\n }\n }\n }\n\n if (this.__opts__.fuzzyLink && this.__compiled__['http:']) {\n // guess schemaless links\n tld_pos = text.search(this.re.host_fuzzy_test);\n if (tld_pos >= 0) {\n // if tld is located after found link - no need to check fuzzy pattern\n if (this.__index__ < 0 || tld_pos < this.__index__) {\n if ((ml = text.match(this.__opts__.fuzzyIP ? this.re.link_fuzzy : this.re.link_no_ip_fuzzy)) !== null) {\n\n shift = ml.index + ml[1].length;\n\n if (this.__index__ < 0 || shift < this.__index__) {\n this.__schema__ = '';\n this.__index__ = shift;\n this.__last_index__ = ml.index + ml[0].length;\n }\n }\n }\n }\n }\n\n if (this.__opts__.fuzzyEmail && this.__compiled__['mailto:']) {\n // guess schemaless emails\n at_pos = text.indexOf('@');\n if (at_pos >= 0) {\n // We can't skip this check, because this cases are possible:\n // 192.168.1.1@gmail.com, my.in@example.com\n if ((me = text.match(this.re.email_fuzzy)) !== null) {\n\n shift = me.index + me[1].length;\n next = me.index + me[0].length;\n\n if (this.__index__ < 0 || shift < this.__index__ ||\n (shift === this.__index__ && next > this.__last_index__)) {\n this.__schema__ = 'mailto:';\n this.__index__ = shift;\n this.__last_index__ = next;\n }\n }\n }\n }\n\n return this.__index__ >= 0;\n};\n\n\n/**\n * LinkifyIt#pretest(text) -> Boolean\n *\n * Very quick check, that can give false positives. Returns true if link MAY BE\n * can exists. Can be used for speed optimization, when you need to check that\n * link NOT exists.\n **/\nLinkifyIt.prototype.pretest = function pretest(text) {\n return this.re.pretest.test(text);\n};\n\n\n/**\n * LinkifyIt#testSchemaAt(text, name, position) -> Number\n * - text (String): text to scan\n * - name (String): rule (schema) name\n * - position (Number): text offset to check from\n *\n * Similar to [[LinkifyIt#test]] but checks only specific protocol tail exactly\n * at given position. Returns length of found pattern (0 on fail).\n **/\nLinkifyIt.prototype.testSchemaAt = function testSchemaAt(text, schema, pos) {\n // If not supported schema check requested - terminate\n if (!this.__compiled__[schema.toLowerCase()]) {\n return 0;\n }\n return this.__compiled__[schema.toLowerCase()].validate(text, pos, this);\n};\n\n\n/**\n * LinkifyIt#match(text) -> Array|null\n *\n * Returns array of found link descriptions or `null` on fail. We strongly\n * recommend to use [[LinkifyIt#test]] first, for best speed.\n *\n * ##### Result match description\n *\n * - __schema__ - link schema, can be empty for fuzzy links, or `//` for\n * protocol-neutral links.\n * - __index__ - offset of matched text\n * - __lastIndex__ - index of next char after mathch end\n * - __raw__ - matched text\n * - __text__ - normalized text\n * - __url__ - link, generated from matched text\n **/\nLinkifyIt.prototype.match = function match(text) {\n var shift = 0, result = [];\n\n // Try to take previous element from cache, if .test() called before\n if (this.__index__ >= 0 && this.__text_cache__ === text) {\n result.push(createMatch(this, shift));\n shift = this.__last_index__;\n }\n\n // Cut head if cache was used\n var tail = shift ? text.slice(shift) : text;\n\n // Scan string until end reached\n while (this.test(tail)) {\n result.push(createMatch(this, shift));\n\n tail = tail.slice(this.__last_index__);\n shift += this.__last_index__;\n }\n\n if (result.length) {\n return result;\n }\n\n return null;\n};\n\n\n/** chainable\n * LinkifyIt#tlds(list [, keepOld]) -> this\n * - list (Array): list of tlds\n * - keepOld (Boolean): merge with current list if `true` (`false` by default)\n *\n * Load (or merge) new tlds list. Those are user for fuzzy links (without prefix)\n * to avoid false positives. By default this algorythm used:\n *\n * - hostname with any 2-letter root zones are ok.\n * - biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|\u0440\u0444\n * are ok.\n * - encoded (`xn--...`) root zones are ok.\n *\n * If list is replaced, then exact match for 2-chars root zones will be checked.\n **/\nLinkifyIt.prototype.tlds = function tlds(list, keepOld) {\n list = Array.isArray(list) ? list : [ list ];\n\n if (!keepOld) {\n this.__tlds__ = list.slice();\n this.__tlds_replaced__ = true;\n compile(this);\n return this;\n }\n\n this.__tlds__ = this.__tlds__.concat(list)\n .sort()\n .filter(function (el, idx, arr) {\n return el !== arr[idx - 1];\n })\n .reverse();\n\n compile(this);\n return this;\n};\n\n/**\n * LinkifyIt#normalize(match)\n *\n * Default normalizer (if schema does not define it's own).\n **/\nLinkifyIt.prototype.normalize = function normalize(match) {\n\n // Do minimal possible changes by default. Need to collect feedback prior\n // to move forward https://github.com/markdown-it/linkify-it/issues/1\n\n if (!match.schema) { match.url = 'http://' + match.url; }\n\n if (match.schema === 'mailto:' && !/^mailto:/i.test(match.url)) {\n match.url = 'mailto:' + match.url;\n }\n};\n\n\n/**\n * LinkifyIt#onCompile()\n *\n * Override to modify basic RegExp-s.\n **/\nLinkifyIt.prototype.onCompile = function onCompile() {\n};\n\n\nmodule.exports = LinkifyIt;\n", "'use strict';\n\n/** Highest positive signed 32-bit float value */\nconst maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1\n\n/** Bootstring parameters */\nconst base = 36;\nconst tMin = 1;\nconst tMax = 26;\nconst skew = 38;\nconst damp = 700;\nconst initialBias = 72;\nconst initialN = 128; // 0x80\nconst delimiter = '-'; // '\\x2D'\n\n/** Regular expressions */\nconst regexPunycode = /^xn--/;\nconst regexNonASCII = /[^\\0-\\x7E]/; // non-ASCII chars\nconst regexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g; // RFC 3490 separators\n\n/** Error messages */\nconst errors = {\n\t'overflow': 'Overflow: input needs wider integers to process',\n\t'not-basic': 'Illegal input >= 0x80 (not a basic code point)',\n\t'invalid-input': 'Invalid input'\n};\n\n/** Convenience shortcuts */\nconst baseMinusTMin = base - tMin;\nconst floor = Math.floor;\nconst stringFromCharCode = String.fromCharCode;\n\n/*--------------------------------------------------------------------------*/\n\n/**\n * A generic error utility function.\n * @private\n * @param {String} type The error type.\n * @returns {Error} Throws a `RangeError` with the applicable error message.\n */\nfunction error(type) {\n\tthrow new RangeError(errors[type]);\n}\n\n/**\n * A generic `Array#map` utility function.\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} callback The function that gets called for every array\n * item.\n * @returns {Array} A new array of values returned by the callback function.\n */\nfunction map(array, fn) {\n\tconst result = [];\n\tlet length = array.length;\n\twhile (length--) {\n\t\tresult[length] = fn(array[length]);\n\t}\n\treturn result;\n}\n\n/**\n * A simple `Array#map`-like wrapper to work with domain name strings or email\n * addresses.\n * @private\n * @param {String} domain The domain name or email address.\n * @param {Function} callback The function that gets called for every\n * character.\n * @returns {Array} A new string of characters returned by the callback\n * function.\n */\nfunction mapDomain(string, fn) {\n\tconst parts = string.split('@');\n\tlet result = '';\n\tif (parts.length > 1) {\n\t\t// In email addresses, only the domain name should be punycoded. Leave\n\t\t// the local part (i.e. everything up to `@`) intact.\n\t\tresult = parts[0] + '@';\n\t\tstring = parts[1];\n\t}\n\t// Avoid `split(regex)` for IE8 compatibility. See #17.\n\tstring = string.replace(regexSeparators, '\\x2E');\n\tconst labels = string.split('.');\n\tconst encoded = map(labels, fn).join('.');\n\treturn result + encoded;\n}\n\n/**\n * Creates an array containing the numeric code points of each Unicode\n * character in the string. While JavaScript uses UCS-2 internally,\n * this function will convert a pair of surrogate halves (each of which\n * UCS-2 exposes as separate characters) into a single code point,\n * matching UTF-16.\n * @see `punycode.ucs2.encode`\n * @see \n * @memberOf punycode.ucs2\n * @name decode\n * @param {String} string The Unicode input string (UCS-2).\n * @returns {Array} The new array of code points.\n */\nfunction ucs2decode(string) {\n\tconst output = [];\n\tlet counter = 0;\n\tconst length = string.length;\n\twhile (counter < length) {\n\t\tconst value = string.charCodeAt(counter++);\n\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t// It's a high surrogate, and there is a next character.\n\t\t\tconst extra = string.charCodeAt(counter++);\n\t\t\tif ((extra & 0xFC00) == 0xDC00) { // Low surrogate.\n\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t} else {\n\t\t\t\t// It's an unmatched surrogate; only append this code unit, in case the\n\t\t\t\t// next code unit is the high surrogate of a surrogate pair.\n\t\t\t\toutput.push(value);\n\t\t\t\tcounter--;\n\t\t\t}\n\t\t} else {\n\t\t\toutput.push(value);\n\t\t}\n\t}\n\treturn output;\n}\n\n/**\n * Creates a string based on an array of numeric code points.\n * @see `punycode.ucs2.decode`\n * @memberOf punycode.ucs2\n * @name encode\n * @param {Array} codePoints The array of numeric code points.\n * @returns {String} The new Unicode string (UCS-2).\n */\nconst ucs2encode = array => String.fromCodePoint(...array);\n\n/**\n * Converts a basic code point into a digit/integer.\n * @see `digitToBasic()`\n * @private\n * @param {Number} codePoint The basic numeric code point value.\n * @returns {Number} The numeric value of a basic code point (for use in\n * representing integers) in the range `0` to `base - 1`, or `base` if\n * the code point does not represent a value.\n */\nconst basicToDigit = function(codePoint) {\n\tif (codePoint - 0x30 < 0x0A) {\n\t\treturn codePoint - 0x16;\n\t}\n\tif (codePoint - 0x41 < 0x1A) {\n\t\treturn codePoint - 0x41;\n\t}\n\tif (codePoint - 0x61 < 0x1A) {\n\t\treturn codePoint - 0x61;\n\t}\n\treturn base;\n};\n\n/**\n * Converts a digit/integer into a basic code point.\n * @see `basicToDigit()`\n * @private\n * @param {Number} digit The numeric value of a basic code point.\n * @returns {Number} The basic code point whose value (when used for\n * representing integers) is `digit`, which needs to be in the range\n * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is\n * used; else, the lowercase form is used. The behavior is undefined\n * if `flag` is non-zero and `digit` has no uppercase form.\n */\nconst digitToBasic = function(digit, flag) {\n\t// 0..25 map to ASCII a..z or A..Z\n\t// 26..35 map to ASCII 0..9\n\treturn digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);\n};\n\n/**\n * Bias adaptation function as per section 3.4 of RFC 3492.\n * https://tools.ietf.org/html/rfc3492#section-3.4\n * @private\n */\nconst adapt = function(delta, numPoints, firstTime) {\n\tlet k = 0;\n\tdelta = firstTime ? floor(delta / damp) : delta >> 1;\n\tdelta += floor(delta / numPoints);\n\tfor (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {\n\t\tdelta = floor(delta / baseMinusTMin);\n\t}\n\treturn floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n};\n\n/**\n * Converts a Punycode string of ASCII-only symbols to a string of Unicode\n * symbols.\n * @memberOf punycode\n * @param {String} input The Punycode string of ASCII-only symbols.\n * @returns {String} The resulting string of Unicode symbols.\n */\nconst decode = function(input) {\n\t// Don't use UCS-2.\n\tconst output = [];\n\tconst inputLength = input.length;\n\tlet i = 0;\n\tlet n = initialN;\n\tlet bias = initialBias;\n\n\t// Handle the basic code points: let `basic` be the number of input code\n\t// points before the last delimiter, or `0` if there is none, then copy\n\t// the first basic code points to the output.\n\n\tlet basic = input.lastIndexOf(delimiter);\n\tif (basic < 0) {\n\t\tbasic = 0;\n\t}\n\n\tfor (let j = 0; j < basic; ++j) {\n\t\t// if it's not a basic code point\n\t\tif (input.charCodeAt(j) >= 0x80) {\n\t\t\terror('not-basic');\n\t\t}\n\t\toutput.push(input.charCodeAt(j));\n\t}\n\n\t// Main decoding loop: start just after the last delimiter if any basic code\n\t// points were copied; start at the beginning otherwise.\n\n\tfor (let index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {\n\n\t\t// `index` is the index of the next character to be consumed.\n\t\t// Decode a generalized variable-length integer into `delta`,\n\t\t// which gets added to `i`. The overflow checking is easier\n\t\t// if we increase `i` as we go, then subtract off its starting\n\t\t// value at the end to obtain `delta`.\n\t\tlet oldi = i;\n\t\tfor (let w = 1, k = base; /* no condition */; k += base) {\n\n\t\t\tif (index >= inputLength) {\n\t\t\t\terror('invalid-input');\n\t\t\t}\n\n\t\t\tconst digit = basicToDigit(input.charCodeAt(index++));\n\n\t\t\tif (digit >= base || digit > floor((maxInt - i) / w)) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\ti += digit * w;\n\t\t\tconst t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\n\t\t\tif (digit < t) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst baseMinusT = base - t;\n\t\t\tif (w > floor(maxInt / baseMinusT)) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tw *= baseMinusT;\n\n\t\t}\n\n\t\tconst out = output.length + 1;\n\t\tbias = adapt(i - oldi, out, oldi == 0);\n\n\t\t// `i` was supposed to wrap around from `out` to `0`,\n\t\t// incrementing `n` each time, so we'll fix that now:\n\t\tif (floor(i / out) > maxInt - n) {\n\t\t\terror('overflow');\n\t\t}\n\n\t\tn += floor(i / out);\n\t\ti %= out;\n\n\t\t// Insert `n` at position `i` of the output.\n\t\toutput.splice(i++, 0, n);\n\n\t}\n\n\treturn String.fromCodePoint(...output);\n};\n\n/**\n * Converts a string of Unicode symbols (e.g. a domain name label) to a\n * Punycode string of ASCII-only symbols.\n * @memberOf punycode\n * @param {String} input The string of Unicode symbols.\n * @returns {String} The resulting Punycode string of ASCII-only symbols.\n */\nconst encode = function(input) {\n\tconst output = [];\n\n\t// Convert the input in UCS-2 to an array of Unicode code points.\n\tinput = ucs2decode(input);\n\n\t// Cache the length.\n\tlet inputLength = input.length;\n\n\t// Initialize the state.\n\tlet n = initialN;\n\tlet delta = 0;\n\tlet bias = initialBias;\n\n\t// Handle the basic code points.\n\tfor (const currentValue of input) {\n\t\tif (currentValue < 0x80) {\n\t\t\toutput.push(stringFromCharCode(currentValue));\n\t\t}\n\t}\n\n\tlet basicLength = output.length;\n\tlet handledCPCount = basicLength;\n\n\t// `handledCPCount` is the number of code points that have been handled;\n\t// `basicLength` is the number of basic code points.\n\n\t// Finish the basic string with a delimiter unless it's empty.\n\tif (basicLength) {\n\t\toutput.push(delimiter);\n\t}\n\n\t// Main encoding loop:\n\twhile (handledCPCount < inputLength) {\n\n\t\t// All non-basic code points < n have been handled already. Find the next\n\t\t// larger one:\n\t\tlet m = maxInt;\n\t\tfor (const currentValue of input) {\n\t\t\tif (currentValue >= n && currentValue < m) {\n\t\t\t\tm = currentValue;\n\t\t\t}\n\t\t}\n\n\t\t// Increase `delta` enough to advance the decoder's state to ,\n\t\t// but guard against overflow.\n\t\tconst handledCPCountPlusOne = handledCPCount + 1;\n\t\tif (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n\t\t\terror('overflow');\n\t\t}\n\n\t\tdelta += (m - n) * handledCPCountPlusOne;\n\t\tn = m;\n\n\t\tfor (const currentValue of input) {\n\t\t\tif (currentValue < n && ++delta > maxInt) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\t\t\tif (currentValue == n) {\n\t\t\t\t// Represent delta as a generalized variable-length integer.\n\t\t\t\tlet q = delta;\n\t\t\t\tfor (let k = base; /* no condition */; k += base) {\n\t\t\t\t\tconst t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\t\t\t\t\tif (q < t) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tconst qMinusT = q - t;\n\t\t\t\t\tconst baseMinusT = base - t;\n\t\t\t\t\toutput.push(\n\t\t\t\t\t\tstringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))\n\t\t\t\t\t);\n\t\t\t\t\tq = floor(qMinusT / baseMinusT);\n\t\t\t\t}\n\n\t\t\t\toutput.push(stringFromCharCode(digitToBasic(q, 0)));\n\t\t\t\tbias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n\t\t\t\tdelta = 0;\n\t\t\t\t++handledCPCount;\n\t\t\t}\n\t\t}\n\n\t\t++delta;\n\t\t++n;\n\n\t}\n\treturn output.join('');\n};\n\n/**\n * Converts a Punycode string representing a domain name or an email address\n * to Unicode. Only the Punycoded parts of the input will be converted, i.e.\n * it doesn't matter if you call it on a string that has already been\n * converted to Unicode.\n * @memberOf punycode\n * @param {String} input The Punycoded domain name or email address to\n * convert to Unicode.\n * @returns {String} The Unicode representation of the given Punycode\n * string.\n */\nconst toUnicode = function(input) {\n\treturn mapDomain(input, function(string) {\n\t\treturn regexPunycode.test(string)\n\t\t\t? decode(string.slice(4).toLowerCase())\n\t\t\t: string;\n\t});\n};\n\n/**\n * Converts a Unicode string representing a domain name or an email address to\n * Punycode. Only the non-ASCII parts of the domain name will be converted,\n * i.e. it doesn't matter if you call it with a domain that's already in\n * ASCII.\n * @memberOf punycode\n * @param {String} input The domain name or email address to convert, as a\n * Unicode string.\n * @returns {String} The Punycode representation of the given domain name or\n * email address.\n */\nconst toASCII = function(input) {\n\treturn mapDomain(input, function(string) {\n\t\treturn regexNonASCII.test(string)\n\t\t\t? 'xn--' + encode(string)\n\t\t\t: string;\n\t});\n};\n\n/*--------------------------------------------------------------------------*/\n\n/** Define the public API */\nconst punycode = {\n\t/**\n\t * A string representing the current Punycode.js version number.\n\t * @memberOf punycode\n\t * @type String\n\t */\n\t'version': '2.1.0',\n\t/**\n\t * An object of methods to convert from JavaScript's internal character\n\t * representation (UCS-2) to Unicode code points, and back.\n\t * @see \n\t * @memberOf punycode\n\t * @type Object\n\t */\n\t'ucs2': {\n\t\t'decode': ucs2decode,\n\t\t'encode': ucs2encode\n\t},\n\t'decode': decode,\n\t'encode': encode,\n\t'toASCII': toASCII,\n\t'toUnicode': toUnicode\n};\n\nmodule.exports = punycode;\n", "// markdown-it default options\n\n'use strict';\n\n\nmodule.exports = {\n options: {\n html: false, // Enable HTML tags in source\n xhtmlOut: false, // Use '/' to close single tags (
)\n breaks: false, // Convert '\\n' in paragraphs into
\n langPrefix: 'language-', // CSS language prefix for fenced blocks\n linkify: false, // autoconvert URL-like texts to links\n\n // Enable some language-neutral replacements + quotes beautification\n typographer: false,\n\n // Double + single quotes replacement pairs, when typographer enabled,\n // and smartquotes on. Could be either a String or an Array.\n //\n // For example, you can use '\u00AB\u00BB\u201E\u201C' for Russian, '\u201E\u201C\u201A\u2018' for German,\n // and ['\u00AB\\xA0', '\\xA0\u00BB', '\u2039\\xA0', '\\xA0\u203A'] for French (including nbsp).\n quotes: '\\u201c\\u201d\\u2018\\u2019', /* \u201C\u201D\u2018\u2019 */\n\n // Highlighter function. Should return escaped HTML,\n // or '' if the source string is not changed and should be escaped externaly.\n // If result starts with )\n breaks: false, // Convert '\\n' in paragraphs into
\n langPrefix: 'language-', // CSS language prefix for fenced blocks\n linkify: false, // autoconvert URL-like texts to links\n\n // Enable some language-neutral replacements + quotes beautification\n typographer: false,\n\n // Double + single quotes replacement pairs, when typographer enabled,\n // and smartquotes on. Could be either a String or an Array.\n //\n // For example, you can use '\u00AB\u00BB\u201E\u201C' for Russian, '\u201E\u201C\u201A\u2018' for German,\n // and ['\u00AB\\xA0', '\\xA0\u00BB', '\u2039\\xA0', '\\xA0\u203A'] for French (including nbsp).\n quotes: '\\u201c\\u201d\\u2018\\u2019', /* \u201C\u201D\u2018\u2019 */\n\n // Highlighter function. Should return escaped HTML,\n // or '' if the source string is not changed and should be escaped externaly.\n // If result starts with )\n breaks: false, // Convert '\\n' in paragraphs into
\n langPrefix: 'language-', // CSS language prefix for fenced blocks\n linkify: false, // autoconvert URL-like texts to links\n\n // Enable some language-neutral replacements + quotes beautification\n typographer: false,\n\n // Double + single quotes replacement pairs, when typographer enabled,\n // and smartquotes on. Could be either a String or an Array.\n //\n // For example, you can use '\u00AB\u00BB\u201E\u201C' for Russian, '\u201E\u201C\u201A\u2018' for German,\n // and ['\u00AB\\xA0', '\\xA0\u00BB', '\u2039\\xA0', '\\xA0\u203A'] for French (including nbsp).\n quotes: '\\u201c\\u201d\\u2018\\u2019', /* \u201C\u201D\u2018\u2019 */\n\n // Highlighter function. Should return escaped HTML,\n // or '' if the source string is not changed and should be escaped externaly.\n // If result starts with = 0) {\n try {\n parsed.hostname = punycode.toASCII(parsed.hostname);\n } catch (er) { /**/ }\n }\n }\n\n return mdurl.encode(mdurl.format(parsed));\n}\n\nfunction normalizeLinkText(url) {\n var parsed = mdurl.parse(url, true);\n\n if (parsed.hostname) {\n // Encode hostnames in urls like:\n // `http://host/`, `https://host/`, `mailto:user@host`, `//host/`\n //\n // We don't encode unknown schemas, because it's likely that we encode\n // something we shouldn't (e.g. `skype:name` treated as `skype:host`)\n //\n if (!parsed.protocol || RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0) {\n try {\n parsed.hostname = punycode.toUnicode(parsed.hostname);\n } catch (er) { /**/ }\n }\n }\n\n // add '%' to exclude list because of https://github.com/markdown-it/markdown-it/issues/720\n return mdurl.decode(mdurl.format(parsed), mdurl.decode.defaultChars + '%');\n}\n\n\n/**\n * class MarkdownIt\n *\n * Main parser/renderer class.\n *\n * ##### Usage\n *\n * ```javascript\n * // node.js, \"classic\" way:\n * var MarkdownIt = require('markdown-it'),\n * md = new MarkdownIt();\n * var result = md.render('# markdown-it rulezz!');\n *\n * // node.js, the same, but with sugar:\n * var md = require('markdown-it')();\n * var result = md.render('# markdown-it rulezz!');\n *\n * // browser without AMD, added to \"window\" on script load\n * // Note, there are no dash.\n * var md = window.markdownit();\n * var result = md.render('# markdown-it rulezz!');\n * ```\n *\n * Single line rendering, without paragraph wrap:\n *\n * ```javascript\n * var md = require('markdown-it')();\n * var result = md.renderInline('__markdown-it__ rulezz!');\n * ```\n **/\n\n/**\n * new MarkdownIt([presetName, options])\n * - presetName (String): optional, `commonmark` / `zero`\n * - options (Object)\n *\n * Creates parser instanse with given config. Can be called without `new`.\n *\n * ##### presetName\n *\n * MarkdownIt provides named presets as a convenience to quickly\n * enable/disable active syntax rules and options for common use cases.\n *\n * - [\"commonmark\"](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/commonmark.js) -\n * configures parser to strict [CommonMark](http://commonmark.org/) mode.\n * - [default](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/default.js) -\n * similar to GFM, used when no preset name given. Enables all available rules,\n * but still without html, typographer & autolinker.\n * - [\"zero\"](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/zero.js) -\n * all rules disabled. Useful to quickly setup your config via `.enable()`.\n * For example, when you need only `bold` and `italic` markup and nothing else.\n *\n * ##### options:\n *\n * - __html__ - `false`. Set `true` to enable HTML tags in source. Be careful!\n * That's not safe! You may need external sanitizer to protect output from XSS.\n * It's better to extend features via plugins, instead of enabling HTML.\n * - __xhtmlOut__ - `false`. Set `true` to add '/' when closing single tags\n * (`
`). This is needed only for full CommonMark compatibility. In real\n * world you will need HTML output.\n * - __breaks__ - `false`. Set `true` to convert `\\n` in paragraphs into `
`.\n * - __langPrefix__ - `language-`. CSS language class prefix for fenced blocks.\n * Can be useful for external highlighters.\n * - __linkify__ - `false`. Set `true` to autoconvert URL-like text to links.\n * - __typographer__ - `false`. Set `true` to enable [some language-neutral\n * replacement](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/replacements.js) +\n * quotes beautification (smartquotes).\n * - __quotes__ - `\u201C\u201D\u2018\u2019`, String or Array. Double + single quotes replacement\n * pairs, when typographer enabled and smartquotes on. For example, you can\n * use `'\u00AB\u00BB\u201E\u201C'` for Russian, `'\u201E\u201C\u201A\u2018'` for German, and\n * `['\u00AB\\xA0', '\\xA0\u00BB', '\u2039\\xA0', '\\xA0\u203A']` for French (including nbsp).\n * - __highlight__ - `null`. Highlighter function for fenced code blocks.\n * Highlighter `function (str, lang)` should return escaped HTML. It can also\n * return empty string if the source was not changed and should be escaped\n * externaly. If result starts with `):\n *\n * ```javascript\n * var hljs = require('highlight.js') // https://highlightjs.org/\n *\n * // Actual default values\n * var md = require('markdown-it')({\n * highlight: function (str, lang) {\n * if (lang && hljs.getLanguage(lang)) {\n * try {\n * return '
' +\n *                hljs.highlight(str, { language: lang, ignoreIllegals: true }).value +\n *                '
';\n * } catch (__) {}\n * }\n *\n * return '
' + md.utils.escapeHtml(str) + '
';\n * }\n * });\n * ```\n *\n **/\nfunction MarkdownIt(presetName, options) {\n if (!(this instanceof MarkdownIt)) {\n return new MarkdownIt(presetName, options);\n }\n\n if (!options) {\n if (!utils.isString(presetName)) {\n options = presetName || {};\n presetName = 'default';\n }\n }\n\n /**\n * MarkdownIt#inline -> ParserInline\n *\n * Instance of [[ParserInline]]. You may need it to add new rules when\n * writing plugins. For simple rules control use [[MarkdownIt.disable]] and\n * [[MarkdownIt.enable]].\n **/\n this.inline = new ParserInline();\n\n /**\n * MarkdownIt#block -> ParserBlock\n *\n * Instance of [[ParserBlock]]. You may need it to add new rules when\n * writing plugins. For simple rules control use [[MarkdownIt.disable]] and\n * [[MarkdownIt.enable]].\n **/\n this.block = new ParserBlock();\n\n /**\n * MarkdownIt#core -> Core\n *\n * Instance of [[Core]] chain executor. You may need it to add new rules when\n * writing plugins. For simple rules control use [[MarkdownIt.disable]] and\n * [[MarkdownIt.enable]].\n **/\n this.core = new ParserCore();\n\n /**\n * MarkdownIt#renderer -> Renderer\n *\n * Instance of [[Renderer]]. Use it to modify output look. Or to add rendering\n * rules for new token types, generated by plugins.\n *\n * ##### Example\n *\n * ```javascript\n * var md = require('markdown-it')();\n *\n * function myToken(tokens, idx, options, env, self) {\n * //...\n * return result;\n * };\n *\n * md.renderer.rules['my_token'] = myToken\n * ```\n *\n * See [[Renderer]] docs and [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.js).\n **/\n this.renderer = new Renderer();\n\n /**\n * MarkdownIt#linkify -> LinkifyIt\n *\n * [linkify-it](https://github.com/markdown-it/linkify-it) instance.\n * Used by [linkify](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/linkify.js)\n * rule.\n **/\n this.linkify = new LinkifyIt();\n\n /**\n * MarkdownIt#validateLink(url) -> Boolean\n *\n * Link validation function. CommonMark allows too much in links. By default\n * we disable `javascript:`, `vbscript:`, `file:` schemas, and almost all `data:...` schemas\n * except some embedded image types.\n *\n * You can change this behaviour:\n *\n * ```javascript\n * var md = require('markdown-it')();\n * // enable everything\n * md.validateLink = function () { return true; }\n * ```\n **/\n this.validateLink = validateLink;\n\n /**\n * MarkdownIt#normalizeLink(url) -> String\n *\n * Function used to encode link url to a machine-readable format,\n * which includes url-encoding, punycode, etc.\n **/\n this.normalizeLink = normalizeLink;\n\n /**\n * MarkdownIt#normalizeLinkText(url) -> String\n *\n * Function used to decode link url to a human-readable format`\n **/\n this.normalizeLinkText = normalizeLinkText;\n\n\n // Expose utils & helpers for easy acces from plugins\n\n /**\n * MarkdownIt#utils -> utils\n *\n * Assorted utility functions, useful to write plugins. See details\n * [here](https://github.com/markdown-it/markdown-it/blob/master/lib/common/utils.js).\n **/\n this.utils = utils;\n\n /**\n * MarkdownIt#helpers -> helpers\n *\n * Link components parser functions, useful to write plugins. See details\n * [here](https://github.com/markdown-it/markdown-it/blob/master/lib/helpers).\n **/\n this.helpers = utils.assign({}, helpers);\n\n\n this.options = {};\n this.configure(presetName);\n\n if (options) { this.set(options); }\n}\n\n\n/** chainable\n * MarkdownIt.set(options)\n *\n * Set parser options (in the same format as in constructor). Probably, you\n * will never need it, but you can change options after constructor call.\n *\n * ##### Example\n *\n * ```javascript\n * var md = require('markdown-it')()\n * .set({ html: true, breaks: true })\n * .set({ typographer, true });\n * ```\n *\n * __Note:__ To achieve the best possible performance, don't modify a\n * `markdown-it` instance options on the fly. If you need multiple configurations\n * it's best to create multiple instances and initialize each with separate\n * config.\n **/\nMarkdownIt.prototype.set = function (options) {\n utils.assign(this.options, options);\n return this;\n};\n\n\n/** chainable, internal\n * MarkdownIt.configure(presets)\n *\n * Batch load of all options and compenent settings. This is internal method,\n * and you probably will not need it. But if you will - see available presets\n * and data structure [here](https://github.com/markdown-it/markdown-it/tree/master/lib/presets)\n *\n * We strongly recommend to use presets instead of direct config loads. That\n * will give better compatibility with next versions.\n **/\nMarkdownIt.prototype.configure = function (presets) {\n var self = this, presetName;\n\n if (utils.isString(presets)) {\n presetName = presets;\n presets = config[presetName];\n if (!presets) { throw new Error('Wrong `markdown-it` preset \"' + presetName + '\", check name'); }\n }\n\n if (!presets) { throw new Error('Wrong `markdown-it` preset, can\\'t be empty'); }\n\n if (presets.options) { self.set(presets.options); }\n\n if (presets.components) {\n Object.keys(presets.components).forEach(function (name) {\n if (presets.components[name].rules) {\n self[name].ruler.enableOnly(presets.components[name].rules);\n }\n if (presets.components[name].rules2) {\n self[name].ruler2.enableOnly(presets.components[name].rules2);\n }\n });\n }\n return this;\n};\n\n\n/** chainable\n * MarkdownIt.enable(list, ignoreInvalid)\n * - list (String|Array): rule name or list of rule names to enable\n * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.\n *\n * Enable list or rules. It will automatically find appropriate components,\n * containing rules with given names. If rule not found, and `ignoreInvalid`\n * not set - throws exception.\n *\n * ##### Example\n *\n * ```javascript\n * var md = require('markdown-it')()\n * .enable(['sub', 'sup'])\n * .disable('smartquotes');\n * ```\n **/\nMarkdownIt.prototype.enable = function (list, ignoreInvalid) {\n var result = [];\n\n if (!Array.isArray(list)) { list = [ list ]; }\n\n [ 'core', 'block', 'inline' ].forEach(function (chain) {\n result = result.concat(this[chain].ruler.enable(list, true));\n }, this);\n\n result = result.concat(this.inline.ruler2.enable(list, true));\n\n var missed = list.filter(function (name) { return result.indexOf(name) < 0; });\n\n if (missed.length && !ignoreInvalid) {\n throw new Error('MarkdownIt. Failed to enable unknown rule(s): ' + missed);\n }\n\n return this;\n};\n\n\n/** chainable\n * MarkdownIt.disable(list, ignoreInvalid)\n * - list (String|Array): rule name or list of rule names to disable.\n * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.\n *\n * The same as [[MarkdownIt.enable]], but turn specified rules off.\n **/\nMarkdownIt.prototype.disable = function (list, ignoreInvalid) {\n var result = [];\n\n if (!Array.isArray(list)) { list = [ list ]; }\n\n [ 'core', 'block', 'inline' ].forEach(function (chain) {\n result = result.concat(this[chain].ruler.disable(list, true));\n }, this);\n\n result = result.concat(this.inline.ruler2.disable(list, true));\n\n var missed = list.filter(function (name) { return result.indexOf(name) < 0; });\n\n if (missed.length && !ignoreInvalid) {\n throw new Error('MarkdownIt. Failed to disable unknown rule(s): ' + missed);\n }\n return this;\n};\n\n\n/** chainable\n * MarkdownIt.use(plugin, params)\n *\n * Load specified plugin with given params into current parser instance.\n * It's just a sugar to call `plugin(md, params)` with curring.\n *\n * ##### Example\n *\n * ```javascript\n * var iterator = require('markdown-it-for-inline');\n * var md = require('markdown-it')()\n * .use(iterator, 'foo_replace', 'text', function (tokens, idx) {\n * tokens[idx].content = tokens[idx].content.replace(/foo/g, 'bar');\n * });\n * ```\n **/\nMarkdownIt.prototype.use = function (plugin /*, params, ... */) {\n var args = [ this ].concat(Array.prototype.slice.call(arguments, 1));\n plugin.apply(plugin, args);\n return this;\n};\n\n\n/** internal\n * MarkdownIt.parse(src, env) -> Array\n * - src (String): source string\n * - env (Object): environment sandbox\n *\n * Parse input string and return list of block tokens (special token type\n * \"inline\" will contain list of inline tokens). You should not call this\n * method directly, until you write custom renderer (for example, to produce\n * AST).\n *\n * `env` is used to pass data between \"distributed\" rules and return additional\n * metadata like reference info, needed for the renderer. It also can be used to\n * inject data in specific cases. Usually, you will be ok to pass `{}`,\n * and then pass updated object to renderer.\n **/\nMarkdownIt.prototype.parse = function (src, env) {\n if (typeof src !== 'string') {\n throw new Error('Input data should be a String');\n }\n\n var state = new this.core.State(src, this, env);\n\n this.core.process(state);\n\n return state.tokens;\n};\n\n\n/**\n * MarkdownIt.render(src [, env]) -> String\n * - src (String): source string\n * - env (Object): environment sandbox\n *\n * Render markdown string into html. It does all magic for you :).\n *\n * `env` can be used to inject additional metadata (`{}` by default).\n * But you will not need it with high probability. See also comment\n * in [[MarkdownIt.parse]].\n **/\nMarkdownIt.prototype.render = function (src, env) {\n env = env || {};\n\n return this.renderer.render(this.parse(src, env), this.options, env);\n};\n\n\n/** internal\n * MarkdownIt.parseInline(src, env) -> Array\n * - src (String): source string\n * - env (Object): environment sandbox\n *\n * The same as [[MarkdownIt.parse]] but skip all block rules. It returns the\n * block tokens list with the single `inline` element, containing parsed inline\n * tokens in `children` property. Also updates `env` object.\n **/\nMarkdownIt.prototype.parseInline = function (src, env) {\n var state = new this.core.State(src, this, env);\n\n state.inlineMode = true;\n this.core.process(state);\n\n return state.tokens;\n};\n\n\n/**\n * MarkdownIt.renderInline(src [, env]) -> String\n * - src (String): source string\n * - env (Object): environment sandbox\n *\n * Similar to [[MarkdownIt.render]] but for single paragraph content. Result\n * will NOT be wrapped into `

` tags.\n **/\nMarkdownIt.prototype.renderInline = function (src, env) {\n env = env || {};\n\n return this.renderer.render(this.parseInline(src, env), this.options, env);\n};\n\n\nmodule.exports = MarkdownIt;\n", "'use strict';\n\n\nmodule.exports = require('./lib/');\n", "/**\n * Is it empty (stolen from Underscore)\n * @param {Object|String|?} obj some type of things\n * @return {Boolean} is it empty?\n */\nconst isEmpty = function (obj) {\n if (obj === null || obj === undefined) {\n return true;\n }\n if (Array.isArray(obj) || isString(obj)) {\n return obj.length === 0;\n }\n return Object.keys(obj).length === 0;\n};\n/**\n * Is it a String (stolen from Underscore)\n * @param {Object|String|?} obj some type of things\n * @return {Boolean} is it an string?\n */\nconst isString = function (obj) {\n return toString.call(obj) === '[object String]';\n};\n/**\n * Is it an Object (stolen from Underscore).\n * Note: This will return True for an Array also.\n * @param {Object|String|?} obj some type of things\n * @return {Boolean} is it an object?\n */\nconst isObject = function (obj) {\n const type = typeof obj;\n return (type === 'function' || type === 'object') && !!obj;\n};\n/**\n * Is a given variable undefined?\n * @param {Object|String|?} obj object to test\n * @return {Boolean} is it undefined\n */\nconst isUndefined = function (obj) {\n return obj === undefined;\n};\n/**\n * Capitalize a string\n * @param {String} string a string\n * @return {String} string with first letter capitalized\n */\nconst capitalize = function (string) {\n return isEmpty(string) ? string : string.charAt(0).toUpperCase() + string.slice(1);\n};\n/**\n * Default toJSON for classes.\n * Bind this to the class instance when calling.\n * @returns {Object}\n */\nconst defaultToJSON = function () {\n // @todo Should we save the objects class name as a property\n // so we can recreate the right structure later?\n const returnObj = {};\n for (const property in this) {\n const value = this[property];\n if (value instanceof Map) {\n if (value.size === 0) {\n continue;\n }\n // Note: This will be problematic if Map has keys that are not\n // permitted as object properties.\n returnObj[property] = Object.fromEntries(value.entries());\n continue;\n }\n if (isEmpty(value)) {\n continue;\n }\n returnObj[property] = value;\n }\n return returnObj;\n};\n\nexport {\n isEmpty,\n isString,\n isObject,\n isUndefined,\n capitalize,\n defaultToJSON\n};\n", "/**\n * Display options for subtable results. Used in RandomTable and RandomTableResultSet\n */\nexport default class DisplayOptions {\n /**\n *\n * @property {String} table Subtable name.\n * @property {Boolean} hide_table Hide the subtable name.\n * @property {Boolean} hide_result Hide the result.\n * @property {Boolean} hide_desc Hide the description field.\n */\n constructor ({\n table = '',\n hide_table = false,\n hide_result = false,\n hide_desc = false\n }) {\n this.table = table;\n /** Accept true, 1, or '1' to set these properties */\n this.hide_table = (hide_table === true || hide_table === '1' || hide_table === 1);\n this.hide_result = (hide_result === true || hide_result === '1' || hide_result === 1);\n this.hide_desc = (hide_desc === true || hide_desc === '1' || hide_desc === 1);\n }\n /**\n * Custom JSON handler to strip defaults.\n * @returns {Object}\n */\n toJSON () {\n const returnObj = {\n table: this.table\n };\n if (this.hide_table) {\n returnObj.hide_table = true;\n }\n if (this.hide_result) {\n returnObj.hide_result = true;\n }\n if (this.hide_desc) {\n returnObj.hide_desc = true;\n }\n return returnObj;\n }\n}\n", "import { isString, defaultToJSON } from './r_helpers.js';\n\n/**\n * Class for entries in a random (sub)table.\n * This normalizes the various options into a class that makes the other code simpler.\n */\nexport default class RandomTableEntry {\n /**\n *\n * @property {String} label Basic string label. Only required field. Can include tokens.\n * @property {Boolean} [print=true] Should the result be included in the output.\n * @property {String} [description] Extra description for the label.\n * @property {String[]} [subtable] Other tables to roll on.\n * @property {Number} [weight=1] Number to weight entry relative to other entries.\n */\n constructor ({\n label = '',\n print = true,\n description = '',\n subtable = [],\n weight = 1\n }) {\n this.label = label;\n this.print = !(print === false || print === '0' || print === 0);\n this.description = description;\n this.weight = parseInt(weight, 10);\n if (this.weight <= 0) {\n this.weight = 1;\n }\n // Make sure it's an array of string.\n if (isString(subtable)) {\n this.subtable = [subtable];\n } else if (Array.isArray(subtable)) {\n this.subtable = subtable.map((el) => { return el.toString(); });\n }\n }\n /**\n * Custom JSON handler because Map doesn't JSON stringify automatically.\n * @returns {Object}\n */\n toJSON () {\n return defaultToJSON.call(this);\n }\n}\n", "/**\n * Sum an array\n * @param {Array} arr an array of numbers\n * @returns {Number} Total value of numbers in array\n */\nconst arraySum = function (arr) {\n let total = 0;\n for (let i = 0; i < arr.length; i++) {\n const v = parseFloat(arr[i]);\n if (!isNaN(v)) {\n total += v;\n }\n }\n return total;\n};\n\n/**\n * Random integer between two numbers (stolen from underscorejs)\n * @param {Number} [min=0] mininum value\n * @param {Number} [max=null] maximum value\n * @returns {Number} random value\n */\nconst randomInteger = function (min = 0, max = null) {\n if (max == null) {\n max = min;\n min = 0;\n }\n return min + Math.floor(Math.random() * (max - min + 1));\n};\n\n/**\n * Random value selection\n * @param {Array} values an array of objects from which to choose\n * @param {Array} weights a matching array of integers to weight the values (i.e. values and weights are in the same order)\n * @returns {String} the randomly selected Array element from values param\n */\nconst getWeightedRandom = function (values, weights) {\n let n = 0;\n const num = randomInteger(1, arraySum.call(this, weights));\n let i = 0;\n for (i; i < values.length; i++) {\n n = n + weights[i];\n if (n >= num) {\n break;\n }\n }\n return values[i];\n};\n/**\n * Random value selection, wrapper for getWeightedRandom that processes the data into values/weights arrays\n * @param {String[]} data values\n * @returns {String|null} the randomly selected string\n */\nconst randomString = function (data) {\n const values = [];\n const weights = [];\n\n if (!Array.isArray(data) || data.length === 0) {\n return null;\n }\n data.forEach((entry) => {\n weights.push(1);\n values.push(entry);\n });\n\n return getWeightedRandom(values, weights);\n};\n\nexport {\n randomInteger,\n getWeightedRandom,\n randomString\n};\n", "import { isEmpty, isString, isObject, defaultToJSON } from './r_helpers.js';\nimport DisplayOptions from './DisplayOptions.js';\nimport RandomTableEntry from './RandomTableEntry.js';\nimport { getWeightedRandom } from './randomizer.js';\n\n/**\n * RandomTable: Model for tables used by TableRoller\n * @param {Object} config the tables non-default attributes\n */\nexport default class RandomTable {\n /**\n * The primary attributes of this table\n * @property {String} id id for the table, primary key for database if used\n * @property {String} key identifier for the table\n * @property {String} [title] title of the table\n * @property {String} [author] author of the table\n * @property {String} [description] description of the table\n * @property {String} [source] source of the table\n * @property {String[]} [tags] subject tags\n * @property {String[]} [sequence] tables to roll on as default.\n * @property {String[]|Object[]} [table] default table. array of strings or objects. removed after initialization.\n * @property {Object} [tables] a property for each subtables.\n * @property {RandomTableEntries[]} tables[subtablename] Entries for subtables.\n * @property {String[]} [macro] for tables that are only used to aggregate result from other tables, this array consists of table keys and optionsl subtables to be rolled on in order\n * @property {Map[DisplayOptions]} [display_opt] Display options for the subtables.\n * @property {Array} [dependencies] table keys that are needed to get full results from this table\n *\n * Note the Constructor args are not exactly the same as the properties. Some type changes are made to convert data.\n */\n constructor ({\n id = 0,\n key = null,\n title = '',\n author = '',\n description = '',\n source = '',\n tags = [],\n sequence = [],\n tables = {},\n macro = [],\n dependencies = null,\n table = null,\n display_opt = []\n }) {\n this.id = id;\n this.key = key || this.id; // default to the id.\n this.title = title;\n this.author = author;\n this.description = description;\n this.source = source;\n this.tags = tags;\n this.sequence = sequence;\n this.macro = macro;\n this.dependencies = dependencies;\n\n this._normalizeTables(tables, table);\n\n this.display_opt = new Map();\n display_opt.forEach((data) => {\n const key = data.table || '';\n if (key) {\n if (data instanceof DisplayOptions) {\n this.display_opt.set(key, data);\n return;\n }\n const opt = new DisplayOptions(data);\n this.display_opt.set(key, opt);\n }\n });\n }\n toString () {\n return this.title;\n }\n /**\n * Make sure table entries are all RandomTableEntry objects.\n * @param {Array} data\n * @returns RandomTableEntry[]\n */\n _normalizeTable (data) {\n const entries = [];\n data.forEach((d) => {\n if (isEmpty(d)) {\n return;\n }\n if (isString(d)) {\n entries.push(new RandomTableEntry({\n label: d\n }));\n return;\n }\n if (d instanceof RandomTableEntry) {\n entries.push(d);\n return;\n }\n if (isObject(d)) {\n entries.push(new RandomTableEntry(d));\n }\n });\n return entries;\n }\n /**\n * Normalize the tables/table constructor data.\n * @param {Object} tables\n * @param {Array} table\n * @returns\n */\n _normalizeTables (tables, table) {\n if (isEmpty(tables) && isEmpty(table)) {\n return;\n }\n this.tables = {};\n // put default table in first.\n if (!isEmpty(table) && Array.isArray(table)) {\n this.tables.default = this._normalizeTable(table);\n }\n if (isObject(tables)) {\n const subtableNames = Object.keys(tables);\n subtableNames.forEach((name) => {\n const data = tables[name];\n if (!Array.isArray(data)) {\n return;\n }\n this.tables[name] = this._normalizeTable(data);\n });\n }\n }\n /**\n * validate fields before saving\n * @param {Object} properties new attributes to save\n * @returns {Object} error information\n */\n validate (properties) {\n const error = { fields: [], general: '' };\n\n if (properties.title === '') {\n error.fields.push({ field: 'title', message: 'Title cannot be blank' });\n error.general += 'Title cannot be blank. ';\n }\n\n if (isEmpty(properties.tables) && isEmpty(properties.macro)) {\n error.fields.push({ field: 'tables', message: 'Both Tables and Macro cannot be empty' });\n error.general += 'Both Tables and Macro cannot be empty. ';\n }\n\n if (!isEmpty(error.fields) || !isEmpty(error.general)) {\n return error;\n }\n return true;\n }\n /**\n * Basic sequence of table rolls.\n * Either the start, the default sequence, the default table, or just the first one.\n * @param {String} start Subtable name to start with.\n * @returns {String[]}\n */\n getSequence (start = '') {\n if (start !== '') {\n return [start];\n }\n if (this.sequence.length === 0) {\n if (this.tables.default) {\n return ['default'];\n }\n return [this.subtableNames[0]];\n }\n if (this.sequence[0] === 'rollall') {\n return this.subtableNames;\n }\n return this.sequence;\n }\n /**\n * All the subtable names.\n * @returns {String[]}\n */\n get subtableNames () {\n return Object.keys(this.tables);\n }\n /**\n * Get entries for a specific subtable.\n * @param {String} [name=default] Subtable name.\n * @returns {RandomTableEntry[]}\n */\n getSubtableEntries (name = 'default') {\n return this.tables[name] || [];\n }\n /**\n * Get a random entry from a subtable.\n * @param {String} subtableName\n * @returns {RandomTableEntry|null}\n */\n getRandomEntry (subtableName) {\n const entries = this.getSubtableEntries(subtableName);\n if (entries.length === 0) {\n return null;\n }\n const values = [];\n const weights = [];\n entries.forEach((entry, k, l) => {\n weights.push(entry.weight);\n values.push(entry);\n });\n return getWeightedRandom(values, weights);\n }\n /**\n * Get an entry in case we only have the label and need other data from it\n * @param {String} label The item we are looking for\n * @param {String} [table=default] the table to search\n * @returns {RandomTableEntry|null}\n */\n findEntry (label, table = 'default') {\n const t = this.tables[table];\n if (!t) {\n return null;\n }\n const entry = t.find((e) => {\n return e.label === label;\n });\n if (!entry) {\n return null;\n }\n return entry;\n }\n /**\n * Find the dependent tables to get full results for this table\n * @return {Array} table keys\n */\n findDependencies () {\n // check field first, if it's not null we'll trust it...?\n if (this.dependencies !== null) {\n return this.dependencies;\n }\n // iterate over the tables and look for table tokens\n let dep = [];\n\n // Check macro\n this.macro.forEach((macro) => {\n const parts = macro.split(':');\n if (parts.length > 0 && parts[0] !== 'this') {\n dep.push(parts[0]);\n }\n });\n const tokenRegExp = /({{2}.+?}{2})/g;\n const tnames = Object.keys(this.tables);\n tnames.forEach((n) => {\n // n is sub/table name\n const table = this.tables[n];\n table.forEach((result) => {\n const tokens = result.label.match(tokenRegExp);\n if (tokens !== null) {\n tokens.forEach((token) => {\n const parts = token.replace('{{', '').replace('}}', '').split(':');\n if (parts.length > 1 && parts[0] === 'table' && parts[1] !== 'this') {\n dep.push(parts[1]);\n }\n });\n }\n });\n });\n dep = dep.reduce((a, b) => {\n if (a.indexOf(b) < 0) { a.push(b); }\n return a;\n }, []);\n this.dependencies = dep;\n return dep;\n }\n /**\n * Custom JSON handler because Map doesn't JSON stringify automatically.\n * @returns {Object}\n */\n toJSON () {\n return defaultToJSON.call(this);\n }\n}\n", "import { defaultToJSON } from './r_helpers.js';\n\n/**\n * Class for results from RandomTable\n */\nexport default class RandomTableResult {\n /**\n * @property {String} table Title of subtable.\n * @property {String} result Randomized result label.\n * @property {String} desc Extra result description.\n */\n constructor ({\n table = '',\n result = '',\n desc = ''\n }) {\n this.table = table;\n this.result = result;\n this.desc = desc;\n }\n /**\n * Is this from the \"default\" table.\n */\n get isDefault () {\n return this.table === 'default';\n }\n /**\n * Is this an error result.\n */\n get isError () {\n return false;\n }\n toString () {\n return this.result;\n }\n /**\n * Custom JSON handler to strip empty props.\n * @returns {Object}\n */\n toJSON () {\n return defaultToJSON.call(this);\n }\n}\n", "import { capitalize, defaultToJSON } from './r_helpers.js';\nimport RandomTableResult from './RandomTableResult.js';\n\n/**\n * Set of table results.\n */\nexport default class RandomTableResultSet {\n /**\n * @property {String} title Title from the RandomTable parent\n * @property {RandomTableResult[]} results Randomized results.\n * @property {Map[DisplayOptions]} displayOptions Display settings from the RandomTable parent.\n */\n constructor ({\n title = '',\n results = [],\n displayOptions = new Map()\n }) {\n this.title = title;\n this.results = [];\n results.forEach((r) => {\n this.addResult(r);\n });\n if (displayOptions instanceof Map) {\n this.displayOptions = displayOptions;\n } else {\n this.displayOptions = new Map();\n }\n }\n /**\n * Add a result to the set.\n * @param {RandomTableResult|object} data\n * @returns\n */\n addResult (data) {\n if (data instanceof RandomTableResult) {\n this.results.push(data);\n return;\n }\n this.results.push(new RandomTableResult(data));\n }\n\n get isSimple () {\n return this.results.length === 1;\n }\n\n /**\n * Find the result for a specific table/subtable\n * @param {String} table The table to look for\n * @returns {RandomTableResult|null}\n */\n findResultByTable (table = 'default') {\n const obj = this.results.find((v) => {\n return v.table === table;\n });\n return !obj ? null : obj;\n }\n /**\n * Output the set as a string.\n * @param {Boolean} simple Simplify the output (just the result labels)\n * @returns\n */\n niceString (simple = false) {\n if (this.results.length === 0) {\n return '';\n }\n\n if (simple) {\n return this.results.map((r) => { return r.toString(); }).join(' ');\n }\n\n let output = '';\n this.results.forEach((result) => {\n if (result.isError) {\n output += `Error: ${result.result}\\n`;\n return;\n }\n const displayOpt = this.displayOptions.get(result.table);\n if (displayOpt) {\n if (!displayOpt.hide_table) {\n output += `${capitalize(result.table)}: `;\n }\n if (!displayOpt.hide_result) {\n output += `${capitalize(result.result)}\\n`;\n }\n if (!displayOpt.hide_desc) {\n if (result.desc !== '') {\n output += `(${result.desc})\\n`;\n }\n }\n return;\n }\n if (result.isDefault) {\n output += `${capitalize(result.result)}\\n`;\n } else {\n output += `${capitalize(result.table)}: ${capitalize(result.result)}\\n`;\n }\n if (result.desc !== '') {\n output += `${result.desc}\\n`;\n }\n });\n return output.trim(); // trim off final linebreak\n }\n /**\n * Simple base output of result set.\n */\n toString () {\n return this.niceString();\n }\n /**\n * Custom JSON handler because Map doesn't JSON stringify automatically.\n * @returns {Object}\n */\n toJSON () {\n return defaultToJSON.call(this);\n }\n}\n", "/* eslint-disable no-useless-escape */\nimport { randomInteger } from './randomizer.js';\n\n/**\n * @prop {String} die Die notation.\n * @prop {Number} value Random roll for the die notation.\n */\nclass DiceResult {\n constructor ({\n die = '',\n value = 0\n }) {\n this.die = die;\n this.value = value;\n }\n toString () {\n return this.value;\n }\n}\n\n/**\n * Dice rolling simulator\n * @param {Number} [die=6] Die type\n * @param {Number} [number=1] Number of times to roll the die\n * @param {Number} [modifier=0] Numeric modifier to dice total\n * @param {String} [mod_op=+] Operator for the modifier (+,-,/,*)\n * @returns {Number} Number rolled (die*number [mod_op][modifier])\n */\nconst parseDiceNotation = function (die = 6, number = 1, modifier = 0, mod_op = '+') {\n modifier = parseInt(modifier, 10);\n die = parseInt(die, 10);\n\n if (number <= 0) {\n number = 1;\n } else {\n number = parseInt(number, 10);\n }\n\n let sum = 0;\n for (let i = 1; i <= number; i++) {\n sum = sum + randomInteger(1, die);\n }\n if (modifier === 0) {\n return sum;\n }\n\n switch (mod_op) {\n case '*':\n sum = sum * modifier;\n break;\n case '-':\n sum = sum - modifier;\n break;\n case '/':\n sum = sum / modifier;\n break;\n case '+':\n default:\n sum = sum + modifier;\n break;\n }\n return Math.round(sum);\n};\n\n/**\n * takes a string like '3d6+2', 'd6', '2d6', parses it, and puts it through roll\n * @params {String} string a die roll notation\n * @returns {Number} the result of the roll\n */\nconst rollDie = function (string = '') {\n string = string.trim();\n const m = string.match(/^([0-9]*)d([0-9]+)(?:([\\+\\-\\*\\/])([0-9]+))*$/);\n if (!m) {\n return '';\n }\n return parseDiceNotation(m[2], m[1], m[4], m[3]);\n};\n\n/**\n * Return a dice result.\n * @param {String} die Die roll notation.\n * @returns {DiceResult}\n */\nconst getDiceResult = function (die = '') {\n return new DiceResult({\n die,\n value: rollDie(die)\n });\n};\n\nexport {\n rollDie,\n DiceResult,\n getDiceResult\n};\n", "/**\n * Custom error for handling known errors in the table roller.\n */\nclass TableError extends Error {\n constructor (message) {\n super(message);\n this.name = 'TableError';\n }\n}\n\nexport default TableError;\n", "import RandomTableResult from './RandomTableResult.js';\n\n/**\n * Class for results from RandomTable\n */\nexport default class TableErrorResult extends RandomTableResult {\n /**\n * Is this an error result.\n */\n get isError () {\n return true;\n }\n}\n", "/* eslint-disable no-useless-escape */\nimport { isEmpty, isUndefined } from './r_helpers.js';\nimport RandomTable from './RandomTable.js';\nimport RandomTableEntry from './RandomTableEntry.js';\nimport RandomTableResult from './RandomTableResult.js';\nimport RandomTableResultSet from './RandomTableResultSet.js';\nimport { getDiceResult } from './dice_roller.js';\nimport TableError from './TableError.js';\nimport TableErrorResult from './TableErrorResult.js';\n\n/**\n * Define the regex to find tokens\n * This looks for anything between double brackets.\n * Note: this is duplicated in RandomTable.findDependencies() so if updated, update it there too\n */\nconst tokenRegExp = /({{2}.+?}{2})/g;\n\n/**\n * TableRoller\n * Handles rolling on tables and tokens in tables/results.\n * @constructor\n */\nclass TableRoller {\n constructor ({\n token_types = {}\n }) {\n this.token_types = {\n roll: this._defaultRollToken.bind(this),\n table: this._defaultTableToken.bind(this)\n };\n Object.keys(token_types).forEach((token) => {\n this.token_types[token] = token_types[token];\n });\n }\n /**\n * Return an error result\n * @param {String} error Error message\n * @param {String} table Sub/table name if relevant.\n * @returns {TableErrorResult}\n */\n _getErrorResult (error = '', table = '') {\n return new TableErrorResult({\n table: table,\n result: error\n });\n }\n /**\n * Return a result set with an error.\n * @param {String} error Error message\n * @returns {RandomTableResultSet}\n */\n _getErrorResultSet (error = '') {\n return new RandomTableResultSet({\n results: [\n this._getErrorResult(error)\n ]\n });\n }\n /**\n * Get a result from a table/subtable in a RandomTable object\n * DANGER: you could theoretically put yourself in an endless loop if the data were poorly planned\n * Calling method try to catch RangeError to handle that possibility.\n * @param {RandomTable} rtable the RandomTable object\n * @param {String} table table to roll on\n * @returns {RandomTableResult[]}\n */\n _selectFromTable (rtable, table) {\n if (!(rtable instanceof RandomTable)) {\n return [this._getErrorResult('Invalid table.')];\n }\n\n let o = []; // Results\n const entry = rtable.getRandomEntry(table);\n if (entry === null || !(entry instanceof RandomTableEntry)) {\n return [this._getErrorResult('Invalid subtable name.', table)];\n }\n // if print is false we suppress the output from this table\n // (good for top-level tables that have subtables prop set)\n if (entry.print) {\n // replace any tokens\n const t_result = this.findToken(entry.label, rtable);\n o.push(new RandomTableResult({ table: table, result: t_result, desc: entry.description }));\n }\n\n // are there subtables to roll on?\n if (entry.subtable.length === 0) {\n // no subtables\n return o;\n }\n\n // Select from each subtable and add to results.\n entry.subtable.forEach((subtableName) => {\n const subresult = this._selectFromTable(rtable, subtableName);\n // concat because subresult is an array.\n o = o.concat(subresult);\n });\n return o;\n }\n /**\n * Get results array for macro setting of a table.\n * @param {RandomTable} rtable Table with macro set.\n * @returns {RandomTableResult[]}\n */\n _getTableMacroResult (rtable) {\n let results = [];\n try {\n rtable.macro.forEach((macroKey) => {\n const parts = macroKey.split(':');\n const tableKey = parts[0];\n const subtable = parts[1] || '';\n if (tableKey === rtable.key) {\n throw new TableError(`Macros can't self reference.`);\n }\n try {\n const mtable = this.getTableByKey(tableKey);\n const result = this.getTableResult(mtable, subtable);\n // concat because result is an array.\n results = results.concat(result);\n } catch (e) {\n if (e instanceof TableError) {\n results.push(this._getErrorResult(e.message, tableKey));\n } else {\n // Rethrow unexpected errors\n throw e;\n }\n }\n });\n } catch (e) {\n if (e instanceof RangeError) {\n // This could be an infinite loop of table results referencing each other.\n results.push(this._getErrorResult(e.message));\n } else {\n throw e;\n }\n }\n return results;\n }\n /**\n * Generate a result from a RandomTable object\n * @param {RandomTable} rtable the RandomTable\n * @param {String} [start=''] subtable to roll on\n * @return {RandomTableResult[]}\n */\n getTableResult (rtable, start = '') {\n if (!(rtable instanceof RandomTable)) {\n return [\n this._getErrorResult('No table found to roll on.')\n ];\n }\n let results = [];\n\n // if macro is set then we ignore a lot of stuff\n if (rtable.macro.length > 0) {\n return this._getTableMacroResult(rtable);\n }\n\n const sequence = rtable.getSequence(start);\n if (sequence.length === 0) {\n return results;\n }\n try {\n sequence.forEach((seqKey) => {\n const r = this._selectFromTable(rtable, seqKey);\n results = results.concat(r);\n });\n } catch (e) {\n // In case of infinite recursion\n if (e instanceof RangeError) {\n results.push(this._getErrorResult(e.message));\n } else {\n throw e;\n }\n }\n return results;\n }\n /**\n * Get result set from a table based on the key.\n * @param {String} tableKey\n * @param {String} table\n * @returns {RandomTableResultSet}\n */\n getTableResultSetByKey (tableKey, table = '') {\n try {\n const rtable = this.getTableByKey(tableKey);\n const results = this.getTableResult(rtable, table);\n return new RandomTableResultSet({\n title: rtable.title,\n results: results,\n displayOptions: rtable.display_opt\n });\n } catch (e) {\n if (e instanceof TableError) {\n return this._getErrorResultSet(e.message);\n } else {\n // Rethrow unexpected errors\n throw e;\n }\n }\n }\n /**\n * Get result set from a table based on the key.\n * @param {RandomTable} rtable Main table object.\n * @param {String} [table] Subtable\n * @returns {RandomTableResultSet}\n */\n getResultSetForTable (rtable, table = '') {\n if (!(rtable instanceof RandomTable)) {\n return this._getErrorResultSet(`Invalid table data.`);\n }\n const results = this.getTableResult(rtable, table);\n return new RandomTableResultSet({\n title: rtable.title,\n results: results,\n displayOptions: rtable.display_opt\n });\n }\n /**\n * Perform token replacement. Only table and roll actions are accepted\n * @param {String} token A value passed from findToken containing a token(s) {{SOME OPERATION}} Tokens are {{table:SOMETABLE}} {{table:SOMETABLE:SUBTABLE}} {{table:SOMETABLE*3}} (roll that table 3 times) {{roll:1d6+2}} (etc) (i.e. {{table:colonial_occupations:laborer}} {{table:color}} also generate names with {{name:flemish}} (surname only) {{name:flemish:male}} {{name:dutch:female}}\n * @param {RandomTable|null} curtable RandomTable the string is from (needed for \"this\" tokens) or null\n * @returns {RandomTableResultSet|RandomTableResultSet[]|DiceResult|String|Any} The result of the token or else just the token (in case it was a mistake or at least to make the error clearer)\n */\n convertToken (token, curtable = null) {\n let parts = token.replace('{{', '').replace('}}', '').split(':');\n parts = parts.map((el) => {\n return el.trim();\n });\n if (parts.length === 0) {\n return token;\n }\n\n // look for a token type we can run\n try {\n if (this.token_types[parts[0]]) {\n return this.token_types[parts[0]](parts, token, curtable);\n } else {\n return token;\n }\n } catch (e) {\n if (e instanceof RangeError) {\n // This could be an infinite loop of table results referencing each other.\n return this._getErrorResultSet(e.message);\n } else {\n throw e;\n }\n }\n }\n /**\n * Look for tokens to perform replace action on them.\n * @param {String} entryLabel Usually a label from a RandomTableEntry\n * @param {RandomTable|null} curtable RandomTable the string is from (needed for \"this\" tokens) or null\n * @returns {String} String with tokens replaced (if applicable)\n */\n findToken (entryLabel, curtable = null) {\n if (isEmpty(entryLabel)) {\n return '';\n }\n const newstring = entryLabel.replace(tokenRegExp, (token) => {\n return this.convertToken(token, curtable).toString();\n });\n return newstring;\n }\n /**\n * Since tables are stored outside of this module, this function allows for the setting of a function which will be used to lookup a table by it's key\n * @param {Function} lookup a function that takes a table key and returns a RandomTable or null\n */\n setTableKeyLookup (lookup) {\n this._customGetTableByKey = lookup;\n }\n /**\n * Placeholder that should be replaced by a function outside this module\n * @param {String} key human readable table identifier\n * @return {null} nothing, when replaced this function should return a table object\n */\n _customGetTableByKey (key) {\n return null;\n }\n /**\n * Return a table based on it's key.\n * This requires calling setTableKeyLookup and setting a lookup method\n * That returns a RandomTable object or null.\n * @param {String} key human readable table identifier\n * @returns {RandomTable}\n * @throws {TableError}\n */\n getTableByKey (key) {\n if (!key) {\n throw new TableError('No table key.');\n }\n const table = this._customGetTableByKey(key);\n if (!table || !(table instanceof RandomTable)) {\n throw new TableError(`No table found for key: ${key}`);\n }\n return table;\n }\n /**\n * Add a token variable\n * @param {String} name Name of the token (used as first element).\n * @param {Function} process Function to return token replacement value function is passed the token_parts (token split by \":\"), original full_token, current table name\n */\n registerTokenType (name, process) {\n this.token_types[name] = process;\n }\n /**\n * Dice roll token.\n * @returns {DiceResult}\n */\n _defaultRollToken (token_parts, full_token = '', curtable = null) {\n return getDiceResult(token_parts[1]);\n }\n /**\n * Table token lookup in the form:\n * {{table:SOMETABLE}} {{table:SOMETABLE:SUBTABLE}} {{table:SOMETABLE*3}} (roll that table 3 times) {{table:SOMETABLE:SUBTABLE*2}} (roll subtable 2 times)\n * @param {String[]} token_parts Token split by :\n * @param {String} full_token Original token\n * @param {RandomTable|null} curtable Current table or null.\n * @returns {RandomTableResultSet|RandomTableResultSet[]} One or more result sets.\n */\n _defaultTableToken (token_parts, full_token, curtable = null) {\n if (isUndefined(token_parts[1])) {\n return full_token;\n }\n let multiplier = 1;\n if (token_parts[1].indexOf('*') !== -1) {\n const x = token_parts[1].split('*');\n token_parts[1] = x[0];\n multiplier = x[1];\n }\n\n // what table do we roll on\n let rtable = null;\n if (token_parts[1] === 'this') {\n if (!curtable) {\n return full_token;\n }\n // reroll on same table\n rtable = curtable;\n } else {\n // Table lookup\n try {\n rtable = this.getTableByKey(token_parts[1]);\n } catch (e) {\n if (e instanceof TableError) {\n return full_token;\n } else {\n // Rethrow unexpected errors\n throw e;\n }\n }\n }\n\n if (typeof token_parts[2] !== 'undefined' && token_parts[2].indexOf('*') !== -1) {\n const x = token_parts[2].split('*');\n token_parts[2] = x[0];\n multiplier = x[1];\n }\n const subtable = (isUndefined(token_parts[2])) ? '' : token_parts[2];\n\n const results = [];\n for (let i = 1; i <= multiplier; i++) {\n results.push(this.getResultSetForTable(rtable, subtable));\n }\n return results.length === 1 ? results[0] : results;\n }\n}\n\nexport default TableRoller;\n", "/**\n * Adapted from http://blog.javascriptroom.com/2013/01/21/markov-chains/\n */\nclass MarkovGenerator {\n /**\n *\n * @param {Object} memory the \"memory\" where the language parts go\n * @param {String} separator If you want to delimit the generated parts\n * @param {Number} order How many... something... to something.... oh it's been too long I don't remember how this works...\n */\n constructor ({\n memory = {},\n separator = '',\n order = 2\n }) {\n this.memory = memory;\n this.separator = separator;\n this.order = order;\n }\n /**\n * Is the memory key already set.\n * @param {String} key\n */\n isMemoryKeySet (key) {\n return !!this.memory[key];\n }\n /**\n * Generate a starting array for the chain based on the order number\n * @return {Array} just an empty array of length=order\n */\n genInitial () {\n return Array(this.order).fill('');\n }\n /**\n * Get a random array element\n * @param {Array} arr an array\n * @return {String|Object} random value\n */\n getRandomValue (arr) {\n return arr[Math.floor(Math.random() * arr.length)];\n }\n /**\n * Chunk the word or phrase\n * @param {String} txt the text to chunk\n * @param {Function} cb callback function\n * @return {null} null\n */\n breakText (txt, cb) {\n const parts = txt.split(this.separator);\n const prev = this.genInitial();\n\n parts.forEach((v) => {\n v = v.toLowerCase();\n cb(prev, v);\n prev.shift();\n prev.push(v);\n });\n cb(prev, '');\n }\n /**\n * Feed text to memory\n * @param {String} key key for the chain (so we can store multiple memories)\n * @param {String} txt word or phrase\n * @return {null} null\n */\n learn (key, txt) {\n const mem = (this.memory[key]) ? this.memory[key] : {};\n // split up text then add the calculated parts to the memory for this key\n this.breakText(txt, (key, value) => {\n if (!mem[key]) {\n mem[key] = [];\n }\n mem[key].push(value);\n return mem;\n });\n this.memory[key] = mem;\n }\n /**\n * Iterate through, calls self\n * @param {Array} state array of most recent x(x=order) elements in chain\n * @param {Array} ret the chain\n * @return {Array}\n */\n step (state, ret) {\n const nextAvailable = this.memory[this.cur_key][state] || [''];\n const next = this.getRandomValue(nextAvailable);\n // we don't have anywhere to go\n if (!next) {\n return ret;\n }\n ret.push(next);\n const nextState = state.slice(1);\n nextState.push(next);\n return this.step(nextState, ret);\n }\n /**\n * Return a generated response\n * @param {String} key key for the chain (so we can store multiples\n * @param {Array} seed letters to start the response (?)\n */\n generate (key, seed) {\n if (!seed) {\n seed = this.genInitial();\n }\n this.cur_key = key;\n return seed.concat(this.step(seed, [])).join(this.separator);\n }\n}\n\nexport default MarkovGenerator;\n", "/**\n * Custom error for handling known errors in the name generator.\n */\nclass RandomNameError extends Error {\n constructor (message) {\n super(message);\n this.name = 'RandomNameError';\n }\n}\n\nexport default RandomNameError;\n", "import { randomString } from './randomizer.js';\n\n/**\n * Class for name data.\n */\nclass RandomNameType {\n /**\n *\n * @param {String} key Key to identify uniquely in tokens and methods.\n * @param {String} label Human readable label.\n * @param {String[]} male Names.\n * @param {String[]} female Names.\n * @param {String[]} surname Names.\n */\n constructor ({\n key = '',\n label = '',\n male = [],\n female = [],\n surname = []\n }) {\n this.key = key;\n this.label = label || key;\n this.male = Array.isArray(male) ? male : [];\n this.female = Array.isArray(female) ? female : [];\n this.surname = Array.isArray(surname) ? surname : [];\n }\n /**\n * Returns all personal names.\n * @returns {String[]}\n */\n getAllPersonalNames () {\n return Array.prototype.concat(this.male, this.female);\n }\n /**\n * Return a personal name list.\n * @param {String} gender Mixed, random, male, female\n * @returns {String[]}\n */\n getPersonalNameList (gender = 'random') {\n // Mixed gets all the personal names.\n if (gender === 'mixed' || gender === '') {\n return this.getAllPersonalNames();\n }\n // If specific gender is requested\n // return regardless of if it's empty\n if (gender === 'male') {\n return this.male;\n }\n if (gender === 'female') {\n return this.female;\n }\n // Else return a random list\n const randomList = [];\n if (this.male.length > 0) {\n randomList.push('male');\n }\n if (this.female.length > 0) {\n randomList.push('female');\n }\n if (randomList.length === 0) {\n return [];\n }\n gender = randomString(randomList);\n return this[gender];\n }\n}\n\nexport default RandomNameType;\n", "import { capitalize } from './r_helpers.js';\nimport MarkovGenerator from './MarkovGenerator.js';\nimport { randomString } from './randomizer.js';\nimport RandomNameError from './RandomNameError.js';\nimport RandomNameType from './RandomNameType.js';\n\n/** Capitalize names, account for multiword lastnames like \"Van Hausen\"\n * @param {String} name a name\n * @return {String} name capitalized\n */\nconst capitalizeName = function (name) {\n const leave_lower = ['of', 'the', 'from', 'de', 'le', 'la'];\n // need to find spaces in name and capitalize letter after space\n const parts = name.split(' ');\n const upper_parts = parts.map((w) => {\n return (leave_lower.indexOf(w) >= 0) ? w : `${capitalize(w)}`;\n });\n return upper_parts.join(' ');\n};\n\n/**\n * @prop {Map} nameTypes\n * @prop {MarkovGenerator} _markov\n */\nclass RandonNameGenerator {\n /**\n * Random name generation.\n * @param {RandomNameType[]} namedata\n * @param {Number} [markovOrder=3] Markov generator settings.\n */\n constructor ({\n namedata = [],\n markovOrder = 3\n }) {\n this.nameTypes = new Map();\n if (Array.isArray(namedata)) {\n namedata.forEach((type) => {\n this.registerNameType(type);\n });\n }\n this._markov = new MarkovGenerator({ order: markovOrder });\n }\n /**\n * Add some name data\n * Note: you can overwrite existing name_types if you want\n * @param {RandomNameType} type\n * @throws {RandomNameError}\n */\n registerNameType (type) {\n if (!(type instanceof RandomNameType)) {\n throw new RandomNameError('Must be instance of RandomNameType');\n }\n if (!type.key) {\n throw new RandomNameError('RandomNameType must have key set.');\n }\n if (type.key === 'random') {\n throw new RandomNameError(`RandomNameType key ${type.key} is reserved.`);\n }\n if (type.male.length === 0 && type.female.length === 0 && type.surname.length === 0) {\n throw new RandomNameError(`RandomNameType ${type.key} must include male, female, or surname lists.`);\n }\n this.nameTypes.set(type.key, type);\n }\n /**\n * Make sure namedata is set.\n * @param {String} name_type\n * @param {String} [subtype=''] Subtype like a gender or 'surname'\n * @throws RandomNameError\n */\n _validateNameType (name_type, subtype = '') {\n const type = this.nameTypes.get(name_type);\n if (!type) {\n throw new RandomNameError('Invalid name type.');\n }\n if (!subtype) {\n return;\n }\n if (!Array.isArray(type[subtype]) || type[subtype].length === 0) {\n throw new RandomNameError(`${name_type} type does not have subtype ${subtype}`);\n }\n }\n /**\n * Keys of the name types that are set.\n * @returns {String[]}\n */\n getValidNameTypes () {\n return Array.from(this.nameTypes.keys());\n }\n /**\n * Get a random name type from the available types.\n * @returns {String}\n */\n getRandomNameType () {\n return randomString(Array.from(this.nameTypes.keys()));\n }\n /**\n * Get the name type\n * @param {String} name_type Name type key or random.\n * @returns {RandomNameType}\n * @throws {RandomNameError}\n */\n _getNameType (name_type) {\n if (name_type === 'random') {\n // randomize a type...\n name_type = this.getRandomNameType();\n }\n const nameType = this.nameTypes.get(name_type);\n if (!nameType) {\n throw new RandomNameError('Invalid name type.');\n }\n return nameType;\n }\n /**\n * Get a name list\n * @param {String} name_type\n * @param {String} subtype\n * @returns {String[]}\n */\n _getNameList (name_type = 'random', subtype = 'mixed') {\n const nameType = this._getNameType(name_type);\n if (subtype === 'surname') {\n if (nameType.surname.length === 0) {\n throw new RandomNameError(`${name_type} type does not have subtype ${subtype}`);\n }\n return nameType.surname;\n }\n const list = nameType.getPersonalNameList(subtype);\n if (list.length === 0) {\n throw new RandomNameError(`${name_type} type does not have subtype ${subtype}`);\n }\n return list;\n }\n /**\n * Select a personal name from one of the lists.\n * @param {String} name_type what list/process to use, else random\n * @param {String} gender\n * @returns {String}\n * @throws {RandomNameError}\n */\n selectPersonalName (name_type = 'random', gender = 'random') {\n const nameList = this._getNameList(name_type, gender);\n return capitalizeName(randomString(nameList));\n }\n /**\n * Select a sur/last name only from one of the lists\n * @param {String} name_type what list/process to use, else random\n * @returns {String} a name\n * @throws {RandomNameError}\n */\n selectSurname (name_type = 'random') {\n const nameList = this._getNameList(name_type, 'surname');\n return capitalizeName(randomString(nameList));\n }\n /**\n * Select a name from one of the lists\n * @param {String} name_type What name list/process to use else random\n * @param {String} gender male, female, random, ''\n * @param {String} style first=first name only, else full name\n * @returns {String} a name\n * @throws {RandomNameError}\n */\n selectName (name_type = 'random', gender = 'random', style = '') {\n const nameType = this._getNameType(name_type);\n const personalNameList = nameType.getPersonalNameList(gender);\n if (personalNameList.length === 0) {\n throw new RandomNameError(`${nameType.key} does not have list for ${gender}`);\n }\n let name = capitalizeName(randomString(personalNameList));\n if (style !== 'first') {\n name += ` ${capitalizeName(randomString(nameType.surname))}`;\n }\n return name.trim();\n }\n /**\n * Create a personal name using markov chains.\n * @param {String} name_type what list/process to use, else random\n * @param {String} gender\n * @returns {String}\n * @throws {RandomNameError}\n */\n createPersonalName (name_type = 'random', gender = 'random') {\n const nameType = this._getNameType(name_type);\n const namelist = nameType.getPersonalNameList(gender);\n if (namelist.length === 0) {\n throw new RandomNameError('Starting name list is empty.');\n }\n const mkey = `${nameType.key}_${gender}`;\n if (!this._markov.isMemoryKeySet(mkey)) {\n namelist.forEach((v) => {\n this._markov.learn(mkey, v);\n });\n }\n return capitalizeName(this._markov.generate(mkey).trim());\n }\n /**\n * Create a sur/last name using markov chains.\n * @param {String} name_type what list/process to use, else random\n * @returns {String} a name\n * @throws {RandomNameError}\n */\n createSurName (name_type = 'random') {\n const nameType = this._getNameType(name_type);\n const namelist = nameType.surname;\n if (namelist.length === 0) {\n throw new RandomNameError('Starting name list is empty.');\n }\n const skey = `${nameType.key}_surname`;\n if (!this._markov.isMemoryKeySet(skey)) {\n namelist.forEach((v) => {\n this._markov.learn(skey, v);\n });\n }\n return capitalizeName(this._markov.generate(skey).trim());\n }\n /**\n * Create a name using Markov chains\n * @param {String} [name_type=random] what list/process to use\n * @param {String} [gender=random] male or female or both\n * @param {String} style first=first name only, else full name\n * @returns {String} a name\n * @throws {RandomNameError}\n */\n createName (name_type = 'random', gender = 'random', style = '') {\n if (name_type === 'random') {\n name_type = this.getRandomNameType();\n }\n let name = this.createPersonalName(name_type, gender);\n if (style !== 'first') {\n name = `${name} ${this.createSurName(name_type)}`;\n }\n return name.trim();\n }\n /**\n * Generate a bunch of names, half male, half female\n * @param {Number} [number=10] number of names in the list (half will be male, half will be female)\n * @param {String} [name_type] type of name or else it will randomly select\n * @param {Bool} [create=false] new names or just pick from list\n * @return {Object} arrays of names inside male/female property\n * @throws {RandomNameError}\n */\n generateList (number = 10, name_type = 'random', create = false) {\n const names = { male: [], female: [] };\n\n for (let i = 1; i <= number; i++) {\n const gender = (i <= Math.ceil(number / 2)) ? 'male' : 'female';\n if (create) {\n names[gender].push(this.createName(name_type, gender));\n } else {\n names[gender].push(this.selectName(name_type, gender));\n }\n }\n return names;\n }\n /**\n * Callback for the TableRoller to generate names from a token.\n * Token parts will be:\n * 0: \"name\" literally\n * 1: type of name (often a nationality/language/ethnicity/etc)\n * 2: gender (\"male\"/\"female\" for which name list to pick from, defaults to randomizing between them).\n * 3: style (\"first\" for a first name, else a full name will be returned)\n * @param {String[]} token_parts Parts of a token: 0 will be the action (name in most cases.)\n * @param {String} full_token Full token wrapped in double braces.\n * @param {RandomTable|null} curtable Current table token was found in (helpful if `this` token is found) or null\n * @returns {String}\n */\n nameTokenCallback (token_parts, full_token = '', curtable = null) {\n let string = '';\n if (!token_parts[1]) {\n token_parts[1] = 'random';\n }\n if (!token_parts[3] || token_parts[3] !== 'first') {\n token_parts[3] = '';\n }\n if (!token_parts[2]) {\n token_parts[2] = 'random';\n }\n try {\n string = this.selectName(token_parts[1], token_parts[2], token_parts[3]);\n } catch (e) {\n if (e instanceof RandomNameError) {\n return '';\n } else {\n throw e;\n }\n }\n return string;\n }\n}\n\nexport default RandonNameGenerator;\n", "export default [\n {\n id: 3,\n key: 'npcs',\n title: 'NPC Characteristics',\n sequence: ['size', 'manner', 'physical_trait', 'quirk', 'speech'],\n tables: {\n size: [\n 'Short',\n 'Thin',\n 'Average',\n 'Tall',\n 'Large',\n 'Pick Two'\n ],\n dress: [\n 'Cleancut',\n 'Filthy',\n 'Fancy',\n 'Practical',\n 'Rich',\n 'Uniform'\n ],\n manner: [\n 'Gregarious',\n 'Icy',\n 'Pious',\n 'Flirtacious / Obsequious',\n 'Aggressive / Critical',\n 'Reserved'\n ],\n physical_trait: [\n 'Missing Limb',\n 'Hairy',\n 'Unusual hair',\n 'Muscular',\n 'Unusually Attractive',\n 'Unusually Ugly'\n ],\n quirk: [\n 'Touchy',\n 'Fingers Talisman [crucifix/ring/gun]',\n 'Ticket/Fidgety',\n 'Bad Sense [sight/hearing]',\n 'Drinks/Smokes Profusely',\n 'Gestures a lot'\n ],\n speech: [\n 'Stutters',\n 'Florid',\n 'Terse',\n 'Curses excessively',\n 'Laughs a lot',\n 'Meandering'\n ]\n }\n },\n {\n id: 4,\n key: 'jobs',\n title: 'NPC Jobs',\n display_opt: [\n { table: 'worker', hide_table: true },\n { table: 'merchant', hide_table: true },\n { table: 'craftsman', hide_table: true },\n { table: 'professional', hide_table: true },\n { table: 'wealthy', hide_table: true },\n { table: 'neer_do_well', hide_table: true }\n ],\n tables: {\n default: [\n { label: 'Worker', subtable: 'worker', print: false },\n { label: 'Merchant', subtable: 'merchant', print: false },\n { label: 'Craftsman', subtable: 'craftsman', print: false },\n { label: 'Professional', subtable: 'professional', print: false },\n { label: 'Wealthy', subtable: 'wealthy', print: false },\n { label: 'Ne\\'er Do Well', subtable: 'neer_do_well', print: false }\n ],\n worker: [\n 'Farmer',\n 'Bartender',\n 'Clerk',\n 'Cowboy',\n 'Soldier',\n 'Laundress',\n 'Prostitute',\n 'Logger',\n 'Parent',\n 'Miner',\n 'Trapper',\n 'Unemployed'\n ],\n merchant: [\n 'General Store',\n 'Bathhouse',\n 'Hotel/Boarding',\n 'Saloon',\n 'Pimp',\n 'Hardware',\n 'Livery',\n 'Foreman/Manager',\n 'Food/Cafe',\n 'Freight',\n 'Haberdasher',\n 'Feed Barn'\n ],\n craftsman: [\n 'Blacksmith',\n 'Wainwright',\n 'Brewer/Distiller',\n 'Saddler',\n 'Tailor',\n 'Barber',\n 'Cook',\n 'Butcher',\n 'Gunsmith',\n 'Sawmill',\n 'Carpenter',\n '?'\n ],\n professional: [\n 'Doctor',\n 'Lawyer',\n 'Newspaper Editor',\n 'Teacher',\n 'Sheriff',\n 'Army Officer',\n 'Preacher',\n 'Telegraph Operator',\n 'Conductor',\n 'Assayer',\n 'Surveyor',\n 'Marshal'\n ],\n wealthy: [\n 'Mine Owner',\n 'Cattle Baron',\n 'Trust Fund Child',\n 'Banker',\n 'Politician',\n 'Nouveau Riche'\n ],\n neer_do_well: [\n 'Gambler',\n 'Addict',\n 'Gunfighter',\n 'Actor',\n 'Musician',\n 'Dancer',\n 'Thug',\n 'Gossip',\n 'Thief',\n 'Gigolo',\n 'Hermit',\n 'Vigilante'\n ]\n }\n },\n {\n id: 5,\n key: 'goals',\n title: 'NPC Goals',\n display_opt: [\n { table: 'long_term', hide_table: true },\n { table: 'short_term', hide_table: true },\n { table: 'secrets', hide_table: true }\n ],\n tables: {\n long_term: [\n 'Wealth',\n 'Safety [family/self]',\n 'Civic Good',\n 'Knowledge/Skill/Craft',\n 'Piety/Charity',\n 'Status/Power',\n 'Peace & Quiet',\n 'Passion'\n ],\n short_term: [\n 'Business Deal',\n 'Pleasure/Addiction',\n 'Property',\n 'Specific Object',\n 'Money',\n 'Job/Work',\n 'Love/Lust/Desire',\n 'Revenge/Hate'\n ],\n secrets: [\n 'Love\u2019s another\u2019s spouse [mutual/unrequited/unexpressed]',\n 'Fled a murder rap [innocent/guilty]',\n 'Fraud at profession',\n 'Hidden vice [dope/alcohol/sex]',\n 'Secret child in town',\n 'Ran with a bad bunch of hombres',\n 'Owes a lot of money / Broke',\n 'Hallucinatory visions [religious/psychotic]'\n ]\n }\n },\n {\n id: 6,\n key: 'relationships',\n title: 'NPC Relationships',\n tables: {\n default: [\n { label: 'Hate', weight: 1 },\n { label: 'Dislike', weight: 5 },\n { label: 'Suspicious', weight: 7 },\n { label: 'Neutral', weight: 10 },\n { label: 'Like', weight: 7 },\n { label: 'Friend', weight: 5 },\n { label: 'Love', weight: 1 }\n ],\n specific: [\n 'Lovers [current/former]',\n 'Enemies [long term/recent/former]',\n 'Rivalry [business/love]',\n 'Loaner/Debtor',\n 'Comrades [current/former] [business/army/mines/banditry/cowboys]',\n 'Employer/Employee [current/former]',\n 'Family [happy/secret/estranged]'\n ],\n faction: [\n 'Community leaders (business owners)',\n 'Pious church goers',\n 'Miners/Loggers [union]',\n 'Ranchers',\n 'The Law (sheriff, deputies, judges, posse members, etc.)',\n 'Homesteaders',\n 'Bandits'\n ]\n }\n },\n {\n id: 7,\n key: 'events',\n title: 'Events',\n tables: {\n regular: [\n 'Wedding [jealousy/drunken revelry]',\n 'Funeral [murder/inheritance]',\n 'Market day [theft/rivalry/strangers]',\n 'Holiday',\n 'Arrival [stage/train]',\n 'Sunday services',\n 'Payday at the [mine/ranch/camp]'\n ],\n crimes: [\n 'Drunken brawl',\n 'Murder',\n 'Theft',\n 'Kidnapping',\n 'Bandit raid',\n 'Shootout',\n '[Stage/train] ambushed',\n 'Arson'\n ],\n natural: [\n 'Resource Depletion',\n 'Sickness',\n 'Rainstorm',\n 'Windstorm',\n 'Fire',\n 'Wild animals'\n ],\n other: [\n 'Territorial dispute [ranchers/farmers/both]',\n 'Heartless capitalist tries to run thing',\n 'A dark past catches up with someone',\n 'Mine collapse/Logging accident',\n 'Election',\n 'Workers strike',\n 'Lynch mob',\n 'New business opens',\n 'Square dance'\n ]\n }\n },\n {\n id: 8,\n key: 'stranger',\n title: 'A Stranger Comes to Town',\n tables: {\n default: [\n 'Gunslinger',\n 'Pinkerton Detective',\n 'Itinerant Preacher',\n '[Son/father/daughter/lover] thought to be dead',\n 'Family member with a [problem/past/secret]',\n 'Ex-con [stranger/relative/old friend]',\n 'Snake Oil Salesman',\n 'Rabblerouser',\n 'Swindler [man/woman/couple/family]',\n 'Rich [worldly/naive] [man/couple/woman] from back East',\n 'Bandit [with/out] his gang',\n 'Family looking to settle',\n 'Destitute men looking for work',\n 'Former soldiers [hungry/crazed/in pursuit/pursued]',\n 'Bounty hunter with a [recent/old] warrant for [townsperson/bandit/gunslinger]',\n 'Traveling salesman',\n '[Troublesome/pitiful] [man/woman] comes to get [family/friend] out of jail',\n 'Politician [campaigning/canvassing]',\n 'Woman fleeing [fiance/husband]',\n 'Travelling Troupe of Actors'\n ]\n }\n },\n {\n id: 10,\n key: 'items',\n title: 'Items',\n tables: {\n default: [\n { label: 'weapons', subtable: 'weapons', print: true },\n { label: 'valuables', subtable: 'valuables', print: true },\n { label: 'clothes', subtable: 'clothes', print: true },\n { label: 'consumables', subtable: 'consumables', print: true },\n { label: 'papers', subtable: 'papers', print: true },\n { label: 'other', subtable: 'other', print: true }\n ],\n weapons: [\n 'Famous gunslinger\u2019s pistol',\n 'Knife',\n 'Gun [shotgun/pistol/rifle]',\n 'Bandolier of bullets',\n 'Cavalry Sword',\n 'Ax',\n 'Whip'\n ],\n valuables: [\n 'Wedding band of [live/dead] spouse',\n 'Thoroughbred horse',\n 'Unopened bottle of imported liquor',\n 'Wallet of bills',\n 'Pouch of gold',\n 'Combination to safe on a photo',\n 'Crucifix'\n ],\n clothes: [\n 'Hat [lady\u2019s/man\u2019s] [fine/plain]',\n 'Boots [new/muddy/decorative]',\n 'Dress [fancy/torn/bloodied]',\n 'Shirt [fancy/bloodstained/torn]',\n 'Gun belt',\n 'Earrings [plain/bejeweled]'\n ],\n consumables: [\n 'Bottle of whisky',\n 'Jerky',\n 'Tobacco pouch and rolling papers',\n 'Canned peaches',\n 'Sweet buns',\n 'Wine bottle'\n ],\n papers: [\n 'Newspaper [local/nearby /far]',\n 'Deed to mines',\n 'Arrest warrant',\n 'Letter [incriminating/sentimental]',\n 'Dime novel',\n 'Daguerrotype'\n ],\n other: [\n 'Dice [loaded]',\n 'Playing cards [fresh/used]',\n 'Keys to [house/business/lockbox/jail]',\n 'Hammer [nails]',\n 'Pipe and matches',\n 'Lantern'\n ]\n }\n },\n {\n id: 9,\n key: 'town_landscape',\n title: 'Landscape Prominent Feature',\n tables: {\n default: [\n 'Town build on the banks of a winding stream crossed by makeshift bridges.',\n 'Town build upon rocky outcrops, street(s) wind back and forth, buildings are all at different levels.',\n 'Town grew around a single giant tree, the rest of the land is flat and barren.',\n 'Town sits in a narrow valley, overlooked by ridges, main road snakes down to town and then back up and out.',\n 'Town built at foot of cliff where the first mine was found.',\n 'Town expanded from a small waterfall and pool amongst tall evergreens.'\n ]\n }\n },\n {\n id: 11,\n key: 'dressing',\n title: 'Set Dressing',\n display_opt: [\n { table: 'outside', hide_table: true },\n { table: 'inside', hide_table: true }\n ],\n tables: {\n outside: [\n 'Balconies',\n 'Boardwalks',\n 'Hitching posts',\n 'Water troughs',\n 'Fences',\n 'Barrels',\n 'Mud Puddles',\n 'Hand scrawled signs',\n 'Water wagon',\n 'Log bridges',\n 'Water wheels',\n 'Framed out buildings',\n 'Tents',\n 'Horses and Wagons',\n 'Posters (Wanted, Ads, Broadsheets)'\n ],\n inside: [\n 'Piano',\n 'Billiard table',\n 'Dart board',\n 'Music box',\n 'Spittoons',\n 'Bed pans',\n 'Paintings [landscape/pretty woman/historical figure]',\n 'Mismatched chairs',\n 'Makeshift tables',\n 'Ladders',\n 'Heavy curtains',\n 'Wash tubs',\n 'Valise filled with dresses',\n 'Old Clock',\n 'Brightly upholstered chair/couch',\n 'Crystal decanter filled with whiskey'\n ]\n }\n },\n {\n id: 1,\n key: 'locations',\n title: 'Locations Outside of Town',\n tables: {\n default: [\n 'Train [in motion/broken down/stopped by blocked tracks]',\n 'Family Farm [abandoned/prospering/failing]',\n 'Cattle Ranch',\n 'Mine [abandoned/active]',\n 'Grazing land [disputed]',\n 'River [rapids]',\n 'Rocky hills',\n 'Deep woods',\n 'Religious camp',\n 'Bandit camp',\n 'Log cabin [abandoned/hideout/hermit]'\n ]\n }\n },\n {\n id: 2,\n key: 'resources',\n title: 'Settlement Resources',\n tables: {\n default: [\n 'Gold',\n 'Lumber',\n 'Farmland',\n 'Water',\n 'Railway',\n 'Furs/Game'\n ]\n }\n },\n {\n id: 12,\n key: 'town_name',\n title: 'Town Names',\n display_opt: [\n { table: 'main', hide_table: true },\n { table: 'ending1', hide_table: true },\n { table: 'ending2', hide_table: true }\n ],\n tables: {\n default: [\n { label: '{{table:this:main}}{{table:this:ending1}}', weight: 4 },\n { label: '{{table:this:main}} {{table:this:ending2}}', weight: 4 },\n { label: 'Fort {{table:this:main}}', weight: 1 }\n ],\n main: [\n 'Hadley',\n 'Smith',\n 'Adams',\n 'Snake',\n 'Elk',\n 'Fire',\n 'Coal',\n 'Oak',\n 'Maple',\n 'Elm',\n 'Wilder',\n 'Jackson',\n 'Washington',\n 'Revere',\n 'Franklin',\n 'Shallow',\n 'Rapid',\n 'Gold',\n 'Summer',\n 'Spring',\n 'Nugget',\n 'Mary'\n ],\n ending1: [\n 'ville',\n 'town',\n 'berg',\n 'woods'\n ],\n ending2: [\n 'Hollow',\n 'Hills',\n 'City',\n 'Falls',\n 'Rapids'\n ]\n }\n }\n];\n", "export default [\n\t{\n\t\t\"key\": \"western\",\n\t\t\"label\": \"Western\",\n\t\t\"male\": [\n\t\t\t\"Alan\",\n\t\t\t\"Conan\",\n\t\t\t\"Daveth\",\n\t\t\t\"Denzel\",\n\t\t\t\"Derrick\",\n\t\t\t\"Hammitt\",\n\t\t\t\"Jermyn\",\n\t\t\t\"Jory\",\n\t\t\t\"Merryn\",\n\t\t\t\"Pasco\",\n\t\t\t\"Tomas\",\n\t\t\t\"Trelawney\",\n\t\t\t\"Tremayne\",\n\t\t\t\"Tristan\",\n \"Abel\",\n\t\t\t\"Abraham\",\n\t\t\t\"Adam\",\n\t\t\t\"Alan\",\n\t\t\t\"Albert\",\n\t\t\t\"Alex\",\n\t\t\t\"Alexandre\",\n\t\t\t\"Alfred\",\n\t\t\t\"Alphonse\",\n\t\t\t\"Anatole\",\n\t\t\t\"Andr\u00E9\",\n\t\t\t\"Anselme\",\n\t\t\t\"Armand\",\n\t\t\t\"Arthur\",\n\t\t\t\"Auguste\",\n\t\t\t\"Barnabus\",\n\t\t\t\"Benjamin\",\n\t\t\t\"Bernard\",\n\t\t\t\"Bertrand\",\n\t\t\t\"Blaise\",\n\t\t\t\"Brice\",\n\t\t\t\"Bruno\",\n\t\t\t\"C\u00E9sar\",\n\t\t\t\"Charles\",\n\t\t\t\"Christian\",\n\t\t\t\"Christophe\",\n\t\t\t\"Claude\",\n\t\t\t\"Cyril\",\n\t\t\t\"Damien\",\n\t\t\t\"Dan\",\n\t\t\t\"Daniel\",\n\t\t\t\"David\",\n\t\t\t\"Denis\",\n\t\t\t\"Didier\",\n\t\t\t\"Dorian\",\n\t\t\t\"Edgar\",\n\t\t\t\"\u00C9mile\",\n\t\t\t\"Emmanuel\",\n\t\t\t\"Ernest\",\n\t\t\t\"Ethan\",\n\t\t\t\"\u00C9tienne\",\n\t\t\t\"Eug\u00E8ne\",\n\t\t\t\"Fabien\",\n\t\t\t\"F\u00E9lix\",\n\t\t\t\"Ferdinand\",\n\t\t\t\"Florent\",\n\t\t\t\"Francis\",\n\t\t\t\"Frank\",\n\t\t\t\"Fred\",\n\t\t\t\"Gabriel\",\n\t\t\t\"Gaspard\",\n\t\t\t\"Geoffrey\",\n\t\t\t\"Georges\",\n\t\t\t\"G\u00E9rard\",\n\t\t\t\"Gilbert\",\n\t\t\t\"Guillaume\",\n\t\t\t\"Gustave\",\n\t\t\t\"Guy\",\n\t\t\t\"Hector\",\n\t\t\t\"Hercule\",\n\t\t\t\"Horace\",\n\t\t\t\"Jason\",\n\t\t\t\"Jean\",\n\t\t\t\"J\u00E9r\u00E9mie\",\n\t\t\t\"J\u00E9r\u00F4me\",\n\t\t\t\"Jess\u00E9\",\n\t\t\t\"Jonathan\",\n\t\t\t\"Joseph\",\n\t\t\t\"Jules\",\n\t\t\t\"Kevin\",\n\t\t\t\"Laurent\",\n\t\t\t\"L\u00E9o\",\n\t\t\t\"L\u00E9on\",\n\t\t\t\"L\u00E9onard\",\n\t\t\t\"Lionel\",\n\t\t\t\"Lou\",\n\t\t\t\"Louis\",\n\t\t\t\"Lucas\",\n\t\t\t\"Manuel\",\n\t\t\t\"Marc\",\n\t\t\t\"Marcel\",\n\t\t\t\"Martin\",\n\t\t\t\"Maurice\",\n\t\t\t\"Maxime\",\n\t\t\t\"Micha\u00EBl\",\n\t\t\t\"Morgan\",\n\t\t\t\"Nathan\",\n\t\t\t\"Nicolas\",\n\t\t\t\"Odilon\",\n\t\t\t\"Oscar\",\n\t\t\t\"Pascal\",\n\t\t\t\"Patrick\",\n\t\t\t\"Paul\",\n\t\t\t\"Philippe\",\n\t\t\t\"Pierre\",\n\t\t\t\"Raoul\",\n\t\t\t\"Rapha\u00EBl\",\n\t\t\t\"Raymond\",\n\t\t\t\"R\u00E9gis\",\n\t\t\t\"Richard\",\n\t\t\t\"Robert\",\n\t\t\t\"Roger\",\n\t\t\t\"Roland\",\n\t\t\t\"Ruben\",\n\t\t\t\"Samson\",\n\t\t\t\"Samuel\",\n\t\t\t\"S\u00E9bastien\",\n\t\t\t\"Serge\",\n\t\t\t\"Simon\",\n\t\t\t\"Th\u00E9o\",\n\t\t\t\"Th\u00E9odore\",\n\t\t\t\"Th\u00E9ophile\",\n\t\t\t\"Thomas\",\n\t\t\t\"Tristan\",\n\t\t\t\"Ulysse\",\n\t\t\t\"Valentin\",\n\t\t\t\"Victor\",\n\t\t\t\"Vincent\",\n\t\t\t\"Xavier\",\n \"Yves\",\n \"Abe\",\n\t\t\t\"Abraham\",\n\t\t\t\"Adam\",\n\t\t\t\"Albert\",\n\t\t\t\"Alex\",\n\t\t\t\"Alexander\",\n\t\t\t\"Alfred\",\n\t\t\t\"Aloysius\",\n\t\t\t\"Andreas\",\n\t\t\t\"Anton\",\n\t\t\t\"Arthur\",\n\t\t\t\"Augustus\",\n\t\t\t\"Bart\",\n\t\t\t\"Ben\",\n\t\t\t\"Benjamin\",\n\t\t\t\"Bernhard\",\n\t\t\t\"Bert\",\n\t\t\t\"Bob\",\n\t\t\t\"Bram\",\n\t\t\t\"Brecht\",\n\t\t\t\"Casper\",\n\t\t\t\"Chris\",\n\t\t\t\"Christiaan\",\n\t\t\t\"Cornelius\",\n\t\t\t\"Damian\",\n\t\t\t\"Dani\u00EBl\",\n\t\t\t\"David\",\n\t\t\t\"Dennis\",\n\t\t\t\"Dick\",\n\t\t\t\"Dirk\",\n\t\t\t\"Ed\",\n\t\t\t\"Edwin\",\n\t\t\t\"Erik\",\n\t\t\t\"Ernst\",\n\t\t\t\"Erwin\",\n\t\t\t\"Fabian\",\n\t\t\t\"Felix\",\n\t\t\t\"Ferdinand\",\n\t\t\t\"Filip\",\n\t\t\t\"Frank\",\n\t\t\t\"Fred\",\n\t\t\t\"Frederik\",\n\t\t\t\"Gerard\",\n\t\t\t\"Gerhard\",\n\t\t\t\"Gerrit\",\n\t\t\t\"Gerry\",\n\t\t\t\"Gilbert\",\n\t\t\t\"Gustaaf\",\n\t\t\t\"Hans\",\n\t\t\t\"Hendrik\",\n\t\t\t\"Herman\",\n\t\t\t\"Hieronymus\",\n\t\t\t\"Hubert\",\n\t\t\t\"Hugo\",\n\t\t\t\"Jacob\",\n\t\t\t\"Jan\",\n\t\t\t\"Jasper\",\n\t\t\t\"Jef\",\n\t\t\t\"Jesse\",\n\t\t\t\"Jonas\",\n\t\t\t\"Jonathan\",\n\t\t\t\"Jordan\",\n\t\t\t\"Karel\",\n\t\t\t\"Kasper\",\n\t\t\t\"Kevin\",\n\t\t\t\"Lambert\",\n\t\t\t\"Lars\",\n\t\t\t\"Leo\",\n\t\t\t\"Leonard\",\n\t\t\t\"Leopold\",\n\t\t\t\"Levi\",\n\t\t\t\"Louis\",\n\t\t\t\"Lucas\",\n\t\t\t\"Marcel\",\n\t\t\t\"Marco\",\n\t\t\t\"Mark\",\n\t\t\t\"Martin\",\n\t\t\t\"Max\",\n\t\t\t\"Michael\",\n\t\t\t\"Mick\",\n\t\t\t\"Nick\",\n\t\t\t\"Nico\",\n\t\t\t\"Olaf\",\n\t\t\t\"Oliver\",\n\t\t\t\"Otto\",\n\t\t\t\"Pascal\",\n\t\t\t\"Paul\",\n\t\t\t\"Peter\",\n\t\t\t\"Philip\",\n\t\t\t\"Rembrandt\",\n\t\t\t\"Richard\",\n\t\t\t\"Rob\",\n\t\t\t\"Robert\",\n\t\t\t\"Robin\",\n\t\t\t\"Roy\",\n\t\t\t\"Ruben\",\n\t\t\t\"Rudolf\",\n\t\t\t\"Rupert\",\n\t\t\t\"Rutger\",\n\t\t\t\"Sebastian\",\n\t\t\t\"Simon\",\n\t\t\t\"Stefan\",\n\t\t\t\"Steven\",\n\t\t\t\"Sven\",\n\t\t\t\"Theo\",\n\t\t\t\"Thomas\",\n\t\t\t\"Tim\",\n\t\t\t\"Tom\",\n\t\t\t\"Vincent\",\n\t\t\t\"Werner\",\n\t\t\t\"Willem\",\n\t\t\t\"Willy\",\n\t\t\t\"Xander\",\n \"Adam\",\n\t\t\t\"Adolf\",\n\t\t\t\"Arnold\",\n\t\t\t\"Bern\",\n\t\t\t\"Baldwin\",\n\t\t\t\"Conrad\",\n\t\t\t\"Constantin\",\n\t\t\t\"Egmund\",\n\t\t\t\"Eric\",\n\t\t\t\"Finn\",\n\t\t\t\"Franco\",\n\t\t\t\"Gerald\",\n\t\t\t\"Gregorio\",\n\t\t\t\"Gunther\",\n\t\t\t\"Henryk\",\n\t\t\t\"Herman\",\n\t\t\t\"Hubert\",\n\t\t\t\"Isaac\",\n\t\t\t\"Johannes\",\n\t\t\t\"Knut\",\n\t\t\t\"Norbert\",\n\t\t\t\"Otto\",\n\t\t\t\"Rainer\",\n\t\t\t\"Richard\",\n\t\t\t\"Rupert\",\n\t\t\t\"Rutger\",\n\t\t\t\"Simon\",\n\t\t\t\"Stefan\",\n\t\t\t\"Waldo\",\n\t\t\t\"Walther\",\n\t\t\t\"Willem\",\n \"akira\",\n\t\t\t\"goro\",\n\t\t\t\"haruki\",\n\t\t\t\"ichiro\",\n\t\t\t\"jiro\",\n\t\t\t\"ken\",\n\t\t\t\"ren\",\n\t\t\t\"shin\",\n\t\t\t\"shiro\",\n\t\t\t\"takashi\",\n \"Aar\u00F3n\",\n \"Abel\",\n \"Alberto\",\n \"Albino\",\n \"Alcides\",\n \"Alejandro\",\n \"Alejo\",\n \"\u00C1lex\",\n \"Alexis\",\n \"Alfonso\",\n \"Alfredo\",\n \"Alonso\",\n \"\u00C1lvaro\",\n \"Amado\",\n \"Amador\",\n \"Anastacio\",\n \"Andr\u00E9s\",\n \"\u00C1ngel\",\n \"Armando\",\n \"Arsenio\",\n \"Arturo\",\n \"Baldo\",\n \"Bartolom\u00E9\",\n \"Bautista\",\n \"Benito\",\n \"Benjam\u00EDn\",\n \"Bernardo\",\n \"Berto\",\n \"Bol\u00EDvar\",\n \"Bonifacio\",\n \"Bruno\",\n \"Buenaventura\",\n \"Carlito\",\n \"Carlos\",\n \"Carmelo\",\n \"C\u00E9sar\",\n \"Che\",\n \"Chuy\",\n \"Clemente\",\n \"Crist\u00F3bal\",\n \"Dar\u00EDo\",\n \"Diego\",\n \"Domingo\",\n \"Edgardo\",\n \"Eduardo\",\n \"Eladio\",\n \"El\u00EDas\",\n \"Emiliano\",\n \"Emilio\",\n \"Enrique\",\n \"Esteban\",\n \"Evaristo\",\n \"Fabio\",\n \"Fabricio\",\n \"Faustino\",\n \"Feliciano\",\n \"Felipe\",\n \"F\u00E9lix\",\n \"Fernando\",\n \"Fidel\",\n \"Flavio\",\n \"Flori\u00E1n\",\n \"Francisco\",\n \"Gabriel\",\n \"Gast\u00F3n\",\n \"Geraldo\",\n \"Gerardo\",\n \"Gonzalo\",\n \"Guadalupe\",\n \"Guillermo\",\n \"Gustavo\",\n \"Gutierre\",\n \"H\u00E9ctor\",\n \"Hern\u00E1n\",\n \"Hernando\",\n \"Hugo\",\n \"Ignacio\",\n \"Isaac\",\n \"Isidoro\",\n \"Jaime\",\n \"Javier\",\n \"Jes\u00FAs\",\n \"Joaquin\",\n \"Joel\",\n \"Jorge\",\n \"Jose\",\n \"Jos\u00E9 Antonio\",\n \"Jos\u00E9 Luis\",\n \"Jos\u00E9 Manuel\",\n \"Juan\",\n \"Juan Carlos\",\n \"Juan Manuel\",\n \"Juan Pablo\",\n \"Julio\",\n \"Leonardo\",\n \"Lorenzo\",\n \"Luciano\",\n \"Lucio\",\n \"Luis\",\n \"Lupe\",\n \"Manolo\",\n \"Manuel\",\n \"Marco\",\n \"Mariano\",\n \"Mario\",\n \"Mateo\",\n \"Miguel\",\n \"Nacho\",\n \"N\u00E9stor\",\n \"Octavio\",\n \"\u00D3scar\",\n \"Pablo\",\n \"Paco\",\n \"Pancho\",\n \"Pedro\",\n \"Pepe\",\n \"Pl\u00E1cido\",\n \"Rafael\",\n \"Ram\u00F3n\",\n \"Ra\u00FAl\",\n \"Reynaldo\",\n \"Ricardo\",\n \"Roberto\",\n \"Rodrigo\",\n \"Salvador\",\n \"Samuel\",\n \"Sancho\",\n \"Santos\",\n \"Sergio\",\n \"Severino\",\n \"Silvio\",\n \"Sim\u00F3n\",\n \"Tito\",\n \"Tom\u00E1s\",\n \"Valent\u00EDn\",\n \"Vicente\",\n \"V\u00EDctor\",\n \"Wilfredo\",\n\t\t],\n\t\t\"female\": [\n \"Adela\",\n\t\t\t\"Agatha\",\n\t\t\t\"Agnes\",\n\t\t\t\"Ava\",\n\t\t\t\"Benedicta\",\n\t\t\t\"Berta\",\n\t\t\t\"Gertrude\",\n\t\t\t\"Helena\",\n\t\t\t\"Olge\",\n\t\t\t\"Sophia\",\n\t\t\t\"Susanne\",\n\t\t\t\"Yolande\",\n \"Agnes\",\n\t\t\t\"Albertina\",\n\t\t\t\"Alexandra\",\n\t\t\t\"Amanda\",\n\t\t\t\"Amber\",\n\t\t\t\"Amelia\",\n\t\t\t\"Angela\",\n\t\t\t\"Angelina\",\n\t\t\t\"Angelique\",\n\t\t\t\"Anita\",\n\t\t\t\"Anna\",\n\t\t\t\"Annabel\",\n\t\t\t\"Anne\",\n\t\t\t\"Annemarie\",\n\t\t\t\"Antonia\",\n\t\t\t\"Augusta\",\n\t\t\t\"Beatrix\",\n\t\t\t\"Brigitta\",\n\t\t\t\"Carla\",\n\t\t\t\"Caroline\",\n\t\t\t\"Catharina\",\n\t\t\t\"Cecilia\",\n\t\t\t\"Charlotte\",\n\t\t\t\"Christina\",\n\t\t\t\"Christine\",\n\t\t\t\"Claudia\",\n\t\t\t\"C\u00E9cile\",\n\t\t\t\"Daphne\",\n\t\t\t\"Debora\",\n\t\t\t\"Denise\",\n\t\t\t\"Diana\",\n\t\t\t\"Dora\",\n\t\t\t\"Dorothea\",\n\t\t\t\"Edith\",\n\t\t\t\"Elisabeth\",\n\t\t\t\"Elise\",\n\t\t\t\"Ellen\",\n\t\t\t\"Emma\",\n\t\t\t\"Esther\",\n\t\t\t\"Eva\",\n\t\t\t\"Eveline\",\n\t\t\t\"Felicia\",\n\t\t\t\"Georgina\",\n\t\t\t\"Gertie\",\n\t\t\t\"Gertrude\",\n\t\t\t\"Hanna\",\n\t\t\t\"Hannah\",\n\t\t\t\"Helena\",\n\t\t\t\"Henrietta\",\n\t\t\t\"Henriette\",\n\t\t\t\"Hilda\",\n\t\t\t\"Hilde\",\n\t\t\t\"Ida\",\n\t\t\t\"Irena\",\n\t\t\t\"Iris\",\n\t\t\t\"Isabella\",\n\t\t\t\"Isabelle\",\n\t\t\t\"Jetta\",\n\t\t\t\"Johanna\",\n\t\t\t\"Julia\",\n\t\t\t\"Juliana\",\n\t\t\t\"Justine\",\n\t\t\t\"Karen\",\n\t\t\t\"Katrina\",\n\t\t\t\"Lara\",\n\t\t\t\"Laura\",\n\t\t\t\"Laurie\",\n\t\t\t\"Linda\",\n\t\t\t\"Lisa\",\n\t\t\t\"Louisa\",\n\t\t\t\"Louise\",\n\t\t\t\"Magda\",\n\t\t\t\"Magdalena\",\n\t\t\t\"Maria\",\n\t\t\t\"Marianne\",\n\t\t\t\"Marilou\",\n\t\t\t\"Maud\",\n\t\t\t\"Melissa\",\n\t\t\t\"Mia\",\n\t\t\t\"Michelle\",\n\t\t\t\"Mina\",\n\t\t\t\"Nicole\",\n\t\t\t\"Nicolet\",\n\t\t\t\"Nora\",\n\t\t\t\"Paula\",\n\t\t\t\"Petra\",\n\t\t\t\"Rachel\",\n\t\t\t\"Rebekka\",\n\t\t\t\"Renate\",\n\t\t\t\"Ren\u00E9e\",\n\t\t\t\"Rosa\",\n\t\t\t\"Rosanne\",\n\t\t\t\"Samantha\",\n\t\t\t\"Sandra\",\n\t\t\t\"Sara\",\n\t\t\t\"Saskia\",\n\t\t\t\"Sophie\",\n\t\t\t\"Susanna\",\n\t\t\t\"Tina\",\n\t\t\t\"Trudy\",\n\t\t\t\"Ursula\",\n\t\t\t\"Vanessa\",\n\t\t\t\"Vera\",\n\t\t\t\"Willemina\",\n\t\t\t\"Wilma\",\n\t\t\t\"Yvonne\",\n\t\t\t\"Zo\u00EB\",\n\t\t\t\"Eva\",\n\t\t\t\"Jenna\",\n\t\t\t\"Gwen\",\n\t\t\t\"Gwenneth\",\n\t\t\t\"Gwynne\",\n\t\t\t\"Jena\",\n\t\t\t\"Kerra\",\n\t\t\t\"Lowenna\",\n\t\t\t\"Merryn\",\n\t\t\t\"Pasca\",\n\t\t\t\"Tamsin\",\n\t\t\t\"Tressa\",\n \"Ad\u00E9la\u00EFde\",\n\t\t\t\"Adeline\",\n\t\t\t\"Agn\u00E8s\",\n\t\t\t\"Alberte\",\n\t\t\t\"Albertine\",\n\t\t\t\"Alex\",\n\t\t\t\"Alexandra\",\n\t\t\t\"Alexandrine\",\n\t\t\t\"Alexis\",\n\t\t\t\"Alice\",\n\t\t\t\"Alix\",\n\t\t\t\"Ana\u00EFs\",\n\t\t\t\"Anastasie\",\n\t\t\t\"Angeline\",\n\t\t\t\"Ang\u00E9lique\",\n\t\t\t\"Anna\",\n\t\t\t\"Annabelle\",\n\t\t\t\"Anne\",\n\t\t\t\"Annette\",\n\t\t\t\"Annie\",\n\t\t\t\"Antoinette\",\n\t\t\t\"Ariel\",\n\t\t\t\"Astrid\",\n\t\t\t\"Augustine\",\n\t\t\t\"Aurore\",\n\t\t\t\"Babette\",\n\t\t\t\"Barbara\",\n\t\t\t\"B\u00E9atrice\",\n\t\t\t\"B\u00E9r\u00E9nice\",\n\t\t\t\"Bernadette\",\n\t\t\t\"Berthe\",\n\t\t\t\"Blanche\",\n\t\t\t\"Brigitte\",\n\t\t\t\"Camille\",\n\t\t\t\"Caroline\",\n\t\t\t\"Cassandra\",\n\t\t\t\"Catherine\",\n\t\t\t\"C\u00E9cile\",\n\t\t\t\"C\u00E9leste\",\n\t\t\t\"Charlotte\",\n\t\t\t\"Chlo\u00E9\",\n\t\t\t\"Christine\",\n\t\t\t\"Claire\",\n\t\t\t\"Clarisse\",\n\t\t\t\"Claudette\",\n\t\t\t\"Cl\u00E9mentine\",\n\t\t\t\"Colette\",\n\t\t\t\"Constance\",\n\t\t\t\"Danielle\",\n\t\t\t\"Daphn\u00E9\",\n\t\t\t\"Daphn\u00E9e\",\n\t\t\t\"Denise\",\n\t\t\t\"Diane\",\n\t\t\t\"Dominique\",\n\t\t\t\"\u00C9dith\",\n\t\t\t\"El\u00E9onore\",\n\t\t\t\"\u00C9lisabeth\",\n\t\t\t\"\u00C9lo\u00EFse\",\n\t\t\t\"Emma\",\n\t\t\t\"Emmanuelle\",\n\t\t\t\"Ernestine\",\n\t\t\t\"Estelle\",\n\t\t\t\"Esther\",\n\t\t\t\"\u00C8ve\",\n\t\t\t\"Eveline\",\n\t\t\t\"Fanny\",\n\t\t\t\"F\u00E9licit\u00E9\",\n\t\t\t\"Fifi\",\n\t\t\t\"Florence\",\n\t\t\t\"Florentine\",\n\t\t\t\"Francine\",\n\t\t\t\"Francis\",\n\t\t\t\"Gabrielle\",\n\t\t\t\"Genevi\u00E8ve\",\n\t\t\t\"Georgette\",\n\t\t\t\"Georgine\",\n\t\t\t\"Gigi\",\n\t\t\t\"Gilberte\",\n\t\t\t\"Gwendoline\",\n\t\t\t\"Hannah\",\n\t\t\t\"Henriette\",\n\t\t\t\"Hortense\",\n\t\t\t\"Ir\u00E8ne\",\n\t\t\t\"Iris\",\n\t\t\t\"Isabelle\",\n\t\t\t\"Jacqueline\",\n\t\t\t\"Jeanette\",\n\t\t\t\"Jeanine\",\n\t\t\t\"Jessica\",\n\t\t\t\"Joanne\",\n\t\t\t\"Jos\u00E9phine\",\n\t\t\t\"Judith\",\n\t\t\t\"Juliane\",\n\t\t\t\"Julie\",\n\t\t\t\"Juliette\",\n\t\t\t\"Justine\",\n\t\t\t\"Lili\",\n\t\t\t\"Lilian\",\n\t\t\t\"Linda\",\n\t\t\t\"Louise\",\n\t\t\t\"Lucille\",\n\t\t\t\"Madeleine\",\n\t\t\t\"Margot\",\n\t\t\t\"Marianne\",\n\t\t\t\"Marie\",\n\t\t\t\"Marilou\",\n\t\t\t\"Marthe\",\n\t\t\t\"M\u00E9lissa\",\n\t\t\t\"M\u00E9lody\",\n\t\t\t\"Michelle\",\n\t\t\t\"Modeste\",\n\t\t\t\"Monique\",\n\t\t\t\"Muriel\",\n\t\t\t\"Nadine\",\n\t\t\t\"Nathalie\",\n\t\t\t\"Nicole\",\n\t\t\t\"Nina\",\n\t\t\t\"Pauline\",\n\t\t\t\"P\u00E9n\u00E9lope\",\n\t\t\t\"Rachel\",\n\t\t\t\"R\u00E9becca\",\n\t\t\t\"Ren\u00E9e\",\n\t\t\t\"Rosalie\",\n\t\t\t\"Rose\",\n\t\t\t\"Rosette\",\n\t\t\t\"Roxanne\",\n\t\t\t\"Sandra\",\n\t\t\t\"Sara\",\n\t\t\t\"Sarah\",\n\t\t\t\"Sophie\",\n\t\t\t\"St\u00E9phanie\",\n\t\t\t\"Suzanne\",\n\t\t\t\"Suzette\",\n\t\t\t\"Sylvie\",\n\t\t\t\"Valentine\",\n\t\t\t\"Violette\",\n\t\t\t\"Virginie\",\n\t\t\t\"Wanda\",\n \"akemi\",\n\t\t\t\"aki\",\n\t\t\t\"akiko\",\n\t\t\t\"akira\",\n\t\t\t\"aya\",\n\t\t\t\"chiyo\",\n\t\t\t\"hana\",\n\t\t\t\"hanako\",\n\t\t\t\"haruka\",\n\t\t\t\"hitomi\",\n\t\t\t\"kasumi\",\n\t\t\t\"keiko\",\n\t\t\t\"mai\",\n\t\t\t\"mariko\",\n\t\t\t\"michiko\",\n\t\t\t\"mitsuko\",\n\t\t\t\"nana\",\n\t\t\t\"naomi\",\n\t\t\t\"natsumi\",\n\t\t\t\"noriko\",\n\t\t\t\"ren\",\n\t\t\t\"rina\",\n\t\t\t\"sakura\",\n\t\t\t\"setsuko\",\n\t\t\t\"yoko\",\n \"Abiga\u00EDl\",\n\t\t\t\"Adelaida\",\n\t\t\t\"Adriana\",\n\t\t\t\"Alexandra\",\n\t\t\t\"Alexis\",\n\t\t\t\"Alicia\",\n\t\t\t\"Alma\",\n\t\t\t\"Amada\",\n\t\t\t\"Amanda\",\n\t\t\t\"Am\u00E9rica\",\n\t\t\t\"Ana\",\n\t\t\t\"Anabel\",\n\t\t\t\"Ana Mar\u00EDa\",\n\t\t\t\"Ana Sof\u00EDa\",\n\t\t\t\"Anastasia\",\n\t\t\t\"Andrea\",\n\t\t\t\"\u00C1ngela\",\n\t\t\t\"Ang\u00E9lica\",\n\t\t\t\"Angelina\",\n\t\t\t\"Anita\",\n\t\t\t\"Ariel\",\n\t\t\t\"Aurelia\",\n\t\t\t\"Beatriz\",\n\t\t\t\"Berta\",\n\t\t\t\"Blanca\",\n\t\t\t\"Camila\",\n\t\t\t\"Carla\",\n\t\t\t\"Carmen\",\n\t\t\t\"Carolina\",\n\t\t\t\"Clara\",\n\t\t\t\"Clementina\",\n\t\t\t\"Conchita\",\n\t\t\t\"Consuela\",\n\t\t\t\"Cristina\",\n\t\t\t\"Dalia\",\n\t\t\t\"Delia\",\n\t\t\t\"Diana\",\n\t\t\t\"Dolores\",\n\t\t\t\"Dominga\",\n\t\t\t\"Dora\",\n\t\t\t\"Dulce\",\n\t\t\t\"Elena\",\n\t\t\t\"Elisa\",\n\t\t\t\"Elodia\",\n\t\t\t\"Elo\u00EDsa\",\n\t\t\t\"Emilia\",\n\t\t\t\"Emma\",\n\t\t\t\"Encarnita\",\n\t\t\t\"Esmeralda\",\n\t\t\t\"Esperanza\",\n\t\t\t\"Esther\",\n\t\t\t\"Eulalia\",\n\t\t\t\"Eva\",\n\t\t\t\"Eva Mar\u00EDa\",\n\t\t\t\"Evangelina\",\n\t\t\t\"Evita\",\n\t\t\t\"Fanny\",\n\t\t\t\"F\u00E1tima\",\n\t\t\t\"Felicia\",\n\t\t\t\"Felipa\",\n\t\t\t\"Flora\",\n\t\t\t\"Florentina\",\n\t\t\t\"Fran\",\n\t\t\t\"Francisca\",\n\t\t\t\"Gabriela\",\n\t\t\t\"Georgina\",\n\t\t\t\"Gertrudis\",\n\t\t\t\"Gisela\",\n\t\t\t\"Gloria\",\n\t\t\t\"Guadalupe\",\n\t\t\t\"Hayd\u00E9e\",\n\t\t\t\"Hilda\",\n\t\t\t\"In\u00E9s\",\n\t\t\t\"Irene\",\n\t\t\t\"Iris\",\n\t\t\t\"Irma\",\n\t\t\t\"Isabela\",\n\t\t\t\"Isidora\",\n\t\t\t\"Jenifer\",\n\t\t\t\"Jennifer\",\n\t\t\t\"Jenny\",\n\t\t\t\"Jessica\",\n\t\t\t\"Johana\",\n\t\t\t\"Josefina\",\n\t\t\t\"Juanita\",\n\t\t\t\"Judith\",\n\t\t\t\"Julia\",\n\t\t\t\"Julieta\",\n\t\t\t\"Justina\",\n\t\t\t\"Laura\",\n\t\t\t\"Leandra\",\n\t\t\t\"Leticia\",\n\t\t\t\"Liliana\",\n\t\t\t\"Lola\",\n\t\t\t\"Lolita\",\n\t\t\t\"Luna\",\n\t\t\t\"Lupe\",\n\t\t\t\"Magdalena\",\n\t\t\t\"Marcela\",\n\t\t\t\"Marcia\",\n\t\t\t\"Margarita\",\n\t\t\t\"Mar\u00EDa\",\n\t\t\t\"Mar\u00EDa Carmen\",\n\t\t\t\"Mar\u00EDa Cristina\",\n\t\t\t\"Mar\u00EDa Dolores\",\n\t\t\t\"Mar\u00EDa Fernanda\",\n\t\t\t\"Mar\u00EDa Guadalupe\",\n\t\t\t\"Mar\u00EDa Jes\u00FAs\",\n\t\t\t\"Mar\u00EDa Jos\u00E9\",\n\t\t\t\"Mar\u00EDa Luisa\",\n\t\t\t\"Mar\u00EDa Manuela\",\n\t\t\t\"Mariana\",\n\t\t\t\"Mar\u00EDa Teresa\",\n\t\t\t\"Marisa\",\n\t\t\t\"Maritza\",\n\t\t\t\"Marta\",\n\t\t\t\"Matilde\",\n\t\t\t\"Mercedes\",\n\t\t\t\"Miriam\",\n\t\t\t\"Modesta\",\n\t\t\t\"M\u00F3nica\",\n\t\t\t\"Nadia\",\n\t\t\t\"Natalia\",\n\t\t\t\"Octavia\",\n\t\t\t\"Ofelia\",\n\t\t\t\"Olga\",\n\t\t\t\"Olivia\",\n\t\t\t\"Oriana\",\n\t\t\t\"Paloma\",\n\t\t\t\"Paola\",\n\t\t\t\"Patricia\",\n\t\t\t\"Paula\",\n\t\t\t\"Paulina\",\n\t\t\t\"Paz\",\n\t\t\t\"Perla\",\n\t\t\t\"Perlita\",\n\t\t\t\"Pilar\",\n\t\t\t\"Priscila\",\n\t\t\t\"Ramona\",\n\t\t\t\"Raquel\",\n\t\t\t\"Regina\",\n\t\t\t\"Remedios\",\n\t\t\t\"Renata\",\n\t\t\t\"Rita\",\n\t\t\t\"Roberta\",\n\t\t\t\"Rosa\",\n\t\t\t\"Rosario\",\n\t\t\t\"Ruth\",\n\t\t\t\"Sandra\",\n\t\t\t\"Sara\",\n\t\t\t\"Selena\",\n\t\t\t\"Silvia\",\n\t\t\t\"Sof\u00EDa\",\n\t\t\t\"Soledad\",\n\t\t\t\"Susana\",\n\t\t\t\"Tamara\",\n\t\t\t\"Teresa\",\n\t\t\t\"\u00DArsula\",\n\t\t\t\"Valentina\",\n\t\t\t\"Valeria\",\n\t\t\t\"Vera\",\n\t\t\t\"Ver\u00F3nica\",\n\t\t\t\"Victoria\",\n\t\t\t\"Violeta\",\n\t\t\t\"Virginia\",\n\t\t\t\"Viviana\",\n\t\t\t\"Yasmina\",\n\t\t\t\"Yolanda\",\n\t\t],\n\t\t\"surname\": [\n\t\t\t\"Ahearn\",\n\t\t\t\"Bell\",\n\t\t\t\"Berryman\",\n\t\t\t\"Boden\",\n\t\t\t\"Bray\",\n\t\t\t\"Brock\",\n\t\t\t\"Burrows\",\n\t\t\t\"Connor\",\n\t\t\t\"Craddick\",\n\t\t\t\"Crocker\",\n\t\t\t\"Deane\",\n\t\t\t\"Drew\",\n\t\t\t\"Evans\",\n\t\t\t\"Fry\",\n\t\t\t\"Gay\",\n\t\t\t\"Godden\",\n\t\t\t\"Goldsworthy\",\n\t\t\t\"Hancock\",\n\t\t\t\"Hart\",\n\t\t\t\"Harvey\",\n\t\t\t\"Hawke\",\n\t\t\t\"Hoskins\",\n\t\t\t\"Hutchens\",\n\t\t\t\"James\",\n\t\t\t\"Jewell\",\n\t\t\t\"Johns\",\n\t\t\t\"Kemp\",\n\t\t\t\"Kent\",\n\t\t\t\"Kinsey\",\n\t\t\t\"Kirby\",\n\t\t\t\"Lowry\",\n\t\t\t\"Lean\",\n\t\t\t\"Lyon\",\n\t\t\t\"May\",\n\t\t\t\"Moon\",\n\t\t\t\"Nance\",\n\t\t\t\"Nicholls\",\n\t\t\t\"Oates\",\n\t\t\t\"Pawley\",\n\t\t\t\"Perrin\",\n\t\t\t\"Phillips\",\n\t\t\t\"Quick\",\n\t\t\t\"Rickard\",\n\t\t\t\"Roach\",\n\t\t\t\"Roberts\",\n\t\t\t\"Rodgers\",\n\t\t\t\"Sanders\",\n\t\t\t\"Symons\",\n\t\t\t\"Stevens\",\n\t\t\t\"Thorne\",\n\t\t\t\"Warren\",\n\t\t\t\"Franke\",\n\t\t\t\"Peeters\",\n\t\t\t\"Aaldenberg\",\n\t\t\t\"Aalders\",\n\t\t\t\"Abram\",\n\t\t\t\"Abrams\",\n\t\t\t\"Acker\",\n\t\t\t\"Addens\",\n\t\t\t\"Adema\",\n\t\t\t\"Ahlers\",\n\t\t\t\"Akkerman\",\n\t\t\t\"Alberda\",\n\t\t\t\"Alberdink\",\n\t\t\t\"Albers\",\n\t\t\t\"Alberts\",\n\t\t\t\"Alders\",\n\t\t\t\"Alting\",\n\t\t\t\"Arntz\",\n\t\t\t\"Baker\",\n\t\t\t\"Banner\",\n\t\t\t\"Beringer\",\n\t\t\t\"Beulens\",\n\t\t\t\"Boer\",\n\t\t\t\"Boon\",\n\t\t\t\"Bosch\",\n\t\t\t\"Brams\",\n\t\t\t\"Brinkerhoff\",\n\t\t\t\"Carman\",\n\t\t\t\"Clark\",\n\t\t\t\"Cuyper\",\n\t\t\t\"Dahl\",\n\t\t\t\"Dahlman\",\n\t\t\t\"De Witte\",\n\t\t\t\"Dirks\",\n\t\t\t\"Dreyer\",\n\t\t\t\"Dykstra\",\n\t\t\t\"Evers\",\n\t\t\t\"Franke\",\n\t\t\t\"Haas\",\n\t\t\t\"Hansen\",\n\t\t\t\"Hendrix\",\n\t\t\t\"Herberts\",\n\t\t\t\"Herman\",\n\t\t\t\"Heyman\",\n\t\t\t\"Holt\",\n\t\t\t\"Hummel\",\n\t\t\t\"Jacobs\",\n\t\t\t\"Jacobson\",\n\t\t\t\"Jansen\",\n\t\t\t\"Jansing\",\n\t\t\t\"Karl\",\n\t\t\t\"King\",\n\t\t\t\"Klein\",\n\t\t\t\"Koning\",\n\t\t\t\"Krantz\",\n\t\t\t\"Lucas\",\n\t\t\t\"Lyon\",\n\t\t\t\"Michel\",\n\t\t\t\"Miller\",\n\t\t\t\"Moore\",\n\t\t\t\"Nagel\",\n\t\t\t\"Peeters\",\n\t\t\t\"Peters\",\n\t\t\t\"Philips\",\n\t\t\t\"Richard\",\n\t\t\t\"Robert\",\n\t\t\t\"Roosevelt\",\n\t\t\t\"Samson\",\n\t\t\t\"Schneider\",\n\t\t\t\"Schuyler\",\n\t\t\t\"Schwarzenberg\",\n\t\t\t\"Seeger\",\n\t\t\t\"Smith\",\n\t\t\t\"Snyder\",\n\t\t\t\"Thomas\",\n\t\t\t\"Van Aalsburg\",\n\t\t\t\"Van Buren\",\n\t\t\t\"Van Der Beek\",\n\t\t\t\"Van Der Veen\",\n\t\t\t\"Van Hassel\",\n\t\t\t\"Van Horn\",\n\t\t\t\"Van Houte\",\n\t\t\t\"fujimoto\",\n\t\t\t\"hayashi\",\n\t\t\t\"kimura\",\n\t\t\t\"kurosawa\",\n\t\t\t\"matsumoto\",\n\t\t\t\"minami\",\n\t\t\t\"suzuki\",\n\t\t\t\"yamaguchi\",\n\t\t\t\"Babineaux\",\n\t\t\t\"Barre\",\n\t\t\t\"Beaufort\",\n\t\t\t\"Beaumont\",\n\t\t\t\"Bellamy\",\n\t\t\t\"Belmont\",\n\t\t\t\"Berger\",\n\t\t\t\"Bernard\",\n\t\t\t\"Blanchard\",\n\t\t\t\"Bonhomme\",\n\t\t\t\"Borde\",\n\t\t\t\"Charpentier\",\n\t\t\t\"Chevalier\",\n\t\t\t\"Colbert\",\n\t\t\t\"Coste\",\n\t\t\t\"David\",\n\t\t\t\"Deforest\",\n\t\t\t\"Delacroix\",\n\t\t\t\"Desroches\",\n\t\t\t\"Dubois\",\n\t\t\t\"Duchamps\",\n\t\t\t\"Dupont\",\n\t\t\t\"Fabian\",\n\t\t\t\"Favreau\",\n\t\t\t\"Fontaine\",\n\t\t\t\"Forest\",\n\t\t\t\"Forestier\",\n\t\t\t\"Fran\u00E7ois\",\n\t\t\t\"Garcon\",\n\t\t\t\"Germain\",\n\t\t\t\"Giles\",\n\t\t\t\"Granger\",\n\t\t\t\"Hardy\",\n\t\t\t\"Harman\",\n\t\t\t\"Herbert\",\n\t\t\t\"Jordan\",\n\t\t\t\"Labelle\",\n\t\t\t\"Lachance\",\n\t\t\t\"Lachapelle\",\n\t\t\t\"Lane\",\n\t\t\t\"Lapointe\",\n\t\t\t\"Larue\",\n\t\t\t\"Laurent\",\n\t\t\t\"Lebeau\",\n\t\t\t\"Leblanc\",\n\t\t\t\"Leclair\",\n\t\t\t\"Leroy\",\n\t\t\t\"Lyon\",\n\t\t\t\"Marchand\",\n\t\t\t\"Martel\",\n\t\t\t\"Martin\",\n\t\t\t\"Montagne\",\n\t\t\t\"Mullins\",\n\t\t\t\"Olivier\",\n\t\t\t\"Page\",\n\t\t\t\"Pettigrew\",\n\t\t\t\"Pierre\",\n\t\t\t\"Renaud\",\n\t\t\t\"Robert\",\n\t\t\t\"Roche\",\n\t\t\t\"Rose\",\n\t\t\t\"Roy\",\n\t\t\t\"Salmon\",\n\t\t\t\"Samson\",\n\t\t\t\"Sargent\",\n\t\t\t\"Sauvage\",\n\t\t\t\"Segal\",\n\t\t\t\"S\u00E9verin\",\n\t\t\t\"Simon\",\n\t\t\t\"Thayer\",\n\t\t\t\"Thomas\",\n\t\t\t\"Tolbert\",\n\t\t\t\"Travers\",\n\t\t\t\"Tremblay\",\n\t\t\t\"Vincent\",\n \"Abel\",\n\t\t\t\"Abraham\",\n\t\t\t\"Acosta\",\n\t\t\t\"Aguilar\",\n\t\t\t\"Alfaro\",\n\t\t\t\"Alonso\",\n\t\t\t\"Alvarado\",\n\t\t\t\"\u00C1lvarez\",\n\t\t\t\"Amador\",\n\t\t\t\"Antonio\",\n\t\t\t\"Ant\u00FAnez\",\n\t\t\t\"Armando\",\n\t\t\t\"Arriola\",\n\t\t\t\"Asturias\",\n\t\t\t\"Banderas\",\n\t\t\t\"Bautista\",\n\t\t\t\"Bello\",\n\t\t\t\"Belmonte\",\n\t\t\t\"Blanco\",\n\t\t\t\"Bol\u00EDvar\",\n\t\t\t\"Bustos\",\n\t\t\t\"Caballero\",\n\t\t\t\"Cabrera\",\n\t\t\t\"Campo\",\n\t\t\t\"Campos\",\n\t\t\t\"Carrasco\",\n\t\t\t\"Castellano\",\n\t\t\t\"Castilla\",\n\t\t\t\"Castillo\",\n\t\t\t\"Castro\",\n\t\t\t\"Cervantes\",\n\t\t\t\"Col\u00F3n\",\n\t\t\t\"Cortez\",\n\t\t\t\"Cruz\",\n\t\t\t\"De la Cruz\",\n\t\t\t\"De Le\u00F3n\",\n\t\t\t\"Delgado\",\n\t\t\t\"Del R\u00EDo\",\n\t\t\t\"D\u00EDaz\",\n\t\t\t\"Dom\u00EDnguez\",\n\t\t\t\"Escarr\u00E0\",\n\t\t\t\"Espinosa\",\n\t\t\t\"Espinoza\",\n\t\t\t\"Esteban\",\n\t\t\t\"Est\u00E9vez\",\n\t\t\t\"Feliciano\",\n\t\t\t\"Fern\u00E1ndez\",\n\t\t\t\"Fierro\",\n\t\t\t\"Figueroa\",\n\t\t\t\"Flores\",\n\t\t\t\"Fontana\",\n\t\t\t\"Franco\",\n\t\t\t\"Fuentes\",\n\t\t\t\"Garc\u00EDa\",\n\t\t\t\"Gaspar\",\n\t\t\t\"Gim\u00E9nez\",\n\t\t\t\"G\u00F3mez\",\n\t\t\t\"Gonzales\",\n\t\t\t\"Gonz\u00E1lez\",\n\t\t\t\"Guti\u00E9rrez\",\n\t\t\t\"Hern\u00E1ndez\",\n\t\t\t\"Herrera\",\n\t\t\t\"Hidalgo\",\n\t\t\t\"Ibarra\",\n\t\t\t\"Ju\u00E1rez\",\n\t\t\t\"Le\u00F3n\",\n\t\t\t\"Lopez\",\n\t\t\t\"Lorenzo\",\n\t\t\t\"Loyola\",\n\t\t\t\"Lucas\",\n\t\t\t\"Luna\",\n\t\t\t\"Machado\",\n\t\t\t\"Marino\",\n\t\t\t\"M\u00E1rquez\",\n\t\t\t\"Mart\u00EDn\",\n\t\t\t\"Mart\u00EDnez\",\n\t\t\t\"Martinez\",\n\t\t\t\"M\u00E9ndez\",\n\t\t\t\"Mendoza\",\n\t\t\t\"Molina\",\n\t\t\t\"Montero\",\n\t\t\t\"Morales\",\n\t\t\t\"Moralez\",\n\t\t\t\"Mu\u00F1oz\",\n\t\t\t\"Navarro\",\n\t\t\t\"Olmos\",\n\t\t\t\"Ortega\",\n\t\t\t\"Padilla\",\n\t\t\t\"Paz\",\n\t\t\t\"P\u00E9rez\",\n\t\t\t\"Perez\",\n\t\t\t\"Quesada\",\n\t\t\t\"Ram\u00EDrez\",\n\t\t\t\"Ramos\",\n\t\t\t\"Reyes\",\n\t\t\t\"R\u00EDos\",\n\t\t\t\"Rivera\",\n\t\t\t\"Rodr\u00EDguez\",\n\t\t\t\"Rodriquez\",\n\t\t\t\"Romero\",\n\t\t\t\"Rosales\",\n\t\t\t\"Rosario\",\n\t\t\t\"Rubio\",\n\t\t\t\"Ruiz\",\n\t\t\t\"Salamanca\",\n\t\t\t\"Salinas\",\n\t\t\t\"S\u00E1nchez\",\n\t\t\t\"Sanchez\",\n\t\t\t\"Santana\",\n\t\t\t\"Santiago\",\n\t\t\t\"Santos\",\n\t\t\t\"Sierra\",\n\t\t\t\"Silva\",\n\t\t\t\"Torres\",\n\t\t\t\"Valencia\",\n\t\t\t\"Vega\",\n\t\t\t\"Vel\u00E1squez\",\n\t\t\t\"Vidal\",\n\t\t]\n\t}\n];\n", "/**\n * @prop {Object} events Store the events here.\n * @prop {Boolean} debug So you can more easily in dev see when events are triggered.\n */\nexport default class EventEmitter {\n constructor () {\n this.events = {};\n this.debug = false;\n }\n /**\n * Get index of listener in the event array.\n * -1 means it isn't there\n * @param {String} event Event to check.\n * @param {Function} listener Listener to check.\n * @return {Number}\n */\n listenerIndex (event, listener) {\n return this.events[event].findIndex((item) => {\n return item.listener === listener;\n });\n }\n /**\n * Listen to an event\n * @param {String} event Name of the event to listen for.\n * @param {Function|Array} listener Callback to trigger for event OR an array of [classname, methodName]\n * @param {Object} boundObj Object to bind the callback to.\n * @return {undefined}\n */\n on (event, listener, boundObj = null) {\n if (typeof listener !== 'function') {\n return;\n }\n this.events[event] = this.events[event] || [];\n if (this.events[event].length > 0) {\n const index = this.listenerIndex(event, listener);\n // Replace the listener if it already exists.\n if (index > -1) {\n this.events[event].splice(index, 1);\n }\n }\n this.events[event].push({ listener: listener, boundObj: boundObj });\n }\n /**\n * Stop listening to an event.\n * Remove event if it was the last listener.\n * @param {String} event Name of the event.\n * @param {Function} listener Callback to remove.\n * @return {undefined}\n */\n off (event, listener) {\n if (Array.isArray(this.events[event])) {\n const index = this.listenerIndex(event, listener);\n if (index === -1) {\n return;\n }\n this.events[event].splice(index, 1);\n if (this.events[event].length === 0) {\n delete this.events[event];\n }\n }\n }\n /**\n * Listen for an event but only trigger it once, then it is removed.\n * @param {String} event Name of the event to listen for.\n * @param {Function} listener Callback to trigger for event.\n * @param {Object} boundObj Object to bind the callback to.\n */\n once (event, listener, boundObj) {\n this.on(event, function wrap () {\n this.off(event, wrap);\n const binder = typeof boundObj === 'undefined' ? this : boundObj;\n listener.apply(binder, arguments);\n });\n }\n /**\n * Trigger an event. This will cause any listeners for that event to be called.\n * Any arguments after the event will be passed on to the callback(s).\n * @param {String} event Event to trigger.\n */\n trigger (event) {\n if (this.debug && console) {\n console.log(`EventEmitter triggered: ${event}`);\n }\n const args = [].slice.call(arguments, 1);\n\n if (Array.isArray(this.events[event])) {\n this.events[event].forEach((listenObj) => {\n const binder = listenObj.boundObj === null ? this : listenObj.boundObj;\n listenObj.listener.apply(binder, args);\n });\n }\n };\n};\n", "import TableRoller from '../../node_modules/rpg-table-randomizer/src/TableRoller.js';\nimport RandomTable from '../../node_modules/rpg-table-randomizer/src/RandomTable.js';\nimport RandomNameGenerator from '../../node_modules/rpg-table-randomizer/src/RandomNameGenerator.js';\nimport RandomNameType from '../../node_modules/rpg-table-randomizer/src/RandomNameType.js';\nimport tables from '../data/tables.js';\nimport names from '../data/names.js';\nimport { rollDie } from '../../node_modules/rpg-table-randomizer/src/dice_roller.js';\nimport EventEmitter from '../models/EventEmitter.js';\n\nconst tableEmitter = new EventEmitter();\nconst tableRoller = new TableRoller({});\nconst randomTables = {};\n\n// Format name data\nconst nameTypes = [];\nnames.forEach((data) => {\n nameTypes.push(new RandomNameType(data));\n});\n// Create a default name generator.\nconst nameGenerator = new RandomNameGenerator({ namedata: nameTypes });\n// Assign it to the name token of the table roller.\ntableRoller.registerTokenType('name', nameGenerator.nameTokenCallback.bind(nameGenerator));\n\ntables.forEach((data) => {\n const key = data.key;\n if (!key) {\n return;\n }\n randomTables[key] = new RandomTable(data);\n});\n/**\n * Get 1 table by it's key.\n * @param key {String} Table key.\n * @returns {RandomTable|null}\n */\nconst getTableByKey = function (key) {\n if (randomTables[key]) {\n return randomTables[key];\n }\n return null;\n};\ntableRoller.setTableKeyLookup(getTableByKey);\n\n/**\n * Get all tables.\n * @returns {RandomTable[]}\n */\nconst getAllTables = function () {\n const arr = [];\n Object.keys(randomTables).forEach((key) => {\n const table = randomTables[key];\n arr.push(table);\n });\n return arr;\n};\n\n/**\n * Get result for a table by its key.\n * @param key {String} table key.\n * @param {String} subtable\n * @returns {RandomTableResultSet|null}\n */\nconst getResultByTableKey = function (key, subtable = '') {\n return tableRoller.getTableResultSetByKey(key, subtable);\n};\n/**\n * Get results from a table using the whole table.\n * @param table {RandomTable}\n * @param {String} subtable\n * @returns {RandomTableResultSet|null}\n */\nconst getResultFromTable = function (table, subtable = '') {\n return tableRoller.getResultSetForTable(table, subtable);\n};\n\n/**\n * Return a name\n * @param, {String} [nameType] Name list to use.\n * @returns {String}\n */\nconst getNPCName = function (nameType) {\n return nameGenerator.selectName(nameType);\n};\n\n/**\n * Convert a token to a result string.\n * @param token RandomTable token string\n * @returns {RandomTableResultSet|RandomTableResultSet[]|DiceResult|String|Any}\n */\nconst convertToken = function (token) {\n return tableRoller.convertToken(token);\n};\n\nexport {\n getAllTables,\n getTableByKey,\n getResultByTableKey,\n getResultFromTable,\n rollDie,\n getNPCName,\n convertToken,\n tableEmitter\n};\n", "import { tableEmitter } from '../services/randomTableService.js';\n\nconst template = document.createElement('template');\ntemplate.innerHTML = `\n \n \n

Hadleyville: Rules Light RPG

\n \n \n`;\n\nclass Header extends HTMLElement {\n constructor () {\n super();\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.appendChild(template.content.cloneNode(true));\n\n this.setAttribute('role', 'header');\n this.showTables = this.dataset.showtables === 'true';\n if (!this.showTables) {\n this.shadowRoot.querySelector('.table-toggle').hidden = true;\n }\n\n this.toggleButton = this.shadowRoot.querySelector('button');\n }\n\n connectedCallback () {\n tableEmitter.on('table:drawer', this._toggleOpenButton.bind(this));\n this.toggleButton.addEventListener('click', this._toggleDrawer.bind(this));\n }\n\n disconnectedCallback () {\n tableEmitter.off('table:drawer', this._toggleOpenButton.bind(this));\n this.toggleButton.removeEventListener('click', this._toggleDrawer.bind(this));\n }\n /**\n * Click event on the toggle button.\n * Triggers event on emitter.\n */\n _toggleDrawer () {\n const open = !this.toggleButton.classList.contains('open');\n tableEmitter.trigger('table:drawer', { open });\n }\n /**\n * Handler for the table:drawer event.\n * @param {Boolean} open\n */\n _toggleOpenButton ({ open }) {\n if (open) {\n this.toggleButton.classList.add('open');\n return;\n }\n this.toggleButton.classList.remove('open');\n }\n};\n\nwindow.customElements.define('had-header', Header);\n\nexport default Header;\n", "const template = document.createElement('template');\ntemplate.innerHTML = `\n\n\n

Written in Mar-Apr 2021 by Derik A. Badman https://derikbadman.com Game info and updates at https://madinkbeard.itch.io/hadleyville

\n`;\n\nclass Footer extends HTMLElement {\n constructor () {\n super();\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.appendChild(template.content.cloneNode(true));\n\n this.setAttribute('role', 'footer');\n }\n\n connectedCallback () {\n }\n\n disconnectedCallback () {\n\n }\n};\n\nwindow.customElements.define('had-footer', Footer);\n\nexport default Footer;\n", "var focusableSelectors = [\n 'a[href]:not([tabindex^=\"-\"])',\n 'area[href]:not([tabindex^=\"-\"])',\n 'input:not([type=\"hidden\"]):not([type=\"radio\"]):not([disabled]):not([tabindex^=\"-\"])',\n 'input[type=\"radio\"]:not([disabled]):not([tabindex^=\"-\"])',\n 'select:not([disabled]):not([tabindex^=\"-\"])',\n 'textarea:not([disabled]):not([tabindex^=\"-\"])',\n 'button:not([disabled]):not([tabindex^=\"-\"])',\n 'iframe:not([tabindex^=\"-\"])',\n 'audio[controls]:not([tabindex^=\"-\"])',\n 'video[controls]:not([tabindex^=\"-\"])',\n '[contenteditable]:not([tabindex^=\"-\"])',\n '[tabindex]:not([tabindex^=\"-\"])',\n];\n\nvar TAB_KEY = 9;\nvar ESCAPE_KEY = 27;\n\n/**\n * Define the constructor to instantiate a dialog\n *\n * @constructor\n * @param {Element} element\n */\nfunction A11yDialog(element) {\n // Prebind the functions that will be bound in addEventListener and\n // removeEventListener to avoid losing references\n this._show = this.show.bind(this);\n this._hide = this.hide.bind(this);\n this._maintainFocus = this._maintainFocus.bind(this);\n this._bindKeypress = this._bindKeypress.bind(this);\n\n this.$el = element;\n this.shown = false;\n this._id = this.$el.getAttribute('data-a11y-dialog') || this.$el.id;\n this._previouslyFocused = null;\n this._listeners = {};\n\n // Initialise everything needed for the dialog to work properly\n this.create();\n}\n\n/**\n * Set up everything necessary for the dialog to be functioning\n *\n * @param {(NodeList | Element | string)} targets\n * @return {this}\n */\nA11yDialog.prototype.create = function () {\n this.$el.setAttribute('aria-hidden', true);\n this.$el.setAttribute('aria-modal', true);\n this.$el.setAttribute('tabindex', -1);\n\n if (!this.$el.hasAttribute('role')) {\n this.$el.setAttribute('role', 'dialog');\n }\n\n // Keep a collection of dialog openers, each of which will be bound a click\n // event listener to open the dialog\n this._openers = $$('[data-a11y-dialog-show=\"' + this._id + '\"]');\n this._openers.forEach(\n function (opener) {\n opener.addEventListener('click', this._show);\n }.bind(this)\n );\n\n // Keep a collection of dialog closers, each of which will be bound a click\n // event listener to close the dialog\n this._closers = $$('[data-a11y-dialog-hide]', this.$el).concat(\n $$('[data-a11y-dialog-hide=\"' + this._id + '\"]')\n );\n this._closers.forEach(\n function (closer) {\n closer.addEventListener('click', this._hide);\n }.bind(this)\n );\n\n // Execute all callbacks registered for the `create` event\n this._fire('create');\n\n return this\n};\n\n/**\n * Show the dialog element, disable all the targets (siblings), trap the\n * current focus within it, listen for some specific key presses and fire all\n * registered callbacks for `show` event\n *\n * @param {Event} event\n * @return {this}\n */\nA11yDialog.prototype.show = function (event) {\n // If the dialog is already open, abort\n if (this.shown) {\n return this\n }\n\n // Keep a reference to the currently focused element to be able to restore\n // it later\n this._previouslyFocused = document.activeElement;\n this.$el.removeAttribute('aria-hidden');\n this.shown = true;\n\n // Set the focus to the dialog element\n moveFocusToDialog(this.$el);\n\n // Bind a focus event listener to the body element to make sure the focus\n // stays trapped inside the dialog while open, and start listening for some\n // specific key presses (TAB and ESC)\n document.body.addEventListener('focus', this._maintainFocus, true);\n document.addEventListener('keydown', this._bindKeypress);\n\n // Execute all callbacks registered for the `show` event\n this._fire('show', event);\n\n return this\n};\n\n/**\n * Hide the dialog element, enable all the targets (siblings), restore the\n * focus to the previously active element, stop listening for some specific\n * key presses and fire all registered callbacks for `hide` event\n *\n * @param {Event} event\n * @return {this}\n */\nA11yDialog.prototype.hide = function (event) {\n // If the dialog is already closed, abort\n if (!this.shown) {\n return this\n }\n\n this.shown = false;\n this.$el.setAttribute('aria-hidden', 'true');\n\n // If there was a focused element before the dialog was opened (and it has a\n // `focus` method), restore the focus back to it\n // See: https://github.com/KittyGiraudel/a11y-dialog/issues/108\n if (this._previouslyFocused && this._previouslyFocused.focus) {\n this._previouslyFocused.focus();\n }\n\n // Remove the focus event listener to the body element and stop listening\n // for specific key presses\n document.body.removeEventListener('focus', this._maintainFocus, true);\n document.removeEventListener('keydown', this._bindKeypress);\n\n // Execute all callbacks registered for the `hide` event\n this._fire('hide', event);\n\n return this\n};\n\n/**\n * Destroy the current instance (after making sure the dialog has been hidden)\n * and remove all associated listeners from dialog openers and closers\n *\n * @return {this}\n */\nA11yDialog.prototype.destroy = function () {\n // Hide the dialog to avoid destroying an open instance\n this.hide();\n\n // Remove the click event listener from all dialog openers\n this._openers.forEach(\n function (opener) {\n opener.removeEventListener('click', this._show);\n }.bind(this)\n );\n\n // Remove the click event listener from all dialog closers\n this._closers.forEach(\n function (closer) {\n closer.removeEventListener('click', this._hide);\n }.bind(this)\n );\n\n // Execute all callbacks registered for the `destroy` event\n this._fire('destroy');\n\n // Keep an object of listener types mapped to callback functions\n this._listeners = {};\n\n return this\n};\n\n/**\n * Register a new callback for the given event type\n *\n * @param {string} type\n * @param {Function} handler\n */\nA11yDialog.prototype.on = function (type, handler) {\n if (typeof this._listeners[type] === 'undefined') {\n this._listeners[type] = [];\n }\n\n this._listeners[type].push(handler);\n\n return this\n};\n\n/**\n * Unregister an existing callback for the given event type\n *\n * @param {string} type\n * @param {Function} handler\n */\nA11yDialog.prototype.off = function (type, handler) {\n var index = (this._listeners[type] || []).indexOf(handler);\n\n if (index > -1) {\n this._listeners[type].splice(index, 1);\n }\n\n return this\n};\n\n/**\n * Iterate over all registered handlers for given type and call them all with\n * the dialog element as first argument, event as second argument (if any). Also\n * dispatch a custom event on the DOM element itself to make it possible to\n * react to the lifecycle of auto-instantiated dialogs.\n *\n * @access private\n * @param {string} type\n * @param {Event} event\n */\nA11yDialog.prototype._fire = function (type, event) {\n var listeners = this._listeners[type] || [];\n var domEvent = new CustomEvent(type, { detail: event });\n\n this.$el.dispatchEvent(domEvent);\n\n listeners.forEach(\n function (listener) {\n listener(this.$el, event);\n }.bind(this)\n );\n};\n\n/**\n * Private event handler used when listening to some specific key presses\n * (namely ESCAPE and TAB)\n *\n * @access private\n * @param {Event} event\n */\nA11yDialog.prototype._bindKeypress = function (event) {\n // This is an escape hatch in case there are nested dialogs, so the keypresses\n // are only reacted to for the most recent one\n if (!this.$el.contains(document.activeElement)) return\n\n // If the dialog is shown and the ESCAPE key is being pressed, prevent any\n // further effects from the ESCAPE key and hide the dialog, unless its role\n // is 'alertdialog', which should be modal\n if (\n this.shown &&\n event.which === ESCAPE_KEY &&\n this.$el.getAttribute('role') !== 'alertdialog'\n ) {\n event.preventDefault();\n this.hide(event);\n }\n\n // If the dialog is shown and the TAB key is being pressed, make sure the\n // focus stays trapped within the dialog element\n if (this.shown && event.which === TAB_KEY) {\n trapTabKey(this.$el, event);\n }\n};\n\n/**\n * Private event handler used when making sure the focus stays within the\n * currently open dialog\n *\n * @access private\n * @param {Event} event\n */\nA11yDialog.prototype._maintainFocus = function (event) {\n // If the dialog is shown and the focus is not within a dialog element (either\n // this one or another one in case of nested dialogs) or within an element\n // with the `data-a11y-dialog-focus-trap-ignore` attribute, move it back to\n // its first focusable child.\n // See: https://github.com/KittyGiraudel/a11y-dialog/issues/177\n if (\n this.shown &&\n !event.target.closest('[aria-modal=\"true\"]') &&\n !event.target.closest('[data-a11y-dialog-ignore-focus-trap]')\n ) {\n moveFocusToDialog(this.$el);\n }\n};\n\n/**\n * Convert a NodeList into an array\n *\n * @param {NodeList} collection\n * @return {Array}\n */\nfunction toArray(collection) {\n return Array.prototype.slice.call(collection)\n}\n\n/**\n * Query the DOM for nodes matching the given selector, scoped to context (or\n * the whole document)\n *\n * @param {String} selector\n * @param {Element} [context = document]\n * @return {Array}\n */\nfunction $$(selector, context) {\n return toArray((context || document).querySelectorAll(selector))\n}\n\n/**\n * Set the focus to the first element with `autofocus` with the element or the\n * element itself\n *\n * @param {Element} node\n */\nfunction moveFocusToDialog(node) {\n var focused = node.querySelector('[autofocus]') || node;\n\n focused.focus();\n}\n\n/**\n * Get the focusable children of the given element\n *\n * @param {Element} node\n * @return {Array}\n */\nfunction getFocusableChildren(node) {\n return $$(focusableSelectors.join(','), node).filter(function (child) {\n return !!(\n child.offsetWidth ||\n child.offsetHeight ||\n child.getClientRects().length\n )\n })\n}\n\n/**\n * Trap the focus inside the given element\n *\n * @param {Element} node\n * @param {Event} event\n */\nfunction trapTabKey(node, event) {\n var focusableChildren = getFocusableChildren(node);\n var focusedItemIndex = focusableChildren.indexOf(document.activeElement);\n\n // If the SHIFT key is being pressed while tabbing (moving backwards) and\n // the currently focused item is the first one, move the focus to the last\n // focusable item from the dialog element\n if (event.shiftKey && focusedItemIndex === 0) {\n focusableChildren[focusableChildren.length - 1].focus();\n event.preventDefault();\n // If the SHIFT key is not being pressed (moving forwards) and the currently\n // focused item is the last one, move the focus to the first focusable item\n // from the dialog element\n } else if (\n !event.shiftKey &&\n focusedItemIndex === focusableChildren.length - 1\n ) {\n focusableChildren[0].focus();\n event.preventDefault();\n }\n}\n\nfunction instantiateDialogs() {\n $$('[data-a11y-dialog]').forEach(function (node) {\n new A11yDialog(node);\n });\n}\n\nif (typeof document !== 'undefined') {\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', instantiateDialogs);\n } else {\n if (window.requestAnimationFrame) {\n window.requestAnimationFrame(instantiateDialogs);\n } else {\n window.setTimeout(instantiateDialogs, 16);\n }\n }\n}\n\nexport { A11yDialog as default };\n", "const errors = {\n\t0: \"Illegal state\",\n\t1: \"Immer drafts cannot have computed properties\",\n\t2: \"This object has been frozen and should not be mutated\",\n\t3(data: any) {\n\t\treturn (\n\t\t\t\"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? \" +\n\t\t\tdata\n\t\t)\n\t},\n\t4: \"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.\",\n\t5: \"Immer forbids circular references\",\n\t6: \"The first or second argument to `produce` must be a function\",\n\t7: \"The third argument to `produce` must be a function or undefined\",\n\t8: \"First argument to `createDraft` must be a plain object, an array, or an immerable object\",\n\t9: \"First argument to `finishDraft` must be a draft returned by `createDraft`\",\n\t10: \"The given draft is already finalized\",\n\t11: \"Object.defineProperty() cannot be used on an Immer draft\",\n\t12: \"Object.setPrototypeOf() cannot be used on an Immer draft\",\n\t13: \"Immer only supports deleting array indices\",\n\t14: \"Immer only supports setting array indices and the 'length' property\",\n\t15(path: string) {\n\t\treturn \"Cannot apply patch, path doesn't resolve: \" + path\n\t},\n\t16: 'Sets cannot have \"replace\" patches.',\n\t17(op: string) {\n\t\treturn \"Unsupported patch operation: \" + op\n\t},\n\t18(plugin: string) {\n\t\treturn `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \\`enable${plugin}()\\` when initializing your application.`\n\t},\n\t20: \"Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available\",\n\t21(thing: string) {\n\t\treturn `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${thing}'`\n\t},\n\t22(thing: string) {\n\t\treturn `'current' expects a draft, got: ${thing}`\n\t},\n\t23(thing: string) {\n\t\treturn `'original' expects a draft, got: ${thing}`\n\t},\n\t24: \"Patching reserved attributes like __proto__, prototype and constructor is not allowed\"\n} as const\n\nexport function die(error: keyof typeof errors, ...args: any[]): never {\n\tif (__DEV__) {\n\t\tconst e = errors[error]\n\t\tconst msg = !e\n\t\t\t? \"unknown error nr: \" + error\n\t\t\t: typeof e === \"function\"\n\t\t\t? e.apply(null, args as any)\n\t\t\t: e\n\t\tthrow new Error(`[Immer] ${msg}`)\n\t}\n\tthrow new Error(\n\t\t`[Immer] minified error nr: ${error}${\n\t\t\targs.length ? \" \" + args.map(s => `'${s}'`).join(\",\") : \"\"\n\t\t}. Find the full error at: https://bit.ly/3cXEKWf`\n\t)\n}\n", "import {\n\tDRAFT_STATE,\n\tDRAFTABLE,\n\thasSet,\n\tObjectish,\n\tDrafted,\n\tAnyObject,\n\tAnyMap,\n\tAnySet,\n\tImmerState,\n\thasMap,\n\tArchtype,\n\tdie\n} from \"../internal\"\n\n/** Returns true if the given value is an Immer draft */\n/*#__PURE__*/\nexport function isDraft(value: any): boolean {\n\treturn !!value && !!value[DRAFT_STATE]\n}\n\n/** Returns true if the given value can be drafted by Immer */\n/*#__PURE__*/\nexport function isDraftable(value: any): boolean {\n\tif (!value) return false\n\treturn (\n\t\tisPlainObject(value) ||\n\t\tArray.isArray(value) ||\n\t\t!!value[DRAFTABLE] ||\n\t\t!!value.constructor[DRAFTABLE] ||\n\t\tisMap(value) ||\n\t\tisSet(value)\n\t)\n}\n\nconst objectCtorString = Object.prototype.constructor.toString()\n/*#__PURE__*/\nexport function isPlainObject(value: any): boolean {\n\tif (!value || typeof value !== \"object\") return false\n\tconst proto = Object.getPrototypeOf(value)\n\tif (proto === null) {\n\t\treturn true\n\t}\n\tconst Ctor =\n\t\tObject.hasOwnProperty.call(proto, \"constructor\") && proto.constructor\n\n\tif (Ctor === Object) return true\n\n\treturn (\n\t\ttypeof Ctor == \"function\" &&\n\t\tFunction.toString.call(Ctor) === objectCtorString\n\t)\n}\n\n/** Get the underlying object that is represented by the given draft */\n/*#__PURE__*/\nexport function original(value: T): T | undefined\nexport function original(value: Drafted): any {\n\tif (!isDraft(value)) die(23, value)\n\treturn value[DRAFT_STATE].base_\n}\n\n/*#__PURE__*/\nexport const ownKeys: (target: AnyObject) => PropertyKey[] =\n\ttypeof Reflect !== \"undefined\" && Reflect.ownKeys\n\t\t? Reflect.ownKeys\n\t\t: typeof Object.getOwnPropertySymbols !== \"undefined\"\n\t\t? obj =>\n\t\t\t\tObject.getOwnPropertyNames(obj).concat(\n\t\t\t\t\tObject.getOwnPropertySymbols(obj) as any\n\t\t\t\t)\n\t\t: /* istanbul ignore next */ Object.getOwnPropertyNames\n\nexport const getOwnPropertyDescriptors =\n\tObject.getOwnPropertyDescriptors ||\n\tfunction getOwnPropertyDescriptors(target: any) {\n\t\t// Polyfill needed for Hermes and IE, see https://github.com/facebook/hermes/issues/274\n\t\tconst res: any = {}\n\t\townKeys(target).forEach(key => {\n\t\t\tres[key] = Object.getOwnPropertyDescriptor(target, key)\n\t\t})\n\t\treturn res\n\t}\n\nexport function each(\n\tobj: T,\n\titer: (key: string | number, value: any, source: T) => void,\n\tenumerableOnly?: boolean\n): void\nexport function each(obj: any, iter: any, enumerableOnly = false) {\n\tif (getArchtype(obj) === Archtype.Object) {\n\t\t;(enumerableOnly ? Object.keys : ownKeys)(obj).forEach(key => {\n\t\t\tif (!enumerableOnly || typeof key !== \"symbol\") iter(key, obj[key], obj)\n\t\t})\n\t} else {\n\t\tobj.forEach((entry: any, index: any) => iter(index, entry, obj))\n\t}\n}\n\n/*#__PURE__*/\nexport function getArchtype(thing: any): Archtype {\n\t/* istanbul ignore next */\n\tconst state: undefined | ImmerState = thing[DRAFT_STATE]\n\treturn state\n\t\t? state.type_ > 3\n\t\t\t? state.type_ - 4 // cause Object and Array map back from 4 and 5\n\t\t\t: (state.type_ as any) // others are the same\n\t\t: Array.isArray(thing)\n\t\t? Archtype.Array\n\t\t: isMap(thing)\n\t\t? Archtype.Map\n\t\t: isSet(thing)\n\t\t? Archtype.Set\n\t\t: Archtype.Object\n}\n\n/*#__PURE__*/\nexport function has(thing: any, prop: PropertyKey): boolean {\n\treturn getArchtype(thing) === Archtype.Map\n\t\t? thing.has(prop)\n\t\t: Object.prototype.hasOwnProperty.call(thing, prop)\n}\n\n/*#__PURE__*/\nexport function get(thing: AnyMap | AnyObject, prop: PropertyKey): any {\n\t// @ts-ignore\n\treturn getArchtype(thing) === Archtype.Map ? thing.get(prop) : thing[prop]\n}\n\n/*#__PURE__*/\nexport function set(thing: any, propOrOldValue: PropertyKey, value: any) {\n\tconst t = getArchtype(thing)\n\tif (t === Archtype.Map) thing.set(propOrOldValue, value)\n\telse if (t === Archtype.Set) {\n\t\tthing.delete(propOrOldValue)\n\t\tthing.add(value)\n\t} else thing[propOrOldValue] = value\n}\n\n/*#__PURE__*/\nexport function is(x: any, y: any): boolean {\n\t// From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js\n\tif (x === y) {\n\t\treturn x !== 0 || 1 / x === 1 / y\n\t} else {\n\t\treturn x !== x && y !== y\n\t}\n}\n\n/*#__PURE__*/\nexport function isMap(target: any): target is AnyMap {\n\treturn hasMap && target instanceof Map\n}\n\n/*#__PURE__*/\nexport function isSet(target: any): target is AnySet {\n\treturn hasSet && target instanceof Set\n}\n/*#__PURE__*/\nexport function latest(state: ImmerState): any {\n\treturn state.copy_ || state.base_\n}\n\n/*#__PURE__*/\nexport function shallowCopy(base: any) {\n\tif (Array.isArray(base)) return Array.prototype.slice.call(base)\n\tconst descriptors = getOwnPropertyDescriptors(base)\n\tdelete descriptors[DRAFT_STATE as any]\n\tlet keys = ownKeys(descriptors)\n\tfor (let i = 0; i < keys.length; i++) {\n\t\tconst key: any = keys[i]\n\t\tconst desc = descriptors[key]\n\t\tif (desc.writable === false) {\n\t\t\tdesc.writable = true\n\t\t\tdesc.configurable = true\n\t\t}\n\t\t// like object.assign, we will read any _own_, get/set accessors. This helps in dealing\n\t\t// with libraries that trap values, like mobx or vue\n\t\t// unlike object.assign, non-enumerables will be copied as well\n\t\tif (desc.get || desc.set)\n\t\t\tdescriptors[key] = {\n\t\t\t\tconfigurable: true,\n\t\t\t\twritable: true, // could live with !!desc.set as well here...\n\t\t\t\tenumerable: desc.enumerable,\n\t\t\t\tvalue: base[key]\n\t\t\t}\n\t}\n\treturn Object.create(Object.getPrototypeOf(base), descriptors)\n}\n\n/**\n * Freezes draftable objects. Returns the original object.\n * By default freezes shallowly, but if the second argument is `true` it will freeze recursively.\n *\n * @param obj\n * @param deep\n */\nexport function freeze(obj: T, deep?: boolean): T\nexport function freeze(obj: any, deep: boolean = false): T {\n\tif (isFrozen(obj) || isDraft(obj) || !isDraftable(obj)) return obj\n\tif (getArchtype(obj) > 1 /* Map or Set */) {\n\t\tobj.set = obj.add = obj.clear = obj.delete = dontMutateFrozenCollections as any\n\t}\n\tObject.freeze(obj)\n\tif (deep) each(obj, (key, value) => freeze(value, true), true)\n\treturn obj\n}\n\nfunction dontMutateFrozenCollections() {\n\tdie(2)\n}\n\nexport function isFrozen(obj: any): boolean {\n\tif (obj == null || typeof obj !== \"object\") return true\n\t// See #600, IE dies on non-objects in Object.isFrozen\n\treturn Object.isFrozen(obj)\n}\n", "import {\n\tImmerState,\n\tPatch,\n\tImmerScope,\n\tDrafted,\n\tAnyObject,\n\tImmerBaseState,\n\tAnyMap,\n\tAnySet,\n\tProxyType,\n\tdie\n} from \"../internal\"\n\n/** Plugin utilities */\nconst plugins: {\n\tPatches?: {\n\t\tgeneratePatches_(\n\t\t\tstate: ImmerState,\n\t\t\tbasePath: PatchPath,\n\t\t\tpatches: Patch[],\n\t\t\tinversePatches: Patch[]\n\t\t): void\n\t\tgenerateReplacementPatches_(\n\t\t\trootState: ImmerState,\n\t\t\treplacement: any,\n\t\t\tpatches: Patch[],\n\t\t\tinversePatches: Patch[]\n\t\t): void\n\t\tapplyPatches_(draft: T, patches: Patch[]): T\n\t}\n\tES5?: {\n\t\twillFinalizeES5_(scope: ImmerScope, result: any, isReplaced: boolean): void\n\t\tcreateES5Proxy_(\n\t\t\tbase: T,\n\t\t\tparent?: ImmerState\n\t\t): Drafted\n\t\thasChanges_(state: ES5ArrayState | ES5ObjectState): boolean\n\t}\n\tMapSet?: {\n\t\tproxyMap_(target: T, parent?: ImmerState): T\n\t\tproxySet_(target: T, parent?: ImmerState): T\n\t}\n} = {}\n\ntype Plugins = typeof plugins\n\nexport function getPlugin(\n\tpluginKey: K\n): Exclude {\n\tconst plugin = plugins[pluginKey]\n\tif (!plugin) {\n\t\tdie(18, pluginKey)\n\t}\n\t// @ts-ignore\n\treturn plugin\n}\n\nexport function loadPlugin(\n\tpluginKey: K,\n\timplementation: Plugins[K]\n): void {\n\tif (!plugins[pluginKey]) plugins[pluginKey] = implementation\n}\n\n/** ES5 Plugin */\n\ninterface ES5BaseState extends ImmerBaseState {\n\tassigned_: {[key: string]: any}\n\tparent_?: ImmerState\n\trevoked_: boolean\n}\n\nexport interface ES5ObjectState extends ES5BaseState {\n\ttype_: ProxyType.ES5Object\n\tdraft_: Drafted\n\tbase_: AnyObject\n\tcopy_: AnyObject | null\n}\n\nexport interface ES5ArrayState extends ES5BaseState {\n\ttype_: ProxyType.ES5Array\n\tdraft_: Drafted\n\tbase_: any\n\tcopy_: any\n}\n\n/** Map / Set plugin */\n\nexport interface MapState extends ImmerBaseState {\n\ttype_: ProxyType.Map\n\tcopy_: AnyMap | undefined\n\tassigned_: Map | undefined\n\tbase_: AnyMap\n\trevoked_: boolean\n\tdraft_: Drafted\n}\n\nexport interface SetState extends ImmerBaseState {\n\ttype_: ProxyType.Set\n\tcopy_: AnySet | undefined\n\tbase_: AnySet\n\tdrafts_: Map // maps the original value to the draft value in the new set\n\trevoked_: boolean\n\tdraft_: Drafted\n}\n\n/** Patches plugin */\n\nexport type PatchPath = (string | number)[]\n", "import {\n\tPatch,\n\tPatchListener,\n\tDrafted,\n\tImmer,\n\tDRAFT_STATE,\n\tImmerState,\n\tProxyType,\n\tgetPlugin\n} from \"../internal\"\nimport {die} from \"../utils/errors\"\n\n/** Each scope represents a `produce` call. */\n\nexport interface ImmerScope {\n\tpatches_?: Patch[]\n\tinversePatches_?: Patch[]\n\tcanAutoFreeze_: boolean\n\tdrafts_: any[]\n\tparent_?: ImmerScope\n\tpatchListener_?: PatchListener\n\timmer_: Immer\n\tunfinalizedDrafts_: number\n}\n\nlet currentScope: ImmerScope | undefined\n\nexport function getCurrentScope() {\n\tif (__DEV__ && !currentScope) die(0)\n\treturn currentScope!\n}\n\nfunction createScope(\n\tparent_: ImmerScope | undefined,\n\timmer_: Immer\n): ImmerScope {\n\treturn {\n\t\tdrafts_: [],\n\t\tparent_,\n\t\timmer_,\n\t\t// Whenever the modified draft contains a draft from another scope, we\n\t\t// need to prevent auto-freezing so the unowned draft can be finalized.\n\t\tcanAutoFreeze_: true,\n\t\tunfinalizedDrafts_: 0\n\t}\n}\n\nexport function usePatchesInScope(\n\tscope: ImmerScope,\n\tpatchListener?: PatchListener\n) {\n\tif (patchListener) {\n\t\tgetPlugin(\"Patches\") // assert we have the plugin\n\t\tscope.patches_ = []\n\t\tscope.inversePatches_ = []\n\t\tscope.patchListener_ = patchListener\n\t}\n}\n\nexport function revokeScope(scope: ImmerScope) {\n\tleaveScope(scope)\n\tscope.drafts_.forEach(revokeDraft)\n\t// @ts-ignore\n\tscope.drafts_ = null\n}\n\nexport function leaveScope(scope: ImmerScope) {\n\tif (scope === currentScope) {\n\t\tcurrentScope = scope.parent_\n\t}\n}\n\nexport function enterScope(immer: Immer) {\n\treturn (currentScope = createScope(currentScope, immer))\n}\n\nfunction revokeDraft(draft: Drafted) {\n\tconst state: ImmerState = draft[DRAFT_STATE]\n\tif (\n\t\tstate.type_ === ProxyType.ProxyObject ||\n\t\tstate.type_ === ProxyType.ProxyArray\n\t)\n\t\tstate.revoke_()\n\telse state.revoked_ = true\n}\n", "import {\n\tImmerScope,\n\tDRAFT_STATE,\n\tisDraftable,\n\tNOTHING,\n\tPatchPath,\n\teach,\n\thas,\n\tfreeze,\n\tImmerState,\n\tisDraft,\n\tSetState,\n\tset,\n\tProxyType,\n\tgetPlugin,\n\tdie,\n\trevokeScope,\n\tisFrozen,\n\tshallowCopy\n} from \"../internal\"\n\nexport function processResult(result: any, scope: ImmerScope) {\n\tscope.unfinalizedDrafts_ = scope.drafts_.length\n\tconst baseDraft = scope.drafts_![0]\n\tconst isReplaced = result !== undefined && result !== baseDraft\n\tif (!scope.immer_.useProxies_)\n\t\tgetPlugin(\"ES5\").willFinalizeES5_(scope, result, isReplaced)\n\tif (isReplaced) {\n\t\tif (baseDraft[DRAFT_STATE].modified_) {\n\t\t\trevokeScope(scope)\n\t\t\tdie(4)\n\t\t}\n\t\tif (isDraftable(result)) {\n\t\t\t// Finalize the result in case it contains (or is) a subset of the draft.\n\t\t\tresult = finalize(scope, result)\n\t\t\tif (!scope.parent_) maybeFreeze(scope, result)\n\t\t}\n\t\tif (scope.patches_) {\n\t\t\tgetPlugin(\"Patches\").generateReplacementPatches_(\n\t\t\t\tbaseDraft[DRAFT_STATE],\n\t\t\t\tresult,\n\t\t\t\tscope.patches_,\n\t\t\t\tscope.inversePatches_!\n\t\t\t)\n\t\t}\n\t} else {\n\t\t// Finalize the base draft.\n\t\tresult = finalize(scope, baseDraft, [])\n\t}\n\trevokeScope(scope)\n\tif (scope.patches_) {\n\t\tscope.patchListener_!(scope.patches_, scope.inversePatches_!)\n\t}\n\treturn result !== NOTHING ? result : undefined\n}\n\nfunction finalize(rootScope: ImmerScope, value: any, path?: PatchPath) {\n\t// Don't recurse in tho recursive data structures\n\tif (isFrozen(value)) return value\n\n\tconst state: ImmerState = value[DRAFT_STATE]\n\t// A plain object, might need freezing, might contain drafts\n\tif (!state) {\n\t\teach(\n\t\t\tvalue,\n\t\t\t(key, childValue) =>\n\t\t\t\tfinalizeProperty(rootScope, state, value, key, childValue, path),\n\t\t\ttrue // See #590, don't recurse into non-enumerable of non drafted objects\n\t\t)\n\t\treturn value\n\t}\n\t// Never finalize drafts owned by another scope.\n\tif (state.scope_ !== rootScope) return value\n\t// Unmodified draft, return the (frozen) original\n\tif (!state.modified_) {\n\t\tmaybeFreeze(rootScope, state.base_, true)\n\t\treturn state.base_\n\t}\n\t// Not finalized yet, let's do that now\n\tif (!state.finalized_) {\n\t\tstate.finalized_ = true\n\t\tstate.scope_.unfinalizedDrafts_--\n\t\tconst result =\n\t\t\t// For ES5, create a good copy from the draft first, with added keys and without deleted keys.\n\t\t\tstate.type_ === ProxyType.ES5Object || state.type_ === ProxyType.ES5Array\n\t\t\t\t? (state.copy_ = shallowCopy(state.draft_))\n\t\t\t\t: state.copy_\n\t\t// Finalize all children of the copy\n\t\t// For sets we clone before iterating, otherwise we can get in endless loop due to modifying during iteration, see #628\n\t\t// Although the original test case doesn't seem valid anyway, so if this in the way we can turn the next line\n\t\t// back to each(result, ....)\n\t\teach(\n\t\t\tstate.type_ === ProxyType.Set ? new Set(result) : result,\n\t\t\t(key, childValue) =>\n\t\t\t\tfinalizeProperty(rootScope, state, result, key, childValue, path)\n\t\t)\n\t\t// everything inside is frozen, we can freeze here\n\t\tmaybeFreeze(rootScope, result, false)\n\t\t// first time finalizing, let's create those patches\n\t\tif (path && rootScope.patches_) {\n\t\t\tgetPlugin(\"Patches\").generatePatches_(\n\t\t\t\tstate,\n\t\t\t\tpath,\n\t\t\t\trootScope.patches_,\n\t\t\t\trootScope.inversePatches_!\n\t\t\t)\n\t\t}\n\t}\n\treturn state.copy_\n}\n\nfunction finalizeProperty(\n\trootScope: ImmerScope,\n\tparentState: undefined | ImmerState,\n\ttargetObject: any,\n\tprop: string | number,\n\tchildValue: any,\n\trootPath?: PatchPath\n) {\n\tif (__DEV__ && childValue === targetObject) die(5)\n\tif (isDraft(childValue)) {\n\t\tconst path =\n\t\t\trootPath &&\n\t\t\tparentState &&\n\t\t\tparentState!.type_ !== ProxyType.Set && // Set objects are atomic since they have no keys.\n\t\t\t!has((parentState as Exclude).assigned_!, prop) // Skip deep patches for assigned keys.\n\t\t\t\t? rootPath!.concat(prop)\n\t\t\t\t: undefined\n\t\t// Drafts owned by `scope` are finalized here.\n\t\tconst res = finalize(rootScope, childValue, path)\n\t\tset(targetObject, prop, res)\n\t\t// Drafts from another scope must prevented to be frozen\n\t\t// if we got a draft back from finalize, we're in a nested produce and shouldn't freeze\n\t\tif (isDraft(res)) {\n\t\t\trootScope.canAutoFreeze_ = false\n\t\t} else return\n\t}\n\t// Search new objects for unfinalized drafts. Frozen objects should never contain drafts.\n\tif (isDraftable(childValue) && !isFrozen(childValue)) {\n\t\tif (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {\n\t\t\t// optimization: if an object is not a draft, and we don't have to\n\t\t\t// deepfreeze everything, and we are sure that no drafts are left in the remaining object\n\t\t\t// cause we saw and finalized all drafts already; we can stop visiting the rest of the tree.\n\t\t\t// This benefits especially adding large data tree's without further processing.\n\t\t\t// See add-data.js perf test\n\t\t\treturn\n\t\t}\n\t\tfinalize(rootScope, childValue)\n\t\t// immer deep freezes plain objects, so if there is no parent state, we freeze as well\n\t\tif (!parentState || !parentState.scope_.parent_)\n\t\t\tmaybeFreeze(rootScope, childValue)\n\t}\n}\n\nfunction maybeFreeze(scope: ImmerScope, value: any, deep = false) {\n\tif (scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {\n\t\tfreeze(value, deep)\n\t}\n}\n", "import {\n\teach,\n\thas,\n\tis,\n\tisDraftable,\n\tshallowCopy,\n\tlatest,\n\tImmerBaseState,\n\tImmerState,\n\tDrafted,\n\tAnyObject,\n\tAnyArray,\n\tObjectish,\n\tgetCurrentScope,\n\tDRAFT_STATE,\n\tdie,\n\tcreateProxy,\n\tProxyType\n} from \"../internal\"\n\ninterface ProxyBaseState extends ImmerBaseState {\n\tassigned_: {\n\t\t[property: string]: boolean\n\t}\n\tparent_?: ImmerState\n\trevoke_(): void\n}\n\nexport interface ProxyObjectState extends ProxyBaseState {\n\ttype_: ProxyType.ProxyObject\n\tbase_: any\n\tcopy_: any\n\tdraft_: Drafted\n}\n\nexport interface ProxyArrayState extends ProxyBaseState {\n\ttype_: ProxyType.ProxyArray\n\tbase_: AnyArray\n\tcopy_: AnyArray | null\n\tdraft_: Drafted\n}\n\ntype ProxyState = ProxyObjectState | ProxyArrayState\n\n/**\n * Returns a new draft of the `base` object.\n *\n * The second argument is the parent draft-state (used internally).\n */\nexport function createProxyProxy(\n\tbase: T,\n\tparent?: ImmerState\n): Drafted {\n\tconst isArray = Array.isArray(base)\n\tconst state: ProxyState = {\n\t\ttype_: isArray ? ProxyType.ProxyArray : (ProxyType.ProxyObject as any),\n\t\t// Track which produce call this is associated with.\n\t\tscope_: parent ? parent.scope_ : getCurrentScope()!,\n\t\t// True for both shallow and deep changes.\n\t\tmodified_: false,\n\t\t// Used during finalization.\n\t\tfinalized_: false,\n\t\t// Track which properties have been assigned (true) or deleted (false).\n\t\tassigned_: {},\n\t\t// The parent draft state.\n\t\tparent_: parent,\n\t\t// The base state.\n\t\tbase_: base,\n\t\t// The base proxy.\n\t\tdraft_: null as any, // set below\n\t\t// The base copy with any updated values.\n\t\tcopy_: null,\n\t\t// Called by the `produce` function.\n\t\trevoke_: null as any,\n\t\tisManual_: false\n\t}\n\n\t// the traps must target something, a bit like the 'real' base.\n\t// but also, we need to be able to determine from the target what the relevant state is\n\t// (to avoid creating traps per instance to capture the state in closure,\n\t// and to avoid creating weird hidden properties as well)\n\t// So the trick is to use 'state' as the actual 'target'! (and make sure we intercept everything)\n\t// Note that in the case of an array, we put the state in an array to have better Reflect defaults ootb\n\tlet target: T = state as any\n\tlet traps: ProxyHandler> = objectTraps\n\tif (isArray) {\n\t\ttarget = [state] as any\n\t\ttraps = arrayTraps\n\t}\n\n\tconst {revoke, proxy} = Proxy.revocable(target, traps)\n\tstate.draft_ = proxy as any\n\tstate.revoke_ = revoke\n\treturn proxy as any\n}\n\n/**\n * Object drafts\n */\nexport const objectTraps: ProxyHandler = {\n\tget(state, prop) {\n\t\tif (prop === DRAFT_STATE) return state\n\n\t\tconst source = latest(state)\n\t\tif (!has(source, prop)) {\n\t\t\t// non-existing or non-own property...\n\t\t\treturn readPropFromProto(state, source, prop)\n\t\t}\n\t\tconst value = source[prop]\n\t\tif (state.finalized_ || !isDraftable(value)) {\n\t\t\treturn value\n\t\t}\n\t\t// Check for existing draft in modified state.\n\t\t// Assigned values are never drafted. This catches any drafts we created, too.\n\t\tif (value === peek(state.base_, prop)) {\n\t\t\tprepareCopy(state)\n\t\t\treturn (state.copy_![prop as any] = createProxy(\n\t\t\t\tstate.scope_.immer_,\n\t\t\t\tvalue,\n\t\t\t\tstate\n\t\t\t))\n\t\t}\n\t\treturn value\n\t},\n\thas(state, prop) {\n\t\treturn prop in latest(state)\n\t},\n\townKeys(state) {\n\t\treturn Reflect.ownKeys(latest(state))\n\t},\n\tset(\n\t\tstate: ProxyObjectState,\n\t\tprop: string /* strictly not, but helps TS */,\n\t\tvalue\n\t) {\n\t\tconst desc = getDescriptorFromProto(latest(state), prop)\n\t\tif (desc?.set) {\n\t\t\t// special case: if this write is captured by a setter, we have\n\t\t\t// to trigger it with the correct context\n\t\t\tdesc.set.call(state.draft_, value)\n\t\t\treturn true\n\t\t}\n\t\tif (!state.modified_) {\n\t\t\t// the last check is because we need to be able to distinguish setting a non-existing to undefined (which is a change)\n\t\t\t// from setting an existing property with value undefined to undefined (which is not a change)\n\t\t\tconst current = peek(latest(state), prop)\n\t\t\t// special case, if we assigning the original value to a draft, we can ignore the assignment\n\t\t\tconst currentState: ProxyObjectState = current?.[DRAFT_STATE]\n\t\t\tif (currentState && currentState.base_ === value) {\n\t\t\t\tstate.copy_![prop] = value\n\t\t\t\tstate.assigned_[prop] = false\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif (is(value, current) && (value !== undefined || has(state.base_, prop)))\n\t\t\t\treturn true\n\t\t\tprepareCopy(state)\n\t\t\tmarkChanged(state)\n\t\t}\n\n\t\tif (\n\t\t\tstate.copy_![prop] === value &&\n\t\t\t// special case: NaN\n\t\t\ttypeof value !== \"number\" &&\n\t\t\t// special case: handle new props with value 'undefined'\n\t\t\t(value !== undefined || prop in state.copy_)\n\t\t)\n\t\t\treturn true\n\n\t\t// @ts-ignore\n\t\tstate.copy_![prop] = value\n\t\tstate.assigned_[prop] = true\n\t\treturn true\n\t},\n\tdeleteProperty(state, prop: string) {\n\t\t// The `undefined` check is a fast path for pre-existing keys.\n\t\tif (peek(state.base_, prop) !== undefined || prop in state.base_) {\n\t\t\tstate.assigned_[prop] = false\n\t\t\tprepareCopy(state)\n\t\t\tmarkChanged(state)\n\t\t} else {\n\t\t\t// if an originally not assigned property was deleted\n\t\t\tdelete state.assigned_[prop]\n\t\t}\n\t\t// @ts-ignore\n\t\tif (state.copy_) delete state.copy_[prop]\n\t\treturn true\n\t},\n\t// Note: We never coerce `desc.value` into an Immer draft, because we can't make\n\t// the same guarantee in ES5 mode.\n\tgetOwnPropertyDescriptor(state, prop) {\n\t\tconst owner = latest(state)\n\t\tconst desc = Reflect.getOwnPropertyDescriptor(owner, prop)\n\t\tif (!desc) return desc\n\t\treturn {\n\t\t\twritable: true,\n\t\t\tconfigurable: state.type_ !== ProxyType.ProxyArray || prop !== \"length\",\n\t\t\tenumerable: desc.enumerable,\n\t\t\tvalue: owner[prop]\n\t\t}\n\t},\n\tdefineProperty() {\n\t\tdie(11)\n\t},\n\tgetPrototypeOf(state) {\n\t\treturn Object.getPrototypeOf(state.base_)\n\t},\n\tsetPrototypeOf() {\n\t\tdie(12)\n\t}\n}\n\n/**\n * Array drafts\n */\n\nconst arrayTraps: ProxyHandler<[ProxyArrayState]> = {}\neach(objectTraps, (key, fn) => {\n\t// @ts-ignore\n\tarrayTraps[key] = function() {\n\t\targuments[0] = arguments[0][0]\n\t\treturn fn.apply(this, arguments)\n\t}\n})\narrayTraps.deleteProperty = function(state, prop) {\n\tif (__DEV__ && isNaN(parseInt(prop as any))) die(13)\n\treturn objectTraps.deleteProperty!.call(this, state[0], prop)\n}\narrayTraps.set = function(state, prop, value) {\n\tif (__DEV__ && prop !== \"length\" && isNaN(parseInt(prop as any))) die(14)\n\treturn objectTraps.set!.call(this, state[0], prop, value, state[0])\n}\n\n// Access a property without creating an Immer draft.\nfunction peek(draft: Drafted, prop: PropertyKey) {\n\tconst state = draft[DRAFT_STATE]\n\tconst source = state ? latest(state) : draft\n\treturn source[prop]\n}\n\nfunction readPropFromProto(state: ImmerState, source: any, prop: PropertyKey) {\n\tconst desc = getDescriptorFromProto(source, prop)\n\treturn desc\n\t\t? `value` in desc\n\t\t\t? desc.value\n\t\t\t: // This is a very special case, if the prop is a getter defined by the\n\t\t\t // prototype, we should invoke it with the draft as context!\n\t\t\t desc.get?.call(state.draft_)\n\t\t: undefined\n}\n\nfunction getDescriptorFromProto(\n\tsource: any,\n\tprop: PropertyKey\n): PropertyDescriptor | undefined {\n\t// 'in' checks proto!\n\tif (!(prop in source)) return undefined\n\tlet proto = Object.getPrototypeOf(source)\n\twhile (proto) {\n\t\tconst desc = Object.getOwnPropertyDescriptor(proto, prop)\n\t\tif (desc) return desc\n\t\tproto = Object.getPrototypeOf(proto)\n\t}\n\treturn undefined\n}\n\nexport function markChanged(state: ImmerState) {\n\tif (!state.modified_) {\n\t\tstate.modified_ = true\n\t\tif (state.parent_) {\n\t\t\tmarkChanged(state.parent_)\n\t\t}\n\t}\n}\n\nexport function prepareCopy(state: {base_: any; copy_: any}) {\n\tif (!state.copy_) {\n\t\tstate.copy_ = shallowCopy(state.base_)\n\t}\n}\n", "import {\n\tIProduceWithPatches,\n\tIProduce,\n\tImmerState,\n\tDrafted,\n\tisDraftable,\n\tprocessResult,\n\tPatch,\n\tObjectish,\n\tDRAFT_STATE,\n\tDraft,\n\tPatchListener,\n\tisDraft,\n\tisMap,\n\tisSet,\n\tcreateProxyProxy,\n\tgetPlugin,\n\tdie,\n\thasProxies,\n\tenterScope,\n\trevokeScope,\n\tleaveScope,\n\tusePatchesInScope,\n\tgetCurrentScope,\n\tNOTHING,\n\tfreeze,\n\tcurrent\n} from \"../internal\"\n\ninterface ProducersFns {\n\tproduce: IProduce\n\tproduceWithPatches: IProduceWithPatches\n}\n\nexport class Immer implements ProducersFns {\n\tuseProxies_: boolean = hasProxies\n\n\tautoFreeze_: boolean = true\n\n\tconstructor(config?: {useProxies?: boolean; autoFreeze?: boolean}) {\n\t\tif (typeof config?.useProxies === \"boolean\")\n\t\t\tthis.setUseProxies(config!.useProxies)\n\t\tif (typeof config?.autoFreeze === \"boolean\")\n\t\t\tthis.setAutoFreeze(config!.autoFreeze)\n\t}\n\n\t/**\n\t * The `produce` function takes a value and a \"recipe function\" (whose\n\t * return value often depends on the base state). The recipe function is\n\t * free to mutate its first argument however it wants. All mutations are\n\t * only ever applied to a __copy__ of the base state.\n\t *\n\t * Pass only a function to create a \"curried producer\" which relieves you\n\t * from passing the recipe function every time.\n\t *\n\t * Only plain objects and arrays are made mutable. All other objects are\n\t * considered uncopyable.\n\t *\n\t * Note: This function is __bound__ to its `Immer` instance.\n\t *\n\t * @param {any} base - the initial state\n\t * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified\n\t * @param {Function} patchListener - optional function that will be called with all the patches produced here\n\t * @returns {any} a new state, or the initial state if nothing was modified\n\t */\n\tproduce: IProduce = (base: any, recipe?: any, patchListener?: any) => {\n\t\t// curried invocation\n\t\tif (typeof base === \"function\" && typeof recipe !== \"function\") {\n\t\t\tconst defaultBase = recipe\n\t\t\trecipe = base\n\n\t\t\tconst self = this\n\t\t\treturn function curriedProduce(\n\t\t\t\tthis: any,\n\t\t\t\tbase = defaultBase,\n\t\t\t\t...args: any[]\n\t\t\t) {\n\t\t\t\treturn self.produce(base, (draft: Drafted) => recipe.call(this, draft, ...args)) // prettier-ignore\n\t\t\t}\n\t\t}\n\n\t\tif (typeof recipe !== \"function\") die(6)\n\t\tif (patchListener !== undefined && typeof patchListener !== \"function\")\n\t\t\tdie(7)\n\n\t\tlet result\n\n\t\t// Only plain objects, arrays, and \"immerable classes\" are drafted.\n\t\tif (isDraftable(base)) {\n\t\t\tconst scope = enterScope(this)\n\t\t\tconst proxy = createProxy(this, base, undefined)\n\t\t\tlet hasError = true\n\t\t\ttry {\n\t\t\t\tresult = recipe(proxy)\n\t\t\t\thasError = false\n\t\t\t} finally {\n\t\t\t\t// finally instead of catch + rethrow better preserves original stack\n\t\t\t\tif (hasError) revokeScope(scope)\n\t\t\t\telse leaveScope(scope)\n\t\t\t}\n\t\t\tif (typeof Promise !== \"undefined\" && result instanceof Promise) {\n\t\t\t\treturn result.then(\n\t\t\t\t\tresult => {\n\t\t\t\t\t\tusePatchesInScope(scope, patchListener)\n\t\t\t\t\t\treturn processResult(result, scope)\n\t\t\t\t\t},\n\t\t\t\t\terror => {\n\t\t\t\t\t\trevokeScope(scope)\n\t\t\t\t\t\tthrow error\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\t}\n\t\t\tusePatchesInScope(scope, patchListener)\n\t\t\treturn processResult(result, scope)\n\t\t} else if (!base || typeof base !== \"object\") {\n\t\t\tresult = recipe(base)\n\t\t\tif (result === NOTHING) return undefined\n\t\t\tif (result === undefined) result = base\n\t\t\tif (this.autoFreeze_) freeze(result, true)\n\t\t\treturn result\n\t\t} else die(21, base)\n\t}\n\n\tproduceWithPatches: IProduceWithPatches = (\n\t\targ1: any,\n\t\targ2?: any,\n\t\targ3?: any\n\t): any => {\n\t\tif (typeof arg1 === \"function\") {\n\t\t\treturn (state: any, ...args: any[]) =>\n\t\t\t\tthis.produceWithPatches(state, (draft: any) => arg1(draft, ...args))\n\t\t}\n\n\t\tlet patches: Patch[], inversePatches: Patch[]\n\t\tconst nextState = this.produce(arg1, arg2, (p: Patch[], ip: Patch[]) => {\n\t\t\tpatches = p\n\t\t\tinversePatches = ip\n\t\t})\n\t\treturn [nextState, patches!, inversePatches!]\n\t}\n\n\tcreateDraft(base: T): Draft {\n\t\tif (!isDraftable(base)) die(8)\n\t\tif (isDraft(base)) base = current(base)\n\t\tconst scope = enterScope(this)\n\t\tconst proxy = createProxy(this, base, undefined)\n\t\tproxy[DRAFT_STATE].isManual_ = true\n\t\tleaveScope(scope)\n\t\treturn proxy as any\n\t}\n\n\tfinishDraft>(\n\t\tdraft: D,\n\t\tpatchListener?: PatchListener\n\t): D extends Draft ? T : never {\n\t\tconst state: ImmerState = draft && (draft as any)[DRAFT_STATE]\n\t\tif (__DEV__) {\n\t\t\tif (!state || !state.isManual_) die(9)\n\t\t\tif (state.finalized_) die(10)\n\t\t}\n\t\tconst {scope_: scope} = state\n\t\tusePatchesInScope(scope, patchListener)\n\t\treturn processResult(undefined, scope)\n\t}\n\n\t/**\n\t * Pass true to automatically freeze all copies created by Immer.\n\t *\n\t * By default, auto-freezing is enabled.\n\t */\n\tsetAutoFreeze(value: boolean) {\n\t\tthis.autoFreeze_ = value\n\t}\n\n\t/**\n\t * Pass true to use the ES2015 `Proxy` class when creating drafts, which is\n\t * always faster than using ES5 proxies.\n\t *\n\t * By default, feature detection is used, so calling this is rarely necessary.\n\t */\n\tsetUseProxies(value: boolean) {\n\t\tif (value && !hasProxies) {\n\t\t\tdie(20)\n\t\t}\n\t\tthis.useProxies_ = value\n\t}\n\n\tapplyPatches(base: T, patches: Patch[]): T {\n\t\t// If a patch replaces the entire state, take that replacement as base\n\t\t// before applying patches\n\t\tlet i: number\n\t\tfor (i = patches.length - 1; i >= 0; i--) {\n\t\t\tconst patch = patches[i]\n\t\t\tif (patch.path.length === 0 && patch.op === \"replace\") {\n\t\t\t\tbase = patch.value\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t// If there was a patch that replaced the entire state, start from the\n\t\t// patch after that.\n\t\tif (i > -1) {\n\t\t\tpatches = patches.slice(i + 1)\n\t\t}\n\n\t\tconst applyPatchesImpl = getPlugin(\"Patches\").applyPatches_\n\t\tif (isDraft(base)) {\n\t\t\t// N.B: never hits if some patch a replacement, patches are never drafts\n\t\t\treturn applyPatchesImpl(base, patches)\n\t\t}\n\t\t// Otherwise, produce a copy of the base state.\n\t\treturn this.produce(base, (draft: Drafted) =>\n\t\t\tapplyPatchesImpl(draft, patches)\n\t\t)\n\t}\n}\n\nexport function createProxy(\n\timmer: Immer,\n\tvalue: T,\n\tparent?: ImmerState\n): Drafted {\n\t// precondition: createProxy should be guarded by isDraftable, so we know we can safely draft\n\tconst draft: Drafted = isMap(value)\n\t\t? getPlugin(\"MapSet\").proxyMap_(value, parent)\n\t\t: isSet(value)\n\t\t? getPlugin(\"MapSet\").proxySet_(value, parent)\n\t\t: immer.useProxies_\n\t\t? createProxyProxy(value, parent)\n\t\t: getPlugin(\"ES5\").createES5Proxy_(value, parent)\n\n\tconst scope = parent ? parent.scope_ : getCurrentScope()\n\tscope.drafts_.push(draft)\n\treturn draft\n}\n", "import {\n\tdie,\n\tisDraft,\n\tshallowCopy,\n\teach,\n\tDRAFT_STATE,\n\tget,\n\tset,\n\tImmerState,\n\tisDraftable,\n\tArchtype,\n\tgetArchtype,\n\tgetPlugin\n} from \"../internal\"\n\n/** Takes a snapshot of the current state of a draft and finalizes it (but without freezing). This is a great utility to print the current state during debugging (no Proxies in the way). The output of current can also be safely leaked outside the producer. */\nexport function current(value: T): T\nexport function current(value: any): any {\n\tif (!isDraft(value)) die(22, value)\n\treturn currentImpl(value)\n}\n\nfunction currentImpl(value: any): any {\n\tif (!isDraftable(value)) return value\n\tconst state: ImmerState | undefined = value[DRAFT_STATE]\n\tlet copy: any\n\tconst archType = getArchtype(value)\n\tif (state) {\n\t\tif (\n\t\t\t!state.modified_ &&\n\t\t\t(state.type_ < 4 || !getPlugin(\"ES5\").hasChanges_(state as any))\n\t\t)\n\t\t\treturn state.base_\n\t\t// Optimization: avoid generating new drafts during copying\n\t\tstate.finalized_ = true\n\t\tcopy = copyHelper(value, archType)\n\t\tstate.finalized_ = false\n\t} else {\n\t\tcopy = copyHelper(value, archType)\n\t}\n\n\teach(copy, (key, childValue) => {\n\t\tif (state && get(state.base_, key) === childValue) return // no need to copy or search in something that didn't change\n\t\tset(copy, key, currentImpl(childValue))\n\t})\n\t// In the future, we might consider freezing here, based on the current settings\n\treturn archType === Archtype.Set ? new Set(copy) : copy\n}\n\nfunction copyHelper(value: any, archType: number): any {\n\t// creates a shallow copy, even if it is a map or set\n\tswitch (archType) {\n\t\tcase Archtype.Map:\n\t\t\treturn new Map(value)\n\t\tcase Archtype.Set:\n\t\t\t// Set will be cloned as array temporarily, so that we can replace individual items\n\t\t\treturn Array.from(value)\n\t}\n\treturn shallowCopy(value)\n}\n", "import {\n\tImmerState,\n\tDrafted,\n\tES5ArrayState,\n\tES5ObjectState,\n\teach,\n\thas,\n\tisDraft,\n\tlatest,\n\tDRAFT_STATE,\n\tis,\n\tloadPlugin,\n\tImmerScope,\n\tProxyType,\n\tgetCurrentScope,\n\tdie,\n\tmarkChanged,\n\tobjectTraps,\n\townKeys,\n\tgetOwnPropertyDescriptors\n} from \"../internal\"\n\ntype ES5State = ES5ArrayState | ES5ObjectState\n\nexport function enableES5() {\n\tfunction willFinalizeES5_(\n\t\tscope: ImmerScope,\n\t\tresult: any,\n\t\tisReplaced: boolean\n\t) {\n\t\tif (!isReplaced) {\n\t\t\tif (scope.patches_) {\n\t\t\t\tmarkChangesRecursively(scope.drafts_![0])\n\t\t\t}\n\t\t\t// This is faster when we don't care about which attributes changed.\n\t\t\tmarkChangesSweep(scope.drafts_)\n\t\t}\n\t\t// When a child draft is returned, look for changes.\n\t\telse if (\n\t\t\tisDraft(result) &&\n\t\t\t(result[DRAFT_STATE] as ES5State).scope_ === scope\n\t\t) {\n\t\t\tmarkChangesSweep(scope.drafts_)\n\t\t}\n\t}\n\n\tfunction createES5Draft(isArray: boolean, base: any) {\n\t\tif (isArray) {\n\t\t\tconst draft = new Array(base.length)\n\t\t\tfor (let i = 0; i < base.length; i++)\n\t\t\t\tObject.defineProperty(draft, \"\" + i, proxyProperty(i, true))\n\t\t\treturn draft\n\t\t} else {\n\t\t\tconst descriptors = getOwnPropertyDescriptors(base)\n\t\t\tdelete descriptors[DRAFT_STATE as any]\n\t\t\tconst keys = ownKeys(descriptors)\n\t\t\tfor (let i = 0; i < keys.length; i++) {\n\t\t\t\tconst key: any = keys[i]\n\t\t\t\tdescriptors[key] = proxyProperty(\n\t\t\t\t\tkey,\n\t\t\t\t\tisArray || !!descriptors[key].enumerable\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn Object.create(Object.getPrototypeOf(base), descriptors)\n\t\t}\n\t}\n\n\tfunction createES5Proxy_(\n\t\tbase: T,\n\t\tparent?: ImmerState\n\t): Drafted {\n\t\tconst isArray = Array.isArray(base)\n\t\tconst draft = createES5Draft(isArray, base)\n\n\t\tconst state: ES5ObjectState | ES5ArrayState = {\n\t\t\ttype_: isArray ? ProxyType.ES5Array : (ProxyType.ES5Object as any),\n\t\t\tscope_: parent ? parent.scope_ : getCurrentScope(),\n\t\t\tmodified_: false,\n\t\t\tfinalized_: false,\n\t\t\tassigned_: {},\n\t\t\tparent_: parent,\n\t\t\t// base is the object we are drafting\n\t\t\tbase_: base,\n\t\t\t// draft is the draft object itself, that traps all reads and reads from either the base (if unmodified) or copy (if modified)\n\t\t\tdraft_: draft,\n\t\t\tcopy_: null,\n\t\t\trevoked_: false,\n\t\t\tisManual_: false\n\t\t}\n\n\t\tObject.defineProperty(draft, DRAFT_STATE, {\n\t\t\tvalue: state,\n\t\t\t// enumerable: false <- the default\n\t\t\twritable: true\n\t\t})\n\t\treturn draft\n\t}\n\n\t// property descriptors are recycled to make sure we don't create a get and set closure per property,\n\t// but share them all instead\n\tconst descriptors: {[prop: string]: PropertyDescriptor} = {}\n\n\tfunction proxyProperty(\n\t\tprop: string | number,\n\t\tenumerable: boolean\n\t): PropertyDescriptor {\n\t\tlet desc = descriptors[prop]\n\t\tif (desc) {\n\t\t\tdesc.enumerable = enumerable\n\t\t} else {\n\t\t\tdescriptors[prop] = desc = {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable,\n\t\t\t\tget(this: any) {\n\t\t\t\t\tconst state = this[DRAFT_STATE]\n\t\t\t\t\tif (__DEV__) assertUnrevoked(state)\n\t\t\t\t\t// @ts-ignore\n\t\t\t\t\treturn objectTraps.get(state, prop)\n\t\t\t\t},\n\t\t\t\tset(this: any, value) {\n\t\t\t\t\tconst state = this[DRAFT_STATE]\n\t\t\t\t\tif (__DEV__) assertUnrevoked(state)\n\t\t\t\t\t// @ts-ignore\n\t\t\t\t\tobjectTraps.set(state, prop, value)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn desc\n\t}\n\n\t// This looks expensive, but only proxies are visited, and only objects without known changes are scanned.\n\tfunction markChangesSweep(drafts: Drafted[]) {\n\t\t// The natural order of drafts in the `scope` array is based on when they\n\t\t// were accessed. By processing drafts in reverse natural order, we have a\n\t\t// better chance of processing leaf nodes first. When a leaf node is known to\n\t\t// have changed, we can avoid any traversal of its ancestor nodes.\n\t\tfor (let i = drafts.length - 1; i >= 0; i--) {\n\t\t\tconst state: ES5State = drafts[i][DRAFT_STATE]\n\t\t\tif (!state.modified_) {\n\t\t\t\tswitch (state.type_) {\n\t\t\t\t\tcase ProxyType.ES5Array:\n\t\t\t\t\t\tif (hasArrayChanges(state)) markChanged(state)\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase ProxyType.ES5Object:\n\t\t\t\t\t\tif (hasObjectChanges(state)) markChanged(state)\n\t\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction markChangesRecursively(object: any) {\n\t\tif (!object || typeof object !== \"object\") return\n\t\tconst state: ES5State | undefined = object[DRAFT_STATE]\n\t\tif (!state) return\n\t\tconst {base_, draft_, assigned_, type_} = state\n\t\tif (type_ === ProxyType.ES5Object) {\n\t\t\t// Look for added keys.\n\t\t\t// probably there is a faster way to detect changes, as sweep + recurse seems to do some\n\t\t\t// unnecessary work.\n\t\t\t// also: probably we can store the information we detect here, to speed up tree finalization!\n\t\t\teach(draft_, key => {\n\t\t\t\tif ((key as any) === DRAFT_STATE) return\n\t\t\t\t// The `undefined` check is a fast path for pre-existing keys.\n\t\t\t\tif ((base_ as any)[key] === undefined && !has(base_, key)) {\n\t\t\t\t\tassigned_[key] = true\n\t\t\t\t\tmarkChanged(state)\n\t\t\t\t} else if (!assigned_[key]) {\n\t\t\t\t\t// Only untouched properties trigger recursion.\n\t\t\t\t\tmarkChangesRecursively(draft_[key])\n\t\t\t\t}\n\t\t\t})\n\t\t\t// Look for removed keys.\n\t\t\teach(base_, key => {\n\t\t\t\t// The `undefined` check is a fast path for pre-existing keys.\n\t\t\t\tif (draft_[key] === undefined && !has(draft_, key)) {\n\t\t\t\t\tassigned_[key] = false\n\t\t\t\t\tmarkChanged(state)\n\t\t\t\t}\n\t\t\t})\n\t\t} else if (type_ === ProxyType.ES5Array) {\n\t\t\tif (hasArrayChanges(state as ES5ArrayState)) {\n\t\t\t\tmarkChanged(state)\n\t\t\t\tassigned_.length = true\n\t\t\t}\n\n\t\t\tif (draft_.length < base_.length) {\n\t\t\t\tfor (let i = draft_.length; i < base_.length; i++) assigned_[i] = false\n\t\t\t} else {\n\t\t\t\tfor (let i = base_.length; i < draft_.length; i++) assigned_[i] = true\n\t\t\t}\n\n\t\t\t// Minimum count is enough, the other parts has been processed.\n\t\t\tconst min = Math.min(draft_.length, base_.length)\n\n\t\t\tfor (let i = 0; i < min; i++) {\n\t\t\t\t// Only untouched indices trigger recursion.\n\t\t\t\tif (assigned_[i] === undefined) markChangesRecursively(draft_[i])\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction hasObjectChanges(state: ES5ObjectState) {\n\t\tconst {base_, draft_} = state\n\n\t\t// Search for added keys and changed keys. Start at the back, because\n\t\t// non-numeric keys are ordered by time of definition on the object.\n\t\tconst keys = ownKeys(draft_)\n\t\tfor (let i = keys.length - 1; i >= 0; i--) {\n\t\t\tconst key: any = keys[i]\n\t\t\tif (key === DRAFT_STATE) continue\n\t\t\tconst baseValue = base_[key]\n\t\t\t// The `undefined` check is a fast path for pre-existing keys.\n\t\t\tif (baseValue === undefined && !has(base_, key)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\t// Once a base key is deleted, future changes go undetected, because its\n\t\t\t// descriptor is erased. This branch detects any missed changes.\n\t\t\telse {\n\t\t\t\tconst value = draft_[key]\n\t\t\t\tconst state: ImmerState = value && value[DRAFT_STATE]\n\t\t\t\tif (state ? state.base_ !== baseValue : !is(value, baseValue)) {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// At this point, no keys were added or changed.\n\t\t// Compare key count to determine if keys were deleted.\n\t\tconst baseIsDraft = !!base_[DRAFT_STATE as any]\n\t\treturn keys.length !== ownKeys(base_).length + (baseIsDraft ? 0 : 1) // + 1 to correct for DRAFT_STATE\n\t}\n\n\tfunction hasArrayChanges(state: ES5ArrayState) {\n\t\tconst {draft_} = state\n\t\tif (draft_.length !== state.base_.length) return true\n\t\t// See #116\n\t\t// If we first shorten the length, our array interceptors will be removed.\n\t\t// If after that new items are added, result in the same original length,\n\t\t// those last items will have no intercepting property.\n\t\t// So if there is no own descriptor on the last position, we know that items were removed and added\n\t\t// N.B.: splice, unshift, etc only shift values around, but not prop descriptors, so we only have to check\n\t\t// the last one\n\t\tconst descriptor = Object.getOwnPropertyDescriptor(\n\t\t\tdraft_,\n\t\t\tdraft_.length - 1\n\t\t)\n\t\t// descriptor can be null, but only for newly created sparse arrays, eg. new Array(10)\n\t\tif (descriptor && !descriptor.get) return true\n\t\t// For all other cases, we don't have to compare, as they would have been picked up by the index setters\n\t\treturn false\n\t}\n\n\tfunction hasChanges_(state: ES5State) {\n\t\treturn state.type_ === ProxyType.ES5Object\n\t\t\t? hasObjectChanges(state)\n\t\t\t: hasArrayChanges(state)\n\t}\n\n\tfunction assertUnrevoked(state: any /*ES5State | MapState | SetState*/) {\n\t\tif (state.revoked_) die(3, JSON.stringify(latest(state)))\n\t}\n\n\tloadPlugin(\"ES5\", {\n\t\tcreateES5Proxy_,\n\t\twillFinalizeES5_,\n\t\thasChanges_\n\t})\n}\n", "import {immerable} from \"../immer\"\nimport {\n\tImmerState,\n\tPatch,\n\tSetState,\n\tES5ArrayState,\n\tProxyArrayState,\n\tMapState,\n\tES5ObjectState,\n\tProxyObjectState,\n\tPatchPath,\n\tget,\n\teach,\n\thas,\n\tgetArchtype,\n\tisSet,\n\tisMap,\n\tloadPlugin,\n\tProxyType,\n\tArchtype,\n\tdie,\n\tisDraft,\n\tisDraftable,\n\tNOTHING\n} from \"../internal\"\n\nexport function enablePatches() {\n\tconst REPLACE = \"replace\"\n\tconst ADD = \"add\"\n\tconst REMOVE = \"remove\"\n\n\tfunction generatePatches_(\n\t\tstate: ImmerState,\n\t\tbasePath: PatchPath,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t): void {\n\t\tswitch (state.type_) {\n\t\t\tcase ProxyType.ProxyObject:\n\t\t\tcase ProxyType.ES5Object:\n\t\t\tcase ProxyType.Map:\n\t\t\t\treturn generatePatchesFromAssigned(\n\t\t\t\t\tstate,\n\t\t\t\t\tbasePath,\n\t\t\t\t\tpatches,\n\t\t\t\t\tinversePatches\n\t\t\t\t)\n\t\t\tcase ProxyType.ES5Array:\n\t\t\tcase ProxyType.ProxyArray:\n\t\t\t\treturn generateArrayPatches(state, basePath, patches, inversePatches)\n\t\t\tcase ProxyType.Set:\n\t\t\t\treturn generateSetPatches(\n\t\t\t\t\t(state as any) as SetState,\n\t\t\t\t\tbasePath,\n\t\t\t\t\tpatches,\n\t\t\t\t\tinversePatches\n\t\t\t\t)\n\t\t}\n\t}\n\n\tfunction generateArrayPatches(\n\t\tstate: ES5ArrayState | ProxyArrayState,\n\t\tbasePath: PatchPath,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t) {\n\t\tlet {base_, assigned_} = state\n\t\tlet copy_ = state.copy_!\n\n\t\t// Reduce complexity by ensuring `base` is never longer.\n\t\tif (copy_.length < base_.length) {\n\t\t\t// @ts-ignore\n\t\t\t;[base_, copy_] = [copy_, base_]\n\t\t\t;[patches, inversePatches] = [inversePatches, patches]\n\t\t}\n\n\t\t// Process replaced indices.\n\t\tfor (let i = 0; i < base_.length; i++) {\n\t\t\tif (assigned_[i] && copy_[i] !== base_[i]) {\n\t\t\t\tconst path = basePath.concat([i])\n\t\t\t\tpatches.push({\n\t\t\t\t\top: REPLACE,\n\t\t\t\t\tpath,\n\t\t\t\t\t// Need to maybe clone it, as it can in fact be the original value\n\t\t\t\t\t// due to the base/copy inversion at the start of this function\n\t\t\t\t\tvalue: clonePatchValueIfNeeded(copy_[i])\n\t\t\t\t})\n\t\t\t\tinversePatches.push({\n\t\t\t\t\top: REPLACE,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue: clonePatchValueIfNeeded(base_[i])\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\t// Process added indices.\n\t\tfor (let i = base_.length; i < copy_.length; i++) {\n\t\t\tconst path = basePath.concat([i])\n\t\t\tpatches.push({\n\t\t\t\top: ADD,\n\t\t\t\tpath,\n\t\t\t\t// Need to maybe clone it, as it can in fact be the original value\n\t\t\t\t// due to the base/copy inversion at the start of this function\n\t\t\t\tvalue: clonePatchValueIfNeeded(copy_[i])\n\t\t\t})\n\t\t}\n\t\tif (base_.length < copy_.length) {\n\t\t\tinversePatches.push({\n\t\t\t\top: REPLACE,\n\t\t\t\tpath: basePath.concat([\"length\"]),\n\t\t\t\tvalue: base_.length\n\t\t\t})\n\t\t}\n\t}\n\n\t// This is used for both Map objects and normal objects.\n\tfunction generatePatchesFromAssigned(\n\t\tstate: MapState | ES5ObjectState | ProxyObjectState,\n\t\tbasePath: PatchPath,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t) {\n\t\tconst {base_, copy_} = state\n\t\teach(state.assigned_!, (key, assignedValue) => {\n\t\t\tconst origValue = get(base_, key)\n\t\t\tconst value = get(copy_!, key)\n\t\t\tconst op = !assignedValue ? REMOVE : has(base_, key) ? REPLACE : ADD\n\t\t\tif (origValue === value && op === REPLACE) return\n\t\t\tconst path = basePath.concat(key as any)\n\t\t\tpatches.push(op === REMOVE ? {op, path} : {op, path, value})\n\t\t\tinversePatches.push(\n\t\t\t\top === ADD\n\t\t\t\t\t? {op: REMOVE, path}\n\t\t\t\t\t: op === REMOVE\n\t\t\t\t\t? {op: ADD, path, value: clonePatchValueIfNeeded(origValue)}\n\t\t\t\t\t: {op: REPLACE, path, value: clonePatchValueIfNeeded(origValue)}\n\t\t\t)\n\t\t})\n\t}\n\n\tfunction generateSetPatches(\n\t\tstate: SetState,\n\t\tbasePath: PatchPath,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t) {\n\t\tlet {base_, copy_} = state\n\n\t\tlet i = 0\n\t\tbase_.forEach((value: any) => {\n\t\t\tif (!copy_!.has(value)) {\n\t\t\t\tconst path = basePath.concat([i])\n\t\t\t\tpatches.push({\n\t\t\t\t\top: REMOVE,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue\n\t\t\t\t})\n\t\t\t\tinversePatches.unshift({\n\t\t\t\t\top: ADD,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue\n\t\t\t\t})\n\t\t\t}\n\t\t\ti++\n\t\t})\n\t\ti = 0\n\t\tcopy_!.forEach((value: any) => {\n\t\t\tif (!base_.has(value)) {\n\t\t\t\tconst path = basePath.concat([i])\n\t\t\t\tpatches.push({\n\t\t\t\t\top: ADD,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue\n\t\t\t\t})\n\t\t\t\tinversePatches.unshift({\n\t\t\t\t\top: REMOVE,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue\n\t\t\t\t})\n\t\t\t}\n\t\t\ti++\n\t\t})\n\t}\n\n\tfunction generateReplacementPatches_(\n\t\trootState: ImmerState,\n\t\treplacement: any,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t): void {\n\t\tpatches.push({\n\t\t\top: REPLACE,\n\t\t\tpath: [],\n\t\t\tvalue: replacement === NOTHING ? undefined : replacement\n\t\t})\n\t\tinversePatches.push({\n\t\t\top: REPLACE,\n\t\t\tpath: [],\n\t\t\tvalue: rootState.base_\n\t\t})\n\t}\n\n\tfunction applyPatches_(draft: T, patches: Patch[]): T {\n\t\tpatches.forEach(patch => {\n\t\t\tconst {path, op} = patch\n\n\t\t\tlet base: any = draft\n\t\t\tfor (let i = 0; i < path.length - 1; i++) {\n\t\t\t\tconst parentType = getArchtype(base)\n\t\t\t\tconst p = \"\" + path[i]\n\t\t\t\t// See #738, avoid prototype pollution\n\t\t\t\tif (\n\t\t\t\t\t(parentType === Archtype.Object || parentType === Archtype.Array) &&\n\t\t\t\t\t(p === \"__proto__\" || p === \"constructor\")\n\t\t\t\t)\n\t\t\t\t\tdie(24)\n\t\t\t\tif (typeof base === \"function\" && p === \"prototype\") die(24)\n\t\t\t\tbase = get(base, p)\n\t\t\t\tif (typeof base !== \"object\") die(15, path.join(\"/\"))\n\t\t\t}\n\n\t\t\tconst type = getArchtype(base)\n\t\t\tconst value = deepClonePatchValue(patch.value) // used to clone patch to ensure original patch is not modified, see #411\n\t\t\tconst key = path[path.length - 1]\n\t\t\tswitch (op) {\n\t\t\t\tcase REPLACE:\n\t\t\t\t\tswitch (type) {\n\t\t\t\t\t\tcase Archtype.Map:\n\t\t\t\t\t\t\treturn base.set(key, value)\n\t\t\t\t\t\t/* istanbul ignore next */\n\t\t\t\t\t\tcase Archtype.Set:\n\t\t\t\t\t\t\tdie(16)\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t// if value is an object, then it's assigned by reference\n\t\t\t\t\t\t\t// in the following add or remove ops, the value field inside the patch will also be modifyed\n\t\t\t\t\t\t\t// so we use value from the cloned patch\n\t\t\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t\t\treturn (base[key] = value)\n\t\t\t\t\t}\n\t\t\t\tcase ADD:\n\t\t\t\t\tswitch (type) {\n\t\t\t\t\t\tcase Archtype.Array:\n\t\t\t\t\t\t\treturn key === \"-\"\n\t\t\t\t\t\t\t\t? base.push(value)\n\t\t\t\t\t\t\t\t: base.splice(key as any, 0, value)\n\t\t\t\t\t\tcase Archtype.Map:\n\t\t\t\t\t\t\treturn base.set(key, value)\n\t\t\t\t\t\tcase Archtype.Set:\n\t\t\t\t\t\t\treturn base.add(value)\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn (base[key] = value)\n\t\t\t\t\t}\n\t\t\t\tcase REMOVE:\n\t\t\t\t\tswitch (type) {\n\t\t\t\t\t\tcase Archtype.Array:\n\t\t\t\t\t\t\treturn base.splice(key as any, 1)\n\t\t\t\t\t\tcase Archtype.Map:\n\t\t\t\t\t\t\treturn base.delete(key)\n\t\t\t\t\t\tcase Archtype.Set:\n\t\t\t\t\t\t\treturn base.delete(patch.value)\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn delete base[key]\n\t\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tdie(17, op)\n\t\t\t}\n\t\t})\n\n\t\treturn draft\n\t}\n\n\t// optimize: this is quite a performance hit, can we detect intelligently when it is needed?\n\t// E.g. auto-draft when new objects from outside are assigned and modified?\n\t// (See failing test when deepClone just returns obj)\n\tfunction deepClonePatchValue(obj: T): T\n\tfunction deepClonePatchValue(obj: any) {\n\t\tif (!isDraftable(obj)) return obj\n\t\tif (Array.isArray(obj)) return obj.map(deepClonePatchValue)\n\t\tif (isMap(obj))\n\t\t\treturn new Map(\n\t\t\t\tArray.from(obj.entries()).map(([k, v]) => [k, deepClonePatchValue(v)])\n\t\t\t)\n\t\tif (isSet(obj)) return new Set(Array.from(obj).map(deepClonePatchValue))\n\t\tconst cloned = Object.create(Object.getPrototypeOf(obj))\n\t\tfor (const key in obj) cloned[key] = deepClonePatchValue(obj[key])\n\t\tif (has(obj, immerable)) cloned[immerable] = obj[immerable]\n\t\treturn cloned\n\t}\n\n\tfunction clonePatchValueIfNeeded(obj: T): T {\n\t\tif (isDraft(obj)) {\n\t\t\treturn deepClonePatchValue(obj)\n\t\t} else return obj\n\t}\n\n\tloadPlugin(\"Patches\", {\n\t\tapplyPatches_,\n\t\tgeneratePatches_,\n\t\tgenerateReplacementPatches_\n\t})\n}\n", "// types only!\nimport {\n\tImmerState,\n\tAnyMap,\n\tAnySet,\n\tMapState,\n\tSetState,\n\tDRAFT_STATE,\n\tgetCurrentScope,\n\tlatest,\n\titeratorSymbol,\n\tisDraftable,\n\tcreateProxy,\n\tloadPlugin,\n\tmarkChanged,\n\tProxyType,\n\tdie,\n\teach\n} from \"../internal\"\n\nexport function enableMapSet() {\n\t/* istanbul ignore next */\n\tvar extendStatics = function(d: any, b: any): any {\n\t\textendStatics =\n\t\t\tObject.setPrototypeOf ||\n\t\t\t({__proto__: []} instanceof Array &&\n\t\t\t\tfunction(d, b) {\n\t\t\t\t\td.__proto__ = b\n\t\t\t\t}) ||\n\t\t\tfunction(d, b) {\n\t\t\t\tfor (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]\n\t\t\t}\n\t\treturn extendStatics(d, b)\n\t}\n\n\t// Ugly hack to resolve #502 and inherit built in Map / Set\n\tfunction __extends(d: any, b: any): any {\n\t\textendStatics(d, b)\n\t\tfunction __(this: any): any {\n\t\t\tthis.constructor = d\n\t\t}\n\t\td.prototype =\n\t\t\t// @ts-ignore\n\t\t\t((__.prototype = b.prototype), new __())\n\t}\n\n\tconst DraftMap = (function(_super) {\n\t\t__extends(DraftMap, _super)\n\t\t// Create class manually, cause #502\n\t\tfunction DraftMap(this: any, target: AnyMap, parent?: ImmerState): any {\n\t\t\tthis[DRAFT_STATE] = {\n\t\t\t\ttype_: ProxyType.Map,\n\t\t\t\tparent_: parent,\n\t\t\t\tscope_: parent ? parent.scope_ : getCurrentScope()!,\n\t\t\t\tmodified_: false,\n\t\t\t\tfinalized_: false,\n\t\t\t\tcopy_: undefined,\n\t\t\t\tassigned_: undefined,\n\t\t\t\tbase_: target,\n\t\t\t\tdraft_: this as any,\n\t\t\t\tisManual_: false,\n\t\t\t\trevoked_: false\n\t\t\t} as MapState\n\t\t\treturn this\n\t\t}\n\t\tconst p = DraftMap.prototype\n\n\t\tObject.defineProperty(p, \"size\", {\n\t\t\tget: function() {\n\t\t\t\treturn latest(this[DRAFT_STATE]).size\n\t\t\t}\n\t\t\t// enumerable: false,\n\t\t\t// configurable: true\n\t\t})\n\n\t\tp.has = function(key: any): boolean {\n\t\t\treturn latest(this[DRAFT_STATE]).has(key)\n\t\t}\n\n\t\tp.set = function(key: any, value: any) {\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tif (!latest(state).has(key) || latest(state).get(key) !== value) {\n\t\t\t\tprepareMapCopy(state)\n\t\t\t\tmarkChanged(state)\n\t\t\t\tstate.assigned_!.set(key, true)\n\t\t\t\tstate.copy_!.set(key, value)\n\t\t\t\tstate.assigned_!.set(key, true)\n\t\t\t}\n\t\t\treturn this\n\t\t}\n\n\t\tp.delete = function(key: any): boolean {\n\t\t\tif (!this.has(key)) {\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tprepareMapCopy(state)\n\t\t\tmarkChanged(state)\n\t\t\tstate.assigned_!.set(key, false)\n\t\t\tstate.copy_!.delete(key)\n\t\t\treturn true\n\t\t}\n\n\t\tp.clear = function() {\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tif (latest(state).size) {\n\t\t\t\tprepareMapCopy(state)\n\t\t\t\tmarkChanged(state)\n\t\t\t\tstate.assigned_ = new Map()\n\t\t\t\teach(state.base_, key => {\n\t\t\t\t\tstate.assigned_!.set(key, false)\n\t\t\t\t})\n\t\t\t\tstate.copy_!.clear()\n\t\t\t}\n\t\t}\n\n\t\tp.forEach = function(\n\t\t\tcb: (value: any, key: any, self: any) => void,\n\t\t\tthisArg?: any\n\t\t) {\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tlatest(state).forEach((_value: any, key: any, _map: any) => {\n\t\t\t\tcb.call(thisArg, this.get(key), key, this)\n\t\t\t})\n\t\t}\n\n\t\tp.get = function(key: any): any {\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tconst value = latest(state).get(key)\n\t\t\tif (state.finalized_ || !isDraftable(value)) {\n\t\t\t\treturn value\n\t\t\t}\n\t\t\tif (value !== state.base_.get(key)) {\n\t\t\t\treturn value // either already drafted or reassigned\n\t\t\t}\n\t\t\t// despite what it looks, this creates a draft only once, see above condition\n\t\t\tconst draft = createProxy(state.scope_.immer_, value, state)\n\t\t\tprepareMapCopy(state)\n\t\t\tstate.copy_!.set(key, draft)\n\t\t\treturn draft\n\t\t}\n\n\t\tp.keys = function(): IterableIterator {\n\t\t\treturn latest(this[DRAFT_STATE]).keys()\n\t\t}\n\n\t\tp.values = function(): IterableIterator {\n\t\t\tconst iterator = this.keys()\n\t\t\treturn {\n\t\t\t\t[iteratorSymbol]: () => this.values(),\n\t\t\t\tnext: () => {\n\t\t\t\t\tconst r = iterator.next()\n\t\t\t\t\t/* istanbul ignore next */\n\t\t\t\t\tif (r.done) return r\n\t\t\t\t\tconst value = this.get(r.value)\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdone: false,\n\t\t\t\t\t\tvalue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} as any\n\t\t}\n\n\t\tp.entries = function(): IterableIterator<[any, any]> {\n\t\t\tconst iterator = this.keys()\n\t\t\treturn {\n\t\t\t\t[iteratorSymbol]: () => this.entries(),\n\t\t\t\tnext: () => {\n\t\t\t\t\tconst r = iterator.next()\n\t\t\t\t\t/* istanbul ignore next */\n\t\t\t\t\tif (r.done) return r\n\t\t\t\t\tconst value = this.get(r.value)\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdone: false,\n\t\t\t\t\t\tvalue: [r.value, value]\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} as any\n\t\t}\n\n\t\tp[iteratorSymbol] = function() {\n\t\t\treturn this.entries()\n\t\t}\n\n\t\treturn DraftMap\n\t})(Map)\n\n\tfunction proxyMap_(target: T, parent?: ImmerState): T {\n\t\t// @ts-ignore\n\t\treturn new DraftMap(target, parent)\n\t}\n\n\tfunction prepareMapCopy(state: MapState) {\n\t\tif (!state.copy_) {\n\t\t\tstate.assigned_ = new Map()\n\t\t\tstate.copy_ = new Map(state.base_)\n\t\t}\n\t}\n\n\tconst DraftSet = (function(_super) {\n\t\t__extends(DraftSet, _super)\n\t\t// Create class manually, cause #502\n\t\tfunction DraftSet(this: any, target: AnySet, parent?: ImmerState) {\n\t\t\tthis[DRAFT_STATE] = {\n\t\t\t\ttype_: ProxyType.Set,\n\t\t\t\tparent_: parent,\n\t\t\t\tscope_: parent ? parent.scope_ : getCurrentScope()!,\n\t\t\t\tmodified_: false,\n\t\t\t\tfinalized_: false,\n\t\t\t\tcopy_: undefined,\n\t\t\t\tbase_: target,\n\t\t\t\tdraft_: this,\n\t\t\t\tdrafts_: new Map(),\n\t\t\t\trevoked_: false,\n\t\t\t\tisManual_: false\n\t\t\t} as SetState\n\t\t\treturn this\n\t\t}\n\t\tconst p = DraftSet.prototype\n\n\t\tObject.defineProperty(p, \"size\", {\n\t\t\tget: function() {\n\t\t\t\treturn latest(this[DRAFT_STATE]).size\n\t\t\t}\n\t\t\t// enumerable: true,\n\t\t})\n\n\t\tp.has = function(value: any): boolean {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\t// bit of trickery here, to be able to recognize both the value, and the draft of its value\n\t\t\tif (!state.copy_) {\n\t\t\t\treturn state.base_.has(value)\n\t\t\t}\n\t\t\tif (state.copy_.has(value)) return true\n\t\t\tif (state.drafts_.has(value) && state.copy_.has(state.drafts_.get(value)))\n\t\t\t\treturn true\n\t\t\treturn false\n\t\t}\n\n\t\tp.add = function(value: any): any {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tif (!this.has(value)) {\n\t\t\t\tprepareSetCopy(state)\n\t\t\t\tmarkChanged(state)\n\t\t\t\tstate.copy_!.add(value)\n\t\t\t}\n\t\t\treturn this\n\t\t}\n\n\t\tp.delete = function(value: any): any {\n\t\t\tif (!this.has(value)) {\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tprepareSetCopy(state)\n\t\t\tmarkChanged(state)\n\t\t\treturn (\n\t\t\t\tstate.copy_!.delete(value) ||\n\t\t\t\t(state.drafts_.has(value)\n\t\t\t\t\t? state.copy_!.delete(state.drafts_.get(value))\n\t\t\t\t\t: /* istanbul ignore next */ false)\n\t\t\t)\n\t\t}\n\n\t\tp.clear = function() {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tif (latest(state).size) {\n\t\t\t\tprepareSetCopy(state)\n\t\t\t\tmarkChanged(state)\n\t\t\t\tstate.copy_!.clear()\n\t\t\t}\n\t\t}\n\n\t\tp.values = function(): IterableIterator {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tprepareSetCopy(state)\n\t\t\treturn state.copy_!.values()\n\t\t}\n\n\t\tp.entries = function entries(): IterableIterator<[any, any]> {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tprepareSetCopy(state)\n\t\t\treturn state.copy_!.entries()\n\t\t}\n\n\t\tp.keys = function(): IterableIterator {\n\t\t\treturn this.values()\n\t\t}\n\n\t\tp[iteratorSymbol] = function() {\n\t\t\treturn this.values()\n\t\t}\n\n\t\tp.forEach = function forEach(cb: any, thisArg?: any) {\n\t\t\tconst iterator = this.values()\n\t\t\tlet result = iterator.next()\n\t\t\twhile (!result.done) {\n\t\t\t\tcb.call(thisArg, result.value, result.value, this)\n\t\t\t\tresult = iterator.next()\n\t\t\t}\n\t\t}\n\n\t\treturn DraftSet\n\t})(Set)\n\n\tfunction proxySet_(target: T, parent?: ImmerState): T {\n\t\t// @ts-ignore\n\t\treturn new DraftSet(target, parent)\n\t}\n\n\tfunction prepareSetCopy(state: SetState) {\n\t\tif (!state.copy_) {\n\t\t\t// create drafts for all entries to preserve insertion order\n\t\t\tstate.copy_ = new Set()\n\t\t\tstate.base_.forEach(value => {\n\t\t\t\tif (isDraftable(value)) {\n\t\t\t\t\tconst draft = createProxy(state.scope_.immer_, value, state)\n\t\t\t\t\tstate.drafts_.set(value, draft)\n\t\t\t\t\tstate.copy_!.add(draft)\n\t\t\t\t} else {\n\t\t\t\t\tstate.copy_!.add(value)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t}\n\n\tfunction assertUnrevoked(state: any /*ES5State | MapState | SetState*/) {\n\t\tif (state.revoked_) die(3, JSON.stringify(latest(state)))\n\t}\n\n\tloadPlugin(\"MapSet\", {proxyMap_, proxySet_})\n}\n", "import {enableES5} from \"./es5\"\nimport {enableMapSet} from \"./mapset\"\nimport {enablePatches} from \"./patches\"\n\nexport function enableAllPlugins() {\n\tenableES5()\n\tenableMapSet()\n\tenablePatches()\n}\n", "import {\n\tIProduce,\n\tIProduceWithPatches,\n\tImmer,\n\tDraft,\n\tImmutable\n} from \"./internal\"\n\nexport {\n\tDraft,\n\tImmutable,\n\tPatch,\n\tPatchListener,\n\toriginal,\n\tcurrent,\n\tisDraft,\n\tisDraftable,\n\tNOTHING as nothing,\n\tDRAFTABLE as immerable,\n\tfreeze\n} from \"./internal\"\n\nconst immer = new Immer()\n\n/**\n * The `produce` function takes a value and a \"recipe function\" (whose\n * return value often depends on the base state). The recipe function is\n * free to mutate its first argument however it wants. All mutations are\n * only ever applied to a __copy__ of the base state.\n *\n * Pass only a function to create a \"curried producer\" which relieves you\n * from passing the recipe function every time.\n *\n * Only plain objects and arrays are made mutable. All other objects are\n * considered uncopyable.\n *\n * Note: This function is __bound__ to its `Immer` instance.\n *\n * @param {any} base - the initial state\n * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified\n * @param {Function} patchListener - optional function that will be called with all the patches produced here\n * @returns {any} a new state, or the initial state if nothing was modified\n */\nexport const produce: IProduce = immer.produce\nexport default produce\n\n/**\n * Like `produce`, but `produceWithPatches` always returns a tuple\n * [nextState, patches, inversePatches] (instead of just the next state)\n */\nexport const produceWithPatches: IProduceWithPatches = immer.produceWithPatches.bind(\n\timmer\n)\n\n/**\n * Pass true to automatically freeze all copies created by Immer.\n *\n * Always freeze by default, even in production mode\n */\nexport const setAutoFreeze = immer.setAutoFreeze.bind(immer)\n\n/**\n * Pass true to use the ES2015 `Proxy` class when creating drafts, which is\n * always faster than using ES5 proxies.\n *\n * By default, feature detection is used, so calling this is rarely necessary.\n */\nexport const setUseProxies = immer.setUseProxies.bind(immer)\n\n/**\n * Apply an array of Immer patches to the first argument.\n *\n * This function is a producer, which means copy-on-write is in effect.\n */\nexport const applyPatches = immer.applyPatches.bind(immer)\n\n/**\n * Create an Immer draft from the given base state, which may be a draft itself.\n * The draft can be modified until you finalize it with the `finishDraft` function.\n */\nexport const createDraft = immer.createDraft.bind(immer)\n\n/**\n * Finalize an Immer draft from a `createDraft` call, returning the base state\n * (if no changes were made) or a modified copy. The draft must *not* be\n * mutated afterwards.\n *\n * Pass a function as the 2nd argument to generate Immer patches based on the\n * changes that were made.\n */\nexport const finishDraft = immer.finishDraft.bind(immer)\n\n/**\n * This function is actually a no-op, but can be used to cast an immutable type\n * to an draft type and make TypeScript happy\n *\n * @param value\n */\nexport function castDraft(value: T): Draft {\n\treturn value as any\n}\n\n/**\n * This function is actually a no-op, but can be used to cast a mutable type\n * to an immutable type and make TypeScript happy\n * @param value\n */\nexport function castImmutable(value: T): Immutable {\n\treturn value as any\n}\n\nexport {Immer}\n\nexport {enableES5} from \"./plugins/es5\"\nexport {enablePatches} from \"./plugins/patches\"\nexport {enableMapSet} from \"./plugins/mapset\"\nexport {enableAllPlugins} from \"./plugins/all\"\n", "// Should be no imports here!\n\n// Some things that should be evaluated before all else...\n\n// We only want to know if non-polyfilled symbols are available\nconst hasSymbol =\n\ttypeof Symbol !== \"undefined\" && typeof Symbol(\"x\") === \"symbol\"\nexport const hasMap = typeof Map !== \"undefined\"\nexport const hasSet = typeof Set !== \"undefined\"\nexport const hasProxies =\n\ttypeof Proxy !== \"undefined\" &&\n\ttypeof Proxy.revocable !== \"undefined\" &&\n\ttypeof Reflect !== \"undefined\"\n\n/**\n * The sentinel value returned by producers to replace the draft with undefined.\n */\nexport const NOTHING: Nothing = hasSymbol\n\t? Symbol.for(\"immer-nothing\")\n\t: ({[\"immer-nothing\"]: true} as any)\n\n/**\n * To let Immer treat your class instances as plain immutable objects\n * (albeit with a custom prototype), you must define either an instance property\n * or a static property on each of your custom classes.\n *\n * Otherwise, your class instance will never be drafted, which means it won't be\n * safe to mutate in a produce callback.\n */\nexport const DRAFTABLE: unique symbol = hasSymbol\n\t? Symbol.for(\"immer-draftable\")\n\t: (\"__$immer_draftable\" as any)\n\nexport const DRAFT_STATE: unique symbol = hasSymbol\n\t? Symbol.for(\"immer-state\")\n\t: (\"__$immer_state\" as any)\n\n// Even a polyfilled Symbol might provide Symbol.iterator\nexport const iteratorSymbol: typeof Symbol.iterator =\n\t(typeof Symbol != \"undefined\" && Symbol.iterator) || (\"@@iterator\" as any)\n\n/** Use a class type for `nothing` so its type is unique */\nexport class Nothing {\n\t// This lets us do `Exclude`\n\t// @ts-ignore\n\tprivate _!: unique symbol\n}\n", "export default function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}", "import defineProperty from \"./defineProperty.js\";\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n enumerableOnly && (symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n })), keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nexport default function _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = null != arguments[i] ? arguments[i] : {};\n i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {\n defineProperty(target, key, source[key]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n\n return target;\n}", "import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2';\n\n/**\n * Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js\n *\n * Do not require this module directly! Use normal throw error calls. These messages will be replaced with error codes\n * during build.\n * @param {number} code\n */\nfunction formatProdErrorMessage(code) {\n return \"Minified Redux error #\" + code + \"; visit https://redux.js.org/Errors?code=\" + code + \" for the full message or \" + 'use the non-minified dev environment for full errors. ';\n}\n\n// Inlined version of the `symbol-observable` polyfill\nvar $$observable = (function () {\n return typeof Symbol === 'function' && Symbol.observable || '@@observable';\n})();\n\n/**\n * These are private action types reserved by Redux.\n * For any unknown actions, you must return the current state.\n * If the current state is undefined, you must return the initial state.\n * Do not reference these action types directly in your code.\n */\nvar randomString = function randomString() {\n return Math.random().toString(36).substring(7).split('').join('.');\n};\n\nvar ActionTypes = {\n INIT: \"@@redux/INIT\" + randomString(),\n REPLACE: \"@@redux/REPLACE\" + randomString(),\n PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {\n return \"@@redux/PROBE_UNKNOWN_ACTION\" + randomString();\n }\n};\n\n/**\n * @param {any} obj The object to inspect.\n * @returns {boolean} True if the argument appears to be a plain object.\n */\nfunction isPlainObject(obj) {\n if (typeof obj !== 'object' || obj === null) return false;\n var proto = obj;\n\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n\n return Object.getPrototypeOf(obj) === proto;\n}\n\n// Inlined / shortened version of `kindOf` from https://github.com/jonschlinkert/kind-of\nfunction miniKindOf(val) {\n if (val === void 0) return 'undefined';\n if (val === null) return 'null';\n var type = typeof val;\n\n switch (type) {\n case 'boolean':\n case 'string':\n case 'number':\n case 'symbol':\n case 'function':\n {\n return type;\n }\n }\n\n if (Array.isArray(val)) return 'array';\n if (isDate(val)) return 'date';\n if (isError(val)) return 'error';\n var constructorName = ctorName(val);\n\n switch (constructorName) {\n case 'Symbol':\n case 'Promise':\n case 'WeakMap':\n case 'WeakSet':\n case 'Map':\n case 'Set':\n return constructorName;\n } // other\n\n\n return type.slice(8, -1).toLowerCase().replace(/\\s/g, '');\n}\n\nfunction ctorName(val) {\n return typeof val.constructor === 'function' ? val.constructor.name : null;\n}\n\nfunction isError(val) {\n return val instanceof Error || typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number';\n}\n\nfunction isDate(val) {\n if (val instanceof Date) return true;\n return typeof val.toDateString === 'function' && typeof val.getDate === 'function' && typeof val.setDate === 'function';\n}\n\nfunction kindOf(val) {\n var typeOfVal = typeof val;\n\n if (process.env.NODE_ENV !== 'production') {\n typeOfVal = miniKindOf(val);\n }\n\n return typeOfVal;\n}\n\n/**\n * Creates a Redux store that holds the state tree.\n * The only way to change the data in the store is to call `dispatch()` on it.\n *\n * There should only be a single store in your app. To specify how different\n * parts of the state tree respond to actions, you may combine several reducers\n * into a single reducer function by using `combineReducers`.\n *\n * @param {Function} reducer A function that returns the next state tree, given\n * the current state tree and the action to handle.\n *\n * @param {any} [preloadedState] The initial state. You may optionally specify it\n * to hydrate the state from the server in universal apps, or to restore a\n * previously serialized user session.\n * If you use `combineReducers` to produce the root reducer function, this must be\n * an object with the same shape as `combineReducers` keys.\n *\n * @param {Function} [enhancer] The store enhancer. You may optionally specify it\n * to enhance the store with third-party capabilities such as middleware,\n * time travel, persistence, etc. The only store enhancer that ships with Redux\n * is `applyMiddleware()`.\n *\n * @returns {Store} A Redux store that lets you read the state, dispatch actions\n * and subscribe to changes.\n */\n\nfunction createStore(reducer, preloadedState, enhancer) {\n var _ref2;\n\n if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(0) : 'It looks like you are passing several store enhancers to ' + 'createStore(). This is not supported. Instead, compose them ' + 'together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.');\n }\n\n if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {\n enhancer = preloadedState;\n preloadedState = undefined;\n }\n\n if (typeof enhancer !== 'undefined') {\n if (typeof enhancer !== 'function') {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(1) : \"Expected the enhancer to be a function. Instead, received: '\" + kindOf(enhancer) + \"'\");\n }\n\n return enhancer(createStore)(reducer, preloadedState);\n }\n\n if (typeof reducer !== 'function') {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(2) : \"Expected the root reducer to be a function. Instead, received: '\" + kindOf(reducer) + \"'\");\n }\n\n var currentReducer = reducer;\n var currentState = preloadedState;\n var currentListeners = [];\n var nextListeners = currentListeners;\n var isDispatching = false;\n /**\n * This makes a shallow copy of currentListeners so we can use\n * nextListeners as a temporary list while dispatching.\n *\n * This prevents any bugs around consumers calling\n * subscribe/unsubscribe in the middle of a dispatch.\n */\n\n function ensureCanMutateNextListeners() {\n if (nextListeners === currentListeners) {\n nextListeners = currentListeners.slice();\n }\n }\n /**\n * Reads the state tree managed by the store.\n *\n * @returns {any} The current state tree of your application.\n */\n\n\n function getState() {\n if (isDispatching) {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(3) : 'You may not call store.getState() while the reducer is executing. ' + 'The reducer has already received the state as an argument. ' + 'Pass it down from the top reducer instead of reading it from the store.');\n }\n\n return currentState;\n }\n /**\n * Adds a change listener. It will be called any time an action is dispatched,\n * and some part of the state tree may potentially have changed. You may then\n * call `getState()` to read the current state tree inside the callback.\n *\n * You may call `dispatch()` from a change listener, with the following\n * caveats:\n *\n * 1. The subscriptions are snapshotted just before every `dispatch()` call.\n * If you subscribe or unsubscribe while the listeners are being invoked, this\n * will not have any effect on the `dispatch()` that is currently in progress.\n * However, the next `dispatch()` call, whether nested or not, will use a more\n * recent snapshot of the subscription list.\n *\n * 2. The listener should not expect to see all state changes, as the state\n * might have been updated multiple times during a nested `dispatch()` before\n * the listener is called. It is, however, guaranteed that all subscribers\n * registered before the `dispatch()` started will be called with the latest\n * state by the time it exits.\n *\n * @param {Function} listener A callback to be invoked on every dispatch.\n * @returns {Function} A function to remove this change listener.\n */\n\n\n function subscribe(listener) {\n if (typeof listener !== 'function') {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(4) : \"Expected the listener to be a function. Instead, received: '\" + kindOf(listener) + \"'\");\n }\n\n if (isDispatching) {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(5) : 'You may not call store.subscribe() while the reducer is executing. ' + 'If you would like to be notified after the store has been updated, subscribe from a ' + 'component and invoke store.getState() in the callback to access the latest state. ' + 'See https://redux.js.org/api/store#subscribelistener for more details.');\n }\n\n var isSubscribed = true;\n ensureCanMutateNextListeners();\n nextListeners.push(listener);\n return function unsubscribe() {\n if (!isSubscribed) {\n return;\n }\n\n if (isDispatching) {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(6) : 'You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api/store#subscribelistener for more details.');\n }\n\n isSubscribed = false;\n ensureCanMutateNextListeners();\n var index = nextListeners.indexOf(listener);\n nextListeners.splice(index, 1);\n currentListeners = null;\n };\n }\n /**\n * Dispatches an action. It is the only way to trigger a state change.\n *\n * The `reducer` function, used to create the store, will be called with the\n * current state tree and the given `action`. Its return value will\n * be considered the **next** state of the tree, and the change listeners\n * will be notified.\n *\n * The base implementation only supports plain object actions. If you want to\n * dispatch a Promise, an Observable, a thunk, or something else, you need to\n * wrap your store creating function into the corresponding middleware. For\n * example, see the documentation for the `redux-thunk` package. Even the\n * middleware will eventually dispatch plain object actions using this method.\n *\n * @param {Object} action A plain object representing \u201Cwhat changed\u201D. It is\n * a good idea to keep actions serializable so you can record and replay user\n * sessions, or use the time travelling `redux-devtools`. An action must have\n * a `type` property which may not be `undefined`. It is a good idea to use\n * string constants for action types.\n *\n * @returns {Object} For convenience, the same action object you dispatched.\n *\n * Note that, if you use a custom middleware, it may wrap `dispatch()` to\n * return something else (for example, a Promise you can await).\n */\n\n\n function dispatch(action) {\n if (!isPlainObject(action)) {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(7) : \"Actions must be plain objects. Instead, the actual type was: '\" + kindOf(action) + \"'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.\");\n }\n\n if (typeof action.type === 'undefined') {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(8) : 'Actions may not have an undefined \"type\" property. You may have misspelled an action type string constant.');\n }\n\n if (isDispatching) {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(9) : 'Reducers may not dispatch actions.');\n }\n\n try {\n isDispatching = true;\n currentState = currentReducer(currentState, action);\n } finally {\n isDispatching = false;\n }\n\n var listeners = currentListeners = nextListeners;\n\n for (var i = 0; i < listeners.length; i++) {\n var listener = listeners[i];\n listener();\n }\n\n return action;\n }\n /**\n * Replaces the reducer currently used by the store to calculate the state.\n *\n * You might need this if your app implements code splitting and you want to\n * load some of the reducers dynamically. You might also need this if you\n * implement a hot reloading mechanism for Redux.\n *\n * @param {Function} nextReducer The reducer for the store to use instead.\n * @returns {void}\n */\n\n\n function replaceReducer(nextReducer) {\n if (typeof nextReducer !== 'function') {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(10) : \"Expected the nextReducer to be a function. Instead, received: '\" + kindOf(nextReducer));\n }\n\n currentReducer = nextReducer; // This action has a similiar effect to ActionTypes.INIT.\n // Any reducers that existed in both the new and old rootReducer\n // will receive the previous state. This effectively populates\n // the new state tree with any relevant data from the old one.\n\n dispatch({\n type: ActionTypes.REPLACE\n });\n }\n /**\n * Interoperability point for observable/reactive libraries.\n * @returns {observable} A minimal observable of state changes.\n * For more information, see the observable proposal:\n * https://github.com/tc39/proposal-observable\n */\n\n\n function observable() {\n var _ref;\n\n var outerSubscribe = subscribe;\n return _ref = {\n /**\n * The minimal observable subscription method.\n * @param {Object} observer Any object that can be used as an observer.\n * The observer object should have a `next` method.\n * @returns {subscription} An object with an `unsubscribe` method that can\n * be used to unsubscribe the observable from the store, and prevent further\n * emission of values from the observable.\n */\n subscribe: function subscribe(observer) {\n if (typeof observer !== 'object' || observer === null) {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(11) : \"Expected the observer to be an object. Instead, received: '\" + kindOf(observer) + \"'\");\n }\n\n function observeState() {\n if (observer.next) {\n observer.next(getState());\n }\n }\n\n observeState();\n var unsubscribe = outerSubscribe(observeState);\n return {\n unsubscribe: unsubscribe\n };\n }\n }, _ref[$$observable] = function () {\n return this;\n }, _ref;\n } // When a store is created, an \"INIT\" action is dispatched so that every\n // reducer returns their initial state. This effectively populates\n // the initial state tree.\n\n\n dispatch({\n type: ActionTypes.INIT\n });\n return _ref2 = {\n dispatch: dispatch,\n subscribe: subscribe,\n getState: getState,\n replaceReducer: replaceReducer\n }, _ref2[$$observable] = observable, _ref2;\n}\n\n/**\n * Prints a warning in the console if it exists.\n *\n * @param {String} message The warning message.\n * @returns {void}\n */\nfunction warning(message) {\n /* eslint-disable no-console */\n if (typeof console !== 'undefined' && typeof console.error === 'function') {\n console.error(message);\n }\n /* eslint-enable no-console */\n\n\n try {\n // This error was thrown as a convenience so that if you enable\n // \"break on all exceptions\" in your console,\n // it would pause the execution at this line.\n throw new Error(message);\n } catch (e) {} // eslint-disable-line no-empty\n\n}\n\nfunction getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {\n var reducerKeys = Object.keys(reducers);\n var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';\n\n if (reducerKeys.length === 0) {\n return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';\n }\n\n if (!isPlainObject(inputState)) {\n return \"The \" + argumentName + \" has unexpected type of \\\"\" + kindOf(inputState) + \"\\\". Expected argument to be an object with the following \" + (\"keys: \\\"\" + reducerKeys.join('\", \"') + \"\\\"\");\n }\n\n var unexpectedKeys = Object.keys(inputState).filter(function (key) {\n return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];\n });\n unexpectedKeys.forEach(function (key) {\n unexpectedKeyCache[key] = true;\n });\n if (action && action.type === ActionTypes.REPLACE) return;\n\n if (unexpectedKeys.length > 0) {\n return \"Unexpected \" + (unexpectedKeys.length > 1 ? 'keys' : 'key') + \" \" + (\"\\\"\" + unexpectedKeys.join('\", \"') + \"\\\" found in \" + argumentName + \". \") + \"Expected to find one of the known reducer keys instead: \" + (\"\\\"\" + reducerKeys.join('\", \"') + \"\\\". Unexpected keys will be ignored.\");\n }\n}\n\nfunction assertReducerShape(reducers) {\n Object.keys(reducers).forEach(function (key) {\n var reducer = reducers[key];\n var initialState = reducer(undefined, {\n type: ActionTypes.INIT\n });\n\n if (typeof initialState === 'undefined') {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(12) : \"The slice reducer for key \\\"\" + key + \"\\\" returned undefined during initialization. \" + \"If the state passed to the reducer is undefined, you must \" + \"explicitly return the initial state. The initial state may \" + \"not be undefined. If you don't want to set a value for this reducer, \" + \"you can use null instead of undefined.\");\n }\n\n if (typeof reducer(undefined, {\n type: ActionTypes.PROBE_UNKNOWN_ACTION()\n }) === 'undefined') {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(13) : \"The slice reducer for key \\\"\" + key + \"\\\" returned undefined when probed with a random type. \" + (\"Don't try to handle '\" + ActionTypes.INIT + \"' or other actions in \\\"redux/*\\\" \") + \"namespace. They are considered private. Instead, you must return the \" + \"current state for any unknown actions, unless it is undefined, \" + \"in which case you must return the initial state, regardless of the \" + \"action type. The initial state may not be undefined, but can be null.\");\n }\n });\n}\n/**\n * Turns an object whose values are different reducer functions, into a single\n * reducer function. It will call every child reducer, and gather their results\n * into a single state object, whose keys correspond to the keys of the passed\n * reducer functions.\n *\n * @param {Object} reducers An object whose values correspond to different\n * reducer functions that need to be combined into one. One handy way to obtain\n * it is to use ES6 `import * as reducers` syntax. The reducers may never return\n * undefined for any action. Instead, they should return their initial state\n * if the state passed to them was undefined, and the current state for any\n * unrecognized action.\n *\n * @returns {Function} A reducer function that invokes every reducer inside the\n * passed object, and builds a state object with the same shape.\n */\n\n\nfunction combineReducers(reducers) {\n var reducerKeys = Object.keys(reducers);\n var finalReducers = {};\n\n for (var i = 0; i < reducerKeys.length; i++) {\n var key = reducerKeys[i];\n\n if (process.env.NODE_ENV !== 'production') {\n if (typeof reducers[key] === 'undefined') {\n warning(\"No reducer provided for key \\\"\" + key + \"\\\"\");\n }\n }\n\n if (typeof reducers[key] === 'function') {\n finalReducers[key] = reducers[key];\n }\n }\n\n var finalReducerKeys = Object.keys(finalReducers); // This is used to make sure we don't warn about the same\n // keys multiple times.\n\n var unexpectedKeyCache;\n\n if (process.env.NODE_ENV !== 'production') {\n unexpectedKeyCache = {};\n }\n\n var shapeAssertionError;\n\n try {\n assertReducerShape(finalReducers);\n } catch (e) {\n shapeAssertionError = e;\n }\n\n return function combination(state, action) {\n if (state === void 0) {\n state = {};\n }\n\n if (shapeAssertionError) {\n throw shapeAssertionError;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);\n\n if (warningMessage) {\n warning(warningMessage);\n }\n }\n\n var hasChanged = false;\n var nextState = {};\n\n for (var _i = 0; _i < finalReducerKeys.length; _i++) {\n var _key = finalReducerKeys[_i];\n var reducer = finalReducers[_key];\n var previousStateForKey = state[_key];\n var nextStateForKey = reducer(previousStateForKey, action);\n\n if (typeof nextStateForKey === 'undefined') {\n var actionType = action && action.type;\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(14) : \"When called with an action of type \" + (actionType ? \"\\\"\" + String(actionType) + \"\\\"\" : '(unknown type)') + \", the slice reducer for key \\\"\" + _key + \"\\\" returned undefined. \" + \"To ignore an action, you must explicitly return the previous state. \" + \"If you want this reducer to hold no value, you can return null instead of undefined.\");\n }\n\n nextState[_key] = nextStateForKey;\n hasChanged = hasChanged || nextStateForKey !== previousStateForKey;\n }\n\n hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;\n return hasChanged ? nextState : state;\n };\n}\n\nfunction bindActionCreator(actionCreator, dispatch) {\n return function () {\n return dispatch(actionCreator.apply(this, arguments));\n };\n}\n/**\n * Turns an object whose values are action creators, into an object with the\n * same keys, but with every function wrapped into a `dispatch` call so they\n * may be invoked directly. This is just a convenience method, as you can call\n * `store.dispatch(MyActionCreators.doSomething())` yourself just fine.\n *\n * For convenience, you can also pass an action creator as the first argument,\n * and get a dispatch wrapped function in return.\n *\n * @param {Function|Object} actionCreators An object whose values are action\n * creator functions. One handy way to obtain it is to use ES6 `import * as`\n * syntax. You may also pass a single function.\n *\n * @param {Function} dispatch The `dispatch` function available on your Redux\n * store.\n *\n * @returns {Function|Object} The object mimicking the original object, but with\n * every action creator wrapped into the `dispatch` call. If you passed a\n * function as `actionCreators`, the return value will also be a single\n * function.\n */\n\n\nfunction bindActionCreators(actionCreators, dispatch) {\n if (typeof actionCreators === 'function') {\n return bindActionCreator(actionCreators, dispatch);\n }\n\n if (typeof actionCreators !== 'object' || actionCreators === null) {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(16) : \"bindActionCreators expected an object or a function, but instead received: '\" + kindOf(actionCreators) + \"'. \" + \"Did you write \\\"import ActionCreators from\\\" instead of \\\"import * as ActionCreators from\\\"?\");\n }\n\n var boundActionCreators = {};\n\n for (var key in actionCreators) {\n var actionCreator = actionCreators[key];\n\n if (typeof actionCreator === 'function') {\n boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);\n }\n }\n\n return boundActionCreators;\n}\n\n/**\n * Composes single-argument functions from right to left. The rightmost\n * function can take multiple arguments as it provides the signature for\n * the resulting composite function.\n *\n * @param {...Function} funcs The functions to compose.\n * @returns {Function} A function obtained by composing the argument functions\n * from right to left. For example, compose(f, g, h) is identical to doing\n * (...args) => f(g(h(...args))).\n */\nfunction compose() {\n for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {\n funcs[_key] = arguments[_key];\n }\n\n if (funcs.length === 0) {\n return function (arg) {\n return arg;\n };\n }\n\n if (funcs.length === 1) {\n return funcs[0];\n }\n\n return funcs.reduce(function (a, b) {\n return function () {\n return a(b.apply(void 0, arguments));\n };\n });\n}\n\n/**\n * Creates a store enhancer that applies middleware to the dispatch method\n * of the Redux store. This is handy for a variety of tasks, such as expressing\n * asynchronous actions in a concise manner, or logging every action payload.\n *\n * See `redux-thunk` package as an example of the Redux middleware.\n *\n * Because middleware is potentially asynchronous, this should be the first\n * store enhancer in the composition chain.\n *\n * Note that each middleware will be given the `dispatch` and `getState` functions\n * as named arguments.\n *\n * @param {...Function} middlewares The middleware chain to be applied.\n * @returns {Function} A store enhancer applying the middleware.\n */\n\nfunction applyMiddleware() {\n for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {\n middlewares[_key] = arguments[_key];\n }\n\n return function (createStore) {\n return function () {\n var store = createStore.apply(void 0, arguments);\n\n var _dispatch = function dispatch() {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(15) : 'Dispatching while constructing your middleware is not allowed. ' + 'Other middleware would not be applied to this dispatch.');\n };\n\n var middlewareAPI = {\n getState: store.getState,\n dispatch: function dispatch() {\n return _dispatch.apply(void 0, arguments);\n }\n };\n var chain = middlewares.map(function (middleware) {\n return middleware(middlewareAPI);\n });\n _dispatch = compose.apply(void 0, chain)(store.dispatch);\n return _objectSpread(_objectSpread({}, store), {}, {\n dispatch: _dispatch\n });\n };\n };\n}\n\n/*\n * This is a dummy function to check if the function name has been altered by minification.\n * If the function has been minified and NODE_ENV !== 'production', warn the user.\n */\n\nfunction isCrushed() {}\n\nif (process.env.NODE_ENV !== 'production' && typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') {\n warning('You are currently using minified code outside of NODE_ENV === \"production\". ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or setting mode to production in webpack (https://webpack.js.org/concepts/mode/) ' + 'to ensure you have the correct code for your production build.');\n}\n\nexport { ActionTypes as __DO_NOT_USE__ActionTypes, applyMiddleware, bindActionCreators, combineReducers, compose, createStore };\n", "/** A function that accepts a potential \"extra argument\" value to be injected later,\r\n * and returns an instance of the thunk middleware that uses that value\r\n */\nfunction createThunkMiddleware(extraArgument) {\n // Standard Redux middleware definition pattern:\n // See: https://redux.js.org/tutorials/fundamentals/part-4-store#writing-custom-middleware\n var middleware = function middleware(_ref) {\n var dispatch = _ref.dispatch,\n getState = _ref.getState;\n return function (next) {\n return function (action) {\n // The thunk middleware looks for any functions that were passed to `store.dispatch`.\n // If this \"action\" is really a function, call it and return the result.\n if (typeof action === 'function') {\n // Inject the store's `dispatch` and `getState` methods, as well as any \"extra arg\"\n return action(dispatch, getState, extraArgument);\n } // Otherwise, pass the action down the middleware chain as usual\n\n\n return next(action);\n };\n };\n };\n\n return middleware;\n}\n\nvar thunk = createThunkMiddleware(); // Attach the factory function so users can create a customized version\n// with whatever \"extra arg\" they want to inject into their thunks\n\nthunk.withExtraArgument = createThunkMiddleware;\nexport default thunk;", "import { enableES5 } from 'immer'\r\nexport * from 'redux'\r\nexport {\r\n default as createNextState,\r\n current,\r\n freeze,\r\n original,\r\n isDraft,\r\n} from 'immer'\r\nexport type { Draft } from 'immer'\r\nexport { createSelector } from 'reselect'\r\nexport type {\r\n Selector,\r\n OutputParametricSelector,\r\n OutputSelector,\r\n ParametricSelector,\r\n} from 'reselect'\r\nexport { createDraftSafeSelector } from './createDraftSafeSelector'\r\nexport type { ThunkAction, ThunkDispatch } from 'redux-thunk'\r\n\r\n// We deliberately enable Immer's ES5 support, on the grounds that\r\n// we assume RTK will be used with React Native and other Proxy-less\r\n// environments. In addition, that's how Immer 4 behaved, and since\r\n// we want to ship this in an RTK minor, we should keep the same behavior.\r\nenableES5()\r\n\r\nexport {\r\n // js\r\n configureStore,\r\n} from './configureStore'\r\nexport type {\r\n // types\r\n ConfigureEnhancersCallback,\r\n ConfigureStoreOptions,\r\n EnhancedStore,\r\n} from './configureStore'\r\nexport {\r\n // js\r\n createAction,\r\n getType,\r\n} from './createAction'\r\nexport type {\r\n // types\r\n PayloadAction,\r\n PayloadActionCreator,\r\n ActionCreatorWithNonInferrablePayload,\r\n ActionCreatorWithOptionalPayload,\r\n ActionCreatorWithPayload,\r\n ActionCreatorWithoutPayload,\r\n ActionCreatorWithPreparedPayload,\r\n PrepareAction,\r\n} from './createAction'\r\nexport {\r\n // js\r\n createReducer,\r\n} from './createReducer'\r\nexport type {\r\n // types\r\n Actions,\r\n CaseReducer,\r\n CaseReducers,\r\n} from './createReducer'\r\nexport {\r\n // js\r\n createSlice,\r\n} from './createSlice'\r\n\r\nexport type {\r\n // types\r\n CreateSliceOptions,\r\n Slice,\r\n CaseReducerActions,\r\n SliceCaseReducers,\r\n ValidateSliceCaseReducers,\r\n CaseReducerWithPrepare,\r\n SliceActionCreator,\r\n} from './createSlice'\r\nexport {\r\n // js\r\n createImmutableStateInvariantMiddleware,\r\n isImmutableDefault,\r\n} from './immutableStateInvariantMiddleware'\r\nexport type {\r\n // types\r\n ImmutableStateInvariantMiddlewareOptions,\r\n} from './immutableStateInvariantMiddleware'\r\nexport {\r\n // js\r\n createSerializableStateInvariantMiddleware,\r\n findNonSerializableValue,\r\n isPlain,\r\n} from './serializableStateInvariantMiddleware'\r\nexport type {\r\n // types\r\n SerializableStateInvariantMiddlewareOptions,\r\n} from './serializableStateInvariantMiddleware'\r\nexport {\r\n // js\r\n getDefaultMiddleware,\r\n} from './getDefaultMiddleware'\r\nexport type {\r\n // types\r\n ActionReducerMapBuilder,\r\n} from './mapBuilders'\r\nexport { MiddlewareArray } from './utils'\r\n\r\nexport { createEntityAdapter } from './entities/create_adapter'\r\nexport type {\r\n Dictionary,\r\n EntityState,\r\n EntityAdapter,\r\n EntitySelectors,\r\n EntityStateAdapter,\r\n EntityId,\r\n Update,\r\n IdSelector,\r\n Comparer,\r\n} from './entities/models'\r\n\r\nexport {\r\n createAsyncThunk,\r\n unwrapResult,\r\n miniSerializeError,\r\n} from './createAsyncThunk'\r\nexport type {\r\n AsyncThunk,\r\n AsyncThunkOptions,\r\n AsyncThunkAction,\r\n AsyncThunkPayloadCreatorReturnValue,\r\n AsyncThunkPayloadCreator,\r\n SerializedError,\r\n} from './createAsyncThunk'\r\n\r\nexport {\r\n // js\r\n isAllOf,\r\n isAnyOf,\r\n isPending,\r\n isRejected,\r\n isFulfilled,\r\n isAsyncThunkAction,\r\n isRejectedWithValue,\r\n} from './matchers'\r\nexport type {\r\n // types\r\n ActionMatchingAllOf,\r\n ActionMatchingAnyOf,\r\n} from './matchers'\r\n\r\nexport { nanoid } from './nanoid'\r\n\r\nexport { default as isPlainObject } from './isPlainObject'\r\n", "import { current, isDraft } from 'immer'\r\nimport { createSelector } from 'reselect'\r\n\r\n/**\r\n * \"Draft-Safe\" version of `reselect`'s `createSelector`:\r\n * If an `immer`-drafted object is passed into the resulting selector's first argument,\r\n * the selector will act on the current draft value, instead of returning a cached value\r\n * that might be possibly outdated if the draft has been modified since.\r\n * @public\r\n */\r\nexport const createDraftSafeSelector: typeof createSelector = (\r\n ...args: unknown[]\r\n) => {\r\n const selector = (createSelector as any)(...args)\r\n const wrappedSelector = (value: unknown, ...rest: unknown[]) =>\r\n selector(isDraft(value) ? current(value) : value, ...rest)\r\n return wrappedSelector as any\r\n}\r\n", "import type {\r\n Reducer,\r\n ReducersMapObject,\r\n Middleware,\r\n Action,\r\n AnyAction,\r\n StoreEnhancer,\r\n Store,\r\n Dispatch,\r\n PreloadedState,\r\n CombinedState,\r\n} from 'redux'\r\nimport { createStore, compose, applyMiddleware, combineReducers } from 'redux'\r\nimport type { EnhancerOptions as DevToolsOptions } from './devtoolsExtension'\r\nimport { composeWithDevTools } from './devtoolsExtension'\r\n\r\nimport isPlainObject from './isPlainObject'\r\nimport type {\r\n ThunkMiddlewareFor,\r\n CurriedGetDefaultMiddleware,\r\n} from './getDefaultMiddleware'\r\nimport { curryGetDefaultMiddleware } from './getDefaultMiddleware'\r\nimport type { DispatchForMiddlewares, NoInfer } from './tsHelpers'\r\n\r\nconst IS_PRODUCTION = process.env.NODE_ENV === 'production'\r\n\r\n/**\r\n * Callback function type, to be used in `ConfigureStoreOptions.enhancers`\r\n *\r\n * @public\r\n */\r\nexport type ConfigureEnhancersCallback = (\r\n defaultEnhancers: readonly StoreEnhancer[]\r\n) => StoreEnhancer[]\r\n\r\n/**\r\n * Options for `configureStore()`.\r\n *\r\n * @public\r\n */\r\nexport interface ConfigureStoreOptions<\r\n S = any,\r\n A extends Action = AnyAction,\r\n M extends Middlewares = Middlewares\r\n> {\r\n /**\r\n * A single reducer function that will be used as the root reducer, or an\r\n * object of slice reducers that will be passed to `combineReducers()`.\r\n */\r\n reducer: Reducer | ReducersMapObject\r\n\r\n /**\r\n * An array of Redux middleware to install. If not supplied, defaults to\r\n * the set of middleware returned by `getDefaultMiddleware()`.\r\n */\r\n middleware?: ((getDefaultMiddleware: CurriedGetDefaultMiddleware) => M) | M\r\n\r\n /**\r\n * Whether to enable Redux DevTools integration. Defaults to `true`.\r\n *\r\n * Additional configuration can be done by passing Redux DevTools options\r\n */\r\n devTools?: boolean | DevToolsOptions\r\n\r\n /**\r\n * The initial state, same as Redux's createStore.\r\n * You may optionally specify it to hydrate the state\r\n * from the server in universal apps, or to restore a previously serialized\r\n * user session. If you use `combineReducers()` to produce the root reducer\r\n * function (either directly or indirectly by passing an object as `reducer`),\r\n * this must be an object with the same shape as the reducer map keys.\r\n */\r\n /* \r\n Not 100% correct but the best approximation we can get:\r\n - if S is a `CombinedState` applying a second `CombinedState` on it does not change anything.\r\n - if it is not, there could be two cases:\r\n - `ReducersMapObject` is being passed in. In this case, we will call `combineReducers` on it and `CombinedState` is correct\r\n - `Reducer` is being passed in. In this case, actually `CombinedState` is wrong and `S` would be correct.\r\n As we cannot distinguish between those two cases without adding another generic paramter, \r\n we just make the pragmatic assumption that the latter almost never happens.\r\n */\r\n preloadedState?: PreloadedState>>\r\n\r\n /**\r\n * The store enhancers to apply. See Redux's `createStore()`.\r\n * All enhancers will be included before the DevTools Extension enhancer.\r\n * If you need to customize the order of enhancers, supply a callback\r\n * function that will receive the original array (ie, `[applyMiddleware]`),\r\n * and should return a new array (such as `[applyMiddleware, offline]`).\r\n * If you only need to add middleware, you can use the `middleware` parameter instead.\r\n */\r\n enhancers?: StoreEnhancer[] | ConfigureEnhancersCallback\r\n}\r\n\r\ntype Middlewares = ReadonlyArray>\r\n\r\n/**\r\n * A Redux store returned by `configureStore()`. Supports dispatching\r\n * side-effectful _thunks_ in addition to plain actions.\r\n *\r\n * @public\r\n */\r\nexport interface EnhancedStore<\r\n S = any,\r\n A extends Action = AnyAction,\r\n M extends Middlewares = Middlewares\r\n> extends Store {\r\n /**\r\n * The `dispatch` method of your store, enhanced by all its middlewares.\r\n *\r\n * @inheritdoc\r\n */\r\n dispatch: Dispatch & DispatchForMiddlewares\r\n}\r\n\r\n/**\r\n * A friendly abstraction over the standard Redux `createStore()` function.\r\n *\r\n * @param config The store configuration.\r\n * @returns A configured Redux store.\r\n *\r\n * @public\r\n */\r\nexport function configureStore<\r\n S = any,\r\n A extends Action = AnyAction,\r\n M extends Middlewares = [ThunkMiddlewareFor]\r\n>(options: ConfigureStoreOptions): EnhancedStore {\r\n const curriedGetDefaultMiddleware = curryGetDefaultMiddleware()\r\n\r\n const {\r\n reducer = undefined,\r\n middleware = curriedGetDefaultMiddleware(),\r\n devTools = true,\r\n preloadedState = undefined,\r\n enhancers = undefined,\r\n } = options || {}\r\n\r\n let rootReducer: Reducer\r\n\r\n if (typeof reducer === 'function') {\r\n rootReducer = reducer\r\n } else if (isPlainObject(reducer)) {\r\n rootReducer = combineReducers(reducer)\r\n } else {\r\n throw new Error(\r\n '\"reducer\" is a required argument, and must be a function or an object of functions that can be passed to combineReducers'\r\n )\r\n }\r\n\r\n let finalMiddleware = middleware\r\n if (typeof finalMiddleware === 'function') {\r\n finalMiddleware = finalMiddleware(curriedGetDefaultMiddleware)\r\n\r\n if (!IS_PRODUCTION && !Array.isArray(finalMiddleware)) {\r\n throw new Error(\r\n 'when using a middleware builder function, an array of middleware must be returned'\r\n )\r\n }\r\n }\r\n if (\r\n !IS_PRODUCTION &&\r\n finalMiddleware.some((item) => typeof item !== 'function')\r\n ) {\r\n throw new Error(\r\n 'each middleware provided to configureStore must be a function'\r\n )\r\n }\r\n\r\n const middlewareEnhancer = applyMiddleware(...finalMiddleware)\r\n\r\n let finalCompose = compose\r\n\r\n if (devTools) {\r\n finalCompose = composeWithDevTools({\r\n // Enable capture of stack traces for dispatched Redux actions\r\n trace: !IS_PRODUCTION,\r\n ...(typeof devTools === 'object' && devTools),\r\n })\r\n }\r\n\r\n let storeEnhancers: StoreEnhancer[] = [middlewareEnhancer]\r\n\r\n if (Array.isArray(enhancers)) {\r\n storeEnhancers = [middlewareEnhancer, ...enhancers]\r\n } else if (typeof enhancers === 'function') {\r\n storeEnhancers = enhancers(storeEnhancers)\r\n }\r\n\r\n const composedEnhancer = finalCompose(...storeEnhancers) as any\r\n\r\n return createStore(rootReducer, preloadedState, composedEnhancer)\r\n}\r\n", "import type { Action, ActionCreator, StoreEnhancer } from 'redux'\r\nimport { compose } from 'redux'\r\n\r\n/**\r\n * @public\r\n */\r\nexport interface EnhancerOptions {\r\n /**\r\n * the instance name to be showed on the monitor page. Default value is `document.title`.\r\n * If not specified and there's no document title, it will consist of `tabId` and `instanceId`.\r\n */\r\n name?: string\r\n /**\r\n * action creators functions to be available in the Dispatcher.\r\n */\r\n actionCreators?: ActionCreator[] | { [key: string]: ActionCreator }\r\n /**\r\n * if more than one action is dispatched in the indicated interval, all new actions will be collected and sent at once.\r\n * It is the joint between performance and speed. When set to `0`, all actions will be sent instantly.\r\n * Set it to a higher value when experiencing perf issues (also `maxAge` to a lower value).\r\n *\r\n * @default 500 ms.\r\n */\r\n latency?: number\r\n /**\r\n * (> 1) - maximum allowed actions to be stored in the history tree. The oldest actions are removed once maxAge is reached. It's critical for performance.\r\n *\r\n * @default 50\r\n */\r\n maxAge?: number\r\n /**\r\n * See detailed documentation at http://extension.remotedev.io/docs/API/Arguments.html#serialize\r\n */\r\n serialize?:\r\n | boolean\r\n | {\r\n options?:\r\n | boolean\r\n | {\r\n date?: boolean\r\n regex?: boolean\r\n undefined?: boolean\r\n error?: boolean\r\n symbol?: boolean\r\n map?: boolean\r\n set?: boolean\r\n function?: boolean | Function\r\n }\r\n replacer?: (key: string, value: unknown) => unknown\r\n reviver?: (key: string, value: unknown) => unknown\r\n immutable?: unknown\r\n refs?: unknown[]\r\n }\r\n /**\r\n * function which takes `action` object and id number as arguments, and should return `action` object back.\r\n */\r\n actionSanitizer?: (action: A, id: number) => A\r\n /**\r\n * function which takes `state` object and index as arguments, and should return `state` object back.\r\n */\r\n stateSanitizer?: (state: S, index: number) => S\r\n /**\r\n * *string or array of strings as regex* - actions types to be hidden / shown in the monitors (while passed to the reducers).\r\n * If `actionsWhitelist` specified, `actionsBlacklist` is ignored.\r\n */\r\n actionsBlacklist?: string | string[]\r\n /**\r\n * *string or array of strings as regex* - actions types to be hidden / shown in the monitors (while passed to the reducers).\r\n * If `actionsWhitelist` specified, `actionsBlacklist` is ignored.\r\n */\r\n actionsWhitelist?: string | string[]\r\n /**\r\n * called for every action before sending, takes `state` and `action` object, and returns `true` in case it allows sending the current data to the monitor.\r\n * Use it as a more advanced version of `actionsBlacklist`/`actionsWhitelist` parameters.\r\n */\r\n predicate?: (state: S, action: A) => boolean\r\n /**\r\n * if specified as `false`, it will not record the changes till clicking on `Start recording` button.\r\n * Available only for Redux enhancer, for others use `autoPause`.\r\n *\r\n * @default true\r\n */\r\n shouldRecordChanges?: boolean\r\n /**\r\n * if specified, whenever clicking on `Pause recording` button and there are actions in the history log, will add this action type.\r\n * If not specified, will commit when paused. Available only for Redux enhancer.\r\n *\r\n * @default \"@@PAUSED\"\"\r\n */\r\n pauseActionType?: string\r\n /**\r\n * auto pauses when the extension\u2019s window is not opened, and so has zero impact on your app when not in use.\r\n * Not available for Redux enhancer (as it already does it but storing the data to be sent).\r\n *\r\n * @default false\r\n */\r\n autoPause?: boolean\r\n /**\r\n * if specified as `true`, it will not allow any non-monitor actions to be dispatched till clicking on `Unlock changes` button.\r\n * Available only for Redux enhancer.\r\n *\r\n * @default false\r\n */\r\n shouldStartLocked?: boolean\r\n /**\r\n * if set to `false`, will not recompute the states on hot reloading (or on replacing the reducers). Available only for Redux enhancer.\r\n *\r\n * @default true\r\n */\r\n shouldHotReload?: boolean\r\n /**\r\n * if specified as `true`, whenever there's an exception in reducers, the monitors will show the error message, and next actions will not be dispatched.\r\n *\r\n * @default false\r\n */\r\n shouldCatchErrors?: boolean\r\n /**\r\n * If you want to restrict the extension, specify the features you allow.\r\n * If not specified, all of the features are enabled. When set as an object, only those included as `true` will be allowed.\r\n * Note that except `true`/`false`, `import` and `export` can be set as `custom` (which is by default for Redux enhancer), meaning that the importing/exporting occurs on the client side.\r\n * Otherwise, you'll get/set the data right from the monitor part.\r\n */\r\n features?: {\r\n /**\r\n * start/pause recording of dispatched actions\r\n */\r\n pause?: boolean\r\n /**\r\n * lock/unlock dispatching actions and side effects\r\n */\r\n lock?: boolean\r\n /**\r\n * persist states on page reloading\r\n */\r\n persist?: boolean\r\n /**\r\n * export history of actions in a file\r\n */\r\n export?: boolean | 'custom'\r\n /**\r\n * import history of actions from a file\r\n */\r\n import?: boolean | 'custom'\r\n /**\r\n * jump back and forth (time travelling)\r\n */\r\n jump?: boolean\r\n /**\r\n * skip (cancel) actions\r\n */\r\n skip?: boolean\r\n /**\r\n * drag and drop actions in the history list\r\n */\r\n reorder?: boolean\r\n /**\r\n * dispatch custom actions or action creators\r\n */\r\n dispatch?: boolean\r\n /**\r\n * generate tests for the selected actions\r\n */\r\n test?: boolean\r\n }\r\n /**\r\n * Set to true or a stacktrace-returning function to record call stack traces for dispatched actions.\r\n * Defaults to false.\r\n */\r\n trace?: boolean | ((action: A) => string)\r\n /**\r\n * The maximum number of stack trace entries to record per action. Defaults to 10.\r\n */\r\n traceLimit?: number\r\n}\r\n\r\n/**\r\n * @public\r\n */\r\nexport const composeWithDevTools: {\r\n (options: EnhancerOptions): typeof compose\r\n (...funcs: Array>): StoreEnhancer\r\n} =\r\n typeof window !== 'undefined' &&\r\n (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__\r\n ? (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__\r\n : function () {\r\n if (arguments.length === 0) return undefined\r\n if (typeof arguments[0] === 'object') return compose\r\n return compose.apply(null, arguments as any as Function[])\r\n }\r\n\r\n/**\r\n * @public\r\n */\r\nexport const devToolsEnhancer: {\r\n (options: EnhancerOptions): StoreEnhancer\r\n} =\r\n typeof window !== 'undefined' && (window as any).__REDUX_DEVTOOLS_EXTENSION__\r\n ? (window as any).__REDUX_DEVTOOLS_EXTENSION__\r\n : function () {\r\n return function (noop) {\r\n return noop\r\n }\r\n }\r\n", "/**\r\n * Returns true if the passed value is \"plain\" object, i.e. an object whose\r\n * prototype is the root `Object.prototype`. This includes objects created\r\n * using object literals, but not for instance for class instances.\r\n *\r\n * @param {any} value The value to inspect.\r\n * @returns {boolean} True if the argument appears to be a plain object.\r\n *\r\n * @public\r\n */\r\nexport default function isPlainObject(value: unknown): value is object {\r\n if (typeof value !== 'object' || value === null) return false\r\n\r\n let proto = Object.getPrototypeOf(value)\r\n if (proto === null) return true\r\n\r\n let baseProto = proto\r\n while (Object.getPrototypeOf(baseProto) !== null) {\r\n baseProto = Object.getPrototypeOf(baseProto)\r\n }\r\n\r\n return proto === baseProto\r\n}\r\n", "import type { Middleware, AnyAction } from 'redux'\r\nimport type { ThunkMiddleware } from 'redux-thunk'\r\nimport thunkMiddleware from 'redux-thunk'\r\nimport type { ImmutableStateInvariantMiddlewareOptions } from './immutableStateInvariantMiddleware'\r\n/* PROD_START_REMOVE_UMD */\r\nimport { createImmutableStateInvariantMiddleware } from './immutableStateInvariantMiddleware'\r\n/* PROD_STOP_REMOVE_UMD */\r\n\r\nimport type { SerializableStateInvariantMiddlewareOptions } from './serializableStateInvariantMiddleware'\r\nimport { createSerializableStateInvariantMiddleware } from './serializableStateInvariantMiddleware'\r\nimport { MiddlewareArray } from './utils'\r\n\r\nfunction isBoolean(x: any): x is boolean {\r\n return typeof x === 'boolean'\r\n}\r\n\r\ninterface ThunkOptions {\r\n extraArgument: E\r\n}\r\n\r\ninterface GetDefaultMiddlewareOptions {\r\n thunk?: boolean | ThunkOptions\r\n immutableCheck?: boolean | ImmutableStateInvariantMiddlewareOptions\r\n serializableCheck?: boolean | SerializableStateInvariantMiddlewareOptions\r\n}\r\n\r\nexport type ThunkMiddlewareFor<\r\n S,\r\n O extends GetDefaultMiddlewareOptions = {}\r\n> = O extends {\r\n thunk: false\r\n}\r\n ? never\r\n : O extends { thunk: { extraArgument: infer E } }\r\n ? ThunkMiddleware\r\n :\r\n | ThunkMiddleware //The ThunkMiddleware with a `null` ExtraArgument is here to provide backwards-compatibility.\r\n | ThunkMiddleware\r\n\r\nexport type CurriedGetDefaultMiddleware = <\r\n O extends Partial = {\r\n thunk: true\r\n immutableCheck: true\r\n serializableCheck: true\r\n }\r\n>(\r\n options?: O\r\n) => MiddlewareArray | ThunkMiddlewareFor>\r\n\r\nexport function curryGetDefaultMiddleware<\r\n S = any\r\n>(): CurriedGetDefaultMiddleware {\r\n return function curriedGetDefaultMiddleware(options) {\r\n return getDefaultMiddleware(options)\r\n }\r\n}\r\n\r\n/**\r\n * Returns any array containing the default middleware installed by\r\n * `configureStore()`. Useful if you want to configure your store with a custom\r\n * `middleware` array but still keep the default set.\r\n *\r\n * @return The default middleware used by `configureStore()`.\r\n *\r\n * @public\r\n *\r\n * @deprecated Prefer to use the callback notation for the `middleware` option in `configureStore`\r\n * to access a pre-typed `getDefaultMiddleware` instead.\r\n */\r\nexport function getDefaultMiddleware<\r\n S = any,\r\n O extends Partial = {\r\n thunk: true\r\n immutableCheck: true\r\n serializableCheck: true\r\n }\r\n>(\r\n options: O = {} as O\r\n): MiddlewareArray | ThunkMiddlewareFor> {\r\n const {\r\n thunk = true,\r\n immutableCheck = true,\r\n serializableCheck = true,\r\n } = options\r\n\r\n let middlewareArray: Middleware<{}, S>[] = new MiddlewareArray()\r\n\r\n if (thunk) {\r\n if (isBoolean(thunk)) {\r\n middlewareArray.push(thunkMiddleware)\r\n } else {\r\n middlewareArray.push(\r\n thunkMiddleware.withExtraArgument(thunk.extraArgument)\r\n )\r\n }\r\n }\r\n\r\n if (process.env.NODE_ENV !== 'production') {\r\n if (immutableCheck) {\r\n /* PROD_START_REMOVE_UMD */\r\n let immutableOptions: ImmutableStateInvariantMiddlewareOptions = {}\r\n\r\n if (!isBoolean(immutableCheck)) {\r\n immutableOptions = immutableCheck\r\n }\r\n\r\n middlewareArray.unshift(\r\n createImmutableStateInvariantMiddleware(immutableOptions)\r\n )\r\n /* PROD_STOP_REMOVE_UMD */\r\n }\r\n\r\n if (serializableCheck) {\r\n let serializableOptions: SerializableStateInvariantMiddlewareOptions = {}\r\n\r\n if (!isBoolean(serializableCheck)) {\r\n serializableOptions = serializableCheck\r\n }\r\n\r\n middlewareArray.push(\r\n createSerializableStateInvariantMiddleware(serializableOptions)\r\n )\r\n }\r\n }\r\n\r\n return middlewareArray as any\r\n}\r\n", "import type { Middleware } from 'redux'\r\n\r\nexport function getTimeMeasureUtils(maxDelay: number, fnName: string) {\r\n let elapsed = 0\r\n return {\r\n measureTime(fn: () => T): T {\r\n const started = Date.now()\r\n try {\r\n return fn()\r\n } finally {\r\n const finished = Date.now()\r\n elapsed += finished - started\r\n }\r\n },\r\n warnIfExceeded() {\r\n if (elapsed > maxDelay) {\r\n console.warn(`${fnName} took ${elapsed}ms, which is more than the warning threshold of ${maxDelay}ms. \r\nIf your state or actions are very large, you may want to disable the middleware as it might cause too much of a slowdown in development mode. See https://redux-toolkit.js.org/api/getDefaultMiddleware for instructions.\r\nIt is disabled in production builds, so you don't need to worry about that.`)\r\n }\r\n },\r\n }\r\n}\r\n\r\n/**\r\n * @public\r\n */\r\nexport class MiddlewareArray<\r\n Middlewares extends Middleware\r\n> extends Array {\r\n constructor(arrayLength?: number)\r\n constructor(...items: Middlewares[])\r\n constructor(...args: any[]) {\r\n super(...args)\r\n Object.setPrototypeOf(this, MiddlewareArray.prototype)\r\n }\r\n\r\n static get [Symbol.species]() {\r\n return MiddlewareArray as any\r\n }\r\n\r\n concat>>(\r\n items: AdditionalMiddlewares\r\n ): MiddlewareArray\r\n\r\n concat>>(\r\n ...items: AdditionalMiddlewares\r\n ): MiddlewareArray\r\n concat(...arr: any[]) {\r\n return super.concat.apply(this, arr)\r\n }\r\n\r\n prepend>>(\r\n items: AdditionalMiddlewares\r\n ): MiddlewareArray\r\n\r\n prepend>>(\r\n ...items: AdditionalMiddlewares\r\n ): MiddlewareArray\r\n\r\n prepend(...arr: any[]) {\r\n if (arr.length === 1 && Array.isArray(arr[0])) {\r\n return new MiddlewareArray(...arr[0].concat(this))\r\n }\r\n return new MiddlewareArray(...arr.concat(this))\r\n }\r\n}\r\n", "import type { Middleware } from 'redux'\r\nimport { getTimeMeasureUtils } from './utils'\r\n\r\ntype EntryProcessor = (key: string, value: any) => any\r\n\r\nconst isProduction: boolean = process.env.NODE_ENV === 'production'\r\nconst prefix: string = 'Invariant failed'\r\n\r\n// Throw an error if the condition fails\r\n// Strip out error messages for production\r\n// > Not providing an inline default argument for message as the result is smaller\r\nfunction invariant(condition: any, message?: string) {\r\n if (condition) {\r\n return\r\n }\r\n // Condition not passed\r\n\r\n // In production we strip the message but still throw\r\n if (isProduction) {\r\n throw new Error(prefix)\r\n }\r\n\r\n // When not in production we allow the message to pass through\r\n // *This block will be removed in production builds*\r\n throw new Error(`${prefix}: ${message || ''}`)\r\n}\r\n\r\nfunction stringify(\r\n obj: any,\r\n serializer?: EntryProcessor,\r\n indent?: string | number,\r\n decycler?: EntryProcessor\r\n): string {\r\n return JSON.stringify(obj, getSerialize(serializer, decycler), indent)\r\n}\r\n\r\nfunction getSerialize(\r\n serializer?: EntryProcessor,\r\n decycler?: EntryProcessor\r\n): EntryProcessor {\r\n let stack: any[] = [],\r\n keys: any[] = []\r\n\r\n if (!decycler)\r\n decycler = function (_: string, value: any) {\r\n if (stack[0] === value) return '[Circular ~]'\r\n return (\r\n '[Circular ~.' + keys.slice(0, stack.indexOf(value)).join('.') + ']'\r\n )\r\n }\r\n\r\n return function (this: any, key: string, value: any) {\r\n if (stack.length > 0) {\r\n var thisPos = stack.indexOf(this)\r\n ~thisPos ? stack.splice(thisPos + 1) : stack.push(this)\r\n ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key)\r\n if (~stack.indexOf(value)) value = decycler!.call(this, key, value)\r\n } else stack.push(value)\r\n\r\n return serializer == null ? value : serializer.call(this, key, value)\r\n }\r\n}\r\n\r\n/**\r\n * The default `isImmutable` function.\r\n *\r\n * @public\r\n */\r\nexport function isImmutableDefault(value: unknown): boolean {\r\n return (\r\n typeof value !== 'object' ||\r\n value === null ||\r\n typeof value === 'undefined' ||\r\n Object.isFrozen(value)\r\n )\r\n}\r\n\r\nexport function trackForMutations(\r\n isImmutable: IsImmutableFunc,\r\n ignorePaths: string[] | undefined,\r\n obj: any\r\n) {\r\n const trackedProperties = trackProperties(isImmutable, ignorePaths, obj)\r\n return {\r\n detectMutations() {\r\n return detectMutations(isImmutable, ignorePaths, trackedProperties, obj)\r\n },\r\n }\r\n}\r\n\r\ninterface TrackedProperty {\r\n value: any\r\n children: Record\r\n}\r\n\r\nfunction trackProperties(\r\n isImmutable: IsImmutableFunc,\r\n ignorePaths: IgnorePaths = [],\r\n obj: Record,\r\n path: string = ''\r\n) {\r\n const tracked: Partial = { value: obj }\r\n\r\n if (!isImmutable(obj)) {\r\n tracked.children = {}\r\n\r\n for (const key in obj) {\r\n const childPath = path ? path + '.' + key : key\r\n if (ignorePaths.length && ignorePaths.indexOf(childPath) !== -1) {\r\n continue\r\n }\r\n\r\n tracked.children[key] = trackProperties(\r\n isImmutable,\r\n ignorePaths,\r\n obj[key],\r\n childPath\r\n )\r\n }\r\n }\r\n return tracked as TrackedProperty\r\n}\r\n\r\ntype IgnorePaths = readonly string[]\r\n\r\nfunction detectMutations(\r\n isImmutable: IsImmutableFunc,\r\n ignorePaths: IgnorePaths = [],\r\n trackedProperty: TrackedProperty,\r\n obj: any,\r\n sameParentRef: boolean = false,\r\n path: string = ''\r\n): { wasMutated: boolean; path?: string } {\r\n const prevObj = trackedProperty ? trackedProperty.value : undefined\r\n\r\n const sameRef = prevObj === obj\r\n\r\n if (sameParentRef && !sameRef && !Number.isNaN(obj)) {\r\n return { wasMutated: true, path }\r\n }\r\n\r\n if (isImmutable(prevObj) || isImmutable(obj)) {\r\n return { wasMutated: false }\r\n }\r\n\r\n // Gather all keys from prev (tracked) and after objs\r\n const keysToDetect: Record = {}\r\n for (let key in trackedProperty.children) {\r\n keysToDetect[key] = true\r\n }\r\n for (let key in obj) {\r\n keysToDetect[key] = true\r\n }\r\n\r\n for (let key in keysToDetect) {\r\n const childPath = path ? path + '.' + key : key\r\n if (ignorePaths.length && ignorePaths.indexOf(childPath) !== -1) {\r\n continue\r\n }\r\n\r\n const result = detectMutations(\r\n isImmutable,\r\n ignorePaths,\r\n trackedProperty.children[key],\r\n obj[key],\r\n sameRef,\r\n childPath\r\n )\r\n\r\n if (result.wasMutated) {\r\n return result\r\n }\r\n }\r\n return { wasMutated: false }\r\n}\r\n\r\ntype IsImmutableFunc = (value: any) => boolean\r\n\r\n/**\r\n * Options for `createImmutableStateInvariantMiddleware()`.\r\n *\r\n * @public\r\n */\r\nexport interface ImmutableStateInvariantMiddlewareOptions {\r\n /**\r\n Callback function to check if a value is considered to be immutable.\r\n This function is applied recursively to every value contained in the state.\r\n The default implementation will return true for primitive types \r\n (like numbers, strings, booleans, null and undefined).\r\n */\r\n isImmutable?: IsImmutableFunc\r\n /** \r\n An array of dot-separated path strings that match named nodes from \r\n the root state to ignore when checking for immutability.\r\n Defaults to undefined\r\n */\r\n ignoredPaths?: string[]\r\n /** Print a warning if checks take longer than N ms. Default: 32ms */\r\n warnAfter?: number\r\n // @deprecated. Use ignoredPaths\r\n ignore?: string[]\r\n}\r\n\r\n/**\r\n * Creates a middleware that checks whether any state was mutated in between\r\n * dispatches or during a dispatch. If any mutations are detected, an error is\r\n * thrown.\r\n *\r\n * @param options Middleware options.\r\n *\r\n * @public\r\n */\r\nexport function createImmutableStateInvariantMiddleware(\r\n options: ImmutableStateInvariantMiddlewareOptions = {}\r\n): Middleware {\r\n if (process.env.NODE_ENV === 'production') {\r\n return () => (next) => (action) => next(action)\r\n }\r\n\r\n let {\r\n isImmutable = isImmutableDefault,\r\n ignoredPaths,\r\n warnAfter = 32,\r\n ignore,\r\n } = options\r\n\r\n // Alias ignore->ignoredPaths, but prefer ignoredPaths if present\r\n ignoredPaths = ignoredPaths || ignore\r\n\r\n const track = trackForMutations.bind(null, isImmutable, ignoredPaths)\r\n\r\n return ({ getState }) => {\r\n let state = getState()\r\n let tracker = track(state)\r\n\r\n let result\r\n return (next) => (action) => {\r\n const measureUtils = getTimeMeasureUtils(\r\n warnAfter,\r\n 'ImmutableStateInvariantMiddleware'\r\n )\r\n\r\n measureUtils.measureTime(() => {\r\n state = getState()\r\n\r\n result = tracker.detectMutations()\r\n // Track before potentially not meeting the invariant\r\n tracker = track(state)\r\n\r\n invariant(\r\n !result.wasMutated,\r\n `A state mutation was detected between dispatches, in the path '${\r\n result.path || ''\r\n }'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`\r\n )\r\n })\r\n\r\n const dispatchedAction = next(action)\r\n\r\n measureUtils.measureTime(() => {\r\n state = getState()\r\n\r\n result = tracker.detectMutations()\r\n // Track before potentially not meeting the invariant\r\n tracker = track(state)\r\n\r\n result.wasMutated &&\r\n invariant(\r\n !result.wasMutated,\r\n `A state mutation was detected inside a dispatch, in the path: ${\r\n result.path || ''\r\n }. Take a look at the reducer(s) handling the action ${stringify(\r\n action\r\n )}. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`\r\n )\r\n })\r\n\r\n measureUtils.warnIfExceeded()\r\n\r\n return dispatchedAction\r\n }\r\n }\r\n}\r\n", "import isPlainObject from './isPlainObject'\r\nimport type { Middleware } from 'redux'\r\nimport { getTimeMeasureUtils } from './utils'\r\n\r\n/**\r\n * Returns true if the passed value is \"plain\", i.e. a value that is either\r\n * directly JSON-serializable (boolean, number, string, array, plain object)\r\n * or `undefined`.\r\n *\r\n * @param val The value to check.\r\n *\r\n * @public\r\n */\r\nexport function isPlain(val: any) {\r\n const type = typeof val\r\n return (\r\n type === 'undefined' ||\r\n val === null ||\r\n type === 'string' ||\r\n type === 'boolean' ||\r\n type === 'number' ||\r\n Array.isArray(val) ||\r\n isPlainObject(val)\r\n )\r\n}\r\n\r\ninterface NonSerializableValue {\r\n keyPath: string\r\n value: unknown\r\n}\r\n\r\n/**\r\n * @public\r\n */\r\nexport function findNonSerializableValue(\r\n value: unknown,\r\n path: string = '',\r\n isSerializable: (value: unknown) => boolean = isPlain,\r\n getEntries?: (value: unknown) => [string, any][],\r\n ignoredPaths: readonly string[] = []\r\n): NonSerializableValue | false {\r\n let foundNestedSerializable: NonSerializableValue | false\r\n\r\n if (!isSerializable(value)) {\r\n return {\r\n keyPath: path || '',\r\n value: value,\r\n }\r\n }\r\n\r\n if (typeof value !== 'object' || value === null) {\r\n return false\r\n }\r\n\r\n const entries = getEntries != null ? getEntries(value) : Object.entries(value)\r\n\r\n const hasIgnoredPaths = ignoredPaths.length > 0\r\n\r\n for (const [key, nestedValue] of entries) {\r\n const nestedPath = path ? path + '.' + key : key\r\n\r\n if (hasIgnoredPaths && ignoredPaths.indexOf(nestedPath) >= 0) {\r\n continue\r\n }\r\n\r\n if (!isSerializable(nestedValue)) {\r\n return {\r\n keyPath: nestedPath,\r\n value: nestedValue,\r\n }\r\n }\r\n\r\n if (typeof nestedValue === 'object') {\r\n foundNestedSerializable = findNonSerializableValue(\r\n nestedValue,\r\n nestedPath,\r\n isSerializable,\r\n getEntries,\r\n ignoredPaths\r\n )\r\n\r\n if (foundNestedSerializable) {\r\n return foundNestedSerializable\r\n }\r\n }\r\n }\r\n\r\n return false\r\n}\r\n\r\n/**\r\n * Options for `createSerializableStateInvariantMiddleware()`.\r\n *\r\n * @public\r\n */\r\nexport interface SerializableStateInvariantMiddlewareOptions {\r\n /**\r\n * The function to check if a value is considered serializable. This\r\n * function is applied recursively to every value contained in the\r\n * state. Defaults to `isPlain()`.\r\n */\r\n isSerializable?: (value: any) => boolean\r\n /**\r\n * The function that will be used to retrieve entries from each\r\n * value. If unspecified, `Object.entries` will be used. Defaults\r\n * to `undefined`.\r\n */\r\n getEntries?: (value: any) => [string, any][]\r\n\r\n /**\r\n * An array of action types to ignore when checking for serializability.\r\n * Defaults to []\r\n */\r\n ignoredActions?: string[]\r\n\r\n /**\r\n * An array of dot-separated path strings to ignore when checking\r\n * for serializability, Defaults to ['meta.arg', 'meta.baseQueryMeta']\r\n */\r\n ignoredActionPaths?: string[]\r\n\r\n /**\r\n * An array of dot-separated path strings to ignore when checking\r\n * for serializability, Defaults to []\r\n */\r\n ignoredPaths?: string[]\r\n /**\r\n * Execution time warning threshold. If the middleware takes longer\r\n * than `warnAfter` ms, a warning will be displayed in the console.\r\n * Defaults to 32ms.\r\n */\r\n warnAfter?: number\r\n\r\n /**\r\n * Opt out of checking state, but continue checking actions\r\n */\r\n ignoreState?: boolean\r\n}\r\n\r\n/**\r\n * Creates a middleware that, after every state change, checks if the new\r\n * state is serializable. If a non-serializable value is found within the\r\n * state, an error is printed to the console.\r\n *\r\n * @param options Middleware options.\r\n *\r\n * @public\r\n */\r\nexport function createSerializableStateInvariantMiddleware(\r\n options: SerializableStateInvariantMiddlewareOptions = {}\r\n): Middleware {\r\n if (process.env.NODE_ENV === 'production') {\r\n return () => (next) => (action) => next(action)\r\n }\r\n const {\r\n isSerializable = isPlain,\r\n getEntries,\r\n ignoredActions = [],\r\n ignoredActionPaths = ['meta.arg', 'meta.baseQueryMeta'],\r\n ignoredPaths = [],\r\n warnAfter = 32,\r\n ignoreState = false,\r\n } = options\r\n\r\n return (storeAPI) => (next) => (action) => {\r\n if (ignoredActions.length && ignoredActions.indexOf(action.type) !== -1) {\r\n return next(action)\r\n }\r\n\r\n const measureUtils = getTimeMeasureUtils(\r\n warnAfter,\r\n 'SerializableStateInvariantMiddleware'\r\n )\r\n measureUtils.measureTime(() => {\r\n const foundActionNonSerializableValue = findNonSerializableValue(\r\n action,\r\n '',\r\n isSerializable,\r\n getEntries,\r\n ignoredActionPaths\r\n )\r\n\r\n if (foundActionNonSerializableValue) {\r\n const { keyPath, value } = foundActionNonSerializableValue\r\n\r\n console.error(\r\n `A non-serializable value was detected in an action, in the path: \\`${keyPath}\\`. Value:`,\r\n value,\r\n '\\nTake a look at the logic that dispatched this action: ',\r\n action,\r\n '\\n(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)',\r\n '\\n(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)'\r\n )\r\n }\r\n })\r\n\r\n const result = next(action)\r\n\r\n if (!ignoreState) {\r\n measureUtils.measureTime(() => {\r\n const state = storeAPI.getState()\r\n\r\n const foundStateNonSerializableValue = findNonSerializableValue(\r\n state,\r\n '',\r\n isSerializable,\r\n getEntries,\r\n ignoredPaths\r\n )\r\n\r\n if (foundStateNonSerializableValue) {\r\n const { keyPath, value } = foundStateNonSerializableValue\r\n\r\n console.error(\r\n `A non-serializable value was detected in the state, in the path: \\`${keyPath}\\`. Value:`,\r\n value,\r\n `\r\nTake a look at the reducer(s) handling this action type: ${action.type}.\r\n(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)`\r\n )\r\n }\r\n })\r\n\r\n measureUtils.warnIfExceeded()\r\n }\r\n\r\n return result\r\n }\r\n}\r\n", "import type { Action } from 'redux'\r\nimport type {\r\n IsUnknownOrNonInferrable,\r\n IfMaybeUndefined,\r\n IfVoid,\r\n IsAny,\r\n} from './tsHelpers'\r\nimport isPlainObject from './isPlainObject'\r\n\r\n/**\r\n * An action with a string type and an associated payload. This is the\r\n * type of action returned by `createAction()` action creators.\r\n *\r\n * @template P The type of the action's payload.\r\n * @template T the type used for the action type.\r\n * @template M The type of the action's meta (optional)\r\n * @template E The type of the action's error (optional)\r\n *\r\n * @public\r\n */\r\nexport type PayloadAction<\r\n P = void,\r\n T extends string = string,\r\n M = never,\r\n E = never\r\n> = {\r\n payload: P\r\n type: T\r\n} & ([M] extends [never]\r\n ? {}\r\n : {\r\n meta: M\r\n }) &\r\n ([E] extends [never]\r\n ? {}\r\n : {\r\n error: E\r\n })\r\n\r\n/**\r\n * A \"prepare\" method to be used as the second parameter of `createAction`.\r\n * Takes any number of arguments and returns a Flux Standard Action without\r\n * type (will be added later) that *must* contain a payload (might be undefined).\r\n *\r\n * @public\r\n */\r\nexport type PrepareAction

=\r\n | ((...args: any[]) => { payload: P })\r\n | ((...args: any[]) => { payload: P; meta: any })\r\n | ((...args: any[]) => { payload: P; error: any })\r\n | ((...args: any[]) => { payload: P; meta: any; error: any })\r\n\r\n/**\r\n * Internal version of `ActionCreatorWithPreparedPayload`. Not to be used externally.\r\n *\r\n * @internal\r\n */\r\nexport type _ActionCreatorWithPreparedPayload<\r\n PA extends PrepareAction | void,\r\n T extends string = string\r\n> = PA extends PrepareAction\r\n ? ActionCreatorWithPreparedPayload<\r\n Parameters,\r\n P,\r\n T,\r\n ReturnType extends {\r\n error: infer E\r\n }\r\n ? E\r\n : never,\r\n ReturnType extends {\r\n meta: infer M\r\n }\r\n ? M\r\n : never\r\n >\r\n : void\r\n\r\n/**\r\n * Basic type for all action creators.\r\n *\r\n * @inheritdoc {redux#ActionCreator}\r\n */\r\ninterface BaseActionCreator {\r\n type: T\r\n match: (action: Action) => action is PayloadAction\r\n}\r\n\r\n/**\r\n * An action creator that takes multiple arguments that are passed\r\n * to a `PrepareAction` method to create the final Action.\r\n * @typeParam Args arguments for the action creator function\r\n * @typeParam P `payload` type\r\n * @typeParam T `type` name\r\n * @typeParam E optional `error` type\r\n * @typeParam M optional `meta` type\r\n *\r\n * @inheritdoc {redux#ActionCreator}\r\n *\r\n * @public\r\n */\r\nexport interface ActionCreatorWithPreparedPayload<\r\n Args extends unknown[],\r\n P,\r\n T extends string = string,\r\n E = never,\r\n M = never\r\n> extends BaseActionCreator {\r\n /**\r\n * Calling this {@link redux#ActionCreator} with `Args` will return\r\n * an Action with a payload of type `P` and (depending on the `PrepareAction`\r\n * method used) a `meta`- and `error` property of types `M` and `E` respectively.\r\n */\r\n (...args: Args): PayloadAction\r\n}\r\n\r\n/**\r\n * An action creator of type `T` that takes an optional payload of type `P`.\r\n *\r\n * @inheritdoc {redux#ActionCreator}\r\n *\r\n * @public\r\n */\r\nexport interface ActionCreatorWithOptionalPayload\r\n extends BaseActionCreator {\r\n /**\r\n * Calling this {@link redux#ActionCreator} with an argument will\r\n * return a {@link PayloadAction} of type `T` with a payload of `P`.\r\n * Calling it without an argument will return a PayloadAction with a payload of `undefined`.\r\n */\r\n (payload?: P): PayloadAction\r\n}\r\n\r\n/**\r\n * An action creator of type `T` that takes no payload.\r\n *\r\n * @inheritdoc {redux#ActionCreator}\r\n *\r\n * @public\r\n */\r\nexport interface ActionCreatorWithoutPayload\r\n extends BaseActionCreator {\r\n /**\r\n * Calling this {@link redux#ActionCreator} will\r\n * return a {@link PayloadAction} of type `T` with a payload of `undefined`\r\n */\r\n (): PayloadAction\r\n}\r\n\r\n/**\r\n * An action creator of type `T` that requires a payload of type P.\r\n *\r\n * @inheritdoc {redux#ActionCreator}\r\n *\r\n * @public\r\n */\r\nexport interface ActionCreatorWithPayload\r\n extends BaseActionCreator {\r\n /**\r\n * Calling this {@link redux#ActionCreator} with an argument will\r\n * return a {@link PayloadAction} of type `T` with a payload of `P`\r\n */\r\n (payload: P): PayloadAction\r\n}\r\n\r\n/**\r\n * An action creator of type `T` whose `payload` type could not be inferred. Accepts everything as `payload`.\r\n *\r\n * @inheritdoc {redux#ActionCreator}\r\n *\r\n * @public\r\n */\r\nexport interface ActionCreatorWithNonInferrablePayload<\r\n T extends string = string\r\n> extends BaseActionCreator {\r\n /**\r\n * Calling this {@link redux#ActionCreator} with an argument will\r\n * return a {@link PayloadAction} of type `T` with a payload\r\n * of exactly the type of the argument.\r\n */\r\n (payload: PT): PayloadAction\r\n}\r\n\r\n/**\r\n * An action creator that produces actions with a `payload` attribute.\r\n *\r\n * @typeParam P the `payload` type\r\n * @typeParam T the `type` of the resulting action\r\n * @typeParam PA if the resulting action is preprocessed by a `prepare` method, the signature of said method.\r\n *\r\n * @public\r\n */\r\nexport type PayloadActionCreator<\r\n P = void,\r\n T extends string = string,\r\n PA extends PrepareAction

| void = void\r\n> = IfPrepareActionMethodProvided<\r\n PA,\r\n _ActionCreatorWithPreparedPayload,\r\n // else\r\n IsAny<\r\n P,\r\n ActionCreatorWithPayload,\r\n IsUnknownOrNonInferrable<\r\n P,\r\n ActionCreatorWithNonInferrablePayload,\r\n // else\r\n IfVoid<\r\n P,\r\n ActionCreatorWithoutPayload,\r\n // else\r\n IfMaybeUndefined<\r\n P,\r\n ActionCreatorWithOptionalPayload,\r\n // else\r\n ActionCreatorWithPayload\r\n >\r\n >\r\n >\r\n >\r\n>\r\n\r\n/**\r\n * A utility function to create an action creator for the given action type\r\n * string. The action creator accepts a single argument, which will be included\r\n * in the action object as a field called payload. The action creator function\r\n * will also have its toString() overriden so that it returns the action type,\r\n * allowing it to be used in reducer logic that is looking for that action type.\r\n *\r\n * @param type The action type to use for created actions.\r\n * @param prepare (optional) a method that takes any number of arguments and returns { payload } or { payload, meta }.\r\n * If this is given, the resulting action creator will pass its arguments to this method to calculate payload & meta.\r\n *\r\n * @public\r\n */\r\nexport function createAction

= PayloadActionCreator

\r\n\r\n/**\r\n * The return value of `createSlice`\r\n *\r\n * @public\r\n */\r\nexport interface Slice<\r\n State = any,\r\n CaseReducers extends SliceCaseReducers = SliceCaseReducers,\r\n Name extends string = string\r\n> {\r\n /**\r\n * The slice name.\r\n */\r\n name: Name\r\n\r\n /**\r\n * The slice's reducer.\r\n */\r\n reducer: Reducer\r\n\r\n /**\r\n * Action creators for the types of actions that are handled by the slice\r\n * reducer.\r\n */\r\n actions: CaseReducerActions\r\n\r\n /**\r\n * The individual case reducer functions that were passed in the `reducers` parameter.\r\n * This enables reuse and testing if they were defined inline when calling `createSlice`.\r\n */\r\n caseReducers: SliceDefinedCaseReducers\r\n\r\n /**\r\n * Provides access to the initial state value given to the slice.\r\n * If a lazy state initializer was provided, it will be called and a fresh value returned.\r\n */\r\n getInitialState: () => State\r\n}\r\n\r\n/**\r\n * Options for `createSlice()`.\r\n *\r\n * @public\r\n */\r\nexport interface CreateSliceOptions<\r\n State = any,\r\n CR extends SliceCaseReducers = SliceCaseReducers,\r\n Name extends string = string\r\n> {\r\n /**\r\n * The slice's name. Used to namespace the generated action types.\r\n */\r\n name: Name\r\n\r\n /**\r\n * The initial state that should be used when the reducer is called the first time. This may also be a \"lazy initializer\" function, which should return an initial state value when called. This will be used whenever the reducer is called with `undefined` as its state value, and is primarily useful for cases like reading initial state from `localStorage`.\r\n */\r\n initialState: State | (() => State)\r\n\r\n /**\r\n * A mapping from action types to action-type-specific *case reducer*\r\n * functions. For every action type, a matching action creator will be\r\n * generated using `createAction()`.\r\n */\r\n reducers: ValidateSliceCaseReducers\r\n\r\n /**\r\n * A callback that receives a *builder* object to define\r\n * case reducers via calls to `builder.addCase(actionCreatorOrType, reducer)`.\r\n * \r\n * Alternatively, a mapping from action types to action-type-specific *case reducer*\r\n * functions. These reducers should have existing action types used\r\n * as the keys, and action creators will _not_ be generated.\r\n * \r\n * @example\r\n```ts\r\nimport { createAction, createSlice, Action, AnyAction } from '@reduxjs/toolkit'\r\nconst incrementBy = createAction('incrementBy')\r\nconst decrement = createAction('decrement')\r\n\r\ninterface RejectedAction extends Action {\r\n error: Error\r\n}\r\n\r\nfunction isRejectedAction(action: AnyAction): action is RejectedAction {\r\n return action.type.endsWith('rejected')\r\n}\r\n\r\ncreateSlice({\r\n name: 'counter',\r\n initialState: 0,\r\n reducers: {},\r\n extraReducers: builder => {\r\n builder\r\n .addCase(incrementBy, (state, action) => {\r\n // action is inferred correctly here if using TS\r\n })\r\n // You can chain calls, or have separate `builder.addCase()` lines each time\r\n .addCase(decrement, (state, action) => {})\r\n // You can match a range of action types\r\n .addMatcher(\r\n isRejectedAction,\r\n // `action` will be inferred as a RejectedAction due to isRejectedAction being defined as a type guard\r\n (state, action) => {}\r\n )\r\n // and provide a default case if no other handlers matched\r\n .addDefaultCase((state, action) => {})\r\n }\r\n})\r\n```\r\n */\r\n extraReducers?:\r\n | CaseReducers, any>\r\n | ((builder: ActionReducerMapBuilder>) => void)\r\n}\r\n\r\n/**\r\n * A CaseReducer with a `prepare` method.\r\n *\r\n * @public\r\n */\r\nexport type CaseReducerWithPrepare = {\r\n reducer: CaseReducer\r\n prepare: PrepareAction\r\n}\r\n\r\n/**\r\n * The type describing a slice's `reducers` option.\r\n *\r\n * @public\r\n */\r\nexport type SliceCaseReducers = {\r\n [K: string]:\r\n | CaseReducer>\r\n | CaseReducerWithPrepare>\r\n}\r\n\r\n/**\r\n * Derives the slice's `actions` property from the `reducers` options\r\n *\r\n * @public\r\n */\r\nexport type CaseReducerActions> = {\r\n [Type in keyof CaseReducers]: CaseReducers[Type] extends { prepare: any }\r\n ? ActionCreatorForCaseReducerWithPrepare\r\n : ActionCreatorForCaseReducer\r\n}\r\n\r\n/**\r\n * Get a `PayloadActionCreator` type for a passed `CaseReducerWithPrepare`\r\n *\r\n * @internal\r\n */\r\ntype ActionCreatorForCaseReducerWithPrepare =\r\n _ActionCreatorWithPreparedPayload\r\n\r\n/**\r\n * Get a `PayloadActionCreator` type for a passed `CaseReducer`\r\n *\r\n * @internal\r\n */\r\ntype ActionCreatorForCaseReducer = CR extends (\r\n state: any,\r\n action: infer Action\r\n) => any\r\n ? Action extends { payload: infer P }\r\n ? PayloadActionCreator

\r\n : ActionCreatorWithoutPayload\r\n : ActionCreatorWithoutPayload\r\n\r\n/**\r\n * Extracts the CaseReducers out of a `reducers` object, even if they are\r\n * tested into a `CaseReducerWithPrepare`.\r\n *\r\n * @internal\r\n */\r\ntype SliceDefinedCaseReducers> = {\r\n [Type in keyof CaseReducers]: CaseReducers[Type] extends {\r\n reducer: infer Reducer\r\n }\r\n ? Reducer\r\n : CaseReducers[Type]\r\n}\r\n\r\n/**\r\n * Used on a SliceCaseReducers object.\r\n * Ensures that if a CaseReducer is a `CaseReducerWithPrepare`, that\r\n * the `reducer` and the `prepare` function use the same type of `payload`.\r\n *\r\n * Might do additional such checks in the future.\r\n *\r\n * This type is only ever useful if you want to write your own wrapper around\r\n * `createSlice`. Please don't use it otherwise!\r\n *\r\n * @public\r\n */\r\nexport type ValidateSliceCaseReducers<\r\n S,\r\n ACR extends SliceCaseReducers\r\n> = ACR &\r\n {\r\n [T in keyof ACR]: ACR[T] extends {\r\n reducer(s: S, action?: infer A): any\r\n }\r\n ? {\r\n prepare(...a: never[]): Omit\r\n }\r\n : {}\r\n }\r\n\r\nfunction getType(slice: string, actionKey: string): string {\r\n return `${slice}/${actionKey}`\r\n}\r\n\r\n/**\r\n * A function that accepts an initial state, an object full of reducer\r\n * functions, and a \"slice name\", and automatically generates\r\n * action creators and action types that correspond to the\r\n * reducers and state.\r\n *\r\n * The `reducer` argument is passed to `createReducer()`.\r\n *\r\n * @public\r\n */\r\nexport function createSlice<\r\n State,\r\n CaseReducers extends SliceCaseReducers,\r\n Name extends string = string\r\n>(\r\n options: CreateSliceOptions\r\n): Slice {\r\n const { name } = options\r\n if (!name) {\r\n throw new Error('`name` is a required option for createSlice')\r\n }\r\n const initialState =\r\n typeof options.initialState == 'function'\r\n ? options.initialState\r\n : createNextState(options.initialState, () => {})\r\n\r\n const reducers = options.reducers || {}\r\n\r\n const reducerNames = Object.keys(reducers)\r\n\r\n const sliceCaseReducersByName: Record = {}\r\n const sliceCaseReducersByType: Record = {}\r\n const actionCreators: Record = {}\r\n\r\n reducerNames.forEach((reducerName) => {\r\n const maybeReducerWithPrepare = reducers[reducerName]\r\n const type = getType(name, reducerName)\r\n\r\n let caseReducer: CaseReducer\r\n let prepareCallback: PrepareAction | undefined\r\n\r\n if ('reducer' in maybeReducerWithPrepare) {\r\n caseReducer = maybeReducerWithPrepare.reducer\r\n prepareCallback = maybeReducerWithPrepare.prepare\r\n } else {\r\n caseReducer = maybeReducerWithPrepare\r\n }\r\n\r\n sliceCaseReducersByName[reducerName] = caseReducer\r\n sliceCaseReducersByType[type] = caseReducer\r\n actionCreators[reducerName] = prepareCallback\r\n ? createAction(type, prepareCallback)\r\n : createAction(type)\r\n })\r\n\r\n function buildReducer() {\r\n const [\r\n extraReducers = {},\r\n actionMatchers = [],\r\n defaultCaseReducer = undefined,\r\n ] =\r\n typeof options.extraReducers === 'function'\r\n ? executeReducerBuilderCallback(options.extraReducers)\r\n : [options.extraReducers]\r\n\r\n const finalCaseReducers = { ...extraReducers, ...sliceCaseReducersByType }\r\n return createReducer(\r\n initialState,\r\n finalCaseReducers as any,\r\n actionMatchers,\r\n defaultCaseReducer\r\n )\r\n }\r\n\r\n let _reducer: ReducerWithInitialState\r\n\r\n return {\r\n name,\r\n reducer(state, action) {\r\n if (!_reducer) _reducer = buildReducer()\r\n\r\n return _reducer(state, action)\r\n },\r\n actions: actionCreators as any,\r\n caseReducers: sliceCaseReducersByName as any,\r\n getInitialState() {\r\n if (!_reducer) _reducer = buildReducer()\r\n\r\n return _reducer.getInitialState()\r\n },\r\n }\r\n}\r\n", "import type { EntityState } from './models'\r\n\r\nexport function getInitialEntityState(): EntityState {\r\n return {\r\n ids: [],\r\n entities: {},\r\n }\r\n}\r\n\r\nexport function createInitialStateFactory() {\r\n function getInitialState(): EntityState\r\n function getInitialState(\r\n additionalState: S\r\n ): EntityState & S\r\n function getInitialState(additionalState: any = {}): any {\r\n return Object.assign(getInitialEntityState(), additionalState)\r\n }\r\n\r\n return { getInitialState }\r\n}\r\n", "import type { Selector } from 'reselect'\r\nimport { createDraftSafeSelector } from '../createDraftSafeSelector'\r\nimport type {\r\n EntityState,\r\n EntitySelectors,\r\n Dictionary,\r\n EntityId,\r\n} from './models'\r\n\r\nexport function createSelectorsFactory() {\r\n function getSelectors(): EntitySelectors>\r\n function getSelectors(\r\n selectState: (state: V) => EntityState\r\n ): EntitySelectors\r\n function getSelectors(\r\n selectState?: (state: V) => EntityState\r\n ): EntitySelectors {\r\n const selectIds = (state: EntityState) => state.ids\r\n\r\n const selectEntities = (state: EntityState) => state.entities\r\n\r\n const selectAll = createDraftSafeSelector(\r\n selectIds,\r\n selectEntities,\r\n (ids, entities): T[] => ids.map((id) => entities[id]!)\r\n )\r\n\r\n const selectId = (_: unknown, id: EntityId) => id\r\n\r\n const selectById = (entities: Dictionary, id: EntityId) => entities[id]\r\n\r\n const selectTotal = createDraftSafeSelector(selectIds, (ids) => ids.length)\r\n\r\n if (!selectState) {\r\n return {\r\n selectIds,\r\n selectEntities,\r\n selectAll,\r\n selectTotal,\r\n selectById: createDraftSafeSelector(\r\n selectEntities,\r\n selectId,\r\n selectById\r\n ),\r\n }\r\n }\r\n\r\n const selectGlobalizedEntities = createDraftSafeSelector(\r\n selectState as Selector>,\r\n selectEntities\r\n )\r\n\r\n return {\r\n selectIds: createDraftSafeSelector(selectState, selectIds),\r\n selectEntities: selectGlobalizedEntities,\r\n selectAll: createDraftSafeSelector(selectState, selectAll),\r\n selectTotal: createDraftSafeSelector(selectState, selectTotal),\r\n selectById: createDraftSafeSelector(\r\n selectGlobalizedEntities,\r\n selectId,\r\n selectById\r\n ),\r\n }\r\n }\r\n\r\n return { getSelectors }\r\n}\r\n", "import createNextState, { isDraft } from 'immer'\r\nimport type { EntityState, PreventAny } from './models'\r\nimport type { PayloadAction } from '../createAction'\r\nimport { isFSA } from '../createAction'\r\nimport { IsAny } from '../tsHelpers'\r\n\r\nexport function createSingleArgumentStateOperator(\r\n mutator: (state: EntityState) => void\r\n) {\r\n const operator = createStateOperator((_: undefined, state: EntityState) =>\r\n mutator(state)\r\n )\r\n\r\n return function operation>(\r\n state: PreventAny\r\n ): S {\r\n return operator(state as S, undefined)\r\n }\r\n}\r\n\r\nexport function createStateOperator(\r\n mutator: (arg: R, state: EntityState) => void\r\n) {\r\n return function operation>(\r\n state: S,\r\n arg: R | PayloadAction\r\n ): S {\r\n function isPayloadActionArgument(\r\n arg: R | PayloadAction\r\n ): arg is PayloadAction {\r\n return isFSA(arg)\r\n }\r\n\r\n const runMutator = (draft: EntityState) => {\r\n if (isPayloadActionArgument(arg)) {\r\n mutator(arg.payload, draft)\r\n } else {\r\n mutator(arg, draft)\r\n }\r\n }\r\n\r\n if (isDraft(state)) {\r\n // we must already be inside a `createNextState` call, likely because\r\n // this is being wrapped in `createReducer` or `createSlice`.\r\n // It's safe to just pass the draft to the mutator.\r\n runMutator(state)\r\n\r\n // since it's a draft, we'll just return it\r\n return state\r\n } else {\r\n // @ts-ignore createNextState() produces an Immutable> rather\r\n // than an Immutable, and TypeScript cannot find out how to reconcile\r\n // these two types.\r\n return createNextState(state, runMutator)\r\n }\r\n }\r\n}\r\n", "import type { EntityState, IdSelector, Update, EntityId } from './models'\r\n\r\nexport function selectIdValue(entity: T, selectId: IdSelector) {\r\n const key = selectId(entity)\r\n\r\n if (process.env.NODE_ENV !== 'production' && key === undefined) {\r\n console.warn(\r\n 'The entity passed to the `selectId` implementation returned undefined.',\r\n 'You should probably provide your own `selectId` implementation.',\r\n 'The entity that was passed:',\r\n entity,\r\n 'The `selectId` implementation:',\r\n selectId.toString()\r\n )\r\n }\r\n\r\n return key\r\n}\r\n\r\nexport function ensureEntitiesArray(\r\n entities: readonly T[] | Record\r\n): readonly T[] {\r\n if (!Array.isArray(entities)) {\r\n entities = Object.values(entities)\r\n }\r\n\r\n return entities\r\n}\r\n\r\nexport function splitAddedUpdatedEntities(\r\n newEntities: readonly T[] | Record,\r\n selectId: IdSelector,\r\n state: EntityState\r\n): [T[], Update[]] {\r\n newEntities = ensureEntitiesArray(newEntities)\r\n\r\n const added: T[] = []\r\n const updated: Update[] = []\r\n\r\n for (const entity of newEntities) {\r\n const id = selectIdValue(entity, selectId)\r\n if (id in state.entities) {\r\n updated.push({ id, changes: entity })\r\n } else {\r\n added.push(entity)\r\n }\r\n }\r\n return [added, updated]\r\n}\r\n", "import type {\r\n EntityState,\r\n EntityStateAdapter,\r\n IdSelector,\r\n Update,\r\n EntityId,\r\n} from './models'\r\nimport {\r\n createStateOperator,\r\n createSingleArgumentStateOperator,\r\n} from './state_adapter'\r\nimport {\r\n selectIdValue,\r\n ensureEntitiesArray,\r\n splitAddedUpdatedEntities,\r\n} from './utils'\r\n\r\nexport function createUnsortedStateAdapter(\r\n selectId: IdSelector\r\n): EntityStateAdapter {\r\n type R = EntityState\r\n\r\n function addOneMutably(entity: T, state: R): void {\r\n const key = selectIdValue(entity, selectId)\r\n\r\n if (key in state.entities) {\r\n return\r\n }\r\n\r\n state.ids.push(key)\r\n state.entities[key] = entity\r\n }\r\n\r\n function addManyMutably(\r\n newEntities: readonly T[] | Record,\r\n state: R\r\n ): void {\r\n newEntities = ensureEntitiesArray(newEntities)\r\n\r\n for (const entity of newEntities) {\r\n addOneMutably(entity, state)\r\n }\r\n }\r\n\r\n function setOneMutably(entity: T, state: R): void {\r\n const key = selectIdValue(entity, selectId)\r\n if (!(key in state.entities)) {\r\n state.ids.push(key)\r\n }\r\n state.entities[key] = entity\r\n }\r\n\r\n function setManyMutably(\r\n newEntities: readonly T[] | Record,\r\n state: R\r\n ): void {\r\n newEntities = ensureEntitiesArray(newEntities)\r\n for (const entity of newEntities) {\r\n setOneMutably(entity, state)\r\n }\r\n }\r\n\r\n function setAllMutably(\r\n newEntities: readonly T[] | Record,\r\n state: R\r\n ): void {\r\n newEntities = ensureEntitiesArray(newEntities)\r\n\r\n state.ids = []\r\n state.entities = {}\r\n\r\n addManyMutably(newEntities, state)\r\n }\r\n\r\n function removeOneMutably(key: EntityId, state: R): void {\r\n return removeManyMutably([key], state)\r\n }\r\n\r\n function removeManyMutably(keys: readonly EntityId[], state: R): void {\r\n let didMutate = false\r\n\r\n keys.forEach((key) => {\r\n if (key in state.entities) {\r\n delete state.entities[key]\r\n didMutate = true\r\n }\r\n })\r\n\r\n if (didMutate) {\r\n state.ids = state.ids.filter((id) => id in state.entities)\r\n }\r\n }\r\n\r\n function removeAllMutably(state: R): void {\r\n Object.assign(state, {\r\n ids: [],\r\n entities: {},\r\n })\r\n }\r\n\r\n function takeNewKey(\r\n keys: { [id: string]: EntityId },\r\n update: Update,\r\n state: R\r\n ): boolean {\r\n const original = state.entities[update.id]\r\n const updated: T = Object.assign({}, original, update.changes)\r\n const newKey = selectIdValue(updated, selectId)\r\n const hasNewKey = newKey !== update.id\r\n\r\n if (hasNewKey) {\r\n keys[update.id] = newKey\r\n delete state.entities[update.id]\r\n }\r\n\r\n state.entities[newKey] = updated\r\n\r\n return hasNewKey\r\n }\r\n\r\n function updateOneMutably(update: Update, state: R): void {\r\n return updateManyMutably([update], state)\r\n }\r\n\r\n function updateManyMutably(\r\n updates: ReadonlyArray>,\r\n state: R\r\n ): void {\r\n const newKeys: { [id: string]: EntityId } = {}\r\n\r\n const updatesPerEntity: { [id: string]: Update } = {}\r\n\r\n updates.forEach((update) => {\r\n // Only apply updates to entities that currently exist\r\n if (update.id in state.entities) {\r\n // If there are multiple updates to one entity, merge them together\r\n updatesPerEntity[update.id] = {\r\n id: update.id,\r\n // Spreads ignore falsy values, so this works even if there isn't\r\n // an existing update already at this key\r\n changes: {\r\n ...(updatesPerEntity[update.id]\r\n ? updatesPerEntity[update.id].changes\r\n : null),\r\n ...update.changes,\r\n },\r\n }\r\n }\r\n })\r\n\r\n updates = Object.values(updatesPerEntity)\r\n\r\n const didMutateEntities = updates.length > 0\r\n\r\n if (didMutateEntities) {\r\n const didMutateIds =\r\n updates.filter((update) => takeNewKey(newKeys, update, state)).length >\r\n 0\r\n\r\n if (didMutateIds) {\r\n state.ids = state.ids.map((id) => newKeys[id] || id)\r\n }\r\n }\r\n }\r\n\r\n function upsertOneMutably(entity: T, state: R): void {\r\n return upsertManyMutably([entity], state)\r\n }\r\n\r\n function upsertManyMutably(\r\n newEntities: readonly T[] | Record,\r\n state: R\r\n ): void {\r\n const [added, updated] = splitAddedUpdatedEntities(\r\n newEntities,\r\n selectId,\r\n state\r\n )\r\n\r\n updateManyMutably(updated, state)\r\n addManyMutably(added, state)\r\n }\r\n\r\n return {\r\n removeAll: createSingleArgumentStateOperator(removeAllMutably),\r\n addOne: createStateOperator(addOneMutably),\r\n addMany: createStateOperator(addManyMutably),\r\n setOne: createStateOperator(setOneMutably),\r\n setMany: createStateOperator(setManyMutably),\r\n setAll: createStateOperator(setAllMutably),\r\n updateOne: createStateOperator(updateOneMutably),\r\n updateMany: createStateOperator(updateManyMutably),\r\n upsertOne: createStateOperator(upsertOneMutably),\r\n upsertMany: createStateOperator(upsertManyMutably),\r\n removeOne: createStateOperator(removeOneMutably),\r\n removeMany: createStateOperator(removeManyMutably),\r\n }\r\n}\r\n", "import type {\r\n EntityState,\r\n IdSelector,\r\n Comparer,\r\n EntityStateAdapter,\r\n Update,\r\n EntityId,\r\n} from './models'\r\nimport { createStateOperator } from './state_adapter'\r\nimport { createUnsortedStateAdapter } from './unsorted_state_adapter'\r\nimport {\r\n selectIdValue,\r\n ensureEntitiesArray,\r\n splitAddedUpdatedEntities,\r\n} from './utils'\r\n\r\nexport function createSortedStateAdapter(\r\n selectId: IdSelector,\r\n sort: Comparer\r\n): EntityStateAdapter {\r\n type R = EntityState\r\n\r\n const { removeOne, removeMany, removeAll } =\r\n createUnsortedStateAdapter(selectId)\r\n\r\n function addOneMutably(entity: T, state: R): void {\r\n return addManyMutably([entity], state)\r\n }\r\n\r\n function addManyMutably(\r\n newEntities: readonly T[] | Record,\r\n state: R\r\n ): void {\r\n newEntities = ensureEntitiesArray(newEntities)\r\n\r\n const models = newEntities.filter(\r\n (model) => !(selectIdValue(model, selectId) in state.entities)\r\n )\r\n\r\n if (models.length !== 0) {\r\n merge(models, state)\r\n }\r\n }\r\n\r\n function setOneMutably(entity: T, state: R): void {\r\n return setManyMutably([entity], state)\r\n }\r\n\r\n function setManyMutably(\r\n newEntities: readonly T[] | Record,\r\n state: R\r\n ): void {\r\n newEntities = ensureEntitiesArray(newEntities)\r\n if (newEntities.length !== 0) {\r\n merge(newEntities, state)\r\n }\r\n }\r\n\r\n function setAllMutably(\r\n newEntities: readonly T[] | Record,\r\n state: R\r\n ): void {\r\n newEntities = ensureEntitiesArray(newEntities)\r\n state.entities = {}\r\n state.ids = []\r\n\r\n addManyMutably(newEntities, state)\r\n }\r\n\r\n function updateOneMutably(update: Update, state: R): void {\r\n return updateManyMutably([update], state)\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types\r\n function takeUpdatedModel(models: T[], update: Update, state: R): boolean {\r\n if (!(update.id in state.entities)) {\r\n return false\r\n }\r\n\r\n const original = state.entities[update.id]\r\n const updated = Object.assign({}, original, update.changes)\r\n const newKey = selectIdValue(updated, selectId)\r\n\r\n delete state.entities[update.id]\r\n\r\n models.push(updated)\r\n\r\n return newKey !== update.id\r\n }\r\n\r\n function updateManyMutably(\r\n updates: ReadonlyArray>,\r\n state: R\r\n ): void {\r\n const models: T[] = []\r\n\r\n updates.forEach((update) => takeUpdatedModel(models, update, state))\r\n\r\n if (models.length !== 0) {\r\n merge(models, state)\r\n }\r\n }\r\n\r\n function upsertOneMutably(entity: T, state: R): void {\r\n return upsertManyMutably([entity], state)\r\n }\r\n\r\n function upsertManyMutably(\r\n newEntities: readonly T[] | Record,\r\n state: R\r\n ): void {\r\n const [added, updated] = splitAddedUpdatedEntities(\r\n newEntities,\r\n selectId,\r\n state\r\n )\r\n\r\n updateManyMutably(updated, state)\r\n addManyMutably(added, state)\r\n }\r\n\r\n function areArraysEqual(a: readonly unknown[], b: readonly unknown[]) {\r\n if (a.length !== b.length) {\r\n return false\r\n }\r\n\r\n for (let i = 0; i < a.length && i < b.length; i++) {\r\n if (a[i] === b[i]) {\r\n continue\r\n }\r\n return false\r\n }\r\n return true\r\n }\r\n\r\n function merge(models: readonly T[], state: R): void {\r\n // Insert/overwrite all new/updated\r\n models.forEach((model) => {\r\n state.entities[selectId(model)] = model\r\n })\r\n\r\n const allEntities = Object.values(state.entities) as T[]\r\n allEntities.sort(sort)\r\n\r\n const newSortedIds = allEntities.map(selectId)\r\n const { ids } = state\r\n\r\n if (!areArraysEqual(ids, newSortedIds)) {\r\n state.ids = newSortedIds\r\n }\r\n }\r\n\r\n return {\r\n removeOne,\r\n removeMany,\r\n removeAll,\r\n addOne: createStateOperator(addOneMutably),\r\n updateOne: createStateOperator(updateOneMutably),\r\n upsertOne: createStateOperator(upsertOneMutably),\r\n setOne: createStateOperator(setOneMutably),\r\n setMany: createStateOperator(setManyMutably),\r\n setAll: createStateOperator(setAllMutably),\r\n addMany: createStateOperator(addManyMutably),\r\n updateMany: createStateOperator(updateManyMutably),\r\n upsertMany: createStateOperator(upsertManyMutably),\r\n }\r\n}\r\n", "import type {\r\n EntityDefinition,\r\n Comparer,\r\n IdSelector,\r\n EntityAdapter,\r\n} from './models'\r\nimport { createInitialStateFactory } from './entity_state'\r\nimport { createSelectorsFactory } from './state_selectors'\r\nimport { createSortedStateAdapter } from './sorted_state_adapter'\r\nimport { createUnsortedStateAdapter } from './unsorted_state_adapter'\r\n\r\n/**\r\n *\r\n * @param options\r\n *\r\n * @public\r\n */\r\nexport function createEntityAdapter(\r\n options: {\r\n selectId?: IdSelector\r\n sortComparer?: false | Comparer\r\n } = {}\r\n): EntityAdapter {\r\n const { selectId, sortComparer }: EntityDefinition = {\r\n sortComparer: false,\r\n selectId: (instance: any) => instance.id,\r\n ...options,\r\n }\r\n\r\n const stateFactory = createInitialStateFactory()\r\n const selectorsFactory = createSelectorsFactory()\r\n const stateAdapter = sortComparer\r\n ? createSortedStateAdapter(selectId, sortComparer)\r\n : createUnsortedStateAdapter(selectId)\r\n\r\n return {\r\n selectId,\r\n sortComparer,\r\n ...stateFactory,\r\n ...selectorsFactory,\r\n ...stateAdapter,\r\n }\r\n}\r\n", "// Borrowed from https://github.com/ai/nanoid/blob/3.0.2/non-secure/index.js\r\n// This alphabet uses `A-Za-z0-9_-` symbols. A genetic algorithm helped\r\n// optimize the gzip compression for this alphabet.\r\nlet urlAlphabet =\r\n 'ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW'\r\n\r\n/**\r\n *\r\n * @public\r\n */\r\nexport let nanoid = (size = 21) => {\r\n let id = ''\r\n // A compact alternative for `for (var i = 0; i < step; i++)`.\r\n let i = size\r\n while (i--) {\r\n // `| 0` is more compact and faster than `Math.floor()`.\r\n id += urlAlphabet[(Math.random() * 64) | 0]\r\n }\r\n return id\r\n}\r\n", "import type { Dispatch, AnyAction } from 'redux'\r\nimport type {\r\n PayloadAction,\r\n ActionCreatorWithPreparedPayload,\r\n} from './createAction'\r\nimport { createAction } from './createAction'\r\nimport type { ThunkDispatch } from 'redux-thunk'\r\nimport type { FallbackIfUnknown, IsAny, IsUnknown } from './tsHelpers'\r\nimport { nanoid } from './nanoid'\r\n\r\n// @ts-ignore we need the import of these types due to a bundling issue.\r\ntype _Keep = PayloadAction | ActionCreatorWithPreparedPayload\r\n\r\nexport type BaseThunkAPI<\r\n S,\r\n E,\r\n D extends Dispatch = Dispatch,\r\n RejectedValue = undefined,\r\n RejectedMeta = unknown,\r\n FulfilledMeta = unknown\r\n> = {\r\n dispatch: D\r\n getState: () => S\r\n extra: E\r\n requestId: string\r\n signal: AbortSignal\r\n rejectWithValue: IsUnknown<\r\n RejectedMeta,\r\n (value: RejectedValue) => RejectWithValue,\r\n (\r\n value: RejectedValue,\r\n meta: RejectedMeta\r\n ) => RejectWithValue\r\n >\r\n fulfillWithValue: IsUnknown<\r\n FulfilledMeta,\r\n (\r\n value: FulfilledValue\r\n ) => FulfillWithMeta,\r\n (\r\n value: FulfilledValue,\r\n meta: FulfilledMeta\r\n ) => FulfillWithMeta\r\n >\r\n}\r\n\r\n/**\r\n * @public\r\n */\r\nexport interface SerializedError {\r\n name?: string\r\n message?: string\r\n stack?: string\r\n code?: string\r\n}\r\n\r\nconst commonProperties: Array = [\r\n 'name',\r\n 'message',\r\n 'stack',\r\n 'code',\r\n]\r\n\r\nclass RejectWithValue {\r\n /*\r\n type-only property to distinguish between RejectWithValue and FulfillWithMeta\r\n does not exist at runtime\r\n */\r\n private readonly _type!: 'RejectWithValue'\r\n constructor(\r\n public readonly payload: Payload,\r\n public readonly meta: RejectedMeta\r\n ) {}\r\n}\r\n\r\nclass FulfillWithMeta {\r\n /*\r\n type-only property to distinguish between RejectWithValue and FulfillWithMeta\r\n does not exist at runtime\r\n */\r\n private readonly _type!: 'FulfillWithMeta'\r\n constructor(\r\n public readonly payload: Payload,\r\n public readonly meta: FulfilledMeta\r\n ) {}\r\n}\r\n\r\n/**\r\n * Serializes an error into a plain object.\r\n * Reworked from https://github.com/sindresorhus/serialize-error\r\n *\r\n * @public\r\n */\r\nexport const miniSerializeError = (value: any): SerializedError => {\r\n if (typeof value === 'object' && value !== null) {\r\n const simpleError: SerializedError = {}\r\n for (const property of commonProperties) {\r\n if (typeof value[property] === 'string') {\r\n simpleError[property] = value[property]\r\n }\r\n }\r\n\r\n return simpleError\r\n }\r\n\r\n return { message: String(value) }\r\n}\r\n\r\ntype AsyncThunkConfig = {\r\n state?: unknown\r\n dispatch?: Dispatch\r\n extra?: unknown\r\n rejectValue?: unknown\r\n serializedErrorType?: unknown\r\n pendingMeta?: unknown\r\n fulfilledMeta?: unknown\r\n rejectedMeta?: unknown\r\n}\r\n\r\ntype GetState = ThunkApiConfig extends {\r\n state: infer State\r\n}\r\n ? State\r\n : unknown\r\ntype GetExtra = ThunkApiConfig extends { extra: infer Extra }\r\n ? Extra\r\n : unknown\r\ntype GetDispatch = ThunkApiConfig extends {\r\n dispatch: infer Dispatch\r\n}\r\n ? FallbackIfUnknown<\r\n Dispatch,\r\n ThunkDispatch<\r\n GetState,\r\n GetExtra,\r\n AnyAction\r\n >\r\n >\r\n : ThunkDispatch, GetExtra, AnyAction>\r\n\r\ntype GetThunkAPI = BaseThunkAPI<\r\n GetState,\r\n GetExtra,\r\n GetDispatch,\r\n GetRejectValue,\r\n GetRejectedMeta,\r\n GetFulfilledMeta\r\n>\r\n\r\ntype GetRejectValue = ThunkApiConfig extends {\r\n rejectValue: infer RejectValue\r\n}\r\n ? RejectValue\r\n : unknown\r\n\r\ntype GetPendingMeta = ThunkApiConfig extends {\r\n pendingMeta: infer PendingMeta\r\n}\r\n ? PendingMeta\r\n : unknown\r\n\r\ntype GetFulfilledMeta = ThunkApiConfig extends {\r\n fulfilledMeta: infer FulfilledMeta\r\n}\r\n ? FulfilledMeta\r\n : unknown\r\n\r\ntype GetRejectedMeta = ThunkApiConfig extends {\r\n rejectedMeta: infer RejectedMeta\r\n}\r\n ? RejectedMeta\r\n : unknown\r\n\r\ntype GetSerializedErrorType = ThunkApiConfig extends {\r\n serializedErrorType: infer GetSerializedErrorType\r\n}\r\n ? GetSerializedErrorType\r\n : SerializedError\r\n\r\ntype MaybePromise = T | Promise | (T extends any ? Promise : never)\r\n\r\n/**\r\n * A type describing the return value of the `payloadCreator` argument to `createAsyncThunk`.\r\n * Might be useful for wrapping `createAsyncThunk` in custom abstractions.\r\n *\r\n * @public\r\n */\r\nexport type AsyncThunkPayloadCreatorReturnValue<\r\n Returned,\r\n ThunkApiConfig extends AsyncThunkConfig\r\n> = MaybePromise<\r\n | IsUnknown<\r\n GetFulfilledMeta,\r\n Returned,\r\n FulfillWithMeta>\r\n >\r\n | RejectWithValue<\r\n GetRejectValue,\r\n GetRejectedMeta\r\n >\r\n>\r\n/**\r\n * A type describing the `payloadCreator` argument to `createAsyncThunk`.\r\n * Might be useful for wrapping `createAsyncThunk` in custom abstractions.\r\n *\r\n * @public\r\n */\r\nexport type AsyncThunkPayloadCreator<\r\n Returned,\r\n ThunkArg = void,\r\n ThunkApiConfig extends AsyncThunkConfig = {}\r\n> = (\r\n arg: ThunkArg,\r\n thunkAPI: GetThunkAPI\r\n) => AsyncThunkPayloadCreatorReturnValue\r\n\r\n/**\r\n * A ThunkAction created by `createAsyncThunk`.\r\n * Dispatching it returns a Promise for either a\r\n * fulfilled or rejected action.\r\n * Also, the returned value contains an `abort()` method\r\n * that allows the asyncAction to be cancelled from the outside.\r\n *\r\n * @public\r\n */\r\nexport type AsyncThunkAction<\r\n Returned,\r\n ThunkArg,\r\n ThunkApiConfig extends AsyncThunkConfig\r\n> = (\r\n dispatch: GetDispatch,\r\n getState: () => GetState,\r\n extra: GetExtra\r\n) => Promise<\r\n | ReturnType>\r\n | ReturnType>\r\n> & {\r\n abort: (reason?: string) => void\r\n requestId: string\r\n arg: ThunkArg\r\n unwrap: () => Promise\r\n}\r\n\r\ntype AsyncThunkActionCreator<\r\n Returned,\r\n ThunkArg,\r\n ThunkApiConfig extends AsyncThunkConfig\r\n> = IsAny<\r\n ThunkArg,\r\n // any handling\r\n (arg: ThunkArg) => AsyncThunkAction,\r\n // unknown handling\r\n unknown extends ThunkArg\r\n ? (arg: ThunkArg) => AsyncThunkAction // argument not specified or specified as void or undefined\r\n : [ThunkArg] extends [void] | [undefined]\r\n ? () => AsyncThunkAction // argument contains void\r\n : [void] extends [ThunkArg] // make optional\r\n ? (arg?: ThunkArg) => AsyncThunkAction // argument contains undefined\r\n : [undefined] extends [ThunkArg]\r\n ? WithStrictNullChecks<\r\n // with strict nullChecks: make optional\r\n (\r\n arg?: ThunkArg\r\n ) => AsyncThunkAction,\r\n // without strict null checks this will match everything, so don't make it optional\r\n (arg: ThunkArg) => AsyncThunkAction\r\n > // default case: normal argument\r\n : (arg: ThunkArg) => AsyncThunkAction\r\n>\r\n\r\n/**\r\n * Options object for `createAsyncThunk`.\r\n *\r\n * @public\r\n */\r\nexport type AsyncThunkOptions<\r\n ThunkArg = void,\r\n ThunkApiConfig extends AsyncThunkConfig = {}\r\n> = {\r\n /**\r\n * A method to control whether the asyncThunk should be executed. Has access to the\r\n * `arg`, `api.getState()` and `api.extra` arguments.\r\n *\r\n * @returns `false` if it should be skipped\r\n */\r\n condition?(\r\n arg: ThunkArg,\r\n api: Pick, 'getState' | 'extra'>\r\n ): MaybePromise\r\n /**\r\n * If `condition` returns `false`, the asyncThunk will be skipped.\r\n * This option allows you to control whether a `rejected` action with `meta.condition == false`\r\n * will be dispatched or not.\r\n *\r\n * @default `false`\r\n */\r\n dispatchConditionRejection?: boolean\r\n\r\n serializeError?: (x: unknown) => GetSerializedErrorType\r\n\r\n /**\r\n * A function to use when generating the `requestId` for the request sequence.\r\n *\r\n * @default `nanoid`\r\n */\r\n idGenerator?: (arg: ThunkArg) => string\r\n} & IsUnknown<\r\n GetPendingMeta,\r\n {\r\n /**\r\n * A method to generate additional properties to be added to `meta` of the pending action.\r\n *\r\n * Using this optional overload will not modify the types correctly, this overload is only in place to support JavaScript users.\r\n * Please use the `ThunkApiConfig` parameter `pendingMeta` to get access to a correctly typed overload\r\n */\r\n getPendingMeta?(\r\n base: {\r\n arg: ThunkArg\r\n requestId: string\r\n },\r\n api: Pick, 'getState' | 'extra'>\r\n ): GetPendingMeta\r\n },\r\n {\r\n /**\r\n * A method to generate additional properties to be added to `meta` of the pending action.\r\n */\r\n getPendingMeta(\r\n base: {\r\n arg: ThunkArg\r\n requestId: string\r\n },\r\n api: Pick, 'getState' | 'extra'>\r\n ): GetPendingMeta\r\n }\r\n>\r\n\r\nexport type AsyncThunkPendingActionCreator<\r\n ThunkArg,\r\n ThunkApiConfig = {}\r\n> = ActionCreatorWithPreparedPayload<\r\n [string, ThunkArg, GetPendingMeta?],\r\n undefined,\r\n string,\r\n never,\r\n {\r\n arg: ThunkArg\r\n requestId: string\r\n requestStatus: 'pending'\r\n } & GetPendingMeta\r\n>\r\n\r\nexport type AsyncThunkRejectedActionCreator<\r\n ThunkArg,\r\n ThunkApiConfig = {}\r\n> = ActionCreatorWithPreparedPayload<\r\n [\r\n Error | null,\r\n string,\r\n ThunkArg,\r\n GetRejectValue?,\r\n GetRejectedMeta?\r\n ],\r\n GetRejectValue | undefined,\r\n string,\r\n GetSerializedErrorType,\r\n {\r\n arg: ThunkArg\r\n requestId: string\r\n requestStatus: 'rejected'\r\n aborted: boolean\r\n condition: boolean\r\n } & (\r\n | ({ rejectedWithValue: false } & {\r\n [K in keyof GetRejectedMeta]?: undefined\r\n })\r\n | ({ rejectedWithValue: true } & GetRejectedMeta)\r\n )\r\n>\r\n\r\nexport type AsyncThunkFulfilledActionCreator<\r\n Returned,\r\n ThunkArg,\r\n ThunkApiConfig = {}\r\n> = ActionCreatorWithPreparedPayload<\r\n [Returned, string, ThunkArg, GetFulfilledMeta?],\r\n Returned,\r\n string,\r\n never,\r\n {\r\n arg: ThunkArg\r\n requestId: string\r\n requestStatus: 'fulfilled'\r\n } & GetFulfilledMeta\r\n>\r\n\r\n/**\r\n * A type describing the return value of `createAsyncThunk`.\r\n * Might be useful for wrapping `createAsyncThunk` in custom abstractions.\r\n *\r\n * @public\r\n */\r\nexport type AsyncThunk<\r\n Returned,\r\n ThunkArg,\r\n ThunkApiConfig extends AsyncThunkConfig\r\n> = AsyncThunkActionCreator & {\r\n pending: AsyncThunkPendingActionCreator\r\n rejected: AsyncThunkRejectedActionCreator\r\n fulfilled: AsyncThunkFulfilledActionCreator<\r\n Returned,\r\n ThunkArg,\r\n ThunkApiConfig\r\n >\r\n typePrefix: string\r\n}\r\n\r\n/**\r\n *\r\n * @param typePrefix\r\n * @param payloadCreator\r\n * @param options\r\n *\r\n * @public\r\n */\r\n// separate signature without `AsyncThunkConfig` for better inference\r\nexport function createAsyncThunk(\r\n typePrefix: string,\r\n payloadCreator: AsyncThunkPayloadCreator,\r\n options?: AsyncThunkOptions\r\n): AsyncThunk\r\n\r\n/**\r\n *\r\n * @param typePrefix\r\n * @param payloadCreator\r\n * @param options\r\n *\r\n * @public\r\n */\r\nexport function createAsyncThunk<\r\n Returned,\r\n ThunkArg,\r\n ThunkApiConfig extends AsyncThunkConfig\r\n>(\r\n typePrefix: string,\r\n payloadCreator: AsyncThunkPayloadCreator,\r\n options?: AsyncThunkOptions\r\n): AsyncThunk\r\n\r\nexport function createAsyncThunk<\r\n Returned,\r\n ThunkArg,\r\n ThunkApiConfig extends AsyncThunkConfig\r\n>(\r\n typePrefix: string,\r\n payloadCreator: AsyncThunkPayloadCreator,\r\n options?: AsyncThunkOptions\r\n): AsyncThunk {\r\n type RejectedValue = GetRejectValue\r\n type PendingMeta = GetPendingMeta\r\n type FulfilledMeta = GetFulfilledMeta\r\n type RejectedMeta = GetRejectedMeta\r\n\r\n const fulfilled: AsyncThunkFulfilledActionCreator<\r\n Returned,\r\n ThunkArg,\r\n ThunkApiConfig\r\n > = createAction(\r\n typePrefix + '/fulfilled',\r\n (\r\n payload: Returned,\r\n requestId: string,\r\n arg: ThunkArg,\r\n meta?: FulfilledMeta\r\n ) => ({\r\n payload,\r\n meta: {\r\n ...((meta as any) || {}),\r\n arg,\r\n requestId,\r\n requestStatus: 'fulfilled' as const,\r\n },\r\n })\r\n )\r\n\r\n const pending: AsyncThunkPendingActionCreator =\r\n createAction(\r\n typePrefix + '/pending',\r\n (requestId: string, arg: ThunkArg, meta?: PendingMeta) => ({\r\n payload: undefined,\r\n meta: {\r\n ...((meta as any) || {}),\r\n arg,\r\n requestId,\r\n requestStatus: 'pending' as const,\r\n },\r\n })\r\n )\r\n\r\n const rejected: AsyncThunkRejectedActionCreator =\r\n createAction(\r\n typePrefix + '/rejected',\r\n (\r\n error: Error | null,\r\n requestId: string,\r\n arg: ThunkArg,\r\n payload?: RejectedValue,\r\n meta?: RejectedMeta\r\n ) => ({\r\n payload,\r\n error: ((options && options.serializeError) || miniSerializeError)(\r\n error || 'Rejected'\r\n ) as GetSerializedErrorType,\r\n meta: {\r\n ...((meta as any) || {}),\r\n arg,\r\n requestId,\r\n rejectedWithValue: !!payload,\r\n requestStatus: 'rejected' as const,\r\n aborted: error?.name === 'AbortError',\r\n condition: error?.name === 'ConditionError',\r\n },\r\n })\r\n )\r\n\r\n let displayedWarning = false\r\n\r\n const AC =\r\n typeof AbortController !== 'undefined'\r\n ? AbortController\r\n : class implements AbortController {\r\n signal: AbortSignal = {\r\n aborted: false,\r\n addEventListener() {},\r\n dispatchEvent() {\r\n return false\r\n },\r\n onabort() {},\r\n removeEventListener() {},\r\n }\r\n abort() {\r\n if (process.env.NODE_ENV !== 'production') {\r\n if (!displayedWarning) {\r\n displayedWarning = true\r\n console.info(\r\n `This platform does not implement AbortController. \r\nIf you want to use the AbortController to react to \\`abort\\` events, please consider importing a polyfill like 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'.`\r\n )\r\n }\r\n }\r\n }\r\n }\r\n\r\n function actionCreator(\r\n arg: ThunkArg\r\n ): AsyncThunkAction {\r\n return (dispatch, getState, extra) => {\r\n const requestId = options?.idGenerator\r\n ? options.idGenerator(arg)\r\n : nanoid()\r\n\r\n const abortController = new AC()\r\n let abortReason: string | undefined\r\n\r\n const abortedPromise = new Promise((_, reject) =>\r\n abortController.signal.addEventListener('abort', () =>\r\n reject({ name: 'AbortError', message: abortReason || 'Aborted' })\r\n )\r\n )\r\n\r\n let started = false\r\n function abort(reason?: string) {\r\n if (started) {\r\n abortReason = reason\r\n abortController.abort()\r\n }\r\n }\r\n\r\n const promise = (async function () {\r\n let finalAction: ReturnType\r\n try {\r\n let conditionResult = options?.condition?.(arg, { getState, extra })\r\n if (isThenable(conditionResult)) {\r\n conditionResult = await conditionResult\r\n }\r\n if (conditionResult === false) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw {\r\n name: 'ConditionError',\r\n message: 'Aborted due to condition callback returning false.',\r\n }\r\n }\r\n started = true\r\n dispatch(\r\n pending(\r\n requestId,\r\n arg,\r\n options?.getPendingMeta?.({ requestId, arg }, { getState, extra })\r\n )\r\n )\r\n finalAction = await Promise.race([\r\n abortedPromise,\r\n Promise.resolve(\r\n payloadCreator(arg, {\r\n dispatch,\r\n getState,\r\n extra,\r\n requestId,\r\n signal: abortController.signal,\r\n rejectWithValue: ((\r\n value: RejectedValue,\r\n meta?: RejectedMeta\r\n ) => {\r\n return new RejectWithValue(value, meta)\r\n }) as any,\r\n fulfillWithValue: ((value: unknown, meta?: FulfilledMeta) => {\r\n return new FulfillWithMeta(value, meta)\r\n }) as any,\r\n })\r\n ).then((result) => {\r\n if (result instanceof RejectWithValue) {\r\n throw result\r\n }\r\n if (result instanceof FulfillWithMeta) {\r\n return fulfilled(result.payload, requestId, arg, result.meta)\r\n }\r\n return fulfilled(result as any, requestId, arg)\r\n }),\r\n ])\r\n } catch (err) {\r\n finalAction =\r\n err instanceof RejectWithValue\r\n ? rejected(null, requestId, arg, err.payload, err.meta)\r\n : rejected(err as any, requestId, arg)\r\n }\r\n // We dispatch the result action _after_ the catch, to avoid having any errors\r\n // here get swallowed by the try/catch block,\r\n // per https://twitter.com/dan_abramov/status/770914221638942720\r\n // and https://github.com/reduxjs/redux-toolkit/blob/e85eb17b39a2118d859f7b7746e0f3fee523e089/docs/tutorials/advanced-tutorial.md#async-error-handling-logic-in-thunks\r\n\r\n const skipDispatch =\r\n options &&\r\n !options.dispatchConditionRejection &&\r\n rejected.match(finalAction) &&\r\n (finalAction as any).meta.condition\r\n\r\n if (!skipDispatch) {\r\n dispatch(finalAction)\r\n }\r\n return finalAction\r\n })()\r\n return Object.assign(promise as Promise, {\r\n abort,\r\n requestId,\r\n arg,\r\n unwrap() {\r\n return promise.then(unwrapResult)\r\n },\r\n })\r\n }\r\n }\r\n\r\n return Object.assign(\r\n actionCreator as AsyncThunkActionCreator<\r\n Returned,\r\n ThunkArg,\r\n ThunkApiConfig\r\n >,\r\n {\r\n pending,\r\n rejected,\r\n fulfilled,\r\n typePrefix,\r\n }\r\n )\r\n}\r\n\r\ninterface UnwrappableAction {\r\n payload: any\r\n meta?: any\r\n error?: any\r\n}\r\n\r\ntype UnwrappedActionPayload = Exclude<\r\n T,\r\n { error: any }\r\n>['payload']\r\n\r\n/**\r\n * @public\r\n */\r\nexport function unwrapResult(\r\n action: R\r\n): UnwrappedActionPayload {\r\n if (action.meta && action.meta.rejectedWithValue) {\r\n throw action.payload\r\n }\r\n if (action.error) {\r\n throw action.error\r\n }\r\n return action.payload\r\n}\r\n\r\ntype WithStrictNullChecks = undefined extends boolean\r\n ? False\r\n : True\r\n\r\nfunction isThenable(value: any): value is PromiseLike {\r\n return (\r\n value !== null &&\r\n typeof value === 'object' &&\r\n typeof value.then === 'function'\r\n )\r\n}\r\n", "import type { Middleware } from 'redux'\r\n\r\n/**\r\n * return True if T is `any`, otherwise return False\r\n * taken from https://github.com/joonhocho/tsdef\r\n *\r\n * @internal\r\n */\r\nexport type IsAny =\r\n // test if we are going the left AND right path in the condition\r\n true | false extends (T extends never ? true : false) ? True : False\r\n\r\n/**\r\n * return True if T is `unknown`, otherwise return False\r\n * taken from https://github.com/joonhocho/tsdef\r\n *\r\n * @internal\r\n */\r\nexport type IsUnknown = unknown extends T\r\n ? IsAny\r\n : False\r\n\r\nexport type FallbackIfUnknown = IsUnknown\r\n\r\n/**\r\n * @internal\r\n */\r\nexport type IfMaybeUndefined = [undefined] extends [P]\r\n ? True\r\n : False\r\n\r\n/**\r\n * @internal\r\n */\r\nexport type IfVoid = [void] extends [P] ? True : False\r\n\r\n/**\r\n * @internal\r\n */\r\nexport type IsEmptyObj = T extends any\r\n ? keyof T extends never\r\n ? IsUnknown>>\r\n : False\r\n : never\r\n\r\n/**\r\n * returns True if TS version is above 3.5, False if below.\r\n * uses feature detection to detect TS version >= 3.5\r\n * * versions below 3.5 will return `{}` for unresolvable interference\r\n * * versions above will return `unknown`\r\n *\r\n * @internal\r\n */\r\nexport type AtLeastTS35 = [True, False][IsUnknown<\r\n ReturnType<() => T>,\r\n 0,\r\n 1\r\n>]\r\n\r\n/**\r\n * @internal\r\n */\r\nexport type IsUnknownOrNonInferrable = AtLeastTS35<\r\n IsUnknown,\r\n IsEmptyObj>\r\n>\r\n\r\n/**\r\n * Combines all dispatch signatures of all middlewares in the array `M` into\r\n * one intersected dispatch signature.\r\n */\r\nexport type DispatchForMiddlewares = M extends ReadonlyArray\r\n ? UnionToIntersection<\r\n M[number] extends infer MiddlewareValues\r\n ? MiddlewareValues extends Middleware\r\n ? DispatchExt extends Function\r\n ? IsAny\r\n : never\r\n : never\r\n : never\r\n >\r\n : never\r\n\r\n/**\r\n * Convert a Union type `(A|B)` to an intersection type `(A&B)`\r\n */\r\nexport type UnionToIntersection = (\r\n U extends any ? (k: U) => void : never\r\n) extends (k: infer I) => void\r\n ? I\r\n : never\r\n\r\n/**\r\n * Helper type. Passes T out again, but boxes it in a way that it cannot\r\n * \"widen\" the type by accident if it is a generic that should be inferred\r\n * from elsewhere.\r\n *\r\n * @internal\r\n */\r\nexport type NoInfer = [T][T extends any ? 0 : never]\r\n\r\nexport type Omit = Pick>\r\n\r\nexport interface HasMatchFunction {\r\n match: (v: any) => v is T\r\n}\r\n\r\nexport const hasMatchFunction = (\r\n v: Matcher\r\n): v is HasMatchFunction => {\r\n return v && typeof (v as HasMatchFunction).match === 'function'\r\n}\r\n\r\n/** @public */\r\nexport type Matcher = HasMatchFunction | ((v: any) => v is T)\r\n\r\n/** @public */\r\nexport type ActionFromMatcher> = M extends Matcher<\r\n infer T\r\n>\r\n ? T\r\n : never\r\n", "import type {\r\n ActionFromMatcher,\r\n Matcher,\r\n UnionToIntersection,\r\n} from './tsHelpers'\r\nimport { hasMatchFunction } from './tsHelpers'\r\nimport type {\r\n AsyncThunk,\r\n AsyncThunkFulfilledActionCreator,\r\n AsyncThunkPendingActionCreator,\r\n AsyncThunkRejectedActionCreator,\r\n} from './createAsyncThunk'\r\n\r\n/** @public */\r\nexport type ActionMatchingAnyOf<\r\n Matchers extends [Matcher, ...Matcher[]]\r\n> = ActionFromMatcher\r\n\r\n/** @public */\r\nexport type ActionMatchingAllOf<\r\n Matchers extends [Matcher, ...Matcher[]]\r\n> = UnionToIntersection>\r\n\r\nconst matches = (matcher: Matcher, action: any) => {\r\n if (hasMatchFunction(matcher)) {\r\n return matcher.match(action)\r\n } else {\r\n return matcher(action)\r\n }\r\n}\r\n\r\n/**\r\n * A higher-order function that returns a function that may be used to check\r\n * whether an action matches any one of the supplied type guards or action\r\n * creators.\r\n *\r\n * @param matchers The type guards or action creators to match against.\r\n *\r\n * @public\r\n */\r\nexport function isAnyOf, ...Matcher[]]>(\r\n ...matchers: Matchers\r\n) {\r\n return (action: any): action is ActionMatchingAnyOf => {\r\n return matchers.some((matcher) => matches(matcher, action))\r\n }\r\n}\r\n\r\n/**\r\n * A higher-order function that returns a function that may be used to check\r\n * whether an action matches all of the supplied type guards or action\r\n * creators.\r\n *\r\n * @param matchers The type guards or action creators to match against.\r\n *\r\n * @public\r\n */\r\nexport function isAllOf, ...Matcher[]]>(\r\n ...matchers: Matchers\r\n) {\r\n return (action: any): action is ActionMatchingAllOf => {\r\n return matchers.every((matcher) => matches(matcher, action))\r\n }\r\n}\r\n\r\n/**\r\n * @param action A redux action\r\n * @param validStatus An array of valid meta.requestStatus values\r\n *\r\n * @internal\r\n */\r\nexport function hasExpectedRequestMetadata(\r\n action: any,\r\n validStatus: readonly string[]\r\n) {\r\n if (!action || !action.meta) return false\r\n\r\n const hasValidRequestId = typeof action.meta.requestId === 'string'\r\n const hasValidRequestStatus =\r\n validStatus.indexOf(action.meta.requestStatus) > -1\r\n\r\n return hasValidRequestId && hasValidRequestStatus\r\n}\r\n\r\nfunction isAsyncThunkArray(a: [any] | AnyAsyncThunk[]): a is AnyAsyncThunk[] {\r\n return (\r\n typeof a[0] === 'function' &&\r\n 'pending' in a[0] &&\r\n 'fulfilled' in a[0] &&\r\n 'rejected' in a[0]\r\n )\r\n}\r\n\r\nexport type UnknownAsyncThunkPendingAction = ReturnType<\r\n AsyncThunkPendingActionCreator\r\n>\r\n\r\nexport type PendingActionFromAsyncThunk =\r\n ActionFromMatcher\r\n\r\n/**\r\n * A higher-order function that returns a function that may be used to check\r\n * whether an action was created by an async thunk action creator, and that\r\n * the action is pending.\r\n *\r\n * @public\r\n */\r\nexport function isPending(): (\r\n action: any\r\n) => action is UnknownAsyncThunkPendingAction\r\n/**\r\n * A higher-order function that returns a function that may be used to check\r\n * whether an action belongs to one of the provided async thunk action creators,\r\n * and that the action is pending.\r\n *\r\n * @param asyncThunks (optional) The async thunk action creators to match against.\r\n *\r\n * @public\r\n */\r\nexport function isPending<\r\n AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]\r\n>(\r\n ...asyncThunks: AsyncThunks\r\n): (action: any) => action is PendingActionFromAsyncThunk\r\n/**\r\n * Tests if `action` is a pending thunk action\r\n * @public\r\n */\r\nexport function isPending(action: any): action is UnknownAsyncThunkPendingAction\r\nexport function isPending<\r\n AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]\r\n>(...asyncThunks: AsyncThunks | [any]) {\r\n if (asyncThunks.length === 0) {\r\n return (action: any) => hasExpectedRequestMetadata(action, ['pending'])\r\n }\r\n\r\n if (!isAsyncThunkArray(asyncThunks)) {\r\n return isPending()(asyncThunks[0])\r\n }\r\n\r\n return (\r\n action: any\r\n ): action is PendingActionFromAsyncThunk => {\r\n // note: this type will be correct because we have at least 1 asyncThunk\r\n const matchers: [Matcher, ...Matcher[]] = asyncThunks.map(\r\n (asyncThunk) => asyncThunk.pending\r\n ) as any\r\n\r\n const combinedMatcher = isAnyOf(...matchers)\r\n\r\n return combinedMatcher(action)\r\n }\r\n}\r\n\r\nexport type UnknownAsyncThunkRejectedAction = ReturnType<\r\n AsyncThunkRejectedActionCreator\r\n>\r\n\r\nexport type RejectedActionFromAsyncThunk =\r\n ActionFromMatcher\r\n\r\n/**\r\n * A higher-order function that returns a function that may be used to check\r\n * whether an action was created by an async thunk action creator, and that\r\n * the action is rejected.\r\n *\r\n * @public\r\n */\r\nexport function isRejected(): (\r\n action: any\r\n) => action is UnknownAsyncThunkRejectedAction\r\n/**\r\n * A higher-order function that returns a function that may be used to check\r\n * whether an action belongs to one of the provided async thunk action creators,\r\n * and that the action is rejected.\r\n *\r\n * @param asyncThunks (optional) The async thunk action creators to match against.\r\n *\r\n * @public\r\n */\r\nexport function isRejected<\r\n AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]\r\n>(\r\n ...asyncThunks: AsyncThunks\r\n): (action: any) => action is RejectedActionFromAsyncThunk\r\n/**\r\n * Tests if `action` is a rejected thunk action\r\n * @public\r\n */\r\nexport function isRejected(\r\n action: any\r\n): action is UnknownAsyncThunkRejectedAction\r\nexport function isRejected<\r\n AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]\r\n>(...asyncThunks: AsyncThunks | [any]) {\r\n if (asyncThunks.length === 0) {\r\n return (action: any) => hasExpectedRequestMetadata(action, ['rejected'])\r\n }\r\n\r\n if (!isAsyncThunkArray(asyncThunks)) {\r\n return isRejected()(asyncThunks[0])\r\n }\r\n\r\n return (\r\n action: any\r\n ): action is RejectedActionFromAsyncThunk => {\r\n // note: this type will be correct because we have at least 1 asyncThunk\r\n const matchers: [Matcher, ...Matcher[]] = asyncThunks.map(\r\n (asyncThunk) => asyncThunk.rejected\r\n ) as any\r\n\r\n const combinedMatcher = isAnyOf(...matchers)\r\n\r\n return combinedMatcher(action)\r\n }\r\n}\r\n\r\nexport type UnknownAsyncThunkRejectedWithValueAction = ReturnType<\r\n AsyncThunkRejectedActionCreator\r\n>\r\n\r\nexport type RejectedWithValueActionFromAsyncThunk =\r\n ActionFromMatcher &\r\n (T extends AsyncThunk\r\n ? { payload: RejectedValue }\r\n : unknown)\r\n\r\n/**\r\n * A higher-order function that returns a function that may be used to check\r\n * whether an action was created by an async thunk action creator, and that\r\n * the action is rejected with value.\r\n *\r\n * @public\r\n */\r\nexport function isRejectedWithValue(): (\r\n action: any\r\n) => action is UnknownAsyncThunkRejectedAction\r\n/**\r\n * A higher-order function that returns a function that may be used to check\r\n * whether an action belongs to one of the provided async thunk action creators,\r\n * and that the action is rejected with value.\r\n *\r\n * @param asyncThunks (optional) The async thunk action creators to match against.\r\n *\r\n * @public\r\n */\r\nexport function isRejectedWithValue<\r\n AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]\r\n>(\r\n ...asyncThunks: AsyncThunks\r\n): (\r\n action: any\r\n) => action is RejectedWithValueActionFromAsyncThunk\r\n/**\r\n * Tests if `action` is a rejected thunk action with value\r\n * @public\r\n */\r\nexport function isRejectedWithValue(\r\n action: any\r\n): action is UnknownAsyncThunkRejectedAction\r\nexport function isRejectedWithValue<\r\n AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]\r\n>(...asyncThunks: AsyncThunks | [any]) {\r\n const hasFlag = (action: any): action is any => {\r\n return action && action.meta && action.meta.rejectedWithValue\r\n }\r\n\r\n if (asyncThunks.length === 0) {\r\n return (action: any) => {\r\n const combinedMatcher = isAllOf(isRejected(...asyncThunks), hasFlag)\r\n\r\n return combinedMatcher(action)\r\n }\r\n }\r\n\r\n if (!isAsyncThunkArray(asyncThunks)) {\r\n return isRejectedWithValue()(asyncThunks[0])\r\n }\r\n\r\n return (\r\n action: any\r\n ): action is RejectedActionFromAsyncThunk => {\r\n const combinedMatcher = isAllOf(isRejected(...asyncThunks), hasFlag)\r\n\r\n return combinedMatcher(action)\r\n }\r\n}\r\n\r\nexport type UnknownAsyncThunkFulfilledAction = ReturnType<\r\n AsyncThunkFulfilledActionCreator\r\n>\r\n\r\nexport type FulfilledActionFromAsyncThunk =\r\n ActionFromMatcher\r\n\r\n/**\r\n * A higher-order function that returns a function that may be used to check\r\n * whether an action was created by an async thunk action creator, and that\r\n * the action is fulfilled.\r\n *\r\n * @public\r\n */\r\nexport function isFulfilled(): (\r\n action: any\r\n) => action is UnknownAsyncThunkFulfilledAction\r\n/**\r\n * A higher-order function that returns a function that may be used to check\r\n * whether an action belongs to one of the provided async thunk action creators,\r\n * and that the action is fulfilled.\r\n *\r\n * @param asyncThunks (optional) The async thunk action creators to match against.\r\n *\r\n * @public\r\n */\r\nexport function isFulfilled<\r\n AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]\r\n>(\r\n ...asyncThunks: AsyncThunks\r\n): (action: any) => action is FulfilledActionFromAsyncThunk\r\n/**\r\n * Tests if `action` is a fulfilled thunk action\r\n * @public\r\n */\r\nexport function isFulfilled(\r\n action: any\r\n): action is UnknownAsyncThunkFulfilledAction\r\nexport function isFulfilled<\r\n AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]\r\n>(...asyncThunks: AsyncThunks | [any]) {\r\n if (asyncThunks.length === 0) {\r\n return (action: any) => hasExpectedRequestMetadata(action, ['fulfilled'])\r\n }\r\n\r\n if (!isAsyncThunkArray(asyncThunks)) {\r\n return isFulfilled()(asyncThunks[0])\r\n }\r\n\r\n return (\r\n action: any\r\n ): action is FulfilledActionFromAsyncThunk => {\r\n // note: this type will be correct because we have at least 1 asyncThunk\r\n const matchers: [Matcher, ...Matcher[]] = asyncThunks.map(\r\n (asyncThunk) => asyncThunk.fulfilled\r\n ) as any\r\n\r\n const combinedMatcher = isAnyOf(...matchers)\r\n\r\n return combinedMatcher(action)\r\n }\r\n}\r\n\r\nexport type UnknownAsyncThunkAction =\r\n | UnknownAsyncThunkPendingAction\r\n | UnknownAsyncThunkRejectedAction\r\n | UnknownAsyncThunkFulfilledAction\r\n\r\nexport type AnyAsyncThunk = {\r\n pending: { match: (action: any) => action is any }\r\n fulfilled: { match: (action: any) => action is any }\r\n rejected: { match: (action: any) => action is any }\r\n}\r\n\r\nexport type ActionsFromAsyncThunk =\r\n | ActionFromMatcher\r\n | ActionFromMatcher\r\n | ActionFromMatcher\r\n\r\n/**\r\n * A higher-order function that returns a function that may be used to check\r\n * whether an action was created by an async thunk action creator.\r\n *\r\n * @public\r\n */\r\nexport function isAsyncThunkAction(): (\r\n action: any\r\n) => action is UnknownAsyncThunkAction\r\n/**\r\n * A higher-order function that returns a function that may be used to check\r\n * whether an action belongs to one of the provided async thunk action creators.\r\n *\r\n * @param asyncThunks (optional) The async thunk action creators to match against.\r\n *\r\n * @public\r\n */\r\nexport function isAsyncThunkAction<\r\n AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]\r\n>(\r\n ...asyncThunks: AsyncThunks\r\n): (action: any) => action is ActionsFromAsyncThunk\r\n/**\r\n * Tests if `action` is a thunk action\r\n * @public\r\n */\r\nexport function isAsyncThunkAction(\r\n action: any\r\n): action is UnknownAsyncThunkAction\r\nexport function isAsyncThunkAction<\r\n AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]\r\n>(...asyncThunks: AsyncThunks | [any]) {\r\n if (asyncThunks.length === 0) {\r\n return (action: any) =>\r\n hasExpectedRequestMetadata(action, ['pending', 'fulfilled', 'rejected'])\r\n }\r\n\r\n if (!isAsyncThunkArray(asyncThunks)) {\r\n return isAsyncThunkAction()(asyncThunks[0])\r\n }\r\n\r\n return (\r\n action: any\r\n ): action is ActionsFromAsyncThunk => {\r\n // note: this type will be correct because we have at least 1 asyncThunk\r\n const matchers: [Matcher, ...Matcher[]] = [] as any\r\n\r\n for (const asyncThunk of asyncThunks) {\r\n matchers.push(\r\n asyncThunk.pending,\r\n asyncThunk.rejected,\r\n asyncThunk.fulfilled\r\n )\r\n }\r\n\r\n const combinedMatcher = isAnyOf(...matchers)\r\n\r\n return combinedMatcher(action)\r\n }\r\n}\r\n", null, "import { createSlice } from '@reduxjs/toolkit';\n\nconst notesSlice = createSlice({\n name: 'notes',\n initialState: [\n ],\n reducers: {\n createNote (state, action) {\n const uuid = action.payload.note.uuid;\n const index = state.findIndex((el) => el.uuid === uuid);\n // It's a dupe uuid... probably should throw an error or something...\n if (index > -1) {\n return;\n }\n state.push(action.payload.note);\n },\n updateNote (state, action) {\n const uuid = action.payload.note.uuid;\n if (!uuid) {\n return;\n }\n const index = state.findIndex((el) => el.uuid === uuid);\n if (index !== -1) {\n state.splice(index, 1, action.payload.note);\n } else {\n state.push(action.payload.note);\n }\n },\n deleteNote (state, action) {\n const uuid = action.payload.uuid;\n if (!uuid) {\n return;\n }\n const index = state.findIndex((el) => el.uuid === uuid);\n if (index !== -1) {\n state.splice(index, 1);\n }\n },\n sortNotes (state, action) {\n // Array of UUIDs in new order.\n const sortUuids = action.payload.sortUuids;\n if (!Array.isArray(sortUuids) || sortUuids.length === 0) {\n return;\n }\n state.sort((a, b) => {\n const aIndex = sortUuids.indexOf(a.uuid);\n const bIndex = sortUuids.indexOf(b.uuid);\n return aIndex - bIndex;\n });\n },\n clearNotes () {\n return [];\n },\n importNotes (state, action) {\n const notes = action.payload.notes;\n\n notes.forEach((note) => {\n if (!note.uuid) {\n return;\n }\n const index = state.findIndex((el) => el.uuid === note.uuid);\n if (index !== -1) {\n state.splice(index, 1, note);\n } else {\n state.push(note);\n }\n });\n }\n }\n});\n\n// Extract the action creators object and the reducer\nconst { actions, reducer } = notesSlice;\n// Extract and export each action creator by name\nexport const { createNote, updateNote, deleteNote, sortNotes, clearNotes, importNotes } = actions;\n// Export the reducer, either as a default or named export\nexport default reducer;\n", "import { createSlice } from '@reduxjs/toolkit';\n\nconst npcsSlice = createSlice({\n name: 'npcs',\n initialState: [\n ],\n reducers: {\n createNPC (state, action) {\n const id = action.payload.npc.id;\n if (!id) {\n return;\n }\n const index = state.findIndex((el) => el.id === id);\n // It's a dupe uuid... probably should throw an error or something...\n if (index > -1) {\n return;\n }\n state.push(action.payload.npc);\n },\n updateNPC (state, action) {\n const id = action.payload.npc.id;\n if (!id) {\n return;\n }\n const index = state.findIndex((el) => el.id === id);\n if (index !== -1) {\n state.splice(index, 1, action.payload.npc);\n } else {\n state.push(action.payload.npc);\n }\n },\n deleteNPC (state, action) {\n const id = action.payload.id;\n if (!id) {\n return;\n }\n const index = state.findIndex((el) => el.id === id);\n if (index !== -1) {\n state.splice(index, 1);\n }\n },\n sortNPCs (state, action) {\n // Array of UUIDs in new order.\n const sortUuids = action.payload.sortUuids;\n if (!Array.isArray(sortUuids) || sortUuids.length === 0) {\n return;\n }\n state.sort((a, b) => {\n const aIndex = sortUuids.indexOf(a.id);\n const bIndex = sortUuids.indexOf(b.id);\n return aIndex - bIndex;\n });\n },\n clearNPCs (state) {\n return [];\n },\n importNPCs (state, action) {\n const npcs = action.payload.npcs;\n\n npcs.forEach((npc) => {\n if (!npc.id) {\n return;\n }\n const index = state.findIndex((el) => el.id === npc.id);\n if (index !== -1) {\n state.splice(index, 1, npc);\n } else {\n state.push(npc);\n }\n });\n }\n }\n});\n\n// Extract the action creators object and the reducer\nconst { actions, reducer } = npcsSlice;\n// Extract and export each action creator by name\nexport const { createNPC, updateNPC, deleteNPC, sortNPCs, clearNPCs, importNPCs } = actions;\n// Export the reducer, either as a default or named export\nexport default reducer;\n", "import { createSlice } from '@reduxjs/toolkit';\n\nconst townSlice = createSlice({\n name: 'town',\n initialState: [\n ],\n reducers: {\n updateTown (state, action) {\n state.splice(0, 1, action.payload.town);\n },\n clearTown () {\n return [];\n }\n }\n});\n\n// Extract the action creators object and the reducer\nconst { actions, reducer } = townSlice;\n// Extract and export each action creator by name\nexport const { updateTown, clearTown } = actions;\n// Export the reducer, either as a default or named export\nexport default reducer;\n", "import { configureStore } from '@reduxjs/toolkit';\nimport notesReducer from './notes-reducer.js';\nimport npcsReducer from './npcs-reducer.js';\nimport townReducer from './town-reducer.js';\nimport { save, load } from 'redux-localstorage-simple';\n\nconst store = configureStore({\n reducer: {\n notes: notesReducer,\n npcs: npcsReducer,\n town: townReducer\n },\n preloadedState: load(),\n middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(save())\n});\n\nexport default store;\n", "// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nvar getRandomValues;\nvar rnds8 = new Uint8Array(16);\nexport default function rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation. Also,\n // find the complete implementation of crypto (msCrypto) on IE11.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}", "export default /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;", "import REGEX from './regex.js';\n\nfunction validate(uuid) {\n return typeof uuid === 'string' && REGEX.test(uuid);\n}\n\nexport default validate;", "import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nvar byteToHex = [];\n\nfor (var i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).substr(1));\n}\n\nfunction stringify(arr) {\n var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;", "import rng from './rng.js';\nimport stringify from './stringify.js';\n\nfunction v4(options, buf, offset) {\n options = options || {};\n var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (var i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return stringify(rnds);\n}\n\nexport default v4;", "/**\n * Notes for the game.\n */\nimport { v4 as uuidv4 } from 'uuid';\nimport MarkdownIt from 'markdown-it';\n\nexport default class Note {\n constructor ({\n uuid = null,\n title = '',\n content = '',\n collapse = false\n }) {\n this.title = title;\n this.content = content;\n this.collapse = collapse;\n if (uuid) {\n this.uuid = uuid;\n } else {\n this.uuid = uuidv4();\n }\n }\n get id () {\n return this.uuid;\n }\n\n get contentHtml () {\n const md = new MarkdownIt();\n return md.render(this.content);\n }\n\n toJSON () {\n const obj = {};\n Object.keys(this).forEach((prop) => {\n const value = this[prop];\n if (value.length === 0) {\n return;\n }\n obj[prop] = value;\n });\n return obj;\n }\n}\n", "import store from '../store/store.js';\nimport { createNote, updateNote as updateNoteStore, deleteNote as deleteNoteStore, sortNotes as sortNotesStore, clearNotes, importNotes as importNotesStore } from '../store/notes-reducer.js';\nimport Note from '../models/note.js';\nimport EventEmitter from '../models/EventEmitter.js';\n\n/**\n * @prop {EventEmitter}\n */\nconst noteEmitter = new EventEmitter();\n\n/**\n * Get all notes.\n * @returns {Note[]}\n */\nconst getAllNotes = function () {\n const notes = store.getState().notes;\n return notes.map((obj) => new Note(obj));\n};\n/**\n * Get single note.\n * @param {String} id\n * @returns {Note|null}\n */\nconst getNoteById = function (id) {\n const notes = store.getState().notes;\n const data = notes.find((el) => el.uuid === id);\n if (data) {\n return new Note(data);\n }\n return null;\n};\n/**\n * Save a new note.\n * @param {Note} note\n * @param {String} mode view|edit\n * @returns {Note}\n */\nconst addNote = function (note, mode = 'view') {\n store.dispatch(createNote({ note: note.toJSON() }));\n noteEmitter.trigger('note:add', {\n note,\n mode\n });\n return note;\n};\n\n/**\n * Update a note.\n * @param {Note} note\n */\nconst updateNote = function (note) {\n store.dispatch(updateNoteStore({ note: note.toJSON() }));\n noteEmitter.trigger('note:edit', {\n note\n });\n};\n\nconst deleteNote = function (uuid) {\n store.dispatch(deleteNoteStore({ uuid }));\n noteEmitter.trigger('note:delete', {\n id: uuid\n });\n};\n\nconst sortNotes = function (sortUuids) {\n store.dispatch(sortNotesStore({ sortUuids }));\n};\n\n/**\n * Delete all the notes at once.\n */\nconst deleteAllNotes = function () {\n store.dispatch(clearNotes());\n // probably should trigger an event here?\n};\n/**\n * Import notes.\n * @param {Note[]} notes\n */\nconst importNotes = function (notes) {\n store.dispatch(importNotesStore({ notes }));\n notes.forEach((noteData) => {\n if (!noteData.uuid) {\n return;\n }\n const note = new Note(noteData);\n noteEmitter.trigger('note:add', {\n note\n });\n });\n};\n\nexport {\n noteEmitter,\n getAllNotes,\n getNoteById,\n addNote,\n updateNote,\n sortNotes,\n deleteNote,\n deleteAllNotes,\n importNotes\n};\n", "import { getResultFromTable } from '../services/randomTableService.js';\nimport A11yDialog from 'a11y-dialog/dist/a11y-dialog.esm';\nimport { getAllNotes, addNote, getNoteById, updateNote } from '../services/notesService.js';\nimport Note from '../models/note.js';\n\nconst template = document.createElement('template');\ntemplate.innerHTML = `\n\n\n

\n \n
{{ table.title }}
\n
\n
\n \n
\n
\n`;\n\nconst addnoteForm = document.createElement('template');\naddnoteForm.innerHTML = `\n
\n
\n \n \n
\n \n \n
\n`;\n\nclass RTableDisplay extends HTMLElement {\n constructor () {\n super();\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.appendChild(template.content.cloneNode(true));\n\n this.includeNumbers = false; // this doesn't work yet.\n }\n\n connectedCallback () {\n this.shadowRoot.querySelectorAll('button').forEach((btn) => {\n btn.addEventListener('click', this._rollTable.bind(this));\n });\n }\n\n disconnectedCallback () {\n this.shadowRoot.querySelectorAll('button').forEach((btn) => {\n btn.removeEventListener('click', this._rollTable.bind(this));\n });\n }\n /**\n *\n * @param {RandomTable} table\n */\n setTable (table) {\n this.table = table;\n this.shadowRoot.querySelector('#summary-title').innerText = this.table.title;\n\n const rows = this.getTableRows();\n\n const tableEl = this.shadowRoot.querySelector('table');\n if (table.subtableNames.length > 1) {\n const head = document.createElement('thead');\n const row = document.createElement('tr');\n table.subtableNames.forEach((name) => {\n const th = document.createElement('th');\n const btn = document.createElement('button');\n btn.innerText = 'Roll';\n btn.dataset.table = name;\n th.innerHTML = name;\n th.appendChild(btn);\n row.appendChild(th);\n });\n head.appendChild(row);\n tableEl.appendChild(head);\n }\n const body = document.createElement('tbody');\n\n rows.forEach((cells) => {\n const row = document.createElement('tr');\n cells.forEach((cell) => {\n const td = document.createElement('td');\n td.innerHTML = cell;\n row.appendChild(td);\n });\n body.appendChild(row);\n });\n tableEl.appendChild(body);\n\n // Now some events? Or else delegate from the Host?\n }\n\n /**\n * Get the data as rows of cells.\n * @returns\n */\n getTableRows () {\n // Count the largest result set.\n // make that many row arrays.\n // fill them with the empty value `---`\n // iterate and add in the table entries.\n const tableKeys = this.table.subtableNames;\n const entryCounts = tableKeys.map((t) => { return this.table.getSubtableEntries(t).length; });\n const columnCount = entryCounts.length + (this.includeNumbers ? 1 : 0);\n const rowCount = Math.max(...entryCounts);\n // Make sure we get different arrays in each index\n // Using Array.fill with another array directly gets all the same array.\n const rows = Array.from({ length: rowCount }, (e) => {\n return Array(columnCount).fill('---', 0, columnCount);\n });\n\n if (this.includeNumbers) {\n rows.forEach((row, i) => {\n row[0] = i + 1; // Start at 1.\n });\n }\n tableKeys.forEach((key, col) => {\n const entries = this.table.getSubtableEntries(key);\n const column = col + (this.includeNumbers ? 1 : 0);\n entries.forEach((entry, row) => {\n rows[row][column] = entry.label;\n });\n });\n return rows;\n }\n\n _rollTable (ev) {\n const btn = ev.target;\n const subtable = btn.dataset.table || '';\n const resultSet = getResultFromTable(this.table, subtable);\n\n const dialogEl = document.getElementById('dialog-rtable');\n const dialog = new A11yDialog(dialogEl);\n\n const dialogTitle = dialogEl.querySelector('#dialog-rtable-title');\n dialogTitle.innerHTML = resultSet.title;\n\n const content = dialogEl.querySelector('.dialog-body');\n resultSet.results.forEach((result) => {\n const p = document.createElement('p');\n p.classList.add('rtable-result');\n p.innerHTML = `${result.isDefault ? '' : `${result.table}: `}${result.result}${result.desc !== '' ? `${result.desc}` : ''}`;\n content.appendChild(p);\n });\n\n let form = addnoteForm.content.cloneNode(true);\n const select = form.querySelector('select');\n getAllNotes().forEach((note) => {\n const option = document.createElement('option');\n option.value = note.id;\n option.innerHTML = note.title;\n select.appendChild(option);\n });\n content.appendChild(form);\n form = content.querySelector('form');\n form.addEventListener('submit', (ev) => {\n ev.preventDefault();\n const formData = new FormData(ev.target);\n const noteId = formData.get('note_uuid').toString();\n if (noteId === '') {\n const note = new Note({\n title: this.table.title,\n content: resultSet.toString()\n });\n addNote(note);\n } else {\n const note = getNoteById(noteId);\n note.content = `${note.content}\\n\\n${resultSet.niceString()}`;\n updateNote(note);\n }\n dialog.hide();\n });\n form.querySelector('.btn-cancel').addEventListener('click', (ev) => {\n dialog.hide();\n });\n\n dialog.on('hide', (element, event) => {\n content.innerHTML = '';\n dialogTitle.innerHTML = '';\n dialog.destroy();\n });\n dialog.show();\n }\n};\n\nwindow.customElements.define('had-rtable', RTableDisplay);\n\nexport default RTableDisplay;\n", "import { getAllTables, tableEmitter } from '../services/randomTableService.js';\nimport RTableDisplay from './rtabledisplay.js';\n\nconst template = document.createElement('template');\ntemplate.innerHTML = `\n\n\n
\n

Tables

\n
\n \n
\n
\n`;\n\nclass TableDrawer extends HTMLElement {\n constructor () {\n super();\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.appendChild(template.content.cloneNode(true));\n\n this.setAttribute('role', 'region');\n\n this.closeButton = this.shadowRoot.querySelector('.btn-close');\n\n getAllTables().forEach((rtable) => {\n const display = new RTableDisplay();\n display.setTable(rtable);\n this.shadowRoot.appendChild(display);\n });\n }\n\n connectedCallback () {\n tableEmitter.on('table:drawer', this._toggle.bind(this));\n this.closeButton.addEventListener('click', this._toggleClick.bind(this));\n }\n\n disconnectedCallback () {\n tableEmitter.off('table:drawer', this._toggle.bind(this));\n this.closeButton.removeEventListener('click', this._toggleClick.bind(this));\n }\n /**\n * Click event on the close button.\n * Triggers event on emitter.\n * @param {Event} ev\n */\n _toggleClick (ev) {\n let open = true;\n if (this.getAttribute('aria-expanded') === 'true') {\n open = false;\n }\n tableEmitter.trigger('table:drawer', { open });\n }\n /**\n * Handler for the table:drawer event.\n * @param {Boolean} open\n */\n _toggle ({ open }) {\n if (open) {\n this.setAttribute('aria-expanded', 'true');\n return;\n }\n this.setAttribute('aria-expanded', 'false');\n }\n};\n\nwindow.customElements.define('had-tabledrawer', TableDrawer);\n\nexport default TableDrawer;\n", "import { defaultToJSON, isObject } from './r_helpers.js';\nimport { v4 as uuidv4 } from 'uuid';\n// import uuidv4 from '../node_modules/uuid/dist/esm-browser/v4.js';\n\n/**\n * Class for NPCs\n * @param {String} id Some kind of indentifier.\n * @param {String} schema Key for a NPCSchema used for this NPC.\n * @param {Map} fields Field values indexed by NPCSchemaField key.\n */\nexport default class NPC {\n constructor ({\n id = null,\n schema = '',\n fields = new Map()\n }) {\n // if null, generate a uuid\n if (id === null) {\n this.id = uuidv4();\n } else {\n this.id = id;\n }\n this.schema = schema;\n if (fields instanceof Map) {\n this.fields = fields;\n } else if (isObject(fields)) {\n // @todo do we convert result set objects to classes?\n // how?\n this.fields = new Map(Object.entries(fields));\n }\n }\n /**\n * Get field keys as array.\n * @returns {String[]}\n */\n getFieldKeys () {\n return Array.from(this.fields.keys());\n }\n /**\n * Get value by field key.\n * @param {String} key NPCSchemaField.key\n * @returns {RandomTableResultSet|RandomTableResultSet[]|DiceResult|String|Any}\n */\n getFieldValue (key) {\n return this.fields.get(key) || '';\n }\n /**\n * Custom JSON handler to strip empty props.\n * @returns {Object}\n */\n toJSON () {\n return defaultToJSON.call(this);\n }\n}\n", "import { defaultToJSON } from './r_helpers.js';\n\n/**\n * Specific field in NPC Schema.\n */\nexport default class NPCSchemaField {\n /**\n *\n * @property {String} key Identifying key\n * @property {String} label Readable label for field.\n * @property {String} type Type of data in field. Valid: string, text, array, number, modifier\n * @property {String} source Source of data for TableRoller in the form of a token (see TableRoller, ex: \"name:french\", \"table:color\", etc.)\n * @property {Number} count Number of entries for array types.\n * @property {Array|String|Number} starting_value An optional starting value.\n */\n constructor ({\n key = '',\n label = '',\n type = 'string',\n source = '',\n count = 1,\n starting_value = null\n }) {\n this.key = key;\n this.label = label;\n this.type = type;\n this.source = source;\n this.count = count;\n if (starting_value !== null) {\n this.starting_value = starting_value;\n }\n }\n /**\n * Default value for this field by type if empty.\n */\n get defaultEmpty () {\n switch (this.type) {\n case 'string':\n case 'text':\n return '';\n case 'array':\n return [];\n case 'number':\n case 'modifier':\n return 0;\n }\n return null;\n }\n /**\n * Custom JSON handler to strip empty props.\n * @returns {Object}\n */\n toJSON () {\n return defaultToJSON.call(this);\n }\n}\n", "import { defaultToJSON } from './r_helpers.js';\nimport NPCSchemaField from './NPCSchemaField.js';\n\n/**\n * Schema for creating NPCs.\n */\nexport default class NPCSchema {\n /**\n * @property {String} key Identifying key\n * @property {String} name Name of schema.\n * @property {String} author Name of author.\n * @property {Map} fields Data fields will be converted to NPCSchemaField if necessary.\n */\n constructor ({\n key = '',\n name = '',\n author = '',\n fields = []\n }) {\n this.key = key;\n this.name = name;\n this.author = author;\n this.fields = new Map();\n if (Array.isArray(fields)) {\n fields.forEach((obj) => {\n if (obj instanceof NPCSchemaField) {\n this.fields.set(obj.key, obj);\n return;\n }\n const field = new NPCSchemaField(obj);\n this.fields.set(field.key, field);\n });\n }\n }\n /**\n * Get a Field by the key.\n * @param {String} key\n * @returns {NPCSchemaField|undefined}\n */\n getFieldByKey (key) {\n return this.fields.get(key);\n }\n /**\n * Get field label by the key.\n * @param {String} key\n * @returns {String}\n */\n getFieldLabelByKey (key) {\n const field = this.getFieldByKey(key);\n if (!field) {\n return '';\n }\n return field.label;\n }\n /**\n * Custom JSON handler to strip empty props.\n * @returns {Object}\n */\n toJSON () {\n return defaultToJSON.call(this);\n }\n}\n", "import NPC from 'rpg-table-randomizer/src/NPC.js';\nimport NPCSchema from 'rpg-table-randomizer/src/NPCSchema.js';\nimport NPCSchemaField from 'rpg-table-randomizer/src/NPCSchemaField.js';\nimport MarkdownIt from 'markdown-it/lib';\n\nconst townSchema = new NPCSchema({\n key: 'town',\n name: 'Town',\n fields: [\n new NPCSchemaField({\n key: 'townName',\n label: 'Name',\n source: '{{table:town_name}}'\n }),\n new NPCSchemaField({\n key: 'landscape',\n label: 'Prominent Landscape',\n source: '{{table:town_landscape}}'\n }),\n new NPCSchemaField({\n key: 'resource',\n label: 'Primary Resource',\n source: '{{table:resources}}'\n }),\n new NPCSchemaField({\n key: 'dressing',\n label: 'Set Dressing',\n source: '{{table:dressing:outside}}',\n type: 'long'\n }),\n new NPCSchemaField({\n key: 'locations',\n label: 'Location Near Town',\n source: '{{table:locations}}'\n }),\n new NPCSchemaField({\n key: 'recent_event',\n label: 'Recent Event',\n source: '{{table:events}}'\n }),\n new NPCSchemaField({\n key: 'current_event',\n label: 'Current Event',\n source: '{{table:events}}'\n })\n ]\n});\n\nclass Town extends NPC {\n constructor ({\n id = null,\n fields = new Map()\n }) {\n super({\n id,\n schema: 'town',\n fields\n });\n }\n\n get name () {\n return this.getFieldValue('townName').toString();\n }\n\n getFieldDisplay (field) {\n if (field === 'notes') {\n return this.noteHtml;\n }\n return this.fields.get(field);\n }\n\n setFieldValue (field, value) {\n if (typeof this.fields.get(field) === 'undefined') {\n return;\n }\n this.fields.set(field, value);\n }\n\n get noteHtml () {\n const md = new MarkdownIt();\n return md.render(this.notes);\n }\n};\n\nexport {\n Town,\n townSchema\n};\n", "import { Town, townSchema } from '../models/town.js';\nimport { isEmpty } from 'rpg-table-randomizer/src/r_helpers.js';\nimport { convertToken } from '../services/randomTableService.js';\nimport store from '../store/store.js';\nimport { updateTown, clearTown as clearTownStore } from '../store/town-reducer.js';\n\n/**\n * Create a new Town\n * @returns Town\n */\nconst createTown = function () {\n const fields = new Map();\n townSchema.fields.forEach((field) => {\n const key = field.key;\n if (!isEmpty(field.starting_value)) {\n fields.set(key, field.starting_value);\n return;\n }\n if (!isEmpty(field.source)) {\n if (field.type === 'array') {\n const value = [];\n const ct = (field.count) ? field.count : 1;\n for (let i = 0; i < ct; i++) {\n value.push(convertToken(field.source).toString());\n }\n fields.set(key, value);\n } else {\n fields.set(key, convertToken(field.source).toString());\n }\n return;\n }\n fields.set(key, field.defaultEmpty);\n });\n return new Town({\n fields: fields\n });\n};\n\n/**\n * Get town or create new town\n * @returns {Town}\n */\nconst getTown = function () {\n const data = store.getState().town[0] || {};\n if (!data.id) {\n // Always have a town in the UI.\n const town = createTown();\n store.dispatch(updateTown({ town: town.toJSON() }));\n return town;\n }\n return new Town(data);\n};\n\n/**\n * Save changes to the town.\n * @param {Town} town\n */\nconst saveTown = function (town) {\n store.dispatch(updateTown({ town: town.toJSON() }));\n};\n/**\n * Reset town data.\n */\nconst clearTown = function () {\n store.dispatch(clearTownStore());\n};\n\nexport {\n getTown,\n saveTown,\n clearTown\n};\n", "import { townSchema } from '../models/town.js';\nimport { getTown, saveTown } from '../services/townService.js';\nimport { convertToken } from '../services/randomTableService.js';\n\nconst template = document.createElement('template');\ntemplate.innerHTML = `\n\n\n
\n \n
Town:
\n
\n \n
\n
\n
\n
\n`;\n\nconst formTemplate = document.createElement('template');\nformTemplate.innerHTML = `\n
\n

Click the to reroll a field. Click \"Save\" to save any changes.

\n
\n
\n
\n \n \n
\n
\n`;\n\nclass TownDisplay extends HTMLElement {\n constructor () {\n super();\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.appendChild(template.content.cloneNode(true));\n this._isEdit = false;\n this.editButton = this.shadowRoot.querySelector('.btn-edit');\n\n this.town = getTown();\n this.setTownDisplay();\n }\n\n connectedCallback () {\n this.editButton.addEventListener('click', this._toggleEdit.bind(this));\n }\n\n disconnectedCallback () {\n this.editButton.removeEventListener('click', this._toggleEdit.bind(this));\n }\n /**\n * Get the data as rows of cells.\n * @returns\n */\n setTownDisplay () {\n this.shadowRoot.querySelector('.body').innerHTML = '';\n this.shadowRoot.getElementById('summary-title').innerHTML = `Town: ${this.town.name}`;\n const list = document.createElement('dl');\n\n this.town.getFieldKeys().forEach((key) => {\n if (key === 'townName') {\n return;\n }\n const field = townSchema.getFieldByKey(key);\n const div = document.createElement('DIV');\n const dt = document.createElement('DT');\n dt.innerHTML = field.label;\n const dd = document.createElement('DD');\n dd.innerHTML = this.town.getFieldValue(key).toString();\n div.appendChild(dt);\n div.appendChild(dd);\n list.appendChild(div);\n });\n this.shadowRoot.querySelector('.body').appendChild(list);\n }\n\n _toggleEdit (ev) {\n if (this._isEdit) {\n this._disableEdit();\n return;\n }\n this._enableEdit();\n }\n\n _createFormField (field, value = '') {\n const key = field.key;\n const div = document.createElement('div');\n div.classList.add('formField');\n const label = document.createElement('label');\n label.setAttribute('for', key);\n label.innerHTML = field.label;\n div.appendChild(label);\n\n const div2 = document.createElement('div');\n div2.classList.add('fieldReroll');\n\n let input = null;\n if (field.type === 'long') {\n input = document.createElement('textarea');\n } else {\n input = document.createElement('input');\n input.setAttribute('type', 'text');\n }\n input.id = key;\n input.setAttribute('name', key);\n input.setAttribute('autocomplete', 'off');\n input.value = value;\n div2.appendChild(input);\n\n const button = document.createElement('button');\n button.classList.add('btn-reroll');\n button.dataset.field = key;\n button.dataset.append = field.type === 'long' ? 'true' : 'false';\n button.setAttribute('type', 'button');\n button.setAttribute('aria-label', 'Reroll');\n button.setAttribute('aria-controls', key);\n button.innerHTML = '⚅';\n div2.appendChild(button);\n\n div.appendChild(div2);\n\n return div;\n }\n\n _enableEdit () {\n if (this._isEdit) {\n return;\n }\n this._isEdit = true;\n\n this.shadowRoot.querySelector('.body').innerHTML = '';\n\n let form = formTemplate.content.cloneNode(true);\n const fieldDiv = form.querySelector('.formFields');\n Array.from(townSchema.fields.keys()).forEach((key) => {\n const field = townSchema.getFieldByKey(key);\n const value = this.town.getFieldDisplay(key);\n const formField = this._createFormField(\n field,\n value\n );\n fieldDiv.appendChild(formField);\n });\n\n // form.querySelector('textarea[name=notes').value = this.npc.notes;\n\n this.shadowRoot.querySelector('.body').appendChild(form);\n form = this.shadowRoot.querySelector('form');\n form.addEventListener('submit', this._saveEdit.bind(this));\n form.querySelector('.btn-cancel').addEventListener('click', this._toggleEdit.bind(this));\n\n form.querySelectorAll('.btn-reroll').forEach((btn) => {\n btn.addEventListener('click', this._reroll.bind(this));\n });\n }\n\n _disableEdit () {\n if (!this._isEdit) {\n return;\n }\n this._isEdit = false;\n\n // remove form events\n const form = this.shadowRoot.querySelector('form');\n form.removeEventListener('submit', this._saveEdit.bind(this));\n form.querySelector('.btn-cancel').removeEventListener('click', this._toggleEdit.bind(this));\n form.querySelectorAll('.btn-reroll').forEach((btn) => {\n btn.removeEventListener('click', this._reroll.bind(this));\n });\n\n this.setTownDisplay();\n }\n\n _saveEdit (ev) {\n ev.preventDefault();\n const formData = new FormData(ev.target);\n\n this.town.getFieldKeys().forEach((key) => {\n this.town.setFieldValue(key, formData.get(key).toString());\n });\n\n // this.town.notes = formData.get('notes').toString();\n\n saveTown(this.town);\n this._disableEdit();\n }\n\n _reroll (ev) {\n const fieldKey = ev.target.dataset.field || '';\n if (fieldKey === '') {\n return;\n }\n const append = ev.target.dataset.append === 'true';\n // get source from schema\n const field = townSchema.getFieldByKey(fieldKey);\n const result = convertToken(field.source);\n const input = this.shadowRoot.querySelector(`#${fieldKey}`);\n if (append) {\n input.value += `\\n${result.toString()}`;\n } else {\n input.value = result.toString();\n }\n }\n};\n\nwindow.customElements.define('had-town', TownDisplay);\n\nexport default TownDisplay;\n", "import { updateNote, deleteNote } from '../services/notesService.js';\n\nconst template = document.createElement('template');\ntemplate.innerHTML = `\n\n\n
\n \n
{{ note.title }}
\n
\n \n
\n
\n\n
\n
\n
\n
\n`;\n\nconst formTemplate = document.createElement('template');\nformTemplate.innerHTML = `\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n \n
\n
\n`;\n\nclass NoteDisplay extends HTMLElement {\n constructor () {\n super();\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.appendChild(template.content.cloneNode(true));\n this._isEdit = false;\n this.editButton = this.shadowRoot.querySelector('.btn-edit');\n }\n\n connectedCallback () {\n this.shadowRoot.querySelector('details').addEventListener('toggle', this._setCollapse.bind(this));\n this.editButton.addEventListener('click', this._toggleEdit.bind(this));\n }\n\n disconnectedCallback () {\n this.shadowRoot.querySelector('details').removeEventListener('toggle', this._setCollapse.bind(this));\n this.editButton.removeEventListener('click', this._toggleEdit.bind(this));\n }\n\n /**\n *\n * @param {Note} note\n */\n setNote (note) {\n this.note = note;\n this.id = `note_${this.note.id}`;\n this.dataset.id = this.note.id;\n this.shadowRoot.querySelector('#summary-title').innerText = note.title;\n if (note.collapse) {\n this.shadowRoot.querySelector('details').open = false;\n } else {\n this.shadowRoot.querySelector('details').open = true;\n }\n this.shadowRoot.querySelector('.content').innerHTML = this.note.contentHtml;\n // Now some events? Or else delegate from the Host?\n }\n\n /**\n * Save collapse state\n * @param ev Toggle event on details.\n */\n _setCollapse (ev) {\n const newState = !ev.target.open;\n if (this.note.collapse === newState) {\n return;\n }\n this.note.collapse = newState;\n updateNote(this.note);\n }\n\n collapse () {\n this.shadowRoot.querySelector('details').open = false;\n }\n\n _toggleEdit (ev) {\n if (this._isEdit) {\n this._disableEdit();\n return;\n }\n this._enableEdit();\n }\n\n _enableEdit () {\n if (this._isEdit) {\n return;\n }\n this._isEdit = true;\n\n this.shadowRoot.querySelector('.body').innerHTML = '';\n\n let form = formTemplate.content.cloneNode(true);\n form.querySelector('input[name=title').value = this.note.title;\n form.querySelector('textarea[name=content').value = this.note.content;\n\n this.shadowRoot.querySelector('.body').appendChild(form);\n form = this.shadowRoot.querySelector('form');\n\n form.addEventListener('submit', this._saveEdit.bind(this));\n form.querySelector('.btn-cancel').addEventListener('click', this._toggleEdit.bind(this));\n form.querySelector('.btn-delete').addEventListener('click', this._deleteNote.bind(this));\n }\n\n _disableEdit () {\n if (!this._isEdit) {\n return;\n }\n this._isEdit = false;\n\n // remove form events\n const form = this.shadowRoot.querySelector('form');\n form.removeEventListener('submit', this._saveEdit.bind(this));\n form.querySelector('.btn-cancel').removeEventListener('click', this._toggleEdit.bind(this));\n form.querySelector('.btn-delete').removeEventListener('click', this._deleteNote.bind(this));\n\n this.shadowRoot.querySelector('#summary-title').innerText = this.note.title;\n this.shadowRoot.querySelector('.body').innerHTML = `
${this.note.contentHtml}
`;\n }\n\n _saveEdit (ev) {\n ev.preventDefault();\n const formData = new FormData(ev.target);\n this.note.title = formData.get('title').toString();\n this.note.content = formData.get('content').toString();\n this._disableEdit();\n updateNote(this.note);\n }\n\n _deleteNote () {\n deleteNote(this.note.id);\n }\n};\n\nwindow.customElements.define('had-note', NoteDisplay);\n\nexport default NoteDisplay;\n", "/**!\n * Sortable 1.14.0\n * @author\tRubaXa \n * @author\towenm \n * @license MIT\n */\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n\n if (enumerableOnly) {\n symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n }\n\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nfunction _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n}\n\nfunction _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function (obj) {\n return typeof obj;\n };\n } else {\n _typeof = function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n\n var target = _objectWithoutPropertiesLoose(source, excluded);\n\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nfunction _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();\n}\n\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return _arrayLikeToArray(arr);\n}\n\nfunction _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter);\n}\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n\n return arr2;\n}\n\nfunction _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nvar version = \"1.14.0\";\n\nfunction userAgent(pattern) {\n if (typeof window !== 'undefined' && window.navigator) {\n return !! /*@__PURE__*/navigator.userAgent.match(pattern);\n }\n}\n\nvar IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\\.|msie|iemobile|Windows Phone)/i);\nvar Edge = userAgent(/Edge/i);\nvar FireFox = userAgent(/firefox/i);\nvar Safari = userAgent(/safari/i) && !userAgent(/chrome/i) && !userAgent(/android/i);\nvar IOS = userAgent(/iP(ad|od|hone)/i);\nvar ChromeForAndroid = userAgent(/chrome/i) && userAgent(/android/i);\n\nvar captureMode = {\n capture: false,\n passive: false\n};\n\nfunction on(el, event, fn) {\n el.addEventListener(event, fn, !IE11OrLess && captureMode);\n}\n\nfunction off(el, event, fn) {\n el.removeEventListener(event, fn, !IE11OrLess && captureMode);\n}\n\nfunction matches(\n/**HTMLElement*/\nel,\n/**String*/\nselector) {\n if (!selector) return;\n selector[0] === '>' && (selector = selector.substring(1));\n\n if (el) {\n try {\n if (el.matches) {\n return el.matches(selector);\n } else if (el.msMatchesSelector) {\n return el.msMatchesSelector(selector);\n } else if (el.webkitMatchesSelector) {\n return el.webkitMatchesSelector(selector);\n }\n } catch (_) {\n return false;\n }\n }\n\n return false;\n}\n\nfunction getParentOrHost(el) {\n return el.host && el !== document && el.host.nodeType ? el.host : el.parentNode;\n}\n\nfunction closest(\n/**HTMLElement*/\nel,\n/**String*/\nselector,\n/**HTMLElement*/\nctx, includeCTX) {\n if (el) {\n ctx = ctx || document;\n\n do {\n if (selector != null && (selector[0] === '>' ? el.parentNode === ctx && matches(el, selector) : matches(el, selector)) || includeCTX && el === ctx) {\n return el;\n }\n\n if (el === ctx) break;\n /* jshint boss:true */\n } while (el = getParentOrHost(el));\n }\n\n return null;\n}\n\nvar R_SPACE = /\\s+/g;\n\nfunction toggleClass(el, name, state) {\n if (el && name) {\n if (el.classList) {\n el.classList[state ? 'add' : 'remove'](name);\n } else {\n var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');\n el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');\n }\n }\n}\n\nfunction css(el, prop, val) {\n var style = el && el.style;\n\n if (style) {\n if (val === void 0) {\n if (document.defaultView && document.defaultView.getComputedStyle) {\n val = document.defaultView.getComputedStyle(el, '');\n } else if (el.currentStyle) {\n val = el.currentStyle;\n }\n\n return prop === void 0 ? val : val[prop];\n } else {\n if (!(prop in style) && prop.indexOf('webkit') === -1) {\n prop = '-webkit-' + prop;\n }\n\n style[prop] = val + (typeof val === 'string' ? '' : 'px');\n }\n }\n}\n\nfunction matrix(el, selfOnly) {\n var appliedTransforms = '';\n\n if (typeof el === 'string') {\n appliedTransforms = el;\n } else {\n do {\n var transform = css(el, 'transform');\n\n if (transform && transform !== 'none') {\n appliedTransforms = transform + ' ' + appliedTransforms;\n }\n /* jshint boss:true */\n\n } while (!selfOnly && (el = el.parentNode));\n }\n\n var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;\n /*jshint -W056 */\n\n return matrixFn && new matrixFn(appliedTransforms);\n}\n\nfunction find(ctx, tagName, iterator) {\n if (ctx) {\n var list = ctx.getElementsByTagName(tagName),\n i = 0,\n n = list.length;\n\n if (iterator) {\n for (; i < n; i++) {\n iterator(list[i], i);\n }\n }\n\n return list;\n }\n\n return [];\n}\n\nfunction getWindowScrollingElement() {\n var scrollingElement = document.scrollingElement;\n\n if (scrollingElement) {\n return scrollingElement;\n } else {\n return document.documentElement;\n }\n}\n/**\n * Returns the \"bounding client rect\" of given element\n * @param {HTMLElement} el The element whose boundingClientRect is wanted\n * @param {[Boolean]} relativeToContainingBlock Whether the rect should be relative to the containing block of (including) the container\n * @param {[Boolean]} relativeToNonStaticParent Whether the rect should be relative to the relative parent of (including) the contaienr\n * @param {[Boolean]} undoScale Whether the container's scale() should be undone\n * @param {[HTMLElement]} container The parent the element will be placed in\n * @return {Object} The boundingClientRect of el, with specified adjustments\n */\n\n\nfunction getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) {\n if (!el.getBoundingClientRect && el !== window) return;\n var elRect, top, left, bottom, right, height, width;\n\n if (el !== window && el.parentNode && el !== getWindowScrollingElement()) {\n elRect = el.getBoundingClientRect();\n top = elRect.top;\n left = elRect.left;\n bottom = elRect.bottom;\n right = elRect.right;\n height = elRect.height;\n width = elRect.width;\n } else {\n top = 0;\n left = 0;\n bottom = window.innerHeight;\n right = window.innerWidth;\n height = window.innerHeight;\n width = window.innerWidth;\n }\n\n if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) {\n // Adjust for translate()\n container = container || el.parentNode; // solves #1123 (see: https://stackoverflow.com/a/37953806/6088312)\n // Not needed on <= IE11\n\n if (!IE11OrLess) {\n do {\n if (container && container.getBoundingClientRect && (css(container, 'transform') !== 'none' || relativeToNonStaticParent && css(container, 'position') !== 'static')) {\n var containerRect = container.getBoundingClientRect(); // Set relative to edges of padding box of container\n\n top -= containerRect.top + parseInt(css(container, 'border-top-width'));\n left -= containerRect.left + parseInt(css(container, 'border-left-width'));\n bottom = top + elRect.height;\n right = left + elRect.width;\n break;\n }\n /* jshint boss:true */\n\n } while (container = container.parentNode);\n }\n }\n\n if (undoScale && el !== window) {\n // Adjust for scale()\n var elMatrix = matrix(container || el),\n scaleX = elMatrix && elMatrix.a,\n scaleY = elMatrix && elMatrix.d;\n\n if (elMatrix) {\n top /= scaleY;\n left /= scaleX;\n width /= scaleX;\n height /= scaleY;\n bottom = top + height;\n right = left + width;\n }\n }\n\n return {\n top: top,\n left: left,\n bottom: bottom,\n right: right,\n width: width,\n height: height\n };\n}\n/**\n * Checks if a side of an element is scrolled past a side of its parents\n * @param {HTMLElement} el The element who's side being scrolled out of view is in question\n * @param {String} elSide Side of the element in question ('top', 'left', 'right', 'bottom')\n * @param {String} parentSide Side of the parent in question ('top', 'left', 'right', 'bottom')\n * @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element\n */\n\n\nfunction isScrolledPast(el, elSide, parentSide) {\n var parent = getParentAutoScrollElement(el, true),\n elSideVal = getRect(el)[elSide];\n /* jshint boss:true */\n\n while (parent) {\n var parentSideVal = getRect(parent)[parentSide],\n visible = void 0;\n\n if (parentSide === 'top' || parentSide === 'left') {\n visible = elSideVal >= parentSideVal;\n } else {\n visible = elSideVal <= parentSideVal;\n }\n\n if (!visible) return parent;\n if (parent === getWindowScrollingElement()) break;\n parent = getParentAutoScrollElement(parent, false);\n }\n\n return false;\n}\n/**\n * Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible)\n * and non-draggable elements\n * @param {HTMLElement} el The parent element\n * @param {Number} childNum The index of the child\n * @param {Object} options Parent Sortable's options\n * @return {HTMLElement} The child at index childNum, or null if not found\n */\n\n\nfunction getChild(el, childNum, options, includeDragEl) {\n var currentChild = 0,\n i = 0,\n children = el.children;\n\n while (i < children.length) {\n if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && (includeDragEl || children[i] !== Sortable.dragged) && closest(children[i], options.draggable, el, false)) {\n if (currentChild === childNum) {\n return children[i];\n }\n\n currentChild++;\n }\n\n i++;\n }\n\n return null;\n}\n/**\n * Gets the last child in the el, ignoring ghostEl or invisible elements (clones)\n * @param {HTMLElement} el Parent element\n * @param {selector} selector Any other elements that should be ignored\n * @return {HTMLElement} The last child, ignoring ghostEl\n */\n\n\nfunction lastChild(el, selector) {\n var last = el.lastElementChild;\n\n while (last && (last === Sortable.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) {\n last = last.previousElementSibling;\n }\n\n return last || null;\n}\n/**\n * Returns the index of an element within its parent for a selected set of\n * elements\n * @param {HTMLElement} el\n * @param {selector} selector\n * @return {number}\n */\n\n\nfunction index(el, selector) {\n var index = 0;\n\n if (!el || !el.parentNode) {\n return -1;\n }\n /* jshint boss:true */\n\n\n while (el = el.previousElementSibling) {\n if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable.clone && (!selector || matches(el, selector))) {\n index++;\n }\n }\n\n return index;\n}\n/**\n * Returns the scroll offset of the given element, added with all the scroll offsets of parent elements.\n * The value is returned in real pixels.\n * @param {HTMLElement} el\n * @return {Array} Offsets in the format of [left, top]\n */\n\n\nfunction getRelativeScrollOffset(el) {\n var offsetLeft = 0,\n offsetTop = 0,\n winScroller = getWindowScrollingElement();\n\n if (el) {\n do {\n var elMatrix = matrix(el),\n scaleX = elMatrix.a,\n scaleY = elMatrix.d;\n offsetLeft += el.scrollLeft * scaleX;\n offsetTop += el.scrollTop * scaleY;\n } while (el !== winScroller && (el = el.parentNode));\n }\n\n return [offsetLeft, offsetTop];\n}\n/**\n * Returns the index of the object within the given array\n * @param {Array} arr Array that may or may not hold the object\n * @param {Object} obj An object that has a key-value pair unique to and identical to a key-value pair in the object you want to find\n * @return {Number} The index of the object in the array, or -1\n */\n\n\nfunction indexOfObject(arr, obj) {\n for (var i in arr) {\n if (!arr.hasOwnProperty(i)) continue;\n\n for (var key in obj) {\n if (obj.hasOwnProperty(key) && obj[key] === arr[i][key]) return Number(i);\n }\n }\n\n return -1;\n}\n\nfunction getParentAutoScrollElement(el, includeSelf) {\n // skip to window\n if (!el || !el.getBoundingClientRect) return getWindowScrollingElement();\n var elem = el;\n var gotSelf = false;\n\n do {\n // we don't need to get elem css if it isn't even overflowing in the first place (performance)\n if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) {\n var elemCSS = css(elem);\n\n if (elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == 'auto' || elemCSS.overflowX == 'scroll') || elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == 'auto' || elemCSS.overflowY == 'scroll')) {\n if (!elem.getBoundingClientRect || elem === document.body) return getWindowScrollingElement();\n if (gotSelf || includeSelf) return elem;\n gotSelf = true;\n }\n }\n /* jshint boss:true */\n\n } while (elem = elem.parentNode);\n\n return getWindowScrollingElement();\n}\n\nfunction extend(dst, src) {\n if (dst && src) {\n for (var key in src) {\n if (src.hasOwnProperty(key)) {\n dst[key] = src[key];\n }\n }\n }\n\n return dst;\n}\n\nfunction isRectEqual(rect1, rect2) {\n return Math.round(rect1.top) === Math.round(rect2.top) && Math.round(rect1.left) === Math.round(rect2.left) && Math.round(rect1.height) === Math.round(rect2.height) && Math.round(rect1.width) === Math.round(rect2.width);\n}\n\nvar _throttleTimeout;\n\nfunction throttle(callback, ms) {\n return function () {\n if (!_throttleTimeout) {\n var args = arguments,\n _this = this;\n\n if (args.length === 1) {\n callback.call(_this, args[0]);\n } else {\n callback.apply(_this, args);\n }\n\n _throttleTimeout = setTimeout(function () {\n _throttleTimeout = void 0;\n }, ms);\n }\n };\n}\n\nfunction cancelThrottle() {\n clearTimeout(_throttleTimeout);\n _throttleTimeout = void 0;\n}\n\nfunction scrollBy(el, x, y) {\n el.scrollLeft += x;\n el.scrollTop += y;\n}\n\nfunction clone(el) {\n var Polymer = window.Polymer;\n var $ = window.jQuery || window.Zepto;\n\n if (Polymer && Polymer.dom) {\n return Polymer.dom(el).cloneNode(true);\n } else if ($) {\n return $(el).clone(true)[0];\n } else {\n return el.cloneNode(true);\n }\n}\n\nfunction setRect(el, rect) {\n css(el, 'position', 'absolute');\n css(el, 'top', rect.top);\n css(el, 'left', rect.left);\n css(el, 'width', rect.width);\n css(el, 'height', rect.height);\n}\n\nfunction unsetRect(el) {\n css(el, 'position', '');\n css(el, 'top', '');\n css(el, 'left', '');\n css(el, 'width', '');\n css(el, 'height', '');\n}\n\nvar expando = 'Sortable' + new Date().getTime();\n\nfunction AnimationStateManager() {\n var animationStates = [],\n animationCallbackId;\n return {\n captureAnimationState: function captureAnimationState() {\n animationStates = [];\n if (!this.options.animation) return;\n var children = [].slice.call(this.el.children);\n children.forEach(function (child) {\n if (css(child, 'display') === 'none' || child === Sortable.ghost) return;\n animationStates.push({\n target: child,\n rect: getRect(child)\n });\n\n var fromRect = _objectSpread2({}, animationStates[animationStates.length - 1].rect); // If animating: compensate for current animation\n\n\n if (child.thisAnimationDuration) {\n var childMatrix = matrix(child, true);\n\n if (childMatrix) {\n fromRect.top -= childMatrix.f;\n fromRect.left -= childMatrix.e;\n }\n }\n\n child.fromRect = fromRect;\n });\n },\n addAnimationState: function addAnimationState(state) {\n animationStates.push(state);\n },\n removeAnimationState: function removeAnimationState(target) {\n animationStates.splice(indexOfObject(animationStates, {\n target: target\n }), 1);\n },\n animateAll: function animateAll(callback) {\n var _this = this;\n\n if (!this.options.animation) {\n clearTimeout(animationCallbackId);\n if (typeof callback === 'function') callback();\n return;\n }\n\n var animating = false,\n animationTime = 0;\n animationStates.forEach(function (state) {\n var time = 0,\n target = state.target,\n fromRect = target.fromRect,\n toRect = getRect(target),\n prevFromRect = target.prevFromRect,\n prevToRect = target.prevToRect,\n animatingRect = state.rect,\n targetMatrix = matrix(target, true);\n\n if (targetMatrix) {\n // Compensate for current animation\n toRect.top -= targetMatrix.f;\n toRect.left -= targetMatrix.e;\n }\n\n target.toRect = toRect;\n\n if (target.thisAnimationDuration) {\n // Could also check if animatingRect is between fromRect and toRect\n if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) && // Make sure animatingRect is on line between toRect & fromRect\n (animatingRect.top - toRect.top) / (animatingRect.left - toRect.left) === (fromRect.top - toRect.top) / (fromRect.left - toRect.left)) {\n // If returning to same place as started from animation and on same axis\n time = calculateRealTime(animatingRect, prevFromRect, prevToRect, _this.options);\n }\n } // if fromRect != toRect: animate\n\n\n if (!isRectEqual(toRect, fromRect)) {\n target.prevFromRect = fromRect;\n target.prevToRect = toRect;\n\n if (!time) {\n time = _this.options.animation;\n }\n\n _this.animate(target, animatingRect, toRect, time);\n }\n\n if (time) {\n animating = true;\n animationTime = Math.max(animationTime, time);\n clearTimeout(target.animationResetTimer);\n target.animationResetTimer = setTimeout(function () {\n target.animationTime = 0;\n target.prevFromRect = null;\n target.fromRect = null;\n target.prevToRect = null;\n target.thisAnimationDuration = null;\n }, time);\n target.thisAnimationDuration = time;\n }\n });\n clearTimeout(animationCallbackId);\n\n if (!animating) {\n if (typeof callback === 'function') callback();\n } else {\n animationCallbackId = setTimeout(function () {\n if (typeof callback === 'function') callback();\n }, animationTime);\n }\n\n animationStates = [];\n },\n animate: function animate(target, currentRect, toRect, duration) {\n if (duration) {\n css(target, 'transition', '');\n css(target, 'transform', '');\n var elMatrix = matrix(this.el),\n scaleX = elMatrix && elMatrix.a,\n scaleY = elMatrix && elMatrix.d,\n translateX = (currentRect.left - toRect.left) / (scaleX || 1),\n translateY = (currentRect.top - toRect.top) / (scaleY || 1);\n target.animatingX = !!translateX;\n target.animatingY = !!translateY;\n css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)');\n this.forRepaintDummy = repaint(target); // repaint\n\n css(target, 'transition', 'transform ' + duration + 'ms' + (this.options.easing ? ' ' + this.options.easing : ''));\n css(target, 'transform', 'translate3d(0,0,0)');\n typeof target.animated === 'number' && clearTimeout(target.animated);\n target.animated = setTimeout(function () {\n css(target, 'transition', '');\n css(target, 'transform', '');\n target.animated = false;\n target.animatingX = false;\n target.animatingY = false;\n }, duration);\n }\n }\n };\n}\n\nfunction repaint(target) {\n return target.offsetWidth;\n}\n\nfunction calculateRealTime(animatingRect, fromRect, toRect, options) {\n return Math.sqrt(Math.pow(fromRect.top - animatingRect.top, 2) + Math.pow(fromRect.left - animatingRect.left, 2)) / Math.sqrt(Math.pow(fromRect.top - toRect.top, 2) + Math.pow(fromRect.left - toRect.left, 2)) * options.animation;\n}\n\nvar plugins = [];\nvar defaults = {\n initializeByDefault: true\n};\nvar PluginManager = {\n mount: function mount(plugin) {\n // Set default static properties\n for (var option in defaults) {\n if (defaults.hasOwnProperty(option) && !(option in plugin)) {\n plugin[option] = defaults[option];\n }\n }\n\n plugins.forEach(function (p) {\n if (p.pluginName === plugin.pluginName) {\n throw \"Sortable: Cannot mount plugin \".concat(plugin.pluginName, \" more than once\");\n }\n });\n plugins.push(plugin);\n },\n pluginEvent: function pluginEvent(eventName, sortable, evt) {\n var _this = this;\n\n this.eventCanceled = false;\n\n evt.cancel = function () {\n _this.eventCanceled = true;\n };\n\n var eventNameGlobal = eventName + 'Global';\n plugins.forEach(function (plugin) {\n if (!sortable[plugin.pluginName]) return; // Fire global events if it exists in this sortable\n\n if (sortable[plugin.pluginName][eventNameGlobal]) {\n sortable[plugin.pluginName][eventNameGlobal](_objectSpread2({\n sortable: sortable\n }, evt));\n } // Only fire plugin event if plugin is enabled in this sortable,\n // and plugin has event defined\n\n\n if (sortable.options[plugin.pluginName] && sortable[plugin.pluginName][eventName]) {\n sortable[plugin.pluginName][eventName](_objectSpread2({\n sortable: sortable\n }, evt));\n }\n });\n },\n initializePlugins: function initializePlugins(sortable, el, defaults, options) {\n plugins.forEach(function (plugin) {\n var pluginName = plugin.pluginName;\n if (!sortable.options[pluginName] && !plugin.initializeByDefault) return;\n var initialized = new plugin(sortable, el, sortable.options);\n initialized.sortable = sortable;\n initialized.options = sortable.options;\n sortable[pluginName] = initialized; // Add default options from plugin\n\n _extends(defaults, initialized.defaults);\n });\n\n for (var option in sortable.options) {\n if (!sortable.options.hasOwnProperty(option)) continue;\n var modified = this.modifyOption(sortable, option, sortable.options[option]);\n\n if (typeof modified !== 'undefined') {\n sortable.options[option] = modified;\n }\n }\n },\n getEventProperties: function getEventProperties(name, sortable) {\n var eventProperties = {};\n plugins.forEach(function (plugin) {\n if (typeof plugin.eventProperties !== 'function') return;\n\n _extends(eventProperties, plugin.eventProperties.call(sortable[plugin.pluginName], name));\n });\n return eventProperties;\n },\n modifyOption: function modifyOption(sortable, name, value) {\n var modifiedValue;\n plugins.forEach(function (plugin) {\n // Plugin must exist on the Sortable\n if (!sortable[plugin.pluginName]) return; // If static option listener exists for this option, call in the context of the Sortable's instance of this plugin\n\n if (plugin.optionListeners && typeof plugin.optionListeners[name] === 'function') {\n modifiedValue = plugin.optionListeners[name].call(sortable[plugin.pluginName], value);\n }\n });\n return modifiedValue;\n }\n};\n\nfunction dispatchEvent(_ref) {\n var sortable = _ref.sortable,\n rootEl = _ref.rootEl,\n name = _ref.name,\n targetEl = _ref.targetEl,\n cloneEl = _ref.cloneEl,\n toEl = _ref.toEl,\n fromEl = _ref.fromEl,\n oldIndex = _ref.oldIndex,\n newIndex = _ref.newIndex,\n oldDraggableIndex = _ref.oldDraggableIndex,\n newDraggableIndex = _ref.newDraggableIndex,\n originalEvent = _ref.originalEvent,\n putSortable = _ref.putSortable,\n extraEventProperties = _ref.extraEventProperties;\n sortable = sortable || rootEl && rootEl[expando];\n if (!sortable) return;\n var evt,\n options = sortable.options,\n onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1); // Support for new CustomEvent feature\n\n if (window.CustomEvent && !IE11OrLess && !Edge) {\n evt = new CustomEvent(name, {\n bubbles: true,\n cancelable: true\n });\n } else {\n evt = document.createEvent('Event');\n evt.initEvent(name, true, true);\n }\n\n evt.to = toEl || rootEl;\n evt.from = fromEl || rootEl;\n evt.item = targetEl || rootEl;\n evt.clone = cloneEl;\n evt.oldIndex = oldIndex;\n evt.newIndex = newIndex;\n evt.oldDraggableIndex = oldDraggableIndex;\n evt.newDraggableIndex = newDraggableIndex;\n evt.originalEvent = originalEvent;\n evt.pullMode = putSortable ? putSortable.lastPutMode : undefined;\n\n var allEventProperties = _objectSpread2(_objectSpread2({}, extraEventProperties), PluginManager.getEventProperties(name, sortable));\n\n for (var option in allEventProperties) {\n evt[option] = allEventProperties[option];\n }\n\n if (rootEl) {\n rootEl.dispatchEvent(evt);\n }\n\n if (options[onName]) {\n options[onName].call(sortable, evt);\n }\n}\n\nvar _excluded = [\"evt\"];\n\nvar pluginEvent = function pluginEvent(eventName, sortable) {\n var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},\n originalEvent = _ref.evt,\n data = _objectWithoutProperties(_ref, _excluded);\n\n PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread2({\n dragEl: dragEl,\n parentEl: parentEl,\n ghostEl: ghostEl,\n rootEl: rootEl,\n nextEl: nextEl,\n lastDownEl: lastDownEl,\n cloneEl: cloneEl,\n cloneHidden: cloneHidden,\n dragStarted: moved,\n putSortable: putSortable,\n activeSortable: Sortable.active,\n originalEvent: originalEvent,\n oldIndex: oldIndex,\n oldDraggableIndex: oldDraggableIndex,\n newIndex: newIndex,\n newDraggableIndex: newDraggableIndex,\n hideGhostForTarget: _hideGhostForTarget,\n unhideGhostForTarget: _unhideGhostForTarget,\n cloneNowHidden: function cloneNowHidden() {\n cloneHidden = true;\n },\n cloneNowShown: function cloneNowShown() {\n cloneHidden = false;\n },\n dispatchSortableEvent: function dispatchSortableEvent(name) {\n _dispatchEvent({\n sortable: sortable,\n name: name,\n originalEvent: originalEvent\n });\n }\n }, data));\n};\n\nfunction _dispatchEvent(info) {\n dispatchEvent(_objectSpread2({\n putSortable: putSortable,\n cloneEl: cloneEl,\n targetEl: dragEl,\n rootEl: rootEl,\n oldIndex: oldIndex,\n oldDraggableIndex: oldDraggableIndex,\n newIndex: newIndex,\n newDraggableIndex: newDraggableIndex\n }, info));\n}\n\nvar dragEl,\n parentEl,\n ghostEl,\n rootEl,\n nextEl,\n lastDownEl,\n cloneEl,\n cloneHidden,\n oldIndex,\n newIndex,\n oldDraggableIndex,\n newDraggableIndex,\n activeGroup,\n putSortable,\n awaitingDragStarted = false,\n ignoreNextClick = false,\n sortables = [],\n tapEvt,\n touchEvt,\n lastDx,\n lastDy,\n tapDistanceLeft,\n tapDistanceTop,\n moved,\n lastTarget,\n lastDirection,\n pastFirstInvertThresh = false,\n isCircumstantialInvert = false,\n targetMoveDistance,\n // For positioning ghost absolutely\nghostRelativeParent,\n ghostRelativeParentInitialScroll = [],\n // (left, top)\n_silent = false,\n savedInputChecked = [];\n/** @const */\n\nvar documentExists = typeof document !== 'undefined',\n PositionGhostAbsolutely = IOS,\n CSSFloatProperty = Edge || IE11OrLess ? 'cssFloat' : 'float',\n // This will not pass for IE9, because IE9 DnD only works on anchors\nsupportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in document.createElement('div'),\n supportCssPointerEvents = function () {\n if (!documentExists) return; // false when <= IE11\n\n if (IE11OrLess) {\n return false;\n }\n\n var el = document.createElement('x');\n el.style.cssText = 'pointer-events:auto';\n return el.style.pointerEvents === 'auto';\n}(),\n _detectDirection = function _detectDirection(el, options) {\n var elCSS = css(el),\n elWidth = parseInt(elCSS.width) - parseInt(elCSS.paddingLeft) - parseInt(elCSS.paddingRight) - parseInt(elCSS.borderLeftWidth) - parseInt(elCSS.borderRightWidth),\n child1 = getChild(el, 0, options),\n child2 = getChild(el, 1, options),\n firstChildCSS = child1 && css(child1),\n secondChildCSS = child2 && css(child2),\n firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + getRect(child1).width,\n secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + getRect(child2).width;\n\n if (elCSS.display === 'flex') {\n return elCSS.flexDirection === 'column' || elCSS.flexDirection === 'column-reverse' ? 'vertical' : 'horizontal';\n }\n\n if (elCSS.display === 'grid') {\n return elCSS.gridTemplateColumns.split(' ').length <= 1 ? 'vertical' : 'horizontal';\n }\n\n if (child1 && firstChildCSS[\"float\"] && firstChildCSS[\"float\"] !== 'none') {\n var touchingSideChild2 = firstChildCSS[\"float\"] === 'left' ? 'left' : 'right';\n return child2 && (secondChildCSS.clear === 'both' || secondChildCSS.clear === touchingSideChild2) ? 'vertical' : 'horizontal';\n }\n\n return child1 && (firstChildCSS.display === 'block' || firstChildCSS.display === 'flex' || firstChildCSS.display === 'table' || firstChildCSS.display === 'grid' || firstChildWidth >= elWidth && elCSS[CSSFloatProperty] === 'none' || child2 && elCSS[CSSFloatProperty] === 'none' && firstChildWidth + secondChildWidth > elWidth) ? 'vertical' : 'horizontal';\n},\n _dragElInRowColumn = function _dragElInRowColumn(dragRect, targetRect, vertical) {\n var dragElS1Opp = vertical ? dragRect.left : dragRect.top,\n dragElS2Opp = vertical ? dragRect.right : dragRect.bottom,\n dragElOppLength = vertical ? dragRect.width : dragRect.height,\n targetS1Opp = vertical ? targetRect.left : targetRect.top,\n targetS2Opp = vertical ? targetRect.right : targetRect.bottom,\n targetOppLength = vertical ? targetRect.width : targetRect.height;\n return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2;\n},\n\n/**\n * Detects first nearest empty sortable to X and Y position using emptyInsertThreshold.\n * @param {Number} x X position\n * @param {Number} y Y position\n * @return {HTMLElement} Element of the first found nearest Sortable\n */\n_detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) {\n var ret;\n sortables.some(function (sortable) {\n var threshold = sortable[expando].options.emptyInsertThreshold;\n if (!threshold || lastChild(sortable)) return;\n var rect = getRect(sortable),\n insideHorizontally = x >= rect.left - threshold && x <= rect.right + threshold,\n insideVertically = y >= rect.top - threshold && y <= rect.bottom + threshold;\n\n if (insideHorizontally && insideVertically) {\n return ret = sortable;\n }\n });\n return ret;\n},\n _prepareGroup = function _prepareGroup(options) {\n function toFn(value, pull) {\n return function (to, from, dragEl, evt) {\n var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name;\n\n if (value == null && (pull || sameGroup)) {\n // Default pull value\n // Default pull and put value if same group\n return true;\n } else if (value == null || value === false) {\n return false;\n } else if (pull && value === 'clone') {\n return value;\n } else if (typeof value === 'function') {\n return toFn(value(to, from, dragEl, evt), pull)(to, from, dragEl, evt);\n } else {\n var otherGroup = (pull ? to : from).options.group.name;\n return value === true || typeof value === 'string' && value === otherGroup || value.join && value.indexOf(otherGroup) > -1;\n }\n };\n }\n\n var group = {};\n var originalGroup = options.group;\n\n if (!originalGroup || _typeof(originalGroup) != 'object') {\n originalGroup = {\n name: originalGroup\n };\n }\n\n group.name = originalGroup.name;\n group.checkPull = toFn(originalGroup.pull, true);\n group.checkPut = toFn(originalGroup.put);\n group.revertClone = originalGroup.revertClone;\n options.group = group;\n},\n _hideGhostForTarget = function _hideGhostForTarget() {\n if (!supportCssPointerEvents && ghostEl) {\n css(ghostEl, 'display', 'none');\n }\n},\n _unhideGhostForTarget = function _unhideGhostForTarget() {\n if (!supportCssPointerEvents && ghostEl) {\n css(ghostEl, 'display', '');\n }\n}; // #1184 fix - Prevent click event on fallback if dragged but item not changed position\n\n\nif (documentExists) {\n document.addEventListener('click', function (evt) {\n if (ignoreNextClick) {\n evt.preventDefault();\n evt.stopPropagation && evt.stopPropagation();\n evt.stopImmediatePropagation && evt.stopImmediatePropagation();\n ignoreNextClick = false;\n return false;\n }\n }, true);\n}\n\nvar nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent(evt) {\n if (dragEl) {\n evt = evt.touches ? evt.touches[0] : evt;\n\n var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY);\n\n if (nearest) {\n // Create imitation event\n var event = {};\n\n for (var i in evt) {\n if (evt.hasOwnProperty(i)) {\n event[i] = evt[i];\n }\n }\n\n event.target = event.rootEl = nearest;\n event.preventDefault = void 0;\n event.stopPropagation = void 0;\n\n nearest[expando]._onDragOver(event);\n }\n }\n};\n\nvar _checkOutsideTargetEl = function _checkOutsideTargetEl(evt) {\n if (dragEl) {\n dragEl.parentNode[expando]._isOutsideThisEl(evt.target);\n }\n};\n/**\n * @class Sortable\n * @param {HTMLElement} el\n * @param {Object} [options]\n */\n\n\nfunction Sortable(el, options) {\n if (!(el && el.nodeType && el.nodeType === 1)) {\n throw \"Sortable: `el` must be an HTMLElement, not \".concat({}.toString.call(el));\n }\n\n this.el = el; // root element\n\n this.options = options = _extends({}, options); // Export instance\n\n el[expando] = this;\n var defaults = {\n group: null,\n sort: true,\n disabled: false,\n store: null,\n handle: null,\n draggable: /^[uo]l$/i.test(el.nodeName) ? '>li' : '>*',\n swapThreshold: 1,\n // percentage; 0 <= x <= 1\n invertSwap: false,\n // invert always\n invertedSwapThreshold: null,\n // will be set to same as swapThreshold if default\n removeCloneOnHide: true,\n direction: function direction() {\n return _detectDirection(el, this.options);\n },\n ghostClass: 'sortable-ghost',\n chosenClass: 'sortable-chosen',\n dragClass: 'sortable-drag',\n ignore: 'a, img',\n filter: null,\n preventOnFilter: true,\n animation: 0,\n easing: null,\n setData: function setData(dataTransfer, dragEl) {\n dataTransfer.setData('Text', dragEl.textContent);\n },\n dropBubble: false,\n dragoverBubble: false,\n dataIdAttr: 'data-id',\n delay: 0,\n delayOnTouchOnly: false,\n touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1,\n forceFallback: false,\n fallbackClass: 'sortable-fallback',\n fallbackOnBody: false,\n fallbackTolerance: 0,\n fallbackOffset: {\n x: 0,\n y: 0\n },\n supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window && !Safari,\n emptyInsertThreshold: 5\n };\n PluginManager.initializePlugins(this, el, defaults); // Set default options\n\n for (var name in defaults) {\n !(name in options) && (options[name] = defaults[name]);\n }\n\n _prepareGroup(options); // Bind all private methods\n\n\n for (var fn in this) {\n if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {\n this[fn] = this[fn].bind(this);\n }\n } // Setup drag mode\n\n\n this.nativeDraggable = options.forceFallback ? false : supportDraggable;\n\n if (this.nativeDraggable) {\n // Touch start threshold cannot be greater than the native dragstart threshold\n this.options.touchStartThreshold = 1;\n } // Bind events\n\n\n if (options.supportPointer) {\n on(el, 'pointerdown', this._onTapStart);\n } else {\n on(el, 'mousedown', this._onTapStart);\n on(el, 'touchstart', this._onTapStart);\n }\n\n if (this.nativeDraggable) {\n on(el, 'dragover', this);\n on(el, 'dragenter', this);\n }\n\n sortables.push(this.el); // Restore sorting\n\n options.store && options.store.get && this.sort(options.store.get(this) || []); // Add animation state manager\n\n _extends(this, AnimationStateManager());\n}\n\nSortable.prototype =\n/** @lends Sortable.prototype */\n{\n constructor: Sortable,\n _isOutsideThisEl: function _isOutsideThisEl(target) {\n if (!this.el.contains(target) && target !== this.el) {\n lastTarget = null;\n }\n },\n _getDirection: function _getDirection(evt, target) {\n return typeof this.options.direction === 'function' ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction;\n },\n _onTapStart: function _onTapStart(\n /** Event|TouchEvent */\n evt) {\n if (!evt.cancelable) return;\n\n var _this = this,\n el = this.el,\n options = this.options,\n preventOnFilter = options.preventOnFilter,\n type = evt.type,\n touch = evt.touches && evt.touches[0] || evt.pointerType && evt.pointerType === 'touch' && evt,\n target = (touch || evt).target,\n originalTarget = evt.target.shadowRoot && (evt.path && evt.path[0] || evt.composedPath && evt.composedPath()[0]) || target,\n filter = options.filter;\n\n _saveInputCheckedState(el); // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.\n\n\n if (dragEl) {\n return;\n }\n\n if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {\n return; // only left button and enabled\n } // cancel dnd if original target is content editable\n\n\n if (originalTarget.isContentEditable) {\n return;\n } // Safari ignores further event handling after mousedown\n\n\n if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === 'SELECT') {\n return;\n }\n\n target = closest(target, options.draggable, el, false);\n\n if (target && target.animated) {\n return;\n }\n\n if (lastDownEl === target) {\n // Ignoring duplicate `down`\n return;\n } // Get the index of the dragged element within its parent\n\n\n oldIndex = index(target);\n oldDraggableIndex = index(target, options.draggable); // Check filter\n\n if (typeof filter === 'function') {\n if (filter.call(this, evt, target, this)) {\n _dispatchEvent({\n sortable: _this,\n rootEl: originalTarget,\n name: 'filter',\n targetEl: target,\n toEl: el,\n fromEl: el\n });\n\n pluginEvent('filter', _this, {\n evt: evt\n });\n preventOnFilter && evt.cancelable && evt.preventDefault();\n return; // cancel dnd\n }\n } else if (filter) {\n filter = filter.split(',').some(function (criteria) {\n criteria = closest(originalTarget, criteria.trim(), el, false);\n\n if (criteria) {\n _dispatchEvent({\n sortable: _this,\n rootEl: criteria,\n name: 'filter',\n targetEl: target,\n fromEl: el,\n toEl: el\n });\n\n pluginEvent('filter', _this, {\n evt: evt\n });\n return true;\n }\n });\n\n if (filter) {\n preventOnFilter && evt.cancelable && evt.preventDefault();\n return; // cancel dnd\n }\n }\n\n if (options.handle && !closest(originalTarget, options.handle, el, false)) {\n return;\n } // Prepare `dragstart`\n\n\n this._prepareDragStart(evt, touch, target);\n },\n _prepareDragStart: function _prepareDragStart(\n /** Event */\n evt,\n /** Touch */\n touch,\n /** HTMLElement */\n target) {\n var _this = this,\n el = _this.el,\n options = _this.options,\n ownerDocument = el.ownerDocument,\n dragStartFn;\n\n if (target && !dragEl && target.parentNode === el) {\n var dragRect = getRect(target);\n rootEl = el;\n dragEl = target;\n parentEl = dragEl.parentNode;\n nextEl = dragEl.nextSibling;\n lastDownEl = target;\n activeGroup = options.group;\n Sortable.dragged = dragEl;\n tapEvt = {\n target: dragEl,\n clientX: (touch || evt).clientX,\n clientY: (touch || evt).clientY\n };\n tapDistanceLeft = tapEvt.clientX - dragRect.left;\n tapDistanceTop = tapEvt.clientY - dragRect.top;\n this._lastX = (touch || evt).clientX;\n this._lastY = (touch || evt).clientY;\n dragEl.style['will-change'] = 'all';\n\n dragStartFn = function dragStartFn() {\n pluginEvent('delayEnded', _this, {\n evt: evt\n });\n\n if (Sortable.eventCanceled) {\n _this._onDrop();\n\n return;\n } // Delayed drag has been triggered\n // we can re-enable the events: touchmove/mousemove\n\n\n _this._disableDelayedDragEvents();\n\n if (!FireFox && _this.nativeDraggable) {\n dragEl.draggable = true;\n } // Bind the events: dragstart/dragend\n\n\n _this._triggerDragStart(evt, touch); // Drag start event\n\n\n _dispatchEvent({\n sortable: _this,\n name: 'choose',\n originalEvent: evt\n }); // Chosen item\n\n\n toggleClass(dragEl, options.chosenClass, true);\n }; // Disable \"draggable\"\n\n\n options.ignore.split(',').forEach(function (criteria) {\n find(dragEl, criteria.trim(), _disableDraggable);\n });\n on(ownerDocument, 'dragover', nearestEmptyInsertDetectEvent);\n on(ownerDocument, 'mousemove', nearestEmptyInsertDetectEvent);\n on(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent);\n on(ownerDocument, 'mouseup', _this._onDrop);\n on(ownerDocument, 'touchend', _this._onDrop);\n on(ownerDocument, 'touchcancel', _this._onDrop); // Make dragEl draggable (must be before delay for FireFox)\n\n if (FireFox && this.nativeDraggable) {\n this.options.touchStartThreshold = 4;\n dragEl.draggable = true;\n }\n\n pluginEvent('delayStart', this, {\n evt: evt\n }); // Delay is impossible for native DnD in Edge or IE\n\n if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) {\n if (Sortable.eventCanceled) {\n this._onDrop();\n\n return;\n } // If the user moves the pointer or let go the click or touch\n // before the delay has been reached:\n // disable the delayed drag\n\n\n on(ownerDocument, 'mouseup', _this._disableDelayedDrag);\n on(ownerDocument, 'touchend', _this._disableDelayedDrag);\n on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);\n on(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler);\n on(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler);\n options.supportPointer && on(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler);\n _this._dragStartTimer = setTimeout(dragStartFn, options.delay);\n } else {\n dragStartFn();\n }\n }\n },\n _delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler(\n /** TouchEvent|PointerEvent **/\n e) {\n var touch = e.touches ? e.touches[0] : e;\n\n if (Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1))) {\n this._disableDelayedDrag();\n }\n },\n _disableDelayedDrag: function _disableDelayedDrag() {\n dragEl && _disableDraggable(dragEl);\n clearTimeout(this._dragStartTimer);\n\n this._disableDelayedDragEvents();\n },\n _disableDelayedDragEvents: function _disableDelayedDragEvents() {\n var ownerDocument = this.el.ownerDocument;\n off(ownerDocument, 'mouseup', this._disableDelayedDrag);\n off(ownerDocument, 'touchend', this._disableDelayedDrag);\n off(ownerDocument, 'touchcancel', this._disableDelayedDrag);\n off(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler);\n off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler);\n off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler);\n },\n _triggerDragStart: function _triggerDragStart(\n /** Event */\n evt,\n /** Touch */\n touch) {\n touch = touch || evt.pointerType == 'touch' && evt;\n\n if (!this.nativeDraggable || touch) {\n if (this.options.supportPointer) {\n on(document, 'pointermove', this._onTouchMove);\n } else if (touch) {\n on(document, 'touchmove', this._onTouchMove);\n } else {\n on(document, 'mousemove', this._onTouchMove);\n }\n } else {\n on(dragEl, 'dragend', this);\n on(rootEl, 'dragstart', this._onDragStart);\n }\n\n try {\n if (document.selection) {\n // Timeout neccessary for IE9\n _nextTick(function () {\n document.selection.empty();\n });\n } else {\n window.getSelection().removeAllRanges();\n }\n } catch (err) {}\n },\n _dragStarted: function _dragStarted(fallback, evt) {\n\n awaitingDragStarted = false;\n\n if (rootEl && dragEl) {\n pluginEvent('dragStarted', this, {\n evt: evt\n });\n\n if (this.nativeDraggable) {\n on(document, 'dragover', _checkOutsideTargetEl);\n }\n\n var options = this.options; // Apply effect\n\n !fallback && toggleClass(dragEl, options.dragClass, false);\n toggleClass(dragEl, options.ghostClass, true);\n Sortable.active = this;\n fallback && this._appendGhost(); // Drag start event\n\n _dispatchEvent({\n sortable: this,\n name: 'start',\n originalEvent: evt\n });\n } else {\n this._nulling();\n }\n },\n _emulateDragOver: function _emulateDragOver() {\n if (touchEvt) {\n this._lastX = touchEvt.clientX;\n this._lastY = touchEvt.clientY;\n\n _hideGhostForTarget();\n\n var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY);\n var parent = target;\n\n while (target && target.shadowRoot) {\n target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY);\n if (target === parent) break;\n parent = target;\n }\n\n dragEl.parentNode[expando]._isOutsideThisEl(target);\n\n if (parent) {\n do {\n if (parent[expando]) {\n var inserted = void 0;\n inserted = parent[expando]._onDragOver({\n clientX: touchEvt.clientX,\n clientY: touchEvt.clientY,\n target: target,\n rootEl: parent\n });\n\n if (inserted && !this.options.dragoverBubble) {\n break;\n }\n }\n\n target = parent; // store last element\n }\n /* jshint boss:true */\n while (parent = parent.parentNode);\n }\n\n _unhideGhostForTarget();\n }\n },\n _onTouchMove: function _onTouchMove(\n /**TouchEvent*/\n evt) {\n if (tapEvt) {\n var options = this.options,\n fallbackTolerance = options.fallbackTolerance,\n fallbackOffset = options.fallbackOffset,\n touch = evt.touches ? evt.touches[0] : evt,\n ghostMatrix = ghostEl && matrix(ghostEl, true),\n scaleX = ghostEl && ghostMatrix && ghostMatrix.a,\n scaleY = ghostEl && ghostMatrix && ghostMatrix.d,\n relativeScrollOffset = PositionGhostAbsolutely && ghostRelativeParent && getRelativeScrollOffset(ghostRelativeParent),\n dx = (touch.clientX - tapEvt.clientX + fallbackOffset.x) / (scaleX || 1) + (relativeScrollOffset ? relativeScrollOffset[0] - ghostRelativeParentInitialScroll[0] : 0) / (scaleX || 1),\n dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1); // only set the status to dragging, when we are actually dragging\n\n if (!Sortable.active && !awaitingDragStarted) {\n if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) {\n return;\n }\n\n this._onDragStart(evt, true);\n }\n\n if (ghostEl) {\n if (ghostMatrix) {\n ghostMatrix.e += dx - (lastDx || 0);\n ghostMatrix.f += dy - (lastDy || 0);\n } else {\n ghostMatrix = {\n a: 1,\n b: 0,\n c: 0,\n d: 1,\n e: dx,\n f: dy\n };\n }\n\n var cssMatrix = \"matrix(\".concat(ghostMatrix.a, \",\").concat(ghostMatrix.b, \",\").concat(ghostMatrix.c, \",\").concat(ghostMatrix.d, \",\").concat(ghostMatrix.e, \",\").concat(ghostMatrix.f, \")\");\n css(ghostEl, 'webkitTransform', cssMatrix);\n css(ghostEl, 'mozTransform', cssMatrix);\n css(ghostEl, 'msTransform', cssMatrix);\n css(ghostEl, 'transform', cssMatrix);\n lastDx = dx;\n lastDy = dy;\n touchEvt = touch;\n }\n\n evt.cancelable && evt.preventDefault();\n }\n },\n _appendGhost: function _appendGhost() {\n // Bug if using scale(): https://stackoverflow.com/questions/2637058\n // Not being adjusted for\n if (!ghostEl) {\n var container = this.options.fallbackOnBody ? document.body : rootEl,\n rect = getRect(dragEl, true, PositionGhostAbsolutely, true, container),\n options = this.options; // Position absolutely\n\n if (PositionGhostAbsolutely) {\n // Get relatively positioned parent\n ghostRelativeParent = container;\n\n while (css(ghostRelativeParent, 'position') === 'static' && css(ghostRelativeParent, 'transform') === 'none' && ghostRelativeParent !== document) {\n ghostRelativeParent = ghostRelativeParent.parentNode;\n }\n\n if (ghostRelativeParent !== document.body && ghostRelativeParent !== document.documentElement) {\n if (ghostRelativeParent === document) ghostRelativeParent = getWindowScrollingElement();\n rect.top += ghostRelativeParent.scrollTop;\n rect.left += ghostRelativeParent.scrollLeft;\n } else {\n ghostRelativeParent = getWindowScrollingElement();\n }\n\n ghostRelativeParentInitialScroll = getRelativeScrollOffset(ghostRelativeParent);\n }\n\n ghostEl = dragEl.cloneNode(true);\n toggleClass(ghostEl, options.ghostClass, false);\n toggleClass(ghostEl, options.fallbackClass, true);\n toggleClass(ghostEl, options.dragClass, true);\n css(ghostEl, 'transition', '');\n css(ghostEl, 'transform', '');\n css(ghostEl, 'box-sizing', 'border-box');\n css(ghostEl, 'margin', 0);\n css(ghostEl, 'top', rect.top);\n css(ghostEl, 'left', rect.left);\n css(ghostEl, 'width', rect.width);\n css(ghostEl, 'height', rect.height);\n css(ghostEl, 'opacity', '0.8');\n css(ghostEl, 'position', PositionGhostAbsolutely ? 'absolute' : 'fixed');\n css(ghostEl, 'zIndex', '100000');\n css(ghostEl, 'pointerEvents', 'none');\n Sortable.ghost = ghostEl;\n container.appendChild(ghostEl); // Set transform-origin\n\n css(ghostEl, 'transform-origin', tapDistanceLeft / parseInt(ghostEl.style.width) * 100 + '% ' + tapDistanceTop / parseInt(ghostEl.style.height) * 100 + '%');\n }\n },\n _onDragStart: function _onDragStart(\n /**Event*/\n evt,\n /**boolean*/\n fallback) {\n var _this = this;\n\n var dataTransfer = evt.dataTransfer;\n var options = _this.options;\n pluginEvent('dragStart', this, {\n evt: evt\n });\n\n if (Sortable.eventCanceled) {\n this._onDrop();\n\n return;\n }\n\n pluginEvent('setupClone', this);\n\n if (!Sortable.eventCanceled) {\n cloneEl = clone(dragEl);\n cloneEl.draggable = false;\n cloneEl.style['will-change'] = '';\n\n this._hideClone();\n\n toggleClass(cloneEl, this.options.chosenClass, false);\n Sortable.clone = cloneEl;\n } // #1143: IFrame support workaround\n\n\n _this.cloneId = _nextTick(function () {\n pluginEvent('clone', _this);\n if (Sortable.eventCanceled) return;\n\n if (!_this.options.removeCloneOnHide) {\n rootEl.insertBefore(cloneEl, dragEl);\n }\n\n _this._hideClone();\n\n _dispatchEvent({\n sortable: _this,\n name: 'clone'\n });\n });\n !fallback && toggleClass(dragEl, options.dragClass, true); // Set proper drop events\n\n if (fallback) {\n ignoreNextClick = true;\n _this._loopId = setInterval(_this._emulateDragOver, 50);\n } else {\n // Undo what was set in _prepareDragStart before drag started\n off(document, 'mouseup', _this._onDrop);\n off(document, 'touchend', _this._onDrop);\n off(document, 'touchcancel', _this._onDrop);\n\n if (dataTransfer) {\n dataTransfer.effectAllowed = 'move';\n options.setData && options.setData.call(_this, dataTransfer, dragEl);\n }\n\n on(document, 'drop', _this); // #1276 fix:\n\n css(dragEl, 'transform', 'translateZ(0)');\n }\n\n awaitingDragStarted = true;\n _this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt));\n on(document, 'selectstart', _this);\n moved = true;\n\n if (Safari) {\n css(document.body, 'user-select', 'none');\n }\n },\n // Returns true - if no further action is needed (either inserted or another condition)\n _onDragOver: function _onDragOver(\n /**Event*/\n evt) {\n var el = this.el,\n target = evt.target,\n dragRect,\n targetRect,\n revert,\n options = this.options,\n group = options.group,\n activeSortable = Sortable.active,\n isOwner = activeGroup === group,\n canSort = options.sort,\n fromSortable = putSortable || activeSortable,\n vertical,\n _this = this,\n completedFired = false;\n\n if (_silent) return;\n\n function dragOverEvent(name, extra) {\n pluginEvent(name, _this, _objectSpread2({\n evt: evt,\n isOwner: isOwner,\n axis: vertical ? 'vertical' : 'horizontal',\n revert: revert,\n dragRect: dragRect,\n targetRect: targetRect,\n canSort: canSort,\n fromSortable: fromSortable,\n target: target,\n completed: completed,\n onMove: function onMove(target, after) {\n return _onMove(rootEl, el, dragEl, dragRect, target, getRect(target), evt, after);\n },\n changed: changed\n }, extra));\n } // Capture animation state\n\n\n function capture() {\n dragOverEvent('dragOverAnimationCapture');\n\n _this.captureAnimationState();\n\n if (_this !== fromSortable) {\n fromSortable.captureAnimationState();\n }\n } // Return invocation when dragEl is inserted (or completed)\n\n\n function completed(insertion) {\n dragOverEvent('dragOverCompleted', {\n insertion: insertion\n });\n\n if (insertion) {\n // Clones must be hidden before folding animation to capture dragRectAbsolute properly\n if (isOwner) {\n activeSortable._hideClone();\n } else {\n activeSortable._showClone(_this);\n }\n\n if (_this !== fromSortable) {\n // Set ghost class to new sortable's ghost class\n toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : activeSortable.options.ghostClass, false);\n toggleClass(dragEl, options.ghostClass, true);\n }\n\n if (putSortable !== _this && _this !== Sortable.active) {\n putSortable = _this;\n } else if (_this === Sortable.active && putSortable) {\n putSortable = null;\n } // Animation\n\n\n if (fromSortable === _this) {\n _this._ignoreWhileAnimating = target;\n }\n\n _this.animateAll(function () {\n dragOverEvent('dragOverAnimationComplete');\n _this._ignoreWhileAnimating = null;\n });\n\n if (_this !== fromSortable) {\n fromSortable.animateAll();\n fromSortable._ignoreWhileAnimating = null;\n }\n } // Null lastTarget if it is not inside a previously swapped element\n\n\n if (target === dragEl && !dragEl.animated || target === el && !target.animated) {\n lastTarget = null;\n } // no bubbling and not fallback\n\n\n if (!options.dragoverBubble && !evt.rootEl && target !== document) {\n dragEl.parentNode[expando]._isOutsideThisEl(evt.target); // Do not detect for empty insert if already inserted\n\n\n !insertion && nearestEmptyInsertDetectEvent(evt);\n }\n\n !options.dragoverBubble && evt.stopPropagation && evt.stopPropagation();\n return completedFired = true;\n } // Call when dragEl has been inserted\n\n\n function changed() {\n newIndex = index(dragEl);\n newDraggableIndex = index(dragEl, options.draggable);\n\n _dispatchEvent({\n sortable: _this,\n name: 'change',\n toEl: el,\n newIndex: newIndex,\n newDraggableIndex: newDraggableIndex,\n originalEvent: evt\n });\n }\n\n if (evt.preventDefault !== void 0) {\n evt.cancelable && evt.preventDefault();\n }\n\n target = closest(target, options.draggable, el, true);\n dragOverEvent('dragOver');\n if (Sortable.eventCanceled) return completedFired;\n\n if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) {\n return completed(false);\n }\n\n ignoreNextClick = false;\n\n if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = parentEl !== rootEl) // Reverting item into the original list\n : putSortable === this || (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt))) {\n vertical = this._getDirection(evt, target) === 'vertical';\n dragRect = getRect(dragEl);\n dragOverEvent('dragOverValid');\n if (Sortable.eventCanceled) return completedFired;\n\n if (revert) {\n parentEl = rootEl; // actualization\n\n capture();\n\n this._hideClone();\n\n dragOverEvent('revert');\n\n if (!Sortable.eventCanceled) {\n if (nextEl) {\n rootEl.insertBefore(dragEl, nextEl);\n } else {\n rootEl.appendChild(dragEl);\n }\n }\n\n return completed(true);\n }\n\n var elLastChild = lastChild(el, options.draggable);\n\n if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) {\n // Insert to end of list\n // If already at end of list: Do not insert\n if (elLastChild === dragEl) {\n return completed(false);\n } // if there is a last element, it is the target\n\n\n if (elLastChild && el === evt.target) {\n target = elLastChild;\n }\n\n if (target) {\n targetRect = getRect(target);\n }\n\n if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {\n capture();\n el.appendChild(dragEl);\n parentEl = el; // actualization\n\n changed();\n return completed(true);\n }\n } else if (elLastChild && _ghostIsFirst(evt, vertical, this)) {\n // Insert to start of list\n var firstChild = getChild(el, 0, options, true);\n\n if (firstChild === dragEl) {\n return completed(false);\n }\n\n target = firstChild;\n targetRect = getRect(target);\n\n if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, false) !== false) {\n capture();\n el.insertBefore(dragEl, firstChild);\n parentEl = el; // actualization\n\n changed();\n return completed(true);\n }\n } else if (target.parentNode === el) {\n targetRect = getRect(target);\n var direction = 0,\n targetBeforeFirstSwap,\n differentLevel = dragEl.parentNode !== el,\n differentRowCol = !_dragElInRowColumn(dragEl.animated && dragEl.toRect || dragRect, target.animated && target.toRect || targetRect, vertical),\n side1 = vertical ? 'top' : 'left',\n scrolledPastTop = isScrolledPast(target, 'top', 'top') || isScrolledPast(dragEl, 'top', 'top'),\n scrollBefore = scrolledPastTop ? scrolledPastTop.scrollTop : void 0;\n\n if (lastTarget !== target) {\n targetBeforeFirstSwap = targetRect[side1];\n pastFirstInvertThresh = false;\n isCircumstantialInvert = !differentRowCol && options.invertSwap || differentLevel;\n }\n\n direction = _getSwapDirection(evt, target, targetRect, vertical, differentRowCol ? 1 : options.swapThreshold, options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold, isCircumstantialInvert, lastTarget === target);\n var sibling;\n\n if (direction !== 0) {\n // Check if target is beside dragEl in respective direction (ignoring hidden elements)\n var dragIndex = index(dragEl);\n\n do {\n dragIndex -= direction;\n sibling = parentEl.children[dragIndex];\n } while (sibling && (css(sibling, 'display') === 'none' || sibling === ghostEl));\n } // If dragEl is already beside target: Do not insert\n\n\n if (direction === 0 || sibling === target) {\n return completed(false);\n }\n\n lastTarget = target;\n lastDirection = direction;\n var nextSibling = target.nextElementSibling,\n after = false;\n after = direction === 1;\n\n var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);\n\n if (moveVector !== false) {\n if (moveVector === 1 || moveVector === -1) {\n after = moveVector === 1;\n }\n\n _silent = true;\n setTimeout(_unsilent, 30);\n capture();\n\n if (after && !nextSibling) {\n el.appendChild(dragEl);\n } else {\n target.parentNode.insertBefore(dragEl, after ? nextSibling : target);\n } // Undo chrome's scroll adjustment (has no effect on other browsers)\n\n\n if (scrolledPastTop) {\n scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop);\n }\n\n parentEl = dragEl.parentNode; // actualization\n // must be done before animation\n\n if (targetBeforeFirstSwap !== undefined && !isCircumstantialInvert) {\n targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect(target)[side1]);\n }\n\n changed();\n return completed(true);\n }\n }\n\n if (el.contains(dragEl)) {\n return completed(false);\n }\n }\n\n return false;\n },\n _ignoreWhileAnimating: null,\n _offMoveEvents: function _offMoveEvents() {\n off(document, 'mousemove', this._onTouchMove);\n off(document, 'touchmove', this._onTouchMove);\n off(document, 'pointermove', this._onTouchMove);\n off(document, 'dragover', nearestEmptyInsertDetectEvent);\n off(document, 'mousemove', nearestEmptyInsertDetectEvent);\n off(document, 'touchmove', nearestEmptyInsertDetectEvent);\n },\n _offUpEvents: function _offUpEvents() {\n var ownerDocument = this.el.ownerDocument;\n off(ownerDocument, 'mouseup', this._onDrop);\n off(ownerDocument, 'touchend', this._onDrop);\n off(ownerDocument, 'pointerup', this._onDrop);\n off(ownerDocument, 'touchcancel', this._onDrop);\n off(document, 'selectstart', this);\n },\n _onDrop: function _onDrop(\n /**Event*/\n evt) {\n var el = this.el,\n options = this.options; // Get the index of the dragged element within its parent\n\n newIndex = index(dragEl);\n newDraggableIndex = index(dragEl, options.draggable);\n pluginEvent('drop', this, {\n evt: evt\n });\n parentEl = dragEl && dragEl.parentNode; // Get again after plugin event\n\n newIndex = index(dragEl);\n newDraggableIndex = index(dragEl, options.draggable);\n\n if (Sortable.eventCanceled) {\n this._nulling();\n\n return;\n }\n\n awaitingDragStarted = false;\n isCircumstantialInvert = false;\n pastFirstInvertThresh = false;\n clearInterval(this._loopId);\n clearTimeout(this._dragStartTimer);\n\n _cancelNextTick(this.cloneId);\n\n _cancelNextTick(this._dragStartId); // Unbind events\n\n\n if (this.nativeDraggable) {\n off(document, 'drop', this);\n off(el, 'dragstart', this._onDragStart);\n }\n\n this._offMoveEvents();\n\n this._offUpEvents();\n\n if (Safari) {\n css(document.body, 'user-select', '');\n }\n\n css(dragEl, 'transform', '');\n\n if (evt) {\n if (moved) {\n evt.cancelable && evt.preventDefault();\n !options.dropBubble && evt.stopPropagation();\n }\n\n ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);\n\n if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') {\n // Remove clone(s)\n cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);\n }\n\n if (dragEl) {\n if (this.nativeDraggable) {\n off(dragEl, 'dragend', this);\n }\n\n _disableDraggable(dragEl);\n\n dragEl.style['will-change'] = ''; // Remove classes\n // ghostClass is added in dragStarted\n\n if (moved && !awaitingDragStarted) {\n toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : this.options.ghostClass, false);\n }\n\n toggleClass(dragEl, this.options.chosenClass, false); // Drag stop event\n\n _dispatchEvent({\n sortable: this,\n name: 'unchoose',\n toEl: parentEl,\n newIndex: null,\n newDraggableIndex: null,\n originalEvent: evt\n });\n\n if (rootEl !== parentEl) {\n if (newIndex >= 0) {\n // Add event\n _dispatchEvent({\n rootEl: parentEl,\n name: 'add',\n toEl: parentEl,\n fromEl: rootEl,\n originalEvent: evt\n }); // Remove event\n\n\n _dispatchEvent({\n sortable: this,\n name: 'remove',\n toEl: parentEl,\n originalEvent: evt\n }); // drag from one list and drop into another\n\n\n _dispatchEvent({\n rootEl: parentEl,\n name: 'sort',\n toEl: parentEl,\n fromEl: rootEl,\n originalEvent: evt\n });\n\n _dispatchEvent({\n sortable: this,\n name: 'sort',\n toEl: parentEl,\n originalEvent: evt\n });\n }\n\n putSortable && putSortable.save();\n } else {\n if (newIndex !== oldIndex) {\n if (newIndex >= 0) {\n // drag & drop within the same list\n _dispatchEvent({\n sortable: this,\n name: 'update',\n toEl: parentEl,\n originalEvent: evt\n });\n\n _dispatchEvent({\n sortable: this,\n name: 'sort',\n toEl: parentEl,\n originalEvent: evt\n });\n }\n }\n }\n\n if (Sortable.active) {\n /* jshint eqnull:true */\n if (newIndex == null || newIndex === -1) {\n newIndex = oldIndex;\n newDraggableIndex = oldDraggableIndex;\n }\n\n _dispatchEvent({\n sortable: this,\n name: 'end',\n toEl: parentEl,\n originalEvent: evt\n }); // Save sorting\n\n\n this.save();\n }\n }\n }\n\n this._nulling();\n },\n _nulling: function _nulling() {\n pluginEvent('nulling', this);\n rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = cloneHidden = tapEvt = touchEvt = moved = newIndex = newDraggableIndex = oldIndex = oldDraggableIndex = lastTarget = lastDirection = putSortable = activeGroup = Sortable.dragged = Sortable.ghost = Sortable.clone = Sortable.active = null;\n savedInputChecked.forEach(function (el) {\n el.checked = true;\n });\n savedInputChecked.length = lastDx = lastDy = 0;\n },\n handleEvent: function handleEvent(\n /**Event*/\n evt) {\n switch (evt.type) {\n case 'drop':\n case 'dragend':\n this._onDrop(evt);\n\n break;\n\n case 'dragenter':\n case 'dragover':\n if (dragEl) {\n this._onDragOver(evt);\n\n _globalDragOver(evt);\n }\n\n break;\n\n case 'selectstart':\n evt.preventDefault();\n break;\n }\n },\n\n /**\n * Serializes the item into an array of string.\n * @returns {String[]}\n */\n toArray: function toArray() {\n var order = [],\n el,\n children = this.el.children,\n i = 0,\n n = children.length,\n options = this.options;\n\n for (; i < n; i++) {\n el = children[i];\n\n if (closest(el, options.draggable, this.el, false)) {\n order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));\n }\n }\n\n return order;\n },\n\n /**\n * Sorts the elements according to the array.\n * @param {String[]} order order of the items\n */\n sort: function sort(order, useAnimation) {\n var items = {},\n rootEl = this.el;\n this.toArray().forEach(function (id, i) {\n var el = rootEl.children[i];\n\n if (closest(el, this.options.draggable, rootEl, false)) {\n items[id] = el;\n }\n }, this);\n useAnimation && this.captureAnimationState();\n order.forEach(function (id) {\n if (items[id]) {\n rootEl.removeChild(items[id]);\n rootEl.appendChild(items[id]);\n }\n });\n useAnimation && this.animateAll();\n },\n\n /**\n * Save the current sorting\n */\n save: function save() {\n var store = this.options.store;\n store && store.set && store.set(this);\n },\n\n /**\n * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.\n * @param {HTMLElement} el\n * @param {String} [selector] default: `options.draggable`\n * @returns {HTMLElement|null}\n */\n closest: function closest$1(el, selector) {\n return closest(el, selector || this.options.draggable, this.el, false);\n },\n\n /**\n * Set/get option\n * @param {string} name\n * @param {*} [value]\n * @returns {*}\n */\n option: function option(name, value) {\n var options = this.options;\n\n if (value === void 0) {\n return options[name];\n } else {\n var modifiedValue = PluginManager.modifyOption(this, name, value);\n\n if (typeof modifiedValue !== 'undefined') {\n options[name] = modifiedValue;\n } else {\n options[name] = value;\n }\n\n if (name === 'group') {\n _prepareGroup(options);\n }\n }\n },\n\n /**\n * Destroy\n */\n destroy: function destroy() {\n pluginEvent('destroy', this);\n var el = this.el;\n el[expando] = null;\n off(el, 'mousedown', this._onTapStart);\n off(el, 'touchstart', this._onTapStart);\n off(el, 'pointerdown', this._onTapStart);\n\n if (this.nativeDraggable) {\n off(el, 'dragover', this);\n off(el, 'dragenter', this);\n } // Remove draggable attributes\n\n\n Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {\n el.removeAttribute('draggable');\n });\n\n this._onDrop();\n\n this._disableDelayedDragEvents();\n\n sortables.splice(sortables.indexOf(this.el), 1);\n this.el = el = null;\n },\n _hideClone: function _hideClone() {\n if (!cloneHidden) {\n pluginEvent('hideClone', this);\n if (Sortable.eventCanceled) return;\n css(cloneEl, 'display', 'none');\n\n if (this.options.removeCloneOnHide && cloneEl.parentNode) {\n cloneEl.parentNode.removeChild(cloneEl);\n }\n\n cloneHidden = true;\n }\n },\n _showClone: function _showClone(putSortable) {\n if (putSortable.lastPutMode !== 'clone') {\n this._hideClone();\n\n return;\n }\n\n if (cloneHidden) {\n pluginEvent('showClone', this);\n if (Sortable.eventCanceled) return; // show clone at dragEl or original position\n\n if (dragEl.parentNode == rootEl && !this.options.group.revertClone) {\n rootEl.insertBefore(cloneEl, dragEl);\n } else if (nextEl) {\n rootEl.insertBefore(cloneEl, nextEl);\n } else {\n rootEl.appendChild(cloneEl);\n }\n\n if (this.options.group.revertClone) {\n this.animate(dragEl, cloneEl);\n }\n\n css(cloneEl, 'display', '');\n cloneHidden = false;\n }\n }\n};\n\nfunction _globalDragOver(\n/**Event*/\nevt) {\n if (evt.dataTransfer) {\n evt.dataTransfer.dropEffect = 'move';\n }\n\n evt.cancelable && evt.preventDefault();\n}\n\nfunction _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) {\n var evt,\n sortable = fromEl[expando],\n onMoveFn = sortable.options.onMove,\n retVal; // Support for new CustomEvent feature\n\n if (window.CustomEvent && !IE11OrLess && !Edge) {\n evt = new CustomEvent('move', {\n bubbles: true,\n cancelable: true\n });\n } else {\n evt = document.createEvent('Event');\n evt.initEvent('move', true, true);\n }\n\n evt.to = toEl;\n evt.from = fromEl;\n evt.dragged = dragEl;\n evt.draggedRect = dragRect;\n evt.related = targetEl || toEl;\n evt.relatedRect = targetRect || getRect(toEl);\n evt.willInsertAfter = willInsertAfter;\n evt.originalEvent = originalEvent;\n fromEl.dispatchEvent(evt);\n\n if (onMoveFn) {\n retVal = onMoveFn.call(sortable, evt, originalEvent);\n }\n\n return retVal;\n}\n\nfunction _disableDraggable(el) {\n el.draggable = false;\n}\n\nfunction _unsilent() {\n _silent = false;\n}\n\nfunction _ghostIsFirst(evt, vertical, sortable) {\n var rect = getRect(getChild(sortable.el, 0, sortable.options, true));\n var spacer = 10;\n return vertical ? evt.clientX < rect.left - spacer || evt.clientY < rect.top && evt.clientX < rect.right : evt.clientY < rect.top - spacer || evt.clientY < rect.bottom && evt.clientX < rect.left;\n}\n\nfunction _ghostIsLast(evt, vertical, sortable) {\n var rect = getRect(lastChild(sortable.el, sortable.options.draggable));\n var spacer = 10;\n return vertical ? evt.clientX > rect.right + spacer || evt.clientX <= rect.right && evt.clientY > rect.bottom && evt.clientX >= rect.left : evt.clientX > rect.right && evt.clientY > rect.top || evt.clientX <= rect.right && evt.clientY > rect.bottom + spacer;\n}\n\nfunction _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {\n var mouseOnAxis = vertical ? evt.clientY : evt.clientX,\n targetLength = vertical ? targetRect.height : targetRect.width,\n targetS1 = vertical ? targetRect.top : targetRect.left,\n targetS2 = vertical ? targetRect.bottom : targetRect.right,\n invert = false;\n\n if (!invertSwap) {\n // Never invert or create dragEl shadow when target movemenet causes mouse to move past the end of regular swapThreshold\n if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) {\n // multiplied only by swapThreshold because mouse will already be inside target by (1 - threshold) * targetLength / 2\n // check if past first invert threshold on side opposite of lastDirection\n if (!pastFirstInvertThresh && (lastDirection === 1 ? mouseOnAxis > targetS1 + targetLength * invertedSwapThreshold / 2 : mouseOnAxis < targetS2 - targetLength * invertedSwapThreshold / 2)) {\n // past first invert threshold, do not restrict inverted threshold to dragEl shadow\n pastFirstInvertThresh = true;\n }\n\n if (!pastFirstInvertThresh) {\n // dragEl shadow (target move distance shadow)\n if (lastDirection === 1 ? mouseOnAxis < targetS1 + targetMoveDistance // over dragEl shadow\n : mouseOnAxis > targetS2 - targetMoveDistance) {\n return -lastDirection;\n }\n } else {\n invert = true;\n }\n } else {\n // Regular\n if (mouseOnAxis > targetS1 + targetLength * (1 - swapThreshold) / 2 && mouseOnAxis < targetS2 - targetLength * (1 - swapThreshold) / 2) {\n return _getInsertDirection(target);\n }\n }\n }\n\n invert = invert || invertSwap;\n\n if (invert) {\n // Invert of regular\n if (mouseOnAxis < targetS1 + targetLength * invertedSwapThreshold / 2 || mouseOnAxis > targetS2 - targetLength * invertedSwapThreshold / 2) {\n return mouseOnAxis > targetS1 + targetLength / 2 ? 1 : -1;\n }\n }\n\n return 0;\n}\n/**\n * Gets the direction dragEl must be swapped relative to target in order to make it\n * seem that dragEl has been \"inserted\" into that element's position\n * @param {HTMLElement} target The target whose position dragEl is being inserted at\n * @return {Number} Direction dragEl must be swapped\n */\n\n\nfunction _getInsertDirection(target) {\n if (index(dragEl) < index(target)) {\n return 1;\n } else {\n return -1;\n }\n}\n/**\n * Generate id\n * @param {HTMLElement} el\n * @returns {String}\n * @private\n */\n\n\nfunction _generateId(el) {\n var str = el.tagName + el.className + el.src + el.href + el.textContent,\n i = str.length,\n sum = 0;\n\n while (i--) {\n sum += str.charCodeAt(i);\n }\n\n return sum.toString(36);\n}\n\nfunction _saveInputCheckedState(root) {\n savedInputChecked.length = 0;\n var inputs = root.getElementsByTagName('input');\n var idx = inputs.length;\n\n while (idx--) {\n var el = inputs[idx];\n el.checked && savedInputChecked.push(el);\n }\n}\n\nfunction _nextTick(fn) {\n return setTimeout(fn, 0);\n}\n\nfunction _cancelNextTick(id) {\n return clearTimeout(id);\n} // Fixed #973:\n\n\nif (documentExists) {\n on(document, 'touchmove', function (evt) {\n if ((Sortable.active || awaitingDragStarted) && evt.cancelable) {\n evt.preventDefault();\n }\n });\n} // Export utils\n\n\nSortable.utils = {\n on: on,\n off: off,\n css: css,\n find: find,\n is: function is(el, selector) {\n return !!closest(el, selector, el, false);\n },\n extend: extend,\n throttle: throttle,\n closest: closest,\n toggleClass: toggleClass,\n clone: clone,\n index: index,\n nextTick: _nextTick,\n cancelNextTick: _cancelNextTick,\n detectDirection: _detectDirection,\n getChild: getChild\n};\n/**\n * Get the Sortable instance of an element\n * @param {HTMLElement} element The element\n * @return {Sortable|undefined} The instance of Sortable\n */\n\nSortable.get = function (element) {\n return element[expando];\n};\n/**\n * Mount a plugin to Sortable\n * @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted\n */\n\n\nSortable.mount = function () {\n for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) {\n plugins[_key] = arguments[_key];\n }\n\n if (plugins[0].constructor === Array) plugins = plugins[0];\n plugins.forEach(function (plugin) {\n if (!plugin.prototype || !plugin.prototype.constructor) {\n throw \"Sortable: Mounted plugin must be a constructor function, not \".concat({}.toString.call(plugin));\n }\n\n if (plugin.utils) Sortable.utils = _objectSpread2(_objectSpread2({}, Sortable.utils), plugin.utils);\n PluginManager.mount(plugin);\n });\n};\n/**\n * Create sortable instance\n * @param {HTMLElement} el\n * @param {Object} [options]\n */\n\n\nSortable.create = function (el, options) {\n return new Sortable(el, options);\n}; // Export\n\n\nSortable.version = version;\n\nvar autoScrolls = [],\n scrollEl,\n scrollRootEl,\n scrolling = false,\n lastAutoScrollX,\n lastAutoScrollY,\n touchEvt$1,\n pointerElemChangedInterval;\n\nfunction AutoScrollPlugin() {\n function AutoScroll() {\n this.defaults = {\n scroll: true,\n forceAutoScrollFallback: false,\n scrollSensitivity: 30,\n scrollSpeed: 10,\n bubbleScroll: true\n }; // Bind all private methods\n\n for (var fn in this) {\n if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {\n this[fn] = this[fn].bind(this);\n }\n }\n }\n\n AutoScroll.prototype = {\n dragStarted: function dragStarted(_ref) {\n var originalEvent = _ref.originalEvent;\n\n if (this.sortable.nativeDraggable) {\n on(document, 'dragover', this._handleAutoScroll);\n } else {\n if (this.options.supportPointer) {\n on(document, 'pointermove', this._handleFallbackAutoScroll);\n } else if (originalEvent.touches) {\n on(document, 'touchmove', this._handleFallbackAutoScroll);\n } else {\n on(document, 'mousemove', this._handleFallbackAutoScroll);\n }\n }\n },\n dragOverCompleted: function dragOverCompleted(_ref2) {\n var originalEvent = _ref2.originalEvent;\n\n // For when bubbling is canceled and using fallback (fallback 'touchmove' always reached)\n if (!this.options.dragOverBubble && !originalEvent.rootEl) {\n this._handleAutoScroll(originalEvent);\n }\n },\n drop: function drop() {\n if (this.sortable.nativeDraggable) {\n off(document, 'dragover', this._handleAutoScroll);\n } else {\n off(document, 'pointermove', this._handleFallbackAutoScroll);\n off(document, 'touchmove', this._handleFallbackAutoScroll);\n off(document, 'mousemove', this._handleFallbackAutoScroll);\n }\n\n clearPointerElemChangedInterval();\n clearAutoScrolls();\n cancelThrottle();\n },\n nulling: function nulling() {\n touchEvt$1 = scrollRootEl = scrollEl = scrolling = pointerElemChangedInterval = lastAutoScrollX = lastAutoScrollY = null;\n autoScrolls.length = 0;\n },\n _handleFallbackAutoScroll: function _handleFallbackAutoScroll(evt) {\n this._handleAutoScroll(evt, true);\n },\n _handleAutoScroll: function _handleAutoScroll(evt, fallback) {\n var _this = this;\n\n var x = (evt.touches ? evt.touches[0] : evt).clientX,\n y = (evt.touches ? evt.touches[0] : evt).clientY,\n elem = document.elementFromPoint(x, y);\n touchEvt$1 = evt; // IE does not seem to have native autoscroll,\n // Edge's autoscroll seems too conditional,\n // MACOS Safari does not have autoscroll,\n // Firefox and Chrome are good\n\n if (fallback || this.options.forceAutoScrollFallback || Edge || IE11OrLess || Safari) {\n autoScroll(evt, this.options, elem, fallback); // Listener for pointer element change\n\n var ogElemScroller = getParentAutoScrollElement(elem, true);\n\n if (scrolling && (!pointerElemChangedInterval || x !== lastAutoScrollX || y !== lastAutoScrollY)) {\n pointerElemChangedInterval && clearPointerElemChangedInterval(); // Detect for pointer elem change, emulating native DnD behaviour\n\n pointerElemChangedInterval = setInterval(function () {\n var newElem = getParentAutoScrollElement(document.elementFromPoint(x, y), true);\n\n if (newElem !== ogElemScroller) {\n ogElemScroller = newElem;\n clearAutoScrolls();\n }\n\n autoScroll(evt, _this.options, newElem, fallback);\n }, 10);\n lastAutoScrollX = x;\n lastAutoScrollY = y;\n }\n } else {\n // if DnD is enabled (and browser has good autoscrolling), first autoscroll will already scroll, so get parent autoscroll of first autoscroll\n if (!this.options.bubbleScroll || getParentAutoScrollElement(elem, true) === getWindowScrollingElement()) {\n clearAutoScrolls();\n return;\n }\n\n autoScroll(evt, this.options, getParentAutoScrollElement(elem, false), false);\n }\n }\n };\n return _extends(AutoScroll, {\n pluginName: 'scroll',\n initializeByDefault: true\n });\n}\n\nfunction clearAutoScrolls() {\n autoScrolls.forEach(function (autoScroll) {\n clearInterval(autoScroll.pid);\n });\n autoScrolls = [];\n}\n\nfunction clearPointerElemChangedInterval() {\n clearInterval(pointerElemChangedInterval);\n}\n\nvar autoScroll = throttle(function (evt, options, rootEl, isFallback) {\n // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521\n if (!options.scroll) return;\n var x = (evt.touches ? evt.touches[0] : evt).clientX,\n y = (evt.touches ? evt.touches[0] : evt).clientY,\n sens = options.scrollSensitivity,\n speed = options.scrollSpeed,\n winScroller = getWindowScrollingElement();\n var scrollThisInstance = false,\n scrollCustomFn; // New scroll root, set scrollEl\n\n if (scrollRootEl !== rootEl) {\n scrollRootEl = rootEl;\n clearAutoScrolls();\n scrollEl = options.scroll;\n scrollCustomFn = options.scrollFn;\n\n if (scrollEl === true) {\n scrollEl = getParentAutoScrollElement(rootEl, true);\n }\n }\n\n var layersOut = 0;\n var currentParent = scrollEl;\n\n do {\n var el = currentParent,\n rect = getRect(el),\n top = rect.top,\n bottom = rect.bottom,\n left = rect.left,\n right = rect.right,\n width = rect.width,\n height = rect.height,\n canScrollX = void 0,\n canScrollY = void 0,\n scrollWidth = el.scrollWidth,\n scrollHeight = el.scrollHeight,\n elCSS = css(el),\n scrollPosX = el.scrollLeft,\n scrollPosY = el.scrollTop;\n\n if (el === winScroller) {\n canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll' || elCSS.overflowX === 'visible');\n canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll' || elCSS.overflowY === 'visible');\n } else {\n canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll');\n canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll');\n }\n\n var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX);\n var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY);\n\n if (!autoScrolls[layersOut]) {\n for (var i = 0; i <= layersOut; i++) {\n if (!autoScrolls[i]) {\n autoScrolls[i] = {};\n }\n }\n }\n\n if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) {\n autoScrolls[layersOut].el = el;\n autoScrolls[layersOut].vx = vx;\n autoScrolls[layersOut].vy = vy;\n clearInterval(autoScrolls[layersOut].pid);\n\n if (vx != 0 || vy != 0) {\n scrollThisInstance = true;\n /* jshint loopfunc:true */\n\n autoScrolls[layersOut].pid = setInterval(function () {\n // emulate drag over during autoscroll (fallback), emulating native DnD behaviour\n if (isFallback && this.layer === 0) {\n Sortable.active._onTouchMove(touchEvt$1); // To move ghost if it is positioned absolutely\n\n }\n\n var scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0;\n var scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0;\n\n if (typeof scrollCustomFn === 'function') {\n if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt$1, autoScrolls[this.layer].el) !== 'continue') {\n return;\n }\n }\n\n scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY);\n }.bind({\n layer: layersOut\n }), 24);\n }\n }\n\n layersOut++;\n } while (options.bubbleScroll && currentParent !== winScroller && (currentParent = getParentAutoScrollElement(currentParent, false)));\n\n scrolling = scrollThisInstance; // in case another function catches scrolling as false in between when it is not\n}, 30);\n\nvar drop = function drop(_ref) {\n var originalEvent = _ref.originalEvent,\n putSortable = _ref.putSortable,\n dragEl = _ref.dragEl,\n activeSortable = _ref.activeSortable,\n dispatchSortableEvent = _ref.dispatchSortableEvent,\n hideGhostForTarget = _ref.hideGhostForTarget,\n unhideGhostForTarget = _ref.unhideGhostForTarget;\n if (!originalEvent) return;\n var toSortable = putSortable || activeSortable;\n hideGhostForTarget();\n var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent;\n var target = document.elementFromPoint(touch.clientX, touch.clientY);\n unhideGhostForTarget();\n\n if (toSortable && !toSortable.el.contains(target)) {\n dispatchSortableEvent('spill');\n this.onSpill({\n dragEl: dragEl,\n putSortable: putSortable\n });\n }\n};\n\nfunction Revert() {}\n\nRevert.prototype = {\n startIndex: null,\n dragStart: function dragStart(_ref2) {\n var oldDraggableIndex = _ref2.oldDraggableIndex;\n this.startIndex = oldDraggableIndex;\n },\n onSpill: function onSpill(_ref3) {\n var dragEl = _ref3.dragEl,\n putSortable = _ref3.putSortable;\n this.sortable.captureAnimationState();\n\n if (putSortable) {\n putSortable.captureAnimationState();\n }\n\n var nextSibling = getChild(this.sortable.el, this.startIndex, this.options);\n\n if (nextSibling) {\n this.sortable.el.insertBefore(dragEl, nextSibling);\n } else {\n this.sortable.el.appendChild(dragEl);\n }\n\n this.sortable.animateAll();\n\n if (putSortable) {\n putSortable.animateAll();\n }\n },\n drop: drop\n};\n\n_extends(Revert, {\n pluginName: 'revertOnSpill'\n});\n\nfunction Remove() {}\n\nRemove.prototype = {\n onSpill: function onSpill(_ref4) {\n var dragEl = _ref4.dragEl,\n putSortable = _ref4.putSortable;\n var parentSortable = putSortable || this.sortable;\n parentSortable.captureAnimationState();\n dragEl.parentNode && dragEl.parentNode.removeChild(dragEl);\n parentSortable.animateAll();\n },\n drop: drop\n};\n\n_extends(Remove, {\n pluginName: 'removeOnSpill'\n});\n\nvar OnSpill = [Remove, Revert];\n\nvar lastSwapEl;\n\nfunction SwapPlugin() {\n function Swap() {\n this.defaults = {\n swapClass: 'sortable-swap-highlight'\n };\n }\n\n Swap.prototype = {\n dragStart: function dragStart(_ref) {\n var dragEl = _ref.dragEl;\n lastSwapEl = dragEl;\n },\n dragOverValid: function dragOverValid(_ref2) {\n var completed = _ref2.completed,\n target = _ref2.target,\n onMove = _ref2.onMove,\n activeSortable = _ref2.activeSortable,\n changed = _ref2.changed,\n cancel = _ref2.cancel;\n if (!activeSortable.options.swap) return;\n var el = this.sortable.el,\n options = this.options;\n\n if (target && target !== el) {\n var prevSwapEl = lastSwapEl;\n\n if (onMove(target) !== false) {\n toggleClass(target, options.swapClass, true);\n lastSwapEl = target;\n } else {\n lastSwapEl = null;\n }\n\n if (prevSwapEl && prevSwapEl !== lastSwapEl) {\n toggleClass(prevSwapEl, options.swapClass, false);\n }\n }\n\n changed();\n completed(true);\n cancel();\n },\n drop: function drop(_ref3) {\n var activeSortable = _ref3.activeSortable,\n putSortable = _ref3.putSortable,\n dragEl = _ref3.dragEl;\n var toSortable = putSortable || this.sortable;\n var options = this.options;\n lastSwapEl && toggleClass(lastSwapEl, options.swapClass, false);\n\n if (lastSwapEl && (options.swap || putSortable && putSortable.options.swap)) {\n if (dragEl !== lastSwapEl) {\n toSortable.captureAnimationState();\n if (toSortable !== activeSortable) activeSortable.captureAnimationState();\n swapNodes(dragEl, lastSwapEl);\n toSortable.animateAll();\n if (toSortable !== activeSortable) activeSortable.animateAll();\n }\n }\n },\n nulling: function nulling() {\n lastSwapEl = null;\n }\n };\n return _extends(Swap, {\n pluginName: 'swap',\n eventProperties: function eventProperties() {\n return {\n swapItem: lastSwapEl\n };\n }\n });\n}\n\nfunction swapNodes(n1, n2) {\n var p1 = n1.parentNode,\n p2 = n2.parentNode,\n i1,\n i2;\n if (!p1 || !p2 || p1.isEqualNode(n2) || p2.isEqualNode(n1)) return;\n i1 = index(n1);\n i2 = index(n2);\n\n if (p1.isEqualNode(p2) && i1 < i2) {\n i2++;\n }\n\n p1.insertBefore(n2, p1.children[i1]);\n p2.insertBefore(n1, p2.children[i2]);\n}\n\nvar multiDragElements = [],\n multiDragClones = [],\n lastMultiDragSelect,\n // for selection with modifier key down (SHIFT)\nmultiDragSortable,\n initialFolding = false,\n // Initial multi-drag fold when drag started\nfolding = false,\n // Folding any other time\ndragStarted = false,\n dragEl$1,\n clonesFromRect,\n clonesHidden;\n\nfunction MultiDragPlugin() {\n function MultiDrag(sortable) {\n // Bind all private methods\n for (var fn in this) {\n if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {\n this[fn] = this[fn].bind(this);\n }\n }\n\n if (sortable.options.supportPointer) {\n on(document, 'pointerup', this._deselectMultiDrag);\n } else {\n on(document, 'mouseup', this._deselectMultiDrag);\n on(document, 'touchend', this._deselectMultiDrag);\n }\n\n on(document, 'keydown', this._checkKeyDown);\n on(document, 'keyup', this._checkKeyUp);\n this.defaults = {\n selectedClass: 'sortable-selected',\n multiDragKey: null,\n setData: function setData(dataTransfer, dragEl) {\n var data = '';\n\n if (multiDragElements.length && multiDragSortable === sortable) {\n multiDragElements.forEach(function (multiDragElement, i) {\n data += (!i ? '' : ', ') + multiDragElement.textContent;\n });\n } else {\n data = dragEl.textContent;\n }\n\n dataTransfer.setData('Text', data);\n }\n };\n }\n\n MultiDrag.prototype = {\n multiDragKeyDown: false,\n isMultiDrag: false,\n delayStartGlobal: function delayStartGlobal(_ref) {\n var dragged = _ref.dragEl;\n dragEl$1 = dragged;\n },\n delayEnded: function delayEnded() {\n this.isMultiDrag = ~multiDragElements.indexOf(dragEl$1);\n },\n setupClone: function setupClone(_ref2) {\n var sortable = _ref2.sortable,\n cancel = _ref2.cancel;\n if (!this.isMultiDrag) return;\n\n for (var i = 0; i < multiDragElements.length; i++) {\n multiDragClones.push(clone(multiDragElements[i]));\n multiDragClones[i].sortableIndex = multiDragElements[i].sortableIndex;\n multiDragClones[i].draggable = false;\n multiDragClones[i].style['will-change'] = '';\n toggleClass(multiDragClones[i], this.options.selectedClass, false);\n multiDragElements[i] === dragEl$1 && toggleClass(multiDragClones[i], this.options.chosenClass, false);\n }\n\n sortable._hideClone();\n\n cancel();\n },\n clone: function clone(_ref3) {\n var sortable = _ref3.sortable,\n rootEl = _ref3.rootEl,\n dispatchSortableEvent = _ref3.dispatchSortableEvent,\n cancel = _ref3.cancel;\n if (!this.isMultiDrag) return;\n\n if (!this.options.removeCloneOnHide) {\n if (multiDragElements.length && multiDragSortable === sortable) {\n insertMultiDragClones(true, rootEl);\n dispatchSortableEvent('clone');\n cancel();\n }\n }\n },\n showClone: function showClone(_ref4) {\n var cloneNowShown = _ref4.cloneNowShown,\n rootEl = _ref4.rootEl,\n cancel = _ref4.cancel;\n if (!this.isMultiDrag) return;\n insertMultiDragClones(false, rootEl);\n multiDragClones.forEach(function (clone) {\n css(clone, 'display', '');\n });\n cloneNowShown();\n clonesHidden = false;\n cancel();\n },\n hideClone: function hideClone(_ref5) {\n var _this = this;\n\n var sortable = _ref5.sortable,\n cloneNowHidden = _ref5.cloneNowHidden,\n cancel = _ref5.cancel;\n if (!this.isMultiDrag) return;\n multiDragClones.forEach(function (clone) {\n css(clone, 'display', 'none');\n\n if (_this.options.removeCloneOnHide && clone.parentNode) {\n clone.parentNode.removeChild(clone);\n }\n });\n cloneNowHidden();\n clonesHidden = true;\n cancel();\n },\n dragStartGlobal: function dragStartGlobal(_ref6) {\n var sortable = _ref6.sortable;\n\n if (!this.isMultiDrag && multiDragSortable) {\n multiDragSortable.multiDrag._deselectMultiDrag();\n }\n\n multiDragElements.forEach(function (multiDragElement) {\n multiDragElement.sortableIndex = index(multiDragElement);\n }); // Sort multi-drag elements\n\n multiDragElements = multiDragElements.sort(function (a, b) {\n return a.sortableIndex - b.sortableIndex;\n });\n dragStarted = true;\n },\n dragStarted: function dragStarted(_ref7) {\n var _this2 = this;\n\n var sortable = _ref7.sortable;\n if (!this.isMultiDrag) return;\n\n if (this.options.sort) {\n // Capture rects,\n // hide multi drag elements (by positioning them absolute),\n // set multi drag elements rects to dragRect,\n // show multi drag elements,\n // animate to rects,\n // unset rects & remove from DOM\n sortable.captureAnimationState();\n\n if (this.options.animation) {\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement === dragEl$1) return;\n css(multiDragElement, 'position', 'absolute');\n });\n var dragRect = getRect(dragEl$1, false, true, true);\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement === dragEl$1) return;\n setRect(multiDragElement, dragRect);\n });\n folding = true;\n initialFolding = true;\n }\n }\n\n sortable.animateAll(function () {\n folding = false;\n initialFolding = false;\n\n if (_this2.options.animation) {\n multiDragElements.forEach(function (multiDragElement) {\n unsetRect(multiDragElement);\n });\n } // Remove all auxiliary multidrag items from el, if sorting enabled\n\n\n if (_this2.options.sort) {\n removeMultiDragElements();\n }\n });\n },\n dragOver: function dragOver(_ref8) {\n var target = _ref8.target,\n completed = _ref8.completed,\n cancel = _ref8.cancel;\n\n if (folding && ~multiDragElements.indexOf(target)) {\n completed(false);\n cancel();\n }\n },\n revert: function revert(_ref9) {\n var fromSortable = _ref9.fromSortable,\n rootEl = _ref9.rootEl,\n sortable = _ref9.sortable,\n dragRect = _ref9.dragRect;\n\n if (multiDragElements.length > 1) {\n // Setup unfold animation\n multiDragElements.forEach(function (multiDragElement) {\n sortable.addAnimationState({\n target: multiDragElement,\n rect: folding ? getRect(multiDragElement) : dragRect\n });\n unsetRect(multiDragElement);\n multiDragElement.fromRect = dragRect;\n fromSortable.removeAnimationState(multiDragElement);\n });\n folding = false;\n insertMultiDragElements(!this.options.removeCloneOnHide, rootEl);\n }\n },\n dragOverCompleted: function dragOverCompleted(_ref10) {\n var sortable = _ref10.sortable,\n isOwner = _ref10.isOwner,\n insertion = _ref10.insertion,\n activeSortable = _ref10.activeSortable,\n parentEl = _ref10.parentEl,\n putSortable = _ref10.putSortable;\n var options = this.options;\n\n if (insertion) {\n // Clones must be hidden before folding animation to capture dragRectAbsolute properly\n if (isOwner) {\n activeSortable._hideClone();\n }\n\n initialFolding = false; // If leaving sort:false root, or already folding - Fold to new location\n\n if (options.animation && multiDragElements.length > 1 && (folding || !isOwner && !activeSortable.options.sort && !putSortable)) {\n // Fold: Set all multi drag elements's rects to dragEl's rect when multi-drag elements are invisible\n var dragRectAbsolute = getRect(dragEl$1, false, true, true);\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement === dragEl$1) return;\n setRect(multiDragElement, dragRectAbsolute); // Move element(s) to end of parentEl so that it does not interfere with multi-drag clones insertion if they are inserted\n // while folding, and so that we can capture them again because old sortable will no longer be fromSortable\n\n parentEl.appendChild(multiDragElement);\n });\n folding = true;\n } // Clones must be shown (and check to remove multi drags) after folding when interfering multiDragElements are moved out\n\n\n if (!isOwner) {\n // Only remove if not folding (folding will remove them anyways)\n if (!folding) {\n removeMultiDragElements();\n }\n\n if (multiDragElements.length > 1) {\n var clonesHiddenBefore = clonesHidden;\n\n activeSortable._showClone(sortable); // Unfold animation for clones if showing from hidden\n\n\n if (activeSortable.options.animation && !clonesHidden && clonesHiddenBefore) {\n multiDragClones.forEach(function (clone) {\n activeSortable.addAnimationState({\n target: clone,\n rect: clonesFromRect\n });\n clone.fromRect = clonesFromRect;\n clone.thisAnimationDuration = null;\n });\n }\n } else {\n activeSortable._showClone(sortable);\n }\n }\n }\n },\n dragOverAnimationCapture: function dragOverAnimationCapture(_ref11) {\n var dragRect = _ref11.dragRect,\n isOwner = _ref11.isOwner,\n activeSortable = _ref11.activeSortable;\n multiDragElements.forEach(function (multiDragElement) {\n multiDragElement.thisAnimationDuration = null;\n });\n\n if (activeSortable.options.animation && !isOwner && activeSortable.multiDrag.isMultiDrag) {\n clonesFromRect = _extends({}, dragRect);\n var dragMatrix = matrix(dragEl$1, true);\n clonesFromRect.top -= dragMatrix.f;\n clonesFromRect.left -= dragMatrix.e;\n }\n },\n dragOverAnimationComplete: function dragOverAnimationComplete() {\n if (folding) {\n folding = false;\n removeMultiDragElements();\n }\n },\n drop: function drop(_ref12) {\n var evt = _ref12.originalEvent,\n rootEl = _ref12.rootEl,\n parentEl = _ref12.parentEl,\n sortable = _ref12.sortable,\n dispatchSortableEvent = _ref12.dispatchSortableEvent,\n oldIndex = _ref12.oldIndex,\n putSortable = _ref12.putSortable;\n var toSortable = putSortable || this.sortable;\n if (!evt) return;\n var options = this.options,\n children = parentEl.children; // Multi-drag selection\n\n if (!dragStarted) {\n if (options.multiDragKey && !this.multiDragKeyDown) {\n this._deselectMultiDrag();\n }\n\n toggleClass(dragEl$1, options.selectedClass, !~multiDragElements.indexOf(dragEl$1));\n\n if (!~multiDragElements.indexOf(dragEl$1)) {\n multiDragElements.push(dragEl$1);\n dispatchEvent({\n sortable: sortable,\n rootEl: rootEl,\n name: 'select',\n targetEl: dragEl$1,\n originalEvt: evt\n }); // Modifier activated, select from last to dragEl\n\n if (evt.shiftKey && lastMultiDragSelect && sortable.el.contains(lastMultiDragSelect)) {\n var lastIndex = index(lastMultiDragSelect),\n currentIndex = index(dragEl$1);\n\n if (~lastIndex && ~currentIndex && lastIndex !== currentIndex) {\n // Must include lastMultiDragSelect (select it), in case modified selection from no selection\n // (but previous selection existed)\n var n, i;\n\n if (currentIndex > lastIndex) {\n i = lastIndex;\n n = currentIndex;\n } else {\n i = currentIndex;\n n = lastIndex + 1;\n }\n\n for (; i < n; i++) {\n if (~multiDragElements.indexOf(children[i])) continue;\n toggleClass(children[i], options.selectedClass, true);\n multiDragElements.push(children[i]);\n dispatchEvent({\n sortable: sortable,\n rootEl: rootEl,\n name: 'select',\n targetEl: children[i],\n originalEvt: evt\n });\n }\n }\n } else {\n lastMultiDragSelect = dragEl$1;\n }\n\n multiDragSortable = toSortable;\n } else {\n multiDragElements.splice(multiDragElements.indexOf(dragEl$1), 1);\n lastMultiDragSelect = null;\n dispatchEvent({\n sortable: sortable,\n rootEl: rootEl,\n name: 'deselect',\n targetEl: dragEl$1,\n originalEvt: evt\n });\n }\n } // Multi-drag drop\n\n\n if (dragStarted && this.isMultiDrag) {\n folding = false; // Do not \"unfold\" after around dragEl if reverted\n\n if ((parentEl[expando].options.sort || parentEl !== rootEl) && multiDragElements.length > 1) {\n var dragRect = getRect(dragEl$1),\n multiDragIndex = index(dragEl$1, ':not(.' + this.options.selectedClass + ')');\n if (!initialFolding && options.animation) dragEl$1.thisAnimationDuration = null;\n toSortable.captureAnimationState();\n\n if (!initialFolding) {\n if (options.animation) {\n dragEl$1.fromRect = dragRect;\n multiDragElements.forEach(function (multiDragElement) {\n multiDragElement.thisAnimationDuration = null;\n\n if (multiDragElement !== dragEl$1) {\n var rect = folding ? getRect(multiDragElement) : dragRect;\n multiDragElement.fromRect = rect; // Prepare unfold animation\n\n toSortable.addAnimationState({\n target: multiDragElement,\n rect: rect\n });\n }\n });\n } // Multi drag elements are not necessarily removed from the DOM on drop, so to reinsert\n // properly they must all be removed\n\n\n removeMultiDragElements();\n multiDragElements.forEach(function (multiDragElement) {\n if (children[multiDragIndex]) {\n parentEl.insertBefore(multiDragElement, children[multiDragIndex]);\n } else {\n parentEl.appendChild(multiDragElement);\n }\n\n multiDragIndex++;\n }); // If initial folding is done, the elements may have changed position because they are now\n // unfolding around dragEl, even though dragEl may not have his index changed, so update event\n // must be fired here as Sortable will not.\n\n if (oldIndex === index(dragEl$1)) {\n var update = false;\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement.sortableIndex !== index(multiDragElement)) {\n update = true;\n return;\n }\n });\n\n if (update) {\n dispatchSortableEvent('update');\n }\n }\n } // Must be done after capturing individual rects (scroll bar)\n\n\n multiDragElements.forEach(function (multiDragElement) {\n unsetRect(multiDragElement);\n });\n toSortable.animateAll();\n }\n\n multiDragSortable = toSortable;\n } // Remove clones if necessary\n\n\n if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') {\n multiDragClones.forEach(function (clone) {\n clone.parentNode && clone.parentNode.removeChild(clone);\n });\n }\n },\n nullingGlobal: function nullingGlobal() {\n this.isMultiDrag = dragStarted = false;\n multiDragClones.length = 0;\n },\n destroyGlobal: function destroyGlobal() {\n this._deselectMultiDrag();\n\n off(document, 'pointerup', this._deselectMultiDrag);\n off(document, 'mouseup', this._deselectMultiDrag);\n off(document, 'touchend', this._deselectMultiDrag);\n off(document, 'keydown', this._checkKeyDown);\n off(document, 'keyup', this._checkKeyUp);\n },\n _deselectMultiDrag: function _deselectMultiDrag(evt) {\n if (typeof dragStarted !== \"undefined\" && dragStarted) return; // Only deselect if selection is in this sortable\n\n if (multiDragSortable !== this.sortable) return; // Only deselect if target is not item in this sortable\n\n if (evt && closest(evt.target, this.options.draggable, this.sortable.el, false)) return; // Only deselect if left click\n\n if (evt && evt.button !== 0) return;\n\n while (multiDragElements.length) {\n var el = multiDragElements[0];\n toggleClass(el, this.options.selectedClass, false);\n multiDragElements.shift();\n dispatchEvent({\n sortable: this.sortable,\n rootEl: this.sortable.el,\n name: 'deselect',\n targetEl: el,\n originalEvt: evt\n });\n }\n },\n _checkKeyDown: function _checkKeyDown(evt) {\n if (evt.key === this.options.multiDragKey) {\n this.multiDragKeyDown = true;\n }\n },\n _checkKeyUp: function _checkKeyUp(evt) {\n if (evt.key === this.options.multiDragKey) {\n this.multiDragKeyDown = false;\n }\n }\n };\n return _extends(MultiDrag, {\n // Static methods & properties\n pluginName: 'multiDrag',\n utils: {\n /**\n * Selects the provided multi-drag item\n * @param {HTMLElement} el The element to be selected\n */\n select: function select(el) {\n var sortable = el.parentNode[expando];\n if (!sortable || !sortable.options.multiDrag || ~multiDragElements.indexOf(el)) return;\n\n if (multiDragSortable && multiDragSortable !== sortable) {\n multiDragSortable.multiDrag._deselectMultiDrag();\n\n multiDragSortable = sortable;\n }\n\n toggleClass(el, sortable.options.selectedClass, true);\n multiDragElements.push(el);\n },\n\n /**\n * Deselects the provided multi-drag item\n * @param {HTMLElement} el The element to be deselected\n */\n deselect: function deselect(el) {\n var sortable = el.parentNode[expando],\n index = multiDragElements.indexOf(el);\n if (!sortable || !sortable.options.multiDrag || !~index) return;\n toggleClass(el, sortable.options.selectedClass, false);\n multiDragElements.splice(index, 1);\n }\n },\n eventProperties: function eventProperties() {\n var _this3 = this;\n\n var oldIndicies = [],\n newIndicies = [];\n multiDragElements.forEach(function (multiDragElement) {\n oldIndicies.push({\n multiDragElement: multiDragElement,\n index: multiDragElement.sortableIndex\n }); // multiDragElements will already be sorted if folding\n\n var newIndex;\n\n if (folding && multiDragElement !== dragEl$1) {\n newIndex = -1;\n } else if (folding) {\n newIndex = index(multiDragElement, ':not(.' + _this3.options.selectedClass + ')');\n } else {\n newIndex = index(multiDragElement);\n }\n\n newIndicies.push({\n multiDragElement: multiDragElement,\n index: newIndex\n });\n });\n return {\n items: _toConsumableArray(multiDragElements),\n clones: [].concat(multiDragClones),\n oldIndicies: oldIndicies,\n newIndicies: newIndicies\n };\n },\n optionListeners: {\n multiDragKey: function multiDragKey(key) {\n key = key.toLowerCase();\n\n if (key === 'ctrl') {\n key = 'Control';\n } else if (key.length > 1) {\n key = key.charAt(0).toUpperCase() + key.substr(1);\n }\n\n return key;\n }\n }\n });\n}\n\nfunction insertMultiDragElements(clonesInserted, rootEl) {\n multiDragElements.forEach(function (multiDragElement, i) {\n var target = rootEl.children[multiDragElement.sortableIndex + (clonesInserted ? Number(i) : 0)];\n\n if (target) {\n rootEl.insertBefore(multiDragElement, target);\n } else {\n rootEl.appendChild(multiDragElement);\n }\n });\n}\n/**\n * Insert multi-drag clones\n * @param {[Boolean]} elementsInserted Whether the multi-drag elements are inserted\n * @param {HTMLElement} rootEl\n */\n\n\nfunction insertMultiDragClones(elementsInserted, rootEl) {\n multiDragClones.forEach(function (clone, i) {\n var target = rootEl.children[clone.sortableIndex + (elementsInserted ? Number(i) : 0)];\n\n if (target) {\n rootEl.insertBefore(clone, target);\n } else {\n rootEl.appendChild(clone);\n }\n });\n}\n\nfunction removeMultiDragElements() {\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement === dragEl$1) return;\n multiDragElement.parentNode && multiDragElement.parentNode.removeChild(multiDragElement);\n });\n}\n\nexport default Sortable;\nexport { AutoScrollPlugin as AutoScroll, MultiDragPlugin as MultiDrag, OnSpill, Sortable, SwapPlugin as Swap };\n", "import { getAllNotes, addNote, noteEmitter, sortNotes } from '../services/notesService.js';\nimport NoteDisplay from './notedisplay.js';\nimport Note from '../models/note.js';\nimport Sortable from 'sortablejs/modular/sortable.core.esm.js';\n\nconst template = document.createElement('template');\ntemplate.innerHTML = `\n\n\n
\n

Notes

\n
\n \n \n
\n
\n
\n
\n`;\n\nclass NotesList extends HTMLElement {\n constructor () {\n super();\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.appendChild(template.content.cloneNode(true));\n this.noteList = this.shadowRoot.querySelector('#note-list');\n this.setAttribute('role', 'region');\n\n getAllNotes().forEach((note) => {\n const display = new NoteDisplay();\n display.setNote(note);\n this.noteList.appendChild(display);\n });\n\n noteEmitter.on('note:add', this._addNote.bind(this));\n noteEmitter.on('note:delete', this._removeNote.bind(this));\n noteEmitter.on('note:edit', this._updateNote.bind(this));\n }\n\n connectedCallback () {\n this.shadowRoot.querySelector('.btn-collapse').addEventListener('click', this._collapseAll.bind(this));\n this.shadowRoot.querySelector('.btn-create').addEventListener('click', this._createNote.bind(this));\n\n this.sortable = new Sortable(this.noteList, {\n draggable: 'had-note',\n dataIdAttr: 'data-id',\n store: {\n /**\n * Save the order of elements. Called onEnd (when the item is dropped).\n * @param {Sortable} sortable\n */\n set: function (sortable) {\n const order = sortable.toArray();\n sortNotes(order);\n }\n }\n });\n }\n\n disconnectedCallback () {\n this.shadowRoot.querySelector('.btn-collapse').removeEventListener('click', this._collapseAll.bind(this));\n this.shadowRoot.querySelector('.btn-create').removeEventListener('click', this._createNote.bind(this));\n this.sortable.destroy();\n }\n\n _collapseAll () {\n this.shadowRoot.querySelectorAll('had-note').forEach((el) => {\n el.collapse();\n });\n }\n\n _createNote () {\n addNote(new Note({}), 'edit');\n }\n\n _addNote ({ note, mode }) {\n const id = note.id;\n if (this.shadowRoot.querySelector(`#note_${id}`)) {\n return;\n }\n const display = new NoteDisplay();\n display.setNote(note);\n if (mode === 'edit') {\n display._enableEdit();\n }\n this.noteList.appendChild(display);\n if (mode === 'edit') {\n display.shadowRoot.querySelector('input[name=title]').focus();\n }\n }\n\n _updateNote ({ note }) {\n const id = note.id;\n const noteDisplay = this.shadowRoot.querySelector(`#note_${id}`);\n if (!noteDisplay) {\n return;\n }\n noteDisplay.setNote(note);\n }\n\n _removeNote ({ id }) {\n const noteDisplay = this.shadowRoot.querySelector(`#note_${id}`);\n if (noteDisplay) {\n noteDisplay.parentElement.removeChild(noteDisplay);\n }\n }\n};\n\nwindow.customElements.define('had-noteslist', NotesList);\n\nexport default NotesList;\n", "import { rollDie } from '../services/randomTableService.js';\n\nconst template = document.createElement('template');\ntemplate.innerHTML = `\n\n\n\n\n`;\n\nclass DiceRoller extends HTMLElement {\n constructor () {\n super();\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.appendChild(template.content.cloneNode(true));\n\n this.result = this.shadowRoot.querySelector('.result');\n this.button = this.shadowRoot.querySelector('button');\n }\n\n connectedCallback () {\n this.button.addEventListener('click', this._roll.bind(this));\n }\n\n disconnectedCallback () {\n this.button.removeEventListener('click', this._roll.bind(this));\n }\n\n _roll () {\n const result = rollDie('2d6');\n this.result.innerHTML = result;\n }\n};\n\nwindow.customElements.define('had-diceroller', DiceRoller);\n\nexport default DiceRoller;\n", "import NPCSchema from 'rpg-table-randomizer/src/NPCSchema.js';\nimport NPCSchemaField from 'rpg-table-randomizer/src/NPCSchemaField.js';\n\nconst npcName = new NPCSchemaField({\n key: 'npcName',\n label: 'Name',\n type: 'string',\n source: 'name:western',\n count: 1\n});\n\nconst field1 = new NPCSchemaField({\n key: 'job',\n label: 'Occupation',\n type: 'string',\n source: 'table:jobs',\n count: 1\n});\n\nconst field2 = new NPCSchemaField({\n key: 'long_goal',\n label: 'Goal (Long term)',\n type: 'string',\n source: 'table:goals:long_term',\n count: 1\n});\n\nconst field3 = new NPCSchemaField({\n key: 'short_goal',\n label: 'Goal (Short term)',\n type: 'string',\n source: 'table:goals:short_term',\n count: 1\n});\n\nconst field4 = new NPCSchemaField({\n key: 'secret',\n label: 'Secret',\n type: 'string',\n source: 'table:goals:secrets',\n count: 1\n});\n\nconst appNPCSchema = new NPCSchema({\n key: 'hadleyville',\n name: 'Hadleyville NPC',\n fields: [\n npcName,\n field1,\n field2,\n field3,\n field4\n ]\n});\n\nexport default appNPCSchema;\n", "\nimport NPC from 'rpg-table-randomizer/src/NPC.js';\nimport MarkdownIt from 'markdown-it/lib';\n\nexport default class AppNPC extends NPC {\n constructor ({\n id = null,\n schema = 'hadleyville',\n fields = new Map(),\n notes = '',\n collapse = false\n }) {\n super({\n id,\n schema,\n fields\n });\n this.notes = notes;\n this.collapse = !!collapse;\n }\n\n get name () {\n return this.getFieldValue('npcName');\n }\n\n get job () {\n return this.getFieldValue('job');\n }\n\n get longGoal () {\n return this.getFieldValue('long_goal');\n }\n\n get shortGoal () {\n return this.getFieldValue('short_goal');\n }\n\n get secret () {\n return this.getFieldValue('secret');\n }\n\n setFieldValue (field, value) {\n if (typeof this.fields.get(field) === 'undefined') {\n return;\n }\n this.fields.set(field, value);\n }\n\n getFieldDisplay (field) {\n if (field === 'notes') {\n return this.noteHtml;\n }\n return this.fields.get(field);\n }\n\n get noteHtml () {\n const md = new MarkdownIt();\n return md.render(this.notes);\n }\n}\n", "import store from '../store/store.js';\nimport { createNPC, updateNPC, deleteNPC, sortNPCs as sortNPCsStore, clearNPCs, importNPCs as importNPCsStore } from '../store/npcs-reducer.js';\n\nimport npcSchema from '../models/npcSchema.js';\nimport NPC from '../models/npc.js';\nimport { convertToken } from '../services/randomTableService.js';\nimport { isEmpty } from '../../node_modules/rpg-table-randomizer/src/r_helpers.js';\nimport EventEmitter from '../models/EventEmitter.js';\n\nconst npcEmitter = new EventEmitter();\n\nconst newNPC = function () {\n const fields = new Map();\n npcSchema.fields.forEach((field) => {\n const key = field.key;\n if (!isEmpty(field.starting_value)) {\n fields.set(key, field.starting_value);\n return;\n }\n if (!isEmpty(field.source)) {\n if (field.type === 'array') {\n const value = [];\n const ct = (field.count) ? field.count : 1;\n for (let i = 0; i < ct; i++) {\n value.push(convertToken(field.source));\n }\n fields.set(key, value);\n } else {\n fields.set(key, convertToken(field.source));\n }\n return;\n }\n fields.set(key, field.defaultEmpty);\n });\n return new NPC({\n fields: fields\n });\n};\n\nconst getAllNPCs = function () {\n const npcs = store.getState().npcs;\n return npcs.map((obj) => {\n return new NPC(obj);\n });\n};\n\nconst createNewNPC = function () {\n const npc = newNPC();\n store.dispatch(createNPC({ npc: npc.toJSON() }));\n return npc;\n};\n\nconst getNPCById = function (id) {\n const npcs = store.getState().npcs;\n const data = npcs.find((npc) => {\n return npc.id === id;\n });\n if (data) {\n return new NPC(data);\n }\n return null;\n};\n\nconst saveNPC = function (npc) {\n store.dispatch(updateNPC({ npc: npc.toJSON() }));\n const upnpc = this.getNPCById(npc.id);\n this.npcs$.next(upnpc);\n};\n\nconst removeNPC = function (id) {\n store.dispatch(deleteNPC({ id }));\n npcEmitter.trigger('npc:delete', {\n id\n });\n};\n\nconst sortNPCs = function (sortUuids) {\n store.dispatch(sortNPCsStore({ sortUuids }));\n};\n\nconst deleteAllNPCs = function () {\n store.dispatch(clearNPCs());\n};\n\nconst importNPCs = function (npcs) {\n store.dispatch(importNPCsStore({ npcs }));\n npcs.forEach((npcData) => {\n if (!npcData.id) {\n return;\n }\n const npc = new NPC(npcData);\n npcEmitter.trigger('npc:add', {\n npc\n });\n });\n};\n\nexport {\n npcEmitter,\n getAllNPCs,\n getNPCById,\n createNewNPC,\n saveNPC,\n sortNPCs,\n removeNPC,\n deleteAllNPCs,\n importNPCs\n};\n", "import { saveNPC, removeNPC } from '../services/npcService.js';\nimport NPCSchema from '../models/npcSchema.js';\nimport { convertToken } from '../services/randomTableService.js';\n\nconst template = document.createElement('template');\ntemplate.innerHTML = `\n\n\n
\n \n
\n
\n \n
\n
\n
\n
\n
\n`;\n\nconst formTemplate = document.createElement('template');\nformTemplate.innerHTML = `\n
\n

Click the to reroll a field. Click \"Save\" to save any changes.

\n
\n
\n
\n \n \n
\n
\n \n \n \n
\n
\n`;\n\nclass NPCDisplay extends HTMLElement {\n constructor () {\n super();\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.appendChild(template.content.cloneNode(true));\n this._isEdit = false;\n this.editButton = this.shadowRoot.querySelector('.btn-edit');\n }\n\n connectedCallback () {\n this.shadowRoot.querySelector('details').addEventListener('toggle', this._setCollapse.bind(this));\n this.editButton.addEventListener('click', this._toggleEdit.bind(this));\n }\n\n disconnectedCallback () {\n this.shadowRoot.querySelector('details').removeEventListener('toggle', this._setCollapse.bind(this));\n this.editButton.removeEventListener('click', this._toggleEdit.bind(this));\n }\n\n /**\n *\n * @param {NPC} npc\n */\n setNPC (npc) {\n this.npc = npc;\n this.id = `npc_${this.npc.id}`;\n this.dataset.id = this.npc.id;\n if (npc.collapse) {\n this.shadowRoot.querySelector('details').open = false;\n } else {\n this.shadowRoot.querySelector('details').open = true;\n }\n this._setNPCOutput();\n }\n\n _setNPCOutput () {\n this.shadowRoot.querySelector('#summary-title').innerText = this.npc.name;\n this.shadowRoot.querySelector('.body').innerHTML = '';\n\n const ul = document.createElement('ul');\n Array.from(NPCSchema.fields.keys()).forEach((key) => {\n const li = document.createElement('li');\n const label = NPCSchema.getFieldLabelByKey(key);\n const value = this.npc.getFieldDisplay(key);\n li.innerHTML = `${label}: ${value}`;\n ul.appendChild(li);\n });\n const li = document.createElement('li');\n li.innerHTML = `Notes: ${this.npc.getFieldDisplay('notes')}`;\n ul.appendChild(li);\n this.shadowRoot.querySelector('.body').appendChild(ul);\n }\n\n /**\n * Save collapse state\n * @param ev Toggle event on details.\n */\n _setCollapse (ev) {\n const newState = !ev.target.open;\n if (this.npc.collapse === newState) {\n return;\n }\n this.npc.collapse = newState;\n saveNPC(this.npc);\n }\n\n collapse () {\n this.shadowRoot.querySelector('details').open = false;\n }\n\n _toggleEdit (ev) {\n if (this._isEdit) {\n this._disableEdit();\n return;\n }\n this._enableEdit();\n }\n\n _createFormField (key, fieldLabel, value = '') {\n const div = document.createElement('div');\n div.classList.add('formField');\n const label = document.createElement('label');\n label.setAttribute('for', key);\n label.innerHTML = fieldLabel;\n div.appendChild(label);\n\n const div2 = document.createElement('div');\n div2.classList.add('fieldReroll');\n const input = document.createElement('input');\n input.id = key;\n input.setAttribute('type', 'text');\n input.setAttribute('name', key);\n input.setAttribute('autocomplete', 'off');\n input.value = value;\n div2.appendChild(input);\n\n const button = document.createElement('button');\n button.classList.add('btn-reroll');\n button.dataset.field = key;\n button.setAttribute('type', 'button');\n button.setAttribute('aria-label', 'Reroll');\n button.setAttribute('aria-controls', key);\n button.innerHTML = '⚅';\n div2.appendChild(button);\n\n div.appendChild(div2);\n\n return div;\n }\n\n _enableEdit () {\n if (this._isEdit) {\n return;\n }\n this._isEdit = true;\n\n this.shadowRoot.querySelector('.body').innerHTML = '';\n\n let form = formTemplate.content.cloneNode(true);\n const fieldDiv = form.querySelector('.formFields');\n Array.from(NPCSchema.fields.keys()).forEach((key) => {\n const label = NPCSchema.getFieldLabelByKey(key);\n const value = this.npc.getFieldDisplay(key);\n const formField = this._createFormField(\n key,\n label,\n value\n );\n fieldDiv.appendChild(formField);\n });\n\n form.querySelector('textarea[name=notes').value = this.npc.notes;\n\n this.shadowRoot.querySelector('.body').appendChild(form);\n form = this.shadowRoot.querySelector('form');\n form.addEventListener('submit', this._saveEdit.bind(this));\n form.querySelector('.btn-cancel').addEventListener('click', this._toggleEdit.bind(this));\n form.querySelector('.btn-delete').addEventListener('click', this._deleteNPC.bind(this));\n\n form.querySelectorAll('.btn-reroll').forEach((btn) => {\n btn.addEventListener('click', this._reroll.bind(this));\n });\n }\n\n _disableEdit () {\n if (!this._isEdit) {\n return;\n }\n this._isEdit = false;\n\n // remove form events\n const form = this.shadowRoot.querySelector('form');\n form.removeEventListener('submit', this._saveEdit.bind(this));\n form.querySelector('.btn-cancel').removeEventListener('click', this._toggleEdit.bind(this));\n form.querySelector('.btn-delete').removeEventListener('click', this._deleteNPC.bind(this));\n form.querySelectorAll('.btn-reroll').forEach((btn) => {\n btn.removeEventListener('click', this._reroll.bind(this));\n });\n\n this._setNPCOutput();\n }\n\n _saveEdit (ev) {\n ev.preventDefault();\n const formData = new FormData(ev.target);\n\n this.npc.getFieldKeys().forEach((key) => {\n this.npc.setFieldValue(key, formData.get(key).toString());\n });\n\n this.npc.notes = formData.get('notes').toString();\n\n saveNPC(this.npc);\n this._disableEdit();\n }\n\n _deleteNPC () {\n removeNPC(this.npc.id);\n }\n\n _reroll (ev) {\n const fieldKey = ev.target.dataset.field || '';\n if (fieldKey === '') {\n return;\n }\n // get source from schema\n const field = NPCSchema.getFieldByKey(fieldKey);\n const result = convertToken(field.source);\n const input = this.shadowRoot.querySelector(`#${fieldKey}`);\n input.value = result.toString();\n }\n};\n\nwindow.customElements.define('had-npc', NPCDisplay);\n\nexport default NPCDisplay;\n", "import { createNewNPC, getAllNPCs, npcEmitter, sortNPCs } from '../services/npcService.js';\nimport NPCDisplay from './npcdisplay.js';\nimport Sortable from 'sortablejs/modular/sortable.core.esm.js';\n\nconst template = document.createElement('template');\ntemplate.innerHTML = `\n\n\n
\n

NPCs

\n
\n \n \n
\n
\n
\n
\n`;\n\nclass NPCsList extends HTMLElement {\n constructor () {\n super();\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.appendChild(template.content.cloneNode(true));\n this.npcList = this.shadowRoot.querySelector('#npc-list');\n this.setAttribute('role', 'region');\n\n getAllNPCs().forEach((npc) => {\n const display = new NPCDisplay();\n display.setNPC(npc);\n this.npcList.appendChild(display);\n });\n\n npcEmitter.on('npc:delete', this._removeNPC.bind(this));\n }\n\n connectedCallback () {\n this.shadowRoot.querySelector('.btn-collapse').addEventListener('click', this._collapseAll.bind(this));\n this.shadowRoot.querySelector('.btn-create').addEventListener('click', this._createNPC.bind(this));\n\n this.sortable = new Sortable(this.npcList, {\n draggable: 'had-npc',\n dataIdAttr: 'data-id',\n store: {\n /**\n * Save the order of elements. Called onEnd (when the item is dropped).\n * @param {Sortable} sortable\n */\n set: function (sortable) {\n const order = sortable.toArray();\n sortNPCs(order);\n }\n }\n });\n }\n\n disconnectedCallback () {\n this.shadowRoot.querySelector('.btn-collapse').removeEventListener('click', this._collapseAll.bind(this));\n this.shadowRoot.querySelector('.btn-create').removeEventListener('click', this._createNPC.bind(this));\n this.sortable.destroy();\n }\n\n _collapseAll () {\n this.shadowRoot.querySelectorAll('had-npc').forEach((el) => {\n el.collapse();\n });\n }\n\n _createNPC () {\n const npc = createNewNPC();\n const display = new NPCDisplay();\n display.setNPC(npc);\n display._enableEdit();\n this.npcList.appendChild(display);\n display.shadowRoot.querySelector('input[name=npcName]').focus();\n }\n\n _addNPC ({ npc }) {\n const display = new NPCDisplay();\n display.setNPC(npc);\n this.npcList.appendChild(display);\n }\n\n _removeNPC ({ id }) {\n const npcDisplay = this.shadowRoot.querySelector(`#npc_${id}`);\n if (npcDisplay) {\n npcDisplay.parentElement.removeChild(npcDisplay);\n }\n }\n};\n\nwindow.customElements.define('had-npcslist', NPCsList);\n\nexport default NPCsList;\n", "import store from '../store/store';\nimport { importNotes, deleteAllNotes } from './notesService.js';\nimport { saveTown, clearTown } from './townService.js';\nimport { importNPCs, deleteAllNPCs } from './npcService.js';\nimport { Town } from '../models/town.js';\n\n/**\n * Reset UI after downloading export.\n * @param {Event} ev\n */\nconst resetExport = function (ev) {\n // Give it a second so the link default action happens.\n // Then we revoke the object url to clear memory.\n setTimeout(() => {\n window.URL.revokeObjectURL(ev.target.href);\n document.getElementById('export-output').innerHTML = '';\n document.getElementById('export-button').hidden = false;\n }, 1000);\n};\n\n/**\n * Export date.\n * @param {Event} event\n */\nconst doExport = function (event) {\n const data = store.getState();\n const date = new Date();\n const file = new Blob([JSON.stringify(data)], { type: 'application/json' });\n // Object url must be unsanitized else it doesn't work.\n const exportFileUrl = URL.createObjectURL(file);\n const exportFileName = `Hadleyville__${date.getFullYear()}_${date.getMonth() + 1}_${date.getDate()}`;\n\n const link = document.createElement('a');\n link.href = exportFileUrl;\n link.setAttribute('download', exportFileName);\n link.innerText = 'Download Export';\n link.addEventListener('click', resetExport);\n document.getElementById('export-output').appendChild(link);\n document.getElementById('export-button').hidden = true;\n};\n\n/**\n * Import from an export.\n * @param {Event} ev\n */\nconst doImport = function (ev) {\n ev.preventDefault();\n const form = ev.target;\n const input_file = form.querySelector('input[type=file]');\n if (!input_file.files) {\n return;\n }\n Array.from(input_file.files).forEach((f) => {\n const reader = new FileReader();\n // Closure to capture the file information.\n reader.onload = ((theFile) => {\n return (e) => {\n let data = {};\n try {\n data = JSON.parse(e.target.result);\n } catch (err) {\n return;\n }\n const notes = data.notes || [];\n if (notes && Array.isArray(notes) && notes.length > 0) {\n importNotes(notes);\n }\n const npcs = data.npcs || [];\n if (npcs && Array.isArray(npcs) && npcs.length > 0) {\n importNPCs(npcs);\n }\n const towns = data.town || [];\n if (Array.isArray(towns)) {\n const town = towns.find(Boolean);\n if (town && town.id) {\n saveTown(new Town(town));\n }\n }\n };\n })(f);\n reader.readAsText(f);\n });\n\n // clear form.\n input_file.value = '';\n};\n\n/**\n * Remove all npcs, notes, and clear the town.\n * @param {Event} ev\n */\nconst deleteAll = function (ev) {\n if (!confirm('Are you really sure?')) {\n return;\n }\n deleteAllNotes();\n deleteAllNPCs();\n clearTown();\n};\n\n/**\n * Setup actions on the settings page.\n */\nconst setupPage = function () {\n const exportButton = document.getElementById('btn-export');\n exportButton.addEventListener('click', doExport);\n\n const importForm = document.getElementById('importForm');\n importForm.addEventListener('submit', doImport);\n\n const deleteButton = document.getElementById('btn-delete');\n deleteButton.addEventListener('click', deleteAll);\n};\n\nexport {\n setupPage\n};\n", "\nimport Header from './components/header.js';\nimport Footer from './components/footer.js';\nimport TableDrawer from './components/tabledrawer.js';\nimport RTableDisplay from './components/rtabledisplay.js';\nimport TownDisplay from './components/towndisplay.js';\nimport NotesList from './components/noteslist.js';\nimport NoteDisplay from './components/notedisplay.js';\nimport DiceRoller from './components/diceroller.js';\nimport NPCsList from './components/npcslist.js';\nimport NPCDisplay from './components/npcdisplay.js';\n\nimport { setupPage } from './services/importExportService.js';\n\nif (document.body.id === 'page-settings') {\n setupPage();\n}\n"], - "mappings": "2mBAAA,gCACA,OAAO,eAAe,GAAS,aAAc,CAAE,MAAO,KACtD,GAAQ,cAAgB,GAAQ,MAAQ,GAAQ,UAAY,GAAQ,MAAQ,GAAQ,KAAO,OAC3F,GAAO,QAAU,GAAU,GAC3B,GAAQ,QAAU,GAClB,aAAgB,CAEZ,OADI,GAAQ,GACH,EAAK,EAAG,EAAK,UAAU,OAAQ,IACpC,EAAM,GAAM,UAAU,GAE1B,MAAO,IAAM,MAAM,OAAQ,GAE/B,GAAQ,KAAO,GACf,GAAK,MAAQ,GACb,GAAK,cAAgB,GACrB,GAAK,UAAY,GACjB,aAAiB,CAEb,OADI,GAAQ,GACH,EAAK,EAAG,EA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AS,CACL,YACA,aACA,iBACA,gBACA,SACA,UACA,cACA,sBACA,cACA,cACA,eACA,uBACA,QACA,oBACA,sCAEJ,OAAQ,CACJ,QACA,iBACA,aACA,YACA,YACA,WACA,uDACA,oBACA,mBACA,UACA,iBACA,YACA,6BACA,YACA,mCACA,0CAIZ,CACI,GAAI,EACJ,IAAK,YACL,MAAO,4BACP,OAAQ,CACJ,QAAS,CACL,0DACA,6CACA,eACA,0BACA,0BACA,iBACA,cACA,aACA,iBACA,cACA,0CAIZ,CACI,GAAI,EACJ,IAAK,YACL,MAAO,uBACP,OAAQ,CACJ,QAAS,CACL,OACA,SACA,WACA,QACA,UACA,eAIZ,CACI,GAAI,GACJ,IAAK,YACL,MAAO,aACP,YAAa,CACT,CAAE,MAAO,OAAQ,WAAY,IAC7B,CAAE,MAAO,UAAW,WAAY,IAChC,CAAE,MAAO,UAAW,WAAY,KAEpC,OAAQ,CACJ,QAAS,CACL,CAAE,MAAO,4CAA6C,OAAQ,GAC9D,CAAE,MAAO,6CAA8C,OAAQ,GAC/D,CAAE,MAAO,2BAA4B,OAAQ,IAEjD,KAAM,CACF,SACA,QACA,QACA,QACA,MACA,OACA,OACA,MACA,QACA,MACA,SACA,UACA,aACA,SACA,WACA,UACA,QACA,OACA,SACA,SACA,SACA,QAEJ,QAAS,CACL,QACA,OACA,OACA,SAEJ,QAAS,CACL,SACA,QACA,OACA,QACA,aCvgBhB,GAAO,IAAQ,CACd,CACC,IAAO,UACP,MAAS,UACT,KAAQ,CACP,OACA,QACA,SACA,SACA,UACA,UACA,SACA,OACA,SACA,QACA,QACA,YACA,WACA,UACS,OACT,UACA,OACA,OACA,SACA,OACA,YACA,SACA,WACA,UACA,WACA,UACA,SACA,SACA,UACA,WACA,WACA,UACA,WACA,SACA,QACA,QACA,WACA,UACA,YACA,aACA,SACA,QACA,SACA,MACA,SACA,QACA,QACA,SACA,SACA,QACA,WACA,WACA,SACA,QACA,aACA,YACA,SACA,WACA,YACA,UACA,UACA,QACA,OACA,UACA,UACA,WACA,UACA,YACA,UACA,YACA,UACA,MACA,SACA,UACA,SACA,QACA,OACA,gBACA,eACA,WACA,WACA,SACA,QACA,QACA,UACA,SACA,UACA,aACA,SACA,MACA,QACA,QACA,SACA,OACA,SACA,SACA,UACA,SACA,aACA,SACA,SACA,UACA,SACA,QACA,SACA,UACA,OACA,WACA,SACA,QACA,aACA,UACA,WACA,UACA,SACA,QACA,SACA,QACA,SACA,SACA,eACA,QACA,QACA,UACA,cACA,eACA,SACA,UACA,SACA,WACA,SACA,UACA,SACS,OACA,MACT,UACA,OACA,SACA,OACA,YACA,SACA,WACA,UACA,QACA,SACA,WACA,OACA,MACA,WACA,WACA,OACA,MACA,OACA,SACA,SACA,QACA,aACA,YACA,SACA,YACA,QACA,SACA,OACA,OACA,KACA,QACA,OACA,QACA,QACA,SACA,QACA,YACA,QACA,QACA,OACA,WACA,SACA,UACA,SACA,QACA,UACA,UACA,OACA,UACA,SACA,aACA,SACA,OACA,QACA,MACA,SACA,MACA,QACA,QACA,WACA,SACA,QACA,SACA,QACA,UACA,OACA,MACA,UACA,UACA,OACA,QACA,QACA,SACA,QACA,OACA,SACA,MACA,UACA,OACA,OACA,OACA,OACA,SACA,OACA,SACA,OACA,QACA,SACA,YACA,UACA,MACA,SACA,QACA,MACA,QACA,SACA,SACA,SACA,YACA,QACA,SACA,SACA,OACA,OACA,SACA,MACA,MACA,UACA,SACA,SACA,QACA,SACS,OACT,QACA,SACA,OACA,UACA,SACA,aACA,SACA,OACA,OACA,SACA,SACA,WACA,UACA,SACA,SACA,SACA,QACA,WACA,OACA,UACA,OACA,SACA,UACA,SACA,SACA,QACA,SACA,QACA,UACA,SACS,QACT,OACA,SACA,SACA,OACA,MACA,MACA,OACA,QACA,UACS,WACA,OACA,UACA,SACA,UACA,YACA,QACA,UACA,SACA,UACA,UACA,SACA,YACA,QACA,SACA,YACA,YACA,WACA,UACA,UACA,SACA,QACA,eACA,WACA,SACA,cACA,WACA,QACA,aACA,YACA,QACA,eACA,UACA,SACA,UACA,WACA,MACA,OACA,WACA,eACA,WACA,QACA,UACA,UACA,UACA,SACA,WACA,WACA,SACA,UACA,UACA,WACA,QACA,WACA,WACA,YACA,SACA,WACA,WACA,QACA,SACA,aACA,YACA,UACA,YACA,UACA,UACA,UACA,YACA,YACA,UACA,WACA,YACA,YACA,WACA,OACA,UACA,QACA,UACA,QACA,SACA,WACA,UACA,OACA,QACA,OACA,kBACA,eACA,iBACA,OACA,cACA,cACA,aACA,QACA,WACA,UACA,UACA,QACA,OACA,OACA,SACA,SACA,QACA,UACA,QACA,QACA,SACA,QACA,YACA,UACA,WACA,QACA,OACA,SACA,QACA,OACA,aACA,SACA,WACA,UACA,WACA,UACA,UACA,UACA,WACA,SACA,SACA,SACA,SACA,WACA,SACA,WACA,OACA,WACA,cACA,UACA,YACA,YAEV,OAAU,CACA,QACT,SACA,QACA,MACA,YACA,QACA,WACA,SACA,OACA,SACA,UACA,UACS,QACT,YACA,YACA,SACA,QACA,SACA,SACA,WACA,YACA,QACA,OACA,UACA,OACA,YACA,UACA,UACA,UACA,WACA,QACA,WACA,YACA,UACA,YACA,YACA,YACA,UACA,YACA,SACA,SACA,SACA,QACA,OACA,WACA,QACA,YACA,QACA,QACA,OACA,SACA,MACA,UACA,UACA,WACA,SACA,WACA,QACA,SACA,SACA,YACA,YACA,QACA,QACA,MACA,QACA,OACA,WACA,WACA,QACA,UACA,QACA,UACA,UACA,QACA,UACA,OACA,QACA,SACA,QACA,OACA,SACA,SACA,QACA,YACA,QACA,WACA,UACA,OACA,UACA,MACA,WACA,OACA,SACA,UACA,OACA,QACA,QACA,SACA,UACA,SACA,WACA,OACA,UACA,WACA,SACA,OACA,SACA,SACA,UACA,OACA,QACA,SACA,UACA,OACA,YACA,QACA,SACA,SACA,MACA,QACA,OACA,WACA,SACA,OACA,QACA,UACA,SACA,QACA,SACA,SACS,iBACT,UACA,WACA,UACA,YACA,OACA,YACA,cACA,SACA,QACA,OACA,WACA,YACA,WACA,eACA,OACA,YACA,OACA,UACA,QACA,aACA,QACA,SACA,YACA,SACA,UACA,UACA,cACA,iBACA,aACA,SACA,UACA,WACA,UACA,WACA,YACA,YACA,YACA,aACA,YACA,WACA,YACA,SACA,WACA,YACA,gBACA,UACA,YACA,WACA,YACA,aACA,SACA,QACA,YACA,WACA,cACA,eACA,eACA,OACA,aACA,YACA,UACA,SACA,SACA,UACA,QACA,iBACA,OACA,WACA,aACA,WACA,UACA,YACA,eACA,YACA,WACA,OACA,WACA,aACA,SACA,YACA,WACA,WACA,OACA,WACA,aACA,WACA,UACA,UACA,SACA,eACA,SACA,UACA,QACA,WACA,UACA,OACA,SACA,QACA,SACA,UACA,YACA,SACA,WACA,QACA,UACA,SACA,aACA,YACA,WACA,UACA,UACA,SACA,SACA,WACA,SACA,OACA,UACA,iBACA,SACA,aACA,WACA,UACA,OACA,UACA,UACA,SACA,OACA,QACA,SACA,eACA,UACA,UACA,SACA,YACA,WACA,WACA,QACS,QACT,MACA,QACA,QACA,MACA,QACA,OACA,SACA,SACA,SACA,SACA,QACA,MACA,SACA,UACA,UACA,OACA,QACA,UACA,SACA,MACA,OACA,SACA,UACA,OACS,aACT,WACA,UACA,YACA,SACA,SACA,OACA,QACA,SACA,aACA,MACA,SACA,eACA,eACA,YACA,SACA,YACA,cACA,WACA,QACA,QACA,UACA,UACA,QACA,SACA,SACA,QACA,SACA,WACA,QACA,aACA,WACA,WACA,WACA,QACA,QACA,QACA,UACA,UACA,OACA,QACA,QACA,QACA,SACA,YACA,SACA,OACA,YACA,YACA,YACA,SACA,UACA,MACA,eACA,aACA,QACA,QACA,YACA,UACA,SACA,QACA,aACA,OACA,YACA,WACA,WACA,YACA,SACA,SACA,YACA,YACA,QACA,UACA,QACA,OACA,OACA,UACA,UACA,UACA,WACA,QACA,UACA,SACA,WACA,UACA,SACA,QACA,UACA,UACA,QACA,UACA,UACA,UACA,OACA,SACA,OACA,OACA,YACA,UACA,SACA,YACA,WACA,kBACA,oBACA,mBACA,oBACA,qBACA,oBACA,mBACA,iBACA,mBACA,UACA,kBACA,SACA,UACA,QACA,UACA,WACA,SACA,UACA,YACA,QACA,UACA,UACA,SACA,OACA,SACA,SACA,SACA,QACA,WACA,QACA,UACA,MACA,QACA,UACA,QACA,WACA,SACA,SACA,SACA,WACA,SACA,OACA,UACA,OACA,UACA,OACA,SACA,OACA,SACA,SACA,WACA,UACA,SACA,SACA,SACA,YACA,YACA,UACA,OACA,cACA,WACA,UACA,WACA,UACA,UACA,WAED,QAAW,CACV,SACA,OACA,WACA,QACA,OACA,QACA,UACA,SACA,WACA,UACA,QACA,OACA,QACA,MACA,MACA,SACA,cACA,UACA,OACA,SACA,QACA,UACA,WACA,QACA,SACA,QACA,OACA,OACA,SACA,QACA,QACA,OACA,OACA,MACA,OACA,QACA,WACA,QACA,SACA,SACA,WACA,QACA,UACA,QACA,UACA,UACA,UACA,SACA,UACA,SACA,SACA,SACA,UACA,aACA,UACA,QACA,SACA,QACA,SACA,QACA,SACA,WACA,UACA,YACA,SACA,UACA,SACA,SACA,QACA,QACA,SACA,WACA,UACA,OACA,OACA,QACA,QACA,cACA,SACA,QACA,SACA,OACA,UACA,WACA,QACA,SACA,UACA,QACA,SACA,OACA,SACA,UACA,WACA,SACA,SACA,OACA,SACA,SACA,WACA,SACA,UACA,OACA,OACA,QACA,SACA,SACA,QACA,OACA,SACA,SACA,QACA,QACA,UACA,SACA,UACA,UACA,SACA,YACA,SACA,YACA,WACA,gBACA,SACA,QACA,SACA,SACA,eACA,YACA,eACA,eACA,aACA,WACA,YACA,WACA,UACA,SACA,WACA,YACA,SACA,SACA,YACA,YACA,QACA,WACA,WACA,UACA,UACA,SACA,UACA,YACA,WACA,QACA,cACA,YACA,UACA,QACA,QACA,WACA,YACA,YACA,SACA,WACA,SACA,SACA,UACA,WACA,SACA,YACA,cACA,SACA,UACA,QACA,UACA,QACA,SACA,UACA,SACA,UACA,WACA,aACA,OACA,WACA,QACA,UACA,SACA,UACA,UACA,QACA,OACA,WACA,SACA,SACA,WACA,UACA,UACA,OACA,YACA,SACA,SACA,SACA,QACA,OACA,MACA,SACA,SACA,UACA,UACA,QACA,aACA,QACA,SACA,SACA,UACA,UACA,WACA,UACS,OACT,UACA,SACA,UACA,SACA,SACA,WACA,aACA,SACA,UACA,aACA,UACA,UACA,WACA,WACA,WACA,QACA,WACA,SACA,aACA,SACA,YACA,UACA,QACA,SACA,WACA,aACA,WACA,WACA,SACA,YACA,WACA,SACA,OACA,aACA,aACA,UACA,aACA,UACA,eACA,aACA,WACA,WACA,UACA,aACA,YACA,eACA,SACA,WACA,SACA,UACA,SACA,UACA,YACA,SACA,aACA,WACA,WACA,cACA,eACA,eACA,UACA,UACA,SACA,YACA,UACA,QACA,UACA,SACA,QACA,OACA,UACA,SACA,aACA,YACA,cACA,WACA,YACA,UACA,SACA,UACA,UACA,UACA,WACA,UACA,QACA,SACA,UACA,MACA,WACA,QACA,UACA,aACA,QACA,QACA,UACA,SACA,eACA,YACA,SACA,UACA,UACA,QACA,OACA,YACA,UACA,aACA,UACA,UACA,WACA,SACA,SACA,QACA,SACA,WACA,OACA,eACA,WC1sCH,YAAkC,CAC9B,aAAe,CACX,KAAK,OAAS,GACd,KAAK,MAAQ,GASjB,cAAe,EAAO,EAAU,CAC5B,MAAO,MAAK,OAAO,GAAO,UAAU,AAAC,GAC1B,EAAK,WAAa,GAUjC,GAAI,EAAO,EAAU,EAAW,KAAM,CAClC,GAAI,MAAO,IAAa,WAIxB,IADA,KAAK,OAAO,GAAS,KAAK,OAAO,IAAU,GACvC,KAAK,OAAO,GAAO,OAAS,EAAG,CAC/B,GAAM,GAAQ,KAAK,cAAc,EAAO,GAExC,AAAI,EAAQ,IACR,KAAK,OAAO,GAAO,OAAO,EAAO,GAGzC,KAAK,OAAO,GAAO,KAAK,CAAE,SAAU,EAAU,SAAU,KAS5D,IAAK,EAAO,EAAU,CAClB,GAAI,MAAM,QAAQ,KAAK,OAAO,IAAS,CACnC,GAAM,GAAQ,KAA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,GAAI,IAAK,OAI/B,GACH,EAAO,WAAW,KAItB,EAAW,MAAQ,KAOjB,GAAY,SAAU,EAAI,CAC5B,AAAI,CAAC,QAAQ,yBAGb,MACA,KACA,OAME,GAAY,UAAY,CAE1B,AADqB,SAAS,eAAe,cAChC,iBAAiB,QAAS,IAGvC,AADmB,SAAS,eAAe,cAChC,iBAAiB,SAAU,IAGtC,AADqB,SAAS,eAAe,cAChC,iBAAiB,QAAS,KCjG3C,AAAI,SAAS,KAAK,KAAO,iBACrB", + "sources": ["../node_modules/merge/lib/src/index.js", "../node_modules/redux-localstorage-simple/dist/index.js", "../node_modules/markdown-it/lib/common/entities.js", "../node_modules/uc.micro/categories/P/regex.js", "../node_modules/mdurl/encode.js", "../node_modules/mdurl/decode.js", "../node_modules/mdurl/format.js", "../node_modules/mdurl/parse.js", "../node_modules/mdurl/index.js", "../node_modules/uc.micro/properties/Any/regex.js", "../node_modules/uc.micro/categories/Cc/regex.js", "../node_modules/uc.micro/categories/Cf/regex.js", "../node_modules/uc.micro/categories/Z/regex.js", "../node_modules/uc.micro/index.js", "../node_modules/markdown-it/lib/common/utils.js", "../node_modules/markdown-it/lib/helpers/parse_link_label.js", "../node_modules/markdown-it/lib/helpers/parse_link_destination.js", "../node_modules/markdown-it/lib/helpers/parse_link_title.js", "../node_modules/markdown-it/lib/helpers/index.js", "../node_modules/markdown-it/lib/renderer.js", "../node_modules/markdown-it/lib/ruler.js", "../node_modules/markdown-it/lib/rules_core/normalize.js", "../node_modules/markdown-it/lib/rules_core/block.js", "../node_modules/markdown-it/lib/rules_core/inline.js", "../node_modules/markdown-it/lib/rules_core/linkify.js", "../node_modules/markdown-it/lib/rules_core/replacements.js", "../node_modules/markdown-it/lib/rules_core/smartquotes.js", "../node_modules/markdown-it/lib/token.js", "../node_modules/markdown-it/lib/rules_core/state_core.js", "../node_modules/markdown-it/lib/parser_core.js", "../node_modules/markdown-it/lib/rules_block/table.js", "../node_modules/markdown-it/lib/rules_block/code.js", "../node_modules/markdown-it/lib/rules_block/fence.js", "../node_modules/markdown-it/lib/rules_block/blockquote.js", "../node_modules/markdown-it/lib/rules_block/hr.js", "../node_modules/markdown-it/lib/rules_block/list.js", "../node_modules/markdown-it/lib/rules_block/reference.js", "../node_modules/markdown-it/lib/common/html_blocks.js", "../node_modules/markdown-it/lib/common/html_re.js", "../node_modules/markdown-it/lib/rules_block/html_block.js", "../node_modules/markdown-it/lib/rules_block/heading.js", "../node_modules/markdown-it/lib/rules_block/lheading.js", "../node_modules/markdown-it/lib/rules_block/paragraph.js", "../node_modules/markdown-it/lib/rules_block/state_block.js", "../node_modules/markdown-it/lib/parser_block.js", "../node_modules/markdown-it/lib/rules_inline/text.js", "../node_modules/markdown-it/lib/rules_inline/newline.js", "../node_modules/markdown-it/lib/rules_inline/escape.js", "../node_modules/markdown-it/lib/rules_inline/backticks.js", "../node_modules/markdown-it/lib/rules_inline/strikethrough.js", "../node_modules/markdown-it/lib/rules_inline/emphasis.js", "../node_modules/markdown-it/lib/rules_inline/link.js", "../node_modules/markdown-it/lib/rules_inline/image.js", "../node_modules/markdown-it/lib/rules_inline/autolink.js", "../node_modules/markdown-it/lib/rules_inline/html_inline.js", "../node_modules/markdown-it/lib/rules_inline/entity.js", "../node_modules/markdown-it/lib/rules_inline/balance_pairs.js", "../node_modules/markdown-it/lib/rules_inline/text_collapse.js", "../node_modules/markdown-it/lib/rules_inline/state_inline.js", "../node_modules/markdown-it/lib/parser_inline.js", "../node_modules/linkify-it/lib/re.js", "../node_modules/linkify-it/index.js", "../node_modules/punycode/punycode.js", "../node_modules/markdown-it/lib/presets/default.js", "../node_modules/markdown-it/lib/presets/zero.js", "../node_modules/markdown-it/lib/presets/commonmark.js", "../node_modules/markdown-it/lib/index.js", "../node_modules/markdown-it/index.js", "../node_modules/rpg-table-randomizer/src/r_helpers.js", "../node_modules/rpg-table-randomizer/src/DisplayOptions.js", "../node_modules/rpg-table-randomizer/src/RandomTableEntry.js", "../node_modules/rpg-table-randomizer/src/randomizer.js", "../node_modules/rpg-table-randomizer/src/RandomTable.js", "../node_modules/rpg-table-randomizer/src/RandomTableResult.js", "../node_modules/rpg-table-randomizer/src/TableErrorResult.js", "../node_modules/rpg-table-randomizer/src/RandomTableResultSet.js", "../node_modules/rpg-table-randomizer/src/dice_roller.js", "../node_modules/rpg-table-randomizer/src/TableError.js", "../node_modules/rpg-table-randomizer/src/TableRoller.js", "../node_modules/rpg-table-randomizer/src/MarkovGenerator.js", "../node_modules/rpg-table-randomizer/src/RandomNameError.js", "../node_modules/rpg-table-randomizer/src/RandomNameType.js", "../node_modules/rpg-table-randomizer/src/RandomNameGenerator.js", "../src/data/tables.js", "../src/data/names.js", "../src/models/EventEmitter.js", "../src/services/randomTableService.js", "../src/components/header.js", "../src/components/footer.js", "../node_modules/a11y-dialog/dist/a11y-dialog.esm.js", "../src/services/notesService.js", "../node_modules/immer/src/utils/errors.ts", "../node_modules/immer/src/utils/common.ts", "../node_modules/immer/src/utils/plugins.ts", "../node_modules/immer/src/core/scope.ts", "../node_modules/immer/src/core/finalize.ts", "../node_modules/immer/src/core/proxy.ts", "../node_modules/immer/src/core/immerClass.ts", "../node_modules/immer/src/core/current.ts", "../node_modules/immer/src/plugins/es5.ts", "../node_modules/immer/src/plugins/patches.ts", "../node_modules/immer/src/plugins/mapset.ts", "../node_modules/immer/src/plugins/all.ts", "../node_modules/immer/src/immer.ts", "../node_modules/immer/src/utils/env.ts", "../node_modules/@babel/runtime/helpers/esm/defineProperty.js", "../node_modules/@babel/runtime/helpers/esm/objectSpread2.js", "../node_modules/redux/es/redux.js", "../node_modules/redux-thunk/es/index.js", "../node_modules/@reduxjs/toolkit/src/index.ts", "../node_modules/@reduxjs/toolkit/src/createDraftSafeSelector.ts", "../node_modules/@reduxjs/toolkit/src/configureStore.ts", "../node_modules/@reduxjs/toolkit/src/devtoolsExtension.ts", "../node_modules/@reduxjs/toolkit/src/isPlainObject.ts", "../node_modules/@reduxjs/toolkit/src/getDefaultMiddleware.ts", "../node_modules/@reduxjs/toolkit/src/utils.ts", "../node_modules/@reduxjs/toolkit/src/immutableStateInvariantMiddleware.ts", "../node_modules/@reduxjs/toolkit/src/serializableStateInvariantMiddleware.ts", "../node_modules/@reduxjs/toolkit/src/createAction.ts", "../node_modules/@reduxjs/toolkit/src/createReducer.ts", "../node_modules/@reduxjs/toolkit/src/mapBuilders.ts", "../node_modules/@reduxjs/toolkit/src/createSlice.ts", "../node_modules/@reduxjs/toolkit/src/entities/entity_state.ts", "../node_modules/@reduxjs/toolkit/src/entities/state_selectors.ts", "../node_modules/@reduxjs/toolkit/src/entities/state_adapter.ts", "../node_modules/@reduxjs/toolkit/src/entities/utils.ts", "../node_modules/@reduxjs/toolkit/src/entities/unsorted_state_adapter.ts", "../node_modules/@reduxjs/toolkit/src/entities/sorted_state_adapter.ts", "../node_modules/@reduxjs/toolkit/src/entities/create_adapter.ts", "../node_modules/@reduxjs/toolkit/src/nanoid.ts", "../node_modules/@reduxjs/toolkit/src/createAsyncThunk.ts", "../node_modules/@reduxjs/toolkit/src/tsHelpers.ts", "../node_modules/@reduxjs/toolkit/src/matchers.ts", "../node_modules/@reduxjs/toolkit/dist/redux-toolkit.esm.js", "../src/store/notes-reducer.js", "../src/store/npcs-reducer.js", "../src/store/town-reducer.js", "../src/store/store.js", "../node_modules/uuid/dist/esm-browser/rng.js", "../node_modules/uuid/dist/esm-browser/regex.js", "../node_modules/uuid/dist/esm-browser/validate.js", "../node_modules/uuid/dist/esm-browser/stringify.js", "../node_modules/uuid/dist/esm-browser/v4.js", "../src/models/note.js", "../src/components/notedisplay.js", "../src/components/rtabledisplay.js", "../src/components/tabledrawer.js", "../node_modules/rpg-table-randomizer/src/NPC.js", "../node_modules/rpg-table-randomizer/src/NPCSchemaField.js", "../node_modules/rpg-table-randomizer/src/NPCSchema.js", "../src/models/town.js", "../src/services/townService.js", "../src/components/towndisplay.js", "../node_modules/sortablejs/modular/sortable.core.esm.js", "../src/components/itemList.js", "../src/components/noteslist.js", "../src/components/diceroller.js", "../src/services/npcService.js", "../src/models/npcSchema.js", "../src/models/npc.js", "../node_modules/rpg-table-randomizer/src/npc_generator.js", "../src/components/npcdisplay.js", "../src/components/npcslist.js", "../src/services/importExportService.js", "../src/index.js"], + "sourcesContent": ["\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.isPlainObject = exports.clone = exports.recursive = exports.merge = exports.main = void 0;\r\nmodule.exports = exports = main;\r\nexports.default = main;\r\nfunction main() {\r\n var items = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n items[_i] = arguments[_i];\r\n }\r\n return merge.apply(void 0, items);\r\n}\r\nexports.main = main;\r\nmain.clone = clone;\r\nmain.isPlainObject = isPlainObject;\r\nmain.recursive = recursive;\r\nfunction merge() {\r\n var items = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n items[_i] = arguments[_i];\r\n }\r\n return _merge(items[0] === true, false, items);\r\n}\r\nexports.merge = merge;\r\nfunction recursive() {\r\n var items = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n items[_i] = arguments[_i];\r\n }\r\n return _merge(items[0] === true, true, items);\r\n}\r\nexports.recursive = recursive;\r\nfunction clone(input) {\r\n if (Array.isArray(input)) {\r\n var output = [];\r\n for (var index = 0; index < input.length; ++index)\r\n output.push(clone(input[index]));\r\n return output;\r\n }\r\n else if (isPlainObject(input)) {\r\n var output = {};\r\n for (var index in input)\r\n output[index] = clone(input[index]);\r\n return output;\r\n }\r\n else {\r\n return input;\r\n }\r\n}\r\nexports.clone = clone;\r\nfunction isPlainObject(input) {\r\n return input && typeof input === 'object' && !Array.isArray(input);\r\n}\r\nexports.isPlainObject = isPlainObject;\r\nfunction _recursiveMerge(base, extend) {\r\n if (!isPlainObject(base))\r\n return extend;\r\n for (var key in extend) {\r\n if (key === '__proto__' || key === 'constructor' || key === 'prototype')\r\n continue;\r\n base[key] = (isPlainObject(base[key]) && isPlainObject(extend[key])) ?\r\n _recursiveMerge(base[key], extend[key]) :\r\n extend[key];\r\n }\r\n return base;\r\n}\r\nfunction _merge(isClone, isRecursive, items) {\r\n var result;\r\n if (isClone || !isPlainObject(result = items.shift()))\r\n result = {};\r\n for (var index = 0; index < items.length; ++index) {\r\n var item = items[index];\r\n if (!isPlainObject(item))\r\n continue;\r\n for (var key in item) {\r\n if (key === '__proto__' || key === 'constructor' || key === 'prototype')\r\n continue;\r\n var value = isClone ? clone(item[key]) : item[key];\r\n result[key] = isRecursive ? _recursiveMerge(result[key], value) : value;\r\n }\r\n }\r\n return result;\r\n}\r\n", "'use strict';var _merge=_interopRequireDefault(require(\"merge\"));Object.defineProperty(exports,\"__esModule\",{value:!0}),exports.save=save,exports.load=load,exports.combineLoads=combineLoads,exports.clear=clear;function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _slicedToArray(a,b){return _arrayWithHoles(a)||_iterableToArrayLimit(a,b)||_unsupportedIterableToArray(a,b)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")}function _unsupportedIterableToArray(a,b){if(a){if(\"string\"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return\"Object\"===c&&a.constructor&&(c=a.constructor.name),\"Map\"===c||\"Set\"===c?Array.from(a):\"Arguments\"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c utf16string }\n//\n'use strict';\n\n/*eslint quotes:0*/\nmodule.exports = require('entities/lib/maps/entities.json');\n", "module.exports=/[!-#%-\\*,-\\/:;\\?@\\[-\\]_\\{\\}\\xA1\\xA7\\xAB\\xB6\\xB7\\xBB\\xBF\\u037E\\u0387\\u055A-\\u055F\\u0589\\u058A\\u05BE\\u05C0\\u05C3\\u05C6\\u05F3\\u05F4\\u0609\\u060A\\u060C\\u060D\\u061B\\u061E\\u061F\\u066A-\\u066D\\u06D4\\u0700-\\u070D\\u07F7-\\u07F9\\u0830-\\u083E\\u085E\\u0964\\u0965\\u0970\\u09FD\\u0A76\\u0AF0\\u0C84\\u0DF4\\u0E4F\\u0E5A\\u0E5B\\u0F04-\\u0F12\\u0F14\\u0F3A-\\u0F3D\\u0F85\\u0FD0-\\u0FD4\\u0FD9\\u0FDA\\u104A-\\u104F\\u10FB\\u1360-\\u1368\\u1400\\u166D\\u166E\\u169B\\u169C\\u16EB-\\u16ED\\u1735\\u1736\\u17D4-\\u17D6\\u17D8-\\u17DA\\u1800-\\u180A\\u1944\\u1945\\u1A1E\\u1A1F\\u1AA0-\\u1AA6\\u1AA8-\\u1AAD\\u1B5A-\\u1B60\\u1BFC-\\u1BFF\\u1C3B-\\u1C3F\\u1C7E\\u1C7F\\u1CC0-\\u1CC7\\u1CD3\\u2010-\\u2027\\u2030-\\u2043\\u2045-\\u2051\\u2053-\\u205E\\u207D\\u207E\\u208D\\u208E\\u2308-\\u230B\\u2329\\u232A\\u2768-\\u2775\\u27C5\\u27C6\\u27E6-\\u27EF\\u2983-\\u2998\\u29D8-\\u29DB\\u29FC\\u29FD\\u2CF9-\\u2CFC\\u2CFE\\u2CFF\\u2D70\\u2E00-\\u2E2E\\u2E30-\\u2E4E\\u3001-\\u3003\\u3008-\\u3011\\u3014-\\u301F\\u3030\\u303D\\u30A0\\u30FB\\uA4FE\\uA4FF\\uA60D-\\uA60F\\uA673\\uA67E\\uA6F2-\\uA6F7\\uA874-\\uA877\\uA8CE\\uA8CF\\uA8F8-\\uA8FA\\uA8FC\\uA92E\\uA92F\\uA95F\\uA9C1-\\uA9CD\\uA9DE\\uA9DF\\uAA5C-\\uAA5F\\uAADE\\uAADF\\uAAF0\\uAAF1\\uABEB\\uFD3E\\uFD3F\\uFE10-\\uFE19\\uFE30-\\uFE52\\uFE54-\\uFE61\\uFE63\\uFE68\\uFE6A\\uFE6B\\uFF01-\\uFF03\\uFF05-\\uFF0A\\uFF0C-\\uFF0F\\uFF1A\\uFF1B\\uFF1F\\uFF20\\uFF3B-\\uFF3D\\uFF3F\\uFF5B\\uFF5D\\uFF5F-\\uFF65]|\\uD800[\\uDD00-\\uDD02\\uDF9F\\uDFD0]|\\uD801\\uDD6F|\\uD802[\\uDC57\\uDD1F\\uDD3F\\uDE50-\\uDE58\\uDE7F\\uDEF0-\\uDEF6\\uDF39-\\uDF3F\\uDF99-\\uDF9C]|\\uD803[\\uDF55-\\uDF59]|\\uD804[\\uDC47-\\uDC4D\\uDCBB\\uDCBC\\uDCBE-\\uDCC1\\uDD40-\\uDD43\\uDD74\\uDD75\\uDDC5-\\uDDC8\\uDDCD\\uDDDB\\uDDDD-\\uDDDF\\uDE38-\\uDE3D\\uDEA9]|\\uD805[\\uDC4B-\\uDC4F\\uDC5B\\uDC5D\\uDCC6\\uDDC1-\\uDDD7\\uDE41-\\uDE43\\uDE60-\\uDE6C\\uDF3C-\\uDF3E]|\\uD806[\\uDC3B\\uDE3F-\\uDE46\\uDE9A-\\uDE9C\\uDE9E-\\uDEA2]|\\uD807[\\uDC41-\\uDC45\\uDC70\\uDC71\\uDEF7\\uDEF8]|\\uD809[\\uDC70-\\uDC74]|\\uD81A[\\uDE6E\\uDE6F\\uDEF5\\uDF37-\\uDF3B\\uDF44]|\\uD81B[\\uDE97-\\uDE9A]|\\uD82F\\uDC9F|\\uD836[\\uDE87-\\uDE8B]|\\uD83A[\\uDD5E\\uDD5F]/", "\n'use strict';\n\n\nvar encodeCache = {};\n\n\n// Create a lookup array where anything but characters in `chars` string\n// and alphanumeric chars is percent-encoded.\n//\nfunction getEncodeCache(exclude) {\n var i, ch, cache = encodeCache[exclude];\n if (cache) { return cache; }\n\n cache = encodeCache[exclude] = [];\n\n for (i = 0; i < 128; i++) {\n ch = String.fromCharCode(i);\n\n if (/^[0-9a-z]$/i.test(ch)) {\n // always allow unencoded alphanumeric characters\n cache.push(ch);\n } else {\n cache.push('%' + ('0' + i.toString(16).toUpperCase()).slice(-2));\n }\n }\n\n for (i = 0; i < exclude.length; i++) {\n cache[exclude.charCodeAt(i)] = exclude[i];\n }\n\n return cache;\n}\n\n\n// Encode unsafe characters with percent-encoding, skipping already\n// encoded sequences.\n//\n// - string - string to encode\n// - exclude - list of characters to ignore (in addition to a-zA-Z0-9)\n// - keepEscaped - don't encode '%' in a correct escape sequence (default: true)\n//\nfunction encode(string, exclude, keepEscaped) {\n var i, l, code, nextCode, cache,\n result = '';\n\n if (typeof exclude !== 'string') {\n // encode(string, keepEscaped)\n keepEscaped = exclude;\n exclude = encode.defaultChars;\n }\n\n if (typeof keepEscaped === 'undefined') {\n keepEscaped = true;\n }\n\n cache = getEncodeCache(exclude);\n\n for (i = 0, l = string.length; i < l; i++) {\n code = string.charCodeAt(i);\n\n if (keepEscaped && code === 0x25 /* % */ && i + 2 < l) {\n if (/^[0-9a-f]{2}$/i.test(string.slice(i + 1, i + 3))) {\n result += string.slice(i, i + 3);\n i += 2;\n continue;\n }\n }\n\n if (code < 128) {\n result += cache[code];\n continue;\n }\n\n if (code >= 0xD800 && code <= 0xDFFF) {\n if (code >= 0xD800 && code <= 0xDBFF && i + 1 < l) {\n nextCode = string.charCodeAt(i + 1);\n if (nextCode >= 0xDC00 && nextCode <= 0xDFFF) {\n result += encodeURIComponent(string[i] + string[i + 1]);\n i++;\n continue;\n }\n }\n result += '%EF%BF%BD';\n continue;\n }\n\n result += encodeURIComponent(string[i]);\n }\n\n return result;\n}\n\nencode.defaultChars = \";/?:@&=+$,-_.!~*'()#\";\nencode.componentChars = \"-_.!~*'()\";\n\n\nmodule.exports = encode;\n", "\n'use strict';\n\n\n/* eslint-disable no-bitwise */\n\nvar decodeCache = {};\n\nfunction getDecodeCache(exclude) {\n var i, ch, cache = decodeCache[exclude];\n if (cache) { return cache; }\n\n cache = decodeCache[exclude] = [];\n\n for (i = 0; i < 128; i++) {\n ch = String.fromCharCode(i);\n cache.push(ch);\n }\n\n for (i = 0; i < exclude.length; i++) {\n ch = exclude.charCodeAt(i);\n cache[ch] = '%' + ('0' + ch.toString(16).toUpperCase()).slice(-2);\n }\n\n return cache;\n}\n\n\n// Decode percent-encoded string.\n//\nfunction decode(string, exclude) {\n var cache;\n\n if (typeof exclude !== 'string') {\n exclude = decode.defaultChars;\n }\n\n cache = getDecodeCache(exclude);\n\n return string.replace(/(%[a-f0-9]{2})+/gi, function(seq) {\n var i, l, b1, b2, b3, b4, chr,\n result = '';\n\n for (i = 0, l = seq.length; i < l; i += 3) {\n b1 = parseInt(seq.slice(i + 1, i + 3), 16);\n\n if (b1 < 0x80) {\n result += cache[b1];\n continue;\n }\n\n if ((b1 & 0xE0) === 0xC0 && (i + 3 < l)) {\n // 110xxxxx 10xxxxxx\n b2 = parseInt(seq.slice(i + 4, i + 6), 16);\n\n if ((b2 & 0xC0) === 0x80) {\n chr = ((b1 << 6) & 0x7C0) | (b2 & 0x3F);\n\n if (chr < 0x80) {\n result += '\\ufffd\\ufffd';\n } else {\n result += String.fromCharCode(chr);\n }\n\n i += 3;\n continue;\n }\n }\n\n if ((b1 & 0xF0) === 0xE0 && (i + 6 < l)) {\n // 1110xxxx 10xxxxxx 10xxxxxx\n b2 = parseInt(seq.slice(i + 4, i + 6), 16);\n b3 = parseInt(seq.slice(i + 7, i + 9), 16);\n\n if ((b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80) {\n chr = ((b1 << 12) & 0xF000) | ((b2 << 6) & 0xFC0) | (b3 & 0x3F);\n\n if (chr < 0x800 || (chr >= 0xD800 && chr <= 0xDFFF)) {\n result += '\\ufffd\\ufffd\\ufffd';\n } else {\n result += String.fromCharCode(chr);\n }\n\n i += 6;\n continue;\n }\n }\n\n if ((b1 & 0xF8) === 0xF0 && (i + 9 < l)) {\n // 111110xx 10xxxxxx 10xxxxxx 10xxxxxx\n b2 = parseInt(seq.slice(i + 4, i + 6), 16);\n b3 = parseInt(seq.slice(i + 7, i + 9), 16);\n b4 = parseInt(seq.slice(i + 10, i + 12), 16);\n\n if ((b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80 && (b4 & 0xC0) === 0x80) {\n chr = ((b1 << 18) & 0x1C0000) | ((b2 << 12) & 0x3F000) | ((b3 << 6) & 0xFC0) | (b4 & 0x3F);\n\n if (chr < 0x10000 || chr > 0x10FFFF) {\n result += '\\ufffd\\ufffd\\ufffd\\ufffd';\n } else {\n chr -= 0x10000;\n result += String.fromCharCode(0xD800 + (chr >> 10), 0xDC00 + (chr & 0x3FF));\n }\n\n i += 9;\n continue;\n }\n }\n\n result += '\\ufffd';\n }\n\n return result;\n });\n}\n\n\ndecode.defaultChars = ';/?:@&=+$,#';\ndecode.componentChars = '';\n\n\nmodule.exports = decode;\n", "\n'use strict';\n\n\nmodule.exports = function format(url) {\n var result = '';\n\n result += url.protocol || '';\n result += url.slashes ? '//' : '';\n result += url.auth ? url.auth + '@' : '';\n\n if (url.hostname && url.hostname.indexOf(':') !== -1) {\n // ipv6 address\n result += '[' + url.hostname + ']';\n } else {\n result += url.hostname || '';\n }\n\n result += url.port ? ':' + url.port : '';\n result += url.pathname || '';\n result += url.search || '';\n result += url.hash || '';\n\n return result;\n};\n", "// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n//\n// Changes from joyent/node:\n//\n// 1. No leading slash in paths,\n// e.g. in `url.parse('http://foo?bar')` pathname is ``, not `/`\n//\n// 2. Backslashes are not replaced with slashes,\n// so `http:\\\\example.org\\` is treated like a relative path\n//\n// 3. Trailing colon is treated like a part of the path,\n// i.e. in `http://example.org:foo` pathname is `:foo`\n//\n// 4. Nothing is URL-encoded in the resulting object,\n// (in joyent/node some chars in auth and paths are encoded)\n//\n// 5. `url.parse()` does not have `parseQueryString` argument\n//\n// 6. Removed extraneous result properties: `host`, `path`, `query`, etc.,\n// which can be constructed using other parts of the url.\n//\n\n\nfunction Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.pathname = null;\n}\n\n// Reference: RFC 3986, RFC 1808, RFC 2396\n\n// define these here so at least they only have to be\n// compiled once on the first module load.\nvar protocolPattern = /^([a-z0-9.+-]+:)/i,\n portPattern = /:[0-9]*$/,\n\n // Special case for a simple path URL\n simplePathPattern = /^(\\/\\/?(?!\\/)[^\\?\\s]*)(\\?[^\\s]*)?$/,\n\n // RFC 2396: characters reserved for delimiting URLs.\n // We actually just auto-escape these.\n delims = [ '<', '>', '\"', '`', ' ', '\\r', '\\n', '\\t' ],\n\n // RFC 2396: characters not allowed for various reasons.\n unwise = [ '{', '}', '|', '\\\\', '^', '`' ].concat(delims),\n\n // Allowed by RFCs, but cause of XSS attacks. Always escape these.\n autoEscape = [ '\\'' ].concat(unwise),\n // Characters that are never ever allowed in a hostname.\n // Note that any invalid chars are also handled, but these\n // are the ones that are *expected* to be seen, so we fast-path\n // them.\n nonHostChars = [ '%', '/', '?', ';', '#' ].concat(autoEscape),\n hostEndingChars = [ '/', '?', '#' ],\n hostnameMaxLen = 255,\n hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,\n hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,\n // protocols that can allow \"unsafe\" and \"unwise\" chars.\n /* eslint-disable no-script-url */\n // protocols that never have a hostname.\n hostlessProtocol = {\n 'javascript': true,\n 'javascript:': true\n },\n // protocols that always contain a // bit.\n slashedProtocol = {\n 'http': true,\n 'https': true,\n 'ftp': true,\n 'gopher': true,\n 'file': true,\n 'http:': true,\n 'https:': true,\n 'ftp:': true,\n 'gopher:': true,\n 'file:': true\n };\n /* eslint-enable no-script-url */\n\nfunction urlParse(url, slashesDenoteHost) {\n if (url && url instanceof Url) { return url; }\n\n var u = new Url();\n u.parse(url, slashesDenoteHost);\n return u;\n}\n\nUrl.prototype.parse = function(url, slashesDenoteHost) {\n var i, l, lowerProto, hec, slashes,\n rest = url;\n\n // trim before proceeding.\n // This is to support parse stuff like \" http://foo.com \\n\"\n rest = rest.trim();\n\n if (!slashesDenoteHost && url.split('#').length === 1) {\n // Try fast path regexp\n var simplePath = simplePathPattern.exec(rest);\n if (simplePath) {\n this.pathname = simplePath[1];\n if (simplePath[2]) {\n this.search = simplePath[2];\n }\n return this;\n }\n }\n\n var proto = protocolPattern.exec(rest);\n if (proto) {\n proto = proto[0];\n lowerProto = proto.toLowerCase();\n this.protocol = proto;\n rest = rest.substr(proto.length);\n }\n\n // figure out if it's got a host\n // user@server is *always* interpreted as a hostname, and url\n // resolution will treat //foo/bar as host=foo,path=bar because that's\n // how the browser resolves relative URLs.\n if (slashesDenoteHost || proto || rest.match(/^\\/\\/[^@\\/]+@[^@\\/]+/)) {\n slashes = rest.substr(0, 2) === '//';\n if (slashes && !(proto && hostlessProtocol[proto])) {\n rest = rest.substr(2);\n this.slashes = true;\n }\n }\n\n if (!hostlessProtocol[proto] &&\n (slashes || (proto && !slashedProtocol[proto]))) {\n\n // there's a hostname.\n // the first instance of /, ?, ;, or # ends the host.\n //\n // If there is an @ in the hostname, then non-host chars *are* allowed\n // to the left of the last @ sign, unless some host-ending character\n // comes *before* the @-sign.\n // URLs are obnoxious.\n //\n // ex:\n // http://a@b@c/ => user:a@b host:c\n // http://a@b?@c => user:a host:c path:/?@c\n\n // v0.12 TODO(isaacs): This is not quite how Chrome does things.\n // Review our test case against browsers more comprehensively.\n\n // find the first instance of any hostEndingChars\n var hostEnd = -1;\n for (i = 0; i < hostEndingChars.length; i++) {\n hec = rest.indexOf(hostEndingChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) {\n hostEnd = hec;\n }\n }\n\n // at this point, either we have an explicit point where the\n // auth portion cannot go past, or the last @ char is the decider.\n var auth, atSign;\n if (hostEnd === -1) {\n // atSign can be anywhere.\n atSign = rest.lastIndexOf('@');\n } else {\n // atSign must be in auth portion.\n // http://a@b/c@d => host:b auth:a path:/c@d\n atSign = rest.lastIndexOf('@', hostEnd);\n }\n\n // Now we have a portion which is definitely the auth.\n // Pull that off.\n if (atSign !== -1) {\n auth = rest.slice(0, atSign);\n rest = rest.slice(atSign + 1);\n this.auth = auth;\n }\n\n // the host is the remaining to the left of the first non-host char\n hostEnd = -1;\n for (i = 0; i < nonHostChars.length; i++) {\n hec = rest.indexOf(nonHostChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) {\n hostEnd = hec;\n }\n }\n // if we still have not hit it, then the entire thing is a host.\n if (hostEnd === -1) {\n hostEnd = rest.length;\n }\n\n if (rest[hostEnd - 1] === ':') { hostEnd--; }\n var host = rest.slice(0, hostEnd);\n rest = rest.slice(hostEnd);\n\n // pull out port.\n this.parseHost(host);\n\n // we've indicated that there is a hostname,\n // so even if it's empty, it has to be present.\n this.hostname = this.hostname || '';\n\n // if hostname begins with [ and ends with ]\n // assume that it's an IPv6 address.\n var ipv6Hostname = this.hostname[0] === '[' &&\n this.hostname[this.hostname.length - 1] === ']';\n\n // validate a little.\n if (!ipv6Hostname) {\n var hostparts = this.hostname.split(/\\./);\n for (i = 0, l = hostparts.length; i < l; i++) {\n var part = hostparts[i];\n if (!part) { continue; }\n if (!part.match(hostnamePartPattern)) {\n var newpart = '';\n for (var j = 0, k = part.length; j < k; j++) {\n if (part.charCodeAt(j) > 127) {\n // we replace non-ASCII char with a temporary placeholder\n // we need this to make sure size of hostname is not\n // broken by replacing non-ASCII by nothing\n newpart += 'x';\n } else {\n newpart += part[j];\n }\n }\n // we test again with ASCII char only\n if (!newpart.match(hostnamePartPattern)) {\n var validParts = hostparts.slice(0, i);\n var notHost = hostparts.slice(i + 1);\n var bit = part.match(hostnamePartStart);\n if (bit) {\n validParts.push(bit[1]);\n notHost.unshift(bit[2]);\n }\n if (notHost.length) {\n rest = notHost.join('.') + rest;\n }\n this.hostname = validParts.join('.');\n break;\n }\n }\n }\n }\n\n if (this.hostname.length > hostnameMaxLen) {\n this.hostname = '';\n }\n\n // strip [ and ] from the hostname\n // the host field still retains them, though\n if (ipv6Hostname) {\n this.hostname = this.hostname.substr(1, this.hostname.length - 2);\n }\n }\n\n // chop off from the tail first.\n var hash = rest.indexOf('#');\n if (hash !== -1) {\n // got a fragment string.\n this.hash = rest.substr(hash);\n rest = rest.slice(0, hash);\n }\n var qm = rest.indexOf('?');\n if (qm !== -1) {\n this.search = rest.substr(qm);\n rest = rest.slice(0, qm);\n }\n if (rest) { this.pathname = rest; }\n if (slashedProtocol[lowerProto] &&\n this.hostname && !this.pathname) {\n this.pathname = '';\n }\n\n return this;\n};\n\nUrl.prototype.parseHost = function(host) {\n var port = portPattern.exec(host);\n if (port) {\n port = port[0];\n if (port !== ':') {\n this.port = port.substr(1);\n }\n host = host.substr(0, host.length - port.length);\n }\n if (host) { this.hostname = host; }\n};\n\nmodule.exports = urlParse;\n", "'use strict';\n\n\nmodule.exports.encode = require('./encode');\nmodule.exports.decode = require('./decode');\nmodule.exports.format = require('./format');\nmodule.exports.parse = require('./parse');\n", "module.exports=/[\\0-\\uD7FF\\uE000-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF]/", "module.exports=/[\\0-\\x1F\\x7F-\\x9F]/", "module.exports=/[\\xAD\\u0600-\\u0605\\u061C\\u06DD\\u070F\\u08E2\\u180E\\u200B-\\u200F\\u202A-\\u202E\\u2060-\\u2064\\u2066-\\u206F\\uFEFF\\uFFF9-\\uFFFB]|\\uD804[\\uDCBD\\uDCCD]|\\uD82F[\\uDCA0-\\uDCA3]|\\uD834[\\uDD73-\\uDD7A]|\\uDB40[\\uDC01\\uDC20-\\uDC7F]/", "module.exports=/[ \\xA0\\u1680\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000]/", "'use strict';\n\nexports.Any = require('./properties/Any/regex');\nexports.Cc = require('./categories/Cc/regex');\nexports.Cf = require('./categories/Cf/regex');\nexports.P = require('./categories/P/regex');\nexports.Z = require('./categories/Z/regex');\n", "// Utilities\n//\n'use strict';\n\n\nfunction _class(obj) { return Object.prototype.toString.call(obj); }\n\nfunction isString(obj) { return _class(obj) === '[object String]'; }\n\nvar _hasOwnProperty = Object.prototype.hasOwnProperty;\n\nfunction has(object, key) {\n return _hasOwnProperty.call(object, key);\n}\n\n// Merge objects\n//\nfunction assign(obj /*from1, from2, from3, ...*/) {\n var sources = Array.prototype.slice.call(arguments, 1);\n\n sources.forEach(function (source) {\n if (!source) { return; }\n\n if (typeof source !== 'object') {\n throw new TypeError(source + 'must be object');\n }\n\n Object.keys(source).forEach(function (key) {\n obj[key] = source[key];\n });\n });\n\n return obj;\n}\n\n// Remove element from array and put another array at those position.\n// Useful for some operations with tokens\nfunction arrayReplaceAt(src, pos, newElements) {\n return [].concat(src.slice(0, pos), newElements, src.slice(pos + 1));\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\nfunction isValidEntityCode(c) {\n /*eslint no-bitwise:0*/\n // broken sequence\n if (c >= 0xD800 && c <= 0xDFFF) { return false; }\n // never used\n if (c >= 0xFDD0 && c <= 0xFDEF) { return false; }\n if ((c & 0xFFFF) === 0xFFFF || (c & 0xFFFF) === 0xFFFE) { return false; }\n // control codes\n if (c >= 0x00 && c <= 0x08) { return false; }\n if (c === 0x0B) { return false; }\n if (c >= 0x0E && c <= 0x1F) { return false; }\n if (c >= 0x7F && c <= 0x9F) { return false; }\n // out of range\n if (c > 0x10FFFF) { return false; }\n return true;\n}\n\nfunction fromCodePoint(c) {\n /*eslint no-bitwise:0*/\n if (c > 0xffff) {\n c -= 0x10000;\n var surrogate1 = 0xd800 + (c >> 10),\n surrogate2 = 0xdc00 + (c & 0x3ff);\n\n return String.fromCharCode(surrogate1, surrogate2);\n }\n return String.fromCharCode(c);\n}\n\n\nvar UNESCAPE_MD_RE = /\\\\([!\"#$%&'()*+,\\-.\\/:;<=>?@[\\\\\\]^_`{|}~])/g;\nvar ENTITY_RE = /&([a-z#][a-z0-9]{1,31});/gi;\nvar UNESCAPE_ALL_RE = new RegExp(UNESCAPE_MD_RE.source + '|' + ENTITY_RE.source, 'gi');\n\nvar DIGITAL_ENTITY_TEST_RE = /^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i;\n\nvar entities = require('./entities');\n\nfunction replaceEntityPattern(match, name) {\n var code = 0;\n\n if (has(entities, name)) {\n return entities[name];\n }\n\n if (name.charCodeAt(0) === 0x23/* # */ && DIGITAL_ENTITY_TEST_RE.test(name)) {\n code = name[1].toLowerCase() === 'x' ?\n parseInt(name.slice(2), 16) : parseInt(name.slice(1), 10);\n\n if (isValidEntityCode(code)) {\n return fromCodePoint(code);\n }\n }\n\n return match;\n}\n\n/*function replaceEntities(str) {\n if (str.indexOf('&') < 0) { return str; }\n\n return str.replace(ENTITY_RE, replaceEntityPattern);\n}*/\n\nfunction unescapeMd(str) {\n if (str.indexOf('\\\\') < 0) { return str; }\n return str.replace(UNESCAPE_MD_RE, '$1');\n}\n\nfunction unescapeAll(str) {\n if (str.indexOf('\\\\') < 0 && str.indexOf('&') < 0) { return str; }\n\n return str.replace(UNESCAPE_ALL_RE, function (match, escaped, entity) {\n if (escaped) { return escaped; }\n return replaceEntityPattern(match, entity);\n });\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\nvar HTML_ESCAPE_TEST_RE = /[&<>\"]/;\nvar HTML_ESCAPE_REPLACE_RE = /[&<>\"]/g;\nvar HTML_REPLACEMENTS = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"'\n};\n\nfunction replaceUnsafeChar(ch) {\n return HTML_REPLACEMENTS[ch];\n}\n\nfunction escapeHtml(str) {\n if (HTML_ESCAPE_TEST_RE.test(str)) {\n return str.replace(HTML_ESCAPE_REPLACE_RE, replaceUnsafeChar);\n }\n return str;\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\nvar REGEXP_ESCAPE_RE = /[.?*+^$[\\]\\\\(){}|-]/g;\n\nfunction escapeRE(str) {\n return str.replace(REGEXP_ESCAPE_RE, '\\\\$&');\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\nfunction isSpace(code) {\n switch (code) {\n case 0x09:\n case 0x20:\n return true;\n }\n return false;\n}\n\n// Zs (unicode class) || [\\t\\f\\v\\r\\n]\nfunction isWhiteSpace(code) {\n if (code >= 0x2000 && code <= 0x200A) { return true; }\n switch (code) {\n case 0x09: // \\t\n case 0x0A: // \\n\n case 0x0B: // \\v\n case 0x0C: // \\f\n case 0x0D: // \\r\n case 0x20:\n case 0xA0:\n case 0x1680:\n case 0x202F:\n case 0x205F:\n case 0x3000:\n return true;\n }\n return false;\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\n/*eslint-disable max-len*/\nvar UNICODE_PUNCT_RE = require('uc.micro/categories/P/regex');\n\n// Currently without astral characters support.\nfunction isPunctChar(ch) {\n return UNICODE_PUNCT_RE.test(ch);\n}\n\n\n// Markdown ASCII punctuation characters.\n//\n// !, \", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \\, ], ^, _, `, {, |, }, or ~\n// http://spec.commonmark.org/0.15/#ascii-punctuation-character\n//\n// Don't confuse with unicode punctuation !!! It lacks some chars in ascii range.\n//\nfunction isMdAsciiPunct(ch) {\n switch (ch) {\n case 0x21/* ! */:\n case 0x22/* \" */:\n case 0x23/* # */:\n case 0x24/* $ */:\n case 0x25/* % */:\n case 0x26/* & */:\n case 0x27/* ' */:\n case 0x28/* ( */:\n case 0x29/* ) */:\n case 0x2A/* * */:\n case 0x2B/* + */:\n case 0x2C/* , */:\n case 0x2D/* - */:\n case 0x2E/* . */:\n case 0x2F/* / */:\n case 0x3A/* : */:\n case 0x3B/* ; */:\n case 0x3C/* < */:\n case 0x3D/* = */:\n case 0x3E/* > */:\n case 0x3F/* ? */:\n case 0x40/* @ */:\n case 0x5B/* [ */:\n case 0x5C/* \\ */:\n case 0x5D/* ] */:\n case 0x5E/* ^ */:\n case 0x5F/* _ */:\n case 0x60/* ` */:\n case 0x7B/* { */:\n case 0x7C/* | */:\n case 0x7D/* } */:\n case 0x7E/* ~ */:\n return true;\n default:\n return false;\n }\n}\n\n// Hepler to unify [reference labels].\n//\nfunction normalizeReference(str) {\n // Trim and collapse whitespace\n //\n str = str.trim().replace(/\\s+/g, ' ');\n\n // In node v10 '\u1E9E'.toLowerCase() === '\u1E7E', which is presumed to be a bug\n // fixed in v12 (couldn't find any details).\n //\n // So treat this one as a special case\n // (remove this when node v10 is no longer supported).\n //\n if ('\u1E9E'.toLowerCase() === '\u1E7E') {\n str = str.replace(/\u1E9E/g, '\u00DF');\n }\n\n // .toLowerCase().toUpperCase() should get rid of all differences\n // between letter variants.\n //\n // Simple .toLowerCase() doesn't normalize 125 code points correctly,\n // and .toUpperCase doesn't normalize 6 of them (list of exceptions:\n // \u0130, \u03F4, \u1E9E, \u2126, \u212A, \u212B - those are already uppercased, but have differently\n // uppercased versions).\n //\n // Here's an example showing how it happens. Lets take greek letter omega:\n // uppercase U+0398 (\u0398), U+03f4 (\u03F4) and lowercase U+03b8 (\u03B8), U+03d1 (\u03D1)\n //\n // Unicode entries:\n // 0398;GREEK CAPITAL LETTER THETA;Lu;0;L;;;;;N;;;;03B8;\n // 03B8;GREEK SMALL LETTER THETA;Ll;0;L;;;;;N;;;0398;;0398\n // 03D1;GREEK THETA SYMBOL;Ll;0;L; 03B8;;;;N;GREEK SMALL LETTER SCRIPT THETA;;0398;;0398\n // 03F4;GREEK CAPITAL THETA SYMBOL;Lu;0;L; 0398;;;;N;;;;03B8;\n //\n // Case-insensitive comparison should treat all of them as equivalent.\n //\n // But .toLowerCase() doesn't change \u03D1 (it's already lowercase),\n // and .toUpperCase() doesn't change \u03F4 (already uppercase).\n //\n // Applying first lower then upper case normalizes any character:\n // '\\u0398\\u03f4\\u03b8\\u03d1'.toLowerCase().toUpperCase() === '\\u0398\\u0398\\u0398\\u0398'\n //\n // Note: this is equivalent to unicode case folding; unicode normalization\n // is a different step that is not required here.\n //\n // Final result should be uppercased, because it's later stored in an object\n // (this avoid a conflict with Object.prototype members,\n // most notably, `__proto__`)\n //\n return str.toLowerCase().toUpperCase();\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\n// Re-export libraries commonly used in both markdown-it and its plugins,\n// so plugins won't have to depend on them explicitly, which reduces their\n// bundled size (e.g. a browser build).\n//\nexports.lib = {};\nexports.lib.mdurl = require('mdurl');\nexports.lib.ucmicro = require('uc.micro');\n\nexports.assign = assign;\nexports.isString = isString;\nexports.has = has;\nexports.unescapeMd = unescapeMd;\nexports.unescapeAll = unescapeAll;\nexports.isValidEntityCode = isValidEntityCode;\nexports.fromCodePoint = fromCodePoint;\n// exports.replaceEntities = replaceEntities;\nexports.escapeHtml = escapeHtml;\nexports.arrayReplaceAt = arrayReplaceAt;\nexports.isSpace = isSpace;\nexports.isWhiteSpace = isWhiteSpace;\nexports.isMdAsciiPunct = isMdAsciiPunct;\nexports.isPunctChar = isPunctChar;\nexports.escapeRE = escapeRE;\nexports.normalizeReference = normalizeReference;\n", "// Parse link label\n//\n// this function assumes that first character (\"[\") already matches;\n// returns the end of the label\n//\n'use strict';\n\nmodule.exports = function parseLinkLabel(state, start, disableNested) {\n var level, found, marker, prevPos,\n labelEnd = -1,\n max = state.posMax,\n oldPos = state.pos;\n\n state.pos = start + 1;\n level = 1;\n\n while (state.pos < max) {\n marker = state.src.charCodeAt(state.pos);\n if (marker === 0x5D /* ] */) {\n level--;\n if (level === 0) {\n found = true;\n break;\n }\n }\n\n prevPos = state.pos;\n state.md.inline.skipToken(state);\n if (marker === 0x5B /* [ */) {\n if (prevPos === state.pos - 1) {\n // increase level if we find text `[`, which is not a part of any token\n level++;\n } else if (disableNested) {\n state.pos = oldPos;\n return -1;\n }\n }\n }\n\n if (found) {\n labelEnd = state.pos;\n }\n\n // restore old state\n state.pos = oldPos;\n\n return labelEnd;\n};\n", "// Parse link destination\n//\n'use strict';\n\n\nvar unescapeAll = require('../common/utils').unescapeAll;\n\n\nmodule.exports = function parseLinkDestination(str, pos, max) {\n var code, level,\n lines = 0,\n start = pos,\n result = {\n ok: false,\n pos: 0,\n lines: 0,\n str: ''\n };\n\n if (str.charCodeAt(pos) === 0x3C /* < */) {\n pos++;\n while (pos < max) {\n code = str.charCodeAt(pos);\n if (code === 0x0A /* \\n */) { return result; }\n if (code === 0x3C /* < */) { return result; }\n if (code === 0x3E /* > */) {\n result.pos = pos + 1;\n result.str = unescapeAll(str.slice(start + 1, pos));\n result.ok = true;\n return result;\n }\n if (code === 0x5C /* \\ */ && pos + 1 < max) {\n pos += 2;\n continue;\n }\n\n pos++;\n }\n\n // no closing '>'\n return result;\n }\n\n // this should be ... } else { ... branch\n\n level = 0;\n while (pos < max) {\n code = str.charCodeAt(pos);\n\n if (code === 0x20) { break; }\n\n // ascii control characters\n if (code < 0x20 || code === 0x7F) { break; }\n\n if (code === 0x5C /* \\ */ && pos + 1 < max) {\n if (str.charCodeAt(pos + 1) === 0x20) { break; }\n pos += 2;\n continue;\n }\n\n if (code === 0x28 /* ( */) {\n level++;\n if (level > 32) { return result; }\n }\n\n if (code === 0x29 /* ) */) {\n if (level === 0) { break; }\n level--;\n }\n\n pos++;\n }\n\n if (start === pos) { return result; }\n if (level !== 0) { return result; }\n\n result.str = unescapeAll(str.slice(start, pos));\n result.lines = lines;\n result.pos = pos;\n result.ok = true;\n return result;\n};\n", "// Parse link title\n//\n'use strict';\n\n\nvar unescapeAll = require('../common/utils').unescapeAll;\n\n\nmodule.exports = function parseLinkTitle(str, pos, max) {\n var code,\n marker,\n lines = 0,\n start = pos,\n result = {\n ok: false,\n pos: 0,\n lines: 0,\n str: ''\n };\n\n if (pos >= max) { return result; }\n\n marker = str.charCodeAt(pos);\n\n if (marker !== 0x22 /* \" */ && marker !== 0x27 /* ' */ && marker !== 0x28 /* ( */) { return result; }\n\n pos++;\n\n // if opening marker is \"(\", switch it to closing marker \")\"\n if (marker === 0x28) { marker = 0x29; }\n\n while (pos < max) {\n code = str.charCodeAt(pos);\n if (code === marker) {\n result.pos = pos + 1;\n result.lines = lines;\n result.str = unescapeAll(str.slice(start + 1, pos));\n result.ok = true;\n return result;\n } else if (code === 0x28 /* ( */ && marker === 0x29 /* ) */) {\n return result;\n } else if (code === 0x0A) {\n lines++;\n } else if (code === 0x5C /* \\ */ && pos + 1 < max) {\n pos++;\n if (str.charCodeAt(pos) === 0x0A) {\n lines++;\n }\n }\n\n pos++;\n }\n\n return result;\n};\n", "// Just a shortcut for bulk export\n'use strict';\n\n\nexports.parseLinkLabel = require('./parse_link_label');\nexports.parseLinkDestination = require('./parse_link_destination');\nexports.parseLinkTitle = require('./parse_link_title');\n", "/**\n * class Renderer\n *\n * Generates HTML from parsed token stream. Each instance has independent\n * copy of rules. Those can be rewritten with ease. Also, you can add new\n * rules if you create plugin and adds new token types.\n **/\n'use strict';\n\n\nvar assign = require('./common/utils').assign;\nvar unescapeAll = require('./common/utils').unescapeAll;\nvar escapeHtml = require('./common/utils').escapeHtml;\n\n\n////////////////////////////////////////////////////////////////////////////////\n\nvar default_rules = {};\n\n\ndefault_rules.code_inline = function (tokens, idx, options, env, slf) {\n var token = tokens[idx];\n\n return '' +\n escapeHtml(tokens[idx].content) +\n '';\n};\n\n\ndefault_rules.code_block = function (tokens, idx, options, env, slf) {\n var token = tokens[idx];\n\n return '' +\n escapeHtml(tokens[idx].content) +\n '\\n';\n};\n\n\ndefault_rules.fence = function (tokens, idx, options, env, slf) {\n var token = tokens[idx],\n info = token.info ? unescapeAll(token.info).trim() : '',\n langName = '',\n langAttrs = '',\n highlighted, i, arr, tmpAttrs, tmpToken;\n\n if (info) {\n arr = info.split(/(\\s+)/g);\n langName = arr[0];\n langAttrs = arr.slice(2).join('');\n }\n\n if (options.highlight) {\n highlighted = options.highlight(token.content, langName, langAttrs) || escapeHtml(token.content);\n } else {\n highlighted = escapeHtml(token.content);\n }\n\n if (highlighted.indexOf(''\n + highlighted\n + '\\n';\n }\n\n\n return '
'\n        + highlighted\n        + '
\\n';\n};\n\n\ndefault_rules.image = function (tokens, idx, options, env, slf) {\n var token = tokens[idx];\n\n // \"alt\" attr MUST be set, even if empty. Because it's mandatory and\n // should be placed on proper position for tests.\n //\n // Replace content with actual value\n\n token.attrs[token.attrIndex('alt')][1] =\n slf.renderInlineAsText(token.children, options, env);\n\n return slf.renderToken(tokens, idx, options);\n};\n\n\ndefault_rules.hardbreak = function (tokens, idx, options /*, env */) {\n return options.xhtmlOut ? '
\\n' : '
\\n';\n};\ndefault_rules.softbreak = function (tokens, idx, options /*, env */) {\n return options.breaks ? (options.xhtmlOut ? '
\\n' : '
\\n') : '\\n';\n};\n\n\ndefault_rules.text = function (tokens, idx /*, options, env */) {\n return escapeHtml(tokens[idx].content);\n};\n\n\ndefault_rules.html_block = function (tokens, idx /*, options, env */) {\n return tokens[idx].content;\n};\ndefault_rules.html_inline = function (tokens, idx /*, options, env */) {\n return tokens[idx].content;\n};\n\n\n/**\n * new Renderer()\n *\n * Creates new [[Renderer]] instance and fill [[Renderer#rules]] with defaults.\n **/\nfunction Renderer() {\n\n /**\n * Renderer#rules -> Object\n *\n * Contains render rules for tokens. Can be updated and extended.\n *\n * ##### Example\n *\n * ```javascript\n * var md = require('markdown-it')();\n *\n * md.renderer.rules.strong_open = function () { return ''; };\n * md.renderer.rules.strong_close = function () { return ''; };\n *\n * var result = md.renderInline(...);\n * ```\n *\n * Each rule is called as independent static function with fixed signature:\n *\n * ```javascript\n * function my_token_render(tokens, idx, options, env, renderer) {\n * // ...\n * return renderedHTML;\n * }\n * ```\n *\n * See [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.js)\n * for more details and examples.\n **/\n this.rules = assign({}, default_rules);\n}\n\n\n/**\n * Renderer.renderAttrs(token) -> String\n *\n * Render token attributes to string.\n **/\nRenderer.prototype.renderAttrs = function renderAttrs(token) {\n var i, l, result;\n\n if (!token.attrs) { return ''; }\n\n result = '';\n\n for (i = 0, l = token.attrs.length; i < l; i++) {\n result += ' ' + escapeHtml(token.attrs[i][0]) + '=\"' + escapeHtml(token.attrs[i][1]) + '\"';\n }\n\n return result;\n};\n\n\n/**\n * Renderer.renderToken(tokens, idx, options) -> String\n * - tokens (Array): list of tokens\n * - idx (Numbed): token index to render\n * - options (Object): params of parser instance\n *\n * Default token renderer. Can be overriden by custom function\n * in [[Renderer#rules]].\n **/\nRenderer.prototype.renderToken = function renderToken(tokens, idx, options) {\n var nextToken,\n result = '',\n needLf = false,\n token = tokens[idx];\n\n // Tight list paragraphs\n if (token.hidden) {\n return '';\n }\n\n // Insert a newline between hidden paragraph and subsequent opening\n // block-level tag.\n //\n // For example, here we should insert a newline before blockquote:\n // - a\n // >\n //\n if (token.block && token.nesting !== -1 && idx && tokens[idx - 1].hidden) {\n result += '\\n';\n }\n\n // Add token name, e.g. ``.\n //\n needLf = false;\n }\n }\n }\n }\n\n result += needLf ? '>\\n' : '>';\n\n return result;\n};\n\n\n/**\n * Renderer.renderInline(tokens, options, env) -> String\n * - tokens (Array): list on block tokens to render\n * - options (Object): params of parser instance\n * - env (Object): additional data from parsed input (references, for example)\n *\n * The same as [[Renderer.render]], but for single token of `inline` type.\n **/\nRenderer.prototype.renderInline = function (tokens, options, env) {\n var type,\n result = '',\n rules = this.rules;\n\n for (var i = 0, len = tokens.length; i < len; i++) {\n type = tokens[i].type;\n\n if (typeof rules[type] !== 'undefined') {\n result += rules[type](tokens, i, options, env, this);\n } else {\n result += this.renderToken(tokens, i, options);\n }\n }\n\n return result;\n};\n\n\n/** internal\n * Renderer.renderInlineAsText(tokens, options, env) -> String\n * - tokens (Array): list on block tokens to render\n * - options (Object): params of parser instance\n * - env (Object): additional data from parsed input (references, for example)\n *\n * Special kludge for image `alt` attributes to conform CommonMark spec.\n * Don't try to use it! Spec requires to show `alt` content with stripped markup,\n * instead of simple escaping.\n **/\nRenderer.prototype.renderInlineAsText = function (tokens, options, env) {\n var result = '';\n\n for (var i = 0, len = tokens.length; i < len; i++) {\n if (tokens[i].type === 'text') {\n result += tokens[i].content;\n } else if (tokens[i].type === 'image') {\n result += this.renderInlineAsText(tokens[i].children, options, env);\n } else if (tokens[i].type === 'softbreak') {\n result += '\\n';\n }\n }\n\n return result;\n};\n\n\n/**\n * Renderer.render(tokens, options, env) -> String\n * - tokens (Array): list on block tokens to render\n * - options (Object): params of parser instance\n * - env (Object): additional data from parsed input (references, for example)\n *\n * Takes token stream and generates HTML. Probably, you will never need to call\n * this method directly.\n **/\nRenderer.prototype.render = function (tokens, options, env) {\n var i, len, type,\n result = '',\n rules = this.rules;\n\n for (i = 0, len = tokens.length; i < len; i++) {\n type = tokens[i].type;\n\n if (type === 'inline') {\n result += this.renderInline(tokens[i].children, options, env);\n } else if (typeof rules[type] !== 'undefined') {\n result += rules[tokens[i].type](tokens, i, options, env, this);\n } else {\n result += this.renderToken(tokens, i, options, env);\n }\n }\n\n return result;\n};\n\nmodule.exports = Renderer;\n", "/**\n * class Ruler\n *\n * Helper class, used by [[MarkdownIt#core]], [[MarkdownIt#block]] and\n * [[MarkdownIt#inline]] to manage sequences of functions (rules):\n *\n * - keep rules in defined order\n * - assign the name to each rule\n * - enable/disable rules\n * - add/replace rules\n * - allow assign rules to additional named chains (in the same)\n * - cacheing lists of active rules\n *\n * You will not need use this class directly until write plugins. For simple\n * rules control use [[MarkdownIt.disable]], [[MarkdownIt.enable]] and\n * [[MarkdownIt.use]].\n **/\n'use strict';\n\n\n/**\n * new Ruler()\n **/\nfunction Ruler() {\n // List of added rules. Each element is:\n //\n // {\n // name: XXX,\n // enabled: Boolean,\n // fn: Function(),\n // alt: [ name2, name3 ]\n // }\n //\n this.__rules__ = [];\n\n // Cached rule chains.\n //\n // First level - chain name, '' for default.\n // Second level - diginal anchor for fast filtering by charcodes.\n //\n this.__cache__ = null;\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// Helper methods, should not be used directly\n\n\n// Find rule index by name\n//\nRuler.prototype.__find__ = function (name) {\n for (var i = 0; i < this.__rules__.length; i++) {\n if (this.__rules__[i].name === name) {\n return i;\n }\n }\n return -1;\n};\n\n\n// Build rules lookup cache\n//\nRuler.prototype.__compile__ = function () {\n var self = this;\n var chains = [ '' ];\n\n // collect unique names\n self.__rules__.forEach(function (rule) {\n if (!rule.enabled) { return; }\n\n rule.alt.forEach(function (altName) {\n if (chains.indexOf(altName) < 0) {\n chains.push(altName);\n }\n });\n });\n\n self.__cache__ = {};\n\n chains.forEach(function (chain) {\n self.__cache__[chain] = [];\n self.__rules__.forEach(function (rule) {\n if (!rule.enabled) { return; }\n\n if (chain && rule.alt.indexOf(chain) < 0) { return; }\n\n self.__cache__[chain].push(rule.fn);\n });\n });\n};\n\n\n/**\n * Ruler.at(name, fn [, options])\n * - name (String): rule name to replace.\n * - fn (Function): new rule function.\n * - options (Object): new rule options (not mandatory).\n *\n * Replace rule by name with new function & options. Throws error if name not\n * found.\n *\n * ##### Options:\n *\n * - __alt__ - array with names of \"alternate\" chains.\n *\n * ##### Example\n *\n * Replace existing typographer replacement rule with new one:\n *\n * ```javascript\n * var md = require('markdown-it')();\n *\n * md.core.ruler.at('replacements', function replace(state) {\n * //...\n * });\n * ```\n **/\nRuler.prototype.at = function (name, fn, options) {\n var index = this.__find__(name);\n var opt = options || {};\n\n if (index === -1) { throw new Error('Parser rule not found: ' + name); }\n\n this.__rules__[index].fn = fn;\n this.__rules__[index].alt = opt.alt || [];\n this.__cache__ = null;\n};\n\n\n/**\n * Ruler.before(beforeName, ruleName, fn [, options])\n * - beforeName (String): new rule will be added before this one.\n * - ruleName (String): name of added rule.\n * - fn (Function): rule function.\n * - options (Object): rule options (not mandatory).\n *\n * Add new rule to chain before one with given name. See also\n * [[Ruler.after]], [[Ruler.push]].\n *\n * ##### Options:\n *\n * - __alt__ - array with names of \"alternate\" chains.\n *\n * ##### Example\n *\n * ```javascript\n * var md = require('markdown-it')();\n *\n * md.block.ruler.before('paragraph', 'my_rule', function replace(state) {\n * //...\n * });\n * ```\n **/\nRuler.prototype.before = function (beforeName, ruleName, fn, options) {\n var index = this.__find__(beforeName);\n var opt = options || {};\n\n if (index === -1) { throw new Error('Parser rule not found: ' + beforeName); }\n\n this.__rules__.splice(index, 0, {\n name: ruleName,\n enabled: true,\n fn: fn,\n alt: opt.alt || []\n });\n\n this.__cache__ = null;\n};\n\n\n/**\n * Ruler.after(afterName, ruleName, fn [, options])\n * - afterName (String): new rule will be added after this one.\n * - ruleName (String): name of added rule.\n * - fn (Function): rule function.\n * - options (Object): rule options (not mandatory).\n *\n * Add new rule to chain after one with given name. See also\n * [[Ruler.before]], [[Ruler.push]].\n *\n * ##### Options:\n *\n * - __alt__ - array with names of \"alternate\" chains.\n *\n * ##### Example\n *\n * ```javascript\n * var md = require('markdown-it')();\n *\n * md.inline.ruler.after('text', 'my_rule', function replace(state) {\n * //...\n * });\n * ```\n **/\nRuler.prototype.after = function (afterName, ruleName, fn, options) {\n var index = this.__find__(afterName);\n var opt = options || {};\n\n if (index === -1) { throw new Error('Parser rule not found: ' + afterName); }\n\n this.__rules__.splice(index + 1, 0, {\n name: ruleName,\n enabled: true,\n fn: fn,\n alt: opt.alt || []\n });\n\n this.__cache__ = null;\n};\n\n/**\n * Ruler.push(ruleName, fn [, options])\n * - ruleName (String): name of added rule.\n * - fn (Function): rule function.\n * - options (Object): rule options (not mandatory).\n *\n * Push new rule to the end of chain. See also\n * [[Ruler.before]], [[Ruler.after]].\n *\n * ##### Options:\n *\n * - __alt__ - array with names of \"alternate\" chains.\n *\n * ##### Example\n *\n * ```javascript\n * var md = require('markdown-it')();\n *\n * md.core.ruler.push('my_rule', function replace(state) {\n * //...\n * });\n * ```\n **/\nRuler.prototype.push = function (ruleName, fn, options) {\n var opt = options || {};\n\n this.__rules__.push({\n name: ruleName,\n enabled: true,\n fn: fn,\n alt: opt.alt || []\n });\n\n this.__cache__ = null;\n};\n\n\n/**\n * Ruler.enable(list [, ignoreInvalid]) -> Array\n * - list (String|Array): list of rule names to enable.\n * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.\n *\n * Enable rules with given names. If any rule name not found - throw Error.\n * Errors can be disabled by second param.\n *\n * Returns list of found rule names (if no exception happened).\n *\n * See also [[Ruler.disable]], [[Ruler.enableOnly]].\n **/\nRuler.prototype.enable = function (list, ignoreInvalid) {\n if (!Array.isArray(list)) { list = [ list ]; }\n\n var result = [];\n\n // Search by name and enable\n list.forEach(function (name) {\n var idx = this.__find__(name);\n\n if (idx < 0) {\n if (ignoreInvalid) { return; }\n throw new Error('Rules manager: invalid rule name ' + name);\n }\n this.__rules__[idx].enabled = true;\n result.push(name);\n }, this);\n\n this.__cache__ = null;\n return result;\n};\n\n\n/**\n * Ruler.enableOnly(list [, ignoreInvalid])\n * - list (String|Array): list of rule names to enable (whitelist).\n * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.\n *\n * Enable rules with given names, and disable everything else. If any rule name\n * not found - throw Error. Errors can be disabled by second param.\n *\n * See also [[Ruler.disable]], [[Ruler.enable]].\n **/\nRuler.prototype.enableOnly = function (list, ignoreInvalid) {\n if (!Array.isArray(list)) { list = [ list ]; }\n\n this.__rules__.forEach(function (rule) { rule.enabled = false; });\n\n this.enable(list, ignoreInvalid);\n};\n\n\n/**\n * Ruler.disable(list [, ignoreInvalid]) -> Array\n * - list (String|Array): list of rule names to disable.\n * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.\n *\n * Disable rules with given names. If any rule name not found - throw Error.\n * Errors can be disabled by second param.\n *\n * Returns list of found rule names (if no exception happened).\n *\n * See also [[Ruler.enable]], [[Ruler.enableOnly]].\n **/\nRuler.prototype.disable = function (list, ignoreInvalid) {\n if (!Array.isArray(list)) { list = [ list ]; }\n\n var result = [];\n\n // Search by name and disable\n list.forEach(function (name) {\n var idx = this.__find__(name);\n\n if (idx < 0) {\n if (ignoreInvalid) { return; }\n throw new Error('Rules manager: invalid rule name ' + name);\n }\n this.__rules__[idx].enabled = false;\n result.push(name);\n }, this);\n\n this.__cache__ = null;\n return result;\n};\n\n\n/**\n * Ruler.getRules(chainName) -> Array\n *\n * Return array of active functions (rules) for given chain name. It analyzes\n * rules configuration, compiles caches if not exists and returns result.\n *\n * Default chain name is `''` (empty string). It can't be skipped. That's\n * done intentionally, to keep signature monomorphic for high speed.\n **/\nRuler.prototype.getRules = function (chainName) {\n if (this.__cache__ === null) {\n this.__compile__();\n }\n\n // Chain can be empty, if rules disabled. But we still have to return Array.\n return this.__cache__[chainName] || [];\n};\n\nmodule.exports = Ruler;\n", "// Normalize input string\n\n'use strict';\n\n\n// https://spec.commonmark.org/0.29/#line-ending\nvar NEWLINES_RE = /\\r\\n?|\\n/g;\nvar NULL_RE = /\\0/g;\n\n\nmodule.exports = function normalize(state) {\n var str;\n\n // Normalize newlines\n str = state.src.replace(NEWLINES_RE, '\\n');\n\n // Replace NULL characters\n str = str.replace(NULL_RE, '\\uFFFD');\n\n state.src = str;\n};\n", "'use strict';\n\n\nmodule.exports = function block(state) {\n var token;\n\n if (state.inlineMode) {\n token = new state.Token('inline', '', 0);\n token.content = state.src;\n token.map = [ 0, 1 ];\n token.children = [];\n state.tokens.push(token);\n } else {\n state.md.block.parse(state.src, state.md, state.env, state.tokens);\n }\n};\n", "'use strict';\n\nmodule.exports = function inline(state) {\n var tokens = state.tokens, tok, i, l;\n\n // Parse inlines\n for (i = 0, l = tokens.length; i < l; i++) {\n tok = tokens[i];\n if (tok.type === 'inline') {\n state.md.inline.parse(tok.content, state.md, state.env, tok.children);\n }\n }\n};\n", "// Replace link-like texts with link nodes.\n//\n// Currently restricted by `md.validateLink()` to http/https/ftp\n//\n'use strict';\n\n\nvar arrayReplaceAt = require('../common/utils').arrayReplaceAt;\n\n\nfunction isLinkOpen(str) {\n return /^\\s]/i.test(str);\n}\nfunction isLinkClose(str) {\n return /^<\\/a\\s*>/i.test(str);\n}\n\n\nmodule.exports = function linkify(state) {\n var i, j, l, tokens, token, currentToken, nodes, ln, text, pos, lastPos,\n level, htmlLinkLevel, url, fullUrl, urlText,\n blockTokens = state.tokens,\n links;\n\n if (!state.md.options.linkify) { return; }\n\n for (j = 0, l = blockTokens.length; j < l; j++) {\n if (blockTokens[j].type !== 'inline' ||\n !state.md.linkify.pretest(blockTokens[j].content)) {\n continue;\n }\n\n tokens = blockTokens[j].children;\n\n htmlLinkLevel = 0;\n\n // We scan from the end, to keep position when new tags added.\n // Use reversed logic in links start/end match\n for (i = tokens.length - 1; i >= 0; i--) {\n currentToken = tokens[i];\n\n // Skip content of markdown links\n if (currentToken.type === 'link_close') {\n i--;\n while (tokens[i].level !== currentToken.level && tokens[i].type !== 'link_open') {\n i--;\n }\n continue;\n }\n\n // Skip content of html tag links\n if (currentToken.type === 'html_inline') {\n if (isLinkOpen(currentToken.content) && htmlLinkLevel > 0) {\n htmlLinkLevel--;\n }\n if (isLinkClose(currentToken.content)) {\n htmlLinkLevel++;\n }\n }\n if (htmlLinkLevel > 0) { continue; }\n\n if (currentToken.type === 'text' && state.md.linkify.test(currentToken.content)) {\n\n text = currentToken.content;\n links = state.md.linkify.match(text);\n\n // Now split string to nodes\n nodes = [];\n level = currentToken.level;\n lastPos = 0;\n\n for (ln = 0; ln < links.length; ln++) {\n\n url = links[ln].url;\n fullUrl = state.md.normalizeLink(url);\n if (!state.md.validateLink(fullUrl)) { continue; }\n\n urlText = links[ln].text;\n\n // Linkifier might send raw hostnames like \"example.com\", where url\n // starts with domain name. So we prepend http:// in those cases,\n // and remove it afterwards.\n //\n if (!links[ln].schema) {\n urlText = state.md.normalizeLinkText('http://' + urlText).replace(/^http:\\/\\//, '');\n } else if (links[ln].schema === 'mailto:' && !/^mailto:/i.test(urlText)) {\n urlText = state.md.normalizeLinkText('mailto:' + urlText).replace(/^mailto:/, '');\n } else {\n urlText = state.md.normalizeLinkText(urlText);\n }\n\n pos = links[ln].index;\n\n if (pos > lastPos) {\n token = new state.Token('text', '', 0);\n token.content = text.slice(lastPos, pos);\n token.level = level;\n nodes.push(token);\n }\n\n token = new state.Token('link_open', 'a', 1);\n token.attrs = [ [ 'href', fullUrl ] ];\n token.level = level++;\n token.markup = 'linkify';\n token.info = 'auto';\n nodes.push(token);\n\n token = new state.Token('text', '', 0);\n token.content = urlText;\n token.level = level;\n nodes.push(token);\n\n token = new state.Token('link_close', 'a', -1);\n token.level = --level;\n token.markup = 'linkify';\n token.info = 'auto';\n nodes.push(token);\n\n lastPos = links[ln].lastIndex;\n }\n if (lastPos < text.length) {\n token = new state.Token('text', '', 0);\n token.content = text.slice(lastPos);\n token.level = level;\n nodes.push(token);\n }\n\n // replace current node\n blockTokens[j].children = tokens = arrayReplaceAt(tokens, i, nodes);\n }\n }\n }\n};\n", "// Simple typographic replacements\n//\n// (c) (C) \u2192 \u00A9\n// (tm) (TM) \u2192 \u2122\n// (r) (R) \u2192 \u00AE\n// +- \u2192 \u00B1\n// (p) (P) -> \u00A7\n// ... \u2192 \u2026 (also ?.... \u2192 ?.., !.... \u2192 !..)\n// ???????? \u2192 ???, !!!!! \u2192 !!!, `,,` \u2192 `,`\n// -- \u2192 –, --- \u2192 —\n//\n'use strict';\n\n// TODO:\n// - fractionals 1/2, 1/4, 3/4 -> \u00BD, \u00BC, \u00BE\n// - miltiplication 2 x 4 -> 2 \u00D7 4\n\nvar RARE_RE = /\\+-|\\.\\.|\\?\\?\\?\\?|!!!!|,,|--/;\n\n// Workaround for phantomjs - need regex without /g flag,\n// or root check will fail every second time\nvar SCOPED_ABBR_TEST_RE = /\\((c|tm|r|p)\\)/i;\n\nvar SCOPED_ABBR_RE = /\\((c|tm|r|p)\\)/ig;\nvar SCOPED_ABBR = {\n c: '\u00A9',\n r: '\u00AE',\n p: '\u00A7',\n tm: '\u2122'\n};\n\nfunction replaceFn(match, name) {\n return SCOPED_ABBR[name.toLowerCase()];\n}\n\nfunction replace_scoped(inlineTokens) {\n var i, token, inside_autolink = 0;\n\n for (i = inlineTokens.length - 1; i >= 0; i--) {\n token = inlineTokens[i];\n\n if (token.type === 'text' && !inside_autolink) {\n token.content = token.content.replace(SCOPED_ABBR_RE, replaceFn);\n }\n\n if (token.type === 'link_open' && token.info === 'auto') {\n inside_autolink--;\n }\n\n if (token.type === 'link_close' && token.info === 'auto') {\n inside_autolink++;\n }\n }\n}\n\nfunction replace_rare(inlineTokens) {\n var i, token, inside_autolink = 0;\n\n for (i = inlineTokens.length - 1; i >= 0; i--) {\n token = inlineTokens[i];\n\n if (token.type === 'text' && !inside_autolink) {\n if (RARE_RE.test(token.content)) {\n token.content = token.content\n .replace(/\\+-/g, '\u00B1')\n // .., ..., ....... -> \u2026\n // but ?..... & !..... -> ?.. & !..\n .replace(/\\.{2,}/g, '\u2026').replace(/([?!])\u2026/g, '$1..')\n .replace(/([?!]){4,}/g, '$1$1$1').replace(/,{2,}/g, ',')\n // em-dash\n .replace(/(^|[^-])---(?=[^-]|$)/mg, '$1\\u2014')\n // en-dash\n .replace(/(^|\\s)--(?=\\s|$)/mg, '$1\\u2013')\n .replace(/(^|[^-\\s])--(?=[^-\\s]|$)/mg, '$1\\u2013');\n }\n }\n\n if (token.type === 'link_open' && token.info === 'auto') {\n inside_autolink--;\n }\n\n if (token.type === 'link_close' && token.info === 'auto') {\n inside_autolink++;\n }\n }\n}\n\n\nmodule.exports = function replace(state) {\n var blkIdx;\n\n if (!state.md.options.typographer) { return; }\n\n for (blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) {\n\n if (state.tokens[blkIdx].type !== 'inline') { continue; }\n\n if (SCOPED_ABBR_TEST_RE.test(state.tokens[blkIdx].content)) {\n replace_scoped(state.tokens[blkIdx].children);\n }\n\n if (RARE_RE.test(state.tokens[blkIdx].content)) {\n replace_rare(state.tokens[blkIdx].children);\n }\n\n }\n};\n", "// Convert straight quotation marks to typographic ones\n//\n'use strict';\n\n\nvar isWhiteSpace = require('../common/utils').isWhiteSpace;\nvar isPunctChar = require('../common/utils').isPunctChar;\nvar isMdAsciiPunct = require('../common/utils').isMdAsciiPunct;\n\nvar QUOTE_TEST_RE = /['\"]/;\nvar QUOTE_RE = /['\"]/g;\nvar APOSTROPHE = '\\u2019'; /* \u2019 */\n\n\nfunction replaceAt(str, index, ch) {\n return str.substr(0, index) + ch + str.substr(index + 1);\n}\n\nfunction process_inlines(tokens, state) {\n var i, token, text, t, pos, max, thisLevel, item, lastChar, nextChar,\n isLastPunctChar, isNextPunctChar, isLastWhiteSpace, isNextWhiteSpace,\n canOpen, canClose, j, isSingle, stack, openQuote, closeQuote;\n\n stack = [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n\n thisLevel = tokens[i].level;\n\n for (j = stack.length - 1; j >= 0; j--) {\n if (stack[j].level <= thisLevel) { break; }\n }\n stack.length = j + 1;\n\n if (token.type !== 'text') { continue; }\n\n text = token.content;\n pos = 0;\n max = text.length;\n\n /*eslint no-labels:0,block-scoped-var:0*/\n OUTER:\n while (pos < max) {\n QUOTE_RE.lastIndex = pos;\n t = QUOTE_RE.exec(text);\n if (!t) { break; }\n\n canOpen = canClose = true;\n pos = t.index + 1;\n isSingle = (t[0] === \"'\");\n\n // Find previous character,\n // default to space if it's the beginning of the line\n //\n lastChar = 0x20;\n\n if (t.index - 1 >= 0) {\n lastChar = text.charCodeAt(t.index - 1);\n } else {\n for (j = i - 1; j >= 0; j--) {\n if (tokens[j].type === 'softbreak' || tokens[j].type === 'hardbreak') break; // lastChar defaults to 0x20\n if (!tokens[j].content) continue; // should skip all tokens except 'text', 'html_inline' or 'code_inline'\n\n lastChar = tokens[j].content.charCodeAt(tokens[j].content.length - 1);\n break;\n }\n }\n\n // Find next character,\n // default to space if it's the end of the line\n //\n nextChar = 0x20;\n\n if (pos < max) {\n nextChar = text.charCodeAt(pos);\n } else {\n for (j = i + 1; j < tokens.length; j++) {\n if (tokens[j].type === 'softbreak' || tokens[j].type === 'hardbreak') break; // nextChar defaults to 0x20\n if (!tokens[j].content) continue; // should skip all tokens except 'text', 'html_inline' or 'code_inline'\n\n nextChar = tokens[j].content.charCodeAt(0);\n break;\n }\n }\n\n isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar));\n isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar));\n\n isLastWhiteSpace = isWhiteSpace(lastChar);\n isNextWhiteSpace = isWhiteSpace(nextChar);\n\n if (isNextWhiteSpace) {\n canOpen = false;\n } else if (isNextPunctChar) {\n if (!(isLastWhiteSpace || isLastPunctChar)) {\n canOpen = false;\n }\n }\n\n if (isLastWhiteSpace) {\n canClose = false;\n } else if (isLastPunctChar) {\n if (!(isNextWhiteSpace || isNextPunctChar)) {\n canClose = false;\n }\n }\n\n if (nextChar === 0x22 /* \" */ && t[0] === '\"') {\n if (lastChar >= 0x30 /* 0 */ && lastChar <= 0x39 /* 9 */) {\n // special case: 1\"\" - count first quote as an inch\n canClose = canOpen = false;\n }\n }\n\n if (canOpen && canClose) {\n // Replace quotes in the middle of punctuation sequence, but not\n // in the middle of the words, i.e.:\n //\n // 1. foo \" bar \" baz - not replaced\n // 2. foo-\"-bar-\"-baz - replaced\n // 3. foo\"bar\"baz - not replaced\n //\n canOpen = isLastPunctChar;\n canClose = isNextPunctChar;\n }\n\n if (!canOpen && !canClose) {\n // middle of word\n if (isSingle) {\n token.content = replaceAt(token.content, t.index, APOSTROPHE);\n }\n continue;\n }\n\n if (canClose) {\n // this could be a closing quote, rewind the stack to get a match\n for (j = stack.length - 1; j >= 0; j--) {\n item = stack[j];\n if (stack[j].level < thisLevel) { break; }\n if (item.single === isSingle && stack[j].level === thisLevel) {\n item = stack[j];\n\n if (isSingle) {\n openQuote = state.md.options.quotes[2];\n closeQuote = state.md.options.quotes[3];\n } else {\n openQuote = state.md.options.quotes[0];\n closeQuote = state.md.options.quotes[1];\n }\n\n // replace token.content *before* tokens[item.token].content,\n // because, if they are pointing at the same token, replaceAt\n // could mess up indices when quote length != 1\n token.content = replaceAt(token.content, t.index, closeQuote);\n tokens[item.token].content = replaceAt(\n tokens[item.token].content, item.pos, openQuote);\n\n pos += closeQuote.length - 1;\n if (item.token === i) { pos += openQuote.length - 1; }\n\n text = token.content;\n max = text.length;\n\n stack.length = j;\n continue OUTER;\n }\n }\n }\n\n if (canOpen) {\n stack.push({\n token: i,\n pos: t.index,\n single: isSingle,\n level: thisLevel\n });\n } else if (canClose && isSingle) {\n token.content = replaceAt(token.content, t.index, APOSTROPHE);\n }\n }\n }\n}\n\n\nmodule.exports = function smartquotes(state) {\n /*eslint max-depth:0*/\n var blkIdx;\n\n if (!state.md.options.typographer) { return; }\n\n for (blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) {\n\n if (state.tokens[blkIdx].type !== 'inline' ||\n !QUOTE_TEST_RE.test(state.tokens[blkIdx].content)) {\n continue;\n }\n\n process_inlines(state.tokens[blkIdx].children, state);\n }\n};\n", "// Token class\n\n'use strict';\n\n\n/**\n * class Token\n **/\n\n/**\n * new Token(type, tag, nesting)\n *\n * Create new token and fill passed properties.\n **/\nfunction Token(type, tag, nesting) {\n /**\n * Token#type -> String\n *\n * Type of the token (string, e.g. \"paragraph_open\")\n **/\n this.type = type;\n\n /**\n * Token#tag -> String\n *\n * html tag name, e.g. \"p\"\n **/\n this.tag = tag;\n\n /**\n * Token#attrs -> Array\n *\n * Html attributes. Format: `[ [ name1, value1 ], [ name2, value2 ] ]`\n **/\n this.attrs = null;\n\n /**\n * Token#map -> Array\n *\n * Source map info. Format: `[ line_begin, line_end ]`\n **/\n this.map = null;\n\n /**\n * Token#nesting -> Number\n *\n * Level change (number in {-1, 0, 1} set), where:\n *\n * - `1` means the tag is opening\n * - `0` means the tag is self-closing\n * - `-1` means the tag is closing\n **/\n this.nesting = nesting;\n\n /**\n * Token#level -> Number\n *\n * nesting level, the same as `state.level`\n **/\n this.level = 0;\n\n /**\n * Token#children -> Array\n *\n * An array of child nodes (inline and img tokens)\n **/\n this.children = null;\n\n /**\n * Token#content -> String\n *\n * In a case of self-closing tag (code, html, fence, etc.),\n * it has contents of this tag.\n **/\n this.content = '';\n\n /**\n * Token#markup -> String\n *\n * '*' or '_' for emphasis, fence string for fence, etc.\n **/\n this.markup = '';\n\n /**\n * Token#info -> String\n *\n * Additional information:\n *\n * - Info string for \"fence\" tokens\n * - The value \"auto\" for autolink \"link_open\" and \"link_close\" tokens\n * - The string value of the item marker for ordered-list \"list_item_open\" tokens\n **/\n this.info = '';\n\n /**\n * Token#meta -> Object\n *\n * A place for plugins to store an arbitrary data\n **/\n this.meta = null;\n\n /**\n * Token#block -> Boolean\n *\n * True for block-level tokens, false for inline tokens.\n * Used in renderer to calculate line breaks\n **/\n this.block = false;\n\n /**\n * Token#hidden -> Boolean\n *\n * If it's true, ignore this element when rendering. Used for tight lists\n * to hide paragraphs.\n **/\n this.hidden = false;\n}\n\n\n/**\n * Token.attrIndex(name) -> Number\n *\n * Search attribute index by name.\n **/\nToken.prototype.attrIndex = function attrIndex(name) {\n var attrs, i, len;\n\n if (!this.attrs) { return -1; }\n\n attrs = this.attrs;\n\n for (i = 0, len = attrs.length; i < len; i++) {\n if (attrs[i][0] === name) { return i; }\n }\n return -1;\n};\n\n\n/**\n * Token.attrPush(attrData)\n *\n * Add `[ name, value ]` attribute to list. Init attrs if necessary\n **/\nToken.prototype.attrPush = function attrPush(attrData) {\n if (this.attrs) {\n this.attrs.push(attrData);\n } else {\n this.attrs = [ attrData ];\n }\n};\n\n\n/**\n * Token.attrSet(name, value)\n *\n * Set `name` attribute to `value`. Override old value if exists.\n **/\nToken.prototype.attrSet = function attrSet(name, value) {\n var idx = this.attrIndex(name),\n attrData = [ name, value ];\n\n if (idx < 0) {\n this.attrPush(attrData);\n } else {\n this.attrs[idx] = attrData;\n }\n};\n\n\n/**\n * Token.attrGet(name)\n *\n * Get the value of attribute `name`, or null if it does not exist.\n **/\nToken.prototype.attrGet = function attrGet(name) {\n var idx = this.attrIndex(name), value = null;\n if (idx >= 0) {\n value = this.attrs[idx][1];\n }\n return value;\n};\n\n\n/**\n * Token.attrJoin(name, value)\n *\n * Join value to existing attribute via space. Or create new attribute if not\n * exists. Useful to operate with token classes.\n **/\nToken.prototype.attrJoin = function attrJoin(name, value) {\n var idx = this.attrIndex(name);\n\n if (idx < 0) {\n this.attrPush([ name, value ]);\n } else {\n this.attrs[idx][1] = this.attrs[idx][1] + ' ' + value;\n }\n};\n\n\nmodule.exports = Token;\n", "// Core state object\n//\n'use strict';\n\nvar Token = require('../token');\n\n\nfunction StateCore(src, md, env) {\n this.src = src;\n this.env = env;\n this.tokens = [];\n this.inlineMode = false;\n this.md = md; // link to parser instance\n}\n\n// re-export Token class to use in core rules\nStateCore.prototype.Token = Token;\n\n\nmodule.exports = StateCore;\n", "/** internal\n * class Core\n *\n * Top-level rules executor. Glues block/inline parsers and does intermediate\n * transformations.\n **/\n'use strict';\n\n\nvar Ruler = require('./ruler');\n\n\nvar _rules = [\n [ 'normalize', require('./rules_core/normalize') ],\n [ 'block', require('./rules_core/block') ],\n [ 'inline', require('./rules_core/inline') ],\n [ 'linkify', require('./rules_core/linkify') ],\n [ 'replacements', require('./rules_core/replacements') ],\n [ 'smartquotes', require('./rules_core/smartquotes') ]\n];\n\n\n/**\n * new Core()\n **/\nfunction Core() {\n /**\n * Core#ruler -> Ruler\n *\n * [[Ruler]] instance. Keep configuration of core rules.\n **/\n this.ruler = new Ruler();\n\n for (var i = 0; i < _rules.length; i++) {\n this.ruler.push(_rules[i][0], _rules[i][1]);\n }\n}\n\n\n/**\n * Core.process(state)\n *\n * Executes core chain rules.\n **/\nCore.prototype.process = function (state) {\n var i, l, rules;\n\n rules = this.ruler.getRules('');\n\n for (i = 0, l = rules.length; i < l; i++) {\n rules[i](state);\n }\n};\n\nCore.prototype.State = require('./rules_core/state_core');\n\n\nmodule.exports = Core;\n", "// GFM table, https://github.github.com/gfm/#tables-extension-\n\n'use strict';\n\nvar isSpace = require('../common/utils').isSpace;\n\n\nfunction getLine(state, line) {\n var pos = state.bMarks[line] + state.tShift[line],\n max = state.eMarks[line];\n\n return state.src.substr(pos, max - pos);\n}\n\nfunction escapedSplit(str) {\n var result = [],\n pos = 0,\n max = str.length,\n ch,\n isEscaped = false,\n lastPos = 0,\n current = '';\n\n ch = str.charCodeAt(pos);\n\n while (pos < max) {\n if (ch === 0x7c/* | */) {\n if (!isEscaped) {\n // pipe separating cells, '|'\n result.push(current + str.substring(lastPos, pos));\n current = '';\n lastPos = pos + 1;\n } else {\n // escaped pipe, '\\|'\n current += str.substring(lastPos, pos - 1);\n lastPos = pos;\n }\n }\n\n isEscaped = (ch === 0x5c/* \\ */);\n pos++;\n\n ch = str.charCodeAt(pos);\n }\n\n result.push(current + str.substring(lastPos));\n\n return result;\n}\n\n\nmodule.exports = function table(state, startLine, endLine, silent) {\n var ch, lineText, pos, i, l, nextLine, columns, columnCount, token,\n aligns, t, tableLines, tbodyLines, oldParentType, terminate,\n terminatorRules, firstCh, secondCh;\n\n // should have at least two lines\n if (startLine + 2 > endLine) { return false; }\n\n nextLine = startLine + 1;\n\n if (state.sCount[nextLine] < state.blkIndent) { return false; }\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[nextLine] - state.blkIndent >= 4) { return false; }\n\n // first character of the second line should be '|', '-', ':',\n // and no other characters are allowed but spaces;\n // basically, this is the equivalent of /^[-:|][-:|\\s]*$/ regexp\n\n pos = state.bMarks[nextLine] + state.tShift[nextLine];\n if (pos >= state.eMarks[nextLine]) { return false; }\n\n firstCh = state.src.charCodeAt(pos++);\n if (firstCh !== 0x7C/* | */ && firstCh !== 0x2D/* - */ && firstCh !== 0x3A/* : */) { return false; }\n\n if (pos >= state.eMarks[nextLine]) { return false; }\n\n secondCh = state.src.charCodeAt(pos++);\n if (secondCh !== 0x7C/* | */ && secondCh !== 0x2D/* - */ && secondCh !== 0x3A/* : */ && !isSpace(secondCh)) {\n return false;\n }\n\n // if first character is '-', then second character must not be a space\n // (due to parsing ambiguity with list)\n if (firstCh === 0x2D/* - */ && isSpace(secondCh)) { return false; }\n\n while (pos < state.eMarks[nextLine]) {\n ch = state.src.charCodeAt(pos);\n\n if (ch !== 0x7C/* | */ && ch !== 0x2D/* - */ && ch !== 0x3A/* : */ && !isSpace(ch)) { return false; }\n\n pos++;\n }\n\n lineText = getLine(state, startLine + 1);\n\n columns = lineText.split('|');\n aligns = [];\n for (i = 0; i < columns.length; i++) {\n t = columns[i].trim();\n if (!t) {\n // allow empty columns before and after table, but not in between columns;\n // e.g. allow ` |---| `, disallow ` ---||--- `\n if (i === 0 || i === columns.length - 1) {\n continue;\n } else {\n return false;\n }\n }\n\n if (!/^:?-+:?$/.test(t)) { return false; }\n if (t.charCodeAt(t.length - 1) === 0x3A/* : */) {\n aligns.push(t.charCodeAt(0) === 0x3A/* : */ ? 'center' : 'right');\n } else if (t.charCodeAt(0) === 0x3A/* : */) {\n aligns.push('left');\n } else {\n aligns.push('');\n }\n }\n\n lineText = getLine(state, startLine).trim();\n if (lineText.indexOf('|') === -1) { return false; }\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n columns = escapedSplit(lineText);\n if (columns.length && columns[0] === '') columns.shift();\n if (columns.length && columns[columns.length - 1] === '') columns.pop();\n\n // header row will define an amount of columns in the entire table,\n // and align row should be exactly the same (the rest of the rows can differ)\n columnCount = columns.length;\n if (columnCount === 0 || columnCount !== aligns.length) { return false; }\n\n if (silent) { return true; }\n\n oldParentType = state.parentType;\n state.parentType = 'table';\n\n // use 'blockquote' lists for termination because it's\n // the most similar to tables\n terminatorRules = state.md.block.ruler.getRules('blockquote');\n\n token = state.push('table_open', 'table', 1);\n token.map = tableLines = [ startLine, 0 ];\n\n token = state.push('thead_open', 'thead', 1);\n token.map = [ startLine, startLine + 1 ];\n\n token = state.push('tr_open', 'tr', 1);\n token.map = [ startLine, startLine + 1 ];\n\n for (i = 0; i < columns.length; i++) {\n token = state.push('th_open', 'th', 1);\n if (aligns[i]) {\n token.attrs = [ [ 'style', 'text-align:' + aligns[i] ] ];\n }\n\n token = state.push('inline', '', 0);\n token.content = columns[i].trim();\n token.children = [];\n\n token = state.push('th_close', 'th', -1);\n }\n\n token = state.push('tr_close', 'tr', -1);\n token = state.push('thead_close', 'thead', -1);\n\n for (nextLine = startLine + 2; nextLine < endLine; nextLine++) {\n if (state.sCount[nextLine] < state.blkIndent) { break; }\n\n terminate = false;\n for (i = 0, l = terminatorRules.length; i < l; i++) {\n if (terminatorRules[i](state, nextLine, endLine, true)) {\n terminate = true;\n break;\n }\n }\n\n if (terminate) { break; }\n lineText = getLine(state, nextLine).trim();\n if (!lineText) { break; }\n if (state.sCount[nextLine] - state.blkIndent >= 4) { break; }\n columns = escapedSplit(lineText);\n if (columns.length && columns[0] === '') columns.shift();\n if (columns.length && columns[columns.length - 1] === '') columns.pop();\n\n if (nextLine === startLine + 2) {\n token = state.push('tbody_open', 'tbody', 1);\n token.map = tbodyLines = [ startLine + 2, 0 ];\n }\n\n token = state.push('tr_open', 'tr', 1);\n token.map = [ nextLine, nextLine + 1 ];\n\n for (i = 0; i < columnCount; i++) {\n token = state.push('td_open', 'td', 1);\n if (aligns[i]) {\n token.attrs = [ [ 'style', 'text-align:' + aligns[i] ] ];\n }\n\n token = state.push('inline', '', 0);\n token.content = columns[i] ? columns[i].trim() : '';\n token.children = [];\n\n token = state.push('td_close', 'td', -1);\n }\n token = state.push('tr_close', 'tr', -1);\n }\n\n if (tbodyLines) {\n token = state.push('tbody_close', 'tbody', -1);\n tbodyLines[1] = nextLine;\n }\n\n token = state.push('table_close', 'table', -1);\n tableLines[1] = nextLine;\n\n state.parentType = oldParentType;\n state.line = nextLine;\n return true;\n};\n", "// Code block (4 spaces padded)\n\n'use strict';\n\n\nmodule.exports = function code(state, startLine, endLine/*, silent*/) {\n var nextLine, last, token;\n\n if (state.sCount[startLine] - state.blkIndent < 4) { return false; }\n\n last = nextLine = startLine + 1;\n\n while (nextLine < endLine) {\n if (state.isEmpty(nextLine)) {\n nextLine++;\n continue;\n }\n\n if (state.sCount[nextLine] - state.blkIndent >= 4) {\n nextLine++;\n last = nextLine;\n continue;\n }\n break;\n }\n\n state.line = last;\n\n token = state.push('code_block', 'code', 0);\n token.content = state.getLines(startLine, last, 4 + state.blkIndent, false) + '\\n';\n token.map = [ startLine, state.line ];\n\n return true;\n};\n", "// fences (``` lang, ~~~ lang)\n\n'use strict';\n\n\nmodule.exports = function fence(state, startLine, endLine, silent) {\n var marker, len, params, nextLine, mem, token, markup,\n haveEndMarker = false,\n pos = state.bMarks[startLine] + state.tShift[startLine],\n max = state.eMarks[startLine];\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n\n if (pos + 3 > max) { return false; }\n\n marker = state.src.charCodeAt(pos);\n\n if (marker !== 0x7E/* ~ */ && marker !== 0x60 /* ` */) {\n return false;\n }\n\n // scan marker length\n mem = pos;\n pos = state.skipChars(pos, marker);\n\n len = pos - mem;\n\n if (len < 3) { return false; }\n\n markup = state.src.slice(mem, pos);\n params = state.src.slice(pos, max);\n\n if (marker === 0x60 /* ` */) {\n if (params.indexOf(String.fromCharCode(marker)) >= 0) {\n return false;\n }\n }\n\n // Since start is found, we can report success here in validation mode\n if (silent) { return true; }\n\n // search end of block\n nextLine = startLine;\n\n for (;;) {\n nextLine++;\n if (nextLine >= endLine) {\n // unclosed block should be autoclosed by end of document.\n // also block seems to be autoclosed by end of parent\n break;\n }\n\n pos = mem = state.bMarks[nextLine] + state.tShift[nextLine];\n max = state.eMarks[nextLine];\n\n if (pos < max && state.sCount[nextLine] < state.blkIndent) {\n // non-empty line with negative indent should stop the list:\n // - ```\n // test\n break;\n }\n\n if (state.src.charCodeAt(pos) !== marker) { continue; }\n\n if (state.sCount[nextLine] - state.blkIndent >= 4) {\n // closing fence should be indented less than 4 spaces\n continue;\n }\n\n pos = state.skipChars(pos, marker);\n\n // closing code fence must be at least as long as the opening one\n if (pos - mem < len) { continue; }\n\n // make sure tail has spaces only\n pos = state.skipSpaces(pos);\n\n if (pos < max) { continue; }\n\n haveEndMarker = true;\n // found!\n break;\n }\n\n // If a fence has heading spaces, they should be removed from its inner block\n len = state.sCount[startLine];\n\n state.line = nextLine + (haveEndMarker ? 1 : 0);\n\n token = state.push('fence', 'code', 0);\n token.info = params;\n token.content = state.getLines(startLine + 1, nextLine, len, true);\n token.markup = markup;\n token.map = [ startLine, state.line ];\n\n return true;\n};\n", "// Block quotes\n\n'use strict';\n\nvar isSpace = require('../common/utils').isSpace;\n\n\nmodule.exports = function blockquote(state, startLine, endLine, silent) {\n var adjustTab,\n ch,\n i,\n initial,\n l,\n lastLineEmpty,\n lines,\n nextLine,\n offset,\n oldBMarks,\n oldBSCount,\n oldIndent,\n oldParentType,\n oldSCount,\n oldTShift,\n spaceAfterMarker,\n terminate,\n terminatorRules,\n token,\n isOutdented,\n oldLineMax = state.lineMax,\n pos = state.bMarks[startLine] + state.tShift[startLine],\n max = state.eMarks[startLine];\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n\n // check the block quote marker\n if (state.src.charCodeAt(pos++) !== 0x3E/* > */) { return false; }\n\n // we know that it's going to be a valid blockquote,\n // so no point trying to find the end of it in silent mode\n if (silent) { return true; }\n\n // set offset past spaces and \">\"\n initial = offset = state.sCount[startLine] + 1;\n\n // skip one optional space after '>'\n if (state.src.charCodeAt(pos) === 0x20 /* space */) {\n // ' > test '\n // ^ -- position start of line here:\n pos++;\n initial++;\n offset++;\n adjustTab = false;\n spaceAfterMarker = true;\n } else if (state.src.charCodeAt(pos) === 0x09 /* tab */) {\n spaceAfterMarker = true;\n\n if ((state.bsCount[startLine] + offset) % 4 === 3) {\n // ' >\\t test '\n // ^ -- position start of line here (tab has width===1)\n pos++;\n initial++;\n offset++;\n adjustTab = false;\n } else {\n // ' >\\t test '\n // ^ -- position start of line here + shift bsCount slightly\n // to make extra space appear\n adjustTab = true;\n }\n } else {\n spaceAfterMarker = false;\n }\n\n oldBMarks = [ state.bMarks[startLine] ];\n state.bMarks[startLine] = pos;\n\n while (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (isSpace(ch)) {\n if (ch === 0x09) {\n offset += 4 - (offset + state.bsCount[startLine] + (adjustTab ? 1 : 0)) % 4;\n } else {\n offset++;\n }\n } else {\n break;\n }\n\n pos++;\n }\n\n oldBSCount = [ state.bsCount[startLine] ];\n state.bsCount[startLine] = state.sCount[startLine] + 1 + (spaceAfterMarker ? 1 : 0);\n\n lastLineEmpty = pos >= max;\n\n oldSCount = [ state.sCount[startLine] ];\n state.sCount[startLine] = offset - initial;\n\n oldTShift = [ state.tShift[startLine] ];\n state.tShift[startLine] = pos - state.bMarks[startLine];\n\n terminatorRules = state.md.block.ruler.getRules('blockquote');\n\n oldParentType = state.parentType;\n state.parentType = 'blockquote';\n\n // Search the end of the block\n //\n // Block ends with either:\n // 1. an empty line outside:\n // ```\n // > test\n //\n // ```\n // 2. an empty line inside:\n // ```\n // >\n // test\n // ```\n // 3. another tag:\n // ```\n // > test\n // - - -\n // ```\n for (nextLine = startLine + 1; nextLine < endLine; nextLine++) {\n // check if it's outdented, i.e. it's inside list item and indented\n // less than said list item:\n //\n // ```\n // 1. anything\n // > current blockquote\n // 2. checking this line\n // ```\n isOutdented = state.sCount[nextLine] < state.blkIndent;\n\n pos = state.bMarks[nextLine] + state.tShift[nextLine];\n max = state.eMarks[nextLine];\n\n if (pos >= max) {\n // Case 1: line is not inside the blockquote, and this line is empty.\n break;\n }\n\n if (state.src.charCodeAt(pos++) === 0x3E/* > */ && !isOutdented) {\n // This line is inside the blockquote.\n\n // set offset past spaces and \">\"\n initial = offset = state.sCount[nextLine] + 1;\n\n // skip one optional space after '>'\n if (state.src.charCodeAt(pos) === 0x20 /* space */) {\n // ' > test '\n // ^ -- position start of line here:\n pos++;\n initial++;\n offset++;\n adjustTab = false;\n spaceAfterMarker = true;\n } else if (state.src.charCodeAt(pos) === 0x09 /* tab */) {\n spaceAfterMarker = true;\n\n if ((state.bsCount[nextLine] + offset) % 4 === 3) {\n // ' >\\t test '\n // ^ -- position start of line here (tab has width===1)\n pos++;\n initial++;\n offset++;\n adjustTab = false;\n } else {\n // ' >\\t test '\n // ^ -- position start of line here + shift bsCount slightly\n // to make extra space appear\n adjustTab = true;\n }\n } else {\n spaceAfterMarker = false;\n }\n\n oldBMarks.push(state.bMarks[nextLine]);\n state.bMarks[nextLine] = pos;\n\n while (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (isSpace(ch)) {\n if (ch === 0x09) {\n offset += 4 - (offset + state.bsCount[nextLine] + (adjustTab ? 1 : 0)) % 4;\n } else {\n offset++;\n }\n } else {\n break;\n }\n\n pos++;\n }\n\n lastLineEmpty = pos >= max;\n\n oldBSCount.push(state.bsCount[nextLine]);\n state.bsCount[nextLine] = state.sCount[nextLine] + 1 + (spaceAfterMarker ? 1 : 0);\n\n oldSCount.push(state.sCount[nextLine]);\n state.sCount[nextLine] = offset - initial;\n\n oldTShift.push(state.tShift[nextLine]);\n state.tShift[nextLine] = pos - state.bMarks[nextLine];\n continue;\n }\n\n // Case 2: line is not inside the blockquote, and the last line was empty.\n if (lastLineEmpty) { break; }\n\n // Case 3: another tag found.\n terminate = false;\n for (i = 0, l = terminatorRules.length; i < l; i++) {\n if (terminatorRules[i](state, nextLine, endLine, true)) {\n terminate = true;\n break;\n }\n }\n\n if (terminate) {\n // Quirk to enforce \"hard termination mode\" for paragraphs;\n // normally if you call `tokenize(state, startLine, nextLine)`,\n // paragraphs will look below nextLine for paragraph continuation,\n // but if blockquote is terminated by another tag, they shouldn't\n state.lineMax = nextLine;\n\n if (state.blkIndent !== 0) {\n // state.blkIndent was non-zero, we now set it to zero,\n // so we need to re-calculate all offsets to appear as\n // if indent wasn't changed\n oldBMarks.push(state.bMarks[nextLine]);\n oldBSCount.push(state.bsCount[nextLine]);\n oldTShift.push(state.tShift[nextLine]);\n oldSCount.push(state.sCount[nextLine]);\n state.sCount[nextLine] -= state.blkIndent;\n }\n\n break;\n }\n\n oldBMarks.push(state.bMarks[nextLine]);\n oldBSCount.push(state.bsCount[nextLine]);\n oldTShift.push(state.tShift[nextLine]);\n oldSCount.push(state.sCount[nextLine]);\n\n // A negative indentation means that this is a paragraph continuation\n //\n state.sCount[nextLine] = -1;\n }\n\n oldIndent = state.blkIndent;\n state.blkIndent = 0;\n\n token = state.push('blockquote_open', 'blockquote', 1);\n token.markup = '>';\n token.map = lines = [ startLine, 0 ];\n\n state.md.block.tokenize(state, startLine, nextLine);\n\n token = state.push('blockquote_close', 'blockquote', -1);\n token.markup = '>';\n\n state.lineMax = oldLineMax;\n state.parentType = oldParentType;\n lines[1] = state.line;\n\n // Restore original tShift; this might not be necessary since the parser\n // has already been here, but just to make sure we can do that.\n for (i = 0; i < oldTShift.length; i++) {\n state.bMarks[i + startLine] = oldBMarks[i];\n state.tShift[i + startLine] = oldTShift[i];\n state.sCount[i + startLine] = oldSCount[i];\n state.bsCount[i + startLine] = oldBSCount[i];\n }\n state.blkIndent = oldIndent;\n\n return true;\n};\n", "// Horizontal rule\n\n'use strict';\n\nvar isSpace = require('../common/utils').isSpace;\n\n\nmodule.exports = function hr(state, startLine, endLine, silent) {\n var marker, cnt, ch, token,\n pos = state.bMarks[startLine] + state.tShift[startLine],\n max = state.eMarks[startLine];\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n\n marker = state.src.charCodeAt(pos++);\n\n // Check hr marker\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x5F/* _ */) {\n return false;\n }\n\n // markers can be mixed with spaces, but there should be at least 3 of them\n\n cnt = 1;\n while (pos < max) {\n ch = state.src.charCodeAt(pos++);\n if (ch !== marker && !isSpace(ch)) { return false; }\n if (ch === marker) { cnt++; }\n }\n\n if (cnt < 3) { return false; }\n\n if (silent) { return true; }\n\n state.line = startLine + 1;\n\n token = state.push('hr', 'hr', 0);\n token.map = [ startLine, state.line ];\n token.markup = Array(cnt + 1).join(String.fromCharCode(marker));\n\n return true;\n};\n", "// Lists\n\n'use strict';\n\nvar isSpace = require('../common/utils').isSpace;\n\n\n// Search `[-+*][\\n ]`, returns next pos after marker on success\n// or -1 on fail.\nfunction skipBulletListMarker(state, startLine) {\n var marker, pos, max, ch;\n\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1;\n }\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" -test \" - is not a list item\n return -1;\n }\n }\n\n return pos;\n}\n\n// Search `\\d+[.)][\\n ]`, returns next pos after marker on success\n// or -1 on fail.\nfunction skipOrderedListMarker(state, startLine) {\n var ch,\n start = state.bMarks[startLine] + state.tShift[startLine],\n pos = start,\n max = state.eMarks[startLine];\n\n // List marker should have at least 2 chars (digit + dot)\n if (pos + 1 >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n for (;;) {\n // EOL -> fail\n if (pos >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n\n // List marker should have no more than 9 digits\n // (prevents integer overflow in browsers)\n if (pos - start >= 10) { return -1; }\n\n continue;\n }\n\n // found valid marker\n if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n break;\n }\n\n return -1;\n }\n\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n }\n return pos;\n}\n\nfunction markTightParagraphs(state, idx) {\n var i, l,\n level = state.level + 2;\n\n for (i = idx + 2, l = state.tokens.length - 2; i < l; i++) {\n if (state.tokens[i].level === level && state.tokens[i].type === 'paragraph_open') {\n state.tokens[i + 2].hidden = true;\n state.tokens[i].hidden = true;\n i += 2;\n }\n }\n}\n\n\nmodule.exports = function list(state, startLine, endLine, silent) {\n var ch,\n contentStart,\n i,\n indent,\n indentAfterMarker,\n initial,\n isOrdered,\n itemLines,\n l,\n listLines,\n listTokIdx,\n markerCharCode,\n markerValue,\n max,\n nextLine,\n offset,\n oldListIndent,\n oldParentType,\n oldSCount,\n oldTShift,\n oldTight,\n pos,\n posAfterMarker,\n prevEmptyEnd,\n start,\n terminate,\n terminatorRules,\n token,\n isTerminatingParagraph = false,\n tight = true;\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n\n // Special case:\n // - item 1\n // - item 2\n // - item 3\n // - item 4\n // - this one is a paragraph continuation\n if (state.listIndent >= 0 &&\n state.sCount[startLine] - state.listIndent >= 4 &&\n state.sCount[startLine] < state.blkIndent) {\n return false;\n }\n\n // limit conditions when list can interrupt\n // a paragraph (validation mode only)\n if (silent && state.parentType === 'paragraph') {\n // Next list item should still terminate previous list item;\n //\n // This code can fail if plugins use blkIndent as well as lists,\n // but I hope the spec gets fixed long before that happens.\n //\n if (state.sCount[startLine] >= state.blkIndent) {\n isTerminatingParagraph = true;\n }\n }\n\n // Detect list type and position after marker\n if ((posAfterMarker = skipOrderedListMarker(state, startLine)) >= 0) {\n isOrdered = true;\n start = state.bMarks[startLine] + state.tShift[startLine];\n markerValue = Number(state.src.slice(start, posAfterMarker - 1));\n\n // If we're starting a new ordered list right after\n // a paragraph, it should start with 1.\n if (isTerminatingParagraph && markerValue !== 1) return false;\n\n } else if ((posAfterMarker = skipBulletListMarker(state, startLine)) >= 0) {\n isOrdered = false;\n\n } else {\n return false;\n }\n\n // If we're starting a new unordered list right after\n // a paragraph, first line should not be empty.\n if (isTerminatingParagraph) {\n if (state.skipSpaces(posAfterMarker) >= state.eMarks[startLine]) return false;\n }\n\n // We should terminate list on style change. Remember first one to compare.\n markerCharCode = state.src.charCodeAt(posAfterMarker - 1);\n\n // For validation mode we can terminate immediately\n if (silent) { return true; }\n\n // Start list\n listTokIdx = state.tokens.length;\n\n if (isOrdered) {\n token = state.push('ordered_list_open', 'ol', 1);\n if (markerValue !== 1) {\n token.attrs = [ [ 'start', markerValue ] ];\n }\n\n } else {\n token = state.push('bullet_list_open', 'ul', 1);\n }\n\n token.map = listLines = [ startLine, 0 ];\n token.markup = String.fromCharCode(markerCharCode);\n\n //\n // Iterate list items\n //\n\n nextLine = startLine;\n prevEmptyEnd = false;\n terminatorRules = state.md.block.ruler.getRules('list');\n\n oldParentType = state.parentType;\n state.parentType = 'list';\n\n while (nextLine < endLine) {\n pos = posAfterMarker;\n max = state.eMarks[nextLine];\n\n initial = offset = state.sCount[nextLine] + posAfterMarker - (state.bMarks[startLine] + state.tShift[startLine]);\n\n while (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (ch === 0x09) {\n offset += 4 - (offset + state.bsCount[nextLine]) % 4;\n } else if (ch === 0x20) {\n offset++;\n } else {\n break;\n }\n\n pos++;\n }\n\n contentStart = pos;\n\n if (contentStart >= max) {\n // trimming space in \"- \\n 3\" case, indent is 1 here\n indentAfterMarker = 1;\n } else {\n indentAfterMarker = offset - initial;\n }\n\n // If we have more than 4 spaces, the indent is 1\n // (the rest is just indented code block)\n if (indentAfterMarker > 4) { indentAfterMarker = 1; }\n\n // \" - test\"\n // ^^^^^ - calculating total length of this thing\n indent = initial + indentAfterMarker;\n\n // Run subparser & write tokens\n token = state.push('list_item_open', 'li', 1);\n token.markup = String.fromCharCode(markerCharCode);\n token.map = itemLines = [ startLine, 0 ];\n if (isOrdered) {\n token.info = state.src.slice(start, posAfterMarker - 1);\n }\n\n // change current state, then restore it after parser subcall\n oldTight = state.tight;\n oldTShift = state.tShift[startLine];\n oldSCount = state.sCount[startLine];\n\n // - example list\n // ^ listIndent position will be here\n // ^ blkIndent position will be here\n //\n oldListIndent = state.listIndent;\n state.listIndent = state.blkIndent;\n state.blkIndent = indent;\n\n state.tight = true;\n state.tShift[startLine] = contentStart - state.bMarks[startLine];\n state.sCount[startLine] = offset;\n\n if (contentStart >= max && state.isEmpty(startLine + 1)) {\n // workaround for this case\n // (list item is empty, list terminates before \"foo\"):\n // ~~~~~~~~\n // -\n //\n // foo\n // ~~~~~~~~\n state.line = Math.min(state.line + 2, endLine);\n } else {\n state.md.block.tokenize(state, startLine, endLine, true);\n }\n\n // If any of list item is tight, mark list as tight\n if (!state.tight || prevEmptyEnd) {\n tight = false;\n }\n // Item become loose if finish with empty line,\n // but we should filter last element, because it means list finish\n prevEmptyEnd = (state.line - startLine) > 1 && state.isEmpty(state.line - 1);\n\n state.blkIndent = state.listIndent;\n state.listIndent = oldListIndent;\n state.tShift[startLine] = oldTShift;\n state.sCount[startLine] = oldSCount;\n state.tight = oldTight;\n\n token = state.push('list_item_close', 'li', -1);\n token.markup = String.fromCharCode(markerCharCode);\n\n nextLine = startLine = state.line;\n itemLines[1] = nextLine;\n contentStart = state.bMarks[startLine];\n\n if (nextLine >= endLine) { break; }\n\n //\n // Try to check if list is terminated or continued.\n //\n if (state.sCount[nextLine] < state.blkIndent) { break; }\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { break; }\n\n // fail if terminating block found\n terminate = false;\n for (i = 0, l = terminatorRules.length; i < l; i++) {\n if (terminatorRules[i](state, nextLine, endLine, true)) {\n terminate = true;\n break;\n }\n }\n if (terminate) { break; }\n\n // fail if list has another type\n if (isOrdered) {\n posAfterMarker = skipOrderedListMarker(state, nextLine);\n if (posAfterMarker < 0) { break; }\n start = state.bMarks[nextLine] + state.tShift[nextLine];\n } else {\n posAfterMarker = skipBulletListMarker(state, nextLine);\n if (posAfterMarker < 0) { break; }\n }\n\n if (markerCharCode !== state.src.charCodeAt(posAfterMarker - 1)) { break; }\n }\n\n // Finalize list\n if (isOrdered) {\n token = state.push('ordered_list_close', 'ol', -1);\n } else {\n token = state.push('bullet_list_close', 'ul', -1);\n }\n token.markup = String.fromCharCode(markerCharCode);\n\n listLines[1] = nextLine;\n state.line = nextLine;\n\n state.parentType = oldParentType;\n\n // mark paragraphs tight if needed\n if (tight) {\n markTightParagraphs(state, listTokIdx);\n }\n\n return true;\n};\n", "'use strict';\n\n\nvar normalizeReference = require('../common/utils').normalizeReference;\nvar isSpace = require('../common/utils').isSpace;\n\n\nmodule.exports = function reference(state, startLine, _endLine, silent) {\n var ch,\n destEndPos,\n destEndLineNo,\n endLine,\n href,\n i,\n l,\n label,\n labelEnd,\n oldParentType,\n res,\n start,\n str,\n terminate,\n terminatorRules,\n title,\n lines = 0,\n pos = state.bMarks[startLine] + state.tShift[startLine],\n max = state.eMarks[startLine],\n nextLine = startLine + 1;\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n\n if (state.src.charCodeAt(pos) !== 0x5B/* [ */) { return false; }\n\n // Simple check to quickly interrupt scan on [link](url) at the start of line.\n // Can be useful on practice: https://github.com/markdown-it/markdown-it/issues/54\n while (++pos < max) {\n if (state.src.charCodeAt(pos) === 0x5D /* ] */ &&\n state.src.charCodeAt(pos - 1) !== 0x5C/* \\ */) {\n if (pos + 1 === max) { return false; }\n if (state.src.charCodeAt(pos + 1) !== 0x3A/* : */) { return false; }\n break;\n }\n }\n\n endLine = state.lineMax;\n\n // jump line-by-line until empty one or EOF\n terminatorRules = state.md.block.ruler.getRules('reference');\n\n oldParentType = state.parentType;\n state.parentType = 'reference';\n\n for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {\n // this would be a code block normally, but after paragraph\n // it's considered a lazy continuation regardless of what's there\n if (state.sCount[nextLine] - state.blkIndent > 3) { continue; }\n\n // quirk for blockquotes, this line should already be checked by that rule\n if (state.sCount[nextLine] < 0) { continue; }\n\n // Some tags can terminate paragraph without empty line.\n terminate = false;\n for (i = 0, l = terminatorRules.length; i < l; i++) {\n if (terminatorRules[i](state, nextLine, endLine, true)) {\n terminate = true;\n break;\n }\n }\n if (terminate) { break; }\n }\n\n str = state.getLines(startLine, nextLine, state.blkIndent, false).trim();\n max = str.length;\n\n for (pos = 1; pos < max; pos++) {\n ch = str.charCodeAt(pos);\n if (ch === 0x5B /* [ */) {\n return false;\n } else if (ch === 0x5D /* ] */) {\n labelEnd = pos;\n break;\n } else if (ch === 0x0A /* \\n */) {\n lines++;\n } else if (ch === 0x5C /* \\ */) {\n pos++;\n if (pos < max && str.charCodeAt(pos) === 0x0A) {\n lines++;\n }\n }\n }\n\n if (labelEnd < 0 || str.charCodeAt(labelEnd + 1) !== 0x3A/* : */) { return false; }\n\n // [label]: destination 'title'\n // ^^^ skip optional whitespace here\n for (pos = labelEnd + 2; pos < max; pos++) {\n ch = str.charCodeAt(pos);\n if (ch === 0x0A) {\n lines++;\n } else if (isSpace(ch)) {\n /*eslint no-empty:0*/\n } else {\n break;\n }\n }\n\n // [label]: destination 'title'\n // ^^^^^^^^^^^ parse this\n res = state.md.helpers.parseLinkDestination(str, pos, max);\n if (!res.ok) { return false; }\n\n href = state.md.normalizeLink(res.str);\n if (!state.md.validateLink(href)) { return false; }\n\n pos = res.pos;\n lines += res.lines;\n\n // save cursor state, we could require to rollback later\n destEndPos = pos;\n destEndLineNo = lines;\n\n // [label]: destination 'title'\n // ^^^ skipping those spaces\n start = pos;\n for (; pos < max; pos++) {\n ch = str.charCodeAt(pos);\n if (ch === 0x0A) {\n lines++;\n } else if (isSpace(ch)) {\n /*eslint no-empty:0*/\n } else {\n break;\n }\n }\n\n // [label]: destination 'title'\n // ^^^^^^^ parse this\n res = state.md.helpers.parseLinkTitle(str, pos, max);\n if (pos < max && start !== pos && res.ok) {\n title = res.str;\n pos = res.pos;\n lines += res.lines;\n } else {\n title = '';\n pos = destEndPos;\n lines = destEndLineNo;\n }\n\n // skip trailing spaces until the rest of the line\n while (pos < max) {\n ch = str.charCodeAt(pos);\n if (!isSpace(ch)) { break; }\n pos++;\n }\n\n if (pos < max && str.charCodeAt(pos) !== 0x0A) {\n if (title) {\n // garbage at the end of the line after title,\n // but it could still be a valid reference if we roll back\n title = '';\n pos = destEndPos;\n lines = destEndLineNo;\n while (pos < max) {\n ch = str.charCodeAt(pos);\n if (!isSpace(ch)) { break; }\n pos++;\n }\n }\n }\n\n if (pos < max && str.charCodeAt(pos) !== 0x0A) {\n // garbage at the end of the line\n return false;\n }\n\n label = normalizeReference(str.slice(1, labelEnd));\n if (!label) {\n // CommonMark 0.20 disallows empty labels\n return false;\n }\n\n // Reference can not terminate anything. This check is for safety only.\n /*istanbul ignore if*/\n if (silent) { return true; }\n\n if (typeof state.env.references === 'undefined') {\n state.env.references = {};\n }\n if (typeof state.env.references[label] === 'undefined') {\n state.env.references[label] = { title: title, href: href };\n }\n\n state.parentType = oldParentType;\n\n state.line = startLine + lines + 1;\n return true;\n};\n", "// List of valid html blocks names, accorting to commonmark spec\n// http://jgm.github.io/CommonMark/spec.html#html-blocks\n\n'use strict';\n\n\nmodule.exports = [\n 'address',\n 'article',\n 'aside',\n 'base',\n 'basefont',\n 'blockquote',\n 'body',\n 'caption',\n 'center',\n 'col',\n 'colgroup',\n 'dd',\n 'details',\n 'dialog',\n 'dir',\n 'div',\n 'dl',\n 'dt',\n 'fieldset',\n 'figcaption',\n 'figure',\n 'footer',\n 'form',\n 'frame',\n 'frameset',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'head',\n 'header',\n 'hr',\n 'html',\n 'iframe',\n 'legend',\n 'li',\n 'link',\n 'main',\n 'menu',\n 'menuitem',\n 'nav',\n 'noframes',\n 'ol',\n 'optgroup',\n 'option',\n 'p',\n 'param',\n 'section',\n 'source',\n 'summary',\n 'table',\n 'tbody',\n 'td',\n 'tfoot',\n 'th',\n 'thead',\n 'title',\n 'tr',\n 'track',\n 'ul'\n];\n", "// Regexps to match html elements\n\n'use strict';\n\nvar attr_name = '[a-zA-Z_:][a-zA-Z0-9:._-]*';\n\nvar unquoted = '[^\"\\'=<>`\\\\x00-\\\\x20]+';\nvar single_quoted = \"'[^']*'\";\nvar double_quoted = '\"[^\"]*\"';\n\nvar attr_value = '(?:' + unquoted + '|' + single_quoted + '|' + double_quoted + ')';\n\nvar attribute = '(?:\\\\s+' + attr_name + '(?:\\\\s*=\\\\s*' + attr_value + ')?)';\n\nvar open_tag = '<[A-Za-z][A-Za-z0-9\\\\-]*' + attribute + '*\\\\s*\\\\/?>';\n\nvar close_tag = '<\\\\/[A-Za-z][A-Za-z0-9\\\\-]*\\\\s*>';\nvar comment = '|';\nvar processing = '<[?][\\\\s\\\\S]*?[?]>';\nvar declaration = ']*>';\nvar cdata = '';\n\nvar HTML_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + '|' + comment +\n '|' + processing + '|' + declaration + '|' + cdata + ')');\nvar HTML_OPEN_CLOSE_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + ')');\n\nmodule.exports.HTML_TAG_RE = HTML_TAG_RE;\nmodule.exports.HTML_OPEN_CLOSE_TAG_RE = HTML_OPEN_CLOSE_TAG_RE;\n", "// HTML block\n\n'use strict';\n\n\nvar block_names = require('../common/html_blocks');\nvar HTML_OPEN_CLOSE_TAG_RE = require('../common/html_re').HTML_OPEN_CLOSE_TAG_RE;\n\n// An array of opening and corresponding closing sequences for html tags,\n// last argument defines whether it can terminate a paragraph or not\n//\nvar HTML_SEQUENCES = [\n [ /^<(script|pre|style|textarea)(?=(\\s|>|$))/i, /<\\/(script|pre|style|textarea)>/i, true ],\n [ /^/, true ],\n [ /^<\\?/, /\\?>/, true ],\n [ /^/, true ],\n [ /^/, true ],\n [ new RegExp('^|$))', 'i'), /^$/, true ],\n [ new RegExp(HTML_OPEN_CLOSE_TAG_RE.source + '\\\\s*$'), /^$/, false ]\n];\n\n\nmodule.exports = function html_block(state, startLine, endLine, silent) {\n var i, nextLine, token, lineText,\n pos = state.bMarks[startLine] + state.tShift[startLine],\n max = state.eMarks[startLine];\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n\n if (!state.md.options.html) { return false; }\n\n if (state.src.charCodeAt(pos) !== 0x3C/* < */) { return false; }\n\n lineText = state.src.slice(pos, max);\n\n for (i = 0; i < HTML_SEQUENCES.length; i++) {\n if (HTML_SEQUENCES[i][0].test(lineText)) { break; }\n }\n\n if (i === HTML_SEQUENCES.length) { return false; }\n\n if (silent) {\n // true if this sequence can be a terminator, false otherwise\n return HTML_SEQUENCES[i][2];\n }\n\n nextLine = startLine + 1;\n\n // If we are here - we detected HTML block.\n // Let's roll down till block end.\n if (!HTML_SEQUENCES[i][1].test(lineText)) {\n for (; nextLine < endLine; nextLine++) {\n if (state.sCount[nextLine] < state.blkIndent) { break; }\n\n pos = state.bMarks[nextLine] + state.tShift[nextLine];\n max = state.eMarks[nextLine];\n lineText = state.src.slice(pos, max);\n\n if (HTML_SEQUENCES[i][1].test(lineText)) {\n if (lineText.length !== 0) { nextLine++; }\n break;\n }\n }\n }\n\n state.line = nextLine;\n\n token = state.push('html_block', '', 0);\n token.map = [ startLine, nextLine ];\n token.content = state.getLines(startLine, nextLine, state.blkIndent, true);\n\n return true;\n};\n", "// heading (#, ##, ...)\n\n'use strict';\n\nvar isSpace = require('../common/utils').isSpace;\n\n\nmodule.exports = function heading(state, startLine, endLine, silent) {\n var ch, level, tmp, token,\n pos = state.bMarks[startLine] + state.tShift[startLine],\n max = state.eMarks[startLine];\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n\n ch = state.src.charCodeAt(pos);\n\n if (ch !== 0x23/* # */ || pos >= max) { return false; }\n\n // count heading level\n level = 1;\n ch = state.src.charCodeAt(++pos);\n while (ch === 0x23/* # */ && pos < max && level <= 6) {\n level++;\n ch = state.src.charCodeAt(++pos);\n }\n\n if (level > 6 || (pos < max && !isSpace(ch))) { return false; }\n\n if (silent) { return true; }\n\n // Let's cut tails like ' ### ' from the end of string\n\n max = state.skipSpacesBack(max, pos);\n tmp = state.skipCharsBack(max, 0x23, pos); // #\n if (tmp > pos && isSpace(state.src.charCodeAt(tmp - 1))) {\n max = tmp;\n }\n\n state.line = startLine + 1;\n\n token = state.push('heading_open', 'h' + String(level), 1);\n token.markup = '########'.slice(0, level);\n token.map = [ startLine, state.line ];\n\n token = state.push('inline', '', 0);\n token.content = state.src.slice(pos, max).trim();\n token.map = [ startLine, state.line ];\n token.children = [];\n\n token = state.push('heading_close', 'h' + String(level), -1);\n token.markup = '########'.slice(0, level);\n\n return true;\n};\n", "// lheading (---, ===)\n\n'use strict';\n\n\nmodule.exports = function lheading(state, startLine, endLine/*, silent*/) {\n var content, terminate, i, l, token, pos, max, level, marker,\n nextLine = startLine + 1, oldParentType,\n terminatorRules = state.md.block.ruler.getRules('paragraph');\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n\n oldParentType = state.parentType;\n state.parentType = 'paragraph'; // use paragraph to match terminatorRules\n\n // jump line-by-line until empty one or EOF\n for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {\n // this would be a code block normally, but after paragraph\n // it's considered a lazy continuation regardless of what's there\n if (state.sCount[nextLine] - state.blkIndent > 3) { continue; }\n\n //\n // Check for underline in setext header\n //\n if (state.sCount[nextLine] >= state.blkIndent) {\n pos = state.bMarks[nextLine] + state.tShift[nextLine];\n max = state.eMarks[nextLine];\n\n if (pos < max) {\n marker = state.src.charCodeAt(pos);\n\n if (marker === 0x2D/* - */ || marker === 0x3D/* = */) {\n pos = state.skipChars(pos, marker);\n pos = state.skipSpaces(pos);\n\n if (pos >= max) {\n level = (marker === 0x3D/* = */ ? 1 : 2);\n break;\n }\n }\n }\n }\n\n // quirk for blockquotes, this line should already be checked by that rule\n if (state.sCount[nextLine] < 0) { continue; }\n\n // Some tags can terminate paragraph without empty line.\n terminate = false;\n for (i = 0, l = terminatorRules.length; i < l; i++) {\n if (terminatorRules[i](state, nextLine, endLine, true)) {\n terminate = true;\n break;\n }\n }\n if (terminate) { break; }\n }\n\n if (!level) {\n // Didn't find valid underline\n return false;\n }\n\n content = state.getLines(startLine, nextLine, state.blkIndent, false).trim();\n\n state.line = nextLine + 1;\n\n token = state.push('heading_open', 'h' + String(level), 1);\n token.markup = String.fromCharCode(marker);\n token.map = [ startLine, state.line ];\n\n token = state.push('inline', '', 0);\n token.content = content;\n token.map = [ startLine, state.line - 1 ];\n token.children = [];\n\n token = state.push('heading_close', 'h' + String(level), -1);\n token.markup = String.fromCharCode(marker);\n\n state.parentType = oldParentType;\n\n return true;\n};\n", "// Paragraph\n\n'use strict';\n\n\nmodule.exports = function paragraph(state, startLine/*, endLine*/) {\n var content, terminate, i, l, token, oldParentType,\n nextLine = startLine + 1,\n terminatorRules = state.md.block.ruler.getRules('paragraph'),\n endLine = state.lineMax;\n\n oldParentType = state.parentType;\n state.parentType = 'paragraph';\n\n // jump line-by-line until empty one or EOF\n for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {\n // this would be a code block normally, but after paragraph\n // it's considered a lazy continuation regardless of what's there\n if (state.sCount[nextLine] - state.blkIndent > 3) { continue; }\n\n // quirk for blockquotes, this line should already be checked by that rule\n if (state.sCount[nextLine] < 0) { continue; }\n\n // Some tags can terminate paragraph without empty line.\n terminate = false;\n for (i = 0, l = terminatorRules.length; i < l; i++) {\n if (terminatorRules[i](state, nextLine, endLine, true)) {\n terminate = true;\n break;\n }\n }\n if (terminate) { break; }\n }\n\n content = state.getLines(startLine, nextLine, state.blkIndent, false).trim();\n\n state.line = nextLine;\n\n token = state.push('paragraph_open', 'p', 1);\n token.map = [ startLine, state.line ];\n\n token = state.push('inline', '', 0);\n token.content = content;\n token.map = [ startLine, state.line ];\n token.children = [];\n\n token = state.push('paragraph_close', 'p', -1);\n\n state.parentType = oldParentType;\n\n return true;\n};\n", "// Parser state class\n\n'use strict';\n\nvar Token = require('../token');\nvar isSpace = require('../common/utils').isSpace;\n\n\nfunction StateBlock(src, md, env, tokens) {\n var ch, s, start, pos, len, indent, offset, indent_found;\n\n this.src = src;\n\n // link to parser instance\n this.md = md;\n\n this.env = env;\n\n //\n // Internal state vartiables\n //\n\n this.tokens = tokens;\n\n this.bMarks = []; // line begin offsets for fast jumps\n this.eMarks = []; // line end offsets for fast jumps\n this.tShift = []; // offsets of the first non-space characters (tabs not expanded)\n this.sCount = []; // indents for each line (tabs expanded)\n\n // An amount of virtual spaces (tabs expanded) between beginning\n // of each line (bMarks) and real beginning of that line.\n //\n // It exists only as a hack because blockquotes override bMarks\n // losing information in the process.\n //\n // It's used only when expanding tabs, you can think about it as\n // an initial tab length, e.g. bsCount=21 applied to string `\\t123`\n // means first tab should be expanded to 4-21%4 === 3 spaces.\n //\n this.bsCount = [];\n\n // block parser variables\n this.blkIndent = 0; // required block content indent (for example, if we are\n // inside a list, it would be positioned after list marker)\n this.line = 0; // line index in src\n this.lineMax = 0; // lines count\n this.tight = false; // loose/tight mode for lists\n this.ddIndent = -1; // indent of the current dd block (-1 if there isn't any)\n this.listIndent = -1; // indent of the current list block (-1 if there isn't any)\n\n // can be 'blockquote', 'list', 'root', 'paragraph' or 'reference'\n // used in lists to determine if they interrupt a paragraph\n this.parentType = 'root';\n\n this.level = 0;\n\n // renderer\n this.result = '';\n\n // Create caches\n // Generate markers.\n s = this.src;\n indent_found = false;\n\n for (start = pos = indent = offset = 0, len = s.length; pos < len; pos++) {\n ch = s.charCodeAt(pos);\n\n if (!indent_found) {\n if (isSpace(ch)) {\n indent++;\n\n if (ch === 0x09) {\n offset += 4 - offset % 4;\n } else {\n offset++;\n }\n continue;\n } else {\n indent_found = true;\n }\n }\n\n if (ch === 0x0A || pos === len - 1) {\n if (ch !== 0x0A) { pos++; }\n this.bMarks.push(start);\n this.eMarks.push(pos);\n this.tShift.push(indent);\n this.sCount.push(offset);\n this.bsCount.push(0);\n\n indent_found = false;\n indent = 0;\n offset = 0;\n start = pos + 1;\n }\n }\n\n // Push fake entry to simplify cache bounds checks\n this.bMarks.push(s.length);\n this.eMarks.push(s.length);\n this.tShift.push(0);\n this.sCount.push(0);\n this.bsCount.push(0);\n\n this.lineMax = this.bMarks.length - 1; // don't count last fake line\n}\n\n// Push new token to \"stream\".\n//\nStateBlock.prototype.push = function (type, tag, nesting) {\n var token = new Token(type, tag, nesting);\n token.block = true;\n\n if (nesting < 0) this.level--; // closing tag\n token.level = this.level;\n if (nesting > 0) this.level++; // opening tag\n\n this.tokens.push(token);\n return token;\n};\n\nStateBlock.prototype.isEmpty = function isEmpty(line) {\n return this.bMarks[line] + this.tShift[line] >= this.eMarks[line];\n};\n\nStateBlock.prototype.skipEmptyLines = function skipEmptyLines(from) {\n for (var max = this.lineMax; from < max; from++) {\n if (this.bMarks[from] + this.tShift[from] < this.eMarks[from]) {\n break;\n }\n }\n return from;\n};\n\n// Skip spaces from given position.\nStateBlock.prototype.skipSpaces = function skipSpaces(pos) {\n var ch;\n\n for (var max = this.src.length; pos < max; pos++) {\n ch = this.src.charCodeAt(pos);\n if (!isSpace(ch)) { break; }\n }\n return pos;\n};\n\n// Skip spaces from given position in reverse.\nStateBlock.prototype.skipSpacesBack = function skipSpacesBack(pos, min) {\n if (pos <= min) { return pos; }\n\n while (pos > min) {\n if (!isSpace(this.src.charCodeAt(--pos))) { return pos + 1; }\n }\n return pos;\n};\n\n// Skip char codes from given position\nStateBlock.prototype.skipChars = function skipChars(pos, code) {\n for (var max = this.src.length; pos < max; pos++) {\n if (this.src.charCodeAt(pos) !== code) { break; }\n }\n return pos;\n};\n\n// Skip char codes reverse from given position - 1\nStateBlock.prototype.skipCharsBack = function skipCharsBack(pos, code, min) {\n if (pos <= min) { return pos; }\n\n while (pos > min) {\n if (code !== this.src.charCodeAt(--pos)) { return pos + 1; }\n }\n return pos;\n};\n\n// cut lines range from source.\nStateBlock.prototype.getLines = function getLines(begin, end, indent, keepLastLF) {\n var i, lineIndent, ch, first, last, queue, lineStart,\n line = begin;\n\n if (begin >= end) {\n return '';\n }\n\n queue = new Array(end - begin);\n\n for (i = 0; line < end; line++, i++) {\n lineIndent = 0;\n lineStart = first = this.bMarks[line];\n\n if (line + 1 < end || keepLastLF) {\n // No need for bounds check because we have fake entry on tail.\n last = this.eMarks[line] + 1;\n } else {\n last = this.eMarks[line];\n }\n\n while (first < last && lineIndent < indent) {\n ch = this.src.charCodeAt(first);\n\n if (isSpace(ch)) {\n if (ch === 0x09) {\n lineIndent += 4 - (lineIndent + this.bsCount[line]) % 4;\n } else {\n lineIndent++;\n }\n } else if (first - lineStart < this.tShift[line]) {\n // patched tShift masked characters to look like spaces (blockquotes, list markers)\n lineIndent++;\n } else {\n break;\n }\n\n first++;\n }\n\n if (lineIndent > indent) {\n // partially expanding tabs in code blocks, e.g '\\t\\tfoobar'\n // with indent=2 becomes ' \\tfoobar'\n queue[i] = new Array(lineIndent - indent + 1).join(' ') + this.src.slice(first, last);\n } else {\n queue[i] = this.src.slice(first, last);\n }\n }\n\n return queue.join('');\n};\n\n// re-export Token class to use in block rules\nStateBlock.prototype.Token = Token;\n\n\nmodule.exports = StateBlock;\n", "/** internal\n * class ParserBlock\n *\n * Block-level tokenizer.\n **/\n'use strict';\n\n\nvar Ruler = require('./ruler');\n\n\nvar _rules = [\n // First 2 params - rule name & source. Secondary array - list of rules,\n // which can be terminated by this one.\n [ 'table', require('./rules_block/table'), [ 'paragraph', 'reference' ] ],\n [ 'code', require('./rules_block/code') ],\n [ 'fence', require('./rules_block/fence'), [ 'paragraph', 'reference', 'blockquote', 'list' ] ],\n [ 'blockquote', require('./rules_block/blockquote'), [ 'paragraph', 'reference', 'blockquote', 'list' ] ],\n [ 'hr', require('./rules_block/hr'), [ 'paragraph', 'reference', 'blockquote', 'list' ] ],\n [ 'list', require('./rules_block/list'), [ 'paragraph', 'reference', 'blockquote' ] ],\n [ 'reference', require('./rules_block/reference') ],\n [ 'html_block', require('./rules_block/html_block'), [ 'paragraph', 'reference', 'blockquote' ] ],\n [ 'heading', require('./rules_block/heading'), [ 'paragraph', 'reference', 'blockquote' ] ],\n [ 'lheading', require('./rules_block/lheading') ],\n [ 'paragraph', require('./rules_block/paragraph') ]\n];\n\n\n/**\n * new ParserBlock()\n **/\nfunction ParserBlock() {\n /**\n * ParserBlock#ruler -> Ruler\n *\n * [[Ruler]] instance. Keep configuration of block rules.\n **/\n this.ruler = new Ruler();\n\n for (var i = 0; i < _rules.length; i++) {\n this.ruler.push(_rules[i][0], _rules[i][1], { alt: (_rules[i][2] || []).slice() });\n }\n}\n\n\n// Generate tokens for input range\n//\nParserBlock.prototype.tokenize = function (state, startLine, endLine) {\n var ok, i,\n rules = this.ruler.getRules(''),\n len = rules.length,\n line = startLine,\n hasEmptyLines = false,\n maxNesting = state.md.options.maxNesting;\n\n while (line < endLine) {\n state.line = line = state.skipEmptyLines(line);\n if (line >= endLine) { break; }\n\n // Termination condition for nested calls.\n // Nested calls currently used for blockquotes & lists\n if (state.sCount[line] < state.blkIndent) { break; }\n\n // If nesting level exceeded - skip tail to the end. That's not ordinary\n // situation and we should not care about content.\n if (state.level >= maxNesting) {\n state.line = endLine;\n break;\n }\n\n // Try all possible rules.\n // On success, rule should:\n //\n // - update `state.line`\n // - update `state.tokens`\n // - return true\n\n for (i = 0; i < len; i++) {\n ok = rules[i](state, line, endLine, false);\n if (ok) { break; }\n }\n\n // set state.tight if we had an empty line before current tag\n // i.e. latest empty line should not count\n state.tight = !hasEmptyLines;\n\n // paragraph might \"eat\" one newline after it in nested lists\n if (state.isEmpty(state.line - 1)) {\n hasEmptyLines = true;\n }\n\n line = state.line;\n\n if (line < endLine && state.isEmpty(line)) {\n hasEmptyLines = true;\n line++;\n state.line = line;\n }\n }\n};\n\n\n/**\n * ParserBlock.parse(str, md, env, outTokens)\n *\n * Process input string and push block tokens into `outTokens`\n **/\nParserBlock.prototype.parse = function (src, md, env, outTokens) {\n var state;\n\n if (!src) { return; }\n\n state = new this.State(src, md, env, outTokens);\n\n this.tokenize(state, state.line, state.lineMax);\n};\n\n\nParserBlock.prototype.State = require('./rules_block/state_block');\n\n\nmodule.exports = ParserBlock;\n", "// Skip text characters for text token, place those to pending buffer\n// and increment current pos\n\n'use strict';\n\n\n// Rule to skip pure text\n// '{}$%@~+=:' reserved for extentions\n\n// !, \", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \\, ], ^, _, `, {, |, }, or ~\n\n// !!!! Don't confuse with \"Markdown ASCII Punctuation\" chars\n// http://spec.commonmark.org/0.15/#ascii-punctuation-character\nfunction isTerminatorChar(ch) {\n switch (ch) {\n case 0x0A/* \\n */:\n case 0x21/* ! */:\n case 0x23/* # */:\n case 0x24/* $ */:\n case 0x25/* % */:\n case 0x26/* & */:\n case 0x2A/* * */:\n case 0x2B/* + */:\n case 0x2D/* - */:\n case 0x3A/* : */:\n case 0x3C/* < */:\n case 0x3D/* = */:\n case 0x3E/* > */:\n case 0x40/* @ */:\n case 0x5B/* [ */:\n case 0x5C/* \\ */:\n case 0x5D/* ] */:\n case 0x5E/* ^ */:\n case 0x5F/* _ */:\n case 0x60/* ` */:\n case 0x7B/* { */:\n case 0x7D/* } */:\n case 0x7E/* ~ */:\n return true;\n default:\n return false;\n }\n}\n\nmodule.exports = function text(state, silent) {\n var pos = state.pos;\n\n while (pos < state.posMax && !isTerminatorChar(state.src.charCodeAt(pos))) {\n pos++;\n }\n\n if (pos === state.pos) { return false; }\n\n if (!silent) { state.pending += state.src.slice(state.pos, pos); }\n\n state.pos = pos;\n\n return true;\n};\n\n// Alternative implementation, for memory.\n//\n// It costs 10% of performance, but allows extend terminators list, if place it\n// to `ParcerInline` property. Probably, will switch to it sometime, such\n// flexibility required.\n\n/*\nvar TERMINATOR_RE = /[\\n!#$%&*+\\-:<=>@[\\\\\\]^_`{}~]/;\n\nmodule.exports = function text(state, silent) {\n var pos = state.pos,\n idx = state.src.slice(pos).search(TERMINATOR_RE);\n\n // first char is terminator -> empty text\n if (idx === 0) { return false; }\n\n // no terminator -> text till end of string\n if (idx < 0) {\n if (!silent) { state.pending += state.src.slice(pos); }\n state.pos = state.src.length;\n return true;\n }\n\n if (!silent) { state.pending += state.src.slice(pos, pos + idx); }\n\n state.pos += idx;\n\n return true;\n};*/\n", "// Proceess '\\n'\n\n'use strict';\n\nvar isSpace = require('../common/utils').isSpace;\n\n\nmodule.exports = function newline(state, silent) {\n var pmax, max, ws, pos = state.pos;\n\n if (state.src.charCodeAt(pos) !== 0x0A/* \\n */) { return false; }\n\n pmax = state.pending.length - 1;\n max = state.posMax;\n\n // ' \\n' -> hardbreak\n // Lookup in pending chars is bad practice! Don't copy to other rules!\n // Pending string is stored in concat mode, indexed lookups will cause\n // convertion to flat mode.\n if (!silent) {\n if (pmax >= 0 && state.pending.charCodeAt(pmax) === 0x20) {\n if (pmax >= 1 && state.pending.charCodeAt(pmax - 1) === 0x20) {\n // Find whitespaces tail of pending chars.\n ws = pmax - 1;\n while (ws >= 1 && state.pending.charCodeAt(ws - 1) === 0x20) ws--;\n\n state.pending = state.pending.slice(0, ws);\n state.push('hardbreak', 'br', 0);\n } else {\n state.pending = state.pending.slice(0, -1);\n state.push('softbreak', 'br', 0);\n }\n\n } else {\n state.push('softbreak', 'br', 0);\n }\n }\n\n pos++;\n\n // skip heading spaces for next line\n while (pos < max && isSpace(state.src.charCodeAt(pos))) { pos++; }\n\n state.pos = pos;\n return true;\n};\n", "// Process escaped chars and hardbreaks\n\n'use strict';\n\nvar isSpace = require('../common/utils').isSpace;\n\nvar ESCAPED = [];\n\nfor (var i = 0; i < 256; i++) { ESCAPED.push(0); }\n\n'\\\\!\"#$%&\\'()*+,./:;<=>?@[]^_`{|}~-'\n .split('').forEach(function (ch) { ESCAPED[ch.charCodeAt(0)] = 1; });\n\n\nmodule.exports = function escape(state, silent) {\n var ch, pos = state.pos, max = state.posMax;\n\n if (state.src.charCodeAt(pos) !== 0x5C/* \\ */) { return false; }\n\n pos++;\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (ch < 256 && ESCAPED[ch] !== 0) {\n if (!silent) { state.pending += state.src[pos]; }\n state.pos += 2;\n return true;\n }\n\n if (ch === 0x0A) {\n if (!silent) {\n state.push('hardbreak', 'br', 0);\n }\n\n pos++;\n // skip leading whitespaces from next line\n while (pos < max) {\n ch = state.src.charCodeAt(pos);\n if (!isSpace(ch)) { break; }\n pos++;\n }\n\n state.pos = pos;\n return true;\n }\n }\n\n if (!silent) { state.pending += '\\\\'; }\n state.pos++;\n return true;\n};\n", "// Parse backticks\n\n'use strict';\n\n\nmodule.exports = function backtick(state, silent) {\n var start, max, marker, token, matchStart, matchEnd, openerLength, closerLength,\n pos = state.pos,\n ch = state.src.charCodeAt(pos);\n\n if (ch !== 0x60/* ` */) { return false; }\n\n start = pos;\n pos++;\n max = state.posMax;\n\n // scan marker length\n while (pos < max && state.src.charCodeAt(pos) === 0x60/* ` */) { pos++; }\n\n marker = state.src.slice(start, pos);\n openerLength = marker.length;\n\n if (state.backticksScanned && (state.backticks[openerLength] || 0) <= start) {\n if (!silent) state.pending += marker;\n state.pos += openerLength;\n return true;\n }\n\n matchStart = matchEnd = pos;\n\n // Nothing found in the cache, scan until the end of the line (or until marker is found)\n while ((matchStart = state.src.indexOf('`', matchEnd)) !== -1) {\n matchEnd = matchStart + 1;\n\n // scan marker length\n while (matchEnd < max && state.src.charCodeAt(matchEnd) === 0x60/* ` */) { matchEnd++; }\n\n closerLength = matchEnd - matchStart;\n\n if (closerLength === openerLength) {\n // Found matching closer length.\n if (!silent) {\n token = state.push('code_inline', 'code', 0);\n token.markup = marker;\n token.content = state.src.slice(pos, matchStart)\n .replace(/\\n/g, ' ')\n .replace(/^ (.+) $/, '$1');\n }\n state.pos = matchEnd;\n return true;\n }\n\n // Some different length found, put it in cache as upper limit of where closer can be found\n state.backticks[closerLength] = matchStart;\n }\n\n // Scanned through the end, didn't find anything\n state.backticksScanned = true;\n\n if (!silent) state.pending += marker;\n state.pos += openerLength;\n return true;\n};\n", "// ~~strike through~~\n//\n'use strict';\n\n\n// Insert each marker as a separate text token, and add it to delimiter list\n//\nmodule.exports.tokenize = function strikethrough(state, silent) {\n var i, scanned, token, len, ch,\n start = state.pos,\n marker = state.src.charCodeAt(start);\n\n if (silent) { return false; }\n\n if (marker !== 0x7E/* ~ */) { return false; }\n\n scanned = state.scanDelims(state.pos, true);\n len = scanned.length;\n ch = String.fromCharCode(marker);\n\n if (len < 2) { return false; }\n\n if (len % 2) {\n token = state.push('text', '', 0);\n token.content = ch;\n len--;\n }\n\n for (i = 0; i < len; i += 2) {\n token = state.push('text', '', 0);\n token.content = ch + ch;\n\n state.delimiters.push({\n marker: marker,\n length: 0, // disable \"rule of 3\" length checks meant for emphasis\n token: state.tokens.length - 1,\n end: -1,\n open: scanned.can_open,\n close: scanned.can_close\n });\n }\n\n state.pos += scanned.length;\n\n return true;\n};\n\n\nfunction postProcess(state, delimiters) {\n var i, j,\n startDelim,\n endDelim,\n token,\n loneMarkers = [],\n max = delimiters.length;\n\n for (i = 0; i < max; i++) {\n startDelim = delimiters[i];\n\n if (startDelim.marker !== 0x7E/* ~ */) {\n continue;\n }\n\n if (startDelim.end === -1) {\n continue;\n }\n\n endDelim = delimiters[startDelim.end];\n\n token = state.tokens[startDelim.token];\n token.type = 's_open';\n token.tag = 's';\n token.nesting = 1;\n token.markup = '~~';\n token.content = '';\n\n token = state.tokens[endDelim.token];\n token.type = 's_close';\n token.tag = 's';\n token.nesting = -1;\n token.markup = '~~';\n token.content = '';\n\n if (state.tokens[endDelim.token - 1].type === 'text' &&\n state.tokens[endDelim.token - 1].content === '~') {\n\n loneMarkers.push(endDelim.token - 1);\n }\n }\n\n // If a marker sequence has an odd number of characters, it's splitted\n // like this: `~~~~~` -> `~` + `~~` + `~~`, leaving one marker at the\n // start of the sequence.\n //\n // So, we have to move all those markers after subsequent s_close tags.\n //\n while (loneMarkers.length) {\n i = loneMarkers.pop();\n j = i + 1;\n\n while (j < state.tokens.length && state.tokens[j].type === 's_close') {\n j++;\n }\n\n j--;\n\n if (i !== j) {\n token = state.tokens[j];\n state.tokens[j] = state.tokens[i];\n state.tokens[i] = token;\n }\n }\n}\n\n\n// Walk through delimiter list and replace text tokens with tags\n//\nmodule.exports.postProcess = function strikethrough(state) {\n var curr,\n tokens_meta = state.tokens_meta,\n max = state.tokens_meta.length;\n\n postProcess(state, state.delimiters);\n\n for (curr = 0; curr < max; curr++) {\n if (tokens_meta[curr] && tokens_meta[curr].delimiters) {\n postProcess(state, tokens_meta[curr].delimiters);\n }\n }\n};\n", "// Process *this* and _that_\n//\n'use strict';\n\n\n// Insert each marker as a separate text token, and add it to delimiter list\n//\nmodule.exports.tokenize = function emphasis(state, silent) {\n var i, scanned, token,\n start = state.pos,\n marker = state.src.charCodeAt(start);\n\n if (silent) { return false; }\n\n if (marker !== 0x5F /* _ */ && marker !== 0x2A /* * */) { return false; }\n\n scanned = state.scanDelims(state.pos, marker === 0x2A);\n\n for (i = 0; i < scanned.length; i++) {\n token = state.push('text', '', 0);\n token.content = String.fromCharCode(marker);\n\n state.delimiters.push({\n // Char code of the starting marker (number).\n //\n marker: marker,\n\n // Total length of these series of delimiters.\n //\n length: scanned.length,\n\n // A position of the token this delimiter corresponds to.\n //\n token: state.tokens.length - 1,\n\n // If this delimiter is matched as a valid opener, `end` will be\n // equal to its position, otherwise it's `-1`.\n //\n end: -1,\n\n // Boolean flags that determine if this delimiter could open or close\n // an emphasis.\n //\n open: scanned.can_open,\n close: scanned.can_close\n });\n }\n\n state.pos += scanned.length;\n\n return true;\n};\n\n\nfunction postProcess(state, delimiters) {\n var i,\n startDelim,\n endDelim,\n token,\n ch,\n isStrong,\n max = delimiters.length;\n\n for (i = max - 1; i >= 0; i--) {\n startDelim = delimiters[i];\n\n if (startDelim.marker !== 0x5F/* _ */ && startDelim.marker !== 0x2A/* * */) {\n continue;\n }\n\n // Process only opening markers\n if (startDelim.end === -1) {\n continue;\n }\n\n endDelim = delimiters[startDelim.end];\n\n // If the previous delimiter has the same marker and is adjacent to this one,\n // merge those into one strong delimiter.\n //\n // `whatever` -> `whatever`\n //\n isStrong = i > 0 &&\n delimiters[i - 1].end === startDelim.end + 1 &&\n // check that first two markers match and adjacent\n delimiters[i - 1].marker === startDelim.marker &&\n delimiters[i - 1].token === startDelim.token - 1 &&\n // check that last two markers are adjacent (we can safely assume they match)\n delimiters[startDelim.end + 1].token === endDelim.token + 1;\n\n ch = String.fromCharCode(startDelim.marker);\n\n token = state.tokens[startDelim.token];\n token.type = isStrong ? 'strong_open' : 'em_open';\n token.tag = isStrong ? 'strong' : 'em';\n token.nesting = 1;\n token.markup = isStrong ? ch + ch : ch;\n token.content = '';\n\n token = state.tokens[endDelim.token];\n token.type = isStrong ? 'strong_close' : 'em_close';\n token.tag = isStrong ? 'strong' : 'em';\n token.nesting = -1;\n token.markup = isStrong ? ch + ch : ch;\n token.content = '';\n\n if (isStrong) {\n state.tokens[delimiters[i - 1].token].content = '';\n state.tokens[delimiters[startDelim.end + 1].token].content = '';\n i--;\n }\n }\n}\n\n\n// Walk through delimiter list and replace text tokens with tags\n//\nmodule.exports.postProcess = function emphasis(state) {\n var curr,\n tokens_meta = state.tokens_meta,\n max = state.tokens_meta.length;\n\n postProcess(state, state.delimiters);\n\n for (curr = 0; curr < max; curr++) {\n if (tokens_meta[curr] && tokens_meta[curr].delimiters) {\n postProcess(state, tokens_meta[curr].delimiters);\n }\n }\n};\n", "// Process [link]( \"stuff\")\n\n'use strict';\n\nvar normalizeReference = require('../common/utils').normalizeReference;\nvar isSpace = require('../common/utils').isSpace;\n\n\nmodule.exports = function link(state, silent) {\n var attrs,\n code,\n label,\n labelEnd,\n labelStart,\n pos,\n res,\n ref,\n token,\n href = '',\n title = '',\n oldPos = state.pos,\n max = state.posMax,\n start = state.pos,\n parseReference = true;\n\n if (state.src.charCodeAt(state.pos) !== 0x5B/* [ */) { return false; }\n\n labelStart = state.pos + 1;\n labelEnd = state.md.helpers.parseLinkLabel(state, state.pos, true);\n\n // parser failed to find ']', so it's not a valid link\n if (labelEnd < 0) { return false; }\n\n pos = labelEnd + 1;\n if (pos < max && state.src.charCodeAt(pos) === 0x28/* ( */) {\n //\n // Inline link\n //\n\n // might have found a valid shortcut link, disable reference parsing\n parseReference = false;\n\n // [link]( \"title\" )\n // ^^ skipping these spaces\n pos++;\n for (; pos < max; pos++) {\n code = state.src.charCodeAt(pos);\n if (!isSpace(code) && code !== 0x0A) { break; }\n }\n if (pos >= max) { return false; }\n\n // [link]( \"title\" )\n // ^^^^^^ parsing link destination\n start = pos;\n res = state.md.helpers.parseLinkDestination(state.src, pos, state.posMax);\n if (res.ok) {\n href = state.md.normalizeLink(res.str);\n if (state.md.validateLink(href)) {\n pos = res.pos;\n } else {\n href = '';\n }\n\n // [link]( \"title\" )\n // ^^ skipping these spaces\n start = pos;\n for (; pos < max; pos++) {\n code = state.src.charCodeAt(pos);\n if (!isSpace(code) && code !== 0x0A) { break; }\n }\n\n // [link]( \"title\" )\n // ^^^^^^^ parsing link title\n res = state.md.helpers.parseLinkTitle(state.src, pos, state.posMax);\n if (pos < max && start !== pos && res.ok) {\n title = res.str;\n pos = res.pos;\n\n // [link]( \"title\" )\n // ^^ skipping these spaces\n for (; pos < max; pos++) {\n code = state.src.charCodeAt(pos);\n if (!isSpace(code) && code !== 0x0A) { break; }\n }\n }\n }\n\n if (pos >= max || state.src.charCodeAt(pos) !== 0x29/* ) */) {\n // parsing a valid shortcut link failed, fallback to reference\n parseReference = true;\n }\n pos++;\n }\n\n if (parseReference) {\n //\n // Link reference\n //\n if (typeof state.env.references === 'undefined') { return false; }\n\n if (pos < max && state.src.charCodeAt(pos) === 0x5B/* [ */) {\n start = pos + 1;\n pos = state.md.helpers.parseLinkLabel(state, pos);\n if (pos >= 0) {\n label = state.src.slice(start, pos++);\n } else {\n pos = labelEnd + 1;\n }\n } else {\n pos = labelEnd + 1;\n }\n\n // covers label === '' and label === undefined\n // (collapsed reference link and shortcut reference link respectively)\n if (!label) { label = state.src.slice(labelStart, labelEnd); }\n\n ref = state.env.references[normalizeReference(label)];\n if (!ref) {\n state.pos = oldPos;\n return false;\n }\n href = ref.href;\n title = ref.title;\n }\n\n //\n // We found the end of the link, and know for a fact it's a valid link;\n // so all that's left to do is to call tokenizer.\n //\n if (!silent) {\n state.pos = labelStart;\n state.posMax = labelEnd;\n\n token = state.push('link_open', 'a', 1);\n token.attrs = attrs = [ [ 'href', href ] ];\n if (title) {\n attrs.push([ 'title', title ]);\n }\n\n state.md.inline.tokenize(state);\n\n token = state.push('link_close', 'a', -1);\n }\n\n state.pos = pos;\n state.posMax = max;\n return true;\n};\n", "// Process ![image]( \"title\")\n\n'use strict';\n\nvar normalizeReference = require('../common/utils').normalizeReference;\nvar isSpace = require('../common/utils').isSpace;\n\n\nmodule.exports = function image(state, silent) {\n var attrs,\n code,\n content,\n label,\n labelEnd,\n labelStart,\n pos,\n ref,\n res,\n title,\n token,\n tokens,\n start,\n href = '',\n oldPos = state.pos,\n max = state.posMax;\n\n if (state.src.charCodeAt(state.pos) !== 0x21/* ! */) { return false; }\n if (state.src.charCodeAt(state.pos + 1) !== 0x5B/* [ */) { return false; }\n\n labelStart = state.pos + 2;\n labelEnd = state.md.helpers.parseLinkLabel(state, state.pos + 1, false);\n\n // parser failed to find ']', so it's not a valid link\n if (labelEnd < 0) { return false; }\n\n pos = labelEnd + 1;\n if (pos < max && state.src.charCodeAt(pos) === 0x28/* ( */) {\n //\n // Inline link\n //\n\n // [link]( \"title\" )\n // ^^ skipping these spaces\n pos++;\n for (; pos < max; pos++) {\n code = state.src.charCodeAt(pos);\n if (!isSpace(code) && code !== 0x0A) { break; }\n }\n if (pos >= max) { return false; }\n\n // [link]( \"title\" )\n // ^^^^^^ parsing link destination\n start = pos;\n res = state.md.helpers.parseLinkDestination(state.src, pos, state.posMax);\n if (res.ok) {\n href = state.md.normalizeLink(res.str);\n if (state.md.validateLink(href)) {\n pos = res.pos;\n } else {\n href = '';\n }\n }\n\n // [link]( \"title\" )\n // ^^ skipping these spaces\n start = pos;\n for (; pos < max; pos++) {\n code = state.src.charCodeAt(pos);\n if (!isSpace(code) && code !== 0x0A) { break; }\n }\n\n // [link]( \"title\" )\n // ^^^^^^^ parsing link title\n res = state.md.helpers.parseLinkTitle(state.src, pos, state.posMax);\n if (pos < max && start !== pos && res.ok) {\n title = res.str;\n pos = res.pos;\n\n // [link]( \"title\" )\n // ^^ skipping these spaces\n for (; pos < max; pos++) {\n code = state.src.charCodeAt(pos);\n if (!isSpace(code) && code !== 0x0A) { break; }\n }\n } else {\n title = '';\n }\n\n if (pos >= max || state.src.charCodeAt(pos) !== 0x29/* ) */) {\n state.pos = oldPos;\n return false;\n }\n pos++;\n } else {\n //\n // Link reference\n //\n if (typeof state.env.references === 'undefined') { return false; }\n\n if (pos < max && state.src.charCodeAt(pos) === 0x5B/* [ */) {\n start = pos + 1;\n pos = state.md.helpers.parseLinkLabel(state, pos);\n if (pos >= 0) {\n label = state.src.slice(start, pos++);\n } else {\n pos = labelEnd + 1;\n }\n } else {\n pos = labelEnd + 1;\n }\n\n // covers label === '' and label === undefined\n // (collapsed reference link and shortcut reference link respectively)\n if (!label) { label = state.src.slice(labelStart, labelEnd); }\n\n ref = state.env.references[normalizeReference(label)];\n if (!ref) {\n state.pos = oldPos;\n return false;\n }\n href = ref.href;\n title = ref.title;\n }\n\n //\n // We found the end of the link, and know for a fact it's a valid link;\n // so all that's left to do is to call tokenizer.\n //\n if (!silent) {\n content = state.src.slice(labelStart, labelEnd);\n\n state.md.inline.parse(\n content,\n state.md,\n state.env,\n tokens = []\n );\n\n token = state.push('image', 'img', 0);\n token.attrs = attrs = [ [ 'src', href ], [ 'alt', '' ] ];\n token.children = tokens;\n token.content = content;\n\n if (title) {\n attrs.push([ 'title', title ]);\n }\n }\n\n state.pos = pos;\n state.posMax = max;\n return true;\n};\n", "// Process autolinks ''\n\n'use strict';\n\n\n/*eslint max-len:0*/\nvar EMAIL_RE = /^([a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/;\nvar AUTOLINK_RE = /^([a-zA-Z][a-zA-Z0-9+.\\-]{1,31}):([^<>\\x00-\\x20]*)$/;\n\n\nmodule.exports = function autolink(state, silent) {\n var url, fullUrl, token, ch, start, max,\n pos = state.pos;\n\n if (state.src.charCodeAt(pos) !== 0x3C/* < */) { return false; }\n\n start = state.pos;\n max = state.posMax;\n\n for (;;) {\n if (++pos >= max) return false;\n\n ch = state.src.charCodeAt(pos);\n\n if (ch === 0x3C /* < */) return false;\n if (ch === 0x3E /* > */) break;\n }\n\n url = state.src.slice(start + 1, pos);\n\n if (AUTOLINK_RE.test(url)) {\n fullUrl = state.md.normalizeLink(url);\n if (!state.md.validateLink(fullUrl)) { return false; }\n\n if (!silent) {\n token = state.push('link_open', 'a', 1);\n token.attrs = [ [ 'href', fullUrl ] ];\n token.markup = 'autolink';\n token.info = 'auto';\n\n token = state.push('text', '', 0);\n token.content = state.md.normalizeLinkText(url);\n\n token = state.push('link_close', 'a', -1);\n token.markup = 'autolink';\n token.info = 'auto';\n }\n\n state.pos += url.length + 2;\n return true;\n }\n\n if (EMAIL_RE.test(url)) {\n fullUrl = state.md.normalizeLink('mailto:' + url);\n if (!state.md.validateLink(fullUrl)) { return false; }\n\n if (!silent) {\n token = state.push('link_open', 'a', 1);\n token.attrs = [ [ 'href', fullUrl ] ];\n token.markup = 'autolink';\n token.info = 'auto';\n\n token = state.push('text', '', 0);\n token.content = state.md.normalizeLinkText(url);\n\n token = state.push('link_close', 'a', -1);\n token.markup = 'autolink';\n token.info = 'auto';\n }\n\n state.pos += url.length + 2;\n return true;\n }\n\n return false;\n};\n", "// Process html tags\n\n'use strict';\n\n\nvar HTML_TAG_RE = require('../common/html_re').HTML_TAG_RE;\n\n\nfunction isLetter(ch) {\n /*eslint no-bitwise:0*/\n var lc = ch | 0x20; // to lower case\n return (lc >= 0x61/* a */) && (lc <= 0x7a/* z */);\n}\n\n\nmodule.exports = function html_inline(state, silent) {\n var ch, match, max, token,\n pos = state.pos;\n\n if (!state.md.options.html) { return false; }\n\n // Check start\n max = state.posMax;\n if (state.src.charCodeAt(pos) !== 0x3C/* < */ ||\n pos + 2 >= max) {\n return false;\n }\n\n // Quick fail on second char\n ch = state.src.charCodeAt(pos + 1);\n if (ch !== 0x21/* ! */ &&\n ch !== 0x3F/* ? */ &&\n ch !== 0x2F/* / */ &&\n !isLetter(ch)) {\n return false;\n }\n\n match = state.src.slice(pos).match(HTML_TAG_RE);\n if (!match) { return false; }\n\n if (!silent) {\n token = state.push('html_inline', '', 0);\n token.content = state.src.slice(pos, pos + match[0].length);\n }\n state.pos += match[0].length;\n return true;\n};\n", "// Process html entity - {, ¯, ", ...\n\n'use strict';\n\nvar entities = require('../common/entities');\nvar has = require('../common/utils').has;\nvar isValidEntityCode = require('../common/utils').isValidEntityCode;\nvar fromCodePoint = require('../common/utils').fromCodePoint;\n\n\nvar DIGITAL_RE = /^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i;\nvar NAMED_RE = /^&([a-z][a-z0-9]{1,31});/i;\n\n\nmodule.exports = function entity(state, silent) {\n var ch, code, match, pos = state.pos, max = state.posMax;\n\n if (state.src.charCodeAt(pos) !== 0x26/* & */) { return false; }\n\n if (pos + 1 < max) {\n ch = state.src.charCodeAt(pos + 1);\n\n if (ch === 0x23 /* # */) {\n match = state.src.slice(pos).match(DIGITAL_RE);\n if (match) {\n if (!silent) {\n code = match[1][0].toLowerCase() === 'x' ? parseInt(match[1].slice(1), 16) : parseInt(match[1], 10);\n state.pending += isValidEntityCode(code) ? fromCodePoint(code) : fromCodePoint(0xFFFD);\n }\n state.pos += match[0].length;\n return true;\n }\n } else {\n match = state.src.slice(pos).match(NAMED_RE);\n if (match) {\n if (has(entities, match[1])) {\n if (!silent) { state.pending += entities[match[1]]; }\n state.pos += match[0].length;\n return true;\n }\n }\n }\n }\n\n if (!silent) { state.pending += '&'; }\n state.pos++;\n return true;\n};\n", "// For each opening emphasis-like marker find a matching closing one\n//\n'use strict';\n\n\nfunction processDelimiters(state, delimiters) {\n var closerIdx, openerIdx, closer, opener, minOpenerIdx, newMinOpenerIdx,\n isOddMatch, lastJump,\n openersBottom = {},\n max = delimiters.length;\n\n if (!max) return;\n\n // headerIdx is the first delimiter of the current (where closer is) delimiter run\n var headerIdx = 0;\n var lastTokenIdx = -2; // needs any value lower than -1\n var jumps = [];\n\n for (closerIdx = 0; closerIdx < max; closerIdx++) {\n closer = delimiters[closerIdx];\n\n jumps.push(0);\n\n // markers belong to same delimiter run if:\n // - they have adjacent tokens\n // - AND markers are the same\n //\n if (delimiters[headerIdx].marker !== closer.marker || lastTokenIdx !== closer.token - 1) {\n headerIdx = closerIdx;\n }\n\n lastTokenIdx = closer.token;\n\n // Length is only used for emphasis-specific \"rule of 3\",\n // if it's not defined (in strikethrough or 3rd party plugins),\n // we can default it to 0 to disable those checks.\n //\n closer.length = closer.length || 0;\n\n if (!closer.close) continue;\n\n // Previously calculated lower bounds (previous fails)\n // for each marker, each delimiter length modulo 3,\n // and for whether this closer can be an opener;\n // https://github.com/commonmark/cmark/commit/34250e12ccebdc6372b8b49c44fab57c72443460\n if (!openersBottom.hasOwnProperty(closer.marker)) {\n openersBottom[closer.marker] = [ -1, -1, -1, -1, -1, -1 ];\n }\n\n minOpenerIdx = openersBottom[closer.marker][(closer.open ? 3 : 0) + (closer.length % 3)];\n\n openerIdx = headerIdx - jumps[headerIdx] - 1;\n\n newMinOpenerIdx = openerIdx;\n\n for (; openerIdx > minOpenerIdx; openerIdx -= jumps[openerIdx] + 1) {\n opener = delimiters[openerIdx];\n\n if (opener.marker !== closer.marker) continue;\n\n if (opener.open && opener.end < 0) {\n\n isOddMatch = false;\n\n // from spec:\n //\n // If one of the delimiters can both open and close emphasis, then the\n // sum of the lengths of the delimiter runs containing the opening and\n // closing delimiters must not be a multiple of 3 unless both lengths\n // are multiples of 3.\n //\n if (opener.close || closer.open) {\n if ((opener.length + closer.length) % 3 === 0) {\n if (opener.length % 3 !== 0 || closer.length % 3 !== 0) {\n isOddMatch = true;\n }\n }\n }\n\n if (!isOddMatch) {\n // If previous delimiter cannot be an opener, we can safely skip\n // the entire sequence in future checks. This is required to make\n // sure algorithm has linear complexity (see *_*_*_*_*_... case).\n //\n lastJump = openerIdx > 0 && !delimiters[openerIdx - 1].open ?\n jumps[openerIdx - 1] + 1 :\n 0;\n\n jumps[closerIdx] = closerIdx - openerIdx + lastJump;\n jumps[openerIdx] = lastJump;\n\n closer.open = false;\n opener.end = closerIdx;\n opener.close = false;\n newMinOpenerIdx = -1;\n // treat next token as start of run,\n // it optimizes skips in **<...>**a**<...>** pathological case\n lastTokenIdx = -2;\n break;\n }\n }\n }\n\n if (newMinOpenerIdx !== -1) {\n // If match for this delimiter run failed, we want to set lower bound for\n // future lookups. This is required to make sure algorithm has linear\n // complexity.\n //\n // See details here:\n // https://github.com/commonmark/cmark/issues/178#issuecomment-270417442\n //\n openersBottom[closer.marker][(closer.open ? 3 : 0) + ((closer.length || 0) % 3)] = newMinOpenerIdx;\n }\n }\n}\n\n\nmodule.exports = function link_pairs(state) {\n var curr,\n tokens_meta = state.tokens_meta,\n max = state.tokens_meta.length;\n\n processDelimiters(state, state.delimiters);\n\n for (curr = 0; curr < max; curr++) {\n if (tokens_meta[curr] && tokens_meta[curr].delimiters) {\n processDelimiters(state, tokens_meta[curr].delimiters);\n }\n }\n};\n", "// Clean up tokens after emphasis and strikethrough postprocessing:\n// merge adjacent text nodes into one and re-calculate all token levels\n//\n// This is necessary because initially emphasis delimiter markers (*, _, ~)\n// are treated as their own separate text tokens. Then emphasis rule either\n// leaves them as text (needed to merge with adjacent text) or turns them\n// into opening/closing tags (which messes up levels inside).\n//\n'use strict';\n\n\nmodule.exports = function text_collapse(state) {\n var curr, last,\n level = 0,\n tokens = state.tokens,\n max = state.tokens.length;\n\n for (curr = last = 0; curr < max; curr++) {\n // re-calculate levels after emphasis/strikethrough turns some text nodes\n // into opening/closing tags\n if (tokens[curr].nesting < 0) level--; // closing tag\n tokens[curr].level = level;\n if (tokens[curr].nesting > 0) level++; // opening tag\n\n if (tokens[curr].type === 'text' &&\n curr + 1 < max &&\n tokens[curr + 1].type === 'text') {\n\n // collapse two adjacent text nodes\n tokens[curr + 1].content = tokens[curr].content + tokens[curr + 1].content;\n } else {\n if (curr !== last) { tokens[last] = tokens[curr]; }\n\n last++;\n }\n }\n\n if (curr !== last) {\n tokens.length = last;\n }\n};\n", "// Inline parser state\n\n'use strict';\n\n\nvar Token = require('../token');\nvar isWhiteSpace = require('../common/utils').isWhiteSpace;\nvar isPunctChar = require('../common/utils').isPunctChar;\nvar isMdAsciiPunct = require('../common/utils').isMdAsciiPunct;\n\n\nfunction StateInline(src, md, env, outTokens) {\n this.src = src;\n this.env = env;\n this.md = md;\n this.tokens = outTokens;\n this.tokens_meta = Array(outTokens.length);\n\n this.pos = 0;\n this.posMax = this.src.length;\n this.level = 0;\n this.pending = '';\n this.pendingLevel = 0;\n\n // Stores { start: end } pairs. Useful for backtrack\n // optimization of pairs parse (emphasis, strikes).\n this.cache = {};\n\n // List of emphasis-like delimiters for current tag\n this.delimiters = [];\n\n // Stack of delimiter lists for upper level tags\n this._prev_delimiters = [];\n\n // backtick length => last seen position\n this.backticks = {};\n this.backticksScanned = false;\n}\n\n\n// Flush pending text\n//\nStateInline.prototype.pushPending = function () {\n var token = new Token('text', '', 0);\n token.content = this.pending;\n token.level = this.pendingLevel;\n this.tokens.push(token);\n this.pending = '';\n return token;\n};\n\n\n// Push new token to \"stream\".\n// If pending text exists - flush it as text token\n//\nStateInline.prototype.push = function (type, tag, nesting) {\n if (this.pending) {\n this.pushPending();\n }\n\n var token = new Token(type, tag, nesting);\n var token_meta = null;\n\n if (nesting < 0) {\n // closing tag\n this.level--;\n this.delimiters = this._prev_delimiters.pop();\n }\n\n token.level = this.level;\n\n if (nesting > 0) {\n // opening tag\n this.level++;\n this._prev_delimiters.push(this.delimiters);\n this.delimiters = [];\n token_meta = { delimiters: this.delimiters };\n }\n\n this.pendingLevel = this.level;\n this.tokens.push(token);\n this.tokens_meta.push(token_meta);\n return token;\n};\n\n\n// Scan a sequence of emphasis-like markers, and determine whether\n// it can start an emphasis sequence or end an emphasis sequence.\n//\n// - start - position to scan from (it should point at a valid marker);\n// - canSplitWord - determine if these markers can be found inside a word\n//\nStateInline.prototype.scanDelims = function (start, canSplitWord) {\n var pos = start, lastChar, nextChar, count, can_open, can_close,\n isLastWhiteSpace, isLastPunctChar,\n isNextWhiteSpace, isNextPunctChar,\n left_flanking = true,\n right_flanking = true,\n max = this.posMax,\n marker = this.src.charCodeAt(start);\n\n // treat beginning of the line as a whitespace\n lastChar = start > 0 ? this.src.charCodeAt(start - 1) : 0x20;\n\n while (pos < max && this.src.charCodeAt(pos) === marker) { pos++; }\n\n count = pos - start;\n\n // treat end of the line as a whitespace\n nextChar = pos < max ? this.src.charCodeAt(pos) : 0x20;\n\n isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar));\n isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar));\n\n isLastWhiteSpace = isWhiteSpace(lastChar);\n isNextWhiteSpace = isWhiteSpace(nextChar);\n\n if (isNextWhiteSpace) {\n left_flanking = false;\n } else if (isNextPunctChar) {\n if (!(isLastWhiteSpace || isLastPunctChar)) {\n left_flanking = false;\n }\n }\n\n if (isLastWhiteSpace) {\n right_flanking = false;\n } else if (isLastPunctChar) {\n if (!(isNextWhiteSpace || isNextPunctChar)) {\n right_flanking = false;\n }\n }\n\n if (!canSplitWord) {\n can_open = left_flanking && (!right_flanking || isLastPunctChar);\n can_close = right_flanking && (!left_flanking || isNextPunctChar);\n } else {\n can_open = left_flanking;\n can_close = right_flanking;\n }\n\n return {\n can_open: can_open,\n can_close: can_close,\n length: count\n };\n};\n\n\n// re-export Token class to use in block rules\nStateInline.prototype.Token = Token;\n\n\nmodule.exports = StateInline;\n", "/** internal\n * class ParserInline\n *\n * Tokenizes paragraph content.\n **/\n'use strict';\n\n\nvar Ruler = require('./ruler');\n\n\n////////////////////////////////////////////////////////////////////////////////\n// Parser rules\n\nvar _rules = [\n [ 'text', require('./rules_inline/text') ],\n [ 'newline', require('./rules_inline/newline') ],\n [ 'escape', require('./rules_inline/escape') ],\n [ 'backticks', require('./rules_inline/backticks') ],\n [ 'strikethrough', require('./rules_inline/strikethrough').tokenize ],\n [ 'emphasis', require('./rules_inline/emphasis').tokenize ],\n [ 'link', require('./rules_inline/link') ],\n [ 'image', require('./rules_inline/image') ],\n [ 'autolink', require('./rules_inline/autolink') ],\n [ 'html_inline', require('./rules_inline/html_inline') ],\n [ 'entity', require('./rules_inline/entity') ]\n];\n\nvar _rules2 = [\n [ 'balance_pairs', require('./rules_inline/balance_pairs') ],\n [ 'strikethrough', require('./rules_inline/strikethrough').postProcess ],\n [ 'emphasis', require('./rules_inline/emphasis').postProcess ],\n [ 'text_collapse', require('./rules_inline/text_collapse') ]\n];\n\n\n/**\n * new ParserInline()\n **/\nfunction ParserInline() {\n var i;\n\n /**\n * ParserInline#ruler -> Ruler\n *\n * [[Ruler]] instance. Keep configuration of inline rules.\n **/\n this.ruler = new Ruler();\n\n for (i = 0; i < _rules.length; i++) {\n this.ruler.push(_rules[i][0], _rules[i][1]);\n }\n\n /**\n * ParserInline#ruler2 -> Ruler\n *\n * [[Ruler]] instance. Second ruler used for post-processing\n * (e.g. in emphasis-like rules).\n **/\n this.ruler2 = new Ruler();\n\n for (i = 0; i < _rules2.length; i++) {\n this.ruler2.push(_rules2[i][0], _rules2[i][1]);\n }\n}\n\n\n// Skip single token by running all rules in validation mode;\n// returns `true` if any rule reported success\n//\nParserInline.prototype.skipToken = function (state) {\n var ok, i, pos = state.pos,\n rules = this.ruler.getRules(''),\n len = rules.length,\n maxNesting = state.md.options.maxNesting,\n cache = state.cache;\n\n\n if (typeof cache[pos] !== 'undefined') {\n state.pos = cache[pos];\n return;\n }\n\n if (state.level < maxNesting) {\n for (i = 0; i < len; i++) {\n // Increment state.level and decrement it later to limit recursion.\n // It's harmless to do here, because no tokens are created. But ideally,\n // we'd need a separate private state variable for this purpose.\n //\n state.level++;\n ok = rules[i](state, true);\n state.level--;\n\n if (ok) { break; }\n }\n } else {\n // Too much nesting, just skip until the end of the paragraph.\n //\n // NOTE: this will cause links to behave incorrectly in the following case,\n // when an amount of `[` is exactly equal to `maxNesting + 1`:\n //\n // [[[[[[[[[[[[[[[[[[[[[foo]()\n //\n // TODO: remove this workaround when CM standard will allow nested links\n // (we can replace it by preventing links from being parsed in\n // validation mode)\n //\n state.pos = state.posMax;\n }\n\n if (!ok) { state.pos++; }\n cache[pos] = state.pos;\n};\n\n\n// Generate tokens for input range\n//\nParserInline.prototype.tokenize = function (state) {\n var ok, i,\n rules = this.ruler.getRules(''),\n len = rules.length,\n end = state.posMax,\n maxNesting = state.md.options.maxNesting;\n\n while (state.pos < end) {\n // Try all possible rules.\n // On success, rule should:\n //\n // - update `state.pos`\n // - update `state.tokens`\n // - return true\n\n if (state.level < maxNesting) {\n for (i = 0; i < len; i++) {\n ok = rules[i](state, false);\n if (ok) { break; }\n }\n }\n\n if (ok) {\n if (state.pos >= end) { break; }\n continue;\n }\n\n state.pending += state.src[state.pos++];\n }\n\n if (state.pending) {\n state.pushPending();\n }\n};\n\n\n/**\n * ParserInline.parse(str, md, env, outTokens)\n *\n * Process input string and push inline tokens into `outTokens`\n **/\nParserInline.prototype.parse = function (str, md, env, outTokens) {\n var i, rules, len;\n var state = new this.State(str, md, env, outTokens);\n\n this.tokenize(state);\n\n rules = this.ruler2.getRules('');\n len = rules.length;\n\n for (i = 0; i < len; i++) {\n rules[i](state);\n }\n};\n\n\nParserInline.prototype.State = require('./rules_inline/state_inline');\n\n\nmodule.exports = ParserInline;\n", "'use strict';\n\n\nmodule.exports = function (opts) {\n var re = {};\n\n // Use direct extract instead of `regenerate` to reduse browserified size\n re.src_Any = require('uc.micro/properties/Any/regex').source;\n re.src_Cc = require('uc.micro/categories/Cc/regex').source;\n re.src_Z = require('uc.micro/categories/Z/regex').source;\n re.src_P = require('uc.micro/categories/P/regex').source;\n\n // \\p{\\Z\\P\\Cc\\CF} (white spaces + control + format + punctuation)\n re.src_ZPCc = [ re.src_Z, re.src_P, re.src_Cc ].join('|');\n\n // \\p{\\Z\\Cc} (white spaces + control)\n re.src_ZCc = [ re.src_Z, re.src_Cc ].join('|');\n\n // Experimental. List of chars, completely prohibited in links\n // because can separate it from other part of text\n var text_separators = '[><\\uff5c]';\n\n // All possible word characters (everything without punctuation, spaces & controls)\n // Defined via punctuation & spaces to save space\n // Should be something like \\p{\\L\\N\\S\\M} (\\w but without `_`)\n re.src_pseudo_letter = '(?:(?!' + text_separators + '|' + re.src_ZPCc + ')' + re.src_Any + ')';\n // The same as abothe but without [0-9]\n // var src_pseudo_letter_non_d = '(?:(?![0-9]|' + src_ZPCc + ')' + src_Any + ')';\n\n ////////////////////////////////////////////////////////////////////////////////\n\n re.src_ip4 =\n\n '(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)';\n\n // Prohibit any of \"@/[]()\" in user/pass to avoid wrong domain fetch.\n re.src_auth = '(?:(?:(?!' + re.src_ZCc + '|[@/\\\\[\\\\]()]).)+@)?';\n\n re.src_port =\n\n '(?::(?:6(?:[0-4]\\\\d{3}|5(?:[0-4]\\\\d{2}|5(?:[0-2]\\\\d|3[0-5])))|[1-5]?\\\\d{1,4}))?';\n\n re.src_host_terminator =\n\n '(?=$|' + text_separators + '|' + re.src_ZPCc + ')(?!-|_|:\\\\d|\\\\.-|\\\\.(?!$|' + re.src_ZPCc + '))';\n\n re.src_path =\n\n '(?:' +\n '[/?#]' +\n '(?:' +\n '(?!' + re.src_ZCc + '|' + text_separators + '|[()[\\\\]{}.,\"\\'?!\\\\-;]).|' +\n '\\\\[(?:(?!' + re.src_ZCc + '|\\\\]).)*\\\\]|' +\n '\\\\((?:(?!' + re.src_ZCc + '|[)]).)*\\\\)|' +\n '\\\\{(?:(?!' + re.src_ZCc + '|[}]).)*\\\\}|' +\n '\\\\\"(?:(?!' + re.src_ZCc + '|[\"]).)+\\\\\"|' +\n \"\\\\'(?:(?!\" + re.src_ZCc + \"|[']).)+\\\\'|\" +\n \"\\\\'(?=\" + re.src_pseudo_letter + '|[-]).|' + // allow `I'm_king` if no pair found\n '\\\\.{2,}[a-zA-Z0-9%/&]|' + // google has many dots in \"google search\" links (#66, #81).\n // github has ... in commit range links,\n // Restrict to\n // - english\n // - percent-encoded\n // - parts of file path\n // - params separator\n // until more examples found.\n '\\\\.(?!' + re.src_ZCc + '|[.]).|' +\n (opts && opts['---'] ?\n '\\\\-(?!--(?:[^-]|$))(?:-*)|' // `---` => long dash, terminate\n :\n '\\\\-+|'\n ) +\n ',(?!' + re.src_ZCc + ').|' + // allow `,,,` in paths\n ';(?!' + re.src_ZCc + ').|' + // allow `;` if not followed by space-like char\n '\\\\!+(?!' + re.src_ZCc + '|[!]).|' + // allow `!!!` in paths, but not at the end\n '\\\\?(?!' + re.src_ZCc + '|[?]).' +\n ')+' +\n '|\\\\/' +\n ')?';\n\n // Allow anything in markdown spec, forbid quote (\") at the first position\n // because emails enclosed in quotes are far more common\n re.src_email_name =\n\n '[\\\\-;:&=\\\\+\\\\$,\\\\.a-zA-Z0-9_][\\\\-;:&=\\\\+\\\\$,\\\\\"\\\\.a-zA-Z0-9_]*';\n\n re.src_xn =\n\n 'xn--[a-z0-9\\\\-]{1,59}';\n\n // More to read about domain names\n // http://serverfault.com/questions/638260/\n\n re.src_domain_root =\n\n // Allow letters & digits (http://test1)\n '(?:' +\n re.src_xn +\n '|' +\n re.src_pseudo_letter + '{1,63}' +\n ')';\n\n re.src_domain =\n\n '(?:' +\n re.src_xn +\n '|' +\n '(?:' + re.src_pseudo_letter + ')' +\n '|' +\n '(?:' + re.src_pseudo_letter + '(?:-|' + re.src_pseudo_letter + '){0,61}' + re.src_pseudo_letter + ')' +\n ')';\n\n re.src_host =\n\n '(?:' +\n // Don't need IP check, because digits are already allowed in normal domain names\n // src_ip4 +\n // '|' +\n '(?:(?:(?:' + re.src_domain + ')\\\\.)*' + re.src_domain/*_root*/ + ')' +\n ')';\n\n re.tpl_host_fuzzy =\n\n '(?:' +\n re.src_ip4 +\n '|' +\n '(?:(?:(?:' + re.src_domain + ')\\\\.)+(?:%TLDS%))' +\n ')';\n\n re.tpl_host_no_ip_fuzzy =\n\n '(?:(?:(?:' + re.src_domain + ')\\\\.)+(?:%TLDS%))';\n\n re.src_host_strict =\n\n re.src_host + re.src_host_terminator;\n\n re.tpl_host_fuzzy_strict =\n\n re.tpl_host_fuzzy + re.src_host_terminator;\n\n re.src_host_port_strict =\n\n re.src_host + re.src_port + re.src_host_terminator;\n\n re.tpl_host_port_fuzzy_strict =\n\n re.tpl_host_fuzzy + re.src_port + re.src_host_terminator;\n\n re.tpl_host_port_no_ip_fuzzy_strict =\n\n re.tpl_host_no_ip_fuzzy + re.src_port + re.src_host_terminator;\n\n\n ////////////////////////////////////////////////////////////////////////////////\n // Main rules\n\n // Rude test fuzzy links by host, for quick deny\n re.tpl_host_fuzzy_test =\n\n 'localhost|www\\\\.|\\\\.\\\\d{1,3}\\\\.|(?:\\\\.(?:%TLDS%)(?:' + re.src_ZPCc + '|>|$))';\n\n re.tpl_email_fuzzy =\n\n '(^|' + text_separators + '|\"|\\\\(|' + re.src_ZCc + ')' +\n '(' + re.src_email_name + '@' + re.tpl_host_fuzzy_strict + ')';\n\n re.tpl_link_fuzzy =\n // Fuzzy link can't be prepended with .:/\\- and non punctuation.\n // but can start with > (markdown blockquote)\n '(^|(?![.:/\\\\-_@])(?:[$+<=>^`|\\uff5c]|' + re.src_ZPCc + '))' +\n '((?![$+<=>^`|\\uff5c])' + re.tpl_host_port_fuzzy_strict + re.src_path + ')';\n\n re.tpl_link_no_ip_fuzzy =\n // Fuzzy link can't be prepended with .:/\\- and non punctuation.\n // but can start with > (markdown blockquote)\n '(^|(?![.:/\\\\-_@])(?:[$+<=>^`|\\uff5c]|' + re.src_ZPCc + '))' +\n '((?![$+<=>^`|\\uff5c])' + re.tpl_host_port_no_ip_fuzzy_strict + re.src_path + ')';\n\n return re;\n};\n", "'use strict';\n\n\n////////////////////////////////////////////////////////////////////////////////\n// Helpers\n\n// Merge objects\n//\nfunction assign(obj /*from1, from2, from3, ...*/) {\n var sources = Array.prototype.slice.call(arguments, 1);\n\n sources.forEach(function (source) {\n if (!source) { return; }\n\n Object.keys(source).forEach(function (key) {\n obj[key] = source[key];\n });\n });\n\n return obj;\n}\n\nfunction _class(obj) { return Object.prototype.toString.call(obj); }\nfunction isString(obj) { return _class(obj) === '[object String]'; }\nfunction isObject(obj) { return _class(obj) === '[object Object]'; }\nfunction isRegExp(obj) { return _class(obj) === '[object RegExp]'; }\nfunction isFunction(obj) { return _class(obj) === '[object Function]'; }\n\n\nfunction escapeRE(str) { return str.replace(/[.?*+^$[\\]\\\\(){}|-]/g, '\\\\$&'); }\n\n////////////////////////////////////////////////////////////////////////////////\n\n\nvar defaultOptions = {\n fuzzyLink: true,\n fuzzyEmail: true,\n fuzzyIP: false\n};\n\n\nfunction isOptionsObj(obj) {\n return Object.keys(obj || {}).reduce(function (acc, k) {\n return acc || defaultOptions.hasOwnProperty(k);\n }, false);\n}\n\n\nvar defaultSchemas = {\n 'http:': {\n validate: function (text, pos, self) {\n var tail = text.slice(pos);\n\n if (!self.re.http) {\n // compile lazily, because \"host\"-containing variables can change on tlds update.\n self.re.http = new RegExp(\n '^\\\\/\\\\/' + self.re.src_auth + self.re.src_host_port_strict + self.re.src_path, 'i'\n );\n }\n if (self.re.http.test(tail)) {\n return tail.match(self.re.http)[0].length;\n }\n return 0;\n }\n },\n 'https:': 'http:',\n 'ftp:': 'http:',\n '//': {\n validate: function (text, pos, self) {\n var tail = text.slice(pos);\n\n if (!self.re.no_http) {\n // compile lazily, because \"host\"-containing variables can change on tlds update.\n self.re.no_http = new RegExp(\n '^' +\n self.re.src_auth +\n // Don't allow single-level domains, because of false positives like '//test'\n // with code comments\n '(?:localhost|(?:(?:' + self.re.src_domain + ')\\\\.)+' + self.re.src_domain_root + ')' +\n self.re.src_port +\n self.re.src_host_terminator +\n self.re.src_path,\n\n 'i'\n );\n }\n\n if (self.re.no_http.test(tail)) {\n // should not be `://` & `///`, that protects from errors in protocol name\n if (pos >= 3 && text[pos - 3] === ':') { return 0; }\n if (pos >= 3 && text[pos - 3] === '/') { return 0; }\n return tail.match(self.re.no_http)[0].length;\n }\n return 0;\n }\n },\n 'mailto:': {\n validate: function (text, pos, self) {\n var tail = text.slice(pos);\n\n if (!self.re.mailto) {\n self.re.mailto = new RegExp(\n '^' + self.re.src_email_name + '@' + self.re.src_host_strict, 'i'\n );\n }\n if (self.re.mailto.test(tail)) {\n return tail.match(self.re.mailto)[0].length;\n }\n return 0;\n }\n }\n};\n\n/*eslint-disable max-len*/\n\n// RE pattern for 2-character tlds (autogenerated by ./support/tlds_2char_gen.js)\nvar tlds_2ch_src_re = 'a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]';\n\n// DON'T try to make PRs with changes. Extend TLDs with LinkifyIt.tlds() instead\nvar tlds_default = 'biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|\u0440\u0444'.split('|');\n\n/*eslint-enable max-len*/\n\n////////////////////////////////////////////////////////////////////////////////\n\nfunction resetScanCache(self) {\n self.__index__ = -1;\n self.__text_cache__ = '';\n}\n\nfunction createValidator(re) {\n return function (text, pos) {\n var tail = text.slice(pos);\n\n if (re.test(tail)) {\n return tail.match(re)[0].length;\n }\n return 0;\n };\n}\n\nfunction createNormalizer() {\n return function (match, self) {\n self.normalize(match);\n };\n}\n\n// Schemas compiler. Build regexps.\n//\nfunction compile(self) {\n\n // Load & clone RE patterns.\n var re = self.re = require('./lib/re')(self.__opts__);\n\n // Define dynamic patterns\n var tlds = self.__tlds__.slice();\n\n self.onCompile();\n\n if (!self.__tlds_replaced__) {\n tlds.push(tlds_2ch_src_re);\n }\n tlds.push(re.src_xn);\n\n re.src_tlds = tlds.join('|');\n\n function untpl(tpl) { return tpl.replace('%TLDS%', re.src_tlds); }\n\n re.email_fuzzy = RegExp(untpl(re.tpl_email_fuzzy), 'i');\n re.link_fuzzy = RegExp(untpl(re.tpl_link_fuzzy), 'i');\n re.link_no_ip_fuzzy = RegExp(untpl(re.tpl_link_no_ip_fuzzy), 'i');\n re.host_fuzzy_test = RegExp(untpl(re.tpl_host_fuzzy_test), 'i');\n\n //\n // Compile each schema\n //\n\n var aliases = [];\n\n self.__compiled__ = {}; // Reset compiled data\n\n function schemaError(name, val) {\n throw new Error('(LinkifyIt) Invalid schema \"' + name + '\": ' + val);\n }\n\n Object.keys(self.__schemas__).forEach(function (name) {\n var val = self.__schemas__[name];\n\n // skip disabled methods\n if (val === null) { return; }\n\n var compiled = { validate: null, link: null };\n\n self.__compiled__[name] = compiled;\n\n if (isObject(val)) {\n if (isRegExp(val.validate)) {\n compiled.validate = createValidator(val.validate);\n } else if (isFunction(val.validate)) {\n compiled.validate = val.validate;\n } else {\n schemaError(name, val);\n }\n\n if (isFunction(val.normalize)) {\n compiled.normalize = val.normalize;\n } else if (!val.normalize) {\n compiled.normalize = createNormalizer();\n } else {\n schemaError(name, val);\n }\n\n return;\n }\n\n if (isString(val)) {\n aliases.push(name);\n return;\n }\n\n schemaError(name, val);\n });\n\n //\n // Compile postponed aliases\n //\n\n aliases.forEach(function (alias) {\n if (!self.__compiled__[self.__schemas__[alias]]) {\n // Silently fail on missed schemas to avoid errons on disable.\n // schemaError(alias, self.__schemas__[alias]);\n return;\n }\n\n self.__compiled__[alias].validate =\n self.__compiled__[self.__schemas__[alias]].validate;\n self.__compiled__[alias].normalize =\n self.__compiled__[self.__schemas__[alias]].normalize;\n });\n\n //\n // Fake record for guessed links\n //\n self.__compiled__[''] = { validate: null, normalize: createNormalizer() };\n\n //\n // Build schema condition\n //\n var slist = Object.keys(self.__compiled__)\n .filter(function (name) {\n // Filter disabled & fake schemas\n return name.length > 0 && self.__compiled__[name];\n })\n .map(escapeRE)\n .join('|');\n // (?!_) cause 1.5x slowdown\n self.re.schema_test = RegExp('(^|(?!_)(?:[><\\uff5c]|' + re.src_ZPCc + '))(' + slist + ')', 'i');\n self.re.schema_search = RegExp('(^|(?!_)(?:[><\\uff5c]|' + re.src_ZPCc + '))(' + slist + ')', 'ig');\n\n self.re.pretest = RegExp(\n '(' + self.re.schema_test.source + ')|(' + self.re.host_fuzzy_test.source + ')|@',\n 'i'\n );\n\n //\n // Cleanup\n //\n\n resetScanCache(self);\n}\n\n/**\n * class Match\n *\n * Match result. Single element of array, returned by [[LinkifyIt#match]]\n **/\nfunction Match(self, shift) {\n var start = self.__index__,\n end = self.__last_index__,\n text = self.__text_cache__.slice(start, end);\n\n /**\n * Match#schema -> String\n *\n * Prefix (protocol) for matched string.\n **/\n this.schema = self.__schema__.toLowerCase();\n /**\n * Match#index -> Number\n *\n * First position of matched string.\n **/\n this.index = start + shift;\n /**\n * Match#lastIndex -> Number\n *\n * Next position after matched string.\n **/\n this.lastIndex = end + shift;\n /**\n * Match#raw -> String\n *\n * Matched string.\n **/\n this.raw = text;\n /**\n * Match#text -> String\n *\n * Notmalized text of matched string.\n **/\n this.text = text;\n /**\n * Match#url -> String\n *\n * Normalized url of matched string.\n **/\n this.url = text;\n}\n\nfunction createMatch(self, shift) {\n var match = new Match(self, shift);\n\n self.__compiled__[match.schema].normalize(match, self);\n\n return match;\n}\n\n\n/**\n * class LinkifyIt\n **/\n\n/**\n * new LinkifyIt(schemas, options)\n * - schemas (Object): Optional. Additional schemas to validate (prefix/validator)\n * - options (Object): { fuzzyLink|fuzzyEmail|fuzzyIP: true|false }\n *\n * Creates new linkifier instance with optional additional schemas.\n * Can be called without `new` keyword for convenience.\n *\n * By default understands:\n *\n * - `http(s)://...` , `ftp://...`, `mailto:...` & `//...` links\n * - \"fuzzy\" links and emails (example.com, foo@bar.com).\n *\n * `schemas` is an object, where each key/value describes protocol/rule:\n *\n * - __key__ - link prefix (usually, protocol name with `:` at the end, `skype:`\n * for example). `linkify-it` makes shure that prefix is not preceeded with\n * alphanumeric char and symbols. Only whitespaces and punctuation allowed.\n * - __value__ - rule to check tail after link prefix\n * - _String_ - just alias to existing rule\n * - _Object_\n * - _validate_ - validator function (should return matched length on success),\n * or `RegExp`.\n * - _normalize_ - optional function to normalize text & url of matched result\n * (for example, for @twitter mentions).\n *\n * `options`:\n *\n * - __fuzzyLink__ - recognige URL-s without `http(s):` prefix. Default `true`.\n * - __fuzzyIP__ - allow IPs in fuzzy links above. Can conflict with some texts\n * like version numbers. Default `false`.\n * - __fuzzyEmail__ - recognize emails without `mailto:` prefix.\n *\n **/\nfunction LinkifyIt(schemas, options) {\n if (!(this instanceof LinkifyIt)) {\n return new LinkifyIt(schemas, options);\n }\n\n if (!options) {\n if (isOptionsObj(schemas)) {\n options = schemas;\n schemas = {};\n }\n }\n\n this.__opts__ = assign({}, defaultOptions, options);\n\n // Cache last tested result. Used to skip repeating steps on next `match` call.\n this.__index__ = -1;\n this.__last_index__ = -1; // Next scan position\n this.__schema__ = '';\n this.__text_cache__ = '';\n\n this.__schemas__ = assign({}, defaultSchemas, schemas);\n this.__compiled__ = {};\n\n this.__tlds__ = tlds_default;\n this.__tlds_replaced__ = false;\n\n this.re = {};\n\n compile(this);\n}\n\n\n/** chainable\n * LinkifyIt#add(schema, definition)\n * - schema (String): rule name (fixed pattern prefix)\n * - definition (String|RegExp|Object): schema definition\n *\n * Add new rule definition. See constructor description for details.\n **/\nLinkifyIt.prototype.add = function add(schema, definition) {\n this.__schemas__[schema] = definition;\n compile(this);\n return this;\n};\n\n\n/** chainable\n * LinkifyIt#set(options)\n * - options (Object): { fuzzyLink|fuzzyEmail|fuzzyIP: true|false }\n *\n * Set recognition options for links without schema.\n **/\nLinkifyIt.prototype.set = function set(options) {\n this.__opts__ = assign(this.__opts__, options);\n return this;\n};\n\n\n/**\n * LinkifyIt#test(text) -> Boolean\n *\n * Searches linkifiable pattern and returns `true` on success or `false` on fail.\n **/\nLinkifyIt.prototype.test = function test(text) {\n // Reset scan cache\n this.__text_cache__ = text;\n this.__index__ = -1;\n\n if (!text.length) { return false; }\n\n var m, ml, me, len, shift, next, re, tld_pos, at_pos;\n\n // try to scan for link with schema - that's the most simple rule\n if (this.re.schema_test.test(text)) {\n re = this.re.schema_search;\n re.lastIndex = 0;\n while ((m = re.exec(text)) !== null) {\n len = this.testSchemaAt(text, m[2], re.lastIndex);\n if (len) {\n this.__schema__ = m[2];\n this.__index__ = m.index + m[1].length;\n this.__last_index__ = m.index + m[0].length + len;\n break;\n }\n }\n }\n\n if (this.__opts__.fuzzyLink && this.__compiled__['http:']) {\n // guess schemaless links\n tld_pos = text.search(this.re.host_fuzzy_test);\n if (tld_pos >= 0) {\n // if tld is located after found link - no need to check fuzzy pattern\n if (this.__index__ < 0 || tld_pos < this.__index__) {\n if ((ml = text.match(this.__opts__.fuzzyIP ? this.re.link_fuzzy : this.re.link_no_ip_fuzzy)) !== null) {\n\n shift = ml.index + ml[1].length;\n\n if (this.__index__ < 0 || shift < this.__index__) {\n this.__schema__ = '';\n this.__index__ = shift;\n this.__last_index__ = ml.index + ml[0].length;\n }\n }\n }\n }\n }\n\n if (this.__opts__.fuzzyEmail && this.__compiled__['mailto:']) {\n // guess schemaless emails\n at_pos = text.indexOf('@');\n if (at_pos >= 0) {\n // We can't skip this check, because this cases are possible:\n // 192.168.1.1@gmail.com, my.in@example.com\n if ((me = text.match(this.re.email_fuzzy)) !== null) {\n\n shift = me.index + me[1].length;\n next = me.index + me[0].length;\n\n if (this.__index__ < 0 || shift < this.__index__ ||\n (shift === this.__index__ && next > this.__last_index__)) {\n this.__schema__ = 'mailto:';\n this.__index__ = shift;\n this.__last_index__ = next;\n }\n }\n }\n }\n\n return this.__index__ >= 0;\n};\n\n\n/**\n * LinkifyIt#pretest(text) -> Boolean\n *\n * Very quick check, that can give false positives. Returns true if link MAY BE\n * can exists. Can be used for speed optimization, when you need to check that\n * link NOT exists.\n **/\nLinkifyIt.prototype.pretest = function pretest(text) {\n return this.re.pretest.test(text);\n};\n\n\n/**\n * LinkifyIt#testSchemaAt(text, name, position) -> Number\n * - text (String): text to scan\n * - name (String): rule (schema) name\n * - position (Number): text offset to check from\n *\n * Similar to [[LinkifyIt#test]] but checks only specific protocol tail exactly\n * at given position. Returns length of found pattern (0 on fail).\n **/\nLinkifyIt.prototype.testSchemaAt = function testSchemaAt(text, schema, pos) {\n // If not supported schema check requested - terminate\n if (!this.__compiled__[schema.toLowerCase()]) {\n return 0;\n }\n return this.__compiled__[schema.toLowerCase()].validate(text, pos, this);\n};\n\n\n/**\n * LinkifyIt#match(text) -> Array|null\n *\n * Returns array of found link descriptions or `null` on fail. We strongly\n * recommend to use [[LinkifyIt#test]] first, for best speed.\n *\n * ##### Result match description\n *\n * - __schema__ - link schema, can be empty for fuzzy links, or `//` for\n * protocol-neutral links.\n * - __index__ - offset of matched text\n * - __lastIndex__ - index of next char after mathch end\n * - __raw__ - matched text\n * - __text__ - normalized text\n * - __url__ - link, generated from matched text\n **/\nLinkifyIt.prototype.match = function match(text) {\n var shift = 0, result = [];\n\n // Try to take previous element from cache, if .test() called before\n if (this.__index__ >= 0 && this.__text_cache__ === text) {\n result.push(createMatch(this, shift));\n shift = this.__last_index__;\n }\n\n // Cut head if cache was used\n var tail = shift ? text.slice(shift) : text;\n\n // Scan string until end reached\n while (this.test(tail)) {\n result.push(createMatch(this, shift));\n\n tail = tail.slice(this.__last_index__);\n shift += this.__last_index__;\n }\n\n if (result.length) {\n return result;\n }\n\n return null;\n};\n\n\n/** chainable\n * LinkifyIt#tlds(list [, keepOld]) -> this\n * - list (Array): list of tlds\n * - keepOld (Boolean): merge with current list if `true` (`false` by default)\n *\n * Load (or merge) new tlds list. Those are user for fuzzy links (without prefix)\n * to avoid false positives. By default this algorythm used:\n *\n * - hostname with any 2-letter root zones are ok.\n * - biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|\u0440\u0444\n * are ok.\n * - encoded (`xn--...`) root zones are ok.\n *\n * If list is replaced, then exact match for 2-chars root zones will be checked.\n **/\nLinkifyIt.prototype.tlds = function tlds(list, keepOld) {\n list = Array.isArray(list) ? list : [ list ];\n\n if (!keepOld) {\n this.__tlds__ = list.slice();\n this.__tlds_replaced__ = true;\n compile(this);\n return this;\n }\n\n this.__tlds__ = this.__tlds__.concat(list)\n .sort()\n .filter(function (el, idx, arr) {\n return el !== arr[idx - 1];\n })\n .reverse();\n\n compile(this);\n return this;\n};\n\n/**\n * LinkifyIt#normalize(match)\n *\n * Default normalizer (if schema does not define it's own).\n **/\nLinkifyIt.prototype.normalize = function normalize(match) {\n\n // Do minimal possible changes by default. Need to collect feedback prior\n // to move forward https://github.com/markdown-it/linkify-it/issues/1\n\n if (!match.schema) { match.url = 'http://' + match.url; }\n\n if (match.schema === 'mailto:' && !/^mailto:/i.test(match.url)) {\n match.url = 'mailto:' + match.url;\n }\n};\n\n\n/**\n * LinkifyIt#onCompile()\n *\n * Override to modify basic RegExp-s.\n **/\nLinkifyIt.prototype.onCompile = function onCompile() {\n};\n\n\nmodule.exports = LinkifyIt;\n", "'use strict';\n\n/** Highest positive signed 32-bit float value */\nconst maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1\n\n/** Bootstring parameters */\nconst base = 36;\nconst tMin = 1;\nconst tMax = 26;\nconst skew = 38;\nconst damp = 700;\nconst initialBias = 72;\nconst initialN = 128; // 0x80\nconst delimiter = '-'; // '\\x2D'\n\n/** Regular expressions */\nconst regexPunycode = /^xn--/;\nconst regexNonASCII = /[^\\0-\\x7E]/; // non-ASCII chars\nconst regexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g; // RFC 3490 separators\n\n/** Error messages */\nconst errors = {\n\t'overflow': 'Overflow: input needs wider integers to process',\n\t'not-basic': 'Illegal input >= 0x80 (not a basic code point)',\n\t'invalid-input': 'Invalid input'\n};\n\n/** Convenience shortcuts */\nconst baseMinusTMin = base - tMin;\nconst floor = Math.floor;\nconst stringFromCharCode = String.fromCharCode;\n\n/*--------------------------------------------------------------------------*/\n\n/**\n * A generic error utility function.\n * @private\n * @param {String} type The error type.\n * @returns {Error} Throws a `RangeError` with the applicable error message.\n */\nfunction error(type) {\n\tthrow new RangeError(errors[type]);\n}\n\n/**\n * A generic `Array#map` utility function.\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} callback The function that gets called for every array\n * item.\n * @returns {Array} A new array of values returned by the callback function.\n */\nfunction map(array, fn) {\n\tconst result = [];\n\tlet length = array.length;\n\twhile (length--) {\n\t\tresult[length] = fn(array[length]);\n\t}\n\treturn result;\n}\n\n/**\n * A simple `Array#map`-like wrapper to work with domain name strings or email\n * addresses.\n * @private\n * @param {String} domain The domain name or email address.\n * @param {Function} callback The function that gets called for every\n * character.\n * @returns {Array} A new string of characters returned by the callback\n * function.\n */\nfunction mapDomain(string, fn) {\n\tconst parts = string.split('@');\n\tlet result = '';\n\tif (parts.length > 1) {\n\t\t// In email addresses, only the domain name should be punycoded. Leave\n\t\t// the local part (i.e. everything up to `@`) intact.\n\t\tresult = parts[0] + '@';\n\t\tstring = parts[1];\n\t}\n\t// Avoid `split(regex)` for IE8 compatibility. See #17.\n\tstring = string.replace(regexSeparators, '\\x2E');\n\tconst labels = string.split('.');\n\tconst encoded = map(labels, fn).join('.');\n\treturn result + encoded;\n}\n\n/**\n * Creates an array containing the numeric code points of each Unicode\n * character in the string. While JavaScript uses UCS-2 internally,\n * this function will convert a pair of surrogate halves (each of which\n * UCS-2 exposes as separate characters) into a single code point,\n * matching UTF-16.\n * @see `punycode.ucs2.encode`\n * @see \n * @memberOf punycode.ucs2\n * @name decode\n * @param {String} string The Unicode input string (UCS-2).\n * @returns {Array} The new array of code points.\n */\nfunction ucs2decode(string) {\n\tconst output = [];\n\tlet counter = 0;\n\tconst length = string.length;\n\twhile (counter < length) {\n\t\tconst value = string.charCodeAt(counter++);\n\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t// It's a high surrogate, and there is a next character.\n\t\t\tconst extra = string.charCodeAt(counter++);\n\t\t\tif ((extra & 0xFC00) == 0xDC00) { // Low surrogate.\n\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t} else {\n\t\t\t\t// It's an unmatched surrogate; only append this code unit, in case the\n\t\t\t\t// next code unit is the high surrogate of a surrogate pair.\n\t\t\t\toutput.push(value);\n\t\t\t\tcounter--;\n\t\t\t}\n\t\t} else {\n\t\t\toutput.push(value);\n\t\t}\n\t}\n\treturn output;\n}\n\n/**\n * Creates a string based on an array of numeric code points.\n * @see `punycode.ucs2.decode`\n * @memberOf punycode.ucs2\n * @name encode\n * @param {Array} codePoints The array of numeric code points.\n * @returns {String} The new Unicode string (UCS-2).\n */\nconst ucs2encode = array => String.fromCodePoint(...array);\n\n/**\n * Converts a basic code point into a digit/integer.\n * @see `digitToBasic()`\n * @private\n * @param {Number} codePoint The basic numeric code point value.\n * @returns {Number} The numeric value of a basic code point (for use in\n * representing integers) in the range `0` to `base - 1`, or `base` if\n * the code point does not represent a value.\n */\nconst basicToDigit = function(codePoint) {\n\tif (codePoint - 0x30 < 0x0A) {\n\t\treturn codePoint - 0x16;\n\t}\n\tif (codePoint - 0x41 < 0x1A) {\n\t\treturn codePoint - 0x41;\n\t}\n\tif (codePoint - 0x61 < 0x1A) {\n\t\treturn codePoint - 0x61;\n\t}\n\treturn base;\n};\n\n/**\n * Converts a digit/integer into a basic code point.\n * @see `basicToDigit()`\n * @private\n * @param {Number} digit The numeric value of a basic code point.\n * @returns {Number} The basic code point whose value (when used for\n * representing integers) is `digit`, which needs to be in the range\n * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is\n * used; else, the lowercase form is used. The behavior is undefined\n * if `flag` is non-zero and `digit` has no uppercase form.\n */\nconst digitToBasic = function(digit, flag) {\n\t// 0..25 map to ASCII a..z or A..Z\n\t// 26..35 map to ASCII 0..9\n\treturn digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);\n};\n\n/**\n * Bias adaptation function as per section 3.4 of RFC 3492.\n * https://tools.ietf.org/html/rfc3492#section-3.4\n * @private\n */\nconst adapt = function(delta, numPoints, firstTime) {\n\tlet k = 0;\n\tdelta = firstTime ? floor(delta / damp) : delta >> 1;\n\tdelta += floor(delta / numPoints);\n\tfor (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {\n\t\tdelta = floor(delta / baseMinusTMin);\n\t}\n\treturn floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n};\n\n/**\n * Converts a Punycode string of ASCII-only symbols to a string of Unicode\n * symbols.\n * @memberOf punycode\n * @param {String} input The Punycode string of ASCII-only symbols.\n * @returns {String} The resulting string of Unicode symbols.\n */\nconst decode = function(input) {\n\t// Don't use UCS-2.\n\tconst output = [];\n\tconst inputLength = input.length;\n\tlet i = 0;\n\tlet n = initialN;\n\tlet bias = initialBias;\n\n\t// Handle the basic code points: let `basic` be the number of input code\n\t// points before the last delimiter, or `0` if there is none, then copy\n\t// the first basic code points to the output.\n\n\tlet basic = input.lastIndexOf(delimiter);\n\tif (basic < 0) {\n\t\tbasic = 0;\n\t}\n\n\tfor (let j = 0; j < basic; ++j) {\n\t\t// if it's not a basic code point\n\t\tif (input.charCodeAt(j) >= 0x80) {\n\t\t\terror('not-basic');\n\t\t}\n\t\toutput.push(input.charCodeAt(j));\n\t}\n\n\t// Main decoding loop: start just after the last delimiter if any basic code\n\t// points were copied; start at the beginning otherwise.\n\n\tfor (let index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {\n\n\t\t// `index` is the index of the next character to be consumed.\n\t\t// Decode a generalized variable-length integer into `delta`,\n\t\t// which gets added to `i`. The overflow checking is easier\n\t\t// if we increase `i` as we go, then subtract off its starting\n\t\t// value at the end to obtain `delta`.\n\t\tlet oldi = i;\n\t\tfor (let w = 1, k = base; /* no condition */; k += base) {\n\n\t\t\tif (index >= inputLength) {\n\t\t\t\terror('invalid-input');\n\t\t\t}\n\n\t\t\tconst digit = basicToDigit(input.charCodeAt(index++));\n\n\t\t\tif (digit >= base || digit > floor((maxInt - i) / w)) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\ti += digit * w;\n\t\t\tconst t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\n\t\t\tif (digit < t) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst baseMinusT = base - t;\n\t\t\tif (w > floor(maxInt / baseMinusT)) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tw *= baseMinusT;\n\n\t\t}\n\n\t\tconst out = output.length + 1;\n\t\tbias = adapt(i - oldi, out, oldi == 0);\n\n\t\t// `i` was supposed to wrap around from `out` to `0`,\n\t\t// incrementing `n` each time, so we'll fix that now:\n\t\tif (floor(i / out) > maxInt - n) {\n\t\t\terror('overflow');\n\t\t}\n\n\t\tn += floor(i / out);\n\t\ti %= out;\n\n\t\t// Insert `n` at position `i` of the output.\n\t\toutput.splice(i++, 0, n);\n\n\t}\n\n\treturn String.fromCodePoint(...output);\n};\n\n/**\n * Converts a string of Unicode symbols (e.g. a domain name label) to a\n * Punycode string of ASCII-only symbols.\n * @memberOf punycode\n * @param {String} input The string of Unicode symbols.\n * @returns {String} The resulting Punycode string of ASCII-only symbols.\n */\nconst encode = function(input) {\n\tconst output = [];\n\n\t// Convert the input in UCS-2 to an array of Unicode code points.\n\tinput = ucs2decode(input);\n\n\t// Cache the length.\n\tlet inputLength = input.length;\n\n\t// Initialize the state.\n\tlet n = initialN;\n\tlet delta = 0;\n\tlet bias = initialBias;\n\n\t// Handle the basic code points.\n\tfor (const currentValue of input) {\n\t\tif (currentValue < 0x80) {\n\t\t\toutput.push(stringFromCharCode(currentValue));\n\t\t}\n\t}\n\n\tlet basicLength = output.length;\n\tlet handledCPCount = basicLength;\n\n\t// `handledCPCount` is the number of code points that have been handled;\n\t// `basicLength` is the number of basic code points.\n\n\t// Finish the basic string with a delimiter unless it's empty.\n\tif (basicLength) {\n\t\toutput.push(delimiter);\n\t}\n\n\t// Main encoding loop:\n\twhile (handledCPCount < inputLength) {\n\n\t\t// All non-basic code points < n have been handled already. Find the next\n\t\t// larger one:\n\t\tlet m = maxInt;\n\t\tfor (const currentValue of input) {\n\t\t\tif (currentValue >= n && currentValue < m) {\n\t\t\t\tm = currentValue;\n\t\t\t}\n\t\t}\n\n\t\t// Increase `delta` enough to advance the decoder's state to ,\n\t\t// but guard against overflow.\n\t\tconst handledCPCountPlusOne = handledCPCount + 1;\n\t\tif (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n\t\t\terror('overflow');\n\t\t}\n\n\t\tdelta += (m - n) * handledCPCountPlusOne;\n\t\tn = m;\n\n\t\tfor (const currentValue of input) {\n\t\t\tif (currentValue < n && ++delta > maxInt) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\t\t\tif (currentValue == n) {\n\t\t\t\t// Represent delta as a generalized variable-length integer.\n\t\t\t\tlet q = delta;\n\t\t\t\tfor (let k = base; /* no condition */; k += base) {\n\t\t\t\t\tconst t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\t\t\t\t\tif (q < t) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tconst qMinusT = q - t;\n\t\t\t\t\tconst baseMinusT = base - t;\n\t\t\t\t\toutput.push(\n\t\t\t\t\t\tstringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))\n\t\t\t\t\t);\n\t\t\t\t\tq = floor(qMinusT / baseMinusT);\n\t\t\t\t}\n\n\t\t\t\toutput.push(stringFromCharCode(digitToBasic(q, 0)));\n\t\t\t\tbias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n\t\t\t\tdelta = 0;\n\t\t\t\t++handledCPCount;\n\t\t\t}\n\t\t}\n\n\t\t++delta;\n\t\t++n;\n\n\t}\n\treturn output.join('');\n};\n\n/**\n * Converts a Punycode string representing a domain name or an email address\n * to Unicode. Only the Punycoded parts of the input will be converted, i.e.\n * it doesn't matter if you call it on a string that has already been\n * converted to Unicode.\n * @memberOf punycode\n * @param {String} input The Punycoded domain name or email address to\n * convert to Unicode.\n * @returns {String} The Unicode representation of the given Punycode\n * string.\n */\nconst toUnicode = function(input) {\n\treturn mapDomain(input, function(string) {\n\t\treturn regexPunycode.test(string)\n\t\t\t? decode(string.slice(4).toLowerCase())\n\t\t\t: string;\n\t});\n};\n\n/**\n * Converts a Unicode string representing a domain name or an email address to\n * Punycode. Only the non-ASCII parts of the domain name will be converted,\n * i.e. it doesn't matter if you call it with a domain that's already in\n * ASCII.\n * @memberOf punycode\n * @param {String} input The domain name or email address to convert, as a\n * Unicode string.\n * @returns {String} The Punycode representation of the given domain name or\n * email address.\n */\nconst toASCII = function(input) {\n\treturn mapDomain(input, function(string) {\n\t\treturn regexNonASCII.test(string)\n\t\t\t? 'xn--' + encode(string)\n\t\t\t: string;\n\t});\n};\n\n/*--------------------------------------------------------------------------*/\n\n/** Define the public API */\nconst punycode = {\n\t/**\n\t * A string representing the current Punycode.js version number.\n\t * @memberOf punycode\n\t * @type String\n\t */\n\t'version': '2.1.0',\n\t/**\n\t * An object of methods to convert from JavaScript's internal character\n\t * representation (UCS-2) to Unicode code points, and back.\n\t * @see \n\t * @memberOf punycode\n\t * @type Object\n\t */\n\t'ucs2': {\n\t\t'decode': ucs2decode,\n\t\t'encode': ucs2encode\n\t},\n\t'decode': decode,\n\t'encode': encode,\n\t'toASCII': toASCII,\n\t'toUnicode': toUnicode\n};\n\nmodule.exports = punycode;\n", "// markdown-it default options\n\n'use strict';\n\n\nmodule.exports = {\n options: {\n html: false, // Enable HTML tags in source\n xhtmlOut: false, // Use '/' to close single tags (
)\n breaks: false, // Convert '\\n' in paragraphs into
\n langPrefix: 'language-', // CSS language prefix for fenced blocks\n linkify: false, // autoconvert URL-like texts to links\n\n // Enable some language-neutral replacements + quotes beautification\n typographer: false,\n\n // Double + single quotes replacement pairs, when typographer enabled,\n // and smartquotes on. Could be either a String or an Array.\n //\n // For example, you can use '\u00AB\u00BB\u201E\u201C' for Russian, '\u201E\u201C\u201A\u2018' for German,\n // and ['\u00AB\\xA0', '\\xA0\u00BB', '\u2039\\xA0', '\\xA0\u203A'] for French (including nbsp).\n quotes: '\\u201c\\u201d\\u2018\\u2019', /* \u201C\u201D\u2018\u2019 */\n\n // Highlighter function. Should return escaped HTML,\n // or '' if the source string is not changed and should be escaped externaly.\n // If result starts with )\n breaks: false, // Convert '\\n' in paragraphs into
\n langPrefix: 'language-', // CSS language prefix for fenced blocks\n linkify: false, // autoconvert URL-like texts to links\n\n // Enable some language-neutral replacements + quotes beautification\n typographer: false,\n\n // Double + single quotes replacement pairs, when typographer enabled,\n // and smartquotes on. Could be either a String or an Array.\n //\n // For example, you can use '\u00AB\u00BB\u201E\u201C' for Russian, '\u201E\u201C\u201A\u2018' for German,\n // and ['\u00AB\\xA0', '\\xA0\u00BB', '\u2039\\xA0', '\\xA0\u203A'] for French (including nbsp).\n quotes: '\\u201c\\u201d\\u2018\\u2019', /* \u201C\u201D\u2018\u2019 */\n\n // Highlighter function. Should return escaped HTML,\n // or '' if the source string is not changed and should be escaped externaly.\n // If result starts with )\n breaks: false, // Convert '\\n' in paragraphs into
\n langPrefix: 'language-', // CSS language prefix for fenced blocks\n linkify: false, // autoconvert URL-like texts to links\n\n // Enable some language-neutral replacements + quotes beautification\n typographer: false,\n\n // Double + single quotes replacement pairs, when typographer enabled,\n // and smartquotes on. Could be either a String or an Array.\n //\n // For example, you can use '\u00AB\u00BB\u201E\u201C' for Russian, '\u201E\u201C\u201A\u2018' for German,\n // and ['\u00AB\\xA0', '\\xA0\u00BB', '\u2039\\xA0', '\\xA0\u203A'] for French (including nbsp).\n quotes: '\\u201c\\u201d\\u2018\\u2019', /* \u201C\u201D\u2018\u2019 */\n\n // Highlighter function. Should return escaped HTML,\n // or '' if the source string is not changed and should be escaped externaly.\n // If result starts with = 0) {\n try {\n parsed.hostname = punycode.toASCII(parsed.hostname);\n } catch (er) { /**/ }\n }\n }\n\n return mdurl.encode(mdurl.format(parsed));\n}\n\nfunction normalizeLinkText(url) {\n var parsed = mdurl.parse(url, true);\n\n if (parsed.hostname) {\n // Encode hostnames in urls like:\n // `http://host/`, `https://host/`, `mailto:user@host`, `//host/`\n //\n // We don't encode unknown schemas, because it's likely that we encode\n // something we shouldn't (e.g. `skype:name` treated as `skype:host`)\n //\n if (!parsed.protocol || RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0) {\n try {\n parsed.hostname = punycode.toUnicode(parsed.hostname);\n } catch (er) { /**/ }\n }\n }\n\n // add '%' to exclude list because of https://github.com/markdown-it/markdown-it/issues/720\n return mdurl.decode(mdurl.format(parsed), mdurl.decode.defaultChars + '%');\n}\n\n\n/**\n * class MarkdownIt\n *\n * Main parser/renderer class.\n *\n * ##### Usage\n *\n * ```javascript\n * // node.js, \"classic\" way:\n * var MarkdownIt = require('markdown-it'),\n * md = new MarkdownIt();\n * var result = md.render('# markdown-it rulezz!');\n *\n * // node.js, the same, but with sugar:\n * var md = require('markdown-it')();\n * var result = md.render('# markdown-it rulezz!');\n *\n * // browser without AMD, added to \"window\" on script load\n * // Note, there are no dash.\n * var md = window.markdownit();\n * var result = md.render('# markdown-it rulezz!');\n * ```\n *\n * Single line rendering, without paragraph wrap:\n *\n * ```javascript\n * var md = require('markdown-it')();\n * var result = md.renderInline('__markdown-it__ rulezz!');\n * ```\n **/\n\n/**\n * new MarkdownIt([presetName, options])\n * - presetName (String): optional, `commonmark` / `zero`\n * - options (Object)\n *\n * Creates parser instanse with given config. Can be called without `new`.\n *\n * ##### presetName\n *\n * MarkdownIt provides named presets as a convenience to quickly\n * enable/disable active syntax rules and options for common use cases.\n *\n * - [\"commonmark\"](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/commonmark.js) -\n * configures parser to strict [CommonMark](http://commonmark.org/) mode.\n * - [default](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/default.js) -\n * similar to GFM, used when no preset name given. Enables all available rules,\n * but still without html, typographer & autolinker.\n * - [\"zero\"](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/zero.js) -\n * all rules disabled. Useful to quickly setup your config via `.enable()`.\n * For example, when you need only `bold` and `italic` markup and nothing else.\n *\n * ##### options:\n *\n * - __html__ - `false`. Set `true` to enable HTML tags in source. Be careful!\n * That's not safe! You may need external sanitizer to protect output from XSS.\n * It's better to extend features via plugins, instead of enabling HTML.\n * - __xhtmlOut__ - `false`. Set `true` to add '/' when closing single tags\n * (`
`). This is needed only for full CommonMark compatibility. In real\n * world you will need HTML output.\n * - __breaks__ - `false`. Set `true` to convert `\\n` in paragraphs into `
`.\n * - __langPrefix__ - `language-`. CSS language class prefix for fenced blocks.\n * Can be useful for external highlighters.\n * - __linkify__ - `false`. Set `true` to autoconvert URL-like text to links.\n * - __typographer__ - `false`. Set `true` to enable [some language-neutral\n * replacement](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/replacements.js) +\n * quotes beautification (smartquotes).\n * - __quotes__ - `\u201C\u201D\u2018\u2019`, String or Array. Double + single quotes replacement\n * pairs, when typographer enabled and smartquotes on. For example, you can\n * use `'\u00AB\u00BB\u201E\u201C'` for Russian, `'\u201E\u201C\u201A\u2018'` for German, and\n * `['\u00AB\\xA0', '\\xA0\u00BB', '\u2039\\xA0', '\\xA0\u203A']` for French (including nbsp).\n * - __highlight__ - `null`. Highlighter function for fenced code blocks.\n * Highlighter `function (str, lang)` should return escaped HTML. It can also\n * return empty string if the source was not changed and should be escaped\n * externaly. If result starts with `):\n *\n * ```javascript\n * var hljs = require('highlight.js') // https://highlightjs.org/\n *\n * // Actual default values\n * var md = require('markdown-it')({\n * highlight: function (str, lang) {\n * if (lang && hljs.getLanguage(lang)) {\n * try {\n * return '
' +\n *                hljs.highlight(str, { language: lang, ignoreIllegals: true }).value +\n *                '
';\n * } catch (__) {}\n * }\n *\n * return '
' + md.utils.escapeHtml(str) + '
';\n * }\n * });\n * ```\n *\n **/\nfunction MarkdownIt(presetName, options) {\n if (!(this instanceof MarkdownIt)) {\n return new MarkdownIt(presetName, options);\n }\n\n if (!options) {\n if (!utils.isString(presetName)) {\n options = presetName || {};\n presetName = 'default';\n }\n }\n\n /**\n * MarkdownIt#inline -> ParserInline\n *\n * Instance of [[ParserInline]]. You may need it to add new rules when\n * writing plugins. For simple rules control use [[MarkdownIt.disable]] and\n * [[MarkdownIt.enable]].\n **/\n this.inline = new ParserInline();\n\n /**\n * MarkdownIt#block -> ParserBlock\n *\n * Instance of [[ParserBlock]]. You may need it to add new rules when\n * writing plugins. For simple rules control use [[MarkdownIt.disable]] and\n * [[MarkdownIt.enable]].\n **/\n this.block = new ParserBlock();\n\n /**\n * MarkdownIt#core -> Core\n *\n * Instance of [[Core]] chain executor. You may need it to add new rules when\n * writing plugins. For simple rules control use [[MarkdownIt.disable]] and\n * [[MarkdownIt.enable]].\n **/\n this.core = new ParserCore();\n\n /**\n * MarkdownIt#renderer -> Renderer\n *\n * Instance of [[Renderer]]. Use it to modify output look. Or to add rendering\n * rules for new token types, generated by plugins.\n *\n * ##### Example\n *\n * ```javascript\n * var md = require('markdown-it')();\n *\n * function myToken(tokens, idx, options, env, self) {\n * //...\n * return result;\n * };\n *\n * md.renderer.rules['my_token'] = myToken\n * ```\n *\n * See [[Renderer]] docs and [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.js).\n **/\n this.renderer = new Renderer();\n\n /**\n * MarkdownIt#linkify -> LinkifyIt\n *\n * [linkify-it](https://github.com/markdown-it/linkify-it) instance.\n * Used by [linkify](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/linkify.js)\n * rule.\n **/\n this.linkify = new LinkifyIt();\n\n /**\n * MarkdownIt#validateLink(url) -> Boolean\n *\n * Link validation function. CommonMark allows too much in links. By default\n * we disable `javascript:`, `vbscript:`, `file:` schemas, and almost all `data:...` schemas\n * except some embedded image types.\n *\n * You can change this behaviour:\n *\n * ```javascript\n * var md = require('markdown-it')();\n * // enable everything\n * md.validateLink = function () { return true; }\n * ```\n **/\n this.validateLink = validateLink;\n\n /**\n * MarkdownIt#normalizeLink(url) -> String\n *\n * Function used to encode link url to a machine-readable format,\n * which includes url-encoding, punycode, etc.\n **/\n this.normalizeLink = normalizeLink;\n\n /**\n * MarkdownIt#normalizeLinkText(url) -> String\n *\n * Function used to decode link url to a human-readable format`\n **/\n this.normalizeLinkText = normalizeLinkText;\n\n\n // Expose utils & helpers for easy acces from plugins\n\n /**\n * MarkdownIt#utils -> utils\n *\n * Assorted utility functions, useful to write plugins. See details\n * [here](https://github.com/markdown-it/markdown-it/blob/master/lib/common/utils.js).\n **/\n this.utils = utils;\n\n /**\n * MarkdownIt#helpers -> helpers\n *\n * Link components parser functions, useful to write plugins. See details\n * [here](https://github.com/markdown-it/markdown-it/blob/master/lib/helpers).\n **/\n this.helpers = utils.assign({}, helpers);\n\n\n this.options = {};\n this.configure(presetName);\n\n if (options) { this.set(options); }\n}\n\n\n/** chainable\n * MarkdownIt.set(options)\n *\n * Set parser options (in the same format as in constructor). Probably, you\n * will never need it, but you can change options after constructor call.\n *\n * ##### Example\n *\n * ```javascript\n * var md = require('markdown-it')()\n * .set({ html: true, breaks: true })\n * .set({ typographer, true });\n * ```\n *\n * __Note:__ To achieve the best possible performance, don't modify a\n * `markdown-it` instance options on the fly. If you need multiple configurations\n * it's best to create multiple instances and initialize each with separate\n * config.\n **/\nMarkdownIt.prototype.set = function (options) {\n utils.assign(this.options, options);\n return this;\n};\n\n\n/** chainable, internal\n * MarkdownIt.configure(presets)\n *\n * Batch load of all options and compenent settings. This is internal method,\n * and you probably will not need it. But if you will - see available presets\n * and data structure [here](https://github.com/markdown-it/markdown-it/tree/master/lib/presets)\n *\n * We strongly recommend to use presets instead of direct config loads. That\n * will give better compatibility with next versions.\n **/\nMarkdownIt.prototype.configure = function (presets) {\n var self = this, presetName;\n\n if (utils.isString(presets)) {\n presetName = presets;\n presets = config[presetName];\n if (!presets) { throw new Error('Wrong `markdown-it` preset \"' + presetName + '\", check name'); }\n }\n\n if (!presets) { throw new Error('Wrong `markdown-it` preset, can\\'t be empty'); }\n\n if (presets.options) { self.set(presets.options); }\n\n if (presets.components) {\n Object.keys(presets.components).forEach(function (name) {\n if (presets.components[name].rules) {\n self[name].ruler.enableOnly(presets.components[name].rules);\n }\n if (presets.components[name].rules2) {\n self[name].ruler2.enableOnly(presets.components[name].rules2);\n }\n });\n }\n return this;\n};\n\n\n/** chainable\n * MarkdownIt.enable(list, ignoreInvalid)\n * - list (String|Array): rule name or list of rule names to enable\n * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.\n *\n * Enable list or rules. It will automatically find appropriate components,\n * containing rules with given names. If rule not found, and `ignoreInvalid`\n * not set - throws exception.\n *\n * ##### Example\n *\n * ```javascript\n * var md = require('markdown-it')()\n * .enable(['sub', 'sup'])\n * .disable('smartquotes');\n * ```\n **/\nMarkdownIt.prototype.enable = function (list, ignoreInvalid) {\n var result = [];\n\n if (!Array.isArray(list)) { list = [ list ]; }\n\n [ 'core', 'block', 'inline' ].forEach(function (chain) {\n result = result.concat(this[chain].ruler.enable(list, true));\n }, this);\n\n result = result.concat(this.inline.ruler2.enable(list, true));\n\n var missed = list.filter(function (name) { return result.indexOf(name) < 0; });\n\n if (missed.length && !ignoreInvalid) {\n throw new Error('MarkdownIt. Failed to enable unknown rule(s): ' + missed);\n }\n\n return this;\n};\n\n\n/** chainable\n * MarkdownIt.disable(list, ignoreInvalid)\n * - list (String|Array): rule name or list of rule names to disable.\n * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.\n *\n * The same as [[MarkdownIt.enable]], but turn specified rules off.\n **/\nMarkdownIt.prototype.disable = function (list, ignoreInvalid) {\n var result = [];\n\n if (!Array.isArray(list)) { list = [ list ]; }\n\n [ 'core', 'block', 'inline' ].forEach(function (chain) {\n result = result.concat(this[chain].ruler.disable(list, true));\n }, this);\n\n result = result.concat(this.inline.ruler2.disable(list, true));\n\n var missed = list.filter(function (name) { return result.indexOf(name) < 0; });\n\n if (missed.length && !ignoreInvalid) {\n throw new Error('MarkdownIt. Failed to disable unknown rule(s): ' + missed);\n }\n return this;\n};\n\n\n/** chainable\n * MarkdownIt.use(plugin, params)\n *\n * Load specified plugin with given params into current parser instance.\n * It's just a sugar to call `plugin(md, params)` with curring.\n *\n * ##### Example\n *\n * ```javascript\n * var iterator = require('markdown-it-for-inline');\n * var md = require('markdown-it')()\n * .use(iterator, 'foo_replace', 'text', function (tokens, idx) {\n * tokens[idx].content = tokens[idx].content.replace(/foo/g, 'bar');\n * });\n * ```\n **/\nMarkdownIt.prototype.use = function (plugin /*, params, ... */) {\n var args = [ this ].concat(Array.prototype.slice.call(arguments, 1));\n plugin.apply(plugin, args);\n return this;\n};\n\n\n/** internal\n * MarkdownIt.parse(src, env) -> Array\n * - src (String): source string\n * - env (Object): environment sandbox\n *\n * Parse input string and return list of block tokens (special token type\n * \"inline\" will contain list of inline tokens). You should not call this\n * method directly, until you write custom renderer (for example, to produce\n * AST).\n *\n * `env` is used to pass data between \"distributed\" rules and return additional\n * metadata like reference info, needed for the renderer. It also can be used to\n * inject data in specific cases. Usually, you will be ok to pass `{}`,\n * and then pass updated object to renderer.\n **/\nMarkdownIt.prototype.parse = function (src, env) {\n if (typeof src !== 'string') {\n throw new Error('Input data should be a String');\n }\n\n var state = new this.core.State(src, this, env);\n\n this.core.process(state);\n\n return state.tokens;\n};\n\n\n/**\n * MarkdownIt.render(src [, env]) -> String\n * - src (String): source string\n * - env (Object): environment sandbox\n *\n * Render markdown string into html. It does all magic for you :).\n *\n * `env` can be used to inject additional metadata (`{}` by default).\n * But you will not need it with high probability. See also comment\n * in [[MarkdownIt.parse]].\n **/\nMarkdownIt.prototype.render = function (src, env) {\n env = env || {};\n\n return this.renderer.render(this.parse(src, env), this.options, env);\n};\n\n\n/** internal\n * MarkdownIt.parseInline(src, env) -> Array\n * - src (String): source string\n * - env (Object): environment sandbox\n *\n * The same as [[MarkdownIt.parse]] but skip all block rules. It returns the\n * block tokens list with the single `inline` element, containing parsed inline\n * tokens in `children` property. Also updates `env` object.\n **/\nMarkdownIt.prototype.parseInline = function (src, env) {\n var state = new this.core.State(src, this, env);\n\n state.inlineMode = true;\n this.core.process(state);\n\n return state.tokens;\n};\n\n\n/**\n * MarkdownIt.renderInline(src [, env]) -> String\n * - src (String): source string\n * - env (Object): environment sandbox\n *\n * Similar to [[MarkdownIt.render]] but for single paragraph content. Result\n * will NOT be wrapped into `

` tags.\n **/\nMarkdownIt.prototype.renderInline = function (src, env) {\n env = env || {};\n\n return this.renderer.render(this.parseInline(src, env), this.options, env);\n};\n\n\nmodule.exports = MarkdownIt;\n", "'use strict';\n\n\nmodule.exports = require('./lib/');\n", "/**\n * Is it empty (stolen from Underscore)\n * @param {Object|String|?} obj some type of things\n * @return {Boolean} is it empty?\n */\nconst isEmpty = function (obj) {\n if (obj === null || obj === undefined) {\n return true;\n }\n if (Array.isArray(obj) || isString(obj)) {\n return obj.length === 0;\n }\n return Object.keys(obj).length === 0;\n};\n/**\n * Is it a String (stolen from Underscore)\n * @param {Object|String|?} obj some type of things\n * @return {Boolean} is it an string?\n */\nconst isString = function (obj) {\n return toString.call(obj) === '[object String]';\n};\n/**\n * Is it an Object (stolen from Underscore).\n * Note: This will return True for an Array also.\n * @param {Object|String|?} obj some type of things\n * @return {Boolean} is it an object?\n */\nconst isObject = function (obj) {\n const type = typeof obj;\n return (type === 'function' || type === 'object') && !!obj;\n};\n/**\n * Is a given variable undefined?\n * @param {Object|String|?} obj object to test\n * @return {Boolean} is it undefined\n */\nconst isUndefined = function (obj) {\n return obj === undefined;\n};\n/**\n * Capitalize a string\n * @param {String} string a string\n * @return {String} string with first letter capitalized\n */\nconst capitalize = function (string) {\n return isEmpty(string) ? string : string.charAt(0).toUpperCase() + string.slice(1);\n};\n\n/**\n * Convert a value for serialization.\n * @param {Any} value\n * @returns {Any} Though not Map or any class/object with a toJSON method.\n */\nconst serializeValue = function (value) {\n if (value === null || typeof value === 'undefined') {\n return;\n }\n if (isString(value)) {\n return value;\n }\n if (typeof value === 'number') {\n return value;\n }\n if (Array.isArray(value)) {\n return value.map((el) => serializeValue(el));\n }\n if (typeof value.toJSON === 'function') {\n return value.toJSON();\n }\n if (value instanceof Map) {\n const obj = {};\n value.forEach(function (val, key) {\n obj[key] = serializeValue(val);\n });\n return obj;\n }\n if (typeof value === 'function') {\n return;\n }\n if (typeof value === 'undefined') {\n return;\n }\n // a plain Object would just return itself, no matter its property values\n // not sure if I use any in the classes that it is a concern\n return value;\n};\n/**\n * Default toJSON for classes.\n * Bind this to the class instance when calling.\n * @returns {Object}\n */\nconst defaultToJSON = function () {\n // We save the objects class name as a property\n // so we can recreate the right structure later\n // but it is done in each class as I can't find a good way\n // to consistent get the class name.\n const returnObj = {};\n for (const property in this) {\n const value = this[property];\n\n const value2 = serializeValue(value);\n if (typeof value2 === 'undefined') {\n continue;\n }\n returnObj[property] = value2;\n }\n return returnObj;\n};\n\nexport {\n isEmpty,\n isString,\n isObject,\n isUndefined,\n capitalize,\n defaultToJSON\n};\n", "/**\n * Display options for subtable results. Used in RandomTable and RandomTableResultSet\n */\nexport default class DisplayOptions {\n /**\n *\n * @property {String} table Subtable name.\n * @property {Boolean} hide_table Hide the subtable name.\n * @property {Boolean} hide_result Hide the result.\n * @property {Boolean} hide_desc Hide the description field.\n */\n constructor ({\n table = '',\n hide_table = false,\n hide_result = false,\n hide_desc = false\n }) {\n this.table = table;\n /** Accept true, 1, or '1' to set these properties */\n this.hide_table = (hide_table === true || hide_table === '1' || hide_table === 1);\n this.hide_result = (hide_result === true || hide_result === '1' || hide_result === 1);\n this.hide_desc = (hide_desc === true || hide_desc === '1' || hide_desc === 1);\n }\n /**\n * Custom JSON handler to strip defaults.\n * @returns {Object}\n */\n toJSON () {\n const returnObj = {\n className: 'DisplayOptions',\n table: this.table\n };\n if (this.hide_table) {\n returnObj.hide_table = true;\n }\n if (this.hide_result) {\n returnObj.hide_result = true;\n }\n if (this.hide_desc) {\n returnObj.hide_desc = true;\n }\n return returnObj;\n }\n}\n", "import { isString, defaultToJSON } from './r_helpers.js';\n\n/**\n * Class for entries in a random (sub)table.\n * This normalizes the various options into a class that makes the other code simpler.\n */\nexport default class RandomTableEntry {\n /**\n *\n * @property {String} label Basic string label. Only required field. Can include tokens.\n * @property {Boolean} [print=true] Should the result be included in the output.\n * @property {String} [description] Extra description for the label.\n * @property {String[]} [subtable] Other tables to roll on.\n * @property {Number} [weight=1] Number to weight entry relative to other entries.\n */\n constructor ({\n label = '',\n print = true,\n description = '',\n subtable = [],\n weight = 1\n }) {\n this.label = label;\n this.print = !(print === false || print === '0' || print === 0);\n this.description = description;\n this.weight = parseInt(weight, 10);\n if (this.weight <= 0) {\n this.weight = 1;\n }\n // Make sure it's an array of string.\n if (isString(subtable)) {\n this.subtable = [subtable];\n } else if (Array.isArray(subtable)) {\n this.subtable = subtable.map((el) => { return el.toString(); });\n }\n }\n /**\n * Custom JSON handler because Map doesn't JSON stringify automatically.\n * @returns {Object}\n */\n toJSON () {\n const obj = defaultToJSON.call(this);\n obj.className = 'RandomTableEntry';\n return obj;\n }\n}\n", "/**\n * Sum an array\n * @param {Array} arr an array of numbers\n * @returns {Number} Total value of numbers in array\n */\nconst arraySum = function (arr) {\n let total = 0;\n for (let i = 0; i < arr.length; i++) {\n const v = parseFloat(arr[i]);\n if (!isNaN(v)) {\n total += v;\n }\n }\n return total;\n};\n\n/**\n * Random integer between two numbers (stolen from underscorejs)\n * @param {Number} [min=0] mininum value\n * @param {Number} [max=null] maximum value\n * @returns {Number} random value\n */\nconst randomInteger = function (min = 0, max = null) {\n if (max == null) {\n max = min;\n min = 0;\n }\n return min + Math.floor(Math.random() * (max - min + 1));\n};\n\n/**\n * Random value selection\n * @param {Array} values an array of objects from which to choose\n * @param {Array} weights a matching array of integers to weight the values (i.e. values and weights are in the same order)\n * @returns {String} the randomly selected Array element from values param\n */\nconst getWeightedRandom = function (values, weights) {\n let n = 0;\n const num = randomInteger(1, arraySum.call(this, weights));\n let i = 0;\n for (i; i < values.length; i++) {\n n = n + weights[i];\n if (n >= num) {\n break;\n }\n }\n return values[i];\n};\n/**\n * Random value selection, wrapper for getWeightedRandom that processes the data into values/weights arrays\n * @param {String[]} data values\n * @returns {String|null} the randomly selected string\n */\nconst randomString = function (data) {\n const values = [];\n const weights = [];\n\n if (!Array.isArray(data) || data.length === 0) {\n return null;\n }\n data.forEach((entry) => {\n weights.push(1);\n values.push(entry);\n });\n\n return getWeightedRandom(values, weights);\n};\n\nexport {\n randomInteger,\n getWeightedRandom,\n randomString\n};\n", "import { isEmpty, isString, isObject, defaultToJSON } from './r_helpers.js';\nimport DisplayOptions from './DisplayOptions.js';\nimport RandomTableEntry from './RandomTableEntry.js';\nimport { getWeightedRandom } from './randomizer.js';\n\n/**\n * RandomTable: Model for tables used by TableRoller\n */\nexport default class RandomTable {\n /**\n * The primary attributes of this table\n * @property {String} id id for the table, primary key for database if used\n * @property {String} key identifier for the table\n * @property {String} [title] title of the table\n * @property {String} [author] author of the table\n * @property {String} [description] description of the table\n * @property {String} [source] source of the table\n * @property {String[]} [tags] subject tags\n * @property {String[]} [sequence] tables to roll on as default.\n * @property {String[]|Object[]} [table] default table. array of strings or objects. removed after initialization.\n * @property {Object} [tables] a property for each subtables.\n * @property {RandomTableEntries[]} tables[subtablename] Entries for subtables.\n * @property {String[]} [macro] for tables that are only used to aggregate result from other tables, this array consists of table keys and optionsl subtables to be rolled on in order\n * @property {Map[DisplayOptions]} [display_opt] Display options for the subtables.\n * @property {Array} [dependencies] table keys that are needed to get full results from this table\n *\n * Note the Constructor args are not exactly the same as the properties. Some type changes are made to convert data.\n */\n constructor ({\n id = 0,\n key = null,\n title = '',\n author = '',\n description = '',\n source = '',\n tags = [],\n sequence = [],\n tables = {},\n macro = [],\n dependencies = null,\n table = null,\n display_opt = []\n }) {\n this.id = id;\n this.key = key || this.id; // default to the id.\n this.title = title;\n this.author = author;\n this.description = description;\n this.source = source;\n this.tags = tags;\n this.sequence = sequence;\n this.macro = macro;\n this.dependencies = dependencies;\n\n this._normalizeTables(tables, table);\n\n this.display_opt = new Map();\n display_opt.forEach((data) => {\n const key = data.table || '';\n if (key) {\n if (data instanceof DisplayOptions) {\n this.display_opt.set(key, data);\n return;\n }\n const opt = new DisplayOptions(data);\n this.display_opt.set(key, opt);\n }\n });\n }\n toString () {\n return this.title;\n }\n /**\n * Make sure table entries are all RandomTableEntry objects.\n * @param {Array} data\n * @returns RandomTableEntry[]\n */\n _normalizeTable (data) {\n const entries = [];\n data.forEach((d) => {\n if (isEmpty(d)) {\n return;\n }\n if (isString(d)) {\n entries.push(new RandomTableEntry({\n label: d\n }));\n return;\n }\n if (d instanceof RandomTableEntry) {\n entries.push(d);\n return;\n }\n if (isObject(d)) {\n entries.push(new RandomTableEntry(d));\n }\n });\n return entries;\n }\n /**\n * Normalize the tables/table constructor data.\n * @param {Object} tables\n * @param {Array} table\n * @returns\n */\n _normalizeTables (tables, table) {\n if (isEmpty(tables) && isEmpty(table)) {\n return;\n }\n this.tables = {};\n // put default table in first.\n if (!isEmpty(table) && Array.isArray(table)) {\n this.tables.default = this._normalizeTable(table);\n }\n if (isObject(tables)) {\n const subtableNames = Object.keys(tables);\n subtableNames.forEach((name) => {\n const data = tables[name];\n if (!Array.isArray(data)) {\n return;\n }\n this.tables[name] = this._normalizeTable(data);\n });\n }\n }\n /**\n * Basic sequence of table rolls.\n * Either the start, the default sequence, the default table, or just the first one.\n * @param {String} start Subtable name to start with.\n * @returns {String[]}\n */\n getSequence (start = '') {\n if (start !== '') {\n return [start];\n }\n if (this.sequence.length === 0) {\n if (this.tables.default) {\n return ['default'];\n }\n return [this.subtableNames[0]];\n }\n if (this.sequence[0] === 'rollall') {\n return this.subtableNames;\n }\n return this.sequence;\n }\n /**\n * All the subtable names.\n * @returns {String[]}\n */\n get subtableNames () {\n return Object.keys(this.tables);\n }\n /**\n * Get entries for a specific subtable.\n * @param {String} [name=default] Subtable name.\n * @returns {RandomTableEntry[]}\n */\n getSubtableEntries (name = 'default') {\n return this.tables[name] || [];\n }\n /**\n * Get a random entry from a subtable.\n * @param {String} subtableName\n * @returns {RandomTableEntry|null}\n */\n getRandomEntry (subtableName) {\n const entries = this.getSubtableEntries(subtableName);\n if (entries.length === 0) {\n return null;\n }\n const values = [];\n const weights = [];\n entries.forEach((entry, k, l) => {\n weights.push(entry.weight);\n values.push(entry);\n });\n return getWeightedRandom(values, weights);\n }\n /**\n * Get an entry in case we only have the label and need other data from it\n * @param {String} label The item we are looking for\n * @param {String} [table=default] the table to search\n * @returns {RandomTableEntry|null}\n */\n findEntry (label, table = 'default') {\n const t = this.tables[table];\n if (!t) {\n return null;\n }\n const entry = t.find((e) => {\n return e.label === label;\n });\n if (!entry) {\n return null;\n }\n return entry;\n }\n /**\n * Find the dependent tables to get full results for this table\n * @return {Array} table keys\n */\n findDependencies () {\n // check field first, if it's not null we'll trust it...?\n if (this.dependencies !== null) {\n return this.dependencies;\n }\n // iterate over the tables and look for table tokens\n let dep = [];\n\n // Check macro\n this.macro.forEach((macro) => {\n const parts = macro.split(':');\n if (parts.length > 0 && parts[0] !== 'this') {\n dep.push(parts[0]);\n }\n });\n const tokenRegExp = /({{2}.+?}{2})/g;\n const tnames = Object.keys(this.tables);\n tnames.forEach((n) => {\n // n is sub/table name\n const table = this.tables[n];\n table.forEach((result) => {\n const tokens = result.label.match(tokenRegExp);\n if (tokens !== null) {\n tokens.forEach((token) => {\n const parts = token.replace('{{', '').replace('}}', '').split(':');\n if (parts.length > 1 && parts[0] === 'table' && parts[1] !== 'this') {\n dep.push(parts[1]);\n }\n });\n }\n });\n });\n dep = dep.reduce((a, b) => {\n if (a.indexOf(b) < 0) { a.push(b); }\n return a;\n }, []);\n this.dependencies = dep;\n return dep;\n }\n /**\n * Custom JSON handler because Map doesn't JSON stringify automatically.\n * @returns {Object}\n */\n toJSON () {\n const obj = defaultToJSON.call(this);\n obj.className = 'RandomTable';\n return obj;\n }\n}\n", "import { defaultToJSON } from './r_helpers.js';\n\n/**\n * Class for results from RandomTable\n */\nexport default class RandomTableResult {\n /**\n * @property {String} table Title of subtable.\n * @property {String} result Randomized result label.\n * @property {String} desc Extra result description.\n */\n constructor ({\n table = '',\n result = '',\n desc = ''\n }) {\n this.table = table;\n this.result = result;\n this.desc = desc;\n }\n /**\n * Is this from the \"default\" table.\n */\n get isDefault () {\n return this.table === 'default';\n }\n /**\n * Is this an error result.\n */\n get isError () {\n return false;\n }\n toString () {\n return this.result;\n }\n /**\n * Custom JSON handler to strip empty props.\n * @returns {Object}\n */\n toJSON () {\n const obj = defaultToJSON.call(this);\n obj.className = 'RandomTableResult';\n return obj;\n }\n}\n", "import RandomTableResult from './RandomTableResult.js';\n\n/**\n * Class for results from RandomTable\n */\nexport default class TableErrorResult extends RandomTableResult {\n /**\n * Is this an error result.\n */\n get isError () {\n return true;\n }\n /**\n * Custom JSON handler to strip empty props.\n * @returns {Object}\n */\n toJSON () {\n const obj = super.toJSON();\n obj.className = 'TableErrorResult';\n return obj;\n }\n}\n", "import { capitalize, defaultToJSON } from './r_helpers.js';\nimport RandomTableResult from './RandomTableResult.js';\nimport TableErrorResult from './TableErrorResult.js';\nimport DisplayOptions from './DisplayOptions.js';\n\n/**\n * Set of table results.\n */\nexport default class RandomTableResultSet {\n /**\n * @property {String} title Title from the RandomTable parent\n * @property {RandomTableResult[]} results Randomized results.\n * @property {Map[DisplayOptions]|Object} displayOptions Display settings from the RandomTable parent.\n */\n constructor ({\n title = '',\n results = [],\n displayOptions = new Map()\n }) {\n this.title = title;\n this.results = [];\n results.forEach((r) => {\n this.addResult(r);\n });\n if (displayOptions instanceof Map) {\n this.displayOptions = displayOptions;\n } else {\n this.displayOptions = new Map();\n Object.keys(displayOptions).forEach((key) => {\n const data = displayOptions[key];\n const tableName = data.table || '';\n if (tableName) {\n if (data instanceof DisplayOptions) {\n this.displayOptions.set(tableName, data);\n return;\n }\n this.displayOptions.set(tableName, new DisplayOptions(data));\n }\n });\n }\n }\n /**\n * Add a result to the set.\n * @param {RandomTableResult|TableErrorResult|object} data\n * @returns\n */\n addResult (data) {\n if (data instanceof RandomTableResult || data instanceof TableErrorResult) {\n this.results.push(data);\n return;\n }\n if (data.className === 'TableErrorResult') {\n this.results.push(new TableErrorResult(data));\n return;\n }\n this.results.push(new RandomTableResult(data));\n }\n\n get isSimple () {\n return this.results.length === 1;\n }\n\n /**\n * Find the result for a specific table/subtable\n * @param {String} table The table to look for\n * @returns {RandomTableResult|null}\n */\n findResultByTable (table = 'default') {\n const obj = this.results.find((v) => {\n return v.table === table;\n });\n return !obj ? null : obj;\n }\n /**\n * Output the set as a string.\n * @param {Boolean} simple Simplify the output (just the result labels)\n * @returns\n */\n niceString (simple = false) {\n if (this.results.length === 0) {\n return '';\n }\n\n if (simple) {\n return this.results.map((r) => { return r.toString(); }).join(' ');\n }\n\n let output = '';\n this.results.forEach((result) => {\n if (result.isError) {\n output += `Error: ${result.result}\\n`;\n return;\n }\n const displayOpt = this.displayOptions.get(result.table);\n if (displayOpt) {\n if (!displayOpt.hide_table) {\n output += `${capitalize(result.table)}: `;\n }\n if (!displayOpt.hide_result) {\n output += `${capitalize(result.result)}\\n`;\n }\n if (!displayOpt.hide_desc) {\n if (result.desc !== '') {\n output += `(${result.desc})\\n`;\n }\n }\n return;\n }\n if (result.isDefault) {\n output += `${capitalize(result.result)}\\n`;\n } else {\n output += `${capitalize(result.table)}: ${capitalize(result.result)}\\n`;\n }\n if (result.desc !== '') {\n output += `${result.desc}\\n`;\n }\n });\n return output.trim(); // trim off final linebreak\n }\n /**\n * Simple base output of result set.\n */\n toString () {\n return this.niceString();\n }\n /**\n * Custom JSON handler because Map doesn't JSON stringify automatically.\n * @returns {Object}\n */\n toJSON () {\n const obj = defaultToJSON.call(this);\n obj.className = 'RandomTableResultSet';\n return obj;\n }\n}\n", "/* eslint-disable no-useless-escape */\nimport { randomInteger } from './randomizer.js';\n\n/**\n * @prop {String} die Die notation.\n * @prop {Number} value Random roll for the die notation.\n */\nclass DiceResult {\n constructor ({\n die = '',\n value = 0\n }) {\n this.die = die;\n this.value = value;\n }\n toString () {\n return this.value;\n }\n toJSON () {\n return {\n className: 'DiceResult',\n die: this.die,\n value: this.value\n };\n }\n}\n\n/**\n * Dice rolling simulator\n * @param {Number} [die=6] Die type\n * @param {Number} [number=1] Number of times to roll the die\n * @param {Number} [modifier=0] Numeric modifier to dice total\n * @param {String} [mod_op=+] Operator for the modifier (+,-,/,*)\n * @returns {Number} Number rolled (die*number [mod_op][modifier])\n */\nconst parseDiceNotation = function (die = 6, number = 1, modifier = 0, mod_op = '+') {\n modifier = parseInt(modifier, 10);\n die = parseInt(die, 10);\n\n if (number <= 0) {\n number = 1;\n } else {\n number = parseInt(number, 10);\n }\n\n let sum = 0;\n for (let i = 1; i <= number; i++) {\n sum = sum + randomInteger(1, die);\n }\n if (modifier === 0) {\n return sum;\n }\n\n switch (mod_op) {\n case '*':\n sum = sum * modifier;\n break;\n case '-':\n sum = sum - modifier;\n break;\n case '/':\n sum = sum / modifier;\n break;\n case '+':\n default:\n sum = sum + modifier;\n break;\n }\n return Math.round(sum);\n};\n\n/**\n * takes a string like '3d6+2', 'd6', '2d6', parses it, and puts it through roll\n * @params {String} string a die roll notation\n * @returns {Number} the result of the roll\n */\nconst rollDie = function (string = '') {\n string = string.trim();\n const m = string.match(/^([0-9]*)d([0-9]+)(?:([\\+\\-\\*\\/])([0-9]+))*$/);\n if (!m) {\n return '';\n }\n return parseDiceNotation(m[2], m[1], m[4], m[3]);\n};\n\n/**\n * Return a dice result.\n * @param {String} die Die roll notation.\n * @returns {DiceResult}\n */\nconst getDiceResult = function (die = '') {\n return new DiceResult({\n die,\n value: rollDie(die)\n });\n};\n\nexport {\n rollDie,\n DiceResult,\n getDiceResult\n};\n", "/**\n * Custom error for handling known errors in the table roller.\n */\nclass TableError extends Error {\n constructor (message) {\n super(message);\n this.name = 'TableError';\n }\n}\n\nexport default TableError;\n", "/* eslint-disable no-useless-escape */\nimport { isEmpty, isUndefined } from './r_helpers.js';\nimport RandomTable from './RandomTable.js';\nimport RandomTableEntry from './RandomTableEntry.js';\nimport RandomTableResult from './RandomTableResult.js';\nimport RandomTableResultSet from './RandomTableResultSet.js';\nimport { getDiceResult } from './dice_roller.js';\nimport TableError from './TableError.js';\nimport TableErrorResult from './TableErrorResult.js';\n\n/**\n * Define the regex to find tokens\n * This looks for anything between double brackets.\n * Note: this is duplicated in RandomTable.findDependencies() so if updated, update it there too\n */\nconst tokenRegExp = /({{2}.+?}{2})/g;\n\n/**\n * TableRoller\n * Handles rolling on tables and tokens in tables/results.\n * @constructor\n */\nclass TableRoller {\n constructor ({\n token_types = {}\n }) {\n this.token_types = {\n roll: this._defaultRollToken.bind(this),\n table: this._defaultTableToken.bind(this)\n };\n Object.keys(token_types).forEach((token) => {\n this.token_types[token] = token_types[token];\n });\n }\n /**\n * Return an error result\n * @param {String} error Error message\n * @param {String} table Sub/table name if relevant.\n * @returns {TableErrorResult}\n */\n _getErrorResult (error = '', table = '') {\n return new TableErrorResult({\n table: table,\n result: error\n });\n }\n /**\n * Return a result set with an error.\n * @param {String} error Error message\n * @returns {RandomTableResultSet}\n */\n _getErrorResultSet (error = '') {\n return new RandomTableResultSet({\n results: [\n this._getErrorResult(error)\n ]\n });\n }\n /**\n * Get a result from a table/subtable in a RandomTable object\n * DANGER: you could theoretically put yourself in an endless loop if the data were poorly planned\n * Calling method try to catch RangeError to handle that possibility.\n * @param {RandomTable} rtable the RandomTable object\n * @param {String} table table to roll on\n * @returns {RandomTableResult[]}\n */\n _selectFromTable (rtable, table) {\n if (!(rtable instanceof RandomTable)) {\n return [this._getErrorResult('Invalid table.')];\n }\n\n let o = []; // Results\n const entry = rtable.getRandomEntry(table);\n if (entry === null || !(entry instanceof RandomTableEntry)) {\n return [this._getErrorResult('Invalid subtable name.', table)];\n }\n // if print is false we suppress the output from this table\n // (good for top-level tables that have subtables prop set)\n if (entry.print) {\n // replace any tokens\n const t_result = this.findToken(entry.label, rtable);\n o.push(new RandomTableResult({ table: table, result: t_result, desc: entry.description }));\n }\n\n // are there subtables to roll on?\n if (entry.subtable.length === 0) {\n // no subtables\n return o;\n }\n\n // Select from each subtable and add to results.\n entry.subtable.forEach((subtableName) => {\n const subresult = this._selectFromTable(rtable, subtableName);\n // concat because subresult is an array.\n o = o.concat(subresult);\n });\n return o;\n }\n /**\n * Get results array for macro setting of a table.\n * @param {RandomTable} rtable Table with macro set.\n * @returns {RandomTableResult[]}\n */\n _getTableMacroResult (rtable) {\n let results = [];\n try {\n rtable.macro.forEach((macroKey) => {\n const parts = macroKey.split(':');\n const tableKey = parts[0];\n const subtable = parts[1] || '';\n if (tableKey === rtable.key) {\n throw new TableError(`Macros can't self reference.`);\n }\n try {\n const mtable = this.getTableByKey(tableKey);\n const result = this.getTableResult(mtable, subtable);\n // concat because result is an array.\n results = results.concat(result);\n } catch (e) {\n if (e instanceof TableError) {\n results.push(this._getErrorResult(e.message, tableKey));\n } else {\n // Rethrow unexpected errors\n throw e;\n }\n }\n });\n } catch (e) {\n if (e instanceof RangeError) {\n // This could be an infinite loop of table results referencing each other.\n results.push(this._getErrorResult(e.message));\n } else {\n throw e;\n }\n }\n return results;\n }\n /**\n * Generate a result from a RandomTable object\n * @param {RandomTable} rtable the RandomTable\n * @param {String} [start=''] subtable to roll on\n * @return {RandomTableResult[]}\n */\n getTableResult (rtable, start = '') {\n if (!(rtable instanceof RandomTable)) {\n return [\n this._getErrorResult('No table found to roll on.')\n ];\n }\n let results = [];\n\n // if macro is set then we ignore a lot of stuff\n if (rtable.macro.length > 0) {\n return this._getTableMacroResult(rtable);\n }\n\n const sequence = rtable.getSequence(start);\n if (sequence.length === 0) {\n return results;\n }\n try {\n sequence.forEach((seqKey) => {\n const r = this._selectFromTable(rtable, seqKey);\n results = results.concat(r);\n });\n } catch (e) {\n // In case of infinite recursion\n if (e instanceof RangeError) {\n results.push(this._getErrorResult(e.message));\n } else {\n throw e;\n }\n }\n return results;\n }\n /**\n * Get result set from a table based on the key.\n * @param {String} tableKey\n * @param {String} table\n * @returns {RandomTableResultSet}\n */\n getTableResultSetByKey (tableKey, table = '') {\n try {\n const rtable = this.getTableByKey(tableKey);\n const results = this.getTableResult(rtable, table);\n return new RandomTableResultSet({\n title: rtable.title,\n results: results,\n displayOptions: rtable.display_opt\n });\n } catch (e) {\n if (e instanceof TableError) {\n return this._getErrorResultSet(e.message);\n } else {\n // Rethrow unexpected errors\n throw e;\n }\n }\n }\n /**\n * Get result set from a table based on the key.\n * @param {RandomTable} rtable Main table object.\n * @param {String} [table] Subtable\n * @returns {RandomTableResultSet}\n */\n getResultSetForTable (rtable, table = '') {\n if (!(rtable instanceof RandomTable)) {\n return this._getErrorResultSet(`Invalid table data.`);\n }\n const results = this.getTableResult(rtable, table);\n return new RandomTableResultSet({\n title: rtable.title,\n results: results,\n displayOptions: rtable.display_opt\n });\n }\n /**\n * Perform token replacement. Only table and roll actions are accepted\n * @param {String} token A value passed from findToken containing a token(s) {{SOME OPERATION}} Tokens are {{table:SOMETABLE}} {{table:SOMETABLE:SUBTABLE}} {{table:SOMETABLE*3}} (roll that table 3 times) {{roll:1d6+2}} (etc) (i.e. {{table:colonial_occupations:laborer}} {{table:color}} also generate names with {{name:flemish}} (surname only) {{name:flemish:male}} {{name:dutch:female}}\n * @param {RandomTable|null} curtable RandomTable the string is from (needed for \"this\" tokens) or null\n * @returns {RandomTableResultSet|RandomTableResultSet[]|DiceResult|String|Any} The result of the token or else just the token (in case it was a mistake or at least to make the error clearer)\n */\n convertToken (token, curtable = null) {\n let parts = token.replace('{{', '').replace('}}', '').split(':');\n parts = parts.map((el) => {\n return el.trim();\n });\n if (parts.length === 0) {\n return token;\n }\n\n // look for a token type we can run\n try {\n if (this.token_types[parts[0]]) {\n return this.token_types[parts[0]](parts, token, curtable);\n } else {\n return token;\n }\n } catch (e) {\n if (e instanceof RangeError) {\n // This could be an infinite loop of table results referencing each other.\n return this._getErrorResultSet(e.message);\n } else {\n throw e;\n }\n }\n }\n /**\n * Look for tokens to perform replace action on them.\n * @param {String} entryLabel Usually a label from a RandomTableEntry\n * @param {RandomTable|null} curtable RandomTable the string is from (needed for \"this\" tokens) or null\n * @returns {String} String with tokens replaced (if applicable)\n */\n findToken (entryLabel, curtable = null) {\n if (isEmpty(entryLabel)) {\n return '';\n }\n const newstring = entryLabel.replace(tokenRegExp, (token) => {\n return this.convertToken(token, curtable).toString();\n });\n return newstring;\n }\n /**\n * Since tables are stored outside of this module, this function allows for the setting of a function which will be used to lookup a table by it's key\n * @param {Function} lookup a function that takes a table key and returns a RandomTable or null\n */\n setTableKeyLookup (lookup) {\n this._customGetTableByKey = lookup;\n }\n /**\n * Placeholder that should be replaced by a function outside this module\n * @param {String} key human readable table identifier\n * @return {null} nothing, when replaced this function should return a table object\n */\n _customGetTableByKey (key) {\n return null;\n }\n /**\n * Return a table based on it's key.\n * This requires calling setTableKeyLookup and setting a lookup method\n * That returns a RandomTable object or null.\n * @param {String} key human readable table identifier\n * @returns {RandomTable}\n * @throws {TableError}\n */\n getTableByKey (key) {\n if (!key) {\n throw new TableError('No table key.');\n }\n const table = this._customGetTableByKey(key);\n if (!table || !(table instanceof RandomTable)) {\n throw new TableError(`No table found for key: ${key}`);\n }\n return table;\n }\n /**\n * Add a token variable\n * @param {String} name Name of the token (used as first element).\n * @param {Function} process Function to return token replacement value function is passed the token_parts (token split by \":\"), original full_token, current table name\n */\n registerTokenType (name, process) {\n this.token_types[name] = process;\n }\n /**\n * Dice roll token.\n * @returns {DiceResult}\n */\n _defaultRollToken (token_parts, full_token = '', curtable = null) {\n return getDiceResult(token_parts[1]);\n }\n /**\n * Table token lookup in the form:\n * {{table:SOMETABLE}} {{table:SOMETABLE:SUBTABLE}} {{table:SOMETABLE*3}} (roll that table 3 times) {{table:SOMETABLE:SUBTABLE*2}} (roll subtable 2 times)\n * @param {String[]} token_parts Token split by :\n * @param {String} full_token Original token\n * @param {RandomTable|null} curtable Current table or null.\n * @returns {RandomTableResultSet|RandomTableResultSet[]} One or more result sets.\n */\n _defaultTableToken (token_parts, full_token, curtable = null) {\n if (isUndefined(token_parts[1])) {\n return full_token;\n }\n let multiplier = 1;\n if (token_parts[1].indexOf('*') !== -1) {\n const x = token_parts[1].split('*');\n token_parts[1] = x[0];\n multiplier = x[1];\n }\n\n // what table do we roll on\n let rtable = null;\n if (token_parts[1] === 'this') {\n if (!curtable) {\n return full_token;\n }\n // reroll on same table\n rtable = curtable;\n } else {\n // Table lookup\n try {\n rtable = this.getTableByKey(token_parts[1]);\n } catch (e) {\n if (e instanceof TableError) {\n return full_token;\n } else {\n // Rethrow unexpected errors\n throw e;\n }\n }\n }\n\n if (typeof token_parts[2] !== 'undefined' && token_parts[2].indexOf('*') !== -1) {\n const x = token_parts[2].split('*');\n token_parts[2] = x[0];\n multiplier = x[1];\n }\n const subtable = (isUndefined(token_parts[2])) ? '' : token_parts[2];\n\n const results = [];\n for (let i = 1; i <= multiplier; i++) {\n results.push(this.getResultSetForTable(rtable, subtable));\n }\n return results.length === 1 ? results[0] : results;\n }\n}\n\nexport default TableRoller;\n", "/**\n * Adapted from http://blog.javascriptroom.com/2013/01/21/markov-chains/\n */\nclass MarkovGenerator {\n /**\n *\n * @param {Object} memory the \"memory\" where the language parts go\n * @param {String} separator If you want to delimit the generated parts\n * @param {Number} order How many... something... to something.... oh it's been too long I don't remember how this works...\n */\n constructor ({\n memory = {},\n separator = '',\n order = 2\n }) {\n this.memory = memory;\n this.separator = separator;\n this.order = order;\n }\n /**\n * Is the memory key already set.\n * @param {String} key\n */\n isMemoryKeySet (key) {\n return !!this.memory[key];\n }\n /**\n * Generate a starting array for the chain based on the order number\n * @return {Array} just an empty array of length=order\n */\n genInitial () {\n return Array(this.order).fill('');\n }\n /**\n * Get a random array element\n * @param {Array} arr an array\n * @return {String|Object} random value\n */\n getRandomValue (arr) {\n return arr[Math.floor(Math.random() * arr.length)];\n }\n /**\n * Chunk the word or phrase\n * @param {String} txt the text to chunk\n * @param {Function} cb callback function\n * @return {null} null\n */\n breakText (txt, cb) {\n const parts = txt.split(this.separator);\n const prev = this.genInitial();\n\n parts.forEach((v) => {\n v = v.toLowerCase();\n cb(prev, v);\n prev.shift();\n prev.push(v);\n });\n cb(prev, '');\n }\n /**\n * Feed text to memory\n * @param {String} key key for the chain (so we can store multiple memories)\n * @param {String} txt word or phrase\n * @return {null} null\n */\n learn (key, txt) {\n const mem = (this.memory[key]) ? this.memory[key] : {};\n // split up text then add the calculated parts to the memory for this key\n this.breakText(txt, (key, value) => {\n if (!mem[key]) {\n mem[key] = [];\n }\n mem[key].push(value);\n return mem;\n });\n this.memory[key] = mem;\n }\n /**\n * Iterate through, calls self\n * @param {Array} state array of most recent x(x=order) elements in chain\n * @param {Array} ret the chain\n * @return {Array}\n */\n step (state, ret) {\n const nextAvailable = this.memory[this.cur_key][state] || [''];\n const next = this.getRandomValue(nextAvailable);\n // we don't have anywhere to go\n if (!next) {\n return ret;\n }\n ret.push(next);\n const nextState = state.slice(1);\n nextState.push(next);\n return this.step(nextState, ret);\n }\n /**\n * Return a generated response\n * @param {String} key key for the chain (so we can store multiples\n * @param {Array} seed letters to start the response (?)\n */\n generate (key, seed) {\n if (!seed) {\n seed = this.genInitial();\n }\n this.cur_key = key;\n return seed.concat(this.step(seed, [])).join(this.separator);\n }\n}\n\nexport default MarkovGenerator;\n", "/**\n * Custom error for handling known errors in the name generator.\n */\nclass RandomNameError extends Error {\n constructor (message) {\n super(message);\n this.name = 'RandomNameError';\n }\n}\n\nexport default RandomNameError;\n", "import { randomString } from './randomizer.js';\nimport { defaultToJSON } from './r_helpers.js';\n\n/**\n * Class for name data.\n */\nexport default class RandomNameType {\n /**\n *\n * @param {String} key Key to identify uniquely in tokens and methods.\n * @param {String} label Human readable label.\n * @param {String[]} male Names.\n * @param {String[]} female Names.\n * @param {String[]} surname Names.\n */\n constructor ({\n key = '',\n label = '',\n male = [],\n female = [],\n surname = []\n }) {\n this.key = key;\n this.label = label || key;\n this.male = Array.isArray(male) ? male : [];\n this.female = Array.isArray(female) ? female : [];\n this.surname = Array.isArray(surname) ? surname : [];\n }\n /**\n * Returns all personal names.\n * @returns {String[]}\n */\n getAllPersonalNames () {\n return Array.prototype.concat(this.male, this.female);\n }\n /**\n * Return a personal name list.\n * @param {String} gender Mixed, random, male, female\n * @returns {String[]}\n */\n getPersonalNameList (gender = 'random') {\n // Mixed gets all the personal names.\n if (gender === 'mixed' || gender === '') {\n return this.getAllPersonalNames();\n }\n // If specific gender is requested\n // return regardless of if it's empty\n if (gender === 'male') {\n return this.male;\n }\n if (gender === 'female') {\n return this.female;\n }\n // Else return a random list\n const randomList = [];\n if (this.male.length > 0) {\n randomList.push('male');\n }\n if (this.female.length > 0) {\n randomList.push('female');\n }\n if (randomList.length === 0) {\n return [];\n }\n gender = randomString(randomList);\n return this[gender];\n }\n /**\n * Custom JSON handler because Map doesn't JSON stringify automatically.\n * @returns {Object}\n */\n toJSON () {\n const obj = defaultToJSON.call(this);\n obj.className = 'RandomNameType';\n return obj;\n }\n}\n", "import { capitalize } from './r_helpers.js';\nimport MarkovGenerator from './MarkovGenerator.js';\nimport { randomString } from './randomizer.js';\nimport RandomNameError from './RandomNameError.js';\nimport RandomNameType from './RandomNameType.js';\n\n/** Capitalize names, account for multiword lastnames like \"Van Hausen\"\n * @param {String} name a name\n * @return {String} name capitalized\n */\nconst capitalizeName = function (name) {\n if (!name) {\n return '';\n }\n const leave_lower = ['of', 'the', 'from', 'de', 'le', 'la'];\n // need to find spaces in name and capitalize letter after space\n const parts = name.split(' ');\n const upper_parts = parts.map((w) => {\n return (leave_lower.indexOf(w) >= 0) ? w : `${capitalize(w)}`;\n });\n return upper_parts.join(' ');\n};\n\n/**\n * @prop {Map} nameTypes\n * @prop {MarkovGenerator} _markov\n */\nclass RandomNameGenerator {\n /**\n * Random name generation.\n * @param {RandomNameType[]} namedata\n * @param {Number} [markovOrder=3] Markov generator settings.\n */\n constructor ({\n namedata = [],\n markovOrder = 3\n }) {\n this.nameTypes = new Map();\n if (Array.isArray(namedata)) {\n namedata.forEach((type) => {\n this.registerNameType(type);\n });\n }\n this._markov = new MarkovGenerator({ order: markovOrder });\n }\n /**\n * Add some name data\n * Note: you can overwrite existing name_types if you want\n * @param {RandomNameType} type\n * @throws {RandomNameError}\n */\n registerNameType (type) {\n if (!(type instanceof RandomNameType)) {\n throw new RandomNameError('Must be instance of RandomNameType');\n }\n if (!type.key) {\n throw new RandomNameError('RandomNameType must have key set.');\n }\n if (type.key === 'random') {\n throw new RandomNameError(`RandomNameType key ${type.key} is reserved.`);\n }\n if (type.male.length === 0 && type.female.length === 0 && type.surname.length === 0) {\n throw new RandomNameError(`RandomNameType ${type.key} must include male, female, or surname lists.`);\n }\n this.nameTypes.set(type.key, type);\n }\n /**\n * Make sure namedata is set.\n * @param {String} name_type\n * @param {String} [subtype=''] Subtype like a gender or 'surname'\n * @throws RandomNameError\n */\n _validateNameType (name_type, subtype = '') {\n const type = this.nameTypes.get(name_type);\n if (!type) {\n throw new RandomNameError('Invalid name type.');\n }\n if (!subtype) {\n return;\n }\n if (!Array.isArray(type[subtype]) || type[subtype].length === 0) {\n throw new RandomNameError(`${name_type} type does not have subtype ${subtype}`);\n }\n }\n /**\n * Keys of the name types that are set.\n * @returns {String[]}\n */\n getValidNameTypes () {\n return Array.from(this.nameTypes.keys());\n }\n /**\n * Get a random name type from the available types.\n * @returns {String}\n */\n getRandomNameType () {\n return randomString(Array.from(this.nameTypes.keys())) || '';\n }\n /**\n * Get the name type\n * @param {String} name_type Name type key or random.\n * @returns {RandomNameType}\n * @throws {RandomNameError}\n */\n _getNameType (name_type) {\n if (name_type === 'random') {\n // randomize a type...\n name_type = this.getRandomNameType();\n }\n const nameType = this.nameTypes.get(name_type);\n if (!nameType) {\n throw new RandomNameError('Invalid name type.');\n }\n return nameType;\n }\n /**\n * Get a name list\n * @param {String} name_type\n * @param {String} subtype\n * @returns {String[]}\n */\n _getNameList (name_type = 'random', subtype = 'mixed') {\n const nameType = this._getNameType(name_type);\n if (subtype === 'surname') {\n if (nameType.surname.length === 0) {\n throw new RandomNameError(`${name_type} type does not have subtype ${subtype}`);\n }\n return nameType.surname;\n }\n const list = nameType.getPersonalNameList(subtype);\n if (list.length === 0) {\n throw new RandomNameError(`${name_type} type does not have subtype ${subtype}`);\n }\n return list;\n }\n /**\n * Select a personal name from one of the lists.\n * @param {String} name_type what list/process to use, else random\n * @param {String} gender\n * @returns {String}\n * @throws {RandomNameError}\n */\n selectPersonalName (name_type = 'random', gender = 'random') {\n const nameList = this._getNameList(name_type, gender);\n return capitalizeName(randomString(nameList));\n }\n /**\n * Select a sur/last name only from one of the lists\n * @param {String} name_type what list/process to use, else random\n * @returns {String} a name\n * @throws {RandomNameError}\n */\n selectSurname (name_type = 'random') {\n const nameList = this._getNameList(name_type, 'surname');\n return capitalizeName(randomString(nameList));\n }\n /**\n * Select a name from one of the lists\n * @param {String} name_type What name list/process to use else random\n * @param {String} gender male, female, random, ''\n * @param {String} style first=first name only, else full name\n * @returns {String} a name\n * @throws {RandomNameError}\n */\n selectName (name_type = 'random', gender = 'random', style = '') {\n const nameType = this._getNameType(name_type);\n const personalNameList = nameType.getPersonalNameList(gender);\n if (personalNameList.length === 0) {\n throw new RandomNameError(`${nameType.key} does not have list for ${gender}`);\n }\n let name = capitalizeName(randomString(personalNameList));\n if (style !== 'first' && nameType.surname.length > 0) {\n name += ` ${capitalizeName(randomString(nameType.surname))}`;\n }\n return name.trim();\n }\n /**\n * Create a personal name using markov chains.\n * @param {String} name_type what list/process to use, else random\n * @param {String} gender\n * @returns {String}\n * @throws {RandomNameError}\n */\n createPersonalName (name_type = 'random', gender = 'random') {\n const nameType = this._getNameType(name_type);\n const namelist = nameType.getPersonalNameList(gender);\n if (namelist.length === 0) {\n throw new RandomNameError('Starting name list is empty.');\n }\n const mkey = `${nameType.key}_${gender}`;\n if (!this._markov.isMemoryKeySet(mkey)) {\n namelist.forEach((v) => {\n this._markov.learn(mkey, v);\n });\n }\n return capitalizeName(this._markov.generate(mkey).trim());\n }\n /**\n * Create a sur/last name using markov chains.\n * @param {String} name_type what list/process to use, else random\n * @returns {String} a name\n * @throws {RandomNameError}\n */\n createSurName (name_type = 'random') {\n const nameType = this._getNameType(name_type);\n const namelist = nameType.surname;\n if (namelist.length === 0) {\n throw new RandomNameError('Starting name list is empty.');\n }\n const skey = `${nameType.key}_surname`;\n if (!this._markov.isMemoryKeySet(skey)) {\n namelist.forEach((v) => {\n this._markov.learn(skey, v);\n });\n }\n return capitalizeName(this._markov.generate(skey).trim());\n }\n /**\n * Create a name using Markov chains\n * @param {String} [name_type=random] what list/process to use\n * @param {String} [gender=random] male or female or both\n * @param {String} style first=first name only, else full name\n * @returns {String} a name\n * @throws {RandomNameError}\n */\n createName (name_type = 'random', gender = 'random', style = '') {\n if (name_type === 'random') {\n name_type = this.getRandomNameType();\n }\n let name = this.createPersonalName(name_type, gender);\n if (style !== 'first') {\n name = `${name} ${this.createSurName(name_type)}`;\n }\n return name.trim();\n }\n /**\n * Generate a bunch of names, half male, half female\n * @param {Number} [number=10] number of names in the list (half will be male, half will be female)\n * @param {String} [name_type] type of name or else it will randomly select\n * @param {Bool} [create=false] new names or just pick from list\n * @return {Object} arrays of names inside male/female property\n * @throws {RandomNameError}\n */\n generateList (number = 10, name_type = 'random', create = false) {\n const names = { male: [], female: [] };\n\n for (let i = 1; i <= number; i++) {\n const gender = (i <= Math.ceil(number / 2)) ? 'male' : 'female';\n if (create) {\n names[gender].push(this.createName(name_type, gender));\n } else {\n names[gender].push(this.selectName(name_type, gender));\n }\n }\n return names;\n }\n /**\n * Callback for the TableRoller to generate names from a token.\n * Token parts will be:\n * 0: \"name\" literally\n * 1: type of name (often a nationality/language/ethnicity/etc)\n * 2: gender (\"male\"/\"female\" for which name list to pick from, defaults to randomizing between them).\n * 3: style (\"first\" for a first name, else a full name will be returned)\n * @param {String[]} token_parts Parts of a token: 0 will be the action (name in most cases.)\n * @param {String} full_token Full token wrapped in double braces.\n * @param {RandomTable|null} curtable Current table token was found in (helpful if `this` token is found) or null\n * @returns {String}\n */\n nameTokenCallback (token_parts, full_token = '', curtable = null) {\n let string = '';\n if (!token_parts[1]) {\n token_parts[1] = 'random';\n }\n if (!token_parts[3] || token_parts[3] !== 'first') {\n token_parts[3] = '';\n }\n if (!token_parts[2]) {\n token_parts[2] = 'random';\n }\n try {\n string = this.selectName(token_parts[1], token_parts[2], token_parts[3]);\n } catch (e) {\n if (e instanceof RandomNameError) {\n return '';\n } else {\n throw e;\n }\n }\n return string;\n }\n}\n\nexport default RandomNameGenerator;\n", "export default [\n {\n id: 3,\n key: 'npcs',\n title: 'NPC Characteristics',\n sequence: ['size', 'manner', 'physical_trait', 'quirk', 'speech'],\n tables: {\n size: [\n 'Short',\n 'Thin',\n 'Average',\n 'Tall',\n 'Large',\n 'Pick Two'\n ],\n dress: [\n 'Cleancut',\n 'Filthy',\n 'Fancy',\n 'Practical',\n 'Rich',\n 'Uniform'\n ],\n manner: [\n 'Gregarious',\n 'Icy',\n 'Pious',\n 'Flirtacious / Obsequious',\n 'Aggressive / Critical',\n 'Reserved'\n ],\n physical_trait: [\n 'Missing Limb',\n 'Hairy',\n 'Unusual hair',\n 'Muscular',\n 'Unusually Attractive',\n 'Unusually Ugly'\n ],\n quirk: [\n 'Touchy',\n 'Fingers Talisman [crucifix/ring/gun]',\n 'Ticket/Fidgety',\n 'Bad Sense [sight/hearing]',\n 'Drinks/Smokes Profusely',\n 'Gestures a lot'\n ],\n speech: [\n 'Stutters',\n 'Florid',\n 'Terse',\n 'Curses excessively',\n 'Laughs a lot',\n 'Meandering'\n ]\n }\n },\n {\n id: 4,\n key: 'jobs',\n title: 'NPC Jobs',\n display_opt: [\n { table: 'worker', hide_table: true },\n { table: 'merchant', hide_table: true },\n { table: 'craftsman', hide_table: true },\n { table: 'professional', hide_table: true },\n { table: 'wealthy', hide_table: true },\n { table: 'neer_do_well', hide_table: true }\n ],\n tables: {\n default: [\n { label: 'Worker', subtable: 'worker', print: false },\n { label: 'Merchant', subtable: 'merchant', print: false },\n { label: 'Craftsman', subtable: 'craftsman', print: false },\n { label: 'Professional', subtable: 'professional', print: false },\n { label: 'Wealthy', subtable: 'wealthy', print: false },\n { label: 'Ne\\'er Do Well', subtable: 'neer_do_well', print: false }\n ],\n worker: [\n 'Farmer',\n 'Bartender',\n 'Clerk',\n 'Cowboy',\n 'Soldier',\n 'Laundress',\n 'Prostitute',\n 'Logger',\n 'Parent',\n 'Miner',\n 'Trapper',\n 'Unemployed'\n ],\n merchant: [\n 'General Store',\n 'Bathhouse',\n 'Hotel/Boarding',\n 'Saloon',\n 'Pimp',\n 'Hardware',\n 'Livery',\n 'Foreman/Manager',\n 'Food/Cafe',\n 'Freight',\n 'Haberdasher',\n 'Feed Barn'\n ],\n craftsman: [\n 'Blacksmith',\n 'Wainwright',\n 'Brewer/Distiller',\n 'Saddler',\n 'Tailor',\n 'Barber',\n 'Cook',\n 'Butcher',\n 'Gunsmith',\n 'Sawmill',\n 'Carpenter',\n '?'\n ],\n professional: [\n 'Doctor',\n 'Lawyer',\n 'Newspaper Editor',\n 'Teacher',\n 'Sheriff',\n 'Army Officer',\n 'Preacher',\n 'Telegraph Operator',\n 'Conductor',\n 'Assayer',\n 'Surveyor',\n 'Marshal'\n ],\n wealthy: [\n 'Mine Owner',\n 'Cattle Baron',\n 'Trust Fund Child',\n 'Banker',\n 'Politician',\n 'Nouveau Riche'\n ],\n neer_do_well: [\n 'Gambler',\n 'Addict',\n 'Gunfighter',\n 'Actor',\n 'Musician',\n 'Dancer',\n 'Thug',\n 'Gossip',\n 'Thief',\n 'Gigolo',\n 'Hermit',\n 'Vigilante'\n ]\n }\n },\n {\n id: 5,\n key: 'goals',\n title: 'NPC Goals',\n display_opt: [\n { table: 'long_term', hide_table: true },\n { table: 'short_term', hide_table: true },\n { table: 'secrets', hide_table: true }\n ],\n tables: {\n long_term: [\n 'Wealth',\n 'Safety [family/self]',\n 'Civic Good',\n 'Knowledge/Skill/Craft',\n 'Piety/Charity',\n 'Status/Power',\n 'Peace & Quiet',\n 'Passion'\n ],\n short_term: [\n 'Business Deal',\n 'Pleasure/Addiction',\n 'Property',\n 'Specific Object',\n 'Money',\n 'Job/Work',\n 'Love/Lust/Desire',\n 'Revenge/Hate'\n ],\n secrets: [\n 'Love\u2019s another\u2019s spouse [mutual/unrequited/unexpressed]',\n 'Fled a murder rap [innocent/guilty]',\n 'Fraud at profession',\n 'Hidden vice [dope/alcohol/sex]',\n 'Secret child in town',\n 'Ran with a bad bunch of hombres',\n 'Owes a lot of money / Broke',\n 'Hallucinatory visions [religious/psychotic]'\n ]\n }\n },\n {\n id: 6,\n key: 'relationships',\n title: 'NPC Relationships',\n tables: {\n default: [\n { label: 'Hate', weight: 1 },\n { label: 'Dislike', weight: 5 },\n { label: 'Suspicious', weight: 7 },\n { label: 'Neutral', weight: 10 },\n { label: 'Like', weight: 7 },\n { label: 'Friend', weight: 5 },\n { label: 'Love', weight: 1 }\n ],\n specific: [\n 'Lovers [current/former]',\n 'Enemies [long term/recent/former]',\n 'Rivalry [business/love]',\n 'Loaner/Debtor',\n 'Comrades [current/former] [business/army/mines/banditry/cowboys]',\n 'Employer/Employee [current/former]',\n 'Family [happy/secret/estranged]'\n ],\n faction: [\n 'Community leaders (business owners)',\n 'Pious church goers',\n 'Miners/Loggers [union]',\n 'Ranchers',\n 'The Law (sheriff, deputies, judges, posse members, etc.)',\n 'Homesteaders',\n 'Bandits'\n ]\n }\n },\n {\n id: 7,\n key: 'events',\n title: 'Events',\n tables: {\n regular: [\n 'Wedding [jealousy/drunken revelry]',\n 'Funeral [murder/inheritance]',\n 'Market day [theft/rivalry/strangers]',\n 'Holiday',\n 'Arrival [stage/train]',\n 'Sunday services',\n 'Payday at the [mine/ranch/camp]'\n ],\n crimes: [\n 'Drunken brawl',\n 'Murder',\n 'Theft',\n 'Kidnapping',\n 'Bandit raid',\n 'Shootout',\n '[Stage/train] ambushed',\n 'Arson'\n ],\n natural: [\n 'Resource Depletion',\n 'Sickness',\n 'Rainstorm',\n 'Windstorm',\n 'Fire',\n 'Wild animals'\n ],\n other: [\n 'Territorial dispute [ranchers/farmers/both]',\n 'Heartless capitalist tries to run thing',\n 'A dark past catches up with someone',\n 'Mine collapse/Logging accident',\n 'Election',\n 'Workers strike',\n 'Lynch mob',\n 'New business opens',\n 'Square dance'\n ]\n }\n },\n {\n id: 8,\n key: 'stranger',\n title: 'A Stranger Comes to Town',\n tables: {\n default: [\n 'Gunslinger',\n 'Pinkerton Detective',\n 'Itinerant Preacher',\n '[Son/father/daughter/lover] thought to be dead',\n 'Family member with a [problem/past/secret]',\n 'Ex-con [stranger/relative/old friend]',\n 'Snake Oil Salesman',\n 'Rabblerouser',\n 'Swindler [man/woman/couple/family]',\n 'Rich [worldly/naive] [man/couple/woman] from back East',\n 'Bandit [with/out] his gang',\n 'Family looking to settle',\n 'Destitute men looking for work',\n 'Former soldiers [hungry/crazed/in pursuit/pursued]',\n 'Bounty hunter with a [recent/old] warrant for [townsperson/bandit/gunslinger]',\n 'Traveling salesman',\n '[Troublesome/pitiful] [man/woman] comes to get [family/friend] out of jail',\n 'Politician [campaigning/canvassing]',\n 'Woman fleeing [fiance/husband]',\n 'Travelling Troupe of Actors'\n ]\n }\n },\n {\n id: 10,\n key: 'items',\n title: 'Items',\n tables: {\n default: [\n { label: 'weapons', subtable: 'weapons', print: true },\n { label: 'valuables', subtable: 'valuables', print: true },\n { label: 'clothes', subtable: 'clothes', print: true },\n { label: 'consumables', subtable: 'consumables', print: true },\n { label: 'papers', subtable: 'papers', print: true },\n { label: 'other', subtable: 'other', print: true }\n ],\n weapons: [\n 'Famous gunslinger\u2019s pistol',\n 'Knife',\n 'Gun [shotgun/pistol/rifle]',\n 'Bandolier of bullets',\n 'Cavalry Sword',\n 'Ax',\n 'Whip'\n ],\n valuables: [\n 'Wedding band of [live/dead] spouse',\n 'Thoroughbred horse',\n 'Unopened bottle of imported liquor',\n 'Wallet of bills',\n 'Pouch of gold',\n 'Combination to safe on a photo',\n 'Crucifix'\n ],\n clothes: [\n 'Hat [lady\u2019s/man\u2019s] [fine/plain]',\n 'Boots [new/muddy/decorative]',\n 'Dress [fancy/torn/bloodied]',\n 'Shirt [fancy/bloodstained/torn]',\n 'Gun belt',\n 'Earrings [plain/bejeweled]'\n ],\n consumables: [\n 'Bottle of whisky',\n 'Jerky',\n 'Tobacco pouch and rolling papers',\n 'Canned peaches',\n 'Sweet buns',\n 'Wine bottle'\n ],\n papers: [\n 'Newspaper [local/nearby /far]',\n 'Deed to mines',\n 'Arrest warrant',\n 'Letter [incriminating/sentimental]',\n 'Dime novel',\n 'Daguerrotype'\n ],\n other: [\n 'Dice [loaded]',\n 'Playing cards [fresh/used]',\n 'Keys to [house/business/lockbox/jail]',\n 'Hammer [nails]',\n 'Pipe and matches',\n 'Lantern'\n ]\n }\n },\n {\n id: 9,\n key: 'town_landscape',\n title: 'Landscape Prominent Feature',\n tables: {\n default: [\n 'Town build on the banks of a winding stream crossed by makeshift bridges.',\n 'Town build upon rocky outcrops, street(s) wind back and forth, buildings are all at different levels.',\n 'Town grew around a single giant tree, the rest of the land is flat and barren.',\n 'Town sits in a narrow valley, overlooked by ridges, main road snakes down to town and then back up and out.',\n 'Town built at foot of cliff where the first mine was found.',\n 'Town expanded from a small waterfall and pool amongst tall evergreens.'\n ]\n }\n },\n {\n id: 11,\n key: 'dressing',\n title: 'Set Dressing',\n display_opt: [\n { table: 'outside', hide_table: true },\n { table: 'inside', hide_table: true }\n ],\n tables: {\n outside: [\n 'Balconies',\n 'Boardwalks',\n 'Hitching posts',\n 'Water troughs',\n 'Fences',\n 'Barrels',\n 'Mud Puddles',\n 'Hand scrawled signs',\n 'Water wagon',\n 'Log bridges',\n 'Water wheels',\n 'Framed out buildings',\n 'Tents',\n 'Horses and Wagons',\n 'Posters (Wanted, Ads, Broadsheets)'\n ],\n inside: [\n 'Piano',\n 'Billiard table',\n 'Dart board',\n 'Music box',\n 'Spittoons',\n 'Bed pans',\n 'Paintings [landscape/pretty woman/historical figure]',\n 'Mismatched chairs',\n 'Makeshift tables',\n 'Ladders',\n 'Heavy curtains',\n 'Wash tubs',\n 'Valise filled with dresses',\n 'Old Clock',\n 'Brightly upholstered chair/couch',\n 'Crystal decanter filled with whiskey'\n ]\n }\n },\n {\n id: 1,\n key: 'locations',\n title: 'Locations Outside of Town',\n tables: {\n default: [\n 'Train [in motion/broken down/stopped by blocked tracks]',\n 'Family Farm [abandoned/prospering/failing]',\n 'Cattle Ranch',\n 'Mine [abandoned/active]',\n 'Grazing land [disputed]',\n 'River [rapids]',\n 'Rocky hills',\n 'Deep woods',\n 'Religious camp',\n 'Bandit camp',\n 'Log cabin [abandoned/hideout/hermit]'\n ]\n }\n },\n {\n id: 2,\n key: 'resources',\n title: 'Settlement Resources',\n tables: {\n default: [\n 'Gold',\n 'Lumber',\n 'Farmland',\n 'Water',\n 'Railway',\n 'Furs/Game'\n ]\n }\n },\n {\n id: 12,\n key: 'town_name',\n title: 'Town Names',\n display_opt: [\n { table: 'main', hide_table: true },\n { table: 'ending1', hide_table: true },\n { table: 'ending2', hide_table: true }\n ],\n tables: {\n default: [\n { label: '{{table:this:main}}{{table:this:ending1}}', weight: 4 },\n { label: '{{table:this:main}} {{table:this:ending2}}', weight: 4 },\n { label: 'Fort {{table:this:main}}', weight: 1 }\n ],\n main: [\n 'Hadley',\n 'Smith',\n 'Adams',\n 'Snake',\n 'Elk',\n 'Fire',\n 'Coal',\n 'Oak',\n 'Maple',\n 'Elm',\n 'Wilder',\n 'Jackson',\n 'Washington',\n 'Revere',\n 'Franklin',\n 'Shallow',\n 'Rapid',\n 'Gold',\n 'Summer',\n 'Spring',\n 'Nugget',\n 'Mary'\n ],\n ending1: [\n 'ville',\n 'town',\n 'berg',\n 'woods'\n ],\n ending2: [\n 'Hollow',\n 'Hills',\n 'City',\n 'Falls',\n 'Rapids'\n ]\n }\n }\n];\n", "export default [\n {\n key: 'western',\n label: 'Western',\n male: [\n 'Alan',\n 'Conan',\n 'Daveth',\n 'Denzel',\n 'Derrick',\n 'Hammitt',\n 'Jermyn',\n 'Jory',\n 'Merryn',\n 'Pasco',\n 'Tomas',\n 'Trelawney',\n 'Tremayne',\n 'Tristan',\n 'Abel',\n 'Abraham',\n 'Adam',\n 'Alan',\n 'Albert',\n 'Alex',\n 'Alexandre',\n 'Alfred',\n 'Alphonse',\n 'Anatole',\n 'Andr\u00E9',\n 'Anselme',\n 'Armand',\n 'Arthur',\n 'Auguste',\n 'Barnabus',\n 'Benjamin',\n 'Bernard',\n 'Bertrand',\n 'Blaise',\n 'Brice',\n 'Bruno',\n 'C\u00E9sar',\n 'Charles',\n 'Christian',\n 'Christophe',\n 'Claude',\n 'Cyril',\n 'Damien',\n 'Dan',\n 'Daniel',\n 'David',\n 'Denis',\n 'Didier',\n 'Dorian',\n 'Edgar',\n '\u00C9mile',\n 'Emmanuel',\n 'Ernest',\n 'Ethan',\n '\u00C9tienne',\n 'Eug\u00E8ne',\n 'Fabien',\n 'F\u00E9lix',\n 'Ferdinand',\n 'Florent',\n 'Francis',\n 'Frank',\n 'Fred',\n 'Gabriel',\n 'Gaspard',\n 'Geoffrey',\n 'Georges',\n 'G\u00E9rard',\n 'Gilbert',\n 'Guillaume',\n 'Gustave',\n 'Guy',\n 'Hector',\n 'Hercule',\n 'Horace',\n 'Jason',\n 'Jean',\n 'J\u00E9r\u00E9mie',\n 'J\u00E9r\u00F4me',\n 'Jess\u00E9',\n 'Jonathan',\n 'Joseph',\n 'Jules',\n 'Kevin',\n 'Laurent',\n 'L\u00E9o',\n 'L\u00E9on',\n 'L\u00E9onard',\n 'Lionel',\n 'Lou',\n 'Louis',\n 'Lucas',\n 'Manuel',\n 'Marc',\n 'Marcel',\n 'Martin',\n 'Maurice',\n 'Maxime',\n 'Micha\u00EBl',\n 'Morgan',\n 'Nathan',\n 'Nicolas',\n 'Odilon',\n 'Oscar',\n 'Pascal',\n 'Patrick',\n 'Paul',\n 'Philippe',\n 'Pierre',\n 'Raoul',\n 'Rapha\u00EBl',\n 'Raymond',\n 'R\u00E9gis',\n 'Richard',\n 'Robert',\n 'Roger',\n 'Roland',\n 'Ruben',\n 'Samson',\n 'Samuel',\n 'S\u00E9bastien',\n 'Serge',\n 'Simon',\n 'Th\u00E9o',\n 'Th\u00E9odore',\n 'Th\u00E9ophile',\n 'Thomas',\n 'Tristan',\n 'Ulysse',\n 'Valentin',\n 'Victor',\n 'Vincent',\n 'Xavier',\n 'Yves',\n 'Abe',\n 'Abraham',\n 'Adam',\n 'Albert',\n 'Alex',\n 'Alexander',\n 'Alfred',\n 'Aloysius',\n 'Andreas',\n 'Anton',\n 'Arthur',\n 'Augustus',\n 'Bart',\n 'Ben',\n 'Benjamin',\n 'Bernhard',\n 'Bert',\n 'Bob',\n 'Bram',\n 'Brecht',\n 'Casper',\n 'Chris',\n 'Christiaan',\n 'Cornelius',\n 'Damian',\n 'Dani\u00EBl',\n 'David',\n 'Dennis',\n 'Dick',\n 'Dirk',\n 'Ed',\n 'Edwin',\n 'Erik',\n 'Ernst',\n 'Erwin',\n 'Fabian',\n 'Felix',\n 'Ferdinand',\n 'Filip',\n 'Frank',\n 'Fred',\n 'Frederik',\n 'Gerard',\n 'Gerhard',\n 'Gerrit',\n 'Gerry',\n 'Gilbert',\n 'Gustaaf',\n 'Hans',\n 'Hendrik',\n 'Herman',\n 'Hieronymus',\n 'Hubert',\n 'Hugo',\n 'Jacob',\n 'Jan',\n 'Jasper',\n 'Jef',\n 'Jesse',\n 'Jonas',\n 'Jonathan',\n 'Jordan',\n 'Karel',\n 'Kasper',\n 'Kevin',\n 'Lambert',\n 'Lars',\n 'Leo',\n 'Leonard',\n 'Leopold',\n 'Levi',\n 'Louis',\n 'Lucas',\n 'Marcel',\n 'Marco',\n 'Mark',\n 'Martin',\n 'Max',\n 'Michael',\n 'Mick',\n 'Nick',\n 'Nico',\n 'Olaf',\n 'Oliver',\n 'Otto',\n 'Pascal',\n 'Paul',\n 'Peter',\n 'Philip',\n 'Rembrandt',\n 'Richard',\n 'Rob',\n 'Robert',\n 'Robin',\n 'Roy',\n 'Ruben',\n 'Rudolf',\n 'Rupert',\n 'Rutger',\n 'Sebastian',\n 'Simon',\n 'Stefan',\n 'Steven',\n 'Sven',\n 'Theo',\n 'Thomas',\n 'Tim',\n 'Tom',\n 'Vincent',\n 'Werner',\n 'Willem',\n 'Willy',\n 'Xander',\n 'Adam',\n 'Adolf',\n 'Arnold',\n 'Bern',\n 'Baldwin',\n 'Conrad',\n 'Constantin',\n 'Egmund',\n 'Eric',\n 'Finn',\n 'Franco',\n 'Gerald',\n 'Gregorio',\n 'Gunther',\n 'Henryk',\n 'Herman',\n 'Hubert',\n 'Isaac',\n 'Johannes',\n 'Knut',\n 'Norbert',\n 'Otto',\n 'Rainer',\n 'Richard',\n 'Rupert',\n 'Rutger',\n 'Simon',\n 'Stefan',\n 'Waldo',\n 'Walther',\n 'Willem',\n 'akira',\n 'goro',\n 'haruki',\n 'ichiro',\n 'jiro',\n 'ken',\n 'ren',\n 'shin',\n 'shiro',\n 'takashi',\n 'Aar\u00F3n',\n 'Abel',\n 'Alberto',\n 'Albino',\n 'Alcides',\n 'Alejandro',\n 'Alejo',\n '\u00C1lex',\n 'Alexis',\n 'Alfonso',\n 'Alfredo',\n 'Alonso',\n '\u00C1lvaro',\n 'Amado',\n 'Amador',\n 'Anastacio',\n 'Andr\u00E9s',\n '\u00C1ngel',\n 'Armando',\n 'Arsenio',\n 'Arturo',\n 'Baldo',\n 'Bartolom\u00E9',\n 'Bautista',\n 'Benito',\n 'Benjam\u00EDn',\n 'Bernardo',\n 'Berto',\n 'Bol\u00EDvar',\n 'Bonifacio',\n 'Bruno',\n 'Buenaventura',\n 'Carlito',\n 'Carlos',\n 'Carmelo',\n 'C\u00E9sar',\n 'Che',\n 'Chuy',\n 'Clemente',\n 'Crist\u00F3bal',\n 'Dar\u00EDo',\n 'Diego',\n 'Domingo',\n 'Edgardo',\n 'Eduardo',\n 'Eladio',\n 'El\u00EDas',\n 'Emiliano',\n 'Emilio',\n 'Enrique',\n 'Esteban',\n 'Evaristo',\n 'Fabio',\n 'Fabricio',\n 'Faustino',\n 'Feliciano',\n 'Felipe',\n 'F\u00E9lix',\n 'Fernando',\n 'Fidel',\n 'Flavio',\n 'Flori\u00E1n',\n 'Francisco',\n 'Gabriel',\n 'Gast\u00F3n',\n 'Geraldo',\n 'Gerardo',\n 'Gonzalo',\n 'Guadalupe',\n 'Guillermo',\n 'Gustavo',\n 'Gutierre',\n 'H\u00E9ctor',\n 'Hern\u00E1n',\n 'Hernando',\n 'Hugo',\n 'Ignacio',\n 'Isaac',\n 'Isidoro',\n 'Jaime',\n 'Javier',\n 'Jes\u00FAs',\n 'Joaquin',\n 'Joel',\n 'Jorge',\n 'Jose',\n 'Jos\u00E9 Antonio',\n 'Jos\u00E9 Luis',\n 'Jos\u00E9 Manuel',\n 'Juan',\n 'Juan Carlos',\n 'Juan Manuel',\n 'Juan Pablo',\n 'Julio',\n 'Leonardo',\n 'Lorenzo',\n 'Luciano',\n 'Lucio',\n 'Luis',\n 'Lupe',\n 'Manolo',\n 'Manuel',\n 'Marco',\n 'Mariano',\n 'Mario',\n 'Mateo',\n 'Miguel',\n 'Nacho',\n 'N\u00E9stor',\n 'Octavio',\n '\u00D3scar',\n 'Pablo',\n 'Paco',\n 'Pancho',\n 'Pedro',\n 'Pepe',\n 'Pl\u00E1cido',\n 'Rafael',\n 'Ram\u00F3n',\n 'Ra\u00FAl',\n 'Reynaldo',\n 'Ricardo',\n 'Roberto',\n 'Rodrigo',\n 'Salvador',\n 'Samuel',\n 'Sancho',\n 'Santos',\n 'Sergio',\n 'Severino',\n 'Silvio',\n 'Sim\u00F3n',\n 'Tito',\n 'Tom\u00E1s',\n 'Valent\u00EDn',\n 'Vicente',\n 'V\u00EDctor',\n 'Wilfredo'\n ],\n female: [\n 'Adela',\n 'Agatha',\n 'Agnes',\n 'Ava',\n 'Benedicta',\n 'Berta',\n 'Gertrude',\n 'Helena',\n 'Olge',\n 'Sophia',\n 'Susanne',\n 'Yolande',\n 'Agnes',\n 'Albertina',\n 'Alexandra',\n 'Amanda',\n 'Amber',\n 'Amelia',\n 'Angela',\n 'Angelina',\n 'Angelique',\n 'Anita',\n 'Anna',\n 'Annabel',\n 'Anne',\n 'Annemarie',\n 'Antonia',\n 'Augusta',\n 'Beatrix',\n 'Brigitta',\n 'Carla',\n 'Caroline',\n 'Catharina',\n 'Cecilia',\n 'Charlotte',\n 'Christina',\n 'Christine',\n 'Claudia',\n 'C\u00E9cile',\n 'Daphne',\n 'Debora',\n 'Denise',\n 'Diana',\n 'Dora',\n 'Dorothea',\n 'Edith',\n 'Elisabeth',\n 'Elise',\n 'Ellen',\n 'Emma',\n 'Esther',\n 'Eva',\n 'Eveline',\n 'Felicia',\n 'Georgina',\n 'Gertie',\n 'Gertrude',\n 'Hanna',\n 'Hannah',\n 'Helena',\n 'Henrietta',\n 'Henriette',\n 'Hilda',\n 'Hilde',\n 'Ida',\n 'Irena',\n 'Iris',\n 'Isabella',\n 'Isabelle',\n 'Jetta',\n 'Johanna',\n 'Julia',\n 'Juliana',\n 'Justine',\n 'Karen',\n 'Katrina',\n 'Lara',\n 'Laura',\n 'Laurie',\n 'Linda',\n 'Lisa',\n 'Louisa',\n 'Louise',\n 'Magda',\n 'Magdalena',\n 'Maria',\n 'Marianne',\n 'Marilou',\n 'Maud',\n 'Melissa',\n 'Mia',\n 'Michelle',\n 'Mina',\n 'Nicole',\n 'Nicolet',\n 'Nora',\n 'Paula',\n 'Petra',\n 'Rachel',\n 'Rebekka',\n 'Renate',\n 'Ren\u00E9e',\n 'Rosa',\n 'Rosanne',\n 'Samantha',\n 'Sandra',\n 'Sara',\n 'Saskia',\n 'Sophie',\n 'Susanna',\n 'Tina',\n 'Trudy',\n 'Ursula',\n 'Vanessa',\n 'Vera',\n 'Willemina',\n 'Wilma',\n 'Yvonne',\n 'Zo\u00EB',\n 'Eva',\n 'Jenna',\n 'Gwen',\n 'Gwenneth',\n 'Gwynne',\n 'Jena',\n 'Kerra',\n 'Lowenna',\n 'Merryn',\n 'Pasca',\n 'Tamsin',\n 'Tressa',\n 'Ad\u00E9la\u00EFde',\n 'Adeline',\n 'Agn\u00E8s',\n 'Alberte',\n 'Albertine',\n 'Alex',\n 'Alexandra',\n 'Alexandrine',\n 'Alexis',\n 'Alice',\n 'Alix',\n 'Ana\u00EFs',\n 'Anastasie',\n 'Angeline',\n 'Ang\u00E9lique',\n 'Anna',\n 'Annabelle',\n 'Anne',\n 'Annette',\n 'Annie',\n 'Antoinette',\n 'Ariel',\n 'Astrid',\n 'Augustine',\n 'Aurore',\n 'Babette',\n 'Barbara',\n 'B\u00E9atrice',\n 'B\u00E9r\u00E9nice',\n 'Bernadette',\n 'Berthe',\n 'Blanche',\n 'Brigitte',\n 'Camille',\n 'Caroline',\n 'Cassandra',\n 'Catherine',\n 'C\u00E9cile',\n 'C\u00E9leste',\n 'Charlotte',\n 'Chlo\u00E9',\n 'Christine',\n 'Claire',\n 'Clarisse',\n 'Claudette',\n 'Cl\u00E9mentine',\n 'Colette',\n 'Constance',\n 'Danielle',\n 'Daphn\u00E9',\n 'Daphn\u00E9e',\n 'Denise',\n 'Diane',\n 'Dominique',\n '\u00C9dith',\n 'El\u00E9onore',\n '\u00C9lisabeth',\n '\u00C9lo\u00EFse',\n 'Emma',\n 'Emmanuelle',\n 'Ernestine',\n 'Estelle',\n 'Esther',\n '\u00C8ve',\n 'Eveline',\n 'Fanny',\n 'F\u00E9licit\u00E9',\n 'Fifi',\n 'Florence',\n 'Florentine',\n 'Francine',\n 'Francis',\n 'Gabrielle',\n 'Genevi\u00E8ve',\n 'Georgette',\n 'Georgine',\n 'Gigi',\n 'Gilberte',\n 'Gwendoline',\n 'Hannah',\n 'Henriette',\n 'Hortense',\n 'Ir\u00E8ne',\n 'Iris',\n 'Isabelle',\n 'Jacqueline',\n 'Jeanette',\n 'Jeanine',\n 'Jessica',\n 'Joanne',\n 'Jos\u00E9phine',\n 'Judith',\n 'Juliane',\n 'Julie',\n 'Juliette',\n 'Justine',\n 'Lili',\n 'Lilian',\n 'Linda',\n 'Louise',\n 'Lucille',\n 'Madeleine',\n 'Margot',\n 'Marianne',\n 'Marie',\n 'Marilou',\n 'Marthe',\n 'M\u00E9lissa',\n 'M\u00E9lody',\n 'Michelle',\n 'Modeste',\n 'Monique',\n 'Muriel',\n 'Nadine',\n 'Nathalie',\n 'Nicole',\n 'Nina',\n 'Pauline',\n 'P\u00E9n\u00E9lope',\n 'Rachel',\n 'R\u00E9becca',\n 'Ren\u00E9e',\n 'Rosalie',\n 'Rose',\n 'Rosette',\n 'Roxanne',\n 'Sandra',\n 'Sara',\n 'Sarah',\n 'Sophie',\n 'St\u00E9phanie',\n 'Suzanne',\n 'Suzette',\n 'Sylvie',\n 'Valentine',\n 'Violette',\n 'Virginie',\n 'Wanda',\n 'akemi',\n 'aki',\n 'akiko',\n 'akira',\n 'aya',\n 'chiyo',\n 'hana',\n 'hanako',\n 'haruka',\n 'hitomi',\n 'kasumi',\n 'keiko',\n 'mai',\n 'mariko',\n 'michiko',\n 'mitsuko',\n 'nana',\n 'naomi',\n 'natsumi',\n 'noriko',\n 'ren',\n 'rina',\n 'sakura',\n 'setsuko',\n 'yoko',\n 'Abiga\u00EDl',\n 'Adelaida',\n 'Adriana',\n 'Alexandra',\n 'Alexis',\n 'Alicia',\n 'Alma',\n 'Amada',\n 'Amanda',\n 'Am\u00E9rica',\n 'Ana',\n 'Anabel',\n 'Ana Mar\u00EDa',\n 'Ana Sof\u00EDa',\n 'Anastasia',\n 'Andrea',\n '\u00C1ngela',\n 'Ang\u00E9lica',\n 'Angelina',\n 'Anita',\n 'Ariel',\n 'Aurelia',\n 'Beatriz',\n 'Berta',\n 'Blanca',\n 'Camila',\n 'Carla',\n 'Carmen',\n 'Carolina',\n 'Clara',\n 'Clementina',\n 'Conchita',\n 'Consuela',\n 'Cristina',\n 'Dalia',\n 'Delia',\n 'Diana',\n 'Dolores',\n 'Dominga',\n 'Dora',\n 'Dulce',\n 'Elena',\n 'Elisa',\n 'Elodia',\n 'Elo\u00EDsa',\n 'Emilia',\n 'Emma',\n 'Encarnita',\n 'Esmeralda',\n 'Esperanza',\n 'Esther',\n 'Eulalia',\n 'Eva',\n 'Eva Mar\u00EDa',\n 'Evangelina',\n 'Evita',\n 'Fanny',\n 'F\u00E1tima',\n 'Felicia',\n 'Felipa',\n 'Flora',\n 'Florentina',\n 'Fran',\n 'Francisca',\n 'Gabriela',\n 'Georgina',\n 'Gertrudis',\n 'Gisela',\n 'Gloria',\n 'Guadalupe',\n 'Hayd\u00E9e',\n 'Hilda',\n 'In\u00E9s',\n 'Irene',\n 'Iris',\n 'Irma',\n 'Isabela',\n 'Isidora',\n 'Jenifer',\n 'Jennifer',\n 'Jenny',\n 'Jessica',\n 'Johana',\n 'Josefina',\n 'Juanita',\n 'Judith',\n 'Julia',\n 'Julieta',\n 'Justina',\n 'Laura',\n 'Leandra',\n 'Leticia',\n 'Liliana',\n 'Lola',\n 'Lolita',\n 'Luna',\n 'Lupe',\n 'Magdalena',\n 'Marcela',\n 'Marcia',\n 'Margarita',\n 'Mar\u00EDa',\n 'Mar\u00EDa Carmen',\n 'Mar\u00EDa Cristina',\n 'Mar\u00EDa Dolores',\n 'Mar\u00EDa Fernanda',\n 'Mar\u00EDa Guadalupe',\n 'Mar\u00EDa Jes\u00FAs',\n 'Mar\u00EDa Jos\u00E9',\n 'Mar\u00EDa Luisa',\n 'Mar\u00EDa Manuela',\n 'Mariana',\n 'Mar\u00EDa Teresa',\n 'Marisa',\n 'Maritza',\n 'Marta',\n 'Matilde',\n 'Mercedes',\n 'Miriam',\n 'Modesta',\n 'M\u00F3nica',\n 'Nadia',\n 'Natalia',\n 'Octavia',\n 'Ofelia',\n 'Olga',\n 'Olivia',\n 'Oriana',\n 'Paloma',\n 'Paola',\n 'Patricia',\n 'Paula',\n 'Paulina',\n 'Paz',\n 'Perla',\n 'Perlita',\n 'Pilar',\n 'Priscila',\n 'Ramona',\n 'Raquel',\n 'Regina',\n 'Remedios',\n 'Renata',\n 'Rita',\n 'Roberta',\n 'Rosa',\n 'Rosario',\n 'Ruth',\n 'Sandra',\n 'Sara',\n 'Selena',\n 'Silvia',\n 'Sof\u00EDa',\n 'Soledad',\n 'Susana',\n 'Tamara',\n 'Teresa',\n '\u00DArsula',\n 'Valentina',\n 'Valeria',\n 'Vera',\n 'Ver\u00F3nica',\n 'Victoria',\n 'Violeta',\n 'Virginia',\n 'Viviana',\n 'Yasmina',\n 'Yolanda'\n ],\n surname: [\n 'Ahearn',\n 'Bell',\n 'Berryman',\n 'Boden',\n 'Bray',\n 'Brock',\n 'Burrows',\n 'Connor',\n 'Craddick',\n 'Crocker',\n 'Deane',\n 'Drew',\n 'Evans',\n 'Fry',\n 'Gay',\n 'Godden',\n 'Goldsworthy',\n 'Hancock',\n 'Hart',\n 'Harvey',\n 'Hawke',\n 'Hoskins',\n 'Hutchens',\n 'James',\n 'Jewell',\n 'Johns',\n 'Kemp',\n 'Kent',\n 'Kinsey',\n 'Kirby',\n 'Lowry',\n 'Lean',\n 'Lyon',\n 'May',\n 'Moon',\n 'Nance',\n 'Nicholls',\n 'Oates',\n 'Pawley',\n 'Perrin',\n 'Phillips',\n 'Quick',\n 'Rickard',\n 'Roach',\n 'Roberts',\n 'Rodgers',\n 'Sanders',\n 'Symons',\n 'Stevens',\n 'Thorne',\n 'Warren',\n 'Franke',\n 'Peeters',\n 'Aaldenberg',\n 'Aalders',\n 'Abram',\n 'Abrams',\n 'Acker',\n 'Addens',\n 'Adema',\n 'Ahlers',\n 'Akkerman',\n 'Alberda',\n 'Alberdink',\n 'Albers',\n 'Alberts',\n 'Alders',\n 'Alting',\n 'Arntz',\n 'Baker',\n 'Banner',\n 'Beringer',\n 'Beulens',\n 'Boer',\n 'Boon',\n 'Bosch',\n 'Brams',\n 'Brinkerhoff',\n 'Carman',\n 'Clark',\n 'Cuyper',\n 'Dahl',\n 'Dahlman',\n 'De Witte',\n 'Dirks',\n 'Dreyer',\n 'Dykstra',\n 'Evers',\n 'Franke',\n 'Haas',\n 'Hansen',\n 'Hendrix',\n 'Herberts',\n 'Herman',\n 'Heyman',\n 'Holt',\n 'Hummel',\n 'Jacobs',\n 'Jacobson',\n 'Jansen',\n 'Jansing',\n 'Karl',\n 'King',\n 'Klein',\n 'Koning',\n 'Krantz',\n 'Lucas',\n 'Lyon',\n 'Michel',\n 'Miller',\n 'Moore',\n 'Nagel',\n 'Peeters',\n 'Peters',\n 'Philips',\n 'Richard',\n 'Robert',\n 'Roosevelt',\n 'Samson',\n 'Schneider',\n 'Schuyler',\n 'Schwarzenberg',\n 'Seeger',\n 'Smith',\n 'Snyder',\n 'Thomas',\n 'Van Aalsburg',\n 'Van Buren',\n 'Van Der Beek',\n 'Van Der Veen',\n 'Van Hassel',\n 'Van Horn',\n 'Van Houte',\n 'fujimoto',\n 'hayashi',\n 'kimura',\n 'kurosawa',\n 'matsumoto',\n 'minami',\n 'suzuki',\n 'yamaguchi',\n 'Babineaux',\n 'Barre',\n 'Beaufort',\n 'Beaumont',\n 'Bellamy',\n 'Belmont',\n 'Berger',\n 'Bernard',\n 'Blanchard',\n 'Bonhomme',\n 'Borde',\n 'Charpentier',\n 'Chevalier',\n 'Colbert',\n 'Coste',\n 'David',\n 'Deforest',\n 'Delacroix',\n 'Desroches',\n 'Dubois',\n 'Duchamps',\n 'Dupont',\n 'Fabian',\n 'Favreau',\n 'Fontaine',\n 'Forest',\n 'Forestier',\n 'Fran\u00E7ois',\n 'Garcon',\n 'Germain',\n 'Giles',\n 'Granger',\n 'Hardy',\n 'Harman',\n 'Herbert',\n 'Jordan',\n 'Labelle',\n 'Lachance',\n 'Lachapelle',\n 'Lane',\n 'Lapointe',\n 'Larue',\n 'Laurent',\n 'Lebeau',\n 'Leblanc',\n 'Leclair',\n 'Leroy',\n 'Lyon',\n 'Marchand',\n 'Martel',\n 'Martin',\n 'Montagne',\n 'Mullins',\n 'Olivier',\n 'Page',\n 'Pettigrew',\n 'Pierre',\n 'Renaud',\n 'Robert',\n 'Roche',\n 'Rose',\n 'Roy',\n 'Salmon',\n 'Samson',\n 'Sargent',\n 'Sauvage',\n 'Segal',\n 'S\u00E9verin',\n 'Simon',\n 'Thayer',\n 'Thomas',\n 'Tolbert',\n 'Travers',\n 'Tremblay',\n 'Vincent',\n 'Abel',\n 'Abraham',\n 'Acosta',\n 'Aguilar',\n 'Alfaro',\n 'Alonso',\n 'Alvarado',\n '\u00C1lvarez',\n 'Amador',\n 'Antonio',\n 'Ant\u00FAnez',\n 'Armando',\n 'Arriola',\n 'Asturias',\n 'Banderas',\n 'Bautista',\n 'Bello',\n 'Belmonte',\n 'Blanco',\n 'Bol\u00EDvar',\n 'Bustos',\n 'Caballero',\n 'Cabrera',\n 'Campo',\n 'Campos',\n 'Carrasco',\n 'Castellano',\n 'Castilla',\n 'Castillo',\n 'Castro',\n 'Cervantes',\n 'Col\u00F3n',\n 'Cortez',\n 'Cruz',\n 'De la Cruz',\n 'De Le\u00F3n',\n 'Delgado',\n 'Del R\u00EDo',\n 'D\u00EDaz',\n 'Dom\u00EDnguez',\n 'Escarr\u00E0',\n 'Espinosa',\n 'Espinoza',\n 'Esteban',\n 'Est\u00E9vez',\n 'Feliciano',\n 'Fern\u00E1ndez',\n 'Fierro',\n 'Figueroa',\n 'Flores',\n 'Fontana',\n 'Franco',\n 'Fuentes',\n 'Garc\u00EDa',\n 'Gaspar',\n 'Gim\u00E9nez',\n 'G\u00F3mez',\n 'Gonzales',\n 'Gonz\u00E1lez',\n 'Guti\u00E9rrez',\n 'Hern\u00E1ndez',\n 'Herrera',\n 'Hidalgo',\n 'Ibarra',\n 'Ju\u00E1rez',\n 'Le\u00F3n',\n 'Lopez',\n 'Lorenzo',\n 'Loyola',\n 'Lucas',\n 'Luna',\n 'Machado',\n 'Marino',\n 'M\u00E1rquez',\n 'Mart\u00EDn',\n 'Mart\u00EDnez',\n 'Martinez',\n 'M\u00E9ndez',\n 'Mendoza',\n 'Molina',\n 'Montero',\n 'Morales',\n 'Moralez',\n 'Mu\u00F1oz',\n 'Navarro',\n 'Olmos',\n 'Ortega',\n 'Padilla',\n 'Paz',\n 'P\u00E9rez',\n 'Perez',\n 'Quesada',\n 'Ram\u00EDrez',\n 'Ramos',\n 'Reyes',\n 'R\u00EDos',\n 'Rivera',\n 'Rodr\u00EDguez',\n 'Rodriquez',\n 'Romero',\n 'Rosales',\n 'Rosario',\n 'Rubio',\n 'Ruiz',\n 'Salamanca',\n 'Salinas',\n 'S\u00E1nchez',\n 'Sanchez',\n 'Santana',\n 'Santiago',\n 'Santos',\n 'Sierra',\n 'Silva',\n 'Torres',\n 'Valencia',\n 'Vega',\n 'Vel\u00E1squez',\n 'Vidal'\n ]\n }\n];\n", "/**\n * @prop {Object} events Store the events here.\n * @prop {Boolean} debug So you can more easily in dev see when events are triggered.\n */\nexport default class EventEmitter {\n constructor () {\n this.events = {};\n this.debug = false;\n }\n /**\n * Get index of listener in the event array.\n * -1 means it isn't there\n * @param {String} event Event to check.\n * @param {Function} listener Listener to check.\n * @return {Number}\n */\n listenerIndex (event, listener) {\n return this.events[event].findIndex((item) => {\n return item.listener === listener;\n });\n }\n /**\n * Listen to an event\n * @param {String} event Name of the event to listen for.\n * @param {Function|Array} listener Callback to trigger for event OR an array of [classname, methodName]\n * @param {Object} boundObj Object to bind the callback to.\n * @return {undefined}\n */\n on (event, listener, boundObj = null) {\n if (typeof listener !== 'function') {\n return;\n }\n this.events[event] = this.events[event] || [];\n if (this.events[event].length > 0) {\n const index = this.listenerIndex(event, listener);\n // Replace the listener if it already exists.\n if (index > -1) {\n this.events[event].splice(index, 1);\n }\n }\n this.events[event].push({ listener: listener, boundObj: boundObj });\n }\n /**\n * Stop listening to an event.\n * Remove event if it was the last listener.\n * @param {String} event Name of the event.\n * @param {Function} listener Callback to remove.\n * @return {undefined}\n */\n off (event, listener) {\n if (Array.isArray(this.events[event])) {\n const index = this.listenerIndex(event, listener);\n if (index === -1) {\n return;\n }\n this.events[event].splice(index, 1);\n if (this.events[event].length === 0) {\n delete this.events[event];\n }\n }\n }\n /**\n * Listen for an event but only trigger it once, then it is removed.\n * @param {String} event Name of the event to listen for.\n * @param {Function} listener Callback to trigger for event.\n * @param {Object} boundObj Object to bind the callback to.\n */\n once (event, listener, boundObj) {\n this.on(event, function wrap () {\n this.off(event, wrap);\n const binder = typeof boundObj === 'undefined' ? this : boundObj;\n listener.apply(binder, arguments);\n });\n }\n /**\n * Trigger an event. This will cause any listeners for that event to be called.\n * Any arguments after the event will be passed on to the callback(s).\n * @param {String} event Event to trigger.\n */\n trigger (event) {\n if (this.debug && console) {\n console.log(`EventEmitter triggered: ${event}`);\n }\n const args = [].slice.call(arguments, 1);\n\n if (Array.isArray(this.events[event])) {\n this.events[event].forEach((listenObj) => {\n const binder = listenObj.boundObj === null ? this : listenObj.boundObj;\n listenObj.listener.apply(binder, args);\n });\n }\n };\n};\n", "import TableRoller from '../../node_modules/rpg-table-randomizer/src/TableRoller.js';\nimport RandomTable from '../../node_modules/rpg-table-randomizer/src/RandomTable.js';\nimport RandomNameGenerator from '../../node_modules/rpg-table-randomizer/src/RandomNameGenerator.js';\nimport RandomNameType from '../../node_modules/rpg-table-randomizer/src/RandomNameType.js';\nimport tables from '../data/tables.js';\nimport names from '../data/names.js';\nimport { rollDie } from '../../node_modules/rpg-table-randomizer/src/dice_roller.js';\nimport EventEmitter from '../models/EventEmitter.js';\n\nconst tableEmitter = new EventEmitter();\nconst tableRoller = new TableRoller({});\nconst randomTables = {};\n\n// Format name data\nconst nameTypes = [];\nnames.forEach((data) => {\n nameTypes.push(new RandomNameType(data));\n});\n// Create a default name generator.\nconst nameGenerator = new RandomNameGenerator({ namedata: nameTypes });\n// Assign it to the name token of the table roller.\ntableRoller.registerTokenType('name', nameGenerator.nameTokenCallback.bind(nameGenerator));\n\ntables.forEach((data) => {\n const key = data.key;\n if (!key) {\n return;\n }\n randomTables[key] = new RandomTable(data);\n});\n/**\n * Get 1 table by it's key.\n * @param key {String} Table key.\n * @returns {RandomTable|null}\n */\nconst getTableByKey = function (key) {\n if (randomTables[key]) {\n return randomTables[key];\n }\n return null;\n};\ntableRoller.setTableKeyLookup(getTableByKey);\n\n/**\n * Get all tables.\n * @returns {RandomTable[]}\n */\nconst getAllTables = function () {\n const arr = [];\n Object.keys(randomTables).forEach((key) => {\n const table = randomTables[key];\n arr.push(table);\n });\n return arr;\n};\n\n/**\n * Get result for a table by its key.\n * @param key {String} table key.\n * @param {String} subtable\n * @returns {RandomTableResultSet|null}\n */\nconst getResultByTableKey = function (key, subtable = '') {\n return tableRoller.getTableResultSetByKey(key, subtable);\n};\n/**\n * Get results from a table using the whole table.\n * @param table {RandomTable}\n * @param {String} subtable\n * @returns {RandomTableResultSet|null}\n */\nconst getResultFromTable = function (table, subtable = '') {\n return tableRoller.getResultSetForTable(table, subtable);\n};\n\n/**\n * Return a name\n * @param, {String} [nameType] Name list to use.\n * @returns {String}\n */\nconst getNPCName = function (nameType) {\n return nameGenerator.selectName(nameType);\n};\n\n/**\n * Convert a token to a result string.\n * @param token RandomTable token string\n * @returns {RandomTableResultSet|RandomTableResultSet[]|DiceResult|String|Any}\n */\nconst convertToken = function (token) {\n return tableRoller.convertToken(token);\n};\n\nexport {\n getAllTables,\n getTableByKey,\n getResultByTableKey,\n getResultFromTable,\n rollDie,\n getNPCName,\n convertToken,\n tableEmitter,\n tableRoller\n};\n", "import { tableEmitter } from '../services/randomTableService.js';\n\nconst template = document.createElement('template');\ntemplate.innerHTML = `\n \n \n

Hadleyville: Rules Light RPG

\n \n
\n`;\n\nclass Header extends HTMLElement {\n constructor () {\n super();\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.appendChild(template.content.cloneNode(true));\n\n this.setAttribute('role', 'header');\n this.showTables = this.dataset.showtables === 'true';\n if (!this.showTables) {\n this.shadowRoot.querySelector('.table-toggle').hidden = true;\n }\n\n this.toggleButton = this.shadowRoot.querySelector('button');\n }\n\n connectedCallback () {\n tableEmitter.on('table:drawer', this._toggleOpenButton.bind(this));\n this.toggleButton.addEventListener('click', this._toggleDrawer.bind(this));\n }\n\n disconnectedCallback () {\n tableEmitter.off('table:drawer', this._toggleOpenButton.bind(this));\n this.toggleButton.removeEventListener('click', this._toggleDrawer.bind(this));\n }\n /**\n * Click event on the toggle button.\n * Triggers event on emitter.\n */\n _toggleDrawer () {\n const open = !this.toggleButton.classList.contains('open');\n tableEmitter.trigger('table:drawer', { open });\n }\n /**\n * Handler for the table:drawer event.\n * @param {Boolean} open\n */\n _toggleOpenButton ({ open }) {\n if (open) {\n this.toggleButton.classList.add('open');\n return;\n }\n this.toggleButton.classList.remove('open');\n }\n};\n\nwindow.customElements.define('had-header', Header);\n\nexport default Header;\n", "const template = document.createElement('template');\ntemplate.innerHTML = `\n\n\n

Written in Mar-Apr 2021 by Derik A. Badman https://derikbadman.com Game info and updates at https://madinkbeard.itch.io/hadleyville

\n`;\n\nclass Footer extends HTMLElement {\n constructor () {\n super();\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.appendChild(template.content.cloneNode(true));\n\n this.setAttribute('role', 'footer');\n }\n\n connectedCallback () {\n }\n\n disconnectedCallback () {\n\n }\n};\n\nwindow.customElements.define('had-footer', Footer);\n\nexport default Footer;\n", "var focusableSelectors = [\n 'a[href]:not([tabindex^=\"-\"])',\n 'area[href]:not([tabindex^=\"-\"])',\n 'input:not([type=\"hidden\"]):not([type=\"radio\"]):not([disabled]):not([tabindex^=\"-\"])',\n 'input[type=\"radio\"]:not([disabled]):not([tabindex^=\"-\"])',\n 'select:not([disabled]):not([tabindex^=\"-\"])',\n 'textarea:not([disabled]):not([tabindex^=\"-\"])',\n 'button:not([disabled]):not([tabindex^=\"-\"])',\n 'iframe:not([tabindex^=\"-\"])',\n 'audio[controls]:not([tabindex^=\"-\"])',\n 'video[controls]:not([tabindex^=\"-\"])',\n '[contenteditable]:not([tabindex^=\"-\"])',\n '[tabindex]:not([tabindex^=\"-\"])',\n];\n\nvar TAB_KEY = 9;\nvar ESCAPE_KEY = 27;\n\n/**\n * Define the constructor to instantiate a dialog\n *\n * @constructor\n * @param {Element} element\n */\nfunction A11yDialog(element) {\n // Prebind the functions that will be bound in addEventListener and\n // removeEventListener to avoid losing references\n this._show = this.show.bind(this);\n this._hide = this.hide.bind(this);\n this._maintainFocus = this._maintainFocus.bind(this);\n this._bindKeypress = this._bindKeypress.bind(this);\n\n this.$el = element;\n this.shown = false;\n this._id = this.$el.getAttribute('data-a11y-dialog') || this.$el.id;\n this._previouslyFocused = null;\n this._listeners = {};\n\n // Initialise everything needed for the dialog to work properly\n this.create();\n}\n\n/**\n * Set up everything necessary for the dialog to be functioning\n *\n * @param {(NodeList | Element | string)} targets\n * @return {this}\n */\nA11yDialog.prototype.create = function () {\n this.$el.setAttribute('aria-hidden', true);\n this.$el.setAttribute('aria-modal', true);\n this.$el.setAttribute('tabindex', -1);\n\n if (!this.$el.hasAttribute('role')) {\n this.$el.setAttribute('role', 'dialog');\n }\n\n // Keep a collection of dialog openers, each of which will be bound a click\n // event listener to open the dialog\n this._openers = $$('[data-a11y-dialog-show=\"' + this._id + '\"]');\n this._openers.forEach(\n function (opener) {\n opener.addEventListener('click', this._show);\n }.bind(this)\n );\n\n // Keep a collection of dialog closers, each of which will be bound a click\n // event listener to close the dialog\n this._closers = $$('[data-a11y-dialog-hide]', this.$el).concat(\n $$('[data-a11y-dialog-hide=\"' + this._id + '\"]')\n );\n this._closers.forEach(\n function (closer) {\n closer.addEventListener('click', this._hide);\n }.bind(this)\n );\n\n // Execute all callbacks registered for the `create` event\n this._fire('create');\n\n return this\n};\n\n/**\n * Show the dialog element, disable all the targets (siblings), trap the\n * current focus within it, listen for some specific key presses and fire all\n * registered callbacks for `show` event\n *\n * @param {Event} event\n * @return {this}\n */\nA11yDialog.prototype.show = function (event) {\n // If the dialog is already open, abort\n if (this.shown) {\n return this\n }\n\n // Keep a reference to the currently focused element to be able to restore\n // it later\n this._previouslyFocused = document.activeElement;\n this.$el.removeAttribute('aria-hidden');\n this.shown = true;\n\n // Set the focus to the dialog element\n moveFocusToDialog(this.$el);\n\n // Bind a focus event listener to the body element to make sure the focus\n // stays trapped inside the dialog while open, and start listening for some\n // specific key presses (TAB and ESC)\n document.body.addEventListener('focus', this._maintainFocus, true);\n document.addEventListener('keydown', this._bindKeypress);\n\n // Execute all callbacks registered for the `show` event\n this._fire('show', event);\n\n return this\n};\n\n/**\n * Hide the dialog element, enable all the targets (siblings), restore the\n * focus to the previously active element, stop listening for some specific\n * key presses and fire all registered callbacks for `hide` event\n *\n * @param {Event} event\n * @return {this}\n */\nA11yDialog.prototype.hide = function (event) {\n // If the dialog is already closed, abort\n if (!this.shown) {\n return this\n }\n\n this.shown = false;\n this.$el.setAttribute('aria-hidden', 'true');\n\n // If there was a focused element before the dialog was opened (and it has a\n // `focus` method), restore the focus back to it\n // See: https://github.com/KittyGiraudel/a11y-dialog/issues/108\n if (this._previouslyFocused && this._previouslyFocused.focus) {\n this._previouslyFocused.focus();\n }\n\n // Remove the focus event listener to the body element and stop listening\n // for specific key presses\n document.body.removeEventListener('focus', this._maintainFocus, true);\n document.removeEventListener('keydown', this._bindKeypress);\n\n // Execute all callbacks registered for the `hide` event\n this._fire('hide', event);\n\n return this\n};\n\n/**\n * Destroy the current instance (after making sure the dialog has been hidden)\n * and remove all associated listeners from dialog openers and closers\n *\n * @return {this}\n */\nA11yDialog.prototype.destroy = function () {\n // Hide the dialog to avoid destroying an open instance\n this.hide();\n\n // Remove the click event listener from all dialog openers\n this._openers.forEach(\n function (opener) {\n opener.removeEventListener('click', this._show);\n }.bind(this)\n );\n\n // Remove the click event listener from all dialog closers\n this._closers.forEach(\n function (closer) {\n closer.removeEventListener('click', this._hide);\n }.bind(this)\n );\n\n // Execute all callbacks registered for the `destroy` event\n this._fire('destroy');\n\n // Keep an object of listener types mapped to callback functions\n this._listeners = {};\n\n return this\n};\n\n/**\n * Register a new callback for the given event type\n *\n * @param {string} type\n * @param {Function} handler\n */\nA11yDialog.prototype.on = function (type, handler) {\n if (typeof this._listeners[type] === 'undefined') {\n this._listeners[type] = [];\n }\n\n this._listeners[type].push(handler);\n\n return this\n};\n\n/**\n * Unregister an existing callback for the given event type\n *\n * @param {string} type\n * @param {Function} handler\n */\nA11yDialog.prototype.off = function (type, handler) {\n var index = (this._listeners[type] || []).indexOf(handler);\n\n if (index > -1) {\n this._listeners[type].splice(index, 1);\n }\n\n return this\n};\n\n/**\n * Iterate over all registered handlers for given type and call them all with\n * the dialog element as first argument, event as second argument (if any). Also\n * dispatch a custom event on the DOM element itself to make it possible to\n * react to the lifecycle of auto-instantiated dialogs.\n *\n * @access private\n * @param {string} type\n * @param {Event} event\n */\nA11yDialog.prototype._fire = function (type, event) {\n var listeners = this._listeners[type] || [];\n var domEvent = new CustomEvent(type, { detail: event });\n\n this.$el.dispatchEvent(domEvent);\n\n listeners.forEach(\n function (listener) {\n listener(this.$el, event);\n }.bind(this)\n );\n};\n\n/**\n * Private event handler used when listening to some specific key presses\n * (namely ESCAPE and TAB)\n *\n * @access private\n * @param {Event} event\n */\nA11yDialog.prototype._bindKeypress = function (event) {\n // This is an escape hatch in case there are nested dialogs, so the keypresses\n // are only reacted to for the most recent one\n if (!this.$el.contains(document.activeElement)) return\n\n // If the dialog is shown and the ESCAPE key is being pressed, prevent any\n // further effects from the ESCAPE key and hide the dialog, unless its role\n // is 'alertdialog', which should be modal\n if (\n this.shown &&\n event.which === ESCAPE_KEY &&\n this.$el.getAttribute('role') !== 'alertdialog'\n ) {\n event.preventDefault();\n this.hide(event);\n }\n\n // If the dialog is shown and the TAB key is being pressed, make sure the\n // focus stays trapped within the dialog element\n if (this.shown && event.which === TAB_KEY) {\n trapTabKey(this.$el, event);\n }\n};\n\n/**\n * Private event handler used when making sure the focus stays within the\n * currently open dialog\n *\n * @access private\n * @param {Event} event\n */\nA11yDialog.prototype._maintainFocus = function (event) {\n // If the dialog is shown and the focus is not within a dialog element (either\n // this one or another one in case of nested dialogs) or within an element\n // with the `data-a11y-dialog-focus-trap-ignore` attribute, move it back to\n // its first focusable child.\n // See: https://github.com/KittyGiraudel/a11y-dialog/issues/177\n if (\n this.shown &&\n !event.target.closest('[aria-modal=\"true\"]') &&\n !event.target.closest('[data-a11y-dialog-ignore-focus-trap]')\n ) {\n moveFocusToDialog(this.$el);\n }\n};\n\n/**\n * Convert a NodeList into an array\n *\n * @param {NodeList} collection\n * @return {Array}\n */\nfunction toArray(collection) {\n return Array.prototype.slice.call(collection)\n}\n\n/**\n * Query the DOM for nodes matching the given selector, scoped to context (or\n * the whole document)\n *\n * @param {String} selector\n * @param {Element} [context = document]\n * @return {Array}\n */\nfunction $$(selector, context) {\n return toArray((context || document).querySelectorAll(selector))\n}\n\n/**\n * Set the focus to the first element with `autofocus` with the element or the\n * element itself\n *\n * @param {Element} node\n */\nfunction moveFocusToDialog(node) {\n var focused = node.querySelector('[autofocus]') || node;\n\n focused.focus();\n}\n\n/**\n * Get the focusable children of the given element\n *\n * @param {Element} node\n * @return {Array}\n */\nfunction getFocusableChildren(node) {\n return $$(focusableSelectors.join(','), node).filter(function (child) {\n return !!(\n child.offsetWidth ||\n child.offsetHeight ||\n child.getClientRects().length\n )\n })\n}\n\n/**\n * Trap the focus inside the given element\n *\n * @param {Element} node\n * @param {Event} event\n */\nfunction trapTabKey(node, event) {\n var focusableChildren = getFocusableChildren(node);\n var focusedItemIndex = focusableChildren.indexOf(document.activeElement);\n\n // If the SHIFT key is being pressed while tabbing (moving backwards) and\n // the currently focused item is the first one, move the focus to the last\n // focusable item from the dialog element\n if (event.shiftKey && focusedItemIndex === 0) {\n focusableChildren[focusableChildren.length - 1].focus();\n event.preventDefault();\n // If the SHIFT key is not being pressed (moving forwards) and the currently\n // focused item is the last one, move the focus to the first focusable item\n // from the dialog element\n } else if (\n !event.shiftKey &&\n focusedItemIndex === focusableChildren.length - 1\n ) {\n focusableChildren[0].focus();\n event.preventDefault();\n }\n}\n\nfunction instantiateDialogs() {\n $$('[data-a11y-dialog]').forEach(function (node) {\n new A11yDialog(node);\n });\n}\n\nif (typeof document !== 'undefined') {\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', instantiateDialogs);\n } else {\n if (window.requestAnimationFrame) {\n window.requestAnimationFrame(instantiateDialogs);\n } else {\n window.setTimeout(instantiateDialogs, 16);\n }\n }\n}\n\nexport { A11yDialog as default };\n", "import store from '../store/store.js';\nimport { createNote, updateNote, deleteNote, sortNotes, clearNotes, importNotes } from '../store/notes-reducer.js';\nimport Note from '../models/note.js';\nimport EventEmitter from '../models/EventEmitter.js';\nimport NoteDisplay from '../components/notedisplay.js';\n\n/**\n * @prop {EventEmitter}\n */\nconst emitter = new EventEmitter();\n\n/**\n * Get all notes.\n * @returns {Note[]}\n */\nconst getAll = function () {\n const notes = store.getState().notes;\n return notes.map((obj) => new Note(obj));\n};\n/**\n * Get single note.\n * @param {String} id\n * @returns {Note|null}\n */\nconst getById = function (id) {\n const notes = store.getState().notes;\n const data = notes.find((el) => el.uuid === id);\n if (data) {\n return new Note(data);\n }\n return null;\n};\n/**\n * Save a new note.\n * @param {String} mode view|edit\n * @param {Note} note\n * @returns {Note}\n */\nconst create = function (mode = 'view', note = null) {\n if (!(note instanceof Note)) {\n note = new Note({});\n }\n store.dispatch(createNote({ note: note.toJSON() }));\n emitter.trigger('note:add', {\n item: note,\n mode\n });\n return note;\n};\n\n/**\n * Update a note.\n * @param {Note} note\n */\nconst save = function (note) {\n store.dispatch(updateNote({ note: note.toJSON() }));\n emitter.trigger('note:edit', {\n item: note\n });\n};\n\nconst remove = function (uuid) {\n store.dispatch(deleteNote({ uuid }));\n emitter.trigger('note:delete', {\n id: uuid\n });\n};\n\nconst sort = function (sortUuids) {\n store.dispatch(sortNotes({ sortUuids }));\n};\n\n/**\n * Delete all the notes at once.\n */\nconst deleteAll = function () {\n store.dispatch(clearNotes());\n // probably should trigger an event here?\n};\n/**\n * Import notes.\n * @param {Note[]} notes\n */\nconst importAll = function (notes) {\n store.dispatch(importNotes({ notes }));\n notes.forEach((noteData) => {\n if (!noteData.uuid) {\n return;\n }\n const note = new Note(noteData);\n emitter.trigger('note:add', {\n item: note\n });\n });\n};\n\nconst getDisplay = function () {\n return new NoteDisplay();\n};\n\nexport {\n emitter,\n getAll,\n getById,\n create,\n save,\n sort,\n remove,\n deleteAll,\n importAll,\n getDisplay\n};\n", "const errors = {\n\t0: \"Illegal state\",\n\t1: \"Immer drafts cannot have computed properties\",\n\t2: \"This object has been frozen and should not be mutated\",\n\t3(data: any) {\n\t\treturn (\n\t\t\t\"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? \" +\n\t\t\tdata\n\t\t)\n\t},\n\t4: \"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.\",\n\t5: \"Immer forbids circular references\",\n\t6: \"The first or second argument to `produce` must be a function\",\n\t7: \"The third argument to `produce` must be a function or undefined\",\n\t8: \"First argument to `createDraft` must be a plain object, an array, or an immerable object\",\n\t9: \"First argument to `finishDraft` must be a draft returned by `createDraft`\",\n\t10: \"The given draft is already finalized\",\n\t11: \"Object.defineProperty() cannot be used on an Immer draft\",\n\t12: \"Object.setPrototypeOf() cannot be used on an Immer draft\",\n\t13: \"Immer only supports deleting array indices\",\n\t14: \"Immer only supports setting array indices and the 'length' property\",\n\t15(path: string) {\n\t\treturn \"Cannot apply patch, path doesn't resolve: \" + path\n\t},\n\t16: 'Sets cannot have \"replace\" patches.',\n\t17(op: string) {\n\t\treturn \"Unsupported patch operation: \" + op\n\t},\n\t18(plugin: string) {\n\t\treturn `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \\`enable${plugin}()\\` when initializing your application.`\n\t},\n\t20: \"Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available\",\n\t21(thing: string) {\n\t\treturn `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${thing}'`\n\t},\n\t22(thing: string) {\n\t\treturn `'current' expects a draft, got: ${thing}`\n\t},\n\t23(thing: string) {\n\t\treturn `'original' expects a draft, got: ${thing}`\n\t},\n\t24: \"Patching reserved attributes like __proto__, prototype and constructor is not allowed\"\n} as const\n\nexport function die(error: keyof typeof errors, ...args: any[]): never {\n\tif (__DEV__) {\n\t\tconst e = errors[error]\n\t\tconst msg = !e\n\t\t\t? \"unknown error nr: \" + error\n\t\t\t: typeof e === \"function\"\n\t\t\t? e.apply(null, args as any)\n\t\t\t: e\n\t\tthrow new Error(`[Immer] ${msg}`)\n\t}\n\tthrow new Error(\n\t\t`[Immer] minified error nr: ${error}${\n\t\t\targs.length ? \" \" + args.map(s => `'${s}'`).join(\",\") : \"\"\n\t\t}. Find the full error at: https://bit.ly/3cXEKWf`\n\t)\n}\n", "import {\n\tDRAFT_STATE,\n\tDRAFTABLE,\n\thasSet,\n\tObjectish,\n\tDrafted,\n\tAnyObject,\n\tAnyMap,\n\tAnySet,\n\tImmerState,\n\thasMap,\n\tArchtype,\n\tdie\n} from \"../internal\"\n\n/** Returns true if the given value is an Immer draft */\n/*#__PURE__*/\nexport function isDraft(value: any): boolean {\n\treturn !!value && !!value[DRAFT_STATE]\n}\n\n/** Returns true if the given value can be drafted by Immer */\n/*#__PURE__*/\nexport function isDraftable(value: any): boolean {\n\tif (!value) return false\n\treturn (\n\t\tisPlainObject(value) ||\n\t\tArray.isArray(value) ||\n\t\t!!value[DRAFTABLE] ||\n\t\t!!value.constructor[DRAFTABLE] ||\n\t\tisMap(value) ||\n\t\tisSet(value)\n\t)\n}\n\nconst objectCtorString = Object.prototype.constructor.toString()\n/*#__PURE__*/\nexport function isPlainObject(value: any): boolean {\n\tif (!value || typeof value !== \"object\") return false\n\tconst proto = Object.getPrototypeOf(value)\n\tif (proto === null) {\n\t\treturn true\n\t}\n\tconst Ctor =\n\t\tObject.hasOwnProperty.call(proto, \"constructor\") && proto.constructor\n\n\tif (Ctor === Object) return true\n\n\treturn (\n\t\ttypeof Ctor == \"function\" &&\n\t\tFunction.toString.call(Ctor) === objectCtorString\n\t)\n}\n\n/** Get the underlying object that is represented by the given draft */\n/*#__PURE__*/\nexport function original(value: T): T | undefined\nexport function original(value: Drafted): any {\n\tif (!isDraft(value)) die(23, value)\n\treturn value[DRAFT_STATE].base_\n}\n\n/*#__PURE__*/\nexport const ownKeys: (target: AnyObject) => PropertyKey[] =\n\ttypeof Reflect !== \"undefined\" && Reflect.ownKeys\n\t\t? Reflect.ownKeys\n\t\t: typeof Object.getOwnPropertySymbols !== \"undefined\"\n\t\t? obj =>\n\t\t\t\tObject.getOwnPropertyNames(obj).concat(\n\t\t\t\t\tObject.getOwnPropertySymbols(obj) as any\n\t\t\t\t)\n\t\t: /* istanbul ignore next */ Object.getOwnPropertyNames\n\nexport const getOwnPropertyDescriptors =\n\tObject.getOwnPropertyDescriptors ||\n\tfunction getOwnPropertyDescriptors(target: any) {\n\t\t// Polyfill needed for Hermes and IE, see https://github.com/facebook/hermes/issues/274\n\t\tconst res: any = {}\n\t\townKeys(target).forEach(key => {\n\t\t\tres[key] = Object.getOwnPropertyDescriptor(target, key)\n\t\t})\n\t\treturn res\n\t}\n\nexport function each(\n\tobj: T,\n\titer: (key: string | number, value: any, source: T) => void,\n\tenumerableOnly?: boolean\n): void\nexport function each(obj: any, iter: any, enumerableOnly = false) {\n\tif (getArchtype(obj) === Archtype.Object) {\n\t\t;(enumerableOnly ? Object.keys : ownKeys)(obj).forEach(key => {\n\t\t\tif (!enumerableOnly || typeof key !== \"symbol\") iter(key, obj[key], obj)\n\t\t})\n\t} else {\n\t\tobj.forEach((entry: any, index: any) => iter(index, entry, obj))\n\t}\n}\n\n/*#__PURE__*/\nexport function getArchtype(thing: any): Archtype {\n\t/* istanbul ignore next */\n\tconst state: undefined | ImmerState = thing[DRAFT_STATE]\n\treturn state\n\t\t? state.type_ > 3\n\t\t\t? state.type_ - 4 // cause Object and Array map back from 4 and 5\n\t\t\t: (state.type_ as any) // others are the same\n\t\t: Array.isArray(thing)\n\t\t? Archtype.Array\n\t\t: isMap(thing)\n\t\t? Archtype.Map\n\t\t: isSet(thing)\n\t\t? Archtype.Set\n\t\t: Archtype.Object\n}\n\n/*#__PURE__*/\nexport function has(thing: any, prop: PropertyKey): boolean {\n\treturn getArchtype(thing) === Archtype.Map\n\t\t? thing.has(prop)\n\t\t: Object.prototype.hasOwnProperty.call(thing, prop)\n}\n\n/*#__PURE__*/\nexport function get(thing: AnyMap | AnyObject, prop: PropertyKey): any {\n\t// @ts-ignore\n\treturn getArchtype(thing) === Archtype.Map ? thing.get(prop) : thing[prop]\n}\n\n/*#__PURE__*/\nexport function set(thing: any, propOrOldValue: PropertyKey, value: any) {\n\tconst t = getArchtype(thing)\n\tif (t === Archtype.Map) thing.set(propOrOldValue, value)\n\telse if (t === Archtype.Set) {\n\t\tthing.delete(propOrOldValue)\n\t\tthing.add(value)\n\t} else thing[propOrOldValue] = value\n}\n\n/*#__PURE__*/\nexport function is(x: any, y: any): boolean {\n\t// From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js\n\tif (x === y) {\n\t\treturn x !== 0 || 1 / x === 1 / y\n\t} else {\n\t\treturn x !== x && y !== y\n\t}\n}\n\n/*#__PURE__*/\nexport function isMap(target: any): target is AnyMap {\n\treturn hasMap && target instanceof Map\n}\n\n/*#__PURE__*/\nexport function isSet(target: any): target is AnySet {\n\treturn hasSet && target instanceof Set\n}\n/*#__PURE__*/\nexport function latest(state: ImmerState): any {\n\treturn state.copy_ || state.base_\n}\n\n/*#__PURE__*/\nexport function shallowCopy(base: any) {\n\tif (Array.isArray(base)) return Array.prototype.slice.call(base)\n\tconst descriptors = getOwnPropertyDescriptors(base)\n\tdelete descriptors[DRAFT_STATE as any]\n\tlet keys = ownKeys(descriptors)\n\tfor (let i = 0; i < keys.length; i++) {\n\t\tconst key: any = keys[i]\n\t\tconst desc = descriptors[key]\n\t\tif (desc.writable === false) {\n\t\t\tdesc.writable = true\n\t\t\tdesc.configurable = true\n\t\t}\n\t\t// like object.assign, we will read any _own_, get/set accessors. This helps in dealing\n\t\t// with libraries that trap values, like mobx or vue\n\t\t// unlike object.assign, non-enumerables will be copied as well\n\t\tif (desc.get || desc.set)\n\t\t\tdescriptors[key] = {\n\t\t\t\tconfigurable: true,\n\t\t\t\twritable: true, // could live with !!desc.set as well here...\n\t\t\t\tenumerable: desc.enumerable,\n\t\t\t\tvalue: base[key]\n\t\t\t}\n\t}\n\treturn Object.create(Object.getPrototypeOf(base), descriptors)\n}\n\n/**\n * Freezes draftable objects. Returns the original object.\n * By default freezes shallowly, but if the second argument is `true` it will freeze recursively.\n *\n * @param obj\n * @param deep\n */\nexport function freeze(obj: T, deep?: boolean): T\nexport function freeze(obj: any, deep: boolean = false): T {\n\tif (isFrozen(obj) || isDraft(obj) || !isDraftable(obj)) return obj\n\tif (getArchtype(obj) > 1 /* Map or Set */) {\n\t\tobj.set = obj.add = obj.clear = obj.delete = dontMutateFrozenCollections as any\n\t}\n\tObject.freeze(obj)\n\tif (deep) each(obj, (key, value) => freeze(value, true), true)\n\treturn obj\n}\n\nfunction dontMutateFrozenCollections() {\n\tdie(2)\n}\n\nexport function isFrozen(obj: any): boolean {\n\tif (obj == null || typeof obj !== \"object\") return true\n\t// See #600, IE dies on non-objects in Object.isFrozen\n\treturn Object.isFrozen(obj)\n}\n", "import {\n\tImmerState,\n\tPatch,\n\tImmerScope,\n\tDrafted,\n\tAnyObject,\n\tImmerBaseState,\n\tAnyMap,\n\tAnySet,\n\tProxyType,\n\tdie\n} from \"../internal\"\n\n/** Plugin utilities */\nconst plugins: {\n\tPatches?: {\n\t\tgeneratePatches_(\n\t\t\tstate: ImmerState,\n\t\t\tbasePath: PatchPath,\n\t\t\tpatches: Patch[],\n\t\t\tinversePatches: Patch[]\n\t\t): void\n\t\tgenerateReplacementPatches_(\n\t\t\trootState: ImmerState,\n\t\t\treplacement: any,\n\t\t\tpatches: Patch[],\n\t\t\tinversePatches: Patch[]\n\t\t): void\n\t\tapplyPatches_(draft: T, patches: Patch[]): T\n\t}\n\tES5?: {\n\t\twillFinalizeES5_(scope: ImmerScope, result: any, isReplaced: boolean): void\n\t\tcreateES5Proxy_(\n\t\t\tbase: T,\n\t\t\tparent?: ImmerState\n\t\t): Drafted\n\t\thasChanges_(state: ES5ArrayState | ES5ObjectState): boolean\n\t}\n\tMapSet?: {\n\t\tproxyMap_(target: T, parent?: ImmerState): T\n\t\tproxySet_(target: T, parent?: ImmerState): T\n\t}\n} = {}\n\ntype Plugins = typeof plugins\n\nexport function getPlugin(\n\tpluginKey: K\n): Exclude {\n\tconst plugin = plugins[pluginKey]\n\tif (!plugin) {\n\t\tdie(18, pluginKey)\n\t}\n\t// @ts-ignore\n\treturn plugin\n}\n\nexport function loadPlugin(\n\tpluginKey: K,\n\timplementation: Plugins[K]\n): void {\n\tif (!plugins[pluginKey]) plugins[pluginKey] = implementation\n}\n\n/** ES5 Plugin */\n\ninterface ES5BaseState extends ImmerBaseState {\n\tassigned_: {[key: string]: any}\n\tparent_?: ImmerState\n\trevoked_: boolean\n}\n\nexport interface ES5ObjectState extends ES5BaseState {\n\ttype_: ProxyType.ES5Object\n\tdraft_: Drafted\n\tbase_: AnyObject\n\tcopy_: AnyObject | null\n}\n\nexport interface ES5ArrayState extends ES5BaseState {\n\ttype_: ProxyType.ES5Array\n\tdraft_: Drafted\n\tbase_: any\n\tcopy_: any\n}\n\n/** Map / Set plugin */\n\nexport interface MapState extends ImmerBaseState {\n\ttype_: ProxyType.Map\n\tcopy_: AnyMap | undefined\n\tassigned_: Map | undefined\n\tbase_: AnyMap\n\trevoked_: boolean\n\tdraft_: Drafted\n}\n\nexport interface SetState extends ImmerBaseState {\n\ttype_: ProxyType.Set\n\tcopy_: AnySet | undefined\n\tbase_: AnySet\n\tdrafts_: Map // maps the original value to the draft value in the new set\n\trevoked_: boolean\n\tdraft_: Drafted\n}\n\n/** Patches plugin */\n\nexport type PatchPath = (string | number)[]\n", "import {\n\tPatch,\n\tPatchListener,\n\tDrafted,\n\tImmer,\n\tDRAFT_STATE,\n\tImmerState,\n\tProxyType,\n\tgetPlugin\n} from \"../internal\"\nimport {die} from \"../utils/errors\"\n\n/** Each scope represents a `produce` call. */\n\nexport interface ImmerScope {\n\tpatches_?: Patch[]\n\tinversePatches_?: Patch[]\n\tcanAutoFreeze_: boolean\n\tdrafts_: any[]\n\tparent_?: ImmerScope\n\tpatchListener_?: PatchListener\n\timmer_: Immer\n\tunfinalizedDrafts_: number\n}\n\nlet currentScope: ImmerScope | undefined\n\nexport function getCurrentScope() {\n\tif (__DEV__ && !currentScope) die(0)\n\treturn currentScope!\n}\n\nfunction createScope(\n\tparent_: ImmerScope | undefined,\n\timmer_: Immer\n): ImmerScope {\n\treturn {\n\t\tdrafts_: [],\n\t\tparent_,\n\t\timmer_,\n\t\t// Whenever the modified draft contains a draft from another scope, we\n\t\t// need to prevent auto-freezing so the unowned draft can be finalized.\n\t\tcanAutoFreeze_: true,\n\t\tunfinalizedDrafts_: 0\n\t}\n}\n\nexport function usePatchesInScope(\n\tscope: ImmerScope,\n\tpatchListener?: PatchListener\n) {\n\tif (patchListener) {\n\t\tgetPlugin(\"Patches\") // assert we have the plugin\n\t\tscope.patches_ = []\n\t\tscope.inversePatches_ = []\n\t\tscope.patchListener_ = patchListener\n\t}\n}\n\nexport function revokeScope(scope: ImmerScope) {\n\tleaveScope(scope)\n\tscope.drafts_.forEach(revokeDraft)\n\t// @ts-ignore\n\tscope.drafts_ = null\n}\n\nexport function leaveScope(scope: ImmerScope) {\n\tif (scope === currentScope) {\n\t\tcurrentScope = scope.parent_\n\t}\n}\n\nexport function enterScope(immer: Immer) {\n\treturn (currentScope = createScope(currentScope, immer))\n}\n\nfunction revokeDraft(draft: Drafted) {\n\tconst state: ImmerState = draft[DRAFT_STATE]\n\tif (\n\t\tstate.type_ === ProxyType.ProxyObject ||\n\t\tstate.type_ === ProxyType.ProxyArray\n\t)\n\t\tstate.revoke_()\n\telse state.revoked_ = true\n}\n", "import {\n\tImmerScope,\n\tDRAFT_STATE,\n\tisDraftable,\n\tNOTHING,\n\tPatchPath,\n\teach,\n\thas,\n\tfreeze,\n\tImmerState,\n\tisDraft,\n\tSetState,\n\tset,\n\tProxyType,\n\tgetPlugin,\n\tdie,\n\trevokeScope,\n\tisFrozen,\n\tshallowCopy\n} from \"../internal\"\n\nexport function processResult(result: any, scope: ImmerScope) {\n\tscope.unfinalizedDrafts_ = scope.drafts_.length\n\tconst baseDraft = scope.drafts_![0]\n\tconst isReplaced = result !== undefined && result !== baseDraft\n\tif (!scope.immer_.useProxies_)\n\t\tgetPlugin(\"ES5\").willFinalizeES5_(scope, result, isReplaced)\n\tif (isReplaced) {\n\t\tif (baseDraft[DRAFT_STATE].modified_) {\n\t\t\trevokeScope(scope)\n\t\t\tdie(4)\n\t\t}\n\t\tif (isDraftable(result)) {\n\t\t\t// Finalize the result in case it contains (or is) a subset of the draft.\n\t\t\tresult = finalize(scope, result)\n\t\t\tif (!scope.parent_) maybeFreeze(scope, result)\n\t\t}\n\t\tif (scope.patches_) {\n\t\t\tgetPlugin(\"Patches\").generateReplacementPatches_(\n\t\t\t\tbaseDraft[DRAFT_STATE],\n\t\t\t\tresult,\n\t\t\t\tscope.patches_,\n\t\t\t\tscope.inversePatches_!\n\t\t\t)\n\t\t}\n\t} else {\n\t\t// Finalize the base draft.\n\t\tresult = finalize(scope, baseDraft, [])\n\t}\n\trevokeScope(scope)\n\tif (scope.patches_) {\n\t\tscope.patchListener_!(scope.patches_, scope.inversePatches_!)\n\t}\n\treturn result !== NOTHING ? result : undefined\n}\n\nfunction finalize(rootScope: ImmerScope, value: any, path?: PatchPath) {\n\t// Don't recurse in tho recursive data structures\n\tif (isFrozen(value)) return value\n\n\tconst state: ImmerState = value[DRAFT_STATE]\n\t// A plain object, might need freezing, might contain drafts\n\tif (!state) {\n\t\teach(\n\t\t\tvalue,\n\t\t\t(key, childValue) =>\n\t\t\t\tfinalizeProperty(rootScope, state, value, key, childValue, path),\n\t\t\ttrue // See #590, don't recurse into non-enumerable of non drafted objects\n\t\t)\n\t\treturn value\n\t}\n\t// Never finalize drafts owned by another scope.\n\tif (state.scope_ !== rootScope) return value\n\t// Unmodified draft, return the (frozen) original\n\tif (!state.modified_) {\n\t\tmaybeFreeze(rootScope, state.base_, true)\n\t\treturn state.base_\n\t}\n\t// Not finalized yet, let's do that now\n\tif (!state.finalized_) {\n\t\tstate.finalized_ = true\n\t\tstate.scope_.unfinalizedDrafts_--\n\t\tconst result =\n\t\t\t// For ES5, create a good copy from the draft first, with added keys and without deleted keys.\n\t\t\tstate.type_ === ProxyType.ES5Object || state.type_ === ProxyType.ES5Array\n\t\t\t\t? (state.copy_ = shallowCopy(state.draft_))\n\t\t\t\t: state.copy_\n\t\t// Finalize all children of the copy\n\t\t// For sets we clone before iterating, otherwise we can get in endless loop due to modifying during iteration, see #628\n\t\t// Although the original test case doesn't seem valid anyway, so if this in the way we can turn the next line\n\t\t// back to each(result, ....)\n\t\teach(\n\t\t\tstate.type_ === ProxyType.Set ? new Set(result) : result,\n\t\t\t(key, childValue) =>\n\t\t\t\tfinalizeProperty(rootScope, state, result, key, childValue, path)\n\t\t)\n\t\t// everything inside is frozen, we can freeze here\n\t\tmaybeFreeze(rootScope, result, false)\n\t\t// first time finalizing, let's create those patches\n\t\tif (path && rootScope.patches_) {\n\t\t\tgetPlugin(\"Patches\").generatePatches_(\n\t\t\t\tstate,\n\t\t\t\tpath,\n\t\t\t\trootScope.patches_,\n\t\t\t\trootScope.inversePatches_!\n\t\t\t)\n\t\t}\n\t}\n\treturn state.copy_\n}\n\nfunction finalizeProperty(\n\trootScope: ImmerScope,\n\tparentState: undefined | ImmerState,\n\ttargetObject: any,\n\tprop: string | number,\n\tchildValue: any,\n\trootPath?: PatchPath\n) {\n\tif (__DEV__ && childValue === targetObject) die(5)\n\tif (isDraft(childValue)) {\n\t\tconst path =\n\t\t\trootPath &&\n\t\t\tparentState &&\n\t\t\tparentState!.type_ !== ProxyType.Set && // Set objects are atomic since they have no keys.\n\t\t\t!has((parentState as Exclude).assigned_!, prop) // Skip deep patches for assigned keys.\n\t\t\t\t? rootPath!.concat(prop)\n\t\t\t\t: undefined\n\t\t// Drafts owned by `scope` are finalized here.\n\t\tconst res = finalize(rootScope, childValue, path)\n\t\tset(targetObject, prop, res)\n\t\t// Drafts from another scope must prevented to be frozen\n\t\t// if we got a draft back from finalize, we're in a nested produce and shouldn't freeze\n\t\tif (isDraft(res)) {\n\t\t\trootScope.canAutoFreeze_ = false\n\t\t} else return\n\t}\n\t// Search new objects for unfinalized drafts. Frozen objects should never contain drafts.\n\tif (isDraftable(childValue) && !isFrozen(childValue)) {\n\t\tif (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {\n\t\t\t// optimization: if an object is not a draft, and we don't have to\n\t\t\t// deepfreeze everything, and we are sure that no drafts are left in the remaining object\n\t\t\t// cause we saw and finalized all drafts already; we can stop visiting the rest of the tree.\n\t\t\t// This benefits especially adding large data tree's without further processing.\n\t\t\t// See add-data.js perf test\n\t\t\treturn\n\t\t}\n\t\tfinalize(rootScope, childValue)\n\t\t// immer deep freezes plain objects, so if there is no parent state, we freeze as well\n\t\tif (!parentState || !parentState.scope_.parent_)\n\t\t\tmaybeFreeze(rootScope, childValue)\n\t}\n}\n\nfunction maybeFreeze(scope: ImmerScope, value: any, deep = false) {\n\tif (scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {\n\t\tfreeze(value, deep)\n\t}\n}\n", "import {\n\teach,\n\thas,\n\tis,\n\tisDraftable,\n\tshallowCopy,\n\tlatest,\n\tImmerBaseState,\n\tImmerState,\n\tDrafted,\n\tAnyObject,\n\tAnyArray,\n\tObjectish,\n\tgetCurrentScope,\n\tDRAFT_STATE,\n\tdie,\n\tcreateProxy,\n\tProxyType\n} from \"../internal\"\n\ninterface ProxyBaseState extends ImmerBaseState {\n\tassigned_: {\n\t\t[property: string]: boolean\n\t}\n\tparent_?: ImmerState\n\trevoke_(): void\n}\n\nexport interface ProxyObjectState extends ProxyBaseState {\n\ttype_: ProxyType.ProxyObject\n\tbase_: any\n\tcopy_: any\n\tdraft_: Drafted\n}\n\nexport interface ProxyArrayState extends ProxyBaseState {\n\ttype_: ProxyType.ProxyArray\n\tbase_: AnyArray\n\tcopy_: AnyArray | null\n\tdraft_: Drafted\n}\n\ntype ProxyState = ProxyObjectState | ProxyArrayState\n\n/**\n * Returns a new draft of the `base` object.\n *\n * The second argument is the parent draft-state (used internally).\n */\nexport function createProxyProxy(\n\tbase: T,\n\tparent?: ImmerState\n): Drafted {\n\tconst isArray = Array.isArray(base)\n\tconst state: ProxyState = {\n\t\ttype_: isArray ? ProxyType.ProxyArray : (ProxyType.ProxyObject as any),\n\t\t// Track which produce call this is associated with.\n\t\tscope_: parent ? parent.scope_ : getCurrentScope()!,\n\t\t// True for both shallow and deep changes.\n\t\tmodified_: false,\n\t\t// Used during finalization.\n\t\tfinalized_: false,\n\t\t// Track which properties have been assigned (true) or deleted (false).\n\t\tassigned_: {},\n\t\t// The parent draft state.\n\t\tparent_: parent,\n\t\t// The base state.\n\t\tbase_: base,\n\t\t// The base proxy.\n\t\tdraft_: null as any, // set below\n\t\t// The base copy with any updated values.\n\t\tcopy_: null,\n\t\t// Called by the `produce` function.\n\t\trevoke_: null as any,\n\t\tisManual_: false\n\t}\n\n\t// the traps must target something, a bit like the 'real' base.\n\t// but also, we need to be able to determine from the target what the relevant state is\n\t// (to avoid creating traps per instance to capture the state in closure,\n\t// and to avoid creating weird hidden properties as well)\n\t// So the trick is to use 'state' as the actual 'target'! (and make sure we intercept everything)\n\t// Note that in the case of an array, we put the state in an array to have better Reflect defaults ootb\n\tlet target: T = state as any\n\tlet traps: ProxyHandler> = objectTraps\n\tif (isArray) {\n\t\ttarget = [state] as any\n\t\ttraps = arrayTraps\n\t}\n\n\tconst {revoke, proxy} = Proxy.revocable(target, traps)\n\tstate.draft_ = proxy as any\n\tstate.revoke_ = revoke\n\treturn proxy as any\n}\n\n/**\n * Object drafts\n */\nexport const objectTraps: ProxyHandler = {\n\tget(state, prop) {\n\t\tif (prop === DRAFT_STATE) return state\n\n\t\tconst source = latest(state)\n\t\tif (!has(source, prop)) {\n\t\t\t// non-existing or non-own property...\n\t\t\treturn readPropFromProto(state, source, prop)\n\t\t}\n\t\tconst value = source[prop]\n\t\tif (state.finalized_ || !isDraftable(value)) {\n\t\t\treturn value\n\t\t}\n\t\t// Check for existing draft in modified state.\n\t\t// Assigned values are never drafted. This catches any drafts we created, too.\n\t\tif (value === peek(state.base_, prop)) {\n\t\t\tprepareCopy(state)\n\t\t\treturn (state.copy_![prop as any] = createProxy(\n\t\t\t\tstate.scope_.immer_,\n\t\t\t\tvalue,\n\t\t\t\tstate\n\t\t\t))\n\t\t}\n\t\treturn value\n\t},\n\thas(state, prop) {\n\t\treturn prop in latest(state)\n\t},\n\townKeys(state) {\n\t\treturn Reflect.ownKeys(latest(state))\n\t},\n\tset(\n\t\tstate: ProxyObjectState,\n\t\tprop: string /* strictly not, but helps TS */,\n\t\tvalue\n\t) {\n\t\tconst desc = getDescriptorFromProto(latest(state), prop)\n\t\tif (desc?.set) {\n\t\t\t// special case: if this write is captured by a setter, we have\n\t\t\t// to trigger it with the correct context\n\t\t\tdesc.set.call(state.draft_, value)\n\t\t\treturn true\n\t\t}\n\t\tif (!state.modified_) {\n\t\t\t// the last check is because we need to be able to distinguish setting a non-existing to undefined (which is a change)\n\t\t\t// from setting an existing property with value undefined to undefined (which is not a change)\n\t\t\tconst current = peek(latest(state), prop)\n\t\t\t// special case, if we assigning the original value to a draft, we can ignore the assignment\n\t\t\tconst currentState: ProxyObjectState = current?.[DRAFT_STATE]\n\t\t\tif (currentState && currentState.base_ === value) {\n\t\t\t\tstate.copy_![prop] = value\n\t\t\t\tstate.assigned_[prop] = false\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif (is(value, current) && (value !== undefined || has(state.base_, prop)))\n\t\t\t\treturn true\n\t\t\tprepareCopy(state)\n\t\t\tmarkChanged(state)\n\t\t}\n\n\t\tif (\n\t\t\tstate.copy_![prop] === value &&\n\t\t\t// special case: NaN\n\t\t\ttypeof value !== \"number\" &&\n\t\t\t// special case: handle new props with value 'undefined'\n\t\t\t(value !== undefined || prop in state.copy_)\n\t\t)\n\t\t\treturn true\n\n\t\t// @ts-ignore\n\t\tstate.copy_![prop] = value\n\t\tstate.assigned_[prop] = true\n\t\treturn true\n\t},\n\tdeleteProperty(state, prop: string) {\n\t\t// The `undefined` check is a fast path for pre-existing keys.\n\t\tif (peek(state.base_, prop) !== undefined || prop in state.base_) {\n\t\t\tstate.assigned_[prop] = false\n\t\t\tprepareCopy(state)\n\t\t\tmarkChanged(state)\n\t\t} else {\n\t\t\t// if an originally not assigned property was deleted\n\t\t\tdelete state.assigned_[prop]\n\t\t}\n\t\t// @ts-ignore\n\t\tif (state.copy_) delete state.copy_[prop]\n\t\treturn true\n\t},\n\t// Note: We never coerce `desc.value` into an Immer draft, because we can't make\n\t// the same guarantee in ES5 mode.\n\tgetOwnPropertyDescriptor(state, prop) {\n\t\tconst owner = latest(state)\n\t\tconst desc = Reflect.getOwnPropertyDescriptor(owner, prop)\n\t\tif (!desc) return desc\n\t\treturn {\n\t\t\twritable: true,\n\t\t\tconfigurable: state.type_ !== ProxyType.ProxyArray || prop !== \"length\",\n\t\t\tenumerable: desc.enumerable,\n\t\t\tvalue: owner[prop]\n\t\t}\n\t},\n\tdefineProperty() {\n\t\tdie(11)\n\t},\n\tgetPrototypeOf(state) {\n\t\treturn Object.getPrototypeOf(state.base_)\n\t},\n\tsetPrototypeOf() {\n\t\tdie(12)\n\t}\n}\n\n/**\n * Array drafts\n */\n\nconst arrayTraps: ProxyHandler<[ProxyArrayState]> = {}\neach(objectTraps, (key, fn) => {\n\t// @ts-ignore\n\tarrayTraps[key] = function() {\n\t\targuments[0] = arguments[0][0]\n\t\treturn fn.apply(this, arguments)\n\t}\n})\narrayTraps.deleteProperty = function(state, prop) {\n\tif (__DEV__ && isNaN(parseInt(prop as any))) die(13)\n\treturn objectTraps.deleteProperty!.call(this, state[0], prop)\n}\narrayTraps.set = function(state, prop, value) {\n\tif (__DEV__ && prop !== \"length\" && isNaN(parseInt(prop as any))) die(14)\n\treturn objectTraps.set!.call(this, state[0], prop, value, state[0])\n}\n\n// Access a property without creating an Immer draft.\nfunction peek(draft: Drafted, prop: PropertyKey) {\n\tconst state = draft[DRAFT_STATE]\n\tconst source = state ? latest(state) : draft\n\treturn source[prop]\n}\n\nfunction readPropFromProto(state: ImmerState, source: any, prop: PropertyKey) {\n\tconst desc = getDescriptorFromProto(source, prop)\n\treturn desc\n\t\t? `value` in desc\n\t\t\t? desc.value\n\t\t\t: // This is a very special case, if the prop is a getter defined by the\n\t\t\t // prototype, we should invoke it with the draft as context!\n\t\t\t desc.get?.call(state.draft_)\n\t\t: undefined\n}\n\nfunction getDescriptorFromProto(\n\tsource: any,\n\tprop: PropertyKey\n): PropertyDescriptor | undefined {\n\t// 'in' checks proto!\n\tif (!(prop in source)) return undefined\n\tlet proto = Object.getPrototypeOf(source)\n\twhile (proto) {\n\t\tconst desc = Object.getOwnPropertyDescriptor(proto, prop)\n\t\tif (desc) return desc\n\t\tproto = Object.getPrototypeOf(proto)\n\t}\n\treturn undefined\n}\n\nexport function markChanged(state: ImmerState) {\n\tif (!state.modified_) {\n\t\tstate.modified_ = true\n\t\tif (state.parent_) {\n\t\t\tmarkChanged(state.parent_)\n\t\t}\n\t}\n}\n\nexport function prepareCopy(state: {base_: any; copy_: any}) {\n\tif (!state.copy_) {\n\t\tstate.copy_ = shallowCopy(state.base_)\n\t}\n}\n", "import {\n\tIProduceWithPatches,\n\tIProduce,\n\tImmerState,\n\tDrafted,\n\tisDraftable,\n\tprocessResult,\n\tPatch,\n\tObjectish,\n\tDRAFT_STATE,\n\tDraft,\n\tPatchListener,\n\tisDraft,\n\tisMap,\n\tisSet,\n\tcreateProxyProxy,\n\tgetPlugin,\n\tdie,\n\thasProxies,\n\tenterScope,\n\trevokeScope,\n\tleaveScope,\n\tusePatchesInScope,\n\tgetCurrentScope,\n\tNOTHING,\n\tfreeze,\n\tcurrent\n} from \"../internal\"\n\ninterface ProducersFns {\n\tproduce: IProduce\n\tproduceWithPatches: IProduceWithPatches\n}\n\nexport class Immer implements ProducersFns {\n\tuseProxies_: boolean = hasProxies\n\n\tautoFreeze_: boolean = true\n\n\tconstructor(config?: {useProxies?: boolean; autoFreeze?: boolean}) {\n\t\tif (typeof config?.useProxies === \"boolean\")\n\t\t\tthis.setUseProxies(config!.useProxies)\n\t\tif (typeof config?.autoFreeze === \"boolean\")\n\t\t\tthis.setAutoFreeze(config!.autoFreeze)\n\t}\n\n\t/**\n\t * The `produce` function takes a value and a \"recipe function\" (whose\n\t * return value often depends on the base state). The recipe function is\n\t * free to mutate its first argument however it wants. All mutations are\n\t * only ever applied to a __copy__ of the base state.\n\t *\n\t * Pass only a function to create a \"curried producer\" which relieves you\n\t * from passing the recipe function every time.\n\t *\n\t * Only plain objects and arrays are made mutable. All other objects are\n\t * considered uncopyable.\n\t *\n\t * Note: This function is __bound__ to its `Immer` instance.\n\t *\n\t * @param {any} base - the initial state\n\t * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified\n\t * @param {Function} patchListener - optional function that will be called with all the patches produced here\n\t * @returns {any} a new state, or the initial state if nothing was modified\n\t */\n\tproduce: IProduce = (base: any, recipe?: any, patchListener?: any) => {\n\t\t// curried invocation\n\t\tif (typeof base === \"function\" && typeof recipe !== \"function\") {\n\t\t\tconst defaultBase = recipe\n\t\t\trecipe = base\n\n\t\t\tconst self = this\n\t\t\treturn function curriedProduce(\n\t\t\t\tthis: any,\n\t\t\t\tbase = defaultBase,\n\t\t\t\t...args: any[]\n\t\t\t) {\n\t\t\t\treturn self.produce(base, (draft: Drafted) => recipe.call(this, draft, ...args)) // prettier-ignore\n\t\t\t}\n\t\t}\n\n\t\tif (typeof recipe !== \"function\") die(6)\n\t\tif (patchListener !== undefined && typeof patchListener !== \"function\")\n\t\t\tdie(7)\n\n\t\tlet result\n\n\t\t// Only plain objects, arrays, and \"immerable classes\" are drafted.\n\t\tif (isDraftable(base)) {\n\t\t\tconst scope = enterScope(this)\n\t\t\tconst proxy = createProxy(this, base, undefined)\n\t\t\tlet hasError = true\n\t\t\ttry {\n\t\t\t\tresult = recipe(proxy)\n\t\t\t\thasError = false\n\t\t\t} finally {\n\t\t\t\t// finally instead of catch + rethrow better preserves original stack\n\t\t\t\tif (hasError) revokeScope(scope)\n\t\t\t\telse leaveScope(scope)\n\t\t\t}\n\t\t\tif (typeof Promise !== \"undefined\" && result instanceof Promise) {\n\t\t\t\treturn result.then(\n\t\t\t\t\tresult => {\n\t\t\t\t\t\tusePatchesInScope(scope, patchListener)\n\t\t\t\t\t\treturn processResult(result, scope)\n\t\t\t\t\t},\n\t\t\t\t\terror => {\n\t\t\t\t\t\trevokeScope(scope)\n\t\t\t\t\t\tthrow error\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\t}\n\t\t\tusePatchesInScope(scope, patchListener)\n\t\t\treturn processResult(result, scope)\n\t\t} else if (!base || typeof base !== \"object\") {\n\t\t\tresult = recipe(base)\n\t\t\tif (result === NOTHING) return undefined\n\t\t\tif (result === undefined) result = base\n\t\t\tif (this.autoFreeze_) freeze(result, true)\n\t\t\treturn result\n\t\t} else die(21, base)\n\t}\n\n\tproduceWithPatches: IProduceWithPatches = (\n\t\targ1: any,\n\t\targ2?: any,\n\t\targ3?: any\n\t): any => {\n\t\tif (typeof arg1 === \"function\") {\n\t\t\treturn (state: any, ...args: any[]) =>\n\t\t\t\tthis.produceWithPatches(state, (draft: any) => arg1(draft, ...args))\n\t\t}\n\n\t\tlet patches: Patch[], inversePatches: Patch[]\n\t\tconst nextState = this.produce(arg1, arg2, (p: Patch[], ip: Patch[]) => {\n\t\t\tpatches = p\n\t\t\tinversePatches = ip\n\t\t})\n\t\treturn [nextState, patches!, inversePatches!]\n\t}\n\n\tcreateDraft(base: T): Draft {\n\t\tif (!isDraftable(base)) die(8)\n\t\tif (isDraft(base)) base = current(base)\n\t\tconst scope = enterScope(this)\n\t\tconst proxy = createProxy(this, base, undefined)\n\t\tproxy[DRAFT_STATE].isManual_ = true\n\t\tleaveScope(scope)\n\t\treturn proxy as any\n\t}\n\n\tfinishDraft>(\n\t\tdraft: D,\n\t\tpatchListener?: PatchListener\n\t): D extends Draft ? T : never {\n\t\tconst state: ImmerState = draft && (draft as any)[DRAFT_STATE]\n\t\tif (__DEV__) {\n\t\t\tif (!state || !state.isManual_) die(9)\n\t\t\tif (state.finalized_) die(10)\n\t\t}\n\t\tconst {scope_: scope} = state\n\t\tusePatchesInScope(scope, patchListener)\n\t\treturn processResult(undefined, scope)\n\t}\n\n\t/**\n\t * Pass true to automatically freeze all copies created by Immer.\n\t *\n\t * By default, auto-freezing is enabled.\n\t */\n\tsetAutoFreeze(value: boolean) {\n\t\tthis.autoFreeze_ = value\n\t}\n\n\t/**\n\t * Pass true to use the ES2015 `Proxy` class when creating drafts, which is\n\t * always faster than using ES5 proxies.\n\t *\n\t * By default, feature detection is used, so calling this is rarely necessary.\n\t */\n\tsetUseProxies(value: boolean) {\n\t\tif (value && !hasProxies) {\n\t\t\tdie(20)\n\t\t}\n\t\tthis.useProxies_ = value\n\t}\n\n\tapplyPatches(base: T, patches: Patch[]): T {\n\t\t// If a patch replaces the entire state, take that replacement as base\n\t\t// before applying patches\n\t\tlet i: number\n\t\tfor (i = patches.length - 1; i >= 0; i--) {\n\t\t\tconst patch = patches[i]\n\t\t\tif (patch.path.length === 0 && patch.op === \"replace\") {\n\t\t\t\tbase = patch.value\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t// If there was a patch that replaced the entire state, start from the\n\t\t// patch after that.\n\t\tif (i > -1) {\n\t\t\tpatches = patches.slice(i + 1)\n\t\t}\n\n\t\tconst applyPatchesImpl = getPlugin(\"Patches\").applyPatches_\n\t\tif (isDraft(base)) {\n\t\t\t// N.B: never hits if some patch a replacement, patches are never drafts\n\t\t\treturn applyPatchesImpl(base, patches)\n\t\t}\n\t\t// Otherwise, produce a copy of the base state.\n\t\treturn this.produce(base, (draft: Drafted) =>\n\t\t\tapplyPatchesImpl(draft, patches)\n\t\t)\n\t}\n}\n\nexport function createProxy(\n\timmer: Immer,\n\tvalue: T,\n\tparent?: ImmerState\n): Drafted {\n\t// precondition: createProxy should be guarded by isDraftable, so we know we can safely draft\n\tconst draft: Drafted = isMap(value)\n\t\t? getPlugin(\"MapSet\").proxyMap_(value, parent)\n\t\t: isSet(value)\n\t\t? getPlugin(\"MapSet\").proxySet_(value, parent)\n\t\t: immer.useProxies_\n\t\t? createProxyProxy(value, parent)\n\t\t: getPlugin(\"ES5\").createES5Proxy_(value, parent)\n\n\tconst scope = parent ? parent.scope_ : getCurrentScope()\n\tscope.drafts_.push(draft)\n\treturn draft\n}\n", "import {\n\tdie,\n\tisDraft,\n\tshallowCopy,\n\teach,\n\tDRAFT_STATE,\n\tget,\n\tset,\n\tImmerState,\n\tisDraftable,\n\tArchtype,\n\tgetArchtype,\n\tgetPlugin\n} from \"../internal\"\n\n/** Takes a snapshot of the current state of a draft and finalizes it (but without freezing). This is a great utility to print the current state during debugging (no Proxies in the way). The output of current can also be safely leaked outside the producer. */\nexport function current(value: T): T\nexport function current(value: any): any {\n\tif (!isDraft(value)) die(22, value)\n\treturn currentImpl(value)\n}\n\nfunction currentImpl(value: any): any {\n\tif (!isDraftable(value)) return value\n\tconst state: ImmerState | undefined = value[DRAFT_STATE]\n\tlet copy: any\n\tconst archType = getArchtype(value)\n\tif (state) {\n\t\tif (\n\t\t\t!state.modified_ &&\n\t\t\t(state.type_ < 4 || !getPlugin(\"ES5\").hasChanges_(state as any))\n\t\t)\n\t\t\treturn state.base_\n\t\t// Optimization: avoid generating new drafts during copying\n\t\tstate.finalized_ = true\n\t\tcopy = copyHelper(value, archType)\n\t\tstate.finalized_ = false\n\t} else {\n\t\tcopy = copyHelper(value, archType)\n\t}\n\n\teach(copy, (key, childValue) => {\n\t\tif (state && get(state.base_, key) === childValue) return // no need to copy or search in something that didn't change\n\t\tset(copy, key, currentImpl(childValue))\n\t})\n\t// In the future, we might consider freezing here, based on the current settings\n\treturn archType === Archtype.Set ? new Set(copy) : copy\n}\n\nfunction copyHelper(value: any, archType: number): any {\n\t// creates a shallow copy, even if it is a map or set\n\tswitch (archType) {\n\t\tcase Archtype.Map:\n\t\t\treturn new Map(value)\n\t\tcase Archtype.Set:\n\t\t\t// Set will be cloned as array temporarily, so that we can replace individual items\n\t\t\treturn Array.from(value)\n\t}\n\treturn shallowCopy(value)\n}\n", "import {\n\tImmerState,\n\tDrafted,\n\tES5ArrayState,\n\tES5ObjectState,\n\teach,\n\thas,\n\tisDraft,\n\tlatest,\n\tDRAFT_STATE,\n\tis,\n\tloadPlugin,\n\tImmerScope,\n\tProxyType,\n\tgetCurrentScope,\n\tdie,\n\tmarkChanged,\n\tobjectTraps,\n\townKeys,\n\tgetOwnPropertyDescriptors\n} from \"../internal\"\n\ntype ES5State = ES5ArrayState | ES5ObjectState\n\nexport function enableES5() {\n\tfunction willFinalizeES5_(\n\t\tscope: ImmerScope,\n\t\tresult: any,\n\t\tisReplaced: boolean\n\t) {\n\t\tif (!isReplaced) {\n\t\t\tif (scope.patches_) {\n\t\t\t\tmarkChangesRecursively(scope.drafts_![0])\n\t\t\t}\n\t\t\t// This is faster when we don't care about which attributes changed.\n\t\t\tmarkChangesSweep(scope.drafts_)\n\t\t}\n\t\t// When a child draft is returned, look for changes.\n\t\telse if (\n\t\t\tisDraft(result) &&\n\t\t\t(result[DRAFT_STATE] as ES5State).scope_ === scope\n\t\t) {\n\t\t\tmarkChangesSweep(scope.drafts_)\n\t\t}\n\t}\n\n\tfunction createES5Draft(isArray: boolean, base: any) {\n\t\tif (isArray) {\n\t\t\tconst draft = new Array(base.length)\n\t\t\tfor (let i = 0; i < base.length; i++)\n\t\t\t\tObject.defineProperty(draft, \"\" + i, proxyProperty(i, true))\n\t\t\treturn draft\n\t\t} else {\n\t\t\tconst descriptors = getOwnPropertyDescriptors(base)\n\t\t\tdelete descriptors[DRAFT_STATE as any]\n\t\t\tconst keys = ownKeys(descriptors)\n\t\t\tfor (let i = 0; i < keys.length; i++) {\n\t\t\t\tconst key: any = keys[i]\n\t\t\t\tdescriptors[key] = proxyProperty(\n\t\t\t\t\tkey,\n\t\t\t\t\tisArray || !!descriptors[key].enumerable\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn Object.create(Object.getPrototypeOf(base), descriptors)\n\t\t}\n\t}\n\n\tfunction createES5Proxy_(\n\t\tbase: T,\n\t\tparent?: ImmerState\n\t): Drafted {\n\t\tconst isArray = Array.isArray(base)\n\t\tconst draft = createES5Draft(isArray, base)\n\n\t\tconst state: ES5ObjectState | ES5ArrayState = {\n\t\t\ttype_: isArray ? ProxyType.ES5Array : (ProxyType.ES5Object as any),\n\t\t\tscope_: parent ? parent.scope_ : getCurrentScope(),\n\t\t\tmodified_: false,\n\t\t\tfinalized_: false,\n\t\t\tassigned_: {},\n\t\t\tparent_: parent,\n\t\t\t// base is the object we are drafting\n\t\t\tbase_: base,\n\t\t\t// draft is the draft object itself, that traps all reads and reads from either the base (if unmodified) or copy (if modified)\n\t\t\tdraft_: draft,\n\t\t\tcopy_: null,\n\t\t\trevoked_: false,\n\t\t\tisManual_: false\n\t\t}\n\n\t\tObject.defineProperty(draft, DRAFT_STATE, {\n\t\t\tvalue: state,\n\t\t\t// enumerable: false <- the default\n\t\t\twritable: true\n\t\t})\n\t\treturn draft\n\t}\n\n\t// property descriptors are recycled to make sure we don't create a get and set closure per property,\n\t// but share them all instead\n\tconst descriptors: {[prop: string]: PropertyDescriptor} = {}\n\n\tfunction proxyProperty(\n\t\tprop: string | number,\n\t\tenumerable: boolean\n\t): PropertyDescriptor {\n\t\tlet desc = descriptors[prop]\n\t\tif (desc) {\n\t\t\tdesc.enumerable = enumerable\n\t\t} else {\n\t\t\tdescriptors[prop] = desc = {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable,\n\t\t\t\tget(this: any) {\n\t\t\t\t\tconst state = this[DRAFT_STATE]\n\t\t\t\t\tif (__DEV__) assertUnrevoked(state)\n\t\t\t\t\t// @ts-ignore\n\t\t\t\t\treturn objectTraps.get(state, prop)\n\t\t\t\t},\n\t\t\t\tset(this: any, value) {\n\t\t\t\t\tconst state = this[DRAFT_STATE]\n\t\t\t\t\tif (__DEV__) assertUnrevoked(state)\n\t\t\t\t\t// @ts-ignore\n\t\t\t\t\tobjectTraps.set(state, prop, value)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn desc\n\t}\n\n\t// This looks expensive, but only proxies are visited, and only objects without known changes are scanned.\n\tfunction markChangesSweep(drafts: Drafted[]) {\n\t\t// The natural order of drafts in the `scope` array is based on when they\n\t\t// were accessed. By processing drafts in reverse natural order, we have a\n\t\t// better chance of processing leaf nodes first. When a leaf node is known to\n\t\t// have changed, we can avoid any traversal of its ancestor nodes.\n\t\tfor (let i = drafts.length - 1; i >= 0; i--) {\n\t\t\tconst state: ES5State = drafts[i][DRAFT_STATE]\n\t\t\tif (!state.modified_) {\n\t\t\t\tswitch (state.type_) {\n\t\t\t\t\tcase ProxyType.ES5Array:\n\t\t\t\t\t\tif (hasArrayChanges(state)) markChanged(state)\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase ProxyType.ES5Object:\n\t\t\t\t\t\tif (hasObjectChanges(state)) markChanged(state)\n\t\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction markChangesRecursively(object: any) {\n\t\tif (!object || typeof object !== \"object\") return\n\t\tconst state: ES5State | undefined = object[DRAFT_STATE]\n\t\tif (!state) return\n\t\tconst {base_, draft_, assigned_, type_} = state\n\t\tif (type_ === ProxyType.ES5Object) {\n\t\t\t// Look for added keys.\n\t\t\t// probably there is a faster way to detect changes, as sweep + recurse seems to do some\n\t\t\t// unnecessary work.\n\t\t\t// also: probably we can store the information we detect here, to speed up tree finalization!\n\t\t\teach(draft_, key => {\n\t\t\t\tif ((key as any) === DRAFT_STATE) return\n\t\t\t\t// The `undefined` check is a fast path for pre-existing keys.\n\t\t\t\tif ((base_ as any)[key] === undefined && !has(base_, key)) {\n\t\t\t\t\tassigned_[key] = true\n\t\t\t\t\tmarkChanged(state)\n\t\t\t\t} else if (!assigned_[key]) {\n\t\t\t\t\t// Only untouched properties trigger recursion.\n\t\t\t\t\tmarkChangesRecursively(draft_[key])\n\t\t\t\t}\n\t\t\t})\n\t\t\t// Look for removed keys.\n\t\t\teach(base_, key => {\n\t\t\t\t// The `undefined` check is a fast path for pre-existing keys.\n\t\t\t\tif (draft_[key] === undefined && !has(draft_, key)) {\n\t\t\t\t\tassigned_[key] = false\n\t\t\t\t\tmarkChanged(state)\n\t\t\t\t}\n\t\t\t})\n\t\t} else if (type_ === ProxyType.ES5Array) {\n\t\t\tif (hasArrayChanges(state as ES5ArrayState)) {\n\t\t\t\tmarkChanged(state)\n\t\t\t\tassigned_.length = true\n\t\t\t}\n\n\t\t\tif (draft_.length < base_.length) {\n\t\t\t\tfor (let i = draft_.length; i < base_.length; i++) assigned_[i] = false\n\t\t\t} else {\n\t\t\t\tfor (let i = base_.length; i < draft_.length; i++) assigned_[i] = true\n\t\t\t}\n\n\t\t\t// Minimum count is enough, the other parts has been processed.\n\t\t\tconst min = Math.min(draft_.length, base_.length)\n\n\t\t\tfor (let i = 0; i < min; i++) {\n\t\t\t\t// Only untouched indices trigger recursion.\n\t\t\t\tif (assigned_[i] === undefined) markChangesRecursively(draft_[i])\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction hasObjectChanges(state: ES5ObjectState) {\n\t\tconst {base_, draft_} = state\n\n\t\t// Search for added keys and changed keys. Start at the back, because\n\t\t// non-numeric keys are ordered by time of definition on the object.\n\t\tconst keys = ownKeys(draft_)\n\t\tfor (let i = keys.length - 1; i >= 0; i--) {\n\t\t\tconst key: any = keys[i]\n\t\t\tif (key === DRAFT_STATE) continue\n\t\t\tconst baseValue = base_[key]\n\t\t\t// The `undefined` check is a fast path for pre-existing keys.\n\t\t\tif (baseValue === undefined && !has(base_, key)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\t// Once a base key is deleted, future changes go undetected, because its\n\t\t\t// descriptor is erased. This branch detects any missed changes.\n\t\t\telse {\n\t\t\t\tconst value = draft_[key]\n\t\t\t\tconst state: ImmerState = value && value[DRAFT_STATE]\n\t\t\t\tif (state ? state.base_ !== baseValue : !is(value, baseValue)) {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// At this point, no keys were added or changed.\n\t\t// Compare key count to determine if keys were deleted.\n\t\tconst baseIsDraft = !!base_[DRAFT_STATE as any]\n\t\treturn keys.length !== ownKeys(base_).length + (baseIsDraft ? 0 : 1) // + 1 to correct for DRAFT_STATE\n\t}\n\n\tfunction hasArrayChanges(state: ES5ArrayState) {\n\t\tconst {draft_} = state\n\t\tif (draft_.length !== state.base_.length) return true\n\t\t// See #116\n\t\t// If we first shorten the length, our array interceptors will be removed.\n\t\t// If after that new items are added, result in the same original length,\n\t\t// those last items will have no intercepting property.\n\t\t// So if there is no own descriptor on the last position, we know that items were removed and added\n\t\t// N.B.: splice, unshift, etc only shift values around, but not prop descriptors, so we only have to check\n\t\t// the last one\n\t\tconst descriptor = Object.getOwnPropertyDescriptor(\n\t\t\tdraft_,\n\t\t\tdraft_.length - 1\n\t\t)\n\t\t// descriptor can be null, but only for newly created sparse arrays, eg. new Array(10)\n\t\tif (descriptor && !descriptor.get) return true\n\t\t// For all other cases, we don't have to compare, as they would have been picked up by the index setters\n\t\treturn false\n\t}\n\n\tfunction hasChanges_(state: ES5State) {\n\t\treturn state.type_ === ProxyType.ES5Object\n\t\t\t? hasObjectChanges(state)\n\t\t\t: hasArrayChanges(state)\n\t}\n\n\tfunction assertUnrevoked(state: any /*ES5State | MapState | SetState*/) {\n\t\tif (state.revoked_) die(3, JSON.stringify(latest(state)))\n\t}\n\n\tloadPlugin(\"ES5\", {\n\t\tcreateES5Proxy_,\n\t\twillFinalizeES5_,\n\t\thasChanges_\n\t})\n}\n", "import {immerable} from \"../immer\"\nimport {\n\tImmerState,\n\tPatch,\n\tSetState,\n\tES5ArrayState,\n\tProxyArrayState,\n\tMapState,\n\tES5ObjectState,\n\tProxyObjectState,\n\tPatchPath,\n\tget,\n\teach,\n\thas,\n\tgetArchtype,\n\tisSet,\n\tisMap,\n\tloadPlugin,\n\tProxyType,\n\tArchtype,\n\tdie,\n\tisDraft,\n\tisDraftable,\n\tNOTHING\n} from \"../internal\"\n\nexport function enablePatches() {\n\tconst REPLACE = \"replace\"\n\tconst ADD = \"add\"\n\tconst REMOVE = \"remove\"\n\n\tfunction generatePatches_(\n\t\tstate: ImmerState,\n\t\tbasePath: PatchPath,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t): void {\n\t\tswitch (state.type_) {\n\t\t\tcase ProxyType.ProxyObject:\n\t\t\tcase ProxyType.ES5Object:\n\t\t\tcase ProxyType.Map:\n\t\t\t\treturn generatePatchesFromAssigned(\n\t\t\t\t\tstate,\n\t\t\t\t\tbasePath,\n\t\t\t\t\tpatches,\n\t\t\t\t\tinversePatches\n\t\t\t\t)\n\t\t\tcase ProxyType.ES5Array:\n\t\t\tcase ProxyType.ProxyArray:\n\t\t\t\treturn generateArrayPatches(state, basePath, patches, inversePatches)\n\t\t\tcase ProxyType.Set:\n\t\t\t\treturn generateSetPatches(\n\t\t\t\t\t(state as any) as SetState,\n\t\t\t\t\tbasePath,\n\t\t\t\t\tpatches,\n\t\t\t\t\tinversePatches\n\t\t\t\t)\n\t\t}\n\t}\n\n\tfunction generateArrayPatches(\n\t\tstate: ES5ArrayState | ProxyArrayState,\n\t\tbasePath: PatchPath,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t) {\n\t\tlet {base_, assigned_} = state\n\t\tlet copy_ = state.copy_!\n\n\t\t// Reduce complexity by ensuring `base` is never longer.\n\t\tif (copy_.length < base_.length) {\n\t\t\t// @ts-ignore\n\t\t\t;[base_, copy_] = [copy_, base_]\n\t\t\t;[patches, inversePatches] = [inversePatches, patches]\n\t\t}\n\n\t\t// Process replaced indices.\n\t\tfor (let i = 0; i < base_.length; i++) {\n\t\t\tif (assigned_[i] && copy_[i] !== base_[i]) {\n\t\t\t\tconst path = basePath.concat([i])\n\t\t\t\tpatches.push({\n\t\t\t\t\top: REPLACE,\n\t\t\t\t\tpath,\n\t\t\t\t\t// Need to maybe clone it, as it can in fact be the original value\n\t\t\t\t\t// due to the base/copy inversion at the start of this function\n\t\t\t\t\tvalue: clonePatchValueIfNeeded(copy_[i])\n\t\t\t\t})\n\t\t\t\tinversePatches.push({\n\t\t\t\t\top: REPLACE,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue: clonePatchValueIfNeeded(base_[i])\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\t// Process added indices.\n\t\tfor (let i = base_.length; i < copy_.length; i++) {\n\t\t\tconst path = basePath.concat([i])\n\t\t\tpatches.push({\n\t\t\t\top: ADD,\n\t\t\t\tpath,\n\t\t\t\t// Need to maybe clone it, as it can in fact be the original value\n\t\t\t\t// due to the base/copy inversion at the start of this function\n\t\t\t\tvalue: clonePatchValueIfNeeded(copy_[i])\n\t\t\t})\n\t\t}\n\t\tif (base_.length < copy_.length) {\n\t\t\tinversePatches.push({\n\t\t\t\top: REPLACE,\n\t\t\t\tpath: basePath.concat([\"length\"]),\n\t\t\t\tvalue: base_.length\n\t\t\t})\n\t\t}\n\t}\n\n\t// This is used for both Map objects and normal objects.\n\tfunction generatePatchesFromAssigned(\n\t\tstate: MapState | ES5ObjectState | ProxyObjectState,\n\t\tbasePath: PatchPath,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t) {\n\t\tconst {base_, copy_} = state\n\t\teach(state.assigned_!, (key, assignedValue) => {\n\t\t\tconst origValue = get(base_, key)\n\t\t\tconst value = get(copy_!, key)\n\t\t\tconst op = !assignedValue ? REMOVE : has(base_, key) ? REPLACE : ADD\n\t\t\tif (origValue === value && op === REPLACE) return\n\t\t\tconst path = basePath.concat(key as any)\n\t\t\tpatches.push(op === REMOVE ? {op, path} : {op, path, value})\n\t\t\tinversePatches.push(\n\t\t\t\top === ADD\n\t\t\t\t\t? {op: REMOVE, path}\n\t\t\t\t\t: op === REMOVE\n\t\t\t\t\t? {op: ADD, path, value: clonePatchValueIfNeeded(origValue)}\n\t\t\t\t\t: {op: REPLACE, path, value: clonePatchValueIfNeeded(origValue)}\n\t\t\t)\n\t\t})\n\t}\n\n\tfunction generateSetPatches(\n\t\tstate: SetState,\n\t\tbasePath: PatchPath,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t) {\n\t\tlet {base_, copy_} = state\n\n\t\tlet i = 0\n\t\tbase_.forEach((value: any) => {\n\t\t\tif (!copy_!.has(value)) {\n\t\t\t\tconst path = basePath.concat([i])\n\t\t\t\tpatches.push({\n\t\t\t\t\top: REMOVE,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue\n\t\t\t\t})\n\t\t\t\tinversePatches.unshift({\n\t\t\t\t\top: ADD,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue\n\t\t\t\t})\n\t\t\t}\n\t\t\ti++\n\t\t})\n\t\ti = 0\n\t\tcopy_!.forEach((value: any) => {\n\t\t\tif (!base_.has(value)) {\n\t\t\t\tconst path = basePath.concat([i])\n\t\t\t\tpatches.push({\n\t\t\t\t\top: ADD,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue\n\t\t\t\t})\n\t\t\t\tinversePatches.unshift({\n\t\t\t\t\top: REMOVE,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue\n\t\t\t\t})\n\t\t\t}\n\t\t\ti++\n\t\t})\n\t}\n\n\tfunction generateReplacementPatches_(\n\t\trootState: ImmerState,\n\t\treplacement: any,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t): void {\n\t\tpatches.push({\n\t\t\top: REPLACE,\n\t\t\tpath: [],\n\t\t\tvalue: replacement === NOTHING ? undefined : replacement\n\t\t})\n\t\tinversePatches.push({\n\t\t\top: REPLACE,\n\t\t\tpath: [],\n\t\t\tvalue: rootState.base_\n\t\t})\n\t}\n\n\tfunction applyPatches_(draft: T, patches: Patch[]): T {\n\t\tpatches.forEach(patch => {\n\t\t\tconst {path, op} = patch\n\n\t\t\tlet base: any = draft\n\t\t\tfor (let i = 0; i < path.length - 1; i++) {\n\t\t\t\tconst parentType = getArchtype(base)\n\t\t\t\tconst p = \"\" + path[i]\n\t\t\t\t// See #738, avoid prototype pollution\n\t\t\t\tif (\n\t\t\t\t\t(parentType === Archtype.Object || parentType === Archtype.Array) &&\n\t\t\t\t\t(p === \"__proto__\" || p === \"constructor\")\n\t\t\t\t)\n\t\t\t\t\tdie(24)\n\t\t\t\tif (typeof base === \"function\" && p === \"prototype\") die(24)\n\t\t\t\tbase = get(base, p)\n\t\t\t\tif (typeof base !== \"object\") die(15, path.join(\"/\"))\n\t\t\t}\n\n\t\t\tconst type = getArchtype(base)\n\t\t\tconst value = deepClonePatchValue(patch.value) // used to clone patch to ensure original patch is not modified, see #411\n\t\t\tconst key = path[path.length - 1]\n\t\t\tswitch (op) {\n\t\t\t\tcase REPLACE:\n\t\t\t\t\tswitch (type) {\n\t\t\t\t\t\tcase Archtype.Map:\n\t\t\t\t\t\t\treturn base.set(key, value)\n\t\t\t\t\t\t/* istanbul ignore next */\n\t\t\t\t\t\tcase Archtype.Set:\n\t\t\t\t\t\t\tdie(16)\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t// if value is an object, then it's assigned by reference\n\t\t\t\t\t\t\t// in the following add or remove ops, the value field inside the patch will also be modifyed\n\t\t\t\t\t\t\t// so we use value from the cloned patch\n\t\t\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t\t\treturn (base[key] = value)\n\t\t\t\t\t}\n\t\t\t\tcase ADD:\n\t\t\t\t\tswitch (type) {\n\t\t\t\t\t\tcase Archtype.Array:\n\t\t\t\t\t\t\treturn key === \"-\"\n\t\t\t\t\t\t\t\t? base.push(value)\n\t\t\t\t\t\t\t\t: base.splice(key as any, 0, value)\n\t\t\t\t\t\tcase Archtype.Map:\n\t\t\t\t\t\t\treturn base.set(key, value)\n\t\t\t\t\t\tcase Archtype.Set:\n\t\t\t\t\t\t\treturn base.add(value)\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn (base[key] = value)\n\t\t\t\t\t}\n\t\t\t\tcase REMOVE:\n\t\t\t\t\tswitch (type) {\n\t\t\t\t\t\tcase Archtype.Array:\n\t\t\t\t\t\t\treturn base.splice(key as any, 1)\n\t\t\t\t\t\tcase Archtype.Map:\n\t\t\t\t\t\t\treturn base.delete(key)\n\t\t\t\t\t\tcase Archtype.Set:\n\t\t\t\t\t\t\treturn base.delete(patch.value)\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn delete base[key]\n\t\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tdie(17, op)\n\t\t\t}\n\t\t})\n\n\t\treturn draft\n\t}\n\n\t// optimize: this is quite a performance hit, can we detect intelligently when it is needed?\n\t// E.g. auto-draft when new objects from outside are assigned and modified?\n\t// (See failing test when deepClone just returns obj)\n\tfunction deepClonePatchValue(obj: T): T\n\tfunction deepClonePatchValue(obj: any) {\n\t\tif (!isDraftable(obj)) return obj\n\t\tif (Array.isArray(obj)) return obj.map(deepClonePatchValue)\n\t\tif (isMap(obj))\n\t\t\treturn new Map(\n\t\t\t\tArray.from(obj.entries()).map(([k, v]) => [k, deepClonePatchValue(v)])\n\t\t\t)\n\t\tif (isSet(obj)) return new Set(Array.from(obj).map(deepClonePatchValue))\n\t\tconst cloned = Object.create(Object.getPrototypeOf(obj))\n\t\tfor (const key in obj) cloned[key] = deepClonePatchValue(obj[key])\n\t\tif (has(obj, immerable)) cloned[immerable] = obj[immerable]\n\t\treturn cloned\n\t}\n\n\tfunction clonePatchValueIfNeeded(obj: T): T {\n\t\tif (isDraft(obj)) {\n\t\t\treturn deepClonePatchValue(obj)\n\t\t} else return obj\n\t}\n\n\tloadPlugin(\"Patches\", {\n\t\tapplyPatches_,\n\t\tgeneratePatches_,\n\t\tgenerateReplacementPatches_\n\t})\n}\n", "// types only!\nimport {\n\tImmerState,\n\tAnyMap,\n\tAnySet,\n\tMapState,\n\tSetState,\n\tDRAFT_STATE,\n\tgetCurrentScope,\n\tlatest,\n\titeratorSymbol,\n\tisDraftable,\n\tcreateProxy,\n\tloadPlugin,\n\tmarkChanged,\n\tProxyType,\n\tdie,\n\teach\n} from \"../internal\"\n\nexport function enableMapSet() {\n\t/* istanbul ignore next */\n\tvar extendStatics = function(d: any, b: any): any {\n\t\textendStatics =\n\t\t\tObject.setPrototypeOf ||\n\t\t\t({__proto__: []} instanceof Array &&\n\t\t\t\tfunction(d, b) {\n\t\t\t\t\td.__proto__ = b\n\t\t\t\t}) ||\n\t\t\tfunction(d, b) {\n\t\t\t\tfor (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]\n\t\t\t}\n\t\treturn extendStatics(d, b)\n\t}\n\n\t// Ugly hack to resolve #502 and inherit built in Map / Set\n\tfunction __extends(d: any, b: any): any {\n\t\textendStatics(d, b)\n\t\tfunction __(this: any): any {\n\t\t\tthis.constructor = d\n\t\t}\n\t\td.prototype =\n\t\t\t// @ts-ignore\n\t\t\t((__.prototype = b.prototype), new __())\n\t}\n\n\tconst DraftMap = (function(_super) {\n\t\t__extends(DraftMap, _super)\n\t\t// Create class manually, cause #502\n\t\tfunction DraftMap(this: any, target: AnyMap, parent?: ImmerState): any {\n\t\t\tthis[DRAFT_STATE] = {\n\t\t\t\ttype_: ProxyType.Map,\n\t\t\t\tparent_: parent,\n\t\t\t\tscope_: parent ? parent.scope_ : getCurrentScope()!,\n\t\t\t\tmodified_: false,\n\t\t\t\tfinalized_: false,\n\t\t\t\tcopy_: undefined,\n\t\t\t\tassigned_: undefined,\n\t\t\t\tbase_: target,\n\t\t\t\tdraft_: this as any,\n\t\t\t\tisManual_: false,\n\t\t\t\trevoked_: false\n\t\t\t} as MapState\n\t\t\treturn this\n\t\t}\n\t\tconst p = DraftMap.prototype\n\n\t\tObject.defineProperty(p, \"size\", {\n\t\t\tget: function() {\n\t\t\t\treturn latest(this[DRAFT_STATE]).size\n\t\t\t}\n\t\t\t// enumerable: false,\n\t\t\t// configurable: true\n\t\t})\n\n\t\tp.has = function(key: any): boolean {\n\t\t\treturn latest(this[DRAFT_STATE]).has(key)\n\t\t}\n\n\t\tp.set = function(key: any, value: any) {\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tif (!latest(state).has(key) || latest(state).get(key) !== value) {\n\t\t\t\tprepareMapCopy(state)\n\t\t\t\tmarkChanged(state)\n\t\t\t\tstate.assigned_!.set(key, true)\n\t\t\t\tstate.copy_!.set(key, value)\n\t\t\t\tstate.assigned_!.set(key, true)\n\t\t\t}\n\t\t\treturn this\n\t\t}\n\n\t\tp.delete = function(key: any): boolean {\n\t\t\tif (!this.has(key)) {\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tprepareMapCopy(state)\n\t\t\tmarkChanged(state)\n\t\t\tstate.assigned_!.set(key, false)\n\t\t\tstate.copy_!.delete(key)\n\t\t\treturn true\n\t\t}\n\n\t\tp.clear = function() {\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tif (latest(state).size) {\n\t\t\t\tprepareMapCopy(state)\n\t\t\t\tmarkChanged(state)\n\t\t\t\tstate.assigned_ = new Map()\n\t\t\t\teach(state.base_, key => {\n\t\t\t\t\tstate.assigned_!.set(key, false)\n\t\t\t\t})\n\t\t\t\tstate.copy_!.clear()\n\t\t\t}\n\t\t}\n\n\t\tp.forEach = function(\n\t\t\tcb: (value: any, key: any, self: any) => void,\n\t\t\tthisArg?: any\n\t\t) {\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tlatest(state).forEach((_value: any, key: any, _map: any) => {\n\t\t\t\tcb.call(thisArg, this.get(key), key, this)\n\t\t\t})\n\t\t}\n\n\t\tp.get = function(key: any): any {\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tconst value = latest(state).get(key)\n\t\t\tif (state.finalized_ || !isDraftable(value)) {\n\t\t\t\treturn value\n\t\t\t}\n\t\t\tif (value !== state.base_.get(key)) {\n\t\t\t\treturn value // either already drafted or reassigned\n\t\t\t}\n\t\t\t// despite what it looks, this creates a draft only once, see above condition\n\t\t\tconst draft = createProxy(state.scope_.immer_, value, state)\n\t\t\tprepareMapCopy(state)\n\t\t\tstate.copy_!.set(key, draft)\n\t\t\treturn draft\n\t\t}\n\n\t\tp.keys = function(): IterableIterator {\n\t\t\treturn latest(this[DRAFT_STATE]).keys()\n\t\t}\n\n\t\tp.values = function(): IterableIterator {\n\t\t\tconst iterator = this.keys()\n\t\t\treturn {\n\t\t\t\t[iteratorSymbol]: () => this.values(),\n\t\t\t\tnext: () => {\n\t\t\t\t\tconst r = iterator.next()\n\t\t\t\t\t/* istanbul ignore next */\n\t\t\t\t\tif (r.done) return r\n\t\t\t\t\tconst value = this.get(r.value)\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdone: false,\n\t\t\t\t\t\tvalue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} as any\n\t\t}\n\n\t\tp.entries = function(): IterableIterator<[any, any]> {\n\t\t\tconst iterator = this.keys()\n\t\t\treturn {\n\t\t\t\t[iteratorSymbol]: () => this.entries(),\n\t\t\t\tnext: () => {\n\t\t\t\t\tconst r = iterator.next()\n\t\t\t\t\t/* istanbul ignore next */\n\t\t\t\t\tif (r.done) return r\n\t\t\t\t\tconst value = this.get(r.value)\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdone: false,\n\t\t\t\t\t\tvalue: [r.value, value]\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} as any\n\t\t}\n\n\t\tp[iteratorSymbol] = function() {\n\t\t\treturn this.entries()\n\t\t}\n\n\t\treturn DraftMap\n\t})(Map)\n\n\tfunction proxyMap_(target: T, parent?: ImmerState): T {\n\t\t// @ts-ignore\n\t\treturn new DraftMap(target, parent)\n\t}\n\n\tfunction prepareMapCopy(state: MapState) {\n\t\tif (!state.copy_) {\n\t\t\tstate.assigned_ = new Map()\n\t\t\tstate.copy_ = new Map(state.base_)\n\t\t}\n\t}\n\n\tconst DraftSet = (function(_super) {\n\t\t__extends(DraftSet, _super)\n\t\t// Create class manually, cause #502\n\t\tfunction DraftSet(this: any, target: AnySet, parent?: ImmerState) {\n\t\t\tthis[DRAFT_STATE] = {\n\t\t\t\ttype_: ProxyType.Set,\n\t\t\t\tparent_: parent,\n\t\t\t\tscope_: parent ? parent.scope_ : getCurrentScope()!,\n\t\t\t\tmodified_: false,\n\t\t\t\tfinalized_: false,\n\t\t\t\tcopy_: undefined,\n\t\t\t\tbase_: target,\n\t\t\t\tdraft_: this,\n\t\t\t\tdrafts_: new Map(),\n\t\t\t\trevoked_: false,\n\t\t\t\tisManual_: false\n\t\t\t} as SetState\n\t\t\treturn this\n\t\t}\n\t\tconst p = DraftSet.prototype\n\n\t\tObject.defineProperty(p, \"size\", {\n\t\t\tget: function() {\n\t\t\t\treturn latest(this[DRAFT_STATE]).size\n\t\t\t}\n\t\t\t// enumerable: true,\n\t\t})\n\n\t\tp.has = function(value: any): boolean {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\t// bit of trickery here, to be able to recognize both the value, and the draft of its value\n\t\t\tif (!state.copy_) {\n\t\t\t\treturn state.base_.has(value)\n\t\t\t}\n\t\t\tif (state.copy_.has(value)) return true\n\t\t\tif (state.drafts_.has(value) && state.copy_.has(state.drafts_.get(value)))\n\t\t\t\treturn true\n\t\t\treturn false\n\t\t}\n\n\t\tp.add = function(value: any): any {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tif (!this.has(value)) {\n\t\t\t\tprepareSetCopy(state)\n\t\t\t\tmarkChanged(state)\n\t\t\t\tstate.copy_!.add(value)\n\t\t\t}\n\t\t\treturn this\n\t\t}\n\n\t\tp.delete = function(value: any): any {\n\t\t\tif (!this.has(value)) {\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tprepareSetCopy(state)\n\t\t\tmarkChanged(state)\n\t\t\treturn (\n\t\t\t\tstate.copy_!.delete(value) ||\n\t\t\t\t(state.drafts_.has(value)\n\t\t\t\t\t? state.copy_!.delete(state.drafts_.get(value))\n\t\t\t\t\t: /* istanbul ignore next */ false)\n\t\t\t)\n\t\t}\n\n\t\tp.clear = function() {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tif (latest(state).size) {\n\t\t\t\tprepareSetCopy(state)\n\t\t\t\tmarkChanged(state)\n\t\t\t\tstate.copy_!.clear()\n\t\t\t}\n\t\t}\n\n\t\tp.values = function(): IterableIterator {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tprepareSetCopy(state)\n\t\t\treturn state.copy_!.values()\n\t\t}\n\n\t\tp.entries = function entries(): IterableIterator<[any, any]> {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tprepareSetCopy(state)\n\t\t\treturn state.copy_!.entries()\n\t\t}\n\n\t\tp.keys = function(): IterableIterator {\n\t\t\treturn this.values()\n\t\t}\n\n\t\tp[iteratorSymbol] = function() {\n\t\t\treturn this.values()\n\t\t}\n\n\t\tp.forEach = function forEach(cb: any, thisArg?: any) {\n\t\t\tconst iterator = this.values()\n\t\t\tlet result = iterator.next()\n\t\t\twhile (!result.done) {\n\t\t\t\tcb.call(thisArg, result.value, result.value, this)\n\t\t\t\tresult = iterator.next()\n\t\t\t}\n\t\t}\n\n\t\treturn DraftSet\n\t})(Set)\n\n\tfunction proxySet_(target: T, parent?: ImmerState): T {\n\t\t// @ts-ignore\n\t\treturn new DraftSet(target, parent)\n\t}\n\n\tfunction prepareSetCopy(state: SetState) {\n\t\tif (!state.copy_) {\n\t\t\t// create drafts for all entries to preserve insertion order\n\t\t\tstate.copy_ = new Set()\n\t\t\tstate.base_.forEach(value => {\n\t\t\t\tif (isDraftable(value)) {\n\t\t\t\t\tconst draft = createProxy(state.scope_.immer_, value, state)\n\t\t\t\t\tstate.drafts_.set(value, draft)\n\t\t\t\t\tstate.copy_!.add(draft)\n\t\t\t\t} else {\n\t\t\t\t\tstate.copy_!.add(value)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t}\n\n\tfunction assertUnrevoked(state: any /*ES5State | MapState | SetState*/) {\n\t\tif (state.revoked_) die(3, JSON.stringify(latest(state)))\n\t}\n\n\tloadPlugin(\"MapSet\", {proxyMap_, proxySet_})\n}\n", "import {enableES5} from \"./es5\"\nimport {enableMapSet} from \"./mapset\"\nimport {enablePatches} from \"./patches\"\n\nexport function enableAllPlugins() {\n\tenableES5()\n\tenableMapSet()\n\tenablePatches()\n}\n", "import {\n\tIProduce,\n\tIProduceWithPatches,\n\tImmer,\n\tDraft,\n\tImmutable\n} from \"./internal\"\n\nexport {\n\tDraft,\n\tImmutable,\n\tPatch,\n\tPatchListener,\n\toriginal,\n\tcurrent,\n\tisDraft,\n\tisDraftable,\n\tNOTHING as nothing,\n\tDRAFTABLE as immerable,\n\tfreeze\n} from \"./internal\"\n\nconst immer = new Immer()\n\n/**\n * The `produce` function takes a value and a \"recipe function\" (whose\n * return value often depends on the base state). The recipe function is\n * free to mutate its first argument however it wants. All mutations are\n * only ever applied to a __copy__ of the base state.\n *\n * Pass only a function to create a \"curried producer\" which relieves you\n * from passing the recipe function every time.\n *\n * Only plain objects and arrays are made mutable. All other objects are\n * considered uncopyable.\n *\n * Note: This function is __bound__ to its `Immer` instance.\n *\n * @param {any} base - the initial state\n * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified\n * @param {Function} patchListener - optional function that will be called with all the patches produced here\n * @returns {any} a new state, or the initial state if nothing was modified\n */\nexport const produce: IProduce = immer.produce\nexport default produce\n\n/**\n * Like `produce`, but `produceWithPatches` always returns a tuple\n * [nextState, patches, inversePatches] (instead of just the next state)\n */\nexport const produceWithPatches: IProduceWithPatches = immer.produceWithPatches.bind(\n\timmer\n)\n\n/**\n * Pass true to automatically freeze all copies created by Immer.\n *\n * Always freeze by default, even in production mode\n */\nexport const setAutoFreeze = immer.setAutoFreeze.bind(immer)\n\n/**\n * Pass true to use the ES2015 `Proxy` class when creating drafts, which is\n * always faster than using ES5 proxies.\n *\n * By default, feature detection is used, so calling this is rarely necessary.\n */\nexport const setUseProxies = immer.setUseProxies.bind(immer)\n\n/**\n * Apply an array of Immer patches to the first argument.\n *\n * This function is a producer, which means copy-on-write is in effect.\n */\nexport const applyPatches = immer.applyPatches.bind(immer)\n\n/**\n * Create an Immer draft from the given base state, which may be a draft itself.\n * The draft can be modified until you finalize it with the `finishDraft` function.\n */\nexport const createDraft = immer.createDraft.bind(immer)\n\n/**\n * Finalize an Immer draft from a `createDraft` call, returning the base state\n * (if no changes were made) or a modified copy. The draft must *not* be\n * mutated afterwards.\n *\n * Pass a function as the 2nd argument to generate Immer patches based on the\n * changes that were made.\n */\nexport const finishDraft = immer.finishDraft.bind(immer)\n\n/**\n * This function is actually a no-op, but can be used to cast an immutable type\n * to an draft type and make TypeScript happy\n *\n * @param value\n */\nexport function castDraft(value: T): Draft {\n\treturn value as any\n}\n\n/**\n * This function is actually a no-op, but can be used to cast a mutable type\n * to an immutable type and make TypeScript happy\n * @param value\n */\nexport function castImmutable(value: T): Immutable {\n\treturn value as any\n}\n\nexport {Immer}\n\nexport {enableES5} from \"./plugins/es5\"\nexport {enablePatches} from \"./plugins/patches\"\nexport {enableMapSet} from \"./plugins/mapset\"\nexport {enableAllPlugins} from \"./plugins/all\"\n", "// Should be no imports here!\n\n// Some things that should be evaluated before all else...\n\n// We only want to know if non-polyfilled symbols are available\nconst hasSymbol =\n\ttypeof Symbol !== \"undefined\" && typeof Symbol(\"x\") === \"symbol\"\nexport const hasMap = typeof Map !== \"undefined\"\nexport const hasSet = typeof Set !== \"undefined\"\nexport const hasProxies =\n\ttypeof Proxy !== \"undefined\" &&\n\ttypeof Proxy.revocable !== \"undefined\" &&\n\ttypeof Reflect !== \"undefined\"\n\n/**\n * The sentinel value returned by producers to replace the draft with undefined.\n */\nexport const NOTHING: Nothing = hasSymbol\n\t? Symbol.for(\"immer-nothing\")\n\t: ({[\"immer-nothing\"]: true} as any)\n\n/**\n * To let Immer treat your class instances as plain immutable objects\n * (albeit with a custom prototype), you must define either an instance property\n * or a static property on each of your custom classes.\n *\n * Otherwise, your class instance will never be drafted, which means it won't be\n * safe to mutate in a produce callback.\n */\nexport const DRAFTABLE: unique symbol = hasSymbol\n\t? Symbol.for(\"immer-draftable\")\n\t: (\"__$immer_draftable\" as any)\n\nexport const DRAFT_STATE: unique symbol = hasSymbol\n\t? Symbol.for(\"immer-state\")\n\t: (\"__$immer_state\" as any)\n\n// Even a polyfilled Symbol might provide Symbol.iterator\nexport const iteratorSymbol: typeof Symbol.iterator =\n\t(typeof Symbol != \"undefined\" && Symbol.iterator) || (\"@@iterator\" as any)\n\n/** Use a class type for `nothing` so its type is unique */\nexport class Nothing {\n\t// This lets us do `Exclude`\n\t// @ts-ignore\n\tprivate _!: unique symbol\n}\n", "export default function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}", "import defineProperty from \"./defineProperty.js\";\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n enumerableOnly && (symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n })), keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nexport default function _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = null != arguments[i] ? arguments[i] : {};\n i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {\n defineProperty(target, key, source[key]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n\n return target;\n}", "import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2';\n\n/**\n * Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js\n *\n * Do not require this module directly! Use normal throw error calls. These messages will be replaced with error codes\n * during build.\n * @param {number} code\n */\nfunction formatProdErrorMessage(code) {\n return \"Minified Redux error #\" + code + \"; visit https://redux.js.org/Errors?code=\" + code + \" for the full message or \" + 'use the non-minified dev environment for full errors. ';\n}\n\n// Inlined version of the `symbol-observable` polyfill\nvar $$observable = (function () {\n return typeof Symbol === 'function' && Symbol.observable || '@@observable';\n})();\n\n/**\n * These are private action types reserved by Redux.\n * For any unknown actions, you must return the current state.\n * If the current state is undefined, you must return the initial state.\n * Do not reference these action types directly in your code.\n */\nvar randomString = function randomString() {\n return Math.random().toString(36).substring(7).split('').join('.');\n};\n\nvar ActionTypes = {\n INIT: \"@@redux/INIT\" + randomString(),\n REPLACE: \"@@redux/REPLACE\" + randomString(),\n PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {\n return \"@@redux/PROBE_UNKNOWN_ACTION\" + randomString();\n }\n};\n\n/**\n * @param {any} obj The object to inspect.\n * @returns {boolean} True if the argument appears to be a plain object.\n */\nfunction isPlainObject(obj) {\n if (typeof obj !== 'object' || obj === null) return false;\n var proto = obj;\n\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n\n return Object.getPrototypeOf(obj) === proto;\n}\n\n// Inlined / shortened version of `kindOf` from https://github.com/jonschlinkert/kind-of\nfunction miniKindOf(val) {\n if (val === void 0) return 'undefined';\n if (val === null) return 'null';\n var type = typeof val;\n\n switch (type) {\n case 'boolean':\n case 'string':\n case 'number':\n case 'symbol':\n case 'function':\n {\n return type;\n }\n }\n\n if (Array.isArray(val)) return 'array';\n if (isDate(val)) return 'date';\n if (isError(val)) return 'error';\n var constructorName = ctorName(val);\n\n switch (constructorName) {\n case 'Symbol':\n case 'Promise':\n case 'WeakMap':\n case 'WeakSet':\n case 'Map':\n case 'Set':\n return constructorName;\n } // other\n\n\n return type.slice(8, -1).toLowerCase().replace(/\\s/g, '');\n}\n\nfunction ctorName(val) {\n return typeof val.constructor === 'function' ? val.constructor.name : null;\n}\n\nfunction isError(val) {\n return val instanceof Error || typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number';\n}\n\nfunction isDate(val) {\n if (val instanceof Date) return true;\n return typeof val.toDateString === 'function' && typeof val.getDate === 'function' && typeof val.setDate === 'function';\n}\n\nfunction kindOf(val) {\n var typeOfVal = typeof val;\n\n if (process.env.NODE_ENV !== 'production') {\n typeOfVal = miniKindOf(val);\n }\n\n return typeOfVal;\n}\n\n/**\n * Creates a Redux store that holds the state tree.\n * The only way to change the data in the store is to call `dispatch()` on it.\n *\n * There should only be a single store in your app. To specify how different\n * parts of the state tree respond to actions, you may combine several reducers\n * into a single reducer function by using `combineReducers`.\n *\n * @param {Function} reducer A function that returns the next state tree, given\n * the current state tree and the action to handle.\n *\n * @param {any} [preloadedState] The initial state. You may optionally specify it\n * to hydrate the state from the server in universal apps, or to restore a\n * previously serialized user session.\n * If you use `combineReducers` to produce the root reducer function, this must be\n * an object with the same shape as `combineReducers` keys.\n *\n * @param {Function} [enhancer] The store enhancer. You may optionally specify it\n * to enhance the store with third-party capabilities such as middleware,\n * time travel, persistence, etc. The only store enhancer that ships with Redux\n * is `applyMiddleware()`.\n *\n * @returns {Store} A Redux store that lets you read the state, dispatch actions\n * and subscribe to changes.\n */\n\nfunction createStore(reducer, preloadedState, enhancer) {\n var _ref2;\n\n if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(0) : 'It looks like you are passing several store enhancers to ' + 'createStore(). This is not supported. Instead, compose them ' + 'together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.');\n }\n\n if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {\n enhancer = preloadedState;\n preloadedState = undefined;\n }\n\n if (typeof enhancer !== 'undefined') {\n if (typeof enhancer !== 'function') {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(1) : \"Expected the enhancer to be a function. Instead, received: '\" + kindOf(enhancer) + \"'\");\n }\n\n return enhancer(createStore)(reducer, preloadedState);\n }\n\n if (typeof reducer !== 'function') {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(2) : \"Expected the root reducer to be a function. Instead, received: '\" + kindOf(reducer) + \"'\");\n }\n\n var currentReducer = reducer;\n var currentState = preloadedState;\n var currentListeners = [];\n var nextListeners = currentListeners;\n var isDispatching = false;\n /**\n * This makes a shallow copy of currentListeners so we can use\n * nextListeners as a temporary list while dispatching.\n *\n * This prevents any bugs around consumers calling\n * subscribe/unsubscribe in the middle of a dispatch.\n */\n\n function ensureCanMutateNextListeners() {\n if (nextListeners === currentListeners) {\n nextListeners = currentListeners.slice();\n }\n }\n /**\n * Reads the state tree managed by the store.\n *\n * @returns {any} The current state tree of your application.\n */\n\n\n function getState() {\n if (isDispatching) {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(3) : 'You may not call store.getState() while the reducer is executing. ' + 'The reducer has already received the state as an argument. ' + 'Pass it down from the top reducer instead of reading it from the store.');\n }\n\n return currentState;\n }\n /**\n * Adds a change listener. It will be called any time an action is dispatched,\n * and some part of the state tree may potentially have changed. You may then\n * call `getState()` to read the current state tree inside the callback.\n *\n * You may call `dispatch()` from a change listener, with the following\n * caveats:\n *\n * 1. The subscriptions are snapshotted just before every `dispatch()` call.\n * If you subscribe or unsubscribe while the listeners are being invoked, this\n * will not have any effect on the `dispatch()` that is currently in progress.\n * However, the next `dispatch()` call, whether nested or not, will use a more\n * recent snapshot of the subscription list.\n *\n * 2. The listener should not expect to see all state changes, as the state\n * might have been updated multiple times during a nested `dispatch()` before\n * the listener is called. It is, however, guaranteed that all subscribers\n * registered before the `dispatch()` started will be called with the latest\n * state by the time it exits.\n *\n * @param {Function} listener A callback to be invoked on every dispatch.\n * @returns {Function} A function to remove this change listener.\n */\n\n\n function subscribe(listener) {\n if (typeof listener !== 'function') {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(4) : \"Expected the listener to be a function. Instead, received: '\" + kindOf(listener) + \"'\");\n }\n\n if (isDispatching) {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(5) : 'You may not call store.subscribe() while the reducer is executing. ' + 'If you would like to be notified after the store has been updated, subscribe from a ' + 'component and invoke store.getState() in the callback to access the latest state. ' + 'See https://redux.js.org/api/store#subscribelistener for more details.');\n }\n\n var isSubscribed = true;\n ensureCanMutateNextListeners();\n nextListeners.push(listener);\n return function unsubscribe() {\n if (!isSubscribed) {\n return;\n }\n\n if (isDispatching) {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(6) : 'You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api/store#subscribelistener for more details.');\n }\n\n isSubscribed = false;\n ensureCanMutateNextListeners();\n var index = nextListeners.indexOf(listener);\n nextListeners.splice(index, 1);\n currentListeners = null;\n };\n }\n /**\n * Dispatches an action. It is the only way to trigger a state change.\n *\n * The `reducer` function, used to create the store, will be called with the\n * current state tree and the given `action`. Its return value will\n * be considered the **next** state of the tree, and the change listeners\n * will be notified.\n *\n * The base implementation only supports plain object actions. If you want to\n * dispatch a Promise, an Observable, a thunk, or something else, you need to\n * wrap your store creating function into the corresponding middleware. For\n * example, see the documentation for the `redux-thunk` package. Even the\n * middleware will eventually dispatch plain object actions using this method.\n *\n * @param {Object} action A plain object representing \u201Cwhat changed\u201D. It is\n * a good idea to keep actions serializable so you can record and replay user\n * sessions, or use the time travelling `redux-devtools`. An action must have\n * a `type` property which may not be `undefined`. It is a good idea to use\n * string constants for action types.\n *\n * @returns {Object} For convenience, the same action object you dispatched.\n *\n * Note that, if you use a custom middleware, it may wrap `dispatch()` to\n * return something else (for example, a Promise you can await).\n */\n\n\n function dispatch(action) {\n if (!isPlainObject(action)) {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(7) : \"Actions must be plain objects. Instead, the actual type was: '\" + kindOf(action) + \"'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.\");\n }\n\n if (typeof action.type === 'undefined') {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(8) : 'Actions may not have an undefined \"type\" property. You may have misspelled an action type string constant.');\n }\n\n if (isDispatching) {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(9) : 'Reducers may not dispatch actions.');\n }\n\n try {\n isDispatching = true;\n currentState = currentReducer(currentState, action);\n } finally {\n isDispatching = false;\n }\n\n var listeners = currentListeners = nextListeners;\n\n for (var i = 0; i < listeners.length; i++) {\n var listener = listeners[i];\n listener();\n }\n\n return action;\n }\n /**\n * Replaces the reducer currently used by the store to calculate the state.\n *\n * You might need this if your app implements code splitting and you want to\n * load some of the reducers dynamically. You might also need this if you\n * implement a hot reloading mechanism for Redux.\n *\n * @param {Function} nextReducer The reducer for the store to use instead.\n * @returns {void}\n */\n\n\n function replaceReducer(nextReducer) {\n if (typeof nextReducer !== 'function') {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(10) : \"Expected the nextReducer to be a function. Instead, received: '\" + kindOf(nextReducer));\n }\n\n currentReducer = nextReducer; // This action has a similiar effect to ActionTypes.INIT.\n // Any reducers that existed in both the new and old rootReducer\n // will receive the previous state. This effectively populates\n // the new state tree with any relevant data from the old one.\n\n dispatch({\n type: ActionTypes.REPLACE\n });\n }\n /**\n * Interoperability point for observable/reactive libraries.\n * @returns {observable} A minimal observable of state changes.\n * For more information, see the observable proposal:\n * https://github.com/tc39/proposal-observable\n */\n\n\n function observable() {\n var _ref;\n\n var outerSubscribe = subscribe;\n return _ref = {\n /**\n * The minimal observable subscription method.\n * @param {Object} observer Any object that can be used as an observer.\n * The observer object should have a `next` method.\n * @returns {subscription} An object with an `unsubscribe` method that can\n * be used to unsubscribe the observable from the store, and prevent further\n * emission of values from the observable.\n */\n subscribe: function subscribe(observer) {\n if (typeof observer !== 'object' || observer === null) {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(11) : \"Expected the observer to be an object. Instead, received: '\" + kindOf(observer) + \"'\");\n }\n\n function observeState() {\n if (observer.next) {\n observer.next(getState());\n }\n }\n\n observeState();\n var unsubscribe = outerSubscribe(observeState);\n return {\n unsubscribe: unsubscribe\n };\n }\n }, _ref[$$observable] = function () {\n return this;\n }, _ref;\n } // When a store is created, an \"INIT\" action is dispatched so that every\n // reducer returns their initial state. This effectively populates\n // the initial state tree.\n\n\n dispatch({\n type: ActionTypes.INIT\n });\n return _ref2 = {\n dispatch: dispatch,\n subscribe: subscribe,\n getState: getState,\n replaceReducer: replaceReducer\n }, _ref2[$$observable] = observable, _ref2;\n}\n\n/**\n * Prints a warning in the console if it exists.\n *\n * @param {String} message The warning message.\n * @returns {void}\n */\nfunction warning(message) {\n /* eslint-disable no-console */\n if (typeof console !== 'undefined' && typeof console.error === 'function') {\n console.error(message);\n }\n /* eslint-enable no-console */\n\n\n try {\n // This error was thrown as a convenience so that if you enable\n // \"break on all exceptions\" in your console,\n // it would pause the execution at this line.\n throw new Error(message);\n } catch (e) {} // eslint-disable-line no-empty\n\n}\n\nfunction getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {\n var reducerKeys = Object.keys(reducers);\n var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';\n\n if (reducerKeys.length === 0) {\n return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';\n }\n\n if (!isPlainObject(inputState)) {\n return \"The \" + argumentName + \" has unexpected type of \\\"\" + kindOf(inputState) + \"\\\". Expected argument to be an object with the following \" + (\"keys: \\\"\" + reducerKeys.join('\", \"') + \"\\\"\");\n }\n\n var unexpectedKeys = Object.keys(inputState).filter(function (key) {\n return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];\n });\n unexpectedKeys.forEach(function (key) {\n unexpectedKeyCache[key] = true;\n });\n if (action && action.type === ActionTypes.REPLACE) return;\n\n if (unexpectedKeys.length > 0) {\n return \"Unexpected \" + (unexpectedKeys.length > 1 ? 'keys' : 'key') + \" \" + (\"\\\"\" + unexpectedKeys.join('\", \"') + \"\\\" found in \" + argumentName + \". \") + \"Expected to find one of the known reducer keys instead: \" + (\"\\\"\" + reducerKeys.join('\", \"') + \"\\\". Unexpected keys will be ignored.\");\n }\n}\n\nfunction assertReducerShape(reducers) {\n Object.keys(reducers).forEach(function (key) {\n var reducer = reducers[key];\n var initialState = reducer(undefined, {\n type: ActionTypes.INIT\n });\n\n if (typeof initialState === 'undefined') {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(12) : \"The slice reducer for key \\\"\" + key + \"\\\" returned undefined during initialization. \" + \"If the state passed to the reducer is undefined, you must \" + \"explicitly return the initial state. The initial state may \" + \"not be undefined. If you don't want to set a value for this reducer, \" + \"you can use null instead of undefined.\");\n }\n\n if (typeof reducer(undefined, {\n type: ActionTypes.PROBE_UNKNOWN_ACTION()\n }) === 'undefined') {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(13) : \"The slice reducer for key \\\"\" + key + \"\\\" returned undefined when probed with a random type. \" + (\"Don't try to handle '\" + ActionTypes.INIT + \"' or other actions in \\\"redux/*\\\" \") + \"namespace. They are considered private. Instead, you must return the \" + \"current state for any unknown actions, unless it is undefined, \" + \"in which case you must return the initial state, regardless of the \" + \"action type. The initial state may not be undefined, but can be null.\");\n }\n });\n}\n/**\n * Turns an object whose values are different reducer functions, into a single\n * reducer function. It will call every child reducer, and gather their results\n * into a single state object, whose keys correspond to the keys of the passed\n * reducer functions.\n *\n * @param {Object} reducers An object whose values correspond to different\n * reducer functions that need to be combined into one. One handy way to obtain\n * it is to use ES6 `import * as reducers` syntax. The reducers may never return\n * undefined for any action. Instead, they should return their initial state\n * if the state passed to them was undefined, and the current state for any\n * unrecognized action.\n *\n * @returns {Function} A reducer function that invokes every reducer inside the\n * passed object, and builds a state object with the same shape.\n */\n\n\nfunction combineReducers(reducers) {\n var reducerKeys = Object.keys(reducers);\n var finalReducers = {};\n\n for (var i = 0; i < reducerKeys.length; i++) {\n var key = reducerKeys[i];\n\n if (process.env.NODE_ENV !== 'production') {\n if (typeof reducers[key] === 'undefined') {\n warning(\"No reducer provided for key \\\"\" + key + \"\\\"\");\n }\n }\n\n if (typeof reducers[key] === 'function') {\n finalReducers[key] = reducers[key];\n }\n }\n\n var finalReducerKeys = Object.keys(finalReducers); // This is used to make sure we don't warn about the same\n // keys multiple times.\n\n var unexpectedKeyCache;\n\n if (process.env.NODE_ENV !== 'production') {\n unexpectedKeyCache = {};\n }\n\n var shapeAssertionError;\n\n try {\n assertReducerShape(finalReducers);\n } catch (e) {\n shapeAssertionError = e;\n }\n\n return function combination(state, action) {\n if (state === void 0) {\n state = {};\n }\n\n if (shapeAssertionError) {\n throw shapeAssertionError;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);\n\n if (warningMessage) {\n warning(warningMessage);\n }\n }\n\n var hasChanged = false;\n var nextState = {};\n\n for (var _i = 0; _i < finalReducerKeys.length; _i++) {\n var _key = finalReducerKeys[_i];\n var reducer = finalReducers[_key];\n var previousStateForKey = state[_key];\n var nextStateForKey = reducer(previousStateForKey, action);\n\n if (typeof nextStateForKey === 'undefined') {\n var actionType = action && action.type;\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(14) : \"When called with an action of type \" + (actionType ? \"\\\"\" + String(actionType) + \"\\\"\" : '(unknown type)') + \", the slice reducer for key \\\"\" + _key + \"\\\" returned undefined. \" + \"To ignore an action, you must explicitly return the previous state. \" + \"If you want this reducer to hold no value, you can return null instead of undefined.\");\n }\n\n nextState[_key] = nextStateForKey;\n hasChanged = hasChanged || nextStateForKey !== previousStateForKey;\n }\n\n hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;\n return hasChanged ? nextState : state;\n };\n}\n\nfunction bindActionCreator(actionCreator, dispatch) {\n return function () {\n return dispatch(actionCreator.apply(this, arguments));\n };\n}\n/**\n * Turns an object whose values are action creators, into an object with the\n * same keys, but with every function wrapped into a `dispatch` call so they\n * may be invoked directly. This is just a convenience method, as you can call\n * `store.dispatch(MyActionCreators.doSomething())` yourself just fine.\n *\n * For convenience, you can also pass an action creator as the first argument,\n * and get a dispatch wrapped function in return.\n *\n * @param {Function|Object} actionCreators An object whose values are action\n * creator functions. One handy way to obtain it is to use ES6 `import * as`\n * syntax. You may also pass a single function.\n *\n * @param {Function} dispatch The `dispatch` function available on your Redux\n * store.\n *\n * @returns {Function|Object} The object mimicking the original object, but with\n * every action creator wrapped into the `dispatch` call. If you passed a\n * function as `actionCreators`, the return value will also be a single\n * function.\n */\n\n\nfunction bindActionCreators(actionCreators, dispatch) {\n if (typeof actionCreators === 'function') {\n return bindActionCreator(actionCreators, dispatch);\n }\n\n if (typeof actionCreators !== 'object' || actionCreators === null) {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(16) : \"bindActionCreators expected an object or a function, but instead received: '\" + kindOf(actionCreators) + \"'. \" + \"Did you write \\\"import ActionCreators from\\\" instead of \\\"import * as ActionCreators from\\\"?\");\n }\n\n var boundActionCreators = {};\n\n for (var key in actionCreators) {\n var actionCreator = actionCreators[key];\n\n if (typeof actionCreator === 'function') {\n boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);\n }\n }\n\n return boundActionCreators;\n}\n\n/**\n * Composes single-argument functions from right to left. The rightmost\n * function can take multiple arguments as it provides the signature for\n * the resulting composite function.\n *\n * @param {...Function} funcs The functions to compose.\n * @returns {Function} A function obtained by composing the argument functions\n * from right to left. For example, compose(f, g, h) is identical to doing\n * (...args) => f(g(h(...args))).\n */\nfunction compose() {\n for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {\n funcs[_key] = arguments[_key];\n }\n\n if (funcs.length === 0) {\n return function (arg) {\n return arg;\n };\n }\n\n if (funcs.length === 1) {\n return funcs[0];\n }\n\n return funcs.reduce(function (a, b) {\n return function () {\n return a(b.apply(void 0, arguments));\n };\n });\n}\n\n/**\n * Creates a store enhancer that applies middleware to the dispatch method\n * of the Redux store. This is handy for a variety of tasks, such as expressing\n * asynchronous actions in a concise manner, or logging every action payload.\n *\n * See `redux-thunk` package as an example of the Redux middleware.\n *\n * Because middleware is potentially asynchronous, this should be the first\n * store enhancer in the composition chain.\n *\n * Note that each middleware will be given the `dispatch` and `getState` functions\n * as named arguments.\n *\n * @param {...Function} middlewares The middleware chain to be applied.\n * @returns {Function} A store enhancer applying the middleware.\n */\n\nfunction applyMiddleware() {\n for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {\n middlewares[_key] = arguments[_key];\n }\n\n return function (createStore) {\n return function () {\n var store = createStore.apply(void 0, arguments);\n\n var _dispatch = function dispatch() {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(15) : 'Dispatching while constructing your middleware is not allowed. ' + 'Other middleware would not be applied to this dispatch.');\n };\n\n var middlewareAPI = {\n getState: store.getState,\n dispatch: function dispatch() {\n return _dispatch.apply(void 0, arguments);\n }\n };\n var chain = middlewares.map(function (middleware) {\n return middleware(middlewareAPI);\n });\n _dispatch = compose.apply(void 0, chain)(store.dispatch);\n return _objectSpread(_objectSpread({}, store), {}, {\n dispatch: _dispatch\n });\n };\n };\n}\n\n/*\n * This is a dummy function to check if the function name has been altered by minification.\n * If the function has been minified and NODE_ENV !== 'production', warn the user.\n */\n\nfunction isCrushed() {}\n\nif (process.env.NODE_ENV !== 'production' && typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') {\n warning('You are currently using minified code outside of NODE_ENV === \"production\". ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or setting mode to production in webpack (https://webpack.js.org/concepts/mode/) ' + 'to ensure you have the correct code for your production build.');\n}\n\nexport { ActionTypes as __DO_NOT_USE__ActionTypes, applyMiddleware, bindActionCreators, combineReducers, compose, createStore };\n", "/** A function that accepts a potential \"extra argument\" value to be injected later,\r\n * and returns an instance of the thunk middleware that uses that value\r\n */\nfunction createThunkMiddleware(extraArgument) {\n // Standard Redux middleware definition pattern:\n // See: https://redux.js.org/tutorials/fundamentals/part-4-store#writing-custom-middleware\n var middleware = function middleware(_ref) {\n var dispatch = _ref.dispatch,\n getState = _ref.getState;\n return function (next) {\n return function (action) {\n // The thunk middleware looks for any functions that were passed to `store.dispatch`.\n // If this \"action\" is really a function, call it and return the result.\n if (typeof action === 'function') {\n // Inject the store's `dispatch` and `getState` methods, as well as any \"extra arg\"\n return action(dispatch, getState, extraArgument);\n } // Otherwise, pass the action down the middleware chain as usual\n\n\n return next(action);\n };\n };\n };\n\n return middleware;\n}\n\nvar thunk = createThunkMiddleware(); // Attach the factory function so users can create a customized version\n// with whatever \"extra arg\" they want to inject into their thunks\n\nthunk.withExtraArgument = createThunkMiddleware;\nexport default thunk;", "import { enableES5 } from 'immer'\r\nexport * from 'redux'\r\nexport {\r\n default as createNextState,\r\n current,\r\n freeze,\r\n original,\r\n isDraft,\r\n} from 'immer'\r\nexport type { Draft } from 'immer'\r\nexport { createSelector } from 'reselect'\r\nexport type {\r\n Selector,\r\n OutputParametricSelector,\r\n OutputSelector,\r\n ParametricSelector,\r\n} from 'reselect'\r\nexport { createDraftSafeSelector } from './createDraftSafeSelector'\r\nexport type { ThunkAction, ThunkDispatch } from 'redux-thunk'\r\n\r\n// We deliberately enable Immer's ES5 support, on the grounds that\r\n// we assume RTK will be used with React Native and other Proxy-less\r\n// environments. In addition, that's how Immer 4 behaved, and since\r\n// we want to ship this in an RTK minor, we should keep the same behavior.\r\nenableES5()\r\n\r\nexport {\r\n // js\r\n configureStore,\r\n} from './configureStore'\r\nexport type {\r\n // types\r\n ConfigureEnhancersCallback,\r\n ConfigureStoreOptions,\r\n EnhancedStore,\r\n} from './configureStore'\r\nexport {\r\n // js\r\n createAction,\r\n getType,\r\n} from './createAction'\r\nexport type {\r\n // types\r\n PayloadAction,\r\n PayloadActionCreator,\r\n ActionCreatorWithNonInferrablePayload,\r\n ActionCreatorWithOptionalPayload,\r\n ActionCreatorWithPayload,\r\n ActionCreatorWithoutPayload,\r\n ActionCreatorWithPreparedPayload,\r\n PrepareAction,\r\n} from './createAction'\r\nexport {\r\n // js\r\n createReducer,\r\n} from './createReducer'\r\nexport type {\r\n // types\r\n Actions,\r\n CaseReducer,\r\n CaseReducers,\r\n} from './createReducer'\r\nexport {\r\n // js\r\n createSlice,\r\n} from './createSlice'\r\n\r\nexport type {\r\n // types\r\n CreateSliceOptions,\r\n Slice,\r\n CaseReducerActions,\r\n SliceCaseReducers,\r\n ValidateSliceCaseReducers,\r\n CaseReducerWithPrepare,\r\n SliceActionCreator,\r\n} from './createSlice'\r\nexport {\r\n // js\r\n createImmutableStateInvariantMiddleware,\r\n isImmutableDefault,\r\n} from './immutableStateInvariantMiddleware'\r\nexport type {\r\n // types\r\n ImmutableStateInvariantMiddlewareOptions,\r\n} from './immutableStateInvariantMiddleware'\r\nexport {\r\n // js\r\n createSerializableStateInvariantMiddleware,\r\n findNonSerializableValue,\r\n isPlain,\r\n} from './serializableStateInvariantMiddleware'\r\nexport type {\r\n // types\r\n SerializableStateInvariantMiddlewareOptions,\r\n} from './serializableStateInvariantMiddleware'\r\nexport {\r\n // js\r\n getDefaultMiddleware,\r\n} from './getDefaultMiddleware'\r\nexport type {\r\n // types\r\n ActionReducerMapBuilder,\r\n} from './mapBuilders'\r\nexport { MiddlewareArray } from './utils'\r\n\r\nexport { createEntityAdapter } from './entities/create_adapter'\r\nexport type {\r\n Dictionary,\r\n EntityState,\r\n EntityAdapter,\r\n EntitySelectors,\r\n EntityStateAdapter,\r\n EntityId,\r\n Update,\r\n IdSelector,\r\n Comparer,\r\n} from './entities/models'\r\n\r\nexport {\r\n createAsyncThunk,\r\n unwrapResult,\r\n miniSerializeError,\r\n} from './createAsyncThunk'\r\nexport type {\r\n AsyncThunk,\r\n AsyncThunkOptions,\r\n AsyncThunkAction,\r\n AsyncThunkPayloadCreatorReturnValue,\r\n AsyncThunkPayloadCreator,\r\n SerializedError,\r\n} from './createAsyncThunk'\r\n\r\nexport {\r\n // js\r\n isAllOf,\r\n isAnyOf,\r\n isPending,\r\n isRejected,\r\n isFulfilled,\r\n isAsyncThunkAction,\r\n isRejectedWithValue,\r\n} from './matchers'\r\nexport type {\r\n // types\r\n ActionMatchingAllOf,\r\n ActionMatchingAnyOf,\r\n} from './matchers'\r\n\r\nexport { nanoid } from './nanoid'\r\n\r\nexport { default as isPlainObject } from './isPlainObject'\r\n", "import { current, isDraft } from 'immer'\r\nimport { createSelector } from 'reselect'\r\n\r\n/**\r\n * \"Draft-Safe\" version of `reselect`'s `createSelector`:\r\n * If an `immer`-drafted object is passed into the resulting selector's first argument,\r\n * the selector will act on the current draft value, instead of returning a cached value\r\n * that might be possibly outdated if the draft has been modified since.\r\n * @public\r\n */\r\nexport const createDraftSafeSelector: typeof createSelector = (\r\n ...args: unknown[]\r\n) => {\r\n const selector = (createSelector as any)(...args)\r\n const wrappedSelector = (value: unknown, ...rest: unknown[]) =>\r\n selector(isDraft(value) ? current(value) : value, ...rest)\r\n return wrappedSelector as any\r\n}\r\n", "import type {\r\n Reducer,\r\n ReducersMapObject,\r\n Middleware,\r\n Action,\r\n AnyAction,\r\n StoreEnhancer,\r\n Store,\r\n Dispatch,\r\n PreloadedState,\r\n CombinedState,\r\n} from 'redux'\r\nimport { createStore, compose, applyMiddleware, combineReducers } from 'redux'\r\nimport type { EnhancerOptions as DevToolsOptions } from './devtoolsExtension'\r\nimport { composeWithDevTools } from './devtoolsExtension'\r\n\r\nimport isPlainObject from './isPlainObject'\r\nimport type {\r\n ThunkMiddlewareFor,\r\n CurriedGetDefaultMiddleware,\r\n} from './getDefaultMiddleware'\r\nimport { curryGetDefaultMiddleware } from './getDefaultMiddleware'\r\nimport type { DispatchForMiddlewares, NoInfer } from './tsHelpers'\r\n\r\nconst IS_PRODUCTION = process.env.NODE_ENV === 'production'\r\n\r\n/**\r\n * Callback function type, to be used in `ConfigureStoreOptions.enhancers`\r\n *\r\n * @public\r\n */\r\nexport type ConfigureEnhancersCallback = (\r\n defaultEnhancers: readonly StoreEnhancer[]\r\n) => StoreEnhancer[]\r\n\r\n/**\r\n * Options for `configureStore()`.\r\n *\r\n * @public\r\n */\r\nexport interface ConfigureStoreOptions<\r\n S = any,\r\n A extends Action = AnyAction,\r\n M extends Middlewares = Middlewares\r\n> {\r\n /**\r\n * A single reducer function that will be used as the root reducer, or an\r\n * object of slice reducers that will be passed to `combineReducers()`.\r\n */\r\n reducer: Reducer | ReducersMapObject\r\n\r\n /**\r\n * An array of Redux middleware to install. If not supplied, defaults to\r\n * the set of middleware returned by `getDefaultMiddleware()`.\r\n */\r\n middleware?: ((getDefaultMiddleware: CurriedGetDefaultMiddleware) => M) | M\r\n\r\n /**\r\n * Whether to enable Redux DevTools integration. Defaults to `true`.\r\n *\r\n * Additional configuration can be done by passing Redux DevTools options\r\n */\r\n devTools?: boolean | DevToolsOptions\r\n\r\n /**\r\n * The initial state, same as Redux's createStore.\r\n * You may optionally specify it to hydrate the state\r\n * from the server in universal apps, or to restore a previously serialized\r\n * user session. If you use `combineReducers()` to produce the root reducer\r\n * function (either directly or indirectly by passing an object as `reducer`),\r\n * this must be an object with the same shape as the reducer map keys.\r\n */\r\n /* \r\n Not 100% correct but the best approximation we can get:\r\n - if S is a `CombinedState` applying a second `CombinedState` on it does not change anything.\r\n - if it is not, there could be two cases:\r\n - `ReducersMapObject` is being passed in. In this case, we will call `combineReducers` on it and `CombinedState` is correct\r\n - `Reducer` is being passed in. In this case, actually `CombinedState` is wrong and `S` would be correct.\r\n As we cannot distinguish between those two cases without adding another generic paramter, \r\n we just make the pragmatic assumption that the latter almost never happens.\r\n */\r\n preloadedState?: PreloadedState>>\r\n\r\n /**\r\n * The store enhancers to apply. See Redux's `createStore()`.\r\n * All enhancers will be included before the DevTools Extension enhancer.\r\n * If you need to customize the order of enhancers, supply a callback\r\n * function that will receive the original array (ie, `[applyMiddleware]`),\r\n * and should return a new array (such as `[applyMiddleware, offline]`).\r\n * If you only need to add middleware, you can use the `middleware` parameter instead.\r\n */\r\n enhancers?: StoreEnhancer[] | ConfigureEnhancersCallback\r\n}\r\n\r\ntype Middlewares = ReadonlyArray>\r\n\r\n/**\r\n * A Redux store returned by `configureStore()`. Supports dispatching\r\n * side-effectful _thunks_ in addition to plain actions.\r\n *\r\n * @public\r\n */\r\nexport interface EnhancedStore<\r\n S = any,\r\n A extends Action = AnyAction,\r\n M extends Middlewares = Middlewares\r\n> extends Store {\r\n /**\r\n * The `dispatch` method of your store, enhanced by all its middlewares.\r\n *\r\n * @inheritdoc\r\n */\r\n dispatch: Dispatch & DispatchForMiddlewares\r\n}\r\n\r\n/**\r\n * A friendly abstraction over the standard Redux `createStore()` function.\r\n *\r\n * @param config The store configuration.\r\n * @returns A configured Redux store.\r\n *\r\n * @public\r\n */\r\nexport function configureStore<\r\n S = any,\r\n A extends Action = AnyAction,\r\n M extends Middlewares = [ThunkMiddlewareFor]\r\n>(options: ConfigureStoreOptions): EnhancedStore {\r\n const curriedGetDefaultMiddleware = curryGetDefaultMiddleware()\r\n\r\n const {\r\n reducer = undefined,\r\n middleware = curriedGetDefaultMiddleware(),\r\n devTools = true,\r\n preloadedState = undefined,\r\n enhancers = undefined,\r\n } = options || {}\r\n\r\n let rootReducer: Reducer\r\n\r\n if (typeof reducer === 'function') {\r\n rootReducer = reducer\r\n } else if (isPlainObject(reducer)) {\r\n rootReducer = combineReducers(reducer)\r\n } else {\r\n throw new Error(\r\n '\"reducer\" is a required argument, and must be a function or an object of functions that can be passed to combineReducers'\r\n )\r\n }\r\n\r\n let finalMiddleware = middleware\r\n if (typeof finalMiddleware === 'function') {\r\n finalMiddleware = finalMiddleware(curriedGetDefaultMiddleware)\r\n\r\n if (!IS_PRODUCTION && !Array.isArray(finalMiddleware)) {\r\n throw new Error(\r\n 'when using a middleware builder function, an array of middleware must be returned'\r\n )\r\n }\r\n }\r\n if (\r\n !IS_PRODUCTION &&\r\n finalMiddleware.some((item) => typeof item !== 'function')\r\n ) {\r\n throw new Error(\r\n 'each middleware provided to configureStore must be a function'\r\n )\r\n }\r\n\r\n const middlewareEnhancer = applyMiddleware(...finalMiddleware)\r\n\r\n let finalCompose = compose\r\n\r\n if (devTools) {\r\n finalCompose = composeWithDevTools({\r\n // Enable capture of stack traces for dispatched Redux actions\r\n trace: !IS_PRODUCTION,\r\n ...(typeof devTools === 'object' && devTools),\r\n })\r\n }\r\n\r\n let storeEnhancers: StoreEnhancer[] = [middlewareEnhancer]\r\n\r\n if (Array.isArray(enhancers)) {\r\n storeEnhancers = [middlewareEnhancer, ...enhancers]\r\n } else if (typeof enhancers === 'function') {\r\n storeEnhancers = enhancers(storeEnhancers)\r\n }\r\n\r\n const composedEnhancer = finalCompose(...storeEnhancers) as any\r\n\r\n return createStore(rootReducer, preloadedState, composedEnhancer)\r\n}\r\n", "import type { Action, ActionCreator, StoreEnhancer } from 'redux'\r\nimport { compose } from 'redux'\r\n\r\n/**\r\n * @public\r\n */\r\nexport interface EnhancerOptions {\r\n /**\r\n * the instance name to be showed on the monitor page. Default value is `document.title`.\r\n * If not specified and there's no document title, it will consist of `tabId` and `instanceId`.\r\n */\r\n name?: string\r\n /**\r\n * action creators functions to be available in the Dispatcher.\r\n */\r\n actionCreators?: ActionCreator[] | { [key: string]: ActionCreator }\r\n /**\r\n * if more than one action is dispatched in the indicated interval, all new actions will be collected and sent at once.\r\n * It is the joint between performance and speed. When set to `0`, all actions will be sent instantly.\r\n * Set it to a higher value when experiencing perf issues (also `maxAge` to a lower value).\r\n *\r\n * @default 500 ms.\r\n */\r\n latency?: number\r\n /**\r\n * (> 1) - maximum allowed actions to be stored in the history tree. The oldest actions are removed once maxAge is reached. It's critical for performance.\r\n *\r\n * @default 50\r\n */\r\n maxAge?: number\r\n /**\r\n * See detailed documentation at http://extension.remotedev.io/docs/API/Arguments.html#serialize\r\n */\r\n serialize?:\r\n | boolean\r\n | {\r\n options?:\r\n | boolean\r\n | {\r\n date?: boolean\r\n regex?: boolean\r\n undefined?: boolean\r\n error?: boolean\r\n symbol?: boolean\r\n map?: boolean\r\n set?: boolean\r\n function?: boolean | Function\r\n }\r\n replacer?: (key: string, value: unknown) => unknown\r\n reviver?: (key: string, value: unknown) => unknown\r\n immutable?: unknown\r\n refs?: unknown[]\r\n }\r\n /**\r\n * function which takes `action` object and id number as arguments, and should return `action` object back.\r\n */\r\n actionSanitizer?: (action: A, id: number) => A\r\n /**\r\n * function which takes `state` object and index as arguments, and should return `state` object back.\r\n */\r\n stateSanitizer?: (state: S, index: number) => S\r\n /**\r\n * *string or array of strings as regex* - actions types to be hidden / shown in the monitors (while passed to the reducers).\r\n * If `actionsWhitelist` specified, `actionsBlacklist` is ignored.\r\n */\r\n actionsBlacklist?: string | string[]\r\n /**\r\n * *string or array of strings as regex* - actions types to be hidden / shown in the monitors (while passed to the reducers).\r\n * If `actionsWhitelist` specified, `actionsBlacklist` is ignored.\r\n */\r\n actionsWhitelist?: string | string[]\r\n /**\r\n * called for every action before sending, takes `state` and `action` object, and returns `true` in case it allows sending the current data to the monitor.\r\n * Use it as a more advanced version of `actionsBlacklist`/`actionsWhitelist` parameters.\r\n */\r\n predicate?: (state: S, action: A) => boolean\r\n /**\r\n * if specified as `false`, it will not record the changes till clicking on `Start recording` button.\r\n * Available only for Redux enhancer, for others use `autoPause`.\r\n *\r\n * @default true\r\n */\r\n shouldRecordChanges?: boolean\r\n /**\r\n * if specified, whenever clicking on `Pause recording` button and there are actions in the history log, will add this action type.\r\n * If not specified, will commit when paused. Available only for Redux enhancer.\r\n *\r\n * @default \"@@PAUSED\"\"\r\n */\r\n pauseActionType?: string\r\n /**\r\n * auto pauses when the extension\u2019s window is not opened, and so has zero impact on your app when not in use.\r\n * Not available for Redux enhancer (as it already does it but storing the data to be sent).\r\n *\r\n * @default false\r\n */\r\n autoPause?: boolean\r\n /**\r\n * if specified as `true`, it will not allow any non-monitor actions to be dispatched till clicking on `Unlock changes` button.\r\n * Available only for Redux enhancer.\r\n *\r\n * @default false\r\n */\r\n shouldStartLocked?: boolean\r\n /**\r\n * if set to `false`, will not recompute the states on hot reloading (or on replacing the reducers). Available only for Redux enhancer.\r\n *\r\n * @default true\r\n */\r\n shouldHotReload?: boolean\r\n /**\r\n * if specified as `true`, whenever there's an exception in reducers, the monitors will show the error message, and next actions will not be dispatched.\r\n *\r\n * @default false\r\n */\r\n shouldCatchErrors?: boolean\r\n /**\r\n * If you want to restrict the extension, specify the features you allow.\r\n * If not specified, all of the features are enabled. When set as an object, only those included as `true` will be allowed.\r\n * Note that except `true`/`false`, `import` and `export` can be set as `custom` (which is by default for Redux enhancer), meaning that the importing/exporting occurs on the client side.\r\n * Otherwise, you'll get/set the data right from the monitor part.\r\n */\r\n features?: {\r\n /**\r\n * start/pause recording of dispatched actions\r\n */\r\n pause?: boolean\r\n /**\r\n * lock/unlock dispatching actions and side effects\r\n */\r\n lock?: boolean\r\n /**\r\n * persist states on page reloading\r\n */\r\n persist?: boolean\r\n /**\r\n * export history of actions in a file\r\n */\r\n export?: boolean | 'custom'\r\n /**\r\n * import history of actions from a file\r\n */\r\n import?: boolean | 'custom'\r\n /**\r\n * jump back and forth (time travelling)\r\n */\r\n jump?: boolean\r\n /**\r\n * skip (cancel) actions\r\n */\r\n skip?: boolean\r\n /**\r\n * drag and drop actions in the history list\r\n */\r\n reorder?: boolean\r\n /**\r\n * dispatch custom actions or action creators\r\n */\r\n dispatch?: boolean\r\n /**\r\n * generate tests for the selected actions\r\n */\r\n test?: boolean\r\n }\r\n /**\r\n * Set to true or a stacktrace-returning function to record call stack traces for dispatched actions.\r\n * Defaults to false.\r\n */\r\n trace?: boolean | ((action: A) => string)\r\n /**\r\n * The maximum number of stack trace entries to record per action. Defaults to 10.\r\n */\r\n traceLimit?: number\r\n}\r\n\r\n/**\r\n * @public\r\n */\r\nexport const composeWithDevTools: {\r\n (options: EnhancerOptions): typeof compose\r\n (...funcs: Array>): StoreEnhancer\r\n} =\r\n typeof window !== 'undefined' &&\r\n (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__\r\n ? (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__\r\n : function () {\r\n if (arguments.length === 0) return undefined\r\n if (typeof arguments[0] === 'object') return compose\r\n return compose.apply(null, arguments as any as Function[])\r\n }\r\n\r\n/**\r\n * @public\r\n */\r\nexport const devToolsEnhancer: {\r\n (options: EnhancerOptions): StoreEnhancer\r\n} =\r\n typeof window !== 'undefined' && (window as any).__REDUX_DEVTOOLS_EXTENSION__\r\n ? (window as any).__REDUX_DEVTOOLS_EXTENSION__\r\n : function () {\r\n return function (noop) {\r\n return noop\r\n }\r\n }\r\n", "/**\r\n * Returns true if the passed value is \"plain\" object, i.e. an object whose\r\n * prototype is the root `Object.prototype`. This includes objects created\r\n * using object literals, but not for instance for class instances.\r\n *\r\n * @param {any} value The value to inspect.\r\n * @returns {boolean} True if the argument appears to be a plain object.\r\n *\r\n * @public\r\n */\r\nexport default function isPlainObject(value: unknown): value is object {\r\n if (typeof value !== 'object' || value === null) return false\r\n\r\n let proto = Object.getPrototypeOf(value)\r\n if (proto === null) return true\r\n\r\n let baseProto = proto\r\n while (Object.getPrototypeOf(baseProto) !== null) {\r\n baseProto = Object.getPrototypeOf(baseProto)\r\n }\r\n\r\n return proto === baseProto\r\n}\r\n", "import type { Middleware, AnyAction } from 'redux'\r\nimport type { ThunkMiddleware } from 'redux-thunk'\r\nimport thunkMiddleware from 'redux-thunk'\r\nimport type { ImmutableStateInvariantMiddlewareOptions } from './immutableStateInvariantMiddleware'\r\n/* PROD_START_REMOVE_UMD */\r\nimport { createImmutableStateInvariantMiddleware } from './immutableStateInvariantMiddleware'\r\n/* PROD_STOP_REMOVE_UMD */\r\n\r\nimport type { SerializableStateInvariantMiddlewareOptions } from './serializableStateInvariantMiddleware'\r\nimport { createSerializableStateInvariantMiddleware } from './serializableStateInvariantMiddleware'\r\nimport { MiddlewareArray } from './utils'\r\n\r\nfunction isBoolean(x: any): x is boolean {\r\n return typeof x === 'boolean'\r\n}\r\n\r\ninterface ThunkOptions {\r\n extraArgument: E\r\n}\r\n\r\ninterface GetDefaultMiddlewareOptions {\r\n thunk?: boolean | ThunkOptions\r\n immutableCheck?: boolean | ImmutableStateInvariantMiddlewareOptions\r\n serializableCheck?: boolean | SerializableStateInvariantMiddlewareOptions\r\n}\r\n\r\nexport type ThunkMiddlewareFor<\r\n S,\r\n O extends GetDefaultMiddlewareOptions = {}\r\n> = O extends {\r\n thunk: false\r\n}\r\n ? never\r\n : O extends { thunk: { extraArgument: infer E } }\r\n ? ThunkMiddleware\r\n :\r\n | ThunkMiddleware //The ThunkMiddleware with a `null` ExtraArgument is here to provide backwards-compatibility.\r\n | ThunkMiddleware\r\n\r\nexport type CurriedGetDefaultMiddleware = <\r\n O extends Partial = {\r\n thunk: true\r\n immutableCheck: true\r\n serializableCheck: true\r\n }\r\n>(\r\n options?: O\r\n) => MiddlewareArray | ThunkMiddlewareFor>\r\n\r\nexport function curryGetDefaultMiddleware<\r\n S = any\r\n>(): CurriedGetDefaultMiddleware {\r\n return function curriedGetDefaultMiddleware(options) {\r\n return getDefaultMiddleware(options)\r\n }\r\n}\r\n\r\n/**\r\n * Returns any array containing the default middleware installed by\r\n * `configureStore()`. Useful if you want to configure your store with a custom\r\n * `middleware` array but still keep the default set.\r\n *\r\n * @return The default middleware used by `configureStore()`.\r\n *\r\n * @public\r\n *\r\n * @deprecated Prefer to use the callback notation for the `middleware` option in `configureStore`\r\n * to access a pre-typed `getDefaultMiddleware` instead.\r\n */\r\nexport function getDefaultMiddleware<\r\n S = any,\r\n O extends Partial = {\r\n thunk: true\r\n immutableCheck: true\r\n serializableCheck: true\r\n }\r\n>(\r\n options: O = {} as O\r\n): MiddlewareArray | ThunkMiddlewareFor> {\r\n const {\r\n thunk = true,\r\n immutableCheck = true,\r\n serializableCheck = true,\r\n } = options\r\n\r\n let middlewareArray: Middleware<{}, S>[] = new MiddlewareArray()\r\n\r\n if (thunk) {\r\n if (isBoolean(thunk)) {\r\n middlewareArray.push(thunkMiddleware)\r\n } else {\r\n middlewareArray.push(\r\n thunkMiddleware.withExtraArgument(thunk.extraArgument)\r\n )\r\n }\r\n }\r\n\r\n if (process.env.NODE_ENV !== 'production') {\r\n if (immutableCheck) {\r\n /* PROD_START_REMOVE_UMD */\r\n let immutableOptions: ImmutableStateInvariantMiddlewareOptions = {}\r\n\r\n if (!isBoolean(immutableCheck)) {\r\n immutableOptions = immutableCheck\r\n }\r\n\r\n middlewareArray.unshift(\r\n createImmutableStateInvariantMiddleware(immutableOptions)\r\n )\r\n /* PROD_STOP_REMOVE_UMD */\r\n }\r\n\r\n if (serializableCheck) {\r\n let serializableOptions: SerializableStateInvariantMiddlewareOptions = {}\r\n\r\n if (!isBoolean(serializableCheck)) {\r\n serializableOptions = serializableCheck\r\n }\r\n\r\n middlewareArray.push(\r\n createSerializableStateInvariantMiddleware(serializableOptions)\r\n )\r\n }\r\n }\r\n\r\n return middlewareArray as any\r\n}\r\n", "import type { Middleware } from 'redux'\r\n\r\nexport function getTimeMeasureUtils(maxDelay: number, fnName: string) {\r\n let elapsed = 0\r\n return {\r\n measureTime(fn: () => T): T {\r\n const started = Date.now()\r\n try {\r\n return fn()\r\n } finally {\r\n const finished = Date.now()\r\n elapsed += finished - started\r\n }\r\n },\r\n warnIfExceeded() {\r\n if (elapsed > maxDelay) {\r\n console.warn(`${fnName} took ${elapsed}ms, which is more than the warning threshold of ${maxDelay}ms. \r\nIf your state or actions are very large, you may want to disable the middleware as it might cause too much of a slowdown in development mode. See https://redux-toolkit.js.org/api/getDefaultMiddleware for instructions.\r\nIt is disabled in production builds, so you don't need to worry about that.`)\r\n }\r\n },\r\n }\r\n}\r\n\r\n/**\r\n * @public\r\n */\r\nexport class MiddlewareArray<\r\n Middlewares extends Middleware\r\n> extends Array {\r\n constructor(arrayLength?: number)\r\n constructor(...items: Middlewares[])\r\n constructor(...args: any[]) {\r\n super(...args)\r\n Object.setPrototypeOf(this, MiddlewareArray.prototype)\r\n }\r\n\r\n static get [Symbol.species]() {\r\n return MiddlewareArray as any\r\n }\r\n\r\n concat>>(\r\n items: AdditionalMiddlewares\r\n ): MiddlewareArray\r\n\r\n concat>>(\r\n ...items: AdditionalMiddlewares\r\n ): MiddlewareArray\r\n concat(...arr: any[]) {\r\n return super.concat.apply(this, arr)\r\n }\r\n\r\n prepend>>(\r\n items: AdditionalMiddlewares\r\n ): MiddlewareArray\r\n\r\n prepend>>(\r\n ...items: AdditionalMiddlewares\r\n ): MiddlewareArray\r\n\r\n prepend(...arr: any[]) {\r\n if (arr.length === 1 && Array.isArray(arr[0])) {\r\n return new MiddlewareArray(...arr[0].concat(this))\r\n }\r\n return new MiddlewareArray(...arr.concat(this))\r\n }\r\n}\r\n", "import type { Middleware } from 'redux'\r\nimport { getTimeMeasureUtils } from './utils'\r\n\r\ntype EntryProcessor = (key: string, value: any) => any\r\n\r\nconst isProduction: boolean = process.env.NODE_ENV === 'production'\r\nconst prefix: string = 'Invariant failed'\r\n\r\n// Throw an error if the condition fails\r\n// Strip out error messages for production\r\n// > Not providing an inline default argument for message as the result is smaller\r\nfunction invariant(condition: any, message?: string) {\r\n if (condition) {\r\n return\r\n }\r\n // Condition not passed\r\n\r\n // In production we strip the message but still throw\r\n if (isProduction) {\r\n throw new Error(prefix)\r\n }\r\n\r\n // When not in production we allow the message to pass through\r\n // *This block will be removed in production builds*\r\n throw new Error(`${prefix}: ${message || ''}`)\r\n}\r\n\r\nfunction stringify(\r\n obj: any,\r\n serializer?: EntryProcessor,\r\n indent?: string | number,\r\n decycler?: EntryProcessor\r\n): string {\r\n return JSON.stringify(obj, getSerialize(serializer, decycler), indent)\r\n}\r\n\r\nfunction getSerialize(\r\n serializer?: EntryProcessor,\r\n decycler?: EntryProcessor\r\n): EntryProcessor {\r\n let stack: any[] = [],\r\n keys: any[] = []\r\n\r\n if (!decycler)\r\n decycler = function (_: string, value: any) {\r\n if (stack[0] === value) return '[Circular ~]'\r\n return (\r\n '[Circular ~.' + keys.slice(0, stack.indexOf(value)).join('.') + ']'\r\n )\r\n }\r\n\r\n return function (this: any, key: string, value: any) {\r\n if (stack.length > 0) {\r\n var thisPos = stack.indexOf(this)\r\n ~thisPos ? stack.splice(thisPos + 1) : stack.push(this)\r\n ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key)\r\n if (~stack.indexOf(value)) value = decycler!.call(this, key, value)\r\n } else stack.push(value)\r\n\r\n return serializer == null ? value : serializer.call(this, key, value)\r\n }\r\n}\r\n\r\n/**\r\n * The default `isImmutable` function.\r\n *\r\n * @public\r\n */\r\nexport function isImmutableDefault(value: unknown): boolean {\r\n return (\r\n typeof value !== 'object' ||\r\n value === null ||\r\n typeof value === 'undefined' ||\r\n Object.isFrozen(value)\r\n )\r\n}\r\n\r\nexport function trackForMutations(\r\n isImmutable: IsImmutableFunc,\r\n ignorePaths: string[] | undefined,\r\n obj: any\r\n) {\r\n const trackedProperties = trackProperties(isImmutable, ignorePaths, obj)\r\n return {\r\n detectMutations() {\r\n return detectMutations(isImmutable, ignorePaths, trackedProperties, obj)\r\n },\r\n }\r\n}\r\n\r\ninterface TrackedProperty {\r\n value: any\r\n children: Record\r\n}\r\n\r\nfunction trackProperties(\r\n isImmutable: IsImmutableFunc,\r\n ignorePaths: IgnorePaths = [],\r\n obj: Record,\r\n path: string = ''\r\n) {\r\n const tracked: Partial = { value: obj }\r\n\r\n if (!isImmutable(obj)) {\r\n tracked.children = {}\r\n\r\n for (const key in obj) {\r\n const childPath = path ? path + '.' + key : key\r\n if (ignorePaths.length && ignorePaths.indexOf(childPath) !== -1) {\r\n continue\r\n }\r\n\r\n tracked.children[key] = trackProperties(\r\n isImmutable,\r\n ignorePaths,\r\n obj[key],\r\n childPath\r\n )\r\n }\r\n }\r\n return tracked as TrackedProperty\r\n}\r\n\r\ntype IgnorePaths = readonly string[]\r\n\r\nfunction detectMutations(\r\n isImmutable: IsImmutableFunc,\r\n ignorePaths: IgnorePaths = [],\r\n trackedProperty: TrackedProperty,\r\n obj: any,\r\n sameParentRef: boolean = false,\r\n path: string = ''\r\n): { wasMutated: boolean; path?: string } {\r\n const prevObj = trackedProperty ? trackedProperty.value : undefined\r\n\r\n const sameRef = prevObj === obj\r\n\r\n if (sameParentRef && !sameRef && !Number.isNaN(obj)) {\r\n return { wasMutated: true, path }\r\n }\r\n\r\n if (isImmutable(prevObj) || isImmutable(obj)) {\r\n return { wasMutated: false }\r\n }\r\n\r\n // Gather all keys from prev (tracked) and after objs\r\n const keysToDetect: Record = {}\r\n for (let key in trackedProperty.children) {\r\n keysToDetect[key] = true\r\n }\r\n for (let key in obj) {\r\n keysToDetect[key] = true\r\n }\r\n\r\n for (let key in keysToDetect) {\r\n const childPath = path ? path + '.' + key : key\r\n if (ignorePaths.length && ignorePaths.indexOf(childPath) !== -1) {\r\n continue\r\n }\r\n\r\n const result = detectMutations(\r\n isImmutable,\r\n ignorePaths,\r\n trackedProperty.children[key],\r\n obj[key],\r\n sameRef,\r\n childPath\r\n )\r\n\r\n if (result.wasMutated) {\r\n return result\r\n }\r\n }\r\n return { wasMutated: false }\r\n}\r\n\r\ntype IsImmutableFunc = (value: any) => boolean\r\n\r\n/**\r\n * Options for `createImmutableStateInvariantMiddleware()`.\r\n *\r\n * @public\r\n */\r\nexport interface ImmutableStateInvariantMiddlewareOptions {\r\n /**\r\n Callback function to check if a value is considered to be immutable.\r\n This function is applied recursively to every value contained in the state.\r\n The default implementation will return true for primitive types \r\n (like numbers, strings, booleans, null and undefined).\r\n */\r\n isImmutable?: IsImmutableFunc\r\n /** \r\n An array of dot-separated path strings that match named nodes from \r\n the root state to ignore when checking for immutability.\r\n Defaults to undefined\r\n */\r\n ignoredPaths?: string[]\r\n /** Print a warning if checks take longer than N ms. Default: 32ms */\r\n warnAfter?: number\r\n // @deprecated. Use ignoredPaths\r\n ignore?: string[]\r\n}\r\n\r\n/**\r\n * Creates a middleware that checks whether any state was mutated in between\r\n * dispatches or during a dispatch. If any mutations are detected, an error is\r\n * thrown.\r\n *\r\n * @param options Middleware options.\r\n *\r\n * @public\r\n */\r\nexport function createImmutableStateInvariantMiddleware(\r\n options: ImmutableStateInvariantMiddlewareOptions = {}\r\n): Middleware {\r\n if (process.env.NODE_ENV === 'production') {\r\n return () => (next) => (action) => next(action)\r\n }\r\n\r\n let {\r\n isImmutable = isImmutableDefault,\r\n ignoredPaths,\r\n warnAfter = 32,\r\n ignore,\r\n } = options\r\n\r\n // Alias ignore->ignoredPaths, but prefer ignoredPaths if present\r\n ignoredPaths = ignoredPaths || ignore\r\n\r\n const track = trackForMutations.bind(null, isImmutable, ignoredPaths)\r\n\r\n return ({ getState }) => {\r\n let state = getState()\r\n let tracker = track(state)\r\n\r\n let result\r\n return (next) => (action) => {\r\n const measureUtils = getTimeMeasureUtils(\r\n warnAfter,\r\n 'ImmutableStateInvariantMiddleware'\r\n )\r\n\r\n measureUtils.measureTime(() => {\r\n state = getState()\r\n\r\n result = tracker.detectMutations()\r\n // Track before potentially not meeting the invariant\r\n tracker = track(state)\r\n\r\n invariant(\r\n !result.wasMutated,\r\n `A state mutation was detected between dispatches, in the path '${\r\n result.path || ''\r\n }'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`\r\n )\r\n })\r\n\r\n const dispatchedAction = next(action)\r\n\r\n measureUtils.measureTime(() => {\r\n state = getState()\r\n\r\n result = tracker.detectMutations()\r\n // Track before potentially not meeting the invariant\r\n tracker = track(state)\r\n\r\n result.wasMutated &&\r\n invariant(\r\n !result.wasMutated,\r\n `A state mutation was detected inside a dispatch, in the path: ${\r\n result.path || ''\r\n }. Take a look at the reducer(s) handling the action ${stringify(\r\n action\r\n )}. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`\r\n )\r\n })\r\n\r\n measureUtils.warnIfExceeded()\r\n\r\n return dispatchedAction\r\n }\r\n }\r\n}\r\n", "import isPlainObject from './isPlainObject'\r\nimport type { Middleware } from 'redux'\r\nimport { getTimeMeasureUtils } from './utils'\r\n\r\n/**\r\n * Returns true if the passed value is \"plain\", i.e. a value that is either\r\n * directly JSON-serializable (boolean, number, string, array, plain object)\r\n * or `undefined`.\r\n *\r\n * @param val The value to check.\r\n *\r\n * @public\r\n */\r\nexport function isPlain(val: any) {\r\n const type = typeof val\r\n return (\r\n type === 'undefined' ||\r\n val === null ||\r\n type === 'string' ||\r\n type === 'boolean' ||\r\n type === 'number' ||\r\n Array.isArray(val) ||\r\n isPlainObject(val)\r\n )\r\n}\r\n\r\ninterface NonSerializableValue {\r\n keyPath: string\r\n value: unknown\r\n}\r\n\r\n/**\r\n * @public\r\n */\r\nexport function findNonSerializableValue(\r\n value: unknown,\r\n path: string = '',\r\n isSerializable: (value: unknown) => boolean = isPlain,\r\n getEntries?: (value: unknown) => [string, any][],\r\n ignoredPaths: readonly string[] = []\r\n): NonSerializableValue | false {\r\n let foundNestedSerializable: NonSerializableValue | false\r\n\r\n if (!isSerializable(value)) {\r\n return {\r\n keyPath: path || '',\r\n value: value,\r\n }\r\n }\r\n\r\n if (typeof value !== 'object' || value === null) {\r\n return false\r\n }\r\n\r\n const entries = getEntries != null ? getEntries(value) : Object.entries(value)\r\n\r\n const hasIgnoredPaths = ignoredPaths.length > 0\r\n\r\n for (const [key, nestedValue] of entries) {\r\n const nestedPath = path ? path + '.' + key : key\r\n\r\n if (hasIgnoredPaths && ignoredPaths.indexOf(nestedPath) >= 0) {\r\n continue\r\n }\r\n\r\n if (!isSerializable(nestedValue)) {\r\n return {\r\n keyPath: nestedPath,\r\n value: nestedValue,\r\n }\r\n }\r\n\r\n if (typeof nestedValue === 'object') {\r\n foundNestedSerializable = findNonSerializableValue(\r\n nestedValue,\r\n nestedPath,\r\n isSerializable,\r\n getEntries,\r\n ignoredPaths\r\n )\r\n\r\n if (foundNestedSerializable) {\r\n return foundNestedSerializable\r\n }\r\n }\r\n }\r\n\r\n return false\r\n}\r\n\r\n/**\r\n * Options for `createSerializableStateInvariantMiddleware()`.\r\n *\r\n * @public\r\n */\r\nexport interface SerializableStateInvariantMiddlewareOptions {\r\n /**\r\n * The function to check if a value is considered serializable. This\r\n * function is applied recursively to every value contained in the\r\n * state. Defaults to `isPlain()`.\r\n */\r\n isSerializable?: (value: any) => boolean\r\n /**\r\n * The function that will be used to retrieve entries from each\r\n * value. If unspecified, `Object.entries` will be used. Defaults\r\n * to `undefined`.\r\n */\r\n getEntries?: (value: any) => [string, any][]\r\n\r\n /**\r\n * An array of action types to ignore when checking for serializability.\r\n * Defaults to []\r\n */\r\n ignoredActions?: string[]\r\n\r\n /**\r\n * An array of dot-separated path strings to ignore when checking\r\n * for serializability, Defaults to ['meta.arg', 'meta.baseQueryMeta']\r\n */\r\n ignoredActionPaths?: string[]\r\n\r\n /**\r\n * An array of dot-separated path strings to ignore when checking\r\n * for serializability, Defaults to []\r\n */\r\n ignoredPaths?: string[]\r\n /**\r\n * Execution time warning threshold. If the middleware takes longer\r\n * than `warnAfter` ms, a warning will be displayed in the console.\r\n * Defaults to 32ms.\r\n */\r\n warnAfter?: number\r\n\r\n /**\r\n * Opt out of checking state, but continue checking actions\r\n */\r\n ignoreState?: boolean\r\n}\r\n\r\n/**\r\n * Creates a middleware that, after every state change, checks if the new\r\n * state is serializable. If a non-serializable value is found within the\r\n * state, an error is printed to the console.\r\n *\r\n * @param options Middleware options.\r\n *\r\n * @public\r\n */\r\nexport function createSerializableStateInvariantMiddleware(\r\n options: SerializableStateInvariantMiddlewareOptions = {}\r\n): Middleware {\r\n if (process.env.NODE_ENV === 'production') {\r\n return () => (next) => (action) => next(action)\r\n }\r\n const {\r\n isSerializable = isPlain,\r\n getEntries,\r\n ignoredActions = [],\r\n ignoredActionPaths = ['meta.arg', 'meta.baseQueryMeta'],\r\n ignoredPaths = [],\r\n warnAfter = 32,\r\n ignoreState = false,\r\n } = options\r\n\r\n return (storeAPI) => (next) => (action) => {\r\n if (ignoredActions.length && ignoredActions.indexOf(action.type) !== -1) {\r\n return next(action)\r\n }\r\n\r\n const measureUtils = getTimeMeasureUtils(\r\n warnAfter,\r\n 'SerializableStateInvariantMiddleware'\r\n )\r\n measureUtils.measureTime(() => {\r\n const foundActionNonSerializableValue = findNonSerializableValue(\r\n action,\r\n '',\r\n isSerializable,\r\n getEntries,\r\n ignoredActionPaths\r\n )\r\n\r\n if (foundActionNonSerializableValue) {\r\n const { keyPath, value } = foundActionNonSerializableValue\r\n\r\n console.error(\r\n `A non-serializable value was detected in an action, in the path: \\`${keyPath}\\`. Value:`,\r\n value,\r\n '\\nTake a look at the logic that dispatched this action: ',\r\n action,\r\n '\\n(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)',\r\n '\\n(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)'\r\n )\r\n }\r\n })\r\n\r\n const result = next(action)\r\n\r\n if (!ignoreState) {\r\n measureUtils.measureTime(() => {\r\n const state = storeAPI.getState()\r\n\r\n const foundStateNonSerializableValue = findNonSerializableValue(\r\n state,\r\n '',\r\n isSerializable,\r\n getEntries,\r\n ignoredPaths\r\n )\r\n\r\n if (foundStateNonSerializableValue) {\r\n const { keyPath, value } = foundStateNonSerializableValue\r\n\r\n console.error(\r\n `A non-serializable value was detected in the state, in the path: \\`${keyPath}\\`. Value:`,\r\n value,\r\n `\r\nTake a look at the reducer(s) handling this action type: ${action.type}.\r\n(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)`\r\n )\r\n }\r\n })\r\n\r\n measureUtils.warnIfExceeded()\r\n }\r\n\r\n return result\r\n }\r\n}\r\n", "import type { Action } from 'redux'\r\nimport type {\r\n IsUnknownOrNonInferrable,\r\n IfMaybeUndefined,\r\n IfVoid,\r\n IsAny,\r\n} from './tsHelpers'\r\nimport isPlainObject from './isPlainObject'\r\n\r\n/**\r\n * An action with a string type and an associated payload. This is the\r\n * type of action returned by `createAction()` action creators.\r\n *\r\n * @template P The type of the action's payload.\r\n * @template T the type used for the action type.\r\n * @template M The type of the action's meta (optional)\r\n * @template E The type of the action's error (optional)\r\n *\r\n * @public\r\n */\r\nexport type PayloadAction<\r\n P = void,\r\n T extends string = string,\r\n M = never,\r\n E = never\r\n> = {\r\n payload: P\r\n type: T\r\n} & ([M] extends [never]\r\n ? {}\r\n : {\r\n meta: M\r\n }) &\r\n ([E] extends [never]\r\n ? {}\r\n : {\r\n error: E\r\n })\r\n\r\n/**\r\n * A \"prepare\" method to be used as the second parameter of `createAction`.\r\n * Takes any number of arguments and returns a Flux Standard Action without\r\n * type (will be added later) that *must* contain a payload (might be undefined).\r\n *\r\n * @public\r\n */\r\nexport type PrepareAction

=\r\n | ((...args: any[]) => { payload: P })\r\n | ((...args: any[]) => { payload: P; meta: any })\r\n | ((...args: any[]) => { payload: P; error: any })\r\n | ((...args: any[]) => { payload: P; meta: any; error: any })\r\n\r\n/**\r\n * Internal version of `ActionCreatorWithPreparedPayload`. Not to be used externally.\r\n *\r\n * @internal\r\n */\r\nexport type _ActionCreatorWithPreparedPayload<\r\n PA extends PrepareAction | void,\r\n T extends string = string\r\n> = PA extends PrepareAction\r\n ? ActionCreatorWithPreparedPayload<\r\n Parameters,\r\n P,\r\n T,\r\n ReturnType extends {\r\n error: infer E\r\n }\r\n ? E\r\n : never,\r\n ReturnType extends {\r\n meta: infer M\r\n }\r\n ? M\r\n : never\r\n >\r\n : void\r\n\r\n/**\r\n * Basic type for all action creators.\r\n *\r\n * @inheritdoc {redux#ActionCreator}\r\n */\r\ninterface BaseActionCreator {\r\n type: T\r\n match: (action: Action) => action is PayloadAction\r\n}\r\n\r\n/**\r\n * An action creator that takes multiple arguments that are passed\r\n * to a `PrepareAction` method to create the final Action.\r\n * @typeParam Args arguments for the action creator function\r\n * @typeParam P `payload` type\r\n * @typeParam T `type` name\r\n * @typeParam E optional `error` type\r\n * @typeParam M optional `meta` type\r\n *\r\n * @inheritdoc {redux#ActionCreator}\r\n *\r\n * @public\r\n */\r\nexport interface ActionCreatorWithPreparedPayload<\r\n Args extends unknown[],\r\n P,\r\n T extends string = string,\r\n E = never,\r\n M = never\r\n> extends BaseActionCreator {\r\n /**\r\n * Calling this {@link redux#ActionCreator} with `Args` will return\r\n * an Action with a payload of type `P` and (depending on the `PrepareAction`\r\n * method used) a `meta`- and `error` property of types `M` and `E` respectively.\r\n */\r\n (...args: Args): PayloadAction\r\n}\r\n\r\n/**\r\n * An action creator of type `T` that takes an optional payload of type `P`.\r\n *\r\n * @inheritdoc {redux#ActionCreator}\r\n *\r\n * @public\r\n */\r\nexport interface ActionCreatorWithOptionalPayload\r\n extends BaseActionCreator {\r\n /**\r\n * Calling this {@link redux#ActionCreator} with an argument will\r\n * return a {@link PayloadAction} of type `T` with a payload of `P`.\r\n * Calling it without an argument will return a PayloadAction with a payload of `undefined`.\r\n */\r\n (payload?: P): PayloadAction\r\n}\r\n\r\n/**\r\n * An action creator of type `T` that takes no payload.\r\n *\r\n * @inheritdoc {redux#ActionCreator}\r\n *\r\n * @public\r\n */\r\nexport interface ActionCreatorWithoutPayload\r\n extends BaseActionCreator {\r\n /**\r\n * Calling this {@link redux#ActionCreator} will\r\n * return a {@link PayloadAction} of type `T` with a payload of `undefined`\r\n */\r\n (): PayloadAction\r\n}\r\n\r\n/**\r\n * An action creator of type `T` that requires a payload of type P.\r\n *\r\n * @inheritdoc {redux#ActionCreator}\r\n *\r\n * @public\r\n */\r\nexport interface ActionCreatorWithPayload\r\n extends BaseActionCreator {\r\n /**\r\n * Calling this {@link redux#ActionCreator} with an argument will\r\n * return a {@link PayloadAction} of type `T` with a payload of `P`\r\n */\r\n (payload: P): PayloadAction\r\n}\r\n\r\n/**\r\n * An action creator of type `T` whose `payload` type could not be inferred. Accepts everything as `payload`.\r\n *\r\n * @inheritdoc {redux#ActionCreator}\r\n *\r\n * @public\r\n */\r\nexport interface ActionCreatorWithNonInferrablePayload<\r\n T extends string = string\r\n> extends BaseActionCreator {\r\n /**\r\n * Calling this {@link redux#ActionCreator} with an argument will\r\n * return a {@link PayloadAction} of type `T` with a payload\r\n * of exactly the type of the argument.\r\n */\r\n (payload: PT): PayloadAction\r\n}\r\n\r\n/**\r\n * An action creator that produces actions with a `payload` attribute.\r\n *\r\n * @typeParam P the `payload` type\r\n * @typeParam T the `type` of the resulting action\r\n * @typeParam PA if the resulting action is preprocessed by a `prepare` method, the signature of said method.\r\n *\r\n * @public\r\n */\r\nexport type PayloadActionCreator<\r\n P = void,\r\n T extends string = string,\r\n PA extends PrepareAction

| void = void\r\n> = IfPrepareActionMethodProvided<\r\n PA,\r\n _ActionCreatorWithPreparedPayload,\r\n // else\r\n IsAny<\r\n P,\r\n ActionCreatorWithPayload,\r\n IsUnknownOrNonInferrable<\r\n P,\r\n ActionCreatorWithNonInferrablePayload,\r\n // else\r\n IfVoid<\r\n P,\r\n ActionCreatorWithoutPayload,\r\n // else\r\n IfMaybeUndefined<\r\n P,\r\n ActionCreatorWithOptionalPayload,\r\n // else\r\n ActionCreatorWithPayload\r\n >\r\n >\r\n >\r\n >\r\n>\r\n\r\n/**\r\n * A utility function to create an action creator for the given action type\r\n * string. The action creator accepts a single argument, which will be included\r\n * in the action object as a field called payload. The action creator function\r\n * will also have its toString() overriden so that it returns the action type,\r\n * allowing it to be used in reducer logic that is looking for that action type.\r\n *\r\n * @param type The action type to use for created actions.\r\n * @param prepare (optional) a method that takes any number of arguments and returns { payload } or { payload, meta }.\r\n * If this is given, the resulting action creator will pass its arguments to this method to calculate payload & meta.\r\n *\r\n * @public\r\n */\r\nexport function createAction

= PayloadActionCreator

\r\n\r\n/**\r\n * The return value of `createSlice`\r\n *\r\n * @public\r\n */\r\nexport interface Slice<\r\n State = any,\r\n CaseReducers extends SliceCaseReducers = SliceCaseReducers,\r\n Name extends string = string\r\n> {\r\n /**\r\n * The slice name.\r\n */\r\n name: Name\r\n\r\n /**\r\n * The slice's reducer.\r\n */\r\n reducer: Reducer\r\n\r\n /**\r\n * Action creators for the types of actions that are handled by the slice\r\n * reducer.\r\n */\r\n actions: CaseReducerActions\r\n\r\n /**\r\n * The individual case reducer functions that were passed in the `reducers` parameter.\r\n * This enables reuse and testing if they were defined inline when calling `createSlice`.\r\n */\r\n caseReducers: SliceDefinedCaseReducers\r\n\r\n /**\r\n * Provides access to the initial state value given to the slice.\r\n * If a lazy state initializer was provided, it will be called and a fresh value returned.\r\n */\r\n getInitialState: () => State\r\n}\r\n\r\n/**\r\n * Options for `createSlice()`.\r\n *\r\n * @public\r\n */\r\nexport interface CreateSliceOptions<\r\n State = any,\r\n CR extends SliceCaseReducers = SliceCaseReducers,\r\n Name extends string = string\r\n> {\r\n /**\r\n * The slice's name. Used to namespace the generated action types.\r\n */\r\n name: Name\r\n\r\n /**\r\n * The initial state that should be used when the reducer is called the first time. This may also be a \"lazy initializer\" function, which should return an initial state value when called. This will be used whenever the reducer is called with `undefined` as its state value, and is primarily useful for cases like reading initial state from `localStorage`.\r\n */\r\n initialState: State | (() => State)\r\n\r\n /**\r\n * A mapping from action types to action-type-specific *case reducer*\r\n * functions. For every action type, a matching action creator will be\r\n * generated using `createAction()`.\r\n */\r\n reducers: ValidateSliceCaseReducers\r\n\r\n /**\r\n * A callback that receives a *builder* object to define\r\n * case reducers via calls to `builder.addCase(actionCreatorOrType, reducer)`.\r\n * \r\n * Alternatively, a mapping from action types to action-type-specific *case reducer*\r\n * functions. These reducers should have existing action types used\r\n * as the keys, and action creators will _not_ be generated.\r\n * \r\n * @example\r\n```ts\r\nimport { createAction, createSlice, Action, AnyAction } from '@reduxjs/toolkit'\r\nconst incrementBy = createAction('incrementBy')\r\nconst decrement = createAction('decrement')\r\n\r\ninterface RejectedAction extends Action {\r\n error: Error\r\n}\r\n\r\nfunction isRejectedAction(action: AnyAction): action is RejectedAction {\r\n return action.type.endsWith('rejected')\r\n}\r\n\r\ncreateSlice({\r\n name: 'counter',\r\n initialState: 0,\r\n reducers: {},\r\n extraReducers: builder => {\r\n builder\r\n .addCase(incrementBy, (state, action) => {\r\n // action is inferred correctly here if using TS\r\n })\r\n // You can chain calls, or have separate `builder.addCase()` lines each time\r\n .addCase(decrement, (state, action) => {})\r\n // You can match a range of action types\r\n .addMatcher(\r\n isRejectedAction,\r\n // `action` will be inferred as a RejectedAction due to isRejectedAction being defined as a type guard\r\n (state, action) => {}\r\n )\r\n // and provide a default case if no other handlers matched\r\n .addDefaultCase((state, action) => {})\r\n }\r\n})\r\n```\r\n */\r\n extraReducers?:\r\n | CaseReducers, any>\r\n | ((builder: ActionReducerMapBuilder>) => void)\r\n}\r\n\r\n/**\r\n * A CaseReducer with a `prepare` method.\r\n *\r\n * @public\r\n */\r\nexport type CaseReducerWithPrepare = {\r\n reducer: CaseReducer\r\n prepare: PrepareAction\r\n}\r\n\r\n/**\r\n * The type describing a slice's `reducers` option.\r\n *\r\n * @public\r\n */\r\nexport type SliceCaseReducers = {\r\n [K: string]:\r\n | CaseReducer>\r\n | CaseReducerWithPrepare>\r\n}\r\n\r\n/**\r\n * Derives the slice's `actions` property from the `reducers` options\r\n *\r\n * @public\r\n */\r\nexport type CaseReducerActions> = {\r\n [Type in keyof CaseReducers]: CaseReducers[Type] extends { prepare: any }\r\n ? ActionCreatorForCaseReducerWithPrepare\r\n : ActionCreatorForCaseReducer\r\n}\r\n\r\n/**\r\n * Get a `PayloadActionCreator` type for a passed `CaseReducerWithPrepare`\r\n *\r\n * @internal\r\n */\r\ntype ActionCreatorForCaseReducerWithPrepare =\r\n _ActionCreatorWithPreparedPayload\r\n\r\n/**\r\n * Get a `PayloadActionCreator` type for a passed `CaseReducer`\r\n *\r\n * @internal\r\n */\r\ntype ActionCreatorForCaseReducer = CR extends (\r\n state: any,\r\n action: infer Action\r\n) => any\r\n ? Action extends { payload: infer P }\r\n ? PayloadActionCreator

\r\n : ActionCreatorWithoutPayload\r\n : ActionCreatorWithoutPayload\r\n\r\n/**\r\n * Extracts the CaseReducers out of a `reducers` object, even if they are\r\n * tested into a `CaseReducerWithPrepare`.\r\n *\r\n * @internal\r\n */\r\ntype SliceDefinedCaseReducers> = {\r\n [Type in keyof CaseReducers]: CaseReducers[Type] extends {\r\n reducer: infer Reducer\r\n }\r\n ? Reducer\r\n : CaseReducers[Type]\r\n}\r\n\r\n/**\r\n * Used on a SliceCaseReducers object.\r\n * Ensures that if a CaseReducer is a `CaseReducerWithPrepare`, that\r\n * the `reducer` and the `prepare` function use the same type of `payload`.\r\n *\r\n * Might do additional such checks in the future.\r\n *\r\n * This type is only ever useful if you want to write your own wrapper around\r\n * `createSlice`. Please don't use it otherwise!\r\n *\r\n * @public\r\n */\r\nexport type ValidateSliceCaseReducers<\r\n S,\r\n ACR extends SliceCaseReducers\r\n> = ACR &\r\n {\r\n [T in keyof ACR]: ACR[T] extends {\r\n reducer(s: S, action?: infer A): any\r\n }\r\n ? {\r\n prepare(...a: never[]): Omit\r\n }\r\n : {}\r\n }\r\n\r\nfunction getType(slice: string, actionKey: string): string {\r\n return `${slice}/${actionKey}`\r\n}\r\n\r\n/**\r\n * A function that accepts an initial state, an object full of reducer\r\n * functions, and a \"slice name\", and automatically generates\r\n * action creators and action types that correspond to the\r\n * reducers and state.\r\n *\r\n * The `reducer` argument is passed to `createReducer()`.\r\n *\r\n * @public\r\n */\r\nexport function createSlice<\r\n State,\r\n CaseReducers extends SliceCaseReducers,\r\n Name extends string = string\r\n>(\r\n options: CreateSliceOptions\r\n): Slice {\r\n const { name } = options\r\n if (!name) {\r\n throw new Error('`name` is a required option for createSlice')\r\n }\r\n const initialState =\r\n typeof options.initialState == 'function'\r\n ? options.initialState\r\n : createNextState(options.initialState, () => {})\r\n\r\n const reducers = options.reducers || {}\r\n\r\n const reducerNames = Object.keys(reducers)\r\n\r\n const sliceCaseReducersByName: Record = {}\r\n const sliceCaseReducersByType: Record = {}\r\n const actionCreators: Record = {}\r\n\r\n reducerNames.forEach((reducerName) => {\r\n const maybeReducerWithPrepare = reducers[reducerName]\r\n const type = getType(name, reducerName)\r\n\r\n let caseReducer: CaseReducer\r\n let prepareCallback: PrepareAction | undefined\r\n\r\n if ('reducer' in maybeReducerWithPrepare) {\r\n caseReducer = maybeReducerWithPrepare.reducer\r\n prepareCallback = maybeReducerWithPrepare.prepare\r\n } else {\r\n caseReducer = maybeReducerWithPrepare\r\n }\r\n\r\n sliceCaseReducersByName[reducerName] = caseReducer\r\n sliceCaseReducersByType[type] = caseReducer\r\n actionCreators[reducerName] = prepareCallback\r\n ? createAction(type, prepareCallback)\r\n : createAction(type)\r\n })\r\n\r\n function buildReducer() {\r\n const [\r\n extraReducers = {},\r\n actionMatchers = [],\r\n defaultCaseReducer = undefined,\r\n ] =\r\n typeof options.extraReducers === 'function'\r\n ? executeReducerBuilderCallback(options.extraReducers)\r\n : [options.extraReducers]\r\n\r\n const finalCaseReducers = { ...extraReducers, ...sliceCaseReducersByType }\r\n return createReducer(\r\n initialState,\r\n finalCaseReducers as any,\r\n actionMatchers,\r\n defaultCaseReducer\r\n )\r\n }\r\n\r\n let _reducer: ReducerWithInitialState\r\n\r\n return {\r\n name,\r\n reducer(state, action) {\r\n if (!_reducer) _reducer = buildReducer()\r\n\r\n return _reducer(state, action)\r\n },\r\n actions: actionCreators as any,\r\n caseReducers: sliceCaseReducersByName as any,\r\n getInitialState() {\r\n if (!_reducer) _reducer = buildReducer()\r\n\r\n return _reducer.getInitialState()\r\n },\r\n }\r\n}\r\n", "import type { EntityState } from './models'\r\n\r\nexport function getInitialEntityState(): EntityState {\r\n return {\r\n ids: [],\r\n entities: {},\r\n }\r\n}\r\n\r\nexport function createInitialStateFactory() {\r\n function getInitialState(): EntityState\r\n function getInitialState(\r\n additionalState: S\r\n ): EntityState & S\r\n function getInitialState(additionalState: any = {}): any {\r\n return Object.assign(getInitialEntityState(), additionalState)\r\n }\r\n\r\n return { getInitialState }\r\n}\r\n", "import type { Selector } from 'reselect'\r\nimport { createDraftSafeSelector } from '../createDraftSafeSelector'\r\nimport type {\r\n EntityState,\r\n EntitySelectors,\r\n Dictionary,\r\n EntityId,\r\n} from './models'\r\n\r\nexport function createSelectorsFactory() {\r\n function getSelectors(): EntitySelectors>\r\n function getSelectors(\r\n selectState: (state: V) => EntityState\r\n ): EntitySelectors\r\n function getSelectors(\r\n selectState?: (state: V) => EntityState\r\n ): EntitySelectors {\r\n const selectIds = (state: EntityState) => state.ids\r\n\r\n const selectEntities = (state: EntityState) => state.entities\r\n\r\n const selectAll = createDraftSafeSelector(\r\n selectIds,\r\n selectEntities,\r\n (ids, entities): T[] => ids.map((id) => entities[id]!)\r\n )\r\n\r\n const selectId = (_: unknown, id: EntityId) => id\r\n\r\n const selectById = (entities: Dictionary, id: EntityId) => entities[id]\r\n\r\n const selectTotal = createDraftSafeSelector(selectIds, (ids) => ids.length)\r\n\r\n if (!selectState) {\r\n return {\r\n selectIds,\r\n selectEntities,\r\n selectAll,\r\n selectTotal,\r\n selectById: createDraftSafeSelector(\r\n selectEntities,\r\n selectId,\r\n selectById\r\n ),\r\n }\r\n }\r\n\r\n const selectGlobalizedEntities = createDraftSafeSelector(\r\n selectState as Selector>,\r\n selectEntities\r\n )\r\n\r\n return {\r\n selectIds: createDraftSafeSelector(selectState, selectIds),\r\n selectEntities: selectGlobalizedEntities,\r\n selectAll: createDraftSafeSelector(selectState, selectAll),\r\n selectTotal: createDraftSafeSelector(selectState, selectTotal),\r\n selectById: createDraftSafeSelector(\r\n selectGlobalizedEntities,\r\n selectId,\r\n selectById\r\n ),\r\n }\r\n }\r\n\r\n return { getSelectors }\r\n}\r\n", "import createNextState, { isDraft } from 'immer'\r\nimport type { EntityState, PreventAny } from './models'\r\nimport type { PayloadAction } from '../createAction'\r\nimport { isFSA } from '../createAction'\r\nimport { IsAny } from '../tsHelpers'\r\n\r\nexport function createSingleArgumentStateOperator(\r\n mutator: (state: EntityState) => void\r\n) {\r\n const operator = createStateOperator((_: undefined, state: EntityState) =>\r\n mutator(state)\r\n )\r\n\r\n return function operation>(\r\n state: PreventAny\r\n ): S {\r\n return operator(state as S, undefined)\r\n }\r\n}\r\n\r\nexport function createStateOperator(\r\n mutator: (arg: R, state: EntityState) => void\r\n) {\r\n return function operation>(\r\n state: S,\r\n arg: R | PayloadAction\r\n ): S {\r\n function isPayloadActionArgument(\r\n arg: R | PayloadAction\r\n ): arg is PayloadAction {\r\n return isFSA(arg)\r\n }\r\n\r\n const runMutator = (draft: EntityState) => {\r\n if (isPayloadActionArgument(arg)) {\r\n mutator(arg.payload, draft)\r\n } else {\r\n mutator(arg, draft)\r\n }\r\n }\r\n\r\n if (isDraft(state)) {\r\n // we must already be inside a `createNextState` call, likely because\r\n // this is being wrapped in `createReducer` or `createSlice`.\r\n // It's safe to just pass the draft to the mutator.\r\n runMutator(state)\r\n\r\n // since it's a draft, we'll just return it\r\n return state\r\n } else {\r\n // @ts-ignore createNextState() produces an Immutable> rather\r\n // than an Immutable, and TypeScript cannot find out how to reconcile\r\n // these two types.\r\n return createNextState(state, runMutator)\r\n }\r\n }\r\n}\r\n", "import type { EntityState, IdSelector, Update, EntityId } from './models'\r\n\r\nexport function selectIdValue(entity: T, selectId: IdSelector) {\r\n const key = selectId(entity)\r\n\r\n if (process.env.NODE_ENV !== 'production' && key === undefined) {\r\n console.warn(\r\n 'The entity passed to the `selectId` implementation returned undefined.',\r\n 'You should probably provide your own `selectId` implementation.',\r\n 'The entity that was passed:',\r\n entity,\r\n 'The `selectId` implementation:',\r\n selectId.toString()\r\n )\r\n }\r\n\r\n return key\r\n}\r\n\r\nexport function ensureEntitiesArray(\r\n entities: readonly T[] | Record\r\n): readonly T[] {\r\n if (!Array.isArray(entities)) {\r\n entities = Object.values(entities)\r\n }\r\n\r\n return entities\r\n}\r\n\r\nexport function splitAddedUpdatedEntities(\r\n newEntities: readonly T[] | Record,\r\n selectId: IdSelector,\r\n state: EntityState\r\n): [T[], Update[]] {\r\n newEntities = ensureEntitiesArray(newEntities)\r\n\r\n const added: T[] = []\r\n const updated: Update[] = []\r\n\r\n for (const entity of newEntities) {\r\n const id = selectIdValue(entity, selectId)\r\n if (id in state.entities) {\r\n updated.push({ id, changes: entity })\r\n } else {\r\n added.push(entity)\r\n }\r\n }\r\n return [added, updated]\r\n}\r\n", "import type {\r\n EntityState,\r\n EntityStateAdapter,\r\n IdSelector,\r\n Update,\r\n EntityId,\r\n} from './models'\r\nimport {\r\n createStateOperator,\r\n createSingleArgumentStateOperator,\r\n} from './state_adapter'\r\nimport {\r\n selectIdValue,\r\n ensureEntitiesArray,\r\n splitAddedUpdatedEntities,\r\n} from './utils'\r\n\r\nexport function createUnsortedStateAdapter(\r\n selectId: IdSelector\r\n): EntityStateAdapter {\r\n type R = EntityState\r\n\r\n function addOneMutably(entity: T, state: R): void {\r\n const key = selectIdValue(entity, selectId)\r\n\r\n if (key in state.entities) {\r\n return\r\n }\r\n\r\n state.ids.push(key)\r\n state.entities[key] = entity\r\n }\r\n\r\n function addManyMutably(\r\n newEntities: readonly T[] | Record,\r\n state: R\r\n ): void {\r\n newEntities = ensureEntitiesArray(newEntities)\r\n\r\n for (const entity of newEntities) {\r\n addOneMutably(entity, state)\r\n }\r\n }\r\n\r\n function setOneMutably(entity: T, state: R): void {\r\n const key = selectIdValue(entity, selectId)\r\n if (!(key in state.entities)) {\r\n state.ids.push(key)\r\n }\r\n state.entities[key] = entity\r\n }\r\n\r\n function setManyMutably(\r\n newEntities: readonly T[] | Record,\r\n state: R\r\n ): void {\r\n newEntities = ensureEntitiesArray(newEntities)\r\n for (const entity of newEntities) {\r\n setOneMutably(entity, state)\r\n }\r\n }\r\n\r\n function setAllMutably(\r\n newEntities: readonly T[] | Record,\r\n state: R\r\n ): void {\r\n newEntities = ensureEntitiesArray(newEntities)\r\n\r\n state.ids = []\r\n state.entities = {}\r\n\r\n addManyMutably(newEntities, state)\r\n }\r\n\r\n function removeOneMutably(key: EntityId, state: R): void {\r\n return removeManyMutably([key], state)\r\n }\r\n\r\n function removeManyMutably(keys: readonly EntityId[], state: R): void {\r\n let didMutate = false\r\n\r\n keys.forEach((key) => {\r\n if (key in state.entities) {\r\n delete state.entities[key]\r\n didMutate = true\r\n }\r\n })\r\n\r\n if (didMutate) {\r\n state.ids = state.ids.filter((id) => id in state.entities)\r\n }\r\n }\r\n\r\n function removeAllMutably(state: R): void {\r\n Object.assign(state, {\r\n ids: [],\r\n entities: {},\r\n })\r\n }\r\n\r\n function takeNewKey(\r\n keys: { [id: string]: EntityId },\r\n update: Update,\r\n state: R\r\n ): boolean {\r\n const original = state.entities[update.id]\r\n const updated: T = Object.assign({}, original, update.changes)\r\n const newKey = selectIdValue(updated, selectId)\r\n const hasNewKey = newKey !== update.id\r\n\r\n if (hasNewKey) {\r\n keys[update.id] = newKey\r\n delete state.entities[update.id]\r\n }\r\n\r\n state.entities[newKey] = updated\r\n\r\n return hasNewKey\r\n }\r\n\r\n function updateOneMutably(update: Update, state: R): void {\r\n return updateManyMutably([update], state)\r\n }\r\n\r\n function updateManyMutably(\r\n updates: ReadonlyArray>,\r\n state: R\r\n ): void {\r\n const newKeys: { [id: string]: EntityId } = {}\r\n\r\n const updatesPerEntity: { [id: string]: Update } = {}\r\n\r\n updates.forEach((update) => {\r\n // Only apply updates to entities that currently exist\r\n if (update.id in state.entities) {\r\n // If there are multiple updates to one entity, merge them together\r\n updatesPerEntity[update.id] = {\r\n id: update.id,\r\n // Spreads ignore falsy values, so this works even if there isn't\r\n // an existing update already at this key\r\n changes: {\r\n ...(updatesPerEntity[update.id]\r\n ? updatesPerEntity[update.id].changes\r\n : null),\r\n ...update.changes,\r\n },\r\n }\r\n }\r\n })\r\n\r\n updates = Object.values(updatesPerEntity)\r\n\r\n const didMutateEntities = updates.length > 0\r\n\r\n if (didMutateEntities) {\r\n const didMutateIds =\r\n updates.filter((update) => takeNewKey(newKeys, update, state)).length >\r\n 0\r\n\r\n if (didMutateIds) {\r\n state.ids = state.ids.map((id) => newKeys[id] || id)\r\n }\r\n }\r\n }\r\n\r\n function upsertOneMutably(entity: T, state: R): void {\r\n return upsertManyMutably([entity], state)\r\n }\r\n\r\n function upsertManyMutably(\r\n newEntities: readonly T[] | Record,\r\n state: R\r\n ): void {\r\n const [added, updated] = splitAddedUpdatedEntities(\r\n newEntities,\r\n selectId,\r\n state\r\n )\r\n\r\n updateManyMutably(updated, state)\r\n addManyMutably(added, state)\r\n }\r\n\r\n return {\r\n removeAll: createSingleArgumentStateOperator(removeAllMutably),\r\n addOne: createStateOperator(addOneMutably),\r\n addMany: createStateOperator(addManyMutably),\r\n setOne: createStateOperator(setOneMutably),\r\n setMany: createStateOperator(setManyMutably),\r\n setAll: createStateOperator(setAllMutably),\r\n updateOne: createStateOperator(updateOneMutably),\r\n updateMany: createStateOperator(updateManyMutably),\r\n upsertOne: createStateOperator(upsertOneMutably),\r\n upsertMany: createStateOperator(upsertManyMutably),\r\n removeOne: createStateOperator(removeOneMutably),\r\n removeMany: createStateOperator(removeManyMutably),\r\n }\r\n}\r\n", "import type {\r\n EntityState,\r\n IdSelector,\r\n Comparer,\r\n EntityStateAdapter,\r\n Update,\r\n EntityId,\r\n} from './models'\r\nimport { createStateOperator } from './state_adapter'\r\nimport { createUnsortedStateAdapter } from './unsorted_state_adapter'\r\nimport {\r\n selectIdValue,\r\n ensureEntitiesArray,\r\n splitAddedUpdatedEntities,\r\n} from './utils'\r\n\r\nexport function createSortedStateAdapter(\r\n selectId: IdSelector,\r\n sort: Comparer\r\n): EntityStateAdapter {\r\n type R = EntityState\r\n\r\n const { removeOne, removeMany, removeAll } =\r\n createUnsortedStateAdapter(selectId)\r\n\r\n function addOneMutably(entity: T, state: R): void {\r\n return addManyMutably([entity], state)\r\n }\r\n\r\n function addManyMutably(\r\n newEntities: readonly T[] | Record,\r\n state: R\r\n ): void {\r\n newEntities = ensureEntitiesArray(newEntities)\r\n\r\n const models = newEntities.filter(\r\n (model) => !(selectIdValue(model, selectId) in state.entities)\r\n )\r\n\r\n if (models.length !== 0) {\r\n merge(models, state)\r\n }\r\n }\r\n\r\n function setOneMutably(entity: T, state: R): void {\r\n return setManyMutably([entity], state)\r\n }\r\n\r\n function setManyMutably(\r\n newEntities: readonly T[] | Record,\r\n state: R\r\n ): void {\r\n newEntities = ensureEntitiesArray(newEntities)\r\n if (newEntities.length !== 0) {\r\n merge(newEntities, state)\r\n }\r\n }\r\n\r\n function setAllMutably(\r\n newEntities: readonly T[] | Record,\r\n state: R\r\n ): void {\r\n newEntities = ensureEntitiesArray(newEntities)\r\n state.entities = {}\r\n state.ids = []\r\n\r\n addManyMutably(newEntities, state)\r\n }\r\n\r\n function updateOneMutably(update: Update, state: R): void {\r\n return updateManyMutably([update], state)\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types\r\n function takeUpdatedModel(models: T[], update: Update, state: R): boolean {\r\n if (!(update.id in state.entities)) {\r\n return false\r\n }\r\n\r\n const original = state.entities[update.id]\r\n const updated = Object.assign({}, original, update.changes)\r\n const newKey = selectIdValue(updated, selectId)\r\n\r\n delete state.entities[update.id]\r\n\r\n models.push(updated)\r\n\r\n return newKey !== update.id\r\n }\r\n\r\n function updateManyMutably(\r\n updates: ReadonlyArray>,\r\n state: R\r\n ): void {\r\n const models: T[] = []\r\n\r\n updates.forEach((update) => takeUpdatedModel(models, update, state))\r\n\r\n if (models.length !== 0) {\r\n merge(models, state)\r\n }\r\n }\r\n\r\n function upsertOneMutably(entity: T, state: R): void {\r\n return upsertManyMutably([entity], state)\r\n }\r\n\r\n function upsertManyMutably(\r\n newEntities: readonly T[] | Record,\r\n state: R\r\n ): void {\r\n const [added, updated] = splitAddedUpdatedEntities(\r\n newEntities,\r\n selectId,\r\n state\r\n )\r\n\r\n updateManyMutably(updated, state)\r\n addManyMutably(added, state)\r\n }\r\n\r\n function areArraysEqual(a: readonly unknown[], b: readonly unknown[]) {\r\n if (a.length !== b.length) {\r\n return false\r\n }\r\n\r\n for (let i = 0; i < a.length && i < b.length; i++) {\r\n if (a[i] === b[i]) {\r\n continue\r\n }\r\n return false\r\n }\r\n return true\r\n }\r\n\r\n function merge(models: readonly T[], state: R): void {\r\n // Insert/overwrite all new/updated\r\n models.forEach((model) => {\r\n state.entities[selectId(model)] = model\r\n })\r\n\r\n const allEntities = Object.values(state.entities) as T[]\r\n allEntities.sort(sort)\r\n\r\n const newSortedIds = allEntities.map(selectId)\r\n const { ids } = state\r\n\r\n if (!areArraysEqual(ids, newSortedIds)) {\r\n state.ids = newSortedIds\r\n }\r\n }\r\n\r\n return {\r\n removeOne,\r\n removeMany,\r\n removeAll,\r\n addOne: createStateOperator(addOneMutably),\r\n updateOne: createStateOperator(updateOneMutably),\r\n upsertOne: createStateOperator(upsertOneMutably),\r\n setOne: createStateOperator(setOneMutably),\r\n setMany: createStateOperator(setManyMutably),\r\n setAll: createStateOperator(setAllMutably),\r\n addMany: createStateOperator(addManyMutably),\r\n updateMany: createStateOperator(updateManyMutably),\r\n upsertMany: createStateOperator(upsertManyMutably),\r\n }\r\n}\r\n", "import type {\r\n EntityDefinition,\r\n Comparer,\r\n IdSelector,\r\n EntityAdapter,\r\n} from './models'\r\nimport { createInitialStateFactory } from './entity_state'\r\nimport { createSelectorsFactory } from './state_selectors'\r\nimport { createSortedStateAdapter } from './sorted_state_adapter'\r\nimport { createUnsortedStateAdapter } from './unsorted_state_adapter'\r\n\r\n/**\r\n *\r\n * @param options\r\n *\r\n * @public\r\n */\r\nexport function createEntityAdapter(\r\n options: {\r\n selectId?: IdSelector\r\n sortComparer?: false | Comparer\r\n } = {}\r\n): EntityAdapter {\r\n const { selectId, sortComparer }: EntityDefinition = {\r\n sortComparer: false,\r\n selectId: (instance: any) => instance.id,\r\n ...options,\r\n }\r\n\r\n const stateFactory = createInitialStateFactory()\r\n const selectorsFactory = createSelectorsFactory()\r\n const stateAdapter = sortComparer\r\n ? createSortedStateAdapter(selectId, sortComparer)\r\n : createUnsortedStateAdapter(selectId)\r\n\r\n return {\r\n selectId,\r\n sortComparer,\r\n ...stateFactory,\r\n ...selectorsFactory,\r\n ...stateAdapter,\r\n }\r\n}\r\n", "// Borrowed from https://github.com/ai/nanoid/blob/3.0.2/non-secure/index.js\r\n// This alphabet uses `A-Za-z0-9_-` symbols. A genetic algorithm helped\r\n// optimize the gzip compression for this alphabet.\r\nlet urlAlphabet =\r\n 'ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW'\r\n\r\n/**\r\n *\r\n * @public\r\n */\r\nexport let nanoid = (size = 21) => {\r\n let id = ''\r\n // A compact alternative for `for (var i = 0; i < step; i++)`.\r\n let i = size\r\n while (i--) {\r\n // `| 0` is more compact and faster than `Math.floor()`.\r\n id += urlAlphabet[(Math.random() * 64) | 0]\r\n }\r\n return id\r\n}\r\n", "import type { Dispatch, AnyAction } from 'redux'\r\nimport type {\r\n PayloadAction,\r\n ActionCreatorWithPreparedPayload,\r\n} from './createAction'\r\nimport { createAction } from './createAction'\r\nimport type { ThunkDispatch } from 'redux-thunk'\r\nimport type { FallbackIfUnknown, IsAny, IsUnknown } from './tsHelpers'\r\nimport { nanoid } from './nanoid'\r\n\r\n// @ts-ignore we need the import of these types due to a bundling issue.\r\ntype _Keep = PayloadAction | ActionCreatorWithPreparedPayload\r\n\r\nexport type BaseThunkAPI<\r\n S,\r\n E,\r\n D extends Dispatch = Dispatch,\r\n RejectedValue = undefined,\r\n RejectedMeta = unknown,\r\n FulfilledMeta = unknown\r\n> = {\r\n dispatch: D\r\n getState: () => S\r\n extra: E\r\n requestId: string\r\n signal: AbortSignal\r\n rejectWithValue: IsUnknown<\r\n RejectedMeta,\r\n (value: RejectedValue) => RejectWithValue,\r\n (\r\n value: RejectedValue,\r\n meta: RejectedMeta\r\n ) => RejectWithValue\r\n >\r\n fulfillWithValue: IsUnknown<\r\n FulfilledMeta,\r\n (\r\n value: FulfilledValue\r\n ) => FulfillWithMeta,\r\n (\r\n value: FulfilledValue,\r\n meta: FulfilledMeta\r\n ) => FulfillWithMeta\r\n >\r\n}\r\n\r\n/**\r\n * @public\r\n */\r\nexport interface SerializedError {\r\n name?: string\r\n message?: string\r\n stack?: string\r\n code?: string\r\n}\r\n\r\nconst commonProperties: Array = [\r\n 'name',\r\n 'message',\r\n 'stack',\r\n 'code',\r\n]\r\n\r\nclass RejectWithValue {\r\n /*\r\n type-only property to distinguish between RejectWithValue and FulfillWithMeta\r\n does not exist at runtime\r\n */\r\n private readonly _type!: 'RejectWithValue'\r\n constructor(\r\n public readonly payload: Payload,\r\n public readonly meta: RejectedMeta\r\n ) {}\r\n}\r\n\r\nclass FulfillWithMeta {\r\n /*\r\n type-only property to distinguish between RejectWithValue and FulfillWithMeta\r\n does not exist at runtime\r\n */\r\n private readonly _type!: 'FulfillWithMeta'\r\n constructor(\r\n public readonly payload: Payload,\r\n public readonly meta: FulfilledMeta\r\n ) {}\r\n}\r\n\r\n/**\r\n * Serializes an error into a plain object.\r\n * Reworked from https://github.com/sindresorhus/serialize-error\r\n *\r\n * @public\r\n */\r\nexport const miniSerializeError = (value: any): SerializedError => {\r\n if (typeof value === 'object' && value !== null) {\r\n const simpleError: SerializedError = {}\r\n for (const property of commonProperties) {\r\n if (typeof value[property] === 'string') {\r\n simpleError[property] = value[property]\r\n }\r\n }\r\n\r\n return simpleError\r\n }\r\n\r\n return { message: String(value) }\r\n}\r\n\r\ntype AsyncThunkConfig = {\r\n state?: unknown\r\n dispatch?: Dispatch\r\n extra?: unknown\r\n rejectValue?: unknown\r\n serializedErrorType?: unknown\r\n pendingMeta?: unknown\r\n fulfilledMeta?: unknown\r\n rejectedMeta?: unknown\r\n}\r\n\r\ntype GetState = ThunkApiConfig extends {\r\n state: infer State\r\n}\r\n ? State\r\n : unknown\r\ntype GetExtra = ThunkApiConfig extends { extra: infer Extra }\r\n ? Extra\r\n : unknown\r\ntype GetDispatch = ThunkApiConfig extends {\r\n dispatch: infer Dispatch\r\n}\r\n ? FallbackIfUnknown<\r\n Dispatch,\r\n ThunkDispatch<\r\n GetState,\r\n GetExtra,\r\n AnyAction\r\n >\r\n >\r\n : ThunkDispatch, GetExtra, AnyAction>\r\n\r\ntype GetThunkAPI = BaseThunkAPI<\r\n GetState,\r\n GetExtra,\r\n GetDispatch,\r\n GetRejectValue,\r\n GetRejectedMeta,\r\n GetFulfilledMeta\r\n>\r\n\r\ntype GetRejectValue = ThunkApiConfig extends {\r\n rejectValue: infer RejectValue\r\n}\r\n ? RejectValue\r\n : unknown\r\n\r\ntype GetPendingMeta = ThunkApiConfig extends {\r\n pendingMeta: infer PendingMeta\r\n}\r\n ? PendingMeta\r\n : unknown\r\n\r\ntype GetFulfilledMeta = ThunkApiConfig extends {\r\n fulfilledMeta: infer FulfilledMeta\r\n}\r\n ? FulfilledMeta\r\n : unknown\r\n\r\ntype GetRejectedMeta = ThunkApiConfig extends {\r\n rejectedMeta: infer RejectedMeta\r\n}\r\n ? RejectedMeta\r\n : unknown\r\n\r\ntype GetSerializedErrorType = ThunkApiConfig extends {\r\n serializedErrorType: infer GetSerializedErrorType\r\n}\r\n ? GetSerializedErrorType\r\n : SerializedError\r\n\r\ntype MaybePromise = T | Promise | (T extends any ? Promise : never)\r\n\r\n/**\r\n * A type describing the return value of the `payloadCreator` argument to `createAsyncThunk`.\r\n * Might be useful for wrapping `createAsyncThunk` in custom abstractions.\r\n *\r\n * @public\r\n */\r\nexport type AsyncThunkPayloadCreatorReturnValue<\r\n Returned,\r\n ThunkApiConfig extends AsyncThunkConfig\r\n> = MaybePromise<\r\n | IsUnknown<\r\n GetFulfilledMeta,\r\n Returned,\r\n FulfillWithMeta>\r\n >\r\n | RejectWithValue<\r\n GetRejectValue,\r\n GetRejectedMeta\r\n >\r\n>\r\n/**\r\n * A type describing the `payloadCreator` argument to `createAsyncThunk`.\r\n * Might be useful for wrapping `createAsyncThunk` in custom abstractions.\r\n *\r\n * @public\r\n */\r\nexport type AsyncThunkPayloadCreator<\r\n Returned,\r\n ThunkArg = void,\r\n ThunkApiConfig extends AsyncThunkConfig = {}\r\n> = (\r\n arg: ThunkArg,\r\n thunkAPI: GetThunkAPI\r\n) => AsyncThunkPayloadCreatorReturnValue\r\n\r\n/**\r\n * A ThunkAction created by `createAsyncThunk`.\r\n * Dispatching it returns a Promise for either a\r\n * fulfilled or rejected action.\r\n * Also, the returned value contains an `abort()` method\r\n * that allows the asyncAction to be cancelled from the outside.\r\n *\r\n * @public\r\n */\r\nexport type AsyncThunkAction<\r\n Returned,\r\n ThunkArg,\r\n ThunkApiConfig extends AsyncThunkConfig\r\n> = (\r\n dispatch: GetDispatch,\r\n getState: () => GetState,\r\n extra: GetExtra\r\n) => Promise<\r\n | ReturnType>\r\n | ReturnType>\r\n> & {\r\n abort: (reason?: string) => void\r\n requestId: string\r\n arg: ThunkArg\r\n unwrap: () => Promise\r\n}\r\n\r\ntype AsyncThunkActionCreator<\r\n Returned,\r\n ThunkArg,\r\n ThunkApiConfig extends AsyncThunkConfig\r\n> = IsAny<\r\n ThunkArg,\r\n // any handling\r\n (arg: ThunkArg) => AsyncThunkAction,\r\n // unknown handling\r\n unknown extends ThunkArg\r\n ? (arg: ThunkArg) => AsyncThunkAction // argument not specified or specified as void or undefined\r\n : [ThunkArg] extends [void] | [undefined]\r\n ? () => AsyncThunkAction // argument contains void\r\n : [void] extends [ThunkArg] // make optional\r\n ? (arg?: ThunkArg) => AsyncThunkAction // argument contains undefined\r\n : [undefined] extends [ThunkArg]\r\n ? WithStrictNullChecks<\r\n // with strict nullChecks: make optional\r\n (\r\n arg?: ThunkArg\r\n ) => AsyncThunkAction,\r\n // without strict null checks this will match everything, so don't make it optional\r\n (arg: ThunkArg) => AsyncThunkAction\r\n > // default case: normal argument\r\n : (arg: ThunkArg) => AsyncThunkAction\r\n>\r\n\r\n/**\r\n * Options object for `createAsyncThunk`.\r\n *\r\n * @public\r\n */\r\nexport type AsyncThunkOptions<\r\n ThunkArg = void,\r\n ThunkApiConfig extends AsyncThunkConfig = {}\r\n> = {\r\n /**\r\n * A method to control whether the asyncThunk should be executed. Has access to the\r\n * `arg`, `api.getState()` and `api.extra` arguments.\r\n *\r\n * @returns `false` if it should be skipped\r\n */\r\n condition?(\r\n arg: ThunkArg,\r\n api: Pick, 'getState' | 'extra'>\r\n ): MaybePromise\r\n /**\r\n * If `condition` returns `false`, the asyncThunk will be skipped.\r\n * This option allows you to control whether a `rejected` action with `meta.condition == false`\r\n * will be dispatched or not.\r\n *\r\n * @default `false`\r\n */\r\n dispatchConditionRejection?: boolean\r\n\r\n serializeError?: (x: unknown) => GetSerializedErrorType\r\n\r\n /**\r\n * A function to use when generating the `requestId` for the request sequence.\r\n *\r\n * @default `nanoid`\r\n */\r\n idGenerator?: (arg: ThunkArg) => string\r\n} & IsUnknown<\r\n GetPendingMeta,\r\n {\r\n /**\r\n * A method to generate additional properties to be added to `meta` of the pending action.\r\n *\r\n * Using this optional overload will not modify the types correctly, this overload is only in place to support JavaScript users.\r\n * Please use the `ThunkApiConfig` parameter `pendingMeta` to get access to a correctly typed overload\r\n */\r\n getPendingMeta?(\r\n base: {\r\n arg: ThunkArg\r\n requestId: string\r\n },\r\n api: Pick, 'getState' | 'extra'>\r\n ): GetPendingMeta\r\n },\r\n {\r\n /**\r\n * A method to generate additional properties to be added to `meta` of the pending action.\r\n */\r\n getPendingMeta(\r\n base: {\r\n arg: ThunkArg\r\n requestId: string\r\n },\r\n api: Pick, 'getState' | 'extra'>\r\n ): GetPendingMeta\r\n }\r\n>\r\n\r\nexport type AsyncThunkPendingActionCreator<\r\n ThunkArg,\r\n ThunkApiConfig = {}\r\n> = ActionCreatorWithPreparedPayload<\r\n [string, ThunkArg, GetPendingMeta?],\r\n undefined,\r\n string,\r\n never,\r\n {\r\n arg: ThunkArg\r\n requestId: string\r\n requestStatus: 'pending'\r\n } & GetPendingMeta\r\n>\r\n\r\nexport type AsyncThunkRejectedActionCreator<\r\n ThunkArg,\r\n ThunkApiConfig = {}\r\n> = ActionCreatorWithPreparedPayload<\r\n [\r\n Error | null,\r\n string,\r\n ThunkArg,\r\n GetRejectValue?,\r\n GetRejectedMeta?\r\n ],\r\n GetRejectValue | undefined,\r\n string,\r\n GetSerializedErrorType,\r\n {\r\n arg: ThunkArg\r\n requestId: string\r\n requestStatus: 'rejected'\r\n aborted: boolean\r\n condition: boolean\r\n } & (\r\n | ({ rejectedWithValue: false } & {\r\n [K in keyof GetRejectedMeta]?: undefined\r\n })\r\n | ({ rejectedWithValue: true } & GetRejectedMeta)\r\n )\r\n>\r\n\r\nexport type AsyncThunkFulfilledActionCreator<\r\n Returned,\r\n ThunkArg,\r\n ThunkApiConfig = {}\r\n> = ActionCreatorWithPreparedPayload<\r\n [Returned, string, ThunkArg, GetFulfilledMeta?],\r\n Returned,\r\n string,\r\n never,\r\n {\r\n arg: ThunkArg\r\n requestId: string\r\n requestStatus: 'fulfilled'\r\n } & GetFulfilledMeta\r\n>\r\n\r\n/**\r\n * A type describing the return value of `createAsyncThunk`.\r\n * Might be useful for wrapping `createAsyncThunk` in custom abstractions.\r\n *\r\n * @public\r\n */\r\nexport type AsyncThunk<\r\n Returned,\r\n ThunkArg,\r\n ThunkApiConfig extends AsyncThunkConfig\r\n> = AsyncThunkActionCreator & {\r\n pending: AsyncThunkPendingActionCreator\r\n rejected: AsyncThunkRejectedActionCreator\r\n fulfilled: AsyncThunkFulfilledActionCreator<\r\n Returned,\r\n ThunkArg,\r\n ThunkApiConfig\r\n >\r\n typePrefix: string\r\n}\r\n\r\n/**\r\n *\r\n * @param typePrefix\r\n * @param payloadCreator\r\n * @param options\r\n *\r\n * @public\r\n */\r\n// separate signature without `AsyncThunkConfig` for better inference\r\nexport function createAsyncThunk(\r\n typePrefix: string,\r\n payloadCreator: AsyncThunkPayloadCreator,\r\n options?: AsyncThunkOptions\r\n): AsyncThunk\r\n\r\n/**\r\n *\r\n * @param typePrefix\r\n * @param payloadCreator\r\n * @param options\r\n *\r\n * @public\r\n */\r\nexport function createAsyncThunk<\r\n Returned,\r\n ThunkArg,\r\n ThunkApiConfig extends AsyncThunkConfig\r\n>(\r\n typePrefix: string,\r\n payloadCreator: AsyncThunkPayloadCreator,\r\n options?: AsyncThunkOptions\r\n): AsyncThunk\r\n\r\nexport function createAsyncThunk<\r\n Returned,\r\n ThunkArg,\r\n ThunkApiConfig extends AsyncThunkConfig\r\n>(\r\n typePrefix: string,\r\n payloadCreator: AsyncThunkPayloadCreator,\r\n options?: AsyncThunkOptions\r\n): AsyncThunk {\r\n type RejectedValue = GetRejectValue\r\n type PendingMeta = GetPendingMeta\r\n type FulfilledMeta = GetFulfilledMeta\r\n type RejectedMeta = GetRejectedMeta\r\n\r\n const fulfilled: AsyncThunkFulfilledActionCreator<\r\n Returned,\r\n ThunkArg,\r\n ThunkApiConfig\r\n > = createAction(\r\n typePrefix + '/fulfilled',\r\n (\r\n payload: Returned,\r\n requestId: string,\r\n arg: ThunkArg,\r\n meta?: FulfilledMeta\r\n ) => ({\r\n payload,\r\n meta: {\r\n ...((meta as any) || {}),\r\n arg,\r\n requestId,\r\n requestStatus: 'fulfilled' as const,\r\n },\r\n })\r\n )\r\n\r\n const pending: AsyncThunkPendingActionCreator =\r\n createAction(\r\n typePrefix + '/pending',\r\n (requestId: string, arg: ThunkArg, meta?: PendingMeta) => ({\r\n payload: undefined,\r\n meta: {\r\n ...((meta as any) || {}),\r\n arg,\r\n requestId,\r\n requestStatus: 'pending' as const,\r\n },\r\n })\r\n )\r\n\r\n const rejected: AsyncThunkRejectedActionCreator =\r\n createAction(\r\n typePrefix + '/rejected',\r\n (\r\n error: Error | null,\r\n requestId: string,\r\n arg: ThunkArg,\r\n payload?: RejectedValue,\r\n meta?: RejectedMeta\r\n ) => ({\r\n payload,\r\n error: ((options && options.serializeError) || miniSerializeError)(\r\n error || 'Rejected'\r\n ) as GetSerializedErrorType,\r\n meta: {\r\n ...((meta as any) || {}),\r\n arg,\r\n requestId,\r\n rejectedWithValue: !!payload,\r\n requestStatus: 'rejected' as const,\r\n aborted: error?.name === 'AbortError',\r\n condition: error?.name === 'ConditionError',\r\n },\r\n })\r\n )\r\n\r\n let displayedWarning = false\r\n\r\n const AC =\r\n typeof AbortController !== 'undefined'\r\n ? AbortController\r\n : class implements AbortController {\r\n signal: AbortSignal = {\r\n aborted: false,\r\n addEventListener() {},\r\n dispatchEvent() {\r\n return false\r\n },\r\n onabort() {},\r\n removeEventListener() {},\r\n }\r\n abort() {\r\n if (process.env.NODE_ENV !== 'production') {\r\n if (!displayedWarning) {\r\n displayedWarning = true\r\n console.info(\r\n `This platform does not implement AbortController. \r\nIf you want to use the AbortController to react to \\`abort\\` events, please consider importing a polyfill like 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'.`\r\n )\r\n }\r\n }\r\n }\r\n }\r\n\r\n function actionCreator(\r\n arg: ThunkArg\r\n ): AsyncThunkAction {\r\n return (dispatch, getState, extra) => {\r\n const requestId = options?.idGenerator\r\n ? options.idGenerator(arg)\r\n : nanoid()\r\n\r\n const abortController = new AC()\r\n let abortReason: string | undefined\r\n\r\n const abortedPromise = new Promise((_, reject) =>\r\n abortController.signal.addEventListener('abort', () =>\r\n reject({ name: 'AbortError', message: abortReason || 'Aborted' })\r\n )\r\n )\r\n\r\n let started = false\r\n function abort(reason?: string) {\r\n if (started) {\r\n abortReason = reason\r\n abortController.abort()\r\n }\r\n }\r\n\r\n const promise = (async function () {\r\n let finalAction: ReturnType\r\n try {\r\n let conditionResult = options?.condition?.(arg, { getState, extra })\r\n if (isThenable(conditionResult)) {\r\n conditionResult = await conditionResult\r\n }\r\n if (conditionResult === false) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw {\r\n name: 'ConditionError',\r\n message: 'Aborted due to condition callback returning false.',\r\n }\r\n }\r\n started = true\r\n dispatch(\r\n pending(\r\n requestId,\r\n arg,\r\n options?.getPendingMeta?.({ requestId, arg }, { getState, extra })\r\n )\r\n )\r\n finalAction = await Promise.race([\r\n abortedPromise,\r\n Promise.resolve(\r\n payloadCreator(arg, {\r\n dispatch,\r\n getState,\r\n extra,\r\n requestId,\r\n signal: abortController.signal,\r\n rejectWithValue: ((\r\n value: RejectedValue,\r\n meta?: RejectedMeta\r\n ) => {\r\n return new RejectWithValue(value, meta)\r\n }) as any,\r\n fulfillWithValue: ((value: unknown, meta?: FulfilledMeta) => {\r\n return new FulfillWithMeta(value, meta)\r\n }) as any,\r\n })\r\n ).then((result) => {\r\n if (result instanceof RejectWithValue) {\r\n throw result\r\n }\r\n if (result instanceof FulfillWithMeta) {\r\n return fulfilled(result.payload, requestId, arg, result.meta)\r\n }\r\n return fulfilled(result as any, requestId, arg)\r\n }),\r\n ])\r\n } catch (err) {\r\n finalAction =\r\n err instanceof RejectWithValue\r\n ? rejected(null, requestId, arg, err.payload, err.meta)\r\n : rejected(err as any, requestId, arg)\r\n }\r\n // We dispatch the result action _after_ the catch, to avoid having any errors\r\n // here get swallowed by the try/catch block,\r\n // per https://twitter.com/dan_abramov/status/770914221638942720\r\n // and https://github.com/reduxjs/redux-toolkit/blob/e85eb17b39a2118d859f7b7746e0f3fee523e089/docs/tutorials/advanced-tutorial.md#async-error-handling-logic-in-thunks\r\n\r\n const skipDispatch =\r\n options &&\r\n !options.dispatchConditionRejection &&\r\n rejected.match(finalAction) &&\r\n (finalAction as any).meta.condition\r\n\r\n if (!skipDispatch) {\r\n dispatch(finalAction)\r\n }\r\n return finalAction\r\n })()\r\n return Object.assign(promise as Promise, {\r\n abort,\r\n requestId,\r\n arg,\r\n unwrap() {\r\n return promise.then(unwrapResult)\r\n },\r\n })\r\n }\r\n }\r\n\r\n return Object.assign(\r\n actionCreator as AsyncThunkActionCreator<\r\n Returned,\r\n ThunkArg,\r\n ThunkApiConfig\r\n >,\r\n {\r\n pending,\r\n rejected,\r\n fulfilled,\r\n typePrefix,\r\n }\r\n )\r\n}\r\n\r\ninterface UnwrappableAction {\r\n payload: any\r\n meta?: any\r\n error?: any\r\n}\r\n\r\ntype UnwrappedActionPayload = Exclude<\r\n T,\r\n { error: any }\r\n>['payload']\r\n\r\n/**\r\n * @public\r\n */\r\nexport function unwrapResult(\r\n action: R\r\n): UnwrappedActionPayload {\r\n if (action.meta && action.meta.rejectedWithValue) {\r\n throw action.payload\r\n }\r\n if (action.error) {\r\n throw action.error\r\n }\r\n return action.payload\r\n}\r\n\r\ntype WithStrictNullChecks = undefined extends boolean\r\n ? False\r\n : True\r\n\r\nfunction isThenable(value: any): value is PromiseLike {\r\n return (\r\n value !== null &&\r\n typeof value === 'object' &&\r\n typeof value.then === 'function'\r\n )\r\n}\r\n", "import type { Middleware } from 'redux'\r\n\r\n/**\r\n * return True if T is `any`, otherwise return False\r\n * taken from https://github.com/joonhocho/tsdef\r\n *\r\n * @internal\r\n */\r\nexport type IsAny =\r\n // test if we are going the left AND right path in the condition\r\n true | false extends (T extends never ? true : false) ? True : False\r\n\r\n/**\r\n * return True if T is `unknown`, otherwise return False\r\n * taken from https://github.com/joonhocho/tsdef\r\n *\r\n * @internal\r\n */\r\nexport type IsUnknown = unknown extends T\r\n ? IsAny\r\n : False\r\n\r\nexport type FallbackIfUnknown = IsUnknown\r\n\r\n/**\r\n * @internal\r\n */\r\nexport type IfMaybeUndefined = [undefined] extends [P]\r\n ? True\r\n : False\r\n\r\n/**\r\n * @internal\r\n */\r\nexport type IfVoid = [void] extends [P] ? True : False\r\n\r\n/**\r\n * @internal\r\n */\r\nexport type IsEmptyObj = T extends any\r\n ? keyof T extends never\r\n ? IsUnknown>>\r\n : False\r\n : never\r\n\r\n/**\r\n * returns True if TS version is above 3.5, False if below.\r\n * uses feature detection to detect TS version >= 3.5\r\n * * versions below 3.5 will return `{}` for unresolvable interference\r\n * * versions above will return `unknown`\r\n *\r\n * @internal\r\n */\r\nexport type AtLeastTS35 = [True, False][IsUnknown<\r\n ReturnType<() => T>,\r\n 0,\r\n 1\r\n>]\r\n\r\n/**\r\n * @internal\r\n */\r\nexport type IsUnknownOrNonInferrable = AtLeastTS35<\r\n IsUnknown,\r\n IsEmptyObj>\r\n>\r\n\r\n/**\r\n * Combines all dispatch signatures of all middlewares in the array `M` into\r\n * one intersected dispatch signature.\r\n */\r\nexport type DispatchForMiddlewares = M extends ReadonlyArray\r\n ? UnionToIntersection<\r\n M[number] extends infer MiddlewareValues\r\n ? MiddlewareValues extends Middleware\r\n ? DispatchExt extends Function\r\n ? IsAny\r\n : never\r\n : never\r\n : never\r\n >\r\n : never\r\n\r\n/**\r\n * Convert a Union type `(A|B)` to an intersection type `(A&B)`\r\n */\r\nexport type UnionToIntersection = (\r\n U extends any ? (k: U) => void : never\r\n) extends (k: infer I) => void\r\n ? I\r\n : never\r\n\r\n/**\r\n * Helper type. Passes T out again, but boxes it in a way that it cannot\r\n * \"widen\" the type by accident if it is a generic that should be inferred\r\n * from elsewhere.\r\n *\r\n * @internal\r\n */\r\nexport type NoInfer = [T][T extends any ? 0 : never]\r\n\r\nexport type Omit = Pick>\r\n\r\nexport interface HasMatchFunction {\r\n match: (v: any) => v is T\r\n}\r\n\r\nexport const hasMatchFunction = (\r\n v: Matcher\r\n): v is HasMatchFunction => {\r\n return v && typeof (v as HasMatchFunction).match === 'function'\r\n}\r\n\r\n/** @public */\r\nexport type Matcher = HasMatchFunction | ((v: any) => v is T)\r\n\r\n/** @public */\r\nexport type ActionFromMatcher> = M extends Matcher<\r\n infer T\r\n>\r\n ? T\r\n : never\r\n", "import type {\r\n ActionFromMatcher,\r\n Matcher,\r\n UnionToIntersection,\r\n} from './tsHelpers'\r\nimport { hasMatchFunction } from './tsHelpers'\r\nimport type {\r\n AsyncThunk,\r\n AsyncThunkFulfilledActionCreator,\r\n AsyncThunkPendingActionCreator,\r\n AsyncThunkRejectedActionCreator,\r\n} from './createAsyncThunk'\r\n\r\n/** @public */\r\nexport type ActionMatchingAnyOf<\r\n Matchers extends [Matcher, ...Matcher[]]\r\n> = ActionFromMatcher\r\n\r\n/** @public */\r\nexport type ActionMatchingAllOf<\r\n Matchers extends [Matcher, ...Matcher[]]\r\n> = UnionToIntersection>\r\n\r\nconst matches = (matcher: Matcher, action: any) => {\r\n if (hasMatchFunction(matcher)) {\r\n return matcher.match(action)\r\n } else {\r\n return matcher(action)\r\n }\r\n}\r\n\r\n/**\r\n * A higher-order function that returns a function that may be used to check\r\n * whether an action matches any one of the supplied type guards or action\r\n * creators.\r\n *\r\n * @param matchers The type guards or action creators to match against.\r\n *\r\n * @public\r\n */\r\nexport function isAnyOf, ...Matcher[]]>(\r\n ...matchers: Matchers\r\n) {\r\n return (action: any): action is ActionMatchingAnyOf => {\r\n return matchers.some((matcher) => matches(matcher, action))\r\n }\r\n}\r\n\r\n/**\r\n * A higher-order function that returns a function that may be used to check\r\n * whether an action matches all of the supplied type guards or action\r\n * creators.\r\n *\r\n * @param matchers The type guards or action creators to match against.\r\n *\r\n * @public\r\n */\r\nexport function isAllOf, ...Matcher[]]>(\r\n ...matchers: Matchers\r\n) {\r\n return (action: any): action is ActionMatchingAllOf => {\r\n return matchers.every((matcher) => matches(matcher, action))\r\n }\r\n}\r\n\r\n/**\r\n * @param action A redux action\r\n * @param validStatus An array of valid meta.requestStatus values\r\n *\r\n * @internal\r\n */\r\nexport function hasExpectedRequestMetadata(\r\n action: any,\r\n validStatus: readonly string[]\r\n) {\r\n if (!action || !action.meta) return false\r\n\r\n const hasValidRequestId = typeof action.meta.requestId === 'string'\r\n const hasValidRequestStatus =\r\n validStatus.indexOf(action.meta.requestStatus) > -1\r\n\r\n return hasValidRequestId && hasValidRequestStatus\r\n}\r\n\r\nfunction isAsyncThunkArray(a: [any] | AnyAsyncThunk[]): a is AnyAsyncThunk[] {\r\n return (\r\n typeof a[0] === 'function' &&\r\n 'pending' in a[0] &&\r\n 'fulfilled' in a[0] &&\r\n 'rejected' in a[0]\r\n )\r\n}\r\n\r\nexport type UnknownAsyncThunkPendingAction = ReturnType<\r\n AsyncThunkPendingActionCreator\r\n>\r\n\r\nexport type PendingActionFromAsyncThunk =\r\n ActionFromMatcher\r\n\r\n/**\r\n * A higher-order function that returns a function that may be used to check\r\n * whether an action was created by an async thunk action creator, and that\r\n * the action is pending.\r\n *\r\n * @public\r\n */\r\nexport function isPending(): (\r\n action: any\r\n) => action is UnknownAsyncThunkPendingAction\r\n/**\r\n * A higher-order function that returns a function that may be used to check\r\n * whether an action belongs to one of the provided async thunk action creators,\r\n * and that the action is pending.\r\n *\r\n * @param asyncThunks (optional) The async thunk action creators to match against.\r\n *\r\n * @public\r\n */\r\nexport function isPending<\r\n AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]\r\n>(\r\n ...asyncThunks: AsyncThunks\r\n): (action: any) => action is PendingActionFromAsyncThunk\r\n/**\r\n * Tests if `action` is a pending thunk action\r\n * @public\r\n */\r\nexport function isPending(action: any): action is UnknownAsyncThunkPendingAction\r\nexport function isPending<\r\n AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]\r\n>(...asyncThunks: AsyncThunks | [any]) {\r\n if (asyncThunks.length === 0) {\r\n return (action: any) => hasExpectedRequestMetadata(action, ['pending'])\r\n }\r\n\r\n if (!isAsyncThunkArray(asyncThunks)) {\r\n return isPending()(asyncThunks[0])\r\n }\r\n\r\n return (\r\n action: any\r\n ): action is PendingActionFromAsyncThunk => {\r\n // note: this type will be correct because we have at least 1 asyncThunk\r\n const matchers: [Matcher, ...Matcher[]] = asyncThunks.map(\r\n (asyncThunk) => asyncThunk.pending\r\n ) as any\r\n\r\n const combinedMatcher = isAnyOf(...matchers)\r\n\r\n return combinedMatcher(action)\r\n }\r\n}\r\n\r\nexport type UnknownAsyncThunkRejectedAction = ReturnType<\r\n AsyncThunkRejectedActionCreator\r\n>\r\n\r\nexport type RejectedActionFromAsyncThunk =\r\n ActionFromMatcher\r\n\r\n/**\r\n * A higher-order function that returns a function that may be used to check\r\n * whether an action was created by an async thunk action creator, and that\r\n * the action is rejected.\r\n *\r\n * @public\r\n */\r\nexport function isRejected(): (\r\n action: any\r\n) => action is UnknownAsyncThunkRejectedAction\r\n/**\r\n * A higher-order function that returns a function that may be used to check\r\n * whether an action belongs to one of the provided async thunk action creators,\r\n * and that the action is rejected.\r\n *\r\n * @param asyncThunks (optional) The async thunk action creators to match against.\r\n *\r\n * @public\r\n */\r\nexport function isRejected<\r\n AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]\r\n>(\r\n ...asyncThunks: AsyncThunks\r\n): (action: any) => action is RejectedActionFromAsyncThunk\r\n/**\r\n * Tests if `action` is a rejected thunk action\r\n * @public\r\n */\r\nexport function isRejected(\r\n action: any\r\n): action is UnknownAsyncThunkRejectedAction\r\nexport function isRejected<\r\n AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]\r\n>(...asyncThunks: AsyncThunks | [any]) {\r\n if (asyncThunks.length === 0) {\r\n return (action: any) => hasExpectedRequestMetadata(action, ['rejected'])\r\n }\r\n\r\n if (!isAsyncThunkArray(asyncThunks)) {\r\n return isRejected()(asyncThunks[0])\r\n }\r\n\r\n return (\r\n action: any\r\n ): action is RejectedActionFromAsyncThunk => {\r\n // note: this type will be correct because we have at least 1 asyncThunk\r\n const matchers: [Matcher, ...Matcher[]] = asyncThunks.map(\r\n (asyncThunk) => asyncThunk.rejected\r\n ) as any\r\n\r\n const combinedMatcher = isAnyOf(...matchers)\r\n\r\n return combinedMatcher(action)\r\n }\r\n}\r\n\r\nexport type UnknownAsyncThunkRejectedWithValueAction = ReturnType<\r\n AsyncThunkRejectedActionCreator\r\n>\r\n\r\nexport type RejectedWithValueActionFromAsyncThunk =\r\n ActionFromMatcher &\r\n (T extends AsyncThunk\r\n ? { payload: RejectedValue }\r\n : unknown)\r\n\r\n/**\r\n * A higher-order function that returns a function that may be used to check\r\n * whether an action was created by an async thunk action creator, and that\r\n * the action is rejected with value.\r\n *\r\n * @public\r\n */\r\nexport function isRejectedWithValue(): (\r\n action: any\r\n) => action is UnknownAsyncThunkRejectedAction\r\n/**\r\n * A higher-order function that returns a function that may be used to check\r\n * whether an action belongs to one of the provided async thunk action creators,\r\n * and that the action is rejected with value.\r\n *\r\n * @param asyncThunks (optional) The async thunk action creators to match against.\r\n *\r\n * @public\r\n */\r\nexport function isRejectedWithValue<\r\n AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]\r\n>(\r\n ...asyncThunks: AsyncThunks\r\n): (\r\n action: any\r\n) => action is RejectedWithValueActionFromAsyncThunk\r\n/**\r\n * Tests if `action` is a rejected thunk action with value\r\n * @public\r\n */\r\nexport function isRejectedWithValue(\r\n action: any\r\n): action is UnknownAsyncThunkRejectedAction\r\nexport function isRejectedWithValue<\r\n AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]\r\n>(...asyncThunks: AsyncThunks | [any]) {\r\n const hasFlag = (action: any): action is any => {\r\n return action && action.meta && action.meta.rejectedWithValue\r\n }\r\n\r\n if (asyncThunks.length === 0) {\r\n return (action: any) => {\r\n const combinedMatcher = isAllOf(isRejected(...asyncThunks), hasFlag)\r\n\r\n return combinedMatcher(action)\r\n }\r\n }\r\n\r\n if (!isAsyncThunkArray(asyncThunks)) {\r\n return isRejectedWithValue()(asyncThunks[0])\r\n }\r\n\r\n return (\r\n action: any\r\n ): action is RejectedActionFromAsyncThunk => {\r\n const combinedMatcher = isAllOf(isRejected(...asyncThunks), hasFlag)\r\n\r\n return combinedMatcher(action)\r\n }\r\n}\r\n\r\nexport type UnknownAsyncThunkFulfilledAction = ReturnType<\r\n AsyncThunkFulfilledActionCreator\r\n>\r\n\r\nexport type FulfilledActionFromAsyncThunk =\r\n ActionFromMatcher\r\n\r\n/**\r\n * A higher-order function that returns a function that may be used to check\r\n * whether an action was created by an async thunk action creator, and that\r\n * the action is fulfilled.\r\n *\r\n * @public\r\n */\r\nexport function isFulfilled(): (\r\n action: any\r\n) => action is UnknownAsyncThunkFulfilledAction\r\n/**\r\n * A higher-order function that returns a function that may be used to check\r\n * whether an action belongs to one of the provided async thunk action creators,\r\n * and that the action is fulfilled.\r\n *\r\n * @param asyncThunks (optional) The async thunk action creators to match against.\r\n *\r\n * @public\r\n */\r\nexport function isFulfilled<\r\n AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]\r\n>(\r\n ...asyncThunks: AsyncThunks\r\n): (action: any) => action is FulfilledActionFromAsyncThunk\r\n/**\r\n * Tests if `action` is a fulfilled thunk action\r\n * @public\r\n */\r\nexport function isFulfilled(\r\n action: any\r\n): action is UnknownAsyncThunkFulfilledAction\r\nexport function isFulfilled<\r\n AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]\r\n>(...asyncThunks: AsyncThunks | [any]) {\r\n if (asyncThunks.length === 0) {\r\n return (action: any) => hasExpectedRequestMetadata(action, ['fulfilled'])\r\n }\r\n\r\n if (!isAsyncThunkArray(asyncThunks)) {\r\n return isFulfilled()(asyncThunks[0])\r\n }\r\n\r\n return (\r\n action: any\r\n ): action is FulfilledActionFromAsyncThunk => {\r\n // note: this type will be correct because we have at least 1 asyncThunk\r\n const matchers: [Matcher, ...Matcher[]] = asyncThunks.map(\r\n (asyncThunk) => asyncThunk.fulfilled\r\n ) as any\r\n\r\n const combinedMatcher = isAnyOf(...matchers)\r\n\r\n return combinedMatcher(action)\r\n }\r\n}\r\n\r\nexport type UnknownAsyncThunkAction =\r\n | UnknownAsyncThunkPendingAction\r\n | UnknownAsyncThunkRejectedAction\r\n | UnknownAsyncThunkFulfilledAction\r\n\r\nexport type AnyAsyncThunk = {\r\n pending: { match: (action: any) => action is any }\r\n fulfilled: { match: (action: any) => action is any }\r\n rejected: { match: (action: any) => action is any }\r\n}\r\n\r\nexport type ActionsFromAsyncThunk =\r\n | ActionFromMatcher\r\n | ActionFromMatcher\r\n | ActionFromMatcher\r\n\r\n/**\r\n * A higher-order function that returns a function that may be used to check\r\n * whether an action was created by an async thunk action creator.\r\n *\r\n * @public\r\n */\r\nexport function isAsyncThunkAction(): (\r\n action: any\r\n) => action is UnknownAsyncThunkAction\r\n/**\r\n * A higher-order function that returns a function that may be used to check\r\n * whether an action belongs to one of the provided async thunk action creators.\r\n *\r\n * @param asyncThunks (optional) The async thunk action creators to match against.\r\n *\r\n * @public\r\n */\r\nexport function isAsyncThunkAction<\r\n AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]\r\n>(\r\n ...asyncThunks: AsyncThunks\r\n): (action: any) => action is ActionsFromAsyncThunk\r\n/**\r\n * Tests if `action` is a thunk action\r\n * @public\r\n */\r\nexport function isAsyncThunkAction(\r\n action: any\r\n): action is UnknownAsyncThunkAction\r\nexport function isAsyncThunkAction<\r\n AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]\r\n>(...asyncThunks: AsyncThunks | [any]) {\r\n if (asyncThunks.length === 0) {\r\n return (action: any) =>\r\n hasExpectedRequestMetadata(action, ['pending', 'fulfilled', 'rejected'])\r\n }\r\n\r\n if (!isAsyncThunkArray(asyncThunks)) {\r\n return isAsyncThunkAction()(asyncThunks[0])\r\n }\r\n\r\n return (\r\n action: any\r\n ): action is ActionsFromAsyncThunk => {\r\n // note: this type will be correct because we have at least 1 asyncThunk\r\n const matchers: [Matcher, ...Matcher[]] = [] as any\r\n\r\n for (const asyncThunk of asyncThunks) {\r\n matchers.push(\r\n asyncThunk.pending,\r\n asyncThunk.rejected,\r\n asyncThunk.fulfilled\r\n )\r\n }\r\n\r\n const combinedMatcher = isAnyOf(...matchers)\r\n\r\n return combinedMatcher(action)\r\n }\r\n}\r\n", null, "import { createSlice } from '@reduxjs/toolkit';\n\nconst notesSlice = createSlice({\n name: 'notes',\n initialState: [\n ],\n reducers: {\n createNote (state, action) {\n const uuid = action.payload.note.uuid;\n const index = state.findIndex((el) => el.uuid === uuid);\n // It's a dupe uuid... probably should throw an error or something...\n if (index > -1) {\n return;\n }\n state.push(action.payload.note);\n },\n updateNote (state, action) {\n const uuid = action.payload.note.uuid;\n if (!uuid) {\n return;\n }\n const index = state.findIndex((el) => el.uuid === uuid);\n if (index !== -1) {\n state.splice(index, 1, action.payload.note);\n } else {\n state.push(action.payload.note);\n }\n },\n deleteNote (state, action) {\n const uuid = action.payload.uuid;\n if (!uuid) {\n return;\n }\n const index = state.findIndex((el) => el.uuid === uuid);\n if (index !== -1) {\n state.splice(index, 1);\n }\n },\n sortNotes (state, action) {\n // Array of UUIDs in new order.\n const sortUuids = action.payload.sortUuids;\n if (!Array.isArray(sortUuids) || sortUuids.length === 0) {\n return;\n }\n state.sort((a, b) => {\n const aIndex = sortUuids.indexOf(a.uuid);\n const bIndex = sortUuids.indexOf(b.uuid);\n return aIndex - bIndex;\n });\n },\n clearNotes () {\n return [];\n },\n importNotes (state, action) {\n const notes = action.payload.notes;\n\n notes.forEach((note) => {\n if (!note.uuid) {\n return;\n }\n const index = state.findIndex((el) => el.uuid === note.uuid);\n if (index !== -1) {\n state.splice(index, 1, note);\n } else {\n state.push(note);\n }\n });\n }\n }\n});\n\n// Extract the action creators object and the reducer\nconst { actions, reducer } = notesSlice;\n// Extract and export each action creator by name\nexport const { createNote, updateNote, deleteNote, sortNotes, clearNotes, importNotes } = actions;\n// Export the reducer, either as a default or named export\nexport default reducer;\n", "import { createSlice } from '@reduxjs/toolkit';\n\nconst npcsSlice = createSlice({\n name: 'npcs',\n initialState: [\n ],\n reducers: {\n createNPC (state, action) {\n const id = action.payload.npc.id;\n if (!id) {\n return;\n }\n const index = state.findIndex((el) => el.id === id);\n // It's a dupe uuid... probably should throw an error or something...\n if (index > -1) {\n return;\n }\n state.push(action.payload.npc);\n },\n updateNPC (state, action) {\n const id = action.payload.npc.id;\n if (!id) {\n return;\n }\n const index = state.findIndex((el) => el.id === id);\n if (index !== -1) {\n state.splice(index, 1, action.payload.npc);\n } else {\n state.push(action.payload.npc);\n }\n },\n deleteNPC (state, action) {\n const id = action.payload.id;\n if (!id) {\n return;\n }\n const index = state.findIndex((el) => el.id === id);\n if (index !== -1) {\n state.splice(index, 1);\n }\n },\n sortNPCs (state, action) {\n // Array of UUIDs in new order.\n const sortUuids = action.payload.sortUuids;\n if (!Array.isArray(sortUuids) || sortUuids.length === 0) {\n return;\n }\n state.sort((a, b) => {\n const aIndex = sortUuids.indexOf(a.id);\n const bIndex = sortUuids.indexOf(b.id);\n return aIndex - bIndex;\n });\n },\n clearNPCs (state) {\n return [];\n },\n importNPCs (state, action) {\n const npcs = action.payload.npcs;\n\n npcs.forEach((npc) => {\n if (!npc.id) {\n return;\n }\n const index = state.findIndex((el) => el.id === npc.id);\n if (index !== -1) {\n state.splice(index, 1, npc);\n } else {\n state.push(npc);\n }\n });\n }\n }\n});\n\n// Extract the action creators object and the reducer\nconst { actions, reducer } = npcsSlice;\n// Extract and export each action creator by name\nexport const { createNPC, updateNPC, deleteNPC, sortNPCs, clearNPCs, importNPCs } = actions;\n// Export the reducer, either as a default or named export\nexport default reducer;\n", "import { createSlice } from '@reduxjs/toolkit';\n\nconst townSlice = createSlice({\n name: 'town',\n initialState: [\n ],\n reducers: {\n updateTown (state, action) {\n state.splice(0, 1, action.payload.town);\n },\n clearTown () {\n return [];\n }\n }\n});\n\n// Extract the action creators object and the reducer\nconst { actions, reducer } = townSlice;\n// Extract and export each action creator by name\nexport const { updateTown, clearTown } = actions;\n// Export the reducer, either as a default or named export\nexport default reducer;\n", "import { configureStore } from '@reduxjs/toolkit';\nimport notesReducer from './notes-reducer.js';\nimport npcsReducer from './npcs-reducer.js';\nimport townReducer from './town-reducer.js';\nimport { save, load } from 'redux-localstorage-simple';\n\nconst store = configureStore({\n reducer: {\n notes: notesReducer,\n npcs: npcsReducer,\n town: townReducer\n },\n preloadedState: load(),\n middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(save())\n});\n\nexport default store;\n", "// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nvar getRandomValues;\nvar rnds8 = new Uint8Array(16);\nexport default function rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation. Also,\n // find the complete implementation of crypto (msCrypto) on IE11.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}", "export default /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;", "import REGEX from './regex.js';\n\nfunction validate(uuid) {\n return typeof uuid === 'string' && REGEX.test(uuid);\n}\n\nexport default validate;", "import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nvar byteToHex = [];\n\nfor (var i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).substr(1));\n}\n\nfunction stringify(arr) {\n var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;", "import rng from './rng.js';\nimport stringify from './stringify.js';\n\nfunction v4(options, buf, offset) {\n options = options || {};\n var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (var i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return stringify(rnds);\n}\n\nexport default v4;", "/**\n * Notes for the game.\n */\nimport { v4 as uuidv4 } from 'uuid';\nimport MarkdownIt from 'markdown-it';\n\nexport default class Note {\n constructor ({\n uuid = null,\n title = '',\n content = '',\n collapse = false\n }) {\n this.title = title;\n this.content = content;\n this.collapse = collapse;\n if (uuid) {\n this.uuid = uuid;\n } else {\n this.uuid = uuidv4();\n }\n }\n get id () {\n return this.uuid;\n }\n\n get contentHtml () {\n const md = new MarkdownIt();\n return md.render(this.content);\n }\n\n toJSON () {\n const obj = {};\n Object.keys(this).forEach((prop) => {\n const value = this[prop];\n if (value.length === 0) {\n return;\n }\n obj[prop] = value;\n });\n return obj;\n }\n}\n", "import * as notesService from '../services/notesService.js';\n\nconst template = document.createElement('template');\ntemplate.innerHTML = `\n\n\n

\n \n
{{ note.title }}
\n
\n \n
\n
\n\n
\n
\n
\n
\n`;\n\nconst formTemplate = document.createElement('template');\nformTemplate.innerHTML = `\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n \n
\n
\n`;\n\nclass NoteDisplay extends HTMLElement {\n constructor () {\n super();\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.appendChild(template.content.cloneNode(true));\n this._isEdit = false;\n this.editButton = this.shadowRoot.querySelector('.btn-edit');\n }\n\n connectedCallback () {\n this.shadowRoot.querySelector('details').addEventListener('toggle', this._setCollapse.bind(this));\n this.editButton.addEventListener('click', this._toggleEdit.bind(this));\n }\n\n disconnectedCallback () {\n this.shadowRoot.querySelector('details').removeEventListener('toggle', this._setCollapse.bind(this));\n this.editButton.removeEventListener('click', this._toggleEdit.bind(this));\n }\n\n /**\n *\n * @param {Note} note\n */\n setItem (note) {\n this.note = note;\n this.id = `note_${this.note.id}`;\n this.dataset.id = this.note.id;\n this.shadowRoot.querySelector('#summary-title').innerText = note.title;\n if (note.collapse) {\n this.shadowRoot.querySelector('details').open = false;\n } else {\n this.shadowRoot.querySelector('details').open = true;\n }\n this.shadowRoot.querySelector('.content').innerHTML = this.note.contentHtml;\n // Now some events? Or else delegate from the Host?\n }\n\n /**\n * Save collapse state\n * @param ev Toggle event on details.\n */\n _setCollapse (ev) {\n if (this._isEdit) {\n // We can't cancel the toggle\n // So we shouldn't try to save the note's state.\n return;\n }\n const newState = !ev.target.open;\n if (this.note.collapse === newState) {\n return;\n }\n this.note.collapse = newState;\n notesService.save(this.note);\n }\n\n collapse () {\n this.shadowRoot.querySelector('details').open = false;\n }\n\n _toggleEdit (ev) {\n if (this._isEdit) {\n this._disableEdit();\n return;\n }\n this._enableEdit();\n }\n\n _enableEdit () {\n if (this._isEdit) {\n return;\n }\n this._isEdit = true;\n\n this.shadowRoot.querySelector('.body').innerHTML = '';\n\n let form = formTemplate.content.cloneNode(true);\n form.querySelector('input[name=title').value = this.note.title;\n form.querySelector('textarea[name=content').value = this.note.content;\n\n this.shadowRoot.querySelector('.body').appendChild(form);\n form = this.shadowRoot.querySelector('form');\n\n form.addEventListener('submit', this._saveEdit.bind(this));\n form.querySelector('.btn-cancel').addEventListener('click', this._cancelEdit.bind(this));\n form.querySelector('.btn-delete').addEventListener('click', this._deleteNote.bind(this));\n }\n\n _cancelEdit () {\n // Was the note empty _pre_ edit toggle.\n if (this.note.title === '' && this.note.content === '') {\n // Probably means it's a new note that wasn't actually edited.\n // So remove it.\n this._deleteNote();\n return;\n }\n this._toggleEdit();\n }\n\n _disableEdit () {\n if (!this._isEdit) {\n return;\n }\n this._isEdit = false;\n\n // remove form events\n const form = this.shadowRoot.querySelector('form');\n form.removeEventListener('submit', this._saveEdit.bind(this));\n form.querySelector('.btn-cancel').removeEventListener('click', this._cancelEdit.bind(this));\n form.querySelector('.btn-delete').removeEventListener('click', this._deleteNote.bind(this));\n\n this.shadowRoot.querySelector('#summary-title').innerText = this.note.title;\n this.shadowRoot.querySelector('.body').innerHTML = `
${this.note.contentHtml}
`;\n this._refocus();\n }\n\n _saveEdit (ev) {\n ev.preventDefault();\n const formData = new FormData(ev.target);\n this.note.title = formData.get('title').toString();\n this.note.content = formData.get('content').toString();\n this._disableEdit();\n notesService.save(this.note);\n }\n\n _deleteNote () {\n notesService.remove(this.note.id);\n }\n /**\n * When we need to reset focus in this element.\n */\n _refocus () {\n this.shadowRoot.querySelector('summary').focus();\n }\n};\n\nwindow.customElements.define('had-note', NoteDisplay);\n\nexport default NoteDisplay;\n", "import { getResultFromTable } from '../services/randomTableService.js';\nimport A11yDialog from 'a11y-dialog/dist/a11y-dialog.esm';\nimport * as notesService from '../services/notesService.js';\nimport Note from '../models/note.js';\n\nconst template = document.createElement('template');\ntemplate.innerHTML = `\n\n\n
\n \n
{{ table.title }}
\n
\n
\n \n
\n
\n`;\n\nconst addnoteForm = document.createElement('template');\naddnoteForm.innerHTML = `\n
\n
\n \n \n
\n \n \n
\n`;\n\nclass RTableDisplay extends HTMLElement {\n constructor () {\n super();\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.appendChild(template.content.cloneNode(true));\n\n this.includeNumbers = false; // this doesn't work yet.\n }\n\n connectedCallback () {\n this.shadowRoot.querySelectorAll('button').forEach((btn) => {\n btn.addEventListener('click', this._rollTable.bind(this));\n });\n }\n\n disconnectedCallback () {\n this.shadowRoot.querySelectorAll('button').forEach((btn) => {\n btn.removeEventListener('click', this._rollTable.bind(this));\n });\n }\n /**\n *\n * @param {RandomTable} table\n */\n setTable (table) {\n this.table = table;\n this.shadowRoot.querySelector('#summary-title').innerText = this.table.title;\n\n const rows = this.getTableRows();\n\n const tableEl = this.shadowRoot.querySelector('table');\n if (table.subtableNames.length > 1) {\n const head = document.createElement('thead');\n const row = document.createElement('tr');\n table.subtableNames.forEach((name) => {\n const th = document.createElement('th');\n const btn = document.createElement('button');\n btn.innerText = 'Roll';\n btn.dataset.table = name;\n th.innerHTML = name;\n th.appendChild(btn);\n row.appendChild(th);\n });\n head.appendChild(row);\n tableEl.appendChild(head);\n }\n const body = document.createElement('tbody');\n\n rows.forEach((cells) => {\n const row = document.createElement('tr');\n cells.forEach((cell) => {\n const td = document.createElement('td');\n td.innerHTML = cell;\n row.appendChild(td);\n });\n body.appendChild(row);\n });\n tableEl.appendChild(body);\n\n // Now some events? Or else delegate from the Host?\n }\n\n /**\n * Get the data as rows of cells.\n * @returns\n */\n getTableRows () {\n // Count the largest result set.\n // make that many row arrays.\n // fill them with the empty value `---`\n // iterate and add in the table entries.\n const tableKeys = this.table.subtableNames;\n const entryCounts = tableKeys.map((t) => { return this.table.getSubtableEntries(t).length; });\n const columnCount = entryCounts.length + (this.includeNumbers ? 1 : 0);\n const rowCount = Math.max(...entryCounts);\n // Make sure we get different arrays in each index\n // Using Array.fill with another array directly gets all the same array.\n const rows = Array.from({ length: rowCount }, (e) => {\n return Array(columnCount).fill('---', 0, columnCount);\n });\n\n if (this.includeNumbers) {\n rows.forEach((row, i) => {\n row[0] = i + 1; // Start at 1.\n });\n }\n tableKeys.forEach((key, col) => {\n const entries = this.table.getSubtableEntries(key);\n const column = col + (this.includeNumbers ? 1 : 0);\n entries.forEach((entry, row) => {\n rows[row][column] = entry.label;\n });\n });\n return rows;\n }\n\n _rollTable (ev) {\n const btn = ev.target;\n const subtable = btn.dataset.table || '';\n const resultSet = getResultFromTable(this.table, subtable);\n\n const dialogEl = document.getElementById('dialog-rtable');\n const dialog = new A11yDialog(dialogEl);\n\n const dialogTitle = dialogEl.querySelector('#dialog-rtable-title');\n dialogTitle.innerHTML = resultSet.title;\n\n const content = dialogEl.querySelector('.dialog-body');\n resultSet.results.forEach((result) => {\n const p = document.createElement('p');\n p.classList.add('rtable-result');\n p.innerHTML = `${result.isDefault ? '' : `${result.table}: `}${result.result}${result.desc !== '' ? `${result.desc}` : ''}`;\n content.appendChild(p);\n });\n\n let form = addnoteForm.content.cloneNode(true);\n const select = form.querySelector('select');\n notesService.getAll().forEach((note) => {\n const option = document.createElement('option');\n option.value = note.id;\n option.innerHTML = note.title;\n select.appendChild(option);\n });\n content.appendChild(form);\n form = content.querySelector('form');\n form.addEventListener('submit', (ev) => {\n ev.preventDefault();\n const formData = new FormData(ev.target);\n const noteId = formData.get('note_uuid').toString();\n if (noteId === '') {\n const note = new Note({\n title: this.table.title,\n content: resultSet.toString()\n });\n notesService.create('view', note);\n } else {\n const note = notesService.getById(noteId);\n note.content = `${note.content}\\n\\n${resultSet.niceString()}`;\n notesService.save(note);\n }\n dialog.hide();\n });\n form.querySelector('.btn-cancel').addEventListener('click', (ev) => {\n dialog.hide();\n });\n\n dialog.on('hide', (element, event) => {\n content.innerHTML = '';\n dialogTitle.innerHTML = '';\n dialog.destroy();\n });\n dialog.show();\n }\n};\n\nwindow.customElements.define('had-rtable', RTableDisplay);\n\nexport default RTableDisplay;\n", "import { getAllTables, tableEmitter } from '../services/randomTableService.js';\nimport RTableDisplay from './rtabledisplay.js';\n\nconst template = document.createElement('template');\ntemplate.innerHTML = `\n\n\n
\n

Tables

\n
\n \n
\n
\n`;\n\nclass TableDrawer extends HTMLElement {\n constructor () {\n super();\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.appendChild(template.content.cloneNode(true));\n\n this.setAttribute('role', 'region');\n\n this.closeButton = this.shadowRoot.querySelector('.btn-close');\n\n getAllTables().forEach((rtable) => {\n const display = new RTableDisplay();\n display.setTable(rtable);\n this.shadowRoot.appendChild(display);\n });\n }\n\n connectedCallback () {\n this.setAttribute('tabindex', 0);\n tableEmitter.on('table:drawer', this._toggle.bind(this));\n this.closeButton.addEventListener('click', this._toggleClick.bind(this));\n // Make element not focusable when we are inside it, so tabbing out skips the element as a whole\n this.addEventListener('focus', (ev) => {\n this.focus();\n this.setAttribute('tabindex', -1);\n });\n // Re-enable focusability when we leave so we tab back in later.\n this.addEventListener('blur', (ev) => {\n this.setAttribute('tabindex', 0);\n });\n }\n\n disconnectedCallback () {\n tableEmitter.off('table:drawer', this._toggle.bind(this));\n this.closeButton.removeEventListener('click', this._toggleClick.bind(this));\n }\n /**\n * Click event on the close button.\n * Triggers event on emitter.\n * @param {Event} ev\n */\n _toggleClick (ev) {\n let open = true;\n if (this.getAttribute('aria-expanded') === 'true') {\n open = false;\n }\n tableEmitter.trigger('table:drawer', { open });\n }\n /**\n * Add overlay behind the drawer that we can click on to close.\n */\n _addOverlay () {\n if (this.overlay) {\n return;\n }\n this.overlay = document.createElement('div');\n this.overlay.classList.add('overlay');\n this.overlay.style.cssText = `\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n background-color: transparent;\n z-index: 9;`;\n this.parentNode.appendChild(this.overlay);\n this.overlay.addEventListener('click', (ev) => {\n tableEmitter.trigger('table:drawer', { open: false });\n }, { once: true });\n }\n /**\n * Remove the overlay when the drawer is closed.\n */\n _removeOverlay () {\n if (this.overlay) {\n this.overlay.parentNode.removeChild(this.overlay);\n this.overlay = null;\n }\n }\n /**\n * Handler for the table:drawer event.\n * @param {Boolean} open\n */\n _toggle ({ open }) {\n if (open) {\n this._addOverlay();\n this.setAttribute('aria-expanded', 'true');\n // Until the css transition finishes, the element is not focusable.\n setTimeout(() => {\n this.focus();\n }, 500);\n return;\n }\n this.setAttribute('aria-expanded', 'false');\n this._removeOverlay();\n }\n /**\n * Focus method since HTMLElement doesn't have that by default (I think).\n */\n focus () {\n this.shadowRoot.querySelector('h2').focus();\n }\n};\n\nwindow.customElements.define('had-tabledrawer', TableDrawer);\n\nexport default TableDrawer;\n", "import { defaultToJSON, isObject } from './r_helpers.js';\nimport { v4 as uuidv4 } from 'uuid';\nimport { DiceResult } from './dice_roller.js';\nimport RandomTableResultSet from './RandomTableResultSet.js';\nimport RandomTableResult from './RandomTableResult.js';\nimport TableErrorResult from './TableErrorResult.js';\n\n/**\n * Class for NPCs\n * @param {String} id Some kind of indentifier.\n * @param {String} schema Key for a NPCSchema used for this NPC.\n * @param {Map} fields Field values indexed by NPCSchemaField key.\n */\nexport default class NPC {\n constructor ({\n id = null,\n schema = '',\n fields = new Map()\n }) {\n // if null, generate a uuid\n if (id === null) {\n this.id = uuidv4();\n } else {\n this.id = id;\n }\n this.schema = schema;\n if (fields instanceof Map) {\n this.fields = fields;\n } else if (isObject(fields)) {\n this.fields = new Map();\n for (const [key, value] of Object.entries(fields)) {\n this.fields.set(key, this._convertFieldValue(value));\n }\n }\n }\n _convertFieldValue (value) {\n if (typeof value === 'undefined') {\n return '';\n }\n if (typeof value === 'string') {\n return value;\n }\n if (Array.isArray('value')) {\n return value.map((el) => {\n return this._convertFieldValue(el);\n });\n }\n if (value instanceof RandomTableResultSet ||\n value instanceof RandomTableResult ||\n value instanceof TableErrorResult ||\n value instanceof DiceResult) {\n return value;\n }\n if (value.className === 'RandomTableResultSet') {\n return new RandomTableResultSet(value);\n }\n if (value.className === 'RandomTableResult') {\n return new RandomTableResult(value);\n }\n if (value.className === 'TableErrorResult') {\n return new TableErrorResult(value);\n }\n if (value.className === 'DiceResult') {\n return new DiceResult(value);\n }\n return value;\n }\n /**\n * Set field value.\n * @param {String} key Field key.\n * @param {Any} value Value for field.\n */\n setFieldValue (key, value) {\n this.fields.set(key, this._convertFieldValue(value));\n }\n /**\n * Get field keys as array.\n * @returns {String[]}\n */\n getFieldKeys () {\n return Array.from(this.fields.keys());\n }\n /**\n * Get value by field key.\n * @param {String} key NPCSchemaField.key\n * @returns {RandomTableResultSet|RandomTableResultSet[]|DiceResult|String|Any}\n */\n getFieldValue (key) {\n return this.fields.get(key) || '';\n }\n /**\n * Custom JSON handler to strip empty props.\n * @returns {Object}\n */\n toJSON () {\n const obj = defaultToJSON.call(this);\n obj.className = 'NPC';\n return obj;\n }\n}\n", "import { defaultToJSON } from './r_helpers.js';\n\n/**\n * Specific field in NPC Schema.\n */\nexport default class NPCSchemaField {\n /**\n *\n * @property {String} key Identifying key\n * @property {String} label Readable label for field.\n * @property {String} type Type of data in field. Valid: string, text, array, number, modifier\n * @property {String} source Source of data for TableRoller in the form of a token (see TableRoller, ex: \"name:french\", \"table:color\", etc.)\n * @property {Number} count Number of entries for array types.\n * @property {Array|String|Number} starting_value An optional starting value.\n */\n constructor ({\n key = '',\n label = '',\n type = 'string',\n source = '',\n count = 1,\n starting_value = null\n }) {\n this.key = key;\n this.label = label;\n this.type = type;\n this.source = source;\n this.count = count;\n if (starting_value !== null) {\n this.starting_value = starting_value;\n }\n }\n /**\n * Default value for this field by type if empty.\n */\n get defaultEmpty () {\n switch (this.type) {\n case 'string':\n case 'text':\n return '';\n case 'array':\n return [];\n case 'number':\n case 'modifier':\n return 0;\n }\n return null;\n }\n /**\n * Custom JSON handler to strip empty props.\n * @returns {Object}\n */\n toJSON () {\n const obj = defaultToJSON.call(this);\n obj.className = 'NPCSchemaField';\n return obj;\n }\n}\n", "import { defaultToJSON, isObject } from './r_helpers.js';\nimport NPCSchemaField from './NPCSchemaField.js';\n\n/**\n * Schema for creating NPCs.\n */\nexport default class NPCSchema {\n /**\n * @property {String} key Identifying key\n * @property {String} name Name of schema.\n * @property {String} author Name of author.\n * @property {Map} fields Data fields will be converted to NPCSchemaField if necessary.\n */\n constructor ({\n key = '',\n name = '',\n author = '',\n fields = []\n }) {\n this.key = key;\n this.name = name;\n this.author = author;\n this.fields = new Map();\n if (Array.isArray(fields)) {\n fields.forEach((obj) => {\n this._convertField(obj);\n });\n } else {\n Object.keys(fields).forEach((key) => {\n this._convertField(fields[key]);\n });\n }\n }\n _convertField (value) {\n if (value instanceof NPCSchemaField) {\n this.fields.set(value.key, value);\n return;\n }\n if (isObject(value)) {\n const field = new NPCSchemaField(value);\n this.fields.set(field.key, field);\n }\n }\n /**\n * Get field keys as array.\n * @returns String[]\n */\n getFieldKeys () {\n return Array.from(this.fields.keys());\n }\n /**\n * Get a Field by the key.\n * @param {String} key\n * @returns {NPCSchemaField|undefined}\n */\n getFieldByKey (key) {\n return this.fields.get(key);\n }\n /**\n * Get field label by the key.\n * @param {String} key\n * @returns {String}\n */\n getFieldLabelByKey (key) {\n const field = this.getFieldByKey(key);\n if (!field) {\n return '';\n }\n return field.label;\n }\n /**\n * Custom JSON handler to strip empty props.\n * @returns {Object}\n */\n toJSON () {\n const obj = defaultToJSON.call(this);\n obj.className = 'NPCSchema';\n return obj;\n }\n}\n", "import NPC from 'rpg-table-randomizer/src/NPC.js';\nimport NPCSchema from 'rpg-table-randomizer/src/NPCSchema.js';\nimport NPCSchemaField from 'rpg-table-randomizer/src/NPCSchemaField.js';\nimport MarkdownIt from 'markdown-it/lib';\n\nconst townSchema = new NPCSchema({\n key: 'town',\n name: 'Town',\n fields: [\n new NPCSchemaField({\n key: 'townName',\n label: 'Name',\n source: '{{table:town_name}}'\n }),\n new NPCSchemaField({\n key: 'landscape',\n label: 'Prominent Landscape',\n source: '{{table:town_landscape}}'\n }),\n new NPCSchemaField({\n key: 'resource',\n label: 'Primary Resource',\n source: '{{table:resources}}'\n }),\n new NPCSchemaField({\n key: 'dressing',\n label: 'Set Dressing',\n source: '{{table:dressing:outside}}',\n type: 'long'\n }),\n new NPCSchemaField({\n key: 'locations',\n label: 'Location Near Town',\n source: '{{table:locations}}'\n }),\n new NPCSchemaField({\n key: 'recent_event',\n label: 'Recent Event',\n source: '{{table:events}}'\n }),\n new NPCSchemaField({\n key: 'current_event',\n label: 'Current Event',\n source: '{{table:events}}'\n })\n ]\n});\n\nclass Town extends NPC {\n constructor ({\n id = null,\n fields = new Map()\n }) {\n super({\n id,\n schema: 'town',\n fields\n });\n }\n\n get name () {\n return this.getFieldValue('townName').toString();\n }\n\n getFieldDisplay (field) {\n if (field === 'notes') {\n return this.noteHtml;\n }\n return this.fields.get(field);\n }\n\n setFieldValue (field, value) {\n if (typeof this.fields.get(field) === 'undefined') {\n return;\n }\n this.fields.set(field, value);\n }\n\n get noteHtml () {\n const md = new MarkdownIt();\n return md.render(this.notes);\n }\n};\n\nexport {\n Town,\n townSchema\n};\n", "import { Town, townSchema } from '../models/town.js';\nimport { isEmpty } from 'rpg-table-randomizer/src/r_helpers.js';\nimport { convertToken } from '../services/randomTableService.js';\nimport store from '../store/store.js';\nimport { updateTown, clearTown } from '../store/town-reducer.js';\n\n/**\n * Create a new Town\n * @returns Town\n */\nconst createTown = function () {\n const fields = new Map();\n townSchema.fields.forEach((field) => {\n const key = field.key;\n if (!isEmpty(field.starting_value)) {\n fields.set(key, field.starting_value);\n return;\n }\n if (!isEmpty(field.source)) {\n if (field.type === 'array') {\n const value = [];\n const ct = (field.count) ? field.count : 1;\n for (let i = 0; i < ct; i++) {\n value.push(convertToken(field.source).toString());\n }\n fields.set(key, value);\n } else {\n fields.set(key, convertToken(field.source).toString());\n }\n return;\n }\n fields.set(key, field.defaultEmpty);\n });\n return new Town({\n fields: fields\n });\n};\n\n/**\n * Get town or create new town\n * @returns {Town}\n */\nconst getById = function () {\n const data = store.getState().town[0] || {};\n if (!data.id) {\n // Always have a town in the UI.\n const town = createTown();\n store.dispatch(updateTown({ town: town.toJSON() }));\n return town;\n }\n return new Town(data);\n};\n\n/**\n * Save changes to the town.\n * @param {Town} town\n */\nconst save = function (town) {\n store.dispatch(updateTown({ town: town.toJSON() }));\n};\n/**\n * Reset town data.\n */\nconst clear = function () {\n store.dispatch(clearTown());\n};\n\nexport {\n getById,\n save,\n clear\n};\n", "import { townSchema } from '../models/town.js';\nimport * as townService from '../services/townService.js';\nimport { convertToken } from '../services/randomTableService.js';\n\nconst template = document.createElement('template');\ntemplate.innerHTML = `\n\n\n
\n \n
Town:
\n
\n \n
\n
\n
\n
\n`;\n\nconst formTemplate = document.createElement('template');\nformTemplate.innerHTML = `\n
\n

Click the to reroll a field. Click \"Save\" to save any changes.

\n
\n
\n
\n \n \n
\n
\n`;\n\nclass TownDisplay extends HTMLElement {\n constructor () {\n super();\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.appendChild(template.content.cloneNode(true));\n this._isEdit = false;\n this.editButton = this.shadowRoot.querySelector('.btn-edit');\n\n this.town = townService.getById();\n this.setTownDisplay();\n }\n\n connectedCallback () {\n this.editButton.addEventListener('click', this._toggleEdit.bind(this));\n }\n\n disconnectedCallback () {\n this.editButton.removeEventListener('click', this._toggleEdit.bind(this));\n }\n /**\n * Get the data as rows of cells.\n * @returns\n */\n setTownDisplay () {\n this.shadowRoot.querySelector('.body').innerHTML = '';\n this.shadowRoot.getElementById('summary-title').innerHTML = `Town: ${this.town.name}`;\n const list = document.createElement('dl');\n\n this.town.getFieldKeys().forEach((key) => {\n if (key === 'townName') {\n return;\n }\n const field = townSchema.getFieldByKey(key);\n const div = document.createElement('DIV');\n const dt = document.createElement('DT');\n dt.innerHTML = field.label;\n const dd = document.createElement('DD');\n dd.innerHTML = this.town.getFieldValue(key).toString();\n div.appendChild(dt);\n div.appendChild(dd);\n list.appendChild(div);\n });\n this.shadowRoot.querySelector('.body').appendChild(list);\n }\n\n _toggleEdit (ev) {\n if (this._isEdit) {\n this._disableEdit();\n return;\n }\n this._enableEdit();\n }\n\n _createFormField (field, value = '') {\n const key = field.key;\n const div = document.createElement('div');\n div.classList.add('formField');\n const label = document.createElement('label');\n label.setAttribute('for', key);\n label.innerHTML = field.label;\n div.appendChild(label);\n\n const div2 = document.createElement('div');\n div2.classList.add('fieldReroll');\n\n let input = null;\n if (field.type === 'long') {\n input = document.createElement('textarea');\n } else {\n input = document.createElement('input');\n input.setAttribute('type', 'text');\n }\n input.id = key;\n input.setAttribute('name', key);\n input.setAttribute('autocomplete', 'off');\n input.value = value;\n div2.appendChild(input);\n\n const button = document.createElement('button');\n button.classList.add('btn-reroll');\n button.dataset.field = key;\n button.dataset.append = field.type === 'long' ? 'true' : 'false';\n button.setAttribute('type', 'button');\n button.setAttribute('aria-label', 'Reroll');\n button.setAttribute('aria-controls', key);\n button.innerHTML = '⚅';\n div2.appendChild(button);\n\n div.appendChild(div2);\n\n return div;\n }\n\n _enableEdit () {\n if (this._isEdit) {\n return;\n }\n this._isEdit = true;\n\n this.shadowRoot.querySelector('.body').innerHTML = '';\n\n let form = formTemplate.content.cloneNode(true);\n const fieldDiv = form.querySelector('.formFields');\n Array.from(townSchema.fields.keys()).forEach((key) => {\n const field = townSchema.getFieldByKey(key);\n const value = this.town.getFieldDisplay(key);\n const formField = this._createFormField(\n field,\n value\n );\n fieldDiv.appendChild(formField);\n });\n\n // form.querySelector('textarea[name=notes').value = this.npc.notes;\n\n this.shadowRoot.querySelector('.body').appendChild(form);\n form = this.shadowRoot.querySelector('form');\n form.addEventListener('submit', this._saveEdit.bind(this));\n form.querySelector('.btn-cancel').addEventListener('click', this._toggleEdit.bind(this));\n\n form.querySelectorAll('.btn-reroll').forEach((btn) => {\n btn.addEventListener('click', this._reroll.bind(this));\n });\n }\n\n _disableEdit () {\n if (!this._isEdit) {\n return;\n }\n this._isEdit = false;\n\n // remove form events\n const form = this.shadowRoot.querySelector('form');\n form.removeEventListener('submit', this._saveEdit.bind(this));\n form.querySelector('.btn-cancel').removeEventListener('click', this._toggleEdit.bind(this));\n form.querySelectorAll('.btn-reroll').forEach((btn) => {\n btn.removeEventListener('click', this._reroll.bind(this));\n });\n\n this.setTownDisplay();\n this._refocus();\n }\n\n _saveEdit (ev) {\n ev.preventDefault();\n const formData = new FormData(ev.target);\n\n this.town.getFieldKeys().forEach((key) => {\n this.town.setFieldValue(key, formData.get(key).toString());\n });\n\n // this.town.notes = formData.get('notes').toString();\n\n townService.save(this.town);\n this._disableEdit();\n }\n\n _reroll (ev) {\n const fieldKey = ev.target.dataset.field || '';\n if (fieldKey === '') {\n return;\n }\n const append = ev.target.dataset.append === 'true';\n // get source from schema\n const field = townSchema.getFieldByKey(fieldKey);\n const result = convertToken(field.source);\n const input = this.shadowRoot.querySelector(`#${fieldKey}`);\n if (append) {\n input.value += `\\n${result.toString()}`;\n } else {\n input.value = result.toString();\n }\n }\n /**\n * When we need to reset focus in this element.\n */\n _refocus () {\n this.shadowRoot.querySelector('summary').focus();\n }\n};\n\nwindow.customElements.define('had-town', TownDisplay);\n\nexport default TownDisplay;\n", "/**!\n * Sortable 1.14.0\n * @author\tRubaXa \n * @author\towenm \n * @license MIT\n */\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n\n if (enumerableOnly) {\n symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n }\n\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nfunction _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n}\n\nfunction _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function (obj) {\n return typeof obj;\n };\n } else {\n _typeof = function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n\n var target = _objectWithoutPropertiesLoose(source, excluded);\n\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nfunction _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();\n}\n\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return _arrayLikeToArray(arr);\n}\n\nfunction _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter);\n}\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n\n return arr2;\n}\n\nfunction _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nvar version = \"1.14.0\";\n\nfunction userAgent(pattern) {\n if (typeof window !== 'undefined' && window.navigator) {\n return !! /*@__PURE__*/navigator.userAgent.match(pattern);\n }\n}\n\nvar IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\\.|msie|iemobile|Windows Phone)/i);\nvar Edge = userAgent(/Edge/i);\nvar FireFox = userAgent(/firefox/i);\nvar Safari = userAgent(/safari/i) && !userAgent(/chrome/i) && !userAgent(/android/i);\nvar IOS = userAgent(/iP(ad|od|hone)/i);\nvar ChromeForAndroid = userAgent(/chrome/i) && userAgent(/android/i);\n\nvar captureMode = {\n capture: false,\n passive: false\n};\n\nfunction on(el, event, fn) {\n el.addEventListener(event, fn, !IE11OrLess && captureMode);\n}\n\nfunction off(el, event, fn) {\n el.removeEventListener(event, fn, !IE11OrLess && captureMode);\n}\n\nfunction matches(\n/**HTMLElement*/\nel,\n/**String*/\nselector) {\n if (!selector) return;\n selector[0] === '>' && (selector = selector.substring(1));\n\n if (el) {\n try {\n if (el.matches) {\n return el.matches(selector);\n } else if (el.msMatchesSelector) {\n return el.msMatchesSelector(selector);\n } else if (el.webkitMatchesSelector) {\n return el.webkitMatchesSelector(selector);\n }\n } catch (_) {\n return false;\n }\n }\n\n return false;\n}\n\nfunction getParentOrHost(el) {\n return el.host && el !== document && el.host.nodeType ? el.host : el.parentNode;\n}\n\nfunction closest(\n/**HTMLElement*/\nel,\n/**String*/\nselector,\n/**HTMLElement*/\nctx, includeCTX) {\n if (el) {\n ctx = ctx || document;\n\n do {\n if (selector != null && (selector[0] === '>' ? el.parentNode === ctx && matches(el, selector) : matches(el, selector)) || includeCTX && el === ctx) {\n return el;\n }\n\n if (el === ctx) break;\n /* jshint boss:true */\n } while (el = getParentOrHost(el));\n }\n\n return null;\n}\n\nvar R_SPACE = /\\s+/g;\n\nfunction toggleClass(el, name, state) {\n if (el && name) {\n if (el.classList) {\n el.classList[state ? 'add' : 'remove'](name);\n } else {\n var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');\n el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');\n }\n }\n}\n\nfunction css(el, prop, val) {\n var style = el && el.style;\n\n if (style) {\n if (val === void 0) {\n if (document.defaultView && document.defaultView.getComputedStyle) {\n val = document.defaultView.getComputedStyle(el, '');\n } else if (el.currentStyle) {\n val = el.currentStyle;\n }\n\n return prop === void 0 ? val : val[prop];\n } else {\n if (!(prop in style) && prop.indexOf('webkit') === -1) {\n prop = '-webkit-' + prop;\n }\n\n style[prop] = val + (typeof val === 'string' ? '' : 'px');\n }\n }\n}\n\nfunction matrix(el, selfOnly) {\n var appliedTransforms = '';\n\n if (typeof el === 'string') {\n appliedTransforms = el;\n } else {\n do {\n var transform = css(el, 'transform');\n\n if (transform && transform !== 'none') {\n appliedTransforms = transform + ' ' + appliedTransforms;\n }\n /* jshint boss:true */\n\n } while (!selfOnly && (el = el.parentNode));\n }\n\n var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;\n /*jshint -W056 */\n\n return matrixFn && new matrixFn(appliedTransforms);\n}\n\nfunction find(ctx, tagName, iterator) {\n if (ctx) {\n var list = ctx.getElementsByTagName(tagName),\n i = 0,\n n = list.length;\n\n if (iterator) {\n for (; i < n; i++) {\n iterator(list[i], i);\n }\n }\n\n return list;\n }\n\n return [];\n}\n\nfunction getWindowScrollingElement() {\n var scrollingElement = document.scrollingElement;\n\n if (scrollingElement) {\n return scrollingElement;\n } else {\n return document.documentElement;\n }\n}\n/**\n * Returns the \"bounding client rect\" of given element\n * @param {HTMLElement} el The element whose boundingClientRect is wanted\n * @param {[Boolean]} relativeToContainingBlock Whether the rect should be relative to the containing block of (including) the container\n * @param {[Boolean]} relativeToNonStaticParent Whether the rect should be relative to the relative parent of (including) the contaienr\n * @param {[Boolean]} undoScale Whether the container's scale() should be undone\n * @param {[HTMLElement]} container The parent the element will be placed in\n * @return {Object} The boundingClientRect of el, with specified adjustments\n */\n\n\nfunction getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) {\n if (!el.getBoundingClientRect && el !== window) return;\n var elRect, top, left, bottom, right, height, width;\n\n if (el !== window && el.parentNode && el !== getWindowScrollingElement()) {\n elRect = el.getBoundingClientRect();\n top = elRect.top;\n left = elRect.left;\n bottom = elRect.bottom;\n right = elRect.right;\n height = elRect.height;\n width = elRect.width;\n } else {\n top = 0;\n left = 0;\n bottom = window.innerHeight;\n right = window.innerWidth;\n height = window.innerHeight;\n width = window.innerWidth;\n }\n\n if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) {\n // Adjust for translate()\n container = container || el.parentNode; // solves #1123 (see: https://stackoverflow.com/a/37953806/6088312)\n // Not needed on <= IE11\n\n if (!IE11OrLess) {\n do {\n if (container && container.getBoundingClientRect && (css(container, 'transform') !== 'none' || relativeToNonStaticParent && css(container, 'position') !== 'static')) {\n var containerRect = container.getBoundingClientRect(); // Set relative to edges of padding box of container\n\n top -= containerRect.top + parseInt(css(container, 'border-top-width'));\n left -= containerRect.left + parseInt(css(container, 'border-left-width'));\n bottom = top + elRect.height;\n right = left + elRect.width;\n break;\n }\n /* jshint boss:true */\n\n } while (container = container.parentNode);\n }\n }\n\n if (undoScale && el !== window) {\n // Adjust for scale()\n var elMatrix = matrix(container || el),\n scaleX = elMatrix && elMatrix.a,\n scaleY = elMatrix && elMatrix.d;\n\n if (elMatrix) {\n top /= scaleY;\n left /= scaleX;\n width /= scaleX;\n height /= scaleY;\n bottom = top + height;\n right = left + width;\n }\n }\n\n return {\n top: top,\n left: left,\n bottom: bottom,\n right: right,\n width: width,\n height: height\n };\n}\n/**\n * Checks if a side of an element is scrolled past a side of its parents\n * @param {HTMLElement} el The element who's side being scrolled out of view is in question\n * @param {String} elSide Side of the element in question ('top', 'left', 'right', 'bottom')\n * @param {String} parentSide Side of the parent in question ('top', 'left', 'right', 'bottom')\n * @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element\n */\n\n\nfunction isScrolledPast(el, elSide, parentSide) {\n var parent = getParentAutoScrollElement(el, true),\n elSideVal = getRect(el)[elSide];\n /* jshint boss:true */\n\n while (parent) {\n var parentSideVal = getRect(parent)[parentSide],\n visible = void 0;\n\n if (parentSide === 'top' || parentSide === 'left') {\n visible = elSideVal >= parentSideVal;\n } else {\n visible = elSideVal <= parentSideVal;\n }\n\n if (!visible) return parent;\n if (parent === getWindowScrollingElement()) break;\n parent = getParentAutoScrollElement(parent, false);\n }\n\n return false;\n}\n/**\n * Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible)\n * and non-draggable elements\n * @param {HTMLElement} el The parent element\n * @param {Number} childNum The index of the child\n * @param {Object} options Parent Sortable's options\n * @return {HTMLElement} The child at index childNum, or null if not found\n */\n\n\nfunction getChild(el, childNum, options, includeDragEl) {\n var currentChild = 0,\n i = 0,\n children = el.children;\n\n while (i < children.length) {\n if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && (includeDragEl || children[i] !== Sortable.dragged) && closest(children[i], options.draggable, el, false)) {\n if (currentChild === childNum) {\n return children[i];\n }\n\n currentChild++;\n }\n\n i++;\n }\n\n return null;\n}\n/**\n * Gets the last child in the el, ignoring ghostEl or invisible elements (clones)\n * @param {HTMLElement} el Parent element\n * @param {selector} selector Any other elements that should be ignored\n * @return {HTMLElement} The last child, ignoring ghostEl\n */\n\n\nfunction lastChild(el, selector) {\n var last = el.lastElementChild;\n\n while (last && (last === Sortable.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) {\n last = last.previousElementSibling;\n }\n\n return last || null;\n}\n/**\n * Returns the index of an element within its parent for a selected set of\n * elements\n * @param {HTMLElement} el\n * @param {selector} selector\n * @return {number}\n */\n\n\nfunction index(el, selector) {\n var index = 0;\n\n if (!el || !el.parentNode) {\n return -1;\n }\n /* jshint boss:true */\n\n\n while (el = el.previousElementSibling) {\n if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable.clone && (!selector || matches(el, selector))) {\n index++;\n }\n }\n\n return index;\n}\n/**\n * Returns the scroll offset of the given element, added with all the scroll offsets of parent elements.\n * The value is returned in real pixels.\n * @param {HTMLElement} el\n * @return {Array} Offsets in the format of [left, top]\n */\n\n\nfunction getRelativeScrollOffset(el) {\n var offsetLeft = 0,\n offsetTop = 0,\n winScroller = getWindowScrollingElement();\n\n if (el) {\n do {\n var elMatrix = matrix(el),\n scaleX = elMatrix.a,\n scaleY = elMatrix.d;\n offsetLeft += el.scrollLeft * scaleX;\n offsetTop += el.scrollTop * scaleY;\n } while (el !== winScroller && (el = el.parentNode));\n }\n\n return [offsetLeft, offsetTop];\n}\n/**\n * Returns the index of the object within the given array\n * @param {Array} arr Array that may or may not hold the object\n * @param {Object} obj An object that has a key-value pair unique to and identical to a key-value pair in the object you want to find\n * @return {Number} The index of the object in the array, or -1\n */\n\n\nfunction indexOfObject(arr, obj) {\n for (var i in arr) {\n if (!arr.hasOwnProperty(i)) continue;\n\n for (var key in obj) {\n if (obj.hasOwnProperty(key) && obj[key] === arr[i][key]) return Number(i);\n }\n }\n\n return -1;\n}\n\nfunction getParentAutoScrollElement(el, includeSelf) {\n // skip to window\n if (!el || !el.getBoundingClientRect) return getWindowScrollingElement();\n var elem = el;\n var gotSelf = false;\n\n do {\n // we don't need to get elem css if it isn't even overflowing in the first place (performance)\n if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) {\n var elemCSS = css(elem);\n\n if (elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == 'auto' || elemCSS.overflowX == 'scroll') || elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == 'auto' || elemCSS.overflowY == 'scroll')) {\n if (!elem.getBoundingClientRect || elem === document.body) return getWindowScrollingElement();\n if (gotSelf || includeSelf) return elem;\n gotSelf = true;\n }\n }\n /* jshint boss:true */\n\n } while (elem = elem.parentNode);\n\n return getWindowScrollingElement();\n}\n\nfunction extend(dst, src) {\n if (dst && src) {\n for (var key in src) {\n if (src.hasOwnProperty(key)) {\n dst[key] = src[key];\n }\n }\n }\n\n return dst;\n}\n\nfunction isRectEqual(rect1, rect2) {\n return Math.round(rect1.top) === Math.round(rect2.top) && Math.round(rect1.left) === Math.round(rect2.left) && Math.round(rect1.height) === Math.round(rect2.height) && Math.round(rect1.width) === Math.round(rect2.width);\n}\n\nvar _throttleTimeout;\n\nfunction throttle(callback, ms) {\n return function () {\n if (!_throttleTimeout) {\n var args = arguments,\n _this = this;\n\n if (args.length === 1) {\n callback.call(_this, args[0]);\n } else {\n callback.apply(_this, args);\n }\n\n _throttleTimeout = setTimeout(function () {\n _throttleTimeout = void 0;\n }, ms);\n }\n };\n}\n\nfunction cancelThrottle() {\n clearTimeout(_throttleTimeout);\n _throttleTimeout = void 0;\n}\n\nfunction scrollBy(el, x, y) {\n el.scrollLeft += x;\n el.scrollTop += y;\n}\n\nfunction clone(el) {\n var Polymer = window.Polymer;\n var $ = window.jQuery || window.Zepto;\n\n if (Polymer && Polymer.dom) {\n return Polymer.dom(el).cloneNode(true);\n } else if ($) {\n return $(el).clone(true)[0];\n } else {\n return el.cloneNode(true);\n }\n}\n\nfunction setRect(el, rect) {\n css(el, 'position', 'absolute');\n css(el, 'top', rect.top);\n css(el, 'left', rect.left);\n css(el, 'width', rect.width);\n css(el, 'height', rect.height);\n}\n\nfunction unsetRect(el) {\n css(el, 'position', '');\n css(el, 'top', '');\n css(el, 'left', '');\n css(el, 'width', '');\n css(el, 'height', '');\n}\n\nvar expando = 'Sortable' + new Date().getTime();\n\nfunction AnimationStateManager() {\n var animationStates = [],\n animationCallbackId;\n return {\n captureAnimationState: function captureAnimationState() {\n animationStates = [];\n if (!this.options.animation) return;\n var children = [].slice.call(this.el.children);\n children.forEach(function (child) {\n if (css(child, 'display') === 'none' || child === Sortable.ghost) return;\n animationStates.push({\n target: child,\n rect: getRect(child)\n });\n\n var fromRect = _objectSpread2({}, animationStates[animationStates.length - 1].rect); // If animating: compensate for current animation\n\n\n if (child.thisAnimationDuration) {\n var childMatrix = matrix(child, true);\n\n if (childMatrix) {\n fromRect.top -= childMatrix.f;\n fromRect.left -= childMatrix.e;\n }\n }\n\n child.fromRect = fromRect;\n });\n },\n addAnimationState: function addAnimationState(state) {\n animationStates.push(state);\n },\n removeAnimationState: function removeAnimationState(target) {\n animationStates.splice(indexOfObject(animationStates, {\n target: target\n }), 1);\n },\n animateAll: function animateAll(callback) {\n var _this = this;\n\n if (!this.options.animation) {\n clearTimeout(animationCallbackId);\n if (typeof callback === 'function') callback();\n return;\n }\n\n var animating = false,\n animationTime = 0;\n animationStates.forEach(function (state) {\n var time = 0,\n target = state.target,\n fromRect = target.fromRect,\n toRect = getRect(target),\n prevFromRect = target.prevFromRect,\n prevToRect = target.prevToRect,\n animatingRect = state.rect,\n targetMatrix = matrix(target, true);\n\n if (targetMatrix) {\n // Compensate for current animation\n toRect.top -= targetMatrix.f;\n toRect.left -= targetMatrix.e;\n }\n\n target.toRect = toRect;\n\n if (target.thisAnimationDuration) {\n // Could also check if animatingRect is between fromRect and toRect\n if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) && // Make sure animatingRect is on line between toRect & fromRect\n (animatingRect.top - toRect.top) / (animatingRect.left - toRect.left) === (fromRect.top - toRect.top) / (fromRect.left - toRect.left)) {\n // If returning to same place as started from animation and on same axis\n time = calculateRealTime(animatingRect, prevFromRect, prevToRect, _this.options);\n }\n } // if fromRect != toRect: animate\n\n\n if (!isRectEqual(toRect, fromRect)) {\n target.prevFromRect = fromRect;\n target.prevToRect = toRect;\n\n if (!time) {\n time = _this.options.animation;\n }\n\n _this.animate(target, animatingRect, toRect, time);\n }\n\n if (time) {\n animating = true;\n animationTime = Math.max(animationTime, time);\n clearTimeout(target.animationResetTimer);\n target.animationResetTimer = setTimeout(function () {\n target.animationTime = 0;\n target.prevFromRect = null;\n target.fromRect = null;\n target.prevToRect = null;\n target.thisAnimationDuration = null;\n }, time);\n target.thisAnimationDuration = time;\n }\n });\n clearTimeout(animationCallbackId);\n\n if (!animating) {\n if (typeof callback === 'function') callback();\n } else {\n animationCallbackId = setTimeout(function () {\n if (typeof callback === 'function') callback();\n }, animationTime);\n }\n\n animationStates = [];\n },\n animate: function animate(target, currentRect, toRect, duration) {\n if (duration) {\n css(target, 'transition', '');\n css(target, 'transform', '');\n var elMatrix = matrix(this.el),\n scaleX = elMatrix && elMatrix.a,\n scaleY = elMatrix && elMatrix.d,\n translateX = (currentRect.left - toRect.left) / (scaleX || 1),\n translateY = (currentRect.top - toRect.top) / (scaleY || 1);\n target.animatingX = !!translateX;\n target.animatingY = !!translateY;\n css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)');\n this.forRepaintDummy = repaint(target); // repaint\n\n css(target, 'transition', 'transform ' + duration + 'ms' + (this.options.easing ? ' ' + this.options.easing : ''));\n css(target, 'transform', 'translate3d(0,0,0)');\n typeof target.animated === 'number' && clearTimeout(target.animated);\n target.animated = setTimeout(function () {\n css(target, 'transition', '');\n css(target, 'transform', '');\n target.animated = false;\n target.animatingX = false;\n target.animatingY = false;\n }, duration);\n }\n }\n };\n}\n\nfunction repaint(target) {\n return target.offsetWidth;\n}\n\nfunction calculateRealTime(animatingRect, fromRect, toRect, options) {\n return Math.sqrt(Math.pow(fromRect.top - animatingRect.top, 2) + Math.pow(fromRect.left - animatingRect.left, 2)) / Math.sqrt(Math.pow(fromRect.top - toRect.top, 2) + Math.pow(fromRect.left - toRect.left, 2)) * options.animation;\n}\n\nvar plugins = [];\nvar defaults = {\n initializeByDefault: true\n};\nvar PluginManager = {\n mount: function mount(plugin) {\n // Set default static properties\n for (var option in defaults) {\n if (defaults.hasOwnProperty(option) && !(option in plugin)) {\n plugin[option] = defaults[option];\n }\n }\n\n plugins.forEach(function (p) {\n if (p.pluginName === plugin.pluginName) {\n throw \"Sortable: Cannot mount plugin \".concat(plugin.pluginName, \" more than once\");\n }\n });\n plugins.push(plugin);\n },\n pluginEvent: function pluginEvent(eventName, sortable, evt) {\n var _this = this;\n\n this.eventCanceled = false;\n\n evt.cancel = function () {\n _this.eventCanceled = true;\n };\n\n var eventNameGlobal = eventName + 'Global';\n plugins.forEach(function (plugin) {\n if (!sortable[plugin.pluginName]) return; // Fire global events if it exists in this sortable\n\n if (sortable[plugin.pluginName][eventNameGlobal]) {\n sortable[plugin.pluginName][eventNameGlobal](_objectSpread2({\n sortable: sortable\n }, evt));\n } // Only fire plugin event if plugin is enabled in this sortable,\n // and plugin has event defined\n\n\n if (sortable.options[plugin.pluginName] && sortable[plugin.pluginName][eventName]) {\n sortable[plugin.pluginName][eventName](_objectSpread2({\n sortable: sortable\n }, evt));\n }\n });\n },\n initializePlugins: function initializePlugins(sortable, el, defaults, options) {\n plugins.forEach(function (plugin) {\n var pluginName = plugin.pluginName;\n if (!sortable.options[pluginName] && !plugin.initializeByDefault) return;\n var initialized = new plugin(sortable, el, sortable.options);\n initialized.sortable = sortable;\n initialized.options = sortable.options;\n sortable[pluginName] = initialized; // Add default options from plugin\n\n _extends(defaults, initialized.defaults);\n });\n\n for (var option in sortable.options) {\n if (!sortable.options.hasOwnProperty(option)) continue;\n var modified = this.modifyOption(sortable, option, sortable.options[option]);\n\n if (typeof modified !== 'undefined') {\n sortable.options[option] = modified;\n }\n }\n },\n getEventProperties: function getEventProperties(name, sortable) {\n var eventProperties = {};\n plugins.forEach(function (plugin) {\n if (typeof plugin.eventProperties !== 'function') return;\n\n _extends(eventProperties, plugin.eventProperties.call(sortable[plugin.pluginName], name));\n });\n return eventProperties;\n },\n modifyOption: function modifyOption(sortable, name, value) {\n var modifiedValue;\n plugins.forEach(function (plugin) {\n // Plugin must exist on the Sortable\n if (!sortable[plugin.pluginName]) return; // If static option listener exists for this option, call in the context of the Sortable's instance of this plugin\n\n if (plugin.optionListeners && typeof plugin.optionListeners[name] === 'function') {\n modifiedValue = plugin.optionListeners[name].call(sortable[plugin.pluginName], value);\n }\n });\n return modifiedValue;\n }\n};\n\nfunction dispatchEvent(_ref) {\n var sortable = _ref.sortable,\n rootEl = _ref.rootEl,\n name = _ref.name,\n targetEl = _ref.targetEl,\n cloneEl = _ref.cloneEl,\n toEl = _ref.toEl,\n fromEl = _ref.fromEl,\n oldIndex = _ref.oldIndex,\n newIndex = _ref.newIndex,\n oldDraggableIndex = _ref.oldDraggableIndex,\n newDraggableIndex = _ref.newDraggableIndex,\n originalEvent = _ref.originalEvent,\n putSortable = _ref.putSortable,\n extraEventProperties = _ref.extraEventProperties;\n sortable = sortable || rootEl && rootEl[expando];\n if (!sortable) return;\n var evt,\n options = sortable.options,\n onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1); // Support for new CustomEvent feature\n\n if (window.CustomEvent && !IE11OrLess && !Edge) {\n evt = new CustomEvent(name, {\n bubbles: true,\n cancelable: true\n });\n } else {\n evt = document.createEvent('Event');\n evt.initEvent(name, true, true);\n }\n\n evt.to = toEl || rootEl;\n evt.from = fromEl || rootEl;\n evt.item = targetEl || rootEl;\n evt.clone = cloneEl;\n evt.oldIndex = oldIndex;\n evt.newIndex = newIndex;\n evt.oldDraggableIndex = oldDraggableIndex;\n evt.newDraggableIndex = newDraggableIndex;\n evt.originalEvent = originalEvent;\n evt.pullMode = putSortable ? putSortable.lastPutMode : undefined;\n\n var allEventProperties = _objectSpread2(_objectSpread2({}, extraEventProperties), PluginManager.getEventProperties(name, sortable));\n\n for (var option in allEventProperties) {\n evt[option] = allEventProperties[option];\n }\n\n if (rootEl) {\n rootEl.dispatchEvent(evt);\n }\n\n if (options[onName]) {\n options[onName].call(sortable, evt);\n }\n}\n\nvar _excluded = [\"evt\"];\n\nvar pluginEvent = function pluginEvent(eventName, sortable) {\n var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},\n originalEvent = _ref.evt,\n data = _objectWithoutProperties(_ref, _excluded);\n\n PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread2({\n dragEl: dragEl,\n parentEl: parentEl,\n ghostEl: ghostEl,\n rootEl: rootEl,\n nextEl: nextEl,\n lastDownEl: lastDownEl,\n cloneEl: cloneEl,\n cloneHidden: cloneHidden,\n dragStarted: moved,\n putSortable: putSortable,\n activeSortable: Sortable.active,\n originalEvent: originalEvent,\n oldIndex: oldIndex,\n oldDraggableIndex: oldDraggableIndex,\n newIndex: newIndex,\n newDraggableIndex: newDraggableIndex,\n hideGhostForTarget: _hideGhostForTarget,\n unhideGhostForTarget: _unhideGhostForTarget,\n cloneNowHidden: function cloneNowHidden() {\n cloneHidden = true;\n },\n cloneNowShown: function cloneNowShown() {\n cloneHidden = false;\n },\n dispatchSortableEvent: function dispatchSortableEvent(name) {\n _dispatchEvent({\n sortable: sortable,\n name: name,\n originalEvent: originalEvent\n });\n }\n }, data));\n};\n\nfunction _dispatchEvent(info) {\n dispatchEvent(_objectSpread2({\n putSortable: putSortable,\n cloneEl: cloneEl,\n targetEl: dragEl,\n rootEl: rootEl,\n oldIndex: oldIndex,\n oldDraggableIndex: oldDraggableIndex,\n newIndex: newIndex,\n newDraggableIndex: newDraggableIndex\n }, info));\n}\n\nvar dragEl,\n parentEl,\n ghostEl,\n rootEl,\n nextEl,\n lastDownEl,\n cloneEl,\n cloneHidden,\n oldIndex,\n newIndex,\n oldDraggableIndex,\n newDraggableIndex,\n activeGroup,\n putSortable,\n awaitingDragStarted = false,\n ignoreNextClick = false,\n sortables = [],\n tapEvt,\n touchEvt,\n lastDx,\n lastDy,\n tapDistanceLeft,\n tapDistanceTop,\n moved,\n lastTarget,\n lastDirection,\n pastFirstInvertThresh = false,\n isCircumstantialInvert = false,\n targetMoveDistance,\n // For positioning ghost absolutely\nghostRelativeParent,\n ghostRelativeParentInitialScroll = [],\n // (left, top)\n_silent = false,\n savedInputChecked = [];\n/** @const */\n\nvar documentExists = typeof document !== 'undefined',\n PositionGhostAbsolutely = IOS,\n CSSFloatProperty = Edge || IE11OrLess ? 'cssFloat' : 'float',\n // This will not pass for IE9, because IE9 DnD only works on anchors\nsupportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in document.createElement('div'),\n supportCssPointerEvents = function () {\n if (!documentExists) return; // false when <= IE11\n\n if (IE11OrLess) {\n return false;\n }\n\n var el = document.createElement('x');\n el.style.cssText = 'pointer-events:auto';\n return el.style.pointerEvents === 'auto';\n}(),\n _detectDirection = function _detectDirection(el, options) {\n var elCSS = css(el),\n elWidth = parseInt(elCSS.width) - parseInt(elCSS.paddingLeft) - parseInt(elCSS.paddingRight) - parseInt(elCSS.borderLeftWidth) - parseInt(elCSS.borderRightWidth),\n child1 = getChild(el, 0, options),\n child2 = getChild(el, 1, options),\n firstChildCSS = child1 && css(child1),\n secondChildCSS = child2 && css(child2),\n firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + getRect(child1).width,\n secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + getRect(child2).width;\n\n if (elCSS.display === 'flex') {\n return elCSS.flexDirection === 'column' || elCSS.flexDirection === 'column-reverse' ? 'vertical' : 'horizontal';\n }\n\n if (elCSS.display === 'grid') {\n return elCSS.gridTemplateColumns.split(' ').length <= 1 ? 'vertical' : 'horizontal';\n }\n\n if (child1 && firstChildCSS[\"float\"] && firstChildCSS[\"float\"] !== 'none') {\n var touchingSideChild2 = firstChildCSS[\"float\"] === 'left' ? 'left' : 'right';\n return child2 && (secondChildCSS.clear === 'both' || secondChildCSS.clear === touchingSideChild2) ? 'vertical' : 'horizontal';\n }\n\n return child1 && (firstChildCSS.display === 'block' || firstChildCSS.display === 'flex' || firstChildCSS.display === 'table' || firstChildCSS.display === 'grid' || firstChildWidth >= elWidth && elCSS[CSSFloatProperty] === 'none' || child2 && elCSS[CSSFloatProperty] === 'none' && firstChildWidth + secondChildWidth > elWidth) ? 'vertical' : 'horizontal';\n},\n _dragElInRowColumn = function _dragElInRowColumn(dragRect, targetRect, vertical) {\n var dragElS1Opp = vertical ? dragRect.left : dragRect.top,\n dragElS2Opp = vertical ? dragRect.right : dragRect.bottom,\n dragElOppLength = vertical ? dragRect.width : dragRect.height,\n targetS1Opp = vertical ? targetRect.left : targetRect.top,\n targetS2Opp = vertical ? targetRect.right : targetRect.bottom,\n targetOppLength = vertical ? targetRect.width : targetRect.height;\n return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2;\n},\n\n/**\n * Detects first nearest empty sortable to X and Y position using emptyInsertThreshold.\n * @param {Number} x X position\n * @param {Number} y Y position\n * @return {HTMLElement} Element of the first found nearest Sortable\n */\n_detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) {\n var ret;\n sortables.some(function (sortable) {\n var threshold = sortable[expando].options.emptyInsertThreshold;\n if (!threshold || lastChild(sortable)) return;\n var rect = getRect(sortable),\n insideHorizontally = x >= rect.left - threshold && x <= rect.right + threshold,\n insideVertically = y >= rect.top - threshold && y <= rect.bottom + threshold;\n\n if (insideHorizontally && insideVertically) {\n return ret = sortable;\n }\n });\n return ret;\n},\n _prepareGroup = function _prepareGroup(options) {\n function toFn(value, pull) {\n return function (to, from, dragEl, evt) {\n var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name;\n\n if (value == null && (pull || sameGroup)) {\n // Default pull value\n // Default pull and put value if same group\n return true;\n } else if (value == null || value === false) {\n return false;\n } else if (pull && value === 'clone') {\n return value;\n } else if (typeof value === 'function') {\n return toFn(value(to, from, dragEl, evt), pull)(to, from, dragEl, evt);\n } else {\n var otherGroup = (pull ? to : from).options.group.name;\n return value === true || typeof value === 'string' && value === otherGroup || value.join && value.indexOf(otherGroup) > -1;\n }\n };\n }\n\n var group = {};\n var originalGroup = options.group;\n\n if (!originalGroup || _typeof(originalGroup) != 'object') {\n originalGroup = {\n name: originalGroup\n };\n }\n\n group.name = originalGroup.name;\n group.checkPull = toFn(originalGroup.pull, true);\n group.checkPut = toFn(originalGroup.put);\n group.revertClone = originalGroup.revertClone;\n options.group = group;\n},\n _hideGhostForTarget = function _hideGhostForTarget() {\n if (!supportCssPointerEvents && ghostEl) {\n css(ghostEl, 'display', 'none');\n }\n},\n _unhideGhostForTarget = function _unhideGhostForTarget() {\n if (!supportCssPointerEvents && ghostEl) {\n css(ghostEl, 'display', '');\n }\n}; // #1184 fix - Prevent click event on fallback if dragged but item not changed position\n\n\nif (documentExists) {\n document.addEventListener('click', function (evt) {\n if (ignoreNextClick) {\n evt.preventDefault();\n evt.stopPropagation && evt.stopPropagation();\n evt.stopImmediatePropagation && evt.stopImmediatePropagation();\n ignoreNextClick = false;\n return false;\n }\n }, true);\n}\n\nvar nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent(evt) {\n if (dragEl) {\n evt = evt.touches ? evt.touches[0] : evt;\n\n var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY);\n\n if (nearest) {\n // Create imitation event\n var event = {};\n\n for (var i in evt) {\n if (evt.hasOwnProperty(i)) {\n event[i] = evt[i];\n }\n }\n\n event.target = event.rootEl = nearest;\n event.preventDefault = void 0;\n event.stopPropagation = void 0;\n\n nearest[expando]._onDragOver(event);\n }\n }\n};\n\nvar _checkOutsideTargetEl = function _checkOutsideTargetEl(evt) {\n if (dragEl) {\n dragEl.parentNode[expando]._isOutsideThisEl(evt.target);\n }\n};\n/**\n * @class Sortable\n * @param {HTMLElement} el\n * @param {Object} [options]\n */\n\n\nfunction Sortable(el, options) {\n if (!(el && el.nodeType && el.nodeType === 1)) {\n throw \"Sortable: `el` must be an HTMLElement, not \".concat({}.toString.call(el));\n }\n\n this.el = el; // root element\n\n this.options = options = _extends({}, options); // Export instance\n\n el[expando] = this;\n var defaults = {\n group: null,\n sort: true,\n disabled: false,\n store: null,\n handle: null,\n draggable: /^[uo]l$/i.test(el.nodeName) ? '>li' : '>*',\n swapThreshold: 1,\n // percentage; 0 <= x <= 1\n invertSwap: false,\n // invert always\n invertedSwapThreshold: null,\n // will be set to same as swapThreshold if default\n removeCloneOnHide: true,\n direction: function direction() {\n return _detectDirection(el, this.options);\n },\n ghostClass: 'sortable-ghost',\n chosenClass: 'sortable-chosen',\n dragClass: 'sortable-drag',\n ignore: 'a, img',\n filter: null,\n preventOnFilter: true,\n animation: 0,\n easing: null,\n setData: function setData(dataTransfer, dragEl) {\n dataTransfer.setData('Text', dragEl.textContent);\n },\n dropBubble: false,\n dragoverBubble: false,\n dataIdAttr: 'data-id',\n delay: 0,\n delayOnTouchOnly: false,\n touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1,\n forceFallback: false,\n fallbackClass: 'sortable-fallback',\n fallbackOnBody: false,\n fallbackTolerance: 0,\n fallbackOffset: {\n x: 0,\n y: 0\n },\n supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window && !Safari,\n emptyInsertThreshold: 5\n };\n PluginManager.initializePlugins(this, el, defaults); // Set default options\n\n for (var name in defaults) {\n !(name in options) && (options[name] = defaults[name]);\n }\n\n _prepareGroup(options); // Bind all private methods\n\n\n for (var fn in this) {\n if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {\n this[fn] = this[fn].bind(this);\n }\n } // Setup drag mode\n\n\n this.nativeDraggable = options.forceFallback ? false : supportDraggable;\n\n if (this.nativeDraggable) {\n // Touch start threshold cannot be greater than the native dragstart threshold\n this.options.touchStartThreshold = 1;\n } // Bind events\n\n\n if (options.supportPointer) {\n on(el, 'pointerdown', this._onTapStart);\n } else {\n on(el, 'mousedown', this._onTapStart);\n on(el, 'touchstart', this._onTapStart);\n }\n\n if (this.nativeDraggable) {\n on(el, 'dragover', this);\n on(el, 'dragenter', this);\n }\n\n sortables.push(this.el); // Restore sorting\n\n options.store && options.store.get && this.sort(options.store.get(this) || []); // Add animation state manager\n\n _extends(this, AnimationStateManager());\n}\n\nSortable.prototype =\n/** @lends Sortable.prototype */\n{\n constructor: Sortable,\n _isOutsideThisEl: function _isOutsideThisEl(target) {\n if (!this.el.contains(target) && target !== this.el) {\n lastTarget = null;\n }\n },\n _getDirection: function _getDirection(evt, target) {\n return typeof this.options.direction === 'function' ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction;\n },\n _onTapStart: function _onTapStart(\n /** Event|TouchEvent */\n evt) {\n if (!evt.cancelable) return;\n\n var _this = this,\n el = this.el,\n options = this.options,\n preventOnFilter = options.preventOnFilter,\n type = evt.type,\n touch = evt.touches && evt.touches[0] || evt.pointerType && evt.pointerType === 'touch' && evt,\n target = (touch || evt).target,\n originalTarget = evt.target.shadowRoot && (evt.path && evt.path[0] || evt.composedPath && evt.composedPath()[0]) || target,\n filter = options.filter;\n\n _saveInputCheckedState(el); // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.\n\n\n if (dragEl) {\n return;\n }\n\n if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {\n return; // only left button and enabled\n } // cancel dnd if original target is content editable\n\n\n if (originalTarget.isContentEditable) {\n return;\n } // Safari ignores further event handling after mousedown\n\n\n if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === 'SELECT') {\n return;\n }\n\n target = closest(target, options.draggable, el, false);\n\n if (target && target.animated) {\n return;\n }\n\n if (lastDownEl === target) {\n // Ignoring duplicate `down`\n return;\n } // Get the index of the dragged element within its parent\n\n\n oldIndex = index(target);\n oldDraggableIndex = index(target, options.draggable); // Check filter\n\n if (typeof filter === 'function') {\n if (filter.call(this, evt, target, this)) {\n _dispatchEvent({\n sortable: _this,\n rootEl: originalTarget,\n name: 'filter',\n targetEl: target,\n toEl: el,\n fromEl: el\n });\n\n pluginEvent('filter', _this, {\n evt: evt\n });\n preventOnFilter && evt.cancelable && evt.preventDefault();\n return; // cancel dnd\n }\n } else if (filter) {\n filter = filter.split(',').some(function (criteria) {\n criteria = closest(originalTarget, criteria.trim(), el, false);\n\n if (criteria) {\n _dispatchEvent({\n sortable: _this,\n rootEl: criteria,\n name: 'filter',\n targetEl: target,\n fromEl: el,\n toEl: el\n });\n\n pluginEvent('filter', _this, {\n evt: evt\n });\n return true;\n }\n });\n\n if (filter) {\n preventOnFilter && evt.cancelable && evt.preventDefault();\n return; // cancel dnd\n }\n }\n\n if (options.handle && !closest(originalTarget, options.handle, el, false)) {\n return;\n } // Prepare `dragstart`\n\n\n this._prepareDragStart(evt, touch, target);\n },\n _prepareDragStart: function _prepareDragStart(\n /** Event */\n evt,\n /** Touch */\n touch,\n /** HTMLElement */\n target) {\n var _this = this,\n el = _this.el,\n options = _this.options,\n ownerDocument = el.ownerDocument,\n dragStartFn;\n\n if (target && !dragEl && target.parentNode === el) {\n var dragRect = getRect(target);\n rootEl = el;\n dragEl = target;\n parentEl = dragEl.parentNode;\n nextEl = dragEl.nextSibling;\n lastDownEl = target;\n activeGroup = options.group;\n Sortable.dragged = dragEl;\n tapEvt = {\n target: dragEl,\n clientX: (touch || evt).clientX,\n clientY: (touch || evt).clientY\n };\n tapDistanceLeft = tapEvt.clientX - dragRect.left;\n tapDistanceTop = tapEvt.clientY - dragRect.top;\n this._lastX = (touch || evt).clientX;\n this._lastY = (touch || evt).clientY;\n dragEl.style['will-change'] = 'all';\n\n dragStartFn = function dragStartFn() {\n pluginEvent('delayEnded', _this, {\n evt: evt\n });\n\n if (Sortable.eventCanceled) {\n _this._onDrop();\n\n return;\n } // Delayed drag has been triggered\n // we can re-enable the events: touchmove/mousemove\n\n\n _this._disableDelayedDragEvents();\n\n if (!FireFox && _this.nativeDraggable) {\n dragEl.draggable = true;\n } // Bind the events: dragstart/dragend\n\n\n _this._triggerDragStart(evt, touch); // Drag start event\n\n\n _dispatchEvent({\n sortable: _this,\n name: 'choose',\n originalEvent: evt\n }); // Chosen item\n\n\n toggleClass(dragEl, options.chosenClass, true);\n }; // Disable \"draggable\"\n\n\n options.ignore.split(',').forEach(function (criteria) {\n find(dragEl, criteria.trim(), _disableDraggable);\n });\n on(ownerDocument, 'dragover', nearestEmptyInsertDetectEvent);\n on(ownerDocument, 'mousemove', nearestEmptyInsertDetectEvent);\n on(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent);\n on(ownerDocument, 'mouseup', _this._onDrop);\n on(ownerDocument, 'touchend', _this._onDrop);\n on(ownerDocument, 'touchcancel', _this._onDrop); // Make dragEl draggable (must be before delay for FireFox)\n\n if (FireFox && this.nativeDraggable) {\n this.options.touchStartThreshold = 4;\n dragEl.draggable = true;\n }\n\n pluginEvent('delayStart', this, {\n evt: evt\n }); // Delay is impossible for native DnD in Edge or IE\n\n if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) {\n if (Sortable.eventCanceled) {\n this._onDrop();\n\n return;\n } // If the user moves the pointer or let go the click or touch\n // before the delay has been reached:\n // disable the delayed drag\n\n\n on(ownerDocument, 'mouseup', _this._disableDelayedDrag);\n on(ownerDocument, 'touchend', _this._disableDelayedDrag);\n on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);\n on(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler);\n on(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler);\n options.supportPointer && on(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler);\n _this._dragStartTimer = setTimeout(dragStartFn, options.delay);\n } else {\n dragStartFn();\n }\n }\n },\n _delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler(\n /** TouchEvent|PointerEvent **/\n e) {\n var touch = e.touches ? e.touches[0] : e;\n\n if (Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1))) {\n this._disableDelayedDrag();\n }\n },\n _disableDelayedDrag: function _disableDelayedDrag() {\n dragEl && _disableDraggable(dragEl);\n clearTimeout(this._dragStartTimer);\n\n this._disableDelayedDragEvents();\n },\n _disableDelayedDragEvents: function _disableDelayedDragEvents() {\n var ownerDocument = this.el.ownerDocument;\n off(ownerDocument, 'mouseup', this._disableDelayedDrag);\n off(ownerDocument, 'touchend', this._disableDelayedDrag);\n off(ownerDocument, 'touchcancel', this._disableDelayedDrag);\n off(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler);\n off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler);\n off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler);\n },\n _triggerDragStart: function _triggerDragStart(\n /** Event */\n evt,\n /** Touch */\n touch) {\n touch = touch || evt.pointerType == 'touch' && evt;\n\n if (!this.nativeDraggable || touch) {\n if (this.options.supportPointer) {\n on(document, 'pointermove', this._onTouchMove);\n } else if (touch) {\n on(document, 'touchmove', this._onTouchMove);\n } else {\n on(document, 'mousemove', this._onTouchMove);\n }\n } else {\n on(dragEl, 'dragend', this);\n on(rootEl, 'dragstart', this._onDragStart);\n }\n\n try {\n if (document.selection) {\n // Timeout neccessary for IE9\n _nextTick(function () {\n document.selection.empty();\n });\n } else {\n window.getSelection().removeAllRanges();\n }\n } catch (err) {}\n },\n _dragStarted: function _dragStarted(fallback, evt) {\n\n awaitingDragStarted = false;\n\n if (rootEl && dragEl) {\n pluginEvent('dragStarted', this, {\n evt: evt\n });\n\n if (this.nativeDraggable) {\n on(document, 'dragover', _checkOutsideTargetEl);\n }\n\n var options = this.options; // Apply effect\n\n !fallback && toggleClass(dragEl, options.dragClass, false);\n toggleClass(dragEl, options.ghostClass, true);\n Sortable.active = this;\n fallback && this._appendGhost(); // Drag start event\n\n _dispatchEvent({\n sortable: this,\n name: 'start',\n originalEvent: evt\n });\n } else {\n this._nulling();\n }\n },\n _emulateDragOver: function _emulateDragOver() {\n if (touchEvt) {\n this._lastX = touchEvt.clientX;\n this._lastY = touchEvt.clientY;\n\n _hideGhostForTarget();\n\n var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY);\n var parent = target;\n\n while (target && target.shadowRoot) {\n target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY);\n if (target === parent) break;\n parent = target;\n }\n\n dragEl.parentNode[expando]._isOutsideThisEl(target);\n\n if (parent) {\n do {\n if (parent[expando]) {\n var inserted = void 0;\n inserted = parent[expando]._onDragOver({\n clientX: touchEvt.clientX,\n clientY: touchEvt.clientY,\n target: target,\n rootEl: parent\n });\n\n if (inserted && !this.options.dragoverBubble) {\n break;\n }\n }\n\n target = parent; // store last element\n }\n /* jshint boss:true */\n while (parent = parent.parentNode);\n }\n\n _unhideGhostForTarget();\n }\n },\n _onTouchMove: function _onTouchMove(\n /**TouchEvent*/\n evt) {\n if (tapEvt) {\n var options = this.options,\n fallbackTolerance = options.fallbackTolerance,\n fallbackOffset = options.fallbackOffset,\n touch = evt.touches ? evt.touches[0] : evt,\n ghostMatrix = ghostEl && matrix(ghostEl, true),\n scaleX = ghostEl && ghostMatrix && ghostMatrix.a,\n scaleY = ghostEl && ghostMatrix && ghostMatrix.d,\n relativeScrollOffset = PositionGhostAbsolutely && ghostRelativeParent && getRelativeScrollOffset(ghostRelativeParent),\n dx = (touch.clientX - tapEvt.clientX + fallbackOffset.x) / (scaleX || 1) + (relativeScrollOffset ? relativeScrollOffset[0] - ghostRelativeParentInitialScroll[0] : 0) / (scaleX || 1),\n dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1); // only set the status to dragging, when we are actually dragging\n\n if (!Sortable.active && !awaitingDragStarted) {\n if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) {\n return;\n }\n\n this._onDragStart(evt, true);\n }\n\n if (ghostEl) {\n if (ghostMatrix) {\n ghostMatrix.e += dx - (lastDx || 0);\n ghostMatrix.f += dy - (lastDy || 0);\n } else {\n ghostMatrix = {\n a: 1,\n b: 0,\n c: 0,\n d: 1,\n e: dx,\n f: dy\n };\n }\n\n var cssMatrix = \"matrix(\".concat(ghostMatrix.a, \",\").concat(ghostMatrix.b, \",\").concat(ghostMatrix.c, \",\").concat(ghostMatrix.d, \",\").concat(ghostMatrix.e, \",\").concat(ghostMatrix.f, \")\");\n css(ghostEl, 'webkitTransform', cssMatrix);\n css(ghostEl, 'mozTransform', cssMatrix);\n css(ghostEl, 'msTransform', cssMatrix);\n css(ghostEl, 'transform', cssMatrix);\n lastDx = dx;\n lastDy = dy;\n touchEvt = touch;\n }\n\n evt.cancelable && evt.preventDefault();\n }\n },\n _appendGhost: function _appendGhost() {\n // Bug if using scale(): https://stackoverflow.com/questions/2637058\n // Not being adjusted for\n if (!ghostEl) {\n var container = this.options.fallbackOnBody ? document.body : rootEl,\n rect = getRect(dragEl, true, PositionGhostAbsolutely, true, container),\n options = this.options; // Position absolutely\n\n if (PositionGhostAbsolutely) {\n // Get relatively positioned parent\n ghostRelativeParent = container;\n\n while (css(ghostRelativeParent, 'position') === 'static' && css(ghostRelativeParent, 'transform') === 'none' && ghostRelativeParent !== document) {\n ghostRelativeParent = ghostRelativeParent.parentNode;\n }\n\n if (ghostRelativeParent !== document.body && ghostRelativeParent !== document.documentElement) {\n if (ghostRelativeParent === document) ghostRelativeParent = getWindowScrollingElement();\n rect.top += ghostRelativeParent.scrollTop;\n rect.left += ghostRelativeParent.scrollLeft;\n } else {\n ghostRelativeParent = getWindowScrollingElement();\n }\n\n ghostRelativeParentInitialScroll = getRelativeScrollOffset(ghostRelativeParent);\n }\n\n ghostEl = dragEl.cloneNode(true);\n toggleClass(ghostEl, options.ghostClass, false);\n toggleClass(ghostEl, options.fallbackClass, true);\n toggleClass(ghostEl, options.dragClass, true);\n css(ghostEl, 'transition', '');\n css(ghostEl, 'transform', '');\n css(ghostEl, 'box-sizing', 'border-box');\n css(ghostEl, 'margin', 0);\n css(ghostEl, 'top', rect.top);\n css(ghostEl, 'left', rect.left);\n css(ghostEl, 'width', rect.width);\n css(ghostEl, 'height', rect.height);\n css(ghostEl, 'opacity', '0.8');\n css(ghostEl, 'position', PositionGhostAbsolutely ? 'absolute' : 'fixed');\n css(ghostEl, 'zIndex', '100000');\n css(ghostEl, 'pointerEvents', 'none');\n Sortable.ghost = ghostEl;\n container.appendChild(ghostEl); // Set transform-origin\n\n css(ghostEl, 'transform-origin', tapDistanceLeft / parseInt(ghostEl.style.width) * 100 + '% ' + tapDistanceTop / parseInt(ghostEl.style.height) * 100 + '%');\n }\n },\n _onDragStart: function _onDragStart(\n /**Event*/\n evt,\n /**boolean*/\n fallback) {\n var _this = this;\n\n var dataTransfer = evt.dataTransfer;\n var options = _this.options;\n pluginEvent('dragStart', this, {\n evt: evt\n });\n\n if (Sortable.eventCanceled) {\n this._onDrop();\n\n return;\n }\n\n pluginEvent('setupClone', this);\n\n if (!Sortable.eventCanceled) {\n cloneEl = clone(dragEl);\n cloneEl.draggable = false;\n cloneEl.style['will-change'] = '';\n\n this._hideClone();\n\n toggleClass(cloneEl, this.options.chosenClass, false);\n Sortable.clone = cloneEl;\n } // #1143: IFrame support workaround\n\n\n _this.cloneId = _nextTick(function () {\n pluginEvent('clone', _this);\n if (Sortable.eventCanceled) return;\n\n if (!_this.options.removeCloneOnHide) {\n rootEl.insertBefore(cloneEl, dragEl);\n }\n\n _this._hideClone();\n\n _dispatchEvent({\n sortable: _this,\n name: 'clone'\n });\n });\n !fallback && toggleClass(dragEl, options.dragClass, true); // Set proper drop events\n\n if (fallback) {\n ignoreNextClick = true;\n _this._loopId = setInterval(_this._emulateDragOver, 50);\n } else {\n // Undo what was set in _prepareDragStart before drag started\n off(document, 'mouseup', _this._onDrop);\n off(document, 'touchend', _this._onDrop);\n off(document, 'touchcancel', _this._onDrop);\n\n if (dataTransfer) {\n dataTransfer.effectAllowed = 'move';\n options.setData && options.setData.call(_this, dataTransfer, dragEl);\n }\n\n on(document, 'drop', _this); // #1276 fix:\n\n css(dragEl, 'transform', 'translateZ(0)');\n }\n\n awaitingDragStarted = true;\n _this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt));\n on(document, 'selectstart', _this);\n moved = true;\n\n if (Safari) {\n css(document.body, 'user-select', 'none');\n }\n },\n // Returns true - if no further action is needed (either inserted or another condition)\n _onDragOver: function _onDragOver(\n /**Event*/\n evt) {\n var el = this.el,\n target = evt.target,\n dragRect,\n targetRect,\n revert,\n options = this.options,\n group = options.group,\n activeSortable = Sortable.active,\n isOwner = activeGroup === group,\n canSort = options.sort,\n fromSortable = putSortable || activeSortable,\n vertical,\n _this = this,\n completedFired = false;\n\n if (_silent) return;\n\n function dragOverEvent(name, extra) {\n pluginEvent(name, _this, _objectSpread2({\n evt: evt,\n isOwner: isOwner,\n axis: vertical ? 'vertical' : 'horizontal',\n revert: revert,\n dragRect: dragRect,\n targetRect: targetRect,\n canSort: canSort,\n fromSortable: fromSortable,\n target: target,\n completed: completed,\n onMove: function onMove(target, after) {\n return _onMove(rootEl, el, dragEl, dragRect, target, getRect(target), evt, after);\n },\n changed: changed\n }, extra));\n } // Capture animation state\n\n\n function capture() {\n dragOverEvent('dragOverAnimationCapture');\n\n _this.captureAnimationState();\n\n if (_this !== fromSortable) {\n fromSortable.captureAnimationState();\n }\n } // Return invocation when dragEl is inserted (or completed)\n\n\n function completed(insertion) {\n dragOverEvent('dragOverCompleted', {\n insertion: insertion\n });\n\n if (insertion) {\n // Clones must be hidden before folding animation to capture dragRectAbsolute properly\n if (isOwner) {\n activeSortable._hideClone();\n } else {\n activeSortable._showClone(_this);\n }\n\n if (_this !== fromSortable) {\n // Set ghost class to new sortable's ghost class\n toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : activeSortable.options.ghostClass, false);\n toggleClass(dragEl, options.ghostClass, true);\n }\n\n if (putSortable !== _this && _this !== Sortable.active) {\n putSortable = _this;\n } else if (_this === Sortable.active && putSortable) {\n putSortable = null;\n } // Animation\n\n\n if (fromSortable === _this) {\n _this._ignoreWhileAnimating = target;\n }\n\n _this.animateAll(function () {\n dragOverEvent('dragOverAnimationComplete');\n _this._ignoreWhileAnimating = null;\n });\n\n if (_this !== fromSortable) {\n fromSortable.animateAll();\n fromSortable._ignoreWhileAnimating = null;\n }\n } // Null lastTarget if it is not inside a previously swapped element\n\n\n if (target === dragEl && !dragEl.animated || target === el && !target.animated) {\n lastTarget = null;\n } // no bubbling and not fallback\n\n\n if (!options.dragoverBubble && !evt.rootEl && target !== document) {\n dragEl.parentNode[expando]._isOutsideThisEl(evt.target); // Do not detect for empty insert if already inserted\n\n\n !insertion && nearestEmptyInsertDetectEvent(evt);\n }\n\n !options.dragoverBubble && evt.stopPropagation && evt.stopPropagation();\n return completedFired = true;\n } // Call when dragEl has been inserted\n\n\n function changed() {\n newIndex = index(dragEl);\n newDraggableIndex = index(dragEl, options.draggable);\n\n _dispatchEvent({\n sortable: _this,\n name: 'change',\n toEl: el,\n newIndex: newIndex,\n newDraggableIndex: newDraggableIndex,\n originalEvent: evt\n });\n }\n\n if (evt.preventDefault !== void 0) {\n evt.cancelable && evt.preventDefault();\n }\n\n target = closest(target, options.draggable, el, true);\n dragOverEvent('dragOver');\n if (Sortable.eventCanceled) return completedFired;\n\n if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) {\n return completed(false);\n }\n\n ignoreNextClick = false;\n\n if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = parentEl !== rootEl) // Reverting item into the original list\n : putSortable === this || (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt))) {\n vertical = this._getDirection(evt, target) === 'vertical';\n dragRect = getRect(dragEl);\n dragOverEvent('dragOverValid');\n if (Sortable.eventCanceled) return completedFired;\n\n if (revert) {\n parentEl = rootEl; // actualization\n\n capture();\n\n this._hideClone();\n\n dragOverEvent('revert');\n\n if (!Sortable.eventCanceled) {\n if (nextEl) {\n rootEl.insertBefore(dragEl, nextEl);\n } else {\n rootEl.appendChild(dragEl);\n }\n }\n\n return completed(true);\n }\n\n var elLastChild = lastChild(el, options.draggable);\n\n if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) {\n // Insert to end of list\n // If already at end of list: Do not insert\n if (elLastChild === dragEl) {\n return completed(false);\n } // if there is a last element, it is the target\n\n\n if (elLastChild && el === evt.target) {\n target = elLastChild;\n }\n\n if (target) {\n targetRect = getRect(target);\n }\n\n if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {\n capture();\n el.appendChild(dragEl);\n parentEl = el; // actualization\n\n changed();\n return completed(true);\n }\n } else if (elLastChild && _ghostIsFirst(evt, vertical, this)) {\n // Insert to start of list\n var firstChild = getChild(el, 0, options, true);\n\n if (firstChild === dragEl) {\n return completed(false);\n }\n\n target = firstChild;\n targetRect = getRect(target);\n\n if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, false) !== false) {\n capture();\n el.insertBefore(dragEl, firstChild);\n parentEl = el; // actualization\n\n changed();\n return completed(true);\n }\n } else if (target.parentNode === el) {\n targetRect = getRect(target);\n var direction = 0,\n targetBeforeFirstSwap,\n differentLevel = dragEl.parentNode !== el,\n differentRowCol = !_dragElInRowColumn(dragEl.animated && dragEl.toRect || dragRect, target.animated && target.toRect || targetRect, vertical),\n side1 = vertical ? 'top' : 'left',\n scrolledPastTop = isScrolledPast(target, 'top', 'top') || isScrolledPast(dragEl, 'top', 'top'),\n scrollBefore = scrolledPastTop ? scrolledPastTop.scrollTop : void 0;\n\n if (lastTarget !== target) {\n targetBeforeFirstSwap = targetRect[side1];\n pastFirstInvertThresh = false;\n isCircumstantialInvert = !differentRowCol && options.invertSwap || differentLevel;\n }\n\n direction = _getSwapDirection(evt, target, targetRect, vertical, differentRowCol ? 1 : options.swapThreshold, options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold, isCircumstantialInvert, lastTarget === target);\n var sibling;\n\n if (direction !== 0) {\n // Check if target is beside dragEl in respective direction (ignoring hidden elements)\n var dragIndex = index(dragEl);\n\n do {\n dragIndex -= direction;\n sibling = parentEl.children[dragIndex];\n } while (sibling && (css(sibling, 'display') === 'none' || sibling === ghostEl));\n } // If dragEl is already beside target: Do not insert\n\n\n if (direction === 0 || sibling === target) {\n return completed(false);\n }\n\n lastTarget = target;\n lastDirection = direction;\n var nextSibling = target.nextElementSibling,\n after = false;\n after = direction === 1;\n\n var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);\n\n if (moveVector !== false) {\n if (moveVector === 1 || moveVector === -1) {\n after = moveVector === 1;\n }\n\n _silent = true;\n setTimeout(_unsilent, 30);\n capture();\n\n if (after && !nextSibling) {\n el.appendChild(dragEl);\n } else {\n target.parentNode.insertBefore(dragEl, after ? nextSibling : target);\n } // Undo chrome's scroll adjustment (has no effect on other browsers)\n\n\n if (scrolledPastTop) {\n scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop);\n }\n\n parentEl = dragEl.parentNode; // actualization\n // must be done before animation\n\n if (targetBeforeFirstSwap !== undefined && !isCircumstantialInvert) {\n targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect(target)[side1]);\n }\n\n changed();\n return completed(true);\n }\n }\n\n if (el.contains(dragEl)) {\n return completed(false);\n }\n }\n\n return false;\n },\n _ignoreWhileAnimating: null,\n _offMoveEvents: function _offMoveEvents() {\n off(document, 'mousemove', this._onTouchMove);\n off(document, 'touchmove', this._onTouchMove);\n off(document, 'pointermove', this._onTouchMove);\n off(document, 'dragover', nearestEmptyInsertDetectEvent);\n off(document, 'mousemove', nearestEmptyInsertDetectEvent);\n off(document, 'touchmove', nearestEmptyInsertDetectEvent);\n },\n _offUpEvents: function _offUpEvents() {\n var ownerDocument = this.el.ownerDocument;\n off(ownerDocument, 'mouseup', this._onDrop);\n off(ownerDocument, 'touchend', this._onDrop);\n off(ownerDocument, 'pointerup', this._onDrop);\n off(ownerDocument, 'touchcancel', this._onDrop);\n off(document, 'selectstart', this);\n },\n _onDrop: function _onDrop(\n /**Event*/\n evt) {\n var el = this.el,\n options = this.options; // Get the index of the dragged element within its parent\n\n newIndex = index(dragEl);\n newDraggableIndex = index(dragEl, options.draggable);\n pluginEvent('drop', this, {\n evt: evt\n });\n parentEl = dragEl && dragEl.parentNode; // Get again after plugin event\n\n newIndex = index(dragEl);\n newDraggableIndex = index(dragEl, options.draggable);\n\n if (Sortable.eventCanceled) {\n this._nulling();\n\n return;\n }\n\n awaitingDragStarted = false;\n isCircumstantialInvert = false;\n pastFirstInvertThresh = false;\n clearInterval(this._loopId);\n clearTimeout(this._dragStartTimer);\n\n _cancelNextTick(this.cloneId);\n\n _cancelNextTick(this._dragStartId); // Unbind events\n\n\n if (this.nativeDraggable) {\n off(document, 'drop', this);\n off(el, 'dragstart', this._onDragStart);\n }\n\n this._offMoveEvents();\n\n this._offUpEvents();\n\n if (Safari) {\n css(document.body, 'user-select', '');\n }\n\n css(dragEl, 'transform', '');\n\n if (evt) {\n if (moved) {\n evt.cancelable && evt.preventDefault();\n !options.dropBubble && evt.stopPropagation();\n }\n\n ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);\n\n if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') {\n // Remove clone(s)\n cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);\n }\n\n if (dragEl) {\n if (this.nativeDraggable) {\n off(dragEl, 'dragend', this);\n }\n\n _disableDraggable(dragEl);\n\n dragEl.style['will-change'] = ''; // Remove classes\n // ghostClass is added in dragStarted\n\n if (moved && !awaitingDragStarted) {\n toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : this.options.ghostClass, false);\n }\n\n toggleClass(dragEl, this.options.chosenClass, false); // Drag stop event\n\n _dispatchEvent({\n sortable: this,\n name: 'unchoose',\n toEl: parentEl,\n newIndex: null,\n newDraggableIndex: null,\n originalEvent: evt\n });\n\n if (rootEl !== parentEl) {\n if (newIndex >= 0) {\n // Add event\n _dispatchEvent({\n rootEl: parentEl,\n name: 'add',\n toEl: parentEl,\n fromEl: rootEl,\n originalEvent: evt\n }); // Remove event\n\n\n _dispatchEvent({\n sortable: this,\n name: 'remove',\n toEl: parentEl,\n originalEvent: evt\n }); // drag from one list and drop into another\n\n\n _dispatchEvent({\n rootEl: parentEl,\n name: 'sort',\n toEl: parentEl,\n fromEl: rootEl,\n originalEvent: evt\n });\n\n _dispatchEvent({\n sortable: this,\n name: 'sort',\n toEl: parentEl,\n originalEvent: evt\n });\n }\n\n putSortable && putSortable.save();\n } else {\n if (newIndex !== oldIndex) {\n if (newIndex >= 0) {\n // drag & drop within the same list\n _dispatchEvent({\n sortable: this,\n name: 'update',\n toEl: parentEl,\n originalEvent: evt\n });\n\n _dispatchEvent({\n sortable: this,\n name: 'sort',\n toEl: parentEl,\n originalEvent: evt\n });\n }\n }\n }\n\n if (Sortable.active) {\n /* jshint eqnull:true */\n if (newIndex == null || newIndex === -1) {\n newIndex = oldIndex;\n newDraggableIndex = oldDraggableIndex;\n }\n\n _dispatchEvent({\n sortable: this,\n name: 'end',\n toEl: parentEl,\n originalEvent: evt\n }); // Save sorting\n\n\n this.save();\n }\n }\n }\n\n this._nulling();\n },\n _nulling: function _nulling() {\n pluginEvent('nulling', this);\n rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = cloneHidden = tapEvt = touchEvt = moved = newIndex = newDraggableIndex = oldIndex = oldDraggableIndex = lastTarget = lastDirection = putSortable = activeGroup = Sortable.dragged = Sortable.ghost = Sortable.clone = Sortable.active = null;\n savedInputChecked.forEach(function (el) {\n el.checked = true;\n });\n savedInputChecked.length = lastDx = lastDy = 0;\n },\n handleEvent: function handleEvent(\n /**Event*/\n evt) {\n switch (evt.type) {\n case 'drop':\n case 'dragend':\n this._onDrop(evt);\n\n break;\n\n case 'dragenter':\n case 'dragover':\n if (dragEl) {\n this._onDragOver(evt);\n\n _globalDragOver(evt);\n }\n\n break;\n\n case 'selectstart':\n evt.preventDefault();\n break;\n }\n },\n\n /**\n * Serializes the item into an array of string.\n * @returns {String[]}\n */\n toArray: function toArray() {\n var order = [],\n el,\n children = this.el.children,\n i = 0,\n n = children.length,\n options = this.options;\n\n for (; i < n; i++) {\n el = children[i];\n\n if (closest(el, options.draggable, this.el, false)) {\n order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));\n }\n }\n\n return order;\n },\n\n /**\n * Sorts the elements according to the array.\n * @param {String[]} order order of the items\n */\n sort: function sort(order, useAnimation) {\n var items = {},\n rootEl = this.el;\n this.toArray().forEach(function (id, i) {\n var el = rootEl.children[i];\n\n if (closest(el, this.options.draggable, rootEl, false)) {\n items[id] = el;\n }\n }, this);\n useAnimation && this.captureAnimationState();\n order.forEach(function (id) {\n if (items[id]) {\n rootEl.removeChild(items[id]);\n rootEl.appendChild(items[id]);\n }\n });\n useAnimation && this.animateAll();\n },\n\n /**\n * Save the current sorting\n */\n save: function save() {\n var store = this.options.store;\n store && store.set && store.set(this);\n },\n\n /**\n * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.\n * @param {HTMLElement} el\n * @param {String} [selector] default: `options.draggable`\n * @returns {HTMLElement|null}\n */\n closest: function closest$1(el, selector) {\n return closest(el, selector || this.options.draggable, this.el, false);\n },\n\n /**\n * Set/get option\n * @param {string} name\n * @param {*} [value]\n * @returns {*}\n */\n option: function option(name, value) {\n var options = this.options;\n\n if (value === void 0) {\n return options[name];\n } else {\n var modifiedValue = PluginManager.modifyOption(this, name, value);\n\n if (typeof modifiedValue !== 'undefined') {\n options[name] = modifiedValue;\n } else {\n options[name] = value;\n }\n\n if (name === 'group') {\n _prepareGroup(options);\n }\n }\n },\n\n /**\n * Destroy\n */\n destroy: function destroy() {\n pluginEvent('destroy', this);\n var el = this.el;\n el[expando] = null;\n off(el, 'mousedown', this._onTapStart);\n off(el, 'touchstart', this._onTapStart);\n off(el, 'pointerdown', this._onTapStart);\n\n if (this.nativeDraggable) {\n off(el, 'dragover', this);\n off(el, 'dragenter', this);\n } // Remove draggable attributes\n\n\n Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {\n el.removeAttribute('draggable');\n });\n\n this._onDrop();\n\n this._disableDelayedDragEvents();\n\n sortables.splice(sortables.indexOf(this.el), 1);\n this.el = el = null;\n },\n _hideClone: function _hideClone() {\n if (!cloneHidden) {\n pluginEvent('hideClone', this);\n if (Sortable.eventCanceled) return;\n css(cloneEl, 'display', 'none');\n\n if (this.options.removeCloneOnHide && cloneEl.parentNode) {\n cloneEl.parentNode.removeChild(cloneEl);\n }\n\n cloneHidden = true;\n }\n },\n _showClone: function _showClone(putSortable) {\n if (putSortable.lastPutMode !== 'clone') {\n this._hideClone();\n\n return;\n }\n\n if (cloneHidden) {\n pluginEvent('showClone', this);\n if (Sortable.eventCanceled) return; // show clone at dragEl or original position\n\n if (dragEl.parentNode == rootEl && !this.options.group.revertClone) {\n rootEl.insertBefore(cloneEl, dragEl);\n } else if (nextEl) {\n rootEl.insertBefore(cloneEl, nextEl);\n } else {\n rootEl.appendChild(cloneEl);\n }\n\n if (this.options.group.revertClone) {\n this.animate(dragEl, cloneEl);\n }\n\n css(cloneEl, 'display', '');\n cloneHidden = false;\n }\n }\n};\n\nfunction _globalDragOver(\n/**Event*/\nevt) {\n if (evt.dataTransfer) {\n evt.dataTransfer.dropEffect = 'move';\n }\n\n evt.cancelable && evt.preventDefault();\n}\n\nfunction _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) {\n var evt,\n sortable = fromEl[expando],\n onMoveFn = sortable.options.onMove,\n retVal; // Support for new CustomEvent feature\n\n if (window.CustomEvent && !IE11OrLess && !Edge) {\n evt = new CustomEvent('move', {\n bubbles: true,\n cancelable: true\n });\n } else {\n evt = document.createEvent('Event');\n evt.initEvent('move', true, true);\n }\n\n evt.to = toEl;\n evt.from = fromEl;\n evt.dragged = dragEl;\n evt.draggedRect = dragRect;\n evt.related = targetEl || toEl;\n evt.relatedRect = targetRect || getRect(toEl);\n evt.willInsertAfter = willInsertAfter;\n evt.originalEvent = originalEvent;\n fromEl.dispatchEvent(evt);\n\n if (onMoveFn) {\n retVal = onMoveFn.call(sortable, evt, originalEvent);\n }\n\n return retVal;\n}\n\nfunction _disableDraggable(el) {\n el.draggable = false;\n}\n\nfunction _unsilent() {\n _silent = false;\n}\n\nfunction _ghostIsFirst(evt, vertical, sortable) {\n var rect = getRect(getChild(sortable.el, 0, sortable.options, true));\n var spacer = 10;\n return vertical ? evt.clientX < rect.left - spacer || evt.clientY < rect.top && evt.clientX < rect.right : evt.clientY < rect.top - spacer || evt.clientY < rect.bottom && evt.clientX < rect.left;\n}\n\nfunction _ghostIsLast(evt, vertical, sortable) {\n var rect = getRect(lastChild(sortable.el, sortable.options.draggable));\n var spacer = 10;\n return vertical ? evt.clientX > rect.right + spacer || evt.clientX <= rect.right && evt.clientY > rect.bottom && evt.clientX >= rect.left : evt.clientX > rect.right && evt.clientY > rect.top || evt.clientX <= rect.right && evt.clientY > rect.bottom + spacer;\n}\n\nfunction _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {\n var mouseOnAxis = vertical ? evt.clientY : evt.clientX,\n targetLength = vertical ? targetRect.height : targetRect.width,\n targetS1 = vertical ? targetRect.top : targetRect.left,\n targetS2 = vertical ? targetRect.bottom : targetRect.right,\n invert = false;\n\n if (!invertSwap) {\n // Never invert or create dragEl shadow when target movemenet causes mouse to move past the end of regular swapThreshold\n if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) {\n // multiplied only by swapThreshold because mouse will already be inside target by (1 - threshold) * targetLength / 2\n // check if past first invert threshold on side opposite of lastDirection\n if (!pastFirstInvertThresh && (lastDirection === 1 ? mouseOnAxis > targetS1 + targetLength * invertedSwapThreshold / 2 : mouseOnAxis < targetS2 - targetLength * invertedSwapThreshold / 2)) {\n // past first invert threshold, do not restrict inverted threshold to dragEl shadow\n pastFirstInvertThresh = true;\n }\n\n if (!pastFirstInvertThresh) {\n // dragEl shadow (target move distance shadow)\n if (lastDirection === 1 ? mouseOnAxis < targetS1 + targetMoveDistance // over dragEl shadow\n : mouseOnAxis > targetS2 - targetMoveDistance) {\n return -lastDirection;\n }\n } else {\n invert = true;\n }\n } else {\n // Regular\n if (mouseOnAxis > targetS1 + targetLength * (1 - swapThreshold) / 2 && mouseOnAxis < targetS2 - targetLength * (1 - swapThreshold) / 2) {\n return _getInsertDirection(target);\n }\n }\n }\n\n invert = invert || invertSwap;\n\n if (invert) {\n // Invert of regular\n if (mouseOnAxis < targetS1 + targetLength * invertedSwapThreshold / 2 || mouseOnAxis > targetS2 - targetLength * invertedSwapThreshold / 2) {\n return mouseOnAxis > targetS1 + targetLength / 2 ? 1 : -1;\n }\n }\n\n return 0;\n}\n/**\n * Gets the direction dragEl must be swapped relative to target in order to make it\n * seem that dragEl has been \"inserted\" into that element's position\n * @param {HTMLElement} target The target whose position dragEl is being inserted at\n * @return {Number} Direction dragEl must be swapped\n */\n\n\nfunction _getInsertDirection(target) {\n if (index(dragEl) < index(target)) {\n return 1;\n } else {\n return -1;\n }\n}\n/**\n * Generate id\n * @param {HTMLElement} el\n * @returns {String}\n * @private\n */\n\n\nfunction _generateId(el) {\n var str = el.tagName + el.className + el.src + el.href + el.textContent,\n i = str.length,\n sum = 0;\n\n while (i--) {\n sum += str.charCodeAt(i);\n }\n\n return sum.toString(36);\n}\n\nfunction _saveInputCheckedState(root) {\n savedInputChecked.length = 0;\n var inputs = root.getElementsByTagName('input');\n var idx = inputs.length;\n\n while (idx--) {\n var el = inputs[idx];\n el.checked && savedInputChecked.push(el);\n }\n}\n\nfunction _nextTick(fn) {\n return setTimeout(fn, 0);\n}\n\nfunction _cancelNextTick(id) {\n return clearTimeout(id);\n} // Fixed #973:\n\n\nif (documentExists) {\n on(document, 'touchmove', function (evt) {\n if ((Sortable.active || awaitingDragStarted) && evt.cancelable) {\n evt.preventDefault();\n }\n });\n} // Export utils\n\n\nSortable.utils = {\n on: on,\n off: off,\n css: css,\n find: find,\n is: function is(el, selector) {\n return !!closest(el, selector, el, false);\n },\n extend: extend,\n throttle: throttle,\n closest: closest,\n toggleClass: toggleClass,\n clone: clone,\n index: index,\n nextTick: _nextTick,\n cancelNextTick: _cancelNextTick,\n detectDirection: _detectDirection,\n getChild: getChild\n};\n/**\n * Get the Sortable instance of an element\n * @param {HTMLElement} element The element\n * @return {Sortable|undefined} The instance of Sortable\n */\n\nSortable.get = function (element) {\n return element[expando];\n};\n/**\n * Mount a plugin to Sortable\n * @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted\n */\n\n\nSortable.mount = function () {\n for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) {\n plugins[_key] = arguments[_key];\n }\n\n if (plugins[0].constructor === Array) plugins = plugins[0];\n plugins.forEach(function (plugin) {\n if (!plugin.prototype || !plugin.prototype.constructor) {\n throw \"Sortable: Mounted plugin must be a constructor function, not \".concat({}.toString.call(plugin));\n }\n\n if (plugin.utils) Sortable.utils = _objectSpread2(_objectSpread2({}, Sortable.utils), plugin.utils);\n PluginManager.mount(plugin);\n });\n};\n/**\n * Create sortable instance\n * @param {HTMLElement} el\n * @param {Object} [options]\n */\n\n\nSortable.create = function (el, options) {\n return new Sortable(el, options);\n}; // Export\n\n\nSortable.version = version;\n\nvar autoScrolls = [],\n scrollEl,\n scrollRootEl,\n scrolling = false,\n lastAutoScrollX,\n lastAutoScrollY,\n touchEvt$1,\n pointerElemChangedInterval;\n\nfunction AutoScrollPlugin() {\n function AutoScroll() {\n this.defaults = {\n scroll: true,\n forceAutoScrollFallback: false,\n scrollSensitivity: 30,\n scrollSpeed: 10,\n bubbleScroll: true\n }; // Bind all private methods\n\n for (var fn in this) {\n if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {\n this[fn] = this[fn].bind(this);\n }\n }\n }\n\n AutoScroll.prototype = {\n dragStarted: function dragStarted(_ref) {\n var originalEvent = _ref.originalEvent;\n\n if (this.sortable.nativeDraggable) {\n on(document, 'dragover', this._handleAutoScroll);\n } else {\n if (this.options.supportPointer) {\n on(document, 'pointermove', this._handleFallbackAutoScroll);\n } else if (originalEvent.touches) {\n on(document, 'touchmove', this._handleFallbackAutoScroll);\n } else {\n on(document, 'mousemove', this._handleFallbackAutoScroll);\n }\n }\n },\n dragOverCompleted: function dragOverCompleted(_ref2) {\n var originalEvent = _ref2.originalEvent;\n\n // For when bubbling is canceled and using fallback (fallback 'touchmove' always reached)\n if (!this.options.dragOverBubble && !originalEvent.rootEl) {\n this._handleAutoScroll(originalEvent);\n }\n },\n drop: function drop() {\n if (this.sortable.nativeDraggable) {\n off(document, 'dragover', this._handleAutoScroll);\n } else {\n off(document, 'pointermove', this._handleFallbackAutoScroll);\n off(document, 'touchmove', this._handleFallbackAutoScroll);\n off(document, 'mousemove', this._handleFallbackAutoScroll);\n }\n\n clearPointerElemChangedInterval();\n clearAutoScrolls();\n cancelThrottle();\n },\n nulling: function nulling() {\n touchEvt$1 = scrollRootEl = scrollEl = scrolling = pointerElemChangedInterval = lastAutoScrollX = lastAutoScrollY = null;\n autoScrolls.length = 0;\n },\n _handleFallbackAutoScroll: function _handleFallbackAutoScroll(evt) {\n this._handleAutoScroll(evt, true);\n },\n _handleAutoScroll: function _handleAutoScroll(evt, fallback) {\n var _this = this;\n\n var x = (evt.touches ? evt.touches[0] : evt).clientX,\n y = (evt.touches ? evt.touches[0] : evt).clientY,\n elem = document.elementFromPoint(x, y);\n touchEvt$1 = evt; // IE does not seem to have native autoscroll,\n // Edge's autoscroll seems too conditional,\n // MACOS Safari does not have autoscroll,\n // Firefox and Chrome are good\n\n if (fallback || this.options.forceAutoScrollFallback || Edge || IE11OrLess || Safari) {\n autoScroll(evt, this.options, elem, fallback); // Listener for pointer element change\n\n var ogElemScroller = getParentAutoScrollElement(elem, true);\n\n if (scrolling && (!pointerElemChangedInterval || x !== lastAutoScrollX || y !== lastAutoScrollY)) {\n pointerElemChangedInterval && clearPointerElemChangedInterval(); // Detect for pointer elem change, emulating native DnD behaviour\n\n pointerElemChangedInterval = setInterval(function () {\n var newElem = getParentAutoScrollElement(document.elementFromPoint(x, y), true);\n\n if (newElem !== ogElemScroller) {\n ogElemScroller = newElem;\n clearAutoScrolls();\n }\n\n autoScroll(evt, _this.options, newElem, fallback);\n }, 10);\n lastAutoScrollX = x;\n lastAutoScrollY = y;\n }\n } else {\n // if DnD is enabled (and browser has good autoscrolling), first autoscroll will already scroll, so get parent autoscroll of first autoscroll\n if (!this.options.bubbleScroll || getParentAutoScrollElement(elem, true) === getWindowScrollingElement()) {\n clearAutoScrolls();\n return;\n }\n\n autoScroll(evt, this.options, getParentAutoScrollElement(elem, false), false);\n }\n }\n };\n return _extends(AutoScroll, {\n pluginName: 'scroll',\n initializeByDefault: true\n });\n}\n\nfunction clearAutoScrolls() {\n autoScrolls.forEach(function (autoScroll) {\n clearInterval(autoScroll.pid);\n });\n autoScrolls = [];\n}\n\nfunction clearPointerElemChangedInterval() {\n clearInterval(pointerElemChangedInterval);\n}\n\nvar autoScroll = throttle(function (evt, options, rootEl, isFallback) {\n // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521\n if (!options.scroll) return;\n var x = (evt.touches ? evt.touches[0] : evt).clientX,\n y = (evt.touches ? evt.touches[0] : evt).clientY,\n sens = options.scrollSensitivity,\n speed = options.scrollSpeed,\n winScroller = getWindowScrollingElement();\n var scrollThisInstance = false,\n scrollCustomFn; // New scroll root, set scrollEl\n\n if (scrollRootEl !== rootEl) {\n scrollRootEl = rootEl;\n clearAutoScrolls();\n scrollEl = options.scroll;\n scrollCustomFn = options.scrollFn;\n\n if (scrollEl === true) {\n scrollEl = getParentAutoScrollElement(rootEl, true);\n }\n }\n\n var layersOut = 0;\n var currentParent = scrollEl;\n\n do {\n var el = currentParent,\n rect = getRect(el),\n top = rect.top,\n bottom = rect.bottom,\n left = rect.left,\n right = rect.right,\n width = rect.width,\n height = rect.height,\n canScrollX = void 0,\n canScrollY = void 0,\n scrollWidth = el.scrollWidth,\n scrollHeight = el.scrollHeight,\n elCSS = css(el),\n scrollPosX = el.scrollLeft,\n scrollPosY = el.scrollTop;\n\n if (el === winScroller) {\n canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll' || elCSS.overflowX === 'visible');\n canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll' || elCSS.overflowY === 'visible');\n } else {\n canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll');\n canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll');\n }\n\n var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX);\n var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY);\n\n if (!autoScrolls[layersOut]) {\n for (var i = 0; i <= layersOut; i++) {\n if (!autoScrolls[i]) {\n autoScrolls[i] = {};\n }\n }\n }\n\n if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) {\n autoScrolls[layersOut].el = el;\n autoScrolls[layersOut].vx = vx;\n autoScrolls[layersOut].vy = vy;\n clearInterval(autoScrolls[layersOut].pid);\n\n if (vx != 0 || vy != 0) {\n scrollThisInstance = true;\n /* jshint loopfunc:true */\n\n autoScrolls[layersOut].pid = setInterval(function () {\n // emulate drag over during autoscroll (fallback), emulating native DnD behaviour\n if (isFallback && this.layer === 0) {\n Sortable.active._onTouchMove(touchEvt$1); // To move ghost if it is positioned absolutely\n\n }\n\n var scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0;\n var scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0;\n\n if (typeof scrollCustomFn === 'function') {\n if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt$1, autoScrolls[this.layer].el) !== 'continue') {\n return;\n }\n }\n\n scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY);\n }.bind({\n layer: layersOut\n }), 24);\n }\n }\n\n layersOut++;\n } while (options.bubbleScroll && currentParent !== winScroller && (currentParent = getParentAutoScrollElement(currentParent, false)));\n\n scrolling = scrollThisInstance; // in case another function catches scrolling as false in between when it is not\n}, 30);\n\nvar drop = function drop(_ref) {\n var originalEvent = _ref.originalEvent,\n putSortable = _ref.putSortable,\n dragEl = _ref.dragEl,\n activeSortable = _ref.activeSortable,\n dispatchSortableEvent = _ref.dispatchSortableEvent,\n hideGhostForTarget = _ref.hideGhostForTarget,\n unhideGhostForTarget = _ref.unhideGhostForTarget;\n if (!originalEvent) return;\n var toSortable = putSortable || activeSortable;\n hideGhostForTarget();\n var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent;\n var target = document.elementFromPoint(touch.clientX, touch.clientY);\n unhideGhostForTarget();\n\n if (toSortable && !toSortable.el.contains(target)) {\n dispatchSortableEvent('spill');\n this.onSpill({\n dragEl: dragEl,\n putSortable: putSortable\n });\n }\n};\n\nfunction Revert() {}\n\nRevert.prototype = {\n startIndex: null,\n dragStart: function dragStart(_ref2) {\n var oldDraggableIndex = _ref2.oldDraggableIndex;\n this.startIndex = oldDraggableIndex;\n },\n onSpill: function onSpill(_ref3) {\n var dragEl = _ref3.dragEl,\n putSortable = _ref3.putSortable;\n this.sortable.captureAnimationState();\n\n if (putSortable) {\n putSortable.captureAnimationState();\n }\n\n var nextSibling = getChild(this.sortable.el, this.startIndex, this.options);\n\n if (nextSibling) {\n this.sortable.el.insertBefore(dragEl, nextSibling);\n } else {\n this.sortable.el.appendChild(dragEl);\n }\n\n this.sortable.animateAll();\n\n if (putSortable) {\n putSortable.animateAll();\n }\n },\n drop: drop\n};\n\n_extends(Revert, {\n pluginName: 'revertOnSpill'\n});\n\nfunction Remove() {}\n\nRemove.prototype = {\n onSpill: function onSpill(_ref4) {\n var dragEl = _ref4.dragEl,\n putSortable = _ref4.putSortable;\n var parentSortable = putSortable || this.sortable;\n parentSortable.captureAnimationState();\n dragEl.parentNode && dragEl.parentNode.removeChild(dragEl);\n parentSortable.animateAll();\n },\n drop: drop\n};\n\n_extends(Remove, {\n pluginName: 'removeOnSpill'\n});\n\nvar OnSpill = [Remove, Revert];\n\nvar lastSwapEl;\n\nfunction SwapPlugin() {\n function Swap() {\n this.defaults = {\n swapClass: 'sortable-swap-highlight'\n };\n }\n\n Swap.prototype = {\n dragStart: function dragStart(_ref) {\n var dragEl = _ref.dragEl;\n lastSwapEl = dragEl;\n },\n dragOverValid: function dragOverValid(_ref2) {\n var completed = _ref2.completed,\n target = _ref2.target,\n onMove = _ref2.onMove,\n activeSortable = _ref2.activeSortable,\n changed = _ref2.changed,\n cancel = _ref2.cancel;\n if (!activeSortable.options.swap) return;\n var el = this.sortable.el,\n options = this.options;\n\n if (target && target !== el) {\n var prevSwapEl = lastSwapEl;\n\n if (onMove(target) !== false) {\n toggleClass(target, options.swapClass, true);\n lastSwapEl = target;\n } else {\n lastSwapEl = null;\n }\n\n if (prevSwapEl && prevSwapEl !== lastSwapEl) {\n toggleClass(prevSwapEl, options.swapClass, false);\n }\n }\n\n changed();\n completed(true);\n cancel();\n },\n drop: function drop(_ref3) {\n var activeSortable = _ref3.activeSortable,\n putSortable = _ref3.putSortable,\n dragEl = _ref3.dragEl;\n var toSortable = putSortable || this.sortable;\n var options = this.options;\n lastSwapEl && toggleClass(lastSwapEl, options.swapClass, false);\n\n if (lastSwapEl && (options.swap || putSortable && putSortable.options.swap)) {\n if (dragEl !== lastSwapEl) {\n toSortable.captureAnimationState();\n if (toSortable !== activeSortable) activeSortable.captureAnimationState();\n swapNodes(dragEl, lastSwapEl);\n toSortable.animateAll();\n if (toSortable !== activeSortable) activeSortable.animateAll();\n }\n }\n },\n nulling: function nulling() {\n lastSwapEl = null;\n }\n };\n return _extends(Swap, {\n pluginName: 'swap',\n eventProperties: function eventProperties() {\n return {\n swapItem: lastSwapEl\n };\n }\n });\n}\n\nfunction swapNodes(n1, n2) {\n var p1 = n1.parentNode,\n p2 = n2.parentNode,\n i1,\n i2;\n if (!p1 || !p2 || p1.isEqualNode(n2) || p2.isEqualNode(n1)) return;\n i1 = index(n1);\n i2 = index(n2);\n\n if (p1.isEqualNode(p2) && i1 < i2) {\n i2++;\n }\n\n p1.insertBefore(n2, p1.children[i1]);\n p2.insertBefore(n1, p2.children[i2]);\n}\n\nvar multiDragElements = [],\n multiDragClones = [],\n lastMultiDragSelect,\n // for selection with modifier key down (SHIFT)\nmultiDragSortable,\n initialFolding = false,\n // Initial multi-drag fold when drag started\nfolding = false,\n // Folding any other time\ndragStarted = false,\n dragEl$1,\n clonesFromRect,\n clonesHidden;\n\nfunction MultiDragPlugin() {\n function MultiDrag(sortable) {\n // Bind all private methods\n for (var fn in this) {\n if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {\n this[fn] = this[fn].bind(this);\n }\n }\n\n if (sortable.options.supportPointer) {\n on(document, 'pointerup', this._deselectMultiDrag);\n } else {\n on(document, 'mouseup', this._deselectMultiDrag);\n on(document, 'touchend', this._deselectMultiDrag);\n }\n\n on(document, 'keydown', this._checkKeyDown);\n on(document, 'keyup', this._checkKeyUp);\n this.defaults = {\n selectedClass: 'sortable-selected',\n multiDragKey: null,\n setData: function setData(dataTransfer, dragEl) {\n var data = '';\n\n if (multiDragElements.length && multiDragSortable === sortable) {\n multiDragElements.forEach(function (multiDragElement, i) {\n data += (!i ? '' : ', ') + multiDragElement.textContent;\n });\n } else {\n data = dragEl.textContent;\n }\n\n dataTransfer.setData('Text', data);\n }\n };\n }\n\n MultiDrag.prototype = {\n multiDragKeyDown: false,\n isMultiDrag: false,\n delayStartGlobal: function delayStartGlobal(_ref) {\n var dragged = _ref.dragEl;\n dragEl$1 = dragged;\n },\n delayEnded: function delayEnded() {\n this.isMultiDrag = ~multiDragElements.indexOf(dragEl$1);\n },\n setupClone: function setupClone(_ref2) {\n var sortable = _ref2.sortable,\n cancel = _ref2.cancel;\n if (!this.isMultiDrag) return;\n\n for (var i = 0; i < multiDragElements.length; i++) {\n multiDragClones.push(clone(multiDragElements[i]));\n multiDragClones[i].sortableIndex = multiDragElements[i].sortableIndex;\n multiDragClones[i].draggable = false;\n multiDragClones[i].style['will-change'] = '';\n toggleClass(multiDragClones[i], this.options.selectedClass, false);\n multiDragElements[i] === dragEl$1 && toggleClass(multiDragClones[i], this.options.chosenClass, false);\n }\n\n sortable._hideClone();\n\n cancel();\n },\n clone: function clone(_ref3) {\n var sortable = _ref3.sortable,\n rootEl = _ref3.rootEl,\n dispatchSortableEvent = _ref3.dispatchSortableEvent,\n cancel = _ref3.cancel;\n if (!this.isMultiDrag) return;\n\n if (!this.options.removeCloneOnHide) {\n if (multiDragElements.length && multiDragSortable === sortable) {\n insertMultiDragClones(true, rootEl);\n dispatchSortableEvent('clone');\n cancel();\n }\n }\n },\n showClone: function showClone(_ref4) {\n var cloneNowShown = _ref4.cloneNowShown,\n rootEl = _ref4.rootEl,\n cancel = _ref4.cancel;\n if (!this.isMultiDrag) return;\n insertMultiDragClones(false, rootEl);\n multiDragClones.forEach(function (clone) {\n css(clone, 'display', '');\n });\n cloneNowShown();\n clonesHidden = false;\n cancel();\n },\n hideClone: function hideClone(_ref5) {\n var _this = this;\n\n var sortable = _ref5.sortable,\n cloneNowHidden = _ref5.cloneNowHidden,\n cancel = _ref5.cancel;\n if (!this.isMultiDrag) return;\n multiDragClones.forEach(function (clone) {\n css(clone, 'display', 'none');\n\n if (_this.options.removeCloneOnHide && clone.parentNode) {\n clone.parentNode.removeChild(clone);\n }\n });\n cloneNowHidden();\n clonesHidden = true;\n cancel();\n },\n dragStartGlobal: function dragStartGlobal(_ref6) {\n var sortable = _ref6.sortable;\n\n if (!this.isMultiDrag && multiDragSortable) {\n multiDragSortable.multiDrag._deselectMultiDrag();\n }\n\n multiDragElements.forEach(function (multiDragElement) {\n multiDragElement.sortableIndex = index(multiDragElement);\n }); // Sort multi-drag elements\n\n multiDragElements = multiDragElements.sort(function (a, b) {\n return a.sortableIndex - b.sortableIndex;\n });\n dragStarted = true;\n },\n dragStarted: function dragStarted(_ref7) {\n var _this2 = this;\n\n var sortable = _ref7.sortable;\n if (!this.isMultiDrag) return;\n\n if (this.options.sort) {\n // Capture rects,\n // hide multi drag elements (by positioning them absolute),\n // set multi drag elements rects to dragRect,\n // show multi drag elements,\n // animate to rects,\n // unset rects & remove from DOM\n sortable.captureAnimationState();\n\n if (this.options.animation) {\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement === dragEl$1) return;\n css(multiDragElement, 'position', 'absolute');\n });\n var dragRect = getRect(dragEl$1, false, true, true);\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement === dragEl$1) return;\n setRect(multiDragElement, dragRect);\n });\n folding = true;\n initialFolding = true;\n }\n }\n\n sortable.animateAll(function () {\n folding = false;\n initialFolding = false;\n\n if (_this2.options.animation) {\n multiDragElements.forEach(function (multiDragElement) {\n unsetRect(multiDragElement);\n });\n } // Remove all auxiliary multidrag items from el, if sorting enabled\n\n\n if (_this2.options.sort) {\n removeMultiDragElements();\n }\n });\n },\n dragOver: function dragOver(_ref8) {\n var target = _ref8.target,\n completed = _ref8.completed,\n cancel = _ref8.cancel;\n\n if (folding && ~multiDragElements.indexOf(target)) {\n completed(false);\n cancel();\n }\n },\n revert: function revert(_ref9) {\n var fromSortable = _ref9.fromSortable,\n rootEl = _ref9.rootEl,\n sortable = _ref9.sortable,\n dragRect = _ref9.dragRect;\n\n if (multiDragElements.length > 1) {\n // Setup unfold animation\n multiDragElements.forEach(function (multiDragElement) {\n sortable.addAnimationState({\n target: multiDragElement,\n rect: folding ? getRect(multiDragElement) : dragRect\n });\n unsetRect(multiDragElement);\n multiDragElement.fromRect = dragRect;\n fromSortable.removeAnimationState(multiDragElement);\n });\n folding = false;\n insertMultiDragElements(!this.options.removeCloneOnHide, rootEl);\n }\n },\n dragOverCompleted: function dragOverCompleted(_ref10) {\n var sortable = _ref10.sortable,\n isOwner = _ref10.isOwner,\n insertion = _ref10.insertion,\n activeSortable = _ref10.activeSortable,\n parentEl = _ref10.parentEl,\n putSortable = _ref10.putSortable;\n var options = this.options;\n\n if (insertion) {\n // Clones must be hidden before folding animation to capture dragRectAbsolute properly\n if (isOwner) {\n activeSortable._hideClone();\n }\n\n initialFolding = false; // If leaving sort:false root, or already folding - Fold to new location\n\n if (options.animation && multiDragElements.length > 1 && (folding || !isOwner && !activeSortable.options.sort && !putSortable)) {\n // Fold: Set all multi drag elements's rects to dragEl's rect when multi-drag elements are invisible\n var dragRectAbsolute = getRect(dragEl$1, false, true, true);\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement === dragEl$1) return;\n setRect(multiDragElement, dragRectAbsolute); // Move element(s) to end of parentEl so that it does not interfere with multi-drag clones insertion if they are inserted\n // while folding, and so that we can capture them again because old sortable will no longer be fromSortable\n\n parentEl.appendChild(multiDragElement);\n });\n folding = true;\n } // Clones must be shown (and check to remove multi drags) after folding when interfering multiDragElements are moved out\n\n\n if (!isOwner) {\n // Only remove if not folding (folding will remove them anyways)\n if (!folding) {\n removeMultiDragElements();\n }\n\n if (multiDragElements.length > 1) {\n var clonesHiddenBefore = clonesHidden;\n\n activeSortable._showClone(sortable); // Unfold animation for clones if showing from hidden\n\n\n if (activeSortable.options.animation && !clonesHidden && clonesHiddenBefore) {\n multiDragClones.forEach(function (clone) {\n activeSortable.addAnimationState({\n target: clone,\n rect: clonesFromRect\n });\n clone.fromRect = clonesFromRect;\n clone.thisAnimationDuration = null;\n });\n }\n } else {\n activeSortable._showClone(sortable);\n }\n }\n }\n },\n dragOverAnimationCapture: function dragOverAnimationCapture(_ref11) {\n var dragRect = _ref11.dragRect,\n isOwner = _ref11.isOwner,\n activeSortable = _ref11.activeSortable;\n multiDragElements.forEach(function (multiDragElement) {\n multiDragElement.thisAnimationDuration = null;\n });\n\n if (activeSortable.options.animation && !isOwner && activeSortable.multiDrag.isMultiDrag) {\n clonesFromRect = _extends({}, dragRect);\n var dragMatrix = matrix(dragEl$1, true);\n clonesFromRect.top -= dragMatrix.f;\n clonesFromRect.left -= dragMatrix.e;\n }\n },\n dragOverAnimationComplete: function dragOverAnimationComplete() {\n if (folding) {\n folding = false;\n removeMultiDragElements();\n }\n },\n drop: function drop(_ref12) {\n var evt = _ref12.originalEvent,\n rootEl = _ref12.rootEl,\n parentEl = _ref12.parentEl,\n sortable = _ref12.sortable,\n dispatchSortableEvent = _ref12.dispatchSortableEvent,\n oldIndex = _ref12.oldIndex,\n putSortable = _ref12.putSortable;\n var toSortable = putSortable || this.sortable;\n if (!evt) return;\n var options = this.options,\n children = parentEl.children; // Multi-drag selection\n\n if (!dragStarted) {\n if (options.multiDragKey && !this.multiDragKeyDown) {\n this._deselectMultiDrag();\n }\n\n toggleClass(dragEl$1, options.selectedClass, !~multiDragElements.indexOf(dragEl$1));\n\n if (!~multiDragElements.indexOf(dragEl$1)) {\n multiDragElements.push(dragEl$1);\n dispatchEvent({\n sortable: sortable,\n rootEl: rootEl,\n name: 'select',\n targetEl: dragEl$1,\n originalEvt: evt\n }); // Modifier activated, select from last to dragEl\n\n if (evt.shiftKey && lastMultiDragSelect && sortable.el.contains(lastMultiDragSelect)) {\n var lastIndex = index(lastMultiDragSelect),\n currentIndex = index(dragEl$1);\n\n if (~lastIndex && ~currentIndex && lastIndex !== currentIndex) {\n // Must include lastMultiDragSelect (select it), in case modified selection from no selection\n // (but previous selection existed)\n var n, i;\n\n if (currentIndex > lastIndex) {\n i = lastIndex;\n n = currentIndex;\n } else {\n i = currentIndex;\n n = lastIndex + 1;\n }\n\n for (; i < n; i++) {\n if (~multiDragElements.indexOf(children[i])) continue;\n toggleClass(children[i], options.selectedClass, true);\n multiDragElements.push(children[i]);\n dispatchEvent({\n sortable: sortable,\n rootEl: rootEl,\n name: 'select',\n targetEl: children[i],\n originalEvt: evt\n });\n }\n }\n } else {\n lastMultiDragSelect = dragEl$1;\n }\n\n multiDragSortable = toSortable;\n } else {\n multiDragElements.splice(multiDragElements.indexOf(dragEl$1), 1);\n lastMultiDragSelect = null;\n dispatchEvent({\n sortable: sortable,\n rootEl: rootEl,\n name: 'deselect',\n targetEl: dragEl$1,\n originalEvt: evt\n });\n }\n } // Multi-drag drop\n\n\n if (dragStarted && this.isMultiDrag) {\n folding = false; // Do not \"unfold\" after around dragEl if reverted\n\n if ((parentEl[expando].options.sort || parentEl !== rootEl) && multiDragElements.length > 1) {\n var dragRect = getRect(dragEl$1),\n multiDragIndex = index(dragEl$1, ':not(.' + this.options.selectedClass + ')');\n if (!initialFolding && options.animation) dragEl$1.thisAnimationDuration = null;\n toSortable.captureAnimationState();\n\n if (!initialFolding) {\n if (options.animation) {\n dragEl$1.fromRect = dragRect;\n multiDragElements.forEach(function (multiDragElement) {\n multiDragElement.thisAnimationDuration = null;\n\n if (multiDragElement !== dragEl$1) {\n var rect = folding ? getRect(multiDragElement) : dragRect;\n multiDragElement.fromRect = rect; // Prepare unfold animation\n\n toSortable.addAnimationState({\n target: multiDragElement,\n rect: rect\n });\n }\n });\n } // Multi drag elements are not necessarily removed from the DOM on drop, so to reinsert\n // properly they must all be removed\n\n\n removeMultiDragElements();\n multiDragElements.forEach(function (multiDragElement) {\n if (children[multiDragIndex]) {\n parentEl.insertBefore(multiDragElement, children[multiDragIndex]);\n } else {\n parentEl.appendChild(multiDragElement);\n }\n\n multiDragIndex++;\n }); // If initial folding is done, the elements may have changed position because they are now\n // unfolding around dragEl, even though dragEl may not have his index changed, so update event\n // must be fired here as Sortable will not.\n\n if (oldIndex === index(dragEl$1)) {\n var update = false;\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement.sortableIndex !== index(multiDragElement)) {\n update = true;\n return;\n }\n });\n\n if (update) {\n dispatchSortableEvent('update');\n }\n }\n } // Must be done after capturing individual rects (scroll bar)\n\n\n multiDragElements.forEach(function (multiDragElement) {\n unsetRect(multiDragElement);\n });\n toSortable.animateAll();\n }\n\n multiDragSortable = toSortable;\n } // Remove clones if necessary\n\n\n if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') {\n multiDragClones.forEach(function (clone) {\n clone.parentNode && clone.parentNode.removeChild(clone);\n });\n }\n },\n nullingGlobal: function nullingGlobal() {\n this.isMultiDrag = dragStarted = false;\n multiDragClones.length = 0;\n },\n destroyGlobal: function destroyGlobal() {\n this._deselectMultiDrag();\n\n off(document, 'pointerup', this._deselectMultiDrag);\n off(document, 'mouseup', this._deselectMultiDrag);\n off(document, 'touchend', this._deselectMultiDrag);\n off(document, 'keydown', this._checkKeyDown);\n off(document, 'keyup', this._checkKeyUp);\n },\n _deselectMultiDrag: function _deselectMultiDrag(evt) {\n if (typeof dragStarted !== \"undefined\" && dragStarted) return; // Only deselect if selection is in this sortable\n\n if (multiDragSortable !== this.sortable) return; // Only deselect if target is not item in this sortable\n\n if (evt && closest(evt.target, this.options.draggable, this.sortable.el, false)) return; // Only deselect if left click\n\n if (evt && evt.button !== 0) return;\n\n while (multiDragElements.length) {\n var el = multiDragElements[0];\n toggleClass(el, this.options.selectedClass, false);\n multiDragElements.shift();\n dispatchEvent({\n sortable: this.sortable,\n rootEl: this.sortable.el,\n name: 'deselect',\n targetEl: el,\n originalEvt: evt\n });\n }\n },\n _checkKeyDown: function _checkKeyDown(evt) {\n if (evt.key === this.options.multiDragKey) {\n this.multiDragKeyDown = true;\n }\n },\n _checkKeyUp: function _checkKeyUp(evt) {\n if (evt.key === this.options.multiDragKey) {\n this.multiDragKeyDown = false;\n }\n }\n };\n return _extends(MultiDrag, {\n // Static methods & properties\n pluginName: 'multiDrag',\n utils: {\n /**\n * Selects the provided multi-drag item\n * @param {HTMLElement} el The element to be selected\n */\n select: function select(el) {\n var sortable = el.parentNode[expando];\n if (!sortable || !sortable.options.multiDrag || ~multiDragElements.indexOf(el)) return;\n\n if (multiDragSortable && multiDragSortable !== sortable) {\n multiDragSortable.multiDrag._deselectMultiDrag();\n\n multiDragSortable = sortable;\n }\n\n toggleClass(el, sortable.options.selectedClass, true);\n multiDragElements.push(el);\n },\n\n /**\n * Deselects the provided multi-drag item\n * @param {HTMLElement} el The element to be deselected\n */\n deselect: function deselect(el) {\n var sortable = el.parentNode[expando],\n index = multiDragElements.indexOf(el);\n if (!sortable || !sortable.options.multiDrag || !~index) return;\n toggleClass(el, sortable.options.selectedClass, false);\n multiDragElements.splice(index, 1);\n }\n },\n eventProperties: function eventProperties() {\n var _this3 = this;\n\n var oldIndicies = [],\n newIndicies = [];\n multiDragElements.forEach(function (multiDragElement) {\n oldIndicies.push({\n multiDragElement: multiDragElement,\n index: multiDragElement.sortableIndex\n }); // multiDragElements will already be sorted if folding\n\n var newIndex;\n\n if (folding && multiDragElement !== dragEl$1) {\n newIndex = -1;\n } else if (folding) {\n newIndex = index(multiDragElement, ':not(.' + _this3.options.selectedClass + ')');\n } else {\n newIndex = index(multiDragElement);\n }\n\n newIndicies.push({\n multiDragElement: multiDragElement,\n index: newIndex\n });\n });\n return {\n items: _toConsumableArray(multiDragElements),\n clones: [].concat(multiDragClones),\n oldIndicies: oldIndicies,\n newIndicies: newIndicies\n };\n },\n optionListeners: {\n multiDragKey: function multiDragKey(key) {\n key = key.toLowerCase();\n\n if (key === 'ctrl') {\n key = 'Control';\n } else if (key.length > 1) {\n key = key.charAt(0).toUpperCase() + key.substr(1);\n }\n\n return key;\n }\n }\n });\n}\n\nfunction insertMultiDragElements(clonesInserted, rootEl) {\n multiDragElements.forEach(function (multiDragElement, i) {\n var target = rootEl.children[multiDragElement.sortableIndex + (clonesInserted ? Number(i) : 0)];\n\n if (target) {\n rootEl.insertBefore(multiDragElement, target);\n } else {\n rootEl.appendChild(multiDragElement);\n }\n });\n}\n/**\n * Insert multi-drag clones\n * @param {[Boolean]} elementsInserted Whether the multi-drag elements are inserted\n * @param {HTMLElement} rootEl\n */\n\n\nfunction insertMultiDragClones(elementsInserted, rootEl) {\n multiDragClones.forEach(function (clone, i) {\n var target = rootEl.children[clone.sortableIndex + (elementsInserted ? Number(i) : 0)];\n\n if (target) {\n rootEl.insertBefore(clone, target);\n } else {\n rootEl.appendChild(clone);\n }\n });\n}\n\nfunction removeMultiDragElements() {\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement === dragEl$1) return;\n multiDragElement.parentNode && multiDragElement.parentNode.removeChild(multiDragElement);\n });\n}\n\nexport default Sortable;\nexport { AutoScrollPlugin as AutoScroll, MultiDragPlugin as MultiDrag, OnSpill, Sortable, SwapPlugin as Swap };\n", "import Sortable from 'sortablejs/modular/sortable.core.esm.js';\n\nconst template = document.createElement('template');\ntemplate.innerHTML = `\n\n\n
\n

\n
\n \n \n
\n
\n
\n
\n`;\n\nclass ItemList extends HTMLElement {\n constructor ({\n type = '',\n header = '',\n createButton = '',\n service = {}\n }) {\n super();\n this.type = type;\n this.service = service;\n this.header = header;\n this.createButton = createButton;\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.appendChild(template.content.cloneNode(true));\n this.itemList = this.shadowRoot.querySelector('#item-list');\n this.setAttribute('role', 'region');\n this.shadowRoot.querySelector('h2').innerHTML = this.header;\n this.shadowRoot.querySelector('.btn-create').innerHTML = this.createButton;\n this._getAll();\n }\n\n connectedCallback () {\n this.shadowRoot.querySelector('.btn-collapse').addEventListener('click', this._collapseAll.bind(this));\n this.shadowRoot.querySelector('.btn-create').addEventListener('click', this._createItem.bind(this));\n\n this.sortable = new Sortable(this.itemList, {\n draggable: '#item-list > *',\n dataIdAttr: 'data-id',\n store: {\n /**\n * Save the order of elements. Called onEnd (when the item is dropped).\n * @param {Sortable} sortable\n */\n set: (sortable) => {\n const order = sortable.toArray();\n this._sortItems(order);\n }\n }\n });\n\n this.service.emitter.on(`${this.type}:add`, this._addItem.bind(this));\n this.service.emitter.on(`${this.type}:delete`, this._removeItem.bind(this));\n this.service.emitter.on(`${this.type}:edit`, this._updateItem.bind(this));\n }\n\n disconnectedCallback () {\n this.shadowRoot.querySelector('.btn-collapse').removeEventListener('click', this._collapseAll.bind(this));\n this.shadowRoot.querySelector('.btn-create').removeEventListener('click', this._createItem.bind(this));\n\n this.sortable.destroy();\n\n this.service.emitter.off(`${this.type}:add`, this._addItem.bind(this));\n this.service.emitter.off(`${this.type}:delete`, this._removeItem.bind(this));\n this.service.emitter.off(`${this.type}:edit`, this._updateItem.bind(this));\n }\n\n _getAll () {\n this.service.getAll().forEach((item) => {\n const display = this.service.getDisplay();\n display.setItem(item);\n this.itemList.appendChild(display);\n });\n }\n\n _collapseAll () {\n this.shadowRoot.querySelectorAll('#item-list > *').forEach((el) => {\n el.collapse();\n });\n }\n\n _sortItems (idArray) {\n this.service.sort(idArray);\n }\n\n _createItem () {\n this.service.create('edit');\n }\n\n _addItem ({ item, mode }) {\n const id = item.id;\n if (this.shadowRoot.querySelector(`#${this.type}_${id}`)) {\n return;\n }\n const display = this.service.getDisplay();\n display.setItem(item);\n if (mode === 'edit') {\n display._enableEdit();\n }\n this.itemList.appendChild(display);\n if (mode === 'edit') {\n display.shadowRoot.querySelector('input').focus();\n }\n }\n\n _updateItem ({ item }) {\n const id = item.id;\n const display = this.shadowRoot.querySelector(`#${this.type}_${id}`);\n if (!display) {\n return;\n }\n display.setItem(item);\n }\n /**\n * Remove an item from the list.\n * @param {String} id Item uuid.\n */\n _removeItem ({ id }) {\n const itemDisplay = this.shadowRoot.querySelector(`[data-id=\"${id}\"]`);\n if (itemDisplay) {\n this.shadowRoot.querySelector('h2').focus();\n itemDisplay.parentElement.removeChild(itemDisplay);\n }\n }\n};\n\nwindow.customElements.define('had-itemlist', ItemList);\n\nexport default ItemList;\n", "import ItemList from './itemList.js';\nimport * as notesService from '../services/notesService.js';\n\nclass NotesList extends ItemList {\n constructor () {\n super({\n type: 'note',\n header: 'Notes',\n createButton: 'Create Note',\n service: notesService\n });\n }\n};\n\nwindow.customElements.define('had-noteslist', NotesList);\n\nexport default NotesList;\n", "import { rollDie } from '../services/randomTableService.js';\n\nconst template = document.createElement('template');\ntemplate.innerHTML = `\n\n\n\n\n`;\n\nclass DiceRoller extends HTMLElement {\n constructor () {\n super();\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.appendChild(template.content.cloneNode(true));\n\n this.result = this.shadowRoot.querySelector('.result');\n this.button = this.shadowRoot.querySelector('button');\n }\n\n connectedCallback () {\n this.button.addEventListener('click', this._roll.bind(this));\n }\n\n disconnectedCallback () {\n this.button.removeEventListener('click', this._roll.bind(this));\n }\n\n _roll () {\n const result = rollDie('2d6');\n this.result.innerHTML = result;\n }\n};\n\nwindow.customElements.define('had-diceroller', DiceRoller);\n\nexport default DiceRoller;\n", "import store from '../store/store.js';\nimport { createNPC, updateNPC, deleteNPC, sortNPCs, clearNPCs, importNPCs } from '../store/npcs-reducer.js';\n\nimport npcSchema from '../models/npcSchema.js';\nimport NPC from '../models/npc.js';\nimport { tableRoller } from '../services/randomTableService.js';\nimport { applySchemaToNPC } from '../../node_modules/rpg-table-randomizer/src/npc_generator';\nimport EventEmitter from '../models/EventEmitter.js';\nimport NPCDisplay from '../components/npcdisplay.js';\n\nconst emitter = new EventEmitter();\n\nconst getAll = function () {\n const npcs = store.getState().npcs;\n return npcs.map((obj) => {\n return new NPC(obj);\n });\n};\n\nconst getById = function (id) {\n const npcs = store.getState().npcs;\n const data = npcs.find((npc) => {\n return npc.id === id;\n });\n if (data) {\n return new NPC(data);\n }\n return null;\n};\n\nconst create = function (mode = 'view', npc = null) {\n if (!(npc instanceof NPC)) {\n npc = new NPC({});\n applySchemaToNPC(npcSchema, tableRoller, npc);\n }\n store.dispatch(createNPC({ npc: npc.toJSON() }));\n emitter.trigger('npc:add', {\n item: npc,\n mode\n });\n return npc;\n};\n\nconst save = function (npc) {\n store.dispatch(updateNPC({ npc: npc.toJSON() }));\n emitter.trigger('npc:edit', {\n item: npc\n });\n};\n\nconst remove = function (id) {\n store.dispatch(deleteNPC({ id }));\n emitter.trigger('npc:delete', {\n id\n });\n};\n\nconst sort = function (sortUuids) {\n store.dispatch(sortNPCs({ sortUuids }));\n};\n\nconst deleteAll = function () {\n store.dispatch(clearNPCs());\n};\n\nconst importAll = function (npcs) {\n store.dispatch(importNPCs({ npcs }));\n npcs.forEach((npcData) => {\n if (!npcData.id) {\n return;\n }\n const npc = new NPC(npcData);\n emitter.trigger('npc:add', {\n item: npc\n });\n });\n};\n\nconst getDisplay = function () {\n return new NPCDisplay();\n};\n\nexport {\n emitter,\n getAll,\n getById,\n create,\n save,\n sort,\n remove,\n deleteAll,\n importAll,\n getDisplay\n};\n", "import NPCSchema from 'rpg-table-randomizer/src/NPCSchema.js';\nimport NPCSchemaField from 'rpg-table-randomizer/src/NPCSchemaField.js';\n\nconst npcName = new NPCSchemaField({\n key: 'npcName',\n label: 'Name',\n type: 'string',\n source: 'name:western',\n count: 1\n});\n\nconst field1 = new NPCSchemaField({\n key: 'job',\n label: 'Occupation',\n type: 'string',\n source: 'table:jobs',\n count: 1\n});\n\nconst field2 = new NPCSchemaField({\n key: 'long_goal',\n label: 'Goal (Long term)',\n type: 'string',\n source: 'table:goals:long_term',\n count: 1\n});\n\nconst field3 = new NPCSchemaField({\n key: 'short_goal',\n label: 'Goal (Short term)',\n type: 'string',\n source: 'table:goals:short_term',\n count: 1\n});\n\nconst field4 = new NPCSchemaField({\n key: 'secret',\n label: 'Secret',\n type: 'string',\n source: 'table:goals:secrets',\n count: 1\n});\n\nconst appNPCSchema = new NPCSchema({\n key: 'hadleyville',\n name: 'Hadleyville NPC',\n fields: [\n npcName,\n field1,\n field2,\n field3,\n field4\n ]\n});\n\nexport default appNPCSchema;\n", "\nimport NPC from 'rpg-table-randomizer/src/NPC.js';\nimport MarkdownIt from 'markdown-it/lib';\n\nexport default class AppNPC extends NPC {\n constructor ({\n id = null,\n schema = 'hadleyville',\n fields = new Map(),\n notes = '',\n collapse = false\n }) {\n super({\n id,\n schema,\n fields\n });\n this.notes = notes;\n this.collapse = !!collapse;\n }\n\n get name () {\n return this.getFieldValue('npcName');\n }\n\n get job () {\n return this.getFieldValue('job');\n }\n\n get longGoal () {\n return this.getFieldValue('long_goal');\n }\n\n get shortGoal () {\n return this.getFieldValue('short_goal');\n }\n\n get secret () {\n return this.getFieldValue('secret');\n }\n\n getFieldDisplay (field) {\n if (field === 'notes') {\n return this.noteHtml;\n }\n return this.fields.get(field);\n }\n\n get noteHtml () {\n const md = new MarkdownIt();\n return md.render(this.notes);\n }\n}\n", "import TableRoller from './TableRoller.js';\nimport { isEmpty } from './r_helpers.js';\nimport NPC from './NPC.js';\nimport NPCSchema from './NPCSchema.js';\n\n/**\n * Object store for registered schemas\n */\nconst Schemas = {};\n/**\n * Add new schema to store.\n * @param {NPCSchema} schema\n */\nconst registerSchema = function (schema) {\n if (!(schema instanceof NPCSchema) || !schema.key || schema.key === 'base') {\n throw Error('Invalid schema');\n }\n // store it for later reference\n Schemas[schema.key] = schema;\n};\n/**\n * Get all registered schemas.\n * @returns {NPCSchema[]}\n */\nconst getAllSchemas = function () {\n return Schemas;\n};\n/**\n * Get schema by key.\n * @param {String} key Schema key.\n * @returns {NPCSchema|null}\n */\nconst getSchemaByKey = function (key) {\n return Schemas[key] || null;\n};\n/**\n * Create a new NPC from a Schema.\n * @param {String} schemaKey Key for an NPCSchema\n * @param {TableRoller} tableRoller\n * @param {Boolean} generateId Should the npc get a uuid.\n * @returns NPC\n */\nconst initializeNewNPC = function (schemaKey, tableRoller, generateId = true) {\n const schema = getSchemaByKey(schemaKey);\n if (!schema) {\n throw Error('Schema not found.');\n }\n if (!(tableRoller instanceof TableRoller)) {\n throw Error('Invalid tableRoller');\n }\n\n const npc = new NPC({\n schema: schemaKey,\n id: (generateId ? null : '')\n });\n\n applySchemaToNPC(schema, tableRoller, npc);\n return npc;\n};\n/**\n * Apply a schema to an NPC.\n * You could pass in children of NPC class here.\n * @param {NPCSchema} schema\n * @param {TableRoller} tableRoller\n * @param {NPC} npc With either blank schema or set to same key as schema arg\n */\nconst applySchemaToNPC = function (schema, tableRoller, npc) {\n if (!(npc instanceof NPC)) {\n throw Error('npc object must be or inherit from NPC class.');\n }\n if (!(schema instanceof NPCSchema)) {\n throw Error('schema object must be or inherit from NPCSchema class.');\n }\n if (!(tableRoller instanceof TableRoller)) {\n throw Error('Invalid tableRoller');\n }\n if (npc.schema === '') {\n npc.schema = schema.key;\n }\n if (npc.schema !== schema.key) {\n throw Error('npc already has schema set.');\n }\n schema.fields.forEach((field) => {\n const key = field.key;\n if (!isEmpty(field.starting_value)) {\n npc.setFieldValue(key, field.starting_value);\n return;\n }\n if (!isEmpty(field.source)) {\n if (field.type === 'array') {\n const value = [];\n const ct = (field.count) ? field.count : 1;\n for (let i = 0; i < ct; i++) {\n value.push(tableRoller.convertToken(field.source));\n }\n npc.setFieldValue(key, value);\n } else {\n npc.setFieldValue(key, tableRoller.convertToken(field.source));\n }\n return;\n }\n npc.setFieldValue(key, field.defaultEmpty);\n });\n};\n\nexport {\n registerSchema,\n getAllSchemas,\n getSchemaByKey,\n initializeNewNPC,\n applySchemaToNPC\n};\n", "import * as npcService from '../services/npcService.js';\nimport NPCSchema from '../models/npcSchema.js';\nimport { convertToken } from '../services/randomTableService.js';\n\nconst template = document.createElement('template');\ntemplate.innerHTML = `\n\n\n
\n \n
\n
\n \n
\n
\n
\n
\n
\n`;\n\nconst formTemplate = document.createElement('template');\nformTemplate.innerHTML = `\n
\n

Click the to reroll a field. Click \"Save\" to save any changes.

\n
\n
\n
\n \n \n
\n
\n \n \n \n
\n
\n`;\n\nclass NPCDisplay extends HTMLElement {\n constructor () {\n super();\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.appendChild(template.content.cloneNode(true));\n this._isEdit = false;\n this.editButton = this.shadowRoot.querySelector('.btn-edit');\n }\n\n connectedCallback () {\n this.shadowRoot.querySelector('details').addEventListener('toggle', this._setCollapse.bind(this));\n this.editButton.addEventListener('click', this._toggleEdit.bind(this));\n }\n\n disconnectedCallback () {\n this.shadowRoot.querySelector('details').removeEventListener('toggle', this._setCollapse.bind(this));\n this.editButton.removeEventListener('click', this._toggleEdit.bind(this));\n }\n\n /**\n *\n * @param {NPC} npc\n */\n setItem (npc) {\n this.npc = npc;\n this.id = `npc_${this.npc.id}`;\n this.dataset.id = this.npc.id;\n if (npc.collapse) {\n this.shadowRoot.querySelector('details').open = false;\n } else {\n this.shadowRoot.querySelector('details').open = true;\n }\n this._setNPCOutput();\n }\n\n _setNPCOutput () {\n this.shadowRoot.querySelector('#summary-title').innerText = this.npc.name;\n this.shadowRoot.querySelector('.body').innerHTML = '';\n\n const ul = document.createElement('ul');\n Array.from(NPCSchema.fields.keys()).forEach((key) => {\n const li = document.createElement('li');\n const label = NPCSchema.getFieldLabelByKey(key);\n const value = this.npc.getFieldDisplay(key);\n li.innerHTML = `${label}: ${value}`;\n ul.appendChild(li);\n });\n const li = document.createElement('li');\n li.innerHTML = `Notes: ${this.npc.getFieldDisplay('notes')}`;\n ul.appendChild(li);\n this.shadowRoot.querySelector('.body').appendChild(ul);\n }\n\n /**\n * Save collapse state\n * @param ev Toggle event on details.\n */\n _setCollapse (ev) {\n if (this._isEdit) {\n // We can't cancel the toggle\n // So we shouldn't try to save the npc's state.\n return;\n }\n const newState = !ev.target.open;\n if (this.npc.collapse === newState) {\n return;\n }\n this.npc.collapse = newState;\n npcService.save(this.npc);\n }\n\n collapse () {\n this.shadowRoot.querySelector('details').open = false;\n }\n\n _toggleEdit (ev) {\n if (this._isEdit) {\n this._disableEdit();\n return;\n }\n this._enableEdit();\n }\n\n _createFormField (key, fieldLabel, value = '') {\n const div = document.createElement('div');\n div.classList.add('formField');\n const label = document.createElement('label');\n label.setAttribute('for', key);\n label.innerHTML = fieldLabel;\n div.appendChild(label);\n\n const div2 = document.createElement('div');\n div2.classList.add('fieldReroll');\n const input = document.createElement('input');\n input.id = key;\n input.setAttribute('type', 'text');\n input.setAttribute('name', key);\n input.setAttribute('autocomplete', 'off');\n input.value = value;\n div2.appendChild(input);\n\n const button = document.createElement('button');\n button.classList.add('btn-reroll');\n button.dataset.field = key;\n button.setAttribute('type', 'button');\n button.setAttribute('aria-label', 'Reroll');\n button.setAttribute('aria-controls', key);\n button.innerHTML = '⚅';\n div2.appendChild(button);\n\n div.appendChild(div2);\n\n return div;\n }\n\n _enableEdit () {\n if (this._isEdit) {\n return;\n }\n this._isEdit = true;\n\n this.shadowRoot.querySelector('.body').innerHTML = '';\n\n let form = formTemplate.content.cloneNode(true);\n const fieldDiv = form.querySelector('.formFields');\n Array.from(NPCSchema.fields.keys()).forEach((key) => {\n const label = NPCSchema.getFieldLabelByKey(key);\n const value = this.npc.getFieldDisplay(key);\n const formField = this._createFormField(\n key,\n label,\n value\n );\n fieldDiv.appendChild(formField);\n });\n\n form.querySelector('textarea[name=notes').value = this.npc.notes;\n\n this.shadowRoot.querySelector('.body').appendChild(form);\n form = this.shadowRoot.querySelector('form');\n form.addEventListener('submit', this._saveEdit.bind(this));\n form.querySelector('.btn-cancel').addEventListener('click', this._toggleEdit.bind(this));\n form.querySelector('.btn-delete').addEventListener('click', this._deleteNPC.bind(this));\n\n form.querySelectorAll('.btn-reroll').forEach((btn) => {\n btn.addEventListener('click', this._reroll.bind(this));\n });\n }\n\n _disableEdit () {\n if (!this._isEdit) {\n return;\n }\n this._isEdit = false;\n\n // remove form events\n const form = this.shadowRoot.querySelector('form');\n form.removeEventListener('submit', this._saveEdit.bind(this));\n form.querySelector('.btn-cancel').removeEventListener('click', this._toggleEdit.bind(this));\n form.querySelector('.btn-delete').removeEventListener('click', this._deleteNPC.bind(this));\n form.querySelectorAll('.btn-reroll').forEach((btn) => {\n btn.removeEventListener('click', this._reroll.bind(this));\n });\n\n this._setNPCOutput();\n this._refocus();\n }\n\n _saveEdit (ev) {\n ev.preventDefault();\n const formData = new FormData(ev.target);\n\n this.npc.getFieldKeys().forEach((key) => {\n this.npc.setFieldValue(key, formData.get(key).toString());\n });\n\n this.npc.notes = formData.get('notes').toString();\n\n npcService.save(this.npc);\n this._disableEdit();\n }\n\n _deleteNPC () {\n npcService.remove(this.npc.id);\n }\n\n _reroll (ev) {\n const fieldKey = ev.target.dataset.field || '';\n if (fieldKey === '') {\n return;\n }\n // get source from schema\n const field = NPCSchema.getFieldByKey(fieldKey);\n const result = convertToken(field.source);\n const input = this.shadowRoot.querySelector(`#${fieldKey}`);\n input.value = result.toString();\n }\n /**\n * When we need to reset focus in this element.\n */\n _refocus () {\n this.shadowRoot.querySelector('summary').focus();\n }\n};\n\nwindow.customElements.define('had-npc', NPCDisplay);\n\nexport default NPCDisplay;\n", "import ItemList from './itemList.js';\nimport * as npcService from '../services/npcService.js';\n\nclass NPCsList extends ItemList {\n constructor () {\n super({\n type: 'npc',\n header: 'NPCs',\n createButton: 'Create NPC',\n service: npcService\n });\n }\n\n _updateItem () {\n // Ignore the event that triggers this\n // As the item will already be updated.\n }\n};\n\nwindow.customElements.define('had-npcslist', NPCsList);\n\nexport default NPCsList;\n", "import store from '../store/store';\nimport { importAll as importNotes, deleteAll as deleteAllNotes } from './notesService.js';\nimport { save as saveTown, clear as clearTown } from './townService.js';\nimport { importAll as importNPCs, deleteAll as deleteAllNPCs } from './npcService.js';\nimport { Town } from '../models/town.js';\n\n/**\n * Reset UI after downloading export.\n * @param {Event} ev\n */\nconst resetExport = function (ev) {\n // Give it a second so the link default action happens.\n // Then we revoke the object url to clear memory.\n setTimeout(() => {\n window.URL.revokeObjectURL(ev.target.href);\n document.getElementById('export-output').innerHTML = '';\n document.getElementById('export-button').hidden = false;\n }, 1000);\n};\n\n/**\n * Export date.\n * @param {Event} event\n */\nconst doExport = function (event) {\n const data = store.getState();\n const date = new Date();\n const file = new Blob([JSON.stringify(data)], { type: 'application/json' });\n // Object url must be unsanitized else it doesn't work.\n const exportFileUrl = URL.createObjectURL(file);\n const exportFileName = `Hadleyville__${date.getFullYear()}_${date.getMonth() + 1}_${date.getDate()}`;\n\n const link = document.createElement('a');\n link.href = exportFileUrl;\n link.setAttribute('download', exportFileName);\n link.innerText = 'Download Export';\n link.addEventListener('click', resetExport);\n document.getElementById('export-output').appendChild(link);\n document.getElementById('export-button').hidden = true;\n};\n\n/**\n * Import from an export.\n * @param {Event} ev\n */\nconst doImport = function (ev) {\n ev.preventDefault();\n const form = ev.target;\n const input_file = form.querySelector('input[type=file]');\n if (!input_file.files) {\n return;\n }\n Array.from(input_file.files).forEach((f) => {\n const reader = new FileReader();\n // Closure to capture the file information.\n reader.onload = ((theFile) => {\n return (e) => {\n let data = {};\n try {\n data = JSON.parse(e.target.result);\n } catch (err) {\n return;\n }\n const notes = data.notes || [];\n if (notes && Array.isArray(notes) && notes.length > 0) {\n importNotes(notes);\n }\n const npcs = data.npcs || [];\n if (npcs && Array.isArray(npcs) && npcs.length > 0) {\n importNPCs(npcs);\n }\n const towns = data.town || [];\n if (Array.isArray(towns)) {\n const town = towns.find(Boolean);\n if (town && town.id) {\n saveTown(new Town(town));\n }\n }\n };\n })(f);\n reader.readAsText(f);\n });\n\n // clear form.\n input_file.value = '';\n};\n\n/**\n * Remove all npcs, notes, and clear the town.\n * @param {Event} ev\n */\nconst deleteAll = function (ev) {\n if (!confirm('Are you really sure?')) {\n return;\n }\n deleteAllNotes();\n deleteAllNPCs();\n clearTown();\n};\n\n/**\n * Setup actions on the settings page.\n */\nconst setupPage = function () {\n const exportButton = document.getElementById('btn-export');\n exportButton.addEventListener('click', doExport);\n\n const importForm = document.getElementById('importForm');\n importForm.addEventListener('submit', doImport);\n\n const deleteButton = document.getElementById('btn-delete');\n deleteButton.addEventListener('click', deleteAll);\n};\n\nexport {\n setupPage\n};\n", "\nimport Header from './components/header.js';\nimport Footer from './components/footer.js';\nimport TableDrawer from './components/tabledrawer.js';\nimport RTableDisplay from './components/rtabledisplay.js';\nimport TownDisplay from './components/towndisplay.js';\nimport NotesList from './components/noteslist.js';\nimport NoteDisplay from './components/notedisplay.js';\nimport DiceRoller from './components/diceroller.js';\nimport NPCsList from './components/npcslist.js';\nimport NPCDisplay from './components/npcdisplay.js';\n\nimport { setupPage } from './services/importExportService.js';\n\nif (document.body.id === 'page-settings') {\n setupPage();\n}\n"], + "mappings": "mqBAAA,gCACA,OAAO,eAAe,GAAS,aAAc,CAA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,QACA,oBACA,sCAEJ,OAAQ,CACJ,QACA,iBACA,aACA,YACA,YACA,WACA,uDACA,oBACA,mBACA,UACA,iBACA,YACA,6BACA,YACA,mCACA,0CAIZ,CACI,GAAI,EACJ,IAAK,YACL,MAAO,4BACP,OAAQ,CACJ,QAAS,CACL,0DACA,6CACA,eACA,0BACA,0BACA,iBACA,cACA,aACA,iBACA,cACA,0CAIZ,CACI,GAAI,EACJ,IAAK,YACL,MAAO,uBACP,OAAQ,CACJ,QAAS,CACL,OACA,SACA,WACA,QACA,UACA,eAIZ,CACI,GAAI,GACJ,IAAK,YACL,MAAO,aACP,YAAa,CACT,CAAE,MAAO,OAAQ,WAAY,IAC7B,CAAE,MAAO,UAAW,WAAY,IAChC,CAAE,MAAO,UAAW,WAAY,KAEpC,OAAQ,CACJ,QAAS,CACL,CAAE,MAAO,4CAA6C,OAAQ,GAC9D,CAAE,MAAO,6CAA8C,OAAQ,GAC/D,CAAE,MAAO,2BAA4B,OAAQ,IAEjD,KAAM,CACF,SACA,QACA,QACA,QACA,MACA,OACA,OACA,MACA,QACA,MACA,SACA,UACA,aACA,SACA,WACA,UACA,QACA,OACA,SACA,SACA,SACA,QAEJ,QAAS,CACL,QACA,OACA,OACA,SAEJ,QAAS,CACL,SACA,QACA,OACA,QACA,aCvgBhB,GAAO,IAAQ,CACX,CACI,IAAK,UACL,MAAO,UACP,KAAM,CACF,OACA,QACA,SACA,SACA,UACA,UACA,SACA,OACA,SACA,QACA,QACA,YACA,WACA,UACA,OACA,UACA,OACA,OACA,SACA,OACA,YACA,SACA,WACA,UACA,WACA,UACA,SACA,SACA,UACA,WACA,WACA,UACA,WACA,SACA,QACA,QACA,WACA,UACA,YACA,aACA,SACA,QACA,SACA,MACA,SACA,QACA,QACA,SACA,SACA,QACA,WACA,WACA,SACA,QACA,aACA,YACA,SACA,WACA,YACA,UACA,UACA,QACA,OACA,UACA,UACA,WACA,UACA,YACA,UACA,YACA,UACA,MACA,SACA,UACA,SACA,QACA,OACA,gBACA,eACA,WACA,WACA,SACA,QACA,QACA,UACA,SACA,UACA,aACA,SACA,MACA,QACA,QACA,SACA,OACA,SACA,SACA,UACA,SACA,aACA,SACA,SACA,UACA,SACA,QACA,SACA,UACA,OACA,WACA,SACA,QACA,aACA,UACA,WACA,UACA,SACA,QACA,SACA,QACA,SACA,SACA,eACA,QACA,QACA,UACA,cACA,eACA,SACA,UACA,SACA,WACA,SACA,UACA,SACA,OACA,MACA,UACA,OACA,SACA,OACA,YACA,SACA,WACA,UACA,QACA,SACA,WACA,OACA,MACA,WACA,WACA,OACA,MACA,OACA,SACA,SACA,QACA,aACA,YACA,SACA,YACA,QACA,SACA,OACA,OACA,KACA,QACA,OACA,QACA,QACA,SACA,QACA,YACA,QACA,QACA,OACA,WACA,SACA,UACA,SACA,QACA,UACA,UACA,OACA,UACA,SACA,aACA,SACA,OACA,QACA,MACA,SACA,MACA,QACA,QACA,WACA,SACA,QACA,SACA,QACA,UACA,OACA,MACA,UACA,UACA,OACA,QACA,QACA,SACA,QACA,OACA,SACA,MACA,UACA,OACA,OACA,OACA,OACA,SACA,OACA,SACA,OACA,QACA,SACA,YACA,UACA,MACA,SACA,QACA,MACA,QACA,SACA,SACA,SACA,YACA,QACA,SACA,SACA,OACA,OACA,SACA,MACA,MACA,UACA,SACA,SACA,QACA,SACA,OACA,QACA,SACA,OACA,UACA,SACA,aACA,SACA,OACA,OACA,SACA,SACA,WACA,UACA,SACA,SACA,SACA,QACA,WACA,OACA,UACA,OACA,SACA,UACA,SACA,SACA,QACA,SACA,QACA,UACA,SACA,QACA,OACA,SACA,SACA,OACA,MACA,MACA,OACA,QACA,UACA,WACA,OACA,UACA,SACA,UACA,YACA,QACA,UACA,SACA,UACA,UACA,SACA,YACA,QACA,SACA,YACA,YACA,WACA,UACA,UACA,SACA,QACA,eACA,WACA,SACA,cACA,WACA,QACA,aACA,YACA,QACA,eACA,UACA,SACA,UACA,WACA,MACA,OACA,WACA,eACA,WACA,QACA,UACA,UACA,UACA,SACA,WACA,WACA,SACA,UACA,UACA,WACA,QACA,WACA,WACA,YACA,SACA,WACA,WACA,QACA,SACA,aACA,YACA,UACA,YACA,UACA,UACA,UACA,YACA,YACA,UACA,WACA,YACA,YACA,WACA,OACA,UACA,QACA,UACA,QACA,SACA,WACA,UACA,OACA,QACA,OACA,kBACA,eACA,iBACA,OACA,cACA,cACA,aACA,QACA,WACA,UACA,UACA,QACA,OACA,OACA,SACA,SACA,QACA,UACA,QACA,QACA,SACA,QACA,YACA,UACA,WACA,QACA,OACA,SACA,QACA,OACA,aACA,SACA,WACA,UACA,WACA,UACA,UACA,UACA,WACA,SACA,SACA,SACA,SACA,WACA,SACA,WACA,OACA,WACA,cACA,UACA,YACA,YAEJ,OAAQ,CACJ,QACA,SACA,QACA,MACA,YACA,QACA,WACA,SACA,OACA,SACA,UACA,UACA,QACA,YACA,YACA,SACA,QACA,SACA,SACA,WACA,YACA,QACA,OACA,UACA,OACA,YACA,UACA,UACA,UACA,WACA,QACA,WACA,YACA,UACA,YACA,YACA,YACA,UACA,YACA,SACA,SACA,SACA,QACA,OACA,WACA,QACA,YACA,QACA,QACA,OACA,SACA,MACA,UACA,UACA,WACA,SACA,WACA,QACA,SACA,SACA,YACA,YACA,QACA,QACA,MACA,QACA,OACA,WACA,WACA,QACA,UACA,QACA,UACA,UACA,QACA,UACA,OACA,QACA,SACA,QACA,OACA,SACA,SACA,QACA,YACA,QACA,WACA,UACA,OACA,UACA,MACA,WACA,OACA,SACA,UACA,OACA,QACA,QACA,SACA,UACA,SACA,WACA,OACA,UACA,WACA,SACA,OACA,SACA,SACA,UACA,OACA,QACA,SACA,UACA,OACA,YACA,QACA,SACA,SACA,MACA,QACA,OACA,WACA,SACA,OACA,QACA,UACA,SACA,QACA,SACA,SACA,iBACA,UACA,WACA,UACA,YACA,OACA,YACA,cACA,SACA,QACA,OACA,WACA,YACA,WACA,eACA,OACA,YACA,OACA,UACA,QACA,aACA,QACA,SACA,YACA,SACA,UACA,UACA,cACA,iBACA,aACA,SACA,UACA,WACA,UACA,WACA,YACA,YACA,YACA,aACA,YACA,WACA,YACA,SACA,WACA,YACA,gBACA,UACA,YACA,WACA,YACA,aACA,SACA,QACA,YACA,WACA,cACA,eACA,eACA,OACA,aACA,YACA,UACA,SACA,SACA,UACA,QACA,iBACA,OACA,WACA,aACA,WACA,UACA,YACA,eACA,YACA,WACA,OACA,WACA,aACA,SACA,YACA,WACA,WACA,OACA,WACA,aACA,WACA,UACA,UACA,SACA,eACA,SACA,UACA,QACA,WACA,UACA,OACA,SACA,QACA,SACA,UACA,YACA,SACA,WACA,QACA,UACA,SACA,aACA,YACA,WACA,UACA,UACA,SACA,SACA,WACA,SACA,OACA,UACA,iBACA,SACA,aACA,WACA,UACA,OACA,UACA,UACA,SACA,OACA,QACA,SACA,eACA,UACA,UACA,SACA,YACA,WACA,WACA,QACA,QACA,MACA,QACA,QACA,MACA,QACA,OACA,SACA,SACA,SACA,SACA,QACA,MACA,SACA,UACA,UACA,OACA,QACA,UACA,SACA,MACA,OACA,SACA,UACA,OACA,aACA,WACA,UACA,YACA,SACA,SACA,OACA,QACA,SACA,aACA,MACA,SACA,eACA,eACA,YACA,SACA,YACA,cACA,WACA,QACA,QACA,UACA,UACA,QACA,SACA,SACA,QACA,SACA,WACA,QACA,aACA,WACA,WACA,WACA,QACA,QACA,QACA,UACA,UACA,OACA,QACA,QACA,QACA,SACA,YACA,SACA,OACA,YACA,YACA,YACA,SACA,UACA,MACA,eACA,aACA,QACA,QACA,YACA,UACA,SACA,QACA,aACA,OACA,YACA,WACA,WACA,YACA,SACA,SACA,YACA,YACA,QACA,UACA,QACA,OACA,OACA,UACA,UACA,UACA,WACA,QACA,UACA,SACA,WACA,UACA,SACA,QACA,UACA,UACA,QACA,UACA,UACA,UACA,OACA,SACA,OACA,OACA,YACA,UACA,SACA,YACA,WACA,kBACA,oBACA,mBACA,oBACA,qBACA,oBACA,mBACA,iBACA,mBACA,UACA,kBACA,SACA,UACA,QACA,UACA,WACA,SACA,UACA,YACA,QACA,UACA,UACA,SACA,OACA,SACA,SACA,SACA,QACA,WACA,QACA,UACA,MACA,QACA,UACA,QACA,WACA,SACA,SACA,SACA,WACA,SACA,OACA,UACA,OACA,UACA,OACA,SACA,OACA,SACA,SACA,WACA,UACA,SACA,SACA,SACA,YACA,YACA,UACA,OACA,cACA,WACA,UACA,WACA,UACA,UACA,WAEJ,QAAS,CACL,SACA,OACA,WACA,QACA,OACA,QACA,UACA,SACA,WACA,UACA,QACA,OACA,QACA,MACA,MACA,SACA,cACA,UACA,OACA,SACA,QACA,UACA,WACA,QACA,SACA,QACA,OACA,OACA,SACA,QACA,QACA,OACA,OACA,MACA,OACA,QACA,WACA,QACA,SACA,SACA,WACA,QACA,UACA,QACA,UACA,UACA,UACA,SACA,UACA,SACA,SACA,SACA,UACA,aACA,UACA,QACA,SACA,QACA,SACA,QACA,SACA,WACA,UACA,YACA,SACA,UACA,SACA,SACA,QACA,QACA,SACA,WACA,UACA,OACA,OACA,QACA,QACA,cACA,SACA,QACA,SACA,OACA,UACA,WACA,QACA,SACA,UACA,QACA,SACA,OACA,SACA,UACA,WACA,SACA,SACA,OACA,SACA,SACA,WACA,SACA,UACA,OACA,OACA,QACA,SACA,SACA,QACA,OACA,SACA,SACA,QACA,QACA,UACA,SACA,UACA,UACA,SACA,YACA,SACA,YACA,WACA,gBACA,SACA,QACA,SACA,SACA,eACA,YACA,eACA,eACA,aACA,WACA,YACA,WACA,UACA,SACA,WACA,YACA,SACA,SACA,YACA,YACA,QACA,WACA,WACA,UACA,UACA,SACA,UACA,YACA,WACA,QACA,cACA,YACA,UACA,QACA,QACA,WACA,YACA,YACA,SACA,WACA,SACA,SACA,UACA,WACA,SACA,YACA,cACA,SACA,UACA,QACA,UACA,QACA,SACA,UACA,SACA,UACA,WACA,aACA,OACA,WACA,QACA,UACA,SACA,UACA,UACA,QACA,OACA,WACA,SACA,SACA,WACA,UACA,UACA,OACA,YACA,SACA,SACA,SACA,QACA,OACA,MACA,SACA,SACA,UACA,UACA,QACA,aACA,QACA,SACA,SACA,UACA,UACA,WACA,UACA,OACA,UACA,SACA,UACA,SACA,SACA,WACA,aACA,SACA,UACA,aACA,UACA,UACA,WACA,WACA,WACA,QACA,WACA,SACA,aACA,SACA,YACA,UACA,QACA,SACA,WACA,aACA,WACA,WACA,SACA,YACA,WACA,SACA,OACA,aACA,aACA,UACA,aACA,UACA,eACA,aACA,WACA,WACA,UACA,aACA,YACA,eACA,SACA,WACA,SACA,UACA,SACA,UACA,YACA,SACA,aACA,WACA,WACA,cACA,eACA,eACA,UACA,UACA,SACA,YACA,UACA,QACA,UACA,SACA,QACA,OACA,UACA,SACA,aACA,YACA,cACA,WACA,YACA,UACA,SACA,UACA,UACA,UACA,WACA,UACA,QACA,SACA,UACA,MACA,WACA,QACA,UACA,aACA,QACA,QACA,UACA,SACA,eACA,YACA,SACA,UACA,UACA,QACA,OACA,YACA,UACA,aACA,UACA,UACA,WACA,SACA,SACA,QACA,SACA,WACA,OACA,eACA,WC1sCZ,YAAkC,CAC9B,aAAe,CACX,KAAK,OAAS,GACd,KAAK,MAAQ,GASjB,cAAe,EAAO,EAAU,CAC5B,MAAO,MAAK,OAAO,GAAO,UAAU,AAAC,GAC1B,EAAK,WAAa,GAUjC,GAAI,EAAO,EAAU,EAAW,KAAM,CAClC,GAAI,MAAO,IAAa,WAIxB,IADA,KAAK,OAAO,GAAS,KAAK,OAAO,IAAU,GACvC,KAAK,OAAO,GAAO,OAAS,EAAG,CAC/B,GAAM,GAAQ,KAAK,cAAc,EAAO,GAExC,AAAI,EAAQ,IACR,KAAK,OAAO,GAAO,OAAO,EAAO,GAGzC,KAAK,OAAO,GAAO,KAAK,CAAE,SAAU,EAAU,SAAU,KAS5D,IAAK,EAAO,EAAU,CAClB,GAAI,MAAM,QAAQ,KAAK,OAAO,IAAS,CACnC,GAAM,GAAQ,KAAK,cAAc,EAAO,GACxC,GAAI,IAAU,GACV,OAEJ,KAAK,OAAO,GAAO,O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,CAAC,EAAW,OAGhB,OAAM,KAAK,EAAW,OAAO,QAAQ,AAAC,GAAM,CACxC,GAAM,GAAS,GAAI,YAEnB,EAAO,OAAU,CAAC,GACP,AAAC,GAAM,CACV,GAAI,GAAO,GACX,GAAI,CACA,EAAO,KAAK,MAAM,EAAE,OAAO,aAC7B,CACE,OAEJ,GAAM,GAAQ,EAAK,OAAS,GAC5B,AAAI,GAAS,MAAM,QAAQ,IAAU,EAAM,OAAS,GAChD,GAAY,GAEhB,GAAM,GAAO,EAAK,MAAQ,GAC1B,AAAI,GAAQ,MAAM,QAAQ,IAAS,EAAK,OAAS,GAC7C,GAAW,GAEf,GAAM,GAAQ,EAAK,MAAQ,GAC3B,GAAI,MAAM,QAAQ,GAAQ,CACtB,GAAM,GAAO,EAAM,KAAK,SACxB,AAAI,GAAQ,EAAK,IACb,GAAS,GAAI,IAAK,OAI/B,GACH,EAAO,WAAW,KAItB,EAAW,MAAQ,KAOjB,GAAY,SAAU,EAAI,CAC5B,AAAI,CAAC,QAAQ,yBAGb,MACA,KACA,OAME,GAAY,UAAY,CAE1B,AADqB,SAAS,eAAe,cAChC,iBAAiB,QAAS,IAGvC,AADmB,SAAS,eAAe,cAChC,iBAAiB,SAAU,IAGtC,AADqB,SAAS,eAAe,cAChC,iBAAiB,QAAS,KCjG3C,AAAI,SAAS,KAAK,KAAO,iBACrB", "names": [] } diff --git a/package-lock.json b/package-lock.json index e44b718..b2eac76 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "hadleyville-online", - "version": "1.0.0", + "version": "2.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index f187a90..b48519d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hadleyville-online", - "version": "1.0.0", + "version": "2.0.0", "repository": { "type": "git", "url": "git+https://github.com/derikb/hadleyville-online.git" @@ -45,7 +45,7 @@ }, "standard-version": { "scripts": { - "postbump": "npm run build && git add ./dist/index.js ./dist/index.js.map ./dist/styles.css ./dist/styles.css.map" + "postbump": "npm run build && git add ./dist/index.js ./dist/index.js.map ./dist/style.css ./dist/style.css.map" }, "bumpFiles": [ "package.json",

(\r\n type: T\r\n): PayloadActionCreator\r\n\r\n/**\r\n * A utility function to create an action creator for the given action type\r\n * string. The action creator accepts a single argument, which will be included\r\n * in the action object as a field called payload. The action creator function\r\n * will also have its toString() overriden so that it returns the action type,\r\n * allowing it to be used in reducer logic that is looking for that action type.\r\n *\r\n * @param type The action type to use for created actions.\r\n * @param prepare (optional) a method that takes any number of arguments and returns { payload } or { payload, meta }.\r\n * If this is given, the resulting action creator will pass its arguments to this method to calculate payload & meta.\r\n *\r\n * @public\r\n */\r\nexport function createAction<\r\n PA extends PrepareAction,\r\n T extends string = string\r\n>(\r\n type: T,\r\n prepareAction: PA\r\n): PayloadActionCreator['payload'], T, PA>\r\n\r\nexport function createAction(type: string, prepareAction?: Function): any {\r\n function actionCreator(...args: any[]) {\r\n if (prepareAction) {\r\n let prepared = prepareAction(...args)\r\n if (!prepared) {\r\n throw new Error('prepareAction did not return an object')\r\n }\r\n\r\n return {\r\n type,\r\n payload: prepared.payload,\r\n ...('meta' in prepared && { meta: prepared.meta }),\r\n ...('error' in prepared && { error: prepared.error }),\r\n }\r\n }\r\n return { type, payload: args[0] }\r\n }\r\n\r\n actionCreator.toString = () => `${type}`\r\n\r\n actionCreator.type = type\r\n\r\n actionCreator.match = (action: Action): action is PayloadAction =>\r\n action.type === type\r\n\r\n return actionCreator\r\n}\r\n\r\nexport function isFSA(action: unknown): action is {\r\n type: string\r\n payload?: unknown\r\n error?: unknown\r\n meta?: unknown\r\n} {\r\n return (\r\n isPlainObject(action) &&\r\n typeof (action as any).type === 'string' &&\r\n Object.keys(action).every(isValidKey)\r\n )\r\n}\r\n\r\nfunction isValidKey(key: string) {\r\n return ['type', 'payload', 'error', 'meta'].indexOf(key) > -1\r\n}\r\n\r\n/**\r\n * Returns the action type of the actions created by the passed\r\n * `createAction()`-generated action creator (arbitrary action creators\r\n * are not supported).\r\n *\r\n * @param action The action creator whose action type to get.\r\n * @returns The action type used by the action creator.\r\n *\r\n * @public\r\n */\r\nexport function getType(\r\n actionCreator: PayloadActionCreator\r\n): T {\r\n return `${actionCreator}` as T\r\n}\r\n\r\n// helper types for more readable typings\r\n\r\ntype IfPrepareActionMethodProvided<\r\n PA extends PrepareAction | void,\r\n True,\r\n False\r\n> = PA extends (...args: any[]) => any ? True : False\r\n", "import type { Draft } from 'immer'\r\nimport createNextState, { isDraft, isDraftable } from 'immer'\r\nimport type { AnyAction, Action, Reducer } from 'redux'\r\nimport type { ActionReducerMapBuilder } from './mapBuilders'\r\nimport { executeReducerBuilderCallback } from './mapBuilders'\r\nimport type { NoInfer } from './tsHelpers'\r\n\r\n/**\r\n * Defines a mapping from action types to corresponding action object shapes.\r\n *\r\n * @deprecated This should not be used manually - it is only used for internal\r\n * inference purposes and should not have any further value.\r\n * It might be removed in the future.\r\n * @public\r\n */\r\nexport type Actions = Record\r\n\r\nexport interface ActionMatcher {\r\n (action: AnyAction): action is A\r\n}\r\n\r\nexport type ActionMatcherDescription = {\r\n matcher: ActionMatcher\r\n reducer: CaseReducer>\r\n}\r\n\r\nexport type ReadonlyActionMatcherDescriptionCollection = ReadonlyArray<\r\n ActionMatcherDescription\r\n>\r\n\r\nexport type ActionMatcherDescriptionCollection = Array<\r\n ActionMatcherDescription\r\n>\r\n\r\n/**\r\n * An *case reducer* is a reducer function for a specific action type. Case\r\n * reducers can be composed to full reducers using `createReducer()`.\r\n *\r\n * Unlike a normal Redux reducer, a case reducer is never called with an\r\n * `undefined` state to determine the initial state. Instead, the initial\r\n * state is explicitly specified as an argument to `createReducer()`.\r\n *\r\n * In addition, a case reducer can choose to mutate the passed-in `state`\r\n * value directly instead of returning a new state. This does not actually\r\n * cause the store state to be mutated directly; instead, thanks to\r\n * [immer](https://github.com/mweststrate/immer), the mutations are\r\n * translated to copy operations that result in a new state.\r\n *\r\n * @public\r\n */\r\nexport type CaseReducer = (\r\n state: Draft,\r\n action: A\r\n) => S | void | Draft\r\n\r\n/**\r\n * A mapping from action types to case reducers for `createReducer()`.\r\n *\r\n * @deprecated This should not be used manually - it is only used\r\n * for internal inference purposes and using it manually\r\n * would lead to type erasure.\r\n * It might be removed in the future.\r\n * @public\r\n */\r\nexport type CaseReducers = {\r\n [T in keyof AS]: AS[T] extends Action ? CaseReducer : void\r\n}\r\n\r\nexport type NotFunction = T extends Function ? never : T\r\n\r\nfunction isStateFunction(x: unknown): x is () => S {\r\n return typeof x === 'function'\r\n}\r\n\r\nexport type ReducerWithInitialState> = Reducer & {\r\n getInitialState: () => S\r\n}\r\n\r\n/**\r\n * A utility function that allows defining a reducer as a mapping from action\r\n * type to *case reducer* functions that handle these action types. The\r\n * reducer's initial state is passed as the first argument.\r\n *\r\n * @remarks\r\n * The body of every case reducer is implicitly wrapped with a call to\r\n * `produce()` from the [immer](https://github.com/mweststrate/immer) library.\r\n * This means that rather than returning a new state object, you can also\r\n * mutate the passed-in state object directly; these mutations will then be\r\n * automatically and efficiently translated into copies, giving you both\r\n * convenience and immutability.\r\n *\r\n * @overloadSummary\r\n * This overload accepts a callback function that receives a `builder` object as its argument.\r\n * That builder provides `addCase`, `addMatcher` and `addDefaultCase` functions that may be\r\n * called to define what actions this reducer will handle.\r\n *\r\n * @param initialState - `State | (() => State)`: The initial state that should be used when the reducer is called the first time. This may also be a \"lazy initializer\" function, which should return an initial state value when called. This will be used whenever the reducer is called with `undefined` as its state value, and is primarily useful for cases like reading initial state from `localStorage`.\r\n * @param builderCallback - `(builder: Builder) => void` A callback that receives a *builder* object to define\r\n * case reducers via calls to `builder.addCase(actionCreatorOrType, reducer)`.\r\n * @example\r\n```ts\r\nimport {\r\n createAction,\r\n createReducer,\r\n AnyAction,\r\n PayloadAction,\r\n} from \"@reduxjs/toolkit\";\r\n\r\nconst increment = createAction(\"increment\");\r\nconst decrement = createAction(\"decrement\");\r\n\r\nfunction isActionWithNumberPayload(\r\n action: AnyAction\r\n): action is PayloadAction {\r\n return typeof action.payload === \"number\";\r\n}\r\n\r\nconst reducer = createReducer(\r\n {\r\n counter: 0,\r\n sumOfNumberPayloads: 0,\r\n unhandledActions: 0,\r\n },\r\n (builder) => {\r\n builder\r\n .addCase(increment, (state, action) => {\r\n // action is inferred correctly here\r\n state.counter += action.payload;\r\n })\r\n // You can chain calls, or have separate `builder.addCase()` lines each time\r\n .addCase(decrement, (state, action) => {\r\n state.counter -= action.payload;\r\n })\r\n // You can apply a \"matcher function\" to incoming actions\r\n .addMatcher(isActionWithNumberPayload, (state, action) => {})\r\n // and provide a default case if no other handlers matched\r\n .addDefaultCase((state, action) => {});\r\n }\r\n);\r\n```\r\n * @public\r\n */\r\nexport function createReducer>(\r\n initialState: S | (() => S),\r\n builderCallback: (builder: ActionReducerMapBuilder) => void\r\n): ReducerWithInitialState\r\n\r\n/**\r\n * A utility function that allows defining a reducer as a mapping from action\r\n * type to *case reducer* functions that handle these action types. The\r\n * reducer's initial state is passed as the first argument.\r\n *\r\n * The body of every case reducer is implicitly wrapped with a call to\r\n * `produce()` from the [immer](https://github.com/mweststrate/immer) library.\r\n * This means that rather than returning a new state object, you can also\r\n * mutate the passed-in state object directly; these mutations will then be\r\n * automatically and efficiently translated into copies, giving you both\r\n * convenience and immutability.\r\n * \r\n * @overloadSummary\r\n * This overload accepts an object where the keys are string action types, and the values\r\n * are case reducer functions to handle those action types.\r\n *\r\n * @param initialState - `State | (() => State)`: The initial state that should be used when the reducer is called the first time. This may also be a \"lazy initializer\" function, which should return an initial state value when called. This will be used whenever the reducer is called with `undefined` as its state value, and is primarily useful for cases like reading initial state from `localStorage`.\r\n * @param actionsMap - An object mapping from action types to _case reducers_, each of which handles one specific action type.\r\n * @param actionMatchers - An array of matcher definitions in the form `{matcher, reducer}`.\r\n * All matching reducers will be executed in order, independently if a case reducer matched or not.\r\n * @param defaultCaseReducer - A \"default case\" reducer that is executed if no case reducer and no matcher\r\n * reducer was executed for this action.\r\n *\r\n * @example\r\n```js\r\nconst counterReducer = createReducer(0, {\r\n increment: (state, action) => state + action.payload,\r\n decrement: (state, action) => state - action.payload\r\n})\r\n\r\n// Alternately, use a \"lazy initializer\" to provide the initial state\r\n// (works with either form of createReducer)\r\nconst initialState = () => 0\r\nconst counterReducer = createReducer(initialState, {\r\n increment: (state, action) => state + action.payload,\r\n decrement: (state, action) => state - action.payload\r\n})\r\n```\r\n \r\n * Action creators that were generated using [`createAction`](./createAction) may be used directly as the keys here, using computed property syntax:\r\n\r\n```js\r\nconst increment = createAction('increment')\r\nconst decrement = createAction('decrement')\r\n\r\nconst counterReducer = createReducer(0, {\r\n [increment]: (state, action) => state + action.payload,\r\n [decrement.type]: (state, action) => state - action.payload\r\n})\r\n```\r\n * @public\r\n */\r\nexport function createReducer<\r\n S extends NotFunction,\r\n CR extends CaseReducers = CaseReducers\r\n>(\r\n initialState: S | (() => S),\r\n actionsMap: CR,\r\n actionMatchers?: ActionMatcherDescriptionCollection,\r\n defaultCaseReducer?: CaseReducer\r\n): ReducerWithInitialState\r\n\r\nexport function createReducer>(\r\n initialState: S | (() => S),\r\n mapOrBuilderCallback:\r\n | CaseReducers\r\n | ((builder: ActionReducerMapBuilder) => void),\r\n actionMatchers: ReadonlyActionMatcherDescriptionCollection = [],\r\n defaultCaseReducer?: CaseReducer\r\n): ReducerWithInitialState {\r\n let [actionsMap, finalActionMatchers, finalDefaultCaseReducer] =\r\n typeof mapOrBuilderCallback === 'function'\r\n ? executeReducerBuilderCallback(mapOrBuilderCallback)\r\n : [mapOrBuilderCallback, actionMatchers, defaultCaseReducer]\r\n\r\n // Ensure the initial state gets frozen either way\r\n let getInitialState: () => S\r\n if (isStateFunction(initialState)) {\r\n getInitialState = () => createNextState(initialState(), () => {})\r\n } else {\r\n const frozenInitialState = createNextState(initialState, () => {})\r\n getInitialState = () => frozenInitialState\r\n }\r\n\r\n function reducer(state = getInitialState(), action: any): S {\r\n let caseReducers = [\r\n actionsMap[action.type],\r\n ...finalActionMatchers\r\n .filter(({ matcher }) => matcher(action))\r\n .map(({ reducer }) => reducer),\r\n ]\r\n if (caseReducers.filter((cr) => !!cr).length === 0) {\r\n caseReducers = [finalDefaultCaseReducer]\r\n }\r\n\r\n return caseReducers.reduce((previousState, caseReducer): S => {\r\n if (caseReducer) {\r\n if (isDraft(previousState)) {\r\n // If it's already a draft, we must already be inside a `createNextState` call,\r\n // likely because this is being wrapped in `createReducer`, `createSlice`, or nested\r\n // inside an existing draft. It's safe to just pass the draft to the mutator.\r\n const draft = previousState as Draft // We can assume this is already a draft\r\n const result = caseReducer(draft, action)\r\n\r\n if (typeof result === 'undefined') {\r\n return previousState\r\n }\r\n\r\n return result as S\r\n } else if (!isDraftable(previousState)) {\r\n // If state is not draftable (ex: a primitive, such as 0), we want to directly\r\n // return the caseReducer func and not wrap it with produce.\r\n const result = caseReducer(previousState as any, action)\r\n\r\n if (typeof result === 'undefined') {\r\n if (previousState === null) {\r\n return previousState\r\n }\r\n throw Error(\r\n 'A case reducer on a non-draftable value must not return undefined'\r\n )\r\n }\r\n\r\n return result as S\r\n } else {\r\n // @ts-ignore createNextState() produces an Immutable> rather\r\n // than an Immutable, and TypeScript cannot find out how to reconcile\r\n // these two types.\r\n return createNextState(previousState, (draft: Draft) => {\r\n return caseReducer(draft, action)\r\n })\r\n }\r\n }\r\n\r\n return previousState\r\n }, state)\r\n }\r\n\r\n reducer.getInitialState = getInitialState\r\n\r\n return reducer as ReducerWithInitialState\r\n}\r\n", "import type { Action, AnyAction } from 'redux'\r\nimport type {\r\n CaseReducer,\r\n CaseReducers,\r\n ActionMatcher,\r\n ActionMatcherDescriptionCollection,\r\n} from './createReducer'\r\n\r\nexport interface TypedActionCreator {\r\n (...args: any[]): Action\r\n type: Type\r\n}\r\n\r\n/**\r\n * A builder for an action <-> reducer map.\r\n *\r\n * @public\r\n */\r\nexport interface ActionReducerMapBuilder {\r\n /**\r\n * Adds a case reducer to handle a single exact action type.\r\n * @remarks\r\n * All calls to `builder.addCase` must come before any calls to `builder.addMatcher` or `builder.addDefaultCase`.\r\n * @param actionCreator - Either a plain action type string, or an action creator generated by [`createAction`](./createAction) that can be used to determine the action type.\r\n * @param reducer - The actual case reducer function.\r\n */\r\n addCase>(\r\n actionCreator: ActionCreator,\r\n reducer: CaseReducer>\r\n ): ActionReducerMapBuilder\r\n /**\r\n * Adds a case reducer to handle a single exact action type.\r\n * @remarks\r\n * All calls to `builder.addCase` must come before any calls to `builder.addMatcher` or `builder.addDefaultCase`.\r\n * @param actionCreator - Either a plain action type string, or an action creator generated by [`createAction`](./createAction) that can be used to determine the action type.\r\n * @param reducer - The actual case reducer function.\r\n */\r\n addCase>(\r\n type: Type,\r\n reducer: CaseReducer\r\n ): ActionReducerMapBuilder\r\n\r\n /**\r\n * Allows you to match your incoming actions against your own filter function instead of only the `action.type` property.\r\n * @remarks\r\n * If multiple matcher reducers match, all of them will be executed in the order\r\n * they were defined in - even if a case reducer already matched.\r\n * All calls to `builder.addMatcher` must come after any calls to `builder.addCase` and before any calls to `builder.addDefaultCase`.\r\n * @param matcher - A matcher function. In TypeScript, this should be a [type predicate](https://www.typescriptlang.org/docs/handbook/advanced-types.html#using-type-predicates)\r\n * function\r\n * @param reducer - The actual case reducer function.\r\n *\r\n * @example\r\n```ts\r\nimport {\r\n createAction,\r\n createReducer,\r\n AsyncThunk,\r\n AnyAction,\r\n} from \"@reduxjs/toolkit\";\r\n\r\ntype GenericAsyncThunk = AsyncThunk;\r\n\r\ntype PendingAction = ReturnType;\r\ntype RejectedAction = ReturnType;\r\ntype FulfilledAction = ReturnType;\r\n\r\nconst initialState: Record = {};\r\nconst resetAction = createAction(\"reset-tracked-loading-state\");\r\n\r\nfunction isPendingAction(action: AnyAction): action is PendingAction {\r\n return action.type.endsWith(\"/pending\");\r\n}\r\n\r\nconst reducer = createReducer(initialState, (builder) => {\r\n builder\r\n .addCase(resetAction, () => initialState)\r\n // matcher can be defined outside as a type predicate function\r\n .addMatcher(isPendingAction, (state, action) => {\r\n state[action.meta.requestId] = \"pending\";\r\n })\r\n .addMatcher(\r\n // matcher can be defined inline as a type predicate function\r\n (action): action is RejectedAction => action.type.endsWith(\"/rejected\"),\r\n (state, action) => {\r\n state[action.meta.requestId] = \"rejected\";\r\n }\r\n )\r\n // matcher can just return boolean and the matcher can receive a generic argument\r\n .addMatcher(\r\n (action) => action.type.endsWith(\"/fulfilled\"),\r\n (state, action) => {\r\n state[action.meta.requestId] = \"fulfilled\";\r\n }\r\n );\r\n});\r\n```\r\n */\r\n addMatcher(\r\n matcher: ActionMatcher | ((action: AnyAction) => boolean),\r\n reducer: CaseReducer\r\n ): Omit, 'addCase'>\r\n\r\n /**\r\n * Adds a \"default case\" reducer that is executed if no case reducer and no matcher\r\n * reducer was executed for this action.\r\n * @param reducer - The fallback \"default case\" reducer function.\r\n *\r\n * @example\r\n```ts\r\nimport { createReducer } from '@reduxjs/toolkit'\r\nconst initialState = { otherActions: 0 }\r\nconst reducer = createReducer(initialState, builder => {\r\n builder\r\n // .addCase(...)\r\n // .addMatcher(...)\r\n .addDefaultCase((state, action) => {\r\n state.otherActions++\r\n })\r\n})\r\n```\r\n */\r\n addDefaultCase(reducer: CaseReducer): {}\r\n}\r\n\r\nexport function executeReducerBuilderCallback(\r\n builderCallback: (builder: ActionReducerMapBuilder) => void\r\n): [\r\n CaseReducers,\r\n ActionMatcherDescriptionCollection,\r\n CaseReducer | undefined\r\n] {\r\n const actionsMap: CaseReducers = {}\r\n const actionMatchers: ActionMatcherDescriptionCollection = []\r\n let defaultCaseReducer: CaseReducer | undefined\r\n const builder = {\r\n addCase(\r\n typeOrActionCreator: string | TypedActionCreator,\r\n reducer: CaseReducer\r\n ) {\r\n if (process.env.NODE_ENV !== 'production') {\r\n /*\r\n to keep the definition by the user in line with actual behavior, \r\n we enforce `addCase` to always be called before calling `addMatcher`\r\n as matching cases take precedence over matchers\r\n */\r\n if (actionMatchers.length > 0) {\r\n throw new Error(\r\n '`builder.addCase` should only be called before calling `builder.addMatcher`'\r\n )\r\n }\r\n if (defaultCaseReducer) {\r\n throw new Error(\r\n '`builder.addCase` should only be called before calling `builder.addDefaultCase`'\r\n )\r\n }\r\n }\r\n const type =\r\n typeof typeOrActionCreator === 'string'\r\n ? typeOrActionCreator\r\n : typeOrActionCreator.type\r\n if (type in actionsMap) {\r\n throw new Error(\r\n 'addCase cannot be called with two reducers for the same action type'\r\n )\r\n }\r\n actionsMap[type] = reducer\r\n return builder\r\n },\r\n addMatcher(\r\n matcher: ActionMatcher,\r\n reducer: CaseReducer\r\n ) {\r\n if (process.env.NODE_ENV !== 'production') {\r\n if (defaultCaseReducer) {\r\n throw new Error(\r\n '`builder.addMatcher` should only be called before calling `builder.addDefaultCase`'\r\n )\r\n }\r\n }\r\n actionMatchers.push({ matcher, reducer })\r\n return builder\r\n },\r\n addDefaultCase(reducer: CaseReducer) {\r\n if (process.env.NODE_ENV !== 'production') {\r\n if (defaultCaseReducer) {\r\n throw new Error('`builder.addDefaultCase` can only be called once')\r\n }\r\n }\r\n defaultCaseReducer = reducer\r\n return builder\r\n },\r\n }\r\n builderCallback(builder)\r\n return [actionsMap, actionMatchers, defaultCaseReducer]\r\n}\r\n", "import type { AnyAction, Reducer } from 'redux'\r\nimport { createNextState } from '.'\r\nimport type {\r\n ActionCreatorWithoutPayload,\r\n PayloadAction,\r\n PayloadActionCreator,\r\n PrepareAction,\r\n _ActionCreatorWithPreparedPayload,\r\n} from './createAction'\r\nimport { createAction } from './createAction'\r\nimport type {\r\n CaseReducer,\r\n CaseReducers,\r\n ReducerWithInitialState,\r\n} from './createReducer'\r\nimport { createReducer, NotFunction } from './createReducer'\r\nimport type { ActionReducerMapBuilder } from './mapBuilders'\r\nimport { executeReducerBuilderCallback } from './mapBuilders'\r\nimport type { NoInfer } from './tsHelpers'\r\n\r\n/**\r\n * An action creator attached to a slice.\r\n *\r\n * @deprecated please use PayloadActionCreator directly\r\n *\r\n * @public\r\n */\r\nexport type SliceActionCreator

(\r\n type: T\r\n): PayloadActionCreator\r\n\r\n/**\r\n * A utility function to create an action creator for the given action type\r\n * string. The action creator accepts a single argument, which will be included\r\n * in the action object as a field called payload. The action creator function\r\n * will also have its toString() overriden so that it returns the action type,\r\n * allowing it to be used in reducer logic that is looking for that action type.\r\n *\r\n * @param type The action type to use for created actions.\r\n * @param prepare (optional) a method that takes any number of arguments and returns { payload } or { payload, meta }.\r\n * If this is given, the resulting action creator will pass its arguments to this method to calculate payload & meta.\r\n *\r\n * @public\r\n */\r\nexport function createAction<\r\n PA extends PrepareAction,\r\n T extends string = string\r\n>(\r\n type: T,\r\n prepareAction: PA\r\n): PayloadActionCreator['payload'], T, PA>\r\n\r\nexport function createAction(type: string, prepareAction?: Function): any {\r\n function actionCreator(...args: any[]) {\r\n if (prepareAction) {\r\n let prepared = prepareAction(...args)\r\n if (!prepared) {\r\n throw new Error('prepareAction did not return an object')\r\n }\r\n\r\n return {\r\n type,\r\n payload: prepared.payload,\r\n ...('meta' in prepared && { meta: prepared.meta }),\r\n ...('error' in prepared && { error: prepared.error }),\r\n }\r\n }\r\n return { type, payload: args[0] }\r\n }\r\n\r\n actionCreator.toString = () => `${type}`\r\n\r\n actionCreator.type = type\r\n\r\n actionCreator.match = (action: Action): action is PayloadAction =>\r\n action.type === type\r\n\r\n return actionCreator\r\n}\r\n\r\nexport function isFSA(action: unknown): action is {\r\n type: string\r\n payload?: unknown\r\n error?: unknown\r\n meta?: unknown\r\n} {\r\n return (\r\n isPlainObject(action) &&\r\n typeof (action as any).type === 'string' &&\r\n Object.keys(action).every(isValidKey)\r\n )\r\n}\r\n\r\nfunction isValidKey(key: string) {\r\n return ['type', 'payload', 'error', 'meta'].indexOf(key) > -1\r\n}\r\n\r\n/**\r\n * Returns the action type of the actions created by the passed\r\n * `createAction()`-generated action creator (arbitrary action creators\r\n * are not supported).\r\n *\r\n * @param action The action creator whose action type to get.\r\n * @returns The action type used by the action creator.\r\n *\r\n * @public\r\n */\r\nexport function getType(\r\n actionCreator: PayloadActionCreator\r\n): T {\r\n return `${actionCreator}` as T\r\n}\r\n\r\n// helper types for more readable typings\r\n\r\ntype IfPrepareActionMethodProvided<\r\n PA extends PrepareAction | void,\r\n True,\r\n False\r\n> = PA extends (...args: any[]) => any ? True : False\r\n", "import type { Draft } from 'immer'\r\nimport createNextState, { isDraft, isDraftable } from 'immer'\r\nimport type { AnyAction, Action, Reducer } from 'redux'\r\nimport type { ActionReducerMapBuilder } from './mapBuilders'\r\nimport { executeReducerBuilderCallback } from './mapBuilders'\r\nimport type { NoInfer } from './tsHelpers'\r\n\r\n/**\r\n * Defines a mapping from action types to corresponding action object shapes.\r\n *\r\n * @deprecated This should not be used manually - it is only used for internal\r\n * inference purposes and should not have any further value.\r\n * It might be removed in the future.\r\n * @public\r\n */\r\nexport type Actions = Record\r\n\r\nexport interface ActionMatcher {\r\n (action: AnyAction): action is A\r\n}\r\n\r\nexport type ActionMatcherDescription = {\r\n matcher: ActionMatcher\r\n reducer: CaseReducer>\r\n}\r\n\r\nexport type ReadonlyActionMatcherDescriptionCollection = ReadonlyArray<\r\n ActionMatcherDescription\r\n>\r\n\r\nexport type ActionMatcherDescriptionCollection = Array<\r\n ActionMatcherDescription\r\n>\r\n\r\n/**\r\n * An *case reducer* is a reducer function for a specific action type. Case\r\n * reducers can be composed to full reducers using `createReducer()`.\r\n *\r\n * Unlike a normal Redux reducer, a case reducer is never called with an\r\n * `undefined` state to determine the initial state. Instead, the initial\r\n * state is explicitly specified as an argument to `createReducer()`.\r\n *\r\n * In addition, a case reducer can choose to mutate the passed-in `state`\r\n * value directly instead of returning a new state. This does not actually\r\n * cause the store state to be mutated directly; instead, thanks to\r\n * [immer](https://github.com/mweststrate/immer), the mutations are\r\n * translated to copy operations that result in a new state.\r\n *\r\n * @public\r\n */\r\nexport type CaseReducer = (\r\n state: Draft,\r\n action: A\r\n) => S | void | Draft\r\n\r\n/**\r\n * A mapping from action types to case reducers for `createReducer()`.\r\n *\r\n * @deprecated This should not be used manually - it is only used\r\n * for internal inference purposes and using it manually\r\n * would lead to type erasure.\r\n * It might be removed in the future.\r\n * @public\r\n */\r\nexport type CaseReducers = {\r\n [T in keyof AS]: AS[T] extends Action ? CaseReducer : void\r\n}\r\n\r\nexport type NotFunction = T extends Function ? never : T\r\n\r\nfunction isStateFunction(x: unknown): x is () => S {\r\n return typeof x === 'function'\r\n}\r\n\r\nexport type ReducerWithInitialState> = Reducer & {\r\n getInitialState: () => S\r\n}\r\n\r\n/**\r\n * A utility function that allows defining a reducer as a mapping from action\r\n * type to *case reducer* functions that handle these action types. The\r\n * reducer's initial state is passed as the first argument.\r\n *\r\n * @remarks\r\n * The body of every case reducer is implicitly wrapped with a call to\r\n * `produce()` from the [immer](https://github.com/mweststrate/immer) library.\r\n * This means that rather than returning a new state object, you can also\r\n * mutate the passed-in state object directly; these mutations will then be\r\n * automatically and efficiently translated into copies, giving you both\r\n * convenience and immutability.\r\n *\r\n * @overloadSummary\r\n * This overload accepts a callback function that receives a `builder` object as its argument.\r\n * That builder provides `addCase`, `addMatcher` and `addDefaultCase` functions that may be\r\n * called to define what actions this reducer will handle.\r\n *\r\n * @param initialState - `State | (() => State)`: The initial state that should be used when the reducer is called the first time. This may also be a \"lazy initializer\" function, which should return an initial state value when called. This will be used whenever the reducer is called with `undefined` as its state value, and is primarily useful for cases like reading initial state from `localStorage`.\r\n * @param builderCallback - `(builder: Builder) => void` A callback that receives a *builder* object to define\r\n * case reducers via calls to `builder.addCase(actionCreatorOrType, reducer)`.\r\n * @example\r\n```ts\r\nimport {\r\n createAction,\r\n createReducer,\r\n AnyAction,\r\n PayloadAction,\r\n} from \"@reduxjs/toolkit\";\r\n\r\nconst increment = createAction(\"increment\");\r\nconst decrement = createAction(\"decrement\");\r\n\r\nfunction isActionWithNumberPayload(\r\n action: AnyAction\r\n): action is PayloadAction {\r\n return typeof action.payload === \"number\";\r\n}\r\n\r\nconst reducer = createReducer(\r\n {\r\n counter: 0,\r\n sumOfNumberPayloads: 0,\r\n unhandledActions: 0,\r\n },\r\n (builder) => {\r\n builder\r\n .addCase(increment, (state, action) => {\r\n // action is inferred correctly here\r\n state.counter += action.payload;\r\n })\r\n // You can chain calls, or have separate `builder.addCase()` lines each time\r\n .addCase(decrement, (state, action) => {\r\n state.counter -= action.payload;\r\n })\r\n // You can apply a \"matcher function\" to incoming actions\r\n .addMatcher(isActionWithNumberPayload, (state, action) => {})\r\n // and provide a default case if no other handlers matched\r\n .addDefaultCase((state, action) => {});\r\n }\r\n);\r\n```\r\n * @public\r\n */\r\nexport function createReducer>(\r\n initialState: S | (() => S),\r\n builderCallback: (builder: ActionReducerMapBuilder) => void\r\n): ReducerWithInitialState\r\n\r\n/**\r\n * A utility function that allows defining a reducer as a mapping from action\r\n * type to *case reducer* functions that handle these action types. The\r\n * reducer's initial state is passed as the first argument.\r\n *\r\n * The body of every case reducer is implicitly wrapped with a call to\r\n * `produce()` from the [immer](https://github.com/mweststrate/immer) library.\r\n * This means that rather than returning a new state object, you can also\r\n * mutate the passed-in state object directly; these mutations will then be\r\n * automatically and efficiently translated into copies, giving you both\r\n * convenience and immutability.\r\n * \r\n * @overloadSummary\r\n * This overload accepts an object where the keys are string action types, and the values\r\n * are case reducer functions to handle those action types.\r\n *\r\n * @param initialState - `State | (() => State)`: The initial state that should be used when the reducer is called the first time. This may also be a \"lazy initializer\" function, which should return an initial state value when called. This will be used whenever the reducer is called with `undefined` as its state value, and is primarily useful for cases like reading initial state from `localStorage`.\r\n * @param actionsMap - An object mapping from action types to _case reducers_, each of which handles one specific action type.\r\n * @param actionMatchers - An array of matcher definitions in the form `{matcher, reducer}`.\r\n * All matching reducers will be executed in order, independently if a case reducer matched or not.\r\n * @param defaultCaseReducer - A \"default case\" reducer that is executed if no case reducer and no matcher\r\n * reducer was executed for this action.\r\n *\r\n * @example\r\n```js\r\nconst counterReducer = createReducer(0, {\r\n increment: (state, action) => state + action.payload,\r\n decrement: (state, action) => state - action.payload\r\n})\r\n\r\n// Alternately, use a \"lazy initializer\" to provide the initial state\r\n// (works with either form of createReducer)\r\nconst initialState = () => 0\r\nconst counterReducer = createReducer(initialState, {\r\n increment: (state, action) => state + action.payload,\r\n decrement: (state, action) => state - action.payload\r\n})\r\n```\r\n \r\n * Action creators that were generated using [`createAction`](./createAction) may be used directly as the keys here, using computed property syntax:\r\n\r\n```js\r\nconst increment = createAction('increment')\r\nconst decrement = createAction('decrement')\r\n\r\nconst counterReducer = createReducer(0, {\r\n [increment]: (state, action) => state + action.payload,\r\n [decrement.type]: (state, action) => state - action.payload\r\n})\r\n```\r\n * @public\r\n */\r\nexport function createReducer<\r\n S extends NotFunction,\r\n CR extends CaseReducers = CaseReducers\r\n>(\r\n initialState: S | (() => S),\r\n actionsMap: CR,\r\n actionMatchers?: ActionMatcherDescriptionCollection,\r\n defaultCaseReducer?: CaseReducer\r\n): ReducerWithInitialState\r\n\r\nexport function createReducer>(\r\n initialState: S | (() => S),\r\n mapOrBuilderCallback:\r\n | CaseReducers\r\n | ((builder: ActionReducerMapBuilder) => void),\r\n actionMatchers: ReadonlyActionMatcherDescriptionCollection = [],\r\n defaultCaseReducer?: CaseReducer\r\n): ReducerWithInitialState {\r\n let [actionsMap, finalActionMatchers, finalDefaultCaseReducer] =\r\n typeof mapOrBuilderCallback === 'function'\r\n ? executeReducerBuilderCallback(mapOrBuilderCallback)\r\n : [mapOrBuilderCallback, actionMatchers, defaultCaseReducer]\r\n\r\n // Ensure the initial state gets frozen either way\r\n let getInitialState: () => S\r\n if (isStateFunction(initialState)) {\r\n getInitialState = () => createNextState(initialState(), () => {})\r\n } else {\r\n const frozenInitialState = createNextState(initialState, () => {})\r\n getInitialState = () => frozenInitialState\r\n }\r\n\r\n function reducer(state = getInitialState(), action: any): S {\r\n let caseReducers = [\r\n actionsMap[action.type],\r\n ...finalActionMatchers\r\n .filter(({ matcher }) => matcher(action))\r\n .map(({ reducer }) => reducer),\r\n ]\r\n if (caseReducers.filter((cr) => !!cr).length === 0) {\r\n caseReducers = [finalDefaultCaseReducer]\r\n }\r\n\r\n return caseReducers.reduce((previousState, caseReducer): S => {\r\n if (caseReducer) {\r\n if (isDraft(previousState)) {\r\n // If it's already a draft, we must already be inside a `createNextState` call,\r\n // likely because this is being wrapped in `createReducer`, `createSlice`, or nested\r\n // inside an existing draft. It's safe to just pass the draft to the mutator.\r\n const draft = previousState as Draft // We can assume this is already a draft\r\n const result = caseReducer(draft, action)\r\n\r\n if (typeof result === 'undefined') {\r\n return previousState\r\n }\r\n\r\n return result as S\r\n } else if (!isDraftable(previousState)) {\r\n // If state is not draftable (ex: a primitive, such as 0), we want to directly\r\n // return the caseReducer func and not wrap it with produce.\r\n const result = caseReducer(previousState as any, action)\r\n\r\n if (typeof result === 'undefined') {\r\n if (previousState === null) {\r\n return previousState\r\n }\r\n throw Error(\r\n 'A case reducer on a non-draftable value must not return undefined'\r\n )\r\n }\r\n\r\n return result as S\r\n } else {\r\n // @ts-ignore createNextState() produces an Immutable> rather\r\n // than an Immutable, and TypeScript cannot find out how to reconcile\r\n // these two types.\r\n return createNextState(previousState, (draft: Draft) => {\r\n return caseReducer(draft, action)\r\n })\r\n }\r\n }\r\n\r\n return previousState\r\n }, state)\r\n }\r\n\r\n reducer.getInitialState = getInitialState\r\n\r\n return reducer as ReducerWithInitialState\r\n}\r\n", "import type { Action, AnyAction } from 'redux'\r\nimport type {\r\n CaseReducer,\r\n CaseReducers,\r\n ActionMatcher,\r\n ActionMatcherDescriptionCollection,\r\n} from './createReducer'\r\n\r\nexport interface TypedActionCreator {\r\n (...args: any[]): Action\r\n type: Type\r\n}\r\n\r\n/**\r\n * A builder for an action <-> reducer map.\r\n *\r\n * @public\r\n */\r\nexport interface ActionReducerMapBuilder {\r\n /**\r\n * Adds a case reducer to handle a single exact action type.\r\n * @remarks\r\n * All calls to `builder.addCase` must come before any calls to `builder.addMatcher` or `builder.addDefaultCase`.\r\n * @param actionCreator - Either a plain action type string, or an action creator generated by [`createAction`](./createAction) that can be used to determine the action type.\r\n * @param reducer - The actual case reducer function.\r\n */\r\n addCase>(\r\n actionCreator: ActionCreator,\r\n reducer: CaseReducer>\r\n ): ActionReducerMapBuilder\r\n /**\r\n * Adds a case reducer to handle a single exact action type.\r\n * @remarks\r\n * All calls to `builder.addCase` must come before any calls to `builder.addMatcher` or `builder.addDefaultCase`.\r\n * @param actionCreator - Either a plain action type string, or an action creator generated by [`createAction`](./createAction) that can be used to determine the action type.\r\n * @param reducer - The actual case reducer function.\r\n */\r\n addCase>(\r\n type: Type,\r\n reducer: CaseReducer\r\n ): ActionReducerMapBuilder\r\n\r\n /**\r\n * Allows you to match your incoming actions against your own filter function instead of only the `action.type` property.\r\n * @remarks\r\n * If multiple matcher reducers match, all of them will be executed in the order\r\n * they were defined in - even if a case reducer already matched.\r\n * All calls to `builder.addMatcher` must come after any calls to `builder.addCase` and before any calls to `builder.addDefaultCase`.\r\n * @param matcher - A matcher function. In TypeScript, this should be a [type predicate](https://www.typescriptlang.org/docs/handbook/advanced-types.html#using-type-predicates)\r\n * function\r\n * @param reducer - The actual case reducer function.\r\n *\r\n * @example\r\n```ts\r\nimport {\r\n createAction,\r\n createReducer,\r\n AsyncThunk,\r\n AnyAction,\r\n} from \"@reduxjs/toolkit\";\r\n\r\ntype GenericAsyncThunk = AsyncThunk;\r\n\r\ntype PendingAction = ReturnType;\r\ntype RejectedAction = ReturnType;\r\ntype FulfilledAction = ReturnType;\r\n\r\nconst initialState: Record = {};\r\nconst resetAction = createAction(\"reset-tracked-loading-state\");\r\n\r\nfunction isPendingAction(action: AnyAction): action is PendingAction {\r\n return action.type.endsWith(\"/pending\");\r\n}\r\n\r\nconst reducer = createReducer(initialState, (builder) => {\r\n builder\r\n .addCase(resetAction, () => initialState)\r\n // matcher can be defined outside as a type predicate function\r\n .addMatcher(isPendingAction, (state, action) => {\r\n state[action.meta.requestId] = \"pending\";\r\n })\r\n .addMatcher(\r\n // matcher can be defined inline as a type predicate function\r\n (action): action is RejectedAction => action.type.endsWith(\"/rejected\"),\r\n (state, action) => {\r\n state[action.meta.requestId] = \"rejected\";\r\n }\r\n )\r\n // matcher can just return boolean and the matcher can receive a generic argument\r\n .addMatcher(\r\n (action) => action.type.endsWith(\"/fulfilled\"),\r\n (state, action) => {\r\n state[action.meta.requestId] = \"fulfilled\";\r\n }\r\n );\r\n});\r\n```\r\n */\r\n addMatcher(\r\n matcher: ActionMatcher | ((action: AnyAction) => boolean),\r\n reducer: CaseReducer\r\n ): Omit, 'addCase'>\r\n\r\n /**\r\n * Adds a \"default case\" reducer that is executed if no case reducer and no matcher\r\n * reducer was executed for this action.\r\n * @param reducer - The fallback \"default case\" reducer function.\r\n *\r\n * @example\r\n```ts\r\nimport { createReducer } from '@reduxjs/toolkit'\r\nconst initialState = { otherActions: 0 }\r\nconst reducer = createReducer(initialState, builder => {\r\n builder\r\n // .addCase(...)\r\n // .addMatcher(...)\r\n .addDefaultCase((state, action) => {\r\n state.otherActions++\r\n })\r\n})\r\n```\r\n */\r\n addDefaultCase(reducer: CaseReducer): {}\r\n}\r\n\r\nexport function executeReducerBuilderCallback(\r\n builderCallback: (builder: ActionReducerMapBuilder) => void\r\n): [\r\n CaseReducers,\r\n ActionMatcherDescriptionCollection,\r\n CaseReducer | undefined\r\n] {\r\n const actionsMap: CaseReducers = {}\r\n const actionMatchers: ActionMatcherDescriptionCollection = []\r\n let defaultCaseReducer: CaseReducer | undefined\r\n const builder = {\r\n addCase(\r\n typeOrActionCreator: string | TypedActionCreator,\r\n reducer: CaseReducer\r\n ) {\r\n if (process.env.NODE_ENV !== 'production') {\r\n /*\r\n to keep the definition by the user in line with actual behavior, \r\n we enforce `addCase` to always be called before calling `addMatcher`\r\n as matching cases take precedence over matchers\r\n */\r\n if (actionMatchers.length > 0) {\r\n throw new Error(\r\n '`builder.addCase` should only be called before calling `builder.addMatcher`'\r\n )\r\n }\r\n if (defaultCaseReducer) {\r\n throw new Error(\r\n '`builder.addCase` should only be called before calling `builder.addDefaultCase`'\r\n )\r\n }\r\n }\r\n const type =\r\n typeof typeOrActionCreator === 'string'\r\n ? typeOrActionCreator\r\n : typeOrActionCreator.type\r\n if (type in actionsMap) {\r\n throw new Error(\r\n 'addCase cannot be called with two reducers for the same action type'\r\n )\r\n }\r\n actionsMap[type] = reducer\r\n return builder\r\n },\r\n addMatcher(\r\n matcher: ActionMatcher,\r\n reducer: CaseReducer\r\n ) {\r\n if (process.env.NODE_ENV !== 'production') {\r\n if (defaultCaseReducer) {\r\n throw new Error(\r\n '`builder.addMatcher` should only be called before calling `builder.addDefaultCase`'\r\n )\r\n }\r\n }\r\n actionMatchers.push({ matcher, reducer })\r\n return builder\r\n },\r\n addDefaultCase(reducer: CaseReducer) {\r\n if (process.env.NODE_ENV !== 'production') {\r\n if (defaultCaseReducer) {\r\n throw new Error('`builder.addDefaultCase` can only be called once')\r\n }\r\n }\r\n defaultCaseReducer = reducer\r\n return builder\r\n },\r\n }\r\n builderCallback(builder)\r\n return [actionsMap, actionMatchers, defaultCaseReducer]\r\n}\r\n", "import type { AnyAction, Reducer } from 'redux'\r\nimport { createNextState } from '.'\r\nimport type {\r\n ActionCreatorWithoutPayload,\r\n PayloadAction,\r\n PayloadActionCreator,\r\n PrepareAction,\r\n _ActionCreatorWithPreparedPayload,\r\n} from './createAction'\r\nimport { createAction } from './createAction'\r\nimport type {\r\n CaseReducer,\r\n CaseReducers,\r\n ReducerWithInitialState,\r\n} from './createReducer'\r\nimport { createReducer, NotFunction } from './createReducer'\r\nimport type { ActionReducerMapBuilder } from './mapBuilders'\r\nimport { executeReducerBuilderCallback } from './mapBuilders'\r\nimport type { NoInfer } from './tsHelpers'\r\n\r\n/**\r\n * An action creator attached to a slice.\r\n *\r\n * @deprecated please use PayloadActionCreator directly\r\n *\r\n * @public\r\n */\r\nexport type SliceActionCreator