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.

3567 lines
1006 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 o7=Object.create;var aa=Object.defineProperty;var c7=Object.getOwnPropertyDescriptor;var l7=Object.getOwnPropertyNames;var h7=Object.getPrototypeOf,u7=Object.prototype.hasOwnProperty;var Ar=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),f7=(a,e)=>{for(var t in e)aa(a,t,{get:e[t],enumerable:!0})},Zc=(a,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of l7(e))!u7.call(a,n)&&n!==t&&aa(a,n,{get:()=>e[n],enumerable:!(i=c7(e,n))||i.enumerable});return a};var oa=(a,e,t)=>(t=a!=null?o7(h7(a)):{},Zc(e||!a||!a.__esModule?aa(t,"default",{value:a,enumerable:!0}):t,a)),d7=a=>Zc(aa({},"__esModule",{value:!0}),a);var Xc=Ar(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});require("obsidian");var p7=a=>{var e;return a?(e=a.plugins.plugins.dataview)===null||e===void 0?void 0:e.api:window.DataviewAPI},m7=a=>a.plugins.enabledPlugins.has("dataview");ca.getAPI=p7;ca.isPluginEnabled=m7});var T8=Ar((ga,Lr)=>{(function(a){var e=typeof ga=="object"&&ga,t=typeof Lr=="object"&&Lr&&Lr.exports==e&&Lr,i=typeof global=="object"&&global;(i.global===i||i.window===i)&&(a=i);var n=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,r=/[\x01-\x7F]/g,s=/[\x01-\t\x0B\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,o=/<\u20D2|=\u20E5|>\u20D2|\u205F\u200A|\u219D\u0338|\u2202\u0338|\u2220\u20D2|\u2229\uFE00|\u222A\uFE00|\u223C\u20D2|\u223D\u0331|\u223E\u0333|\u2242\u0338|\u224B\u0338|\u224D\u20D2|\u224E\u0338|\u224F\u0338|\u2250\u0338|\u2261\u20E5|\u2264\u20D2|\u2265\u20D2|\u2266\u0338|\u2267\u0338|\u2268\uFE00|\u2269\uFE00|\u226A\u0338|\u226A\u20D2|\u226B\u0338|\u226B\u20D2|\u227F\u0338|\u2282\u20D2|\u2283\u20D2|\u228A\uFE00|\u228B\uFE00|\u228F\u0338|\u2290\u0338|\u2293\uFE00|\u2294\uFE00|\u22B4\u20D2|\u22B5\u20D2|\u22D8\u0338|\u22D9\u0338|\u22DA\uFE00|\u22DB\uFE00|\u22F5\u0338|\u22F9\u0338|\u2933\u0338|\u29CF\u0338|\u29D0\u0338|\u2A6D\u0338|\u2A70\u0338|\u2A7D\u0338|\u2A7E\u0338|\u2AA1\u0338|\u2AA2\u0338|\u2AAC\uFE00|\u2AAD\uFE00|\u2AAF\u0338|\u2AB0\u0338|\u2AC5\u0338|\u2AC6\u0338|\u2ACB\uFE00|\u2ACC\uFE00|\u2AFD\u20E5|[\xA0-\u0113\u0116-\u0122\u0124-\u012B\u012E-\u014D\u0150-\u017E\u0192\u01B5\u01F5\u0237\u02C6\u02C7\u02D8-\u02DD\u0311\u0391-\u03A1\u03A3-\u03A9\u03B1-\u03C9\u03D1\u03D2\u03D5\u03D6\u03DC\u03DD\u03F0\u03F1\u03F5\u03F6\u0401-\u040C\u040E-\u044F\u0451-\u045C\u045E\u045F\u2002-\u2005\u2007-\u2010\u2013-\u2016\u2018-\u201A\u201C-\u201E\u2020-\u2022\u2025\u2026\u2030-\u2035\u2039\u203A\u203E\u2041\u2043\u2044\u204F\u2057\u205F-\u2063\u20AC\u20DB\u20DC\u2102\u2105\u210A-\u2113\u2115-\u211E\u2122\u2124\u2127-\u2129\u212C\u212D\u212F-\u2131\u2133-\u2138\u2145-\u2148\u2153-\u215E\u2190-\u219B\u219D-\u21A7\u21A9-\u21AE\u21B0-\u21B3\u21B5-\u21B7\u21BA-\u21DB\u21DD\u21E4\u21E5\u21F5\u21FD-\u2205\u2207-\u2209\u220B\u220C\u220F-\u2214\u2216-\u2218\u221A\u221D-\u2238\u223A-\u2257\u2259\u225A\u225C\u225F-\u2262\u2264-\u228B\u228D-\u229B\u229D-\u22A5\u22A7-\u22B0\u22B2-\u22BB\u22BD-\u22DB\u22DE-\u22E3\u22E6-\u22F7\u22F9-\u22FE\u2305\u2306\u2308-\u2310\u2312\u2313\u2315\u2316\u231C-\u231F\u2322\u2323\u232D\u232E\u2336\u233D\u233F\u237C\u23B0\u23B1\u23B4-\u23B6\u23DC-\u23DF\u23E2\u23E7\u2423\u24C8\u2500\u2502\u250C\u2510\u2514\u2518\u251C\u2524\u252C\u2534\u253C\u2550-\u256C\u2580\u2584\u2588\u2591-\u2593\u25A1\u25AA\u25AB\u25AD\u25AE\u25B1\u25B3-\u25B5\u25B8\u25B9\u25BD-\u25BF\u25C2\u25C3\u25CA\u25CB\u25EC\u25EF\u25F8-\u25FC\u2605\u2606\u260E\u2640\u2642\u2660\u2663\u2665\u2666\u266A\u266D-\u266F\u2713\u2717\u2720\u2736\u2758\u2772\u2773\u27C8\u27C9\u27E6-\u27ED\u27F5-\u27FA\u27FC\u27FF\u2902-\u2905\u290C-\u2913\u2916\u2919-\u2920\u2923-\u292A\u2933\u2935-\u2939\u293C\u293D\u2945\u2948-\u294B\u294E-\u2976\u2978\u2979\u297B-\u297F\u2985\u2986\u298B-\u2996\u299A\u299C\u299D\u29A4-\u29B7\u29B9\u29BB\u29BC\u29BE-\u29C5\u29C9\u29CD-\u29D0\u29DC-\u29DE\u29E3-\u29E5\u29EB\u29F4\u29F6\u2A00-\u2A02\u2A04\u2A06\u2A0C\u2A0D\u2A10-\u2A17\u2A22-\u2A27\u2A29\u2A2A\u2A2D-\u2A31\u2A33-\u2A3C\u2A3F\u2A40\u2A42-\u2A4D\u2A50\u2A53-\u2A58\u2A5A-\u2A5D\u2A5F\u2A66\u2A6A\u2A6D-\u2A75\u2A77-\u2A9A\u2A9D-\u2AA2\u2AA4-\u2AB0\u2AB3-\u2AC8\u2ACB\u2ACC\u2ACF-\u2ADB\u2AE4\u2AE6-\u2AE9\u2AEB-\u2AF3\u2AFD\uFB00-\uFB04]|\uD835[\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDCCF\uDD04\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDD6B]/g,c={"\xAD":"shy","\u200C":"zwnj","\u200D":"zwj","\u200E":"lrm","\u2063":"ic","\u2062":"it","\u2061":"af","\u200F":"rlm","\u200B":"ZeroWidthSpace","\u2060":"NoBreak","\u0311":"DownBreve","\u20DB":"tdot","\u20DC":"DotDot"," ":"Tab","\n":"NewLine","\u2008":"puncsp","\u205F":"MediumSpace","\u2009":"thinsp","\u200A":"hairsp","\u2004":"emsp13","\u2002":"ensp","\u2005":"emsp14","\u2003":"emsp","\u2007":"numsp","\xA0":"nbsp","\u205F\u200A":"ThickSpace","\u203E":"oline",_:"lowbar","\u2010":"dash","\u2013":"ndash","\u2014":"mdash","\u2015":"horbar",",":"comma",";":"semi","\u204F":"bsemi",":":"colon","\u2A74":"Colone","!":"excl","\xA1":"iexcl","?":"quest","\xBF":"iquest",".":"period","\u2025":"nldr","\u2026":"mldr","\xB7":"middot","'":"apos","\u2018":"lsquo","\u2019":"rsquo","\u201A":"sbquo","\u2039":"lsaquo","\u203A":"rsaquo",'"':"quot","\u201C":"ldquo","\u201D":"rdquo","\u201E":"bdquo","\xAB":"laquo","\xBB":"raquo","(":"lpar",")":"rpar","[":"lsqb","]":"rsqb","{":"lcub","}":"rcub","\u2308":"lceil","\u2309":"rceil","\u230A":"lfloor","\u230B":"rfloor","\u2985":"lopar","\u2986":"ropar","\u298B":"lbrke","\u298C":"rbrke","\u298D":"lbrkslu","\u298E":"rbrksld","\u298F":"lbrksld","\u2990":"rbrkslu","\u2991":"langd","\u2992":"rangd","\u2993":"lparlt","\u2994":"rpargt","\u2995":"gtlPar","\u2996":"ltrPar","\u27E6":"lobrk","\u27E7":"robrk","\u27E8":"lang","\u27E9":"rang","\u27EA":"Lang","\u27EB":"Rang","\u27EC":"loang","\u27ED":"roang","\u2772":"lbbrk","\u2773":"rbbrk","\u2016":"Vert","\xA7":"sect","\xB6":"para","@":"commat","*":"ast","/":"sol",undefined:null,"&":"amp","#":"num","%":"percnt","\u2030":"permil","\u2031":"pertenk","\u2020":"dagger","\u2021":"Dagger","\u2022":"bull","\u2043":"hybull","\u2032":"prime","\u2033":"Prime","\u2034":"tprime","\u2057":"qprime","\u2035":"bprime","\u2041":"caret","`":"grave","\xB4":"acute","\u02DC":"tilde","^":"Hat","\xAF":"macr","\u02D8":"breve","\u02D9":"dot","\xA8":"die","\u02DA":"ring","\u02DD":"dblac","\xB8":"cedil","\u02DB":"ogon","\u02C6":"circ","\u02C7":"caron","\xB0":"deg","\xA9":"copy","\xAE":"reg","\u2117":"copysr","\u2118":"wp","\u211E":"rx","\u2127":"mho","\u2129":"iiota","\u2190":"larr","\u219A":"nlarr","\u2192":"rarr","\u219B":"nrarr","\u2191":"uarr","\u2193":"darr","\u2194":"harr","\u21AE":"nharr","\u2195":"varr","\u2196":"nwarr","\u2197":"nearr","\u2198":"searr","\u2199":"swarr","\u219D":"rarrw","\u219D\u0338":"nrarrw","\u219E":"Larr","\u219F":"Uarr","\u21A0":"Rarr","\u21A1":"Darr","\u21A2":"larrtl","\u21A3":"rarrtl","\u21A4":"mapstoleft","\u21A5":"mapstoup","\u21A6":"map","\u21A7":"mapstodown","\u21A9":"larrhk","\u21AA":"rarrhk","\u21AB":"larrlp","\u21AC":"rarrlp","\u21AD":"harrw","\u21B0":"lsh","\u21B1":"rsh","\u21B2":"ldsh","\u21B3":"rdsh","\u21B5":"crarr","\u21B6":"cularr","\u21B7":"curarr","\u21BA":"olarr","\u21BB":"orarr","\u21BC":"lharu","\u21BD":"lhard","\u21BE":"uharr","\u21BF":"uharl","\u21C0":"rharu","\u21C1":"rhard","\u21C2":"dharr","\u21C3":"dharl","\u21C4":"rlarr","\u21C5":"udarr","\u21C6":"lrarr","\u21C7":"llarr","\u21C8":"uuarr","\u21C9":"rrarr","\u21CA":"ddarr","\u21CB":"lrhar","\u21CC":"rlhar","\u21D0":"lArr","\u21CD":"nlArr","\u21D1":"uArr","\u21D2":"rArr","\u21CF":"nrArr","\u21D3":"dArr","\u21D4":"iff","\u21CE":"nhArr","\u21D5":"vArr","\u21D6":"nwArr","\u21D7":"neArr","\u21D8":"seArr","\u21D9":"swArr","\u21DA":"lAarr","\u21DB":"rAarr","\u21DD":"zigrarr","\u21E4":"larrb","\u21E5":"rarrb","\u21F5":"duarr","\u21FD":"loarr","\u21FE":"roarr","\u21FF":"hoarr","\u2200":"forall","\u2201":"comp","\u2202":"part","\u2202\u0338":"npart","\u2203":"exist","\u2204":"nexist","\u2205":"empty","\u2207":"Del","\u2208":"in","\u2209":"notin","\u220B":"ni","\u220C":"notni","\u03F6":"bepsi","\u220F":"prod","\u2210":"coprod","\u2211":"sum","+":"plus","\xB1":"pm","\xF7":"div","\xD7":"times","<":"lt","\u226E":"nlt","<\u20D2":"nvlt","=":"equals","\u2260":"ne","=\u20E5":"bne","\u2A75":"Equal",">":"gt","\u226F":"ngt",">\u20D2":"nvgt","\xAC":"not","|":"vert","\xA6":"brvbar","\u2212":"minus","\u2213":"mp","\u2214":"plusdo","\u2044":"frasl","\u2216":"setmn","\u2217":"lowast","\u2218":"compfn","\u221A":"Sqrt","\u221D":"prop","\u221E":"infin","\u221F":"angrt","\u2220":"ang","\u2220\u20D2":"nang","\u2221":"angmsd","\u2222":"angsph","\u2223":"mid","\u2224":"nmid","\u2225":"par","\u2226":"npar","\u2227":"and","\u2228":"or","\u2229":"cap","\u2229\uFE00":"caps","\u222A":"cup","\u222A\uFE00":"cups","\u222B":"int","\u222C":"Int","\u222D":"tint","\u2A0C":"qint","\u222E":"oint","\u222F":"Conint","\u2230":"Cconint","\u2231":"cwint","\u2232":"cwconint","\u2233":"awconint","\u2234":"there4","\u2235":"becaus","\u2236":"ratio","\u2237":"Colon","\u2238":"minusd","\u223A":"mDDot","\u223B":"homtht","\u223C":"sim","\u2241":"nsim","\u223C\u20D2":"nvsim","\u223D":"bsim","\u223D\u0331":"race","\u223E":"ac","\u223E\u0333":"acE","\u223F":"acd","\u2240":"wr","\u2242":"esim","\u2242\u0338":"nesim","\u2243":"sime","\u2244":"nsime","\u2245":"cong","\u2247":"ncong","\u2246":"simne","\u2248":"ap","\u2249":"nap","\u224A":"ape","\u224B":"apid","\u224B\u0338":"napid","\u224C":"bcong","\u224D":"CupCap","\u226D":"NotCupCap","\u224D\u20D2":"nvap","\u224E":"bump","\u224E\u0338":"nbump","\u224F":"bumpe","\u224F\u0338":"nbumpe","\u2250":"doteq","\u2250\u0338":"nedot","\u2251":"eDot","\u2252":"efDot","\u2253":"erDot","\u2254":"colone","\u2255":"ecolon","\u2256":"ecir","\u2257":"cire","\u2259":"wedgeq","\u225A":"veeeq","\u225C":"trie","\u225F":"equest","\u2261":"equiv","\u2262":"nequiv","\u2261\u20E5":"bnequiv","\u2264":"le","\u2270":"nle","\u2264\u20D2":"nvle","\u2265":"ge","\u2271":"nge","\u2265\u20D2":"nvge","\u2266":"lE","\u2266\u0338":"nlE","\u2267":"gE","\u2267\u0338":"ngE","\u2268\uFE00":"lvnE","\u2268":"lnE","\u2269":"gnE","\u2269\uFE00":"gvnE","\u226A":"ll","\u226A\u0338":"nLtv","\u226A\u20D2":"nLt","\u226B":"gg","\u226B\u0338":"nGtv","\u226B\u20D2":"nGt","\u226C":"twixt","\u2272":"lsim","\u2274":"nlsim","\u2273":"gsim","\u2275":"ngsim","\u2276":"lg","\u2278":"ntlg","\u2277":"gl","\u2279":"ntgl","\u227A":"pr","\u2280":"npr","\u227B":"sc","\u2281":"nsc","\u227C":"prcue","\u22E0":"nprcue","\u227D":"sccue","\u22E1":"nsccue","\u227E":"prsim","\u227F":"scsim","\u227F\u0338":"NotSucceedsTilde","\u2282":"sub","\u2284":"nsub","\u2282\u20D2":"vnsub","\u2283":"sup","\u2285":"nsup","\u2283\u20D2":"vnsup","\u2286":"sube","\u2288":"nsube","\u2287":"supe","\u2289":"nsupe","\u228A\uFE00":"vsubne","\u228A":"subne","\u228B\uFE00":"vsupne","\u228B":"supne","\u228D":"cupdot","\u228E":"uplus","\u228F":"sqsub","\u228F\u0338":"NotSquareSubset","\u2290":"sqsup","\u2290\u0338":"NotSquareSuperset","\u2291":"sqsube","\u22E2":"nsqsube","\u2292":"sqsupe","\u22E3":"nsqsupe","\u2293":"sqcap","\u2293\uFE00":"sqcaps","\u2294":"sqcup","\u2294\uFE00":"sqcups","\u2295":"oplus","\u2296":"ominus","\u2297":"otimes","\u2298":"osol","\u2299":"odot","\u229A":"ocir","\u229B":"oast","\u229D":"odash","\u229E":"plusb","\u229F":"minusb","\u22A0":"timesb","\u22A1":"sdotb","\u22A2":"vdash","\u22AC":"nvdash","\u22A3":"dashv","\u22A4":"top","\u22A5":"bot","\u22A7":"models","\u22A8":"vDash","\u22AD":"nvDash","\u22A9":"Vdash","\u22AE":"nVdash","\u22AA":"Vvdash","\u22AB":"VDash","\u22AF":"nVDash","\u22B0":"prurel","\u22B2":"vltri","\u22EA":"nltri","\u22B3":"vrtri","\u22EB":"nrtri","\u22B4":"ltrie","\u22EC":"nltrie","\u22B4\u20D2":"nvltrie","\u22B5":"rtrie","\u22ED":"nrtrie","\u22B5\u20D2":"nvrtrie","\u22B6":"origof","\u22B7":"imof","\u22B8":"mumap","\u22B9":"hercon","\u22BA":"intcal","\u22BB":"veebar","\u22BD":"barvee","\u22BE":"angrtvb","\u22BF":"lrtri","\u22C0":"Wedge","\u22C1":"Vee","\u22C2":"xcap","\u22C3":"xcup","\u22C4":"diam","\u22C5":"sdot","\u22C6":"Star","\u22C7":"divonx","\u22C8":"bowtie","\u22C9":"ltimes","\u22CA":"rtimes","\u22CB":"lthree","\u22CC":"rthree","\u22CD":"bsime","\u22CE":"cuvee","\u22CF":"cuwed","\u22D0":"Sub","\u22D1":"Sup","\u22D2":"Cap","\u22D3":"Cup","\u22D4":"fork","\u22D5":"epar","\u22D6":"ltdot","\u22D7":"gtdot","\u22D8":"Ll","\u22D8\u0338":"nLl","\u22D9":"Gg","\u22D9\u0338":"nGg","\u22DA\uFE00":"lesg","\u22DA":"leg","\u22DB":"gel","\u22DB\uFE00":"gesl","\u22DE":"cuepr","\u22DF":"cuesc","\u22E6":"lnsim","\u22E7":"gnsim","\u22E8":"prnsim","\u22E9":"scnsim","\u22EE":"vellip","\u22EF":"ctdot","\u22F0":"utdot","\u22F1":"dtdot","\u22F2":"disin","\u22F3":"isinsv","\u22F4":"isins","\u22F5":"isindot","\u22F5\u0338":"notindot","\u22F6":"notinvc","\u22F7":"notinvb","\u22F9":"isinE","\u22F9\u0338":"notinE","\u22FA":"nisd","\u22FB":"xnis","\u22FC":"nis","\u22FD":"notnivc","\u22FE":"notnivb","\u2305":"barwed","\u2306":"Barwed","\u230C":"drcrop","\u230D":"dlcrop","\u230E":"urcrop","\u230F":"ulcrop","\u2310":"bnot","\u2312":"profline","\u2313":"profsurf","\u2315":"telrec","\u2316":"target","\u231C":"ulcorn","\u231D":"urcorn","\u231E":"dlcorn","\u231F":"drcorn","\u2322":"frown","\u2323":"smile","\u232D":"cylcty","\u232E":"profalar","\u2336":"topbot","\u233D":"ovbar","\u233F":"solbar","\u237C":"angzarr","\u23B0":"lmoust","\u23B1":"rmoust","\u23B4":"tbrk","\u23B5":"bbrk","\u23B6":"bbrktbrk","\u23DC":"OverParenthesis","\u23DD":"UnderParenthesis","\u23DE":"OverBrace","\u23DF":"UnderBrace","\u23E2":"trpezium","\u23E7":"elinters","\u2423":"blank","\u2500":"boxh","\u2502":"boxv","\u250C":"boxdr","\u2510":"boxdl","\u2514":"boxur","\u2518":"boxul","\u251C":"boxvr","\u2524":"boxvl","\u252C":"boxhd","\u2534":"boxhu","\u253C":"boxvh","\u2550":"boxH","\u2551":"boxV","\u2552":"boxdR","\u2553":"boxDr","\u2554":"boxDR","\u2555":"boxdL","\u2556":"boxDl","\u2557":"boxDL","\u2558":"boxuR","\u2559":"boxUr","\u255A":"boxUR","\u255B":"boxuL","\u255C":"boxUl","\u255D":"boxUL","\u255E":"boxvR","\u255F":"boxVr","\u2560":"boxVR","\u2561":"boxvL","\u2562":"boxVl","\u2563":"boxVL","\u2564":"boxHd","\u2565":"boxhD","\u2566":"boxHD","\u2567":"boxHu","\u2568":"boxhU","\u2569":"boxHU","\u256A":"boxvH","\u256B":"boxVh","\u256C":"boxVH","\u2580":"uhblk","\u2584":"lhblk","\u2588":"block","\u2591":"blk14","\u2592":"blk12","\u2593":"blk34","\u25A1":"squ","\u25AA":"squf","\u25AB":"EmptyVerySmallSquare","\u25AD":"rect","\u25AE":"marker","\u25B1":"fltns","\u25B3":"xutri","\u25B4":"utrif","\u25B5":"utri","\u25B8":"rtrif","\u25B9":"rtri","\u25BD":"xdtri","\u25BE":"dtrif","\u25BF":"dtri","\u25C2":"ltrif","\u25C3":"ltri","\u25CA":"loz","\u25CB":"cir","\u25EC":"tridot","\u25EF":"xcirc","\u25F8":"ultri","\u25F9":"urtri","\u25FA":"lltri","\u25FB":"EmptySmallSquare","\u25FC":"FilledSmallSquare","\u2605":"starf","\u2606":"star","\u260E":"phone","\u2640":"female","\u2642":"male","\u2660":"spades","\u2663":"clubs","\u2665":"hearts","\u2666":"diams","\u266A":"sung","\u2713":"check","\u2717":"cross","\u2720":"malt","\u2736":"sext","\u2758":"VerticalSeparator","\u27C8":"bsolhsub","\u27C9":"suphsol","\u27F5":"xlarr","\u27F6":"xrarr","\u27F7":"xharr","\u27F8":"xlArr","\u27F9":"xrArr","\u27FA":"xhArr","\u27FC":"xmap","\u27FF":"dzigrarr","\u2902":"nvlArr","\u2903":"nvrArr","\u2904":"nvHarr","\u2905":"Map","\u290C":"lbarr","\u290D":"rbarr","\u290E":"lBarr","\u290F":"rBarr","\u2910":"RBarr","\u2911":"DDotrahd","\u2912":"UpArrowBar","\u2913":"DownArrowBar","\u2916":"Rarrtl","\u2919":"latail","\u291A":"ratail","\u291B":"lAtail","\u291C":"rAtail","\u291D":"larrfs","\u291E":"rarrfs","\u291F":"larrbfs","\u2920":"rarrbfs","\u2923":"nwarhk","\u2924":"nearhk","\u2925":"searhk","\u2926":"swarhk","\u2927":"nwnear","\u2928":"toea","\u2929":"tosa","\u292A":"swnwar","\u2933":"rarrc","\u2933\u0338":"nrarrc","\u2935":"cudarrr","\u2936":"ldca","\u2937":"rdca","\u2938":"cudarrl","\u2939":"larrpl","\u293C":"curarrm","\u293D":"cularrp","\u2945":"rarrpl","\u2948":"harrcir","\u2949":"Uarrocir","\u294A":"lurdshar","\u294B":"ldrushar","\u294E":"LeftRightVector","\u294F":"RightUpDownVector","\u2950":"DownLeftRightVector","\u2951":"LeftUpDownVector","\u2952":"LeftVectorBar","\u2953":"RightVectorBar","\u2954":"RightUpVectorBar","\u2955":"RightDownVectorBar","\u2956":"DownLeftVectorBar","\u2957":"DownRightVectorBar","\u2958":"LeftUpVectorBar","\u2959":"LeftDownVectorBar","\u295A":"LeftTeeVector","\u295B":"RightTeeVector","\u295C":"RightUpTeeVector","\u295D":"RightDownTeeVector","\u295E":"DownLeftTeeVector","\u295F":"DownRightTeeVector","\u2960":"LeftUpTeeVector","\u2961":"LeftDownTeeVector","\u2962":"lHar","\u2963":"uHar","\u2964":"rHar","\u2965":"dHar","\u2966":"luruhar","\u2967":"ldrdhar","\u2968":"ruluhar","\u2969":"rdldhar","\u296A":"lharul","\u296B":"llhard","\u296C":"rharul","\u296D":"lrhard","\u296E":"udhar","\u296F":"duhar","\u2970":"RoundImplies","\u2971":"erarr","\u2972":"simrarr","\u2973":"larrsim","\u2974":"rarrsim","\u2975":"rarrap","\u2976":"ltlarr","\u2978":"gtrarr","\u2979":"subrarr","\u297B":"suplarr","\u297C":"lfisht","\u297D":"rfisht","\u297E":"ufisht","\u297F":"dfisht","\u299A":"vzigzag","\u299C":"vangrt","\u299D":"angrtvbd","\u29A4":"ange","\u29A5":"range","\u29A6":"dwangle","\u29A7":"uwangle","\u29A8":"angmsdaa","\u29A9":"angmsdab","\u29AA":"angmsdac","\u29AB":"angmsdad","\u29AC":"angmsdae","\u29AD":"angmsdaf","\u29AE":"angmsdag","\u29AF":"angmsdah","\u29B0":"bemptyv","\u29B1":"demptyv","\u29B2":"cemptyv","\u29B3":"raemptyv","\u29B4":"laemptyv","\u29B5":"ohbar","\u29B6":"omid","\u29B7":"opar","\u29B9":"operp","\u29BB":"olcross","\u29BC":"odsold","\u29BE":"olcir","\u29BF":"ofcir","\u29C0":"olt","\u29C1":"ogt","\u29C2":"cirscir","\u29C3":"cirE","\u29C4":"solb","\u29C5":"bsolb","\u29C9":"boxbox","\u29CD":"trisb","\u29CE":"rtriltri","\u29CF":"LeftTriangleBar","\u29CF\u0338":"NotLeftTriangleBar","\u29D0":"RightTriangleBar","\u29D0\u0338":"NotRightTriangleBar","\u29DC":"iinfin","\u29DD":"infintie","\u29DE":"nvinfin","\u29E3":"eparsl","\u29E4":"smeparsl","\u29E5":"eqvparsl","\u29EB":"lozf","\u29F4":"RuleDelayed","\u29F6":"dsol","\u2A00":"xodot","\u2A01":"xoplus","\u2A02":"xotime","\u2A04":"xuplus","\u2A06":"xsqcup","\u2A0D":"fpartint","\u2A10":"cirfnint","\u2A11":"awint","\u2A12":"rppolint","\u2A13":"scpolint","\u2A14":"npolint","\u2A15":"pointint","\u2A16":"quatint","\u2A17":"intlarhk","\u2A22":"pluscir","\u2A23":"plusacir","\u2A24":"simplus","\u2A25":"plusdu","\u2A26":"plussim","\u2A27":"plustwo","\u2A29":"mcomma","\u2A2A":"minusdu","\u2A2D":"loplus","\u2A2E":"roplus","\u2A2F":"Cross","\u2A30":"timesd","\u2A31":"timesbar","\u2A33":"smashp","\u2A34":"lotimes","\u2A35":"rotimes","\u2A36":"otimesas","\u2A37":"Otimes","\u2A38":"odiv","\u2A39":"triplus","\u2A3A":"triminus","\u2A3B":"tritime","\u2A3C":"iprod","\u2A3F":"amalg","\u2A40":"capdot","\u2A42":"ncup","\u2A43":"ncap","\u2A44":"capand","\u2A45":"cupor","\u2A46":"cupcap","\u2A47":"capcup","\u2A48":"cupbrcap","\u2A49":"capbrcup","\u2A4A":"cupcup","\u2A4B":"capcap","\u2A4C":"ccups","\u2A4D":"ccaps","\u2A50":"ccupssm","\u2A53":"And","\u2A54":"Or","\u2A55":"andand","\u2A56":"oror","\u2A57":"orslope","\u2A58":"andslope","\u2A5A":"andv","\u2A5B":"orv","\u2A5C":"andd","\u2A5D":"ord","\u2A5F":"wedbar","\u2A66":"sdote","\u2A6A":"simdot","\u2A6D":"congdot","\u2A6D\u0338":"ncongdot","\u2A6E":"easter","\u2A6F":"apacir","\u2A70":"apE","\u2A70\u0338":"napE","\u2A71":"eplus","\u2A72":"pluse","\u2A73":"Esim","\u2A77":"eDDot","\u2A78":"equivDD","\u2A79":"ltcir","\u2A7A":"gtcir","\u2A7B":"ltquest","\u2A7C":"gtquest","\u2A7D":"les","\u2A7D\u0338":"nles","\u2A7E":"ges","\u2A7E\u0338":"nges","\u2A7F":"lesdot","\u2A80":"gesdot","\u2A81":"lesdoto","\u2A82":"gesdoto","\u2A83":"lesdotor","\u2A84":"gesdotol","\u2A85":"lap","\u2A86":"gap","\u2A87":"lne","\u2A88":"gne","\u2A89":"lnap","\u2A8A":"gnap","\u2A8B":"lEg","\u2A8C":"gEl","\u2A8D":"lsime","\u2A8E":"gsime","\u2A8F":"lsimg","\u2A90":"gsiml","\u2A91":"lgE","\u2A92":"glE","\u2A93":"lesges","\u2A94":"gesles","\u2A95":"els","\u2A96":"egs","\u2A97":"elsdot","\u2A98":"egsdot","\u2A99":"el","\u2A9A":"eg","\u2A9D":"siml","\u2A9E":"simg","\u2A9F":"simlE","\u2AA0":"simgE","\u2AA1":"LessLess","\u2AA1\u0338":"NotNestedLessLess","\u2AA2":"GreaterGreater","\u2AA2\u0338":"NotNestedGreaterGreater","\u2AA4":"glj","\u2AA5":"gla","\u2AA6":"ltcc","\u2AA7":"gtcc","\u2AA8":"lescc","\u2AA9":"gescc","\u2AAA":"smt","\u2AAB":"lat","\u2AAC":"smte","\u2AAC\uFE00":"smtes","\u2AAD":"late","\u2AAD\uFE00":"lates","\u2AAE":"bumpE","\u2AAF":"pre","\u2AAF\u0338":"npre","\u2AB0":"sce","\u2AB0\u0338":"nsce","\u2AB3":"prE","\u2AB4":"scE","\u2AB5":"prnE","\u2AB6":"scnE","\u2AB7":"prap","\u2AB8":"scap","\u2AB9":"prnap","\u2ABA":"scnap","\u2ABB":"Pr","\u2ABC":"Sc","\u2ABD":"subdot","\u2ABE":"supdot","\u2ABF":"subplus","\u2AC0":"supplus","\u2AC1":"submult","\u2AC2":"supmult","\u2AC3":"subedot","\u2AC4":"supedot","\u2AC5":"subE","\u2AC5\u0338":"nsubE","\u2AC6":"supE","\u2AC6\u0338":"nsupE","\u2AC7":"subsim","\u2AC8":"supsim","\u2ACB\uFE00":"vsubnE","\u2ACB":"subnE","\u2ACC\uFE00":"vsupnE","\u2ACC":"supnE","\u2ACF":"csub","\u2AD0":"csup","\u2AD1":"csube","\u2AD2":"csupe","\u2AD3":"subsup","\u2AD4":"supsub","\u2AD5":"subsub","\u2AD6":"supsup","\u2AD7":"suphsub","\u2AD8":"supdsub","\u2AD9":"forkv","\u2ADA":"topfork","\u2ADB":"mlcp","\u2AE4":"Dashv","\u2AE6":"Vdashl","\u2AE7":"Barv","\u2AE8":"vBar","\u2AE9":"vBarv","\u2AEB":"Vbar","\u2AEC":"Not","\u2AED":"bNot","\u2AEE":"rnmid","\u2AEF":"cirmid","\u2AF0":"midcir","\u2AF1":"topcir","\u2AF2":"nhpar","\u2AF3":"parsim","\u2AFD":"parsl","\u2AFD\u20E5":"nparsl","\u266D":"flat","\u266E":"natur","\u266F":"sharp","\xA4":"curren","\xA2":"cent",$:"dollar","\xA3":"pound","\xA5":"yen","\u20AC":"euro","\xB9":"sup1","\xBD":"half","\u2153":"frac13","\xBC":"frac14","\u2155":"frac15","\u2159":"frac16","\u215B":"frac18","\xB2":"sup2","\u2154":"frac23","\u2156":"frac25","\xB3":"sup3","\xBE":"frac34","\u2157":"frac35","\u215C":"frac38","\u2158":"frac45","\u215A":"frac56","\u215D":"frac58","\u215E":"frac78","\u{1D4B6}":"ascr","\u{1D552}":"aopf","\u{1D51E}":"afr","\u{1D538}":"Aopf","\u{1D504}":"Afr","\u{1D49C}":"Ascr",\u00AA:"ordf",\u00E1:"aacute",\u00C1:"Aacute",\u00E0:"agrave",\u00C0:"Agrave",\u0103:"abreve",\u0102:"Abreve",\u00E2:"acirc",\u00C2:"Acirc",\u00E5:"aring",\u00C5:"angst",\u00E4:"auml",\u00C4:"Auml",\u00E3:"atilde",\u00C3:"Atilde",\u0105:"aogon",\u0104:"Aogon",\u0101:"amacr",\u0100:"Amacr",\u00E6:"aelig",\u00C6:"AElig","\u{1D4B7}":"bscr","\u{1D553}":"bopf","\u{1D51F}":"bfr","\u{1D539}":"Bopf",\u212C:"Bscr","\u{1D505}":"Bfr","\u{1D520}":"cfr","\u{1D4B8}":"cscr","\u{1D554}":"copf",\u212D:"Cfr","\u{1D49E}":"Cscr",\u2102:"Copf",\u0107:"cacute",\u0106:"Cacute",\u0109:"ccirc",\u0108:"Ccirc",\u010D:"ccaron",\u010C:"Ccaron",\u010B:"cdot",\u010A:"Cdot",\u00E7:"ccedil",\u00C7:"Ccedil","\u2105":"incare","\u{1D521}":"dfr","\u2146":"dd","\u{1D555}":"dopf","\u{1D4B9}":"dscr","\u{1D49F}":"Dscr","\u{1D507}":"Dfr","\u2145":"DD","\u{1D53B}":"Dopf",\u010F:"dcaron",\u010E:"Dcaron",\u0111:"dstrok",\u0110:"Dstrok",\u00F0:"eth",\u00D0:"ETH","\u2147":"ee",\u212F:"escr","\u{1D522}":"efr","\u{1D556}":"eopf",\u2130:"Escr","\u{1D508}":"Efr","\u{1D53C}":"Eopf",\u00E9:"eacute",\u00C9:"Eacute",\u00E8:"egrave",\u00C8:"Egrave",\u00EA:"ecirc",\u00CA:"Ecirc",\u011B:"ecaron",\u011A:"Ecaron",\u00EB:"euml",\u00CB:"Euml",\u0117:"edot",\u0116:"Edot",\u0119:"eogon",\u0118:"Eogon",\u0113:"emacr",\u0112:"Emacr","\u{1D523}":"ffr","\u{1D557}":"fopf","\u{1D4BB}":"fscr","\u{1D509}":"Ffr","\u{1D53D}":"Fopf",\u2131:"Fscr",\uFB00:"fflig",\uFB03:"ffilig",\uFB04:"ffllig",\uFB01:"filig",fj:"fjlig",\uFB02:"fllig",\u0192:"fnof",\u210A:"gscr","\u{1D558}":"gopf","\u{1D524}":"gfr","\u{1D4A2}":"Gscr","\u{1D53E}":"Gopf","\u{1D50A}":"Gfr",\u01F5:"gacute",\u011F:"gbreve",\u011E:"Gbreve",\u011D:"gcirc",\u011C:"Gcirc",\u0121:"gdot",\u0120:"Gdot",\u0122:"Gcedil","\u{1D525}":"hfr",\u210E:"planckh","\u{1D4BD}":"hscr","\u{1D559}":"hopf",\u210B:"Hscr",\u210C:"Hfr",\u210D:"Hopf",\u0125:"hcirc",\u0124:"Hcirc",\u210F:"hbar",\u0127:"hstrok",\u0126:"Hstrok","\u{1D55A}":"iopf","\u{1D526}":"ifr","\u{1D4BE}":"iscr","\u2148":"ii","\u{1D540}":"Iopf",\u2110:"Iscr",\u2111:"Im",\u00ED:"iacute",\u00CD:"Iacute",\u00EC:"igrave",\u00CC:"Igrave",\u00EE:"icirc",\u00CE:"Icirc",\u00EF:"iuml",\u00CF:"Iuml",\u0129:"itilde",\u0128:"Itilde",\u0130:"Idot",\u012F:"iogon",\u012E:"Iogon",\u012B:"imacr",\u012A:"Imacr",\u0133:"ijlig",\u0132:"IJlig",\u0131:"imath","\u{1D4BF}":"jscr","\u{1D55B}":"jopf","\u{1D527}":"jfr","\u{1D4A5}":"Jscr","\u{1D50D}":"Jfr","\u{1D541}":"Jopf",\u0135:"jcirc",\u0134:"Jcirc","\u0237":"jmath","\u{1D55C}":"kopf","\u{1D4C0}":"kscr","\u{1D528}":"kfr","\u{1D4A6}":"Kscr","\u{1D542}":"Kopf","\u{1D50E}":"Kfr",\u0137:"kcedil",\u0136:"Kcedil","\u{1D529}":"lfr","\u{1D4C1}":"lscr",\u2113:"ell","\u{1D55D}":"lopf",\u2112:"Lscr","\u{1D50F}":"Lfr","\u{1D543}":"Lopf",\u013A:"lacute",\u0139:"Lacute",\u013E:"lcaron",\u013D:"Lcaron",\u013C:"lcedil",\u013B:"Lcedil",\u0142:"lstrok",\u0141:"Lstrok",\u0140:"lmidot",\u013F:"Lmidot","\u{1D52A}":"mfr","\u{1D55E}":"mopf","\u{1D4C2}":"mscr","\u{1D510}":"Mfr","\u{1D544}":"Mopf",\u2133:"Mscr","\u{1D52B}":"nfr","\u{1D55F}":"nopf","\u{1D4C3}":"nscr",\u2115:"Nopf","\u{1D4A9}":"Nscr","\u{1D511}":"Nfr",\u0144:"nacute",\u0143:"Nacute",\u0148:"ncaron",\u0147:"Ncaron",\u00F1:"ntilde",\u00D1:"Ntilde",\u0146:"ncedil",\u0145:"Ncedil","\u2116":"numero",\u014B:"eng",\u014A:"ENG","\u{1D560}":"oopf","\u{1D52C}":"ofr",\u2134:"oscr","\u{1D4AA}":"Oscr","\u{1D512}":"Ofr","\u{1D546}":"Oopf",\u00BA:"ordm",\u00F3:"oacute",\u00D3:"Oacute",\u00F2:"ograve",\u00D2:"Ograve",\u00F4:"ocirc",\u00D4:"Ocirc",\u00F6:"ouml",\u00D6:"Ouml",\u0151:"odblac",\u0150:"Odblac",\u00F5:"otilde",\u00D5:"Otilde",\u00F8:"oslash",\u00D8:"Oslash",\u014D:"omacr",\u014C:"Omacr",\u0153:"oelig",\u0152:"OElig","\u{1D52D}":"pfr","\u{1D4C5}":"pscr","\u{1D561}":"popf",\u2119:"Popf","\u{1D513}":"Pfr","\u{1D4AB}":"Pscr","\u{1D562}":"qopf","\u{1D52E}":"qfr","\u{1D4C6}":"qscr","\u{1D4AC}":"Qscr","\u{1D514}":"Qfr",\u211A:"Qopf",\u0138:"kgreen","\u{1D52F}":"rfr","\u{1D563}":"ropf","\u{1D4C7}":"rscr",\u211B:"Rscr",\u211C:"Re",\u211D:"Ropf",\u0155:"racute",\u0154:"Racute",\u0159:"rcaron",\u0158:"Rcaron",\u0157:"rcedil",\u0156:"Rcedil","\u{1D564}":"sopf","\u{1D4C8}":"sscr","\u{1D530}":"sfr","\u{1D54A}":"Sopf","\u{1D516}":"Sfr","\u{1D4AE}":"Sscr","\u24C8":"oS",\u015B:"sacute",\u015A:"Sacute",\u015D:"scirc",\u015C:"Scirc",\u0161:"scaron",\u0160:"Scaron",\u015F:"scedil",\u015E:"Scedil",\u00DF:"szlig","\u{1D531}":"tfr","\u{1D4C9}":"tscr","\u{1D565}":"topf","\u{1D4AF}":"Tscr","\u{1D517}":"Tfr","\u{1D54B}":"Topf",\u0165:"tcaron",\u0164:"Tcaron",\u0163:"tcedil",\u0162:"Tcedil","\u2122":"trade",\u0167:"tstrok",\u0166:"Tstrok","\u{1D4CA}":"uscr","\u{1D566}":"uopf","\u{1D532}":"ufr","\u{1D54C}":"Uopf","\u{1D518}":"Ufr","\u{1D4B0}":"Uscr",\u00FA:"uacute",\u00DA:"Uacute",\u00F9:"ugrave",\u00D9:"Ugrave",\u016D:"ubreve",\u016C:"Ubreve",\u00FB:"ucirc",\u00DB:"Ucirc",\u016F:"uring",\u016E:"Uring",\u00FC:"uuml",\u00DC:"Uuml",\u0171:"udblac",\u0170:"Udblac",\u0169:"utilde",\u0168:"Utilde",\u0173:"uogon",\u0172:"Uogon",\u016B:"umacr",\u016A:"Umacr","\u{1D533}":"vfr","\u{1D567}":"vopf","\u{1D4CB}":"vscr","\u{1D519}":"Vfr","\u{1D54D}":"Vopf","\u{1D4B1}":"Vscr","\u{1D568}":"wopf","\u{1D4CC}":"wscr","\u{1D534}":"wfr","\u{1D4B2}":"Wscr","\u{1D54E}":"Wopf","\u{1D51A}":"Wfr",\u0175:"wcirc",\u0174:"Wcirc","\u{1D535}":"xfr","\u{1D4CD}":"xscr","\u{1D569}":"xopf","\u{1D54F}":"Xopf","\u{1D51B}":"Xfr","\u{1D4B3}":"Xscr","\u{1D536}":"yfr","\u{1D4CE}":"yscr","\u{1D56A}":"yopf","\u{1D4B4}":"Yscr","\u{1D51C}":"Yfr","\u{1D550}":"Yopf",\u00FD:"yacute",\u00DD:"Yacute",\u0177:"ycirc",\u0176:"Ycirc",\u00FF:"yuml",\u0178:"Yuml","\u{1D4CF}":"zscr","\u{1D537}":"zfr","\u{1D56B}":"zopf",\u2128:"Zfr",\u2124:"Zopf","\u{1D4B5}":"Zscr",\u017A:"zacute",\u0179:"Zacute",\u017E:"zcaron",\u017D:"Zcaron",\u017C:"zdot",\u017B:"Zdot",\u01B5:"imped",\u00FE:"thorn",\u00DE:"THORN",\u0149:"napos",\u03B1:"alpha",\u0391:"Alpha",\u03B2:"beta",\u0392:"Beta",\u03B3:"gamma",\u0393:"Gamma",\u03B4:"delta",\u0394:"Delta",\u03B5:"epsi","\u03F5":"epsiv",\u0395:"Epsilon",\u03DD:"gammad",\u03DC:"Gammad",\u03B6:"zeta",\u0396:"Zeta",\u03B7:"eta",\u0397:"Eta",\u03B8:"theta",\u03D1:"thetav",\u0398:"Theta",\u03B9:"iota",\u0399:"Iota",\u03BA:"kappa",\u03F0:"kappav",\u039A:"Kappa",\u03BB:"lambda",\u039B:"Lambda",\u03BC:"mu",\u00B5:"micro",\u039C:"Mu",\u03BD:"nu",\u039D:"Nu",\u03BE:"xi",\u039E:"Xi",\u03BF:"omicron",\u039F:"Omicron",\u03C0:"pi",\u03D6:"piv",\u03A0:"Pi",\u03C1:"rho",\u03F1:"rhov",\u03A1:"Rho",\u03C3:"sigma",\u03A3:"Sigma",\u03C2:"sigmaf",\u03C4:"tau",\u03A4:"Tau",\u03C5:"upsi",\u03A5:"Upsilon",\u03D2:"Upsi",\u03C6:"phi",\u03D5:"phiv",\u03A6:"Phi",\u03C7:"chi",\u03A7:"Chi",\u03C8:"psi",\u03A8:"Psi",\u03C9:"omega",\u03A9:"ohm",\u0430:"acy",\u0410:"Acy",\u0431:"bcy",\u0411:"Bcy",\u0432:"vcy",\u0412:"Vcy",\u0433:"gcy",\u0413:"Gcy",\u0453:"gjcy",\u0403:"GJcy",\u0434:"dcy",\u0414:"Dcy",\u0452:"djcy",\u0402:"DJcy",\u0435:"iecy",\u0415:"IEcy",\u0451:"iocy",\u0401:"IOcy",\u0454:"jukcy",\u0404:"Jukcy",\u0436:"zhcy",\u0416:"ZHcy",\u0437:"zcy",\u0417:"Zcy",\u0455:"dscy",\u0405:"DScy",\u0438:"icy",\u0418:"Icy",\u0456:"iukcy",\u0406:"Iukcy",\u0457:"yicy",\u0407:"YIcy",\u0439:"jcy",\u0419:"Jcy",\u0458:"jsercy",\u0408:"Jsercy",\u043A:"kcy",\u041A:"Kcy",\u045C:"kjcy",\u040C:"KJcy",\u043B:"lcy",\u041B:"Lcy",\u0459:"ljcy",\u0409:"LJcy",\u043C:"mcy",\u041C:"Mcy",\u043D:"ncy",\u041D:"Ncy",\u045A:"njcy",\u040A:"NJcy",\u043E:"ocy",\u041E:"Ocy",\u043F:"pcy",\u041F:"Pcy",\u0440:"rcy",\u0420:"Rcy",\u0441:"scy",\u0421:"Scy",\u0442:"tcy",\u0422:"Tcy",\u045B:"tshcy",\u040B:"TSHcy",\u0443:"ucy",\u0423:"Ucy",\u045E:"ubrcy",\u040E:"Ubrcy",\u0444:"fcy",\u0424:"Fcy",\u0445:"khcy",\u0425:"KHcy",\u0446:"tscy",\u0426:"TScy",\u0447:"chcy",\u0427:"CHcy",\u045F:"dzcy",\u040F:"DZcy",\u0448:"shcy",\u0428:"SHcy",\u0449:"shchcy",\u0429:"SHCHcy",\u044A:"hardcy",\u042A:"HARDcy",\u044B:"ycy",\u042B:"Ycy",\u044C:"softcy",\u042C:"SOFTcy",\u044D:"ecy",\u042D:"Ecy",\u044E:"yucy",\u042E:"YUcy",\u044F:"yacy",\u042F:"YAcy",\u2135:"aleph",\u2136:"beth",\u2137:"gimel",\u2138:"daleth"},l=/["&'<>`]/g,h={'"':"&quot;","&":"&amp;","'":"&#x27;","<":"&lt;",">":"&gt;","`":"&#x60;"},u=/&#(?:[xX][^a-fA-F0-9]|[^0-9xX])/,f=/[\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,M={},y=M.hasOwnProperty,b=function(N,I){return y.call(N,I)},C=function(N,I){for(var W=-1,O=N.length;++W<O;)if(N[W]==I)return!0;return!1},_=function(N,I){if(!N)return I;var W={},O;for(O in I)W[O]=b(N,O)?N[O]:I[O];return W},S=function(N,I){var W="";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&&C(g,N)&&w("disallowed character reference"),N>65535&&(N-=65536,W+=m(N>>>10&1023|55296),N=56320|N&1023),W+=m(N),W)},P=function(N){return"&#x"+N.toString(16).toUpperCase()+";"},H=function(N){return"&#"+N+";"},w=function(N){throw Error("Parse error: "+N)},T=function(N,I){I=_(I,T.options);var W=I.strict;W&&f.test(N)&&w("forbidden code point");var O=I.encodeEverything,q=I.useNamedReferences,j=I.allowUnsafeSymbols,ie=I.decimal?H:P,ae=function(U){return ie(U.charCodeAt(0))};return O?(N=N.replace(r,function(U){return q&&b(c,U)?"&"+c[U]+";":ae(U)}),q&&(N=N.replace(/&gt;\u20D2/g,"&nvgt;").replace(/&lt;\u20D2/g,"&nvlt;").replace(/&#x66;&#x6A;/g,"&fjlig;")),q&&(N=N.replace(o,function(U){return"&"+c[U]+";"}))):q?(j||(N=N.replace(l,function(U){return"&"+c[U]+";"})),N=N.replace(/&gt;\u20D2/g,"&nvgt;").replace(/&lt;\u20D2/g,"&nvlt;"),N=N.replace(o,function(U){return"&"+c[U]+";"})):j||(N=N.replace(l,ae)),N.replace(n,function(U){var Ce=U.charCodeAt(0),ce=U.charCodeAt(1),xe=(Ce-55296)*1024+ce-56320+65536;return ie(xe)}).replace(s,ae)};T.options={allowUnsafeSymbols:!1,encodeEverything:!1,strict:!1,useNamedReferences:!1,decimal:!1};var A=function(N,I){I=_(I,A.options);var W=I.strict;return W&&u.test(N)&&w("malformed character reference"),N.replace(d,function(O,q,j,ie,ae,U,Ce,ce,xe){var le,De,ze,Q,re,ne;return q?(re=q,p[re]):j?(re=j,ne=ie,ne&&I.isAttributeValue?(W&&ne=="="&&w("`&` did not start a character reference"),O):(W&&w("named character reference was not terminated by a semicolon"),v[re]+(ne||""))):ae?(ze=ae,De=U,W&&!De&&w("character reference was not terminated by a semicolon"),le=parseInt(ze,10),S(le,W)):Ce?(Q=Ce,De=ce,W&&!De&&w("character reference was not terminated by a semicolon"),le=parseInt(Q,16),S(le,W)):(W&&w("named character reference was not terminated by a semicolon"),O)})};A.options={isAttributeValue:!1,strict:!1};var R=function(N){return N.replace(l,function(I){return h[I]})},V={version:"1.2.0",encode:T,decode:A,escape:R,unescape:A};if(typeof define=="function"&&typeof define.amd=="object"&&define.amd)define(function(){return V});else if(e&&!e.nodeType)if(t)t.exports=V;else for(var L in V)b(V,L)&&(e[L]=V[L]);else a.he=V})(ga)});var P8=Ar(o2=>{"use strict";var f9=o2&&o2.__values||function(a){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&a[e],i=0;if(t)return t.call(a);if(a&&typeof a.length=="number")return{next:function(){return a&&i>=a.length&&(a=void 0),{value:a&&a[i++],done:!a}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(o2,"__esModule",{value:!0});o2.getWordsByCategory=o2.wordList=void 0;o2.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 d9(a,e){var t,i;e===void 0&&(e=[]);var n=new Set(e),r=[];try{for(var s=f9(o2.wordList[a]),o=s.next();!o.done;o=s.next()){var c=o.value;(e.length===0||c.categories.some(function(l){return n.has(l)}))&&r.push(c.word)}}catch(l){t={error:l}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(t)throw t.error}}return r}o2.getWordsByCategory=d9});var O8=Ar(k2=>{"use strict";var Sa=k2&&k2.__assign||function(){return Sa=Object.assign||function(a){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)&&(a[n]=e[n])}return a},Sa.apply(this,arguments)};Object.defineProperty(k2,"__esModule",{value:!0});k2.totalUniqueSlugs=k2.generateSlug=void 0;var M0=P8(),I8=3;function p9(a,e){for(var t=a||I8,i={partsOfSpeech:k8(t),categories:{},format:"kebab"},n=Sa(Sa({},i),e),r=[],s=0;s<t;s++){var o=n.partsOfSpeech[s],c=M0.getWordsByCategory(n.partsOfSpeech[s],n.categories[o]),l=c[Math.floor(Math.random()*c.length)];r.push(l)}return m9(r,n.format)}k2.generateSlug=p9;function k8(a){for(var e=[],t=0;t<a-1;t++)e.push("adjective");return e.push("noun"),e}function m9(a,e){return e==="kebab"?a.join("-").toLowerCase():e==="camel"?a.map(function(t,i){return i===0?t.toLowerCase():t[0].toUpperCase()+t.slice(1).toLowerCase()}).join(""):e==="lower"?a.join(" ").toLowerCase():e==="sentence"?a.map(function(t,i){return i===0?t[0].toUpperCase()+t.slice(1).toLowerCase():t}).join(" "):a.map(function(t){return t[0].toUpperCase()+t.slice(1).toLowerCase()}).join(" ")}function g9(a,e){for(var t,i,n=M0.getWordsByCategory("adjective",(t=e?.categories)===null||t===void 0?void 0:t.adjective).length,r=M0.getWordsByCategory("noun",(i=e?.categories)===null||i===void 0?void 0:i.noun).length,s={adjective:n,noun:r},o=a||I8,c=e?.partsOfSpeech||k8(o),l=1,h=0;h<o;h++)l*=s[c[h]];return l}k2.totalUniqueSlugs=g9});var ku=Ar((Iu,Ko)=>{(function(a,e){typeof define=="function"&&define.amd?define([],e):typeof Ko=="object"&&Ko.exports?Ko.exports=e():a.moo=e()})(Iu,function(){"use strict";var a=Object.prototype.hasOwnProperty,e=Object.prototype.toString,t=typeof new RegExp().sticky=="boolean";function i(S){return S&&e.call(S)==="[object RegExp]"}function n(S){return S&&typeof S=="object"&&!i(S)&&!Array.isArray(S)}function r(S){return S.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function s(S){var P=new RegExp("|"+S);return P.exec("").length-1}function o(S){return"("+S+")"}function c(S){if(!S.length)return"(?!)";var P=S.map(function(H){return"(?:"+H+")"}).join("|");return"(?:"+P+")"}function l(S){if(typeof S=="string")return"(?:"+r(S)+")";if(i(S)){if(S.ignoreCase)throw new Error("RegExp /i flag not allowed");if(S.global)throw new Error("RegExp /g flag is implied");if(S.sticky)throw new Error("RegExp /y flag is implied");if(S.multiline)throw new Error("RegExp /m flag is implied");return S.source}else throw new Error("Not a pattern: "+S)}function h(S){for(var P=Object.getOwnPropertyNames(S),H=[],w=0;w<P.length;w++){var T=P[w],A=S[T],R=[].concat(A);if(T==="include"){for(var V=0;V<R.length;V++)H.push({include:R[V]});continue}var L=[];R.forEach(function(N){n(N)?(L.length&&H.push(f(T,L)),H.push(f(T,N)),L=[]):L.push(N)}),L.length&&H.push(f(T,L))}return H}function u(S){for(var P=[],H=0;H<S.length;H++){var w=S[H];if(w.include){for(var T=[].concat(w.include),A=0;A<T.length;A++)P.push({include:T[A]});continue}if(!w.type)throw new Error("Rule has no type: "+JSON.stringify(w));P.push(f(w.type,w))}return P}function f(S,P){if(n(P)||(P={match:P}),P.include)throw new Error("Matching rules cannot also include states");var H={defaultType:S,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)a.call(P,w)&&(H[w]=P[w]);if(typeof H.type=="string"&&S!==H.type)throw new Error("Type transform cannot be a string (type '"+H.type+"' for token '"+S+"')");var T=H.match;return H.match=Array.isArray(T)?T:T?[T]:[],H.match.sort(function(A,R){return i(A)&&i(R)?0:i(R)?-1:i(A)?1:R.length-A.length}),H}function d(S){return Array.isArray(S)?u(S):h(S)}var p=f("error",{lineBreaks:!0,shouldThrow:!0});function v(S,P){for(var H=null,w=Object.create(null),T=!0,A=null,R=[],V=[],L=0;L<S.length;L++)S[L].fallback&&(T=!1);for(var L=0;L<S.length;L++){var N=S[L];if(N.include)throw new Error("Inheritance is not allowed in stateless lexers");if(N.error||N.fallback){if(H)throw!N.fallback==!H.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+"')");H=N}var I=N.match.slice();if(T)for(;I.length&&typeof I[0]=="string"&&I[0].length===1;){var W=I.shift();w[W.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){T=!1,R.push(N);for(var O=0;O<I.length;O++){var q=I[O];if(i(q)){if(A===null)A=q.unicode;else if(A!==q.unicode&&N.fallback===!1)throw new Error("If one rule is /u then all must be")}}var j=c(I.map(l)),ie=new RegExp(j);if(ie.test(""))throw new Error("RegExp matches empty string: "+ie);var ae=s(j);if(ae>0)throw new Error("RegExp has capture groups: "+ie+`
Use (?: \u2026 ) instead`);if(!N.lineBreaks&&ie.test(`
`))throw new Error("Rule should declare lineBreaks: "+ie);V.push(o(j))}}var U=H&&H.fallback,Ce=t&&!U?"ym":"gm",ce=t||U?"":"|";A===!0&&(Ce+="u");var xe=new RegExp(c(V)+ce,Ce);return{regexp:xe,groups:R,fast:w,error:H||p}}function x(S){var P=v(d(S));return new y({start:P},"start")}function g(S,P,H){var w=S&&(S.push||S.next);if(w&&!H[w])throw new Error("Missing state '"+w+"' (in token '"+S.defaultType+"' of state '"+P+"')");if(S&&S.pop&&+S.pop!=1)throw new Error("pop must be 1 (in token '"+S.defaultType+"' of state '"+P+"')")}function m(S,P){var H=S.$all?d(S.$all):[];delete S.$all;var w=Object.getOwnPropertyNames(S);P||(P=w[0]);for(var T=Object.create(null),A=0;A<w.length;A++){var R=w[A];T[R]=d(S[R]).concat(H)}for(var A=0;A<w.length;A++)for(var R=w[A],V=T[R],L=Object.create(null),N=0;N<V.length;N++){var I=V[N];if(I.include){var W=[N,1];if(I.include!==R&&!L[I.include]){L[I.include]=!0;var O=T[I.include];if(!O)throw new Error("Cannot include nonexistent state '"+I.include+"' (in state '"+R+"')");for(var q=0;q<O.length;q++){var j=O[q];V.indexOf(j)===-1&&W.push(j)}}V.splice.apply(V,W),N--}}for(var ie=Object.create(null),A=0;A<w.length;A++){var R=w[A];ie[R]=v(T[R],!0)}for(var A=0;A<w.length;A++){for(var ae=w[A],U=ie[ae],Ce=U.groups,N=0;N<Ce.length;N++)g(Ce[N],ae,ie);for(var ce=Object.getOwnPropertyNames(U.fast),N=0;N<ce.length;N++)g(U.fast[ce[N]],ae,ie)}return new y(ie,P)}function M(S){for(var P=Object.create(null),H=Object.create(null),w=Object.getOwnPropertyNames(S),T=0;T<w.length;T++){var A=w[T],R=S[A],V=Array.isArray(R)?R:[R];V.forEach(function(O){if((H[O.length]=H[O.length]||[]).push(O),typeof O!="string")throw new Error("keyword must be string (in keyword '"+A+"')");P[O]=A})}function L(O){return JSON.stringify(O)}var N="";N+=`switch (value.length) {
`;for(var I in H){var W=H[I];N+="case "+I+`:
`,N+=`switch (value) {
`,W.forEach(function(O){var q=P[O];N+="case "+L(O)+": return "+L(q)+`
`}),N+=`}
`}return N+=`}
`,Function("value",N)}var y=function(S,P){this.startState=P,this.states=S,this.buffer="",this.stack=[],this.reset()};y.prototype.reset=function(S,P){return this.buffer=S||"",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(S){if(!(!S||this.state===S)){this.state=S;var P=this.states[S];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(S){this.stack.push(this.state),this.setState(S)};var b=t?function(S,P){return S.exec(P)}:function(S,P){var H=S.exec(P);return H[0].length===0?null:H};y.prototype._getGroup=function(S){for(var P=this.groups.length,H=0;H<P;H++)if(S[H+1]!==void 0)return this.groups[H];throw new Error("Cannot find token type for matched text")};function C(){return this.value}if(y.prototype.next=function(){var S=this.index;if(this.queuedGroup){var P=this._token(this.queuedGroup,this.queuedText,S);return this.queuedGroup=null,this.queuedText="",P}var H=this.buffer;if(S!==H.length){var R=this.fast[H.charCodeAt(S)];if(R)return this._token(R,H.charAt(S),S);var w=this.re;w.lastIndex=S;var T=b(w,H),A=this.error;if(T==null)return this._token(A,H.slice(S,H.length),S);var R=this._getGroup(T),V=T[0];return A.fallback&&T.index!==S?(this.queuedGroup=R,this.queuedText=V,this._token(A,H.slice(S,T.index),S)):this._token(R,V,S)}},y.prototype._token=function(S,P,H){var w=0;if(S.lineBreaks){var T=/\n/g,A=1;if(P===`
`)w=1;else for(;T.exec(P);)w++,A=T.lastIndex}var R={type:typeof S.type=="function"&&S.type(P)||S.defaultType,value:typeof S.value=="function"?S.value(P):P,text:P,toString:C,offset:H,lineBreaks:w,line:this.line,col:this.col},V=P.length;if(this.index+=V,this.line+=w,w!==0?this.col=V-A+1:this.col+=V,S.shouldThrow)throw new Error(this.formatError(R,"invalid syntax"));return S.pop?this.popState():S.push?this.pushState(S.push):S.next&&this.setState(S.next),R},typeof Symbol<"u"&&Symbol.iterator){var _=function(S){this.lexer=S};_.prototype.next=function(){var S=this.lexer.next();return{value:S,done:!S}},_.prototype[Symbol.iterator]=function(){return this},y.prototype[Symbol.iterator]=function(){return new _(this)}}return y.prototype.formatError=function(S,P){if(S==null)var H=this.buffer.slice(this.index),S={text:H,offset:this.index,lineBreaks:H.indexOf(`
`)===-1?0:1,line:this.line,col:this.col};var w=Math.max(0,S.offset-S.col+1),T=S.lineBreaks?S.text.indexOf(`
`):S.text.length,A=this.buffer.substring(w,S.offset+T);return P+=" at line "+S.line+" col "+S.col+`:
`,P+=" "+A+`
`,P+=" "+Array(S.col).join(" ")+"^",P},y.prototype.clone=function(){return new y(this.states,this.state)},y.prototype.has=function(S){return!0},{compile:x,states:m,error:Object.freeze({error:!0}),fallback:Object.freeze({fallback:!0}),keywords:M}})});var Tb={};f7(Tb,{DEFAULT_SETTINGS:()=>Fa,default:()=>n0});module.exports=d7(Tb);var ft=require("obsidian"),t7=oa(Xc());var Yc={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 $c={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 _r(a){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_r=function(e){return typeof e}:_r=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_r(a)}function g7(a,e){if(!(a instanceof e))throw new TypeError("Cannot call a class as a function")}function Jc(a,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(a,i.key,i)}}function v7(a,e,t){return e&&Jc(a.prototype,e),t&&Jc(a,t),a}function x7(a,e,t){return e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function We(a){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){x7(a,n,t[n])})}return a}function l8(a,e){return y7(a)||w7(a,e)||b7()}function y7(a){if(Array.isArray(a))return a}function w7(a,e){var t=[],i=!0,n=!1,r=void 0;try{for(var s=a[Symbol.iterator](),o;!(i=(o=s.next()).done)&&(t.push(o.value),!(e&&t.length===e));i=!0);}catch(c){n=!0,r=c}finally{try{!i&&s.return!=null&&s.return()}finally{if(n)throw r}}return t}function b7(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}var Qc=function(){},u0={},h8={},M7=null,u8={mark:Qc,measure:Qc};try{typeof window<"u"&&(u0=window),typeof document<"u"&&(h8=document),typeof MutationObserver<"u"&&(M7=MutationObserver),typeof performance<"u"&&(u8=performance)}catch{}var z7=u0.navigator||{},Kc=z7.userAgent,e8=Kc===void 0?"":Kc,pa=u0,qt=h8;var la=u8,Nb=!!pa.document,f0=!!qt.documentElement&&!!qt.head&&typeof qt.addEventListener=="function"&&typeof qt.createElement=="function",Fb=~e8.indexOf("MSIE")||~e8.indexOf("Trident/"),n2="___FONT_AWESOME___";var f8="fa",d8="svg-inline--fa",C7="data-fa-i2svg";var Bb=function(){try{return!0}catch{return!1}}();var p8=[1,2,3,4,5,6,7,8,9,10],A7=p8.concat([11,12,13,14,15,16,17,18,19,20]);var Ai={GROUP:"group",SWAP_OPACITY:"swap-opacity",PRIMARY:"primary",SECONDARY:"secondary"},Pb=["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",Ai.GROUP,Ai.SWAP_OPACITY,Ai.PRIMARY,Ai.SECONDARY].concat(p8.map(function(a){return"".concat(a,"x")})).concat(A7.map(function(a){return"w-".concat(a)})),m8=pa.FontAwesomeConfig||{};function S7(a){var e=qt.querySelector("script["+a+"]");if(e)return e.getAttribute(a)}function _7(a){return a===""?!0:a==="false"?!1:a==="true"?!0:a}qt&&typeof qt.querySelector=="function"&&(t8=[["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"]],t8.forEach(function(a){var e=l8(a,2),t=e[0],i=e[1],n=_7(S7(t));n!=null&&(m8[i]=n)}));var t8,E7={familyPrefix:f8,replacementClass:d8,autoReplaceSvg:!0,autoAddCss:!0,autoA11y:!0,searchPseudoElements:!1,observeMutations:!0,mutateApproach:"async",keepOriginalSource:!0,measurePerformance:!1,showMissingIcons:!0},o0=We({},E7,m8);o0.autoReplaceSvg||(o0.observeMutations=!1);var n1=We({},o0);pa.FontAwesomeConfig=n1;var r2=pa||{};r2[n2]||(r2[n2]={});r2[n2].styles||(r2[n2].styles={});r2[n2].hooks||(r2[n2].hooks={});r2[n2].shims||(r2[n2].shims=[]);var O1=r2[n2],L7=[],T7=function a(){qt.removeEventListener("DOMContentLoaded",a),c0=1,L7.map(function(e){return e()})},c0=!1;f0&&(c0=(qt.documentElement.doScroll?/^loaded|^c/:/^loaded|^i|^c/).test(qt.readyState),c0||qt.addEventListener("DOMContentLoaded",T7));var d0="pending",g8="settled",ha="fulfilled",ua="rejected",D7=function(){},v8=typeof global<"u"&&typeof global.process<"u"&&typeof global.process.emit=="function",H7=typeof setImmediate>"u"?setTimeout:setImmediate,Sr=[],l0;function V7(){for(var a=0;a<Sr.length;a++)Sr[a][0](Sr[a][1]);Sr=[],l0=!1}function fa(a,e){Sr.push([a,e]),l0||(l0=!0,H7(V7,0))}function R7(a,e){function t(n){p0(e,n)}function i(n){Er(e,n)}try{a(t,i)}catch(n){i(n)}}function x8(a){var e=a.owner,t=e._state,i=e._data,n=a[t],r=a.then;if(typeof n=="function"){t=ha;try{i=n(i)}catch(s){Er(r,s)}}y8(r,i)||(t===ha&&p0(r,i),t===ua&&Er(r,i))}function y8(a,e){var t;try{if(a===e)throw new TypeError("A promises callback cannot return that same promise.");if(e&&(typeof e=="function"||_r(e)==="object")){var i=e.then;if(typeof i=="function")return i.call(e,function(n){t||(t=!0,e===n?w8(a,n):p0(a,n))},function(n){t||(t=!0,Er(a,n))}),!0}}catch(n){return t||Er(a,n),!0}return!1}function p0(a,e){(a===e||!y8(a,e))&&w8(a,e)}function w8(a,e){a._state===d0&&(a._state=g8,a._data=e,fa(N7,a))}function Er(a,e){a._state===d0&&(a._state=g8,a._data=e,fa(F7,a))}function b8(a){a._then=a._then.forEach(x8)}function N7(a){a._state=ha,b8(a)}function F7(a){a._state=ua,b8(a),!a._handled&&v8&&global.process.emit("unhandledRejection",a._data,a)}function B7(a){global.process.emit("rejectionHandled",a)}function u1(a){if(typeof a!="function")throw new TypeError("Promise resolver "+a+" is not a function");if(!(this instanceof u1))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this._then=[],R7(a,this)}u1.prototype={constructor:u1,_state:d0,_then:null,_data:void 0,_handled:!1,then:function(e,t){var i={owner:this,then:new this.constructor(D7),fulfilled:e,rejected:t};return(t||e)&&!this._handled&&(this._handled=!0,this._state===ua&&v8&&fa(B7,this)),this._state===ha||this._state===ua?fa(x8,i):this._then.push(i),i.then},catch:function(e){return this.then(null,e)}};u1.all=function(a){if(!Array.isArray(a))throw new TypeError("You must pass an array to Promise.all().");return new u1(function(e,t){var i=[],n=0;function r(c){return n++,function(l){i[c]=l,--n||e(i)}}for(var s=0,o;s<a.length;s++)o=a[s],o&&typeof o.then=="function"?o.then(r(s),t):i[s]=o;n||e(i)})};u1.race=function(a){if(!Array.isArray(a))throw new TypeError("You must pass an array to Promise.race().");return new u1(function(e,t){for(var i=0,n;i<a.length;i++)n=a[i],n&&typeof n.then=="function"?n.then(e,t):e(n)})};u1.resolve=function(a){return a&&_r(a)==="object"&&a.constructor===u1?a:new u1(function(e){e(a)})};u1.reject=function(a){return new u1(function(e,t){t(a)})};var cn={size:16,x:0,y:0,rotate:0,flipX:!1,flipY:!1};function P7(a){if(!(!a||!f0)){var e=qt.createElement("style");e.setAttribute("type","text/css"),e.innerHTML=a;for(var t=qt.head.childNodes,i=null,n=t.length-1;n>-1;n--){var r=t[n],s=(r.tagName||"").toUpperCase();["STYLE","LINK"].indexOf(s)>-1&&(i=r)}return qt.head.insertBefore(e,i),a}}var I7="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";function da(){for(var a=12,e="";a-- >0;)e+=I7[Math.random()*62|0];return e}function M8(a){return"".concat(a).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function k7(a){return Object.keys(a||{}).reduce(function(e,t){return e+"".concat(t,'="').concat(M8(a[t]),'" ')},"").trim()}function z8(a){return Object.keys(a||{}).reduce(function(e,t){return e+"".concat(t,": ").concat(a[t],";")},"")}function C8(a){return a.size!==cn.size||a.x!==cn.x||a.y!==cn.y||a.rotate!==cn.rotate||a.flipX||a.flipY}function A8(a){var e=a.transform,t=a.containerWidth,i=a.iconWidth,n={transform:"translate(".concat(t/2," 256)")},r="translate(".concat(e.x*32,", ").concat(e.y*32,") "),s="scale(".concat(e.size/16*(e.flipX?-1:1),", ").concat(e.size/16*(e.flipY?-1:1),") "),o="rotate(".concat(e.rotate," 0 0)"),c={transform:"".concat(r," ").concat(s," ").concat(o)},l={transform:"translate(".concat(i/2*-1," -256)")};return{outer:n,inner:c,path:l}}var s0={x:0,y:0,width:"100%",height:"100%"};function i8(a){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return a.attributes&&(a.attributes.fill||e)&&(a.attributes.fill="black"),a}function O7(a){return a.tag==="g"?a.children:[a]}function U7(a){var e=a.children,t=a.attributes,i=a.main,n=a.mask,r=a.maskId,s=a.transform,o=i.width,c=i.icon,l=n.width,h=n.icon,u=A8({transform:s,containerWidth:l,iconWidth:o}),f={tag:"rect",attributes:We({},s0,{fill:"white"})},d=c.children?{children:c.children.map(i8)}:{},p={tag:"g",attributes:We({},u.inner),children:[i8(We({tag:c.tag,attributes:We({},c.attributes,u.path)},d))]},v={tag:"g",attributes:We({},u.outer),children:[p]},x="mask-".concat(r||da()),g="clip-".concat(r||da()),m={tag:"mask",attributes:We({},s0,{id:x,maskUnits:"userSpaceOnUse",maskContentUnits:"userSpaceOnUse"}),children:[f,v]},M={tag:"defs",children:[{tag:"clipPath",attributes:{id:g},children:O7(h)},m]};return e.push(M,{tag:"rect",attributes:We({fill:"currentColor","clip-path":"url(#".concat(g,")"),mask:"url(#".concat(x,")")},s0)}),{children:e,attributes:t}}function q7(a){var e=a.children,t=a.attributes,i=a.main,n=a.transform,r=a.styles,s=z8(r);if(s.length>0&&(t.style=s),C8(n)){var o=A8({transform:n,containerWidth:i.width,iconWidth:i.width});e.push({tag:"g",attributes:We({},o.outer),children:[{tag:"g",attributes:We({},o.inner),children:[{tag:i.icon.tag,children:i.icon.children,attributes:We({},i.icon.attributes,o.path)}]}]})}else e.push(i.icon);return{children:e,attributes:t}}function G7(a){var e=a.children,t=a.main,i=a.mask,n=a.attributes,r=a.styles,s=a.transform;if(C8(s)&&t.found&&!i.found){var o=t.width,c=t.height,l={x:o/c/2,y:.5};n.style=z8(We({},r,{"transform-origin":"".concat(l.x+s.x/16,"em ").concat(l.y+s.y/16,"em")}))}return[{tag:"svg",attributes:n,children:e}]}function W7(a){var e=a.prefix,t=a.iconName,i=a.children,n=a.attributes,r=a.symbol,s=r===!0?"".concat(e,"-").concat(n1.familyPrefix,"-").concat(t):r;return[{tag:"svg",attributes:{style:"display: none;"},children:[{tag:"symbol",attributes:We({},n,{id:s}),children:i}]}]}function j7(a){var e=a.icons,t=e.main,i=e.mask,n=a.prefix,r=a.iconName,s=a.transform,o=a.symbol,c=a.title,l=a.maskId,h=a.titleId,u=a.extra,f=a.watchable,d=f===void 0?!1:f,p=i.found?i:t,v=p.width,x=p.height,g=n==="fak",m=g?"":"fa-w-".concat(Math.ceil(v/x*16)),M=[n1.replacementClass,r?"".concat(n1.familyPrefix,"-").concat(r):"",m].filter(function(H){return u.classes.indexOf(H)===-1}).filter(function(H){return H!==""||!!H}).concat(u.classes).join(" "),y={children:[],attributes:We({},u.attributes,{"data-prefix":n,"data-icon":r,class:M,role:u.attributes.role||"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 ".concat(v," ").concat(x)})},b=g&&!~u.classes.indexOf("fa-fw")?{width:"".concat(v/x*16*.0625,"em")}:{};d&&(y.attributes[C7]=""),c&&y.children.push({tag:"title",attributes:{id:y.attributes["aria-labelledby"]||"title-".concat(h||da())},children:[c]});var C=We({},y,{prefix:n,iconName:r,main:t,mask:i,maskId:l,transform:s,symbol:o,styles:We({},b,u.styles)}),_=i.found&&t.found?U7(C):q7(C),S=_.children,P=_.attributes;return C.children=S,C.attributes=P,o?W7(C):G7(C)}var n8=function(){},Ib=n1.measurePerformance&&la&&la.mark&&la.measure?la:{mark:n8,measure:n8};var Z7=function(e,t){return function(i,n,r,s){return e.call(t,i,n,r,s)}},a0=function(e,t,i,n){var r=Object.keys(e),s=r.length,o=n!==void 0?Z7(t,n):t,c,l,h;for(i===void 0?(c=1,h=e[r[0]]):(c=0,h=i);c<s;c++)l=r[c],h=o(h,e[l],l,e);return h};function S8(a,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=t.skipHooks,n=i===void 0?!1:i,r=Object.keys(e).reduce(function(s,o){var c=e[o],l=!!c.icon;return l?s[c.iconName]=c.icon:s[o]=c,s},{});typeof O1.hooks.addPack=="function"&&!n?O1.hooks.addPack(a,r):O1.styles[a]=We({},O1.styles[a]||{},r),a==="fas"&&S8("fa",e)}var r8=O1.styles,X7=O1.shims,Y7={},$7={},J7={},_8=function(){var e=function(n){return a0(r8,function(r,s,o){return r[o]=a0(s,n,{}),r},{})};Y7=e(function(i,n,r){return n[3]&&(i[n[3]]=r),i}),$7=e(function(i,n,r){var s=n[2];return i[r]=r,s.forEach(function(o){i[o]=r}),i});var t="far"in r8;J7=a0(X7,function(i,n){var r=n[0],s=n[1],o=n[2];return s==="far"&&!t&&(s="fas"),i[r]={prefix:s,iconName:o},i},{})};_8();var kb=O1.styles;function s8(a,e,t){if(a&&a[e]&&a[e][t])return{prefix:e,iconName:t,icon:a[e][t]}}function E8(a){var e=a.tag,t=a.attributes,i=t===void 0?{}:t,n=a.children,r=n===void 0?[]:n;return typeof a=="string"?M8(a):"<".concat(e," ").concat(k7(i),">").concat(r.map(E8).join(""),"</").concat(e,">")}function h0(a){this.name="MissingIcon",this.message=a||"Icon unavailable",this.stack=new Error().stack}h0.prototype=Object.create(Error.prototype);h0.prototype.constructor=h0;var ma={fill:"currentColor"},L8={attributeType:"XML",repeatCount:"indefinite",dur:"2s"},Ob={tag:"path",attributes:We({},ma,{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"})},m0=We({},L8,{attributeName:"opacity"}),Ub={tag:"circle",attributes:We({},ma,{cx:"256",cy:"364",r:"28"}),children:[{tag:"animate",attributes:We({},L8,{attributeName:"r",values:"28;14;28;28;14;28;"})},{tag:"animate",attributes:We({},m0,{values:"1;0;1;1;0;1;"})}]},qb={tag:"path",attributes:We({},ma,{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:We({},m0,{values:"1;0;0;0;0;1;"})}]},Gb={tag:"path",attributes:We({},ma,{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:We({},m0,{values:"0;0;1;1;0;0;"})}]};var Wb=O1.styles;function a8(a){var e=a[0],t=a[1],i=a.slice(4),n=l8(i,1),r=n[0],s=null;return Array.isArray(r)?s={tag:"g",attributes:{class:"".concat(n1.familyPrefix,"-").concat(Ai.GROUP)},children:[{tag:"path",attributes:{class:"".concat(n1.familyPrefix,"-").concat(Ai.SECONDARY),fill:"currentColor",d:r[0]}},{tag:"path",attributes:{class:"".concat(n1.familyPrefix,"-").concat(Ai.PRIMARY),fill:"currentColor",d:r[1]}}]}:s={tag:"path",attributes:{fill:"currentColor",d:r}},{found:!0,width:e,height:t,icon:s}}var jb=O1.styles;var Q7=`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 K7(){var a=f8,e=d8,t=n1.familyPrefix,i=n1.replacementClass,n=Q7;if(t!==a||i!==e){var r=new RegExp("\\.".concat(a,"\\-"),"g"),s=new RegExp("\\--".concat(a,"\\-"),"g"),o=new RegExp("\\.".concat(e),"g");n=n.replace(r,".".concat(t,"-")).replace(s,"--".concat(t,"-")).replace(o,".".concat(i))}return n}var e9=function(){function a(){g7(this,a),this.definitions={}}return v7(a,[{key:"add",value:function(){for(var t=this,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];var s=n.reduce(this._pullDefinitions,{});Object.keys(s).forEach(function(o){t.definitions[o]=We({},t.definitions[o]||{},s[o]),S8(o,s[o]),_8()})}},{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(r){var s=n[r],o=s.prefix,c=s.iconName,l=s.icon;t[o]||(t[o]={}),t[o][c]=l}),t}}]),a}();function t9(){n1.autoAddCss&&!c8&&(P7(K7()),c8=!0)}function i9(a,e){return Object.defineProperty(a,"abstract",{get:e}),Object.defineProperty(a,"html",{get:function(){return a.abstract.map(function(i){return E8(i)})}}),Object.defineProperty(a,"node",{get:function(){if(f0){var i=qt.createElement("div");return i.innerHTML=a.html,i.children}}}),a}function o8(a){var e=a.prefix,t=e===void 0?"fa":e,i=a.iconName;if(i)return s8(r9.definitions,t,i)||s8(O1.styles,t,i)}function n9(a){return function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=(e||{}).icon?e:o8(e||{}),n=t.mask;return n&&(n=(n||{}).icon?n:o8(n||{})),a(i,We({},t,{mask:n}))}}var r9=new e9;var c8=!1;var g0=n9(function(a){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.transform,i=t===void 0?cn:t,n=e.symbol,r=n===void 0?!1:n,s=e.mask,o=s===void 0?null:s,c=e.maskId,l=c===void 0?null:c,h=e.title,u=h===void 0?null:h,f=e.titleId,d=f===void 0?null:f,p=e.classes,v=p===void 0?[]:p,x=e.attributes,g=x===void 0?{}:x,m=e.styles,M=m===void 0?{}:m;if(a){var y=a.prefix,b=a.iconName,C=a.icon;return i9(We({type:"icon"},a),function(){return t9(),n1.autoA11y&&(u?g["aria-labelledby"]="".concat(n1.replacementClass,"-title-").concat(d||da()):(g["aria-hidden"]="true",g.focusable="false")),j7({icons:{main:a8(C),mask:o?a8(o.icon):{found:!1,width:null,height:null,icon:{}}},prefix:y,iconName:b,transform:We({},cn,i),symbol:r,title:u,maskId:l,titleId:d,extra:{attributes:g,styles:M,classes:v}})})}});function v0(a,e){let t=Object.keys(e).map(i=>s9(a,i,e[i]));return t.length===1?t[0]:function(){t.forEach(i=>i())}}function s9(a,e,t){let i=a[e],n=a.hasOwnProperty(e),r=t(i);return i&&Object.setPrototypeOf(r,i),Object.setPrototypeOf(s,r),a[e]=s,o;function s(...c){return r===i&&a[e]===s&&o(),r.apply(this,c)}function o(){a[e]===s&&(n?a[e]=i:delete a[e]),r!==i&&(r=i,Object.setPrototypeOf(s,i||Function))}}var i7=oa(T8());var x0=/(?:(?<roll>\d+)[Dd])?#(?<query>[\p{Letter}\p{Emoji_Presentation}\w/-]+)(?:\|(?<collapse>[\+-]))?(?:\|(?<types>[^\+-]+))?/u,D8=/(?:(?<roll>\d+)[Dd]?)?dv\((?<query>.+)\)(?:\|(?<collapse>[\+-]))?(?:\|(?<types>[^\+-]+))?/u,H8=/(?<diceRoll>.*)?(?:\[.*\]\(|\[\[)(?<link>.+?)#?\^(?<block>.+?)(?:\]\]|\))(?:\|(?<header>.+))?/,va=/(?:(?<roll>\d+)[Dd])?(?:\[.*\]\(|\[\[)(?<link>.+)(?:\]\]|\))\|?(?<types>.+)?/;var M1="dice-roller-icon",U1="dice-roller-copy";var B2=require("obsidian");var ln=(n=>(n.None="None",n.Normal="Normal",n.Up="Up",n.Down="Down",n))(ln||{});function V8(a,e,t){[...a].slice(e).reverse().forEach(([n,r])=>{a.set(n+1,r)}),a.set(e,t)}function xa(a,e){return Object.entries(a).reduce((t,i)=>{let n=i[0],s=i[1]?e.parent.path.startsWith(n):e.parent.path==n;return t||s},!1)}var s2=require("obsidian");var Tr=class extends s2.Events{getRandomBetween(e,t){let i=new Uint32Array(1);crypto.getRandomValues(i);let n=i[0]/4294967296;return Math.floor(n*(t-e+1))+e}},ya=class extends Tr{constructor(t,i="",n=t.data.showDice){super();this.plugin=t;this.original=i;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");n?(this.iconEl=this.containerEl.createSpan({cls:"dice-roller-button"}),(0,s2.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(t,i){let n=new Uint32Array(1);crypto.getRandomValues(n);let r=n[0]/4294967296;return Math.floor(r*(i-t+1))+t}async render(){this.setTooltip(),await this.build()}async onClick(t){t.stopPropagation(),t.stopImmediatePropagation(),window.getSelection()?.isCollapsed&&await this.roll()}},Dr=class extends ya{constructor(t,i,n,r=t.data.showDice){super(t,i,r);this.plugin=t;this.original=i;this.lexemes=n;this.showDice=r;this.save=!1}get inlineText(){return`${this.tooltip.split(`
`).join(" -> ")} -> `}},F2=class extends Dr{},Hr=class extends F2{constructor(t,i,n,r,s=t.data.showDice){super(t,i,[n],s);this.plugin=t;this.original=i;this.lexeme=n;this.source=r;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 s2.TFile))throw new Error("Could not load file.");await this.load()}},hn=class extends Hr{constructor(t,i,n,r,s=!0,o=t.data.showDice){super(t,i,n,r,o);this.plugin=t;this.original=i;this.lexeme=n;this.inline=s;this.plugin.data.displayAsEmbed&&(this.containerEl.addClasses(["has-embed","markdown-embed"]),this.resultEl.addClass("internal-embed")),this.resultEl.setAttrs({src:r}),this.copy=this.containerEl.createDiv({cls:"dice-content-copy dice-roller-button no-show",attr:{"aria-label":"Copy Contents"}}),this.copy.addEventListener("click",c=>{c.stopPropagation(),navigator.clipboard.writeText(this.transformResultsToString()).then(async()=>{new s2.Notice("Result copied to clipboard.")})}),(0,s2.setIcon)(this.copy,U1)}getEmbedClass(){return this.plugin.data.displayAsEmbed?"markdown-embed":""}},wa=class extends ya{constructor(t,i,n){super(t,"");this.options=i;this.rolls=n}get tooltip(){return`${this.options.toString()}
${this.results.toString()}`}async roll(){let t=[...this.options];return this.results=[...Array(this.rolls)].map(()=>{let i=t[this.getRandomBetween(0,t.length-1)];return t.splice(t.indexOf(i),1),i}).filter(i=>i),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 $t=class{constructor(e,t,i={value:`${e}`,conditions:[],type:"dice"}){this.renderer=t;this.lexeme=i;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,r="1"]=this.dice.match(/(\-?\d+)[dD](%|F|-?\d+|\[\d+(?:[ \t]*,[ \t]*\d+)+\])/)||[,1,"1"];n=Number(n),this.multiplier=n<0?-1:1;let s=1,o=isNaN(Number(r))?1:Number(r);this.rolls=Math.abs(Number(n))||1,/\[\d+(?:[ \t]*,[ \t]*\d+)+\]/.test(r)?this.possibilities=r.replace(/[\[\]\s]/g,"").split(",").map(c=>Number(c)):r==="F"?(this.possibilities=[-1,0,1],this.fudge=!0):(r==="%"?o=100:o=Number(r),Number(o)<0&&!s&&(s=-1),Number(o)<Number(s)&&([o,s]=[s,o]),this.possibilities=[...Array(Number(o)).keys()].map(c=>c+s)),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:r}])=>{let s=n.map(o=>o.value);return`${r}${s.join("")}`}).join("");return`${e}${t}`}keepLow(e=1){if(!this.modifiersAllowed){new B2.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 B2.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 B2.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:r}])=>this.checkCondition(r,t));for(;i<e&&n.length>0;){let r=[];for(let[s,o]of n)r.push(new Promise(async c=>{o.modifiers.add("r");let l=this.getShapes(s),h=await this.getValue(l);o.value=h,o.display=`${h}`,c()}));await Promise.all(r),n=n.filter(([,{value:s}])=>this.checkCondition(s,t)),i++}n.forEach(([r,s])=>{this.results.set(r,s)})}async explode(e,t,i=!1){if(!this.modifiersAllowed){new B2.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:s}])=>this.checkCondition(s,t)),r=0;await Promise.all(n.map(async([s,o])=>{if(i){let c=await this.getValue(),l=0;for(o.modifiers.add("!"),o.value+=c,o.display=`${o.value}`,this.results.set(s,o);l<e&&this.checkCondition(c,t);)l++,c=await this.getValue(),o.value+=c,o.display=`${o.value}`,this.results.set(s,o)}else{let c=o.value,l=0;for(;l<e&&this.checkCondition(c,t);)this.results.get(s+r+l).modifiers.add("!"),c=await this.getValue(),V8(this.results,s+r+l+1,this.#t(c)),l++;r+=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=this.#e(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}#e(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)}#t(e=0){return{usable:!0,value:e,display:`${e}`,modifiers:new Set}}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,this.#t(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 this.#i();return this.setResults(e),await this.applyModifiers(),this.conditions?.length&&this.applyConditions(),[...e.values()]}async#i(){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 r=await this.getValue(this.getShapes(i));e.set(i,r),n()}));await Promise.all(t)}return e}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,r)=>n.value-r.value):i=[...this.results.values()].sort((n,r)=>r.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,r]of this.results)i.push(new Promise(async s=>{let o=e.find(c=>c.value==r.value&&c!=r);o&&(o.value=await this.getValue(this.getShapes(n)),o.display=`${o.value}`,o.modifiers.add("u")),s()}));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:r,comparer:s,lexemes:o}=n;if(Number.isNaN(e)||!r?.length||!s)continue;let c=new y0(s,o);if(c.rollSync(),n.result=c.result,!Number.isNaN(n.result)){switch(r){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}},q1=class extends $t{constructor(t,i,n){super("3d6",i,n);this.dice=t}get doubles(){return new Set([...this.results].map(([,{usable:t,value:i}])=>t?i:0)).size<3}get result(){return this.static?Number(this.dice):[...this.results].map(([,{usable:i,value:n}])=>i?n:0).reduce((i,n)=>i+n,0)}get display(){let t=[];for(let i of this.results){if(i[0]==0&&this.doubles){t.push(`${i[1].value}S`);continue}t.push(`${i[1].value}`)}return`[${t.join(", ")}]`}allowAverage(){return!1}},ba=class extends $t{constructor(t,i,n){super(t,i,n);this.dice=t;this.stack=[];let r=`${this.faces.max}`.split("");for(let s=0;s<this.rolls;s++){let o=[];for(let c of r){let l=new $t(`1d${c}`,i);o.push(l),l.roll()}this.stack.push(o)}}get result(){let t=0;for(let i of this.stack){let n=[];for(let r of i)r.rollSync(),n.push(r.result);t+=Number(n.join(""))}return t}get display(){return this.stack.map(t=>t.map(i=>i.result).join(",")).join("|")}async roll(){return!this.stack||!this.stack.length?super.roll():(this.stack.forEach(t=>t.map(i=>i.roll())),[...this.stack.map(t=>t.map(i=>i.result)).flat()])}allowAverage(){return!1}},y0=class extends Tr{constructor(t,i){super();this.original=t;this.lexemes=i;this.operators={"+":(t,i)=>t+i,"-":(t,i)=>t-i,"*":(t,i)=>t*i,"/":(t,i)=>t/i,"^":(t,i)=>Math.pow(t,i)};this.stack=[];this.stackCopy=[];this.stunted="";this.dice=[]}async roll(){return this.rollSync()}rollSync(){this.stunted="",this.parseLexemes();let t=this.stack.pop();return t.rollSync(),t instanceof q1&&t.doubles&&(this.stunted=` - ${t.results.get(0).value} Stunt Points`),this.result=t.result,this.result}parseLexemes(){let t=0;for(let i of this.lexemes)switch(i.type){case"+":case"-":case"*":case"/":case"^":case"math":let n=this.stack.pop(),r=this.stack.pop();n.rollSync(),n instanceof q1&&n.doubles&&(this.stunted=` - ${n.results.get(0).value} Stunt Points`),r.rollSync(),r instanceof q1&&r.doubles&&(this.stunted=` - ${r.results.get(0).value} Stunt Points`);let s=this.operators[i.value](r.result,n.result);this.stackCopy.push(i.value),this.stack.push(new $t(`${s}`,null,i));break;case"u":{let o=this.dice[t-1],c=i.value?Number(i.value):1;o.modifiers.set("u",{data:c,conditionals:[],value:i.text});break}case"kh":{let o=this.dice[t-1],c=i.value?Number(i.value):1;o.modifiers.set("kh",{data:c,conditionals:[],value:i.text});break}case"dl":{let o=this.dice[t-1],c=i.value?Number(i.value):1;c=o.rolls-c,o.modifiers.set("kh",{data:c,conditionals:[],value:i.text});break}case"kl":{let o=this.dice[t-1],c=i.value?Number(i.value):1;o.modifiers.set("kl",{data:c,conditionals:[],value:i.text});break}case"dh":{let o=this.dice[t-1],c=i.value?Number(i.value):1;c=o.rolls-c,o.modifiers.set("kl",{data:c,conditionals:[],value:i.text});break}case"!":{let o=this.dice[t-1],c=Number(i.value)||1;o.modifiers.set("!",{data:c,conditionals:i.conditions??[],value:i.text});break}case"!!":{let o=this.dice[t-1],c=Number(i.value)||1;o.modifiers.set("!!",{data:c,conditionals:i.conditions??[],value:i.text});break}case"r":{let o=this.dice[t-1],c=Number(i.value)||1;o.modifiers.set("r",{data:c,conditionals:i.conditions??[],value:i.text});break}case"sort":{let o=this.dice[t-1],c=Number(i.value);o.modifiers.set("sort",{data:c,conditionals:i.conditions??[],value:i.value});break}case"dice":{if(i.parenedDice&&/^d/.test(i.value)&&this.stack.length){let o=this.stack.pop();i.value=`${o.result}${i.value}`,this.dice[t]=new $t(i.value,null,i)}this.dice[t]||(this.dice[t]=new $t(i.value,null,i)),this.stack.push(this.dice[t]),this.stackCopy.push(this.dice[t]),t++;break}case"stunt":{this.dice[t]||(this.dice[t]=new q1(i.value,null,i)),this.stack.push(this.dice[t]),this.stackCopy.push(this.dice[t]),t++;break}case"%":{this.dice[t]||(this.dice[t]=new ba(i.value,null,i)),this.stack.push(this.dice[t]),this.stackCopy.push(this.dice[t]),t++;break}}}},Gt=class extends F2{constructor(t,i,n,r,s=t.data.showDice,o,c=t.data.initialDisplay,l=t.data.displayFormulaAfter,h=t.data.round,u=t.data.signed){super(t,i,n,s);this.plugin=t;this.original=i;this.lexemes=n;this.renderer=r;this.displayFixedText=!1;this.stunted="";this.shouldRender=!1;this.isRendering=!1;this.showFormula=!1;this.operators={"+":(t,i)=>t+i,"-":(t,i)=>t-i,"*":(t,i)=>t*i,"/":(t,i)=>t/i,"^":(t,i)=>Math.pow(t,i)};this.stack=[];this.maxStack=[];this.minStack=[];this.stackCopy=[];this.dice=[];this.hasRunOnce=!1;this.max=Number.MIN_VALUE;this.min=Number.MAX_VALUE;l&&this.containerEl.createSpan({cls:"dice-roller-formula",text:`(${i})`}),this.fixedText=o,this.expectedValue=c,this.displayFixedText=this.fixedText!=="",this.round=h,this.signed=u,this.loaded=!0,this.trigger("loaded")}async getReplacer(){return`${this.result}`}get resultText(){let t=[],i=0;return this.dice.forEach(n=>{let r=this.original.slice(i);t.push(r.slice(0,r.indexOf(n.lexeme.text)),n.display),i+=r.indexOf(n.lexeme.text)+n.lexeme.text.length+n.modifierText.length}),t.push(this.original.slice(i)),t.join("")}get tooltip(){return this.isRendering?this.original:this._tooltip?this._tooltip:this.expectedValue==="Roll"||this.shouldRender?this.displayFixedText?`${this.original}
${this.result} = ${this.resultText}`:`${this.original}
${this.resultText}`:this.expectedValue==="Average"?this.displayFixedText?`${this.original}
${this.result} = average: ${this.resultText}`:`${this.original}
average: ${this.resultText}`:`${this.original}
empty`}allowAverage(){let t=i=>i.allowAverage();return this.dynamic.every(t)}async build(){if(this.resultEl.empty(),this.expectedValue==="Average"&&!this.shouldRender){if(this.allowAverage()){for(let r of this.dynamic){let s=r.average(),o=new Map;for(let c=0;c<r.rolls;c++)o.set(c,s);r.setResults(o)}this.calculate()}else this.expectedValue="Roll";this.result=Math.floor(this.result),this.setTooltip()}let t=this.result;switch(this.round){case"None":{t=Math.trunc(t*100)/100;break}case"Normal":{t=Math.round(t);break}case"Up":{t=Math.ceil(t);break}case"Down":{t=Math.floor(t);break}}let i=this.signed&&t>0?"+":"",n;this.expectedValue==="None"&&!this.shouldRender?(this.showDice?n=[""]:n=["\xA0"],this.showFormula&&n.unshift(this.original+" -> ")):(n=[`${i}${t}`],this.showFormula&&n.unshift(this.inlineText)),this.expectedValue="Roll",this.displayFixedText?this.resultEl.setText(this.fixedText):this.resultEl.setText(n.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(t){t.stopPropagation(),t.stopImmediatePropagation(),t.getModifierState("Alt")?this.expectedValue="Average":t.getModifierState("Control")&&(this.expectedValue="None"),t.getModifierState("Shift")?(await this.roll(!0),this.hasRunOnce=!0):window.getSelection()?.isCollapsed&&await this.roll()}get dynamic(){return this.dice.filter(t=>!t.static)}get static(){return this.dice.filter(t=>t.static)}get isStatic(){return this.dice.every(t=>t.static)}rollSync(){this.stunted="",this.buildDiceTree();for(let t of this.dice)t.rollSync();return this.calculate(),this._tooltip=null,this.render(),this.trigger("new-result"),this.hasRunOnce=!0,this.result}setSpinner(){this.resultEl.empty(),(0,B2.setIcon)(this.resultEl.createDiv("should-spin"),"loader-2")}async renderDice(){this.isRendering=!0,this.setTooltip(),this.setSpinner();let t=[];for(let i of this.dice)t.push(new Promise(async n=>{await i.render(),n()}));await Promise.all(t),this.isRendering=!1,this.setTooltip()}buildDiceTree(){let t=0;for(let i of this.lexemes)switch(i.type){case"+":case"*":case"/":case"^":case"-":case"math":continue;case"u":{let n=this.dice[t-1],r=i.value?Number(i.value):1;n.modifiers.set("u",{data:r,conditionals:[],value:i.text});break}case"kh":{let n=this.dice[t-1],r=i.value?Number(i.value):1;n.modifiers.set("kh",{data:r,conditionals:[],value:i.text});break}case"dl":{let n=this.dice[t-1],r=i.value?Number(i.value):1;r=n.rolls-r,n.modifiers.set("kh",{data:r,conditionals:[],value:i.text});break}case"kl":{let n=this.dice[t-1],r=i.value?Number(i.value):1;n.modifiers.set("kl",{data:r,conditionals:[],value:i.text});break}case"dh":{let n=this.dice[t-1],r=i.value?Number(i.value):1;r=n.rolls-r,n.modifiers.set("kl",{data:r,conditionals:[],value:i.text});break}case"!":{let n=this.dice[t-1],r=Number(i.value)||1;n.modifiers.set("!",{data:r,conditionals:i.conditions??[],value:i.text});break}case"!!":{let n=this.dice[t-1],r=Number(i.value)||1;n.modifiers.set("!!",{data:r,conditionals:i.conditions??[],value:i.text});break}case"r":{let n=this.dice[t-1],r=Number(i.value)||1;n.modifiers.set("r",{data:r,conditionals:i.conditions??[],value:i.text});break}case"sort":{let n=this.dice[t-1],r=Number(i.value);n.modifiers.set("sort",{data:r,conditionals:i.conditions??[],value:i.value});break}case"dice":{if(i.parenedDice&&/^d/.test(i.value)&&this.stack.length){let n=this.stack.pop();i.value=`${n.result}${i.value}`,this.dice[t]=new $t(i.value,this.renderer,i)}this.dice[t]||(this.dice[t]=new $t(i.value,this.renderer,i)),t++;break}case"stunt":{this.dice[t]||(this.dice[t]=new q1(i.value,this.renderer,i)),t++;break}case"%":{this.dice[t]||(this.dice[t]=new ba(i.value,this.renderer,i)),t++;break}}}async roll(t){if(this.stunted="",this.stackCopy=[],this.dice.length||this.buildDiceTree(),this.renderer.stop(),this.dice.forEach(i=>i.shouldRender=!1),t||this.shouldRender&&this.hasRunOnce)await this.renderDice();else for(let i of this.dice)await i.roll();return this.calculate(),this.render(),this.showRenderNotice&&(t||this.shouldRender&&this.hasRunOnce)&&new B2.Notice(`${this.tooltip}
Result: ${this.result}`),this.trigger("new-result"),this.hasRunOnce=!0,this.result}calculate(){let t=0;for(let n of this.lexemes)switch(n.type){case"+":case"-":case"*":case"/":case"^":case"math":{let r=this.stack.pop(),s=this.stack.pop();r instanceof q1&&r.doubles&&(this.stunted=` - ${r.results.get(0).value} Stunt Points`),s instanceof q1&&s.doubles&&(this.stunted=` - ${s.results.get(0).value} Stunt Points`);let o=this.operators[n.value](s.result,r.result),c=this.operators[n.value](this.minStack.pop(),this.minStack.pop()),l=this.operators[n.value](this.maxStack.pop(),this.maxStack.pop());this.stackCopy.push(n.value),this.stack.push(new $t(`${o}`,this.renderer,n)),this.minStack.push(c),this.maxStack.push(l);break}case"stunt":case"%":case"dice":this.stack.push(this.dice[t]),this.stackCopy.push(this.dice[t]),this.minStack.push(this.dice[t].getMinPossible()),this.maxStack.push(this.dice[t].getMaxPossible()),t++;default:continue}let i=this.stack.pop();this.min=this.minStack.pop(),this.max=this.maxStack.pop(),i instanceof q1&&i.doubles&&(this.stunted=` - ${i.results.get(0).value} Stunt Points`),this.result=i.result}recalculate(t=!1){let i=[],n=0;if(!this.stackCopy.length)return this.roll();for(let r of this.stackCopy)if(typeof r=="string"){let s=i.pop(),o=i.pop(),c=this.operators[r](o.result,s.result);i.push(new $t(`${c}`,this.renderer))}else i.push(r),r instanceof $t&&this.stackCopy.indexOf(r)!=this.stackCopy.length-1&&t&&r.applyModifiers();i.length&&i[0]instanceof $t&&(t&&i[0].applyModifiers(),n+=i[0].result),this.result=n,this.render()}toResult(){return{type:"dice",result:this.result,tooltip:this.tooltip}}async applyResult(t){t.type==="dice"&&(t.result&&(this.result=t.result),t.tooltip&&(this._tooltip=t.tooltip),await this.render())}setResult(t){}};var P2=require("obsidian");function a9(a){let e="",t="abcdefghijklmnopqrstuvwxyz0123456789",i=t.length;for(let n=0;n<a;n++)e+=t.charAt(Math.floor(Math.random()*i));return e}function o9(a){return`dice-${a9(4)}`}var Si=class extends hn{constructor(t,i,n,r,s=!0,o=t.data.showDice){super(t,i,n,r,o);this.plugin=t;this.original=i;this.lexeme=n;this.inline=s}async getReplacer(){let t=await this.getBlockId();return t?`![[${this.path}#^${t}]]`:""}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 t of this.results){this.resultEl.onclick=async n=>{if(n&&n.getModifierState("Control")||n.getModifierState("Meta")){n.stopPropagation();return}};let i=this.resultEl.createDiv({cls:this.getEmbedClass()});if(!this.plugin.data.displayResultsInline){let n="type"in t?t.type:"List Item";i.setAttrs({"aria-label":`${this.file.basename}: ${n}`})}if(!t){i.createDiv({cls:"dice-no-results",text:"No results."});continue}if(P2.MarkdownRenderer.render(app,this.displayFromCache(t),i.createDiv(),this.source,new P2.Component),this.plugin.data.copyContentButton&&this.results.length>1){let n=i.createDiv({cls:"dice-content-copy dice-roller-button",attr:{"aria-label":"Copy Contents"}});n.addEventListener("click",r=>{r.stopPropagation(),navigator.clipboard.writeText(this.displayFromCache(t).trim()).then(async()=>{new P2.Notice("Result copied to clipboard.")})}),(0,P2.setIcon)(n,U1)}}}async load(){await this.getOptions()}displayFromCache(...t){let i=[];for(let n of t)i.push(this.content.slice(n.position.start.offset,n.position.end.offset));return i.join(`
`)}transformResultsToString(){return this.displayFromCache(...this.results)}async getBlockId(){this.result||await this.roll();let t=this.cache.blocks??{},i=Object.entries(t).find(([n,r])=>R8(r.position,this.result.position));if(!i){let n=`${o9(4)}`,r=`${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,r),n}return i[0]}getPath(){let{groups:t}=this.lexeme.value.match(va)??{},{roll:i=1,link:n,types:r}=t??{};if(!n)throw new Error("Could not parse link.");this.rolls=(i&&!isNaN(Number(i))&&Number(i))??1,this.path=decodeURIComponent(n.replace(/(\[|\]|\(|\))/g,"")),this.types=r?.split(","),this.levels=r?.split(",").map(s=>/heading\-\d+/.test(s)?s.split("-").pop():null).filter(s=>s),this.types=r?.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:t,position:i})=>this.types?t=="heading"&&this.types.includes(t)&&this.levels.length?(this.cache.headings??[]).filter(({level:r})=>this.levels.includes(`${r}`)).some(({position:r})=>R8(r,i)):this.types.includes(t):!["yaml","thematicBreak"].includes(t)),this.types&&this.types.includes("listItem")&&this.options.push(...this.cache.listItems),this.loaded=!0,this.trigger("loaded")}async roll(){return new Promise((t,i)=>{if(!this.loaded)this.on("loaded",()=>{let n=[...this.options];this.results=[...Array(this.rolls)].map(()=>{let r=n[this.getRandomBetween(0,n.length-1)];return n.splice(n.indexOf(r),1),r}).filter(r=>r),this.render(),this.trigger("new-result"),this.result=this.results[0],t(this.results[0])});else{let n=[...this.options];this.results=[...Array(this.rolls)].map(()=>{let r=n[this.getRandomBetween(0,n.length-1)];return n.splice(n.indexOf(r),1),r}).filter(r=>r),this.render(),this.trigger("new-result"),this.result=this.results[0],t(this.results[0])}})}toResult(){return{type:"section",result:this.results}}async applyResult(t){t.type==="section"&&(t.result&&(this.results=t.result),await this.render())}},R8=(a,e)=>a.start.col==e.start.col&&a.start.line==e.start.line&&a.start.offset==e.start.offset;var a2=require("obsidian");var w0=class{constructor(){this.result="";this.combinedTooltip=""}},Vr=class a extends Hr{constructor(){super(...arguments);this.combinedTooltip="";this.prettyTooltip=""}getPath(){let{groups:t}=this.lexeme.value.match(H8)??{},{diceRoll:i="1",link:n,block:r,header:s}=t??{};if(!n||!r)throw new Error("Could not parse link.");let o=i.match(/(\d*?)[Dd]$/);if(o){let[,c="1"]=o;this.rollsFormula=c}else this.rollsFormula=i;this.rolls=1,this.path=decodeURIComponent(n.replace(/(\[|\]|\(|\))/g,"")),this.block=r.replace(/(\^|#)/g,"").trim().toLowerCase(),this.header=s}get tooltip(){return this.prettyTooltip}async getReplacer(){return this.result}async build(){this.resultEl.empty();let t=[this.result];this.plugin.data.displayResultsInline&&t.unshift(this.inlineText);let i=createSpan();await a2.MarkdownRenderer.renderMarkdown(t.join(""),i,this.source,new a2.Component);let n=this.resultEl.createSpan("embedded-table-result");i.childElementCount==1&&i.firstElementChild instanceof HTMLParagraphElement?n.append(...Array.from(i.firstElementChild.childNodes)):n.append(...Array.from(i.childNodes))}prettify(t){let i=/(.*?)(\(|\)|;|\|\|)(.*)/,n=" ",r=0,s="",o=t,c;for(;c=o.match(i);){let[,l,h,u]=c;s+=l,h==")"?(r--,s+=`
`,s+=n.repeat(r),s+=")"):(h=="("?(r++,s+="("):h==";"?s+=",":h=="||"&&(s+="|"),s+=`
`,s+=n.repeat(r)),o=u}return s+=o,s}async getSubResult(t){let i=new w0;typeof t=="number"?i.result=t.toString():i.result=t;let n=[];if(typeof t=="string"){let r=/(?:\`dice:)(.*?)(?:\`)/g,s=t.matchAll(r);for(let o of s){let c=o[1].trim(),l=await this.plugin.getRoller(c,this.source);await l.roll();let h=await this.getSubResult(l.result),u;if(h.result instanceof a2.TFile?u=h.result.basename:u=h.result,i.result=i.result.replace(o[0],u),l instanceof a)n.push(l.combinedTooltip);else{let[f,d]=l.tooltip.split(`
`);n.push(f+" --> "+d)}}}return i.combinedTooltip=n.join(";"),i}async getResult(){let t=[],i=[],n=this.original;if(this.rollsFormula)try{let r=await this.plugin.getRoller(this.rollsFormula,this.source);if(!(r instanceof Gt))return this.prettyTooltip="TableRoller only supports dice rolls to select multiple elements.",new a2.Notice(this.prettyTooltip),"ERROR";let s=r;await s.roll(),this.rolls=s.result,s.isStatic||(n=n.replace(this.rollsFormula,`${this.rollsFormula.trim()} --> ${s.resultText} > `))}catch{return this.prettyTooltip=`TableRoller: '${this.rollsFormula}' is not a valid dice roll.`,new a2.Notice(this.prettyTooltip),"ERROR"}for(let r=0;r<this.rolls;r++){let s="",o,c="";if(this.isLookup){let l=await this.lookupRoller.roll(),h=this.lookupRanges.find(([u])=>u[1]===void 0&&l===u[0]||l>=u[0]&&u[1]>=l);h&&(s=this.lookupRoller.original.trim()+" --> "+`${this.lookupRoller.resultText}${this.header?" | "+this.header:""}`.trim(),c=h[1])}else{let l=[...this.options],h=this.getRandomBetween(0,l.length-1);s=l.length+" rows --> [row "+(h+1)+"]",c=l[h]}o=await this.getSubResult(c),t.push(o.result),o.combinedTooltip&&(s+=" > ("+o.combinedTooltip+")"),i.push(s)}return i.length==0?this.combinedTooltip=n:i.length==1?this.combinedTooltip=n+" "+i.join(""):this.combinedTooltip=n+" ==> ("+i.join(" ||")+")",this.prettyTooltip=this.prettify(this.combinedTooltip),t.join("||")}async roll(){return new Promise(async t=>{this.loaded?(this.result=await this.getResult(),this.render(),this.trigger("new-result"),t(this.result)):this.on("loaded",async()=>{this.result=await this.getResult(),this.render(),this.trigger("new-result"),t(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 t=this.cache.sections?.find(r=>r.position==this.cache.blocks[this.block].position),i=this.cache.blocks[this.block].position,n=await this.plugin.app.vault.cachedRead(this.file);if(this.content=n.slice(i.start.offset,i.end.offset),t&&t.type==="list")this.options=this.content.split(`
`);else{let r=l9(this.content);if(r.columns.size===2&&/dice:\s*([\s\S]+)\s*?/.test(Array.from(r.columns.keys())[0])){let s=await this.plugin.getRoller(Array.from(r.columns.keys())[0].split(":").pop().replace(/\`/g,""),this.source);s instanceof Gt&&(this.lookupRoller=s,this.lookupRanges=r.rows.map(o=>{let[c,l]=o.replace(/\\\|/g,"{ESCAPED_PIPE}").split("|").map(f=>f.replace(/{ESCAPED_PIPE}/g,"\\|")).map(f=>f.trim()),[,h,u]=c.match(/(\d+)(?:[^\d]+?(\d+))?/)??[];if(!(!h&&!u))return[[Number(h),u?Number(u):void 0],l]}),this.isLookup=!0)}if(this.header==="xy"&&!r.columns.has("xy")){this.options=[];for(let s of Array.from(r.columns.values()).slice(1))this.options.push(...s)}else if(this.header&&r.columns.has(this.header))this.options=r.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=r.rows}}this.loaded=!0,this.trigger("loaded")}toResult(){return{type:"table",result:this.result}}async applyResult(t){t.type==="table"&&(t.result&&(this.result=t.result),await this.render())}},c9=/^\|?([\s\S]+?)\|?$/,N8=/\|/g;function l9(a){let e=a.split(`
`),i=e.map(s=>(s.trim().match(c9)??[,s.trim()])[1])[0].replace("\\|","{ESCAPED_PIPE}").split(N8),n=[],r=[];for(let s in i){let o=i[s];o.trim().length||(o=s),r.push([o.trim(),[]])}for(let s of e.slice(2)){let o=s.trim().replace(/\\\|/g,"{ESCAPED_PIPE}").split(N8).map(c=>c.replace(/{ESCAPED_PIPE}/g,"\\|")).map(c=>c.trim()).filter(c=>c.length);n.push(o.join(" | "));for(let c in o){let l=o[c].trim();!l.length||!r[c]||r[c][1].push(l)}}return{columns:new Map(r),rows:n}}var I2=require("obsidian");var Rr=class extends hn{constructor(t,i,n,r,s=!0,o=t.data.showDice){super(t,i,n,r,o);this.plugin=t;this.original=i;this.lexeme=n}async getReplacer(){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 t of this.results){this.resultEl.onclick=async n=>{if(n&&n.getModifierState("Control")||n.getModifierState("Meta")){n.stopPropagation();return}};let i=this.resultEl.createDiv({cls:this.getEmbedClass()});if(!t){i.createDiv({cls:"dice-no-results",text:"No results."});continue}if(I2.MarkdownRenderer.renderMarkdown(t,i.createDiv(),this.source,new I2.Component),this.plugin.data.copyContentButton&&this.results.length>1){let n=i.createDiv({cls:"dice-content-copy dice-roller-button",attr:{"aria-label":"Copy Contents"}});n.addEventListener("click",r=>{r.stopPropagation(),navigator.clipboard.writeText(t).then(async()=>{new I2.Notice("Result copied to clipboard.")})}),(0,I2.setIcon)(n,U1)}}}transformResultsToString(){return this.results.join(`
`)}async load(){await this.getOptions()}getPath(){let{groups:t}=this.lexeme.value.match(va)??{},{roll:i=1,link:n,types:r}=t??{};if(!n)throw new Error("Could not parse link.");this.rolls=(i&&!isNaN(Number(i))&&Number(i))??1,this.path=n.replace(/(\[|\])/g,""),this.types=r?.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(t=>t.trim()).filter(t=>t&&t.length),this.loaded=!0,this.trigger("loaded")}async roll(){return new Promise((t,i)=>{if(!this.loaded)this.on("loaded",()=>{let n=[...this.options];this.results=[...Array(this.rolls)].map(()=>{let r=n[this.getRandomBetween(0,n.length-1)];return n.splice(n.indexOf(r),1),r}).filter(r=>r),this.render(),this.trigger("new-result"),t(this.results[0])});else{let n=[...this.options];this.results=[...Array(this.rolls)].map(()=>{let r=n[this.getRandomBetween(0,n.length-1)];return n.splice(n.indexOf(r),1),r}).filter(r=>r),this.render(),this.trigger("new-result"),t(this.results[0])}})}toResult(){return{type:"section",result:this.results}}async applyResult(t){t.type==="section"&&(t.result&&(this.results=t.result),await this.render())}};var F8=require("obsidian");var _i=require("obsidian");var za=class extends F2{constructor(t,i,n,r,s=t.data.showDice){super(t,i,[n],s);this.plugin=t;this.original=i;this.lexeme=n;this.source=r;this.isLink=!1;this.loaded=!1;this.guardDataview()}async getReplacer(){return this.isLink?`[[${this.result.file.basename}]]`:await this.result.getReplacer()}guardDataview(){if(!this.plugin.canUseDataview)throw new _i.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:t=1,query:i,types:n}=this.lexeme.value.match(this.regex).groups;this.base=i,this.rolls=Number(t),this.types=n,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 _i.Notice("Dice Roller: Dataview must be installed and enabled to use query rollers.");return}await this.plugin.dataviewReady();let t=await this.plugin.dataviewAPI.query(this.query);if(!t.successful)throw new Error(`No files found with that query. Is the query correct?
`+this.query);let i=new Set(t.value.values.reduce((s,o)=>(o.type=="file"&&s.push(o.path),s),[]));if(i&&i.delete(this.source),!i||!i.size)throw new Error(`No files found with that query. Is the query correct?
`+this.query);let n=Array.from(i).map(s=>`[[${s}]]${this.typeText}`);this.results=[];let r=[];for(let s of n)r.push(new Promise(async o=>{let c=new Si(this.plugin,s,{...this.lexeme,value:s,type:"section"},this.source,!1);this.results.push(c),o()}));await Promise.all(r),this.loaded=!0,this.trigger("loaded")}async build(){this.resultEl.empty(),this.plugin.data.displayResultsInline&&this.resultEl.createSpan({text:this.inlineText});let t=[],i=new Map(this.results.map((n,r)=>[r,n]));for(let n=0;n<this.rolls;n++){if(!i.size)continue;let r=this.getRandomBetween(0,i.size),s=i.get(r);await s.roll(),t.push(s),i.delete(r)}if(this.isLink){let n=t.reduce((r,s,o,c)=>(r.push(`[[${s.file.basename}]]`),c.length>1&&o!=c.length-1&&r.push(","),r),[]);_i.MarkdownRenderer.render(this.plugin.app,n.join(" "),this.resultEl,this.plugin.app.workspace.getActiveFile()?.path,new _i.Component)}else for(let n of t){let r=this.resultEl.createDiv();r.createEl("h5",{cls:"dice-file-name",text:n.file.basename}),r.appendChild(n.containerEl)}}async roll(){return new Promise((t,i)=>{this.loaded?(this.result=this.results[0],this.render(),this.trigger("new-result"),t(this.result)):this.on("loaded",()=>{this.result=this.results[0],this.render(),this.trigger("new-result"),t(this.result)})})}get tooltip(){return this.original}toResult(){return{type:"query",random:this.chosen,result:Object.fromEntries(this.results.map(t=>[t.path,t.toResult()]))}}async applyResult(t){if(t.type==="query"){if(t.result)for(let i in t.result){let n=this.results.find(r=>r.path===i);n&&n.applyResult(t.result[i])}t.random&&(this.random=t.random),await this.render()}}},Nr=class extends za{constructor(t,i,n,r,s=t.data.showDice){super(t,i,n,r,s);this.plugin=t;this.original=i;this.lexeme=n;this.source=r;this.regex=D8;this.initialize()}get query(){return this.base}},Fr=class extends za{constructor(t,i,n,r,s=t.data.showDice){super(t,i,n,r,s);this.plugin=t;this.original=i;this.lexeme=n;this.source=r;this.regex=x0;this.initialize()}get query(){return`list from #${this.base}`}};var de=require("obsidian");var un=require("obsidian"),h9=createSvg("svg",{attr:{viewBox:"0 0 500 500"}}),u9=createSvg("text",{attr:{class:"font",fill:"currentColor",x:"50%",y:"50%","text-anchor":"middle","dominant-baseline":"central"}}),Ca=(o=>(o.NONE="None",o.TRIANGLE="Triangle",o.SQUARE="Square",o.DIAMOND="Diamond",o.DODECAHEDRON="Dodecahedron",o.ICOSAHEDRON="Icosahedron",o.CIRCLE="Circle",o))(Ca||{}),B8=[{id:"dice-roller-d4",shape:"Triangle",formula:"d4",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:"%"}],b0=class extends un.Component{#e(){return h9.cloneNode(!0)}#t(){return u9.cloneNode()}#i=new Set;registerIcon(e,t,i){this.#i.add(e);let n=this.#e(),r=this.#t();r.textContent=i,n.appendChild(r);let s;switch(t){case"Triangle":s=this.getTriangle();break;case"Square":{s=this.getSquare();break}case"Diamond":{s=this.getDiamond();break}case"Dodecahedron":{s=this.getDodecahedron();break}case"Icosahedron":{s=this.getIcosahedron();break}case"Circle":{s=this.getCircle();break}case"None":s=createSvg("defs")}n.appendChild(s),(0,un.addIcon)(e,n.outerHTML),this.register(()=>(0,un.removeIcon)(e))}getTriangle(){return this.#n("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 this.#n("rect",{x:"87.5",y:"87.5",width:"325",height:"325",rx:"10"})}getDiamond(){return this.#n("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 this.#n("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 this.#n("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 this.#n("circle",{cx:"250",cy:"250",r:"190"})}#n(e,t){return createSvg(e,{cls:"shape",attr:{...t,stroke:"currentColor"}})}onunload(){}},Aa=new b0;var hl=oa(O8());var Va=require("obsidian");var ht="top",wt="bottom",gt="right",dt="left",_a="auto",O2=[ht,wt,gt,dt],c2="start",Ei="end",U8="clippingParents",Ea="viewport",fn="popper",q8="reference",z0=O2.reduce(function(a,e){return a.concat([e+"-"+c2,e+"-"+Ei])},[]),La=[].concat(O2,[_a]).reduce(function(a,e){return a.concat([e,e+"-"+c2,e+"-"+Ei])},[]),v9="beforeRead",x9="read",y9="afterRead",w9="beforeMain",b9="main",M9="afterMain",z9="beforeWrite",C9="write",A9="afterWrite",G8=[v9,x9,y9,w9,b9,M9,z9,C9,A9];function _t(a){return a?(a.nodeName||"").toLowerCase():null}function it(a){if(a==null)return window;if(a.toString()!=="[object Window]"){var e=a.ownerDocument;return e&&e.defaultView||window}return a}function f1(a){var e=it(a).Element;return a instanceof e||a instanceof Element}function bt(a){var e=it(a).HTMLElement;return a instanceof e||a instanceof HTMLElement}function dn(a){if(typeof ShadowRoot>"u")return!1;var e=it(a).ShadowRoot;return a instanceof e||a instanceof ShadowRoot}function S9(a){var e=a.state;Object.keys(e.elements).forEach(function(t){var i=e.styles[t]||{},n=e.attributes[t]||{},r=e.elements[t];!bt(r)||!_t(r)||(Object.assign(r.style,i),Object.keys(n).forEach(function(s){var o=n[s];o===!1?r.removeAttribute(s):r.setAttribute(s,o===!0?"":o)}))})}function _9(a){var e=a.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(i){var n=e.elements[i],r=e.attributes[i]||{},s=Object.keys(e.styles.hasOwnProperty(i)?e.styles[i]:t[i]),o=s.reduce(function(c,l){return c[l]="",c},{});!bt(n)||!_t(n)||(Object.assign(n.style,o),Object.keys(r).forEach(function(c){n.removeAttribute(c)}))})}}var W8={name:"applyStyles",enabled:!0,phase:"write",fn:S9,effect:_9,requires:["computeStyles"]};function Et(a){return a.split("-")[0]}var z1=Math.max,Li=Math.min,l2=Math.round;function pn(){var a=navigator.userAgentData;return a!=null&&a.brands&&Array.isArray(a.brands)?a.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function Br(){return!/^((?!chrome|android).)*safari/i.test(pn())}function d1(a,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var i=a.getBoundingClientRect(),n=1,r=1;e&&bt(a)&&(n=a.offsetWidth>0&&l2(i.width)/a.offsetWidth||1,r=a.offsetHeight>0&&l2(i.height)/a.offsetHeight||1);var s=f1(a)?it(a):window,o=s.visualViewport,c=!Br()&&t,l=(i.left+(c&&o?o.offsetLeft:0))/n,h=(i.top+(c&&o?o.offsetTop:0))/r,u=i.width/n,f=i.height/r;return{width:u,height:f,top:h,right:l+u,bottom:h+f,left:l,x:l,y:h}}function Ti(a){var e=d1(a),t=a.offsetWidth,i=a.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-i)<=1&&(i=e.height),{x:a.offsetLeft,y:a.offsetTop,width:t,height:i}}function Pr(a,e){var t=e.getRootNode&&e.getRootNode();if(a.contains(e))return!0;if(t&&dn(t)){var i=e;do{if(i&&a.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function Wt(a){return it(a).getComputedStyle(a)}function C0(a){return["table","td","th"].indexOf(_t(a))>=0}function Rt(a){return((f1(a)?a.ownerDocument:a.document)||window.document).documentElement}function h2(a){return _t(a)==="html"?a:a.assignedSlot||a.parentNode||(dn(a)?a.host:null)||Rt(a)}function j8(a){return!bt(a)||Wt(a).position==="fixed"?null:a.offsetParent}function E9(a){var e=/firefox/i.test(pn()),t=/Trident/i.test(pn());if(t&&bt(a)){var i=Wt(a);if(i.position==="fixed")return null}var n=h2(a);for(dn(n)&&(n=n.host);bt(n)&&["html","body"].indexOf(_t(n))<0;){var r=Wt(n);if(r.transform!=="none"||r.perspective!=="none"||r.contain==="paint"||["transform","perspective"].indexOf(r.willChange)!==-1||e&&r.willChange==="filter"||e&&r.filter&&r.filter!=="none")return n;n=n.parentNode}return null}function C1(a){for(var e=it(a),t=j8(a);t&&C0(t)&&Wt(t).position==="static";)t=j8(t);return t&&(_t(t)==="html"||_t(t)==="body"&&Wt(t).position==="static")?e:t||E9(a)||e}function Di(a){return["top","bottom"].indexOf(a)>=0?"x":"y"}function Hi(a,e,t){return z1(a,Li(e,t))}function Z8(a,e,t){var i=Hi(a,e,t);return i>t?t:i}function Ir(){return{top:0,right:0,bottom:0,left:0}}function kr(a){return Object.assign({},Ir(),a)}function Or(a,e){return e.reduce(function(t,i){return t[i]=a,t},{})}var L9=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,kr(typeof e!="number"?e:Or(e,O2))};function T9(a){var e,t=a.state,i=a.name,n=a.options,r=t.elements.arrow,s=t.modifiersData.popperOffsets,o=Et(t.placement),c=Di(o),l=[dt,gt].indexOf(o)>=0,h=l?"height":"width";if(!(!r||!s)){var u=L9(n.padding,t),f=Ti(r),d=c==="y"?ht:dt,p=c==="y"?wt:gt,v=t.rects.reference[h]+t.rects.reference[c]-s[c]-t.rects.popper[h],x=s[c]-t.rects.reference[c],g=C1(r),m=g?c==="y"?g.clientHeight||0:g.clientWidth||0:0,M=v/2-x/2,y=u[d],b=m-f[h]-u[p],C=m/2-f[h]/2+M,_=Hi(y,C,b),S=c;t.modifiersData[i]=(e={},e[S]=_,e.centerOffset=_-C,e)}}function D9(a){var e=a.state,t=a.options,i=t.element,n=i===void 0?"[data-popper-arrow]":i;n!=null&&(typeof n=="string"&&(n=e.elements.popper.querySelector(n),!n)||Pr(e.elements.popper,n)&&(e.elements.arrow=n))}var X8={name:"arrow",enabled:!0,phase:"main",fn:T9,effect:D9,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function p1(a){return a.split("-")[1]}var H9={top:"auto",right:"auto",bottom:"auto",left:"auto"};function V9(a,e){var t=a.x,i=a.y,n=e.devicePixelRatio||1;return{x:l2(t*n)/n||0,y:l2(i*n)/n||0}}function Y8(a){var e,t=a.popper,i=a.popperRect,n=a.placement,r=a.variation,s=a.offsets,o=a.position,c=a.gpuAcceleration,l=a.adaptive,h=a.roundOffsets,u=a.isFixed,f=s.x,d=f===void 0?0:f,p=s.y,v=p===void 0?0:p,x=typeof h=="function"?h({x:d,y:v}):{x:d,y:v};d=x.x,v=x.y;var g=s.hasOwnProperty("x"),m=s.hasOwnProperty("y"),M=dt,y=ht,b=window;if(l){var C=C1(t),_="clientHeight",S="clientWidth";if(C===it(t)&&(C=Rt(t),Wt(C).position!=="static"&&o==="absolute"&&(_="scrollHeight",S="scrollWidth")),C=C,n===ht||(n===dt||n===gt)&&r===Ei){y=wt;var P=u&&C===b&&b.visualViewport?b.visualViewport.height:C[_];v-=P-i.height,v*=c?1:-1}if(n===dt||(n===ht||n===wt)&&r===Ei){M=gt;var H=u&&C===b&&b.visualViewport?b.visualViewport.width:C[S];d-=H-i.width,d*=c?1:-1}}var w=Object.assign({position:o},l&&H9),T=h===!0?V9({x:d,y:v},it(t)):{x:d,y:v};if(d=T.x,v=T.y,c){var A;return Object.assign({},w,(A={},A[y]=m?"0":"",A[M]=g?"0":"",A.transform=(b.devicePixelRatio||1)<=1?"translate("+d+"px, "+v+"px)":"translate3d("+d+"px, "+v+"px, 0)",A))}return Object.assign({},w,(e={},e[y]=m?v+"px":"",e[M]=g?d+"px":"",e.transform="",e))}function R9(a){var e=a.state,t=a.options,i=t.gpuAcceleration,n=i===void 0?!0:i,r=t.adaptive,s=r===void 0?!0:r,o=t.roundOffsets,c=o===void 0?!0:o,l={placement:Et(e.placement),variation:p1(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:n,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,Y8(Object.assign({},l,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:c})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,Y8(Object.assign({},l,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}var $8={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:R9,data:{}};var Ta={passive:!0};function N9(a){var e=a.state,t=a.instance,i=a.options,n=i.scroll,r=n===void 0?!0:n,s=i.resize,o=s===void 0?!0:s,c=it(e.elements.popper),l=[].concat(e.scrollParents.reference,e.scrollParents.popper);return r&&l.forEach(function(h){h.addEventListener("scroll",t.update,Ta)}),o&&c.addEventListener("resize",t.update,Ta),function(){r&&l.forEach(function(h){h.removeEventListener("scroll",t.update,Ta)}),o&&c.removeEventListener("resize",t.update,Ta)}}var J8={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:N9,data:{}};var F9={left:"right",right:"left",bottom:"top",top:"bottom"};function mn(a){return a.replace(/left|right|bottom|top/g,function(e){return F9[e]})}var B9={start:"end",end:"start"};function Da(a){return a.replace(/start|end/g,function(e){return B9[e]})}function Vi(a){var e=it(a),t=e.pageXOffset,i=e.pageYOffset;return{scrollLeft:t,scrollTop:i}}function Ri(a){return d1(Rt(a)).left+Vi(a).scrollLeft}function A0(a,e){var t=it(a),i=Rt(a),n=t.visualViewport,r=i.clientWidth,s=i.clientHeight,o=0,c=0;if(n){r=n.width,s=n.height;var l=Br();(l||!l&&e==="fixed")&&(o=n.offsetLeft,c=n.offsetTop)}return{width:r,height:s,x:o+Ri(a),y:c}}function S0(a){var e,t=Rt(a),i=Vi(a),n=(e=a.ownerDocument)==null?void 0:e.body,r=z1(t.scrollWidth,t.clientWidth,n?n.scrollWidth:0,n?n.clientWidth:0),s=z1(t.scrollHeight,t.clientHeight,n?n.scrollHeight:0,n?n.clientHeight:0),o=-i.scrollLeft+Ri(a),c=-i.scrollTop;return Wt(n||t).direction==="rtl"&&(o+=z1(t.clientWidth,n?n.clientWidth:0)-r),{width:r,height:s,x:o,y:c}}function Ni(a){var e=Wt(a),t=e.overflow,i=e.overflowX,n=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+n+i)}function Ha(a){return["html","body","#document"].indexOf(_t(a))>=0?a.ownerDocument.body:bt(a)&&Ni(a)?a:Ha(h2(a))}function U2(a,e){var t;e===void 0&&(e=[]);var i=Ha(a),n=i===((t=a.ownerDocument)==null?void 0:t.body),r=it(i),s=n?[r].concat(r.visualViewport||[],Ni(i)?i:[]):i,o=e.concat(s);return n?o:o.concat(U2(h2(s)))}function gn(a){return Object.assign({},a,{left:a.x,top:a.y,right:a.x+a.width,bottom:a.y+a.height})}function P9(a,e){var t=d1(a,!1,e==="fixed");return t.top=t.top+a.clientTop,t.left=t.left+a.clientLeft,t.bottom=t.top+a.clientHeight,t.right=t.left+a.clientWidth,t.width=a.clientWidth,t.height=a.clientHeight,t.x=t.left,t.y=t.top,t}function Q8(a,e,t){return e===Ea?gn(A0(a,t)):f1(e)?P9(e,t):gn(S0(Rt(a)))}function I9(a){var e=U2(h2(a)),t=["absolute","fixed"].indexOf(Wt(a).position)>=0,i=t&&bt(a)?C1(a):a;return f1(i)?e.filter(function(n){return f1(n)&&Pr(n,i)&&_t(n)!=="body"}):[]}function _0(a,e,t,i){var n=e==="clippingParents"?I9(a):[].concat(e),r=[].concat(n,[t]),s=r[0],o=r.reduce(function(c,l){var h=Q8(a,l,i);return c.top=z1(h.top,c.top),c.right=Li(h.right,c.right),c.bottom=Li(h.bottom,c.bottom),c.left=z1(h.left,c.left),c},Q8(a,s,i));return o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}function Ur(a){var e=a.reference,t=a.element,i=a.placement,n=i?Et(i):null,r=i?p1(i):null,s=e.x+e.width/2-t.width/2,o=e.y+e.height/2-t.height/2,c;switch(n){case ht:c={x:s,y:e.y-t.height};break;case wt:c={x:s,y:e.y+e.height};break;case gt:c={x:e.x+e.width,y:o};break;case dt:c={x:e.x-t.width,y:o};break;default:c={x:e.x,y:e.y}}var l=n?Di(n):null;if(l!=null){var h=l==="y"?"height":"width";switch(r){case c2:c[l]=c[l]-(e[h]/2-t[h]/2);break;case Ei:c[l]=c[l]+(e[h]/2-t[h]/2);break;default:}}return c}function A1(a,e){e===void 0&&(e={});var t=e,i=t.placement,n=i===void 0?a.placement:i,r=t.strategy,s=r===void 0?a.strategy:r,o=t.boundary,c=o===void 0?U8:o,l=t.rootBoundary,h=l===void 0?Ea:l,u=t.elementContext,f=u===void 0?fn:u,d=t.altBoundary,p=d===void 0?!1:d,v=t.padding,x=v===void 0?0:v,g=kr(typeof x!="number"?x:Or(x,O2)),m=f===fn?q8:fn,M=a.rects.popper,y=a.elements[p?m:f],b=_0(f1(y)?y:y.contextElement||Rt(a.elements.popper),c,h,s),C=d1(a.elements.reference),_=Ur({reference:C,element:M,strategy:"absolute",placement:n}),S=gn(Object.assign({},M,_)),P=f===fn?S:C,H={top:b.top-P.top+g.top,bottom:P.bottom-b.bottom+g.bottom,left:b.left-P.left+g.left,right:P.right-b.right+g.right},w=a.modifiersData.offset;if(f===fn&&w){var T=w[n];Object.keys(H).forEach(function(A){var R=[gt,wt].indexOf(A)>=0?1:-1,V=[ht,wt].indexOf(A)>=0?"y":"x";H[A]+=T[V]*R})}return H}function E0(a,e){e===void 0&&(e={});var t=e,i=t.placement,n=t.boundary,r=t.rootBoundary,s=t.padding,o=t.flipVariations,c=t.allowedAutoPlacements,l=c===void 0?La:c,h=p1(i),u=h?o?z0:z0.filter(function(p){return p1(p)===h}):O2,f=u.filter(function(p){return l.indexOf(p)>=0});f.length===0&&(f=u);var d=f.reduce(function(p,v){return p[v]=A1(a,{placement:v,boundary:n,rootBoundary:r,padding:s})[Et(v)],p},{});return Object.keys(d).sort(function(p,v){return d[p]-d[v]})}function k9(a){if(Et(a)===_a)return[];var e=mn(a);return[Da(a),e,Da(e)]}function O9(a){var e=a.state,t=a.options,i=a.name;if(!e.modifiersData[i]._skip){for(var n=t.mainAxis,r=n===void 0?!0:n,s=t.altAxis,o=s===void 0?!0:s,c=t.fallbackPlacements,l=t.padding,h=t.boundary,u=t.rootBoundary,f=t.altBoundary,d=t.flipVariations,p=d===void 0?!0:d,v=t.allowedAutoPlacements,x=e.options.placement,g=Et(x),m=g===x,M=c||(m||!p?[mn(x)]:k9(x)),y=[x].concat(M).reduce(function(ae,U){return ae.concat(Et(U)===_a?E0(e,{placement:U,boundary:h,rootBoundary:u,padding:l,flipVariations:p,allowedAutoPlacements:v}):U)},[]),b=e.rects.reference,C=e.rects.popper,_=new Map,S=!0,P=y[0],H=0;H<y.length;H++){var w=y[H],T=Et(w),A=p1(w)===c2,R=[ht,wt].indexOf(T)>=0,V=R?"width":"height",L=A1(e,{placement:w,boundary:h,rootBoundary:u,altBoundary:f,padding:l}),N=R?A?gt:dt:A?wt:ht;b[V]>C[V]&&(N=mn(N));var I=mn(N),W=[];if(r&&W.push(L[T]<=0),o&&W.push(L[N]<=0,L[I]<=0),W.every(function(ae){return ae})){P=w,S=!1;break}_.set(w,W)}if(S)for(var O=p?3:1,q=function(U){var Ce=y.find(function(ce){var xe=_.get(ce);if(xe)return xe.slice(0,U).every(function(le){return le})});if(Ce)return P=Ce,"break"},j=O;j>0;j--){var ie=q(j);if(ie==="break")break}e.placement!==P&&(e.modifiersData[i]._skip=!0,e.placement=P,e.reset=!0)}}var K8={name:"flip",enabled:!0,phase:"main",fn:O9,requiresIfExists:["offset"],data:{_skip:!1}};function el(a,e,t){return t===void 0&&(t={x:0,y:0}),{top:a.top-e.height-t.y,right:a.right-e.width+t.x,bottom:a.bottom-e.height+t.y,left:a.left-e.width-t.x}}function tl(a){return[ht,gt,wt,dt].some(function(e){return a[e]>=0})}function U9(a){var e=a.state,t=a.name,i=e.rects.reference,n=e.rects.popper,r=e.modifiersData.preventOverflow,s=A1(e,{elementContext:"reference"}),o=A1(e,{altBoundary:!0}),c=el(s,i),l=el(o,n,r),h=tl(c),u=tl(l);e.modifiersData[t]={referenceClippingOffsets:c,popperEscapeOffsets:l,isReferenceHidden:h,hasPopperEscaped:u},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":h,"data-popper-escaped":u})}var il={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:U9};function q9(a,e,t){var i=Et(a),n=[dt,ht].indexOf(i)>=0?-1:1,r=typeof t=="function"?t(Object.assign({},e,{placement:a})):t,s=r[0],o=r[1];return s=s||0,o=(o||0)*n,[dt,gt].indexOf(i)>=0?{x:o,y:s}:{x:s,y:o}}function G9(a){var e=a.state,t=a.options,i=a.name,n=t.offset,r=n===void 0?[0,0]:n,s=La.reduce(function(h,u){return h[u]=q9(u,e.rects,r),h},{}),o=s[e.placement],c=o.x,l=o.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=c,e.modifiersData.popperOffsets.y+=l),e.modifiersData[i]=s}var nl={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:G9};function W9(a){var e=a.state,t=a.name;e.modifiersData[t]=Ur({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}var rl={name:"popperOffsets",enabled:!0,phase:"read",fn:W9,data:{}};function L0(a){return a==="x"?"y":"x"}function j9(a){var e=a.state,t=a.options,i=a.name,n=t.mainAxis,r=n===void 0?!0:n,s=t.altAxis,o=s===void 0?!1:s,c=t.boundary,l=t.rootBoundary,h=t.altBoundary,u=t.padding,f=t.tether,d=f===void 0?!0:f,p=t.tetherOffset,v=p===void 0?0:p,x=A1(e,{boundary:c,rootBoundary:l,padding:u,altBoundary:h}),g=Et(e.placement),m=p1(e.placement),M=!m,y=Di(g),b=L0(y),C=e.modifiersData.popperOffsets,_=e.rects.reference,S=e.rects.popper,P=typeof v=="function"?v(Object.assign({},e.rects,{placement:e.placement})):v,H=typeof P=="number"?{mainAxis:P,altAxis:P}:Object.assign({mainAxis:0,altAxis:0},P),w=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,T={x:0,y:0};if(C){if(r){var A,R=y==="y"?ht:dt,V=y==="y"?wt:gt,L=y==="y"?"height":"width",N=C[y],I=N+x[R],W=N-x[V],O=d?-S[L]/2:0,q=m===c2?_[L]:S[L],j=m===c2?-S[L]:-_[L],ie=e.elements.arrow,ae=d&&ie?Ti(ie):{width:0,height:0},U=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Ir(),Ce=U[R],ce=U[V],xe=Hi(0,_[L],ae[L]),le=M?_[L]/2-O-xe-Ce-H.mainAxis:q-xe-Ce-H.mainAxis,De=M?-_[L]/2+O+xe+ce+H.mainAxis:j+xe+ce+H.mainAxis,ze=e.elements.arrow&&C1(e.elements.arrow),Q=ze?y==="y"?ze.clientTop||0:ze.clientLeft||0:0,re=(A=w?.[y])!=null?A:0,ne=N+le-re-Q,pe=N+De-re,he=Hi(d?Li(I,ne):I,N,d?z1(W,pe):W);C[y]=he,T[y]=he-N}if(o){var Ae,Ee=y==="x"?ht:dt,Pe=y==="x"?wt:gt,ke=C[b],Oe=b==="y"?"height":"width",F=ke+x[Ee],E=ke-x[Pe],$=[ht,dt].indexOf(g)!==-1,se=(Ae=w?.[b])!=null?Ae:0,ve=$?F:ke-_[Oe]-S[Oe]-se+H.altAxis,J=$?ke+_[Oe]+S[Oe]-se-H.altAxis:E,Me=d&&$?Z8(ve,ke,J):Hi(d?ve:F,ke,d?J:E);C[b]=Me,T[b]=Me-ke}e.modifiersData[i]=T}}var sl={name:"preventOverflow",enabled:!0,phase:"main",fn:j9,requiresIfExists:["offset"]};function T0(a){return{scrollLeft:a.scrollLeft,scrollTop:a.scrollTop}}function D0(a){return a===it(a)||!bt(a)?Vi(a):T0(a)}function Z9(a){var e=a.getBoundingClientRect(),t=l2(e.width)/a.offsetWidth||1,i=l2(e.height)/a.offsetHeight||1;return t!==1||i!==1}function H0(a,e,t){t===void 0&&(t=!1);var i=bt(e),n=bt(e)&&Z9(e),r=Rt(e),s=d1(a,n,t),o={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(i||!i&&!t)&&((_t(e)!=="body"||Ni(r))&&(o=D0(e)),bt(e)?(c=d1(e,!0),c.x+=e.clientLeft,c.y+=e.clientTop):r&&(c.x=Ri(r))),{x:s.left+o.scrollLeft-c.x,y:s.top+o.scrollTop-c.y,width:s.width,height:s.height}}function X9(a){var e=new Map,t=new Set,i=[];a.forEach(function(r){e.set(r.name,r)});function n(r){t.add(r.name);var s=[].concat(r.requires||[],r.requiresIfExists||[]);s.forEach(function(o){if(!t.has(o)){var c=e.get(o);c&&n(c)}}),i.push(r)}return a.forEach(function(r){t.has(r.name)||n(r)}),i}function V0(a){var e=X9(a);return G8.reduce(function(t,i){return t.concat(e.filter(function(n){return n.phase===i}))},[])}function R0(a){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(a())})})),e}}function N0(a){var e=a.reduce(function(t,i){var n=t[i.name];return t[i.name]=n?Object.assign({},n,i,{options:Object.assign({},n.options,i.options),data:Object.assign({},n.data,i.data)}):i,t},{});return Object.keys(e).map(function(t){return e[t]})}var al={placement:"bottom",modifiers:[],strategy:"absolute"};function ol(){for(var a=arguments.length,e=new Array(a),t=0;t<a;t++)e[t]=arguments[t];return!e.some(function(i){return!(i&&typeof i.getBoundingClientRect=="function")})}function cl(a){a===void 0&&(a={});var e=a,t=e.defaultModifiers,i=t===void 0?[]:t,n=e.defaultOptions,r=n===void 0?al:n;return function(o,c,l){l===void 0&&(l=r);var h={placement:"bottom",orderedModifiers:[],options:Object.assign({},al,r),modifiersData:{},elements:{reference:o,popper:c},attributes:{},styles:{}},u=[],f=!1,d={state:h,setOptions:function(g){var m=typeof g=="function"?g(h.options):g;v(),h.options=Object.assign({},r,h.options,m),h.scrollParents={reference:f1(o)?U2(o):o.contextElement?U2(o.contextElement):[],popper:U2(c)};var M=V0(N0([].concat(i,h.options.modifiers)));return h.orderedModifiers=M.filter(function(y){return y.enabled}),p(),d.update()},forceUpdate:function(){if(!f){var g=h.elements,m=g.reference,M=g.popper;if(ol(m,M)){h.rects={reference:H0(m,C1(M),h.options.strategy==="fixed"),popper:Ti(M)},h.reset=!1,h.placement=h.options.placement,h.orderedModifiers.forEach(function(H){return h.modifiersData[H.name]=Object.assign({},H.data)});for(var y=0;y<h.orderedModifiers.length;y++){if(h.reset===!0){h.reset=!1,y=-1;continue}var b=h.orderedModifiers[y],C=b.fn,_=b.options,S=_===void 0?{}:_,P=b.name;typeof C=="function"&&(h=C({state:h,options:S,name:P,instance:d})||h)}}}},update:R0(function(){return new Promise(function(x){d.forceUpdate(),x(h)})}),destroy:function(){v(),f=!0}};if(!ol(o,c))return d;d.setOptions(l).then(function(x){!f&&l.onFirstUpdate&&l.onFirstUpdate(x)});function p(){h.orderedModifiers.forEach(function(x){var g=x.name,m=x.options,M=m===void 0?{}:m,y=x.effect;if(typeof y=="function"){var b=y({state:h,name:g,instance:d,options:M}),C=function(){};u.push(b||C)}})}function v(){u.forEach(function(x){return x()}),u=[]}return d}}var Y9=[J8,rl,$8,W8,nl,K8,sl,X8,il],F0=cl({defaultModifiers:Y9});var B0=class{constructor(e,t,i){this.containerEl=t,this.owner=e,t.on("click",".suggestion-item",this.onSuggestionClick.bind(this)),t.on("mousemove",".suggestion-item",this.onSuggestionMouseover.bind(this)),i.register([],"ArrowUp",()=>(this.setSelectedItem(this.selectedItem-1,!0),!1)),i.register([],"ArrowDown",()=>(this.setSelectedItem(this.selectedItem+1,!0),!1)),i.register([],"Enter",n=>(this.useSelectedItem(n),!1)),i.register([],"Tab",n=>(this.chooseSuggestion(n),!1))}chooseSuggestion(e){if(!this.items||!this.items.length)return;let t=this.items[this.selectedItem];t&&this.owner.onChooseSuggestion(t,e)}onSuggestionClick(e,t){if(e.preventDefault(),!this.suggestions||!this.suggestions.length)return;let i=this.suggestions.indexOf(t);this.setSelectedItem(i,!1),this.useSelectedItem(e)}onSuggestionMouseover(e,t){if(!this.suggestions||!this.suggestions.length)return;let i=this.suggestions.indexOf(t);this.setSelectedItem(i,!1)}empty(){this.containerEl.empty()}setSuggestions(e){this.containerEl.empty();let t=[];e.forEach(i=>{let n=this.containerEl.createDiv("suggestion-item");this.owner.renderSuggestion(i,n),t.push(n)}),this.items=e,this.suggestions=t,this.setSelectedItem(0,!1)}useSelectedItem(e){if(!this.items||!this.items.length)return;let t=this.items[this.selectedItem];t&&this.owner.selectSuggestion(t,e)}wrap(e,t){return(e%t+t)%t}setSelectedItem(e,t){let i=this.wrap(e,this.suggestions.length),n=this.suggestions[this.selectedItem],r=this.suggestions[i];n&&n.removeClass("is-selected"),r&&r.addClass("is-selected"),this.selectedItem=i,t&&r.scrollIntoView(!1)}},vn=class extends Va.FuzzySuggestModal{constructor(t,i,n){super(t);this.items=[];this.scope=new Va.Scope;this.emptyStateText="No match found";this.limit=100;this.shouldNotOpen=!this.items.length,this.inputEl=i,this.items=n,this.suggestEl=createDiv("suggestion-container"),this.contentEl=this.suggestEl.createDiv("suggestion"),this.suggester=new B0(this,this.contentEl,this.scope),this.scope.register([],"Escape",this.onEscape.bind(this)),this.inputEl.addEventListener("input",this.onInputChanged.bind(this)),this.inputEl.addEventListener("focus",this.onFocus.bind(this)),this.inputEl.addEventListener("blur",this.close.bind(this)),this.suggestEl.on("mousedown",".suggestion-container",r=>{r.preventDefault()})}empty(){this.suggester.empty()}onInputChanged(){if(this.shouldNotOpen)return;let t=this.modifyInput(this.inputEl.value),i=this.getSuggestions(t??"");i.length>0?this.suggester.setSuggestions(i.slice(0,this.limit)):this.onNoSuggestion(),this.open()}onFocus(){this.shouldNotOpen=!1,this.onInputChanged()}modifyInput(t){return t}onNoSuggestion(){this.empty()}open(){this.app.keymap.pushScope(this.scope),document.body.appendChild(this.suggestEl),this.popper=F0(this.inputEl,this.suggestEl,{placement:"bottom-start",modifiers:[{name:"offset",options:{offset:[0,10]}},{name:"flip",options:{fallbackPlacements:["top"]}}]})}onEscape(){this.close(),this.shouldNotOpen=!0}close(){this.app.keymap.popScope(this.scope),this.suggester.setSuggestions([]),this.popper&&this.popper.destroy(),this.suggestEl.detach()}createPrompt(t){this.promptEl||(this.promptEl=this.suggestEl.createDiv("prompt-instructions"));let i=this.promptEl.createDiv("prompt-instruction");for(let n of t)i.appendChild(n)}getItems(){return this.items}};var Ra=class extends vn{constructor(e,t,i){super(e,t.inputEl,i),this.text=t}getItemText(e){return e}onChooseItem(e){this.text.setValue(e),this.item=e}selectSuggestion({item:e}){let t=e;this.text.setValue(t),this.onClose(),this.close()}renderSuggestion(e,t){let{item:i,match:n}=e||{},r=t.createDiv({cls:"suggestion-content",attr:{style:`font-family: "${i}"`}});if(!i){r.setText(this.emptyStateText),r.parentElement?.addClass("is-selected");return}let s=i.length-i.length,o=n.matches.map(c=>createSpan("suggestion-highlight"));for(let c=s;c<i.length;c++){let l=n.matches.find(h=>h[0]===c);if(l){let h=o[n.matches.indexOf(l)];r.appendChild(h),h.appendText(i.substring(l[0],l[1])),c+=l[1]-l[0]-1;continue}r.appendText(i[c])}}};var ll=require("obsidian");var Na=class extends vn{constructor(e,t,i){super(e,t.inputEl,i),this.text=t,this.inputEl.addEventListener("input",()=>this.getFolder())}getFolder(){let e=this.inputEl.value,t=this.app.vault.getAbstractFileByPath(e);t!=this.item&&t instanceof ll.TFolder&&(this.item=t,this.onInputChanged())}getItemText(e){return e.path}onChooseItem(e){this.item=e,this.text.setValue(e.path)}selectSuggestion({item:e}){let t=e.path;this.item=e,this.text.setValue(t),this.onClose(),this.close()}renderSuggestion(e,t){let{item:i,match:n}=e||{};t.addClass("mod-complex");let r=t.createDiv({cls:"suggestion-content"});if(!i){r.setText(this.emptyStateText),r.parentElement?.addClass("is-selected");return}let s=i.path.length-i.name.length,o=n.matches.map(c=>createSpan("suggestion-highlight"));for(let c=s;c<i.path.length;c++){let l=n.matches.find(h=>h[0]===c);if(l){let h=o[n.matches.indexOf(l)];r.appendChild(h),h.appendText(i.path.substring(l[0],l[1])),c+=l[1]-l[0]-1;continue}r.appendText(i.path[c])}r.createDiv({cls:"suggestion-note",text:i.path})}};var qr=class extends de.PluginSettingTab{constructor(t,i){super(t,i);this.plugin=i;this.#t=!0;this.allFolders=this.app.vault.getAllLoadedFiles().filter(t=>t instanceof de.TFolder);this.folders=this.allFolders.filter(t=>!(t.path in this.plugin.data.diceModTemplateFolders));this.plugin=i}async getFonts(){let t=[];try{de.Platform.isMobile&&window?.Capacitor?.isPluginAvailable("App")?t=await window?.Capacitor?.Plugins.App?.getFonts()?.catch(n=>[]):t=await require("get-fonts").getFonts().catch(n=>[])}catch{}let i=new Set;for(let n of t)i.add(n);return[...i].sort()}async display(){let{containerEl:t}=this;t.empty(),t.addClass("dice-roller-settings"),t.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"})),this.buildDiceModTemplateFoldersSettings(this.contentEl.createEl("details",{cls:"dice-roller-nested-settings"})),t.createDiv("coffee").createEl("a",{href:"https://www.buymeacoffee.com/valentine195"}).createEl("img",{attr:{src:"https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=\u2615&slug=valentine195&button_colour=e3e7ef&font_colour=262626&font_family=Inter&outline_colour=262626&coffee_colour=ff0000"}})}buildGenerics(t){t.empty(),new de.Setting(t).setName("Globally Save Results").setDesc(createFragment(i=>{i.createSpan({text:"Dice results will be saved by default. This can be overridden using "}),i.createEl("code",{text:"dice-: formula"}),i.createEl("p",{text:"Please note that the plugin will attempt to save the result but may not be able to."})})).addToggle(i=>{i.setValue(this.plugin.data.persistResults),i.onChange(async n=>{this.plugin.data.persistResults=n,await this.plugin.saveSettings()})})}#e(t,i){let n=t.createEl("summary");new de.Setting(n).setHeading().setName(i),(0,de.setIcon)(n.createDiv("collapser").createDiv("handle"),"chevron-right")}buildDisplay(t){t.empty(),this.#e(t,"Dice Display"),new de.Setting(t).setName("Display Formula With Results").setDesc("Both the formula and the results will both be displayed in preview mode.").addToggle(i=>{i.setValue(this.plugin.data.displayResultsInline),i.onChange(async n=>{this.plugin.data.displayResultsInline=n,await this.plugin.saveSettings()})}),new de.Setting(t).setName("Display Dice Button With Results").setDesc("A dice button will appear next to results.").addToggle(i=>{i.setValue(this.plugin.data.showDice),i.onChange(async n=>{this.plugin.data.showDice=n,await this.plugin.saveSettings()})}),new de.Setting(t).setName("Display Formula in Parentheses After").setDesc(createFragment(i=>{i.createSpan({text:"For example, "}),i.createEl("code",{text:"`dice: 1d6`"}),i.createSpan({text:" will become "});let n=i.createSpan("dice-roller");n.createSpan({cls:"dice-roller-result",text:"3"}),(0,de.setIcon)(n.createSpan("dice-roller-button"),M1),i.createSpan({text:" (1d6). This only affects Dice Rollers."})})).addToggle(i=>{i.setValue(this.plugin.data.displayFormulaAfter),i.onChange(async n=>{this.plugin.data.displayFormulaAfter=n,await this.plugin.saveSettings()})})}buildDice(t){t.empty(),this.#e(t,"Dice Rollers"),new de.Setting(t).setName("Default Face").setDesc("Use this as the number of faces when it is omitted.").addText(i=>{i.setValue(`${this.plugin.data.defaultFace}`),i.inputEl.onblur=async()=>{isNaN(Number(i.inputEl.value))&&new de.Notice("The default face must be a number."),this.plugin.data.defaultFace=Number(i.inputEl.value),this.plugin.parser.setDefaultFace(this.plugin.data.defaultFace),await this.plugin.saveSettings()}}),new de.Setting(t).setName("Round Results").setDesc("Determine the rounding behavior for dice results.").addDropdown(i=>{i.addOptions(ln).setValue(this.plugin.data.round).onChange(n=>{this.plugin.data.round=n,this.plugin.saveSettings()})}),new de.Setting(t).setName("Auto Roll dice").setDesc("On initial display, should dice be rolled or displayed empty.").addDropdown(i=>{i.addOption("None","Empty").addOption("Roll","Rolled").setValue(this.plugin.data.initialDisplay).onChange(n=>{this.plugin.data.initialDisplay=n,this.plugin.saveSettings()})}),new de.Setting(t).setName("Show Signed Results").setDesc("Positive results will show a '+'. This setting has no effect on negative results.").addToggle(i=>{i.setValue(this.plugin.data.signed).onChange(n=>{this.plugin.data.signed=n,this.plugin.saveSettings()})}),new de.Setting(t).setName("Always Render Dice").setDesc(createFragment(i=>{i.createSpan({text:"Dice rolled in notes will always be rendered. Use the "}),i.createEl("code",{text:"|norender"}),i.createSpan({text:" flag to prevent it."})})).addToggle(i=>{i.setValue(this.plugin.data.renderAllDice).onChange(n=>{this.plugin.data.renderAllDice=n,this.plugin.saveSettings()})}),new de.Setting(t).setName("Log Rolls to Dice Tray").setDesc(createFragment(i=>{i.createSpan({text:"Dice rolled in notes will be added to the Dice Tray's Results section."})})).addToggle(i=>{i.setValue(this.plugin.data.addToView).onChange(n=>{this.plugin.data.addToView=n,this.plugin.saveSettings()})})}buildTables(t){t.empty(),this.#e(t,"Table Rollers"),new de.Setting(t).setName("Display Lookup Table Roll").setDesc("Lookup table rolls will display the rolled number along with the result.").addToggle(i=>{i.setValue(this.plugin.data.displayLookupRoll),i.onChange(async n=>{this.plugin.data.displayLookupRoll=n,await this.plugin.saveSettings()})})}buildSections(t){t.empty(),this.#e(t,"Section Rollers"),new de.Setting(t).setName("Add Copy Button to Section Results").setDesc("Randomly rolled sections will have a copy-content button to easy add result to clipboard.").addToggle(i=>{i.setValue(this.plugin.data.copyContentButton),i.onChange(async n=>{this.plugin.data.copyContentButton=n,await this.plugin.saveSettings()})}),new de.Setting(t).setName("Display As Embeds").setDesc("Sections returned from Section & Tag Rollers will display as embedded fields.").addToggle(i=>{i.setValue(this.plugin.data.displayAsEmbed),i.onChange(async n=>{this.plugin.data.displayAsEmbed=n,await this.plugin.saveSettings()})})}buildTags(t){t.empty(),this.#e(t,"Tag Rollers"),new de.Setting(t).setName("Always Return Links for Tags").setDesc("Enables random link rolling with the link parameter. Override by specifying a section type.").addToggle(i=>{i.setValue(this.plugin.data.rollLinksForTags),i.onChange(async n=>{this.plugin.data.rollLinksForTags=n,await this.plugin.saveSettings()})})}buildView(t){t.empty(),this.#e(t,"Dice Tray"),new de.Setting(t).setName("Open Dice Tray on Startup").setDesc("The dice view can always be opened using the command from the command palette.").addToggle(i=>{i.setValue(this.plugin.data.showLeafOnStartup),i.onChange(async n=>{this.plugin.data.showLeafOnStartup=n,await this.plugin.saveSettings()})}),new de.Setting(t).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=t.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 i=this.iconsEl.createDiv("existing-buttons has-table").createDiv("buttons-table");for(let h=0;h<this.plugin.data.icons.length;h++){let u=i.createDiv("icons-table-row");this.buildStaticIcon(u,h)}let n=i.createDiv("icons-table-row add-new"),r={text:null,formula:null,shape:"None",id:(0,hl.generateSlug)()},s=n.createDiv("shape"),o=n.createDiv("formula");new de.TextComponent(o).setPlaceholder("Formula").onChange(h=>{r.formula=h,c.setDisabled(r.text?.length===0||r.formula?.length===0)}),new de.TextComponent(o).setPlaceholder("Display").onChange(h=>{r.text=h,c.setDisabled(r.text?.length===0||r.formula?.length===0)});let c=new de.ExtraButtonComponent(n.createDiv("actions")).setIcon("plus-with-circle").setDisabled(!0).onClick(async()=>{!r.text||!r.formula||(this.plugin.data.icons.push({...r}),this.buildIcons(),await this.plugin.view.buildButtons(),await this.plugin.saveSettings())}),l=new de.DropdownComponent(s);for(let[h,u]of Object.entries(Ca))l.addOption(u,u);l.setValue(r.shape).onChange(h=>{r.shape=l.getValue()}),r.shape=l.getValue()}buildStaticIcon(t,i){t.empty(),t.removeClass("add-new");let n=this.plugin.data.icons[i],r=t.createDiv("shape dice-button");Aa.registerIcon(n.id,n.shape,n.text),(0,de.setIcon)(r,n.id),t.createDiv({cls:"formula",text:n.formula});let s=t.createDiv("actions");new de.ExtraButtonComponent(s).setIcon("edit").onClick(()=>{this.buildEditIcon(t,i,n)}),new de.ExtraButtonComponent(s).setIcon("trash").onClick(async()=>{this.plugin.data.icons.splice(i,1),await this.plugin.view.buildButtons(),this.buildIcons()})}buildEditIcon(t,i,n){t.empty(),t.addClass("add-new");let r={text:n.text,formula:n.formula,shape:n.shape,id:n.id},s=t.createDiv("shape"),o=t.createDiv("formula");new de.TextComponent(o).setPlaceholder("Formula").setValue(r.formula).onChange(u=>{r.formula=u,l.setDisabled(r.text.length===0||r.formula.length===0)}),new de.TextComponent(o).setPlaceholder("Display").setValue(r.text).onChange(u=>{r.text=u,l.setDisabled(r.text.length===0||r.formula.length===0)});let c=t.createDiv("actions"),l=new de.ExtraButtonComponent(c).setIcon("checkmark").setDisabled(r.text.length===0||r.formula.length===0).onClick(async()=>{!r.text||!r.formula||(this.plugin.data.icons.splice(i,1,{...r}),await this.plugin.saveSettings(),this.buildStaticIcon(t,i),await this.plugin.view.buildButtons())});new de.ExtraButtonComponent(c).setIcon("cross").onClick(()=>{this.buildStaticIcon(t,i)});let h=new de.DropdownComponent(s);for(let[u,f]of Object.entries(Ca))h.addOption(f,f);h.setValue(r.shape).onChange(u=>{r.shape=u})}buildRender(t){t.empty(),this.#e(t,"Graphical Dice"),new de.Setting(t).setName("Display graphics for Dice Tray Rolls").setDesc("Dice rolls from dice view will be displayed on screen.").addToggle(r=>{r.setValue(this.plugin.data.renderer),r.onChange(async s=>{this.plugin.data.renderer=s,await this.plugin.saveSettings()})}),new de.Setting(t).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(r=>{r.inputEl.setAttr("type","number"),r.inputEl.onblur=s=>{Number(r.getValue())<0&&(new de.Notice("Render time cannot be less than 0."),r.setValue("0"))},r.setValue(`${this.plugin.data.renderTime}`),r.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(r=>{r.setIcon("reset").setTooltip("Reset to Default").onClick(async()=>{this.plugin.data.renderTime=Fa.renderTime,await this.plugin.saveSettings(),this.buildRender(t)})}),new de.Setting(t).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(r=>{r.setValue(this.plugin.data.colorfulDice),r.onChange(async s=>{this.plugin.data.colorfulDice=s,this.plugin.renderer.setData(this.plugin.getRendererData()),await this.plugin.saveSettings()})}),new de.Setting(t).setName("Adjust Dice Scale").setDesc("Control the size of rendered dice.").addSlider(r=>{r.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 de.Setting(t).setName("Font for dice").setDesc("Select the font to use for the dice").addText(async r=>{let s=async()=>{this.plugin.data.textFont=r.getValue(),await this.plugin.saveSettings(),this.plugin.renderer.setData(this.plugin.getRendererData())},o=new Ra(this.app,r,await this.getFonts());o.onClose=()=>{r.setValue(o.item),s()},r.setValue(this.plugin.data.textFont),r.inputEl.onblur=async()=>{s()}}),new de.Setting(t).setName("Dice Base Color").setDesc("Rendered dice will be this color.").controlEl.createEl("input",{type:"color",value:this.plugin.data.diceColor},r=>{r.value=this.plugin.data.diceColor,r.onchange=async({target:s})=>{let o=s.value;this.plugin.data.diceColor=o,this.plugin.renderer.setData(this.plugin.getRendererData()),await this.plugin.saveSettings()}}),new de.Setting(t).setName("Dice Text Color").setDesc("Rendered dice will use this color for their numbers.").controlEl.createEl("input",{type:"color",value:this.plugin.data.textColor},r=>{r.value=this.plugin.data.textColor,r.onchange=async({target:s})=>{let o=s.value;o&&(this.plugin.data.textColor=o,this.plugin.renderer.setData(this.plugin.getRendererData()),await this.plugin.saveSettings())}}),new de.Setting(t).setName("Show Notice for Results").setDesc(createFragment(r=>{r.createSpan({text:"A notice will be displayed for each rendered dice roll."}),r.createEl("br"),r.createSpan({text:"Changing this setting will not effect any existing dice rollers in opened notes."})})).addToggle(r=>{r.setValue(this.plugin.data.showRenderNotice).onChange(async s=>{this.plugin.data.showRenderNotice=s,await this.plugin.saveSettings()})})}buildFormulaSettings(t){t.empty(),this.#e(t,"Saved Formulas");let i=t.createDiv("dice-roller-setting-additional-container"),n=i.createDiv();new de.Setting(n).setName("Add Formula").setDesc("Add a new formula shortcut.").addButton(o=>o.setTooltip("Add Formula").setButtonText("+").onClick(async()=>{let l=await this.buildFormulaForm(n);l&&(this.plugin.data.formulas[l.alias]=l.formula,this.buildFormulaSettings(t),await this.plugin.saveSettings())}));let r=i.createDiv("additional"),s=this.plugin.data.formulas;for(let[o,c]of Object.entries(s)){let l=new de.Setting(r).setName(o);l.controlEl.createSpan({text:c}),l.addExtraButton(h=>h.setIcon("pencil").setTooltip("Edit").onClick(async()=>{let u=await this.buildFormulaForm(n,{alias:o,formula:c});u&&(delete this.plugin.data.formulas[o],this.plugin.data.formulas[u.alias]=u.formula,this.buildFormulaSettings(t),await this.plugin.saveSettings())})).addExtraButton(h=>h.setIcon("trash").setTooltip("Delete").onClick(async()=>{delete this.plugin.data.formulas[o],await this.plugin.saveSettings(),this.buildFormulaSettings(t)}))}Object.values(s).length||r.createSpan({text:"Create a formula to see it here!",cls:"no-formulas"})}async buildFormulaForm(t,i={alias:null,formula:null}){return new Promise(n=>{let r=t.createDiv("add-new-formula"),s=r.createDiv("formula-data");new de.Setting(s).setName("Alias").addText(c=>{c.setValue(i.alias).onChange(l=>i.alias=l)}),new de.Setting(s).setName("Formula").addText(c=>{c.setValue(i.formula).onChange(l=>i.formula=l)});let o=r.createDiv("formula-buttons");new de.Setting(o).addButton(c=>c.setCta().setButtonText("Save").onClick(async()=>{r.detach(),n(i)})).addExtraButton(c=>c.setIcon("cross").setTooltip("Cancel").onClick(()=>{r.detach(),n(null)}))})}#t;buildDiceModTemplateFoldersSettings(t){t.empty(),this.#e(t,"Modify Dice"),new de.Setting(t).setName(createFragment(i=>{i.createSpan({text:"Apply "}),i.createEl("code",{text:"dice-mod"}),i.createSpan({text:" in live-preview"})})).setDesc(createFragment(i=>{i.createSpan({text:"If not enabled "}),i.createEl("code",{text:"dice-mod"}),i.createSpan({text:" will only be applied/replaced in read mode."})})).addToggle(i=>{i.setValue(this.plugin.data.replaceDiceModInLivePreview),i.onChange(async n=>{this.plugin.data.replaceDiceModInLivePreview=n,await this.plugin.saveSettings()})}),new de.Setting(t).setName("Escape Markdown When Modifying").setDesc(createFragment(i=>{i.createSpan({text:"Markdown characters will be escaped when using "}),i.createEl("code",{text:"dice-mod"}),i.createSpan({text:"."})})).addToggle(i=>{i.setValue(this.plugin.data.escapeDiceMod),i.onChange(async n=>{this.plugin.data.escapeDiceMod=n,await this.plugin.saveSettings()})}),new de.Setting(t).setName("Add Formula When Using Modify Dice").setDesc(createFragment(i=>{i.createSpan({text:"Both the formula and the results will both be added to the note when using "}),i.createEl("code",{text:"dice-mod"}),i.createSpan({text:"."})})).addToggle(i=>{i.setValue(this.plugin.data.displayFormulaForMod),i.onChange(async n=>{this.plugin.data.displayFormulaForMod=n,await this.plugin.saveSettings()})}),this.pathsEl=t.createDiv("template-paths dice-roller-setting-additional-container"),this.buildPaths()}buildPaths(){if(this.#t){this.folders=this.allFolders.filter(n=>!(n.path in this.plugin.data.diceModTemplateFolders));let i=Object.entries(this.plugin.data.diceModTemplateFolders);i.sort((n,r)=>n[0].localeCompare(r[0])),this.plugin.data.diceModTemplateFolders=Object.fromEntries(i),this.#t=!1}this.pathsEl.empty(),new de.Setting(this.pathsEl).setName("Template Folders").setDesc(createFragment(i=>{i.createSpan({text:"Define folders where "}),i.createEl("code",{text:"dice-mod"}),i.createSpan({text:" is not applied/replaced and can be used in templates."})})).setHeading();let t=this.pathsEl.createDiv("additional");for(let i in this.plugin.data.diceModTemplateFolders)this.buildStaticPath(t.createDiv(),i);this.buildEditPath(t.createDiv())}buildStaticPath(t,i){t.empty();let n=this.plugin.data.diceModTemplateFolders[i],r=new de.Setting(t).setName(i);n&&r.setDesc("(incl. subfolders)"),r.addExtraButton(s=>s.setIcon("wrench").onClick(()=>{this.buildEditPath(t,i)})).addExtraButton(s=>s.setIcon("trash").onClick(async()=>{delete this.plugin.data.diceModTemplateFolders[i],await this.plugin.saveSettings(),this.#t=!0,this.buildPaths()}))}buildEditPath(t,i){t.empty();let n={folder:i,useSubfolders:this.plugin.data.diceModTemplateFolders[i]??!0},r=t.createDiv("template-edit setting-item"),s=r.createDiv("template-input"),o=s.createDiv("folder-input"),c=new de.ExtraButtonComponent(s).setTooltip("Include Subfolders").onClick(()=>{n.useSubfolders=!n.useSubfolders,n.useSubfolders?c.setIcon("folder-tree"):c.setIcon("folder-closed")});this.plugin.data.diceModTemplateFolders[i]??!0?c.setIcon("folder-tree"):c.setIcon("folder-closed");let l=r.createDiv("actions");i||new de.ExtraButtonComponent(l).extraSettingsEl.setAttr("style","visibility: hidden;");let h=new de.ExtraButtonComponent(l).setIcon(i?"check":"plus-with-circle").setDisabled(!i).onClick(async()=>{this.plugin.data.diceModTemplateFolders[n.folder]=n.useSubfolders,await this.plugin.saveSettings(),n.folder!=i?(this.#t=!0,this.buildPaths()):this.buildStaticPath(t,i)});i&&new de.ExtraButtonComponent(l).setIcon("cross").onClick(()=>this.buildStaticPath(t,i)),this.buildPathInput(o,h,u=>{n.folder=u},i)}buildPathInput(t,i,n,r="Folder"){let s=l=>{if(!l||!l.length||l in this.plugin.data.diceModTemplateFolders)return i.setDisabled(!0),!1;i.setDisabled(!1),n((0,de.normalizePath)(l))},o=new de.TextComponent(t).setPlaceholder(r).onChange(l=>{s(l)}),c=new Na(this.app,o,[...this.folders]);c.onClose=async()=>{let l=o.inputEl.value?.trim()?o.inputEl.value.trim():"/";s(l)}}};var et=require("obsidian");var u2=class a{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)??a.RollerOptions(this.plugin);return this.plugin.getRollerSync(e,t,i)}async getRoller(e,t){let i=this.sources.get(t)??a.RollerOptions(this.plugin);return this.plugin.getRoller(e,t,i)}getRollerString(e,t){if(!t)return e;let i=this.sources.get(t)??a.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=="Average"&&(e+="|avg"),i.expectedValue=="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"Down":{e+="|floor";break}case"Up":{e+="|ceil";break}case"Normal":{e+="|round";break}case"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 Fi="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 xn=class extends et.ItemView{constructor(t,i){super(i);this.plugin=t;this.leaf=i;this.custom="";this.#e=!1;this.#t=!1;this.#i=0;this.#n=Aa;this.#r=new Map;this.contentEl.addClass("dice-roller-view"),this.addChild(this.#n)}get customFormulas(){return this.plugin.data.customFormulas}#e;#t;#i;#n;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 t=this.contentEl.createDiv("dice-roller-results-container"),i=t.createDiv("dice-roller-results-header");i.createEl("h4",{text:"Results"}),new et.ExtraButtonComponent(i.createDiv("clear-all")).setIcon("trash").setTooltip("Clear All").onClick(()=>{this.resultEl.empty(),this.resultEl.append(this.noResultsEl)}),this.resultEl=t.createDiv("dice-roller-results"),this.noResultsEl=this.resultEl.createSpan({text:"No results yet! Roll some dice to get started :)"}),this.buildButtons(),this.buildFormula()}#r;buildButtons(){this.gridEl.empty();let t=this.gridEl.createDiv("dice-buttons");for(let s of this.plugin.data.icons)this.#n.registerIcon(s.id,s.shape,s.text),new et.ExtraButtonComponent(t.createDiv("dice-button")).setIcon(s.id).extraSettingsEl.onClickEvent(o=>{if(o.type==="auxclick"){this.roll(s.formula);return}this.#r.has(s)||this.#r.set(s,0);let c=this.#r.get(s);c+=o.getModifierState("Shift")?-1:1,this.#r.set(s,c),this.setFormula()});let i=this.gridEl.createDiv("advantage-disadvantage");new et.ExtraButtonComponent(i).setIcon("dice-roller-minus").onClick(()=>{this.#i-=1,this.setFormula()});let n=new et.ButtonComponent(i).setButtonText("ADV").onClick(()=>{this.#e=!this.#e,this.#t=!1,this.#e?(n.setCta(),r.removeCta()):n.removeCta(),this.setFormula()}),r=new et.ButtonComponent(i).setButtonText("DIS").onClick(()=>{this.#t=!this.#t,this.#e=!1,this.#t?(r.setCta(),n.removeCta()):r.removeCta(),this.setFormula()});if(new et.ExtraButtonComponent(i).setIcon("dice-roller-plus").onClick(()=>{this.#i+=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 c of this.customFormulas){let l=s.createDiv("dice-custom-formula-container"),h=l.createDiv("dice-custom-formula");new et.ExtraButtonComponent(h).setIcon(M1).setTooltip("Roll").onClick(()=>this.roll(c)),h.createSpan({text:c}),new et.ExtraButtonComponent(l).setIcon("trash").setTooltip("Remove").onClick(()=>{this.plugin.data.customFormulas=this.plugin.data.customFormulas.filter(u=>u!=c),this.plugin.saveSettings(),this.buildButtons()})}}}setFormula(){if(!this.#r.size&&!this.#i){this.formulaComponent.inputEl.value="";return}let t=[];for(let[n,r]of this.#r){if(!r)continue;let s=r<0?"-":"+",o=/^(?:1)?d(\d|%|F)+$/.test(n.formula)?`${Math.abs(r)}${n.formula.replace(/^1/,"")}`:`${Math.abs(r)} * (${n.formula})`,c=this.plugin.getRollerSync(n.formula,"view");c instanceof Gt&&(c.buildDiceTree(),c.calculate(),t.push({formula:o,max:c.max,sign:s}))}t.sort((n,r)=>r.max-n.max);let i=[];for(let n=0;n<t.length;n++){let r=t[n];n===0&&r.sign==="-"?r.formula=`${r.sign}${r.formula}`:n>0&&i.push(r.sign);let s="";n===0&&(this.#e?s="kh":this.#t&&(s="kl"),r.formula=r.formula.replace(/(d\d+)/,`$1${s}`)),i.push(`${r.formula}`)}this.#i!==0&&(i.length>0&&i.push(this.#i>0?"+":"-"),i.push(`${Math.abs(this.#i)}`)),this.formulaComponent.inputEl.value=i.join(" ")}async roll(t=this.formulaComponent.inputEl.value){if(!t)return;this.rollButton.setDisabled(!0);let i={...u2.RollerOptions(this.plugin)};i.expectedValue=="None"&&(i.expectedValue="Roll");try{let n=await this.plugin.getRoller(t,"view",i).catch(r=>{throw r});if(!(n instanceof Gt))throw new Error("The Dice Tray only supports dice rolls.");if(n.iconEl.detach(),n.containerEl.onclick=null,n.buildDiceTree(),!n.dice.length)throw new Error("No dice.");await n.roll(this.plugin.data.renderer).catch(r=>{throw r}),this.addResult(n)}catch(n){new et.Notice("Invalid Formula: "+n.message)}finally{this.rollButton.setDisabled(!1),this.buildButtons(),this.#r=new Map,this.#i=0,this.setFormula()}}buildFormula(){this.formulaEl.empty(),this.formulaComponent=new et.TextAreaComponent(this.formulaEl).setPlaceholder("Dice Formula");let t=this.formulaEl.createDiv("action-buttons");this.saveButton=new et.ExtraButtonComponent(t).setIcon("plus-with-circle").setTooltip("Save Formula").onClick(()=>this.save()),this.saveButton.extraSettingsEl.addClass("dice-roller-roll"),this.rollButton=new et.ButtonComponent(t).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(t){this.noResultsEl&&this.noResultsEl.detach();let i=createDiv("view-result");i.createSpan({text:t.original}),i.createEl("strong",{attr:{"aria-label":t.resultText}}).appendChild(t.containerEl.cloneNode(!0));let n=i.createDiv("result-context");n.createEl("em",{text:new Date().toLocaleString()}),new et.ExtraButtonComponent(n).setIcon("trash").onClick(()=>{i.detach(),this.resultEl.children.length===0&&this.resultEl.prepend(this.noResultsEl)}),new et.ExtraButtonComponent(n).setIcon(U1).setTooltip("Copy Result").onClick(async()=>{await navigator.clipboard.writeText(`${t.result}`)}).extraSettingsEl.addClass("dice-content-copy"),new et.ExtraButtonComponent(n).setIcon(M1).setTooltip("Roll Again").onClick(()=>this.roll(t.original)).extraSettingsEl.addClass("dice-result-reroll"),this.resultEl.prepend(i)}getDisplayText(){return"Dice Tray"}getViewType(){return Fi}getIcon(){return M1}async onClose(){await super.onClose()}};var an=require("obsidian");var Z1=class a{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 z){let t=this.elements;return e.x=t[0],e.y=t[4],e.z=t[8],e}vmult(e,t=new z){let i=this.elements,n=e.x,r=e.y,s=e.z;return t.x=i[0]*n+i[1]*r+i[2]*s,t.y=i[3]*n+i[4]*r+i[5]*s,t.z=i[6]*n+i[7]*r+i[8]*s,t}smult(e){for(let t=0;t<this.elements.length;t++)this.elements[t]*=e}mmult(e,t=new a){let i=this.elements,n=e.elements,r=t.elements,s=i[0],o=i[1],c=i[2],l=i[3],h=i[4],u=i[5],f=i[6],d=i[7],p=i[8],v=n[0],x=n[1],g=n[2],m=n[3],M=n[4],y=n[5],b=n[6],C=n[7],_=n[8];return r[0]=s*v+o*m+c*b,r[1]=s*x+o*M+c*C,r[2]=s*g+o*y+c*_,r[3]=l*v+h*m+u*b,r[4]=l*x+h*M+u*C,r[5]=l*g+h*y+u*_,r[6]=f*v+d*m+p*b,r[7]=f*x+d*M+p*C,r[8]=f*g+d*y+p*_,t}scale(e,t=new a){let i=this.elements,n=t.elements;for(let r=0;r!==3;r++)n[3*r+0]=e.x*i[3*r+0],n[3*r+1]=e.y*i[3*r+1],n[3*r+2]=e.z*i[3*r+2];return t}solve(e,t=new z){let r=[],s,o;for(s=0;s<3*4;s++)r.push(0);for(s=0;s<3;s++)for(o=0;o<3;o++)r[s+4*o]=this.elements[s+3*o];r[3+4*0]=e.x,r[3+4*1]=e.y,r[3+4*2]=e.z;let c=3,l=c,h,u=4,f;do{if(s=l-c,r[s+4*s]===0){for(o=s+1;o<l;o++)if(r[s+4*o]!==0){h=u;do f=u-h,r[f+4*s]+=r[f+4*o];while(--h);break}}if(r[s+4*s]!==0)for(o=s+1;o<l;o++){let d=r[s+4*o]/r[s+4*s];h=u;do f=u-h,r[f+4*o]=f<=s?0:r[f+4*o]-r[f+4*s]*d;while(--h)}}while(--c);if(t.z=r[2*4+3]/r[2*4+2],t.y=(r[1*4+3]-r[1*4+2]*t.z)/r[1*4+1],t.x=(r[0*4+3]-r[0*4+2]*t.z-r[0*4+1]*t.y)/r[0*4+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 a){let n=$9,r,s;for(r=0;r<3;r++)for(s=0;s<3;s++)n[r+6*s]=this.elements[r+3*s];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 o=3,c=o,l,h=6,u;do{if(r=c-o,n[r+6*r]===0){for(s=r+1;s<c;s++)if(n[r+6*s]!==0){l=h;do u=h-l,n[u+6*r]+=n[u+6*s];while(--l);break}}if(n[r+6*r]!==0)for(s=r+1;s<c;s++){let f=n[r+6*s]/n[r+6*r];l=h;do u=h-l,n[u+6*s]=u<=r?0:n[u+6*s]-n[u+6*r]*f;while(--l)}}while(--o);r=2;do{s=r-1;do{let f=n[r+6*s]/n[r+6*r];l=6;do u=6-l,n[u+6*s]=n[u+6*s]-n[u+6*r]*f;while(--l)}while(s--)}while(--r);r=2;do{let f=1/n[r+6*r];l=6;do u=6-l,n[u+6*r]=n[u+6*r]*f;while(--l)}while(r--);r=2;do{s=2;do{if(u=n[3+s+6*r],isNaN(u)||u===1/0)throw"Could not reverse! A=["+this.toString()+"]";e.e(r,s,u)}while(s--)}while(r--);return e}setRotationFromQuaternion(e){let t=e.x,i=e.y,n=e.z,r=e.w,s=t+t,o=i+i,c=n+n,l=t*s,h=t*o,u=t*c,f=i*o,d=i*c,p=n*c,v=r*s,x=r*o,g=r*c,m=this.elements;return m[3*0+0]=1-(f+p),m[3*0+1]=h-g,m[3*0+2]=u+x,m[3*1+0]=h+g,m[3*1+1]=1-(l+p),m[3*1+2]=d-v,m[3*2+0]=u-x,m[3*2+1]=d+v,m[3*2+2]=1-(l+f),this}transpose(e=new a){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}},$9=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],z=class a{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 a){let i=e.x,n=e.y,r=e.z,s=this.x,o=this.y,c=this.z;return t.x=o*r-c*n,t.y=c*i-s*r,t.z=s*n-o*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 a(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 a(this.x-e.x,this.y-e.y,this.z-e.z)}crossmat(){return new Z1([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 r=1/n;this.x*=r,this.y*=r,this.z*=r}else this.x=0,this.y=0,this.z=0;return n}unit(e=new a){let t=this.x,i=this.y,n=this.z,r=Math.sqrt(t*t+i*i+n*n);return r>0?(r=1/r,e.x=t*r,e.y=i*r,e.z=n*r):(e.x=1,e.y=0,e.z=0),e}length(){let e=this.x,t=this.y,i=this.z;return Math.sqrt(e*e+t*t+i*i)}lengthSquared(){return this.dot(this)}distanceTo(e){let t=this.x,i=this.y,n=this.z,r=e.x,s=e.y,o=e.z;return Math.sqrt((r-t)*(r-t)+(s-i)*(s-i)+(o-n)*(o-n))}distanceSquared(e){let t=this.x,i=this.y,n=this.z,r=e.x,s=e.y,o=e.z;return(r-t)*(r-t)+(s-i)*(s-i)+(o-n)*(o-n)}scale(e,t=new a){let i=this.x,n=this.y,r=this.z;return t.x=e*i,t.y=e*n,t.z=e*r,t}vmul(e,t=new a){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 a){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 a){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=J9,r=1/i;n.set(this.x*r,this.y*r,this.z*r);let s=Q9;Math.abs(n.x)<.9?(s.set(1,0,0),n.cross(s,e)):(s.set(0,1,0),n.cross(s,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,r=this.y,s=this.z;i.x=n+(e.x-n)*t,i.y=r+(e.y-r)*t,i.z=s+(e.z-s)*t}almostEquals(e,t=1e-6){return!(Math.abs(this.x-e.x)>t||Math.abs(this.y-e.y)>t||Math.abs(this.z-e.z)>t)}almostZero(e=1e-6){return!(Math.abs(this.x)>e||Math.abs(this.y)>e||Math.abs(this.z)>e)}isAntiparallelTo(e,t){return this.negate(ul),ul.almostEquals(e,t)}clone(){return new a(this.x,this.y,this.z)}};z.ZERO=void 0;z.UNIT_X=void 0;z.UNIT_Y=void 0;z.UNIT_Z=void 0;z.ZERO=new z(0,0,0);z.UNIT_X=new z(1,0,0);z.UNIT_Y=new z(0,1,0);z.UNIT_Z=new z(0,0,1);var J9=new z,Q9=new z,ul=new z,r1=class a{constructor(e={}){this.lowerBound=void 0,this.upperBound=void 0,this.lowerBound=new z,this.upperBound=new z,e.lowerBound&&this.lowerBound.copy(e.lowerBound),e.upperBound&&this.upperBound.copy(e.upperBound)}setFromPoints(e,t,i,n){let r=this.lowerBound,s=this.upperBound,o=i;r.copy(e[0]),o&&o.vmult(r,r),s.copy(r);for(let c=1;c<e.length;c++){let l=e[c];o&&(o.vmult(l,fl),l=fl),l.x>s.x&&(s.x=l.x),l.x<r.x&&(r.x=l.x),l.y>s.y&&(s.y=l.y),l.y<r.y&&(r.y=l.y),l.z>s.z&&(s.z=l.z),l.z<r.z&&(r.z=l.z)}return t&&(t.vadd(r,r),t.vadd(s,s)),n&&(r.x-=n,r.y-=n,r.z-=n,s.x+=n,s.y+=n,s.z+=n),this}copy(e){return this.lowerBound.copy(e.lowerBound),this.upperBound.copy(e.upperBound),this}clone(){return new a().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,r=e.upperBound,s=n.x<=i.x&&i.x<=r.x||t.x<=r.x&&r.x<=i.x,o=n.y<=i.y&&i.y<=r.y||t.y<=r.y&&r.y<=i.y,c=n.z<=i.z&&i.z<=r.z||t.z<=r.z&&r.z<=i.z;return s&&o&&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,r=e.upperBound;return t.x<=n.x&&i.x>=r.x&&t.y<=n.y&&i.y>=r.y&&t.z<=n.z&&i.z>=r.z}getCorners(e,t,i,n,r,s,o,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),r.set(h.x,l.y,h.z),s.set(l.x,h.y,l.z),o.set(l.x,l.y,h.z),c.copy(h)}toLocalFrame(e,t){let i=dl,n=i[0],r=i[1],s=i[2],o=i[3],c=i[4],l=i[5],h=i[6],u=i[7];this.getCorners(n,r,s,o,c,l,h,u);for(let f=0;f!==8;f++){let d=i[f];e.pointToLocal(d,d)}return t.setFromPoints(i)}toWorldFrame(e,t){let i=dl,n=i[0],r=i[1],s=i[2],o=i[3],c=i[4],l=i[5],h=i[6],u=i[7];this.getCorners(n,r,s,o,c,l,h,u);for(let f=0;f!==8;f++){let d=i[f];e.pointToWorld(d,d)}return t.setFromPoints(i)}overlapsRay(e){let{direction:t,from:i}=e,n=1/t.x,r=1/t.y,s=1/t.z,o=(this.lowerBound.x-i.x)*n,c=(this.upperBound.x-i.x)*n,l=(this.lowerBound.y-i.y)*r,h=(this.upperBound.y-i.y)*r,u=(this.lowerBound.z-i.z)*s,f=(this.upperBound.z-i.z)*s,d=Math.max(Math.max(Math.min(o,c),Math.min(l,h)),Math.min(u,f)),p=Math.min(Math.min(Math.max(o,c),Math.max(l,h)),Math.max(u,f));return!(p<0||d>p)}},fl=new z,dl=[new z,new z,new z,new z,new z,new z,new z,new z],Ua=class{constructor(){this.matrix=void 0,this.matrix=[]}get(e,t){let{index:i}=e,{index:n}=t;if(n>i){let r=n;n=i,i=r}return this.matrix[(i*(i+1)>>1)+n-1]}set(e,t,i){let{index:n}=e,{index:r}=t;if(r>n){let s=r;r=n,n=s}this.matrix[(n*(n+1)>>1)+r-1]=i?1:0}reset(){for(let e=0,t=this.matrix.length;e!==t;e++)this.matrix[e]=0}setNumObjects(e){this.matrix.length=e*(e-1)>>1}},qa=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,r=i.length;n<r;n++)i[n].call(this,e)}return this}},Mt=class a{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 z){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=K9,n=ef;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 a){let i=this.x,n=this.y,r=this.z,s=this.w,o=e.x,c=e.y,l=e.z,h=e.w;return t.x=i*h+s*o+n*l-r*c,t.y=n*h+s*c+r*o-i*l,t.z=r*h+s*l+i*c-n*o,t.w=s*h-i*o-n*c-r*l,t}inverse(e=new a){let t=this.x,i=this.y,n=this.z,r=this.w;this.conjugate(e);let s=1/(t*t+i*i+n*n+r*r);return e.x*=s,e.y*=s,e.z*=s,e.w*=s,e}conjugate(e=new a){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 z){let i=e.x,n=e.y,r=e.z,s=this.x,o=this.y,c=this.z,l=this.w,h=l*i+o*r-c*n,u=l*n+c*i-s*r,f=l*r+s*n-o*i,d=-s*i-o*n-c*r;return t.x=h*l+d*-s+u*-c-f*-o,t.y=u*l+d*-o+f*-s-h*-c,t.z=f*l+d*-c+h*-o-u*-s,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,r,s=this.x,o=this.y,c=this.z,l=this.w;switch(t){case"YZX":let h=s*o+c*l;if(h>.499&&(i=2*Math.atan2(s,l),n=Math.PI/2,r=0),h<-.499&&(i=-2*Math.atan2(s,l),n=-Math.PI/2,r=0),i===void 0){let u=s*s,f=o*o,d=c*c;i=Math.atan2(2*o*l-2*s*c,1-2*f-2*d),n=Math.asin(2*h),r=Math.atan2(2*s*l-2*o*c,1-2*u-2*d)}break;default:throw new Error("Euler order "+t+" not supported yet.")}e.y=i,e.z=n,e.x=r}setFromEuler(e,t,i,n="XYZ"){let r=Math.cos(e/2),s=Math.cos(t/2),o=Math.cos(i/2),c=Math.sin(e/2),l=Math.sin(t/2),h=Math.sin(i/2);return n==="XYZ"?(this.x=c*s*o+r*l*h,this.y=r*l*o-c*s*h,this.z=r*s*h+c*l*o,this.w=r*s*o-c*l*h):n==="YXZ"?(this.x=c*s*o+r*l*h,this.y=r*l*o-c*s*h,this.z=r*s*h-c*l*o,this.w=r*s*o+c*l*h):n==="ZXY"?(this.x=c*s*o-r*l*h,this.y=r*l*o+c*s*h,this.z=r*s*h+c*l*o,this.w=r*s*o-c*l*h):n==="ZYX"?(this.x=c*s*o-r*l*h,this.y=r*l*o+c*s*h,this.z=r*s*h-c*l*o,this.w=r*s*o+c*l*h):n==="YZX"?(this.x=c*s*o+r*l*h,this.y=r*l*o+c*s*h,this.z=r*s*h-c*l*o,this.w=r*s*o-c*l*h):n==="XZY"&&(this.x=c*s*o-r*l*h,this.y=r*l*o-c*s*h,this.z=r*s*h+c*l*o,this.w=r*s*o+c*l*h),this}clone(){return new a(this.x,this.y,this.z,this.w)}slerp(e,t,i=new a){let n=this.x,r=this.y,s=this.z,o=this.w,c=e.x,l=e.y,h=e.z,u=e.w,f,d,p,v,x;return d=n*c+r*l+s*h+o*u,d<0&&(d=-d,c=-c,l=-l,h=-h,u=-u),1-d>1e-6?(f=Math.acos(d),p=Math.sin(f),v=Math.sin((1-t)*f)/p,x=Math.sin(t*f)/p):(v=1-t,x=t),i.x=v*n+x*c,i.y=v*r+x*l,i.z=v*s+x*h,i.w=v*o+x*u,i}integrate(e,t,i,n=new a){let r=e.x*i.x,s=e.y*i.y,o=e.z*i.z,c=this.x,l=this.y,h=this.z,u=this.w,f=t*.5;return n.x+=f*(r*u+s*h-o*l),n.y+=f*(s*u+o*c-r*h),n.z+=f*(o*u+r*l-s*c),n.w+=f*(-r*c-s*l-o*h),n}},K9=new z,ef=new z,tf={SPHERE:1,PLANE:2,BOX:4,COMPOUND:8,CONVEXPOLYHEDRON:16,HEIGHTFIELD:32,PARTICLE:64,CYLINDER:128,TRIMESH:256},ge=class a{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=a.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}};ge.idCounter=0;ge.types=tf;var je=class a{constructor(e={}){this.position=void 0,this.quaternion=void 0,this.position=new z,this.quaternion=new Mt,e.position&&this.position.copy(e.position),e.quaternion&&this.quaternion.copy(e.quaternion)}pointToLocal(e,t){return a.pointToLocalFrame(this.position,this.quaternion,e,t)}pointToWorld(e,t){return a.pointToWorldFrame(this.position,this.quaternion,e,t)}vectorToWorldFrame(e,t=new z){return this.quaternion.vmult(e,t),t}static pointToLocalFrame(e,t,i,n=new z){return i.vsub(e,n),t.conjugate(pl),pl.vmult(n,n),n}static pointToWorldFrame(e,t,i,n=new z){return t.vmult(i,n),n.vadd(e,n),n}static vectorToWorldFrame(e,t,i=new z){return e.vmult(t,i),i}static vectorToLocalFrame(e,t,i,n=new z){return t.w*=-1,t.vmult(i,n),t.w*=-1,n}},pl=new Mt,Xr=class a extends ge{constructor(e={}){let{vertices:t=[],faces:i=[],normals:n=[],axes:r,boundingSphereRadius:s}=e;super({type:ge.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(),s?this.boundingSphereRadius=s:this.updateBoundingSphereRadius(),this.worldVertices=[],this.worldVerticesNeedsUpdate=!0,this.worldFaceNormals=[],this.worldFaceNormalsNeedsUpdate=!0,this.uniqueAxes=r?r.slice():null,this.uniqueEdges=[],this.computeEdges()}computeEdges(){let e=this.faces,t=this.vertices,i=this.uniqueEdges;i.length=0;let n=new z;for(let r=0;r!==e.length;r++){let s=e[r],o=s.length;for(let c=0;c!==o;c++){let l=(c+1)%o;t[s[c]].vsub(t[s[l]],n),n.normalize();let h=!1;for(let u=0;u!==i.length;u++)if(i[u].almostEquals(n)||i[u].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 z;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]],r=this.vertices[i[1]],s=this.vertices[i[2]];a.computeNormal(n,r,s,t)}static computeNormal(e,t,i,n){let r=new z,s=new z;t.vsub(e,s),i.vsub(t,r),r.cross(s,n),n.isZero()||n.normalize()}clipAgainstHull(e,t,i,n,r,s,o,c,l){let h=new z,u=-1,f=-Number.MAX_VALUE;for(let p=0;p<i.faces.length;p++){h.copy(i.faceNormals[p]),r.vmult(h,h);let v=h.dot(s);v>f&&(f=v,u=p)}let d=[];for(let p=0;p<i.faces[u].length;p++){let v=i.vertices[i.faces[u][p]],x=new z;x.copy(v),r.vmult(x,x),n.vadd(x,x),d.push(x)}u>=0&&this.clipFaceAgainstHull(s,e,t,d,o,c,l)}findSeparatingAxis(e,t,i,n,r,s,o,c){let l=new z,h=new z,u=new z,f=new z,d=new z,p=new z,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,r);if(m===!1)return!1;m<v&&(v=m,s.copy(l))}else{let g=o?o.length:x.faces.length;for(let m=0;m<g;m++){let M=o?o[m]:m;l.copy(x.faceNormals[M]),i.vmult(l,l);let y=x.testSepAxis(l,e,t,i,n,r);if(y===!1)return!1;y<v&&(v=y,s.copy(l))}}if(e.uniqueAxes)for(let g=0;g!==e.uniqueAxes.length;g++){r.vmult(e.uniqueAxes[g],h);let m=x.testSepAxis(h,e,t,i,n,r);if(m===!1)return!1;m<v&&(v=m,s.copy(h))}else{let g=c?c.length:e.faces.length;for(let m=0;m<g;m++){let M=c?c[m]:m;h.copy(e.faceNormals[M]),r.vmult(h,h);let y=x.testSepAxis(h,e,t,i,n,r);if(y===!1)return!1;y<v&&(v=y,s.copy(h))}}for(let g=0;g!==x.uniqueEdges.length;g++){i.vmult(x.uniqueEdges[g],f);for(let m=0;m!==e.uniqueEdges.length;m++)if(r.vmult(e.uniqueEdges[m],d),f.cross(d,p),!p.almostZero()){p.normalize();let M=x.testSepAxis(p,e,t,i,n,r);if(M===!1)return!1;M<v&&(v=M,s.copy(p))}}return n.vsub(t,u),u.dot(s)>0&&s.negate(s),!0}testSepAxis(e,t,i,n,r,s){let o=this;a.project(o,e,i,n,P0),a.project(t,e,r,s,I0);let c=P0[0],l=P0[1],h=I0[0],u=I0[1];if(c<u||h<l)return!1;let f=c-u,d=h-l;return f<d?f:d}calculateLocalInertia(e,t){let i=new z,n=new z;this.computeLocalAABB(n,i);let r=i.x-n.x,s=i.y-n.y,o=i.z-n.z;t.x=1/12*e*(2*s*2*s+2*o*2*o),t.y=1/12*e*(2*r*2*r+2*o*2*o),t.z=1/12*e*(2*s*2*s+2*r*2*r)}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,r,s,o){let c=new z,l=new z,h=new z,u=new z,f=new z,d=new z,p=new z,v=new z,x=this,g=[],m=n,M=g,y=-1,b=Number.MAX_VALUE;for(let H=0;H<x.faces.length;H++){c.copy(x.faceNormals[H]),i.vmult(c,c);let w=c.dot(e);w<b&&(b=w,y=H)}if(y<0)return;let C=x.faces[y];C.connectedFaces=[];for(let H=0;H<x.faces.length;H++)for(let w=0;w<x.faces[H].length;w++)C.indexOf(x.faces[H][w])!==-1&&H!==y&&C.connectedFaces.indexOf(H)===-1&&C.connectedFaces.push(H);let _=C.length;for(let H=0;H<_;H++){let w=x.vertices[C[H]],T=x.vertices[C[(H+1)%_]];w.vsub(T,l),h.copy(l),i.vmult(h,h),t.vadd(h,h),u.copy(this.faceNormals[y]),i.vmult(u,u),t.vadd(u,u),h.cross(u,f),f.negate(f),d.copy(w),i.vmult(d,d),t.vadd(d,d);let A=C.connectedFaces[H];p.copy(this.faceNormals[A]);let R=this.getPlaneConstantOfFace(A);v.copy(p),i.vmult(v,v);let V=R-v.dot(t);for(this.clipFaceAgainstPlane(m,M,v,V);m.length;)m.shift();for(;M.length;)m.push(M.shift())}p.copy(this.faceNormals[y]);let S=this.getPlaneConstantOfFace(y);v.copy(p),i.vmult(v,v);let P=S-v.dot(t);for(let H=0;H<m.length;H++){let w=v.dot(m[H])+P;if(w<=r&&(console.log("clamped: depth="+w+" to minDist="+r),w=r),w<=s){let T=m[H];if(w<=1e-6){let A={point:T,normal:v,depth:w};o.push(A)}}}}clipFaceAgainstPlane(e,t,i,n){let r,s,o=e.length;if(o<2)return t;let c=e[e.length-1],l=e[0];r=i.dot(c)+n;for(let h=0;h<o;h++){if(l=e[h],s=i.dot(l)+n,r<0)if(s<0){let u=new z;u.copy(l),t.push(u)}else{let u=new z;c.lerp(l,r/(r-s),u),t.push(u)}else if(s<0){let u=new z;c.lerp(l,r/(r-s),u),t.push(u),t.push(l)}c=l,r=s}return t}computeWorldVertices(e,t){for(;this.worldVertices.length<this.vertices.length;)this.worldVertices.push(new z);let i=this.vertices,n=this.worldVertices;for(let r=0;r!==this.vertices.length;r++)t.vmult(i[r],n[r]),e.vadd(n[r],n[r]);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 r=i[n];r.x<e.x?e.x=r.x:r.x>t.x&&(t.x=r.x),r.y<e.y?e.y=r.y:r.y>t.y&&(t.y=r.y),r.z<e.z?e.z=r.z:r.z>t.z&&(t.z=r.z)}}computeWorldFaceNormals(e){let t=this.faceNormals.length;for(;this.worldFaceNormals.length<t;)this.worldFaceNormals.push(new z);let i=this.faceNormals,n=this.worldFaceNormals;for(let r=0;r!==t;r++)e.vmult(i[r],n[r]);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 r=this.vertices,s,o,c,l,h,u,f=new z;for(let d=0;d<r.length;d++){f.copy(r[d]),t.vmult(f,f),e.vadd(f,f);let p=f;(s===void 0||p.x<s)&&(s=p.x),(l===void 0||p.x>l)&&(l=p.x),(o===void 0||p.y<o)&&(o=p.y),(h===void 0||p.y>h)&&(h=p.y),(c===void 0||p.z<c)&&(c=p.z),(u===void 0||p.z>u)&&(u=p.z)}i.set(s,o,c),n.set(l,h,u)}volume(){return 4*Math.PI*this.boundingSphereRadius/3}getAveragePointLocal(e=new z){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 r=0;r<i;r++){let s=n[r];t.vmult(s,s)}for(let r=0;r<this.faceNormals.length;r++){let s=this.faceNormals[r];t.vmult(s,s)}}if(e)for(let r=0;r<i;r++){let s=n[r];s.vadd(e,s)}}pointIsInside(e){let t=this.vertices,i=this.faces,n=this.faceNormals,r=new z;this.getAveragePointLocal(r);for(let s=0;s<this.faces.length;s++){let o=n[s],c=t[i[s][0]],l=new z;e.vsub(c,l);let h=o.dot(l),u=new z;r.vsub(c,u);let f=o.dot(u);if(h<0&&f>0||h>0&&f<0)return!1}return-1}static project(e,t,i,n,r){let s=e.vertices.length,o=nf,c=0,l=0,h=rf,u=e.vertices;h.setZero(),je.vectorToLocalFrame(i,n,t,o),je.pointToLocalFrame(i,n,h,h);let f=h.dot(o);l=c=u[0].dot(o);for(let d=1;d<s;d++){let p=u[d].dot(o);p>c&&(c=p),p<l&&(l=p)}if(l-=f,c-=f,l>c){let d=l;l=c,c=d}r[0]=c,r[1]=l}},P0=[],I0=[],nf=new z,rf=new z,q0=class a extends ge{constructor(e){super({type:ge.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=z,r=[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)],s=[[3,2,1,0],[4,5,6,7],[5,4,0,1],[2,3,7,6],[0,4,7,3],[1,2,6,5]],o=[new n(0,0,1),new n(0,1,0),new n(1,0,0)],c=new Xr({vertices:r,faces:s,axes:o});this.convexPolyhedronRepresentation=c,c.material=this.material}calculateLocalInertia(e,t=new z){return a.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 r=0;r!==i.length;r++)t.vmult(i[r],i[r]);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,r=[[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 s=0;s<r.length;s++)q2.set(r[s][0],r[s][1],r[s][2]),t.vmult(q2,q2),e.vadd(q2,q2),i(q2.x,q2.y,q2.z)}calculateWorldAABB(e,t,i,n){let r=this.halfExtents;G1[0].set(r.x,r.y,r.z),G1[1].set(-r.x,r.y,r.z),G1[2].set(-r.x,-r.y,r.z),G1[3].set(-r.x,-r.y,-r.z),G1[4].set(r.x,-r.y,-r.z),G1[5].set(r.x,r.y,-r.z),G1[6].set(-r.x,r.y,-r.z),G1[7].set(r.x,-r.y,r.z);let s=G1[0];t.vmult(s,s),e.vadd(s,s),n.copy(s),i.copy(s);for(let o=1;o<8;o++){let c=G1[o];t.vmult(c,c),e.vadd(c,c);let l=c.x,h=c.y,u=c.z;l>n.x&&(n.x=l),h>n.y&&(n.y=h),u>n.z&&(n.z=u),l<i.x&&(i.x=l),h<i.y&&(i.y=h),u<i.z&&(i.z=u)}}},q2=new z,G1=[new z,new z,new z,new z,new z,new z,new z,new z],K0={DYNAMIC:1,STATIC:2,KINEMATIC:4},e6={AWAKE:0,SLEEPY:1,SLEEPING:2},Te=class a extends qa{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=a.idCounter++,this.index=-1,this.world=null,this.preStep=null,this.postStep=null,this.vlambda=new z,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 z,this.previousPosition=new z,this.interpolatedPosition=new z,this.initPosition=new z,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 z,e.velocity&&this.velocity.copy(e.velocity),this.initVelocity=new z,this.force=new z;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?a.STATIC:a.DYNAMIC,typeof e.type==typeof a.STATIC&&(this.type=e.type),this.allowSleep=typeof e.allowSleep<"u"?e.allowSleep:!0,this.sleepState=a.AWAKE,this.sleepSpeedLimit=typeof e.sleepSpeedLimit<"u"?e.sleepSpeedLimit:.1,this.sleepTimeLimit=typeof e.sleepTimeLimit<"u"?e.sleepTimeLimit:1,this.timeLastSleepy=0,this.wakeUpAfterNarrowphase=!1,this.torque=new z,this.quaternion=new Mt,this.initQuaternion=new Mt,this.previousQuaternion=new Mt,this.interpolatedQuaternion=new Mt,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 z,e.angularVelocity&&this.angularVelocity.copy(e.angularVelocity),this.initAngularVelocity=new z,this.shapes=[],this.shapeOffsets=[],this.shapeOrientations=[],this.inertia=new z,this.invInertia=new z,this.invInertiaWorld=new Z1,this.invMassSolve=0,this.invInertiaSolve=new z,this.invInertiaWorldSolve=new Z1,this.fixedRotation=typeof e.fixedRotation<"u"?e.fixedRotation:!1,this.angularDamping=typeof e.angularDamping<"u"?e.angularDamping:.01,this.linearFactor=new z(1,1,1),e.linearFactor&&this.linearFactor.copy(e.linearFactor),this.angularFactor=new z(1,1,1),e.angularFactor&&this.angularFactor.copy(e.angularFactor),this.aabb=new r1,this.aabbNeedsUpdate=!0,this.boundingRadius=0,this.wlambda=new z,this.isTrigger=!!e.isTrigger,e.shape&&this.addShape(e.shape),this.updateMassProperties()}wakeUp(){let e=this.sleepState;this.sleepState=a.AWAKE,this.wakeUpAfterNarrowphase=!1,e===a.SLEEPING&&this.dispatchEvent(a.wakeupEvent)}sleep(){this.sleepState=a.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===a.AWAKE&&i<n?(this.sleepState=a.SLEEPY,this.timeLastSleepy=e,this.dispatchEvent(a.sleepyEvent)):t===a.SLEEPY&&i>n?this.wakeUp():t===a.SLEEPY&&e-this.timeLastSleepy>this.sleepTimeLimit&&(this.sleep(),this.dispatchEvent(a.sleepEvent))}}updateSolveMassProperties(){this.sleepState===a.SLEEPING||this.type===a.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 z){return e.vsub(this.position,t),this.quaternion.conjugate().vmult(t,t),t}vectorToLocalFrame(e,t=new z){return this.quaternion.conjugate().vmult(e,t),t}pointToWorldFrame(e,t=new z){return this.quaternion.vmult(e,t),t.vadd(this.position,t),t}vectorToWorldFrame(e,t=new z){return this.quaternion.vmult(e,t),t}addShape(e,t,i){let n=new z,r=new Mt;return t&&n.copy(t),i&&r.copy(i),this.shapes.push(e),this.shapeOffsets.push(n),this.shapeOrientations.push(r),this.updateMassProperties(),this.updateBoundingRadius(),this.aabbNeedsUpdate=!0,e.body=this,this}removeShape(e){let t=this.shapes.indexOf(e);return t===-1?(console.warn("Shape does not belong to the body"),this):(this.shapes.splice(t,1),this.shapeOffsets.splice(t,1),this.shapeOrientations.splice(t,1),this.updateMassProperties(),this.updateBoundingRadius(),this.aabbNeedsUpdate=!0,e.body=null,this)}updateBoundingRadius(){let e=this.shapes,t=this.shapeOffsets,i=e.length,n=0;for(let r=0;r!==i;r++){let s=e[r];s.updateBoundingSphereRadius();let o=t[r].length(),c=s.boundingSphereRadius;o+c>n&&(n=o+c)}this.boundingRadius=n}updateAABB(){let e=this.shapes,t=this.shapeOffsets,i=this.shapeOrientations,n=e.length,r=sf,s=af,o=this.quaternion,c=this.aabb,l=of;for(let h=0;h!==n;h++){let u=e[h];o.vmult(t[h],r),r.vadd(this.position,r),o.mult(i[h],s),u.calculateWorldAABB(r,s,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=cf,n=lf;i.setRotationFromQuaternion(this.quaternion),i.transpose(n),i.scale(t,i),i.mmult(n,this.invInertiaWorld)}}applyForce(e,t=new z){if(this.type!==a.DYNAMIC)return;this.sleepState===a.SLEEPING&&this.wakeUp();let i=hf;t.cross(e,i),this.force.vadd(e,this.force),this.torque.vadd(i,this.torque)}applyLocalForce(e,t=new z){if(this.type!==a.DYNAMIC)return;let i=uf,n=ff;this.vectorToWorldFrame(e,i),this.vectorToWorldFrame(t,n),this.applyForce(i,n)}applyTorque(e){this.type===a.DYNAMIC&&(this.sleepState===a.SLEEPING&&this.wakeUp(),this.torque.vadd(e,this.torque))}applyImpulse(e,t=new z){if(this.type!==a.DYNAMIC)return;this.sleepState===a.SLEEPING&&this.wakeUp();let i=t,n=df;n.copy(e),n.scale(this.invMass,n),this.velocity.vadd(n,this.velocity);let r=pf;i.cross(e,r),this.invInertiaWorld.vmult(r,r),this.angularVelocity.vadd(r,this.angularVelocity)}applyLocalImpulse(e,t=new z){if(this.type!==a.DYNAMIC)return;let i=mf,n=gf;this.vectorToWorldFrame(e,i),this.vectorToWorldFrame(t,n),this.applyImpulse(i,n)}updateMassProperties(){let e=vf;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),q0.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 z;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===a.DYNAMIC||this.type===a.KINEMATIC)||this.sleepState===a.SLEEPING)return;let n=this.velocity,r=this.angularVelocity,s=this.position,o=this.force,c=this.torque,l=this.quaternion,h=this.invMass,u=this.invInertiaWorld,f=this.linearFactor,d=h*e;n.x+=o.x*d*f.x,n.y+=o.y*d*f.y,n.z+=o.z*d*f.z;let p=u.elements,v=this.angularFactor,x=c.x*v.x,g=c.y*v.y,m=c.z*v.z;r.x+=e*(p[0]*x+p[1]*g+p[2]*m),r.y+=e*(p[3]*x+p[4]*g+p[5]*m),r.z+=e*(p[6]*x+p[7]*g+p[8]*m),s.x+=n.x*e,s.y+=n.y*e,s.z+=n.z*e,l.integrate(this.angularVelocity,e,this.angularFactor,l),t&&(i?l.normalizeFast():l.normalize()),this.aabbNeedsUpdate=!0,this.updateInertiaWorld()}};Te.idCounter=0;Te.COLLIDE_EVENT_NAME="collide";Te.DYNAMIC=K0.DYNAMIC;Te.STATIC=K0.STATIC;Te.KINEMATIC=K0.KINEMATIC;Te.AWAKE=e6.AWAKE;Te.SLEEPY=e6.SLEEPY;Te.SLEEPING=e6.SLEEPING;Te.wakeupEvent={type:"wakeup"};Te.sleepyEvent={type:"sleepy"};Te.sleepEvent={type:"sleep"};var sf=new z,af=new Mt,of=new r1,cf=new Z1,lf=new Z1,hf=new z,uf=new z,ff=new z,df=new z,pf=new z,mf=new z,gf=new z,vf=new z,G0=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)||!(t.collisionFilterGroup&e.collisionFilterMask)||(e.type&Te.STATIC||e.sleepState===Te.SLEEPING)&&(t.type&Te.STATIC||t.sleepState===Te.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 r=xf;t.position.vsub(e.position,r);let s=(e.boundingRadius+t.boundingRadius)**2;r.lengthSquared()<s&&(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=yf,n=wf,r=bf,s=e.length;for(let o=0;o!==s;o++)n[o]=e[o],r[o]=t[o];e.length=0,t.length=0;for(let o=0;o!==s;o++){let c=n[o].id,l=r[o].id,h=c<l?c+","+l:l+","+c;i[h]=o,i.keys.push(h)}for(let o=0;o!==i.keys.length;o++){let c=i.keys.pop(),l=i[c];e.push(n[l]),t.push(r[l]),delete i[c]}}setWorld(e){}static boundingSphereCheck(e,t){let i=new z;e.position.vsub(t.position,i);let n=e.shapes[0],r=t.shapes[0];return Math.pow(n.boundingSphereRadius+r.boundingSphereRadius,2)>i.lengthSquared()}aabbQuery(e,t,i){return console.warn(".aabbQuery is not implemented in this Broadphase subclass."),[]}},xf=new z,yf={keys:[]},wf=[],bf=[];var x_=new z,Yr=class extends G0{constructor(){super()}collisionPairs(e,t,i){let n=e.bodies,r=n.length,s,o;for(let c=0;c!==r;c++)for(let l=0;l!==c;l++)s=n[c],o=n[l],this.needBroadphaseCollision(s,o)&&this.intersectionTest(s,o,t,i)}aabbQuery(e,t,i=[]){for(let n=0;n<e.bodies.length;n++){let r=e.bodies[n];r.aabbNeedsUpdate&&r.updateAABB(),r.aabb.overlaps(t)&&i.push(r)}return i}},$r=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 z,this.rayToWorld=new z,this.hitNormalWorld=new z,this.hitPointWorld=new z,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,r,s,o){this.rayFromWorld.copy(e),this.rayToWorld.copy(t),this.hitNormalWorld.copy(i),this.hitPointWorld.copy(n),this.shape=r,this.body=s,this.distance=o}},Sl,_l,El,Ll,Tl,Dl,Hl,t6={CLOSEST:1,ANY:2,ALL:4};Sl=ge.types.SPHERE;_l=ge.types.PLANE;El=ge.types.BOX;Ll=ge.types.CYLINDER;Tl=ge.types.CONVEXPOLYHEDRON;Dl=ge.types.HEIGHTFIELD;Hl=ge.types.TRIMESH;var m1=class a{get[Sl](){return this._intersectSphere}get[_l](){return this._intersectPlane}get[El](){return this._intersectBox}get[Ll](){return this._intersectConvex}get[Tl](){return this._intersectConvex}get[Dl](){return this._intersectHeightfield}get[Hl](){return this._intersectTrimesh}constructor(e=new z,t=new z){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 z,this.precision=1e-4,this.checkCollisionResponse=!0,this.skipBackfaces=!1,this.collisionFilterMask=-1,this.collisionFilterGroup=-1,this.mode=a.ANY,this.result=new $r,this.hasHit=!1,this.callback=i=>{}}intersectWorld(e,t){return this.mode=t.mode||a.ANY,this.result=t.result||new $r,this.skipBackfaces=!!t.skipBackfaces,this.collisionFilterMask=typeof t.collisionFilterMask<"u"?t.collisionFilterMask:-1,this.collisionFilterGroup=typeof t.collisionFilterGroup<"u"?t.collisionFilterGroup:-1,this.checkCollisionResponse=typeof t.checkCollisionResponse<"u"?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(ml),k0.length=0,e.broadphase.aabbQuery(e,ml,k0),this.intersectBodies(k0),this.hasHit}intersectBody(e,t){t&&(this.result=t,this.updateDirection());let i=this.checkCollisionResponse;if(i&&!e.collisionResponse||!(this.collisionFilterGroup&e.collisionFilterMask)||!(e.collisionFilterGroup&this.collisionFilterMask))return;let n=Mf,r=zf;for(let s=0,o=e.shapes.length;s<o;s++){let c=e.shapes[s];if(!(i&&!c.collisionResponse)&&(e.quaternion.mult(e.shapeOrientations[s],r),e.quaternion.vmult(e.shapeOffsets[s],n),n.vadd(e.position,n),this.intersectShape(c,r,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 r=this.from;if(Bf(r,this.direction,i)>e.boundingSphereRadius)return;let o=this[e.type];o&&o.call(this,e,t,i,n,e)}_intersectBox(e,t,i,n,r){return this._intersectConvex(e.convexPolyhedronRepresentation,t,i,n,r)}_intersectPlane(e,t,i,n,r){let s=this.from,o=this.to,c=this.direction,l=new z(0,0,1);t.vmult(l,l);let h=new z;s.vsub(i,h);let u=h.dot(l);o.vsub(i,h);let f=h.dot(l);if(u*f>0||s.distanceTo(o)<u)return;let d=l.dot(c);if(Math.abs(d)<this.precision)return;let p=new z,v=new z,x=new z;s.vsub(i,p);let g=-l.dot(p)/d;c.scale(g,v),s.vadd(v,x),this.reportIntersection(l,x,r,n,-1)}getAABB(e){let{lowerBound:t,upperBound:i}=e,n=this.to,r=this.from;t.x=Math.min(n.x,r.x),t.y=Math.min(n.y,r.y),t.z=Math.min(n.z,r.z),i.x=Math.max(n.x,r.x),i.y=Math.max(n.y,r.y),i.z=Math.max(n.z,r.z)}_intersectHeightfield(e,t,i,n,r){e.data,e.elementSize;let s=Cf;s.from.copy(this.from),s.to.copy(this.to),je.pointToLocalFrame(i,t,s.from,s.from),je.pointToLocalFrame(i,t,s.to,s.to),s.updateDirection();let o=Af,c,l,h,u;c=l=0,h=u=e.data.length-1;let f=new r1;s.getAABB(f),e.getIndexOfPosition(f.lowerBound.x,f.lowerBound.y,o,!0),c=Math.max(c,o[0]),l=Math.max(l,o[1]),e.getIndexOfPosition(f.upperBound.x,f.upperBound.y,o,!0),h=Math.min(h,o[0]+1),u=Math.min(u,o[1]+1);for(let d=c;d<h;d++)for(let p=l;p<u;p++){if(this.result.shouldStop)return;if(e.getAabbAtIndex(d,p,f),!!f.overlapsRay(s)){if(e.getConvexTrianglePillar(d,p,!1),je.pointToWorldFrame(i,t,e.pillarOffset,Ba),this._intersectConvex(e.pillarConvex,t,Ba,n,r,gl),this.result.shouldStop)return;e.getConvexTrianglePillar(d,p,!0),je.pointToWorldFrame(i,t,e.pillarOffset,Ba),this._intersectConvex(e.pillarConvex,t,Ba,n,r,gl)}}}_intersectSphere(e,t,i,n,r){let s=this.from,o=this.to,c=e.radius,l=(o.x-s.x)**2+(o.y-s.y)**2+(o.z-s.z)**2,h=2*((o.x-s.x)*(s.x-i.x)+(o.y-s.y)*(s.y-i.y)+(o.z-s.z)*(s.z-i.z)),u=(s.x-i.x)**2+(s.y-i.y)**2+(s.z-i.z)**2-c**2,f=h**2-4*l*u,d=Sf,p=_f;if(!(f<0))if(f===0)s.lerp(o,f,d),d.vsub(i,p),p.normalize(),this.reportIntersection(p,d,r,n,-1);else{let v=(-h-Math.sqrt(f))/(2*l),x=(-h+Math.sqrt(f))/(2*l);if(v>=0&&v<=1&&(s.lerp(o,v,d),d.vsub(i,p),p.normalize(),this.reportIntersection(p,d,r,n,-1)),this.result.shouldStop)return;x>=0&&x<=1&&(s.lerp(o,x,d),d.vsub(i,p),p.normalize(),this.reportIntersection(p,d,r,n,-1))}}_intersectConvex(e,t,i,n,r,s){let o=Ef,c=vl,l=s&&s.faceList||null,h=e.faces,u=e.vertices,f=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 M=0;!m.shouldStop&&M<g;M++){let y=l?l[M]:M,b=h[y],C=f[y],_=t,S=i;c.copy(u[b[0]]),_.vmult(c,c),c.vadd(S,c),c.vsub(p,c),_.vmult(C,o);let P=d.dot(o);if(Math.abs(P)<this.precision)continue;let H=o.dot(c)/P;if(!(H<0)){d.scale(H,Jt),Jt.vadd(p,Jt),S1.copy(u[b[0]]),_.vmult(S1,S1),S.vadd(S1,S1);for(let w=1;!m.shouldStop&&w<b.length-1;w++){W1.copy(u[b[w]]),j1.copy(u[b[w+1]]),_.vmult(W1,W1),_.vmult(j1,j1),S.vadd(W1,W1),S.vadd(j1,j1);let T=Jt.distanceTo(p);!(a.pointInTriangle(Jt,S1,W1,j1)||a.pointInTriangle(Jt,W1,S1,j1))||T>x||this.reportIntersection(o,Jt,r,n,y)}}}}_intersectTrimesh(e,t,i,n,r,s){let o=Lf,c=Nf,l=Ff,h=vl,u=Tf,f=Df,d=Hf,p=Rf,v=Vf,x=e.indices;e.vertices;let g=this.from,m=this.to,M=this.direction;l.position.copy(i),l.quaternion.copy(t),je.vectorToLocalFrame(i,t,M,u),je.pointToLocalFrame(i,t,g,f),je.pointToLocalFrame(i,t,m,d),d.x*=e.scale.x,d.y*=e.scale.y,d.z*=e.scale.z,f.x*=e.scale.x,f.y*=e.scale.y,f.z*=e.scale.z,d.vsub(f,u),u.normalize();let y=f.distanceSquared(d);e.tree.rayQuery(this,l,c);for(let b=0,C=c.length;!this.result.shouldStop&&b!==C;b++){let _=c[b];e.getNormal(_,o),e.getVertex(x[_*3],S1),S1.vsub(f,h);let S=u.dot(o),P=o.dot(h)/S;if(P<0)continue;u.scale(P,Jt),Jt.vadd(f,Jt),e.getVertex(x[_*3+1],W1),e.getVertex(x[_*3+2],j1);let H=Jt.distanceSquared(f);!(a.pointInTriangle(Jt,W1,S1,j1)||a.pointInTriangle(Jt,S1,W1,j1))||H>y||(je.vectorToWorldFrame(t,o,v),je.pointToWorldFrame(i,t,Jt,p),this.reportIntersection(v,p,r,n,_))}c.length=0}reportIntersection(e,t,i,n,r){let s=this.from,o=this.to,c=s.distanceTo(t),l=this.result;if(!(this.skipBackfaces&&e.dot(this.direction)>0))switch(l.hitFaceIndex=typeof r<"u"?r:-1,this.mode){case a.ALL:this.hasHit=!0,l.set(s,o,e,t,i,n,c),l.hasHit=!0,this.callback(l);break;case a.CLOSEST:(c<l.distance||!l.hasHit)&&(this.hasHit=!0,l.hasHit=!0,l.set(s,o,e,t,i,n,c));break;case a.ANY:this.hasHit=!0,l.hasHit=!0,l.set(s,o,e,t,i,n,c),l.shouldStop=!0;break}}static pointInTriangle(e,t,i,n){n.vsub(t,Pi),i.vsub(t,Gr),e.vsub(t,O0);let r=Pi.dot(Pi),s=Pi.dot(Gr),o=Pi.dot(O0),c=Gr.dot(Gr),l=Gr.dot(O0),h,u;return(h=c*o-s*l)>=0&&(u=r*l-s*o)>=0&&h+u<r*c-s*s}};m1.CLOSEST=t6.CLOSEST;m1.ANY=t6.ANY;m1.ALL=t6.ALL;var ml=new r1,k0=[],Gr=new z,O0=new z,Mf=new z,zf=new Mt,Jt=new z,S1=new z,W1=new z,j1=new z,gl={faceList:[0]},Ba=new z,Cf=new m1,Af=[],Sf=new z,_f=new z,Ef=new z,vl=new z,Lf=new z,Tf=new z,Df=new z,Hf=new z,Vf=new z,Rf=new z;new r1;var Nf=[],Ff=new je,Pi=new z,Pa=new z;function Bf(a,e,t){t.vsub(a,Pi);let i=Pi.dot(e);return e.scale(i,Pa),Pa.vadd(a,Pa),t.distanceTo(Pa)}var Ga=class{static defaults(e={},t){for(let i in t)i in e||(e[i]=t[i]);return e}},W0=class a{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=Ga.defaults(i,{collideConnected:!0,wakeUpBodies:!0}),this.equations=[],this.bodyA=e,this.bodyB=t,this.id=a.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}};W0.idCounter=0;var Wa=class{constructor(){this.spatial=void 0,this.rotational=void 0,this.spatial=new z,this.rotational=new z}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)}},Jr=class a{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=a.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 Wa,this.jacobianElementB=new Wa,this.enabled=!0,this.multiplier=0,this.setSpookParams(1e7,4,1/60)}setSpookParams(e,t,i){let n=t,r=e,s=i;this.a=4/(s*(1+4*n)),this.b=4*n/(1+4*n),this.eps=4/(s*s*r*(1+4*n))}computeB(e,t,i){let n=this.computeGW(),r=this.computeGq(),s=this.computeGiMf();return-r*e-n*t-s*i}computeGq(){let e=this.jacobianElementA,t=this.jacobianElementB,i=this.bi,n=this.bj,r=i.position,s=n.position;return e.spatial.dot(r)+t.spatial.dot(s)}computeGW(){let e=this.jacobianElementA,t=this.jacobianElementB,i=this.bi,n=this.bj,r=i.velocity,s=n.velocity,o=i.angularVelocity,c=n.angularVelocity;return e.multiplyVectors(r,o)+t.multiplyVectors(s,c)}computeGWlambda(){let e=this.jacobianElementA,t=this.jacobianElementB,i=this.bi,n=this.bj,r=i.vlambda,s=n.vlambda,o=i.wlambda,c=n.wlambda;return e.multiplyVectors(r,o)+t.multiplyVectors(s,c)}computeGiMf(){let e=this.jacobianElementA,t=this.jacobianElementB,i=this.bi,n=this.bj,r=i.force,s=i.torque,o=n.force,c=n.torque,l=i.invMassSolve,h=n.invMassSolve;return r.scale(l,xl),o.scale(h,yl),i.invInertiaWorldSolve.vmult(s,wl),n.invInertiaWorldSolve.vmult(c,bl),e.multiplyVectors(xl,wl)+t.multiplyVectors(yl,bl)}computeGiMGt(){let e=this.jacobianElementA,t=this.jacobianElementB,i=this.bi,n=this.bj,r=i.invMassSolve,s=n.invMassSolve,o=i.invInertiaWorldSolve,c=n.invInertiaWorldSolve,l=r+s;return o.vmult(e.rotational,Ia),l+=Ia.dot(e.rotational),c.vmult(t.rotational,Ia),l+=Ia.dot(t.rotational),l}addToWlambda(e){let t=this.jacobianElementA,i=this.jacobianElementB,n=this.bi,r=this.bj,s=Pf;n.vlambda.addScaledVector(n.invMassSolve*e,t.spatial,n.vlambda),r.vlambda.addScaledVector(r.invMassSolve*e,i.spatial,r.vlambda),n.invInertiaWorldSolve.vmult(t.rotational,s),n.wlambda.addScaledVector(e,s,n.wlambda),r.invInertiaWorldSolve.vmult(i.rotational,s),r.wlambda.addScaledVector(e,s,r.wlambda)}computeC(){return this.computeGiMGt()+this.eps}};Jr.idCounter=0;var xl=new z,yl=new z,wl=new z,bl=new z,Ia=new z,Pf=new z,j0=class extends Jr{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 z,this.rj=new z,this.ni=new z}computeB(e){let t=this.a,i=this.b,n=this.bi,r=this.bj,s=this.ri,o=this.rj,c=If,l=kf,h=n.velocity,u=n.angularVelocity;n.force,n.torque;let f=r.velocity,d=r.angularVelocity;r.force,r.torque;let p=Of,v=this.jacobianElementA,x=this.jacobianElementB,g=this.ni;s.cross(g,c),o.cross(g,l),g.negate(v.spatial),c.negate(v.rotational),x.spatial.copy(g),x.rotational.copy(l),p.copy(r.position),p.vadd(o,p),p.vsub(n.position,p),p.vsub(s,p);let m=g.dot(p),M=this.restitution+1,y=M*f.dot(g)-M*h.dot(g)+d.dot(l)-u.dot(c),b=this.computeGiMf();return-m*t-y*i-e*b}getImpactVelocityAlongNormal(){let e=Uf,t=qf,i=Gf,n=Wf,r=jf;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,r),this.ni.dot(r)}},If=new z,kf=new z,Of=new z,Uf=new z,qf=new z,Gf=new z,Wf=new z,jf=new z;var y_=new z,w_=new z;var b_=new z,M_=new z;var z_=new z,C_=new z,ja=class extends Jr{constructor(e,t,i){super(e,t,-i,i),this.ri=void 0,this.rj=void 0,this.t=void 0,this.ri=new z,this.rj=new z,this.t=new z}computeB(e){this.a;let t=this.b;this.bi,this.bj;let i=this.ri,n=this.rj,r=Zf,s=Xf,o=this.t;i.cross(o,r),n.cross(o,s);let c=this.jacobianElementA,l=this.jacobianElementB;o.negate(c.spatial),r.negate(c.rotational),l.spatial.copy(o),l.rotational.copy(s);let h=this.computeGW(),u=this.computeGiMf();return-h*t-e*u}},Zf=new z,Xf=new z,G2=class a{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=Ga.defaults(i,{friction:.3,restitution:.3,contactEquationStiffness:1e7,contactEquationRelaxation:3,frictionEquationStiffness:1e7,frictionEquationRelaxation:3}),this.id=a.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}};G2.idCounter=0;var W2=class a{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=a.idCounter++,this.friction=typeof e.friction<"u"?e.friction:-1,this.restitution=typeof e.restitution<"u"?e.restitution:-1}};W2.idCounter=0;var A_=new z,S_=new z,__=new z,E_=new z,L_=new z,T_=new z,D_=new z,H_=new z,V_=new z,R_=new z,N_=new z;var F_=new z,B_=new z;var P_=new z,I_=new z,k_=new z;new m1;var O_=new z,U_=new z,q_=[new z(1,0,0),new z(0,1,0),new z(0,0,1)],G_=new z;var W_=new z,j_=new z,Z_=new z;var X_=new z,Y_=new z,$_=new z,J_=new z;var Q_=new z,K_=new z,eE=new z;var tE=new z,iE=new z;var nE=new z,rE=new z,sE=new z,aE=new z,oE=new z,cE=new z,lE=new z;var v2=class extends ge{constructor(){super({type:ge.types.PLANE}),this.worldNormal=void 0,this.worldNormalNeedsUpdate=void 0,this.boundingSphereRadius=void 0,this.worldNormal=new z,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 z){return t}volume(){return Number.MAX_VALUE}calculateWorldAABB(e,t,i,n){f2.set(0,0,1),t.vmult(f2,f2);let r=Number.MAX_VALUE;i.set(-r,-r,-r),n.set(r,r,r),f2.x===1?n.x=e.x:f2.x===-1&&(i.x=e.x),f2.y===1?n.y=e.y:f2.y===-1&&(i.y=e.y),f2.z===1?n.z=e.z:f2.z===-1&&(i.z=e.z)}updateBoundingSphereRadius(){this.boundingSphereRadius=Number.MAX_VALUE}},f2=new z;var hE=new z,uE=new z,fE=new z,dE=new z,pE=new z,mE=new z,gE=new z,vE=new z,xE=new z;var yE=new z,wE=new r1;var bE=new z,ME=new r1,zE=new z,CE=new z,AE=new z,SE=new z,_E=new z,EE=new z,LE=new z,TE=new r1,DE=new z,HE=new je,VE=new r1,Z0=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}},X0=class extends Z0{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,r=this.tolerance*this.tolerance,s=this.equations,o=s.length,c=t.bodies,l=c.length,h=e,u,f,d,p,v,x;if(o!==0)for(let y=0;y!==l;y++)c[y].updateSolveMassProperties();let g=$f,m=Jf,M=Yf;g.length=o,m.length=o,M.length=o;for(let y=0;y!==o;y++){let b=s[y];M[y]=0,m[y]=b.computeB(h),g[y]=1/b.computeC()}if(o!==0){for(let C=0;C!==l;C++){let _=c[C],S=_.vlambda,P=_.wlambda;S.set(0,0,0),P.set(0,0,0)}for(i=0;i!==n;i++){p=0;for(let C=0;C!==o;C++){let _=s[C];u=m[C],f=g[C],x=M[C],v=_.computeGWlambda(),d=f*(u-v-_.eps*x),x+d<_.minForce?d=_.minForce-x:x+d>_.maxForce&&(d=_.maxForce-x),M[C]+=d,p+=d>0?d:-d,_.addToWlambda(d)}if(p*p<r)break}for(let C=0;C!==l;C++){let _=c[C],S=_.velocity,P=_.angularVelocity;_.vlambda.vmul(_.linearFactor,_.vlambda),S.vadd(_.vlambda,S),_.wlambda.vmul(_.angularFactor,_.wlambda),P.vadd(_.wlambda,P)}let y=s.length,b=1/h;for(;y--;)s[y].multiplier=M[y]*b}return i}},Yf=[],$f=[],Jf=[];var RE=Te.STATIC;var Y0=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}},$0=class extends Y0{constructor(...e){super(...e),this.type=z}constructObject(){return new z}},Vl,Rl,Nl,Fl,Bl,Pl,Il,kl,Ol,Ul,ql,Gl,Wl,jl,Zl,Xl,Yl,$l,Jl,Ql,Kl,e5,t5,i5,n5,tt={sphereSphere:ge.types.SPHERE,spherePlane:ge.types.SPHERE|ge.types.PLANE,boxBox:ge.types.BOX|ge.types.BOX,sphereBox:ge.types.SPHERE|ge.types.BOX,planeBox:ge.types.PLANE|ge.types.BOX,convexConvex:ge.types.CONVEXPOLYHEDRON,sphereConvex:ge.types.SPHERE|ge.types.CONVEXPOLYHEDRON,planeConvex:ge.types.PLANE|ge.types.CONVEXPOLYHEDRON,boxConvex:ge.types.BOX|ge.types.CONVEXPOLYHEDRON,sphereHeightfield:ge.types.SPHERE|ge.types.HEIGHTFIELD,boxHeightfield:ge.types.BOX|ge.types.HEIGHTFIELD,convexHeightfield:ge.types.CONVEXPOLYHEDRON|ge.types.HEIGHTFIELD,sphereParticle:ge.types.PARTICLE|ge.types.SPHERE,planeParticle:ge.types.PLANE|ge.types.PARTICLE,boxParticle:ge.types.BOX|ge.types.PARTICLE,convexParticle:ge.types.PARTICLE|ge.types.CONVEXPOLYHEDRON,cylinderCylinder:ge.types.CYLINDER,sphereCylinder:ge.types.SPHERE|ge.types.CYLINDER,planeCylinder:ge.types.PLANE|ge.types.CYLINDER,boxCylinder:ge.types.BOX|ge.types.CYLINDER,convexCylinder:ge.types.CONVEXPOLYHEDRON|ge.types.CYLINDER,heightfieldCylinder:ge.types.HEIGHTFIELD|ge.types.CYLINDER,particleCylinder:ge.types.PARTICLE|ge.types.CYLINDER,sphereTrimesh:ge.types.SPHERE|ge.types.TRIMESH,planeTrimesh:ge.types.PLANE|ge.types.TRIMESH};Vl=tt.sphereSphere;Rl=tt.spherePlane;Nl=tt.boxBox;Fl=tt.sphereBox;Bl=tt.planeBox;Pl=tt.convexConvex;Il=tt.sphereConvex;kl=tt.planeConvex;Ol=tt.boxConvex;Ul=tt.sphereHeightfield;ql=tt.boxHeightfield;Gl=tt.convexHeightfield;Wl=tt.sphereParticle;jl=tt.planeParticle;Zl=tt.boxParticle;Xl=tt.convexParticle;Yl=tt.cylinderCylinder;$l=tt.sphereCylinder;Jl=tt.planeCylinder;Ql=tt.boxCylinder;Kl=tt.convexCylinder;e5=tt.heightfieldCylinder;t5=tt.particleCylinder;i5=tt.sphereTrimesh;n5=tt.planeTrimesh;var J0=class{get[Vl](){return this.sphereSphere}get[Rl](){return this.spherePlane}get[Nl](){return this.boxBox}get[Fl](){return this.sphereBox}get[Bl](){return this.planeBox}get[Pl](){return this.convexConvex}get[Il](){return this.sphereConvex}get[kl](){return this.planeConvex}get[Ol](){return this.boxConvex}get[Ul](){return this.sphereHeightfield}get[ql](){return this.boxHeightfield}get[Gl](){return this.convexHeightfield}get[Wl](){return this.sphereParticle}get[jl](){return this.planeParticle}get[Zl](){return this.boxParticle}get[Xl](){return this.convexParticle}get[Yl](){return this.convexConvex}get[$l](){return this.sphereConvex}get[Jl](){return this.planeConvex}get[Ql](){return this.boxConvex}get[Kl](){return this.convexConvex}get[e5](){return this.heightfieldCylinder}get[t5](){return this.particleCylinder}get[i5](){return this.sphereTrimesh}get[n5](){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 $0,this.world=e,this.currentContactMaterial=e.defaultContactMaterial,this.enableFrictionReduction=!1}createContactEquation(e,t,i,n,r,s){let o;this.contactPointPool.length?(o=this.contactPointPool.pop(),o.bi=e,o.bj=t):o=new j0(e,t),o.enabled=e.collisionResponse&&t.collisionResponse&&i.collisionResponse&&n.collisionResponse;let c=this.currentContactMaterial;o.restitution=c.restitution,o.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&&(o.restitution=l.restitution*h.restitution),o.si=r||i,o.sj=s||n,o}createFrictionEquationsFromContact(e,t){let i=e.bi,n=e.bj,r=e.si,s=e.sj,o=this.world,c=this.currentContactMaterial,l=c.friction,h=r.material||i.material,u=s.material||n.material;if(h&&u&&h.friction>=0&&u.friction>=0&&(l=h.friction*u.friction),l>0){let f=l*o.gravity.length(),d=i.invMass+n.invMass;d>0&&(d=1/d);let p=this.frictionEquationPool,v=p.length?p.pop():new ja(i,n,f*d),x=p.length?p.pop():new ja(i,n,f*d);return v.bi=x.bi=i,v.bj=x.bj=n,v.minForce=x.minForce=-f*d,v.maxForce=x.maxForce=f*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,o.dt),x.setSpookParams(c.frictionEquationStiffness,c.frictionEquationRelaxation,o.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(),yn.setZero(),wn.setZero();let r=t.bi;t.bj;for(let o=0;o!==e;o++)t=this.result[this.result.length-1-o],t.bi!==r?(Bi.vadd(t.ni,Bi),yn.vadd(t.ri,yn),wn.vadd(t.rj,wn)):(Bi.vsub(t.ni,Bi),yn.vadd(t.rj,yn),wn.vadd(t.ri,wn));let s=1/e;yn.scale(s,i.ri),wn.scale(s,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,r,s,o){this.contactPointPool=r,this.frictionEquationPool=o,this.result=n,this.frictionResult=s;let c=ed,l=td,h=Qf,u=Kf;for(let f=0,d=e.length;f!==d;f++){let p=e[f],v=t[f],x=null;p.material&&v.material&&(x=i.getContactMaterial(p.material,v.material)||null);let g=p.type&Te.KINEMATIC&&v.type&Te.STATIC||p.type&Te.STATIC&&v.type&Te.KINEMATIC||p.type&Te.KINEMATIC&&v.type&Te.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 M=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],u),u.vadd(v.position,u);let b=v.shapes[y];if(!(M.collisionFilterMask&b.collisionFilterGroup&&b.collisionFilterMask&M.collisionFilterGroup)||h.distanceTo(u)>M.boundingSphereRadius+b.boundingSphereRadius)continue;let C=null;M.material&&b.material&&(C=i.getContactMaterial(M.material,b.material)||null),this.currentContactMaterial=C||x||i.defaultContactMaterial;let _=M.type|b.type,S=this[_];if(S){let P=!1;M.type<b.type?P=S.call(this,M,b,h,u,c,l,p,v,M,b,g):P=S.call(this,b,M,u,h,l,c,v,p,M,b,g),P&&g&&(i.shapeOverlapKeeper.set(M.id,b.id),i.bodyOverlapKeeper.set(p.id,v.id))}}}}}sphereSphere(e,t,i,n,r,s,o,c,l,h,u){if(u)return i.distanceSquared(n)<(e.radius+t.radius)**2;let f=this.createContactEquation(o,c,e,t,l,h);n.vsub(i,f.ni),f.ni.normalize(),f.ri.copy(f.ni),f.rj.copy(f.ni),f.ri.scale(e.radius,f.ri),f.rj.scale(-t.radius,f.rj),f.ri.vadd(i,f.ri),f.ri.vsub(o.position,f.ri),f.rj.vadd(n,f.rj),f.rj.vsub(c.position,f.rj),this.result.push(f),this.createFrictionEquationsFromContact(f,this.frictionResult)}spherePlane(e,t,i,n,r,s,o,c,l,h,u){let f=this.createContactEquation(o,c,e,t,l,h);if(f.ni.set(0,0,1),s.vmult(f.ni,f.ni),f.ni.negate(f.ni),f.ni.normalize(),f.ni.scale(e.radius,f.ri),i.vsub(n,ka),f.ni.scale(f.ni.dot(ka),Ml),ka.vsub(Ml,f.rj),-ka.dot(f.ni)<=e.radius){if(u)return!0;let d=f.ri,p=f.rj;d.vadd(i,d),d.vsub(o.position,d),p.vadd(n,p),p.vsub(c.position,p),this.result.push(f),this.createFrictionEquationsFromContact(f,this.frictionResult)}}boxBox(e,t,i,n,r,s,o,c,l,h,u){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,r,s,o,c,e,t,u)}sphereBox(e,t,i,n,r,s,o,c,l,h,u){let f=this.v3pool,d=_d;i.vsub(n,Oa),t.getSideNormals(d,s);let p=e.radius,v=!1,x=Ld,g=Td,m=Dd,M=null,y=0,b=0,C=0,_=null;for(let L=0,N=d.length;L!==N&&v===!1;L++){let I=Cd;I.copy(d[L]);let W=I.length();I.normalize();let O=Oa.dot(I);if(O<W+p&&O>0){let q=Ad,j=Sd;q.copy(d[(L+1)%3]),j.copy(d[(L+2)%3]);let ie=q.length(),ae=j.length();q.normalize(),j.normalize();let U=Oa.dot(q),Ce=Oa.dot(j);if(U<ie&&U>-ie&&Ce<ae&&Ce>-ae){let ce=Math.abs(O-W-p);if((_===null||ce<_)&&(_=ce,b=U,C=Ce,M=W,x.copy(I),g.copy(q),m.copy(j),y++,u))return!0}}}if(y){v=!0;let L=this.createContactEquation(o,c,e,t,l,h);x.scale(-p,L.ri),L.ni.copy(x),L.ni.negate(L.ni),x.scale(M,x),g.scale(b,g),x.vadd(g,x),m.scale(C,m),x.vadd(m,L.rj),L.ri.vadd(i,L.ri),L.ri.vsub(o.position,L.ri),L.rj.vadd(n,L.rj),L.rj.vsub(c.position,L.rj),this.result.push(L),this.createFrictionEquationsFromContact(L,this.frictionResult)}let S=f.get(),P=Ed;for(let L=0;L!==2&&!v;L++)for(let N=0;N!==2&&!v;N++)for(let I=0;I!==2&&!v;I++)if(S.set(0,0,0),L?S.vadd(d[0],S):S.vsub(d[0],S),N?S.vadd(d[1],S):S.vsub(d[1],S),I?S.vadd(d[2],S):S.vsub(d[2],S),n.vadd(S,P),P.vsub(i,P),P.lengthSquared()<p*p){if(u)return!0;v=!0;let W=this.createContactEquation(o,c,e,t,l,h);W.ri.copy(P),W.ri.normalize(),W.ni.copy(W.ri),W.ri.scale(p,W.ri),W.rj.copy(S),W.ri.vadd(i,W.ri),W.ri.vsub(o.position,W.ri),W.rj.vadd(n,W.rj),W.rj.vsub(c.position,W.rj),this.result.push(W),this.createFrictionEquationsFromContact(W,this.frictionResult)}f.release(S),S=null;let H=f.get(),w=f.get(),T=f.get(),A=f.get(),R=f.get(),V=d.length;for(let L=0;L!==V&&!v;L++)for(let N=0;N!==V&&!v;N++)if(L%3!==N%3){d[N].cross(d[L],H),H.normalize(),d[L].vadd(d[N],w),T.copy(i),T.vsub(w,T),T.vsub(n,T);let I=T.dot(H);H.scale(I,A);let W=0;for(;W===L%3||W===N%3;)W++;R.copy(i),R.vsub(A,R),R.vsub(w,R),R.vsub(n,R);let O=Math.abs(I),q=R.length();if(O<d[W].length()&&q<p){if(u)return!0;v=!0;let j=this.createContactEquation(o,c,e,t,l,h);w.vadd(A,j.rj),j.rj.copy(j.rj),R.negate(j.ni),j.ni.normalize(),j.ri.copy(j.rj),j.ri.vadd(n,j.ri),j.ri.vsub(i,j.ri),j.ri.normalize(),j.ri.scale(p,j.ri),j.ri.vadd(i,j.ri),j.ri.vsub(o.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)}}f.release(H,w,T,A,R)}planeBox(e,t,i,n,r,s,o,c,l,h,u){return t.convexPolyhedronRepresentation.material=t.material,t.convexPolyhedronRepresentation.collisionResponse=t.collisionResponse,t.convexPolyhedronRepresentation.id=t.id,this.planeConvex(e,t.convexPolyhedronRepresentation,i,n,r,s,o,c,e,t,u)}convexConvex(e,t,i,n,r,s,o,c,l,h,u,f,d){let p=jd;if(!(i.distanceTo(n)>e.boundingSphereRadius+t.boundingSphereRadius)&&e.findSeparatingAxis(t,i,r,n,s,p,f,d)){let v=[],x=Zd;e.clipAgainstHull(i,r,t,n,s,p,-100,100,v);let g=0;for(let m=0;m!==v.length;m++){if(u)return!0;let M=this.createContactEquation(o,c,e,t,l,h),y=M.ri,b=M.rj;p.negate(M.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(o.position,y),b.vadd(n,b),b.vsub(c.position,b),this.result.push(M),g++,this.enableFrictionReduction||this.createFrictionEquationsFromContact(M,this.frictionResult)}this.enableFrictionReduction&&g&&this.createFrictionFromAverage(g)}}sphereConvex(e,t,i,n,r,s,o,c,l,h,u){let f=this.v3pool;i.vsub(n,Hd);let d=t.faceNormals,p=t.faces,v=t.vertices,x=e.radius,g=!1;for(let m=0;m!==v.length;m++){let M=v[m],y=Fd;s.vmult(M,y),n.vadd(y,y);let b=Nd;if(y.vsub(i,b),b.lengthSquared()<x*x){if(u)return!0;g=!0;let C=this.createContactEquation(o,c,e,t,l,h);C.ri.copy(b),C.ri.normalize(),C.ni.copy(C.ri),C.ri.scale(x,C.ri),y.vsub(n,C.rj),C.ri.vadd(i,C.ri),C.ri.vsub(o.position,C.ri),C.rj.vadd(n,C.rj),C.rj.vsub(c.position,C.rj),this.result.push(C),this.createFrictionEquationsFromContact(C,this.frictionResult);return}}for(let m=0,M=p.length;m!==M&&g===!1;m++){let y=d[m],b=p[m],C=Bd;s.vmult(y,C);let _=Pd;s.vmult(v[b[0]],_),_.vadd(n,_);let S=Id;C.scale(-x,S),i.vadd(S,S);let P=kd;S.vsub(_,P);let H=P.dot(C),w=Od;if(i.vsub(_,w),H<0&&w.dot(C)>0){let T=[];for(let A=0,R=b.length;A!==R;A++){let V=f.get();s.vmult(v[b[A]],V),n.vadd(V,V),T.push(V)}if(zd(T,C,i)){if(u)return!0;g=!0;let A=this.createContactEquation(o,c,e,t,l,h);C.scale(-x,A.ri),C.negate(A.ni);let R=f.get();C.scale(-H,R);let V=f.get();C.scale(-x,V),i.vsub(n,A.rj),A.rj.vadd(V,A.rj),A.rj.vadd(R,A.rj),A.rj.vadd(n,A.rj),A.rj.vsub(c.position,A.rj),A.ri.vadd(i,A.ri),A.ri.vsub(o.position,A.ri),f.release(R),f.release(V),this.result.push(A),this.createFrictionEquationsFromContact(A,this.frictionResult);for(let L=0,N=T.length;L!==N;L++)f.release(T[L]);return}else for(let A=0;A!==b.length;A++){let R=f.get(),V=f.get();s.vmult(v[b[(A+1)%b.length]],R),s.vmult(v[b[(A+2)%b.length]],V),n.vadd(R,R),n.vadd(V,V);let L=Vd;V.vsub(R,L);let N=Rd;L.unit(N);let I=f.get(),W=f.get();i.vsub(R,W);let O=W.dot(N);N.scale(O,I),I.vadd(R,I);let q=f.get();if(I.vsub(i,q),O>0&&O*O<L.lengthSquared()&&q.lengthSquared()<x*x){if(u)return!0;let j=this.createContactEquation(o,c,e,t,l,h);I.vsub(n,j.rj),I.vsub(i,j.ni),j.ni.normalize(),j.ni.scale(x,j.ri),j.rj.vadd(n,j.rj),j.rj.vsub(c.position,j.rj),j.ri.vadd(i,j.ri),j.ri.vsub(o.position,j.ri),this.result.push(j),this.createFrictionEquationsFromContact(j,this.frictionResult);for(let ie=0,ae=T.length;ie!==ae;ie++)f.release(T[ie]);f.release(R),f.release(V),f.release(I),f.release(q),f.release(W);return}f.release(R),f.release(V),f.release(I),f.release(q),f.release(W)}for(let A=0,R=T.length;A!==R;A++)f.release(T[A])}}}planeConvex(e,t,i,n,r,s,o,c,l,h,u){let f=Ud,d=qd;d.set(0,0,1),r.vmult(d,d);let p=0,v=Gd;for(let x=0;x!==t.vertices.length;x++)if(f.copy(t.vertices[x]),s.vmult(f,f),n.vadd(f,f),f.vsub(i,v),d.dot(v)<=0){if(u)return!0;let m=this.createContactEquation(o,c,e,t,l,h),M=Wd;d.scale(d.dot(v),M),f.vsub(M,M),M.vsub(i,m.ri),m.ni.copy(d),f.vsub(n,m.rj),m.ri.vadd(i,m.ri),m.ri.vsub(o.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,r,s,o,c,l,h,u){return e.convexPolyhedronRepresentation.material=e.material,e.convexPolyhedronRepresentation.collisionResponse=e.collisionResponse,this.convexConvex(e.convexPolyhedronRepresentation,t,i,n,r,s,o,c,e,t,u)}sphereHeightfield(e,t,i,n,r,s,o,c,l,h,u){let f=t.data,d=e.radius,p=t.elementSize,v=sp,x=rp;je.pointToLocalFrame(n,s,i,x);let g=Math.floor((x.x-d)/p)-1,m=Math.ceil((x.x+d)/p)+1,M=Math.floor((x.y-d)/p)-1,y=Math.ceil((x.y+d)/p)+1;if(m<0||y<0||g>f.length||M>f[0].length)return;g<0&&(g=0),m<0&&(m=0),M<0&&(M=0),y<0&&(y=0),g>=f.length&&(g=f.length-1),m>=f.length&&(m=f.length-1),y>=f[0].length&&(y=f[0].length-1),M>=f[0].length&&(M=f[0].length-1);let b=[];t.getRectMinMax(g,M,m,y,b);let C=b[0],_=b[1];if(x.z-d>_||x.z+d<C)return;let S=this.result;for(let P=g;P<m;P++)for(let H=M;H<y;H++){let w=S.length,T=!1;if(t.getConvexTrianglePillar(P,H,!1),je.pointToWorldFrame(n,s,t.pillarOffset,v),i.distanceTo(v)<t.pillarConvex.boundingSphereRadius+e.boundingSphereRadius&&(T=this.sphereConvex(e,t.pillarConvex,i,v,r,s,o,c,e,t,u)),u&&T||(t.getConvexTrianglePillar(P,H,!0),je.pointToWorldFrame(n,s,t.pillarOffset,v),i.distanceTo(v)<t.pillarConvex.boundingSphereRadius+e.boundingSphereRadius&&(T=this.sphereConvex(e,t.pillarConvex,i,v,r,s,o,c,e,t,u)),u&&T))return!0;if(S.length-w>2)return}}boxHeightfield(e,t,i,n,r,s,o,c,l,h,u){return e.convexPolyhedronRepresentation.material=e.material,e.convexPolyhedronRepresentation.collisionResponse=e.collisionResponse,this.convexHeightfield(e.convexPolyhedronRepresentation,t,i,n,r,s,o,c,e,t,u)}convexHeightfield(e,t,i,n,r,s,o,c,l,h,u){let f=t.data,d=t.elementSize,p=e.boundingSphereRadius,v=ip,x=np,g=tp;je.pointToLocalFrame(n,s,i,g);let m=Math.floor((g.x-p)/d)-1,M=Math.ceil((g.x+p)/d)+1,y=Math.floor((g.y-p)/d)-1,b=Math.ceil((g.y+p)/d)+1;if(M<0||b<0||m>f.length||y>f[0].length)return;m<0&&(m=0),M<0&&(M=0),y<0&&(y=0),b<0&&(b=0),m>=f.length&&(m=f.length-1),M>=f.length&&(M=f.length-1),b>=f[0].length&&(b=f[0].length-1),y>=f[0].length&&(y=f[0].length-1);let C=[];t.getRectMinMax(m,y,M,b,C);let _=C[0],S=C[1];if(!(g.z-p>S||g.z+p<_))for(let P=m;P<M;P++)for(let H=y;H<b;H++){let w=!1;if(t.getConvexTrianglePillar(P,H,!1),je.pointToWorldFrame(n,s,t.pillarOffset,v),i.distanceTo(v)<t.pillarConvex.boundingSphereRadius+e.boundingSphereRadius&&(w=this.convexConvex(e,t.pillarConvex,i,v,r,s,o,c,null,null,u,x,null)),u&&w||(t.getConvexTrianglePillar(P,H,!0),je.pointToWorldFrame(n,s,t.pillarOffset,v),i.distanceTo(v)<t.pillarConvex.boundingSphereRadius+e.boundingSphereRadius&&(w=this.convexConvex(e,t.pillarConvex,i,v,r,s,o,c,null,null,u,x,null)),u&&w))return!0}}sphereParticle(e,t,i,n,r,s,o,c,l,h,u){let f=Jd;if(f.set(0,0,1),n.vsub(i,f),f.lengthSquared()<=e.radius*e.radius){if(u)return!0;let p=this.createContactEquation(c,o,t,e,l,h);f.normalize(),p.rj.copy(f),p.rj.scale(e.radius,p.rj),p.ni.copy(f),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,r,s,o,c,l,h,u){let f=Xd;f.set(0,0,1),o.quaternion.vmult(f,f);let d=Yd;if(n.vsub(o.position,d),f.dot(d)<=0){if(u)return!0;let v=this.createContactEquation(c,o,t,e,l,h);v.ni.copy(f),v.ni.negate(v.ni),v.ri.set(0,0,0);let x=$d;f.scale(f.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,r,s,o,c,l,h,u){return e.convexPolyhedronRepresentation.material=e.material,e.convexPolyhedronRepresentation.collisionResponse=e.collisionResponse,this.convexParticle(e.convexPolyhedronRepresentation,t,i,n,r,s,o,c,e,t,u)}convexParticle(e,t,i,n,r,s,o,c,l,h,u){let f=-1,d=Kd,p=ep,v=null,x=Qd;if(x.copy(n),x.vsub(i,x),r.conjugate(zl),zl.vmult(x,x),e.pointIsInside(x)){e.worldVerticesNeedsUpdate&&e.computeWorldVertices(i,r),e.worldFaceNormalsNeedsUpdate&&e.computeWorldFaceNormals(r);for(let g=0,m=e.faces.length;g!==m;g++){let M=[e.worldVertices[e.faces[g][0]]],y=e.worldFaceNormals[g];n.vsub(M[0],Cl);let b=-y.dot(Cl);if(v===null||Math.abs(b)<Math.abs(v)){if(u)return!0;v=b,f=g,d.copy(y)}}if(f!==-1){let g=this.createContactEquation(c,o,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,M=g.rj;m.vadd(n,m),m.vsub(c.position,m),M.vadd(i,M),M.vsub(o.position,M),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,r,s,o,c,l,h,u){return this.convexHeightfield(t,e,n,i,s,r,c,o,l,h,u)}particleCylinder(e,t,i,n,r,s,o,c,l,h,u){return this.convexParticle(t,e,n,i,s,r,c,o,l,h,u)}sphereTrimesh(e,t,i,n,r,s,o,c,l,h,u){let f=ld,d=hd,p=ud,v=fd,x=dd,g=pd,m=xd,M=cd,y=ad,b=yd;je.pointToLocalFrame(n,s,i,x);let C=e.radius;m.lowerBound.set(x.x-C,x.y-C,x.z-C),m.upperBound.set(x.x+C,x.y+C,x.z+C),t.getTrianglesInAABB(m,b);let _=od,S=e.radius*e.radius;for(let A=0;A<b.length;A++)for(let R=0;R<3;R++)if(t.getVertex(t.indices[b[A]*3+R],_),_.vsub(x,y),y.lengthSquared()<=S){if(M.copy(_),je.pointToWorldFrame(n,s,M,_),_.vsub(i,y),u)return!0;let V=this.createContactEquation(o,c,e,t,l,h);V.ni.copy(y),V.ni.normalize(),V.ri.copy(V.ni),V.ri.scale(e.radius,V.ri),V.ri.vadd(i,V.ri),V.ri.vsub(o.position,V.ri),V.rj.copy(_),V.rj.vsub(c.position,V.rj),this.result.push(V),this.createFrictionEquationsFromContact(V,this.frictionResult)}for(let A=0;A<b.length;A++)for(let R=0;R<3;R++){t.getVertex(t.indices[b[A]*3+R],f),t.getVertex(t.indices[b[A]*3+(R+1)%3],d),d.vsub(f,p),x.vsub(d,g);let V=g.dot(p);x.vsub(f,g);let L=g.dot(p);if(L>0&&V<0&&(x.vsub(f,g),v.copy(p),v.normalize(),L=g.dot(v),v.scale(L,g),g.vadd(f,g),g.distanceTo(x)<e.radius)){if(u)return!0;let I=this.createContactEquation(o,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(o.position,I.ri),je.pointToWorldFrame(n,s,g,g),g.vsub(c.position,I.rj),je.vectorToWorldFrame(s,I.ni,I.ni),je.vectorToWorldFrame(s,I.ri,I.ri),this.result.push(I),this.createFrictionEquationsFromContact(I,this.frictionResult)}}let P=md,H=gd,w=vd,T=sd;for(let A=0,R=b.length;A!==R;A++){t.getTriangleVertices(b[A],P,H,w),t.getNormal(b[A],T),x.vsub(P,g);let V=g.dot(T);if(T.scale(V,g),x.vsub(g,g),V=g.distanceTo(x),m1.pointInTriangle(g,P,H,w)&&V<e.radius){if(u)return!0;let L=this.createContactEquation(o,c,e,t,l,h);g.vsub(x,L.ni),L.ni.normalize(),L.ni.scale(e.radius,L.ri),L.ri.vadd(i,L.ri),L.ri.vsub(o.position,L.ri),je.pointToWorldFrame(n,s,g,g),g.vsub(c.position,L.rj),je.vectorToWorldFrame(s,L.ni,L.ni),je.vectorToWorldFrame(s,L.ri,L.ri),this.result.push(L),this.createFrictionEquationsFromContact(L,this.frictionResult)}}b.length=0}planeTrimesh(e,t,i,n,r,s,o,c,l,h,u){let f=new z,d=id;d.set(0,0,1),r.vmult(d,d);for(let p=0;p<t.vertices.length/3;p++){t.getVertex(p,f);let v=new z;v.copy(f),je.pointToWorldFrame(n,s,v,f);let x=nd;if(f.vsub(i,x),d.dot(x)<=0){if(u)return!0;let m=this.createContactEquation(o,c,e,t,l,h);m.ni.copy(d);let M=rd;d.scale(x.dot(d),M),f.vsub(M,M),m.ri.copy(M),m.ri.vsub(o.position,m.ri),m.rj.copy(f),m.rj.vsub(c.position,m.rj),this.result.push(m),this.createFrictionEquationsFromContact(m,this.frictionResult)}}}},Bi=new z,yn=new z,wn=new z,Qf=new z,Kf=new z,ed=new Mt,td=new Mt,id=new z,nd=new z,rd=new z,sd=new z,ad=new z,od=new z,cd=new z,ld=new z,hd=new z,ud=new z,fd=new z,dd=new z,pd=new z,md=new z,gd=new z,vd=new z,xd=new r1,yd=[],ka=new z,Ml=new z,wd=new z,bd=new z,Md=new z;function zd(a,e,t){let i=null,n=a.length;for(let r=0;r!==n;r++){let s=a[r],o=wd;a[(r+1)%n].vsub(s,o);let c=bd;o.cross(e,c);let l=Md;t.vsub(s,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 Oa=new z,Cd=new z,Ad=new z,Sd=new z,_d=[new z,new z,new z,new z,new z,new z],Ed=new z,Ld=new z,Td=new z,Dd=new z,Hd=new z,Vd=new z,Rd=new z,Nd=new z,Fd=new z,Bd=new z,Pd=new z,Id=new z,kd=new z,Od=new z,Ud=new z,qd=new z,Gd=new z,Wd=new z,jd=new z,Zd=new z,Xd=new z,Yd=new z,$d=new z,Jd=new z,zl=new Mt,Qd=new z,Kd=new z,Cl=new z,ep=new z,tp=new z,ip=new z,np=[0],rp=new z,sp=new z,Za=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,r=0;for(;i>n[r];)r++;if(i!==n[r]){for(let s=n.length-1;s>=r;s--)n[s+1]=n[s];n[r]=i}}tick(){let e=this.current;this.current=this.previous,this.previous=e,this.current.length=0}getDiff(e,t){let i=this.current,n=this.previous,r=i.length,s=n.length,o=0;for(let c=0;c<r;c++){let l=!1,h=i[c];for(;h>n[o];)o++;l=h===n[o],l||Al(e,h)}o=0;for(let c=0;c<s;c++){let l=!1,h=n[c];for(;h>i[o];)o++;l=i[o]===h,l||Al(t,h)}}};function Al(a,e){a.push((e&4294901760)>>16,e&65535)}var Q0=class{constructor(){this.data={keys:[]}}get(e,t){if(e>t){let i=t;t=e,e=i}return this.data[e+"-"+t]}set(e,t,i){if(e>t){let r=t;t=e,e=r}let 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]}}},Xa=class extends qa{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 z,e.gravity&&this.gravity.copy(e.gravity),this.broadphase=e.broadphase!==void 0?e.broadphase:new Yr,this.bodies=[],this.hasActiveBodies=!1,this.solver=e.solver!==void 0?e.solver:new X0,this.constraints=[],this.narrowphase=new J0(this),this.collisionMatrix=new Ua,this.collisionMatrixPrevious=new Ua,this.bodyOverlapKeeper=new Za,this.shapeOverlapKeeper=new Za,this.materials=[],this.contactmaterials=[],this.contactMaterialTable=new Q0,this.defaultMaterial=new W2("default"),this.defaultContactMaterial=new G2(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 $r?this.raycastClosest(e,t,{skipBackfaces:!0},i):this.raycastAll(e,t,{skipBackfaces:!0},i)}raycastAll(e,t,i={},n){return i.mode=m1.ALL,i.from=e,i.to=t,i.callback=n,U0.intersectWorld(this,i)}raycastAny(e,t,i={},n){return i.mode=m1.ANY,i.from=e,i.to=t,i.result=n,U0.intersectWorld(this,i)}raycastClosest(e,t,i={},n){return i.mode=m1.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 Te&&(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 r=0;r!==i.length;r++)i[r].index=r;this.collisionMatrix.setNumObjects(t),this.removeBodyEvent.body=e,delete this.idToBodyMap[e.id],this.dispatchEvent(this.removeBodyEvent)}}getBodyById(e){return this.idToBodyMap[e]}getShapeById(e){let t=this.bodies;for(let i=0;i<t.length;i++){let n=t[i].shapes;for(let r=0;r<n.length;r++){let s=n[r];if(s.id===e)return s}}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=Lt.now(),r=0;for(;this.accumulator>=e&&r<i&&(this.internalStep(e),this.accumulator-=e,r++,!(Lt.now()-n>e*1e3)););this.accumulator=this.accumulator%e;let s=this.accumulator/e;for(let o=0;o!==this.bodies.length;o++){let c=this.bodies[o];c.previousPosition.lerp(c.position,s,c.interpolatedPosition),c.previousQuaternion.slerp(c.quaternion,s,c.interpolatedQuaternion),c.previousQuaternion.normalize()}this.time+=t}}internalStep(e){this.dt=e;let t=this.contacts,i=hp,n=up,r=this.numObjects(),s=this.bodies,o=this.solver,c=this.gravity,l=this.doProfiling,h=this.profile,u=Te.DYNAMIC,f=-1/0,d=this.constraints,p=lp;c.length();let v=c.x,x=c.y,g=c.z,m=0;for(l&&(f=Lt.now()),m=0;m!==r;m++){let A=s[m];if(A.type===u){let R=A.force,V=A.mass;R.x+=V*v,R.y+=V*x,R.z+=V*g}}for(let A=0,R=this.subsystems.length;A!==R;A++)this.subsystems[A].update();l&&(f=Lt.now()),i.length=0,n.length=0,this.broadphase.collisionPairs(this,i,n),l&&(h.broadphase=Lt.now()-f);let M=d.length;for(m=0;m!==M;m++){let A=d[m];if(!A.collideConnected)for(let R=i.length-1;R>=0;R-=1)(A.bodyA===i[R]&&A.bodyB===n[R]||A.bodyB===i[R]&&A.bodyA===n[R])&&(i.splice(R,1),n.splice(R,1))}this.collisionMatrixTick(),l&&(f=Lt.now());let y=cp,b=t.length;for(m=0;m!==b;m++)y.push(t[m]);t.length=0;let C=this.frictionEquations.length;for(m=0;m!==C;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=Lt.now()-f),l&&(f=Lt.now()),m=0;m<this.frictionEquations.length;m++)o.addEquation(this.frictionEquations[m]);let _=t.length;for(let A=0;A!==_;A++){let R=t[A],V=R.bi,L=R.bj,N=R.si,I=R.sj,W;if(V.material&&L.material?W=this.getContactMaterial(V.material,L.material)||this.defaultContactMaterial:W=this.defaultContactMaterial,W.friction,V.material&&L.material&&(V.material.friction>=0&&L.material.friction>=0&&V.material.friction*L.material.friction,V.material.restitution>=0&&L.material.restitution>=0&&(R.restitution=V.material.restitution*L.material.restitution)),o.addEquation(R),V.allowSleep&&V.type===Te.DYNAMIC&&V.sleepState===Te.SLEEPING&&L.sleepState===Te.AWAKE&&L.type!==Te.STATIC){let O=L.velocity.lengthSquared()+L.angularVelocity.lengthSquared(),q=L.sleepSpeedLimit**2;O>=q*2&&(V.wakeUpAfterNarrowphase=!0)}if(L.allowSleep&&L.type===Te.DYNAMIC&&L.sleepState===Te.SLEEPING&&V.sleepState===Te.AWAKE&&V.type!==Te.STATIC){let O=V.velocity.lengthSquared()+V.angularVelocity.lengthSquared(),q=V.sleepSpeedLimit**2;O>=q*2&&(L.wakeUpAfterNarrowphase=!0)}this.collisionMatrix.set(V,L,!0),this.collisionMatrixPrevious.get(V,L)||(Wr.body=L,Wr.contact=R,V.dispatchEvent(Wr),Wr.body=V,L.dispatchEvent(Wr)),this.bodyOverlapKeeper.set(V.id,L.id),this.shapeOverlapKeeper.set(N.id,I.id)}for(this.emitContactEvents(),l&&(h.makeContactConstraints=Lt.now()-f,f=Lt.now()),m=0;m!==r;m++){let A=s[m];A.wakeUpAfterNarrowphase&&(A.wakeUp(),A.wakeUpAfterNarrowphase=!1)}for(M=d.length,m=0;m!==M;m++){let A=d[m];A.update();for(let R=0,V=A.equations.length;R!==V;R++){let L=A.equations[R];o.addEquation(L)}}o.solve(e,this),l&&(h.solve=Lt.now()-f),o.removeAllEquations();let S=Math.pow;for(m=0;m!==r;m++){let A=s[m];if(A.type&u){let R=S(1-A.linearDamping,e),V=A.velocity;V.scale(R,V);let L=A.angularVelocity;if(L){let N=S(1-A.angularDamping,e);L.scale(N,L)}}}for(this.dispatchEvent(op),m=0;m!==r;m++){let A=s[m];A.preStep&&A.preStep.call(A)}l&&(f=Lt.now());let H=this.stepnumber%(this.quatNormalizeSkip+1)===0,w=this.quatNormalizeFast;for(m=0;m!==r;m++)s[m].integrate(e,H,w);for(this.clearForces(),this.broadphase.dirty=!0,l&&(h.integrate=Lt.now()-f),this.stepnumber+=1,this.dispatchEvent(ap),m=0;m!==r;m++){let A=s[m],R=A.postStep;R&&R.call(A)}let T=!0;if(this.allowSleep)for(T=!1,m=0;m!==r;m++){let A=s[m];A.sleepTick(this.time),A.sleepState!==Te.SLEEPING&&(T=!0)}this.hasActiveBodies=T}emitContactEvents(){let e=this.hasAnyEventListener("beginContact"),t=this.hasAnyEventListener("endContact");if((e||t)&&this.bodyOverlapKeeper.getDiff(d2,p2),e){for(let r=0,s=d2.length;r<s;r+=2)jr.bodyA=this.getBodyById(d2[r]),jr.bodyB=this.getBodyById(d2[r+1]),this.dispatchEvent(jr);jr.bodyA=jr.bodyB=null}if(t){for(let r=0,s=p2.length;r<s;r+=2)Zr.bodyA=this.getBodyById(p2[r]),Zr.bodyB=this.getBodyById(p2[r+1]),this.dispatchEvent(Zr);Zr.bodyA=Zr.bodyB=null}d2.length=p2.length=0;let i=this.hasAnyEventListener("beginShapeContact"),n=this.hasAnyEventListener("endShapeContact");if((i||n)&&this.shapeOverlapKeeper.getDiff(d2,p2),i){for(let r=0,s=d2.length;r<s;r+=2){let o=this.getShapeById(d2[r]),c=this.getShapeById(d2[r+1]);m2.shapeA=o,m2.shapeB=c,o&&(m2.bodyA=o.body),c&&(m2.bodyB=c.body),this.dispatchEvent(m2)}m2.bodyA=m2.bodyB=m2.shapeA=m2.shapeB=null}if(n){for(let r=0,s=p2.length;r<s;r+=2){let o=this.getShapeById(p2[r]),c=this.getShapeById(p2[r+1]);g2.shapeA=o,g2.shapeB=c,o&&(g2.bodyA=o.body),c&&(g2.bodyB=c.body),this.dispatchEvent(g2)}g2.bodyA=g2.bodyB=g2.shapeA=g2.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 r1;var U0=new m1,Lt=globalThis.performance||{};if(!Lt.now){let a=Date.now();Lt.timing&&Lt.timing.navigationStart&&(a=Lt.timing.navigationStart),Lt.now=()=>Date.now()-a}var ap={type:"postStep"},op={type:"preStep"},Wr={type:Te.COLLIDE_EVENT_NAME,body:null,contact:null},cp=[],lp=[],hp=[],up=[],d2=[],p2=[],jr={type:"beginContact",bodyA:null,bodyB:null},Zr={type:"endContact",bodyA:null,bodyB:null},m2={type:"beginShapeContact",bodyA:null,bodyB:null,shapeA:null,shapeB:null},g2={type:"endShapeContact",bodyA:null,bodyB:null,shapeA:null,shapeB:null};var Qr=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,r=this.w,s=e.elements;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.w=s[3]*t+s[7]*i+s[11]*n+s[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,n,r,c=e.elements,l=c[0],h=c[4],u=c[8],f=c[1],d=c[5],p=c[9],v=c[2],x=c[6],g=c[10];if(Math.abs(h-f)<.01&&Math.abs(u-v)<.01&&Math.abs(p-x)<.01){if(Math.abs(h+f)<.1&&Math.abs(u+v)<.1&&Math.abs(p+x)<.1&&Math.abs(l+d+g-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let M=(l+1)/2,y=(d+1)/2,b=(g+1)/2,C=(h+f)/4,_=(u+v)/4,S=(p+x)/4;return M>y&&M>b?M<.01?(i=0,n=.707106781,r=.707106781):(i=Math.sqrt(M),n=C/i,r=_/i):y>b?y<.01?(i=.707106781,n=0,r=.707106781):(n=Math.sqrt(y),i=C/n,r=S/n):b<.01?(i=.707106781,n=.707106781,r=0):(r=Math.sqrt(b),i=_/r,n=S/r),this.set(i,n,r,t),this}let m=Math.sqrt((x-p)*(x-p)+(u-v)*(u-v)+(f-h)*(f-h));return Math.abs(m)<.001&&(m=1),this.x=(x-p)/m,this.y=(u-v)/m,this.z=(f-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}};Qr.prototype.isVector4=!0;var Nt=[];for(let a=0;a<256;a++)Nt[a]=(a<16?"0":"")+a.toString(16);var BE=Math.PI/180,PE=180/Math.PI;function x2(){let a=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Nt[a&255]+Nt[a>>8&255]+Nt[a>>16&255]+Nt[a>>24&255]+"-"+Nt[e&255]+Nt[e>>8&255]+"-"+Nt[e>>16&15|64]+Nt[e>>24&255]+"-"+Nt[t&63|128]+Nt[t>>8&255]+"-"+Nt[t>>16&255]+Nt[t>>24&255]+Nt[i&255]+Nt[i>>8&255]+Nt[i>>16&255]+Nt[i>>24&255]).toUpperCase()}function Qt(a,e,t){return Math.max(e,Math.min(t,a))}function r5(a,e){return(a%e+e)%e}function Ya(a,e,t){return(1-t)*a+t*e}var _1=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,r,s,o){let c=i[n+0],l=i[n+1],h=i[n+2],u=i[n+3],f=r[s+0],d=r[s+1],p=r[s+2],v=r[s+3];if(o===0){e[t+0]=c,e[t+1]=l,e[t+2]=h,e[t+3]=u;return}if(o===1){e[t+0]=f,e[t+1]=d,e[t+2]=p,e[t+3]=v;return}if(u!==v||c!==f||l!==d||h!==p){let x=1-o,g=c*f+l*d+h*p+u*v,m=g>=0?1:-1,M=1-g*g;if(M>Number.EPSILON){let b=Math.sqrt(M),C=Math.atan2(b,g*m);x=Math.sin(x*C)/b,o=Math.sin(o*C)/b}let y=o*m;if(c=c*x+f*y,l=l*x+d*y,h=h*x+p*y,u=u*x+v*y,x===1-o){let b=1/Math.sqrt(c*c+l*l+h*h+u*u);c*=b,l*=b,h*=b,u*=b}}e[t]=c,e[t+1]=l,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,i,n,r,s){let o=i[n],c=i[n+1],l=i[n+2],h=i[n+3],u=r[s],f=r[s+1],d=r[s+2],p=r[s+3];return e[t]=o*p+h*u+c*d-l*f,e[t+1]=c*p+h*f+l*u-o*d,e[t+2]=l*p+h*d+o*f-c*u,e[t+3]=h*p-o*u-c*f-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,r=e._z,s=e._order,o=Math.cos,c=Math.sin,l=o(i/2),h=o(n/2),u=o(r/2),f=c(i/2),d=c(n/2),p=c(r/2);switch(s){case"XYZ":this._x=f*h*u+l*d*p,this._y=l*d*u-f*h*p,this._z=l*h*p+f*d*u,this._w=l*h*u-f*d*p;break;case"YXZ":this._x=f*h*u+l*d*p,this._y=l*d*u-f*h*p,this._z=l*h*p-f*d*u,this._w=l*h*u+f*d*p;break;case"ZXY":this._x=f*h*u-l*d*p,this._y=l*d*u+f*h*p,this._z=l*h*p+f*d*u,this._w=l*h*u-f*d*p;break;case"ZYX":this._x=f*h*u-l*d*p,this._y=l*d*u+f*h*p,this._z=l*h*p-f*d*u,this._w=l*h*u+f*d*p;break;case"YZX":this._x=f*h*u+l*d*p,this._y=l*d*u+f*h*p,this._z=l*h*p-f*d*u,this._w=l*h*u-f*d*p;break;case"XZY":this._x=f*h*u-l*d*p,this._y=l*d*u-f*h*p,this._z=l*h*p+f*d*u,this._w=l*h*u+f*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let i=t/2,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],r=t[8],s=t[1],o=t[5],c=t[9],l=t[2],h=t[6],u=t[10],f=i+o+u;if(f>0){let d=.5/Math.sqrt(f+1);this._w=.25/d,this._x=(h-c)*d,this._y=(r-l)*d,this._z=(s-n)*d}else if(i>o&&i>u){let d=2*Math.sqrt(1+i-o-u);this._w=(h-c)/d,this._x=.25*d,this._y=(n+s)/d,this._z=(r+l)/d}else if(o>u){let d=2*Math.sqrt(1+o-i-u);this._w=(r-l)/d,this._x=(n+s)/d,this._y=.25*d,this._z=(c+h)/d}else{let d=2*Math.sqrt(1+u-i-o);this._w=(s-n)/d,this._x=(r+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(Qt(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,r=e._z,s=e._w,o=t._x,c=t._y,l=t._z,h=t._w;return this._x=i*h+s*o+n*l-r*c,this._y=n*h+s*c+r*o-i*l,this._z=r*h+s*l+i*c-n*o,this._w=s*h-i*o-n*c-r*l,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);let i=this._x,n=this._y,r=this._z,s=this._w,o=s*e._w+i*e._x+n*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=s,this._x=i,this._y=n,this._z=r,this;let c=1-o*o;if(c<=Number.EPSILON){let d=1-t;return this._w=d*s+t*this._w,this._x=d*i+t*this._x,this._y=d*n+t*this._y,this._z=d*r+t*this._z,this.normalize(),this._onChangeCallback(),this}let l=Math.sqrt(c),h=Math.atan2(l,o),u=Math.sin((1-t)*h)/l,f=Math.sin(t*h)/l;return this._w=s*u+this._w*f,this._x=i*u+this._x*f,this._y=n*u+this._y*f,this._z=r*u+this._z*f,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(),r=2*Math.PI*Math.random();return this.set(t*Math.cos(n),i*Math.sin(r),i*Math.cos(r),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(){}};_1.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(s5.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(s5.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,i=this.y,n=this.z,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6]*n,this.y=r[1]*t+r[4]*i+r[7]*n,this.z=r[2]*t+r[5]*i+r[8]*n,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,i=this.y,n=this.z,r=e.elements,s=1/(r[3]*t+r[7]*i+r[11]*n+r[15]);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}applyQuaternion(e){let t=this.x,i=this.y,n=this.z,r=e.x,s=e.y,o=e.z,c=e.w,l=c*t+s*n-o*i,h=c*i+o*t-r*n,u=c*n+r*i-s*t,f=-r*t-s*i-o*n;return this.x=l*c+f*-r+h*-o-u*-s,this.y=h*c+f*-s+u*-r-l*-o,this.z=u*c+f*-o+l*-s-h*-r,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,i=this.y,n=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*n,this.y=r[1]*t+r[5]*i+r[9]*n,this.z=r[2]*t+r[6]*i+r[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,r=e.z,s=t.x,o=t.y,c=t.z;return this.x=n*c-r*o,this.y=r*s-i*c,this.z=i*o-n*s,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return i6.copy(this).projectOnVector(e),this.sub(i6)}reflect(e){return this.sub(i6.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(Qt(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 i6=new Y,s5=new _1;var ut=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),r=this.x-e.x,s=this.y-e.y;return this.x=r*i-s*n+e.x,this.y=r*n+s*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};ut.prototype.isVector2=!0;var a5={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},E1={h:0,s:0,l:0},$a={h:0,s:0,l:0};function n6(a,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?a+(e-a)*6*t:t<1/2?e:t<2/3?a+(e-a)*6*(2/3-t):a}function ki(a){return a<.04045?a*.0773993808:Math.pow(a*.9478672986+.0521327014,2.4)}function r6(a){return a<.0031308?a*12.92:1.055*Math.pow(a,.41666)-.055}var jt=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=r5(e,1),t=Qt(t,0,1),i=Qt(i,0,1),t===0)this.r=this.g=this.b=i;else{let n=i<=.5?i*(1+t):i+t-i*t,r=2*i-n;this.r=n6(r,n,e+1/3),this.g=n6(r,n,e),this.b=n6(r,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,r=i[1],s=i[2];switch(r){case"rgb":case"rgba":if(n=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))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(s))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(s)){let o=parseFloat(n[1])/360,c=parseInt(n[2],10)/100,l=parseInt(n[3],10)/100;return t(n[4]),this.setHSL(o,c,l)}break}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){let n=i[1],r=n.length;if(r===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(r===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=a5[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=ki(e.r),this.g=ki(e.g),this.b=ki(e.b),this}copyLinearToSRGB(e){return this.r=r6(e.r),this.g=r6(e.g),this.b=r6(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,r=Math.max(t,i,n),s=Math.min(t,i,n),o,c,l=(s+r)/2;if(s===r)o=0,c=0;else{let h=r-s;switch(c=l<=.5?h/(r+s):h/(2-r-s),r){case t:o=(i-n)/h+(i<n?6:0);break;case i:o=(n-t)/h+2;break;case n:o=(t-i)/h+4;break}o/=6}return e.h=o,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(E1),E1.h+=e,E1.s+=t,E1.l+=i,this.setHSL(E1.h,E1.s,E1.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(E1),e.getHSL($a);let i=Ya(E1.h,$a.h,t),n=Ya(E1.s,$a.s,t),r=Ya(E1.l,$a.l,t);return this.setHSL(i,n,r),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()}};jt.NAMES=a5;jt.prototype.isColor=!0;jt.prototype.r=1;jt.prototype.g=1;jt.prototype.b=1;var s6=0,o5=1,c5=2,l5=1;var a6=1;var h5=100;var u5=204,f5=205;var d5=3;var Ja=0;var o6=300;var c6=1e3,Kr=1001,l6=1002;var p5=1006;var m5=1008;var g5=1009;var v5=1023;var x5=3e3;var y5=0;var Qa=7680;var w5=519,h6=35044;var Qe=new Y,Ka=new ut,L1=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=h6,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,r=this.itemSize;n<r;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,r=e.length;n<r;n++){let s=e[n];s===void 0&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",n),s=new jt),t[i++]=s.r,t[i++]=s.g,t[i++]=s.b}return this}copyVector2sArray(e){let t=this.array,i=0;for(let n=0,r=e.length;n<r;n++){let s=e[n];s===void 0&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",n),s=new ut),t[i++]=s.x,t[i++]=s.y}return this}copyVector3sArray(e){let t=this.array,i=0;for(let n=0,r=e.length;n<r;n++){let s=e[n];s===void 0&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",n),s=new Y),t[i++]=s.x,t[i++]=s.y,t[i++]=s.z}return this}copyVector4sArray(e){let t=this.array,i=0;for(let n=0,r=e.length;n<r;n++){let s=e[n];s===void 0&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",n),s=new Qr),t[i++]=s.x,t[i++]=s.y,t[i++]=s.z,t[i++]=s.w}return this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)Ka.fromBufferAttribute(this,t),Ka.applyMatrix3(e),this.setXY(t,Ka.x,Ka.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)Qe.fromBufferAttribute(this,t),Qe.applyMatrix3(e),this.setXYZ(t,Qe.x,Qe.y,Qe.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)Qe.x=this.getX(t),Qe.y=this.getY(t),Qe.z=this.getZ(t),Qe.applyMatrix4(e),this.setXYZ(t,Qe.x,Qe.y,Qe.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Qe.x=this.getX(t),Qe.y=this.getY(t),Qe.z=this.getZ(t),Qe.applyNormalMatrix(e),this.setXYZ(t,Qe.x,Qe.y,Qe.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Qe.x=this.getX(t),Qe.y=this.getY(t),Qe.z=this.getZ(t),Qe.transformDirection(e),this.setXYZ(t,Qe.x,Qe.y,Qe.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,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this.array[e+3]=r,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!==h6&&(e.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(e.updateRange=this.updateRange),e}};L1.prototype.isBufferAttribute=!0;var e4=class extends L1{constructor(e,t,i){super(new Uint16Array(e),t,i)}};var t4=class extends L1{constructor(e,t,i){super(new Uint32Array(e),t,i)}},u6=class extends L1{constructor(e,t,i){super(new Uint16Array(e),t,i)}};u6.prototype.isFloat16BufferAttribute=!0;var j2=class extends L1{constructor(e,t,i){super(new Float32Array(e),t,i)}};var X1=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,r=-1/0,s=-1/0,o=-1/0;for(let c=0,l=e.length;c<l;c+=3){let h=e[c],u=e[c+1],f=e[c+2];h<t&&(t=h),u<i&&(i=u),f<n&&(n=f),h>r&&(r=h),u>s&&(s=u),f>o&&(o=f)}return this.min.set(t,i,n),this.max.set(r,s,o),this}setFromBufferAttribute(e){let t=1/0,i=1/0,n=1/0,r=-1/0,s=-1/0,o=-1/0;for(let c=0,l=e.count;c<l;c++){let h=e.getX(c),u=e.getY(c),f=e.getZ(c);h<t&&(t=h),u<i&&(i=u),f<n&&(n=f),h>r&&(r=h),u>s&&(s=u),f>o&&(o=f)}return this.min.set(t,i,n),this.max.set(r,s,o),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=Oi.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 r=i.attributes.position;for(let s=0,o=r.count;s<o;s++)Oi.fromBufferAttribute(r,s).applyMatrix4(e.matrixWorld),this.expandByPoint(Oi)}else i.boundingBox===null&&i.computeBoundingBox(),f6.copy(i.boundingBox),f6.applyMatrix4(e.matrixWorld),this.union(f6);let n=e.children;for(let r=0,s=n.length;r<s;r++)this.expandByObject(n[r],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,Oi),Oi.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(es),i4.subVectors(this.max,es),bn.subVectors(e.a,es),Mn.subVectors(e.b,es),zn.subVectors(e.c,es),Z2.subVectors(Mn,bn),X2.subVectors(zn,Mn),Ui.subVectors(bn,zn);let t=[0,-Z2.z,Z2.y,0,-X2.z,X2.y,0,-Ui.z,Ui.y,Z2.z,0,-Z2.x,X2.z,0,-X2.x,Ui.z,0,-Ui.x,-Z2.y,Z2.x,0,-X2.y,X2.x,0,-Ui.y,Ui.x,0];return!d6(t,bn,Mn,zn,i4)||(t=[1,0,0,0,1,0,0,0,1],!d6(t,bn,Mn,zn,i4))?!1:(n4.crossVectors(Z2,X2),t=[n4.x,n4.y,n4.z],d6(t,bn,Mn,zn,i4))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return Oi.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=this.getSize(Oi).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)}};X1.prototype.isBox3=!0;var y2=[new Y,new Y,new Y,new Y,new Y,new Y,new Y,new Y],Oi=new Y,f6=new X1,bn=new Y,Mn=new Y,zn=new Y,Z2=new Y,X2=new Y,Ui=new Y,es=new Y,i4=new Y,n4=new Y,qi=new Y;function d6(a,e,t,i,n){for(let r=0,s=a.length-3;r<=s;r+=3){qi.fromArray(a,r);let o=n.x*Math.abs(qi.x)+n.y*Math.abs(qi.y)+n.z*Math.abs(qi.z),c=e.dot(qi),l=t.dot(qi),h=i.dot(qi);if(Math.max(-Math.max(c,l,h),Math.min(c,l,h))>o)return!1}return!0}var Y1=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 r=n.indexOf(t);r!==-1&&n.splice(r,1)}}dispatchEvent(e){if(this._listeners===void 0)return;let i=this._listeners[e.type];if(i!==void 0){e.target=this;let n=i.slice(0);for(let r=0,s=n.length;r<s;r++)n[r].call(this,e);e.target=null}}};var fp=new X1,b5=new Y,r4=new Y,p6=new Y,Y2=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):fp.setFromPoints(e).getCenter(i);let n=0;for(let r=0,s=e.length;r<s;r++)n=Math.max(n,i.distanceToSquared(e[r]));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){p6.subVectors(e,this.center);let t=p6.lengthSq();if(t>this.radius*this.radius){let i=Math.sqrt(t),n=(i-this.radius)*.5;this.center.add(p6.multiplyScalar(n/i)),this.radius+=n}return this}union(e){return this.center.equals(e.center)===!0?r4.set(0,0,1).multiplyScalar(e.radius):r4.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(b5.copy(e.center).add(r4)),this.expandByPoint(b5.copy(e.center).sub(r4)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}};var Zt=class a{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,r,s,o,c,l,h,u,f,d,p,v,x){let g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=n,g[1]=r,g[5]=s,g[9]=o,g[13]=c,g[2]=l,g[6]=h,g[10]=u,g[14]=f,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 a().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/Cn.setFromMatrixColumn(e,0).length(),r=1/Cn.setFromMatrixColumn(e,1).length(),s=1/Cn.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]*r,t[5]=i[5]*r,t[6]=i[6]*r,t[7]=0,t[8]=i[8]*s,t[9]=i[9]*s,t[10]=i[10]*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");let t=this.elements,i=e.x,n=e.y,r=e.z,s=Math.cos(i),o=Math.sin(i),c=Math.cos(n),l=Math.sin(n),h=Math.cos(r),u=Math.sin(r);if(e.order==="XYZ"){let f=s*h,d=s*u,p=o*h,v=o*u;t[0]=c*h,t[4]=-c*u,t[8]=l,t[1]=d+p*l,t[5]=f-v*l,t[9]=-o*c,t[2]=v-f*l,t[6]=p+d*l,t[10]=s*c}else if(e.order==="YXZ"){let f=c*h,d=c*u,p=l*h,v=l*u;t[0]=f+v*o,t[4]=p*o-d,t[8]=s*l,t[1]=s*u,t[5]=s*h,t[9]=-o,t[2]=d*o-p,t[6]=v+f*o,t[10]=s*c}else if(e.order==="ZXY"){let f=c*h,d=c*u,p=l*h,v=l*u;t[0]=f-v*o,t[4]=-s*u,t[8]=p+d*o,t[1]=d+p*o,t[5]=s*h,t[9]=v-f*o,t[2]=-s*l,t[6]=o,t[10]=s*c}else if(e.order==="ZYX"){let f=s*h,d=s*u,p=o*h,v=o*u;t[0]=c*h,t[4]=p*l-d,t[8]=f*l+v,t[1]=c*u,t[5]=v*l+f,t[9]=d*l-p,t[2]=-l,t[6]=o*c,t[10]=s*c}else if(e.order==="YZX"){let f=s*c,d=s*l,p=o*c,v=o*l;t[0]=c*h,t[4]=v-f*u,t[8]=p*u+d,t[1]=u,t[5]=s*h,t[9]=-o*h,t[2]=-l*h,t[6]=d*u+p,t[10]=f-v*u}else if(e.order==="XZY"){let f=s*c,d=s*l,p=o*c,v=o*l;t[0]=c*h,t[4]=-u,t[8]=l*h,t[1]=f*u+v,t[5]=s*h,t[9]=d*u-p,t[2]=p*u-d,t[6]=o*h,t[10]=v*u+f}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(dp,e,pp)}lookAt(e,t,i){let n=this.elements;return s1.subVectors(e,t),s1.lengthSq()===0&&(s1.z=1),s1.normalize(),$2.crossVectors(i,s1),$2.lengthSq()===0&&(Math.abs(i.z)===1?s1.x+=1e-4:s1.z+=1e-4,s1.normalize(),$2.crossVectors(i,s1)),$2.normalize(),s4.crossVectors(s1,$2),n[0]=$2.x,n[4]=s4.x,n[8]=s1.x,n[1]=$2.y,n[5]=s4.y,n[9]=s1.y,n[2]=$2.z,n[6]=s4.z,n[10]=s1.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,r=this.elements,s=i[0],o=i[4],c=i[8],l=i[12],h=i[1],u=i[5],f=i[9],d=i[13],p=i[2],v=i[6],x=i[10],g=i[14],m=i[3],M=i[7],y=i[11],b=i[15],C=n[0],_=n[4],S=n[8],P=n[12],H=n[1],w=n[5],T=n[9],A=n[13],R=n[2],V=n[6],L=n[10],N=n[14],I=n[3],W=n[7],O=n[11],q=n[15];return r[0]=s*C+o*H+c*R+l*I,r[4]=s*_+o*w+c*V+l*W,r[8]=s*S+o*T+c*L+l*O,r[12]=s*P+o*A+c*N+l*q,r[1]=h*C+u*H+f*R+d*I,r[5]=h*_+u*w+f*V+d*W,r[9]=h*S+u*T+f*L+d*O,r[13]=h*P+u*A+f*N+d*q,r[2]=p*C+v*H+x*R+g*I,r[6]=p*_+v*w+x*V+g*W,r[10]=p*S+v*T+x*L+g*O,r[14]=p*P+v*A+x*N+g*q,r[3]=m*C+M*H+y*R+b*I,r[7]=m*_+M*w+y*V+b*W,r[11]=m*S+M*T+y*L+b*O,r[15]=m*P+M*A+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],r=e[12],s=e[1],o=e[5],c=e[9],l=e[13],h=e[2],u=e[6],f=e[10],d=e[14],p=e[3],v=e[7],x=e[11],g=e[15];return p*(+r*c*u-n*l*u-r*o*f+i*l*f+n*o*d-i*c*d)+v*(+t*c*d-t*l*f+r*s*f-n*s*d+n*l*h-r*c*h)+x*(+t*l*u-t*o*d-r*s*u+i*s*d+r*o*h-i*l*h)+g*(-n*o*h-t*c*u+t*o*f+n*s*u-i*s*f+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],r=e[3],s=e[4],o=e[5],c=e[6],l=e[7],h=e[8],u=e[9],f=e[10],d=e[11],p=e[12],v=e[13],x=e[14],g=e[15],m=u*x*l-v*f*l+v*c*d-o*x*d-u*c*g+o*f*g,M=p*f*l-h*x*l-p*c*d+s*x*d+h*c*g-s*f*g,y=h*v*l-p*u*l+p*o*d-s*v*d-h*o*g+s*u*g,b=p*u*c-h*v*c-p*o*f+s*v*f+h*o*x-s*u*x,C=t*m+i*M+n*y+r*b;if(C===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let _=1/C;return e[0]=m*_,e[1]=(v*f*r-u*x*r-v*n*d+i*x*d+u*n*g-i*f*g)*_,e[2]=(o*x*r-v*c*r+v*n*l-i*x*l-o*n*g+i*c*g)*_,e[3]=(u*c*r-o*f*r-u*n*l+i*f*l+o*n*d-i*c*d)*_,e[4]=M*_,e[5]=(h*x*r-p*f*r+p*n*d-t*x*d-h*n*g+t*f*g)*_,e[6]=(p*c*r-s*x*r-p*n*l+t*x*l+s*n*g-t*c*g)*_,e[7]=(s*f*r-h*c*r+h*n*l-t*f*l-s*n*d+t*c*d)*_,e[8]=y*_,e[9]=(p*u*r-h*v*r-p*i*d+t*v*d+h*i*g-t*u*g)*_,e[10]=(s*v*r-p*o*r+p*i*l-t*v*l-s*i*g+t*o*g)*_,e[11]=(h*o*r-s*u*r-h*i*l+t*u*l+s*i*d-t*o*d)*_,e[12]=b*_,e[13]=(h*v*n-p*u*n+p*i*f-t*v*f-h*i*x+t*u*x)*_,e[14]=(p*o*n-s*v*n-p*i*c+t*v*c+s*i*x-t*o*x)*_,e[15]=(s*u*n-h*o*n+h*i*c-t*u*c-s*i*f+t*o*f)*_,this}scale(e){let t=this.elements,i=e.x,n=e.y,r=e.z;return t[0]*=i,t[4]*=n,t[8]*=r,t[1]*=i,t[5]*=n,t[9]*=r,t[2]*=i,t[6]*=n,t[10]*=r,t[3]*=i,t[7]*=n,t[11]*=r,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],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),r=1-i,s=e.x,o=e.y,c=e.z,l=r*s,h=r*o;return this.set(l*s+i,l*o-n*c,l*c+n*o,0,l*o+n*c,h*o+i,h*c-n*s,0,l*c-n*o,h*c+n*s,r*c*c+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,n,r,s){return this.set(1,i,r,0,e,1,s,0,t,n,1,0,0,0,0,1),this}compose(e,t,i){let n=this.elements,r=t._x,s=t._y,o=t._z,c=t._w,l=r+r,h=s+s,u=o+o,f=r*l,d=r*h,p=r*u,v=s*h,x=s*u,g=o*u,m=c*l,M=c*h,y=c*u,b=i.x,C=i.y,_=i.z;return n[0]=(1-(v+g))*b,n[1]=(d+y)*b,n[2]=(p-M)*b,n[3]=0,n[4]=(d-y)*C,n[5]=(1-(f+g))*C,n[6]=(x+m)*C,n[7]=0,n[8]=(p+M)*_,n[9]=(x-m)*_,n[10]=(1-(f+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,r=Cn.set(n[0],n[1],n[2]).length(),s=Cn.set(n[4],n[5],n[6]).length(),o=Cn.set(n[8],n[9],n[10]).length();this.determinant()<0&&(r=-r),e.x=n[12],e.y=n[13],e.z=n[14],T1.copy(this);let l=1/r,h=1/s,u=1/o;return T1.elements[0]*=l,T1.elements[1]*=l,T1.elements[2]*=l,T1.elements[4]*=h,T1.elements[5]*=h,T1.elements[6]*=h,T1.elements[8]*=u,T1.elements[9]*=u,T1.elements[10]*=u,t.setFromRotationMatrix(T1),i.x=r,i.y=s,i.z=o,this}makePerspective(e,t,i,n,r,s){s===void 0&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");let o=this.elements,c=2*r/(t-e),l=2*r/(i-n),h=(t+e)/(t-e),u=(i+n)/(i-n),f=-(s+r)/(s-r),d=-2*s*r/(s-r);return o[0]=c,o[4]=0,o[8]=h,o[12]=0,o[1]=0,o[5]=l,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=f,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(e,t,i,n,r,s){let o=this.elements,c=1/(t-e),l=1/(i-n),h=1/(s-r),u=(t+e)*c,f=(i+n)*l,d=(s+r)*h;return o[0]=2*c,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-f,o[2]=0,o[6]=0,o[10]=-2*h,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[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}};Zt.prototype.isMatrix4=!0;var Cn=new Y,T1=new Zt,dp=new Y(0,0,0),pp=new Y(1,1,1),$2=new Y,s4=new Y,s1=new Y;var M5=new Zt,z5=new _1,Gi=class a{constructor(e=0,t=0,i=0,n=a.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,r=n[0],s=n[4],o=n[8],c=n[1],l=n[5],h=n[9],u=n[2],f=n[6],d=n[10];switch(t){case"XYZ":this._y=Math.asin(Qt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(f,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Qt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(Qt(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(c,r));break;case"ZYX":this._y=Math.asin(-Qt(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(f,d),this._z=Math.atan2(c,r)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(Qt(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-Qt(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(f,l),this._y=Math.atan2(o,r)):(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 M5.makeRotationFromQuaternion(e),this.setFromRotationMatrix(M5,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return z5.setFromEuler(this),this.setFromQuaternion(z5,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(){}};Gi.prototype.isEuler=!0;Gi.DefaultOrder="XYZ";Gi.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];var a4=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}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 w2=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,r,s,o,c,l){let h=this.elements;return h[0]=e,h[1]=n,h[2]=o,h[3]=t,h[4]=r,h[5]=c,h[6]=i,h[7]=s,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,r=this.elements,s=i[0],o=i[3],c=i[6],l=i[1],h=i[4],u=i[7],f=i[2],d=i[5],p=i[8],v=n[0],x=n[3],g=n[6],m=n[1],M=n[4],y=n[7],b=n[2],C=n[5],_=n[8];return r[0]=s*v+o*m+c*b,r[3]=s*x+o*M+c*C,r[6]=s*g+o*y+c*_,r[1]=l*v+h*m+u*b,r[4]=l*x+h*M+u*C,r[7]=l*g+h*y+u*_,r[2]=f*v+d*m+p*b,r[5]=f*x+d*M+p*C,r[8]=f*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],r=e[3],s=e[4],o=e[5],c=e[6],l=e[7],h=e[8];return t*s*h-t*o*l-i*r*h+i*o*c+n*r*l-n*s*c}invert(){let e=this.elements,t=e[0],i=e[1],n=e[2],r=e[3],s=e[4],o=e[5],c=e[6],l=e[7],h=e[8],u=h*s-o*l,f=o*c-h*r,d=l*r-s*c,p=t*u+i*f+n*d;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let v=1/p;return e[0]=u*v,e[1]=(n*l-h*i)*v,e[2]=(o*i-n*s)*v,e[3]=f*v,e[4]=(h*t-n*c)*v,e[5]=(n*r-o*t)*v,e[6]=d*v,e[7]=(i*c-l*t)*v,e[8]=(s*t-i*r)*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,r,s,o){let c=Math.cos(r),l=Math.sin(r);return this.set(i*c,i*l,-i*(c*s+l*o)+s+e,-n*l,n*c,-n*(-l*s+c*o)+o+t,0,0,1),this}scale(e,t){let i=this.elements;return i[0]*=e,i[3]*=e,i[6]*=e,i[1]*=t,i[4]*=t,i[7]*=t,this}rotate(e){let t=Math.cos(e),i=Math.sin(e),n=this.elements,r=n[0],s=n[3],o=n[6],c=n[1],l=n[4],h=n[7];return n[0]=t*r+i*c,n[3]=t*s+i*l,n[6]=t*o+i*h,n[1]=-i*r+t*c,n[4]=-i*s+t*l,n[7]=-i*o+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)}};w2.prototype.isMatrix3=!0;var mp=0,C5=new Y,An=new _1,b2=new Zt,o4=new Y,ts=new Y,gp=new Y,vp=new _1,A5=new Y(1,0,0),S5=new Y(0,1,0),_5=new Y(0,0,1),xp={type:"added"},E5={type:"removed"},M2=class a extends Y1{constructor(){super(),Object.defineProperty(this,"id",{value:mp++}),this.uuid=x2(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=a.DefaultUp.clone();let e=new Y,t=new Gi,i=new _1,n=new Y(1,1,1);function r(){i.setFromEuler(t,!1)}function s(){t.setFromQuaternion(i,void 0,!1)}t._onChange(r),i._onChange(s),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new Zt},normalMatrix:{value:new w2}}),this.matrix=new Zt,this.matrixWorld=new Zt,this.matrixAutoUpdate=a.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new a4,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 An.setFromAxisAngle(e,t),this.quaternion.multiply(An),this}rotateOnWorldAxis(e,t){return An.setFromAxisAngle(e,t),this.quaternion.premultiply(An),this}rotateX(e){return this.rotateOnAxis(A5,e)}rotateY(e){return this.rotateOnAxis(S5,e)}rotateZ(e){return this.rotateOnAxis(_5,e)}translateOnAxis(e,t){return C5.copy(e).applyQuaternion(this.quaternion),this.position.add(C5.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(A5,e)}translateY(e){return this.translateOnAxis(S5,e)}translateZ(e){return this.translateOnAxis(_5,e)}localToWorld(e){return e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return e.applyMatrix4(b2.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?o4.copy(e):o4.set(e,t,i);let n=this.parent;this.updateWorldMatrix(!0,!1),ts.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?b2.lookAt(ts,o4,this.up):b2.lookAt(o4,ts,this.up),this.quaternion.setFromRotationMatrix(b2),n&&(b2.extractRotation(n.matrixWorld),An.setFromRotationMatrix(b2),this.quaternion.premultiply(An.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(xp)):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(E5)),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(E5)}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 s=this.children[i].getObjectByProperty(e,t);if(s!==void 0)return s}}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ts,e,gp),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ts,vp,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 r=0,s=n.length;r<s;r++)n[r].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 r(o,c){return o[c.uuid]===void 0&&(o[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=r(e.geometries,this.geometry);let o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){let c=o.shapes;if(Array.isArray(c))for(let l=0,h=c.length;l<h;l++){let u=c[l];r(e.shapes,u)}else r(e.shapes,c)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(e.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let o=[];for(let c=0,l=this.material.length;c<l;c++)o.push(r(e.materials,this.material[c]));n.material=o}else n.material=r(e.materials,this.material);if(this.children.length>0){n.children=[];for(let o=0;o<this.children.length;o++)n.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){n.animations=[];for(let o=0;o<this.animations.length;o++){let c=this.animations[o];n.animations.push(r(e.animations,c))}}if(t){let o=s(e.geometries),c=s(e.materials),l=s(e.textures),h=s(e.images),u=s(e.shapes),f=s(e.skeletons),d=s(e.animations);o.length>0&&(i.geometries=o),c.length>0&&(i.materials=c),l.length>0&&(i.textures=l),h.length>0&&(i.images=h),u.length>0&&(i.shapes=u),f.length>0&&(i.skeletons=f),d.length>0&&(i.animations=d)}return i.object=n,i;function s(o){let c=[];for(let l in o){let h=o[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}};M2.DefaultUp=new Y(0,1,0);M2.DefaultMatrixAutoUpdate=!0;M2.prototype.isObject3D=!0;function L5(a){for(let e=a.length-1;e>=0;--e)if(a[e]>65535)return!0;return!1}function m6(a){return document.createElementNS("http://www.w3.org/1999/xhtml",a)}var yp=0,g1=new Zt,g6=new M2,Sn=new Y,a1=new X1,is=new X1,Tt=new Y,Wi=class a extends Y1{constructor(){super(),Object.defineProperty(this,"id",{value:yp++}),this.uuid=x2(),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(L5(e)?t4:e4)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let i=this.attributes.normal;if(i!==void 0){let r=new w2().getNormalMatrix(e);i.applyNormalMatrix(r),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 g1.makeRotationFromQuaternion(e),this.applyMatrix4(g1),this}rotateX(e){return g1.makeRotationX(e),this.applyMatrix4(g1),this}rotateY(e){return g1.makeRotationY(e),this.applyMatrix4(g1),this}rotateZ(e){return g1.makeRotationZ(e),this.applyMatrix4(g1),this}translate(e,t,i){return g1.makeTranslation(e,t,i),this.applyMatrix4(g1),this}scale(e,t,i){return g1.makeScale(e,t,i),this.applyMatrix4(g1),this}lookAt(e){return g6.lookAt(e),g6.updateMatrix(),this.applyMatrix4(g6.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Sn).negate(),this.translate(Sn.x,Sn.y,Sn.z),this}setFromPoints(e){let t=[];for(let i=0,n=e.length;i<n;i++){let r=e[i];t.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new j2(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new X1);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 r=t[i];a1.setFromBufferAttribute(r),this.morphTargetsRelative?(Tt.addVectors(this.boundingBox.min,a1.min),this.boundingBox.expandByPoint(Tt),Tt.addVectors(this.boundingBox.max,a1.max),this.boundingBox.expandByPoint(Tt)):(this.boundingBox.expandByPoint(a1.min),this.boundingBox.expandByPoint(a1.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 Y2);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(a1.setFromBufferAttribute(e),t)for(let r=0,s=t.length;r<s;r++){let o=t[r];is.setFromBufferAttribute(o),this.morphTargetsRelative?(Tt.addVectors(a1.min,is.min),a1.expandByPoint(Tt),Tt.addVectors(a1.max,is.max),a1.expandByPoint(Tt)):(a1.expandByPoint(is.min),a1.expandByPoint(is.max))}a1.getCenter(i);let n=0;for(let r=0,s=e.count;r<s;r++)Tt.fromBufferAttribute(e,r),n=Math.max(n,i.distanceToSquared(Tt));if(t)for(let r=0,s=t.length;r<s;r++){let o=t[r],c=this.morphTargetsRelative;for(let l=0,h=o.count;l<h;l++)Tt.fromBufferAttribute(o,l),c&&(Sn.fromBufferAttribute(e,l),Tt.add(Sn)),n=Math.max(n,i.distanceToSquared(Tt))}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,r=t.normal.array,s=t.uv.array,o=n.length/3;t.tangent===void 0&&this.setAttribute("tangent",new L1(new Float32Array(4*o),4));let c=t.tangent.array,l=[],h=[];for(let H=0;H<o;H++)l[H]=new Y,h[H]=new Y;let u=new Y,f=new Y,d=new Y,p=new ut,v=new ut,x=new ut,g=new Y,m=new Y;function M(H,w,T){u.fromArray(n,H*3),f.fromArray(n,w*3),d.fromArray(n,T*3),p.fromArray(s,H*2),v.fromArray(s,w*2),x.fromArray(s,T*2),f.sub(u),d.sub(u),v.sub(p),x.sub(p);let A=1/(v.x*x.y-x.x*v.y);isFinite(A)&&(g.copy(f).multiplyScalar(x.y).addScaledVector(d,-v.y).multiplyScalar(A),m.copy(d).multiplyScalar(v.x).addScaledVector(f,-x.x).multiplyScalar(A),l[H].add(g),l[w].add(g),l[T].add(g),h[H].add(m),h[w].add(m),h[T].add(m))}let y=this.groups;y.length===0&&(y=[{start:0,count:i.length}]);for(let H=0,w=y.length;H<w;++H){let T=y[H],A=T.start,R=T.count;for(let V=A,L=A+R;V<L;V+=3)M(i[V+0],i[V+1],i[V+2])}let b=new Y,C=new Y,_=new Y,S=new Y;function P(H){_.fromArray(r,H*3),S.copy(_);let w=l[H];b.copy(w),b.sub(_.multiplyScalar(_.dot(w))).normalize(),C.crossVectors(S,w);let A=C.dot(h[H])<0?-1:1;c[H*4]=b.x,c[H*4+1]=b.y,c[H*4+2]=b.z,c[H*4+3]=A}for(let H=0,w=y.length;H<w;++H){let T=y[H],A=T.start,R=T.count;for(let V=A,L=A+R;V<L;V+=3)P(i[V+0]),P(i[V+1]),P(i[V+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 L1(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let f=0,d=i.count;f<d;f++)i.setXYZ(f,0,0,0);let n=new Y,r=new Y,s=new Y,o=new Y,c=new Y,l=new Y,h=new Y,u=new Y;if(e)for(let f=0,d=e.count;f<d;f+=3){let p=e.getX(f+0),v=e.getX(f+1),x=e.getX(f+2);n.fromBufferAttribute(t,p),r.fromBufferAttribute(t,v),s.fromBufferAttribute(t,x),h.subVectors(s,r),u.subVectors(n,r),h.cross(u),o.fromBufferAttribute(i,p),c.fromBufferAttribute(i,v),l.fromBufferAttribute(i,x),o.add(h),c.add(h),l.add(h),i.setXYZ(p,o.x,o.y,o.z),i.setXYZ(v,c.x,c.y,c.z),i.setXYZ(x,l.x,l.y,l.z)}else for(let f=0,d=t.count;f<d;f+=3)n.fromBufferAttribute(t,f+0),r.fromBufferAttribute(t,f+1),s.fromBufferAttribute(t,f+2),h.subVectors(s,r),u.subVectors(n,r),h.cross(u),i.setXYZ(f+0,h.x,h.y,h.z),i.setXYZ(f+1,h.x,h.y,h.z),i.setXYZ(f+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 s=i[n].array,o=e.attributes[n],c=o.array,l=o.itemSize*t,h=Math.min(c.length,s.length-l);for(let u=0,f=l;u<h;u++,f++)s[f]=c[u]}return this}normalizeNormals(){let e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)Tt.fromBufferAttribute(e,t),Tt.normalize(),e.setXYZ(t,Tt.x,Tt.y,Tt.z)}toNonIndexed(){function e(o,c){let l=o.array,h=o.itemSize,u=o.normalized,f=new l.constructor(c.length*h),d=0,p=0;for(let v=0,x=c.length;v<x;v++){o.isInterleavedBufferAttribute?d=c[v]*o.data.stride+o.offset:d=c[v]*h;for(let g=0;g<h;g++)f[p++]=l[d++]}return new L1(f,h,u)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new a,i=this.index.array,n=this.attributes;for(let o in n){let c=n[o],l=e(c,i);t.setAttribute(o,l)}let r=this.morphAttributes;for(let o in r){let c=[],l=r[o];for(let h=0,u=l.length;h<u;h++){let f=l[h],d=e(f,i);c.push(d)}t.morphAttributes[o]=c}t.morphTargetsRelative=this.morphTargetsRelative;let s=this.groups;for(let o=0,c=s.length;o<c;o++){let l=s[o];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={},r=!1;for(let c in this.morphAttributes){let l=this.morphAttributes[c],h=[];for(let u=0,f=l.length;u<f;u++){let d=l[u];h.push(d.toJSON(e.data))}h.length>0&&(n[c]=h,r=!0)}r&&(e.data.morphAttributes=n,e.data.morphTargetsRelative=this.morphTargetsRelative);let s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));let o=this.boundingSphere;return o!==null&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let i=e.index;i!==null&&this.setIndex(i.clone(t));let n=e.attributes;for(let l in n){let h=n[l];this.setAttribute(l,h.clone(t))}let r=e.morphAttributes;for(let l in r){let h=[],u=r[l];for(let f=0,d=u.length;f<d;f++)h.push(u[f].clone(t));this.morphAttributes[l]=h}this.morphTargetsRelative=e.morphTargetsRelative;let s=e.groups;for(let l=0,h=s.length;l<h;l++){let u=s[l];this.addGroup(u.start,u.count,u.materialIndex)}let o=e.boundingBox;o!==null&&(this.boundingBox=o.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"})}};Wi.prototype.isBufferGeometry=!0;var wp=0,ji=class extends Y1{constructor(){super(),Object.defineProperty(this,"id",{value:wp++}),this.uuid=x2(),this.name="",this.type="Material",this.fog=!0,this.blending=a6,this.side=s6,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=u5,this.blendDst=f5,this.blendEquation=h5,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=d5,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=w5,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Qa,this.stencilZFail=Qa,this.stencilZPass=Qa,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===l5;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!==a6&&(i.blending=this.blending),this.side!==s6&&(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(r){let s=[];for(let o in r){let c=r[o];delete c.metadata,s.push(c)}return s}if(t){let r=n(e.textures),s=n(e.images);r.length>0&&(i.textures=r),s.length>0&&(i.images=s)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,i=null;if(t!==null){let n=t.length;i=new Array(n);for(let r=0;r!==n;++r)i[r]=t[r].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.alphaWrite=e.alphaWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}};ji.prototype.isMaterial=!0;var _n=class extends ji{constructor(e){super(),this.type="MeshPhongMaterial",this.color=new jt(16777215),this.specular=new jt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new jt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=y5,this.normalScale=new ut(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Ja,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}};_n.prototype.isMeshPhongMaterial=!0;var z2=new Y,v6=new Y,c4=new Y,J2=new Y,x6=new Y,l4=new Y,y6=new Y,h4=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,z2)),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=z2.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(z2.copy(this.direction).multiplyScalar(t).add(this.origin),z2.distanceToSquared(e))}distanceSqToSegment(e,t,i,n){v6.copy(e).add(t).multiplyScalar(.5),c4.copy(t).sub(e).normalize(),J2.copy(this.origin).sub(v6);let r=e.distanceTo(t)*.5,s=-this.direction.dot(c4),o=J2.dot(this.direction),c=-J2.dot(c4),l=J2.lengthSq(),h=Math.abs(1-s*s),u,f,d,p;if(h>0)if(u=s*c-o,f=s*o-c,p=r*h,u>=0)if(f>=-p)if(f<=p){let v=1/h;u*=v,f*=v,d=u*(u+s*f+2*o)+f*(s*u+f+2*c)+l}else f=r,u=Math.max(0,-(s*f+o)),d=-u*u+f*(f+2*c)+l;else f=-r,u=Math.max(0,-(s*f+o)),d=-u*u+f*(f+2*c)+l;else f<=-p?(u=Math.max(0,-(-s*r+o)),f=u>0?-r:Math.min(Math.max(-r,-c),r),d=-u*u+f*(f+2*c)+l):f<=p?(u=0,f=Math.min(Math.max(-r,-c),r),d=f*(f+2*c)+l):(u=Math.max(0,-(s*r+o)),f=u>0?r:Math.min(Math.max(-r,-c),r),d=-u*u+f*(f+2*c)+l);else f=s>0?-r:r,u=Math.max(0,-(s*f+o)),d=-u*u+f*(f+2*c)+l;return i&&i.copy(this.direction).multiplyScalar(u).add(this.origin),n&&n.copy(c4).multiplyScalar(f).add(v6),d}intersectSphere(e,t){z2.subVectors(e.center,this.origin);let i=z2.dot(this.direction),n=z2.dot(z2)-i*i,r=e.radius*e.radius;if(n>r)return null;let s=Math.sqrt(r-n),o=i-s,c=i+s;return o<0&&c<0?null:o<0?this.at(c,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){let i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,n,r,s,o,c,l=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,f=this.origin;return l>=0?(i=(e.min.x-f.x)*l,n=(e.max.x-f.x)*l):(i=(e.max.x-f.x)*l,n=(e.min.x-f.x)*l),h>=0?(r=(e.min.y-f.y)*h,s=(e.max.y-f.y)*h):(r=(e.max.y-f.y)*h,s=(e.min.y-f.y)*h),i>s||r>n||((r>i||i!==i)&&(i=r),(s<n||n!==n)&&(n=s),u>=0?(o=(e.min.z-f.z)*u,c=(e.max.z-f.z)*u):(o=(e.max.z-f.z)*u,c=(e.min.z-f.z)*u),i>c||o>n)||((o>i||i!==i)&&(i=o),(c<n||n!==n)&&(n=c),n<0)?null:this.at(i>=0?i:n,t)}intersectsBox(e){return this.intersectBox(e,z2)!==null}intersectTriangle(e,t,i,n,r){x6.subVectors(t,e),l4.subVectors(i,e),y6.crossVectors(x6,l4);let s=this.direction.dot(y6),o;if(s>0){if(n)return null;o=1}else if(s<0)o=-1,s=-s;else return null;J2.subVectors(this.origin,e);let c=o*this.direction.dot(l4.crossVectors(J2,l4));if(c<0)return null;let l=o*this.direction.dot(x6.cross(J2));if(l<0||c+l>s)return null;let h=-o*J2.dot(y6);return h<0?null:this.at(h/s,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}};var D1=new Y,C2=new Y,w6=new Y,A2=new Y,En=new Y,Ln=new Y,T5=new Y,b6=new Y,M6=new Y,z6=new Y,Tn=class a{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),D1.subVectors(e,t),n.cross(D1);let r=n.lengthSq();return r>0?n.multiplyScalar(1/Math.sqrt(r)):n.set(0,0,0)}static getBarycoord(e,t,i,n,r){D1.subVectors(n,t),C2.subVectors(i,t),w6.subVectors(e,t);let s=D1.dot(D1),o=D1.dot(C2),c=D1.dot(w6),l=C2.dot(C2),h=C2.dot(w6),u=s*l-o*o;if(u===0)return r.set(-2,-1,-1);let f=1/u,d=(l*c-o*h)*f,p=(s*h-o*c)*f;return r.set(1-d-p,p,d)}static containsPoint(e,t,i,n){return this.getBarycoord(e,t,i,n,A2),A2.x>=0&&A2.y>=0&&A2.x+A2.y<=1}static getUV(e,t,i,n,r,s,o,c){return this.getBarycoord(e,t,i,n,A2),c.set(0,0),c.addScaledVector(r,A2.x),c.addScaledVector(s,A2.y),c.addScaledVector(o,A2.z),c}static isFrontFacing(e,t,i,n){return D1.subVectors(i,t),C2.subVectors(e,t),D1.cross(C2).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 D1.subVectors(this.c,this.b),C2.subVectors(this.a,this.b),D1.cross(C2).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return a.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return a.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,n,r){return a.getUV(e,this.a,this.b,this.c,t,i,n,r)}containsPoint(e){return a.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return a.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let i=this.a,n=this.b,r=this.c,s,o;En.subVectors(n,i),Ln.subVectors(r,i),b6.subVectors(e,i);let c=En.dot(b6),l=Ln.dot(b6);if(c<=0&&l<=0)return t.copy(i);M6.subVectors(e,n);let h=En.dot(M6),u=Ln.dot(M6);if(h>=0&&u<=h)return t.copy(n);let f=c*u-h*l;if(f<=0&&c>=0&&h<=0)return s=c/(c-h),t.copy(i).addScaledVector(En,s);z6.subVectors(e,r);let d=En.dot(z6),p=Ln.dot(z6);if(p>=0&&d<=p)return t.copy(r);let v=d*l-c*p;if(v<=0&&l>=0&&p<=0)return o=l/(l-p),t.copy(i).addScaledVector(Ln,o);let x=h*p-d*u;if(x<=0&&u-h>=0&&d-p>=0)return T5.subVectors(r,n),o=(u-h)/(u-h+(d-p)),t.copy(n).addScaledVector(T5,o);let g=1/(x+v+f);return s=v*g,o=f*g,t.copy(i).addScaledVector(En,s).addScaledVector(Ln,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}};var ns=class extends ji{constructor(e){super(),this.type="MeshBasicMaterial",this.color=new jt(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=Ja,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}};ns.prototype.isMeshBasicMaterial=!0;var D5=new Zt,Dn=new h4,C6=new Y2,Q2=new Y,K2=new Y,ei=new Y,A6=new Y,S6=new Y,_6=new Y,u4=new Y,f4=new Y,d4=new Y,p4=new ut,m4=new ut,g4=new ut,E6=new Y,v4=new Y,rs=class extends M2{constructor(e=new Wi,t=new ns){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 r=0,s=n.length;r<s;r++){let o=n[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}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,r=this.matrixWorld;if(n===void 0||(i.boundingSphere===null&&i.computeBoundingSphere(),C6.copy(i.boundingSphere),C6.applyMatrix4(r),e.ray.intersectsSphere(C6)===!1)||(D5.copy(r).invert(),Dn.copy(e.ray).applyMatrix4(D5),i.boundingBox!==null&&Dn.intersectsBox(i.boundingBox)===!1))return;let s;if(i.isBufferGeometry){let o=i.index,c=i.attributes.position,l=i.morphAttributes.position,h=i.morphTargetsRelative,u=i.attributes.uv,f=i.attributes.uv2,d=i.groups,p=i.drawRange;if(o!==null)if(Array.isArray(n))for(let v=0,x=d.length;v<x;v++){let g=d[v],m=n[g.materialIndex],M=Math.max(g.start,p.start),y=Math.min(o.count,Math.min(g.start+g.count,p.start+p.count));for(let b=M,C=y;b<C;b+=3){let _=o.getX(b),S=o.getX(b+1),P=o.getX(b+2);s=x4(this,m,e,Dn,c,l,h,u,f,_,S,P),s&&(s.faceIndex=Math.floor(b/3),s.face.materialIndex=g.materialIndex,t.push(s))}}else{let v=Math.max(0,p.start),x=Math.min(o.count,p.start+p.count);for(let g=v,m=x;g<m;g+=3){let M=o.getX(g),y=o.getX(g+1),b=o.getX(g+2);s=x4(this,n,e,Dn,c,l,h,u,f,M,y,b),s&&(s.faceIndex=Math.floor(g/3),t.push(s))}}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],M=Math.max(g.start,p.start),y=Math.min(c.count,Math.min(g.start+g.count,p.start+p.count));for(let b=M,C=y;b<C;b+=3){let _=b,S=b+1,P=b+2;s=x4(this,m,e,Dn,c,l,h,u,f,_,S,P),s&&(s.faceIndex=Math.floor(b/3),s.face.materialIndex=g.materialIndex,t.push(s))}}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 M=g,y=g+1,b=g+2;s=x4(this,n,e,Dn,c,l,h,u,f,M,y,b),s&&(s.faceIndex=Math.floor(g/3),t.push(s))}}}else i.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}};rs.prototype.isMesh=!0;function bp(a,e,t,i,n,r,s,o){let c;if(e.side===o5?c=i.intersectTriangle(s,r,n,!0,o):c=i.intersectTriangle(n,r,s,e.side!==c5,o),c===null)return null;v4.copy(o),v4.applyMatrix4(a.matrixWorld);let l=t.ray.origin.distanceTo(v4);return l<t.near||l>t.far?null:{distance:l,point:v4.clone(),object:a}}function x4(a,e,t,i,n,r,s,o,c,l,h,u){Q2.fromBufferAttribute(n,l),K2.fromBufferAttribute(n,h),ei.fromBufferAttribute(n,u);let f=a.morphTargetInfluences;if(r&&f){u4.set(0,0,0),f4.set(0,0,0),d4.set(0,0,0);for(let p=0,v=r.length;p<v;p++){let x=f[p],g=r[p];x!==0&&(A6.fromBufferAttribute(g,l),S6.fromBufferAttribute(g,h),_6.fromBufferAttribute(g,u),s?(u4.addScaledVector(A6,x),f4.addScaledVector(S6,x),d4.addScaledVector(_6,x)):(u4.addScaledVector(A6.sub(Q2),x),f4.addScaledVector(S6.sub(K2),x),d4.addScaledVector(_6.sub(ei),x)))}Q2.add(u4),K2.add(f4),ei.add(d4)}a.isSkinnedMesh&&(a.boneTransform(l,Q2),a.boneTransform(h,K2),a.boneTransform(u,ei));let d=bp(a,e,t,i,Q2,K2,ei,E6);if(d){o&&(p4.fromBufferAttribute(o,l),m4.fromBufferAttribute(o,h),g4.fromBufferAttribute(o,u),d.uv=Tn.getUV(E6,Q2,K2,ei,p4,m4,g4,new ut)),c&&(p4.fromBufferAttribute(c,l),m4.fromBufferAttribute(c,h),g4.fromBufferAttribute(c,u),d.uv2=Tn.getUV(E6,Q2,K2,ei,p4,m4,g4,new ut));let p={a:l,b:h,c:u,normal:new Y,materialIndex:0};Tn.getNormal(Q2,K2,ei,p.normal),d.face=p}return d}var Hn,y4=class{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Hn===void 0&&(Hn=m6("canvas")),Hn.width=e.width,Hn.height=e.height;let i=Hn.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=Hn}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<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=m6("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),r=n.data;for(let s=0;s<r.length;s++)r[s]=ki(r[s]/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(ki(t[i]/255)*255):t[i]=ki(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 Mp=0,ti=class a extends Y1{constructor(e=a.DEFAULT_IMAGE,t=a.DEFAULT_MAPPING,i=Kr,n=Kr,r=p5,s=m5,o=v5,c=g5,l=1,h=x5){super(),Object.defineProperty(this,"id",{value:Mp++}),this.uuid=x2(),this.name="",this.image=e,this.mipmaps=[],this.mapping=t,this.wrapS=i,this.wrapT=n,this.magFilter=r,this.minFilter=s,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=c,this.offset=new ut(0,0),this.repeat=new ut(1,1),this.center=new ut(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new w2,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=x2()),!t&&e.images[n.uuid]===void 0){let r;if(Array.isArray(n)){r=[];for(let s=0,o=n.length;s<o;s++)n[s].isDataTexture?r.push(L6(n[s].image)):r.push(L6(n[s]))}else r=L6(n);e.images[n.uuid]={uuid:n.uuid,url:r}}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!==o6)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case c6:e.x=e.x-Math.floor(e.x);break;case Kr:e.x=e.x<0?0:1;break;case l6: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 c6:e.y=e.y-Math.floor(e.y);break;case Kr:e.y=e.y<0?0:1;break;case l6: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++}};ti.DEFAULT_IMAGE=void 0;ti.DEFAULT_MAPPING=o6;ti.prototype.isTexture=!0;function L6(a){return typeof HTMLImageElement<"u"&&a instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&a instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&a instanceof ImageBitmap?y4.getDataURL(a):a.data?{data:Array.prototype.slice.call(a.data),width:a.width,height:a.height,type:a.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var H5={specular:1515554,color:15790320,shininess:60,flatShading:!0},ii={diceColor:"#202020",textColor:"#ffffff",textFont:"Arial"},v1=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={...ii,...i},this.fontFace=this.options.textFont}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 rs(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 Te({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 r=e[n];t[n]=new z(r.x*this.radius,r.y*this.radius,r.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 Xr({vertices:t,faces:i})}getChamferGeometry(e){let t=[],i=[],n=new Array(e.length);for(let r=0;r<e.length;++r)n[r]=[];for(let r=0;r<this.faces.length;++r){let s=this.faces[r],o=s.length-1,c=new Y,l=new Array(o);for(let h=0;h<o;++h){let u=e[s[h]].clone();c.add(u),n[s[h]].push(l[h]=t.push(u)-1)}c.divideScalar(o);for(let h=0;h<o;++h){let u=t[l[h]];u.subVectors(u,c).multiplyScalar(this.chamfer).addVectors(u,c)}l.push(s[o]),i.push(l)}for(let r=0;r<this.faces.length-1;++r)for(let s=r+1;s<this.faces.length;++s){let o=[],c=-1;for(let l=0;l<this.faces[r].length-1;++l){let h=this.faces[s].indexOf(this.faces[r][l]);h>=0&&h<this.faces[s].length-1&&(c>=0&&l!==c+1?o.unshift([r,l],[s,h]):o.push([r,l],[s,h]),c=l)}o.length===4&&i.push([i[o[0][0]][o[0][1]],i[o[1][0]][o[1][1]],i[o[3][0]][o[3][1]],i[o[2][0]][o[2][1]],-1])}for(let r=0;r<n.length;++r){let s=n[r],o=[s[0]],c=s.length-1;for(;c;){for(let l=this.faces.length;l<i.length;++l){let h=i[l].indexOf(o[o.length-1]);if(h>=0&&h<4){--h===-1&&(h=3);let u=i[l][h];if(s.indexOf(u)>=0){o.push(u);break}}}--c}o.push(-1),i.push(o)}return{vectors:t,faces:i}}makeGeometry(e,t){let i=new Wi;for(let u=0;u<e.length;++u)e[u]=e[u].multiplyScalar(this.radius);let n=[],r=[],s=[],o=new Y,c=new Y,l,h=0;for(let u=0;u<t.length;++u){let f=t[u],d=f.length-1,p=Math.PI*2/d;l=f[d]+1;for(let x=0;x<d-2;++x)n.push(...e[f[0]].toArray()),n.push(...e[f[x+1]].toArray()),n.push(...e[f[x+2]].toArray()),o.subVectors(e[f[x+2]],e[f[x+1]]),c.subVectors(e[f[0]],e[f[x+1]]),o.cross(c),o.normalize(),r.push(...o.toArray()),r.push(...o.toArray()),r.push(...o.toArray()),s.push((Math.cos(this.af)+1+this.tab)/2/(1+this.tab),(Math.sin(this.af)+1+this.tab)/2/(1+this.tab)),s.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)),s.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 j2(n,3)),i.setAttribute("normal",new j2(r,3)),i.setAttribute("uv",new j2(s,2)),i.boundingSphere=new Y2(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 _n(Object.assign({},H5,{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,r=i.width/2,{context:s,fontsize:o}=this.getContext(i),c=s.measureText("M").width*1.4,l=t.split(`
`);l.length>1&&(o=o/l.length,s.font=`${o}pt '${this.fontFace}'`,c=s.measureText("M").width*1.2,n-=c*l.length/2);for(let u=0,f=l.length;u<f;u++){let d=l[u].trim();s.fillText(l[u],r,n),(d=="6"||d=="9")&&s.fillText(" .",r,n),n+=c*1.5}let h=new ti(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 Te({mass:this.mass,shape:this.shape}),geometry:this.geometry.clone(),values:this.values}}},w4=class extends v1{constructor(t,i,n={diceColor:"#171120",textColor:"#FF0000"},r){super(t,i,n,r);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]]}},b4=class extends v1{constructor(t,i,n={diceColor:"#7339BE",textColor:"#FFFFFF"},r){super(t,i,n,r);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,o=1/s;this.vertices=[[0,o,s],[0,o,-s],[0,-o,s],[0,-o,-s],[s,0,o],[s,0,-o],[-s,0,o],[-s,0,-o],[o,s,0],[o,-s,0],[-o,s,0],[-o,-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]]}},M4=class extends v1{constructor(t,i,n={diceColor:"#c74749",textColor:"#FFFFFF"},r){super(t,i,n,r);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,o=0;s<10;++s,o+=Math.PI*2/10)this.vertices.push([Math.cos(o),Math.sin(o),.105*(s%2?1:-1)]);this.vertices.push([0,0,-1]),this.vertices.push([0,0,1])}},z4=class extends v1{constructor(t,i,n={diceColor:"#7a2c2d",textColor:"#FFFFFF"},r){super(t,i,n,r);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,o=0;s<10;++s,o+=Math.PI*2/10)this.vertices.push([Math.cos(o),Math.sin(o),.105*(s%2?1:-1)]);this.vertices.push([0,0,-1]),this.vertices.push([0,0,1])}},C4=class extends v1{constructor(t,i,n={diceColor:"#5eb0c5",textColor:"#FFFFFF"},r){super(t,i,n,r);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}},A4=class extends v1{constructor(t,i,n={diceColor:"#d68316",textColor:"#FFFFFF"},r){super(t,i,n,r);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()]}},S4=class extends v1{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]}},_4=class extends v1{constructor(t,i,n={diceColor:"#93b139",textColor:"#FFFFFF"},r){super(t,i,n,r);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 t=[];for(let i=0;i<this.d4FaceTexts[0].length;++i){let n=null;n=this.createTextTexture(i),t.push(new _n(Object.assign({},H5,{map:n})))}return t}createTextTexture(t){let i=document.createElement("canvas"),n=i.getContext("2d"),r=this.calculateTextureSize(this.radius/2+this.radius*2)*2;i.width=i.height=r,n.font=`${r/5}pt '${this.fontFace}'`,n.fillStyle=this.diceColor,n.fillRect(0,0,i.width,i.height),n.textAlign="center",n.textBaseline="middle",n.fillStyle=this.textColor;for(let o in this.faceTexts[t])n.fillText(`${this.faceTexts[t][o]}`,i.width/2,i.height/2-r*.3),n.translate(i.width/2,i.height/2),n.rotate(Math.PI*2/3),n.translate(-i.width/2,-i.height/2);let s=new ti(i);return s.needsUpdate=!0,s}updateMaterialsForValue(t){t<0&&(t+=4),this.faceTexts=this.d4FaceTexts[t],this.geometry.material=this.getMaterials()}},ss=class extends v1{constructor(){super(...arguments);this.fontFace="DICE_ROLLER_GENESYS_FONT"}},E4=class extends ss{constructor(t,i,n=ii,r){super(t,i,n,r);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,o=1/s;this.vertices=[[0,o,s],[0,o,-s],[0,-o,s],[0,-o,-s],[s,0,o],[s,0,-o],[-s,0,o],[-s,0,-o],[o,s,0],[o,-s,0],[-o,s,0],[-o,-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]]}},L4=class extends E4{constructor(t,i,n=ii,r){super(t,i,n,r);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"})}},T4=class extends E4{constructor(t,i,n=ii,r){super(t,i,n,r);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"})}},D4=class extends ss{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}},H4=class extends D4{constructor(t,i,n=ii,r){super(t,i,n,r);this.labels=["","","s","a",`s
a`,`s
s`,"a","s",`a
a`,""];this.setColor({diceColor:"#46AC4E",textColor:"#000000"})}},V4=class extends D4{constructor(t,i,n=ii,r){super(t,i,n,r);this.labels=["","","t","f",`f
t`,"t","",`t
t`,`f
f`,"t",""];this.setColor({diceColor:"#52287E",textColor:"#FFFFFF"})}},R4=class extends ss{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]}},N4=class extends R4{constructor(t,i,n=ii,r){super(t,i,n,r);this.labels=["","","","","s",`s
a`,`a
a`,"a","",""];this.setColor({diceColor:"#76CDDB",textColor:"#000000"})}},F4=class extends R4{constructor(t,i,n=ii,r){super(t,i,n,r);this.labels=["","","","t","f","",""];this.setColor({diceColor:"#000000",textColor:"#FFFFFF"})}};var zp={pos:{x:0+100*Math.random(),y:0+100*Math.random(),z: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()}},ni=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={...zp};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},r=this.makeRandomVector(n),s={x:this.w*(r.x>0?-1:1)*.9,y:this.h*(r.y>0?-1:1)*.9,z:Math.random()*200+200},o=Math.abs(r.x/r.y);o>1?s.y/=o:s.x*=o;let c=this.makeRandomVector(n),l={x:c.x*i,y:c.y*i,z:-10},h={x:-(Math.random()*r.y*5+this.inertia*r.y),y:Math.random()*r.x*5+this.inertia*r.x,z:0},u={x:Math.random(),y:Math.random(),z:Math.random(),w:Math.random()};return{pos:s,velocity:l,angular:h,axis:u}}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 s=0,o=this.buffer.groups.length;s<o;++s){let c=this.buffer.groups[s];if(c.materialIndex==0)continue;let l=s*9,u=new Y(n[l],n[l+1],n[l+2]).clone().applyQuaternion(new Mt(this.body.quaternion.x,this.body.quaternion.y,this.body.quaternion.z,this.body.quaternion.w)).angleTo(e);u<i&&(i=u,t=c)}let r=t.materialIndex-1;return this.sides==10&&r==0&&(r=10),this.data.values?.[r]??r}shiftUpperValue(e){let t=this.geometry.geometry.clone(),i=this.getUpsideValue();for(let n=0,r=t.groups.length;n<r;++n){let s=t.groups[n].materialIndex;if(s!==0){for(s+=e-i-1;s>this.sides;)s-=this.sides;for(;s<1;)s+=this.sides;t.groups[n].materialIndex=s+1}}this.updateMaterialsForValue(e-i),this.geometry.geometry=t}resetBody(){return this.body.vlambda=new z,this.body.position=new z,this.body.previousPosition=new z,this.body.initPosition=new z,this.body.velocity=new z,this.body.initVelocity=new z,this.body.force=new z,this.body.torque=new z,this.body.quaternion=new Mt,this.body.initQuaternion=new Mt,this.body.angularVelocity=new z,this.body.initAngularVelocity=new z,this.body.interpolatedPosition=new z,this.body.interpolatedQuaternion=new Mt,this.body.inertia=new z,this.body.invInertia=new z,this.body.invInertiaWorld=new Z1,this.body.invInertiaSolve=new z,this.body.invInertiaWorldSolve=new Z1,this.body.wlambda=new z,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 z(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}},as=class extends ni{constructor(t,i,n,r){super(t,i,n);this.w=t;this.h=i;this.data=n;this.sides=20;this.inertia=6;r&&(this.vector=this.generateVector(r)),this.create()}},os=class extends ni{constructor(t,i,n,r){super(t,i,n);this.w=t;this.h=i;this.data=n;this.sides=12;this.inertia=8;r&&(this.vector=this.generateVector(r)),this.create()}},S2=class extends ni{constructor(t,i,n,r,s=!1){super(t,i,n);this.w=t;this.h=i;this.data=n;this.isPercentile=s;this.sides=10;this.inertia=9;r&&(this.vector=this.generateVector(r)),this.create()}},cs=class extends ni{constructor(t,i,n,r){super(t,i,n);this.w=t;this.h=i;this.data=n;this.sides=8;this.inertia=10;r&&(this.vector=this.generateVector(r)),this.create()}},Vn=class extends ni{constructor(t,i,n,r){super(t,i,n);this.w=t;this.h=i;this.data=n;this.sides=6;this.inertia=13;r&&(this.vector=this.generateVector(r)),this.create()}},ls=class extends ni{constructor(t,i,n,r){super(t,i,n);this.w=t;this.h=i;this.data=n;this.sides=4;this.inertia=5;r&&(this.vector=this.generateVector(r)),this.create()}};var Tc="137";var Cp=0,V5=1,Ap=2;var pu=1,Dc=2,ys=3,As=0,zt=1,or=2,mu=1;var fi=0,bs=1,R5=2,N5=3,F5=4,Sp=5,Kn=100,_p=101,Ep=102,B5=103,P5=104,Lp=200,Tp=201,Dp=202,Hp=203,gu=204,vu=205,Vp=206,Rp=207,Np=208,Fp=209,Bp=210,Pp=0,Ip=1,kp=2,m3=3,Op=4,Up=5,qp=6,Gp=7,Zo=0,Wp=1,jp=2,di=0,Zp=1,Xp=2,Yp=3,$p=4,Jp=5,xu=300,ea=301,ta=302,g3=303,v3=304,Xo=306,Hc=307,x3=1e3,l1=1001,y3=1002,Ct=1003,I5=1004;var k5=1005;var It=1006,Qp=1007;var Yo=1008;var pi=1009,Kp=1010,em=1011,Ss=1012,tm=1013,vo=1014,Ji=1015,nr=1016,im=1017,nm=1018,rr=1020,rm=1021,Xt=1023,sm=1024,am=1025,Ki=1026,cr=1027,om=1028,cm=1029,lm=1030,hm=1031,um=1033,T6=33776,D6=33777,H6=33778,V6=33779,O5=35840,U5=35841,q5=35842,G5=35843,fm=36196,W5=37492,j5=37496,Z5=37808,X5=37809,Y5=37810,$5=37811,J5=37812,Q5=37813,K5=37814,eh=37815,th=37816,ih=37817,nh=37818,rh=37819,sh=37820,ah=37821,oh=36492,dm=2200,pm=2201,mm=2202,xo=2300,yo=2301,R6=2302,er=2400,tr=2401,wo=2402,Vc=2500,yu=2501,gm=0;var xi=3e3,nt=3001,vm=3200,xm=3201,br=0,ym=1;var N6=7680;var wm=519,_s=35044,bo=35048;var ch="300 es",w3=1035,V2=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 r=n.indexOf(t);r!==-1&&n.splice(r,1)}}dispatchEvent(e){if(this._listeners===void 0)return;let i=this._listeners[e.type];if(i!==void 0){e.target=this;let n=i.slice(0);for(let r=0,s=n.length;r<s;r++)n[r].call(this,e);e.target=null}}},Ft=[];for(let a=0;a<256;a++)Ft[a]=(a<16?"0":"")+a.toString(16);var F6=Math.PI/180,b3=180/Math.PI;function F1(){let a=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Ft[a&255]+Ft[a>>8&255]+Ft[a>>16&255]+Ft[a>>24&255]+"-"+Ft[e&255]+Ft[e>>8&255]+"-"+Ft[e>>16&15|64]+Ft[e>>24&255]+"-"+Ft[t&63|128]+Ft[t>>8&255]+"-"+Ft[t>>16&255]+Ft[t>>24&255]+Ft[i&255]+Ft[i>>8&255]+Ft[i>>16&255]+Ft[i>>24&255]).toUpperCase()}function Kt(a,e,t){return Math.max(e,Math.min(t,a))}function bm(a,e){return(a%e+e)%e}function B6(a,e,t){return(1-t)*a+t*e}function lh(a){return(a&a-1)===0&&a!==0}function Mm(a){return Math.pow(2,Math.floor(Math.log(a)/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),r=this.x-e.x,s=this.y-e.y;return this.x=r*i-s*n+e.x,this.y=r*n+s*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 At=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,r,s,o,c,l){let h=this.elements;return h[0]=e,h[1]=n,h[2]=o,h[3]=t,h[4]=r,h[5]=c,h[6]=i,h[7]=s,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,r=this.elements,s=i[0],o=i[3],c=i[6],l=i[1],h=i[4],u=i[7],f=i[2],d=i[5],p=i[8],v=n[0],x=n[3],g=n[6],m=n[1],M=n[4],y=n[7],b=n[2],C=n[5],_=n[8];return r[0]=s*v+o*m+c*b,r[3]=s*x+o*M+c*C,r[6]=s*g+o*y+c*_,r[1]=l*v+h*m+u*b,r[4]=l*x+h*M+u*C,r[7]=l*g+h*y+u*_,r[2]=f*v+d*m+p*b,r[5]=f*x+d*M+p*C,r[8]=f*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],r=e[3],s=e[4],o=e[5],c=e[6],l=e[7],h=e[8];return t*s*h-t*o*l-i*r*h+i*o*c+n*r*l-n*s*c}invert(){let e=this.elements,t=e[0],i=e[1],n=e[2],r=e[3],s=e[4],o=e[5],c=e[6],l=e[7],h=e[8],u=h*s-o*l,f=o*c-h*r,d=l*r-s*c,p=t*u+i*f+n*d;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let v=1/p;return e[0]=u*v,e[1]=(n*l-h*i)*v,e[2]=(o*i-n*s)*v,e[3]=f*v,e[4]=(h*t-n*c)*v,e[5]=(n*r-o*t)*v,e[6]=d*v,e[7]=(i*c-l*t)*v,e[8]=(s*t-i*r)*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,r,s,o){let c=Math.cos(r),l=Math.sin(r);return this.set(i*c,i*l,-i*(c*s+l*o)+s+e,-n*l,n*c,-n*(-l*s+c*o)+o+t,0,0,1),this}scale(e,t){let i=this.elements;return i[0]*=e,i[3]*=e,i[6]*=e,i[1]*=t,i[4]*=t,i[7]*=t,this}rotate(e){let t=Math.cos(e),i=Math.sin(e),n=this.elements,r=n[0],s=n[3],o=n[6],c=n[1],l=n[4],h=n[7];return n[0]=t*r+i*c,n[3]=t*s+i*l,n[6]=t*o+i*h,n[1]=-i*r+t*c,n[4]=-i*s+t*l,n[7]=-i*o+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)}};At.prototype.isMatrix3=!0;function wu(a){for(let e=a.length-1;e>=0;--e)if(a[e]>65535)return!0;return!1}function Es(a){return document.createElementNS("http://www.w3.org/1999/xhtml",a)}var bu={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},H1={h:0,s:0,l:0},B4={h:0,s:0,l:0};function P6(a,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?a+(e-a)*6*t:t<1/2?e:t<2/3?a+(e-a)*6*(2/3-t):a}function sr(a){return a<.04045?a*.0773993808:Math.pow(a*.9478672986+.0521327014,2.4)}function I6(a){return a<.0031308?a*12.92:1.055*Math.pow(a,.41666)-.055}var we=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=bm(e,1),t=Kt(t,0,1),i=Kt(i,0,1),t===0)this.r=this.g=this.b=i;else{let n=i<=.5?i*(1+t):i+t-i*t,r=2*i-n;this.r=P6(r,n,e+1/3),this.g=P6(r,n,e),this.b=P6(r,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,r=i[1],s=i[2];switch(r){case"rgb":case"rgba":if(n=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))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(s))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(s)){let o=parseFloat(n[1])/360,c=parseInt(n[2],10)/100,l=parseInt(n[3],10)/100;return t(n[4]),this.setHSL(o,c,l)}break}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){let n=i[1],r=n.length;if(r===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(r===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=bu[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=sr(e.r),this.g=sr(e.g),this.b=sr(e.b),this}copyLinearToSRGB(e){return this.r=I6(e.r),this.g=I6(e.g),this.b=I6(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,r=Math.max(t,i,n),s=Math.min(t,i,n),o,c,l=(s+r)/2;if(s===r)o=0,c=0;else{let h=r-s;switch(c=l<=.5?h/(r+s):h/(2-r-s),r){case t:o=(i-n)/h+(i<n?6:0);break;case i:o=(n-t)/h+2;break;case n:o=(t-i)/h+4;break}o/=6}return e.h=o,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(H1),H1.h+=e,H1.s+=t,H1.l+=i,this.setHSL(H1.h,H1.s,H1.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(H1),e.getHSL(B4);let i=B6(H1.h,B4.h,t),n=B6(H1.s,B4.s,t),r=B6(H1.l,B4.l,t);return this.setHSL(i,n,r),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()}};we.NAMES=bu;we.prototype.isColor=!0;we.prototype.r=1;we.prototype.g=1;we.prototype.b=1;var Rn,R2=class{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Rn===void 0&&(Rn=Es("canvas")),Rn.width=e.width,Rn.height=e.height;let i=Rn.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=Rn}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<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=Es("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),r=n.data;for(let s=0;s<r.length;s++)r[s]=sr(r[s]/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(sr(t[i]/255)*255):t[i]=sr(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}},zm=0,St=class a extends V2{constructor(e=a.DEFAULT_IMAGE,t=a.DEFAULT_MAPPING,i=l1,n=l1,r=It,s=Yo,o=Xt,c=pi,l=1,h=xi){super(),Object.defineProperty(this,"id",{value:zm++}),this.uuid=F1(),this.name="",this.image=e,this.mipmaps=[],this.mapping=t,this.wrapS=i,this.wrapT=n,this.magFilter=r,this.minFilter=s,this.anisotropy=l,this.format=o,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 At,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=F1()),!t&&e.images[n.uuid]===void 0){let r;if(Array.isArray(n)){r=[];for(let s=0,o=n.length;s<o;s++)n[s].isDataTexture?r.push(k6(n[s].image)):r.push(k6(n[s]))}else r=k6(n);e.images[n.uuid]={uuid:n.uuid,url:r}}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!==xu)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case x3:e.x=e.x-Math.floor(e.x);break;case l1:e.x=e.x<0?0:1;break;case y3: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 x3:e.y=e.y-Math.floor(e.y);break;case l1:e.y=e.y<0?0:1;break;case y3: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++}};St.DEFAULT_IMAGE=void 0;St.DEFAULT_MAPPING=xu;St.prototype.isTexture=!0;function k6(a){return typeof HTMLImageElement<"u"&&a instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&a instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&a instanceof ImageBitmap?R2.getDataURL(a):a.data?{data:Array.prototype.slice.call(a.data),width:a.width,height:a.height,type:a.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var $e=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,r=this.w,s=e.elements;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.w=s[3]*t+s[7]*i+s[11]*n+s[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,n,r,c=e.elements,l=c[0],h=c[4],u=c[8],f=c[1],d=c[5],p=c[9],v=c[2],x=c[6],g=c[10];if(Math.abs(h-f)<.01&&Math.abs(u-v)<.01&&Math.abs(p-x)<.01){if(Math.abs(h+f)<.1&&Math.abs(u+v)<.1&&Math.abs(p+x)<.1&&Math.abs(l+d+g-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let M=(l+1)/2,y=(d+1)/2,b=(g+1)/2,C=(h+f)/4,_=(u+v)/4,S=(p+x)/4;return M>y&&M>b?M<.01?(i=0,n=.707106781,r=.707106781):(i=Math.sqrt(M),n=C/i,r=_/i):y>b?y<.01?(i=.707106781,n=0,r=.707106781):(n=Math.sqrt(y),i=C/n,r=S/n):b<.01?(i=.707106781,n=.707106781,r=0):(r=Math.sqrt(b),i=_/r,n=S/r),this.set(i,n,r,t),this}let m=Math.sqrt((x-p)*(x-p)+(u-v)*(u-v)+(f-h)*(f-h));return Math.abs(m)<.001&&(m=1),this.x=(x-p)/m,this.y=(u-v)/m,this.z=(f-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}};$e.prototype.isVector4=!0;var e1=class extends V2{constructor(e,t,i={}){super(),this.width=e,this.height=t,this.depth=1,this.scissor=new $e(0,0,e,t),this.scissorTest=!1,this.viewport=new $e(0,0,e,t),this.texture=new St(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:It,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"})}};e1.prototype.isWebGLRenderTarget=!0;var M3=class extends e1{constructor(e,t,i){super(e,t);let n=this.texture;this.texture=[];for(let r=0;r<i;r++)this.texture[r]=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,r=this.texture.length;n<r;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}};M3.prototype.isWebGLMultipleRenderTargets=!0;var Ls=class extends e1{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}};Ls.prototype.isWebGLMultisampleRenderTarget=!0;var kt=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,r,s,o){let c=i[n+0],l=i[n+1],h=i[n+2],u=i[n+3],f=r[s+0],d=r[s+1],p=r[s+2],v=r[s+3];if(o===0){e[t+0]=c,e[t+1]=l,e[t+2]=h,e[t+3]=u;return}if(o===1){e[t+0]=f,e[t+1]=d,e[t+2]=p,e[t+3]=v;return}if(u!==v||c!==f||l!==d||h!==p){let x=1-o,g=c*f+l*d+h*p+u*v,m=g>=0?1:-1,M=1-g*g;if(M>Number.EPSILON){let b=Math.sqrt(M),C=Math.atan2(b,g*m);x=Math.sin(x*C)/b,o=Math.sin(o*C)/b}let y=o*m;if(c=c*x+f*y,l=l*x+d*y,h=h*x+p*y,u=u*x+v*y,x===1-o){let b=1/Math.sqrt(c*c+l*l+h*h+u*u);c*=b,l*=b,h*=b,u*=b}}e[t]=c,e[t+1]=l,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,i,n,r,s){let o=i[n],c=i[n+1],l=i[n+2],h=i[n+3],u=r[s],f=r[s+1],d=r[s+2],p=r[s+3];return e[t]=o*p+h*u+c*d-l*f,e[t+1]=c*p+h*f+l*u-o*d,e[t+2]=l*p+h*d+o*f-c*u,e[t+3]=h*p-o*u-c*f-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,r=e._z,s=e._order,o=Math.cos,c=Math.sin,l=o(i/2),h=o(n/2),u=o(r/2),f=c(i/2),d=c(n/2),p=c(r/2);switch(s){case"XYZ":this._x=f*h*u+l*d*p,this._y=l*d*u-f*h*p,this._z=l*h*p+f*d*u,this._w=l*h*u-f*d*p;break;case"YXZ":this._x=f*h*u+l*d*p,this._y=l*d*u-f*h*p,this._z=l*h*p-f*d*u,this._w=l*h*u+f*d*p;break;case"ZXY":this._x=f*h*u-l*d*p,this._y=l*d*u+f*h*p,this._z=l*h*p+f*d*u,this._w=l*h*u-f*d*p;break;case"ZYX":this._x=f*h*u-l*d*p,this._y=l*d*u+f*h*p,this._z=l*h*p-f*d*u,this._w=l*h*u+f*d*p;break;case"YZX":this._x=f*h*u+l*d*p,this._y=l*d*u+f*h*p,this._z=l*h*p-f*d*u,this._w=l*h*u-f*d*p;break;case"XZY":this._x=f*h*u-l*d*p,this._y=l*d*u-f*h*p,this._z=l*h*p+f*d*u,this._w=l*h*u+f*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let i=t/2,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],r=t[8],s=t[1],o=t[5],c=t[9],l=t[2],h=t[6],u=t[10],f=i+o+u;if(f>0){let d=.5/Math.sqrt(f+1);this._w=.25/d,this._x=(h-c)*d,this._y=(r-l)*d,this._z=(s-n)*d}else if(i>o&&i>u){let d=2*Math.sqrt(1+i-o-u);this._w=(h-c)/d,this._x=.25*d,this._y=(n+s)/d,this._z=(r+l)/d}else if(o>u){let d=2*Math.sqrt(1+o-i-u);this._w=(r-l)/d,this._x=(n+s)/d,this._y=.25*d,this._z=(c+h)/d}else{let d=2*Math.sqrt(1+u-i-o);this._w=(s-n)/d,this._x=(r+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(Kt(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,r=e._z,s=e._w,o=t._x,c=t._y,l=t._z,h=t._w;return this._x=i*h+s*o+n*l-r*c,this._y=n*h+s*c+r*o-i*l,this._z=r*h+s*l+i*c-n*o,this._w=s*h-i*o-n*c-r*l,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);let i=this._x,n=this._y,r=this._z,s=this._w,o=s*e._w+i*e._x+n*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=s,this._x=i,this._y=n,this._z=r,this;let c=1-o*o;if(c<=Number.EPSILON){let d=1-t;return this._w=d*s+t*this._w,this._x=d*i+t*this._x,this._y=d*n+t*this._y,this._z=d*r+t*this._z,this.normalize(),this._onChangeCallback(),this}let l=Math.sqrt(c),h=Math.atan2(l,o),u=Math.sin((1-t)*h)/l,f=Math.sin(t*h)/l;return this._w=s*u+this._w*f,this._x=i*u+this._x*f,this._y=n*u+this._y*f,this._z=r*u+this._z*f,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(),r=2*Math.PI*Math.random();return this.set(t*Math.cos(n),i*Math.sin(r),i*Math.cos(r),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(){}};kt.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(hh.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(hh.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,i=this.y,n=this.z,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6]*n,this.y=r[1]*t+r[4]*i+r[7]*n,this.z=r[2]*t+r[5]*i+r[8]*n,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,i=this.y,n=this.z,r=e.elements,s=1/(r[3]*t+r[7]*i+r[11]*n+r[15]);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}applyQuaternion(e){let t=this.x,i=this.y,n=this.z,r=e.x,s=e.y,o=e.z,c=e.w,l=c*t+s*n-o*i,h=c*i+o*t-r*n,u=c*n+r*i-s*t,f=-r*t-s*i-o*n;return this.x=l*c+f*-r+h*-o-u*-s,this.y=h*c+f*-s+u*-r-l*-o,this.z=u*c+f*-o+l*-s-h*-r,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,i=this.y,n=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*n,this.y=r[1]*t+r[5]*i+r[9]*n,this.z=r[2]*t+r[6]*i+r[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,r=e.z,s=t.x,o=t.y,c=t.z;return this.x=n*c-r*o,this.y=r*s-i*c,this.z=i*o-n*s,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return O6.copy(this).projectOnVector(e),this.sub(O6)}reflect(e){return this.sub(O6.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(Kt(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 O6=new B,hh=new kt,h1=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,r=-1/0,s=-1/0,o=-1/0;for(let c=0,l=e.length;c<l;c+=3){let h=e[c],u=e[c+1],f=e[c+2];h<t&&(t=h),u<i&&(i=u),f<n&&(n=f),h>r&&(r=h),u>s&&(s=u),f>o&&(o=f)}return this.min.set(t,i,n),this.max.set(r,s,o),this}setFromBufferAttribute(e){let t=1/0,i=1/0,n=1/0,r=-1/0,s=-1/0,o=-1/0;for(let c=0,l=e.count;c<l;c++){let h=e.getX(c),u=e.getY(c),f=e.getZ(c);h<t&&(t=h),u<i&&(i=u),f<n&&(n=f),h>r&&(r=h),u>s&&(s=u),f>o&&(o=f)}return this.min.set(t,i,n),this.max.set(r,s,o),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=Zi.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 r=i.attributes.position;for(let s=0,o=r.count;s<o;s++)Zi.fromBufferAttribute(r,s).applyMatrix4(e.matrixWorld),this.expandByPoint(Zi)}else i.boundingBox===null&&i.computeBoundingBox(),U6.copy(i.boundingBox),U6.applyMatrix4(e.matrixWorld),this.union(U6);let n=e.children;for(let r=0,s=n.length;r<s;r++)this.expandByObject(n[r],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,Zi),Zi.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),P4.subVectors(this.max,hs),Nn.subVectors(e.a,hs),Fn.subVectors(e.b,hs),Bn.subVectors(e.c,hs),ri.subVectors(Fn,Nn),si.subVectors(Bn,Fn),Xi.subVectors(Nn,Bn);let t=[0,-ri.z,ri.y,0,-si.z,si.y,0,-Xi.z,Xi.y,ri.z,0,-ri.x,si.z,0,-si.x,Xi.z,0,-Xi.x,-ri.y,ri.x,0,-si.y,si.x,0,-Xi.y,Xi.x,0];return!q6(t,Nn,Fn,Bn,P4)||(t=[1,0,0,0,1,0,0,0,1],!q6(t,Nn,Fn,Bn,P4))?!1:(I4.crossVectors(ri,si),t=[I4.x,I4.y,I4.z],q6(t,Nn,Fn,Bn,P4))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return Zi.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=this.getSize(Zi).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:(_2[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),_2[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),_2[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),_2[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),_2[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),_2[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),_2[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),_2[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(_2),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)}};h1.prototype.isBox3=!0;var _2=[new B,new B,new B,new B,new B,new B,new B,new B],Zi=new B,U6=new h1,Nn=new B,Fn=new B,Bn=new B,ri=new B,si=new B,Xi=new B,hs=new B,P4=new B,I4=new B,Yi=new B;function q6(a,e,t,i,n){for(let r=0,s=a.length-3;r<=s;r+=3){Yi.fromArray(a,r);let o=n.x*Math.abs(Yi.x)+n.y*Math.abs(Yi.y)+n.z*Math.abs(Yi.z),c=e.dot(Yi),l=t.dot(Yi),h=i.dot(Yi);if(Math.max(-Math.max(c,l,h),Math.min(c,l,h))>o)return!1}return!0}var Cm=new h1,uh=new B,k4=new B,G6=new B,yi=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):Cm.setFromPoints(e).getCenter(i);let n=0;for(let r=0,s=e.length;r<s;r++)n=Math.max(n,i.distanceToSquared(e[r]));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){G6.subVectors(e,this.center);let t=G6.lengthSq();if(t>this.radius*this.radius){let i=Math.sqrt(t),n=(i-this.radius)*.5;this.center.add(G6.multiplyScalar(n/i)),this.radius+=n}return this}union(e){return this.center.equals(e.center)===!0?k4.set(0,0,1).multiplyScalar(e.radius):k4.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(uh.copy(e.center).add(k4)),this.expandByPoint(uh.copy(e.center).sub(k4)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}},E2=new B,W6=new B,O4=new B,ai=new B,j6=new B,U4=new B,Z6=new B,wi=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,E2)),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=E2.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(E2.copy(this.direction).multiplyScalar(t).add(this.origin),E2.distanceToSquared(e))}distanceSqToSegment(e,t,i,n){W6.copy(e).add(t).multiplyScalar(.5),O4.copy(t).sub(e).normalize(),ai.copy(this.origin).sub(W6);let r=e.distanceTo(t)*.5,s=-this.direction.dot(O4),o=ai.dot(this.direction),c=-ai.dot(O4),l=ai.lengthSq(),h=Math.abs(1-s*s),u,f,d,p;if(h>0)if(u=s*c-o,f=s*o-c,p=r*h,u>=0)if(f>=-p)if(f<=p){let v=1/h;u*=v,f*=v,d=u*(u+s*f+2*o)+f*(s*u+f+2*c)+l}else f=r,u=Math.max(0,-(s*f+o)),d=-u*u+f*(f+2*c)+l;else f=-r,u=Math.max(0,-(s*f+o)),d=-u*u+f*(f+2*c)+l;else f<=-p?(u=Math.max(0,-(-s*r+o)),f=u>0?-r:Math.min(Math.max(-r,-c),r),d=-u*u+f*(f+2*c)+l):f<=p?(u=0,f=Math.min(Math.max(-r,-c),r),d=f*(f+2*c)+l):(u=Math.max(0,-(s*r+o)),f=u>0?r:Math.min(Math.max(-r,-c),r),d=-u*u+f*(f+2*c)+l);else f=s>0?-r:r,u=Math.max(0,-(s*f+o)),d=-u*u+f*(f+2*c)+l;return i&&i.copy(this.direction).multiplyScalar(u).add(this.origin),n&&n.copy(O4).multiplyScalar(f).add(W6),d}intersectSphere(e,t){E2.subVectors(e.center,this.origin);let i=E2.dot(this.direction),n=E2.dot(E2)-i*i,r=e.radius*e.radius;if(n>r)return null;let s=Math.sqrt(r-n),o=i-s,c=i+s;return o<0&&c<0?null:o<0?this.at(c,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){let i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,n,r,s,o,c,l=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,f=this.origin;return l>=0?(i=(e.min.x-f.x)*l,n=(e.max.x-f.x)*l):(i=(e.max.x-f.x)*l,n=(e.min.x-f.x)*l),h>=0?(r=(e.min.y-f.y)*h,s=(e.max.y-f.y)*h):(r=(e.max.y-f.y)*h,s=(e.min.y-f.y)*h),i>s||r>n||((r>i||i!==i)&&(i=r),(s<n||n!==n)&&(n=s),u>=0?(o=(e.min.z-f.z)*u,c=(e.max.z-f.z)*u):(o=(e.max.z-f.z)*u,c=(e.min.z-f.z)*u),i>c||o>n)||((o>i||i!==i)&&(i=o),(c<n||n!==n)&&(n=c),n<0)?null:this.at(i>=0?i:n,t)}intersectsBox(e){return this.intersectBox(e,E2)!==null}intersectTriangle(e,t,i,n,r){j6.subVectors(t,e),U4.subVectors(i,e),Z6.crossVectors(j6,U4);let s=this.direction.dot(Z6),o;if(s>0){if(n)return null;o=1}else if(s<0)o=-1,s=-s;else return null;ai.subVectors(this.origin,e);let c=o*this.direction.dot(U4.crossVectors(ai,U4));if(c<0)return null;let l=o*this.direction.dot(j6.cross(ai));if(l<0||c+l>s)return null;let h=-o*ai.dot(Z6);return h<0?null:this.at(h/s,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},_e=class a{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,r,s,o,c,l,h,u,f,d,p,v,x){let g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=n,g[1]=r,g[5]=s,g[9]=o,g[13]=c,g[2]=l,g[6]=h,g[10]=u,g[14]=f,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 a().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/Pn.setFromMatrixColumn(e,0).length(),r=1/Pn.setFromMatrixColumn(e,1).length(),s=1/Pn.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]*r,t[5]=i[5]*r,t[6]=i[6]*r,t[7]=0,t[8]=i[8]*s,t[9]=i[9]*s,t[10]=i[10]*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");let t=this.elements,i=e.x,n=e.y,r=e.z,s=Math.cos(i),o=Math.sin(i),c=Math.cos(n),l=Math.sin(n),h=Math.cos(r),u=Math.sin(r);if(e.order==="XYZ"){let f=s*h,d=s*u,p=o*h,v=o*u;t[0]=c*h,t[4]=-c*u,t[8]=l,t[1]=d+p*l,t[5]=f-v*l,t[9]=-o*c,t[2]=v-f*l,t[6]=p+d*l,t[10]=s*c}else if(e.order==="YXZ"){let f=c*h,d=c*u,p=l*h,v=l*u;t[0]=f+v*o,t[4]=p*o-d,t[8]=s*l,t[1]=s*u,t[5]=s*h,t[9]=-o,t[2]=d*o-p,t[6]=v+f*o,t[10]=s*c}else if(e.order==="ZXY"){let f=c*h,d=c*u,p=l*h,v=l*u;t[0]=f-v*o,t[4]=-s*u,t[8]=p+d*o,t[1]=d+p*o,t[5]=s*h,t[9]=v-f*o,t[2]=-s*l,t[6]=o,t[10]=s*c}else if(e.order==="ZYX"){let f=s*h,d=s*u,p=o*h,v=o*u;t[0]=c*h,t[4]=p*l-d,t[8]=f*l+v,t[1]=c*u,t[5]=v*l+f,t[9]=d*l-p,t[2]=-l,t[6]=o*c,t[10]=s*c}else if(e.order==="YZX"){let f=s*c,d=s*l,p=o*c,v=o*l;t[0]=c*h,t[4]=v-f*u,t[8]=p*u+d,t[1]=u,t[5]=s*h,t[9]=-o*h,t[2]=-l*h,t[6]=d*u+p,t[10]=f-v*u}else if(e.order==="XZY"){let f=s*c,d=s*l,p=o*c,v=o*l;t[0]=c*h,t[4]=-u,t[8]=l*h,t[1]=f*u+v,t[5]=s*h,t[9]=d*u-p,t[2]=p*u-d,t[6]=o*h,t[10]=v*u+f}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(Am,e,Sm)}lookAt(e,t,i){let n=this.elements;return o1.subVectors(e,t),o1.lengthSq()===0&&(o1.z=1),o1.normalize(),oi.crossVectors(i,o1),oi.lengthSq()===0&&(Math.abs(i.z)===1?o1.x+=1e-4:o1.z+=1e-4,o1.normalize(),oi.crossVectors(i,o1)),oi.normalize(),q4.crossVectors(o1,oi),n[0]=oi.x,n[4]=q4.x,n[8]=o1.x,n[1]=oi.y,n[5]=q4.y,n[9]=o1.y,n[2]=oi.z,n[6]=q4.z,n[10]=o1.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,r=this.elements,s=i[0],o=i[4],c=i[8],l=i[12],h=i[1],u=i[5],f=i[9],d=i[13],p=i[2],v=i[6],x=i[10],g=i[14],m=i[3],M=i[7],y=i[11],b=i[15],C=n[0],_=n[4],S=n[8],P=n[12],H=n[1],w=n[5],T=n[9],A=n[13],R=n[2],V=n[6],L=n[10],N=n[14],I=n[3],W=n[7],O=n[11],q=n[15];return r[0]=s*C+o*H+c*R+l*I,r[4]=s*_+o*w+c*V+l*W,r[8]=s*S+o*T+c*L+l*O,r[12]=s*P+o*A+c*N+l*q,r[1]=h*C+u*H+f*R+d*I,r[5]=h*_+u*w+f*V+d*W,r[9]=h*S+u*T+f*L+d*O,r[13]=h*P+u*A+f*N+d*q,r[2]=p*C+v*H+x*R+g*I,r[6]=p*_+v*w+x*V+g*W,r[10]=p*S+v*T+x*L+g*O,r[14]=p*P+v*A+x*N+g*q,r[3]=m*C+M*H+y*R+b*I,r[7]=m*_+M*w+y*V+b*W,r[11]=m*S+M*T+y*L+b*O,r[15]=m*P+M*A+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],r=e[12],s=e[1],o=e[5],c=e[9],l=e[13],h=e[2],u=e[6],f=e[10],d=e[14],p=e[3],v=e[7],x=e[11],g=e[15];return p*(+r*c*u-n*l*u-r*o*f+i*l*f+n*o*d-i*c*d)+v*(+t*c*d-t*l*f+r*s*f-n*s*d+n*l*h-r*c*h)+x*(+t*l*u-t*o*d-r*s*u+i*s*d+r*o*h-i*l*h)+g*(-n*o*h-t*c*u+t*o*f+n*s*u-i*s*f+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],r=e[3],s=e[4],o=e[5],c=e[6],l=e[7],h=e[8],u=e[9],f=e[10],d=e[11],p=e[12],v=e[13],x=e[14],g=e[15],m=u*x*l-v*f*l+v*c*d-o*x*d-u*c*g+o*f*g,M=p*f*l-h*x*l-p*c*d+s*x*d+h*c*g-s*f*g,y=h*v*l-p*u*l+p*o*d-s*v*d-h*o*g+s*u*g,b=p*u*c-h*v*c-p*o*f+s*v*f+h*o*x-s*u*x,C=t*m+i*M+n*y+r*b;if(C===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let _=1/C;return e[0]=m*_,e[1]=(v*f*r-u*x*r-v*n*d+i*x*d+u*n*g-i*f*g)*_,e[2]=(o*x*r-v*c*r+v*n*l-i*x*l-o*n*g+i*c*g)*_,e[3]=(u*c*r-o*f*r-u*n*l+i*f*l+o*n*d-i*c*d)*_,e[4]=M*_,e[5]=(h*x*r-p*f*r+p*n*d-t*x*d-h*n*g+t*f*g)*_,e[6]=(p*c*r-s*x*r-p*n*l+t*x*l+s*n*g-t*c*g)*_,e[7]=(s*f*r-h*c*r+h*n*l-t*f*l-s*n*d+t*c*d)*_,e[8]=y*_,e[9]=(p*u*r-h*v*r-p*i*d+t*v*d+h*i*g-t*u*g)*_,e[10]=(s*v*r-p*o*r+p*i*l-t*v*l-s*i*g+t*o*g)*_,e[11]=(h*o*r-s*u*r-h*i*l+t*u*l+s*i*d-t*o*d)*_,e[12]=b*_,e[13]=(h*v*n-p*u*n+p*i*f-t*v*f-h*i*x+t*u*x)*_,e[14]=(p*o*n-s*v*n-p*i*c+t*v*c+s*i*x-t*o*x)*_,e[15]=(s*u*n-h*o*n+h*i*c-t*u*c-s*i*f+t*o*f)*_,this}scale(e){let t=this.elements,i=e.x,n=e.y,r=e.z;return t[0]*=i,t[4]*=n,t[8]*=r,t[1]*=i,t[5]*=n,t[9]*=r,t[2]*=i,t[6]*=n,t[10]*=r,t[3]*=i,t[7]*=n,t[11]*=r,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],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),r=1-i,s=e.x,o=e.y,c=e.z,l=r*s,h=r*o;return this.set(l*s+i,l*o-n*c,l*c+n*o,0,l*o+n*c,h*o+i,h*c-n*s,0,l*c-n*o,h*c+n*s,r*c*c+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,n,r,s){return this.set(1,i,r,0,e,1,s,0,t,n,1,0,0,0,0,1),this}compose(e,t,i){let n=this.elements,r=t._x,s=t._y,o=t._z,c=t._w,l=r+r,h=s+s,u=o+o,f=r*l,d=r*h,p=r*u,v=s*h,x=s*u,g=o*u,m=c*l,M=c*h,y=c*u,b=i.x,C=i.y,_=i.z;return n[0]=(1-(v+g))*b,n[1]=(d+y)*b,n[2]=(p-M)*b,n[3]=0,n[4]=(d-y)*C,n[5]=(1-(f+g))*C,n[6]=(x+m)*C,n[7]=0,n[8]=(p+M)*_,n[9]=(x-m)*_,n[10]=(1-(f+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,r=Pn.set(n[0],n[1],n[2]).length(),s=Pn.set(n[4],n[5],n[6]).length(),o=Pn.set(n[8],n[9],n[10]).length();this.determinant()<0&&(r=-r),e.x=n[12],e.y=n[13],e.z=n[14],V1.copy(this);let l=1/r,h=1/s,u=1/o;return V1.elements[0]*=l,V1.elements[1]*=l,V1.elements[2]*=l,V1.elements[4]*=h,V1.elements[5]*=h,V1.elements[6]*=h,V1.elements[8]*=u,V1.elements[9]*=u,V1.elements[10]*=u,t.setFromRotationMatrix(V1),i.x=r,i.y=s,i.z=o,this}makePerspective(e,t,i,n,r,s){s===void 0&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");let o=this.elements,c=2*r/(t-e),l=2*r/(i-n),h=(t+e)/(t-e),u=(i+n)/(i-n),f=-(s+r)/(s-r),d=-2*s*r/(s-r);return o[0]=c,o[4]=0,o[8]=h,o[12]=0,o[1]=0,o[5]=l,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=f,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(e,t,i,n,r,s){let o=this.elements,c=1/(t-e),l=1/(i-n),h=1/(s-r),u=(t+e)*c,f=(i+n)*l,d=(s+r)*h;return o[0]=2*c,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-f,o[2]=0,o[6]=0,o[10]=-2*h,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[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}};_e.prototype.isMatrix4=!0;var Pn=new B,V1=new _e,Am=new B(0,0,0),Sm=new B(1,1,1),oi=new B,q4=new B,o1=new B,fh=new _e,dh=new kt,lr=class a{constructor(e=0,t=0,i=0,n=a.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,r=n[0],s=n[4],o=n[8],c=n[1],l=n[5],h=n[9],u=n[2],f=n[6],d=n[10];switch(t){case"XYZ":this._y=Math.asin(Kt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(f,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Kt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(Kt(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(c,r));break;case"ZYX":this._y=Math.asin(-Kt(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(f,d),this._z=Math.atan2(c,r)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(Kt(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-Kt(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(f,l),this._y=Math.atan2(o,r)):(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 fh.makeRotationFromQuaternion(e),this.setFromRotationMatrix(fh,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return dh.setFromEuler(this),this.setFromQuaternion(dh,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(){}};lr.prototype.isEuler=!0;lr.DefaultOrder="XYZ";lr.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];var Mo=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}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}},_m=0,ph=new B,In=new kt,L2=new _e,G4=new B,us=new B,Em=new B,Lm=new kt,mh=new B(1,0,0),gh=new B(0,1,0),vh=new B(0,0,1),Tm={type:"added"},xh={type:"removed"},Ze=class a extends V2{constructor(){super(),Object.defineProperty(this,"id",{value:_m++}),this.uuid=F1(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=a.DefaultUp.clone();let e=new B,t=new lr,i=new kt,n=new B(1,1,1);function r(){i.setFromEuler(t,!1)}function s(){t.setFromQuaternion(i,void 0,!1)}t._onChange(r),i._onChange(s),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new _e},normalMatrix:{value:new At}}),this.matrix=new _e,this.matrixWorld=new _e,this.matrixAutoUpdate=a.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Mo,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 In.setFromAxisAngle(e,t),this.quaternion.multiply(In),this}rotateOnWorldAxis(e,t){return In.setFromAxisAngle(e,t),this.quaternion.premultiply(In),this}rotateX(e){return this.rotateOnAxis(mh,e)}rotateY(e){return this.rotateOnAxis(gh,e)}rotateZ(e){return this.rotateOnAxis(vh,e)}translateOnAxis(e,t){return ph.copy(e).applyQuaternion(this.quaternion),this.position.add(ph.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(mh,e)}translateY(e){return this.translateOnAxis(gh,e)}translateZ(e){return this.translateOnAxis(vh,e)}localToWorld(e){return e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return e.applyMatrix4(L2.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?G4.copy(e):G4.set(e,t,i);let n=this.parent;this.updateWorldMatrix(!0,!1),us.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?L2.lookAt(us,G4,this.up):L2.lookAt(G4,us,this.up),this.quaternion.setFromRotationMatrix(L2),n&&(L2.extractRotation(n.matrixWorld),In.setFromRotationMatrix(L2),this.quaternion.premultiply(In.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(Tm)):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(xh)),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(xh)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),L2.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),L2.multiply(e.parent.matrixWorld)),e.applyMatrix4(L2),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 s=this.children[i].getObjectByProperty(e,t);if(s!==void 0)return s}}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(us,e,Em),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(us,Lm,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 r=0,s=n.length;r<s;r++)n[r].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 r(o,c){return o[c.uuid]===void 0&&(o[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=r(e.geometries,this.geometry);let o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){let c=o.shapes;if(Array.isArray(c))for(let l=0,h=c.length;l<h;l++){let u=c[l];r(e.shapes,u)}else r(e.shapes,c)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(e.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let o=[];for(let c=0,l=this.material.length;c<l;c++)o.push(r(e.materials,this.material[c]));n.material=o}else n.material=r(e.materials,this.material);if(this.children.length>0){n.children=[];for(let o=0;o<this.children.length;o++)n.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){n.animations=[];for(let o=0;o<this.animations.length;o++){let c=this.animations[o];n.animations.push(r(e.animations,c))}}if(t){let o=s(e.geometries),c=s(e.materials),l=s(e.textures),h=s(e.images),u=s(e.shapes),f=s(e.skeletons),d=s(e.animations);o.length>0&&(i.geometries=o),c.length>0&&(i.materials=c),l.length>0&&(i.textures=l),h.length>0&&(i.images=h),u.length>0&&(i.shapes=u),f.length>0&&(i.skeletons=f),d.length>0&&(i.animations=d)}return i.object=n,i;function s(o){let c=[];for(let l in o){let h=o[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}};Ze.DefaultUp=new B(0,1,0);Ze.DefaultMatrixAutoUpdate=!0;Ze.prototype.isObject3D=!0;var R1=new B,T2=new B,X6=new B,D2=new B,kn=new B,On=new B,yh=new B,Y6=new B,$6=new B,J6=new B,Ot=class a{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),R1.subVectors(e,t),n.cross(R1);let r=n.lengthSq();return r>0?n.multiplyScalar(1/Math.sqrt(r)):n.set(0,0,0)}static getBarycoord(e,t,i,n,r){R1.subVectors(n,t),T2.subVectors(i,t),X6.subVectors(e,t);let s=R1.dot(R1),o=R1.dot(T2),c=R1.dot(X6),l=T2.dot(T2),h=T2.dot(X6),u=s*l-o*o;if(u===0)return r.set(-2,-1,-1);let f=1/u,d=(l*c-o*h)*f,p=(s*h-o*c)*f;return r.set(1-d-p,p,d)}static containsPoint(e,t,i,n){return this.getBarycoord(e,t,i,n,D2),D2.x>=0&&D2.y>=0&&D2.x+D2.y<=1}static getUV(e,t,i,n,r,s,o,c){return this.getBarycoord(e,t,i,n,D2),c.set(0,0),c.addScaledVector(r,D2.x),c.addScaledVector(s,D2.y),c.addScaledVector(o,D2.z),c}static isFrontFacing(e,t,i,n){return R1.subVectors(i,t),T2.subVectors(e,t),R1.cross(T2).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 R1.subVectors(this.c,this.b),T2.subVectors(this.a,this.b),R1.cross(T2).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return a.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return a.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,n,r){return a.getUV(e,this.a,this.b,this.c,t,i,n,r)}containsPoint(e){return a.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return a.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let i=this.a,n=this.b,r=this.c,s,o;kn.subVectors(n,i),On.subVectors(r,i),Y6.subVectors(e,i);let c=kn.dot(Y6),l=On.dot(Y6);if(c<=0&&l<=0)return t.copy(i);$6.subVectors(e,n);let h=kn.dot($6),u=On.dot($6);if(h>=0&&u<=h)return t.copy(n);let f=c*u-h*l;if(f<=0&&c>=0&&h<=0)return s=c/(c-h),t.copy(i).addScaledVector(kn,s);J6.subVectors(e,r);let d=kn.dot(J6),p=On.dot(J6);if(p>=0&&d<=p)return t.copy(r);let v=d*l-c*p;if(v<=0&&l>=0&&p<=0)return o=l/(l-p),t.copy(i).addScaledVector(On,o);let x=h*p-d*u;if(x<=0&&u-h>=0&&d-p>=0)return yh.subVectors(r,n),o=(u-h)/(u-h+(d-p)),t.copy(n).addScaledVector(yh,o);let g=1/(x+v+f);return s=v*g,o=f*g,t.copy(i).addScaledVector(kn,s).addScaledVector(On,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},Dm=0,xt=class extends V2{constructor(){super(),Object.defineProperty(this,"id",{value:Dm++}),this.uuid=F1(),this.name="",this.type="Material",this.fog=!0,this.blending=bs,this.side=As,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=gu,this.blendDst=vu,this.blendEquation=Kn,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=m3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=wm,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=N6,this.stencilZFail=N6,this.stencilZPass=N6,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===mu;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!==bs&&(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(r){let s=[];for(let o in r){let c=r[o];delete c.metadata,s.push(c)}return s}if(t){let r=n(e.textures),s=n(e.images);r.length>0&&(i.textures=r),s.length>0&&(i.images=s)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,i=null;if(t!==null){let n=t.length;i=new Array(n);for(let r=0;r!==n;++r)i[r]=t[r].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.alphaWrite=e.alphaWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}};xt.prototype.isMaterial=!0;var Ts=class extends xt{constructor(e){super(),this.type="MeshBasicMaterial",this.color=new we(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=Zo,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}};Ts.prototype.isMeshBasicMaterial=!0;var Ke=new B,W4=new te,mt=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=_s,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,r=this.itemSize;n<r;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,r=e.length;n<r;n++){let s=e[n];s===void 0&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",n),s=new we),t[i++]=s.r,t[i++]=s.g,t[i++]=s.b}return this}copyVector2sArray(e){let t=this.array,i=0;for(let n=0,r=e.length;n<r;n++){let s=e[n];s===void 0&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",n),s=new te),t[i++]=s.x,t[i++]=s.y}return this}copyVector3sArray(e){let t=this.array,i=0;for(let n=0,r=e.length;n<r;n++){let s=e[n];s===void 0&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",n),s=new B),t[i++]=s.x,t[i++]=s.y,t[i++]=s.z}return this}copyVector4sArray(e){let t=this.array,i=0;for(let n=0,r=e.length;n<r;n++){let s=e[n];s===void 0&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",n),s=new $e),t[i++]=s.x,t[i++]=s.y,t[i++]=s.z,t[i++]=s.w}return this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)W4.fromBufferAttribute(this,t),W4.applyMatrix3(e),this.setXY(t,W4.x,W4.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)Ke.fromBufferAttribute(this,t),Ke.applyMatrix3(e),this.setXYZ(t,Ke.x,Ke.y,Ke.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)Ke.x=this.getX(t),Ke.y=this.getY(t),Ke.z=this.getZ(t),Ke.applyMatrix4(e),this.setXYZ(t,Ke.x,Ke.y,Ke.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Ke.x=this.getX(t),Ke.y=this.getY(t),Ke.z=this.getZ(t),Ke.applyNormalMatrix(e),this.setXYZ(t,Ke.x,Ke.y,Ke.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Ke.x=this.getX(t),Ke.y=this.getY(t),Ke.z=this.getZ(t),Ke.transformDirection(e),this.setXYZ(t,Ke.x,Ke.y,Ke.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,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this.array[e+3]=r,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!==_s&&(e.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(e.updateRange=this.updateRange),e}};mt.prototype.isBufferAttribute=!0;var zo=class extends mt{constructor(e,t,i){super(new Uint16Array(e),t,i)}};var Co=class extends mt{constructor(e,t,i){super(new Uint32Array(e),t,i)}},z3=class extends mt{constructor(e,t,i){super(new Uint16Array(e),t,i)}};z3.prototype.isFloat16BufferAttribute=!0;var vt=class extends mt{constructor(e,t,i){super(new Float32Array(e),t,i)}};var Hm=0,x1=new _e,Q6=new Ze,Un=new B,c1=new h1,fs=new h1,Dt=new B,st=class a extends V2{constructor(){super(),Object.defineProperty(this,"id",{value:Hm++}),this.uuid=F1(),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(wu(e)?Co:zo)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let i=this.attributes.normal;if(i!==void 0){let r=new At().getNormalMatrix(e);i.applyNormalMatrix(r),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 x1.makeRotationFromQuaternion(e),this.applyMatrix4(x1),this}rotateX(e){return x1.makeRotationX(e),this.applyMatrix4(x1),this}rotateY(e){return x1.makeRotationY(e),this.applyMatrix4(x1),this}rotateZ(e){return x1.makeRotationZ(e),this.applyMatrix4(x1),this}translate(e,t,i){return x1.makeTranslation(e,t,i),this.applyMatrix4(x1),this}scale(e,t,i){return x1.makeScale(e,t,i),this.applyMatrix4(x1),this}lookAt(e){return Q6.lookAt(e),Q6.updateMatrix(),this.applyMatrix4(Q6.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Un).negate(),this.translate(Un.x,Un.y,Un.z),this}setFromPoints(e){let t=[];for(let i=0,n=e.length;i<n;i++){let r=e[i];t.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new vt(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new h1);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 r=t[i];c1.setFromBufferAttribute(r),this.morphTargetsRelative?(Dt.addVectors(this.boundingBox.min,c1.min),this.boundingBox.expandByPoint(Dt),Dt.addVectors(this.boundingBox.max,c1.max),this.boundingBox.expandByPoint(Dt)):(this.boundingBox.expandByPoint(c1.min),this.boundingBox.expandByPoint(c1.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 yi);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(c1.setFromBufferAttribute(e),t)for(let r=0,s=t.length;r<s;r++){let o=t[r];fs.setFromBufferAttribute(o),this.morphTargetsRelative?(Dt.addVectors(c1.min,fs.min),c1.expandByPoint(Dt),Dt.addVectors(c1.max,fs.max),c1.expandByPoint(Dt)):(c1.expandByPoint(fs.min),c1.expandByPoint(fs.max))}c1.getCenter(i);let n=0;for(let r=0,s=e.count;r<s;r++)Dt.fromBufferAttribute(e,r),n=Math.max(n,i.distanceToSquared(Dt));if(t)for(let r=0,s=t.length;r<s;r++){let o=t[r],c=this.morphTargetsRelative;for(let l=0,h=o.count;l<h;l++)Dt.fromBufferAttribute(o,l),c&&(Un.fromBufferAttribute(e,l),Dt.add(Un)),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,r=t.normal.array,s=t.uv.array,o=n.length/3;t.tangent===void 0&&this.setAttribute("tangent",new mt(new Float32Array(4*o),4));let c=t.tangent.array,l=[],h=[];for(let H=0;H<o;H++)l[H]=new B,h[H]=new B;let u=new B,f=new B,d=new B,p=new te,v=new te,x=new te,g=new B,m=new B;function M(H,w,T){u.fromArray(n,H*3),f.fromArray(n,w*3),d.fromArray(n,T*3),p.fromArray(s,H*2),v.fromArray(s,w*2),x.fromArray(s,T*2),f.sub(u),d.sub(u),v.sub(p),x.sub(p);let A=1/(v.x*x.y-x.x*v.y);isFinite(A)&&(g.copy(f).multiplyScalar(x.y).addScaledVector(d,-v.y).multiplyScalar(A),m.copy(d).multiplyScalar(v.x).addScaledVector(f,-x.x).multiplyScalar(A),l[H].add(g),l[w].add(g),l[T].add(g),h[H].add(m),h[w].add(m),h[T].add(m))}let y=this.groups;y.length===0&&(y=[{start:0,count:i.length}]);for(let H=0,w=y.length;H<w;++H){let T=y[H],A=T.start,R=T.count;for(let V=A,L=A+R;V<L;V+=3)M(i[V+0],i[V+1],i[V+2])}let b=new B,C=new B,_=new B,S=new B;function P(H){_.fromArray(r,H*3),S.copy(_);let w=l[H];b.copy(w),b.sub(_.multiplyScalar(_.dot(w))).normalize(),C.crossVectors(S,w);let A=C.dot(h[H])<0?-1:1;c[H*4]=b.x,c[H*4+1]=b.y,c[H*4+2]=b.z,c[H*4+3]=A}for(let H=0,w=y.length;H<w;++H){let T=y[H],A=T.start,R=T.count;for(let V=A,L=A+R;V<L;V+=3)P(i[V+0]),P(i[V+1]),P(i[V+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 mt(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let f=0,d=i.count;f<d;f++)i.setXYZ(f,0,0,0);let n=new B,r=new B,s=new B,o=new B,c=new B,l=new B,h=new B,u=new B;if(e)for(let f=0,d=e.count;f<d;f+=3){let p=e.getX(f+0),v=e.getX(f+1),x=e.getX(f+2);n.fromBufferAttribute(t,p),r.fromBufferAttribute(t,v),s.fromBufferAttribute(t,x),h.subVectors(s,r),u.subVectors(n,r),h.cross(u),o.fromBufferAttribute(i,p),c.fromBufferAttribute(i,v),l.fromBufferAttribute(i,x),o.add(h),c.add(h),l.add(h),i.setXYZ(p,o.x,o.y,o.z),i.setXYZ(v,c.x,c.y,c.z),i.setXYZ(x,l.x,l.y,l.z)}else for(let f=0,d=t.count;f<d;f+=3)n.fromBufferAttribute(t,f+0),r.fromBufferAttribute(t,f+1),s.fromBufferAttribute(t,f+2),h.subVectors(s,r),u.subVectors(n,r),h.cross(u),i.setXYZ(f+0,h.x,h.y,h.z),i.setXYZ(f+1,h.x,h.y,h.z),i.setXYZ(f+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 s=i[n].array,o=e.attributes[n],c=o.array,l=o.itemSize*t,h=Math.min(c.length,s.length-l);for(let u=0,f=l;u<h;u++,f++)s[f]=c[u]}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(o,c){let l=o.array,h=o.itemSize,u=o.normalized,f=new l.constructor(c.length*h),d=0,p=0;for(let v=0,x=c.length;v<x;v++){o.isInterleavedBufferAttribute?d=c[v]*o.data.stride+o.offset:d=c[v]*h;for(let g=0;g<h;g++)f[p++]=l[d++]}return new mt(f,h,u)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new a,i=this.index.array,n=this.attributes;for(let o in n){let c=n[o],l=e(c,i);t.setAttribute(o,l)}let r=this.morphAttributes;for(let o in r){let c=[],l=r[o];for(let h=0,u=l.length;h<u;h++){let f=l[h],d=e(f,i);c.push(d)}t.morphAttributes[o]=c}t.morphTargetsRelative=this.morphTargetsRelative;let s=this.groups;for(let o=0,c=s.length;o<c;o++){let l=s[o];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={},r=!1;for(let c in this.morphAttributes){let l=this.morphAttributes[c],h=[];for(let u=0,f=l.length;u<f;u++){let d=l[u];h.push(d.toJSON(e.data))}h.length>0&&(n[c]=h,r=!0)}r&&(e.data.morphAttributes=n,e.data.morphTargetsRelative=this.morphTargetsRelative);let s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));let o=this.boundingSphere;return o!==null&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let i=e.index;i!==null&&this.setIndex(i.clone(t));let n=e.attributes;for(let l in n){let h=n[l];this.setAttribute(l,h.clone(t))}let r=e.morphAttributes;for(let l in r){let h=[],u=r[l];for(let f=0,d=u.length;f<d;f++)h.push(u[f].clone(t));this.morphAttributes[l]=h}this.morphTargetsRelative=e.morphTargetsRelative;let s=e.groups;for(let l=0,h=s.length;l<h;l++){let u=s[l];this.addGroup(u.start,u.count,u.materialIndex)}let o=e.boundingBox;o!==null&&(this.boundingBox=o.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"})}};st.prototype.isBufferGeometry=!0;var wh=new _e,qn=new wi,K6=new yi,ci=new B,li=new B,hi=new B,e3=new B,t3=new B,i3=new B,j4=new B,Z4=new B,X4=new B,Y4=new te,$4=new te,J4=new te,n3=new B,Q4=new B,Vt=class extends Ze{constructor(e=new st,t=new Ts){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 r=0,s=n.length;r<s;r++){let o=n[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}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,r=this.matrixWorld;if(n===void 0||(i.boundingSphere===null&&i.computeBoundingSphere(),K6.copy(i.boundingSphere),K6.applyMatrix4(r),e.ray.intersectsSphere(K6)===!1)||(wh.copy(r).invert(),qn.copy(e.ray).applyMatrix4(wh),i.boundingBox!==null&&qn.intersectsBox(i.boundingBox)===!1))return;let s;if(i.isBufferGeometry){let o=i.index,c=i.attributes.position,l=i.morphAttributes.position,h=i.morphTargetsRelative,u=i.attributes.uv,f=i.attributes.uv2,d=i.groups,p=i.drawRange;if(o!==null)if(Array.isArray(n))for(let v=0,x=d.length;v<x;v++){let g=d[v],m=n[g.materialIndex],M=Math.max(g.start,p.start),y=Math.min(o.count,Math.min(g.start+g.count,p.start+p.count));for(let b=M,C=y;b<C;b+=3){let _=o.getX(b),S=o.getX(b+1),P=o.getX(b+2);s=K4(this,m,e,qn,c,l,h,u,f,_,S,P),s&&(s.faceIndex=Math.floor(b/3),s.face.materialIndex=g.materialIndex,t.push(s))}}else{let v=Math.max(0,p.start),x=Math.min(o.count,p.start+p.count);for(let g=v,m=x;g<m;g+=3){let M=o.getX(g),y=o.getX(g+1),b=o.getX(g+2);s=K4(this,n,e,qn,c,l,h,u,f,M,y,b),s&&(s.faceIndex=Math.floor(g/3),t.push(s))}}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],M=Math.max(g.start,p.start),y=Math.min(c.count,Math.min(g.start+g.count,p.start+p.count));for(let b=M,C=y;b<C;b+=3){let _=b,S=b+1,P=b+2;s=K4(this,m,e,qn,c,l,h,u,f,_,S,P),s&&(s.faceIndex=Math.floor(b/3),s.face.materialIndex=g.materialIndex,t.push(s))}}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 M=g,y=g+1,b=g+2;s=K4(this,n,e,qn,c,l,h,u,f,M,y,b),s&&(s.faceIndex=Math.floor(g/3),t.push(s))}}}else i.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}};Vt.prototype.isMesh=!0;function Vm(a,e,t,i,n,r,s,o){let c;if(e.side===zt?c=i.intersectTriangle(s,r,n,!0,o):c=i.intersectTriangle(n,r,s,e.side!==or,o),c===null)return null;Q4.copy(o),Q4.applyMatrix4(a.matrixWorld);let l=t.ray.origin.distanceTo(Q4);return l<t.near||l>t.far?null:{distance:l,point:Q4.clone(),object:a}}function K4(a,e,t,i,n,r,s,o,c,l,h,u){ci.fromBufferAttribute(n,l),li.fromBufferAttribute(n,h),hi.fromBufferAttribute(n,u);let f=a.morphTargetInfluences;if(r&&f){j4.set(0,0,0),Z4.set(0,0,0),X4.set(0,0,0);for(let p=0,v=r.length;p<v;p++){let x=f[p],g=r[p];x!==0&&(e3.fromBufferAttribute(g,l),t3.fromBufferAttribute(g,h),i3.fromBufferAttribute(g,u),s?(j4.addScaledVector(e3,x),Z4.addScaledVector(t3,x),X4.addScaledVector(i3,x)):(j4.addScaledVector(e3.sub(ci),x),Z4.addScaledVector(t3.sub(li),x),X4.addScaledVector(i3.sub(hi),x)))}ci.add(j4),li.add(Z4),hi.add(X4)}a.isSkinnedMesh&&(a.boneTransform(l,ci),a.boneTransform(h,li),a.boneTransform(u,hi));let d=Vm(a,e,t,i,ci,li,hi,n3);if(d){o&&(Y4.fromBufferAttribute(o,l),$4.fromBufferAttribute(o,h),J4.fromBufferAttribute(o,u),d.uv=Ot.getUV(n3,ci,li,hi,Y4,$4,J4,new te)),c&&(Y4.fromBufferAttribute(c,l),$4.fromBufferAttribute(c,h),J4.fromBufferAttribute(c,u),d.uv2=Ot.getUV(n3,ci,li,hi,Y4,$4,J4,new te));let p={a:l,b:h,c:u,normal:new B,materialIndex:0};Ot.getNormal(ci,li,hi,p.normal),d.face=p}return d}var Ds=class a extends st{constructor(e=1,t=1,i=1,n=1,r=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:n,heightSegments:r,depthSegments:s};let o=this;n=Math.floor(n),r=Math.floor(r),s=Math.floor(s);let c=[],l=[],h=[],u=[],f=0,d=0;p("z","y","x",-1,-1,i,t,e,s,r,0),p("z","y","x",1,-1,i,t,-e,s,r,1),p("x","z","y",1,1,e,i,t,n,s,2),p("x","z","y",1,-1,e,i,-t,n,s,3),p("x","y","z",1,-1,e,t,i,n,r,4),p("x","y","z",-1,-1,e,t,-i,n,r,5),this.setIndex(c),this.setAttribute("position",new vt(l,3)),this.setAttribute("normal",new vt(h,3)),this.setAttribute("uv",new vt(u,2));function p(v,x,g,m,M,y,b,C,_,S,P){let H=y/_,w=b/S,T=y/2,A=b/2,R=C/2,V=_+1,L=S+1,N=0,I=0,W=new B;for(let O=0;O<L;O++){let q=O*w-A;for(let j=0;j<V;j++){let ie=j*H-T;W[v]=ie*m,W[x]=q*M,W[g]=R,l.push(W.x,W.y,W.z),W[v]=0,W[x]=0,W[g]=C>0?1:-1,h.push(W.x,W.y,W.z),u.push(j/_),u.push(1-O/S),N+=1}}for(let O=0;O<S;O++)for(let q=0;q<_;q++){let j=f+q+V*O,ie=f+q+V*(O+1),ae=f+(q+1)+V*(O+1),U=f+(q+1)+V*O;c.push(j,ie,U),c.push(ie,ae,U),I+=6}o.addGroup(d,I,P),d+=I,f+=N}}static fromJSON(e){return new a(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};function hr(a){let e={};for(let t in a){e[t]={};for(let i in a[t]){let n=a[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 Pt(a){let e={};for(let t=0;t<a.length;t++){let i=hr(a[t]);for(let n in i)e[n]=i[n]}return e}var Rm={clone:hr,merge:Pt},Nm=`void main() {
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,Fm=`void main() {
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`,N2=class extends xt{constructor(e){super(),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=Nm,this.fragmentShader=Fm,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=hr(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 s=this.uniforms[n].value;s&&s.isTexture?t.uniforms[n]={type:"t",value:s.toJSON(e).uuid}:s&&s.isColor?t.uniforms[n]={type:"c",value:s.getHex()}:s&&s.isVector2?t.uniforms[n]={type:"v2",value:s.toArray()}:s&&s.isVector3?t.uniforms[n]={type:"v3",value:s.toArray()}:s&&s.isVector4?t.uniforms[n]={type:"v4",value:s.toArray()}:s&&s.isMatrix3?t.uniforms[n]={type:"m3",value:s.toArray()}:s&&s.isMatrix4?t.uniforms[n]={type:"m4",value:s.toArray()}:t.uniforms[n]={value:s}}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}};N2.prototype.isShaderMaterial=!0;var Hs=class extends Ze{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new _e,this.projectionMatrix=new _e,this.projectionMatrixInverse=new _e}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)}};Hs.prototype.isCamera=!0;var Ht=class extends Hs{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=b3*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(F6*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return b3*2*Math.atan(Math.tan(F6*.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,r,s){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=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(F6*.5*this.fov)/this.zoom,i=2*t,n=this.aspect*i,r=-.5*n,s=this.view;if(this.view!==null&&this.view.enabled){let c=s.fullWidth,l=s.fullHeight;r+=s.offsetX*n/c,t-=s.offsetY*i/l,n*=s.width/c,i*=s.height/l}let o=this.filmOffset;o!==0&&(r+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+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}};Ht.prototype.isPerspectiveCamera=!0;var Gn=90,Wn=1,Vs=class extends Ze{constructor(e,t,i){if(super(),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 Ht(Gn,Wn,e,t);n.layers=this.layers,n.up.set(0,-1,0),n.lookAt(new B(1,0,0)),this.add(n);let r=new Ht(Gn,Wn,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new B(-1,0,0)),this.add(r);let s=new Ht(Gn,Wn,e,t);s.layers=this.layers,s.up.set(0,0,1),s.lookAt(new B(0,1,0)),this.add(s);let o=new Ht(Gn,Wn,e,t);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new B(0,-1,0)),this.add(o);let c=new Ht(Gn,Wn,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 Ht(Gn,Wn,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,r,s,o,c,l]=this.children,h=e.xr.enabled,u=e.getRenderTarget();e.xr.enabled=!1;let f=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0),e.render(t,n),e.setRenderTarget(i,1),e.render(t,r),e.setRenderTarget(i,2),e.render(t,s),e.setRenderTarget(i,3),e.render(t,o),e.setRenderTarget(i,4),e.render(t,c),i.texture.generateMipmaps=f,e.setRenderTarget(i,5),e.render(t,l),e.setRenderTarget(u),e.xr.enabled=h,i.texture.needsPMREMUpdate=!0}},ur=class extends St{constructor(e,t,i,n,r,s,o,c,l,h){e=e!==void 0?e:[],t=t!==void 0?t:ea,super(e,t,i,n,r,s,o,c,l,h),this.flipY=!1}get images(){return this.image}set images(e){this.image=e}};ur.prototype.isCubeTexture=!0;var Ao=class extends e1{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 ur(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:It}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.format=Xt,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 Ds(5,5,5),r=new N2({name:"CubemapFromEquirect",uniforms:hr(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:zt,blending:fi});r.uniforms.tEquirect.value=t;let s=new Vt(n,r),o=t.minFilter;return t.minFilter===Yo&&(t.minFilter=It),new Vs(1,10,this).update(e,s),t.minFilter=o,s.geometry.dispose(),s.material.dispose(),this}clear(e,t,i,n){let r=e.getRenderTarget();for(let s=0;s<6;s++)e.setRenderTarget(this,s),e.clear(t,i,n);e.setRenderTarget(r)}};Ao.prototype.isWebGLCubeRenderTarget=!0;var r3=new B,Bm=new B,Pm=new At,N1=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=r3.subVectors(i,t).cross(Bm.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(r3),n=this.normal.dot(i);if(n===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let r=-(e.start.dot(this.normal)+this.constant)/n;return r<0||r>1?null:t.copy(i).multiplyScalar(r).add(e.start)}intersectsLine(e){let t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let i=t||Pm.getNormalMatrix(e),n=this.coplanarPoint(r3).applyMatrix4(e),r=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}};N1.prototype.isPlane=!0;var jn=new yi,eo=new B,fr=class{constructor(e=new N1,t=new N1,i=new N1,n=new N1,r=new N1,s=new N1){this.planes=[e,t,i,n,r,s]}set(e,t,i,n,r,s){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(i),o[3].copy(n),o[4].copy(r),o[5].copy(s),this}copy(e){let t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e){let t=this.planes,i=e.elements,n=i[0],r=i[1],s=i[2],o=i[3],c=i[4],l=i[5],h=i[6],u=i[7],f=i[8],d=i[9],p=i[10],v=i[11],x=i[12],g=i[13],m=i[14],M=i[15];return t[0].setComponents(o-n,u-c,v-f,M-x).normalize(),t[1].setComponents(o+n,u+c,v+f,M+x).normalize(),t[2].setComponents(o+r,u+l,v+d,M+g).normalize(),t[3].setComponents(o-r,u-l,v-d,M-g).normalize(),t[4].setComponents(o-s,u-h,v-p,M-m).normalize(),t[5].setComponents(o+s,u+h,v+p,M+m).normalize(),this}intersectsObject(e){let t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),jn.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(jn)}intersectsSprite(e){return jn.center.set(0,0,0),jn.radius=.7071067811865476,jn.applyMatrix4(e.matrixWorld),this.intersectsSphere(jn)}intersectsSphere(e){let t=this.planes,i=e.center,n=-e.radius;for(let r=0;r<6;r++)if(t[r].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(eo.x=n.normal.x>0?e.max.x:e.min.x,eo.y=n.normal.y>0?e.max.y:e.min.y,eo.z=n.normal.z>0?e.max.z:e.min.z,n.distanceToPoint(eo)<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 Mu(){let a=null,e=!1,t=null,i=null;function n(r,s){t(r,s),i=a.requestAnimationFrame(n)}return{start:function(){e!==!0&&t!==null&&(i=a.requestAnimationFrame(n),e=!0)},stop:function(){a.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(r){t=r},setContext:function(r){a=r}}}function Im(a,e){let t=e.isWebGL2,i=new WeakMap;function n(l,h){let u=l.array,f=l.usage,d=a.createBuffer();a.bindBuffer(h,d),a.bufferData(h,u,f),l.onUploadCallback();let p=5126;return u instanceof Float32Array?p=5126:u instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):u instanceof Uint16Array?l.isFloat16BufferAttribute?t?p=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):p=5123:u instanceof Int16Array?p=5122:u instanceof Uint32Array?p=5125:u instanceof Int32Array?p=5124:u instanceof Int8Array?p=5120:(u instanceof Uint8Array||u instanceof Uint8ClampedArray)&&(p=5121),{buffer:d,type:p,bytesPerElement:u.BYTES_PER_ELEMENT,version:l.version}}function r(l,h,u){let f=h.array,d=h.updateRange;a.bindBuffer(u,l),d.count===-1?a.bufferSubData(u,0,f):(t?a.bufferSubData(u,d.offset*f.BYTES_PER_ELEMENT,f,d.offset,d.count):a.bufferSubData(u,d.offset*f.BYTES_PER_ELEMENT,f.subarray(d.offset,d.offset+d.count)),d.count=-1)}function s(l){return l.isInterleavedBufferAttribute&&(l=l.data),i.get(l)}function o(l){l.isInterleavedBufferAttribute&&(l=l.data);let h=i.get(l);h&&(a.deleteBuffer(h.buffer),i.delete(l))}function c(l,h){if(l.isGLBufferAttribute){let f=i.get(l);(!f||f.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 u=i.get(l);u===void 0?i.set(l,n(l,h)):u.version<l.version&&(r(u.buffer,l,h),u.version=l.version)}return{get:s,remove:o,update:c}}var Rs=class a extends st{constructor(e=1,t=1,i=1,n=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:n};let r=e/2,s=t/2,o=Math.floor(i),c=Math.floor(n),l=o+1,h=c+1,u=e/o,f=t/c,d=[],p=[],v=[],x=[];for(let g=0;g<h;g++){let m=g*f-s;for(let M=0;M<l;M++){let y=M*u-r;p.push(y,-m,0),v.push(0,0,1),x.push(M/o),x.push(1-g/c)}}for(let g=0;g<c;g++)for(let m=0;m<o;m++){let M=m+l*g,y=m+l*(g+1),b=m+1+l*(g+1),C=m+1+l*g;d.push(M,y,C),d.push(y,b,C)}this.setIndex(d),this.setAttribute("position",new vt(p,3)),this.setAttribute("normal",new vt(v,3)),this.setAttribute("uv",new vt(x,2))}static fromJSON(e){return new a(e.width,e.height,e.widthSegments,e.heightSegments)}},km=`#ifdef USE_ALPHAMAP
diffuseColor.a *= texture2D( alphaMap, vUv ).g;
#endif`,Om=`#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
#endif`,Um=`#ifdef USE_ALPHATEST
if ( diffuseColor.a < alphaTest ) discard;
#endif`,qm=`#ifdef USE_ALPHATEST
uniform float alphaTest;
#endif`,Gm=`#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`,Wm=`#ifdef USE_AOMAP
uniform sampler2D aoMap;
uniform float aoMapIntensity;
#endif`,jm="vec3 transformed = vec3( position );",Zm=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
vec3 objectTangent = vec3( tangent.xyz );
#endif`,Xm=`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`,Ym=`#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`,$m=`#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`,Jm=`#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,Qm=`#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
#endif`,Km=`#if NUM_CLIPPING_PLANES > 0
vClipPosition = - mvPosition.xyz;
#endif`,eg=`#if defined( USE_COLOR_ALPHA )
diffuseColor *= vColor;
#elif defined( USE_COLOR )
diffuseColor.rgb *= vColor;
#endif`,tg=`#if defined( USE_COLOR_ALPHA )
varying vec4 vColor;
#elif defined( USE_COLOR )
varying vec3 vColor;
#endif`,ig=`#if defined( USE_COLOR_ALPHA )
varying vec4 vColor;
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
varying vec3 vColor;
#endif`,ng=`#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`,rg=`#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 );
}`,sg=`#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`,ag=`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`,og=`#ifdef USE_DISPLACEMENTMAP
uniform sampler2D displacementMap;
uniform float displacementScale;
uniform float displacementBias;
#endif`,cg=`#ifdef USE_DISPLACEMENTMAP
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );
#endif`,lg=`#ifdef USE_EMISSIVEMAP
vec4 emissiveColor = texture2D( emissiveMap, vUv );
totalEmissiveRadiance *= emissiveColor.rgb;
#endif`,hg=`#ifdef USE_EMISSIVEMAP
uniform sampler2D emissiveMap;
#endif`,ug="gl_FragColor = linearToOutputTexel( gl_FragColor );",fg=`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 );
}`,dg=`#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`,pg=`#ifdef USE_ENVMAP
uniform float envMapIntensity;
uniform float flipEnvMap;
#ifdef ENVMAP_TYPE_CUBE
uniform samplerCube envMap;
#else
uniform sampler2D envMap;
#endif
#endif`,mg=`#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`,gg=`#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`,vg=`#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`,xg=`#ifdef USE_FOG
vFogDepth = - mvPosition.z;
#endif`,yg=`#ifdef USE_FOG
varying float vFogDepth;
#endif`,wg=`#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`,bg=`#ifdef USE_FOG
uniform vec3 fogColor;
varying float vFogDepth;
#ifdef FOG_EXP2
uniform float fogDensity;
#else
uniform float fogNear;
uniform float fogFar;
#endif
#endif`,Mg=`#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
}`,zg=`#ifdef USE_LIGHTMAP
vec4 lightMapTexel = texture2D( lightMap, vUv2 );
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
#ifndef PHYSICALLY_CORRECT_LIGHTS
lightMapIrradiance *= PI;
#endif
reflectedLight.indirectDiffuse += lightMapIrradiance;
#endif`,Cg=`#ifdef USE_LIGHTMAP
uniform sampler2D lightMap;
uniform float lightMapIntensity;
#endif`,Ag=`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`,Sg=`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`,_g=`#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`,Eg=`ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`,Lg=`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)`,Tg=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`,Dg=`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)`,Hg=`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`,Vg=`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 );
}`,Rg=`
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`,Ng=`#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`,Fg=`#if defined( RE_IndirectDiffuse )
RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );
#endif
#if defined( RE_IndirectSpecular )
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );
#endif`,Bg=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,Pg=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
uniform float logDepthBufFC;
varying float vFragDepth;
varying float vIsPerspective;
#endif`,Ig=`#ifdef USE_LOGDEPTHBUF
#ifdef USE_LOGDEPTHBUF_EXT
varying float vFragDepth;
varying float vIsPerspective;
#else
uniform float logDepthBufFC;
#endif
#endif`,kg=`#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`,Og=`#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`,Ug=`#ifdef USE_MAP
uniform sampler2D map;
#endif`,qg=`#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`,Gg=`#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`,Wg=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
vec4 texelMetalness = texture2D( metalnessMap, vUv );
metalnessFactor *= texelMetalness.b;
#endif`,jg=`#ifdef USE_METALNESSMAP
uniform sampler2D metalnessMap;
#endif`,Zg=`#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`,Xg=`#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`,Yg=`#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`,$g=`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;`,Jg=`#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`,Qg=`#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
#endif`,Kg=`#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
#endif`,ev=`#ifndef FLAT_SHADED
vNormal = normalize( transformedNormal );
#ifdef USE_TANGENT
vTangent = normalize( transformedTangent );
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
#endif
#endif`,tv=`#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`,iv=`#ifdef USE_CLEARCOAT
vec3 clearcoatNormal = geometryNormal;
#endif`,nv=`#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`,rv=`#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`,sv=`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= transmissionAlpha + 0.1;
#endif
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,av=`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 );
}`,ov=`#ifdef PREMULTIPLIED_ALPHA
gl_FragColor.rgb *= gl_FragColor.a;
#endif`,cv=`vec4 mvPosition = vec4( transformed, 1.0 );
#ifdef USE_INSTANCING
mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
gl_Position = projectionMatrix * mvPosition;`,lv=`#ifdef DITHERING
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`,hv=`#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`,uv=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
vec4 texelRoughness = texture2D( roughnessMap, vUv );
roughnessFactor *= texelRoughness.g;
#endif`,fv=`#ifdef USE_ROUGHNESSMAP
uniform sampler2D roughnessMap;
#endif`,dv=`#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`,pv=`#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`,mv=`#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`,gv=`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;
}`,vv=`#ifdef USE_SKINNING
mat4 boneMatX = getBoneMatrix( skinIndex.x );
mat4 boneMatY = getBoneMatrix( skinIndex.y );
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`,xv=`#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`,yv=`#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`,wv=`#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`,bv=`float specularStrength;
#ifdef USE_SPECULARMAP
vec4 texelSpecular = texture2D( specularMap, vUv );
specularStrength = texelSpecular.r;
#else
specularStrength = 1.0;
#endif`,Mv=`#ifdef USE_SPECULARMAP
uniform sampler2D specularMap;
#endif`,zv=`#if defined( TONE_MAPPING )
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`,Cv=`#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; }`,Av=`#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`,Sv=`#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`,_v=`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )
varying vec2 vUv;
#endif`,Ev=`#ifdef USE_UV
#ifdef UVS_VERTEX_ONLY
vec2 vUv;
#else
varying vec2 vUv;
#endif
uniform mat3 uvTransform;
#endif`,Lv=`#ifdef USE_UV
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
#endif`,Tv=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
varying vec2 vUv2;
#endif`,Dv=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
attribute vec2 uv2;
varying vec2 vUv2;
uniform mat3 uv2Transform;
#endif`,Hv=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;
#endif`,Vv=`#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`,Rv=`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
gl_Position = vec4( position.xy, 1.0, 1.0 );
}`,Nv=`uniform sampler2D t2D;
varying vec2 vUv;
void main() {
gl_FragColor = texture2D( t2D, vUv );
#include <tonemapping_fragment>
#include <encodings_fragment>
}`,Fv=`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
gl_Position.z = gl_Position.w;
}`,Bv=`#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>
}`,Pv=`#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;
}`,Iv=`#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
}`,kv=`#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;
}`,Ov=`#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 );
}`,Uv=`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
}`,qv=`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>
}`,Gv=`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>
}`,Wv=`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>
}`,jv=`#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>
}`,Zv=`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>
}`,Xv=`#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>
}`,Yv=`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>
}`,$v=`#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;
}`,Jv=`#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>
}`,Qv=`#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
}`,Kv=`#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 );
}`,ex=`#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>
}`,tx=`#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>
}`,ix=`#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
}`,nx=`#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>
}`,rx=`#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>
}`,sx=`#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>
}`,ax=`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>
}`,ox=`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>
}`,cx=`#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>
}`,lx=`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>
}`,hx=`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>
}`,ux=`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:km,alphamap_pars_fragment:Om,alphatest_fragment:Um,alphatest_pars_fragment:qm,aomap_fragment:Gm,aomap_pars_fragment:Wm,begin_vertex:jm,beginnormal_vertex:Zm,bsdfs:Xm,bumpmap_pars_fragment:Ym,clipping_planes_fragment:$m,clipping_planes_pars_fragment:Jm,clipping_planes_pars_vertex:Qm,clipping_planes_vertex:Km,color_fragment:eg,color_pars_fragment:tg,color_pars_vertex:ig,color_vertex:ng,common:rg,cube_uv_reflection_fragment:sg,defaultnormal_vertex:ag,displacementmap_pars_vertex:og,displacementmap_vertex:cg,emissivemap_fragment:lg,emissivemap_pars_fragment:hg,encodings_fragment:ug,encodings_pars_fragment:fg,envmap_fragment:dg,envmap_common_pars_fragment:pg,envmap_pars_fragment:mg,envmap_pars_vertex:gg,envmap_physical_pars_fragment:_g,envmap_vertex:vg,fog_vertex:xg,fog_pars_vertex:yg,fog_fragment:wg,fog_pars_fragment:bg,gradientmap_pars_fragment:Mg,lightmap_fragment:zg,lightmap_pars_fragment:Cg,lights_lambert_vertex:Ag,lights_pars_begin:Sg,lights_toon_fragment:Eg,lights_toon_pars_fragment:Lg,lights_phong_fragment:Tg,lights_phong_pars_fragment:Dg,lights_physical_fragment:Hg,lights_physical_pars_fragment:Vg,lights_fragment_begin:Rg,lights_fragment_maps:Ng,lights_fragment_end:Fg,logdepthbuf_fragment:Bg,logdepthbuf_pars_fragment:Pg,logdepthbuf_pars_vertex:Ig,logdepthbuf_vertex:kg,map_fragment:Og,map_pars_fragment:Ug,map_particle_fragment:qg,map_particle_pars_fragment:Gg,metalnessmap_fragment:Wg,metalnessmap_pars_fragment:jg,morphnormal_vertex:Zg,morphtarget_pars_vertex:Xg,morphtarget_vertex:Yg,normal_fragment_begin:$g,normal_fragment_maps:Jg,normal_pars_fragment:Qg,normal_pars_vertex:Kg,normal_vertex:ev,normalmap_pars_fragment:tv,clearcoat_normal_fragment_begin:iv,clearcoat_normal_fragment_maps:nv,clearcoat_pars_fragment:rv,output_fragment:sv,packing:av,premultiplied_alpha_fragment:ov,project_vertex:cv,dithering_fragment:lv,dithering_pars_fragment:hv,roughnessmap_fragment:uv,roughnessmap_pars_fragment:fv,shadowmap_pars_fragment:dv,shadowmap_pars_vertex:pv,shadowmap_vertex:mv,shadowmask_pars_fragment:gv,skinbase_vertex:vv,skinning_pars_vertex:xv,skinning_vertex:yv,skinnormal_vertex:wv,specularmap_fragment:bv,specularmap_pars_fragment:Mv,tonemapping_fragment:zv,tonemapping_pars_fragment:Cv,transmission_fragment:Av,transmission_pars_fragment:Sv,uv_pars_fragment:_v,uv_pars_vertex:Ev,uv_vertex:Lv,uv2_pars_fragment:Tv,uv2_pars_vertex:Dv,uv2_vertex:Hv,worldpos_vertex:Vv,background_vert:Rv,background_frag:Nv,cube_vert:Fv,cube_frag:Bv,depth_vert:Pv,depth_frag:Iv,distanceRGBA_vert:kv,distanceRGBA_frag:Ov,equirect_vert:Uv,equirect_frag:qv,linedashed_vert:Gv,linedashed_frag:Wv,meshbasic_vert:jv,meshbasic_frag:Zv,meshlambert_vert:Xv,meshlambert_frag:Yv,meshmatcap_vert:$v,meshmatcap_frag:Jv,meshnormal_vert:Qv,meshnormal_frag:Kv,meshphong_vert:ex,meshphong_frag:tx,meshphysical_vert:ix,meshphysical_frag:nx,meshtoon_vert:rx,meshtoon_frag:sx,points_vert:ax,points_frag:ox,shadow_vert:cx,shadow_frag:lx,sprite_vert:hx,sprite_frag:ux},oe={common:{diffuse:{value:new we(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new At},uv2Transform:{value:new At},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 we(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 we(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new At}},sprite:{diffuse:{value:new we(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 At}}},J1={basic:{uniforms:Pt([oe.common,oe.specularmap,oe.envmap,oe.aomap,oe.lightmap,oe.fog]),vertexShader:Be.meshbasic_vert,fragmentShader:Be.meshbasic_frag},lambert:{uniforms:Pt([oe.common,oe.specularmap,oe.envmap,oe.aomap,oe.lightmap,oe.emissivemap,oe.fog,oe.lights,{emissive:{value:new we(0)}}]),vertexShader:Be.meshlambert_vert,fragmentShader:Be.meshlambert_frag},phong:{uniforms:Pt([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 we(0)},specular:{value:new we(1118481)},shininess:{value:30}}]),vertexShader:Be.meshphong_vert,fragmentShader:Be.meshphong_frag},standard:{uniforms:Pt([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 we(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Be.meshphysical_vert,fragmentShader:Be.meshphysical_frag},toon:{uniforms:Pt([oe.common,oe.aomap,oe.lightmap,oe.emissivemap,oe.bumpmap,oe.normalmap,oe.displacementmap,oe.gradientmap,oe.fog,oe.lights,{emissive:{value:new we(0)}}]),vertexShader:Be.meshtoon_vert,fragmentShader:Be.meshtoon_frag},matcap:{uniforms:Pt([oe.common,oe.bumpmap,oe.normalmap,oe.displacementmap,oe.fog,{matcap:{value:null}}]),vertexShader:Be.meshmatcap_vert,fragmentShader:Be.meshmatcap_frag},points:{uniforms:Pt([oe.points,oe.fog]),vertexShader:Be.points_vert,fragmentShader:Be.points_frag},dashed:{uniforms:Pt([oe.common,oe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Be.linedashed_vert,fragmentShader:Be.linedashed_frag},depth:{uniforms:Pt([oe.common,oe.displacementmap]),vertexShader:Be.depth_vert,fragmentShader:Be.depth_frag},normal:{uniforms:Pt([oe.common,oe.bumpmap,oe.normalmap,oe.displacementmap,{opacity:{value:1}}]),vertexShader:Be.meshnormal_vert,fragmentShader:Be.meshnormal_frag},sprite:{uniforms:Pt([oe.sprite,oe.fog]),vertexShader:Be.sprite_vert,fragmentShader:Be.sprite_frag},background:{uniforms:{uvTransform:{value:new At},t2D:{value:null}},vertexShader:Be.background_vert,fragmentShader:Be.background_frag},cube:{uniforms:Pt([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:Pt([oe.common,oe.displacementmap,{referencePosition:{value:new B},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Be.distanceRGBA_vert,fragmentShader:Be.distanceRGBA_frag},shadow:{uniforms:Pt([oe.lights,oe.fog,{color:{value:new we(0)},opacity:{value:1}}]),vertexShader:Be.shadow_vert,fragmentShader:Be.shadow_frag}};J1.physical={uniforms:Pt([J1.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 we(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 we(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new we(1,1,1)},specularColorMap:{value:null}}]),vertexShader:Be.meshphysical_vert,fragmentShader:Be.meshphysical_frag};function fx(a,e,t,i,n,r){let s=new we(0),o=n===!0?0:1,c,l,h=null,u=0,f=null;function d(v,x){let g=!1,m=x.isScene===!0?x.background:null;m&&m.isTexture&&(m=e.get(m));let M=a.xr,y=M.getSession&&M.getSession();y&&y.environmentBlendMode==="additive"&&(m=null),m===null?p(s,o):m&&m.isColor&&(p(m,1),g=!0),(a.autoClear||g)&&a.clear(a.autoClearColor,a.autoClearDepth,a.autoClearStencil),m&&(m.isCubeTexture||m.mapping===Xo)?(l===void 0&&(l=new Vt(new Ds(1,1,1),new N2({name:"BackgroundCubeMaterial",uniforms:hr(J1.cube.uniforms),vertexShader:J1.cube.vertexShader,fragmentShader:J1.cube.fragmentShader,side:zt,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(b,C,_){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||u!==m.version||f!==a.toneMapping)&&(l.material.needsUpdate=!0,h=m,u=m.version,f=a.toneMapping),v.unshift(l,l.geometry,l.material,0,0,null)):m&&m.isTexture&&(c===void 0&&(c=new Vt(new Rs(2,2),new N2({name:"BackgroundMaterial",uniforms:hr(J1.background.uniforms),vertexShader:J1.background.vertexShader,fragmentShader:J1.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||u!==m.version||f!==a.toneMapping)&&(c.material.needsUpdate=!0,h=m,u=m.version,f=a.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,r)}return{getClearColor:function(){return s},setClearColor:function(v,x=1){s.set(v),o=x,p(s,o)},getClearAlpha:function(){return o},setClearAlpha:function(v){o=v,p(s,o)},render:d}}function dx(a,e,t,i){let n=a.getParameter(34921),r=i.isWebGL2?null:e.get("OES_vertex_array_object"),s=i.isWebGL2||r!==null,o={},c=v(null),l=c;function h(A,R,V,L,N){let I=!1;if(s){let W=p(L,V,R);l!==W&&(l=W,f(l.object)),I=x(L,N),I&&g(L,N)}else{let W=R.wireframe===!0;(l.geometry!==L.id||l.program!==V.id||l.wireframe!==W)&&(l.geometry=L.id,l.program=V.id,l.wireframe=W,I=!0)}A.isInstancedMesh===!0&&(I=!0),N!==null&&t.update(N,34963),I&&(_(A,R,V,L),N!==null&&a.bindBuffer(34963,t.get(N).buffer))}function u(){return i.isWebGL2?a.createVertexArray():r.createVertexArrayOES()}function f(A){return i.isWebGL2?a.bindVertexArray(A):r.bindVertexArrayOES(A)}function d(A){return i.isWebGL2?a.deleteVertexArray(A):r.deleteVertexArrayOES(A)}function p(A,R,V){let L=V.wireframe===!0,N=o[A.id];N===void 0&&(N={},o[A.id]=N);let I=N[R.id];I===void 0&&(I={},N[R.id]=I);let W=I[L];return W===void 0&&(W=v(u()),I[L]=W),W}function v(A){let R=[],V=[],L=[];for(let N=0;N<n;N++)R[N]=0,V[N]=0,L[N]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:R,enabledAttributes:V,attributeDivisors:L,object:A,attributes:{},index:null}}function x(A,R){let V=l.attributes,L=A.attributes,N=0;for(let I in L){let W=V[I],O=L[I];if(W===void 0||W.attribute!==O||W.data!==O.data)return!0;N++}return l.attributesNum!==N||l.index!==R}function g(A,R){let V={},L=A.attributes,N=0;for(let I in L){let W=L[I],O={};O.attribute=W,W.data&&(O.data=W.data),V[I]=O,N++}l.attributes=V,l.attributesNum=N,l.index=R}function m(){let A=l.newAttributes;for(let R=0,V=A.length;R<V;R++)A[R]=0}function M(A){y(A,0)}function y(A,R){let V=l.newAttributes,L=l.enabledAttributes,N=l.attributeDivisors;V[A]=1,L[A]===0&&(a.enableVertexAttribArray(A),L[A]=1),N[A]!==R&&((i.isWebGL2?a:e.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](A,R),N[A]=R)}function b(){let A=l.newAttributes,R=l.enabledAttributes;for(let V=0,L=R.length;V<L;V++)R[V]!==A[V]&&(a.disableVertexAttribArray(V),R[V]=0)}function C(A,R,V,L,N,I){i.isWebGL2===!0&&(V===5124||V===5125)?a.vertexAttribIPointer(A,R,V,N,I):a.vertexAttribPointer(A,R,V,L,N,I)}function _(A,R,V,L){if(i.isWebGL2===!1&&(A.isInstancedMesh||L.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;m();let N=L.attributes,I=V.getAttributes(),W=R.defaultAttributeValues;for(let O in I){let q=I[O];if(q.location>=0){let j=N[O];if(j===void 0&&(O==="instanceMatrix"&&A.instanceMatrix&&(j=A.instanceMatrix),O==="instanceColor"&&A.instanceColor&&(j=A.instanceColor)),j!==void 0){let ie=j.normalized,ae=j.itemSize,U=t.get(j);if(U===void 0)continue;let Ce=U.buffer,ce=U.type,xe=U.bytesPerElement;if(j.isInterleavedBufferAttribute){let le=j.data,De=le.stride,ze=j.offset;if(le&&le.isInstancedInterleavedBuffer){for(let Q=0;Q<q.locationSize;Q++)y(q.location+Q,le.meshPerAttribute);A.isInstancedMesh!==!0&&L._maxInstanceCount===void 0&&(L._maxInstanceCount=le.meshPerAttribute*le.count)}else for(let Q=0;Q<q.locationSize;Q++)M(q.location+Q);a.bindBuffer(34962,Ce);for(let Q=0;Q<q.locationSize;Q++)C(q.location+Q,ae/q.locationSize,ce,ie,De*xe,(ze+ae/q.locationSize*Q)*xe)}else{if(j.isInstancedBufferAttribute){for(let le=0;le<q.locationSize;le++)y(q.location+le,j.meshPerAttribute);A.isInstancedMesh!==!0&&L._maxInstanceCount===void 0&&(L._maxInstanceCount=j.meshPerAttribute*j.count)}else for(let le=0;le<q.locationSize;le++)M(q.location+le);a.bindBuffer(34962,Ce);for(let le=0;le<q.locationSize;le++)C(q.location+le,ae/q.locationSize,ce,ie,ae*xe,ae/q.locationSize*le*xe)}}else if(W!==void 0){let ie=W[O];if(ie!==void 0)switch(ie.length){case 2:a.vertexAttrib2fv(q.location,ie);break;case 3:a.vertexAttrib3fv(q.location,ie);break;case 4:a.vertexAttrib4fv(q.location,ie);break;default:a.vertexAttrib1fv(q.location,ie)}}}}b()}function S(){w();for(let A in o){let R=o[A];for(let V in R){let L=R[V];for(let N in L)d(L[N].object),delete L[N];delete R[V]}delete o[A]}}function P(A){if(o[A.id]===void 0)return;let R=o[A.id];for(let V in R){let L=R[V];for(let N in L)d(L[N].object),delete L[N];delete R[V]}delete o[A.id]}function H(A){for(let R in o){let V=o[R];if(V[A.id]===void 0)continue;let L=V[A.id];for(let N in L)d(L[N].object),delete L[N];delete V[A.id]}}function w(){T(),l!==c&&(l=c,f(l.object))}function T(){c.geometry=null,c.program=null,c.wireframe=!1}return{setup:h,reset:w,resetDefaultState:T,dispose:S,releaseStatesOfGeometry:P,releaseStatesOfProgram:H,initAttributes:m,enableAttribute:M,disableUnusedAttributes:b}}function px(a,e,t,i){let n=i.isWebGL2,r;function s(l){r=l}function o(l,h){a.drawArrays(r,l,h),t.update(h,r,1)}function c(l,h,u){if(u===0)return;let f,d;if(n)f=a,d="drawArraysInstanced";else if(f=e.get("ANGLE_instanced_arrays"),d="drawArraysInstancedANGLE",f===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}f[d](r,l,h,u),t.update(h,r,u)}this.setMode=s,this.render=o,this.renderInstances=c}function mx(a,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=a.getParameter(_.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function r(_){if(_==="highp"){if(a.getShaderPrecisionFormat(35633,36338).precision>0&&a.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";_="mediump"}return _==="mediump"&&a.getShaderPrecisionFormat(35633,36337).precision>0&&a.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}let s=typeof WebGL2RenderingContext<"u"&&a instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext<"u"&&a instanceof WebGL2ComputeRenderingContext,o=t.precision!==void 0?t.precision:"highp",c=r(o);c!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",c,"instead."),o=c);let l=s||e.has("WEBGL_draw_buffers"),h=t.logarithmicDepthBuffer===!0,u=a.getParameter(34930),f=a.getParameter(35660),d=a.getParameter(3379),p=a.getParameter(34076),v=a.getParameter(34921),x=a.getParameter(36347),g=a.getParameter(36348),m=a.getParameter(36349),M=f>0,y=s||e.has("OES_texture_float"),b=M&&y,C=s?a.getParameter(36183):0;return{isWebGL2:s,drawBuffers:l,getMaxAnisotropy:n,getMaxPrecision:r,precision:o,logarithmicDepthBuffer:h,maxTextures:u,maxVertexTextures:f,maxTextureSize:d,maxCubemapSize:p,maxAttributes:v,maxVertexUniforms:x,maxVaryings:g,maxFragmentUniforms:m,vertexTextures:M,floatFragmentTextures:y,floatVertexTextures:b,maxSamples:C}}function gx(a){let e=this,t=null,i=0,n=!1,r=!1,s=new N1,o=new At,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(u,f,d){let p=u.length!==0||f||i!==0||n;return n=f,t=h(u,d,0),i=u.length,p},this.beginShadows=function(){r=!0,h(null)},this.endShadows=function(){r=!1,l()},this.setState=function(u,f,d){let p=u.clippingPlanes,v=u.clipIntersection,x=u.clipShadows,g=a.get(u);if(!n||p===null||p.length===0||r&&!x)r?h(null):l();else{let m=r?0:i,M=m*4,y=g.clippingState||null;c.value=y,y=h(p,f,M,d);for(let b=0;b!==M;++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(u,f,d,p){let v=u!==null?u.length:0,x=null;if(v!==0){if(x=c.value,p!==!0||x===null){let g=d+v*4,m=f.matrixWorldInverse;o.getNormalMatrix(m),(x===null||x.length<g)&&(x=new Float32Array(g));for(let M=0,y=d;M!==v;++M,y+=4)s.copy(u[M]).applyMatrix4(m,o),s.normal.toArray(x,y),x[y+3]=s.constant}c.value=x,c.needsUpdate=!0}return e.numPlanes=v,e.numIntersection=0,x}}function vx(a){let e=new WeakMap;function t(s,o){return o===g3?s.mapping=ea:o===v3&&(s.mapping=ta),s}function i(s){if(s&&s.isTexture&&s.isRenderTargetTexture===!1){let o=s.mapping;if(o===g3||o===v3)if(e.has(s)){let c=e.get(s).texture;return t(c,s.mapping)}else{let c=s.image;if(c&&c.height>0){let l=new Ao(c.height/2);return l.fromEquirectangularTexture(a,s),e.set(s,l),s.addEventListener("dispose",n),t(l.texture,s.mapping)}else return null}}return s}function n(s){let o=s.target;o.removeEventListener("dispose",n);let c=e.get(o);c!==void 0&&(e.delete(o),c.dispose())}function r(){e=new WeakMap}return{get:i,dispose:r}}var Ns=class extends Hs{constructor(e=-1,t=1,i=1,n=-1,r=.1,s=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=n,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,n,r,s){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2,r=i-e,s=i+e,o=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;r+=l*this.view.offsetX,s=r+l*this.view.width,o-=h*this.view.offsetY,c=o-h*this.view.height}this.projectionMatrix.makeOrthographic(r,s,o,c,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}};Ns.prototype.isOrthographicCamera=!0;var dr=class extends N2{constructor(e){super(e),this.type="RawShaderMaterial"}};dr.prototype.isRawShaderMaterial=!0;var ar=4,mi=8,$1=Math.pow(2,mi),zu=[.125,.215,.35,.446,.526,.582],Cu=mi-ar+1+zu.length,Zn=20,s3=new Ns,{_lodPlanes:ds,_sizeLods:bh,_sigmas:to}=xx(),Mh=new we,a3=null,$i=(1+Math.sqrt(5))/2,Xn=1/$i,zh=[new B(1,1,1),new B(-1,1,1),new B(1,1,-1),new B(-1,1,-1),new B(0,$i,Xn),new B(0,$i,-Xn),new B(Xn,0,$i),new B(-Xn,0,$i),new B($i,Xn,0),new B(-$i,Xn,0)],So=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=yx(Zn),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,n=100){a3=this._renderer.getRenderTarget();let r=this._allocateTargets();return this._sceneToCubeUV(e,i,n,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapShader===null&&(this._cubemapShader=Sh(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){this._equirectShader===null&&(this._equirectShader=Ah(),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<ds.length;e++)ds[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(a3),e.scissorTest=!1,io(e,0,0,e.width,e.height)}_fromTexture(e,t){a3=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:It,minFilter:It,generateMipmaps:!1,type:nr,format:Xt,encoding:xi,depthBuffer:!1},i=Ch(t);return i.depthBuffer=!e,this._pingPongRenderTarget===null&&(this._pingPongRenderTarget=Ch(t)),i}_compileMaterial(e){let t=new Vt(ds[0],e);this._renderer.compile(t,s3)}_sceneToCubeUV(e,t,i,n){let o=new Ht(90,1,t,i),c=[1,-1,1,1,1,1],l=[1,1,1,-1,-1,-1],h=this._renderer,u=h.autoClear,f=h.toneMapping;h.getClearColor(Mh),h.toneMapping=di,h.autoClear=!1;let d=new Ts({name:"PMREM.Background",side:zt,depthWrite:!1,depthTest:!1}),p=new Vt(new Ds,d),v=!1,x=e.background;x?x.isColor&&(d.color.copy(x),e.background=null,v=!0):(d.color.copy(Mh),v=!0);for(let g=0;g<6;g++){let m=g%3;m===0?(o.up.set(0,c[g],0),o.lookAt(l[g],0,0)):m===1?(o.up.set(0,0,c[g]),o.lookAt(0,l[g],0)):(o.up.set(0,c[g],0),o.lookAt(0,0,l[g])),io(n,m*$1,g>2?$1:0,$1,$1),h.setRenderTarget(n),v&&h.render(p,o),h.render(e,o)}p.geometry.dispose(),p.material.dispose(),h.toneMapping=f,h.autoClear=u,e.background=x}_textureToCubeUV(e,t){let i=this._renderer,n=e.mapping===ea||e.mapping===ta;n?(this._cubemapShader===null&&(this._cubemapShader=Sh()),this._cubemapShader.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectShader===null&&(this._equirectShader=Ah());let r=n?this._cubemapShader:this._equirectShader,s=new Vt(ds[0],r),o=r.uniforms;o.envMap.value=e,n||o.texelSize.value.set(1/e.image.width,1/e.image.height),io(t,0,0,3*$1,2*$1),i.setRenderTarget(t),i.render(s,s3)}_applyPMREM(e){let t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let n=1;n<Cu;n++){let r=Math.sqrt(to[n]*to[n]-to[n-1]*to[n-1]),s=zh[(n-1)%zh.length];this._blur(e,n-1,n,r,s)}t.autoClear=i}_blur(e,t,i,n,r){let s=this._pingPongRenderTarget;this._halfBlur(e,s,t,i,n,"latitudinal",r),this._halfBlur(s,e,i,i,n,"longitudinal",r)}_halfBlur(e,t,i,n,r,s,o){let c=this._renderer,l=this._blurMaterial;s!=="latitudinal"&&s!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");let h=3,u=new Vt(ds[n],l),f=l.uniforms,d=bh[i]-1,p=isFinite(r)?Math.PI/(2*d):2*Math.PI/(2*Zn-1),v=r/p,x=isFinite(r)?1+Math.floor(h*v):Zn;x>Zn&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${x} samples when the maximum is set to ${Zn}`);let g=[],m=0;for(let C=0;C<Zn;++C){let _=C/v,S=Math.exp(-_*_/2);g.push(S),C===0?m+=S:C<x&&(m+=2*S)}for(let C=0;C<g.length;C++)g[C]=g[C]/m;f.envMap.value=e.texture,f.samples.value=x,f.weights.value=g,f.latitudinal.value=s==="latitudinal",o&&(f.poleAxis.value=o),f.dTheta.value=p,f.mipInt.value=mi-i;let M=bh[n],y=3*Math.max(0,$1-2*M),b=(n===0?0:2*$1)+2*M*(n>mi-ar?n-mi+ar:0);io(t,y,b,3*M,2*M),c.setRenderTarget(t),c.render(u,s3)}};function xx(){let a=[],e=[],t=[],i=mi;for(let n=0;n<Cu;n++){let r=Math.pow(2,i);e.push(r);let s=1/r;n>mi-ar?s=zu[n-mi+ar-1]:n===0&&(s=0),t.push(s);let o=1/(r-1),c=-o/2,l=1+o/2,h=[c,c,l,c,l,l,c,c,l,l,c,l],u=6,f=6,d=3,p=2,v=1,x=new Float32Array(d*f*u),g=new Float32Array(p*f*u),m=new Float32Array(v*f*u);for(let y=0;y<u;y++){let b=y%3*2/3-1,C=y>2?0:-1,_=[b,C,0,b+2/3,C,0,b+2/3,C+1,0,b,C,0,b+2/3,C+1,0,b,C+1,0];x.set(_,d*f*y),g.set(h,p*f*y);let S=[y,y,y,y,y,y];m.set(S,v*f*y)}let M=new st;M.setAttribute("position",new mt(x,d)),M.setAttribute("uv",new mt(g,p)),M.setAttribute("faceIndex",new mt(m,v)),a.push(M),i>ar&&i--}return{_lodPlanes:a,_sizeLods:e,_sigmas:t}}function Ch(a){let e=new e1(3*$1,3*$1,a);return e.texture.mapping=Xo,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function io(a,e,t,i,n){a.viewport.set(e,t,i,n),a.scissor.set(e,t,i,n)}function yx(a){let e=new Float32Array(a),t=new B(0,1,0);return new dr({name:"SphericalGaussianBlur",defines:{n:a},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:e},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:t}},vertexShader:Rc(),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:fi,depthTest:!1,depthWrite:!1})}function Ah(){let a=new te(1,1);return new dr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:a}},vertexShader:Rc(),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:fi,depthTest:!1,depthWrite:!1})}function Sh(){return new dr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Rc(),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:fi,depthTest:!1,depthWrite:!1})}function Rc(){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 wx(a){let e=new WeakMap,t=null;function i(o){if(o&&o.isTexture){let c=o.mapping,l=c===g3||c===v3,h=c===ea||c===ta;if(l||h)if(o.isRenderTargetTexture&&o.needsPMREMUpdate===!0){o.needsPMREMUpdate=!1;let u=e.get(o);return t===null&&(t=new So(a)),u=l?t.fromEquirectangular(o,u):t.fromCubemap(o,u),e.set(o,u),u.texture}else{if(e.has(o))return e.get(o).texture;{let u=o.image;if(l&&u&&u.height>0||h&&u&&n(u)){t===null&&(t=new So(a));let f=l?t.fromEquirectangular(o):t.fromCubemap(o);return e.set(o,f),o.addEventListener("dispose",r),f.texture}else return null}}}return o}function n(o){let c=0,l=6;for(let h=0;h<l;h++)o[h]!==void 0&&c++;return c===l}function r(o){let c=o.target;c.removeEventListener("dispose",r);let l=e.get(c);l!==void 0&&(e.delete(c),l.dispose())}function s(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:i,dispose:s}}function bx(a){let e={};function t(i){if(e[i]!==void 0)return e[i];let n;switch(i){case"WEBGL_depth_texture":n=a.getExtension("WEBGL_depth_texture")||a.getExtension("MOZ_WEBGL_depth_texture")||a.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=a.getExtension("EXT_texture_filter_anisotropic")||a.getExtension("MOZ_EXT_texture_filter_anisotropic")||a.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=a.getExtension("WEBGL_compressed_texture_s3tc")||a.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||a.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=a.getExtension("WEBGL_compressed_texture_pvrtc")||a.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=a.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 Mx(a,e,t,i){let n={},r=new WeakMap;function s(u){let f=u.target;f.index!==null&&e.remove(f.index);for(let p in f.attributes)e.remove(f.attributes[p]);f.removeEventListener("dispose",s),delete n[f.id];let d=r.get(f);d&&(e.remove(d),r.delete(f)),i.releaseStatesOfGeometry(f),f.isInstancedBufferGeometry===!0&&delete f._maxInstanceCount,t.memory.geometries--}function o(u,f){return n[f.id]===!0||(f.addEventListener("dispose",s),n[f.id]=!0,t.memory.geometries++),f}function c(u){let f=u.attributes;for(let p in f)e.update(f[p],34962);let d=u.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(u){let f=[],d=u.index,p=u.attributes.position,v=0;if(d!==null){let m=d.array;v=d.version;for(let M=0,y=m.length;M<y;M+=3){let b=m[M+0],C=m[M+1],_=m[M+2];f.push(b,C,C,_,_,b)}}else{let m=p.array;v=p.version;for(let M=0,y=m.length/3-1;M<y;M+=3){let b=M+0,C=M+1,_=M+2;f.push(b,C,C,_,_,b)}}let x=new(wu(f)?Co:zo)(f,1);x.version=v;let g=r.get(u);g&&e.remove(g),r.set(u,x)}function h(u){let f=r.get(u);if(f){let d=u.index;d!==null&&f.version<d.version&&l(u)}else l(u);return r.get(u)}return{get:o,update:c,getWireframeAttribute:h}}function zx(a,e,t,i){let n=i.isWebGL2,r;function s(f){r=f}let o,c;function l(f){o=f.type,c=f.bytesPerElement}function h(f,d){a.drawElements(r,d,o,f*c),t.update(d,r,1)}function u(f,d,p){if(p===0)return;let v,x;if(n)v=a,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](r,d,o,f*c,p),t.update(d,r,p)}this.setMode=s,this.setIndex=l,this.render=h,this.renderInstances=u}function Cx(a){let e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function i(r,s,o){switch(t.calls++,s){case 4:t.triangles+=o*(r/3);break;case 1:t.lines+=o*(r/2);break;case 3:t.lines+=o*(r-1);break;case 2:t.lines+=o*r;break;case 0:t.points+=o*r;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",s);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 Fs=class extends St{constructor(e=null,t=1,i=1,n=1){super(null),this.image={data:e,width:t,height:i,depth:n},this.magFilter=Ct,this.minFilter=Ct,this.wrapR=l1,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};Fs.prototype.isDataTexture2DArray=!0;function Ax(a,e){return a[0]-e[0]}function Sx(a,e){return Math.abs(e[1])-Math.abs(a[1])}function _h(a,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),a.divideScalar(t)}function _x(a,e,t){let i={},n=new Float32Array(8),r=new WeakMap,s=new B,o=[];for(let l=0;l<8;l++)o[l]=[l,0];function c(l,h,u,f){let d=l.morphTargetInfluences;if(e.isWebGL2===!0){let p=h.morphAttributes.position.length,v=r.get(h);if(v===void 0||v.count!==p){let T=function(){H.dispose(),r.delete(h),h.removeEventListener("dispose",T)};v!==void 0&&v.texture.dispose();let m=h.morphAttributes.normal!==void 0,M=h.morphAttributes.position,y=h.morphAttributes.normal||[],b=h.attributes.position.count,C=m===!0?2:1,_=b*C,S=1;_>e.maxTextureSize&&(S=Math.ceil(_/e.maxTextureSize),_=e.maxTextureSize);let P=new Float32Array(_*S*4*p),H=new Fs(P,_,S,p);H.format=Xt,H.type=Ji,H.needsUpdate=!0;let w=C*4;for(let A=0;A<p;A++){let R=M[A],V=y[A],L=_*S*4*A;for(let N=0;N<R.count;N++){s.fromBufferAttribute(R,N),R.normalized===!0&&_h(s,R);let I=N*w;P[L+I+0]=s.x,P[L+I+1]=s.y,P[L+I+2]=s.z,P[L+I+3]=0,m===!0&&(s.fromBufferAttribute(V,N),V.normalized===!0&&_h(s,V),P[L+I+4]=s.x,P[L+I+5]=s.y,P[L+I+6]=s.z,P[L+I+7]=0)}}v={count:p,texture:H,size:new te(_,S)},r.set(h,v),h.addEventListener("dispose",T)}let x=0;for(let m=0;m<d.length;m++)x+=d[m];let g=h.morphTargetsRelative?1:1-x;f.getUniforms().setValue(a,"morphTargetBaseInfluence",g),f.getUniforms().setValue(a,"morphTargetInfluences",d),f.getUniforms().setValue(a,"morphTargetsTexture",v.texture,t),f.getUniforms().setValue(a,"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(Sx);for(let y=0;y<8;y++)y<p&&v[y][1]?(o[y][0]=v[y][0],o[y][1]=v[y][1]):(o[y][0]=Number.MAX_SAFE_INTEGER,o[y][1]=0);o.sort(Ax);let x=h.morphAttributes.position,g=h.morphAttributes.normal,m=0;for(let y=0;y<8;y++){let b=o[y],C=b[0],_=b[1];C!==Number.MAX_SAFE_INTEGER&&_?(x&&h.getAttribute("morphTarget"+y)!==x[C]&&h.setAttribute("morphTarget"+y,x[C]),g&&h.getAttribute("morphNormal"+y)!==g[C]&&h.setAttribute("morphNormal"+y,g[C]),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 M=h.morphTargetsRelative?1:1-m;f.getUniforms().setValue(a,"morphTargetBaseInfluence",M),f.getUniforms().setValue(a,"morphTargetInfluences",n)}}return{update:c}}function Ex(a,e,t,i){let n=new WeakMap;function r(c){let l=i.render.frame,h=c.geometry,u=e.get(c,h);return n.get(u)!==l&&(e.update(u),n.set(u,l)),c.isInstancedMesh&&(c.hasEventListener("dispose",o)===!1&&c.addEventListener("dispose",o),t.update(c.instanceMatrix,34962),c.instanceColor!==null&&t.update(c.instanceColor,34962)),u}function s(){n=new WeakMap}function o(c){let l=c.target;l.removeEventListener("dispose",o),t.remove(l.instanceMatrix),l.instanceColor!==null&&t.remove(l.instanceColor)}return{update:r,dispose:s}}var _o=class extends St{constructor(e=null,t=1,i=1,n=1){super(null),this.image={data:e,width:t,height:i,depth:n},this.magFilter=Ct,this.minFilter=Ct,this.wrapR=l1,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};_o.prototype.isDataTexture3D=!0;var Au=new St,Su=new Fs,_u=new _o,Eu=new ur,Eh=[],Lh=[],Th=new Float32Array(16),Dh=new Float32Array(9),Hh=new Float32Array(4);function Mr(a,e,t){let i=a[0];if(i<=0||i>0)return a;let n=e*t,r=Eh[n];if(r===void 0&&(r=new Float32Array(n),Eh[n]=r),e!==0){i.toArray(r,0);for(let s=1,o=0;s!==e;++s)o+=t,a[s].toArray(r,o)}return r}function Yt(a,e){if(a.length!==e.length)return!1;for(let t=0,i=a.length;t<i;t++)if(a[t]!==e[t])return!1;return!0}function Ut(a,e){for(let t=0,i=e.length;t<i;t++)a[t]=e[t]}function $o(a,e){let t=Lh[e];t===void 0&&(t=new Int32Array(e),Lh[e]=t);for(let i=0;i!==e;++i)t[i]=a.allocateTextureUnit();return t}function Lx(a,e){let t=this.cache;t[0]!==e&&(a.uniform1f(this.addr,e),t[0]=e)}function Tx(a,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(a.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Yt(t,e))return;a.uniform2fv(this.addr,e),Ut(t,e)}}function Dx(a,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(a.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)&&(a.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Yt(t,e))return;a.uniform3fv(this.addr,e),Ut(t,e)}}function Hx(a,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)&&(a.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(Yt(t,e))return;a.uniform4fv(this.addr,e),Ut(t,e)}}function Vx(a,e){let t=this.cache,i=e.elements;if(i===void 0){if(Yt(t,e))return;a.uniformMatrix2fv(this.addr,!1,e),Ut(t,e)}else{if(Yt(t,i))return;Hh.set(i),a.uniformMatrix2fv(this.addr,!1,Hh),Ut(t,i)}}function Rx(a,e){let t=this.cache,i=e.elements;if(i===void 0){if(Yt(t,e))return;a.uniformMatrix3fv(this.addr,!1,e),Ut(t,e)}else{if(Yt(t,i))return;Dh.set(i),a.uniformMatrix3fv(this.addr,!1,Dh),Ut(t,i)}}function Nx(a,e){let t=this.cache,i=e.elements;if(i===void 0){if(Yt(t,e))return;a.uniformMatrix4fv(this.addr,!1,e),Ut(t,e)}else{if(Yt(t,i))return;Th.set(i),a.uniformMatrix4fv(this.addr,!1,Th),Ut(t,i)}}function Fx(a,e){let t=this.cache;t[0]!==e&&(a.uniform1i(this.addr,e),t[0]=e)}function Bx(a,e){let t=this.cache;Yt(t,e)||(a.uniform2iv(this.addr,e),Ut(t,e))}function Px(a,e){let t=this.cache;Yt(t,e)||(a.uniform3iv(this.addr,e),Ut(t,e))}function Ix(a,e){let t=this.cache;Yt(t,e)||(a.uniform4iv(this.addr,e),Ut(t,e))}function kx(a,e){let t=this.cache;t[0]!==e&&(a.uniform1ui(this.addr,e),t[0]=e)}function Ox(a,e){let t=this.cache;Yt(t,e)||(a.uniform2uiv(this.addr,e),Ut(t,e))}function Ux(a,e){let t=this.cache;Yt(t,e)||(a.uniform3uiv(this.addr,e),Ut(t,e))}function qx(a,e){let t=this.cache;Yt(t,e)||(a.uniform4uiv(this.addr,e),Ut(t,e))}function Gx(a,e,t){let i=this.cache,n=t.allocateTextureUnit();i[0]!==n&&(a.uniform1i(this.addr,n),i[0]=n),t.safeSetTexture2D(e||Au,n)}function Wx(a,e,t){let i=this.cache,n=t.allocateTextureUnit();i[0]!==n&&(a.uniform1i(this.addr,n),i[0]=n),t.setTexture3D(e||_u,n)}function jx(a,e,t){let i=this.cache,n=t.allocateTextureUnit();i[0]!==n&&(a.uniform1i(this.addr,n),i[0]=n),t.safeSetTextureCube(e||Eu,n)}function Zx(a,e,t){let i=this.cache,n=t.allocateTextureUnit();i[0]!==n&&(a.uniform1i(this.addr,n),i[0]=n),t.setTexture2DArray(e||Su,n)}function Xx(a){switch(a){case 5126:return Lx;case 35664:return Tx;case 35665:return Dx;case 35666:return Hx;case 35674:return Vx;case 35675:return Rx;case 35676:return Nx;case 5124:case 35670:return Fx;case 35667:case 35671:return Bx;case 35668:case 35672:return Px;case 35669:case 35673:return Ix;case 5125:return kx;case 36294:return Ox;case 36295:return Ux;case 36296:return qx;case 35678:case 36198:case 36298:case 36306:case 35682:return Gx;case 35679:case 36299:case 36307:return Wx;case 35680:case 36300:case 36308:case 36293:return jx;case 36289:case 36303:case 36311:case 36292:return Zx}}function Yx(a,e){a.uniform1fv(this.addr,e)}function $x(a,e){let t=Mr(e,this.size,2);a.uniform2fv(this.addr,t)}function Jx(a,e){let t=Mr(e,this.size,3);a.uniform3fv(this.addr,t)}function Qx(a,e){let t=Mr(e,this.size,4);a.uniform4fv(this.addr,t)}function Kx(a,e){let t=Mr(e,this.size,4);a.uniformMatrix2fv(this.addr,!1,t)}function ey(a,e){let t=Mr(e,this.size,9);a.uniformMatrix3fv(this.addr,!1,t)}function ty(a,e){let t=Mr(e,this.size,16);a.uniformMatrix4fv(this.addr,!1,t)}function iy(a,e){a.uniform1iv(this.addr,e)}function ny(a,e){a.uniform2iv(this.addr,e)}function ry(a,e){a.uniform3iv(this.addr,e)}function sy(a,e){a.uniform4iv(this.addr,e)}function ay(a,e){a.uniform1uiv(this.addr,e)}function oy(a,e){a.uniform2uiv(this.addr,e)}function cy(a,e){a.uniform3uiv(this.addr,e)}function ly(a,e){a.uniform4uiv(this.addr,e)}function hy(a,e,t){let i=e.length,n=$o(t,i);a.uniform1iv(this.addr,n);for(let r=0;r!==i;++r)t.safeSetTexture2D(e[r]||Au,n[r])}function uy(a,e,t){let i=e.length,n=$o(t,i);a.uniform1iv(this.addr,n);for(let r=0;r!==i;++r)t.setTexture3D(e[r]||_u,n[r])}function fy(a,e,t){let i=e.length,n=$o(t,i);a.uniform1iv(this.addr,n);for(let r=0;r!==i;++r)t.safeSetTextureCube(e[r]||Eu,n[r])}function dy(a,e,t){let i=e.length,n=$o(t,i);a.uniform1iv(this.addr,n);for(let r=0;r!==i;++r)t.setTexture2DArray(e[r]||Su,n[r])}function py(a){switch(a){case 5126:return Yx;case 35664:return $x;case 35665:return Jx;case 35666:return Qx;case 35674:return Kx;case 35675:return ey;case 35676:return ty;case 5124:case 35670:return iy;case 35667:case 35671:return ny;case 35668:case 35672:return ry;case 35669:case 35673:return sy;case 5125:return ay;case 36294:return oy;case 36295:return cy;case 36296:return ly;case 35678:case 36198:case 36298:case 36306:case 35682:return hy;case 35679:case 36299:case 36307:return uy;case 35680:case 36300:case 36308:case 36293:return fy;case 36289:case 36303:case 36311:case 36292:return dy}}function my(a,e,t){this.id=a,this.addr=t,this.cache=[],this.setValue=Xx(e.type)}function Lu(a,e,t){this.id=a,this.addr=t,this.cache=[],this.size=e.size,this.setValue=py(e.type)}Lu.prototype.updateCache=function(a){let e=this.cache;a instanceof Float32Array&&e.length!==a.length&&(this.cache=new Float32Array(a.length)),Ut(e,a)};function Tu(a){this.id=a,this.seq=[],this.map={}}Tu.prototype.setValue=function(a,e,t){let i=this.seq;for(let n=0,r=i.length;n!==r;++n){let s=i[n];s.setValue(a,e[s.id],t)}};var o3=/(\w+)(\])?(\[|\.)?/g;function Vh(a,e){a.seq.push(e),a.map[e.id]=e}function gy(a,e,t){let i=a.name,n=i.length;for(o3.lastIndex=0;;){let r=o3.exec(i),s=o3.lastIndex,o=r[1],c=r[2]==="]",l=r[3];if(c&&(o=o|0),l===void 0||l==="["&&s+2===n){Vh(t,l===void 0?new my(o,a,e):new Lu(o,a,e));break}else{let u=t.map[o];u===void 0&&(u=new Tu(o),Vh(t,u)),t=u}}}function gi(a,e){this.seq=[],this.map={};let t=a.getProgramParameter(e,35718);for(let i=0;i<t;++i){let n=a.getActiveUniform(e,i),r=a.getUniformLocation(e,n.name);gy(n,r,this)}}gi.prototype.setValue=function(a,e,t,i){let n=this.map[e];n!==void 0&&n.setValue(a,t,i)};gi.prototype.setOptional=function(a,e,t){let i=e[t];i!==void 0&&this.setValue(a,t,i)};gi.upload=function(a,e,t,i){for(let n=0,r=e.length;n!==r;++n){let s=e[n],o=t[s.id];o.needsUpdate!==!1&&s.setValue(a,o.value,i)}};gi.seqWithValue=function(a,e){let t=[];for(let i=0,n=a.length;i!==n;++i){let r=a[i];r.id in e&&t.push(r)}return t};function Rh(a,e,t){let i=a.createShader(e);return a.shaderSource(i,t),a.compileShader(i),i}var vy=0;function xy(a){let e=a.split(`
`);for(let t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join(`
`)}function yy(a){switch(a){case xi:return["Linear","( value )"];case nt:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",a),["Linear","( value )"]}}function Nh(a,e,t){let i=a.getShaderParameter(e,35713),n=a.getShaderInfoLog(e).trim();return i&&n===""?"":t.toUpperCase()+`
`+n+`
`+xy(a.getShaderSource(e))}function wy(a,e){let t=yy(e);return"vec4 "+a+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function by(a,e){let t;switch(e){case Zp:t="Linear";break;case Xp:t="Reinhard";break;case Yp:t="OptimizedCineon";break;case $p:t="ACESFilmic";break;case Jp:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+a+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function My(a){return[a.extensionDerivatives||a.envMapCubeUV||a.bumpMap||a.tangentSpaceNormalMap||a.clearcoatNormalMap||a.flatShading||a.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(a.extensionFragDepth||a.logarithmicDepthBuffer)&&a.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",a.extensionDrawBuffers&&a.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(a.extensionShaderTextureLOD||a.envMap||a.transmission)&&a.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(ws).join(`
`)}function zy(a){let e=[];for(let t in a){let i=a[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(`
`)}function Cy(a,e){let t={},i=a.getProgramParameter(e,35721);for(let n=0;n<i;n++){let r=a.getActiveAttrib(e,n),s=r.name,o=1;r.type===35674&&(o=2),r.type===35675&&(o=3),r.type===35676&&(o=4),t[s]={type:r.type,location:a.getAttribLocation(e,s),locationSize:o}}return t}function ws(a){return a!==""}function Fh(a,e){return a.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 Bh(a,e){return a.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var Ay=/^[ \t]*#include +<([\w\d./]+)>/gm;function C3(a){return a.replace(Ay,Sy)}function Sy(a,e){let t=Be[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return C3(t)}var _y=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Ey=/#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 Ph(a){return a.replace(Ey,Du).replace(_y,Ly)}function Ly(a,e,t,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Du(a,e,t,i)}function Du(a,e,t,i){let n="";for(let r=parseInt(e);r<parseInt(t);r++)n+=i.replace(/\[\s*i\s*\]/g,"[ "+r+" ]").replace(/UNROLLED_LOOP_INDEX/g,r);return n}function Ih(a){let e="precision "+a.precision+` float;
precision `+a.precision+" int;";return a.precision==="highp"?e+=`
#define HIGH_PRECISION`:a.precision==="mediump"?e+=`
#define MEDIUM_PRECISION`:a.precision==="lowp"&&(e+=`
#define LOW_PRECISION`),e}function Ty(a){let e="SHADOWMAP_TYPE_BASIC";return a.shadowMapType===pu?e="SHADOWMAP_TYPE_PCF":a.shadowMapType===Dc?e="SHADOWMAP_TYPE_PCF_SOFT":a.shadowMapType===ys&&(e="SHADOWMAP_TYPE_VSM"),e}function Dy(a){let e="ENVMAP_TYPE_CUBE";if(a.envMap)switch(a.envMapMode){case ea:case ta:e="ENVMAP_TYPE_CUBE";break;case Xo:case Hc:e="ENVMAP_TYPE_CUBE_UV";break}return e}function Hy(a){let e="ENVMAP_MODE_REFLECTION";if(a.envMap)switch(a.envMapMode){case ta:case Hc:e="ENVMAP_MODE_REFRACTION";break}return e}function Vy(a){let e="ENVMAP_BLENDING_NONE";if(a.envMap)switch(a.combine){case Zo:e="ENVMAP_BLENDING_MULTIPLY";break;case Wp:e="ENVMAP_BLENDING_MIX";break;case jp:e="ENVMAP_BLENDING_ADD";break}return e}function Ry(a,e,t,i){let n=a.getContext(),r=t.defines,s=t.vertexShader,o=t.fragmentShader,c=Ty(t),l=Dy(t),h=Hy(t),u=Vy(t),f=t.isWebGL2?"":My(t),d=zy(r),p=n.createProgram(),v,x,g=t.glslVersion?"#version "+t.glslVersion+`
`:"";t.isRawShaderMaterial?(v=[d].filter(ws).join(`
`),v.length>0&&(v+=`
`),x=[f,d].filter(ws).join(`
`),x.length>0&&(x+=`
`)):(v=[Ih(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(ws).join(`
`),x=[f,Ih(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 "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.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!==di?"#define TONE_MAPPING":"",t.toneMapping!==di?Be.tonemapping_pars_fragment:"",t.toneMapping!==di?by("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.alphaWrite?"":"#define OPAQUE",Be.encodings_pars_fragment,wy("linearToOutputTexel",t.outputEncoding),t.depthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
`].filter(ws).join(`
`)),s=C3(s),s=Fh(s,t),s=Bh(s,t),o=C3(o),o=Fh(o,t),o=Bh(o,t),s=Ph(s),o=Ph(o),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===ch?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===ch?"":"#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+s,M=g+x+o,y=Rh(n,35633,m),b=Rh(n,35632,M);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),a.debug.checkShaderErrors){let S=n.getProgramInfoLog(p).trim(),P=n.getShaderInfoLog(y).trim(),H=n.getShaderInfoLog(b).trim(),w=!0,T=!0;if(n.getProgramParameter(p,35714)===!1){w=!1;let A=Nh(n,y,"vertex"),R=Nh(n,b,"fragment");console.error("THREE.WebGLProgram: Shader Error "+n.getError()+" - VALIDATE_STATUS "+n.getProgramParameter(p,35715)+`
Program Info Log: `+S+`
`+A+`
`+R)}else S!==""?console.warn("THREE.WebGLProgram: Program Info Log:",S):(P===""||H==="")&&(T=!1);T&&(this.diagnostics={runnable:w,programLog:S,vertexShader:{log:P,prefix:v},fragmentShader:{log:H,prefix:x}})}n.deleteShader(y),n.deleteShader(b);let C;this.getUniforms=function(){return C===void 0&&(C=new gi(n,p)),C};let _;return this.getAttributes=function(){return _===void 0&&(_=Cy(n,p)),_},this.destroy=function(){i.releaseStatesOfProgram(this),n.deleteProgram(p),this.program=void 0},this.name=t.shaderName,this.id=vy++,this.cacheKey=e,this.usedTimes=1,this.program=p,this.vertexShader=y,this.fragmentShader=b,this}var Ny=0,A3=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,i=e.fragmentShader,n=this._getShaderStage(t),r=this._getShaderStage(i),s=this._getShaderCacheForMaterial(e);return s.has(n)===!1&&(s.add(n),n.usedTimes++),s.has(r)===!1&&(s.add(r),r.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache;return t.has(e)===!1&&t.set(e,new Set),t.get(e)}_getShaderStage(e){let t=this.shaderCache;if(t.has(e)===!1){let i=new S3;t.set(e,i)}return t.get(e)}},S3=class{constructor(){this.id=Ny++,this.usedTimes=0}};function Fy(a,e,t,i,n,r,s){let o=new Mo,c=new A3,l=[],h=n.isWebGL2,u=n.logarithmicDepthBuffer,f=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 A=w.skeleton.bones;if(f)return 1024;{let V=Math.floor((d-20)/4),L=Math.min(V,A.length);return L<A.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+A.length+" bones. This GPU supports "+L+"."),0):L}}function m(w,T,A,R,V){let L=R.fog,N=w.isMeshStandardMaterial?R.environment:null,I=(w.isMeshStandardMaterial?t:e).get(w.envMap||N),W=x[w.type],O=V.isSkinnedMesh?g(V):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,j,ie,ae;if(W){let le=J1[W];q=le.vertexShader,j=le.fragmentShader}else q=w.vertexShader,j=w.fragmentShader,c.update(w),ie=c.getVertexShaderID(w),ae=c.getFragmentShaderID(w);let U=a.getRenderTarget(),Ce=w.alphaTest>0,ce=w.clearcoat>0;return{isWebGL2:h,shaderID:W,shaderName:w.type,vertexShader:q,fragmentShader:j,defines:w.defines,customVertexShaderID:ie,customFragmentShaderID:ae,isRawShaderMaterial:w.isRawShaderMaterial===!0,glslVersion:w.glslVersion,precision:v,instancing:V.isInstancedMesh===!0,instancingColor:V.isInstancedMesh===!0&&V.instanceColor!==null,supportsVertexTextures:p,outputEncoding:U===null?a.outputEncoding:U.isXRRenderTarget===!0?U.texture.encoding:xi,map:!!w.map,matcap:!!w.matcap,envMap:!!I,envMapMode:I&&I.mapping,envMapCubeUV:!!I&&(I.mapping===Xo||I.mapping===Hc),lightMap:!!w.lightMap,aoMap:!!w.aoMap,emissiveMap:!!w.emissiveMap,bumpMap:!!w.bumpMap,normalMap:!!w.normalMap,objectSpaceNormalMap:w.normalMapType===ym,tangentSpaceNormalMap:w.normalMapType===br,decodeVideoTexture:!!w.map&&w.map.isVideoTexture===!0&&w.map.encoding===nt,clearcoat:ce,clearcoatMap:ce&&!!w.clearcoatMap,clearcoatRoughnessMap:ce&&!!w.clearcoatRoughnessMap,clearcoatNormalMap:ce&&!!w.clearcoatNormalMap,displacementMap:!!w.displacementMap,roughnessMap:!!w.roughnessMap,metalnessMap:!!w.metalnessMap,specularMap:!!w.specularMap,specularIntensityMap:!!w.specularIntensityMap,specularColorMap:!!w.specularColorMap,alphaMap:!!w.alphaMap,alphaTest:Ce,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&&!!V.geometry&&!!V.geometry.attributes.tangent,vertexColors:w.vertexColors,vertexAlphas:w.vertexColors===!0&&!!V.geometry&&!!V.geometry.attributes.color&&V.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:!!L,useFog:w.fog,fogExp2:L&&L.isFogExp2,flatShading:!!w.flatShading,sizeAttenuation:w.sizeAttenuation,logarithmicDepthBuffer:u,skinning:V.isSkinnedMesh===!0&&O>0,maxBones:O,useVertexTexture:f,morphTargets:!!V.geometry&&!!V.geometry.morphAttributes.position,morphNormals:!!V.geometry&&!!V.geometry.morphAttributes.normal,morphTargetsCount:V.geometry&&V.geometry.morphAttributes.position?V.geometry.morphAttributes.position.length:0,numDirLights:T.directional.length,numPointLights:T.point.length,numSpotLights:T.spot.length,numRectAreaLights:T.rectArea.length,numHemiLights:T.hemi.length,numDirLightShadows:T.directionalShadowMap.length,numPointLightShadows:T.pointShadowMap.length,numSpotLightShadows:T.spotShadowMap.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:w.dithering,shadowMapEnabled:a.shadowMap.enabled&&A.length>0,shadowMapType:a.shadowMap.type,toneMapping:w.toneMapped?a.toneMapping:di,physicallyCorrectLights:a.physicallyCorrectLights,premultipliedAlpha:w.premultipliedAlpha,doubleSided:w.side===or,flipSided:w.side===zt,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 M(w){let T=[];if(w.shaderID?T.push(w.shaderID):(T.push(w.customVertexShaderID),T.push(w.customFragmentShaderID)),w.defines!==void 0)for(let A in w.defines)T.push(A),T.push(w.defines[A]);return w.isRawShaderMaterial===!1&&(y(T,w),b(T,w),T.push(a.outputEncoding)),T.push(w.customProgramCacheKey),T.join()}function y(w,T){w.push(T.precision),w.push(T.outputEncoding),w.push(T.envMapMode),w.push(T.combine),w.push(T.vertexUvs),w.push(T.fogExp2),w.push(T.sizeAttenuation),w.push(T.maxBones),w.push(T.morphTargetsCount),w.push(T.numDirLights),w.push(T.numPointLights),w.push(T.numSpotLights),w.push(T.numHemiLights),w.push(T.numRectAreaLights),w.push(T.numDirLightShadows),w.push(T.numPointLightShadows),w.push(T.numSpotLightShadows),w.push(T.shadowMapType),w.push(T.toneMapping),w.push(T.numClippingPlanes),w.push(T.numClipIntersection),w.push(T.alphaWrite)}function b(w,T){o.disableAll(),T.isWebGL2&&o.enable(0),T.supportsVertexTextures&&o.enable(1),T.instancing&&o.enable(2),T.instancingColor&&o.enable(3),T.map&&o.enable(4),T.matcap&&o.enable(5),T.envMap&&o.enable(6),T.envMapCubeUV&&o.enable(7),T.lightMap&&o.enable(8),T.aoMap&&o.enable(9),T.emissiveMap&&o.enable(10),T.bumpMap&&o.enable(11),T.normalMap&&o.enable(12),T.objectSpaceNormalMap&&o.enable(13),T.tangentSpaceNormalMap&&o.enable(14),T.clearcoat&&o.enable(15),T.clearcoatMap&&o.enable(16),T.clearcoatRoughnessMap&&o.enable(17),T.clearcoatNormalMap&&o.enable(18),T.displacementMap&&o.enable(19),T.specularMap&&o.enable(20),T.roughnessMap&&o.enable(21),T.metalnessMap&&o.enable(22),T.gradientMap&&o.enable(23),T.alphaMap&&o.enable(24),T.alphaTest&&o.enable(25),T.vertexColors&&o.enable(26),T.vertexAlphas&&o.enable(27),T.vertexUvs&&o.enable(28),T.vertexTangents&&o.enable(29),T.uvsVertexOnly&&o.enable(30),T.fog&&o.enable(31),w.push(o.mask),o.disableAll(),T.useFog&&o.enable(0),T.flatShading&&o.enable(1),T.logarithmicDepthBuffer&&o.enable(2),T.skinning&&o.enable(3),T.useVertexTexture&&o.enable(4),T.morphTargets&&o.enable(5),T.morphNormals&&o.enable(6),T.premultipliedAlpha&&o.enable(7),T.shadowMapEnabled&&o.enable(8),T.physicallyCorrectLights&&o.enable(9),T.doubleSided&&o.enable(10),T.flipSided&&o.enable(11),T.depthPacking&&o.enable(12),T.dithering&&o.enable(13),T.specularIntensityMap&&o.enable(14),T.specularColorMap&&o.enable(15),T.transmission&&o.enable(16),T.transmissionMap&&o.enable(17),T.thicknessMap&&o.enable(18),T.sheen&&o.enable(19),T.sheenColorMap&&o.enable(20),T.sheenRoughnessMap&&o.enable(21),T.decodeVideoTexture&&o.enable(22),w.push(o.mask)}function C(w){let T=x[w.type],A;if(T){let R=J1[T];A=Rm.clone(R.uniforms)}else A=w.uniforms;return A}function _(w,T){let A;for(let R=0,V=l.length;R<V;R++){let L=l[R];if(L.cacheKey===T){A=L,++A.usedTimes;break}}return A===void 0&&(A=new Ry(a,T,w,r),l.push(A)),A}function S(w){if(--w.usedTimes===0){let T=l.indexOf(w);l[T]=l[l.length-1],l.pop(),w.destroy()}}function P(w){c.remove(w)}function H(){c.dispose()}return{getParameters:m,getProgramCacheKey:M,getUniforms:C,acquireProgram:_,releaseProgram:S,releaseShaderCache:P,programs:l,dispose:H}}function By(){let a=new WeakMap;function e(r){let s=a.get(r);return s===void 0&&(s={},a.set(r,s)),s}function t(r){a.delete(r)}function i(r,s,o){a.get(r)[s]=o}function n(){a=new WeakMap}return{get:e,remove:t,update:i,dispose:n}}function Py(a,e){return a.groupOrder!==e.groupOrder?a.groupOrder-e.groupOrder:a.renderOrder!==e.renderOrder?a.renderOrder-e.renderOrder:a.material.id!==e.material.id?a.material.id-e.material.id:a.z!==e.z?a.z-e.z:a.id-e.id}function kh(a,e){return a.groupOrder!==e.groupOrder?a.groupOrder-e.groupOrder:a.renderOrder!==e.renderOrder?a.renderOrder-e.renderOrder:a.z!==e.z?e.z-a.z:a.id-e.id}function Oh(){let a=[],e=0,t=[],i=[],n=[];function r(){e=0,t.length=0,i.length=0,n.length=0}function s(u,f,d,p,v,x){let g=a[e];return g===void 0?(g={id:u.id,object:u,geometry:f,material:d,groupOrder:p,renderOrder:u.renderOrder,z:v,group:x},a[e]=g):(g.id=u.id,g.object=u,g.geometry=f,g.material=d,g.groupOrder=p,g.renderOrder=u.renderOrder,g.z=v,g.group=x),e++,g}function o(u,f,d,p,v,x){let g=s(u,f,d,p,v,x);d.transmission>0?i.push(g):d.transparent===!0?n.push(g):t.push(g)}function c(u,f,d,p,v,x){let g=s(u,f,d,p,v,x);d.transmission>0?i.unshift(g):d.transparent===!0?n.unshift(g):t.unshift(g)}function l(u,f){t.length>1&&t.sort(u||Py),i.length>1&&i.sort(f||kh),n.length>1&&n.sort(f||kh)}function h(){for(let u=e,f=a.length;u<f;u++){let d=a[u];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:r,push:o,unshift:c,finish:h,sort:l}}function Iy(){let a=new WeakMap;function e(i,n){let r;return a.has(i)===!1?(r=new Oh,a.set(i,[r])):n>=a.get(i).length?(r=new Oh,a.get(i).push(r)):r=a.get(i)[n],r}function t(){a=new WeakMap}return{get:e,dispose:t}}function ky(){let a={};return{get:function(e){if(a[e.id]!==void 0)return a[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new B,color:new we};break;case"SpotLight":t={position:new B,direction:new B,color:new we,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new B,color:new we,distance:0,decay:0};break;case"HemisphereLight":t={direction:new B,skyColor:new we,groundColor:new we};break;case"RectAreaLight":t={color:new we,position:new B,halfWidth:new B,halfHeight:new B};break}return a[e.id]=t,t}}}function Oy(){let a={};return{get:function(e){if(a[e.id]!==void 0)return a[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 a[e.id]=t,t}}}var Uy=0;function qy(a,e){return(e.castShadow?1:0)-(a.castShadow?1:0)}function Gy(a,e){let t=new ky,i=Oy(),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 r=new B,s=new _e,o=new _e;function c(h,u){let f=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,M=0,y=0,b=0,C=0;h.sort(qy);let _=u!==!0?Math.PI:1;for(let P=0,H=h.length;P<H;P++){let w=h[P],T=w.color,A=w.intensity,R=w.distance,V=w.shadow&&w.shadow.map?w.shadow.map.texture:null;if(w.isAmbientLight)f+=T.r*A*_,d+=T.g*A*_,p+=T.b*A*_;else if(w.isLightProbe)for(let L=0;L<9;L++)n.probe[L].addScaledVector(w.sh.coefficients[L],A);else if(w.isDirectionalLight){let L=t.get(w);if(L.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]=V,n.directionalShadowMatrix[v]=w.shadow.matrix,y++}n.directional[v]=L,v++}else if(w.isSpotLight){let L=t.get(w);if(L.position.setFromMatrixPosition(w.matrixWorld),L.color.copy(T).multiplyScalar(A*_),L.distance=R,L.coneCos=Math.cos(w.angle),L.penumbraCos=Math.cos(w.angle*(1-w.penumbra)),L.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]=V,n.spotShadowMatrix[g]=w.shadow.matrix,C++}n.spot[g]=L,g++}else if(w.isRectAreaLight){let L=t.get(w);L.color.copy(T).multiplyScalar(A),L.halfWidth.set(w.width*.5,0,0),L.halfHeight.set(0,w.height*.5,0),n.rectArea[m]=L,m++}else if(w.isPointLight){let L=t.get(w);if(L.color.copy(w.color).multiplyScalar(w.intensity*_),L.distance=w.distance,L.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]=V,n.pointShadowMatrix[x]=w.shadow.matrix,b++}n.point[x]=L,x++}else if(w.isHemisphereLight){let L=t.get(w);L.skyColor.copy(w.color).multiplyScalar(A*_),L.groundColor.copy(w.groundColor).multiplyScalar(A*_),n.hemi[M]=L,M++}}m>0&&(e.isWebGL2||a.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=oe.LTC_FLOAT_1,n.rectAreaLTC2=oe.LTC_FLOAT_2):a.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]=f,n.ambient[1]=d,n.ambient[2]=p;let S=n.hash;(S.directionalLength!==v||S.pointLength!==x||S.spotLength!==g||S.rectAreaLength!==m||S.hemiLength!==M||S.numDirectionalShadows!==y||S.numPointShadows!==b||S.numSpotShadows!==C)&&(n.directional.length=v,n.spot.length=g,n.rectArea.length=m,n.point.length=x,n.hemi.length=M,n.directionalShadow.length=y,n.directionalShadowMap.length=y,n.pointShadow.length=b,n.pointShadowMap.length=b,n.spotShadow.length=C,n.spotShadowMap.length=C,n.directionalShadowMatrix.length=y,n.pointShadowMatrix.length=b,n.spotShadowMatrix.length=C,S.directionalLength=v,S.pointLength=x,S.spotLength=g,S.rectAreaLength=m,S.hemiLength=M,S.numDirectionalShadows=y,S.numPointShadows=b,S.numSpotShadows=C,n.version=Uy++)}function l(h,u){let f=0,d=0,p=0,v=0,x=0,g=u.matrixWorldInverse;for(let m=0,M=h.length;m<M;m++){let y=h[m];if(y.isDirectionalLight){let b=n.directional[f];b.direction.setFromMatrixPosition(y.matrixWorld),r.setFromMatrixPosition(y.target.matrixWorld),b.direction.sub(r),b.direction.transformDirection(g),f++}else if(y.isSpotLight){let b=n.spot[p];b.position.setFromMatrixPosition(y.matrixWorld),b.position.applyMatrix4(g),b.direction.setFromMatrixPosition(y.matrixWorld),r.setFromMatrixPosition(y.target.matrixWorld),b.direction.sub(r),b.direction.transformDirection(g),p++}else if(y.isRectAreaLight){let b=n.rectArea[v];b.position.setFromMatrixPosition(y.matrixWorld),b.position.applyMatrix4(g),o.identity(),s.copy(y.matrixWorld),s.premultiply(g),o.extractRotation(s),b.halfWidth.set(y.width*.5,0,0),b.halfHeight.set(0,y.height*.5,0),b.halfWidth.applyMatrix4(o),b.halfHeight.applyMatrix4(o),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 Uh(a,e){let t=new Gy(a,e),i=[],n=[];function r(){i.length=0,n.length=0}function s(u){i.push(u)}function o(u){n.push(u)}function c(u){t.setup(i,u)}function l(u){t.setupView(i,u)}return{init:r,state:{lightsArray:i,shadowsArray:n,lights:t},setupLights:c,setupLightsView:l,pushLight:s,pushShadow:o}}function Wy(a,e){let t=new WeakMap;function i(r,s=0){let o;return t.has(r)===!1?(o=new Uh(a,e),t.set(r,[o])):s>=t.get(r).length?(o=new Uh(a,e),t.get(r).push(o)):o=t.get(r)[s],o}function n(){t=new WeakMap}return{get:i,dispose:n}}var Eo=class extends xt{constructor(e){super(),this.type="MeshDepthMaterial",this.depthPacking=vm,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}};Eo.prototype.isMeshDepthMaterial=!0;var Lo=class extends xt{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}};Lo.prototype.isMeshDistanceMaterial=!0;var jy=`void main() {
gl_Position = vec4( position, 1.0 );
}`,Zy=`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 Hu(a,e,t){let i=new fr,n=new te,r=new te,s=new $e,o=new Eo({depthPacking:xm}),c=new Lo,l={},h=t.maxTextureSize,u={0:zt,1:As,2:or},f=new N2({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new te},radius:{value:4}},vertexShader:jy,fragmentShader:Zy}),d=f.clone();d.defines.HORIZONTAL_PASS=1;let p=new st;p.setAttribute("position",new mt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let v=new Vt(p,f),x=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=pu,this.render=function(y,b,C){if(x.enabled===!1||x.autoUpdate===!1&&x.needsUpdate===!1||y.length===0)return;let _=a.getRenderTarget(),S=a.getActiveCubeFace(),P=a.getActiveMipmapLevel(),H=a.state;H.setBlending(fi),H.buffers.color.setClear(1,1,1,1),H.buffers.depth.setTest(!0),H.setScissorTest(!1);for(let w=0,T=y.length;w<T;w++){let A=y[w],R=A.shadow;if(R===void 0){console.warn("THREE.WebGLShadowMap:",A,"has no shadow.");continue}if(R.autoUpdate===!1&&R.needsUpdate===!1)continue;n.copy(R.mapSize);let V=R.getFrameExtents();if(n.multiply(V),r.copy(R.mapSize),(n.x>h||n.y>h)&&(n.x>h&&(r.x=Math.floor(h/V.x),n.x=r.x*V.x,R.mapSize.x=r.x),n.y>h&&(r.y=Math.floor(h/V.y),n.y=r.y*V.y,R.mapSize.y=r.y)),R.map===null&&!R.isPointLightShadow&&this.type===ys){let N={minFilter:It,magFilter:It,format:Xt};R.map=new e1(n.x,n.y,N),R.map.texture.name=A.name+".shadowMap",R.mapPass=new e1(n.x,n.y,N),R.camera.updateProjectionMatrix()}if(R.map===null){let N={minFilter:Ct,magFilter:Ct,format:Xt};R.map=new e1(n.x,n.y,N),R.map.texture.name=A.name+".shadowMap",R.camera.updateProjectionMatrix()}a.setRenderTarget(R.map),a.clear();let L=R.getViewportCount();for(let N=0;N<L;N++){let I=R.getViewport(N);s.set(r.x*I.x,r.y*I.y,r.x*I.z,r.y*I.w),H.viewport(s),R.updateMatrices(A,N),i=R.getFrustum(),M(b,C,R.camera,A,this.type)}!R.isPointLightShadow&&this.type===ys&&g(R,C),R.needsUpdate=!1}x.needsUpdate=!1,a.setRenderTarget(_,S,P)};function g(y,b){let C=e.update(v);f.defines.VSM_SAMPLES!==y.blurSamples&&(f.defines.VSM_SAMPLES=y.blurSamples,d.defines.VSM_SAMPLES=y.blurSamples,f.needsUpdate=!0,d.needsUpdate=!0),f.uniforms.shadow_pass.value=y.map.texture,f.uniforms.resolution.value=y.mapSize,f.uniforms.radius.value=y.radius,a.setRenderTarget(y.mapPass),a.clear(),a.renderBufferDirect(b,null,C,f,v,null),d.uniforms.shadow_pass.value=y.mapPass.texture,d.uniforms.resolution.value=y.mapSize,d.uniforms.radius.value=y.radius,a.setRenderTarget(y.map),a.clear(),a.renderBufferDirect(b,null,C,d,v,null)}function m(y,b,C,_,S,P,H){let w=null,T=_.isPointLight===!0?y.customDistanceMaterial:y.customDepthMaterial;if(T!==void 0?w=T:w=_.isPointLight===!0?c:o,a.localClippingEnabled&&C.clipShadows===!0&&C.clippingPlanes.length!==0||C.displacementMap&&C.displacementScale!==0||C.alphaMap&&C.alphaTest>0){let A=w.uuid,R=C.uuid,V=l[A];V===void 0&&(V={},l[A]=V);let L=V[R];L===void 0&&(L=w.clone(),V[R]=L),w=L}return w.visible=C.visible,w.wireframe=C.wireframe,H===ys?w.side=C.shadowSide!==null?C.shadowSide:C.side:w.side=C.shadowSide!==null?C.shadowSide:u[C.side],w.alphaMap=C.alphaMap,w.alphaTest=C.alphaTest,w.clipShadows=C.clipShadows,w.clippingPlanes=C.clippingPlanes,w.clipIntersection=C.clipIntersection,w.displacementMap=C.displacementMap,w.displacementScale=C.displacementScale,w.displacementBias=C.displacementBias,w.wireframeLinewidth=C.wireframeLinewidth,w.linewidth=C.linewidth,_.isPointLight===!0&&w.isMeshDistanceMaterial===!0&&(w.referencePosition.setFromMatrixPosition(_.matrixWorld),w.nearDistance=S,w.farDistance=P),w}function M(y,b,C,_,S){if(y.visible===!1)return;if(y.layers.test(b.layers)&&(y.isMesh||y.isLine||y.isPoints)&&(y.castShadow||y.receiveShadow&&S===ys)&&(!y.frustumCulled||i.intersectsObject(y))){y.modelViewMatrix.multiplyMatrices(C.matrixWorldInverse,y.matrixWorld);let w=e.update(y),T=y.material;if(Array.isArray(T)){let A=w.groups;for(let R=0,V=A.length;R<V;R++){let L=A[R],N=T[L.materialIndex];if(N&&N.visible){let I=m(y,w,N,_,C.near,C.far,S);a.renderBufferDirect(C,null,w,I,y,L)}}}else if(T.visible){let A=m(y,w,T,_,C.near,C.far,S);a.renderBufferDirect(C,null,w,A,y,null)}}let H=y.children;for(let w=0,T=H.length;w<T;w++)M(H[w],b,C,_,S)}}function Xy(a,e,t){let i=t.isWebGL2;function n(){let k=!1,ye=new $e,me=null,Le=new $e(0,0,0,0);return{setMask:function(K){me!==K&&!k&&(a.colorMask(K,K,K,K),me=K)},setLocked:function(K){k=K},setClear:function(K,Se,Ie,at,i1){i1===!0&&(K*=at,Se*=at,Ie*=at),ye.set(K,Se,Ie,at),Le.equals(ye)===!1&&(a.clearColor(K,Se,Ie,at),Le.copy(ye))},reset:function(){k=!1,me=null,Le.set(-1,0,0,0)}}}function r(){let k=!1,ye=null,me=null,Le=null;return{setTest:function(K){K?U(2929):Ce(2929)},setMask:function(K){ye!==K&&!k&&(a.depthMask(K),ye=K)},setFunc:function(K){if(me!==K){if(K)switch(K){case Pp:a.depthFunc(512);break;case Ip:a.depthFunc(519);break;case kp:a.depthFunc(513);break;case m3:a.depthFunc(515);break;case Op:a.depthFunc(514);break;case Up:a.depthFunc(518);break;case qp:a.depthFunc(516);break;case Gp:a.depthFunc(517);break;default:a.depthFunc(515)}else a.depthFunc(515);me=K}},setLocked:function(K){k=K},setClear:function(K){Le!==K&&(a.clearDepth(K),Le=K)},reset:function(){k=!1,ye=null,me=null,Le=null}}}function s(){let k=!1,ye=null,me=null,Le=null,K=null,Se=null,Ie=null,at=null,i1=null;return{setTest:function(ct){k||(ct?U(2960):Ce(2960))},setMask:function(ct){ye!==ct&&!k&&(a.stencilMask(ct),ye=ct)},setFunc:function(ct,B1,t2){(me!==ct||Le!==B1||K!==t2)&&(a.stencilFunc(ct,B1,t2),me=ct,Le=B1,K=t2)},setOp:function(ct,B1,t2){(Se!==ct||Ie!==B1||at!==t2)&&(a.stencilOp(ct,B1,t2),Se=ct,Ie=B1,at=t2)},setLocked:function(ct){k=ct},setClear:function(ct){i1!==ct&&(a.clearStencil(ct),i1=ct)},reset:function(){k=!1,ye=null,me=null,Le=null,K=null,Se=null,Ie=null,at=null,i1=null}}}let o=new n,c=new r,l=new s,h={},u={},f=new WeakMap,d=[],p=null,v=!1,x=null,g=null,m=null,M=null,y=null,b=null,C=null,_=!1,S=null,P=null,H=null,w=null,T=null,A=a.getParameter(35661),R=!1,V=0,L=a.getParameter(7938);L.indexOf("WebGL")!==-1?(V=parseFloat(/^WebGL (\d)/.exec(L)[1]),R=V>=1):L.indexOf("OpenGL ES")!==-1&&(V=parseFloat(/^OpenGL ES (\d)/.exec(L)[1]),R=V>=2);let N=null,I={},W=a.getParameter(3088),O=a.getParameter(2978),q=new $e().fromArray(W),j=new $e().fromArray(O);function ie(k,ye,me){let Le=new Uint8Array(4),K=a.createTexture();a.bindTexture(k,K),a.texParameteri(k,10241,9728),a.texParameteri(k,10240,9728);for(let Se=0;Se<me;Se++)a.texImage2D(ye+Se,0,6408,1,1,0,6408,5121,Le);return K}let ae={};ae[3553]=ie(3553,3553,1),ae[34067]=ie(34067,34069,6),o.setClear(0,0,0,1),c.setClear(1),l.setClear(0),U(2929),c.setFunc(m3),ne(!1),pe(V5),U(2884),Q(fi);function U(k){h[k]!==!0&&(a.enable(k),h[k]=!0)}function Ce(k){h[k]!==!1&&(a.disable(k),h[k]=!1)}function ce(k,ye){return u[k]!==ye?(a.bindFramebuffer(k,ye),u[k]=ye,i&&(k===36009&&(u[36160]=ye),k===36160&&(u[36009]=ye)),!0):!1}function xe(k,ye){let me=d,Le=!1;if(k)if(me=f.get(ye),me===void 0&&(me=[],f.set(ye,me)),k.isWebGLMultipleRenderTargets){let K=k.texture;if(me.length!==K.length||me[0]!==36064){for(let Se=0,Ie=K.length;Se<Ie;Se++)me[Se]=36064+Se;me.length=K.length,Le=!0}}else me[0]!==36064&&(me[0]=36064,Le=!0);else me[0]!==1029&&(me[0]=1029,Le=!0);Le&&(t.isWebGL2?a.drawBuffers(me):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(me))}function le(k){return p!==k?(a.useProgram(k),p=k,!0):!1}let De={[Kn]:32774,[_p]:32778,[Ep]:32779};if(i)De[B5]=32775,De[P5]=32776;else{let k=e.get("EXT_blend_minmax");k!==null&&(De[B5]=k.MIN_EXT,De[P5]=k.MAX_EXT)}let ze={[Lp]:0,[Tp]:1,[Dp]:768,[gu]:770,[Bp]:776,[Np]:774,[Vp]:772,[Hp]:769,[vu]:771,[Fp]:775,[Rp]:773};function Q(k,ye,me,Le,K,Se,Ie,at){if(k===fi){v===!0&&(Ce(3042),v=!1);return}if(v===!1&&(U(3042),v=!0),k!==Sp){if(k!==x||at!==_){if((g!==Kn||y!==Kn)&&(a.blendEquation(32774),g=Kn,y=Kn),at)switch(k){case bs:a.blendFuncSeparate(1,771,1,771);break;case R5:a.blendFunc(1,1);break;case N5:a.blendFuncSeparate(0,769,0,1);break;case F5:a.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",k);break}else switch(k){case bs:a.blendFuncSeparate(770,771,1,771);break;case R5:a.blendFunc(770,1);break;case N5:a.blendFuncSeparate(0,769,0,1);break;case F5:a.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",k);break}m=null,M=null,b=null,C=null,x=k,_=at}return}K=K||ye,Se=Se||me,Ie=Ie||Le,(ye!==g||K!==y)&&(a.blendEquationSeparate(De[ye],De[K]),g=ye,y=K),(me!==m||Le!==M||Se!==b||Ie!==C)&&(a.blendFuncSeparate(ze[me],ze[Le],ze[Se],ze[Ie]),m=me,M=Le,b=Se,C=Ie),x=k,_=null}function re(k,ye){k.side===or?Ce(2884):U(2884);let me=k.side===zt;ye&&(me=!me),ne(me),k.blending===bs&&k.transparent===!1?Q(fi):Q(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),o.setMask(k.colorWrite);let Le=k.stencilWrite;l.setTest(Le),Le&&(l.setMask(k.stencilWriteMask),l.setFunc(k.stencilFunc,k.stencilRef,k.stencilFuncMask),l.setOp(k.stencilFail,k.stencilZFail,k.stencilZPass)),Ae(k.polygonOffset,k.polygonOffsetFactor,k.polygonOffsetUnits),k.alphaToCoverage===!0?U(32926):Ce(32926)}function ne(k){S!==k&&(k?a.frontFace(2304):a.frontFace(2305),S=k)}function pe(k){k!==Cp?(U(2884),k!==P&&(k===V5?a.cullFace(1029):k===Ap?a.cullFace(1028):a.cullFace(1032))):Ce(2884),P=k}function he(k){k!==H&&(R&&a.lineWidth(k),H=k)}function Ae(k,ye,me){k?(U(32823),(w!==ye||T!==me)&&(a.polygonOffset(ye,me),w=ye,T=me)):Ce(32823)}function Ee(k){k?U(3089):Ce(3089)}function Pe(k){k===void 0&&(k=33984+A-1),N!==k&&(a.activeTexture(k),N=k)}function ke(k,ye){N===null&&Pe();let me=I[N];me===void 0&&(me={type:void 0,texture:void 0},I[N]=me),(me.type!==k||me.texture!==ye)&&(a.bindTexture(k,ye||ae[k]),me.type=k,me.texture=ye)}function Oe(){let k=I[N];k!==void 0&&k.type!==void 0&&(a.bindTexture(k.type,null),k.type=void 0,k.texture=void 0)}function F(){try{a.compressedTexImage2D.apply(a,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function E(){try{a.texSubImage2D.apply(a,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function $(){try{a.texSubImage3D.apply(a,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function se(){try{a.compressedTexSubImage2D.apply(a,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function ve(){try{a.texStorage2D.apply(a,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function J(){try{a.texStorage3D.apply(a,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function Me(){try{a.texImage2D.apply(a,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function be(){try{a.texImage3D.apply(a,arguments)}catch(k){console.error("THREE.WebGLState:",k)}}function fe(k){q.equals(k)===!1&&(a.scissor(k.x,k.y,k.z,k.w),q.copy(k))}function ue(k){j.equals(k)===!1&&(a.viewport(k.x,k.y,k.z,k.w),j.copy(k))}function Ve(){a.disable(3042),a.disable(2884),a.disable(2929),a.disable(32823),a.disable(3089),a.disable(2960),a.disable(32926),a.blendEquation(32774),a.blendFunc(1,0),a.blendFuncSeparate(1,0,1,0),a.colorMask(!0,!0,!0,!0),a.clearColor(0,0,0,0),a.depthMask(!0),a.depthFunc(513),a.clearDepth(1),a.stencilMask(4294967295),a.stencilFunc(519,0,4294967295),a.stencilOp(7680,7680,7680),a.clearStencil(0),a.cullFace(1029),a.frontFace(2305),a.polygonOffset(0,0),a.activeTexture(33984),a.bindFramebuffer(36160,null),i===!0&&(a.bindFramebuffer(36009,null),a.bindFramebuffer(36008,null)),a.useProgram(null),a.lineWidth(1),a.scissor(0,0,a.canvas.width,a.canvas.height),a.viewport(0,0,a.canvas.width,a.canvas.height),h={},N=null,I={},u={},f=new WeakMap,d=[],p=null,v=!1,x=null,g=null,m=null,M=null,y=null,b=null,C=null,_=!1,S=null,P=null,H=null,w=null,T=null,q.set(0,0,a.canvas.width,a.canvas.height),j.set(0,0,a.canvas.width,a.canvas.height),o.reset(),c.reset(),l.reset()}return{buffers:{color:o,depth:c,stencil:l},enable:U,disable:Ce,bindFramebuffer:ce,drawBuffers:xe,useProgram:le,setBlending:Q,setMaterial:re,setFlipSided:ne,setCullFace:pe,setLineWidth:he,setPolygonOffset:Ae,setScissorTest:Ee,activeTexture:Pe,bindTexture:ke,unbindTexture:Oe,compressedTexImage2D:F,texImage2D:Me,texImage3D:be,texStorage2D:ve,texStorage3D:J,texSubImage2D:E,texSubImage3D:$,compressedTexSubImage2D:se,scissor:fe,viewport:ue,reset:Ve}}function Yy(a,e,t,i,n,r,s){let o=n.isWebGL2,c=n.maxTextures,l=n.maxCubemapSize,h=n.maxTextureSize,u=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<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function g(F,E){return x?new OffscreenCanvas(F,E):Es("canvas")}function m(F,E,$,se){let ve=1;if((F.width>se||F.height>se)&&(ve=se/Math.max(F.width,F.height)),ve<1||E===!0)if(typeof HTMLImageElement<"u"&&F instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&F instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&F instanceof ImageBitmap){let J=E?Mm:Math.floor,Me=J(ve*F.width),be=J(ve*F.height);v===void 0&&(v=g(Me,be));let fe=$?g(Me,be):v;return fe.width=Me,fe.height=be,fe.getContext("2d").drawImage(F,0,0,Me,be),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+F.width+"x"+F.height+") to ("+Me+"x"+be+")."),fe}else return"data"in F&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+F.width+"x"+F.height+")."),F;return F}function M(F){return lh(F.width)&&lh(F.height)}function y(F){return o?!1:F.wrapS!==l1||F.wrapT!==l1||F.minFilter!==Ct&&F.minFilter!==It}function b(F,E){return F.generateMipmaps&&E&&F.minFilter!==Ct&&F.minFilter!==It}function C(F){a.generateMipmap(F)}function _(F,E,$,se,ve=!1){if(o===!1)return E;if(F!==null){if(a[F]!==void 0)return a[F];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+F+"'")}let J=E;return E===6403&&($===5126&&(J=33326),$===5131&&(J=33325),$===5121&&(J=33321)),E===33319&&($===5126&&(J=33328),$===5131&&(J=33327),$===5121&&(J=33323)),E===6408&&($===5126&&(J=34836),$===5131&&(J=34842),$===5121&&(J=se===nt&&ve===!1?35907:32856),$===32819&&(J=32854),$===32820&&(J=32855)),(J===33325||J===33326||J===33327||J===33328||J===34842||J===34836)&&e.get("EXT_color_buffer_float"),J}function S(F,E,$){return b(F,$)===!0||F.isFramebufferTexture&&F.minFilter!==Ct&&F.minFilter!==It?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===Ct||F===I5||F===k5?9728:9729}function H(F){let E=F.target;E.removeEventListener("dispose",H),T(E),E.isVideoTexture&&p.delete(E),s.memory.textures--}function w(F){let E=F.target;E.removeEventListener("dispose",w),A(E)}function T(F){let E=i.get(F);E.__webglInit!==void 0&&(a.deleteTexture(E.__webglTexture),i.remove(F))}function A(F){let E=F.texture,$=i.get(F),se=i.get(E);if(F){if(se.__webglTexture!==void 0&&(a.deleteTexture(se.__webglTexture),s.memory.textures--),F.depthTexture&&F.depthTexture.dispose(),F.isWebGLCubeRenderTarget)for(let ve=0;ve<6;ve++)a.deleteFramebuffer($.__webglFramebuffer[ve]),$.__webglDepthbuffer&&a.deleteRenderbuffer($.__webglDepthbuffer[ve]);else a.deleteFramebuffer($.__webglFramebuffer),$.__webglDepthbuffer&&a.deleteRenderbuffer($.__webglDepthbuffer),$.__webglMultisampledFramebuffer&&a.deleteFramebuffer($.__webglMultisampledFramebuffer),$.__webglColorRenderbuffer&&a.deleteRenderbuffer($.__webglColorRenderbuffer),$.__webglDepthRenderbuffer&&a.deleteRenderbuffer($.__webglDepthRenderbuffer);if(F.isWebGLMultipleRenderTargets)for(let ve=0,J=E.length;ve<J;ve++){let Me=i.get(E[ve]);Me.__webglTexture&&(a.deleteTexture(Me.__webglTexture),s.memory.textures--),i.remove(E[ve])}i.remove(E),i.remove(F)}}let R=0;function V(){R=0}function L(){let F=R;return F>=c&&console.warn("THREE.WebGLTextures: Trying to use "+F+" texture units while this GPU supports only "+c),R+=1,F}function N(F,E){let $=i.get(F);if(F.isVideoTexture&&he(F),F.version>0&&$.__version!==F.version){let se=F.image;if(se===void 0)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else if(se.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{U($,F,E);return}}t.activeTexture(33984+E),t.bindTexture(3553,$.__webglTexture)}function I(F,E){let $=i.get(F);if(F.version>0&&$.__version!==F.version){U($,F,E);return}t.activeTexture(33984+E),t.bindTexture(35866,$.__webglTexture)}function W(F,E){let $=i.get(F);if(F.version>0&&$.__version!==F.version){U($,F,E);return}t.activeTexture(33984+E),t.bindTexture(32879,$.__webglTexture)}function O(F,E){let $=i.get(F);if(F.version>0&&$.__version!==F.version){Ce($,F,E);return}t.activeTexture(33984+E),t.bindTexture(34067,$.__webglTexture)}let q={[x3]:10497,[l1]:33071,[y3]:33648},j={[Ct]:9728,[I5]:9984,[k5]:9986,[It]:9729,[Qp]:9985,[Yo]:9987};function ie(F,E,$){if($?(a.texParameteri(F,10242,q[E.wrapS]),a.texParameteri(F,10243,q[E.wrapT]),(F===32879||F===35866)&&a.texParameteri(F,32882,q[E.wrapR]),a.texParameteri(F,10240,j[E.magFilter]),a.texParameteri(F,10241,j[E.minFilter])):(a.texParameteri(F,10242,33071),a.texParameteri(F,10243,33071),(F===32879||F===35866)&&a.texParameteri(F,32882,33071),(E.wrapS!==l1||E.wrapT!==l1)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),a.texParameteri(F,10240,P(E.magFilter)),a.texParameteri(F,10241,P(E.minFilter)),E.minFilter!==Ct&&E.minFilter!==It&&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 se=e.get("EXT_texture_filter_anisotropic");if(E.type===Ji&&e.has("OES_texture_float_linear")===!1||o===!1&&E.type===nr&&e.has("OES_texture_half_float_linear")===!1)return;(E.anisotropy>1||i.get(E).__currentAnisotropy)&&(a.texParameterf(F,se.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(E.anisotropy,n.getMaxAnisotropy())),i.get(E).__currentAnisotropy=E.anisotropy)}}function ae(F,E){F.__webglInit===void 0&&(F.__webglInit=!0,E.addEventListener("dispose",H),F.__webglTexture=a.createTexture(),s.memory.textures++)}function U(F,E,$){let se=3553;E.isDataTexture2DArray&&(se=35866),E.isDataTexture3D&&(se=32879),ae(F,E),t.activeTexture(33984+$),t.bindTexture(se,F.__webglTexture),a.pixelStorei(37440,E.flipY),a.pixelStorei(37441,E.premultiplyAlpha),a.pixelStorei(3317,E.unpackAlignment),a.pixelStorei(37443,0);let ve=y(E)&&M(E.image)===!1,J=m(E.image,ve,!1,h);J=Ae(E,J);let Me=M(J)||o,be=r.convert(E.format,E.encoding),fe=r.convert(E.type),ue=_(E.internalFormat,be,fe,E.encoding,E.isVideoTexture);ie(se,E,Me);let Ve,k=E.mipmaps,ye=o&&E.isVideoTexture!==!0,me=F.__version===void 0,Le=S(E,J,Me);if(E.isDepthTexture)ue=6402,o?E.type===Ji?ue=36012:E.type===vo?ue=33190:E.type===rr?ue=35056:ue=33189:E.type===Ji&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),E.format===Ki&&ue===6402&&E.type!==Ss&&E.type!==vo&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),E.type=Ss,fe=r.convert(E.type)),E.format===cr&&ue===6402&&(ue=34041,E.type!==rr&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),E.type=rr,fe=r.convert(E.type))),ye&&me?t.texStorage2D(3553,1,ue,J.width,J.height):t.texImage2D(3553,0,ue,J.width,J.height,0,be,fe,null);else if(E.isDataTexture)if(k.length>0&&Me){ye&&me&&t.texStorage2D(3553,Le,ue,k[0].width,k[0].height);for(let K=0,Se=k.length;K<Se;K++)Ve=k[K],ye?t.texSubImage2D(3553,0,0,0,Ve.width,Ve.height,be,fe,Ve.data):t.texImage2D(3553,K,ue,Ve.width,Ve.height,0,be,fe,Ve.data);E.generateMipmaps=!1}else ye?(me&&t.texStorage2D(3553,Le,ue,J.width,J.height),t.texSubImage2D(3553,0,0,0,J.width,J.height,be,fe,J.data)):t.texImage2D(3553,0,ue,J.width,J.height,0,be,fe,J.data);else if(E.isCompressedTexture){ye&&me&&t.texStorage2D(3553,Le,ue,k[0].width,k[0].height);for(let K=0,Se=k.length;K<Se;K++)Ve=k[K],E.format!==Xt?be!==null?ye?t.compressedTexSubImage2D(3553,K,0,0,Ve.width,Ve.height,be,Ve.data):t.compressedTexImage2D(3553,K,ue,Ve.width,Ve.height,0,Ve.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):ye?t.texSubImage2D(3553,K,0,0,Ve.width,Ve.height,be,fe,Ve.data):t.texImage2D(3553,K,ue,Ve.width,Ve.height,0,be,fe,Ve.data)}else if(E.isDataTexture2DArray)ye?(me&&t.texStorage3D(35866,Le,ue,J.width,J.height,J.depth),t.texSubImage3D(35866,0,0,0,0,J.width,J.height,J.depth,be,fe,J.data)):t.texImage3D(35866,0,ue,J.width,J.height,J.depth,0,be,fe,J.data);else if(E.isDataTexture3D)ye?(me&&t.texStorage3D(32879,Le,ue,J.width,J.height,J.depth),t.texSubImage3D(32879,0,0,0,0,J.width,J.height,J.depth,be,fe,J.data)):t.texImage3D(32879,0,ue,J.width,J.height,J.depth,0,be,fe,J.data);else if(E.isFramebufferTexture)ye&&me?t.texStorage2D(3553,Le,ue,J.width,J.height):t.texImage2D(3553,0,ue,J.width,J.height,0,be,fe,null);else if(k.length>0&&Me){ye&&me&&t.texStorage2D(3553,Le,ue,k[0].width,k[0].height);for(let K=0,Se=k.length;K<Se;K++)Ve=k[K],ye?t.texSubImage2D(3553,K,0,0,be,fe,Ve):t.texImage2D(3553,K,ue,be,fe,Ve);E.generateMipmaps=!1}else ye?(me&&t.texStorage2D(3553,Le,ue,J.width,J.height),t.texSubImage2D(3553,0,0,0,be,fe,J)):t.texImage2D(3553,0,ue,be,fe,J);b(E,Me)&&C(se),F.__version=E.version,E.onUpdate&&E.onUpdate(E)}function Ce(F,E,$){if(E.image.length!==6)return;ae(F,E),t.activeTexture(33984+$),t.bindTexture(34067,F.__webglTexture),a.pixelStorei(37440,E.flipY),a.pixelStorei(37441,E.premultiplyAlpha),a.pixelStorei(3317,E.unpackAlignment),a.pixelStorei(37443,0);let se=E&&(E.isCompressedTexture||E.image[0].isCompressedTexture),ve=E.image[0]&&E.image[0].isDataTexture,J=[];for(let K=0;K<6;K++)!se&&!ve?J[K]=m(E.image[K],!1,!0,l):J[K]=ve?E.image[K].image:E.image[K],J[K]=Ae(E,J[K]);let Me=J[0],be=M(Me)||o,fe=r.convert(E.format,E.encoding),ue=r.convert(E.type),Ve=_(E.internalFormat,fe,ue,E.encoding),k=o&&E.isVideoTexture!==!0,ye=F.__version===void 0,me=S(E,Me,be);ie(34067,E,be);let Le;if(se){k&&ye&&t.texStorage2D(34067,me,Ve,Me.width,Me.height);for(let K=0;K<6;K++){Le=J[K].mipmaps;for(let Se=0;Se<Le.length;Se++){let Ie=Le[Se];E.format!==Xt?fe!==null?k?t.compressedTexSubImage2D(34069+K,Se,0,0,Ie.width,Ie.height,fe,Ie.data):t.compressedTexImage2D(34069+K,Se,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,Se,0,0,Ie.width,Ie.height,fe,ue,Ie.data):t.texImage2D(34069+K,Se,Ve,Ie.width,Ie.height,0,fe,ue,Ie.data)}}}else{Le=E.mipmaps,k&&ye&&(Le.length>0&&me++,t.texStorage2D(34067,me,Ve,J[0].width,J[0].height));for(let K=0;K<6;K++)if(ve){k?t.texSubImage2D(34069+K,0,0,0,J[K].width,J[K].height,fe,ue,J[K].data):t.texImage2D(34069+K,0,Ve,J[K].width,J[K].height,0,fe,ue,J[K].data);for(let Se=0;Se<Le.length;Se++){let at=Le[Se].image[K].image;k?t.texSubImage2D(34069+K,Se+1,0,0,at.width,at.height,fe,ue,at.data):t.texImage2D(34069+K,Se+1,Ve,at.width,at.height,0,fe,ue,at.data)}}else{k?t.texSubImage2D(34069+K,0,0,0,fe,ue,J[K]):t.texImage2D(34069+K,0,Ve,fe,ue,J[K]);for(let Se=0;Se<Le.length;Se++){let Ie=Le[Se];k?t.texSubImage2D(34069+K,Se+1,0,0,fe,ue,Ie.image[K]):t.texImage2D(34069+K,Se+1,Ve,fe,ue,Ie.image[K])}}}b(E,be)&&C(34067),F.__version=E.version,E.onUpdate&&E.onUpdate(E)}function ce(F,E,$,se,ve){let J=r.convert($.format,$.encoding),Me=r.convert($.type),be=_($.internalFormat,J,Me,$.encoding);i.get(E).__hasExternalTextures||(ve===32879||ve===35866?t.texImage3D(ve,0,be,E.width,E.height,E.depth,0,J,Me,null):t.texImage2D(ve,0,be,E.width,E.height,0,J,Me,null)),t.bindFramebuffer(36160,F),E.useRenderToTexture?d.framebufferTexture2DMultisampleEXT(36160,se,ve,i.get($).__webglTexture,0,pe(E)):a.framebufferTexture2D(36160,se,ve,i.get($).__webglTexture,0),t.bindFramebuffer(36160,null)}function xe(F,E,$){if(a.bindRenderbuffer(36161,F),E.depthBuffer&&!E.stencilBuffer){let se=33189;if($||E.useRenderToTexture){let ve=E.depthTexture;ve&&ve.isDepthTexture&&(ve.type===Ji?se=36012:ve.type===vo&&(se=33190));let J=pe(E);E.useRenderToTexture?d.renderbufferStorageMultisampleEXT(36161,J,se,E.width,E.height):a.renderbufferStorageMultisample(36161,J,se,E.width,E.height)}else a.renderbufferStorage(36161,se,E.width,E.height);a.framebufferRenderbuffer(36160,36096,36161,F)}else if(E.depthBuffer&&E.stencilBuffer){let se=pe(E);$&&E.useRenderbuffer?a.renderbufferStorageMultisample(36161,se,35056,E.width,E.height):E.useRenderToTexture?d.renderbufferStorageMultisampleEXT(36161,se,35056,E.width,E.height):a.renderbufferStorage(36161,34041,E.width,E.height),a.framebufferRenderbuffer(36160,33306,36161,F)}else{let se=E.isWebGLMultipleRenderTargets===!0?E.texture[0]:E.texture,ve=r.convert(se.format,se.encoding),J=r.convert(se.type),Me=_(se.internalFormat,ve,J,se.encoding),be=pe(E);$&&E.useRenderbuffer?a.renderbufferStorageMultisample(36161,be,Me,E.width,E.height):E.useRenderToTexture?d.renderbufferStorageMultisampleEXT(36161,be,Me,E.width,E.height):a.renderbufferStorage(36161,Me,E.width,E.height)}a.bindRenderbuffer(36161,null)}function le(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 se=i.get(E.depthTexture).__webglTexture,ve=pe(E);if(E.depthTexture.format===Ki)E.useRenderToTexture?d.framebufferTexture2DMultisampleEXT(36160,36096,3553,se,0,ve):a.framebufferTexture2D(36160,36096,3553,se,0);else if(E.depthTexture.format===cr)E.useRenderToTexture?d.framebufferTexture2DMultisampleEXT(36160,33306,3553,se,0,ve):a.framebufferTexture2D(36160,33306,3553,se,0);else throw new Error("Unknown depthTexture format")}function De(F){let E=i.get(F),$=F.isWebGLCubeRenderTarget===!0;if(F.depthTexture&&!E.__autoAllocateDepthBuffer){if($)throw new Error("target.depthTexture not supported in Cube render targets");le(E.__webglFramebuffer,F)}else if($){E.__webglDepthbuffer=[];for(let se=0;se<6;se++)t.bindFramebuffer(36160,E.__webglFramebuffer[se]),E.__webglDepthbuffer[se]=a.createRenderbuffer(),xe(E.__webglDepthbuffer[se],F,!1)}else t.bindFramebuffer(36160,E.__webglFramebuffer),E.__webglDepthbuffer=a.createRenderbuffer(),xe(E.__webglDepthbuffer,F,!1);t.bindFramebuffer(36160,null)}function ze(F,E,$){let se=i.get(F);E!==void 0&&ce(se.__webglFramebuffer,F,F.texture,36064,3553),$!==void 0&&De(F)}function Q(F){let E=F.texture,$=i.get(F),se=i.get(E);F.addEventListener("dispose",w),F.isWebGLMultipleRenderTargets!==!0&&(se.__webglTexture===void 0&&(se.__webglTexture=a.createTexture()),se.__version=E.version,s.memory.textures++);let ve=F.isWebGLCubeRenderTarget===!0,J=F.isWebGLMultipleRenderTargets===!0,Me=E.isDataTexture3D||E.isDataTexture2DArray,be=M(F)||o;if(ve){$.__webglFramebuffer=[];for(let fe=0;fe<6;fe++)$.__webglFramebuffer[fe]=a.createFramebuffer()}else if($.__webglFramebuffer=a.createFramebuffer(),J)if(n.drawBuffers){let fe=F.texture;for(let ue=0,Ve=fe.length;ue<Ve;ue++){let k=i.get(fe[ue]);k.__webglTexture===void 0&&(k.__webglTexture=a.createTexture(),s.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(F.useRenderbuffer)if(o){$.__webglMultisampledFramebuffer=a.createFramebuffer(),$.__webglColorRenderbuffer=a.createRenderbuffer(),a.bindRenderbuffer(36161,$.__webglColorRenderbuffer);let fe=r.convert(E.format,E.encoding),ue=r.convert(E.type),Ve=_(E.internalFormat,fe,ue,E.encoding),k=pe(F);a.renderbufferStorageMultisample(36161,k,Ve,F.width,F.height),t.bindFramebuffer(36160,$.__webglMultisampledFramebuffer),a.framebufferRenderbuffer(36160,36064,36161,$.__webglColorRenderbuffer),a.bindRenderbuffer(36161,null),F.depthBuffer&&($.__webglDepthRenderbuffer=a.createRenderbuffer(),xe($.__webglDepthRenderbuffer,F,!0)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(ve){t.bindTexture(34067,se.__webglTexture),ie(34067,E,be);for(let fe=0;fe<6;fe++)ce($.__webglFramebuffer[fe],F,E,36064,34069+fe);b(E,be)&&C(34067),t.unbindTexture()}else if(J){let fe=F.texture;for(let ue=0,Ve=fe.length;ue<Ve;ue++){let k=fe[ue],ye=i.get(k);t.bindTexture(3553,ye.__webglTexture),ie(3553,k,be),ce($.__webglFramebuffer,F,k,36064+ue,3553),b(k,be)&&C(3553)}t.unbindTexture()}else{let fe=3553;Me&&(o?fe=E.isDataTexture3D?32879:35866:console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.")),t.bindTexture(fe,se.__webglTexture),ie(fe,E,be),ce($.__webglFramebuffer,F,E,36064,fe),b(E,be)&&C(fe),t.unbindTexture()}F.depthBuffer&&De(F)}function re(F){let E=M(F)||o,$=F.isWebGLMultipleRenderTargets===!0?F.texture:[F.texture];for(let se=0,ve=$.length;se<ve;se++){let J=$[se];if(b(J,E)){let Me=F.isWebGLCubeRenderTarget?34067:3553,be=i.get(J).__webglTexture;t.bindTexture(Me,be),C(Me),t.unbindTexture()}}}function ne(F){if(F.useRenderbuffer)if(o){let E=F.width,$=F.height,se=16384,ve=[36064],J=F.stencilBuffer?33306:36096;F.depthBuffer&&ve.push(J),F.ignoreDepthForMultisampleCopy||(F.depthBuffer&&(se|=256),F.stencilBuffer&&(se|=1024));let Me=i.get(F);t.bindFramebuffer(36008,Me.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,Me.__webglFramebuffer),F.ignoreDepthForMultisampleCopy&&(a.invalidateFramebuffer(36008,[J]),a.invalidateFramebuffer(36009,[J])),a.blitFramebuffer(0,0,E,$,0,0,E,$,se,9728),a.invalidateFramebuffer(36008,ve),t.bindFramebuffer(36008,null),t.bindFramebuffer(36009,Me.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")}function pe(F){return o&&(F.useRenderbuffer||F.useRenderToTexture)?Math.min(u,F.samples):0}function he(F){let E=s.render.frame;p.get(F)!==E&&(p.set(F,E),F.update())}function Ae(F,E){let $=F.encoding,se=F.format,ve=F.type;return F.isCompressedTexture===!0||F.isVideoTexture===!0||F.format===w3||$!==xi&&($===nt?o===!1?e.has("EXT_sRGB")===!0&&se===Xt?(F.format=w3,F.minFilter=It,F.generateMipmaps=!1):E=R2.sRGBToLinear(E):(se!==Xt||ve!==pi)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",$)),E}let Ee=!1,Pe=!1;function ke(F,E){F&&F.isWebGLRenderTarget&&(Ee===!1&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),Ee=!0),F=F.texture),N(F,E)}function Oe(F,E){F&&F.isWebGLCubeRenderTarget&&(Pe===!1&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),Pe=!0),F=F.texture),O(F,E)}this.allocateTextureUnit=L,this.resetTextureUnits=V,this.setTexture2D=N,this.setTexture2DArray=I,this.setTexture3D=W,this.setTextureCube=O,this.rebindTextures=ze,this.setupRenderTarget=Q,this.updateRenderTargetMipmap=re,this.updateMultisampleRenderTarget=ne,this.setupDepthRenderbuffer=De,this.setupFrameBufferTexture=ce,this.safeSetTexture2D=ke,this.safeSetTextureCube=Oe}function $y(a,e,t){let i=t.isWebGL2;function n(r,s=null){let o;if(r===pi)return 5121;if(r===im)return 32819;if(r===nm)return 32820;if(r===Kp)return 5120;if(r===em)return 5122;if(r===Ss)return 5123;if(r===tm)return 5124;if(r===vo)return 5125;if(r===Ji)return 5126;if(r===nr)return i?5131:(o=e.get("OES_texture_half_float"),o!==null?o.HALF_FLOAT_OES:null);if(r===rm)return 6406;if(r===Xt)return 6408;if(r===sm)return 6409;if(r===am)return 6410;if(r===Ki)return 6402;if(r===cr)return 34041;if(r===om)return 6403;if(r===w3)return o=e.get("EXT_sRGB"),o!==null?o.SRGB_ALPHA_EXT:null;if(r===cm)return 36244;if(r===lm)return 33319;if(r===hm)return 33320;if(r===um)return 36249;if(r===T6||r===D6||r===H6||r===V6)if(s===nt)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(r===T6)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===D6)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===H6)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===V6)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(r===T6)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===D6)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===H6)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===V6)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===O5||r===U5||r===q5||r===G5)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(r===O5)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===U5)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===q5)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===G5)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===fm)return o=e.get("WEBGL_compressed_texture_etc1"),o!==null?o.COMPRESSED_RGB_ETC1_WEBGL:null;if(r===W5||r===j5)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(r===W5)return s===nt?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(r===j5)return s===nt?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===Z5||r===X5||r===Y5||r===$5||r===J5||r===Q5||r===K5||r===eh||r===th||r===ih||r===nh||r===rh||r===sh||r===ah)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(r===Z5)return s===nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===X5)return s===nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===Y5)return s===nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===$5)return s===nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===J5)return s===nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===Q5)return s===nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===K5)return s===nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===eh)return s===nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===th)return s===nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===ih)return s===nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===nh)return s===nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===rh)return s===nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===sh)return s===nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===ah)return s===nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===oh)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(r===oh)return s===nt?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(r===rr)return i?34042:(o=e.get("WEBGL_depth_texture"),o!==null?o.UNSIGNED_INT_24_8_WEBGL:null)}return{convert:n}}var To=class extends Ht{constructor(e=[]){super(),this.cameras=e}};To.prototype.isArrayCamera=!0;var Qi=class extends Ze{constructor(){super(),this.type="Group"}};Qi.prototype.isGroup=!0;var Jy={type:"move"},Ms=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Qi,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 Qi,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 Qi,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,r=null,s=null,o=this._targetRay,c=this._grip,l=this._hand;if(e&&t.session.visibilityState!=="visible-blurred")if(o!==null&&(n=t.getPose(e.targetRaySpace,i),n!==null&&(o.matrix.fromArray(n.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),n.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(n.linearVelocity)):o.hasLinearVelocity=!1,n.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(n.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Jy))),l&&e.hand){s=!0;for(let v of e.hand.values()){let x=t.getJointPose(v,i);if(l.joints[v.jointName]===void 0){let m=new Qi;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"],u=l.joints["thumb-tip"],f=h.position.distanceTo(u.position),d=.02,p=.005;l.inputState.pinching&&f>d+p?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&f<=d-p&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,i),r!==null&&(c.matrix.fromArray(r.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),r.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(r.linearVelocity)):c.hasLinearVelocity=!1,r.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(r.angularVelocity)):c.hasAngularVelocity=!1));return o!==null&&(o.visible=n!==null),c!==null&&(c.visible=r!==null),l!==null&&(l.visible=s!==null),this}},Bs=class extends St{constructor(e,t,i,n,r,s,o,c,l,h){if(h=h!==void 0?h:Ki,h!==Ki&&h!==cr)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&h===Ki&&(i=Ss),i===void 0&&h===cr&&(i=rr),super(null,n,r,s,o,c,h,i,l),this.image={width:e,height:t},this.magFilter=o!==void 0?o:Ct,this.minFilter=c!==void 0?c:Ct,this.flipY=!1,this.generateMipmaps=!1}};Bs.prototype.isDepthTexture=!0;var _3=class extends V2{constructor(e,t){super();let i=this,n=null,r=1,s=null,o="local-floor",c=e.extensions.has("WEBGL_multisampled_render_to_texture"),l=null,h=null,u=null,f=null,d=!1,p=null,v=t.getContextAttributes(),x=null,g=null,m=[],M=new Map,y=new Ht;y.layers.enable(1),y.viewport=new $e;let b=new Ht;b.layers.enable(2),b.viewport=new $e;let C=[y,b],_=new To;_.layers.enable(1),_.layers.enable(2);let S=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 Ms,m[O]=q),q.getTargetRaySpace()},this.getControllerGrip=function(O){let q=m[O];return q===void 0&&(q=new Ms,m[O]=q),q.getGripSpace()},this.getHand=function(O){let q=m[O];return q===void 0&&(q=new Ms,m[O]=q),q.getHandSpace()};function H(O){let q=M.get(O.inputSource);q&&q.dispatchEvent({type:O.type,data:O.inputSource})}function w(){M.forEach(function(O,q){O.disconnect(q)}),M.clear(),S=null,P=null,e.setRenderTarget(x),f=null,u=null,h=null,n=null,g=null,W.stop(),i.isPresenting=!1,i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(O){r=O,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(O){o=O,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return s},this.getBaseLayer=function(){return u!==null?u:f},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",H),n.addEventListener("selectstart",H),n.addEventListener("selectend",H),n.addEventListener("squeeze",H),n.addEventListener("squeezestart",H),n.addEventListener("squeezeend",H),n.addEventListener("end",w),n.addEventListener("inputsourceschange",T),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:r};f=new XRWebGLLayer(n,t,q),n.updateRenderState({baseLayer:f}),g=new e1(f.framebufferWidth,f.framebufferHeight,{format:Xt,type:pi,encoding:e.outputEncoding})}else{d=v.antialias;let q=null,j=null,ie=null;v.depth&&(ie=v.stencil?35056:33190,q=v.stencil?cr:Ki,j=v.stencil?rr:Ss);let ae={colorFormat:e.outputEncoding===nt?35907:32856,depthFormat:ie,scaleFactor:r};h=new XRWebGLBinding(n,t),u=h.createProjectionLayer(ae),n.updateRenderState({layers:[u]}),d?g=new Ls(u.textureWidth,u.textureHeight,{format:Xt,type:pi,depthTexture:new Bs(u.textureWidth,u.textureHeight,j,void 0,void 0,void 0,void 0,void 0,void 0,q),stencilBuffer:v.stencil,ignoreDepth:u.ignoreDepthValues,useRenderToTexture:c,encoding:e.outputEncoding}):g=new e1(u.textureWidth,u.textureHeight,{format:Xt,type:pi,depthTexture:new Bs(u.textureWidth,u.textureHeight,j,void 0,void 0,void 0,void 0,void 0,void 0,q),stencilBuffer:v.stencil,ignoreDepth:u.ignoreDepthValues,encoding:e.outputEncoding})}g.isXRRenderTarget=!0,this.setFoveation(1),s=await n.requestReferenceSpace(o),W.setContext(n),W.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}};function T(O){let q=n.inputSources;for(let j=0;j<m.length;j++)M.set(q[j],m[j]);for(let j=0;j<O.removed.length;j++){let ie=O.removed[j],ae=M.get(ie);ae&&(ae.dispatchEvent({type:"disconnected",data:ie}),M.delete(ie))}for(let j=0;j<O.added.length;j++){let ie=O.added[j],ae=M.get(ie);ae&&ae.dispatchEvent({type:"connected",data:ie})}}let A=new B,R=new B;function V(O,q,j){A.setFromMatrixPosition(q.matrixWorld),R.setFromMatrixPosition(j.matrixWorld);let ie=A.distanceTo(R),ae=q.projectionMatrix.elements,U=j.projectionMatrix.elements,Ce=ae[14]/(ae[10]-1),ce=ae[14]/(ae[10]+1),xe=(ae[9]+1)/ae[5],le=(ae[9]-1)/ae[5],De=(ae[8]-1)/ae[0],ze=(U[8]+1)/U[0],Q=Ce*De,re=Ce*ze,ne=ie/(-De+ze),pe=ne*-De;q.matrixWorld.decompose(O.position,O.quaternion,O.scale),O.translateX(pe),O.translateZ(ne),O.matrixWorld.compose(O.position,O.quaternion,O.scale),O.matrixWorldInverse.copy(O.matrixWorld).invert();let he=Ce+ne,Ae=ce+ne,Ee=Q-pe,Pe=re+(ie-pe),ke=xe*ce/Ae*he,Oe=le*ce/Ae*he;O.projectionMatrix.makePerspective(Ee,Pe,ke,Oe,he,Ae)}function L(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,(S!==_.near||P!==_.far)&&(n.updateRenderState({depthNear:_.near,depthFar:_.far}),S=_.near,P=_.far);let q=O.parent,j=_.cameras;L(_,q);for(let ae=0;ae<j.length;ae++)L(j[ae],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 ie=O.children;for(let ae=0,U=ie.length;ae<U;ae++)ie[ae].updateMatrixWorld(!0);j.length===2?V(_,y,b):_.projectionMatrix.copy(y.projectionMatrix)},this.getCamera=function(){return _},this.getFoveation=function(){if(u!==null)return u.fixedFoveation;if(f!==null)return f.fixedFoveation},this.setFoveation=function(O){u!==null&&(u.fixedFoveation=O),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=O)};let N=null;function I(O,q){if(l=q.getViewerPose(s),p=q,l!==null){let ie=l.views;f!==null&&(e.setRenderTargetFramebuffer(g,f.framebuffer),e.setRenderTarget(g));let ae=!1;ie.length!==_.cameras.length&&(_.cameras.length=0,ae=!0);for(let U=0;U<ie.length;U++){let Ce=ie[U],ce=null;if(f!==null)ce=f.getViewport(Ce);else{let le=h.getViewSubImage(u,Ce);ce=le.viewport,U===0&&(e.setRenderTargetTextures(g,le.colorTexture,u.ignoreDepthValues?void 0:le.depthStencilTexture),e.setRenderTarget(g))}let xe=C[U];xe.matrix.fromArray(Ce.transform.matrix),xe.projectionMatrix.fromArray(Ce.projectionMatrix),xe.viewport.set(ce.x,ce.y,ce.width,ce.height),U===0&&_.matrix.copy(xe.matrix),ae===!0&&_.cameras.push(xe)}}let j=n.inputSources;for(let ie=0;ie<m.length;ie++){let ae=m[ie],U=j[ie];ae.update(U,q,s)}N&&N(O,q),p=null}let W=new Mu;W.setAnimationLoop(I),this.setAnimationLoop=function(O){N=O},this.dispose=function(){}}};function Qy(a){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,M,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?f(g,m,b):u(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&&r(g,m)):m.isPointsMaterial?s(g,m,M,y):m.isSpriteMaterial?o(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 M=a.get(m).envMap;M&&(g.envMap.value=M,g.flipEnvMap.value=M.isCubeTexture&&M.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 r(g,m){g.dashSize.value=m.dashSize,g.totalSize.value=m.dashSize+m.gapSize,g.scale.value=m.scale}function s(g,m,M,y){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,g.size.value=m.size*M,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 o(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 M;m.map?M=m.map:m.alphaMap&&(M=m.alphaMap),M!==void 0&&(M.matrixAutoUpdate===!0&&M.updateMatrix(),g.uvTransform.value.copy(M.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===zt&&(g.bumpScale.value*=-1)),m.normalMap&&(g.normalMap.value=m.normalMap,g.normalScale.value.copy(m.normalScale),m.side===zt&&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===zt&&(g.bumpScale.value*=-1)),m.normalMap&&(g.normalMap.value=m.normalMap,g.normalScale.value.copy(m.normalScale),m.side===zt&&g.normalScale.value.negate()),m.displacementMap&&(g.displacementMap.value=m.displacementMap,g.displacementScale.value=m.displacementScale,g.displacementBias.value=m.displacementBias)}function u(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===zt&&(g.bumpScale.value*=-1)),m.normalMap&&(g.normalMap.value=m.normalMap,g.normalScale.value.copy(m.normalScale),m.side===zt&&g.normalScale.value.negate()),m.displacementMap&&(g.displacementMap.value=m.displacementMap,g.displacementScale.value=m.displacementScale,g.displacementBias.value=m.displacementBias),a.get(m).envMap&&(g.envMapIntensity.value=m.envMapIntensity)}function f(g,m,M){u(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===zt&&g.clearcoatNormalScale.value.negate())),m.transmission>0&&(g.transmission.value=m.transmission,g.transmissionSamplerMap.value=M.texture,g.transmissionSamplerSize.value.set(M.width,M.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===zt&&(g.bumpScale.value*=-1)),m.normalMap&&(g.normalMap.value=m.normalMap,g.normalScale.value.copy(m.normalScale),m.side===zt&&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===zt&&(g.bumpScale.value*=-1)),m.normalMap&&(g.normalMap.value=m.normalMap,g.normalScale.value.copy(m.normalScale),m.side===zt&&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 Ky(){let a=Es("canvas");return a.style.display="block",a}function Xe(a={}){let e=a.canvas!==void 0?a.canvas:Ky(),t=a.context!==void 0?a.context:null,i=a.alpha!==void 0?a.alpha:!1,n=a.depth!==void 0?a.depth:!0,r=a.stencil!==void 0?a.stencil:!0,s=a.antialias!==void 0?a.antialias:!1,o=a.premultipliedAlpha!==void 0?a.premultipliedAlpha:!0,c=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,l=a.powerPreference!==void 0?a.powerPreference:"default",h=a.failIfMajorPerformanceCaveat!==void 0?a.failIfMajorPerformanceCaveat:!1,u=null,f=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=xi,this.physicallyCorrectLights=!1,this.toneMapping=di,this.toneMappingExposure=1;let v=this,x=!1,g=0,m=0,M=null,y=-1,b=null,C=new $e,_=new $e,S=null,P=e.width,H=e.height,w=1,T=null,A=null,R=new $e(0,0,P,H),V=new $e(0,0,P,H),L=!1,N=new fr,I=!1,W=!1,O=null,q=new _e,j=new B,ie={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function ae(){return M===null?w:1}let U=t;function Ce(D,G){for(let X=0;X<D.length;X++){let Z=D[X],ee=e.getContext(Z,G);if(ee!==null)return ee}return null}try{let D={alpha:!0,depth:n,stencil:r,antialias:s,premultipliedAlpha:o,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:h};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Tc}`),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=Ce(G,D),U===null)throw Ce(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(D){throw console.error("THREE.WebGLRenderer: "+D.message),D}let ce,xe,le,De,ze,Q,re,ne,pe,he,Ae,Ee,Pe,ke,Oe,F,E,$,se,ve,J,Me,be;function fe(){ce=new bx(U),xe=new mx(U,ce,a),ce.init(xe),Me=new $y(U,ce,xe),le=new Xy(U,ce,xe),De=new Cx(U),ze=new By,Q=new Yy(U,ce,le,ze,xe,Me,De),re=new vx(v),ne=new wx(v),pe=new Im(U,xe),be=new dx(U,ce,pe,xe),he=new Mx(U,pe,De,be),Ae=new Ex(U,he,pe,De),se=new _x(U,xe,Q),F=new gx(ze),Ee=new Fy(v,re,ne,ce,xe,be,F),Pe=new Qy(ze),ke=new Iy,Oe=new Wy(ce,xe),$=new fx(v,re,le,Ae,i,o),E=new Hu(v,Ae,xe),ve=new px(U,ce,De,xe),J=new zx(U,ce,De,xe),De.programs=Ee.programs,v.capabilities=xe,v.extensions=ce,v.properties=ze,v.renderLists=ke,v.shadowMap=E,v.state=le,v.info=De}fe();let ue=new _3(v,U);this.xr=ue,this.getContext=function(){return U},this.getContextAttributes=function(){return U.getContextAttributes()},this.forceContextLoss=function(){let D=ce.get("WEBGL_lose_context");D&&D.loseContext()},this.forceContextRestore=function(){let D=ce.get("WEBGL_lose_context");D&&D.restoreContext()},this.getPixelRatio=function(){return w},this.setPixelRatio=function(D){D!==void 0&&(w=D,this.setSize(P,H,!1))},this.getSize=function(D){return D.set(P,H)},this.setSize=function(D,G,X){if(ue.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}P=D,H=G,e.width=Math.floor(D*w),e.height=Math.floor(G*w),X!==!1&&(e.style.width=D+"px",e.style.height=G+"px"),this.setViewport(0,0,D,G)},this.getDrawingBufferSize=function(D){return D.set(P*w,H*w).floor()},this.setDrawingBufferSize=function(D,G,X){P=D,H=G,w=X,e.width=Math.floor(D*X),e.height=Math.floor(G*X),this.setViewport(0,0,D,G)},this.getCurrentViewport=function(D){return D.copy(C)},this.getViewport=function(D){return D.copy(R)},this.setViewport=function(D,G,X,Z){D.isVector4?R.set(D.x,D.y,D.z,D.w):R.set(D,G,X,Z),le.viewport(C.copy(R).multiplyScalar(w).floor())},this.getScissor=function(D){return D.copy(V)},this.setScissor=function(D,G,X,Z){D.isVector4?V.set(D.x,D.y,D.z,D.w):V.set(D,G,X,Z),le.scissor(_.copy(V).multiplyScalar(w).floor())},this.getScissorTest=function(){return L},this.setScissorTest=function(D){le.setScissorTest(L=D)},this.setOpaqueSort=function(D){T=D},this.setTransparentSort=function(D){A=D},this.getClearColor=function(D){return D.copy($.getClearColor())},this.setClearColor=function(){$.setClearColor.apply($,arguments)},this.getClearAlpha=function(){return $.getClearAlpha()},this.setClearAlpha=function(){$.setClearAlpha.apply($,arguments)},this.clear=function(D,G,X){let Z=0;(D===void 0||D)&&(Z|=16384),(G===void 0||G)&&(Z|=256),(X===void 0||X)&&(Z|=1024),U.clear(Z)},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(),Oe.dispose(),ze.dispose(),re.dispose(),ne.dispose(),Ae.dispose(),be.dispose(),Ee.dispose(),ue.dispose(),ue.removeEventListener("sessionstart",Ie),ue.removeEventListener("sessionend",at),O&&(O.dispose(),O=null),i1.stop()};function Ve(D){D.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),x=!0}function k(){console.log("THREE.WebGLRenderer: Context Restored."),x=!1;let D=De.autoReset,G=E.enabled,X=E.autoUpdate,Z=E.needsUpdate,ee=E.type;fe(),De.autoReset=D,E.enabled=G,E.autoUpdate=X,E.needsUpdate=Z,E.type=ee}function ye(D){let G=D.target;G.removeEventListener("dispose",ye),me(G)}function me(D){Le(D),ze.remove(D)}function Le(D){let G=ze.get(D).programs;G!==void 0&&(G.forEach(function(X){Ee.releaseProgram(X)}),D.isShaderMaterial&&Ee.releaseShaderCache(D))}this.renderBufferDirect=function(D,G,X,Z,ee,He){G===null&&(G=ie);let Re=ee.isMesh&&ee.matrixWorld.determinant()<0,Fe=r7(D,G,X,Z,ee);le.setMaterial(Z,Re);let Ne=X.index,Ye=X.attributes.position;if(Ne===null){if(Ye===void 0||Ye.count===0)return}else if(Ne.count===0)return;let Ue=1;Z.wireframe===!0&&(Ne=he.getWireframeAttribute(X),Ue=2),be.setup(ee,Z,Fe,X,Ne);let qe,lt=ve;Ne!==null&&(qe=pe.get(Ne),lt=J,lt.setIndex(qe));let Ci=Ne!==null?Ne.count:Ye.count,on=X.drawRange.start*Ue,Ge=X.drawRange.count*Ue,P1=He!==null?He.start*Ue:0,yt=He!==null?He.count*Ue:1/0,I1=Math.max(on,P1),sa=Math.min(Ci,on+Ge,P1+yt)-1,k1=Math.max(0,sa-I1+1);if(k1!==0){if(ee.isMesh)Z.wireframe===!0?(le.setLineWidth(Z.wireframeLinewidth*ae()),lt.setMode(1)):lt.setMode(4);else if(ee.isLine){let i2=Z.linewidth;i2===void 0&&(i2=1),le.setLineWidth(i2*ae()),ee.isLineSegments?lt.setMode(1):ee.isLineLoop?lt.setMode(2):lt.setMode(3)}else ee.isPoints?lt.setMode(0):ee.isSprite&&lt.setMode(4);if(ee.isInstancedMesh)lt.renderInstances(I1,k1,ee.count);else if(X.isInstancedBufferGeometry){let i2=Math.min(X.instanceCount,X._maxInstanceCount);lt.renderInstances(I1,k1,i2)}else lt.render(I1,k1)}},this.compile=function(D,G){f=Oe.get(D),f.init(),p.push(f),D.traverseVisible(function(X){X.isLight&&X.layers.test(G.layers)&&(f.pushLight(X),X.castShadow&&f.pushShadow(X))}),f.setupLights(v.physicallyCorrectLights),D.traverse(function(X){let Z=X.material;if(Z)if(Array.isArray(Z))for(let ee=0;ee<Z.length;ee++){let He=Z[ee];r0(He,D,X)}else r0(Z,D,X)}),p.pop(),f=null};let K=null;function Se(D){K&&K(D)}function Ie(){i1.stop()}function at(){i1.start()}let i1=new Mu;i1.setAnimationLoop(Se),typeof window<"u"&&i1.setContext(window),this.setAnimationLoop=function(D){K=D,ue.setAnimationLoop(D),D===null?i1.stop():i1.start()},ue.addEventListener("sessionstart",Ie),ue.addEventListener("sessionend",at),this.render=function(D,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;D.autoUpdate===!0&&D.updateMatrixWorld(),G.parent===null&&G.updateMatrixWorld(),ue.enabled===!0&&ue.isPresenting===!0&&(ue.cameraAutoUpdate===!0&&ue.updateCamera(G),G=ue.getCamera()),D.isScene===!0&&D.onBeforeRender(v,D,G,M),f=Oe.get(D,p.length),f.init(),p.push(f),q.multiplyMatrices(G.projectionMatrix,G.matrixWorldInverse),N.setFromProjectionMatrix(q),W=this.localClippingEnabled,I=F.init(this.clippingPlanes,W,G),u=ke.get(D,d.length),u.init(),d.push(u),ct(D,G,0,v.sortObjects),u.finish(),v.sortObjects===!0&&u.sort(T,A),I===!0&&F.beginShadows();let X=f.state.shadowsArray;if(E.render(X,D,G),I===!0&&F.endShadows(),this.info.autoReset===!0&&this.info.reset(),$.render(u,D),f.setupLights(v.physicallyCorrectLights),G.isArrayCamera){let Z=G.cameras;for(let ee=0,He=Z.length;ee<He;ee++){let Re=Z[ee];B1(u,D,Re,Re.viewport)}}else B1(u,D,G);M!==null&&(Q.updateMultisampleRenderTarget(M),Q.updateRenderTargetMipmap(M)),D.isScene===!0&&D.onAfterRender(v,D,G),le.buffers.depth.setTest(!0),le.buffers.depth.setMask(!0),le.buffers.color.setMask(!0),le.setPolygonOffset(!1),be.resetDefaultState(),y=-1,b=null,p.pop(),p.length>0?f=p[p.length-1]:f=null,d.pop(),d.length>0?u=d[d.length-1]:u=null};function ct(D,G,X,Z){if(D.visible===!1)return;if(D.layers.test(G.layers)){if(D.isGroup)X=D.renderOrder;else if(D.isLOD)D.autoUpdate===!0&&D.update(G);else if(D.isLight)f.pushLight(D),D.castShadow&&f.pushShadow(D);else if(D.isSprite){if(!D.frustumCulled||N.intersectsSprite(D)){Z&&j.setFromMatrixPosition(D.matrixWorld).applyMatrix4(q);let Re=Ae.update(D),Fe=D.material;Fe.visible&&u.push(D,Re,Fe,X,j.z,null)}}else if((D.isMesh||D.isLine||D.isPoints)&&(D.isSkinnedMesh&&D.skeleton.frame!==De.render.frame&&(D.skeleton.update(),D.skeleton.frame=De.render.frame),!D.frustumCulled||N.intersectsObject(D))){Z&&j.setFromMatrixPosition(D.matrixWorld).applyMatrix4(q);let Re=Ae.update(D),Fe=D.material;if(Array.isArray(Fe)){let Ne=Re.groups;for(let Ye=0,Ue=Ne.length;Ye<Ue;Ye++){let qe=Ne[Ye],lt=Fe[qe.materialIndex];lt&&lt.visible&&u.push(D,Re,lt,X,j.z,qe)}}else Fe.visible&&u.push(D,Re,Fe,X,j.z,null)}}let He=D.children;for(let Re=0,Fe=He.length;Re<Fe;Re++)ct(He[Re],G,X,Z)}function B1(D,G,X,Z){let ee=D.opaque,He=D.transmissive,Re=D.transparent;f.setupLightsView(X),He.length>0&&t2(ee,G,X),Z&&le.viewport(C.copy(Z)),ee.length>0&&ra(ee,G,X),He.length>0&&ra(He,G,X),Re.length>0&&ra(Re,G,X)}function t2(D,G,X){if(O===null){let Re=s===!0&&xe.isWebGL2===!0?Ls:e1;O=new Re(1024,1024,{generateMipmaps:!0,type:Me.convert(nr)!==null?nr:pi,minFilter:Yo,magFilter:Ct,wrapS:l1,wrapT:l1,useRenderToTexture:ce.has("WEBGL_multisampled_render_to_texture")})}let Z=v.getRenderTarget();v.setRenderTarget(O),v.clear();let ee=v.toneMapping;v.toneMapping=di,ra(D,G,X),v.toneMapping=ee,Q.updateMultisampleRenderTarget(O),Q.updateRenderTargetMipmap(O),v.setRenderTarget(Z)}function ra(D,G,X){let Z=G.isScene===!0?G.overrideMaterial:null;for(let ee=0,He=D.length;ee<He;ee++){let Re=D[ee],Fe=Re.object,Ne=Re.geometry,Ye=Z===null?Re.material:Z,Ue=Re.group;Fe.layers.test(X.layers)&&n7(Fe,G,X,Ne,Ye,Ue)}}function n7(D,G,X,Z,ee,He){D.onBeforeRender(v,G,X,Z,ee,He),D.modelViewMatrix.multiplyMatrices(X.matrixWorldInverse,D.matrixWorld),D.normalMatrix.getNormalMatrix(D.modelViewMatrix),ee.onBeforeRender(v,G,X,Z,D,He),ee.transparent===!0&&ee.side===or?(ee.side=zt,ee.needsUpdate=!0,v.renderBufferDirect(X,G,Z,ee,D,He),ee.side=As,ee.needsUpdate=!0,v.renderBufferDirect(X,G,Z,ee,D,He),ee.side=or):v.renderBufferDirect(X,G,Z,ee,D,He),D.onAfterRender(v,G,X,Z,ee,He)}function r0(D,G,X){G.isScene!==!0&&(G=ie);let Z=ze.get(D),ee=f.state.lights,He=f.state.shadowsArray,Re=ee.state.version,Fe=Ee.getParameters(D,ee.state,He,G,X),Ne=Ee.getProgramCacheKey(Fe),Ye=Z.programs;Z.environment=D.isMeshStandardMaterial?G.environment:null,Z.fog=G.fog,Z.envMap=(D.isMeshStandardMaterial?ne:re).get(D.envMap||Z.environment),Ye===void 0&&(D.addEventListener("dispose",ye),Ye=new Map,Z.programs=Ye);let Ue=Ye.get(Ne);if(Ue!==void 0){if(Z.currentProgram===Ue&&Z.lightsStateVersion===Re)return jc(D,Fe),Ue}else Fe.uniforms=Ee.getUniforms(D),D.onBuild(X,Fe,v),D.onBeforeCompile(Fe,v),Ue=Ee.acquireProgram(Fe,Ne),Ye.set(Ne,Ue),Z.uniforms=Fe.uniforms;let qe=Z.uniforms;(!D.isShaderMaterial&&!D.isRawShaderMaterial||D.clipping===!0)&&(qe.clippingPlanes=F.uniform),jc(D,Fe),Z.needsLights=a7(D),Z.lightsStateVersion=Re,Z.needsLights&&(qe.ambientLightColor.value=ee.state.ambient,qe.lightProbe.value=ee.state.probe,qe.directionalLights.value=ee.state.directional,qe.directionalLightShadows.value=ee.state.directionalShadow,qe.spotLights.value=ee.state.spot,qe.spotLightShadows.value=ee.state.spotShadow,qe.rectAreaLights.value=ee.state.rectArea,qe.ltc_1.value=ee.state.rectAreaLTC1,qe.ltc_2.value=ee.state.rectAreaLTC2,qe.pointLights.value=ee.state.point,qe.pointLightShadows.value=ee.state.pointShadow,qe.hemisphereLights.value=ee.state.hemi,qe.directionalShadowMap.value=ee.state.directionalShadowMap,qe.directionalShadowMatrix.value=ee.state.directionalShadowMatrix,qe.spotShadowMap.value=ee.state.spotShadowMap,qe.spotShadowMatrix.value=ee.state.spotShadowMatrix,qe.pointShadowMap.value=ee.state.pointShadowMap,qe.pointShadowMatrix.value=ee.state.pointShadowMatrix);let lt=Ue.getUniforms(),Ci=gi.seqWithValue(lt.seq,qe);return Z.currentProgram=Ue,Z.uniformsList=Ci,Ue}function jc(D,G){let X=ze.get(D);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 r7(D,G,X,Z,ee){G.isScene!==!0&&(G=ie),Q.resetTextureUnits();let He=G.fog,Re=Z.isMeshStandardMaterial?G.environment:null,Fe=M===null?v.outputEncoding:M.isXRRenderTarget===!0?M.texture.encoding:xi,Ne=(Z.isMeshStandardMaterial?ne:re).get(Z.envMap||Re),Ye=Z.vertexColors===!0&&!!X.attributes.color&&X.attributes.color.itemSize===4,Ue=!!Z.normalMap&&!!X.attributes.tangent,qe=!!X.morphAttributes.position,lt=!!X.morphAttributes.normal,Ci=X.morphAttributes.position?X.morphAttributes.position.length:0,on=Z.toneMapped?v.toneMapping:di,Ge=ze.get(Z),P1=f.state.lights;if(I===!0&&(W===!0||D!==b)){let b1=D===b&&Z.id===y;F.setState(Z,D,b1)}let yt=!1;Z.version===Ge.__version?(Ge.needsLights&&Ge.lightsStateVersion!==P1.state.version||Ge.outputEncoding!==Fe||ee.isInstancedMesh&&Ge.instancing===!1||!ee.isInstancedMesh&&Ge.instancing===!0||ee.isSkinnedMesh&&Ge.skinning===!1||!ee.isSkinnedMesh&&Ge.skinning===!0||Ge.envMap!==Ne||Z.fog&&Ge.fog!==He||Ge.numClippingPlanes!==void 0&&(Ge.numClippingPlanes!==F.numPlanes||Ge.numIntersection!==F.numIntersection)||Ge.vertexAlphas!==Ye||Ge.vertexTangents!==Ue||Ge.morphTargets!==qe||Ge.morphNormals!==lt||Ge.toneMapping!==on||xe.isWebGL2===!0&&Ge.morphTargetsCount!==Ci)&&(yt=!0):(yt=!0,Ge.__version=Z.version);let I1=Ge.currentProgram;yt===!0&&(I1=r0(Z,G,ee));let sa=!1,k1=!1,i2=!1,Bt=I1.getUniforms(),Cr=Ge.uniforms;if(le.useProgram(I1.program)&&(sa=!0,k1=!0,i2=!0),Z.id!==y&&(y=Z.id,k1=!0),sa||b!==D){if(Bt.setValue(U,"projectionMatrix",D.projectionMatrix),xe.logarithmicDepthBuffer&&Bt.setValue(U,"logDepthBufFC",2/(Math.log(D.far+1)/Math.LN2)),b!==D&&(b=D,k1=!0,i2=!0),Z.isShaderMaterial||Z.isMeshPhongMaterial||Z.isMeshToonMaterial||Z.isMeshStandardMaterial||Z.envMap){let b1=Bt.map.cameraPosition;b1!==void 0&&b1.setValue(U,j.setFromMatrixPosition(D.matrixWorld))}(Z.isMeshPhongMaterial||Z.isMeshToonMaterial||Z.isMeshLambertMaterial||Z.isMeshBasicMaterial||Z.isMeshStandardMaterial||Z.isShaderMaterial)&&Bt.setValue(U,"isOrthographic",D.isOrthographicCamera===!0),(Z.isMeshPhongMaterial||Z.isMeshToonMaterial||Z.isMeshLambertMaterial||Z.isMeshBasicMaterial||Z.isMeshStandardMaterial||Z.isShaderMaterial||Z.isShadowMaterial||ee.isSkinnedMesh)&&Bt.setValue(U,"viewMatrix",D.matrixWorldInverse)}if(ee.isSkinnedMesh){Bt.setOptional(U,ee,"bindMatrix"),Bt.setOptional(U,ee,"bindMatrixInverse");let b1=ee.skeleton;b1&&(xe.floatVertexTextures?(b1.boneTexture===null&&b1.computeBoneTexture(),Bt.setValue(U,"boneTexture",b1.boneTexture,Q),Bt.setValue(U,"boneTextureSize",b1.boneTextureSize)):Bt.setOptional(U,b1,"boneMatrices"))}return X&&(X.morphAttributes.position!==void 0||X.morphAttributes.normal!==void 0)&&se.update(ee,X,Z,I1),(k1||Ge.receiveShadow!==ee.receiveShadow)&&(Ge.receiveShadow=ee.receiveShadow,Bt.setValue(U,"receiveShadow",ee.receiveShadow)),k1&&(Bt.setValue(U,"toneMappingExposure",v.toneMappingExposure),Ge.needsLights&&s7(Cr,i2),He&&Z.fog&&Pe.refreshFogUniforms(Cr,He),Pe.refreshMaterialUniforms(Cr,Z,w,H,O),gi.upload(U,Ge.uniformsList,Cr,Q)),Z.isShaderMaterial&&Z.uniformsNeedUpdate===!0&&(gi.upload(U,Ge.uniformsList,Cr,Q),Z.uniformsNeedUpdate=!1),Z.isSpriteMaterial&&Bt.setValue(U,"center",ee.center),Bt.setValue(U,"modelViewMatrix",ee.modelViewMatrix),Bt.setValue(U,"normalMatrix",ee.normalMatrix),Bt.setValue(U,"modelMatrix",ee.matrixWorld),I1}function s7(D,G){D.ambientLightColor.needsUpdate=G,D.lightProbe.needsUpdate=G,D.directionalLights.needsUpdate=G,D.directionalLightShadows.needsUpdate=G,D.pointLights.needsUpdate=G,D.pointLightShadows.needsUpdate=G,D.spotLights.needsUpdate=G,D.spotLightShadows.needsUpdate=G,D.rectAreaLights.needsUpdate=G,D.hemisphereLights.needsUpdate=G}function a7(D){return D.isMeshLambertMaterial||D.isMeshToonMaterial||D.isMeshPhongMaterial||D.isMeshStandardMaterial||D.isShadowMaterial||D.isShaderMaterial&&D.lights===!0}this.getActiveCubeFace=function(){return g},this.getActiveMipmapLevel=function(){return m},this.getRenderTarget=function(){return M},this.setRenderTargetTextures=function(D,G,X){ze.get(D.texture).__webglTexture=G,ze.get(D.depthTexture).__webglTexture=X;let Z=ze.get(D);Z.__hasExternalTextures=!0,Z.__hasExternalTextures&&(Z.__autoAllocateDepthBuffer=X===void 0,Z.__autoAllocateDepthBuffer||D.useRenderToTexture&&(console.warn("render-to-texture extension was disabled because an external texture was provided"),D.useRenderToTexture=!1,D.useRenderbuffer=!0))},this.setRenderTargetFramebuffer=function(D,G){let X=ze.get(D);X.__webglFramebuffer=G,X.__useDefaultFramebuffer=G===void 0},this.setRenderTarget=function(D,G=0,X=0){M=D,g=G,m=X;let Z=!0;if(D){let Ne=ze.get(D);Ne.__useDefaultFramebuffer!==void 0?(le.bindFramebuffer(36160,null),Z=!1):Ne.__webglFramebuffer===void 0?Q.setupRenderTarget(D):Ne.__hasExternalTextures&&Q.rebindTextures(D,ze.get(D.texture).__webglTexture,ze.get(D.depthTexture).__webglTexture)}let ee=null,He=!1,Re=!1;if(D){let Ne=D.texture;(Ne.isDataTexture3D||Ne.isDataTexture2DArray)&&(Re=!0);let Ye=ze.get(D).__webglFramebuffer;D.isWebGLCubeRenderTarget?(ee=Ye[G],He=!0):D.useRenderbuffer?ee=ze.get(D).__webglMultisampledFramebuffer:ee=Ye,C.copy(D.viewport),_.copy(D.scissor),S=D.scissorTest}else C.copy(R).multiplyScalar(w).floor(),_.copy(V).multiplyScalar(w).floor(),S=L;if(le.bindFramebuffer(36160,ee)&&xe.drawBuffers&&Z&&le.drawBuffers(D,ee),le.viewport(C),le.scissor(_),le.setScissorTest(S),He){let Ne=ze.get(D.texture);U.framebufferTexture2D(36160,36064,34069+G,Ne.__webglTexture,X)}else if(Re){let Ne=ze.get(D.texture),Ye=G||0;U.framebufferTextureLayer(36160,36064,Ne.__webglTexture,X||0,Ye)}y=-1},this.readRenderTargetPixels=function(D,G,X,Z,ee,He,Re){if(!(D&&D.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Fe=ze.get(D).__webglFramebuffer;if(D.isWebGLCubeRenderTarget&&Re!==void 0&&(Fe=Fe[Re]),Fe){le.bindFramebuffer(36160,Fe);try{let Ne=D.texture,Ye=Ne.format,Ue=Ne.type;if(Ye!==Xt&&Me.convert(Ye)!==U.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let qe=Ue===nr&&(ce.has("EXT_color_buffer_half_float")||xe.isWebGL2&&ce.has("EXT_color_buffer_float"));if(Ue!==pi&&Me.convert(Ue)!==U.getParameter(35738)&&!(Ue===Ji&&(xe.isWebGL2||ce.has("OES_texture_float")||ce.has("WEBGL_color_buffer_float")))&&!qe){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}U.checkFramebufferStatus(36160)===36053?G>=0&&G<=D.width-Z&&X>=0&&X<=D.height-ee&&U.readPixels(G,X,Z,ee,Me.convert(Ye),Me.convert(Ue),He):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{let Ne=M!==null?ze.get(M).__webglFramebuffer:null;le.bindFramebuffer(36160,Ne)}}},this.copyFramebufferToTexture=function(D,G,X=0){if(G.isFramebufferTexture!==!0){console.error("THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.");return}let Z=Math.pow(2,-X),ee=Math.floor(G.image.width*Z),He=Math.floor(G.image.height*Z);Q.setTexture2D(G,0),U.copyTexSubImage2D(3553,X,0,0,D.x,D.y,ee,He),le.unbindTexture()},this.copyTextureToTexture=function(D,G,X,Z=0){let ee=G.image.width,He=G.image.height,Re=Me.convert(X.format),Fe=Me.convert(X.type);Q.setTexture2D(X,0),U.pixelStorei(37440,X.flipY),U.pixelStorei(37441,X.premultiplyAlpha),U.pixelStorei(3317,X.unpackAlignment),G.isDataTexture?U.texSubImage2D(3553,Z,D.x,D.y,ee,He,Re,Fe,G.image.data):G.isCompressedTexture?U.compressedTexSubImage2D(3553,Z,D.x,D.y,G.mipmaps[0].width,G.mipmaps[0].height,Re,G.mipmaps[0].data):U.texSubImage2D(3553,Z,D.x,D.y,Re,Fe,G.image),Z===0&&X.generateMipmaps&&U.generateMipmap(3553),le.unbindTexture()},this.copyTextureToTexture3D=function(D,G,X,Z,ee=0){if(v.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let He=D.max.x-D.min.x+1,Re=D.max.y-D.min.y+1,Fe=D.max.z-D.min.z+1,Ne=Me.convert(Z.format),Ye=Me.convert(Z.type),Ue;if(Z.isDataTexture3D)Q.setTexture3D(Z,0),Ue=32879;else if(Z.isDataTexture2DArray)Q.setTexture2DArray(Z,0),Ue=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}U.pixelStorei(37440,Z.flipY),U.pixelStorei(37441,Z.premultiplyAlpha),U.pixelStorei(3317,Z.unpackAlignment);let qe=U.getParameter(3314),lt=U.getParameter(32878),Ci=U.getParameter(3316),on=U.getParameter(3315),Ge=U.getParameter(32877),P1=X.isCompressedTexture?X.mipmaps[0]:X.image;U.pixelStorei(3314,P1.width),U.pixelStorei(32878,P1.height),U.pixelStorei(3316,D.min.x),U.pixelStorei(3315,D.min.y),U.pixelStorei(32877,D.min.z),X.isDataTexture||X.isDataTexture3D?U.texSubImage3D(Ue,ee,G.x,G.y,G.z,He,Re,Fe,Ne,Ye,P1.data):X.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),U.compressedTexSubImage3D(Ue,ee,G.x,G.y,G.z,He,Re,Fe,Ne,P1.data)):U.texSubImage3D(Ue,ee,G.x,G.y,G.z,He,Re,Fe,Ne,Ye,P1),U.pixelStorei(3314,qe),U.pixelStorei(32878,lt),U.pixelStorei(3316,Ci),U.pixelStorei(3315,on),U.pixelStorei(32877,Ge),ee===0&&Z.generateMipmaps&&U.generateMipmap(Ue),le.unbindTexture()},this.initTexture=function(D){Q.setTexture2D(D,0),le.unbindTexture()},this.resetState=function(){g=0,m=0,M=null,le.reset(),be.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}Xe.prototype.isWebGLRenderer=!0;var E3=class extends Xe{};E3.prototype.isWebGL1Renderer=!0;var L3=class a{constructor(e,t=25e-5){this.name="",this.color=new we(e),this.density=t}clone(){return new a(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}};L3.prototype.isFogExp2=!0;var T3=class a{constructor(e,t=1,i=1e3){this.name="",this.color=new we(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}}};T3.prototype.isFog=!0;var pr=class extends Ze{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,typeof __THREE_DEVTOOLS__<"u"&&__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}};pr.prototype.isScene=!0;var en=class{constructor(e,t){this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=_s,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=F1()}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,r=this.stride;n<r;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=F1()),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=F1()),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}}};en.prototype.isInterleavedBuffer=!0;var pt=new B,Ps=class a{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++)pt.x=this.getX(t),pt.y=this.getY(t),pt.z=this.getZ(t),pt.applyMatrix4(e),this.setXYZ(t,pt.x,pt.y,pt.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)pt.x=this.getX(t),pt.y=this.getY(t),pt.z=this.getZ(t),pt.applyNormalMatrix(e),this.setXYZ(t,pt.x,pt.y,pt.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)pt.x=this.getX(t),pt.y=this.getY(t),pt.z=this.getZ(t),pt.transformDirection(e),this.setXYZ(t,pt.x,pt.y,pt.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,r){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]=r,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 r=0;r<this.itemSize;r++)t.push(this.data.array[n+r])}return new mt(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 a(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 r=0;r<this.itemSize;r++)t.push(this.data.array[n+r])}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}}};Ps.prototype.isInterleavedBufferAttribute=!0;var Do=class extends xt{constructor(e){super(),this.type="SpriteMaterial",this.color=new we(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}};Do.prototype.isSpriteMaterial=!0;var Yn,ps=new B,$n=new B,Jn=new B,Qn=new te,ms=new te,Vu=new _e,no=new B,gs=new B,ro=new B,qh=new te,c3=new te,Gh=new te,D3=class extends Ze{constructor(e){if(super(),this.type="Sprite",Yn===void 0){Yn=new st;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 en(t,5);Yn.setIndex([0,1,2,0,2,3]),Yn.setAttribute("position",new Ps(i,3,0,!1)),Yn.setAttribute("uv",new Ps(i,2,3,!1))}this.geometry=Yn,this.material=e!==void 0?e:new Do,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.'),$n.setFromMatrixScale(this.matrixWorld),Vu.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Jn.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&$n.multiplyScalar(-Jn.z);let i=this.material.rotation,n,r;i!==0&&(r=Math.cos(i),n=Math.sin(i));let s=this.center;so(no.set(-.5,-.5,0),Jn,s,$n,n,r),so(gs.set(.5,-.5,0),Jn,s,$n,n,r),so(ro.set(.5,.5,0),Jn,s,$n,n,r),qh.set(0,0),c3.set(1,0),Gh.set(1,1);let o=e.ray.intersectTriangle(no,gs,ro,!1,ps);if(o===null&&(so(gs.set(-.5,.5,0),Jn,s,$n,n,r),c3.set(0,1),o=e.ray.intersectTriangle(no,ro,gs,!1,ps),o===null))return;let c=e.ray.origin.distanceTo(ps);c<e.near||c>e.far||t.push({distance:c,point:ps.clone(),uv:Ot.getUV(ps,no,gs,ro,qh,c3,Gh,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}};D3.prototype.isSprite=!0;function so(a,e,t,i,n,r){Qn.subVectors(a,t).addScalar(.5).multiply(i),n!==void 0?(ms.x=r*Qn.x-n*Qn.y,ms.y=n*Qn.x+r*Qn.y):ms.copy(Qn),a.copy(e),a.x+=ms.x,a.y+=ms.y,a.applyMatrix4(Vu)}var Wh=new B,jh=new $e,Zh=new $e,ew=new B,Xh=new _e,Ho=class extends Vt{constructor(e,t){super(e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new _e,this.bindMatrixInverse=new _e}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 $e,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 r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):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;jh.fromBufferAttribute(n.attributes.skinIndex,e),Zh.fromBufferAttribute(n.attributes.skinWeight,e),Wh.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let r=0;r<4;r++){let s=Zh.getComponent(r);if(s!==0){let o=jh.getComponent(r);Xh.multiplyMatrices(i.bones[o].matrixWorld,i.boneInverses[o]),t.addScaledVector(ew.copy(Wh).applyMatrix4(Xh),s)}}return t.applyMatrix4(this.bindMatrixInverse)}};Ho.prototype.isSkinnedMesh=!0;var H3=class extends Ze{constructor(){super(),this.type="Bone"}};H3.prototype.isBone=!0;var V3=class extends St{constructor(e=null,t=1,i=1,n,r,s,o,c,l=Ct,h=Ct,u,f){super(null,s,o,c,l,h,n,r,u,f),this.image={data:e,width:t,height:i},this.magFilter=l,this.minFilter=h,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};V3.prototype.isDataTexture=!0;var Is=class extends mt{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}};Is.prototype.isInstancedBufferAttribute=!0;var Yh=new _e,$h=new _e,ao=[],vs=new Vt,R3=class extends Vt{constructor(e,t,i){super(e,t),this.instanceMatrix=new Is(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(vs.geometry=this.geometry,vs.material=this.material,vs.material!==void 0)for(let r=0;r<n;r++){this.getMatrixAt(r,Yh),$h.multiplyMatrices(i,Yh),vs.matrixWorld=$h,vs.raycast(e,ao);for(let s=0,o=ao.length;s<o;s++){let c=ao[s];c.instanceId=r,c.object=this,t.push(c)}ao.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Is(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"})}};R3.prototype.isInstancedMesh=!0;var tn=class extends xt{constructor(e){super(),this.type="LineBasicMaterial",this.color=new we(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}};tn.prototype.isLineBasicMaterial=!0;var Jh=new B,Qh=new B,Kh=new _e,l3=new wi,oo=new yi,ks=class extends Ze{constructor(e=new st,t=new tn){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,r=t.count;n<r;n++)Jh.fromBufferAttribute(t,n-1),Qh.fromBufferAttribute(t,n),i[n]=i[n-1],i[n]+=Jh.distanceTo(Qh);e.setAttribute("lineDistance",new vt(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,r=e.params.Line.threshold,s=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),oo.copy(i.boundingSphere),oo.applyMatrix4(n),oo.radius+=r,e.ray.intersectsSphere(oo)===!1)return;Kh.copy(n).invert(),l3.copy(e.ray).applyMatrix4(Kh);let o=r/((this.scale.x+this.scale.y+this.scale.z)/3),c=o*o,l=new B,h=new B,u=new B,f=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,s.start),m=Math.min(p.count,s.start+s.count);for(let M=g,y=m-1;M<y;M+=d){let b=p.getX(M),C=p.getX(M+1);if(l.fromBufferAttribute(x,b),h.fromBufferAttribute(x,C),l3.distanceSqToSegment(l,h,f,u)>c)continue;f.applyMatrix4(this.matrixWorld);let S=e.ray.origin.distanceTo(f);S<e.near||S>e.far||t.push({distance:S,point:u.clone().applyMatrix4(this.matrixWorld),index:M,face:null,faceIndex:null,object:this})}}else{let g=Math.max(0,s.start),m=Math.min(x.count,s.start+s.count);for(let M=g,y=m-1;M<y;M+=d){if(l.fromBufferAttribute(x,M),h.fromBufferAttribute(x,M+1),l3.distanceSqToSegment(l,h,f,u)>c)continue;f.applyMatrix4(this.matrixWorld);let C=e.ray.origin.distanceTo(f);C<e.near||C>e.far||t.push({distance:C,point:u.clone().applyMatrix4(this.matrixWorld),index:M,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 r=0,s=n.length;r<s;r++){let o=n[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}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.")}}};ks.prototype.isLine=!0;var eu=new B,tu=new B,Os=class extends ks{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,r=t.count;n<r;n+=2)eu.fromBufferAttribute(t,n),tu.fromBufferAttribute(t,n+1),i[n]=n===0?0:i[n-1],i[n+1]=i[n]+eu.distanceTo(tu);e.setAttribute("lineDistance",new vt(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}};Os.prototype.isLineSegments=!0;var N3=class extends ks{constructor(e,t){super(e,t),this.type="LineLoop"}};N3.prototype.isLineLoop=!0;var Vo=class extends xt{constructor(e){super(),this.type="PointsMaterial",this.color=new we(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}};Vo.prototype.isPointsMaterial=!0;var iu=new _e,F3=new wi,co=new yi,lo=new B,B3=class extends Ze{constructor(e=new st,t=new Vo){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,r=e.params.Points.threshold,s=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),co.copy(i.boundingSphere),co.applyMatrix4(n),co.radius+=r,e.ray.intersectsSphere(co)===!1)return;iu.copy(n).invert(),F3.copy(e.ray).applyMatrix4(iu);let o=r/((this.scale.x+this.scale.y+this.scale.z)/3),c=o*o;if(i.isBufferGeometry){let l=i.index,u=i.attributes.position;if(l!==null){let f=Math.max(0,s.start),d=Math.min(l.count,s.start+s.count);for(let p=f,v=d;p<v;p++){let x=l.getX(p);lo.fromBufferAttribute(u,x),nu(lo,x,c,n,e,t,this)}}else{let f=Math.max(0,s.start),d=Math.min(u.count,s.start+s.count);for(let p=f,v=d;p<v;p++)lo.fromBufferAttribute(u,p),nu(lo,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 r=0,s=n.length;r<s;r++){let o=n[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}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.")}}};B3.prototype.isPoints=!0;function nu(a,e,t,i,n,r,s){let o=F3.distanceSqToPoint(a);if(o<t){let c=new B;F3.closestPointToPoint(a,c),c.applyMatrix4(i);let l=n.ray.origin.distanceTo(c);if(l<n.near||l>n.far)return;r.push({distance:l,distanceToRay:Math.sqrt(o),point:c,index:e,face:null,object:s})}}var P3=class extends St{constructor(e,t,i,n,r,s,o,c,l){super(e,t,i,n,r,s,o,c,l),this.minFilter=s!==void 0?s:It,this.magFilter=r!==void 0?r:It,this.generateMipmaps=!1;let h=this;function u(){h.needsUpdate=!0,e.requestVideoFrameCallback(u)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(u)}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)}};P3.prototype.isVideoTexture=!0;var I3=class extends St{constructor(e,t,i){super({width:e,height:t}),this.format=i,this.magFilter=Ct,this.minFilter=Ct,this.generateMipmaps=!1,this.needsUpdate=!0}};I3.prototype.isFramebufferTexture=!0;var k3=class extends St{constructor(e,t,i,n,r,s,o,c,l,h,u,f){super(null,s,o,c,l,h,n,r,u,f),this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}};k3.prototype.isCompressedTexture=!0;var O3=class extends St{constructor(e,t,i,n,r,s,o,c,l){super(e,t,i,n,r,s,o,c,l),this.needsUpdate=!0}};O3.prototype.isCanvasTexture=!0;var _T=new B,ET=new B,LT=new B,TT=new Ot;var t1=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),r=0;t.push(0);for(let s=1;s<=e;s++)i=this.getPoint(s/e),r+=i.distanceTo(n),t.push(r),n=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){let i=this.getLengths(),n=0,r=i.length,s;t?s=t:s=e*i[r-1];let o=0,c=r-1,l;for(;o<=c;)if(n=Math.floor(o+(c-o)/2),l=i[n]-s,l<0)o=n+1;else if(l>0)c=n-1;else{c=n;break}if(n=c,i[n]===s)return n/(r-1);let h=i[n],f=i[n+1]-h,d=(s-h)/f;return(n+d)/(r-1)}getTangent(e,t){let n=e-1e-4,r=e+1e-4;n<0&&(n=0),r>1&&(r=1);let s=this.getPoint(n),o=this.getPoint(r),c=t||(s.isVector2?new te:new B);return c.copy(o).sub(s).normalize(),c}getTangentAt(e,t){let i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){let i=new B,n=[],r=[],s=[],o=new B,c=new _e;for(let d=0;d<=e;d++){let p=d/e;n[d]=this.getTangentAt(p,new B)}r[0]=new B,s[0]=new B;let l=Number.MAX_VALUE,h=Math.abs(n[0].x),u=Math.abs(n[0].y),f=Math.abs(n[0].z);h<=l&&(l=h,i.set(1,0,0)),u<=l&&(l=u,i.set(0,1,0)),f<=l&&i.set(0,0,1),o.crossVectors(n[0],i).normalize(),r[0].crossVectors(n[0],o),s[0].crossVectors(n[0],r[0]);for(let d=1;d<=e;d++){if(r[d]=r[d-1].clone(),s[d]=s[d-1].clone(),o.crossVectors(n[d-1],n[d]),o.length()>Number.EPSILON){o.normalize();let p=Math.acos(Kt(n[d-1].dot(n[d]),-1,1));r[d].applyMatrix4(c.makeRotationAxis(o,p))}s[d].crossVectors(n[d],r[d])}if(t===!0){let d=Math.acos(Kt(r[0].dot(r[e]),-1,1));d/=e,n[0].dot(o.crossVectors(r[0],r[e]))>0&&(d=-d);for(let p=1;p<=e;p++)r[p].applyMatrix4(c.makeRotationAxis(n[p],d*p)),s[p].crossVectors(n[p],r[p])}return{tangents:n,normals:r,binormals:s}}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}},mr=class extends t1{constructor(e=0,t=0,i=1,n=1,r=0,s=Math.PI*2,o=!1,c=0){super(),this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=n,this.aStartAngle=r,this.aEndAngle=s,this.aClockwise=o,this.aRotation=c}getPoint(e,t){let i=t||new te,n=Math.PI*2,r=this.aEndAngle-this.aStartAngle,s=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=n;for(;r>n;)r-=n;r<Number.EPSILON&&(s?r=0:r=n),this.aClockwise===!0&&!s&&(r===n?r=-n:r=r-n);let o=this.aStartAngle+e*r,c=this.aX+this.xRadius*Math.cos(o),l=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){let h=Math.cos(this.aRotation),u=Math.sin(this.aRotation),f=c-this.aX,d=l-this.aY;c=f*h-d*u+this.aX,l=f*u+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}};mr.prototype.isEllipseCurve=!0;var Ro=class extends mr{constructor(e,t,i,n,r,s){super(e,t,i,i,n,r,s),this.type="ArcCurve"}};Ro.prototype.isArcCurve=!0;function Nc(){let a=0,e=0,t=0,i=0;function n(r,s,o,c){a=r,e=o,t=-3*r+3*s-2*o-c,i=2*r-2*s+o+c}return{initCatmullRom:function(r,s,o,c,l){n(s,o,l*(o-r),l*(c-s))},initNonuniformCatmullRom:function(r,s,o,c,l,h,u){let f=(s-r)/l-(o-r)/(l+h)+(o-s)/h,d=(o-s)/h-(c-s)/(h+u)+(c-o)/u;f*=h,d*=h,n(s,o,f,d)},calc:function(r){let s=r*r,o=s*r;return a+e*r+t*s+i*o}}}var ho=new B,h3=new Nc,u3=new Nc,f3=new Nc,No=class extends t1{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,r=n.length,s=(r-(this.closed?0:1))*e,o=Math.floor(s),c=s-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/r)+1)*r:c===0&&o===r-1&&(o=r-2,c=1);let l,h;this.closed||o>0?l=n[(o-1)%r]:(ho.subVectors(n[0],n[1]).add(n[0]),l=ho);let u=n[o%r],f=n[(o+1)%r];if(this.closed||o+2<r?h=n[(o+2)%r]:(ho.subVectors(n[r-1],n[r-2]).add(n[r-1]),h=ho),this.curveType==="centripetal"||this.curveType==="chordal"){let d=this.curveType==="chordal"?.5:.25,p=Math.pow(l.distanceToSquared(u),d),v=Math.pow(u.distanceToSquared(f),d),x=Math.pow(f.distanceToSquared(h),d);v<1e-4&&(v=1),p<1e-4&&(p=v),x<1e-4&&(x=v),h3.initNonuniformCatmullRom(l.x,u.x,f.x,h.x,p,v,x),u3.initNonuniformCatmullRom(l.y,u.y,f.y,h.y,p,v,x),f3.initNonuniformCatmullRom(l.z,u.z,f.z,h.z,p,v,x)}else this.curveType==="catmullrom"&&(h3.initCatmullRom(l.x,u.x,f.x,h.x,this.tension),u3.initCatmullRom(l.y,u.y,f.y,h.y,this.tension),f3.initCatmullRom(l.z,u.z,f.z,h.z,this.tension));return i.set(h3.calc(c),u3.calc(c),f3.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}};No.prototype.isCatmullRomCurve3=!0;function ru(a,e,t,i,n){let r=(i-e)*.5,s=(n-t)*.5,o=a*a,c=a*o;return(2*t-2*i+r+s)*c+(-3*t+3*i-2*r-s)*o+r*a+t}function tw(a,e){let t=1-a;return t*t*e}function iw(a,e){return 2*(1-a)*a*e}function nw(a,e){return a*a*e}function zs(a,e,t,i){return tw(a,e)+iw(a,t)+nw(a,i)}function rw(a,e){let t=1-a;return t*t*t*e}function sw(a,e){let t=1-a;return 3*t*t*a*e}function aw(a,e){return 3*(1-a)*a*a*e}function ow(a,e){return a*a*a*e}function Cs(a,e,t,i,n){return rw(a,e)+sw(a,t)+aw(a,i)+ow(a,n)}var Us=class extends t1{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,r=this.v1,s=this.v2,o=this.v3;return i.set(Cs(e,n.x,r.x,s.x,o.x),Cs(e,n.y,r.y,s.y,o.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}};Us.prototype.isCubicBezierCurve=!0;var Fo=class extends t1{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,r=this.v1,s=this.v2,o=this.v3;return i.set(Cs(e,n.x,r.x,s.x,o.x),Cs(e,n.y,r.y,s.y,o.y),Cs(e,n.z,r.z,s.z,o.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}};Fo.prototype.isCubicBezierCurve3=!0;var gr=class extends t1{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}};gr.prototype.isLineCurve=!0;var U3=class extends t1{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}},qs=class extends t1{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,r=this.v1,s=this.v2;return i.set(zs(e,n.x,r.x,s.x),zs(e,n.y,r.y,s.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}};qs.prototype.isQuadraticBezierCurve=!0;var Bo=class extends t1{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,r=this.v1,s=this.v2;return i.set(zs(e,n.x,r.x,s.x),zs(e,n.y,r.y,s.y),zs(e,n.z,r.z,s.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}};Bo.prototype.isQuadraticBezierCurve3=!0;var Gs=class extends t1{constructor(e=[]){super(),this.type="SplineCurve",this.points=e}getPoint(e,t=new te){let i=t,n=this.points,r=(n.length-1)*e,s=Math.floor(r),o=r-s,c=n[s===0?s:s-1],l=n[s],h=n[s>n.length-2?n.length-1:s+1],u=n[s>n.length-3?n.length-1:s+2];return i.set(ru(o,c.x,l.x,h.x,u.x),ru(o,c.y,l.y,h.y,u.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}};Gs.prototype.isSplineCurve=!0;var Ru=Object.freeze({__proto__:null,ArcCurve:Ro,CatmullRomCurve3:No,CubicBezierCurve:Us,CubicBezierCurve3:Fo,EllipseCurve:mr,LineCurve:gr,LineCurve3:U3,QuadraticBezierCurve:qs,QuadraticBezierCurve3:Bo,SplineCurve:Gs}),q3=class extends t1{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 gr(t,e))}getPoint(e,t){let i=e*this.getLength(),n=this.getCurveLengths(),r=0;for(;r<n.length;){if(n[r]>=i){let s=n[r]-i,o=this.curves[r],c=o.getLength(),l=c===0?0:1-s/c;return o.getPointAt(l,t)}r++}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,r=this.curves;n<r.length;n++){let s=r[n],o=s&&s.isEllipseCurve?e*2:s&&(s.isLineCurve||s.isLineCurve3)?1:s&&s.isSplineCurve?e*s.points.length:e,c=s.getPoints(o);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 Ru[n.type]().fromJSON(n))}return this}},Ws=class extends q3{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 gr(this.currentPoint.clone(),new te(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,n){let r=new qs(this.currentPoint.clone(),new te(e,t),new te(i,n));return this.curves.push(r),this.currentPoint.set(i,n),this}bezierCurveTo(e,t,i,n,r,s){let o=new Us(this.currentPoint.clone(),new te(e,t),new te(i,n),new te(r,s));return this.curves.push(o),this.currentPoint.set(r,s),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),i=new Gs(t);return this.curves.push(i),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,i,n,r,s){let o=this.currentPoint.x,c=this.currentPoint.y;return this.absarc(e+o,t+c,i,n,r,s),this}absarc(e,t,i,n,r,s){return this.absellipse(e,t,i,i,n,r,s),this}ellipse(e,t,i,n,r,s,o,c){let l=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(e+l,t+h,i,n,r,s,o,c),this}absellipse(e,t,i,n,r,s,o,c){let l=new mr(e,t,i,n,r,s,o,c);if(this.curves.length>0){let u=l.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.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}},nn=class extends Ws{constructor(e){super(e),this.uuid=F1(),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 Ws().fromJSON(n))}return this}},cw={triangulate:function(a,e,t=2){let i=e&&e.length,n=i?e[0]*t:a.length,r=Nu(a,0,n,t,!0),s=[];if(!r||r.next===r.prev)return s;let o,c,l,h,u,f,d;if(i&&(r=dw(a,e,r,t)),a.length>80*t){o=l=a[0],c=h=a[1];for(let p=t;p<n;p+=t)u=a[p],f=a[p+1],u<o&&(o=u),f<c&&(c=f),u>l&&(l=u),f>h&&(h=f);d=Math.max(l-o,h-c),d=d!==0?1/d:0}return js(r,s,t,o,c,d),s}};function Nu(a,e,t,i,n){let r,s;if(n===Cw(a,e,t,i)>0)for(r=e;r<t;r+=i)s=su(r,a[r],a[r+1],s);else for(r=t-i;r>=e;r-=i)s=su(r,a[r],a[r+1],s);return s&&Jo(s,s.next)&&(Xs(s),s=s.next),s}function bi(a,e){if(!a)return a;e||(e=a);let t=a,i;do if(i=!1,!t.steiner&&(Jo(t,t.next)||ot(t.prev,t,t.next)===0)){if(Xs(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function js(a,e,t,i,n,r,s){if(!a)return;!s&&r&&xw(a,i,n,r);let o=a,c,l;for(;a.prev!==a.next;){if(c=a.prev,l=a.next,r?hw(a,i,n,r):lw(a)){e.push(c.i/t),e.push(a.i/t),e.push(l.i/t),Xs(a),a=l.next,o=l.next;continue}if(a=l,a===o){s?s===1?(a=uw(bi(a),e,t),js(a,e,t,i,n,r,2)):s===2&&fw(a,e,t,i,n,r):js(bi(a),e,t,i,n,r,1);break}}}function lw(a){let e=a.prev,t=a,i=a.next;if(ot(e,t,i)>=0)return!1;let n=a.next.next;for(;n!==a.prev;){if(ir(e.x,e.y,t.x,t.y,i.x,i.y,n.x,n.y)&&ot(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function hw(a,e,t,i){let n=a.prev,r=a,s=a.next;if(ot(n,r,s)>=0)return!1;let o=n.x<r.x?n.x<s.x?n.x:s.x:r.x<s.x?r.x:s.x,c=n.y<r.y?n.y<s.y?n.y:s.y:r.y<s.y?r.y:s.y,l=n.x>r.x?n.x>s.x?n.x:s.x:r.x>s.x?r.x:s.x,h=n.y>r.y?n.y>s.y?n.y:s.y:r.y>s.y?r.y:s.y,u=G3(o,c,e,t,i),f=G3(l,h,e,t,i),d=a.prevZ,p=a.nextZ;for(;d&&d.z>=u&&p&&p.z<=f;){if(d!==a.prev&&d!==a.next&&ir(n.x,n.y,r.x,r.y,s.x,s.y,d.x,d.y)&&ot(d.prev,d,d.next)>=0||(d=d.prevZ,p!==a.prev&&p!==a.next&&ir(n.x,n.y,r.x,r.y,s.x,s.y,p.x,p.y)&&ot(p.prev,p,p.next)>=0))return!1;p=p.nextZ}for(;d&&d.z>=u;){if(d!==a.prev&&d!==a.next&&ir(n.x,n.y,r.x,r.y,s.x,s.y,d.x,d.y)&&ot(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;p&&p.z<=f;){if(p!==a.prev&&p!==a.next&&ir(n.x,n.y,r.x,r.y,s.x,s.y,p.x,p.y)&&ot(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function uw(a,e,t){let i=a;do{let n=i.prev,r=i.next.next;!Jo(n,r)&&Fu(n,i,i.next,r)&&Zs(n,r)&&Zs(r,n)&&(e.push(n.i/t),e.push(i.i/t),e.push(r.i/t),Xs(i),Xs(i.next),i=a=r),i=i.next}while(i!==a);return bi(i)}function fw(a,e,t,i,n,r){let s=a;do{let o=s.next.next;for(;o!==s.prev;){if(s.i!==o.i&&bw(s,o)){let c=Bu(s,o);s=bi(s,s.next),c=bi(c,c.next),js(s,e,t,i,n,r),js(c,e,t,i,n,r);return}o=o.next}s=s.next}while(s!==a)}function dw(a,e,t,i){let n=[],r,s,o,c,l;for(r=0,s=e.length;r<s;r++)o=e[r]*i,c=r<s-1?e[r+1]*i:a.length,l=Nu(a,o,c,i,!1),l===l.next&&(l.steiner=!0),n.push(ww(l));for(n.sort(pw),r=0;r<n.length;r++)mw(n[r],t),t=bi(t,t.next);return t}function pw(a,e){return a.x-e.x}function mw(a,e){if(e=gw(a,e),e){let t=Bu(e,a);bi(e,e.next),bi(t,t.next)}}function gw(a,e){let t=e,i=a.x,n=a.y,r=-1/0,s;do{if(n<=t.y&&n>=t.next.y&&t.next.y!==t.y){let f=t.x+(n-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=i&&f>r){if(r=f,f===i){if(n===t.y)return t;if(n===t.next.y)return t.next}s=t.x<t.next.x?t:t.next}}t=t.next}while(t!==e);if(!s)return null;if(i===r)return s;let o=s,c=s.x,l=s.y,h=1/0,u;t=s;do i>=t.x&&t.x>=c&&i!==t.x&&ir(n<l?i:r,n,c,l,n<l?r:i,n,t.x,t.y)&&(u=Math.abs(n-t.y)/(i-t.x),Zs(t,a)&&(u<h||u===h&&(t.x>s.x||t.x===s.x&&vw(s,t)))&&(s=t,h=u)),t=t.next;while(t!==o);return s}function vw(a,e){return ot(a.prev,a,e.prev)<0&&ot(e.next,a,a.next)<0}function xw(a,e,t,i){let n=a;do n.z===null&&(n.z=G3(n.x,n.y,e,t,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==a);n.prevZ.nextZ=null,n.prevZ=null,yw(n)}function yw(a){let e,t,i,n,r,s,o,c,l=1;do{for(t=a,a=null,r=null,s=0;t;){for(s++,i=t,o=0,e=0;e<l&&(o++,i=i.nextZ,!!i);e++);for(c=l;o>0||c>0&&i;)o!==0&&(c===0||!i||t.z<=i.z)?(n=t,t=t.nextZ,o--):(n=i,i=i.nextZ,c--),r?r.nextZ=n:a=n,n.prevZ=r,r=n;t=i}r.nextZ=null,l*=2}while(s>1);return a}function G3(a,e,t,i,n){return a=32767*(a-t)*n,e=32767*(e-i)*n,a=(a|a<<8)&16711935,a=(a|a<<4)&252645135,a=(a|a<<2)&858993459,a=(a|a<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,a|e<<1}function ww(a){let e=a,t=a;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==a);return t}function ir(a,e,t,i,n,r,s,o){return(n-s)*(e-o)-(a-s)*(r-o)>=0&&(a-s)*(i-o)-(t-s)*(e-o)>=0&&(t-s)*(r-o)-(n-s)*(i-o)>=0}function bw(a,e){return a.next.i!==e.i&&a.prev.i!==e.i&&!Mw(a,e)&&(Zs(a,e)&&Zs(e,a)&&zw(a,e)&&(ot(a.prev,a,e.prev)||ot(a,e.prev,e))||Jo(a,e)&&ot(a.prev,a,a.next)>0&&ot(e.prev,e,e.next)>0)}function ot(a,e,t){return(e.y-a.y)*(t.x-e.x)-(e.x-a.x)*(t.y-e.y)}function Jo(a,e){return a.x===e.x&&a.y===e.y}function Fu(a,e,t,i){let n=fo(ot(a,e,t)),r=fo(ot(a,e,i)),s=fo(ot(t,i,a)),o=fo(ot(t,i,e));return!!(n!==r&&s!==o||n===0&&uo(a,t,e)||r===0&&uo(a,i,e)||s===0&&uo(t,a,i)||o===0&&uo(t,e,i))}function uo(a,e,t){return e.x<=Math.max(a.x,t.x)&&e.x>=Math.min(a.x,t.x)&&e.y<=Math.max(a.y,t.y)&&e.y>=Math.min(a.y,t.y)}function fo(a){return a>0?1:a<0?-1:0}function Mw(a,e){let t=a;do{if(t.i!==a.i&&t.next.i!==a.i&&t.i!==e.i&&t.next.i!==e.i&&Fu(t,t.next,a,e))return!0;t=t.next}while(t!==a);return!1}function Zs(a,e){return ot(a.prev,a,a.next)<0?ot(a,e,a.next)>=0&&ot(a,a.prev,e)>=0:ot(a,e,a.prev)<0||ot(a,a.next,e)<0}function zw(a,e){let t=a,i=!1,n=(a.x+e.x)/2,r=(a.y+e.y)/2;do t.y>r!=t.next.y>r&&t.next.y!==t.y&&n<(t.next.x-t.x)*(r-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==a);return i}function Bu(a,e){let t=new W3(a.i,a.x,a.y),i=new W3(e.i,e.x,e.y),n=a.next,r=e.prev;return a.next=e,e.prev=a,t.next=n,n.prev=t,i.next=t,t.prev=i,r.next=i,i.prev=r,i}function su(a,e,t,i){let n=new W3(a,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 Xs(a){a.next.prev=a.prev,a.prev.next=a.next,a.prevZ&&(a.prevZ.nextZ=a.nextZ),a.nextZ&&(a.nextZ.prevZ=a.prevZ)}function W3(a,e,t){this.i=a,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 Cw(a,e,t,i){let n=0;for(let r=e,s=t-i;r<t;r+=i)n+=(a[s]-a[r])*(a[r+1]+a[s+1]),s=r;return n}var vi=class a{static area(e){let t=e.length,i=0;for(let n=t-1,r=0;r<t;n=r++)i+=e[n].x*e[r].y-e[r].x*e[n].y;return i*.5}static isClockWise(e){return a.area(e)<0}static triangulateShape(e,t){let i=[],n=[],r=[];au(e),ou(i,e);let s=e.length;t.forEach(au);for(let c=0;c<t.length;c++)n.push(s),s+=t[c].length,ou(i,t[c]);let o=cw.triangulate(i,n);for(let c=0;c<o.length;c+=3)r.push(o.slice(c,c+3));return r}};function au(a){let e=a.length;e>2&&a[e-1].equals(a[0])&&a.pop()}function ou(a,e){for(let t=0;t<e.length;t++)a.push(e[t].x),a.push(e[t].y)}var vr=class a extends st{constructor(e=new nn([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=[],r=[];for(let o=0,c=e.length;o<c;o++){let l=e[o];s(l)}this.setAttribute("position",new vt(n,3)),this.setAttribute("uv",new vt(r,2)),this.computeVertexNormals();function s(o){let c=[],l=t.curveSegments!==void 0?t.curveSegments:12,h=t.steps!==void 0?t.steps:1,u=t.depth!==void 0?t.depth:1,f=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:Aw;t.amount!==void 0&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),u=t.amount);let M,y=!1,b,C,_,S;g&&(M=g.getSpacedPoints(h),y=!0,f=!1,b=g.computeFrenetFrames(h,!1),C=new B,_=new B,S=new B),f||(x=0,d=0,p=0,v=0);let P=o.extractPoints(l),H=P.shape,w=P.holes;if(!vi.isClockWise(H)){H=H.reverse();for(let Q=0,re=w.length;Q<re;Q++){let ne=w[Q];vi.isClockWise(ne)&&(w[Q]=ne.reverse())}}let A=vi.triangulateShape(H,w),R=H;for(let Q=0,re=w.length;Q<re;Q++){let ne=w[Q];H=H.concat(ne)}function V(Q,re,ne){return re||console.error("THREE.ExtrudeGeometry: vec does not exist"),re.clone().multiplyScalar(ne).add(Q)}let L=H.length,N=A.length;function I(Q,re,ne){let pe,he,Ae,Ee=Q.x-re.x,Pe=Q.y-re.y,ke=ne.x-Q.x,Oe=ne.y-Q.y,F=Ee*Ee+Pe*Pe,E=Ee*Oe-Pe*ke;if(Math.abs(E)>Number.EPSILON){let $=Math.sqrt(F),se=Math.sqrt(ke*ke+Oe*Oe),ve=re.x-Pe/$,J=re.y+Ee/$,Me=ne.x-Oe/se,be=ne.y+ke/se,fe=((Me-ve)*Oe-(be-J)*ke)/(Ee*Oe-Pe*ke);pe=ve+Ee*fe-Q.x,he=J+Pe*fe-Q.y;let ue=pe*pe+he*he;if(ue<=2)return new te(pe,he);Ae=Math.sqrt(ue/2)}else{let $=!1;Ee>Number.EPSILON?ke>Number.EPSILON&&($=!0):Ee<-Number.EPSILON?ke<-Number.EPSILON&&($=!0):Math.sign(Pe)===Math.sign(Oe)&&($=!0),$?(pe=-Pe,he=Ee,Ae=Math.sqrt(F)):(pe=Ee,he=Pe,Ae=Math.sqrt(F/2))}return new te(pe/Ae,he/Ae)}let W=[];for(let Q=0,re=R.length,ne=re-1,pe=Q+1;Q<re;Q++,ne++,pe++)ne===re&&(ne=0),pe===re&&(pe=0),W[Q]=I(R[Q],R[ne],R[pe]);let O=[],q,j=W.concat();for(let Q=0,re=w.length;Q<re;Q++){let ne=w[Q];q=[];for(let pe=0,he=ne.length,Ae=he-1,Ee=pe+1;pe<he;pe++,Ae++,Ee++)Ae===he&&(Ae=0),Ee===he&&(Ee=0),q[pe]=I(ne[pe],ne[Ae],ne[Ee]);O.push(q),j=j.concat(q)}for(let Q=0;Q<x;Q++){let re=Q/x,ne=d*Math.cos(re*Math.PI/2),pe=p*Math.sin(re*Math.PI/2)+v;for(let he=0,Ae=R.length;he<Ae;he++){let Ee=V(R[he],W[he],pe);ce(Ee.x,Ee.y,-ne)}for(let he=0,Ae=w.length;he<Ae;he++){let Ee=w[he];q=O[he];for(let Pe=0,ke=Ee.length;Pe<ke;Pe++){let Oe=V(Ee[Pe],q[Pe],pe);ce(Oe.x,Oe.y,-ne)}}}let ie=p+v;for(let Q=0;Q<L;Q++){let re=f?V(H[Q],j[Q],ie):H[Q];y?(_.copy(b.normals[0]).multiplyScalar(re.x),C.copy(b.binormals[0]).multiplyScalar(re.y),S.copy(M[0]).add(_).add(C),ce(S.x,S.y,S.z)):ce(re.x,re.y,0)}for(let Q=1;Q<=h;Q++)for(let re=0;re<L;re++){let ne=f?V(H[re],j[re],ie):H[re];y?(_.copy(b.normals[Q]).multiplyScalar(ne.x),C.copy(b.binormals[Q]).multiplyScalar(ne.y),S.copy(M[Q]).add(_).add(C),ce(S.x,S.y,S.z)):ce(ne.x,ne.y,u/h*Q)}for(let Q=x-1;Q>=0;Q--){let re=Q/x,ne=d*Math.cos(re*Math.PI/2),pe=p*Math.sin(re*Math.PI/2)+v;for(let he=0,Ae=R.length;he<Ae;he++){let Ee=V(R[he],W[he],pe);ce(Ee.x,Ee.y,u+ne)}for(let he=0,Ae=w.length;he<Ae;he++){let Ee=w[he];q=O[he];for(let Pe=0,ke=Ee.length;Pe<ke;Pe++){let Oe=V(Ee[Pe],q[Pe],pe);y?ce(Oe.x,Oe.y+M[h-1].y,M[h-1].x+ne):ce(Oe.x,Oe.y,u+ne)}}}ae(),U();function ae(){let Q=n.length/3;if(f){let re=0,ne=L*re;for(let pe=0;pe<N;pe++){let he=A[pe];xe(he[2]+ne,he[1]+ne,he[0]+ne)}re=h+x*2,ne=L*re;for(let pe=0;pe<N;pe++){let he=A[pe];xe(he[0]+ne,he[1]+ne,he[2]+ne)}}else{for(let re=0;re<N;re++){let ne=A[re];xe(ne[2],ne[1],ne[0])}for(let re=0;re<N;re++){let ne=A[re];xe(ne[0]+L*h,ne[1]+L*h,ne[2]+L*h)}}i.addGroup(Q,n.length/3-Q,0)}function U(){let Q=n.length/3,re=0;Ce(R,re),re+=R.length;for(let ne=0,pe=w.length;ne<pe;ne++){let he=w[ne];Ce(he,re),re+=he.length}i.addGroup(Q,n.length/3-Q,1)}function Ce(Q,re){let ne=Q.length;for(;--ne>=0;){let pe=ne,he=ne-1;he<0&&(he=Q.length-1);for(let Ae=0,Ee=h+x*2;Ae<Ee;Ae++){let Pe=L*Ae,ke=L*(Ae+1),Oe=re+pe+Pe,F=re+he+Pe,E=re+he+ke,$=re+pe+ke;le(Oe,F,E,$)}}}function ce(Q,re,ne){c.push(Q),c.push(re),c.push(ne)}function xe(Q,re,ne){De(Q),De(re),De(ne);let pe=n.length/3,he=m.generateTopUV(i,n,pe-3,pe-2,pe-1);ze(he[0]),ze(he[1]),ze(he[2])}function le(Q,re,ne,pe){De(Q),De(re),De(pe),De(re),De(ne),De(pe);let he=n.length/3,Ae=m.generateSideWallUV(i,n,he-6,he-3,he-2,he-1);ze(Ae[0]),ze(Ae[1]),ze(Ae[3]),ze(Ae[1]),ze(Ae[2]),ze(Ae[3])}function De(Q){n.push(c[Q*3+0]),n.push(c[Q*3+1]),n.push(c[Q*3+2])}function ze(Q){r.push(Q.x),r.push(Q.y)}}}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,i=this.parameters.options;return Sw(t,i,e)}static fromJSON(e,t){let i=[];for(let r=0,s=e.shapes.length;r<s;r++){let o=t[e.shapes[r]];i.push(o)}let n=e.options.extrudePath;return n!==void 0&&(e.options.extrudePath=new Ru[n.type]().fromJSON(n)),new a(i,e.options)}},Aw={generateTopUV:function(a,e,t,i,n){let r=e[t*3],s=e[t*3+1],o=e[i*3],c=e[i*3+1],l=e[n*3],h=e[n*3+1];return[new te(r,s),new te(o,c),new te(l,h)]},generateSideWallUV:function(a,e,t,i,n,r){let s=e[t*3],o=e[t*3+1],c=e[t*3+2],l=e[i*3],h=e[i*3+1],u=e[i*3+2],f=e[n*3],d=e[n*3+1],p=e[n*3+2],v=e[r*3],x=e[r*3+1],g=e[r*3+2];return Math.abs(o-h)<Math.abs(s-l)?[new te(s,1-c),new te(l,1-u),new te(f,1-p),new te(v,1-g)]:[new te(o,1-c),new te(h,1-u),new te(d,1-p),new te(x,1-g)]}};function Sw(a,e,t){if(t.shapes=[],Array.isArray(a))for(let i=0,n=a.length;i<n;i++){let r=a[i];t.shapes.push(r.uuid)}else t.shapes.push(a.uuid);return e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}var j3=class a extends st{constructor(e=new nn([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=[],r=[],s=[],o=0,c=0;if(Array.isArray(e)===!1)l(e);else for(let h=0;h<e.length;h++)l(e[h]),this.addGroup(o,c,h),o+=c,c=0;this.setIndex(i),this.setAttribute("position",new vt(n,3)),this.setAttribute("normal",new vt(r,3)),this.setAttribute("uv",new vt(s,2));function l(h){let u=n.length/3,f=h.extractPoints(t),d=f.shape,p=f.holes;vi.isClockWise(d)===!1&&(d=d.reverse());for(let x=0,g=p.length;x<g;x++){let m=p[x];vi.isClockWise(m)===!0&&(p[x]=m.reverse())}let v=vi.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),r.push(0,0,1),s.push(m.x,m.y)}for(let x=0,g=v.length;x<g;x++){let m=v[x],M=m[0]+u,y=m[1]+u,b=m[2]+u;i.push(M,y,b),c+=3}}}toJSON(){let e=super.toJSON(),t=this.parameters.shapes;return _w(t,e)}static fromJSON(e,t){let i=[];for(let n=0,r=e.shapes.length;n<r;n++){let s=t[e.shapes[n]];i.push(s)}return new a(i,e.curveSegments)}};function _w(a,e){if(e.shapes=[],Array.isArray(a))for(let t=0,i=a.length;t<i;t++){let n=a[t];e.shapes.push(n.uuid)}else e.shapes.push(a.uuid);return e}var Ys=class extends xt{constructor(e){super(),this.type="ShadowMaterial",this.color=new we(0),this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this}};Ys.prototype.isShadowMaterial=!0;var Po=class extends xt{constructor(e){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new we(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 we(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=br,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}};Po.prototype.isMeshStandardMaterial=!0;var Z3=class extends Po{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 Kt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.sheenColor=new we(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 we(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new we(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}};Z3.prototype.isMeshPhysicalMaterial=!0;var X3=class extends xt{constructor(e){super(),this.type="MeshPhongMaterial",this.color=new we(16777215),this.specular=new we(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new we(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=br,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=Zo,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}};X3.prototype.isMeshPhongMaterial=!0;var Y3=class extends xt{constructor(e){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new we(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new we(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=br,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}};Y3.prototype.isMeshToonMaterial=!0;var $3=class extends xt{constructor(e){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=br,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}};$3.prototype.isMeshNormalMaterial=!0;var J3=class extends xt{constructor(e){super(),this.type="MeshLambertMaterial",this.color=new we(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new we(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Zo,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}};J3.prototype.isMeshLambertMaterial=!0;var Q3=class extends xt{constructor(e){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new we(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=br,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}};Q3.prototype.isMeshMatcapMaterial=!0;var K3=class extends tn{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}};K3.prototype.isLineDashedMaterial=!0;var rt={arraySlice:function(a,e,t){return rt.isTypedArray(a)?new a.constructor(a.subarray(e,t!==void 0?t:a.length)):a.slice(e,t)},convertArray:function(a,e,t){return!a||!t&&a.constructor===e?a:typeof e.BYTES_PER_ELEMENT=="number"?new e(a):Array.prototype.slice.call(a)},isTypedArray:function(a){return ArrayBuffer.isView(a)&&!(a instanceof DataView)},getKeyframeOrder:function(a){function e(n,r){return a[n]-a[r]}let t=a.length,i=new Array(t);for(let n=0;n!==t;++n)i[n]=n;return i.sort(e),i},sortedArray:function(a,e,t){let i=a.length,n=new a.constructor(i);for(let r=0,s=0;s!==i;++r){let o=t[r]*e;for(let c=0;c!==e;++c)n[s++]=a[o+c]}return n},flattenJSON:function(a,e,t,i){let n=1,r=a[0];for(;r!==void 0&&r[i]===void 0;)r=a[n++];if(r===void 0)return;let s=r[i];if(s!==void 0)if(Array.isArray(s))do s=r[i],s!==void 0&&(e.push(r.time),t.push.apply(t,s)),r=a[n++];while(r!==void 0);else if(s.toArray!==void 0)do s=r[i],s!==void 0&&(e.push(r.time),s.toArray(t,t.length)),r=a[n++];while(r!==void 0);else do s=r[i],s!==void 0&&(e.push(r.time),t.push(s)),r=a[n++];while(r!==void 0)},subclip:function(a,e,t,i,n=30){let r=a.clone();r.name=e;let s=[];for(let c=0;c<r.tracks.length;++c){let l=r.tracks[c],h=l.getValueSize(),u=[],f=[];for(let d=0;d<l.times.length;++d){let p=l.times[d]*n;if(!(p<t||p>=i)){u.push(l.times[d]);for(let v=0;v<h;++v)f.push(l.values[d*h+v])}}u.length!==0&&(l.times=rt.convertArray(u,l.times.constructor),l.values=rt.convertArray(f,l.values.constructor),s.push(l))}r.tracks=s;let o=1/0;for(let c=0;c<r.tracks.length;++c)o>r.tracks[c].times[0]&&(o=r.tracks[c].times[0]);for(let c=0;c<r.tracks.length;++c)r.tracks[c].shift(-1*o);return r.resetDuration(),r},makeClipAdditive:function(a,e=0,t=a,i=30){i<=0&&(i=30);let n=t.tracks.length,r=e/i;for(let s=0;s<n;++s){let o=t.tracks[s],c=o.ValueTypeName;if(c==="bool"||c==="string")continue;let l=a.tracks.find(function(g){return g.name===o.name&&g.ValueTypeName===c});if(l===void 0)continue;let h=0,u=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=u/3);let f=0,d=l.getValueSize();l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(f=d/3);let p=o.times.length-1,v;if(r<=o.times[0]){let g=h,m=u-h;v=rt.arraySlice(o.values,g,m)}else if(r>=o.times[p]){let g=p*u+h,m=g+u-h;v=rt.arraySlice(o.values,g,m)}else{let g=o.createInterpolant(),m=h,M=u-h;g.evaluate(r),v=rt.arraySlice(g.resultBuffer,m,M)}c==="quaternion"&&new kt().fromArray(v).normalize().conjugate().toArray(v);let x=l.times.length;for(let g=0;g<x;++g){let m=g*d+f;if(c==="quaternion")kt.multiplyQuaternionsFlat(l.values,m,v,0,l.values,m);else{let M=d-f*2;for(let y=0;y<M;++y)l.values[m+y]-=v[y]}}}return a.blendMode=yu,a}},Q1=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],r=t[i-1];e:{t:{let s;i:{n:if(!(e<n)){for(let o=i+2;;){if(n===void 0){if(e<r)break n;return i=t.length,this._cachedIndex=i,this.afterEnd_(i-1,e,r)}if(i===o)break;if(r=n,n=t[++i],e<n)break t}s=t.length;break i}if(!(e>=r)){let o=t[1];e<o&&(i=2,r=o);for(let c=i-2;;){if(r===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,n);if(i===c)break;if(n=r,r=t[--i-1],e>=r)break t}s=i,i=0;break i}break e}for(;i<s;){let o=i+s>>>1;e<t[o]?s=o:i=o+1}if(n=t[i],r=t[i-1],r===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,r,e)}this._cachedIndex=i,this.intervalChanged_(i,r,n)}return this.interpolate_(i,r,e,n)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=e*n;for(let s=0;s!==n;++s)t[s]=i[r+s];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}};Q1.prototype.beforeStart_=Q1.prototype.copySampleValue_;Q1.prototype.afterEnd_=Q1.prototype.copySampleValue_;var ec=class extends Q1{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:er,endingEnd:er}}intervalChanged_(e,t,i){let n=this.parameterPositions,r=e-2,s=e+1,o=n[r],c=n[s];if(o===void 0)switch(this.getSettings_().endingStart){case tr:r=e,o=2*t-i;break;case wo:r=n.length-2,o=t+n[r]-n[r+1];break;default:r=e,o=i}if(c===void 0)switch(this.getSettings_().endingEnd){case tr:s=e,c=2*i-t;break;case wo:s=1,c=i+n[1]-n[0];break;default:s=e-1,c=t}let l=(i-t)*.5,h=this.valueSize;this._weightPrev=l/(t-o),this._weightNext=l/(c-i),this._offsetPrev=r*h,this._offsetNext=s*h}interpolate_(e,t,i,n){let r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,c=e*o,l=c-o,h=this._offsetPrev,u=this._offsetNext,f=this._weightPrev,d=this._weightNext,p=(i-t)/(n-t),v=p*p,x=v*p,g=-f*x+2*f*v-f*p,m=(1+f)*x+(-1.5-2*f)*v+(-.5+f)*p+1,M=(-1-d)*x+(1.5+d)*v+.5*p,y=d*x-d*v;for(let b=0;b!==o;++b)r[b]=g*s[h+b]+m*s[l+b]+M*s[c+b]+y*s[u+b];return r}},Io=class extends Q1{constructor(e,t,i,n){super(e,t,i,n)}interpolate_(e,t,i,n){let r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,c=e*o,l=c-o,h=(i-t)/(n-t),u=1-h;for(let f=0;f!==o;++f)r[f]=s[l+f]*u+s[c+f]*h;return r}},tc=class extends Q1{constructor(e,t,i,n){super(e,t,i,n)}interpolate_(e){return this.copySampleValue_(e-1)}},y1=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=rt.convertArray(t,this.TimeBufferType),this.values=rt.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:rt.convertArray(e.times,Array),values:rt.convertArray(e.values,Array)};let n=e.getInterpolation();n!==e.DefaultInterpolation&&(i.interpolation=n)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new tc(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Io(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new ec(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case xo:t=this.InterpolantFactoryMethodDiscrete;break;case yo:t=this.InterpolantFactoryMethodLinear;break;case R6: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 xo;case this.InterpolantFactoryMethodLinear:return yo;case this.InterpolantFactoryMethodSmooth:return R6}}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,r=0,s=n-1;for(;r!==n&&i[r]<e;)++r;for(;s!==-1&&i[s]>t;)--s;if(++s,r!==0||s!==n){r>=s&&(s=Math.max(s,1),r=s-1);let o=this.getValueSize();this.times=rt.arraySlice(i,r,s),this.values=rt.arraySlice(this.values,r*o,s*o)}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,r=i.length;r===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let s=null;for(let o=0;o!==r;o++){let c=i[o];if(typeof c=="number"&&isNaN(c)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,c),e=!1;break}if(s!==null&&s>c){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,c,s),e=!1;break}s=c}if(n!==void 0&&rt.isTypedArray(n))for(let o=0,c=n.length;o!==c;++o){let l=n[o];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,l),e=!1;break}}return e}optimize(){let e=rt.arraySlice(this.times),t=rt.arraySlice(this.values),i=this.getValueSize(),n=this.getInterpolation()===R6,r=e.length-1,s=1;for(let o=1;o<r;++o){let c=!1,l=e[o],h=e[o+1];if(l!==h&&(o!==1||l!==e[0]))if(n)c=!0;else{let u=o*i,f=u-i,d=u+i;for(let p=0;p!==i;++p){let v=t[u+p];if(v!==t[f+p]||v!==t[d+p]){c=!0;break}}}if(c){if(o!==s){e[s]=e[o];let u=o*i,f=s*i;for(let d=0;d!==i;++d)t[f+d]=t[u+d]}++s}}if(r>0){e[s]=e[r];for(let o=r*i,c=s*i,l=0;l!==i;++l)t[c+l]=t[o+l];++s}return s!==e.length?(this.times=rt.arraySlice(e,0,s),this.values=rt.arraySlice(t,0,s*i)):(this.times=e,this.values=t),this}clone(){let e=rt.arraySlice(this.times,0),t=rt.arraySlice(this.values,0),i=this.constructor,n=new i(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}};y1.prototype.TimeBufferType=Float32Array;y1.prototype.ValueBufferType=Float32Array;y1.prototype.DefaultInterpolation=yo;var Mi=class extends y1{};Mi.prototype.ValueTypeName="bool";Mi.prototype.ValueBufferType=Array;Mi.prototype.DefaultInterpolation=xo;Mi.prototype.InterpolantFactoryMethodLinear=void 0;Mi.prototype.InterpolantFactoryMethodSmooth=void 0;var ko=class extends y1{};ko.prototype.ValueTypeName="color";var xr=class extends y1{};xr.prototype.ValueTypeName="number";var ic=class extends Q1{constructor(e,t,i,n){super(e,t,i,n)}interpolate_(e,t,i,n){let r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,c=(i-t)/(n-t),l=e*o;for(let h=l+o;l!==h;l+=4)kt.slerpFlat(r,0,s,l-o,s,l,c);return r}},rn=class extends y1{InterpolantFactoryMethodLinear(e){return new ic(this.times,this.values,this.getValueSize(),e)}};rn.prototype.ValueTypeName="quaternion";rn.prototype.DefaultInterpolation=yo;rn.prototype.InterpolantFactoryMethodSmooth=void 0;var zi=class extends y1{};zi.prototype.ValueTypeName="string";zi.prototype.ValueBufferType=Array;zi.prototype.DefaultInterpolation=xo;zi.prototype.InterpolantFactoryMethodLinear=void 0;zi.prototype.InterpolantFactoryMethodSmooth=void 0;var yr=class extends y1{};yr.prototype.ValueTypeName="vector";var Oo=class{constructor(e,t=-1,i,n=Vc){this.name=e,this.tracks=i,this.duration=t,this.blendMode=n,this.uuid=F1(),this.duration<0&&this.resetDuration()}static parse(e){let t=[],i=e.tracks,n=1/(e.fps||1);for(let s=0,o=i.length;s!==o;++s)t.push(Lw(i[s]).scale(n));let r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}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 r=0,s=i.length;r!==s;++r)t.push(y1.toJSON(i[r]));return n}static CreateFromMorphTargetSequence(e,t,i,n){let r=t.length,s=[];for(let o=0;o<r;o++){let c=[],l=[];c.push((o+r-1)%r,o,(o+1)%r),l.push(0,1,0);let h=rt.getKeyframeOrder(c);c=rt.sortedArray(c,1,h),l=rt.sortedArray(l,1,h),!n&&c[0]===0&&(c.push(r),l.push(l[0])),s.push(new xr(".morphTargetInfluences["+t[o].name+"]",c,l).scale(1/i))}return new this(e,-1,s)}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={},r=/^([\w-]*?)([\d]+)$/;for(let o=0,c=e.length;o<c;o++){let l=e[o],h=l.name.match(r);if(h&&h.length>1){let u=h[1],f=n[u];f||(n[u]=f=[]),f.push(l)}}let s=[];for(let o in n)s.push(this.CreateFromMorphTargetSequence(o,n[o],t,i));return s}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;let i=function(u,f,d,p,v){if(d.length!==0){let x=[],g=[];rt.flattenJSON(d,x,g,p),x.length!==0&&v.push(new u(f,x,g))}},n=[],r=e.name||"default",s=e.fps||30,o=e.blendMode,c=e.length||-1,l=e.hierarchy||[];for(let u=0;u<l.length;u++){let f=l[u].keys;if(!(!f||f.length===0))if(f[0].morphTargets){let d={},p;for(p=0;p<f.length;p++)if(f[p].morphTargets)for(let v=0;v<f[p].morphTargets.length;v++)d[f[p].morphTargets[v]]=-1;for(let v in d){let x=[],g=[];for(let m=0;m!==f[p].morphTargets.length;++m){let M=f[p];x.push(M.time),g.push(M.morphTarget===v?1:0)}n.push(new xr(".morphTargetInfluence["+v+"]",x,g))}c=d.length*(s||1)}else{let d=".bones["+t[u].name+"]";i(yr,d+".position",f,"pos",n),i(rn,d+".quaternion",f,"rot",n),i(yr,d+".scale",f,"scl",n)}}return n.length===0?null:new this(r,c,n,o)}resetDuration(){let e=this.tracks,t=0;for(let i=0,n=e.length;i!==n;++i){let r=this.tracks[i];t=Math.max(t,r.times[r.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 Ew(a){switch(a.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return xr;case"vector":case"vector2":case"vector3":case"vector4":return yr;case"color":return ko;case"quaternion":return rn;case"bool":case"boolean":return Mi;case"string":return zi}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+a)}function Lw(a){if(a.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");let e=Ew(a.type);if(a.times===void 0){let t=[],i=[];rt.flattenJSON(a.keys,t,i,"value"),a.times=t,a.values=i}return e.parse!==void 0?e.parse(a):new e(a.name,a.times,a.values,a.interpolation)}var wr={enabled:!1,files:{},add:function(a,e){this.enabled!==!1&&(this.files[a]=e)},get:function(a){if(this.enabled!==!1)return this.files[a]},remove:function(a){delete this.files[a]},clear:function(){this.files={}}},nc=class{constructor(e,t,i){let n=this,r=!1,s=0,o=0,c,l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(h){o++,r===!1&&n.onStart!==void 0&&n.onStart(h,s,o),r=!0},this.itemEnd=function(h){s++,n.onProgress!==void 0&&n.onProgress(h,s,o),s===o&&(r=!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,u){return l.push(h,u),this},this.removeHandler=function(h){let u=l.indexOf(h);return u!==-1&&l.splice(u,2),this},this.getHandler=function(h){for(let u=0,f=l.length;u<f;u+=2){let d=l[u],p=l[u+1];if(d.global&&(d.lastIndex=0),d.test(h))return p}return null}}},Tw=new nc,K1=class{constructor(e){this.manager=e!==void 0?e:Tw,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){let i=this;return new Promise(function(n,r){i.load(e,n,t,r)})}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}},H2={},rc=class extends K1{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 r=wr.get(e);if(r!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(r),this.manager.itemEnd(e)},0),r;if(H2[e]!==void 0){H2[e].push({onLoad:t,onProgress:i,onError:n});return}H2[e]=[],H2[e].push({onLoad:t,onProgress:i,onError:n});let s=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,c=this.responseType;fetch(s).then(l=>{if(l.status===200||l.status===0){if(l.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||l.body.getReader===void 0)return l;let h=H2[e],u=l.body.getReader(),f=l.headers.get("Content-Length"),d=f?parseInt(f):0,p=d!==0,v=0,x=new ReadableStream({start(g){m();function m(){u.read().then(({done:M,value:y})=>{if(M)g.close();else{v+=y.byteLength;let b=new ProgressEvent("progress",{lengthComputable:p,loaded:v,total:d});for(let C=0,_=h.length;C<_;C++){let S=h[C];S.onProgress&&S.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,o));case"json":return l.json();default:if(o===void 0)return l.text();{let u=/charset="?([^;"\s]*)"?/i.exec(o),f=u&&u[1]?u[1].toLowerCase():void 0,d=new TextDecoder(f);return l.arrayBuffer().then(p=>d.decode(p))}}}).then(l=>{wr.add(e,l);let h=H2[e];delete H2[e];for(let u=0,f=h.length;u<f;u++){let d=h[u];d.onLoad&&d.onLoad(l)}}).catch(l=>{let h=H2[e];if(h===void 0)throw this.manager.itemError(e),l;delete H2[e];for(let u=0,f=h.length;u<f;u++){let d=h[u];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 Uo=class extends K1{constructor(e){super(e)}load(e,t,i,n){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let r=this,s=wr.get(e);if(s!==void 0)return r.manager.itemStart(e),setTimeout(function(){t&&t(s),r.manager.itemEnd(e)},0),s;let o=Es("img");function c(){h(),wr.add(e,this),t&&t(this),r.manager.itemEnd(e)}function l(u){h(),n&&n(u),r.manager.itemError(e),r.manager.itemEnd(e)}function h(){o.removeEventListener("load",c,!1),o.removeEventListener("error",l,!1)}return o.addEventListener("load",c,!1),o.addEventListener("error",l,!1),e.substr(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(e),o.src=e,o}},sc=class extends K1{constructor(e){super(e)}load(e,t,i,n){let r=new ur,s=new Uo(this.manager);s.setCrossOrigin(this.crossOrigin),s.setPath(this.path);let o=0;function c(l){s.load(e[l],function(h){r.images[l]=h,o++,o===6&&(r.needsUpdate=!0,t&&t(r))},void 0,n)}for(let l=0;l<e.length;++l)c(l);return r}};var ac=class extends K1{constructor(e){super(e)}load(e,t,i,n){let r=new St,s=new Uo(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(e,function(o){r.image=o,r.needsUpdate=!0,t!==void 0&&t(r)},i,n),r}},w1=class extends Ze{constructor(e,t=1){super(),this.type="Light",this.color=new we(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}};w1.prototype.isLight=!0;var oc=class extends w1{constructor(e,t,i){super(e,i),this.type="HemisphereLight",this.position.copy(Ze.DefaultUp),this.updateMatrix(),this.groundColor=new we(t)}copy(e){return w1.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}};oc.prototype.isHemisphereLight=!0;var cu=new _e,lu=new B,hu=new B,$s=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 _e,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new fr,this._frameExtents=new te(1,1),this._viewportCount=1,this._viewports=[new $e(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,i=this.matrix;lu.setFromMatrixPosition(e.matrixWorld),t.position.copy(lu),hu.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(hu),t.updateMatrixWorld(),cu.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(cu),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}},qo=class extends $s{constructor(){super(new Ht(50,1,.5,500)),this.focus=1}updateMatrices(e){let t=this.camera,i=b3*2*e.angle*this.focus,n=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;(i!==t.fov||n!==t.aspect||r!==t.far)&&(t.fov=i,t.aspect=n,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}};qo.prototype.isSpotLightShadow=!0;var Js=class extends w1{constructor(e,t,i=0,n=Math.PI/3,r=0,s=1){super(e,t),this.type="SpotLight",this.position.copy(Ze.DefaultUp),this.updateMatrix(),this.target=new Ze,this.distance=i,this.angle=n,this.penumbra=r,this.decay=s,this.shadow=new qo}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}};Js.prototype.isSpotLight=!0;var uu=new _e,xs=new B,d3=new B,Go=class extends $s{constructor(){super(new Ht(90,1,.5,500)),this._frameExtents=new te(4,2),this._viewportCount=6,this._viewports=[new $e(2,1,1,1),new $e(0,1,1,1),new $e(3,1,1,1),new $e(1,1,1,1),new $e(3,0,1,1),new $e(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,r=e.distance||i.far;r!==i.far&&(i.far=r,i.updateProjectionMatrix()),xs.setFromMatrixPosition(e.matrixWorld),i.position.copy(xs),d3.copy(i.position),d3.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(d3),i.updateMatrixWorld(),n.makeTranslation(-xs.x,-xs.y,-xs.z),uu.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(uu)}};Go.prototype.isPointLightShadow=!0;var cc=class extends w1{constructor(e,t,i=0,n=1){super(e,t),this.type="PointLight",this.distance=i,this.decay=n,this.shadow=new Go}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}};cc.prototype.isPointLight=!0;var Wo=class extends $s{constructor(){super(new Ns(-5,5,5,-5,.5,500))}};Wo.prototype.isDirectionalLightShadow=!0;var lc=class extends w1{constructor(e,t){super(e,t),this.type="DirectionalLight",this.position.copy(Ze.DefaultUp),this.updateMatrix(),this.target=new Ze,this.shadow=new Wo}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}};lc.prototype.isDirectionalLight=!0;var Qs=class extends w1{constructor(e,t){super(e,t),this.type="AmbientLight"}};Qs.prototype.isAmbientLight=!0;var hc=class extends w1{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}};hc.prototype.isRectAreaLight=!0;var jo=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,r=e.z,s=this.coefficients;return t.copy(s[0]).multiplyScalar(.282095),t.addScaledVector(s[1],.488603*n),t.addScaledVector(s[2],.488603*r),t.addScaledVector(s[3],.488603*i),t.addScaledVector(s[4],1.092548*(i*n)),t.addScaledVector(s[5],1.092548*(n*r)),t.addScaledVector(s[6],.315392*(3*r*r-1)),t.addScaledVector(s[7],1.092548*(i*r)),t.addScaledVector(s[8],.546274*(i*i-n*n)),t}getIrradianceAt(e,t){let i=e.x,n=e.y,r=e.z,s=this.coefficients;return t.copy(s[0]).multiplyScalar(.886227),t.addScaledVector(s[1],2*.511664*n),t.addScaledVector(s[2],2*.511664*r),t.addScaledVector(s[3],2*.511664*i),t.addScaledVector(s[4],2*.429043*i*n),t.addScaledVector(s[5],2*.429043*n*r),t.addScaledVector(s[6],.743125*r*r-.247708),t.addScaledVector(s[7],2*.429043*i*r),t.addScaledVector(s[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,r=e.z;t[0]=.282095,t[1]=.488603*n,t[2]=.488603*r,t[3]=.488603*i,t[4]=1.092548*i*n,t[5]=1.092548*n*r,t[6]=.315392*(3*r*r-1),t[7]=1.092548*i*r,t[8]=.546274*(i*i-n*n)}};jo.prototype.isSphericalHarmonics3=!0;var Ks=class extends w1{constructor(e=new jo,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}};Ks.prototype.isLightProbe=!0;var uc=class{static decodeText(e){if(typeof TextDecoder<"u")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)}},fc=class extends st{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}};fc.prototype.isInstancedBufferGeometry=!0;var dc=class extends K1{constructor(e){super(e),typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&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 r=this,s=wr.get(e);if(s!==void 0)return r.manager.itemStart(e),setTimeout(function(){t&&t(s),r.manager.itemEnd(e)},0),s;let o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader,fetch(e,o).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(c){wr.add(e,c),t&&t(c),r.manager.itemEnd(e)}).catch(function(c){n&&n(c),r.manager.itemError(e),r.manager.itemEnd(e)}),r.manager.itemStart(e)}};dc.prototype.isImageBitmapLoader=!0;var po,Dw={getContext:function(){return po===void 0&&(po=new(window.AudioContext||window.webkitAudioContext)),po},setContext:function(a){po=a}},pc=class extends K1{constructor(e){super(e)}load(e,t,i,n){let r=this,s=new rc(this.manager);s.setResponseType("arraybuffer"),s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,function(o){try{let c=o.slice(0);Dw.getContext().decodeAudioData(c,function(h){t(h)})}catch(c){n?n(c):console.error(c),r.manager.itemError(e)}},i,n)}},mc=class extends Ks{constructor(e,t,i=1){super(void 0,i);let n=new we().set(e),r=new we().set(t),s=new B(n.r,n.g,n.b),o=new B(r.r,r.g,r.b),c=Math.sqrt(Math.PI),l=c*Math.sqrt(.75);this.sh.coefficients[0].copy(s).add(o).multiplyScalar(c),this.sh.coefficients[1].copy(s).sub(o).multiplyScalar(l)}};mc.prototype.isHemisphereLightProbe=!0;var gc=class extends Ks{constructor(e,t=1){super(void 0,t);let i=new we().set(e);this.sh.coefficients[0].set(i.r,i.g,i.b).multiplyScalar(2*Math.sqrt(Math.PI))}};gc.prototype.isAmbientLightProbe=!0;var vc=class extends Ze{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 xc=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}},yc=class{constructor(e,t,i){this.binding=e,this.valueSize=i;let n,r,s;switch(t){case"quaternion":n=this._slerp,r=this._slerpAdditive,s=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(i*6),this._workIndex=5;break;case"string":case"bool":n=this._select,r=this._select,s=this._setAdditiveIdentityOther,this.buffer=new Array(i*5);break;default:n=this._lerp,r=this._lerpAdditive,s=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(i*5)}this._mixBufferRegion=n,this._mixBufferRegionAdditive=r,this._setIdentity=s,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,r=e*n+n,s=this.cumulativeWeight;if(s===0){for(let o=0;o!==n;++o)i[r+o]=i[o];s=t}else{s+=t;let o=t/s;this._mixBufferRegion(i,r,0,o,n)}this.cumulativeWeight=s}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,r=this.cumulativeWeight,s=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){let c=t*this._origIndex;this._mixBufferRegion(i,n,c,1-r,t)}s>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]){o.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 r=i,s=n;r!==s;++r)t[r]=t[n+r%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,r){if(n>=.5)for(let s=0;s!==r;++s)e[t+s]=e[i+s]}_slerp(e,t,i,n){kt.slerpFlat(e,t,e,t,e,i,n)}_slerpAdditive(e,t,i,n,r){let s=this._workIndex*r;kt.multiplyQuaternionsFlat(e,s,e,t,e,i),kt.slerpFlat(e,t,e,t,e,s,n)}_lerp(e,t,i,n,r){let s=1-n;for(let o=0;o!==r;++o){let c=t+o;e[c]=e[c]*s+e[i+o]*n}}_lerpAdditive(e,t,i,n,r){for(let s=0;s!==r;++s){let o=t+s;e[o]=e[o]+e[i+s]*n}}},Fc="\\[\\]\\.:\\/",Hw=new RegExp("["+Fc+"]","g"),Bc="[^"+Fc+"]",Vw="[^"+Fc.replace("\\.","")+"]",Rw=/((?:WC+[\/:])*)/.source.replace("WC",Bc),Nw=/(WCOD+)?/.source.replace("WCOD",Vw),Fw=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Bc),Bw=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Bc),Pw=new RegExp("^"+Rw+Nw+Fw+Bw+"$"),Iw=["material","materials","bones"],wc=class{constructor(e,t,i){let n=i||Je.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_,r=i.length;n!==r;++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()}},Je=class a{constructor(e,t,i){this.path=t,this.parsedPath=i||a.parseTrackName(t),this.node=a.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 a.Composite(e,t,i):new a(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Hw,"")}static parseTrackName(e){let t=Pw.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 r=i.nodeName.substring(n+1);Iw.indexOf(r)!==-1&&(i.nodeName=i.nodeName.substring(0,n),i.objectName=r)}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(r){for(let s=0;s<r.length;s++){let o=r[s];if(o.name===t||o.uuid===t)return o;let c=i(o.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,r=i.length;n!==r;++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,r=i.length;n!==r;++n)i[n]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++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,r=t.propertyIndex;if(e||(e=a.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 s=e[n];if(s===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 o=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?o=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(r!==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[r]!==void 0&&(r=e.morphTargetDictionary[r])}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=s,this.propertyIndex=r}else s.fromArray!==void 0&&s.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(c=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=n;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Je.Composite=wc;Je.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Je.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Je.prototype.GetterByBindingType=[Je.prototype._getValue_direct,Je.prototype._getValue_array,Je.prototype._getValue_arrayElement,Je.prototype._getValue_toArray];Je.prototype.SetterByBindingTypeAndVersioning=[[Je.prototype._setValue_direct,Je.prototype._setValue_direct_setNeedsUpdate,Je.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Je.prototype._setValue_array,Je.prototype._setValue_array_setNeedsUpdate,Je.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Je.prototype._setValue_arrayElement,Je.prototype._setValue_arrayElement_setNeedsUpdate,Je.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Je.prototype._setValue_fromArray,Je.prototype._setValue_fromArray_setNeedsUpdate,Je.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var bc=class{constructor(){this.uuid=F1(),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,r=this._bindings,s=r.length,o,c=e.length,l=this.nCachedObjects_;for(let h=0,u=arguments.length;h!==u;++h){let f=arguments[h],d=f.uuid,p=t[d];if(p===void 0){p=c++,t[d]=p,e.push(f);for(let v=0,x=s;v!==x;++v)r[v].push(new Je(f,i[v],n[v]))}else if(p<l){o=e[p];let v=--l,x=e[v];t[x.uuid]=p,e[p]=x,t[d]=v,e[v]=f;for(let g=0,m=s;g!==m;++g){let M=r[g],y=M[v],b=M[p];M[p]=y,b===void 0&&(b=new Je(f,i[g],n[g])),M[v]=b}}else e[p]!==o&&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,r=this.nCachedObjects_;for(let s=0,o=arguments.length;s!==o;++s){let c=arguments[s],l=c.uuid,h=t[l];if(h!==void 0&&h>=r){let u=r++,f=e[u];t[f.uuid]=h,e[h]=f,t[l]=u,e[u]=c;for(let d=0,p=n;d!==p;++d){let v=i[d],x=v[u],g=v[h];v[h]=x,v[u]=g}}}this.nCachedObjects_=r}uncache(){let e=this._objects,t=this._indicesByUUID,i=this._bindings,n=i.length,r=this.nCachedObjects_,s=e.length;for(let o=0,c=arguments.length;o!==c;++o){let l=arguments[o],h=l.uuid,u=t[h];if(u!==void 0)if(delete t[h],u<r){let f=--r,d=e[f],p=--s,v=e[p];t[d.uuid]=u,e[u]=d,t[v.uuid]=f,e[f]=v,e.pop();for(let x=0,g=n;x!==g;++x){let m=i[x],M=m[f],y=m[p];m[u]=M,m[f]=y,m.pop()}}else{let f=--s,d=e[f];f>0&&(t[d.uuid]=u),e[u]=d,e.pop();for(let p=0,v=n;p!==v;++p){let x=i[p];x[u]=x[f],x.pop()}}}this.nCachedObjects_=r}subscribe_(e,t){let i=this._bindingsIndicesByPath,n=i[e],r=this._bindings;if(n!==void 0)return r[n];let s=this._paths,o=this._parsedPaths,c=this._objects,l=c.length,h=this.nCachedObjects_,u=new Array(l);n=r.length,i[e]=n,s.push(e),o.push(t),r.push(u);for(let f=h,d=c.length;f!==d;++f){let p=c[f];u[f]=new Je(p,e,t)}return u}unsubscribe_(e){let t=this._bindingsIndicesByPath,i=t[e];if(i!==void 0){let n=this._paths,r=this._parsedPaths,s=this._bindings,o=s.length-1,c=s[o],l=e[o];t[l]=i,s[i]=c,s.pop(),r[i]=r[o],r.pop(),n[i]=n[o],n.pop()}}};bc.prototype.isAnimationObjectGroup=!0;var Mc=class{constructor(e,t,i=null,n=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=i,this.blendMode=n;let r=t.tracks,s=r.length,o=new Array(s),c={endingStart:er,endingEnd:er};for(let l=0;l!==s;++l){let h=r[l].createInterpolant(null);o[l]=h,h.settings=c}this._interpolantSettings=c,this._interpolants=o,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=pm,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,r=e._clip.duration,s=r/n,o=n/r;e.warp(1,s,t),this.warp(o,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,r=n.time,s=this.timeScale,o=this._timeScaleInterpolant;o===null&&(o=n._lendControlInterpolant(),this._timeScaleInterpolant=o);let c=o.parameterPositions,l=o.sampleValues;return c[0]=r,c[1]=r+i,l[0]=e/s,l[1]=t/s,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 r=this._startTime;if(r!==null){let c=(e-r)*i;if(c<0||i===0)return;this._startTime=null,t=i*c}t*=this._updateTimeScale(e);let s=this._updateTime(t),o=this._updateWeight(e);if(o>0){let c=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case yu:for(let h=0,u=c.length;h!==u;++h)c[h].evaluate(s),l[h].accumulateAdditive(o);break;case Vc:default:for(let h=0,u=c.length;h!==u;++h)c[h].evaluate(s),l[h].accumulate(n,o)}}}_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;if(i!==null){let n=i.evaluate(e)[0];t*=n,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,r=this._loopCount,s=i===mm;if(e===0)return r===-1?n:s&&(r&1)===1?t-n:n;if(i===dm){r===-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(r===-1&&(e>=0?(r=0,this._setEndings(!0,this.repetitions===0,s)):this._setEndings(this.repetitions===0,!0,s)),n>=t||n<0){let o=Math.floor(n/t);n-=t*o,r+=Math.abs(o);let c=this.repetitions-r;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,s)}else this._setEndings(!1,!1,s);this._loopCount=r,this.time=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=n;if(s&&(r&1)===1)return t-n}return n}_setEndings(e,t,i){let n=this._interpolantSettings;i?(n.endingStart=tr,n.endingEnd=tr):(e?n.endingStart=this.zeroSlopeAtStart?tr:er:n.endingStart=wo,t?n.endingEnd=this.zeroSlopeAtEnd?tr:er:n.endingEnd=wo)}_scheduleFading(e,t,i){let n=this._mixer,r=n.time,s=this._weightInterpolant;s===null&&(s=n._lendControlInterpolant(),this._weightInterpolant=s);let o=s.parameterPositions,c=s.sampleValues;return o[0]=r,c[0]=t,o[1]=r+e,c[1]=i,this}},zc=class extends V2{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,r=n.length,s=e._propertyBindings,o=e._interpolants,c=i.uuid,l=this._bindingsByRootAndName,h=l[c];h===void 0&&(h={},l[c]=h);for(let u=0;u!==r;++u){let f=n[u],d=f.name,p=h[d];if(p!==void 0)++p.referenceCount,s[u]=p;else{if(p=s[u],p!==void 0){p._cacheIndex===null&&(++p.referenceCount,this._addInactiveBinding(p,c,d));continue}let v=t&&t._propertyBindings[u].binding.parsedPath;p=new yc(Je.create(i,d,v),f.ValueTypeName,f.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,c,d),s[u]=p}o[u].resultBuffer=p.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){let i=(e._localRoot||this._root).uuid,n=e._clip.uuid,r=this._actionsByClip[n];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,i)}let t=e._propertyBindings;for(let i=0,n=t.length;i!==n;++i){let r=t[i];r.useCount++===0&&(this._lendBinding(r),r.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 r=t[i];--r.useCount===0&&(r.restoreOriginalState(),this._takeBackBinding(r))}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,r=this._actionsByClip,s=r[t];if(s===void 0)s={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=s;else{let o=s.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=n.length,n.push(e),s.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 r=e._clip.uuid,s=this._actionsByClip,o=s[r],c=o.knownActions,l=c[c.length-1],h=e._byClipCacheIndex;l._byClipCacheIndex=h,c[h]=l,c.pop(),e._byClipCacheIndex=null;let u=o.actionByRoot,f=(e._localRoot||this._root).uuid;delete u[f],c.length===0&&delete s[r],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){let t=e._propertyBindings;for(let i=0,n=t.length;i!==n;++i){let r=t[i];--r.referenceCount===0&&this._removeInactiveBinding(r)}}_lendAction(e){let t=this._actions,i=e._cacheIndex,n=this._nActiveActions++,r=t[n];e._cacheIndex=n,t[n]=e,r._cacheIndex=i,t[i]=r}_takeBackAction(e){let t=this._actions,i=e._cacheIndex,n=--this._nActiveActions,r=t[n];e._cacheIndex=n,t[n]=e,r._cacheIndex=i,t[i]=r}_addInactiveBinding(e,t,i){let n=this._bindingsByRootAndName,r=this._bindings,s=n[t];s===void 0&&(s={},n[t]=s),s[i]=e,e._cacheIndex=r.length,r.push(e)}_removeInactiveBinding(e){let t=this._bindings,i=e.binding,n=i.rootNode.uuid,r=i.path,s=this._bindingsByRootAndName,o=s[n],c=t[t.length-1],l=e._cacheIndex;c._cacheIndex=l,t[l]=c,t.pop(),delete o[r],Object.keys(o).length===0&&delete s[n]}_lendBinding(e){let t=this._bindings,i=e._cacheIndex,n=this._nActiveBindings++,r=t[n];e._cacheIndex=n,t[n]=e,r._cacheIndex=i,t[i]=r}_takeBackBinding(e){let t=this._bindings,i=e._cacheIndex,n=--this._nActiveBindings,r=t[n];e._cacheIndex=n,t[n]=e,r._cacheIndex=i,t[i]=r}_lendControlInterpolant(){let e=this._controlInterpolants,t=this._nActiveControlInterpolants++,i=e[t];return i===void 0&&(i=new Io(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,r=t[n];e.__cacheIndex=n,t[n]=e,r.__cacheIndex=i,t[i]=r}clipAction(e,t,i){let n=t||this._root,r=n.uuid,s=typeof e=="string"?Oo.findByName(n,e):e,o=s!==null?s.uuid:e,c=this._actionsByClip[o],l=null;if(i===void 0&&(s!==null?i=s.blendMode:i=Vc),c!==void 0){let u=c.actionByRoot[r];if(u!==void 0&&u.blendMode===i)return u;l=c.knownActions[0],s===null&&(s=l._clip)}if(s===null)return null;let h=new Mc(this,s,t,i);return this._bindAction(h,l),this._addInactiveAction(h,o,r),h}existingAction(e,t){let i=t||this._root,n=i.uuid,r=typeof e=="string"?Oo.findByName(i,e):e,s=r?r.uuid:e,o=this._actionsByClip[s];return o!==void 0&&o.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,r=Math.sign(e),s=this._accuIndex^=1;for(let l=0;l!==i;++l)t[l]._update(n,e,r,s);let o=this._bindings,c=this._nActiveBindings;for(let l=0;l!==c;++l)o[l].apply(s);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,r=n[i];if(r!==void 0){let s=r.knownActions;for(let o=0,c=s.length;o!==c;++o){let l=s[o];this._deactivateAction(l);let h=l._cacheIndex,u=t[t.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,u._cacheIndex=h,t[h]=u,t.pop(),this._removeInactiveBindingsForAction(l)}delete n[i]}}uncacheRoot(e){let t=e.uuid,i=this._actionsByClip;for(let s in i){let o=i[s].actionByRoot,c=o[t];c!==void 0&&(this._deactivateAction(c),this._removeInactiveAction(c))}let n=this._bindingsByRootAndName,r=n[t];if(r!==void 0)for(let s in r){let o=r[s];o.restoreOriginalState(),this._removeInactiveBinding(o)}}uncacheAction(e,t){let i=this.existingAction(e,t);i!==null&&(this._deactivateAction(i),this._removeInactiveAction(i))}};zc.prototype._controlInterpolantsResultBuffer=new Float32Array(1);var Cc=class a{constructor(e){typeof e=="string"&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}clone(){return new a(this.value.clone===void 0?this.value:this.value.clone())}},Ac=class extends en{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}};Ac.prototype.isInstancedInterleavedBuffer=!0;var Sc=class{constructor(e,t,i,n,r){this.buffer=e,this.type=t,this.itemSize=i,this.elementSize=n,this.count=r,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}};Sc.prototype.isGLBufferAttribute=!0;var fu=new te,sn=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=fu.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 fu.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)}};sn.prototype.isBox2=!0;var du=new B,mo=new B,_c=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){du.subVectors(e,this.start),mo.subVectors(this.end,this.start);let i=mo.dot(mo),r=mo.dot(du)/i;return t&&(r=Kt(r,0,1)),r}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 ui=new B,go=new _e,p3=new _e,Ec=class extends Os{constructor(e){let t=Pu(e),i=new st,n=[],r=[],s=new we(0,0,1),o=new we(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),r.push(s.r,s.g,s.b),r.push(o.r,o.g,o.b))}i.setAttribute("position",new vt(n,3)),i.setAttribute("color",new vt(r,3));let c=new tn({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");p3.copy(this.root.matrixWorld).invert();for(let r=0,s=0;r<t.length;r++){let o=t[r];o.parent&&o.parent.isBone&&(go.multiplyMatrices(p3,o.matrixWorld),ui.setFromMatrixPosition(go),n.setXYZ(s,ui.x,ui.y,ui.z),go.multiplyMatrices(p3,o.parent.matrixWorld),ui.setFromMatrixPosition(go),n.setXYZ(s+1,ui.x,ui.y,ui.z),s+=2)}i.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}};function Pu(a){let e=[];a&&a.isBone&&e.push(a);for(let t=0;t<a.children.length;t++)e.push.apply(e,Pu(a.children[t]));return e}var Lc=class extends Os{constructor(e=10,t=10,i=4473924,n=8947848){i=new we(i),n=new we(n);let r=t/2,s=e/t,o=e/2,c=[],l=[];for(let f=0,d=0,p=-o;f<=t;f++,p+=s){c.push(-o,0,p,o,0,p),c.push(p,0,-o,p,0,o);let v=f===r?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 st;h.setAttribute("position",new vt(c,3)),h.setAttribute("color",new vt(l,3));let u=new tn({vertexColors:!0,toneMapped:!1});super(h,u),this.type="GridHelper"}};var kw=new Float32Array(1),DT=new Int32Array(kw.buffer);t1.create=function(a,e){return console.log("THREE.Curve.create() has been deprecated"),a.prototype=Object.create(t1.prototype),a.prototype.constructor=a,a.prototype.getPoint=e,a};Ws.prototype.fromPoints=function(a){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(a)};Lc.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")};Ec.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};K1.prototype.extractUrlBase=function(a){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),uc.extractUrlBase(a)};K1.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.")}};sn.prototype.center=function(a){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(a)};sn.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()};sn.prototype.isIntersectionBox=function(a){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(a)};sn.prototype.size=function(a){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(a)};h1.prototype.center=function(a){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(a)};h1.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()};h1.prototype.isIntersectionBox=function(a){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(a)};h1.prototype.isIntersectionSphere=function(a){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(a)};h1.prototype.size=function(a){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(a)};yi.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()};fr.prototype.setFromMatrix=function(a){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(a)};_c.prototype.center=function(a){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(a)};At.prototype.flattenToArrayOffset=function(a,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(a,e)};At.prototype.multiplyVector3=function(a){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),a.applyMatrix3(this)};At.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")};At.prototype.applyToBufferAttribute=function(a){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),a.applyMatrix3(this)};At.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")};At.prototype.getInverse=function(a){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(a).invert()};_e.prototype.extractPosition=function(a){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(a)};_e.prototype.flattenToArrayOffset=function(a,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(a,e)};_e.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),new B().setFromMatrixColumn(this,3)};_e.prototype.setRotationFromQuaternion=function(a){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(a)};_e.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")};_e.prototype.multiplyVector3=function(a){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),a.applyMatrix4(this)};_e.prototype.multiplyVector4=function(a){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),a.applyMatrix4(this)};_e.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")};_e.prototype.rotateAxis=function(a){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),a.transformDirection(this)};_e.prototype.crossVector=function(a){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),a.applyMatrix4(this)};_e.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")};_e.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")};_e.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")};_e.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")};_e.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")};_e.prototype.applyToBufferAttribute=function(a){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),a.applyMatrix4(this)};_e.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")};_e.prototype.makeFrustum=function(a,e,t,i,n,r){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(a,e,i,t,n,r)};_e.prototype.getInverse=function(a){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(a).invert()};N1.prototype.isIntersectionLine=function(a){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(a)};kt.prototype.multiplyVector3=function(a){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),a.applyQuaternion(this)};kt.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()};wi.prototype.isIntersectionBox=function(a){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(a)};wi.prototype.isIntersectionPlane=function(a){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(a)};wi.prototype.isIntersectionSphere=function(a){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(a)};Ot.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()};Ot.prototype.barycoordFromPoint=function(a,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(a,e)};Ot.prototype.midpoint=function(a){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(a)};Ot.prototypenormal=function(a){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(a)};Ot.prototype.plane=function(a){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(a)};Ot.barycoordFromPoint=function(a,e,t,i,n){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Ot.getBarycoord(a,e,t,i,n)};Ot.normal=function(a,e,t,i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Ot.getNormal(a,e,t,i)};nn.prototype.extractAllPoints=function(a){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(a)};nn.prototype.extrude=function(a){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new vr(this,a)};nn.prototype.makeGeometry=function(a){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new j3(this,a)};te.prototype.fromAttribute=function(a,e,t){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(a,e,t)};te.prototype.distanceToManhattan=function(a){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(a)};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(a){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(a)};B.prototype.getScaleFromMatrix=function(a){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(a)};B.prototype.getColumnFromMatrix=function(a,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,a)};B.prototype.applyProjection=function(a){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(a)};B.prototype.fromAttribute=function(a,e,t){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(a,e,t)};B.prototype.distanceToManhattan=function(a){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(a)};B.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};$e.prototype.fromAttribute=function(a,e,t){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(a,e,t)};$e.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};Ze.prototype.getChildByName=function(a){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(a)};Ze.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")};Ze.prototype.translate=function(a,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,a)};Ze.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")};Ze.prototype.applyMatrix=function(a){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(a)};Object.defineProperties(Ze.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(a){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=a}},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.")}}});Vt.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(Vt.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),gm},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.")}}});Ho.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")};Ht.prototype.setLens=function(a,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),e!==void 0&&(this.filmGauge=e),this.setFocalLength(a)};Object.defineProperties(w1.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(a){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=a}},shadowCameraLeft:{set:function(a){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=a}},shadowCameraRight:{set:function(a){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=a}},shadowCameraTop:{set:function(a){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=a}},shadowCameraBottom:{set:function(a){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=a}},shadowCameraNear:{set:function(a){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=a}},shadowCameraFar:{set:function(a){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=a}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(a){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=a}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(a){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=a}},shadowMapHeight:{set:function(a){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=a}}});Object.defineProperties(mt.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===bo},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(bo)}}});mt.prototype.setDynamic=function(a){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(a===!0?bo:_s),this};mt.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},mt.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};st.prototype.addIndex=function(a){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(a)};st.prototype.addAttribute=function(a,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(a,new mt(arguments[1],arguments[2]))):a==="index"?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(a,e)};st.prototype.addDrawCall=function(a,e,t){t!==void 0&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(a,e)};st.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()};st.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")};st.prototype.removeAttribute=function(a){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(a)};st.prototype.applyMatrix=function(a){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(a)};Object.defineProperties(st.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}}});en.prototype.setDynamic=function(a){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(a===!0?bo:_s),this};en.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};vr.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")};vr.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")};vr.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")};pr.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")};Cc.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this};Object.defineProperties(xt.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 we}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(a){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=a===mu}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(a){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=a}},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(N2.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(a){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=a}}});Xe.prototype.clearTarget=function(a,e,t,i){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(a),this.clear(e,t,i)};Xe.prototype.animate=function(a){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(a)};Xe.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()};Xe.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()};Xe.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision};Xe.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()};Xe.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")};Xe.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")};Xe.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")};Xe.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")};Xe.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")};Xe.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")};Xe.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures};Xe.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")};Xe.prototype.enableScissorTest=function(a){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(a)};Xe.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};Xe.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")};Xe.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")};Xe.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")};Xe.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")};Xe.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")};Xe.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")};Xe.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")};Xe.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")};Xe.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()};Object.defineProperties(Xe.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=a}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=a}},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(a){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=a===!0?nt:xi}},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(Hu.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(e1.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(a){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=a}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(a){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=a}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(a){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=a}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(a){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=a}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(a){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=a}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(a){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=a}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(a){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=a}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(a){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=a}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(a){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=a}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(a){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=a}}});vc.prototype.load=function(a){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");let e=this;return new pc().load(a,function(i){e.setBuffer(i)}),this};xc.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()};Vs.prototype.updateCubeMap=function(a,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(a,e)};Vs.prototype.clear=function(a,e,t,i){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(a,e,t,i)};R2.crossOrigin=void 0;R2.loadTexture=function(a,e,t,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");let n=new ac;n.setCrossOrigin(this.crossOrigin);let r=n.load(a,t,void 0,i);return e&&(r.mapping=e),r};R2.loadTextureCube=function(a,e,t,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");let n=new sc;n.setCrossOrigin(this.crossOrigin);let r=n.load(a,t,void 0,i);return e&&(r.mapping=e),r};R2.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")};R2.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Tc}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Tc);var Qo=class{constructor(){this.resources=new Map}isTracking(e){return this.resources.has(e)}#e(e,t){if(Array.isArray(e))e.forEach(i=>{(this.resources.get(t)??[]).push(i),this.#e(i,t)});else{let i=this.resources.get(t??e)??[];this.resources.set(t??e,i)}}track(e){if("dispose"in e&&this.#e(e),e instanceof Ze&&this.#e(e),"geometry"in e&&this.#e(e.geometry,e),"material"in e&&this.#e(e.material,e),"children"in e&&this.#e(e.children,e),e instanceof xt)for(let t of Object.values(e))t instanceof St&&this.#e(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)}};var ia=class a extends an.Component{constructor(t){super();this.data=t;this.event=new an.Events;this.tracker=new Qo;this.container=createDiv("renderer-container");this.#e=new Set;this.shadows=!0;this.iterations=0;this.frame_rate=1/60;this.loaded=!1;this.#t=!1;this.#i=new WeakMap;this.factory=new Ic(this.WIDTH,this.HEIGHT,{diceColor:this.data.diceColor,textColor:this.data.textColor,colorfulDice:this.data.colorfulDice,scaler:this.data.scaler,textFont:this.data.textFont});this.colors={ambient:16777215,spotlight:16777215};this.display={currentWidth:null,currentHeight:null,containerWidth:null,containerHeight:null,aspect:null,scale:null};this.cameraHeight={max:null,close:null,medium:null,far:null};this.#n=new WeakMap;this.extraFrames=a.DEFAULT_EXTRA_FRAMES;this.renderer=new Xe({alpha:!0,antialias:!0})}#e;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}#t;setData(t){this.data=t,this.factory.width=this.WIDTH,this.factory.height=this.HEIGHT,this.factory.updateDice(this.data)}getDiceForRoller(t){return this.factory.getDiceForRoller(t,this.getVector())}#i;async addDice(t){return new Promise(i=>{this.#t||this.start();for(let n of t)n.recreate(this.getVector(),this.WIDTH,this.HEIGHT),this.scene.add(this.tracker.track(n.geometry)),this.world.add(n);this.#e.add(t),this.#i.set(t,()=>{i()})})}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=Dc,this.container.appendChild(this.renderer.domElement),document.body.appendChild(this.container),this.renderer.setClearColor(0,0),this.scene=new pr,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(),[...this.#e.values()].flat().forEach(t=>{this.world.world.removeBody(t.body)}),this.#e=new Set}start(){this.#t&&this.unload(),this.loaded||this.load(),this.#t=!0,this.extraFrames=a.DEFAULT_EXTRA_FRAMES,this.render()}static{this.DEFAULT_EXTRA_FRAMES=30}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(t){this.display.currentWidth=this.container.clientWidth/2,this.display.currentHeight=this.container.clientHeight/2,t?(this.display.containerWidth=t.w,this.display.containerHeight=t.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.data),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 Ht(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 t=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 Js(this.colors.spotlight,.25),this.light.position.set(-t/2,t/2,t*3),this.light.target.position.set(0,0,0),this.light.distance=t*5,this.light.angle=Math.PI/4,this.light.castShadow=this.shadows,this.light.shadow.camera.near=t/10,this.light.shadow.camera.far=t*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 Qs(16777215,.9),this.scene.add(this.tracker.track(this.ambientLight))}initDesk(){this.desk&&this.scene.remove(this.desk);let t=new Ys;t.opacity=.5,this.desk=new Vt(new Rs(this.display.containerWidth*6,this.display.containerHeight*6,1,1),t),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 Pc(this.WIDTH,this.HEIGHT),this.iterations=0}finishRender(){this.event.trigger("throw-finished")}#n;static{this.Threshold=5}throwFinished(){let t=!0;for(let i of this.#e){let n=!0;for(let r of i){if(r.iterations>10/this.frame_rate&&(r.stopped=!0),r.stopped===!0)continue;let s=r.body.angularVelocity,o=r.body.velocity;if(Math.abs(s.length())<a.Threshold&&Math.abs(o.length())<a.Threshold){if(this.iterations-r.iterations>5){r.stopped=!0;continue}n=!1,t=!1}else r.iterations++,r.stopped=!1,n=!1,t=!1}n&&this.#i.has(i)&&(this.#i.get(i)(),this.#i.delete(i))}return t}unrender(){this.container.style.opacity="0",cancelAnimationFrame(this.animation),this.registerInterval(window.setTimeout(()=>{this.stop()},1e3))}stop(){if(this.#t)for(let t of[...this.#e]){this.#i.has(t)&&(this.#i.get(t)(),this.#i.delete(t));for(let i of t)i.stopped=!0}this.#t=!1,this.unload()}resizeRendererToDisplaySize(){let t=this.renderer.domElement,i=window.devicePixelRatio,n=t.clientWidth*i|0,r=t.clientHeight*i|0,s=t.width!==n||t.height!==r;return s&&this.renderer.setSize(n,r,!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 i=function(){t.unload(),document.body.removeEventListener("click",i)},t=this;this.registerDomEvent(document.body,"click",i)}}catch(t){this.event.trigger("error",t)}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++,[...this.#e.values()].forEach(t=>t.forEach(i=>i.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(...t){t.forEach(i=>{i.children&&this.dispose(...i.children),i.clear()})}},Pc=class{constructor(e,t){this.WIDTH=e;this.HEIGHT=t;this.world=new Xa({gravity:new z(0,0,-9.82*200)});this.ground=this.getPlane();this.diceMaterial=new W2;this.deskMaterial=new W2;this.barrierMaterial=new W2;this.world.broadphase=new Yr,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 G2(this.deskMaterial,this.diceMaterial,{friction:.01,restitution:.5,contactEquationRelaxation:3,contactEquationStiffness:1e8})),this.world.addContactMaterial(new G2(this.barrierMaterial,this.diceMaterial,{friction:.01,restitution:1,contactEquationRelaxation:3,contactEquationStiffness:1e8})),this.world.addContactMaterial(new G2(this.diceMaterial,this.diceMaterial,{friction:.1,restitution:.5,contactEquationRelaxation:3,contactEquationStiffness:1e8})),this.world.addBody(new Te({allowSleep:!1,mass:0,shape:new v2,material:this.deskMaterial}));let e=new Te({allowSleep:!1,mass:0,shape:new v2,material:this.barrierMaterial});e.quaternion.setFromAxisAngle(new z(1,0,0),Math.PI/2),e.position.set(0,this.HEIGHT*.93,0),this.world.addBody(e),e=new Te({allowSleep:!1,mass:0,shape:new v2,material:this.barrierMaterial}),e.quaternion.setFromAxisAngle(new z(1,0,0),-Math.PI/2),e.position.set(0,-this.HEIGHT*.93,0),this.world.addBody(e),e=new Te({allowSleep:!1,mass:0,shape:new v2,material:this.barrierMaterial}),e.quaternion.setFromAxisAngle(new z(0,1,0),-Math.PI/2),e.position.set(this.WIDTH*.93,0,0),this.world.addBody(e),e=new Te({allowSleep:!1,mass:0,shape:new v2,material:this.barrierMaterial}),e.quaternion.setFromAxisAngle(new z(0,1,0),Math.PI/2),e.position.set(-this.WIDTH*.93,0,0),this.world.addBody(e)}getPlane(){return new Te({type:Te.STATIC,shape:new v2})}},Ic=class extends an.Component{constructor(t,i,n){super();this.width=t;this.height=i;this.options=n;this.dice={};this.updateDice=(0,an.debounce)(t=>{this.options={...t},this.dispose(),this.buildDice()},200);this.buildDice()}get colors(){let t=this.options.diceColor,i=this.options.textColor,n=this.options.textFont;if(!this.options.colorfulDice)return{diceColor:t,textFont:n}}onunload(){this.dispose()}disposeChildren(...t){t.forEach(i=>{"dispose"in i&&i.dispose(),i.children&&this.disposeChildren(...i.children)})}dispose(){for(let t of Object.values(this.dice))this.disposeChildren(t.geometry.children)}getDiceForRoller(t,i){let n=[];switch(t.faces.max){case 4:{n.push(new ls(this.width,this.height,this.clone("d4"),i));break}case 1:case 6:{n.push(new Vn(this.width,this.height,t.fudge?this.clone("fudge"):this.clone("d6"),i));break}case 8:{n.push(new cs(this.width,this.height,this.clone("d8"),i));break}case 10:{n.push(new S2(this.width,this.height,this.clone("d10"),i));break}case 12:{n.push(new os(this.width,this.height,this.clone("d12"),i));break}case 20:{n.push(new as(this.width,this.height,this.clone("d20"),i));break}case 100:{n.push(new S2(this.width,this.height,this.clone("d100"),i,!0),new S2(this.width,this.height,this.clone("d10"),i,!0));break}}return n}cloneDice(t,i){switch(t.sides){case 4:return[new ls(this.width,this.height,this.clone("d4"),i)];case 1:return[new Vn(this.width,this.height,this.clone("fudge"),i)];case 6:return[new Vn(this.width,this.height,this.clone("d6"),i)];case 8:return[new cs(this.width,this.height,this.clone("d8"),i)];case 10:return[new S2(this.width,this.height,this.clone("d10"),i)];case 12:return[new os(this.width,this.height,this.clone("d12"),i)];case 20:return[new as(this.width,this.height,this.clone("d20"),i)];case 100:return[new S2(this.width,this.height,this.clone("d100"),i,!0),new S2(this.width,this.height,this.clone("d10"),i,!0)]}}getDice(t,i){let n=new Map;for(let r of t.dynamic){let s=this.getDiceForRoller(r,i);s.length&&n.set(r,s)}return n}clone(t){if(!(t in this.dice))throw new Error("That dice type does not exist!");return this.dice[t].clone()}buildDice(){this.dice.d100=new z4(this.width,this.height,this.colors,this.options.scaler).create(),this.dice.d20=new w4(this.width,this.height,this.colors,this.options.scaler).create(),this.dice.d12=new b4(this.width,this.height,this.colors,this.options.scaler).create(),this.dice.d10=new M4(this.width,this.height,this.colors,this.options.scaler).create(),this.dice.d8=new C4(this.width,this.height,this.colors,this.options.scaler).create(),this.dice.d6=new A4(this.width,this.height,this.colors,this.options.scaler).create(),this.dice.d4=new _4(this.width,this.height,this.colors,this.options.scaler).create(),this.dice.fudge=new S4(this.width,this.height,this.colors,this.options.scaler).create(),this.dice.boost=new N4(this.width,this.height,this.colors,this.options.scaler).create(),this.dice.ability=new H4(this.width,this.height,this.colors,this.options.scaler).create(),this.dice.difficulty=new V4(this.width,this.height,this.colors,this.options.scaler).create(),this.dice.challenge=new T4(this.width,this.height,this.colors,this.options.scaler).create(),this.dice.proficiency=new L4(this.width,this.height,this.colors,this.options.scaler).create(),this.dice.setback=new F4(this.width,this.height,this.colors,this.options.scaler).create()}};var Ou=oa(ku());var e0=class{constructor(e){this.table=e}parse(e){let t=e.length,i=this.table,n=[],r=[],s=0;for(;s<t;){let o=e[s++];switch(o.value){case"(":r.unshift(o);break;case")":for(e[s]&&e[s].type=="dice"&&/^d/.test(e[s].value)&&(e[s].parenedDice=!0);r.length&&(o=r.shift(),o.value!=="(");)n.push(o);if(o.value!=="(")throw new Error("Mismatched parentheses.");break;default:if(i.hasOwnProperty(o.value)){for(;r.length;){let c=r[0];if(c.value==="(")break;let l=i[o.value],h=l.precedence,u=i[c.value].precedence;if(h>u||h===u&&l.associativity==="right")break;n.push(r.shift())}r.unshift(o)}else n.push(o)}}for(;r.length;){let o=r.shift();if(o.value!=="(")n.push(o);else throw new Error("Mismatched parentheses.")}return n}};var Ow=/(?:\d+[Dd])?#(?:[\p{Letter}\p{Emoji_Presentation}\w/-]+)(?:\|(?:[+-]))?(?:\|(?:[^+-]+))?/u,Uw=/(?:\d+[Dd]?)?dv\((?:.+)\)(?:\|(?:[+-]))?(?:\|(?:[^+-]+))?/u,qw=/(?:.*)?(?:\[.*\]\(|\[\[)(?:.+?)#?\^(?:.+?)(?:\)|\]\])\|?(?:.+)?/u,Gw=/(?:\d+[Dd])?(?:\[.*\]\(|\[\[)(?:.+)(?:\)|\]\])\|?(?:.+)?/u,Ww=/(?:\d+[Dd])?(?:\[.*\]\(|\[\[)(?:.+)(?:\)|\]\])\|line/u,jw=/[\(\^\+\-\*\/\)]/u,Zw=/(?:\d+|\b)[Dd](?:%|F|-?\d+|\[\d+(?:[ \t]*,[ \t]*\d+)+\]|\b)/u,Xw=/(?:=|=!|<|>|<=|>=|=<|=>|-=|=-)(?:\d+(?:[Dd](?:%|F|-?\d+|\[\d+(?:[ \t]*,[ \t]*\d+)+\]|\b))?)/u,na=class{constructor(e,t){this.defaultRoll=e;this.defaultFace=t;this.lexer=Ou.compile({WS:[{match:/[ \t]+/u},{match:/[{}]+/u}],table:qw,line:Ww,section:Gw,tag:Ow,dataview:Uw,condition:Xw,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:Zw,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:jw});this.inline=new Map;let i={precedence:3,associativity:"right"},n={precedence:2,associativity:"left"},r={precedence:1,associativity:"left"};this.parser=new e0({"+":r,"-":r,"*":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(c=>c.type!="WS");let t=c=>c.type==="+"||c.type==="math"&&c.value==="+",i=c=>c.type==="-"||c.type==="math"&&c.value==="-",n=c=>t(c)||i(c),r=c=>c[c.length-1],s=(c,l)=>c.splice(c.length-1,1,l);e=e.reduce((c,l)=>{if(c.length==0)c.push(l);else{let h=r(c);n(h)&&n(l)?i(h)!=i(l)?i(h)||s(c,l):i(h)&&(h.type=h.type==="math"?h.type:"+",h.value="+"):c.push(l)}return c},[]);let o=[];for(let c of e)if(c.type=="condition"&&o.length>0){let l=o[o.length-1];l.conditions||(l.conditions=[]);let[h,u,f]=c.value.match(/(?<operator>=|=!|<|>|<=|>=|=<|=>|-=|=-)(?<comparer>\d+(?:[Dd](?:%|F|-?\d+|\[\d+(?:[ \t]*,[ \t]*\d+)+\]|\b))?)/)??[],d=this.parse(f);l.conditions.push({operator:u,comparer:f,lexemes:d,value:c.value})}else o.push(c);return o}};var e2=require("@codemirror/view"),Uu=require("@codemirror/language"),zr=require("obsidian");function Yw(a,e,t){for(let i of a.ranges)if(i.from<=t&&i.to>=e)return!0;return!1}function $w(a,e){let t=this.app.workspace.getActiveFile();if(!t)return;let i=[],n=a.state.selection,r=new RegExp(".*?_?inline-code_?.*");for(let{from:s,to:o}of a.visibleRanges)(0,Uu.syntaxTree)(a.state).iterate({from:s,to:o,enter:({node:c})=>{let l=c.type;if(l.name.includes("formatting")||!r.test(l.name))return;let h=c.from,u=c.to;if(Yw(n,h,u))return;let f=a.state.doc.sliceString(h,u).trim(),d=xa(e.data.diceModTemplateFolders,t);if(/^dice\-mod:\s*([\s\S]+)\s*?/.test(f)&&!d&&e.data.replaceDiceModInLivePreview){let[,g]=f.match(/dice\-mod:\s*([\s\S]+)\s*?/),m=app.workspace.getActiveFile(),M=e.getRollerSync(g,m.path),y=e.data.displayFormulaForMod;g.includes("|noform")&&(y=!1),g.includes("|form")&&(y=!0),M.roll().then(async()=>{let b=await M.getReplacer(),C=y?`${M.inlineText} **${b}**`:`${b}`;e.data.escapeDiceMod&&C.replace(/([\*\[\]])/g,"\\$1");let _={from:h-1,to:u+1,insert:C},S=a.state.update({changes:_});a.dispatch(S)});return}if(!/^dice(?:\+|\-|\-mod)?:\s*([\s\S]+)\s*?/.test(f))return;let[,p]=f.match(/^dice(?:\+|\-|\-mod)?:\s*([\s\S]+)\s*?/),v=e.getRollerSync(p,t.path),x=new kc(f,v,a,e,t);e.addToFileMap(t,v),i.push(e2.Decoration.replace({widget:x,inclusive:!1,block:!1}).range(h-1,u+1))}});return e2.Decoration.set(i,!0)}var kc=class extends e2.WidgetType{constructor(t,i,n,r,s){super();this.rawQuery=t;this.roller=i;this.view=n;this.plugin=r;this.file=s}eq(t){return t.rawQuery===this.rawQuery?!0:(this.plugin.fileMap.get(this.file)?.remove(t.roller),!1)}toDOM(t){return this.roller.roll(),this.roller.containerEl}ignoreEvent(t){if(t.type==="mousedown"){let i=this.view.posAtCoords({x:t.x,y:t.y});if(t.shiftKey){if(i){let{editor:n}=this.view.state.field(zr.editorEditorField).state.field(zr.editorViewField);n.setCursor(n.offsetToPos(i))}return!1}}return!0}};function qu(a){return e2.ViewPlugin.fromClass(class{constructor(e){this.decorations=e2.Decoration.none}update(e){if(!e.state.field(zr.editorLivePreviewField)){this.decorations=e2.Decoration.none;return}(e.docChanged||e.viewportChanged||e.selectionSet)&&(this.decorations=$w(e.view,a)??e2.Decoration.none)}},{decorations:e=>e.decorations})}var Jw=Function.prototype.toString,Oc=Object.create,Qw=Object.prototype.toString,Kw=function(){function a(){this._keys=[],this._values=[]}return a.prototype.has=function(e){return!!~this._keys.indexOf(e)},a.prototype.get=function(e){return this._values[this._keys.indexOf(e)]},a.prototype.set=function(e,t){this._keys.push(e),this._values.push(t)},a}();function eb(){return new Kw}function tb(){return new WeakMap}var ib=typeof WeakMap<"u"?tb:eb;function qc(a){if(!a)return Oc(null);var e=a.constructor;if(e===Object)return a===Object.prototype?{}:Oc(a);if(~Jw.call(e).indexOf("[native code]"))try{return new e}catch{}return Oc(a)}function nb(a){var e="";return a.global&&(e+="g"),a.ignoreCase&&(e+="i"),a.multiline&&(e+="m"),a.unicode&&(e+="u"),a.sticky&&(e+="y"),e}function rb(a){return a.flags}var sb=/test/g.flags==="g"?rb:nb;function Gu(a){var e=Qw.call(a);return e.substring(8,e.length-1)}function ab(a){return a[Symbol.toStringTag]||Gu(a)}var ob=typeof Symbol<"u"?ab:Gu,cb=Object.defineProperty,lb=Object.getOwnPropertyDescriptor,Wu=Object.getOwnPropertyNames,Gc=Object.getOwnPropertySymbols,ju=Object.prototype,Zu=ju.hasOwnProperty,hb=ju.propertyIsEnumerable,Xu=typeof Gc=="function";function ub(a){return Wu(a).concat(Gc(a))}var fb=Xu?ub:Wu;function i0(a,e,t){for(var i=fb(a),n=0,r=i.length,s=void 0,o=void 0;n<r;++n)if(s=i[n],!(s==="callee"||s==="caller")){if(o=lb(a,s),!o){e[s]=t.copier(a[s],t);continue}!o.get&&!o.set&&(o.value=t.copier(o.value,t));try{cb(e,s,o)}catch{e[s]=o.value}}return e}function db(a,e){var t=new e.Constructor;e.cache.set(a,t);for(var i=0,n=a.length;i<n;++i)t[i]=e.copier(a[i],e);return t}function pb(a,e){var t=new e.Constructor;return e.cache.set(a,t),i0(a,t,e)}function Yu(a,e){return a.slice(0)}function mb(a,e){return a.slice(0,a.size,a.type)}function gb(a,e){return new e.Constructor(Yu(a.buffer))}function vb(a,e){return new e.Constructor(a.getTime())}function $u(a,e){var t=new e.Constructor;return e.cache.set(a,t),a.forEach(function(i,n){t.set(n,e.copier(i,e))}),t}function xb(a,e){return i0(a,$u(a,e),e)}function yb(a,e){var t=qc(e.prototype);e.cache.set(a,t);for(var i in a)Zu.call(a,i)&&(t[i]=e.copier(a[i],e));return t}function wb(a,e){var t=qc(e.prototype);e.cache.set(a,t);for(var i in a)Zu.call(a,i)&&(t[i]=e.copier(a[i],e));for(var n=Gc(a),r=0,s=n.length,o=void 0;r<s;++r)o=n[r],hb.call(a,o)&&(t[o]=e.copier(a[o],e));return t}var bb=Xu?wb:yb;function Mb(a,e){var t=qc(e.prototype);return e.cache.set(a,t),i0(a,t,e)}function Uc(a,e){return new e.Constructor(a.valueOf())}function zb(a,e){var t=new e.Constructor(a.source,sb(a));return t.lastIndex=a.lastIndex,t}function t0(a,e){return a}function Ju(a,e){var t=new e.Constructor;return e.cache.set(a,t),a.forEach(function(i){t.add(e.copier(i,e))}),t}function Cb(a,e){return i0(a,Ju(a,e),e)}var Ab=Array.isArray,Wc=Object.assign,Sb=Object.getPrototypeOf||function(a){return a.__proto__},Qu={array:db,arrayBuffer:Yu,blob:mb,dataView:gb,date:vb,error:t0,map:$u,object:bb,regExp:zb,set:Ju},_b=Wc({},Qu,{array:pb,map:xb,object:Mb,set:Cb});function Eb(a){return{Arguments:a.object,Array:a.array,ArrayBuffer:a.arrayBuffer,Blob:a.blob,Boolean:Uc,DataView:a.dataView,Date:a.date,Error:a.error,Float32Array:a.arrayBuffer,Float64Array:a.arrayBuffer,Int8Array:a.arrayBuffer,Int16Array:a.arrayBuffer,Int32Array:a.arrayBuffer,Map:a.map,Number:Uc,Object:a.object,Promise:t0,RegExp:a.regExp,Set:a.set,String:Uc,WeakMap:t0,WeakSet:t0,Uint8Array:a.arrayBuffer,Uint8ClampedArray:a.arrayBuffer,Uint16Array:a.arrayBuffer,Uint32Array:a.arrayBuffer,Uint64Array:a.arrayBuffer}}function Ku(a){var e=Wc({},Qu,a),t=Eb(e),i=t.Array,n=t.Object;function r(s,o){if(o.prototype=o.Constructor=void 0,!s||typeof s!="object")return s;if(o.cache.has(s))return o.cache.get(s);if(o.prototype=Sb(s),o.Constructor=o.prototype&&o.prototype.constructor,!o.Constructor||o.Constructor===Object)return n(s,o);if(Ab(s))return i(s,o);var c=t[ob(s)];return c?c(s,o):typeof s.then=="function"?s:n(s,o)}return function(o){return r(o,{Constructor:void 0,cache:ib(),copier:r,prototype:void 0})}}function Lb(a){return Ku(Wc({},_b,a))}var sD=Lb({}),e7=Ku({});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 Fa={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",textFont:"Arial",showLeafOnStartup:!0,showDice:!0,displayAsEmbed:!0,round:"None",initialDisplay:"Roll",icons:e7(B8),showRenderNotice:!0,diceModTemplateFolders:{},replaceDiceModInLivePreview:!0},n0=class extends ft.Plugin{constructor(){super(...arguments);this.api=new u2(this);this.fileMap=new Map;this.inline=new Map;this.operators={"+":(t,i)=>t+i,"-":(t,i)=>t-i,"*":(t,i)=>t*i,"/":(t,i)=>t/i,"^":(t,i)=>Math.pow(t,i)};this.persistingFiles=new Set;this.existingDice=new WeakSet}getRendererData(){return{diceColor:this.data.diceColor,textColor:this.data.textColor,colorfulDice:this.data.colorfulDice,scaler:this.data.scaler,renderTime:this.data.renderTime,textFont:this.data.textFont}}async onload(){console.log("DiceRoller plugin loaded"),this.data=Object.assign({},Fa,await this.loadData()),this.renderer=new ia(this.getRendererData()),this.parser=new na(this.data.defaultRoll,this.data.defaultFace),this.addSettingTab(new qr(this.app,this)),this.registerView(Fi,n=>new xn(this,n)),this.registerEvent(this.app.workspace.on("dice-roller:render-dice",async n=>{let r=await this.getRoller(n,"external");if(!(r instanceof Gt)){new ft.Notice("The Dice View only supports dice rolls.");return}if(await r.roll(),!r.dice.length){new ft.Notice("Invalid formula.");return}try{this.renderRoll(r)}catch(s){new ft.Notice("There was an error rendering the roll."),console.error(s)}this.app.workspace.trigger("dice-roller:rendered-result",r.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:n=>{let r=this.app.workspace.getActiveViewOfType(ft.MarkdownView);if(r&&(r.getMode()==="preview"||r.editor.cm.state.field(ft.editorLivePreviewField))&&this.fileMap.has(r.file))return n||this.fileMap.get(r.file).forEach(o=>{o instanceof Dr&&o.roll()}),!0}});let t=g0(Yc).html[0];(0,ft.addIcon)(M1,t);let i=g0($c).html[0];(0,ft.addIcon)(U1,i),this.registerMarkdownPostProcessor(this.postprocessor.bind(this)),this.registerEditorExtension([qu(this)]),this.app.workspace.onLayoutReady(async()=>{this.addDiceView(!0),await this.registerDataviewInlineFields()}),this.app.workspace.trigger("dice-roller:loaded")}addToFileMap(t,i){this.fileMap.has(t)||this.fileMap.set(t,[]),this.fileMap.set(t,[...this.fileMap.get(t),i])}async postprocessor(t,i){let n=t.querySelectorAll("code");if(!n.length)return;let r=i.sourcePath,s=i.getSectionInfo(t),o=i.getSectionInfo(t)?.lineStart,c=this.app.vault.getAbstractFileByPath(i.sourcePath);if((!c||!(c instanceof ft.TFile))&&r!="STATBLOCK_RENDERER")return;let l={},h,u=!1,f=[];for(let d=0;d<n.length;d++){let p=n.item(d);if(c&&c instanceof ft.TFile&&/^dice\-mod:\s*([\s\S]+)\s*?/.test(p.innerText)&&s){if(xa(this.data.diceModTemplateFolders,c))continue;try{u||(h=(await this.app.vault.cachedRead(c)).split(`
`),u=!0);let[v,x]=p.innerText.match(/^dice\-mod:\s*([\s\S]+)\s*?/),g=this.data.displayFormulaForMod;x.includes("|noform")&&(g=!1),x.includes("|form")&&(g=!0),x=x.replace("|noform","").replace("|form","");let m=await this.getRoller(x,i.sourcePath);m instanceof Gt&&(m.shouldRender&&(m.hasRunOnce=!0),m.on("new-result",()=>{this.data.addToView&&this.view?.addResult(m)})),f.push(new Promise((M,y)=>{m.on("new-result",async()=>{let b=h.slice(s.lineStart,s.lineEnd+1),C=await m.getReplacer();if(!C){new ft.Notice("Dice Roller: There was an issue modifying the file.");return}let _=g?`${m.inlineText} ${C}`:`${C}`;this.data.escapeDiceMod?b=b.join(`
`).replace(`\`${v}\``,_.replace(/([\*\[\]])/g,"\\$1")).split(`
`):b=b.join(`
`).replace(`\`${v}\``,_).split(`
`),h.splice(s.lineStart,s.lineEnd-s.lineStart+1,...b),M()})})),await m.roll();continue}catch(v){console.error(v)}}if(/^dice(?:\+|\-|\-mod)?:\s*([\s\S]+)\s*?/.test(p.innerText))try{let[,v]=p.innerText.match(/^dice(?:\+|\-|\-mod)?:\s*([\s\S]+)\s*?/),x=await this.getRoller(v,i.sourcePath),g=this.data.results?.[r]?.[o]?.[d]??null;(this.data.persistResults&&!/dice\-/.test(p.innerText)||/dice\+/.test(p.innerText))&&(this.persistingFiles.add(i.sourcePath),l[d]=x,x.save=!0);let m=this.data.renderAllDice;v.includes("|render")&&(m=!0),v.includes("|norender")&&(m=!1);let M=async()=>{await x.roll(),x.save&&g&&await x.applyResult(g),x instanceof Gt&&(x.shouldRender=m,x.on("new-result",()=>{this.data.addToView&&this.view?.addResult(x)})),p.replaceWith(x.containerEl)};if(x.loaded?await M():x.on("loaded",async()=>{await M()}),!c||!(c instanceof ft.TFile))continue;this.addToFileMap(c,x);let y=this.app.workspace.getActiveViewOfType(ft.MarkdownView);if(y&&this.fileMap.has(c)&&this.fileMap.get(c).length===1){let b=this,C=v0(y,{onUnloadFile:function(_){return async function(S){return S==c&&(b.fileMap.delete(c),C()),await _.call(this,S)}}});y.register(C),y.register(()=>this.fileMap.delete(c))}}catch(v){console.error(v),new ft.Notice(`There was an error parsing the dice string: ${p.innerText}.
${v}`,5e3);continue}}if(!(!c||!(c instanceof ft.TFile))&&(u&&f.length&&(await Promise.all(f),sleep(500),await this.app.vault.modify(c,h.join(`
`))),r in this.data.results&&(this.data.results[r][o]={}),Object.entries(l).length)){let d=this.app.workspace.getActiveViewOfType(ft.MarkdownView);if(d){let p=this,v=v0(d,{onUnloadFile:function(x){return async function(g){if(g=c){p.persistingFiles.has(r)&&(p.persistingFiles.delete(r),p.data.results[r]={});for(let m in l){let M=l[m],y=i.getSectionInfo(t)?.lineStart;if(y==null)continue;let b={[y]:{...p.data.results[r]?.[y]??{},[m]:M.toResult()}};p.data.results[r]={...p.data.results[r]??{},...b},await p.saveSettings()}}return v(),await x.call(this,g)}}});d.register(v),d.register(async()=>{this.persistingFiles.has(r)&&(this.persistingFiles.delete(r),this.data.results[r]={});for(let x in l){let g=l[x],m=i.getSectionInfo(t)?.lineStart;if(m==null)continue;let M={[m]:{...this.data.results[r]?.[m]??{},[x]:g.toResult()}};this.data.results[r]={...this.data.results[r]??{},...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,t7.getAPI)()}async dataviewReady(){return new Promise(t=>{this.canUseDataview||t(!1),this.dataview.api&&t(!0),this.registerEvent(this.app.metadataCache.on("dataview:api-ready",()=>{t(!0)}))})}get view(){let t=this.app.workspace.getLeavesOfType(Fi),i=t.length?t[0]:null;if(i&&i.view&&i.view instanceof xn)return i.view}async getArrayRoller(t,i=1){let n=new wa(this,t,i);return await n.roll(),n}async addDiceView(t=!1){t&&!this.data.showLeafOnStartup||this.app.workspace.getLeavesOfType(Fi).length||await this.app.workspace.getRightLeaf(!1).setViewState({type:Fi})}async registerDataviewInlineFields(){if(!this.canUseDataview)return;await this.dataviewReady(),this.dataview.index.pages.forEach(({fields:i})=>{for(let[n,r]of i)typeof r!="number"||Number.isNaN(r)||r==null||this.inline.set(n,r)}),this.parser.setInlineFields(this.inline),this.registerEvent(this.app.metadataCache.on("dataview:metadata-change",(i,n)=>{if(i==="update"){let r=this.dataview.api.page(n.path);if(!r)return;for(let s in r){let o=r[s];typeof o!="number"||Number.isNaN(o)||o==null||this.inline.set(s,o)}this.parser.setInlineFields(this.inline)}}))}async renderRoll(t){await t.roll(!0)}async parseDice(t,i){let n=await this.getRoller(t,i);return{result:await n.roll(),roller:n}}parseDiceSync(t,i){let n=this.getRollerSync(t,i);if(n instanceof Gt)return{result:n.result,roller:n}}clearEmpties(t){for(var i in t)!t[i]||typeof t[i]!="object"||(this.clearEmpties(t[i]),Object.keys(t[i]).length===0&&delete t[i])}async saveSettings(){this.clearEmpties(this.data.results),await this.saveData(this.data)}get dataview_regex(){let t=Array.from(this.inline.keys());return t.length?new RegExp(`(${t.join("|")})`,"g"):null}getParametersForRoller(t,i){t=t.replace(/\\\|/g,"|");let n=i?.showDice??!0,r=i?.shouldRender??this.data.renderAllDice,s=i?.showFormula??this.data.displayResultsInline,o=i?.showParens??this.data.displayFormulaAfter,c=i?.expectedValue??this.data.initialDisplay,l=i?.text??"",h=i?.round??this.data.round,u=i?.signed??this.data.signed,f=/\|text\((.*)\)/;if(t.includes("|nodice")&&(n=!1),t.includes("|render")&&(r=!0),t.includes("|norender")&&(r=!1),t.includes("|form")&&(s=!0),t.includes("|noform")&&(s=!1),t.includes("|avg")&&(c="Average"),t.includes("|none")&&(c="None"),t.includes("|text(")){let[,d]=t.match(f)??[null,""];l=d}return t.includes("|paren")&&(o=!0),t.includes("|noparen")&&(o=!1),t.includes("|round")&&(h="Normal"),t.includes("|noround")&&(h="None"),t.includes("|ceil")&&(h="Up"),t.includes("|floor")&&(h="Down"),t.includes("|signed")&&(u=!0),t=(0,i7.decode)(t.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,"")),t in this.data.formulas&&(t=this.data.formulas[t]),{content:t,showDice:n,showParens:o,showFormula:s,expectedValue:c,shouldRender:r,text:l,round:h,signed:u}}async getRoller(t,i="",n=u2.RollerOptions(this)){let{content:r,showDice:s,showParens:o,showFormula:c,expectedValue:l,round:h,shouldRender:u,text:f,signed:d}=this.getParametersForRoller(t,n),p=this.parse(r);switch(this.getTypeFromLexemes(p)){case"dice":{let x=new Gt(this,r,p,this.renderer,s,f,l,o,h,d);return x.showFormula=c,x.shouldRender=u,x.showRenderNotice=this.data.showRenderNotice,this.existingDice.add(x),x}case"table":{let x=new Vr(this,r,p[0],i,s);return await x.init,x}case"section":return new Si(this,r,p[0],i,s);case"dataview":{if(!this.canUseDataview)throw new Error("Tags are only supported with the Dataview plugin installed.");return new Nr(this,r,p[0],i,s)}case"tag":{if(!this.canUseDataview)throw new Error("Tags are only supported with the Dataview plugin installed.");return new Fr(this,r,p[0],i,s)}case"line":return new Rr(this,r,p[0],i,s)}}getRollerSync(t,i,n=u2.RollerOptions(this)){let{content:r,showDice:s,showParens:o,showFormula:c,expectedValue:l,shouldRender:h,text:u,round:f,signed:d}=this.getParametersForRoller(t,n),p=this.parse(r);switch(this.getTypeFromLexemes(p)){case"dice":{let x=new Gt(this,r,p,this.renderer,s,u,l,o,f,d);return x.shouldRender=h,x.showFormula=c,x.showRenderNotice=this.data.showRenderNotice,this.existingDice.add(x),x}case"table":{let x=new Vr(this,r,p[0],i,s);return x.init,x}case"section":return new Si(this,r,p[0],i,s);case"dataview":{if(!this.canUseDataview)throw new Error("Tags are only supported with the Dataview plugin installed.");return new Nr(this,r,p[0],i,s)}case"tag":{if(!this.canUseDataview)throw new Error("Tags are only supported with the Dataview plugin installed.");return new Fr(this,r,p[0],i,s)}case"line":return new Rr(this,r,p[0],i,s)}}getTypeFromLexemes(t){return t.some(({type:i})=>i==="table")?"table":t.some(({type:i})=>i==="section")?"section":t.some(({type:i})=>i==="dataview")?"dataview":t.some(({type:i})=>i==="tag")?"tag":t.some(({type:i})=>i==="link")?"link":t.some(({type:i})=>i==="line")?"line":"dice"}onunload(){console.log("DiceRoller unloaded"),this.app.workspace.getLeavesOfType(Fi).forEach(t=>t.detach()),"__THREE__"in window&&delete window.__THREE__,this.renderer.unload(),this.app.workspace.trigger("dice-roller:unload")}parse(t){return this.parser.parse(t)}};
/*! Bundled license information:
he/he.js:
(*! https://mths.be/he v1.2.0 by @mathias | MIT license *)
@fortawesome/free-solid-svg-icons/index.es.js:
(*!
* 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)
*)
@fortawesome/free-regular-svg-icons/index.es.js:
(*!
* 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)
*)
@fortawesome/fontawesome-svg-core/index.es.js:
(*!
* 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)
*)
three/build/three.module.js:
(**
* @license
* Copyright 2010-2022 Three.js Authors
* SPDX-License-Identifier: MIT
*)
*/