You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
3549 lines
977 KiB
3549 lines
977 KiB
/*
|
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
|
if you want to view the source, please visit the github repository of this plugin
|
|
*/
|
|
|
|
var i7=Object.create;var nr=Object.defineProperty;var n7=Object.getOwnPropertyDescriptor;var s7=Object.getOwnPropertyNames;var r7=Object.getPrototypeOf,a7=Object.prototype.hasOwnProperty;var Z6=o=>nr(o,"__esModule",{value:!0});var ss=(o,e)=>()=>(e||o((e={exports:{}}).exports,e),e.exports),o7=(o,e)=>{Z6(o);for(var t in e)nr(o,t,{get:e[t],enumerable:!0})},c7=(o,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of s7(e))!a7.call(o,i)&&i!=="default"&&nr(o,i,{get:()=>e[i],enumerable:!(t=n7(e,i))||t.enumerable});return o},Mt=o=>c7(Z6(nr(o!=null?i7(r7(o)):{},"default",o&&o.__esModule&&"default"in o?{get:()=>o.default,enumerable:!0}:{value:o,enumerable:!0})),o);var T4=(o,e,t)=>{if(!e.has(o))throw TypeError("Cannot "+t)};var Pe=(o,e,t)=>(T4(o,e,"read from private field"),t?t.call(o):e.get(o)),at=(o,e,t)=>{if(e.has(o))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(o):e.set(o,t)},Kt=(o,e,t,i)=>(T4(o,e,"write to private field"),i?i.call(o,t):e.set(o,t),t);var Ze=(o,e,t)=>(T4(o,e,"access private method"),t);var X6=ss(sr=>{"use strict";Object.defineProperty(sr,"__esModule",{value:!0});require("obsidian");var l7=o=>{var e;return o?(e=o.plugins.plugins.dataview)===null||e===void 0?void 0:e.api:window.DataviewAPI},h7=o=>o.plugins.enabledPlugins.has("dataview");sr.getAPI=l7;sr.isPluginEnabled=h7});var T3=ss((fr,cs)=>{(function(o){var e=typeof fr=="object"&&fr,t=typeof cs=="object"&&cs&&cs.exports==e&&cs,i=typeof global=="object"&&global;(i.global===i||i.window===i)&&(o=i);var n=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,s=/[\x01-\x7F]/g,r=/[\x01-\t\x0B\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,a=/<\u20D2|=\u20E5|>\u20D2|\u205F\u200A|\u219D\u0338|\u2202\u0338|\u2220\u20D2|\u2229\uFE00|\u222A\uFE00|\u223C\u20D2|\u223D\u0331|\u223E\u0333|\u2242\u0338|\u224B\u0338|\u224D\u20D2|\u224E\u0338|\u224F\u0338|\u2250\u0338|\u2261\u20E5|\u2264\u20D2|\u2265\u20D2|\u2266\u0338|\u2267\u0338|\u2268\uFE00|\u2269\uFE00|\u226A\u0338|\u226A\u20D2|\u226B\u0338|\u226B\u20D2|\u227F\u0338|\u2282\u20D2|\u2283\u20D2|\u228A\uFE00|\u228B\uFE00|\u228F\u0338|\u2290\u0338|\u2293\uFE00|\u2294\uFE00|\u22B4\u20D2|\u22B5\u20D2|\u22D8\u0338|\u22D9\u0338|\u22DA\uFE00|\u22DB\uFE00|\u22F5\u0338|\u22F9\u0338|\u2933\u0338|\u29CF\u0338|\u29D0\u0338|\u2A6D\u0338|\u2A70\u0338|\u2A7D\u0338|\u2A7E\u0338|\u2AA1\u0338|\u2AA2\u0338|\u2AAC\uFE00|\u2AAD\uFE00|\u2AAF\u0338|\u2AB0\u0338|\u2AC5\u0338|\u2AC6\u0338|\u2ACB\uFE00|\u2ACC\uFE00|\u2AFD\u20E5|[\xA0-\u0113\u0116-\u0122\u0124-\u012B\u012E-\u014D\u0150-\u017E\u0192\u01B5\u01F5\u0237\u02C6\u02C7\u02D8-\u02DD\u0311\u0391-\u03A1\u03A3-\u03A9\u03B1-\u03C9\u03D1\u03D2\u03D5\u03D6\u03DC\u03DD\u03F0\u03F1\u03F5\u03F6\u0401-\u040C\u040E-\u044F\u0451-\u045C\u045E\u045F\u2002-\u2005\u2007-\u2010\u2013-\u2016\u2018-\u201A\u201C-\u201E\u2020-\u2022\u2025\u2026\u2030-\u2035\u2039\u203A\u203E\u2041\u2043\u2044\u204F\u2057\u205F-\u2063\u20AC\u20DB\u20DC\u2102\u2105\u210A-\u2113\u2115-\u211E\u2122\u2124\u2127-\u2129\u212C\u212D\u212F-\u2131\u2133-\u2138\u2145-\u2148\u2153-\u215E\u2190-\u219B\u219D-\u21A7\u21A9-\u21AE\u21B0-\u21B3\u21B5-\u21B7\u21BA-\u21DB\u21DD\u21E4\u21E5\u21F5\u21FD-\u2205\u2207-\u2209\u220B\u220C\u220F-\u2214\u2216-\u2218\u221A\u221D-\u2238\u223A-\u2257\u2259\u225A\u225C\u225F-\u2262\u2264-\u228B\u228D-\u229B\u229D-\u22A5\u22A7-\u22B0\u22B2-\u22BB\u22BD-\u22DB\u22DE-\u22E3\u22E6-\u22F7\u22F9-\u22FE\u2305\u2306\u2308-\u2310\u2312\u2313\u2315\u2316\u231C-\u231F\u2322\u2323\u232D\u232E\u2336\u233D\u233F\u237C\u23B0\u23B1\u23B4-\u23B6\u23DC-\u23DF\u23E2\u23E7\u2423\u24C8\u2500\u2502\u250C\u2510\u2514\u2518\u251C\u2524\u252C\u2534\u253C\u2550-\u256C\u2580\u2584\u2588\u2591-\u2593\u25A1\u25AA\u25AB\u25AD\u25AE\u25B1\u25B3-\u25B5\u25B8\u25B9\u25BD-\u25BF\u25C2\u25C3\u25CA\u25CB\u25EC\u25EF\u25F8-\u25FC\u2605\u2606\u260E\u2640\u2642\u2660\u2663\u2665\u2666\u266A\u266D-\u266F\u2713\u2717\u2720\u2736\u2758\u2772\u2773\u27C8\u27C9\u27E6-\u27ED\u27F5-\u27FA\u27FC\u27FF\u2902-\u2905\u290C-\u2913\u2916\u2919-\u2920\u2923-\u292A\u2933\u2935-\u2939\u293C\u293D\u2945\u2948-\u294B\u294E-\u2976\u2978\u2979\u297B-\u297F\u2985\u2986\u298B-\u2996\u299A\u299C\u299D\u29A4-\u29B7\u29B9\u29BB\u29BC\u29BE-\u29C5\u29C9\u29CD-\u29D0\u29DC-\u29DE\u29E3-\u29E5\u29EB\u29F4\u29F6\u2A00-\u2A02\u2A04\u2A06\u2A0C\u2A0D\u2A10-\u2A17\u2A22-\u2A27\u2A29\u2A2A\u2A2D-\u2A31\u2A33-\u2A3C\u2A3F\u2A40\u2A42-\u2A4D\u2A50\u2A53-\u2A58\u2A5A-\u2A5D\u2A5F\u2A66\u2A6A\u2A6D-\u2A75\u2A77-\u2A9A\u2A9D-\u2AA2\u2AA4-\u2AB0\u2AB3-\u2AC8\u2ACB\u2ACC\u2ACF-\u2ADB\u2AE4\u2AE6-\u2AE9\u2AEB-\u2AF3\u2AFD\uFB00-\uFB04]|\uD835[\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDCCF\uDD04\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDD6B]/g,c={"\xAD":"shy","\u200C":"zwnj","\u200D":"zwj","\u200E":"lrm","\u2063":"ic","\u2062":"it","\u2061":"af","\u200F":"rlm","\u200B":"ZeroWidthSpace","\u2060":"NoBreak","\u0311":"DownBreve","\u20DB":"tdot","\u20DC":"DotDot"," ":"Tab","\n":"NewLine","\u2008":"puncsp","\u205F":"MediumSpace","\u2009":"thinsp","\u200A":"hairsp","\u2004":"emsp13","\u2002":"ensp","\u2005":"emsp14","\u2003":"emsp","\u2007":"numsp","\xA0":"nbsp","\u205F\u200A":"ThickSpace","\u203E":"oline",_:"lowbar","\u2010":"dash","\u2013":"ndash","\u2014":"mdash","\u2015":"horbar",",":"comma",";":"semi","\u204F":"bsemi",":":"colon","\u2A74":"Colone","!":"excl","\xA1":"iexcl","?":"quest","\xBF":"iquest",".":"period","\u2025":"nldr","\u2026":"mldr","\xB7":"middot","'":"apos","\u2018":"lsquo","\u2019":"rsquo","\u201A":"sbquo","\u2039":"lsaquo","\u203A":"rsaquo",'"':"quot","\u201C":"ldquo","\u201D":"rdquo","\u201E":"bdquo","\xAB":"laquo","\xBB":"raquo","(":"lpar",")":"rpar","[":"lsqb","]":"rsqb","{":"lcub","}":"rcub","\u2308":"lceil","\u2309":"rceil","\u230A":"lfloor","\u230B":"rfloor","\u2985":"lopar","\u2986":"ropar","\u298B":"lbrke","\u298C":"rbrke","\u298D":"lbrkslu","\u298E":"rbrksld","\u298F":"lbrksld","\u2990":"rbrkslu","\u2991":"langd","\u2992":"rangd","\u2993":"lparlt","\u2994":"rpargt","\u2995":"gtlPar","\u2996":"ltrPar","\u27E6":"lobrk","\u27E7":"robrk","\u27E8":"lang","\u27E9":"rang","\u27EA":"Lang","\u27EB":"Rang","\u27EC":"loang","\u27ED":"roang","\u2772":"lbbrk","\u2773":"rbbrk","\u2016":"Vert","\xA7":"sect","\xB6":"para","@":"commat","*":"ast","/":"sol",undefined:null,"&":"amp","#":"num","%":"percnt","\u2030":"permil","\u2031":"pertenk","\u2020":"dagger","\u2021":"Dagger","\u2022":"bull","\u2043":"hybull","\u2032":"prime","\u2033":"Prime","\u2034":"tprime","\u2057":"qprime","\u2035":"bprime","\u2041":"caret","`":"grave","\xB4":"acute","\u02DC":"tilde","^":"Hat","\xAF":"macr","\u02D8":"breve","\u02D9":"dot","\xA8":"die","\u02DA":"ring","\u02DD":"dblac","\xB8":"cedil","\u02DB":"ogon","\u02C6":"circ","\u02C7":"caron","\xB0":"deg","\xA9":"copy","\xAE":"reg","\u2117":"copysr","\u2118":"wp","\u211E":"rx","\u2127":"mho","\u2129":"iiota","\u2190":"larr","\u219A":"nlarr","\u2192":"rarr","\u219B":"nrarr","\u2191":"uarr","\u2193":"darr","\u2194":"harr","\u21AE":"nharr","\u2195":"varr","\u2196":"nwarr","\u2197":"nearr","\u2198":"searr","\u2199":"swarr","\u219D":"rarrw","\u219D\u0338":"nrarrw","\u219E":"Larr","\u219F":"Uarr","\u21A0":"Rarr","\u21A1":"Darr","\u21A2":"larrtl","\u21A3":"rarrtl","\u21A4":"mapstoleft","\u21A5":"mapstoup","\u21A6":"map","\u21A7":"mapstodown","\u21A9":"larrhk","\u21AA":"rarrhk","\u21AB":"larrlp","\u21AC":"rarrlp","\u21AD":"harrw","\u21B0":"lsh","\u21B1":"rsh","\u21B2":"ldsh","\u21B3":"rdsh","\u21B5":"crarr","\u21B6":"cularr","\u21B7":"curarr","\u21BA":"olarr","\u21BB":"orarr","\u21BC":"lharu","\u21BD":"lhard","\u21BE":"uharr","\u21BF":"uharl","\u21C0":"rharu","\u21C1":"rhard","\u21C2":"dharr","\u21C3":"dharl","\u21C4":"rlarr","\u21C5":"udarr","\u21C6":"lrarr","\u21C7":"llarr","\u21C8":"uuarr","\u21C9":"rrarr","\u21CA":"ddarr","\u21CB":"lrhar","\u21CC":"rlhar","\u21D0":"lArr","\u21CD":"nlArr","\u21D1":"uArr","\u21D2":"rArr","\u21CF":"nrArr","\u21D3":"dArr","\u21D4":"iff","\u21CE":"nhArr","\u21D5":"vArr","\u21D6":"nwArr","\u21D7":"neArr","\u21D8":"seArr","\u21D9":"swArr","\u21DA":"lAarr","\u21DB":"rAarr","\u21DD":"zigrarr","\u21E4":"larrb","\u21E5":"rarrb","\u21F5":"duarr","\u21FD":"loarr","\u21FE":"roarr","\u21FF":"hoarr","\u2200":"forall","\u2201":"comp","\u2202":"part","\u2202\u0338":"npart","\u2203":"exist","\u2204":"nexist","\u2205":"empty","\u2207":"Del","\u2208":"in","\u2209":"notin","\u220B":"ni","\u220C":"notni","\u03F6":"bepsi","\u220F":"prod","\u2210":"coprod","\u2211":"sum","+":"plus","\xB1":"pm","\xF7":"div","\xD7":"times","<":"lt","\u226E":"nlt","<\u20D2":"nvlt","=":"equals","\u2260":"ne","=\u20E5":"bne","\u2A75":"Equal",">":"gt","\u226F":"ngt",">\u20D2":"nvgt","\xAC":"not","|":"vert","\xA6":"brvbar","\u2212":"minus","\u2213":"mp","\u2214":"plusdo","\u2044":"frasl","\u2216":"setmn","\u2217":"lowast","\u2218":"compfn","\u221A":"Sqrt","\u221D":"prop","\u221E":"infin","\u221F":"angrt","\u2220":"ang","\u2220\u20D2":"nang","\u2221":"angmsd","\u2222":"angsph","\u2223":"mid","\u2224":"nmid","\u2225":"par","\u2226":"npar","\u2227":"and","\u2228":"or","\u2229":"cap","\u2229\uFE00":"caps","\u222A":"cup","\u222A\uFE00":"cups","\u222B":"int","\u222C":"Int","\u222D":"tint","\u2A0C":"qint","\u222E":"oint","\u222F":"Conint","\u2230":"Cconint","\u2231":"cwint","\u2232":"cwconint","\u2233":"awconint","\u2234":"there4","\u2235":"becaus","\u2236":"ratio","\u2237":"Colon","\u2238":"minusd","\u223A":"mDDot","\u223B":"homtht","\u223C":"sim","\u2241":"nsim","\u223C\u20D2":"nvsim","\u223D":"bsim","\u223D\u0331":"race","\u223E":"ac","\u223E\u0333":"acE","\u223F":"acd","\u2240":"wr","\u2242":"esim","\u2242\u0338":"nesim","\u2243":"sime","\u2244":"nsime","\u2245":"cong","\u2247":"ncong","\u2246":"simne","\u2248":"ap","\u2249":"nap","\u224A":"ape","\u224B":"apid","\u224B\u0338":"napid","\u224C":"bcong","\u224D":"CupCap","\u226D":"NotCupCap","\u224D\u20D2":"nvap","\u224E":"bump","\u224E\u0338":"nbump","\u224F":"bumpe","\u224F\u0338":"nbumpe","\u2250":"doteq","\u2250\u0338":"nedot","\u2251":"eDot","\u2252":"efDot","\u2253":"erDot","\u2254":"colone","\u2255":"ecolon","\u2256":"ecir","\u2257":"cire","\u2259":"wedgeq","\u225A":"veeeq","\u225C":"trie","\u225F":"equest","\u2261":"equiv","\u2262":"nequiv","\u2261\u20E5":"bnequiv","\u2264":"le","\u2270":"nle","\u2264\u20D2":"nvle","\u2265":"ge","\u2271":"nge","\u2265\u20D2":"nvge","\u2266":"lE","\u2266\u0338":"nlE","\u2267":"gE","\u2267\u0338":"ngE","\u2268\uFE00":"lvnE","\u2268":"lnE","\u2269":"gnE","\u2269\uFE00":"gvnE","\u226A":"ll","\u226A\u0338":"nLtv","\u226A\u20D2":"nLt","\u226B":"gg","\u226B\u0338":"nGtv","\u226B\u20D2":"nGt","\u226C":"twixt","\u2272":"lsim","\u2274":"nlsim","\u2273":"gsim","\u2275":"ngsim","\u2276":"lg","\u2278":"ntlg","\u2277":"gl","\u2279":"ntgl","\u227A":"pr","\u2280":"npr","\u227B":"sc","\u2281":"nsc","\u227C":"prcue","\u22E0":"nprcue","\u227D":"sccue","\u22E1":"nsccue","\u227E":"prsim","\u227F":"scsim","\u227F\u0338":"NotSucceedsTilde","\u2282":"sub","\u2284":"nsub","\u2282\u20D2":"vnsub","\u2283":"sup","\u2285":"nsup","\u2283\u20D2":"vnsup","\u2286":"sube","\u2288":"nsube","\u2287":"supe","\u2289":"nsupe","\u228A\uFE00":"vsubne","\u228A":"subne","\u228B\uFE00":"vsupne","\u228B":"supne","\u228D":"cupdot","\u228E":"uplus","\u228F":"sqsub","\u228F\u0338":"NotSquareSubset","\u2290":"sqsup","\u2290\u0338":"NotSquareSuperset","\u2291":"sqsube","\u22E2":"nsqsube","\u2292":"sqsupe","\u22E3":"nsqsupe","\u2293":"sqcap","\u2293\uFE00":"sqcaps","\u2294":"sqcup","\u2294\uFE00":"sqcups","\u2295":"oplus","\u2296":"ominus","\u2297":"otimes","\u2298":"osol","\u2299":"odot","\u229A":"ocir","\u229B":"oast","\u229D":"odash","\u229E":"plusb","\u229F":"minusb","\u22A0":"timesb","\u22A1":"sdotb","\u22A2":"vdash","\u22AC":"nvdash","\u22A3":"dashv","\u22A4":"top","\u22A5":"bot","\u22A7":"models","\u22A8":"vDash","\u22AD":"nvDash","\u22A9":"Vdash","\u22AE":"nVdash","\u22AA":"Vvdash","\u22AB":"VDash","\u22AF":"nVDash","\u22B0":"prurel","\u22B2":"vltri","\u22EA":"nltri","\u22B3":"vrtri","\u22EB":"nrtri","\u22B4":"ltrie","\u22EC":"nltrie","\u22B4\u20D2":"nvltrie","\u22B5":"rtrie","\u22ED":"nrtrie","\u22B5\u20D2":"nvrtrie","\u22B6":"origof","\u22B7":"imof","\u22B8":"mumap","\u22B9":"hercon","\u22BA":"intcal","\u22BB":"veebar","\u22BD":"barvee","\u22BE":"angrtvb","\u22BF":"lrtri","\u22C0":"Wedge","\u22C1":"Vee","\u22C2":"xcap","\u22C3":"xcup","\u22C4":"diam","\u22C5":"sdot","\u22C6":"Star","\u22C7":"divonx","\u22C8":"bowtie","\u22C9":"ltimes","\u22CA":"rtimes","\u22CB":"lthree","\u22CC":"rthree","\u22CD":"bsime","\u22CE":"cuvee","\u22CF":"cuwed","\u22D0":"Sub","\u22D1":"Sup","\u22D2":"Cap","\u22D3":"Cup","\u22D4":"fork","\u22D5":"epar","\u22D6":"ltdot","\u22D7":"gtdot","\u22D8":"Ll","\u22D8\u0338":"nLl","\u22D9":"Gg","\u22D9\u0338":"nGg","\u22DA\uFE00":"lesg","\u22DA":"leg","\u22DB":"gel","\u22DB\uFE00":"gesl","\u22DE":"cuepr","\u22DF":"cuesc","\u22E6":"lnsim","\u22E7":"gnsim","\u22E8":"prnsim","\u22E9":"scnsim","\u22EE":"vellip","\u22EF":"ctdot","\u22F0":"utdot","\u22F1":"dtdot","\u22F2":"disin","\u22F3":"isinsv","\u22F4":"isins","\u22F5":"isindot","\u22F5\u0338":"notindot","\u22F6":"notinvc","\u22F7":"notinvb","\u22F9":"isinE","\u22F9\u0338":"notinE","\u22FA":"nisd","\u22FB":"xnis","\u22FC":"nis","\u22FD":"notnivc","\u22FE":"notnivb","\u2305":"barwed","\u2306":"Barwed","\u230C":"drcrop","\u230D":"dlcrop","\u230E":"urcrop","\u230F":"ulcrop","\u2310":"bnot","\u2312":"profline","\u2313":"profsurf","\u2315":"telrec","\u2316":"target","\u231C":"ulcorn","\u231D":"urcorn","\u231E":"dlcorn","\u231F":"drcorn","\u2322":"frown","\u2323":"smile","\u232D":"cylcty","\u232E":"profalar","\u2336":"topbot","\u233D":"ovbar","\u233F":"solbar","\u237C":"angzarr","\u23B0":"lmoust","\u23B1":"rmoust","\u23B4":"tbrk","\u23B5":"bbrk","\u23B6":"bbrktbrk","\u23DC":"OverParenthesis","\u23DD":"UnderParenthesis","\u23DE":"OverBrace","\u23DF":"UnderBrace","\u23E2":"trpezium","\u23E7":"elinters","\u2423":"blank","\u2500":"boxh","\u2502":"boxv","\u250C":"boxdr","\u2510":"boxdl","\u2514":"boxur","\u2518":"boxul","\u251C":"boxvr","\u2524":"boxvl","\u252C":"boxhd","\u2534":"boxhu","\u253C":"boxvh","\u2550":"boxH","\u2551":"boxV","\u2552":"boxdR","\u2553":"boxDr","\u2554":"boxDR","\u2555":"boxdL","\u2556":"boxDl","\u2557":"boxDL","\u2558":"boxuR","\u2559":"boxUr","\u255A":"boxUR","\u255B":"boxuL","\u255C":"boxUl","\u255D":"boxUL","\u255E":"boxvR","\u255F":"boxVr","\u2560":"boxVR","\u2561":"boxvL","\u2562":"boxVl","\u2563":"boxVL","\u2564":"boxHd","\u2565":"boxhD","\u2566":"boxHD","\u2567":"boxHu","\u2568":"boxhU","\u2569":"boxHU","\u256A":"boxvH","\u256B":"boxVh","\u256C":"boxVH","\u2580":"uhblk","\u2584":"lhblk","\u2588":"block","\u2591":"blk14","\u2592":"blk12","\u2593":"blk34","\u25A1":"squ","\u25AA":"squf","\u25AB":"EmptyVerySmallSquare","\u25AD":"rect","\u25AE":"marker","\u25B1":"fltns","\u25B3":"xutri","\u25B4":"utrif","\u25B5":"utri","\u25B8":"rtrif","\u25B9":"rtri","\u25BD":"xdtri","\u25BE":"dtrif","\u25BF":"dtri","\u25C2":"ltrif","\u25C3":"ltri","\u25CA":"loz","\u25CB":"cir","\u25EC":"tridot","\u25EF":"xcirc","\u25F8":"ultri","\u25F9":"urtri","\u25FA":"lltri","\u25FB":"EmptySmallSquare","\u25FC":"FilledSmallSquare","\u2605":"starf","\u2606":"star","\u260E":"phone","\u2640":"female","\u2642":"male","\u2660":"spades","\u2663":"clubs","\u2665":"hearts","\u2666":"diams","\u266A":"sung","\u2713":"check","\u2717":"cross","\u2720":"malt","\u2736":"sext","\u2758":"VerticalSeparator","\u27C8":"bsolhsub","\u27C9":"suphsol","\u27F5":"xlarr","\u27F6":"xrarr","\u27F7":"xharr","\u27F8":"xlArr","\u27F9":"xrArr","\u27FA":"xhArr","\u27FC":"xmap","\u27FF":"dzigrarr","\u2902":"nvlArr","\u2903":"nvrArr","\u2904":"nvHarr","\u2905":"Map","\u290C":"lbarr","\u290D":"rbarr","\u290E":"lBarr","\u290F":"rBarr","\u2910":"RBarr","\u2911":"DDotrahd","\u2912":"UpArrowBar","\u2913":"DownArrowBar","\u2916":"Rarrtl","\u2919":"latail","\u291A":"ratail","\u291B":"lAtail","\u291C":"rAtail","\u291D":"larrfs","\u291E":"rarrfs","\u291F":"larrbfs","\u2920":"rarrbfs","\u2923":"nwarhk","\u2924":"nearhk","\u2925":"searhk","\u2926":"swarhk","\u2927":"nwnear","\u2928":"toea","\u2929":"tosa","\u292A":"swnwar","\u2933":"rarrc","\u2933\u0338":"nrarrc","\u2935":"cudarrr","\u2936":"ldca","\u2937":"rdca","\u2938":"cudarrl","\u2939":"larrpl","\u293C":"curarrm","\u293D":"cularrp","\u2945":"rarrpl","\u2948":"harrcir","\u2949":"Uarrocir","\u294A":"lurdshar","\u294B":"ldrushar","\u294E":"LeftRightVector","\u294F":"RightUpDownVector","\u2950":"DownLeftRightVector","\u2951":"LeftUpDownVector","\u2952":"LeftVectorBar","\u2953":"RightVectorBar","\u2954":"RightUpVectorBar","\u2955":"RightDownVectorBar","\u2956":"DownLeftVectorBar","\u2957":"DownRightVectorBar","\u2958":"LeftUpVectorBar","\u2959":"LeftDownVectorBar","\u295A":"LeftTeeVector","\u295B":"RightTeeVector","\u295C":"RightUpTeeVector","\u295D":"RightDownTeeVector","\u295E":"DownLeftTeeVector","\u295F":"DownRightTeeVector","\u2960":"LeftUpTeeVector","\u2961":"LeftDownTeeVector","\u2962":"lHar","\u2963":"uHar","\u2964":"rHar","\u2965":"dHar","\u2966":"luruhar","\u2967":"ldrdhar","\u2968":"ruluhar","\u2969":"rdldhar","\u296A":"lharul","\u296B":"llhard","\u296C":"rharul","\u296D":"lrhard","\u296E":"udhar","\u296F":"duhar","\u2970":"RoundImplies","\u2971":"erarr","\u2972":"simrarr","\u2973":"larrsim","\u2974":"rarrsim","\u2975":"rarrap","\u2976":"ltlarr","\u2978":"gtrarr","\u2979":"subrarr","\u297B":"suplarr","\u297C":"lfisht","\u297D":"rfisht","\u297E":"ufisht","\u297F":"dfisht","\u299A":"vzigzag","\u299C":"vangrt","\u299D":"angrtvbd","\u29A4":"ange","\u29A5":"range","\u29A6":"dwangle","\u29A7":"uwangle","\u29A8":"angmsdaa","\u29A9":"angmsdab","\u29AA":"angmsdac","\u29AB":"angmsdad","\u29AC":"angmsdae","\u29AD":"angmsdaf","\u29AE":"angmsdag","\u29AF":"angmsdah","\u29B0":"bemptyv","\u29B1":"demptyv","\u29B2":"cemptyv","\u29B3":"raemptyv","\u29B4":"laemptyv","\u29B5":"ohbar","\u29B6":"omid","\u29B7":"opar","\u29B9":"operp","\u29BB":"olcross","\u29BC":"odsold","\u29BE":"olcir","\u29BF":"ofcir","\u29C0":"olt","\u29C1":"ogt","\u29C2":"cirscir","\u29C3":"cirE","\u29C4":"solb","\u29C5":"bsolb","\u29C9":"boxbox","\u29CD":"trisb","\u29CE":"rtriltri","\u29CF":"LeftTriangleBar","\u29CF\u0338":"NotLeftTriangleBar","\u29D0":"RightTriangleBar","\u29D0\u0338":"NotRightTriangleBar","\u29DC":"iinfin","\u29DD":"infintie","\u29DE":"nvinfin","\u29E3":"eparsl","\u29E4":"smeparsl","\u29E5":"eqvparsl","\u29EB":"lozf","\u29F4":"RuleDelayed","\u29F6":"dsol","\u2A00":"xodot","\u2A01":"xoplus","\u2A02":"xotime","\u2A04":"xuplus","\u2A06":"xsqcup","\u2A0D":"fpartint","\u2A10":"cirfnint","\u2A11":"awint","\u2A12":"rppolint","\u2A13":"scpolint","\u2A14":"npolint","\u2A15":"pointint","\u2A16":"quatint","\u2A17":"intlarhk","\u2A22":"pluscir","\u2A23":"plusacir","\u2A24":"simplus","\u2A25":"plusdu","\u2A26":"plussim","\u2A27":"plustwo","\u2A29":"mcomma","\u2A2A":"minusdu","\u2A2D":"loplus","\u2A2E":"roplus","\u2A2F":"Cross","\u2A30":"timesd","\u2A31":"timesbar","\u2A33":"smashp","\u2A34":"lotimes","\u2A35":"rotimes","\u2A36":"otimesas","\u2A37":"Otimes","\u2A38":"odiv","\u2A39":"triplus","\u2A3A":"triminus","\u2A3B":"tritime","\u2A3C":"iprod","\u2A3F":"amalg","\u2A40":"capdot","\u2A42":"ncup","\u2A43":"ncap","\u2A44":"capand","\u2A45":"cupor","\u2A46":"cupcap","\u2A47":"capcup","\u2A48":"cupbrcap","\u2A49":"capbrcup","\u2A4A":"cupcup","\u2A4B":"capcap","\u2A4C":"ccups","\u2A4D":"ccaps","\u2A50":"ccupssm","\u2A53":"And","\u2A54":"Or","\u2A55":"andand","\u2A56":"oror","\u2A57":"orslope","\u2A58":"andslope","\u2A5A":"andv","\u2A5B":"orv","\u2A5C":"andd","\u2A5D":"ord","\u2A5F":"wedbar","\u2A66":"sdote","\u2A6A":"simdot","\u2A6D":"congdot","\u2A6D\u0338":"ncongdot","\u2A6E":"easter","\u2A6F":"apacir","\u2A70":"apE","\u2A70\u0338":"napE","\u2A71":"eplus","\u2A72":"pluse","\u2A73":"Esim","\u2A77":"eDDot","\u2A78":"equivDD","\u2A79":"ltcir","\u2A7A":"gtcir","\u2A7B":"ltquest","\u2A7C":"gtquest","\u2A7D":"les","\u2A7D\u0338":"nles","\u2A7E":"ges","\u2A7E\u0338":"nges","\u2A7F":"lesdot","\u2A80":"gesdot","\u2A81":"lesdoto","\u2A82":"gesdoto","\u2A83":"lesdotor","\u2A84":"gesdotol","\u2A85":"lap","\u2A86":"gap","\u2A87":"lne","\u2A88":"gne","\u2A89":"lnap","\u2A8A":"gnap","\u2A8B":"lEg","\u2A8C":"gEl","\u2A8D":"lsime","\u2A8E":"gsime","\u2A8F":"lsimg","\u2A90":"gsiml","\u2A91":"lgE","\u2A92":"glE","\u2A93":"lesges","\u2A94":"gesles","\u2A95":"els","\u2A96":"egs","\u2A97":"elsdot","\u2A98":"egsdot","\u2A99":"el","\u2A9A":"eg","\u2A9D":"siml","\u2A9E":"simg","\u2A9F":"simlE","\u2AA0":"simgE","\u2AA1":"LessLess","\u2AA1\u0338":"NotNestedLessLess","\u2AA2":"GreaterGreater","\u2AA2\u0338":"NotNestedGreaterGreater","\u2AA4":"glj","\u2AA5":"gla","\u2AA6":"ltcc","\u2AA7":"gtcc","\u2AA8":"lescc","\u2AA9":"gescc","\u2AAA":"smt","\u2AAB":"lat","\u2AAC":"smte","\u2AAC\uFE00":"smtes","\u2AAD":"late","\u2AAD\uFE00":"lates","\u2AAE":"bumpE","\u2AAF":"pre","\u2AAF\u0338":"npre","\u2AB0":"sce","\u2AB0\u0338":"nsce","\u2AB3":"prE","\u2AB4":"scE","\u2AB5":"prnE","\u2AB6":"scnE","\u2AB7":"prap","\u2AB8":"scap","\u2AB9":"prnap","\u2ABA":"scnap","\u2ABB":"Pr","\u2ABC":"Sc","\u2ABD":"subdot","\u2ABE":"supdot","\u2ABF":"subplus","\u2AC0":"supplus","\u2AC1":"submult","\u2AC2":"supmult","\u2AC3":"subedot","\u2AC4":"supedot","\u2AC5":"subE","\u2AC5\u0338":"nsubE","\u2AC6":"supE","\u2AC6\u0338":"nsupE","\u2AC7":"subsim","\u2AC8":"supsim","\u2ACB\uFE00":"vsubnE","\u2ACB":"subnE","\u2ACC\uFE00":"vsupnE","\u2ACC":"supnE","\u2ACF":"csub","\u2AD0":"csup","\u2AD1":"csube","\u2AD2":"csupe","\u2AD3":"subsup","\u2AD4":"supsub","\u2AD5":"subsub","\u2AD6":"supsup","\u2AD7":"suphsub","\u2AD8":"supdsub","\u2AD9":"forkv","\u2ADA":"topfork","\u2ADB":"mlcp","\u2AE4":"Dashv","\u2AE6":"Vdashl","\u2AE7":"Barv","\u2AE8":"vBar","\u2AE9":"vBarv","\u2AEB":"Vbar","\u2AEC":"Not","\u2AED":"bNot","\u2AEE":"rnmid","\u2AEF":"cirmid","\u2AF0":"midcir","\u2AF1":"topcir","\u2AF2":"nhpar","\u2AF3":"parsim","\u2AFD":"parsl","\u2AFD\u20E5":"nparsl","\u266D":"flat","\u266E":"natur","\u266F":"sharp","\xA4":"curren","\xA2":"cent",$:"dollar","\xA3":"pound","\xA5":"yen","\u20AC":"euro","\xB9":"sup1","\xBD":"half","\u2153":"frac13","\xBC":"frac14","\u2155":"frac15","\u2159":"frac16","\u215B":"frac18","\xB2":"sup2","\u2154":"frac23","\u2156":"frac25","\xB3":"sup3","\xBE":"frac34","\u2157":"frac35","\u215C":"frac38","\u2158":"frac45","\u215A":"frac56","\u215D":"frac58","\u215E":"frac78","\u{1D4B6}":"ascr","\u{1D552}":"aopf","\u{1D51E}":"afr","\u{1D538}":"Aopf","\u{1D504}":"Afr","\u{1D49C}":"Ascr",\u00AA:"ordf",\u00E1:"aacute",\u00C1:"Aacute",\u00E0:"agrave",\u00C0:"Agrave",\u0103:"abreve",\u0102:"Abreve",\u00E2:"acirc",\u00C2:"Acirc",\u00E5:"aring",\u00C5:"angst",\u00E4:"auml",\u00C4:"Auml",\u00E3:"atilde",\u00C3:"Atilde",\u0105:"aogon",\u0104:"Aogon",\u0101:"amacr",\u0100:"Amacr",\u00E6:"aelig",\u00C6:"AElig","\u{1D4B7}":"bscr","\u{1D553}":"bopf","\u{1D51F}":"bfr","\u{1D539}":"Bopf",\u212C:"Bscr","\u{1D505}":"Bfr","\u{1D520}":"cfr","\u{1D4B8}":"cscr","\u{1D554}":"copf",\u212D:"Cfr","\u{1D49E}":"Cscr",\u2102:"Copf",\u0107:"cacute",\u0106:"Cacute",\u0109:"ccirc",\u0108:"Ccirc",\u010D:"ccaron",\u010C:"Ccaron",\u010B:"cdot",\u010A:"Cdot",\u00E7:"ccedil",\u00C7:"Ccedil","\u2105":"incare","\u{1D521}":"dfr","\u2146":"dd","\u{1D555}":"dopf","\u{1D4B9}":"dscr","\u{1D49F}":"Dscr","\u{1D507}":"Dfr","\u2145":"DD","\u{1D53B}":"Dopf",\u010F:"dcaron",\u010E:"Dcaron",\u0111:"dstrok",\u0110:"Dstrok",\u00F0:"eth",\u00D0:"ETH","\u2147":"ee",\u212F:"escr","\u{1D522}":"efr","\u{1D556}":"eopf",\u2130:"Escr","\u{1D508}":"Efr","\u{1D53C}":"Eopf",\u00E9:"eacute",\u00C9:"Eacute",\u00E8:"egrave",\u00C8:"Egrave",\u00EA:"ecirc",\u00CA:"Ecirc",\u011B:"ecaron",\u011A:"Ecaron",\u00EB:"euml",\u00CB:"Euml",\u0117:"edot",\u0116:"Edot",\u0119:"eogon",\u0118:"Eogon",\u0113:"emacr",\u0112:"Emacr","\u{1D523}":"ffr","\u{1D557}":"fopf","\u{1D4BB}":"fscr","\u{1D509}":"Ffr","\u{1D53D}":"Fopf",\u2131:"Fscr",\uFB00:"fflig",\uFB03:"ffilig",\uFB04:"ffllig",\uFB01:"filig",fj:"fjlig",\uFB02:"fllig",\u0192:"fnof",\u210A:"gscr","\u{1D558}":"gopf","\u{1D524}":"gfr","\u{1D4A2}":"Gscr","\u{1D53E}":"Gopf","\u{1D50A}":"Gfr",\u01F5:"gacute",\u011F:"gbreve",\u011E:"Gbreve",\u011D:"gcirc",\u011C:"Gcirc",\u0121:"gdot",\u0120:"Gdot",\u0122:"Gcedil","\u{1D525}":"hfr",\u210E:"planckh","\u{1D4BD}":"hscr","\u{1D559}":"hopf",\u210B:"Hscr",\u210C:"Hfr",\u210D:"Hopf",\u0125:"hcirc",\u0124:"Hcirc",\u210F:"hbar",\u0127:"hstrok",\u0126:"Hstrok","\u{1D55A}":"iopf","\u{1D526}":"ifr","\u{1D4BE}":"iscr","\u2148":"ii","\u{1D540}":"Iopf",\u2110:"Iscr",\u2111:"Im",\u00ED:"iacute",\u00CD:"Iacute",\u00EC:"igrave",\u00CC:"Igrave",\u00EE:"icirc",\u00CE:"Icirc",\u00EF:"iuml",\u00CF:"Iuml",\u0129:"itilde",\u0128:"Itilde",\u0130:"Idot",\u012F:"iogon",\u012E:"Iogon",\u012B:"imacr",\u012A:"Imacr",\u0133:"ijlig",\u0132:"IJlig",\u0131:"imath","\u{1D4BF}":"jscr","\u{1D55B}":"jopf","\u{1D527}":"jfr","\u{1D4A5}":"Jscr","\u{1D50D}":"Jfr","\u{1D541}":"Jopf",\u0135:"jcirc",\u0134:"Jcirc","\u0237":"jmath","\u{1D55C}":"kopf","\u{1D4C0}":"kscr","\u{1D528}":"kfr","\u{1D4A6}":"Kscr","\u{1D542}":"Kopf","\u{1D50E}":"Kfr",\u0137:"kcedil",\u0136:"Kcedil","\u{1D529}":"lfr","\u{1D4C1}":"lscr",\u2113:"ell","\u{1D55D}":"lopf",\u2112:"Lscr","\u{1D50F}":"Lfr","\u{1D543}":"Lopf",\u013A:"lacute",\u0139:"Lacute",\u013E:"lcaron",\u013D:"Lcaron",\u013C:"lcedil",\u013B:"Lcedil",\u0142:"lstrok",\u0141:"Lstrok",\u0140:"lmidot",\u013F:"Lmidot","\u{1D52A}":"mfr","\u{1D55E}":"mopf","\u{1D4C2}":"mscr","\u{1D510}":"Mfr","\u{1D544}":"Mopf",\u2133:"Mscr","\u{1D52B}":"nfr","\u{1D55F}":"nopf","\u{1D4C3}":"nscr",\u2115:"Nopf","\u{1D4A9}":"Nscr","\u{1D511}":"Nfr",\u0144:"nacute",\u0143:"Nacute",\u0148:"ncaron",\u0147:"Ncaron",\u00F1:"ntilde",\u00D1:"Ntilde",\u0146:"ncedil",\u0145:"Ncedil","\u2116":"numero",\u014B:"eng",\u014A:"ENG","\u{1D560}":"oopf","\u{1D52C}":"ofr",\u2134:"oscr","\u{1D4AA}":"Oscr","\u{1D512}":"Ofr","\u{1D546}":"Oopf",\u00BA:"ordm",\u00F3:"oacute",\u00D3:"Oacute",\u00F2:"ograve",\u00D2:"Ograve",\u00F4:"ocirc",\u00D4:"Ocirc",\u00F6:"ouml",\u00D6:"Ouml",\u0151:"odblac",\u0150:"Odblac",\u00F5:"otilde",\u00D5:"Otilde",\u00F8:"oslash",\u00D8:"Oslash",\u014D:"omacr",\u014C:"Omacr",\u0153:"oelig",\u0152:"OElig","\u{1D52D}":"pfr","\u{1D4C5}":"pscr","\u{1D561}":"popf",\u2119:"Popf","\u{1D513}":"Pfr","\u{1D4AB}":"Pscr","\u{1D562}":"qopf","\u{1D52E}":"qfr","\u{1D4C6}":"qscr","\u{1D4AC}":"Qscr","\u{1D514}":"Qfr",\u211A:"Qopf",\u0138:"kgreen","\u{1D52F}":"rfr","\u{1D563}":"ropf","\u{1D4C7}":"rscr",\u211B:"Rscr",\u211C:"Re",\u211D:"Ropf",\u0155:"racute",\u0154:"Racute",\u0159:"rcaron",\u0158:"Rcaron",\u0157:"rcedil",\u0156:"Rcedil","\u{1D564}":"sopf","\u{1D4C8}":"sscr","\u{1D530}":"sfr","\u{1D54A}":"Sopf","\u{1D516}":"Sfr","\u{1D4AE}":"Sscr","\u24C8":"oS",\u015B:"sacute",\u015A:"Sacute",\u015D:"scirc",\u015C:"Scirc",\u0161:"scaron",\u0160:"Scaron",\u015F:"scedil",\u015E:"Scedil",\u00DF:"szlig","\u{1D531}":"tfr","\u{1D4C9}":"tscr","\u{1D565}":"topf","\u{1D4AF}":"Tscr","\u{1D517}":"Tfr","\u{1D54B}":"Topf",\u0165:"tcaron",\u0164:"Tcaron",\u0163:"tcedil",\u0162:"Tcedil","\u2122":"trade",\u0167:"tstrok",\u0166:"Tstrok","\u{1D4CA}":"uscr","\u{1D566}":"uopf","\u{1D532}":"ufr","\u{1D54C}":"Uopf","\u{1D518}":"Ufr","\u{1D4B0}":"Uscr",\u00FA:"uacute",\u00DA:"Uacute",\u00F9:"ugrave",\u00D9:"Ugrave",\u016D:"ubreve",\u016C:"Ubreve",\u00FB:"ucirc",\u00DB:"Ucirc",\u016F:"uring",\u016E:"Uring",\u00FC:"uuml",\u00DC:"Uuml",\u0171:"udblac",\u0170:"Udblac",\u0169:"utilde",\u0168:"Utilde",\u0173:"uogon",\u0172:"Uogon",\u016B:"umacr",\u016A:"Umacr","\u{1D533}":"vfr","\u{1D567}":"vopf","\u{1D4CB}":"vscr","\u{1D519}":"Vfr","\u{1D54D}":"Vopf","\u{1D4B1}":"Vscr","\u{1D568}":"wopf","\u{1D4CC}":"wscr","\u{1D534}":"wfr","\u{1D4B2}":"Wscr","\u{1D54E}":"Wopf","\u{1D51A}":"Wfr",\u0175:"wcirc",\u0174:"Wcirc","\u{1D535}":"xfr","\u{1D4CD}":"xscr","\u{1D569}":"xopf","\u{1D54F}":"Xopf","\u{1D51B}":"Xfr","\u{1D4B3}":"Xscr","\u{1D536}":"yfr","\u{1D4CE}":"yscr","\u{1D56A}":"yopf","\u{1D4B4}":"Yscr","\u{1D51C}":"Yfr","\u{1D550}":"Yopf",\u00FD:"yacute",\u00DD:"Yacute",\u0177:"ycirc",\u0176:"Ycirc",\u00FF:"yuml",\u0178:"Yuml","\u{1D4CF}":"zscr","\u{1D537}":"zfr","\u{1D56B}":"zopf",\u2128:"Zfr",\u2124:"Zopf","\u{1D4B5}":"Zscr",\u017A:"zacute",\u0179:"Zacute",\u017E:"zcaron",\u017D:"Zcaron",\u017C:"zdot",\u017B:"Zdot",\u01B5:"imped",\u00FE:"thorn",\u00DE:"THORN",\u0149:"napos",\u03B1:"alpha",\u0391:"Alpha",\u03B2:"beta",\u0392:"Beta",\u03B3:"gamma",\u0393:"Gamma",\u03B4:"delta",\u0394:"Delta",\u03B5:"epsi","\u03F5":"epsiv",\u0395:"Epsilon",\u03DD:"gammad",\u03DC:"Gammad",\u03B6:"zeta",\u0396:"Zeta",\u03B7:"eta",\u0397:"Eta",\u03B8:"theta",\u03D1:"thetav",\u0398:"Theta",\u03B9:"iota",\u0399:"Iota",\u03BA:"kappa",\u03F0:"kappav",\u039A:"Kappa",\u03BB:"lambda",\u039B:"Lambda",\u03BC:"mu",\u00B5:"micro",\u039C:"Mu",\u03BD:"nu",\u039D:"Nu",\u03BE:"xi",\u039E:"Xi",\u03BF:"omicron",\u039F:"Omicron",\u03C0:"pi",\u03D6:"piv",\u03A0:"Pi",\u03C1:"rho",\u03F1:"rhov",\u03A1:"Rho",\u03C3:"sigma",\u03A3:"Sigma",\u03C2:"sigmaf",\u03C4:"tau",\u03A4:"Tau",\u03C5:"upsi",\u03A5:"Upsilon",\u03D2:"Upsi",\u03C6:"phi",\u03D5:"phiv",\u03A6:"Phi",\u03C7:"chi",\u03A7:"Chi",\u03C8:"psi",\u03A8:"Psi",\u03C9:"omega",\u03A9:"ohm",\u0430:"acy",\u0410:"Acy",\u0431:"bcy",\u0411:"Bcy",\u0432:"vcy",\u0412:"Vcy",\u0433:"gcy",\u0413:"Gcy",\u0453:"gjcy",\u0403:"GJcy",\u0434:"dcy",\u0414:"Dcy",\u0452:"djcy",\u0402:"DJcy",\u0435:"iecy",\u0415:"IEcy",\u0451:"iocy",\u0401:"IOcy",\u0454:"jukcy",\u0404:"Jukcy",\u0436:"zhcy",\u0416:"ZHcy",\u0437:"zcy",\u0417:"Zcy",\u0455:"dscy",\u0405:"DScy",\u0438:"icy",\u0418:"Icy",\u0456:"iukcy",\u0406:"Iukcy",\u0457:"yicy",\u0407:"YIcy",\u0439:"jcy",\u0419:"Jcy",\u0458:"jsercy",\u0408:"Jsercy",\u043A:"kcy",\u041A:"Kcy",\u045C:"kjcy",\u040C:"KJcy",\u043B:"lcy",\u041B:"Lcy",\u0459:"ljcy",\u0409:"LJcy",\u043C:"mcy",\u041C:"Mcy",\u043D:"ncy",\u041D:"Ncy",\u045A:"njcy",\u040A:"NJcy",\u043E:"ocy",\u041E:"Ocy",\u043F:"pcy",\u041F:"Pcy",\u0440:"rcy",\u0420:"Rcy",\u0441:"scy",\u0421:"Scy",\u0442:"tcy",\u0422:"Tcy",\u045B:"tshcy",\u040B:"TSHcy",\u0443:"ucy",\u0423:"Ucy",\u045E:"ubrcy",\u040E:"Ubrcy",\u0444:"fcy",\u0424:"Fcy",\u0445:"khcy",\u0425:"KHcy",\u0446:"tscy",\u0426:"TScy",\u0447:"chcy",\u0427:"CHcy",\u045F:"dzcy",\u040F:"DZcy",\u0448:"shcy",\u0428:"SHcy",\u0449:"shchcy",\u0429:"SHCHcy",\u044A:"hardcy",\u042A:"HARDcy",\u044B:"ycy",\u042B:"Ycy",\u044C:"softcy",\u042C:"SOFTcy",\u044D:"ecy",\u042D:"Ecy",\u044E:"yucy",\u042E:"YUcy",\u044F:"yacy",\u042F:"YAcy",\u2135:"aleph",\u2136:"beth",\u2137:"gimel",\u2138:"daleth"},l=/["&'<>`]/g,h={'"':""","&":"&","'":"'","<":"<",">":">","`":"`"},f=/&#(?:[xX][^a-fA-F0-9]|[^0-9xX])/,u=/[\0-\x08\x0B\x0E-\x1F\x7F-\x9F\uFDD0-\uFDEF\uFFFE\uFFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDFFE\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,d=/&(CounterClockwiseContourIntegral|DoubleLongLeftRightArrow|ClockwiseContourIntegral|NotNestedGreaterGreater|NotSquareSupersetEqual|DiacriticalDoubleAcute|NotRightTriangleEqual|NotSucceedsSlantEqual|NotPrecedesSlantEqual|CloseCurlyDoubleQuote|NegativeVeryThinSpace|DoubleContourIntegral|FilledVerySmallSquare|CapitalDifferentialD|OpenCurlyDoubleQuote|EmptyVerySmallSquare|NestedGreaterGreater|DoubleLongRightArrow|NotLeftTriangleEqual|NotGreaterSlantEqual|ReverseUpEquilibrium|DoubleLeftRightArrow|NotSquareSubsetEqual|NotDoubleVerticalBar|RightArrowLeftArrow|NotGreaterFullEqual|NotRightTriangleBar|SquareSupersetEqual|DownLeftRightVector|DoubleLongLeftArrow|leftrightsquigarrow|LeftArrowRightArrow|NegativeMediumSpace|blacktriangleright|RightDownVectorBar|PrecedesSlantEqual|RightDoubleBracket|SucceedsSlantEqual|NotLeftTriangleBar|RightTriangleEqual|SquareIntersection|RightDownTeeVector|ReverseEquilibrium|NegativeThickSpace|longleftrightarrow|Longleftrightarrow|LongLeftRightArrow|DownRightTeeVector|DownRightVectorBar|GreaterSlantEqual|SquareSubsetEqual|LeftDownVectorBar|LeftDoubleBracket|VerticalSeparator|rightleftharpoons|NotGreaterGreater|NotSquareSuperset|blacktriangleleft|blacktriangledown|NegativeThinSpace|LeftDownTeeVector|NotLessSlantEqual|leftrightharpoons|DoubleUpDownArrow|DoubleVerticalBar|LeftTriangleEqual|FilledSmallSquare|twoheadrightarrow|NotNestedLessLess|DownLeftTeeVector|DownLeftVectorBar|RightAngleBracket|NotTildeFullEqual|NotReverseElement|RightUpDownVector|DiacriticalTilde|NotSucceedsTilde|circlearrowright|NotPrecedesEqual|rightharpoondown|DoubleRightArrow|NotSucceedsEqual|NonBreakingSpace|NotRightTriangle|LessEqualGreater|RightUpTeeVector|LeftAngleBracket|GreaterFullEqual|DownArrowUpArrow|RightUpVectorBar|twoheadleftarrow|GreaterEqualLess|downharpoonright|RightTriangleBar|ntrianglerighteq|NotSupersetEqual|LeftUpDownVector|DiacriticalAcute|rightrightarrows|vartriangleright|UpArrowDownArrow|DiacriticalGrave|UnderParenthesis|EmptySmallSquare|LeftUpVectorBar|leftrightarrows|DownRightVector|downharpoonleft|trianglerighteq|ShortRightArrow|OverParenthesis|DoubleLeftArrow|DoubleDownArrow|NotSquareSubset|bigtriangledown|ntrianglelefteq|UpperRightArrow|curvearrowright|vartriangleleft|NotLeftTriangle|nleftrightarrow|LowerRightArrow|NotHumpDownHump|NotGreaterTilde|rightthreetimes|LeftUpTeeVector|NotGreaterEqual|straightepsilon|LeftTriangleBar|rightsquigarrow|ContourIntegral|rightleftarrows|CloseCurlyQuote|RightDownVector|LeftRightVector|nLeftrightarrow|leftharpoondown|circlearrowleft|SquareSuperset|OpenCurlyQuote|hookrightarrow|HorizontalLine|DiacriticalDot|NotLessGreater|ntriangleright|DoubleRightTee|InvisibleComma|InvisibleTimes|LowerLeftArrow|DownLeftVector|NotSubsetEqual|curvearrowleft|trianglelefteq|NotVerticalBar|TildeFullEqual|downdownarrows|NotGreaterLess|RightTeeVector|ZeroWidthSpace|looparrowright|LongRightArrow|doublebarwedge|ShortLeftArrow|ShortDownArrow|RightVectorBar|GreaterGreater|ReverseElement|rightharpoonup|LessSlantEqual|leftthreetimes|upharpoonright|rightarrowtail|LeftDownVector|Longrightarrow|NestedLessLess|UpperLeftArrow|nshortparallel|leftleftarrows|leftrightarrow|Leftrightarrow|LeftRightArrow|longrightarrow|upharpoonleft|RightArrowBar|ApplyFunction|LeftTeeVector|leftarrowtail|NotEqualTilde|varsubsetneqq|varsupsetneqq|RightTeeArrow|SucceedsEqual|SucceedsTilde|LeftVectorBar|SupersetEqual|hookleftarrow|DifferentialD|VerticalTilde|VeryThinSpace|blacktriangle|bigtriangleup|LessFullEqual|divideontimes|leftharpoonup|UpEquilibrium|ntriangleleft|RightTriangle|measuredangle|shortparallel|longleftarrow|Longleftarrow|LongLeftArrow|DoubleLeftTee|Poincareplane|PrecedesEqual|triangleright|DoubleUpArrow|RightUpVector|fallingdotseq|looparrowleft|PrecedesTilde|NotTildeEqual|NotTildeTilde|smallsetminus|Proportional|triangleleft|triangledown|UnderBracket|NotHumpEqual|exponentiale|ExponentialE|NotLessTilde|HilbertSpace|RightCeiling|blacklozenge|varsupsetneq|HumpDownHump|GreaterEqual|VerticalLine|LeftTeeArrow|NotLessEqual|DownTeeArrow|LeftTriangle|varsubsetneq|Intersection|NotCongruent|DownArrowBar|LeftUpVector|LeftArrowBar|risingdotseq|GreaterTilde|RoundImplies|SquareSubset|ShortUpArrow|NotSuperset|quaternions|precnapprox|backepsilon|preccurlyeq|OverBracket|blacksquare|MediumSpace|VerticalBar|circledcirc|circleddash|CircleMinus|CircleTimes|LessGreater|curlyeqprec|curlyeqsucc|diamondsuit|UpDownArrow|Updownarrow|RuleDelayed|Rrightarrow|updownarrow|RightVector|nRightarrow|nrightarrow|eqslantless|LeftCeiling|Equilibrium|SmallCircle|expectation|NotSucceeds|thickapprox|GreaterLess|SquareUnion|NotPrecedes|NotLessLess|straightphi|succnapprox|succcurlyeq|SubsetEqual|sqsupseteq|Proportion|Laplacetrf|ImaginaryI|supsetneqq|NotGreater|gtreqqless|NotElement|ThickSpace|TildeEqual|TildeTilde|Fouriertrf|rmoustache|EqualTilde|eqslantgtr|UnderBrace|LeftVector|UpArrowBar|nLeftarrow|nsubseteqq|subsetneqq|nsupseteqq|nleftarrow|succapprox|lessapprox|UpTeeArrow|upuparrows|curlywedge|lesseqqgtr|varepsilon|varnothing|RightFloor|complement|CirclePlus|sqsubseteq|Lleftarrow|circledast|RightArrow|Rightarrow|rightarrow|lmoustache|Bernoullis|precapprox|mapstoleft|mapstodown|longmapsto|dotsquare|downarrow|DoubleDot|nsubseteq|supsetneq|leftarrow|nsupseteq|subsetneq|ThinSpace|ngeqslant|subseteqq|HumpEqual|NotSubset|triangleq|NotCupCap|lesseqgtr|heartsuit|TripleDot|Leftarrow|Coproduct|Congruent|varpropto|complexes|gvertneqq|LeftArrow|LessTilde|supseteqq|MinusPlus|CircleDot|nleqslant|NotExists|gtreqless|nparallel|UnionPlus|LeftFloor|checkmark|CenterDot|centerdot|Mellintrf|gtrapprox|bigotimes|OverBrace|spadesuit|therefore|pitchfork|rationals|PlusMinus|Backslash|Therefore|DownBreve|backsimeq|backprime|DownArrow|nshortmid|Downarrow|lvertneqq|eqvparsl|imagline|imagpart|infintie|integers|Integral|intercal|LessLess|Uarrocir|intlarhk|sqsupset|angmsdaf|sqsubset|llcorner|vartheta|cupbrcap|lnapprox|Superset|SuchThat|succnsim|succneqq|angmsdag|biguplus|curlyvee|trpezium|Succeeds|NotTilde|bigwedge|angmsdah|angrtvbd|triminus|cwconint|fpartint|lrcorner|smeparsl|subseteq|urcorner|lurdshar|laemptyv|DDotrahd|approxeq|ldrushar|awconint|mapstoup|backcong|shortmid|triangle|geqslant|gesdotol|timesbar|circledR|circledS|setminus|multimap|naturals|scpolint|ncongdot|RightTee|boxminus|gnapprox|boxtimes|andslope|thicksim|angmsdaa|varsigma|cirfnint|rtriltri|angmsdab|rppolint|angmsdac|barwedge|drbkarow|clubsuit|thetasym|bsolhsub|capbrcup|dzigrarr|doteqdot|DotEqual|dotminus|UnderBar|NotEqual|realpart|otimesas|ulcorner|hksearow|hkswarow|parallel|PartialD|elinters|emptyset|plusacir|bbrktbrk|angmsdad|pointint|bigoplus|angmsdae|Precedes|bigsqcup|varkappa|notindot|supseteq|precneqq|precnsim|profalar|profline|profsurf|leqslant|lesdotor|raemptyv|subplus|notnivb|notnivc|subrarr|zigrarr|vzigzag|submult|subedot|Element|between|cirscir|larrbfs|larrsim|lotimes|lbrksld|lbrkslu|lozenge|ldrdhar|dbkarow|bigcirc|epsilon|simrarr|simplus|ltquest|Epsilon|luruhar|gtquest|maltese|npolint|eqcolon|npreceq|bigodot|ddagger|gtrless|bnequiv|harrcir|ddotseq|equivDD|backsim|demptyv|nsqsube|nsqsupe|Upsilon|nsubset|upsilon|minusdu|nsucceq|swarrow|nsupset|coloneq|searrow|boxplus|napprox|natural|asympeq|alefsym|congdot|nearrow|bigstar|diamond|supplus|tritime|LeftTee|nvinfin|triplus|NewLine|nvltrie|nvrtrie|nwarrow|nexists|Diamond|ruluhar|Implies|supmult|angzarr|suplarr|suphsub|questeq|because|digamma|Because|olcross|bemptyv|omicron|Omicron|rotimes|NoBreak|intprod|angrtvb|orderof|uwangle|suphsol|lesdoto|orslope|DownTee|realine|cudarrl|rdldhar|OverBar|supedot|lessdot|supdsub|topfork|succsim|rbrkslu|rbrksld|pertenk|cudarrr|isindot|planckh|lessgtr|pluscir|gesdoto|plussim|plustwo|lesssim|cularrp|rarrsim|Cayleys|notinva|notinvb|notinvc|UpArrow|Uparrow|uparrow|NotLess|dwangle|precsim|Product|curarrm|Cconint|dotplus|rarrbfs|ccupssm|Cedilla|cemptyv|notniva|quatint|frac35|frac38|frac45|frac56|frac58|frac78|tridot|xoplus|gacute|gammad|Gammad|lfisht|lfloor|bigcup|sqsupe|gbreve|Gbreve|lharul|sqsube|sqcups|Gcedil|apacir|llhard|lmidot|Lmidot|lmoust|andand|sqcaps|approx|Abreve|spades|circeq|tprime|divide|topcir|Assign|topbot|gesdot|divonx|xuplus|timesd|gesles|atilde|solbar|SOFTcy|loplus|timesb|lowast|lowbar|dlcorn|dlcrop|softcy|dollar|lparlt|thksim|lrhard|Atilde|lsaquo|smashp|bigvee|thinsp|wreath|bkarow|lsquor|lstrok|Lstrok|lthree|ltimes|ltlarr|DotDot|simdot|ltrPar|weierp|xsqcup|angmsd|sigmav|sigmaf|zeetrf|Zcaron|zcaron|mapsto|vsupne|thetav|cirmid|marker|mcomma|Zacute|vsubnE|there4|gtlPar|vsubne|bottom|gtrarr|SHCHcy|shchcy|midast|midcir|middot|minusb|minusd|gtrdot|bowtie|sfrown|mnplus|models|colone|seswar|Colone|mstpos|searhk|gtrsim|nacute|Nacute|boxbox|telrec|hairsp|Tcedil|nbumpe|scnsim|ncaron|Ncaron|ncedil|Ncedil|hamilt|Scedil|nearhk|hardcy|HARDcy|tcedil|Tcaron|commat|nequiv|nesear|tcaron|target|hearts|nexist|varrho|scedil|Scaron|scaron|hellip|Sacute|sacute|hercon|swnwar|compfn|rtimes|rthree|rsquor|rsaquo|zacute|wedgeq|homtht|barvee|barwed|Barwed|rpargt|horbar|conint|swarhk|roplus|nltrie|hslash|hstrok|Hstrok|rmoust|Conint|bprime|hybull|hyphen|iacute|Iacute|supsup|supsub|supsim|varphi|coprod|brvbar|agrave|Supset|supset|igrave|Igrave|notinE|Agrave|iiiint|iinfin|copysr|wedbar|Verbar|vangrt|becaus|incare|verbar|inodot|bullet|drcorn|intcal|drcrop|cularr|vellip|Utilde|bumpeq|cupcap|dstrok|Dstrok|CupCap|cupcup|cupdot|eacute|Eacute|supdot|iquest|easter|ecaron|Ecaron|ecolon|isinsv|utilde|itilde|Itilde|curarr|succeq|Bumpeq|cacute|ulcrop|nparsl|Cacute|nprcue|egrave|Egrave|nrarrc|nrarrw|subsup|subsub|nrtrie|jsercy|nsccue|Jsercy|kappav|kcedil|Kcedil|subsim|ulcorn|nsimeq|egsdot|veebar|kgreen|capand|elsdot|Subset|subset|curren|aacute|lacute|Lacute|emptyv|ntilde|Ntilde|lagran|lambda|Lambda|capcap|Ugrave|langle|subdot|emsp13|numero|emsp14|nvdash|nvDash|nVdash|nVDash|ugrave|ufisht|nvHarr|larrfs|nvlArr|larrhk|larrlp|larrpl|nvrArr|Udblac|nwarhk|larrtl|nwnear|oacute|Oacute|latail|lAtail|sstarf|lbrace|odblac|Odblac|lbrack|udblac|odsold|eparsl|lcaron|Lcaron|ograve|Ograve|lcedil|Lcedil|Aacute|ssmile|ssetmn|squarf|ldquor|capcup|ominus|cylcty|rharul|eqcirc|dagger|rfloor|rfisht|Dagger|daleth|equals|origof|capdot|equest|dcaron|Dcaron|rdquor|oslash|Oslash|otilde|Otilde|otimes|Otimes|urcrop|Ubreve|ubreve|Yacute|Uacute|uacute|Rcedil|rcedil|urcorn|parsim|Rcaron|Vdashl|rcaron|Tstrok|percnt|period|permil|Exists|yacute|rbrack|rbrace|phmmat|ccaron|Ccaron|planck|ccedil|plankv|tstrok|female|plusdo|plusdu|ffilig|plusmn|ffllig|Ccedil|rAtail|dfisht|bernou|ratail|Rarrtl|rarrtl|angsph|rarrpl|rarrlp|rarrhk|xwedge|xotime|forall|ForAll|Vvdash|vsupnE|preceq|bigcap|frac12|frac13|frac14|primes|rarrfs|prnsim|frac15|Square|frac16|square|lesdot|frac18|frac23|propto|prurel|rarrap|rangle|puncsp|frac25|Racute|qprime|racute|lesges|frac34|abreve|AElig|eqsim|utdot|setmn|urtri|Equal|Uring|seArr|uring|searr|dashv|Dashv|mumap|nabla|iogon|Iogon|sdote|sdotb|scsim|napid|napos|equiv|natur|Acirc|dblac|erarr|nbump|iprod|erDot|ucirc|awint|esdot|angrt|ncong|isinE|scnap|Scirc|scirc|ndash|isins|Ubrcy|nearr|neArr|isinv|nedot|ubrcy|acute|Ycirc|iukcy|Iukcy|xutri|nesim|caret|jcirc|Jcirc|caron|twixt|ddarr|sccue|exist|jmath|sbquo|ngeqq|angst|ccaps|lceil|ngsim|UpTee|delta|Delta|rtrif|nharr|nhArr|nhpar|rtrie|jukcy|Jukcy|kappa|rsquo|Kappa|nlarr|nlArr|TSHcy|rrarr|aogon|Aogon|fflig|xrarr|tshcy|ccirc|nleqq|filig|upsih|nless|dharl|nlsim|fjlig|ropar|nltri|dharr|robrk|roarr|fllig|fltns|roang|rnmid|subnE|subne|lAarr|trisb|Ccirc|acirc|ccups|blank|VDash|forkv|Vdash|langd|cedil|blk12|blk14|laquo|strns|diams|notin|vDash|larrb|blk34|block|disin|uplus|vdash|vBarv|aelig|starf|Wedge|check|xrArr|lates|lbarr|lBarr|notni|lbbrk|bcong|frasl|lbrke|frown|vrtri|vprop|vnsup|gamma|Gamma|wedge|xodot|bdquo|srarr|doteq|ldquo|boxdl|boxdL|gcirc|Gcirc|boxDl|boxDL|boxdr|boxdR|boxDr|TRADE|trade|rlhar|boxDR|vnsub|npart|vltri|rlarr|boxhd|boxhD|nprec|gescc|nrarr|nrArr|boxHd|boxHD|boxhu|boxhU|nrtri|boxHu|clubs|boxHU|times|colon|Colon|gimel|xlArr|Tilde|nsime|tilde|nsmid|nspar|THORN|thorn|xlarr|nsube|nsubE|thkap|xhArr|comma|nsucc|boxul|boxuL|nsupe|nsupE|gneqq|gnsim|boxUl|boxUL|grave|boxur|boxuR|boxUr|boxUR|lescc|angle|bepsi|boxvh|varpi|boxvH|numsp|Theta|gsime|gsiml|theta|boxVh|boxVH|boxvl|gtcir|gtdot|boxvL|boxVl|boxVL|crarr|cross|Cross|nvsim|boxvr|nwarr|nwArr|sqsup|dtdot|Uogon|lhard|lharu|dtrif|ocirc|Ocirc|lhblk|duarr|odash|sqsub|Hacek|sqcup|llarr|duhar|oelig|OElig|ofcir|boxvR|uogon|lltri|boxVr|csube|uuarr|ohbar|csupe|ctdot|olarr|olcir|harrw|oline|sqcap|omacr|Omacr|omega|Omega|boxVR|aleph|lneqq|lnsim|loang|loarr|rharu|lobrk|hcirc|operp|oplus|rhard|Hcirc|orarr|Union|order|ecirc|Ecirc|cuepr|szlig|cuesc|breve|reals|eDDot|Breve|hoarr|lopar|utrif|rdquo|Umacr|umacr|efDot|swArr|ultri|alpha|rceil|ovbar|swarr|Wcirc|wcirc|smtes|smile|bsemi|lrarr|aring|parsl|lrhar|bsime|uhblk|lrtri|cupor|Aring|uharr|uharl|slarr|rbrke|bsolb|lsime|rbbrk|RBarr|lsimg|phone|rBarr|rbarr|icirc|lsquo|Icirc|emacr|Emacr|ratio|simne|plusb|simlE|simgE|simeq|pluse|ltcir|ltdot|empty|xharr|xdtri|iexcl|Alpha|ltrie|rarrw|pound|ltrif|xcirc|bumpe|prcue|bumpE|asymp|amacr|cuvee|Sigma|sigma|iiint|udhar|iiota|ijlig|IJlig|supnE|imacr|Imacr|prime|Prime|image|prnap|eogon|Eogon|rarrc|mdash|mDDot|cuwed|imath|supne|imped|Amacr|udarr|prsim|micro|rarrb|cwint|raquo|infin|eplus|range|rangd|Ucirc|radic|minus|amalg|veeeq|rAarr|epsiv|ycirc|quest|sharp|quot|zwnj|Qscr|race|qscr|Qopf|qopf|qint|rang|Rang|Zscr|zscr|Zopf|zopf|rarr|rArr|Rarr|Pscr|pscr|prop|prod|prnE|prec|ZHcy|zhcy|prap|Zeta|zeta|Popf|popf|Zdot|plus|zdot|Yuml|yuml|phiv|YUcy|yucy|Yscr|yscr|perp|Yopf|yopf|part|para|YIcy|Ouml|rcub|yicy|YAcy|rdca|ouml|osol|Oscr|rdsh|yacy|real|oscr|xvee|andd|rect|andv|Xscr|oror|ordm|ordf|xscr|ange|aopf|Aopf|rHar|Xopf|opar|Oopf|xopf|xnis|rhov|oopf|omid|xmap|oint|apid|apos|ogon|ascr|Ascr|odot|odiv|xcup|xcap|ocir|oast|nvlt|nvle|nvgt|nvge|nvap|Wscr|wscr|auml|ntlg|ntgl|nsup|nsub|nsim|Nscr|nscr|nsce|Wopf|ring|npre|wopf|npar|Auml|Barv|bbrk|Nopf|nopf|nmid|nLtv|beta|ropf|Ropf|Beta|beth|nles|rpar|nleq|bnot|bNot|nldr|NJcy|rscr|Rscr|Vscr|vscr|rsqb|njcy|bopf|nisd|Bopf|rtri|Vopf|nGtv|ngtr|vopf|boxh|boxH|boxv|nges|ngeq|boxV|bscr|scap|Bscr|bsim|Vert|vert|bsol|bull|bump|caps|cdot|ncup|scnE|ncap|nbsp|napE|Cdot|cent|sdot|Vbar|nang|vBar|chcy|Mscr|mscr|sect|semi|CHcy|Mopf|mopf|sext|circ|cire|mldr|mlcp|cirE|comp|shcy|SHcy|vArr|varr|cong|copf|Copf|copy|COPY|malt|male|macr|lvnE|cscr|ltri|sime|ltcc|simg|Cscr|siml|csub|Uuml|lsqb|lsim|uuml|csup|Lscr|lscr|utri|smid|lpar|cups|smte|lozf|darr|Lopf|Uscr|solb|lopf|sopf|Sopf|lneq|uscr|spar|dArr|lnap|Darr|dash|Sqrt|LJcy|ljcy|lHar|dHar|Upsi|upsi|diam|lesg|djcy|DJcy|leqq|dopf|Dopf|dscr|Dscr|dscy|ldsh|ldca|squf|DScy|sscr|Sscr|dsol|lcub|late|star|Star|Uopf|Larr|lArr|larr|uopf|dtri|dzcy|sube|subE|Lang|lang|Kscr|kscr|Kopf|kopf|KJcy|kjcy|KHcy|khcy|DZcy|ecir|edot|eDot|Jscr|jscr|succ|Jopf|jopf|Edot|uHar|emsp|ensp|Iuml|iuml|eopf|isin|Iscr|iscr|Eopf|epar|sung|epsi|escr|sup1|sup2|sup3|Iota|iota|supe|supE|Iopf|iopf|IOcy|iocy|Escr|esim|Esim|imof|Uarr|QUOT|uArr|uarr|euml|IEcy|iecy|Idot|Euml|euro|excl|Hscr|hscr|Hopf|hopf|TScy|tscy|Tscr|hbar|tscr|flat|tbrk|fnof|hArr|harr|half|fopf|Fopf|tdot|gvnE|fork|trie|gtcc|fscr|Fscr|gdot|gsim|Gscr|gscr|Gopf|gopf|gneq|Gdot|tosa|gnap|Topf|topf|geqq|toea|GJcy|gjcy|tint|gesl|mid|Sfr|ggg|top|ges|gla|glE|glj|geq|gne|gEl|gel|gnE|Gcy|gcy|gap|Tfr|tfr|Tcy|tcy|Hat|Tau|Ffr|tau|Tab|hfr|Hfr|ffr|Fcy|fcy|icy|Icy|iff|ETH|eth|ifr|Ifr|Eta|eta|int|Int|Sup|sup|ucy|Ucy|Sum|sum|jcy|ENG|ufr|Ufr|eng|Jcy|jfr|els|ell|egs|Efr|efr|Jfr|uml|kcy|Kcy|Ecy|ecy|kfr|Kfr|lap|Sub|sub|lat|lcy|Lcy|leg|Dot|dot|lEg|leq|les|squ|div|die|lfr|Lfr|lgE|Dfr|dfr|Del|deg|Dcy|dcy|lne|lnE|sol|loz|smt|Cup|lrm|cup|lsh|Lsh|sim|shy|map|Map|mcy|Mcy|mfr|Mfr|mho|gfr|Gfr|sfr|cir|Chi|chi|nap|Cfr|vcy|Vcy|cfr|Scy|scy|ncy|Ncy|vee|Vee|Cap|cap|nfr|scE|sce|Nfr|nge|ngE|nGg|vfr|Vfr|ngt|bot|nGt|nis|niv|Rsh|rsh|nle|nlE|bne|Bfr|bfr|nLl|nlt|nLt|Bcy|bcy|not|Not|rlm|wfr|Wfr|npr|nsc|num|ocy|ast|Ocy|ofr|xfr|Xfr|Ofr|ogt|ohm|apE|olt|Rho|ape|rho|Rfr|rfr|ord|REG|ang|reg|orv|And|and|AMP|Rcy|amp|Afr|ycy|Ycy|yen|yfr|Yfr|rcy|par|pcy|Pcy|pfr|Pfr|phi|Phi|afr|Acy|acy|zcy|Zcy|piv|acE|acd|zfr|Zfr|pre|prE|psi|Psi|qfr|Qfr|zwj|Or|ge|Gg|gt|gg|el|oS|lt|Lt|LT|Re|lg|gl|eg|ne|Im|it|le|DD|wp|wr|nu|Nu|dd|lE|Sc|sc|pi|Pi|ee|af|ll|Ll|rx|gE|xi|pm|Xi|ic|pr|Pr|in|ni|mp|mu|ac|Mu|or|ap|Gt|GT|ii);|&(Aacute|Agrave|Atilde|Ccedil|Eacute|Egrave|Iacute|Igrave|Ntilde|Oacute|Ograve|Oslash|Otilde|Uacute|Ugrave|Yacute|aacute|agrave|atilde|brvbar|ccedil|curren|divide|eacute|egrave|frac12|frac14|frac34|iacute|igrave|iquest|middot|ntilde|oacute|ograve|oslash|otilde|plusmn|uacute|ugrave|yacute|AElig|Acirc|Aring|Ecirc|Icirc|Ocirc|THORN|Ucirc|acirc|acute|aelig|aring|cedil|ecirc|icirc|iexcl|laquo|micro|ocirc|pound|raquo|szlig|thorn|times|ucirc|Auml|COPY|Euml|Iuml|Ouml|QUOT|Uuml|auml|cent|copy|euml|iuml|macr|nbsp|ordf|ordm|ouml|para|quot|sect|sup1|sup2|sup3|uuml|yuml|AMP|ETH|REG|amp|deg|eth|not|reg|shy|uml|yen|GT|LT|gt|lt)(?!;)([=a-zA-Z0-9]?)|&#([0-9]+)(;?)|&#[xX]([a-fA-F0-9]+)(;?)|&([0-9a-zA-Z]+)/g,p={aacute:"\xE1",Aacute:"\xC1",abreve:"\u0103",Abreve:"\u0102",ac:"\u223E",acd:"\u223F",acE:"\u223E\u0333",acirc:"\xE2",Acirc:"\xC2",acute:"\xB4",acy:"\u0430",Acy:"\u0410",aelig:"\xE6",AElig:"\xC6",af:"\u2061",afr:"\u{1D51E}",Afr:"\u{1D504}",agrave:"\xE0",Agrave:"\xC0",alefsym:"\u2135",aleph:"\u2135",alpha:"\u03B1",Alpha:"\u0391",amacr:"\u0101",Amacr:"\u0100",amalg:"\u2A3F",amp:"&",AMP:"&",and:"\u2227",And:"\u2A53",andand:"\u2A55",andd:"\u2A5C",andslope:"\u2A58",andv:"\u2A5A",ang:"\u2220",ange:"\u29A4",angle:"\u2220",angmsd:"\u2221",angmsdaa:"\u29A8",angmsdab:"\u29A9",angmsdac:"\u29AA",angmsdad:"\u29AB",angmsdae:"\u29AC",angmsdaf:"\u29AD",angmsdag:"\u29AE",angmsdah:"\u29AF",angrt:"\u221F",angrtvb:"\u22BE",angrtvbd:"\u299D",angsph:"\u2222",angst:"\xC5",angzarr:"\u237C",aogon:"\u0105",Aogon:"\u0104",aopf:"\u{1D552}",Aopf:"\u{1D538}",ap:"\u2248",apacir:"\u2A6F",ape:"\u224A",apE:"\u2A70",apid:"\u224B",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224A",aring:"\xE5",Aring:"\xC5",ascr:"\u{1D4B6}",Ascr:"\u{1D49C}",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224D",atilde:"\xE3",Atilde:"\xC3",auml:"\xE4",Auml:"\xC4",awconint:"\u2233",awint:"\u2A11",backcong:"\u224C",backepsilon:"\u03F6",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",Backslash:"\u2216",Barv:"\u2AE7",barvee:"\u22BD",barwed:"\u2305",Barwed:"\u2306",barwedge:"\u2305",bbrk:"\u23B5",bbrktbrk:"\u23B6",bcong:"\u224C",bcy:"\u0431",Bcy:"\u0411",bdquo:"\u201E",becaus:"\u2235",because:"\u2235",Because:"\u2235",bemptyv:"\u29B0",bepsi:"\u03F6",bernou:"\u212C",Bernoullis:"\u212C",beta:"\u03B2",Beta:"\u0392",beth:"\u2136",between:"\u226C",bfr:"\u{1D51F}",Bfr:"\u{1D505}",bigcap:"\u22C2",bigcirc:"\u25EF",bigcup:"\u22C3",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",bigvee:"\u22C1",bigwedge:"\u22C0",bkarow:"\u290D",blacklozenge:"\u29EB",blacksquare:"\u25AA",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",blacktriangleright:"\u25B8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20E5",bnequiv:"\u2261\u20E5",bnot:"\u2310",bNot:"\u2AED",bopf:"\u{1D553}",Bopf:"\u{1D539}",bot:"\u22A5",bottom:"\u22A5",bowtie:"\u22C8",boxbox:"\u29C9",boxdl:"\u2510",boxdL:"\u2555",boxDl:"\u2556",boxDL:"\u2557",boxdr:"\u250C",boxdR:"\u2552",boxDr:"\u2553",boxDR:"\u2554",boxh:"\u2500",boxH:"\u2550",boxhd:"\u252C",boxhD:"\u2565",boxHd:"\u2564",boxHD:"\u2566",boxhu:"\u2534",boxhU:"\u2568",boxHu:"\u2567",boxHU:"\u2569",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",boxul:"\u2518",boxuL:"\u255B",boxUl:"\u255C",boxUL:"\u255D",boxur:"\u2514",boxuR:"\u2558",boxUr:"\u2559",boxUR:"\u255A",boxv:"\u2502",boxV:"\u2551",boxvh:"\u253C",boxvH:"\u256A",boxVh:"\u256B",boxVH:"\u256C",boxvl:"\u2524",boxvL:"\u2561",boxVl:"\u2562",boxVL:"\u2563",boxvr:"\u251C",boxvR:"\u255E",boxVr:"\u255F",boxVR:"\u2560",bprime:"\u2035",breve:"\u02D8",Breve:"\u02D8",brvbar:"\xA6",bscr:"\u{1D4B7}",Bscr:"\u212C",bsemi:"\u204F",bsim:"\u223D",bsime:"\u22CD",bsol:"\\",bsolb:"\u29C5",bsolhsub:"\u27C8",bull:"\u2022",bullet:"\u2022",bump:"\u224E",bumpe:"\u224F",bumpE:"\u2AAE",bumpeq:"\u224F",Bumpeq:"\u224E",cacute:"\u0107",Cacute:"\u0106",cap:"\u2229",Cap:"\u22D2",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",capcup:"\u2A47",capdot:"\u2A40",CapitalDifferentialD:"\u2145",caps:"\u2229\uFE00",caret:"\u2041",caron:"\u02C7",Cayleys:"\u212D",ccaps:"\u2A4D",ccaron:"\u010D",Ccaron:"\u010C",ccedil:"\xE7",Ccedil:"\xC7",ccirc:"\u0109",Ccirc:"\u0108",Cconint:"\u2230",ccups:"\u2A4C",ccupssm:"\u2A50",cdot:"\u010B",Cdot:"\u010A",cedil:"\xB8",Cedilla:"\xB8",cemptyv:"\u29B2",cent:"\xA2",centerdot:"\xB7",CenterDot:"\xB7",cfr:"\u{1D520}",Cfr:"\u212D",chcy:"\u0447",CHcy:"\u0427",check:"\u2713",checkmark:"\u2713",chi:"\u03C7",Chi:"\u03A7",cir:"\u25CB",circ:"\u02C6",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",CircleDot:"\u2299",circledR:"\xAE",circledS:"\u24C8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cire:"\u2257",cirE:"\u29C3",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201D",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",colon:":",Colon:"\u2237",colone:"\u2254",Colone:"\u2A74",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2A6D",Congruent:"\u2261",conint:"\u222E",Conint:"\u222F",ContourIntegral:"\u222E",copf:"\u{1D554}",Copf:"\u2102",coprod:"\u2210",Coproduct:"\u2210",copy:"\xA9",COPY:"\xA9",copysr:"\u2117",CounterClockwiseContourIntegral:"\u2233",crarr:"\u21B5",cross:"\u2717",Cross:"\u2A2F",cscr:"\u{1D4B8}",Cscr:"\u{1D49E}",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",ctdot:"\u22EF",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22DE",cuesc:"\u22DF",cularr:"\u21B6",cularrp:"\u293D",cup:"\u222A",Cup:"\u22D3",cupbrcap:"\u2A48",cupcap:"\u2A46",CupCap:"\u224D",cupcup:"\u2A4A",cupdot:"\u228D",cupor:"\u2A45",cups:"\u222A\uFE00",curarr:"\u21B7",curarrm:"\u293C",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curlyvee:"\u22CE",curlywedge:"\u22CF",curren:"\xA4",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",cuvee:"\u22CE",cuwed:"\u22CF",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232D",dagger:"\u2020",Dagger:"\u2021",daleth:"\u2138",darr:"\u2193",dArr:"\u21D3",Darr:"\u21A1",dash:"\u2010",dashv:"\u22A3",Dashv:"\u2AE4",dbkarow:"\u290F",dblac:"\u02DD",dcaron:"\u010F",Dcaron:"\u010E",dcy:"\u0434",Dcy:"\u0414",dd:"\u2146",DD:"\u2145",ddagger:"\u2021",ddarr:"\u21CA",DDotrahd:"\u2911",ddotseq:"\u2A77",deg:"\xB0",Del:"\u2207",delta:"\u03B4",Delta:"\u0394",demptyv:"\u29B1",dfisht:"\u297F",dfr:"\u{1D521}",Dfr:"\u{1D507}",dHar:"\u2965",dharl:"\u21C3",dharr:"\u21C2",DiacriticalAcute:"\xB4",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",DiacriticalGrave:"`",DiacriticalTilde:"\u02DC",diam:"\u22C4",diamond:"\u22C4",Diamond:"\u22C4",diamondsuit:"\u2666",diams:"\u2666",die:"\xA8",DifferentialD:"\u2146",digamma:"\u03DD",disin:"\u22F2",div:"\xF7",divide:"\xF7",divideontimes:"\u22C7",divonx:"\u22C7",djcy:"\u0452",DJcy:"\u0402",dlcorn:"\u231E",dlcrop:"\u230D",dollar:"$",dopf:"\u{1D555}",Dopf:"\u{1D53B}",dot:"\u02D9",Dot:"\xA8",DotDot:"\u20DC",doteq:"\u2250",doteqdot:"\u2251",DotEqual:"\u2250",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22A1",doublebarwedge:"\u2306",DoubleContourIntegral:"\u222F",DoubleDot:"\xA8",DoubleDownArrow:"\u21D3",DoubleLeftArrow:"\u21D0",DoubleLeftRightArrow:"\u21D4",DoubleLeftTee:"\u2AE4",DoubleLongLeftArrow:"\u27F8",DoubleLongLeftRightArrow:"\u27FA",DoubleLongRightArrow:"\u27F9",DoubleRightArrow:"\u21D2",DoubleRightTee:"\u22A8",DoubleUpArrow:"\u21D1",DoubleUpDownArrow:"\u21D5",DoubleVerticalBar:"\u2225",downarrow:"\u2193",Downarrow:"\u21D3",DownArrow:"\u2193",DownArrowBar:"\u2913",DownArrowUpArrow:"\u21F5",DownBreve:"\u0311",downdownarrows:"\u21CA",downharpoonleft:"\u21C3",downharpoonright:"\u21C2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295E",DownLeftVector:"\u21BD",DownLeftVectorBar:"\u2956",DownRightTeeVector:"\u295F",DownRightVector:"\u21C1",DownRightVectorBar:"\u2957",DownTee:"\u22A4",DownTeeArrow:"\u21A7",drbkarow:"\u2910",drcorn:"\u231F",drcrop:"\u230C",dscr:"\u{1D4B9}",Dscr:"\u{1D49F}",dscy:"\u0455",DScy:"\u0405",dsol:"\u29F6",dstrok:"\u0111",Dstrok:"\u0110",dtdot:"\u22F1",dtri:"\u25BF",dtrif:"\u25BE",duarr:"\u21F5",duhar:"\u296F",dwangle:"\u29A6",dzcy:"\u045F",DZcy:"\u040F",dzigrarr:"\u27FF",eacute:"\xE9",Eacute:"\xC9",easter:"\u2A6E",ecaron:"\u011B",Ecaron:"\u011A",ecir:"\u2256",ecirc:"\xEA",Ecirc:"\xCA",ecolon:"\u2255",ecy:"\u044D",Ecy:"\u042D",eDDot:"\u2A77",edot:"\u0117",eDot:"\u2251",Edot:"\u0116",ee:"\u2147",efDot:"\u2252",efr:"\u{1D522}",Efr:"\u{1D508}",eg:"\u2A9A",egrave:"\xE8",Egrave:"\xC8",egs:"\u2A96",egsdot:"\u2A98",el:"\u2A99",Element:"\u2208",elinters:"\u23E7",ell:"\u2113",els:"\u2A95",elsdot:"\u2A97",emacr:"\u0113",Emacr:"\u0112",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25FB",emptyv:"\u2205",EmptyVerySmallSquare:"\u25AB",emsp:"\u2003",emsp13:"\u2004",emsp14:"\u2005",eng:"\u014B",ENG:"\u014A",ensp:"\u2002",eogon:"\u0119",Eogon:"\u0118",eopf:"\u{1D556}",Eopf:"\u{1D53C}",epar:"\u22D5",eparsl:"\u29E3",eplus:"\u2A71",epsi:"\u03B5",epsilon:"\u03B5",Epsilon:"\u0395",epsiv:"\u03F5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2A96",eqslantless:"\u2A95",Equal:"\u2A75",equals:"=",EqualTilde:"\u2242",equest:"\u225F",Equilibrium:"\u21CC",equiv:"\u2261",equivDD:"\u2A78",eqvparsl:"\u29E5",erarr:"\u2971",erDot:"\u2253",escr:"\u212F",Escr:"\u2130",esdot:"\u2250",esim:"\u2242",Esim:"\u2A73",eta:"\u03B7",Eta:"\u0397",eth:"\xF0",ETH:"\xD0",euml:"\xEB",Euml:"\xCB",euro:"\u20AC",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",exponentiale:"\u2147",ExponentialE:"\u2147",fallingdotseq:"\u2252",fcy:"\u0444",Fcy:"\u0424",female:"\u2640",ffilig:"\uFB03",fflig:"\uFB00",ffllig:"\uFB04",ffr:"\u{1D523}",Ffr:"\u{1D509}",filig:"\uFB01",FilledSmallSquare:"\u25FC",FilledVerySmallSquare:"\u25AA",fjlig:"fj",flat:"\u266D",fllig:"\uFB02",fltns:"\u25B1",fnof:"\u0192",fopf:"\u{1D557}",Fopf:"\u{1D53D}",forall:"\u2200",ForAll:"\u2200",fork:"\u22D4",forkv:"\u2AD9",Fouriertrf:"\u2131",fpartint:"\u2A0D",frac12:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044",frown:"\u2322",fscr:"\u{1D4BB}",Fscr:"\u2131",gacute:"\u01F5",gamma:"\u03B3",Gamma:"\u0393",gammad:"\u03DD",Gammad:"\u03DC",gap:"\u2A86",gbreve:"\u011F",Gbreve:"\u011E",Gcedil:"\u0122",gcirc:"\u011D",Gcirc:"\u011C",gcy:"\u0433",Gcy:"\u0413",gdot:"\u0121",Gdot:"\u0120",ge:"\u2265",gE:"\u2267",gel:"\u22DB",gEl:"\u2A8C",geq:"\u2265",geqq:"\u2267",geqslant:"\u2A7E",ges:"\u2A7E",gescc:"\u2AA9",gesdot:"\u2A80",gesdoto:"\u2A82",gesdotol:"\u2A84",gesl:"\u22DB\uFE00",gesles:"\u2A94",gfr:"\u{1D524}",Gfr:"\u{1D50A}",gg:"\u226B",Gg:"\u22D9",ggg:"\u22D9",gimel:"\u2137",gjcy:"\u0453",GJcy:"\u0403",gl:"\u2277",gla:"\u2AA5",glE:"\u2A92",glj:"\u2AA4",gnap:"\u2A8A",gnapprox:"\u2A8A",gne:"\u2A88",gnE:"\u2269",gneq:"\u2A88",gneqq:"\u2269",gnsim:"\u22E7",gopf:"\u{1D558}",Gopf:"\u{1D53E}",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22DB",GreaterFullEqual:"\u2267",GreaterGreater:"\u2AA2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2A7E",GreaterTilde:"\u2273",gscr:"\u210A",Gscr:"\u{1D4A2}",gsim:"\u2273",gsime:"\u2A8E",gsiml:"\u2A90",gt:">",Gt:"\u226B",GT:">",gtcc:"\u2AA7",gtcir:"\u2A7A",gtdot:"\u22D7",gtlPar:"\u2995",gtquest:"\u2A7C",gtrapprox:"\u2A86",gtrarr:"\u2978",gtrdot:"\u22D7",gtreqless:"\u22DB",gtreqqless:"\u2A8C",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\uFE00",gvnE:"\u2269\uFE00",Hacek:"\u02C7",hairsp:"\u200A",half:"\xBD",hamilt:"\u210B",hardcy:"\u044A",HARDcy:"\u042A",harr:"\u2194",hArr:"\u21D4",harrcir:"\u2948",harrw:"\u21AD",Hat:"^",hbar:"\u210F",hcirc:"\u0125",Hcirc:"\u0124",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22B9",hfr:"\u{1D525}",Hfr:"\u210C",HilbertSpace:"\u210B",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21FF",homtht:"\u223B",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",hopf:"\u{1D559}",Hopf:"\u210D",horbar:"\u2015",HorizontalLine:"\u2500",hscr:"\u{1D4BD}",Hscr:"\u210B",hslash:"\u210F",hstrok:"\u0127",Hstrok:"\u0126",HumpDownHump:"\u224E",HumpEqual:"\u224F",hybull:"\u2043",hyphen:"\u2010",iacute:"\xED",Iacute:"\xCD",ic:"\u2063",icirc:"\xEE",Icirc:"\xCE",icy:"\u0438",Icy:"\u0418",Idot:"\u0130",iecy:"\u0435",IEcy:"\u0415",iexcl:"\xA1",iff:"\u21D4",ifr:"\u{1D526}",Ifr:"\u2111",igrave:"\xEC",Igrave:"\xCC",ii:"\u2148",iiiint:"\u2A0C",iiint:"\u222D",iinfin:"\u29DC",iiota:"\u2129",ijlig:"\u0133",IJlig:"\u0132",Im:"\u2111",imacr:"\u012B",Imacr:"\u012A",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",imof:"\u22B7",imped:"\u01B5",Implies:"\u21D2",in:"\u2208",incare:"\u2105",infin:"\u221E",infintie:"\u29DD",inodot:"\u0131",int:"\u222B",Int:"\u222C",intcal:"\u22BA",integers:"\u2124",Integral:"\u222B",intercal:"\u22BA",Intersection:"\u22C2",intlarhk:"\u2A17",intprod:"\u2A3C",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",iocy:"\u0451",IOcy:"\u0401",iogon:"\u012F",Iogon:"\u012E",iopf:"\u{1D55A}",Iopf:"\u{1D540}",iota:"\u03B9",Iota:"\u0399",iprod:"\u2A3C",iquest:"\xBF",iscr:"\u{1D4BE}",Iscr:"\u2110",isin:"\u2208",isindot:"\u22F5",isinE:"\u22F9",isins:"\u22F4",isinsv:"\u22F3",isinv:"\u2208",it:"\u2062",itilde:"\u0129",Itilde:"\u0128",iukcy:"\u0456",Iukcy:"\u0406",iuml:"\xEF",Iuml:"\xCF",jcirc:"\u0135",Jcirc:"\u0134",jcy:"\u0439",Jcy:"\u0419",jfr:"\u{1D527}",Jfr:"\u{1D50D}",jmath:"\u0237",jopf:"\u{1D55B}",Jopf:"\u{1D541}",jscr:"\u{1D4BF}",Jscr:"\u{1D4A5}",jsercy:"\u0458",Jsercy:"\u0408",jukcy:"\u0454",Jukcy:"\u0404",kappa:"\u03BA",Kappa:"\u039A",kappav:"\u03F0",kcedil:"\u0137",Kcedil:"\u0136",kcy:"\u043A",Kcy:"\u041A",kfr:"\u{1D528}",Kfr:"\u{1D50E}",kgreen:"\u0138",khcy:"\u0445",KHcy:"\u0425",kjcy:"\u045C",KJcy:"\u040C",kopf:"\u{1D55C}",Kopf:"\u{1D542}",kscr:"\u{1D4C0}",Kscr:"\u{1D4A6}",lAarr:"\u21DA",lacute:"\u013A",Lacute:"\u0139",laemptyv:"\u29B4",lagran:"\u2112",lambda:"\u03BB",Lambda:"\u039B",lang:"\u27E8",Lang:"\u27EA",langd:"\u2991",langle:"\u27E8",lap:"\u2A85",Laplacetrf:"\u2112",laquo:"\xAB",larr:"\u2190",lArr:"\u21D0",Larr:"\u219E",larrb:"\u21E4",larrbfs:"\u291F",larrfs:"\u291D",larrhk:"\u21A9",larrlp:"\u21AB",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21A2",lat:"\u2AAB",latail:"\u2919",lAtail:"\u291B",late:"\u2AAD",lates:"\u2AAD\uFE00",lbarr:"\u290C",lBarr:"\u290E",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298B",lbrksld:"\u298F",lbrkslu:"\u298D",lcaron:"\u013E",Lcaron:"\u013D",lcedil:"\u013C",Lcedil:"\u013B",lceil:"\u2308",lcub:"{",lcy:"\u043B",Lcy:"\u041B",ldca:"\u2936",ldquo:"\u201C",ldquor:"\u201E",ldrdhar:"\u2967",ldrushar:"\u294B",ldsh:"\u21B2",le:"\u2264",lE:"\u2266",LeftAngleBracket:"\u27E8",leftarrow:"\u2190",Leftarrow:"\u21D0",LeftArrow:"\u2190",LeftArrowBar:"\u21E4",LeftArrowRightArrow:"\u21C6",leftarrowtail:"\u21A2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27E6",LeftDownTeeVector:"\u2961",LeftDownVector:"\u21C3",LeftDownVectorBar:"\u2959",LeftFloor:"\u230A",leftharpoondown:"\u21BD",leftharpoonup:"\u21BC",leftleftarrows:"\u21C7",leftrightarrow:"\u2194",Leftrightarrow:"\u21D4",LeftRightArrow:"\u2194",leftrightarrows:"\u21C6",leftrightharpoons:"\u21CB",leftrightsquigarrow:"\u21AD",LeftRightVector:"\u294E",LeftTee:"\u22A3",LeftTeeArrow:"\u21A4",LeftTeeVector:"\u295A",leftthreetimes:"\u22CB",LeftTriangle:"\u22B2",LeftTriangleBar:"\u29CF",LeftTriangleEqual:"\u22B4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVector:"\u21BF",LeftUpVectorBar:"\u2958",LeftVector:"\u21BC",LeftVectorBar:"\u2952",leg:"\u22DA",lEg:"\u2A8B",leq:"\u2264",leqq:"\u2266",leqslant:"\u2A7D",les:"\u2A7D",lescc:"\u2AA8",lesdot:"\u2A7F",lesdoto:"\u2A81",lesdotor:"\u2A83",lesg:"\u22DA\uFE00",lesges:"\u2A93",lessapprox:"\u2A85",lessdot:"\u22D6",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",LessEqualGreater:"\u22DA",LessFullEqual:"\u2266",LessGreater:"\u2276",lessgtr:"\u2276",LessLess:"\u2AA1",lesssim:"\u2272",LessSlantEqual:"\u2A7D",LessTilde:"\u2272",lfisht:"\u297C",lfloor:"\u230A",lfr:"\u{1D529}",Lfr:"\u{1D50F}",lg:"\u2276",lgE:"\u2A91",lHar:"\u2962",lhard:"\u21BD",lharu:"\u21BC",lharul:"\u296A",lhblk:"\u2584",ljcy:"\u0459",LJcy:"\u0409",ll:"\u226A",Ll:"\u22D8",llarr:"\u21C7",llcorner:"\u231E",Lleftarrow:"\u21DA",llhard:"\u296B",lltri:"\u25FA",lmidot:"\u0140",Lmidot:"\u013F",lmoust:"\u23B0",lmoustache:"\u23B0",lnap:"\u2A89",lnapprox:"\u2A89",lne:"\u2A87",lnE:"\u2268",lneq:"\u2A87",lneqq:"\u2268",lnsim:"\u22E6",loang:"\u27EC",loarr:"\u21FD",lobrk:"\u27E6",longleftarrow:"\u27F5",Longleftarrow:"\u27F8",LongLeftArrow:"\u27F5",longleftrightarrow:"\u27F7",Longleftrightarrow:"\u27FA",LongLeftRightArrow:"\u27F7",longmapsto:"\u27FC",longrightarrow:"\u27F6",Longrightarrow:"\u27F9",LongRightArrow:"\u27F6",looparrowleft:"\u21AB",looparrowright:"\u21AC",lopar:"\u2985",lopf:"\u{1D55D}",Lopf:"\u{1D543}",loplus:"\u2A2D",lotimes:"\u2A34",lowast:"\u2217",lowbar:"_",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",loz:"\u25CA",lozenge:"\u25CA",lozf:"\u29EB",lpar:"(",lparlt:"\u2993",lrarr:"\u21C6",lrcorner:"\u231F",lrhar:"\u21CB",lrhard:"\u296D",lrm:"\u200E",lrtri:"\u22BF",lsaquo:"\u2039",lscr:"\u{1D4C1}",Lscr:"\u2112",lsh:"\u21B0",Lsh:"\u21B0",lsim:"\u2272",lsime:"\u2A8D",lsimg:"\u2A8F",lsqb:"[",lsquo:"\u2018",lsquor:"\u201A",lstrok:"\u0142",Lstrok:"\u0141",lt:"<",Lt:"\u226A",LT:"<",ltcc:"\u2AA6",ltcir:"\u2A79",ltdot:"\u22D6",lthree:"\u22CB",ltimes:"\u22C9",ltlarr:"\u2976",ltquest:"\u2A7B",ltri:"\u25C3",ltrie:"\u22B4",ltrif:"\u25C2",ltrPar:"\u2996",lurdshar:"\u294A",luruhar:"\u2966",lvertneqq:"\u2268\uFE00",lvnE:"\u2268\uFE00",macr:"\xAF",male:"\u2642",malt:"\u2720",maltese:"\u2720",map:"\u21A6",Map:"\u2905",mapsto:"\u21A6",mapstodown:"\u21A7",mapstoleft:"\u21A4",mapstoup:"\u21A5",marker:"\u25AE",mcomma:"\u2A29",mcy:"\u043C",Mcy:"\u041C",mdash:"\u2014",mDDot:"\u223A",measuredangle:"\u2221",MediumSpace:"\u205F",Mellintrf:"\u2133",mfr:"\u{1D52A}",Mfr:"\u{1D510}",mho:"\u2127",micro:"\xB5",mid:"\u2223",midast:"*",midcir:"\u2AF0",middot:"\xB7",minus:"\u2212",minusb:"\u229F",minusd:"\u2238",minusdu:"\u2A2A",MinusPlus:"\u2213",mlcp:"\u2ADB",mldr:"\u2026",mnplus:"\u2213",models:"\u22A7",mopf:"\u{1D55E}",Mopf:"\u{1D544}",mp:"\u2213",mscr:"\u{1D4C2}",Mscr:"\u2133",mstpos:"\u223E",mu:"\u03BC",Mu:"\u039C",multimap:"\u22B8",mumap:"\u22B8",nabla:"\u2207",nacute:"\u0144",Nacute:"\u0143",nang:"\u2220\u20D2",nap:"\u2249",napE:"\u2A70\u0338",napid:"\u224B\u0338",napos:"\u0149",napprox:"\u2249",natur:"\u266E",natural:"\u266E",naturals:"\u2115",nbsp:"\xA0",nbump:"\u224E\u0338",nbumpe:"\u224F\u0338",ncap:"\u2A43",ncaron:"\u0148",Ncaron:"\u0147",ncedil:"\u0146",Ncedil:"\u0145",ncong:"\u2247",ncongdot:"\u2A6D\u0338",ncup:"\u2A42",ncy:"\u043D",Ncy:"\u041D",ndash:"\u2013",ne:"\u2260",nearhk:"\u2924",nearr:"\u2197",neArr:"\u21D7",nearrow:"\u2197",nedot:"\u2250\u0338",NegativeMediumSpace:"\u200B",NegativeThickSpace:"\u200B",NegativeThinSpace:"\u200B",NegativeVeryThinSpace:"\u200B",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",NestedGreaterGreater:"\u226B",NestedLessLess:"\u226A",NewLine:`
|
|
`,nexist:"\u2204",nexists:"\u2204",nfr:"\u{1D52B}",Nfr:"\u{1D511}",nge:"\u2271",ngE:"\u2267\u0338",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",nGg:"\u22D9\u0338",ngsim:"\u2275",ngt:"\u226F",nGt:"\u226B\u20D2",ngtr:"\u226F",nGtv:"\u226B\u0338",nharr:"\u21AE",nhArr:"\u21CE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",njcy:"\u045A",NJcy:"\u040A",nlarr:"\u219A",nlArr:"\u21CD",nldr:"\u2025",nle:"\u2270",nlE:"\u2266\u0338",nleftarrow:"\u219A",nLeftarrow:"\u21CD",nleftrightarrow:"\u21AE",nLeftrightarrow:"\u21CE",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2A7D\u0338",nles:"\u2A7D\u0338",nless:"\u226E",nLl:"\u22D8\u0338",nlsim:"\u2274",nlt:"\u226E",nLt:"\u226A\u20D2",nltri:"\u22EA",nltrie:"\u22EC",nLtv:"\u226A\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xA0",nopf:"\u{1D55F}",Nopf:"\u2115",not:"\xAC",Not:"\u2AEC",NotCongruent:"\u2262",NotCupCap:"\u226D",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226F",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226B\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2A7E\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224E\u0338",NotHumpEqual:"\u224F\u0338",notin:"\u2209",notindot:"\u22F5\u0338",notinE:"\u22F9\u0338",notinva:"\u2209",notinvb:"\u22F7",notinvc:"\u22F6",NotLeftTriangle:"\u22EA",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangleEqual:"\u22EC",NotLess:"\u226E",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226A\u0338",NotLessSlantEqual:"\u2A7D\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2AA2\u0338",NotNestedLessLess:"\u2AA1\u0338",notni:"\u220C",notniva:"\u220C",notnivb:"\u22FE",notnivc:"\u22FD",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2AAF\u0338",NotPrecedesSlantEqual:"\u22E0",NotReverseElement:"\u220C",NotRightTriangle:"\u22EB",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangleEqual:"\u22ED",NotSquareSubset:"\u228F\u0338",NotSquareSubsetEqual:"\u22E2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22E3",NotSubset:"\u2282\u20D2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2AB0\u0338",NotSucceedsSlantEqual:"\u22E1",NotSucceedsTilde:"\u227F\u0338",NotSuperset:"\u2283\u20D2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",npar:"\u2226",nparallel:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",npre:"\u2AAF\u0338",nprec:"\u2280",npreceq:"\u2AAF\u0338",nrarr:"\u219B",nrArr:"\u21CF",nrarrc:"\u2933\u0338",nrarrw:"\u219D\u0338",nrightarrow:"\u219B",nRightarrow:"\u21CF",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",nscr:"\u{1D4C3}",Nscr:"\u{1D4A9}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsube:"\u2288",nsubE:"\u2AC5\u0338",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupe:"\u2289",nsupE:"\u2AC6\u0338",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",ntilde:"\xF1",Ntilde:"\xD1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",nu:"\u03BD",Nu:"\u039D",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224D\u20D2",nvdash:"\u22AC",nvDash:"\u22AD",nVdash:"\u22AE",nVDash:"\u22AF",nvge:"\u2265\u20D2",nvgt:">\u20D2",nvHarr:"\u2904",nvinfin:"\u29DE",nvlArr:"\u2902",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvltrie:"\u22B4\u20D2",nvrArr:"\u2903",nvrtrie:"\u22B5\u20D2",nvsim:"\u223C\u20D2",nwarhk:"\u2923",nwarr:"\u2196",nwArr:"\u21D6",nwarrow:"\u2196",nwnear:"\u2927",oacute:"\xF3",Oacute:"\xD3",oast:"\u229B",ocir:"\u229A",ocirc:"\xF4",Ocirc:"\xD4",ocy:"\u043E",Ocy:"\u041E",odash:"\u229D",odblac:"\u0151",Odblac:"\u0150",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",oelig:"\u0153",OElig:"\u0152",ofcir:"\u29BF",ofr:"\u{1D52C}",Ofr:"\u{1D512}",ogon:"\u02DB",ograve:"\xF2",Ograve:"\xD2",ogt:"\u29C1",ohbar:"\u29B5",ohm:"\u03A9",oint:"\u222E",olarr:"\u21BA",olcir:"\u29BE",olcross:"\u29BB",oline:"\u203E",olt:"\u29C0",omacr:"\u014D",Omacr:"\u014C",omega:"\u03C9",Omega:"\u03A9",omicron:"\u03BF",Omicron:"\u039F",omid:"\u29B6",ominus:"\u2296",oopf:"\u{1D560}",Oopf:"\u{1D546}",opar:"\u29B7",OpenCurlyDoubleQuote:"\u201C",OpenCurlyQuote:"\u2018",operp:"\u29B9",oplus:"\u2295",or:"\u2228",Or:"\u2A54",orarr:"\u21BB",ord:"\u2A5D",order:"\u2134",orderof:"\u2134",ordf:"\xAA",ordm:"\xBA",origof:"\u22B6",oror:"\u2A56",orslope:"\u2A57",orv:"\u2A5B",oS:"\u24C8",oscr:"\u2134",Oscr:"\u{1D4AA}",oslash:"\xF8",Oslash:"\xD8",osol:"\u2298",otilde:"\xF5",Otilde:"\xD5",otimes:"\u2297",Otimes:"\u2A37",otimesas:"\u2A36",ouml:"\xF6",Ouml:"\xD6",ovbar:"\u233D",OverBar:"\u203E",OverBrace:"\u23DE",OverBracket:"\u23B4",OverParenthesis:"\u23DC",par:"\u2225",para:"\xB6",parallel:"\u2225",parsim:"\u2AF3",parsl:"\u2AFD",part:"\u2202",PartialD:"\u2202",pcy:"\u043F",Pcy:"\u041F",percnt:"%",period:".",permil:"\u2030",perp:"\u22A5",pertenk:"\u2031",pfr:"\u{1D52D}",Pfr:"\u{1D513}",phi:"\u03C6",Phi:"\u03A6",phiv:"\u03D5",phmmat:"\u2133",phone:"\u260E",pi:"\u03C0",Pi:"\u03A0",pitchfork:"\u22D4",piv:"\u03D6",planck:"\u210F",planckh:"\u210E",plankv:"\u210F",plus:"+",plusacir:"\u2A23",plusb:"\u229E",pluscir:"\u2A22",plusdo:"\u2214",plusdu:"\u2A25",pluse:"\u2A72",PlusMinus:"\xB1",plusmn:"\xB1",plussim:"\u2A26",plustwo:"\u2A27",pm:"\xB1",Poincareplane:"\u210C",pointint:"\u2A15",popf:"\u{1D561}",Popf:"\u2119",pound:"\xA3",pr:"\u227A",Pr:"\u2ABB",prap:"\u2AB7",prcue:"\u227C",pre:"\u2AAF",prE:"\u2AB3",prec:"\u227A",precapprox:"\u2AB7",preccurlyeq:"\u227C",Precedes:"\u227A",PrecedesEqual:"\u2AAF",PrecedesSlantEqual:"\u227C",PrecedesTilde:"\u227E",preceq:"\u2AAF",precnapprox:"\u2AB9",precneqq:"\u2AB5",precnsim:"\u22E8",precsim:"\u227E",prime:"\u2032",Prime:"\u2033",primes:"\u2119",prnap:"\u2AB9",prnE:"\u2AB5",prnsim:"\u22E8",prod:"\u220F",Product:"\u220F",profalar:"\u232E",profline:"\u2312",profsurf:"\u2313",prop:"\u221D",Proportion:"\u2237",Proportional:"\u221D",propto:"\u221D",prsim:"\u227E",prurel:"\u22B0",pscr:"\u{1D4C5}",Pscr:"\u{1D4AB}",psi:"\u03C8",Psi:"\u03A8",puncsp:"\u2008",qfr:"\u{1D52E}",Qfr:"\u{1D514}",qint:"\u2A0C",qopf:"\u{1D562}",Qopf:"\u211A",qprime:"\u2057",qscr:"\u{1D4C6}",Qscr:"\u{1D4AC}",quaternions:"\u210D",quatint:"\u2A16",quest:"?",questeq:"\u225F",quot:'"',QUOT:'"',rAarr:"\u21DB",race:"\u223D\u0331",racute:"\u0155",Racute:"\u0154",radic:"\u221A",raemptyv:"\u29B3",rang:"\u27E9",Rang:"\u27EB",rangd:"\u2992",range:"\u29A5",rangle:"\u27E9",raquo:"\xBB",rarr:"\u2192",rArr:"\u21D2",Rarr:"\u21A0",rarrap:"\u2975",rarrb:"\u21E5",rarrbfs:"\u2920",rarrc:"\u2933",rarrfs:"\u291E",rarrhk:"\u21AA",rarrlp:"\u21AC",rarrpl:"\u2945",rarrsim:"\u2974",rarrtl:"\u21A3",Rarrtl:"\u2916",rarrw:"\u219D",ratail:"\u291A",rAtail:"\u291C",ratio:"\u2236",rationals:"\u211A",rbarr:"\u290D",rBarr:"\u290F",RBarr:"\u2910",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298C",rbrksld:"\u298E",rbrkslu:"\u2990",rcaron:"\u0159",Rcaron:"\u0158",rcedil:"\u0157",Rcedil:"\u0156",rceil:"\u2309",rcub:"}",rcy:"\u0440",Rcy:"\u0420",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201D",rdquor:"\u201D",rdsh:"\u21B3",Re:"\u211C",real:"\u211C",realine:"\u211B",realpart:"\u211C",reals:"\u211D",rect:"\u25AD",reg:"\xAE",REG:"\xAE",ReverseElement:"\u220B",ReverseEquilibrium:"\u21CB",ReverseUpEquilibrium:"\u296F",rfisht:"\u297D",rfloor:"\u230B",rfr:"\u{1D52F}",Rfr:"\u211C",rHar:"\u2964",rhard:"\u21C1",rharu:"\u21C0",rharul:"\u296C",rho:"\u03C1",Rho:"\u03A1",rhov:"\u03F1",RightAngleBracket:"\u27E9",rightarrow:"\u2192",Rightarrow:"\u21D2",RightArrow:"\u2192",RightArrowBar:"\u21E5",RightArrowLeftArrow:"\u21C4",rightarrowtail:"\u21A3",RightCeiling:"\u2309",RightDoubleBracket:"\u27E7",RightDownTeeVector:"\u295D",RightDownVector:"\u21C2",RightDownVectorBar:"\u2955",RightFloor:"\u230B",rightharpoondown:"\u21C1",rightharpoonup:"\u21C0",rightleftarrows:"\u21C4",rightleftharpoons:"\u21CC",rightrightarrows:"\u21C9",rightsquigarrow:"\u219D",RightTee:"\u22A2",RightTeeArrow:"\u21A6",RightTeeVector:"\u295B",rightthreetimes:"\u22CC",RightTriangle:"\u22B3",RightTriangleBar:"\u29D0",RightTriangleEqual:"\u22B5",RightUpDownVector:"\u294F",RightUpTeeVector:"\u295C",RightUpVector:"\u21BE",RightUpVectorBar:"\u2954",RightVector:"\u21C0",RightVectorBar:"\u2953",ring:"\u02DA",risingdotseq:"\u2253",rlarr:"\u21C4",rlhar:"\u21CC",rlm:"\u200F",rmoust:"\u23B1",rmoustache:"\u23B1",rnmid:"\u2AEE",roang:"\u27ED",roarr:"\u21FE",robrk:"\u27E7",ropar:"\u2986",ropf:"\u{1D563}",Ropf:"\u211D",roplus:"\u2A2E",rotimes:"\u2A35",RoundImplies:"\u2970",rpar:")",rpargt:"\u2994",rppolint:"\u2A12",rrarr:"\u21C9",Rrightarrow:"\u21DB",rsaquo:"\u203A",rscr:"\u{1D4C7}",Rscr:"\u211B",rsh:"\u21B1",Rsh:"\u21B1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22CC",rtimes:"\u22CA",rtri:"\u25B9",rtrie:"\u22B5",rtrif:"\u25B8",rtriltri:"\u29CE",RuleDelayed:"\u29F4",ruluhar:"\u2968",rx:"\u211E",sacute:"\u015B",Sacute:"\u015A",sbquo:"\u201A",sc:"\u227B",Sc:"\u2ABC",scap:"\u2AB8",scaron:"\u0161",Scaron:"\u0160",sccue:"\u227D",sce:"\u2AB0",scE:"\u2AB4",scedil:"\u015F",Scedil:"\u015E",scirc:"\u015D",Scirc:"\u015C",scnap:"\u2ABA",scnE:"\u2AB6",scnsim:"\u22E9",scpolint:"\u2A13",scsim:"\u227F",scy:"\u0441",Scy:"\u0421",sdot:"\u22C5",sdotb:"\u22A1",sdote:"\u2A66",searhk:"\u2925",searr:"\u2198",seArr:"\u21D8",searrow:"\u2198",sect:"\xA7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",sfr:"\u{1D530}",Sfr:"\u{1D516}",sfrown:"\u2322",sharp:"\u266F",shchcy:"\u0449",SHCHcy:"\u0429",shcy:"\u0448",SHcy:"\u0428",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xAD",sigma:"\u03C3",Sigma:"\u03A3",sigmaf:"\u03C2",sigmav:"\u03C2",sim:"\u223C",simdot:"\u2A6A",sime:"\u2243",simeq:"\u2243",simg:"\u2A9E",simgE:"\u2AA0",siml:"\u2A9D",simlE:"\u2A9F",simne:"\u2246",simplus:"\u2A24",simrarr:"\u2972",slarr:"\u2190",SmallCircle:"\u2218",smallsetminus:"\u2216",smashp:"\u2A33",smeparsl:"\u29E4",smid:"\u2223",smile:"\u2323",smt:"\u2AAA",smte:"\u2AAC",smtes:"\u2AAC\uFE00",softcy:"\u044C",SOFTcy:"\u042C",sol:"/",solb:"\u29C4",solbar:"\u233F",sopf:"\u{1D564}",Sopf:"\u{1D54A}",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\uFE00",sqcup:"\u2294",sqcups:"\u2294\uFE00",Sqrt:"\u221A",sqsub:"\u228F",sqsube:"\u2291",sqsubset:"\u228F",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",squ:"\u25A1",square:"\u25A1",Square:"\u25A1",SquareIntersection:"\u2293",SquareSubset:"\u228F",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25AA",squf:"\u25AA",srarr:"\u2192",sscr:"\u{1D4C8}",Sscr:"\u{1D4AE}",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22C6",star:"\u2606",Star:"\u22C6",starf:"\u2605",straightepsilon:"\u03F5",straightphi:"\u03D5",strns:"\xAF",sub:"\u2282",Sub:"\u22D0",subdot:"\u2ABD",sube:"\u2286",subE:"\u2AC5",subedot:"\u2AC3",submult:"\u2AC1",subne:"\u228A",subnE:"\u2ACB",subplus:"\u2ABF",subrarr:"\u2979",subset:"\u2282",Subset:"\u22D0",subseteq:"\u2286",subseteqq:"\u2AC5",SubsetEqual:"\u2286",subsetneq:"\u228A",subsetneqq:"\u2ACB",subsim:"\u2AC7",subsub:"\u2AD5",subsup:"\u2AD3",succ:"\u227B",succapprox:"\u2AB8",succcurlyeq:"\u227D",Succeeds:"\u227B",SucceedsEqual:"\u2AB0",SucceedsSlantEqual:"\u227D",SucceedsTilde:"\u227F",succeq:"\u2AB0",succnapprox:"\u2ABA",succneqq:"\u2AB6",succnsim:"\u22E9",succsim:"\u227F",SuchThat:"\u220B",sum:"\u2211",Sum:"\u2211",sung:"\u266A",sup:"\u2283",Sup:"\u22D1",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",supdot:"\u2ABE",supdsub:"\u2AD8",supe:"\u2287",supE:"\u2AC6",supedot:"\u2AC4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27C9",suphsub:"\u2AD7",suplarr:"\u297B",supmult:"\u2AC2",supne:"\u228B",supnE:"\u2ACC",supplus:"\u2AC0",supset:"\u2283",Supset:"\u22D1",supseteq:"\u2287",supseteqq:"\u2AC6",supsetneq:"\u228B",supsetneqq:"\u2ACC",supsim:"\u2AC8",supsub:"\u2AD4",supsup:"\u2AD6",swarhk:"\u2926",swarr:"\u2199",swArr:"\u21D9",swarrow:"\u2199",swnwar:"\u292A",szlig:"\xDF",Tab:" ",target:"\u2316",tau:"\u03C4",Tau:"\u03A4",tbrk:"\u23B4",tcaron:"\u0165",Tcaron:"\u0164",tcedil:"\u0163",Tcedil:"\u0162",tcy:"\u0442",Tcy:"\u0422",tdot:"\u20DB",telrec:"\u2315",tfr:"\u{1D531}",Tfr:"\u{1D517}",there4:"\u2234",therefore:"\u2234",Therefore:"\u2234",theta:"\u03B8",Theta:"\u0398",thetasym:"\u03D1",thetav:"\u03D1",thickapprox:"\u2248",thicksim:"\u223C",ThickSpace:"\u205F\u200A",thinsp:"\u2009",ThinSpace:"\u2009",thkap:"\u2248",thksim:"\u223C",thorn:"\xFE",THORN:"\xDE",tilde:"\u02DC",Tilde:"\u223C",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",times:"\xD7",timesb:"\u22A0",timesbar:"\u2A31",timesd:"\u2A30",tint:"\u222D",toea:"\u2928",top:"\u22A4",topbot:"\u2336",topcir:"\u2AF1",topf:"\u{1D565}",Topf:"\u{1D54B}",topfork:"\u2ADA",tosa:"\u2929",tprime:"\u2034",trade:"\u2122",TRADE:"\u2122",triangle:"\u25B5",triangledown:"\u25BF",triangleleft:"\u25C3",trianglelefteq:"\u22B4",triangleq:"\u225C",triangleright:"\u25B9",trianglerighteq:"\u22B5",tridot:"\u25EC",trie:"\u225C",triminus:"\u2A3A",TripleDot:"\u20DB",triplus:"\u2A39",trisb:"\u29CD",tritime:"\u2A3B",trpezium:"\u23E2",tscr:"\u{1D4C9}",Tscr:"\u{1D4AF}",tscy:"\u0446",TScy:"\u0426",tshcy:"\u045B",TSHcy:"\u040B",tstrok:"\u0167",Tstrok:"\u0166",twixt:"\u226C",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",uacute:"\xFA",Uacute:"\xDA",uarr:"\u2191",uArr:"\u21D1",Uarr:"\u219F",Uarrocir:"\u2949",ubrcy:"\u045E",Ubrcy:"\u040E",ubreve:"\u016D",Ubreve:"\u016C",ucirc:"\xFB",Ucirc:"\xDB",ucy:"\u0443",Ucy:"\u0423",udarr:"\u21C5",udblac:"\u0171",Udblac:"\u0170",udhar:"\u296E",ufisht:"\u297E",ufr:"\u{1D532}",Ufr:"\u{1D518}",ugrave:"\xF9",Ugrave:"\xD9",uHar:"\u2963",uharl:"\u21BF",uharr:"\u21BE",uhblk:"\u2580",ulcorn:"\u231C",ulcorner:"\u231C",ulcrop:"\u230F",ultri:"\u25F8",umacr:"\u016B",Umacr:"\u016A",uml:"\xA8",UnderBar:"_",UnderBrace:"\u23DF",UnderBracket:"\u23B5",UnderParenthesis:"\u23DD",Union:"\u22C3",UnionPlus:"\u228E",uogon:"\u0173",Uogon:"\u0172",uopf:"\u{1D566}",Uopf:"\u{1D54C}",uparrow:"\u2191",Uparrow:"\u21D1",UpArrow:"\u2191",UpArrowBar:"\u2912",UpArrowDownArrow:"\u21C5",updownarrow:"\u2195",Updownarrow:"\u21D5",UpDownArrow:"\u2195",UpEquilibrium:"\u296E",upharpoonleft:"\u21BF",upharpoonright:"\u21BE",uplus:"\u228E",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",upsi:"\u03C5",Upsi:"\u03D2",upsih:"\u03D2",upsilon:"\u03C5",Upsilon:"\u03A5",UpTee:"\u22A5",UpTeeArrow:"\u21A5",upuparrows:"\u21C8",urcorn:"\u231D",urcorner:"\u231D",urcrop:"\u230E",uring:"\u016F",Uring:"\u016E",urtri:"\u25F9",uscr:"\u{1D4CA}",Uscr:"\u{1D4B0}",utdot:"\u22F0",utilde:"\u0169",Utilde:"\u0168",utri:"\u25B5",utrif:"\u25B4",uuarr:"\u21C8",uuml:"\xFC",Uuml:"\xDC",uwangle:"\u29A7",vangrt:"\u299C",varepsilon:"\u03F5",varkappa:"\u03F0",varnothing:"\u2205",varphi:"\u03D5",varpi:"\u03D6",varpropto:"\u221D",varr:"\u2195",vArr:"\u21D5",varrho:"\u03F1",varsigma:"\u03C2",varsubsetneq:"\u228A\uFE00",varsubsetneqq:"\u2ACB\uFE00",varsupsetneq:"\u228B\uFE00",varsupsetneqq:"\u2ACC\uFE00",vartheta:"\u03D1",vartriangleleft:"\u22B2",vartriangleright:"\u22B3",vBar:"\u2AE8",Vbar:"\u2AEB",vBarv:"\u2AE9",vcy:"\u0432",Vcy:"\u0412",vdash:"\u22A2",vDash:"\u22A8",Vdash:"\u22A9",VDash:"\u22AB",Vdashl:"\u2AE6",vee:"\u2228",Vee:"\u22C1",veebar:"\u22BB",veeeq:"\u225A",vellip:"\u22EE",verbar:"|",Verbar:"\u2016",vert:"|",Vert:"\u2016",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200A",vfr:"\u{1D533}",Vfr:"\u{1D519}",vltri:"\u22B2",vnsub:"\u2282\u20D2",vnsup:"\u2283\u20D2",vopf:"\u{1D567}",Vopf:"\u{1D54D}",vprop:"\u221D",vrtri:"\u22B3",vscr:"\u{1D4CB}",Vscr:"\u{1D4B1}",vsubne:"\u228A\uFE00",vsubnE:"\u2ACB\uFE00",vsupne:"\u228B\uFE00",vsupnE:"\u2ACC\uFE00",Vvdash:"\u22AA",vzigzag:"\u299A",wcirc:"\u0175",Wcirc:"\u0174",wedbar:"\u2A5F",wedge:"\u2227",Wedge:"\u22C0",wedgeq:"\u2259",weierp:"\u2118",wfr:"\u{1D534}",Wfr:"\u{1D51A}",wopf:"\u{1D568}",Wopf:"\u{1D54E}",wp:"\u2118",wr:"\u2240",wreath:"\u2240",wscr:"\u{1D4CC}",Wscr:"\u{1D4B2}",xcap:"\u22C2",xcirc:"\u25EF",xcup:"\u22C3",xdtri:"\u25BD",xfr:"\u{1D535}",Xfr:"\u{1D51B}",xharr:"\u27F7",xhArr:"\u27FA",xi:"\u03BE",Xi:"\u039E",xlarr:"\u27F5",xlArr:"\u27F8",xmap:"\u27FC",xnis:"\u22FB",xodot:"\u2A00",xopf:"\u{1D569}",Xopf:"\u{1D54F}",xoplus:"\u2A01",xotime:"\u2A02",xrarr:"\u27F6",xrArr:"\u27F9",xscr:"\u{1D4CD}",Xscr:"\u{1D4B3}",xsqcup:"\u2A06",xuplus:"\u2A04",xutri:"\u25B3",xvee:"\u22C1",xwedge:"\u22C0",yacute:"\xFD",Yacute:"\xDD",yacy:"\u044F",YAcy:"\u042F",ycirc:"\u0177",Ycirc:"\u0176",ycy:"\u044B",Ycy:"\u042B",yen:"\xA5",yfr:"\u{1D536}",Yfr:"\u{1D51C}",yicy:"\u0457",YIcy:"\u0407",yopf:"\u{1D56A}",Yopf:"\u{1D550}",yscr:"\u{1D4CE}",Yscr:"\u{1D4B4}",yucy:"\u044E",YUcy:"\u042E",yuml:"\xFF",Yuml:"\u0178",zacute:"\u017A",Zacute:"\u0179",zcaron:"\u017E",Zcaron:"\u017D",zcy:"\u0437",Zcy:"\u0417",zdot:"\u017C",Zdot:"\u017B",zeetrf:"\u2128",ZeroWidthSpace:"\u200B",zeta:"\u03B6",Zeta:"\u0396",zfr:"\u{1D537}",Zfr:"\u2128",zhcy:"\u0436",ZHcy:"\u0416",zigrarr:"\u21DD",zopf:"\u{1D56B}",Zopf:"\u2124",zscr:"\u{1D4CF}",Zscr:"\u{1D4B5}",zwj:"\u200D",zwnj:"\u200C"},v={aacute:"\xE1",Aacute:"\xC1",acirc:"\xE2",Acirc:"\xC2",acute:"\xB4",aelig:"\xE6",AElig:"\xC6",agrave:"\xE0",Agrave:"\xC0",amp:"&",AMP:"&",aring:"\xE5",Aring:"\xC5",atilde:"\xE3",Atilde:"\xC3",auml:"\xE4",Auml:"\xC4",brvbar:"\xA6",ccedil:"\xE7",Ccedil:"\xC7",cedil:"\xB8",cent:"\xA2",copy:"\xA9",COPY:"\xA9",curren:"\xA4",deg:"\xB0",divide:"\xF7",eacute:"\xE9",Eacute:"\xC9",ecirc:"\xEA",Ecirc:"\xCA",egrave:"\xE8",Egrave:"\xC8",eth:"\xF0",ETH:"\xD0",euml:"\xEB",Euml:"\xCB",frac12:"\xBD",frac14:"\xBC",frac34:"\xBE",gt:">",GT:">",iacute:"\xED",Iacute:"\xCD",icirc:"\xEE",Icirc:"\xCE",iexcl:"\xA1",igrave:"\xEC",Igrave:"\xCC",iquest:"\xBF",iuml:"\xEF",Iuml:"\xCF",laquo:"\xAB",lt:"<",LT:"<",macr:"\xAF",micro:"\xB5",middot:"\xB7",nbsp:"\xA0",not:"\xAC",ntilde:"\xF1",Ntilde:"\xD1",oacute:"\xF3",Oacute:"\xD3",ocirc:"\xF4",Ocirc:"\xD4",ograve:"\xF2",Ograve:"\xD2",ordf:"\xAA",ordm:"\xBA",oslash:"\xF8",Oslash:"\xD8",otilde:"\xF5",Otilde:"\xD5",ouml:"\xF6",Ouml:"\xD6",para:"\xB6",plusmn:"\xB1",pound:"\xA3",quot:'"',QUOT:'"',raquo:"\xBB",reg:"\xAE",REG:"\xAE",sect:"\xA7",shy:"\xAD",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",szlig:"\xDF",thorn:"\xFE",THORN:"\xDE",times:"\xD7",uacute:"\xFA",Uacute:"\xDA",ucirc:"\xFB",Ucirc:"\xDB",ugrave:"\xF9",Ugrave:"\xD9",uml:"\xA8",uuml:"\xFC",Uuml:"\xDC",yacute:"\xFD",Yacute:"\xDD",yen:"\xA5",yuml:"\xFF"},x={"0":"\uFFFD","128":"\u20AC","130":"\u201A","131":"\u0192","132":"\u201E","133":"\u2026","134":"\u2020","135":"\u2021","136":"\u02C6","137":"\u2030","138":"\u0160","139":"\u2039","140":"\u0152","142":"\u017D","145":"\u2018","146":"\u2019","147":"\u201C","148":"\u201D","149":"\u2022","150":"\u2013","151":"\u2014","152":"\u02DC","153":"\u2122","154":"\u0161","155":"\u203A","156":"\u0153","158":"\u017E","159":"\u0178"},g=[1,2,3,4,5,6,7,8,11,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,64976,64977,64978,64979,64980,64981,64982,64983,64984,64985,64986,64987,64988,64989,64990,64991,64992,64993,64994,64995,64996,64997,64998,64999,65e3,65001,65002,65003,65004,65005,65006,65007,65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111],m=String.fromCharCode,z={},y=z.hasOwnProperty,b=function(N,I){return y.call(N,I)},S=function(N,I){for(var j=-1,O=N.length;++j<O;)if(N[j]==I)return!0;return!1},_=function(N,I){if(!N)return I;var j={},O;for(O in I)j[O]=b(N,O)?N[O]:I[O];return j},A=function(N,I){var j="";return N>=55296&&N<=57343||N>1114111?(I&&w("character reference outside the permissible Unicode range"),"\uFFFD"):b(x,N)?(I&&w("disallowed character reference"),x[N]):(I&&S(g,N)&&w("disallowed character reference"),N>65535&&(N-=65536,j+=m(N>>>10&1023|55296),N=56320|N&1023),j+=m(N),j)},P=function(N){return"&#x"+N.toString(16).toUpperCase()+";"},R=function(N){return"&#"+N+";"},w=function(N){throw Error("Parse error: "+N)},D=function(N,I){I=_(I,D.options);var j=I.strict;j&&u.test(N)&&w("forbidden code point");var O=I.encodeEverything,q=I.useNamedReferences,Z=I.allowUnsafeSymbols,ne=I.decimal?R:P,ce=function(U){return ne(U.charCodeAt(0))};return O?(N=N.replace(s,function(U){return q&&b(c,U)?"&"+c[U]+";":ce(U)}),q&&(N=N.replace(/>\u20D2/g,">⃒").replace(/<\u20D2/g,"<⃒").replace(/fj/g,"fj")),q&&(N=N.replace(a,function(U){return"&"+c[U]+";"}))):q?(Z||(N=N.replace(l,function(U){return"&"+c[U]+";"})),N=N.replace(/>\u20D2/g,">⃒").replace(/<\u20D2/g,"<⃒"),N=N.replace(a,function(U){return"&"+c[U]+";"})):Z||(N=N.replace(l,ce)),N.replace(n,function(U){var Le=U.charCodeAt(0),de=U.charCodeAt(1),ze=(Le-55296)*1024+de-56320+65536;return ne(ze)}).replace(r,ce)};D.options={allowUnsafeSymbols:!1,encodeEverything:!1,strict:!1,useNamedReferences:!1,decimal:!1};var C=function(N,I){I=_(I,C.options);var j=I.strict;return j&&f.test(N)&&w("malformed character reference"),N.replace(d,function(O,q,Z,ne,ce,U,Le,de,ze){var ue,De,Se,J,se,ie;return q?(se=q,p[se]):Z?(se=Z,ie=ne,ie&&I.isAttributeValue?(j&&ie=="="&&w("`&` did not start a character reference"),O):(j&&w("named character reference was not terminated by a semicolon"),v[se]+(ie||""))):ce?(Se=ce,De=U,j&&!De&&w("character reference was not terminated by a semicolon"),ue=parseInt(Se,10),A(ue,j)):Le?(J=Le,De=de,j&&!De&&w("character reference was not terminated by a semicolon"),ue=parseInt(J,16),A(ue,j)):(j&&w("named character reference was not terminated by a semicolon"),O)})};C.options={isAttributeValue:!1,strict:!1};var V=function(N){return N.replace(l,function(I){return h[I]})},H={version:"1.2.0",encode:D,decode:C,escape:V,unescape:C};if(typeof define=="function"&&typeof define.amd=="object"&&define.amd)define(function(){return H});else if(e&&!e.nodeType)if(t)t.exports=H;else for(var T in H)b(H,T)&&(e[T]=H[T]);else o.he=H})(fr)});var U3=ss(n2=>{"use strict";var uu=n2&&n2.__values||function(o){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&o[e],i=0;if(t)return t.call(o);if(o&&typeof o.length=="number")return{next:function(){return o&&i>=o.length&&(o=void 0),{value:o&&o[i++],done:!o}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(n2,"__esModule",{value:!0});n2.getWordsByCategory=n2.wordList=void 0;n2.wordList={noun:[{word:"accountant",categories:["profession"]},{word:"ability",categories:["thing"]},{word:"accident",categories:["thing"]},{word:"account",categories:["thing"]},{word:"action",categories:["thing"]},{word:"activity",categories:["thing"]},{word:"actor",categories:["profession"]},{word:"ad",categories:["media"]},{word:"addition",categories:["thing"]},{word:"address",categories:["thing"]},{word:"adult",categories:["people"]},{word:"advantage",categories:["thing"]},{word:"advertisement",categories:["media"]},{word:"afternoon",categories:["time"]},{word:"agency",categories:["thing"]},{word:"agent",categories:["people"]},{word:"air",categories:["thing"]},{word:"airline",categories:["transportation"]},{word:"airplane",categories:["transportation"]},{word:"airport",categories:["transportation","place"]},{word:"alarm",categories:["thing"]},{word:"alligator",categories:["animals"]},{word:"ambulance",categories:["health"]},{word:"analyst",categories:["profession"]},{word:"angle",categories:["thing"]},{word:"animal",categories:["animals"]},{word:"answer",categories:["thing"]},{word:"apartment",categories:["place"]},{word:"apple",categories:["food"]},{word:"application",categories:["thing"]},{word:"appointment",categories:["thing"]},{word:"architect",categories:["profession"]},{word:"argument",categories:["thing"]},{word:"area",categories:["thing"]},{word:"arm",categories:["thing"]},{word:"army",categories:["thing"]},{word:"art",categories:["thing"]},{word:"article",categories:["thing"]},{word:"artist",categories:["profession"]},{word:"australia",categories:["place"]},{word:"author",categories:["profession"]},{word:"autumn",categories:["time"]},{word:"baby",categories:["people","family"]},{word:"baker",categories:["profession"]},{word:"balloon",categories:["thing"]},{word:"banana",categories:["food"]},{word:"barista",categories:["profession"]},{word:"battery",categories:["thing"]},{word:"beach",categories:["place"]},{word:"bear",categories:["animals"]},{word:"beard",categories:["thing"]},{word:"bed",categories:["thing"]},{word:"belgium",categories:["place"]},{word:"bird",categories:["animals"]},{word:"bit",categories:["thing","technology"]},{word:"book",categories:["thing","education"]},{word:"boots",categories:["thing"]},{word:"boy",categories:["people"]},{word:"branch",categories:["thing"]},{word:"breakfast",categories:["thing"]},{word:"brother",categories:["family"]},{word:"businessperson",categories:["people","business"]},{word:"butcher",categories:["profession"]},{word:"byte",categories:["thing","technology"]},{word:"camera",categories:["thing"]},{word:"candle",categories:["thing"]},{word:"car",categories:["transportation"]},{word:"caravan",categories:["transportation"]},{word:"carpenter",categories:["profession"]},{word:"carpet",categories:["thing"]},{word:"cartoon",categories:["media"]},{word:"cat",categories:["animals"]},{word:"chef",categories:["profession"]},{word:"child",categories:["people","family"]},{word:"china",categories:["place"]},{word:"church",categories:["religion"]},{word:"city",categories:["place"]},{word:"coat",categories:["thing"]},{word:"coffeeshop",categories:["place"]},{word:"computer",categories:["thing","technology"]},{word:"continent",categories:["place"]},{word:"controller",categories:["thing","technology"]},{word:"country",categories:["place"]},{word:"cpu",categories:["thing","technology"]},{word:"crayon",categories:["thing"]},{word:"cricket",categories:["animals"]},{word:"crowd",categories:["people"]},{word:"daughter",categories:["family"]},{word:"dawn",categories:["time"]},{word:"daybreak",categories:["time"]},{word:"death",categories:["thing"]},{word:"denmark",categories:["place"]},{word:"dentist",categories:["profession"]},{word:"diamond",categories:["thing"]},{word:"dinner",categories:["food"]},{word:"disease",categories:["thing"]},{word:"doctor",categories:["profession"]},{word:"dog",categories:["animals"]},{word:"dream",categories:["thing"]},{word:"dress",categories:["thing"]},{word:"dusk",categories:["time"]},{word:"easter",categories:["religion"]},{word:"egg",categories:["food"]},{word:"eggplant",categories:["food"]},{word:"egypt",categories:["place"]},{word:"electrician",categories:["profession"]},{word:"elephant",categories:["animals"]},{word:"energy",categories:["thing"]},{word:"engine",categories:["transportation"]},{word:"engineer",categories:["profession"]},{word:"england",categories:["place"]},{word:"eve",categories:["time"]},{word:"evening",categories:["time"]},{word:"eventide",categories:["time"]},{word:"exabyte",categories:["thing","technology"]},{word:"eye",categories:["thing"]},{word:"fall",categories:["time"]},{word:"family",categories:["family"]},{word:"farmer",categories:["profession"]},{word:"father",categories:["people","family"]},{word:"finland",categories:["place"]},{word:"fireman",categories:["profession"]},{word:"fish",categories:["animals"]},{word:"flag",categories:["thing"]},{word:"florist",categories:["profession"]},{word:"flower",categories:["thing"]},{word:"football",categories:["sports"]},{word:"forest",categories:["place"]},{word:"fountain",categories:["thing"]},{word:"france",categories:["place"]},{word:"furniture",categories:["thing"]},{word:"garage",categories:["place"]},{word:"garden",categories:["food"]},{word:"gas",categories:["transportation"]},{word:"ghost",categories:["thing"]},{word:"gigabyte",categories:["thing","technology"]},{word:"girl",categories:["people"]},{word:"glass",categories:["thing"]},{word:"gold",categories:["thing"]},{word:"gpu",categories:["thing","technology"]},{word:"grandmother",categories:["people","family"]},{word:"grass",categories:["thing"]},{word:"greece",categories:["place"]},{word:"guitar",categories:["thing"]},{word:"hair",categories:["thing"]},{word:"hairdresser",categories:["profession"]},{word:"hamburger",categories:["food"]},{word:"helicopter",categories:["transportation"]},{word:"helmet",categories:["thing"]},{word:"holiday",categories:["thing"]},{word:"honey",categories:["food"]},{word:"horse",categories:["animals"]},{word:"hospital",categories:["place"]},{word:"house",categories:["place"]},{word:"hydrogen",categories:["science"]},{word:"ice",categories:["science"]},{word:"insect",categories:["animals"]},{word:"insurance",categories:["thing"]},{word:"intern",categories:["profession"]},{word:"iron",categories:["science"]},{word:"island",categories:["place"]},{word:"jackal",categories:["animals"]},{word:"jelly",categories:["food"]},{word:"jewellery",categories:["thing"]},{word:"jordan",categories:["place"]},{word:"journalist",categories:["profession"]},{word:"joystick",categories:["thing","technology"]},{word:"judge",categories:["profession"]},{word:"juice",categories:["food"]},{word:"kangaroo",categories:["animals"]},{word:"keyboard",categories:["thing","technology"]},{word:"kilobyte",categories:["thing","technology"]},{word:"king",categories:["people"]},{word:"kitchen",categories:["place"]},{word:"kite",categories:["thing"]},{word:"knife",categories:["thing"]},{word:"lamp",categories:["thing"]},{word:"laptop",categories:["thing","technology"]},{word:"lawyer",categories:["profession"]},{word:"leather",categories:["thing"]},{word:"librarian",categories:["profession"]},{word:"library",categories:["place"]},{word:"lifeguard",categories:["profession"]},{word:"lighter",categories:["thing"]},{word:"lion",categories:["animals"]},{word:"lizard",categories:["animals"]},{word:"lock",categories:["thing"]},{word:"london",categories:["place"]},{word:"lunch",categories:["food"]},{word:"machine",categories:["science"]},{word:"magazine",categories:["media"]},{word:"magician",categories:["people"]},{word:"man",categories:["people"]},{word:"manchester",categories:["place"]},{word:"market",categories:["place"]},{word:"match",categories:["thing"]},{word:"mechanic",categories:["profession"]},{word:"megabyte",categories:["thing","technology"]},{word:"memory",categories:["thing","technology"]},{word:"microphone",categories:["thing"]},{word:"midnight",categories:["time"]},{word:"minister",categories:["people","religion"]},{word:"monitor",categories:["thing","technology"]},{word:"monkey",categories:["animals"]},{word:"morn",categories:["time"]},{word:"morning",categories:["time"]},{word:"mother",categories:["people","family"]},{word:"motherboard",categories:["thing","technology"]},{word:"motorcycle",categories:["transportation"]},{word:"mouse",categories:["thing","technology","animals"]},{word:"musician",categories:["profession"]},{word:"nail",categories:["thing"]},{word:"napkin",categories:["thing"]},{word:"needle",categories:["thing"]},{word:"nest",categories:["thing"]},{word:"nigeria",categories:["place"]},{word:"night",categories:["time"]},{word:"nightfall",categories:["time"]},{word:"noon",categories:["time"]},{word:"notebook",categories:["thing"]},{word:"nurse",categories:["profession"]},{word:"ocean",categories:["place"]},{word:"oil",categories:["thing"]},{word:"optician",categories:["profession"]},{word:"orange",categories:["food"]},{word:"oxygen",categories:["science"]},{word:"oyster",categories:["animals"]},{word:"pager",categories:["thing","technology"]},{word:"painter",categories:["profession"]},{word:"painting",categories:["media"]},{word:"park",categories:["place"]},{word:"parrot",categories:["animals"]},{word:"pencil",categories:["thing","education"]},{word:"petabyte",categories:["thing","technology"]},{word:"pharmacist",categories:["profession"]},{word:"photographer",categories:["profession"]},{word:"piano",categories:["thing"]},{word:"pillow",categories:["thing"]},{word:"pilot",categories:["profession"]},{word:"pizza",categories:["food"]},{word:"planet",categories:["science"]},{word:"plastic",categories:["thing"]},{word:"plumber",categories:["profession"]},{word:"policeman",categories:["profession"]},{word:"portugal",categories:["place"]},{word:"postman",categories:["profession"]},{word:"potato",categories:["food"]},{word:"printer",categories:["thing","technology"]},{word:"processor",categories:["thing","technology"]},{word:"psychiatrist",categories:["profession"]},{word:"queen",categories:["people"]},{word:"quill",categories:["thing"]},{word:"rain",categories:["thing"]},{word:"rainbow",categories:["science"]},{word:"raincoat",categories:["thing"]},{word:"ram",categories:["thing","technology"]},{word:"receptionist",categories:["profession"]},{word:"refrigerator",categories:["food"]},{word:"restaurant",categories:["place"]},{word:"river",categories:["thing"]},{word:"rocket",categories:["science"]},{word:"room",categories:["place"]},{word:"rose",categories:["thing"]},{word:"russia",categories:["place"]},{word:"salesclerk",categories:["people","business"]},{word:"salesmen",categories:["profession"]},{word:"sandwich",categories:["food"]},{word:"school",categories:["education"]},{word:"scientist",categories:["profession"]},{word:"scooter",categories:["transportation"]},{word:"secretary",categories:["profession"]},{word:"shampoo",categories:["thing"]},{word:"shoe",categories:["thing"]},{word:"smartphone",categories:["thing","technology"]},{word:"soccer",categories:["sports"]},{word:"solstice",categories:["time"]},{word:"spoon",categories:["thing"]},{word:"spring",categories:["time"]},{word:"state",categories:["place"]},{word:"stone",categories:["thing"]},{word:"student",categories:["people","education"]},{word:"sugar",categories:["food"]},{word:"summer",categories:["time"]},{word:"sundown",categories:["time"]},{word:"sunset",categories:["time"]},{word:"sweden",categories:["place"]},{word:"table",categories:["thing"]},{word:"tailor",categories:["profession"]},{word:"teacher",categories:["people","education","profession"]},{word:"teenager",categories:["people","family"]},{word:"telephone",categories:["thing"]},{word:"television",categories:["media"]},{word:"tent",categories:["thing"]},{word:"terabyte",categories:["thing","technology"]},{word:"thailand",categories:["place"]},{word:"tiger",categories:["animals"]},{word:"toddler",categories:["people","family"]},{word:"tomato",categories:["food"]},{word:"toothbrush",categories:["thing"]},{word:"traffic",categories:["thing"]},{word:"train",categories:["transportation"]},{word:"translator",categories:["profession"]},{word:"truck",categories:["thing","transportation"]},{word:"twilight",categories:["time"]},{word:"uganda",categories:["place"]},{word:"umbrella",categories:["thing"]},{word:"van",categories:["transportation"]},{word:"vase",categories:["thing"]},{word:"vegetable",categories:["food"]},{word:"vr",categories:["thing","technology"]},{word:"vulture",categories:["animals"]},{word:"waiter",categories:["profession"]},{word:"waitress",categories:["profession"]},{word:"wall",categories:["thing"]},{word:"whale",categories:["animals"]},{word:"window",categories:["thing"]},{word:"winter",categories:["time"]},{word:"wire",categories:["thing"]},{word:"wolf",categories:["animals"]},{word:"woman",categories:["people"]},{word:"xylophone",categories:["thing"]},{word:"yacht",categories:["transportation"]},{word:"yak",categories:["animals"]},{word:"yottabyte",categories:["thing","technology"]},{word:"zebra",categories:["animals"]},{word:"zettabyte",categories:["thing","technology"]},{word:"zoo",categories:["animals"]}],adjective:[{word:"abandoned",categories:["condition"]},{word:"abiding",categories:["personality"]},{word:"able",categories:["condition"]},{word:"abrasive",categories:["condition","personality"]},{word:"abnormal",categories:["condition"]},{word:"absurd",categories:["condition"]},{word:"abundant",categories:["quantity"]},{word:"acceptable",categories:["condition"]},{word:"acidic",categories:["taste"]},{word:"acoustic",categories:["sounds"]},{word:"acrid",categories:["condition"]},{word:"adamant",categories:["personality"]},{word:"adorable",categories:["personality"]},{word:"adventurous",categories:["personality"]},{word:"aggressive",categories:["personality"]},{word:"agitated",categories:["personality"]},{word:"agreeable",categories:["personality"]},{word:"alert",categories:["condition"]},{word:"alive",categories:["condition"]},{word:"aloof",categories:["personality"]},{word:"ambitious",categories:["personality"]},{word:"ancient",categories:["time"]},{word:"angry",categories:["personality"]},{word:"annoyed",categories:["personality"]},{word:"antsy",categories:["personality"]},{word:"anxious",categories:["personality"]},{word:"appalling",categories:["personality"]},{word:"appetizing",categories:["taste"]},{word:"apprehensive",categories:["personality"]},{word:"arrogant",categories:["personality"]},{word:"ashamed",categories:["personality"]},{word:"astonishing",categories:["personality"]},{word:"attractive",categories:["appearance"]},{word:"average",categories:["appearance"]},{word:"bad",categories:["condition"]},{word:"bald",categories:["appearance"]},{word:"bashful",categories:["personality"]},{word:"beautiful",categories:["appearance"]},{word:"beefy",categories:["appearance"]},{word:"belligerent",categories:["personality"]},{word:"bent",categories:["condition"]},{word:"best",categories:["condition"]},{word:"better",categories:["condition"]},{word:"bewildered",categories:["personality"]},{word:"big",categories:["size"]},{word:"billions",categories:["quantity"]},{word:"billowy",categories:["appearance"]},{word:"bitter",categories:["taste"]},{word:"black",categories:["color"]},{word:"bland",categories:["taste"]},{word:"blue",categories:["color"]},{word:"blushing",categories:["appearance"]},{word:"bored",categories:["personality"]},{word:"boring",categories:["personality"]},{word:"boundless",categories:["personality"]},{word:"brainy",categories:["personality"]},{word:"brash",categories:["personality"]},{word:"brave",categories:["personality"]},{word:"breezy",categories:["touch"]},{word:"brief",categories:["time"]},{word:"bright",categories:["appearance"]},{word:"broad",categories:["shapes"]},{word:"broken",categories:["condition"]},{word:"brown",categories:["color"]},{word:"bulky",categories:["appearance"]},{word:"bumpy",categories:["touch"]},{word:"burly",categories:["appearance"]},{word:"busy",categories:["personality"]},{word:"cagey",categories:["personality"]},{word:"calm",categories:["personality"]},{word:"callous",categories:["personality"]},{word:"careful",categories:["condition"]},{word:"chilly",categories:["touch"]},{word:"chubby",categories:["appearance"]},{word:"clean",categories:["appearance"]},{word:"clever",categories:["condition"]},{word:"clumsy",categories:["personality"]},{word:"cold",categories:["touch"]},{word:"colossal",categories:["size"]},{word:"cool",categories:["touch"]},{word:"crashing",categories:["sounds"]},{word:"creamy",categories:["taste"]},{word:"crooked",categories:["shapes"]},{word:"cuddly",categories:["touch"]},{word:"curved",categories:["shapes"]},{word:"damaged",categories:["touch"]},{word:"damp",categories:["touch"]},{word:"dazzling",categories:["appearance"]},{word:"dead",categories:["condition"]},{word:"deafening",categories:["sounds"]},{word:"deep",categories:["shapes"]},{word:"defeated",categories:["personality"]},{word:"delicious",categories:["taste"]},{word:"delightful",categories:["personality"]},{word:"dirty",categories:["touch"]},{word:"disgusting",categories:["taste"]},{word:"drab",categories:["appearance"]},{word:"dry",categories:["touch"]},{word:"eager",categories:["personality"]},{word:"early",categories:["time"]},{word:"easy",categories:["condition"]},{word:"echoing",categories:["sounds"]},{word:"elegant",categories:["appearance"]},{word:"embarrassed",categories:["personality"]},{word:"enough",categories:["quantity"]},{word:"faint",categories:["sounds"]},{word:"faithful",categories:["personality"]},{word:"famous",categories:["condition"]},{word:"fancy",categories:["appearance"]},{word:"fast",categories:["time"]},{word:"fat",categories:["size"]},{word:"few",categories:["quantity"]},{word:"fierce",categories:["personality"]},{word:"fit",categories:["appearance"]},{word:"flabby",categories:["appearance"]},{word:"flaky",categories:["touch"]},{word:"flat",categories:["shapes"]},{word:"fluffy",categories:["touch"]},{word:"freezing",categories:["touch"]},{word:"fresh",categories:["taste"]},{word:"full",categories:["quantity"]},{word:"future",categories:["time"]},{word:"gentle",categories:["personality"]},{word:"gifted",categories:["condition"]},{word:"gigantic",categories:["size"]},{word:"glamorous",categories:["appearance"]},{word:"gorgeous",categories:["appearance"]},{word:"gray",categories:["color"]},{word:"greasy",categories:["touch","taste"]},{word:"great",categories:["size"]},{word:"green",categories:["color"]},{word:"grumpy",categories:["personality"]},{word:"hallowed",categories:["condition"]},{word:"handsome",categories:["appearance"]},{word:"happy",categories:["personality"]},{word:"harsh",categories:["sounds"]},{word:"helpful",categories:["condition"]},{word:"helpless",categories:["personality"]},{word:"high",categories:["shapes"]},{word:"hissing",categories:["sounds"]},{word:"hollow",categories:["shapes"]},{word:"hot",categories:["touch","taste"]},{word:"howling",categories:["sounds"]},{word:"huge",categories:["size"]},{word:"hundreds",categories:["quantity"]},{word:"icy",categories:["touch"]},{word:"immense",categories:["size"]},{word:"important",categories:["condition"]},{word:"incalculable",categories:["quantity"]},{word:"inexpensive",categories:["condition"]},{word:"itchy",categories:["personality"]},{word:"jealous",categories:["personality"]},{word:"jolly",categories:["personality"]},{word:"juicy",categories:["taste"]},{word:"kind",categories:["personality"]},{word:"large",categories:["size"]},{word:"late",categories:["time"]},{word:"lazy",categories:["personality"]},{word:"lemon",categories:["color"]},{word:"limited",categories:["quantity"]},{word:"little",categories:["size","quantity"]},{word:"lively",categories:["personality"]},{word:"long",categories:["time","appearance"]},{word:"loose",categories:["touch"]},{word:"loud",categories:["sounds"]},{word:"low",categories:["shapes"]},{word:"magnificent",categories:["appearance"]},{word:"mammoth",categories:["size"]},{word:"mango",categories:["color"]},{word:"many",categories:["quantity"]},{word:"massive",categories:["size"]},{word:"mealy",categories:["condition"]},{word:"melodic",categories:["sounds"]},{word:"melted",categories:["touch"]},{word:"microscopic",categories:["size"]},{word:"millions",categories:["quantity"]},{word:"miniature",categories:["size"]},{word:"modern",categories:["time"]},{word:"moldy",categories:["taste"]},{word:"most",categories:["quantity"]},{word:"muscular",categories:["appearance"]},{word:"mushy",categories:["condition"]},{word:"mysterious",categories:["personality"]},{word:"narrow",categories:["shapes"]},{word:"nervous",categories:["personality"]},{word:"nice",categories:["personality"]},{word:"noisy",categories:["sounds"]},{word:"numerous",categories:["quantity"]},{word:"nutritious",categories:["taste"]},{word:"nutty",categories:["taste"]},{word:"obedient",categories:["personality"]},{word:"obnoxious",categories:["personality"]},{word:"odd",categories:["condition"]},{word:"old",categories:["time"]},{word:"orange",categories:["color"]},{word:"panicky",categories:["personality"]},{word:"petite",categories:["size"]},{word:"pitiful",categories:["personality"]},{word:"plain",categories:["appearance"]},{word:"plump",categories:["appearance"]},{word:"polite",categories:["personality"]},{word:"poor",categories:["condition"]},{word:"powerful",categories:["condition"]},{word:"prehistoric",categories:["time"]},{word:"prickly",categories:["touch"]},{word:"proud",categories:["personality"]},{word:"puny",categories:["size"]},{word:"purple",categories:["color"]},{word:"purring",categories:["sounds"]},{word:"putrid",categories:["taste"]},{word:"quaint",categories:["appearance"]},{word:"quick",categories:["time"]},{word:"quiet",categories:["sounds"]},{word:"rancid",categories:["taste"]},{word:"rapid",categories:["time"]},{word:"rapping",categories:["sounds"]},{word:"raspy",categories:["sounds"]},{word:"red",categories:["color"]},{word:"refined",categories:["shapes"]},{word:"repulsive",categories:["personality"]},{word:"rhythmic",categories:["sounds"]},{word:"rich",categories:["condition"]},{word:"ripe",categories:["taste"]},{word:"rotten",categories:["taste"]},{word:"rough",categories:["touch"]},{word:"round",categories:["shapes"]},{word:"salmon",categories:["color"]},{word:"salty",categories:["taste"]},{word:"savory",categories:["taste"]},{word:"scarce",categories:["quantity"]},{word:"scary",categories:["personality"]},{word:"scrawny",categories:["size"]},{word:"screeching",categories:["sounds"]},{word:"scruffy",categories:["appearance"]},{word:"shaggy",categories:["touch"]},{word:"shallow",categories:["shapes"]},{word:"shapely",categories:["appearance"]},{word:"sharp",categories:["touch"]},{word:"short",categories:["size","appearance","time"]},{word:"shrilling",categories:["sounds"]},{word:"shy",categories:["condition"]},{word:"silly",categories:["personality"]},{word:"skinny",categories:["appearance","shapes"]},{word:"slimy",categories:["touch"]},{word:"slow",categories:["time"]},{word:"small",categories:["size"]},{word:"some",categories:["quantity"]},{word:"sour",categories:["taste"]},{word:"sparse",categories:["quantity"]},{word:"spicy",categories:["taste"]},{word:"spoiled",categories:["taste"]},{word:"square",categories:["shapes"]},{word:"squeaking",categories:["sounds"]},{word:"stale",categories:["taste"]},{word:"steep",categories:["shapes"]},{word:"sticky",categories:["touch"]},{word:"stocky",categories:["appearance"]},{word:"straight",categories:["shapes"]},{word:"strong",categories:["touch"]},{word:"substantial",categories:["quantity"]},{word:"sweet",categories:["taste"]},{word:"swift",categories:["time"]},{word:"tall",categories:["size"]},{word:"tangy",categories:["taste"]},{word:"tart",categories:["taste"]},{word:"tasteless",categories:["taste"]},{word:"tasty",categories:["taste"]},{word:"teeny",categories:["size"]},{word:"tender",categories:["condition"]},{word:"thankful",categories:["personality"]},{word:"thoughtless",categories:["personality"]},{word:"thousands",categories:["quantity"]},{word:"thundering",categories:["sounds"]},{word:"tight",categories:["touch"]},{word:"tinkling",categories:["sounds"]},{word:"tiny",categories:["size"]},{word:"ugly",categories:["appearance"]},{word:"uneven",categories:["touch"]},{word:"unimportant",categories:["condition"]},{word:"uninterested",categories:["condition"]},{word:"unkempt",categories:["appearance"]},{word:"unsightly",categories:["appearance"]},{word:"uptight",categories:["personality"]},{word:"vast",categories:["condition"]},{word:"victorious",categories:["personality"]},{word:"wailing",categories:["sounds"]},{word:"warm",categories:["touch"]},{word:"weak",categories:["touch"]},{word:"wet",categories:["touch"]},{word:"whining",categories:["sounds"]},{word:"whispering",categories:["sounds"]},{word:"white",categories:["color"]},{word:"wide",categories:["shapes"]},{word:"witty",categories:["personality"]},{word:"wonderful",categories:["personality"]},{word:"wooden",categories:["touch"]},{word:"worried",categories:["personality"]},{word:"wrong",categories:["condition"]},{word:"yellow",categories:["color"]},{word:"young",categories:["time"]},{word:"yummy",categories:["taste"]},{word:"zealous",categories:["personality"]}]};function fu(o,e){var t,i;e===void 0&&(e=[]);var n=new Set(e),s=[];try{for(var r=uu(n2.wordList[o]),a=r.next();!a.done;a=r.next()){var c=a.value;(e.length===0||c.categories.some(function(l){return n.has(l)}))&&s.push(c.word)}}catch(l){t={error:l}}finally{try{a&&!a.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}return s}n2.getWordsByCategory=fu});var W3=ss(H2=>{"use strict";var Sr=H2&&H2.__assign||function(){return Sr=Object.assign||function(o){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(o[n]=e[n])}return o},Sr.apply(this,arguments)};Object.defineProperty(H2,"__esModule",{value:!0});H2.totalUniqueSlugs=H2.generateSlug=void 0;var $4=U3(),G3=3;function du(o,e){for(var t=o||G3,i={partsOfSpeech:q3(t),categories:{},format:"kebab"},n=Sr(Sr({},i),e),s=[],r=0;r<t;r++){var a=n.partsOfSpeech[r],c=$4.getWordsByCategory(n.partsOfSpeech[r],n.categories[a]),l=c[Math.floor(Math.random()*c.length)];s.push(l)}return pu(s,n.format)}H2.generateSlug=du;function q3(o){for(var e=[],t=0;t<o-1;t++)e.push("adjective");return e.push("noun"),e}function pu(o,e){return e==="kebab"?o.join("-").toLowerCase():e==="camel"?o.map(function(t,i){return i===0?t.toLowerCase():t[0].toUpperCase()+t.slice(1).toLowerCase()}).join(""):e==="lower"?o.join(" ").toLowerCase():e==="sentence"?o.map(function(t,i){return i===0?t[0].toUpperCase()+t.slice(1).toLowerCase():t}).join(" "):o.map(function(t){return t[0].toUpperCase()+t.slice(1).toLowerCase()}).join(" ")}function mu(o,e){for(var t,i,n=$4.getWordsByCategory("adjective",(t=e==null?void 0:e.categories)===null||t===void 0?void 0:t.adjective).length,s=$4.getWordsByCategory("noun",(i=e==null?void 0:e.categories)===null||i===void 0?void 0:i.noun).length,r={adjective:n,noun:s},a=o||G3,c=(e==null?void 0:e.partsOfSpeech)||q3(a),l=1,h=0;h<a;h++)l*=r[c[h]];return l}H2.totalUniqueSlugs=mu});var Vh=ss((Hh,A4)=>{(function(o,e){typeof define=="function"&&define.amd?define([],e):typeof A4=="object"&&A4.exports?A4.exports=e():o.moo=e()})(Hh,function(){"use strict";var o=Object.prototype.hasOwnProperty,e=Object.prototype.toString,t=typeof new RegExp().sticky=="boolean";function i(A){return A&&e.call(A)==="[object RegExp]"}function n(A){return A&&typeof A=="object"&&!i(A)&&!Array.isArray(A)}function s(A){return A.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function r(A){var P=new RegExp("|"+A);return P.exec("").length-1}function a(A){return"("+A+")"}function c(A){if(!A.length)return"(?!)";var P=A.map(function(R){return"(?:"+R+")"}).join("|");return"(?:"+P+")"}function l(A){if(typeof A=="string")return"(?:"+s(A)+")";if(i(A)){if(A.ignoreCase)throw new Error("RegExp /i flag not allowed");if(A.global)throw new Error("RegExp /g flag is implied");if(A.sticky)throw new Error("RegExp /y flag is implied");if(A.multiline)throw new Error("RegExp /m flag is implied");return A.source}else throw new Error("Not a pattern: "+A)}function h(A){for(var P=Object.getOwnPropertyNames(A),R=[],w=0;w<P.length;w++){var D=P[w],C=A[D],V=[].concat(C);if(D==="include"){for(var H=0;H<V.length;H++)R.push({include:V[H]});continue}var T=[];V.forEach(function(N){n(N)?(T.length&&R.push(u(D,T)),R.push(u(D,N)),T=[]):T.push(N)}),T.length&&R.push(u(D,T))}return R}function f(A){for(var P=[],R=0;R<A.length;R++){var w=A[R];if(w.include){for(var D=[].concat(w.include),C=0;C<D.length;C++)P.push({include:D[C]});continue}if(!w.type)throw new Error("Rule has no type: "+JSON.stringify(w));P.push(u(w.type,w))}return P}function u(A,P){if(n(P)||(P={match:P}),P.include)throw new Error("Matching rules cannot also include states");var R={defaultType:A,lineBreaks:!!P.error||!!P.fallback,pop:!1,next:null,push:null,error:!1,fallback:!1,value:null,type:null,shouldThrow:!1};for(var w in P)o.call(P,w)&&(R[w]=P[w]);if(typeof R.type=="string"&&A!==R.type)throw new Error("Type transform cannot be a string (type '"+R.type+"' for token '"+A+"')");var D=R.match;return R.match=Array.isArray(D)?D:D?[D]:[],R.match.sort(function(C,V){return i(C)&&i(V)?0:i(V)?-1:i(C)?1:V.length-C.length}),R}function d(A){return Array.isArray(A)?f(A):h(A)}var p=u("error",{lineBreaks:!0,shouldThrow:!0});function v(A,P){for(var R=null,w=Object.create(null),D=!0,C=null,V=[],H=[],T=0;T<A.length;T++)A[T].fallback&&(D=!1);for(var T=0;T<A.length;T++){var N=A[T];if(N.include)throw new Error("Inheritance is not allowed in stateless lexers");if(N.error||N.fallback){if(R)throw!N.fallback==!R.fallback?new Error("Multiple "+(N.fallback?"fallback":"error")+" rules not allowed (for token '"+N.defaultType+"')"):new Error("fallback and error are mutually exclusive (for token '"+N.defaultType+"')");R=N}var I=N.match.slice();if(D)for(;I.length&&typeof I[0]=="string"&&I[0].length===1;){var j=I.shift();w[j.charCodeAt(0)]=N}if(N.pop||N.push||N.next){if(!P)throw new Error("State-switching options are not allowed in stateless lexers (for token '"+N.defaultType+"')");if(N.fallback)throw new Error("State-switching options are not allowed on fallback tokens (for token '"+N.defaultType+"')")}if(I.length!==0){D=!1,V.push(N);for(var O=0;O<I.length;O++){var q=I[O];if(!!i(q)){if(C===null)C=q.unicode;else if(C!==q.unicode&&N.fallback===!1)throw new Error("If one rule is /u then all must be")}}var Z=c(I.map(l)),ne=new RegExp(Z);if(ne.test(""))throw new Error("RegExp matches empty string: "+ne);var ce=r(Z);if(ce>0)throw new Error("RegExp has capture groups: "+ne+`
|
|
Use (?: \u2026 ) instead`);if(!N.lineBreaks&&ne.test(`
|
|
`))throw new Error("Rule should declare lineBreaks: "+ne);H.push(a(Z))}}var U=R&&R.fallback,Le=t&&!U?"ym":"gm",de=t||U?"":"|";C===!0&&(Le+="u");var ze=new RegExp(c(H)+de,Le);return{regexp:ze,groups:V,fast:w,error:R||p}}function x(A){var P=v(d(A));return new y({start:P},"start")}function g(A,P,R){var w=A&&(A.push||A.next);if(w&&!R[w])throw new Error("Missing state '"+w+"' (in token '"+A.defaultType+"' of state '"+P+"')");if(A&&A.pop&&+A.pop!=1)throw new Error("pop must be 1 (in token '"+A.defaultType+"' of state '"+P+"')")}function m(A,P){var R=A.$all?d(A.$all):[];delete A.$all;var w=Object.getOwnPropertyNames(A);P||(P=w[0]);for(var D=Object.create(null),C=0;C<w.length;C++){var V=w[C];D[V]=d(A[V]).concat(R)}for(var C=0;C<w.length;C++)for(var V=w[C],H=D[V],T=Object.create(null),N=0;N<H.length;N++){var I=H[N];if(!!I.include){var j=[N,1];if(I.include!==V&&!T[I.include]){T[I.include]=!0;var O=D[I.include];if(!O)throw new Error("Cannot include nonexistent state '"+I.include+"' (in state '"+V+"')");for(var q=0;q<O.length;q++){var Z=O[q];H.indexOf(Z)===-1&&j.push(Z)}}H.splice.apply(H,j),N--}}for(var ne=Object.create(null),C=0;C<w.length;C++){var V=w[C];ne[V]=v(D[V],!0)}for(var C=0;C<w.length;C++){for(var ce=w[C],U=ne[ce],Le=U.groups,N=0;N<Le.length;N++)g(Le[N],ce,ne);for(var de=Object.getOwnPropertyNames(U.fast),N=0;N<de.length;N++)g(U.fast[de[N]],ce,ne)}return new y(ne,P)}function z(A){for(var P=Object.create(null),R=Object.create(null),w=Object.getOwnPropertyNames(A),D=0;D<w.length;D++){var C=w[D],V=A[C],H=Array.isArray(V)?V:[V];H.forEach(function(O){if((R[O.length]=R[O.length]||[]).push(O),typeof O!="string")throw new Error("keyword must be string (in keyword '"+C+"')");P[O]=C})}function T(O){return JSON.stringify(O)}var N="";N+=`switch (value.length) {
|
|
`;for(var I in R){var j=R[I];N+="case "+I+`:
|
|
`,N+=`switch (value) {
|
|
`,j.forEach(function(O){var q=P[O];N+="case "+T(O)+": return "+T(q)+`
|
|
`}),N+=`}
|
|
`}return N+=`}
|
|
`,Function("value",N)}var y=function(A,P){this.startState=P,this.states=A,this.buffer="",this.stack=[],this.reset()};y.prototype.reset=function(A,P){return this.buffer=A||"",this.index=0,this.line=P?P.line:1,this.col=P?P.col:1,this.queuedToken=P?P.queuedToken:null,this.queuedThrow=P?P.queuedThrow:null,this.setState(P?P.state:this.startState),this.stack=P&&P.stack?P.stack.slice():[],this},y.prototype.save=function(){return{line:this.line,col:this.col,state:this.state,stack:this.stack.slice(),queuedToken:this.queuedToken,queuedThrow:this.queuedThrow}},y.prototype.setState=function(A){if(!(!A||this.state===A)){this.state=A;var P=this.states[A];this.groups=P.groups,this.error=P.error,this.re=P.regexp,this.fast=P.fast}},y.prototype.popState=function(){this.setState(this.stack.pop())},y.prototype.pushState=function(A){this.stack.push(this.state),this.setState(A)};var b=t?function(A,P){return A.exec(P)}:function(A,P){var R=A.exec(P);return R[0].length===0?null:R};y.prototype._getGroup=function(A){for(var P=this.groups.length,R=0;R<P;R++)if(A[R+1]!==void 0)return this.groups[R];throw new Error("Cannot find token type for matched text")};function S(){return this.value}if(y.prototype.next=function(){var A=this.index;if(this.queuedGroup){var P=this._token(this.queuedGroup,this.queuedText,A);return this.queuedGroup=null,this.queuedText="",P}var R=this.buffer;if(A!==R.length){var w=this.fast[R.charCodeAt(A)];if(w)return this._token(w,R.charAt(A),A);var D=this.re;D.lastIndex=A;var C=b(D,R),V=this.error;if(C==null)return this._token(V,R.slice(A,R.length),A);var w=this._getGroup(C),H=C[0];return V.fallback&&C.index!==A?(this.queuedGroup=w,this.queuedText=H,this._token(V,R.slice(A,C.index),A)):this._token(w,H,A)}},y.prototype._token=function(A,P,R){var w=0;if(A.lineBreaks){var D=/\n/g,C=1;if(P===`
|
|
`)w=1;else for(;D.exec(P);)w++,C=D.lastIndex}var V={type:typeof A.type=="function"&&A.type(P)||A.defaultType,value:typeof A.value=="function"?A.value(P):P,text:P,toString:S,offset:R,lineBreaks:w,line:this.line,col:this.col},H=P.length;if(this.index+=H,this.line+=w,w!==0?this.col=H-C+1:this.col+=H,A.shouldThrow)throw new Error(this.formatError(V,"invalid syntax"));return A.pop?this.popState():A.push?this.pushState(A.push):A.next&&this.setState(A.next),V},typeof Symbol!="undefined"&&Symbol.iterator){var _=function(A){this.lexer=A};_.prototype.next=function(){var A=this.lexer.next();return{value:A,done:!A}},_.prototype[Symbol.iterator]=function(){return this},y.prototype[Symbol.iterator]=function(){return new _(this)}}return y.prototype.formatError=function(A,P){if(A==null)var R=this.buffer.slice(this.index),A={text:R,offset:this.index,lineBreaks:R.indexOf(`
|
|
`)===-1?0:1,line:this.line,col:this.col};var w=Math.max(0,A.offset-A.col+1),D=A.lineBreaks?A.text.indexOf(`
|
|
`):A.text.length,C=this.buffer.substring(w,A.offset+D);return P+=" at line "+A.line+" col "+A.col+`:
|
|
|
|
`,P+=" "+C+`
|
|
`,P+=" "+Array(A.col).join(" ")+"^",P},y.prototype.clone=function(){return new y(this.states,this.state)},y.prototype.has=function(A){return!0},{compile:x,states:m,error:Object.freeze({error:!0}),fallback:Object.freeze({fallback:!0}),keywords:z}})});o7(exports,{DEFAULT_SETTINGS:()=>Er,default:()=>W6});var pt=Mt(require("obsidian")),$h=Mt(X6());var Y6={prefix:"fas",iconName:"dice",icon:[640,512,[],"f522","M592 192H473.26c12.69 29.59 7.12 65.2-17 89.32L320 417.58V464c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48V240c0-26.51-21.49-48-48-48zM480 376c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24zm-46.37-186.7L258.7 14.37c-19.16-19.16-50.23-19.16-69.39 0L14.37 189.3c-19.16 19.16-19.16 50.23 0 69.39L189.3 433.63c19.16 19.16 50.23 19.16 69.39 0L433.63 258.7c19.16-19.17 19.16-50.24 0-69.4zM96 248c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24zm128 128c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24zm0-128c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24zm0-128c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24zm128 128c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24z"]};var $6={prefix:"far",iconName:"copy",icon:[448,512,[],"f0c5","M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z"]};function rs(o){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?rs=function(e){return typeof e}:rs=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rs(o)}function u7(o,e){if(!(o instanceof e))throw new TypeError("Cannot call a class as a function")}function J6(o,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(o,i.key,i)}}function f7(o,e,t){return e&&J6(o.prototype,e),t&&J6(o,t),o}function d7(o,e,t){return e in o?Object.defineProperty(o,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):o[e]=t,o}function Xe(o){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{},i=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(i=i.concat(Object.getOwnPropertySymbols(t).filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),i.forEach(function(n){d7(o,n,t[n])})}return o}function Q6(o,e){return p7(o)||m7(o,e)||g7()}function p7(o){if(Array.isArray(o))return o}function m7(o,e){var t=[],i=!0,n=!1,s=void 0;try{for(var r=o[Symbol.iterator](),a;!(i=(a=r.next()).done)&&(t.push(a.value),!(e&&t.length===e));i=!0);}catch(c){n=!0,s=c}finally{try{!i&&r.return!=null&&r.return()}finally{if(n)throw s}}return t}function g7(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}var K6=function(){},D4={},e3={},v7=null,t3={mark:K6,measure:K6};try{typeof window!="undefined"&&(D4=window),typeof document!="undefined"&&(e3=document),typeof MutationObserver!="undefined"&&(v7=MutationObserver),typeof performance!="undefined"&&(t3=performance)}catch{}var x7=D4.navigator||{},i3=x7.userAgent,n3=i3===void 0?"":i3,rr=D4,Ot=e3;var ar=t3,Ky=!!rr.document,H4=!!Ot.documentElement&&!!Ot.head&&typeof Ot.addEventListener=="function"&&typeof Ot.createElement=="function",ew=~n3.indexOf("MSIE")||~n3.indexOf("Trident/"),J1="___FONT_AWESOME___";var s3="fa",r3="svg-inline--fa",y7="data-fa-i2svg";var tw=function(){try{return!0}catch{return!1}}();var a3=[1,2,3,4,5,6,7,8,9,10],w7=a3.concat([11,12,13,14,15,16,17,18,19,20]);var vi={GROUP:"group",SWAP_OPACITY:"swap-opacity",PRIMARY:"primary",SECONDARY:"secondary"},iw=["xs","sm","lg","fw","ul","li","border","pull-left","pull-right","spin","pulse","rotate-90","rotate-180","rotate-270","flip-horizontal","flip-vertical","flip-both","stack","stack-1x","stack-2x","inverse","layers","layers-text","layers-counter",vi.GROUP,vi.SWAP_OPACITY,vi.PRIMARY,vi.SECONDARY].concat(a3.map(function(o){return"".concat(o,"x")})).concat(w7.map(function(o){return"w-".concat(o)})),o3=rr.FontAwesomeConfig||{};function b7(o){var e=Ot.querySelector("script["+o+"]");if(e)return e.getAttribute(o)}function M7(o){return o===""?!0:o==="false"?!1:o==="true"?!0:o}Ot&&typeof Ot.querySelector=="function"&&(c3=[["data-family-prefix","familyPrefix"],["data-replacement-class","replacementClass"],["data-auto-replace-svg","autoReplaceSvg"],["data-auto-add-css","autoAddCss"],["data-auto-a11y","autoA11y"],["data-search-pseudo-elements","searchPseudoElements"],["data-observe-mutations","observeMutations"],["data-mutate-approach","mutateApproach"],["data-keep-original-source","keepOriginalSource"],["data-measure-performance","measurePerformance"],["data-show-missing-icons","showMissingIcons"]],c3.forEach(function(o){var e=Q6(o,2),t=e[0],i=e[1],n=M7(b7(t));n!=null&&(o3[i]=n)}));var c3,z7={familyPrefix:s3,replacementClass:r3,autoReplaceSvg:!0,autoAddCss:!0,autoA11y:!0,searchPseudoElements:!1,observeMutations:!0,mutateApproach:"async",keepOriginalSource:!0,measurePerformance:!1,showMissingIcons:!0},V4=Xe({},z7,o3);V4.autoReplaceSvg||(V4.observeMutations=!1);var e1=Xe({},V4);rr.FontAwesomeConfig=e1;var Q1=rr||{};Q1[J1]||(Q1[J1]={});Q1[J1].styles||(Q1[J1].styles={});Q1[J1].hooks||(Q1[J1].hooks={});Q1[J1].shims||(Q1[J1].shims=[]);var R1=Q1[J1],C7=[],A7=function o(){Ot.removeEventListener("DOMContentLoaded",o),R4=1,C7.map(function(e){return e()})},R4=!1;H4&&(R4=(Ot.documentElement.doScroll?/^loaded|^c/:/^loaded|^i|^c/).test(Ot.readyState),R4||Ot.addEventListener("DOMContentLoaded",A7));var N4="pending",l3="settled",or="fulfilled",cr="rejected",S7=function(){},h3=typeof global!="undefined"&&typeof global.process!="undefined"&&typeof global.process.emit=="function",_7=typeof setImmediate=="undefined"?setTimeout:setImmediate,as=[],F4;function E7(){for(var o=0;o<as.length;o++)as[o][0](as[o][1]);as=[],F4=!1}function lr(o,e){as.push([o,e]),F4||(F4=!0,_7(E7,0))}function L7(o,e){function t(n){B4(e,n)}function i(n){os(e,n)}try{o(t,i)}catch(n){i(n)}}function u3(o){var e=o.owner,t=e._state,i=e._data,n=o[t],s=o.then;if(typeof n=="function"){t=or;try{i=n(i)}catch(r){os(s,r)}}f3(s,i)||(t===or&&B4(s,i),t===cr&&os(s,i))}function f3(o,e){var t;try{if(o===e)throw new TypeError("A promises callback cannot return that same promise.");if(e&&(typeof e=="function"||rs(e)==="object")){var i=e.then;if(typeof i=="function")return i.call(e,function(n){t||(t=!0,e===n?d3(o,n):B4(o,n))},function(n){t||(t=!0,os(o,n))}),!0}}catch(n){return t||os(o,n),!0}return!1}function B4(o,e){(o===e||!f3(o,e))&&d3(o,e)}function d3(o,e){o._state===N4&&(o._state=l3,o._data=e,lr(T7,o))}function os(o,e){o._state===N4&&(o._state=l3,o._data=e,lr(D7,o))}function p3(o){o._then=o._then.forEach(u3)}function T7(o){o._state=or,p3(o)}function D7(o){o._state=cr,p3(o),!o._handled&&h3&&global.process.emit("unhandledRejection",o._data,o)}function H7(o){global.process.emit("rejectionHandled",o)}function l1(o){if(typeof o!="function")throw new TypeError("Promise resolver "+o+" is not a function");if(!(this instanceof l1))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this._then=[],L7(o,this)}l1.prototype={constructor:l1,_state:N4,_then:null,_data:void 0,_handled:!1,then:function(e,t){var i={owner:this,then:new this.constructor(S7),fulfilled:e,rejected:t};return(t||e)&&!this._handled&&(this._handled=!0,this._state===cr&&h3&&lr(H7,this)),this._state===or||this._state===cr?lr(u3,i):this._then.push(i),i.then},catch:function(e){return this.then(null,e)}};l1.all=function(o){if(!Array.isArray(o))throw new TypeError("You must pass an array to Promise.all().");return new l1(function(e,t){var i=[],n=0;function s(c){return n++,function(l){i[c]=l,--n||e(i)}}for(var r=0,a;r<o.length;r++)a=o[r],a&&typeof a.then=="function"?a.then(s(r),t):i[r]=a;n||e(i)})};l1.race=function(o){if(!Array.isArray(o))throw new TypeError("You must pass an array to Promise.race().");return new l1(function(e,t){for(var i=0,n;i<o.length;i++)n=o[i],n&&typeof n.then=="function"?n.then(e,t):e(n)})};l1.resolve=function(o){return o&&rs(o)==="object"&&o.constructor===l1?o:new l1(function(e){e(o)})};l1.reject=function(o){return new l1(function(e,t){t(o)})};var ji={size:16,x:0,y:0,rotate:0,flipX:!1,flipY:!1};function V7(o){if(!(!o||!H4)){var e=Ot.createElement("style");e.setAttribute("type","text/css"),e.innerHTML=o;for(var t=Ot.head.childNodes,i=null,n=t.length-1;n>-1;n--){var s=t[n],r=(s.tagName||"").toUpperCase();["STYLE","LINK"].indexOf(r)>-1&&(i=s)}return Ot.head.insertBefore(e,i),o}}var R7="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";function hr(){for(var o=12,e="";o-- >0;)e+=R7[Math.random()*62|0];return e}function m3(o){return"".concat(o).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function N7(o){return Object.keys(o||{}).reduce(function(e,t){return e+"".concat(t,'="').concat(m3(o[t]),'" ')},"").trim()}function g3(o){return Object.keys(o||{}).reduce(function(e,t){return e+"".concat(t,": ").concat(o[t],";")},"")}function v3(o){return o.size!==ji.size||o.x!==ji.x||o.y!==ji.y||o.rotate!==ji.rotate||o.flipX||o.flipY}function x3(o){var e=o.transform,t=o.containerWidth,i=o.iconWidth,n={transform:"translate(".concat(t/2," 256)")},s="translate(".concat(e.x*32,", ").concat(e.y*32,") "),r="scale(".concat(e.size/16*(e.flipX?-1:1),", ").concat(e.size/16*(e.flipY?-1:1),") "),a="rotate(".concat(e.rotate," 0 0)"),c={transform:"".concat(s," ").concat(r," ").concat(a)},l={transform:"translate(".concat(i/2*-1," -256)")};return{outer:n,inner:c,path:l}}var P4={x:0,y:0,width:"100%",height:"100%"};function y3(o){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return o.attributes&&(o.attributes.fill||e)&&(o.attributes.fill="black"),o}function F7(o){return o.tag==="g"?o.children:[o]}function B7(o){var e=o.children,t=o.attributes,i=o.main,n=o.mask,s=o.maskId,r=o.transform,a=i.width,c=i.icon,l=n.width,h=n.icon,f=x3({transform:r,containerWidth:l,iconWidth:a}),u={tag:"rect",attributes:Xe({},P4,{fill:"white"})},d=c.children?{children:c.children.map(y3)}:{},p={tag:"g",attributes:Xe({},f.inner),children:[y3(Xe({tag:c.tag,attributes:Xe({},c.attributes,f.path)},d))]},v={tag:"g",attributes:Xe({},f.outer),children:[p]},x="mask-".concat(s||hr()),g="clip-".concat(s||hr()),m={tag:"mask",attributes:Xe({},P4,{id:x,maskUnits:"userSpaceOnUse",maskContentUnits:"userSpaceOnUse"}),children:[u,v]},z={tag:"defs",children:[{tag:"clipPath",attributes:{id:g},children:F7(h)},m]};return e.push(z,{tag:"rect",attributes:Xe({fill:"currentColor","clip-path":"url(#".concat(g,")"),mask:"url(#".concat(x,")")},P4)}),{children:e,attributes:t}}function P7(o){var e=o.children,t=o.attributes,i=o.main,n=o.transform,s=o.styles,r=g3(s);if(r.length>0&&(t.style=r),v3(n)){var a=x3({transform:n,containerWidth:i.width,iconWidth:i.width});e.push({tag:"g",attributes:Xe({},a.outer),children:[{tag:"g",attributes:Xe({},a.inner),children:[{tag:i.icon.tag,children:i.icon.children,attributes:Xe({},i.icon.attributes,a.path)}]}]})}else e.push(i.icon);return{children:e,attributes:t}}function I7(o){var e=o.children,t=o.main,i=o.mask,n=o.attributes,s=o.styles,r=o.transform;if(v3(r)&&t.found&&!i.found){var a=t.width,c=t.height,l={x:a/c/2,y:.5};n.style=g3(Xe({},s,{"transform-origin":"".concat(l.x+r.x/16,"em ").concat(l.y+r.y/16,"em")}))}return[{tag:"svg",attributes:n,children:e}]}function k7(o){var e=o.prefix,t=o.iconName,i=o.children,n=o.attributes,s=o.symbol,r=s===!0?"".concat(e,"-").concat(e1.familyPrefix,"-").concat(t):s;return[{tag:"svg",attributes:{style:"display: none;"},children:[{tag:"symbol",attributes:Xe({},n,{id:r}),children:i}]}]}function O7(o){var e=o.icons,t=e.main,i=e.mask,n=o.prefix,s=o.iconName,r=o.transform,a=o.symbol,c=o.title,l=o.maskId,h=o.titleId,f=o.extra,u=o.watchable,d=u===void 0?!1:u,p=i.found?i:t,v=p.width,x=p.height,g=n==="fak",m=g?"":"fa-w-".concat(Math.ceil(v/x*16)),z=[e1.replacementClass,s?"".concat(e1.familyPrefix,"-").concat(s):"",m].filter(function(R){return f.classes.indexOf(R)===-1}).filter(function(R){return R!==""||!!R}).concat(f.classes).join(" "),y={children:[],attributes:Xe({},f.attributes,{"data-prefix":n,"data-icon":s,class:z,role:f.attributes.role||"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 ".concat(v," ").concat(x)})},b=g&&!~f.classes.indexOf("fa-fw")?{width:"".concat(v/x*16*.0625,"em")}:{};d&&(y.attributes[y7]=""),c&&y.children.push({tag:"title",attributes:{id:y.attributes["aria-labelledby"]||"title-".concat(h||hr())},children:[c]});var S=Xe({},y,{prefix:n,iconName:s,main:t,mask:i,maskId:l,transform:r,symbol:a,styles:Xe({},b,f.styles)}),_=i.found&&t.found?B7(S):P7(S),A=_.children,P=_.attributes;return S.children=A,S.attributes=P,a?k7(S):I7(S)}var w3=function(){},nw=e1.measurePerformance&&ar&&ar.mark&&ar.measure?ar:{mark:w3,measure:w3};var U7=function(e,t){return function(i,n,s,r){return e.call(t,i,n,s,r)}},I4=function(e,t,i,n){var s=Object.keys(e),r=s.length,a=n!==void 0?U7(t,n):t,c,l,h;for(i===void 0?(c=1,h=e[s[0]]):(c=0,h=i);c<r;c++)l=s[c],h=a(h,e[l],l,e);return h};function b3(o,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=t.skipHooks,n=i===void 0?!1:i,s=Object.keys(e).reduce(function(r,a){var c=e[a],l=!!c.icon;return l?r[c.iconName]=c.icon:r[a]=c,r},{});typeof R1.hooks.addPack=="function"&&!n?R1.hooks.addPack(o,s):R1.styles[o]=Xe({},R1.styles[o]||{},s),o==="fas"&&b3("fa",e)}var M3=R1.styles,G7=R1.shims,q7={},W7={},j7={},z3=function(){var e=function(n){return I4(M3,function(s,r,a){return s[a]=I4(r,n,{}),s},{})};q7=e(function(i,n,s){return n[3]&&(i[n[3]]=s),i}),W7=e(function(i,n,s){var r=n[2];return i[s]=s,r.forEach(function(a){i[a]=s}),i});var t="far"in M3;j7=I4(G7,function(i,n){var s=n[0],r=n[1],a=n[2];return r==="far"&&!t&&(r="fas"),i[s]={prefix:r,iconName:a},i},{})};z3();var sw=R1.styles;function C3(o,e,t){if(o&&o[e]&&o[e][t])return{prefix:e,iconName:t,icon:o[e][t]}}function A3(o){var e=o.tag,t=o.attributes,i=t===void 0?{}:t,n=o.children,s=n===void 0?[]:n;return typeof o=="string"?m3(o):"<".concat(e," ").concat(N7(i),">").concat(s.map(A3).join(""),"</").concat(e,">")}function k4(o){this.name="MissingIcon",this.message=o||"Icon unavailable",this.stack=new Error().stack}k4.prototype=Object.create(Error.prototype);k4.prototype.constructor=k4;var ur={fill:"currentColor"},S3={attributeType:"XML",repeatCount:"indefinite",dur:"2s"},rw={tag:"path",attributes:Xe({},ur,{d:"M156.5,447.7l-12.6,29.5c-18.7-9.5-35.9-21.2-51.5-34.9l22.7-22.7C127.6,430.5,141.5,440,156.5,447.7z M40.6,272H8.5 c1.4,21.2,5.4,41.7,11.7,61.1L50,321.2C45.1,305.5,41.8,289,40.6,272z M40.6,240c1.4-18.8,5.2-37,11.1-54.1l-29.5-12.6 C14.7,194.3,10,216.7,8.5,240H40.6z M64.3,156.5c7.8-14.9,17.2-28.8,28.1-41.5L69.7,92.3c-13.7,15.6-25.5,32.8-34.9,51.5 L64.3,156.5z M397,419.6c-13.9,12-29.4,22.3-46.1,30.4l11.9,29.8c20.7-9.9,39.8-22.6,56.9-37.6L397,419.6z M115,92.4 c13.9-12,29.4-22.3,46.1-30.4l-11.9-29.8c-20.7,9.9-39.8,22.6-56.8,37.6L115,92.4z M447.7,355.5c-7.8,14.9-17.2,28.8-28.1,41.5 l22.7,22.7c13.7-15.6,25.5-32.9,34.9-51.5L447.7,355.5z M471.4,272c-1.4,18.8-5.2,37-11.1,54.1l29.5,12.6 c7.5-21.1,12.2-43.5,13.6-66.8H471.4z M321.2,462c-15.7,5-32.2,8.2-49.2,9.4v32.1c21.2-1.4,41.7-5.4,61.1-11.7L321.2,462z M240,471.4c-18.8-1.4-37-5.2-54.1-11.1l-12.6,29.5c21.1,7.5,43.5,12.2,66.8,13.6V471.4z M462,190.8c5,15.7,8.2,32.2,9.4,49.2h32.1 c-1.4-21.2-5.4-41.7-11.7-61.1L462,190.8z M92.4,397c-12-13.9-22.3-29.4-30.4-46.1l-29.8,11.9c9.9,20.7,22.6,39.8,37.6,56.9 L92.4,397z M272,40.6c18.8,1.4,36.9,5.2,54.1,11.1l12.6-29.5C317.7,14.7,295.3,10,272,8.5V40.6z M190.8,50 c15.7-5,32.2-8.2,49.2-9.4V8.5c-21.2,1.4-41.7,5.4-61.1,11.7L190.8,50z M442.3,92.3L419.6,115c12,13.9,22.3,29.4,30.5,46.1 l29.8-11.9C470,128.5,457.3,109.4,442.3,92.3z M397,92.4l22.7-22.7c-15.6-13.7-32.8-25.5-51.5-34.9l-12.6,29.5 C370.4,72.1,384.4,81.5,397,92.4z"})},O4=Xe({},S3,{attributeName:"opacity"}),aw={tag:"circle",attributes:Xe({},ur,{cx:"256",cy:"364",r:"28"}),children:[{tag:"animate",attributes:Xe({},S3,{attributeName:"r",values:"28;14;28;28;14;28;"})},{tag:"animate",attributes:Xe({},O4,{values:"1;0;1;1;0;1;"})}]},ow={tag:"path",attributes:Xe({},ur,{opacity:"1",d:"M263.7,312h-16c-6.6,0-12-5.4-12-12c0-71,77.4-63.9,77.4-107.8c0-20-17.8-40.2-57.4-40.2c-29.1,0-44.3,9.6-59.2,28.7 c-3.9,5-11.1,6-16.2,2.4l-13.1-9.2c-5.6-3.9-6.9-11.8-2.6-17.2c21.2-27.2,46.4-44.7,91.2-44.7c52.3,0,97.4,29.8,97.4,80.2 c0,67.6-77.4,63.5-77.4,107.8C275.7,306.6,270.3,312,263.7,312z"}),children:[{tag:"animate",attributes:Xe({},O4,{values:"1;0;0;0;0;1;"})}]},cw={tag:"path",attributes:Xe({},ur,{opacity:"0",d:"M232.5,134.5l7,168c0.3,6.4,5.6,11.5,12,11.5h9c6.4,0,11.7-5.1,12-11.5l7-168c0.3-6.8-5.2-12.5-12-12.5h-23 C237.7,122,232.2,127.7,232.5,134.5z"}),children:[{tag:"animate",attributes:Xe({},O4,{values:"0;0;1;1;0;0;"})}]};var lw=R1.styles;function _3(o){var e=o[0],t=o[1],i=o.slice(4),n=Q6(i,1),s=n[0],r=null;return Array.isArray(s)?r={tag:"g",attributes:{class:"".concat(e1.familyPrefix,"-").concat(vi.GROUP)},children:[{tag:"path",attributes:{class:"".concat(e1.familyPrefix,"-").concat(vi.SECONDARY),fill:"currentColor",d:s[0]}},{tag:"path",attributes:{class:"".concat(e1.familyPrefix,"-").concat(vi.PRIMARY),fill:"currentColor",d:s[1]}}]}:r={tag:"path",attributes:{fill:"currentColor",d:s}},{found:!0,width:e,height:t,icon:r}}var hw=R1.styles;var Z7=`svg:not(:root).svg-inline--fa {
|
|
overflow: visible;
|
|
}
|
|
|
|
.svg-inline--fa {
|
|
display: inline-block;
|
|
font-size: inherit;
|
|
height: 1em;
|
|
overflow: visible;
|
|
vertical-align: -0.125em;
|
|
}
|
|
.svg-inline--fa.fa-lg {
|
|
vertical-align: -0.225em;
|
|
}
|
|
.svg-inline--fa.fa-w-1 {
|
|
width: 0.0625em;
|
|
}
|
|
.svg-inline--fa.fa-w-2 {
|
|
width: 0.125em;
|
|
}
|
|
.svg-inline--fa.fa-w-3 {
|
|
width: 0.1875em;
|
|
}
|
|
.svg-inline--fa.fa-w-4 {
|
|
width: 0.25em;
|
|
}
|
|
.svg-inline--fa.fa-w-5 {
|
|
width: 0.3125em;
|
|
}
|
|
.svg-inline--fa.fa-w-6 {
|
|
width: 0.375em;
|
|
}
|
|
.svg-inline--fa.fa-w-7 {
|
|
width: 0.4375em;
|
|
}
|
|
.svg-inline--fa.fa-w-8 {
|
|
width: 0.5em;
|
|
}
|
|
.svg-inline--fa.fa-w-9 {
|
|
width: 0.5625em;
|
|
}
|
|
.svg-inline--fa.fa-w-10 {
|
|
width: 0.625em;
|
|
}
|
|
.svg-inline--fa.fa-w-11 {
|
|
width: 0.6875em;
|
|
}
|
|
.svg-inline--fa.fa-w-12 {
|
|
width: 0.75em;
|
|
}
|
|
.svg-inline--fa.fa-w-13 {
|
|
width: 0.8125em;
|
|
}
|
|
.svg-inline--fa.fa-w-14 {
|
|
width: 0.875em;
|
|
}
|
|
.svg-inline--fa.fa-w-15 {
|
|
width: 0.9375em;
|
|
}
|
|
.svg-inline--fa.fa-w-16 {
|
|
width: 1em;
|
|
}
|
|
.svg-inline--fa.fa-w-17 {
|
|
width: 1.0625em;
|
|
}
|
|
.svg-inline--fa.fa-w-18 {
|
|
width: 1.125em;
|
|
}
|
|
.svg-inline--fa.fa-w-19 {
|
|
width: 1.1875em;
|
|
}
|
|
.svg-inline--fa.fa-w-20 {
|
|
width: 1.25em;
|
|
}
|
|
.svg-inline--fa.fa-pull-left {
|
|
margin-right: 0.3em;
|
|
width: auto;
|
|
}
|
|
.svg-inline--fa.fa-pull-right {
|
|
margin-left: 0.3em;
|
|
width: auto;
|
|
}
|
|
.svg-inline--fa.fa-border {
|
|
height: 1.5em;
|
|
}
|
|
.svg-inline--fa.fa-li {
|
|
width: 2em;
|
|
}
|
|
.svg-inline--fa.fa-fw {
|
|
width: 1.25em;
|
|
}
|
|
|
|
.fa-layers svg.svg-inline--fa {
|
|
bottom: 0;
|
|
left: 0;
|
|
margin: auto;
|
|
position: absolute;
|
|
right: 0;
|
|
top: 0;
|
|
}
|
|
|
|
.fa-layers {
|
|
display: inline-block;
|
|
height: 1em;
|
|
position: relative;
|
|
text-align: center;
|
|
vertical-align: -0.125em;
|
|
width: 1em;
|
|
}
|
|
.fa-layers svg.svg-inline--fa {
|
|
-webkit-transform-origin: center center;
|
|
transform-origin: center center;
|
|
}
|
|
|
|
.fa-layers-counter, .fa-layers-text {
|
|
display: inline-block;
|
|
position: absolute;
|
|
text-align: center;
|
|
}
|
|
|
|
.fa-layers-text {
|
|
left: 50%;
|
|
top: 50%;
|
|
-webkit-transform: translate(-50%, -50%);
|
|
transform: translate(-50%, -50%);
|
|
-webkit-transform-origin: center center;
|
|
transform-origin: center center;
|
|
}
|
|
|
|
.fa-layers-counter {
|
|
background-color: #ff253a;
|
|
border-radius: 1em;
|
|
-webkit-box-sizing: border-box;
|
|
box-sizing: border-box;
|
|
color: #fff;
|
|
height: 1.5em;
|
|
line-height: 1;
|
|
max-width: 5em;
|
|
min-width: 1.5em;
|
|
overflow: hidden;
|
|
padding: 0.25em;
|
|
right: 0;
|
|
text-overflow: ellipsis;
|
|
top: 0;
|
|
-webkit-transform: scale(0.25);
|
|
transform: scale(0.25);
|
|
-webkit-transform-origin: top right;
|
|
transform-origin: top right;
|
|
}
|
|
|
|
.fa-layers-bottom-right {
|
|
bottom: 0;
|
|
right: 0;
|
|
top: auto;
|
|
-webkit-transform: scale(0.25);
|
|
transform: scale(0.25);
|
|
-webkit-transform-origin: bottom right;
|
|
transform-origin: bottom right;
|
|
}
|
|
|
|
.fa-layers-bottom-left {
|
|
bottom: 0;
|
|
left: 0;
|
|
right: auto;
|
|
top: auto;
|
|
-webkit-transform: scale(0.25);
|
|
transform: scale(0.25);
|
|
-webkit-transform-origin: bottom left;
|
|
transform-origin: bottom left;
|
|
}
|
|
|
|
.fa-layers-top-right {
|
|
right: 0;
|
|
top: 0;
|
|
-webkit-transform: scale(0.25);
|
|
transform: scale(0.25);
|
|
-webkit-transform-origin: top right;
|
|
transform-origin: top right;
|
|
}
|
|
|
|
.fa-layers-top-left {
|
|
left: 0;
|
|
right: auto;
|
|
top: 0;
|
|
-webkit-transform: scale(0.25);
|
|
transform: scale(0.25);
|
|
-webkit-transform-origin: top left;
|
|
transform-origin: top left;
|
|
}
|
|
|
|
.fa-lg {
|
|
font-size: 1.3333333333em;
|
|
line-height: 0.75em;
|
|
vertical-align: -0.0667em;
|
|
}
|
|
|
|
.fa-xs {
|
|
font-size: 0.75em;
|
|
}
|
|
|
|
.fa-sm {
|
|
font-size: 0.875em;
|
|
}
|
|
|
|
.fa-1x {
|
|
font-size: 1em;
|
|
}
|
|
|
|
.fa-2x {
|
|
font-size: 2em;
|
|
}
|
|
|
|
.fa-3x {
|
|
font-size: 3em;
|
|
}
|
|
|
|
.fa-4x {
|
|
font-size: 4em;
|
|
}
|
|
|
|
.fa-5x {
|
|
font-size: 5em;
|
|
}
|
|
|
|
.fa-6x {
|
|
font-size: 6em;
|
|
}
|
|
|
|
.fa-7x {
|
|
font-size: 7em;
|
|
}
|
|
|
|
.fa-8x {
|
|
font-size: 8em;
|
|
}
|
|
|
|
.fa-9x {
|
|
font-size: 9em;
|
|
}
|
|
|
|
.fa-10x {
|
|
font-size: 10em;
|
|
}
|
|
|
|
.fa-fw {
|
|
text-align: center;
|
|
width: 1.25em;
|
|
}
|
|
|
|
.fa-ul {
|
|
list-style-type: none;
|
|
margin-left: 2.5em;
|
|
padding-left: 0;
|
|
}
|
|
.fa-ul > li {
|
|
position: relative;
|
|
}
|
|
|
|
.fa-li {
|
|
left: -2em;
|
|
position: absolute;
|
|
text-align: center;
|
|
width: 2em;
|
|
line-height: inherit;
|
|
}
|
|
|
|
.fa-border {
|
|
border: solid 0.08em #eee;
|
|
border-radius: 0.1em;
|
|
padding: 0.2em 0.25em 0.15em;
|
|
}
|
|
|
|
.fa-pull-left {
|
|
float: left;
|
|
}
|
|
|
|
.fa-pull-right {
|
|
float: right;
|
|
}
|
|
|
|
.fa.fa-pull-left,
|
|
.fas.fa-pull-left,
|
|
.far.fa-pull-left,
|
|
.fal.fa-pull-left,
|
|
.fab.fa-pull-left {
|
|
margin-right: 0.3em;
|
|
}
|
|
.fa.fa-pull-right,
|
|
.fas.fa-pull-right,
|
|
.far.fa-pull-right,
|
|
.fal.fa-pull-right,
|
|
.fab.fa-pull-right {
|
|
margin-left: 0.3em;
|
|
}
|
|
|
|
.fa-spin {
|
|
-webkit-animation: fa-spin 2s infinite linear;
|
|
animation: fa-spin 2s infinite linear;
|
|
}
|
|
|
|
.fa-pulse {
|
|
-webkit-animation: fa-spin 1s infinite steps(8);
|
|
animation: fa-spin 1s infinite steps(8);
|
|
}
|
|
|
|
@-webkit-keyframes fa-spin {
|
|
0% {
|
|
-webkit-transform: rotate(0deg);
|
|
transform: rotate(0deg);
|
|
}
|
|
100% {
|
|
-webkit-transform: rotate(360deg);
|
|
transform: rotate(360deg);
|
|
}
|
|
}
|
|
|
|
@keyframes fa-spin {
|
|
0% {
|
|
-webkit-transform: rotate(0deg);
|
|
transform: rotate(0deg);
|
|
}
|
|
100% {
|
|
-webkit-transform: rotate(360deg);
|
|
transform: rotate(360deg);
|
|
}
|
|
}
|
|
.fa-rotate-90 {
|
|
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";
|
|
-webkit-transform: rotate(90deg);
|
|
transform: rotate(90deg);
|
|
}
|
|
|
|
.fa-rotate-180 {
|
|
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";
|
|
-webkit-transform: rotate(180deg);
|
|
transform: rotate(180deg);
|
|
}
|
|
|
|
.fa-rotate-270 {
|
|
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";
|
|
-webkit-transform: rotate(270deg);
|
|
transform: rotate(270deg);
|
|
}
|
|
|
|
.fa-flip-horizontal {
|
|
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";
|
|
-webkit-transform: scale(-1, 1);
|
|
transform: scale(-1, 1);
|
|
}
|
|
|
|
.fa-flip-vertical {
|
|
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";
|
|
-webkit-transform: scale(1, -1);
|
|
transform: scale(1, -1);
|
|
}
|
|
|
|
.fa-flip-both, .fa-flip-horizontal.fa-flip-vertical {
|
|
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";
|
|
-webkit-transform: scale(-1, -1);
|
|
transform: scale(-1, -1);
|
|
}
|
|
|
|
:root .fa-rotate-90,
|
|
:root .fa-rotate-180,
|
|
:root .fa-rotate-270,
|
|
:root .fa-flip-horizontal,
|
|
:root .fa-flip-vertical,
|
|
:root .fa-flip-both {
|
|
-webkit-filter: none;
|
|
filter: none;
|
|
}
|
|
|
|
.fa-stack {
|
|
display: inline-block;
|
|
height: 2em;
|
|
position: relative;
|
|
width: 2.5em;
|
|
}
|
|
|
|
.fa-stack-1x,
|
|
.fa-stack-2x {
|
|
bottom: 0;
|
|
left: 0;
|
|
margin: auto;
|
|
position: absolute;
|
|
right: 0;
|
|
top: 0;
|
|
}
|
|
|
|
.svg-inline--fa.fa-stack-1x {
|
|
height: 1em;
|
|
width: 1.25em;
|
|
}
|
|
.svg-inline--fa.fa-stack-2x {
|
|
height: 2em;
|
|
width: 2.5em;
|
|
}
|
|
|
|
.fa-inverse {
|
|
color: #fff;
|
|
}
|
|
|
|
.sr-only {
|
|
border: 0;
|
|
clip: rect(0, 0, 0, 0);
|
|
height: 1px;
|
|
margin: -1px;
|
|
overflow: hidden;
|
|
padding: 0;
|
|
position: absolute;
|
|
width: 1px;
|
|
}
|
|
|
|
.sr-only-focusable:active, .sr-only-focusable:focus {
|
|
clip: auto;
|
|
height: auto;
|
|
margin: 0;
|
|
overflow: visible;
|
|
position: static;
|
|
width: auto;
|
|
}
|
|
|
|
.svg-inline--fa .fa-primary {
|
|
fill: var(--fa-primary-color, currentColor);
|
|
opacity: 1;
|
|
opacity: var(--fa-primary-opacity, 1);
|
|
}
|
|
|
|
.svg-inline--fa .fa-secondary {
|
|
fill: var(--fa-secondary-color, currentColor);
|
|
opacity: 0.4;
|
|
opacity: var(--fa-secondary-opacity, 0.4);
|
|
}
|
|
|
|
.svg-inline--fa.fa-swap-opacity .fa-primary {
|
|
opacity: 0.4;
|
|
opacity: var(--fa-secondary-opacity, 0.4);
|
|
}
|
|
|
|
.svg-inline--fa.fa-swap-opacity .fa-secondary {
|
|
opacity: 1;
|
|
opacity: var(--fa-primary-opacity, 1);
|
|
}
|
|
|
|
.svg-inline--fa mask .fa-primary,
|
|
.svg-inline--fa mask .fa-secondary {
|
|
fill: black;
|
|
}
|
|
|
|
.fad.fa-inverse {
|
|
color: #fff;
|
|
}`;function X7(){var o=s3,e=r3,t=e1.familyPrefix,i=e1.replacementClass,n=Z7;if(t!==o||i!==e){var s=new RegExp("\\.".concat(o,"\\-"),"g"),r=new RegExp("\\--".concat(o,"\\-"),"g"),a=new RegExp("\\.".concat(e),"g");n=n.replace(s,".".concat(t,"-")).replace(r,"--".concat(t,"-")).replace(a,".".concat(i))}return n}var Y7=function(){function o(){u7(this,o),this.definitions={}}return f7(o,[{key:"add",value:function(){for(var t=this,i=arguments.length,n=new Array(i),s=0;s<i;s++)n[s]=arguments[s];var r=n.reduce(this._pullDefinitions,{});Object.keys(r).forEach(function(a){t.definitions[a]=Xe({},t.definitions[a]||{},r[a]),b3(a,r[a]),z3()})}},{key:"reset",value:function(){this.definitions={}}},{key:"_pullDefinitions",value:function(t,i){var n=i.prefix&&i.iconName&&i.icon?{0:i}:i;return Object.keys(n).map(function(s){var r=n[s],a=r.prefix,c=r.iconName,l=r.icon;t[a]||(t[a]={}),t[a][c]=l}),t}}]),o}();function $7(){e1.autoAddCss&&!L3&&(V7(X7()),L3=!0)}function J7(o,e){return Object.defineProperty(o,"abstract",{get:e}),Object.defineProperty(o,"html",{get:function(){return o.abstract.map(function(i){return A3(i)})}}),Object.defineProperty(o,"node",{get:function(){if(!!H4){var i=Ot.createElement("div");return i.innerHTML=o.html,i.children}}}),o}function E3(o){var e=o.prefix,t=e===void 0?"fa":e,i=o.iconName;if(!!i)return C3(K7.definitions,t,i)||C3(R1.styles,t,i)}function Q7(o){return function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=(e||{}).icon?e:E3(e||{}),n=t.mask;return n&&(n=(n||{}).icon?n:E3(n||{})),o(i,Xe({},t,{mask:n}))}}var K7=new Y7;var L3=!1;var U4=Q7(function(o){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.transform,i=t===void 0?ji:t,n=e.symbol,s=n===void 0?!1:n,r=e.mask,a=r===void 0?null:r,c=e.maskId,l=c===void 0?null:c,h=e.title,f=h===void 0?null:h,u=e.titleId,d=u===void 0?null:u,p=e.classes,v=p===void 0?[]:p,x=e.attributes,g=x===void 0?{}:x,m=e.styles,z=m===void 0?{}:m;if(!!o){var y=o.prefix,b=o.iconName,S=o.icon;return J7(Xe({type:"icon"},o),function(){return $7(),e1.autoA11y&&(f?g["aria-labelledby"]="".concat(e1.replacementClass,"-title-").concat(d||hr()):(g["aria-hidden"]="true",g.focusable="false")),O7({icons:{main:_3(S),mask:a?_3(a.icon):{found:!1,width:null,height:null,icon:{}}},prefix:y,iconName:b,transform:Xe({},ji,i),symbol:s,title:f,maskId:l,titleId:d,extra:{attributes:g,styles:z,classes:v}})})}});function G4(o,e){let t=Object.keys(e).map(i=>eu(o,i,e[i]));return t.length===1?t[0]:function(){t.forEach(i=>i())}}function eu(o,e,t){let i=o[e],n=o.hasOwnProperty(e),s=t(i);return i&&Object.setPrototypeOf(s,i),Object.setPrototypeOf(r,s),o[e]=r,a;function r(...c){return s===i&&o[e]===r&&a(),s.apply(this,c)}function a(){o[e]===r&&(n?o[e]=i:delete o[e]),s!==i&&(s=i,Object.setPrototypeOf(r,i||Function))}}var Jh=Mt(T3());var q4=/(?:(?<roll>\d+)[Dd])?#(?<query>[\p{Letter}\p{Emoji_Presentation}\w/-]+)(?:\|(?<collapse>[\+-]))?(?:\|(?<types>[^\+-]+))?/u,D3=/(?:(?<roll>\d+)[Dd]?)?dv\((?<query>.+)\)(?:\|(?<collapse>[\+-]))?(?:\|(?<types>[^\+-]+))?/u,H3=/(?<diceRoll>.*)?(?:\[.*\]\(|\[\[)(?<link>.+?)#?\^(?<block>.+?)(?:\]\]|\))(?:\|(?<header>.+))?/,dr=/(?:(?<roll>\d+)[Dd])?(?:\[.*\]\(|\[\[)(?<link>.+)(?:\]\]|\))\|?(?<types>.+)?/;var m1="dice-roller-icon",N1="dice-roller-copy";var L2=Mt(require("obsidian"));var zt=(n=>(n.None="None",n.Normal="Normal",n.Up="Up",n.Down="Down",n))(zt||{}),ht=(i=>(i.None="None",i.Average="Average",i.Roll="Roll",i))(ht||{});function V3(o,e,t){[...o].slice(e).reverse().forEach(([n,s])=>{o.set(n+1,s)}),o.set(e,t)}var K1=Mt(require("obsidian"));var pr=class extends K1.Events{getRandomBetween(e,t){let i=new Uint32Array(1);crypto.getRandomValues(i);let n=i[0]/(4294967295+1);return Math.floor(n*(t-e+1))+e}},W4=class extends pr{constructor(e,t="",i=e.data.showDice){super();this.plugin=e;this.original=t;this.loaded=!1;this.containerEl=createSpan({cls:"dice-roller",attr:{"aria-label-position":"top","data-dice":this.original}});this.resultEl=this.containerEl.createSpan("dice-roller-result");i?(this.iconEl=this.containerEl.createSpan({cls:"dice-roller-button"}),(0,K1.setIcon)(this.iconEl,m1),this.iconEl.onclick=this.onClick.bind(this)):this.containerEl.addClass("no-icon"),this.containerEl.onclick=this.onClick.bind(this)}setTooltip(){this.plugin.data.displayResultsInline||this.containerEl.setAttrs({"aria-label":this.tooltip})}getRandomBetween(e,t){let i=new Uint32Array(1);crypto.getRandomValues(i);let n=i[0]/(4294967295+1);return Math.floor(n*(t-e+1))+e}async render(){this.setTooltip(),await this.build()}async onClick(e){e.stopPropagation(),e.stopImmediatePropagation(),window.getSelection()?.isCollapsed&&await this.roll()}},mr=class extends W4{constructor(e,t,i,n=e.data.showDice){super(e,t,n);this.plugin=e;this.original=t;this.lexemes=i;this.showDice=n;this.save=!1}get inlineText(){return`${this.tooltip.split(`
|
|
`).join(" -> ")} -> `}},xi=class extends mr{},gr=class extends xi{constructor(e,t,i,n,s=e.data.showDice){super(e,t,[i],s);this.plugin=e;this.original=t;this.lexeme=i;this.source=n;this.watch=!0;this.getPath(),this.init=this.getFile()}async getFile(){if(this.file=this.plugin.app.metadataCache.getFirstLinkpathDest(this.path,this.source),!this.file||!(this.file instanceof K1.TFile))throw new Error("Could not load file.");await this.load()}},ls=class extends gr{constructor(e,t,i,n,s=!0,r=e.data.showDice){super(e,t,i,n,r);this.plugin=e;this.original=t;this.lexeme=i;this.inline=s;this.plugin.data.displayAsEmbed&&(this.containerEl.addClasses(["has-embed","markdown-embed"]),this.resultEl.addClass("internal-embed")),this.resultEl.setAttrs({src:n}),this.copy=this.containerEl.createDiv({cls:"dice-content-copy dice-roller-button no-show",attr:{"aria-label":"Copy Contents"}}),this.copy.addEventListener("click",a=>{a.stopPropagation(),navigator.clipboard.writeText(this.transformResultsToString()).then(async()=>{new K1.Notice("Result copied to clipboard.")})}),(0,K1.setIcon)(this.copy,N1)}getEmbedClass(){return this.plugin.data.displayAsEmbed?"markdown-embed":""}},j4=class extends W4{constructor(e,t,i){super(e,"");this.options=t;this.rolls=i}get tooltip(){return`${this.options.toString()}
|
|
|
|
${this.results.toString()}`}async roll(){let e=[...this.options];return this.results=[...Array(this.rolls)].map(()=>{let t=e[this.getRandomBetween(0,e.length-1)];return e.splice(e.indexOf(t),1),t}).filter(t=>t),this.render(),this.trigger("new-result"),this.result=this.results[0],this.results[0]}async build(){this.resultEl.empty(),this.resultEl.setText(this.results.toString())}};var vr,tu,hs,R3,xr,iu,t1=class{constructor(e,t,i={value:`${e}`,conditions:[],type:"dice"}){this.renderer=t;this.lexeme=i;at(this,vr);at(this,hs);at(this,xr);this.modifiers=new Map;this.possibilities=[];this.results=new Map;this.shapes=new Map;this.modifiersAllowed=!0;this.static=!1;this.conditions=[];this.fudge=!1;this.shouldRender=!1;if(!/(\-?\d+)[dD]?(\d+|%|\[\d+,\s?\d+\])?/.test(`${e}`))throw new Error("Non parseable dice string passed to DiceRoll.");this.dice=`${e}`.split(" ").join(""),/^-?\d+(?:\.\d+)?$/.test(this.dice)&&(this.static=!0,this.modifiersAllowed=!1);let[,n,s="1"]=this.dice.match(/(\-?\d+)[dD](%|F|-?\d+|\[\d+(?:[ \t]*,[ \t]*\d+)+\])/)||[,1,"1"];n=Number(n),this.multiplier=n<0?-1:1;let r=1,a=isNaN(Number(s))?1:Number(s);this.rolls=Math.abs(Number(n))||1,/\[\d+(?:[ \t]*,[ \t]*\d+)+\]/.test(s)?this.possibilities=s.replace(/[\[\]\s]/g,"").split(",").map(c=>Number(c)):s==="F"?(this.possibilities=[-1,0,1],this.fudge=!0):(s==="%"?a=100:a=Number(s),Number(a)<0&&!r&&(r=-1),Number(a)<Number(r)&&([a,r]=[r,a]),this.possibilities=[...Array(Number(a)).keys()].map(c=>c+r)),this.conditions=this.lexeme.conditions??[]}get faces(){return{max:this.possibilities[this.possibilities.length-1],min:this.possibilities[0]}}getShapes(e){if(this.shapes.has(e))return this.shapes.get(e);let t=this.renderer.getDiceForRoller(this);return e!=null&&this.shapes.set(e,t),t}get text(){return`${this.result}`}get result(){if(this.static)return this.multiplier*Number(this.dice);let e=[...this.results].map(([,{usable:t,value:i}])=>t?i:0);return this.multiplier*e.reduce((t,i)=>t+i,0)}get display(){if(this.static)return`${this.result}`;let e=[`[${[...this.results].map(([,{modifiers:t,display:i}])=>`${i}${[...t].join("")}`).join(", ")}]`];return this.conditions.length&&e.push(this.conditions.map(({result:t,operator:i})=>`${i}${t}`).join("")),e.join("")}get modifierText(){let e=this.conditions.map(({value:i})=>i).join(""),t=[...this.modifiers].map(([i,{conditionals:n,value:s}])=>{let r=n.map(a=>a.value);return`${s}${r.join("")}`}).join("");return`${e}${t}`}keepLow(e=1){if(!this.modifiersAllowed){new L2.Notice("Modifiers are only allowed on dice rolls.");return}[...this.results].sort((t,i)=>t[1].value-i[1].value).slice(e-this.results.size).forEach(([t])=>{let i=this.results.get(t);i.usable=!1,i.modifiers.add("d"),this.results.set(t,{...i})})}keepHigh(e=1){if(!this.modifiersAllowed){new L2.Notice("Modifiers are only allowed on dice rolls.");return}[...this.results].sort((t,i)=>i[1].value-t[1].value).slice(e).forEach(([t])=>{let i=this.results.get(t);i.usable=!1,i.modifiers.add("d"),this.results.set(t,{...i})})}async reroll(e,t){if(!this.modifiersAllowed){new L2.Notice("Modifiers are only allowed on dice rolls.");return}t.length||t.push({operator:"=",comparer:this.faces.min,lexemes:[{value:`${this.faces.min}`,text:`${this.faces.min}`,type:"dice"}],value:""});let i=0,n=[...this.results].filter(([,{value:s}])=>this.checkCondition(s,t));for(;i<e&&n.length>0;){let s=[];for(let[r,a]of n)s.push(new Promise(async c=>{a.modifiers.add("r");let l=this.getShapes(r),h=await this.getValue(l);a.value=h,a.display=`${h}`,c()}));await Promise.all(s),n=n.filter(([,{value:r}])=>this.checkCondition(r,t)),i++}n.forEach(([s,r])=>{this.results.set(s,r)})}async explode(e,t,i=!1){if(!this.modifiersAllowed){new L2.Notice("Modifiers are only allowed on dice rolls.");return}t.length||t.push({operator:"=",comparer:this.faces.max,lexemes:[{value:`${this.faces.max}`,text:`${this.faces.max}`,type:"dice"}],value:""});let n=[...this.results].filter(([,{value:r}])=>this.checkCondition(r,t)),s=0;await Promise.all(n.map(async([r,a])=>{if(i){let c=await this.getValue(),l=0;for(a.modifiers.add("!"),a.value+=c,a.display=`${a.value}`,this.results.set(r,a);l<e&&this.checkCondition(c,t);)l++,c=await this.getValue(),a.value+=c,a.display=`${a.value}`,this.results.set(r,a)}else{let c=a.value,l=0;for(;l<e&&this.checkCondition(c,t);)this.results.get(r+s+l).modifiers.add("!"),c=await this.getValue(),V3(this.results,r+s+l+1,Ze(this,hs,R3).call(this,c)),l++;s+=l}}))}canRender(){return this.possibilities.length!==this.faces.max&&!this.fudge?!1:[...Array(this.faces.max).keys()].map(t=>this.faces.min+t).every(t=>this.possibilities.includes(t))}async getValue(e){let t;if(this.shouldRender&&this.canRender()){let i=e??this.renderer.getDiceForRoller(this)??[];await this.renderer.addDice(i),t=Ze(this,vr,tu).call(this,i)}else t=this.getValueSync();return t}getValueSync(){return this.getRandomValue()}getMaxPossible(){return this.static?Number(this.dice):this.multiplier===-1?this.multiplier*Math.min(...this.possibilities)*this.rolls:Math.max(...this.possibilities)*this.rolls}getMinPossible(){return this.static?Number(this.dice):this.multiplier===-1?this.multiplier*Math.max(...this.possibilities)*this.rolls:Math.min(...this.possibilities)*this.rolls}async applyModifiers(){for(let[e,t]of this.modifiers)e=="kh"||e=="kl"||await this.applyModifier(e,t);this.modifiers.has("kh")&&await this.applyModifier("kh",this.modifiers.get("kh")),this.modifiers.has("kl")&&await this.applyModifier("kl",this.modifiers.get("kl"))}setResults(e){this.results=new Map([...e].map(([t,i])=>[t,Ze(this,hs,R3).call(this,i)])),this.updateResultArray()}rollSync(){let e=new Map;for(let t=0;t<this.rolls;t++)e.set(t,this.getValueSync());return this.setResults(e),this.applyModifiers(),this.conditions?.length&&this.applyConditions(),[...e.values()]}async roll(){this.results=new Map,this.shapes=new Map;let e=await Ze(this,xr,iu).call(this);return this.setResults(e),await this.applyModifiers(),this.conditions?.length&&this.applyConditions(),[...e.values()]}applyConditions(){for(let e of this.results.values()){let t=this.conditions.find(({operator:n})=>n==="-="||n==="=-");if(t&&e.value===t.comparer){e.value=-1,e.modifiers.add("-");continue}this.checkCondition(e.value,this.conditions)?(e.modifiers.add("*"),e.value=1):e.usable=!1}}updateResultArray(){this.resultArray=[...this.results.values()].map(e=>e.value)}async applyModifier(e,t){switch(e){case"sort":{let i;t.value=="sa"?i=[...this.results.values()].sort((n,s)=>n.value-s.value):i=[...this.results.values()].sort((n,s)=>s.value-n.value),this.results=new Map([...this.results.keys()].map(n=>[n,i[n]])),this.updateResultArray();break}case"kh":{this.keepHigh(t.data);break}case"kl":{this.keepLow(t.data);break}case"!":{await this.explode(t.data,t.conditionals);break}case"!!":{await this.explode(t.data,t.conditionals,!0);break}case"r":{await this.reroll(t.data,t.conditionals);break}case"u":{await this.makeUnique();break}case"condition":}}async makeUnique(){let e=[...this.results.values()];if(new Set(this.possibilities).size<this.rolls||new Set(e.map(i=>i.value)).size==this.results.size)return;let t=0;for(;new Set(e.map(i=>i.value)).size!=this.results.size&&t<100;){let i=[];for(let[n,s]of this.results)i.push(new Promise(async r=>{let a=e.find(c=>c.value==s.value&&c!=s);a&&(a.value=await this.getValue(this.getShapes(n)),a.display=`${a.value}`,a.modifiers.add("u")),r()}));await Promise.all(i),e=[...this.results.values()],t++}}checkCondition(e,t){if(!t||!t.length)return e;let i=!1;for(let n of t){let{operator:s,comparer:r,lexemes:a}=n;if(Number.isNaN(e)||!s?.length||!r)continue;let c=new N3(r,a);if(c.rollSync(),n.result=c.result,!Number.isNaN(n.result)){switch(s){case"=":i=e===n.result;break;case"!=":case"=!":i=e!==n.result;break;case"<":i=e<n.result;break;case"<=":i=e<=n.result;break;case">":i=e>n.result;break;case">=":i=e>=n.result;break}if(i)return i}}return i}allowAverage(){return!0}average(){return this.possibilities.reduce((e,t)=>e+t)/this.possibilities.length}getRandomValue(){let e=Math.floor(Math.random()*this.possibilities.length);return this.possibilities[e]}getGeometries(){return[...this.shapes.values()].flat()}async render(){this.shouldRender=!0,await this.roll(),this.shouldRender=!1}};vr=new WeakSet,tu=function(e=[]){if(!e.length)return this.getValueSync();let t=e.map(i=>i.getUpsideValue());if(this.faces.max===100){let[i,n]=t;return i===10&&n==10?100:(n==10&&(n=0),i==10&&(i=0),i*10+n)}return t.reduce((i,n)=>i+n)},hs=new WeakSet,R3=function(e=0){return{usable:!0,value:e,display:`${e}`,modifiers:new Set}},xr=new WeakSet,iu=async function(){let e=new Map;if(this.static)e.set(0,Number(this.dice));else{let t=[];for(let i=0;i<this.rolls;i++)t.push(new Promise(async n=>{let s=await this.getValue(this.getShapes(i));e.set(i,s),n()}));await Promise.all(t)}return e};var e2=class extends t1{constructor(e,t,i){super("3d6",t,i);this.dice=e}get doubles(){return new Set([...this.results].map(([,{usable:e,value:t}])=>e?t:0)).size<3}get result(){return this.static?Number(this.dice):[...this.results].map(([,{usable:t,value:i}])=>t?i:0).reduce((t,i)=>t+i,0)}get display(){let e=[];for(let t of this.results){if(t[0]==0&&this.doubles){e.push(`${t[1].value}S`);continue}e.push(`${t[1].value}`)}return`[${e.join(", ")}]`}allowAverage(){return!1}},Z4=class extends t1{constructor(e,t,i){super(e,t,i);this.dice=e;this.stack=[];let n=`${this.faces.max}`.split("");for(let s=0;s<this.rolls;s++){let r=[];for(let a of n){let c=new t1(`1d${a}`,t);r.push(c),c.roll()}this.stack.push(r)}}get result(){return this.stack.map(e=>Number(e.map(t=>t.result).join(""))).reduce((e,t)=>e+t)}get display(){return this.stack.map(e=>e.map(t=>t.result).join(",")).join("|")}async roll(){return!this.stack||!this.stack.length?super.roll():(this.stack.forEach(e=>e.map(t=>t.roll())),[...this.stack.map(e=>e.map(t=>t.result)).flat()])}allowAverage(){return!1}},N3=class extends pr{constructor(e,t){super();this.original=e;this.lexemes=t;this.operators={"+":(e,t)=>e+t,"-":(e,t)=>e-t,"*":(e,t)=>e*t,"/":(e,t)=>e/t,"^":(e,t)=>Math.pow(e,t)};this.stack=[];this.stackCopy=[];this.stunted="";this.dice=[]}async roll(){return this.rollSync()}rollSync(){this.stunted="",this.parseLexemes();let e=this.stack.pop();return e.rollSync(),e instanceof e2&&e.doubles&&(this.stunted=` - ${e.results.get(0).value} Stunt Points`),this.result=e.result,this.result}parseLexemes(){let e=0;for(let t of this.lexemes)switch(t.type){case"+":case"-":case"*":case"/":case"^":case"math":let i=this.stack.pop(),n=this.stack.pop();i.rollSync(),i instanceof e2&&i.doubles&&(this.stunted=` - ${i.results.get(0).value} Stunt Points`),n.rollSync(),n instanceof e2&&n.doubles&&(this.stunted=` - ${n.results.get(0).value} Stunt Points`);let s=this.operators[t.value](n.result,i.result);this.stackCopy.push(t.value),this.stack.push(new t1(`${s}`,null,t));break;case"u":{let r=this.dice[e-1],a=t.value?Number(t.value):1;r.modifiers.set("u",{data:a,conditionals:[],value:t.text});break}case"kh":{let r=this.dice[e-1],a=t.value?Number(t.value):1;r.modifiers.set("kh",{data:a,conditionals:[],value:t.text});break}case"dl":{let r=this.dice[e-1],a=t.value?Number(t.value):1;a=r.rolls-a,r.modifiers.set("kh",{data:a,conditionals:[],value:t.text});break}case"kl":{let r=this.dice[e-1],a=t.value?Number(t.value):1;r.modifiers.set("kl",{data:a,conditionals:[],value:t.text});break}case"dh":{let r=this.dice[e-1],a=t.value?Number(t.value):1;a=r.rolls-a,r.modifiers.set("kl",{data:a,conditionals:[],value:t.text});break}case"!":{let r=this.dice[e-1],a=Number(t.value)||1;r.modifiers.set("!",{data:a,conditionals:t.conditions??[],value:t.text});break}case"!!":{let r=this.dice[e-1],a=Number(t.value)||1;r.modifiers.set("!!",{data:a,conditionals:t.conditions??[],value:t.text});break}case"r":{let r=this.dice[e-1],a=Number(t.value)||1;r.modifiers.set("r",{data:a,conditionals:t.conditions??[],value:t.text});break}case"sort":{let r=this.dice[e-1],a=Number(t.value);r.modifiers.set("sort",{data:a,conditionals:t.conditions??[],value:t.value});break}case"dice":{if(t.parenedDice&&/^d/.test(t.value)&&this.stack.length){let r=this.stack.pop();t.value=`${r.result}${t.value}`,this.dice[e]=new t1(t.value,null,t)}this.dice[e]||(this.dice[e]=new t1(t.value,null,t)),this.stack.push(this.dice[e]),this.stackCopy.push(this.dice[e]),e++;break}case"stunt":{this.dice[e]||(this.dice[e]=new e2(t.value,null,t)),this.stack.push(this.dice[e]),this.stackCopy.push(this.dice[e]),e++;break}case"%":{this.dice[e]||(this.dice[e]=new Z4(t.value,null,t)),this.stack.push(this.dice[e]),this.stackCopy.push(this.dice[e]),e++;break}}}},Wt=class extends xi{constructor(e,t,i,n,s=e.data.showDice,r,a=e.data.initialDisplay,c=e.data.displayFormulaAfter,l=e.data.round,h=e.data.signed){super(e,t,i,s);this.plugin=e;this.original=t;this.lexemes=i;this.renderer=n;this.displayFixedText=!1;this.stunted="";this.shouldRender=!1;this.isRendering=!1;this.showFormula=!1;this.operators={"+":(e,t)=>e+t,"-":(e,t)=>e-t,"*":(e,t)=>e*t,"/":(e,t)=>e/t,"^":(e,t)=>Math.pow(e,t)};this.stack=[];this.maxStack=[];this.minStack=[];this.stackCopy=[];this.dice=[];this.hasRunOnce=!1;this.max=Number.MIN_VALUE;this.min=Number.MAX_VALUE;c&&this.containerEl.createSpan({cls:"dice-roller-formula",text:`(${t})`}),this.fixedText=r,this.expectedValue=a,this.displayFixedText=this.fixedText!=="",this.round=l,this.signed=h,this.loaded=!0,this.trigger("loaded")}get replacer(){return`${this.result}`}get resultText(){let e=[],t=0;return this.dice.forEach(i=>{let n=this.original.slice(t);e.push(n.slice(0,n.indexOf(i.lexeme.text)),i.display),t+=n.indexOf(i.lexeme.text)+i.lexeme.text.length+i.modifierText.length}),e.push(this.original.slice(t)),e.join("")}get tooltip(){return this.isRendering?this.original:this._tooltip?this._tooltip:this.expectedValue===ht.Roll||this.shouldRender?this.displayFixedText?`${this.original}
|
|
${this.result} = ${this.resultText}`:`${this.original}
|
|
${this.resultText}`:this.expectedValue===ht.Average?this.displayFixedText?`${this.original}
|
|
${this.result} = average: ${this.resultText}`:`${this.original}
|
|
average: ${this.resultText}`:`${this.original}
|
|
empty`}allowAverage(){let e=t=>t.allowAverage();return this.dynamic.every(e)}async build(){if(this.resultEl.empty(),this.expectedValue===ht.Average&&!this.shouldRender){if(this.allowAverage())for(let n of this.dynamic){let s=n.average(),r=new Map;for(let a=0;a<n.rolls;a++)r.set(a,s);n.setResults(r)}else this.expectedValue=ht.Roll;this.result=Math.floor(this.result),this.setTooltip()}let e=this.result;switch(this.round){case zt.None:{e=Math.trunc(e*100)/100;break}case zt.Normal:{e=Math.round(e);break}case zt.Up:{e=Math.ceil(e);break}case zt.Down:{e=Math.floor(e);break}}let t=this.signed&&e>0?"+":"",i;this.expectedValue===ht.None&&!this.shouldRender?(this.showDice?i=[""]:i=["\xA0"],this.showFormula&&i.unshift(this.original+" -> ")):(i=[`${t}${e}`],this.showFormula&&i.unshift(this.inlineText)),this.expectedValue=ht.Roll,this.displayFixedText?this.resultEl.setText(this.fixedText):this.resultEl.setText(i.join("")+this.stunted),this.result===this.max?this.containerEl.addClass("is-max"):this.containerEl.removeClass("is-max"),this.result===this.min?this.containerEl.addClass("is-min"):this.containerEl.removeClass("is-min")}async onClick(e){e.stopPropagation(),e.stopImmediatePropagation(),e.getModifierState("Alt")?this.expectedValue=ht.Average:e.getModifierState("Control")&&(this.expectedValue=ht.None),e.getModifierState("Shift")?(await this.roll(!0),this.hasRunOnce=!0):window.getSelection()?.isCollapsed&&await this.roll()}get dynamic(){return this.dice.filter(e=>!e.static)}get static(){return this.dice.filter(e=>e.static)}get isStatic(){return this.dice.every(e=>e.static)}rollSync(){this.stunted="",this.buildDiceTree();for(let e of this.dice)e.rollSync();return this.calculate(),this._tooltip=null,this.render(),this.trigger("new-result"),this.hasRunOnce=!0,this.result}setSpinner(){this.resultEl.empty(),(0,L2.setIcon)(this.resultEl.createDiv("should-spin"),"loader-2")}async renderDice(){this.isRendering=!0,this.setTooltip(),this.setSpinner();let e=[];for(let t of this.dice)e.push(new Promise(async i=>{await t.render(),i()}));await Promise.all(e),this.isRendering=!1,this.setTooltip()}buildDiceTree(){let e=0;for(let t of this.lexemes)switch(t.type){case"+":case"*":case"/":case"^":case"-":case"math":continue;case"u":{let i=this.dice[e-1],n=t.value?Number(t.value):1;i.modifiers.set("u",{data:n,conditionals:[],value:t.text});break}case"kh":{let i=this.dice[e-1],n=t.value?Number(t.value):1;i.modifiers.set("kh",{data:n,conditionals:[],value:t.text});break}case"dl":{let i=this.dice[e-1],n=t.value?Number(t.value):1;n=i.rolls-n,i.modifiers.set("kh",{data:n,conditionals:[],value:t.text});break}case"kl":{let i=this.dice[e-1],n=t.value?Number(t.value):1;i.modifiers.set("kl",{data:n,conditionals:[],value:t.text});break}case"dh":{let i=this.dice[e-1],n=t.value?Number(t.value):1;n=i.rolls-n,i.modifiers.set("kl",{data:n,conditionals:[],value:t.text});break}case"!":{let i=this.dice[e-1],n=Number(t.value)||1;i.modifiers.set("!",{data:n,conditionals:t.conditions??[],value:t.text});break}case"!!":{let i=this.dice[e-1],n=Number(t.value)||1;i.modifiers.set("!!",{data:n,conditionals:t.conditions??[],value:t.text});break}case"r":{let i=this.dice[e-1],n=Number(t.value)||1;i.modifiers.set("r",{data:n,conditionals:t.conditions??[],value:t.text});break}case"sort":{let i=this.dice[e-1],n=Number(t.value);i.modifiers.set("sort",{data:n,conditionals:t.conditions??[],value:t.value});break}case"dice":{if(t.parenedDice&&/^d/.test(t.value)&&this.stack.length){let i=this.stack.pop();t.value=`${i.result}${t.value}`,this.dice[e]=new t1(t.value,this.renderer,t)}this.dice[e]||(this.dice[e]=new t1(t.value,this.renderer,t)),e++;break}case"stunt":{this.dice[e]||(this.dice[e]=new e2(t.value,this.renderer,t)),e++;break}case"%":{this.dice[e]||(this.dice[e]=new Z4(t.value,this.renderer,t)),e++;break}}}async roll(e){if(this.stunted="",this.stackCopy=[],this.dice.length||this.buildDiceTree(),this.renderer.stop(),this.dice.forEach(t=>t.shouldRender=!1),e||this.shouldRender&&this.hasRunOnce)await this.renderDice();else for(let t of this.dice)await t.roll();return this.calculate(),this.render(),(e||this.shouldRender&&this.hasRunOnce)&&new L2.Notice(`${this.tooltip}
|
|
|
|
Result: ${this.result}`),this.trigger("new-result"),this.hasRunOnce=!0,this.result}calculate(){let e=0;for(let i of this.lexemes)switch(i.type){case"+":case"-":case"*":case"/":case"^":case"math":{let n=this.stack.pop(),s=this.stack.pop();n instanceof e2&&n.doubles&&(this.stunted=` - ${n.results.get(0).value} Stunt Points`),s instanceof e2&&s.doubles&&(this.stunted=` - ${s.results.get(0).value} Stunt Points`);let r=this.operators[i.value](s.result,n.result),a=this.operators[i.value](this.minStack.pop(),this.minStack.pop()),c=this.operators[i.value](this.maxStack.pop(),this.maxStack.pop());this.stackCopy.push(i.value),this.stack.push(new t1(`${r}`,this.renderer,i)),this.minStack.push(a),this.maxStack.push(c);break}case"stunt":case"%":case"dice":this.stack.push(this.dice[e]),this.stackCopy.push(this.dice[e]),this.minStack.push(this.dice[e].getMinPossible()),this.maxStack.push(this.dice[e].getMaxPossible()),e++;default:continue}let t=this.stack.pop();this.min=this.minStack.pop(),this.max=this.maxStack.pop(),t instanceof e2&&t.doubles&&(this.stunted=` - ${t.results.get(0).value} Stunt Points`),this.result=t.result}recalculate(e=!1){let t=[],i=0;if(!this.stackCopy.length)return this.roll();for(let n of this.stackCopy)if(typeof n=="string"){let s=t.pop(),r=t.pop(),a=this.operators[n](r.result,s.result);t.push(new t1(`${a}`,this.renderer))}else t.push(n),n instanceof t1&&this.stackCopy.indexOf(n)!=this.stackCopy.length-1&&e&&n.applyModifiers();t.length&&t[0]instanceof t1&&(e&&t[0].applyModifiers(),i+=t[0].result),this.result=i,this.render()}toResult(){return{type:"dice",result:this.result,tooltip:this.tooltip}}async applyResult(e){e.type==="dice"&&(e.result&&(this.result=e.result),e.tooltip&&(this._tooltip=e.tooltip),await this.render())}setResult(e){}};var T2=Mt(require("obsidian"));function nu(o){let e="",t="abcdefghijklmnopqrstuvwxyz0123456789",i=t.length;for(let n=0;n<o;n++)e+=t.charAt(Math.floor(Math.random()*i));return e}function su(o){return`dice-${nu(4)}`}var Zi=class extends ls{constructor(e,t,i,n,s=!0,r=e.data.showDice){super(e,t,i,n,r);this.plugin=e;this.original=t;this.lexeme=i;this.inline=s}get replacer(){let e=this.getBlockId(this.result);return e?`![[${this.path}#^${e}]]`:""}get tooltip(){return`${this.original}
|
|
${this.path}`}async build(){if(this.resultEl.empty(),this.plugin.data.displayResultsInline&&this.inline&&this.resultEl.createSpan({text:this.inlineText}),!this.results||!this.results.length){this.resultEl.createDiv({cls:"dice-no-results",text:"No results."});return}this.plugin.data.copyContentButton&&this.copy.removeClass("no-show");for(let e of this.results){this.resultEl.onclick=async i=>{if(i&&i.getModifierState("Control")||i.getModifierState("Meta")){i.stopPropagation();return}};let t=this.resultEl.createDiv({cls:this.getEmbedClass()});if(!this.plugin.data.displayResultsInline){let i="type"in e?e.type:"List Item";t.setAttrs({"aria-label":`${this.file.basename}: ${i}`})}if(!e){t.createDiv({cls:"dice-no-results",text:"No results."});continue}if(T2.MarkdownRenderer.renderMarkdown(this.displayFromCache(e),t.createDiv(),this.source,new T2.Component),this.plugin.data.copyContentButton&&this.results.length>1){let i=t.createDiv({cls:"dice-content-copy dice-roller-button",attr:{"aria-label":"Copy Contents"}});i.addEventListener("click",n=>{n.stopPropagation(),navigator.clipboard.writeText(this.displayFromCache(e).trim()).then(async()=>{new T2.Notice("Result copied to clipboard.")})}),(0,T2.setIcon)(i,N1)}}}async load(){await this.getOptions()}displayFromCache(...e){let t=[];for(let i of e)t.push(this.content.slice(i.position.start.offset,i.position.end.offset));return t.join(`
|
|
|
|
`)}transformResultsToString(){return this.displayFromCache(...this.results)}getBlockId(e){let t=this.cache.blocks??{},i=Object.entries(t).find(([n,s])=>F3(s.position,e.position));if(!i){let n=`${su(4)}`,s=`${this.content.slice(0,this.result.position.end.offset+1)}^${n}${this.content.slice(this.result.position.end.offset)}`;return this.watch=!1,this.plugin.app.vault.modify(this.file,s),n}return i[0]}getPath(){let{groups:e}=this.lexeme.value.match(dr)??{},{roll:t=1,link:i,types:n}=e??{};if(!i)throw new Error("Could not parse link.");this.rolls=(t&&!isNaN(Number(t))&&Number(t))??1,this.path=decodeURIComponent(i.replace(/(\[|\]|\(|\))/g,"")),this.types=n?.split(","),this.levels=n?.split(",").map(s=>/heading\-\d+/.test(s)?s.split("-").pop():null).filter(s=>s),this.types=n?.split(",").map(s=>/heading\-\d+/.test(s)?s.split("-").shift():s)}async getOptions(){if(this.cache=this.plugin.app.metadataCache.getFileCache(this.file),!this.cache||!this.cache.sections)throw new Error("Could not read file cache.");this.content=await this.plugin.app.vault.cachedRead(this.file),this.options=this.cache.sections.filter(({type:e,position:t})=>this.types?e=="heading"&&this.types.includes(e)&&this.levels.length?(this.cache.headings??[]).filter(({level:n})=>this.levels.includes(`${n}`)).some(({position:n})=>F3(n,t)):this.types.includes(e):!["yaml","thematicBreak"].includes(e)),this.types&&this.types.includes("listItem")&&this.options.push(...this.cache.listItems),this.loaded=!0,this.trigger("loaded")}async roll(){return new Promise((e,t)=>{if(!this.loaded)this.on("loaded",()=>{let i=[...this.options];this.results=[...Array(this.rolls)].map(()=>{let n=i[this.getRandomBetween(0,i.length-1)];return i.splice(i.indexOf(n),1),n}).filter(n=>n),this.render(),this.trigger("new-result"),this.result=this.results[0],e(this.results[0])});else{let i=[...this.options];this.results=[...Array(this.rolls)].map(()=>{let n=i[this.getRandomBetween(0,i.length-1)];return i.splice(i.indexOf(n),1),n}).filter(n=>n),this.render(),this.trigger("new-result"),this.result=this.results[0],e(this.results[0])}})}toResult(){return{type:"section",result:this.results}}async applyResult(e){e.type==="section"&&(e.result&&(this.results=e.result),await this.render())}},F3=(o,e)=>o.start.col==e.start.col&&o.start.line==e.start.line&&o.start.offset==e.start.offset;var t2=Mt(require("obsidian"));var B3=class{constructor(){this.result="";this.combinedTooltip=""}},Xi=class extends gr{constructor(){super(...arguments);this.combinedTooltip="";this.prettyTooltip=""}getPath(){let{groups:e}=this.lexeme.value.match(H3)??{},{diceRoll:t="1",link:i,block:n,header:s}=e??{};if(!i||!n)throw new Error("Could not parse link.");let r=t.match(/(\d*?)[Dd]$/);if(r){let[,a="1"]=r;this.rollsFormula=a}else this.rollsFormula=t;this.rolls=1,this.path=decodeURIComponent(i.replace(/(\[|\]|\(|\))/g,"")),this.block=n.replace(/(\^|#)/g,"").trim().toLowerCase(),this.header=s}get tooltip(){return this.prettyTooltip}get replacer(){return this.result}async build(){this.resultEl.empty();let e=[this.result];this.plugin.data.displayResultsInline&&e.unshift(this.inlineText);let t=createSpan();await t2.MarkdownRenderer.renderMarkdown(e.join(""),t,this.source,new t2.Component);let i=this.resultEl.createSpan("embedded-table-result");t.childElementCount==1&&t.firstElementChild instanceof HTMLParagraphElement?i.append(...Array.from(t.firstElementChild.childNodes)):i.append(...Array.from(t.childNodes))}prettify(e){let t=/(.*?)(\(|\)|;|\|\|)(.*)/,i=" ",n=0,s="",r=e,a;for(;a=r.match(t);){let[,c,l,h]=a;s+=c,l==")"?(n--,s+=`
|
|
`,s+=i.repeat(n),s+=")"):(l=="("?(n++,s+="("):l==";"?s+=",":l=="||"&&(s+="|"),s+=`
|
|
`,s+=i.repeat(n)),r=h}return s+=r,s}async getSubResult(e){let t=new B3;typeof e=="number"?t.result=e.toString():t.result=e;let i=[];if(typeof e=="string"){let n=/(?:\`dice:)(.*?)(?:\`)/g,s=e.matchAll(n);for(let r of s){let a=r[1].trim(),c=await this.plugin.getRoller(a,this.source);await c.roll();let l=await this.getSubResult(c.result),h;if(l.result instanceof t2.TFile?h=l.result.basename:h=l.result,t.result=t.result.replace(r[0],h),c instanceof Xi)i.push(c.combinedTooltip);else{let[f,u]=c.tooltip.split(`
|
|
`);i.push(f+" --> "+u)}}}return t.combinedTooltip=i.join(";"),t}async getResult(){let e=[],t=[],i=this.original;if(this.rollsFormula)try{let n=await this.plugin.getRoller(this.rollsFormula,this.source);if(!(n instanceof Wt))return this.prettyTooltip="TableRoller only supports dice rolls to select multiple elements.",new t2.Notice(this.prettyTooltip),"ERROR";let s=n;await s.roll(),this.rolls=s.result,s.isStatic||(i=i.replace(this.rollsFormula,`${this.rollsFormula.trim()} --> ${s.resultText} > `))}catch{return this.prettyTooltip=`TableRoller: '${this.rollsFormula}' is not a valid dice roll.`,new t2.Notice(this.prettyTooltip),"ERROR"}for(let n=0;n<this.rolls;n++){let s="",r,a="";if(this.isLookup){let c=await this.lookupRoller.roll(),l=this.lookupRanges.find(([h])=>h[1]===void 0&&c===h[0]||c>=h[0]&&h[1]>=c);l&&(s=this.lookupRoller.original.trim()+" --> "+`${this.lookupRoller.resultText}${this.header?" | "+this.header:""}`.trim(),a=l[1])}else{let c=[...this.options],l=this.getRandomBetween(0,c.length-1);s=c.length+" rows --> [row "+(l+1)+"]",a=c[l]}r=await this.getSubResult(a),e.push(r.result),r.combinedTooltip&&(s+=" > ("+r.combinedTooltip+")"),t.push(s)}return t.length==0?this.combinedTooltip=i:t.length==1?this.combinedTooltip=i+" "+t.join(""):this.combinedTooltip=i+" ==> ("+t.join(" ||")+")",this.prettyTooltip=this.prettify(this.combinedTooltip),e.join("||")}async roll(){return new Promise(async e=>{this.loaded?(this.result=await this.getResult(),this.render(),this.trigger("new-result"),e(this.result)):this.on("loaded",async()=>{this.result=await this.getResult(),this.render(),this.trigger("new-result"),e(this.result)})})}async load(){await this.getOptions()}async getOptions(){if(this.cache=this.plugin.app.metadataCache.getFileCache(this.file),!this.cache||!this.cache.blocks||!(this.block in this.cache.blocks))throw new Error(`Could not read file cache. Does the block reference exist?
|
|
|
|
${this.path} > ${this.block}`);let e=this.cache.sections?.find(n=>n.position==this.cache.blocks[this.block].position),t=this.cache.blocks[this.block].position,i=await this.plugin.app.vault.cachedRead(this.file);if(this.content=i.slice(t.start.offset,t.end.offset),e&&e.type==="list")this.options=this.content.split(`
|
|
`);else{let n=au(this.content);if(n.columns.size===2&&/dice:\s*([\s\S]+)\s*?/.test(Array.from(n.columns.keys())[0])){let s=await this.plugin.getRoller(Array.from(n.columns.keys())[0].split(":").pop(),this.source);s instanceof Wt&&(this.lookupRoller=s,this.lookupRanges=n.rows.map(r=>{let[a,c]=r.replace(/\\\|/g,"{ESCAPED_PIPE}").split("|").map(f=>f.replace(/{ESCAPED_PIPE}/g,"\\|")).map(f=>f.trim()),[,l,h]=a.match(/(\d+)(?:[^\d]+?(\d+))?/)??[];if(!(!l&&!h))return[[Number(l),h?Number(h):void 0],c]}),this.isLookup=!0)}if(this.header==="xy"&&!n.columns.has("xy")){this.options=[];for(let s of Array.from(n.columns.values()).slice(1))this.options.push(...s)}else if(this.header&&n.columns.has(this.header))this.options=n.columns.get(this.header);else{if(this.header)throw new Error(`Header ${this.header} was not found in table ${this.path} > ${this.block}.`);this.options=n.rows}}this.loaded=!0,this.trigger("loaded")}toResult(){return{type:"table",result:this.result}}async applyResult(e){e.type==="table"&&(e.result&&(this.result=e.result),await this.render())}},ru=/^\|?([\s\S]+?)\|?$/,P3=/\|/g;function au(o){let e=o.split(`
|
|
`),i=e.map(r=>(r.trim().match(ru)??[,r.trim()])[1])[0].replace("\\|","{ESCAPED_PIPE}").split(P3),n=[],s=[];for(let r in i){let a=i[r];a.trim().length||(a=r),s.push([a.trim(),[]])}for(let r of e.slice(2)){let a=r.trim().replace(/\\\|/g,"{ESCAPED_PIPE}").split(P3).map(c=>c.replace(/{ESCAPED_PIPE}/g,"\\|")).map(c=>c.trim()).filter(c=>c.length);n.push(a.join(" | "));for(let c in a){let l=a[c].trim();!l.length||!s[c]||s[c][1].push(l)}}return{columns:new Map(s),rows:n}}var D2=Mt(require("obsidian"));var yr=class extends ls{constructor(e,t,i,n,s=!0,r=e.data.showDice){super(e,t,i,n,r);this.plugin=e;this.original=t;this.lexeme=i}get replacer(){return this.result}get tooltip(){return`${this.original}
|
|
${this.path}`}async build(){if(this.resultEl.empty(),this.plugin.data.displayResultsInline&&this.inline&&this.resultEl.createSpan({text:this.inlineText}),!this.results||!this.results.length){this.resultEl.createDiv({cls:"dice-no-results",text:"No results."});return}this.plugin.data.copyContentButton&&this.copy.removeClass("no-show");for(let e of this.results){this.resultEl.onclick=async i=>{if(i&&i.getModifierState("Control")||i.getModifierState("Meta")){i.stopPropagation();return}};let t=this.resultEl.createDiv({cls:this.getEmbedClass()});if(!e){t.createDiv({cls:"dice-no-results",text:"No results."});continue}if(D2.MarkdownRenderer.renderMarkdown(e,t.createDiv(),this.source,new D2.Component),this.plugin.data.copyContentButton&&this.results.length>1){let i=t.createDiv({cls:"dice-content-copy dice-roller-button",attr:{"aria-label":"Copy Contents"}});i.addEventListener("click",n=>{n.stopPropagation(),navigator.clipboard.writeText(e).then(async()=>{new D2.Notice("Result copied to clipboard.")})}),(0,D2.setIcon)(i,N1)}}}transformResultsToString(){return this.results.join(`
|
|
|
|
`)}async load(){await this.getOptions()}getPath(){let{groups:e}=this.lexeme.value.match(dr)??{},{roll:t=1,link:i,types:n}=e??{};if(!i)throw new Error("Could not parse link.");this.rolls=(t&&!isNaN(Number(t))&&Number(t))??1,this.path=i.replace(/(\[|\])/g,""),this.types=n?.split(",")}async getOptions(){if(this.content=await this.plugin.app.vault.cachedRead(this.file),!this.content)throw new Error("Could not read file cache.");this.options=this.content.trim().split(`
|
|
`).map(e=>e.trim()).filter(e=>e&&e.length),this.loaded=!0,this.trigger("loaded")}async roll(){return new Promise((e,t)=>{if(!this.loaded)this.on("loaded",()=>{let i=[...this.options];this.results=[...Array(this.rolls)].map(()=>{let n=i[this.getRandomBetween(0,i.length-1)];return i.splice(i.indexOf(n),1),n}).filter(n=>n),this.render(),this.trigger("new-result"),e(this.results[0])});else{let i=[...this.options];this.results=[...Array(this.rolls)].map(()=>{let n=i[this.getRandomBetween(0,i.length-1)];return i.splice(i.indexOf(n),1),n}).filter(n=>n),this.render(),this.trigger("new-result"),e(this.results[0])}})}toResult(){return{type:"section",result:this.results}}async applyResult(e){e.type==="section"&&(e.result&&(this.results=e.result),await this.render())}};var I3=Mt(require("obsidian"));var X4=Mt(require("obsidian"));var Y4=class extends xi{constructor(e,t,i,n,s=e.data.showDice){super(e,t,[i],s);this.plugin=e;this.original=t;this.lexeme=i;this.source=n;this.isLink=!1;this.loaded=!1;this.guardDataview()}get replacer(){return this.result.replacer}guardDataview(){if(!this.plugin.canUseDataview)throw new X4.Notice("A query can only be rolled with the Dataview plugin enabled."),new Error("A query can only be rolled with the Dataview plugin enabled.")}initialize(){let{roll:e=1,query:t,types:i}=this.lexeme.value.match(this.regex).groups;this.base=t,this.rolls=Number(e),this.types=i,this.types&&(this.isLink=this.types.includes("link"),this.types=this.types.replace("link","")),!this.isLink&&this.plugin.data.displayAsEmbed&&this.containerEl.addClasses(["has-embed","markdown-embed"]),this.getFiles()}get typeText(){return this.types?.length?`|${this.types}`:""}async getFiles(){if(!this.plugin.dataviewAPI){new X4.Notice("Dice Roller: Dataview must be installed and enabled to use query rollers.");return}await this.plugin.dataviewReady();let e=await this.plugin.dataviewAPI.query(this.query);if(!e.successful)throw new Error(`No files found with that query. Is the query correct?
|
|
|
|
`+this.query);let t=new Set(e.value.values.reduce((n,s)=>(s.type=="file"&&n.push(s.path),n),[]));if(t&&t.delete(this.source),!t||!t.size)throw new Error(`No files found with that query. Is the query correct?
|
|
|
|
`+this.query);let i=Array.from(t).map(n=>`[[${n}]]${this.typeText}`);this.results=i.map(n=>new Zi(this.plugin,n,{...this.lexeme,value:n,type:"section"},this.source,!1)),this.loaded=!0,this.trigger("loaded")}async build(){this.resultEl.empty(),this.plugin.data.displayResultsInline&&this.resultEl.createSpan({text:this.inlineText});let e=[],t=new Map(this.results.map((i,n)=>[n,i]));for(let i=0;i<this.rolls;i++){if(!t.size)continue;let n=this.getRandomBetween(0,t.size);e.push(t.get(n)),t.delete(n)}for(let i=0;i<e.length;i++){let n=e[i];if(this.isLink){let s=this.resultEl.createEl("a",{cls:"internal-link",text:n.file.basename});s.onclick=async r=>{r.stopPropagation(),this.plugin.app.workspace.openLinkText(n.path,this.plugin.app.workspace.getActiveFile()?.path,r.getModifierState("Control"))},s.onmouseenter=async r=>{this.plugin.app.workspace.trigger("link-hover",this,s,n.path,this.plugin.app.workspace.getActiveFile()?.path)},e.length>1&&i!=e.length-1&&this.resultEl.createSpan({text:", "})}else{let s=this.resultEl.createDiv();s.createEl("h5",{cls:"dice-file-name",text:n.file.basename}),s.appendChild(n.containerEl)}}}async roll(){return new Promise((e,t)=>{this.loaded?(this.results.forEach(async i=>await i.roll()),this.result=this.results[0],this.render(),this.trigger("new-result"),e(this.result)):this.on("loaded",()=>{this.results.forEach(async i=>await i.roll()),this.result=this.results[0],this.render(),this.trigger("new-result"),e(this.result)})})}get tooltip(){return this.original}toResult(){return{type:"query",random:this.chosen,result:Object.fromEntries(this.results.map(e=>[e.path,e.toResult()]))}}async applyResult(e){if(e.type==="query"){if(e.result)for(let t in e.result){let i=this.results.find(n=>n.path===t);!i||i.applyResult(e.result[t])}e.random&&(this.random=e.random),await this.render()}}},wr=class extends Y4{constructor(e,t,i,n,s=e.data.showDice){super(e,t,i,n,s);this.plugin=e;this.original=t;this.lexeme=i;this.source=n;this.regex=D3;this.initialize()}get query(){return this.base}},br=class extends Y4{constructor(e,t,i,n,s=e.data.showDice){super(e,t,i,n,s);this.plugin=e;this.original=t;this.lexeme=i;this.source=n;this.regex=q4;this.initialize()}get query(){return`list from #${this.base}`}};var be=Mt(require("obsidian"));var Yi=Mt(require("obsidian")),ou=createSvg("svg",{attr:{viewBox:"0 0 500 500"}}),cu=createSvg("text",{attr:{class:"font",fill:"currentColor",x:"50%",y:"50%","text-anchor":"middle","dominant-baseline":"central"}}),us=(a=>(a.NONE="None",a.TRIANGLE="Triangle",a.SQUARE="Square",a.DIAMOND="Diamond",a.DODECAHEDRON="Dodecahedron",a.ICOSAHEDRON="Icosahedron",a.CIRCLE="Circle",a))(us||{}),k3=[{id:"dice-roller-d4",shape:"Triangle",formula:"2d8 + 3",text:"4"},{id:"dice-roller-d6",shape:"Square",formula:"d6",text:"6"},{id:"dice-roller-d8",shape:"Diamond",formula:"d8",text:"8"},{id:"dice-roller-d10",shape:"Diamond",formula:"d10",text:"10"},{id:"dice-roller-d12",shape:"Dodecahedron",formula:"d12",text:"12"},{id:"dice-roller-d20",shape:"Icosahedron",formula:"d20",text:"20"},{id:"dice-roller-d100",shape:"Circle",formula:"d%",text:"%"}],zr,lu,Cr,hu,Ar,i2,$i,O3=class extends Yi.Component{constructor(){super(...arguments);at(this,zr);at(this,Cr);at(this,i2);at(this,Ar,new Set)}registerIcon(e,t,i){Pe(this,Ar).add(e);let n=Ze(this,zr,lu).call(this),s=Ze(this,Cr,hu).call(this);s.textContent=i,n.appendChild(s);let r;switch(t){case"Triangle":r=this.getTriangle();break;case"Square":{r=this.getSquare();break}case"Diamond":{r=this.getDiamond();break}case"Dodecahedron":{r=this.getDodecahedron();break}case"Icosahedron":{r=this.getIcosahedron();break}case"Circle":{r=this.getCircle();break}case"None":r=createSvg("defs")}n.appendChild(r),(0,Yi.addIcon)(e,n.outerHTML),this.register(()=>(0,Yi.removeIcon)(e))}getTriangle(){return Ze(this,i2,$i).call(this,"path",{d:"M244.6,49.3L40.3,403.2c-1.7,3-0.7,6.8,2.3,8.5c0.9,0.5,2,0.8,3.1,0.8h408.6c3.4,0,6.2-2.8,6.2-6.2 c0-1.1-0.3-2.2-0.8-3.1L255.4,49.3c-1.7-3-5.5-4-8.5-2.3C246,47.6,245.2,48.4,244.6,49.3z"})}getSquare(){return Ze(this,i2,$i).call(this,"rect",{x:"87.5",y:"87.5",width:"325",height:"325",rx:"10"})}getDiamond(){return Ze(this,i2,$i).call(this,"rect",{x:"102.75",y:"102.75",width:"294.51",height:"294.51",rx:"9.8",transform:"translate(-103.55 250) rotate(-45)"})}getDodecahedron(){return Ze(this,i2,$i).call(this,"path",{d:"M244.31,29.14,52,168.87a9.72,9.72,0,0,0-3.52,10.84l73.47,226.1a9.69,9.69,0,0,0,9.21,6.69H368.87a9.69,9.69,0,0,0,9.21-6.69l73.47-226.1A9.72,9.72,0,0,0,448,168.87L255.69,29.14A9.66,9.66,0,0,0,244.31,29.14Z"})}getIcosahedron(){return Ze(this,i2,$i).call(this,"path",{d:"M55.14,143.27V356.73a10,10,0,0,0,5,8.66L245,472.11a10,10,0,0,0,10,0L439.86,365.39a10,10,0,0,0,5-8.66V143.27a10,10,0,0,0-5-8.66L255,27.89a10,10,0,0,0-10,0L60.14,134.61A10,10,0,0,0,55.14,143.27Z"})}getCircle(){return Ze(this,i2,$i).call(this,"circle",{cx:"250",cy:"250",r:"190"})}onunload(){}};zr=new WeakSet,lu=function(){return ou.cloneNode(!0)},Cr=new WeakSet,hu=function(){return cu.cloneNode()},Ar=new WeakMap,i2=new WeakSet,$i=function(e,t){return createSvg(e,{cls:"shape",attr:{...t,stroke:"currentColor"}})};var Mr=new O3;var j3=Mt(W3()),g1,V2,_r=class extends be.PluginSettingTab{constructor(e,t){super(e,t);this.plugin=t;at(this,g1);this.plugin=t}async display(){let{containerEl:e}=this;e.empty(),e.addClass("dice-roller-settings"),e.createEl("h2",{text:"Dice Roller Settings"}),this.contentEl=this.containerEl.createDiv("dice-roller-settings-content"),this.buildGenerics(this.contentEl.createDiv()),this.buildDisplay(this.contentEl.createEl("details",{cls:"dice-roller-nested-settings"})),this.buildDice(this.contentEl.createEl("details",{cls:"dice-roller-nested-settings"})),this.buildView(this.contentEl.createEl("details",{cls:"dice-roller-nested-settings"})),this.buildRender(this.contentEl.createEl("details",{cls:"dice-roller-nested-settings"})),this.buildFormulaSettings(this.contentEl.createEl("details",{cls:"dice-roller-nested-settings"})),this.buildTables(this.contentEl.createEl("details",{cls:"dice-roller-nested-settings"})),this.buildSections(this.contentEl.createEl("details",{cls:"dice-roller-nested-settings"})),this.buildTags(this.contentEl.createEl("details",{cls:"dice-roller-nested-settings"})),e.createDiv("coffee").createEl("a",{href:"https://www.buymeacoffee.com/valentine195"}).createEl("img",{attr:{src:"https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=\u2615&slug=valentine195&button_colour=e3e7ef&font_colour=262626&font_family=Inter&outline_colour=262626&coffee_colour=ff0000"}})}buildGenerics(e){e.empty(),new be.Setting(e).setName("Globally Save Results").setDesc(createFragment(t=>{t.createSpan({text:"Dice results will be saved by default. This can be overridden using "}),t.createEl("code",{text:"dice-: formula"}),t.createEl("p",{text:"Please note that the plugin will attempt to save the result but may not be able to."})})).addToggle(t=>{t.setValue(this.plugin.data.persistResults),t.onChange(async i=>{this.plugin.data.persistResults=i,await this.plugin.saveSettings()})})}buildDisplay(e){e.empty(),Ze(this,g1,V2).call(this,e,"Dice Display"),new be.Setting(e).setName("Display Formula With Results").setDesc("Both the formula and the results will both be displayed in preview mode.").addToggle(t=>{t.setValue(this.plugin.data.displayResultsInline),t.onChange(async i=>{this.plugin.data.displayResultsInline=i,await this.plugin.saveSettings()})}),new be.Setting(e).setName("Display Dice Button With Results").setDesc("A dice button will appear next to results.").addToggle(t=>{t.setValue(this.plugin.data.showDice),t.onChange(async i=>{this.plugin.data.showDice=i,await this.plugin.saveSettings()})}),new be.Setting(e).setName("Add Formula When Using Modify Dice").setDesc(createFragment(t=>{t.createSpan({text:"Both the formula and the results will both be added to the note when using "}),t.createEl("code",{text:"dice-mod"}),t.createSpan({text:"."})})).addToggle(t=>{t.setValue(this.plugin.data.displayFormulaForMod),t.onChange(async i=>{this.plugin.data.displayFormulaForMod=i,await this.plugin.saveSettings()})}),new be.Setting(e).setName("Display Formula in Parentheses After").setDesc(createFragment(t=>{t.createSpan({text:"For example, "}),t.createEl("code",{text:"`dice: 1d6`"}),t.createSpan({text:" will become "});let i=t.createSpan("dice-roller");i.createSpan({cls:"dice-roller-result",text:"3"}),(0,be.setIcon)(i.createSpan("dice-roller-button"),m1),t.createSpan({text:" (1d6). This only affects Dice Rollers."})})).addToggle(t=>{t.setValue(this.plugin.data.displayFormulaAfter),t.onChange(async i=>{this.plugin.data.displayFormulaAfter=i,await this.plugin.saveSettings()})}),new be.Setting(e).setName("Escape Markdown When Modifying").setDesc(createFragment(t=>{t.createSpan({text:"Markdown characters will be escaped when using "}),t.createEl("code",{text:"dice-mod"}),t.createSpan({text:"."})})).addToggle(t=>{t.setValue(this.plugin.data.escapeDiceMod),t.onChange(async i=>{this.plugin.data.escapeDiceMod=i,await this.plugin.saveSettings()})})}buildDice(e){e.empty(),Ze(this,g1,V2).call(this,e,"Dice Rollers"),new be.Setting(e).setName("Default Face").setDesc("Use this as the number of faces when it is omitted.").addText(t=>{t.setValue(`${this.plugin.data.defaultFace}`),t.inputEl.onblur=async()=>{isNaN(Number(t.inputEl.value))&&new be.Notice("The default face must be a number."),this.plugin.data.defaultFace=Number(t.inputEl.value),this.plugin.parser.setDefaultFace(this.plugin.data.defaultFace),await this.plugin.saveSettings()}}),new be.Setting(e).setName("Round Results").setDesc("Determine the rounding behavior for dice results.").addDropdown(t=>{t.addOptions(zt).setValue(this.plugin.data.round).onChange(i=>{this.plugin.data.round=i,this.plugin.saveSettings()})}),new be.Setting(e).setName("Auto Roll dice").setDesc("On initial display, should dice be rolled or displayed empty.").addDropdown(t=>{t.addOption(ht.None,"Empty").addOption(ht.Roll,"Rolled").setValue(this.plugin.data.initialDisplay).onChange(i=>{this.plugin.data.initialDisplay=i,this.plugin.saveSettings()})}),new be.Setting(e).setName("Show Signed Results").setDesc("Positive results will show a '+'. This setting has no effect on negative results.").addToggle(t=>{t.setValue(this.plugin.data.signed).onChange(i=>{this.plugin.data.signed=i,this.plugin.saveSettings()})}),new be.Setting(e).setName("Always Render Dice").setDesc(createFragment(t=>{t.createSpan({text:"Dice rolled in notes will always be rendered. Use the "}),t.createEl("code",{text:"|norender"}),t.createSpan({text:" flag to prevent it."})})).addToggle(t=>{t.setValue(this.plugin.data.renderAllDice).onChange(i=>{this.plugin.data.renderAllDice=i,this.plugin.saveSettings()})}),new be.Setting(e).setName("Log Rolls to Dice Tray").setDesc(createFragment(t=>{t.createSpan({text:"Dice rolled in notes will be added to the Dice Tray's Results section."})})).addToggle(t=>{t.setValue(this.plugin.data.addToView).onChange(i=>{this.plugin.data.addToView=i,this.plugin.saveSettings()})})}buildTables(e){e.empty(),Ze(this,g1,V2).call(this,e,"Table Rollers"),new be.Setting(e).setName("Display Lookup Table Roll").setDesc("Lookup table rolls will display the rolled number along with the result.").addToggle(t=>{t.setValue(this.plugin.data.displayLookupRoll),t.onChange(async i=>{this.plugin.data.displayLookupRoll=i,await this.plugin.saveSettings()})})}buildSections(e){e.empty(),Ze(this,g1,V2).call(this,e,"Section Rollers"),new be.Setting(e).setName("Add Copy Button to Section Results").setDesc("Randomly rolled sections will have a copy-content button to easy add result to clipboard.").addToggle(t=>{t.setValue(this.plugin.data.copyContentButton),t.onChange(async i=>{this.plugin.data.copyContentButton=i,await this.plugin.saveSettings()})}),new be.Setting(e).setName("Display As Embeds").setDesc("Sections returned from Section & Tag Rollers will display as embedded fields.").addToggle(t=>{t.setValue(this.plugin.data.displayAsEmbed),t.onChange(async i=>{this.plugin.data.displayAsEmbed=i,await this.plugin.saveSettings()})})}buildTags(e){e.empty(),Ze(this,g1,V2).call(this,e,"Tag Rollers"),new be.Setting(e).setName("Always Return Links for Tags").setDesc("Enables random link rolling with the link parameter. Override by specifying a section type.").addToggle(t=>{t.setValue(this.plugin.data.rollLinksForTags),t.onChange(async i=>{this.plugin.data.rollLinksForTags=i,await this.plugin.saveSettings()})})}buildView(e){e.empty(),Ze(this,g1,V2).call(this,e,"Dice Tray"),new be.Setting(e).setName("Open Dice Tray on Startup").setDesc("The dice view can always be opened using the command from the command palette.").addToggle(t=>{t.setValue(this.plugin.data.showLeafOnStartup),t.onChange(async i=>{this.plugin.data.showLeafOnStartup=i,await this.plugin.saveSettings()})}),new be.Setting(e).setName("Dice Tray Buttons").setDesc("Add and remove the buttons available in the Dice Tray here, to customize what quick-actions are available to roll."),this.iconsEl=e.createDiv("dice-icons"),this.buildIcons()}buildIcons(){if(this.iconsEl.empty(),!this.plugin.data.icons){this.iconsEl.createSpan({cls:"no-icons",text:"No dice buttons created! Create a button to use this functionality."});return}let t=this.iconsEl.createDiv("existing-buttons has-table").createDiv("buttons-table");for(let l=0;l<this.plugin.data.icons.length;l++){let h=t.createDiv("icons-table-row");this.buildStaticIcon(h,l)}let i=t.createDiv("icons-table-row add-new"),n={text:null,formula:null,shape:us.NONE,id:(0,j3.generateSlug)()},s=i.createDiv("shape"),r=i.createDiv("formula");new be.TextComponent(r).setPlaceholder("Formula").onChange(l=>{n.formula=l,a.setDisabled(n.text?.length===0||n.formula?.length===0)}),new be.TextComponent(r).setPlaceholder("Display").onChange(l=>{n.text=l,a.setDisabled(n.text?.length===0||n.formula?.length===0)});let a=new be.ExtraButtonComponent(i.createDiv("actions")).setIcon("plus-with-circle").setDisabled(!0).onClick(async()=>{!n.text||!n.formula||(this.plugin.data.icons.push({...n}),this.buildIcons(),await this.plugin.view.buildButtons(),await this.plugin.saveSettings())}),c=new be.DropdownComponent(s);for(let[l,h]of Object.entries(us))c.addOption(h,h);c.setValue(n.shape).onChange(l=>{n.shape=c.getValue()}),n.shape=c.getValue()}buildStaticIcon(e,t){e.empty(),e.removeClass("add-new");let i=this.plugin.data.icons[t],n=e.createDiv("shape dice-button");Mr.registerIcon(i.id,i.shape,i.text),(0,be.setIcon)(n,i.id),e.createDiv({cls:"formula",text:i.formula});let s=e.createDiv("actions");new be.ExtraButtonComponent(s).setIcon("edit").onClick(()=>{this.buildEditIcon(e,t,i)}),new be.ExtraButtonComponent(s).setIcon("trash").onClick(async()=>{this.plugin.data.icons.splice(t,1),await this.plugin.view.buildButtons(),this.buildIcons()})}buildEditIcon(e,t,i){e.empty(),e.addClass("add-new");let n={text:i.text,formula:i.formula,shape:i.shape,id:i.id},s=e.createDiv("shape"),r=e.createDiv("formula");new be.TextComponent(r).setPlaceholder("Formula").setValue(n.formula).onChange(h=>{n.formula=h,c.setDisabled(n.text.length===0||n.formula.length===0)}),new be.TextComponent(r).setPlaceholder("Display").setValue(n.text).onChange(h=>{n.text=h,c.setDisabled(n.text.length===0||n.formula.length===0)});let a=e.createDiv("actions"),c=new be.ExtraButtonComponent(a).setIcon("checkmark").setDisabled(n.text.length===0||n.formula.length===0).onClick(async()=>{!n.text||!n.formula||(this.plugin.data.icons.splice(t,1,{...n}),await this.plugin.saveSettings(),this.buildStaticIcon(e,t),await this.plugin.view.buildButtons())});new be.ExtraButtonComponent(a).setIcon("cross").onClick(()=>{this.buildStaticIcon(e,t)});let l=new be.DropdownComponent(s);for(let[h,f]of Object.entries(us))l.addOption(f,f);l.setValue(n.shape).onChange(h=>{n.shape=h})}buildRender(e){e.empty(),Ze(this,g1,V2).call(this,e,"Graphical Dice"),new be.Setting(e).setName("Display graphics for Dice Tray Rolls").setDesc("Dice rolls from dice view will be displayed on screen.").addToggle(n=>{n.setValue(this.plugin.data.renderer),n.onChange(async s=>{this.plugin.data.renderer=s,await this.plugin.saveSettings()})}),new be.Setting(e).setName("Display Time for Dice Graphics").setDesc("Rendered dice will stay on screen for this number of milliseconds. Leave blank to require a click to clear dice.").addText(n=>{n.inputEl.setAttr("type","number"),n.inputEl.onblur=s=>{Number(n.getValue())<0&&(new be.Notice("Render time cannot be less than 0."),n.setValue("0"))},n.setValue(`${this.plugin.data.renderTime}`),n.onChange(async s=>{s&&Number(s)<0||isNaN(Number(s))||(this.plugin.data.renderTime=Number(s),this.plugin.renderer.setData(this.plugin.getRendererData()),await this.plugin.saveSettings())})}).addExtraButton(n=>{n.setIcon("reset").setTooltip("Reset to Default").onClick(async()=>{this.plugin.data.renderTime=Er.renderTime,await this.plugin.saveSettings(),this.buildRender(e)})}),new be.Setting(e).setName("Use Colorful Dice").setDesc("Rendered dice will be varied colors based on the dice type. This will override manually set dice and text colors.").addToggle(n=>{n.setValue(this.plugin.data.colorfulDice),n.onChange(async s=>{this.plugin.data.colorfulDice=s,this.plugin.renderer.setData(this.plugin.getRendererData()),await this.plugin.saveSettings()})}),new be.Setting(e).setName("Adjust Dice Scale").setDesc("Control the size of rendered dice.").addSlider(n=>{n.setLimits(.5,1.5,.1).setValue(this.plugin.data.scaler).onChange(s=>{this.plugin.data.scaler=s,this.plugin.renderer.setData(this.plugin.getRendererData()),this.plugin.saveSettings()})}),new be.Setting(e).setName("Dice Base Color").setDesc("Rendered dice will be this color.").controlEl.createEl("input",{type:"color",value:this.plugin.data.diceColor},n=>{n.value=this.plugin.data.diceColor,n.onchange=async({target:s})=>{let r=s.value;this.plugin.data.diceColor=r,this.plugin.renderer.setData(this.plugin.getRendererData()),await this.plugin.saveSettings()}}),new be.Setting(e).setName("Dice Text Color").setDesc("Rendered dice will use this color for their numbers.").controlEl.createEl("input",{type:"color",value:this.plugin.data.textColor},n=>{n.value=this.plugin.data.textColor,n.onchange=async({target:s})=>{let r=s.value;!r||(this.plugin.data.textColor=r,this.plugin.renderer.setData(this.plugin.getRendererData()),await this.plugin.saveSettings())}})}buildFormulaSettings(e){e.empty(),Ze(this,g1,V2).call(this,e,"Saved Formulas");let i=e.createDiv("dice-roller-setting-additional-container").createDiv();new be.Setting(i).setName("Add Formula").setDesc("Add a new formula shortcut.").addButton(r=>r.setTooltip("Add Formula").setButtonText("+").onClick(async()=>{let c=await this.buildFormulaForm(i);c&&(this.plugin.data.formulas[c.alias]=c.formula,this.buildFormulaSettings(e),await this.plugin.saveSettings())}));let n=e.createDiv("additional"),s=this.plugin.data.formulas;for(let[r,a]of Object.entries(s)){let c=new be.Setting(n).setName(r);c.controlEl.createSpan({text:a}),c.addExtraButton(l=>l.setIcon("pencil").setTooltip("Edit").onClick(async()=>{let h=await this.buildFormulaForm(i,{alias:r,formula:a});h&&(delete this.plugin.data.formulas[r],this.plugin.data.formulas[h.alias]=h.formula,this.buildFormulaSettings(e),await this.plugin.saveSettings())})).addExtraButton(l=>l.setIcon("trash").setTooltip("Delete").onClick(async()=>{delete this.plugin.data.formulas[r],await this.plugin.saveSettings(),this.buildFormulaSettings(e)}))}Object.values(s).length||n.createSpan({text:"Create a formula to see it here!",cls:"no-formulas"})}async buildFormulaForm(e,t={alias:null,formula:null}){return new Promise(i=>{let n=e.createDiv("add-new-formula"),s=n.createDiv("formula-data");new be.Setting(s).setName("Alias").addText(a=>{a.setValue(t.alias).onChange(c=>t.alias=c)}),new be.Setting(s).setName("Formula").addText(a=>{a.setValue(t.formula).onChange(c=>t.formula=c)});let r=n.createDiv("formula-buttons");new be.Setting(r).addButton(a=>a.setCta().setButtonText("Save").onClick(async()=>{n.detach(),i(t)})).addExtraButton(a=>a.setIcon("cross").setTooltip("Cancel").onClick(()=>{n.detach(),i(null)}))})}};g1=new WeakSet,V2=function(e,t){let i=e.createEl("summary");new be.Setting(i).setHeading().setName(t),(0,be.setIcon)(i.createDiv("collapser").createDiv("handle"),"chevron-right")};var et=Mt(require("obsidian"));var h1=class{constructor(e){this.plugin=e;this.sources=new Map}get renderer(){return this.plugin.renderer}registerSource(e,t){this.sources.set(e,t)}getRollerSync(e,t){let i=this.sources.get(t)??h1.RollerOptions(this.plugin);return this.plugin.getRollerSync(e,t,i)}async getRoller(e,t){let i=this.sources.get(t)??h1.RollerOptions(this.plugin);return this.plugin.getRoller(e,t,i)}getRollerString(e,t){if(!t)return e;let i=this.sources.get(t)??h1.RollerOptions(this.plugin);if("showDice"in i&&(e+=i.showDice?"":"|nodice"),"shouldRender"in i&&(e+=i.shouldRender?"|render":"|norender"),"showFormula"in i&&(e+=i.showFormula?"|form":"|noform"),"expectedValue"in i&&(i.expectedValue==ht.Average&&(e+="|avg"),i.expectedValue==ht.None&&(e+="|none")),"text"in i&&i.text&&(e+="|text("+i.text+")"),"showParens"in i&&(e+=i.showParens?"|paren":"|noparen"),"round"in i)switch(i.round){case zt.Down:{e+="|floor";break}case zt.Up:{e+="|ceil";break}case zt.Normal:{e+="|round";break}case zt.None:e+="|noround"}return i.signed&&(e+="|signed"),e}static RollerOptions(e){return{showDice:e.data.showDice,shouldRender:e.data.renderAllDice,showFormula:e.data.displayResultsInline,showParens:e.data.displayFormulaAfter,expectedValue:e.data.initialDisplay,round:e.data.round,text:null,signed:e.data.signed}}};var yi="DICE_ROLLER_VIEW";(0,et.addIcon)("dice-roller-save",'<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="far" data-icon="save" class="svg-inline--fa fa-save fa-w-14" role="img" viewBox="0 0 448 512"><path fill="currentColor" d="M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM272 80v80H144V80h128zm122 352H54a6 6 0 0 1-6-6V86a6 6 0 0 1 6-6h42v104c0 13.255 10.745 24 24 24h176c13.255 0 24-10.745 24-24V83.882l78.243 78.243a6 6 0 0 1 1.757 4.243V426a6 6 0 0 1-6 6zM224 232c-48.523 0-88 39.477-88 88s39.477 88 88 88 88-39.477 88-88-39.477-88-88-88zm0 128c-22.056 0-40-17.944-40-40s17.944-40 40-40 40 17.944 40 40-17.944 40-40 40z"/></svg>');(0,et.addIcon)("dice-roller-plus",'<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="far" data-icon="plus-square" class="svg-inline--fa fa-plus-square fa-w-14" role="img" viewBox="0 0 448 512"><path fill="currentColor" d="M352 240v32c0 6.6-5.4 12-12 12h-88v88c0 6.6-5.4 12-12 12h-32c-6.6 0-12-5.4-12-12v-88h-88c-6.6 0-12-5.4-12-12v-32c0-6.6 5.4-12 12-12h88v-88c0-6.6 5.4-12 12-12h32c6.6 0 12 5.4 12 12v88h88c6.6 0 12 5.4 12 12zm96-160v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48zm-48 346V86c0-3.3-2.7-6-6-6H54c-3.3 0-6 2.7-6 6v340c0 3.3 2.7 6 6 6h340c3.3 0 6-2.7 6-6z"/></svg>');(0,et.addIcon)("dice-roller-minus",'<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="far" data-icon="minus-square" class="svg-inline--fa fa-minus-square fa-w-14" role="img" viewBox="0 0 448 512"><path fill="currentColor" d="M108 284c-6.6 0-12-5.4-12-12v-32c0-6.6 5.4-12 12-12h232c6.6 0 12 5.4 12 12v32c0 6.6-5.4 12-12 12H108zM448 80v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48zm-48 346V86c0-3.3-2.7-6-6-6H54c-3.3 0-6 2.7-6 6v340c0 3.3 2.7 6 6 6h340c3.3 0 6-2.7 6-6z"/></svg>');var R2,N2,F1,ds,B1,fs=class extends et.ItemView{constructor(e,t){super(t);this.plugin=e;this.leaf=t;this.custom="";at(this,R2,!1);at(this,N2,!1);at(this,F1,0);at(this,ds,Mr);at(this,B1,new Map);this.contentEl.addClass("dice-roller-view"),this.addChild(Pe(this,ds))}get customFormulas(){return this.plugin.data.customFormulas}async onOpen(){this.display()}async display(){this.contentEl.empty(),this.gridEl=this.contentEl.createDiv("dice-roller-grid"),this.formulaEl=this.contentEl.createDiv("dice-roller-formula");let e=this.contentEl.createDiv("dice-roller-results-container"),t=e.createDiv("dice-roller-results-header");t.createEl("h4",{text:"Results"}),new et.ExtraButtonComponent(t.createDiv("clear-all")).setIcon("trash").setTooltip("Clear All").onClick(()=>{this.resultEl.empty(),this.resultEl.append(this.noResultsEl)}),this.resultEl=e.createDiv("dice-roller-results"),this.noResultsEl=this.resultEl.createSpan({text:"No results yet! Roll some dice to get started :)"}),this.buildButtons(),this.buildFormula()}buildButtons(){this.gridEl.empty();let e=this.gridEl.createDiv("dice-buttons");for(let s of this.plugin.data.icons)Pe(this,ds).registerIcon(s.id,s.shape,s.text),new et.ExtraButtonComponent(e.createDiv("dice-button")).setIcon(s.id).extraSettingsEl.onClickEvent(r=>{if(r.type==="auxclick"){this.roll(s.formula);return}Pe(this,B1).has(s)||Pe(this,B1).set(s,0);let a=Pe(this,B1).get(s);a+=r.getModifierState("Shift")?-1:1,Pe(this,B1).set(s,a),this.setFormula()});let t=this.gridEl.createDiv("advantage-disadvantage");new et.ExtraButtonComponent(t).setIcon("dice-roller-minus").onClick(()=>{Kt(this,F1,Pe(this,F1)-1),this.setFormula()});let i=new et.ButtonComponent(t).setButtonText("ADV").onClick(()=>{Kt(this,R2,!Pe(this,R2)),Kt(this,N2,!1),Pe(this,R2)?(i.setCta(),n.removeCta()):i.removeCta(),this.setFormula()}),n=new et.ButtonComponent(t).setButtonText("DIS").onClick(()=>{Kt(this,N2,!Pe(this,N2)),Kt(this,R2,!1),Pe(this,N2)?(n.setCta(),i.removeCta()):n.removeCta(),this.setFormula()});if(new et.ExtraButtonComponent(t).setIcon("dice-roller-plus").onClick(()=>{Kt(this,F1,Pe(this,F1)+1),this.setFormula()}),this.customFormulas.length){let s=this.gridEl.createDiv("dice-roller-results-container");s.createDiv("dice-roller-results-header").createEl("h4",{text:"Saved Formulas"});for(let a of this.customFormulas){let c=s.createDiv("dice-custom-formula-container"),l=c.createDiv("dice-custom-formula");new et.ExtraButtonComponent(l).setIcon(m1).setTooltip("Roll").onClick(()=>this.roll(a)),l.createSpan({text:a}),new et.ExtraButtonComponent(c).setIcon("trash").setTooltip("Remove").onClick(()=>{this.plugin.data.customFormulas=this.plugin.data.customFormulas.filter(h=>h!=a),this.plugin.saveSettings(),this.buildButtons()})}}}setFormula(){if(!Pe(this,B1).size&&!Pe(this,F1)){this.formulaComponent.inputEl.value="";return}let e=[];for(let[i,n]of Pe(this,B1)){if(!n)continue;let s=n<0?"-":"+",r=/^(?:1)?d(\d|%|F)+$/.test(i.formula)?`${Math.abs(n)}${i.formula.replace(/^1/,"")}`:`${Math.abs(n)} * (${i.formula})`,a=this.plugin.getRollerSync(i.formula,"view");a instanceof Wt&&(a.buildDiceTree(),a.calculate(),e.push({formula:r,max:a.max,sign:s}))}e.sort((i,n)=>n.max-i.max);let t=[];for(let i=0;i<e.length;i++){let n=e[i];i===0&&n.sign==="-"?n.formula=`${n.sign}${n.formula}`:i>0&&t.push(n.sign);let s="";i===0&&(Pe(this,R2)?s="kh":Pe(this,N2)&&(s="kl"),n.formula=n.formula.replace(/(d\d+)/,`$1${s}`)),t.push(`${n.formula}`)}Pe(this,F1)!==0&&(t.length>0&&t.push(Pe(this,F1)>0?"+":"-"),t.push(`${Math.abs(Pe(this,F1))}`)),this.formulaComponent.inputEl.value=t.join(" ")}async roll(e=this.formulaComponent.inputEl.value){if(!e)return;this.rollButton.setDisabled(!0);let t={...h1.RollerOptions(this.plugin)};t.expectedValue==ht.None&&(t.expectedValue=ht.Roll);let i=await this.plugin.getRoller(e,"view",t);if(!(i instanceof Wt)){new et.Notice("The Dice Tray only supports dice rolls.");return}if(i.iconEl.detach(),i.containerEl.onclick=null,i.buildDiceTree(),!i.dice.length){new et.Notice("Invalid formula.");return}await i.roll(this.plugin.data.renderer),this.rollButton.setDisabled(!1),this.addResult(i),this.buildButtons(),Kt(this,B1,new Map),Kt(this,F1,0),this.setFormula()}buildFormula(){this.formulaEl.empty(),this.formulaComponent=new et.TextAreaComponent(this.formulaEl).setPlaceholder("Dice Formula");let e=this.formulaEl.createDiv("action-buttons");this.saveButton=new et.ExtraButtonComponent(e).setIcon("plus-with-circle").setTooltip("Save Formula").onClick(()=>this.save()),this.saveButton.extraSettingsEl.addClass("dice-roller-roll"),this.rollButton=new et.ButtonComponent(e).setIcon(m1).setCta().setTooltip("Roll").onClick(()=>this.roll()),this.rollButton.buttonEl.addClass("dice-roller-roll")}save(){!this.formulaComponent.inputEl.value||(this.plugin.data.customFormulas.push(this.formulaComponent.inputEl.value),this.buildButtons(),this.plugin.saveSettings())}addResult(e){this.noResultsEl&&this.noResultsEl.detach();let t=createDiv("view-result");t.createSpan({text:e.original}),t.createEl("strong",{attr:{"aria-label":e.resultText}}).appendChild(e.containerEl.cloneNode(!0));let i=t.createDiv("result-context");i.createEl("em",{text:new Date().toLocaleString()}),new et.ExtraButtonComponent(i).setIcon("trash").onClick(()=>{t.detach(),this.resultEl.children.length===0&&this.resultEl.prepend(this.noResultsEl)}),new et.ExtraButtonComponent(i).setIcon(N1).setTooltip("Copy Result").onClick(async()=>{await navigator.clipboard.writeText(`${e.result}`)}).extraSettingsEl.addClass("dice-content-copy"),new et.ExtraButtonComponent(i).setIcon(m1).setTooltip("Roll Again").onClick(()=>this.roll(e.original)).extraSettingsEl.addClass("dice-result-reroll"),this.resultEl.prepend(t)}getDisplayText(){return"Dice Tray"}getViewType(){return yi}getIcon(){return m1}async onClose(){await super.onClose()}};R2=new WeakMap,N2=new WeakMap,F1=new WeakMap,ds=new WeakMap,B1=new WeakMap;var Gi=Mt(require("obsidian"));var jt=class{constructor(e=[0,0,0,0,0,0,0,0,0]){this.elements=void 0,this.elements=e}identity(){let e=this.elements;e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1}setZero(){let e=this.elements;e[0]=0,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=0,e[6]=0,e[7]=0,e[8]=0}setTrace(e){let t=this.elements;t[0]=e.x,t[4]=e.y,t[8]=e.z}getTrace(e=new M){let t=this.elements;return e.x=t[0],e.y=t[4],e.z=t[8],e}vmult(e,t=new M){let i=this.elements,n=e.x,s=e.y,r=e.z;return t.x=i[0]*n+i[1]*s+i[2]*r,t.y=i[3]*n+i[4]*s+i[5]*r,t.z=i[6]*n+i[7]*s+i[8]*r,t}smult(e){for(let t=0;t<this.elements.length;t++)this.elements[t]*=e}mmult(e,t=new jt){let i=this.elements,n=e.elements,s=t.elements,r=i[0],a=i[1],c=i[2],l=i[3],h=i[4],f=i[5],u=i[6],d=i[7],p=i[8],v=n[0],x=n[1],g=n[2],m=n[3],z=n[4],y=n[5],b=n[6],S=n[7],_=n[8];return s[0]=r*v+a*m+c*b,s[1]=r*x+a*z+c*S,s[2]=r*g+a*y+c*_,s[3]=l*v+h*m+f*b,s[4]=l*x+h*z+f*S,s[5]=l*g+h*y+f*_,s[6]=u*v+d*m+p*b,s[7]=u*x+d*z+p*S,s[8]=u*g+d*y+p*_,t}scale(e,t=new jt){let i=this.elements,n=t.elements;for(let s=0;s!==3;s++)n[3*s+0]=e.x*i[3*s+0],n[3*s+1]=e.y*i[3*s+1],n[3*s+2]=e.z*i[3*s+2];return t}solve(e,t=new M){let i=3,n=4,s=[],r,a;for(r=0;r<i*n;r++)s.push(0);for(r=0;r<3;r++)for(a=0;a<3;a++)s[r+n*a]=this.elements[r+3*a];s[3+4*0]=e.x,s[3+4*1]=e.y,s[3+4*2]=e.z;let c=3,l=c,h,f=4,u;do{if(r=l-c,s[r+n*r]===0){for(a=r+1;a<l;a++)if(s[r+n*a]!==0){h=f;do u=f-h,s[u+n*r]+=s[u+n*a];while(--h);break}}if(s[r+n*r]!==0)for(a=r+1;a<l;a++){let d=s[r+n*a]/s[r+n*r];h=f;do u=f-h,s[u+n*a]=u<=r?0:s[u+n*a]-s[u+n*r]*d;while(--h)}}while(--c);if(t.z=s[2*n+3]/s[2*n+2],t.y=(s[1*n+3]-s[1*n+2]*t.z)/s[1*n+1],t.x=(s[0*n+3]-s[0*n+2]*t.z-s[0*n+1]*t.y)/s[0*n+0],isNaN(t.x)||isNaN(t.y)||isNaN(t.z)||t.x===1/0||t.y===1/0||t.z===1/0)throw"Could not solve equation! Got x=["+t.toString()+"], b=["+e.toString()+"], A=["+this.toString()+"]";return t}e(e,t,i){if(i===void 0)return this.elements[t+3*e];this.elements[t+3*e]=i}copy(e){for(let t=0;t<e.elements.length;t++)this.elements[t]=e.elements[t];return this}toString(){let e="",t=",";for(let i=0;i<9;i++)e+=this.elements[i]+t;return e}reverse(e=new jt){let t=3,i=6,n=gu,s,r;for(s=0;s<3;s++)for(r=0;r<3;r++)n[s+i*r]=this.elements[s+3*r];n[3+6*0]=1,n[3+6*1]=0,n[3+6*2]=0,n[4+6*0]=0,n[4+6*1]=1,n[4+6*2]=0,n[5+6*0]=0,n[5+6*1]=0,n[5+6*2]=1;let a=3,c=a,l,h=i,f;do{if(s=c-a,n[s+i*s]===0){for(r=s+1;r<c;r++)if(n[s+i*r]!==0){l=h;do f=h-l,n[f+i*s]+=n[f+i*r];while(--l);break}}if(n[s+i*s]!==0)for(r=s+1;r<c;r++){let u=n[s+i*r]/n[s+i*s];l=h;do f=h-l,n[f+i*r]=f<=s?0:n[f+i*r]-n[f+i*s]*u;while(--l)}}while(--a);s=2;do{r=s-1;do{let u=n[s+i*r]/n[s+i*s];l=i;do f=i-l,n[f+i*r]=n[f+i*r]-n[f+i*s]*u;while(--l)}while(r--)}while(--s);s=2;do{let u=1/n[s+i*s];l=i;do f=i-l,n[f+i*s]=n[f+i*s]*u;while(--l)}while(s--);s=2;do{r=2;do{if(f=n[t+r+i*s],isNaN(f)||f===1/0)throw"Could not reverse! A=["+this.toString()+"]";e.e(s,r,f)}while(r--)}while(s--);return e}setRotationFromQuaternion(e){let t=e.x,i=e.y,n=e.z,s=e.w,r=t+t,a=i+i,c=n+n,l=t*r,h=t*a,f=t*c,u=i*a,d=i*c,p=n*c,v=s*r,x=s*a,g=s*c,m=this.elements;return m[3*0+0]=1-(u+p),m[3*0+1]=h-g,m[3*0+2]=f+x,m[3*1+0]=h+g,m[3*1+1]=1-(l+p),m[3*1+2]=d-v,m[3*2+0]=f-x,m[3*2+1]=d+v,m[3*2+2]=1-(l+u),this}transpose(e=new jt){let t=this.elements,i=e.elements,n;return i[0]=t[0],i[4]=t[4],i[8]=t[8],n=t[1],i[1]=t[3],i[3]=n,n=t[2],i[2]=t[6],i[6]=n,n=t[5],i[5]=t[7],i[7]=n,e}},gu=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],M=class{constructor(e=0,t=0,i=0){this.x=void 0,this.y=void 0,this.z=void 0,this.x=e,this.y=t,this.z=i}cross(e,t=new M){let i=e.x,n=e.y,s=e.z,r=this.x,a=this.y,c=this.z;return t.x=a*s-c*n,t.y=c*i-r*s,t.z=r*n-a*i,t}set(e,t,i){return this.x=e,this.y=t,this.z=i,this}setZero(){this.x=this.y=this.z=0}vadd(e,t){if(t)t.x=e.x+this.x,t.y=e.y+this.y,t.z=e.z+this.z;else return new M(this.x+e.x,this.y+e.y,this.z+e.z)}vsub(e,t){if(t)t.x=this.x-e.x,t.y=this.y-e.y,t.z=this.z-e.z;else return new M(this.x-e.x,this.y-e.y,this.z-e.z)}crossmat(){return new jt([0,-this.z,this.y,this.z,0,-this.x,-this.y,this.x,0])}normalize(){let e=this.x,t=this.y,i=this.z,n=Math.sqrt(e*e+t*t+i*i);if(n>0){let s=1/n;this.x*=s,this.y*=s,this.z*=s}else this.x=0,this.y=0,this.z=0;return n}unit(e=new M){let t=this.x,i=this.y,n=this.z,s=Math.sqrt(t*t+i*i+n*n);return s>0?(s=1/s,e.x=t*s,e.y=i*s,e.z=n*s):(e.x=1,e.y=0,e.z=0),e}length(){let e=this.x,t=this.y,i=this.z;return Math.sqrt(e*e+t*t+i*i)}lengthSquared(){return this.dot(this)}distanceTo(e){let t=this.x,i=this.y,n=this.z,s=e.x,r=e.y,a=e.z;return Math.sqrt((s-t)*(s-t)+(r-i)*(r-i)+(a-n)*(a-n))}distanceSquared(e){let t=this.x,i=this.y,n=this.z,s=e.x,r=e.y,a=e.z;return(s-t)*(s-t)+(r-i)*(r-i)+(a-n)*(a-n)}scale(e,t=new M){let i=this.x,n=this.y,s=this.z;return t.x=e*i,t.y=e*n,t.z=e*s,t}vmul(e,t=new M){return t.x=e.x*this.x,t.y=e.y*this.y,t.z=e.z*this.z,t}addScaledVector(e,t,i=new M){return i.x=this.x+e*t.x,i.y=this.y+e*t.y,i.z=this.z+e*t.z,i}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}isZero(){return this.x===0&&this.y===0&&this.z===0}negate(e=new M){return e.x=-this.x,e.y=-this.y,e.z=-this.z,e}tangents(e,t){let i=this.length();if(i>0){let n=vu,s=1/i;n.set(this.x*s,this.y*s,this.z*s);let r=xu;Math.abs(n.x)<.9?(r.set(1,0,0),n.cross(r,e)):(r.set(0,1,0),n.cross(r,e)),n.cross(e,t)}else e.set(1,0,0),t.set(0,1,0)}toString(){return this.x+","+this.y+","+this.z}toArray(){return[this.x,this.y,this.z]}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}lerp(e,t,i){let n=this.x,s=this.y,r=this.z;i.x=n+(e.x-n)*t,i.y=s+(e.y-s)*t,i.z=r+(e.z-r)*t}almostEquals(e,t=1e-6){return!(Math.abs(this.x-e.x)>t||Math.abs(this.y-e.y)>t||Math.abs(this.z-e.z)>t)}almostZero(e=1e-6){return!(Math.abs(this.x)>e||Math.abs(this.y)>e||Math.abs(this.z)>e)}isAntiparallelTo(e,t){return this.negate(Z3),Z3.almostEquals(e,t)}clone(){return new M(this.x,this.y,this.z)}};M.ZERO=void 0;M.UNIT_X=void 0;M.UNIT_Y=void 0;M.UNIT_Z=void 0;M.ZERO=new M(0,0,0);M.UNIT_X=new M(1,0,0);M.UNIT_Y=new M(0,1,0);M.UNIT_Z=new M(0,0,1);var vu=new M,xu=new M,Z3=new M,Zt=class{constructor(e={}){this.lowerBound=void 0,this.upperBound=void 0,this.lowerBound=new M,this.upperBound=new M,e.lowerBound&&this.lowerBound.copy(e.lowerBound),e.upperBound&&this.upperBound.copy(e.upperBound)}setFromPoints(e,t,i,n){let s=this.lowerBound,r=this.upperBound,a=i;s.copy(e[0]),a&&a.vmult(s,s),r.copy(s);for(let c=1;c<e.length;c++){let l=e[c];a&&(a.vmult(l,X3),l=X3),l.x>r.x&&(r.x=l.x),l.x<s.x&&(s.x=l.x),l.y>r.y&&(r.y=l.y),l.y<s.y&&(s.y=l.y),l.z>r.z&&(r.z=l.z),l.z<s.z&&(s.z=l.z)}return t&&(t.vadd(s,s),t.vadd(r,r)),n&&(s.x-=n,s.y-=n,s.z-=n,r.x+=n,r.y+=n,r.z+=n),this}copy(e){return this.lowerBound.copy(e.lowerBound),this.upperBound.copy(e.upperBound),this}clone(){return new Zt().copy(this)}extend(e){this.lowerBound.x=Math.min(this.lowerBound.x,e.lowerBound.x),this.upperBound.x=Math.max(this.upperBound.x,e.upperBound.x),this.lowerBound.y=Math.min(this.lowerBound.y,e.lowerBound.y),this.upperBound.y=Math.max(this.upperBound.y,e.upperBound.y),this.lowerBound.z=Math.min(this.lowerBound.z,e.lowerBound.z),this.upperBound.z=Math.max(this.upperBound.z,e.upperBound.z)}overlaps(e){let t=this.lowerBound,i=this.upperBound,n=e.lowerBound,s=e.upperBound,r=n.x<=i.x&&i.x<=s.x||t.x<=s.x&&s.x<=i.x,a=n.y<=i.y&&i.y<=s.y||t.y<=s.y&&s.y<=i.y,c=n.z<=i.z&&i.z<=s.z||t.z<=s.z&&s.z<=i.z;return r&&a&&c}volume(){let e=this.lowerBound,t=this.upperBound;return(t.x-e.x)*(t.y-e.y)*(t.z-e.z)}contains(e){let t=this.lowerBound,i=this.upperBound,n=e.lowerBound,s=e.upperBound;return t.x<=n.x&&i.x>=s.x&&t.y<=n.y&&i.y>=s.y&&t.z<=n.z&&i.z>=s.z}getCorners(e,t,i,n,s,r,a,c){let l=this.lowerBound,h=this.upperBound;e.copy(l),t.set(h.x,l.y,l.z),i.set(h.x,h.y,l.z),n.set(l.x,h.y,h.z),s.set(h.x,l.y,h.z),r.set(l.x,h.y,l.z),a.set(l.x,l.y,h.z),c.copy(h)}toLocalFrame(e,t){let i=Y3,n=i[0],s=i[1],r=i[2],a=i[3],c=i[4],l=i[5],h=i[6],f=i[7];this.getCorners(n,s,r,a,c,l,h,f);for(let u=0;u!==8;u++){let d=i[u];e.pointToLocal(d,d)}return t.setFromPoints(i)}toWorldFrame(e,t){let i=Y3,n=i[0],s=i[1],r=i[2],a=i[3],c=i[4],l=i[5],h=i[6],f=i[7];this.getCorners(n,s,r,a,c,l,h,f);for(let u=0;u!==8;u++){let d=i[u];e.pointToWorld(d,d)}return t.setFromPoints(i)}overlapsRay(e){let{direction:t,from:i}=e,n=1/t.x,s=1/t.y,r=1/t.z,a=(this.lowerBound.x-i.x)*n,c=(this.upperBound.x-i.x)*n,l=(this.lowerBound.y-i.y)*s,h=(this.upperBound.y-i.y)*s,f=(this.lowerBound.z-i.z)*r,u=(this.upperBound.z-i.z)*r,d=Math.max(Math.max(Math.min(a,c),Math.min(l,h)),Math.min(f,u)),p=Math.min(Math.min(Math.max(a,c),Math.max(l,h)),Math.max(f,u));return!(p<0||d>p)}},X3=new M,Y3=[new M,new M,new M,new M,new M,new M,new M,new M],J4=class{constructor(){this.matrix=void 0,this.matrix=[]}get(e,t){let{index:i}=e,{index:n}=t;if(n>i){let s=n;n=i,i=s}return this.matrix[(i*(i+1)>>1)+n-1]}set(e,t,i){let{index:n}=e,{index:s}=t;if(s>n){let r=s;s=n,n=r}this.matrix[(n*(n+1)>>1)+s-1]=i?1:0}reset(){for(let e=0,t=this.matrix.length;e!==t;e++)this.matrix[e]=0}setNumObjects(e){this.matrix.length=e*(e-1)>>1}},Q4=class{constructor(){this._listeners=void 0}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let i=this._listeners;return i[e]===void 0&&(i[e]=[]),i[e].includes(t)||i[e].push(t),this}hasEventListener(e,t){if(this._listeners===void 0)return!1;let i=this._listeners;return!!(i[e]!==void 0&&i[e].includes(t))}hasAnyEventListener(e){return this._listeners===void 0?!1:this._listeners[e]!==void 0}removeEventListener(e,t){if(this._listeners===void 0)return this;let i=this._listeners;if(i[e]===void 0)return this;let n=i[e].indexOf(t);return n!==-1&&i[e].splice(n,1),this}dispatchEvent(e){if(this._listeners===void 0)return this;let i=this._listeners[e.type];if(i!==void 0){e.target=this;for(let n=0,s=i.length;n<s;n++)i[n].call(this,e)}return this}},nt=class{constructor(e=0,t=0,i=0,n=1){this.x=void 0,this.y=void 0,this.z=void 0,this.w=void 0,this.x=e,this.y=t,this.z=i,this.w=n}set(e,t,i,n){return this.x=e,this.y=t,this.z=i,this.w=n,this}toString(){return this.x+","+this.y+","+this.z+","+this.w}toArray(){return[this.x,this.y,this.z,this.w]}setFromAxisAngle(e,t){let i=Math.sin(t*.5);return this.x=e.x*i,this.y=e.y*i,this.z=e.z*i,this.w=Math.cos(t*.5),this}toAxisAngle(e=new M){this.normalize();let t=2*Math.acos(this.w),i=Math.sqrt(1-this.w*this.w);return i<.001?(e.x=this.x,e.y=this.y,e.z=this.z):(e.x=this.x/i,e.y=this.y/i,e.z=this.z/i),[e,t]}setFromVectors(e,t){if(e.isAntiparallelTo(t)){let i=yu,n=wu;e.tangents(i,n),this.setFromAxisAngle(i,Math.PI)}else{let i=e.cross(t);this.x=i.x,this.y=i.y,this.z=i.z,this.w=Math.sqrt(e.length()**2*t.length()**2)+e.dot(t),this.normalize()}return this}mult(e,t=new nt){let i=this.x,n=this.y,s=this.z,r=this.w,a=e.x,c=e.y,l=e.z,h=e.w;return t.x=i*h+r*a+n*l-s*c,t.y=n*h+r*c+s*a-i*l,t.z=s*h+r*l+i*c-n*a,t.w=r*h-i*a-n*c-s*l,t}inverse(e=new nt){let t=this.x,i=this.y,n=this.z,s=this.w;this.conjugate(e);let r=1/(t*t+i*i+n*n+s*s);return e.x*=r,e.y*=r,e.z*=r,e.w*=r,e}conjugate(e=new nt){return e.x=-this.x,e.y=-this.y,e.z=-this.z,e.w=this.w,e}normalize(){let e=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);return e===0?(this.x=0,this.y=0,this.z=0,this.w=0):(e=1/e,this.x*=e,this.y*=e,this.z*=e,this.w*=e),this}normalizeFast(){let e=(3-(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w))/2;return e===0?(this.x=0,this.y=0,this.z=0,this.w=0):(this.x*=e,this.y*=e,this.z*=e,this.w*=e),this}vmult(e,t=new M){let i=e.x,n=e.y,s=e.z,r=this.x,a=this.y,c=this.z,l=this.w,h=l*i+a*s-c*n,f=l*n+c*i-r*s,u=l*s+r*n-a*i,d=-r*i-a*n-c*s;return t.x=h*l+d*-r+f*-c-u*-a,t.y=f*l+d*-a+u*-r-h*-c,t.z=u*l+d*-c+h*-a-f*-r,t}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this}toEuler(e,t="YZX"){let i,n,s,r=this.x,a=this.y,c=this.z,l=this.w;switch(t){case"YZX":let h=r*a+c*l;if(h>.499&&(i=2*Math.atan2(r,l),n=Math.PI/2,s=0),h<-.499&&(i=-2*Math.atan2(r,l),n=-Math.PI/2,s=0),i===void 0){let f=r*r,u=a*a,d=c*c;i=Math.atan2(2*a*l-2*r*c,1-2*u-2*d),n=Math.asin(2*h),s=Math.atan2(2*r*l-2*a*c,1-2*f-2*d)}break;default:throw new Error("Euler order "+t+" not supported yet.")}e.y=i,e.z=n,e.x=s}setFromEuler(e,t,i,n="XYZ"){let s=Math.cos(e/2),r=Math.cos(t/2),a=Math.cos(i/2),c=Math.sin(e/2),l=Math.sin(t/2),h=Math.sin(i/2);return n==="XYZ"?(this.x=c*r*a+s*l*h,this.y=s*l*a-c*r*h,this.z=s*r*h+c*l*a,this.w=s*r*a-c*l*h):n==="YXZ"?(this.x=c*r*a+s*l*h,this.y=s*l*a-c*r*h,this.z=s*r*h-c*l*a,this.w=s*r*a+c*l*h):n==="ZXY"?(this.x=c*r*a-s*l*h,this.y=s*l*a+c*r*h,this.z=s*r*h+c*l*a,this.w=s*r*a-c*l*h):n==="ZYX"?(this.x=c*r*a-s*l*h,this.y=s*l*a+c*r*h,this.z=s*r*h-c*l*a,this.w=s*r*a+c*l*h):n==="YZX"?(this.x=c*r*a+s*l*h,this.y=s*l*a+c*r*h,this.z=s*r*h-c*l*a,this.w=s*r*a-c*l*h):n==="XZY"&&(this.x=c*r*a-s*l*h,this.y=s*l*a-c*r*h,this.z=s*r*h+c*l*a,this.w=s*r*a+c*l*h),this}clone(){return new nt(this.x,this.y,this.z,this.w)}slerp(e,t,i=new nt){let n=this.x,s=this.y,r=this.z,a=this.w,c=e.x,l=e.y,h=e.z,f=e.w,u,d,p,v,x;return d=n*c+s*l+r*h+a*f,d<0&&(d=-d,c=-c,l=-l,h=-h,f=-f),1-d>1e-6?(u=Math.acos(d),p=Math.sin(u),v=Math.sin((1-t)*u)/p,x=Math.sin(t*u)/p):(v=1-t,x=t),i.x=v*n+x*c,i.y=v*s+x*l,i.z=v*r+x*h,i.w=v*a+x*f,i}integrate(e,t,i,n=new nt){let s=e.x*i.x,r=e.y*i.y,a=e.z*i.z,c=this.x,l=this.y,h=this.z,f=this.w,u=t*.5;return n.x+=u*(s*f+r*h-a*l),n.y+=u*(r*f+a*c-s*h),n.z+=u*(a*f+s*l-r*c),n.w+=u*(-s*c-r*l-a*h),n}},yu=new M,wu=new M,bu={SPHERE:1,PLANE:2,BOX:4,COMPOUND:8,CONVEXPOLYHEDRON:16,HEIGHTFIELD:32,PARTICLE:64,CYLINDER:128,TRIMESH:256},me=class{constructor(e={}){this.id=void 0,this.type=void 0,this.boundingSphereRadius=void 0,this.collisionResponse=void 0,this.collisionFilterGroup=void 0,this.collisionFilterMask=void 0,this.material=void 0,this.body=void 0,this.id=me.idCounter++,this.type=e.type||0,this.boundingSphereRadius=0,this.collisionResponse=e.collisionResponse?e.collisionResponse:!0,this.collisionFilterGroup=e.collisionFilterGroup!==void 0?e.collisionFilterGroup:1,this.collisionFilterMask=e.collisionFilterMask!==void 0?e.collisionFilterMask:-1,this.material=e.material?e.material:null,this.body=null}updateBoundingSphereRadius(){throw"computeBoundingSphereRadius() not implemented for shape type "+this.type}volume(){throw"volume() not implemented for shape type "+this.type}calculateLocalInertia(e,t){throw"calculateLocalInertia() not implemented for shape type "+this.type}calculateWorldAABB(e,t,i,n){throw"calculateWorldAABB() not implemented for shape type "+this.type}};me.idCounter=0;me.types=bu;var qe=class{constructor(e={}){this.position=void 0,this.quaternion=void 0,this.position=new M,this.quaternion=new nt,e.position&&this.position.copy(e.position),e.quaternion&&this.quaternion.copy(e.quaternion)}pointToLocal(e,t){return qe.pointToLocalFrame(this.position,this.quaternion,e,t)}pointToWorld(e,t){return qe.pointToWorldFrame(this.position,this.quaternion,e,t)}vectorToWorldFrame(e,t=new M){return this.quaternion.vmult(e,t),t}static pointToLocalFrame(e,t,i,n=new M){return i.vsub(e,n),t.conjugate($3),$3.vmult(n,n),n}static pointToWorldFrame(e,t,i,n=new M){return t.vmult(i,n),n.vadd(e,n),n}static vectorToWorldFrame(e,t,i=new M){return e.vmult(t,i),i}static vectorToLocalFrame(e,t,i,n=new M){return t.w*=-1,t.vmult(i,n),t.w*=-1,n}},$3=new nt,F2=class extends me{constructor(e={}){let{vertices:t=[],faces:i=[],normals:n=[],axes:s,boundingSphereRadius:r}=e;super({type:me.types.CONVEXPOLYHEDRON});this.vertices=void 0,this.faces=void 0,this.faceNormals=void 0,this.worldVertices=void 0,this.worldVerticesNeedsUpdate=void 0,this.worldFaceNormals=void 0,this.worldFaceNormalsNeedsUpdate=void 0,this.uniqueAxes=void 0,this.uniqueEdges=void 0,this.vertices=t,this.faces=i,this.faceNormals=n,this.faceNormals.length===0&&this.computeNormals(),r?this.boundingSphereRadius=r:this.updateBoundingSphereRadius(),this.worldVertices=[],this.worldVerticesNeedsUpdate=!0,this.worldFaceNormals=[],this.worldFaceNormalsNeedsUpdate=!0,this.uniqueAxes=s?s.slice():null,this.uniqueEdges=[],this.computeEdges()}computeEdges(){let e=this.faces,t=this.vertices,i=this.uniqueEdges;i.length=0;let n=new M;for(let s=0;s!==e.length;s++){let r=e[s],a=r.length;for(let c=0;c!==a;c++){let l=(c+1)%a;t[r[c]].vsub(t[r[l]],n),n.normalize();let h=!1;for(let f=0;f!==i.length;f++)if(i[f].almostEquals(n)||i[f].almostEquals(n)){h=!0;break}h||i.push(n.clone())}}}computeNormals(){this.faceNormals.length=this.faces.length;for(let e=0;e<this.faces.length;e++){for(let n=0;n<this.faces[e].length;n++)if(!this.vertices[this.faces[e][n]])throw new Error("Vertex "+this.faces[e][n]+" not found!");let t=this.faceNormals[e]||new M;this.getFaceNormal(e,t),t.negate(t),this.faceNormals[e]=t;let i=this.vertices[this.faces[e][0]];if(t.dot(i)<0){console.error(".faceNormals["+e+"] = Vec3("+t.toString()+") looks like it points into the shape? The vertices follow. Make sure they are ordered CCW around the normal, using the right hand rule.");for(let n=0;n<this.faces[e].length;n++)console.warn(".vertices["+this.faces[e][n]+"] = Vec3("+this.vertices[this.faces[e][n]].toString()+")")}}}getFaceNormal(e,t){let i=this.faces[e],n=this.vertices[i[0]],s=this.vertices[i[1]],r=this.vertices[i[2]];F2.computeNormal(n,s,r,t)}static computeNormal(e,t,i,n){let s=new M,r=new M;t.vsub(e,r),i.vsub(t,s),s.cross(r,n),n.isZero()||n.normalize()}clipAgainstHull(e,t,i,n,s,r,a,c,l){let h=new M,f=-1,u=-Number.MAX_VALUE;for(let p=0;p<i.faces.length;p++){h.copy(i.faceNormals[p]),s.vmult(h,h);let v=h.dot(r);v>u&&(u=v,f=p)}let d=[];for(let p=0;p<i.faces[f].length;p++){let v=i.vertices[i.faces[f][p]],x=new M;x.copy(v),s.vmult(x,x),n.vadd(x,x),d.push(x)}f>=0&&this.clipFaceAgainstHull(r,e,t,d,a,c,l)}findSeparatingAxis(e,t,i,n,s,r,a,c){let l=new M,h=new M,f=new M,u=new M,d=new M,p=new M,v=Number.MAX_VALUE,x=this;if(x.uniqueAxes)for(let g=0;g!==x.uniqueAxes.length;g++){i.vmult(x.uniqueAxes[g],l);let m=x.testSepAxis(l,e,t,i,n,s);if(m===!1)return!1;m<v&&(v=m,r.copy(l))}else{let g=a?a.length:x.faces.length;for(let m=0;m<g;m++){let z=a?a[m]:m;l.copy(x.faceNormals[z]),i.vmult(l,l);let y=x.testSepAxis(l,e,t,i,n,s);if(y===!1)return!1;y<v&&(v=y,r.copy(l))}}if(e.uniqueAxes)for(let g=0;g!==e.uniqueAxes.length;g++){s.vmult(e.uniqueAxes[g],h);let m=x.testSepAxis(h,e,t,i,n,s);if(m===!1)return!1;m<v&&(v=m,r.copy(h))}else{let g=c?c.length:e.faces.length;for(let m=0;m<g;m++){let z=c?c[m]:m;h.copy(e.faceNormals[z]),s.vmult(h,h);let y=x.testSepAxis(h,e,t,i,n,s);if(y===!1)return!1;y<v&&(v=y,r.copy(h))}}for(let g=0;g!==x.uniqueEdges.length;g++){i.vmult(x.uniqueEdges[g],u);for(let m=0;m!==e.uniqueEdges.length;m++)if(s.vmult(e.uniqueEdges[m],d),u.cross(d,p),!p.almostZero()){p.normalize();let z=x.testSepAxis(p,e,t,i,n,s);if(z===!1)return!1;z<v&&(v=z,r.copy(p))}}return n.vsub(t,f),f.dot(r)>0&&r.negate(r),!0}testSepAxis(e,t,i,n,s,r){let a=this;F2.project(a,e,i,n,K4),F2.project(t,e,s,r,e0);let c=K4[0],l=K4[1],h=e0[0],f=e0[1];if(c<f||h<l)return!1;let u=c-f,d=h-l;return u<d?u:d}calculateLocalInertia(e,t){let i=new M,n=new M;this.computeLocalAABB(n,i);let s=i.x-n.x,r=i.y-n.y,a=i.z-n.z;t.x=1/12*e*(2*r*2*r+2*a*2*a),t.y=1/12*e*(2*s*2*s+2*a*2*a),t.z=1/12*e*(2*r*2*r+2*s*2*s)}getPlaneConstantOfFace(e){let t=this.faces[e],i=this.faceNormals[e],n=this.vertices[t[0]];return-i.dot(n)}clipFaceAgainstHull(e,t,i,n,s,r,a){let c=new M,l=new M,h=new M,f=new M,u=new M,d=new M,p=new M,v=new M,x=this,g=[],m=n,z=g,y=-1,b=Number.MAX_VALUE;for(let R=0;R<x.faces.length;R++){c.copy(x.faceNormals[R]),i.vmult(c,c);let w=c.dot(e);w<b&&(b=w,y=R)}if(y<0)return;let S=x.faces[y];S.connectedFaces=[];for(let R=0;R<x.faces.length;R++)for(let w=0;w<x.faces[R].length;w++)S.indexOf(x.faces[R][w])!==-1&&R!==y&&S.connectedFaces.indexOf(R)===-1&&S.connectedFaces.push(R);let _=S.length;for(let R=0;R<_;R++){let w=x.vertices[S[R]],D=x.vertices[S[(R+1)%_]];w.vsub(D,l),h.copy(l),i.vmult(h,h),t.vadd(h,h),f.copy(this.faceNormals[y]),i.vmult(f,f),t.vadd(f,f),h.cross(f,u),u.negate(u),d.copy(w),i.vmult(d,d),t.vadd(d,d);let C=S.connectedFaces[R];p.copy(this.faceNormals[C]);let V=this.getPlaneConstantOfFace(C);v.copy(p),i.vmult(v,v);let H=V-v.dot(t);for(this.clipFaceAgainstPlane(m,z,v,H);m.length;)m.shift();for(;z.length;)m.push(z.shift())}p.copy(this.faceNormals[y]);let A=this.getPlaneConstantOfFace(y);v.copy(p),i.vmult(v,v);let P=A-v.dot(t);for(let R=0;R<m.length;R++){let w=v.dot(m[R])+P;if(w<=s&&(console.log("clamped: depth="+w+" to minDist="+s),w=s),w<=r){let D=m[R];if(w<=1e-6){let C={point:D,normal:v,depth:w};a.push(C)}}}}clipFaceAgainstPlane(e,t,i,n){let s,r,a=e.length;if(a<2)return t;let c=e[e.length-1],l=e[0];s=i.dot(c)+n;for(let h=0;h<a;h++){if(l=e[h],r=i.dot(l)+n,s<0)if(r<0){let f=new M;f.copy(l),t.push(f)}else{let f=new M;c.lerp(l,s/(s-r),f),t.push(f)}else if(r<0){let f=new M;c.lerp(l,s/(s-r),f),t.push(f),t.push(l)}c=l,s=r}return t}computeWorldVertices(e,t){for(;this.worldVertices.length<this.vertices.length;)this.worldVertices.push(new M);let i=this.vertices,n=this.worldVertices;for(let s=0;s!==this.vertices.length;s++)t.vmult(i[s],n[s]),e.vadd(n[s],n[s]);this.worldVerticesNeedsUpdate=!1}computeLocalAABB(e,t){let i=this.vertices;e.set(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),t.set(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);for(let n=0;n<this.vertices.length;n++){let s=i[n];s.x<e.x?e.x=s.x:s.x>t.x&&(t.x=s.x),s.y<e.y?e.y=s.y:s.y>t.y&&(t.y=s.y),s.z<e.z?e.z=s.z:s.z>t.z&&(t.z=s.z)}}computeWorldFaceNormals(e){let t=this.faceNormals.length;for(;this.worldFaceNormals.length<t;)this.worldFaceNormals.push(new M);let i=this.faceNormals,n=this.worldFaceNormals;for(let s=0;s!==t;s++)e.vmult(i[s],n[s]);this.worldFaceNormalsNeedsUpdate=!1}updateBoundingSphereRadius(){let e=0,t=this.vertices;for(let i=0;i!==t.length;i++){let n=t[i].lengthSquared();n>e&&(e=n)}this.boundingSphereRadius=Math.sqrt(e)}calculateWorldAABB(e,t,i,n){let s=this.vertices,r,a,c,l,h,f,u=new M;for(let d=0;d<s.length;d++){u.copy(s[d]),t.vmult(u,u),e.vadd(u,u);let p=u;(r===void 0||p.x<r)&&(r=p.x),(l===void 0||p.x>l)&&(l=p.x),(a===void 0||p.y<a)&&(a=p.y),(h===void 0||p.y>h)&&(h=p.y),(c===void 0||p.z<c)&&(c=p.z),(f===void 0||p.z>f)&&(f=p.z)}i.set(r,a,c),n.set(l,h,f)}volume(){return 4*Math.PI*this.boundingSphereRadius/3}getAveragePointLocal(e=new M){let t=this.vertices;for(let i=0;i<t.length;i++)e.vadd(t[i],e);return e.scale(1/t.length,e),e}transformAllPoints(e,t){let i=this.vertices.length,n=this.vertices;if(t){for(let s=0;s<i;s++){let r=n[s];t.vmult(r,r)}for(let s=0;s<this.faceNormals.length;s++){let r=this.faceNormals[s];t.vmult(r,r)}}if(e)for(let s=0;s<i;s++){let r=n[s];r.vadd(e,r)}}pointIsInside(e){let t=this.vertices,i=this.faces,n=this.faceNormals,s=new M;this.getAveragePointLocal(s);for(let r=0;r<this.faces.length;r++){let a=n[r],c=t[i[r][0]],l=new M;e.vsub(c,l);let h=a.dot(l),f=new M;s.vsub(c,f);let u=a.dot(f);if(h<0&&u>0||h>0&&u<0)return!1}return-1}static project(e,t,i,n,s){let r=e.vertices.length,a=Mu,c=0,l=0,h=zu,f=e.vertices;h.setZero(),qe.vectorToLocalFrame(i,n,t,a),qe.pointToLocalFrame(i,n,h,h);let u=h.dot(a);l=c=f[0].dot(a);for(let d=1;d<r;d++){let p=f[d].dot(a);p>c&&(c=p),p<l&&(l=p)}if(l-=u,c-=u,l>c){let d=l;l=c,c=d}s[0]=c,s[1]=l}},K4=[],e0=[],Mu=new M,zu=new M,Lr=class extends me{constructor(e){super({type:me.types.BOX});this.halfExtents=void 0,this.convexPolyhedronRepresentation=void 0,this.halfExtents=e,this.convexPolyhedronRepresentation=null,this.updateConvexPolyhedronRepresentation(),this.updateBoundingSphereRadius()}updateConvexPolyhedronRepresentation(){let e=this.halfExtents.x,t=this.halfExtents.y,i=this.halfExtents.z,n=M,s=[new n(-e,-t,-i),new n(e,-t,-i),new n(e,t,-i),new n(-e,t,-i),new n(-e,-t,i),new n(e,-t,i),new n(e,t,i),new n(-e,t,i)],r=[[3,2,1,0],[4,5,6,7],[5,4,0,1],[2,3,7,6],[0,4,7,3],[1,2,6,5]],a=[new n(0,0,1),new n(0,1,0),new n(1,0,0)],c=new F2({vertices:s,faces:r,axes:a});this.convexPolyhedronRepresentation=c,c.material=this.material}calculateLocalInertia(e,t=new M){return Lr.calculateInertia(this.halfExtents,e,t),t}static calculateInertia(e,t,i){let n=e;i.x=1/12*t*(2*n.y*2*n.y+2*n.z*2*n.z),i.y=1/12*t*(2*n.x*2*n.x+2*n.z*2*n.z),i.z=1/12*t*(2*n.y*2*n.y+2*n.x*2*n.x)}getSideNormals(e,t){let i=e,n=this.halfExtents;if(i[0].set(n.x,0,0),i[1].set(0,n.y,0),i[2].set(0,0,n.z),i[3].set(-n.x,0,0),i[4].set(0,-n.y,0),i[5].set(0,0,-n.z),t!==void 0)for(let s=0;s!==i.length;s++)t.vmult(i[s],i[s]);return i}volume(){return 8*this.halfExtents.x*this.halfExtents.y*this.halfExtents.z}updateBoundingSphereRadius(){this.boundingSphereRadius=this.halfExtents.length()}forEachWorldCorner(e,t,i){let n=this.halfExtents,s=[[n.x,n.y,n.z],[-n.x,n.y,n.z],[-n.x,-n.y,n.z],[-n.x,-n.y,-n.z],[n.x,-n.y,-n.z],[n.x,n.y,-n.z],[-n.x,n.y,-n.z],[n.x,-n.y,n.z]];for(let r=0;r<s.length;r++)B2.set(s[r][0],s[r][1],s[r][2]),t.vmult(B2,B2),e.vadd(B2,B2),i(B2.x,B2.y,B2.z)}calculateWorldAABB(e,t,i,n){let s=this.halfExtents;P1[0].set(s.x,s.y,s.z),P1[1].set(-s.x,s.y,s.z),P1[2].set(-s.x,-s.y,s.z),P1[3].set(-s.x,-s.y,-s.z),P1[4].set(s.x,-s.y,-s.z),P1[5].set(s.x,s.y,-s.z),P1[6].set(-s.x,s.y,-s.z),P1[7].set(s.x,-s.y,s.z);let r=P1[0];t.vmult(r,r),e.vadd(r,r),n.copy(r),i.copy(r);for(let a=1;a<8;a++){let c=P1[a];t.vmult(c,c),e.vadd(c,c);let l=c.x,h=c.y,f=c.z;l>n.x&&(n.x=l),h>n.y&&(n.y=h),f>n.z&&(n.z=f),l<i.x&&(i.x=l),h<i.y&&(i.y=h),f<i.z&&(i.z=f)}}},B2=new M,P1=[new M,new M,new M,new M,new M,new M,new M,new M],t0={DYNAMIC:1,STATIC:2,KINEMATIC:4},i0={AWAKE:0,SLEEPY:1,SLEEPING:2},ae=class extends Q4{constructor(e={}){super();this.id=void 0,this.index=void 0,this.world=void 0,this.preStep=void 0,this.postStep=void 0,this.vlambda=void 0,this.collisionFilterGroup=void 0,this.collisionFilterMask=void 0,this.collisionResponse=void 0,this.position=void 0,this.previousPosition=void 0,this.interpolatedPosition=void 0,this.initPosition=void 0,this.velocity=void 0,this.initVelocity=void 0,this.force=void 0,this.mass=void 0,this.invMass=void 0,this.material=void 0,this.linearDamping=void 0,this.type=void 0,this.allowSleep=void 0,this.sleepState=void 0,this.sleepSpeedLimit=void 0,this.sleepTimeLimit=void 0,this.timeLastSleepy=void 0,this.wakeUpAfterNarrowphase=void 0,this.torque=void 0,this.quaternion=void 0,this.initQuaternion=void 0,this.previousQuaternion=void 0,this.interpolatedQuaternion=void 0,this.angularVelocity=void 0,this.initAngularVelocity=void 0,this.shapes=void 0,this.shapeOffsets=void 0,this.shapeOrientations=void 0,this.inertia=void 0,this.invInertia=void 0,this.invInertiaWorld=void 0,this.invMassSolve=void 0,this.invInertiaSolve=void 0,this.invInertiaWorldSolve=void 0,this.fixedRotation=void 0,this.angularDamping=void 0,this.linearFactor=void 0,this.angularFactor=void 0,this.aabb=void 0,this.aabbNeedsUpdate=void 0,this.boundingRadius=void 0,this.wlambda=void 0,this.isTrigger=void 0,this.id=ae.idCounter++,this.index=-1,this.world=null,this.preStep=null,this.postStep=null,this.vlambda=new M,this.collisionFilterGroup=typeof e.collisionFilterGroup=="number"?e.collisionFilterGroup:1,this.collisionFilterMask=typeof e.collisionFilterMask=="number"?e.collisionFilterMask:-1,this.collisionResponse=typeof e.collisionResponse=="boolean"?e.collisionResponse:!0,this.position=new M,this.previousPosition=new M,this.interpolatedPosition=new M,this.initPosition=new M,e.position&&(this.position.copy(e.position),this.previousPosition.copy(e.position),this.interpolatedPosition.copy(e.position),this.initPosition.copy(e.position)),this.velocity=new M,e.velocity&&this.velocity.copy(e.velocity),this.initVelocity=new M,this.force=new M;let t=typeof e.mass=="number"?e.mass:0;this.mass=t,this.invMass=t>0?1/t:0,this.material=e.material||null,this.linearDamping=typeof e.linearDamping=="number"?e.linearDamping:.01,this.type=t<=0?ae.STATIC:ae.DYNAMIC,typeof e.type==typeof ae.STATIC&&(this.type=e.type),this.allowSleep=typeof e.allowSleep!="undefined"?e.allowSleep:!0,this.sleepState=ae.AWAKE,this.sleepSpeedLimit=typeof e.sleepSpeedLimit!="undefined"?e.sleepSpeedLimit:.1,this.sleepTimeLimit=typeof e.sleepTimeLimit!="undefined"?e.sleepTimeLimit:1,this.timeLastSleepy=0,this.wakeUpAfterNarrowphase=!1,this.torque=new M,this.quaternion=new nt,this.initQuaternion=new nt,this.previousQuaternion=new nt,this.interpolatedQuaternion=new nt,e.quaternion&&(this.quaternion.copy(e.quaternion),this.initQuaternion.copy(e.quaternion),this.previousQuaternion.copy(e.quaternion),this.interpolatedQuaternion.copy(e.quaternion)),this.angularVelocity=new M,e.angularVelocity&&this.angularVelocity.copy(e.angularVelocity),this.initAngularVelocity=new M,this.shapes=[],this.shapeOffsets=[],this.shapeOrientations=[],this.inertia=new M,this.invInertia=new M,this.invInertiaWorld=new jt,this.invMassSolve=0,this.invInertiaSolve=new M,this.invInertiaWorldSolve=new jt,this.fixedRotation=typeof e.fixedRotation!="undefined"?e.fixedRotation:!1,this.angularDamping=typeof e.angularDamping!="undefined"?e.angularDamping:.01,this.linearFactor=new M(1,1,1),e.linearFactor&&this.linearFactor.copy(e.linearFactor),this.angularFactor=new M(1,1,1),e.angularFactor&&this.angularFactor.copy(e.angularFactor),this.aabb=new Zt,this.aabbNeedsUpdate=!0,this.boundingRadius=0,this.wlambda=new M,this.isTrigger=Boolean(e.isTrigger),e.shape&&this.addShape(e.shape),this.updateMassProperties()}wakeUp(){let e=this.sleepState;this.sleepState=ae.AWAKE,this.wakeUpAfterNarrowphase=!1,e===ae.SLEEPING&&this.dispatchEvent(ae.wakeupEvent)}sleep(){this.sleepState=ae.SLEEPING,this.velocity.set(0,0,0),this.angularVelocity.set(0,0,0),this.wakeUpAfterNarrowphase=!1}sleepTick(e){if(this.allowSleep){let t=this.sleepState,i=this.velocity.lengthSquared()+this.angularVelocity.lengthSquared(),n=this.sleepSpeedLimit**2;t===ae.AWAKE&&i<n?(this.sleepState=ae.SLEEPY,this.timeLastSleepy=e,this.dispatchEvent(ae.sleepyEvent)):t===ae.SLEEPY&&i>n?this.wakeUp():t===ae.SLEEPY&&e-this.timeLastSleepy>this.sleepTimeLimit&&(this.sleep(),this.dispatchEvent(ae.sleepEvent))}}updateSolveMassProperties(){this.sleepState===ae.SLEEPING||this.type===ae.KINEMATIC?(this.invMassSolve=0,this.invInertiaSolve.setZero(),this.invInertiaWorldSolve.setZero()):(this.invMassSolve=this.invMass,this.invInertiaSolve.copy(this.invInertia),this.invInertiaWorldSolve.copy(this.invInertiaWorld))}pointToLocalFrame(e,t=new M){return e.vsub(this.position,t),this.quaternion.conjugate().vmult(t,t),t}vectorToLocalFrame(e,t=new M){return this.quaternion.conjugate().vmult(e,t),t}pointToWorldFrame(e,t=new M){return this.quaternion.vmult(e,t),t.vadd(this.position,t),t}vectorToWorldFrame(e,t=new M){return this.quaternion.vmult(e,t),t}addShape(e,t,i){let n=new M,s=new nt;return t&&n.copy(t),i&&s.copy(i),this.shapes.push(e),this.shapeOffsets.push(n),this.shapeOrientations.push(s),this.updateMassProperties(),this.updateBoundingRadius(),this.aabbNeedsUpdate=!0,e.body=this,this}removeShape(e){let t=this.shapes.indexOf(e);return t===-1?(console.warn("Shape does not belong to the body"),this):(this.shapes.splice(t,1),this.shapeOffsets.splice(t,1),this.shapeOrientations.splice(t,1),this.updateMassProperties(),this.updateBoundingRadius(),this.aabbNeedsUpdate=!0,e.body=null,this)}updateBoundingRadius(){let e=this.shapes,t=this.shapeOffsets,i=e.length,n=0;for(let s=0;s!==i;s++){let r=e[s];r.updateBoundingSphereRadius();let a=t[s].length(),c=r.boundingSphereRadius;a+c>n&&(n=a+c)}this.boundingRadius=n}updateAABB(){let e=this.shapes,t=this.shapeOffsets,i=this.shapeOrientations,n=e.length,s=Cu,r=Au,a=this.quaternion,c=this.aabb,l=Su;for(let h=0;h!==n;h++){let f=e[h];a.vmult(t[h],s),s.vadd(this.position,s),a.mult(i[h],r),f.calculateWorldAABB(s,r,l.lowerBound,l.upperBound),h===0?c.copy(l):c.extend(l)}this.aabbNeedsUpdate=!1}updateInertiaWorld(e){let t=this.invInertia;if(!(t.x===t.y&&t.y===t.z&&!e)){let i=_u,n=Eu;i.setRotationFromQuaternion(this.quaternion),i.transpose(n),i.scale(t,i),i.mmult(n,this.invInertiaWorld)}}applyForce(e,t=new M){if(this.type!==ae.DYNAMIC)return;this.sleepState===ae.SLEEPING&&this.wakeUp();let i=Lu;t.cross(e,i),this.force.vadd(e,this.force),this.torque.vadd(i,this.torque)}applyLocalForce(e,t=new M){if(this.type!==ae.DYNAMIC)return;let i=Tu,n=Du;this.vectorToWorldFrame(e,i),this.vectorToWorldFrame(t,n),this.applyForce(i,n)}applyTorque(e){this.type===ae.DYNAMIC&&(this.sleepState===ae.SLEEPING&&this.wakeUp(),this.torque.vadd(e,this.torque))}applyImpulse(e,t=new M){if(this.type!==ae.DYNAMIC)return;this.sleepState===ae.SLEEPING&&this.wakeUp();let i=t,n=Hu;n.copy(e),n.scale(this.invMass,n),this.velocity.vadd(n,this.velocity);let s=Vu;i.cross(e,s),this.invInertiaWorld.vmult(s,s),this.angularVelocity.vadd(s,this.angularVelocity)}applyLocalImpulse(e,t=new M){if(this.type!==ae.DYNAMIC)return;let i=Ru,n=Nu;this.vectorToWorldFrame(e,i),this.vectorToWorldFrame(t,n),this.applyImpulse(i,n)}updateMassProperties(){let e=Fu;this.invMass=this.mass>0?1/this.mass:0;let t=this.inertia,i=this.fixedRotation;this.updateAABB(),e.set((this.aabb.upperBound.x-this.aabb.lowerBound.x)/2,(this.aabb.upperBound.y-this.aabb.lowerBound.y)/2,(this.aabb.upperBound.z-this.aabb.lowerBound.z)/2),Lr.calculateInertia(e,this.mass,t),this.invInertia.set(t.x>0&&!i?1/t.x:0,t.y>0&&!i?1/t.y:0,t.z>0&&!i?1/t.z:0),this.updateInertiaWorld(!0)}getVelocityAtWorldPoint(e,t){let i=new M;return e.vsub(this.position,i),this.angularVelocity.cross(i,t),this.velocity.vadd(t,t),t}integrate(e,t,i){if(this.previousPosition.copy(this.position),this.previousQuaternion.copy(this.quaternion),!(this.type===ae.DYNAMIC||this.type===ae.KINEMATIC)||this.sleepState===ae.SLEEPING)return;let n=this.velocity,s=this.angularVelocity,r=this.position,a=this.force,c=this.torque,l=this.quaternion,h=this.invMass,f=this.invInertiaWorld,u=this.linearFactor,d=h*e;n.x+=a.x*d*u.x,n.y+=a.y*d*u.y,n.z+=a.z*d*u.z;let p=f.elements,v=this.angularFactor,x=c.x*v.x,g=c.y*v.y,m=c.z*v.z;s.x+=e*(p[0]*x+p[1]*g+p[2]*m),s.y+=e*(p[3]*x+p[4]*g+p[5]*m),s.z+=e*(p[6]*x+p[7]*g+p[8]*m),r.x+=n.x*e,r.y+=n.y*e,r.z+=n.z*e,l.integrate(this.angularVelocity,e,this.angularFactor,l),t&&(i?l.normalizeFast():l.normalize()),this.aabbNeedsUpdate=!0,this.updateInertiaWorld()}};ae.idCounter=0;ae.COLLIDE_EVENT_NAME="collide";ae.DYNAMIC=t0.DYNAMIC;ae.STATIC=t0.STATIC;ae.KINEMATIC=t0.KINEMATIC;ae.AWAKE=i0.AWAKE;ae.SLEEPY=i0.SLEEPY;ae.SLEEPING=i0.SLEEPING;ae.wakeupEvent={type:"wakeup"};ae.sleepyEvent={type:"sleepy"};ae.sleepEvent={type:"sleep"};var Cu=new M,Au=new nt,Su=new Zt,_u=new jt,Eu=new jt,Lu=new M,Tu=new M,Du=new M,Hu=new M,Vu=new M,Ru=new M,Nu=new M,Fu=new M,J3=class{constructor(){this.world=void 0,this.useBoundingBoxes=void 0,this.dirty=void 0,this.world=null,this.useBoundingBoxes=!1,this.dirty=!0}collisionPairs(e,t,i){throw new Error("collisionPairs not implemented for this BroadPhase class!")}needBroadphaseCollision(e,t){return!((e.collisionFilterGroup&t.collisionFilterMask)==0||(t.collisionFilterGroup&e.collisionFilterMask)==0||((e.type&ae.STATIC)!=0||e.sleepState===ae.SLEEPING)&&((t.type&ae.STATIC)!=0||t.sleepState===ae.SLEEPING))}intersectionTest(e,t,i,n){this.useBoundingBoxes?this.doBoundingBoxBroadphase(e,t,i,n):this.doBoundingSphereBroadphase(e,t,i,n)}doBoundingSphereBroadphase(e,t,i,n){let s=Bu;t.position.vsub(e.position,s);let r=(e.boundingRadius+t.boundingRadius)**2;s.lengthSquared()<r&&(i.push(e),n.push(t))}doBoundingBoxBroadphase(e,t,i,n){e.aabbNeedsUpdate&&e.updateAABB(),t.aabbNeedsUpdate&&t.updateAABB(),e.aabb.overlaps(t.aabb)&&(i.push(e),n.push(t))}makePairsUnique(e,t){let i=Pu,n=Iu,s=ku,r=e.length;for(let a=0;a!==r;a++)n[a]=e[a],s[a]=t[a];e.length=0,t.length=0;for(let a=0;a!==r;a++){let c=n[a].id,l=s[a].id,h=c<l?c+","+l:l+","+c;i[h]=a,i.keys.push(h)}for(let a=0;a!==i.keys.length;a++){let c=i.keys.pop(),l=i[c];e.push(n[l]),t.push(s[l]),delete i[c]}}setWorld(e){}static boundingSphereCheck(e,t){let i=new M;e.position.vsub(t.position,i);let n=e.shapes[0],s=t.shapes[0];return Math.pow(n.boundingSphereRadius+s.boundingSphereRadius,2)>i.lengthSquared()}aabbQuery(e,t,i){return console.warn(".aabbQuery is not implemented in this Broadphase subclass."),[]}},Bu=new M,Pu={keys:[]},Iu=[],ku=[];var Rb=new M,Tr=class extends J3{constructor(){super()}collisionPairs(e,t,i){let n=e.bodies,s=n.length,r,a;for(let c=0;c!==s;c++)for(let l=0;l!==c;l++)r=n[c],a=n[l],!!this.needBroadphaseCollision(r,a)&&this.intersectionTest(r,a,t,i)}aabbQuery(e,t,i=[]){for(let n=0;n<e.bodies.length;n++){let s=e.bodies[n];s.aabbNeedsUpdate&&s.updateAABB(),s.aabb.overlaps(t)&&i.push(s)}return i}},Dr=class{constructor(){this.rayFromWorld=void 0,this.rayToWorld=void 0,this.hitNormalWorld=void 0,this.hitPointWorld=void 0,this.hasHit=void 0,this.shape=void 0,this.body=void 0,this.hitFaceIndex=void 0,this.distance=void 0,this.shouldStop=void 0,this.rayFromWorld=new M,this.rayToWorld=new M,this.hitNormalWorld=new M,this.hitPointWorld=new M,this.hasHit=!1,this.shape=null,this.body=null,this.hitFaceIndex=-1,this.distance=-1,this.shouldStop=!1}reset(){this.rayFromWorld.setZero(),this.rayToWorld.setZero(),this.hitNormalWorld.setZero(),this.hitPointWorld.setZero(),this.hasHit=!1,this.shape=null,this.body=null,this.hitFaceIndex=-1,this.distance=-1,this.shouldStop=!1}abort(){this.shouldStop=!0}set(e,t,i,n,s,r,a){this.rayFromWorld.copy(e),this.rayToWorld.copy(t),this.hitNormalWorld.copy(i),this.hitPointWorld.copy(n),this.shape=s,this.body=r,this.distance=a}},Q3,K3,ec,tc,ic,nc,sc,n0={CLOSEST:1,ANY:2,ALL:4};Q3=me.types.SPHERE;K3=me.types.PLANE;ec=me.types.BOX;tc=me.types.CYLINDER;ic=me.types.CONVEXPOLYHEDRON;nc=me.types.HEIGHTFIELD;sc=me.types.TRIMESH;var mt=class{get[Q3](){return this._intersectSphere}get[K3](){return this._intersectPlane}get[ec](){return this._intersectBox}get[tc](){return this._intersectConvex}get[ic](){return this._intersectConvex}get[nc](){return this._intersectHeightfield}get[sc](){return this._intersectTrimesh}constructor(e=new M,t=new M){this.from=void 0,this.to=void 0,this.direction=void 0,this.precision=void 0,this.checkCollisionResponse=void 0,this.skipBackfaces=void 0,this.collisionFilterMask=void 0,this.collisionFilterGroup=void 0,this.mode=void 0,this.result=void 0,this.hasHit=void 0,this.callback=void 0,this.from=e.clone(),this.to=t.clone(),this.direction=new M,this.precision=1e-4,this.checkCollisionResponse=!0,this.skipBackfaces=!1,this.collisionFilterMask=-1,this.collisionFilterGroup=-1,this.mode=mt.ANY,this.result=new Dr,this.hasHit=!1,this.callback=i=>{}}intersectWorld(e,t){return this.mode=t.mode||mt.ANY,this.result=t.result||new Dr,this.skipBackfaces=!!t.skipBackfaces,this.collisionFilterMask=typeof t.collisionFilterMask!="undefined"?t.collisionFilterMask:-1,this.collisionFilterGroup=typeof t.collisionFilterGroup!="undefined"?t.collisionFilterGroup:-1,this.checkCollisionResponse=typeof t.checkCollisionResponse!="undefined"?t.checkCollisionResponse:!0,t.from&&this.from.copy(t.from),t.to&&this.to.copy(t.to),this.callback=t.callback||(()=>{}),this.hasHit=!1,this.result.reset(),this.updateDirection(),this.getAABB(rc),s0.length=0,e.broadphase.aabbQuery(e,rc,s0),this.intersectBodies(s0),this.hasHit}intersectBody(e,t){t&&(this.result=t,this.updateDirection());let i=this.checkCollisionResponse;if(i&&!e.collisionResponse||(this.collisionFilterGroup&e.collisionFilterMask)==0||(e.collisionFilterGroup&this.collisionFilterMask)==0)return;let n=Ou,s=Uu;for(let r=0,a=e.shapes.length;r<a;r++){let c=e.shapes[r];if(!(i&&!c.collisionResponse)&&(e.quaternion.mult(e.shapeOrientations[r],s),e.quaternion.vmult(e.shapeOffsets[r],n),n.vadd(e.position,n),this.intersectShape(c,s,n,e),this.result.shouldStop))break}}intersectBodies(e,t){t&&(this.result=t,this.updateDirection());for(let i=0,n=e.length;!this.result.shouldStop&&i<n;i++)this.intersectBody(e[i])}updateDirection(){this.to.vsub(this.from,this.direction),this.direction.normalize()}intersectShape(e,t,i,n){let s=this.from;if(i9(s,this.direction,i)>e.boundingSphereRadius)return;let a=this[e.type];a&&a.call(this,e,t,i,n,e)}_intersectBox(e,t,i,n,s){return this._intersectConvex(e.convexPolyhedronRepresentation,t,i,n,s)}_intersectPlane(e,t,i,n,s){let r=this.from,a=this.to,c=this.direction,l=new M(0,0,1);t.vmult(l,l);let h=new M;r.vsub(i,h);let f=h.dot(l);a.vsub(i,h);let u=h.dot(l);if(f*u>0||r.distanceTo(a)<f)return;let d=l.dot(c);if(Math.abs(d)<this.precision)return;let p=new M,v=new M,x=new M;r.vsub(i,p);let g=-l.dot(p)/d;c.scale(g,v),r.vadd(v,x),this.reportIntersection(l,x,s,n,-1)}getAABB(e){let{lowerBound:t,upperBound:i}=e,n=this.to,s=this.from;t.x=Math.min(n.x,s.x),t.y=Math.min(n.y,s.y),t.z=Math.min(n.z,s.z),i.x=Math.max(n.x,s.x),i.y=Math.max(n.y,s.y),i.z=Math.max(n.z,s.z)}_intersectHeightfield(e,t,i,n,s){e.data,e.elementSize;let r=Gu;r.from.copy(this.from),r.to.copy(this.to),qe.pointToLocalFrame(i,t,r.from,r.from),qe.pointToLocalFrame(i,t,r.to,r.to),r.updateDirection();let a=qu,c,l,h,f;c=l=0,h=f=e.data.length-1;let u=new Zt;r.getAABB(u),e.getIndexOfPosition(u.lowerBound.x,u.lowerBound.y,a,!0),c=Math.max(c,a[0]),l=Math.max(l,a[1]),e.getIndexOfPosition(u.upperBound.x,u.upperBound.y,a,!0),h=Math.min(h,a[0]+1),f=Math.min(f,a[1]+1);for(let d=c;d<h;d++)for(let p=l;p<f;p++){if(this.result.shouldStop)return;if(e.getAabbAtIndex(d,p,u),!!u.overlapsRay(r)){if(e.getConvexTrianglePillar(d,p,!1),qe.pointToWorldFrame(i,t,e.pillarOffset,Hr),this._intersectConvex(e.pillarConvex,t,Hr,n,s,ac),this.result.shouldStop)return;e.getConvexTrianglePillar(d,p,!0),qe.pointToWorldFrame(i,t,e.pillarOffset,Hr),this._intersectConvex(e.pillarConvex,t,Hr,n,s,ac)}}}_intersectSphere(e,t,i,n,s){let r=this.from,a=this.to,c=e.radius,l=(a.x-r.x)**2+(a.y-r.y)**2+(a.z-r.z)**2,h=2*((a.x-r.x)*(r.x-i.x)+(a.y-r.y)*(r.y-i.y)+(a.z-r.z)*(r.z-i.z)),f=(r.x-i.x)**2+(r.y-i.y)**2+(r.z-i.z)**2-c**2,u=h**2-4*l*f,d=Wu,p=ju;if(!(u<0))if(u===0)r.lerp(a,u,d),d.vsub(i,p),p.normalize(),this.reportIntersection(p,d,s,n,-1);else{let v=(-h-Math.sqrt(u))/(2*l),x=(-h+Math.sqrt(u))/(2*l);if(v>=0&&v<=1&&(r.lerp(a,v,d),d.vsub(i,p),p.normalize(),this.reportIntersection(p,d,s,n,-1)),this.result.shouldStop)return;x>=0&&x<=1&&(r.lerp(a,x,d),d.vsub(i,p),p.normalize(),this.reportIntersection(p,d,s,n,-1))}}_intersectConvex(e,t,i,n,s,r){let a=Zu,c=oc,l=r&&r.faceList||null,h=e.faces,f=e.vertices,u=e.faceNormals,d=this.direction,p=this.from,v=this.to,x=p.distanceTo(v),g=l?l.length:h.length,m=this.result;for(let z=0;!m.shouldStop&&z<g;z++){let y=l?l[z]:z,b=h[y],S=u[y],_=t,A=i;c.copy(f[b[0]]),_.vmult(c,c),c.vadd(A,c),c.vsub(p,c),_.vmult(S,a);let P=d.dot(a);if(Math.abs(P)<this.precision)continue;let R=a.dot(c)/P;if(!(R<0)){d.scale(R,Xt),Xt.vadd(p,Xt),v1.copy(f[b[0]]),_.vmult(v1,v1),A.vadd(v1,v1);for(let w=1;!m.shouldStop&&w<b.length-1;w++){I1.copy(f[b[w]]),k1.copy(f[b[w+1]]),_.vmult(I1,I1),_.vmult(k1,k1),A.vadd(I1,I1),A.vadd(k1,k1);let D=Xt.distanceTo(p);!(mt.pointInTriangle(Xt,v1,I1,k1)||mt.pointInTriangle(Xt,I1,v1,k1))||D>x||this.reportIntersection(a,Xt,s,n,y)}}}}_intersectTrimesh(e,t,i,n,s,r){let a=Xu,c=e9,l=t9,h=oc,f=Yu,u=$u,d=Ju,p=Ku,v=Qu,x=e.indices;e.vertices;let g=this.from,m=this.to,z=this.direction;l.position.copy(i),l.quaternion.copy(t),qe.vectorToLocalFrame(i,t,z,f),qe.pointToLocalFrame(i,t,g,u),qe.pointToLocalFrame(i,t,m,d),d.x*=e.scale.x,d.y*=e.scale.y,d.z*=e.scale.z,u.x*=e.scale.x,u.y*=e.scale.y,u.z*=e.scale.z,d.vsub(u,f),f.normalize();let y=u.distanceSquared(d);e.tree.rayQuery(this,l,c);for(let b=0,S=c.length;!this.result.shouldStop&&b!==S;b++){let _=c[b];e.getNormal(_,a),e.getVertex(x[_*3],v1),v1.vsub(u,h);let A=f.dot(a),P=a.dot(h)/A;if(P<0)continue;f.scale(P,Xt),Xt.vadd(u,Xt),e.getVertex(x[_*3+1],I1),e.getVertex(x[_*3+2],k1);let R=Xt.distanceSquared(u);!(mt.pointInTriangle(Xt,I1,v1,k1)||mt.pointInTriangle(Xt,v1,I1,k1))||R>y||(qe.vectorToWorldFrame(t,a,v),qe.pointToWorldFrame(i,t,Xt,p),this.reportIntersection(v,p,s,n,_))}c.length=0}reportIntersection(e,t,i,n,s){let r=this.from,a=this.to,c=r.distanceTo(t),l=this.result;if(!(this.skipBackfaces&&e.dot(this.direction)>0))switch(l.hitFaceIndex=typeof s!="undefined"?s:-1,this.mode){case mt.ALL:this.hasHit=!0,l.set(r,a,e,t,i,n,c),l.hasHit=!0,this.callback(l);break;case mt.CLOSEST:(c<l.distance||!l.hasHit)&&(this.hasHit=!0,l.hasHit=!0,l.set(r,a,e,t,i,n,c));break;case mt.ANY:this.hasHit=!0,l.hasHit=!0,l.set(r,a,e,t,i,n,c),l.shouldStop=!0;break}}static pointInTriangle(e,t,i,n){n.vsub(t,wi),i.vsub(t,ps),e.vsub(t,r0);let s=wi.dot(wi),r=wi.dot(ps),a=wi.dot(r0),c=ps.dot(ps),l=ps.dot(r0),h,f;return(h=c*a-r*l)>=0&&(f=s*l-r*a)>=0&&h+f<s*c-r*r}};mt.CLOSEST=n0.CLOSEST;mt.ANY=n0.ANY;mt.ALL=n0.ALL;var rc=new Zt,s0=[],ps=new M,r0=new M,Ou=new M,Uu=new nt,Xt=new M,v1=new M,I1=new M,k1=new M,ac={faceList:[0]},Hr=new M,Gu=new mt,qu=[],Wu=new M,ju=new M,Zu=new M,oc=new M,Xu=new M,Yu=new M,$u=new M,Ju=new M,Qu=new M,Ku=new M;new Zt;var e9=[],t9=new qe,wi=new M,Vr=new M;function i9(o,e,t){t.vsub(o,wi);let i=wi.dot(e);return e.scale(i,Vr),Vr.vadd(o,Vr),t.distanceTo(Vr)}var a0=class{static defaults(e={},t){for(let i in t)i in e||(e[i]=t[i]);return e}},Rr=class{constructor(e,t,i={}){this.equations=void 0,this.bodyA=void 0,this.bodyB=void 0,this.id=void 0,this.collideConnected=void 0,i=a0.defaults(i,{collideConnected:!0,wakeUpBodies:!0}),this.equations=[],this.bodyA=e,this.bodyB=t,this.id=Rr.idCounter++,this.collideConnected=i.collideConnected,i.wakeUpBodies&&(e&&e.wakeUp(),t&&t.wakeUp())}update(){throw new Error("method update() not implmemented in this Constraint subclass!")}enable(){let e=this.equations;for(let t=0;t<e.length;t++)e[t].enabled=!0}disable(){let e=this.equations;for(let t=0;t<e.length;t++)e[t].enabled=!1}};Rr.idCounter=0;var o0=class{constructor(){this.spatial=void 0,this.rotational=void 0,this.spatial=new M,this.rotational=new M}multiplyElement(e){return e.spatial.dot(this.spatial)+e.rotational.dot(this.rotational)}multiplyVectors(e,t){return e.dot(this.spatial)+t.dot(this.rotational)}},Ji=class{constructor(e,t,i=-1e6,n=1e6){this.id=void 0,this.minForce=void 0,this.maxForce=void 0,this.bi=void 0,this.bj=void 0,this.si=void 0,this.sj=void 0,this.a=void 0,this.b=void 0,this.eps=void 0,this.jacobianElementA=void 0,this.jacobianElementB=void 0,this.enabled=void 0,this.multiplier=void 0,this.id=Ji.idCounter++,this.minForce=i,this.maxForce=n,this.bi=e,this.bj=t,this.a=0,this.b=0,this.eps=0,this.jacobianElementA=new o0,this.jacobianElementB=new o0,this.enabled=!0,this.multiplier=0,this.setSpookParams(1e7,4,1/60)}setSpookParams(e,t,i){let n=t,s=e,r=i;this.a=4/(r*(1+4*n)),this.b=4*n/(1+4*n),this.eps=4/(r*r*s*(1+4*n))}computeB(e,t,i){let n=this.computeGW(),s=this.computeGq(),r=this.computeGiMf();return-s*e-n*t-r*i}computeGq(){let e=this.jacobianElementA,t=this.jacobianElementB,i=this.bi,n=this.bj,s=i.position,r=n.position;return e.spatial.dot(s)+t.spatial.dot(r)}computeGW(){let e=this.jacobianElementA,t=this.jacobianElementB,i=this.bi,n=this.bj,s=i.velocity,r=n.velocity,a=i.angularVelocity,c=n.angularVelocity;return e.multiplyVectors(s,a)+t.multiplyVectors(r,c)}computeGWlambda(){let e=this.jacobianElementA,t=this.jacobianElementB,i=this.bi,n=this.bj,s=i.vlambda,r=n.vlambda,a=i.wlambda,c=n.wlambda;return e.multiplyVectors(s,a)+t.multiplyVectors(r,c)}computeGiMf(){let e=this.jacobianElementA,t=this.jacobianElementB,i=this.bi,n=this.bj,s=i.force,r=i.torque,a=n.force,c=n.torque,l=i.invMassSolve,h=n.invMassSolve;return s.scale(l,cc),a.scale(h,lc),i.invInertiaWorldSolve.vmult(r,hc),n.invInertiaWorldSolve.vmult(c,uc),e.multiplyVectors(cc,hc)+t.multiplyVectors(lc,uc)}computeGiMGt(){let e=this.jacobianElementA,t=this.jacobianElementB,i=this.bi,n=this.bj,s=i.invMassSolve,r=n.invMassSolve,a=i.invInertiaWorldSolve,c=n.invInertiaWorldSolve,l=s+r;return a.vmult(e.rotational,Nr),l+=Nr.dot(e.rotational),c.vmult(t.rotational,Nr),l+=Nr.dot(t.rotational),l}addToWlambda(e){let t=this.jacobianElementA,i=this.jacobianElementB,n=this.bi,s=this.bj,r=n9;n.vlambda.addScaledVector(n.invMassSolve*e,t.spatial,n.vlambda),s.vlambda.addScaledVector(s.invMassSolve*e,i.spatial,s.vlambda),n.invInertiaWorldSolve.vmult(t.rotational,r),n.wlambda.addScaledVector(e,r,n.wlambda),s.invInertiaWorldSolve.vmult(i.rotational,r),s.wlambda.addScaledVector(e,r,s.wlambda)}computeC(){return this.computeGiMGt()+this.eps}};Ji.idCounter=0;var cc=new M,lc=new M,hc=new M,uc=new M,Nr=new M,n9=new M,fc=class extends Ji{constructor(e,t,i=1e6){super(e,t,0,i);this.restitution=void 0,this.ri=void 0,this.rj=void 0,this.ni=void 0,this.restitution=0,this.ri=new M,this.rj=new M,this.ni=new M}computeB(e){let t=this.a,i=this.b,n=this.bi,s=this.bj,r=this.ri,a=this.rj,c=s9,l=r9,h=n.velocity,f=n.angularVelocity;n.force,n.torque;let u=s.velocity,d=s.angularVelocity;s.force,s.torque;let p=a9,v=this.jacobianElementA,x=this.jacobianElementB,g=this.ni;r.cross(g,c),a.cross(g,l),g.negate(v.spatial),c.negate(v.rotational),x.spatial.copy(g),x.rotational.copy(l),p.copy(s.position),p.vadd(a,p),p.vsub(n.position,p),p.vsub(r,p);let m=g.dot(p),z=this.restitution+1,y=z*u.dot(g)-z*h.dot(g)+d.dot(l)-f.dot(c),b=this.computeGiMf();return-m*t-y*i-e*b}getImpactVelocityAlongNormal(){let e=o9,t=c9,i=l9,n=h9,s=u9;return this.bi.position.vadd(this.ri,i),this.bj.position.vadd(this.rj,n),this.bi.getVelocityAtWorldPoint(i,e),this.bj.getVelocityAtWorldPoint(n,t),e.vsub(t,s),this.ni.dot(s)}},s9=new M,r9=new M,a9=new M,o9=new M,c9=new M,l9=new M,h9=new M,u9=new M;var Nb=new M,Fb=new M;var Bb=new M,Pb=new M;var Ib=new M,kb=new M,c0=class extends Ji{constructor(e,t,i){super(e,t,-i,i);this.ri=void 0,this.rj=void 0,this.t=void 0,this.ri=new M,this.rj=new M,this.t=new M}computeB(e){this.a;let t=this.b;this.bi,this.bj;let i=this.ri,n=this.rj,s=f9,r=d9,a=this.t;i.cross(a,s),n.cross(a,r);let c=this.jacobianElementA,l=this.jacobianElementB;a.negate(c.spatial),s.negate(c.rotational),l.spatial.copy(a),l.rotational.copy(r);let h=this.computeGW(),f=this.computeGiMf();return-h*t-e*f}},f9=new M,d9=new M,s2=class{constructor(e,t,i){this.id=void 0,this.materials=void 0,this.friction=void 0,this.restitution=void 0,this.contactEquationStiffness=void 0,this.contactEquationRelaxation=void 0,this.frictionEquationStiffness=void 0,this.frictionEquationRelaxation=void 0,i=a0.defaults(i,{friction:.3,restitution:.3,contactEquationStiffness:1e7,contactEquationRelaxation:3,frictionEquationStiffness:1e7,frictionEquationRelaxation:3}),this.id=s2.idCounter++,this.materials=[e,t],this.friction=i.friction,this.restitution=i.restitution,this.contactEquationStiffness=i.contactEquationStiffness,this.contactEquationRelaxation=i.contactEquationRelaxation,this.frictionEquationStiffness=i.frictionEquationStiffness,this.frictionEquationRelaxation=i.frictionEquationRelaxation}};s2.idCounter=0;var r2=class{constructor(e={}){this.name=void 0,this.id=void 0,this.friction=void 0,this.restitution=void 0;let t="";typeof e=="string"&&(t=e,e={}),this.name=t,this.id=r2.idCounter++,this.friction=typeof e.friction!="undefined"?e.friction:-1,this.restitution=typeof e.restitution!="undefined"?e.restitution:-1}};r2.idCounter=0;var Ob=new M,Ub=new M,Gb=new M,qb=new M,Wb=new M,jb=new M,Zb=new M,Xb=new M,Yb=new M,$b=new M,Jb=new M;var Qb=new M,Kb=new M;var eM=new M,tM=new M,iM=new M;new mt;var nM=new M,sM=new M,rM=[new M(1,0,0),new M(0,1,0),new M(0,0,1)],aM=new M;var oM=new M,cM=new M,lM=new M;var hM=new M,uM=new M,fM=new M,dM=new M;var pM=new M,mM=new M,gM=new M;var vM=new M,xM=new M;var yM=new M,wM=new M,bM=new M,MM=new M,zM=new M,CM=new M,AM=new M;var P2=class extends me{constructor(){super({type:me.types.PLANE});this.worldNormal=void 0,this.worldNormalNeedsUpdate=void 0,this.boundingSphereRadius=void 0,this.worldNormal=new M,this.worldNormalNeedsUpdate=!0,this.boundingSphereRadius=Number.MAX_VALUE}computeWorldNormal(e){let t=this.worldNormal;t.set(0,0,1),e.vmult(t,t),this.worldNormalNeedsUpdate=!1}calculateLocalInertia(e,t=new M){return t}volume(){return Number.MAX_VALUE}calculateWorldAABB(e,t,i,n){a2.set(0,0,1),t.vmult(a2,a2);let s=Number.MAX_VALUE;i.set(-s,-s,-s),n.set(s,s,s),a2.x===1?n.x=e.x:a2.x===-1&&(i.x=e.x),a2.y===1?n.y=e.y:a2.y===-1&&(i.y=e.y),a2.z===1?n.z=e.z:a2.z===-1&&(i.z=e.z)}updateBoundingSphereRadius(){this.boundingSphereRadius=Number.MAX_VALUE}},a2=new M;var SM=new M,_M=new M,EM=new M,LM=new M,TM=new M,DM=new M,HM=new M,VM=new M,RM=new M;var NM=new M,FM=new Zt;var BM=new M,PM=new Zt,IM=new M,kM=new M,OM=new M,UM=new M,GM=new M,qM=new M,WM=new M,jM=new Zt,ZM=new M,XM=new qe,YM=new Zt,dc=class{constructor(){this.equations=void 0,this.equations=[]}solve(e,t){return 0}addEquation(e){e.enabled&&!e.bi.isTrigger&&!e.bj.isTrigger&&this.equations.push(e)}removeEquation(e){let t=this.equations,i=t.indexOf(e);i!==-1&&t.splice(i,1)}removeAllEquations(){this.equations.length=0}},pc=class extends dc{constructor(){super();this.iterations=void 0,this.tolerance=void 0,this.iterations=10,this.tolerance=1e-7}solve(e,t){let i=0,n=this.iterations,s=this.tolerance*this.tolerance,r=this.equations,a=r.length,c=t.bodies,l=c.length,h=e,f,u,d,p,v,x;if(a!==0)for(let y=0;y!==l;y++)c[y].updateSolveMassProperties();let g=m9,m=g9,z=p9;g.length=a,m.length=a,z.length=a;for(let y=0;y!==a;y++){let b=r[y];z[y]=0,m[y]=b.computeB(h),g[y]=1/b.computeC()}if(a!==0){for(let S=0;S!==l;S++){let _=c[S],A=_.vlambda,P=_.wlambda;A.set(0,0,0),P.set(0,0,0)}for(i=0;i!==n;i++){p=0;for(let S=0;S!==a;S++){let _=r[S];f=m[S],u=g[S],x=z[S],v=_.computeGWlambda(),d=u*(f-v-_.eps*x),x+d<_.minForce?d=_.minForce-x:x+d>_.maxForce&&(d=_.maxForce-x),z[S]+=d,p+=d>0?d:-d,_.addToWlambda(d)}if(p*p<s)break}for(let S=0;S!==l;S++){let _=c[S],A=_.velocity,P=_.angularVelocity;_.vlambda.vmul(_.linearFactor,_.vlambda),A.vadd(_.vlambda,A),_.wlambda.vmul(_.angularFactor,_.wlambda),P.vadd(_.wlambda,P)}let y=r.length,b=1/h;for(;y--;)r[y].multiplier=z[y]*b}return i}},p9=[],m9=[],g9=[];var $M=ae.STATIC;var mc=class{constructor(){this.objects=[],this.type=Object}release(...e){let t=e.length;for(let i=0;i!==t;i++)this.objects.push(e[i]);return this}get(){return this.objects.length===0?this.constructObject():this.objects.pop()}constructObject(){throw new Error("constructObject() not implemented in this Pool subclass yet!")}resize(e){let t=this.objects;for(;t.length>e;)t.pop();for(;t.length<e;)t.push(this.constructObject());return this}},gc=class extends mc{constructor(...e){super(...e);this.type=M}constructObject(){return new M}},vc,xc,yc,wc,bc,Mc,zc,Cc,Ac,Sc,_c,Ec,Lc,Tc,Dc,Hc,Vc,Rc,Nc,Fc,Bc,Pc,Ic,kc,Oc,st={sphereSphere:me.types.SPHERE,spherePlane:me.types.SPHERE|me.types.PLANE,boxBox:me.types.BOX|me.types.BOX,sphereBox:me.types.SPHERE|me.types.BOX,planeBox:me.types.PLANE|me.types.BOX,convexConvex:me.types.CONVEXPOLYHEDRON,sphereConvex:me.types.SPHERE|me.types.CONVEXPOLYHEDRON,planeConvex:me.types.PLANE|me.types.CONVEXPOLYHEDRON,boxConvex:me.types.BOX|me.types.CONVEXPOLYHEDRON,sphereHeightfield:me.types.SPHERE|me.types.HEIGHTFIELD,boxHeightfield:me.types.BOX|me.types.HEIGHTFIELD,convexHeightfield:me.types.CONVEXPOLYHEDRON|me.types.HEIGHTFIELD,sphereParticle:me.types.PARTICLE|me.types.SPHERE,planeParticle:me.types.PLANE|me.types.PARTICLE,boxParticle:me.types.BOX|me.types.PARTICLE,convexParticle:me.types.PARTICLE|me.types.CONVEXPOLYHEDRON,cylinderCylinder:me.types.CYLINDER,sphereCylinder:me.types.SPHERE|me.types.CYLINDER,planeCylinder:me.types.PLANE|me.types.CYLINDER,boxCylinder:me.types.BOX|me.types.CYLINDER,convexCylinder:me.types.CONVEXPOLYHEDRON|me.types.CYLINDER,heightfieldCylinder:me.types.HEIGHTFIELD|me.types.CYLINDER,particleCylinder:me.types.PARTICLE|me.types.CYLINDER,sphereTrimesh:me.types.SPHERE|me.types.TRIMESH,planeTrimesh:me.types.PLANE|me.types.TRIMESH};vc=st.sphereSphere;xc=st.spherePlane;yc=st.boxBox;wc=st.sphereBox;bc=st.planeBox;Mc=st.convexConvex;zc=st.sphereConvex;Cc=st.planeConvex;Ac=st.boxConvex;Sc=st.sphereHeightfield;_c=st.boxHeightfield;Ec=st.convexHeightfield;Lc=st.sphereParticle;Tc=st.planeParticle;Dc=st.boxParticle;Hc=st.convexParticle;Vc=st.cylinderCylinder;Rc=st.sphereCylinder;Nc=st.planeCylinder;Fc=st.boxCylinder;Bc=st.convexCylinder;Pc=st.heightfieldCylinder;Ic=st.particleCylinder;kc=st.sphereTrimesh;Oc=st.planeTrimesh;var Uc=class{get[vc](){return this.sphereSphere}get[xc](){return this.spherePlane}get[yc](){return this.boxBox}get[wc](){return this.sphereBox}get[bc](){return this.planeBox}get[Mc](){return this.convexConvex}get[zc](){return this.sphereConvex}get[Cc](){return this.planeConvex}get[Ac](){return this.boxConvex}get[Sc](){return this.sphereHeightfield}get[_c](){return this.boxHeightfield}get[Ec](){return this.convexHeightfield}get[Lc](){return this.sphereParticle}get[Tc](){return this.planeParticle}get[Dc](){return this.boxParticle}get[Hc](){return this.convexParticle}get[Vc](){return this.convexConvex}get[Rc](){return this.sphereConvex}get[Nc](){return this.planeConvex}get[Fc](){return this.boxConvex}get[Bc](){return this.convexConvex}get[Pc](){return this.heightfieldCylinder}get[Ic](){return this.particleCylinder}get[kc](){return this.sphereTrimesh}get[Oc](){return this.planeTrimesh}constructor(e){this.contactPointPool=void 0,this.frictionEquationPool=void 0,this.result=void 0,this.frictionResult=void 0,this.v3pool=void 0,this.world=void 0,this.currentContactMaterial=void 0,this.enableFrictionReduction=void 0,this.contactPointPool=[],this.frictionEquationPool=[],this.result=[],this.frictionResult=[],this.v3pool=new gc,this.world=e,this.currentContactMaterial=e.defaultContactMaterial,this.enableFrictionReduction=!1}createContactEquation(e,t,i,n,s,r){let a;this.contactPointPool.length?(a=this.contactPointPool.pop(),a.bi=e,a.bj=t):a=new fc(e,t),a.enabled=e.collisionResponse&&t.collisionResponse&&i.collisionResponse&&n.collisionResponse;let c=this.currentContactMaterial;a.restitution=c.restitution,a.setSpookParams(c.contactEquationStiffness,c.contactEquationRelaxation,this.world.dt);let l=i.material||e.material,h=n.material||t.material;return l&&h&&l.restitution>=0&&h.restitution>=0&&(a.restitution=l.restitution*h.restitution),a.si=s||i,a.sj=r||n,a}createFrictionEquationsFromContact(e,t){let i=e.bi,n=e.bj,s=e.si,r=e.sj,a=this.world,c=this.currentContactMaterial,l=c.friction,h=s.material||i.material,f=r.material||n.material;if(h&&f&&h.friction>=0&&f.friction>=0&&(l=h.friction*f.friction),l>0){let u=l*a.gravity.length(),d=i.invMass+n.invMass;d>0&&(d=1/d);let p=this.frictionEquationPool,v=p.length?p.pop():new c0(i,n,u*d),x=p.length?p.pop():new c0(i,n,u*d);return v.bi=x.bi=i,v.bj=x.bj=n,v.minForce=x.minForce=-u*d,v.maxForce=x.maxForce=u*d,v.ri.copy(e.ri),v.rj.copy(e.rj),x.ri.copy(e.ri),x.rj.copy(e.rj),e.ni.tangents(v.t,x.t),v.setSpookParams(c.frictionEquationStiffness,c.frictionEquationRelaxation,a.dt),x.setSpookParams(c.frictionEquationStiffness,c.frictionEquationRelaxation,a.dt),v.enabled=x.enabled=e.enabled,t.push(v,x),!0}return!1}createFrictionFromAverage(e){let t=this.result[this.result.length-1];if(!this.createFrictionEquationsFromContact(t,this.frictionResult)||e===1)return;let i=this.frictionResult[this.frictionResult.length-2],n=this.frictionResult[this.frictionResult.length-1];bi.setZero(),Qi.setZero(),Ki.setZero();let s=t.bi;t.bj;for(let a=0;a!==e;a++)t=this.result[this.result.length-1-a],t.bi!==s?(bi.vadd(t.ni,bi),Qi.vadd(t.ri,Qi),Ki.vadd(t.rj,Ki)):(bi.vsub(t.ni,bi),Qi.vadd(t.rj,Qi),Ki.vadd(t.ri,Ki));let r=1/e;Qi.scale(r,i.ri),Ki.scale(r,i.rj),n.ri.copy(i.ri),n.rj.copy(i.rj),bi.normalize(),bi.tangents(i.t,n.t)}getContacts(e,t,i,n,s,r,a){this.contactPointPool=s,this.frictionEquationPool=a,this.result=n,this.frictionResult=r;let c=y9,l=w9,h=v9,f=x9;for(let u=0,d=e.length;u!==d;u++){let p=e[u],v=t[u],x=null;p.material&&v.material&&(x=i.getContactMaterial(p.material,v.material)||null);let g=p.type&ae.KINEMATIC&&v.type&ae.STATIC||p.type&ae.STATIC&&v.type&ae.KINEMATIC||p.type&ae.KINEMATIC&&v.type&ae.KINEMATIC;for(let m=0;m<p.shapes.length;m++){p.quaternion.mult(p.shapeOrientations[m],c),p.quaternion.vmult(p.shapeOffsets[m],h),h.vadd(p.position,h);let z=p.shapes[m];for(let y=0;y<v.shapes.length;y++){v.quaternion.mult(v.shapeOrientations[y],l),v.quaternion.vmult(v.shapeOffsets[y],f),f.vadd(v.position,f);let b=v.shapes[y];if(!(z.collisionFilterMask&b.collisionFilterGroup&&b.collisionFilterMask&z.collisionFilterGroup)||h.distanceTo(f)>z.boundingSphereRadius+b.boundingSphereRadius)continue;let S=null;z.material&&b.material&&(S=i.getContactMaterial(z.material,b.material)||null),this.currentContactMaterial=S||x||i.defaultContactMaterial;let _=z.type|b.type,A=this[_];if(A){let P=!1;z.type<b.type?P=A.call(this,z,b,h,f,c,l,p,v,z,b,g):P=A.call(this,b,z,f,h,l,c,v,p,z,b,g),P&&g&&(i.shapeOverlapKeeper.set(z.id,b.id),i.bodyOverlapKeeper.set(p.id,v.id))}}}}}sphereSphere(e,t,i,n,s,r,a,c,l,h,f){if(f)return i.distanceSquared(n)<(e.radius+t.radius)**2;let u=this.createContactEquation(a,c,e,t,l,h);n.vsub(i,u.ni),u.ni.normalize(),u.ri.copy(u.ni),u.rj.copy(u.ni),u.ri.scale(e.radius,u.ri),u.rj.scale(-t.radius,u.rj),u.ri.vadd(i,u.ri),u.ri.vsub(a.position,u.ri),u.rj.vadd(n,u.rj),u.rj.vsub(c.position,u.rj),this.result.push(u),this.createFrictionEquationsFromContact(u,this.frictionResult)}spherePlane(e,t,i,n,s,r,a,c,l,h,f){let u=this.createContactEquation(a,c,e,t,l,h);if(u.ni.set(0,0,1),r.vmult(u.ni,u.ni),u.ni.negate(u.ni),u.ni.normalize(),u.ni.scale(e.radius,u.ri),i.vsub(n,Fr),u.ni.scale(u.ni.dot(Fr),Gc),Fr.vsub(Gc,u.rj),-Fr.dot(u.ni)<=e.radius){if(f)return!0;let d=u.ri,p=u.rj;d.vadd(i,d),d.vsub(a.position,d),p.vadd(n,p),p.vsub(c.position,p),this.result.push(u),this.createFrictionEquationsFromContact(u,this.frictionResult)}}boxBox(e,t,i,n,s,r,a,c,l,h,f){return e.convexPolyhedronRepresentation.material=e.material,t.convexPolyhedronRepresentation.material=t.material,e.convexPolyhedronRepresentation.collisionResponse=e.collisionResponse,t.convexPolyhedronRepresentation.collisionResponse=t.collisionResponse,this.convexConvex(e.convexPolyhedronRepresentation,t.convexPolyhedronRepresentation,i,n,s,r,a,c,e,t,f)}sphereBox(e,t,i,n,s,r,a,c,l,h,f){let u=this.v3pool,d=j9;i.vsub(n,Br),t.getSideNormals(d,r);let p=e.radius,v=!1,x=X9,g=Y9,m=$9,z=null,y=0,b=0,S=0,_=null;for(let T=0,N=d.length;T!==N&&v===!1;T++){let I=G9;I.copy(d[T]);let j=I.length();I.normalize();let O=Br.dot(I);if(O<j+p&&O>0){let q=q9,Z=W9;q.copy(d[(T+1)%3]),Z.copy(d[(T+2)%3]);let ne=q.length(),ce=Z.length();q.normalize(),Z.normalize();let U=Br.dot(q),Le=Br.dot(Z);if(U<ne&&U>-ne&&Le<ce&&Le>-ce){let de=Math.abs(O-j-p);if((_===null||de<_)&&(_=de,b=U,S=Le,z=j,x.copy(I),g.copy(q),m.copy(Z),y++,f))return!0}}}if(y){v=!0;let T=this.createContactEquation(a,c,e,t,l,h);x.scale(-p,T.ri),T.ni.copy(x),T.ni.negate(T.ni),x.scale(z,x),g.scale(b,g),x.vadd(g,x),m.scale(S,m),x.vadd(m,T.rj),T.ri.vadd(i,T.ri),T.ri.vsub(a.position,T.ri),T.rj.vadd(n,T.rj),T.rj.vsub(c.position,T.rj),this.result.push(T),this.createFrictionEquationsFromContact(T,this.frictionResult)}let A=u.get(),P=Z9;for(let T=0;T!==2&&!v;T++)for(let N=0;N!==2&&!v;N++)for(let I=0;I!==2&&!v;I++)if(A.set(0,0,0),T?A.vadd(d[0],A):A.vsub(d[0],A),N?A.vadd(d[1],A):A.vsub(d[1],A),I?A.vadd(d[2],A):A.vsub(d[2],A),n.vadd(A,P),P.vsub(i,P),P.lengthSquared()<p*p){if(f)return!0;v=!0;let j=this.createContactEquation(a,c,e,t,l,h);j.ri.copy(P),j.ri.normalize(),j.ni.copy(j.ri),j.ri.scale(p,j.ri),j.rj.copy(A),j.ri.vadd(i,j.ri),j.ri.vsub(a.position,j.ri),j.rj.vadd(n,j.rj),j.rj.vsub(c.position,j.rj),this.result.push(j),this.createFrictionEquationsFromContact(j,this.frictionResult)}u.release(A),A=null;let R=u.get(),w=u.get(),D=u.get(),C=u.get(),V=u.get(),H=d.length;for(let T=0;T!==H&&!v;T++)for(let N=0;N!==H&&!v;N++)if(T%3!=N%3){d[N].cross(d[T],R),R.normalize(),d[T].vadd(d[N],w),D.copy(i),D.vsub(w,D),D.vsub(n,D);let I=D.dot(R);R.scale(I,C);let j=0;for(;j===T%3||j===N%3;)j++;V.copy(i),V.vsub(C,V),V.vsub(w,V),V.vsub(n,V);let O=Math.abs(I),q=V.length();if(O<d[j].length()&&q<p){if(f)return!0;v=!0;let Z=this.createContactEquation(a,c,e,t,l,h);w.vadd(C,Z.rj),Z.rj.copy(Z.rj),V.negate(Z.ni),Z.ni.normalize(),Z.ri.copy(Z.rj),Z.ri.vadd(n,Z.ri),Z.ri.vsub(i,Z.ri),Z.ri.normalize(),Z.ri.scale(p,Z.ri),Z.ri.vadd(i,Z.ri),Z.ri.vsub(a.position,Z.ri),Z.rj.vadd(n,Z.rj),Z.rj.vsub(c.position,Z.rj),this.result.push(Z),this.createFrictionEquationsFromContact(Z,this.frictionResult)}}u.release(R,w,D,C,V)}planeBox(e,t,i,n,s,r,a,c,l,h,f){return t.convexPolyhedronRepresentation.material=t.material,t.convexPolyhedronRepresentation.collisionResponse=t.collisionResponse,t.convexPolyhedronRepresentation.id=t.id,this.planeConvex(e,t.convexPolyhedronRepresentation,i,n,s,r,a,c,e,t,f)}convexConvex(e,t,i,n,s,r,a,c,l,h,f,u,d){let p=ff;if(!(i.distanceTo(n)>e.boundingSphereRadius+t.boundingSphereRadius)&&e.findSeparatingAxis(t,i,s,n,r,p,u,d)){let v=[],x=df;e.clipAgainstHull(i,s,t,n,r,p,-100,100,v);let g=0;for(let m=0;m!==v.length;m++){if(f)return!0;let z=this.createContactEquation(a,c,e,t,l,h),y=z.ri,b=z.rj;p.negate(z.ni),v[m].normal.negate(x),x.scale(v[m].depth,x),v[m].point.vadd(x,y),b.copy(v[m].point),y.vsub(i,y),b.vsub(n,b),y.vadd(i,y),y.vsub(a.position,y),b.vadd(n,b),b.vsub(c.position,b),this.result.push(z),g++,this.enableFrictionReduction||this.createFrictionEquationsFromContact(z,this.frictionResult)}this.enableFrictionReduction&&g&&this.createFrictionFromAverage(g)}}sphereConvex(e,t,i,n,s,r,a,c,l,h,f){let u=this.v3pool;i.vsub(n,J9);let d=t.faceNormals,p=t.faces,v=t.vertices,x=e.radius,g=!1;for(let m=0;m!==v.length;m++){let z=v[m],y=tf;r.vmult(z,y),n.vadd(y,y);let b=ef;if(y.vsub(i,b),b.lengthSquared()<x*x){if(f)return!0;g=!0;let S=this.createContactEquation(a,c,e,t,l,h);S.ri.copy(b),S.ri.normalize(),S.ni.copy(S.ri),S.ri.scale(x,S.ri),y.vsub(n,S.rj),S.ri.vadd(i,S.ri),S.ri.vsub(a.position,S.ri),S.rj.vadd(n,S.rj),S.rj.vsub(c.position,S.rj),this.result.push(S),this.createFrictionEquationsFromContact(S,this.frictionResult);return}}for(let m=0,z=p.length;m!==z&&g===!1;m++){let y=d[m],b=p[m],S=nf;r.vmult(y,S);let _=sf;r.vmult(v[b[0]],_),_.vadd(n,_);let A=rf;S.scale(-x,A),i.vadd(A,A);let P=af;A.vsub(_,P);let R=P.dot(S),w=of;if(i.vsub(_,w),R<0&&w.dot(S)>0){let D=[];for(let C=0,V=b.length;C!==V;C++){let H=u.get();r.vmult(v[b[C]],H),n.vadd(H,H),D.push(H)}if(U9(D,S,i)){if(f)return!0;g=!0;let C=this.createContactEquation(a,c,e,t,l,h);S.scale(-x,C.ri),S.negate(C.ni);let V=u.get();S.scale(-R,V);let H=u.get();S.scale(-x,H),i.vsub(n,C.rj),C.rj.vadd(H,C.rj),C.rj.vadd(V,C.rj),C.rj.vadd(n,C.rj),C.rj.vsub(c.position,C.rj),C.ri.vadd(i,C.ri),C.ri.vsub(a.position,C.ri),u.release(V),u.release(H),this.result.push(C),this.createFrictionEquationsFromContact(C,this.frictionResult);for(let T=0,N=D.length;T!==N;T++)u.release(D[T]);return}else for(let C=0;C!==b.length;C++){let V=u.get(),H=u.get();r.vmult(v[b[(C+1)%b.length]],V),r.vmult(v[b[(C+2)%b.length]],H),n.vadd(V,V),n.vadd(H,H);let T=Q9;H.vsub(V,T);let N=K9;T.unit(N);let I=u.get(),j=u.get();i.vsub(V,j);let O=j.dot(N);N.scale(O,I),I.vadd(V,I);let q=u.get();if(I.vsub(i,q),O>0&&O*O<T.lengthSquared()&&q.lengthSquared()<x*x){if(f)return!0;let Z=this.createContactEquation(a,c,e,t,l,h);I.vsub(n,Z.rj),I.vsub(i,Z.ni),Z.ni.normalize(),Z.ni.scale(x,Z.ri),Z.rj.vadd(n,Z.rj),Z.rj.vsub(c.position,Z.rj),Z.ri.vadd(i,Z.ri),Z.ri.vsub(a.position,Z.ri),this.result.push(Z),this.createFrictionEquationsFromContact(Z,this.frictionResult);for(let ne=0,ce=D.length;ne!==ce;ne++)u.release(D[ne]);u.release(V),u.release(H),u.release(I),u.release(q),u.release(j);return}u.release(V),u.release(H),u.release(I),u.release(q),u.release(j)}for(let C=0,V=D.length;C!==V;C++)u.release(D[C])}}}planeConvex(e,t,i,n,s,r,a,c,l,h,f){let u=cf,d=lf;d.set(0,0,1),s.vmult(d,d);let p=0,v=hf;for(let x=0;x!==t.vertices.length;x++)if(u.copy(t.vertices[x]),r.vmult(u,u),n.vadd(u,u),u.vsub(i,v),d.dot(v)<=0){if(f)return!0;let m=this.createContactEquation(a,c,e,t,l,h),z=uf;d.scale(d.dot(v),z),u.vsub(z,z),z.vsub(i,m.ri),m.ni.copy(d),u.vsub(n,m.rj),m.ri.vadd(i,m.ri),m.ri.vsub(a.position,m.ri),m.rj.vadd(n,m.rj),m.rj.vsub(c.position,m.rj),this.result.push(m),p++,this.enableFrictionReduction||this.createFrictionEquationsFromContact(m,this.frictionResult)}this.enableFrictionReduction&&p&&this.createFrictionFromAverage(p)}boxConvex(e,t,i,n,s,r,a,c,l,h,f){return e.convexPolyhedronRepresentation.material=e.material,e.convexPolyhedronRepresentation.collisionResponse=e.collisionResponse,this.convexConvex(e.convexPolyhedronRepresentation,t,i,n,s,r,a,c,e,t,f)}sphereHeightfield(e,t,i,n,s,r,a,c,l,h,f){let u=t.data,d=e.radius,p=t.elementSize,v=Af,x=Cf;qe.pointToLocalFrame(n,r,i,x);let g=Math.floor((x.x-d)/p)-1,m=Math.ceil((x.x+d)/p)+1,z=Math.floor((x.y-d)/p)-1,y=Math.ceil((x.y+d)/p)+1;if(m<0||y<0||g>u.length||z>u[0].length)return;g<0&&(g=0),m<0&&(m=0),z<0&&(z=0),y<0&&(y=0),g>=u.length&&(g=u.length-1),m>=u.length&&(m=u.length-1),y>=u[0].length&&(y=u[0].length-1),z>=u[0].length&&(z=u[0].length-1);let b=[];t.getRectMinMax(g,z,m,y,b);let S=b[0],_=b[1];if(x.z-d>_||x.z+d<S)return;let A=this.result;for(let P=g;P<m;P++)for(let R=z;R<y;R++){let w=A.length,D=!1;if(t.getConvexTrianglePillar(P,R,!1),qe.pointToWorldFrame(n,r,t.pillarOffset,v),i.distanceTo(v)<t.pillarConvex.boundingSphereRadius+e.boundingSphereRadius&&(D=this.sphereConvex(e,t.pillarConvex,i,v,s,r,a,c,e,t,f)),f&&D||(t.getConvexTrianglePillar(P,R,!0),qe.pointToWorldFrame(n,r,t.pillarOffset,v),i.distanceTo(v)<t.pillarConvex.boundingSphereRadius+e.boundingSphereRadius&&(D=this.sphereConvex(e,t.pillarConvex,i,v,s,r,a,c,e,t,f)),f&&D))return!0;if(A.length-w>2)return}}boxHeightfield(e,t,i,n,s,r,a,c,l,h,f){return e.convexPolyhedronRepresentation.material=e.material,e.convexPolyhedronRepresentation.collisionResponse=e.collisionResponse,this.convexHeightfield(e.convexPolyhedronRepresentation,t,i,n,s,r,a,c,e,t,f)}convexHeightfield(e,t,i,n,s,r,a,c,l,h,f){let u=t.data,d=t.elementSize,p=e.boundingSphereRadius,v=Mf,x=zf,g=bf;qe.pointToLocalFrame(n,r,i,g);let m=Math.floor((g.x-p)/d)-1,z=Math.ceil((g.x+p)/d)+1,y=Math.floor((g.y-p)/d)-1,b=Math.ceil((g.y+p)/d)+1;if(z<0||b<0||m>u.length||y>u[0].length)return;m<0&&(m=0),z<0&&(z=0),y<0&&(y=0),b<0&&(b=0),m>=u.length&&(m=u.length-1),z>=u.length&&(z=u.length-1),b>=u[0].length&&(b=u[0].length-1),y>=u[0].length&&(y=u[0].length-1);let S=[];t.getRectMinMax(m,y,z,b,S);let _=S[0],A=S[1];if(!(g.z-p>A||g.z+p<_))for(let P=m;P<z;P++)for(let R=y;R<b;R++){let w=!1;if(t.getConvexTrianglePillar(P,R,!1),qe.pointToWorldFrame(n,r,t.pillarOffset,v),i.distanceTo(v)<t.pillarConvex.boundingSphereRadius+e.boundingSphereRadius&&(w=this.convexConvex(e,t.pillarConvex,i,v,s,r,a,c,null,null,f,x,null)),f&&w||(t.getConvexTrianglePillar(P,R,!0),qe.pointToWorldFrame(n,r,t.pillarOffset,v),i.distanceTo(v)<t.pillarConvex.boundingSphereRadius+e.boundingSphereRadius&&(w=this.convexConvex(e,t.pillarConvex,i,v,s,r,a,c,null,null,f,x,null)),f&&w))return!0}}sphereParticle(e,t,i,n,s,r,a,c,l,h,f){let u=vf;if(u.set(0,0,1),n.vsub(i,u),u.lengthSquared()<=e.radius*e.radius){if(f)return!0;let p=this.createContactEquation(c,a,t,e,l,h);u.normalize(),p.rj.copy(u),p.rj.scale(e.radius,p.rj),p.ni.copy(u),p.ni.negate(p.ni),p.ri.set(0,0,0),this.result.push(p),this.createFrictionEquationsFromContact(p,this.frictionResult)}}planeParticle(e,t,i,n,s,r,a,c,l,h,f){let u=pf;u.set(0,0,1),a.quaternion.vmult(u,u);let d=mf;if(n.vsub(a.position,d),u.dot(d)<=0){if(f)return!0;let v=this.createContactEquation(c,a,t,e,l,h);v.ni.copy(u),v.ni.negate(v.ni),v.ri.set(0,0,0);let x=gf;u.scale(u.dot(n),x),n.vsub(x,x),v.rj.copy(x),this.result.push(v),this.createFrictionEquationsFromContact(v,this.frictionResult)}}boxParticle(e,t,i,n,s,r,a,c,l,h,f){return e.convexPolyhedronRepresentation.material=e.material,e.convexPolyhedronRepresentation.collisionResponse=e.collisionResponse,this.convexParticle(e.convexPolyhedronRepresentation,t,i,n,s,r,a,c,e,t,f)}convexParticle(e,t,i,n,s,r,a,c,l,h,f){let u=-1,d=yf,p=wf,v=null,x=xf;if(x.copy(n),x.vsub(i,x),s.conjugate(qc),qc.vmult(x,x),e.pointIsInside(x)){e.worldVerticesNeedsUpdate&&e.computeWorldVertices(i,s),e.worldFaceNormalsNeedsUpdate&&e.computeWorldFaceNormals(s);for(let g=0,m=e.faces.length;g!==m;g++){let z=[e.worldVertices[e.faces[g][0]]],y=e.worldFaceNormals[g];n.vsub(z[0],Wc);let b=-y.dot(Wc);if(v===null||Math.abs(b)<Math.abs(v)){if(f)return!0;v=b,u=g,d.copy(y)}}if(u!==-1){let g=this.createContactEquation(c,a,t,e,l,h);d.scale(v,p),p.vadd(n,p),p.vsub(i,p),g.rj.copy(p),d.negate(g.ni),g.ri.set(0,0,0);let m=g.ri,z=g.rj;m.vadd(n,m),m.vsub(c.position,m),z.vadd(i,z),z.vsub(a.position,z),this.result.push(g),this.createFrictionEquationsFromContact(g,this.frictionResult)}else console.warn("Point found inside convex, but did not find penetrating face!")}}heightfieldCylinder(e,t,i,n,s,r,a,c,l,h,f){return this.convexHeightfield(t,e,n,i,r,s,c,a,l,h,f)}particleCylinder(e,t,i,n,s,r,a,c,l,h,f){return this.convexParticle(t,e,n,i,r,s,c,a,l,h,f)}sphereTrimesh(e,t,i,n,s,r,a,c,l,h,f){let u=E9,d=L9,p=T9,v=D9,x=H9,g=V9,m=B9,z=_9,y=A9,b=P9;qe.pointToLocalFrame(n,r,i,x);let S=e.radius;m.lowerBound.set(x.x-S,x.y-S,x.z-S),m.upperBound.set(x.x+S,x.y+S,x.z+S),t.getTrianglesInAABB(m,b);let _=S9,A=e.radius*e.radius;for(let C=0;C<b.length;C++)for(let V=0;V<3;V++)if(t.getVertex(t.indices[b[C]*3+V],_),_.vsub(x,y),y.lengthSquared()<=A){if(z.copy(_),qe.pointToWorldFrame(n,r,z,_),_.vsub(i,y),f)return!0;let H=this.createContactEquation(a,c,e,t,l,h);H.ni.copy(y),H.ni.normalize(),H.ri.copy(H.ni),H.ri.scale(e.radius,H.ri),H.ri.vadd(i,H.ri),H.ri.vsub(a.position,H.ri),H.rj.copy(_),H.rj.vsub(c.position,H.rj),this.result.push(H),this.createFrictionEquationsFromContact(H,this.frictionResult)}for(let C=0;C<b.length;C++)for(let V=0;V<3;V++){t.getVertex(t.indices[b[C]*3+V],u),t.getVertex(t.indices[b[C]*3+(V+1)%3],d),d.vsub(u,p),x.vsub(d,g);let H=g.dot(p);x.vsub(u,g);let T=g.dot(p);if(T>0&&H<0&&(x.vsub(u,g),v.copy(p),v.normalize(),T=g.dot(v),v.scale(T,g),g.vadd(u,g),g.distanceTo(x)<e.radius)){if(f)return!0;let I=this.createContactEquation(a,c,e,t,l,h);g.vsub(x,I.ni),I.ni.normalize(),I.ni.scale(e.radius,I.ri),I.ri.vadd(i,I.ri),I.ri.vsub(a.position,I.ri),qe.pointToWorldFrame(n,r,g,g),g.vsub(c.position,I.rj),qe.vectorToWorldFrame(r,I.ni,I.ni),qe.vectorToWorldFrame(r,I.ri,I.ri),this.result.push(I),this.createFrictionEquationsFromContact(I,this.frictionResult)}}let P=R9,R=N9,w=F9,D=C9;for(let C=0,V=b.length;C!==V;C++){t.getTriangleVertices(b[C],P,R,w),t.getNormal(b[C],D),x.vsub(P,g);let H=g.dot(D);if(D.scale(H,g),x.vsub(g,g),H=g.distanceTo(x),mt.pointInTriangle(g,P,R,w)&&H<e.radius){if(f)return!0;let T=this.createContactEquation(a,c,e,t,l,h);g.vsub(x,T.ni),T.ni.normalize(),T.ni.scale(e.radius,T.ri),T.ri.vadd(i,T.ri),T.ri.vsub(a.position,T.ri),qe.pointToWorldFrame(n,r,g,g),g.vsub(c.position,T.rj),qe.vectorToWorldFrame(r,T.ni,T.ni),qe.vectorToWorldFrame(r,T.ri,T.ri),this.result.push(T),this.createFrictionEquationsFromContact(T,this.frictionResult)}}b.length=0}planeTrimesh(e,t,i,n,s,r,a,c,l,h,f){let u=new M,d=b9;d.set(0,0,1),s.vmult(d,d);for(let p=0;p<t.vertices.length/3;p++){t.getVertex(p,u);let v=new M;v.copy(u),qe.pointToWorldFrame(n,r,v,u);let x=M9;if(u.vsub(i,x),d.dot(x)<=0){if(f)return!0;let m=this.createContactEquation(a,c,e,t,l,h);m.ni.copy(d);let z=z9;d.scale(x.dot(d),z),u.vsub(z,z),m.ri.copy(z),m.ri.vsub(a.position,m.ri),m.rj.copy(u),m.rj.vsub(c.position,m.rj),this.result.push(m),this.createFrictionEquationsFromContact(m,this.frictionResult)}}}},bi=new M,Qi=new M,Ki=new M,v9=new M,x9=new M,y9=new nt,w9=new nt,b9=new M,M9=new M,z9=new M,C9=new M,A9=new M,S9=new M,_9=new M,E9=new M,L9=new M,T9=new M,D9=new M,H9=new M,V9=new M,R9=new M,N9=new M,F9=new M,B9=new Zt,P9=[],Fr=new M,Gc=new M,I9=new M,k9=new M,O9=new M;function U9(o,e,t){let i=null,n=o.length;for(let s=0;s!==n;s++){let r=o[s],a=I9;o[(s+1)%n].vsub(r,a);let c=k9;a.cross(e,c);let l=O9;t.vsub(r,l);let h=c.dot(l);if(i===null||h>0&&i===!0||h<=0&&i===!1){i===null&&(i=h>0);continue}else return!1}return!0}var Br=new M,G9=new M,q9=new M,W9=new M,j9=[new M,new M,new M,new M,new M,new M],Z9=new M,X9=new M,Y9=new M,$9=new M,J9=new M,Q9=new M,K9=new M,ef=new M,tf=new M,nf=new M,sf=new M,rf=new M,af=new M,of=new M,cf=new M,lf=new M,hf=new M,uf=new M,ff=new M,df=new M,pf=new M,mf=new M,gf=new M,vf=new M,qc=new nt,xf=new M,yf=new M,Wc=new M,wf=new M,bf=new M,Mf=new M,zf=[0],Cf=new M,Af=new M,l0=class{constructor(){this.current=void 0,this.previous=void 0,this.current=[],this.previous=[]}getKey(e,t){if(t<e){let i=t;t=e,e=i}return e<<16|t}set(e,t){let i=this.getKey(e,t),n=this.current,s=0;for(;i>n[s];)s++;if(i!==n[s]){for(let r=n.length-1;r>=s;r--)n[r+1]=n[r];n[s]=i}}tick(){let e=this.current;this.current=this.previous,this.previous=e,this.current.length=0}getDiff(e,t){let i=this.current,n=this.previous,s=i.length,r=n.length,a=0;for(let c=0;c<s;c++){let l=!1,h=i[c];for(;h>n[a];)a++;l=h===n[a],l||jc(e,h)}a=0;for(let c=0;c<r;c++){let l=!1,h=n[c];for(;h>i[a];)a++;l=i[a]===h,l||jc(t,h)}}};function jc(o,e){o.push((e&4294901760)>>16,e&65535)}var Zc=class{constructor(){this.data={keys:[]}}get(e,t){if(e>t){let i=t;t=e,e=i}return this.data[e+"-"+t]}set(e,t,i){if(e>t){let s=t;t=e,e=s}let n=e+"-"+t;this.get(e,t)||this.data.keys.push(n),this.data[n]=i}reset(){let e=this.data,t=e.keys;for(;t.length>0;){let i=t.pop();delete e[i]}}},h0=class extends Q4{constructor(e={}){super();this.dt=void 0,this.allowSleep=void 0,this.contacts=void 0,this.frictionEquations=void 0,this.quatNormalizeSkip=void 0,this.quatNormalizeFast=void 0,this.time=void 0,this.stepnumber=void 0,this.default_dt=void 0,this.nextId=void 0,this.gravity=void 0,this.broadphase=void 0,this.bodies=void 0,this.hasActiveBodies=void 0,this.solver=void 0,this.constraints=void 0,this.narrowphase=void 0,this.collisionMatrix=void 0,this.collisionMatrixPrevious=void 0,this.bodyOverlapKeeper=void 0,this.shapeOverlapKeeper=void 0,this.materials=void 0,this.contactmaterials=void 0,this.contactMaterialTable=void 0,this.defaultMaterial=void 0,this.defaultContactMaterial=void 0,this.doProfiling=void 0,this.profile=void 0,this.accumulator=void 0,this.subsystems=void 0,this.addBodyEvent=void 0,this.removeBodyEvent=void 0,this.idToBodyMap=void 0,this.dt=-1,this.allowSleep=!!e.allowSleep,this.contacts=[],this.frictionEquations=[],this.quatNormalizeSkip=e.quatNormalizeSkip!==void 0?e.quatNormalizeSkip:0,this.quatNormalizeFast=e.quatNormalizeFast!==void 0?e.quatNormalizeFast:!1,this.time=0,this.stepnumber=0,this.default_dt=1/60,this.nextId=0,this.gravity=new M,e.gravity&&this.gravity.copy(e.gravity),this.broadphase=e.broadphase!==void 0?e.broadphase:new Tr,this.bodies=[],this.hasActiveBodies=!1,this.solver=e.solver!==void 0?e.solver:new pc,this.constraints=[],this.narrowphase=new Uc(this),this.collisionMatrix=new J4,this.collisionMatrixPrevious=new J4,this.bodyOverlapKeeper=new l0,this.shapeOverlapKeeper=new l0,this.materials=[],this.contactmaterials=[],this.contactMaterialTable=new Zc,this.defaultMaterial=new r2("default"),this.defaultContactMaterial=new s2(this.defaultMaterial,this.defaultMaterial,{friction:.3,restitution:0}),this.doProfiling=!1,this.profile={solve:0,makeContactConstraints:0,broadphase:0,integrate:0,narrowphase:0},this.accumulator=0,this.subsystems=[],this.addBodyEvent={type:"addBody",body:null},this.removeBodyEvent={type:"removeBody",body:null},this.idToBodyMap={},this.broadphase.setWorld(this)}getContactMaterial(e,t){return this.contactMaterialTable.get(e.id,t.id)}numObjects(){return this.bodies.length}collisionMatrixTick(){let e=this.collisionMatrixPrevious;this.collisionMatrixPrevious=this.collisionMatrix,this.collisionMatrix=e,this.collisionMatrix.reset(),this.bodyOverlapKeeper.tick(),this.shapeOverlapKeeper.tick()}addConstraint(e){this.constraints.push(e)}removeConstraint(e){let t=this.constraints.indexOf(e);t!==-1&&this.constraints.splice(t,1)}rayTest(e,t,i){i instanceof Dr?this.raycastClosest(e,t,{skipBackfaces:!0},i):this.raycastAll(e,t,{skipBackfaces:!0},i)}raycastAll(e,t,i={},n){return i.mode=mt.ALL,i.from=e,i.to=t,i.callback=n,u0.intersectWorld(this,i)}raycastAny(e,t,i={},n){return i.mode=mt.ANY,i.from=e,i.to=t,i.result=n,u0.intersectWorld(this,i)}raycastClosest(e,t,i={},n){return i.mode=mt.CLOSEST,i.from=e,i.to=t,i.result=n,u0.intersectWorld(this,i)}addBody(e){this.bodies.includes(e)||(e.index=this.bodies.length,this.bodies.push(e),e.world=this,e.initPosition.copy(e.position),e.initVelocity.copy(e.velocity),e.timeLastSleepy=this.time,e instanceof ae&&(e.initAngularVelocity.copy(e.angularVelocity),e.initQuaternion.copy(e.quaternion)),this.collisionMatrix.setNumObjects(this.bodies.length),this.addBodyEvent.body=e,this.idToBodyMap[e.id]=e,this.dispatchEvent(this.addBodyEvent))}removeBody(e){e.world=null;let t=this.bodies.length-1,i=this.bodies,n=i.indexOf(e);if(n!==-1){i.splice(n,1);for(let s=0;s!==i.length;s++)i[s].index=s;this.collisionMatrix.setNumObjects(t),this.removeBodyEvent.body=e,delete this.idToBodyMap[e.id],this.dispatchEvent(this.removeBodyEvent)}}getBodyById(e){return this.idToBodyMap[e]}getShapeById(e){let t=this.bodies;for(let i=0;i<t.length;i++){let n=t[i].shapes;for(let s=0;s<n.length;s++){let r=n[s];if(r.id===e)return r}}return null}addMaterial(e){this.materials.push(e)}addContactMaterial(e){this.contactmaterials.push(e),this.contactMaterialTable.set(e.materials[0].id,e.materials[1].id,e)}step(e,t,i=10){if(t===void 0)this.internalStep(e),this.time+=e;else{this.accumulator+=t;let n=Et.now(),s=0;for(;this.accumulator>=e&&s<i&&(this.internalStep(e),this.accumulator-=e,s++,!(Et.now()-n>e*1e3)););this.accumulator=this.accumulator%e;let r=this.accumulator/e;for(let a=0;a!==this.bodies.length;a++){let c=this.bodies[a];c.previousPosition.lerp(c.position,r,c.interpolatedPosition),c.previousQuaternion.slerp(c.quaternion,r,c.interpolatedQuaternion),c.previousQuaternion.normalize()}this.time+=t}}internalStep(e){this.dt=e;let t=this.contacts,i=Tf,n=Df,s=this.numObjects(),r=this.bodies,a=this.solver,c=this.gravity,l=this.doProfiling,h=this.profile,f=ae.DYNAMIC,u=-1/0,d=this.constraints,p=Lf;c.length();let v=c.x,x=c.y,g=c.z,m=0;for(l&&(u=Et.now()),m=0;m!==s;m++){let C=r[m];if(C.type===f){let V=C.force,H=C.mass;V.x+=H*v,V.y+=H*x,V.z+=H*g}}for(let C=0,V=this.subsystems.length;C!==V;C++)this.subsystems[C].update();l&&(u=Et.now()),i.length=0,n.length=0,this.broadphase.collisionPairs(this,i,n),l&&(h.broadphase=Et.now()-u);let z=d.length;for(m=0;m!==z;m++){let C=d[m];if(!C.collideConnected)for(let V=i.length-1;V>=0;V-=1)(C.bodyA===i[V]&&C.bodyB===n[V]||C.bodyB===i[V]&&C.bodyA===n[V])&&(i.splice(V,1),n.splice(V,1))}this.collisionMatrixTick(),l&&(u=Et.now());let y=Ef,b=t.length;for(m=0;m!==b;m++)y.push(t[m]);t.length=0;let S=this.frictionEquations.length;for(m=0;m!==S;m++)p.push(this.frictionEquations[m]);for(this.frictionEquations.length=0,this.narrowphase.getContacts(i,n,this,t,y,this.frictionEquations,p),l&&(h.narrowphase=Et.now()-u),l&&(u=Et.now()),m=0;m<this.frictionEquations.length;m++)a.addEquation(this.frictionEquations[m]);let _=t.length;for(let C=0;C!==_;C++){let V=t[C],H=V.bi,T=V.bj,N=V.si,I=V.sj,j;if(H.material&&T.material?j=this.getContactMaterial(H.material,T.material)||this.defaultContactMaterial:j=this.defaultContactMaterial,j.friction,H.material&&T.material&&(H.material.friction>=0&&T.material.friction>=0&&H.material.friction*T.material.friction,H.material.restitution>=0&&T.material.restitution>=0&&(V.restitution=H.material.restitution*T.material.restitution)),a.addEquation(V),H.allowSleep&&H.type===ae.DYNAMIC&&H.sleepState===ae.SLEEPING&&T.sleepState===ae.AWAKE&&T.type!==ae.STATIC){let O=T.velocity.lengthSquared()+T.angularVelocity.lengthSquared(),q=T.sleepSpeedLimit**2;O>=q*2&&(H.wakeUpAfterNarrowphase=!0)}if(T.allowSleep&&T.type===ae.DYNAMIC&&T.sleepState===ae.SLEEPING&&H.sleepState===ae.AWAKE&&H.type!==ae.STATIC){let O=H.velocity.lengthSquared()+H.angularVelocity.lengthSquared(),q=H.sleepSpeedLimit**2;O>=q*2&&(T.wakeUpAfterNarrowphase=!0)}this.collisionMatrix.set(H,T,!0),this.collisionMatrixPrevious.get(H,T)||(ms.body=T,ms.contact=V,H.dispatchEvent(ms),ms.body=H,T.dispatchEvent(ms)),this.bodyOverlapKeeper.set(H.id,T.id),this.shapeOverlapKeeper.set(N.id,I.id)}for(this.emitContactEvents(),l&&(h.makeContactConstraints=Et.now()-u,u=Et.now()),m=0;m!==s;m++){let C=r[m];C.wakeUpAfterNarrowphase&&(C.wakeUp(),C.wakeUpAfterNarrowphase=!1)}for(z=d.length,m=0;m!==z;m++){let C=d[m];C.update();for(let V=0,H=C.equations.length;V!==H;V++){let T=C.equations[V];a.addEquation(T)}}a.solve(e,this),l&&(h.solve=Et.now()-u),a.removeAllEquations();let A=Math.pow;for(m=0;m!==s;m++){let C=r[m];if(C.type&f){let V=A(1-C.linearDamping,e),H=C.velocity;H.scale(V,H);let T=C.angularVelocity;if(T){let N=A(1-C.angularDamping,e);T.scale(N,T)}}}for(this.dispatchEvent(_f),m=0;m!==s;m++){let C=r[m];C.preStep&&C.preStep.call(C)}l&&(u=Et.now());let R=this.stepnumber%(this.quatNormalizeSkip+1)==0,w=this.quatNormalizeFast;for(m=0;m!==s;m++)r[m].integrate(e,R,w);for(this.clearForces(),this.broadphase.dirty=!0,l&&(h.integrate=Et.now()-u),this.stepnumber+=1,this.dispatchEvent(Sf),m=0;m!==s;m++){let C=r[m],V=C.postStep;V&&V.call(C)}let D=!0;if(this.allowSleep)for(D=!1,m=0;m!==s;m++){let C=r[m];C.sleepTick(this.time),C.sleepState!==ae.SLEEPING&&(D=!0)}this.hasActiveBodies=D}emitContactEvents(){let e=this.hasAnyEventListener("beginContact"),t=this.hasAnyEventListener("endContact");if((e||t)&&this.bodyOverlapKeeper.getDiff(o2,c2),e){for(let s=0,r=o2.length;s<r;s+=2)gs.bodyA=this.getBodyById(o2[s]),gs.bodyB=this.getBodyById(o2[s+1]),this.dispatchEvent(gs);gs.bodyA=gs.bodyB=null}if(t){for(let s=0,r=c2.length;s<r;s+=2)vs.bodyA=this.getBodyById(c2[s]),vs.bodyB=this.getBodyById(c2[s+1]),this.dispatchEvent(vs);vs.bodyA=vs.bodyB=null}o2.length=c2.length=0;let i=this.hasAnyEventListener("beginShapeContact"),n=this.hasAnyEventListener("endShapeContact");if((i||n)&&this.shapeOverlapKeeper.getDiff(o2,c2),i){for(let s=0,r=o2.length;s<r;s+=2){let a=this.getShapeById(o2[s]),c=this.getShapeById(o2[s+1]);l2.shapeA=a,l2.shapeB=c,a&&(l2.bodyA=a.body),c&&(l2.bodyB=c.body),this.dispatchEvent(l2)}l2.bodyA=l2.bodyB=l2.shapeA=l2.shapeB=null}if(n){for(let s=0,r=c2.length;s<r;s+=2){let a=this.getShapeById(c2[s]),c=this.getShapeById(c2[s+1]);h2.shapeA=a,h2.shapeB=c,a&&(h2.bodyA=a.body),c&&(h2.bodyB=c.body),this.dispatchEvent(h2)}h2.bodyA=h2.bodyB=h2.shapeA=h2.shapeB=null}}clearForces(){let e=this.bodies,t=e.length;for(let i=0;i!==t;i++){let n=e[i];n.force,n.torque,n.force.set(0,0,0),n.torque.set(0,0,0)}}};new Zt;var u0=new mt,Et=globalThis.performance||{};if(!Et.now){let o=Date.now();Et.timing&&Et.timing.navigationStart&&(o=Et.timing.navigationStart),Et.now=()=>Date.now()-o}var Sf={type:"postStep"},_f={type:"preStep"},ms={type:ae.COLLIDE_EVENT_NAME,body:null,contact:null},Ef=[],Lf=[],Tf=[],Df=[],o2=[],c2=[],gs={type:"beginContact",bodyA:null,bodyB:null},vs={type:"endContact",bodyA:null,bodyB:null},l2={type:"beginShapeContact",bodyA:null,bodyB:null,shapeA:null,shapeB:null},h2={type:"endShapeContact",bodyA:null,bodyB:null,shapeA:null,shapeB:null};var Pr=class{constructor(e=0,t=0,i=0,n=1){this.x=e,this.y=t,this.z=i,this.w=n}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,n){return this.x=e,this.y=t,this.z=i,this.w=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e,t){return t!==void 0?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e,t){return t!==void 0?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,i=this.y,n=this.z,s=this.w,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*n+r[12]*s,this.y=r[1]*t+r[5]*i+r[9]*n+r[13]*s,this.z=r[2]*t+r[6]*i+r[10]*n+r[14]*s,this.w=r[3]*t+r[7]*i+r[11]*n+r[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,n,s,r=.01,a=.1,c=e.elements,l=c[0],h=c[4],f=c[8],u=c[1],d=c[5],p=c[9],v=c[2],x=c[6],g=c[10];if(Math.abs(h-u)<r&&Math.abs(f-v)<r&&Math.abs(p-x)<r){if(Math.abs(h+u)<a&&Math.abs(f+v)<a&&Math.abs(p+x)<a&&Math.abs(l+d+g-3)<a)return this.set(1,0,0,0),this;t=Math.PI;let z=(l+1)/2,y=(d+1)/2,b=(g+1)/2,S=(h+u)/4,_=(f+v)/4,A=(p+x)/4;return z>y&&z>b?z<r?(i=0,n=.707106781,s=.707106781):(i=Math.sqrt(z),n=S/i,s=_/i):y>b?y<r?(i=.707106781,n=0,s=.707106781):(n=Math.sqrt(y),i=S/n,s=A/n):b<r?(i=.707106781,n=.707106781,s=0):(s=Math.sqrt(b),i=_/s,n=A/s),this.set(i,n,s,t),this}let m=Math.sqrt((x-p)*(x-p)+(f-v)*(f-v)+(u-h)*(u-h));return Math.abs(m)<.001&&(m=1),this.x=(x-p)/m,this.y=(f-v)/m,this.z=(u-h)/m,this.w=Math.acos((l+d+g-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t,i){return i!==void 0&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};Pr.prototype.isVector4=!0;var Ht=[];for(let o=0;o<256;o++)Ht[o]=(o<16?"0":"")+o.toString(16);var KM=Math.PI/180,ez=180/Math.PI;function u2(){let o=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Ht[o&255]+Ht[o>>8&255]+Ht[o>>16&255]+Ht[o>>24&255]+"-"+Ht[e&255]+Ht[e>>8&255]+"-"+Ht[e>>16&15|64]+Ht[e>>24&255]+"-"+Ht[t&63|128]+Ht[t>>8&255]+"-"+Ht[t>>16&255]+Ht[t>>24&255]+Ht[i&255]+Ht[i>>8&255]+Ht[i>>16&255]+Ht[i>>24&255]).toUpperCase()}function Yt(o,e,t){return Math.max(e,Math.min(t,o))}function Xc(o,e){return(o%e+e)%e}function Ir(o,e,t){return(1-t)*o+t*e}var O1=class{constructor(e=0,t=0,i=0,n=1){this._x=e,this._y=t,this._z=i,this._w=n}static slerp(e,t,i,n){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),i.slerpQuaternions(e,t,n)}static slerpFlat(e,t,i,n,s,r,a){let c=i[n+0],l=i[n+1],h=i[n+2],f=i[n+3],u=s[r+0],d=s[r+1],p=s[r+2],v=s[r+3];if(a===0){e[t+0]=c,e[t+1]=l,e[t+2]=h,e[t+3]=f;return}if(a===1){e[t+0]=u,e[t+1]=d,e[t+2]=p,e[t+3]=v;return}if(f!==v||c!==u||l!==d||h!==p){let x=1-a,g=c*u+l*d+h*p+f*v,m=g>=0?1:-1,z=1-g*g;if(z>Number.EPSILON){let b=Math.sqrt(z),S=Math.atan2(b,g*m);x=Math.sin(x*S)/b,a=Math.sin(a*S)/b}let y=a*m;if(c=c*x+u*y,l=l*x+d*y,h=h*x+p*y,f=f*x+v*y,x===1-a){let b=1/Math.sqrt(c*c+l*l+h*h+f*f);c*=b,l*=b,h*=b,f*=b}}e[t]=c,e[t+1]=l,e[t+2]=h,e[t+3]=f}static multiplyQuaternionsFlat(e,t,i,n,s,r){let a=i[n],c=i[n+1],l=i[n+2],h=i[n+3],f=s[r],u=s[r+1],d=s[r+2],p=s[r+3];return e[t]=a*p+h*f+c*d-l*u,e[t+1]=c*p+h*u+l*f-a*d,e[t+2]=l*p+h*d+a*u-c*f,e[t+3]=h*p-a*f-c*u-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,n){return this._x=e,this._y=t,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){if(!(e&&e.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");let i=e._x,n=e._y,s=e._z,r=e._order,a=Math.cos,c=Math.sin,l=a(i/2),h=a(n/2),f=a(s/2),u=c(i/2),d=c(n/2),p=c(s/2);switch(r){case"XYZ":this._x=u*h*f+l*d*p,this._y=l*d*f-u*h*p,this._z=l*h*p+u*d*f,this._w=l*h*f-u*d*p;break;case"YXZ":this._x=u*h*f+l*d*p,this._y=l*d*f-u*h*p,this._z=l*h*p-u*d*f,this._w=l*h*f+u*d*p;break;case"ZXY":this._x=u*h*f-l*d*p,this._y=l*d*f+u*h*p,this._z=l*h*p+u*d*f,this._w=l*h*f-u*d*p;break;case"ZYX":this._x=u*h*f-l*d*p,this._y=l*d*f+u*h*p,this._z=l*h*p-u*d*f,this._w=l*h*f+u*d*p;break;case"YZX":this._x=u*h*f+l*d*p,this._y=l*d*f+u*h*p,this._z=l*h*p-u*d*f,this._w=l*h*f-u*d*p;break;case"XZY":this._x=u*h*f-l*d*p,this._y=l*d*f-u*h*p,this._z=l*h*p+u*d*f,this._w=l*h*f+u*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+r)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let i=t/2,n=Math.sin(i);return this._x=e.x*n,this._y=e.y*n,this._z=e.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,i=t[0],n=t[4],s=t[8],r=t[1],a=t[5],c=t[9],l=t[2],h=t[6],f=t[10],u=i+a+f;if(u>0){let d=.5/Math.sqrt(u+1);this._w=.25/d,this._x=(h-c)*d,this._y=(s-l)*d,this._z=(r-n)*d}else if(i>a&&i>f){let d=2*Math.sqrt(1+i-a-f);this._w=(h-c)/d,this._x=.25*d,this._y=(n+r)/d,this._z=(s+l)/d}else if(a>f){let d=2*Math.sqrt(1+a-i-f);this._w=(s-l)/d,this._x=(n+r)/d,this._y=.25*d,this._z=(c+h)/d}else{let d=2*Math.sqrt(1+f-i-a);this._w=(r-n)/d,this._x=(s+l)/d,this._y=(c+h)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Yt(this.dot(e),-1,1)))}rotateTowards(e,t){let i=this.angleTo(e);if(i===0)return this;let n=Math.min(1,t/i);return this.slerp(e,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e,t){return t!==void 0?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let i=e._x,n=e._y,s=e._z,r=e._w,a=t._x,c=t._y,l=t._z,h=t._w;return this._x=i*h+r*a+n*l-s*c,this._y=n*h+r*c+s*a-i*l,this._z=s*h+r*l+i*c-n*a,this._w=r*h-i*a-n*c-s*l,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);let i=this._x,n=this._y,s=this._z,r=this._w,a=r*e._w+i*e._x+n*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=r,this._x=i,this._y=n,this._z=s,this;let c=1-a*a;if(c<=Number.EPSILON){let d=1-t;return this._w=d*r+t*this._w,this._x=d*i+t*this._x,this._y=d*n+t*this._y,this._z=d*s+t*this._z,this.normalize(),this._onChangeCallback(),this}let l=Math.sqrt(c),h=Math.atan2(l,a),f=Math.sin((1-t)*h)/l,u=Math.sin(t*h)/l;return this._w=r*f+this._w*u,this._x=i*f+this._x*u,this._y=n*f+this._y*u,this._z=s*f+this._z*u,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){let e=Math.random(),t=Math.sqrt(1-e),i=Math.sqrt(e),n=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(n),i*Math.sin(s),i*Math.cos(s),t*Math.sin(n))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}};O1.prototype.isQuaternion=!0;var Y=class{constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e,t){return t!==void 0?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e,t){return t!==void 0?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e,t){return t!==void 0?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Yc.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Yc.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,i=this.y,n=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*n,this.y=s[1]*t+s[4]*i+s[7]*n,this.z=s[2]*t+s[5]*i+s[8]*n,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,i=this.y,n=this.z,s=e.elements,r=1/(s[3]*t+s[7]*i+s[11]*n+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*n+s[12])*r,this.y=(s[1]*t+s[5]*i+s[9]*n+s[13])*r,this.z=(s[2]*t+s[6]*i+s[10]*n+s[14])*r,this}applyQuaternion(e){let t=this.x,i=this.y,n=this.z,s=e.x,r=e.y,a=e.z,c=e.w,l=c*t+r*n-a*i,h=c*i+a*t-s*n,f=c*n+s*i-r*t,u=-s*t-r*i-a*n;return this.x=l*c+u*-s+h*-a-f*-r,this.y=h*c+u*-r+f*-s-l*-a,this.z=f*c+u*-a+l*-r-h*-s,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,i=this.y,n=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*n,this.y=s[1]*t+s[5]*i+s[9]*n,this.z=s[2]*t+s[6]*i+s[10]*n,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e,t){return t!==void 0?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)}crossVectors(e,t){let i=e.x,n=e.y,s=e.z,r=t.x,a=t.y,c=t.z;return this.x=n*c-s*a,this.y=s*r-i*c,this.z=i*a-n*r,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return f0.copy(this).projectOnVector(e),this.sub(f0)}reflect(e){return this.sub(f0.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let i=this.dot(e)/t;return Math.acos(Yt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y,n=this.z-e.z;return t*t+i*i+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){let n=Math.sin(t)*e;return this.x=n*Math.sin(i),this.y=Math.cos(t)*e,this.z=n*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),n=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=n,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t,i){return i!==void 0&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(t),this.y=i*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};Y.prototype.isVector3=!0;var f0=new Y,Yc=new O1;var gt=class{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e,t){return t!==void 0?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e,t){return t!==void 0?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,i=this.y,n=e.elements;return this.x=n[0]*t+n[3]*i+n[6],this.y=n[1]*t+n[4]*i+n[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t,i){return i!==void 0&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let i=Math.cos(t),n=Math.sin(t),s=this.x-e.x,r=this.y-e.y;return this.x=s*i-r*n+e.x,this.y=s*n+r*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};gt.prototype.isVector2=!0;var $c={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},x1={h:0,s:0,l:0},kr={h:0,s:0,l:0};function d0(o,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?o+(e-o)*6*t:t<1/2?e:t<2/3?o+(e-o)*6*(2/3-t):o}function zi(o){return o<.04045?o*.0773993808:Math.pow(o*.9478672986+.0521327014,2.4)}function p0(o){return o<.0031308?o*12.92:1.055*Math.pow(o,.41666)-.055}var $t=class{constructor(e,t,i){return t===void 0&&i===void 0?this.set(e):this.setRGB(e,t,i)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,this}setRGB(e,t,i){return this.r=e,this.g=t,this.b=i,this}setHSL(e,t,i){if(e=Xc(e,1),t=Yt(t,0,1),i=Yt(i,0,1),t===0)this.r=this.g=this.b=i;else{let n=i<=.5?i*(1+t):i+t-i*t,s=2*i-n;this.r=d0(s,n,e+1/3),this.g=d0(s,n,e),this.b=d0(s,n,e-1/3)}return this}setStyle(e){function t(n){n!==void 0&&parseFloat(n)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let n,s=i[1],r=i[2];switch(s){case"rgb":case"rgba":if(n=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(255,parseInt(n[1],10))/255,this.g=Math.min(255,parseInt(n[2],10))/255,this.b=Math.min(255,parseInt(n[3],10))/255,t(n[4]),this;if(n=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(100,parseInt(n[1],10))/100,this.g=Math.min(100,parseInt(n[2],10))/100,this.b=Math.min(100,parseInt(n[3],10))/100,t(n[4]),this;break;case"hsl":case"hsla":if(n=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r)){let a=parseFloat(n[1])/360,c=parseInt(n[2],10)/100,l=parseInt(n[3],10)/100;return t(n[4]),this.setHSL(a,c,l)}break}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){let n=i[1],s=n.length;if(s===3)return this.r=parseInt(n.charAt(0)+n.charAt(0),16)/255,this.g=parseInt(n.charAt(1)+n.charAt(1),16)/255,this.b=parseInt(n.charAt(2)+n.charAt(2),16)/255,this;if(s===6)return this.r=parseInt(n.charAt(0)+n.charAt(1),16)/255,this.g=parseInt(n.charAt(2)+n.charAt(3),16)/255,this.b=parseInt(n.charAt(4)+n.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this}setColorName(e){let t=$c[e.toLowerCase()];return t!==void 0?this.setHex(t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=zi(e.r),this.g=zi(e.g),this.b=zi(e.b),this}copyLinearToSRGB(e){return this.r=p0(e.r),this.g=p0(e.g),this.b=p0(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return this.r*255<<16^this.g*255<<8^this.b*255<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(e){let t=this.r,i=this.g,n=this.b,s=Math.max(t,i,n),r=Math.min(t,i,n),a,c,l=(r+s)/2;if(r===s)a=0,c=0;else{let h=s-r;switch(c=l<=.5?h/(s+r):h/(2-s-r),s){case t:a=(i-n)/h+(i<n?6:0);break;case i:a=(n-t)/h+2;break;case n:a=(t-i)/h+4;break}a/=6}return e.h=a,e.s=c,e.l=l,e}getStyle(){return"rgb("+(this.r*255|0)+","+(this.g*255|0)+","+(this.b*255|0)+")"}offsetHSL(e,t,i){return this.getHSL(x1),x1.h+=e,x1.s+=t,x1.l+=i,this.setHSL(x1.h,x1.s,x1.l),this}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(x1),e.getHSL(kr);let i=Ir(x1.h,kr.h,t),n=Ir(x1.s,kr.s,t),s=Ir(x1.l,kr.l,t);return this.setHSL(i,n,s),this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),e.normalized===!0&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}};$t.NAMES=$c;$t.prototype.isColor=!0;$t.prototype.r=1;$t.prototype.g=1;$t.prototype.b=1;var m0=0,Jc=1,Qc=2,Kc=1;var g0=1;var e8=100;var t8=204,i8=205;var n8=3;var Or=0;var v0=300;var x0=1e3,xs=1001,y0=1002;var s8=1006;var r8=1008;var a8=1009;var o8=1023;var c8=3e3;var l8=0;var Ur=7680;var h8=519,w0=35044;var tt=new Y,Gr=new gt,U1=class{constructor(e,t,i){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i===!0,this.usage=w0,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let n=0,s=this.itemSize;n<s;n++)this.array[e+n]=t.array[i+n];return this}copyArray(e){return this.array.set(e),this}copyColorsArray(e){let t=this.array,i=0;for(let n=0,s=e.length;n<s;n++){let r=e[n];r===void 0&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",n),r=new $t),t[i++]=r.r,t[i++]=r.g,t[i++]=r.b}return this}copyVector2sArray(e){let t=this.array,i=0;for(let n=0,s=e.length;n<s;n++){let r=e[n];r===void 0&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",n),r=new gt),t[i++]=r.x,t[i++]=r.y}return this}copyVector3sArray(e){let t=this.array,i=0;for(let n=0,s=e.length;n<s;n++){let r=e[n];r===void 0&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",n),r=new Y),t[i++]=r.x,t[i++]=r.y,t[i++]=r.z}return this}copyVector4sArray(e){let t=this.array,i=0;for(let n=0,s=e.length;n<s;n++){let r=e[n];r===void 0&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",n),r=new Pr),t[i++]=r.x,t[i++]=r.y,t[i++]=r.z,t[i++]=r.w}return this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)Gr.fromBufferAttribute(this,t),Gr.applyMatrix3(e),this.setXY(t,Gr.x,Gr.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)tt.fromBufferAttribute(this,t),tt.applyMatrix3(e),this.setXYZ(t,tt.x,tt.y,tt.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)tt.x=this.getX(t),tt.y=this.getY(t),tt.z=this.getZ(t),tt.applyMatrix4(e),this.setXYZ(t,tt.x,tt.y,tt.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)tt.x=this.getX(t),tt.y=this.getY(t),tt.z=this.getZ(t),tt.applyNormalMatrix(e),this.setXYZ(t,tt.x,tt.y,tt.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)tt.x=this.getX(t),tt.y=this.getY(t),tt.z=this.getZ(t),tt.transformDirection(e),this.setXYZ(t,tt.x,tt.y,tt.z);return this}set(e,t=0){return this.array.set(e,t),this}getX(e){return this.array[e*this.itemSize]}setX(e,t){return this.array[e*this.itemSize]=t,this}getY(e){return this.array[e*this.itemSize+1]}setY(e,t){return this.array[e*this.itemSize+1]=t,this}getZ(e){return this.array[e*this.itemSize+2]}setZ(e,t){return this.array[e*this.itemSize+2]=t,this}getW(e){return this.array[e*this.itemSize+3]}setW(e,t){return this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this}setXYZW(e,t,i,n,s){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==w0&&(e.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(e.updateRange=this.updateRange),e}};U1.prototype.isBufferAttribute=!0;var b0=class extends U1{constructor(e,t,i){super(new Uint16Array(e),t,i)}};var M0=class extends U1{constructor(e,t,i){super(new Uint32Array(e),t,i)}},u8=class extends U1{constructor(e,t,i){super(new Uint16Array(e),t,i)}};u8.prototype.isFloat16BufferAttribute=!0;var Ci=class extends U1{constructor(e,t,i){super(new Float32Array(e),t,i)}};var f2=class{constructor(e=new Y(1/0,1/0,1/0),t=new Y(-1/0,-1/0,-1/0)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,i=1/0,n=1/0,s=-1/0,r=-1/0,a=-1/0;for(let c=0,l=e.length;c<l;c+=3){let h=e[c],f=e[c+1],u=e[c+2];h<t&&(t=h),f<i&&(i=f),u<n&&(n=u),h>s&&(s=h),f>r&&(r=f),u>a&&(a=u)}return this.min.set(t,i,n),this.max.set(s,r,a),this}setFromBufferAttribute(e){let t=1/0,i=1/0,n=1/0,s=-1/0,r=-1/0,a=-1/0;for(let c=0,l=e.count;c<l;c++){let h=e.getX(c),f=e.getY(c),u=e.getZ(c);h<t&&(t=h),f<i&&(i=f),u<n&&(n=u),h>s&&(s=h),f>r&&(r=f),u>a&&(a=u)}return this.min.set(t,i,n),this.max.set(s,r,a),this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let i=Ai.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let i=e.geometry;if(i!==void 0)if(t&&i.attributes!=null&&i.attributes.position!==void 0){let s=i.attributes.position;for(let r=0,a=s.count;r<a;r++)Ai.fromBufferAttribute(s,r).applyMatrix4(e.matrixWorld),this.expandByPoint(Ai)}else i.boundingBox===null&&i.computeBoundingBox(),z0.copy(i.boundingBox),z0.applyMatrix4(e.matrixWorld),this.union(z0);let n=e.children;for(let s=0,r=n.length;s<r;s++)this.expandByObject(n[s],t);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Ai),Ai.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(ys),qr.subVectors(this.max,ys),en.subVectors(e.a,ys),tn.subVectors(e.b,ys),nn.subVectors(e.c,ys),I2.subVectors(tn,en),k2.subVectors(nn,tn),Si.subVectors(en,nn);let t=[0,-I2.z,I2.y,0,-k2.z,k2.y,0,-Si.z,Si.y,I2.z,0,-I2.x,k2.z,0,-k2.x,Si.z,0,-Si.x,-I2.y,I2.x,0,-k2.y,k2.x,0,-Si.y,Si.x,0];return!C0(t,en,tn,nn,qr)||(t=[1,0,0,0,1,0,0,0,1],!C0(t,en,tn,nn,qr))?!1:(Wr.crossVectors(I2,k2),t=[Wr.x,Wr.y,Wr.z],C0(t,en,tn,nn,qr))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return Ai.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=this.getSize(Ai).length()*.5,e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(d2[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),d2[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),d2[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),d2[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),d2[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),d2[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),d2[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),d2[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(d2),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}};f2.prototype.isBox3=!0;var d2=[new Y,new Y,new Y,new Y,new Y,new Y,new Y,new Y],Ai=new Y,z0=new f2,en=new Y,tn=new Y,nn=new Y,I2=new Y,k2=new Y,Si=new Y,ys=new Y,qr=new Y,Wr=new Y,_i=new Y;function C0(o,e,t,i,n){for(let s=0,r=o.length-3;s<=r;s+=3){_i.fromArray(o,s);let a=n.x*Math.abs(_i.x)+n.y*Math.abs(_i.y)+n.z*Math.abs(_i.z),c=e.dot(_i),l=t.dot(_i),h=i.dot(_i);if(Math.max(-Math.max(c,l,h),Math.min(c,l,h))>a)return!1}return!0}var p2=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;let i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;let n=this._listeners[e];if(n!==void 0){let s=n.indexOf(t);s!==-1&&n.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;let i=this._listeners[e.type];if(i!==void 0){e.target=this;let n=i.slice(0);for(let s=0,r=n.length;s<r;s++)n[s].call(this,e);e.target=null}}};var Hf=new f2,f8=new Y,jr=new Y,A0=new Y,Ei=class{constructor(e=new Y,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let i=this.center;t!==void 0?i.copy(t):Hf.setFromPoints(e).getCenter(i);let n=0;for(let s=0,r=e.length;s<r;s++)n=Math.max(n,i.distanceToSquared(e[s]));return this.radius=Math.sqrt(n),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){A0.subVectors(e,this.center);let t=A0.lengthSq();if(t>this.radius*this.radius){let i=Math.sqrt(t),n=(i-this.radius)*.5;this.center.add(A0.multiplyScalar(n/i)),this.radius+=n}return this}union(e){return this.center.equals(e.center)===!0?jr.set(0,0,1).multiplyScalar(e.radius):jr.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(f8.copy(e.center).add(jr)),this.expandByPoint(f8.copy(e.center).sub(jr)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}};var Bt=class{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(e,t,i,n,s,r,a,c,l,h,f,u,d,p,v,x){let g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=n,g[1]=s,g[5]=r,g[9]=a,g[13]=c,g[2]=l,g[6]=h,g[10]=f,g[14]=u,g[3]=d,g[7]=p,g[11]=v,g[15]=x,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Bt().fromArray(this.elements)}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){let t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,i=e.elements,n=1/sn.setFromMatrixColumn(e,0).length(),s=1/sn.setFromMatrixColumn(e,1).length(),r=1/sn.setFromMatrixColumn(e,2).length();return t[0]=i[0]*n,t[1]=i[1]*n,t[2]=i[2]*n,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*r,t[9]=i[9]*r,t[10]=i[10]*r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");let t=this.elements,i=e.x,n=e.y,s=e.z,r=Math.cos(i),a=Math.sin(i),c=Math.cos(n),l=Math.sin(n),h=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){let u=r*h,d=r*f,p=a*h,v=a*f;t[0]=c*h,t[4]=-c*f,t[8]=l,t[1]=d+p*l,t[5]=u-v*l,t[9]=-a*c,t[2]=v-u*l,t[6]=p+d*l,t[10]=r*c}else if(e.order==="YXZ"){let u=c*h,d=c*f,p=l*h,v=l*f;t[0]=u+v*a,t[4]=p*a-d,t[8]=r*l,t[1]=r*f,t[5]=r*h,t[9]=-a,t[2]=d*a-p,t[6]=v+u*a,t[10]=r*c}else if(e.order==="ZXY"){let u=c*h,d=c*f,p=l*h,v=l*f;t[0]=u-v*a,t[4]=-r*f,t[8]=p+d*a,t[1]=d+p*a,t[5]=r*h,t[9]=v-u*a,t[2]=-r*l,t[6]=a,t[10]=r*c}else if(e.order==="ZYX"){let u=r*h,d=r*f,p=a*h,v=a*f;t[0]=c*h,t[4]=p*l-d,t[8]=u*l+v,t[1]=c*f,t[5]=v*l+u,t[9]=d*l-p,t[2]=-l,t[6]=a*c,t[10]=r*c}else if(e.order==="YZX"){let u=r*c,d=r*l,p=a*c,v=a*l;t[0]=c*h,t[4]=v-u*f,t[8]=p*f+d,t[1]=f,t[5]=r*h,t[9]=-a*h,t[2]=-l*h,t[6]=d*f+p,t[10]=u-v*f}else if(e.order==="XZY"){let u=r*c,d=r*l,p=a*c,v=a*l;t[0]=c*h,t[4]=-f,t[8]=l*h,t[1]=u*f+v,t[5]=r*h,t[9]=d*f-p,t[2]=p*f-d,t[6]=a*h,t[10]=v*f+u}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Vf,e,Rf)}lookAt(e,t,i){let n=this.elements;return i1.subVectors(e,t),i1.lengthSq()===0&&(i1.z=1),i1.normalize(),O2.crossVectors(i,i1),O2.lengthSq()===0&&(Math.abs(i.z)===1?i1.x+=1e-4:i1.z+=1e-4,i1.normalize(),O2.crossVectors(i,i1)),O2.normalize(),Zr.crossVectors(i1,O2),n[0]=O2.x,n[4]=Zr.x,n[8]=i1.x,n[1]=O2.y,n[5]=Zr.y,n[9]=i1.y,n[2]=O2.z,n[6]=Zr.z,n[10]=i1.z,this}multiply(e,t){return t!==void 0?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,n=t.elements,s=this.elements,r=i[0],a=i[4],c=i[8],l=i[12],h=i[1],f=i[5],u=i[9],d=i[13],p=i[2],v=i[6],x=i[10],g=i[14],m=i[3],z=i[7],y=i[11],b=i[15],S=n[0],_=n[4],A=n[8],P=n[12],R=n[1],w=n[5],D=n[9],C=n[13],V=n[2],H=n[6],T=n[10],N=n[14],I=n[3],j=n[7],O=n[11],q=n[15];return s[0]=r*S+a*R+c*V+l*I,s[4]=r*_+a*w+c*H+l*j,s[8]=r*A+a*D+c*T+l*O,s[12]=r*P+a*C+c*N+l*q,s[1]=h*S+f*R+u*V+d*I,s[5]=h*_+f*w+u*H+d*j,s[9]=h*A+f*D+u*T+d*O,s[13]=h*P+f*C+u*N+d*q,s[2]=p*S+v*R+x*V+g*I,s[6]=p*_+v*w+x*H+g*j,s[10]=p*A+v*D+x*T+g*O,s[14]=p*P+v*C+x*N+g*q,s[3]=m*S+z*R+y*V+b*I,s[7]=m*_+z*w+y*H+b*j,s[11]=m*A+z*D+y*T+b*O,s[15]=m*P+z*C+y*N+b*q,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[4],n=e[8],s=e[12],r=e[1],a=e[5],c=e[9],l=e[13],h=e[2],f=e[6],u=e[10],d=e[14],p=e[3],v=e[7],x=e[11],g=e[15];return p*(+s*c*f-n*l*f-s*a*u+i*l*u+n*a*d-i*c*d)+v*(+t*c*d-t*l*u+s*r*u-n*r*d+n*l*h-s*c*h)+x*(+t*l*f-t*a*d-s*r*f+i*r*d+s*a*h-i*l*h)+g*(-n*a*h-t*c*f+t*a*u+n*r*f-i*r*u+i*c*h)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){let n=this.elements;return e.isVector3?(n[12]=e.x,n[13]=e.y,n[14]=e.z):(n[12]=e,n[13]=t,n[14]=i),this}invert(){let e=this.elements,t=e[0],i=e[1],n=e[2],s=e[3],r=e[4],a=e[5],c=e[6],l=e[7],h=e[8],f=e[9],u=e[10],d=e[11],p=e[12],v=e[13],x=e[14],g=e[15],m=f*x*l-v*u*l+v*c*d-a*x*d-f*c*g+a*u*g,z=p*u*l-h*x*l-p*c*d+r*x*d+h*c*g-r*u*g,y=h*v*l-p*f*l+p*a*d-r*v*d-h*a*g+r*f*g,b=p*f*c-h*v*c-p*a*u+r*v*u+h*a*x-r*f*x,S=t*m+i*z+n*y+s*b;if(S===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let _=1/S;return e[0]=m*_,e[1]=(v*u*s-f*x*s-v*n*d+i*x*d+f*n*g-i*u*g)*_,e[2]=(a*x*s-v*c*s+v*n*l-i*x*l-a*n*g+i*c*g)*_,e[3]=(f*c*s-a*u*s-f*n*l+i*u*l+a*n*d-i*c*d)*_,e[4]=z*_,e[5]=(h*x*s-p*u*s+p*n*d-t*x*d-h*n*g+t*u*g)*_,e[6]=(p*c*s-r*x*s-p*n*l+t*x*l+r*n*g-t*c*g)*_,e[7]=(r*u*s-h*c*s+h*n*l-t*u*l-r*n*d+t*c*d)*_,e[8]=y*_,e[9]=(p*f*s-h*v*s-p*i*d+t*v*d+h*i*g-t*f*g)*_,e[10]=(r*v*s-p*a*s+p*i*l-t*v*l-r*i*g+t*a*g)*_,e[11]=(h*a*s-r*f*s-h*i*l+t*f*l+r*i*d-t*a*d)*_,e[12]=b*_,e[13]=(h*v*n-p*f*n+p*i*u-t*v*u-h*i*x+t*f*x)*_,e[14]=(p*a*n-r*v*n-p*i*c+t*v*c+r*i*x-t*a*x)*_,e[15]=(r*f*n-h*a*n+h*i*c-t*f*c-r*i*u+t*a*u)*_,this}scale(e){let t=this.elements,i=e.x,n=e.y,s=e.z;return t[0]*=i,t[4]*=n,t[8]*=s,t[1]*=i,t[5]*=n,t[9]*=s,t[2]*=i,t[6]*=n,t[10]*=s,t[3]*=i,t[7]*=n,t[11]*=s,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,n))}makeTranslation(e,t,i){return this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let i=Math.cos(t),n=Math.sin(t),s=1-i,r=e.x,a=e.y,c=e.z,l=s*r,h=s*a;return this.set(l*r+i,l*a-n*c,l*c+n*a,0,l*a+n*c,h*a+i,h*c-n*r,0,l*c-n*a,h*c+n*r,s*c*c+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,n,s,r){return this.set(1,i,s,0,e,1,r,0,t,n,1,0,0,0,0,1),this}compose(e,t,i){let n=this.elements,s=t._x,r=t._y,a=t._z,c=t._w,l=s+s,h=r+r,f=a+a,u=s*l,d=s*h,p=s*f,v=r*h,x=r*f,g=a*f,m=c*l,z=c*h,y=c*f,b=i.x,S=i.y,_=i.z;return n[0]=(1-(v+g))*b,n[1]=(d+y)*b,n[2]=(p-z)*b,n[3]=0,n[4]=(d-y)*S,n[5]=(1-(u+g))*S,n[6]=(x+m)*S,n[7]=0,n[8]=(p+z)*_,n[9]=(x-m)*_,n[10]=(1-(u+v))*_,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,this}decompose(e,t,i){let n=this.elements,s=sn.set(n[0],n[1],n[2]).length(),r=sn.set(n[4],n[5],n[6]).length(),a=sn.set(n[8],n[9],n[10]).length();this.determinant()<0&&(s=-s),e.x=n[12],e.y=n[13],e.z=n[14],y1.copy(this);let l=1/s,h=1/r,f=1/a;return y1.elements[0]*=l,y1.elements[1]*=l,y1.elements[2]*=l,y1.elements[4]*=h,y1.elements[5]*=h,y1.elements[6]*=h,y1.elements[8]*=f,y1.elements[9]*=f,y1.elements[10]*=f,t.setFromRotationMatrix(y1),i.x=s,i.y=r,i.z=a,this}makePerspective(e,t,i,n,s,r){r===void 0&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");let a=this.elements,c=2*s/(t-e),l=2*s/(i-n),h=(t+e)/(t-e),f=(i+n)/(i-n),u=-(r+s)/(r-s),d=-2*r*s/(r-s);return a[0]=c,a[4]=0,a[8]=h,a[12]=0,a[1]=0,a[5]=l,a[9]=f,a[13]=0,a[2]=0,a[6]=0,a[10]=u,a[14]=d,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,t,i,n,s,r){let a=this.elements,c=1/(t-e),l=1/(i-n),h=1/(r-s),f=(t+e)*c,u=(i+n)*l,d=(r+s)*h;return a[0]=2*c,a[4]=0,a[8]=0,a[12]=-f,a[1]=0,a[5]=2*l,a[9]=0,a[13]=-u,a[2]=0,a[6]=0,a[10]=-2*h,a[14]=-d,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(e){let t=this.elements,i=e.elements;for(let n=0;n<16;n++)if(t[n]!==i[n])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}};Bt.prototype.isMatrix4=!0;var sn=new Y,y1=new Bt,Vf=new Y(0,0,0),Rf=new Y(1,1,1),O2=new Y,Zr=new Y,i1=new Y;var d8=new Bt,p8=new O1,U2=class{constructor(e=0,t=0,i=0,n=U2.DefaultOrder){this._x=e,this._y=t,this._z=i,this._order=n}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,n=this._order){return this._x=e,this._y=t,this._z=i,this._order=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){let n=e.elements,s=n[0],r=n[4],a=n[8],c=n[1],l=n[5],h=n[9],f=n[2],u=n[6],d=n[10];switch(t){case"XYZ":this._y=Math.asin(Yt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-r,s)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Yt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(Yt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-f,d),this._z=Math.atan2(-r,l)):(this._y=0,this._z=Math.atan2(c,s));break;case"ZYX":this._y=Math.asin(-Yt(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(u,d),this._z=Math.atan2(c,s)):(this._x=0,this._z=Math.atan2(-r,l));break;case"YZX":this._z=Math.asin(Yt(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-Yt(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(u,l),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-h,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return d8.makeRotationFromQuaternion(e),this.setFromRotationMatrix(d8,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return p8.setFromEuler(this),this.setFromQuaternion(p8,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}toVector3(e){return e?e.set(this._x,this._y,this._z):new Y(this._x,this._y,this._z)}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}};U2.prototype.isEuler=!0;U2.DefaultOrder="XYZ";U2.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];var S0=class{constructor(){this.mask=1|0}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=4294967295|0}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!=0}isEnabled(e){return(this.mask&(1<<e|0))!=0}};var G2=class{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(e,t,i,n,s,r,a,c,l){let h=this.elements;return h[0]=e,h[1]=n,h[2]=a,h[3]=t,h[4]=s,h[5]=c,h[6]=i,h[7]=r,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,n=t.elements,s=this.elements,r=i[0],a=i[3],c=i[6],l=i[1],h=i[4],f=i[7],u=i[2],d=i[5],p=i[8],v=n[0],x=n[3],g=n[6],m=n[1],z=n[4],y=n[7],b=n[2],S=n[5],_=n[8];return s[0]=r*v+a*m+c*b,s[3]=r*x+a*z+c*S,s[6]=r*g+a*y+c*_,s[1]=l*v+h*m+f*b,s[4]=l*x+h*z+f*S,s[7]=l*g+h*y+f*_,s[2]=u*v+d*m+p*b,s[5]=u*x+d*z+p*S,s[8]=u*g+d*y+p*_,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[1],n=e[2],s=e[3],r=e[4],a=e[5],c=e[6],l=e[7],h=e[8];return t*r*h-t*a*l-i*s*h+i*a*c+n*s*l-n*r*c}invert(){let e=this.elements,t=e[0],i=e[1],n=e[2],s=e[3],r=e[4],a=e[5],c=e[6],l=e[7],h=e[8],f=h*r-a*l,u=a*c-h*s,d=l*s-r*c,p=t*f+i*u+n*d;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let v=1/p;return e[0]=f*v,e[1]=(n*l-h*i)*v,e[2]=(a*i-n*r)*v,e[3]=u*v,e[4]=(h*t-n*c)*v,e[5]=(n*s-a*t)*v,e[6]=d*v,e[7]=(i*c-l*t)*v,e[8]=(r*t-i*s)*v,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,n,s,r,a){let c=Math.cos(s),l=Math.sin(s);return this.set(i*c,i*l,-i*(c*r+l*a)+r+e,-n*l,n*c,-n*(-l*r+c*a)+a+t,0,0,1),this}scale(e,t){let i=this.elements;return i[0]*=e,i[3]*=e,i[6]*=e,i[1]*=t,i[4]*=t,i[7]*=t,this}rotate(e){let t=Math.cos(e),i=Math.sin(e),n=this.elements,s=n[0],r=n[3],a=n[6],c=n[1],l=n[4],h=n[7];return n[0]=t*s+i*c,n[3]=t*r+i*l,n[6]=t*a+i*h,n[1]=-i*s+t*c,n[4]=-i*r+t*l,n[7]=-i*a+t*h,this}translate(e,t){let i=this.elements;return i[0]+=e*i[2],i[3]+=e*i[5],i[6]+=e*i[8],i[1]+=t*i[2],i[4]+=t*i[5],i[7]+=t*i[8],this}equals(e){let t=this.elements,i=e.elements;for(let n=0;n<9;n++)if(t[n]!==i[n])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}};G2.prototype.isMatrix3=!0;var Nf=0,m8=new Y,rn=new O1,m2=new Bt,Xr=new Y,ws=new Y,Ff=new Y,Bf=new O1,g8=new Y(1,0,0),v8=new Y(0,1,0),x8=new Y(0,0,1),Pf={type:"added"},y8={type:"removed"},w1=class extends p2{constructor(){super();Object.defineProperty(this,"id",{value:Nf++}),this.uuid=u2(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=w1.DefaultUp.clone();let e=new Y,t=new U2,i=new O1,n=new Y(1,1,1);function s(){i.setFromEuler(t,!1)}function r(){t.setFromQuaternion(i,void 0,!1)}t._onChange(s),i._onChange(r),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new Bt},normalMatrix:{value:new G2}}),this.matrix=new Bt,this.matrixWorld=new Bt,this.matrixAutoUpdate=w1.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new S0,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return rn.setFromAxisAngle(e,t),this.quaternion.multiply(rn),this}rotateOnWorldAxis(e,t){return rn.setFromAxisAngle(e,t),this.quaternion.premultiply(rn),this}rotateX(e){return this.rotateOnAxis(g8,e)}rotateY(e){return this.rotateOnAxis(v8,e)}rotateZ(e){return this.rotateOnAxis(x8,e)}translateOnAxis(e,t){return m8.copy(e).applyQuaternion(this.quaternion),this.position.add(m8.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(g8,e)}translateY(e){return this.translateOnAxis(v8,e)}translateZ(e){return this.translateOnAxis(x8,e)}localToWorld(e){return e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return e.applyMatrix4(m2.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?Xr.copy(e):Xr.set(e,t,i);let n=this.parent;this.updateWorldMatrix(!0,!1),ws.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?m2.lookAt(ws,Xr,this.up):m2.lookAt(Xr,ws,this.up),this.quaternion.setFromRotationMatrix(m2),n&&(m2.extractRotation(n.matrixWorld),rn.setFromRotationMatrix(m2),this.quaternion.premultiply(rn.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(Pf)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(y8)),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){for(let e=0;e<this.children.length;e++){let t=this.children[e];t.parent=null,t.dispatchEvent(y8)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),m2.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),m2.multiply(e.parent.matrixWorld)),e.applyMatrix4(m2),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,n=this.children.length;i<n;i++){let r=this.children[i].getObjectByProperty(e,t);if(r!==void 0)return r}}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ws,e,Ff),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ws,Bf,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let i=0,n=t.length;i<n;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let i=0,n=t.length;i<n;i++)t[i].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let i=0,n=t.length;i<n;i++)t[i].updateMatrixWorld(e)}updateWorldMatrix(e,t){let i=this.parent;if(e===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){let n=this.children;for(let s=0,r=n.length;s<r;s++)n[s].updateWorldMatrix(!1,!0)}}toJSON(e){let t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});let n={};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.castShadow===!0&&(n.castShadow=!0),this.receiveShadow===!0&&(n.receiveShadow=!0),this.visible===!1&&(n.visible=!1),this.frustumCulled===!1&&(n.frustumCulled=!1),this.renderOrder!==0&&(n.renderOrder=this.renderOrder),JSON.stringify(this.userData)!=="{}"&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),this.matrixAutoUpdate===!1&&(n.matrixAutoUpdate=!1),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(n.instanceColor=this.instanceColor.toJSON()));function s(a,c){return a[c.uuid]===void 0&&(a[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&(n.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.geometry=s(e.geometries,this.geometry);let a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){let c=a.shapes;if(Array.isArray(c))for(let l=0,h=c.length;l<h;l++){let f=c[l];s(e.shapes,f)}else s(e.shapes,c)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let a=[];for(let c=0,l=this.material.length;c<l;c++)a.push(s(e.materials,this.material[c]));n.material=a}else n.material=s(e.materials,this.material);if(this.children.length>0){n.children=[];for(let a=0;a<this.children.length;a++)n.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){n.animations=[];for(let a=0;a<this.animations.length;a++){let c=this.animations[a];n.animations.push(s(e.animations,c))}}if(t){let a=r(e.geometries),c=r(e.materials),l=r(e.textures),h=r(e.images),f=r(e.shapes),u=r(e.skeletons),d=r(e.animations);a.length>0&&(i.geometries=a),c.length>0&&(i.materials=c),l.length>0&&(i.textures=l),h.length>0&&(i.images=h),f.length>0&&(i.shapes=f),u.length>0&&(i.skeletons=u),d.length>0&&(i.animations=d)}return i.object=n,i;function r(a){let c=[];for(let l in a){let h=a[l];delete h.metadata,c.push(h)}return c}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i<e.children.length;i++){let n=e.children[i];this.add(n.clone())}return this}};w1.DefaultUp=new Y(0,1,0);w1.DefaultMatrixAutoUpdate=!0;w1.prototype.isObject3D=!0;function w8(o){for(let e=o.length-1;e>=0;--e)if(o[e]>65535)return!0;return!1}function _0(o){return document.createElementNS("http://www.w3.org/1999/xhtml",o)}var If=0,u1=new Bt,E0=new w1,an=new Y,n1=new f2,bs=new f2,Lt=new Y,q2=class extends p2{constructor(){super();Object.defineProperty(this,"id",{value:If++}),this.uuid=u2(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(w8(e)?M0:b0)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let i=this.attributes.normal;if(i!==void 0){let s=new G2().getNormalMatrix(e);i.applyNormalMatrix(s),i.needsUpdate=!0}let n=this.attributes.tangent;return n!==void 0&&(n.transformDirection(e),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return u1.makeRotationFromQuaternion(e),this.applyMatrix4(u1),this}rotateX(e){return u1.makeRotationX(e),this.applyMatrix4(u1),this}rotateY(e){return u1.makeRotationY(e),this.applyMatrix4(u1),this}rotateZ(e){return u1.makeRotationZ(e),this.applyMatrix4(u1),this}translate(e,t,i){return u1.makeTranslation(e,t,i),this.applyMatrix4(u1),this}scale(e,t,i){return u1.makeScale(e,t,i),this.applyMatrix4(u1),this}lookAt(e){return E0.lookAt(e),E0.updateMatrix(),this.applyMatrix4(E0.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(an).negate(),this.translate(an.x,an.y,an.z),this}setFromPoints(e){let t=[];for(let i=0,n=e.length;i<n;i++){let s=e[i];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new Ci(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new f2);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingBox.set(new Y(-1/0,-1/0,-1/0),new Y(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,n=t.length;i<n;i++){let s=t[i];n1.setFromBufferAttribute(s),this.morphTargetsRelative?(Lt.addVectors(this.boundingBox.min,n1.min),this.boundingBox.expandByPoint(Lt),Lt.addVectors(this.boundingBox.max,n1.max),this.boundingBox.expandByPoint(Lt)):(this.boundingBox.expandByPoint(n1.min),this.boundingBox.expandByPoint(n1.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Ei);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingSphere.set(new Y,1/0);return}if(e){let i=this.boundingSphere.center;if(n1.setFromBufferAttribute(e),t)for(let s=0,r=t.length;s<r;s++){let a=t[s];bs.setFromBufferAttribute(a),this.morphTargetsRelative?(Lt.addVectors(n1.min,bs.min),n1.expandByPoint(Lt),Lt.addVectors(n1.max,bs.max),n1.expandByPoint(Lt)):(n1.expandByPoint(bs.min),n1.expandByPoint(bs.max))}n1.getCenter(i);let n=0;for(let s=0,r=e.count;s<r;s++)Lt.fromBufferAttribute(e,s),n=Math.max(n,i.distanceToSquared(Lt));if(t)for(let s=0,r=t.length;s<r;s++){let a=t[s],c=this.morphTargetsRelative;for(let l=0,h=a.count;l<h;l++)Lt.fromBufferAttribute(a,l),c&&(an.fromBufferAttribute(e,l),Lt.add(an)),n=Math.max(n,i.distanceToSquared(Lt))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let i=e.array,n=t.position.array,s=t.normal.array,r=t.uv.array,a=n.length/3;t.tangent===void 0&&this.setAttribute("tangent",new U1(new Float32Array(4*a),4));let c=t.tangent.array,l=[],h=[];for(let R=0;R<a;R++)l[R]=new Y,h[R]=new Y;let f=new Y,u=new Y,d=new Y,p=new gt,v=new gt,x=new gt,g=new Y,m=new Y;function z(R,w,D){f.fromArray(n,R*3),u.fromArray(n,w*3),d.fromArray(n,D*3),p.fromArray(r,R*2),v.fromArray(r,w*2),x.fromArray(r,D*2),u.sub(f),d.sub(f),v.sub(p),x.sub(p);let C=1/(v.x*x.y-x.x*v.y);!isFinite(C)||(g.copy(u).multiplyScalar(x.y).addScaledVector(d,-v.y).multiplyScalar(C),m.copy(d).multiplyScalar(v.x).addScaledVector(u,-x.x).multiplyScalar(C),l[R].add(g),l[w].add(g),l[D].add(g),h[R].add(m),h[w].add(m),h[D].add(m))}let y=this.groups;y.length===0&&(y=[{start:0,count:i.length}]);for(let R=0,w=y.length;R<w;++R){let D=y[R],C=D.start,V=D.count;for(let H=C,T=C+V;H<T;H+=3)z(i[H+0],i[H+1],i[H+2])}let b=new Y,S=new Y,_=new Y,A=new Y;function P(R){_.fromArray(s,R*3),A.copy(_);let w=l[R];b.copy(w),b.sub(_.multiplyScalar(_.dot(w))).normalize(),S.crossVectors(A,w);let C=S.dot(h[R])<0?-1:1;c[R*4]=b.x,c[R*4+1]=b.y,c[R*4+2]=b.z,c[R*4+3]=C}for(let R=0,w=y.length;R<w;++R){let D=y[R],C=D.start,V=D.count;for(let H=C,T=C+V;H<T;H+=3)P(i[H+0]),P(i[H+1]),P(i[H+2])}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new U1(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let u=0,d=i.count;u<d;u++)i.setXYZ(u,0,0,0);let n=new Y,s=new Y,r=new Y,a=new Y,c=new Y,l=new Y,h=new Y,f=new Y;if(e)for(let u=0,d=e.count;u<d;u+=3){let p=e.getX(u+0),v=e.getX(u+1),x=e.getX(u+2);n.fromBufferAttribute(t,p),s.fromBufferAttribute(t,v),r.fromBufferAttribute(t,x),h.subVectors(r,s),f.subVectors(n,s),h.cross(f),a.fromBufferAttribute(i,p),c.fromBufferAttribute(i,v),l.fromBufferAttribute(i,x),a.add(h),c.add(h),l.add(h),i.setXYZ(p,a.x,a.y,a.z),i.setXYZ(v,c.x,c.y,c.z),i.setXYZ(x,l.x,l.y,l.z)}else for(let u=0,d=t.count;u<d;u+=3)n.fromBufferAttribute(t,u+0),s.fromBufferAttribute(t,u+1),r.fromBufferAttribute(t,u+2),h.subVectors(r,s),f.subVectors(n,s),h.cross(f),i.setXYZ(u+0,h.x,h.y,h.z),i.setXYZ(u+1,h.x,h.y,h.z),i.setXYZ(u+2,h.x,h.y,h.z);this.normalizeNormals(),i.needsUpdate=!0}}merge(e,t){if(!(e&&e.isBufferGeometry)){console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e);return}t===void 0&&(t=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));let i=this.attributes;for(let n in i){if(e.attributes[n]===void 0)continue;let r=i[n].array,a=e.attributes[n],c=a.array,l=a.itemSize*t,h=Math.min(c.length,r.length-l);for(let f=0,u=l;f<h;f++,u++)r[u]=c[f]}return this}normalizeNormals(){let e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)Lt.fromBufferAttribute(e,t),Lt.normalize(),e.setXYZ(t,Lt.x,Lt.y,Lt.z)}toNonIndexed(){function e(a,c){let l=a.array,h=a.itemSize,f=a.normalized,u=new l.constructor(c.length*h),d=0,p=0;for(let v=0,x=c.length;v<x;v++){a.isInterleavedBufferAttribute?d=c[v]*a.data.stride+a.offset:d=c[v]*h;for(let g=0;g<h;g++)u[p++]=l[d++]}return new U1(u,h,f)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new q2,i=this.index.array,n=this.attributes;for(let a in n){let c=n[a],l=e(c,i);t.setAttribute(a,l)}let s=this.morphAttributes;for(let a in s){let c=[],l=s[a];for(let h=0,f=l.length;h<f;h++){let u=l[h],d=e(u,i);c.push(d)}t.morphAttributes[a]=c}t.morphTargetsRelative=this.morphTargetsRelative;let r=this.groups;for(let a=0,c=r.length;a<c;a++){let l=r[a];t.addGroup(l.start,l.count,l.materialIndex)}return t}toJSON(){let e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){let c=this.parameters;for(let l in c)c[l]!==void 0&&(e[l]=c[l]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let i=this.attributes;for(let c in i){let l=i[c];e.data.attributes[c]=l.toJSON(e.data)}let n={},s=!1;for(let c in this.morphAttributes){let l=this.morphAttributes[c],h=[];for(let f=0,u=l.length;f<u;f++){let d=l[f];h.push(d.toJSON(e.data))}h.length>0&&(n[c]=h,s=!0)}s&&(e.data.morphAttributes=n,e.data.morphTargetsRelative=this.morphTargetsRelative);let r=this.groups;r.length>0&&(e.data.groups=JSON.parse(JSON.stringify(r)));let a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let i=e.index;i!==null&&this.setIndex(i.clone(t));let n=e.attributes;for(let l in n){let h=n[l];this.setAttribute(l,h.clone(t))}let s=e.morphAttributes;for(let l in s){let h=[],f=s[l];for(let u=0,d=f.length;u<d;u++)h.push(f[u].clone(t));this.morphAttributes[l]=h}this.morphTargetsRelative=e.morphTargetsRelative;let r=e.groups;for(let l=0,h=r.length;l<h;l++){let f=r[l];this.addGroup(f.start,f.count,f.materialIndex)}let a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());let c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,e.parameters!==void 0&&(this.parameters=Object.assign({},e.parameters)),this}dispose(){this.dispatchEvent({type:"dispose"})}};q2.prototype.isBufferGeometry=!0;var kf=0,on=class extends p2{constructor(){super();Object.defineProperty(this,"id",{value:kf++}),this.uuid=u2(),this.name="",this.type="Material",this.fog=!0,this.blending=g0,this.side=m0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=t8,this.blendDst=i8,this.blendEquation=e8,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=n8,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=h8,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ur,this.stencilZFail=Ur,this.stencilZPass=Ur,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.alphaWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let i=e[t];if(i===void 0){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}if(t==="shading"){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=i===Kc;continue}let n=this[t];if(n===void 0){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[t]=i}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==g0&&(i.blending=this.blending),this.side!==m0&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.alphaWrite=this.alphaWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,this.rotation&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(i.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=this.flatShading),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),JSON.stringify(this.userData)!=="{}"&&(i.userData=this.userData);function n(s){let r=[];for(let a in s){let c=s[a];delete c.metadata,r.push(c)}return r}if(t){let s=n(e.textures),r=n(e.images);s.length>0&&(i.textures=s),r.length>0&&(i.images=r)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,i=null;if(t!==null){let n=t.length;i=new Array(n);for(let s=0;s!==n;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.alphaWrite=e.alphaWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}};on.prototype.isMaterial=!0;var Ms=class extends on{constructor(e){super();this.type="MeshPhongMaterial",this.color=new $t(16777215),this.specular=new $t(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new $t(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=l8,this.normalScale=new gt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Or,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this}};Ms.prototype.isMeshPhongMaterial=!0;var g2=new Y,L0=new Y,Yr=new Y,W2=new Y,T0=new Y,$r=new Y,D0=new Y,H0=class{constructor(e=new Y,t=new Y(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,g2)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(i).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=g2.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(g2.copy(this.direction).multiplyScalar(t).add(this.origin),g2.distanceToSquared(e))}distanceSqToSegment(e,t,i,n){L0.copy(e).add(t).multiplyScalar(.5),Yr.copy(t).sub(e).normalize(),W2.copy(this.origin).sub(L0);let s=e.distanceTo(t)*.5,r=-this.direction.dot(Yr),a=W2.dot(this.direction),c=-W2.dot(Yr),l=W2.lengthSq(),h=Math.abs(1-r*r),f,u,d,p;if(h>0)if(f=r*c-a,u=r*a-c,p=s*h,f>=0)if(u>=-p)if(u<=p){let v=1/h;f*=v,u*=v,d=f*(f+r*u+2*a)+u*(r*f+u+2*c)+l}else u=s,f=Math.max(0,-(r*u+a)),d=-f*f+u*(u+2*c)+l;else u=-s,f=Math.max(0,-(r*u+a)),d=-f*f+u*(u+2*c)+l;else u<=-p?(f=Math.max(0,-(-r*s+a)),u=f>0?-s:Math.min(Math.max(-s,-c),s),d=-f*f+u*(u+2*c)+l):u<=p?(f=0,u=Math.min(Math.max(-s,-c),s),d=u*(u+2*c)+l):(f=Math.max(0,-(r*s+a)),u=f>0?s:Math.min(Math.max(-s,-c),s),d=-f*f+u*(u+2*c)+l);else u=r>0?-s:s,f=Math.max(0,-(r*u+a)),d=-f*f+u*(u+2*c)+l;return i&&i.copy(this.direction).multiplyScalar(f).add(this.origin),n&&n.copy(Yr).multiplyScalar(u).add(L0),d}intersectSphere(e,t){g2.subVectors(e.center,this.origin);let i=g2.dot(this.direction),n=g2.dot(g2)-i*i,s=e.radius*e.radius;if(n>s)return null;let r=Math.sqrt(s-n),a=i-r,c=i+r;return a<0&&c<0?null:a<0?this.at(c,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){let i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,n,s,r,a,c,l=1/this.direction.x,h=1/this.direction.y,f=1/this.direction.z,u=this.origin;return l>=0?(i=(e.min.x-u.x)*l,n=(e.max.x-u.x)*l):(i=(e.max.x-u.x)*l,n=(e.min.x-u.x)*l),h>=0?(s=(e.min.y-u.y)*h,r=(e.max.y-u.y)*h):(s=(e.max.y-u.y)*h,r=(e.min.y-u.y)*h),i>r||s>n||((s>i||i!==i)&&(i=s),(r<n||n!==n)&&(n=r),f>=0?(a=(e.min.z-u.z)*f,c=(e.max.z-u.z)*f):(a=(e.max.z-u.z)*f,c=(e.min.z-u.z)*f),i>c||a>n)||((a>i||i!==i)&&(i=a),(c<n||n!==n)&&(n=c),n<0)?null:this.at(i>=0?i:n,t)}intersectsBox(e){return this.intersectBox(e,g2)!==null}intersectTriangle(e,t,i,n,s){T0.subVectors(t,e),$r.subVectors(i,e),D0.crossVectors(T0,$r);let r=this.direction.dot(D0),a;if(r>0){if(n)return null;a=1}else if(r<0)a=-1,r=-r;else return null;W2.subVectors(this.origin,e);let c=a*this.direction.dot($r.crossVectors(W2,$r));if(c<0)return null;let l=a*this.direction.dot(T0.cross(W2));if(l<0||c+l>r)return null;let h=-a*W2.dot(D0);return h<0?null:this.at(h/r,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}};var b1=new Y,v2=new Y,V0=new Y,x2=new Y,cn=new Y,ln=new Y,b8=new Y,R0=new Y,N0=new Y,F0=new Y,M1=class{constructor(e=new Y,t=new Y,i=new Y){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,n){n.subVectors(i,t),b1.subVectors(e,t),n.cross(b1);let s=n.lengthSq();return s>0?n.multiplyScalar(1/Math.sqrt(s)):n.set(0,0,0)}static getBarycoord(e,t,i,n,s){b1.subVectors(n,t),v2.subVectors(i,t),V0.subVectors(e,t);let r=b1.dot(b1),a=b1.dot(v2),c=b1.dot(V0),l=v2.dot(v2),h=v2.dot(V0),f=r*l-a*a;if(f===0)return s.set(-2,-1,-1);let u=1/f,d=(l*c-a*h)*u,p=(r*h-a*c)*u;return s.set(1-d-p,p,d)}static containsPoint(e,t,i,n){return this.getBarycoord(e,t,i,n,x2),x2.x>=0&&x2.y>=0&&x2.x+x2.y<=1}static getUV(e,t,i,n,s,r,a,c){return this.getBarycoord(e,t,i,n,x2),c.set(0,0),c.addScaledVector(s,x2.x),c.addScaledVector(r,x2.y),c.addScaledVector(a,x2.z),c}static isFrontFacing(e,t,i,n){return b1.subVectors(i,t),v2.subVectors(e,t),b1.cross(v2).dot(n)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,n){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[n]),this}setFromAttributeAndIndices(e,t,i,n){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return b1.subVectors(this.c,this.b),v2.subVectors(this.a,this.b),b1.cross(v2).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return M1.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return M1.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,n,s){return M1.getUV(e,this.a,this.b,this.c,t,i,n,s)}containsPoint(e){return M1.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return M1.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let i=this.a,n=this.b,s=this.c,r,a;cn.subVectors(n,i),ln.subVectors(s,i),R0.subVectors(e,i);let c=cn.dot(R0),l=ln.dot(R0);if(c<=0&&l<=0)return t.copy(i);N0.subVectors(e,n);let h=cn.dot(N0),f=ln.dot(N0);if(h>=0&&f<=h)return t.copy(n);let u=c*f-h*l;if(u<=0&&c>=0&&h<=0)return r=c/(c-h),t.copy(i).addScaledVector(cn,r);F0.subVectors(e,s);let d=cn.dot(F0),p=ln.dot(F0);if(p>=0&&d<=p)return t.copy(s);let v=d*l-c*p;if(v<=0&&l>=0&&p<=0)return a=l/(l-p),t.copy(i).addScaledVector(ln,a);let x=h*p-d*f;if(x<=0&&f-h>=0&&d-p>=0)return b8.subVectors(s,n),a=(f-h)/(f-h+(d-p)),t.copy(n).addScaledVector(b8,a);let g=1/(x+v+u);return r=v*g,a=u*g,t.copy(i).addScaledVector(cn,r).addScaledVector(ln,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}};var Jr=class extends on{constructor(e){super();this.type="MeshBasicMaterial",this.color=new $t(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Or,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}};Jr.prototype.isMeshBasicMaterial=!0;var M8=new Bt,hn=new H0,B0=new Ei,j2=new Y,Z2=new Y,X2=new Y,P0=new Y,I0=new Y,k0=new Y,Qr=new Y,Kr=new Y,ea=new Y,ta=new gt,ia=new gt,na=new gt,O0=new Y,sa=new Y,ra=class extends w1{constructor(e=new q2,t=new Jr){super();this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry;if(e.isBufferGeometry){let t=e.morphAttributes,i=Object.keys(t);if(i.length>0){let n=t[i[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,r=n.length;s<r;s++){let a=n[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}else{let t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(e,t){let i=this.geometry,n=this.material,s=this.matrixWorld;if(n===void 0||(i.boundingSphere===null&&i.computeBoundingSphere(),B0.copy(i.boundingSphere),B0.applyMatrix4(s),e.ray.intersectsSphere(B0)===!1)||(M8.copy(s).invert(),hn.copy(e.ray).applyMatrix4(M8),i.boundingBox!==null&&hn.intersectsBox(i.boundingBox)===!1))return;let r;if(i.isBufferGeometry){let a=i.index,c=i.attributes.position,l=i.morphAttributes.position,h=i.morphTargetsRelative,f=i.attributes.uv,u=i.attributes.uv2,d=i.groups,p=i.drawRange;if(a!==null)if(Array.isArray(n))for(let v=0,x=d.length;v<x;v++){let g=d[v],m=n[g.materialIndex],z=Math.max(g.start,p.start),y=Math.min(a.count,Math.min(g.start+g.count,p.start+p.count));for(let b=z,S=y;b<S;b+=3){let _=a.getX(b),A=a.getX(b+1),P=a.getX(b+2);r=aa(this,m,e,hn,c,l,h,f,u,_,A,P),r&&(r.faceIndex=Math.floor(b/3),r.face.materialIndex=g.materialIndex,t.push(r))}}else{let v=Math.max(0,p.start),x=Math.min(a.count,p.start+p.count);for(let g=v,m=x;g<m;g+=3){let z=a.getX(g),y=a.getX(g+1),b=a.getX(g+2);r=aa(this,n,e,hn,c,l,h,f,u,z,y,b),r&&(r.faceIndex=Math.floor(g/3),t.push(r))}}else if(c!==void 0)if(Array.isArray(n))for(let v=0,x=d.length;v<x;v++){let g=d[v],m=n[g.materialIndex],z=Math.max(g.start,p.start),y=Math.min(c.count,Math.min(g.start+g.count,p.start+p.count));for(let b=z,S=y;b<S;b+=3){let _=b,A=b+1,P=b+2;r=aa(this,m,e,hn,c,l,h,f,u,_,A,P),r&&(r.faceIndex=Math.floor(b/3),r.face.materialIndex=g.materialIndex,t.push(r))}}else{let v=Math.max(0,p.start),x=Math.min(c.count,p.start+p.count);for(let g=v,m=x;g<m;g+=3){let z=g,y=g+1,b=g+2;r=aa(this,n,e,hn,c,l,h,f,u,z,y,b),r&&(r.faceIndex=Math.floor(g/3),t.push(r))}}}else i.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}};ra.prototype.isMesh=!0;function Of(o,e,t,i,n,s,r,a){let c;if(e.side===Jc?c=i.intersectTriangle(r,s,n,!0,a):c=i.intersectTriangle(n,s,r,e.side!==Qc,a),c===null)return null;sa.copy(a),sa.applyMatrix4(o.matrixWorld);let l=t.ray.origin.distanceTo(sa);return l<t.near||l>t.far?null:{distance:l,point:sa.clone(),object:o}}function aa(o,e,t,i,n,s,r,a,c,l,h,f){j2.fromBufferAttribute(n,l),Z2.fromBufferAttribute(n,h),X2.fromBufferAttribute(n,f);let u=o.morphTargetInfluences;if(s&&u){Qr.set(0,0,0),Kr.set(0,0,0),ea.set(0,0,0);for(let p=0,v=s.length;p<v;p++){let x=u[p],g=s[p];x!==0&&(P0.fromBufferAttribute(g,l),I0.fromBufferAttribute(g,h),k0.fromBufferAttribute(g,f),r?(Qr.addScaledVector(P0,x),Kr.addScaledVector(I0,x),ea.addScaledVector(k0,x)):(Qr.addScaledVector(P0.sub(j2),x),Kr.addScaledVector(I0.sub(Z2),x),ea.addScaledVector(k0.sub(X2),x)))}j2.add(Qr),Z2.add(Kr),X2.add(ea)}o.isSkinnedMesh&&(o.boneTransform(l,j2),o.boneTransform(h,Z2),o.boneTransform(f,X2));let d=Of(o,e,t,i,j2,Z2,X2,O0);if(d){a&&(ta.fromBufferAttribute(a,l),ia.fromBufferAttribute(a,h),na.fromBufferAttribute(a,f),d.uv=M1.getUV(O0,j2,Z2,X2,ta,ia,na,new gt)),c&&(ta.fromBufferAttribute(c,l),ia.fromBufferAttribute(c,h),na.fromBufferAttribute(c,f),d.uv2=M1.getUV(O0,j2,Z2,X2,ta,ia,na,new gt));let p={a:l,b:h,c:f,normal:new Y,materialIndex:0};M1.getNormal(j2,Z2,X2,p.normal),d.face=p}return d}var un,U0=class{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement=="undefined")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{un===void 0&&(un=_0("canvas")),un.width=e.width,un.height=e.height;let i=un.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=un}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement!="undefined"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&e instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&e instanceof ImageBitmap){let t=_0("canvas");t.width=e.width,t.height=e.height;let i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);let n=i.getImageData(0,0,e.width,e.height),s=n.data;for(let r=0;r<s.length;r++)s[r]=zi(s[r]/255)*255;return i.putImageData(n,0,0),t}else if(e.data){let t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(zi(t[i]/255)*255):t[i]=zi(t[i]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}};var Uf=0,G1=class extends p2{constructor(e=G1.DEFAULT_IMAGE,t=G1.DEFAULT_MAPPING,i=xs,n=xs,s=s8,r=r8,a=o8,c=a8,l=1,h=c8){super();Object.defineProperty(this,"id",{value:Uf++}),this.uuid=u2(),this.name="",this.image=e,this.mipmaps=[],this.mapping=t,this.wrapS=i,this.wrapT=n,this.magFilter=s,this.minFilter=r,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=c,this.offset=new gt(0,0),this.repeat=new gt(1,1),this.center=new gt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new G2,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=h,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this.userData=JSON.parse(JSON.stringify(e.userData)),this}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let i={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(this.image!==void 0){let n=this.image;if(n.uuid===void 0&&(n.uuid=u2()),!t&&e.images[n.uuid]===void 0){let s;if(Array.isArray(n)){s=[];for(let r=0,a=n.length;r<a;r++)n[r].isDataTexture?s.push(G0(n[r].image)):s.push(G0(n[r]))}else s=G0(n);e.images[n.uuid]={uuid:n.uuid,url:s}}i.image=n.uuid}return JSON.stringify(this.userData)!=="{}"&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==v0)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case x0:e.x=e.x-Math.floor(e.x);break;case xs:e.x=e.x<0?0:1;break;case y0:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case x0:e.y=e.y-Math.floor(e.y);break;case xs:e.y=e.y<0?0:1;break;case y0:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&this.version++}};G1.DEFAULT_IMAGE=void 0;G1.DEFAULT_MAPPING=v0;G1.prototype.isTexture=!0;function G0(o){return typeof HTMLImageElement!="undefined"&&o instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&o instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&o instanceof ImageBitmap?U0.getDataURL(o):o.data?{data:Array.prototype.slice.call(o.data),width:o.width,height:o.height,type:o.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var z8={specular:1515554,color:15790320,shininess:60,flatShading:!0},Y2={diceColor:"#202020",textColor:"#ffffff"},z1=class{constructor(e,t,i={diceColor:"#202020",textColor:"#aaaaaa"},n){this.w=e;this.h=t;this.options=i;this.scaler=n;this.scale=50;this.labels=[" ","0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20"];this.fontFace="Arial";this.options={...Y2,...i}}setColor({diceColor:e,textColor:t}){e&&(this.options.diceColor=e),t&&(this.options.textColor=t)}get radius(){return this.scale*this.scaleFactor*(this.scaler??1)}get diceColor(){return this.options.diceColor}get textColor(){return this.options.textColor}get buffer(){return this.geometry.geometry}create(){this.textureSize=this.calculateTextureSize(this.scale/2+this.scale*this.margin)*2;let e=this.getGeometry(),t=this.getMaterials();return this.geometry=new ra(e,t),this.geometry.receiveShadow=!0,this.geometry.castShadow=!0,this.body.position.set(0+this.radius*2*Math.random(),0+this.radius*2*Math.random(),0+this.radius*4),this.body.velocity.x=500*Math.random()*2-1,this.body.velocity.y=500*Math.random()*2-1,this.body.angularVelocity.x=100*Math.random(),this.body.angularVelocity.y=100*Math.random(),this}getGeometry(){let e=new Array(this.vertices.length);for(let i=0;i<this.vertices.length;++i)e[i]=new Y().fromArray(this.vertices[i]).normalize();this.chamferGeometry=this.getChamferGeometry(e);let t=this.makeGeometry(this.chamferGeometry.vectors,this.chamferGeometry.faces);return this.shape=this.makeShape(e),this.body=new ae({mass:this.mass,shape:this.shape}),t}makeShape(e){let t=new Array(e.length),i=new Array(this.faces.length);for(let n=0;n<e.length;++n){let s=e[n];t[n]=new M(s.x*this.radius,s.y*this.radius,s.z*this.radius)}for(let n=0;n<this.faces.length;++n)i[n]=this.faces[n].slice(0,this.faces[n].length-1);return this.shapeData={vertices:t,faces:i},new F2({vertices:t,faces:i})}getChamferGeometry(e){let t=[],i=[],n=new Array(e.length);for(let s=0;s<e.length;++s)n[s]=[];for(let s=0;s<this.faces.length;++s){let r=this.faces[s],a=r.length-1,c=new Y,l=new Array(a);for(let h=0;h<a;++h){let f=e[r[h]].clone();c.add(f),n[r[h]].push(l[h]=t.push(f)-1)}c.divideScalar(a);for(let h=0;h<a;++h){let f=t[l[h]];f.subVectors(f,c).multiplyScalar(this.chamfer).addVectors(f,c)}l.push(r[a]),i.push(l)}for(let s=0;s<this.faces.length-1;++s)for(let r=s+1;r<this.faces.length;++r){let a=[],c=-1;for(let l=0;l<this.faces[s].length-1;++l){let h=this.faces[r].indexOf(this.faces[s][l]);h>=0&&h<this.faces[r].length-1&&(c>=0&&l!==c+1?a.unshift([s,l],[r,h]):a.push([s,l],[r,h]),c=l)}a.length===4&&i.push([i[a[0][0]][a[0][1]],i[a[1][0]][a[1][1]],i[a[3][0]][a[3][1]],i[a[2][0]][a[2][1]],-1])}for(let s=0;s<n.length;++s){let r=n[s],a=[r[0]],c=r.length-1;for(;c;){for(let l=this.faces.length;l<i.length;++l){let h=i[l].indexOf(a[a.length-1]);if(h>=0&&h<4){--h==-1&&(h=3);let f=i[l][h];if(r.indexOf(f)>=0){a.push(f);break}}}--c}a.push(-1),i.push(a)}return{vectors:t,faces:i}}makeGeometry(e,t){let i=new q2;for(let f=0;f<e.length;++f)e[f]=e[f].multiplyScalar(this.radius);let n=[],s=[],r=[],a=new Y,c=new Y,l,h=0;for(let f=0;f<t.length;++f){let u=t[f],d=u.length-1,p=Math.PI*2/d;l=u[d]+1;for(let x=0;x<d-2;++x)n.push(...e[u[0]].toArray()),n.push(...e[u[x+1]].toArray()),n.push(...e[u[x+2]].toArray()),a.subVectors(e[u[x+2]],e[u[x+1]]),c.subVectors(e[u[0]],e[u[x+1]]),a.cross(c),a.normalize(),s.push(...a.toArray()),s.push(...a.toArray()),s.push(...a.toArray()),r.push((Math.cos(this.af)+1+this.tab)/2/(1+this.tab),(Math.sin(this.af)+1+this.tab)/2/(1+this.tab)),r.push((Math.cos(p*(x+1)+this.af)+1+this.tab)/2/(1+this.tab),(Math.sin(p*(x+1)+this.af)+1+this.tab)/2/(1+this.tab)),r.push((Math.cos(p*(x+2)+this.af)+1+this.tab)/2/(1+this.tab),(Math.sin(p*(x+2)+this.af)+1+this.tab)/2/(1+this.tab));let v=(d-2)*3;for(let x=0;x<v/3;x++)i.addGroup(h,3,l),h+=3}return i.setAttribute("position",new Ci(n,3)),i.setAttribute("normal",new Ci(s,3)),i.setAttribute("uv",new Ci(r,2)),i.boundingSphere=new Ei(new Y,this.radius),i}getMaterials(){let e=[];for(let t=0;t<this.labels.length;t++){let i=this.createTextTexture(t);e.push(new Ms(Object.assign({},z8,{map:i})))}return e}calculateTextureSize(e){return Math.max(128,Math.pow(2,Math.floor(Math.log(e)/Math.log(2))))}createTextTexture(e){let t=this.labels[e];if(t==null)return null;let i=createEl("canvas");i.width=i.height=this.textureSize;let n=i.height/2,s=i.width/2,{context:r,fontsize:a}=this.getContext(i),c=r.measureText("M").width*1.4,l=t.split(`
|
|
`);l.length>1&&(a=a/l.length,r.font=`${a}pt '${this.fontFace}'`,c=r.measureText("M").width*1.2,n-=c*l.length/2);for(let f=0,u=l.length;f<u;f++){let d=l[f].trim();r.fillText(l[f],s,n),(d=="6"||d=="9")&&r.fillText(" .",s,n),n+=c*1.5}let h=new G1(i);return h.needsUpdate=!0,i.detach(),h}getContext(e){let t=e.getContext("2d",{alpha:!0});t.clearRect(0,0,e.width,e.height);let i=e.width/(1+2*this.margin);return this.sides==100&&(i*=.75),t.font=`${i}pt '${this.fontFace}'`,t.fillStyle=this.diceColor,t.fillRect(0,0,e.width,e.height),t.textAlign="center",t.textBaseline="middle",(this.sides==10||this.sides==100)&&(t.translate(e.width/2,e.height/2),t.rotate(60*Math.PI/180),t.translate(-e.width/2,-e.height/2)),t.fillStyle=this.textColor,{context:t,fontsize:i}}clone(){return{body:new ae({mass:this.mass,shape:this.shape}),geometry:this.geometry.clone(),values:this.values}}},q0=class extends z1{constructor(e,t,i={diceColor:"#171120",textColor:"#FF0000"},n){super(e,t,i,n);this.sides=20;this.tab=-.2;this.af=-Math.PI/4/2;this.chamfer=.955;this.vertices=[];this.faces=[[0,11,5,1],[0,5,1,2],[0,1,7,3],[0,7,10,4],[0,10,11,5],[1,5,9,6],[5,11,4,7],[11,10,2,8],[10,7,6,9],[7,1,8,10],[3,9,4,11],[3,4,2,12],[3,2,6,13],[3,6,8,14],[3,8,9,15],[4,9,5,16],[2,4,11,17],[6,2,10,18],[8,6,7,19],[9,8,1,20]];this.scaleFactor=1;this.values=[...Array(20).keys()];this.margin=1;this.mass=400;let s=(1+Math.sqrt(5))/2;this.vertices=[[-1,s,0],[1,s,0],[-1,-s,0],[1,-s,0],[0,-1,s],[0,1,s],[0,-1,-s],[0,1,-s],[s,0,-1],[s,0,1],[-s,0,-1],[-s,0,1]]}},W0=class extends z1{constructor(e,t,i={diceColor:"#7339BE",textColor:"#FFFFFF"},n){super(e,t,i,n);this.mass=350;this.sides=12;this.tab=.2;this.af=-Math.PI/4/2;this.chamfer=.968;this.vertices=[];this.faces=[[2,14,4,12,0,1],[15,9,11,19,3,2],[16,10,17,7,6,3],[6,7,19,11,18,4],[6,18,2,0,16,5],[18,11,9,14,2,6],[1,17,10,8,13,7],[1,13,5,15,3,8],[13,8,12,4,5,9],[5,4,14,9,15,10],[0,12,8,10,16,11],[3,19,7,17,1,12]];this.scaleFactor=.9;this.values=[...Array(12).keys()];this.margin=1;let s=(1+Math.sqrt(5))/2,r=1/s;this.vertices=[[0,r,s],[0,r,-s],[0,-r,s],[0,-r,-s],[s,0,r],[s,0,-r],[-s,0,r],[-s,0,-r],[r,s,0],[r,-s,0],[-r,s,0],[-r,-s,0],[1,1,1],[1,1,-1],[1,-1,1],[1,-1,-1],[-1,1,1],[-1,1,-1],[-1,-1,1],[-1,-1,-1]]}},j0=class extends z1{constructor(e,t,i={diceColor:"#c74749",textColor:"#FFFFFF"},n){super(e,t,i,n);this.mass=350;this.sides=10;this.tab=0;this.af=-Math.PI*6/5;this.chamfer=.945;this.vertices=[];this.faces=[[5,7,11,0],[4,2,10,1],[1,3,11,2],[0,8,10,3],[7,9,11,4],[8,6,10,5],[9,1,11,6],[2,0,10,7],[3,5,11,8],[6,4,10,9],[1,0,2,-1],[1,2,3,-1],[3,2,4,-1],[3,4,5,-1],[5,4,6,-1],[5,6,7,-1],[7,6,8,-1],[7,8,9,-1],[9,8,0,-1],[9,0,1,-1]];this.scaleFactor=.9;this.values=[...Array(10).keys()];this.margin=1;for(let s=0,r=0;s<10;++s,r+=Math.PI*2/10)this.vertices.push([Math.cos(r),Math.sin(r),.105*(s%2?1:-1)]);this.vertices.push([0,0,-1]),this.vertices.push([0,0,1])}},Z0=class extends z1{constructor(e,t,i={diceColor:"#7a2c2d",textColor:"#FFFFFF"},n){super(e,t,i,n);this.labels=["","00","10","20","30","40","50","60","70","80","90"];this.sides=100;this.mass=350;this.tab=0;this.af=-Math.PI*6/5;this.chamfer=.945;this.vertices=[];this.faces=[[5,7,11,0],[4,2,10,1],[1,3,11,2],[0,8,10,3],[7,9,11,4],[8,6,10,5],[9,1,11,6],[2,0,10,7],[3,5,11,8],[6,4,10,9],[1,0,2,-1],[1,2,3,-1],[3,2,4,-1],[3,4,5,-1],[5,4,6,-1],[5,6,7,-1],[7,6,8,-1],[7,8,9,-1],[9,8,0,-1],[9,0,1,-1]];this.scaleFactor=.9;this.values=[...Array(10).keys()];this.margin=1;for(let s=0,r=0;s<10;++s,r+=Math.PI*2/10)this.vertices.push([Math.cos(r),Math.sin(r),.105*(s%2?1:-1)]);this.vertices.push([0,0,-1]),this.vertices.push([0,0,1])}},X0=class extends z1{constructor(e,t,i={diceColor:"#5eb0c5",textColor:"#FFFFFF"},n){super(e,t,i,n);this.mass=340;this.sides=8;this.tab=0;this.af=-Math.PI/4/2;this.chamfer=.965;this.vertices=[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]];this.faces=[[0,2,4,1],[0,4,3,2],[0,3,5,3],[0,5,2,4],[1,3,4,5],[1,4,2,6],[1,2,5,7],[1,5,3,8]];this.scaleFactor=1;this.values=[...Array(8).keys()];this.margin=1.2}},Y0=class extends z1{constructor(e,t,i={diceColor:"#d68316",textColor:"#FFFFFF"},n){super(e,t,i,n);this.mass=300;this.tab=.1;this.af=Math.PI/4;this.chamfer=.96;this.vertices=[[-1,-1,-1],[1,-1,-1],[1,1,-1],[-1,1,-1],[-1,-1,1],[1,-1,1],[1,1,1],[-1,1,1]];this.faces=[[0,3,2,1,1],[1,2,6,5,2],[0,1,5,4,3],[3,7,6,2,4],[0,4,7,3,5],[4,5,6,7,6]];this.scaleFactor=.9;this.sides=6;this.margin=1;this.values=[...Array(6).keys()]}},$0=class extends z1{constructor(){super(...arguments);this.mass=300;this.tab=.1;this.af=Math.PI/4;this.chamfer=.96;this.vertices=[[-1,-1,-1],[1,-1,-1],[1,1,-1],[-1,1,-1],[-1,-1,1],[1,-1,1],[1,1,1],[-1,1,1]];this.faces=[[0,3,2,1,1],[1,2,6,5,2],[0,1,5,4,3],[3,7,6,2,4],[0,4,7,3,5],[4,5,6,7,6]];this.scaleFactor=.9;this.sides=6;this.margin=1;this.labels=["","","+","-"," ","+","-"," "];this.values=[null,1,-1,0,1,-1,0]}},J0=class extends z1{constructor(e,t,i={diceColor:"#93b139",textColor:"#FFFFFF"},n){super(e,t,i,n);this.mass=300;this.tab=-.1;this.af=Math.PI*7/6;this.chamfer=.96;this.vertices=[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]];this.faces=[[1,0,2,1],[0,1,3,2],[0,3,2,3],[1,2,3,4]];this.scaleFactor=1.2;this.sides=4;this.margin=1;this.d4FaceTexts=[[[],[0,0,0],[2,4,3],[1,3,4],[2,1,4],[1,2,3]],[[],[0,0,0],[2,3,4],[3,1,4],[2,4,1],[3,2,1]],[[],[0,0,0],[4,3,2],[3,4,1],[4,2,1],[3,1,2]],[[],[0,0,0],[4,2,3],[1,4,3],[4,1,2],[1,3,2]]];this.faceTexts=this.d4FaceTexts[0];this.values=[...Array(4).keys()]}getMaterials(){let e=[];for(let t=0;t<this.d4FaceTexts[0].length;++t){let i=null;i=this.createTextTexture(t),e.push(new Ms(Object.assign({},z8,{map:i})))}return e}createTextTexture(e){let t=document.createElement("canvas"),i=t.getContext("2d"),n=this.calculateTextureSize(this.radius/2+this.radius*2)*2;t.width=t.height=n,i.font=`${n/5}pt '${this.fontFace}'`,i.fillStyle=this.diceColor,i.fillRect(0,0,t.width,t.height),i.textAlign="center",i.textBaseline="middle",i.fillStyle=this.textColor;for(let r in this.faceTexts[e])i.fillText(`${this.faceTexts[e][r]}`,t.width/2,t.height/2-n*.3),i.translate(t.width/2,t.height/2),i.rotate(Math.PI*2/3),i.translate(-t.width/2,-t.height/2);let s=new G1(t);return s.needsUpdate=!0,s}updateMaterialsForValue(e){e<0&&(e+=4),this.faceTexts=this.d4FaceTexts[e],this.geometry.material=this.getMaterials()}},oa=class extends z1{constructor(){super(...arguments);this.fontFace="DICE_ROLLER_GENESYS_FONT"}},Q0=class extends oa{constructor(e,t,i=Y2,n){super(e,t,i,n);this.mass=350;this.sides=12;this.tab=.2;this.af=-Math.PI/4/2;this.chamfer=.968;this.vertices=[];this.faces=[[2,14,4,12,0,1],[15,9,11,19,3,2],[16,10,17,7,6,3],[6,7,19,11,18,4],[6,18,2,0,16,5],[18,11,9,14,2,6],[1,17,10,8,13,7],[1,13,5,15,3,8],[13,8,12,4,5,9],[5,4,14,9,15,10],[0,12,8,10,16,11],[3,19,7,17,1,12]];this.scaleFactor=.9;this.values=[...Array(12).keys()];this.margin=1;let s=(1+Math.sqrt(5))/2,r=1/s;this.vertices=[[0,r,s],[0,r,-s],[0,-r,s],[0,-r,-s],[s,0,r],[s,0,-r],[-s,0,r],[-s,0,-r],[r,s,0],[r,-s,0],[-r,s,0],[-r,-s,0],[1,1,1],[1,1,-1],[1,-1,1],[1,-1,-1],[-1,1,1],[-1,1,-1],[-1,-1,1],[-1,-1,-1]]}},K0=class extends Q0{constructor(e,t,i=Y2,n){super(e,t,i,n);this.labels=["","",`a
|
|
a`,"a",`a
|
|
a`,"x","s",`s
|
|
a`,"s",`s
|
|
a`,`s
|
|
s`,`s
|
|
a`,`s
|
|
s`,""];this.setColor({diceColor:"#FEF035",textColor:"#000000"})}},eo=class extends Q0{constructor(e,t,i=Y2,n){super(e,t,i,n);this.labels=["","",`t
|
|
t`,"t",`t
|
|
t`,"t",`t
|
|
f`,"f",`t
|
|
f`,"f",`f
|
|
f`,"y",`f
|
|
f`,""];this.setColor({diceColor:"#751317",textColor:"#FFFFFF"})}},to=class extends oa{constructor(){super(...arguments);this.mass=340;this.sides=8;this.tab=0;this.af=-Math.PI/4/2;this.chamfer=.965;this.vertices=[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]];this.faces=[[0,2,4,1],[0,4,3,2],[0,3,5,3],[0,5,2,4],[1,3,4,5],[1,4,2,6],[1,2,5,7],[1,5,3,8]];this.scaleFactor=1;this.values=[...Array(8).keys()];this.margin=1.2}},io=class extends to{constructor(e,t,i=Y2,n){super(e,t,i,n);this.labels=["","","s","a",`s
|
|
a`,`s
|
|
s`,"a","s",`a
|
|
a`,""];this.setColor({diceColor:"#46AC4E",textColor:"#000000"})}},no=class extends to{constructor(e,t,i=Y2,n){super(e,t,i,n);this.labels=["","","t","f",`f
|
|
t`,"t","",`t
|
|
t`,`f
|
|
f`,"t",""];this.setColor({diceColor:"#52287E",textColor:"#FFFFFF"})}},so=class extends oa{constructor(){super(...arguments);this.mass=300;this.tab=.1;this.af=Math.PI/4;this.chamfer=.96;this.vertices=[[-1,-1,-1],[1,-1,-1],[1,1,-1],[-1,1,-1],[-1,-1,1],[1,-1,1],[1,1,1],[-1,1,1]];this.faces=[[0,3,2,1,1],[1,2,6,5,2],[0,1,5,4,3],[3,7,6,2,4],[0,4,7,3,5],[4,5,6,7,6]];this.scaleFactor=.9;this.sides=6;this.margin=1;this.values=[null,1,-1,0,1,-1,0]}},ro=class extends so{constructor(e,t,i=Y2,n){super(e,t,i,n);this.labels=["","","","","s",`s
|
|
a`,`a
|
|
a`,"a","",""];this.setColor({diceColor:"#76CDDB",textColor:"#000000"})}},ao=class extends so{constructor(e,t,i=Y2,n){super(e,t,i,n);this.labels=["","","","t","f","",""];this.setColor({diceColor:"#000000",textColor:"#FFFFFF"})}};var Gf={pos:{x:0+100*Math.random(),y:0+100*Math.random(),z:0+250},velocity:{x:600*(Math.random()*2+1),y:750*(Math.random()*2+1),z:0},angular:{x:200*Math.random(),y:200*Math.random(),z:100*Math.random()},axis:{x:Math.random(),y:Math.random(),z:Math.random(),w:Math.random()}},Li=class{constructor(e,t,i){this.w=e;this.h=t;this.data=i;this.scale=50;this.stopped=!1;this.iterations=0;this.vector={...Gf};this.exploded=!1;this.rerolled=0;this.geometry=i.geometry,this.body=i.body}generateVector(e){let t=Math.sqrt(e.x*e.x+e.y*e.y),i=(Math.random()+5)*t,n={x:e.x/t,y:e.y/t},s=this.makeRandomVector(n),r={x:this.w*(s.x>0?-1:1)*.9,y:this.h*(s.y>0?-1:1)*.9,z:Math.random()*200+200},a=Math.abs(s.x/s.y);a>1?r.y/=a:r.x*=a;let c=this.makeRandomVector(n),l={x:c.x*i,y:c.y*i,z:-10},h={x:-(Math.random()*s.y*5+this.inertia*s.y),y:Math.random()*s.x*5+this.inertia*s.x,z:0},f={x:Math.random(),y:Math.random(),z:Math.random(),w:Math.random()};return{pos:r,velocity:l,angular:h,axis:f}}makeRandomVector(e){let t=Math.random()*Math.PI/5-Math.PI/5/2,i={x:e.x*Math.cos(t)-e.y*Math.sin(t),y:e.x*Math.sin(t)+e.y*Math.cos(t)};return i.x==0&&(i.x=.01),i.y==0&&(i.y=.01),i}get buffer(){return this.geometry.geometry}get result(){return this.getUpsideValue()}getUpsideValue(){let e=new Y(0,0,this.sides==4?-1:1),t,i=Math.PI*2,n=this.buffer.getAttribute("normal").array;for(let r=0,a=this.buffer.groups.length;r<a;++r){let c=this.buffer.groups[r];if(c.materialIndex==0)continue;let l=r*9,f=new Y(n[l],n[l+1],n[l+2]).clone().applyQuaternion(new nt(this.body.quaternion.x,this.body.quaternion.y,this.body.quaternion.z,this.body.quaternion.w)).angleTo(e);f<i&&(i=f,t=c)}let s=t.materialIndex-1;return this.sides==10&&s==0&&(s=10),this.data.values?.[s]??s}shiftUpperValue(e){let t=this.geometry.geometry.clone(),i=this.getUpsideValue();for(let n=0,s=t.groups.length;n<s;++n){let r=t.groups[n].materialIndex;if(r!==0){for(r+=e-i-1;r>this.sides;)r-=this.sides;for(;r<1;)r+=this.sides;t.groups[n].materialIndex=r+1}}this.updateMaterialsForValue(e-i),this.geometry.geometry=t}resetBody(){return this.body.vlambda=new M,this.body.position=new M,this.body.previousPosition=new M,this.body.initPosition=new M,this.body.velocity=new M,this.body.initVelocity=new M,this.body.force=new M,this.body.torque=new M,this.body.quaternion=new nt,this.body.initQuaternion=new nt,this.body.angularVelocity=new M,this.body.initAngularVelocity=new M,this.body.interpolatedPosition=new M,this.body.interpolatedQuaternion=new nt,this.body.inertia=new M,this.body.invInertia=new M,this.body.invInertiaWorld=new jt,this.body.invInertiaSolve=new M,this.body.invInertiaWorldSolve=new jt,this.body.wlambda=new M,this.body.updateMassProperties(),this}updateMaterialsForValue(e){}set(){this.geometry.position.set(this.body.position.x,this.body.position.y,this.body.position.z),this.geometry.quaternion.set(this.body.quaternion.x,this.body.quaternion.y,this.body.quaternion.z,this.body.quaternion.w)}recreate(e,t,i){this.w=t,this.h=i,this.vector=this.generateVector(e),this.stopped=!1,this.iterations=0,this.create()}create(){return this.body.position.set(this.vector.pos.x,this.vector.pos.y,this.vector.pos.z),this.body.quaternion.setFromAxisAngle(new M(this.vector.axis.x,this.vector.axis.y,this.vector.axis.z),this.vector.axis.w*Math.PI*2),this.body.angularVelocity.set(this.vector.angular.x,this.vector.angular.y,this.vector.angular.z),this.body.velocity.set(this.vector.velocity.x,this.vector.velocity.y,this.vector.velocity.z),this.body.linearDamping=.1,this.body.angularDamping=.1,this}},ca=class extends Li{constructor(e,t,i,n){super(e,t,i);this.w=e;this.h=t;this.data=i;this.sides=20;this.inertia=6;n&&(this.vector=this.generateVector(n)),this.create()}},la=class extends Li{constructor(e,t,i,n){super(e,t,i);this.w=e;this.h=t;this.data=i;this.sides=12;this.inertia=8;n&&(this.vector=this.generateVector(n)),this.create()}},$2=class extends Li{constructor(e,t,i,n,s=!1){super(e,t,i);this.w=e;this.h=t;this.data=i;this.isPercentile=s;this.sides=10;this.inertia=9;n&&(this.vector=this.generateVector(n)),this.create()}},ha=class extends Li{constructor(e,t,i,n){super(e,t,i);this.w=e;this.h=t;this.data=i;this.sides=8;this.inertia=10;n&&(this.vector=this.generateVector(n)),this.create()}},zs=class extends Li{constructor(e,t,i,n){super(e,t,i);this.w=e;this.h=t;this.data=i;this.sides=6;this.inertia=13;n&&(this.vector=this.generateVector(n)),this.create()}},ua=class extends Li{constructor(e,t,i,n){super(e,t,i);this.w=e;this.h=t;this.data=i;this.sides=4;this.inertia=5;n&&(this.vector=this.generateVector(n)),this.create()}};var oo="137";var qf=0,C8=1,Wf=2;var A8=1,co=2,Cs=3,As=0,Ct=1,fn=2,S8=1;var J2=0,Ss=1,_8=2,E8=3,L8=4,jf=5,dn=100,Zf=101,Xf=102,T8=103,D8=104,Yf=200,$f=201,Jf=202,Qf=203,H8=204,V8=205,Kf=206,ed=207,td=208,id=209,nd=210,sd=0,rd=1,ad=2,lo=3,od=4,cd=5,ld=6,hd=7,fa=0,ud=1,fd=2,Q2=0,dd=1,pd=2,md=3,gd=4,vd=5,R8=300,_s=301,Es=302,ho=303,uo=304,da=306,fo=307,po=1e3,s1=1001,mo=1002,At=1003,N8=1004;var F8=1005;var Pt=1006,xd=1007;var pa=1008;var K2=1009,yd=1010,wd=1011,Ls=1012,bd=1013,ma=1014,Ti=1015,pn=1016,Md=1017,zd=1018,mn=1020,Cd=1021,Ut=1023,Ad=1024,Sd=1025,Di=1026,gn=1027,_d=1028,Ed=1029,Ld=1030,Td=1031,Dd=1033,go=33776,vo=33777,xo=33778,yo=33779,B8=35840,P8=35841,I8=35842,k8=35843,Hd=36196,O8=37492,U8=37496,G8=37808,q8=37809,W8=37810,j8=37811,Z8=37812,X8=37813,Y8=37814,$8=37815,J8=37816,Q8=37817,K8=37818,e5=37819,t5=37820,i5=37821,n5=36492,Vd=2200,Rd=2201,Nd=2202,ga=2300,va=2301,wo=2302,vn=2400,xn=2401,xa=2402,bo=2500,s5=2501,Fd=0;var ei=3e3,ot=3001,Bd=3200,Pd=3201,yn=0,Id=1;var Mo=7680;var kd=519,Ts=35044,ya=35048;var r5="300 es",zo=1035,ti=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;let i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;let n=this._listeners[e];if(n!==void 0){let s=n.indexOf(t);s!==-1&&n.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;let i=this._listeners[e.type];if(i!==void 0){e.target=this;let n=i.slice(0);for(let s=0,r=n.length;s<r;s++)n[s].call(this,e);e.target=null}}},Vt=[];for(let o=0;o<256;o++)Vt[o]=(o<16?"0":"")+o.toString(16);var Co=Math.PI/180,Ao=180/Math.PI;function C1(){let o=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Vt[o&255]+Vt[o>>8&255]+Vt[o>>16&255]+Vt[o>>24&255]+"-"+Vt[e&255]+Vt[e>>8&255]+"-"+Vt[e>>16&15|64]+Vt[e>>24&255]+"-"+Vt[t&63|128]+Vt[t>>8&255]+"-"+Vt[t>>16&255]+Vt[t>>24&255]+Vt[i&255]+Vt[i>>8&255]+Vt[i>>16&255]+Vt[i>>24&255]).toUpperCase()}function Jt(o,e,t){return Math.max(e,Math.min(t,o))}function Od(o,e){return(o%e+e)%e}function So(o,e,t){return(1-t)*o+t*e}function a5(o){return(o&o-1)==0&&o!==0}function Ud(o){return Math.pow(2,Math.floor(Math.log(o)/Math.LN2))}var te=class{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e,t){return t!==void 0?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e,t){return t!==void 0?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,i=this.y,n=e.elements;return this.x=n[0]*t+n[3]*i+n[6],this.y=n[1]*t+n[4]*i+n[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t,i){return i!==void 0&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let i=Math.cos(t),n=Math.sin(t),s=this.x-e.x,r=this.y-e.y;return this.x=s*i-r*n+e.x,this.y=s*n+r*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};te.prototype.isVector2=!0;var Tt=class{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(e,t,i,n,s,r,a,c,l){let h=this.elements;return h[0]=e,h[1]=n,h[2]=a,h[3]=t,h[4]=s,h[5]=c,h[6]=i,h[7]=r,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,n=t.elements,s=this.elements,r=i[0],a=i[3],c=i[6],l=i[1],h=i[4],f=i[7],u=i[2],d=i[5],p=i[8],v=n[0],x=n[3],g=n[6],m=n[1],z=n[4],y=n[7],b=n[2],S=n[5],_=n[8];return s[0]=r*v+a*m+c*b,s[3]=r*x+a*z+c*S,s[6]=r*g+a*y+c*_,s[1]=l*v+h*m+f*b,s[4]=l*x+h*z+f*S,s[7]=l*g+h*y+f*_,s[2]=u*v+d*m+p*b,s[5]=u*x+d*z+p*S,s[8]=u*g+d*y+p*_,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[1],n=e[2],s=e[3],r=e[4],a=e[5],c=e[6],l=e[7],h=e[8];return t*r*h-t*a*l-i*s*h+i*a*c+n*s*l-n*r*c}invert(){let e=this.elements,t=e[0],i=e[1],n=e[2],s=e[3],r=e[4],a=e[5],c=e[6],l=e[7],h=e[8],f=h*r-a*l,u=a*c-h*s,d=l*s-r*c,p=t*f+i*u+n*d;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let v=1/p;return e[0]=f*v,e[1]=(n*l-h*i)*v,e[2]=(a*i-n*r)*v,e[3]=u*v,e[4]=(h*t-n*c)*v,e[5]=(n*s-a*t)*v,e[6]=d*v,e[7]=(i*c-l*t)*v,e[8]=(r*t-i*s)*v,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,n,s,r,a){let c=Math.cos(s),l=Math.sin(s);return this.set(i*c,i*l,-i*(c*r+l*a)+r+e,-n*l,n*c,-n*(-l*r+c*a)+a+t,0,0,1),this}scale(e,t){let i=this.elements;return i[0]*=e,i[3]*=e,i[6]*=e,i[1]*=t,i[4]*=t,i[7]*=t,this}rotate(e){let t=Math.cos(e),i=Math.sin(e),n=this.elements,s=n[0],r=n[3],a=n[6],c=n[1],l=n[4],h=n[7];return n[0]=t*s+i*c,n[3]=t*r+i*l,n[6]=t*a+i*h,n[1]=-i*s+t*c,n[4]=-i*r+t*l,n[7]=-i*a+t*h,this}translate(e,t){let i=this.elements;return i[0]+=e*i[2],i[3]+=e*i[5],i[6]+=e*i[8],i[1]+=t*i[2],i[4]+=t*i[5],i[7]+=t*i[8],this}equals(e){let t=this.elements,i=e.elements;for(let n=0;n<9;n++)if(t[n]!==i[n])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}};Tt.prototype.isMatrix3=!0;function o5(o){for(let e=o.length-1;e>=0;--e)if(o[e]>65535)return!0;return!1}function Ds(o){return document.createElementNS("http://www.w3.org/1999/xhtml",o)}var c5={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},A1={h:0,s:0,l:0},wa={h:0,s:0,l:0};function _o(o,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?o+(e-o)*6*t:t<1/2?e:t<2/3?o+(e-o)*6*(2/3-t):o}function wn(o){return o<.04045?o*.0773993808:Math.pow(o*.9478672986+.0521327014,2.4)}function Eo(o){return o<.0031308?o*12.92:1.055*Math.pow(o,.41666)-.055}var xe=class{constructor(e,t,i){return t===void 0&&i===void 0?this.set(e):this.setRGB(e,t,i)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,this}setRGB(e,t,i){return this.r=e,this.g=t,this.b=i,this}setHSL(e,t,i){if(e=Od(e,1),t=Jt(t,0,1),i=Jt(i,0,1),t===0)this.r=this.g=this.b=i;else{let n=i<=.5?i*(1+t):i+t-i*t,s=2*i-n;this.r=_o(s,n,e+1/3),this.g=_o(s,n,e),this.b=_o(s,n,e-1/3)}return this}setStyle(e){function t(n){n!==void 0&&parseFloat(n)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let n,s=i[1],r=i[2];switch(s){case"rgb":case"rgba":if(n=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(255,parseInt(n[1],10))/255,this.g=Math.min(255,parseInt(n[2],10))/255,this.b=Math.min(255,parseInt(n[3],10))/255,t(n[4]),this;if(n=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(100,parseInt(n[1],10))/100,this.g=Math.min(100,parseInt(n[2],10))/100,this.b=Math.min(100,parseInt(n[3],10))/100,t(n[4]),this;break;case"hsl":case"hsla":if(n=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r)){let a=parseFloat(n[1])/360,c=parseInt(n[2],10)/100,l=parseInt(n[3],10)/100;return t(n[4]),this.setHSL(a,c,l)}break}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){let n=i[1],s=n.length;if(s===3)return this.r=parseInt(n.charAt(0)+n.charAt(0),16)/255,this.g=parseInt(n.charAt(1)+n.charAt(1),16)/255,this.b=parseInt(n.charAt(2)+n.charAt(2),16)/255,this;if(s===6)return this.r=parseInt(n.charAt(0)+n.charAt(1),16)/255,this.g=parseInt(n.charAt(2)+n.charAt(3),16)/255,this.b=parseInt(n.charAt(4)+n.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this}setColorName(e){let t=c5[e.toLowerCase()];return t!==void 0?this.setHex(t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=wn(e.r),this.g=wn(e.g),this.b=wn(e.b),this}copyLinearToSRGB(e){return this.r=Eo(e.r),this.g=Eo(e.g),this.b=Eo(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return this.r*255<<16^this.g*255<<8^this.b*255<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(e){let t=this.r,i=this.g,n=this.b,s=Math.max(t,i,n),r=Math.min(t,i,n),a,c,l=(r+s)/2;if(r===s)a=0,c=0;else{let h=s-r;switch(c=l<=.5?h/(s+r):h/(2-s-r),s){case t:a=(i-n)/h+(i<n?6:0);break;case i:a=(n-t)/h+2;break;case n:a=(t-i)/h+4;break}a/=6}return e.h=a,e.s=c,e.l=l,e}getStyle(){return"rgb("+(this.r*255|0)+","+(this.g*255|0)+","+(this.b*255|0)+")"}offsetHSL(e,t,i){return this.getHSL(A1),A1.h+=e,A1.s+=t,A1.l+=i,this.setHSL(A1.h,A1.s,A1.l),this}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(A1),e.getHSL(wa);let i=So(A1.h,wa.h,t),n=So(A1.s,wa.s,t),s=So(A1.l,wa.l,t);return this.setHSL(i,n,s),this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),e.normalized===!0&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}};xe.NAMES=c5;xe.prototype.isColor=!0;xe.prototype.r=1;xe.prototype.g=1;xe.prototype.b=1;var bn,ii=class{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement=="undefined")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{bn===void 0&&(bn=Ds("canvas")),bn.width=e.width,bn.height=e.height;let i=bn.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=bn}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement!="undefined"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&e instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&e instanceof ImageBitmap){let t=Ds("canvas");t.width=e.width,t.height=e.height;let i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);let n=i.getImageData(0,0,e.width,e.height),s=n.data;for(let r=0;r<s.length;r++)s[r]=wn(s[r]/255)*255;return i.putImageData(n,0,0),t}else if(e.data){let t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(wn(t[i]/255)*255):t[i]=wn(t[i]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},Gd=0,vt=class extends ti{constructor(e=vt.DEFAULT_IMAGE,t=vt.DEFAULT_MAPPING,i=s1,n=s1,s=Pt,r=pa,a=Ut,c=K2,l=1,h=ei){super();Object.defineProperty(this,"id",{value:Gd++}),this.uuid=C1(),this.name="",this.image=e,this.mipmaps=[],this.mapping=t,this.wrapS=i,this.wrapT=n,this.magFilter=s,this.minFilter=r,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=c,this.offset=new te(0,0),this.repeat=new te(1,1),this.center=new te(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Tt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=h,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this.userData=JSON.parse(JSON.stringify(e.userData)),this}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let i={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(this.image!==void 0){let n=this.image;if(n.uuid===void 0&&(n.uuid=C1()),!t&&e.images[n.uuid]===void 0){let s;if(Array.isArray(n)){s=[];for(let r=0,a=n.length;r<a;r++)n[r].isDataTexture?s.push(Lo(n[r].image)):s.push(Lo(n[r]))}else s=Lo(n);e.images[n.uuid]={uuid:n.uuid,url:s}}i.image=n.uuid}return JSON.stringify(this.userData)!=="{}"&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==R8)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case po:e.x=e.x-Math.floor(e.x);break;case s1:e.x=e.x<0?0:1;break;case mo:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case po:e.y=e.y-Math.floor(e.y);break;case s1:e.y=e.y<0?0:1;break;case mo:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&this.version++}};vt.DEFAULT_IMAGE=void 0;vt.DEFAULT_MAPPING=R8;vt.prototype.isTexture=!0;function Lo(o){return typeof HTMLImageElement!="undefined"&&o instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&o instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&o instanceof ImageBitmap?ii.getDataURL(o):o.data?{data:Array.prototype.slice.call(o.data),width:o.width,height:o.height,type:o.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var Qe=class{constructor(e=0,t=0,i=0,n=1){this.x=e,this.y=t,this.z=i,this.w=n}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,n){return this.x=e,this.y=t,this.z=i,this.w=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e,t){return t!==void 0?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e,t){return t!==void 0?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,i=this.y,n=this.z,s=this.w,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*n+r[12]*s,this.y=r[1]*t+r[5]*i+r[9]*n+r[13]*s,this.z=r[2]*t+r[6]*i+r[10]*n+r[14]*s,this.w=r[3]*t+r[7]*i+r[11]*n+r[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,n,s,r=.01,a=.1,c=e.elements,l=c[0],h=c[4],f=c[8],u=c[1],d=c[5],p=c[9],v=c[2],x=c[6],g=c[10];if(Math.abs(h-u)<r&&Math.abs(f-v)<r&&Math.abs(p-x)<r){if(Math.abs(h+u)<a&&Math.abs(f+v)<a&&Math.abs(p+x)<a&&Math.abs(l+d+g-3)<a)return this.set(1,0,0,0),this;t=Math.PI;let z=(l+1)/2,y=(d+1)/2,b=(g+1)/2,S=(h+u)/4,_=(f+v)/4,A=(p+x)/4;return z>y&&z>b?z<r?(i=0,n=.707106781,s=.707106781):(i=Math.sqrt(z),n=S/i,s=_/i):y>b?y<r?(i=.707106781,n=0,s=.707106781):(n=Math.sqrt(y),i=S/n,s=A/n):b<r?(i=.707106781,n=.707106781,s=0):(s=Math.sqrt(b),i=_/s,n=A/s),this.set(i,n,s,t),this}let m=Math.sqrt((x-p)*(x-p)+(f-v)*(f-v)+(u-h)*(u-h));return Math.abs(m)<.001&&(m=1),this.x=(x-p)/m,this.y=(f-v)/m,this.z=(u-h)/m,this.w=Math.acos((l+d+g-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t,i){return i!==void 0&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};Qe.prototype.isVector4=!0;var r1=class extends ti{constructor(e,t,i={}){super();this.width=e,this.height=t,this.depth=1,this.scissor=new Qe(0,0,e,t),this.scissorTest=!1,this.viewport=new Qe(0,0,e,t),this.texture=new vt(void 0,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.texture.isRenderTargetTexture=!0,this.texture.image={width:e,height:t,depth:1},this.texture.generateMipmaps=i.generateMipmaps!==void 0?i.generateMipmaps:!1,this.texture.internalFormat=i.internalFormat!==void 0?i.internalFormat:null,this.texture.minFilter=i.minFilter!==void 0?i.minFilter:Pt,this.depthBuffer=i.depthBuffer!==void 0?i.depthBuffer:!0,this.stencilBuffer=i.stencilBuffer!==void 0?i.stencilBuffer:!1,this.depthTexture=i.depthTexture!==void 0?i.depthTexture:null}setTexture(e){e.image={width:this.width,height:this.height,depth:this.depth},this.texture=e}setSize(e,t,i=1){(this.width!==e||this.height!==t||this.depth!==i)&&(this.width=e,this.height=t,this.depth=i,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.image=Object.assign({},e.texture.image),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}};r1.prototype.isWebGLRenderTarget=!0;var l5=class extends r1{constructor(e,t,i){super(e,t);let n=this.texture;this.texture=[];for(let s=0;s<i;s++)this.texture[s]=n.clone()}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let n=0,s=this.texture.length;n<s;n++)this.texture[n].image.width=e,this.texture[n].image.height=t,this.texture[n].image.depth=i;this.dispose()}return this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t),this}copy(e){this.dispose(),this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.set(0,0,this.width,this.height),this.scissor.set(0,0,this.width,this.height),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this.texture.length=0;for(let t=0,i=e.texture.length;t<i;t++)this.texture[t]=e.texture[t].clone();return this}};l5.prototype.isWebGLMultipleRenderTargets=!0;var ba=class extends r1{constructor(e,t,i={}){super(e,t,i);this.samples=4,this.ignoreDepthForMultisampleCopy=i.ignoreDepth!==void 0?i.ignoreDepth:!0,this.useRenderToTexture=i.useRenderToTexture!==void 0?i.useRenderToTexture:!1,this.useRenderbuffer=this.useRenderToTexture===!1}copy(e){return super.copy.call(this,e),this.samples=e.samples,this.useRenderToTexture=e.useRenderToTexture,this.useRenderbuffer=e.useRenderbuffer,this}};ba.prototype.isWebGLMultisampleRenderTarget=!0;var Gt=class{constructor(e=0,t=0,i=0,n=1){this._x=e,this._y=t,this._z=i,this._w=n}static slerp(e,t,i,n){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),i.slerpQuaternions(e,t,n)}static slerpFlat(e,t,i,n,s,r,a){let c=i[n+0],l=i[n+1],h=i[n+2],f=i[n+3],u=s[r+0],d=s[r+1],p=s[r+2],v=s[r+3];if(a===0){e[t+0]=c,e[t+1]=l,e[t+2]=h,e[t+3]=f;return}if(a===1){e[t+0]=u,e[t+1]=d,e[t+2]=p,e[t+3]=v;return}if(f!==v||c!==u||l!==d||h!==p){let x=1-a,g=c*u+l*d+h*p+f*v,m=g>=0?1:-1,z=1-g*g;if(z>Number.EPSILON){let b=Math.sqrt(z),S=Math.atan2(b,g*m);x=Math.sin(x*S)/b,a=Math.sin(a*S)/b}let y=a*m;if(c=c*x+u*y,l=l*x+d*y,h=h*x+p*y,f=f*x+v*y,x===1-a){let b=1/Math.sqrt(c*c+l*l+h*h+f*f);c*=b,l*=b,h*=b,f*=b}}e[t]=c,e[t+1]=l,e[t+2]=h,e[t+3]=f}static multiplyQuaternionsFlat(e,t,i,n,s,r){let a=i[n],c=i[n+1],l=i[n+2],h=i[n+3],f=s[r],u=s[r+1],d=s[r+2],p=s[r+3];return e[t]=a*p+h*f+c*d-l*u,e[t+1]=c*p+h*u+l*f-a*d,e[t+2]=l*p+h*d+a*u-c*f,e[t+3]=h*p-a*f-c*u-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,n){return this._x=e,this._y=t,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){if(!(e&&e.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");let i=e._x,n=e._y,s=e._z,r=e._order,a=Math.cos,c=Math.sin,l=a(i/2),h=a(n/2),f=a(s/2),u=c(i/2),d=c(n/2),p=c(s/2);switch(r){case"XYZ":this._x=u*h*f+l*d*p,this._y=l*d*f-u*h*p,this._z=l*h*p+u*d*f,this._w=l*h*f-u*d*p;break;case"YXZ":this._x=u*h*f+l*d*p,this._y=l*d*f-u*h*p,this._z=l*h*p-u*d*f,this._w=l*h*f+u*d*p;break;case"ZXY":this._x=u*h*f-l*d*p,this._y=l*d*f+u*h*p,this._z=l*h*p+u*d*f,this._w=l*h*f-u*d*p;break;case"ZYX":this._x=u*h*f-l*d*p,this._y=l*d*f+u*h*p,this._z=l*h*p-u*d*f,this._w=l*h*f+u*d*p;break;case"YZX":this._x=u*h*f+l*d*p,this._y=l*d*f+u*h*p,this._z=l*h*p-u*d*f,this._w=l*h*f-u*d*p;break;case"XZY":this._x=u*h*f-l*d*p,this._y=l*d*f-u*h*p,this._z=l*h*p+u*d*f,this._w=l*h*f+u*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+r)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let i=t/2,n=Math.sin(i);return this._x=e.x*n,this._y=e.y*n,this._z=e.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,i=t[0],n=t[4],s=t[8],r=t[1],a=t[5],c=t[9],l=t[2],h=t[6],f=t[10],u=i+a+f;if(u>0){let d=.5/Math.sqrt(u+1);this._w=.25/d,this._x=(h-c)*d,this._y=(s-l)*d,this._z=(r-n)*d}else if(i>a&&i>f){let d=2*Math.sqrt(1+i-a-f);this._w=(h-c)/d,this._x=.25*d,this._y=(n+r)/d,this._z=(s+l)/d}else if(a>f){let d=2*Math.sqrt(1+a-i-f);this._w=(s-l)/d,this._x=(n+r)/d,this._y=.25*d,this._z=(c+h)/d}else{let d=2*Math.sqrt(1+f-i-a);this._w=(r-n)/d,this._x=(s+l)/d,this._y=(c+h)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Jt(this.dot(e),-1,1)))}rotateTowards(e,t){let i=this.angleTo(e);if(i===0)return this;let n=Math.min(1,t/i);return this.slerp(e,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e,t){return t!==void 0?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let i=e._x,n=e._y,s=e._z,r=e._w,a=t._x,c=t._y,l=t._z,h=t._w;return this._x=i*h+r*a+n*l-s*c,this._y=n*h+r*c+s*a-i*l,this._z=s*h+r*l+i*c-n*a,this._w=r*h-i*a-n*c-s*l,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);let i=this._x,n=this._y,s=this._z,r=this._w,a=r*e._w+i*e._x+n*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=r,this._x=i,this._y=n,this._z=s,this;let c=1-a*a;if(c<=Number.EPSILON){let d=1-t;return this._w=d*r+t*this._w,this._x=d*i+t*this._x,this._y=d*n+t*this._y,this._z=d*s+t*this._z,this.normalize(),this._onChangeCallback(),this}let l=Math.sqrt(c),h=Math.atan2(l,a),f=Math.sin((1-t)*h)/l,u=Math.sin(t*h)/l;return this._w=r*f+this._w*u,this._x=i*f+this._x*u,this._y=n*f+this._y*u,this._z=s*f+this._z*u,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){let e=Math.random(),t=Math.sqrt(1-e),i=Math.sqrt(e),n=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(n),i*Math.sin(s),i*Math.cos(s),t*Math.sin(n))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}};Gt.prototype.isQuaternion=!0;var B=class{constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e,t){return t!==void 0?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e,t){return t!==void 0?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e,t){return t!==void 0?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(h5.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(h5.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,i=this.y,n=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*n,this.y=s[1]*t+s[4]*i+s[7]*n,this.z=s[2]*t+s[5]*i+s[8]*n,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,i=this.y,n=this.z,s=e.elements,r=1/(s[3]*t+s[7]*i+s[11]*n+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*n+s[12])*r,this.y=(s[1]*t+s[5]*i+s[9]*n+s[13])*r,this.z=(s[2]*t+s[6]*i+s[10]*n+s[14])*r,this}applyQuaternion(e){let t=this.x,i=this.y,n=this.z,s=e.x,r=e.y,a=e.z,c=e.w,l=c*t+r*n-a*i,h=c*i+a*t-s*n,f=c*n+s*i-r*t,u=-s*t-r*i-a*n;return this.x=l*c+u*-s+h*-a-f*-r,this.y=h*c+u*-r+f*-s-l*-a,this.z=f*c+u*-a+l*-r-h*-s,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,i=this.y,n=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*n,this.y=s[1]*t+s[5]*i+s[9]*n,this.z=s[2]*t+s[6]*i+s[10]*n,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e,t){return t!==void 0?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)}crossVectors(e,t){let i=e.x,n=e.y,s=e.z,r=t.x,a=t.y,c=t.z;return this.x=n*c-s*a,this.y=s*r-i*c,this.z=i*a-n*r,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return To.copy(this).projectOnVector(e),this.sub(To)}reflect(e){return this.sub(To.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let i=this.dot(e)/t;return Math.acos(Jt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y,n=this.z-e.z;return t*t+i*i+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){let n=Math.sin(t)*e;return this.x=n*Math.sin(i),this.y=Math.cos(t)*e,this.z=n*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),n=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=n,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t,i){return i!==void 0&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(t),this.y=i*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};B.prototype.isVector3=!0;var To=new B,h5=new Gt,f1=class{constructor(e=new B(1/0,1/0,1/0),t=new B(-1/0,-1/0,-1/0)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,i=1/0,n=1/0,s=-1/0,r=-1/0,a=-1/0;for(let c=0,l=e.length;c<l;c+=3){let h=e[c],f=e[c+1],u=e[c+2];h<t&&(t=h),f<i&&(i=f),u<n&&(n=u),h>s&&(s=h),f>r&&(r=f),u>a&&(a=u)}return this.min.set(t,i,n),this.max.set(s,r,a),this}setFromBufferAttribute(e){let t=1/0,i=1/0,n=1/0,s=-1/0,r=-1/0,a=-1/0;for(let c=0,l=e.count;c<l;c++){let h=e.getX(c),f=e.getY(c),u=e.getZ(c);h<t&&(t=h),f<i&&(i=f),u<n&&(n=u),h>s&&(s=h),f>r&&(r=f),u>a&&(a=u)}return this.min.set(t,i,n),this.max.set(s,r,a),this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let i=Hi.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let i=e.geometry;if(i!==void 0)if(t&&i.attributes!=null&&i.attributes.position!==void 0){let s=i.attributes.position;for(let r=0,a=s.count;r<a;r++)Hi.fromBufferAttribute(s,r).applyMatrix4(e.matrixWorld),this.expandByPoint(Hi)}else i.boundingBox===null&&i.computeBoundingBox(),Do.copy(i.boundingBox),Do.applyMatrix4(e.matrixWorld),this.union(Do);let n=e.children;for(let s=0,r=n.length;s<r;s++)this.expandByObject(n[s],t);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Hi),Hi.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Hs),Ma.subVectors(this.max,Hs),Mn.subVectors(e.a,Hs),zn.subVectors(e.b,Hs),Cn.subVectors(e.c,Hs),ni.subVectors(zn,Mn),si.subVectors(Cn,zn),Vi.subVectors(Mn,Cn);let t=[0,-ni.z,ni.y,0,-si.z,si.y,0,-Vi.z,Vi.y,ni.z,0,-ni.x,si.z,0,-si.x,Vi.z,0,-Vi.x,-ni.y,ni.x,0,-si.y,si.x,0,-Vi.y,Vi.x,0];return!Ho(t,Mn,zn,Cn,Ma)||(t=[1,0,0,0,1,0,0,0,1],!Ho(t,Mn,zn,Cn,Ma))?!1:(za.crossVectors(ni,si),t=[za.x,za.y,za.z],Ho(t,Mn,zn,Cn,Ma))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return Hi.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=this.getSize(Hi).length()*.5,e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(y2[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),y2[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),y2[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),y2[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),y2[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),y2[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),y2[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),y2[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(y2),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}};f1.prototype.isBox3=!0;var y2=[new B,new B,new B,new B,new B,new B,new B,new B],Hi=new B,Do=new f1,Mn=new B,zn=new B,Cn=new B,ni=new B,si=new B,Vi=new B,Hs=new B,Ma=new B,za=new B,Ri=new B;function Ho(o,e,t,i,n){for(let s=0,r=o.length-3;s<=r;s+=3){Ri.fromArray(o,s);let a=n.x*Math.abs(Ri.x)+n.y*Math.abs(Ri.y)+n.z*Math.abs(Ri.z),c=e.dot(Ri),l=t.dot(Ri),h=i.dot(Ri);if(Math.max(-Math.max(c,l,h),Math.min(c,l,h))>a)return!1}return!0}var qd=new f1,u5=new B,Ca=new B,Vo=new B,Ni=class{constructor(e=new B,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let i=this.center;t!==void 0?i.copy(t):qd.setFromPoints(e).getCenter(i);let n=0;for(let s=0,r=e.length;s<r;s++)n=Math.max(n,i.distanceToSquared(e[s]));return this.radius=Math.sqrt(n),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){Vo.subVectors(e,this.center);let t=Vo.lengthSq();if(t>this.radius*this.radius){let i=Math.sqrt(t),n=(i-this.radius)*.5;this.center.add(Vo.multiplyScalar(n/i)),this.radius+=n}return this}union(e){return this.center.equals(e.center)===!0?Ca.set(0,0,1).multiplyScalar(e.radius):Ca.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(u5.copy(e.center).add(Ca)),this.expandByPoint(u5.copy(e.center).sub(Ca)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}},w2=new B,Ro=new B,Aa=new B,ri=new B,No=new B,Sa=new B,Fo=new B,Fi=class{constructor(e=new B,t=new B(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,w2)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(i).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=w2.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(w2.copy(this.direction).multiplyScalar(t).add(this.origin),w2.distanceToSquared(e))}distanceSqToSegment(e,t,i,n){Ro.copy(e).add(t).multiplyScalar(.5),Aa.copy(t).sub(e).normalize(),ri.copy(this.origin).sub(Ro);let s=e.distanceTo(t)*.5,r=-this.direction.dot(Aa),a=ri.dot(this.direction),c=-ri.dot(Aa),l=ri.lengthSq(),h=Math.abs(1-r*r),f,u,d,p;if(h>0)if(f=r*c-a,u=r*a-c,p=s*h,f>=0)if(u>=-p)if(u<=p){let v=1/h;f*=v,u*=v,d=f*(f+r*u+2*a)+u*(r*f+u+2*c)+l}else u=s,f=Math.max(0,-(r*u+a)),d=-f*f+u*(u+2*c)+l;else u=-s,f=Math.max(0,-(r*u+a)),d=-f*f+u*(u+2*c)+l;else u<=-p?(f=Math.max(0,-(-r*s+a)),u=f>0?-s:Math.min(Math.max(-s,-c),s),d=-f*f+u*(u+2*c)+l):u<=p?(f=0,u=Math.min(Math.max(-s,-c),s),d=u*(u+2*c)+l):(f=Math.max(0,-(r*s+a)),u=f>0?s:Math.min(Math.max(-s,-c),s),d=-f*f+u*(u+2*c)+l);else u=r>0?-s:s,f=Math.max(0,-(r*u+a)),d=-f*f+u*(u+2*c)+l;return i&&i.copy(this.direction).multiplyScalar(f).add(this.origin),n&&n.copy(Aa).multiplyScalar(u).add(Ro),d}intersectSphere(e,t){w2.subVectors(e.center,this.origin);let i=w2.dot(this.direction),n=w2.dot(w2)-i*i,s=e.radius*e.radius;if(n>s)return null;let r=Math.sqrt(s-n),a=i-r,c=i+r;return a<0&&c<0?null:a<0?this.at(c,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){let i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,n,s,r,a,c,l=1/this.direction.x,h=1/this.direction.y,f=1/this.direction.z,u=this.origin;return l>=0?(i=(e.min.x-u.x)*l,n=(e.max.x-u.x)*l):(i=(e.max.x-u.x)*l,n=(e.min.x-u.x)*l),h>=0?(s=(e.min.y-u.y)*h,r=(e.max.y-u.y)*h):(s=(e.max.y-u.y)*h,r=(e.min.y-u.y)*h),i>r||s>n||((s>i||i!==i)&&(i=s),(r<n||n!==n)&&(n=r),f>=0?(a=(e.min.z-u.z)*f,c=(e.max.z-u.z)*f):(a=(e.max.z-u.z)*f,c=(e.min.z-u.z)*f),i>c||a>n)||((a>i||i!==i)&&(i=a),(c<n||n!==n)&&(n=c),n<0)?null:this.at(i>=0?i:n,t)}intersectsBox(e){return this.intersectBox(e,w2)!==null}intersectTriangle(e,t,i,n,s){No.subVectors(t,e),Sa.subVectors(i,e),Fo.crossVectors(No,Sa);let r=this.direction.dot(Fo),a;if(r>0){if(n)return null;a=1}else if(r<0)a=-1,r=-r;else return null;ri.subVectors(this.origin,e);let c=a*this.direction.dot(Sa.crossVectors(ri,Sa));if(c<0)return null;let l=a*this.direction.dot(No.cross(ri));if(l<0||c+l>r)return null;let h=-a*ri.dot(Fo);return h<0?null:this.at(h/r,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},Ce=class{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(e,t,i,n,s,r,a,c,l,h,f,u,d,p,v,x){let g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=n,g[1]=s,g[5]=r,g[9]=a,g[13]=c,g[2]=l,g[6]=h,g[10]=f,g[14]=u,g[3]=d,g[7]=p,g[11]=v,g[15]=x,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Ce().fromArray(this.elements)}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){let t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,i=e.elements,n=1/An.setFromMatrixColumn(e,0).length(),s=1/An.setFromMatrixColumn(e,1).length(),r=1/An.setFromMatrixColumn(e,2).length();return t[0]=i[0]*n,t[1]=i[1]*n,t[2]=i[2]*n,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*r,t[9]=i[9]*r,t[10]=i[10]*r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");let t=this.elements,i=e.x,n=e.y,s=e.z,r=Math.cos(i),a=Math.sin(i),c=Math.cos(n),l=Math.sin(n),h=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){let u=r*h,d=r*f,p=a*h,v=a*f;t[0]=c*h,t[4]=-c*f,t[8]=l,t[1]=d+p*l,t[5]=u-v*l,t[9]=-a*c,t[2]=v-u*l,t[6]=p+d*l,t[10]=r*c}else if(e.order==="YXZ"){let u=c*h,d=c*f,p=l*h,v=l*f;t[0]=u+v*a,t[4]=p*a-d,t[8]=r*l,t[1]=r*f,t[5]=r*h,t[9]=-a,t[2]=d*a-p,t[6]=v+u*a,t[10]=r*c}else if(e.order==="ZXY"){let u=c*h,d=c*f,p=l*h,v=l*f;t[0]=u-v*a,t[4]=-r*f,t[8]=p+d*a,t[1]=d+p*a,t[5]=r*h,t[9]=v-u*a,t[2]=-r*l,t[6]=a,t[10]=r*c}else if(e.order==="ZYX"){let u=r*h,d=r*f,p=a*h,v=a*f;t[0]=c*h,t[4]=p*l-d,t[8]=u*l+v,t[1]=c*f,t[5]=v*l+u,t[9]=d*l-p,t[2]=-l,t[6]=a*c,t[10]=r*c}else if(e.order==="YZX"){let u=r*c,d=r*l,p=a*c,v=a*l;t[0]=c*h,t[4]=v-u*f,t[8]=p*f+d,t[1]=f,t[5]=r*h,t[9]=-a*h,t[2]=-l*h,t[6]=d*f+p,t[10]=u-v*f}else if(e.order==="XZY"){let u=r*c,d=r*l,p=a*c,v=a*l;t[0]=c*h,t[4]=-f,t[8]=l*h,t[1]=u*f+v,t[5]=r*h,t[9]=d*f-p,t[2]=p*f-d,t[6]=a*h,t[10]=v*f+u}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Wd,e,jd)}lookAt(e,t,i){let n=this.elements;return a1.subVectors(e,t),a1.lengthSq()===0&&(a1.z=1),a1.normalize(),ai.crossVectors(i,a1),ai.lengthSq()===0&&(Math.abs(i.z)===1?a1.x+=1e-4:a1.z+=1e-4,a1.normalize(),ai.crossVectors(i,a1)),ai.normalize(),_a.crossVectors(a1,ai),n[0]=ai.x,n[4]=_a.x,n[8]=a1.x,n[1]=ai.y,n[5]=_a.y,n[9]=a1.y,n[2]=ai.z,n[6]=_a.z,n[10]=a1.z,this}multiply(e,t){return t!==void 0?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,n=t.elements,s=this.elements,r=i[0],a=i[4],c=i[8],l=i[12],h=i[1],f=i[5],u=i[9],d=i[13],p=i[2],v=i[6],x=i[10],g=i[14],m=i[3],z=i[7],y=i[11],b=i[15],S=n[0],_=n[4],A=n[8],P=n[12],R=n[1],w=n[5],D=n[9],C=n[13],V=n[2],H=n[6],T=n[10],N=n[14],I=n[3],j=n[7],O=n[11],q=n[15];return s[0]=r*S+a*R+c*V+l*I,s[4]=r*_+a*w+c*H+l*j,s[8]=r*A+a*D+c*T+l*O,s[12]=r*P+a*C+c*N+l*q,s[1]=h*S+f*R+u*V+d*I,s[5]=h*_+f*w+u*H+d*j,s[9]=h*A+f*D+u*T+d*O,s[13]=h*P+f*C+u*N+d*q,s[2]=p*S+v*R+x*V+g*I,s[6]=p*_+v*w+x*H+g*j,s[10]=p*A+v*D+x*T+g*O,s[14]=p*P+v*C+x*N+g*q,s[3]=m*S+z*R+y*V+b*I,s[7]=m*_+z*w+y*H+b*j,s[11]=m*A+z*D+y*T+b*O,s[15]=m*P+z*C+y*N+b*q,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[4],n=e[8],s=e[12],r=e[1],a=e[5],c=e[9],l=e[13],h=e[2],f=e[6],u=e[10],d=e[14],p=e[3],v=e[7],x=e[11],g=e[15];return p*(+s*c*f-n*l*f-s*a*u+i*l*u+n*a*d-i*c*d)+v*(+t*c*d-t*l*u+s*r*u-n*r*d+n*l*h-s*c*h)+x*(+t*l*f-t*a*d-s*r*f+i*r*d+s*a*h-i*l*h)+g*(-n*a*h-t*c*f+t*a*u+n*r*f-i*r*u+i*c*h)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){let n=this.elements;return e.isVector3?(n[12]=e.x,n[13]=e.y,n[14]=e.z):(n[12]=e,n[13]=t,n[14]=i),this}invert(){let e=this.elements,t=e[0],i=e[1],n=e[2],s=e[3],r=e[4],a=e[5],c=e[6],l=e[7],h=e[8],f=e[9],u=e[10],d=e[11],p=e[12],v=e[13],x=e[14],g=e[15],m=f*x*l-v*u*l+v*c*d-a*x*d-f*c*g+a*u*g,z=p*u*l-h*x*l-p*c*d+r*x*d+h*c*g-r*u*g,y=h*v*l-p*f*l+p*a*d-r*v*d-h*a*g+r*f*g,b=p*f*c-h*v*c-p*a*u+r*v*u+h*a*x-r*f*x,S=t*m+i*z+n*y+s*b;if(S===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let _=1/S;return e[0]=m*_,e[1]=(v*u*s-f*x*s-v*n*d+i*x*d+f*n*g-i*u*g)*_,e[2]=(a*x*s-v*c*s+v*n*l-i*x*l-a*n*g+i*c*g)*_,e[3]=(f*c*s-a*u*s-f*n*l+i*u*l+a*n*d-i*c*d)*_,e[4]=z*_,e[5]=(h*x*s-p*u*s+p*n*d-t*x*d-h*n*g+t*u*g)*_,e[6]=(p*c*s-r*x*s-p*n*l+t*x*l+r*n*g-t*c*g)*_,e[7]=(r*u*s-h*c*s+h*n*l-t*u*l-r*n*d+t*c*d)*_,e[8]=y*_,e[9]=(p*f*s-h*v*s-p*i*d+t*v*d+h*i*g-t*f*g)*_,e[10]=(r*v*s-p*a*s+p*i*l-t*v*l-r*i*g+t*a*g)*_,e[11]=(h*a*s-r*f*s-h*i*l+t*f*l+r*i*d-t*a*d)*_,e[12]=b*_,e[13]=(h*v*n-p*f*n+p*i*u-t*v*u-h*i*x+t*f*x)*_,e[14]=(p*a*n-r*v*n-p*i*c+t*v*c+r*i*x-t*a*x)*_,e[15]=(r*f*n-h*a*n+h*i*c-t*f*c-r*i*u+t*a*u)*_,this}scale(e){let t=this.elements,i=e.x,n=e.y,s=e.z;return t[0]*=i,t[4]*=n,t[8]*=s,t[1]*=i,t[5]*=n,t[9]*=s,t[2]*=i,t[6]*=n,t[10]*=s,t[3]*=i,t[7]*=n,t[11]*=s,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,n))}makeTranslation(e,t,i){return this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let i=Math.cos(t),n=Math.sin(t),s=1-i,r=e.x,a=e.y,c=e.z,l=s*r,h=s*a;return this.set(l*r+i,l*a-n*c,l*c+n*a,0,l*a+n*c,h*a+i,h*c-n*r,0,l*c-n*a,h*c+n*r,s*c*c+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,n,s,r){return this.set(1,i,s,0,e,1,r,0,t,n,1,0,0,0,0,1),this}compose(e,t,i){let n=this.elements,s=t._x,r=t._y,a=t._z,c=t._w,l=s+s,h=r+r,f=a+a,u=s*l,d=s*h,p=s*f,v=r*h,x=r*f,g=a*f,m=c*l,z=c*h,y=c*f,b=i.x,S=i.y,_=i.z;return n[0]=(1-(v+g))*b,n[1]=(d+y)*b,n[2]=(p-z)*b,n[3]=0,n[4]=(d-y)*S,n[5]=(1-(u+g))*S,n[6]=(x+m)*S,n[7]=0,n[8]=(p+z)*_,n[9]=(x-m)*_,n[10]=(1-(u+v))*_,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,this}decompose(e,t,i){let n=this.elements,s=An.set(n[0],n[1],n[2]).length(),r=An.set(n[4],n[5],n[6]).length(),a=An.set(n[8],n[9],n[10]).length();this.determinant()<0&&(s=-s),e.x=n[12],e.y=n[13],e.z=n[14],S1.copy(this);let l=1/s,h=1/r,f=1/a;return S1.elements[0]*=l,S1.elements[1]*=l,S1.elements[2]*=l,S1.elements[4]*=h,S1.elements[5]*=h,S1.elements[6]*=h,S1.elements[8]*=f,S1.elements[9]*=f,S1.elements[10]*=f,t.setFromRotationMatrix(S1),i.x=s,i.y=r,i.z=a,this}makePerspective(e,t,i,n,s,r){r===void 0&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");let a=this.elements,c=2*s/(t-e),l=2*s/(i-n),h=(t+e)/(t-e),f=(i+n)/(i-n),u=-(r+s)/(r-s),d=-2*r*s/(r-s);return a[0]=c,a[4]=0,a[8]=h,a[12]=0,a[1]=0,a[5]=l,a[9]=f,a[13]=0,a[2]=0,a[6]=0,a[10]=u,a[14]=d,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,t,i,n,s,r){let a=this.elements,c=1/(t-e),l=1/(i-n),h=1/(r-s),f=(t+e)*c,u=(i+n)*l,d=(r+s)*h;return a[0]=2*c,a[4]=0,a[8]=0,a[12]=-f,a[1]=0,a[5]=2*l,a[9]=0,a[13]=-u,a[2]=0,a[6]=0,a[10]=-2*h,a[14]=-d,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(e){let t=this.elements,i=e.elements;for(let n=0;n<16;n++)if(t[n]!==i[n])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}};Ce.prototype.isMatrix4=!0;var An=new B,S1=new Ce,Wd=new B(0,0,0),jd=new B(1,1,1),ai=new B,_a=new B,a1=new B,f5=new Ce,d5=new Gt,Bi=class{constructor(e=0,t=0,i=0,n=Bi.DefaultOrder){this._x=e,this._y=t,this._z=i,this._order=n}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,n=this._order){return this._x=e,this._y=t,this._z=i,this._order=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){let n=e.elements,s=n[0],r=n[4],a=n[8],c=n[1],l=n[5],h=n[9],f=n[2],u=n[6],d=n[10];switch(t){case"XYZ":this._y=Math.asin(Jt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-r,s)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Jt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(Jt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-f,d),this._z=Math.atan2(-r,l)):(this._y=0,this._z=Math.atan2(c,s));break;case"ZYX":this._y=Math.asin(-Jt(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(u,d),this._z=Math.atan2(c,s)):(this._x=0,this._z=Math.atan2(-r,l));break;case"YZX":this._z=Math.asin(Jt(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-Jt(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(u,l),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-h,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return f5.makeRotationFromQuaternion(e),this.setFromRotationMatrix(f5,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return d5.setFromEuler(this),this.setFromQuaternion(d5,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}toVector3(e){return e?e.set(this._x,this._y,this._z):new B(this._x,this._y,this._z)}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}};Bi.prototype.isEuler=!0;Bi.DefaultOrder="XYZ";Bi.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];var Bo=class{constructor(){this.mask=1|0}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=4294967295|0}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!=0}isEnabled(e){return(this.mask&(1<<e|0))!=0}},Zd=0,p5=new B,Sn=new Gt,b2=new Ce,Ea=new B,Vs=new B,Xd=new B,Yd=new Gt,m5=new B(1,0,0),g5=new B(0,1,0),v5=new B(0,0,1),$d={type:"added"},x5={type:"removed"},We=class extends ti{constructor(){super();Object.defineProperty(this,"id",{value:Zd++}),this.uuid=C1(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=We.DefaultUp.clone();let e=new B,t=new Bi,i=new Gt,n=new B(1,1,1);function s(){i.setFromEuler(t,!1)}function r(){t.setFromQuaternion(i,void 0,!1)}t._onChange(s),i._onChange(r),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new Ce},normalMatrix:{value:new Tt}}),this.matrix=new Ce,this.matrixWorld=new Ce,this.matrixAutoUpdate=We.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Bo,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Sn.setFromAxisAngle(e,t),this.quaternion.multiply(Sn),this}rotateOnWorldAxis(e,t){return Sn.setFromAxisAngle(e,t),this.quaternion.premultiply(Sn),this}rotateX(e){return this.rotateOnAxis(m5,e)}rotateY(e){return this.rotateOnAxis(g5,e)}rotateZ(e){return this.rotateOnAxis(v5,e)}translateOnAxis(e,t){return p5.copy(e).applyQuaternion(this.quaternion),this.position.add(p5.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(m5,e)}translateY(e){return this.translateOnAxis(g5,e)}translateZ(e){return this.translateOnAxis(v5,e)}localToWorld(e){return e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return e.applyMatrix4(b2.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?Ea.copy(e):Ea.set(e,t,i);let n=this.parent;this.updateWorldMatrix(!0,!1),Vs.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?b2.lookAt(Vs,Ea,this.up):b2.lookAt(Ea,Vs,this.up),this.quaternion.setFromRotationMatrix(b2),n&&(b2.extractRotation(n.matrixWorld),Sn.setFromRotationMatrix(b2),this.quaternion.premultiply(Sn.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent($d)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(x5)),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){for(let e=0;e<this.children.length;e++){let t=this.children[e];t.parent=null,t.dispatchEvent(x5)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),b2.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),b2.multiply(e.parent.matrixWorld)),e.applyMatrix4(b2),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,n=this.children.length;i<n;i++){let r=this.children[i].getObjectByProperty(e,t);if(r!==void 0)return r}}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Vs,e,Xd),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Vs,Yd,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let i=0,n=t.length;i<n;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let i=0,n=t.length;i<n;i++)t[i].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let i=0,n=t.length;i<n;i++)t[i].updateMatrixWorld(e)}updateWorldMatrix(e,t){let i=this.parent;if(e===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){let n=this.children;for(let s=0,r=n.length;s<r;s++)n[s].updateWorldMatrix(!1,!0)}}toJSON(e){let t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});let n={};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.castShadow===!0&&(n.castShadow=!0),this.receiveShadow===!0&&(n.receiveShadow=!0),this.visible===!1&&(n.visible=!1),this.frustumCulled===!1&&(n.frustumCulled=!1),this.renderOrder!==0&&(n.renderOrder=this.renderOrder),JSON.stringify(this.userData)!=="{}"&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),this.matrixAutoUpdate===!1&&(n.matrixAutoUpdate=!1),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(n.instanceColor=this.instanceColor.toJSON()));function s(a,c){return a[c.uuid]===void 0&&(a[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&(n.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.geometry=s(e.geometries,this.geometry);let a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){let c=a.shapes;if(Array.isArray(c))for(let l=0,h=c.length;l<h;l++){let f=c[l];s(e.shapes,f)}else s(e.shapes,c)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let a=[];for(let c=0,l=this.material.length;c<l;c++)a.push(s(e.materials,this.material[c]));n.material=a}else n.material=s(e.materials,this.material);if(this.children.length>0){n.children=[];for(let a=0;a<this.children.length;a++)n.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){n.animations=[];for(let a=0;a<this.animations.length;a++){let c=this.animations[a];n.animations.push(s(e.animations,c))}}if(t){let a=r(e.geometries),c=r(e.materials),l=r(e.textures),h=r(e.images),f=r(e.shapes),u=r(e.skeletons),d=r(e.animations);a.length>0&&(i.geometries=a),c.length>0&&(i.materials=c),l.length>0&&(i.textures=l),h.length>0&&(i.images=h),f.length>0&&(i.shapes=f),u.length>0&&(i.skeletons=u),d.length>0&&(i.animations=d)}return i.object=n,i;function r(a){let c=[];for(let l in a){let h=a[l];delete h.metadata,c.push(h)}return c}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i<e.children.length;i++){let n=e.children[i];this.add(n.clone())}return this}};We.DefaultUp=new B(0,1,0);We.DefaultMatrixAutoUpdate=!0;We.prototype.isObject3D=!0;var _1=new B,M2=new B,Po=new B,z2=new B,_n=new B,En=new B,y5=new B,Io=new B,ko=new B,Oo=new B,xt=class{constructor(e=new B,t=new B,i=new B){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,n){n.subVectors(i,t),_1.subVectors(e,t),n.cross(_1);let s=n.lengthSq();return s>0?n.multiplyScalar(1/Math.sqrt(s)):n.set(0,0,0)}static getBarycoord(e,t,i,n,s){_1.subVectors(n,t),M2.subVectors(i,t),Po.subVectors(e,t);let r=_1.dot(_1),a=_1.dot(M2),c=_1.dot(Po),l=M2.dot(M2),h=M2.dot(Po),f=r*l-a*a;if(f===0)return s.set(-2,-1,-1);let u=1/f,d=(l*c-a*h)*u,p=(r*h-a*c)*u;return s.set(1-d-p,p,d)}static containsPoint(e,t,i,n){return this.getBarycoord(e,t,i,n,z2),z2.x>=0&&z2.y>=0&&z2.x+z2.y<=1}static getUV(e,t,i,n,s,r,a,c){return this.getBarycoord(e,t,i,n,z2),c.set(0,0),c.addScaledVector(s,z2.x),c.addScaledVector(r,z2.y),c.addScaledVector(a,z2.z),c}static isFrontFacing(e,t,i,n){return _1.subVectors(i,t),M2.subVectors(e,t),_1.cross(M2).dot(n)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,n){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[n]),this}setFromAttributeAndIndices(e,t,i,n){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return _1.subVectors(this.c,this.b),M2.subVectors(this.a,this.b),_1.cross(M2).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return xt.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return xt.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,n,s){return xt.getUV(e,this.a,this.b,this.c,t,i,n,s)}containsPoint(e){return xt.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return xt.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let i=this.a,n=this.b,s=this.c,r,a;_n.subVectors(n,i),En.subVectors(s,i),Io.subVectors(e,i);let c=_n.dot(Io),l=En.dot(Io);if(c<=0&&l<=0)return t.copy(i);ko.subVectors(e,n);let h=_n.dot(ko),f=En.dot(ko);if(h>=0&&f<=h)return t.copy(n);let u=c*f-h*l;if(u<=0&&c>=0&&h<=0)return r=c/(c-h),t.copy(i).addScaledVector(_n,r);Oo.subVectors(e,s);let d=_n.dot(Oo),p=En.dot(Oo);if(p>=0&&d<=p)return t.copy(s);let v=d*l-c*p;if(v<=0&&l>=0&&p<=0)return a=l/(l-p),t.copy(i).addScaledVector(En,a);let x=h*p-d*f;if(x<=0&&f-h>=0&&d-p>=0)return y5.subVectors(s,n),a=(f-h)/(f-h+(d-p)),t.copy(n).addScaledVector(y5,a);let g=1/(x+v+u);return r=v*g,a=u*g,t.copy(i).addScaledVector(_n,r).addScaledVector(En,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},Jd=0,St=class extends ti{constructor(){super();Object.defineProperty(this,"id",{value:Jd++}),this.uuid=C1(),this.name="",this.type="Material",this.fog=!0,this.blending=Ss,this.side=As,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=H8,this.blendDst=V8,this.blendEquation=dn,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=lo,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=kd,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Mo,this.stencilZFail=Mo,this.stencilZPass=Mo,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.alphaWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let i=e[t];if(i===void 0){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}if(t==="shading"){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=i===S8;continue}let n=this[t];if(n===void 0){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[t]=i}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==Ss&&(i.blending=this.blending),this.side!==As&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.alphaWrite=this.alphaWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,this.rotation&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(i.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=this.flatShading),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),JSON.stringify(this.userData)!=="{}"&&(i.userData=this.userData);function n(s){let r=[];for(let a in s){let c=s[a];delete c.metadata,r.push(c)}return r}if(t){let s=n(e.textures),r=n(e.images);s.length>0&&(i.textures=s),r.length>0&&(i.images=r)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,i=null;if(t!==null){let n=t.length;i=new Array(n);for(let s=0;s!==n;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.alphaWrite=e.alphaWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}};St.prototype.isMaterial=!0;var La=class extends St{constructor(e){super();this.type="MeshBasicMaterial",this.color=new xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=fa,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}};La.prototype.isMeshBasicMaterial=!0;var it=new B,Ta=new te,wt=class{constructor(e,t,i){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i===!0,this.usage=Ts,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let n=0,s=this.itemSize;n<s;n++)this.array[e+n]=t.array[i+n];return this}copyArray(e){return this.array.set(e),this}copyColorsArray(e){let t=this.array,i=0;for(let n=0,s=e.length;n<s;n++){let r=e[n];r===void 0&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",n),r=new xe),t[i++]=r.r,t[i++]=r.g,t[i++]=r.b}return this}copyVector2sArray(e){let t=this.array,i=0;for(let n=0,s=e.length;n<s;n++){let r=e[n];r===void 0&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",n),r=new te),t[i++]=r.x,t[i++]=r.y}return this}copyVector3sArray(e){let t=this.array,i=0;for(let n=0,s=e.length;n<s;n++){let r=e[n];r===void 0&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",n),r=new B),t[i++]=r.x,t[i++]=r.y,t[i++]=r.z}return this}copyVector4sArray(e){let t=this.array,i=0;for(let n=0,s=e.length;n<s;n++){let r=e[n];r===void 0&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",n),r=new Qe),t[i++]=r.x,t[i++]=r.y,t[i++]=r.z,t[i++]=r.w}return this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)Ta.fromBufferAttribute(this,t),Ta.applyMatrix3(e),this.setXY(t,Ta.x,Ta.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)it.fromBufferAttribute(this,t),it.applyMatrix3(e),this.setXYZ(t,it.x,it.y,it.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)it.x=this.getX(t),it.y=this.getY(t),it.z=this.getZ(t),it.applyMatrix4(e),this.setXYZ(t,it.x,it.y,it.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)it.x=this.getX(t),it.y=this.getY(t),it.z=this.getZ(t),it.applyNormalMatrix(e),this.setXYZ(t,it.x,it.y,it.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)it.x=this.getX(t),it.y=this.getY(t),it.z=this.getZ(t),it.transformDirection(e),this.setXYZ(t,it.x,it.y,it.z);return this}set(e,t=0){return this.array.set(e,t),this}getX(e){return this.array[e*this.itemSize]}setX(e,t){return this.array[e*this.itemSize]=t,this}getY(e){return this.array[e*this.itemSize+1]}setY(e,t){return this.array[e*this.itemSize+1]=t,this}getZ(e){return this.array[e*this.itemSize+2]}setZ(e,t){return this.array[e*this.itemSize+2]=t,this}getW(e){return this.array[e*this.itemSize+3]}setW(e,t){return this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this}setXYZW(e,t,i,n,s){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Ts&&(e.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(e.updateRange=this.updateRange),e}};wt.prototype.isBufferAttribute=!0;var Uo=class extends wt{constructor(e,t,i){super(new Uint16Array(e),t,i)}};var Go=class extends wt{constructor(e,t,i){super(new Uint32Array(e),t,i)}},w5=class extends wt{constructor(e,t,i){super(new Uint16Array(e),t,i)}};w5.prototype.isFloat16BufferAttribute=!0;var _t=class extends wt{constructor(e,t,i){super(new Float32Array(e),t,i)}};var Qd=0,d1=new Ce,qo=new We,Ln=new B,o1=new f1,Rs=new f1,Dt=new B,rt=class extends ti{constructor(){super();Object.defineProperty(this,"id",{value:Qd++}),this.uuid=C1(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(o5(e)?Go:Uo)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let i=this.attributes.normal;if(i!==void 0){let s=new Tt().getNormalMatrix(e);i.applyNormalMatrix(s),i.needsUpdate=!0}let n=this.attributes.tangent;return n!==void 0&&(n.transformDirection(e),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return d1.makeRotationFromQuaternion(e),this.applyMatrix4(d1),this}rotateX(e){return d1.makeRotationX(e),this.applyMatrix4(d1),this}rotateY(e){return d1.makeRotationY(e),this.applyMatrix4(d1),this}rotateZ(e){return d1.makeRotationZ(e),this.applyMatrix4(d1),this}translate(e,t,i){return d1.makeTranslation(e,t,i),this.applyMatrix4(d1),this}scale(e,t,i){return d1.makeScale(e,t,i),this.applyMatrix4(d1),this}lookAt(e){return qo.lookAt(e),qo.updateMatrix(),this.applyMatrix4(qo.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ln).negate(),this.translate(Ln.x,Ln.y,Ln.z),this}setFromPoints(e){let t=[];for(let i=0,n=e.length;i<n;i++){let s=e[i];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new _t(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new f1);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingBox.set(new B(-1/0,-1/0,-1/0),new B(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,n=t.length;i<n;i++){let s=t[i];o1.setFromBufferAttribute(s),this.morphTargetsRelative?(Dt.addVectors(this.boundingBox.min,o1.min),this.boundingBox.expandByPoint(Dt),Dt.addVectors(this.boundingBox.max,o1.max),this.boundingBox.expandByPoint(Dt)):(this.boundingBox.expandByPoint(o1.min),this.boundingBox.expandByPoint(o1.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Ni);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingSphere.set(new B,1/0);return}if(e){let i=this.boundingSphere.center;if(o1.setFromBufferAttribute(e),t)for(let s=0,r=t.length;s<r;s++){let a=t[s];Rs.setFromBufferAttribute(a),this.morphTargetsRelative?(Dt.addVectors(o1.min,Rs.min),o1.expandByPoint(Dt),Dt.addVectors(o1.max,Rs.max),o1.expandByPoint(Dt)):(o1.expandByPoint(Rs.min),o1.expandByPoint(Rs.max))}o1.getCenter(i);let n=0;for(let s=0,r=e.count;s<r;s++)Dt.fromBufferAttribute(e,s),n=Math.max(n,i.distanceToSquared(Dt));if(t)for(let s=0,r=t.length;s<r;s++){let a=t[s],c=this.morphTargetsRelative;for(let l=0,h=a.count;l<h;l++)Dt.fromBufferAttribute(a,l),c&&(Ln.fromBufferAttribute(e,l),Dt.add(Ln)),n=Math.max(n,i.distanceToSquared(Dt))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let i=e.array,n=t.position.array,s=t.normal.array,r=t.uv.array,a=n.length/3;t.tangent===void 0&&this.setAttribute("tangent",new wt(new Float32Array(4*a),4));let c=t.tangent.array,l=[],h=[];for(let R=0;R<a;R++)l[R]=new B,h[R]=new B;let f=new B,u=new B,d=new B,p=new te,v=new te,x=new te,g=new B,m=new B;function z(R,w,D){f.fromArray(n,R*3),u.fromArray(n,w*3),d.fromArray(n,D*3),p.fromArray(r,R*2),v.fromArray(r,w*2),x.fromArray(r,D*2),u.sub(f),d.sub(f),v.sub(p),x.sub(p);let C=1/(v.x*x.y-x.x*v.y);!isFinite(C)||(g.copy(u).multiplyScalar(x.y).addScaledVector(d,-v.y).multiplyScalar(C),m.copy(d).multiplyScalar(v.x).addScaledVector(u,-x.x).multiplyScalar(C),l[R].add(g),l[w].add(g),l[D].add(g),h[R].add(m),h[w].add(m),h[D].add(m))}let y=this.groups;y.length===0&&(y=[{start:0,count:i.length}]);for(let R=0,w=y.length;R<w;++R){let D=y[R],C=D.start,V=D.count;for(let H=C,T=C+V;H<T;H+=3)z(i[H+0],i[H+1],i[H+2])}let b=new B,S=new B,_=new B,A=new B;function P(R){_.fromArray(s,R*3),A.copy(_);let w=l[R];b.copy(w),b.sub(_.multiplyScalar(_.dot(w))).normalize(),S.crossVectors(A,w);let C=S.dot(h[R])<0?-1:1;c[R*4]=b.x,c[R*4+1]=b.y,c[R*4+2]=b.z,c[R*4+3]=C}for(let R=0,w=y.length;R<w;++R){let D=y[R],C=D.start,V=D.count;for(let H=C,T=C+V;H<T;H+=3)P(i[H+0]),P(i[H+1]),P(i[H+2])}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new wt(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let u=0,d=i.count;u<d;u++)i.setXYZ(u,0,0,0);let n=new B,s=new B,r=new B,a=new B,c=new B,l=new B,h=new B,f=new B;if(e)for(let u=0,d=e.count;u<d;u+=3){let p=e.getX(u+0),v=e.getX(u+1),x=e.getX(u+2);n.fromBufferAttribute(t,p),s.fromBufferAttribute(t,v),r.fromBufferAttribute(t,x),h.subVectors(r,s),f.subVectors(n,s),h.cross(f),a.fromBufferAttribute(i,p),c.fromBufferAttribute(i,v),l.fromBufferAttribute(i,x),a.add(h),c.add(h),l.add(h),i.setXYZ(p,a.x,a.y,a.z),i.setXYZ(v,c.x,c.y,c.z),i.setXYZ(x,l.x,l.y,l.z)}else for(let u=0,d=t.count;u<d;u+=3)n.fromBufferAttribute(t,u+0),s.fromBufferAttribute(t,u+1),r.fromBufferAttribute(t,u+2),h.subVectors(r,s),f.subVectors(n,s),h.cross(f),i.setXYZ(u+0,h.x,h.y,h.z),i.setXYZ(u+1,h.x,h.y,h.z),i.setXYZ(u+2,h.x,h.y,h.z);this.normalizeNormals(),i.needsUpdate=!0}}merge(e,t){if(!(e&&e.isBufferGeometry)){console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e);return}t===void 0&&(t=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));let i=this.attributes;for(let n in i){if(e.attributes[n]===void 0)continue;let r=i[n].array,a=e.attributes[n],c=a.array,l=a.itemSize*t,h=Math.min(c.length,r.length-l);for(let f=0,u=l;f<h;f++,u++)r[u]=c[f]}return this}normalizeNormals(){let e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)Dt.fromBufferAttribute(e,t),Dt.normalize(),e.setXYZ(t,Dt.x,Dt.y,Dt.z)}toNonIndexed(){function e(a,c){let l=a.array,h=a.itemSize,f=a.normalized,u=new l.constructor(c.length*h),d=0,p=0;for(let v=0,x=c.length;v<x;v++){a.isInterleavedBufferAttribute?d=c[v]*a.data.stride+a.offset:d=c[v]*h;for(let g=0;g<h;g++)u[p++]=l[d++]}return new wt(u,h,f)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new rt,i=this.index.array,n=this.attributes;for(let a in n){let c=n[a],l=e(c,i);t.setAttribute(a,l)}let s=this.morphAttributes;for(let a in s){let c=[],l=s[a];for(let h=0,f=l.length;h<f;h++){let u=l[h],d=e(u,i);c.push(d)}t.morphAttributes[a]=c}t.morphTargetsRelative=this.morphTargetsRelative;let r=this.groups;for(let a=0,c=r.length;a<c;a++){let l=r[a];t.addGroup(l.start,l.count,l.materialIndex)}return t}toJSON(){let e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){let c=this.parameters;for(let l in c)c[l]!==void 0&&(e[l]=c[l]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let i=this.attributes;for(let c in i){let l=i[c];e.data.attributes[c]=l.toJSON(e.data)}let n={},s=!1;for(let c in this.morphAttributes){let l=this.morphAttributes[c],h=[];for(let f=0,u=l.length;f<u;f++){let d=l[f];h.push(d.toJSON(e.data))}h.length>0&&(n[c]=h,s=!0)}s&&(e.data.morphAttributes=n,e.data.morphTargetsRelative=this.morphTargetsRelative);let r=this.groups;r.length>0&&(e.data.groups=JSON.parse(JSON.stringify(r)));let a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let i=e.index;i!==null&&this.setIndex(i.clone(t));let n=e.attributes;for(let l in n){let h=n[l];this.setAttribute(l,h.clone(t))}let s=e.morphAttributes;for(let l in s){let h=[],f=s[l];for(let u=0,d=f.length;u<d;u++)h.push(f[u].clone(t));this.morphAttributes[l]=h}this.morphTargetsRelative=e.morphTargetsRelative;let r=e.groups;for(let l=0,h=r.length;l<h;l++){let f=r[l];this.addGroup(f.start,f.count,f.materialIndex)}let a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());let c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,e.parameters!==void 0&&(this.parameters=Object.assign({},e.parameters)),this}dispose(){this.dispatchEvent({type:"dispose"})}};rt.prototype.isBufferGeometry=!0;var b5=new Ce,Tn=new Fi,Wo=new Ni,oi=new B,ci=new B,li=new B,jo=new B,Zo=new B,Xo=new B,Da=new B,Ha=new B,Va=new B,Ra=new te,Na=new te,Fa=new te,Yo=new B,Ba=new B,Rt=class extends We{constructor(e=new rt,t=new La){super();this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry;if(e.isBufferGeometry){let t=e.morphAttributes,i=Object.keys(t);if(i.length>0){let n=t[i[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,r=n.length;s<r;s++){let a=n[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}else{let t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(e,t){let i=this.geometry,n=this.material,s=this.matrixWorld;if(n===void 0||(i.boundingSphere===null&&i.computeBoundingSphere(),Wo.copy(i.boundingSphere),Wo.applyMatrix4(s),e.ray.intersectsSphere(Wo)===!1)||(b5.copy(s).invert(),Tn.copy(e.ray).applyMatrix4(b5),i.boundingBox!==null&&Tn.intersectsBox(i.boundingBox)===!1))return;let r;if(i.isBufferGeometry){let a=i.index,c=i.attributes.position,l=i.morphAttributes.position,h=i.morphTargetsRelative,f=i.attributes.uv,u=i.attributes.uv2,d=i.groups,p=i.drawRange;if(a!==null)if(Array.isArray(n))for(let v=0,x=d.length;v<x;v++){let g=d[v],m=n[g.materialIndex],z=Math.max(g.start,p.start),y=Math.min(a.count,Math.min(g.start+g.count,p.start+p.count));for(let b=z,S=y;b<S;b+=3){let _=a.getX(b),A=a.getX(b+1),P=a.getX(b+2);r=Pa(this,m,e,Tn,c,l,h,f,u,_,A,P),r&&(r.faceIndex=Math.floor(b/3),r.face.materialIndex=g.materialIndex,t.push(r))}}else{let v=Math.max(0,p.start),x=Math.min(a.count,p.start+p.count);for(let g=v,m=x;g<m;g+=3){let z=a.getX(g),y=a.getX(g+1),b=a.getX(g+2);r=Pa(this,n,e,Tn,c,l,h,f,u,z,y,b),r&&(r.faceIndex=Math.floor(g/3),t.push(r))}}else if(c!==void 0)if(Array.isArray(n))for(let v=0,x=d.length;v<x;v++){let g=d[v],m=n[g.materialIndex],z=Math.max(g.start,p.start),y=Math.min(c.count,Math.min(g.start+g.count,p.start+p.count));for(let b=z,S=y;b<S;b+=3){let _=b,A=b+1,P=b+2;r=Pa(this,m,e,Tn,c,l,h,f,u,_,A,P),r&&(r.faceIndex=Math.floor(b/3),r.face.materialIndex=g.materialIndex,t.push(r))}}else{let v=Math.max(0,p.start),x=Math.min(c.count,p.start+p.count);for(let g=v,m=x;g<m;g+=3){let z=g,y=g+1,b=g+2;r=Pa(this,n,e,Tn,c,l,h,f,u,z,y,b),r&&(r.faceIndex=Math.floor(g/3),t.push(r))}}}else i.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}};Rt.prototype.isMesh=!0;function Kd(o,e,t,i,n,s,r,a){let c;if(e.side===Ct?c=i.intersectTriangle(r,s,n,!0,a):c=i.intersectTriangle(n,s,r,e.side!==fn,a),c===null)return null;Ba.copy(a),Ba.applyMatrix4(o.matrixWorld);let l=t.ray.origin.distanceTo(Ba);return l<t.near||l>t.far?null:{distance:l,point:Ba.clone(),object:o}}function Pa(o,e,t,i,n,s,r,a,c,l,h,f){oi.fromBufferAttribute(n,l),ci.fromBufferAttribute(n,h),li.fromBufferAttribute(n,f);let u=o.morphTargetInfluences;if(s&&u){Da.set(0,0,0),Ha.set(0,0,0),Va.set(0,0,0);for(let p=0,v=s.length;p<v;p++){let x=u[p],g=s[p];x!==0&&(jo.fromBufferAttribute(g,l),Zo.fromBufferAttribute(g,h),Xo.fromBufferAttribute(g,f),r?(Da.addScaledVector(jo,x),Ha.addScaledVector(Zo,x),Va.addScaledVector(Xo,x)):(Da.addScaledVector(jo.sub(oi),x),Ha.addScaledVector(Zo.sub(ci),x),Va.addScaledVector(Xo.sub(li),x)))}oi.add(Da),ci.add(Ha),li.add(Va)}o.isSkinnedMesh&&(o.boneTransform(l,oi),o.boneTransform(h,ci),o.boneTransform(f,li));let d=Kd(o,e,t,i,oi,ci,li,Yo);if(d){a&&(Ra.fromBufferAttribute(a,l),Na.fromBufferAttribute(a,h),Fa.fromBufferAttribute(a,f),d.uv=xt.getUV(Yo,oi,ci,li,Ra,Na,Fa,new te)),c&&(Ra.fromBufferAttribute(c,l),Na.fromBufferAttribute(c,h),Fa.fromBufferAttribute(c,f),d.uv2=xt.getUV(Yo,oi,ci,li,Ra,Na,Fa,new te));let p={a:l,b:h,c:f,normal:new B,materialIndex:0};xt.getNormal(oi,ci,li,p.normal),d.face=p}return d}var Dn=class extends rt{constructor(e=1,t=1,i=1,n=1,s=1,r=1){super();this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:n,heightSegments:s,depthSegments:r};let a=this;n=Math.floor(n),s=Math.floor(s),r=Math.floor(r);let c=[],l=[],h=[],f=[],u=0,d=0;p("z","y","x",-1,-1,i,t,e,r,s,0),p("z","y","x",1,-1,i,t,-e,r,s,1),p("x","z","y",1,1,e,i,t,n,r,2),p("x","z","y",1,-1,e,i,-t,n,r,3),p("x","y","z",1,-1,e,t,i,n,s,4),p("x","y","z",-1,-1,e,t,-i,n,s,5),this.setIndex(c),this.setAttribute("position",new _t(l,3)),this.setAttribute("normal",new _t(h,3)),this.setAttribute("uv",new _t(f,2));function p(v,x,g,m,z,y,b,S,_,A,P){let R=y/_,w=b/A,D=y/2,C=b/2,V=S/2,H=_+1,T=A+1,N=0,I=0,j=new B;for(let O=0;O<T;O++){let q=O*w-C;for(let Z=0;Z<H;Z++){let ne=Z*R-D;j[v]=ne*m,j[x]=q*z,j[g]=V,l.push(j.x,j.y,j.z),j[v]=0,j[x]=0,j[g]=S>0?1:-1,h.push(j.x,j.y,j.z),f.push(Z/_),f.push(1-O/A),N+=1}}for(let O=0;O<A;O++)for(let q=0;q<_;q++){let Z=u+q+H*O,ne=u+q+H*(O+1),ce=u+(q+1)+H*(O+1),U=u+(q+1)+H*O;c.push(Z,ne,U),c.push(ne,ce,U),I+=6}a.addGroup(d,I,P),d+=I,u+=N}}static fromJSON(e){return new Dn(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};function Hn(o){let e={};for(let t in o){e[t]={};for(let i in o[t]){let n=o[t][i];n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture||n.isQuaternion)?e[t][i]=n.clone():Array.isArray(n)?e[t][i]=n.slice():e[t][i]=n}}return e}function It(o){let e={};for(let t=0;t<o.length;t++){let i=Hn(o[t]);for(let n in i)e[n]=i[n]}return e}var ep={clone:Hn,merge:It},tp=`void main() {
|
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
}`,ip=`void main() {
|
|
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
}`,hi=class extends St{constructor(e){super();this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=tp,this.fragmentShader=ip,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&(e.attributes!==void 0&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Hn(e.uniforms),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let n in this.uniforms){let r=this.uniforms[n].value;r&&r.isTexture?t.uniforms[n]={type:"t",value:r.toJSON(e).uuid}:r&&r.isColor?t.uniforms[n]={type:"c",value:r.getHex()}:r&&r.isVector2?t.uniforms[n]={type:"v2",value:r.toArray()}:r&&r.isVector3?t.uniforms[n]={type:"v3",value:r.toArray()}:r&&r.isVector4?t.uniforms[n]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?t.uniforms[n]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?t.uniforms[n]={type:"m4",value:r.toArray()}:t.uniforms[n]={value:r}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;let i={};for(let n in this.extensions)this.extensions[n]===!0&&(i[n]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}};hi.prototype.isShaderMaterial=!0;var Ia=class extends We{constructor(){super();this.type="Camera",this.matrixWorldInverse=new Ce,this.projectionMatrix=new Ce,this.projectionMatrixInverse=new Ce}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}};Ia.prototype.isCamera=!0;var Nt=class extends Ia{constructor(e=50,t=1,i=.1,n=2e3){super();this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=n,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=Ao*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(Co*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ao*2*Math.atan(Math.tan(Co*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,i,n,s,r){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=n,this.view.width=s,this.view.height=r,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(Co*.5*this.fov)/this.zoom,i=2*t,n=this.aspect*i,s=-.5*n,r=this.view;if(this.view!==null&&this.view.enabled){let c=r.fullWidth,l=r.fullHeight;s+=r.offsetX*n/c,t-=r.offsetY*i/l,n*=r.width/c,i*=r.height/l}let a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+n,t,t-i,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}};Nt.prototype.isPerspectiveCamera=!0;var Vn=90,Rn=1,ka=class extends We{constructor(e,t,i){super();if(this.type="CubeCamera",i.isWebGLCubeRenderTarget!==!0){console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");return}this.renderTarget=i;let n=new Nt(Vn,Rn,e,t);n.layers=this.layers,n.up.set(0,-1,0),n.lookAt(new B(1,0,0)),this.add(n);let s=new Nt(Vn,Rn,e,t);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new B(-1,0,0)),this.add(s);let r=new Nt(Vn,Rn,e,t);r.layers=this.layers,r.up.set(0,0,1),r.lookAt(new B(0,1,0)),this.add(r);let a=new Nt(Vn,Rn,e,t);a.layers=this.layers,a.up.set(0,0,-1),a.lookAt(new B(0,-1,0)),this.add(a);let c=new Nt(Vn,Rn,e,t);c.layers=this.layers,c.up.set(0,-1,0),c.lookAt(new B(0,0,1)),this.add(c);let l=new Nt(Vn,Rn,e,t);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new B(0,0,-1)),this.add(l)}update(e,t){this.parent===null&&this.updateMatrixWorld();let i=this.renderTarget,[n,s,r,a,c,l]=this.children,h=e.xr.enabled,f=e.getRenderTarget();e.xr.enabled=!1;let u=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0),e.render(t,n),e.setRenderTarget(i,1),e.render(t,s),e.setRenderTarget(i,2),e.render(t,r),e.setRenderTarget(i,3),e.render(t,a),e.setRenderTarget(i,4),e.render(t,c),i.texture.generateMipmaps=u,e.setRenderTarget(i,5),e.render(t,l),e.setRenderTarget(f),e.xr.enabled=h,i.texture.needsPMREMUpdate=!0}},Ns=class extends vt{constructor(e,t,i,n,s,r,a,c,l,h){e=e!==void 0?e:[],t=t!==void 0?t:_s;super(e,t,i,n,s,r,a,c,l,h);this.flipY=!1}get images(){return this.image}set images(e){this.image=e}};Ns.prototype.isCubeTexture=!0;var $o=class extends r1{constructor(e,t,i){Number.isInteger(t)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),t=i);super(e,e,t);t=t||{},this.texture=new Ns(void 0,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Pt}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.format=Ut,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let i={uniforms:{tEquirect:{value:null}},vertexShader:`
|
|
|
|
varying vec3 vWorldDirection;
|
|
|
|
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
|
|
|
|
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
|
|
|
|
}
|
|
|
|
void main() {
|
|
|
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|
|
|
#include <begin_vertex>
|
|
#include <project_vertex>
|
|
|
|
}
|
|
`,fragmentShader:`
|
|
|
|
uniform sampler2D tEquirect;
|
|
|
|
varying vec3 vWorldDirection;
|
|
|
|
#include <common>
|
|
|
|
void main() {
|
|
|
|
vec3 direction = normalize( vWorldDirection );
|
|
|
|
vec2 sampleUV = equirectUv( direction );
|
|
|
|
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
|
|
}
|
|
`},n=new Dn(5,5,5),s=new hi({name:"CubemapFromEquirect",uniforms:Hn(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Ct,blending:J2});s.uniforms.tEquirect.value=t;let r=new Rt(n,s),a=t.minFilter;return t.minFilter===pa&&(t.minFilter=Pt),new ka(1,10,this).update(e,r),t.minFilter=a,r.geometry.dispose(),r.material.dispose(),this}clear(e,t,i,n){let s=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(t,i,n);e.setRenderTarget(s)}};$o.prototype.isWebGLCubeRenderTarget=!0;var Jo=new B,np=new B,sp=new Tt,q1=class{constructor(e=new B(1,0,0),t=0){this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,n){return this.normal.set(e,t,i),this.constant=n,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){let n=Jo.subVectors(i,t).cross(np.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(n,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){let i=e.delta(Jo),n=this.normal.dot(i);if(n===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let s=-(e.start.dot(this.normal)+this.constant)/n;return s<0||s>1?null:t.copy(i).multiplyScalar(s).add(e.start)}intersectsLine(e){let t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let i=t||sp.getNormalMatrix(e),n=this.coplanarPoint(Jo).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}};q1.prototype.isPlane=!0;var Nn=new Ni,Oa=new B,Fs=class{constructor(e=new q1,t=new q1,i=new q1,n=new q1,s=new q1,r=new q1){this.planes=[e,t,i,n,s,r]}set(e,t,i,n,s,r){let a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(n),a[4].copy(s),a[5].copy(r),this}copy(e){let t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e){let t=this.planes,i=e.elements,n=i[0],s=i[1],r=i[2],a=i[3],c=i[4],l=i[5],h=i[6],f=i[7],u=i[8],d=i[9],p=i[10],v=i[11],x=i[12],g=i[13],m=i[14],z=i[15];return t[0].setComponents(a-n,f-c,v-u,z-x).normalize(),t[1].setComponents(a+n,f+c,v+u,z+x).normalize(),t[2].setComponents(a+s,f+l,v+d,z+g).normalize(),t[3].setComponents(a-s,f-l,v-d,z-g).normalize(),t[4].setComponents(a-r,f-h,v-p,z-m).normalize(),t[5].setComponents(a+r,f+h,v+p,z+m).normalize(),this}intersectsObject(e){let t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),Nn.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Nn)}intersectsSprite(e){return Nn.center.set(0,0,0),Nn.radius=.7071067811865476,Nn.applyMatrix4(e.matrixWorld),this.intersectsSphere(Nn)}intersectsSphere(e){let t=this.planes,i=e.center,n=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)<n)return!1;return!0}intersectsBox(e){let t=this.planes;for(let i=0;i<6;i++){let n=t[i];if(Oa.x=n.normal.x>0?e.max.x:e.min.x,Oa.y=n.normal.y>0?e.max.y:e.min.y,Oa.z=n.normal.z>0?e.max.z:e.min.z,n.distanceToPoint(Oa)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}};function M5(){let o=null,e=!1,t=null,i=null;function n(s,r){t(s,r),i=o.requestAnimationFrame(n)}return{start:function(){e!==!0&&t!==null&&(i=o.requestAnimationFrame(n),e=!0)},stop:function(){o.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){o=s}}}function rp(o,e){let t=e.isWebGL2,i=new WeakMap;function n(l,h){let f=l.array,u=l.usage,d=o.createBuffer();o.bindBuffer(h,d),o.bufferData(h,f,u),l.onUploadCallback();let p=5126;return f instanceof Float32Array?p=5126:f instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):f instanceof Uint16Array?l.isFloat16BufferAttribute?t?p=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):p=5123:f instanceof Int16Array?p=5122:f instanceof Uint32Array?p=5125:f instanceof Int32Array?p=5124:f instanceof Int8Array?p=5120:(f instanceof Uint8Array||f instanceof Uint8ClampedArray)&&(p=5121),{buffer:d,type:p,bytesPerElement:f.BYTES_PER_ELEMENT,version:l.version}}function s(l,h,f){let u=h.array,d=h.updateRange;o.bindBuffer(f,l),d.count===-1?o.bufferSubData(f,0,u):(t?o.bufferSubData(f,d.offset*u.BYTES_PER_ELEMENT,u,d.offset,d.count):o.bufferSubData(f,d.offset*u.BYTES_PER_ELEMENT,u.subarray(d.offset,d.offset+d.count)),d.count=-1)}function r(l){return l.isInterleavedBufferAttribute&&(l=l.data),i.get(l)}function a(l){l.isInterleavedBufferAttribute&&(l=l.data);let h=i.get(l);h&&(o.deleteBuffer(h.buffer),i.delete(l))}function c(l,h){if(l.isGLBufferAttribute){let u=i.get(l);(!u||u.version<l.version)&&i.set(l,{buffer:l.buffer,type:l.type,bytesPerElement:l.elementSize,version:l.version});return}l.isInterleavedBufferAttribute&&(l=l.data);let f=i.get(l);f===void 0?i.set(l,n(l,h)):f.version<l.version&&(s(f.buffer,l,h),f.version=l.version)}return{get:r,remove:a,update:c}}var Fn=class extends rt{constructor(e=1,t=1,i=1,n=1){super();this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:n};let s=e/2,r=t/2,a=Math.floor(i),c=Math.floor(n),l=a+1,h=c+1,f=e/a,u=t/c,d=[],p=[],v=[],x=[];for(let g=0;g<h;g++){let m=g*u-r;for(let z=0;z<l;z++){let y=z*f-s;p.push(y,-m,0),v.push(0,0,1),x.push(z/a),x.push(1-g/c)}}for(let g=0;g<c;g++)for(let m=0;m<a;m++){let z=m+l*g,y=m+l*(g+1),b=m+1+l*(g+1),S=m+1+l*g;d.push(z,y,S),d.push(y,b,S)}this.setIndex(d),this.setAttribute("position",new _t(p,3)),this.setAttribute("normal",new _t(v,3)),this.setAttribute("uv",new _t(x,2))}static fromJSON(e){return new Fn(e.width,e.height,e.widthSegments,e.heightSegments)}},ap=`#ifdef USE_ALPHAMAP
|
|
diffuseColor.a *= texture2D( alphaMap, vUv ).g;
|
|
#endif`,op=`#ifdef USE_ALPHAMAP
|
|
uniform sampler2D alphaMap;
|
|
#endif`,cp=`#ifdef USE_ALPHATEST
|
|
if ( diffuseColor.a < alphaTest ) discard;
|
|
#endif`,lp=`#ifdef USE_ALPHATEST
|
|
uniform float alphaTest;
|
|
#endif`,hp=`#ifdef USE_AOMAP
|
|
float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;
|
|
reflectedLight.indirectDiffuse *= ambientOcclusion;
|
|
#if defined( USE_ENVMAP ) && defined( STANDARD )
|
|
float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
|
|
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
|
|
#endif
|
|
#endif`,up=`#ifdef USE_AOMAP
|
|
uniform sampler2D aoMap;
|
|
uniform float aoMapIntensity;
|
|
#endif`,fp="vec3 transformed = vec3( position );",dp=`vec3 objectNormal = vec3( normal );
|
|
#ifdef USE_TANGENT
|
|
vec3 objectTangent = vec3( tangent.xyz );
|
|
#endif`,pp=`vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
|
|
return RECIPROCAL_PI * diffuseColor;
|
|
}
|
|
vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
|
|
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
|
|
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
|
|
}
|
|
float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
|
|
float a2 = pow2( alpha );
|
|
float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
|
|
float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
|
|
return 0.5 / max( gv + gl, EPSILON );
|
|
}
|
|
float D_GGX( const in float alpha, const in float dotNH ) {
|
|
float a2 = pow2( alpha );
|
|
float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
|
|
return RECIPROCAL_PI * a2 / pow2( denom );
|
|
}
|
|
vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) {
|
|
float alpha = pow2( roughness );
|
|
vec3 halfDir = normalize( lightDir + viewDir );
|
|
float dotNL = saturate( dot( normal, lightDir ) );
|
|
float dotNV = saturate( dot( normal, viewDir ) );
|
|
float dotNH = saturate( dot( normal, halfDir ) );
|
|
float dotVH = saturate( dot( viewDir, halfDir ) );
|
|
vec3 F = F_Schlick( f0, f90, dotVH );
|
|
float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
|
|
float D = D_GGX( alpha, dotNH );
|
|
return F * ( V * D );
|
|
}
|
|
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
|
|
const float LUT_SIZE = 64.0;
|
|
const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
|
|
const float LUT_BIAS = 0.5 / LUT_SIZE;
|
|
float dotNV = saturate( dot( N, V ) );
|
|
vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
|
|
uv = uv * LUT_SCALE + LUT_BIAS;
|
|
return uv;
|
|
}
|
|
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
|
|
float l = length( f );
|
|
return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
|
|
}
|
|
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
|
|
float x = dot( v1, v2 );
|
|
float y = abs( x );
|
|
float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
|
|
float b = 3.4175940 + ( 4.1616724 + y ) * y;
|
|
float v = a / b;
|
|
float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
|
|
return cross( v1, v2 ) * theta_sintheta;
|
|
}
|
|
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
|
|
vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
|
|
vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
|
|
vec3 lightNormal = cross( v1, v2 );
|
|
if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
|
|
vec3 T1, T2;
|
|
T1 = normalize( V - N * dot( V, N ) );
|
|
T2 = - cross( N, T1 );
|
|
mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
|
|
vec3 coords[ 4 ];
|
|
coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
|
|
coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
|
|
coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
|
|
coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
|
|
coords[ 0 ] = normalize( coords[ 0 ] );
|
|
coords[ 1 ] = normalize( coords[ 1 ] );
|
|
coords[ 2 ] = normalize( coords[ 2 ] );
|
|
coords[ 3 ] = normalize( coords[ 3 ] );
|
|
vec3 vectorFormFactor = vec3( 0.0 );
|
|
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
|
|
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
|
|
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
|
|
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
|
|
float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
|
|
return vec3( result );
|
|
}
|
|
float G_BlinnPhong_Implicit( ) {
|
|
return 0.25;
|
|
}
|
|
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
|
|
return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
|
|
}
|
|
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
|
|
vec3 halfDir = normalize( lightDir + viewDir );
|
|
float dotNH = saturate( dot( normal, halfDir ) );
|
|
float dotVH = saturate( dot( viewDir, halfDir ) );
|
|
vec3 F = F_Schlick( specularColor, 1.0, dotVH );
|
|
float G = G_BlinnPhong_Implicit( );
|
|
float D = D_BlinnPhong( shininess, dotNH );
|
|
return F * ( G * D );
|
|
}
|
|
#if defined( USE_SHEEN )
|
|
float D_Charlie( float roughness, float dotNH ) {
|
|
float alpha = pow2( roughness );
|
|
float invAlpha = 1.0 / alpha;
|
|
float cos2h = dotNH * dotNH;
|
|
float sin2h = max( 1.0 - cos2h, 0.0078125 );
|
|
return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
|
|
}
|
|
float V_Neubelt( float dotNV, float dotNL ) {
|
|
return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
|
|
}
|
|
vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
|
|
vec3 halfDir = normalize( lightDir + viewDir );
|
|
float dotNL = saturate( dot( normal, lightDir ) );
|
|
float dotNV = saturate( dot( normal, viewDir ) );
|
|
float dotNH = saturate( dot( normal, halfDir ) );
|
|
float D = D_Charlie( sheenRoughness, dotNH );
|
|
float V = V_Neubelt( dotNV, dotNL );
|
|
return sheenColor * ( D * V );
|
|
}
|
|
#endif`,mp=`#ifdef USE_BUMPMAP
|
|
uniform sampler2D bumpMap;
|
|
uniform float bumpScale;
|
|
vec2 dHdxy_fwd() {
|
|
vec2 dSTdx = dFdx( vUv );
|
|
vec2 dSTdy = dFdy( vUv );
|
|
float Hll = bumpScale * texture2D( bumpMap, vUv ).x;
|
|
float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;
|
|
float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;
|
|
return vec2( dBx, dBy );
|
|
}
|
|
vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
|
|
vec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );
|
|
vec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );
|
|
vec3 vN = surf_norm;
|
|
vec3 R1 = cross( vSigmaY, vN );
|
|
vec3 R2 = cross( vN, vSigmaX );
|
|
float fDet = dot( vSigmaX, R1 ) * faceDirection;
|
|
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
|
|
return normalize( abs( fDet ) * surf_norm - vGrad );
|
|
}
|
|
#endif`,gp=`#if NUM_CLIPPING_PLANES > 0
|
|
vec4 plane;
|
|
#pragma unroll_loop_start
|
|
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
|
|
plane = clippingPlanes[ i ];
|
|
if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
|
|
}
|
|
#pragma unroll_loop_end
|
|
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
|
|
bool clipped = true;
|
|
#pragma unroll_loop_start
|
|
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
|
|
plane = clippingPlanes[ i ];
|
|
clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
|
|
}
|
|
#pragma unroll_loop_end
|
|
if ( clipped ) discard;
|
|
#endif
|
|
#endif`,vp=`#if NUM_CLIPPING_PLANES > 0
|
|
varying vec3 vClipPosition;
|
|
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
|
|
#endif`,xp=`#if NUM_CLIPPING_PLANES > 0
|
|
varying vec3 vClipPosition;
|
|
#endif`,yp=`#if NUM_CLIPPING_PLANES > 0
|
|
vClipPosition = - mvPosition.xyz;
|
|
#endif`,wp=`#if defined( USE_COLOR_ALPHA )
|
|
diffuseColor *= vColor;
|
|
#elif defined( USE_COLOR )
|
|
diffuseColor.rgb *= vColor;
|
|
#endif`,bp=`#if defined( USE_COLOR_ALPHA )
|
|
varying vec4 vColor;
|
|
#elif defined( USE_COLOR )
|
|
varying vec3 vColor;
|
|
#endif`,Mp=`#if defined( USE_COLOR_ALPHA )
|
|
varying vec4 vColor;
|
|
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
|
|
varying vec3 vColor;
|
|
#endif`,zp=`#if defined( USE_COLOR_ALPHA )
|
|
vColor = vec4( 1.0 );
|
|
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
|
|
vColor = vec3( 1.0 );
|
|
#endif
|
|
#ifdef USE_COLOR
|
|
vColor *= color;
|
|
#endif
|
|
#ifdef USE_INSTANCING_COLOR
|
|
vColor.xyz *= instanceColor.xyz;
|
|
#endif`,Cp=`#define PI 3.141592653589793
|
|
#define PI2 6.283185307179586
|
|
#define PI_HALF 1.5707963267948966
|
|
#define RECIPROCAL_PI 0.3183098861837907
|
|
#define RECIPROCAL_PI2 0.15915494309189535
|
|
#define EPSILON 1e-6
|
|
#ifndef saturate
|
|
#define saturate( a ) clamp( a, 0.0, 1.0 )
|
|
#endif
|
|
#define whiteComplement( a ) ( 1.0 - saturate( a ) )
|
|
float pow2( const in float x ) { return x*x; }
|
|
float pow3( const in float x ) { return x*x*x; }
|
|
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
|
|
float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
|
|
float average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }
|
|
highp float rand( const in vec2 uv ) {
|
|
const highp float a = 12.9898, b = 78.233, c = 43758.5453;
|
|
highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
|
|
return fract( sin( sn ) * c );
|
|
}
|
|
#ifdef HIGH_PRECISION
|
|
float precisionSafeLength( vec3 v ) { return length( v ); }
|
|
#else
|
|
float precisionSafeLength( vec3 v ) {
|
|
float maxComponent = max3( abs( v ) );
|
|
return length( v / maxComponent ) * maxComponent;
|
|
}
|
|
#endif
|
|
struct IncidentLight {
|
|
vec3 color;
|
|
vec3 direction;
|
|
bool visible;
|
|
};
|
|
struct ReflectedLight {
|
|
vec3 directDiffuse;
|
|
vec3 directSpecular;
|
|
vec3 indirectDiffuse;
|
|
vec3 indirectSpecular;
|
|
};
|
|
struct GeometricContext {
|
|
vec3 position;
|
|
vec3 normal;
|
|
vec3 viewDir;
|
|
#ifdef USE_CLEARCOAT
|
|
vec3 clearcoatNormal;
|
|
#endif
|
|
};
|
|
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
|
|
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
|
|
}
|
|
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
|
|
return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
|
|
}
|
|
mat3 transposeMat3( const in mat3 m ) {
|
|
mat3 tmp;
|
|
tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
|
|
tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
|
|
tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
|
|
return tmp;
|
|
}
|
|
float linearToRelativeLuminance( const in vec3 color ) {
|
|
vec3 weights = vec3( 0.2126, 0.7152, 0.0722 );
|
|
return dot( weights, color.rgb );
|
|
}
|
|
bool isPerspectiveMatrix( mat4 m ) {
|
|
return m[ 2 ][ 3 ] == - 1.0;
|
|
}
|
|
vec2 equirectUv( in vec3 dir ) {
|
|
float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
|
|
float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
|
|
return vec2( u, v );
|
|
}`,Ap=`#ifdef ENVMAP_TYPE_CUBE_UV
|
|
#define cubeUV_maxMipLevel 8.0
|
|
#define cubeUV_minMipLevel 4.0
|
|
#define cubeUV_maxTileSize 256.0
|
|
#define cubeUV_minTileSize 16.0
|
|
float getFace( vec3 direction ) {
|
|
vec3 absDirection = abs( direction );
|
|
float face = - 1.0;
|
|
if ( absDirection.x > absDirection.z ) {
|
|
if ( absDirection.x > absDirection.y )
|
|
face = direction.x > 0.0 ? 0.0 : 3.0;
|
|
else
|
|
face = direction.y > 0.0 ? 1.0 : 4.0;
|
|
} else {
|
|
if ( absDirection.z > absDirection.y )
|
|
face = direction.z > 0.0 ? 2.0 : 5.0;
|
|
else
|
|
face = direction.y > 0.0 ? 1.0 : 4.0;
|
|
}
|
|
return face;
|
|
}
|
|
vec2 getUV( vec3 direction, float face ) {
|
|
vec2 uv;
|
|
if ( face == 0.0 ) {
|
|
uv = vec2( direction.z, direction.y ) / abs( direction.x );
|
|
} else if ( face == 1.0 ) {
|
|
uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
|
|
} else if ( face == 2.0 ) {
|
|
uv = vec2( - direction.x, direction.y ) / abs( direction.z );
|
|
} else if ( face == 3.0 ) {
|
|
uv = vec2( - direction.z, direction.y ) / abs( direction.x );
|
|
} else if ( face == 4.0 ) {
|
|
uv = vec2( - direction.x, direction.z ) / abs( direction.y );
|
|
} else {
|
|
uv = vec2( direction.x, direction.y ) / abs( direction.z );
|
|
}
|
|
return 0.5 * ( uv + 1.0 );
|
|
}
|
|
vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
|
|
float face = getFace( direction );
|
|
float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
|
|
mipInt = max( mipInt, cubeUV_minMipLevel );
|
|
float faceSize = exp2( mipInt );
|
|
float texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );
|
|
vec2 uv = getUV( direction, face ) * ( faceSize - 1.0 ) + 0.5;
|
|
if ( face > 2.0 ) {
|
|
uv.y += faceSize;
|
|
face -= 3.0;
|
|
}
|
|
uv.x += face * faceSize;
|
|
if ( mipInt < cubeUV_maxMipLevel ) {
|
|
uv.y += 2.0 * cubeUV_maxTileSize;
|
|
}
|
|
uv.y += filterInt * 2.0 * cubeUV_minTileSize;
|
|
uv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );
|
|
uv *= texelSize;
|
|
return texture2D( envMap, uv ).rgb;
|
|
}
|
|
#define r0 1.0
|
|
#define v0 0.339
|
|
#define m0 - 2.0
|
|
#define r1 0.8
|
|
#define v1 0.276
|
|
#define m1 - 1.0
|
|
#define r4 0.4
|
|
#define v4 0.046
|
|
#define m4 2.0
|
|
#define r5 0.305
|
|
#define v5 0.016
|
|
#define m5 3.0
|
|
#define r6 0.21
|
|
#define v6 0.0038
|
|
#define m6 4.0
|
|
float roughnessToMip( float roughness ) {
|
|
float mip = 0.0;
|
|
if ( roughness >= r1 ) {
|
|
mip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;
|
|
} else if ( roughness >= r4 ) {
|
|
mip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;
|
|
} else if ( roughness >= r5 ) {
|
|
mip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;
|
|
} else if ( roughness >= r6 ) {
|
|
mip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;
|
|
} else {
|
|
mip = - 2.0 * log2( 1.16 * roughness ); }
|
|
return mip;
|
|
}
|
|
vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
|
|
float mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );
|
|
float mipF = fract( mip );
|
|
float mipInt = floor( mip );
|
|
vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
|
|
if ( mipF == 0.0 ) {
|
|
return vec4( color0, 1.0 );
|
|
} else {
|
|
vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
|
|
return vec4( mix( color0, color1, mipF ), 1.0 );
|
|
}
|
|
}
|
|
#endif`,Sp=`vec3 transformedNormal = objectNormal;
|
|
#ifdef USE_INSTANCING
|
|
mat3 m = mat3( instanceMatrix );
|
|
transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );
|
|
transformedNormal = m * transformedNormal;
|
|
#endif
|
|
transformedNormal = normalMatrix * transformedNormal;
|
|
#ifdef FLIP_SIDED
|
|
transformedNormal = - transformedNormal;
|
|
#endif
|
|
#ifdef USE_TANGENT
|
|
vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;
|
|
#ifdef FLIP_SIDED
|
|
transformedTangent = - transformedTangent;
|
|
#endif
|
|
#endif`,_p=`#ifdef USE_DISPLACEMENTMAP
|
|
uniform sampler2D displacementMap;
|
|
uniform float displacementScale;
|
|
uniform float displacementBias;
|
|
#endif`,Ep=`#ifdef USE_DISPLACEMENTMAP
|
|
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );
|
|
#endif`,Lp=`#ifdef USE_EMISSIVEMAP
|
|
vec4 emissiveColor = texture2D( emissiveMap, vUv );
|
|
totalEmissiveRadiance *= emissiveColor.rgb;
|
|
#endif`,Tp=`#ifdef USE_EMISSIVEMAP
|
|
uniform sampler2D emissiveMap;
|
|
#endif`,Dp="gl_FragColor = linearToOutputTexel( gl_FragColor );",Hp=`vec4 LinearToLinear( in vec4 value ) {
|
|
return value;
|
|
}
|
|
vec4 LinearTosRGB( in vec4 value ) {
|
|
return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
|
|
}`,Vp=`#ifdef USE_ENVMAP
|
|
#ifdef ENV_WORLDPOS
|
|
vec3 cameraToFrag;
|
|
if ( isOrthographic ) {
|
|
cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
|
|
} else {
|
|
cameraToFrag = normalize( vWorldPosition - cameraPosition );
|
|
}
|
|
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
|
#ifdef ENVMAP_MODE_REFLECTION
|
|
vec3 reflectVec = reflect( cameraToFrag, worldNormal );
|
|
#else
|
|
vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
|
|
#endif
|
|
#else
|
|
vec3 reflectVec = vReflect;
|
|
#endif
|
|
#ifdef ENVMAP_TYPE_CUBE
|
|
vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
|
|
#elif defined( ENVMAP_TYPE_CUBE_UV )
|
|
vec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );
|
|
#else
|
|
vec4 envColor = vec4( 0.0 );
|
|
#endif
|
|
#ifdef ENVMAP_BLENDING_MULTIPLY
|
|
outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
|
|
#elif defined( ENVMAP_BLENDING_MIX )
|
|
outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
|
|
#elif defined( ENVMAP_BLENDING_ADD )
|
|
outgoingLight += envColor.xyz * specularStrength * reflectivity;
|
|
#endif
|
|
#endif`,Rp=`#ifdef USE_ENVMAP
|
|
uniform float envMapIntensity;
|
|
uniform float flipEnvMap;
|
|
#ifdef ENVMAP_TYPE_CUBE
|
|
uniform samplerCube envMap;
|
|
#else
|
|
uniform sampler2D envMap;
|
|
#endif
|
|
|
|
#endif`,Np=`#ifdef USE_ENVMAP
|
|
uniform float reflectivity;
|
|
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )
|
|
#define ENV_WORLDPOS
|
|
#endif
|
|
#ifdef ENV_WORLDPOS
|
|
varying vec3 vWorldPosition;
|
|
uniform float refractionRatio;
|
|
#else
|
|
varying vec3 vReflect;
|
|
#endif
|
|
#endif`,Fp=`#ifdef USE_ENVMAP
|
|
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )
|
|
#define ENV_WORLDPOS
|
|
#endif
|
|
#ifdef ENV_WORLDPOS
|
|
|
|
varying vec3 vWorldPosition;
|
|
#else
|
|
varying vec3 vReflect;
|
|
uniform float refractionRatio;
|
|
#endif
|
|
#endif`,Bp=`#ifdef USE_ENVMAP
|
|
#ifdef ENV_WORLDPOS
|
|
vWorldPosition = worldPosition.xyz;
|
|
#else
|
|
vec3 cameraToVertex;
|
|
if ( isOrthographic ) {
|
|
cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
|
|
} else {
|
|
cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
|
|
}
|
|
vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
|
|
#ifdef ENVMAP_MODE_REFLECTION
|
|
vReflect = reflect( cameraToVertex, worldNormal );
|
|
#else
|
|
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
|
|
#endif
|
|
#endif
|
|
#endif`,Pp=`#ifdef USE_FOG
|
|
vFogDepth = - mvPosition.z;
|
|
#endif`,Ip=`#ifdef USE_FOG
|
|
varying float vFogDepth;
|
|
#endif`,kp=`#ifdef USE_FOG
|
|
#ifdef FOG_EXP2
|
|
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
|
|
#else
|
|
float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
|
|
#endif
|
|
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
|
|
#endif`,Op=`#ifdef USE_FOG
|
|
uniform vec3 fogColor;
|
|
varying float vFogDepth;
|
|
#ifdef FOG_EXP2
|
|
uniform float fogDensity;
|
|
#else
|
|
uniform float fogNear;
|
|
uniform float fogFar;
|
|
#endif
|
|
#endif`,Up=`#ifdef USE_GRADIENTMAP
|
|
uniform sampler2D gradientMap;
|
|
#endif
|
|
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
|
|
float dotNL = dot( normal, lightDirection );
|
|
vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
|
|
#ifdef USE_GRADIENTMAP
|
|
return vec3( texture2D( gradientMap, coord ).r );
|
|
#else
|
|
return ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );
|
|
#endif
|
|
}`,Gp=`#ifdef USE_LIGHTMAP
|
|
vec4 lightMapTexel = texture2D( lightMap, vUv2 );
|
|
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
|
|
#ifndef PHYSICALLY_CORRECT_LIGHTS
|
|
lightMapIrradiance *= PI;
|
|
#endif
|
|
reflectedLight.indirectDiffuse += lightMapIrradiance;
|
|
#endif`,qp=`#ifdef USE_LIGHTMAP
|
|
uniform sampler2D lightMap;
|
|
uniform float lightMapIntensity;
|
|
#endif`,Wp=`vec3 diffuse = vec3( 1.0 );
|
|
GeometricContext geometry;
|
|
geometry.position = mvPosition.xyz;
|
|
geometry.normal = normalize( transformedNormal );
|
|
geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );
|
|
GeometricContext backGeometry;
|
|
backGeometry.position = geometry.position;
|
|
backGeometry.normal = -geometry.normal;
|
|
backGeometry.viewDir = geometry.viewDir;
|
|
vLightFront = vec3( 0.0 );
|
|
vIndirectFront = vec3( 0.0 );
|
|
#ifdef DOUBLE_SIDED
|
|
vLightBack = vec3( 0.0 );
|
|
vIndirectBack = vec3( 0.0 );
|
|
#endif
|
|
IncidentLight directLight;
|
|
float dotNL;
|
|
vec3 directLightColor_Diffuse;
|
|
vIndirectFront += getAmbientLightIrradiance( ambientLightColor );
|
|
vIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );
|
|
#ifdef DOUBLE_SIDED
|
|
vIndirectBack += getAmbientLightIrradiance( ambientLightColor );
|
|
vIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );
|
|
#endif
|
|
#if NUM_POINT_LIGHTS > 0
|
|
#pragma unroll_loop_start
|
|
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
|
|
getPointLightInfo( pointLights[ i ], geometry, directLight );
|
|
dotNL = dot( geometry.normal, directLight.direction );
|
|
directLightColor_Diffuse = directLight.color;
|
|
vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
|
|
#ifdef DOUBLE_SIDED
|
|
vLightBack += saturate( - dotNL ) * directLightColor_Diffuse;
|
|
#endif
|
|
}
|
|
#pragma unroll_loop_end
|
|
#endif
|
|
#if NUM_SPOT_LIGHTS > 0
|
|
#pragma unroll_loop_start
|
|
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
|
|
getSpotLightInfo( spotLights[ i ], geometry, directLight );
|
|
dotNL = dot( geometry.normal, directLight.direction );
|
|
directLightColor_Diffuse = directLight.color;
|
|
vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
|
|
#ifdef DOUBLE_SIDED
|
|
vLightBack += saturate( - dotNL ) * directLightColor_Diffuse;
|
|
#endif
|
|
}
|
|
#pragma unroll_loop_end
|
|
#endif
|
|
#if NUM_DIR_LIGHTS > 0
|
|
#pragma unroll_loop_start
|
|
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
|
|
getDirectionalLightInfo( directionalLights[ i ], geometry, directLight );
|
|
dotNL = dot( geometry.normal, directLight.direction );
|
|
directLightColor_Diffuse = directLight.color;
|
|
vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
|
|
#ifdef DOUBLE_SIDED
|
|
vLightBack += saturate( - dotNL ) * directLightColor_Diffuse;
|
|
#endif
|
|
}
|
|
#pragma unroll_loop_end
|
|
#endif
|
|
#if NUM_HEMI_LIGHTS > 0
|
|
#pragma unroll_loop_start
|
|
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
|
|
vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );
|
|
#ifdef DOUBLE_SIDED
|
|
vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );
|
|
#endif
|
|
}
|
|
#pragma unroll_loop_end
|
|
#endif`,jp=`uniform bool receiveShadow;
|
|
uniform vec3 ambientLightColor;
|
|
uniform vec3 lightProbe[ 9 ];
|
|
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
|
|
float x = normal.x, y = normal.y, z = normal.z;
|
|
vec3 result = shCoefficients[ 0 ] * 0.886227;
|
|
result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
|
|
result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
|
|
result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
|
|
result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
|
|
result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
|
|
result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
|
|
result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
|
|
result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
|
|
return result;
|
|
}
|
|
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
|
|
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
|
vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
|
|
return irradiance;
|
|
}
|
|
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
|
|
vec3 irradiance = ambientLightColor;
|
|
return irradiance;
|
|
}
|
|
float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
|
|
#if defined ( PHYSICALLY_CORRECT_LIGHTS )
|
|
float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
|
|
if ( cutoffDistance > 0.0 ) {
|
|
distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
|
|
}
|
|
return distanceFalloff;
|
|
#else
|
|
if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
|
|
return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );
|
|
}
|
|
return 1.0;
|
|
#endif
|
|
}
|
|
float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
|
|
return smoothstep( coneCosine, penumbraCosine, angleCosine );
|
|
}
|
|
#if NUM_DIR_LIGHTS > 0
|
|
struct DirectionalLight {
|
|
vec3 direction;
|
|
vec3 color;
|
|
};
|
|
uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
|
|
void getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {
|
|
light.color = directionalLight.color;
|
|
light.direction = directionalLight.direction;
|
|
light.visible = true;
|
|
}
|
|
#endif
|
|
#if NUM_POINT_LIGHTS > 0
|
|
struct PointLight {
|
|
vec3 position;
|
|
vec3 color;
|
|
float distance;
|
|
float decay;
|
|
};
|
|
uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
|
|
void getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {
|
|
vec3 lVector = pointLight.position - geometry.position;
|
|
light.direction = normalize( lVector );
|
|
float lightDistance = length( lVector );
|
|
light.color = pointLight.color;
|
|
light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
|
|
light.visible = ( light.color != vec3( 0.0 ) );
|
|
}
|
|
#endif
|
|
#if NUM_SPOT_LIGHTS > 0
|
|
struct SpotLight {
|
|
vec3 position;
|
|
vec3 direction;
|
|
vec3 color;
|
|
float distance;
|
|
float decay;
|
|
float coneCos;
|
|
float penumbraCos;
|
|
};
|
|
uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
|
|
void getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {
|
|
vec3 lVector = spotLight.position - geometry.position;
|
|
light.direction = normalize( lVector );
|
|
float angleCos = dot( light.direction, spotLight.direction );
|
|
float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
|
|
if ( spotAttenuation > 0.0 ) {
|
|
float lightDistance = length( lVector );
|
|
light.color = spotLight.color * spotAttenuation;
|
|
light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
|
|
light.visible = ( light.color != vec3( 0.0 ) );
|
|
} else {
|
|
light.color = vec3( 0.0 );
|
|
light.visible = false;
|
|
}
|
|
}
|
|
#endif
|
|
#if NUM_RECT_AREA_LIGHTS > 0
|
|
struct RectAreaLight {
|
|
vec3 color;
|
|
vec3 position;
|
|
vec3 halfWidth;
|
|
vec3 halfHeight;
|
|
};
|
|
uniform sampler2D ltc_1; uniform sampler2D ltc_2;
|
|
uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
|
|
#endif
|
|
#if NUM_HEMI_LIGHTS > 0
|
|
struct HemisphereLight {
|
|
vec3 direction;
|
|
vec3 skyColor;
|
|
vec3 groundColor;
|
|
};
|
|
uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
|
|
vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
|
|
float dotNL = dot( normal, hemiLight.direction );
|
|
float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
|
|
vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
|
|
return irradiance;
|
|
}
|
|
#endif`,Zp=`#if defined( USE_ENVMAP )
|
|
#ifdef ENVMAP_MODE_REFRACTION
|
|
uniform float refractionRatio;
|
|
#endif
|
|
vec3 getIBLIrradiance( const in vec3 normal ) {
|
|
#if defined( ENVMAP_TYPE_CUBE_UV )
|
|
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
|
vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );
|
|
return PI * envMapColor.rgb * envMapIntensity;
|
|
#else
|
|
return vec3( 0.0 );
|
|
#endif
|
|
}
|
|
vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
|
|
#if defined( ENVMAP_TYPE_CUBE_UV )
|
|
vec3 reflectVec;
|
|
#ifdef ENVMAP_MODE_REFLECTION
|
|
reflectVec = reflect( - viewDir, normal );
|
|
reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
|
|
#else
|
|
reflectVec = refract( - viewDir, normal, refractionRatio );
|
|
#endif
|
|
reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
|
|
vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );
|
|
return envMapColor.rgb * envMapIntensity;
|
|
#else
|
|
return vec3( 0.0 );
|
|
#endif
|
|
}
|
|
#endif`,Xp=`ToonMaterial material;
|
|
material.diffuseColor = diffuseColor.rgb;`,Yp=`varying vec3 vViewPosition;
|
|
struct ToonMaterial {
|
|
vec3 diffuseColor;
|
|
};
|
|
void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
|
|
vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;
|
|
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
}
|
|
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
|
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
}
|
|
#define RE_Direct RE_Direct_Toon
|
|
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon
|
|
#define Material_LightProbeLOD( material ) (0)`,$p=`BlinnPhongMaterial material;
|
|
material.diffuseColor = diffuseColor.rgb;
|
|
material.specularColor = specular;
|
|
material.specularShininess = shininess;
|
|
material.specularStrength = specularStrength;`,Jp=`varying vec3 vViewPosition;
|
|
struct BlinnPhongMaterial {
|
|
vec3 diffuseColor;
|
|
vec3 specularColor;
|
|
float specularShininess;
|
|
float specularStrength;
|
|
};
|
|
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
|
|
float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
|
|
vec3 irradiance = dotNL * directLight.color;
|
|
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;
|
|
}
|
|
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
|
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
}
|
|
#define RE_Direct RE_Direct_BlinnPhong
|
|
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong
|
|
#define Material_LightProbeLOD( material ) (0)`,Qp=`PhysicalMaterial material;
|
|
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
|
|
vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );
|
|
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
|
|
material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
|
|
material.roughness = min( material.roughness, 1.0 );
|
|
#ifdef IOR
|
|
#ifdef SPECULAR
|
|
float specularIntensityFactor = specularIntensity;
|
|
vec3 specularColorFactor = specularColor;
|
|
#ifdef USE_SPECULARINTENSITYMAP
|
|
specularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;
|
|
#endif
|
|
#ifdef USE_SPECULARCOLORMAP
|
|
specularColorFactor *= texture2D( specularColorMap, vUv ).rgb;
|
|
#endif
|
|
material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
|
|
#else
|
|
float specularIntensityFactor = 1.0;
|
|
vec3 specularColorFactor = vec3( 1.0 );
|
|
material.specularF90 = 1.0;
|
|
#endif
|
|
material.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
|
|
#else
|
|
material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
|
|
material.specularF90 = 1.0;
|
|
#endif
|
|
#ifdef USE_CLEARCOAT
|
|
material.clearcoat = clearcoat;
|
|
material.clearcoatRoughness = clearcoatRoughness;
|
|
material.clearcoatF0 = vec3( 0.04 );
|
|
material.clearcoatF90 = 1.0;
|
|
#ifdef USE_CLEARCOATMAP
|
|
material.clearcoat *= texture2D( clearcoatMap, vUv ).x;
|
|
#endif
|
|
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;
|
|
#endif
|
|
material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
|
|
material.clearcoatRoughness += geometryRoughness;
|
|
material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
|
|
#endif
|
|
#ifdef USE_SHEEN
|
|
material.sheenColor = sheenColor;
|
|
#ifdef USE_SHEENCOLORMAP
|
|
material.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;
|
|
#endif
|
|
material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
|
|
#ifdef USE_SHEENROUGHNESSMAP
|
|
material.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;
|
|
#endif
|
|
#endif`,Kp=`struct PhysicalMaterial {
|
|
vec3 diffuseColor;
|
|
float roughness;
|
|
vec3 specularColor;
|
|
float specularF90;
|
|
#ifdef USE_CLEARCOAT
|
|
float clearcoat;
|
|
float clearcoatRoughness;
|
|
vec3 clearcoatF0;
|
|
float clearcoatF90;
|
|
#endif
|
|
#ifdef USE_SHEEN
|
|
vec3 sheenColor;
|
|
float sheenRoughness;
|
|
#endif
|
|
};
|
|
vec3 clearcoatSpecular = vec3( 0.0 );
|
|
vec3 sheenSpecular = vec3( 0.0 );
|
|
float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness) {
|
|
float dotNV = saturate( dot( normal, viewDir ) );
|
|
float r2 = roughness * roughness;
|
|
float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
|
|
float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
|
|
float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
|
|
return saturate( DG * RECIPROCAL_PI );
|
|
}
|
|
vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
|
|
float dotNV = saturate( dot( normal, viewDir ) );
|
|
const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
|
|
const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
|
|
vec4 r = roughness * c0 + c1;
|
|
float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
|
|
vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
|
|
return fab;
|
|
}
|
|
vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
|
|
vec2 fab = DFGApprox( normal, viewDir, roughness );
|
|
return specularColor * fab.x + specularF90 * fab.y;
|
|
}
|
|
void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
|
|
vec2 fab = DFGApprox( normal, viewDir, roughness );
|
|
vec3 FssEss = specularColor * fab.x + specularF90 * fab.y;
|
|
float Ess = fab.x + fab.y;
|
|
float Ems = 1.0 - Ess;
|
|
vec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
|
|
singleScatter += FssEss;
|
|
multiScatter += Fms * Ems;
|
|
}
|
|
#if NUM_RECT_AREA_LIGHTS > 0
|
|
void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
|
vec3 normal = geometry.normal;
|
|
vec3 viewDir = geometry.viewDir;
|
|
vec3 position = geometry.position;
|
|
vec3 lightPos = rectAreaLight.position;
|
|
vec3 halfWidth = rectAreaLight.halfWidth;
|
|
vec3 halfHeight = rectAreaLight.halfHeight;
|
|
vec3 lightColor = rectAreaLight.color;
|
|
float roughness = material.roughness;
|
|
vec3 rectCoords[ 4 ];
|
|
rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
|
|
rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
|
|
rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
|
|
vec2 uv = LTC_Uv( normal, viewDir, roughness );
|
|
vec4 t1 = texture2D( ltc_1, uv );
|
|
vec4 t2 = texture2D( ltc_2, uv );
|
|
mat3 mInv = mat3(
|
|
vec3( t1.x, 0, t1.y ),
|
|
vec3( 0, 1, 0 ),
|
|
vec3( t1.z, 0, t1.w )
|
|
);
|
|
vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
|
|
reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
|
|
reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
|
|
}
|
|
#endif
|
|
void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
|
float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
|
|
vec3 irradiance = dotNL * directLight.color;
|
|
#ifdef USE_CLEARCOAT
|
|
float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );
|
|
vec3 ccIrradiance = dotNLcc * directLight.color;
|
|
clearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
|
|
#endif
|
|
#ifdef USE_SHEEN
|
|
sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );
|
|
#endif
|
|
reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );
|
|
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
}
|
|
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
}
|
|
void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
|
|
#ifdef USE_CLEARCOAT
|
|
clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
|
|
#endif
|
|
#ifdef USE_SHEEN
|
|
sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );
|
|
#endif
|
|
vec3 singleScattering = vec3( 0.0 );
|
|
vec3 multiScattering = vec3( 0.0 );
|
|
vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
|
|
computeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
|
|
vec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );
|
|
reflectedLight.indirectSpecular += radiance * singleScattering;
|
|
reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
|
|
reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
|
|
}
|
|
#define RE_Direct RE_Direct_Physical
|
|
#define RE_Direct_RectArea RE_Direct_RectArea_Physical
|
|
#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
|
|
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
|
|
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
|
|
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
|
|
}`,em=`
|
|
GeometricContext geometry;
|
|
geometry.position = - vViewPosition;
|
|
geometry.normal = normal;
|
|
geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
|
|
#ifdef USE_CLEARCOAT
|
|
geometry.clearcoatNormal = clearcoatNormal;
|
|
#endif
|
|
IncidentLight directLight;
|
|
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
|
|
PointLight pointLight;
|
|
#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
|
|
PointLightShadow pointLightShadow;
|
|
#endif
|
|
#pragma unroll_loop_start
|
|
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
|
|
pointLight = pointLights[ i ];
|
|
getPointLightInfo( pointLight, geometry, directLight );
|
|
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
|
|
pointLightShadow = pointLightShadows[ i ];
|
|
directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
|
|
#endif
|
|
RE_Direct( directLight, geometry, material, reflectedLight );
|
|
}
|
|
#pragma unroll_loop_end
|
|
#endif
|
|
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
|
|
SpotLight spotLight;
|
|
#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
|
|
SpotLightShadow spotLightShadow;
|
|
#endif
|
|
#pragma unroll_loop_start
|
|
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
|
|
spotLight = spotLights[ i ];
|
|
getSpotLightInfo( spotLight, geometry, directLight );
|
|
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
|
|
spotLightShadow = spotLightShadows[ i ];
|
|
directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
|
|
#endif
|
|
RE_Direct( directLight, geometry, material, reflectedLight );
|
|
}
|
|
#pragma unroll_loop_end
|
|
#endif
|
|
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
|
|
DirectionalLight directionalLight;
|
|
#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
|
|
DirectionalLightShadow directionalLightShadow;
|
|
#endif
|
|
#pragma unroll_loop_start
|
|
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
|
|
directionalLight = directionalLights[ i ];
|
|
getDirectionalLightInfo( directionalLight, geometry, directLight );
|
|
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
|
|
directionalLightShadow = directionalLightShadows[ i ];
|
|
directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
|
|
#endif
|
|
RE_Direct( directLight, geometry, material, reflectedLight );
|
|
}
|
|
#pragma unroll_loop_end
|
|
#endif
|
|
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
|
|
RectAreaLight rectAreaLight;
|
|
#pragma unroll_loop_start
|
|
for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
|
|
rectAreaLight = rectAreaLights[ i ];
|
|
RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );
|
|
}
|
|
#pragma unroll_loop_end
|
|
#endif
|
|
#if defined( RE_IndirectDiffuse )
|
|
vec3 iblIrradiance = vec3( 0.0 );
|
|
vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
|
|
irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );
|
|
#if ( NUM_HEMI_LIGHTS > 0 )
|
|
#pragma unroll_loop_start
|
|
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
|
|
irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );
|
|
}
|
|
#pragma unroll_loop_end
|
|
#endif
|
|
#endif
|
|
#if defined( RE_IndirectSpecular )
|
|
vec3 radiance = vec3( 0.0 );
|
|
vec3 clearcoatRadiance = vec3( 0.0 );
|
|
#endif`,tm=`#if defined( RE_IndirectDiffuse )
|
|
#ifdef USE_LIGHTMAP
|
|
vec4 lightMapTexel = texture2D( lightMap, vUv2 );
|
|
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
|
|
#ifndef PHYSICALLY_CORRECT_LIGHTS
|
|
lightMapIrradiance *= PI;
|
|
#endif
|
|
irradiance += lightMapIrradiance;
|
|
#endif
|
|
#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
|
|
iblIrradiance += getIBLIrradiance( geometry.normal );
|
|
#endif
|
|
#endif
|
|
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
|
|
radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );
|
|
#ifdef USE_CLEARCOAT
|
|
clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );
|
|
#endif
|
|
#endif`,im=`#if defined( RE_IndirectDiffuse )
|
|
RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );
|
|
#endif
|
|
#if defined( RE_IndirectSpecular )
|
|
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );
|
|
#endif`,nm=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
|
|
gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
|
|
#endif`,sm=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
|
|
uniform float logDepthBufFC;
|
|
varying float vFragDepth;
|
|
varying float vIsPerspective;
|
|
#endif`,rm=`#ifdef USE_LOGDEPTHBUF
|
|
#ifdef USE_LOGDEPTHBUF_EXT
|
|
varying float vFragDepth;
|
|
varying float vIsPerspective;
|
|
#else
|
|
uniform float logDepthBufFC;
|
|
#endif
|
|
#endif`,am=`#ifdef USE_LOGDEPTHBUF
|
|
#ifdef USE_LOGDEPTHBUF_EXT
|
|
vFragDepth = 1.0 + gl_Position.w;
|
|
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
|
|
#else
|
|
if ( isPerspectiveMatrix( projectionMatrix ) ) {
|
|
gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
|
|
gl_Position.z *= gl_Position.w;
|
|
}
|
|
#endif
|
|
#endif`,om=`#ifdef USE_MAP
|
|
vec4 sampledDiffuseColor = texture2D( map, vUv );
|
|
#ifdef DECODE_VIDEO_TEXTURE
|
|
sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );
|
|
#endif
|
|
diffuseColor *= sampledDiffuseColor;
|
|
#endif`,cm=`#ifdef USE_MAP
|
|
uniform sampler2D map;
|
|
#endif`,lm=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|
vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
|
|
#endif
|
|
#ifdef USE_MAP
|
|
diffuseColor *= texture2D( map, uv );
|
|
#endif
|
|
#ifdef USE_ALPHAMAP
|
|
diffuseColor.a *= texture2D( alphaMap, uv ).g;
|
|
#endif`,hm=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|
uniform mat3 uvTransform;
|
|
#endif
|
|
#ifdef USE_MAP
|
|
uniform sampler2D map;
|
|
#endif
|
|
#ifdef USE_ALPHAMAP
|
|
uniform sampler2D alphaMap;
|
|
#endif`,um=`float metalnessFactor = metalness;
|
|
#ifdef USE_METALNESSMAP
|
|
vec4 texelMetalness = texture2D( metalnessMap, vUv );
|
|
metalnessFactor *= texelMetalness.b;
|
|
#endif`,fm=`#ifdef USE_METALNESSMAP
|
|
uniform sampler2D metalnessMap;
|
|
#endif`,dm=`#ifdef USE_MORPHNORMALS
|
|
objectNormal *= morphTargetBaseInfluence;
|
|
#ifdef MORPHTARGETS_TEXTURE
|
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1, 2 ) * morphTargetInfluences[ i ];
|
|
}
|
|
#else
|
|
objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
|
|
objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
|
|
objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
|
|
objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
|
|
#endif
|
|
#endif`,pm=`#ifdef USE_MORPHTARGETS
|
|
uniform float morphTargetBaseInfluence;
|
|
#ifdef MORPHTARGETS_TEXTURE
|
|
uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
|
|
uniform sampler2DArray morphTargetsTexture;
|
|
uniform vec2 morphTargetsTextureSize;
|
|
vec3 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset, const in int stride ) {
|
|
float texelIndex = float( vertexIndex * stride + offset );
|
|
float y = floor( texelIndex / morphTargetsTextureSize.x );
|
|
float x = texelIndex - y * morphTargetsTextureSize.x;
|
|
vec3 morphUV = vec3( ( x + 0.5 ) / morphTargetsTextureSize.x, y / morphTargetsTextureSize.y, morphTargetIndex );
|
|
return texture( morphTargetsTexture, morphUV ).xyz;
|
|
}
|
|
#else
|
|
#ifndef USE_MORPHNORMALS
|
|
uniform float morphTargetInfluences[ 8 ];
|
|
#else
|
|
uniform float morphTargetInfluences[ 4 ];
|
|
#endif
|
|
#endif
|
|
#endif`,mm=`#ifdef USE_MORPHTARGETS
|
|
transformed *= morphTargetBaseInfluence;
|
|
#ifdef MORPHTARGETS_TEXTURE
|
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
#ifndef USE_MORPHNORMALS
|
|
if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 1 ) * morphTargetInfluences[ i ];
|
|
#else
|
|
if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 2 ) * morphTargetInfluences[ i ];
|
|
#endif
|
|
}
|
|
#else
|
|
transformed += morphTarget0 * morphTargetInfluences[ 0 ];
|
|
transformed += morphTarget1 * morphTargetInfluences[ 1 ];
|
|
transformed += morphTarget2 * morphTargetInfluences[ 2 ];
|
|
transformed += morphTarget3 * morphTargetInfluences[ 3 ];
|
|
#ifndef USE_MORPHNORMALS
|
|
transformed += morphTarget4 * morphTargetInfluences[ 4 ];
|
|
transformed += morphTarget5 * morphTargetInfluences[ 5 ];
|
|
transformed += morphTarget6 * morphTargetInfluences[ 6 ];
|
|
transformed += morphTarget7 * morphTargetInfluences[ 7 ];
|
|
#endif
|
|
#endif
|
|
#endif`,gm=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
|
|
#ifdef FLAT_SHADED
|
|
vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );
|
|
vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );
|
|
vec3 normal = normalize( cross( fdx, fdy ) );
|
|
#else
|
|
vec3 normal = normalize( vNormal );
|
|
#ifdef DOUBLE_SIDED
|
|
normal = normal * faceDirection;
|
|
#endif
|
|
#ifdef USE_TANGENT
|
|
vec3 tangent = normalize( vTangent );
|
|
vec3 bitangent = normalize( vBitangent );
|
|
#ifdef DOUBLE_SIDED
|
|
tangent = tangent * faceDirection;
|
|
bitangent = bitangent * faceDirection;
|
|
#endif
|
|
#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )
|
|
mat3 vTBN = mat3( tangent, bitangent, normal );
|
|
#endif
|
|
#endif
|
|
#endif
|
|
vec3 geometryNormal = normal;`,vm=`#ifdef OBJECTSPACE_NORMALMAP
|
|
normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
|
|
#ifdef FLIP_SIDED
|
|
normal = - normal;
|
|
#endif
|
|
#ifdef DOUBLE_SIDED
|
|
normal = normal * faceDirection;
|
|
#endif
|
|
normal = normalize( normalMatrix * normal );
|
|
#elif defined( TANGENTSPACE_NORMALMAP )
|
|
vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
|
|
mapN.xy *= normalScale;
|
|
#ifdef USE_TANGENT
|
|
normal = normalize( vTBN * mapN );
|
|
#else
|
|
normal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );
|
|
#endif
|
|
#elif defined( USE_BUMPMAP )
|
|
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
|
|
#endif`,xm=`#ifndef FLAT_SHADED
|
|
varying vec3 vNormal;
|
|
#ifdef USE_TANGENT
|
|
varying vec3 vTangent;
|
|
varying vec3 vBitangent;
|
|
#endif
|
|
#endif`,ym=`#ifndef FLAT_SHADED
|
|
varying vec3 vNormal;
|
|
#ifdef USE_TANGENT
|
|
varying vec3 vTangent;
|
|
varying vec3 vBitangent;
|
|
#endif
|
|
#endif`,wm=`#ifndef FLAT_SHADED
|
|
vNormal = normalize( transformedNormal );
|
|
#ifdef USE_TANGENT
|
|
vTangent = normalize( transformedTangent );
|
|
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
|
|
#endif
|
|
#endif`,bm=`#ifdef USE_NORMALMAP
|
|
uniform sampler2D normalMap;
|
|
uniform vec2 normalScale;
|
|
#endif
|
|
#ifdef OBJECTSPACE_NORMALMAP
|
|
uniform mat3 normalMatrix;
|
|
#endif
|
|
#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )
|
|
vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {
|
|
vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );
|
|
vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );
|
|
vec2 st0 = dFdx( vUv.st );
|
|
vec2 st1 = dFdy( vUv.st );
|
|
vec3 N = surf_norm;
|
|
vec3 q1perp = cross( q1, N );
|
|
vec3 q0perp = cross( N, q0 );
|
|
vec3 T = q1perp * st0.x + q0perp * st1.x;
|
|
vec3 B = q1perp * st0.y + q0perp * st1.y;
|
|
float det = max( dot( T, T ), dot( B, B ) );
|
|
float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );
|
|
return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );
|
|
}
|
|
#endif`,Mm=`#ifdef USE_CLEARCOAT
|
|
vec3 clearcoatNormal = geometryNormal;
|
|
#endif`,zm=`#ifdef USE_CLEARCOAT_NORMALMAP
|
|
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;
|
|
clearcoatMapN.xy *= clearcoatNormalScale;
|
|
#ifdef USE_TANGENT
|
|
clearcoatNormal = normalize( vTBN * clearcoatMapN );
|
|
#else
|
|
clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );
|
|
#endif
|
|
#endif`,Cm=`#ifdef USE_CLEARCOATMAP
|
|
uniform sampler2D clearcoatMap;
|
|
#endif
|
|
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
uniform sampler2D clearcoatRoughnessMap;
|
|
#endif
|
|
#ifdef USE_CLEARCOAT_NORMALMAP
|
|
uniform sampler2D clearcoatNormalMap;
|
|
uniform vec2 clearcoatNormalScale;
|
|
#endif`,Am=`#ifdef OPAQUE
|
|
diffuseColor.a = 1.0;
|
|
#endif
|
|
#ifdef USE_TRANSMISSION
|
|
diffuseColor.a *= transmissionAlpha + 0.1;
|
|
#endif
|
|
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Sm=`vec3 packNormalToRGB( const in vec3 normal ) {
|
|
return normalize( normal ) * 0.5 + 0.5;
|
|
}
|
|
vec3 unpackRGBToNormal( const in vec3 rgb ) {
|
|
return 2.0 * rgb.xyz - 1.0;
|
|
}
|
|
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
|
|
const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
|
|
const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
|
|
const float ShiftRight8 = 1. / 256.;
|
|
vec4 packDepthToRGBA( const in float v ) {
|
|
vec4 r = vec4( fract( v * PackFactors ), v );
|
|
r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;
|
|
}
|
|
float unpackRGBAToDepth( const in vec4 v ) {
|
|
return dot( v, UnpackFactors );
|
|
}
|
|
vec4 pack2HalfToRGBA( vec2 v ) {
|
|
vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
|
|
return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
|
|
}
|
|
vec2 unpackRGBATo2Half( vec4 v ) {
|
|
return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
|
|
}
|
|
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
|
|
return ( viewZ + near ) / ( near - far );
|
|
}
|
|
float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {
|
|
return linearClipZ * ( near - far ) - near;
|
|
}
|
|
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
|
|
return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
|
|
}
|
|
float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {
|
|
return ( near * far ) / ( ( far - near ) * invClipZ - far );
|
|
}`,_m=`#ifdef PREMULTIPLIED_ALPHA
|
|
gl_FragColor.rgb *= gl_FragColor.a;
|
|
#endif`,Em=`vec4 mvPosition = vec4( transformed, 1.0 );
|
|
#ifdef USE_INSTANCING
|
|
mvPosition = instanceMatrix * mvPosition;
|
|
#endif
|
|
mvPosition = modelViewMatrix * mvPosition;
|
|
gl_Position = projectionMatrix * mvPosition;`,Lm=`#ifdef DITHERING
|
|
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
|
|
#endif`,Tm=`#ifdef DITHERING
|
|
vec3 dithering( vec3 color ) {
|
|
float grid_position = rand( gl_FragCoord.xy );
|
|
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
|
|
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
|
|
return color + dither_shift_RGB;
|
|
}
|
|
#endif`,Dm=`float roughnessFactor = roughness;
|
|
#ifdef USE_ROUGHNESSMAP
|
|
vec4 texelRoughness = texture2D( roughnessMap, vUv );
|
|
roughnessFactor *= texelRoughness.g;
|
|
#endif`,Hm=`#ifdef USE_ROUGHNESSMAP
|
|
uniform sampler2D roughnessMap;
|
|
#endif`,Vm=`#ifdef USE_SHADOWMAP
|
|
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
|
|
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
|
|
struct DirectionalLightShadow {
|
|
float shadowBias;
|
|
float shadowNormalBias;
|
|
float shadowRadius;
|
|
vec2 shadowMapSize;
|
|
};
|
|
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
|
|
#endif
|
|
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
|
uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
struct SpotLightShadow {
|
|
float shadowBias;
|
|
float shadowNormalBias;
|
|
float shadowRadius;
|
|
vec2 shadowMapSize;
|
|
};
|
|
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
#endif
|
|
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|
uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
|
|
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
|
|
struct PointLightShadow {
|
|
float shadowBias;
|
|
float shadowNormalBias;
|
|
float shadowRadius;
|
|
vec2 shadowMapSize;
|
|
float shadowCameraNear;
|
|
float shadowCameraFar;
|
|
};
|
|
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
|
|
#endif
|
|
float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
|
|
return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
|
|
}
|
|
vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
|
|
return unpackRGBATo2Half( texture2D( shadow, uv ) );
|
|
}
|
|
float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
|
|
float occlusion = 1.0;
|
|
vec2 distribution = texture2DDistribution( shadow, uv );
|
|
float hard_shadow = step( compare , distribution.x );
|
|
if (hard_shadow != 1.0 ) {
|
|
float distance = compare - distribution.x ;
|
|
float variance = max( 0.00000, distribution.y * distribution.y );
|
|
float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
|
|
}
|
|
return occlusion;
|
|
}
|
|
float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
|
|
float shadow = 1.0;
|
|
shadowCoord.xyz /= shadowCoord.w;
|
|
shadowCoord.z += shadowBias;
|
|
bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );
|
|
bool inFrustum = all( inFrustumVec );
|
|
bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );
|
|
bool frustumTest = all( frustumTestVec );
|
|
if ( frustumTest ) {
|
|
#if defined( SHADOWMAP_TYPE_PCF )
|
|
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
|
|
float dx0 = - texelSize.x * shadowRadius;
|
|
float dy0 = - texelSize.y * shadowRadius;
|
|
float dx1 = + texelSize.x * shadowRadius;
|
|
float dy1 = + texelSize.y * shadowRadius;
|
|
float dx2 = dx0 / 2.0;
|
|
float dy2 = dy0 / 2.0;
|
|
float dx3 = dx1 / 2.0;
|
|
float dy3 = dy1 / 2.0;
|
|
shadow = (
|
|
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
|
|
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
|
|
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
|
|
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
|
|
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
|
|
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
|
|
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
|
|
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
|
|
texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
|
|
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
|
|
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
|
|
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
|
|
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
|
|
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
|
|
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
|
|
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
|
|
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
|
|
) * ( 1.0 / 17.0 );
|
|
#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
|
|
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
|
|
float dx = texelSize.x;
|
|
float dy = texelSize.y;
|
|
vec2 uv = shadowCoord.xy;
|
|
vec2 f = fract( uv * shadowMapSize + 0.5 );
|
|
uv -= f * texelSize;
|
|
shadow = (
|
|
texture2DCompare( shadowMap, uv, shadowCoord.z ) +
|
|
texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
|
|
texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
|
|
texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
|
|
mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
|
|
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
|
|
f.x ) +
|
|
mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
|
|
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
|
|
f.x ) +
|
|
mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
|
|
texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
|
|
f.y ) +
|
|
mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
|
|
texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
|
|
f.y ) +
|
|
mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
|
|
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
|
|
f.x ),
|
|
mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
|
|
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
|
|
f.x ),
|
|
f.y )
|
|
) * ( 1.0 / 9.0 );
|
|
#elif defined( SHADOWMAP_TYPE_VSM )
|
|
shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
|
|
#else
|
|
shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
|
|
#endif
|
|
}
|
|
return shadow;
|
|
}
|
|
vec2 cubeToUV( vec3 v, float texelSizeY ) {
|
|
vec3 absV = abs( v );
|
|
float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
|
|
absV *= scaleToCube;
|
|
v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
|
|
vec2 planar = v.xy;
|
|
float almostATexel = 1.5 * texelSizeY;
|
|
float almostOne = 1.0 - almostATexel;
|
|
if ( absV.z >= almostOne ) {
|
|
if ( v.z > 0.0 )
|
|
planar.x = 4.0 - v.x;
|
|
} else if ( absV.x >= almostOne ) {
|
|
float signX = sign( v.x );
|
|
planar.x = v.z * signX + 2.0 * signX;
|
|
} else if ( absV.y >= almostOne ) {
|
|
float signY = sign( v.y );
|
|
planar.x = v.x + 2.0 * signY + 2.0;
|
|
planar.y = v.z * signY - 2.0;
|
|
}
|
|
return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
|
|
}
|
|
float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
|
|
vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
|
|
vec3 lightToPosition = shadowCoord.xyz;
|
|
float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
|
|
vec3 bd3D = normalize( lightToPosition );
|
|
#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
|
|
vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
|
|
return (
|
|
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
|
|
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
|
|
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
|
|
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
|
|
texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
|
|
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
|
|
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
|
|
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
|
|
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
|
|
) * ( 1.0 / 9.0 );
|
|
#else
|
|
return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
|
|
#endif
|
|
}
|
|
#endif`,Rm=`#ifdef USE_SHADOWMAP
|
|
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
|
|
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
|
|
struct DirectionalLightShadow {
|
|
float shadowBias;
|
|
float shadowNormalBias;
|
|
float shadowRadius;
|
|
vec2 shadowMapSize;
|
|
};
|
|
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
|
|
#endif
|
|
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
|
uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
struct SpotLightShadow {
|
|
float shadowBias;
|
|
float shadowNormalBias;
|
|
float shadowRadius;
|
|
vec2 shadowMapSize;
|
|
};
|
|
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
#endif
|
|
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|
uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
|
|
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
|
|
struct PointLightShadow {
|
|
float shadowBias;
|
|
float shadowNormalBias;
|
|
float shadowRadius;
|
|
vec2 shadowMapSize;
|
|
float shadowCameraNear;
|
|
float shadowCameraFar;
|
|
};
|
|
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
|
|
#endif
|
|
#endif`,Nm=`#ifdef USE_SHADOWMAP
|
|
#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0
|
|
vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
|
|
vec4 shadowWorldPosition;
|
|
#endif
|
|
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
#pragma unroll_loop_start
|
|
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
|
|
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
|
|
vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
|
|
}
|
|
#pragma unroll_loop_end
|
|
#endif
|
|
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
|
#pragma unroll_loop_start
|
|
for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
|
|
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );
|
|
vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;
|
|
}
|
|
#pragma unroll_loop_end
|
|
#endif
|
|
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|
#pragma unroll_loop_start
|
|
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
|
|
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
|
|
vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
|
|
}
|
|
#pragma unroll_loop_end
|
|
#endif
|
|
#endif`,Fm=`float getShadowMask() {
|
|
float shadow = 1.0;
|
|
#ifdef USE_SHADOWMAP
|
|
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
DirectionalLightShadow directionalLight;
|
|
#pragma unroll_loop_start
|
|
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
|
|
directionalLight = directionalLightShadows[ i ];
|
|
shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
|
|
}
|
|
#pragma unroll_loop_end
|
|
#endif
|
|
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
|
SpotLightShadow spotLight;
|
|
#pragma unroll_loop_start
|
|
for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
|
|
spotLight = spotLightShadows[ i ];
|
|
shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
|
|
}
|
|
#pragma unroll_loop_end
|
|
#endif
|
|
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|
PointLightShadow pointLight;
|
|
#pragma unroll_loop_start
|
|
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
|
|
pointLight = pointLightShadows[ i ];
|
|
shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
|
|
}
|
|
#pragma unroll_loop_end
|
|
#endif
|
|
#endif
|
|
return shadow;
|
|
}`,Bm=`#ifdef USE_SKINNING
|
|
mat4 boneMatX = getBoneMatrix( skinIndex.x );
|
|
mat4 boneMatY = getBoneMatrix( skinIndex.y );
|
|
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
|
|
mat4 boneMatW = getBoneMatrix( skinIndex.w );
|
|
#endif`,Pm=`#ifdef USE_SKINNING
|
|
uniform mat4 bindMatrix;
|
|
uniform mat4 bindMatrixInverse;
|
|
#ifdef BONE_TEXTURE
|
|
uniform highp sampler2D boneTexture;
|
|
uniform int boneTextureSize;
|
|
mat4 getBoneMatrix( const in float i ) {
|
|
float j = i * 4.0;
|
|
float x = mod( j, float( boneTextureSize ) );
|
|
float y = floor( j / float( boneTextureSize ) );
|
|
float dx = 1.0 / float( boneTextureSize );
|
|
float dy = 1.0 / float( boneTextureSize );
|
|
y = dy * ( y + 0.5 );
|
|
vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );
|
|
vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );
|
|
vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );
|
|
vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );
|
|
mat4 bone = mat4( v1, v2, v3, v4 );
|
|
return bone;
|
|
}
|
|
#else
|
|
uniform mat4 boneMatrices[ MAX_BONES ];
|
|
mat4 getBoneMatrix( const in float i ) {
|
|
mat4 bone = boneMatrices[ int(i) ];
|
|
return bone;
|
|
}
|
|
#endif
|
|
#endif`,Im=`#ifdef USE_SKINNING
|
|
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
|
|
vec4 skinned = vec4( 0.0 );
|
|
skinned += boneMatX * skinVertex * skinWeight.x;
|
|
skinned += boneMatY * skinVertex * skinWeight.y;
|
|
skinned += boneMatZ * skinVertex * skinWeight.z;
|
|
skinned += boneMatW * skinVertex * skinWeight.w;
|
|
transformed = ( bindMatrixInverse * skinned ).xyz;
|
|
#endif`,km=`#ifdef USE_SKINNING
|
|
mat4 skinMatrix = mat4( 0.0 );
|
|
skinMatrix += skinWeight.x * boneMatX;
|
|
skinMatrix += skinWeight.y * boneMatY;
|
|
skinMatrix += skinWeight.z * boneMatZ;
|
|
skinMatrix += skinWeight.w * boneMatW;
|
|
skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
|
|
objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
|
|
#ifdef USE_TANGENT
|
|
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
|
|
#endif
|
|
#endif`,Om=`float specularStrength;
|
|
#ifdef USE_SPECULARMAP
|
|
vec4 texelSpecular = texture2D( specularMap, vUv );
|
|
specularStrength = texelSpecular.r;
|
|
#else
|
|
specularStrength = 1.0;
|
|
#endif`,Um=`#ifdef USE_SPECULARMAP
|
|
uniform sampler2D specularMap;
|
|
#endif`,Gm=`#if defined( TONE_MAPPING )
|
|
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
|
|
#endif`,qm=`#ifndef saturate
|
|
#define saturate( a ) clamp( a, 0.0, 1.0 )
|
|
#endif
|
|
uniform float toneMappingExposure;
|
|
vec3 LinearToneMapping( vec3 color ) {
|
|
return toneMappingExposure * color;
|
|
}
|
|
vec3 ReinhardToneMapping( vec3 color ) {
|
|
color *= toneMappingExposure;
|
|
return saturate( color / ( vec3( 1.0 ) + color ) );
|
|
}
|
|
vec3 OptimizedCineonToneMapping( vec3 color ) {
|
|
color *= toneMappingExposure;
|
|
color = max( vec3( 0.0 ), color - 0.004 );
|
|
return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
|
|
}
|
|
vec3 RRTAndODTFit( vec3 v ) {
|
|
vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
|
|
vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
|
|
return a / b;
|
|
}
|
|
vec3 ACESFilmicToneMapping( vec3 color ) {
|
|
const mat3 ACESInputMat = mat3(
|
|
vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
|
|
vec3( 0.04823, 0.01566, 0.83777 )
|
|
);
|
|
const mat3 ACESOutputMat = mat3(
|
|
vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
|
|
vec3( -0.07367, -0.00605, 1.07602 )
|
|
);
|
|
color *= toneMappingExposure / 0.6;
|
|
color = ACESInputMat * color;
|
|
color = RRTAndODTFit( color );
|
|
color = ACESOutputMat * color;
|
|
return saturate( color );
|
|
}
|
|
vec3 CustomToneMapping( vec3 color ) { return color; }`,Wm=`#ifdef USE_TRANSMISSION
|
|
float transmissionAlpha = 1.0;
|
|
float transmissionFactor = transmission;
|
|
float thicknessFactor = thickness;
|
|
#ifdef USE_TRANSMISSIONMAP
|
|
transmissionFactor *= texture2D( transmissionMap, vUv ).r;
|
|
#endif
|
|
#ifdef USE_THICKNESSMAP
|
|
thicknessFactor *= texture2D( thicknessMap, vUv ).g;
|
|
#endif
|
|
vec3 pos = vWorldPosition;
|
|
vec3 v = normalize( cameraPosition - pos );
|
|
vec3 n = inverseTransformDirection( normal, viewMatrix );
|
|
vec4 transmission = getIBLVolumeRefraction(
|
|
n, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,
|
|
pos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,
|
|
attenuationColor, attenuationDistance );
|
|
totalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );
|
|
transmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );
|
|
#endif`,jm=`#ifdef USE_TRANSMISSION
|
|
uniform float transmission;
|
|
uniform float thickness;
|
|
uniform float attenuationDistance;
|
|
uniform vec3 attenuationColor;
|
|
#ifdef USE_TRANSMISSIONMAP
|
|
uniform sampler2D transmissionMap;
|
|
#endif
|
|
#ifdef USE_THICKNESSMAP
|
|
uniform sampler2D thicknessMap;
|
|
#endif
|
|
uniform vec2 transmissionSamplerSize;
|
|
uniform sampler2D transmissionSamplerMap;
|
|
uniform mat4 modelMatrix;
|
|
uniform mat4 projectionMatrix;
|
|
varying vec3 vWorldPosition;
|
|
vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
|
|
vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
|
|
vec3 modelScale;
|
|
modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
|
|
modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
|
|
modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
|
|
return normalize( refractionVector ) * thickness * modelScale;
|
|
}
|
|
float applyIorToRoughness( const in float roughness, const in float ior ) {
|
|
return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
|
|
}
|
|
vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
|
|
float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
|
|
#ifdef TEXTURE_LOD_EXT
|
|
return texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );
|
|
#else
|
|
return texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );
|
|
#endif
|
|
}
|
|
vec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
|
|
if ( attenuationDistance == 0.0 ) {
|
|
return radiance;
|
|
} else {
|
|
vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
|
|
vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance * radiance;
|
|
}
|
|
}
|
|
vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
|
|
const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
|
|
const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,
|
|
const in vec3 attenuationColor, const in float attenuationDistance ) {
|
|
vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
|
|
vec3 refractedRayExit = position + transmissionRay;
|
|
vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
|
|
vec2 refractionCoords = ndcPos.xy / ndcPos.w;
|
|
refractionCoords += 1.0;
|
|
refractionCoords /= 2.0;
|
|
vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
|
|
vec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );
|
|
vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
|
|
return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );
|
|
}
|
|
#endif`,Zm=`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )
|
|
varying vec2 vUv;
|
|
#endif`,Xm=`#ifdef USE_UV
|
|
#ifdef UVS_VERTEX_ONLY
|
|
vec2 vUv;
|
|
#else
|
|
varying vec2 vUv;
|
|
#endif
|
|
uniform mat3 uvTransform;
|
|
#endif`,Ym=`#ifdef USE_UV
|
|
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
|
#endif`,$m=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
|
|
varying vec2 vUv2;
|
|
#endif`,Jm=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
|
|
attribute vec2 uv2;
|
|
varying vec2 vUv2;
|
|
uniform mat3 uv2Transform;
|
|
#endif`,Qm=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
|
|
vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;
|
|
#endif`,Km=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )
|
|
vec4 worldPosition = vec4( transformed, 1.0 );
|
|
#ifdef USE_INSTANCING
|
|
worldPosition = instanceMatrix * worldPosition;
|
|
#endif
|
|
worldPosition = modelMatrix * worldPosition;
|
|
#endif`,eg=`varying vec2 vUv;
|
|
uniform mat3 uvTransform;
|
|
void main() {
|
|
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
|
gl_Position = vec4( position.xy, 1.0, 1.0 );
|
|
}`,tg=`uniform sampler2D t2D;
|
|
varying vec2 vUv;
|
|
void main() {
|
|
gl_FragColor = texture2D( t2D, vUv );
|
|
#include <tonemapping_fragment>
|
|
#include <encodings_fragment>
|
|
}`,ig=`varying vec3 vWorldDirection;
|
|
#include <common>
|
|
void main() {
|
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|
#include <begin_vertex>
|
|
#include <project_vertex>
|
|
gl_Position.z = gl_Position.w;
|
|
}`,ng=`#include <envmap_common_pars_fragment>
|
|
uniform float opacity;
|
|
varying vec3 vWorldDirection;
|
|
#include <cube_uv_reflection_fragment>
|
|
void main() {
|
|
vec3 vReflect = vWorldDirection;
|
|
#include <envmap_fragment>
|
|
gl_FragColor = envColor;
|
|
gl_FragColor.a *= opacity;
|
|
#include <tonemapping_fragment>
|
|
#include <encodings_fragment>
|
|
}`,sg=`#include <common>
|
|
#include <uv_pars_vertex>
|
|
#include <displacementmap_pars_vertex>
|
|
#include <morphtarget_pars_vertex>
|
|
#include <skinning_pars_vertex>
|
|
#include <logdepthbuf_pars_vertex>
|
|
#include <clipping_planes_pars_vertex>
|
|
varying vec2 vHighPrecisionZW;
|
|
void main() {
|
|
#include <uv_vertex>
|
|
#include <skinbase_vertex>
|
|
#ifdef USE_DISPLACEMENTMAP
|
|
#include <beginnormal_vertex>
|
|
#include <morphnormal_vertex>
|
|
#include <skinnormal_vertex>
|
|
#endif
|
|
#include <begin_vertex>
|
|
#include <morphtarget_vertex>
|
|
#include <skinning_vertex>
|
|
#include <displacementmap_vertex>
|
|
#include <project_vertex>
|
|
#include <logdepthbuf_vertex>
|
|
#include <clipping_planes_vertex>
|
|
vHighPrecisionZW = gl_Position.zw;
|
|
}`,rg=`#if DEPTH_PACKING == 3200
|
|
uniform float opacity;
|
|
#endif
|
|
#include <common>
|
|
#include <packing>
|
|
#include <uv_pars_fragment>
|
|
#include <map_pars_fragment>
|
|
#include <alphamap_pars_fragment>
|
|
#include <alphatest_pars_fragment>
|
|
#include <logdepthbuf_pars_fragment>
|
|
#include <clipping_planes_pars_fragment>
|
|
varying vec2 vHighPrecisionZW;
|
|
void main() {
|
|
#include <clipping_planes_fragment>
|
|
vec4 diffuseColor = vec4( 1.0 );
|
|
#if DEPTH_PACKING == 3200
|
|
diffuseColor.a = opacity;
|
|
#endif
|
|
#include <map_fragment>
|
|
#include <alphamap_fragment>
|
|
#include <alphatest_fragment>
|
|
#include <logdepthbuf_fragment>
|
|
float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
|
|
#if DEPTH_PACKING == 3200
|
|
gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
|
|
#elif DEPTH_PACKING == 3201
|
|
gl_FragColor = packDepthToRGBA( fragCoordZ );
|
|
#endif
|
|
}`,ag=`#define DISTANCE
|
|
varying vec3 vWorldPosition;
|
|
#include <common>
|
|
#include <uv_pars_vertex>
|
|
#include <displacementmap_pars_vertex>
|
|
#include <morphtarget_pars_vertex>
|
|
#include <skinning_pars_vertex>
|
|
#include <clipping_planes_pars_vertex>
|
|
void main() {
|
|
#include <uv_vertex>
|
|
#include <skinbase_vertex>
|
|
#ifdef USE_DISPLACEMENTMAP
|
|
#include <beginnormal_vertex>
|
|
#include <morphnormal_vertex>
|
|
#include <skinnormal_vertex>
|
|
#endif
|
|
#include <begin_vertex>
|
|
#include <morphtarget_vertex>
|
|
#include <skinning_vertex>
|
|
#include <displacementmap_vertex>
|
|
#include <project_vertex>
|
|
#include <worldpos_vertex>
|
|
#include <clipping_planes_vertex>
|
|
vWorldPosition = worldPosition.xyz;
|
|
}`,og=`#define DISTANCE
|
|
uniform vec3 referencePosition;
|
|
uniform float nearDistance;
|
|
uniform float farDistance;
|
|
varying vec3 vWorldPosition;
|
|
#include <common>
|
|
#include <packing>
|
|
#include <uv_pars_fragment>
|
|
#include <map_pars_fragment>
|
|
#include <alphamap_pars_fragment>
|
|
#include <alphatest_pars_fragment>
|
|
#include <clipping_planes_pars_fragment>
|
|
void main () {
|
|
#include <clipping_planes_fragment>
|
|
vec4 diffuseColor = vec4( 1.0 );
|
|
#include <map_fragment>
|
|
#include <alphamap_fragment>
|
|
#include <alphatest_fragment>
|
|
float dist = length( vWorldPosition - referencePosition );
|
|
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
|
|
dist = saturate( dist );
|
|
gl_FragColor = packDepthToRGBA( dist );
|
|
}`,cg=`varying vec3 vWorldDirection;
|
|
#include <common>
|
|
void main() {
|
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|
#include <begin_vertex>
|
|
#include <project_vertex>
|
|
}`,lg=`uniform sampler2D tEquirect;
|
|
varying vec3 vWorldDirection;
|
|
#include <common>
|
|
void main() {
|
|
vec3 direction = normalize( vWorldDirection );
|
|
vec2 sampleUV = equirectUv( direction );
|
|
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
#include <tonemapping_fragment>
|
|
#include <encodings_fragment>
|
|
}`,hg=`uniform float scale;
|
|
attribute float lineDistance;
|
|
varying float vLineDistance;
|
|
#include <common>
|
|
#include <color_pars_vertex>
|
|
#include <fog_pars_vertex>
|
|
#include <morphtarget_pars_vertex>
|
|
#include <logdepthbuf_pars_vertex>
|
|
#include <clipping_planes_pars_vertex>
|
|
void main() {
|
|
vLineDistance = scale * lineDistance;
|
|
#include <color_vertex>
|
|
#include <begin_vertex>
|
|
#include <morphtarget_vertex>
|
|
#include <project_vertex>
|
|
#include <logdepthbuf_vertex>
|
|
#include <clipping_planes_vertex>
|
|
#include <fog_vertex>
|
|
}`,ug=`uniform vec3 diffuse;
|
|
uniform float opacity;
|
|
uniform float dashSize;
|
|
uniform float totalSize;
|
|
varying float vLineDistance;
|
|
#include <common>
|
|
#include <color_pars_fragment>
|
|
#include <fog_pars_fragment>
|
|
#include <logdepthbuf_pars_fragment>
|
|
#include <clipping_planes_pars_fragment>
|
|
void main() {
|
|
#include <clipping_planes_fragment>
|
|
if ( mod( vLineDistance, totalSize ) > dashSize ) {
|
|
discard;
|
|
}
|
|
vec3 outgoingLight = vec3( 0.0 );
|
|
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
#include <logdepthbuf_fragment>
|
|
#include <color_fragment>
|
|
outgoingLight = diffuseColor.rgb;
|
|
#include <output_fragment>
|
|
#include <tonemapping_fragment>
|
|
#include <encodings_fragment>
|
|
#include <fog_fragment>
|
|
#include <premultiplied_alpha_fragment>
|
|
}`,fg=`#include <common>
|
|
#include <uv_pars_vertex>
|
|
#include <uv2_pars_vertex>
|
|
#include <envmap_pars_vertex>
|
|
#include <color_pars_vertex>
|
|
#include <fog_pars_vertex>
|
|
#include <morphtarget_pars_vertex>
|
|
#include <skinning_pars_vertex>
|
|
#include <logdepthbuf_pars_vertex>
|
|
#include <clipping_planes_pars_vertex>
|
|
void main() {
|
|
#include <uv_vertex>
|
|
#include <uv2_vertex>
|
|
#include <color_vertex>
|
|
#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
|
|
#include <beginnormal_vertex>
|
|
#include <morphnormal_vertex>
|
|
#include <skinbase_vertex>
|
|
#include <skinnormal_vertex>
|
|
#include <defaultnormal_vertex>
|
|
#endif
|
|
#include <begin_vertex>
|
|
#include <morphtarget_vertex>
|
|
#include <skinning_vertex>
|
|
#include <project_vertex>
|
|
#include <logdepthbuf_vertex>
|
|
#include <clipping_planes_vertex>
|
|
#include <worldpos_vertex>
|
|
#include <envmap_vertex>
|
|
#include <fog_vertex>
|
|
}`,dg=`uniform vec3 diffuse;
|
|
uniform float opacity;
|
|
#ifndef FLAT_SHADED
|
|
varying vec3 vNormal;
|
|
#endif
|
|
#include <common>
|
|
#include <dithering_pars_fragment>
|
|
#include <color_pars_fragment>
|
|
#include <uv_pars_fragment>
|
|
#include <uv2_pars_fragment>
|
|
#include <map_pars_fragment>
|
|
#include <alphamap_pars_fragment>
|
|
#include <alphatest_pars_fragment>
|
|
#include <aomap_pars_fragment>
|
|
#include <lightmap_pars_fragment>
|
|
#include <envmap_common_pars_fragment>
|
|
#include <envmap_pars_fragment>
|
|
#include <cube_uv_reflection_fragment>
|
|
#include <fog_pars_fragment>
|
|
#include <specularmap_pars_fragment>
|
|
#include <logdepthbuf_pars_fragment>
|
|
#include <clipping_planes_pars_fragment>
|
|
void main() {
|
|
#include <clipping_planes_fragment>
|
|
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
#include <logdepthbuf_fragment>
|
|
#include <map_fragment>
|
|
#include <color_fragment>
|
|
#include <alphamap_fragment>
|
|
#include <alphatest_fragment>
|
|
#include <specularmap_fragment>
|
|
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
#ifdef USE_LIGHTMAP
|
|
vec4 lightMapTexel= texture2D( lightMap, vUv2 );
|
|
reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity;
|
|
#else
|
|
reflectedLight.indirectDiffuse += vec3( 1.0 );
|
|
#endif
|
|
#include <aomap_fragment>
|
|
reflectedLight.indirectDiffuse *= diffuseColor.rgb;
|
|
vec3 outgoingLight = reflectedLight.indirectDiffuse;
|
|
#include <envmap_fragment>
|
|
#include <output_fragment>
|
|
#include <tonemapping_fragment>
|
|
#include <encodings_fragment>
|
|
#include <fog_fragment>
|
|
#include <premultiplied_alpha_fragment>
|
|
#include <dithering_fragment>
|
|
}`,pg=`#define LAMBERT
|
|
varying vec3 vLightFront;
|
|
varying vec3 vIndirectFront;
|
|
#ifdef DOUBLE_SIDED
|
|
varying vec3 vLightBack;
|
|
varying vec3 vIndirectBack;
|
|
#endif
|
|
#include <common>
|
|
#include <uv_pars_vertex>
|
|
#include <uv2_pars_vertex>
|
|
#include <envmap_pars_vertex>
|
|
#include <bsdfs>
|
|
#include <lights_pars_begin>
|
|
#include <color_pars_vertex>
|
|
#include <fog_pars_vertex>
|
|
#include <morphtarget_pars_vertex>
|
|
#include <skinning_pars_vertex>
|
|
#include <shadowmap_pars_vertex>
|
|
#include <logdepthbuf_pars_vertex>
|
|
#include <clipping_planes_pars_vertex>
|
|
void main() {
|
|
#include <uv_vertex>
|
|
#include <uv2_vertex>
|
|
#include <color_vertex>
|
|
#include <beginnormal_vertex>
|
|
#include <morphnormal_vertex>
|
|
#include <skinbase_vertex>
|
|
#include <skinnormal_vertex>
|
|
#include <defaultnormal_vertex>
|
|
#include <begin_vertex>
|
|
#include <morphtarget_vertex>
|
|
#include <skinning_vertex>
|
|
#include <project_vertex>
|
|
#include <logdepthbuf_vertex>
|
|
#include <clipping_planes_vertex>
|
|
#include <worldpos_vertex>
|
|
#include <envmap_vertex>
|
|
#include <lights_lambert_vertex>
|
|
#include <shadowmap_vertex>
|
|
#include <fog_vertex>
|
|
}`,mg=`uniform vec3 diffuse;
|
|
uniform vec3 emissive;
|
|
uniform float opacity;
|
|
varying vec3 vLightFront;
|
|
varying vec3 vIndirectFront;
|
|
#ifdef DOUBLE_SIDED
|
|
varying vec3 vLightBack;
|
|
varying vec3 vIndirectBack;
|
|
#endif
|
|
#include <common>
|
|
#include <packing>
|
|
#include <dithering_pars_fragment>
|
|
#include <color_pars_fragment>
|
|
#include <uv_pars_fragment>
|
|
#include <uv2_pars_fragment>
|
|
#include <map_pars_fragment>
|
|
#include <alphamap_pars_fragment>
|
|
#include <alphatest_pars_fragment>
|
|
#include <aomap_pars_fragment>
|
|
#include <lightmap_pars_fragment>
|
|
#include <emissivemap_pars_fragment>
|
|
#include <envmap_common_pars_fragment>
|
|
#include <envmap_pars_fragment>
|
|
#include <cube_uv_reflection_fragment>
|
|
#include <bsdfs>
|
|
#include <lights_pars_begin>
|
|
#include <fog_pars_fragment>
|
|
#include <shadowmap_pars_fragment>
|
|
#include <shadowmask_pars_fragment>
|
|
#include <specularmap_pars_fragment>
|
|
#include <logdepthbuf_pars_fragment>
|
|
#include <clipping_planes_pars_fragment>
|
|
void main() {
|
|
#include <clipping_planes_fragment>
|
|
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
vec3 totalEmissiveRadiance = emissive;
|
|
#include <logdepthbuf_fragment>
|
|
#include <map_fragment>
|
|
#include <color_fragment>
|
|
#include <alphamap_fragment>
|
|
#include <alphatest_fragment>
|
|
#include <specularmap_fragment>
|
|
#include <emissivemap_fragment>
|
|
#ifdef DOUBLE_SIDED
|
|
reflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;
|
|
#else
|
|
reflectedLight.indirectDiffuse += vIndirectFront;
|
|
#endif
|
|
#include <lightmap_fragment>
|
|
reflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );
|
|
#ifdef DOUBLE_SIDED
|
|
reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;
|
|
#else
|
|
reflectedLight.directDiffuse = vLightFront;
|
|
#endif
|
|
reflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();
|
|
#include <aomap_fragment>
|
|
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
|
|
#include <envmap_fragment>
|
|
#include <output_fragment>
|
|
#include <tonemapping_fragment>
|
|
#include <encodings_fragment>
|
|
#include <fog_fragment>
|
|
#include <premultiplied_alpha_fragment>
|
|
#include <dithering_fragment>
|
|
}`,gg=`#define MATCAP
|
|
varying vec3 vViewPosition;
|
|
#include <common>
|
|
#include <uv_pars_vertex>
|
|
#include <color_pars_vertex>
|
|
#include <displacementmap_pars_vertex>
|
|
#include <fog_pars_vertex>
|
|
#include <normal_pars_vertex>
|
|
#include <morphtarget_pars_vertex>
|
|
#include <skinning_pars_vertex>
|
|
#include <logdepthbuf_pars_vertex>
|
|
#include <clipping_planes_pars_vertex>
|
|
void main() {
|
|
#include <uv_vertex>
|
|
#include <color_vertex>
|
|
#include <beginnormal_vertex>
|
|
#include <morphnormal_vertex>
|
|
#include <skinbase_vertex>
|
|
#include <skinnormal_vertex>
|
|
#include <defaultnormal_vertex>
|
|
#include <normal_vertex>
|
|
#include <begin_vertex>
|
|
#include <morphtarget_vertex>
|
|
#include <skinning_vertex>
|
|
#include <displacementmap_vertex>
|
|
#include <project_vertex>
|
|
#include <logdepthbuf_vertex>
|
|
#include <clipping_planes_vertex>
|
|
#include <fog_vertex>
|
|
vViewPosition = - mvPosition.xyz;
|
|
}`,vg=`#define MATCAP
|
|
uniform vec3 diffuse;
|
|
uniform float opacity;
|
|
uniform sampler2D matcap;
|
|
varying vec3 vViewPosition;
|
|
#include <common>
|
|
#include <dithering_pars_fragment>
|
|
#include <color_pars_fragment>
|
|
#include <uv_pars_fragment>
|
|
#include <map_pars_fragment>
|
|
#include <alphamap_pars_fragment>
|
|
#include <alphatest_pars_fragment>
|
|
#include <fog_pars_fragment>
|
|
#include <normal_pars_fragment>
|
|
#include <bumpmap_pars_fragment>
|
|
#include <normalmap_pars_fragment>
|
|
#include <logdepthbuf_pars_fragment>
|
|
#include <clipping_planes_pars_fragment>
|
|
void main() {
|
|
#include <clipping_planes_fragment>
|
|
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
#include <logdepthbuf_fragment>
|
|
#include <map_fragment>
|
|
#include <color_fragment>
|
|
#include <alphamap_fragment>
|
|
#include <alphatest_fragment>
|
|
#include <normal_fragment_begin>
|
|
#include <normal_fragment_maps>
|
|
vec3 viewDir = normalize( vViewPosition );
|
|
vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
|
|
vec3 y = cross( viewDir, x );
|
|
vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
|
|
#ifdef USE_MATCAP
|
|
vec4 matcapColor = texture2D( matcap, uv );
|
|
#else
|
|
vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
|
|
#endif
|
|
vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
|
|
#include <output_fragment>
|
|
#include <tonemapping_fragment>
|
|
#include <encodings_fragment>
|
|
#include <fog_fragment>
|
|
#include <premultiplied_alpha_fragment>
|
|
#include <dithering_fragment>
|
|
}`,xg=`#define NORMAL
|
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
|
|
varying vec3 vViewPosition;
|
|
#endif
|
|
#include <common>
|
|
#include <uv_pars_vertex>
|
|
#include <displacementmap_pars_vertex>
|
|
#include <normal_pars_vertex>
|
|
#include <morphtarget_pars_vertex>
|
|
#include <skinning_pars_vertex>
|
|
#include <logdepthbuf_pars_vertex>
|
|
#include <clipping_planes_pars_vertex>
|
|
void main() {
|
|
#include <uv_vertex>
|
|
#include <beginnormal_vertex>
|
|
#include <morphnormal_vertex>
|
|
#include <skinbase_vertex>
|
|
#include <skinnormal_vertex>
|
|
#include <defaultnormal_vertex>
|
|
#include <normal_vertex>
|
|
#include <begin_vertex>
|
|
#include <morphtarget_vertex>
|
|
#include <skinning_vertex>
|
|
#include <displacementmap_vertex>
|
|
#include <project_vertex>
|
|
#include <logdepthbuf_vertex>
|
|
#include <clipping_planes_vertex>
|
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
|
|
vViewPosition = - mvPosition.xyz;
|
|
#endif
|
|
}`,yg=`#define NORMAL
|
|
uniform float opacity;
|
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
|
|
varying vec3 vViewPosition;
|
|
#endif
|
|
#include <packing>
|
|
#include <uv_pars_fragment>
|
|
#include <normal_pars_fragment>
|
|
#include <bumpmap_pars_fragment>
|
|
#include <normalmap_pars_fragment>
|
|
#include <logdepthbuf_pars_fragment>
|
|
#include <clipping_planes_pars_fragment>
|
|
void main() {
|
|
#include <clipping_planes_fragment>
|
|
#include <logdepthbuf_fragment>
|
|
#include <normal_fragment_begin>
|
|
#include <normal_fragment_maps>
|
|
gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
|
|
}`,wg=`#define PHONG
|
|
varying vec3 vViewPosition;
|
|
#include <common>
|
|
#include <uv_pars_vertex>
|
|
#include <uv2_pars_vertex>
|
|
#include <displacementmap_pars_vertex>
|
|
#include <envmap_pars_vertex>
|
|
#include <color_pars_vertex>
|
|
#include <fog_pars_vertex>
|
|
#include <normal_pars_vertex>
|
|
#include <morphtarget_pars_vertex>
|
|
#include <skinning_pars_vertex>
|
|
#include <shadowmap_pars_vertex>
|
|
#include <logdepthbuf_pars_vertex>
|
|
#include <clipping_planes_pars_vertex>
|
|
void main() {
|
|
#include <uv_vertex>
|
|
#include <uv2_vertex>
|
|
#include <color_vertex>
|
|
#include <beginnormal_vertex>
|
|
#include <morphnormal_vertex>
|
|
#include <skinbase_vertex>
|
|
#include <skinnormal_vertex>
|
|
#include <defaultnormal_vertex>
|
|
#include <normal_vertex>
|
|
#include <begin_vertex>
|
|
#include <morphtarget_vertex>
|
|
#include <skinning_vertex>
|
|
#include <displacementmap_vertex>
|
|
#include <project_vertex>
|
|
#include <logdepthbuf_vertex>
|
|
#include <clipping_planes_vertex>
|
|
vViewPosition = - mvPosition.xyz;
|
|
#include <worldpos_vertex>
|
|
#include <envmap_vertex>
|
|
#include <shadowmap_vertex>
|
|
#include <fog_vertex>
|
|
}`,bg=`#define PHONG
|
|
uniform vec3 diffuse;
|
|
uniform vec3 emissive;
|
|
uniform vec3 specular;
|
|
uniform float shininess;
|
|
uniform float opacity;
|
|
#include <common>
|
|
#include <packing>
|
|
#include <dithering_pars_fragment>
|
|
#include <color_pars_fragment>
|
|
#include <uv_pars_fragment>
|
|
#include <uv2_pars_fragment>
|
|
#include <map_pars_fragment>
|
|
#include <alphamap_pars_fragment>
|
|
#include <alphatest_pars_fragment>
|
|
#include <aomap_pars_fragment>
|
|
#include <lightmap_pars_fragment>
|
|
#include <emissivemap_pars_fragment>
|
|
#include <envmap_common_pars_fragment>
|
|
#include <envmap_pars_fragment>
|
|
#include <cube_uv_reflection_fragment>
|
|
#include <fog_pars_fragment>
|
|
#include <bsdfs>
|
|
#include <lights_pars_begin>
|
|
#include <normal_pars_fragment>
|
|
#include <lights_phong_pars_fragment>
|
|
#include <shadowmap_pars_fragment>
|
|
#include <bumpmap_pars_fragment>
|
|
#include <normalmap_pars_fragment>
|
|
#include <specularmap_pars_fragment>
|
|
#include <logdepthbuf_pars_fragment>
|
|
#include <clipping_planes_pars_fragment>
|
|
void main() {
|
|
#include <clipping_planes_fragment>
|
|
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
vec3 totalEmissiveRadiance = emissive;
|
|
#include <logdepthbuf_fragment>
|
|
#include <map_fragment>
|
|
#include <color_fragment>
|
|
#include <alphamap_fragment>
|
|
#include <alphatest_fragment>
|
|
#include <specularmap_fragment>
|
|
#include <normal_fragment_begin>
|
|
#include <normal_fragment_maps>
|
|
#include <emissivemap_fragment>
|
|
#include <lights_phong_fragment>
|
|
#include <lights_fragment_begin>
|
|
#include <lights_fragment_maps>
|
|
#include <lights_fragment_end>
|
|
#include <aomap_fragment>
|
|
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
|
|
#include <envmap_fragment>
|
|
#include <output_fragment>
|
|
#include <tonemapping_fragment>
|
|
#include <encodings_fragment>
|
|
#include <fog_fragment>
|
|
#include <premultiplied_alpha_fragment>
|
|
#include <dithering_fragment>
|
|
}`,Mg=`#define STANDARD
|
|
varying vec3 vViewPosition;
|
|
#ifdef USE_TRANSMISSION
|
|
varying vec3 vWorldPosition;
|
|
#endif
|
|
#include <common>
|
|
#include <uv_pars_vertex>
|
|
#include <uv2_pars_vertex>
|
|
#include <displacementmap_pars_vertex>
|
|
#include <color_pars_vertex>
|
|
#include <fog_pars_vertex>
|
|
#include <normal_pars_vertex>
|
|
#include <morphtarget_pars_vertex>
|
|
#include <skinning_pars_vertex>
|
|
#include <shadowmap_pars_vertex>
|
|
#include <logdepthbuf_pars_vertex>
|
|
#include <clipping_planes_pars_vertex>
|
|
void main() {
|
|
#include <uv_vertex>
|
|
#include <uv2_vertex>
|
|
#include <color_vertex>
|
|
#include <beginnormal_vertex>
|
|
#include <morphnormal_vertex>
|
|
#include <skinbase_vertex>
|
|
#include <skinnormal_vertex>
|
|
#include <defaultnormal_vertex>
|
|
#include <normal_vertex>
|
|
#include <begin_vertex>
|
|
#include <morphtarget_vertex>
|
|
#include <skinning_vertex>
|
|
#include <displacementmap_vertex>
|
|
#include <project_vertex>
|
|
#include <logdepthbuf_vertex>
|
|
#include <clipping_planes_vertex>
|
|
vViewPosition = - mvPosition.xyz;
|
|
#include <worldpos_vertex>
|
|
#include <shadowmap_vertex>
|
|
#include <fog_vertex>
|
|
#ifdef USE_TRANSMISSION
|
|
vWorldPosition = worldPosition.xyz;
|
|
#endif
|
|
}`,zg=`#define STANDARD
|
|
#ifdef PHYSICAL
|
|
#define IOR
|
|
#define SPECULAR
|
|
#endif
|
|
uniform vec3 diffuse;
|
|
uniform vec3 emissive;
|
|
uniform float roughness;
|
|
uniform float metalness;
|
|
uniform float opacity;
|
|
#ifdef IOR
|
|
uniform float ior;
|
|
#endif
|
|
#ifdef SPECULAR
|
|
uniform float specularIntensity;
|
|
uniform vec3 specularColor;
|
|
#ifdef USE_SPECULARINTENSITYMAP
|
|
uniform sampler2D specularIntensityMap;
|
|
#endif
|
|
#ifdef USE_SPECULARCOLORMAP
|
|
uniform sampler2D specularColorMap;
|
|
#endif
|
|
#endif
|
|
#ifdef USE_CLEARCOAT
|
|
uniform float clearcoat;
|
|
uniform float clearcoatRoughness;
|
|
#endif
|
|
#ifdef USE_SHEEN
|
|
uniform vec3 sheenColor;
|
|
uniform float sheenRoughness;
|
|
#ifdef USE_SHEENCOLORMAP
|
|
uniform sampler2D sheenColorMap;
|
|
#endif
|
|
#ifdef USE_SHEENROUGHNESSMAP
|
|
uniform sampler2D sheenRoughnessMap;
|
|
#endif
|
|
#endif
|
|
varying vec3 vViewPosition;
|
|
#include <common>
|
|
#include <packing>
|
|
#include <dithering_pars_fragment>
|
|
#include <color_pars_fragment>
|
|
#include <uv_pars_fragment>
|
|
#include <uv2_pars_fragment>
|
|
#include <map_pars_fragment>
|
|
#include <alphamap_pars_fragment>
|
|
#include <alphatest_pars_fragment>
|
|
#include <aomap_pars_fragment>
|
|
#include <lightmap_pars_fragment>
|
|
#include <emissivemap_pars_fragment>
|
|
#include <bsdfs>
|
|
#include <cube_uv_reflection_fragment>
|
|
#include <envmap_common_pars_fragment>
|
|
#include <envmap_physical_pars_fragment>
|
|
#include <fog_pars_fragment>
|
|
#include <lights_pars_begin>
|
|
#include <normal_pars_fragment>
|
|
#include <lights_physical_pars_fragment>
|
|
#include <transmission_pars_fragment>
|
|
#include <shadowmap_pars_fragment>
|
|
#include <bumpmap_pars_fragment>
|
|
#include <normalmap_pars_fragment>
|
|
#include <clearcoat_pars_fragment>
|
|
#include <roughnessmap_pars_fragment>
|
|
#include <metalnessmap_pars_fragment>
|
|
#include <logdepthbuf_pars_fragment>
|
|
#include <clipping_planes_pars_fragment>
|
|
void main() {
|
|
#include <clipping_planes_fragment>
|
|
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
vec3 totalEmissiveRadiance = emissive;
|
|
#include <logdepthbuf_fragment>
|
|
#include <map_fragment>
|
|
#include <color_fragment>
|
|
#include <alphamap_fragment>
|
|
#include <alphatest_fragment>
|
|
#include <roughnessmap_fragment>
|
|
#include <metalnessmap_fragment>
|
|
#include <normal_fragment_begin>
|
|
#include <normal_fragment_maps>
|
|
#include <clearcoat_normal_fragment_begin>
|
|
#include <clearcoat_normal_fragment_maps>
|
|
#include <emissivemap_fragment>
|
|
#include <lights_physical_fragment>
|
|
#include <lights_fragment_begin>
|
|
#include <lights_fragment_maps>
|
|
#include <lights_fragment_end>
|
|
#include <aomap_fragment>
|
|
vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
|
|
vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
|
|
#include <transmission_fragment>
|
|
vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
|
|
#ifdef USE_SHEEN
|
|
float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
|
|
outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;
|
|
#endif
|
|
#ifdef USE_CLEARCOAT
|
|
float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );
|
|
vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
|
|
outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;
|
|
#endif
|
|
#include <output_fragment>
|
|
#include <tonemapping_fragment>
|
|
#include <encodings_fragment>
|
|
#include <fog_fragment>
|
|
#include <premultiplied_alpha_fragment>
|
|
#include <dithering_fragment>
|
|
}`,Cg=`#define TOON
|
|
varying vec3 vViewPosition;
|
|
#include <common>
|
|
#include <uv_pars_vertex>
|
|
#include <uv2_pars_vertex>
|
|
#include <displacementmap_pars_vertex>
|
|
#include <color_pars_vertex>
|
|
#include <fog_pars_vertex>
|
|
#include <normal_pars_vertex>
|
|
#include <morphtarget_pars_vertex>
|
|
#include <skinning_pars_vertex>
|
|
#include <shadowmap_pars_vertex>
|
|
#include <logdepthbuf_pars_vertex>
|
|
#include <clipping_planes_pars_vertex>
|
|
void main() {
|
|
#include <uv_vertex>
|
|
#include <uv2_vertex>
|
|
#include <color_vertex>
|
|
#include <beginnormal_vertex>
|
|
#include <morphnormal_vertex>
|
|
#include <skinbase_vertex>
|
|
#include <skinnormal_vertex>
|
|
#include <defaultnormal_vertex>
|
|
#include <normal_vertex>
|
|
#include <begin_vertex>
|
|
#include <morphtarget_vertex>
|
|
#include <skinning_vertex>
|
|
#include <displacementmap_vertex>
|
|
#include <project_vertex>
|
|
#include <logdepthbuf_vertex>
|
|
#include <clipping_planes_vertex>
|
|
vViewPosition = - mvPosition.xyz;
|
|
#include <worldpos_vertex>
|
|
#include <shadowmap_vertex>
|
|
#include <fog_vertex>
|
|
}`,Ag=`#define TOON
|
|
uniform vec3 diffuse;
|
|
uniform vec3 emissive;
|
|
uniform float opacity;
|
|
#include <common>
|
|
#include <packing>
|
|
#include <dithering_pars_fragment>
|
|
#include <color_pars_fragment>
|
|
#include <uv_pars_fragment>
|
|
#include <uv2_pars_fragment>
|
|
#include <map_pars_fragment>
|
|
#include <alphamap_pars_fragment>
|
|
#include <alphatest_pars_fragment>
|
|
#include <aomap_pars_fragment>
|
|
#include <lightmap_pars_fragment>
|
|
#include <emissivemap_pars_fragment>
|
|
#include <gradientmap_pars_fragment>
|
|
#include <fog_pars_fragment>
|
|
#include <bsdfs>
|
|
#include <lights_pars_begin>
|
|
#include <normal_pars_fragment>
|
|
#include <lights_toon_pars_fragment>
|
|
#include <shadowmap_pars_fragment>
|
|
#include <bumpmap_pars_fragment>
|
|
#include <normalmap_pars_fragment>
|
|
#include <logdepthbuf_pars_fragment>
|
|
#include <clipping_planes_pars_fragment>
|
|
void main() {
|
|
#include <clipping_planes_fragment>
|
|
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
vec3 totalEmissiveRadiance = emissive;
|
|
#include <logdepthbuf_fragment>
|
|
#include <map_fragment>
|
|
#include <color_fragment>
|
|
#include <alphamap_fragment>
|
|
#include <alphatest_fragment>
|
|
#include <normal_fragment_begin>
|
|
#include <normal_fragment_maps>
|
|
#include <emissivemap_fragment>
|
|
#include <lights_toon_fragment>
|
|
#include <lights_fragment_begin>
|
|
#include <lights_fragment_maps>
|
|
#include <lights_fragment_end>
|
|
#include <aomap_fragment>
|
|
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
|
|
#include <output_fragment>
|
|
#include <tonemapping_fragment>
|
|
#include <encodings_fragment>
|
|
#include <fog_fragment>
|
|
#include <premultiplied_alpha_fragment>
|
|
#include <dithering_fragment>
|
|
}`,Sg=`uniform float size;
|
|
uniform float scale;
|
|
#include <common>
|
|
#include <color_pars_vertex>
|
|
#include <fog_pars_vertex>
|
|
#include <morphtarget_pars_vertex>
|
|
#include <logdepthbuf_pars_vertex>
|
|
#include <clipping_planes_pars_vertex>
|
|
void main() {
|
|
#include <color_vertex>
|
|
#include <begin_vertex>
|
|
#include <morphtarget_vertex>
|
|
#include <project_vertex>
|
|
gl_PointSize = size;
|
|
#ifdef USE_SIZEATTENUATION
|
|
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
|
|
if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
|
|
#endif
|
|
#include <logdepthbuf_vertex>
|
|
#include <clipping_planes_vertex>
|
|
#include <worldpos_vertex>
|
|
#include <fog_vertex>
|
|
}`,_g=`uniform vec3 diffuse;
|
|
uniform float opacity;
|
|
#include <common>
|
|
#include <color_pars_fragment>
|
|
#include <map_particle_pars_fragment>
|
|
#include <alphatest_pars_fragment>
|
|
#include <fog_pars_fragment>
|
|
#include <logdepthbuf_pars_fragment>
|
|
#include <clipping_planes_pars_fragment>
|
|
void main() {
|
|
#include <clipping_planes_fragment>
|
|
vec3 outgoingLight = vec3( 0.0 );
|
|
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
#include <logdepthbuf_fragment>
|
|
#include <map_particle_fragment>
|
|
#include <color_fragment>
|
|
#include <alphatest_fragment>
|
|
outgoingLight = diffuseColor.rgb;
|
|
#include <output_fragment>
|
|
#include <tonemapping_fragment>
|
|
#include <encodings_fragment>
|
|
#include <fog_fragment>
|
|
#include <premultiplied_alpha_fragment>
|
|
}`,Eg=`#include <common>
|
|
#include <fog_pars_vertex>
|
|
#include <morphtarget_pars_vertex>
|
|
#include <skinning_pars_vertex>
|
|
#include <shadowmap_pars_vertex>
|
|
void main() {
|
|
#include <beginnormal_vertex>
|
|
#include <morphnormal_vertex>
|
|
#include <skinbase_vertex>
|
|
#include <skinnormal_vertex>
|
|
#include <defaultnormal_vertex>
|
|
#include <begin_vertex>
|
|
#include <morphtarget_vertex>
|
|
#include <skinning_vertex>
|
|
#include <project_vertex>
|
|
#include <worldpos_vertex>
|
|
#include <shadowmap_vertex>
|
|
#include <fog_vertex>
|
|
}`,Lg=`uniform vec3 color;
|
|
uniform float opacity;
|
|
#include <common>
|
|
#include <packing>
|
|
#include <fog_pars_fragment>
|
|
#include <bsdfs>
|
|
#include <lights_pars_begin>
|
|
#include <shadowmap_pars_fragment>
|
|
#include <shadowmask_pars_fragment>
|
|
void main() {
|
|
gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
|
|
#include <tonemapping_fragment>
|
|
#include <encodings_fragment>
|
|
#include <fog_fragment>
|
|
}`,Tg=`uniform float rotation;
|
|
uniform vec2 center;
|
|
#include <common>
|
|
#include <uv_pars_vertex>
|
|
#include <fog_pars_vertex>
|
|
#include <logdepthbuf_pars_vertex>
|
|
#include <clipping_planes_pars_vertex>
|
|
void main() {
|
|
#include <uv_vertex>
|
|
vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
vec2 scale;
|
|
scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
|
|
scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
|
|
#ifndef USE_SIZEATTENUATION
|
|
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
|
|
if ( isPerspective ) scale *= - mvPosition.z;
|
|
#endif
|
|
vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
|
|
vec2 rotatedPosition;
|
|
rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
|
|
rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
|
|
mvPosition.xy += rotatedPosition;
|
|
gl_Position = projectionMatrix * mvPosition;
|
|
#include <logdepthbuf_vertex>
|
|
#include <clipping_planes_vertex>
|
|
#include <fog_vertex>
|
|
}`,Dg=`uniform vec3 diffuse;
|
|
uniform float opacity;
|
|
#include <common>
|
|
#include <uv_pars_fragment>
|
|
#include <map_pars_fragment>
|
|
#include <alphamap_pars_fragment>
|
|
#include <alphatest_pars_fragment>
|
|
#include <fog_pars_fragment>
|
|
#include <logdepthbuf_pars_fragment>
|
|
#include <clipping_planes_pars_fragment>
|
|
void main() {
|
|
#include <clipping_planes_fragment>
|
|
vec3 outgoingLight = vec3( 0.0 );
|
|
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
#include <logdepthbuf_fragment>
|
|
#include <map_fragment>
|
|
#include <alphamap_fragment>
|
|
#include <alphatest_fragment>
|
|
outgoingLight = diffuseColor.rgb;
|
|
#include <output_fragment>
|
|
#include <tonemapping_fragment>
|
|
#include <encodings_fragment>
|
|
#include <fog_fragment>
|
|
}`,Be={alphamap_fragment:ap,alphamap_pars_fragment:op,alphatest_fragment:cp,alphatest_pars_fragment:lp,aomap_fragment:hp,aomap_pars_fragment:up,begin_vertex:fp,beginnormal_vertex:dp,bsdfs:pp,bumpmap_pars_fragment:mp,clipping_planes_fragment:gp,clipping_planes_pars_fragment:vp,clipping_planes_pars_vertex:xp,clipping_planes_vertex:yp,color_fragment:wp,color_pars_fragment:bp,color_pars_vertex:Mp,color_vertex:zp,common:Cp,cube_uv_reflection_fragment:Ap,defaultnormal_vertex:Sp,displacementmap_pars_vertex:_p,displacementmap_vertex:Ep,emissivemap_fragment:Lp,emissivemap_pars_fragment:Tp,encodings_fragment:Dp,encodings_pars_fragment:Hp,envmap_fragment:Vp,envmap_common_pars_fragment:Rp,envmap_pars_fragment:Np,envmap_pars_vertex:Fp,envmap_physical_pars_fragment:Zp,envmap_vertex:Bp,fog_vertex:Pp,fog_pars_vertex:Ip,fog_fragment:kp,fog_pars_fragment:Op,gradientmap_pars_fragment:Up,lightmap_fragment:Gp,lightmap_pars_fragment:qp,lights_lambert_vertex:Wp,lights_pars_begin:jp,lights_toon_fragment:Xp,lights_toon_pars_fragment:Yp,lights_phong_fragment:$p,lights_phong_pars_fragment:Jp,lights_physical_fragment:Qp,lights_physical_pars_fragment:Kp,lights_fragment_begin:em,lights_fragment_maps:tm,lights_fragment_end:im,logdepthbuf_fragment:nm,logdepthbuf_pars_fragment:sm,logdepthbuf_pars_vertex:rm,logdepthbuf_vertex:am,map_fragment:om,map_pars_fragment:cm,map_particle_fragment:lm,map_particle_pars_fragment:hm,metalnessmap_fragment:um,metalnessmap_pars_fragment:fm,morphnormal_vertex:dm,morphtarget_pars_vertex:pm,morphtarget_vertex:mm,normal_fragment_begin:gm,normal_fragment_maps:vm,normal_pars_fragment:xm,normal_pars_vertex:ym,normal_vertex:wm,normalmap_pars_fragment:bm,clearcoat_normal_fragment_begin:Mm,clearcoat_normal_fragment_maps:zm,clearcoat_pars_fragment:Cm,output_fragment:Am,packing:Sm,premultiplied_alpha_fragment:_m,project_vertex:Em,dithering_fragment:Lm,dithering_pars_fragment:Tm,roughnessmap_fragment:Dm,roughnessmap_pars_fragment:Hm,shadowmap_pars_fragment:Vm,shadowmap_pars_vertex:Rm,shadowmap_vertex:Nm,shadowmask_pars_fragment:Fm,skinbase_vertex:Bm,skinning_pars_vertex:Pm,skinning_vertex:Im,skinnormal_vertex:km,specularmap_fragment:Om,specularmap_pars_fragment:Um,tonemapping_fragment:Gm,tonemapping_pars_fragment:qm,transmission_fragment:Wm,transmission_pars_fragment:jm,uv_pars_fragment:Zm,uv_pars_vertex:Xm,uv_vertex:Ym,uv2_pars_fragment:$m,uv2_pars_vertex:Jm,uv2_vertex:Qm,worldpos_vertex:Km,background_vert:eg,background_frag:tg,cube_vert:ig,cube_frag:ng,depth_vert:sg,depth_frag:rg,distanceRGBA_vert:ag,distanceRGBA_frag:og,equirect_vert:cg,equirect_frag:lg,linedashed_vert:hg,linedashed_frag:ug,meshbasic_vert:fg,meshbasic_frag:dg,meshlambert_vert:pg,meshlambert_frag:mg,meshmatcap_vert:gg,meshmatcap_frag:vg,meshnormal_vert:xg,meshnormal_frag:yg,meshphong_vert:wg,meshphong_frag:bg,meshphysical_vert:Mg,meshphysical_frag:zg,meshtoon_vert:Cg,meshtoon_frag:Ag,points_vert:Sg,points_frag:_g,shadow_vert:Eg,shadow_frag:Lg,sprite_vert:Tg,sprite_frag:Dg},oe={common:{diffuse:{value:new xe(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Tt},uv2Transform:{value:new Tt},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new te(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new xe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new xe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Tt}},sprite:{diffuse:{value:new xe(16777215)},opacity:{value:1},center:{value:new te(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Tt}}},W1={basic:{uniforms:It([oe.common,oe.specularmap,oe.envmap,oe.aomap,oe.lightmap,oe.fog]),vertexShader:Be.meshbasic_vert,fragmentShader:Be.meshbasic_frag},lambert:{uniforms:It([oe.common,oe.specularmap,oe.envmap,oe.aomap,oe.lightmap,oe.emissivemap,oe.fog,oe.lights,{emissive:{value:new xe(0)}}]),vertexShader:Be.meshlambert_vert,fragmentShader:Be.meshlambert_frag},phong:{uniforms:It([oe.common,oe.specularmap,oe.envmap,oe.aomap,oe.lightmap,oe.emissivemap,oe.bumpmap,oe.normalmap,oe.displacementmap,oe.fog,oe.lights,{emissive:{value:new xe(0)},specular:{value:new xe(1118481)},shininess:{value:30}}]),vertexShader:Be.meshphong_vert,fragmentShader:Be.meshphong_frag},standard:{uniforms:It([oe.common,oe.envmap,oe.aomap,oe.lightmap,oe.emissivemap,oe.bumpmap,oe.normalmap,oe.displacementmap,oe.roughnessmap,oe.metalnessmap,oe.fog,oe.lights,{emissive:{value:new xe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Be.meshphysical_vert,fragmentShader:Be.meshphysical_frag},toon:{uniforms:It([oe.common,oe.aomap,oe.lightmap,oe.emissivemap,oe.bumpmap,oe.normalmap,oe.displacementmap,oe.gradientmap,oe.fog,oe.lights,{emissive:{value:new xe(0)}}]),vertexShader:Be.meshtoon_vert,fragmentShader:Be.meshtoon_frag},matcap:{uniforms:It([oe.common,oe.bumpmap,oe.normalmap,oe.displacementmap,oe.fog,{matcap:{value:null}}]),vertexShader:Be.meshmatcap_vert,fragmentShader:Be.meshmatcap_frag},points:{uniforms:It([oe.points,oe.fog]),vertexShader:Be.points_vert,fragmentShader:Be.points_frag},dashed:{uniforms:It([oe.common,oe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Be.linedashed_vert,fragmentShader:Be.linedashed_frag},depth:{uniforms:It([oe.common,oe.displacementmap]),vertexShader:Be.depth_vert,fragmentShader:Be.depth_frag},normal:{uniforms:It([oe.common,oe.bumpmap,oe.normalmap,oe.displacementmap,{opacity:{value:1}}]),vertexShader:Be.meshnormal_vert,fragmentShader:Be.meshnormal_frag},sprite:{uniforms:It([oe.sprite,oe.fog]),vertexShader:Be.sprite_vert,fragmentShader:Be.sprite_frag},background:{uniforms:{uvTransform:{value:new Tt},t2D:{value:null}},vertexShader:Be.background_vert,fragmentShader:Be.background_frag},cube:{uniforms:It([oe.envmap,{opacity:{value:1}}]),vertexShader:Be.cube_vert,fragmentShader:Be.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Be.equirect_vert,fragmentShader:Be.equirect_frag},distanceRGBA:{uniforms:It([oe.common,oe.displacementmap,{referencePosition:{value:new B},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Be.distanceRGBA_vert,fragmentShader:Be.distanceRGBA_frag},shadow:{uniforms:It([oe.lights,oe.fog,{color:{value:new xe(0)},opacity:{value:1}}]),vertexShader:Be.shadow_vert,fragmentShader:Be.shadow_frag}};W1.physical={uniforms:It([W1.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new te(1,1)},clearcoatNormalMap:{value:null},sheen:{value:0},sheenColor:{value:new xe(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new te},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new xe(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new xe(1,1,1)},specularColorMap:{value:null}}]),vertexShader:Be.meshphysical_vert,fragmentShader:Be.meshphysical_frag};function Hg(o,e,t,i,n,s){let r=new xe(0),a=n===!0?0:1,c,l,h=null,f=0,u=null;function d(v,x){let g=!1,m=x.isScene===!0?x.background:null;m&&m.isTexture&&(m=e.get(m));let z=o.xr,y=z.getSession&&z.getSession();y&&y.environmentBlendMode==="additive"&&(m=null),m===null?p(r,a):m&&m.isColor&&(p(m,1),g=!0),(o.autoClear||g)&&o.clear(o.autoClearColor,o.autoClearDepth,o.autoClearStencil),m&&(m.isCubeTexture||m.mapping===da)?(l===void 0&&(l=new Rt(new Dn(1,1,1),new hi({name:"BackgroundCubeMaterial",uniforms:Hn(W1.cube.uniforms),vertexShader:W1.cube.vertexShader,fragmentShader:W1.cube.fragmentShader,side:Ct,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(b,S,_){this.matrixWorld.copyPosition(_.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(l)),l.material.uniforms.envMap.value=m,l.material.uniforms.flipEnvMap.value=m.isCubeTexture&&m.isRenderTargetTexture===!1?-1:1,(h!==m||f!==m.version||u!==o.toneMapping)&&(l.material.needsUpdate=!0,h=m,f=m.version,u=o.toneMapping),v.unshift(l,l.geometry,l.material,0,0,null)):m&&m.isTexture&&(c===void 0&&(c=new Rt(new Fn(2,2),new hi({name:"BackgroundMaterial",uniforms:Hn(W1.background.uniforms),vertexShader:W1.background.vertexShader,fragmentShader:W1.background.fragmentShader,side:As,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=m,m.matrixAutoUpdate===!0&&m.updateMatrix(),c.material.uniforms.uvTransform.value.copy(m.matrix),(h!==m||f!==m.version||u!==o.toneMapping)&&(c.material.needsUpdate=!0,h=m,f=m.version,u=o.toneMapping),v.unshift(c,c.geometry,c.material,0,0,null))}function p(v,x){t.buffers.color.setClear(v.r,v.g,v.b,x,s)}return{getClearColor:function(){return r},setClearColor:function(v,x=1){r.set(v),a=x,p(r,a)},getClearAlpha:function(){return a},setClearAlpha:function(v){a=v,p(r,a)},render:d}}function Vg(o,e,t,i){let n=o.getParameter(34921),s=i.isWebGL2?null:e.get("OES_vertex_array_object"),r=i.isWebGL2||s!==null,a={},c=v(null),l=c;function h(C,V,H,T,N){let I=!1;if(r){let j=p(T,H,V);l!==j&&(l=j,u(l.object)),I=x(T,N),I&&g(T,N)}else{let j=V.wireframe===!0;(l.geometry!==T.id||l.program!==H.id||l.wireframe!==j)&&(l.geometry=T.id,l.program=H.id,l.wireframe=j,I=!0)}C.isInstancedMesh===!0&&(I=!0),N!==null&&t.update(N,34963),I&&(_(C,V,H,T),N!==null&&o.bindBuffer(34963,t.get(N).buffer))}function f(){return i.isWebGL2?o.createVertexArray():s.createVertexArrayOES()}function u(C){return i.isWebGL2?o.bindVertexArray(C):s.bindVertexArrayOES(C)}function d(C){return i.isWebGL2?o.deleteVertexArray(C):s.deleteVertexArrayOES(C)}function p(C,V,H){let T=H.wireframe===!0,N=a[C.id];N===void 0&&(N={},a[C.id]=N);let I=N[V.id];I===void 0&&(I={},N[V.id]=I);let j=I[T];return j===void 0&&(j=v(f()),I[T]=j),j}function v(C){let V=[],H=[],T=[];for(let N=0;N<n;N++)V[N]=0,H[N]=0,T[N]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:V,enabledAttributes:H,attributeDivisors:T,object:C,attributes:{},index:null}}function x(C,V){let H=l.attributes,T=C.attributes,N=0;for(let I in T){let j=H[I],O=T[I];if(j===void 0||j.attribute!==O||j.data!==O.data)return!0;N++}return l.attributesNum!==N||l.index!==V}function g(C,V){let H={},T=C.attributes,N=0;for(let I in T){let j=T[I],O={};O.attribute=j,j.data&&(O.data=j.data),H[I]=O,N++}l.attributes=H,l.attributesNum=N,l.index=V}function m(){let C=l.newAttributes;for(let V=0,H=C.length;V<H;V++)C[V]=0}function z(C){y(C,0)}function y(C,V){let H=l.newAttributes,T=l.enabledAttributes,N=l.attributeDivisors;H[C]=1,T[C]===0&&(o.enableVertexAttribArray(C),T[C]=1),N[C]!==V&&((i.isWebGL2?o:e.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](C,V),N[C]=V)}function b(){let C=l.newAttributes,V=l.enabledAttributes;for(let H=0,T=V.length;H<T;H++)V[H]!==C[H]&&(o.disableVertexAttribArray(H),V[H]=0)}function S(C,V,H,T,N,I){i.isWebGL2===!0&&(H===5124||H===5125)?o.vertexAttribIPointer(C,V,H,N,I):o.vertexAttribPointer(C,V,H,T,N,I)}function _(C,V,H,T){if(i.isWebGL2===!1&&(C.isInstancedMesh||T.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;m();let N=T.attributes,I=H.getAttributes(),j=V.defaultAttributeValues;for(let O in I){let q=I[O];if(q.location>=0){let Z=N[O];if(Z===void 0&&(O==="instanceMatrix"&&C.instanceMatrix&&(Z=C.instanceMatrix),O==="instanceColor"&&C.instanceColor&&(Z=C.instanceColor)),Z!==void 0){let ne=Z.normalized,ce=Z.itemSize,U=t.get(Z);if(U===void 0)continue;let Le=U.buffer,de=U.type,ze=U.bytesPerElement;if(Z.isInterleavedBufferAttribute){let ue=Z.data,De=ue.stride,Se=Z.offset;if(ue&&ue.isInstancedInterleavedBuffer){for(let J=0;J<q.locationSize;J++)y(q.location+J,ue.meshPerAttribute);C.isInstancedMesh!==!0&&T._maxInstanceCount===void 0&&(T._maxInstanceCount=ue.meshPerAttribute*ue.count)}else for(let J=0;J<q.locationSize;J++)z(q.location+J);o.bindBuffer(34962,Le);for(let J=0;J<q.locationSize;J++)S(q.location+J,ce/q.locationSize,de,ne,De*ze,(Se+ce/q.locationSize*J)*ze)}else{if(Z.isInstancedBufferAttribute){for(let ue=0;ue<q.locationSize;ue++)y(q.location+ue,Z.meshPerAttribute);C.isInstancedMesh!==!0&&T._maxInstanceCount===void 0&&(T._maxInstanceCount=Z.meshPerAttribute*Z.count)}else for(let ue=0;ue<q.locationSize;ue++)z(q.location+ue);o.bindBuffer(34962,Le);for(let ue=0;ue<q.locationSize;ue++)S(q.location+ue,ce/q.locationSize,de,ne,ce*ze,ce/q.locationSize*ue*ze)}}else if(j!==void 0){let ne=j[O];if(ne!==void 0)switch(ne.length){case 2:o.vertexAttrib2fv(q.location,ne);break;case 3:o.vertexAttrib3fv(q.location,ne);break;case 4:o.vertexAttrib4fv(q.location,ne);break;default:o.vertexAttrib1fv(q.location,ne)}}}}b()}function A(){w();for(let C in a){let V=a[C];for(let H in V){let T=V[H];for(let N in T)d(T[N].object),delete T[N];delete V[H]}delete a[C]}}function P(C){if(a[C.id]===void 0)return;let V=a[C.id];for(let H in V){let T=V[H];for(let N in T)d(T[N].object),delete T[N];delete V[H]}delete a[C.id]}function R(C){for(let V in a){let H=a[V];if(H[C.id]===void 0)continue;let T=H[C.id];for(let N in T)d(T[N].object),delete T[N];delete H[C.id]}}function w(){D(),l!==c&&(l=c,u(l.object))}function D(){c.geometry=null,c.program=null,c.wireframe=!1}return{setup:h,reset:w,resetDefaultState:D,dispose:A,releaseStatesOfGeometry:P,releaseStatesOfProgram:R,initAttributes:m,enableAttribute:z,disableUnusedAttributes:b}}function Rg(o,e,t,i){let n=i.isWebGL2,s;function r(l){s=l}function a(l,h){o.drawArrays(s,l,h),t.update(h,s,1)}function c(l,h,f){if(f===0)return;let u,d;if(n)u=o,d="drawArraysInstanced";else if(u=e.get("ANGLE_instanced_arrays"),d="drawArraysInstancedANGLE",u===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}u[d](s,l,h,f),t.update(h,s,f)}this.setMode=r,this.render=a,this.renderInstances=c}function Ng(o,e,t){let i;function n(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){let _=e.get("EXT_texture_filter_anisotropic");i=o.getParameter(_.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function s(_){if(_==="highp"){if(o.getShaderPrecisionFormat(35633,36338).precision>0&&o.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";_="mediump"}return _==="mediump"&&o.getShaderPrecisionFormat(35633,36337).precision>0&&o.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}let r=typeof WebGL2RenderingContext!="undefined"&&o instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext!="undefined"&&o instanceof WebGL2ComputeRenderingContext,a=t.precision!==void 0?t.precision:"highp",c=s(a);c!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",c,"instead."),a=c);let l=r||e.has("WEBGL_draw_buffers"),h=t.logarithmicDepthBuffer===!0,f=o.getParameter(34930),u=o.getParameter(35660),d=o.getParameter(3379),p=o.getParameter(34076),v=o.getParameter(34921),x=o.getParameter(36347),g=o.getParameter(36348),m=o.getParameter(36349),z=u>0,y=r||e.has("OES_texture_float"),b=z&&y,S=r?o.getParameter(36183):0;return{isWebGL2:r,drawBuffers:l,getMaxAnisotropy:n,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:h,maxTextures:f,maxVertexTextures:u,maxTextureSize:d,maxCubemapSize:p,maxAttributes:v,maxVertexUniforms:x,maxVaryings:g,maxFragmentUniforms:m,vertexTextures:z,floatFragmentTextures:y,floatVertexTextures:b,maxSamples:S}}function Fg(o){let e=this,t=null,i=0,n=!1,s=!1,r=new q1,a=new Tt,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(f,u,d){let p=f.length!==0||u||i!==0||n;return n=u,t=h(f,d,0),i=f.length,p},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1,l()},this.setState=function(f,u,d){let p=f.clippingPlanes,v=f.clipIntersection,x=f.clipShadows,g=o.get(f);if(!n||p===null||p.length===0||s&&!x)s?h(null):l();else{let m=s?0:i,z=m*4,y=g.clippingState||null;c.value=y,y=h(p,u,z,d);for(let b=0;b!==z;++b)y[b]=t[b];g.clippingState=y,this.numIntersection=v?this.numPlanes:0,this.numPlanes+=m}};function l(){c.value!==t&&(c.value=t,c.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function h(f,u,d,p){let v=f!==null?f.length:0,x=null;if(v!==0){if(x=c.value,p!==!0||x===null){let g=d+v*4,m=u.matrixWorldInverse;a.getNormalMatrix(m),(x===null||x.length<g)&&(x=new Float32Array(g));for(let z=0,y=d;z!==v;++z,y+=4)r.copy(f[z]).applyMatrix4(m,a),r.normal.toArray(x,y),x[y+3]=r.constant}c.value=x,c.needsUpdate=!0}return e.numPlanes=v,e.numIntersection=0,x}}function Bg(o){let e=new WeakMap;function t(r,a){return a===ho?r.mapping=_s:a===uo&&(r.mapping=Es),r}function i(r){if(r&&r.isTexture&&r.isRenderTargetTexture===!1){let a=r.mapping;if(a===ho||a===uo)if(e.has(r)){let c=e.get(r).texture;return t(c,r.mapping)}else{let c=r.image;if(c&&c.height>0){let l=new $o(c.height/2);return l.fromEquirectangularTexture(o,r),e.set(r,l),r.addEventListener("dispose",n),t(l.texture,r.mapping)}else return null}}return r}function n(r){let a=r.target;a.removeEventListener("dispose",n);let c=e.get(a);c!==void 0&&(e.delete(a),c.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}var Ua=class extends Ia{constructor(e=-1,t=1,i=1,n=-1,s=.1,r=2e3){super();this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=n,this.near=s,this.far=r,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,n,s,r){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=n,this.view.width=s,this.view.height=r,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2,s=i-e,r=i+e,a=n+t,c=n-t;if(this.view!==null&&this.view.enabled){let l=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=l*this.view.offsetX,r=s+l*this.view.width,a-=h*this.view.offsetY,c=a-h*this.view.height}this.projectionMatrix.makeOrthographic(s,r,a,c,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}};Ua.prototype.isOrthographicCamera=!0;var Bs=class extends hi{constructor(e){super(e);this.type="RawShaderMaterial"}};Bs.prototype.isRawShaderMaterial=!0;var Bn=4,ui=8,j1=Math.pow(2,ui),z5=[.125,.215,.35,.446,.526,.582],C5=ui-Bn+1+z5.length,Pn=20,Qo=new Ua,{_lodPlanes:Ps,_sizeLods:A5,_sigmas:Ga}=Pg(),S5=new xe,Ko=null,Pi=(1+Math.sqrt(5))/2,In=1/Pi,_5=[new B(1,1,1),new B(-1,1,1),new B(1,1,-1),new B(-1,1,-1),new B(0,Pi,In),new B(0,Pi,-In),new B(In,0,Pi),new B(-In,0,Pi),new B(Pi,In,0),new B(-Pi,In,0)],e6=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=Ig(Pn),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,n=100){Ko=this._renderer.getRenderTarget();let s=this._allocateTargets();return this._sceneToCubeUV(e,i,n,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapShader===null&&(this._cubemapShader=T5(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){this._equirectShader===null&&(this._equirectShader=L5(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose(),this._cubemapShader!==null&&this._cubemapShader.dispose(),this._equirectShader!==null&&this._equirectShader.dispose();for(let e=0;e<Ps.length;e++)Ps[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(Ko),e.scissorTest=!1,qa(e,0,0,e.width,e.height)}_fromTexture(e,t){Ko=this._renderer.getRenderTarget();let i=t||this._allocateTargets(e);return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(e){let t={magFilter:Pt,minFilter:Pt,generateMipmaps:!1,type:pn,format:Ut,encoding:ei,depthBuffer:!1},i=E5(t);return i.depthBuffer=!e,this._pingPongRenderTarget===null&&(this._pingPongRenderTarget=E5(t)),i}_compileMaterial(e){let t=new Rt(Ps[0],e);this._renderer.compile(t,Qo)}_sceneToCubeUV(e,t,i,n){let s=90,r=1,a=new Nt(s,r,t,i),c=[1,-1,1,1,1,1],l=[1,1,1,-1,-1,-1],h=this._renderer,f=h.autoClear,u=h.toneMapping;h.getClearColor(S5),h.toneMapping=Q2,h.autoClear=!1;let d=new La({name:"PMREM.Background",side:Ct,depthWrite:!1,depthTest:!1}),p=new Rt(new Dn,d),v=!1,x=e.background;x?x.isColor&&(d.color.copy(x),e.background=null,v=!0):(d.color.copy(S5),v=!0);for(let g=0;g<6;g++){let m=g%3;m===0?(a.up.set(0,c[g],0),a.lookAt(l[g],0,0)):m===1?(a.up.set(0,0,c[g]),a.lookAt(0,l[g],0)):(a.up.set(0,c[g],0),a.lookAt(0,0,l[g])),qa(n,m*j1,g>2?j1:0,j1,j1),h.setRenderTarget(n),v&&h.render(p,a),h.render(e,a)}p.geometry.dispose(),p.material.dispose(),h.toneMapping=u,h.autoClear=f,e.background=x}_textureToCubeUV(e,t){let i=this._renderer,n=e.mapping===_s||e.mapping===Es;n?(this._cubemapShader===null&&(this._cubemapShader=T5()),this._cubemapShader.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectShader===null&&(this._equirectShader=L5());let s=n?this._cubemapShader:this._equirectShader,r=new Rt(Ps[0],s),a=s.uniforms;a.envMap.value=e,n||a.texelSize.value.set(1/e.image.width,1/e.image.height),qa(t,0,0,3*j1,2*j1),i.setRenderTarget(t),i.render(r,Qo)}_applyPMREM(e){let t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let n=1;n<C5;n++){let s=Math.sqrt(Ga[n]*Ga[n]-Ga[n-1]*Ga[n-1]),r=_5[(n-1)%_5.length];this._blur(e,n-1,n,s,r)}t.autoClear=i}_blur(e,t,i,n,s){let r=this._pingPongRenderTarget;this._halfBlur(e,r,t,i,n,"latitudinal",s),this._halfBlur(r,e,i,i,n,"longitudinal",s)}_halfBlur(e,t,i,n,s,r,a){let c=this._renderer,l=this._blurMaterial;r!=="latitudinal"&&r!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");let h=3,f=new Rt(Ps[n],l),u=l.uniforms,d=A5[i]-1,p=isFinite(s)?Math.PI/(2*d):2*Math.PI/(2*Pn-1),v=s/p,x=isFinite(s)?1+Math.floor(h*v):Pn;x>Pn&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${x} samples when the maximum is set to ${Pn}`);let g=[],m=0;for(let S=0;S<Pn;++S){let _=S/v,A=Math.exp(-_*_/2);g.push(A),S===0?m+=A:S<x&&(m+=2*A)}for(let S=0;S<g.length;S++)g[S]=g[S]/m;u.envMap.value=e.texture,u.samples.value=x,u.weights.value=g,u.latitudinal.value=r==="latitudinal",a&&(u.poleAxis.value=a),u.dTheta.value=p,u.mipInt.value=ui-i;let z=A5[n],y=3*Math.max(0,j1-2*z),b=(n===0?0:2*j1)+2*z*(n>ui-Bn?n-ui+Bn:0);qa(t,y,b,3*z,2*z),c.setRenderTarget(t),c.render(f,Qo)}};function Pg(){let o=[],e=[],t=[],i=ui;for(let n=0;n<C5;n++){let s=Math.pow(2,i);e.push(s);let r=1/s;n>ui-Bn?r=z5[n-ui+Bn-1]:n===0&&(r=0),t.push(r);let a=1/(s-1),c=-a/2,l=1+a/2,h=[c,c,l,c,l,l,c,c,l,l,c,l],f=6,u=6,d=3,p=2,v=1,x=new Float32Array(d*u*f),g=new Float32Array(p*u*f),m=new Float32Array(v*u*f);for(let y=0;y<f;y++){let b=y%3*2/3-1,S=y>2?0:-1,_=[b,S,0,b+2/3,S,0,b+2/3,S+1,0,b,S,0,b+2/3,S+1,0,b,S+1,0];x.set(_,d*u*y),g.set(h,p*u*y);let A=[y,y,y,y,y,y];m.set(A,v*u*y)}let z=new rt;z.setAttribute("position",new wt(x,d)),z.setAttribute("uv",new wt(g,p)),z.setAttribute("faceIndex",new wt(m,v)),o.push(z),i>Bn&&i--}return{_lodPlanes:o,_sizeLods:e,_sigmas:t}}function E5(o){let e=new r1(3*j1,3*j1,o);return e.texture.mapping=da,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function qa(o,e,t,i,n){o.viewport.set(e,t,i,n),o.scissor.set(e,t,i,n)}function Ig(o){let e=new Float32Array(o),t=new B(0,1,0);return new Bs({name:"SphericalGaussianBlur",defines:{n:o},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:e},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:t}},vertexShader:t6(),fragmentShader:`
|
|
|
|
precision mediump float;
|
|
precision mediump int;
|
|
|
|
varying vec3 vOutputDirection;
|
|
|
|
uniform sampler2D envMap;
|
|
uniform int samples;
|
|
uniform float weights[ n ];
|
|
uniform bool latitudinal;
|
|
uniform float dTheta;
|
|
uniform float mipInt;
|
|
uniform vec3 poleAxis;
|
|
|
|
#define ENVMAP_TYPE_CUBE_UV
|
|
#include <cube_uv_reflection_fragment>
|
|
|
|
vec3 getSample( float theta, vec3 axis ) {
|
|
|
|
float cosTheta = cos( theta );
|
|
// Rodrigues' axis-angle rotation
|
|
vec3 sampleDirection = vOutputDirection * cosTheta
|
|
+ cross( axis, vOutputDirection ) * sin( theta )
|
|
+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
|
|
|
|
return bilinearCubeUV( envMap, sampleDirection, mipInt );
|
|
|
|
}
|
|
|
|
void main() {
|
|
|
|
vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
|
|
|
|
if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
|
|
|
|
axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
|
|
|
|
}
|
|
|
|
axis = normalize( axis );
|
|
|
|
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
|
|
|
|
for ( int i = 1; i < n; i++ ) {
|
|
|
|
if ( i >= samples ) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
float theta = dTheta * float( i );
|
|
gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
|
|
gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
|
|
|
|
}
|
|
|
|
}
|
|
`,blending:J2,depthTest:!1,depthWrite:!1})}function L5(){let o=new te(1,1);return new Bs({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:o}},vertexShader:t6(),fragmentShader:`
|
|
|
|
precision mediump float;
|
|
precision mediump int;
|
|
|
|
varying vec3 vOutputDirection;
|
|
|
|
uniform sampler2D envMap;
|
|
uniform vec2 texelSize;
|
|
|
|
#include <common>
|
|
|
|
void main() {
|
|
|
|
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
|
|
vec3 outputDirection = normalize( vOutputDirection );
|
|
vec2 uv = equirectUv( outputDirection );
|
|
|
|
vec2 f = fract( uv / texelSize - 0.5 );
|
|
uv -= f * texelSize;
|
|
vec3 tl = texture2D ( envMap, uv ).rgb;
|
|
uv.x += texelSize.x;
|
|
vec3 tr = texture2D ( envMap, uv ).rgb;
|
|
uv.y += texelSize.y;
|
|
vec3 br = texture2D ( envMap, uv ).rgb;
|
|
uv.x -= texelSize.x;
|
|
vec3 bl = texture2D ( envMap, uv ).rgb;
|
|
|
|
vec3 tm = mix( tl, tr, f.x );
|
|
vec3 bm = mix( bl, br, f.x );
|
|
gl_FragColor.rgb = mix( tm, bm, f.y );
|
|
|
|
}
|
|
`,blending:J2,depthTest:!1,depthWrite:!1})}function T5(){return new Bs({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:t6(),fragmentShader:`
|
|
|
|
precision mediump float;
|
|
precision mediump int;
|
|
|
|
uniform float flipEnvMap;
|
|
|
|
varying vec3 vOutputDirection;
|
|
|
|
uniform samplerCube envMap;
|
|
|
|
void main() {
|
|
|
|
gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
|
|
|
|
}
|
|
`,blending:J2,depthTest:!1,depthWrite:!1})}function t6(){return`
|
|
|
|
precision mediump float;
|
|
precision mediump int;
|
|
|
|
attribute vec3 position;
|
|
attribute vec2 uv;
|
|
attribute float faceIndex;
|
|
|
|
varying vec3 vOutputDirection;
|
|
|
|
// RH coordinate system; PMREM face-indexing convention
|
|
vec3 getDirection( vec2 uv, float face ) {
|
|
|
|
uv = 2.0 * uv - 1.0;
|
|
|
|
vec3 direction = vec3( uv, 1.0 );
|
|
|
|
if ( face == 0.0 ) {
|
|
|
|
direction = direction.zyx; // ( 1, v, u ) pos x
|
|
|
|
} else if ( face == 1.0 ) {
|
|
|
|
direction = direction.xzy;
|
|
direction.xz *= -1.0; // ( -u, 1, -v ) pos y
|
|
|
|
} else if ( face == 2.0 ) {
|
|
|
|
direction.x *= -1.0; // ( -u, v, 1 ) pos z
|
|
|
|
} else if ( face == 3.0 ) {
|
|
|
|
direction = direction.zyx;
|
|
direction.xz *= -1.0; // ( -1, v, -u ) neg x
|
|
|
|
} else if ( face == 4.0 ) {
|
|
|
|
direction = direction.xzy;
|
|
direction.xy *= -1.0; // ( -u, -1, v ) neg y
|
|
|
|
} else if ( face == 5.0 ) {
|
|
|
|
direction.z *= -1.0; // ( u, v, -1 ) neg z
|
|
|
|
}
|
|
|
|
return direction;
|
|
|
|
}
|
|
|
|
void main() {
|
|
|
|
vOutputDirection = getDirection( uv, faceIndex );
|
|
gl_Position = vec4( position, 1.0 );
|
|
|
|
}
|
|
`}function kg(o){let e=new WeakMap,t=null;function i(a){if(a&&a.isTexture){let c=a.mapping,l=c===ho||c===uo,h=c===_s||c===Es;if(l||h)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let f=e.get(a);return t===null&&(t=new e6(o)),f=l?t.fromEquirectangular(a,f):t.fromCubemap(a,f),e.set(a,f),f.texture}else{if(e.has(a))return e.get(a).texture;{let f=a.image;if(l&&f&&f.height>0||h&&f&&n(f)){t===null&&(t=new e6(o));let u=l?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,u),a.addEventListener("dispose",s),u.texture}else return null}}}return a}function n(a){let c=0,l=6;for(let h=0;h<l;h++)a[h]!==void 0&&c++;return c===l}function s(a){let c=a.target;c.removeEventListener("dispose",s);let l=e.get(c);l!==void 0&&(e.delete(c),l.dispose())}function r(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:i,dispose:r}}function Og(o){let e={};function t(i){if(e[i]!==void 0)return e[i];let n;switch(i){case"WEBGL_depth_texture":n=o.getExtension("WEBGL_depth_texture")||o.getExtension("MOZ_WEBGL_depth_texture")||o.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=o.getExtension("EXT_texture_filter_anisotropic")||o.getExtension("MOZ_EXT_texture_filter_anisotropic")||o.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=o.getExtension("WEBGL_compressed_texture_s3tc")||o.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||o.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=o.getExtension("WEBGL_compressed_texture_pvrtc")||o.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=o.getExtension(i)}return e[i]=n,n}return{has:function(i){return t(i)!==null},init:function(i){i.isWebGL2?t("EXT_color_buffer_float"):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture")},get:function(i){let n=t(i);return n===null&&console.warn("THREE.WebGLRenderer: "+i+" extension not supported."),n}}}function Ug(o,e,t,i){let n={},s=new WeakMap;function r(f){let u=f.target;u.index!==null&&e.remove(u.index);for(let p in u.attributes)e.remove(u.attributes[p]);u.removeEventListener("dispose",r),delete n[u.id];let d=s.get(u);d&&(e.remove(d),s.delete(u)),i.releaseStatesOfGeometry(u),u.isInstancedBufferGeometry===!0&&delete u._maxInstanceCount,t.memory.geometries--}function a(f,u){return n[u.id]===!0||(u.addEventListener("dispose",r),n[u.id]=!0,t.memory.geometries++),u}function c(f){let u=f.attributes;for(let p in u)e.update(u[p],34962);let d=f.morphAttributes;for(let p in d){let v=d[p];for(let x=0,g=v.length;x<g;x++)e.update(v[x],34962)}}function l(f){let u=[],d=f.index,p=f.attributes.position,v=0;if(d!==null){let m=d.array;v=d.version;for(let z=0,y=m.length;z<y;z+=3){let b=m[z+0],S=m[z+1],_=m[z+2];u.push(b,S,S,_,_,b)}}else{let m=p.array;v=p.version;for(let z=0,y=m.length/3-1;z<y;z+=3){let b=z+0,S=z+1,_=z+2;u.push(b,S,S,_,_,b)}}let x=new(o5(u)?Go:Uo)(u,1);x.version=v;let g=s.get(f);g&&e.remove(g),s.set(f,x)}function h(f){let u=s.get(f);if(u){let d=f.index;d!==null&&u.version<d.version&&l(f)}else l(f);return s.get(f)}return{get:a,update:c,getWireframeAttribute:h}}function Gg(o,e,t,i){let n=i.isWebGL2,s;function r(u){s=u}let a,c;function l(u){a=u.type,c=u.bytesPerElement}function h(u,d){o.drawElements(s,d,a,u*c),t.update(d,s,1)}function f(u,d,p){if(p===0)return;let v,x;if(n)v=o,x="drawElementsInstanced";else if(v=e.get("ANGLE_instanced_arrays"),x="drawElementsInstancedANGLE",v===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}v[x](s,d,a,u*c,p),t.update(d,s,p)}this.setMode=r,this.setIndex=l,this.render=h,this.renderInstances=f}function qg(o){let e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function i(s,r,a){switch(t.calls++,r){case 4:t.triangles+=a*(s/3);break;case 1:t.lines+=a*(s/2);break;case 3:t.lines+=a*(s-1);break;case 2:t.lines+=a*s;break;case 0:t.points+=a*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",r);break}}function n(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:n,update:i}}var Wa=class extends vt{constructor(e=null,t=1,i=1,n=1){super(null);this.image={data:e,width:t,height:i,depth:n},this.magFilter=At,this.minFilter=At,this.wrapR=s1,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};Wa.prototype.isDataTexture2DArray=!0;function Wg(o,e){return o[0]-e[0]}function jg(o,e){return Math.abs(e[1])-Math.abs(o[1])}function D5(o,e){let t=1,i=e.isInterleavedBufferAttribute?e.data.array:e.array;i instanceof Int8Array?t=127:i instanceof Int16Array?t=32767:i instanceof Int32Array?t=2147483647:console.error("THREE.WebGLMorphtargets: Unsupported morph attribute data type: ",i),o.divideScalar(t)}function Zg(o,e,t){let i={},n=new Float32Array(8),s=new WeakMap,r=new B,a=[];for(let l=0;l<8;l++)a[l]=[l,0];function c(l,h,f,u){let d=l.morphTargetInfluences;if(e.isWebGL2===!0){let p=h.morphAttributes.position.length,v=s.get(h);if(v===void 0||v.count!==p){let D=function(){R.dispose(),s.delete(h),h.removeEventListener("dispose",D)};v!==void 0&&v.texture.dispose();let m=h.morphAttributes.normal!==void 0,z=h.morphAttributes.position,y=h.morphAttributes.normal||[],b=h.attributes.position.count,S=m===!0?2:1,_=b*S,A=1;_>e.maxTextureSize&&(A=Math.ceil(_/e.maxTextureSize),_=e.maxTextureSize);let P=new Float32Array(_*A*4*p),R=new Wa(P,_,A,p);R.format=Ut,R.type=Ti,R.needsUpdate=!0;let w=S*4;for(let C=0;C<p;C++){let V=z[C],H=y[C],T=_*A*4*C;for(let N=0;N<V.count;N++){r.fromBufferAttribute(V,N),V.normalized===!0&&D5(r,V);let I=N*w;P[T+I+0]=r.x,P[T+I+1]=r.y,P[T+I+2]=r.z,P[T+I+3]=0,m===!0&&(r.fromBufferAttribute(H,N),H.normalized===!0&&D5(r,H),P[T+I+4]=r.x,P[T+I+5]=r.y,P[T+I+6]=r.z,P[T+I+7]=0)}}v={count:p,texture:R,size:new te(_,A)},s.set(h,v),h.addEventListener("dispose",D)}let x=0;for(let m=0;m<d.length;m++)x+=d[m];let g=h.morphTargetsRelative?1:1-x;u.getUniforms().setValue(o,"morphTargetBaseInfluence",g),u.getUniforms().setValue(o,"morphTargetInfluences",d),u.getUniforms().setValue(o,"morphTargetsTexture",v.texture,t),u.getUniforms().setValue(o,"morphTargetsTextureSize",v.size)}else{let p=d===void 0?0:d.length,v=i[h.id];if(v===void 0||v.length!==p){v=[];for(let y=0;y<p;y++)v[y]=[y,0];i[h.id]=v}for(let y=0;y<p;y++){let b=v[y];b[0]=y,b[1]=d[y]}v.sort(jg);for(let y=0;y<8;y++)y<p&&v[y][1]?(a[y][0]=v[y][0],a[y][1]=v[y][1]):(a[y][0]=Number.MAX_SAFE_INTEGER,a[y][1]=0);a.sort(Wg);let x=h.morphAttributes.position,g=h.morphAttributes.normal,m=0;for(let y=0;y<8;y++){let b=a[y],S=b[0],_=b[1];S!==Number.MAX_SAFE_INTEGER&&_?(x&&h.getAttribute("morphTarget"+y)!==x[S]&&h.setAttribute("morphTarget"+y,x[S]),g&&h.getAttribute("morphNormal"+y)!==g[S]&&h.setAttribute("morphNormal"+y,g[S]),n[y]=_,m+=_):(x&&h.hasAttribute("morphTarget"+y)===!0&&h.deleteAttribute("morphTarget"+y),g&&h.hasAttribute("morphNormal"+y)===!0&&h.deleteAttribute("morphNormal"+y),n[y]=0)}let z=h.morphTargetsRelative?1:1-m;u.getUniforms().setValue(o,"morphTargetBaseInfluence",z),u.getUniforms().setValue(o,"morphTargetInfluences",n)}}return{update:c}}function Xg(o,e,t,i){let n=new WeakMap;function s(c){let l=i.render.frame,h=c.geometry,f=e.get(c,h);return n.get(f)!==l&&(e.update(f),n.set(f,l)),c.isInstancedMesh&&(c.hasEventListener("dispose",a)===!1&&c.addEventListener("dispose",a),t.update(c.instanceMatrix,34962),c.instanceColor!==null&&t.update(c.instanceColor,34962)),f}function r(){n=new WeakMap}function a(c){let l=c.target;l.removeEventListener("dispose",a),t.remove(l.instanceMatrix),l.instanceColor!==null&&t.remove(l.instanceColor)}return{update:s,dispose:r}}var i6=class extends vt{constructor(e=null,t=1,i=1,n=1){super(null);this.image={data:e,width:t,height:i,depth:n},this.magFilter=At,this.minFilter=At,this.wrapR=s1,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};i6.prototype.isDataTexture3D=!0;var H5=new vt,V5=new Wa,R5=new i6,N5=new Ns,F5=[],B5=[],P5=new Float32Array(16),I5=new Float32Array(9),k5=new Float32Array(4);function kn(o,e,t){let i=o[0];if(i<=0||i>0)return o;let n=e*t,s=F5[n];if(s===void 0&&(s=new Float32Array(n),F5[n]=s),e!==0){i.toArray(s,0);for(let r=1,a=0;r!==e;++r)a+=t,o[r].toArray(s,a)}return s}function qt(o,e){if(o.length!==e.length)return!1;for(let t=0,i=o.length;t<i;t++)if(o[t]!==e[t])return!1;return!0}function kt(o,e){for(let t=0,i=e.length;t<i;t++)o[t]=e[t]}function ja(o,e){let t=B5[e];t===void 0&&(t=new Int32Array(e),B5[e]=t);for(let i=0;i!==e;++i)t[i]=o.allocateTextureUnit();return t}function Yg(o,e){let t=this.cache;t[0]!==e&&(o.uniform1f(this.addr,e),t[0]=e)}function $g(o,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(o.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(qt(t,e))return;o.uniform2fv(this.addr,e),kt(t,e)}}function Jg(o,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(o.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(o.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(qt(t,e))return;o.uniform3fv(this.addr,e),kt(t,e)}}function Qg(o,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(o.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(qt(t,e))return;o.uniform4fv(this.addr,e),kt(t,e)}}function Kg(o,e){let t=this.cache,i=e.elements;if(i===void 0){if(qt(t,e))return;o.uniformMatrix2fv(this.addr,!1,e),kt(t,e)}else{if(qt(t,i))return;k5.set(i),o.uniformMatrix2fv(this.addr,!1,k5),kt(t,i)}}function ev(o,e){let t=this.cache,i=e.elements;if(i===void 0){if(qt(t,e))return;o.uniformMatrix3fv(this.addr,!1,e),kt(t,e)}else{if(qt(t,i))return;I5.set(i),o.uniformMatrix3fv(this.addr,!1,I5),kt(t,i)}}function tv(o,e){let t=this.cache,i=e.elements;if(i===void 0){if(qt(t,e))return;o.uniformMatrix4fv(this.addr,!1,e),kt(t,e)}else{if(qt(t,i))return;P5.set(i),o.uniformMatrix4fv(this.addr,!1,P5),kt(t,i)}}function iv(o,e){let t=this.cache;t[0]!==e&&(o.uniform1i(this.addr,e),t[0]=e)}function nv(o,e){let t=this.cache;qt(t,e)||(o.uniform2iv(this.addr,e),kt(t,e))}function sv(o,e){let t=this.cache;qt(t,e)||(o.uniform3iv(this.addr,e),kt(t,e))}function rv(o,e){let t=this.cache;qt(t,e)||(o.uniform4iv(this.addr,e),kt(t,e))}function av(o,e){let t=this.cache;t[0]!==e&&(o.uniform1ui(this.addr,e),t[0]=e)}function ov(o,e){let t=this.cache;qt(t,e)||(o.uniform2uiv(this.addr,e),kt(t,e))}function cv(o,e){let t=this.cache;qt(t,e)||(o.uniform3uiv(this.addr,e),kt(t,e))}function lv(o,e){let t=this.cache;qt(t,e)||(o.uniform4uiv(this.addr,e),kt(t,e))}function hv(o,e,t){let i=this.cache,n=t.allocateTextureUnit();i[0]!==n&&(o.uniform1i(this.addr,n),i[0]=n),t.safeSetTexture2D(e||H5,n)}function uv(o,e,t){let i=this.cache,n=t.allocateTextureUnit();i[0]!==n&&(o.uniform1i(this.addr,n),i[0]=n),t.setTexture3D(e||R5,n)}function fv(o,e,t){let i=this.cache,n=t.allocateTextureUnit();i[0]!==n&&(o.uniform1i(this.addr,n),i[0]=n),t.safeSetTextureCube(e||N5,n)}function dv(o,e,t){let i=this.cache,n=t.allocateTextureUnit();i[0]!==n&&(o.uniform1i(this.addr,n),i[0]=n),t.setTexture2DArray(e||V5,n)}function pv(o){switch(o){case 5126:return Yg;case 35664:return $g;case 35665:return Jg;case 35666:return Qg;case 35674:return Kg;case 35675:return ev;case 35676:return tv;case 5124:case 35670:return iv;case 35667:case 35671:return nv;case 35668:case 35672:return sv;case 35669:case 35673:return rv;case 5125:return av;case 36294:return ov;case 36295:return cv;case 36296:return lv;case 35678:case 36198:case 36298:case 36306:case 35682:return hv;case 35679:case 36299:case 36307:return uv;case 35680:case 36300:case 36308:case 36293:return fv;case 36289:case 36303:case 36311:case 36292:return dv}}function mv(o,e){o.uniform1fv(this.addr,e)}function gv(o,e){let t=kn(e,this.size,2);o.uniform2fv(this.addr,t)}function vv(o,e){let t=kn(e,this.size,3);o.uniform3fv(this.addr,t)}function xv(o,e){let t=kn(e,this.size,4);o.uniform4fv(this.addr,t)}function yv(o,e){let t=kn(e,this.size,4);o.uniformMatrix2fv(this.addr,!1,t)}function wv(o,e){let t=kn(e,this.size,9);o.uniformMatrix3fv(this.addr,!1,t)}function bv(o,e){let t=kn(e,this.size,16);o.uniformMatrix4fv(this.addr,!1,t)}function Mv(o,e){o.uniform1iv(this.addr,e)}function zv(o,e){o.uniform2iv(this.addr,e)}function Cv(o,e){o.uniform3iv(this.addr,e)}function Av(o,e){o.uniform4iv(this.addr,e)}function Sv(o,e){o.uniform1uiv(this.addr,e)}function _v(o,e){o.uniform2uiv(this.addr,e)}function Ev(o,e){o.uniform3uiv(this.addr,e)}function Lv(o,e){o.uniform4uiv(this.addr,e)}function Tv(o,e,t){let i=e.length,n=ja(t,i);o.uniform1iv(this.addr,n);for(let s=0;s!==i;++s)t.safeSetTexture2D(e[s]||H5,n[s])}function Dv(o,e,t){let i=e.length,n=ja(t,i);o.uniform1iv(this.addr,n);for(let s=0;s!==i;++s)t.setTexture3D(e[s]||R5,n[s])}function Hv(o,e,t){let i=e.length,n=ja(t,i);o.uniform1iv(this.addr,n);for(let s=0;s!==i;++s)t.safeSetTextureCube(e[s]||N5,n[s])}function Vv(o,e,t){let i=e.length,n=ja(t,i);o.uniform1iv(this.addr,n);for(let s=0;s!==i;++s)t.setTexture2DArray(e[s]||V5,n[s])}function Rv(o){switch(o){case 5126:return mv;case 35664:return gv;case 35665:return vv;case 35666:return xv;case 35674:return yv;case 35675:return wv;case 35676:return bv;case 5124:case 35670:return Mv;case 35667:case 35671:return zv;case 35668:case 35672:return Cv;case 35669:case 35673:return Av;case 5125:return Sv;case 36294:return _v;case 36295:return Ev;case 36296:return Lv;case 35678:case 36198:case 36298:case 36306:case 35682:return Tv;case 35679:case 36299:case 36307:return Dv;case 35680:case 36300:case 36308:case 36293:return Hv;case 36289:case 36303:case 36311:case 36292:return Vv}}function Nv(o,e,t){this.id=o,this.addr=t,this.cache=[],this.setValue=pv(e.type)}function O5(o,e,t){this.id=o,this.addr=t,this.cache=[],this.size=e.size,this.setValue=Rv(e.type)}O5.prototype.updateCache=function(o){let e=this.cache;o instanceof Float32Array&&e.length!==o.length&&(this.cache=new Float32Array(o.length)),kt(e,o)};function U5(o){this.id=o,this.seq=[],this.map={}}U5.prototype.setValue=function(o,e,t){let i=this.seq;for(let n=0,s=i.length;n!==s;++n){let r=i[n];r.setValue(o,e[r.id],t)}};var n6=/(\w+)(\])?(\[|\.)?/g;function G5(o,e){o.seq.push(e),o.map[e.id]=e}function Fv(o,e,t){let i=o.name,n=i.length;for(n6.lastIndex=0;;){let s=n6.exec(i),r=n6.lastIndex,a=s[1],c=s[2]==="]",l=s[3];if(c&&(a=a|0),l===void 0||l==="["&&r+2===n){G5(t,l===void 0?new Nv(a,o,e):new O5(a,o,e));break}else{let f=t.map[a];f===void 0&&(f=new U5(a),G5(t,f)),t=f}}}function fi(o,e){this.seq=[],this.map={};let t=o.getProgramParameter(e,35718);for(let i=0;i<t;++i){let n=o.getActiveUniform(e,i),s=o.getUniformLocation(e,n.name);Fv(n,s,this)}}fi.prototype.setValue=function(o,e,t,i){let n=this.map[e];n!==void 0&&n.setValue(o,t,i)};fi.prototype.setOptional=function(o,e,t){let i=e[t];i!==void 0&&this.setValue(o,t,i)};fi.upload=function(o,e,t,i){for(let n=0,s=e.length;n!==s;++n){let r=e[n],a=t[r.id];a.needsUpdate!==!1&&r.setValue(o,a.value,i)}};fi.seqWithValue=function(o,e){let t=[];for(let i=0,n=o.length;i!==n;++i){let s=o[i];s.id in e&&t.push(s)}return t};function q5(o,e,t){let i=o.createShader(e);return o.shaderSource(i,t),o.compileShader(i),i}var Bv=0;function Pv(o){let e=o.split(`
|
|
`);for(let t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join(`
|
|
`)}function Iv(o){switch(o){case ei:return["Linear","( value )"];case ot:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",o),["Linear","( value )"]}}function W5(o,e,t){let i=o.getShaderParameter(e,35713),n=o.getShaderInfoLog(e).trim();return i&&n===""?"":t.toUpperCase()+`
|
|
|
|
`+n+`
|
|
|
|
`+Pv(o.getShaderSource(e))}function kv(o,e){let t=Iv(e);return"vec4 "+o+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function Ov(o,e){let t;switch(e){case dd:t="Linear";break;case pd:t="Reinhard";break;case md:t="OptimizedCineon";break;case gd:t="ACESFilmic";break;case vd:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+o+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function Uv(o){return[o.extensionDerivatives||o.envMapCubeUV||o.bumpMap||o.tangentSpaceNormalMap||o.clearcoatNormalMap||o.flatShading||o.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(o.extensionFragDepth||o.logarithmicDepthBuffer)&&o.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",o.extensionDrawBuffers&&o.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(o.extensionShaderTextureLOD||o.envMap||o.transmission)&&o.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Is).join(`
|
|
`)}function Gv(o){let e=[];for(let t in o){let i=o[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(`
|
|
`)}function qv(o,e){let t={},i=o.getProgramParameter(e,35721);for(let n=0;n<i;n++){let s=o.getActiveAttrib(e,n),r=s.name,a=1;s.type===35674&&(a=2),s.type===35675&&(a=3),s.type===35676&&(a=4),t[r]={type:s.type,location:o.getAttribLocation(e,r),locationSize:a}}return t}function Is(o){return o!==""}function j5(o,e){return o.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Z5(o,e){return o.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var Wv=/^[ \t]*#include +<([\w\d./]+)>/gm;function s6(o){return o.replace(Wv,jv)}function jv(o,e){let t=Be[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return s6(t)}var Zv=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Xv=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function X5(o){return o.replace(Xv,Y5).replace(Zv,Yv)}function Yv(o,e,t,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Y5(o,e,t,i)}function Y5(o,e,t,i){let n="";for(let s=parseInt(e);s<parseInt(t);s++)n+=i.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return n}function $5(o){let e="precision "+o.precision+` float;
|
|
precision `+o.precision+" int;";return o.precision==="highp"?e+=`
|
|
#define HIGH_PRECISION`:o.precision==="mediump"?e+=`
|
|
#define MEDIUM_PRECISION`:o.precision==="lowp"&&(e+=`
|
|
#define LOW_PRECISION`),e}function $v(o){let e="SHADOWMAP_TYPE_BASIC";return o.shadowMapType===A8?e="SHADOWMAP_TYPE_PCF":o.shadowMapType===co?e="SHADOWMAP_TYPE_PCF_SOFT":o.shadowMapType===Cs&&(e="SHADOWMAP_TYPE_VSM"),e}function Jv(o){let e="ENVMAP_TYPE_CUBE";if(o.envMap)switch(o.envMapMode){case _s:case Es:e="ENVMAP_TYPE_CUBE";break;case da:case fo:e="ENVMAP_TYPE_CUBE_UV";break}return e}function Qv(o){let e="ENVMAP_MODE_REFLECTION";if(o.envMap)switch(o.envMapMode){case Es:case fo:e="ENVMAP_MODE_REFRACTION";break}return e}function Kv(o){let e="ENVMAP_BLENDING_NONE";if(o.envMap)switch(o.combine){case fa:e="ENVMAP_BLENDING_MULTIPLY";break;case ud:e="ENVMAP_BLENDING_MIX";break;case fd:e="ENVMAP_BLENDING_ADD";break}return e}function ex(o,e,t,i){let n=o.getContext(),s=t.defines,r=t.vertexShader,a=t.fragmentShader,c=$v(t),l=Jv(t),h=Qv(t),f=Kv(t),u=t.isWebGL2?"":Uv(t),d=Gv(s),p=n.createProgram(),v,x,g=t.glslVersion?"#version "+t.glslVersion+`
|
|
`:"";t.isRawShaderMaterial?(v=[d].filter(Is).join(`
|
|
`),v.length>0&&(v+=`
|
|
`),x=[u,d].filter(Is).join(`
|
|
`),x.length>0&&(x+=`
|
|
`)):(v=[$5(t),"#define SHADER_NAME "+t.shaderName,d,t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define MAX_BONES "+t.maxBones,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.displacementMap&&t.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.useVertexTexture?"#define BONE_TEXTURE":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphTargets&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargets&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
|
|
`].filter(Is).join(`
|
|
`),x=[u,$5(t),"#define SHADER_NAME "+t.shaderName,d,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+l:"",t.envMap?"#define "+h:"",t.envMap?"#define "+f:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(t.extensionShaderTextureLOD||t.envMap)&&t.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Q2?"#define TONE_MAPPING":"",t.toneMapping!==Q2?Be.tonemapping_pars_fragment:"",t.toneMapping!==Q2?Ov("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.alphaWrite?"":"#define OPAQUE",Be.encodings_pars_fragment,kv("linearToOutputTexel",t.outputEncoding),t.depthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
|
|
`].filter(Is).join(`
|
|
`)),r=s6(r),r=j5(r,t),r=Z5(r,t),a=s6(a),a=j5(a,t),a=Z5(a,t),r=X5(r),a=X5(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(g=`#version 300 es
|
|
`,v=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`
|
|
`)+`
|
|
`+v,x=["#define varying in",t.glslVersion===r5?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===r5?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
|
|
`)+`
|
|
`+x);let m=g+v+r,z=g+x+a,y=q5(n,35633,m),b=q5(n,35632,z);if(n.attachShader(p,y),n.attachShader(p,b),t.index0AttributeName!==void 0?n.bindAttribLocation(p,0,t.index0AttributeName):t.morphTargets===!0&&n.bindAttribLocation(p,0,"position"),n.linkProgram(p),o.debug.checkShaderErrors){let A=n.getProgramInfoLog(p).trim(),P=n.getShaderInfoLog(y).trim(),R=n.getShaderInfoLog(b).trim(),w=!0,D=!0;if(n.getProgramParameter(p,35714)===!1){w=!1;let C=W5(n,y,"vertex"),V=W5(n,b,"fragment");console.error("THREE.WebGLProgram: Shader Error "+n.getError()+" - VALIDATE_STATUS "+n.getProgramParameter(p,35715)+`
|
|
|
|
Program Info Log: `+A+`
|
|
`+C+`
|
|
`+V)}else A!==""?console.warn("THREE.WebGLProgram: Program Info Log:",A):(P===""||R==="")&&(D=!1);D&&(this.diagnostics={runnable:w,programLog:A,vertexShader:{log:P,prefix:v},fragmentShader:{log:R,prefix:x}})}n.deleteShader(y),n.deleteShader(b);let S;this.getUniforms=function(){return S===void 0&&(S=new fi(n,p)),S};let _;return this.getAttributes=function(){return _===void 0&&(_=qv(n,p)),_},this.destroy=function(){i.releaseStatesOfProgram(this),n.deleteProgram(p),this.program=void 0},this.name=t.shaderName,this.id=Bv++,this.cacheKey=e,this.usedTimes=1,this.program=p,this.vertexShader=y,this.fragmentShader=b,this}var tx=0,J5=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,i=e.fragmentShader,n=this._getShaderStage(t),s=this._getShaderStage(i),r=this._getShaderCacheForMaterial(e);return r.has(n)===!1&&(r.add(n),n.usedTimes++),r.has(s)===!1&&(r.add(s),s.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache;return t.has(e)===!1&&t.set(e,new Set),t.get(e)}_getShaderStage(e){let t=this.shaderCache;if(t.has(e)===!1){let i=new Q5;t.set(e,i)}return t.get(e)}},Q5=class{constructor(){this.id=tx++,this.usedTimes=0}};function ix(o,e,t,i,n,s,r){let a=new Bo,c=new J5,l=[],h=n.isWebGL2,f=n.logarithmicDepthBuffer,u=n.floatVertexTextures,d=n.maxVertexUniforms,p=n.vertexTextures,v=n.precision,x={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function g(w){let C=w.skeleton.bones;if(u)return 1024;{let H=Math.floor((d-20)/4),T=Math.min(H,C.length);return T<C.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+C.length+" bones. This GPU supports "+T+"."),0):T}}function m(w,D,C,V,H){let T=V.fog,N=w.isMeshStandardMaterial?V.environment:null,I=(w.isMeshStandardMaterial?t:e).get(w.envMap||N),j=x[w.type],O=H.isSkinnedMesh?g(H):0;w.precision!==null&&(v=n.getMaxPrecision(w.precision),v!==w.precision&&console.warn("THREE.WebGLProgram.getParameters:",w.precision,"not supported, using",v,"instead."));let q,Z,ne,ce;if(j){let ue=W1[j];q=ue.vertexShader,Z=ue.fragmentShader}else q=w.vertexShader,Z=w.fragmentShader,c.update(w),ne=c.getVertexShaderID(w),ce=c.getFragmentShaderID(w);let U=o.getRenderTarget(),Le=w.alphaTest>0,de=w.clearcoat>0;return{isWebGL2:h,shaderID:j,shaderName:w.type,vertexShader:q,fragmentShader:Z,defines:w.defines,customVertexShaderID:ne,customFragmentShaderID:ce,isRawShaderMaterial:w.isRawShaderMaterial===!0,glslVersion:w.glslVersion,precision:v,instancing:H.isInstancedMesh===!0,instancingColor:H.isInstancedMesh===!0&&H.instanceColor!==null,supportsVertexTextures:p,outputEncoding:U===null?o.outputEncoding:U.isXRRenderTarget===!0?U.texture.encoding:ei,map:!!w.map,matcap:!!w.matcap,envMap:!!I,envMapMode:I&&I.mapping,envMapCubeUV:!!I&&(I.mapping===da||I.mapping===fo),lightMap:!!w.lightMap,aoMap:!!w.aoMap,emissiveMap:!!w.emissiveMap,bumpMap:!!w.bumpMap,normalMap:!!w.normalMap,objectSpaceNormalMap:w.normalMapType===Id,tangentSpaceNormalMap:w.normalMapType===yn,decodeVideoTexture:!!w.map&&w.map.isVideoTexture===!0&&w.map.encoding===ot,clearcoat:de,clearcoatMap:de&&!!w.clearcoatMap,clearcoatRoughnessMap:de&&!!w.clearcoatRoughnessMap,clearcoatNormalMap:de&&!!w.clearcoatNormalMap,displacementMap:!!w.displacementMap,roughnessMap:!!w.roughnessMap,metalnessMap:!!w.metalnessMap,specularMap:!!w.specularMap,specularIntensityMap:!!w.specularIntensityMap,specularColorMap:!!w.specularColorMap,alphaMap:!!w.alphaMap,alphaTest:Le,alphaWrite:w.alphaWrite||w.transparent,gradientMap:!!w.gradientMap,sheen:w.sheen>0,sheenColorMap:!!w.sheenColorMap,sheenRoughnessMap:!!w.sheenRoughnessMap,transmission:w.transmission>0,transmissionMap:!!w.transmissionMap,thicknessMap:!!w.thicknessMap,combine:w.combine,vertexTangents:!!w.normalMap&&!!H.geometry&&!!H.geometry.attributes.tangent,vertexColors:w.vertexColors,vertexAlphas:w.vertexColors===!0&&!!H.geometry&&!!H.geometry.attributes.color&&H.geometry.attributes.color.itemSize===4,vertexUvs:!!w.map||!!w.bumpMap||!!w.normalMap||!!w.specularMap||!!w.alphaMap||!!w.emissiveMap||!!w.roughnessMap||!!w.metalnessMap||!!w.clearcoatMap||!!w.clearcoatRoughnessMap||!!w.clearcoatNormalMap||!!w.displacementMap||!!w.transmissionMap||!!w.thicknessMap||!!w.specularIntensityMap||!!w.specularColorMap||!!w.sheenColorMap||!!w.sheenRoughnessMap,uvsVertexOnly:!(!!w.map||!!w.bumpMap||!!w.normalMap||!!w.specularMap||!!w.alphaMap||!!w.emissiveMap||!!w.roughnessMap||!!w.metalnessMap||!!w.clearcoatNormalMap||w.transmission>0||!!w.transmissionMap||!!w.thicknessMap||!!w.specularIntensityMap||!!w.specularColorMap||w.sheen>0||!!w.sheenColorMap||!!w.sheenRoughnessMap)&&!!w.displacementMap,fog:!!T,useFog:w.fog,fogExp2:T&&T.isFogExp2,flatShading:!!w.flatShading,sizeAttenuation:w.sizeAttenuation,logarithmicDepthBuffer:f,skinning:H.isSkinnedMesh===!0&&O>0,maxBones:O,useVertexTexture:u,morphTargets:!!H.geometry&&!!H.geometry.morphAttributes.position,morphNormals:!!H.geometry&&!!H.geometry.morphAttributes.normal,morphTargetsCount:!!H.geometry&&!!H.geometry.morphAttributes.position?H.geometry.morphAttributes.position.length:0,numDirLights:D.directional.length,numPointLights:D.point.length,numSpotLights:D.spot.length,numRectAreaLights:D.rectArea.length,numHemiLights:D.hemi.length,numDirLightShadows:D.directionalShadowMap.length,numPointLightShadows:D.pointShadowMap.length,numSpotLightShadows:D.spotShadowMap.length,numClippingPlanes:r.numPlanes,numClipIntersection:r.numIntersection,dithering:w.dithering,shadowMapEnabled:o.shadowMap.enabled&&C.length>0,shadowMapType:o.shadowMap.type,toneMapping:w.toneMapped?o.toneMapping:Q2,physicallyCorrectLights:o.physicallyCorrectLights,premultipliedAlpha:w.premultipliedAlpha,doubleSided:w.side===fn,flipSided:w.side===Ct,depthPacking:w.depthPacking!==void 0?w.depthPacking:!1,index0AttributeName:w.index0AttributeName,extensionDerivatives:w.extensions&&w.extensions.derivatives,extensionFragDepth:w.extensions&&w.extensions.fragDepth,extensionDrawBuffers:w.extensions&&w.extensions.drawBuffers,extensionShaderTextureLOD:w.extensions&&w.extensions.shaderTextureLOD,rendererExtensionFragDepth:h||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||i.has("EXT_shader_texture_lod"),customProgramCacheKey:w.customProgramCacheKey()}}function z(w){let D=[];if(w.shaderID?D.push(w.shaderID):(D.push(w.customVertexShaderID),D.push(w.customFragmentShaderID)),w.defines!==void 0)for(let C in w.defines)D.push(C),D.push(w.defines[C]);return w.isRawShaderMaterial===!1&&(y(D,w),b(D,w),D.push(o.outputEncoding)),D.push(w.customProgramCacheKey),D.join()}function y(w,D){w.push(D.precision),w.push(D.outputEncoding),w.push(D.envMapMode),w.push(D.combine),w.push(D.vertexUvs),w.push(D.fogExp2),w.push(D.sizeAttenuation),w.push(D.maxBones),w.push(D.morphTargetsCount),w.push(D.numDirLights),w.push(D.numPointLights),w.push(D.numSpotLights),w.push(D.numHemiLights),w.push(D.numRectAreaLights),w.push(D.numDirLightShadows),w.push(D.numPointLightShadows),w.push(D.numSpotLightShadows),w.push(D.shadowMapType),w.push(D.toneMapping),w.push(D.numClippingPlanes),w.push(D.numClipIntersection),w.push(D.alphaWrite)}function b(w,D){a.disableAll(),D.isWebGL2&&a.enable(0),D.supportsVertexTextures&&a.enable(1),D.instancing&&a.enable(2),D.instancingColor&&a.enable(3),D.map&&a.enable(4),D.matcap&&a.enable(5),D.envMap&&a.enable(6),D.envMapCubeUV&&a.enable(7),D.lightMap&&a.enable(8),D.aoMap&&a.enable(9),D.emissiveMap&&a.enable(10),D.bumpMap&&a.enable(11),D.normalMap&&a.enable(12),D.objectSpaceNormalMap&&a.enable(13),D.tangentSpaceNormalMap&&a.enable(14),D.clearcoat&&a.enable(15),D.clearcoatMap&&a.enable(16),D.clearcoatRoughnessMap&&a.enable(17),D.clearcoatNormalMap&&a.enable(18),D.displacementMap&&a.enable(19),D.specularMap&&a.enable(20),D.roughnessMap&&a.enable(21),D.metalnessMap&&a.enable(22),D.gradientMap&&a.enable(23),D.alphaMap&&a.enable(24),D.alphaTest&&a.enable(25),D.vertexColors&&a.enable(26),D.vertexAlphas&&a.enable(27),D.vertexUvs&&a.enable(28),D.vertexTangents&&a.enable(29),D.uvsVertexOnly&&a.enable(30),D.fog&&a.enable(31),w.push(a.mask),a.disableAll(),D.useFog&&a.enable(0),D.flatShading&&a.enable(1),D.logarithmicDepthBuffer&&a.enable(2),D.skinning&&a.enable(3),D.useVertexTexture&&a.enable(4),D.morphTargets&&a.enable(5),D.morphNormals&&a.enable(6),D.premultipliedAlpha&&a.enable(7),D.shadowMapEnabled&&a.enable(8),D.physicallyCorrectLights&&a.enable(9),D.doubleSided&&a.enable(10),D.flipSided&&a.enable(11),D.depthPacking&&a.enable(12),D.dithering&&a.enable(13),D.specularIntensityMap&&a.enable(14),D.specularColorMap&&a.enable(15),D.transmission&&a.enable(16),D.transmissionMap&&a.enable(17),D.thicknessMap&&a.enable(18),D.sheen&&a.enable(19),D.sheenColorMap&&a.enable(20),D.sheenRoughnessMap&&a.enable(21),D.decodeVideoTexture&&a.enable(22),w.push(a.mask)}function S(w){let D=x[w.type],C;if(D){let V=W1[D];C=ep.clone(V.uniforms)}else C=w.uniforms;return C}function _(w,D){let C;for(let V=0,H=l.length;V<H;V++){let T=l[V];if(T.cacheKey===D){C=T,++C.usedTimes;break}}return C===void 0&&(C=new ex(o,D,w,s),l.push(C)),C}function A(w){if(--w.usedTimes==0){let D=l.indexOf(w);l[D]=l[l.length-1],l.pop(),w.destroy()}}function P(w){c.remove(w)}function R(){c.dispose()}return{getParameters:m,getProgramCacheKey:z,getUniforms:S,acquireProgram:_,releaseProgram:A,releaseShaderCache:P,programs:l,dispose:R}}function nx(){let o=new WeakMap;function e(s){let r=o.get(s);return r===void 0&&(r={},o.set(s,r)),r}function t(s){o.delete(s)}function i(s,r,a){o.get(s)[r]=a}function n(){o=new WeakMap}return{get:e,remove:t,update:i,dispose:n}}function sx(o,e){return o.groupOrder!==e.groupOrder?o.groupOrder-e.groupOrder:o.renderOrder!==e.renderOrder?o.renderOrder-e.renderOrder:o.material.id!==e.material.id?o.material.id-e.material.id:o.z!==e.z?o.z-e.z:o.id-e.id}function K5(o,e){return o.groupOrder!==e.groupOrder?o.groupOrder-e.groupOrder:o.renderOrder!==e.renderOrder?o.renderOrder-e.renderOrder:o.z!==e.z?e.z-o.z:o.id-e.id}function el(){let o=[],e=0,t=[],i=[],n=[];function s(){e=0,t.length=0,i.length=0,n.length=0}function r(f,u,d,p,v,x){let g=o[e];return g===void 0?(g={id:f.id,object:f,geometry:u,material:d,groupOrder:p,renderOrder:f.renderOrder,z:v,group:x},o[e]=g):(g.id=f.id,g.object=f,g.geometry=u,g.material=d,g.groupOrder=p,g.renderOrder=f.renderOrder,g.z=v,g.group=x),e++,g}function a(f,u,d,p,v,x){let g=r(f,u,d,p,v,x);d.transmission>0?i.push(g):d.transparent===!0?n.push(g):t.push(g)}function c(f,u,d,p,v,x){let g=r(f,u,d,p,v,x);d.transmission>0?i.unshift(g):d.transparent===!0?n.unshift(g):t.unshift(g)}function l(f,u){t.length>1&&t.sort(f||sx),i.length>1&&i.sort(u||K5),n.length>1&&n.sort(u||K5)}function h(){for(let f=e,u=o.length;f<u;f++){let d=o[f];if(d.id===null)break;d.id=null,d.object=null,d.geometry=null,d.material=null,d.group=null}}return{opaque:t,transmissive:i,transparent:n,init:s,push:a,unshift:c,finish:h,sort:l}}function rx(){let o=new WeakMap;function e(i,n){let s;return o.has(i)===!1?(s=new el,o.set(i,[s])):n>=o.get(i).length?(s=new el,o.get(i).push(s)):s=o.get(i)[n],s}function t(){o=new WeakMap}return{get:e,dispose:t}}function ax(){let o={};return{get:function(e){if(o[e.id]!==void 0)return o[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new B,color:new xe};break;case"SpotLight":t={position:new B,direction:new B,color:new xe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new B,color:new xe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new B,skyColor:new xe,groundColor:new xe};break;case"RectAreaLight":t={color:new xe,position:new B,halfWidth:new B,halfHeight:new B};break}return o[e.id]=t,t}}}function ox(){let o={};return{get:function(e){if(o[e.id]!==void 0)return o[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new te};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new te};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new te,shadowCameraNear:1,shadowCameraFar:1e3};break}return o[e.id]=t,t}}}var cx=0;function lx(o,e){return(e.castShadow?1:0)-(o.castShadow?1:0)}function hx(o,e){let t=new ax,i=ox(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let h=0;h<9;h++)n.probe.push(new B);let s=new B,r=new Ce,a=new Ce;function c(h,f){let u=0,d=0,p=0;for(let P=0;P<9;P++)n.probe[P].set(0,0,0);let v=0,x=0,g=0,m=0,z=0,y=0,b=0,S=0;h.sort(lx);let _=f!==!0?Math.PI:1;for(let P=0,R=h.length;P<R;P++){let w=h[P],D=w.color,C=w.intensity,V=w.distance,H=w.shadow&&w.shadow.map?w.shadow.map.texture:null;if(w.isAmbientLight)u+=D.r*C*_,d+=D.g*C*_,p+=D.b*C*_;else if(w.isLightProbe)for(let T=0;T<9;T++)n.probe[T].addScaledVector(w.sh.coefficients[T],C);else if(w.isDirectionalLight){let T=t.get(w);if(T.color.copy(w.color).multiplyScalar(w.intensity*_),w.castShadow){let N=w.shadow,I=i.get(w);I.shadowBias=N.bias,I.shadowNormalBias=N.normalBias,I.shadowRadius=N.radius,I.shadowMapSize=N.mapSize,n.directionalShadow[v]=I,n.directionalShadowMap[v]=H,n.directionalShadowMatrix[v]=w.shadow.matrix,y++}n.directional[v]=T,v++}else if(w.isSpotLight){let T=t.get(w);if(T.position.setFromMatrixPosition(w.matrixWorld),T.color.copy(D).multiplyScalar(C*_),T.distance=V,T.coneCos=Math.cos(w.angle),T.penumbraCos=Math.cos(w.angle*(1-w.penumbra)),T.decay=w.decay,w.castShadow){let N=w.shadow,I=i.get(w);I.shadowBias=N.bias,I.shadowNormalBias=N.normalBias,I.shadowRadius=N.radius,I.shadowMapSize=N.mapSize,n.spotShadow[g]=I,n.spotShadowMap[g]=H,n.spotShadowMatrix[g]=w.shadow.matrix,S++}n.spot[g]=T,g++}else if(w.isRectAreaLight){let T=t.get(w);T.color.copy(D).multiplyScalar(C),T.halfWidth.set(w.width*.5,0,0),T.halfHeight.set(0,w.height*.5,0),n.rectArea[m]=T,m++}else if(w.isPointLight){let T=t.get(w);if(T.color.copy(w.color).multiplyScalar(w.intensity*_),T.distance=w.distance,T.decay=w.decay,w.castShadow){let N=w.shadow,I=i.get(w);I.shadowBias=N.bias,I.shadowNormalBias=N.normalBias,I.shadowRadius=N.radius,I.shadowMapSize=N.mapSize,I.shadowCameraNear=N.camera.near,I.shadowCameraFar=N.camera.far,n.pointShadow[x]=I,n.pointShadowMap[x]=H,n.pointShadowMatrix[x]=w.shadow.matrix,b++}n.point[x]=T,x++}else if(w.isHemisphereLight){let T=t.get(w);T.skyColor.copy(w.color).multiplyScalar(C*_),T.groundColor.copy(w.groundColor).multiplyScalar(C*_),n.hemi[z]=T,z++}}m>0&&(e.isWebGL2||o.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=oe.LTC_FLOAT_1,n.rectAreaLTC2=oe.LTC_FLOAT_2):o.has("OES_texture_half_float_linear")===!0?(n.rectAreaLTC1=oe.LTC_HALF_1,n.rectAreaLTC2=oe.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),n.ambient[0]=u,n.ambient[1]=d,n.ambient[2]=p;let A=n.hash;(A.directionalLength!==v||A.pointLength!==x||A.spotLength!==g||A.rectAreaLength!==m||A.hemiLength!==z||A.numDirectionalShadows!==y||A.numPointShadows!==b||A.numSpotShadows!==S)&&(n.directional.length=v,n.spot.length=g,n.rectArea.length=m,n.point.length=x,n.hemi.length=z,n.directionalShadow.length=y,n.directionalShadowMap.length=y,n.pointShadow.length=b,n.pointShadowMap.length=b,n.spotShadow.length=S,n.spotShadowMap.length=S,n.directionalShadowMatrix.length=y,n.pointShadowMatrix.length=b,n.spotShadowMatrix.length=S,A.directionalLength=v,A.pointLength=x,A.spotLength=g,A.rectAreaLength=m,A.hemiLength=z,A.numDirectionalShadows=y,A.numPointShadows=b,A.numSpotShadows=S,n.version=cx++)}function l(h,f){let u=0,d=0,p=0,v=0,x=0,g=f.matrixWorldInverse;for(let m=0,z=h.length;m<z;m++){let y=h[m];if(y.isDirectionalLight){let b=n.directional[u];b.direction.setFromMatrixPosition(y.matrixWorld),s.setFromMatrixPosition(y.target.matrixWorld),b.direction.sub(s),b.direction.transformDirection(g),u++}else if(y.isSpotLight){let b=n.spot[p];b.position.setFromMatrixPosition(y.matrixWorld),b.position.applyMatrix4(g),b.direction.setFromMatrixPosition(y.matrixWorld),s.setFromMatrixPosition(y.target.matrixWorld),b.direction.sub(s),b.direction.transformDirection(g),p++}else if(y.isRectAreaLight){let b=n.rectArea[v];b.position.setFromMatrixPosition(y.matrixWorld),b.position.applyMatrix4(g),a.identity(),r.copy(y.matrixWorld),r.premultiply(g),a.extractRotation(r),b.halfWidth.set(y.width*.5,0,0),b.halfHeight.set(0,y.height*.5,0),b.halfWidth.applyMatrix4(a),b.halfHeight.applyMatrix4(a),v++}else if(y.isPointLight){let b=n.point[d];b.position.setFromMatrixPosition(y.matrixWorld),b.position.applyMatrix4(g),d++}else if(y.isHemisphereLight){let b=n.hemi[x];b.direction.setFromMatrixPosition(y.matrixWorld),b.direction.transformDirection(g),b.direction.normalize(),x++}}}return{setup:c,setupView:l,state:n}}function tl(o,e){let t=new hx(o,e),i=[],n=[];function s(){i.length=0,n.length=0}function r(f){i.push(f)}function a(f){n.push(f)}function c(f){t.setup(i,f)}function l(f){t.setupView(i,f)}return{init:s,state:{lightsArray:i,shadowsArray:n,lights:t},setupLights:c,setupLightsView:l,pushLight:r,pushShadow:a}}function ux(o,e){let t=new WeakMap;function i(s,r=0){let a;return t.has(s)===!1?(a=new tl(o,e),t.set(s,[a])):r>=t.get(s).length?(a=new tl(o,e),t.get(s).push(a)):a=t.get(s)[r],a}function n(){t=new WeakMap}return{get:i,dispose:n}}var r6=class extends St{constructor(e){super();this.type="MeshDepthMaterial",this.depthPacking=Bd,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}};r6.prototype.isMeshDepthMaterial=!0;var a6=class extends St{constructor(e){super();this.type="MeshDistanceMaterial",this.referencePosition=new B,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}};a6.prototype.isMeshDistanceMaterial=!0;var fx=`void main() {
|
|
gl_Position = vec4( position, 1.0 );
|
|
}`,dx=`uniform sampler2D shadow_pass;
|
|
uniform vec2 resolution;
|
|
uniform float radius;
|
|
#include <packing>
|
|
void main() {
|
|
const float samples = float( VSM_SAMPLES );
|
|
float mean = 0.0;
|
|
float squared_mean = 0.0;
|
|
float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
|
|
float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
|
|
for ( float i = 0.0; i < samples; i ++ ) {
|
|
float uvOffset = uvStart + i * uvStride;
|
|
#ifdef HORIZONTAL_PASS
|
|
vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
|
|
mean += distribution.x;
|
|
squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
|
|
#else
|
|
float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
|
|
mean += depth;
|
|
squared_mean += depth * depth;
|
|
#endif
|
|
}
|
|
mean = mean / samples;
|
|
squared_mean = squared_mean / samples;
|
|
float std_dev = sqrt( squared_mean - mean * mean );
|
|
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
|
|
}`;function il(o,e,t){let i=new Fs,n=new te,s=new te,r=new Qe,a=new r6({depthPacking:Pd}),c=new a6,l={},h=t.maxTextureSize,f={0:Ct,1:As,2:fn},u=new hi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new te},radius:{value:4}},vertexShader:fx,fragmentShader:dx}),d=u.clone();d.defines.HORIZONTAL_PASS=1;let p=new rt;p.setAttribute("position",new wt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let v=new Rt(p,u),x=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=A8,this.render=function(y,b,S){if(x.enabled===!1||x.autoUpdate===!1&&x.needsUpdate===!1||y.length===0)return;let _=o.getRenderTarget(),A=o.getActiveCubeFace(),P=o.getActiveMipmapLevel(),R=o.state;R.setBlending(J2),R.buffers.color.setClear(1,1,1,1),R.buffers.depth.setTest(!0),R.setScissorTest(!1);for(let w=0,D=y.length;w<D;w++){let C=y[w],V=C.shadow;if(V===void 0){console.warn("THREE.WebGLShadowMap:",C,"has no shadow.");continue}if(V.autoUpdate===!1&&V.needsUpdate===!1)continue;n.copy(V.mapSize);let H=V.getFrameExtents();if(n.multiply(H),s.copy(V.mapSize),(n.x>h||n.y>h)&&(n.x>h&&(s.x=Math.floor(h/H.x),n.x=s.x*H.x,V.mapSize.x=s.x),n.y>h&&(s.y=Math.floor(h/H.y),n.y=s.y*H.y,V.mapSize.y=s.y)),V.map===null&&!V.isPointLightShadow&&this.type===Cs){let N={minFilter:Pt,magFilter:Pt,format:Ut};V.map=new r1(n.x,n.y,N),V.map.texture.name=C.name+".shadowMap",V.mapPass=new r1(n.x,n.y,N),V.camera.updateProjectionMatrix()}if(V.map===null){let N={minFilter:At,magFilter:At,format:Ut};V.map=new r1(n.x,n.y,N),V.map.texture.name=C.name+".shadowMap",V.camera.updateProjectionMatrix()}o.setRenderTarget(V.map),o.clear();let T=V.getViewportCount();for(let N=0;N<T;N++){let I=V.getViewport(N);r.set(s.x*I.x,s.y*I.y,s.x*I.z,s.y*I.w),R.viewport(r),V.updateMatrices(C,N),i=V.getFrustum(),z(b,S,V.camera,C,this.type)}!V.isPointLightShadow&&this.type===Cs&&g(V,S),V.needsUpdate=!1}x.needsUpdate=!1,o.setRenderTarget(_,A,P)};function g(y,b){let S=e.update(v);u.defines.VSM_SAMPLES!==y.blurSamples&&(u.defines.VSM_SAMPLES=y.blurSamples,d.defines.VSM_SAMPLES=y.blurSamples,u.needsUpdate=!0,d.needsUpdate=!0),u.uniforms.shadow_pass.value=y.map.texture,u.uniforms.resolution.value=y.mapSize,u.uniforms.radius.value=y.radius,o.setRenderTarget(y.mapPass),o.clear(),o.renderBufferDirect(b,null,S,u,v,null),d.uniforms.shadow_pass.value=y.mapPass.texture,d.uniforms.resolution.value=y.mapSize,d.uniforms.radius.value=y.radius,o.setRenderTarget(y.map),o.clear(),o.renderBufferDirect(b,null,S,d,v,null)}function m(y,b,S,_,A,P,R){let w=null,D=_.isPointLight===!0?y.customDistanceMaterial:y.customDepthMaterial;if(D!==void 0?w=D:w=_.isPointLight===!0?c:a,o.localClippingEnabled&&S.clipShadows===!0&&S.clippingPlanes.length!==0||S.displacementMap&&S.displacementScale!==0||S.alphaMap&&S.alphaTest>0){let C=w.uuid,V=S.uuid,H=l[C];H===void 0&&(H={},l[C]=H);let T=H[V];T===void 0&&(T=w.clone(),H[V]=T),w=T}return w.visible=S.visible,w.wireframe=S.wireframe,R===Cs?w.side=S.shadowSide!==null?S.shadowSide:S.side:w.side=S.shadowSide!==null?S.shadowSide:f[S.side],w.alphaMap=S.alphaMap,w.alphaTest=S.alphaTest,w.clipShadows=S.clipShadows,w.clippingPlanes=S.clippingPlanes,w.clipIntersection=S.clipIntersection,w.displacementMap=S.displacementMap,w.displacementScale=S.displacementScale,w.displacementBias=S.displacementBias,w.wireframeLinewidth=S.wireframeLinewidth,w.linewidth=S.linewidth,_.isPointLight===!0&&w.isMeshDistanceMaterial===!0&&(w.referencePosition.setFromMatrixPosition(_.matrixWorld),w.nearDistance=A,w.farDistance=P),w}function z(y,b,S,_,A){if(y.visible===!1)return;if(y.layers.test(b.layers)&&(y.isMesh||y.isLine||y.isPoints)&&(y.castShadow||y.receiveShadow&&A===Cs)&&(!y.frustumCulled||i.intersectsObject(y))){y.modelViewMatrix.multiplyMatrices(S.matrixWorldInverse,y.matrixWorld);let w=e.update(y),D=y.material;if(Array.isArray(D)){let C=w.groups;for(let V=0,H=C.length;V<H;V++){let T=C[V],N=D[T.materialIndex];if(N&&N.visible){let I=m(y,w,N,_,S.near,S.far,A);o.renderBufferDirect(S,null,w,I,y,T)}}}else if(D.visible){let C=m(y,w,D,_,S.near,S.far,A);o.renderBufferDirect(S,null,w,C,y,null)}}let R=y.children;for(let w=0,D=R.length;w<D;w++)z(R[w],b,S,_,A)}}function px(o,e,t){let i=t.isWebGL2;function n(){let k=!1,ve=new Qe,pe=null,Ee=new Qe(0,0,0,0);return{setMask:function(K){pe!==K&&!k&&(o.colorMask(K,K,K,K),pe=K)},setLocked:function(K){k=K},setClear:function(K,Ae,Ie,lt,Qt){Qt===!0&&(K*=lt,Ae*=lt,Ie*=lt),ve.set(K,Ae,Ie,lt),Ee.equals(ve)===!1&&(o.clearColor(K,Ae,Ie,lt),Ee.copy(ve))},reset:function(){k=!1,pe=null,Ee.set(-1,0,0,0)}}}function s(){let k=!1,ve=null,pe=null,Ee=null;return{setTest:function(K){K?U(2929):Le(2929)},setMask:function(K){ve!==K&&!k&&(o.depthMask(K),ve=K)},setFunc:function(K){if(pe!==K){if(K)switch(K){case sd:o.depthFunc(512);break;case rd:o.depthFunc(519);break;case ad:o.depthFunc(513);break;case lo:o.depthFunc(515);break;case od:o.depthFunc(514);break;case cd:o.depthFunc(518);break;case ld:o.depthFunc(516);break;case hd:o.depthFunc(517);break;default:o.depthFunc(515)}else o.depthFunc(515);pe=K}},setLocked:function(K){k=K},setClear:function(K){Ee!==K&&(o.clearDepth(K),Ee=K)},reset:function(){k=!1,ve=null,pe=null,Ee=null}}}function r(){let k=!1,ve=null,pe=null,Ee=null,K=null,Ae=null,Ie=null,lt=null,Qt=null;return{setTest:function(ft){k||(ft?U(2960):Le(2960))},setMask:function(ft){ve!==ft&&!k&&(o.stencilMask(ft),ve=ft)},setFunc:function(ft,T1,Y1){(pe!==ft||Ee!==T1||K!==Y1)&&(o.stencilFunc(ft,T1,Y1),pe=ft,Ee=T1,K=Y1)},setOp:function(ft,T1,Y1){(Ae!==ft||Ie!==T1||lt!==Y1)&&(o.stencilOp(ft,T1,Y1),Ae=ft,Ie=T1,lt=Y1)},setLocked:function(ft){k=ft},setClear:function(ft){Qt!==ft&&(o.clearStencil(ft),Qt=ft)},reset:function(){k=!1,ve=null,pe=null,Ee=null,K=null,Ae=null,Ie=null,lt=null,Qt=null}}}let a=new n,c=new s,l=new r,h={},f={},u=new WeakMap,d=[],p=null,v=!1,x=null,g=null,m=null,z=null,y=null,b=null,S=null,_=!1,A=null,P=null,R=null,w=null,D=null,C=o.getParameter(35661),V=!1,H=0,T=o.getParameter(7938);T.indexOf("WebGL")!==-1?(H=parseFloat(/^WebGL (\d)/.exec(T)[1]),V=H>=1):T.indexOf("OpenGL ES")!==-1&&(H=parseFloat(/^OpenGL ES (\d)/.exec(T)[1]),V=H>=2);let N=null,I={},j=o.getParameter(3088),O=o.getParameter(2978),q=new Qe().fromArray(j),Z=new Qe().fromArray(O);function ne(k,ve,pe){let Ee=new Uint8Array(4),K=o.createTexture();o.bindTexture(k,K),o.texParameteri(k,10241,9728),o.texParameteri(k,10240,9728);for(let Ae=0;Ae<pe;Ae++)o.texImage2D(ve+Ae,0,6408,1,1,0,6408,5121,Ee);return K}let ce={};ce[3553]=ne(3553,3553,1),ce[34067]=ne(34067,34069,6),a.setClear(0,0,0,1),c.setClear(1),l.setClear(0),U(2929),c.setFunc(lo),ie(!1),ge(C8),U(2884),J(J2);function U(k){h[k]!==!0&&(o.enable(k),h[k]=!0)}function Le(k){h[k]!==!1&&(o.disable(k),h[k]=!1)}function de(k,ve){return f[k]!==ve?(o.bindFramebuffer(k,ve),f[k]=ve,i&&(k===36009&&(f[36160]=ve),k===36160&&(f[36009]=ve)),!0):!1}function ze(k,ve){let pe=d,Ee=!1;if(k)if(pe=u.get(ve),pe===void 0&&(pe=[],u.set(ve,pe)),k.isWebGLMultipleRenderTargets){let K=k.texture;if(pe.length!==K.length||pe[0]!==36064){for(let Ae=0,Ie=K.length;Ae<Ie;Ae++)pe[Ae]=36064+Ae;pe.length=K.length,Ee=!0}}else pe[0]!==36064&&(pe[0]=36064,Ee=!0);else pe[0]!==1029&&(pe[0]=1029,Ee=!0);Ee&&(t.isWebGL2?o.drawBuffers(pe):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(pe))}function ue(k){return p!==k?(o.useProgram(k),p=k,!0):!1}let De={[dn]:32774,[Zf]:32778,[Xf]:32779};if(i)De[T8]=32775,De[D8]=32776;else{let k=e.get("EXT_blend_minmax");k!==null&&(De[T8]=k.MIN_EXT,De[D8]=k.MAX_EXT)}let Se={[Yf]:0,[$f]:1,[Jf]:768,[H8]:770,[nd]:776,[td]:774,[Kf]:772,[Qf]:769,[V8]:771,[id]:775,[ed]:773};function J(k,ve,pe,Ee,K,Ae,Ie,lt){if(k===J2){v===!0&&(Le(3042),v=!1);return}if(v===!1&&(U(3042),v=!0),k!==jf){if(k!==x||lt!==_){if((g!==dn||y!==dn)&&(o.blendEquation(32774),g=dn,y=dn),lt)switch(k){case Ss:o.blendFuncSeparate(1,771,1,771);break;case _8:o.blendFunc(1,1);break;case E8:o.blendFuncSeparate(0,769,0,1);break;case L8:o.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",k);break}else switch(k){case Ss:o.blendFuncSeparate(770,771,1,771);break;case _8:o.blendFunc(770,1);break;case E8:o.blendFuncSeparate(0,769,0,1);break;case L8:o.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",k);break}m=null,z=null,b=null,S=null,x=k,_=lt}return}K=K||ve,Ae=Ae||pe,Ie=Ie||Ee,(ve!==g||K!==y)&&(o.blendEquationSeparate(De[ve],De[K]),g=ve,y=K),(pe!==m||Ee!==z||Ae!==b||Ie!==S)&&(o.blendFuncSeparate(Se[pe],Se[Ee],Se[Ae],Se[Ie]),m=pe,z=Ee,b=Ae,S=Ie),x=k,_=null}function se(k,ve){k.side===fn?Le(2884):U(2884);let pe=k.side===Ct;ve&&(pe=!pe),ie(pe),k.blending===Ss&&k.transparent===!1?J(J2):J(k.blending,k.blendEquation,k.blendSrc,k.blendDst,k.blendEquationAlpha,k.blendSrcAlpha,k.blendDstAlpha,k.premultipliedAlpha),c.setFunc(k.depthFunc),c.setTest(k.depthTest),c.setMask(k.depthWrite),a.setMask(k.colorWrite);let Ee=k.stencilWrite;l.setTest(Ee),Ee&&(l.setMask(k.stencilWriteMask),l.setFunc(k.stencilFunc,k.stencilRef,k.stencilFuncMask),l.setOp(k.stencilFail,k.stencilZFail,k.stencilZPass)),_e(k.polygonOffset,k.polygonOffsetFactor,k.polygonOffsetUnits),k.alphaToCoverage===!0?U(32926):Le(32926)}function ie(k){A!==k&&(k?o.frontFace(2304):o.frontFace(2305),A=k)}function ge(k){k!==qf?(U(2884),k!==P&&(k===C8?o.cullFace(1029):k===Wf?o.cullFace(1028):o.cullFace(1032))):Le(2884),P=k}function fe(k){k!==R&&(V&&o.lineWidth(k),R=k)}function _e(k,ve,pe){k?(U(32823),(w!==ve||D!==pe)&&(o.polygonOffset(ve,pe),w=ve,D=pe)):Le(32823)}function Te(k){k?U(3089):Le(3089)}function ke(k){k===void 0&&(k=33984+C-1),N!==k&&(o.activeTexture(k),N=k)}function Ke(k,ve){N===null&&ke();let pe=I[N];pe===void 0&&(pe={type:void 0,texture:void 0},I[N]=pe),(pe.type!==k||pe.texture!==ve)&&(o.bindTexture(k,ve||ce[k]),pe.type=k,pe.texture=ve)}function Je(){let k=I[N];k!==void 0&&k.type!==void 0&&(o.bindTexture(k.type,null),k.type=void 0,k.texture=void 0)}function F(){try{o.compressedTexImage2D.apply(o,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function E(){try{o.texSubImage2D.apply(o,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function Q(){try{o.texSubImage3D.apply(o,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function re(){try{o.compressedTexSubImage2D.apply(o,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function ye(){try{o.texStorage2D.apply(o,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function $(){try{o.texStorage3D.apply(o,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function Me(){try{o.texImage2D.apply(o,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function we(){try{o.texImage3D.apply(o,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function he(k){q.equals(k)===!1&&(o.scissor(k.x,k.y,k.z,k.w),q.copy(k))}function le(k){Z.equals(k)===!1&&(o.viewport(k.x,k.y,k.z,k.w),Z.copy(k))}function Ve(){o.disable(3042),o.disable(2884),o.disable(2929),o.disable(32823),o.disable(3089),o.disable(2960),o.disable(32926),o.blendEquation(32774),o.blendFunc(1,0),o.blendFuncSeparate(1,0,1,0),o.colorMask(!0,!0,!0,!0),o.clearColor(0,0,0,0),o.depthMask(!0),o.depthFunc(513),o.clearDepth(1),o.stencilMask(4294967295),o.stencilFunc(519,0,4294967295),o.stencilOp(7680,7680,7680),o.clearStencil(0),o.cullFace(1029),o.frontFace(2305),o.polygonOffset(0,0),o.activeTexture(33984),o.bindFramebuffer(36160,null),i===!0&&(o.bindFramebuffer(36009,null),o.bindFramebuffer(36008,null)),o.useProgram(null),o.lineWidth(1),o.scissor(0,0,o.canvas.width,o.canvas.height),o.viewport(0,0,o.canvas.width,o.canvas.height),h={},N=null,I={},f={},u=new WeakMap,d=[],p=null,v=!1,x=null,g=null,m=null,z=null,y=null,b=null,S=null,_=!1,A=null,P=null,R=null,w=null,D=null,q.set(0,0,o.canvas.width,o.canvas.height),Z.set(0,0,o.canvas.width,o.canvas.height),a.reset(),c.reset(),l.reset()}return{buffers:{color:a,depth:c,stencil:l},enable:U,disable:Le,bindFramebuffer:de,drawBuffers:ze,useProgram:ue,setBlending:J,setMaterial:se,setFlipSided:ie,setCullFace:ge,setLineWidth:fe,setPolygonOffset:_e,setScissorTest:Te,activeTexture:ke,bindTexture:Ke,unbindTexture:Je,compressedTexImage2D:F,texImage2D:Me,texImage3D:we,texStorage2D:ye,texStorage3D:$,texSubImage2D:E,texSubImage3D:Q,compressedTexSubImage2D:re,scissor:he,viewport:le,reset:Ve}}function mx(o,e,t,i,n,s,r){let a=n.isWebGL2,c=n.maxTextures,l=n.maxCubemapSize,h=n.maxTextureSize,f=n.maxSamples,d=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):void 0,p=new WeakMap,v,x=!1;try{x=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function g(F,E){return x?new OffscreenCanvas(F,E):Ds("canvas")}function m(F,E,Q,re){let ye=1;if((F.width>re||F.height>re)&&(ye=re/Math.max(F.width,F.height)),ye<1||E===!0)if(typeof HTMLImageElement!="undefined"&&F instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&F instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&F instanceof ImageBitmap){let $=E?Ud:Math.floor,Me=$(ye*F.width),we=$(ye*F.height);v===void 0&&(v=g(Me,we));let he=Q?g(Me,we):v;return he.width=Me,he.height=we,he.getContext("2d").drawImage(F,0,0,Me,we),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+F.width+"x"+F.height+") to ("+Me+"x"+we+")."),he}else return"data"in F&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+F.width+"x"+F.height+")."),F;return F}function z(F){return a5(F.width)&&a5(F.height)}function y(F){return a?!1:F.wrapS!==s1||F.wrapT!==s1||F.minFilter!==At&&F.minFilter!==Pt}function b(F,E){return F.generateMipmaps&&E&&F.minFilter!==At&&F.minFilter!==Pt}function S(F){o.generateMipmap(F)}function _(F,E,Q,re,ye=!1){if(a===!1)return E;if(F!==null){if(o[F]!==void 0)return o[F];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+F+"'")}let $=E;return E===6403&&(Q===5126&&($=33326),Q===5131&&($=33325),Q===5121&&($=33321)),E===33319&&(Q===5126&&($=33328),Q===5131&&($=33327),Q===5121&&($=33323)),E===6408&&(Q===5126&&($=34836),Q===5131&&($=34842),Q===5121&&($=re===ot&&ye===!1?35907:32856),Q===32819&&($=32854),Q===32820&&($=32855)),($===33325||$===33326||$===33327||$===33328||$===34842||$===34836)&&e.get("EXT_color_buffer_float"),$}function A(F,E,Q){return b(F,Q)===!0||F.isFramebufferTexture&&F.minFilter!==At&&F.minFilter!==Pt?Math.log2(Math.max(E.width,E.height))+1:F.mipmaps!==void 0&&F.mipmaps.length>0?F.mipmaps.length:F.isCompressedTexture&&Array.isArray(F.image)?E.mipmaps.length:1}function P(F){return F===At||F===N8||F===F8?9728:9729}function R(F){let E=F.target;E.removeEventListener("dispose",R),D(E),E.isVideoTexture&&p.delete(E),r.memory.textures--}function w(F){let E=F.target;E.removeEventListener("dispose",w),C(E)}function D(F){let E=i.get(F);E.__webglInit!==void 0&&(o.deleteTexture(E.__webglTexture),i.remove(F))}function C(F){let E=F.texture,Q=i.get(F),re=i.get(E);if(!!F){if(re.__webglTexture!==void 0&&(o.deleteTexture(re.__webglTexture),r.memory.textures--),F.depthTexture&&F.depthTexture.dispose(),F.isWebGLCubeRenderTarget)for(let ye=0;ye<6;ye++)o.deleteFramebuffer(Q.__webglFramebuffer[ye]),Q.__webglDepthbuffer&&o.deleteRenderbuffer(Q.__webglDepthbuffer[ye]);else o.deleteFramebuffer(Q.__webglFramebuffer),Q.__webglDepthbuffer&&o.deleteRenderbuffer(Q.__webglDepthbuffer),Q.__webglMultisampledFramebuffer&&o.deleteFramebuffer(Q.__webglMultisampledFramebuffer),Q.__webglColorRenderbuffer&&o.deleteRenderbuffer(Q.__webglColorRenderbuffer),Q.__webglDepthRenderbuffer&&o.deleteRenderbuffer(Q.__webglDepthRenderbuffer);if(F.isWebGLMultipleRenderTargets)for(let ye=0,$=E.length;ye<$;ye++){let Me=i.get(E[ye]);Me.__webglTexture&&(o.deleteTexture(Me.__webglTexture),r.memory.textures--),i.remove(E[ye])}i.remove(E),i.remove(F)}}let V=0;function H(){V=0}function T(){let F=V;return F>=c&&console.warn("THREE.WebGLTextures: Trying to use "+F+" texture units while this GPU supports only "+c),V+=1,F}function N(F,E){let Q=i.get(F);if(F.isVideoTexture&&fe(F),F.version>0&&Q.__version!==F.version){let re=F.image;if(re===void 0)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else if(re.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{U(Q,F,E);return}}t.activeTexture(33984+E),t.bindTexture(3553,Q.__webglTexture)}function I(F,E){let Q=i.get(F);if(F.version>0&&Q.__version!==F.version){U(Q,F,E);return}t.activeTexture(33984+E),t.bindTexture(35866,Q.__webglTexture)}function j(F,E){let Q=i.get(F);if(F.version>0&&Q.__version!==F.version){U(Q,F,E);return}t.activeTexture(33984+E),t.bindTexture(32879,Q.__webglTexture)}function O(F,E){let Q=i.get(F);if(F.version>0&&Q.__version!==F.version){Le(Q,F,E);return}t.activeTexture(33984+E),t.bindTexture(34067,Q.__webglTexture)}let q={[po]:10497,[s1]:33071,[mo]:33648},Z={[At]:9728,[N8]:9984,[F8]:9986,[Pt]:9729,[xd]:9985,[pa]:9987};function ne(F,E,Q){if(Q?(o.texParameteri(F,10242,q[E.wrapS]),o.texParameteri(F,10243,q[E.wrapT]),(F===32879||F===35866)&&o.texParameteri(F,32882,q[E.wrapR]),o.texParameteri(F,10240,Z[E.magFilter]),o.texParameteri(F,10241,Z[E.minFilter])):(o.texParameteri(F,10242,33071),o.texParameteri(F,10243,33071),(F===32879||F===35866)&&o.texParameteri(F,32882,33071),(E.wrapS!==s1||E.wrapT!==s1)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),o.texParameteri(F,10240,P(E.magFilter)),o.texParameteri(F,10241,P(E.minFilter)),E.minFilter!==At&&E.minFilter!==Pt&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){let re=e.get("EXT_texture_filter_anisotropic");if(E.type===Ti&&e.has("OES_texture_float_linear")===!1||a===!1&&E.type===pn&&e.has("OES_texture_half_float_linear")===!1)return;(E.anisotropy>1||i.get(E).__currentAnisotropy)&&(o.texParameterf(F,re.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(E.anisotropy,n.getMaxAnisotropy())),i.get(E).__currentAnisotropy=E.anisotropy)}}function ce(F,E){F.__webglInit===void 0&&(F.__webglInit=!0,E.addEventListener("dispose",R),F.__webglTexture=o.createTexture(),r.memory.textures++)}function U(F,E,Q){let re=3553;E.isDataTexture2DArray&&(re=35866),E.isDataTexture3D&&(re=32879),ce(F,E),t.activeTexture(33984+Q),t.bindTexture(re,F.__webglTexture),o.pixelStorei(37440,E.flipY),o.pixelStorei(37441,E.premultiplyAlpha),o.pixelStorei(3317,E.unpackAlignment),o.pixelStorei(37443,0);let ye=y(E)&&z(E.image)===!1,$=m(E.image,ye,!1,h);$=_e(E,$);let Me=z($)||a,we=s.convert(E.format,E.encoding),he=s.convert(E.type),le=_(E.internalFormat,we,he,E.encoding,E.isVideoTexture);ne(re,E,Me);let Ve,k=E.mipmaps,ve=a&&E.isVideoTexture!==!0,pe=F.__version===void 0,Ee=A(E,$,Me);if(E.isDepthTexture)le=6402,a?E.type===Ti?le=36012:E.type===ma?le=33190:E.type===mn?le=35056:le=33189:E.type===Ti&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),E.format===Di&&le===6402&&E.type!==Ls&&E.type!==ma&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),E.type=Ls,he=s.convert(E.type)),E.format===gn&&le===6402&&(le=34041,E.type!==mn&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),E.type=mn,he=s.convert(E.type))),ve&&pe?t.texStorage2D(3553,1,le,$.width,$.height):t.texImage2D(3553,0,le,$.width,$.height,0,we,he,null);else if(E.isDataTexture)if(k.length>0&&Me){ve&&pe&&t.texStorage2D(3553,Ee,le,k[0].width,k[0].height);for(let K=0,Ae=k.length;K<Ae;K++)Ve=k[K],ve?t.texSubImage2D(3553,0,0,0,Ve.width,Ve.height,we,he,Ve.data):t.texImage2D(3553,K,le,Ve.width,Ve.height,0,we,he,Ve.data);E.generateMipmaps=!1}else ve?(pe&&t.texStorage2D(3553,Ee,le,$.width,$.height),t.texSubImage2D(3553,0,0,0,$.width,$.height,we,he,$.data)):t.texImage2D(3553,0,le,$.width,$.height,0,we,he,$.data);else if(E.isCompressedTexture){ve&&pe&&t.texStorage2D(3553,Ee,le,k[0].width,k[0].height);for(let K=0,Ae=k.length;K<Ae;K++)Ve=k[K],E.format!==Ut?we!==null?ve?t.compressedTexSubImage2D(3553,K,0,0,Ve.width,Ve.height,we,Ve.data):t.compressedTexImage2D(3553,K,le,Ve.width,Ve.height,0,Ve.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):ve?t.texSubImage2D(3553,K,0,0,Ve.width,Ve.height,we,he,Ve.data):t.texImage2D(3553,K,le,Ve.width,Ve.height,0,we,he,Ve.data)}else if(E.isDataTexture2DArray)ve?(pe&&t.texStorage3D(35866,Ee,le,$.width,$.height,$.depth),t.texSubImage3D(35866,0,0,0,0,$.width,$.height,$.depth,we,he,$.data)):t.texImage3D(35866,0,le,$.width,$.height,$.depth,0,we,he,$.data);else if(E.isDataTexture3D)ve?(pe&&t.texStorage3D(32879,Ee,le,$.width,$.height,$.depth),t.texSubImage3D(32879,0,0,0,0,$.width,$.height,$.depth,we,he,$.data)):t.texImage3D(32879,0,le,$.width,$.height,$.depth,0,we,he,$.data);else if(E.isFramebufferTexture)ve&&pe?t.texStorage2D(3553,Ee,le,$.width,$.height):t.texImage2D(3553,0,le,$.width,$.height,0,we,he,null);else if(k.length>0&&Me){ve&&pe&&t.texStorage2D(3553,Ee,le,k[0].width,k[0].height);for(let K=0,Ae=k.length;K<Ae;K++)Ve=k[K],ve?t.texSubImage2D(3553,K,0,0,we,he,Ve):t.texImage2D(3553,K,le,we,he,Ve);E.generateMipmaps=!1}else ve?(pe&&t.texStorage2D(3553,Ee,le,$.width,$.height),t.texSubImage2D(3553,0,0,0,we,he,$)):t.texImage2D(3553,0,le,we,he,$);b(E,Me)&&S(re),F.__version=E.version,E.onUpdate&&E.onUpdate(E)}function Le(F,E,Q){if(E.image.length!==6)return;ce(F,E),t.activeTexture(33984+Q),t.bindTexture(34067,F.__webglTexture),o.pixelStorei(37440,E.flipY),o.pixelStorei(37441,E.premultiplyAlpha),o.pixelStorei(3317,E.unpackAlignment),o.pixelStorei(37443,0);let re=E&&(E.isCompressedTexture||E.image[0].isCompressedTexture),ye=E.image[0]&&E.image[0].isDataTexture,$=[];for(let K=0;K<6;K++)!re&&!ye?$[K]=m(E.image[K],!1,!0,l):$[K]=ye?E.image[K].image:E.image[K],$[K]=_e(E,$[K]);let Me=$[0],we=z(Me)||a,he=s.convert(E.format,E.encoding),le=s.convert(E.type),Ve=_(E.internalFormat,he,le,E.encoding),k=a&&E.isVideoTexture!==!0,ve=F.__version===void 0,pe=A(E,Me,we);ne(34067,E,we);let Ee;if(re){k&&ve&&t.texStorage2D(34067,pe,Ve,Me.width,Me.height);for(let K=0;K<6;K++){Ee=$[K].mipmaps;for(let Ae=0;Ae<Ee.length;Ae++){let Ie=Ee[Ae];E.format!==Ut?he!==null?k?t.compressedTexSubImage2D(34069+K,Ae,0,0,Ie.width,Ie.height,he,Ie.data):t.compressedTexImage2D(34069+K,Ae,Ve,Ie.width,Ie.height,0,Ie.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):k?t.texSubImage2D(34069+K,Ae,0,0,Ie.width,Ie.height,he,le,Ie.data):t.texImage2D(34069+K,Ae,Ve,Ie.width,Ie.height,0,he,le,Ie.data)}}}else{Ee=E.mipmaps,k&&ve&&(Ee.length>0&&pe++,t.texStorage2D(34067,pe,Ve,$[0].width,$[0].height));for(let K=0;K<6;K++)if(ye){k?t.texSubImage2D(34069+K,0,0,0,$[K].width,$[K].height,he,le,$[K].data):t.texImage2D(34069+K,0,Ve,$[K].width,$[K].height,0,he,le,$[K].data);for(let Ae=0;Ae<Ee.length;Ae++){let lt=Ee[Ae].image[K].image;k?t.texSubImage2D(34069+K,Ae+1,0,0,lt.width,lt.height,he,le,lt.data):t.texImage2D(34069+K,Ae+1,Ve,lt.width,lt.height,0,he,le,lt.data)}}else{k?t.texSubImage2D(34069+K,0,0,0,he,le,$[K]):t.texImage2D(34069+K,0,Ve,he,le,$[K]);for(let Ae=0;Ae<Ee.length;Ae++){let Ie=Ee[Ae];k?t.texSubImage2D(34069+K,Ae+1,0,0,he,le,Ie.image[K]):t.texImage2D(34069+K,Ae+1,Ve,he,le,Ie.image[K])}}}b(E,we)&&S(34067),F.__version=E.version,E.onUpdate&&E.onUpdate(E)}function de(F,E,Q,re,ye){let $=s.convert(Q.format,Q.encoding),Me=s.convert(Q.type),we=_(Q.internalFormat,$,Me,Q.encoding);i.get(E).__hasExternalTextures||(ye===32879||ye===35866?t.texImage3D(ye,0,we,E.width,E.height,E.depth,0,$,Me,null):t.texImage2D(ye,0,we,E.width,E.height,0,$,Me,null)),t.bindFramebuffer(36160,F),E.useRenderToTexture?d.framebufferTexture2DMultisampleEXT(36160,re,ye,i.get(Q).__webglTexture,0,ge(E)):o.framebufferTexture2D(36160,re,ye,i.get(Q).__webglTexture,0),t.bindFramebuffer(36160,null)}function ze(F,E,Q){if(o.bindRenderbuffer(36161,F),E.depthBuffer&&!E.stencilBuffer){let re=33189;if(Q||E.useRenderToTexture){let ye=E.depthTexture;ye&&ye.isDepthTexture&&(ye.type===Ti?re=36012:ye.type===ma&&(re=33190));let $=ge(E);E.useRenderToTexture?d.renderbufferStorageMultisampleEXT(36161,$,re,E.width,E.height):o.renderbufferStorageMultisample(36161,$,re,E.width,E.height)}else o.renderbufferStorage(36161,re,E.width,E.height);o.framebufferRenderbuffer(36160,36096,36161,F)}else if(E.depthBuffer&&E.stencilBuffer){let re=ge(E);Q&&E.useRenderbuffer?o.renderbufferStorageMultisample(36161,re,35056,E.width,E.height):E.useRenderToTexture?d.renderbufferStorageMultisampleEXT(36161,re,35056,E.width,E.height):o.renderbufferStorage(36161,34041,E.width,E.height),o.framebufferRenderbuffer(36160,33306,36161,F)}else{let re=E.isWebGLMultipleRenderTargets===!0?E.texture[0]:E.texture,ye=s.convert(re.format,re.encoding),$=s.convert(re.type),Me=_(re.internalFormat,ye,$,re.encoding),we=ge(E);Q&&E.useRenderbuffer?o.renderbufferStorageMultisample(36161,we,Me,E.width,E.height):E.useRenderToTexture?d.renderbufferStorageMultisampleEXT(36161,we,Me,E.width,E.height):o.renderbufferStorage(36161,Me,E.width,E.height)}o.bindRenderbuffer(36161,null)}function ue(F,E){if(E&&E.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,F),!(E.depthTexture&&E.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!i.get(E.depthTexture).__webglTexture||E.depthTexture.image.width!==E.width||E.depthTexture.image.height!==E.height)&&(E.depthTexture.image.width=E.width,E.depthTexture.image.height=E.height,E.depthTexture.needsUpdate=!0),N(E.depthTexture,0);let re=i.get(E.depthTexture).__webglTexture,ye=ge(E);if(E.depthTexture.format===Di)E.useRenderToTexture?d.framebufferTexture2DMultisampleEXT(36160,36096,3553,re,0,ye):o.framebufferTexture2D(36160,36096,3553,re,0);else if(E.depthTexture.format===gn)E.useRenderToTexture?d.framebufferTexture2DMultisampleEXT(36160,33306,3553,re,0,ye):o.framebufferTexture2D(36160,33306,3553,re,0);else throw new Error("Unknown depthTexture format")}function De(F){let E=i.get(F),Q=F.isWebGLCubeRenderTarget===!0;if(F.depthTexture&&!E.__autoAllocateDepthBuffer){if(Q)throw new Error("target.depthTexture not supported in Cube render targets");ue(E.__webglFramebuffer,F)}else if(Q){E.__webglDepthbuffer=[];for(let re=0;re<6;re++)t.bindFramebuffer(36160,E.__webglFramebuffer[re]),E.__webglDepthbuffer[re]=o.createRenderbuffer(),ze(E.__webglDepthbuffer[re],F,!1)}else t.bindFramebuffer(36160,E.__webglFramebuffer),E.__webglDepthbuffer=o.createRenderbuffer(),ze(E.__webglDepthbuffer,F,!1);t.bindFramebuffer(36160,null)}function Se(F,E,Q){let re=i.get(F);E!==void 0&&de(re.__webglFramebuffer,F,F.texture,36064,3553),Q!==void 0&&De(F)}function J(F){let E=F.texture,Q=i.get(F),re=i.get(E);F.addEventListener("dispose",w),F.isWebGLMultipleRenderTargets!==!0&&(re.__webglTexture===void 0&&(re.__webglTexture=o.createTexture()),re.__version=E.version,r.memory.textures++);let ye=F.isWebGLCubeRenderTarget===!0,$=F.isWebGLMultipleRenderTargets===!0,Me=E.isDataTexture3D||E.isDataTexture2DArray,we=z(F)||a;if(ye){Q.__webglFramebuffer=[];for(let he=0;he<6;he++)Q.__webglFramebuffer[he]=o.createFramebuffer()}else if(Q.__webglFramebuffer=o.createFramebuffer(),$)if(n.drawBuffers){let he=F.texture;for(let le=0,Ve=he.length;le<Ve;le++){let k=i.get(he[le]);k.__webglTexture===void 0&&(k.__webglTexture=o.createTexture(),r.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(F.useRenderbuffer)if(a){Q.__webglMultisampledFramebuffer=o.createFramebuffer(),Q.__webglColorRenderbuffer=o.createRenderbuffer(),o.bindRenderbuffer(36161,Q.__webglColorRenderbuffer);let he=s.convert(E.format,E.encoding),le=s.convert(E.type),Ve=_(E.internalFormat,he,le,E.encoding),k=ge(F);o.renderbufferStorageMultisample(36161,k,Ve,F.width,F.height),t.bindFramebuffer(36160,Q.__webglMultisampledFramebuffer),o.framebufferRenderbuffer(36160,36064,36161,Q.__webglColorRenderbuffer),o.bindRenderbuffer(36161,null),F.depthBuffer&&(Q.__webglDepthRenderbuffer=o.createRenderbuffer(),ze(Q.__webglDepthRenderbuffer,F,!0)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(ye){t.bindTexture(34067,re.__webglTexture),ne(34067,E,we);for(let he=0;he<6;he++)de(Q.__webglFramebuffer[he],F,E,36064,34069+he);b(E,we)&&S(34067),t.unbindTexture()}else if($){let he=F.texture;for(let le=0,Ve=he.length;le<Ve;le++){let k=he[le],ve=i.get(k);t.bindTexture(3553,ve.__webglTexture),ne(3553,k,we),de(Q.__webglFramebuffer,F,k,36064+le,3553),b(k,we)&&S(3553)}t.unbindTexture()}else{let he=3553;Me&&(a?he=E.isDataTexture3D?32879:35866:console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.")),t.bindTexture(he,re.__webglTexture),ne(he,E,we),de(Q.__webglFramebuffer,F,E,36064,he),b(E,we)&&S(he),t.unbindTexture()}F.depthBuffer&&De(F)}function se(F){let E=z(F)||a,Q=F.isWebGLMultipleRenderTargets===!0?F.texture:[F.texture];for(let re=0,ye=Q.length;re<ye;re++){let $=Q[re];if(b($,E)){let Me=F.isWebGLCubeRenderTarget?34067:3553,we=i.get($).__webglTexture;t.bindTexture(Me,we),S(Me),t.unbindTexture()}}}function ie(F){if(F.useRenderbuffer)if(a){let E=F.width,Q=F.height,re=16384,ye=[36064],$=F.stencilBuffer?33306:36096;F.depthBuffer&&ye.push($),F.ignoreDepthForMultisampleCopy||(F.depthBuffer&&(re|=256),F.stencilBuffer&&(re|=1024));let Me=i.get(F);t.bindFramebuffer(36008,Me.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,Me.__webglFramebuffer),F.ignoreDepthForMultisampleCopy&&(o.invalidateFramebuffer(36008,[$]),o.invalidateFramebuffer(36009,[$])),o.blitFramebuffer(0,0,E,Q,0,0,E,Q,re,9728),o.invalidateFramebuffer(36008,ye),t.bindFramebuffer(36008,null),t.bindFramebuffer(36009,Me.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")}function ge(F){return a&&(F.useRenderbuffer||F.useRenderToTexture)?Math.min(f,F.samples):0}function fe(F){let E=r.render.frame;p.get(F)!==E&&(p.set(F,E),F.update())}function _e(F,E){let Q=F.encoding,re=F.format,ye=F.type;return F.isCompressedTexture===!0||F.isVideoTexture===!0||F.format===zo||Q!==ei&&(Q===ot?a===!1?e.has("EXT_sRGB")===!0&&re===Ut?(F.format=zo,F.minFilter=Pt,F.generateMipmaps=!1):E=ii.sRGBToLinear(E):(re!==Ut||ye!==K2)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",Q)),E}let Te=!1,ke=!1;function Ke(F,E){F&&F.isWebGLRenderTarget&&(Te===!1&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),Te=!0),F=F.texture),N(F,E)}function Je(F,E){F&&F.isWebGLCubeRenderTarget&&(ke===!1&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),ke=!0),F=F.texture),O(F,E)}this.allocateTextureUnit=T,this.resetTextureUnits=H,this.setTexture2D=N,this.setTexture2DArray=I,this.setTexture3D=j,this.setTextureCube=O,this.rebindTextures=Se,this.setupRenderTarget=J,this.updateRenderTargetMipmap=se,this.updateMultisampleRenderTarget=ie,this.setupDepthRenderbuffer=De,this.setupFrameBufferTexture=de,this.safeSetTexture2D=Ke,this.safeSetTextureCube=Je}function gx(o,e,t){let i=t.isWebGL2;function n(s,r=null){let a;if(s===K2)return 5121;if(s===Md)return 32819;if(s===zd)return 32820;if(s===yd)return 5120;if(s===wd)return 5122;if(s===Ls)return 5123;if(s===bd)return 5124;if(s===ma)return 5125;if(s===Ti)return 5126;if(s===pn)return i?5131:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===Cd)return 6406;if(s===Ut)return 6408;if(s===Ad)return 6409;if(s===Sd)return 6410;if(s===Di)return 6402;if(s===gn)return 34041;if(s===_d)return 6403;if(s===zo)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===Ed)return 36244;if(s===Ld)return 33319;if(s===Td)return 33320;if(s===Dd)return 36249;if(s===go||s===vo||s===xo||s===yo)if(r===ot)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===go)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===vo)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===xo)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===yo)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===go)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===vo)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===xo)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===yo)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===B8||s===P8||s===I8||s===k8)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===B8)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===P8)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===I8)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===k8)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===Hd)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===O8||s===U8)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===O8)return r===ot?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===U8)return r===ot?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===G8||s===q8||s===W8||s===j8||s===Z8||s===X8||s===Y8||s===$8||s===J8||s===Q8||s===K8||s===e5||s===t5||s===i5)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===G8)return r===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===q8)return r===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===W8)return r===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===j8)return r===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===Z8)return r===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===X8)return r===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===Y8)return r===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===$8)return r===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===J8)return r===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===Q8)return r===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===K8)return r===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===e5)return r===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===t5)return r===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===i5)return r===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===n5)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===n5)return r===ot?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(s===mn)return i?34042:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null)}return{convert:n}}var o6=class extends Nt{constructor(e=[]){super();this.cameras=e}};o6.prototype.isArrayCamera=!0;var On=class extends We{constructor(){super();this.type="Group"}};On.prototype.isGroup=!0;var vx={type:"move"},Za=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new On,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new On,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new B,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new B),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new On,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new B,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new B),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let n=null,s=null,r=null,a=this._targetRay,c=this._grip,l=this._hand;if(e&&t.session.visibilityState!=="visible-blurred")if(a!==null&&(n=t.getPose(e.targetRaySpace,i),n!==null&&(a.matrix.fromArray(n.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),n.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(n.linearVelocity)):a.hasLinearVelocity=!1,n.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(n.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(vx))),l&&e.hand){r=!0;for(let v of e.hand.values()){let x=t.getJointPose(v,i);if(l.joints[v.jointName]===void 0){let m=new On;m.matrixAutoUpdate=!1,m.visible=!1,l.joints[v.jointName]=m,l.add(m)}let g=l.joints[v.jointName];x!==null&&(g.matrix.fromArray(x.transform.matrix),g.matrix.decompose(g.position,g.rotation,g.scale),g.jointRadius=x.radius),g.visible=x!==null}let h=l.joints["index-finger-tip"],f=l.joints["thumb-tip"],u=h.position.distanceTo(f.position),d=.02,p=.005;l.inputState.pinching&&u>d+p?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&u<=d-p&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1));return a!==null&&(a.visible=n!==null),c!==null&&(c.visible=s!==null),l!==null&&(l.visible=r!==null),this}},Xa=class extends vt{constructor(e,t,i,n,s,r,a,c,l,h){if(h=h!==void 0?h:Di,h!==Di&&h!==gn)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&h===Di&&(i=Ls),i===void 0&&h===gn&&(i=mn);super(null,n,s,r,a,c,h,i,l);this.image={width:e,height:t},this.magFilter=a!==void 0?a:At,this.minFilter=c!==void 0?c:At,this.flipY=!1,this.generateMipmaps=!1}};Xa.prototype.isDepthTexture=!0;var nl=class extends ti{constructor(e,t){super();let i=this,n=null,s=1,r=null,a="local-floor",c=e.extensions.has("WEBGL_multisampled_render_to_texture"),l=null,h=null,f=null,u=null,d=!1,p=null,v=t.getContextAttributes(),x=null,g=null,m=[],z=new Map,y=new Nt;y.layers.enable(1),y.viewport=new Qe;let b=new Nt;b.layers.enable(2),b.viewport=new Qe;let S=[y,b],_=new o6;_.layers.enable(1),_.layers.enable(2);let A=null,P=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(O){let q=m[O];return q===void 0&&(q=new Za,m[O]=q),q.getTargetRaySpace()},this.getControllerGrip=function(O){let q=m[O];return q===void 0&&(q=new Za,m[O]=q),q.getGripSpace()},this.getHand=function(O){let q=m[O];return q===void 0&&(q=new Za,m[O]=q),q.getHandSpace()};function R(O){let q=z.get(O.inputSource);q&&q.dispatchEvent({type:O.type,data:O.inputSource})}function w(){z.forEach(function(O,q){O.disconnect(q)}),z.clear(),A=null,P=null,e.setRenderTarget(x),u=null,f=null,h=null,n=null,g=null,j.stop(),i.isPresenting=!1,i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(O){s=O,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(O){a=O,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return r},this.getBaseLayer=function(){return f!==null?f:u},this.getBinding=function(){return h},this.getFrame=function(){return p},this.getSession=function(){return n},this.setSession=async function(O){if(n=O,n!==null){if(x=e.getRenderTarget(),n.addEventListener("select",R),n.addEventListener("selectstart",R),n.addEventListener("selectend",R),n.addEventListener("squeeze",R),n.addEventListener("squeezestart",R),n.addEventListener("squeezeend",R),n.addEventListener("end",w),n.addEventListener("inputsourceschange",D),v.xrCompatible!==!0&&await t.makeXRCompatible(),n.renderState.layers===void 0||e.capabilities.isWebGL2===!1){let q={antialias:n.renderState.layers===void 0?v.antialias:!0,alpha:v.alpha,depth:v.depth,stencil:v.stencil,framebufferScaleFactor:s};u=new XRWebGLLayer(n,t,q),n.updateRenderState({baseLayer:u}),g=new r1(u.framebufferWidth,u.framebufferHeight,{format:Ut,type:K2,encoding:e.outputEncoding})}else{d=v.antialias;let q=null,Z=null,ne=null;v.depth&&(ne=v.stencil?35056:33190,q=v.stencil?gn:Di,Z=v.stencil?mn:Ls);let ce={colorFormat:e.outputEncoding===ot?35907:32856,depthFormat:ne,scaleFactor:s};h=new XRWebGLBinding(n,t),f=h.createProjectionLayer(ce),n.updateRenderState({layers:[f]}),d?g=new ba(f.textureWidth,f.textureHeight,{format:Ut,type:K2,depthTexture:new Xa(f.textureWidth,f.textureHeight,Z,void 0,void 0,void 0,void 0,void 0,void 0,q),stencilBuffer:v.stencil,ignoreDepth:f.ignoreDepthValues,useRenderToTexture:c,encoding:e.outputEncoding}):g=new r1(f.textureWidth,f.textureHeight,{format:Ut,type:K2,depthTexture:new Xa(f.textureWidth,f.textureHeight,Z,void 0,void 0,void 0,void 0,void 0,void 0,q),stencilBuffer:v.stencil,ignoreDepth:f.ignoreDepthValues,encoding:e.outputEncoding})}g.isXRRenderTarget=!0,this.setFoveation(1),r=await n.requestReferenceSpace(a),j.setContext(n),j.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}};function D(O){let q=n.inputSources;for(let Z=0;Z<m.length;Z++)z.set(q[Z],m[Z]);for(let Z=0;Z<O.removed.length;Z++){let ne=O.removed[Z],ce=z.get(ne);ce&&(ce.dispatchEvent({type:"disconnected",data:ne}),z.delete(ne))}for(let Z=0;Z<O.added.length;Z++){let ne=O.added[Z],ce=z.get(ne);ce&&ce.dispatchEvent({type:"connected",data:ne})}}let C=new B,V=new B;function H(O,q,Z){C.setFromMatrixPosition(q.matrixWorld),V.setFromMatrixPosition(Z.matrixWorld);let ne=C.distanceTo(V),ce=q.projectionMatrix.elements,U=Z.projectionMatrix.elements,Le=ce[14]/(ce[10]-1),de=ce[14]/(ce[10]+1),ze=(ce[9]+1)/ce[5],ue=(ce[9]-1)/ce[5],De=(ce[8]-1)/ce[0],Se=(U[8]+1)/U[0],J=Le*De,se=Le*Se,ie=ne/(-De+Se),ge=ie*-De;q.matrixWorld.decompose(O.position,O.quaternion,O.scale),O.translateX(ge),O.translateZ(ie),O.matrixWorld.compose(O.position,O.quaternion,O.scale),O.matrixWorldInverse.copy(O.matrixWorld).invert();let fe=Le+ie,_e=de+ie,Te=J-ge,ke=se+(ne-ge),Ke=ze*de/_e*fe,Je=ue*de/_e*fe;O.projectionMatrix.makePerspective(Te,ke,Ke,Je,fe,_e)}function T(O,q){q===null?O.matrixWorld.copy(O.matrix):O.matrixWorld.multiplyMatrices(q.matrixWorld,O.matrix),O.matrixWorldInverse.copy(O.matrixWorld).invert()}this.updateCamera=function(O){if(n===null)return;_.near=b.near=y.near=O.near,_.far=b.far=y.far=O.far,(A!==_.near||P!==_.far)&&(n.updateRenderState({depthNear:_.near,depthFar:_.far}),A=_.near,P=_.far);let q=O.parent,Z=_.cameras;T(_,q);for(let ce=0;ce<Z.length;ce++)T(Z[ce],q);_.matrixWorld.decompose(_.position,_.quaternion,_.scale),O.position.copy(_.position),O.quaternion.copy(_.quaternion),O.scale.copy(_.scale),O.matrix.copy(_.matrix),O.matrixWorld.copy(_.matrixWorld);let ne=O.children;for(let ce=0,U=ne.length;ce<U;ce++)ne[ce].updateMatrixWorld(!0);Z.length===2?H(_,y,b):_.projectionMatrix.copy(y.projectionMatrix)},this.getCamera=function(){return _},this.getFoveation=function(){if(f!==null)return f.fixedFoveation;if(u!==null)return u.fixedFoveation},this.setFoveation=function(O){f!==null&&(f.fixedFoveation=O),u!==null&&u.fixedFoveation!==void 0&&(u.fixedFoveation=O)};let N=null;function I(O,q){if(l=q.getViewerPose(r),p=q,l!==null){let ne=l.views;u!==null&&(e.setRenderTargetFramebuffer(g,u.framebuffer),e.setRenderTarget(g));let ce=!1;ne.length!==_.cameras.length&&(_.cameras.length=0,ce=!0);for(let U=0;U<ne.length;U++){let Le=ne[U],de=null;if(u!==null)de=u.getViewport(Le);else{let ue=h.getViewSubImage(f,Le);de=ue.viewport,U===0&&(e.setRenderTargetTextures(g,ue.colorTexture,f.ignoreDepthValues?void 0:ue.depthStencilTexture),e.setRenderTarget(g))}let ze=S[U];ze.matrix.fromArray(Le.transform.matrix),ze.projectionMatrix.fromArray(Le.projectionMatrix),ze.viewport.set(de.x,de.y,de.width,de.height),U===0&&_.matrix.copy(ze.matrix),ce===!0&&_.cameras.push(ze)}}let Z=n.inputSources;for(let ne=0;ne<m.length;ne++){let ce=m[ne],U=Z[ne];ce.update(U,q,r)}N&&N(O,q),p=null}let j=new M5;j.setAnimationLoop(I),this.setAnimationLoop=function(O){N=O},this.dispose=function(){}}};function xx(o){function e(g,m){g.fogColor.value.copy(m.color),m.isFog?(g.fogNear.value=m.near,g.fogFar.value=m.far):m.isFogExp2&&(g.fogDensity.value=m.density)}function t(g,m,z,y,b){m.isMeshBasicMaterial?i(g,m):m.isMeshLambertMaterial?(i(g,m),c(g,m)):m.isMeshToonMaterial?(i(g,m),h(g,m)):m.isMeshPhongMaterial?(i(g,m),l(g,m)):m.isMeshStandardMaterial?(i(g,m),m.isMeshPhysicalMaterial?u(g,m,b):f(g,m)):m.isMeshMatcapMaterial?(i(g,m),d(g,m)):m.isMeshDepthMaterial?(i(g,m),p(g,m)):m.isMeshDistanceMaterial?(i(g,m),v(g,m)):m.isMeshNormalMaterial?(i(g,m),x(g,m)):m.isLineBasicMaterial?(n(g,m),m.isLineDashedMaterial&&s(g,m)):m.isPointsMaterial?r(g,m,z,y):m.isSpriteMaterial?a(g,m):m.isShadowMaterial?(g.color.value.copy(m.color),g.opacity.value=m.opacity):m.isShaderMaterial&&(m.uniformsNeedUpdate=!1)}function i(g,m){g.opacity.value=m.opacity,m.color&&g.diffuse.value.copy(m.color),m.emissive&&g.emissive.value.copy(m.emissive).multiplyScalar(m.emissiveIntensity),m.map&&(g.map.value=m.map),m.alphaMap&&(g.alphaMap.value=m.alphaMap),m.specularMap&&(g.specularMap.value=m.specularMap),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest);let z=o.get(m).envMap;z&&(g.envMap.value=z,g.flipEnvMap.value=z.isCubeTexture&&z.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=m.reflectivity,g.ior.value=m.ior,g.refractionRatio.value=m.refractionRatio),m.lightMap&&(g.lightMap.value=m.lightMap,g.lightMapIntensity.value=m.lightMapIntensity),m.aoMap&&(g.aoMap.value=m.aoMap,g.aoMapIntensity.value=m.aoMapIntensity);let y;m.map?y=m.map:m.specularMap?y=m.specularMap:m.displacementMap?y=m.displacementMap:m.normalMap?y=m.normalMap:m.bumpMap?y=m.bumpMap:m.roughnessMap?y=m.roughnessMap:m.metalnessMap?y=m.metalnessMap:m.alphaMap?y=m.alphaMap:m.emissiveMap?y=m.emissiveMap:m.clearcoatMap?y=m.clearcoatMap:m.clearcoatNormalMap?y=m.clearcoatNormalMap:m.clearcoatRoughnessMap?y=m.clearcoatRoughnessMap:m.specularIntensityMap?y=m.specularIntensityMap:m.specularColorMap?y=m.specularColorMap:m.transmissionMap?y=m.transmissionMap:m.thicknessMap?y=m.thicknessMap:m.sheenColorMap?y=m.sheenColorMap:m.sheenRoughnessMap&&(y=m.sheenRoughnessMap),y!==void 0&&(y.isWebGLRenderTarget&&(y=y.texture),y.matrixAutoUpdate===!0&&y.updateMatrix(),g.uvTransform.value.copy(y.matrix));let b;m.aoMap?b=m.aoMap:m.lightMap&&(b=m.lightMap),b!==void 0&&(b.isWebGLRenderTarget&&(b=b.texture),b.matrixAutoUpdate===!0&&b.updateMatrix(),g.uv2Transform.value.copy(b.matrix))}function n(g,m){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity}function s(g,m){g.dashSize.value=m.dashSize,g.totalSize.value=m.dashSize+m.gapSize,g.scale.value=m.scale}function r(g,m,z,y){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,g.size.value=m.size*z,g.scale.value=y*.5,m.map&&(g.map.value=m.map),m.alphaMap&&(g.alphaMap.value=m.alphaMap),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest);let b;m.map?b=m.map:m.alphaMap&&(b=m.alphaMap),b!==void 0&&(b.matrixAutoUpdate===!0&&b.updateMatrix(),g.uvTransform.value.copy(b.matrix))}function a(g,m){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,g.rotation.value=m.rotation,m.map&&(g.map.value=m.map),m.alphaMap&&(g.alphaMap.value=m.alphaMap),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest);let z;m.map?z=m.map:m.alphaMap&&(z=m.alphaMap),z!==void 0&&(z.matrixAutoUpdate===!0&&z.updateMatrix(),g.uvTransform.value.copy(z.matrix))}function c(g,m){m.emissiveMap&&(g.emissiveMap.value=m.emissiveMap)}function l(g,m){g.specular.value.copy(m.specular),g.shininess.value=Math.max(m.shininess,1e-4),m.emissiveMap&&(g.emissiveMap.value=m.emissiveMap),m.bumpMap&&(g.bumpMap.value=m.bumpMap,g.bumpScale.value=m.bumpScale,m.side===Ct&&(g.bumpScale.value*=-1)),m.normalMap&&(g.normalMap.value=m.normalMap,g.normalScale.value.copy(m.normalScale),m.side===Ct&&g.normalScale.value.negate()),m.displacementMap&&(g.displacementMap.value=m.displacementMap,g.displacementScale.value=m.displacementScale,g.displacementBias.value=m.displacementBias)}function h(g,m){m.gradientMap&&(g.gradientMap.value=m.gradientMap),m.emissiveMap&&(g.emissiveMap.value=m.emissiveMap),m.bumpMap&&(g.bumpMap.value=m.bumpMap,g.bumpScale.value=m.bumpScale,m.side===Ct&&(g.bumpScale.value*=-1)),m.normalMap&&(g.normalMap.value=m.normalMap,g.normalScale.value.copy(m.normalScale),m.side===Ct&&g.normalScale.value.negate()),m.displacementMap&&(g.displacementMap.value=m.displacementMap,g.displacementScale.value=m.displacementScale,g.displacementBias.value=m.displacementBias)}function f(g,m){g.roughness.value=m.roughness,g.metalness.value=m.metalness,m.roughnessMap&&(g.roughnessMap.value=m.roughnessMap),m.metalnessMap&&(g.metalnessMap.value=m.metalnessMap),m.emissiveMap&&(g.emissiveMap.value=m.emissiveMap),m.bumpMap&&(g.bumpMap.value=m.bumpMap,g.bumpScale.value=m.bumpScale,m.side===Ct&&(g.bumpScale.value*=-1)),m.normalMap&&(g.normalMap.value=m.normalMap,g.normalScale.value.copy(m.normalScale),m.side===Ct&&g.normalScale.value.negate()),m.displacementMap&&(g.displacementMap.value=m.displacementMap,g.displacementScale.value=m.displacementScale,g.displacementBias.value=m.displacementBias),o.get(m).envMap&&(g.envMapIntensity.value=m.envMapIntensity)}function u(g,m,z){f(g,m),g.ior.value=m.ior,m.sheen>0&&(g.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),g.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(g.sheenColorMap.value=m.sheenColorMap),m.sheenRoughnessMap&&(g.sheenRoughnessMap.value=m.sheenRoughnessMap)),m.clearcoat>0&&(g.clearcoat.value=m.clearcoat,g.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(g.clearcoatMap.value=m.clearcoatMap),m.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap),m.clearcoatNormalMap&&(g.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),g.clearcoatNormalMap.value=m.clearcoatNormalMap,m.side===Ct&&g.clearcoatNormalScale.value.negate())),m.transmission>0&&(g.transmission.value=m.transmission,g.transmissionSamplerMap.value=z.texture,g.transmissionSamplerSize.value.set(z.width,z.height),m.transmissionMap&&(g.transmissionMap.value=m.transmissionMap),g.thickness.value=m.thickness,m.thicknessMap&&(g.thicknessMap.value=m.thicknessMap),g.attenuationDistance.value=m.attenuationDistance,g.attenuationColor.value.copy(m.attenuationColor)),g.specularIntensity.value=m.specularIntensity,g.specularColor.value.copy(m.specularColor),m.specularIntensityMap&&(g.specularIntensityMap.value=m.specularIntensityMap),m.specularColorMap&&(g.specularColorMap.value=m.specularColorMap)}function d(g,m){m.matcap&&(g.matcap.value=m.matcap),m.bumpMap&&(g.bumpMap.value=m.bumpMap,g.bumpScale.value=m.bumpScale,m.side===Ct&&(g.bumpScale.value*=-1)),m.normalMap&&(g.normalMap.value=m.normalMap,g.normalScale.value.copy(m.normalScale),m.side===Ct&&g.normalScale.value.negate()),m.displacementMap&&(g.displacementMap.value=m.displacementMap,g.displacementScale.value=m.displacementScale,g.displacementBias.value=m.displacementBias)}function p(g,m){m.displacementMap&&(g.displacementMap.value=m.displacementMap,g.displacementScale.value=m.displacementScale,g.displacementBias.value=m.displacementBias)}function v(g,m){m.displacementMap&&(g.displacementMap.value=m.displacementMap,g.displacementScale.value=m.displacementScale,g.displacementBias.value=m.displacementBias),g.referencePosition.value.copy(m.referencePosition),g.nearDistance.value=m.nearDistance,g.farDistance.value=m.farDistance}function x(g,m){m.bumpMap&&(g.bumpMap.value=m.bumpMap,g.bumpScale.value=m.bumpScale,m.side===Ct&&(g.bumpScale.value*=-1)),m.normalMap&&(g.normalMap.value=m.normalMap,g.normalScale.value.copy(m.normalScale),m.side===Ct&&g.normalScale.value.negate()),m.displacementMap&&(g.displacementMap.value=m.displacementMap,g.displacementScale.value=m.displacementScale,g.displacementBias.value=m.displacementBias)}return{refreshFogUniforms:e,refreshMaterialUniforms:t}}function yx(){let o=Ds("canvas");return o.style.display="block",o}function Ye(o={}){let e=o.canvas!==void 0?o.canvas:yx(),t=o.context!==void 0?o.context:null,i=o.alpha!==void 0?o.alpha:!1,n=o.depth!==void 0?o.depth:!0,s=o.stencil!==void 0?o.stencil:!0,r=o.antialias!==void 0?o.antialias:!1,a=o.premultipliedAlpha!==void 0?o.premultipliedAlpha:!0,c=o.preserveDrawingBuffer!==void 0?o.preserveDrawingBuffer:!1,l=o.powerPreference!==void 0?o.powerPreference:"default",h=o.failIfMajorPerformanceCaveat!==void 0?o.failIfMajorPerformanceCaveat:!1,f=null,u=null,d=[],p=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=ei,this.physicallyCorrectLights=!1,this.toneMapping=Q2,this.toneMappingExposure=1;let v=this,x=!1,g=0,m=0,z=null,y=-1,b=null,S=new Qe,_=new Qe,A=null,P=e.width,R=e.height,w=1,D=null,C=null,V=new Qe(0,0,P,R),H=new Qe(0,0,P,R),T=!1,N=new Fs,I=!1,j=!1,O=null,q=new Ce,Z=new B,ne={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function ce(){return z===null?w:1}let U=t;function Le(L,G){for(let X=0;X<L.length;X++){let W=L[X],ee=e.getContext(W,G);if(ee!==null)return ee}return null}try{let L={alpha:!0,depth:n,stencil:s,antialias:r,premultipliedAlpha:a,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:h};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${oo}`),e.addEventListener("webglcontextlost",Ve,!1),e.addEventListener("webglcontextrestored",k,!1),U===null){let G=["webgl2","webgl","experimental-webgl"];if(v.isWebGL1Renderer===!0&&G.shift(),U=Le(G,L),U===null)throw Le(G)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}U.getShaderPrecisionFormat===void 0&&(U.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(L){throw console.error("THREE.WebGLRenderer: "+L.message),L}let de,ze,ue,De,Se,J,se,ie,ge,fe,_e,Te,ke,Ke,Je,F,E,Q,re,ye,$,Me,we;function he(){de=new Og(U),ze=new Ng(U,de,o),de.init(ze),Me=new gx(U,de,ze),ue=new px(U,de,ze),De=new qg(U),Se=new nx,J=new mx(U,de,ue,Se,ze,Me,De),se=new Bg(v),ie=new kg(v),ge=new rp(U,ze),we=new Vg(U,de,ge,ze),fe=new Ug(U,ge,De,we),_e=new Xg(U,fe,ge,De),re=new Zg(U,ze,J),F=new Fg(Se),Te=new ix(v,se,ie,de,ze,we,F),ke=new xx(Se),Ke=new rx,Je=new ux(de,ze),Q=new Hg(v,se,ue,_e,i,a),E=new il(v,_e,ze),ye=new Rg(U,de,De,ze),$=new Gg(U,de,De,ze),De.programs=Te.programs,v.capabilities=ze,v.extensions=de,v.properties=Se,v.renderLists=Ke,v.shadowMap=E,v.state=ue,v.info=De}he();let le=new nl(v,U);this.xr=le,this.getContext=function(){return U},this.getContextAttributes=function(){return U.getContextAttributes()},this.forceContextLoss=function(){let L=de.get("WEBGL_lose_context");L&&L.loseContext()},this.forceContextRestore=function(){let L=de.get("WEBGL_lose_context");L&&L.restoreContext()},this.getPixelRatio=function(){return w},this.setPixelRatio=function(L){L!==void 0&&(w=L,this.setSize(P,R,!1))},this.getSize=function(L){return L.set(P,R)},this.setSize=function(L,G,X){if(le.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}P=L,R=G,e.width=Math.floor(L*w),e.height=Math.floor(G*w),X!==!1&&(e.style.width=L+"px",e.style.height=G+"px"),this.setViewport(0,0,L,G)},this.getDrawingBufferSize=function(L){return L.set(P*w,R*w).floor()},this.setDrawingBufferSize=function(L,G,X){P=L,R=G,w=X,e.width=Math.floor(L*X),e.height=Math.floor(G*X),this.setViewport(0,0,L,G)},this.getCurrentViewport=function(L){return L.copy(S)},this.getViewport=function(L){return L.copy(V)},this.setViewport=function(L,G,X,W){L.isVector4?V.set(L.x,L.y,L.z,L.w):V.set(L,G,X,W),ue.viewport(S.copy(V).multiplyScalar(w).floor())},this.getScissor=function(L){return L.copy(H)},this.setScissor=function(L,G,X,W){L.isVector4?H.set(L.x,L.y,L.z,L.w):H.set(L,G,X,W),ue.scissor(_.copy(H).multiplyScalar(w).floor())},this.getScissorTest=function(){return T},this.setScissorTest=function(L){ue.setScissorTest(T=L)},this.setOpaqueSort=function(L){D=L},this.setTransparentSort=function(L){C=L},this.getClearColor=function(L){return L.copy(Q.getClearColor())},this.setClearColor=function(){Q.setClearColor.apply(Q,arguments)},this.getClearAlpha=function(){return Q.getClearAlpha()},this.setClearAlpha=function(){Q.setClearAlpha.apply(Q,arguments)},this.clear=function(L,G,X){let W=0;(L===void 0||L)&&(W|=16384),(G===void 0||G)&&(W|=256),(X===void 0||X)&&(W|=1024),U.clear(W)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",Ve,!1),e.removeEventListener("webglcontextrestored",k,!1),Ke.dispose(),Je.dispose(),Se.dispose(),se.dispose(),ie.dispose(),_e.dispose(),we.dispose(),Te.dispose(),le.dispose(),le.removeEventListener("sessionstart",Ie),le.removeEventListener("sessionend",lt),O&&(O.dispose(),O=null),Qt.stop()};function Ve(L){L.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),x=!0}function k(){console.log("THREE.WebGLRenderer: Context Restored."),x=!1;let L=De.autoReset,G=E.enabled,X=E.autoUpdate,W=E.needsUpdate,ee=E.type;he(),De.autoReset=L,E.enabled=G,E.autoUpdate=X,E.needsUpdate=W,E.type=ee}function ve(L){let G=L.target;G.removeEventListener("dispose",ve),pe(G)}function pe(L){Ee(L),Se.remove(L)}function Ee(L){let G=Se.get(L).programs;G!==void 0&&(G.forEach(function(X){Te.releaseProgram(X)}),L.isShaderMaterial&&Te.releaseShaderCache(L))}this.renderBufferDirect=function(L,G,X,W,ee,He){G===null&&(G=ne);let Re=ee.isMesh&&ee.matrixWorld.determinant()<0,Fe=Kh(L,G,X,W,ee);ue.setMaterial(W,Re);let Ne=X.index,$e=X.attributes.position;if(Ne===null){if($e===void 0||$e.count===0)return}else if(Ne.count===0)return;let Oe=1;W.wireframe===!0&&(Ne=fe.getWireframeAttribute(X),Oe=2),we.setup(ee,W,Fe,X,Ne);let Ge,dt=ye;Ne!==null&&(Ge=ge.get(Ne),dt=$,dt.setIndex(Ge));let gi=Ne!==null?Ne.count:$e.count,Wi=X.drawRange.start*Oe,je=X.drawRange.count*Oe,D1=He!==null?He.start*Oe:0,bt=He!==null?He.count*Oe:1/0,H1=Math.max(Wi,D1),ir=Math.min(gi,Wi+je,D1+bt)-1,V1=Math.max(0,ir-H1+1);if(V1!==0){if(ee.isMesh)W.wireframe===!0?(ue.setLineWidth(W.wireframeLinewidth*ce()),dt.setMode(1)):dt.setMode(4);else if(ee.isLine){let $1=W.linewidth;$1===void 0&&($1=1),ue.setLineWidth($1*ce()),ee.isLineSegments?dt.setMode(1):ee.isLineLoop?dt.setMode(2):dt.setMode(3)}else ee.isPoints?dt.setMode(0):ee.isSprite&&dt.setMode(4);if(ee.isInstancedMesh)dt.renderInstances(H1,V1,ee.count);else if(X.isInstancedBufferGeometry){let $1=Math.min(X.instanceCount,X._maxInstanceCount);dt.renderInstances(H1,V1,$1)}else dt.render(H1,V1)}},this.compile=function(L,G){u=Je.get(L),u.init(),p.push(u),L.traverseVisible(function(X){X.isLight&&X.layers.test(G.layers)&&(u.pushLight(X),X.castShadow&&u.pushShadow(X))}),u.setupLights(v.physicallyCorrectLights),L.traverse(function(X){let W=X.material;if(W)if(Array.isArray(W))for(let ee=0;ee<W.length;ee++){let He=W[ee];L4(He,L,X)}else L4(W,L,X)}),p.pop(),u=null};let K=null;function Ae(L){K&&K(L)}function Ie(){Qt.stop()}function lt(){Qt.start()}let Qt=new M5;Qt.setAnimationLoop(Ae),typeof window!="undefined"&&Qt.setContext(window),this.setAnimationLoop=function(L){K=L,le.setAnimationLoop(L),L===null?Qt.stop():Qt.start()},le.addEventListener("sessionstart",Ie),le.addEventListener("sessionend",lt),this.render=function(L,G){if(G!==void 0&&G.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(x===!0)return;L.autoUpdate===!0&&L.updateMatrixWorld(),G.parent===null&&G.updateMatrixWorld(),le.enabled===!0&&le.isPresenting===!0&&(le.cameraAutoUpdate===!0&&le.updateCamera(G),G=le.getCamera()),L.isScene===!0&&L.onBeforeRender(v,L,G,z),u=Je.get(L,p.length),u.init(),p.push(u),q.multiplyMatrices(G.projectionMatrix,G.matrixWorldInverse),N.setFromProjectionMatrix(q),j=this.localClippingEnabled,I=F.init(this.clippingPlanes,j,G),f=Ke.get(L,d.length),f.init(),d.push(f),ft(L,G,0,v.sortObjects),f.finish(),v.sortObjects===!0&&f.sort(D,C),I===!0&&F.beginShadows();let X=u.state.shadowsArray;if(E.render(X,L,G),I===!0&&F.endShadows(),this.info.autoReset===!0&&this.info.reset(),Q.render(f,L),u.setupLights(v.physicallyCorrectLights),G.isArrayCamera){let W=G.cameras;for(let ee=0,He=W.length;ee<He;ee++){let Re=W[ee];T1(f,L,Re,Re.viewport)}}else T1(f,L,G);z!==null&&(J.updateMultisampleRenderTarget(z),J.updateRenderTargetMipmap(z)),L.isScene===!0&&L.onAfterRender(v,L,G),ue.buffers.depth.setTest(!0),ue.buffers.depth.setMask(!0),ue.buffers.color.setMask(!0),ue.setPolygonOffset(!1),we.resetDefaultState(),y=-1,b=null,p.pop(),p.length>0?u=p[p.length-1]:u=null,d.pop(),d.length>0?f=d[d.length-1]:f=null};function ft(L,G,X,W){if(L.visible===!1)return;if(L.layers.test(G.layers)){if(L.isGroup)X=L.renderOrder;else if(L.isLOD)L.autoUpdate===!0&&L.update(G);else if(L.isLight)u.pushLight(L),L.castShadow&&u.pushShadow(L);else if(L.isSprite){if(!L.frustumCulled||N.intersectsSprite(L)){W&&Z.setFromMatrixPosition(L.matrixWorld).applyMatrix4(q);let Re=_e.update(L),Fe=L.material;Fe.visible&&f.push(L,Re,Fe,X,Z.z,null)}}else if((L.isMesh||L.isLine||L.isPoints)&&(L.isSkinnedMesh&&L.skeleton.frame!==De.render.frame&&(L.skeleton.update(),L.skeleton.frame=De.render.frame),!L.frustumCulled||N.intersectsObject(L))){W&&Z.setFromMatrixPosition(L.matrixWorld).applyMatrix4(q);let Re=_e.update(L),Fe=L.material;if(Array.isArray(Fe)){let Ne=Re.groups;for(let $e=0,Oe=Ne.length;$e<Oe;$e++){let Ge=Ne[$e],dt=Fe[Ge.materialIndex];dt&&dt.visible&&f.push(L,Re,dt,X,Z.z,Ge)}}else Fe.visible&&f.push(L,Re,Fe,X,Z.z,null)}}let He=L.children;for(let Re=0,Fe=He.length;Re<Fe;Re++)ft(He[Re],G,X,W)}function T1(L,G,X,W){let ee=L.opaque,He=L.transmissive,Re=L.transparent;u.setupLightsView(X),He.length>0&&Y1(ee,G,X),W&&ue.viewport(S.copy(W)),ee.length>0&&tr(ee,G,X),He.length>0&&tr(He,G,X),Re.length>0&&tr(Re,G,X)}function Y1(L,G,X){if(O===null){let Re=r===!0&&ze.isWebGL2===!0?ba:r1;O=new Re(1024,1024,{generateMipmaps:!0,type:Me.convert(pn)!==null?pn:K2,minFilter:pa,magFilter:At,wrapS:s1,wrapT:s1,useRenderToTexture:de.has("WEBGL_multisampled_render_to_texture")})}let W=v.getRenderTarget();v.setRenderTarget(O),v.clear();let ee=v.toneMapping;v.toneMapping=Q2,tr(L,G,X),v.toneMapping=ee,J.updateMultisampleRenderTarget(O),J.updateRenderTargetMipmap(O),v.setRenderTarget(W)}function tr(L,G,X){let W=G.isScene===!0?G.overrideMaterial:null;for(let ee=0,He=L.length;ee<He;ee++){let Re=L[ee],Fe=Re.object,Ne=Re.geometry,$e=W===null?Re.material:W,Oe=Re.group;Fe.layers.test(X.layers)&&Qh(Fe,G,X,Ne,$e,Oe)}}function Qh(L,G,X,W,ee,He){L.onBeforeRender(v,G,X,W,ee,He),L.modelViewMatrix.multiplyMatrices(X.matrixWorldInverse,L.matrixWorld),L.normalMatrix.getNormalMatrix(L.modelViewMatrix),ee.onBeforeRender(v,G,X,W,L,He),ee.transparent===!0&&ee.side===fn?(ee.side=Ct,ee.needsUpdate=!0,v.renderBufferDirect(X,G,W,ee,L,He),ee.side=As,ee.needsUpdate=!0,v.renderBufferDirect(X,G,W,ee,L,He),ee.side=fn):v.renderBufferDirect(X,G,W,ee,L,He),L.onAfterRender(v,G,X,W,ee,He)}function L4(L,G,X){G.isScene!==!0&&(G=ne);let W=Se.get(L),ee=u.state.lights,He=u.state.shadowsArray,Re=ee.state.version,Fe=Te.getParameters(L,ee.state,He,G,X),Ne=Te.getProgramCacheKey(Fe),$e=W.programs;W.environment=L.isMeshStandardMaterial?G.environment:null,W.fog=G.fog,W.envMap=(L.isMeshStandardMaterial?ie:se).get(L.envMap||W.environment),$e===void 0&&(L.addEventListener("dispose",ve),$e=new Map,W.programs=$e);let Oe=$e.get(Ne);if(Oe!==void 0){if(W.currentProgram===Oe&&W.lightsStateVersion===Re)return j6(L,Fe),Oe}else Fe.uniforms=Te.getUniforms(L),L.onBuild(X,Fe,v),L.onBeforeCompile(Fe,v),Oe=Te.acquireProgram(Fe,Ne),$e.set(Ne,Oe),W.uniforms=Fe.uniforms;let Ge=W.uniforms;(!L.isShaderMaterial&&!L.isRawShaderMaterial||L.clipping===!0)&&(Ge.clippingPlanes=F.uniform),j6(L,Fe),W.needsLights=t7(L),W.lightsStateVersion=Re,W.needsLights&&(Ge.ambientLightColor.value=ee.state.ambient,Ge.lightProbe.value=ee.state.probe,Ge.directionalLights.value=ee.state.directional,Ge.directionalLightShadows.value=ee.state.directionalShadow,Ge.spotLights.value=ee.state.spot,Ge.spotLightShadows.value=ee.state.spotShadow,Ge.rectAreaLights.value=ee.state.rectArea,Ge.ltc_1.value=ee.state.rectAreaLTC1,Ge.ltc_2.value=ee.state.rectAreaLTC2,Ge.pointLights.value=ee.state.point,Ge.pointLightShadows.value=ee.state.pointShadow,Ge.hemisphereLights.value=ee.state.hemi,Ge.directionalShadowMap.value=ee.state.directionalShadowMap,Ge.directionalShadowMatrix.value=ee.state.directionalShadowMatrix,Ge.spotShadowMap.value=ee.state.spotShadowMap,Ge.spotShadowMatrix.value=ee.state.spotShadowMatrix,Ge.pointShadowMap.value=ee.state.pointShadowMap,Ge.pointShadowMatrix.value=ee.state.pointShadowMatrix);let dt=Oe.getUniforms(),gi=fi.seqWithValue(dt.seq,Ge);return W.currentProgram=Oe,W.uniformsList=gi,Oe}function j6(L,G){let X=Se.get(L);X.outputEncoding=G.outputEncoding,X.instancing=G.instancing,X.skinning=G.skinning,X.morphTargets=G.morphTargets,X.morphNormals=G.morphNormals,X.morphTargetsCount=G.morphTargetsCount,X.numClippingPlanes=G.numClippingPlanes,X.numIntersection=G.numClipIntersection,X.vertexAlphas=G.vertexAlphas,X.vertexTangents=G.vertexTangents,X.toneMapping=G.toneMapping}function Kh(L,G,X,W,ee){G.isScene!==!0&&(G=ne),J.resetTextureUnits();let He=G.fog,Re=W.isMeshStandardMaterial?G.environment:null,Fe=z===null?v.outputEncoding:z.isXRRenderTarget===!0?z.texture.encoding:ei,Ne=(W.isMeshStandardMaterial?ie:se).get(W.envMap||Re),$e=W.vertexColors===!0&&!!X.attributes.color&&X.attributes.color.itemSize===4,Oe=!!W.normalMap&&!!X.attributes.tangent,Ge=!!X.morphAttributes.position,dt=!!X.morphAttributes.normal,gi=X.morphAttributes.position?X.morphAttributes.position.length:0,Wi=W.toneMapped?v.toneMapping:Q2,je=Se.get(W),D1=u.state.lights;if(I===!0&&(j===!0||L!==b)){let p1=L===b&&W.id===y;F.setState(W,L,p1)}let bt=!1;W.version===je.__version?(je.needsLights&&je.lightsStateVersion!==D1.state.version||je.outputEncoding!==Fe||ee.isInstancedMesh&&je.instancing===!1||!ee.isInstancedMesh&&je.instancing===!0||ee.isSkinnedMesh&&je.skinning===!1||!ee.isSkinnedMesh&&je.skinning===!0||je.envMap!==Ne||W.fog&&je.fog!==He||je.numClippingPlanes!==void 0&&(je.numClippingPlanes!==F.numPlanes||je.numIntersection!==F.numIntersection)||je.vertexAlphas!==$e||je.vertexTangents!==Oe||je.morphTargets!==Ge||je.morphNormals!==dt||je.toneMapping!==Wi||ze.isWebGL2===!0&&je.morphTargetsCount!==gi)&&(bt=!0):(bt=!0,je.__version=W.version);let H1=je.currentProgram;bt===!0&&(H1=L4(W,G,ee));let ir=!1,V1=!1,$1=!1,Ft=H1.getUniforms(),ns=je.uniforms;if(ue.useProgram(H1.program)&&(ir=!0,V1=!0,$1=!0),W.id!==y&&(y=W.id,V1=!0),ir||b!==L){if(Ft.setValue(U,"projectionMatrix",L.projectionMatrix),ze.logarithmicDepthBuffer&&Ft.setValue(U,"logDepthBufFC",2/(Math.log(L.far+1)/Math.LN2)),b!==L&&(b=L,V1=!0,$1=!0),W.isShaderMaterial||W.isMeshPhongMaterial||W.isMeshToonMaterial||W.isMeshStandardMaterial||W.envMap){let p1=Ft.map.cameraPosition;p1!==void 0&&p1.setValue(U,Z.setFromMatrixPosition(L.matrixWorld))}(W.isMeshPhongMaterial||W.isMeshToonMaterial||W.isMeshLambertMaterial||W.isMeshBasicMaterial||W.isMeshStandardMaterial||W.isShaderMaterial)&&Ft.setValue(U,"isOrthographic",L.isOrthographicCamera===!0),(W.isMeshPhongMaterial||W.isMeshToonMaterial||W.isMeshLambertMaterial||W.isMeshBasicMaterial||W.isMeshStandardMaterial||W.isShaderMaterial||W.isShadowMaterial||ee.isSkinnedMesh)&&Ft.setValue(U,"viewMatrix",L.matrixWorldInverse)}if(ee.isSkinnedMesh){Ft.setOptional(U,ee,"bindMatrix"),Ft.setOptional(U,ee,"bindMatrixInverse");let p1=ee.skeleton;p1&&(ze.floatVertexTextures?(p1.boneTexture===null&&p1.computeBoneTexture(),Ft.setValue(U,"boneTexture",p1.boneTexture,J),Ft.setValue(U,"boneTextureSize",p1.boneTextureSize)):Ft.setOptional(U,p1,"boneMatrices"))}return!!X&&(X.morphAttributes.position!==void 0||X.morphAttributes.normal!==void 0)&&re.update(ee,X,W,H1),(V1||je.receiveShadow!==ee.receiveShadow)&&(je.receiveShadow=ee.receiveShadow,Ft.setValue(U,"receiveShadow",ee.receiveShadow)),V1&&(Ft.setValue(U,"toneMappingExposure",v.toneMappingExposure),je.needsLights&&e7(ns,$1),He&&W.fog&&ke.refreshFogUniforms(ns,He),ke.refreshMaterialUniforms(ns,W,w,R,O),fi.upload(U,je.uniformsList,ns,J)),W.isShaderMaterial&&W.uniformsNeedUpdate===!0&&(fi.upload(U,je.uniformsList,ns,J),W.uniformsNeedUpdate=!1),W.isSpriteMaterial&&Ft.setValue(U,"center",ee.center),Ft.setValue(U,"modelViewMatrix",ee.modelViewMatrix),Ft.setValue(U,"normalMatrix",ee.normalMatrix),Ft.setValue(U,"modelMatrix",ee.matrixWorld),H1}function e7(L,G){L.ambientLightColor.needsUpdate=G,L.lightProbe.needsUpdate=G,L.directionalLights.needsUpdate=G,L.directionalLightShadows.needsUpdate=G,L.pointLights.needsUpdate=G,L.pointLightShadows.needsUpdate=G,L.spotLights.needsUpdate=G,L.spotLightShadows.needsUpdate=G,L.rectAreaLights.needsUpdate=G,L.hemisphereLights.needsUpdate=G}function t7(L){return L.isMeshLambertMaterial||L.isMeshToonMaterial||L.isMeshPhongMaterial||L.isMeshStandardMaterial||L.isShadowMaterial||L.isShaderMaterial&&L.lights===!0}this.getActiveCubeFace=function(){return g},this.getActiveMipmapLevel=function(){return m},this.getRenderTarget=function(){return z},this.setRenderTargetTextures=function(L,G,X){Se.get(L.texture).__webglTexture=G,Se.get(L.depthTexture).__webglTexture=X;let W=Se.get(L);W.__hasExternalTextures=!0,W.__hasExternalTextures&&(W.__autoAllocateDepthBuffer=X===void 0,W.__autoAllocateDepthBuffer||L.useRenderToTexture&&(console.warn("render-to-texture extension was disabled because an external texture was provided"),L.useRenderToTexture=!1,L.useRenderbuffer=!0))},this.setRenderTargetFramebuffer=function(L,G){let X=Se.get(L);X.__webglFramebuffer=G,X.__useDefaultFramebuffer=G===void 0},this.setRenderTarget=function(L,G=0,X=0){z=L,g=G,m=X;let W=!0;if(L){let Ne=Se.get(L);Ne.__useDefaultFramebuffer!==void 0?(ue.bindFramebuffer(36160,null),W=!1):Ne.__webglFramebuffer===void 0?J.setupRenderTarget(L):Ne.__hasExternalTextures&&J.rebindTextures(L,Se.get(L.texture).__webglTexture,Se.get(L.depthTexture).__webglTexture)}let ee=null,He=!1,Re=!1;if(L){let Ne=L.texture;(Ne.isDataTexture3D||Ne.isDataTexture2DArray)&&(Re=!0);let $e=Se.get(L).__webglFramebuffer;L.isWebGLCubeRenderTarget?(ee=$e[G],He=!0):L.useRenderbuffer?ee=Se.get(L).__webglMultisampledFramebuffer:ee=$e,S.copy(L.viewport),_.copy(L.scissor),A=L.scissorTest}else S.copy(V).multiplyScalar(w).floor(),_.copy(H).multiplyScalar(w).floor(),A=T;if(ue.bindFramebuffer(36160,ee)&&ze.drawBuffers&&W&&ue.drawBuffers(L,ee),ue.viewport(S),ue.scissor(_),ue.setScissorTest(A),He){let Ne=Se.get(L.texture);U.framebufferTexture2D(36160,36064,34069+G,Ne.__webglTexture,X)}else if(Re){let Ne=Se.get(L.texture),$e=G||0;U.framebufferTextureLayer(36160,36064,Ne.__webglTexture,X||0,$e)}y=-1},this.readRenderTargetPixels=function(L,G,X,W,ee,He,Re){if(!(L&&L.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Fe=Se.get(L).__webglFramebuffer;if(L.isWebGLCubeRenderTarget&&Re!==void 0&&(Fe=Fe[Re]),Fe){ue.bindFramebuffer(36160,Fe);try{let Ne=L.texture,$e=Ne.format,Oe=Ne.type;if($e!==Ut&&Me.convert($e)!==U.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let Ge=Oe===pn&&(de.has("EXT_color_buffer_half_float")||ze.isWebGL2&&de.has("EXT_color_buffer_float"));if(Oe!==K2&&Me.convert(Oe)!==U.getParameter(35738)&&!(Oe===Ti&&(ze.isWebGL2||de.has("OES_texture_float")||de.has("WEBGL_color_buffer_float")))&&!Ge){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}U.checkFramebufferStatus(36160)===36053?G>=0&&G<=L.width-W&&X>=0&&X<=L.height-ee&&U.readPixels(G,X,W,ee,Me.convert($e),Me.convert(Oe),He):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{let Ne=z!==null?Se.get(z).__webglFramebuffer:null;ue.bindFramebuffer(36160,Ne)}}},this.copyFramebufferToTexture=function(L,G,X=0){if(G.isFramebufferTexture!==!0){console.error("THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.");return}let W=Math.pow(2,-X),ee=Math.floor(G.image.width*W),He=Math.floor(G.image.height*W);J.setTexture2D(G,0),U.copyTexSubImage2D(3553,X,0,0,L.x,L.y,ee,He),ue.unbindTexture()},this.copyTextureToTexture=function(L,G,X,W=0){let ee=G.image.width,He=G.image.height,Re=Me.convert(X.format),Fe=Me.convert(X.type);J.setTexture2D(X,0),U.pixelStorei(37440,X.flipY),U.pixelStorei(37441,X.premultiplyAlpha),U.pixelStorei(3317,X.unpackAlignment),G.isDataTexture?U.texSubImage2D(3553,W,L.x,L.y,ee,He,Re,Fe,G.image.data):G.isCompressedTexture?U.compressedTexSubImage2D(3553,W,L.x,L.y,G.mipmaps[0].width,G.mipmaps[0].height,Re,G.mipmaps[0].data):U.texSubImage2D(3553,W,L.x,L.y,Re,Fe,G.image),W===0&&X.generateMipmaps&&U.generateMipmap(3553),ue.unbindTexture()},this.copyTextureToTexture3D=function(L,G,X,W,ee=0){if(v.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let He=L.max.x-L.min.x+1,Re=L.max.y-L.min.y+1,Fe=L.max.z-L.min.z+1,Ne=Me.convert(W.format),$e=Me.convert(W.type),Oe;if(W.isDataTexture3D)J.setTexture3D(W,0),Oe=32879;else if(W.isDataTexture2DArray)J.setTexture2DArray(W,0),Oe=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}U.pixelStorei(37440,W.flipY),U.pixelStorei(37441,W.premultiplyAlpha),U.pixelStorei(3317,W.unpackAlignment);let Ge=U.getParameter(3314),dt=U.getParameter(32878),gi=U.getParameter(3316),Wi=U.getParameter(3315),je=U.getParameter(32877),D1=X.isCompressedTexture?X.mipmaps[0]:X.image;U.pixelStorei(3314,D1.width),U.pixelStorei(32878,D1.height),U.pixelStorei(3316,L.min.x),U.pixelStorei(3315,L.min.y),U.pixelStorei(32877,L.min.z),X.isDataTexture||X.isDataTexture3D?U.texSubImage3D(Oe,ee,G.x,G.y,G.z,He,Re,Fe,Ne,$e,D1.data):X.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),U.compressedTexSubImage3D(Oe,ee,G.x,G.y,G.z,He,Re,Fe,Ne,D1.data)):U.texSubImage3D(Oe,ee,G.x,G.y,G.z,He,Re,Fe,Ne,$e,D1),U.pixelStorei(3314,Ge),U.pixelStorei(32878,dt),U.pixelStorei(3316,gi),U.pixelStorei(3315,Wi),U.pixelStorei(32877,je),ee===0&&W.generateMipmaps&&U.generateMipmap(Oe),ue.unbindTexture()},this.initTexture=function(L){J.setTexture2D(L,0),ue.unbindTexture()},this.resetState=function(){g=0,m=0,z=null,ue.reset(),we.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}Ye.prototype.isWebGLRenderer=!0;var sl=class extends Ye{};sl.prototype.isWebGL1Renderer=!0;var Ya=class{constructor(e,t=25e-5){this.name="",this.color=new xe(e),this.density=t}clone(){return new Ya(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}};Ya.prototype.isFogExp2=!0;var $a=class{constructor(e,t=1,i=1e3){this.name="",this.color=new xe(e),this.near=t,this.far=i}clone(){return new $a(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}};$a.prototype.isFog=!0;var ks=class extends We{constructor(){super();this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),t}};ks.prototype.isScene=!0;var Un=class{constructor(e,t){this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Ts,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=C1()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let n=0,s=this.stride;n<s;n++)this.array[e+n]=t.array[i+n];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=C1()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(t,this.stride);return i.setUsage(this.usage),i}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=C1()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}};Un.prototype.isInterleavedBuffer=!0;var yt=new B,Gn=class{constructor(e,t,i,n=!1){this.name="",this.data=e,this.itemSize=t,this.offset=i,this.normalized=n===!0}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,i=this.data.count;t<i;t++)yt.x=this.getX(t),yt.y=this.getY(t),yt.z=this.getZ(t),yt.applyMatrix4(e),this.setXYZ(t,yt.x,yt.y,yt.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)yt.x=this.getX(t),yt.y=this.getY(t),yt.z=this.getZ(t),yt.applyNormalMatrix(e),this.setXYZ(t,yt.x,yt.y,yt.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)yt.x=this.getX(t),yt.y=this.getY(t),yt.z=this.getZ(t),yt.transformDirection(e),this.setXYZ(t,yt.x,yt.y,yt.z);return this}setX(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){return this.data.array[e*this.data.stride+this.offset]}getY(e){return this.data.array[e*this.data.stride+this.offset+1]}getZ(e){return this.data.array[e*this.data.stride+this.offset+2]}getW(e){return this.data.array[e*this.data.stride+this.offset+3]}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=n,this}setXYZW(e,t,i,n,s){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=n,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");let t=[];for(let i=0;i<this.count;i++){let n=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[n+s])}return new wt(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Gn(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");let t=[];for(let i=0;i<this.count;i++){let n=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[n+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}};Gn.prototype.isInterleavedBufferAttribute=!0;var c6=class extends St{constructor(e){super();this.type="SpriteMaterial",this.color=new xe(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this}};c6.prototype.isSpriteMaterial=!0;var qn,Os=new B,Wn=new B,jn=new B,Zn=new te,Us=new te,rl=new Ce,Ja=new B,Gs=new B,Qa=new B,al=new te,l6=new te,ol=new te,cl=class extends We{constructor(e){super();if(this.type="Sprite",qn===void 0){qn=new rt;let t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),i=new Un(t,5);qn.setIndex([0,1,2,0,2,3]),qn.setAttribute("position",new Gn(i,3,0,!1)),qn.setAttribute("uv",new Gn(i,2,3,!1))}this.geometry=qn,this.material=e!==void 0?e:new c6,this.center=new te(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Wn.setFromMatrixScale(this.matrixWorld),rl.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),jn.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Wn.multiplyScalar(-jn.z);let i=this.material.rotation,n,s;i!==0&&(s=Math.cos(i),n=Math.sin(i));let r=this.center;Ka(Ja.set(-.5,-.5,0),jn,r,Wn,n,s),Ka(Gs.set(.5,-.5,0),jn,r,Wn,n,s),Ka(Qa.set(.5,.5,0),jn,r,Wn,n,s),al.set(0,0),l6.set(1,0),ol.set(1,1);let a=e.ray.intersectTriangle(Ja,Gs,Qa,!1,Os);if(a===null&&(Ka(Gs.set(-.5,.5,0),jn,r,Wn,n,s),l6.set(0,1),a=e.ray.intersectTriangle(Ja,Qa,Gs,!1,Os),a===null))return;let c=e.ray.origin.distanceTo(Os);c<e.near||c>e.far||t.push({distance:c,point:Os.clone(),uv:xt.getUV(Os,Ja,Gs,Qa,al,l6,ol,new te),face:null,object:this})}copy(e){return super.copy(e),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}};cl.prototype.isSprite=!0;function Ka(o,e,t,i,n,s){Zn.subVectors(o,t).addScalar(.5).multiply(i),n!==void 0?(Us.x=s*Zn.x-n*Zn.y,Us.y=n*Zn.x+s*Zn.y):Us.copy(Zn),o.copy(e),o.x+=Us.x,o.y+=Us.y,o.applyMatrix4(rl)}var ll=new B,hl=new Qe,ul=new Qe,wx=new B,fl=new Ce,h6=class extends Rt{constructor(e,t){super(e,t);this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Ce,this.bindMatrixInverse=new Ce}copy(e){return super.copy(e),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let e=new Qe,t=this.geometry.attributes.skinWeight;for(let i=0,n=t.count;i<n;i++){e.x=t.getX(i),e.y=t.getY(i),e.z=t.getZ(i),e.w=t.getW(i);let s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(i,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(e,t){let i=this.skeleton,n=this.geometry;hl.fromBufferAttribute(n.attributes.skinIndex,e),ul.fromBufferAttribute(n.attributes.skinWeight,e),ll.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){let r=ul.getComponent(s);if(r!==0){let a=hl.getComponent(s);fl.multiplyMatrices(i.bones[a].matrixWorld,i.boneInverses[a]),t.addScaledVector(wx.copy(ll).applyMatrix4(fl),r)}}return t.applyMatrix4(this.bindMatrixInverse)}};h6.prototype.isSkinnedMesh=!0;var dl=class extends We{constructor(){super();this.type="Bone"}};dl.prototype.isBone=!0;var pl=class extends vt{constructor(e=null,t=1,i=1,n,s,r,a,c,l=At,h=At,f,u){super(null,r,a,c,l,h,n,s,f,u);this.image={data:e,width:t,height:i},this.magFilter=l,this.minFilter=h,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};pl.prototype.isDataTexture=!0;var e4=class extends wt{constructor(e,t,i,n=1){typeof i=="number"&&(n=i,i=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument."));super(e,t,i);this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}};e4.prototype.isInstancedBufferAttribute=!0;var ml=new Ce,gl=new Ce,t4=[],qs=new Rt,vl=class extends Rt{constructor(e,t,i){super(e,t);this.instanceMatrix=new e4(new Float32Array(i*16),16),this.instanceColor=null,this.count=i,this.frustumCulled=!1}copy(e){return super.copy(e),this.instanceMatrix.copy(e.instanceMatrix),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}raycast(e,t){let i=this.matrixWorld,n=this.count;if(qs.geometry=this.geometry,qs.material=this.material,qs.material!==void 0)for(let s=0;s<n;s++){this.getMatrixAt(s,ml),gl.multiplyMatrices(i,ml),qs.matrixWorld=gl,qs.raycast(e,t4);for(let r=0,a=t4.length;r<a;r++){let c=t4[r];c.instanceId=s,c.object=this,t.push(c)}t4.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new e4(new Float32Array(this.instanceMatrix.count*3),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}};vl.prototype.isInstancedMesh=!0;var Xn=class extends St{constructor(e){super();this.type="LineBasicMaterial",this.color=new xe(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this}};Xn.prototype.isLineBasicMaterial=!0;var xl=new B,yl=new B,wl=new Ce,u6=new Fi,i4=new Ni,n4=class extends We{constructor(e=new rt,t=new Xn){super();this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.isBufferGeometry)if(e.index===null){let t=e.attributes.position,i=[0];for(let n=1,s=t.count;n<s;n++)xl.fromBufferAttribute(t,n-1),yl.fromBufferAttribute(t,n),i[n]=i[n-1],i[n]+=xl.distanceTo(yl);e.setAttribute("lineDistance",new _t(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(e,t){let i=this.geometry,n=this.matrixWorld,s=e.params.Line.threshold,r=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),i4.copy(i.boundingSphere),i4.applyMatrix4(n),i4.radius+=s,e.ray.intersectsSphere(i4)===!1)return;wl.copy(n).invert(),u6.copy(e.ray).applyMatrix4(wl);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=a*a,l=new B,h=new B,f=new B,u=new B,d=this.isLineSegments?2:1;if(i.isBufferGeometry){let p=i.index,x=i.attributes.position;if(p!==null){let g=Math.max(0,r.start),m=Math.min(p.count,r.start+r.count);for(let z=g,y=m-1;z<y;z+=d){let b=p.getX(z),S=p.getX(z+1);if(l.fromBufferAttribute(x,b),h.fromBufferAttribute(x,S),u6.distanceSqToSegment(l,h,u,f)>c)continue;u.applyMatrix4(this.matrixWorld);let A=e.ray.origin.distanceTo(u);A<e.near||A>e.far||t.push({distance:A,point:f.clone().applyMatrix4(this.matrixWorld),index:z,face:null,faceIndex:null,object:this})}}else{let g=Math.max(0,r.start),m=Math.min(x.count,r.start+r.count);for(let z=g,y=m-1;z<y;z+=d){if(l.fromBufferAttribute(x,z),h.fromBufferAttribute(x,z+1),u6.distanceSqToSegment(l,h,u,f)>c)continue;u.applyMatrix4(this.matrixWorld);let S=e.ray.origin.distanceTo(u);S<e.near||S>e.far||t.push({distance:S,point:f.clone().applyMatrix4(this.matrixWorld),index:z,face:null,faceIndex:null,object:this})}}}else i.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){let e=this.geometry;if(e.isBufferGeometry){let t=e.morphAttributes,i=Object.keys(t);if(i.length>0){let n=t[i[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,r=n.length;s<r;s++){let a=n[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}else{let t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}};n4.prototype.isLine=!0;var bl=new B,Ml=new B,s4=class extends n4{constructor(e,t){super(e,t);this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(e.isBufferGeometry)if(e.index===null){let t=e.attributes.position,i=[];for(let n=0,s=t.count;n<s;n+=2)bl.fromBufferAttribute(t,n),Ml.fromBufferAttribute(t,n+1),i[n]=n===0?0:i[n-1],i[n+1]=i[n]+bl.distanceTo(Ml);e.setAttribute("lineDistance",new _t(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}};s4.prototype.isLineSegments=!0;var zl=class extends n4{constructor(e,t){super(e,t);this.type="LineLoop"}};zl.prototype.isLineLoop=!0;var f6=class extends St{constructor(e){super();this.type="PointsMaterial",this.color=new xe(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this}};f6.prototype.isPointsMaterial=!0;var Cl=new Ce,d6=new Fi,r4=new Ni,a4=new B,Al=class extends We{constructor(e=new rt,t=new f6){super();this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){let i=this.geometry,n=this.matrixWorld,s=e.params.Points.threshold,r=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),r4.copy(i.boundingSphere),r4.applyMatrix4(n),r4.radius+=s,e.ray.intersectsSphere(r4)===!1)return;Cl.copy(n).invert(),d6.copy(e.ray).applyMatrix4(Cl);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=a*a;if(i.isBufferGeometry){let l=i.index,f=i.attributes.position;if(l!==null){let u=Math.max(0,r.start),d=Math.min(l.count,r.start+r.count);for(let p=u,v=d;p<v;p++){let x=l.getX(p);a4.fromBufferAttribute(f,x),Sl(a4,x,c,n,e,t,this)}}else{let u=Math.max(0,r.start),d=Math.min(f.count,r.start+r.count);for(let p=u,v=d;p<v;p++)a4.fromBufferAttribute(f,p),Sl(a4,p,c,n,e,t,this)}}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){let e=this.geometry;if(e.isBufferGeometry){let t=e.morphAttributes,i=Object.keys(t);if(i.length>0){let n=t[i[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,r=n.length;s<r;s++){let a=n[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}else{let t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}};Al.prototype.isPoints=!0;function Sl(o,e,t,i,n,s,r){let a=d6.distanceSqToPoint(o);if(a<t){let c=new B;d6.closestPointToPoint(o,c),c.applyMatrix4(i);let l=n.ray.origin.distanceTo(c);if(l<n.near||l>n.far)return;s.push({distance:l,distanceToRay:Math.sqrt(a),point:c,index:e,face:null,object:r})}}var _l=class extends vt{constructor(e,t,i,n,s,r,a,c,l){super(e,t,i,n,s,r,a,c,l);this.minFilter=r!==void 0?r:Pt,this.magFilter=s!==void 0?s:Pt,this.generateMipmaps=!1;let h=this;function f(){h.needsUpdate=!0,e.requestVideoFrameCallback(f)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(f)}clone(){return new this.constructor(this.image).copy(this)}update(){let e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}};_l.prototype.isVideoTexture=!0;var El=class extends vt{constructor(e,t,i){super({width:e,height:t});this.format=i,this.magFilter=At,this.minFilter=At,this.generateMipmaps=!1,this.needsUpdate=!0}};El.prototype.isFramebufferTexture=!0;var Ll=class extends vt{constructor(e,t,i,n,s,r,a,c,l,h,f,u){super(null,r,a,c,l,h,n,s,f,u);this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}};Ll.prototype.isCompressedTexture=!0;var Tl=class extends vt{constructor(e,t,i,n,s,r,a,c,l){super(e,t,i,n,s,r,a,c,l);this.needsUpdate=!0}};Tl.prototype.isCanvasTexture=!0;var GC=new B,qC=new B,WC=new B,jC=new xt;var c1=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){let i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],i,n=this.getPoint(0),s=0;t.push(0);for(let r=1;r<=e;r++)i=this.getPoint(r/e),s+=i.distanceTo(n),t.push(s),n=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){let i=this.getLengths(),n=0,s=i.length,r;t?r=t:r=e*i[s-1];let a=0,c=s-1,l;for(;a<=c;)if(n=Math.floor(a+(c-a)/2),l=i[n]-r,l<0)a=n+1;else if(l>0)c=n-1;else{c=n;break}if(n=c,i[n]===r)return n/(s-1);let h=i[n],u=i[n+1]-h,d=(r-h)/u;return(n+d)/(s-1)}getTangent(e,t){let i=1e-4,n=e-i,s=e+i;n<0&&(n=0),s>1&&(s=1);let r=this.getPoint(n),a=this.getPoint(s),c=t||(r.isVector2?new te:new B);return c.copy(a).sub(r).normalize(),c}getTangentAt(e,t){let i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){let i=new B,n=[],s=[],r=[],a=new B,c=new Ce;for(let d=0;d<=e;d++){let p=d/e;n[d]=this.getTangentAt(p,new B)}s[0]=new B,r[0]=new B;let l=Number.MAX_VALUE,h=Math.abs(n[0].x),f=Math.abs(n[0].y),u=Math.abs(n[0].z);h<=l&&(l=h,i.set(1,0,0)),f<=l&&(l=f,i.set(0,1,0)),u<=l&&i.set(0,0,1),a.crossVectors(n[0],i).normalize(),s[0].crossVectors(n[0],a),r[0].crossVectors(n[0],s[0]);for(let d=1;d<=e;d++){if(s[d]=s[d-1].clone(),r[d]=r[d-1].clone(),a.crossVectors(n[d-1],n[d]),a.length()>Number.EPSILON){a.normalize();let p=Math.acos(Jt(n[d-1].dot(n[d]),-1,1));s[d].applyMatrix4(c.makeRotationAxis(a,p))}r[d].crossVectors(n[d],s[d])}if(t===!0){let d=Math.acos(Jt(s[0].dot(s[e]),-1,1));d/=e,n[0].dot(a.crossVectors(s[0],s[e]))>0&&(d=-d);for(let p=1;p<=e;p++)s[p].applyMatrix4(c.makeRotationAxis(n[p],d*p)),r[p].crossVectors(n[p],s[p])}return{tangents:n,normals:s,binormals:r}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},Ws=class extends c1{constructor(e=0,t=0,i=1,n=1,s=0,r=Math.PI*2,a=!1,c=0){super();this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=n,this.aStartAngle=s,this.aEndAngle=r,this.aClockwise=a,this.aRotation=c}getPoint(e,t){let i=t||new te,n=Math.PI*2,s=this.aEndAngle-this.aStartAngle,r=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=n;for(;s>n;)s-=n;s<Number.EPSILON&&(r?s=0:s=n),this.aClockwise===!0&&!r&&(s===n?s=-n:s=s-n);let a=this.aStartAngle+e*s,c=this.aX+this.xRadius*Math.cos(a),l=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){let h=Math.cos(this.aRotation),f=Math.sin(this.aRotation),u=c-this.aX,d=l-this.aY;c=u*h-d*f+this.aX,l=u*f+d*h+this.aY}return i.set(c,l)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}};Ws.prototype.isEllipseCurve=!0;var p6=class extends Ws{constructor(e,t,i,n,s,r){super(e,t,i,i,n,s,r);this.type="ArcCurve"}};p6.prototype.isArcCurve=!0;function m6(){let o=0,e=0,t=0,i=0;function n(s,r,a,c){o=s,e=a,t=-3*s+3*r-2*a-c,i=2*s-2*r+a+c}return{initCatmullRom:function(s,r,a,c,l){n(r,a,l*(a-s),l*(c-r))},initNonuniformCatmullRom:function(s,r,a,c,l,h,f){let u=(r-s)/l-(a-s)/(l+h)+(a-r)/h,d=(a-r)/h-(c-r)/(h+f)+(c-a)/f;u*=h,d*=h,n(r,a,u,d)},calc:function(s){let r=s*s,a=r*s;return o+e*s+t*r+i*a}}}var o4=new B,g6=new m6,v6=new m6,x6=new m6,y6=class extends c1{constructor(e=[],t=!1,i="centripetal",n=.5){super();this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=i,this.tension=n}getPoint(e,t=new B){let i=t,n=this.points,s=n.length,r=(s-(this.closed?0:1))*e,a=Math.floor(r),c=r-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:c===0&&a===s-1&&(a=s-2,c=1);let l,h;this.closed||a>0?l=n[(a-1)%s]:(o4.subVectors(n[0],n[1]).add(n[0]),l=o4);let f=n[a%s],u=n[(a+1)%s];if(this.closed||a+2<s?h=n[(a+2)%s]:(o4.subVectors(n[s-1],n[s-2]).add(n[s-1]),h=o4),this.curveType==="centripetal"||this.curveType==="chordal"){let d=this.curveType==="chordal"?.5:.25,p=Math.pow(l.distanceToSquared(f),d),v=Math.pow(f.distanceToSquared(u),d),x=Math.pow(u.distanceToSquared(h),d);v<1e-4&&(v=1),p<1e-4&&(p=v),x<1e-4&&(x=v),g6.initNonuniformCatmullRom(l.x,f.x,u.x,h.x,p,v,x),v6.initNonuniformCatmullRom(l.y,f.y,u.y,h.y,p,v,x),x6.initNonuniformCatmullRom(l.z,f.z,u.z,h.z,p,v,x)}else this.curveType==="catmullrom"&&(g6.initCatmullRom(l.x,f.x,u.x,h.x,this.tension),v6.initCatmullRom(l.y,f.y,u.y,h.y,this.tension),x6.initCatmullRom(l.z,f.z,u.z,h.z,this.tension));return i.set(g6.calc(c),v6.calc(c),x6.calc(c)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let n=e.points[t];this.points.push(n.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){let n=this.points[t];e.points.push(n.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let n=e.points[t];this.points.push(new B().fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};y6.prototype.isCatmullRomCurve3=!0;function Dl(o,e,t,i,n){let s=(i-e)*.5,r=(n-t)*.5,a=o*o,c=o*a;return(2*t-2*i+s+r)*c+(-3*t+3*i-2*s-r)*a+s*o+t}function bx(o,e){let t=1-o;return t*t*e}function Mx(o,e){return 2*(1-o)*o*e}function zx(o,e){return o*o*e}function js(o,e,t,i){return bx(o,e)+Mx(o,t)+zx(o,i)}function Cx(o,e){let t=1-o;return t*t*t*e}function Ax(o,e){let t=1-o;return 3*t*t*o*e}function Sx(o,e){return 3*(1-o)*o*o*e}function _x(o,e){return o*o*o*e}function Zs(o,e,t,i,n){return Cx(o,e)+Ax(o,t)+Sx(o,i)+_x(o,n)}var c4=class extends c1{constructor(e=new te,t=new te,i=new te,n=new te){super();this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=n}getPoint(e,t=new te){let i=t,n=this.v0,s=this.v1,r=this.v2,a=this.v3;return i.set(Zs(e,n.x,s.x,r.x,a.x),Zs(e,n.y,s.y,r.y,a.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}};c4.prototype.isCubicBezierCurve=!0;var w6=class extends c1{constructor(e=new B,t=new B,i=new B,n=new B){super();this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=n}getPoint(e,t=new B){let i=t,n=this.v0,s=this.v1,r=this.v2,a=this.v3;return i.set(Zs(e,n.x,s.x,r.x,a.x),Zs(e,n.y,s.y,r.y,a.y),Zs(e,n.z,s.z,r.z,a.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}};w6.prototype.isCubicBezierCurve3=!0;var Xs=class extends c1{constructor(e=new te,t=new te){super();this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new te){let i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t){let i=t||new te;return i.copy(this.v2).sub(this.v1).normalize(),i}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}};Xs.prototype.isLineCurve=!0;var Hl=class extends c1{constructor(e=new B,t=new B){super();this.type="LineCurve3",this.isLineCurve3=!0,this.v1=e,this.v2=t}getPoint(e,t=new B){let i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},l4=class extends c1{constructor(e=new te,t=new te,i=new te){super();this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new te){let i=t,n=this.v0,s=this.v1,r=this.v2;return i.set(js(e,n.x,s.x,r.x),js(e,n.y,s.y,r.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}};l4.prototype.isQuadraticBezierCurve=!0;var b6=class extends c1{constructor(e=new B,t=new B,i=new B){super();this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new B){let i=t,n=this.v0,s=this.v1,r=this.v2;return i.set(js(e,n.x,s.x,r.x),js(e,n.y,s.y,r.y),js(e,n.z,s.z,r.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}};b6.prototype.isQuadraticBezierCurve3=!0;var h4=class extends c1{constructor(e=[]){super();this.type="SplineCurve",this.points=e}getPoint(e,t=new te){let i=t,n=this.points,s=(n.length-1)*e,r=Math.floor(s),a=s-r,c=n[r===0?r:r-1],l=n[r],h=n[r>n.length-2?n.length-1:r+1],f=n[r>n.length-3?n.length-1:r+2];return i.set(Dl(a,c.x,l.x,h.x,f.x),Dl(a,c.y,l.y,h.y,f.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let n=e.points[t];this.points.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){let n=this.points[t];e.points.push(n.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let n=e.points[t];this.points.push(new te().fromArray(n))}return this}};h4.prototype.isSplineCurve=!0;var Vl=Object.freeze({__proto__:null,ArcCurve:p6,CatmullRomCurve3:y6,CubicBezierCurve:c4,CubicBezierCurve3:w6,EllipseCurve:Ws,LineCurve:Xs,LineCurve3:Hl,QuadraticBezierCurve:l4,QuadraticBezierCurve3:b6,SplineCurve:h4}),Rl=class extends c1{constructor(){super();this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new Xs(t,e))}getPoint(e,t){let i=e*this.getLength(),n=this.getCurveLengths(),s=0;for(;s<n.length;){if(n[s]>=i){let r=n[s]-i,a=this.curves[s],c=a.getLength(),l=c===0?0:1-r/c;return a.getPointAt(l,t)}s++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let i=0,n=this.curves.length;i<n;i++)t+=this.curves[i].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],i;for(let n=0,s=this.curves;n<s.length;n++){let r=s[n],a=r&&r.isEllipseCurve?e*2:r&&(r.isLineCurve||r.isLineCurve3)?1:r&&r.isSplineCurve?e*r.points.length:e,c=r.getPoints(a);for(let l=0;l<c.length;l++){let h=c[l];i&&i.equals(h)||(t.push(h),i=h)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){let n=e.curves[t];this.curves.push(n.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,i=this.curves.length;t<i;t++){let n=this.curves[t];e.curves.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){let n=e.curves[t];this.curves.push(new Vl[n.type]().fromJSON(n))}return this}},u4=class extends Rl{constructor(e){super();this.type="Path",this.currentPoint=new te,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,i=e.length;t<i;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let i=new Xs(this.currentPoint.clone(),new te(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,n){let s=new l4(this.currentPoint.clone(),new te(e,t),new te(i,n));return this.curves.push(s),this.currentPoint.set(i,n),this}bezierCurveTo(e,t,i,n,s,r){let a=new c4(this.currentPoint.clone(),new te(e,t),new te(i,n),new te(s,r));return this.curves.push(a),this.currentPoint.set(s,r),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),i=new h4(t);return this.curves.push(i),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,i,n,s,r){let a=this.currentPoint.x,c=this.currentPoint.y;return this.absarc(e+a,t+c,i,n,s,r),this}absarc(e,t,i,n,s,r){return this.absellipse(e,t,i,i,n,s,r),this}ellipse(e,t,i,n,s,r,a,c){let l=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(e+l,t+h,i,n,s,r,a,c),this}absellipse(e,t,i,n,s,r,a,c){let l=new Ws(e,t,i,n,s,r,a,c);if(this.curves.length>0){let f=l.getPoint(0);f.equals(this.currentPoint)||this.lineTo(f.x,f.y)}this.curves.push(l);let h=l.getPoint(1);return this.currentPoint.copy(h),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},Yn=class extends u4{constructor(e){super(e);this.uuid=C1(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let i=0,n=this.holes.length;i<n;i++)t[i]=this.holes[i].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){let n=e.holes[t];this.holes.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,i=this.holes.length;t<i;t++){let n=this.holes[t];e.holes.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){let n=e.holes[t];this.holes.push(new u4().fromJSON(n))}return this}},Ex={triangulate:function(o,e,t=2){let i=e&&e.length,n=i?e[0]*t:o.length,s=Nl(o,0,n,t,!0),r=[];if(!s||s.next===s.prev)return r;let a,c,l,h,f,u,d;if(i&&(s=Vx(o,e,s,t)),o.length>80*t){a=l=o[0],c=h=o[1];for(let p=t;p<n;p+=t)f=o[p],u=o[p+1],f<a&&(a=f),u<c&&(c=u),f>l&&(l=f),u>h&&(h=u);d=Math.max(l-a,h-c),d=d!==0?1/d:0}return Ys(s,r,t,a,c,d),r}};function Nl(o,e,t,i,n){let s,r;if(n===qx(o,e,t,i)>0)for(s=e;s<t;s+=i)r=Pl(s,o[s],o[s+1],r);else for(s=t-i;s>=e;s-=i)r=Pl(s,o[s],o[s+1],r);return r&&f4(r,r.next)&&(Js(r),r=r.next),r}function di(o,e){if(!o)return o;e||(e=o);let t=o,i;do if(i=!1,!t.steiner&&(f4(t,t.next)||ut(t.prev,t,t.next)===0)){if(Js(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function Ys(o,e,t,i,n,s,r){if(!o)return;!r&&s&&Px(o,i,n,s);let a=o,c,l;for(;o.prev!==o.next;){if(c=o.prev,l=o.next,s?Tx(o,i,n,s):Lx(o)){e.push(c.i/t),e.push(o.i/t),e.push(l.i/t),Js(o),o=l.next,a=l.next;continue}if(o=l,o===a){r?r===1?(o=Dx(di(o),e,t),Ys(o,e,t,i,n,s,2)):r===2&&Hx(o,e,t,i,n,s):Ys(di(o),e,t,i,n,s,1);break}}}function Lx(o){let e=o.prev,t=o,i=o.next;if(ut(e,t,i)>=0)return!1;let n=o.next.next;for(;n!==o.prev;){if($n(e.x,e.y,t.x,t.y,i.x,i.y,n.x,n.y)&&ut(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function Tx(o,e,t,i){let n=o.prev,s=o,r=o.next;if(ut(n,s,r)>=0)return!1;let a=n.x<s.x?n.x<r.x?n.x:r.x:s.x<r.x?s.x:r.x,c=n.y<s.y?n.y<r.y?n.y:r.y:s.y<r.y?s.y:r.y,l=n.x>s.x?n.x>r.x?n.x:r.x:s.x>r.x?s.x:r.x,h=n.y>s.y?n.y>r.y?n.y:r.y:s.y>r.y?s.y:r.y,f=M6(a,c,e,t,i),u=M6(l,h,e,t,i),d=o.prevZ,p=o.nextZ;for(;d&&d.z>=f&&p&&p.z<=u;){if(d!==o.prev&&d!==o.next&&$n(n.x,n.y,s.x,s.y,r.x,r.y,d.x,d.y)&&ut(d.prev,d,d.next)>=0||(d=d.prevZ,p!==o.prev&&p!==o.next&&$n(n.x,n.y,s.x,s.y,r.x,r.y,p.x,p.y)&&ut(p.prev,p,p.next)>=0))return!1;p=p.nextZ}for(;d&&d.z>=f;){if(d!==o.prev&&d!==o.next&&$n(n.x,n.y,s.x,s.y,r.x,r.y,d.x,d.y)&&ut(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;p&&p.z<=u;){if(p!==o.prev&&p!==o.next&&$n(n.x,n.y,s.x,s.y,r.x,r.y,p.x,p.y)&&ut(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function Dx(o,e,t){let i=o;do{let n=i.prev,s=i.next.next;!f4(n,s)&&Fl(n,i,i.next,s)&&$s(n,s)&&$s(s,n)&&(e.push(n.i/t),e.push(i.i/t),e.push(s.i/t),Js(i),Js(i.next),i=o=s),i=i.next}while(i!==o);return di(i)}function Hx(o,e,t,i,n,s){let r=o;do{let a=r.next.next;for(;a!==r.prev;){if(r.i!==a.i&&Ox(r,a)){let c=Bl(r,a);r=di(r,r.next),c=di(c,c.next),Ys(r,e,t,i,n,s),Ys(c,e,t,i,n,s);return}a=a.next}r=r.next}while(r!==o)}function Vx(o,e,t,i){let n=[],s,r,a,c,l;for(s=0,r=e.length;s<r;s++)a=e[s]*i,c=s<r-1?e[s+1]*i:o.length,l=Nl(o,a,c,i,!1),l===l.next&&(l.steiner=!0),n.push(kx(l));for(n.sort(Rx),s=0;s<n.length;s++)Nx(n[s],t),t=di(t,t.next);return t}function Rx(o,e){return o.x-e.x}function Nx(o,e){if(e=Fx(o,e),e){let t=Bl(e,o);di(e,e.next),di(t,t.next)}}function Fx(o,e){let t=e,i=o.x,n=o.y,s=-1/0,r;do{if(n<=t.y&&n>=t.next.y&&t.next.y!==t.y){let u=t.x+(n-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(u<=i&&u>s){if(s=u,u===i){if(n===t.y)return t;if(n===t.next.y)return t.next}r=t.x<t.next.x?t:t.next}}t=t.next}while(t!==e);if(!r)return null;if(i===s)return r;let a=r,c=r.x,l=r.y,h=1/0,f;t=r;do i>=t.x&&t.x>=c&&i!==t.x&&$n(n<l?i:s,n,c,l,n<l?s:i,n,t.x,t.y)&&(f=Math.abs(n-t.y)/(i-t.x),$s(t,o)&&(f<h||f===h&&(t.x>r.x||t.x===r.x&&Bx(r,t)))&&(r=t,h=f)),t=t.next;while(t!==a);return r}function Bx(o,e){return ut(o.prev,o,e.prev)<0&&ut(e.next,o,o.next)<0}function Px(o,e,t,i){let n=o;do n.z===null&&(n.z=M6(n.x,n.y,e,t,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==o);n.prevZ.nextZ=null,n.prevZ=null,Ix(n)}function Ix(o){let e,t,i,n,s,r,a,c,l=1;do{for(t=o,o=null,s=null,r=0;t;){for(r++,i=t,a=0,e=0;e<l&&(a++,i=i.nextZ,!!i);e++);for(c=l;a>0||c>0&&i;)a!==0&&(c===0||!i||t.z<=i.z)?(n=t,t=t.nextZ,a--):(n=i,i=i.nextZ,c--),s?s.nextZ=n:o=n,n.prevZ=s,s=n;t=i}s.nextZ=null,l*=2}while(r>1);return o}function M6(o,e,t,i,n){return o=32767*(o-t)*n,e=32767*(e-i)*n,o=(o|o<<8)&16711935,o=(o|o<<4)&252645135,o=(o|o<<2)&858993459,o=(o|o<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,o|e<<1}function kx(o){let e=o,t=o;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==o);return t}function $n(o,e,t,i,n,s,r,a){return(n-r)*(e-a)-(o-r)*(s-a)>=0&&(o-r)*(i-a)-(t-r)*(e-a)>=0&&(t-r)*(s-a)-(n-r)*(i-a)>=0}function Ox(o,e){return o.next.i!==e.i&&o.prev.i!==e.i&&!Ux(o,e)&&($s(o,e)&&$s(e,o)&&Gx(o,e)&&(ut(o.prev,o,e.prev)||ut(o,e.prev,e))||f4(o,e)&&ut(o.prev,o,o.next)>0&&ut(e.prev,e,e.next)>0)}function ut(o,e,t){return(e.y-o.y)*(t.x-e.x)-(e.x-o.x)*(t.y-e.y)}function f4(o,e){return o.x===e.x&&o.y===e.y}function Fl(o,e,t,i){let n=p4(ut(o,e,t)),s=p4(ut(o,e,i)),r=p4(ut(t,i,o)),a=p4(ut(t,i,e));return!!(n!==s&&r!==a||n===0&&d4(o,t,e)||s===0&&d4(o,i,e)||r===0&&d4(t,o,i)||a===0&&d4(t,e,i))}function d4(o,e,t){return e.x<=Math.max(o.x,t.x)&&e.x>=Math.min(o.x,t.x)&&e.y<=Math.max(o.y,t.y)&&e.y>=Math.min(o.y,t.y)}function p4(o){return o>0?1:o<0?-1:0}function Ux(o,e){let t=o;do{if(t.i!==o.i&&t.next.i!==o.i&&t.i!==e.i&&t.next.i!==e.i&&Fl(t,t.next,o,e))return!0;t=t.next}while(t!==o);return!1}function $s(o,e){return ut(o.prev,o,o.next)<0?ut(o,e,o.next)>=0&&ut(o,o.prev,e)>=0:ut(o,e,o.prev)<0||ut(o,o.next,e)<0}function Gx(o,e){let t=o,i=!1,n=(o.x+e.x)/2,s=(o.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&n<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==o);return i}function Bl(o,e){let t=new z6(o.i,o.x,o.y),i=new z6(e.i,e.x,e.y),n=o.next,s=e.prev;return o.next=e,e.prev=o,t.next=n,n.prev=t,i.next=t,t.prev=i,s.next=i,i.prev=s,i}function Pl(o,e,t,i){let n=new z6(o,e,t);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function Js(o){o.next.prev=o.prev,o.prev.next=o.next,o.prevZ&&(o.prevZ.nextZ=o.nextZ),o.nextZ&&(o.nextZ.prevZ=o.prevZ)}function z6(o,e,t){this.i=o,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function qx(o,e,t,i){let n=0;for(let s=e,r=t-i;s<t;s+=i)n+=(o[r]-o[s])*(o[s+1]+o[r+1]),r=s;return n}var C2=class{static area(e){let t=e.length,i=0;for(let n=t-1,s=0;s<t;n=s++)i+=e[n].x*e[s].y-e[s].x*e[n].y;return i*.5}static isClockWise(e){return C2.area(e)<0}static triangulateShape(e,t){let i=[],n=[],s=[];Il(e),kl(i,e);let r=e.length;t.forEach(Il);for(let c=0;c<t.length;c++)n.push(r),r+=t[c].length,kl(i,t[c]);let a=Ex.triangulate(i,n);for(let c=0;c<a.length;c+=3)s.push(a.slice(c,c+3));return s}};function Il(o){let e=o.length;e>2&&o[e-1].equals(o[0])&&o.pop()}function kl(o,e){for(let t=0;t<e.length;t++)o.push(e[t].x),o.push(e[t].y)}var Ii=class extends rt{constructor(e=new Yn([new te(.5,.5),new te(-.5,.5),new te(-.5,-.5),new te(.5,-.5)]),t={}){super();this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let i=this,n=[],s=[];for(let a=0,c=e.length;a<c;a++){let l=e[a];r(l)}this.setAttribute("position",new _t(n,3)),this.setAttribute("uv",new _t(s,2)),this.computeVertexNormals();function r(a){let c=[],l=t.curveSegments!==void 0?t.curveSegments:12,h=t.steps!==void 0?t.steps:1,f=t.depth!==void 0?t.depth:1,u=t.bevelEnabled!==void 0?t.bevelEnabled:!0,d=t.bevelThickness!==void 0?t.bevelThickness:.2,p=t.bevelSize!==void 0?t.bevelSize:d-.1,v=t.bevelOffset!==void 0?t.bevelOffset:0,x=t.bevelSegments!==void 0?t.bevelSegments:3,g=t.extrudePath,m=t.UVGenerator!==void 0?t.UVGenerator:Wx;t.amount!==void 0&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),f=t.amount);let z,y=!1,b,S,_,A;g&&(z=g.getSpacedPoints(h),y=!0,u=!1,b=g.computeFrenetFrames(h,!1),S=new B,_=new B,A=new B),u||(x=0,d=0,p=0,v=0);let P=a.extractPoints(l),R=P.shape,w=P.holes;if(!C2.isClockWise(R)){R=R.reverse();for(let J=0,se=w.length;J<se;J++){let ie=w[J];C2.isClockWise(ie)&&(w[J]=ie.reverse())}}let C=C2.triangulateShape(R,w),V=R;for(let J=0,se=w.length;J<se;J++){let ie=w[J];R=R.concat(ie)}function H(J,se,ie){return se||console.error("THREE.ExtrudeGeometry: vec does not exist"),se.clone().multiplyScalar(ie).add(J)}let T=R.length,N=C.length;function I(J,se,ie){let ge,fe,_e,Te=J.x-se.x,ke=J.y-se.y,Ke=ie.x-J.x,Je=ie.y-J.y,F=Te*Te+ke*ke,E=Te*Je-ke*Ke;if(Math.abs(E)>Number.EPSILON){let Q=Math.sqrt(F),re=Math.sqrt(Ke*Ke+Je*Je),ye=se.x-ke/Q,$=se.y+Te/Q,Me=ie.x-Je/re,we=ie.y+Ke/re,he=((Me-ye)*Je-(we-$)*Ke)/(Te*Je-ke*Ke);ge=ye+Te*he-J.x,fe=$+ke*he-J.y;let le=ge*ge+fe*fe;if(le<=2)return new te(ge,fe);_e=Math.sqrt(le/2)}else{let Q=!1;Te>Number.EPSILON?Ke>Number.EPSILON&&(Q=!0):Te<-Number.EPSILON?Ke<-Number.EPSILON&&(Q=!0):Math.sign(ke)===Math.sign(Je)&&(Q=!0),Q?(ge=-ke,fe=Te,_e=Math.sqrt(F)):(ge=Te,fe=ke,_e=Math.sqrt(F/2))}return new te(ge/_e,fe/_e)}let j=[];for(let J=0,se=V.length,ie=se-1,ge=J+1;J<se;J++,ie++,ge++)ie===se&&(ie=0),ge===se&&(ge=0),j[J]=I(V[J],V[ie],V[ge]);let O=[],q,Z=j.concat();for(let J=0,se=w.length;J<se;J++){let ie=w[J];q=[];for(let ge=0,fe=ie.length,_e=fe-1,Te=ge+1;ge<fe;ge++,_e++,Te++)_e===fe&&(_e=0),Te===fe&&(Te=0),q[ge]=I(ie[ge],ie[_e],ie[Te]);O.push(q),Z=Z.concat(q)}for(let J=0;J<x;J++){let se=J/x,ie=d*Math.cos(se*Math.PI/2),ge=p*Math.sin(se*Math.PI/2)+v;for(let fe=0,_e=V.length;fe<_e;fe++){let Te=H(V[fe],j[fe],ge);de(Te.x,Te.y,-ie)}for(let fe=0,_e=w.length;fe<_e;fe++){let Te=w[fe];q=O[fe];for(let ke=0,Ke=Te.length;ke<Ke;ke++){let Je=H(Te[ke],q[ke],ge);de(Je.x,Je.y,-ie)}}}let ne=p+v;for(let J=0;J<T;J++){let se=u?H(R[J],Z[J],ne):R[J];y?(_.copy(b.normals[0]).multiplyScalar(se.x),S.copy(b.binormals[0]).multiplyScalar(se.y),A.copy(z[0]).add(_).add(S),de(A.x,A.y,A.z)):de(se.x,se.y,0)}for(let J=1;J<=h;J++)for(let se=0;se<T;se++){let ie=u?H(R[se],Z[se],ne):R[se];y?(_.copy(b.normals[J]).multiplyScalar(ie.x),S.copy(b.binormals[J]).multiplyScalar(ie.y),A.copy(z[J]).add(_).add(S),de(A.x,A.y,A.z)):de(ie.x,ie.y,f/h*J)}for(let J=x-1;J>=0;J--){let se=J/x,ie=d*Math.cos(se*Math.PI/2),ge=p*Math.sin(se*Math.PI/2)+v;for(let fe=0,_e=V.length;fe<_e;fe++){let Te=H(V[fe],j[fe],ge);de(Te.x,Te.y,f+ie)}for(let fe=0,_e=w.length;fe<_e;fe++){let Te=w[fe];q=O[fe];for(let ke=0,Ke=Te.length;ke<Ke;ke++){let Je=H(Te[ke],q[ke],ge);y?de(Je.x,Je.y+z[h-1].y,z[h-1].x+ie):de(Je.x,Je.y,f+ie)}}}ce(),U();function ce(){let J=n.length/3;if(u){let se=0,ie=T*se;for(let ge=0;ge<N;ge++){let fe=C[ge];ze(fe[2]+ie,fe[1]+ie,fe[0]+ie)}se=h+x*2,ie=T*se;for(let ge=0;ge<N;ge++){let fe=C[ge];ze(fe[0]+ie,fe[1]+ie,fe[2]+ie)}}else{for(let se=0;se<N;se++){let ie=C[se];ze(ie[2],ie[1],ie[0])}for(let se=0;se<N;se++){let ie=C[se];ze(ie[0]+T*h,ie[1]+T*h,ie[2]+T*h)}}i.addGroup(J,n.length/3-J,0)}function U(){let J=n.length/3,se=0;Le(V,se),se+=V.length;for(let ie=0,ge=w.length;ie<ge;ie++){let fe=w[ie];Le(fe,se),se+=fe.length}i.addGroup(J,n.length/3-J,1)}function Le(J,se){let ie=J.length;for(;--ie>=0;){let ge=ie,fe=ie-1;fe<0&&(fe=J.length-1);for(let _e=0,Te=h+x*2;_e<Te;_e++){let ke=T*_e,Ke=T*(_e+1),Je=se+ge+ke,F=se+fe+ke,E=se+fe+Ke,Q=se+ge+Ke;ue(Je,F,E,Q)}}}function de(J,se,ie){c.push(J),c.push(se),c.push(ie)}function ze(J,se,ie){De(J),De(se),De(ie);let ge=n.length/3,fe=m.generateTopUV(i,n,ge-3,ge-2,ge-1);Se(fe[0]),Se(fe[1]),Se(fe[2])}function ue(J,se,ie,ge){De(J),De(se),De(ge),De(se),De(ie),De(ge);let fe=n.length/3,_e=m.generateSideWallUV(i,n,fe-6,fe-3,fe-2,fe-1);Se(_e[0]),Se(_e[1]),Se(_e[3]),Se(_e[1]),Se(_e[2]),Se(_e[3])}function De(J){n.push(c[J*3+0]),n.push(c[J*3+1]),n.push(c[J*3+2])}function Se(J){s.push(J.x),s.push(J.y)}}}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,i=this.parameters.options;return jx(t,i,e)}static fromJSON(e,t){let i=[];for(let s=0,r=e.shapes.length;s<r;s++){let a=t[e.shapes[s]];i.push(a)}let n=e.options.extrudePath;return n!==void 0&&(e.options.extrudePath=new Vl[n.type]().fromJSON(n)),new Ii(i,e.options)}},Wx={generateTopUV:function(o,e,t,i,n){let s=e[t*3],r=e[t*3+1],a=e[i*3],c=e[i*3+1],l=e[n*3],h=e[n*3+1];return[new te(s,r),new te(a,c),new te(l,h)]},generateSideWallUV:function(o,e,t,i,n,s){let r=e[t*3],a=e[t*3+1],c=e[t*3+2],l=e[i*3],h=e[i*3+1],f=e[i*3+2],u=e[n*3],d=e[n*3+1],p=e[n*3+2],v=e[s*3],x=e[s*3+1],g=e[s*3+2];return Math.abs(a-h)<Math.abs(r-l)?[new te(r,1-c),new te(l,1-f),new te(u,1-p),new te(v,1-g)]:[new te(a,1-c),new te(h,1-f),new te(d,1-p),new te(x,1-g)]}};function jx(o,e,t){if(t.shapes=[],Array.isArray(o))for(let i=0,n=o.length;i<n;i++){let s=o[i];t.shapes.push(s.uuid)}else t.shapes.push(o.uuid);return e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}var m4=class extends rt{constructor(e=new Yn([new te(0,.5),new te(-.5,-.5),new te(.5,-.5)]),t=12){super();this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};let i=[],n=[],s=[],r=[],a=0,c=0;if(Array.isArray(e)===!1)l(e);else for(let h=0;h<e.length;h++)l(e[h]),this.addGroup(a,c,h),a+=c,c=0;this.setIndex(i),this.setAttribute("position",new _t(n,3)),this.setAttribute("normal",new _t(s,3)),this.setAttribute("uv",new _t(r,2));function l(h){let f=n.length/3,u=h.extractPoints(t),d=u.shape,p=u.holes;C2.isClockWise(d)===!1&&(d=d.reverse());for(let x=0,g=p.length;x<g;x++){let m=p[x];C2.isClockWise(m)===!0&&(p[x]=m.reverse())}let v=C2.triangulateShape(d,p);for(let x=0,g=p.length;x<g;x++){let m=p[x];d=d.concat(m)}for(let x=0,g=d.length;x<g;x++){let m=d[x];n.push(m.x,m.y,0),s.push(0,0,1),r.push(m.x,m.y)}for(let x=0,g=v.length;x<g;x++){let m=v[x],z=m[0]+f,y=m[1]+f,b=m[2]+f;i.push(z,y,b),c+=3}}}toJSON(){let e=super.toJSON(),t=this.parameters.shapes;return Zx(t,e)}static fromJSON(e,t){let i=[];for(let n=0,s=e.shapes.length;n<s;n++){let r=t[e.shapes[n]];i.push(r)}return new m4(i,e.curveSegments)}};function Zx(o,e){if(e.shapes=[],Array.isArray(o))for(let t=0,i=o.length;t<i;t++){let n=o[t];e.shapes.push(n.uuid)}else e.shapes.push(o.uuid);return e}var g4=class extends St{constructor(e){super();this.type="ShadowMaterial",this.color=new xe(0),this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this}};g4.prototype.isShadowMaterial=!0;var C6=class extends St{constructor(e){super();this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new xe(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=yn,this.normalScale=new te(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this}};C6.prototype.isMeshStandardMaterial=!0;var Ol=class extends C6{constructor(e){super();this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new te(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Jt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.sheenColor=new xe(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new xe(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new xe(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._transmission=0,this.setValues(e)}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}};Ol.prototype.isMeshPhysicalMaterial=!0;var Ul=class extends St{constructor(e){super();this.type="MeshPhongMaterial",this.color=new xe(16777215),this.specular=new xe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=yn,this.normalScale=new te(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=fa,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this}};Ul.prototype.isMeshPhongMaterial=!0;var Gl=class extends St{constructor(e){super();this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new xe(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=yn,this.normalScale=new te(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}};Gl.prototype.isMeshToonMaterial=!0;var ql=class extends St{constructor(e){super();this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=yn,this.normalScale=new te(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}};ql.prototype.isMeshNormalMaterial=!0;var Wl=class extends St{constructor(e){super();this.type="MeshLambertMaterial",this.color=new xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=fa,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}};Wl.prototype.isMeshLambertMaterial=!0;var jl=class extends St{constructor(e){super();this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new xe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=yn,this.normalScale=new te(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this}};jl.prototype.isMeshMatcapMaterial=!0;var Zl=class extends Xn{constructor(e){super();this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}};Zl.prototype.isLineDashedMaterial=!0;var ct={arraySlice:function(o,e,t){return ct.isTypedArray(o)?new o.constructor(o.subarray(e,t!==void 0?t:o.length)):o.slice(e,t)},convertArray:function(o,e,t){return!o||!t&&o.constructor===e?o:typeof e.BYTES_PER_ELEMENT=="number"?new e(o):Array.prototype.slice.call(o)},isTypedArray:function(o){return ArrayBuffer.isView(o)&&!(o instanceof DataView)},getKeyframeOrder:function(o){function e(n,s){return o[n]-o[s]}let t=o.length,i=new Array(t);for(let n=0;n!==t;++n)i[n]=n;return i.sort(e),i},sortedArray:function(o,e,t){let i=o.length,n=new o.constructor(i);for(let s=0,r=0;r!==i;++s){let a=t[s]*e;for(let c=0;c!==e;++c)n[r++]=o[a+c]}return n},flattenJSON:function(o,e,t,i){let n=1,s=o[0];for(;s!==void 0&&s[i]===void 0;)s=o[n++];if(s===void 0)return;let r=s[i];if(r!==void 0)if(Array.isArray(r))do r=s[i],r!==void 0&&(e.push(s.time),t.push.apply(t,r)),s=o[n++];while(s!==void 0);else if(r.toArray!==void 0)do r=s[i],r!==void 0&&(e.push(s.time),r.toArray(t,t.length)),s=o[n++];while(s!==void 0);else do r=s[i],r!==void 0&&(e.push(s.time),t.push(r)),s=o[n++];while(s!==void 0)},subclip:function(o,e,t,i,n=30){let s=o.clone();s.name=e;let r=[];for(let c=0;c<s.tracks.length;++c){let l=s.tracks[c],h=l.getValueSize(),f=[],u=[];for(let d=0;d<l.times.length;++d){let p=l.times[d]*n;if(!(p<t||p>=i)){f.push(l.times[d]);for(let v=0;v<h;++v)u.push(l.values[d*h+v])}}f.length!==0&&(l.times=ct.convertArray(f,l.times.constructor),l.values=ct.convertArray(u,l.values.constructor),r.push(l))}s.tracks=r;let a=1/0;for(let c=0;c<s.tracks.length;++c)a>s.tracks[c].times[0]&&(a=s.tracks[c].times[0]);for(let c=0;c<s.tracks.length;++c)s.tracks[c].shift(-1*a);return s.resetDuration(),s},makeClipAdditive:function(o,e=0,t=o,i=30){i<=0&&(i=30);let n=t.tracks.length,s=e/i;for(let r=0;r<n;++r){let a=t.tracks[r],c=a.ValueTypeName;if(c==="bool"||c==="string")continue;let l=o.tracks.find(function(g){return g.name===a.name&&g.ValueTypeName===c});if(l===void 0)continue;let h=0,f=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=f/3);let u=0,d=l.getValueSize();l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=d/3);let p=a.times.length-1,v;if(s<=a.times[0]){let g=h,m=f-h;v=ct.arraySlice(a.values,g,m)}else if(s>=a.times[p]){let g=p*f+h,m=g+f-h;v=ct.arraySlice(a.values,g,m)}else{let g=a.createInterpolant(),m=h,z=f-h;g.evaluate(s),v=ct.arraySlice(g.resultBuffer,m,z)}c==="quaternion"&&new Gt().fromArray(v).normalize().conjugate().toArray(v);let x=l.times.length;for(let g=0;g<x;++g){let m=g*d+u;if(c==="quaternion")Gt.multiplyQuaternionsFlat(l.values,m,v,0,l.values,m);else{let z=d-u*2;for(let y=0;y<z;++y)l.values[m+y]-=v[y]}}}return o.blendMode=s5,o}},A2=class{constructor(e,t,i,n){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=n!==void 0?n:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,i=this._cachedIndex,n=t[i],s=t[i-1];e:{t:{let r;i:{n:if(!(e<n)){for(let a=i+2;;){if(n===void 0){if(e<s)break n;return i=t.length,this._cachedIndex=i,this.afterEnd_(i-1,e,s)}if(i===a)break;if(s=n,n=t[++i],e<n)break t}r=t.length;break i}if(!(e>=s)){let a=t[1];e<a&&(i=2,s=a);for(let c=i-2;;){if(s===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,n);if(i===c)break;if(n=s,s=t[--i-1],e>=s)break t}r=i,i=0;break i}break e}for(;i<r;){let a=i+r>>>1;e<t[a]?r=a:i=a+1}if(n=t[i],s=t[i-1],s===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,n);if(n===void 0)return i=t.length,this._cachedIndex=i,this.afterEnd_(i-1,s,e)}this._cachedIndex=i,this.intervalChanged_(i,s,n)}return this.interpolate_(i,s,e,n)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,i=this.sampleValues,n=this.valueSize,s=e*n;for(let r=0;r!==n;++r)t[r]=i[s+r];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}};A2.prototype.beforeStart_=A2.prototype.copySampleValue_;A2.prototype.afterEnd_=A2.prototype.copySampleValue_;var Xl=class extends A2{constructor(e,t,i,n){super(e,t,i,n);this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:vn,endingEnd:vn}}intervalChanged_(e,t,i){let n=this.parameterPositions,s=e-2,r=e+1,a=n[s],c=n[r];if(a===void 0)switch(this.getSettings_().endingStart){case xn:s=e,a=2*t-i;break;case xa:s=n.length-2,a=t+n[s]-n[s+1];break;default:s=e,a=i}if(c===void 0)switch(this.getSettings_().endingEnd){case xn:r=e,c=2*i-t;break;case xa:r=1,c=i+n[1]-n[0];break;default:r=e-1,c=t}let l=(i-t)*.5,h=this.valueSize;this._weightPrev=l/(t-a),this._weightNext=l/(c-i),this._offsetPrev=s*h,this._offsetNext=r*h}interpolate_(e,t,i,n){let s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,c=e*a,l=c-a,h=this._offsetPrev,f=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(i-t)/(n-t),v=p*p,x=v*p,g=-u*x+2*u*v-u*p,m=(1+u)*x+(-1.5-2*u)*v+(-.5+u)*p+1,z=(-1-d)*x+(1.5+d)*v+.5*p,y=d*x-d*v;for(let b=0;b!==a;++b)s[b]=g*r[h+b]+m*r[l+b]+z*r[c+b]+y*r[f+b];return s}},A6=class extends A2{constructor(e,t,i,n){super(e,t,i,n)}interpolate_(e,t,i,n){let s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,c=e*a,l=c-a,h=(i-t)/(n-t),f=1-h;for(let u=0;u!==a;++u)s[u]=r[l+u]*f+r[c+u]*h;return s}},Yl=class extends A2{constructor(e,t,i,n){super(e,t,i,n)}interpolate_(e){return this.copySampleValue_(e-1)}},E1=class{constructor(e,t,i,n){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=ct.convertArray(t,this.TimeBufferType),this.values=ct.convertArray(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,i;if(t.toJSON!==this.toJSON)i=t.toJSON(e);else{i={name:e.name,times:ct.convertArray(e.times,Array),values:ct.convertArray(e.values,Array)};let n=e.getInterpolation();n!==e.DefaultInterpolation&&(i.interpolation=n)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new Yl(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new A6(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Xl(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case ga:t=this.InterpolantFactoryMethodDiscrete;break;case va:t=this.InterpolantFactoryMethodLinear;break;case wo:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){let i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(i);return console.warn("THREE.KeyframeTrack:",i),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ga;case this.InterpolantFactoryMethodLinear:return va;case this.InterpolantFactoryMethodSmooth:return wo}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let i=0,n=t.length;i!==n;++i)t[i]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let i=0,n=t.length;i!==n;++i)t[i]*=e}return this}trim(e,t){let i=this.times,n=i.length,s=0,r=n-1;for(;s!==n&&i[s]<e;)++s;for(;r!==-1&&i[r]>t;)--r;if(++r,s!==0||r!==n){s>=r&&(r=Math.max(r,1),s=r-1);let a=this.getValueSize();this.times=ct.arraySlice(i,s,r),this.values=ct.arraySlice(this.values,s*a,r*a)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);let i=this.times,n=this.values,s=i.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let r=null;for(let a=0;a!==s;a++){let c=i[a];if(typeof c=="number"&&isNaN(c)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,c),e=!1;break}if(r!==null&&r>c){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,c,r),e=!1;break}r=c}if(n!==void 0&&ct.isTypedArray(n))for(let a=0,c=n.length;a!==c;++a){let l=n[a];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,l),e=!1;break}}return e}optimize(){let e=ct.arraySlice(this.times),t=ct.arraySlice(this.values),i=this.getValueSize(),n=this.getInterpolation()===wo,s=e.length-1,r=1;for(let a=1;a<s;++a){let c=!1,l=e[a],h=e[a+1];if(l!==h&&(a!==1||l!==e[0]))if(n)c=!0;else{let f=a*i,u=f-i,d=f+i;for(let p=0;p!==i;++p){let v=t[f+p];if(v!==t[u+p]||v!==t[d+p]){c=!0;break}}}if(c){if(a!==r){e[r]=e[a];let f=a*i,u=r*i;for(let d=0;d!==i;++d)t[u+d]=t[f+d]}++r}}if(s>0){e[r]=e[s];for(let a=s*i,c=r*i,l=0;l!==i;++l)t[c+l]=t[a+l];++r}return r!==e.length?(this.times=ct.arraySlice(e,0,r),this.values=ct.arraySlice(t,0,r*i)):(this.times=e,this.values=t),this}clone(){let e=ct.arraySlice(this.times,0),t=ct.arraySlice(this.values,0),i=this.constructor,n=new i(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}};E1.prototype.TimeBufferType=Float32Array;E1.prototype.ValueBufferType=Float32Array;E1.prototype.DefaultInterpolation=va;var ki=class extends E1{};ki.prototype.ValueTypeName="bool";ki.prototype.ValueBufferType=Array;ki.prototype.DefaultInterpolation=ga;ki.prototype.InterpolantFactoryMethodLinear=void 0;ki.prototype.InterpolantFactoryMethodSmooth=void 0;var S6=class extends E1{};S6.prototype.ValueTypeName="color";var Qs=class extends E1{};Qs.prototype.ValueTypeName="number";var $l=class extends A2{constructor(e,t,i,n){super(e,t,i,n)}interpolate_(e,t,i,n){let s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,c=(i-t)/(n-t),l=e*a;for(let h=l+a;l!==h;l+=4)Gt.slerpFlat(s,0,r,l-a,r,l,c);return s}},Jn=class extends E1{InterpolantFactoryMethodLinear(e){return new $l(this.times,this.values,this.getValueSize(),e)}};Jn.prototype.ValueTypeName="quaternion";Jn.prototype.DefaultInterpolation=va;Jn.prototype.InterpolantFactoryMethodSmooth=void 0;var Oi=class extends E1{};Oi.prototype.ValueTypeName="string";Oi.prototype.ValueBufferType=Array;Oi.prototype.DefaultInterpolation=ga;Oi.prototype.InterpolantFactoryMethodLinear=void 0;Oi.prototype.InterpolantFactoryMethodSmooth=void 0;var Ks=class extends E1{};Ks.prototype.ValueTypeName="vector";var _6=class{constructor(e,t=-1,i,n=bo){this.name=e,this.tracks=i,this.duration=t,this.blendMode=n,this.uuid=C1(),this.duration<0&&this.resetDuration()}static parse(e){let t=[],i=e.tracks,n=1/(e.fps||1);for(let r=0,a=i.length;r!==a;++r)t.push(Yx(i[r]).scale(n));let s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){let t=[],i=e.tracks,n={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,r=i.length;s!==r;++s)t.push(E1.toJSON(i[s]));return n}static CreateFromMorphTargetSequence(e,t,i,n){let s=t.length,r=[];for(let a=0;a<s;a++){let c=[],l=[];c.push((a+s-1)%s,a,(a+1)%s),l.push(0,1,0);let h=ct.getKeyframeOrder(c);c=ct.sortedArray(c,1,h),l=ct.sortedArray(l,1,h),!n&&c[0]===0&&(c.push(s),l.push(l[0])),r.push(new Qs(".morphTargetInfluences["+t[a].name+"]",c,l).scale(1/i))}return new this(e,-1,r)}static findByName(e,t){let i=e;if(!Array.isArray(e)){let n=e;i=n.geometry&&n.geometry.animations||n.animations}for(let n=0;n<i.length;n++)if(i[n].name===t)return i[n];return null}static CreateClipsFromMorphTargetSequences(e,t,i){let n={},s=/^([\w-]*?)([\d]+)$/;for(let a=0,c=e.length;a<c;a++){let l=e[a],h=l.name.match(s);if(h&&h.length>1){let f=h[1],u=n[f];u||(n[f]=u=[]),u.push(l)}}let r=[];for(let a in n)r.push(this.CreateFromMorphTargetSequence(a,n[a],t,i));return r}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;let i=function(f,u,d,p,v){if(d.length!==0){let x=[],g=[];ct.flattenJSON(d,x,g,p),x.length!==0&&v.push(new f(u,x,g))}},n=[],s=e.name||"default",r=e.fps||30,a=e.blendMode,c=e.length||-1,l=e.hierarchy||[];for(let f=0;f<l.length;f++){let u=l[f].keys;if(!(!u||u.length===0))if(u[0].morphTargets){let d={},p;for(p=0;p<u.length;p++)if(u[p].morphTargets)for(let v=0;v<u[p].morphTargets.length;v++)d[u[p].morphTargets[v]]=-1;for(let v in d){let x=[],g=[];for(let m=0;m!==u[p].morphTargets.length;++m){let z=u[p];x.push(z.time),g.push(z.morphTarget===v?1:0)}n.push(new Qs(".morphTargetInfluence["+v+"]",x,g))}c=d.length*(r||1)}else{let d=".bones["+t[f].name+"]";i(Ks,d+".position",u,"pos",n),i(Jn,d+".quaternion",u,"rot",n),i(Ks,d+".scale",u,"scl",n)}}return n.length===0?null:new this(s,c,n,a)}resetDuration(){let e=this.tracks,t=0;for(let i=0,n=e.length;i!==n;++i){let s=this.tracks[i];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){let e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}};function Xx(o){switch(o.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Qs;case"vector":case"vector2":case"vector3":case"vector4":return Ks;case"color":return S6;case"quaternion":return Jn;case"bool":case"boolean":return ki;case"string":return Oi}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+o)}function Yx(o){if(o.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");let e=Xx(o.type);if(o.times===void 0){let t=[],i=[];ct.flattenJSON(o.keys,t,i,"value"),o.times=t,o.values=i}return e.parse!==void 0?e.parse(o):new e(o.name,o.times,o.values,o.interpolation)}var Qn={enabled:!1,files:{},add:function(o,e){this.enabled!==!1&&(this.files[o]=e)},get:function(o){if(this.enabled!==!1)return this.files[o]},remove:function(o){delete this.files[o]},clear:function(){this.files={}}},Jl=class{constructor(e,t,i){let n=this,s=!1,r=0,a=0,c,l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(h){a++,s===!1&&n.onStart!==void 0&&n.onStart(h,r,a),s=!0},this.itemEnd=function(h){r++,n.onProgress!==void 0&&n.onProgress(h,r,a),r===a&&(s=!1,n.onLoad!==void 0&&n.onLoad())},this.itemError=function(h){n.onError!==void 0&&n.onError(h)},this.resolveURL=function(h){return c?c(h):h},this.setURLModifier=function(h){return c=h,this},this.addHandler=function(h,f){return l.push(h,f),this},this.removeHandler=function(h){let f=l.indexOf(h);return f!==-1&&l.splice(f,2),this},this.getHandler=function(h){for(let f=0,u=l.length;f<u;f+=2){let d=l[f],p=l[f+1];if(d.global&&(d.lastIndex=0),d.test(h))return p}return null}}},$x=new Jl,S2=class{constructor(e){this.manager=e!==void 0?e:$x,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){let i=this;return new Promise(function(n,s){i.load(e,n,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}},_2={},Ql=class extends S2{constructor(e){super(e)}load(e,t,i,n){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=Qn.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(_2[e]!==void 0){_2[e].push({onLoad:t,onProgress:i,onError:n});return}_2[e]=[],_2[e].push({onLoad:t,onProgress:i,onError:n});let r=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,c=this.responseType;fetch(r).then(l=>{if(l.status===200||l.status===0){if(l.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream=="undefined"||l.body.getReader===void 0)return l;let h=_2[e],f=l.body.getReader(),u=l.headers.get("Content-Length"),d=u?parseInt(u):0,p=d!==0,v=0,x=new ReadableStream({start(g){m();function m(){f.read().then(({done:z,value:y})=>{if(z)g.close();else{v+=y.byteLength;let b=new ProgressEvent("progress",{lengthComputable:p,loaded:v,total:d});for(let S=0,_=h.length;S<_;S++){let A=h[S];A.onProgress&&A.onProgress(b)}g.enqueue(y),m()}})}}});return new Response(x)}else throw Error(`fetch for "${l.url}" responded with ${l.status}: ${l.statusText}`)}).then(l=>{switch(c){case"arraybuffer":return l.arrayBuffer();case"blob":return l.blob();case"document":return l.text().then(h=>new DOMParser().parseFromString(h,a));case"json":return l.json();default:if(a===void 0)return l.text();{let f=/charset="?([^;"\s]*)"?/i.exec(a),u=f&&f[1]?f[1].toLowerCase():void 0,d=new TextDecoder(u);return l.arrayBuffer().then(p=>d.decode(p))}}}).then(l=>{Qn.add(e,l);let h=_2[e];delete _2[e];for(let f=0,u=h.length;f<u;f++){let d=h[f];d.onLoad&&d.onLoad(l)}}).catch(l=>{let h=_2[e];if(h===void 0)throw this.manager.itemError(e),l;delete _2[e];for(let f=0,u=h.length;f<u;f++){let d=h[f];d.onError&&d.onError(l)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}};var E6=class extends S2{constructor(e){super(e)}load(e,t,i,n){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,r=Qn.get(e);if(r!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(r),s.manager.itemEnd(e)},0),r;let a=Ds("img");function c(){h(),Qn.add(e,this),t&&t(this),s.manager.itemEnd(e)}function l(f){h(),n&&n(f),s.manager.itemError(e),s.manager.itemEnd(e)}function h(){a.removeEventListener("load",c,!1),a.removeEventListener("error",l,!1)}return a.addEventListener("load",c,!1),a.addEventListener("error",l,!1),e.substr(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}},Kl=class extends S2{constructor(e){super(e)}load(e,t,i,n){let s=new Ns,r=new E6(this.manager);r.setCrossOrigin(this.crossOrigin),r.setPath(this.path);let a=0;function c(l){r.load(e[l],function(h){s.images[l]=h,a++,a===6&&(s.needsUpdate=!0,t&&t(s))},void 0,n)}for(let l=0;l<e.length;++l)c(l);return s}};var eh=class extends S2{constructor(e){super(e)}load(e,t,i,n){let s=new vt,r=new E6(this.manager);return r.setCrossOrigin(this.crossOrigin),r.setPath(this.path),r.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},i,n),s}},L1=class extends We{constructor(e,t=1){super();this.type="Light",this.color=new xe(e),this.intensity=t}dispose(){}copy(e){return super.copy(e),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}};L1.prototype.isLight=!0;var th=class extends L1{constructor(e,t,i){super(e,i);this.type="HemisphereLight",this.position.copy(We.DefaultUp),this.updateMatrix(),this.groundColor=new xe(t)}copy(e){return L1.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}};th.prototype.isHemisphereLight=!0;var ih=new Ce,nh=new B,sh=new B,v4=class{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new te(512,512),this.map=null,this.mapPass=null,this.matrix=new Ce,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Fs,this._frameExtents=new te(1,1),this._viewportCount=1,this._viewports=[new Qe(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,i=this.matrix;nh.setFromMatrixPosition(e.matrixWorld),t.position.copy(nh),sh.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(sh),t.updateMatrixWorld(),ih.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ih),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(t.projectionMatrix),i.multiply(t.matrixWorldInverse)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},L6=class extends v4{constructor(){super(new Nt(50,1,.5,500));this.focus=1}updateMatrices(e){let t=this.camera,i=Ao*2*e.angle*this.focus,n=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(i!==t.fov||n!==t.aspect||s!==t.far)&&(t.fov=i,t.aspect=n,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}};L6.prototype.isSpotLightShadow=!0;var x4=class extends L1{constructor(e,t,i=0,n=Math.PI/3,s=0,r=1){super(e,t);this.type="SpotLight",this.position.copy(We.DefaultUp),this.updateMatrix(),this.target=new We,this.distance=i,this.angle=n,this.penumbra=s,this.decay=r,this.shadow=new L6}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}};x4.prototype.isSpotLight=!0;var rh=new Ce,er=new B,T6=new B,D6=class extends v4{constructor(){super(new Nt(90,1,.5,500));this._frameExtents=new te(4,2),this._viewportCount=6,this._viewports=[new Qe(2,1,1,1),new Qe(0,1,1,1),new Qe(3,1,1,1),new Qe(1,1,1,1),new Qe(3,0,1,1),new Qe(1,0,1,1)],this._cubeDirections=[new B(1,0,0),new B(-1,0,0),new B(0,0,1),new B(0,0,-1),new B(0,1,0),new B(0,-1,0)],this._cubeUps=[new B(0,1,0),new B(0,1,0),new B(0,1,0),new B(0,1,0),new B(0,0,1),new B(0,0,-1)]}updateMatrices(e,t=0){let i=this.camera,n=this.matrix,s=e.distance||i.far;s!==i.far&&(i.far=s,i.updateProjectionMatrix()),er.setFromMatrixPosition(e.matrixWorld),i.position.copy(er),T6.copy(i.position),T6.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(T6),i.updateMatrixWorld(),n.makeTranslation(-er.x,-er.y,-er.z),rh.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(rh)}};D6.prototype.isPointLightShadow=!0;var ah=class extends L1{constructor(e,t,i=0,n=1){super(e,t);this.type="PointLight",this.distance=i,this.decay=n,this.shadow=new D6}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}};ah.prototype.isPointLight=!0;var H6=class extends v4{constructor(){super(new Ua(-5,5,5,-5,.5,500))}};H6.prototype.isDirectionalLightShadow=!0;var oh=class extends L1{constructor(e,t){super(e,t);this.type="DirectionalLight",this.position.copy(We.DefaultUp),this.updateMatrix(),this.target=new We,this.shadow=new H6}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}};oh.prototype.isDirectionalLight=!0;var y4=class extends L1{constructor(e,t){super(e,t);this.type="AmbientLight"}};y4.prototype.isAmbientLight=!0;var ch=class extends L1{constructor(e,t,i=10,n=10){super(e,t);this.type="RectAreaLight",this.width=i,this.height=n}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){let t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}};ch.prototype.isRectAreaLight=!0;var V6=class{constructor(){this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new B)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){let i=e.x,n=e.y,s=e.z,r=this.coefficients;return t.copy(r[0]).multiplyScalar(.282095),t.addScaledVector(r[1],.488603*n),t.addScaledVector(r[2],.488603*s),t.addScaledVector(r[3],.488603*i),t.addScaledVector(r[4],1.092548*(i*n)),t.addScaledVector(r[5],1.092548*(n*s)),t.addScaledVector(r[6],.315392*(3*s*s-1)),t.addScaledVector(r[7],1.092548*(i*s)),t.addScaledVector(r[8],.546274*(i*i-n*n)),t}getIrradianceAt(e,t){let i=e.x,n=e.y,s=e.z,r=this.coefficients;return t.copy(r[0]).multiplyScalar(.886227),t.addScaledVector(r[1],2*.511664*n),t.addScaledVector(r[2],2*.511664*s),t.addScaledVector(r[3],2*.511664*i),t.addScaledVector(r[4],2*.429043*i*n),t.addScaledVector(r[5],2*.429043*n*s),t.addScaledVector(r[6],.743125*s*s-.247708),t.addScaledVector(r[7],2*.429043*i*s),t.addScaledVector(r[8],.429043*(i*i-n*n)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let i=0;i<9;i++)this.coefficients[i].addScaledVector(e.coefficients[i],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let i=0;i<9;i++)this.coefficients[i].lerp(e.coefficients[i],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){let i=this.coefficients;for(let n=0;n<9;n++)i[n].fromArray(e,t+n*3);return this}toArray(e=[],t=0){let i=this.coefficients;for(let n=0;n<9;n++)i[n].toArray(e,t+n*3);return e}static getBasisAt(e,t){let i=e.x,n=e.y,s=e.z;t[0]=.282095,t[1]=.488603*n,t[2]=.488603*s,t[3]=.488603*i,t[4]=1.092548*i*n,t[5]=1.092548*n*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*i*s,t[8]=.546274*(i*i-n*n)}};V6.prototype.isSphericalHarmonics3=!0;var w4=class extends L1{constructor(e=new V6,t=1){super(void 0,t);this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){let t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}};w4.prototype.isLightProbe=!0;var lh=class{static decodeText(e){if(typeof TextDecoder!="undefined")return new TextDecoder().decode(e);let t="";for(let i=0,n=e.length;i<n;i++)t+=String.fromCharCode(e[i]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){let t=e.lastIndexOf("/");return t===-1?"./":e.substr(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}},hh=class extends rt{constructor(){super();this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}clone(){return new this.constructor().copy(this)}toJSON(){let e=super.toJSON(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}};hh.prototype.isInstancedBufferGeometry=!0;var uh=class extends S2{constructor(e){super(e);typeof createImageBitmap=="undefined"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch=="undefined"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,i,n){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,r=Qn.get(e);if(r!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(r),s.manager.itemEnd(e)},0),r;let a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,fetch(e,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){Qn.add(e,c),t&&t(c),s.manager.itemEnd(e)}).catch(function(c){n&&n(c),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}};uh.prototype.isImageBitmapLoader=!0;var b4,Jx={getContext:function(){return b4===void 0&&(b4=new(window.AudioContext||window.webkitAudioContext)),b4},setContext:function(o){b4=o}},fh=class extends S2{constructor(e){super(e)}load(e,t,i,n){let s=this,r=new Ql(this.manager);r.setResponseType("arraybuffer"),r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,function(a){try{let c=a.slice(0);Jx.getContext().decodeAudioData(c,function(h){t(h)})}catch(c){n?n(c):console.error(c),s.manager.itemError(e)}},i,n)}},dh=class extends w4{constructor(e,t,i=1){super(void 0,i);let n=new xe().set(e),s=new xe().set(t),r=new B(n.r,n.g,n.b),a=new B(s.r,s.g,s.b),c=Math.sqrt(Math.PI),l=c*Math.sqrt(.75);this.sh.coefficients[0].copy(r).add(a).multiplyScalar(c),this.sh.coefficients[1].copy(r).sub(a).multiplyScalar(l)}};dh.prototype.isHemisphereLightProbe=!0;var ph=class extends w4{constructor(e,t=1){super(void 0,t);let i=new xe().set(e);this.sh.coefficients[0].set(i.r,i.g,i.b).multiplyScalar(2*Math.sqrt(Math.PI))}};ph.prototype.isAmbientLightProbe=!0;var mh=class extends We{constructor(e){super();this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;let t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){if(this.detune=e,this.source.detune!==void 0)return this.isPlaying===!0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}};var gh=class{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0,t=this.getFrequencyData();for(let i=0;i<t.length;i++)e+=t[i];return e/t.length}},vh=class{constructor(e,t,i){this.binding=e,this.valueSize=i;let n,s,r;switch(t){case"quaternion":n=this._slerp,s=this._slerpAdditive,r=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(i*6),this._workIndex=5;break;case"string":case"bool":n=this._select,s=this._select,r=this._setAdditiveIdentityOther,this.buffer=new Array(i*5);break;default:n=this._lerp,s=this._lerpAdditive,r=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(i*5)}this._mixBufferRegion=n,this._mixBufferRegionAdditive=s,this._setIdentity=r,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){let i=this.buffer,n=this.valueSize,s=e*n+n,r=this.cumulativeWeight;if(r===0){for(let a=0;a!==n;++a)i[s+a]=i[a];r=t}else{r+=t;let a=t/r;this._mixBufferRegion(i,s,0,a,n)}this.cumulativeWeight=r}accumulateAdditive(e){let t=this.buffer,i=this.valueSize,n=i*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,n,0,e,i),this.cumulativeWeightAdditive+=e}apply(e){let t=this.valueSize,i=this.buffer,n=e*t+t,s=this.cumulativeWeight,r=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){let c=t*this._origIndex;this._mixBufferRegion(i,n,c,1-s,t)}r>0&&this._mixBufferRegionAdditive(i,n,this._addIndex*t,1,t);for(let c=t,l=t+t;c!==l;++c)if(i[c]!==i[c+t]){a.setValue(i,n);break}}saveOriginalState(){let e=this.binding,t=this.buffer,i=this.valueSize,n=i*this._origIndex;e.getValue(t,n);for(let s=i,r=n;s!==r;++s)t[s]=t[n+s%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){let e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let i=e;i<t;i++)this.buffer[i]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let i=0;i<this.valueSize;i++)this.buffer[t+i]=this.buffer[e+i]}_select(e,t,i,n,s){if(n>=.5)for(let r=0;r!==s;++r)e[t+r]=e[i+r]}_slerp(e,t,i,n){Gt.slerpFlat(e,t,e,t,e,i,n)}_slerpAdditive(e,t,i,n,s){let r=this._workIndex*s;Gt.multiplyQuaternionsFlat(e,r,e,t,e,i),Gt.slerpFlat(e,t,e,t,e,r,n)}_lerp(e,t,i,n,s){let r=1-n;for(let a=0;a!==s;++a){let c=t+a;e[c]=e[c]*r+e[i+a]*n}}_lerpAdditive(e,t,i,n,s){for(let r=0;r!==s;++r){let a=t+r;e[a]=e[a]+e[i+r]*n}}},R6="\\[\\]\\.:\\/",Qx=new RegExp("["+R6+"]","g"),N6="[^"+R6+"]",Kx="[^"+R6.replace("\\.","")+"]",ey=/((?:WC+[\/:])*)/.source.replace("WC",N6),ty=/(WCOD+)?/.source.replace("WCOD",Kx),iy=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",N6),ny=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",N6),sy=new RegExp("^"+ey+ty+iy+ny+"$"),ry=["material","materials","bones"],xh=class{constructor(e,t,i){let n=i||Ue.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,n)}getValue(e,t){this.bind();let i=this._targetGroup.nCachedObjects_,n=this._bindings[i];n!==void 0&&n.getValue(e,t)}setValue(e,t){let i=this._bindings;for(let n=this._targetGroup.nCachedObjects_,s=i.length;n!==s;++n)i[n].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}},Ue=class{constructor(e,t,i){this.path=t,this.parsedPath=i||Ue.parseTrackName(t),this.node=Ue.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new Ue.Composite(e,t,i):new Ue(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Qx,"")}static parseTrackName(e){let t=sy.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},n=i.nodeName&&i.nodeName.lastIndexOf(".");if(n!==void 0&&n!==-1){let s=i.nodeName.substring(n+1);ry.indexOf(s)!==-1&&(i.nodeName=i.nodeName.substring(0,n),i.objectName=s)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(!t||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){let i=function(s){for(let r=0;r<s.length;r++){let a=s[r];if(a.name===t||a.uuid===t)return a;let c=i(a.children);if(c)return c}return null},n=i(e.children);if(n)return n}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let i=this.resolvedProperty;for(let n=0,s=i.length;n!==s;++n)e[t++]=i[n]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let i=this.resolvedProperty;for(let n=0,s=i.length;n!==s;++n)i[n]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let i=this.resolvedProperty;for(let n=0,s=i.length;n!==s;++n)i[n]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let i=this.resolvedProperty;for(let n=0,s=i.length;n!==s;++n)i[n]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,i=t.objectName,n=t.propertyName,s=t.propertyIndex;if(e||(e=Ue.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");return}if(i){let l=t.objectIndex;switch(i){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let h=0;h<e.length;h++)if(e[h].name===l){l=h;break}break;default:if(e[i]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[i]}if(l!==void 0){if(e[l]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[l]}}let r=e[n];if(r===void 0){let l=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+l+"."+n+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?a=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(s!==void 0){if(n==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(e.geometry.isBufferGeometry){if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}else{console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);return}}c=this.BindingType.ArrayElement,this.resolvedProperty=r,this.propertyIndex=s}else r.fromArray!==void 0&&r.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=r):Array.isArray(r)?(c=this.BindingType.EntireArray,this.resolvedProperty=r):this.propertyName=n;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Ue.Composite=xh;Ue.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Ue.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Ue.prototype.GetterByBindingType=[Ue.prototype._getValue_direct,Ue.prototype._getValue_array,Ue.prototype._getValue_arrayElement,Ue.prototype._getValue_toArray];Ue.prototype.SetterByBindingTypeAndVersioning=[[Ue.prototype._setValue_direct,Ue.prototype._setValue_direct_setNeedsUpdate,Ue.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Ue.prototype._setValue_array,Ue.prototype._setValue_array_setNeedsUpdate,Ue.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Ue.prototype._setValue_arrayElement,Ue.prototype._setValue_arrayElement_setNeedsUpdate,Ue.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Ue.prototype._setValue_fromArray,Ue.prototype._setValue_fromArray_setNeedsUpdate,Ue.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var yh=class{constructor(){this.uuid=C1(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;let e={};this._indicesByUUID=e;for(let i=0,n=arguments.length;i!==n;++i)e[arguments[i].uuid]=i;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};let t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){let e=this._objects,t=this._indicesByUUID,i=this._paths,n=this._parsedPaths,s=this._bindings,r=s.length,a,c=e.length,l=this.nCachedObjects_;for(let h=0,f=arguments.length;h!==f;++h){let u=arguments[h],d=u.uuid,p=t[d];if(p===void 0){p=c++,t[d]=p,e.push(u);for(let v=0,x=r;v!==x;++v)s[v].push(new Ue(u,i[v],n[v]))}else if(p<l){a=e[p];let v=--l,x=e[v];t[x.uuid]=p,e[p]=x,t[d]=v,e[v]=u;for(let g=0,m=r;g!==m;++g){let z=s[g],y=z[v],b=z[p];z[p]=y,b===void 0&&(b=new Ue(u,i[g],n[g])),z[v]=b}}else e[p]!==a&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}remove(){let e=this._objects,t=this._indicesByUUID,i=this._bindings,n=i.length,s=this.nCachedObjects_;for(let r=0,a=arguments.length;r!==a;++r){let c=arguments[r],l=c.uuid,h=t[l];if(h!==void 0&&h>=s){let f=s++,u=e[f];t[u.uuid]=h,e[h]=u,t[l]=f,e[f]=c;for(let d=0,p=n;d!==p;++d){let v=i[d],x=v[f],g=v[h];v[h]=x,v[f]=g}}}this.nCachedObjects_=s}uncache(){let e=this._objects,t=this._indicesByUUID,i=this._bindings,n=i.length,s=this.nCachedObjects_,r=e.length;for(let a=0,c=arguments.length;a!==c;++a){let l=arguments[a],h=l.uuid,f=t[h];if(f!==void 0)if(delete t[h],f<s){let u=--s,d=e[u],p=--r,v=e[p];t[d.uuid]=f,e[f]=d,t[v.uuid]=u,e[u]=v,e.pop();for(let x=0,g=n;x!==g;++x){let m=i[x],z=m[u],y=m[p];m[f]=z,m[u]=y,m.pop()}}else{let u=--r,d=e[u];u>0&&(t[d.uuid]=f),e[f]=d,e.pop();for(let p=0,v=n;p!==v;++p){let x=i[p];x[f]=x[u],x.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){let i=this._bindingsIndicesByPath,n=i[e],s=this._bindings;if(n!==void 0)return s[n];let r=this._paths,a=this._parsedPaths,c=this._objects,l=c.length,h=this.nCachedObjects_,f=new Array(l);n=s.length,i[e]=n,r.push(e),a.push(t),s.push(f);for(let u=h,d=c.length;u!==d;++u){let p=c[u];f[u]=new Ue(p,e,t)}return f}unsubscribe_(e){let t=this._bindingsIndicesByPath,i=t[e];if(i!==void 0){let n=this._paths,s=this._parsedPaths,r=this._bindings,a=r.length-1,c=r[a],l=e[a];t[l]=i,r[i]=c,r.pop(),s[i]=s[a],s.pop(),n[i]=n[a],n.pop()}}};yh.prototype.isAnimationObjectGroup=!0;var wh=class{constructor(e,t,i=null,n=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=i,this.blendMode=n;let s=t.tracks,r=s.length,a=new Array(r),c={endingStart:vn,endingEnd:vn};for(let l=0;l!==r;++l){let h=s[l].createInterpolant(null);a[l]=h,h.settings=c}this._interpolantSettings=c,this._interpolants=a,this._propertyBindings=new Array(r),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Rd,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,i){if(e.fadeOut(t),this.fadeIn(t),i){let n=this._clip.duration,s=e._clip.duration,r=s/n,a=n/s;e.warp(1,r,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,i){return e.crossFadeFrom(this,t,i)}stopFading(){let e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,i){let n=this._mixer,s=n.time,r=this.timeScale,a=this._timeScaleInterpolant;a===null&&(a=n._lendControlInterpolant(),this._timeScaleInterpolant=a);let c=a.parameterPositions,l=a.sampleValues;return c[0]=s,c[1]=s+i,l[0]=e/r,l[1]=t/r,this}stopWarping(){let e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,i,n){if(!this.enabled){this._updateWeight(e);return}let s=this._startTime;if(s!==null){let c=(e-s)*i;if(c<0||i===0)return;this._startTime=null,t=i*c}t*=this._updateTimeScale(e);let r=this._updateTime(t),a=this._updateWeight(e);if(a>0){let c=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case s5:for(let h=0,f=c.length;h!==f;++h)c[h].evaluate(r),l[h].accumulateAdditive(a);break;case bo:default:for(let h=0,f=c.length;h!==f;++h)c[h].evaluate(r),l[h].accumulate(n,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let i=this._weightInterpolant;if(i!==null){let n=i.evaluate(e)[0];t*=n,e>i.parameterPositions[1]&&(this.stopFading(),n===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let i=this._timeScaleInterpolant;i!==null&&(t*=i.evaluate(e)[0],e>i.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){let t=this._clip.duration,i=this.loop,n=this.time+e,s=this._loopCount,r=i===Nd;if(e===0)return s===-1?n:r&&(s&1)==1?t-n:n;if(i===Vd){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(n>=t)n=t;else if(n<0)n=0;else{this.time=n;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,r)):this._setEndings(this.repetitions===0,!0,r)),n>=t||n<0){let a=Math.floor(n/t);n-=t*a,s+=Math.abs(a);let c=this.repetitions-s;if(c<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,n=e>0?t:0,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(c===1){let l=e<0;this._setEndings(l,!l,r)}else this._setEndings(!1,!1,r);this._loopCount=s,this.time=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=n;if(r&&(s&1)==1)return t-n}return n}_setEndings(e,t,i){let n=this._interpolantSettings;i?(n.endingStart=xn,n.endingEnd=xn):(e?n.endingStart=this.zeroSlopeAtStart?xn:vn:n.endingStart=xa,t?n.endingEnd=this.zeroSlopeAtEnd?xn:vn:n.endingEnd=xa)}_scheduleFading(e,t,i){let n=this._mixer,s=n.time,r=this._weightInterpolant;r===null&&(r=n._lendControlInterpolant(),this._weightInterpolant=r);let a=r.parameterPositions,c=r.sampleValues;return a[0]=s,c[0]=t,a[1]=s+e,c[1]=i,this}},bh=class extends ti{constructor(e){super();this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){let i=e._localRoot||this._root,n=e._clip.tracks,s=n.length,r=e._propertyBindings,a=e._interpolants,c=i.uuid,l=this._bindingsByRootAndName,h=l[c];h===void 0&&(h={},l[c]=h);for(let f=0;f!==s;++f){let u=n[f],d=u.name,p=h[d];if(p!==void 0)++p.referenceCount,r[f]=p;else{if(p=r[f],p!==void 0){p._cacheIndex===null&&(++p.referenceCount,this._addInactiveBinding(p,c,d));continue}let v=t&&t._propertyBindings[f].binding.parsedPath;p=new vh(Ue.create(i,d,v),u.ValueTypeName,u.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,c,d),r[f]=p}a[f].resultBuffer=p.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){let i=(e._localRoot||this._root).uuid,n=e._clip.uuid,s=this._actionsByClip[n];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,n,i)}let t=e._propertyBindings;for(let i=0,n=t.length;i!==n;++i){let s=t[i];s.useCount++==0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let i=0,n=t.length;i!==n;++i){let s=t[i];--s.useCount==0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){let t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,i){let n=this._actions,s=this._actionsByClip,r=s[t];if(r===void 0)r={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=r;else{let a=r.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=n.length,n.push(e),r.actionByRoot[i]=e}_removeInactiveAction(e){let t=this._actions,i=t[t.length-1],n=e._cacheIndex;i._cacheIndex=n,t[n]=i,t.pop(),e._cacheIndex=null;let s=e._clip.uuid,r=this._actionsByClip,a=r[s],c=a.knownActions,l=c[c.length-1],h=e._byClipCacheIndex;l._byClipCacheIndex=h,c[h]=l,c.pop(),e._byClipCacheIndex=null;let f=a.actionByRoot,u=(e._localRoot||this._root).uuid;delete f[u],c.length===0&&delete r[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){let t=e._propertyBindings;for(let i=0,n=t.length;i!==n;++i){let s=t[i];--s.referenceCount==0&&this._removeInactiveBinding(s)}}_lendAction(e){let t=this._actions,i=e._cacheIndex,n=this._nActiveActions++,s=t[n];e._cacheIndex=n,t[n]=e,s._cacheIndex=i,t[i]=s}_takeBackAction(e){let t=this._actions,i=e._cacheIndex,n=--this._nActiveActions,s=t[n];e._cacheIndex=n,t[n]=e,s._cacheIndex=i,t[i]=s}_addInactiveBinding(e,t,i){let n=this._bindingsByRootAndName,s=this._bindings,r=n[t];r===void 0&&(r={},n[t]=r),r[i]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){let t=this._bindings,i=e.binding,n=i.rootNode.uuid,s=i.path,r=this._bindingsByRootAndName,a=r[n],c=t[t.length-1],l=e._cacheIndex;c._cacheIndex=l,t[l]=c,t.pop(),delete a[s],Object.keys(a).length===0&&delete r[n]}_lendBinding(e){let t=this._bindings,i=e._cacheIndex,n=this._nActiveBindings++,s=t[n];e._cacheIndex=n,t[n]=e,s._cacheIndex=i,t[i]=s}_takeBackBinding(e){let t=this._bindings,i=e._cacheIndex,n=--this._nActiveBindings,s=t[n];e._cacheIndex=n,t[n]=e,s._cacheIndex=i,t[i]=s}_lendControlInterpolant(){let e=this._controlInterpolants,t=this._nActiveControlInterpolants++,i=e[t];return i===void 0&&(i=new A6(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),i.__cacheIndex=t,e[t]=i),i}_takeBackControlInterpolant(e){let t=this._controlInterpolants,i=e.__cacheIndex,n=--this._nActiveControlInterpolants,s=t[n];e.__cacheIndex=n,t[n]=e,s.__cacheIndex=i,t[i]=s}clipAction(e,t,i){let n=t||this._root,s=n.uuid,r=typeof e=="string"?_6.findByName(n,e):e,a=r!==null?r.uuid:e,c=this._actionsByClip[a],l=null;if(i===void 0&&(r!==null?i=r.blendMode:i=bo),c!==void 0){let f=c.actionByRoot[s];if(f!==void 0&&f.blendMode===i)return f;l=c.knownActions[0],r===null&&(r=l._clip)}if(r===null)return null;let h=new wh(this,r,t,i);return this._bindAction(h,l),this._addInactiveAction(h,a,s),h}existingAction(e,t){let i=t||this._root,n=i.uuid,s=typeof e=="string"?_6.findByName(i,e):e,r=s?s.uuid:e,a=this._actionsByClip[r];return a!==void 0&&a.actionByRoot[n]||null}stopAllAction(){let e=this._actions,t=this._nActiveActions;for(let i=t-1;i>=0;--i)e[i].stop();return this}update(e){e*=this.timeScale;let t=this._actions,i=this._nActiveActions,n=this.time+=e,s=Math.sign(e),r=this._accuIndex^=1;for(let l=0;l!==i;++l)t[l]._update(n,e,s,r);let a=this._bindings,c=this._nActiveBindings;for(let l=0;l!==c;++l)a[l].apply(r);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){let t=this._actions,i=e.uuid,n=this._actionsByClip,s=n[i];if(s!==void 0){let r=s.knownActions;for(let a=0,c=r.length;a!==c;++a){let l=r[a];this._deactivateAction(l);let h=l._cacheIndex,f=t[t.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,f._cacheIndex=h,t[h]=f,t.pop(),this._removeInactiveBindingsForAction(l)}delete n[i]}}uncacheRoot(e){let t=e.uuid,i=this._actionsByClip;for(let r in i){let a=i[r].actionByRoot,c=a[t];c!==void 0&&(this._deactivateAction(c),this._removeInactiveAction(c))}let n=this._bindingsByRootAndName,s=n[t];if(s!==void 0)for(let r in s){let a=s[r];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){let i=this.existingAction(e,t);i!==null&&(this._deactivateAction(i),this._removeInactiveAction(i))}};bh.prototype._controlInterpolantsResultBuffer=new Float32Array(1);var M4=class{constructor(e){typeof e=="string"&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}clone(){return new M4(this.value.clone===void 0?this.value:this.value.clone())}},Mh=class extends Un{constructor(e,t,i=1){super(e,t);this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){let t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){let t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}};Mh.prototype.isInstancedInterleavedBuffer=!0;var zh=class{constructor(e,t,i,n,s){this.buffer=e,this.type=t,this.itemSize=i,this.elementSize=n,this.count=s,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}};zh.prototype.isGLBufferAttribute=!0;var Ch=new te,Kn=class{constructor(e=new te(1/0,1/0),t=new te(-1/0,-1/0)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let i=Ch.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return Ch.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}};Kn.prototype.isBox2=!0;var Ah=new B,z4=new B,Sh=class{constructor(e=new B,t=new B){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){Ah.subVectors(e,this.start),z4.subVectors(this.end,this.start);let i=z4.dot(z4),s=z4.dot(Ah)/i;return t&&(s=Jt(s,0,1)),s}closestPointToPoint(e,t,i){let n=this.closestPointToPointParameter(e,t);return this.delta(i).multiplyScalar(n).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}};var pi=new B,C4=new Ce,F6=new Ce,_h=class extends s4{constructor(e){let t=Eh(e),i=new rt,n=[],s=[],r=new xe(0,0,1),a=new xe(0,1,0);for(let l=0;l<t.length;l++){let h=t[l];h.parent&&h.parent.isBone&&(n.push(0,0,0),n.push(0,0,0),s.push(r.r,r.g,r.b),s.push(a.r,a.g,a.b))}i.setAttribute("position",new _t(n,3)),i.setAttribute("color",new _t(s,3));let c=new Xn({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(i,c);this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){let t=this.bones,i=this.geometry,n=i.getAttribute("position");F6.copy(this.root.matrixWorld).invert();for(let s=0,r=0;s<t.length;s++){let a=t[s];a.parent&&a.parent.isBone&&(C4.multiplyMatrices(F6,a.matrixWorld),pi.setFromMatrixPosition(C4),n.setXYZ(r,pi.x,pi.y,pi.z),C4.multiplyMatrices(F6,a.parent.matrixWorld),pi.setFromMatrixPosition(C4),n.setXYZ(r+1,pi.x,pi.y,pi.z),r+=2)}i.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}};function Eh(o){let e=[];o&&o.isBone&&e.push(o);for(let t=0;t<o.children.length;t++)e.push.apply(e,Eh(o.children[t]));return e}var Lh=class extends s4{constructor(e=10,t=10,i=4473924,n=8947848){i=new xe(i),n=new xe(n);let s=t/2,r=e/t,a=e/2,c=[],l=[];for(let u=0,d=0,p=-a;u<=t;u++,p+=r){c.push(-a,0,p,a,0,p),c.push(p,0,-a,p,0,a);let v=u===s?i:n;v.toArray(l,d),d+=3,v.toArray(l,d),d+=3,v.toArray(l,d),d+=3,v.toArray(l,d),d+=3}let h=new rt;h.setAttribute("position",new _t(c,3)),h.setAttribute("color",new _t(l,3));let f=new Xn({vertexColors:!0,toneMapped:!1});super(h,f);this.type="GridHelper"}};var ay=new Float32Array(1),ZC=new Int32Array(ay.buffer);c1.create=function(o,e){return console.log("THREE.Curve.create() has been deprecated"),o.prototype=Object.create(c1.prototype),o.prototype.constructor=o,o.prototype.getPoint=e,o};u4.prototype.fromPoints=function(o){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(o)};Lh.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")};_h.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};S2.prototype.extractUrlBase=function(o){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),lh.extractUrlBase(o)};S2.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}};Kn.prototype.center=function(o){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(o)};Kn.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()};Kn.prototype.isIntersectionBox=function(o){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(o)};Kn.prototype.size=function(o){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(o)};f1.prototype.center=function(o){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(o)};f1.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()};f1.prototype.isIntersectionBox=function(o){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(o)};f1.prototype.isIntersectionSphere=function(o){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(o)};f1.prototype.size=function(o){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(o)};Ni.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()};Fs.prototype.setFromMatrix=function(o){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(o)};Sh.prototype.center=function(o){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(o)};Tt.prototype.flattenToArrayOffset=function(o,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(o,e)};Tt.prototype.multiplyVector3=function(o){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),o.applyMatrix3(this)};Tt.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")};Tt.prototype.applyToBufferAttribute=function(o){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),o.applyMatrix3(this)};Tt.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")};Tt.prototype.getInverse=function(o){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(o).invert()};Ce.prototype.extractPosition=function(o){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(o)};Ce.prototype.flattenToArrayOffset=function(o,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(o,e)};Ce.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),new B().setFromMatrixColumn(this,3)};Ce.prototype.setRotationFromQuaternion=function(o){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(o)};Ce.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")};Ce.prototype.multiplyVector3=function(o){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),o.applyMatrix4(this)};Ce.prototype.multiplyVector4=function(o){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),o.applyMatrix4(this)};Ce.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")};Ce.prototype.rotateAxis=function(o){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),o.transformDirection(this)};Ce.prototype.crossVector=function(o){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),o.applyMatrix4(this)};Ce.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")};Ce.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")};Ce.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")};Ce.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")};Ce.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")};Ce.prototype.applyToBufferAttribute=function(o){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),o.applyMatrix4(this)};Ce.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")};Ce.prototype.makeFrustum=function(o,e,t,i,n,s){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(o,e,i,t,n,s)};Ce.prototype.getInverse=function(o){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(o).invert()};q1.prototype.isIntersectionLine=function(o){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(o)};Gt.prototype.multiplyVector3=function(o){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),o.applyQuaternion(this)};Gt.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()};Fi.prototype.isIntersectionBox=function(o){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(o)};Fi.prototype.isIntersectionPlane=function(o){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(o)};Fi.prototype.isIntersectionSphere=function(o){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(o)};xt.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()};xt.prototype.barycoordFromPoint=function(o,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(o,e)};xt.prototype.midpoint=function(o){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(o)};xt.prototypenormal=function(o){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(o)};xt.prototype.plane=function(o){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(o)};xt.barycoordFromPoint=function(o,e,t,i,n){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),xt.getBarycoord(o,e,t,i,n)};xt.normal=function(o,e,t,i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),xt.getNormal(o,e,t,i)};Yn.prototype.extractAllPoints=function(o){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(o)};Yn.prototype.extrude=function(o){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Ii(this,o)};Yn.prototype.makeGeometry=function(o){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new m4(this,o)};te.prototype.fromAttribute=function(o,e,t){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(o,e,t)};te.prototype.distanceToManhattan=function(o){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(o)};te.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};B.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")};B.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")};B.prototype.getPositionFromMatrix=function(o){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(o)};B.prototype.getScaleFromMatrix=function(o){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(o)};B.prototype.getColumnFromMatrix=function(o,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,o)};B.prototype.applyProjection=function(o){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(o)};B.prototype.fromAttribute=function(o,e,t){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(o,e,t)};B.prototype.distanceToManhattan=function(o){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(o)};B.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};Qe.prototype.fromAttribute=function(o,e,t){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(o,e,t)};Qe.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};We.prototype.getChildByName=function(o){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(o)};We.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")};We.prototype.translate=function(o,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,o)};We.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")};We.prototype.applyMatrix=function(o){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(o)};Object.defineProperties(We.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(o){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=o}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}});Rt.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")};Object.defineProperties(Rt.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),Fd},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}});h6.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")};Nt.prototype.setLens=function(o,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),e!==void 0&&(this.filmGauge=e),this.setFocalLength(o)};Object.defineProperties(L1.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(o){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=o}},shadowCameraLeft:{set:function(o){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=o}},shadowCameraRight:{set:function(o){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=o}},shadowCameraTop:{set:function(o){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=o}},shadowCameraBottom:{set:function(o){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=o}},shadowCameraNear:{set:function(o){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=o}},shadowCameraFar:{set:function(o){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=o}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(o){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=o}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(o){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=o}},shadowMapHeight:{set:function(o){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=o}}});Object.defineProperties(wt.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===ya},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(ya)}}});wt.prototype.setDynamic=function(o){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(o===!0?ya:Ts),this};wt.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},wt.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};rt.prototype.addIndex=function(o){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(o)};rt.prototype.addAttribute=function(o,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),!(e&&e.isBufferAttribute)&&!(e&&e.isInterleavedBufferAttribute)?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(o,new wt(arguments[1],arguments[2]))):o==="index"?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(o,e)};rt.prototype.addDrawCall=function(o,e,t){t!==void 0&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(o,e)};rt.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()};rt.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")};rt.prototype.removeAttribute=function(o){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(o)};rt.prototype.applyMatrix=function(o){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(o)};Object.defineProperties(rt.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}});Un.prototype.setDynamic=function(o){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(o===!0?ya:Ts),this};Un.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};Ii.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")};Ii.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")};Ii.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")};ks.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")};M4.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this};Object.defineProperties(St.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new xe}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(o){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=o===S8}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(o){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=o}},vertexTangents:{get:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")},set:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")}}});Object.defineProperties(hi.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(o){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=o}}});Ye.prototype.clearTarget=function(o,e,t,i){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(o),this.clear(e,t,i)};Ye.prototype.animate=function(o){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(o)};Ye.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()};Ye.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()};Ye.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision};Ye.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()};Ye.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")};Ye.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")};Ye.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")};Ye.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")};Ye.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")};Ye.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")};Ye.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures};Ye.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")};Ye.prototype.enableScissorTest=function(o){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(o)};Ye.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};Ye.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")};Ye.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")};Ye.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")};Ye.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")};Ye.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")};Ye.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")};Ye.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")};Ye.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")};Ye.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()};Object.defineProperties(Ye.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(o){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=o}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(o){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=o}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(o){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=o===!0?ot:ei}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}},gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}});Object.defineProperties(il.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}});Object.defineProperties(r1.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(o){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=o}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(o){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=o}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(o){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=o}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(o){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=o}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(o){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=o}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(o){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=o}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(o){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=o}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(o){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=o}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(o){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=o}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(o){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=o}}});mh.prototype.load=function(o){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");let e=this;return new fh().load(o,function(i){e.setBuffer(i)}),this};gh.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()};ka.prototype.updateCubeMap=function(o,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(o,e)};ka.prototype.clear=function(o,e,t,i){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(o,e,t,i)};ii.crossOrigin=void 0;ii.loadTexture=function(o,e,t,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");let n=new eh;n.setCrossOrigin(this.crossOrigin);let s=n.load(o,t,void 0,i);return e&&(s.mapping=e),s};ii.loadTextureCube=function(o,e,t,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");let n=new Kl;n.setCrossOrigin(this.crossOrigin);let s=n.load(o,t,void 0,i);return e&&(s.mapping=e),s};ii.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")};ii.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:oo}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=oo);var Z1,Ui,B6=class{constructor(){at(this,Z1);this.resources=new Map}isTracking(e){return this.resources.has(e)}track(e){if("dispose"in e&&Ze(this,Z1,Ui).call(this,e),e instanceof We&&Ze(this,Z1,Ui).call(this,e),"geometry"in e&&Ze(this,Z1,Ui).call(this,e.geometry,e),"material"in e&&Ze(this,Z1,Ui).call(this,e.material,e),"children"in e&&Ze(this,Z1,Ui).call(this,e.children,e),e instanceof St)for(let t of Object.values(e))t instanceof vt&&Ze(this,Z1,Ui).call(this,t);return e}untrack(e){this.resources.delete(e)}dispose(){for(let[e]of this.resources)this.disposeResource(e);this.resources.clear()}disposeResource(e){"parent"in e&&e.parent&&e.parent.remove(e),"dispose"in e&&e.dispose();for(let t of this.resources.get(e)??[])this.disposeResource(t);this.resources.delete(e)}};Z1=new WeakSet,Ui=function(e,t){if(Array.isArray(e))e.forEach(i=>{(this.resources.get(t)??[]).push(i),Ze(this,Z1,Ui).call(this,i,t)});else{let i=this.resources.get(t??e)??[];this.resources.set(t??e,i)}};var E2,mi,qi,P6,ts=class extends Gi.Component{constructor(e){super();this.data=e;this.event=new Gi.Events;this.tracker=new B6;this.container=createDiv("renderer-container");at(this,E2,new Set);this.shadows=!0;this.iterations=0;this.frame_rate=1/60;this.loaded=!1;at(this,mi,!1);at(this,qi,new WeakMap);this.factory=new Dh(this.WIDTH,this.HEIGHT,{diceColor:this.data.diceColor,textColor:this.data.textColor,colorfulDice:this.data.colorfulDice,scaler:this.data.scaler});this.colors={ambient:16777215,spotlight:16777215};this.display={currentWidth:null,currentHeight:null,containerWidth:null,containerHeight:null,aspect:null,scale:null};this.cameraHeight={max:null,close:null,medium:null,far:null};at(this,P6,new WeakMap);this.extraFrames=ts.DEFAULT_EXTRA_FRAMES;this.renderer=new Ye({alpha:!0,antialias:!0})}get WIDTH(){return this.container.clientWidth/2}get HEIGHT(){return this.container.clientHeight/2}get ASPECT(){return this.WIDTH/this.HEIGHT}get scale(){return(this.WIDTH*this.WIDTH+this.HEIGHT*this.HEIGHT)/13}get canvasEl(){return this.renderer?this.renderer.domElement:null}setData(e){this.data=e,this.factory.width=this.WIDTH,this.factory.height=this.HEIGHT,this.factory.updateDice()}getDiceForRoller(e){return this.factory.getDiceForRoller(e,this.getVector())}async addDice(e){return new Promise(t=>{Pe(this,mi)||this.start();for(let i of e)i.recreate(this.getVector(),this.WIDTH,this.HEIGHT),this.scene.add(this.tracker.track(i.geometry)),this.world.add(i);Pe(this,E2).add(e),Pe(this,qi).set(e,()=>{t()})})}onload(){this.loaded=!0,this.addChild(this.factory),this.container.empty(),this.container.style.opacity="1",this.renderer.shadowMap.enabled=this.shadows,this.renderer.shadowMap.type=co,this.container.appendChild(this.renderer.domElement),document.body.appendChild(this.container),this.renderer.setClearColor(0,0),this.scene=new ks,this.initScene(),this.initWorld(),this.registerDomEvent(window,"resize",()=>{this.initScene()})}onunload(){this.stop(),this.loaded=!1,cancelAnimationFrame(this.animation),this.container.detach(),this.container.empty(),this.renderer.domElement.detach(),this.factory.dispose(),this.renderer.renderLists.dispose(),this.renderer.dispose(),this.tracker.dispose(),[...Pe(this,E2).values()].flat().forEach(e=>{this.world.world.removeBody(e.body)}),Kt(this,E2,new Set)}start(){Pe(this,mi)&&this.unload(),this.loaded||this.load(),Kt(this,mi,!0),this.extraFrames=ts.DEFAULT_EXTRA_FRAMES,this.render()}enableShadows(){this.shadows=!0,this.renderer&&(this.renderer.shadowMap.enabled=this.shadows),this.light&&(this.light.castShadow=this.shadows),this.desk&&(this.desk.receiveShadow=this.shadows)}disableShadows(){this.shadows=!1,this.renderer&&(this.renderer.shadowMap.enabled=this.shadows),this.light&&(this.light.castShadow=this.shadows),this.desk&&(this.desk.receiveShadow=this.shadows)}get mw(){return Math.max(this.WIDTH,this.HEIGHT)}setDimensions(e){this.display.currentWidth=this.container.clientWidth/2,this.display.currentHeight=this.container.clientHeight/2,e?(this.display.containerWidth=e.w,this.display.containerHeight=e.h):(this.display.containerWidth=this.display.currentWidth,this.display.containerHeight=this.display.currentHeight),this.display.aspect=Math.min(this.display.currentWidth/this.display.containerWidth,this.display.currentHeight/this.display.containerHeight),this.display.scale=Math.sqrt(this.display.containerWidth*this.display.containerWidth+this.display.containerHeight*this.display.containerHeight)/13,this.renderer.setSize(this.display.currentWidth*2,this.display.currentHeight*2),this.cameraHeight.max=this.display.currentHeight/this.display.aspect/Math.tan(10*Math.PI/180),this.factory.width=this.display.currentWidth,this.factory.height=this.display.currentHeight,this.factory.updateDice(),this.cameraHeight.medium=this.cameraHeight.max/1.5,this.cameraHeight.far=this.cameraHeight.max,this.cameraHeight.close=this.cameraHeight.max/2}initCamera(){this.camera&&this.scene.remove(this.camera),this.camera=new Nt(20,this.display.currentWidth/this.display.currentHeight,1,this.cameraHeight.max*1.3),this.camera.position.z=this.cameraHeight.far,this.camera.lookAt(new B(0,0,0))}initLighting(){let e=Math.max(this.display.containerWidth,this.display.containerHeight);this.light&&this.scene.remove(this.light),this.ambientLight&&this.scene.remove(this.ambientLight),this.light=new x4(this.colors.spotlight,.25),this.light.position.set(-e/2,e/2,e*3),this.light.target.position.set(0,0,0),this.light.distance=e*5,this.light.angle=Math.PI/4,this.light.castShadow=this.shadows,this.light.shadow.camera.near=e/10,this.light.shadow.camera.far=e*5,this.light.shadow.camera.fov=50,this.light.shadow.bias=.001,this.light.shadow.mapSize.width=1024,this.light.shadow.mapSize.height=1024,this.scene.add(this.tracker.track(this.light)),this.ambientLight=new y4(16777215,.9),this.scene.add(this.tracker.track(this.ambientLight))}initDesk(){this.desk&&this.scene.remove(this.desk);let e=new g4;e.opacity=.5,this.desk=new Rt(new Fn(this.display.containerWidth*6,this.display.containerHeight*6,1,1),e),this.desk.receiveShadow=this.shadows,this.scene.add(this.tracker.track(this.desk))}initScene(){this.setDimensions(),this.initCamera(),this.initLighting(),this.initDesk(),this.camera.updateProjectionMatrix(),this.renderer.render(this.scene,this.camera)}initWorld(){this.world=new Th(this.WIDTH,this.HEIGHT),this.iterations=0}finishRender(){this.event.trigger("throw-finished")}throwFinished(){let e=!0;for(let t of Pe(this,E2)){let i=!0;for(let n of t){if(n.iterations>10/this.frame_rate&&(n.stopped=!0),n.stopped===!0)continue;let s=n.body.angularVelocity,r=n.body.velocity;if(Math.abs(s.length())<ts.Threshold&&Math.abs(r.length())<ts.Threshold){if(this.iterations-n.iterations>5){n.stopped=!0;continue}i=!1,e=!1}else n.iterations++,n.stopped=!1,i=!1,e=!1}i&&Pe(this,qi).has(t)&&(Pe(this,qi).get(t)(),Pe(this,qi).delete(t))}return e}unrender(){this.container.style.opacity="0",cancelAnimationFrame(this.animation),this.registerInterval(window.setTimeout(()=>{this.stop()},1e3))}stop(){if(Pe(this,mi))for(let e of[...Pe(this,E2)].flat())e.stopped=!0;Kt(this,mi,!1),this.unload()}resizeRendererToDisplaySize(){let e=this.renderer.domElement,t=window.devicePixelRatio,i=e.clientWidth*t|0,n=e.clientHeight*t|0,s=e.width!==i||e.height!==n;return s&&this.renderer.setSize(i,n,!1),s}render(){if(this.throwFinished())if(this.extraFrames>10)this.extraFrames--;else{try{if(this.data.renderTime)this.registerInterval(window.setTimeout(()=>this.unrender(),this.data.renderTime));else{let t=function(){e.unload(),document.body.removeEventListener("click",t)},e=this;this.registerDomEvent(document.body,"click",t)}}catch(e){this.event.trigger("error",e)}return}this.animation=requestAnimationFrame(()=>this.render()),this.resizeRendererToDisplaySize()&&(this.camera.aspect=this.canvasEl.clientWidth/this.canvasEl.clientHeight,this.camera.updateProjectionMatrix()),this.world.step(this.frame_rate),this.iterations++,[...Pe(this,E2).values()].forEach(e=>e.forEach(t=>t.set())),this.renderer.render(this.scene,this.camera)}getVector(){return{x:(Math.random()*2-1)*this.WIDTH,y:-(Math.random()*2-1)*this.HEIGHT}}dispose(...e){e.forEach(t=>{t.children&&this.dispose(...t.children),t.clear()})}},es=ts;E2=new WeakMap,mi=new WeakMap,qi=new WeakMap,P6=new WeakMap,es.DEFAULT_EXTRA_FRAMES=30,es.Threshold=5;var Th=class{constructor(e,t){this.WIDTH=e;this.HEIGHT=t;this.world=new h0({gravity:new M(0,0,-9.82*200)});this.ground=this.getPlane();this.diceMaterial=new r2;this.deskMaterial=new r2;this.barrierMaterial=new r2;this.world.broadphase=new Tr,this.world.allowSleep=!0,this.ground.position.set(0,0,0),this.world.addBody(this.ground),this.buildWalls()}add(...e){e.forEach(t=>{this.world.addBody(t.body)})}remove(...e){e.forEach(t=>this.world.removeBody(t.body))}step(e=1/60){let t=performance.now()/1e3;if(!this.lastCallTime)this.world.step(e);else{let i=t-this.lastCallTime;this.world.step(e,i)}this.lastCallTime=t}buildWalls(){this.world.addContactMaterial(new s2(this.deskMaterial,this.diceMaterial,{friction:.01,restitution:.5,contactEquationRelaxation:3,contactEquationStiffness:1e8})),this.world.addContactMaterial(new s2(this.barrierMaterial,this.diceMaterial,{friction:.01,restitution:1,contactEquationRelaxation:3,contactEquationStiffness:1e8})),this.world.addContactMaterial(new s2(this.diceMaterial,this.diceMaterial,{friction:.1,restitution:.5,contactEquationRelaxation:3,contactEquationStiffness:1e8})),this.world.addBody(new ae({allowSleep:!1,mass:0,shape:new P2,material:this.deskMaterial}));let e=new ae({allowSleep:!1,mass:0,shape:new P2,material:this.barrierMaterial});e.quaternion.setFromAxisAngle(new M(1,0,0),Math.PI/2),e.position.set(0,this.HEIGHT*.93,0),this.world.addBody(e),e=new ae({allowSleep:!1,mass:0,shape:new P2,material:this.barrierMaterial}),e.quaternion.setFromAxisAngle(new M(1,0,0),-Math.PI/2),e.position.set(0,-this.HEIGHT*.93,0),this.world.addBody(e),e=new ae({allowSleep:!1,mass:0,shape:new P2,material:this.barrierMaterial}),e.quaternion.setFromAxisAngle(new M(0,1,0),-Math.PI/2),e.position.set(this.WIDTH*.93,0,0),this.world.addBody(e),e=new ae({allowSleep:!1,mass:0,shape:new P2,material:this.barrierMaterial}),e.quaternion.setFromAxisAngle(new M(0,1,0),Math.PI/2),e.position.set(-this.WIDTH*.93,0,0),this.world.addBody(e)}getPlane(){return new ae({type:ae.STATIC,shape:new P2})}},Dh=class extends Gi.Component{constructor(e,t,i){super();this.width=e;this.height=t;this.options=i;this.dice={};this.updateDice=(0,Gi.debounce)(()=>{this.dispose(),this.buildDice()},200);this.buildDice()}get colors(){let e=this.options.diceColor,t=this.options.textColor;if(!this.options.colorfulDice)return{diceColor:e,textColor:t}}onunload(){this.dispose()}disposeChildren(...e){e.forEach(t=>{"dispose"in t&&t.dispose(),t.children&&this.disposeChildren(...t.children)})}dispose(){for(let e of Object.values(this.dice))this.disposeChildren(e.geometry.children)}getDiceForRoller(e,t){let i=[];switch(e.faces.max){case 4:{i.push(new ua(this.width,this.height,this.clone("d4"),t));break}case 1:case 6:{i.push(new zs(this.width,this.height,e.fudge?this.clone("fudge"):this.clone("d6"),t));break}case 8:{i.push(new ha(this.width,this.height,this.clone("d8"),t));break}case 10:{i.push(new $2(this.width,this.height,this.clone("d10"),t));break}case 12:{i.push(new la(this.width,this.height,this.clone("d12"),t));break}case 20:{i.push(new ca(this.width,this.height,this.clone("d20"),t));break}case 100:{i.push(new $2(this.width,this.height,this.clone("d100"),t,!0),new $2(this.width,this.height,this.clone("d10"),t,!0));break}}return i}cloneDice(e,t){switch(e.sides){case 4:return[new ua(this.width,this.height,this.clone("d4"),t)];case 1:return[new zs(this.width,this.height,this.clone("fudge"),t)];case 6:return[new zs(this.width,this.height,this.clone("d6"),t)];case 8:return[new ha(this.width,this.height,this.clone("d8"),t)];case 10:return[new $2(this.width,this.height,this.clone("d10"),t)];case 12:return[new la(this.width,this.height,this.clone("d12"),t)];case 20:return[new ca(this.width,this.height,this.clone("d20"),t)];case 100:return[new $2(this.width,this.height,this.clone("d100"),t,!0),new $2(this.width,this.height,this.clone("d10"),t,!0)]}}getDice(e,t){let i=new Map;for(let n of e.dynamic){let s=this.getDiceForRoller(n,t);s.length&&i.set(n,s)}return i}clone(e){if(!(e in this.dice))throw new Error("That dice type does not exist!");return this.dice[e].clone()}buildDice(){this.dice.d100=new Z0(this.width,this.height,this.colors,this.options.scaler).create(),this.dice.d20=new q0(this.width,this.height,this.colors,this.options.scaler).create(),this.dice.d12=new W0(this.width,this.height,this.colors,this.options.scaler).create(),this.dice.d10=new j0(this.width,this.height,this.colors,this.options.scaler).create(),this.dice.d8=new X0(this.width,this.height,this.colors,this.options.scaler).create(),this.dice.d6=new Y0(this.width,this.height,this.colors,this.options.scaler).create(),this.dice.d4=new J0(this.width,this.height,this.colors,this.options.scaler).create(),this.dice.fudge=new $0(this.width,this.height,this.colors,this.options.scaler).create(),this.dice.boost=new ro(this.width,this.height,this.colors,this.options.scaler).create(),this.dice.ability=new io(this.width,this.height,this.colors,this.options.scaler).create(),this.dice.difficulty=new no(this.width,this.height,this.colors,this.options.scaler).create(),this.dice.challenge=new eo(this.width,this.height,this.colors,this.options.scaler).create(),this.dice.proficiency=new K0(this.width,this.height,this.colors,this.options.scaler).create(),this.dice.setback=new ao(this.width,this.height,this.colors,this.options.scaler).create()}};var Rh=Mt(Vh());var I6=class{constructor(e){this.table=e}parse(e){let t=e.length,i=this.table,n=[],s=[],r=0;for(;r<t;){let a=e[r++];switch(a.value){case"(":s.unshift(a);break;case")":for(e[r]&&e[r].type=="dice"&&/^d/.test(e[r].value)&&(e[r].parenedDice=!0);s.length&&(a=s.shift(),a.value!=="(");)n.push(a);if(a.value!=="(")throw new Error("Mismatched parentheses.");break;default:if(i.hasOwnProperty(a.value)){for(;s.length;){let c=s[0];if(c.value==="(")break;let l=i[a.value],h=l.precedence,f=i[c.value].precedence;if(h>f||h===f&&l.associativity==="right")break;n.push(s.shift())}s.unshift(a)}else n.push(a)}}for(;s.length;){let a=s.shift();if(a.value!=="(")n.push(a);else throw new Error("Mismatched parentheses.")}return n}};var oy=/(?:\d+[Dd])?#(?:[\p{Letter}\p{Emoji_Presentation}\w/-]+)(?:\|(?:[+-]))?(?:\|(?:[^+-]+))?/u,cy=/(?:\d+[Dd]?)?dv\((?:.+)\)(?:\|(?:[+-]))?(?:\|(?:[^+-]+))?/u,ly=/(?:.*)?(?:\[.*\]\(|\[\[)(?:.+?)#?\^(?:.+?)(?:\)|\]\])\|?(?:.+)?/u,hy=/(?:\d+[Dd])?(?:\[.*\]\(|\[\[)(?:.+)(?:\)|\]\])\|?(?:.+)?/u,uy=/(?:\d+[Dd])?(?:\[.*\]\(|\[\[)(?:.+)(?:\)|\]\])\|line/u,fy=/[\(\^\+\-\*\/\)]/u,dy=/(?:\d+|\b)[Dd](?:%|F|-?\d+|\[\d+(?:[ \t]*,[ \t]*\d+)+\]|\b)/u,py=/(?:=|=!|<|>|<=|>=|=<|=>|-=|=-)(?:\d+(?:[Dd](?:%|F|-?\d+|\[\d+(?:[ \t]*,[ \t]*\d+)+\]|\b))?)/u,S4=class{constructor(e,t){this.defaultRoll=e;this.defaultFace=t;this.lexer=Rh.compile({WS:[{match:/[ \t]+/u},{match:/[{}]+/u}],table:ly,line:uy,section:hy,tag:oy,dataview:cy,condition:py,kl:{match:/kl\d*/u,value:this.clampInfinite},kh:[{match:/kh\d*/u,value:this.clampInfinite},{match:/k\d*/u,value:this.clampInfinite}],dh:{match:/dh\d*/u,value:this.clampInfinite},dl:[{match:/dl\d*/u,value:this.clampInfinite}],"!!":{match:/!!(?:i|\d+)?/u,value:this.clampInfinite},"!":{match:/!(?:i|\d+)?/u,value:this.clampInfinite},r:{match:/r(?:i|\d+)?/u,value:this.clampInfinite},u:/u/u,stunt:/1[Dd]S/u,"%":/\d+[Dd]\d+%/u,dice:[{match:dy,value:e=>{let{roll:t=this.defaultRoll,faces:i=this.defaultFace}=e.match(/(?<roll>\d+)?[Dd](?<faces>%|F|-?\d+|\[\d+(?:[ \t]*,[ \t]*\d+)+\])?/).groups;return`${t}d${i}`}},{match:/\d+/u},{match:/\b[A-Za-z][A-Za-z0-9_]+\b/u,value:e=>this.inline.has(e)?`${this.inline.get(e)}`:e}],sort:[{match:/s(?:a|d)*/u,value:e=>e=="s"||e=="sa"?"sa":"sd"}],math:fy});this.inline=new Map;let i={precedence:3,associativity:"right"},n={precedence:2,associativity:"left"},s={precedence:1,associativity:"left"};this.parser=new I6({"+":s,"-":s,"*":n,"/":n,"^":i})}clampInfinite(e){return/i$/.test(e)?"100":e.replace(/^\D+/g,"")}setInlineFields(e){this.inline=e}setDefaultRoll(e){this.defaultRoll=e}setDefaultFace(e){this.defaultFace=e}parse(e){let t=Array.from(this.lexer.reset(e));return this.lexer.reset(),this.parser.parse(this.transform(t))}transform(e){e=e.filter(i=>i.type!="WS");let t=[];e.length>=2&&(e[0].type==="-"||e[0].type==="math"&&e[0].value==="-")&&e[1].type==="dice"&&(e[1].value=`-${e[1].value}`,e.shift());for(let i of e)if(i.type=="condition"&&t.length>0){let n=t[t.length-1];n.conditions||(n.conditions=[]);let[s,r,a]=i.value.match(/(?<operator>=|=!|<|>|<=|>=|=<|=>|-=|=-)(?<comparer>\d+(?:[Dd](?:%|F|-?\d+|\[\d+(?:[ \t]*,[ \t]*\d+)+\]|\b))?)/)??[],c=this.parse(a);n.conditions.push({operator:r,comparer:a,lexemes:c,value:i.value})}else t.push(i);return t}};var X1=Mt(require("@codemirror/view")),Nh=Mt(require("@codemirror/language")),is=Mt(require("obsidian"));function my(o,e,t){for(let i of o.ranges)if(i.from<=t&&i.to>=e)return!0;return!1}function Fh(o,e){let t=app.workspace.getActiveFile();if(!t)return;let i=[],n=o.state.selection,s=new RegExp(".*?_?inline-code_?.*");for(let{from:r,to:a}of o.visibleRanges)(0,Nh.syntaxTree)(o.state).iterate({from:r,to:a,enter:({node:c})=>{let l=c.type;if(l.name.includes("formatting")||!s.test(l.name))return;let h=c.from,f=c.to;if(my(n,h,f+1))return;let u=o.state.doc.sliceString(h,f).trim();if(/^dice\-mod:\s*([\s\S]+)\s*?/.test(u)){let[,x]=u.match(/dice\-mod:\s*([\s\S]+)\s*?/),g=app.workspace.getActiveFile(),m=e.getRollerSync(x,g.path),z=e.data.displayFormulaForMod;x.includes("|noform")&&(z=!1),x.includes("|form")&&(z=!0),m.roll().then(()=>{let y=z?`${m.inlineText} **${m.replacer}**`:`${m.replacer}`,b={from:h-1,to:f+1,insert:y},S=o.state.update({changes:b});o.dispatch(S)});return}if(!/^dice(?:\+|\-)?:\s*([\s\S]+)\s*?/.test(u))return;let[,d]=u.match(/^dice(?:\+|\-)?:\s*([\s\S]+)\s*?/),p=e.getRollerSync(d,t.path),v=new Bh(u,p,o,e,t);e.addToFileMap(t,p),i.push(X1.Decoration.replace({widget:v,inclusive:!1,block:!1}).range(h-1,f+1))}});return X1.Decoration.set(i,!0)}var Bh=class extends X1.WidgetType{constructor(e,t,i,n,s){super();this.rawQuery=e;this.roller=t;this.view=i;this.plugin=n;this.file=s}eq(e){return e.rawQuery===this.rawQuery?!0:(this.plugin.fileMap.get(this.file)?.remove(e.roller),!1)}toDOM(e){return this.roller.roll(),this.roller.containerEl}ignoreEvent(e){if(e.type==="mousedown"){let t=this.view.posAtCoords({x:e.x,y:e.y});if(e.shiftKey){if(t){let{editor:i}=this.view.state.field(is.editorEditorField).state.field(is.editorViewField);i.setCursor(i.offsetToPos(t))}return!1}}return!0}};function Ph(o){return X1.ViewPlugin.fromClass(class{constructor(e){this.decorations=Fh(e,o)??X1.Decoration.none}update(e){if(!e.state.field(is.editorLivePreviewField)){this.decorations=X1.Decoration.none;return}(e.docChanged||e.viewportChanged||e.selectionSet)&&(this.decorations=Fh(e.view,o)??X1.Decoration.none)}},{decorations:e=>e.decorations})}var gy=Function.prototype.toString,k6=Object.create,vy=Object.prototype.toString,xy=function(){function o(){this._keys=[],this._values=[]}return o.prototype.has=function(e){return!!~this._keys.indexOf(e)},o.prototype.get=function(e){return this._values[this._keys.indexOf(e)]},o.prototype.set=function(e,t){this._keys.push(e),this._values.push(t)},o}();function yy(){return new xy}function wy(){return new WeakMap}var by=typeof WeakMap!="undefined"?wy:yy;function O6(o){if(!o)return k6(null);var e=o.constructor;if(e===Object)return o===Object.prototype?{}:k6(o);if(~gy.call(e).indexOf("[native code]"))try{return new e}catch{}return k6(o)}function My(o){var e="";return o.global&&(e+="g"),o.ignoreCase&&(e+="i"),o.multiline&&(e+="m"),o.unicode&&(e+="u"),o.sticky&&(e+="y"),e}function zy(o){return o.flags}var Cy=/test/g.flags==="g"?zy:My;function Ih(o){var e=vy.call(o);return e.substring(8,e.length-1)}function Ay(o){return o[Symbol.toStringTag]||Ih(o)}var Sy=typeof Symbol!="undefined"?Ay:Ih,_y=Object.defineProperty,Ey=Object.getOwnPropertyDescriptor,kh=Object.getOwnPropertyNames,U6=Object.getOwnPropertySymbols,Oh=Object.prototype,Uh=Oh.hasOwnProperty,Ly=Oh.propertyIsEnumerable,Gh=typeof U6=="function";function Ty(o){return kh(o).concat(U6(o))}var Dy=Gh?Ty:kh;function _4(o,e,t){for(var i=Dy(o),n=0,s=i.length,r=void 0,a=void 0;n<s;++n)if(r=i[n],!(r==="callee"||r==="caller")){if(a=Ey(o,r),!a){e[r]=t.copier(o[r],t);continue}!a.get&&!a.set&&(a.value=t.copier(a.value,t));try{_y(e,r,a)}catch{e[r]=a.value}}return e}function Hy(o,e){var t=new e.Constructor;e.cache.set(o,t);for(var i=0,n=o.length;i<n;++i)t[i]=e.copier(o[i],e);return t}function Vy(o,e){var t=new e.Constructor;return e.cache.set(o,t),_4(o,t,e)}function qh(o,e){return o.slice(0)}function Ry(o,e){return o.slice(0,o.size,o.type)}function Ny(o,e){return new e.Constructor(qh(o.buffer))}function Fy(o,e){return new e.Constructor(o.getTime())}function Wh(o,e){var t=new e.Constructor;return e.cache.set(o,t),o.forEach(function(i,n){t.set(n,e.copier(i,e))}),t}function By(o,e){return _4(o,Wh(o,e),e)}function Py(o,e){var t=O6(e.prototype);e.cache.set(o,t);for(var i in o)Uh.call(o,i)&&(t[i]=e.copier(o[i],e));return t}function Iy(o,e){var t=O6(e.prototype);e.cache.set(o,t);for(var i in o)Uh.call(o,i)&&(t[i]=e.copier(o[i],e));for(var n=U6(o),s=0,r=n.length,a=void 0;s<r;++s)a=n[s],Ly.call(o,a)&&(t[a]=e.copier(o[a],e));return t}var ky=Gh?Iy:Py;function Oy(o,e){var t=O6(e.prototype);return e.cache.set(o,t),_4(o,t,e)}function G6(o,e){return new e.Constructor(o.valueOf())}function Uy(o,e){var t=new e.Constructor(o.source,Cy(o));return t.lastIndex=o.lastIndex,t}function E4(o,e){return o}function jh(o,e){var t=new e.Constructor;return e.cache.set(o,t),o.forEach(function(i){t.add(e.copier(i,e))}),t}function Gy(o,e){return _4(o,jh(o,e),e)}var qy=Array.isArray,q6=Object.assign,Wy=Object.getPrototypeOf||function(o){return o.__proto__},Zh={array:Hy,arrayBuffer:qh,blob:Ry,dataView:Ny,date:Fy,error:E4,map:Wh,object:ky,regExp:Uy,set:jh},jy=q6({},Zh,{array:Vy,map:By,object:Oy,set:Gy});function Zy(o){return{Arguments:o.object,Array:o.array,ArrayBuffer:o.arrayBuffer,Blob:o.blob,Boolean:G6,DataView:o.dataView,Date:o.date,Error:o.error,Float32Array:o.arrayBuffer,Float64Array:o.arrayBuffer,Int8Array:o.arrayBuffer,Int16Array:o.arrayBuffer,Int32Array:o.arrayBuffer,Map:o.map,Number:G6,Object:o.object,Promise:E4,RegExp:o.regExp,Set:o.set,String:G6,WeakMap:E4,WeakSet:E4,Uint8Array:o.arrayBuffer,Uint8ClampedArray:o.arrayBuffer,Uint16Array:o.arrayBuffer,Uint32Array:o.arrayBuffer,Uint64Array:o.arrayBuffer}}function Xh(o){var e=q6({},Zh,o),t=Zy(e),i=t.Array,n=t.Object;function s(r,a){if(a.prototype=a.Constructor=void 0,!r||typeof r!="object")return r;if(a.cache.has(r))return a.cache.get(r);if(a.prototype=Wy(r),a.Constructor=a.prototype&&a.prototype.constructor,!a.Constructor||a.Constructor===Object)return n(r,a);if(qy(r))return i(r,a);var c=t[Sy(r)];return c?c(r,a):typeof r.then=="function"?r:n(r,a)}return function(a){return s(a,{Constructor:void 0,cache:by(),copier:s,prototype:void 0})}}function Xy(o){return Xh(q6({},jy,o))}var yA=Xy({}),Yh=Xh({});String.prototype.matchAll=String.prototype.matchAll||function*(e){let t=e.global?e.flags:e.flags+"g",i=new RegExp(e,t),n;for(;n=i.exec(this);)yield n};var Er={showFudgeIcon:!1,rollLinksForTags:!1,copyContentButton:!0,customFormulas:[],displayFormulaForMod:!0,displayResultsInline:!1,displayFormulaAfter:!1,escapeDiceMod:!0,signed:!1,displayLookupRoll:!0,formulas:{},persistResults:!1,results:{},defaultRoll:1,defaultFace:100,renderer:!1,renderAllDice:!1,addToView:!1,renderTime:2e3,colorfulDice:!1,scaler:1,diceColor:"#202020",textColor:"#ffffff",showLeafOnStartup:!0,showDice:!0,displayAsEmbed:!0,round:zt.None,initialDisplay:ht.Roll,icons:Yh(k3)},W6=class extends pt.Plugin{constructor(){super(...arguments);this.api=new h1(this);this.fileMap=new Map;this.inline=new Map;this.operators={"+":(e,t)=>e+t,"-":(e,t)=>e-t,"*":(e,t)=>e*t,"/":(e,t)=>e/t,"^":(e,t)=>Math.pow(e,t)};this.persistingFiles=new Set}getRendererData(){return{diceColor:this.data.diceColor,textColor:this.data.textColor,colorfulDice:this.data.colorfulDice,scaler:this.data.scaler,renderTime:this.data.renderTime}}async onload(){console.log("DiceRoller plugin loaded"),this.data=Object.assign({},Er,await this.loadData()),this.renderer=new es(this.getRendererData()),this.parser=new S4(this.data.defaultRoll,this.data.defaultFace),this.addSettingTab(new _r(this.app,this)),this.registerView(yi,i=>new fs(this,i)),this.registerEvent(this.app.workspace.on("dice-roller:render-dice",async i=>{let n=await this.getRoller(i,"external");if(!(n instanceof Wt)){new pt.Notice("The Dice View only supports dice rolls.");return}if(await n.roll(),!n.dice.length){new pt.Notice("Invalid formula.");return}try{this.renderRoll(n)}catch(s){new pt.Notice("There was an error rendering the roll."),console.error(s)}this.app.workspace.trigger("dice-roller:rendered-result",n.result)})),this.addCommand({id:"open-view",name:"Open Dice View",callback:()=>{this.view?this.app.workspace.revealLeaf(this.view.leaf):this.addDiceView()}}),this.addCommand({id:"reroll",name:"Re-roll Dice",checkCallback:i=>{let n=this.app.workspace.getActiveViewOfType(pt.MarkdownView);if(n&&(n.getMode()==="preview"||n.editor.cm.state.field(pt.editorLivePreviewField))&&this.fileMap.has(n.file))return i||this.fileMap.get(n.file).forEach(r=>{r instanceof mr&&r.roll()}),!0}});let e=U4(Y6).html[0];(0,pt.addIcon)(m1,e);let t=U4($6).html[0];(0,pt.addIcon)(N1,t),this.registerMarkdownPostProcessor(this.postprocessor.bind(this)),this.registerEditorExtension([Ph(this)]),this.app.workspace.onLayoutReady(async()=>{this.addDiceView(!0),await this.registerDataviewInlineFields()}),this.app.workspace.trigger("dice-roller:loaded")}addToFileMap(e,t){this.fileMap.has(e)||this.fileMap.set(e,[]),this.fileMap.set(e,[...this.fileMap.get(e),t])}async postprocessor(e,t){let i=e.querySelectorAll("code");if(!i.length)return;let n=t.sourcePath,s=t.getSectionInfo(e),r=t.getSectionInfo(e)?.lineStart,a=this.app.vault.getAbstractFileByPath(t.sourcePath);if((!a||!(a instanceof pt.TFile))&&n!="STATBLOCK_RENDERER")return;let c={},l,h=!1,f=[];for(let u=0;u<i.length;u++){let d=i.item(u);if(a&&a instanceof pt.TFile&&/^dice\-mod:\s*([\s\S]+)\s*?/.test(d.innerText)&&s)try{h||(l=(await this.app.vault.cachedRead(a)).split(`
|
|
`),h=!0);let[p,v]=d.innerText.match(/^dice\-mod:\s*([\s\S]+)\s*?/),x=this.data.displayFormulaForMod;v.includes("|noform")&&(x=!1),v.includes("|form")&&(x=!0),v=v.replace("|noform","").replace("|form","");let g=await this.getRoller(v,t.sourcePath);g instanceof Wt&&(g.shouldRender&&(g.hasRunOnce=!0),g.on("new-result",()=>{this.data.addToView&&this.view?.addResult(g)})),f.push(new Promise((m,z)=>{g.on("new-result",async()=>{let y=l.slice(s.lineStart,s.lineEnd+1),b=g.replacer;if(!b){new pt.Notice("Dice Roller: There was an issue modifying the file.");return}let S=x?`${g.inlineText} ${b}`:`${b}`;this.data.escapeDiceMod&&(y=y.join(`
|
|
`).replace(`\`${p}\``,S.replace(/([\*\[\]])/g,"\\$1")).split(`
|
|
`)),l.splice(s.lineStart,s.lineEnd-s.lineStart+1,...y),m()})})),await g.roll();continue}catch(p){console.error(p)}if(!!/^dice(?:\+|\-|\-mod)?:\s*([\s\S]+)\s*?/.test(d.innerText))try{let[,p]=d.innerText.match(/^dice(?:\+|\-|\-mod)?:\s*([\s\S]+)\s*?/),v=await this.getRoller(p,t.sourcePath),x=this.data.results?.[n]?.[r]?.[u]??null;(this.data.persistResults&&!/dice\-/.test(d.innerText)||/dice\+/.test(d.innerText))&&(this.persistingFiles.add(t.sourcePath),c[u]=v,v.save=!0);let g=this.data.renderAllDice;p.includes("|render")&&(g=!0),p.includes("|norender")&&(g=!1);let m=async()=>{await v.roll(),v.save&&x&&await v.applyResult(x),v instanceof Wt&&(v.shouldRender=g,v.on("new-result",()=>{this.data.addToView&&this.view?.addResult(v)})),d.replaceWith(v.containerEl)};if(v.loaded?await m():v.on("loaded",async()=>{await m()}),!a||!(a instanceof pt.TFile))continue;this.addToFileMap(a,v);let z=this.app.workspace.getActiveViewOfType(pt.MarkdownView);if(z&&this.fileMap.has(a)&&this.fileMap.get(a).length===1){let y=this,b=G4(z,{onUnloadFile:function(S){return async function(_){return _==a&&(y.fileMap.delete(a),b()),await S.call(this,_)}}});z.register(b),z.register(()=>this.fileMap.delete(a))}}catch(p){console.error(p),new pt.Notice(`There was an error parsing the dice string: ${d.innerText}.
|
|
|
|
${p}`,5e3);continue}}if(!(!a||!(a instanceof pt.TFile))&&(h&&f.length&&(await Promise.all(f),await this.app.vault.modify(a,l.join(`
|
|
`))),n in this.data.results&&(this.data.results[n][r]={}),Object.entries(c).length)){let u=this.app.workspace.getActiveViewOfType(pt.MarkdownView);if(u){let d=this,p=G4(u,{onUnloadFile:function(v){return async function(x){if(x=a){d.persistingFiles.has(n)&&(d.persistingFiles.delete(n),d.data.results[n]={});for(let g in c){let m=c[g],z=t.getSectionInfo(e)?.lineStart;if(z==null)continue;let y={[z]:{...d.data.results[n]?.[z]??{},[g]:m.toResult()}};d.data.results[n]={...d.data.results[n]??{},...y},await d.saveSettings()}}return p(),await v.call(this,x)}}});u.register(p),u.register(async()=>{this.persistingFiles.has(n)&&(this.persistingFiles.delete(n),this.data.results[n]={});for(let v in c){let x=c[v],g=t.getSectionInfo(e)?.lineStart;if(g==null)continue;let m={[g]:{...this.data.results[n]?.[g]??{},[v]:x.toResult()}};this.data.results[n]={...this.data.results[n]??{},...m},await this.saveSettings()}})}}}get canUseDataview(){return this.app.plugins.getPlugin("dataview")!=null}get dataview(){return this.app.plugins.getPlugin("dataview")}get dataviewAPI(){return(0,$h.getAPI)()}async dataviewReady(){return new Promise(e=>{this.canUseDataview||e(!1),this.dataview.api&&e(!0),this.registerEvent(this.app.metadataCache.on("dataview:api-ready",()=>{e(!0)}))})}get view(){let e=this.app.workspace.getLeavesOfType(yi),t=e.length?e[0]:null;if(t&&t.view&&t.view instanceof fs)return t.view}async getArrayRoller(e,t=1){let i=new j4(this,e,t);return await i.roll(),i}async addDiceView(e=!1){e&&!this.data.showLeafOnStartup||this.app.workspace.getLeavesOfType(yi).length||await this.app.workspace.getRightLeaf(!1).setViewState({type:yi})}async registerDataviewInlineFields(){if(!this.canUseDataview)return;await this.dataviewReady(),this.dataview.index.pages.forEach(({fields:t})=>{for(let[i,n]of t)typeof n!="number"||Number.isNaN(n)||n==null||this.inline.set(i,n)}),this.parser.setInlineFields(this.inline),this.registerEvent(this.app.metadataCache.on("dataview:metadata-change",(t,i)=>{if(t==="update"){let n=this.dataview.api.page(i.path);if(!n)return;for(let s in n){let r=n[s];typeof r!="number"||Number.isNaN(r)||r==null||this.inline.set(s,r)}this.parser.setInlineFields(this.inline)}}))}async renderRoll(e){await e.roll(!0)}async parseDice(e,t){let i=await this.getRoller(e,t);return{result:await i.roll(),roller:i}}parseDiceSync(e,t){let i=this.getRollerSync(e,t);if(i instanceof Wt)return{result:i.result,roller:i}}clearEmpties(e){for(var t in e)!e[t]||typeof e[t]!="object"||(this.clearEmpties(e[t]),Object.keys(e[t]).length===0&&delete e[t])}async saveSettings(){this.clearEmpties(this.data.results),await this.saveData(this.data)}get dataview_regex(){let e=Array.from(this.inline.keys());return e.length?new RegExp(`(${e.join("|")})`,"g"):null}getParametersForRoller(e,t){e=e.replace(/\\\|/g,"|");let i=t?.showDice??!0,n=t?.shouldRender??this.data.renderAllDice,s=t?.showFormula??this.data.displayResultsInline,r=t?.showParens??this.data.displayFormulaAfter,a=t?.expectedValue??this.data.initialDisplay,c=t?.text??"",l=t?.round??this.data.round,h=t?.signed??this.data.signed,f=/\|text\((.*)\)/;if(e.includes("|nodice")&&(i=!1),e.includes("|render")&&(n=!0),e.includes("|norender")&&(n=!1),e.includes("|form")&&(s=!0),e.includes("|noform")&&(s=!1),e.includes("|avg")&&(a=ht.Average),e.includes("|none")&&(a=ht.None),e.includes("|text(")){let[,u]=e.match(f)??[null,""];c=u}return e.includes("|paren")&&(r=!0),e.includes("|noparen")&&(r=!1),e.includes("|round")&&(l=zt.Normal),e.includes("|noround")&&(l=zt.None),e.includes("|ceil")&&(l=zt.Up),e.includes("|floor")&&(l=zt.Down),e.includes("|signed")&&(h=!0),e=(0,Jh.decode)(e.replace("|nodice","").replace("|render","").replace("|norender","").replace("|noform","").replace("|form","").replace("|noparen","").replace("|paren","").replace("|avg","").replace("|none","").replace("|round","").replace("|noround","").replace("|ceil","").replace("|floor","").replace("|signed","").replace(f,"")),e in this.data.formulas&&(e=this.data.formulas[e]),{content:e,showDice:i,showParens:r,showFormula:s,expectedValue:a,shouldRender:n,text:c,round:l,signed:h}}async getRoller(e,t="",i=h1.RollerOptions(this)){let{content:n,showDice:s,showParens:r,showFormula:a,expectedValue:c,round:l,shouldRender:h,text:f,signed:u}=this.getParametersForRoller(e,i),d=this.parse(n);switch(this.getTypeFromLexemes(d)){case"dice":{let v=new Wt(this,n,d,this.renderer,s,f,c,r,l,u);return v.showFormula=a,v.shouldRender=h,v}case"table":{let v=new Xi(this,n,d[0],t,s);return await v.init,v}case"section":return new Zi(this,n,d[0],t,s);case"dataview":{if(!this.canUseDataview)throw new Error("Tags are only supported with the Dataview plugin installed.");return new wr(this,n,d[0],t,s)}case"tag":{if(!this.canUseDataview)throw new Error("Tags are only supported with the Dataview plugin installed.");return new br(this,n,d[0],t,s)}case"line":return new yr(this,n,d[0],t,s)}}getRollerSync(e,t,i=h1.RollerOptions(this)){let{content:n,showDice:s,showParens:r,showFormula:a,expectedValue:c,shouldRender:l,text:h,round:f,signed:u}=this.getParametersForRoller(e,i),d=this.parse(n);switch(this.getTypeFromLexemes(d)){case"dice":{let v=new Wt(this,n,d,this.renderer,s,h,c,r,f,u);return v.shouldRender=l,v.showFormula=a,v}case"table":{let v=new Xi(this,n,d[0],t,s);return v.init,v}case"section":return new Zi(this,n,d[0],t,s);case"dataview":{if(!this.canUseDataview)throw new Error("Tags are only supported with the Dataview plugin installed.");return new wr(this,n,d[0],t,s)}case"tag":{if(!this.canUseDataview)throw new Error("Tags are only supported with the Dataview plugin installed.");return new br(this,n,d[0],t,s)}case"line":return new yr(this,n,d[0],t,s)}}getTypeFromLexemes(e){return e.some(({type:t})=>t==="table")?"table":e.some(({type:t})=>t==="section")?"section":e.some(({type:t})=>t==="dataview")?"dataview":e.some(({type:t})=>t==="tag")?"tag":e.some(({type:t})=>t==="link")?"link":e.some(({type:t})=>t==="line")?"line":"dice"}onunload(){console.log("DiceRoller unloaded"),this.app.workspace.getLeavesOfType(yi).forEach(e=>e.detach()),"__THREE__"in window&&delete window.__THREE__,this.renderer.unload(),this.app.workspace.trigger("dice-roller:unload")}parse(e){return this.parser.parse(e)}};
|
|
/*!
|
|
* Font Awesome Free 5.15.3 by @fontawesome - https://fontawesome.com
|
|
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
|
*/
|
|
/*!
|
|
* Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com
|
|
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
|
*/
|
|
/*! https://mths.be/he v1.2.0 by @mathias | MIT license */
|
|
/**
|
|
* @license
|
|
* Copyright 2010-2022 Three.js Authors
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|