aframe-master.min.js 1.3 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831
  1. (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.AFRAME = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(_dereq_,module,exports){
  2. function anArray(r){return r.BYTES_PER_ELEMENT&&"[object ArrayBuffer]"===str.call(r.buffer)||Array.isArray(r)}var str=Object.prototype.toString;module.exports=anArray;
  3. },{}],2:[function(_dereq_,module,exports){
  4. module.exports=function(e,n){return"number"==typeof e?e:"number"==typeof n?n:0};
  5. },{}],3:[function(_dereq_,module,exports){
  6. "use strict";function getLens(o){var r=o.length;if(r%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=o.indexOf("=");return-1===e&&(e=r),[e,e===r?0:4-e%4]}function byteLength(o){var r=getLens(o),e=r[0],t=r[1];return 3*(e+t)/4-t}function _byteLength(o,r,e){return 3*(r+e)/4-e}function toByteArray(o){for(var r,e=getLens(o),t=e[0],n=e[1],u=new Arr(_byteLength(o,t,n)),p=0,a=n>0?t-4:t,h=0;h<a;h+=4)r=revLookup[o.charCodeAt(h)]<<18|revLookup[o.charCodeAt(h+1)]<<12|revLookup[o.charCodeAt(h+2)]<<6|revLookup[o.charCodeAt(h+3)],u[p++]=r>>16&255,u[p++]=r>>8&255,u[p++]=255&r;return 2===n&&(r=revLookup[o.charCodeAt(h)]<<2|revLookup[o.charCodeAt(h+1)]>>4,u[p++]=255&r),1===n&&(r=revLookup[o.charCodeAt(h)]<<10|revLookup[o.charCodeAt(h+1)]<<4|revLookup[o.charCodeAt(h+2)]>>2,u[p++]=r>>8&255,u[p++]=255&r),u}function tripletToBase64(o){return lookup[o>>18&63]+lookup[o>>12&63]+lookup[o>>6&63]+lookup[63&o]}function encodeChunk(o,r,e){for(var t,n=[],u=r;u<e;u+=3)t=(o[u]<<16&16711680)+(o[u+1]<<8&65280)+(255&o[u+2]),n.push(tripletToBase64(t));return n.join("")}function fromByteArray(o){for(var r,e=o.length,t=e%3,n=[],u=0,p=e-t;u<p;u+=16383)n.push(encodeChunk(o,u,u+16383>p?p:u+16383));return 1===t?(r=o[e-1],n.push(lookup[r>>2]+lookup[r<<4&63]+"==")):2===t&&(r=(o[e-2]<<8)+o[e-1],n.push(lookup[r>>10]+lookup[r>>4&63]+lookup[r<<2&63]+"=")),n.join("")}exports.byteLength=byteLength,exports.toByteArray=toByteArray,exports.fromByteArray=fromByteArray;for(var lookup=[],revLookup=[],Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,len=code.length;i<len;++i)lookup[i]=code[i],revLookup[code.charCodeAt(i)]=i;revLookup["-".charCodeAt(0)]=62,revLookup["_".charCodeAt(0)]=63;
  7. },{}],4:[function(_dereq_,module,exports){
  8. "use strict";module.exports={createLink:function(e,t){var a=document.head||document.getElementsByTagName("head")[0],n=document.createElement("link");n.href=e,n.rel="stylesheet";for(var d in t)if(t.hasOwnProperty(d)){var r=t[d];n.setAttribute("data-"+d,r)}a.appendChild(n)},createStyle:function(e,t){var a=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css";for(var d in t)if(t.hasOwnProperty(d)){var r=t[d];n.setAttribute("data-"+d,r)}n.sheet?(n.innerHTML=e,n.sheet.cssText=e,a.appendChild(n)):n.styleSheet?(a.appendChild(n),n.styleSheet.cssText=e):(n.appendChild(document.createTextNode(e)),a.appendChild(n))}};
  9. },{}],5:[function(_dereq_,module,exports){
  10. var Buffer=_dereq_("buffer").Buffer;module.exports=function(f,e){if(Buffer.isBuffer(f)&&Buffer.isBuffer(e)){if("function"==typeof f.equals)return f.equals(e);if(f.length!==e.length)return!1;for(var r=0;r<f.length;r++)if(f[r]!==e[r])return!1;return!0}};
  11. },{"buffer":6}],6:[function(_dereq_,module,exports){
  12. (function (global,Buffer){
  13. "use strict";function typedArraySupport(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}function kMaxLength(){return Buffer.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function createBuffer(t,e){if(kMaxLength()<e)throw new RangeError("Invalid typed array length");return Buffer.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=Buffer.prototype):(null===t&&(t=new Buffer(e)),t.length=e),t}function Buffer(t,e,r){if(!(Buffer.TYPED_ARRAY_SUPPORT||this instanceof Buffer))return new Buffer(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return allocUnsafe(this,t)}return from(this,t,e,r)}function from(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?fromArrayBuffer(t,e,r,n):"string"==typeof e?fromString(t,e,r):fromObject(t,e)}function assertSize(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function alloc(t,e,r,n){return assertSize(e),e<=0?createBuffer(t,e):void 0!==r?"string"==typeof n?createBuffer(t,e).fill(r,n):createBuffer(t,e).fill(r):createBuffer(t,e)}function allocUnsafe(t,e){if(assertSize(e),t=createBuffer(t,e<0?0:0|checked(e)),!Buffer.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function fromString(t,e,r){if("string"==typeof r&&""!==r||(r="utf8"),!Buffer.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|byteLength(e,r);t=createBuffer(t,n);var f=t.write(e,r);return f!==n&&(t=t.slice(0,f)),t}function fromArrayLike(t,e){var r=e.length<0?0:0|checked(e.length);t=createBuffer(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function fromArrayBuffer(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");return e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n),Buffer.TYPED_ARRAY_SUPPORT?(t=e,t.__proto__=Buffer.prototype):t=fromArrayLike(t,e),t}function fromObject(t,e){if(Buffer.isBuffer(e)){var r=0|checked(e.length);return t=createBuffer(t,r),0===t.length?t:(e.copy(t,0,0,r),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||isnan(e.length)?createBuffer(t,0):fromArrayLike(t,e);if("Buffer"===e.type&&isArray(e.data))return fromArrayLike(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function checked(t){if(t>=kMaxLength())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength().toString(16)+" bytes");return 0|t}function SlowBuffer(t){return+t!=t&&(t=0),Buffer.alloc(+t)}function byteLength(t,e){if(Buffer.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return utf8ToBytes(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return base64ToBytes(t).length;default:if(n)return utf8ToBytes(t).length;e=(""+e).toLowerCase(),n=!0}}function slowToString(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,e>>>=0,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return hexSlice(this,e,r);case"utf8":case"utf-8":return utf8Slice(this,e,r);case"ascii":return asciiSlice(this,e,r);case"latin1":case"binary":return latin1Slice(this,e,r);case"base64":return base64Slice(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function swap(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function bidirectionalIndexOf(t,e,r,n,f){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=f?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(f)return-1;r=t.length-1}else if(r<0){if(!f)return-1;r=0}if("string"==typeof e&&(e=Buffer.from(e,n)),Buffer.isBuffer(e))return 0===e.length?-1:arrayIndexOf(t,e,r,n,f);if("number"==typeof e)return e&=255,Buffer.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?f?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):arrayIndexOf(t,[e],r,n,f);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(t,e,r,n,f){function i(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}var o=1,u=t.length,s=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;o=2,u/=2,s/=2,r/=2}var a;if(f){var h=-1;for(a=r;a<u;a++)if(i(t,a)===i(e,-1===h?0:a-h)){if(-1===h&&(h=a),a-h+1===s)return h*o}else-1!==h&&(a-=a-h),h=-1}else for(r+s>u&&(r=u-s),a=r;a>=0;a--){for(var c=!0,l=0;l<s;l++)if(i(t,a+l)!==i(e,l)){c=!1;break}if(c)return a}return-1}function hexWrite(t,e,r,n){r=Number(r)||0;var f=t.length-r;n?(n=Number(n))>f&&(n=f):n=f;var i=e.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var o=0;o<n;++o){var u=parseInt(e.substr(2*o,2),16);if(isNaN(u))return o;t[r+o]=u}return o}function utf8Write(t,e,r,n){return blitBuffer(utf8ToBytes(e,t.length-r),t,r,n)}function asciiWrite(t,e,r,n){return blitBuffer(asciiToBytes(e),t,r,n)}function latin1Write(t,e,r,n){return asciiWrite(t,e,r,n)}function base64Write(t,e,r,n){return blitBuffer(base64ToBytes(e),t,r,n)}function ucs2Write(t,e,r,n){return blitBuffer(utf16leToBytes(e,t.length-r),t,r,n)}function base64Slice(t,e,r){return 0===e&&r===t.length?base64.fromByteArray(t):base64.fromByteArray(t.slice(e,r))}function utf8Slice(t,e,r){r=Math.min(t.length,r);for(var n=[],f=e;f<r;){var i=t[f],o=null,u=i>239?4:i>223?3:i>191?2:1;if(f+u<=r){var s,a,h,c;switch(u){case 1:i<128&&(o=i);break;case 2:s=t[f+1],128==(192&s)&&(c=(31&i)<<6|63&s)>127&&(o=c);break;case 3:s=t[f+1],a=t[f+2],128==(192&s)&&128==(192&a)&&(c=(15&i)<<12|(63&s)<<6|63&a)>2047&&(c<55296||c>57343)&&(o=c);break;case 4:s=t[f+1],a=t[f+2],h=t[f+3],128==(192&s)&&128==(192&a)&&128==(192&h)&&(c=(15&i)<<18|(63&s)<<12|(63&a)<<6|63&h)>65535&&c<1114112&&(o=c)}}null===o?(o=65533,u=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),f+=u}return decodeCodePointsArray(n)}function decodeCodePointsArray(t){var e=t.length;if(e<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=MAX_ARGUMENTS_LENGTH));return r}function asciiSlice(t,e,r){var n="";r=Math.min(t.length,r);for(var f=e;f<r;++f)n+=String.fromCharCode(127&t[f]);return n}function latin1Slice(t,e,r){var n="";r=Math.min(t.length,r);for(var f=e;f<r;++f)n+=String.fromCharCode(t[f]);return n}function hexSlice(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var f="",i=e;i<r;++i)f+=toHex(t[i]);return f}function utf16leSlice(t,e,r){for(var n=t.slice(e,r),f="",i=0;i<n.length;i+=2)f+=String.fromCharCode(n[i]+256*n[i+1]);return f}function checkOffset(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function checkInt(t,e,r,n,f,i){if(!Buffer.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>f||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function objectWriteUInt16(t,e,r,n){e<0&&(e=65535+e+1);for(var f=0,i=Math.min(t.length-r,2);f<i;++f)t[r+f]=(e&255<<8*(n?f:1-f))>>>8*(n?f:1-f)}function objectWriteUInt32(t,e,r,n){e<0&&(e=4294967295+e+1);for(var f=0,i=Math.min(t.length-r,4);f<i;++f)t[r+f]=e>>>8*(n?f:3-f)&255}function checkIEEE754(t,e,r,n,f,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function writeFloat(t,e,r,n,f){return f||checkIEEE754(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),ieee754.write(t,e,r,n,23,4),r+4}function writeDouble(t,e,r,n,f){return f||checkIEEE754(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),ieee754.write(t,e,r,n,52,8),r+8}function base64clean(t){if(t=stringtrim(t).replace(INVALID_BASE64_RE,""),t.length<2)return"";for(;t.length%4!=0;)t+="=";return t}function stringtrim(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function toHex(t){return t<16?"0"+t.toString(16):t.toString(16)}function utf8ToBytes(t,e){e=e||1/0;for(var r,n=t.length,f=null,i=[],o=0;o<n;++o){if((r=t.charCodeAt(o))>55295&&r<57344){if(!f){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&i.push(239,191,189);continue}f=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),f=r;continue}r=65536+(f-55296<<10|r-56320)}else f&&(e-=3)>-1&&i.push(239,191,189);if(f=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function asciiToBytes(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}function utf16leToBytes(t,e){for(var r,n,f,i=[],o=0;o<t.length&&!((e-=2)<0);++o)r=t.charCodeAt(o),n=r>>8,f=r%256,i.push(f),i.push(n);return i}function base64ToBytes(t){return base64.toByteArray(base64clean(t))}function blitBuffer(t,e,r,n){for(var f=0;f<n&&!(f+r>=e.length||f>=t.length);++f)e[f+r]=t[f];return f}function isnan(t){return t!==t}var base64=_dereq_("base64-js"),ieee754=_dereq_("ieee754"),isArray=_dereq_("isarray");exports.Buffer=Buffer,exports.SlowBuffer=SlowBuffer,exports.INSPECT_MAX_BYTES=50,Buffer.TYPED_ARRAY_SUPPORT=void 0!==global.TYPED_ARRAY_SUPPORT?global.TYPED_ARRAY_SUPPORT:typedArraySupport(),exports.kMaxLength=kMaxLength(),Buffer.poolSize=8192,Buffer._augment=function(t){return t.__proto__=Buffer.prototype,t},Buffer.from=function(t,e,r){return from(null,t,e,r)},Buffer.TYPED_ARRAY_SUPPORT&&(Buffer.prototype.__proto__=Uint8Array.prototype,Buffer.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Buffer[Symbol.species]===Buffer&&Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:!0})),Buffer.alloc=function(t,e,r){return alloc(null,t,e,r)},Buffer.allocUnsafe=function(t){return allocUnsafe(null,t)},Buffer.allocUnsafeSlow=function(t){return allocUnsafe(null,t)},Buffer.isBuffer=function(t){return!(null==t||!t._isBuffer)},Buffer.compare=function(t,e){if(!Buffer.isBuffer(t)||!Buffer.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,f=0,i=Math.min(r,n);f<i;++f)if(t[f]!==e[f]){r=t[f],n=e[f];break}return r<n?-1:n<r?1:0},Buffer.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Buffer.concat=function(t,e){if(!isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return Buffer.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=Buffer.allocUnsafe(e),f=0;for(r=0;r<t.length;++r){var i=t[r];if(!Buffer.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,f),f+=i.length}return n},Buffer.byteLength=byteLength,Buffer.prototype._isBuffer=!0,Buffer.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)swap(this,e,e+1);return this},Buffer.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)swap(this,e,e+3),swap(this,e+1,e+2);return this},Buffer.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)swap(this,e,e+7),swap(this,e+1,e+6),swap(this,e+2,e+5),swap(this,e+3,e+4);return this},Buffer.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?utf8Slice(this,0,t):slowToString.apply(this,arguments)},Buffer.prototype.equals=function(t){if(!Buffer.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===Buffer.compare(this,t)},Buffer.prototype.inspect=function(){var t="",e=exports.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),"<Buffer "+t+">"},Buffer.prototype.compare=function(t,e,r,n,f){if(!Buffer.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===f&&(f=this.length),e<0||r>t.length||n<0||f>this.length)throw new RangeError("out of range index");if(n>=f&&e>=r)return 0;if(n>=f)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,f>>>=0,this===t)return 0;for(var i=f-n,o=r-e,u=Math.min(i,o),s=this.slice(n,f),a=t.slice(e,r),h=0;h<u;++h)if(s[h]!==a[h]){i=s[h],o=a[h];break}return i<o?-1:o<i?1:0},Buffer.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},Buffer.prototype.indexOf=function(t,e,r){return bidirectionalIndexOf(this,t,e,r,!0)},Buffer.prototype.lastIndexOf=function(t,e,r){return bidirectionalIndexOf(this,t,e,r,!1)},Buffer.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var f=this.length-e;if((void 0===r||r>f)&&(r=f),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return hexWrite(this,t,e,r);case"utf8":case"utf-8":return utf8Write(this,t,e,r);case"ascii":return asciiWrite(this,t,e,r);case"latin1":case"binary":return latin1Write(this,t,e,r);case"base64":return base64Write(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var MAX_ARGUMENTS_LENGTH=4096;Buffer.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var n;if(Buffer.TYPED_ARRAY_SUPPORT)n=this.subarray(t,e),n.__proto__=Buffer.prototype;else{var f=e-t;n=new Buffer(f,void 0);for(var i=0;i<f;++i)n[i]=this[i+t]}return n},Buffer.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||checkOffset(t,e,this.length);for(var n=this[t],f=1,i=0;++i<e&&(f*=256);)n+=this[t+i]*f;return n},Buffer.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||checkOffset(t,e,this.length);for(var n=this[t+--e],f=1;e>0&&(f*=256);)n+=this[t+--e]*f;return n},Buffer.prototype.readUInt8=function(t,e){return e||checkOffset(t,1,this.length),this[t]},Buffer.prototype.readUInt16LE=function(t,e){return e||checkOffset(t,2,this.length),this[t]|this[t+1]<<8},Buffer.prototype.readUInt16BE=function(t,e){return e||checkOffset(t,2,this.length),this[t]<<8|this[t+1]},Buffer.prototype.readUInt32LE=function(t,e){return e||checkOffset(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},Buffer.prototype.readUInt32BE=function(t,e){return e||checkOffset(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},Buffer.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||checkOffset(t,e,this.length);for(var n=this[t],f=1,i=0;++i<e&&(f*=256);)n+=this[t+i]*f;return f*=128,n>=f&&(n-=Math.pow(2,8*e)),n},Buffer.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||checkOffset(t,e,this.length);for(var n=e,f=1,i=this[t+--n];n>0&&(f*=256);)i+=this[t+--n]*f;return f*=128,i>=f&&(i-=Math.pow(2,8*e)),i},Buffer.prototype.readInt8=function(t,e){return e||checkOffset(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},Buffer.prototype.readInt16LE=function(t,e){e||checkOffset(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt16BE=function(t,e){e||checkOffset(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt32LE=function(t,e){return e||checkOffset(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},Buffer.prototype.readInt32BE=function(t,e){return e||checkOffset(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},Buffer.prototype.readFloatLE=function(t,e){return e||checkOffset(t,4,this.length),ieee754.read(this,t,!0,23,4)},Buffer.prototype.readFloatBE=function(t,e){return e||checkOffset(t,4,this.length),ieee754.read(this,t,!1,23,4)},Buffer.prototype.readDoubleLE=function(t,e){return e||checkOffset(t,8,this.length),ieee754.read(this,t,!0,52,8)},Buffer.prototype.readDoubleBE=function(t,e){return e||checkOffset(t,8,this.length),ieee754.read(this,t,!1,52,8)},Buffer.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e|=0,r|=0,!n){checkInt(this,t,e,r,Math.pow(2,8*r)-1,0)}var f=1,i=0;for(this[e]=255&t;++i<r&&(f*=256);)this[e+i]=t/f&255;return e+r},Buffer.prototype.writeUIntBE=function(t,e,r,n){if(t=+t,e|=0,r|=0,!n){checkInt(this,t,e,r,Math.pow(2,8*r)-1,0)}var f=r-1,i=1;for(this[e+f]=255&t;--f>=0&&(i*=256);)this[e+f]=t/i&255;return e+r},Buffer.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,1,255,0),Buffer.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},Buffer.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):objectWriteUInt16(this,t,e,!0),e+2},Buffer.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):objectWriteUInt16(this,t,e,!1),e+2},Buffer.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):objectWriteUInt32(this,t,e,!0),e+4},Buffer.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):objectWriteUInt32(this,t,e,!1),e+4},Buffer.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var f=Math.pow(2,8*r-1);checkInt(this,t,e,r,f-1,-f)}var i=0,o=1,u=0;for(this[e]=255&t;++i<r&&(o*=256);)t<0&&0===u&&0!==this[e+i-1]&&(u=1),this[e+i]=(t/o>>0)-u&255;return e+r},Buffer.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var f=Math.pow(2,8*r-1);checkInt(this,t,e,r,f-1,-f)}var i=r-1,o=1,u=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===u&&0!==this[e+i+1]&&(u=1),this[e+i]=(t/o>>0)-u&255;return e+r},Buffer.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,1,127,-128),Buffer.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},Buffer.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):objectWriteUInt16(this,t,e,!0),e+2},Buffer.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):objectWriteUInt16(this,t,e,!1),e+2},Buffer.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,4,2147483647,-2147483648),Buffer.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):objectWriteUInt32(this,t,e,!0),e+4},Buffer.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),Buffer.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):objectWriteUInt32(this,t,e,!1),e+4},Buffer.prototype.writeFloatLE=function(t,e,r){return writeFloat(this,t,e,!0,r)},Buffer.prototype.writeFloatBE=function(t,e,r){return writeFloat(this,t,e,!1,r)},Buffer.prototype.writeDoubleLE=function(t,e,r){return writeDouble(this,t,e,!0,r)},Buffer.prototype.writeDoubleBE=function(t,e,r){return writeDouble(this,t,e,!1,r)},Buffer.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var f,i=n-r;if(this===t&&r<e&&e<n)for(f=i-1;f>=0;--f)t[f+e]=this[f+r];else if(i<1e3||!Buffer.TYPED_ARRAY_SUPPORT)for(f=0;f<i;++f)t[f+e]=this[f+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+i),e);return i},Buffer.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var f=t.charCodeAt(0);f<256&&(t=f)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!Buffer.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var i;if("number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{var o=Buffer.isBuffer(t)?t:utf8ToBytes(new Buffer(t,n).toString()),u=o.length;for(i=0;i<r-e;++i)this[i+e]=o[i%u]}return this};var INVALID_BASE64_RE=/[^+\/0-9A-Za-z-_]/g;
  14. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},_dereq_("buffer").Buffer)
  15. },{"base64-js":3,"buffer":6,"ieee754":29,"isarray":35}],7:[function(_dereq_,module,exports){
  16. !function(){if("undefined"!=typeof window)try{var e=new window.CustomEvent("test",{cancelable:!0});if(e.preventDefault(),!0!==e.defaultPrevented)throw new Error("Could not prevent default")}catch(e){var t=function(e,t){var n,r;return t=t||{},t.bubbles=!!t.bubbles,t.cancelable=!!t.cancelable,n=document.createEvent("CustomEvent"),n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),r=n.preventDefault,n.preventDefault=function(){r.call(this);try{Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})}catch(e){this.defaultPrevented=!0}},n};t.prototype=window.Event.prototype,window.CustomEvent=t}}();
  17. },{}],8:[function(_dereq_,module,exports){
  18. function useColors(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function formatArgs(){var o=arguments,e=this.useColors;if(o[0]=(e?"%c":"")+this.namespace+(e?" %c":" ")+o[0]+(e?"%c ":" "),!e)return o;var r="color: "+this.color;o=[o[0],r,"color: inherit"].concat(Array.prototype.slice.call(o,1));var t=0,s=0;return o[0].replace(/%[a-z%]/g,function(o){"%%"!==o&&(t++,"%c"===o&&(s=t))}),o.splice(s,0,r),o}function log(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function save(o){try{null==o?exports.storage.removeItem("debug"):exports.storage.debug=o}catch(o){}}function load(){var o;try{o=exports.storage.debug}catch(o){}return o}function localstorage(){try{return window.localStorage}catch(o){}}exports=module.exports=_dereq_("./debug"),exports.log=log,exports.formatArgs=formatArgs,exports.save=save,exports.load=load,exports.useColors=useColors,exports.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:localstorage(),exports.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],exports.formatters.j=function(o){return JSON.stringify(o)},exports.enable(load());
  19. },{"./debug":9}],9:[function(_dereq_,module,exports){
  20. function selectColor(){return exports.colors[prevColor++%exports.colors.length]}function debug(e){function r(){}function o(){var e=o;null==e.useColors&&(e.useColors=exports.useColors()),null==e.color&&e.useColors&&(e.color=selectColor());var r=Array.prototype.slice.call(arguments);r[0]=exports.coerce(r[0]),"string"!=typeof r[0]&&(r=["%o"].concat(r));var s=0;r[0]=r[0].replace(/%([a-z%])/g,function(o,t){if("%%"===o)return o;s++;var n=exports.formatters[t];if("function"==typeof n){var l=r[s];o=n.call(e,l),r.splice(s,1),s--}return o}),"function"==typeof exports.formatArgs&&(r=exports.formatArgs.apply(e,r)),(o.log||exports.log||console.log.bind(console)).apply(e,r)}r.enabled=!1,o.enabled=!0;var s=exports.enabled(e)?o:r;return s.namespace=e,s}function enable(e){exports.save(e);for(var r=(e||"").split(/[\s,]+/),o=r.length,s=0;s<o;s++)r[s]&&(e=r[s].replace(/\*/g,".*?"),"-"===e[0]?exports.skips.push(new RegExp("^"+e.substr(1)+"$")):exports.names.push(new RegExp("^"+e+"$")))}function disable(){exports.enable("")}function enabled(e){var r,o;for(r=0,o=exports.skips.length;r<o;r++)if(exports.skips[r].test(e))return!1;for(r=0,o=exports.names.length;r<o;r++)if(exports.names[r].test(e))return!0;return!1}function coerce(e){return e instanceof Error?e.stack||e.message:e}exports=module.exports=debug,exports.coerce=coerce,exports.disable=disable,exports.enable=enable,exports.enabled=enabled,exports.names=[],exports.skips=[],exports.formatters={};var prevColor=0;
  21. },{}],10:[function(_dereq_,module,exports){
  22. "use strict";function toObject(r){if(null===r||void 0===r)throw new TypeError("Sources cannot be null or undefined");return Object(r)}function assignKey(r,e,n){var t=e[n];if(void 0!==t&&null!==t){if(hasOwnProperty.call(r,n)&&(void 0===r[n]||null===r[n]))throw new TypeError("Cannot convert undefined or null to object ("+n+")");hasOwnProperty.call(r,n)&&isObj(t)?r[n]=assign(Object(r[n]),e[n]):r[n]=t}}function assign(r,e){if(r===e)return r;e=Object(e);for(var n in e)hasOwnProperty.call(e,n)&&assignKey(r,e,n);if(Object.getOwnPropertySymbols)for(var t=Object.getOwnPropertySymbols(e),o=0;o<t.length;o++)propIsEnumerable.call(e,t[o])&&assignKey(r,e,t[o]);return r}var isObj=_dereq_("is-obj"),hasOwnProperty=Object.prototype.hasOwnProperty,propIsEnumerable=Object.prototype.propertyIsEnumerable;module.exports=function(r){r=toObject(r);for(var e=1;e<arguments.length;e++)assign(r,arguments[e]);return r};
  23. },{"is-obj":34}],11:[function(_dereq_,module,exports){
  24. "use strict";var keys=_dereq_("object-keys"),hasSymbols="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),toStr=Object.prototype.toString,concat=Array.prototype.concat,origDefineProperty=Object.defineProperty,isFunction=function(e){return"function"==typeof e&&"[object Function]"===toStr.call(e)},arePropertyDescriptorsSupported=function(){var e={};try{origDefineProperty(e,"x",{enumerable:!1,value:e});for(var r in e)return!1;return e.x===e}catch(e){return!1}},supportsDescriptors=origDefineProperty&&arePropertyDescriptorsSupported(),defineProperty=function(e,r,t,o){(!(r in e)||isFunction(o)&&o())&&(supportsDescriptors?origDefineProperty(e,r,{configurable:!0,enumerable:!1,value:t,writable:!0}):e[r]=t)},defineProperties=function(e,r){var t=arguments.length>2?arguments[2]:{},o=keys(r);hasSymbols&&(o=concat.call(o,Object.getOwnPropertySymbols(r)));for(var n=0;n<o.length;n+=1)defineProperty(e,o[n],r[o[n]],t[o[n]])};defineProperties.supportsDescriptors=!!supportsDescriptors,module.exports=defineProperties;
  25. },{"object-keys":41}],12:[function(_dereq_,module,exports){
  26. !function(t,r,n,a){"use strict";function l(e,t){for(var r=0,n=e.length;r<n;r++)m(e[r],t)}function i(e){for(var t,r=0,n=e.length;r<n;r++)t=e[r],y(t,H[u(t)])}function o(e){return function(t){ae(t)&&(m(t,e),l(t.querySelectorAll(x),e))}}function u(e){var t=oe.call(e,"is"),r=e.nodeName.toUpperCase(),n=G.call(U,t?k+t.toUpperCase():_+r);return t&&-1<n&&!c(r,t)?-1:n}function c(e,t){return-1<x.indexOf(e+'[is="'+t+'"]')}function s(e){var t=e.currentTarget,r=e.attrChange,n=e.attrName,a=e.target;me&&(!a||a===t)&&t.attributeChangedCallback&&"style"!==n&&e.prevValue!==e.newValue&&t.attributeChangedCallback(n,r===e[F]?null:e.prevValue,r===e[I]?null:e.newValue)}function d(e){var t=o(e);return function(e){g.push(t,e.target)}}function f(e){be&&(be=!1,e.currentTarget.removeEventListener(P,f)),l((e.target||r).querySelectorAll(x),e.detail===T?T:L),ne&&p()}function h(e,t){var r=this;ue.call(r,e,t),C.call(r,{target:r})}function v(e,t){ee(e,t),O?O.observe(e,de):(pe&&(e.setAttribute=h,e[w]=E(e),e.addEventListener(R,C)),e.addEventListener(D,s)),e.createdCallback&&me&&(e.created=!0,e.createdCallback(),e.created=!1)}function p(){for(var e,t=0,r=le.length;t<r;t++)e=le[t],Z.contains(e)||(r--,le.splice(t--,1),m(e,T))}function b(e){throw new Error("A "+e+" type is already registered")}function m(e,t){var r,n=u(e);-1<n&&(N(e,H[n]),n=0,t!==L||e[L]?t===T&&!e[T]&&(e[L]=!1,e[T]=!0,n=1):(e[T]=!1,e[L]=!0,n=1,ne&&G.call(le,e)<0&&le.push(e)),n&&(r=e[t+"Callback"])&&r.call(e))}if(!(a in r)){var g,C,A,E,O,N,y,w="__"+a+(1e5*Math.random()>>0),L="attached",T="detached",M="extends",F="ADDITION",V="MODIFICATION",I="REMOVAL",D="DOMAttrModified",P="DOMContentLoaded",R="DOMSubtreeModified",_="<",k="=",q=/^[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)+$/,S=["ANNOTATION-XML","COLOR-PROFILE","FONT-FACE","FONT-FACE-SRC","FONT-FACE-URI","FONT-FACE-FORMAT","FONT-FACE-NAME","MISSING-GLYPH"],U=[],H=[],x="",Z=r.documentElement,G=U.indexOf||function(e){for(var t=this.length;t--&&this[t]!==e;);return t},j=n.prototype,z=j.hasOwnProperty,K=j.isPrototypeOf,W=n.defineProperty,X=n.getOwnPropertyDescriptor,Y=n.getOwnPropertyNames,$=n.getPrototypeOf,B=n.setPrototypeOf,J=!!n.__proto__,Q=n.create||function e(t){return t?(e.prototype=t,new e):this},ee=B||(J?function(e,t){return e.__proto__=t,e}:Y&&X?function(){function e(e,t){for(var r,n=Y(t),a=0,l=n.length;a<l;a++)r=n[a],z.call(e,r)||W(e,r,X(t,r))}return function(t,r){do{e(t,r)}while((r=$(r))&&!K.call(r,t));return t}}():function(e,t){for(var r in t)e[r]=t[r];return e}),te=t.MutationObserver||t.WebKitMutationObserver,re=(t.HTMLElement||t.Element||t.Node).prototype,ne=!K.call(re,Z),ae=ne?function(e){return 1===e.nodeType}:function(e){return K.call(re,e)},le=ne&&[],ie=re.cloneNode,oe=re.getAttribute,ue=re.setAttribute,ce=re.removeAttribute,se=r.createElement,de=te&&{attributes:!0,characterData:!0,attributeOldValue:!0},fe=te||function(e){pe=!1,Z.removeEventListener(D,fe)},he=t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.msRequestAnimationFrame||function(e){setTimeout(e,10)},ve=!1,pe=!0,be=!0,me=!0;B||J?(N=function(e,t){K.call(t,e)||v(e,t)},y=v):(N=function(e,t){e[w]||(e[w]=n(!0),v(e,t))},y=N),ne?(pe=!1,function(){var t=X(re,"addEventListener"),r=t.value,n=function(e){var t=new CustomEvent(D,{bubbles:!0});t.attrName=e,t.prevValue=oe.call(this,e),t.newValue=null,t[I]=t.attrChange=2,ce.call(this,e),this.dispatchEvent(t)},a=function(t,r){var n=this.hasAttribute(t),a=n&&oe.call(this,t);e=new CustomEvent(D,{bubbles:!0}),ue.call(this,t,r),e.attrName=t,e.prevValue=n?a:null,e.newValue=r,n?e[V]=e.attrChange=1:e[F]=e.attrChange=0,this.dispatchEvent(e)},l=function(e){var t,r=e.currentTarget,n=r[w],a=e.propertyName;n.hasOwnProperty(a)&&(n=n[a],t=new CustomEvent(D,{bubbles:!0}),t.attrName=n.name,t.prevValue=n.value||null,t.newValue=n.value=r[a]||null,null==t.prevValue?t[F]=t.attrChange=0:t[V]=t.attrChange=1,r.dispatchEvent(t))};t.value=function(e,t,i){e===D&&this.attributeChangedCallback&&this.setAttribute!==a&&(this[w]={className:{name:"class",value:this.className}},this.setAttribute=a,this.removeAttribute=n,r.call(this,"propertychange",l)),r.call(this,e,t,i)},W(re,"addEventListener",t)}()):te||(Z.addEventListener(D,fe),Z.setAttribute(w,1),Z.removeAttribute(w),pe&&(C=function(e){var t,r,n,a=this;if(a===e.target){t=a[w],a[w]=r=E(a);for(n in r){if(!(n in t))return A(0,a,n,t[n],r[n],F);if(r[n]!==t[n])return A(1,a,n,t[n],r[n],V)}for(n in t)if(!(n in r))return A(2,a,n,t[n],r[n],I)}},A=function(e,t,r,n,a,l){var i={attrChange:e,currentTarget:t,attrName:r,prevValue:n,newValue:a};i[l]=e,s(i)},E=function(e){for(var t,r,n={},a=e.attributes,l=0,i=a.length;l<i;l++)t=a[l],"setAttribute"!==(r=t.name)&&(n[r]=t.value);return n})),r[a]=function(e,t){if(n=e.toUpperCase(),ve||(ve=!0,te?(O=function(e,t){function r(e,t){for(var r=0,n=e.length;r<n;t(e[r++]));}return new te(function(n){for(var a,l,i,o=0,u=n.length;o<u;o++)a=n[o],"childList"===a.type?(r(a.addedNodes,e),r(a.removedNodes,t)):(l=a.target,me&&l.attributeChangedCallback&&"style"!==a.attributeName&&(i=oe.call(l,a.attributeName))!==a.oldValue&&l.attributeChangedCallback(a.attributeName,a.oldValue,i))})}(o(L),o(T)),O.observe(r,{childList:!0,subtree:!0})):(g=[],he(function e(){for(;g.length;)g.shift().call(null,g.shift());he(e)}),r.addEventListener("DOMNodeInserted",d(L)),r.addEventListener("DOMNodeRemoved",d(T))),r.addEventListener(P,f),r.addEventListener("readystatechange",f),r.createElement=function(e,t){var n=se.apply(r,arguments),a=""+e,l=G.call(U,(t?k:_)+(t||a).toUpperCase()),i=-1<l;return t&&(n.setAttribute("is",t=t.toLowerCase()),i&&(i=c(a.toUpperCase(),t))),me=!r.createElement.innerHTMLHelper,i&&y(n,H[l]),n},re.cloneNode=function(e){var t=ie.call(this,!!e),r=u(t);return-1<r&&y(t,H[r]),e&&i(t.querySelectorAll(x)),t}),-2<G.call(U,k+n)+G.call(U,_+n)&&b(e),!q.test(n)||-1<G.call(S,n))throw new Error("The type "+e+" is invalid");var n,a,s=function(){return v?r.createElement(p,n):r.createElement(p)},h=t||j,v=z.call(h,M),p=v?t[M].toUpperCase():n;return v&&-1<G.call(U,_+p)&&b(p),a=U.push((v?k:_)+n)-1,x=x.concat(x.length?",":"",v?p+'[is="'+e.toLowerCase()+'"]':p),s.prototype=H[a]=z.call(h,"prototype")?h.prototype:Q(re),l(r.querySelectorAll(x),L),s}}}(window,document,Object,"registerElement");
  27. },{}],13:[function(_dereq_,module,exports){
  28. module.exports=function(r){switch(r){case"int8":return Int8Array;case"int16":return Int16Array;case"int32":return Int32Array;case"uint8":return Uint8Array;case"uint16":return Uint16Array;case"uint32":return Uint32Array;case"float32":return Float32Array;case"float64":return Float64Array;case"array":return Array;case"uint8_clamped":return Uint8ClampedArray}};
  29. },{}],14:[function(_dereq_,module,exports){
  30. "use strict";var undefined,ThrowTypeError=Object.getOwnPropertyDescriptor?function(){return Object.getOwnPropertyDescriptor(arguments,"callee").get}():function(){throw new TypeError},hasSymbols="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator,getProto=Object.getPrototypeOf||function(e){return e.__proto__},generator,generatorFunction=generator?getProto(generator):undefined,asyncFn,asyncFunction=asyncFn?asyncFn.constructor:undefined,asyncGen,asyncGenFunction=asyncGen?getProto(asyncGen):undefined,asyncGenIterator=asyncGen?asyncGen():undefined,TypedArray="undefined"==typeof Uint8Array?undefined:getProto(Uint8Array),INTRINSICS={"$ %Array%":Array,"$ %ArrayBuffer%":"undefined"==typeof ArrayBuffer?undefined:ArrayBuffer,"$ %ArrayBufferPrototype%":"undefined"==typeof ArrayBuffer?undefined:ArrayBuffer.prototype,"$ %ArrayIteratorPrototype%":hasSymbols?getProto([][Symbol.iterator]()):undefined,"$ %ArrayPrototype%":Array.prototype,"$ %ArrayProto_entries%":Array.prototype.entries,"$ %ArrayProto_forEach%":Array.prototype.forEach,"$ %ArrayProto_keys%":Array.prototype.keys,"$ %ArrayProto_values%":Array.prototype.values,"$ %AsyncFromSyncIteratorPrototype%":undefined,"$ %AsyncFunction%":asyncFunction,"$ %AsyncFunctionPrototype%":asyncFunction?asyncFunction.prototype:undefined,"$ %AsyncGenerator%":asyncGen?getProto(asyncGenIterator):undefined,"$ %AsyncGeneratorFunction%":asyncGenFunction,"$ %AsyncGeneratorPrototype%":asyncGenFunction?asyncGenFunction.prototype:undefined,"$ %AsyncIteratorPrototype%":asyncGenIterator&&hasSymbols&&Symbol.asyncIterator?asyncGenIterator[Symbol.asyncIterator]():undefined,"$ %Atomics%":"undefined"==typeof Atomics?undefined:Atomics,"$ %Boolean%":Boolean,"$ %BooleanPrototype%":Boolean.prototype,"$ %DataView%":"undefined"==typeof DataView?undefined:DataView,"$ %DataViewPrototype%":"undefined"==typeof DataView?undefined:DataView.prototype,"$ %Date%":Date,"$ %DatePrototype%":Date.prototype,"$ %decodeURI%":decodeURI,"$ %decodeURIComponent%":decodeURIComponent,"$ %encodeURI%":encodeURI,"$ %encodeURIComponent%":encodeURIComponent,"$ %Error%":Error,"$ %ErrorPrototype%":Error.prototype,"$ %eval%":eval,"$ %EvalError%":EvalError,"$ %EvalErrorPrototype%":EvalError.prototype,"$ %Float32Array%":"undefined"==typeof Float32Array?undefined:Float32Array,"$ %Float32ArrayPrototype%":"undefined"==typeof Float32Array?undefined:Float32Array.prototype,"$ %Float64Array%":"undefined"==typeof Float64Array?undefined:Float64Array,"$ %Float64ArrayPrototype%":"undefined"==typeof Float64Array?undefined:Float64Array.prototype,"$ %Function%":Function,"$ %FunctionPrototype%":Function.prototype,"$ %Generator%":generator?getProto(generator()):undefined,"$ %GeneratorFunction%":generatorFunction,"$ %GeneratorPrototype%":generatorFunction?generatorFunction.prototype:undefined,"$ %Int8Array%":"undefined"==typeof Int8Array?undefined:Int8Array,"$ %Int8ArrayPrototype%":"undefined"==typeof Int8Array?undefined:Int8Array.prototype,"$ %Int16Array%":"undefined"==typeof Int16Array?undefined:Int16Array,"$ %Int16ArrayPrototype%":"undefined"==typeof Int16Array?undefined:Int8Array.prototype,"$ %Int32Array%":"undefined"==typeof Int32Array?undefined:Int32Array,"$ %Int32ArrayPrototype%":"undefined"==typeof Int32Array?undefined:Int32Array.prototype,"$ %isFinite%":isFinite,"$ %isNaN%":isNaN,"$ %IteratorPrototype%":hasSymbols?getProto(getProto([][Symbol.iterator]())):undefined,"$ %JSON%":JSON,"$ %JSONParse%":JSON.parse,"$ %Map%":"undefined"==typeof Map?undefined:Map,"$ %MapIteratorPrototype%":"undefined"!=typeof Map&&hasSymbols?getProto((new Map)[Symbol.iterator]()):undefined,"$ %MapPrototype%":"undefined"==typeof Map?undefined:Map.prototype,"$ %Math%":Math,"$ %Number%":Number,"$ %NumberPrototype%":Number.prototype,"$ %Object%":Object,"$ %ObjectPrototype%":Object.prototype,"$ %ObjProto_toString%":Object.prototype.toString,"$ %ObjProto_valueOf%":Object.prototype.valueOf,"$ %parseFloat%":parseFloat,"$ %parseInt%":parseInt,"$ %Promise%":"undefined"==typeof Promise?undefined:Promise,"$ %PromisePrototype%":"undefined"==typeof Promise?undefined:Promise.prototype,"$ %PromiseProto_then%":"undefined"==typeof Promise?undefined:Promise.prototype.then,"$ %Promise_all%":"undefined"==typeof Promise?undefined:Promise.all,"$ %Promise_reject%":"undefined"==typeof Promise?undefined:Promise.reject,"$ %Promise_resolve%":"undefined"==typeof Promise?undefined:Promise.resolve,"$ %Proxy%":"undefined"==typeof Proxy?undefined:Proxy,"$ %RangeError%":RangeError,"$ %RangeErrorPrototype%":RangeError.prototype,"$ %ReferenceError%":ReferenceError,"$ %ReferenceErrorPrototype%":ReferenceError.prototype,"$ %Reflect%":"undefined"==typeof Reflect?undefined:Reflect,"$ %RegExp%":RegExp,"$ %RegExpPrototype%":RegExp.prototype,"$ %Set%":"undefined"==typeof Set?undefined:Set,"$ %SetIteratorPrototype%":"undefined"!=typeof Set&&hasSymbols?getProto((new Set)[Symbol.iterator]()):undefined,"$ %SetPrototype%":"undefined"==typeof Set?undefined:Set.prototype,"$ %SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?undefined:SharedArrayBuffer,"$ %SharedArrayBufferPrototype%":"undefined"==typeof SharedArrayBuffer?undefined:SharedArrayBuffer.prototype,"$ %String%":String,"$ %StringIteratorPrototype%":hasSymbols?getProto(""[Symbol.iterator]()):undefined,"$ %StringPrototype%":String.prototype,"$ %Symbol%":hasSymbols?Symbol:undefined,"$ %SymbolPrototype%":hasSymbols?Symbol.prototype:undefined,"$ %SyntaxError%":SyntaxError,"$ %SyntaxErrorPrototype%":SyntaxError.prototype,"$ %ThrowTypeError%":ThrowTypeError,"$ %TypedArray%":TypedArray,"$ %TypedArrayPrototype%":TypedArray?TypedArray.prototype:undefined,"$ %TypeError%":TypeError,"$ %TypeErrorPrototype%":TypeError.prototype,"$ %Uint8Array%":"undefined"==typeof Uint8Array?undefined:Uint8Array,"$ %Uint8ArrayPrototype%":"undefined"==typeof Uint8Array?undefined:Uint8Array.prototype,"$ %Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?undefined:Uint8ClampedArray,"$ %Uint8ClampedArrayPrototype%":"undefined"==typeof Uint8ClampedArray?undefined:Uint8ClampedArray.prototype,"$ %Uint16Array%":"undefined"==typeof Uint16Array?undefined:Uint16Array,"$ %Uint16ArrayPrototype%":"undefined"==typeof Uint16Array?undefined:Uint16Array.prototype,"$ %Uint32Array%":"undefined"==typeof Uint32Array?undefined:Uint32Array,"$ %Uint32ArrayPrototype%":"undefined"==typeof Uint32Array?undefined:Uint32Array.prototype,"$ %URIError%":URIError,"$ %URIErrorPrototype%":URIError.prototype,"$ %WeakMap%":"undefined"==typeof WeakMap?undefined:WeakMap,"$ %WeakMapPrototype%":"undefined"==typeof WeakMap?undefined:WeakMap.prototype,"$ %WeakSet%":"undefined"==typeof WeakSet?undefined:WeakSet,"$ %WeakSetPrototype%":"undefined"==typeof WeakSet?undefined:WeakSet.prototype};module.exports=function(e,r){if(arguments.length>1&&"boolean"!=typeof r)throw new TypeError('"allowMissing" argument must be a boolean');var t="$ "+e;if(!(t in INTRINSICS))throw new SyntaxError("intrinsic "+e+" does not exist!");if(void 0===INTRINSICS[t]&&!r)throw new TypeError("intrinsic "+e+" exists, but is not available. Please file an issue!");return INTRINSICS[t]};
  31. },{}],15:[function(_dereq_,module,exports){
  32. "use strict";var GetIntrinsic=_dereq_("./GetIntrinsic"),$Object=GetIntrinsic("%Object%"),$TypeError=GetIntrinsic("%TypeError%"),$String=GetIntrinsic("%String%"),assertRecord=_dereq_("./helpers/assertRecord"),$isNaN=_dereq_("./helpers/isNaN"),$isFinite=_dereq_("./helpers/isFinite"),sign=_dereq_("./helpers/sign"),mod=_dereq_("./helpers/mod"),IsCallable=_dereq_("is-callable"),toPrimitive=_dereq_("es-to-primitive/es5"),has=_dereq_("has"),ES5={ToPrimitive:toPrimitive,ToBoolean:function(e){return!!e},ToNumber:function(e){return+e},ToInteger:function(e){var r=this.ToNumber(e);return $isNaN(r)?0:0!==r&&$isFinite(r)?sign(r)*Math.floor(Math.abs(r)):r},ToInt32:function(e){return this.ToNumber(e)>>0},ToUint32:function(e){return this.ToNumber(e)>>>0},ToUint16:function(e){var r=this.ToNumber(e);if($isNaN(r)||0===r||!$isFinite(r))return 0;var t=sign(r)*Math.floor(Math.abs(r));return mod(t,65536)},ToString:function(e){return $String(e)},ToObject:function(e){return this.CheckObjectCoercible(e),$Object(e)},CheckObjectCoercible:function(e,r){if(null==e)throw new $TypeError(r||"Cannot call method on "+e);return e},IsCallable:IsCallable,SameValue:function(e,r){return e===r?0!==e||1/e==1/r:$isNaN(e)&&$isNaN(r)},Type:function(e){return null===e?"Null":void 0===e?"Undefined":"function"==typeof e||"object"==typeof e?"Object":"number"==typeof e?"Number":"boolean"==typeof e?"Boolean":"string"==typeof e?"String":void 0},IsPropertyDescriptor:function(e){if("Object"!==this.Type(e))return!1;var r={"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0};for(var t in e)if(has(e,t)&&!r[t])return!1;var i=has(e,"[[Value]]"),o=has(e,"[[Get]]")||has(e,"[[Set]]");if(i&&o)throw new $TypeError("Property Descriptors may not be both accessor and data descriptors");return!0},IsAccessorDescriptor:function(e){return void 0!==e&&(assertRecord(this,"Property Descriptor","Desc",e),!(!has(e,"[[Get]]")&&!has(e,"[[Set]]")))},IsDataDescriptor:function(e){return void 0!==e&&(assertRecord(this,"Property Descriptor","Desc",e),!(!has(e,"[[Value]]")&&!has(e,"[[Writable]]")))},IsGenericDescriptor:function(e){return void 0!==e&&(assertRecord(this,"Property Descriptor","Desc",e),!this.IsAccessorDescriptor(e)&&!this.IsDataDescriptor(e))},FromPropertyDescriptor:function(e){if(void 0===e)return e;if(assertRecord(this,"Property Descriptor","Desc",e),this.IsDataDescriptor(e))return{value:e["[[Value]]"],writable:!!e["[[Writable]]"],enumerable:!!e["[[Enumerable]]"],configurable:!!e["[[Configurable]]"]};if(this.IsAccessorDescriptor(e))return{get:e["[[Get]]"],set:e["[[Set]]"],enumerable:!!e["[[Enumerable]]"],configurable:!!e["[[Configurable]]"]};throw new $TypeError("FromPropertyDescriptor must be called with a fully populated Property Descriptor")},ToPropertyDescriptor:function(e){if("Object"!==this.Type(e))throw new $TypeError("ToPropertyDescriptor requires an object");var r={};if(has(e,"enumerable")&&(r["[[Enumerable]]"]=this.ToBoolean(e.enumerable)),has(e,"configurable")&&(r["[[Configurable]]"]=this.ToBoolean(e.configurable)),has(e,"value")&&(r["[[Value]]"]=e.value),has(e,"writable")&&(r["[[Writable]]"]=this.ToBoolean(e.writable)),has(e,"get")){var t=e.get;if(void 0!==t&&!this.IsCallable(t))throw new TypeError("getter must be a function");r["[[Get]]"]=t}if(has(e,"set")){var i=e.set;if(void 0!==i&&!this.IsCallable(i))throw new $TypeError("setter must be a function");r["[[Set]]"]=i}if((has(r,"[[Get]]")||has(r,"[[Set]]"))&&(has(r,"[[Value]]")||has(r,"[[Writable]]")))throw new $TypeError("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return r}};module.exports=ES5;
  33. },{"./GetIntrinsic":14,"./helpers/assertRecord":16,"./helpers/isFinite":17,"./helpers/isNaN":18,"./helpers/mod":19,"./helpers/sign":20,"es-to-primitive/es5":21,"has":28,"is-callable":32}],16:[function(_dereq_,module,exports){
  34. "use strict";var GetIntrinsic=_dereq_("../GetIntrinsic"),$TypeError=GetIntrinsic("%TypeError%"),$SyntaxError=GetIntrinsic("%SyntaxError%"),has=_dereq_("has"),predicates={"Property Descriptor":function(r,e){if("Object"!==r.Type(e))return!1;var t={"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0};for(var n in e)if(has(e,n)&&!t[n])return!1;var o=has(e,"[[Value]]"),a=has(e,"[[Get]]")||has(e,"[[Set]]");if(o&&a)throw new $TypeError("Property Descriptors may not be both accessor and data descriptors");return!0}};module.exports=function(r,e,t,n){var o=predicates[e];if("function"!=typeof o)throw new $SyntaxError("unknown record type: "+e);if(!o(r,n))throw new $TypeError(t+" must be a "+e);console.log(o(r,n),n)};
  35. },{"../GetIntrinsic":14,"has":28}],17:[function(_dereq_,module,exports){
  36. var $isNaN=Number.isNaN||function(e){return e!==e};module.exports=Number.isFinite||function(e){return"number"==typeof e&&!$isNaN(e)&&e!==1/0&&e!==-1/0};
  37. },{}],18:[function(_dereq_,module,exports){
  38. module.exports=Number.isNaN||function(e){return e!==e};
  39. },{}],19:[function(_dereq_,module,exports){
  40. module.exports=function(o,r){var t=o%r;return Math.floor(t>=0?t:t+r)};
  41. },{}],20:[function(_dereq_,module,exports){
  42. module.exports=function(e){return e>=0?1:-1};
  43. },{}],21:[function(_dereq_,module,exports){
  44. "use strict";var toStr=Object.prototype.toString,isPrimitive=_dereq_("./helpers/isPrimitive"),isCallable=_dereq_("is-callable"),ES5internalSlots={"[[DefaultValue]]":function(e){var t;if((t=arguments.length>1?arguments[1]:"[object Date]"===toStr.call(e)?String:Number)===String||t===Number){var r,i,l=t===String?["toString","valueOf"]:["valueOf","toString"];for(i=0;i<l.length;++i)if(isCallable(e[l[i]])&&(r=e[l[i]](),isPrimitive(r)))return r;throw new TypeError("No default value")}throw new TypeError("invalid [[DefaultValue]] hint supplied")}};module.exports=function(e){return isPrimitive(e)?e:arguments.length>1?ES5internalSlots["[[DefaultValue]]"](e,arguments[1]):ES5internalSlots["[[DefaultValue]]"](e)};
  45. },{"./helpers/isPrimitive":22,"is-callable":32}],22:[function(_dereq_,module,exports){
  46. module.exports=function(o){return null===o||"function"!=typeof o&&"object"!=typeof o};
  47. },{}],23:[function(_dereq_,module,exports){
  48. function flattenVertexData(e,t,r){if(!e)throw new TypeError("must specify data as first parameter");if(r=0|+(r||0),Array.isArray(e)&&e[0]&&"number"==typeof e[0][0]){var n,a,l,o,f=e[0].length,s=e.length*f;t&&"string"!=typeof t||(t=new(dtype(t||"float32"))(s+r));var i=t.length-r;if(s!==i)throw new Error("source length "+s+" ("+f+"x"+e.length+") does not match destination length "+i);for(n=0,l=r;n<e.length;n++)for(a=0;a<f;a++)t[l++]=null===e[n][a]?NaN:e[n][a]}else if(t&&"string"!=typeof t)t.set(e,r);else{var y=dtype(t||"float32");if(Array.isArray(e)||"array"===t)for(t=new y(e.length+r),n=0,l=r,o=t.length;l<o;l++,n++)t[l]=null===e[n]?NaN:e[n];else 0===r?t=new y(e):(t=new y(e.length+r),t.set(e,r))}return t}var dtype=_dereq_("dtype");module.exports=flattenVertexData;
  49. },{"dtype":13}],24:[function(_dereq_,module,exports){
  50. "use strict";var isCallable=_dereq_("is-callable"),toStr=Object.prototype.toString,hasOwnProperty=Object.prototype.hasOwnProperty,forEachArray=function(r,t,a){for(var o=0,l=r.length;o<l;o++)hasOwnProperty.call(r,o)&&(null==a?t(r[o],o,r):t.call(a,r[o],o,r))},forEachString=function(r,t,a){for(var o=0,l=r.length;o<l;o++)null==a?t(r.charAt(o),o,r):t.call(a,r.charAt(o),o,r)},forEachObject=function(r,t,a){for(var o in r)hasOwnProperty.call(r,o)&&(null==a?t(r[o],o,r):t.call(a,r[o],o,r))},forEach=function(r,t,a){if(!isCallable(t))throw new TypeError("iterator must be a function");var o;arguments.length>=3&&(o=a),"[object Array]"===toStr.call(r)?forEachArray(r,t,o):"string"==typeof r?forEachString(r,t,o):forEachObject(r,t,o)};module.exports=forEach;
  51. },{"is-callable":32}],25:[function(_dereq_,module,exports){
  52. "use strict";var ERROR_MESSAGE="Function.prototype.bind called on incompatible ",slice=Array.prototype.slice,toStr=Object.prototype.toString,funcType="[object Function]";module.exports=function(t){var n=this;if("function"!=typeof n||toStr.call(n)!==funcType)throw new TypeError(ERROR_MESSAGE+n);for(var o,e=slice.call(arguments,1),r=function(){if(this instanceof o){var r=n.apply(this,e.concat(slice.call(arguments)));return Object(r)===r?r:this}return n.apply(t,e.concat(slice.call(arguments)))},c=Math.max(0,n.length-e.length),i=[],p=0;p<c;p++)i.push("$"+p);if(o=Function("binder","return function ("+i.join(",")+"){ return binder.apply(this,arguments); }")(r),n.prototype){var l=function(){};l.prototype=n.prototype,o.prototype=new l,l.prototype=null}return o};
  53. },{}],26:[function(_dereq_,module,exports){
  54. "use strict";var implementation=_dereq_("./implementation");module.exports=Function.prototype.bind||implementation;
  55. },{"./implementation":25}],27:[function(_dereq_,module,exports){
  56. (function (global){
  57. var win;win="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},module.exports=win;
  58. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  59. },{}],28:[function(_dereq_,module,exports){
  60. "use strict";var bind=_dereq_("function-bind");module.exports=bind.call(Function.call,Object.prototype.hasOwnProperty);
  61. },{"function-bind":26}],29:[function(_dereq_,module,exports){
  62. exports.read=function(a,o,t,r,h){var M,p,w=8*h-r-1,f=(1<<w)-1,e=f>>1,i=-7,N=t?h-1:0,n=t?-1:1,s=a[o+N];for(N+=n,M=s&(1<<-i)-1,s>>=-i,i+=w;i>0;M=256*M+a[o+N],N+=n,i-=8);for(p=M&(1<<-i)-1,M>>=-i,i+=r;i>0;p=256*p+a[o+N],N+=n,i-=8);if(0===M)M=1-e;else{if(M===f)return p?NaN:1/0*(s?-1:1);p+=Math.pow(2,r),M-=e}return(s?-1:1)*p*Math.pow(2,M-r)},exports.write=function(a,o,t,r,h,M){var p,w,f,e=8*M-h-1,i=(1<<e)-1,N=i>>1,n=23===h?Math.pow(2,-24)-Math.pow(2,-77):0,s=r?0:M-1,u=r?1:-1,l=o<0||0===o&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(w=isNaN(o)?1:0,p=i):(p=Math.floor(Math.log(o)/Math.LN2),o*(f=Math.pow(2,-p))<1&&(p--,f*=2),o+=p+N>=1?n/f:n*Math.pow(2,1-N),o*f>=2&&(p++,f/=2),p+N>=i?(w=0,p=i):p+N>=1?(w=(o*f-1)*Math.pow(2,h),p+=N):(w=o*Math.pow(2,N-1)*Math.pow(2,h),p=0));h>=8;a[t+s]=255&w,s+=u,w/=256,h-=8);for(p=p<<h|w,e+=h;e>0;a[t+s]=255&p,s+=u,p/=256,e-=8);a[t+s-u]|=128*l};
  63. },{}],30:[function(_dereq_,module,exports){
  64. "function"==typeof Object.create?module.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:module.exports=function(t,e){if(e){t.super_=e;var o=function(){};o.prototype=e.prototype,t.prototype=new o,t.prototype.constructor=t}};
  65. },{}],31:[function(_dereq_,module,exports){
  66. function isBuffer(f){return!!f.constructor&&"function"==typeof f.constructor.isBuffer&&f.constructor.isBuffer(f)}function isSlowBuffer(f){return"function"==typeof f.readFloatLE&&"function"==typeof f.slice&&isBuffer(f.slice(0,0))}module.exports=function(f){return null!=f&&(isBuffer(f)||isSlowBuffer(f)||!!f._isBuffer)};
  67. },{}],32:[function(_dereq_,module,exports){
  68. "use strict";var fnToStr=Function.prototype.toString,constructorRegex=/^\s*class\b/,isES6ClassFn=function(t){try{var n=fnToStr.call(t);return constructorRegex.test(n)}catch(t){return!1}},tryFunctionObject=function(t){try{return!isES6ClassFn(t)&&(fnToStr.call(t),!0)}catch(t){return!1}},toStr=Object.prototype.toString,fnClass="[object Function]",genClass="[object GeneratorFunction]",hasToStringTag="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;module.exports=function(t){if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;if("function"==typeof t&&!t.prototype)return!0;if(hasToStringTag)return tryFunctionObject(t);if(isES6ClassFn(t))return!1;var n=toStr.call(t);return n===fnClass||n===genClass};
  69. },{}],33:[function(_dereq_,module,exports){
  70. function isFunction(o){var t=toString.call(o);return"[object Function]"===t||"function"==typeof o&&"[object RegExp]"!==t||"undefined"!=typeof window&&(o===window.setTimeout||o===window.alert||o===window.confirm||o===window.prompt)}module.exports=isFunction;var toString=Object.prototype.toString;
  71. },{}],34:[function(_dereq_,module,exports){
  72. "use strict";module.exports=function(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)};
  73. },{}],35:[function(_dereq_,module,exports){
  74. var toString={}.toString;module.exports=Array.isArray||function(r){return"[object Array]"==toString.call(r)};
  75. },{}],36:[function(_dereq_,module,exports){
  76. function TextLayout(t){this.glyphs=[],this._measure=this.computeMetrics.bind(this),this.update(t)}function addGetter(t){Object.defineProperty(TextLayout.prototype,t,{get:wrapper(t),configurable:!0})}function wrapper(t){return new Function(["return function "+t+"() {"," return this._"+t,"}"].join("\n"))()}function getGlyphById(t,e){if(!t.chars||0===t.chars.length)return null;var r=findChar(t.chars,e);return r>=0?t.chars[r]:null}function getXHeight(t){for(var e=0;e<X_HEIGHTS.length;e++){var r=X_HEIGHTS[e].charCodeAt(0),n=findChar(t.chars,r);if(n>=0)return t.chars[n].height}return 0}function getMGlyph(t){for(var e=0;e<M_WIDTHS.length;e++){var r=M_WIDTHS[e].charCodeAt(0),n=findChar(t.chars,r);if(n>=0)return t.chars[n]}return 0}function getCapHeight(t){for(var e=0;e<CAP_HEIGHTS.length;e++){var r=CAP_HEIGHTS[e].charCodeAt(0),n=findChar(t.chars,r);if(n>=0)return t.chars[n].height}return 0}function getKerning(t,e,r){if(!t.kernings||0===t.kernings.length)return 0;for(var n=t.kernings,i=0;i<n.length;i++){var a=n[i];if(a.first===e&&a.second===r)return a.amount}return 0}function getAlignType(t){return"center"===t?ALIGN_CENTER:"right"===t?ALIGN_RIGHT:ALIGN_LEFT}function findChar(t,e,r){r=r||0;for(var n=r;n<t.length;n++)if(t[n].id===e)return n;return-1}var wordWrap=_dereq_("word-wrapper"),xtend=_dereq_("xtend"),number=_dereq_("as-number"),X_HEIGHTS=["x","e","a","o","n","s","r","c","u","m","v","w","z"],M_WIDTHS=["m","w"],CAP_HEIGHTS=["H","I","N","E","F","K","L","T","U","V","W","X","Y","Z"],TAB_ID="\t".charCodeAt(0),SPACE_ID=" ".charCodeAt(0),ALIGN_LEFT=0,ALIGN_CENTER=1,ALIGN_RIGHT=2;module.exports=function(t){return new TextLayout(t)},TextLayout.prototype.update=function(t){if(t=xtend({measure:this._measure},t),this._opt=t,this._opt.tabSize=number(this._opt.tabSize,4),!t.font)throw new Error("must provide a valid bitmap font");var e=this.glyphs,r=t.text||"",n=t.font;this._setupSpaceGlyphs(n);var i=wordWrap.lines(r,t),a=t.width||0;e.length=0;var h=i.reduce(function(t,e){return Math.max(t,e.width,a)},0),o=0,s=0,c=number(t.lineHeight,n.common.lineHeight),u=n.common.base,l=c-u,p=t.letterSpacing||0,f=c*i.length-l,d=getAlignType(this._opt.align);s-=f,this._width=h,this._height=f,this._descender=c-u,this._baseline=u,this._xHeight=getXHeight(n),this._capHeight=getCapHeight(n),this._lineHeight=c,this._ascender=c-l-this._xHeight;var g=this;i.forEach(function(t,i){for(var a,u=t.start,l=t.end,f=t.width,_=u;_<l;_++){var y=r.charCodeAt(_),G=g.getGlyph(n,y);if(G){a&&(o+=getKerning(n,a.id,G.id));var T=o;d===ALIGN_CENTER?T+=(h-f)/2:d===ALIGN_RIGHT&&(T+=h-f),e.push({position:[T,s],data:G,index:_,line:i}),o+=G.xadvance+p,a=G}}s+=c,o=0}),this._linesTotal=i.length},TextLayout.prototype._setupSpaceGlyphs=function(t){if(this._fallbackSpaceGlyph=null,this._fallbackTabGlyph=null,t.chars&&0!==t.chars.length){var e=getGlyphById(t,SPACE_ID)||getMGlyph(t)||t.chars[0],r=this._opt.tabSize*e.xadvance;this._fallbackSpaceGlyph=e,this._fallbackTabGlyph=xtend(e,{x:0,y:0,xadvance:r,id:TAB_ID,xoffset:0,yoffset:0,width:0,height:0})}},TextLayout.prototype.getGlyph=function(t,e){var r=getGlyphById(t,e);return r||(e===TAB_ID?this._fallbackTabGlyph:e===SPACE_ID?this._fallbackSpaceGlyph:null)},TextLayout.prototype.computeMetrics=function(t,e,r,n){var i,a,h=this._opt.letterSpacing||0,o=this._opt.font,s=0,c=0,u=0;if(!o.chars||0===o.chars.length)return{start:e,end:e,width:0};r=Math.min(t.length,r);for(var l=e;l<r;l++){var p=t.charCodeAt(l),i=this.getGlyph(o,p);if(i){i.xoffset;s+=a?getKerning(o,a.id,i.id):0;var f=s+i.xadvance+h,d=s+i.width;if(d>=n||f>=n)break;s=f,c=d,a=i}u++}return a&&(c+=a.xoffset),{start:e,end:e+u,width:c}},["width","height","descender","ascender","xHeight","baseline","capHeight","lineHeight"].forEach(addGetter);
  77. },{"as-number":2,"word-wrapper":69,"xtend":72}],37:[function(_dereq_,module,exports){
  78. (function (Buffer){
  79. function isArrayBuffer(r){return"[object ArrayBuffer]"===Object.prototype.toString.call(r)}function getBinaryOpts(r){if(xml2)return xtend(r,{responseType:"arraybuffer"});if(void 0===self.XMLHttpRequest)throw new Error("your browser does not support XHR loading");var e=new self.XMLHttpRequest;return e.overrideMimeType("text/plain; charset=x-user-defined"),xtend({xhr:e},r)}var xhr=_dereq_("xhr"),noop=function(){},parseASCII=_dereq_("parse-bmfont-ascii"),parseXML=_dereq_("parse-bmfont-xml"),readBinary=_dereq_("parse-bmfont-binary"),isBinaryFormat=_dereq_("./lib/is-binary"),xtend=_dereq_("xtend"),xml2=function(){return self.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}();module.exports=function(r,e){e="function"==typeof e?e:noop,"string"==typeof r?r={uri:r}:r||(r={}),r.binary&&(r=getBinaryOpts(r)),xhr(r,function(t,n,i){if(t)return e(t);if(!/^2/.test(n.statusCode))return e(new Error("http status code: "+n.statusCode));if(!i)return e(new Error("no body result"));var o=!1;if(isArrayBuffer(i)){var a=new Uint8Array(i);i=new Buffer(a,"binary")}isBinaryFormat(i)&&(o=!0,"string"==typeof i&&(i=new Buffer(i,"binary"))),o||(Buffer.isBuffer(i)&&(i=i.toString(r.encoding)),i=i.trim());var s;try{var u=n.headers["content-type"];s=o?readBinary(i):/json/.test(u)||"{"===i.charAt(0)?JSON.parse(i):/xml/.test(u)||"<"===i.charAt(0)?parseXML(i):parseASCII(i)}catch(r){e(new Error("error parsing font "+r.message)),e=noop}e(null,s)})};
  80. }).call(this,_dereq_("buffer").Buffer)
  81. },{"./lib/is-binary":38,"buffer":6,"parse-bmfont-ascii":43,"parse-bmfont-binary":44,"parse-bmfont-xml":45,"xhr":70,"xtend":72}],38:[function(_dereq_,module,exports){
  82. (function (Buffer){
  83. var equal=_dereq_("buffer-equal"),HEADER=new Buffer([66,77,70,3]);module.exports=function(e){return"string"==typeof e?"BMF"===e.substring(0,3):e.length>4&&equal(e.slice(0,4),HEADER)};
  84. }).call(this,_dereq_("buffer").Buffer)
  85. },{"buffer":6,"buffer-equal":5}],39:[function(_dereq_,module,exports){
  86. "use strict";function toObject(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function shouldUseNative(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var r={},t=0;t<10;t++)r["_"+String.fromCharCode(t)]=t;if("0123456789"!==Object.getOwnPropertyNames(r).map(function(e){return r[e]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(e){n[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}var getOwnPropertySymbols=Object.getOwnPropertySymbols,hasOwnProperty=Object.prototype.hasOwnProperty,propIsEnumerable=Object.prototype.propertyIsEnumerable;module.exports=shouldUseNative()?Object.assign:function(e,r){for(var t,n,o=toObject(e),a=1;a<arguments.length;a++){t=Object(arguments[a]);for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);if(getOwnPropertySymbols){n=getOwnPropertySymbols(t);for(var c=0;c<n.length;c++)propIsEnumerable.call(t,n[c])&&(o[n[c]]=t[n[c]])}}return o};
  87. },{}],40:[function(_dereq_,module,exports){
  88. "use strict";var keysShim;if(!Object.keys){var has=Object.prototype.hasOwnProperty,toStr=Object.prototype.toString,isArgs=_dereq_("./isArguments"),isEnumerable=Object.prototype.propertyIsEnumerable,hasDontEnumBug=!isEnumerable.call({toString:null},"toString"),hasProtoEnumBug=isEnumerable.call(function(){},"prototype"),dontEnums=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],equalsConstructorPrototype=function(t){var o=t.constructor;return o&&o.prototype===t},excludedKeys={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},hasAutomationEqualityBug=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!excludedKeys["$"+t]&&has.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{equalsConstructorPrototype(window[t])}catch(t){return!0}}catch(t){return!0}return!1}(),equalsConstructorPrototypeIfNotBuggy=function(t){if("undefined"==typeof window||!hasAutomationEqualityBug)return equalsConstructorPrototype(t);try{return equalsConstructorPrototype(t)}catch(t){return!1}};keysShim=function(t){var o=null!==t&&"object"==typeof t,r="[object Function]"===toStr.call(t),e=isArgs(t),n=o&&"[object String]"===toStr.call(t),u=[];if(!o&&!r&&!e)throw new TypeError("Object.keys called on a non-object");var s=hasProtoEnumBug&&r;if(n&&t.length>0&&!has.call(t,0))for(var a=0;a<t.length;++a)u.push(String(a));if(e&&t.length>0)for(var l=0;l<t.length;++l)u.push(String(l));else for(var i in t)s&&"prototype"===i||!has.call(t,i)||u.push(String(i));if(hasDontEnumBug)for(var c=equalsConstructorPrototypeIfNotBuggy(t),p=0;p<dontEnums.length;++p)c&&"constructor"===dontEnums[p]||!has.call(t,dontEnums[p])||u.push(dontEnums[p]);return u}}module.exports=keysShim;
  89. },{"./isArguments":42}],41:[function(_dereq_,module,exports){
  90. "use strict";var slice=Array.prototype.slice,isArgs=_dereq_("./isArguments"),origKeys=Object.keys,keysShim=origKeys?function(e){return origKeys(e)}:_dereq_("./implementation"),originalKeys=Object.keys;keysShim.shim=function(){if(Object.keys){(function(){var e=Object.keys(arguments);return e&&e.length===arguments.length})(1,2)||(Object.keys=function(e){return originalKeys(isArgs(e)?slice.call(e):e)})}else Object.keys=keysShim;return Object.keys||keysShim},module.exports=keysShim;
  91. },{"./implementation":40,"./isArguments":42}],42:[function(_dereq_,module,exports){
  92. "use strict";var toStr=Object.prototype.toString;module.exports=function(t){var e=toStr.call(t),o="[object Arguments]"===e;return o||(o="[object Array]"!==e&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===toStr.call(t.callee)),o};
  93. },{}],43:[function(_dereq_,module,exports){
  94. function splitLine(e,r){if(!(e=e.replace(/\t+/g," ").trim()))return null;var t=e.indexOf(" ");if(-1===t)throw new Error("no named row at line "+r);var a=e.substring(0,t);e=e.substring(t+1),e=e.replace(/letter=[\'\"]\S+[\'\"]/gi,""),e=e.split("="),e=e.map(function(e){return e.trim().match(/(".*?"|[^"\s]+)+(?=\s*|\s*$)/g)});for(var n=[],i=0;i<e.length;i++){var s=e[i];0===i?n.push({key:s[0],data:""}):i===e.length-1?n[n.length-1].data=parseData(s[0]):(n[n.length-1].data=parseData(s[0]),n.push({key:s[1],data:""}))}var o={key:a,data:{}};return n.forEach(function(e){o.data[e.key]=e.data}),o}function parseData(e){return e&&0!==e.length?0===e.indexOf('"')||0===e.indexOf("'")?e.substring(1,e.length-1):-1!==e.indexOf(",")?parseIntList(e):parseInt(e,10):""}function parseIntList(e){return e.split(",").map(function(e){return parseInt(e,10)})}module.exports=function(e){if(!e)throw new Error("no data provided");e=e.toString().trim();var r={pages:[],chars:[],kernings:[]},t=e.split(/\r\n?|\n/g);if(0===t.length)throw new Error("no data in BMFont file");for(var a=0;a<t.length;a++){var n=splitLine(t[a],a);if(n)if("page"===n.key){if("number"!=typeof n.data.id)throw new Error("malformed file at line "+a+" -- needs page id=N");if("string"!=typeof n.data.file)throw new Error("malformed file at line "+a+' -- needs page file="path"');r.pages[n.data.id]=n.data.file}else"chars"===n.key||"kernings"===n.key||("char"===n.key?r.chars.push(n.data):"kerning"===n.key?r.kernings.push(n.data):r[n.key]=n.data)}return r};
  95. },{}],44:[function(_dereq_,module,exports){
  96. function readBlock(r,e,n){if(n>e.length-1)return 0;var a=e.readUInt8(n++),t=e.readInt32LE(n);switch(n+=4,a){case 1:r.info=readInfo(e,n);break;case 2:r.common=readCommon(e,n);break;case 3:r.pages=readPages(e,n,t);break;case 4:r.chars=readChars(e,n,t);break;case 5:r.kernings=readKernings(e,n,t)}return 5+t}function readInfo(r,e){var n={};n.size=r.readInt16LE(e);var a=r.readUInt8(e+2);return n.smooth=a>>7&1,n.unicode=a>>6&1,n.italic=a>>5&1,n.bold=a>>4&1,a>>3&1&&(n.fixedHeight=1),n.charset=r.readUInt8(e+3)||"",n.stretchH=r.readUInt16LE(e+4),n.aa=r.readUInt8(e+6),n.padding=[r.readInt8(e+7),r.readInt8(e+8),r.readInt8(e+9),r.readInt8(e+10)],n.spacing=[r.readInt8(e+11),r.readInt8(e+12)],n.outline=r.readUInt8(e+13),n.face=readStringNT(r,e+14),n}function readCommon(r,e){var n={};n.lineHeight=r.readUInt16LE(e),n.base=r.readUInt16LE(e+2),n.scaleW=r.readUInt16LE(e+4),n.scaleH=r.readUInt16LE(e+6),n.pages=r.readUInt16LE(e+8);r.readUInt8(e+10);return n.packed=0,n.alphaChnl=r.readUInt8(e+11),n.redChnl=r.readUInt8(e+12),n.greenChnl=r.readUInt8(e+13),n.blueChnl=r.readUInt8(e+14),n}function readPages(r,e,n){for(var a=[],t=readNameNT(r,e),d=t.length+1,o=n/d,i=0;i<o;i++)a[i]=r.slice(e,e+t.length).toString("utf8"),e+=d;return a}function readChars(r,e,n){for(var a=[],t=n/20,d=0;d<t;d++){var o={},i=20*d;o.id=r.readUInt32LE(e+0+i),o.x=r.readUInt16LE(e+4+i),o.y=r.readUInt16LE(e+6+i),o.width=r.readUInt16LE(e+8+i),o.height=r.readUInt16LE(e+10+i),o.xoffset=r.readInt16LE(e+12+i),o.yoffset=r.readInt16LE(e+14+i),o.xadvance=r.readInt16LE(e+16+i),o.page=r.readUInt8(e+18+i),o.chnl=r.readUInt8(e+19+i),a[d]=o}return a}function readKernings(r,e,n){for(var a=[],t=n/10,d=0;d<t;d++){var o={},i=10*d;o.first=r.readUInt32LE(e+0+i),o.second=r.readUInt32LE(e+4+i),o.amount=r.readInt16LE(e+8+i),a[d]=o}return a}function readNameNT(r,e){for(var n=e;n<r.length&&0!==r[n];n++);return r.slice(e,n)}function readStringNT(r,e){return readNameNT(r,e).toString("utf8")}var HEADER=[66,77,70];module.exports=function(r){if(r.length<6)throw new Error("invalid buffer length for BMFont");if(!HEADER.every(function(e,n){return r.readUInt8(n)===e}))throw new Error("BMFont missing BMF byte header");var e=3;if(r.readUInt8(e++)>3)throw new Error("Only supports BMFont Binary v3 (BMFont App v1.10)");for(var n={kernings:[],chars:[]},a=0;a<5;a++)e+=readBlock(n,r,e);return n};
  97. },{}],45:[function(_dereq_,module,exports){
  98. function getAttribs(e){return getAttribList(e).reduce(function(e,t){return e[mapName(t.nodeName)]=t.nodeValue,e},{})}function getAttribList(e){for(var t=[],r=0;r<e.attributes.length;r++)t.push(e.attributes[r]);return t}function mapName(e){return NAME_MAP[e.toLowerCase()]||e}var parseAttributes=_dereq_("./parse-attribs"),parseFromString=_dereq_("xml-parse-from-string"),NAME_MAP={scaleh:"scaleH",scalew:"scaleW",stretchh:"stretchH",lineheight:"lineHeight",alphachnl:"alphaChnl",redchnl:"redChnl",greenchnl:"greenChnl",bluechnl:"blueChnl"};module.exports=function(e){e=e.toString();var t=parseFromString(e),r={pages:[],chars:[],kernings:[]};["info","common"].forEach(function(e){var a=t.getElementsByTagName(e)[0];a&&(r[e]=parseAttributes(getAttribs(a)))});var a=t.getElementsByTagName("pages")[0];if(!a)throw new Error("malformed file -- no <pages> element");for(var n=a.getElementsByTagName("page"),i=0;i<n.length;i++){var s=n[i],g=parseInt(s.getAttribute("id"),10),l=s.getAttribute("file");if(isNaN(g))throw new Error('malformed file -- page "id" attribute is NaN');if(!l)throw new Error('malformed file -- needs page "file" attribute');r.pages[parseInt(g,10)]=l}return["chars","kernings"].forEach(function(e){var a=t.getElementsByTagName(e)[0];if(a)for(var n=e.substring(0,e.length-1),i=a.getElementsByTagName(n),s=0;s<i.length;s++){var g=i[s];r[e].push(parseAttributes(getAttribs(g)))}}),r};
  99. },{"./parse-attribs":46,"xml-parse-from-string":71}],46:[function(_dereq_,module,exports){
  100. function parseIntList(t){return t.split(",").map(function(t){return parseInt(t,10)})}var GLYPH_DESIGNER_ERROR="chasrset";module.exports=function(t){GLYPH_DESIGNER_ERROR in t&&(t.charset=t[GLYPH_DESIGNER_ERROR],delete t[GLYPH_DESIGNER_ERROR]);for(var n in t)"face"!==n&&"charset"!==n&&(t[n]="padding"===n||"spacing"===n?parseIntList(t[n]):parseInt(t[n],10));return t};
  101. },{}],47:[function(_dereq_,module,exports){
  102. var trim=_dereq_("string.prototype.trim"),forEach=_dereq_("for-each"),isArray=function(r){return"[object Array]"===Object.prototype.toString.call(r)};module.exports=function(r){if(!r)return{};var t={};return forEach(trim(r).split("\n"),function(r){var i=r.indexOf(":"),e=trim(r.slice(0,i)).toLowerCase(),o=trim(r.slice(i+1));void 0===t[e]?t[e]=o:isArray(t[e])?t[e].push(o):t[e]=[t[e],o]}),t};
  103. },{"for-each":24,"string.prototype.trim":53}],48:[function(_dereq_,module,exports){
  104. (function (global){
  105. var performance=global.performance||{},present=function(){for(var e=["now","webkitNow","msNow","mozNow","oNow"];e.length;){var n=e.shift();if(n in performance)return performance[n].bind(performance)}var r=Date.now||function(){return(new Date).getTime()},o=(performance.timing||{}).navigationStart||r();return function(){return r()-o}}();present.performanceNow=performance.now,present.noConflict=function(){performance.now=present.performanceNow},present.conflict=function(){performance.now=present},present.conflict(),module.exports=present;
  106. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  107. },{}],49:[function(_dereq_,module,exports){
  108. function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(e){if(cachedSetTimeout===setTimeout)return setTimeout(e,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(e,0);try{return cachedSetTimeout(e,0)}catch(t){try{return cachedSetTimeout.call(null,e,0)}catch(t){return cachedSetTimeout.call(this,e,0)}}}function runClearTimeout(e){if(cachedClearTimeout===clearTimeout)return clearTimeout(e);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(e);try{return cachedClearTimeout(e)}catch(t){try{return cachedClearTimeout.call(null,e)}catch(t){return cachedClearTimeout.call(this,e)}}}function cleanUpNextTick(){draining&&currentQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var e=runTimeout(cleanUpNextTick);draining=!0;for(var t=queue.length;t;){for(currentQueue=queue,queue=[];++queueIndex<t;)currentQueue&&currentQueue[queueIndex].run();queueIndex=-1,t=queue.length}currentQueue=null,draining=!1,runClearTimeout(e)}}function Item(e,t){this.fun=e,this.array=t}function noop(){}var process=module.exports={},cachedSetTimeout,cachedClearTimeout;!function(){try{cachedSetTimeout="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(e){cachedSetTimeout=defaultSetTimout}try{cachedClearTimeout="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(e){cachedClearTimeout=defaultClearTimeout}}();var queue=[],draining=!1,currentQueue,queueIndex=-1;process.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];queue.push(new Item(e,t)),1!==queue.length||draining||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={},process.on=noop,process.addListener=noop,process.once=noop,process.off=noop,process.removeListener=noop,process.removeAllListeners=noop,process.emit=noop,process.prependListener=noop,process.prependOnceListener=noop,process.listeners=function(e){return[]},process.binding=function(e){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(e){throw new Error("process.chdir is not supported")},process.umask=function(){return 0};
  109. },{}],50:[function(_dereq_,module,exports){
  110. (function (setImmediate){
  111. !function(t){function e(t,e){return function(){t.apply(e,arguments)}}function n(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],f(t,e(r,this),e(i,this))}function o(t){var e=this;if(null===this._state)return void this._deferreds.push(t);l(function(){var n=e._state?t.onFulfilled:t.onRejected;if(null===n)return void(e._state?t.resolve:t.reject)(e._value);var o;try{o=n(e._value)}catch(e){return void t.reject(e)}t.resolve(o)})}function r(t){try{if(t===this)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if("function"==typeof n)return void f(e(n,t),e(r,this),e(i,this))}this._state=!0,this._value=t,u.call(this)}catch(t){i.call(this,t)}}function i(t){this._state=!1,this._value=t,u.call(this)}function u(){for(var t=0,e=this._deferreds.length;t<e;t++)o.call(this,this._deferreds[t]);this._deferreds=null}function c(t,e,n,o){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.resolve=n,this.reject=o}function f(t,e,n){var o=!1;try{t(function(t){o||(o=!0,e(t))},function(t){o||(o=!0,n(t))})}catch(t){if(o)return;o=!0,n(t)}}var s=setTimeout,l="function"==typeof setImmediate&&setImmediate||function(t){s(t,1)},h=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};n.prototype.catch=function(t){return this.then(null,t)},n.prototype.then=function(t,e){var r=this;return new n(function(n,i){o.call(r,new c(t,e,n,i))})},n.all=function(){var t=Array.prototype.slice.call(1===arguments.length&&h(arguments[0])?arguments[0]:arguments);return new n(function(e,n){function o(i,u){try{if(u&&("object"==typeof u||"function"==typeof u)){var c=u.then;if("function"==typeof c)return void c.call(u,function(t){o(i,t)},n)}t[i]=u,0==--r&&e(t)}catch(t){n(t)}}if(0===t.length)return e([]);for(var r=t.length,i=0;i<t.length;i++)o(i,t[i])})},n.resolve=function(t){return t&&"object"==typeof t&&t.constructor===n?t:new n(function(e){e(t)})},n.reject=function(t){return new n(function(e,n){n(t)})},n.race=function(t){return new n(function(e,n){for(var o=0,r=t.length;o<r;o++)t[o].then(e,n)})},n._setImmediateFn=function(t){l=t},"undefined"!=typeof module&&module.exports?module.exports=n:t.Promise||(t.Promise=n)}(this);
  112. }).call(this,_dereq_("timers").setImmediate)
  113. },{"timers":67}],51:[function(_dereq_,module,exports){
  114. var dtype=_dereq_("dtype"),anArray=_dereq_("an-array"),isBuffer=_dereq_("is-buffer"),CW=[0,2,3],CCW=[2,1,3];module.exports=function(r,e){r&&(anArray(r)||isBuffer(r))||(e=r||{},r=null),e="number"==typeof e?{count:e}:e||{};for(var t="string"==typeof e.type?e.type:"uint16",u="number"==typeof e.count?e.count:1,n=e.start||0,a=!1!==e.clockwise?CW:CCW,f=a[0],o=a[1],y=a[2],i=6*u,p=r||new(dtype(t))(i),s=0,c=0;s<i;s+=6,c+=4){var C=s+n;p[C+0]=c+0,p[C+1]=c+1,p[C+2]=c+2,p[C+3]=c+f,p[C+4]=c+o,p[C+5]=c+y}return p};
  115. },{"an-array":1,"dtype":13,"is-buffer":31}],52:[function(_dereq_,module,exports){
  116. "use strict";var bind=_dereq_("function-bind"),ES=_dereq_("es-abstract/es5"),replace=bind.call(Function.call,String.prototype.replace),leftWhitespace=/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/,rightWhitespace=/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/;module.exports=function(){var u=ES.ToString(ES.CheckObjectCoercible(this));return replace(replace(u,leftWhitespace,""),rightWhitespace,"")};
  117. },{"es-abstract/es5":15,"function-bind":26}],53:[function(_dereq_,module,exports){
  118. "use strict";var bind=_dereq_("function-bind"),define=_dereq_("define-properties"),implementation=_dereq_("./implementation"),getPolyfill=_dereq_("./polyfill"),shim=_dereq_("./shim"),boundTrim=bind.call(Function.call,getPolyfill());define(boundTrim,{getPolyfill:getPolyfill,implementation:implementation,shim:shim}),module.exports=boundTrim;
  119. },{"./implementation":52,"./polyfill":54,"./shim":55,"define-properties":11,"function-bind":26}],54:[function(_dereq_,module,exports){
  120. "use strict";var implementation=_dereq_("./implementation"),zeroWidthSpace="​";module.exports=function(){return String.prototype.trim&&zeroWidthSpace.trim()===zeroWidthSpace?String.prototype.trim:implementation};
  121. },{"./implementation":52}],55:[function(_dereq_,module,exports){
  122. "use strict";var define=_dereq_("define-properties"),getPolyfill=_dereq_("./polyfill");module.exports=function(){var e=getPolyfill();return define(String.prototype,{trim:e},{trim:function(){return String.prototype.trim!==e}}),e};
  123. },{"./polyfill":54,"define-properties":11}],56:[function(_dereq_,module,exports){
  124. "use strict";function minMax(e,t,n){return Math.min(Math.max(e,t),n)}function stringContains(e,t){return e.indexOf(t)>-1}function applyArguments(e,t){return e.apply(null,t)}function parseEasingParameters(e){var t=easingFunctionRegex.exec(e);return t?t[1].split(",").map(function(e){return parseFloat(e)}):[]}function spring(e,t){function n(e){var n=t?t*e/1e3:e;return n=l<1?Math.exp(-n*l*c)*(f*Math.cos(g*n)+p*Math.sin(g*n)):(f+p*n)*Math.exp(-n*c),0===e||1===e?e:1-n}function r(){var t=cache.springs[e];if(t)return t;for(var r=0,a=0;;)if(r+=1/6,1===n(r)){if(++a>=16)break}else a=0;var i=r*(1/6)*1e3;return cache.springs[e]=i,i}var a=parseEasingParameters(e),i=minMax(is.und(a[0])?1:a[0],.1,100),s=minMax(is.und(a[1])?100:a[1],.1,100),o=minMax(is.und(a[2])?10:a[2],.1,100),u=minMax(is.und(a[3])?0:a[3],.1,100),c=Math.sqrt(s/i),l=o/(2*Math.sqrt(s*i)),g=l<1?c*Math.sqrt(1-l*l):0,f=1,p=l<1?(l*c-u)/g:-u+c;return t?n:r}function elastic(e,t){void 0===e&&(e=1),void 0===t&&(t=.5);var n=minMax(e,1,10),r=minMax(t,.1,2);return function(e){return 0===e||1===e?e:-n*Math.pow(2,10*(e-1))*Math.sin((e-1-r/(2*Math.PI)*Math.asin(1/n))*(2*Math.PI)/r)}}function steps(e){return void 0===e&&(e=10),function(t){return Math.round(t*e)*(1/e)}}function parseEasings(e,t){if(is.fnc(e))return e;var n=e.split("(")[0],r=penner[n],a=parseEasingParameters(e);switch(n){case"spring":return spring(e,t);case"cubicBezier":return applyArguments(bezier,a);case"steps":return applyArguments(steps,a);default:return is.fnc(r)?applyArguments(r,a):applyArguments(bezier,r)}}function selectString(e){try{return document.querySelectorAll(e)}catch(e){return}}function filterArray(e,t){for(var n=auxArrayFilter,r=e.length,a=arguments.length>=2?arguments[1]:void 0,i=0;i<r;i++)if(i in e){var s=e[i];t.call(a,s,i,e)&&n.push(s)}return auxArrayFilter=e,auxArrayFilter.length=0,n}function flattenArray(e,t){t||(t=[]);for(var n=0,r=e.length;n<r;n++){var a=e[n];Array.isArray(a)?flattenArray(a,t):t.push(a)}return t}function toArray(e){return is.arr(e)?e:(is.str(e)&&(e=selectString(e)||e),e instanceof NodeList||e instanceof HTMLCollection?[].slice.call(e):[e])}function arrayContains(e,t){return e.some(function(e){return e===t})}function cloneObject(e){var t={};for(var n in e)t[n]=e[n];return t}function replaceObjectProps(e,t){var n=cloneObject(e);for(var r in e)n[r]=t.hasOwnProperty(r)?t[r]:e[r];return n}function mergeObjects(e,t){var n=cloneObject(e);for(var r in t)n[r]=is.und(e[r])?t[r]:e[r];return n}function rgbToRgba(e){var t=rgbRegex.exec(e);return t?"rgba("+t[1]+",1)":e}function hexToRgba(e){var t=e.replace(hexToRgbaHexRegex,function(e,t,n,r){return t+t+n+n+r+r}),n=hexToRgbaRgbRegex.exec(t);return"rgba("+parseInt(n[1],16)+","+parseInt(n[2],16)+","+parseInt(n[3],16)+",1)"}function hslToRgba(e){function t(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var n,r,a,i=hslToRgbaHsl1Regex.exec(e)||hslToRgbaHsl2Regex.exec(e),s=parseInt(i[1],10)/360,o=parseInt(i[2],10)/100,u=parseInt(i[3],10)/100,c=i[4]||1;if(0==o)n=r=a=u;else{var l=u<.5?u*(1+o):u+o-u*o,g=2*u-l;n=t(g,l,s+1/3),r=t(g,l,s),a=t(g,l,s-1/3)}return"rgba("+255*n+","+255*r+","+255*a+","+c+")"}function colorToRgb(e){return is.rgb(e)?rgbToRgba(e):is.hex(e)?hexToRgba(e):is.hsl(e)?hslToRgba(e):void 0}function getUnit(e){var t=unitRegex.exec(e);if(t)return t[2]}function getTransformUnit(e){return stringContains(e,"translate")||"perspective"===e?"px":stringContains(e,"rotate")||stringContains(e,"skew")?"deg":void 0}function getFunctionValue(e,t){return is.fnc(e)?e(t.target,t.id,t.total):e}function getAttribute(e,t){return e.getAttribute(t)}function convertPxToUnit(e,t,n){if(arrayContains([n,"deg","rad","turn"],getUnit(t)))return t;var r=cache.CSS[t+n];if(!is.und(r))return r;var a=document.createElement(e.tagName),i=e.parentNode&&e.parentNode!==document?e.parentNode:document.body;i.appendChild(a),a.style.position="absolute",a.style.width=100+n;var s=100/a.offsetWidth;i.removeChild(a);var o=s*parseFloat(t);return cache.CSS[t+n]=o,o}function getCSSValue(e,t,n){if(t in e.style){var r=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),a=e.style[t]||getComputedStyle(e).getPropertyValue(r)||"0";return n?convertPxToUnit(e,a,n):a}}function getAnimationType(e,t){return is.dom(e)&&!is.inp(e)&&(getAttribute(e,t)||is.svg(e)&&e[t])?"attribute":is.dom(e)&&arrayContains(validTransforms,t)?"transform":is.dom(e)&&"transform"!==t&&getCSSValue(e,t)?"css":null!=e[t]?"object":void 0}function getElementTransforms(e){if(is.dom(e)){for(var t,n=e.style.transform||"",r=new Map;t=transformRegex.exec(n);)r.set(t[1],t[2]);return r}}function getTransformValue(e,t,n,r){var a=stringContains(t,"scale")?1:0+getTransformUnit(t),i=getElementTransforms(e).get(t)||a;return n&&(n.transforms.list.set(t,i),n.transforms.last=t),r?convertPxToUnit(e,i,r):i}function getOriginalTargetValue(e,t,n,r){switch(getAnimationType(e,t)){case"transform":return getTransformValue(e,t,r,n);case"css":return getCSSValue(e,t,n);case"attribute":return getAttribute(e,t);default:return e[t]||0}}function getRelativeValue(e,t){var n=operatorRegex.exec(e);if(!n)return e;var r=getUnit(e)||0,a=parseFloat(t),i=parseFloat(e.replace(n[0],""));switch(n[0][0]){case"+":return a+i+r;case"-":return a-i+r;case"*":return a*i+r}}function validateValue(e,t){if(is.col(e))return colorToRgb(e);var n=getUnit(e),r=n?e.substr(0,e.length-n.length):e;return t&&!whitespaceRegex.test(e)?r+t:r}function getDistance(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function getCircleLength(e){return 2*Math.PI*getAttribute(e,"r")}function getRectLength(e){return 2*getAttribute(e,"width")+2*getAttribute(e,"height")}function getLineLength(e){return getDistance({x:getAttribute(e,"x1"),y:getAttribute(e,"y1")},{x:getAttribute(e,"x2"),y:getAttribute(e,"y2")})}function getPolylineLength(e){for(var t,n=e.points,r=0,a=0;a<n.numberOfItems;a++){var i=n.getItem(a);a>0&&(r+=getDistance(t,i)),t=i}return r}function getPolygonLength(e){var t=e.points;return getPolylineLength(e)+getDistance(t.getItem(t.numberOfItems-1),t.getItem(0))}function getTotalLength(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return getCircleLength(e);case"rect":return getRectLength(e);case"line":return getLineLength(e);case"polyline":return getPolylineLength(e);case"polygon":return getPolygonLength(e)}}function setDashoffset(e){var t=getTotalLength(e);return e.setAttribute("stroke-dasharray",t),t}function getParentSvgEl(e){for(var t=e.parentNode;is.svg(t)&&(t=t.parentNode,is.svg(t.parentNode)););return t}function getParentSvg(e,t){var n=t||{},r=n.el||getParentSvgEl(e),a=r.getBoundingClientRect(),i=getAttribute(r,"viewBox"),s=a.width,o=a.height,u=n.viewBox||(i?i.split(" "):[0,0,s,o]);return{el:r,viewBox:u,x:u[0]/1,y:u[1]/1,w:s/u[2],h:o/u[3]}}function getPath(e,t){var n=is.str(e)?selectString(e)[0]:e,r=t||100;return function(e){return{property:e,el:n,svg:getParentSvg(n),totalLength:getTotalLength(n)*(r/100)}}}function getPathProgress(e,t){function n(n){void 0===n&&(n=0);var r=t+n>=1?t+n:0;return e.el.getPointAtLength(r)}var r=getParentSvg(e.el,e.svg),a=n(),i=n(-1),s=n(1);switch(e.property){case"x":return(a.x-r.x)*r.w;case"y":return(a.y-r.y)*r.h;case"angle":return 180*Math.atan2(s.y-i.y,s.x-i.x)/Math.PI}}function decomposeValue(e,t){var n=validateValue(is.pth(e)?e.totalLength:e,t)+"";return{original:n,numbers:n.match(valueRegex)?n.match(valueRegex).map(Number):[0],strings:is.str(e)||t?n.split(valueRegex):[]}}function parseTargets(e){return filterArray(e?flattenArray(is.arr(e)?e.map(toArray):toArray(e)):[],function(e,t,n){return n.indexOf(e)===t})}function getAnimatables(e){var t=parseTargets(e);return t.map(function(e,n){return{target:e,id:n,total:t.length,transforms:{list:getElementTransforms(e)}}})}function normalizePropertyTweens(e,t){var n=cloneObject(t);if(springRegex.test(n.easing)&&(n.duration=spring(n.easing)),is.arr(e)){var r=e.length;2===r&&!is.obj(e[0])?e={value:e}:is.fnc(t.duration)||(n.duration=t.duration/r)}var a=is.arr(e)?e:[e];return a.map(function(e,n){var r=is.obj(e)&&!is.pth(e)?e:{value:e};return is.und(r.delay)&&(r.delay=n?0:t.delay),is.und(r.endDelay)&&(r.endDelay=n===a.length-1?t.endDelay:0),r}).map(function(e){return mergeObjects(e,n)})}function flattenKeyframes(e){for(var t=filterArray(flattenArray(e.map(function(e){return Object.keys(e)})),function(e){return is.key(e)}).reduce(function(e,t){return e.indexOf(t)<0&&e.push(t),e},[]),n={},r=0;r<t.length;r++)!function(r){var a=t[r];n[a]=e.map(function(e){var t={};for(var n in e)is.key(n)?n==a&&(t.value=e[n]):t[n]=e[n];return t})}(r);return n}function getProperties(e,t){var n=[],r=t.keyframes;r&&(t=mergeObjects(flattenKeyframes(r),t));for(var a in t)is.key(a)&&n.push({name:a,tweens:normalizePropertyTweens(t[a],e)});return n}function normalizeTweenValues(e,t){var n={};for(var r in e){var a=getFunctionValue(e[r],t);is.arr(a)&&(a=a.map(function(e){return getFunctionValue(e,t)}),1===a.length&&(a=a[0])),n[r]=a}return n.duration=parseFloat(n.duration),n.delay=parseFloat(n.delay),n}function normalizeTweens(e,t){var n;return e.tweens.map(function(r){var a=normalizeTweenValues(r,t),i=a.value,s=is.arr(i)?i[1]:i,o=getUnit(s),u=getOriginalTargetValue(t.target,e.name,o,t),c=n?n.to.original:u,l=is.arr(i)?i[0]:c,g=getUnit(l)||getUnit(u),f=o||g;return is.und(s)&&(s=c),a.from=decomposeValue(l,f),a.to=decomposeValue(getRelativeValue(s,l),f),a.start=n?n.end:0,a.end=a.start+a.delay+a.duration+a.endDelay,a.easing=parseEasings(a.easing,a.duration),a.isPath=is.pth(i),a.isColor=is.col(a.from.original),a.isColor&&(a.round=1),n=a,a})}function setTargetsValue(e,t){for(var n=getAnimatables(e),r=0,a=n.length;r<a;r++){var i=n[r];for(var s in t){var o=getFunctionValue(t[s],i),u=i.target,c=getUnit(o),l=getOriginalTargetValue(u,s,c,i),g=c||getUnit(l),f=getRelativeValue(validateValue(o,g),l),p=getAnimationType(u,s);setProgressValue[p](u,s,f,i.transforms,!0)}}}function createAnimation(e,t){var n=getAnimationType(e.target,t.name);if(n){var r=normalizeTweens(t,e),a=r[r.length-1];return{type:n,property:t.name,animatable:e,tweens:r,duration:a.end,delay:r[0].delay,endDelay:a.endDelay}}}function getAnimations(e,t){return filterArray(flattenArray(e.map(function(e){return t.map(function(t){return createAnimation(e,t)})})),function(e){return!is.und(e)})}function getInstanceTimings(e,t){var n=e.length,r=function(e){return e.timelineOffset?e.timelineOffset:0},a={};return a.duration=n?Math.max.apply(Math,e.map(function(e){return r(e)+e.duration})):t.duration,a.delay=n?Math.min.apply(Math,e.map(function(e){return r(e)+e.delay})):t.delay,a.endDelay=n?a.duration-Math.max.apply(Math,e.map(function(e){return r(e)+e.duration-e.endDelay})):t.endDelay,a}function createNewInstance(e){var t=replaceObjectProps(defaultInstanceSettings,e),n=replaceObjectProps(defaultTweenSettings,e),r=getProperties(n,e),a=getAnimatables(e.targets),i=getAnimations(a,r),s=getInstanceTimings(i,n),o=instanceID;return instanceID++,mergeObjects(t,{id:o,children:[],animatables:a,animations:i,duration:s.duration,delay:s.delay,endDelay:s.endDelay})}function handleVisibilityChange(){if(document.hidden){for(var e=0,t=activeInstances.length;e<t;e++)activeInstance[e].pause();pausedInstances=activeInstances.slice(0),activeInstances=[]}else for(var n=0,r=pausedInstances.length;n<r;n++)pausedInstances[n].play()}function anime(e){function t(){return window.Promise&&new Promise(function(e){return v=e})}function n(){y.reversed=!y.reversed;for(var e=0,t=g.length;e<t;e++)g[e].reversed=y.reversed}function r(e){return y.reversed?y.duration-e:e}function a(){f=0,p=r(y.currentTime)*(1/anime.speed)}function i(e,t){t&&t.seek(e-t.timelineOffset)}function s(e){if(y.reversePlayback)for(var t=d;t--;)i(e,g[t]);else for(var n=0;n<d;n++)i(e,g[n])}function o(e){for(var t=0,n=y.animations,r=n.length;t<r;){var a=n[t],i=a.animatable,s=a.tweens,o=s.length-1,u=s[o];o&&(u=filterArray(s,function(t){return e<t.end})[0]||u);for(var c=minMax(e-u.start-u.delay,0,u.duration)/u.duration,l=isNaN(c)?1:u.easing(c),g=u.to.strings,f=u.round,p=[],m=u.to.numbers.length,d=void 0,v=0;v<m;v++){var h=void 0,b=u.to.numbers[v],x=u.from.numbers[v]||0;h=u.isPath?getPathProgress(u.value,l*b):x+l*(b-x),f&&(u.isColor&&v>2||(h=Math.round(h*f)/f)),p.push(h)}var T=g.length;if(T){d=g[0];for(var A=0;A<T;A++){var R=(g[A],g[A+1]),P=p[A];isNaN(P)||(d+=R?P+R:P+" ")}}else d=p[0];setProgressValue[a.type](i.target,a.property,d,i.transforms),a.currentValue=d,t++}}function u(e){y[e]&&!y.passThrough&&y[e](y)}function c(){y.remaining&&!0!==y.remaining&&y.remaining--}function l(e){var a=y.duration,i=y.delay,l=a-y.endDelay,d=r(e);y.progress=minMax(d/a*100,0,100),y.reversePlayback=d<y.currentTime,g&&s(d),!y.began&&y.currentTime>0&&(y.began=!0,u("begin"),u("loopBegin")),d<=i&&0!==y.currentTime&&o(0),(d>=l&&y.currentTime!==a||!a)&&o(a),d>i&&d<l?(y.changeBegan||(y.changeBegan=!0,y.changeCompleted=!1,u("changeBegin")),u("change"),o(d)):y.changeBegan&&(y.changeCompleted=!0,y.changeBegan=!1,u("changeComplete")),y.currentTime=minMax(d,0,a),y.began&&u("update"),e>=a&&(p=0,c(),y.remaining?(f=m,u("loopComplete"),u("loopBegin"),"alternate"===y.direction&&n()):(y.paused=!0,y.completed||(y.completed=!0,u("loopComplete"),u("complete"),"Promise"in window&&(v(),h=t()))))}void 0===e&&(e={});var g,f=0,p=0,m=0,d=0,v=null,h=t(),y=createNewInstance(e);return y.reset=function(){var e=y.direction;y.passThrough=!1,y.currentTime=0,y.progress=0,y.paused=!0,y.began=!1,y.changeBegan=!1,y.completed=!1,y.changeCompleted=!1,y.reversePlayback=!1,y.reversed="reverse"===e,y.remaining=y.loop,g=y.children,d=g.length;for(var t=d;t--;)y.children[t].reset();(y.reversed&&!0!==y.loop||"alternate"===e&&1===y.loop)&&y.remaining++,o(0)},y.set=function(e,t){return setTargetsValue(e,t),y},y.tick=function(e){m=e,f||(f=m),l((m+(p-f))*anime.speed)},y.seek=function(e){l(r(e))},y.pause=function(){y.paused=!0,a()},y.play=function(){y.paused&&(y.paused=!1,activeInstances.push(y),a(),raf||engine())},y.reverse=function(){n(),a()},y.restart=function(){y.reset(),y.play()},y.finished=h,y.reset(),y.autoplay&&y.play(),y}function removeTargetsFromAnimations(e,t){for(var n=t.length;n--;)arrayContains(e,t[n].animatable.target)&&t.splice(n,1)}function removeTargets(e){for(var t=parseTargets(e),n=activeInstances.length;n--;){var r=activeInstances[n],a=r.animations,i=r.children;removeTargetsFromAnimations(t,a);for(var s=i.length;s--;){var o=i[s],u=o.animations;removeTargetsFromAnimations(t,u),u.length||o.children.length||i.splice(s,1)}a.length||i.length||r.pause()}}function stagger(e,t){void 0===t&&(t={});var n=t.direction||"normal",r=t.easing?parseEasings(t.easing):null,a=t.grid,i=t.axis,s=t.from||0,o="first"===s,u="center"===s,c="last"===s,l=is.arr(e),g=l?parseFloat(e[0]):parseFloat(e),f=l?parseFloat(e[1]):0,p=getUnit(l?e[1]:e)||0,m=t.start||0+(l?g:0),d=[],v=0;return function(e,t,h){if(o&&(s=0),u&&(s=(h-1)/2),c&&(s=h-1),!d.length){for(var y=0;y<h;y++){if(a){var b=u?(a[0]-1)/2:s%a[0],x=u?(a[1]-1)/2:Math.floor(s/a[0]),T=y%a[0],A=Math.floor(y/a[0]),R=b-T,P=x-A,w=Math.sqrt(R*R+P*P);"x"===i&&(w=-R),"y"===i&&(w=-P),d.push(w)}else d.push(Math.abs(s-y));v=Math.max.apply(Math,d)}r&&(d=d.map(function(e){return r(e/v)*v})),"reverse"===n&&(d=d.map(function(e){return i?e<0?-1*e:-e:Math.abs(v-e)}))}return m+(l?(f-g)/v:g)*(Math.round(100*d[t])/100)+p}}function timeline(e){void 0===e&&(e={});var t=anime(e);return t.duration=0,t.add=function(n,r){function a(e){e.passThrough=!0}var i=activeInstances.indexOf(t),s=t.children;i>-1&&activeInstances.splice(i,1);for(var o=0;o<s.length;o++)a(s[o]);var u=mergeObjects(n,replaceObjectProps(defaultTweenSettings,e));u.targets=u.targets||e.targets;var c=t.duration;u.autoplay=!1,u.direction=t.direction,u.timelineOffset=is.und(r)?c:getRelativeValue(r,c),a(t),t.seek(u.timelineOffset);var l=anime(u);a(l),s.push(l);var g=getInstanceTimings(s,e);return t.delay=g.delay,t.endDelay=g.endDelay,t.duration=g.duration,t.seek(0),t.reset(),t.autoplay&&t.play(),t},t}var defaultInstanceSettings={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0},defaultTweenSettings={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},validTransforms=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective"],cache={CSS:{},springs:{}},hexRegex=/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i,rgbPrefixRegex=/^rgb/,hslRegex=/^hsl/,is={arr:function(e){return Array.isArray(e)},obj:function(e){return stringContains(Object.prototype.toString.call(e),"Object")},pth:function(e){return is.obj(e)&&e.hasOwnProperty("totalLength")},svg:function(e){return e instanceof SVGElement},inp:function(e){return e instanceof HTMLInputElement},dom:function(e){return e.nodeType||is.svg(e)},str:function(e){return"string"==typeof e},fnc:function(e){return"function"==typeof e},und:function(e){return void 0===e},hex:function(e){return hexRegex.test(e)},rgb:function(e){return rgbPrefixRegex.test(e)},hsl:function(e){return hslRegex.test(e)},col:function(e){return is.hex(e)||is.rgb(e)||is.hsl(e)},key:function(e){return!defaultInstanceSettings.hasOwnProperty(e)&&!defaultTweenSettings.hasOwnProperty(e)&&"targets"!==e&&"keyframes"!==e}},easingFunctionRegex=/\(([^)]+)\)/,bezier=function(){function e(e,t){return 1-3*t+3*e}function t(e,t){return 3*t-6*e}function n(e){return 3*e}function r(r,a,i){return((e(a,i)*r+t(a,i))*r+n(a))*r}function a(r,a,i){return 3*e(a,i)*r*r+2*t(a,i)*r+n(a)}function i(e,t,n,a,i){var s,o,u=0;do{o=t+(n-t)/2,s=r(o,a,i)-e,s>0?n=o:t=o}while(Math.abs(s)>1e-7&&++u<10);return o}function s(e,t,n,i){for(var s=0;s<4;++s){var o=a(t,n,i);if(0===o)return t;t-=(r(t,n,i)-e)/o}return t}function o(e,t,n,o){function l(t){for(var r=0,o=1,l=u-1;o!==l&&g[o]<=t;++o)r+=c;--o;var f=(t-g[o])/(g[o+1]-g[o]),p=r+f*c,m=a(p,e,n);return m>=.001?s(t,p,e,n):0===m?p:i(t,r,r+c,e,n)}if(0<=e&&e<=1&&0<=n&&n<=1){var g=new Float32Array(u);if(e!==t||n!==o)for(var f=0;f<u;++f)g[f]=r(f*c,e,n);return function(a){return e===t&&n===o?a:0===a||1===a?a:r(l(a),t,o)}}}var u=11,c=1/(u-1);return o}(),penner=function(){var e=["Quad","Cubic","Quart","Quint","Sine","Expo","Circ","Back","Elastic"],t={In:[[.55,.085,.68,.53],[.55,.055,.675,.19],[.895,.03,.685,.22],[.755,.05,.855,.06],[.47,0,.745,.715],[.95,.05,.795,.035],[.6,.04,.98,.335],[.6,-.28,.735,.045],elastic],Out:[[.25,.46,.45,.94],[.215,.61,.355,1],[.165,.84,.44,1],[.23,1,.32,1],[.39,.575,.565,1],[.19,1,.22,1],[.075,.82,.165,1],[.175,.885,.32,1.275],function(e,t){return function(n){return 1-elastic(e,t)(1-n)}}],InOut:[[.455,.03,.515,.955],[.645,.045,.355,1],[.77,0,.175,1],[.86,0,.07,1],[.445,.05,.55,.95],[1,0,0,1],[.785,.135,.15,.86],[.68,-.55,.265,1.55],function(e,t){return function(n){return n<.5?elastic(e,t)(2*n)/2:1-elastic(e,t)(-2*n+2)/2}}]},n={linear:[.25,.25,.75,.75]};for(var r in t)for(var a=0,i=t[r].length;a<i;a++)n["ease"+r+e[a]]=t[r][a];return n}(),auxArrayFilter=[],rgbRegex=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g,hexToRgbaHexRegex=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,hexToRgbaRgbRegex=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,hslToRgbaHsl1Regex=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g,hslToRgbaHsl2Regex=/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g,unitRegex=/([\+\-]?[0-9#\.]+)(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/,transformRegex=/(\w+)\(([^)]*)\)/g,operatorRegex=/^(\*=|\+=|-=)/,whitespaceRegex=/\s/g,valueRegex=/-?\d*\.?\d+/g,springRegex=/^spring/,setProgressValue={css:function(e,t,n){return e.style[t]=n},attribute:function(e,t,n){return e.setAttribute(t,n)},object:function(e,t,n){return e[t]=n},transform:function(e,t,n,r,a){if(r.list.set(t,n),t===r.last||a){var i="";r.list.forEach(function(e,t){i+=t+"("+e+") "}),e.style.transform=i}}},instanceID=0,activeInstances=[],pausedInstances=[],raf,engine=function(){function e(){raf=requestAnimationFrame(t)}function t(t){var n=activeInstances.length;if(n){for(var r=0;r<n;){var a=activeInstances[r];if(a.paused){var i=activeInstances.indexOf(a);i>-1&&(activeInstances.splice(i,1),n=activeInstances.length)}else a.tick(t);r++}e()}else raf=cancelAnimationFrame(raf)}return e}();document.addEventListener("visibilitychange",handleVisibilityChange),anime.version="3.0.0",anime.speed=1,anime.running=activeInstances,anime.remove=removeTargets,anime.get=getOriginalTargetValue,anime.set=setTargetsValue,anime.convertPx=convertPxToUnit,anime.path=getPath,anime.setDashoffset=setDashoffset,anime.stagger=stagger,anime.timeline=timeline,anime.easing=parseEasings,anime.penner=penner,anime.random=function(e,t){return Math.floor(Math.random()*(t-e+1))+e},module.exports=anime;
  125. },{}],57:[function(_dereq_,module,exports){
  126. !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):(t="undefined"!=typeof globalThis?globalThis:t||self,e(t.THREE={}))}(this,function(t){"use strict";function e(t,e,n,r,i,a,o){try{var s=t[a](o),c=s.value}catch(t){return void n(t)}s.done?e(c):Promise.resolve(c).then(r,i)}function n(t){return function(){var n=this,r=arguments;return new Promise(function(i,a){function o(t){e(c,i,a,o,s,"next",t)}function s(t){e(c,i,a,o,s,"throw",t)}var c=t.apply(n,r);o(void 0)})}}function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function i(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}function a(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}function o(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function s(t,e){if(t){if("string"==typeof t)return c(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(t,e):void 0}}function c(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function l(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=s(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return n=t[Symbol.iterator](),n.next.bind(n)}function u(){}function h(t,e,n,r,i,a,o,s,c,l){void 0===t&&(t=h.DEFAULT_IMAGE),void 0===e&&(e=h.DEFAULT_MAPPING),void 0===n&&(n=Do),void 0===r&&(r=Do),void 0===i&&(i=Ho),void 0===a&&(a=Uo),void 0===o&&(o=ns),void 0===s&&(s=ko),void 0===c&&(c=1),void 0===l&&(l=rc),Object.defineProperty(this,"id",{value:Lc++}),this.uuid=Sc.generateUUID(),this.name="",this.image=t,this.mipmaps=[],this.mapping=e,this.wrapS=n,this.wrapT=r,this.magFilter=i,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=s,this.offset=new Tc(0,0),this.repeat=new Tc(1,1),this.center=new Tc(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ec,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=l,this.version=0,this.onUpdate=null}function d(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?Ac.getDataURL(t):t.data?{data:Array.prototype.slice.call(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}function p(t,e,n,r,i){for(var a=0,o=t.length-3;a<=o;a+=3){Zc.fromArray(t,a);var s=i.x*Math.abs(Zc.x)+i.y*Math.abs(Zc.y)+i.z*Math.abs(Zc.z),c=e.dot(Zc),l=n.dot(Zc),u=r.dot(Zc);if(Math.max(-Math.max(c,l,u),Math.min(c,l,u))>s)return!1}return!0}function f(){function t(){i.setFromEuler(r,!1)}function e(){r.setFromQuaternion(i,void 0,!1)}Object.defineProperty(this,"id",{value:yl++}),this.uuid=Sc.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=f.DefaultUp.clone();var n=new Ic,r=new fl,i=new Oc,a=new Ic(1,1,1);r._onChange(t),i._onChange(e),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:n},rotation:{configurable:!0,enumerable:!0,value:r},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:a},modelViewMatrix:{value:new ol},normalMatrix:{value:new Ec}}),this.matrix=new ol,this.matrixWorld=new ol,this.matrixAutoUpdate=f.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new gl,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}function m(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}function v(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function g(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}function y(){Object.defineProperty(this,"id",{value:Ql++}),this.uuid=Sc.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.blending=ka,this.side=Fa,this.flatShading=!1,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=no,this.blendDst=ro,this.blendEquation=Xa,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=po,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=vc,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=mc,this.stencilZFail=mc,this.stencilZPass=mc,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}function x(t){y.call(this),this.type="MeshBasicMaterial",this.color=new Zl(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=yo,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.setValues(t)}function _(t,e,n){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===n,this.usage=gc,this.updateRange={offset:0,count:-1},this.version=0}function b(t,e,n){_.call(this,new Int8Array(t),e,n)}function w(t,e,n){_.call(this,new Uint8Array(t),e,n)}function M(t,e,n){_.call(this,new Uint8ClampedArray(t),e,n)}function S(t,e,n){_.call(this,new Int16Array(t),e,n)}function T(t,e,n){_.call(this,new Uint16Array(t),e,n)}function E(t,e,n){_.call(this,new Int32Array(t),e,n)}function A(t,e,n){_.call(this,new Uint32Array(t),e,n)}function L(t,e,n){_.call(this,new Uint16Array(t),e,n)}function R(t,e,n){_.call(this,new Float32Array(t),e,n)}function C(t,e,n){_.call(this,new Float64Array(t),e,n)}function P(t){if(0===t.length)return-1/0;for(var e=t[0],n=1,r=t.length;n<r;++n)t[n]>e&&(e=t[n]);return e}function O(t,e){return new tu[t](e)}function I(){Object.defineProperty(this,"id",{value:eu++}),this.uuid=Sc.generateUUID(),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={}}function D(t,e){void 0===t&&(t=new I),void 0===e&&(e=new x),f.call(this),this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}function N(t,e,n,r,i,a,o,s){if(null===(e.side===Ha?r.intersectTriangle(o,a,i,!0,s):r.intersectTriangle(i,a,o,e.side!==Ga,s)))return null;Su.copy(s),Su.applyMatrix4(t.matrixWorld);var c=n.ray.origin.distanceTo(Su);return c<n.near||c>n.far?null:{distance:c,point:Su.clone(),object:t}}function B(t,e,n,r,i,a,o,s,c,l,u,h){hu.fromBufferAttribute(i,l),du.fromBufferAttribute(i,u),pu.fromBufferAttribute(i,h);var d=t.morphTargetInfluences;if(e.morphTargets&&a&&d){gu.set(0,0,0),yu.set(0,0,0),xu.set(0,0,0);for(var p=0,f=a.length;p<f;p++){var m=d[p],v=a[p];0!==m&&(fu.fromBufferAttribute(v,l),mu.fromBufferAttribute(v,u),vu.fromBufferAttribute(v,h),o?(gu.addScaledVector(fu,m),yu.addScaledVector(mu,m),xu.addScaledVector(vu,m)):(gu.addScaledVector(fu.sub(hu),m),yu.addScaledVector(mu.sub(du),m),xu.addScaledVector(vu.sub(pu),m)))}hu.add(gu),du.add(yu),pu.add(xu)}t.isSkinnedMesh&&(t.boneTransform(l,hu),t.boneTransform(u,du),t.boneTransform(h,pu));var g=N(t,e,n,r,hu,du,pu,Mu);if(g){s&&(_u.fromBufferAttribute(s,l),bu.fromBufferAttribute(s,u),wu.fromBufferAttribute(s,h),g.uv=jl.getUV(Mu,hu,du,pu,_u,bu,wu,new Tc)),c&&(_u.fromBufferAttribute(c,l),bu.fromBufferAttribute(c,u),wu.fromBufferAttribute(c,h),g.uv2=jl.getUV(Mu,hu,du,pu,_u,bu,wu,new Tc));var y=new Jl(l,u,h);jl.getNormal(hu,du,pu,y.normal),g.face=y}return g}function z(t){var e={};for(var n in t){e[n]={};for(var r in t[n]){var i=t[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture)?e[n][r]=i.clone():Array.isArray(i)?e[n][r]=i.slice():e[n][r]=i}}return e}function F(t){for(var e={},n=0;n<t.length;n++){var r=z(t[n]);for(var i in r)e[i]=r[i]}return e}function H(t){y.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=Au,this.fragmentShader=Lu,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!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,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}function G(){f.call(this),this.type="Camera",this.matrixWorldInverse=new ol,this.projectionMatrix=new ol,this.projectionMatrixInverse=new ol}function U(t,e,n,r){void 0===t&&(t=50),void 0===e&&(e=1),void 0===n&&(n=.1),void 0===r&&(r=2e3),G.call(this),this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function k(t,e,n){if(f.call(this),this.type="CubeCamera",!0!==n.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=n;var r=new U(Ru,Cu,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new Ic(1,0,0)),this.add(r);var i=new U(Ru,Cu,t,e);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new Ic(-1,0,0)),this.add(i);var a=new U(Ru,Cu,t,e);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(new Ic(0,1,0)),this.add(a);var o=new U(Ru,Cu,t,e);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new Ic(0,-1,0)),this.add(o);var s=new U(Ru,Cu,t,e);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new Ic(0,0,1)),this.add(s);var c=new U(Ru,Cu,t,e);c.layers=this.layers,c.up.set(0,-1,0),c.lookAt(new Ic(0,0,-1)),this.add(c),this.update=function(t,e){null===this.parent&&this.updateMatrixWorld();var l=t.xr.enabled,u=t.getRenderTarget();t.xr.enabled=!1;var h=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,r),t.setRenderTarget(n,1),t.render(e,i),t.setRenderTarget(n,2),t.render(e,a),t.setRenderTarget(n,3),t.render(e,o),t.setRenderTarget(n,4),t.render(e,s),n.texture.generateMipmaps=h,t.setRenderTarget(n,5),t.render(e,c),t.setRenderTarget(u),t.xr.enabled=l}}function V(t,e,n,r,i,a,o,s,c,l){t=void 0!==t?t:[],e=void 0!==e?e:Ao,o=void 0!==o?o:es,h.call(this,t,e,n,r,i,a,o,s,c,l),this.flipY=!1,this._needsFlipEnvMap=!0}function W(t,e,n,r,i,a,o,s,c,l,u,d){h.call(this,null,a,o,s,c,l,r,i,u,d),this.image={data:t||null,width:e||1,height:n||1},this.magFilter=void 0!==c?c:Bo,this.minFilter=void 0!==l?l:Bo,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}function j(){function t(n,a){r(n,a),i=e.requestAnimationFrame(t)}var e=null,n=!1,r=null,i=null;return{start:function(){!0!==n&&null!==r&&(i=e.requestAnimationFrame(t),n=!0)},stop:function(){e.cancelAnimationFrame(i),n=!1},setAnimationLoop:function(t){r=t},setContext:function(t){e=t}}}function q(t,e){function n(e,n){var r=e.array,i=e.usage,a=t.createBuffer();t.bindBuffer(n,a),t.bufferData(n,r,i),e.onUploadCallback();var o=5126;return r instanceof Float32Array?o=5126:r instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):r instanceof Uint16Array?e.isFloat16BufferAttribute?s?o=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):o=5123:r instanceof Int16Array?o=5122:r instanceof Uint32Array?o=5125:r instanceof Int32Array?o=5124:r instanceof Int8Array?o=5120:r instanceof Uint8Array&&(o=5121),{buffer:a,type:o,bytesPerElement:r.BYTES_PER_ELEMENT,version:e.version}}function r(e,n,r){var i=n.array,a=n.updateRange;t.bindBuffer(r,e),-1===a.count?t.bufferSubData(r,0,i):(s?t.bufferSubData(r,a.offset*i.BYTES_PER_ELEMENT,i,a.offset,a.count):t.bufferSubData(r,a.offset*i.BYTES_PER_ELEMENT,i.subarray(a.offset,a.offset+a.count)),a.count=-1)}function i(t){return t.isInterleavedBufferAttribute&&(t=t.data),c.get(t)}function a(e){e.isInterleavedBufferAttribute&&(e=e.data);var n=c.get(e);n&&(t.deleteBuffer(n.buffer),c.delete(e))}function o(t,e){if(t.isGLBufferAttribute){var i=c.get(t);return void((!i||i.version<t.version)&&c.set(t,{buffer:t.buffer,type:t.type,bytesPerElement:t.elementSize,version:t.version}))}t.isInterleavedBufferAttribute&&(t=t.data);var a=c.get(t);void 0===a?c.set(t,n(t,e)):a.version<t.version&&(r(a.buffer,t,e),a.version=t.version)}var s=e.isWebGL2,c=new WeakMap;return{get:i,remove:a,update:o}}function X(t,e,n,r,i){function a(n,i,a,f){var m=!0===i.isScene?i.background:null;m&&m.isTexture&&(m=e.get(m));var v=t.xr,g=v.getSession&&v.getSession();g&&"additive"===g.environmentBlendMode&&(m=null),null===m?o(l,u):m&&m.isColor&&(o(m,1),f=!0),(t.autoClear||f)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),m&&(m.isCubeTexture||m.isWebGLCubeRenderTarget||m.mapping===Po)?(void 0===c&&(c=new D(new Tu(1,1,1),new H({name:"BackgroundCubeMaterial",uniforms:z(Fu.cube.uniforms),vertexShader:Fu.cube.vertexShader,fragmentShader:Fu.cube.fragmentShader,side:Ha,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(c)),m.isWebGLCubeRenderTarget&&(m=m.texture),c.material.uniforms.envMap.value=m,c.material.uniforms.flipEnvMap.value=m.isCubeTexture&&m._needsFlipEnvMap?-1:1,h===m&&d===m.version&&p===t.toneMapping||(c.material.needsUpdate=!0,h=m,d=m.version,p=t.toneMapping),n.unshift(c,c.geometry,c.material,0,0,null)):m&&m.isTexture&&(void 0===s&&(s=new D(new Nu(2,2),new H({name:"BackgroundMaterial",uniforms:z(Fu.background.uniforms),vertexShader:Fu.background.vertexShader,fragmentShader:Fu.background.fragmentShader,side:Fa,depthTest:!1,depthWrite:!1,fog:!1})),s.geometry.deleteAttribute("normal"),Object.defineProperty(s.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(s)),s.material.uniforms.t2D.value=m,!0===m.matrixAutoUpdate&&m.updateMatrix(),s.material.uniforms.uvTransform.value.copy(m.matrix),h===m&&d===m.version&&p===t.toneMapping||(s.material.needsUpdate=!0,h=m,d=m.version,p=t.toneMapping),n.unshift(s,s.geometry,s.material,0,0,null))}function o(t,e){n.buffers.color.setClear(t.r,t.g,t.b,e,i)}var s,c,l=new Zl(0),u=0,h=null,d=0,p=null;return{getClearColor:function(){return l},setClearColor:function(t,e){void 0===e&&(e=1),l.set(t),u=e,o(l,u)},getClearAlpha:function(){return u},setClearAlpha:function(t){u=t,o(l,u)},render:a}}function Y(t,e,n,r){function i(e,r,i,a,s){var l=!1;if(T){var d=c(a,i,r);L!==d&&(L=d,o(L.object)),l=u(a,s),l&&h(a,s)}else{var p=!0===r.wireframe;L.geometry===a.id&&L.program===i.id&&L.wireframe===p||(L.geometry=a.id,L.program=i.id,L.wireframe=p,l=!0)}!0===e.isInstancedMesh&&(l=!0),null!==s&&n.update(s,34963),l&&(g(e,r,i,a),null!==s&&t.bindBuffer(34963,n.get(s).buffer))}function a(){return r.isWebGL2?t.createVertexArray():S.createVertexArrayOES()}function o(e){return r.isWebGL2?t.bindVertexArray(e):S.bindVertexArrayOES(e)}function s(e){return r.isWebGL2?t.deleteVertexArray(e):S.deleteVertexArrayOES(e)}function c(t,e,n){var r=!0===n.wireframe,i=E[t.id];void 0===i&&(i={},E[t.id]=i);var o=i[e.id];void 0===o&&(o={},i[e.id]=o);var s=o[r];return void 0===s&&(s=l(a()),o[r]=s),s}function l(t){for(var e=[],n=[],r=[],i=0;i<M;i++)e[i]=0,n[i]=0,r[i]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:n,attributeDivisors:r,object:t,attributes:{},index:null}}function u(t,e){var n=L.attributes,r=t.attributes,i=0;for(var a in r){var o=n[a],s=r[a];if(void 0===o)return!0;if(o.attribute!==s)return!0;if(o.data!==s.data)return!0;i++}return L.attributesNum!==i||L.index!==e}function h(t,e){var n={},r=t.attributes,i=0;for(var a in r){var o=r[a],s={};s.attribute=o,o.data&&(s.data=o.data),n[a]=s,i++}L.attributes=n,L.attributesNum=i,L.index=e}function d(){for(var t=L.newAttributes,e=0,n=t.length;e<n;e++)t[e]=0}function p(t){f(t,0)}function f(n,i){var a=L.newAttributes,o=L.enabledAttributes,s=L.attributeDivisors;if(a[n]=1,0===o[n]&&(t.enableVertexAttribArray(n),o[n]=1),s[n]!==i){(r.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[r.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,i),s[n]=i}}function m(){for(var e=L.newAttributes,n=L.enabledAttributes,r=0,i=n.length;r<i;r++)n[r]!==e[r]&&(t.disableVertexAttribArray(r),n[r]=0)}function v(e,n,i,a,o,s){!0!==r.isWebGL2||5124!==i&&5125!==i?t.vertexAttribPointer(e,n,i,a,o,s):t.vertexAttribIPointer(e,n,i,o,s)}function g(i,a,o,s){if(!1!==r.isWebGL2||!i.isInstancedMesh&&!s.isInstancedBufferGeometry||null!==e.get("ANGLE_instanced_arrays")){d();var c=s.attributes,l=o.getAttributes(),u=a.defaultAttributeValues;for(var h in l){var g=l[h];if(g>=0){var y=c[h];if(void 0!==y){var x=y.normalized,_=y.itemSize,b=n.get(y);if(void 0===b)continue;var w=b.buffer,M=b.type,S=b.bytesPerElement;if(y.isInterleavedBufferAttribute){var T=y.data,E=T.stride,A=y.offset;T&&T.isInstancedInterleavedBuffer?(f(g,T.meshPerAttribute),void 0===s._maxInstanceCount&&(s._maxInstanceCount=T.meshPerAttribute*T.count)):p(g),t.bindBuffer(34962,w),v(g,_,M,x,E*S,A*S)}else y.isInstancedBufferAttribute?(f(g,y.meshPerAttribute),void 0===s._maxInstanceCount&&(s._maxInstanceCount=y.meshPerAttribute*y.count)):p(g),t.bindBuffer(34962,w),v(g,_,M,x,0,0)}else if("instanceMatrix"===h){var L=n.get(i.instanceMatrix);if(void 0===L)continue;var R=L.buffer,C=L.type;f(g+0,1),f(g+1,1),f(g+2,1),f(g+3,1),t.bindBuffer(34962,R),t.vertexAttribPointer(g+0,4,C,!1,64,0),t.vertexAttribPointer(g+1,4,C,!1,64,16),t.vertexAttribPointer(g+2,4,C,!1,64,32),t.vertexAttribPointer(g+3,4,C,!1,64,48)}else if("instanceColor"===h){var P=n.get(i.instanceColor);if(void 0===P)continue;var O=P.buffer,I=P.type;f(g,1),t.bindBuffer(34962,O),t.vertexAttribPointer(g,3,I,!1,12,0)}else if(void 0!==u){var D=u[h];if(void 0!==D)switch(D.length){case 2:t.vertexAttrib2fv(g,D);break;case 3:t.vertexAttrib3fv(g,D);break;case 4:t.vertexAttrib4fv(g,D);break;default:t.vertexAttrib1fv(g,D)}}}}m()}}function y(){b();for(var t in E){var e=E[t];for(var n in e){var r=e[n];for(var i in r)s(r[i].object),delete r[i];delete e[n]}delete E[t]}}function x(t){if(void 0!==E[t.id]){var e=E[t.id];for(var n in e){var r=e[n];for(var i in r)s(r[i].object),delete r[i];delete e[n]}delete E[t.id]}}function _(t){for(var e in E){var n=E[e];if(void 0!==n[t.id]){var r=n[t.id];for(var i in r)s(r[i].object),delete r[i];delete n[t.id]}}}function b(){w(),L!==A&&(L=A,o(L.object))}function w(){A.geometry=null,A.program=null,A.wireframe=!1}var M=t.getParameter(34921),S=r.isWebGL2?null:e.get("OES_vertex_array_object"),T=r.isWebGL2||null!==S,E={},A=l(null),L=A;return{setup:i,reset:b,resetDefaultState:w,dispose:y,releaseStatesOfGeometry:x,releaseStatesOfProgram:_,initAttributes:d,enableAttribute:p,disableUnusedAttributes:m}}function Z(t,e,n,r){function i(t){s=t}function a(e,r){t.drawArrays(s,e,r),n.update(r,s,1)}function o(r,i,a){if(0!==a){var o,l;if(c)o=t,l="drawArraysInstanced";else if(o=e.get("ANGLE_instanced_arrays"),l="drawArraysInstancedANGLE",null===o)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");o[l](s,r,i,a),n.update(i,s,a)}}var s,c=r.isWebGL2;this.setMode=i,this.render=a,this.renderInstances=o}function J(t,e,n){function r(){if(void 0!==a)return a;var n=e.get("EXT_texture_filter_anisotropic");return a=null!==n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}function i(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}var a,o="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext,s=void 0!==n.precision?n.precision:"highp",c=i(s);c!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",c,"instead."),s=c);var l=!0===n.logarithmicDepthBuffer,u=t.getParameter(34930),h=t.getParameter(35660),d=t.getParameter(3379),p=t.getParameter(34076),f=t.getParameter(34921),m=t.getParameter(36347),v=t.getParameter(36348),g=t.getParameter(36349),y=h>0,x=o||!!e.get("OES_texture_float");return{isWebGL2:o,getMaxAnisotropy:r,getMaxPrecision:i,precision:s,logarithmicDepthBuffer:l,maxTextures:u,maxVertexTextures:h,maxTextureSize:d,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:m,maxVaryings:v,maxFragmentUniforms:g,vertexTextures:y,floatFragmentTextures:x,floatVertexTextures:y&&x,maxSamples:o?t.getParameter(36183):0}}function Q(t){function e(){u.value!==i&&(u.value=i,u.needsUpdate=a>0),r.numPlanes=a,r.numIntersection=0}function n(t,e,n,i){var a=null!==t?t.length:0,o=null;if(0!==a){if(o=u.value,!0!==i||null===o){var s=n+4*a,h=e.matrixWorldInverse;l.getNormalMatrix(h),(null===o||o.length<s)&&(o=new Float32Array(s));for(var d=0,p=n;d!==a;++d,p+=4)c.copy(t[d]).applyMatrix4(h,l),c.normal.toArray(o,p),o[p+3]=c.constant}u.value=o,u.needsUpdate=!0}return r.numPlanes=a,r.numIntersection=0,o}var r=this,i=null,a=0,o=!1,s=!1,c=new Dl,l=new Ec,u={value:null,needsUpdate:!1};this.uniform=u,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e,r){var s=0!==t.length||e||0!==a||o;return o=e,i=n(t,r,0),a=t.length,s},this.beginShadows=function(){s=!0,n(null)},this.endShadows=function(){s=!1,e()},this.setState=function(r,c,l){var h=r.clippingPlanes,d=r.clipIntersection,p=r.clipShadows,f=t.get(r);if(!o||null===h||0===h.length||s&&!p)s?n(null):e();else{var m=s?0:a,v=4*m,g=f.clippingState||null;u.value=g,g=n(h,c,v,l);for(var y=0;y!==v;++y)g[y]=i[y];f.clippingState=g,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=m}}}function K(t){function e(t,e){return e===Ro?t.mapping=Ao:e===Co&&(t.mapping=Lo),t}function n(n){if(n&&n.isTexture){var i=n.mapping;if(i===Ro||i===Co){if(a.has(n)){return e(a.get(n).texture,n.mapping)}var o=n.image;if(o&&o.height>0){var s=t.getRenderList(),c=t.getRenderTarget(),l=new Pu(o.height/2);return l.fromEquirectangularTexture(t,n),a.set(n,l),t.setRenderTarget(c),t.setRenderList(s),n.addEventListener("dispose",r),e(l.texture,n.mapping)}return null}}return n}function r(t){var e=t.target;e.removeEventListener("dispose",r);var n=a.get(e);void 0!==n&&(a.delete(e),n.dispose())}function i(){a=new WeakMap}var a=new WeakMap;return{get:n,dispose:i}}function $(t){function e(e){if(void 0!==n[e])return n[e];var r;switch(e){case"WEBGL_depth_texture":r=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=t.getExtension(e)}return n[e]=r,r}var n={};return{has:function(t){return null!==e(t)},init:function(t){t.isWebGL2?e("EXT_color_buffer_float"):(e("WEBGL_depth_texture"),e("OES_texture_float"),e("OES_texture_half_float"),e("OES_texture_half_float_linear"),e("OES_standard_derivatives"),e("OES_element_index_uint"),e("OES_vertex_array_object"),e("ANGLE_instanced_arrays")),e("OES_texture_float_linear"),e("EXT_color_buffer_half_float")},get:function(t){var n=e(t);return null===n&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),n}}}function tt(t,e,n,r){function i(t){var a=t.target;null!==a.index&&e.remove(a.index);for(var o in a.attributes)e.remove(a.attributes[o]);a.removeEventListener("dispose",i),delete l[a.id];var s=u.get(a);s&&(e.remove(s),u.delete(a)),r.releaseStatesOfGeometry(a),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,n.memory.geometries--}function a(t,e){return!0===l[e.id]?e:(e.addEventListener("dispose",i),l[e.id]=!0,n.memory.geometries++,e)}function o(t){var n=t.attributes;for(var r in n)e.update(n[r],34962);var i=t.morphAttributes;for(var a in i)for(var o=i[a],s=0,c=o.length;s<c;s++)e.update(o[s],34962)}function s(t){var n=[],r=t.index,i=t.attributes.position,a=0;if(null!==r){var o=r.array;a=r.version;for(var s=0,c=o.length;s<c;s+=3){var l=o[s+0],h=o[s+1],d=o[s+2];n.push(l,h,h,d,d,l)}}else{var p=i.array;a=i.version;for(var f=0,m=p.length/3-1;f<m;f+=3){var v=f+0,g=f+1,y=f+2;n.push(v,g,g,y,y,v)}}var x=new(P(n)>65535?A:T)(n,1);x.version=a;var _=u.get(t);_&&e.remove(_),u.set(t,x)}function c(t){var e=u.get(t);if(e){var n=t.index;null!==n&&e.version<n.version&&s(t)}else s(t);return u.get(t)}var l={},u=new WeakMap;return{get:a,update:o,getWireframeAttribute:c}}function et(t,e,n,r){function i(t){c=t}function a(t){l=t.type,u=t.bytesPerElement}function o(e,r){t.drawElements(c,r,l,e*u),n.update(r,c,1)}function s(r,i,a){if(0!==a){var o,s;if(h)o=t,s="drawElementsInstanced";else if(o=e.get("ANGLE_instanced_arrays"),s="drawElementsInstancedANGLE",null===o)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");o[s](c,i,l,r*u,a),n.update(i,c,a)}}var c,l,u,h=r.isWebGL2;this.setMode=i,this.setIndex=a,this.render=o,this.renderInstances=s}function nt(t){function e(t,e,n){switch(i.calls++,e){case 4:i.triangles+=n*(t/3);break;case 1:i.lines+=n*(t/2);break;case 3:i.lines+=n*(t-1);break;case 2:i.lines+=n*t;break;case 0:i.points+=n*t;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",e)}}function n(){i.frame++,i.calls=0,i.triangles=0,i.points=0,i.lines=0}var r={geometries:0,textures:0},i={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:r,render:i,programs:null,autoReset:!0,reset:n,update:e}}function rt(t,e){return t[0]-e[0]}function it(t,e){return Math.abs(e[1])-Math.abs(t[1])}function at(t){function e(e,a,o,s){var c=e.morphTargetInfluences,l=void 0===c?0:c.length,u=n[a.id];if(void 0===u){u=[];for(var h=0;h<l;h++)u[h]=[h,0];n[a.id]=u}for(var d=0;d<l;d++){var p=u[d];p[0]=d,p[1]=c[d]}u.sort(it);for(var f=0;f<8;f++)f<l&&u[f][1]?(i[f][0]=u[f][0],i[f][1]=u[f][1]):(i[f][0]=Number.MAX_SAFE_INTEGER,i[f][1]=0);i.sort(rt);for(var m=o.morphTargets&&a.morphAttributes.position,v=o.morphNormals&&a.morphAttributes.normal,g=0,y=0;y<8;y++){var x=i[y],_=x[0],b=x[1];_!==Number.MAX_SAFE_INTEGER&&b?(m&&a.getAttribute("morphTarget"+y)!==m[_]&&a.setAttribute("morphTarget"+y,m[_]),v&&a.getAttribute("morphNormal"+y)!==v[_]&&a.setAttribute("morphNormal"+y,v[_]),r[y]=b,g+=b):(m&&!0===a.hasAttribute("morphTarget"+y)&&a.deleteAttribute("morphTarget"+y),v&&!0===a.hasAttribute("morphNormal"+y)&&a.deleteAttribute("morphNormal"+y),r[y]=0)}var w=a.morphTargetsRelative?1:1-g;s.getUniforms().setValue(t,"morphTargetBaseInfluence",w),s.getUniforms().setValue(t,"morphTargetInfluences",r)}for(var n={},r=new Float32Array(8),i=[],a=0;a<8;a++)i[a]=[a,0];return{update:e}}function ot(t,e,n,r){function i(t){var i=r.render.frame,a=t.geometry,c=e.get(t,a);return s.get(c)!==i&&(e.update(c),s.set(c,i)),t.isInstancedMesh&&(!1===t.hasEventListener("dispose",o)&&t.addEventListener("dispose",o),n.update(t.instanceMatrix,34962),null!==t.instanceColor&&n.update(t.instanceColor,34962)),c}function a(){s=new WeakMap}function o(t){var e=t.target;e.removeEventListener("dispose",o),n.remove(e.instanceMatrix),null!==e.instanceColor&&n.remove(e.instanceColor)}var s=new WeakMap;return{update:i,dispose:a}}function st(t,e,n,r){void 0===t&&(t=null),void 0===e&&(e=1),void 0===n&&(n=1),void 0===r&&(r=1),h.call(this,null),this.image={data:t,width:e,height:n,depth:r},this.magFilter=Bo,this.minFilter=Bo,this.wrapR=Do,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}function ct(t,e,n,r){void 0===t&&(t=null),void 0===e&&(e=1),void 0===n&&(n=1),void 0===r&&(r=1),h.call(this,null),this.image={data:t,width:e,height:n,depth:r},this.magFilter=Bo,this.minFilter=Bo,this.wrapR=Do,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}function lt(t,e,n){var r=t[0];if(r<=0||r>0)return t;var i=e*n,a=Vu[i];if(void 0===a&&(a=new Float32Array(i),Vu[i]=a),0!==e){r.toArray(a,0);for(var o=1,s=0;o!==e;++o)s+=n,t[o].toArray(a,s)}return a}function ut(t,e){if(t.length!==e.length)return!1;for(var n=0,r=t.length;n<r;n++)if(t[n]!==e[n])return!1;return!0}function ht(t,e){for(var n=0,r=e.length;n<r;n++)t[n]=e[n]}function dt(t,e){var n=Wu[e];void 0===n&&(n=new Int32Array(e),Wu[e]=n);for(var r=0;r!==e;++r)n[r]=t.allocateTextureUnit();return n}function pt(t,e){var n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function ft(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(ut(n,e))return;t.uniform2fv(this.addr,e),ht(n,e)}}function mt(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(void 0!==e.r)n[0]===e.r&&n[1]===e.g&&n[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(ut(n,e))return;t.uniform3fv(this.addr,e),ht(n,e)}}function vt(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(ut(n,e))return;t.uniform4fv(this.addr,e),ht(n,e)}}function gt(t,e){var n=this.cache,r=e.elements;if(void 0===r){if(ut(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),ht(n,e)}else{if(ut(n,r))return;Xu.set(r),t.uniformMatrix2fv(this.addr,!1,Xu),ht(n,r)}}function yt(t,e){var n=this.cache,r=e.elements;if(void 0===r){if(ut(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),ht(n,e)}else{if(ut(n,r))return;qu.set(r),t.uniformMatrix3fv(this.addr,!1,qu),ht(n,r)}}function xt(t,e){var n=this.cache,r=e.elements;if(void 0===r){if(ut(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),ht(n,e)}else{if(ut(n,r))return;ju.set(r),t.uniformMatrix4fv(this.addr,!1,ju),ht(n,r)}}function _t(t,e,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.safeSetTexture2D(e||Hu,i)}function bt(t,e,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(e||Gu,i)}function wt(t,e,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(e||Uu,i)}function Mt(t,e,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.safeSetTextureCube(e||ku,i)}function St(t,e){var n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}
  127. function Tt(t,e){var n=this.cache;ut(n,e)||(t.uniform2iv(this.addr,e),ht(n,e))}function Et(t,e){var n=this.cache;ut(n,e)||(t.uniform3iv(this.addr,e),ht(n,e))}function At(t,e){var n=this.cache;ut(n,e)||(t.uniform4iv(this.addr,e),ht(n,e))}function Lt(t,e){var n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function Rt(t){switch(t){case 5126:return pt;case 35664:return ft;case 35665:return mt;case 35666:return vt;case 35674:return gt;case 35675:return yt;case 35676:return xt;case 5124:case 35670:return St;case 35667:case 35671:return Tt;case 35668:case 35672:return Et;case 35669:case 35673:return At;case 5125:return Lt;case 35678:case 36198:case 36298:case 36306:case 35682:return _t;case 35679:case 36299:case 36307:return wt;case 35680:case 36300:case 36308:case 36293:return Mt;case 36289:case 36303:case 36311:case 36292:return bt}}function Ct(t,e){t.uniform1fv(this.addr,e)}function Pt(t,e){t.uniform1iv(this.addr,e)}function Ot(t,e){t.uniform2iv(this.addr,e)}function It(t,e){t.uniform3iv(this.addr,e)}function Dt(t,e){t.uniform4iv(this.addr,e)}function Nt(t,e){var n=lt(e,this.size,2);t.uniform2fv(this.addr,n)}function Bt(t,e){var n=lt(e,this.size,3);t.uniform3fv(this.addr,n)}function zt(t,e){var n=lt(e,this.size,4);t.uniform4fv(this.addr,n)}function Ft(t,e){var n=lt(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function Ht(t,e){var n=lt(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function Gt(t,e){var n=lt(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function Ut(t,e,n){var r=e.length,i=dt(n,r);t.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.safeSetTexture2D(e[a]||Hu,i[a])}function kt(t,e,n){var r=e.length,i=dt(n,r);t.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.safeSetTextureCube(e[a]||ku,i[a])}function Vt(t){switch(t){case 5126:return Ct;case 35664:return Nt;case 35665:return Bt;case 35666:return zt;case 35674:return Ft;case 35675:return Ht;case 35676:return Gt;case 5124:case 35670:return Pt;case 35667:case 35671:return Ot;case 35668:case 35672:return It;case 35669:case 35673:return Dt;case 35678:case 36198:case 36298:case 36306:case 35682:return Ut;case 35680:case 36300:case 36308:case 36293:return kt}}function Wt(t,e,n){this.id=t,this.addr=n,this.cache=[],this.setValue=Rt(e.type)}function jt(t,e,n){this.id=t,this.addr=n,this.cache=[],this.size=e.size,this.setValue=Vt(e.type)}function qt(t){this.id=t,this.seq=[],this.map={}}function Xt(t,e){t.seq.push(e),t.map[e.id]=e}function Yt(t,e,n){var r=t.name,i=r.length;for(Yu.lastIndex=0;;){var a=Yu.exec(r),o=Yu.lastIndex,s=a[1],c="]"===a[2],l=a[3];if(c&&(s|=0),void 0===l||"["===l&&o+2===i){Xt(n,void 0===l?new Wt(s,t,e):new jt(s,t,e));break}var u=n.map,h=u[s];void 0===h&&(h=new qt(s),Xt(n,h)),n=h}}function Zt(t,e){this.seq=[],this.map={};for(var n=t.getProgramParameter(e,35718),r=0;r<n;++r){var i=t.getActiveUniform(e,r);Yt(i,t.getUniformLocation(e,i.name),this)}}function Jt(t,e,n){var r=t.createShader(e);return t.shaderSource(r,n),t.compileShader(r),r}function Qt(t){for(var e=t.split("\n"),n=0;n<e.length;n++)e[n]=n+1+": "+e[n];return e.join("\n")}function Kt(t){switch(t){case rc:return["Linear","( value )"];case ic:return["sRGB","( value )"];case oc:return["RGBE","( value )"];case cc:return["RGBM","( value, 7.0 )"];case lc:return["RGBM","( value, 16.0 )"];case uc:return["RGBD","( value, 256.0 )"];case ac:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case sc:return["LogLuv","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",t),["Linear","( value )"]}}function $t(t,e,n){var r=t.getShaderParameter(e,35713),i=t.getShaderInfoLog(e).trim();return r&&""===i?"":"THREE.WebGLShader: gl.getShaderInfoLog() "+n+"\n"+i+Qt(t.getShaderSource(e))}function te(t,e){var n=Kt(e);return"vec4 "+t+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function ee(t,e){var n=Kt(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function ne(t,e){var n;switch(e){case wo:n="Linear";break;case Mo:n="Reinhard";break;case So:n="OptimizedCineon";break;case To:n="ACESFilmic";break;case Eo:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function re(t){return[t.extensionDerivatives||t.envMapCubeUV||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(oe).join("\n")}function ie(t){var e=[];for(var n in t){var r=t[n];!1!==r&&e.push("#define "+n+" "+r)}return e.join("\n")}function ae(t,e){for(var n={},r=t.getProgramParameter(e,35721),i=0;i<r;i++){var a=t.getActiveAttrib(e,i),o=a.name;n[o]=t.getAttribLocation(e,o)}return n}function oe(t){return""!==t}function se(t,e){return t.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 ce(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}function le(t){return t.replace(Ju,ue)}function ue(t,e){var n=Bu[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return le(n)}function he(t){return t.replace(Ku,pe).replace(Qu,de)}function de(t,e,n,r){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),pe(t,e,n,r)}function pe(t,e,n,r){for(var i="",a=parseInt(e);a<parseInt(n);a++)i+=r.replace(/\[\s*i\s*\]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return i}function fe(t){var e="precision "+t.precision+" float;\nprecision "+t.precision+" int;";return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function me(t){var e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===Na?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===Ba?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===za&&(e="SHADOWMAP_TYPE_VSM"),e}function ve(t){var e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case Ao:case Lo:e="ENVMAP_TYPE_CUBE";break;case Po:case Oo:e="ENVMAP_TYPE_CUBE_UV"}return e}function ge(t){var e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case Lo:case Oo:e="ENVMAP_MODE_REFRACTION"}return e}function ye(t){var e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case yo:e="ENVMAP_BLENDING_MULTIPLY";break;case xo:e="ENVMAP_BLENDING_MIX";break;case _o:e="ENVMAP_BLENDING_ADD"}return e}function xe(t,e,n,r){var i,a,o=t.getContext(),s=n.defines,c=n.vertexShader,l=n.fragmentShader,u=me(n),h=ve(n),d=ge(n),p=ye(n),f=t.gammaFactor>0?t.gammaFactor:1,m=n.isWebGL2?"":re(n),v=ie(s),g=o.createProgram(),y=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?(i=[v].filter(oe).join("\n"),i.length>0&&(i+="\n"),a=[m,v].filter(oe).join("\n"),a.length>0&&(a+="\n")):(i=[fe(n),"#define SHADER_NAME "+n.shaderName,v,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+f,"#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+u:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.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","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(oe).join("\n"),a=[m,fe(n),"#define SHADER_NAME "+n.shaderName,v,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+f,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.envMap?"#define "+d:"",n.envMap?"#define "+p:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.sheen?"#define USE_SHEEN":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+u:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==bo?"#define TONE_MAPPING":"",n.toneMapping!==bo?Bu.tonemapping_pars_fragment:"",n.toneMapping!==bo?ne("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",Bu.encodings_pars_fragment,n.map?te("mapTexelToLinear",n.mapEncoding):"",n.matcap?te("matcapTexelToLinear",n.matcapEncoding):"",n.envMap?te("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMap?te("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMap?te("lightMapTexelToLinear",n.lightMapEncoding):"",ee("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(oe).join("\n")),c=le(c),c=se(c,n),c=ce(c,n),l=le(l),l=se(l,n),l=ce(l,n),c=he(c),l=he(l),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(y="#version 300 es\n",i=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+i,a=["#define varying in",n.glslVersion===xc?"":"out highp vec4 pc_fragColor;",n.glslVersion===xc?"":"#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("\n")+"\n"+a);var x=y+i+c,_=y+a+l,b=Jt(o,35633,x),w=Jt(o,35632,_);if(o.attachShader(g,b),o.attachShader(g,w),void 0!==n.index0AttributeName?o.bindAttribLocation(g,0,n.index0AttributeName):!0===n.morphTargets&&o.bindAttribLocation(g,0,"position"),o.linkProgram(g),t.debug.checkShaderErrors){var M=o.getProgramInfoLog(g).trim(),S=o.getShaderInfoLog(b).trim(),T=o.getShaderInfoLog(w).trim(),E=!0,A=!0;if(!1===o.getProgramParameter(g,35714)){E=!1;var L=$t(o,b,"vertex"),R=$t(o,w,"fragment");console.error("THREE.WebGLProgram: shader error: ",o.getError(),"35715",o.getProgramParameter(g,35715),"gl.getProgramInfoLog",M,L,R)}else""!==M?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",M):""!==S&&""!==T||(A=!1);A&&(this.diagnostics={runnable:E,programLog:M,vertexShader:{log:S,prefix:i},fragmentShader:{log:T,prefix:a}})}o.deleteShader(b),o.deleteShader(w);var C;this.getUniforms=function(){return void 0===C&&(C=new Zt(o,g)),C};var P;return this.getAttributes=function(){return void 0===P&&(P=ae(o,g)),P},this.destroy=function(){r.releaseStatesOfProgram(this),o.deleteProgram(g),this.program=void 0},this.name=n.shaderName,this.id=Zu++,this.cacheKey=e,this.usedTimes=1,this.program=g,this.vertexShader=b,this.fragmentShader=w,this}function _e(t,e,n,r,i,a){function o(t){var e=t.skeleton,n=e.bones;if(v)return 1024;var r=g,i=Math.floor((r-20)/4),a=Math.min(i,n.length);return a<n.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+n.length+" bones. This GPU supports "+a+"."),0):a}function s(t){var e;return t&&t.isTexture?e=t.encoding:t&&t.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),e=t.texture.encoding):e=rc,e}function c(i,c,l,u,h){var d=u.fog,p=i.isMeshStandardMaterial?u.environment:null,g=e.get(i.envMap||p),b=_[i.type],w=h.isSkinnedMesh?o(h):0;null!==i.precision&&(x=r.getMaxPrecision(i.precision))!==i.precision&&console.warn("THREE.WebGLProgram.getParameters:",i.precision,"not supported, using",x,"instead.");var M,S;if(b){var T=Fu[b];M=T.vertexShader,S=T.fragmentShader}else M=i.vertexShader,S=i.fragmentShader;var E=t.getRenderTarget();return{isWebGL2:f,shaderID:b,shaderName:i.type,vertexShader:M,fragmentShader:S,defines:i.defines,isRawShaderMaterial:!0===i.isRawShaderMaterial,glslVersion:i.glslVersion,precision:x,instancing:!0===h.isInstancedMesh,instancingColor:!0===h.isInstancedMesh&&null!==h.instanceColor,supportsVertexTextures:y,outputEncoding:null!==E?s(E.texture):t.outputEncoding,map:!!i.map,mapEncoding:s(i.map),matcap:!!i.matcap,matcapEncoding:s(i.matcap),envMap:!!g,envMapMode:g&&g.mapping,envMapEncoding:s(g),envMapCubeUV:!!g&&(g.mapping===Po||g.mapping===Oo),lightMap:!!i.lightMap,lightMapEncoding:s(i.lightMap),aoMap:!!i.aoMap,emissiveMap:!!i.emissiveMap,emissiveMapEncoding:s(i.emissiveMap),bumpMap:!!i.bumpMap,normalMap:!!i.normalMap,objectSpaceNormalMap:i.normalMapType===fc,tangentSpaceNormalMap:i.normalMapType===pc,clearcoatMap:!!i.clearcoatMap,clearcoatRoughnessMap:!!i.clearcoatRoughnessMap,clearcoatNormalMap:!!i.clearcoatNormalMap,displacementMap:!!i.displacementMap,roughnessMap:!!i.roughnessMap,metalnessMap:!!i.metalnessMap,specularMap:!!i.specularMap,alphaMap:!!i.alphaMap,gradientMap:!!i.gradientMap,sheen:!!i.sheen,transmissionMap:!!i.transmissionMap,combine:i.combine,vertexTangents:i.normalMap&&i.vertexTangents,vertexColors:i.vertexColors,vertexUvs:!!(i.map||i.bumpMap||i.normalMap||i.specularMap||i.alphaMap||i.emissiveMap||i.roughnessMap||i.metalnessMap||i.clearcoatMap||i.clearcoatRoughnessMap||i.clearcoatNormalMap||i.displacementMap||i.transmissionMap),uvsVertexOnly:!(i.map||i.bumpMap||i.normalMap||i.specularMap||i.alphaMap||i.emissiveMap||i.roughnessMap||i.metalnessMap||i.clearcoatNormalMap||i.transmissionMap||!i.displacementMap),fog:!!d,useFog:i.fog,fogExp2:d&&d.isFogExp2,flatShading:i.flatShading,sizeAttenuation:i.sizeAttenuation,logarithmicDepthBuffer:m,skinning:i.skinning&&w>0,maxBones:w,useVertexTexture:v,morphTargets:i.morphTargets,morphNormals:i.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:c.directional.length,numPointLights:c.point.length,numSpotLights:c.spot.length,numRectAreaLights:c.rectArea.length,numHemiLights:c.hemi.length,numDirLightShadows:c.directionalShadowMap.length,numPointLightShadows:c.pointShadowMap.length,numSpotLightShadows:c.spotShadowMap.length,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:i.dithering,shadowMapEnabled:t.shadowMap.enabled&&l.length>0,shadowMapType:t.shadowMap.type,toneMapping:i.toneMapped?t.toneMapping:bo,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:i.premultipliedAlpha,alphaTest:i.alphaTest,doubleSided:i.side===Ga,flipSided:i.side===Ha,depthPacking:void 0!==i.depthPacking&&i.depthPacking,index0AttributeName:i.index0AttributeName,extensionDerivatives:i.extensions&&i.extensions.derivatives,extensionFragDepth:i.extensions&&i.extensions.fragDepth,extensionDrawBuffers:i.extensions&&i.extensions.drawBuffers,extensionShaderTextureLOD:i.extensions&&i.extensions.shaderTextureLOD,rendererExtensionFragDepth:f||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:f||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:f||n.has("EXT_shader_texture_lod"),customProgramCacheKey:i.customProgramCacheKey()}}function l(e){var n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.fragmentShader),n.push(e.vertexShader)),void 0!==e.defines)for(var r in e.defines)n.push(r),n.push(e.defines[r]);if(!1===e.isRawShaderMaterial){for(var i=0;i<b.length;i++)n.push(e[b[i]]);n.push(t.outputEncoding),n.push(t.gammaFactor)}return n.push(e.customProgramCacheKey),n.join()}function u(t){var e,n=_[t.type];if(n){var r=Fu[n];e=Eu.clone(r.uniforms)}else e=t.uniforms;return e}function h(e,n){for(var r,a=0,o=p.length;a<o;a++){var s=p[a];if(s.cacheKey===n){r=s,++r.usedTimes;break}}return void 0===r&&(r=new xe(t,n,e,i),p.push(r)),r}function d(t){if(0==--t.usedTimes){var e=p.indexOf(t);p[e]=p[p.length-1],p.pop(),t.destroy()}}var p=[],f=r.isWebGL2,m=r.logarithmicDepthBuffer,v=r.floatVertexTextures,g=r.maxVertexUniforms,y=r.vertexTextures,x=r.precision,_={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"},b=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen","transmissionMap"];return{getParameters:c,getProgramCacheKey:l,getUniforms:u,acquireProgram:h,releaseProgram:d,programs:p}}function be(){function t(t){var e=i.get(t);return void 0===e&&(e={},i.set(t,e)),e}function e(t){i.delete(t)}function n(t,e,n){i.get(t)[e]=n}function r(){i=new WeakMap}var i=new WeakMap;return{get:t,remove:e,update:n,dispose:r}}function we(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program!==e.program?t.program.id-e.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function Me(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Se(t){function e(){c=0,l.length=0,u.length=0}function n(e,n,r,i,a,o){var l=s[c],u=t.get(r);return void 0===l?(l={id:e.id,object:e,geometry:n,material:r,program:u.program||h,groupOrder:i,renderOrder:e.renderOrder,z:a,group:o},s[c]=l):(l.id=e.id,l.object=e,l.geometry=n,l.material=r,l.program=u.program||h,l.groupOrder=i,l.renderOrder=e.renderOrder,l.z=a,l.group=o),c++,l}function r(t,e,r,i,a,o){var s=n(t,e,r,i,a,o);(!0===r.transparent?u:l).push(s)}function i(t,e,r,i,a,o){var s=n(t,e,r,i,a,o);(!0===r.transparent?u:l).unshift(s)}function a(t,e){l.length>1&&l.sort(t||we),u.length>1&&u.sort(e||Me)}function o(){for(var t=c,e=s.length;t<e;t++){var n=s[t];if(null===n.id)break;n.id=null,n.object=null,n.geometry=null,n.material=null,n.program=null,n.group=null}}var s=[],c=0,l=[],u=[],h={id:-1};return{opaque:l,transparent:u,init:e,push:r,unshift:i,finish:o,sort:a}}function Te(t){function e(e,n){var i,a=r.get(e);return void 0===a?(i=new Se(t),r.set(e,new WeakMap),r.get(e).set(n,i)):void 0===(i=a.get(n))&&(i=new Se(t),a.set(n,i)),i}function n(){r=new WeakMap}var r=new WeakMap;return{get:e,dispose:n}}function Ee(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];var n;switch(e.type){case"DirectionalLight":n={direction:new Ic,color:new Zl};break;case"SpotLight":n={position:new Ic,direction:new Ic,color:new Zl,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Ic,color:new Zl,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Ic,skyColor:new Zl,groundColor:new Zl};break;case"RectAreaLight":n={color:new Zl,position:new Ic,halfWidth:new Ic,halfHeight:new Ic}}return t[e.id]=n,n}}}function Ae(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];var n;switch(e.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Tc};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Tc,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}}function Le(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function Re(t,e){function n(n){for(var r=0,s=0,c=0,l=0;l<9;l++)o.probe[l].set(0,0,0);var u=0,h=0,d=0,p=0,f=0,m=0,v=0,g=0;n.sort(Le);for(var y=0,x=n.length;y<x;y++){var _=n[y],b=_.color,w=_.intensity,M=_.distance,S=_.shadow&&_.shadow.map?_.shadow.map.texture:null;if(_.isAmbientLight)r+=b.r*w,s+=b.g*w,c+=b.b*w;else if(_.isLightProbe)for(var T=0;T<9;T++)o.probe[T].addScaledVector(_.sh.coefficients[T],w);else if(_.isDirectionalLight){var E=i.get(_);if(E.color.copy(_.color).multiplyScalar(_.intensity),_.castShadow){var A=_.shadow,L=a.get(_);L.shadowBias=A.bias,L.shadowNormalBias=A.normalBias,L.shadowRadius=A.radius,L.shadowMapSize=A.mapSize,o.directionalShadow[u]=L,o.directionalShadowMap[u]=S,o.directionalShadowMatrix[u]=_.shadow.matrix,m++}o.directional[u]=E,u++}else if(_.isSpotLight){var R=i.get(_);if(R.position.setFromMatrixPosition(_.matrixWorld),R.color.copy(b).multiplyScalar(w),R.distance=M,R.coneCos=Math.cos(_.angle),R.penumbraCos=Math.cos(_.angle*(1-_.penumbra)),R.decay=_.decay,_.castShadow){var C=_.shadow,P=a.get(_);P.shadowBias=C.bias,P.shadowNormalBias=C.normalBias,P.shadowRadius=C.radius,P.shadowMapSize=C.mapSize,o.spotShadow[d]=P,o.spotShadowMap[d]=S,o.spotShadowMatrix[d]=_.shadow.matrix,g++}o.spot[d]=R,d++}else if(_.isRectAreaLight){var O=i.get(_);O.color.copy(b).multiplyScalar(w),O.halfWidth.set(.5*_.width,0,0),O.halfHeight.set(0,.5*_.height,0),o.rectArea[p]=O,p++}else if(_.isPointLight){var I=i.get(_);if(I.color.copy(_.color).multiplyScalar(_.intensity),I.distance=_.distance,I.decay=_.decay,_.castShadow){var D=_.shadow,N=a.get(_);N.shadowBias=D.bias,N.shadowNormalBias=D.normalBias,N.shadowRadius=D.radius,N.shadowMapSize=D.mapSize,N.shadowCameraNear=D.camera.near,N.shadowCameraFar=D.camera.far,o.pointShadow[h]=N,o.pointShadowMap[h]=S,o.pointShadowMatrix[h]=_.shadow.matrix,v++}o.point[h]=I,h++}else if(_.isHemisphereLight){var B=i.get(_);B.skyColor.copy(_.color).multiplyScalar(w),B.groundColor.copy(_.groundColor).multiplyScalar(w),o.hemi[f]=B,f++}}p>0&&(e.isWebGL2?(o.rectAreaLTC1=zu.LTC_FLOAT_1,o.rectAreaLTC2=zu.LTC_FLOAT_2):!0===t.has("OES_texture_float_linear")?(o.rectAreaLTC1=zu.LTC_FLOAT_1,o.rectAreaLTC2=zu.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(o.rectAreaLTC1=zu.LTC_HALF_1,o.rectAreaLTC2=zu.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),o.ambient[0]=r,o.ambient[1]=s,o.ambient[2]=c;var z=o.hash;z.directionalLength===u&&z.pointLength===h&&z.spotLength===d&&z.rectAreaLength===p&&z.hemiLength===f&&z.numDirectionalShadows===m&&z.numPointShadows===v&&z.numSpotShadows===g||(o.directional.length=u,o.spot.length=d,o.rectArea.length=p,o.point.length=h,o.hemi.length=f,o.directionalShadow.length=m,o.directionalShadowMap.length=m,o.pointShadow.length=v,o.pointShadowMap.length=v,o.spotShadow.length=g,o.spotShadowMap.length=g,o.directionalShadowMatrix.length=m,o.pointShadowMatrix.length=v,o.spotShadowMatrix.length=g,z.directionalLength=u,z.pointLength=h,z.spotLength=d,z.rectAreaLength=p,z.hemiLength=f,z.numDirectionalShadows=m,z.numPointShadows=v,z.numSpotShadows=g,o.version=$u++)}function r(t,e){for(var n=0,r=0,i=0,a=0,s=0,h=e.matrixWorldInverse,d=0,p=t.length;d<p;d++){var f=t[d];if(f.isDirectionalLight){var m=o.directional[n];m.direction.setFromMatrixPosition(f.matrixWorld),c.setFromMatrixPosition(f.target.matrixWorld),m.direction.sub(c),m.direction.transformDirection(h),n++}else if(f.isSpotLight){var v=o.spot[i];v.position.setFromMatrixPosition(f.matrixWorld),v.position.applyMatrix4(h),v.direction.setFromMatrixPosition(f.matrixWorld),c.setFromMatrixPosition(f.target.matrixWorld),v.direction.sub(c),v.direction.transformDirection(h),i++}else if(f.isRectAreaLight){var g=o.rectArea[a];g.position.setFromMatrixPosition(f.matrixWorld),g.position.applyMatrix4(h),u.identity(),l.copy(f.matrixWorld),l.premultiply(h),u.extractRotation(l),g.halfWidth.set(.5*f.width,0,0),g.halfHeight.set(0,.5*f.height,0),g.halfWidth.applyMatrix4(u),g.halfHeight.applyMatrix4(u),a++}else if(f.isPointLight){var y=o.point[r];y.position.setFromMatrixPosition(f.matrixWorld),y.position.applyMatrix4(h),r++}else if(f.isHemisphereLight){var x=o.hemi[s];x.direction.setFromMatrixPosition(f.matrixWorld),x.direction.transformDirection(h),x.direction.normalize(),s++}}}for(var i=new Ee,a=Ae(),o={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:[]},s=0;s<9;s++)o.probe.push(new Ic);var c=new Ic,l=new ol,u=new ol;return{setup:n,setupView:r,state:o}}function Ce(t,e){function n(){c.length=0,l.length=0}function r(t){c.push(t)}function i(t){l.push(t)}function a(){s.setup(c)}function o(t){s.setupView(c,t)}var s=new Re(t,e),c=[],l=[];return{init:n,state:{lightsArray:c,shadowsArray:l,lights:s},setupLights:a,setupLightsView:o,pushLight:r,pushShadow:i}}function Pe(t,e){function n(n,r){void 0===r&&(r=0);var a;return!1===i.has(n)?(a=new Ce(t,e),i.set(n,[]),i.get(n).push(a)):r>=i.get(n).length?(a=new Ce(t,e),i.get(n).push(a)):a=i.get(n)[r],a}function r(){i=new WeakMap}var i=new WeakMap;return{get:n,dispose:r}}function Oe(t){y.call(this),this.type="MeshDepthMaterial",this.depthPacking=hc,this.skinning=!1,this.morphTargets=!1,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(t)}function Ie(t){y.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new Ic,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(t)}function De(t,e,n){function r(n,r){var i=e.update(x);v.uniforms.shadow_pass.value=n.map.texture,v.uniforms.resolution.value=n.mapSize,v.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(r,null,i,v,x,null),g.uniforms.shadow_pass.value=n.mapPass.texture,g.uniforms.resolution.value=n.mapSize,g.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(r,null,i,g,x,null)}function i(t,e,n){var r=t<<0|e<<1|n<<2,i=d[r];return void 0===i&&(i=new Oe({depthPacking:dc,morphTargets:t,skinning:e}),d[r]=i),i}function a(t,e,n){var r=t<<0|e<<1|n<<2,i=p[r];return void 0===i&&(i=new Ie({morphTargets:t,skinning:e}),p[r]=i),i}function o(e,n,r,o,s,c,l){var u=null,h=i,d=e.customDepthMaterial;if(!0===o.isPointLight&&(h=a,d=e.customDistanceMaterial),void 0===d){var p=!1;!0===r.morphTargets&&(p=n.morphAttributes&&n.morphAttributes.position&&n.morphAttributes.position.length>0);var v=!1;!0===e.isSkinnedMesh&&(!0===r.skinning?v=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e));u=h(p,v,!0===e.isInstancedMesh)}else u=d;if(t.localClippingEnabled&&!0===r.clipShadows&&0!==r.clippingPlanes.length){var g=u.uuid,y=r.uuid,x=f[g];void 0===x&&(x={},f[g]=x);var _=x[y];void 0===_&&(_=u.clone(),x[y]=_),u=_}return u.visible=r.visible,u.wireframe=r.wireframe,
  128. u.side=l===za?null!==r.shadowSide?r.shadowSide:r.side:null!==r.shadowSide?r.shadowSide:m[r.side],u.clipShadows=r.clipShadows,u.clippingPlanes=r.clippingPlanes,u.clipIntersection=r.clipIntersection,u.wireframeLinewidth=r.wireframeLinewidth,u.linewidth=r.linewidth,!0===o.isPointLight&&!0===u.isMeshDistanceMaterial&&(u.referencePosition.setFromMatrixPosition(o.matrixWorld),u.nearDistance=s,u.farDistance=c),u}function s(n,r,i,a,l){if(!1!==n.visible){if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&l===za)&&(!n.frustumCulled||c.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,n.matrixWorld);var u=e.update(n),h=n.material;if(Array.isArray(h))for(var d=u.groups,p=0,f=d.length;p<f;p++){var m=d[p],v=h[m.materialIndex];if(v&&v.visible){var g=o(n,u,v,a,i.near,i.far,l);t.renderBufferDirect(i,null,u,g,n,m)}}else if(h.visible){var y=o(n,u,h,a,i.near,i.far,l);t.renderBufferDirect(i,null,u,y,n,null)}}for(var x=n.children,_=0,b=x.length;_<b;_++)s(x[_],r,i,a,l)}}var c=new Du,l=new Tc,u=new Tc,h=new Rc,d=[],p=[],f={},m={0:Ha,1:Fa,2:Ga},v=new H({defines:{SAMPLE_RATE:.25,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new Tc},radius:{value:4}},vertexShader:eh,fragmentShader:th}),g=v.clone();g.defines.HORIZONTAL_PASS=1;var y=new I;y.setAttribute("position",new _(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var x=new D(y,v),b=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Na,this.render=function(e,i,a){if(!1!==b.enabled&&(!1!==b.autoUpdate||!1!==b.needsUpdate)&&0!==e.length){var o=t.getRenderTarget(),d=t.getActiveCubeFace(),p=t.getActiveMipmapLevel(),f=t.state;f.setBlending(Ua),f.buffers.color.setClear(1,1,1,1),f.buffers.depth.setTest(!0),f.setScissorTest(!1);for(var m=0,v=e.length;m<v;m++){var g=e[m],y=g.shadow;if(void 0!==y){if(!1!==y.autoUpdate||!1!==y.needsUpdate){l.copy(y.mapSize);var x=y.getFrameExtents();if(l.multiply(x),u.copy(y.mapSize),(l.x>n||l.y>n)&&(l.x>n&&(u.x=Math.floor(n/x.x),l.x=u.x*x.x,y.mapSize.x=u.x),l.y>n&&(u.y=Math.floor(n/x.y),l.y=u.y*x.y,y.mapSize.y=u.y)),null===y.map&&!y.isPointLightShadow&&this.type===za){var _={minFilter:Ho,magFilter:Ho,format:ns};y.map=new Cc(l.x,l.y,_),y.map.texture.name=g.name+".shadowMap",y.mapPass=new Cc(l.x,l.y,_),y.camera.updateProjectionMatrix()}if(null===y.map){var w={minFilter:Bo,magFilter:Bo,format:ns};y.map=new Cc(l.x,l.y,w),y.map.texture.name=g.name+".shadowMap",y.camera.updateProjectionMatrix()}t.setRenderTarget(y.map),t.clear();for(var M=y.getViewportCount(),S=0;S<M;S++){var T=y.getViewport(S);h.set(u.x*T.x,u.y*T.y,u.x*T.z,u.y*T.w),f.viewport(h),y.updateMatrices(g,S),c=y.getFrustum(),s(i,a,y.camera,g,this.type)}y.isPointLightShadow||this.type!==za||r(y,a),y.needsUpdate=!1}}else console.warn("THREE.WebGLShadowMap:",g,"has no shadow.")}b.needsUpdate=!1,t.setRenderTarget(o,d,p)}}}function Ne(t,e,n){function r(){var e=!1,n=new Rc,r=null,i=new Rc(0,0,0,0);return{setMask:function(n){r===n||e||(t.colorMask(n,n,n,n),r=n)},setLocked:function(t){e=t},setClear:function(e,r,a,o,s){!0===s&&(e*=o,r*=o,a*=o),n.set(e,r,a,o),!1===i.equals(n)&&(t.clearColor(e,r,a,o),i.copy(n))},reset:function(){e=!1,r=null,i.set(-1,0,0,0)}}}function i(){var e=!1,n=null,r=null,i=null;return{setTest:function(t){t?s(2929):c(2929)},setMask:function(r){n===r||e||(t.depthMask(r),n=r)},setFunc:function(e){if(r!==e){if(e)switch(e){case lo:t.depthFunc(512);break;case uo:t.depthFunc(519);break;case ho:t.depthFunc(513);break;case po:t.depthFunc(515);break;case fo:t.depthFunc(514);break;case mo:t.depthFunc(518);break;case vo:t.depthFunc(516);break;case go:t.depthFunc(517);break;default:t.depthFunc(515)}else t.depthFunc(515);r=e}},setLocked:function(t){e=t},setClear:function(e){i!==e&&(t.clearDepth(e),i=e)},reset:function(){e=!1,n=null,r=null,i=null}}}function a(){var e=!1,n=null,r=null,i=null,a=null,o=null,l=null,u=null,h=null;return{setTest:function(t){e||(t?s(2960):c(2960))},setMask:function(r){n===r||e||(t.stencilMask(r),n=r)},setFunc:function(e,n,o){r===e&&i===n&&a===o||(t.stencilFunc(e,n,o),r=e,i=n,a=o)},setOp:function(e,n,r){o===e&&l===n&&u===r||(t.stencilOp(e,n,r),o=e,l=n,u=r)},setLocked:function(t){e=t},setClear:function(e){h!==e&&(t.clearStencil(e),h=e)},reset:function(){e=!1,n=null,r=null,i=null,a=null,o=null,l=null,u=null,h=null}}}function o(e,n,r){var i=new Uint8Array(4),a=t.createTexture();t.bindTexture(e,a),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(var o=0;o<r;o++)t.texImage2D(n+o,0,6408,1,1,0,6408,5121,i);return a}function s(e){!0!==O[e]&&(t.enable(e),O[e]=!0)}function c(e){!1!==O[e]&&(t.disable(e),O[e]=!1)}function l(e){return I!==e&&(t.useProgram(e),I=e,!0)}function u(e,n,r,i,a,o,l,u){if(e===Ua)return void(D&&(c(3042),D=!1));if(D||(s(3042),D=!0),e===qa)a=a||n,o=o||r,l=l||i,n===B&&a===H||(t.blendEquationSeparate(rt[n],rt[a]),B=n,H=a),r===z&&i===F&&o===G&&l===U||(t.blendFuncSeparate(at[r],at[i],at[o],at[l]),z=r,F=i,G=o,U=l),N=e,k=null;else if(e!==N||u!==k){if(B===Xa&&H===Xa||(t.blendEquation(32774),B=Xa,H=Xa),u)switch(e){case ka:t.blendFuncSeparate(1,771,1,771);break;case Va:t.blendFunc(1,1);break;case Wa:t.blendFuncSeparate(0,0,769,771);break;case ja:t.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case ka:t.blendFuncSeparate(770,771,1,771);break;case Va:t.blendFunc(770,1);break;case Wa:t.blendFunc(0,769);break;case ja:t.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}z=null,F=null,G=null,U=null,N=e,k=u}}function h(t,e){t.side===Ga?c(2884):s(2884);var n=t.side===Ha;e&&(n=!n),d(n),t.blending===ka&&!1===t.transparent?u(Ua):u(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),C.setFunc(t.depthFunc),C.setTest(t.depthTest),C.setMask(t.depthWrite),R.setMask(t.colorWrite);var r=t.stencilWrite;P.setTest(r),r&&(P.setMask(t.stencilWriteMask),P.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),P.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),m(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)}function d(e){V!==e&&(e?t.frontFace(2304):t.frontFace(2305),V=e)}function p(e){e!==Oa?(s(2884),e!==W&&(e===Ia?t.cullFace(1029):e===Da?t.cullFace(1028):t.cullFace(1032))):c(2884),W=e}function f(e){e!==j&&(Z&&t.lineWidth(e),j=e)}function m(e,n,r){e?(s(32823),q===n&&X===r||(t.polygonOffset(n,r),q=n,X=r)):c(32823)}function v(t){t?s(3089):c(3089)}function g(e){void 0===e&&(e=33984+Y-1),K!==e&&(t.activeTexture(e),K=e)}function y(e,n){null===K&&g();var r=$[K];void 0===r&&(r={type:void 0,texture:void 0},$[K]=r),r.type===e&&r.texture===n||(t.bindTexture(e,n||nt[e]),r.type=e,r.texture=n)}function x(){var e=$[K];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)}function _(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}}function b(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}}function w(){try{t.texImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}}function M(e){!1===tt.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),tt.copy(e))}function S(e){!1===et.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),et.copy(e))}function T(){O={},K=null,$={},I=null,D=null,N=null,B=null,z=null,F=null,H=null,G=null,U=null,k=!1,V=null,W=null,j=null,q=null,X=null,R.reset(),C.reset(),P.reset()}var E,A,L=n.isWebGL2,R=new r,C=new i,P=new a,O={},I=null,D=null,N=null,B=null,z=null,F=null,H=null,G=null,U=null,k=!1,V=null,W=null,j=null,q=null,X=null,Y=t.getParameter(35661),Z=!1,J=0,Q=t.getParameter(7938);-1!==Q.indexOf("WebGL")?(J=parseFloat(/^WebGL (\d)/.exec(Q)[1]),Z=J>=1):-1!==Q.indexOf("OpenGL ES")&&(J=parseFloat(/^OpenGL ES (\d)/.exec(Q)[1]),Z=J>=2);var K=null,$={},tt=new Rc,et=new Rc,nt={};nt[3553]=o(3553,3553,1),nt[34067]=o(34067,34069,6),R.setClear(0,0,0,1),C.setClear(1),P.setClear(0),s(2929),C.setFunc(po),d(!1),p(Ia),s(2884),u(Ua);var rt=(E={},E[Xa]=32774,E[Ya]=32778,E[Za]=32779,E);if(L)rt[Ja]=32775,rt[Qa]=32776;else{var it=e.get("EXT_blend_minmax");null!==it&&(rt[Ja]=it.MIN_EXT,rt[Qa]=it.MAX_EXT)}var at=(A={},A[Ka]=0,A[$a]=1,A[to]=768,A[no]=770,A[co]=776,A[oo]=774,A[io]=772,A[eo]=769,A[ro]=771,A[so]=775,A[ao]=773,A);return{buffers:{color:R,depth:C,stencil:P},enable:s,disable:c,useProgram:l,setBlending:u,setMaterial:h,setFlipSided:d,setCullFace:p,setLineWidth:f,setPolygonOffset:m,setScissorTest:v,activeTexture:g,bindTexture:y,unbindTexture:x,compressedTexImage2D:_,texImage2D:b,texImage3D:w,scissor:M,viewport:S,reset:T}}function Be(t,e,n,r,i,a,o){function s(t,e){return Z?new OffscreenCanvas(t,e):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function c(t,e,n,r){var i=1;if((t.width>r||t.height>r)&&(i=r/Math.max(t.width,t.height)),i<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){var a=e?Sc.floorPowerOfTwo:Math.floor,o=a(i*t.width),c=a(i*t.height);void 0===k&&(k=s(o,c));var l=n?s(o,c):k;l.width=o,l.height=c;return l.getContext("2d").drawImage(t,0,0,o,c),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+o+"x"+c+")."),l}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function l(t){return Sc.isPowerOfTwo(t.width)&&Sc.isPowerOfTwo(t.height)}function u(t){return!V&&(t.wrapS!==Do||t.wrapT!==Do||t.minFilter!==Bo&&t.minFilter!==Ho)}function h(t,e){return t.generateMipmaps&&e&&t.minFilter!==Bo&&t.minFilter!==Ho}function d(e,n,i,a){t.generateMipmap(e),r.get(n).__maxMipLevel=Math.log(Math.max(i,a))*Math.LOG2E}function p(n,r,i){if(!1===V)return r;if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}var a=r;return 6403===r&&(5126===i&&(a=33326),5131===i&&(a=33325),5121===i&&(a=33321)),6407===r&&(5126===i&&(a=34837),5131===i&&(a=34843),5121===i&&(a=32849)),6408===r&&(5126===i&&(a=34836),5131===i&&(a=34842),5121===i&&(a=32856)),33325!==a&&33326!==a&&34842!==a&&34836!==a||e.get("EXT_color_buffer_float"),a}function f(t){return t===Bo||t===zo||t===Fo?9728:9729}function m(t){var e=t.target;e.removeEventListener("dispose",m),g(e),e.isVideoTexture&&Y.delete(e),o.memory.textures--}function v(t){var e=t.target;e.removeEventListener("dispose",v),y(e),o.memory.textures--}function g(e){var n=r.get(e);void 0!==n.__webglInit&&(t.deleteTexture(n.__webglTexture),r.remove(e))}function y(e){var n=r.get(e),i=r.get(e.texture);if(e){if(void 0!==i.__webglTexture&&t.deleteTexture(i.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLCubeRenderTarget)for(var a=0;a<6;a++)t.deleteFramebuffer(n.__webglFramebuffer[a]),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer[a]);else t.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&t.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer&&t.deleteRenderbuffer(n.__webglColorRenderbuffer),n.__webglDepthRenderbuffer&&t.deleteRenderbuffer(n.__webglDepthRenderbuffer);r.remove(e.texture),r.remove(e)}}function x(){J=0}function _(){var t=J;return t>=W&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+W),J+=1,t}function b(t,e){var i=r.get(t);if(t.isVideoTexture&&z(t),t.version>0&&i.__version!==t.version){var a=t.image;if(void 0===a)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==a.complete)return void A(i,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+e),n.bindTexture(3553,i.__webglTexture)}function w(t,e){var i=r.get(t);if(t.version>0&&i.__version!==t.version)return void A(i,t,e);n.activeTexture(33984+e),n.bindTexture(35866,i.__webglTexture)}function M(t,e){var i=r.get(t);if(t.version>0&&i.__version!==t.version)return void A(i,t,e);n.activeTexture(33984+e),n.bindTexture(32879,i.__webglTexture)}function S(t,e){var i=r.get(t);if(t.version>0&&i.__version!==t.version)return void L(i,t,e);n.activeTexture(33984+e),n.bindTexture(34067,i.__webglTexture)}function T(n,a,o){o?(t.texParameteri(n,10242,Q[a.wrapS]),t.texParameteri(n,10243,Q[a.wrapT]),32879!==n&&35866!==n||t.texParameteri(n,32882,Q[a.wrapR]),t.texParameteri(n,10240,K[a.magFilter]),t.texParameteri(n,10241,K[a.minFilter])):(t.texParameteri(n,10242,33071),t.texParameteri(n,10243,33071),32879!==n&&35866!==n||t.texParameteri(n,32882,33071),a.wrapS===Do&&a.wrapT===Do||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(n,10240,f(a.magFilter)),t.texParameteri(n,10241,f(a.minFilter)),a.minFilter!==Bo&&a.minFilter!==Ho&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter."));var s=e.get("EXT_texture_filter_anisotropic");if(s){if(a.type===Yo&&null===e.get("OES_texture_float_linear"))return;if(a.type===Zo&&null===(V||e.get("OES_texture_half_float_linear")))return;(a.anisotropy>1||r.get(a).__currentAnisotropy)&&(t.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy)}}function E(e,n){void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",m),e.__webglTexture=t.createTexture(),o.memory.textures++)}function A(e,r,i){var o=3553;r.isDataTexture2DArray&&(o=35866),r.isDataTexture3D&&(o=32879),E(e,r),n.activeTexture(33984+i),n.bindTexture(o,e.__webglTexture),t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment);var s=u(r)&&!1===l(r.image),f=c(r.image,s,!1,q),m=l(f)||V,v=a.convert(r.format),g=a.convert(r.type),y=p(r.internalFormat,v,g);T(o,r,m);var x,_=r.mipmaps;if(r.isDepthTexture)y=6402,V?y=r.type===Yo?36012:r.type===Xo?33190:r.type===$o?35056:33189:r.type===Yo&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===os&&6402===y&&r.type!==jo&&r.type!==Xo&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=jo,g=a.convert(r.type)),r.format===ss&&6402===y&&(y=34041,r.type!==$o&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=$o,g=a.convert(r.type))),n.texImage2D(3553,0,y,f.width,f.height,0,v,g,null);else if(r.isDataTexture)if(_.length>0&&m){for(var b=0,w=_.length;b<w;b++)x=_[b],n.texImage2D(3553,b,y,x.width,x.height,0,v,g,x.data);r.generateMipmaps=!1,e.__maxMipLevel=_.length-1}else n.texImage2D(3553,0,y,f.width,f.height,0,v,g,f.data),e.__maxMipLevel=0;else if(r.isCompressedTexture){for(var M=0,S=_.length;M<S;M++)x=_[M],r.format!==ns&&r.format!==es?null!==v?n.compressedTexImage2D(3553,M,y,x.width,x.height,0,x.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(3553,M,y,x.width,x.height,0,v,g,x.data);e.__maxMipLevel=_.length-1}else if(r.isDataTexture2DArray)n.texImage3D(35866,0,y,f.width,f.height,f.depth,0,v,g,f.data),e.__maxMipLevel=0;else if(r.isDataTexture3D)n.texImage3D(32879,0,y,f.width,f.height,f.depth,0,v,g,f.data),e.__maxMipLevel=0;else if(_.length>0&&m){for(var A=0,L=_.length;A<L;A++)x=_[A],n.texImage2D(3553,A,y,v,g,x);r.generateMipmaps=!1,e.__maxMipLevel=_.length-1}else n.texImage2D(3553,0,y,v,g,f),e.__maxMipLevel=0;h(r,m)&&d(o,r,f.width,f.height),e.__version=r.version,r.onUpdate&&r.onUpdate(r)}function L(e,r,i){if(6===r.image.length){E(e,r),n.activeTexture(33984+i),n.bindTexture(34067,e.__webglTexture),t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment);for(var o=r&&(r.isCompressedTexture||r.image[0].isCompressedTexture),s=r.image[0]&&r.image[0].isDataTexture,u=[],f=0;f<6;f++)u[f]=o||s?s?r.image[f].image:r.image[f]:c(r.image[f],!1,!0,j);var m=u[0],v=l(m)||V,g=a.convert(r.format),y=a.convert(r.type),x=p(r.internalFormat,g,y);T(34067,r,v);var _;if(o){for(var b=0;b<6;b++){_=u[b].mipmaps;for(var w=0;w<_.length;w++){var M=_[w];r.format!==ns&&r.format!==es?null!==g?n.compressedTexImage2D(34069+b,w,x,M.width,M.height,0,M.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(34069+b,w,x,M.width,M.height,0,g,y,M.data)}}e.__maxMipLevel=_.length-1}else{_=r.mipmaps;for(var S=0;S<6;S++)if(s){n.texImage2D(34069+S,0,x,u[S].width,u[S].height,0,g,y,u[S].data);for(var A=0;A<_.length;A++){var L=_[A],R=L.image[S].image;n.texImage2D(34069+S,A+1,x,R.width,R.height,0,g,y,R.data)}}else{n.texImage2D(34069+S,0,x,g,y,u[S]);for(var C=0;C<_.length;C++){var P=_[C];n.texImage2D(34069+S,C+1,x,g,y,P.image[S])}}e.__maxMipLevel=_.length}h(r,v)&&d(34067,r,m.width,m.height),e.__version=r.version,r.onUpdate&&r.onUpdate(r)}}function R(e,i,o,s){var c=a.convert(i.texture.format),l=a.convert(i.texture.type),u=p(i.texture.internalFormat,c,l);n.texImage2D(s,0,u,i.width,i.height,0,c,l,null),t.bindFramebuffer(36160,e),t.framebufferTexture2D(36160,o,s,r.get(i.texture).__webglTexture,0),t.bindFramebuffer(36160,null)}function C(e,n,r){if(t.bindRenderbuffer(36161,e),n.depthBuffer&&!n.stencilBuffer){var i=33189;if(r){var o=n.depthTexture;o&&o.isDepthTexture&&(o.type===Yo?i=36012:o.type===Xo&&(i=33190));var s=B(n);t.renderbufferStorageMultisample(36161,s,i,n.width,n.height)}else t.renderbufferStorage(36161,i,n.width,n.height);t.framebufferRenderbuffer(36160,36096,36161,e)}else if(n.depthBuffer&&n.stencilBuffer){if(r){var c=B(n);t.renderbufferStorageMultisample(36161,c,35056,n.width,n.height)}else t.renderbufferStorage(36161,34041,n.width,n.height);t.framebufferRenderbuffer(36160,33306,36161,e)}else{var l=a.convert(n.texture.format),u=a.convert(n.texture.type),h=p(n.texture.internalFormat,l,u);if(r){var d=B(n);t.renderbufferStorageMultisample(36161,d,h,n.width,n.height)}else t.renderbufferStorage(36161,h,n.width,n.height)}t.bindRenderbuffer(36161,null)}function P(e,n){if(n&&n.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,e),!n.depthTexture||!n.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.get(n.depthTexture).__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),b(n.depthTexture,0);var i=r.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===os)t.framebufferTexture2D(36160,36096,3553,i,0);else{if(n.depthTexture.format!==ss)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(36160,33306,3553,i,0)}}function O(e){var n=r.get(e),i=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture){if(i)throw new Error("target.depthTexture not supported in Cube render targets");P(n.__webglFramebuffer,e)}else if(i){n.__webglDepthbuffer=[];for(var a=0;a<6;a++)t.bindFramebuffer(36160,n.__webglFramebuffer[a]),n.__webglDepthbuffer[a]=t.createRenderbuffer(),C(n.__webglDepthbuffer[a],e,!1)}else t.bindFramebuffer(36160,n.__webglFramebuffer),n.__webglDepthbuffer=t.createRenderbuffer(),C(n.__webglDepthbuffer,e,!1);t.bindFramebuffer(36160,null)}function I(e){var i=r.get(e),s=r.get(e.texture);e.addEventListener("dispose",v),s.__webglTexture=t.createTexture(),o.memory.textures++;var c=!0===e.isWebGLCubeRenderTarget,u=!0===e.isWebGLMultisampleRenderTarget,f=l(e)||V;if(!V||e.texture.format!==es||e.texture.type!==Yo&&e.texture.type!==Zo||(e.texture.format=ns,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),c){i.__webglFramebuffer=[];for(var m=0;m<6;m++)i.__webglFramebuffer[m]=t.createFramebuffer()}else if(i.__webglFramebuffer=t.createFramebuffer(),u)if(V){i.__webglMultisampledFramebuffer=t.createFramebuffer(),i.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,i.__webglColorRenderbuffer);var g=a.convert(e.texture.format),y=a.convert(e.texture.type),x=p(e.texture.internalFormat,g,y),_=B(e);t.renderbufferStorageMultisample(36161,_,x,e.width,e.height),t.bindFramebuffer(36160,i.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,i.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(i.__webglDepthRenderbuffer=t.createRenderbuffer(),C(i.__webglDepthRenderbuffer,e,!0)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(c){n.bindTexture(34067,s.__webglTexture),T(34067,e.texture,f);for(var b=0;b<6;b++)R(i.__webglFramebuffer[b],e,36064,34069+b);h(e.texture,f)&&d(34067,e.texture,e.width,e.height),n.bindTexture(34067,null)}else n.bindTexture(3553,s.__webglTexture),T(3553,e.texture,f),R(i.__webglFramebuffer,e,36064,3553),h(e.texture,f)&&d(3553,e.texture,e.width,e.height),n.bindTexture(3553,null);e.depthBuffer&&O(e)}function D(t){var e=t.texture;if(h(e,l(t)||V)){var i=t.isWebGLCubeRenderTarget?34067:3553,a=r.get(e).__webglTexture;n.bindTexture(i,a),d(i,e,t.width,t.height),n.bindTexture(i,null)}}function N(e){if(e.isWebGLMultisampleRenderTarget)if(V){var n=r.get(e);t.bindFramebuffer(36008,n.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,n.__webglFramebuffer);var i=e.width,a=e.height,o=16384;e.depthBuffer&&(o|=256),e.stencilBuffer&&(o|=1024),t.blitFramebuffer(0,0,i,a,0,0,i,a,o,9728),t.bindFramebuffer(36160,n.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")}function B(t){return V&&t.isWebGLMultisampleRenderTarget?Math.min(X,t.samples):0}function z(t){var e=o.render.frame;Y.get(t)!==e&&(Y.set(t,e),t.update())}function F(t,e){t&&t.isWebGLRenderTarget&&(!1===$&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),$=!0),t=t.texture),b(t,e)}function H(t,e){t&&t.isWebGLCubeRenderTarget&&(!1===tt&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),tt=!0),t=t.texture),S(t,e)}var G,U,k,V=i.isWebGL2,W=i.maxTextures,j=i.maxCubemapSize,q=i.maxTextureSize,X=i.maxSamples,Y=new WeakMap,Z=!1;try{Z="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}var J=0,Q=(G={},G[Io]=10497,G[Do]=33071,G[No]=33648,G),K=(U={},U[Bo]=9728,U[zo]=9984,U[Fo]=9986,U[Ho]=9729,U[Go]=9985,U[Uo]=9987,U),$=!1,tt=!1;this.allocateTextureUnit=_,this.resetTextureUnits=x,this.setTexture2D=b,this.setTexture2DArray=w,this.setTexture3D=M,this.setTextureCube=S,this.setupRenderTarget=I,this.updateRenderTargetMipmap=D,this.updateMultisampleRenderTarget=N,this.safeSetTexture2D=F,this.safeSetTextureCube=H}function ze(t,e,n){function r(t){var n;if(t===ko)return 5121;if(t===Jo)return 32819;if(t===Qo)return 32820;if(t===Ko)return 33635;if(t===Vo)return 5120;if(t===Wo)return 5122;if(t===jo)return 5123;if(t===qo)return 5124;if(t===Xo)return 5125;if(t===Yo)return 5126;if(t===Zo)return i?5131:(n=e.get("OES_texture_half_float"),null!==n?n.HALF_FLOAT_OES:null);if(t===ts)return 6406;if(t===es)return 6407;if(t===ns)return 6408;if(t===rs)return 6409;if(t===is)return 6410;if(t===os)return 6402;if(t===ss)return 34041;if(t===cs)return 6403;if(t===ls)return 36244;if(t===us)return 33319;if(t===hs)return 33320;if(t===ds)return 36248;if(t===ps)return 36249;if(t===fs||t===ms||t===vs||t===gs){if(null===(n=e.get("WEBGL_compressed_texture_s3tc")))return null;if(t===fs)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===ms)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===vs)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===gs)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t===ys||t===xs||t===_s||t===bs){if(null===(n=e.get("WEBGL_compressed_texture_pvrtc")))return null;if(t===ys)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===xs)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===_s)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===bs)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t===ws)return n=e.get("WEBGL_compressed_texture_etc1"),null!==n?n.COMPRESSED_RGB_ETC1_WEBGL:null;if((t===Ms||t===Ss)&&null!==(n=e.get("WEBGL_compressed_texture_etc"))){if(t===Ms)return n.COMPRESSED_RGB8_ETC2;if(t===Ss)return n.COMPRESSED_RGBA8_ETC2_EAC}return t===Ts||t===Es||t===As||t===Ls||t===Rs||t===Cs||t===Ps||t===Os||t===Is||t===Ds||t===Ns||t===Bs||t===zs||t===Fs||t===Gs||t===Us||t===ks||t===Vs||t===Ws||t===js||t===qs||t===Xs||t===Ys||t===Zs||t===Js||t===Qs||t===Ks||t===$s?(n=e.get("WEBGL_compressed_texture_astc"),null!==n?t:null):t===Hs?(n=e.get("EXT_texture_compression_bptc"),null!==n?t:null):t===$o?i?34042:(n=e.get("WEBGL_depth_texture"),null!==n?n.UNSIGNED_INT_24_8_WEBGL:null):void 0}var i=n.isWebGL2;return{convert:r}}function Fe(){f.call(this),this.type="Group"}function He(t){void 0===t&&(t=[]),U.call(this),this.cameras=t}function Ge(t,e,n){nh.setFromMatrixPosition(e.matrixWorld),rh.setFromMatrixPosition(n.matrixWorld);var r=nh.distanceTo(rh),i=e.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),c=(i[9]+1)/i[5],l=(i[9]-1)/i[5],u=(i[8]-1)/i[0],h=(a[8]+1)/a[0],d=o*u,p=o*h,f=r/(-u+h),m=f*-u;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(m),t.translateZ(f),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.getInverse(t.matrixWorld);var v=o+f,g=s+f,y=d-m,x=p+(r-m),_=c*s/g*v,b=l*s/g*v;t.projectionMatrix.makePerspective(y,x,_,b,v,g)}function Ue(t){function e(){if(s.isPresenting=null!==c&&!0===c.isPresenting){var e=c.getEyeParameters("left");a=2*e.renderWidth*f,o=e.renderHeight*f,w=t.getPixelRatio(),t.getSize(M),t.setDrawingBufferSize(a,o,1),x.viewport.set(0,0,a/2,o),_.viewport.set(a/2,0,a/2,o),E.start(),s.dispatchEvent({type:"sessionstart"})}else s.enabled&&t.setDrawingBufferSize(M.width,M.height,w),E.stop(),s.dispatchEvent({type:"sessionend"})}function n(t){for(var e=navigator.getGamepads&&navigator.getGamepads(),n=0,r=e.length;n<r;n++){var i=e[n];if(i&&("Daydream Controller"===i.id||"Gear VR Controller"===i.id||"Oculus Go Controller"===i.id||"OpenVR Gamepad"===i.id||i.id.startsWith("Oculus Touch")||i.id.startsWith("HTC Vive Focus")||i.id.startsWith("Spatial Controller"))){var a=i.hand;if(0===t&&(""===a||"right"===a))return i;if(1===t&&"left"===a)return i}}}function r(){for(var t=0;t<h.length;t++){var e=h[t],r=n(t);if(void 0!==r&&void 0!==r.pose){if(null===r.pose)return;var i=r.pose;!1===i.hasPosition&&e.position.set(.2,-.6,-.05),null!==i.position&&e.position.fromArray(i.position),null!==i.orientation&&e.quaternion.fromArray(i.orientation),e.matrix.compose(e.position,e.quaternion,e.scale),e.matrix.premultiply(d),e.matrix.decompose(e.position,e.quaternion,e.scale),e.matrixWorldNeedsUpdate=!0,e.visible=!0;var a="Daydream Controller"===r.id?0:1;void 0===S[t]&&(S[t]=!1),S[t]!==r.buttons[a].pressed&&(S[t]=r.buttons[a].pressed,!0===S[t]?e.dispatchEvent({type:"selectstart"}):(e.dispatchEvent({type:"selectend"}),e.dispatchEvent({type:"select"}))),a=2,void 0===T[t]&&(T[t]=!1),void 0!==r.buttons[a]&&T[t]!==r.buttons[a].pressed&&(T[t]=r.buttons[a].pressed,!0===T[t]?e.dispatchEvent({type:"squeezestart"}):(e.dispatchEvent({type:"squeezeend"}),e.dispatchEvent({type:"squeeze"})))}else e.visible=!1}}function i(t,e){null!==e&&4===e.length&&t.set(e[0]*a,e[1]*o,e[2]*a,e[3]*o)}var a,o,s=this,c=null,l=null,u=null,h=[],d=new ol,p=new ol,f=1,m="local-floor";"undefined"!=typeof window&&"VRFrameData"in window&&(l=new window.VRFrameData,window.addEventListener("vrdisplaypresentchange",e,!1));var v=new ol,g=new Oc,y=new Ic,x=new U;x.viewport=new Rc,x.layers.enable(1);var _=new U;_.viewport=new Rc,_.layers.enable(2);var b=new He([x,_]);b.layers.enable(1),b.layers.enable(2);var w,M=new Tc,S=[],T=[];this.enabled=!1,this.getController=function(t){var e=h[t];return void 0===e&&(e=new Fe,e.matrixAutoUpdate=!1,e.visible=!1,h[t]=e),e},this.getDevice=function(){return c},this.setDevice=function(t){void 0!==t&&(c=t),E.setContext(t)},this.setFramebufferScaleFactor=function(t){f=t},this.setReferenceSpaceType=function(t){m=t},this.setPoseTarget=function(t){void 0!==t&&(u=t)},this.getCamera=function(t){var e="local-floor"===m?1.6:0;if(c.depthNear=t.near,c.depthFar=t.far,c.getFrameData(l),"local-floor"===m){var n=c.stageParameters;n?d.fromArray(n.sittingToStandingTransform):d.makeTranslation(0,e,0)}var a=l.pose,o=null!==u?u:t;o.matrix.copy(d),o.matrix.decompose(o.position,o.quaternion,o.scale),null!==a.orientation&&(g.fromArray(a.orientation),o.quaternion.multiply(g)),null!==a.position&&(g.setFromRotationMatrix(d),y.fromArray(a.position),y.applyQuaternion(g),o.position.add(y)),o.updateMatrixWorld();for(var s=o.children,h=0,f=s.length;h<f;h++)s[h].updateMatrixWorld(!0);x.near=t.near,_.near=t.near,x.far=t.far,_.far=t.far,x.matrixWorldInverse.fromArray(l.leftViewMatrix),_.matrixWorldInverse.fromArray(l.rightViewMatrix),p.getInverse(d),"local-floor"===m&&(x.matrixWorldInverse.multiply(p),_.matrixWorldInverse.multiply(p));var w=o.parent;null!==w&&(v.getInverse(w.matrixWorld),x.matrixWorldInverse.multiply(v),_.matrixWorldInverse.multiply(v)),x.matrixWorld.getInverse(x.matrixWorldInverse),_.matrixWorld.getInverse(_.matrixWorldInverse),x.projectionMatrix.fromArray(l.leftProjectionMatrix),_.projectionMatrix.fromArray(l.rightProjectionMatrix),Ge(b,x,_);var M=c.getLayers();if(M.length){var S=M[0];i(x.viewport,S.leftBounds),i(_.viewport,S.rightBounds)}return r(),b},this.getStandingMatrix=function(){return d},this.isPresenting=!1;var E=new j;this.setAnimationLoop=function(t){E.setAnimationLoop(t),this.isPresenting&&E.start()},this.submitFrame=function(){this.isPresenting&&c.submitFrame()},this.dispose=function(){"undefined"!=typeof window&&window.removeEventListener("vrdisplaypresentchange",e)},this.setFrameOfReferenceType=function(){console.warn("THREE.WebVRManager: setFrameOfReferenceType() has been deprecated.")}}function ke(){this._targetRay=null,this._grip=null,this._hand=null}function Ve(t,e){function r(t){var e=y.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function i(){y.forEach(function(t,e){t.disconnect(e)}),y.clear(),S=null,T=null,t.setFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),R.stop(),u.isPresenting=!1,u.dispatchEvent({type:"sessionend"})}function a(t){for(var e=h.inputSources,n=0;n<g.length;n++)y.set(e[n],g[n]);for(var r=0;r<t.removed.length;r++){var i=t.removed[r],a=y.get(i);a&&(a.dispatchEvent({type:"disconnected",data:i}),y.delete(i))}for(var o=0;o<t.added.length;o++){var s=t.added[o],c=y.get(s);c&&c.dispatchEvent({type:"connected",data:s})}}function o(t,e,n){E.setFromMatrixPosition(e.matrixWorld),A.setFromMatrixPosition(n.matrixWorld);var r=E.distanceTo(A),i=e.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),c=(i[9]+1)/i[5],l=(i[9]-1)/i[5],u=(i[8]-1)/i[0],h=(a[8]+1)/a[0],d=o*u,p=o*h,f=r/(-u+h),m=f*-u;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(m),t.translateZ(f),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert();var v=o+f,g=s+f,y=d-m,x=p+(r-m),_=c*s/g*v,b=l*s/g*v;t.projectionMatrix.makePerspective(y,x,_,b,v,g)}function s(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}function c(e,n){if(null!==(m=n.getViewerPose(p))){var r=m.views;t.setFramebuffer(l.framebuffer);var i=!1;r.length!==M.cameras.length&&(M.cameras.length=0,i=!0);for(var a=0;a<r.length;a++){var o=r[a],s=l.getViewport(o),c=w[a];c.matrix.fromArray(o.transform.matrix),
  129. c.projectionMatrix.fromArray(o.projectionMatrix),c.viewport.set(s.x,s.y,s.width,s.height),0===a&&M.matrix.copy(c.matrix),!0===i&&M.cameras.push(c)}}for(var u=h.inputSources,d=0;d<g.length;d++){var f=g[d],v=u[d];f.update(v,n,p)}L&&L(e,n)}var l,u=this,h=null,d=1,p=null,f="local-floor",m=null,v=null,g=[],y=new Map,x=[],_=new U;_.layers.enable(1),_.viewport=new Rc;var b=new U;b.layers.enable(2),b.viewport=new Rc;var w=[_,b],M=new He;M.layers.enable(1),M.layers.enable(2);var S=null,T=null;this.layersEnabled=!1,this.enabled=!1,this.isPresenting=!1,this.getCameraPose=function(){return m},this.getController=function(t){var e=g[t];return void 0===e&&(e=new ke,g[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){var e=g[t];return void 0===e&&(e=new ke,g[t]=e),e.getGripSpace()},this.getHand=function(t){var e=g[t];return void 0===e&&(e=new ke,g[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){d=t,!0===u.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){f=t,!0===u.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return p},this.getSession=function(){return h},this.setSession=function(){var t=n(regeneratorRuntime.mark(function t(n){var o,s;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(null===(h=n)){t.next=24;break}if(h.addEventListener("select",r),h.addEventListener("selectstart",r),h.addEventListener("selectend",r),h.addEventListener("squeeze",r),h.addEventListener("squeezestart",r),h.addEventListener("squeezeend",r),h.addEventListener("end",i),h.addEventListener("inputsourceschange",a),o=e.getContextAttributes(),!0===o.xrCompatible){t.next=14;break}return t.next=14,e.makeXRCompatible();case 14:return s={antialias:o.antialias,alpha:o.alpha,depth:o.depth,stencil:o.stencil,framebufferScaleFactor:d},l=new XRWebGLLayer(h,e,s),window.XRWebGLBinding&&this.layersEnabled?this.addLayer(l):h.updateRenderState({baseLayer:l}),t.next=19,h.requestReferenceSpace(f);case 19:p=t.sent,R.setContext(h),R.start(),u.isPresenting=!0,u.dispatchEvent({type:"sessionstart"});case 24:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}(),this.addLayer=function(t){window.XRWebGLBinding&&this.layersEnabled&&h&&(x.push(t),h.updateRenderState({layers:x}))},this.removeLayer=function(t){window.XRWebGLBinding&&this.layersEnabled&&h&&(x.splice(x.indexOf(t),1),h.updateRenderState({layers:x}))};var E=new Ic,A=new Ic;this.setPoseTarget=function(t){void 0!==t&&(v=t)},this.getCamera=function(t){M.near=b.near=_.near=t.near,M.far=b.far=_.far=t.far,S===M.near&&T===M.far||(h.updateRenderState({depthNear:M.near,depthFar:M.far}),S=M.near,T=M.far);var e=t.parent,n=M.cameras,r=v||t;s(M,e);for(var i=0;i<n.length;i++)s(n[i],e);r.matrixWorld.copy(M.matrixWorld);for(var a=r.children,c=0,l=a.length;c<l;c++)a[c].updateMatrixWorld(!0);return 2===n.length?o(M,_,b):M.projectionMatrix.copy(_.projectionMatrix),M};var L=null,R=new j;R.setAnimationLoop(c),this.setAnimationLoop=function(t){L=t},this.dispose=function(){}}function We(t){function e(t,e){t.fogColor.value.copy(e.color),e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)}function n(t,e,n,g){e.isMeshBasicMaterial?r(t,e):e.isMeshLambertMaterial?(r(t,e),c(t,e)):e.isMeshToonMaterial?(r(t,e),u(t,e)):e.isMeshPhongMaterial?(r(t,e),l(t,e)):e.isMeshStandardMaterial?(r(t,e),e.isMeshPhysicalMaterial?d(t,e):h(t,e)):e.isMeshMatcapMaterial?(r(t,e),p(t,e)):e.isMeshDepthMaterial?(r(t,e),f(t,e)):e.isMeshDistanceMaterial?(r(t,e),m(t,e)):e.isMeshNormalMaterial?(r(t,e),v(t,e)):e.isLineBasicMaterial?(i(t,e),e.isLineDashedMaterial&&a(t,e)):e.isPointsMaterial?o(t,e,n,g):e.isSpriteMaterial?s(t,e):e.isShadowMaterial?(t.color.value.copy(e.color),t.opacity.value=e.opacity):e.isShaderMaterial&&(e.uniformsNeedUpdate=!1)}function r(e,n){e.opacity.value=n.opacity,n.color&&e.diffuse.value.copy(n.color),n.emissive&&e.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(e.map.value=n.map),n.alphaMap&&(e.alphaMap.value=n.alphaMap),n.specularMap&&(e.specularMap.value=n.specularMap);var r=t.get(n).envMap;if(r){e.envMap.value=r,e.flipEnvMap.value=r.isCubeTexture&&r._needsFlipEnvMap?-1:1,e.reflectivity.value=n.reflectivity,e.refractionRatio.value=n.refractionRatio;var i=t.get(r).__maxMipLevel;void 0!==i&&(e.maxMipLevel.value=i)}n.lightMap&&(e.lightMap.value=n.lightMap,e.lightMapIntensity.value=n.lightMapIntensity),n.aoMap&&(e.aoMap.value=n.aoMap,e.aoMapIntensity.value=n.aoMapIntensity);var a;n.map?a=n.map:n.specularMap?a=n.specularMap:n.displacementMap?a=n.displacementMap:n.normalMap?a=n.normalMap:n.bumpMap?a=n.bumpMap:n.roughnessMap?a=n.roughnessMap:n.metalnessMap?a=n.metalnessMap:n.alphaMap?a=n.alphaMap:n.emissiveMap?a=n.emissiveMap:n.clearcoatMap?a=n.clearcoatMap:n.clearcoatNormalMap?a=n.clearcoatNormalMap:n.clearcoatRoughnessMap&&(a=n.clearcoatRoughnessMap),void 0!==a&&(a.isWebGLRenderTarget&&(a=a.texture),!0===a.matrixAutoUpdate&&a.updateMatrix(),e.uvTransform.value.copy(a.matrix));var o;n.aoMap?o=n.aoMap:n.lightMap&&(o=n.lightMap),void 0!==o&&(o.isWebGLRenderTarget&&(o=o.texture),!0===o.matrixAutoUpdate&&o.updateMatrix(),e.uv2Transform.value.copy(o.matrix))}function i(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}function a(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}function o(t,e,n,r){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*n,t.scale.value=.5*r,e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap);var i;e.map?i=e.map:e.alphaMap&&(i=e.alphaMap),void 0!==i&&(!0===i.matrixAutoUpdate&&i.updateMatrix(),t.uvTransform.value.copy(i.matrix))}function s(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap);var n;e.map?n=e.map:e.alphaMap&&(n=e.alphaMap),void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),t.uvTransform.value.copy(n.matrix))}function c(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}function l(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===Ha&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===Ha&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function u(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===Ha&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===Ha&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function h(e,n){e.roughness.value=n.roughness,e.metalness.value=n.metalness,n.roughnessMap&&(e.roughnessMap.value=n.roughnessMap),n.metalnessMap&&(e.metalnessMap.value=n.metalnessMap),n.emissiveMap&&(e.emissiveMap.value=n.emissiveMap),n.bumpMap&&(e.bumpMap.value=n.bumpMap,e.bumpScale.value=n.bumpScale,n.side===Ha&&(e.bumpScale.value*=-1)),n.normalMap&&(e.normalMap.value=n.normalMap,e.normalScale.value.copy(n.normalScale),n.side===Ha&&e.normalScale.value.negate()),n.displacementMap&&(e.displacementMap.value=n.displacementMap,e.displacementScale.value=n.displacementScale,e.displacementBias.value=n.displacementBias),t.get(n).envMap&&(e.envMapIntensity.value=n.envMapIntensity)}function d(t,e){h(t,e),t.reflectivity.value=e.reflectivity,t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.sheen&&t.sheen.value.copy(e.sheen),e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap),e.clearcoatNormalMap&&(t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),t.clearcoatNormalMap.value=e.clearcoatNormalMap,e.side===Ha&&t.clearcoatNormalScale.value.negate()),t.transmission.value=e.transmission,e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap)}function p(t,e){e.matcap&&(t.matcap.value=e.matcap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===Ha&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===Ha&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function f(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function m(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}function v(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===Ha&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===Ha&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}return{refreshFogUniforms:e,refreshMaterialUniforms:n}}function je(){var t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return t.style.display="block",t}function qe(t){function e(){return null===B?it:1}function n(t,e){for(var n=0;n<t.length;n++){var r=t[n],i=y.getContext(r,e);if(null!==i)return i}return null}function r(){bt=new $(yt),wt=new J(yt,bt,t),bt.init(wt),Gt=new ze(yt,bt,wt),Mt=new Ne(yt,bt,wt),Mt.scissor(U.copy(ut).multiplyScalar(it).floor()),Mt.viewport(G.copy(lt).multiplyScalar(it).floor()),St=new nt(yt),Tt=new be,Et=new Be(yt,bt,Mt,Tt,wt,Gt,St),At=new K(P),Lt=new q(yt,wt),Ut=new Y(yt,bt,Lt,wt),Rt=new tt(yt,Lt,St,Ut),Ct=new ot(yt,Rt,Lt,St),zt=new at(yt),Nt=new Q(Tt),Pt=new _e(P,At,bt,wt,Ut,Nt),Ot=new We(Tt),It=new Te(Tt),Dt=new Pe(bt,wt),Bt=new X(P,At,Mt,Ct,S),Ft=new Z(yt,bt,St,wt),Ht=new et(yt,bt,St,wt),St.programs=Pt.programs,P.capabilities=wt,P.extensions=bt,P.properties=Tt,P.renderLists=It,P.state=Mt,P.info=St}function i(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),O=!0}function a(){console.log("THREE.WebGLRenderer: Context Restored."),O=!1,r()}function o(t){var e=t.target;e.removeEventListener("dispose",o),s(e)}function s(t){c(t),Tt.remove(t)}function c(t){var e=Tt.get(t).program;void 0!==e&&Pt.releaseProgram(e)}function l(t,e){t.render(function(t){P.renderBufferImmediate(t,e)})}function u(t){kt.isPresenting||Wt&&Wt(t)}function h(t,e,n,r){if(!1!==t.visible){if(t.layers.test(e.layers))if(t.isGroup)n=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)R.pushLight(t),t.castShadow&&R.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||dt.intersectsSprite(t)){r&&vt.setFromMatrixPosition(t.matrixWorld).applyMatrix4(mt);var i=Ct.update(t),a=t.material;a.visible&&L.push(t,i,a,n,vt.z,null)}}else if(t.isImmediateRenderObject)r&&vt.setFromMatrixPosition(t.matrixWorld).applyMatrix4(mt),L.push(t,null,t.material,n,vt.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.frame!==St.render.frame&&(t.skeleton.update(),t.skeleton.frame=St.render.frame),!t.frustumCulled||dt.intersectsObject(t))){r&&vt.setFromMatrixPosition(t.matrixWorld).applyMatrix4(mt);var o=Ct.update(t),s=t.material;if(Array.isArray(s))for(var c=o.groups,l=0,u=c.length;l<u;l++){var d=c[l],p=s[d.materialIndex];p&&p.visible&&L.push(t,o,p,n,vt.z,d)}else s.visible&&L.push(t,o,s,n,vt.z,null)}for(var f=t.children,m=0,v=f.length;m<v;m++)h(f[m],e,n,r)}}function d(t,e,n){for(var r=!0===e.isScene?e.overrideMaterial:null,i=0,a=t.length;i<a;i++){var o=t[i],s=o.object,c=o.geometry,l=null===r?o.material:r,u=o.group;if(n.isArrayCamera)for(var h=n.cameras,d=0,f=h.length;d<f;d++){var m=h[d];s.layers.test(m.layers)&&(Mt.viewport(G.copy(m.viewport)),R.setupLightsView(m),p(s,e,m,c,l,u))}else p(s,e,n,c,l,u)}}function p(t,e,n,r,i,a){if(t.onBeforeRender(P,e,n,r,i,a),t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),t.isImmediateRenderObject){var o=m(n,e,i,t);Mt.setMaterial(i),Ut.reset(),l(t,o)}else P.renderBufferDirect(n,e,r,i,t,a);t.onAfterRender(P,e,n,r,i,a)}function f(t,e,n){!0!==e.isScene&&(e=gt);var r=Tt.get(t),i=R.state.lights,a=R.state.shadowsArray,s=i.state.version,l=Pt.getParameters(t,i.state,a,e,n),u=Pt.getProgramCacheKey(l),h=r.program,d=!0;if(r.environment=t.isMeshStandardMaterial?e.environment:null,r.fog=e.fog,r.envMap=At.get(t.envMap||r.environment),void 0===h)t.addEventListener("dispose",o);else if(h.cacheKey!==u)c(t);else if(r.lightsStateVersion!==s)d=!1;else{if(void 0!==l.shaderID)return;d=!1}d&&(l.uniforms=Pt.getUniforms(t),t.onBeforeCompile(l,P),h=Pt.acquireProgram(l,u),r.program=h,r.uniforms=l.uniforms,r.outputEncoding=l.outputEncoding);var p=r.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(r.numClippingPlanes=Nt.numPlanes,r.numIntersection=Nt.numIntersection,p.clippingPlanes=Nt.uniform),r.needsLights=g(t),r.lightsStateVersion=s,r.needsLights&&(p.ambientLightColor.value=i.state.ambient,p.lightProbe.value=i.state.probe,p.directionalLights.value=i.state.directional,p.directionalLightShadows.value=i.state.directionalShadow,p.spotLights.value=i.state.spot,p.spotLightShadows.value=i.state.spotShadow,p.rectAreaLights.value=i.state.rectArea,p.ltc_1.value=i.state.rectAreaLTC1,p.ltc_2.value=i.state.rectAreaLTC2,p.pointLights.value=i.state.point,p.pointLightShadows.value=i.state.pointShadow,p.hemisphereLights.value=i.state.hemi,p.directionalShadowMap.value=i.state.directionalShadowMap,p.directionalShadowMatrix.value=i.state.directionalShadowMatrix,p.spotShadowMap.value=i.state.spotShadowMap,p.spotShadowMatrix.value=i.state.spotShadowMatrix,p.pointShadowMap.value=i.state.pointShadowMap,p.pointShadowMatrix.value=i.state.pointShadowMatrix);var f=r.program.getUniforms(),m=Zt.seqWithValue(f.seq,p);r.uniformsList=m}function m(t,e,n,r){!0!==e.isScene&&(e=gt),Et.resetTextureUnits();var i=e.fog,a=n.isMeshStandardMaterial?e.environment:null,o=null===B?P.outputEncoding:B.texture.encoding,s=At.get(n.envMap||a),c=Tt.get(n),l=R.state.lights;if(!0===pt&&(!0===ft||t!==H)){var u=t===H&&n.id===F;Nt.setState(n,t,u)}n.version===c.__version?n.fog&&c.fog!==i?f(n,e,r):c.environment!==a?f(n,e,r):c.needsLights&&c.lightsStateVersion!==l.state.version?f(n,e,r):void 0===c.numClippingPlanes||c.numClippingPlanes===Nt.numPlanes&&c.numIntersection===Nt.numIntersection?c.outputEncoding!==o?f(n,e,r):c.envMap!==s&&f(n,e,r):f(n,e,r):(f(n,e,r),c.__version=n.version);var h=!1,d=!1,p=!1,m=c.program,g=m.getUniforms(),y=c.uniforms;if(Mt.useProgram(m.program)&&(h=!0,d=!0,p=!0),n.id!==F&&(F=n.id,d=!0),h||H!==t){if(g.setValue(yt,"projectionMatrix",t.projectionMatrix),wt.logarithmicDepthBuffer&&g.setValue(yt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),H!==t&&(H=t,d=!0,p=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshStandardMaterial||n.envMap){var x=g.map.cameraPosition;void 0!==x&&x.setValue(yt,vt.setFromMatrixPosition(t.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&g.setValue(yt,"isOrthographic",!0===t.isOrthographicCamera),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.isShadowMaterial||n.skinning)&&g.setValue(yt,"viewMatrix",t.matrixWorldInverse)}if(n.skinning){g.setOptional(yt,r,"bindMatrix"),g.setOptional(yt,r,"bindMatrixInverse");var _=r.skeleton;if(_){var b=_.bones;if(wt.floatVertexTextures){if(null===_.boneTexture){var w=Math.sqrt(4*b.length);w=Sc.ceilPowerOfTwo(w),w=Math.max(w,4);var M=new Float32Array(w*w*4);M.set(_.boneMatrices);var S=new W(M,w,w,ns,Yo);_.boneMatrices=M,_.boneTexture=S,_.boneTextureSize=w}g.setValue(yt,"boneTexture",_.boneTexture,Et),g.setValue(yt,"boneTextureSize",_.boneTextureSize)}else g.setOptional(yt,_,"boneMatrices")}}return(d||c.receiveShadow!==r.receiveShadow)&&(c.receiveShadow=r.receiveShadow,g.setValue(yt,"receiveShadow",r.receiveShadow)),d&&(g.setValue(yt,"toneMappingExposure",P.toneMappingExposure),c.needsLights&&v(y,p),i&&n.fog&&Ot.refreshFogUniforms(y,i),Ot.refreshMaterialUniforms(y,n,it,rt),Zt.upload(yt,c.uniformsList,y,Et)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(Zt.upload(yt,c.uniformsList,y,Et),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&g.setValue(yt,"center",r.center),g.setValue(yt,"modelViewMatrix",r.modelViewMatrix),g.setValue(yt,"normalMatrix",r.normalMatrix),g.setValue(yt,"modelMatrix",r.matrixWorld),m}function v(t,e){t.ambientLightColor.needsUpdate=e,t.lightProbe.needsUpdate=e,t.directionalLights.needsUpdate=e,t.directionalLightShadows.needsUpdate=e,t.pointLights.needsUpdate=e,t.pointLightShadows.needsUpdate=e,t.spotLights.needsUpdate=e,t.spotLightShadows.needsUpdate=e,t.rectAreaLights.needsUpdate=e,t.hemisphereLights.needsUpdate=e}function g(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}t=t||{};var y=void 0!==t.canvas?t.canvas:je(),x=void 0!==t.context?t.context:null,_=void 0!==t.alpha&&t.alpha,b=void 0===t.depth||t.depth,w=void 0===t.stencil||t.stencil,M=void 0!==t.antialias&&t.antialias,S=void 0===t.premultipliedAlpha||t.premultipliedAlpha,T=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,E=void 0!==t.powerPreference?t.powerPreference:"default",A=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat,L=null,R=null,C=[];this.domElement=y,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.gammaFactor=2,this.outputEncoding=rc,this.physicallyCorrectLights=!1,this.toneMapping=bo,this.toneMappingExposure=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var P=this,O=!1,I=null,D=0,N=0,B=null,z=null,F=-1,H=null,G=new Rc,U=new Rc,k=null,V=y.width,rt=y.height,it=1,st=null,ct=null,lt=new Rc(0,0,V,rt),ut=new Rc(0,0,V,rt),ht=!1,dt=new Du,pt=!1,ft=!1,mt=new ol,vt=new Ic,gt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},yt=x;try{var xt={alpha:_,depth:b,stencil:w,antialias:M,premultipliedAlpha:S,preserveDrawingBuffer:T,powerPreference:E,failIfMajorPerformanceCaveat:A};if(y.addEventListener("webglcontextlost",i,!1),y.addEventListener("webglcontextrestored",a,!1),null===yt){var _t=["webgl2","webgl","experimental-webgl"];if(!0===P.isWebGL1Renderer&&_t.shift(),null===(yt=n(_t,xt)))throw n(_t)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===yt.getShaderPrecisionFormat&&(yt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}var bt,wt,Mt,St,Tt,Et,At,Lt,Rt,Ct,Pt,Ot,It,Dt,Nt,Bt,zt,Ft,Ht,Gt,Ut;r();var kt="undefined"!=typeof navigator&&"xr"in navigator?new Ve(P,yt):new Ue(P);this.xr=kt;var Vt=new De(P,Ct,wt.maxTextureSize);this.shadowMap=Vt,this.getContext=function(){return yt},this.getContextAttributes=function(){return yt.getContextAttributes()},this.forceContextLoss=function(){var t=bt.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){var t=bt.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return it},this.setPixelRatio=function(t){void 0!==t&&(it=t,this.setSize(V,rt,!1))},this.getSize=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),t=new Tc),t.set(V,rt)},this.setSize=function(t,e,n){if(kt.isPresenting)return void console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");V=t,rt=e,y.width=Math.floor(t*it),y.height=Math.floor(e*it),!1!==n&&(y.style.width=t+"px",y.style.height=e+"px"),this.setViewport(0,0,t,e)},this.getDrawingBufferSize=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),t=new Tc),t.set(V*it,rt*it).floor()},this.setDrawingBufferSize=function(t,e,n){V=t,rt=e,it=n,y.width=Math.floor(t*n),y.height=Math.floor(e*n),this.setViewport(0,0,t,e)},this.getCurrentViewport=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),t=new Rc),t.copy(G)},this.getViewport=function(t){return t.copy(lt)},this.setViewport=function(t,e,n,r){t.isVector4?lt.set(t.x,t.y,t.z,t.w):lt.set(t,e,n,r),Mt.viewport(G.copy(lt).multiplyScalar(it).floor())},this.getScissor=function(t){return t.copy(ut)},this.setScissor=function(t,e,n,r){t.isVector4?ut.set(t.x,t.y,t.z,t.w):ut.set(t,e,n,r),Mt.scissor(U.copy(ut).multiplyScalar(it).floor())},this.getScissorTest=function(){return ht},this.setScissorTest=function(t){Mt.setScissorTest(ht=t)},this.setOpaqueSort=function(t){st=t},this.setTransparentSort=function(t){ct=t},this.getClearColor=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getClearColor() now requires a Color as an argument"),t=new Zl),t.copy(Bt.getClearColor())},this.setClearColor=function(){Bt.setClearColor.apply(Bt,arguments)},this.getClearAlpha=function(){return Bt.getClearAlpha()},this.setClearAlpha=function(){Bt.setClearAlpha.apply(Bt,arguments)},this.clear=function(t,e,n){var r=0;(void 0===t||t)&&(r|=16384),(void 0===e||e)&&(r|=256),(void 0===n||n)&&(r|=1024),yt.clear(r)},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(){y.removeEventListener("webglcontextlost",i,!1),y.removeEventListener("webglcontextrestored",a,!1),It.dispose(),Dt.dispose(),Tt.dispose(),At.dispose(),Ct.dispose(),Ut.dispose(),kt.dispose(),jt.stop()},this.renderBufferImmediate=function(t,e){Ut.initAttributes();var n=Tt.get(t);t.hasPositions&&!n.position&&(n.position=yt.createBuffer()),t.hasNormals&&!n.normal&&(n.normal=yt.createBuffer()),t.hasUvs&&!n.uv&&(n.uv=yt.createBuffer()),t.hasColors&&!n.color&&(n.color=yt.createBuffer());var r=e.getAttributes();t.hasPositions&&(yt.bindBuffer(34962,n.position),yt.bufferData(34962,t.positionArray,35048),Ut.enableAttribute(r.position),yt.vertexAttribPointer(r.position,3,5126,!1,0,0)),t.hasNormals&&(yt.bindBuffer(34962,n.normal),yt.bufferData(34962,t.normalArray,35048),Ut.enableAttribute(r.normal),yt.vertexAttribPointer(r.normal,3,5126,!1,0,0)),t.hasUvs&&(yt.bindBuffer(34962,n.uv),yt.bufferData(34962,t.uvArray,35048),Ut.enableAttribute(r.uv),yt.vertexAttribPointer(r.uv,2,5126,!1,0,0)),t.hasColors&&(yt.bindBuffer(34962,n.color),yt.bufferData(34962,t.colorArray,35048),Ut.enableAttribute(r.color),yt.vertexAttribPointer(r.color,3,5126,!1,0,0)),Ut.disableUnusedAttributes(),yt.drawArrays(4,0,t.count),t.count=0},this.renderBufferDirect=function(t,n,r,i,a,o){null===n&&(n=gt);var s=a.isMesh&&a.matrixWorld.determinant()<0,c=m(t,n,i,a);Mt.setMaterial(i,s);var l=r.index,u=r.attributes.position;if(null===l){if(void 0===u||0===u.count)return}else if(0===l.count)return;var h=1;!0===i.wireframe&&(l=Rt.getWireframeAttribute(r),h=2),(i.morphTargets||i.morphNormals)&&zt.update(a,r,i,c),Ut.setup(a,i,c,r,l);var d,p=Ft;null!==l&&(d=Lt.get(l),p=Ht,p.setIndex(d));var f=null!==l?l.count:u.count,v=r.drawRange.start*h,g=r.drawRange.count*h,y=null!==o?o.start*h:0,x=null!==o?o.count*h:1/0,_=Math.max(v,y),b=Math.min(f,v+g,y+x)-1,w=Math.max(0,b-_+1);if(0!==w){if(a.isMesh)!0===i.wireframe?(Mt.setLineWidth(i.wireframeLinewidth*e()),p.setMode(1)):p.setMode(4);else if(a.isLine){var M=i.linewidth;void 0===M&&(M=1),Mt.setLineWidth(M*e()),a.isLineSegments?p.setMode(1):a.isLineLoop?p.setMode(2):p.setMode(3)}else a.isPoints?p.setMode(0):a.isSprite&&p.setMode(4);if(a.isInstancedMesh)p.renderInstances(_,w,a.count);else if(r.isInstancedBufferGeometry){var S=Math.min(r.instanceCount,r._maxInstanceCount);p.renderInstances(_,w,S)}else p.render(_,w)}},this.compile=function(t,e){R=Dt.get(t),R.init(),t.traverseVisible(function(t){t.isLight&&t.layers.test(e.layers)&&(R.pushLight(t),t.castShadow&&R.pushShadow(t))}),R.setupLights();var n=new WeakMap;t.traverse(function(e){var r=e.material;if(r)if(Array.isArray(r))for(var i=0;i<r.length;i++){var a=r[i];!1===n.has(a)&&(f(a,t,e),n.set(a))}else!1===n.has(r)&&(f(r,t,e),n.set(r))})};var Wt=null,jt=new j;jt.setAnimationLoop(u),"undefined"!=typeof window&&jt.setContext(window),this.setAnimationLoop=function(t){Wt=t,kt.setAnimationLoop(t),null===t?jt.stop():jt.start()},this.render=function(t,e){var n,r;if(void 0!==arguments[2]&&(console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),n=arguments[2]),void 0!==arguments[3]&&(console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."),r=arguments[3]),void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0!==O){Ut.resetDefaultState(),F=-1,H=null,!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),!0===kt.enabled&&!0===kt.isPresenting&&(e=kt.getCamera(e)),!0===t.isScene&&t.onBeforeRender(P,t,e,n||B),R=Dt.get(t,C.length),R.init(),C.push(R),mt.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),dt.setFromProjectionMatrix(mt),ft=this.localClippingEnabled,pt=Nt.init(this.clippingPlanes,ft,e),L=It.get(t,e),L.init(),h(t,e,0,P.sortObjects),L.finish(),!0===P.sortObjects&&L.sort(st,ct),!0===pt&&Nt.beginShadows();var i=R.state.shadowsArray;Vt.render(i,t,e),R.setupLights(),R.setupLightsView(e),!0===pt&&Nt.endShadows(),!0===this.info.autoReset&&this.info.reset(),void 0!==n&&this.setRenderTarget(n),Bt.render(L,t,e,r);var a=L.opaque,o=L.transparent;a.length>0&&d(a,t,e),o.length>0&&d(o,t,e),!0===t.isScene&&t.onAfterRender(P,t,e),null!==B&&(Et.updateRenderTargetMipmap(B),Et.updateMultisampleRenderTarget(B)),Mt.buffers.depth.setTest(!0),Mt.buffers.depth.setMask(!0),Mt.buffers.color.setMask(!0),Mt.setPolygonOffset(!1),kt.enabled&&kt.submitFrame&&kt.submitFrame(),C.pop(),R=C.length>0?C[C.length-1]:null,L=null}},this.setTexture2D=function(){var t=!1;return function(e,n){e&&e.isWebGLRenderTarget&&(t||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),Et.setTexture2D(e,n)}}(),this.setFramebuffer=function(t){I!==t&&null===B&&yt.bindFramebuffer(36160,t),I=t},this.getActiveCubeFace=function(){return D},this.getActiveMipmapLevel=function(){return N},this.getRenderList=function(){return L},this.setRenderList=function(t){L=t},this.getRenderTarget=function(){return B},this.setRenderTarget=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=0),B=t,D=e,N=n,t&&void 0===Tt.get(t).__webglFramebuffer&&Et.setupRenderTarget(t);var r=I,i=!1;if(t){var a=Tt.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=a[e],i=!0):r=t.isWebGLMultisampleRenderTarget?Tt.get(t).__webglMultisampledFramebuffer:a,G.copy(t.viewport),U.copy(t.scissor),k=t.scissorTest}else G.copy(lt).multiplyScalar(it).floor(),U.copy(ut).multiplyScalar(it).floor(),k=ht;if(z!==r&&(yt.bindFramebuffer(36160,r),z=r),Mt.viewport(G),Mt.scissor(U),Mt.setScissorTest(k),i){var o=Tt.get(t.texture);yt.framebufferTexture2D(36160,36064,34069+e,o.__webglTexture,n)}},this.readRenderTargetPixels=function(t,e,n,r,i,a,o){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");var s=Tt.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){var c=!1;s!==z&&(yt.bindFramebuffer(36160,s),c=!0);try{var l=t.texture,u=l.format,h=l.type;if(u!==ns&&Gt.convert(u)!==yt.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");var d=h===Zo&&(bt.has("EXT_color_buffer_half_float")||wt.isWebGL2&&bt.has("EXT_color_buffer_float"));if(!(h===ko||Gt.convert(h)===yt.getParameter(35738)||h===Yo&&(wt.isWebGL2||bt.has("OES_texture_float")||bt.has("WEBGL_color_buffer_float"))||d))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===yt.checkFramebufferStatus(36160)?e>=0&&e<=t.width-r&&n>=0&&n<=t.height-i&&yt.readPixels(e,n,r,i,Gt.convert(u),Gt.convert(h),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{c&&yt.bindFramebuffer(36160,z)}}},this.copyFramebufferToTexture=function(t,e,n){void 0===n&&(n=0);var r=Math.pow(2,-n),i=Math.floor(e.image.width*r),a=Math.floor(e.image.height*r),o=Gt.convert(e.format);Et.setTexture2D(e,0),yt.copyTexImage2D(3553,n,o,t.x,t.y,i,a,0),Mt.unbindTexture()},this.copyTextureToTexture=function(t,e,n,r){void 0===r&&(r=0);var i=e.image.width,a=e.image.height,o=Gt.convert(n.format),s=Gt.convert(n.type);Et.setTexture2D(n,0),yt.pixelStorei(37440,n.flipY),yt.pixelStorei(37441,n.premultiplyAlpha),yt.pixelStorei(3317,n.unpackAlignment),e.isDataTexture?yt.texSubImage2D(3553,r,t.x,t.y,i,a,o,s,e.image.data):e.isCompressedTexture?yt.compressedTexSubImage2D(3553,r,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,o,e.mipmaps[0].data):yt.texSubImage2D(3553,r,t.x,t.y,o,s,e.image),0===r&&n.generateMipmaps&&yt.generateMipmap(3553),Mt.unbindTexture()},this.initTexture=function(t){Et.setTexture2D(t,0),Mt.unbindTexture()},this.resetState=function(){Mt.reset(),Ut.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function Xe(t){qe.call(this,t)}function Ye(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=gc,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Sc.generateUUID()}function Ze(t,e,n,r){this.name="",this.data=t,this.itemSize=e,this.offset=n,this.normalized=!0===r}function Je(t){y.call(this),this.type="SpriteMaterial",this.color=new Zl(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(t)}function Qe(t){if(f.call(this),this.type="Sprite",void 0===ch){ch=new I;var e=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Ye(e,5);ch.setIndex([0,1,2,0,2,3]),ch.setAttribute("position",new Ze(n,3,0,!1)),ch.setAttribute("uv",new Ze(n,2,3,!1))}this.geometry=ch,this.material=void 0!==t?t:new Je,this.center=new Tc(.5,.5)}function Ke(t,e,n,r,i,a){dh.subVectors(t,n).addScalar(.5).multiply(r),void 0!==i?(ph.x=a*dh.x-i*dh.y,ph.y=i*dh.x+a*dh.y):ph.copy(dh),t.copy(e),t.x+=ph.x,t.y+=ph.y,t.applyMatrix4(fh)}function $e(){f.call(this),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}function tn(t,e){t&&t.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),D.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new ol,this.bindMatrixInverse=new ol}function en(){f.call(this),this.type="Bone"
  130. }function nn(t,e){void 0===t&&(t=[]),void 0===e&&(e=[]),this.uuid=Sc.generateUUID(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}function rn(t,e,n){D.call(this,t,e),this.instanceMatrix=new _(new Float32Array(16*n),16),this.instanceColor=null,this.count=n,this.frustumCulled=!1}function an(t){y.call(this),this.type="LineBasicMaterial",this.color=new Zl(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.morphTargets=!1,this.setValues(t)}function on(t,e){void 0===t&&(t=new I),void 0===e&&(e=new an),f.call(this),this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}function sn(t,e){on.call(this,t,e),this.type="LineSegments"}function cn(t,e){on.call(this,t,e),this.type="LineLoop"}function ln(t){y.call(this),this.type="PointsMaterial",this.color=new Zl(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(t)}function un(t,e){void 0===t&&(t=new I),void 0===e&&(e=new ln),f.call(this),this.type="Points",this.geometry=t,this.material=e,this.updateMorphTargets()}function hn(t,e,n,r,i,a,o){var s=kh.distanceSqToPoint(t);if(s<n){var c=new Ic;kh.closestPointToPoint(t,c),c.applyMatrix4(r);var l=i.ray.origin.distanceTo(c);if(l<i.near||l>i.far)return;a.push({distance:l,distanceToRay:Math.sqrt(s),point:c,index:e,face:null,object:o})}}function dn(t,e,n,r,i,a,o,s,c){function l(){u.needsUpdate=!0,t.requestVideoFrameCallback(l)}h.call(this,t,e,n,r,i,a,o,s,c),this.format=void 0!==o?o:es,this.minFilter=void 0!==a?a:Ho,this.magFilter=void 0!==i?i:Ho,this.generateMipmaps=!1;var u=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback(l)}function pn(t,e,n,r,i,a,o,s,c,l,u,d){h.call(this,null,a,o,s,c,l,r,i,u,d),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}function fn(t,e,n,r,i,a,o,s,c){h.call(this,t,e,n,r,i,a,o,s,c),this.needsUpdate=!0}function mn(t,e,n,r,i,a,o,s,c,l){if((l=void 0!==l?l:os)!==os&&l!==ss)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&l===os&&(n=jo),void 0===n&&l===ss&&(n=$o),h.call(this,null,r,i,a,o,s,l,n,c),this.image={width:t,height:e},this.magFilter=void 0!==o?o:Bo,this.minFilter=void 0!==s?s:Bo,this.flipY=!1,this.generateMipmaps=!1}function vn(t,e,n,r,i){var a,o;if(i===qn(t,e,n,r)>0)for(a=e;a<n;a+=r)o=Vn(a,t[a],t[a+1],o);else for(a=n-r;a>=e;a-=r)o=Vn(a,t[a],t[a+1],o);return o&&Nn(o,o.next)&&(Wn(o),o=o.next),o}function gn(t,e){if(!t)return t;e||(e=t);var n,r=t;do{if(n=!1,r.steiner||!Nn(r,r.next)&&0!==Dn(r.prev,r,r.next))r=r.next;else{if(Wn(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function yn(t,e,n,r,i,a,o){if(t){!o&&a&&Ln(t,r,i,a);for(var s,c,l=t;t.prev!==t.next;)if(s=t.prev,c=t.next,a?_n(t,r,i,a):xn(t))e.push(s.i/n),e.push(t.i/n),e.push(c.i/n),Wn(t),t=c.next,l=c.next;else if((t=c)===l){o?1===o?(t=bn(gn(t),e,n),yn(t,e,n,r,i,a,2)):2===o&&wn(t,e,n,r,i,a):yn(gn(t),e,n,r,i,a,1);break}}}function xn(t){var e=t.prev,n=t,r=t.next;if(Dn(e,n,r)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(On(e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y)&&Dn(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function _n(t,e,n,r){var i=t.prev,a=t,o=t.next;if(Dn(i,a,o)>=0)return!1;for(var s=i.x<a.x?i.x<o.x?i.x:o.x:a.x<o.x?a.x:o.x,c=i.y<a.y?i.y<o.y?i.y:o.y:a.y<o.y?a.y:o.y,l=i.x>a.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,u=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,h=Cn(s,c,e,n,r),d=Cn(l,u,e,n,r),p=t.prevZ,f=t.nextZ;p&&p.z>=h&&f&&f.z<=d;){if(p!==t.prev&&p!==t.next&&On(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&Dn(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==t.prev&&f!==t.next&&On(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&Dn(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=h;){if(p!==t.prev&&p!==t.next&&On(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&Dn(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==t.prev&&f!==t.next&&On(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&Dn(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function bn(t,e,n){var r=t;do{var i=r.prev,a=r.next.next;!Nn(i,a)&&Bn(i,r,r.next,a)&&Gn(i,a)&&Gn(a,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(a.i/n),Wn(r),Wn(r.next),r=t=a),r=r.next}while(r!==t);return gn(r)}function wn(t,e,n,r,i,a){var o=t;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&In(o,s)){var c=kn(o,s);return o=gn(o,o.next),c=gn(c,c.next),yn(o,e,n,r,i,a),void yn(c,e,n,r,i,a)}s=s.next}o=o.next}while(o!==t)}function Mn(t,e,n,r){var i,a,o,s,c,l=[];for(i=0,a=e.length;i<a;i++)o=e[i]*r,s=i<a-1?e[i+1]*r:t.length,c=vn(t,o,s,r,!1),c===c.next&&(c.steiner=!0),l.push(Pn(c));for(l.sort(Sn),i=0;i<l.length;i++)Tn(l[i],n),n=gn(n,n.next);return n}function Sn(t,e){return t.x-e.x}function Tn(t,e){if(e=En(t,e)){var n=kn(e,t);gn(e,e.next),gn(n,n.next)}}function En(t,e){var n,r=e,i=t.x,a=t.y,o=-1/0;do{if(a<=r.y&&a>=r.next.y&&r.next.y!==r.y){var s=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=i&&s>o){if(o=s,s===i){if(a===r.y)return r;if(a===r.next.y)return r.next}n=r.x<r.next.x?r:r.next}}r=r.next}while(r!==e);if(!n)return null;if(i===o)return n;var c,l=n,u=n.x,h=n.y,d=1/0;r=n;do{i>=r.x&&r.x>=u&&i!==r.x&&On(a<h?i:o,a,u,h,a<h?o:i,a,r.x,r.y)&&(c=Math.abs(a-r.y)/(i-r.x),Gn(r,t)&&(c<d||c===d&&(r.x>n.x||r.x===n.x&&An(n,r)))&&(n=r,d=c)),r=r.next}while(r!==l);return n}function An(t,e){return Dn(t.prev,t,e.prev)<0&&Dn(e.next,t,t.next)<0}function Ln(t,e,n,r){var i=t;do{null===i.z&&(i.z=Cn(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,Rn(i)}function Rn(t){var e,n,r,i,a,o,s,c,l=1;do{for(n=t,t=null,a=null,o=0;n;){for(o++,r=n,s=0,e=0;e<l&&(s++,r=r.nextZ);e++);for(c=l;s>0||c>0&&r;)0!==s&&(0===c||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,c--),a?a.nextZ=i:t=i,i.prevZ=a,a=i;n=r}a.nextZ=null,l*=2}while(o>1);return t}function Cn(t,e,n,r,i){return t=32767*(t-n)*i,e=32767*(e-r)*i,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t|e<<1}function Pn(t){var e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function On(t,e,n,r,i,a,o,s){return(i-o)*(e-s)-(t-o)*(a-s)>=0&&(t-o)*(r-s)-(n-o)*(e-s)>=0&&(n-o)*(a-s)-(i-o)*(r-s)>=0}function In(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!Hn(t,e)&&(Gn(t,e)&&Gn(e,t)&&Un(t,e)&&(Dn(t.prev,t,e.prev)||Dn(t,e.prev,e))||Nn(t,e)&&Dn(t.prev,t,t.next)>0&&Dn(e.prev,e,e.next)>0)}function Dn(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Nn(t,e){return t.x===e.x&&t.y===e.y}function Bn(t,e,n,r){var i=Fn(Dn(t,e,n)),a=Fn(Dn(t,e,r)),o=Fn(Dn(n,r,t)),s=Fn(Dn(n,r,e));return i!==a&&o!==s||(!(0!==i||!zn(t,n,e))||(!(0!==a||!zn(t,r,e))||(!(0!==o||!zn(n,t,r))||!(0!==s||!zn(n,e,r)))))}function zn(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function Fn(t){return t>0?1:t<0?-1:0}function Hn(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&Bn(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function Gn(t,e){return Dn(t.prev,t,t.next)<0?Dn(t,e,t.next)>=0&&Dn(t,t.prev,e)>=0:Dn(t,e,t.prev)<0||Dn(t,t.next,e)<0}function Un(t,e){var n=t,r=!1,i=(t.x+e.x)/2,a=(t.y+e.y)/2;do{n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}function kn(t,e){var n=new jn(t.i,t.x,t.y),r=new jn(e.i,e.x,e.y),i=t.next,a=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function Vn(t,e,n,r){var i=new jn(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Wn(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function jn(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function qn(t,e,n,r){for(var i=0,a=e,o=n-r;a<n;a+=r)i+=(t[o]-t[a])*(t[a+1]+t[o+1]),o=a;return i}function Xn(t){var e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function Yn(t,e){for(var n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}function Zn(t,e,n){if(n.shapes=[],Array.isArray(t))for(var r=0,i=t.length;r<i;r++){var a=t[r];n.shapes.push(a.uuid)}else n.shapes.push(t.uuid);return void 0!==e.extrudePath&&(n.options.extrudePath=e.extrudePath.toJSON()),n}function Jn(t,e,n){I.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:n};var r=[],i=[],a=[],o=[],s=new Ic,c=new Ic,l=new Ic,u=new Ic,h=new Ic;t.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");for(var d=e+1,p=0;p<=n;p++)for(var f=p/n,m=0;m<=e;m++){var v=m/e;t(v,f,c),i.push(c.x,c.y,c.z),v-1e-5>=0?(t(v-1e-5,f,l),u.subVectors(c,l)):(t(v+1e-5,f,l),u.subVectors(l,c)),f-1e-5>=0?(t(v,f-1e-5,l),h.subVectors(c,l)):(t(v,f+1e-5,l),h.subVectors(l,c)),s.crossVectors(u,h).normalize(),a.push(s.x,s.y,s.z),o.push(v,f)}for(var g=0;g<n;g++)for(var y=0;y<e;y++){var x=g*d+y,_=g*d+y+1,b=(g+1)*d+y+1,w=(g+1)*d+y;r.push(x,_,w),r.push(_,b,w)}this.setIndex(r),this.setAttribute("position",new R(i,3)),this.setAttribute("normal",new R(a,3)),this.setAttribute("uv",new R(o,2))}function Qn(t,e){if(e.shapes=[],Array.isArray(t))for(var n=0,r=t.length;n<r;n++){var i=t[n];e.shapes.push(i.uuid)}else e.shapes.push(t.uuid);return e}function Kn(t){y.call(this),this.type="ShadowMaterial",this.color=new Zl(0),this.transparent=!0,this.setValues(t)}function $n(t){H.call(this,t),this.type="RawShaderMaterial"}function tr(t){y.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Zl(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 Zl(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=pc,this.normalScale=new Tc(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.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.vertexTangents=!1,this.setValues(t)}function er(t){tr.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Tc(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,Object.defineProperty(this,"ior",{get:function(){return(1+.4*this.reflectivity)/(1-.4*this.reflectivity)},set:function(t){this.reflectivity=Sc.clamp(2.5*(t-1)/(t+1),0,1)}}),this.sheen=null,this.transmission=0,this.transmissionMap=null,this.setValues(t)}function nr(t){y.call(this),this.type="MeshPhongMaterial",this.color=new Zl(16777215),this.specular=new Zl(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Zl(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=pc,this.normalScale=new Tc(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=yo,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function rr(t){y.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Zl(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Zl(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=pc,this.normalScale=new Tc(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.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function ir(t){y.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=pc,this.normalScale=new Tc(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function ar(t){y.call(this),this.type="MeshLambertMaterial",this.color=new Zl(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Zl(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=yo,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function or(t){y.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Zl(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=pc,this.normalScale=new Tc(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function sr(t){an.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}function cr(t,e,n,r){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new e.constructor(n),this.sampleValues=e,this.valueSize=n}function lr(t,e,n,r){cr.call(this,t,e,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function ur(t,e,n,r){cr.call(this,t,e,n,r)}function hr(t,e,n,r){cr.call(this,t,e,n,r)}function dr(t,e,n,r){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=xd.convertArray(e,this.TimeBufferType),this.values=xd.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}function pr(t,e,n){dr.call(this,t,e,n)}function fr(t,e,n,r){dr.call(this,t,e,n,r)}function mr(t,e,n,r){dr.call(this,t,e,n,r)}function vr(t,e,n,r){cr.call(this,t,e,n,r)}function gr(t,e,n,r){dr.call(this,t,e,n,r)}function yr(t,e,n,r){dr.call(this,t,e,n,r)}function xr(t,e,n,r){dr.call(this,t,e,n,r)}function _r(t,e,n,r){void 0===e&&(e=-1),void 0===r&&(r=nc),this.name=t,this.tracks=n,this.duration=e,this.blendMode=r,this.uuid=Sc.generateUUID(),this.duration<0&&this.resetDuration()}function br(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return mr;case"vector":case"vector2":case"vector3":case"vector4":return xr;case"color":return fr;case"quaternion":return gr;case"bool":case"boolean":return pr;case"string":return yr}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}function wr(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var e=br(t.type);if(void 0===t.times){var n=[],r=[];xd.flattenJSON(t.keys,n,r,"value"),t.times=n,t.values=r}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}function Mr(t,e,n){var r=this,i=!1,a=0,o=0,s=void 0,c=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){o++,!1===i&&void 0!==r.onStart&&r.onStart(t,a,o),i=!0},this.itemEnd=function(t){a++,void 0!==r.onProgress&&r.onProgress(t,a,o),a===o&&(i=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(t){void 0!==r.onError&&r.onError(t)},this.resolveURL=function(t){return s?s(t):t},this.setURLModifier=function(t){return s=t,this},this.addHandler=function(t,e){return c.push(t,e),this},this.removeHandler=function(t){var e=c.indexOf(t);return-1!==e&&c.splice(e,2),this},this.getHandler=function(t){for(var e=0,n=c.length;e<n;e+=2){var r=c[e],i=c[e+1];if(r.global&&(r.lastIndex=0),r.test(t))return i}return null}}function Sr(t){this.manager=void 0!==t?t:bd,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}function Tr(t){Sr.call(this,t)}function Er(t){Sr.call(this,t)}function Ar(t){Sr.call(this,t)}function Lr(t){Sr.call(this,t)}function Rr(t){Sr.call(this,t)}function Cr(t){Sr.call(this,t)}function Pr(t){Sr.call(this,t)}function Or(){this.type="Curve",this.arcLengthDivisions=200}function Ir(t,e,n,r,i,a,o,s){Or.call(this),this.type="EllipseCurve",this.aX=t||0,this.aY=e||0,this.xRadius=n||1,this.yRadius=r||1,this.aStartAngle=i||0,this.aEndAngle=a||2*Math.PI,this.aClockwise=o||!1,this.aRotation=s||0}function Dr(t,e,n,r,i,a){Ir.call(this,t,e,n,n,r,i,a),this.type="ArcCurve"}function Nr(){function t(t,a,o,s){e=t,n=o,r=-3*t+3*a-2*o-s,i=2*t-2*a+o+s}var e=0,n=0,r=0,i=0;return{initCatmullRom:function(e,n,r,i,a){t(n,r,a*(r-e),a*(i-n))},initNonuniformCatmullRom:function(e,n,r,i,a,o,s){var c=(n-e)/a-(r-e)/(a+o)+(r-n)/o,l=(r-n)/o-(i-n)/(o+s)+(i-r)/s;c*=o,l*=o,t(n,r,c,l)},calc:function(t){var a=t*t;return e+n*t+r*a+i*(a*t)}}}function Br(t,e,n,r){void 0===t&&(t=[]),void 0===e&&(e=!1),void 0===n&&(n="centripetal"),void 0===r&&(r=.5),Or.call(this),this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=n,this.tension=r}function zr(t,e,n,r,i){var a=.5*(r-e),o=.5*(i-n),s=t*t;return(2*n-2*r+a+o)*(t*s)+(-3*n+3*r-2*a-o)*s+a*t+n}function Fr(t,e){var n=1-t;return n*n*e}function Hr(t,e){return 2*(1-t)*t*e}function Gr(t,e){return t*t*e}function Ur(t,e,n,r){return Fr(t,e)+Hr(t,n)+Gr(t,r)}function kr(t,e){var n=1-t;return n*n*n*e}function Vr(t,e){var n=1-t;return 3*n*n*t*e}function Wr(t,e){return 3*(1-t)*t*t*e}function jr(t,e){return t*t*t*e}function qr(t,e,n,r,i){return kr(t,e)+Vr(t,n)+Wr(t,r)+jr(t,i)}function Xr(t,e,n,r){void 0===t&&(t=new Tc),void 0===e&&(e=new Tc),void 0===n&&(n=new Tc),void 0===r&&(r=new Tc),Or.call(this),this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=n,this.v3=r}function Yr(t,e,n,r){void 0===t&&(t=new Ic),void 0===e&&(e=new Ic),void 0===n&&(n=new Ic),void 0===r&&(r=new Ic),Or.call(this),this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=n,this.v3=r}function Zr(t,e){void 0===t&&(t=new Tc),void 0===e&&(e=new Tc),Or.call(this),this.type="LineCurve",this.v1=t,this.v2=e}function Jr(t,e){void 0===t&&(t=new Ic),void 0===e&&(e=new Ic),Or.call(this),this.type="LineCurve3",this.v1=t,this.v2=e}function Qr(t,e,n){void 0===t&&(t=new Tc),void 0===e&&(e=new Tc),void 0===n&&(n=new Tc),Or.call(this),this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=n}function Kr(t,e,n){void 0===t&&(t=new Ic),void 0===e&&(e=new Ic),void 0===n&&(n=new Ic),Or.call(this),this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=n}function $r(t){void 0===t&&(t=[]),Or.call(this),this.type="SplineCurve",this.points=t}function ti(){Or.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function ei(t){ti.call(this),this.type="Path",this.currentPoint=new Tc,t&&this.setFromPoints(t)}function ni(t){ei.call(this,t),this.uuid=Sc.generateUUID(),this.type="Shape",this.holes=[]}function ri(t,e){void 0===e&&(e=1),f.call(this),this.type="Light",this.color=new Zl(t),this.intensity=e}function ii(t,e,n){ri.call(this,t,n),this.type="HemisphereLight",this.position.copy(f.DefaultUp),this.updateMatrix(),this.groundColor=new Zl(e)}function ai(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.mapSize=new Tc(512,512),this.map=null,this.mapPass=null,this.matrix=new ol,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Du,this._frameExtents=new Tc(1,1),this._viewportCount=1,this._viewports=[new Rc(0,0,1,1)]}function oi(){ai.call(this,new U(50,1,.5,500)),this.focus=1}function si(t,e,n,r,i,a){ri.call(this,t,e),this.type="SpotLight",this.position.copy(f.DefaultUp),this.updateMatrix(),this.target=new f,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(t){this.intensity=t/Math.PI}}),this.distance=void 0!==n?n:0,this.angle=void 0!==r?r:Math.PI/3,this.penumbra=void 0!==i?i:0,this.decay=void 0!==a?a:1,this.shadow=new oi}function ci(){ai.call(this,new U(90,1,.5,500)),this._frameExtents=new Tc(4,2),this._viewportCount=6,this._viewports=[new Rc(2,1,1,1),new Rc(0,1,1,1),new Rc(3,1,1,1),new Rc(1,1,1,1),new Rc(3,0,1,1),new Rc(1,0,1,1)],this._cubeDirections=[new Ic(1,0,0),new Ic(-1,0,0),new Ic(0,0,1),new Ic(0,0,-1),new Ic(0,1,0),new Ic(0,-1,0)],this._cubeUps=[new Ic(0,1,0),new Ic(0,1,0),new Ic(0,1,0),new Ic(0,1,0),new Ic(0,0,1),new Ic(0,0,-1)]}function li(t,e,n,r){ri.call(this,t,e),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(t){this.intensity=t/(4*Math.PI)}}),this.distance=void 0!==n?n:0,this.decay=void 0!==r?r:1,this.shadow=new ci}function ui(t,e,n,r,i,a){void 0===t&&(t=-1),void 0===e&&(e=1),void 0===n&&(n=1),void 0===r&&(r=-1),void 0===i&&(i=.1),void 0===a&&(a=2e3),G.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=r,this.near=i,this.far=a,this.updateProjectionMatrix()}function hi(){ai.call(this,new ui(-5,5,5,-5,.5,500))}function di(t,e){ri.call(this,t,e),this.type="DirectionalLight",this.position.copy(f.DefaultUp),this.updateMatrix(),this.target=new f,this.shadow=new hi}function pi(t,e){ri.call(this,t,e),this.type="AmbientLight"}function fi(t,e,n,r){ri.call(this,t,e),this.type="RectAreaLight",this.width=void 0!==n?n:10,this.height=void 0!==r?r:10}function mi(t,e){ri.call(this,void 0,e),this.type="LightProbe",this.sh=void 0!==t?t:new Ld}function vi(t){Sr.call(this,t),this.textures={}}function gi(){I.call(this),this.type="InstancedBufferGeometry",this.instanceCount=1/0}function yi(t,e,n,r){"number"==typeof n&&(r=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),_.call(this,t,e,n),this.meshPerAttribute=r||1}function xi(t){Sr.call(this,t)}function _i(t){"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),Sr.call(this,t),this.options={premultiplyAlpha:"none"}}function bi(){this.type="ShapePath",this.color=new Zl,this.subPaths=[],this.currentPath=null}function wi(t,e,n){for(var r=Array.from?Array.from(t):String(t).split(""),i=e/n.resolution,a=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*i,o=[],s=0,c=0,l=0;l<r.length;l++){var u=r[l];if("\n"===u)s=0,c-=a;else{var h=Mi(u,i,s,c,n);s+=h.offsetX,o.push(h.path)}}return o}function Mi(t,e,n,r,i){var a=i.glyphs[t]||i.glyphs["?"];if(!a)return void console.error('THREE.Font: character "'+t+'" does not exists in font family '+i.familyName+".");var o,s,c,l,u,h,d,p,f=new bi;if(a.o)for(var m=a._cachedOutline||(a._cachedOutline=a.o.split(" ")),v=0,g=m.length;v<g;){var y=m[v++];switch(y){case"m":o=m[v++]*e+n,s=m[v++]*e+r,f.moveTo(o,s);break;case"l":o=m[v++]*e+n,s=m[v++]*e+r,f.lineTo(o,s);break;case"q":c=m[v++]*e+n,l=m[v++]*e+r,u=m[v++]*e+n,h=m[v++]*e+r,f.quadraticCurveTo(u,h,c,l);break;case"b":c=m[v++]*e+n,l=m[v++]*e+r,u=m[v++]*e+n,h=m[v++]*e+r,d=m[v++]*e+n,p=m[v++]*e+r,f.bezierCurveTo(u,h,d,p,c,l)}}return{offsetX:a.ha*e,path:f}}function Si(t){Sr.call(this,t)}function Ti(t){Sr.call(this,t)}function Ei(t,e,n){mi.call(this,void 0,n);var r=(new Zl).set(t),i=(new Zl).set(e),a=new Ic(r.r,r.g,r.b),o=new Ic(i.r,i.g,i.b),s=Math.sqrt(Math.PI),c=s*Math.sqrt(.75);this.sh.coefficients[0].copy(a).add(o).multiplyScalar(s),this.sh.coefficients[1].copy(a).sub(o).multiplyScalar(c)}function Ai(t,e){mi.call(this,void 0,e);var n=(new Zl).set(t);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}function Li(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new U,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new U,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}function Ri(){return("undefined"==typeof performance?Date:performance).now()}function Ci(t,e,n){this.binding=t,this.valueSize=n;var r,i,a;switch(e){case"quaternion":r=this._slerp,i=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":r=this._select,i=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:r=this._lerp,i=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=i,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}function Pi(t,e,n){var r=n||Oi.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,r)}function Oi(t,e,n){this.path=e,this.parsedPath=n||Oi.parseTrackName(e),this.node=Oi.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function Ii(){this.uuid=Sc.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var t={};this._indicesByUUID=t;for(var e=0,n=arguments.length;e!==n;++e)t[arguments[e].uuid]=e;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var r=this;this.stats={objects:{get total(){return r._objects.length},get inUse(){return this.total-r.nCachedObjects_}},get bindingsPerObject(){return r._bindings.length}}}function Di(t){this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function Ni(t,e,n){Ye.call(this,t,e),this.meshPerAttribute=n||1}function Bi(t,e,n,r,i){this.buffer=t,this.type=e,this.itemSize=n,this.elementSize=r,this.count=i,this.version=0}function zi(t,e,n,r){this.ray=new al(t,e),this.near=n||0,this.far=r||1/0,this.camera=null,this.layers=new gl,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function Fi(t,e){return t.distance-e.distance}function Hi(t,e,n,r){if(t.layers.test(e.layers)&&t.raycast(e,n),!0===r)for(var i=t.children,a=0,o=i.length;a<o;a++)Hi(i[a],e,n,!0)}function Gi(t){f.call(this),this.material=t,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}function Ui(t){var e=[];t&&t.isBone&&e.push(t);for(var n=0;n<t.children.length;n++)e.push.apply(e,Ui(t.children[n]));return e}function ki(t,e,n,r,i,a,o){zp.set(i,a,o).unproject(r);var s=e[t];if(void 0!==s)for(var c=n.getAttribute("position"),l=0,u=s.length;l<u;l++)c.setXYZ(s[l],zp.x,zp.y,zp.z)}function Vi(t){var e=Math.max(t.r,t.g,t.b),n=Math.min(Math.max(Math.ceil(Math.log2(e)),-128),127);return t.multiplyScalar(Math.pow(2,-n)),(n+128)/255}function Wi(t){return void 0!==t&&t.type===ko&&(t.encoding===rc||t.encoding===ic||t.encoding===ac)}function ji(t){var e=new Cc(3*Kp,3*Kp,t);return e.texture.mapping=Po,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function qi(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function Xi(t){return new $n({name:"SphericalGaussianBlur",defines:{n:t},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:new Float32Array(t)},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:new Ic(0,1,0)},inputEncoding:{value:nf[rc]},outputEncoding:{value:nf[rc]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",
  131. fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t",blending:Ua,depthTest:!1,depthWrite:!1})}function Yi(){return new $n({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:new Tc(1,1)},inputEncoding:{value:nf[rc]},outputEncoding:{value:nf[rc]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform vec2 texelSize;\n\n\t\t\t\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t",blending:Ua,depthTest:!1,depthWrite:!1})}function Zi(){return new $n({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:nf[rc]},outputEncoding:{value:nf[rc]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\t\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t",blending:Ua,depthTest:!1,depthWrite:!1})}function Ji(t,e,n,r,i,a,o){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new Jl(t,e,n,i,a,o)}function Qi(t){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),t}function Ki(t){return void 0===t&&(t=[]),console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),t.isMultiMaterial=!0,t.materials=t,t.clone=function(){return t.slice()},t}function $i(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new un(t,e)}function ta(t){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new Qe(t)}function ea(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new un(t,e)}function na(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new ln(t)}function ra(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new ln(t)}function ia(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new ln(t)}function aa(t,e,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new Ic(t,e,n)}function oa(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new _(t,e).setUsage(yc)}function sa(t,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new b(t,e)}function ca(t,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new w(t,e)}function la(t,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new M(t,e)}function ua(t,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new S(t,e)}function ha(t,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new T(t,e)}function da(t,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new E(t,e)}function pa(t,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new A(t,e)}function fa(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new R(t,e)}function ma(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new C(t,e)}function va(t){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Br.call(this,t),this.type="catmullrom",this.closed=!0}function ga(t){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Br.call(this,t),this.type="catmullrom"}function ya(t){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),Br.call(this,t),this.type="catmullrom"}function xa(t){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new qp(t)}function _a(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new Up(t,e)}function ba(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new sn(new td(t.geometry),new an({color:void 0!==e?e:16777215}))}function wa(t,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new sn(new vd(t.geometry),new an({color:void 0!==e?e:16777215}))}function Ma(t){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new Tr(t)}function Sa(t){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new Cr(t)}function Ta(t,e,n){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new Pu(t,n)}function Ea(){console.error("THREE.CanvasRenderer has been removed")}function Aa(){console.error("THREE.JSONLoader has been removed.")}function La(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:t>0?1:+t}),"name"in Function.prototype==!1&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(t){if(void 0===t||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n<arguments.length;n++){var r=arguments[n];if(void 0!==r&&null!==r)for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e});var Ra=function(t){function e(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}function n(t,e,n,r){var a=e&&e.prototype instanceof i?e:i,o=Object.create(a.prototype),s=new p(r||[]);return o._invoke=l(t,n,s),o}function r(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}function i(){}function a(){}function o(){}function s(t){["next","throw","return"].forEach(function(n){e(t,n,function(t){return this._invoke(n,t)})})}function c(t,e){function n(i,a,o,s){var c=r(t[i],t,a);if("throw"!==c.type){var l=c.arg,u=l.value;return u&&"object"==typeof u&&y.call(u,"__await")?e.resolve(u.__await).then(function(t){n("next",t,o,s)},function(t){n("throw",t,o,s)}):e.resolve(u).then(function(t){l.value=t,o(l)},function(t){return n("throw",t,o,s)})}s(c.arg)}function i(t,r){function i(){return new e(function(e,i){n(t,r,e,i)})}return a=a?a.then(i,i):i()}var a;this._invoke=i}function l(t,e,n){var i=M;return function(a,o){if(i===T)throw new Error("Generator is already running");if(i===E){if("throw"===a)throw o;return m()}for(n.method=a,n.arg=o;;){var s=n.delegate;if(s){var c=u(s,n);if(c){if(c===A)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===M)throw i=E,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=T;var l=r(t,e,n);if("normal"===l.type){if(i=n.done?E:S,l.arg===A)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i=E,n.method="throw",n.arg=l.arg)}}}function u(t,e){var n=t.iterator[e.method];if(n===v){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=v,u(t,e),"throw"===e.method))return A;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return A}var i=r(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,A;var a=i.arg;return a?a.done?(e[t.resultName]=a.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=v),e.delegate=null,A):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,A)}function h(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function d(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function p(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(h,this),this.reset(!0)}function f(t){if(t){var e=t[_];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,r=function e(){for(;++n<t.length;)if(y.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=v,e.done=!0,e};return r.next=r}}return{next:m}}function m(){return{value:v,done:!0}}var v,g=Object.prototype,y=g.hasOwnProperty,x="function"==typeof Symbol?Symbol:{},_=x.iterator||"@@iterator",b=x.asyncIterator||"@@asyncIterator",w=x.toStringTag||"@@toStringTag";try{e({},"")}catch(t){e=function(t,e,n){return t[e]=n}}t.wrap=n;var M="suspendedStart",S="suspendedYield",T="executing",E="completed",A={},L={};L[_]=function(){return this};var R=Object.getPrototypeOf,C=R&&R(R(f([])));C&&C!==g&&y.call(C,_)&&(L=C);var P=o.prototype=i.prototype=Object.create(L);return a.prototype=P.constructor=o,o.constructor=a,a.displayName=e(o,w,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===a||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,o):(t.__proto__=o,e(t,w,"GeneratorFunction")),t.prototype=Object.create(P),t},t.awrap=function(t){return{__await:t}},s(c.prototype),c.prototype[b]=function(){return this},t.AsyncIterator=c,t.async=function(e,r,i,a,o){void 0===o&&(o=Promise);var s=new c(n(e,r,i,a),o);return t.isGeneratorFunction(r)?s:s.next().then(function(t){return t.done?t.value:s.next()})},s(P),e(P,w,"Generator"),P[_]=function(){return this},P.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=f,p.prototype={constructor:p,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=v,this.done=!1,this.delegate=null,this.method="next",this.arg=v,this.tryEntries.forEach(d),!t)for(var e in this)"t"===e.charAt(0)&&y.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=v)},stop:function(){this.done=!0;var t=this.tryEntries[0],e=t.completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){function e(e,r){return a.type="throw",a.arg=t,n.next=e,r&&(n.method="next",n.arg=v),!!r}if(this.done)throw t;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],a=i.completion;if("root"===i.tryLoc)return e("end");if(i.tryLoc<=this.prev){var o=y.call(i,"catchLoc"),s=y.call(i,"finallyLoc");if(o&&s){if(this.prev<i.catchLoc)return e(i.catchLoc,!0);if(this.prev<i.finallyLoc)return e(i.finallyLoc)}else if(o){if(this.prev<i.catchLoc)return e(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return e(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&y.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,A):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),A},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),d(n),A}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;d(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:f(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=v),A}},t}("object"==typeof module?module.exports:{});try{regeneratorRuntime=Ra}catch(t){Function("r","regeneratorRuntime = r")(Ra)}var Ca={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Pa={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Oa=0,Ia=1,Da=2,Na=1,Ba=2,za=3,Fa=0,Ha=1,Ga=2,Ua=0,ka=1,Va=2,Wa=3,ja=4,qa=5,Xa=100,Ya=101,Za=102,Ja=103,Qa=104,Ka=200,$a=201,to=202,eo=203,no=204,ro=205,io=206,ao=207,oo=208,so=209,co=210,lo=0,uo=1,ho=2,po=3,fo=4,mo=5,vo=6,go=7,yo=0,xo=1,_o=2,bo=0,wo=1,Mo=2,So=3,To=4,Eo=5,Ao=301,Lo=302,Ro=303,Co=304,Po=306,Oo=307,Io=1e3,Do=1001,No=1002,Bo=1003,zo=1004,Fo=1005,Ho=1006,Go=1007,Uo=1008,ko=1009,Vo=1010,Wo=1011,jo=1012,qo=1013,Xo=1014,Yo=1015,Zo=1016,Jo=1017,Qo=1018,Ko=1019,$o=1020,ts=1021,es=1022,ns=1023,rs=1024,is=1025,as=ns,os=1026,ss=1027,cs=1028,ls=1029,us=1030,hs=1031,ds=1032,ps=1033,fs=33776,ms=33777,vs=33778,gs=33779,ys=35840,xs=35841,_s=35842,bs=35843,ws=36196,Ms=37492,Ss=37496,Ts=37808,Es=37809,As=37810,Ls=37811,Rs=37812,Cs=37813,Ps=37814,Os=37815,Is=37816,Ds=37817,Ns=37818,Bs=37819,zs=37820,Fs=37821,Hs=36492,Gs=37840,Us=37841,ks=37842,Vs=37843,Ws=37844,js=37845,qs=37846,Xs=37847,Ys=37848,Zs=37849,Js=37850,Qs=37851,Ks=37852,$s=37853,tc=2201,ec=2400,nc=2500,rc=3e3,ic=3001,ac=3007,oc=3002,sc=3003,cc=3004,lc=3005,uc=3006,hc=3200,dc=3201,pc=0,fc=1,mc=7680,vc=519,gc=35044,yc=35048,xc="300 es";Object.assign(u.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)},removeEventListener:function(t,e){if(void 0!==this._listeners){var n=this._listeners,r=n[t];if(void 0!==r){var i=r.indexOf(e);-1!==i&&r.splice(i,1)}}},dispatchEvent:function(t){if(void 0!==this._listeners){var e=this._listeners,n=e[t.type];if(void 0!==n){t.target=this;for(var r=n.slice(0),i=0,a=r.length;i<a;i++)r[i].call(this,t)}}}});for(var _c=[],bc=0;bc<256;bc++)_c[bc]=(bc<16?"0":"")+bc.toString(16);var wc,Mc=1234567,Sc={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(_c[255&t]+_c[t>>8&255]+_c[t>>16&255]+_c[t>>24&255]+"-"+_c[255&e]+_c[e>>8&255]+"-"+_c[e>>16&15|64]+_c[e>>24&255]+"-"+_c[63&n|128]+_c[n>>8&255]+"-"+_c[n>>16&255]+_c[n>>24&255]+_c[255&r]+_c[r>>8&255]+_c[r>>16&255]+_c[r>>24&255]).toUpperCase()},clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)},lerp:function(t,e,n){return(1-n)*t+n*e},damp:function(t,e,n,r){return Sc.lerp(t,e,1-Math.exp(-n*r))},pingpong:function(t,e){return void 0===e&&(e=1),e-Math.abs(Sc.euclideanModulo(t,2*e)-e)},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){return void 0!==t&&(Mc=t%2147483647),((Mc=16807*Mc%2147483647)-1)/2147483646},degToRad:function(t){return t*Sc.DEG2RAD},radToDeg:function(t){return t*Sc.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},setQuaternionFromProperEuler:function(t,e,n,r,i){var a=Math.cos,o=Math.sin,s=a(n/2),c=o(n/2),l=a((e+r)/2),u=o((e+r)/2),h=a((e-r)/2),d=o((e-r)/2),p=a((r-e)/2),f=o((r-e)/2);switch(i){case"XYX":t.set(s*u,c*h,c*d,s*l);break;case"YZY":t.set(c*d,s*u,c*h,s*l);break;case"ZXZ":t.set(c*h,c*d,s*u,s*l);break;case"XZX":t.set(s*u,c*f,c*p,s*l);break;case"YXY":t.set(c*p,s*u,c*f,s*l);break;case"ZYZ":t.set(c*f,c*p,s*u,s*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}},Tc=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),Object.defineProperty(this,"isVector2",{value:!0}),this.x=t,this.y=e}var e=t.prototype;return e.set=function(t,e){return this.x=t,this.y=e,this},e.setScalar=function(t){return this.x=t,this.y=t,this},e.setX=function(t){return this.x=t,this},e.setY=function(t){return this.y=t,this},e.setComponent=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this},e.getComponent=function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},e.clone=function(){return new this.constructor(this.x,this.y)},e.copy=function(t){return this.x=t.x,this.y=t.y,this},e.add=function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},e.addScalar=function(t){return this.x+=t,this.y+=t,this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},e.sub=function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},e.subScalar=function(t){return this.x-=t,this.y-=t,this},e.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},e.multiply=function(t){return this.x*=t.x,this.y*=t.y,this},e.multiplyScalar=function(t){return this.x*=t,this.y*=t,this},e.divide=function(t){return this.x/=t.x,this.y/=t.y,this},e.divideScalar=function(t){return this.multiplyScalar(1/t)},e.applyMatrix3=function(t){var e=this.x,n=this.y,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6],this.y=r[1]*e+r[4]*n+r[7],this},e.min=function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},e.max=function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},e.clamp=function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},e.clampScalar=function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this},e.clampLength=function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},e.roundToZero=function(){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},e.negate=function(){return this.x=-this.x,this.y=-this.y,this},e.dot=function(t){return this.x*t.x+this.y*t.y},e.cross=function(t){return this.x*t.y-this.y*t.x},e.lengthSq=function(){return this.x*this.x+this.y*this.y},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)},e.normalize=function(){return this.divideScalar(this.length()||1)},e.angle=function(){return Math.atan2(-this.y,-this.x)+Math.PI},e.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},e.distanceToSquared=function(t){var e=this.x-t.x,n=this.y-t.y;return e*e+n*n},e.manhattanDistanceTo=function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},e.setLength=function(t){return this.normalize().multiplyScalar(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},e.lerpVectors=function(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this},e.equals=function(t){return t.x===this.x&&t.y===this.y},e.fromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},e.toArray=function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},e.fromBufferAttribute=function(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this},e.rotateAround=function(t,e){var n=Math.cos(e),r=Math.sin(e),i=this.x-t.x,a=this.y-t.y;return this.x=i*n-a*r+t.x,this.y=i*r+a*n+t.y,this},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this},i(t,[{key:"width",get:function(){return this.x},set:function(t){this.x=t}},{key:"height",get:function(){return this.y},set:function(t){this.y=t}}]),t}(),Ec=function(){function t(){Object.defineProperty(this,"isMatrix3",{value:!0}),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.")}var e=t.prototype;return e.set=function(t,e,n,r,i,a,o,s,c){var l=this.elements;return l[0]=t,l[1]=r,l[2]=o,l[3]=e,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this},e.identity=function(){return this.set(1,0,0,0,1,0,0,0,1),this},e.clone=function(){return(new this.constructor).fromArray(this.elements)},e.copy=function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this},e.extractBasis=function(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this},e.setFromMatrix4=function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},e.multiply=function(t){return this.multiplyMatrices(this,t)},e.premultiply=function(t){return this.multiplyMatrices(t,this)},e.multiplyMatrices=function(t,e){var n=t.elements,r=e.elements,i=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],h=n[2],d=n[5],p=n[8],f=r[0],m=r[3],v=r[6],g=r[1],y=r[4],x=r[7],_=r[2],b=r[5],w=r[8];return i[0]=a*f+o*g+s*_,i[3]=a*m+o*y+s*b,i[6]=a*v+o*x+s*w,i[1]=c*f+l*g+u*_,i[4]=c*m+l*y+u*b,i[7]=c*v+l*x+u*w,i[2]=h*f+d*g+p*_,i[5]=h*m+d*y+p*b,i[8]=h*v+d*x+p*w,this},e.multiplyScalar=function(t){var e=this.elements;return e[0]*=t,e[3]*=t,
  132. e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this},e.determinant=function(){var t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8];return e*a*l-e*o*c-n*i*l+n*o*s+r*i*c-r*a*s},e.invert=function(){var t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=l*a-o*c,h=o*s-l*i,d=c*i-a*s,p=e*u+n*h+r*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);var f=1/p;return t[0]=u*f,t[1]=(r*c-l*n)*f,t[2]=(o*n-r*a)*f,t[3]=h*f,t[4]=(l*e-r*s)*f,t[5]=(r*i-o*e)*f,t[6]=d*f,t[7]=(n*s-c*e)*f,t[8]=(a*e-n*i)*f,this},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},e.getNormalMatrix=function(t){return this.setFromMatrix4(t).copy(this).invert().transpose()},e.transposeIntoArray=function(t){var e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this},e.setUvTransform=function(t,e,n,r,i,a,o){var s=Math.cos(i),c=Math.sin(i);return this.set(n*s,n*c,-n*(s*a+c*o)+a+t,-r*c,r*s,-r*(-c*a+s*o)+o+e,0,0,1),this},e.scale=function(t,e){var n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=e,n[4]*=e,n[7]*=e,this},e.rotate=function(t){var e=Math.cos(t),n=Math.sin(t),r=this.elements,i=r[0],a=r[3],o=r[6],s=r[1],c=r[4],l=r[7];return r[0]=e*i+n*s,r[3]=e*a+n*c,r[6]=e*o+n*l,r[1]=-n*i+e*s,r[4]=-n*a+e*c,r[7]=-n*o+e*l,this},e.translate=function(t,e){var n=this.elements;return n[0]+=t*n[2],n[3]+=t*n[5],n[6]+=t*n[8],n[1]+=e*n[2],n[4]+=e*n[5],n[7]+=e*n[8],this},e.equals=function(t){for(var e=this.elements,n=t.elements,r=0;r<9;r++)if(e[r]!==n[r])return!1;return!0},e.fromArray=function(t,e){void 0===e&&(e=0);for(var n=0;n<9;n++)this.elements[n]=t[n+e];return this},e.toArray=function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t},t}(),Ac={getDataURL:function(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;var e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===wc&&(wc=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),wc.width=t.width,wc.height=t.height;var n=wc.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=wc}return e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}},Lc=0;h.DEFAULT_IMAGE=void 0,h.DEFAULT_MAPPING=300,h.prototype=Object.assign(Object.create(u.prototype),{constructor:h,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){var e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];var n={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(void 0!==this.image){var r=this.image;if(void 0===r.uuid&&(r.uuid=Sc.generateUUID()),!e&&void 0===t.images[r.uuid]){var i;if(Array.isArray(r)){i=[];for(var a=0,o=r.length;a<o;a++)r[a].isDataTexture?i.push(d(r[a].image)):i.push(d(r[a]))}else i=d(r);t.images[r.uuid]={uuid:r.uuid,url:i}}n.image=r.uuid}return e||(t.textures[this.uuid]=n),n},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case Io:t.x=t.x-Math.floor(t.x);break;case Do:t.x=t.x<0?0:1;break;case No:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case Io:t.y=t.y-Math.floor(t.y);break;case Do:t.y=t.y<0?0:1;break;case No:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}}),Object.defineProperty(h.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}});var Rc=function(){function t(t,e,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0),void 0===r&&(r=1),Object.defineProperty(this,"isVector4",{value:!0}),this.x=t,this.y=e,this.z=n,this.w=r}var e=t.prototype;return e.set=function(t,e,n,r){return this.x=t,this.y=e,this.z=n,this.w=r,this},e.setScalar=function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},e.setX=function(t){return this.x=t,this},e.setY=function(t){return this.y=t,this},e.setZ=function(t){return this.z=t,this},e.setW=function(t){return this.w=t,this},e.setComponent=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this},e.getComponent=function(t){switch(t){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: "+t)}},e.clone=function(){return new this.constructor(this.x,this.y,this.z,this.w)},e.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},e.add=function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},e.addScalar=function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},e.sub=function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},e.subScalar=function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},e.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},e.multiply=function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this},e.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},e.applyMatrix4=function(t){var e=this.x,n=this.y,r=this.z,i=this.w,a=t.elements;return this.x=a[0]*e+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*e+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*e+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*e+a[7]*n+a[11]*r+a[15]*i,this},e.divideScalar=function(t){return this.multiplyScalar(1/t)},e.setAxisAngleFromQuaternion=function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},e.setAxisAngleFromRotationMatrix=function(t){var e,n,r,i,a=t.elements,o=a[0],s=a[4],c=a[8],l=a[1],u=a[5],h=a[9],d=a[2],p=a[6],f=a[10];if(Math.abs(s-l)<.01&&Math.abs(c-d)<.01&&Math.abs(h-p)<.01){if(Math.abs(s+l)<.1&&Math.abs(c+d)<.1&&Math.abs(h+p)<.1&&Math.abs(o+u+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;var m=(o+1)/2,v=(u+1)/2,g=(f+1)/2,y=(s+l)/4,x=(c+d)/4,_=(h+p)/4;return m>v&&m>g?m<.01?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(m),r=y/n,i=x/n):v>g?v<.01?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(v),n=y/r,i=_/r):g<.01?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(g),n=x/i,r=_/i),this.set(n,r,i,e),this}var b=Math.sqrt((p-h)*(p-h)+(c-d)*(c-d)+(l-s)*(l-s));return Math.abs(b)<.001&&(b=1),this.x=(p-h)/b,this.y=(c-d)/b,this.z=(l-s)/b,this.w=Math.acos((o+u+f-1)/2),this},e.min=function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},e.max=function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},e.clamp=function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},e.clampScalar=function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this},e.clampLength=function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},e.floor=function(){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},e.ceil=function(){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},e.round=function(){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},e.roundToZero=function(){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},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},e.normalize=function(){return this.divideScalar(this.length()||1)},e.setLength=function(t){return this.normalize().multiplyScalar(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},e.lerpVectors=function(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},e.fromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},e.toArray=function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},e.fromBufferAttribute=function(t,e,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this},i(t,[{key:"width",get:function(){return this.z},set:function(t){this.z=t}},{key:"height",get:function(){return this.w},set:function(t){this.w=t}}]),t}(),Cc=function(t){function e(e,n,r){var i;return i=t.call(this)||this,Object.defineProperty(o(i),"isWebGLRenderTarget",{value:!0}),i.width=e,i.height=n,i.scissor=new Rc(0,0,e,n),i.scissorTest=!1,i.viewport=new Rc(0,0,e,n),r=r||{},i.texture=new h(void 0,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.encoding),i.texture.image={},i.texture.image.width=e,i.texture.image.height=n,i.texture.generateMipmaps=void 0!==r.generateMipmaps&&r.generateMipmaps,i.texture.minFilter=void 0!==r.minFilter?r.minFilter:Ho,i.depthBuffer=void 0===r.depthBuffer||r.depthBuffer,i.stencilBuffer=void 0!==r.stencilBuffer&&r.stencilBuffer,i.depthTexture=void 0!==r.depthTexture?r.depthTexture:null,i}a(e,t);var n=e.prototype;return n.setSize=function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.texture.image.width=t,this.texture.image.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},n.clone=function(){return(new this.constructor).copy(this)},n.copy=function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},n.dispose=function(){this.dispatchEvent({type:"dispose"})},e}(u),Pc=function(t){function e(e,n,r){var i;return i=t.call(this,e,n,r)||this,Object.defineProperty(o(i),"isWebGLMultisampleRenderTarget",{value:!0}),i.samples=4,i}return a(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.samples=e.samples,this},e}(Cc),Oc=function(){function t(t,e,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0),void 0===r&&(r=1),Object.defineProperty(this,"isQuaternion",{value:!0}),this._x=t,this._y=e,this._z=n,this._w=r}t.slerp=function(t,e,n,r){return n.copy(t).slerp(e,r)},t.slerpFlat=function(t,e,n,r,i,a,o){var s=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3],h=i[a+0],d=i[a+1],p=i[a+2],f=i[a+3];if(u!==f||s!==h||c!==d||l!==p){var m=1-o,v=s*h+c*d+l*p+u*f,g=v>=0?1:-1,y=1-v*v;if(y>Number.EPSILON){var x=Math.sqrt(y),_=Math.atan2(x,v*g);m=Math.sin(m*_)/x,o=Math.sin(o*_)/x}var b=o*g;if(s=s*m+h*b,c=c*m+d*b,l=l*m+p*b,u=u*m+f*b,m===1-o){var w=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=w,c*=w,l*=w,u*=w}}t[e]=s,t[e+1]=c,t[e+2]=l,t[e+3]=u},t.multiplyQuaternionsFlat=function(t,e,n,r,i,a){var o=n[r],s=n[r+1],c=n[r+2],l=n[r+3],u=i[a],h=i[a+1],d=i[a+2],p=i[a+3];return t[e]=o*p+l*u+s*d-c*h,t[e+1]=s*p+l*h+c*u-o*d,t[e+2]=c*p+l*d+o*h-s*u,t[e+3]=l*p-o*u-s*h-c*d,t};var e=t.prototype;return e.set=function(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._w=r,this._onChangeCallback(),this},e.clone=function(){return new this.constructor(this._x,this._y,this._z,this._w)},e.copy=function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this},e.setFromEuler=function(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=t._x,r=t._y,i=t._z,a=t._order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),h=s(n/2),d=s(r/2),p=s(i/2);switch(a){case"XYZ":this._x=h*l*u+c*d*p,this._y=c*d*u-h*l*p,this._z=c*l*p+h*d*u,this._w=c*l*u-h*d*p;break;case"YXZ":this._x=h*l*u+c*d*p,this._y=c*d*u-h*l*p,this._z=c*l*p-h*d*u,this._w=c*l*u+h*d*p;break;case"ZXY":this._x=h*l*u-c*d*p,this._y=c*d*u+h*l*p,this._z=c*l*p+h*d*u,this._w=c*l*u-h*d*p;break;case"ZYX":this._x=h*l*u-c*d*p,this._y=c*d*u+h*l*p,this._z=c*l*p-h*d*u,this._w=c*l*u+h*d*p;break;case"YZX":this._x=h*l*u+c*d*p,this._y=c*d*u+h*l*p,this._z=c*l*p-h*d*u,this._w=c*l*u-h*d*p;break;case"XZY":this._x=h*l*u-c*d*p,this._y=c*d*u-h*l*p,this._z=c*l*p+h*d*u,this._w=c*l*u+h*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==e&&this._onChangeCallback(),this},e.setFromAxisAngle=function(t,e){var n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this._onChangeCallback(),this},e.setFromRotationMatrix=function(t){var e=t.elements,n=e[0],r=e[4],i=e[8],a=e[1],o=e[5],s=e[9],c=e[2],l=e[6],u=e[10],h=n+o+u;if(h>0){var d=.5/Math.sqrt(h+1);this._w=.25/d,this._x=(l-s)*d,this._y=(i-c)*d,this._z=(a-r)*d}else if(n>o&&n>u){var p=2*Math.sqrt(1+n-o-u);this._w=(l-s)/p,this._x=.25*p,this._y=(r+a)/p,this._z=(i+c)/p}else if(o>u){var f=2*Math.sqrt(1+o-n-u);this._w=(i-c)/f,this._x=(r+a)/f,this._y=.25*f,this._z=(s+l)/f}else{var m=2*Math.sqrt(1+u-n-o);this._w=(a-r)/m,this._x=(i+c)/m,this._y=(s+l)/m,this._z=.25*m}return this._onChangeCallback(),this},e.setFromUnitVectors=function(t,e){var n=t.dot(e)+1;return n<1e-6?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()},e.angleTo=function(t){return 2*Math.acos(Math.abs(Sc.clamp(this.dot(t),-1,1)))},e.rotateTowards=function(t,e){var n=this.angleTo(t);if(0===n)return this;var r=Math.min(1,e/n);return this.slerp(t,r),this},e.identity=function(){return this.set(0,0,0,1)},e.invert=function(){return this.conjugate()},e.conjugate=function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},e.dot=function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},e.lengthSq=function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},e.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},e.normalize=function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this},e.multiply=function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},e.premultiply=function(t){return this.multiplyQuaternions(t,this)},e.multiplyQuaternions=function(t,e){var n=t._x,r=t._y,i=t._z,a=t._w,o=e._x,s=e._y,c=e._z,l=e._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this._onChangeCallback(),this},e.slerp=function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var n=this._x,r=this._y,i=this._z,a=this._w,o=a*t._w+n*t._x+r*t._y+i*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;var s=1-o*o;if(s<=Number.EPSILON){var c=1-e;return this._w=c*a+e*this._w,this._x=c*n+e*this._x,this._y=c*r+e*this._y,this._z=c*i+e*this._z,this.normalize(),this._onChangeCallback(),this}var l=Math.sqrt(s),u=Math.atan2(l,o),h=Math.sin((1-e)*u)/l,d=Math.sin(e*u)/l;return this._w=a*h+this._w*d,this._x=n*h+this._x*d,this._y=r*h+this._y*d,this._z=i*h+this._z*d,this._onChangeCallback(),this},e.equals=function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},e.fromArray=function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this},e.toArray=function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},e.fromBufferAttribute=function(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this},e._onChange=function(t){return this._onChangeCallback=t,this},e._onChangeCallback=function(){},i(t,[{key:"x",get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},{key:"w",get:function(){return this._w},set:function(t){this._w=t,this._onChangeCallback()}}]),t}(),Ic=function(){function t(t,e,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0),Object.defineProperty(this,"isVector3",{value:!0}),this.x=t,this.y=e,this.z=n}var e=t.prototype;return e.set=function(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this},e.setScalar=function(t){return this.x=t,this.y=t,this.z=t,this},e.setX=function(t){return this.x=t,this},e.setY=function(t){return this.y=t,this},e.setZ=function(t){return this.z=t,this},e.setComponent=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this},e.getComponent=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},e.clone=function(){return new this.constructor(this.x,this.y,this.z)},e.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},e.add=function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},e.addScalar=function(t){return this.x+=t,this.y+=t,this.z+=t,this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},e.sub=function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},e.subScalar=function(t){return this.x-=t,this.y-=t,this.z-=t,this},e.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},e.multiply=function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},e.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},e.applyEuler=function(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Nc.setFromEuler(t))},e.applyAxisAngle=function(t,e){return this.applyQuaternion(Nc.setFromAxisAngle(t,e))},e.applyMatrix3=function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6]*r,this.y=i[1]*e+i[4]*n+i[7]*r,this.z=i[2]*e+i[5]*n+i[8]*r,this},e.applyNormalMatrix=function(t){return this.applyMatrix3(t).normalize()},e.applyMatrix4=function(t){var e=this.x,n=this.y,r=this.z,i=t.elements,a=1/(i[3]*e+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*e+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*e+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*e+i[6]*n+i[10]*r+i[14])*a,this},e.applyQuaternion=function(t){var e=this.x,n=this.y,r=this.z,i=t.x,a=t.y,o=t.z,s=t.w,c=s*e+a*r-o*n,l=s*n+o*e-i*r,u=s*r+i*n-a*e,h=-i*e-a*n-o*r;return this.x=c*s+h*-i+l*-o-u*-a,this.y=l*s+h*-a+u*-i-c*-o,this.z=u*s+h*-o+c*-a-l*-i,this},e.project=function(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)},e.unproject=function(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)},e.transformDirection=function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[4]*n+i[8]*r,this.y=i[1]*e+i[5]*n+i[9]*r,this.z=i[2]*e+i[6]*n+i[10]*r,this.normalize()},e.divide=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},e.divideScalar=function(t){return this.multiplyScalar(1/t)},e.min=function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},e.max=function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},e.clamp=function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},e.clampScalar=function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this},e.clampLength=function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},e.roundToZero=function(){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},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},e.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},e.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},e.normalize=function(){return this.divideScalar(this.length()||1)},e.setLength=function(t){return this.normalize().multiplyScalar(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},e.lerpVectors=function(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this},e.cross=function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)},e.crossVectors=function(t,e){var n=t.x,r=t.y,i=t.z,a=e.x,o=e.y,s=e.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this},e.projectOnVector=function(t){var e=t.lengthSq();if(0===e)return this.set(0,0,0);var n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)},e.projectOnPlane=function(t){return Dc.copy(this).projectOnVector(t),this.sub(Dc)},e.reflect=function(t){return this.sub(Dc.copy(t).multiplyScalar(2*this.dot(t)))},e.angleTo=function(t){var e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;var n=this.dot(t)/e;return Math.acos(Sc.clamp(n,-1,1))},e.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},e.distanceToSquared=function(t){var e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return e*e+n*n+r*r},e.manhattanDistanceTo=function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},e.setFromSpherical=function(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)},e.setFromSphericalCoords=function(t,e,n){var r=Math.sin(e)*t;return this.x=r*Math.sin(n),this.y=Math.cos(e)*t,this.z=r*Math.cos(n),this},e.setFromCylindrical=function(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)},e.setFromCylindricalCoords=function(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this},e.setFromMatrixPosition=function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},e.setFromMatrixScale=function(t){var e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=r,this},e.setFromMatrixColumn=function(t,e){return this.fromArray(t.elements,4*e)},e.setFromMatrix3Column=function(t,e){return this.fromArray(t.elements,3*e)},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},e.fromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},e.toArray=function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},e.fromBufferAttribute=function(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},t}(),Dc=new Ic,Nc=new Oc,Bc=function(){function t(t,e){Object.defineProperty(this,"isBox3",{value:!0}),this.min=void 0!==t?t:new Ic(1/0,1/0,1/0),this.max=void 0!==e?e:new Ic(-1/0,-1/0,-1/0)}var e=t.prototype;return e.set=function(t,e){return this.min.copy(t),this.max.copy(e),this},e.setFromArray=function(t){for(var e=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,c=t.length;s<c;s+=3){var l=t[s],u=t[s+1],h=t[s+2];l<e&&(e=l),u<n&&(n=u),h<r&&(r=h),l>i&&(i=l),u>a&&(a=u),h>o&&(o=h)}return this.min.set(e,n,r),this.max.set(i,a,o),this},e.setFromBufferAttribute=function(t){for(var e=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,c=t.count;s<c;s++){var l=t.getX(s),u=t.getY(s),h=t.getZ(s);l<e&&(e=l),u<n&&(n=u),h<r&&(r=h),l>i&&(i=l),u>a&&(a=u),h>o&&(o=h)}return this.min.set(e,n,r),this.max.set(i,a,o),this},e.setFromPoints=function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this},e.setFromCenterAndSize=function(t,e){var n=Fc.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this},e.setFromObject=function(t){return this.makeEmpty(),this.expandByObject(t)},e.clone=function(){return(new this.constructor).copy(this)},e.copy=function(t){return this.min.copy(t.min),this.max.copy(t.max),this},e.makeEmpty=function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},e.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},e.getCenter=function(t){return void 0===t&&(console.warn("THREE.Box3: .getCenter() target is now required"),t=new Ic),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},e.getSize=function(t){return void 0===t&&(console.warn("THREE.Box3: .getSize() target is now required"),t=new Ic),this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)},e.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},e.expandByVector=function(t){return this.min.sub(t),this.max.add(t),this},e.expandByScalar=function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},e.expandByObject=function(t){t.updateWorldMatrix(!1,!1);var e=t.geometry;void 0!==e&&(null===e.boundingBox&&e.computeBoundingBox(),Hc.copy(e.boundingBox),Hc.applyMatrix4(t.matrixWorld),this.union(Hc));for(var n=t.children,r=0,i=n.length;r<i;r++)this.expandByObject(n[r]);return this},e.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},e.containsBox=function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},e.getParameter=function(t,e){return void 0===e&&(console.warn("THREE.Box3: .getParameter() target is now required"),e=new Ic),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},e.intersectsBox=function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},e.intersectsSphere=function(t){return this.clampPoint(t.center,Fc),Fc.distanceToSquared(t.center)<=t.radius*t.radius},e.intersectsPlane=function(t){var e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant},e.intersectsTriangle=function(t){if(this.isEmpty())return!1;this.getCenter(qc),Xc.subVectors(this.max,qc),Gc.subVectors(t.a,qc),Uc.subVectors(t.b,qc),kc.subVectors(t.c,qc),Vc.subVectors(Uc,Gc),Wc.subVectors(kc,Uc),jc.subVectors(Gc,kc);var e=[0,-Vc.z,Vc.y,0,-Wc.z,Wc.y,0,-jc.z,jc.y,Vc.z,0,-Vc.x,Wc.z,0,-Wc.x,jc.z,0,-jc.x,-Vc.y,Vc.x,0,-Wc.y,Wc.x,0,-jc.y,jc.x,0];return!!p(e,Gc,Uc,kc,Xc)&&(e=[1,0,0,0,1,0,0,0,1],!!p(e,Gc,Uc,kc,Xc)&&(Yc.crossVectors(Vc,Wc),e=[Yc.x,Yc.y,Yc.z],p(e,Gc,Uc,kc,Xc)))},e.clampPoint=function(t,e){return void 0===e&&(console.warn("THREE.Box3: .clampPoint() target is now required"),e=new Ic),e.copy(t).clamp(this.min,this.max)},e.distanceToPoint=function(t){return Fc.copy(t).clamp(this.min,this.max).sub(t).length()},e.getBoundingSphere=function(t){return void 0===t&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(t.center),t.radius=.5*this.getSize(Fc).length(),t},
  133. e.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},e.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.applyMatrix4=function(t){return this.isEmpty()?this:(zc[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),zc[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),zc[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),zc[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),zc[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),zc[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),zc[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),zc[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(zc),this)},e.translate=function(t){return this.min.add(t),this.max.add(t),this},e.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},t}(),zc=[new Ic,new Ic,new Ic,new Ic,new Ic,new Ic,new Ic,new Ic],Fc=new Ic,Hc=new Bc,Gc=new Ic,Uc=new Ic,kc=new Ic,Vc=new Ic,Wc=new Ic,jc=new Ic,qc=new Ic,Xc=new Ic,Yc=new Ic,Zc=new Ic,Jc=new Bc,Qc=function(){function t(t,e){this.center=void 0!==t?t:new Ic,this.radius=void 0!==e?e:-1}var e=t.prototype;return e.set=function(t,e){return this.center.copy(t),this.radius=e,this},e.setFromPoints=function(t,e){var n=this.center;void 0!==e?n.copy(e):Jc.setFromPoints(t).getCenter(n);for(var r=0,i=0,a=t.length;i<a;i++)r=Math.max(r,n.distanceToSquared(t[i]));return this.radius=Math.sqrt(r),this},e.clone=function(){return(new this.constructor).copy(this)},e.copy=function(t){return this.center.copy(t.center),this.radius=t.radius,this},e.isEmpty=function(){return this.radius<0},e.makeEmpty=function(){return this.center.set(0,0,0),this.radius=-1,this},e.containsPoint=function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius},e.distanceToPoint=function(t){return t.distanceTo(this.center)-this.radius},e.intersectsSphere=function(t){var e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e},e.intersectsBox=function(t){return t.intersectsSphere(this)},e.intersectsPlane=function(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius},e.clampPoint=function(t,e){var n=this.center.distanceToSquared(t);return void 0===e&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),e=new Ic),e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e},e.getBoundingBox=function(t){return void 0===t&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),t=new Bc),this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)},e.applyMatrix4=function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},e.translate=function(t){return this.center.add(t),this},e.equals=function(t){return t.center.equals(this.center)&&t.radius===this.radius},t}(),Kc=new Ic,$c=new Ic,tl=new Ic,el=new Ic,nl=new Ic,rl=new Ic,il=new Ic,al=function(){function t(t,e){this.origin=void 0!==t?t:new Ic,this.direction=void 0!==e?e:new Ic(0,0,-1)}var e=t.prototype;return e.set=function(t,e){return this.origin.copy(t),this.direction.copy(e),this},e.clone=function(){return(new this.constructor).copy(this)},e.copy=function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},e.at=function(t,e){return void 0===e&&(console.warn("THREE.Ray: .at() target is now required"),e=new Ic),e.copy(this.direction).multiplyScalar(t).add(this.origin)},e.lookAt=function(t){return this.direction.copy(t).sub(this.origin).normalize(),this},e.recast=function(t){return this.origin.copy(this.at(t,Kc)),this},e.closestPointToPoint=function(t,e){void 0===e&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),e=new Ic),e.subVectors(t,this.origin);var n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(n).add(this.origin)},e.distanceToPoint=function(t){return Math.sqrt(this.distanceSqToPoint(t))},e.distanceSqToPoint=function(t){var e=Kc.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Kc.copy(this.direction).multiplyScalar(e).add(this.origin),Kc.distanceToSquared(t))},e.distanceSqToSegment=function(t,e,n,r){$c.copy(t).add(e).multiplyScalar(.5),tl.copy(e).sub(t).normalize(),el.copy(this.origin).sub($c);var i,a,o,s,c=.5*t.distanceTo(e),l=-this.direction.dot(tl),u=el.dot(this.direction),h=-el.dot(tl),d=el.lengthSq(),p=Math.abs(1-l*l);if(p>0)if(i=l*h-u,a=l*u-h,s=c*p,i>=0)if(a>=-s)if(a<=s){var f=1/p;i*=f,a*=f,o=i*(i+l*a+2*u)+a*(l*i+a+2*h)+d}else a=c,i=Math.max(0,-(l*a+u)),o=-i*i+a*(a+2*h)+d;else a=-c,i=Math.max(0,-(l*a+u)),o=-i*i+a*(a+2*h)+d;else a<=-s?(i=Math.max(0,-(-l*c+u)),a=i>0?-c:Math.min(Math.max(-c,-h),c),o=-i*i+a*(a+2*h)+d):a<=s?(i=0,a=Math.min(Math.max(-c,-h),c),o=a*(a+2*h)+d):(i=Math.max(0,-(l*c+u)),a=i>0?c:Math.min(Math.max(-c,-h),c),o=-i*i+a*(a+2*h)+d);else a=l>0?-c:c,i=Math.max(0,-(l*a+u)),o=-i*i+a*(a+2*h)+d;return n&&n.copy(this.direction).multiplyScalar(i).add(this.origin),r&&r.copy(tl).multiplyScalar(a).add($c),o},e.intersectSphere=function(t,e){Kc.subVectors(t.center,this.origin);var n=Kc.dot(this.direction),r=Kc.dot(Kc)-n*n,i=t.radius*t.radius;if(r>i)return null;var a=Math.sqrt(i-r),o=n-a,s=n+a;return o<0&&s<0?null:o<0?this.at(s,e):this.at(o,e)},e.intersectsSphere=function(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius},e.distanceToPlane=function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null},e.intersectPlane=function(t,e){var n=this.distanceToPlane(t);return null===n?null:this.at(n,e)},e.intersectsPlane=function(t){var e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0},e.intersectBox=function(t,e){var n,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,h=this.origin;return c>=0?(n=(t.min.x-h.x)*c,r=(t.max.x-h.x)*c):(n=(t.max.x-h.x)*c,r=(t.min.x-h.x)*c),l>=0?(i=(t.min.y-h.y)*l,a=(t.max.y-h.y)*l):(i=(t.max.y-h.y)*l,a=(t.min.y-h.y)*l),n>a||i>r?null:((i>n||n!==n)&&(n=i),(a<r||r!==r)&&(r=a),u>=0?(o=(t.min.z-h.z)*u,s=(t.max.z-h.z)*u):(o=(t.max.z-h.z)*u,s=(t.min.z-h.z)*u),n>s||o>r?null:((o>n||n!==n)&&(n=o),(s<r||r!==r)&&(r=s),r<0?null:this.at(n>=0?n:r,e)))},e.intersectsBox=function(t){return null!==this.intersectBox(t,Kc)},e.intersectTriangle=function(t,e,n,r,i){nl.subVectors(e,t),rl.subVectors(n,t),il.crossVectors(nl,rl);var a,o=this.direction.dot(il);if(o>0){if(r)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}el.subVectors(this.origin,t);var s=a*this.direction.dot(rl.crossVectors(el,rl));if(s<0)return null;var c=a*this.direction.dot(nl.cross(el));if(c<0)return null;if(s+c>o)return null;var l=-a*el.dot(il);return l<0?null:this.at(l/o,i)},e.applyMatrix4=function(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this},e.equals=function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)},t}(),ol=function(){function t(){Object.defineProperty(this,"isMatrix4",{value:!0}),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.")}var e=t.prototype;return e.set=function(t,e,n,r,i,a,o,s,c,l,u,h,d,p,f,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=n,v[12]=r,v[1]=i,v[5]=a,v[9]=o,v[13]=s,v[2]=c,v[6]=l,v[10]=u,v[14]=h,v[3]=d,v[7]=p,v[11]=f,v[15]=m,this},e.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},e.clone=function(){return(new t).fromArray(this.elements)},e.copy=function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this},e.copyPosition=function(t){var e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this},e.setFromMatrix3=function(t){var e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this},e.extractBasis=function(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},e.makeBasis=function(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this},e.extractRotation=function(t){var e=this.elements,n=t.elements,r=1/sl.setFromMatrixColumn(t,0).length(),i=1/sl.setFromMatrixColumn(t,1).length(),a=1/sl.setFromMatrixColumn(t,2).length();return e[0]=n[0]*r,e[1]=n[1]*r,e[2]=n[2]*r,e[3]=0,e[4]=n[4]*i,e[5]=n[5]*i,e[6]=n[6]*i,e[7]=0,e[8]=n[8]*a,e[9]=n[9]*a,e[10]=n[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},e.makeRotationFromEuler=function(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,n=t.x,r=t.y,i=t.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i);if("XYZ"===t.order){var h=a*l,d=a*u,p=o*l,f=o*u;e[0]=s*l,e[4]=-s*u,e[8]=c,e[1]=d+p*c,e[5]=h-f*c,e[9]=-o*s,e[2]=f-h*c,e[6]=p+d*c,e[10]=a*s}else if("YXZ"===t.order){var m=s*l,v=s*u,g=c*l,y=c*u;e[0]=m+y*o,e[4]=g*o-v,e[8]=a*c,e[1]=a*u,e[5]=a*l,e[9]=-o,e[2]=v*o-g,e[6]=y+m*o,e[10]=a*s}else if("ZXY"===t.order){var x=s*l,_=s*u,b=c*l,w=c*u;e[0]=x-w*o,e[4]=-a*u,e[8]=b+_*o,e[1]=_+b*o,e[5]=a*l,e[9]=w-x*o,e[2]=-a*c,e[6]=o,e[10]=a*s}else if("ZYX"===t.order){var M=a*l,S=a*u,T=o*l,E=o*u;e[0]=s*l,e[4]=T*c-S,e[8]=M*c+E,e[1]=s*u,e[5]=E*c+M,e[9]=S*c-T,e[2]=-c,e[6]=o*s,e[10]=a*s}else if("YZX"===t.order){var A=a*s,L=a*c,R=o*s,C=o*c;e[0]=s*l,e[4]=C-A*u,e[8]=R*u+L,e[1]=u,e[5]=a*l,e[9]=-o*l,e[2]=-c*l,e[6]=L*u+R,e[10]=A-C*u}else if("XZY"===t.order){var P=a*s,O=a*c,I=o*s,D=o*c;e[0]=s*l,e[4]=-u,e[8]=c*l,e[1]=P*u+D,e[5]=a*l,e[9]=O*u-I,e[2]=I*u-O,e[6]=o*l,e[10]=D*u+P}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},e.makeRotationFromQuaternion=function(t){return this.compose(ll,t,ul)},e.lookAt=function(t,e,n){var r=this.elements;return pl.subVectors(t,e),0===pl.lengthSq()&&(pl.z=1),pl.normalize(),hl.crossVectors(n,pl),0===hl.lengthSq()&&(1===Math.abs(n.z)?pl.x+=1e-4:pl.z+=1e-4,pl.normalize(),hl.crossVectors(n,pl)),hl.normalize(),dl.crossVectors(pl,hl),r[0]=hl.x,r[4]=dl.x,r[8]=pl.x,r[1]=hl.y,r[5]=dl.y,r[9]=pl.y,r[2]=hl.z,r[6]=dl.z,r[10]=pl.z,this},e.multiply=function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},e.premultiply=function(t){return this.multiplyMatrices(t,this)},e.multiplyMatrices=function(t,e){var n=t.elements,r=e.elements,i=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=n[1],u=n[5],h=n[9],d=n[13],p=n[2],f=n[6],m=n[10],v=n[14],g=n[3],y=n[7],x=n[11],_=n[15],b=r[0],w=r[4],M=r[8],S=r[12],T=r[1],E=r[5],A=r[9],L=r[13],R=r[2],C=r[6],P=r[10],O=r[14],I=r[3],D=r[7],N=r[11],B=r[15];return i[0]=a*b+o*T+s*R+c*I,i[4]=a*w+o*E+s*C+c*D,i[8]=a*M+o*A+s*P+c*N,i[12]=a*S+o*L+s*O+c*B,i[1]=l*b+u*T+h*R+d*I,i[5]=l*w+u*E+h*C+d*D,i[9]=l*M+u*A+h*P+d*N,i[13]=l*S+u*L+h*O+d*B,i[2]=p*b+f*T+m*R+v*I,i[6]=p*w+f*E+m*C+v*D,i[10]=p*M+f*A+m*P+v*N,i[14]=p*S+f*L+m*O+v*B,i[3]=g*b+y*T+x*R+_*I,i[7]=g*w+y*E+x*C+_*D,i[11]=g*M+y*A+x*P+_*N,i[15]=g*S+y*L+x*O+_*B,this},e.multiplyScalar=function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},e.determinant=function(){var t=this.elements,e=t[0],n=t[4],r=t[8],i=t[12],a=t[1],o=t[5],s=t[9],c=t[13],l=t[2],u=t[6],h=t[10],d=t[14];return t[3]*(+i*s*u-r*c*u-i*o*h+n*c*h+r*o*d-n*s*d)+t[7]*(+e*s*d-e*c*h+i*a*h-r*a*d+r*c*l-i*s*l)+t[11]*(+e*c*u-e*o*d-i*a*u+n*a*d+i*o*l-n*c*l)+t[15]*(-r*o*l-e*s*u+e*o*h+r*a*u-n*a*h+n*s*l)},e.transpose=function(){var t,e=this.elements;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},e.setPosition=function(t,e,n){var r=this.elements;return t.isVector3?(r[12]=t.x,r[13]=t.y,r[14]=t.z):(r[12]=t,r[13]=e,r[14]=n),this},e.invert=function(){var t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9],h=t[10],d=t[11],p=t[12],f=t[13],m=t[14],v=t[15],g=u*m*c-f*h*c+f*s*d-o*m*d-u*s*v+o*h*v,y=p*h*c-l*m*c-p*s*d+a*m*d+l*s*v-a*h*v,x=l*f*c-p*u*c+p*o*d-a*f*d-l*o*v+a*u*v,_=p*u*s-l*f*s-p*o*h+a*f*h+l*o*m-a*u*m,b=e*g+n*y+r*x+i*_;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var w=1/b;return t[0]=g*w,t[1]=(f*h*i-u*m*i-f*r*d+n*m*d+u*r*v-n*h*v)*w,t[2]=(o*m*i-f*s*i+f*r*c-n*m*c-o*r*v+n*s*v)*w,t[3]=(u*s*i-o*h*i-u*r*c+n*h*c+o*r*d-n*s*d)*w,t[4]=y*w,t[5]=(l*m*i-p*h*i+p*r*d-e*m*d-l*r*v+e*h*v)*w,t[6]=(p*s*i-a*m*i-p*r*c+e*m*c+a*r*v-e*s*v)*w,t[7]=(a*h*i-l*s*i+l*r*c-e*h*c-a*r*d+e*s*d)*w,t[8]=x*w,t[9]=(p*u*i-l*f*i-p*n*d+e*f*d+l*n*v-e*u*v)*w,t[10]=(a*f*i-p*o*i+p*n*c-e*f*c-a*n*v+e*o*v)*w,t[11]=(l*o*i-a*u*i-l*n*c+e*u*c+a*n*d-e*o*d)*w,t[12]=_*w,t[13]=(l*f*r-p*u*r+p*n*h-e*f*h-l*n*m+e*u*m)*w,t[14]=(p*o*r-a*f*r-p*n*s+e*f*s+a*n*m-e*o*m)*w,t[15]=(a*u*r-l*o*r+l*n*s-e*u*s-a*n*h+e*o*h)*w,this},e.scale=function(t){var e=this.elements,n=t.x,r=t.y,i=t.z;return e[0]*=n,e[4]*=r,e[8]*=i,e[1]*=n,e[5]*=r,e[9]*=i,e[2]*=n,e[6]*=r,e[10]*=i,e[3]*=n,e[7]*=r,e[11]*=i,this},e.getMaxScaleOnAxis=function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,r))},e.makeTranslation=function(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this},e.makeRotationX=function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this},e.makeRotationY=function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this},e.makeRotationZ=function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this},e.makeRotationAxis=function(t,e){var n=Math.cos(e),r=Math.sin(e),i=1-n,a=t.x,o=t.y,s=t.z,c=i*a,l=i*o;return this.set(c*a+n,c*o-r*s,c*s+r*o,0,c*o+r*s,l*o+n,l*s-r*a,0,c*s-r*o,l*s+r*a,i*s*s+n,0,0,0,0,1),this},e.makeScale=function(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this},e.makeShear=function(t,e,n){return this.set(1,e,n,0,t,1,n,0,t,e,1,0,0,0,0,1),this},e.compose=function(t,e,n){var r=this.elements,i=e._x,a=e._y,o=e._z,s=e._w,c=i+i,l=a+a,u=o+o,h=i*c,d=i*l,p=i*u,f=a*l,m=a*u,v=o*u,g=s*c,y=s*l,x=s*u,_=n.x,b=n.y,w=n.z;return r[0]=(1-(f+v))*_,r[1]=(d+x)*_,r[2]=(p-y)*_,r[3]=0,r[4]=(d-x)*b,r[5]=(1-(h+v))*b,r[6]=(m+g)*b,r[7]=0,r[8]=(p+y)*w,r[9]=(m-g)*w,r[10]=(1-(h+f))*w,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this},e.decompose=function(t,e,n){var r=this.elements,i=sl.set(r[0],r[1],r[2]).length(),a=sl.set(r[4],r[5],r[6]).length(),o=sl.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),t.x=r[12],t.y=r[13],t.z=r[14],cl.copy(this);var s=1/i,c=1/a,l=1/o;return cl.elements[0]*=s,cl.elements[1]*=s,cl.elements[2]*=s,cl.elements[4]*=c,cl.elements[5]*=c,cl.elements[6]*=c,cl.elements[8]*=l,cl.elements[9]*=l,cl.elements[10]*=l,e.setFromRotationMatrix(cl),n.x=i,n.y=a,n.z=o,this},e.makePerspective=function(t,e,n,r,i,a){void 0===a&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var o=this.elements,s=2*i/(e-t),c=2*i/(n-r),l=(e+t)/(e-t),u=(n+r)/(n-r),h=-(a+i)/(a-i),d=-2*a*i/(a-i);return o[0]=s,o[4]=0,o[8]=l,o[12]=0,o[1]=0,o[5]=c,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=h,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},e.makeOrthographic=function(t,e,n,r,i,a){var o=this.elements,s=1/(e-t),c=1/(n-r),l=1/(a-i),u=(e+t)*s,h=(n+r)*c,d=(a+i)*l;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-h,o[2]=0,o[6]=0,o[10]=-2*l,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},e.equals=function(t){for(var e=this.elements,n=t.elements,r=0;r<16;r++)if(e[r]!==n[r])return!1;return!0},e.fromArray=function(t,e){void 0===e&&(e=0);for(var n=0;n<16;n++)this.elements[n]=t[n+e];return this},e.toArray=function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t},t}(),sl=new Ic,cl=new ol,ll=new Ic(0,0,0),ul=new Ic(1,1,1),hl=new Ic,dl=new Ic,pl=new Ic,fl=function(){function t(e,n,r,i){void 0===e&&(e=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===i&&(i=t.DefaultOrder),Object.defineProperty(this,"isEuler",{value:!0}),this._x=e,this._y=n,this._z=r,this._order=i}var e=t.prototype;return e.set=function(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._order=r||this._order,this._onChangeCallback(),this},e.clone=function(){return new this.constructor(this._x,this._y,this._z,this._order)},e.copy=function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this},e.setFromRotationMatrix=function(t,e,n){var r=Sc.clamp,i=t.elements,a=i[0],o=i[4],s=i[8],c=i[1],l=i[5],u=i[9],h=i[2],d=i[6],p=i[10];switch(e=e||this._order){case"XYZ":this._y=Math.asin(r(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-r(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(s,p),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-h,a),this._z=0);break;case"ZXY":this._x=Math.asin(r(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,a));break;case"ZYX":this._y=Math.asin(-r(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(r(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-h,a)):(this._x=0,this._y=Math.atan2(s,p));break;case"XZY":this._z=Math.asin(-r(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-u,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!1!==n&&this._onChangeCallback(),this},e.setFromQuaternion=function(t,e,n){return ml.makeRotationFromQuaternion(t),this.setFromRotationMatrix(ml,e,n)},e.setFromVector3=function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},e.reorder=function(t){return vl.setFromEuler(this),this.setFromQuaternion(vl,t)},e.equals=function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},e.fromArray=function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this},e.toArray=function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},e.toVector3=function(t){return t?t.set(this._x,this._y,this._z):new Ic(this._x,this._y,this._z)},e._onChange=function(t){return this._onChangeCallback=t,this},e._onChangeCallback=function(){},i(t,[{key:"x",get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},{key:"order",get:function(){return this._order},set:function(t){this._order=t,this._onChangeCallback()}}]),t}();fl.DefaultOrder="XYZ",fl.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];var ml=new ol,vl=new Oc,gl=function(){function t(){this.mask=1}var e=t.prototype;return e.set=function(t){this.mask=1<<t|0},e.enable=function(t){this.mask|=1<<t|0},e.enableAll=function(){this.mask=-1},e.toggle=function(t){this.mask^=1<<t|0},e.disable=function(t){this.mask&=~(1<<t|0)},e.disableAll=function(){this.mask=0},e.test=function(t){return 0!=(this.mask&t.mask)},t}(),yl=0,xl=new Ic,_l=new Oc,bl=new ol,wl=new Ic,Ml=new Ic,Sl=new Ic,Tl=new Oc,El=new Ic(1,0,0),Al=new Ic(0,1,0),Ll=new Ic(0,0,1),Rl={type:"added"},Cl={type:"removed"};f.DefaultUp=new Ic(0,1,0),f.DefaultMatrixAutoUpdate=!0,f.prototype=Object.assign(Object.create(u.prototype),{constructor:f,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix4:function(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(t){return this.quaternion.premultiply(t),this},setRotationFromAxisAngle:function(t,e){this.quaternion.setFromAxisAngle(t,e)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:function(t,e){return _l.setFromAxisAngle(t,e),this.quaternion.multiply(_l),this},rotateOnWorldAxis:function(t,e){return _l.setFromAxisAngle(t,e),this.quaternion.premultiply(_l),this},rotateX:function(t){return this.rotateOnAxis(El,t)},rotateY:function(t){return this.rotateOnAxis(Al,t)},rotateZ:function(t){return this.rotateOnAxis(Ll,t)},translateOnAxis:function(t,e){return xl.copy(t).applyQuaternion(this.quaternion),this.position.add(xl.multiplyScalar(e)),this},translateX:function(t){return this.translateOnAxis(El,t)},translateY:function(t){return this.translateOnAxis(Al,t)},translateZ:function(t){return this.translateOnAxis(Ll,t)},localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:function(t){return t.applyMatrix4(bl.copy(this.matrixWorld).invert())},lookAt:function(t,e,n){t.isVector3?wl.copy(t):wl.set(t,e,n);var r=this.parent;this.updateWorldMatrix(!0,!1),Ml.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?bl.lookAt(Ml,wl,this.up):bl.lookAt(wl,Ml,this.up),this.quaternion.setFromRotationMatrix(bl),r&&(bl.extractRotation(r.matrixWorld),_l.setFromRotationMatrix(bl),this.quaternion.premultiply(_l.invert()))},add:function(t){if(arguments.length>1){for(var e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(Rl)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)},remove:function(t){if(arguments.length>1){for(var e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}var n=this.children.indexOf(t);return-1!==n&&(t.parent=null,this.children.splice(n,1),t.dispatchEvent(Cl)),this},clear:function(){for(var t=0;t<this.children.length;t++){var e=this.children[t];e.parent=null,e.dispatchEvent(Cl)}return this.children.length=0,this},attach:function(t){return this.updateWorldMatrix(!0,!1),bl.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),bl.multiply(t.parent.matrixWorld)),t.applyMatrix4(bl),t.updateWorldMatrix(!1,!1),this.add(t),this},getObjectById:function(t){return this.getObjectByProperty("id",t)},getObjectByName:function(t){return this.getObjectByProperty("name",t)},getObjectByProperty:function(t,e){if(this[t]===e)return this;for(var n=0,r=this.children.length;n<r;n++){var i=this.children[n],a=i.getObjectByProperty(t,e);if(void 0!==a)return a}},getWorldPosition:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),t=new Ic),this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),t=new Oc),this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ml,t,Sl),t},getWorldScale:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),t=new Ic),this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ml,Tl,t),t},getWorldDirection:function(t){void 0===t&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),t=new Ic),this.updateWorldMatrix(!0,!1);var e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()},raycast:function(){},traverse:function(t){t(this);for(var e=this.children,n=0,r=e.length;n<r;n++)e[n].traverse(t)},traverseVisible:function(t){if(!1!==this.visible){t(this);for(var e=this.children,n=0,r=e.length;n<r;n++)e[n].traverseVisible(t)}},traverseAncestors:function(t){var e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(var e=this.children,n=0,r=e.length;n<r;n++)e[n].updateMatrixWorld(t)},updateWorldMatrix:function(t,e){var n=this.parent;if(!0===t&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===e)for(var r=this.children,i=0,a=r.length;i<a;i++)r[i].updateWorldMatrix(!1,!0)},toJSON:function(t){function e(e,n){return void 0===e[n.uuid]&&(e[n.uuid]=n.toJSON(t)),n.uuid}function n(t){var e=[];for(var n in t){var r=t[n];delete r.metadata,e.push(r)}return e}var r=void 0===t||"string"==typeof t,i={};r&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var a={};if(a.uuid=this.uuid,a.type=this.type,""!==this.name&&(a.name=this.name),!0===this.castShadow&&(a.castShadow=!0),!0===this.receiveShadow&&(a.receiveShadow=!0),!1===this.visible&&(a.visible=!1),!1===this.frustumCulled&&(a.frustumCulled=!1),0!==this.renderOrder&&(a.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(a.userData=this.userData),a.layers=this.layers.mask,a.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(a.matrixAutoUpdate=!1),this.isInstancedMesh&&(a.type="InstancedMesh",a.count=this.count,a.instanceMatrix=this.instanceMatrix.toJSON()),this.isMesh||this.isLine||this.isPoints){a.geometry=e(t.geometries,this.geometry);var o=this.geometry.parameters;if(void 0!==o&&void 0!==o.shapes){var s=o.shapes;if(Array.isArray(s))for(var c=0,l=s.length;c<l;c++){var u=s[c];e(t.shapes,u)}else e(t.shapes,s)}}if(this.isSkinnedMesh&&(a.bindMode=this.bindMode,a.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(e(t.skeletons,this.skeleton),a.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){for(var h=[],d=0,p=this.material.length;d<p;d++)h.push(e(t.materials,this.material[d]));a.material=h}else a.material=e(t.materials,this.material);if(this.children.length>0){a.children=[];for(var f=0;f<this.children.length;f++)a.children.push(this.children[f].toJSON(t).object)}if(this.animations.length>0){a.animations=[];for(var m=0;m<this.animations.length;m++){var v=this.animations[m];a.animations.push(e(t.animations,v))}}if(r){var g=n(t.geometries),y=n(t.materials),x=n(t.textures),_=n(t.images),b=n(t.shapes),w=n(t.skeletons),M=n(t.animations);g.length>0&&(i.geometries=g),y.length>0&&(i.materials=y),x.length>0&&(i.textures=x),_.length>0&&(i.images=_),b.length>0&&(i.shapes=b),w.length>0&&(i.skeletons=w),M.length>0&&(i.animations=M)}return i.object=a,i},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(var n=0;n<t.children.length;n++){var r=t.children[n];this.add(r.clone())}return this}});var Pl=new Ic,Ol=new Ic,Il=new Ec,Dl=function(){function t(t,e){Object.defineProperty(this,"isPlane",{value:!0}),this.normal=void 0!==t?t:new Ic(1,0,0),this.constant=void 0!==e?e:0}var e=t.prototype;return e.set=function(t,e){return this.normal.copy(t),this.constant=e,this},e.setComponents=function(t,e,n,r){return this.normal.set(t,e,n),this.constant=r,this},e.setFromNormalAndCoplanarPoint=function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},e.setFromCoplanarPoints=function(t,e,n){var r=Pl.subVectors(n,e).cross(Ol.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(r,t),this},e.clone=function(){return(new this.constructor).copy(this)},e.copy=function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},e.normalize=function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},e.negate=function(){return this.constant*=-1,this.normal.negate(),this},e.distanceToPoint=function(t){return this.normal.dot(t)+this.constant},e.distanceToSphere=function(t){return this.distanceToPoint(t.center)-t.radius},e.projectPoint=function(t,e){return void 0===e&&(console.warn("THREE.Plane: .projectPoint() target is now required"),e=new Ic),e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)},e.intersectLine=function(t,e){void 0===e&&(console.warn("THREE.Plane: .intersectLine() target is now required"),e=new Ic);var n=t.delta(Pl),r=this.normal.dot(n);if(0!==r){var i=-(t.start.dot(this.normal)+this.constant)/r;if(!(i<0||i>1))return e.copy(n).multiplyScalar(i).add(t.start)}else if(0===this.distanceToPoint(t.start))return e.copy(t.start)},e.intersectsLine=function(t){var e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0},e.intersectsBox=function(t){return t.intersectsPlane(this)},e.intersectsSphere=function(t){return t.intersectsPlane(this)},e.coplanarPoint=function(t){return void 0===t&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),t=new Ic),t.copy(this.normal).multiplyScalar(-this.constant)},e.applyMatrix4=function(t,e){var n=e||Il.getNormalMatrix(t),r=this.coplanarPoint(Pl).applyMatrix4(t),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this},e.translate=function(t){return this.constant-=t.dot(this.normal),this},e.equals=function(t){return t.normal.equals(this.normal)&&t.constant===this.constant},t}(),Nl=new Ic,Bl=new Ic,zl=new Ic,Fl=new Ic,Hl=new Ic,Gl=new Ic,Ul=new Ic,kl=new Ic,Vl=new Ic,Wl=new Ic,jl=function(){function t(t,e,n){this.a=void 0!==t?t:new Ic,this.b=void 0!==e?e:new Ic,this.c=void 0!==n?n:new Ic}t.getNormal=function(t,e,n,r){void 0===r&&(console.warn("THREE.Triangle: .getNormal() target is now required"),r=new Ic),r.subVectors(n,e),Nl.subVectors(t,e),r.cross(Nl);var i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)},t.getBarycoord=function(t,e,n,r,i){Nl.subVectors(r,e),Bl.subVectors(n,e),zl.subVectors(t,e);var a=Nl.dot(Nl),o=Nl.dot(Bl),s=Nl.dot(zl),c=Bl.dot(Bl),l=Bl.dot(zl),u=a*c-o*o;if(void 0===i&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),i=new Ic),0===u)return i.set(-2,-1,-1);var h=1/u,d=(c*s-o*l)*h,p=(a*l-o*s)*h;return i.set(1-d-p,p,d)},t.containsPoint=function(t,e,n,r){return this.getBarycoord(t,e,n,r,Fl),Fl.x>=0&&Fl.y>=0&&Fl.x+Fl.y<=1},t.getUV=function(t,e,n,r,i,a,o,s){return this.getBarycoord(t,e,n,r,Fl),s.set(0,0),s.addScaledVector(i,Fl.x),s.addScaledVector(a,Fl.y),s.addScaledVector(o,Fl.z),s},t.isFrontFacing=function(t,e,n,r){return Nl.subVectors(n,e),Bl.subVectors(t,e),Nl.cross(Bl).dot(r)<0};var e=t.prototype;return e.set=function(t,e,n){return this.a.copy(t),
  134. this.b.copy(e),this.c.copy(n),this},e.setFromPointsAndIndices=function(t,e,n,r){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[r]),this},e.clone=function(){return(new this.constructor).copy(this)},e.copy=function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},e.getArea=function(){return Nl.subVectors(this.c,this.b),Bl.subVectors(this.a,this.b),.5*Nl.cross(Bl).length()},e.getMidpoint=function(t){return void 0===t&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),t=new Ic),t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},e.getNormal=function(e){return t.getNormal(this.a,this.b,this.c,e)},e.getPlane=function(t){return void 0===t&&(console.warn("THREE.Triangle: .getPlane() target is now required"),t=new Dl),t.setFromCoplanarPoints(this.a,this.b,this.c)},e.getBarycoord=function(e,n){return t.getBarycoord(e,this.a,this.b,this.c,n)},e.getUV=function(e,n,r,i,a){return t.getUV(e,this.a,this.b,this.c,n,r,i,a)},e.containsPoint=function(e){return t.containsPoint(e,this.a,this.b,this.c)},e.isFrontFacing=function(e){return t.isFrontFacing(this.a,this.b,this.c,e)},e.intersectsBox=function(t){return t.intersectsTriangle(this)},e.closestPointToPoint=function(t,e){void 0===e&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),e=new Ic);var n,r,i=this.a,a=this.b,o=this.c;Hl.subVectors(a,i),Gl.subVectors(o,i),kl.subVectors(t,i);var s=Hl.dot(kl),c=Gl.dot(kl);if(s<=0&&c<=0)return e.copy(i);Vl.subVectors(t,a);var l=Hl.dot(Vl),u=Gl.dot(Vl);if(l>=0&&u<=l)return e.copy(a);var h=s*u-l*c;if(h<=0&&s>=0&&l<=0)return n=s/(s-l),e.copy(i).addScaledVector(Hl,n);Wl.subVectors(t,o);var d=Hl.dot(Wl),p=Gl.dot(Wl);if(p>=0&&d<=p)return e.copy(o);var f=d*c-s*p;if(f<=0&&c>=0&&p<=0)return r=c/(c-p),e.copy(i).addScaledVector(Gl,r);var m=l*p-d*u;if(m<=0&&u-l>=0&&d-p>=0)return Ul.subVectors(o,a),r=(u-l)/(u-l+(d-p)),e.copy(a).addScaledVector(Ul,r);var v=1/(m+f+h);return n=f*v,r=h*v,e.copy(i).addScaledVector(Hl,n).addScaledVector(Gl,r)},e.equals=function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)},t}(),ql={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},Xl={h:0,s:0,l:0},Yl={h:0,s:0,l:0},Zl=function(){function t(t,e,n){return Object.defineProperty(this,"isColor",{value:!0}),void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}var e=t.prototype;return e.set=function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},e.setScalar=function(t){return this.r=t,this.g=t,this.b=t,this},e.setHex=function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},e.setRGB=function(t,e,n){return this.r=t,this.g=e,this.b=n,this},e.setHSL=function(t,e,n){if(t=Sc.euclideanModulo(t,1),e=Sc.clamp(e,0,1),n=Sc.clamp(n,0,1),0===e)this.r=this.g=this.b=n;else{var r=n<=.5?n*(1+e):n+e-n*e,i=2*n-r;this.r=m(i,r,t+1/3),this.g=m(i,r,t),this.b=m(i,r,t-1/3)}return this},e.setStyle=function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){var r,i=n[1],a=n[2];switch(i){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,e(r[4]),this;if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,e(r[4]),this;break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)){var o=parseFloat(r[1])/360,s=parseInt(r[2],10)/100,c=parseInt(r[3],10)/100;return e(r[4]),this.setHSL(o,s,c)}}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(t)){var l=n[1],u=l.length;if(3===u)return this.r=parseInt(l.charAt(0)+l.charAt(0),16)/255,this.g=parseInt(l.charAt(1)+l.charAt(1),16)/255,this.b=parseInt(l.charAt(2)+l.charAt(2),16)/255,this;if(6===u)return this.r=parseInt(l.charAt(0)+l.charAt(1),16)/255,this.g=parseInt(l.charAt(2)+l.charAt(3),16)/255,this.b=parseInt(l.charAt(4)+l.charAt(5),16)/255,this}return t&&t.length>0?this.setColorName(t):this},e.setColorName=function(t){var e=ql[t];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this},e.clone=function(){return new this.constructor(this.r,this.g,this.b)},e.copy=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},e.copyGammaToLinear=function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},e.copyLinearToGamma=function(t,e){void 0===e&&(e=2);var n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this},e.convertGammaToLinear=function(t){return this.copyGammaToLinear(this,t),this},e.convertLinearToGamma=function(t){return this.copyLinearToGamma(this,t),this},e.copySRGBToLinear=function(t){return this.r=v(t.r),this.g=v(t.g),this.b=v(t.b),this},e.copyLinearToSRGB=function(t){return this.r=g(t.r),this.g=g(t.g),this.b=g(t.b),this},e.convertSRGBToLinear=function(){return this.copySRGBToLinear(this),this},e.convertLinearToSRGB=function(){return this.copyLinearToSRGB(this),this},e.getHex=function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},e.getHexString=function(){return("000000"+this.getHex().toString(16)).slice(-6)},e.getHSL=function(t){void 0===t&&(console.warn("THREE.Color: .getHSL() target is now required"),t={h:0,s:0,l:0});var e,n,r=this.r,i=this.g,a=this.b,o=Math.max(r,i,a),s=Math.min(r,i,a),c=(s+o)/2;if(s===o)e=0,n=0;else{var l=o-s;switch(n=c<=.5?l/(o+s):l/(2-o-s),o){case r:e=(i-a)/l+(i<a?6:0);break;case i:e=(a-r)/l+2;break;case a:e=(r-i)/l+4}e/=6}return t.h=e,t.s=n,t.l=c,t},e.getStyle=function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},e.offsetHSL=function(t,e,n){return this.getHSL(Xl),Xl.h+=t,Xl.s+=e,Xl.l+=n,this.setHSL(Xl.h,Xl.s,Xl.l),this},e.add=function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this},e.addColors=function(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this},e.addScalar=function(t){return this.r+=t,this.g+=t,this.b+=t,this},e.sub=function(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this},e.multiply=function(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this},e.multiplyScalar=function(t){return this.r*=t,this.g*=t,this.b*=t,this},e.lerp=function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this},e.lerpColors=function(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this},e.lerpHSL=function(t,e){this.getHSL(Xl),t.getHSL(Yl);var n=Sc.lerp(Xl.h,Yl.h,e),r=Sc.lerp(Xl.s,Yl.s,e),i=Sc.lerp(Xl.l,Yl.l,e);return this.setHSL(n,r,i),this},e.equals=function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b},e.fromArray=function(t,e){return void 0===e&&(e=0),this.r=t[e],this.g=t[e+1],this.b=t[e+2],this},e.toArray=function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t},e.fromBufferAttribute=function(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),!0===t.normalized&&(this.r/=255,this.g/=255,this.b/=255),this},e.toJSON=function(){return this.getHex()},t}();Zl.NAMES=ql,Zl.prototype.r=1,Zl.prototype.g=1,Zl.prototype.b=1;var Jl=function(){function t(t,e,n,r,i,a){void 0===a&&(a=0),this.a=t,this.b=e,this.c=n,this.normal=r&&r.isVector3?r:new Ic,this.vertexNormals=Array.isArray(r)?r:[],this.color=i&&i.isColor?i:new Zl,this.vertexColors=Array.isArray(i)?i:[],this.materialIndex=a}var e=t.prototype;return e.clone=function(){return(new this.constructor).copy(this)},e.copy=function(t){this.a=t.a,this.b=t.b,this.c=t.c,this.normal.copy(t.normal),this.color.copy(t.color),this.materialIndex=t.materialIndex;for(var e=0,n=t.vertexNormals.length;e<n;e++)this.vertexNormals[e]=t.vertexNormals[e].clone();for(var r=0,i=t.vertexColors.length;r<i;r++)this.vertexColors[r]=t.vertexColors[r].clone();return this},t}(),Ql=0;y.prototype=Object.assign(Object.create(u.prototype),{constructor:y,isMaterial:!0,onBeforeCompile:function(){},customProgramCacheKey:function(){return this.onBeforeCompile.toString()},setValues:function(t){if(void 0!==t)for(var e in t){var n=t[e];if(void 0!==n)if("shading"!==e){var r=this[e];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[e]=n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}else console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;else console.warn("THREE.Material: '"+e+"' parameter is undefined.")}},toJSON:function(t){function e(t){var e=[];for(var n in t){var r=t[n];delete r.metadata,e.push(r)}return e}var n=void 0===t||"string"==typeof t;n&&(t={textures:{},images:{}});var r={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),void 0!==this.roughness&&(r.roughness=this.roughness),void 0!==this.metalness&&(r.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(r.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),void 0!==this.shininess&&(r.shininess=this.shininess),void 0!==this.clearcoat&&(r.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(t).uuid),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(t).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(t).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(t).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(t).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(t).uuid,r.reflectivity=this.reflectivity,r.refractionRatio=this.refractionRatio,void 0!==this.combine&&(r.combine=this.combine),void 0!==this.envMapIntensity&&(r.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(r.size=this.size),void 0!==this.sizeAttenuation&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==ka&&(r.blending=this.blending),!0===this.flatShading&&(r.flatShading=this.flatShading),this.side!==Fa&&(r.side=this.side),this.vertexColors&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),!0===this.transparent&&(r.transparent=this.transparent),r.depthFunc=this.depthFunc,r.depthTest=this.depthTest,r.depthWrite=this.depthWrite,r.stencilWrite=this.stencilWrite,r.stencilWriteMask=this.stencilWriteMask,r.stencilFunc=this.stencilFunc,r.stencilRef=this.stencilRef,r.stencilFuncMask=this.stencilFuncMask,r.stencilFail=this.stencilFail,r.stencilZFail=this.stencilZFail,r.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(r.rotation=this.rotation),!0===this.polygonOffset&&(r.polygonOffset=!0),0!==this.polygonOffsetFactor&&(r.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(r.linewidth=this.linewidth),void 0!==this.dashSize&&(r.dashSize=this.dashSize),void 0!==this.gapSize&&(r.gapSize=this.gapSize),void 0!==this.scale&&(r.scale=this.scale),!0===this.dithering&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(r.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(r.wireframe=this.wireframe),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(r.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(r.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(r.morphTargets=!0),!0===this.morphNormals&&(r.morphNormals=!0),!0===this.skinning&&(r.skinning=!0),!1===this.visible&&(r.visible=!1),!1===this.toneMapped&&(r.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),n){var i=e(t.textures),a=e(t.images);i.length>0&&(r.textures=i),a.length>0&&(r.images=a)}return r},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.flatShading=t.flatShading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;var e=t.clippingPlanes,n=null;if(null!==e){var r=e.length;n=new Array(r);for(var i=0;i!==r;++i)n[i]=e[i].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(y.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),x.prototype=Object.create(y.prototype),x.prototype.constructor=x,x.prototype.isMeshBasicMaterial=!0,x.prototype.copy=function(t){return y.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this};var Kl=new Ic,$l=new Tc;Object.defineProperty(_.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(_.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this},copyAt:function(t,e,n){t*=this.itemSize,n*=e.itemSize;for(var r=0,i=this.itemSize;r<i;r++)this.array[t+r]=e.array[n+r];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){for(var e=this.array,n=0,r=0,i=t.length;r<i;r++){var a=t[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",r),a=new Zl),e[n++]=a.r,e[n++]=a.g,e[n++]=a.b}return this},copyVector2sArray:function(t){for(var e=this.array,n=0,r=0,i=t.length;r<i;r++){var a=t[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),a=new Tc),e[n++]=a.x,e[n++]=a.y}return this},copyVector3sArray:function(t){for(var e=this.array,n=0,r=0,i=t.length;r<i;r++){var a=t[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",r),a=new Ic),e[n++]=a.x,e[n++]=a.y,e[n++]=a.z}return this},copyVector4sArray:function(t){for(var e=this.array,n=0,r=0,i=t.length;r<i;r++){var a=t[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",r),a=new Rc),e[n++]=a.x,e[n++]=a.y,e[n++]=a.z,e[n++]=a.w}return this},applyMatrix3:function(t){if(2===this.itemSize)for(var e=0,n=this.count;e<n;e++)$l.fromBufferAttribute(this,e),$l.applyMatrix3(t),this.setXY(e,$l.x,$l.y);else if(3===this.itemSize)for(var r=0,i=this.count;r<i;r++)Kl.fromBufferAttribute(this,r),Kl.applyMatrix3(t),this.setXYZ(r,Kl.x,Kl.y,Kl.z);return this},applyMatrix4:function(t){for(var e=0,n=this.count;e<n;e++)Kl.x=this.getX(e),Kl.y=this.getY(e),Kl.z=this.getZ(e),Kl.applyMatrix4(t),this.setXYZ(e,Kl.x,Kl.y,Kl.z);return this},applyNormalMatrix:function(t){for(var e=0,n=this.count;e<n;e++)Kl.x=this.getX(e),Kl.y=this.getY(e),Kl.z=this.getZ(e),Kl.applyNormalMatrix(t),this.setXYZ(e,Kl.x,Kl.y,Kl.z);return this},transformDirection:function(t){for(var e=0,n=this.count;e<n;e++)Kl.x=this.getX(e),Kl.y=this.getY(e),Kl.z=this.getZ(e),Kl.transformDirection(t),this.setXYZ(e,Kl.x,Kl.y,Kl.z);return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},getX:function(t){return this.array[t*this.itemSize]},setX:function(t,e){return this.array[t*this.itemSize]=e,this},getY:function(t){return this.array[t*this.itemSize+1]},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},getZ:function(t){return this.array[t*this.itemSize+2]},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},getW:function(t){return this.array[t*this.itemSize+3]},setW:function(t,e){return this.array[t*this.itemSize+3]=e,this},setXY:function(t,e,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this},setXYZ:function(t,e,n,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=r,this},setXYZW:function(t,e,n,r,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=r,this.array[t+3]=i,this},onUpload:function(t){return this.onUploadCallback=t,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}}),b.prototype=Object.create(_.prototype),b.prototype.constructor=b,w.prototype=Object.create(_.prototype),w.prototype.constructor=w,M.prototype=Object.create(_.prototype),M.prototype.constructor=M,S.prototype=Object.create(_.prototype),S.prototype.constructor=S,T.prototype=Object.create(_.prototype),T.prototype.constructor=T,E.prototype=Object.create(_.prototype),E.prototype.constructor=E,A.prototype=Object.create(_.prototype),A.prototype.constructor=A,L.prototype=Object.create(_.prototype),L.prototype.constructor=L,L.prototype.isFloat16BufferAttribute=!0,R.prototype=Object.create(_.prototype),R.prototype.constructor=R,C.prototype=Object.create(_.prototype),C.prototype.constructor=C;var tu={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array},eu=0,nu=new ol,ru=new f,iu=new Ic,au=new Bc,ou=new Bc,su=new Ic;I.prototype=Object.assign(Object.create(u.prototype),{constructor:I,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(t){return Array.isArray(t)?this.index=new(P(t)>65535?A:T)(t,1):this.index=t,this},getAttribute:function(t){return this.attributes[t]},setAttribute:function(t,e){return this.attributes[t]=e,this},deleteAttribute:function(t){return delete this.attributes[t],this},hasAttribute:function(t){return void 0!==this.attributes[t]},addGroup:function(t,e,n){void 0===n&&(n=0),this.groups.push({start:t,count:e,materialIndex:n})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix4:function(t){var e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){var r=(new Ec).getNormalMatrix(t);n.applyNormalMatrix(r),n.needsUpdate=!0}var i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(t),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(t){return nu.makeRotationX(t),this.applyMatrix4(nu),this},rotateY:function(t){return nu.makeRotationY(t),this.applyMatrix4(nu),this},rotateZ:function(t){return nu.makeRotationZ(t),this.applyMatrix4(nu),this},translate:function(t,e,n){return nu.makeTranslation(t,e,n),this.applyMatrix4(nu),this},scale:function(t,e,n){return nu.makeScale(t,e,n),this.applyMatrix4(nu),this},lookAt:function(t){return ru.lookAt(t),ru.updateMatrix(),this.applyMatrix4(ru.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(iu).negate(),this.translate(iu.x,iu.y,iu.z),this},setFromPoints:function(t){for(var e=[],n=0,r=t.length;n<r;n++){var i=t[n];e.push(i.x,i.y,i.z||0)}return this.setAttribute("position",new R(e,3)),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Bc);var t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingBox.set(new Ic(-1/0,-1/0,-1/0),new Ic(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(var n=0,r=e.length;n<r;n++){var i=e[n];au.setFromBufferAttribute(i),this.morphTargetsRelative?(su.addVectors(this.boundingBox.min,au.min),this.boundingBox.expandByPoint(su),su.addVectors(this.boundingBox.max,au.max),this.boundingBox.expandByPoint(su)):(this.boundingBox.expandByPoint(au.min),this.boundingBox.expandByPoint(au.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:function(){null===this.boundingSphere&&(this.boundingSphere=new Qc);var t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingSphere.set(new Ic,1/0);if(t){var n=this.boundingSphere.center;if(au.setFromBufferAttribute(t),e)for(var r=0,i=e.length;r<i;r++){var a=e[r];ou.setFromBufferAttribute(a),this.morphTargetsRelative?(su.addVectors(au.min,ou.min),au.expandByPoint(su),su.addVectors(au.max,ou.max),au.expandByPoint(su)):(au.expandByPoint(ou.min),au.expandByPoint(ou.max))}au.getCenter(n);for(var o=0,s=0,c=t.count;s<c;s++)su.fromBufferAttribute(t,s),o=Math.max(o,n.distanceToSquared(su));if(e)for(var l=0,u=e.length;l<u;l++)for(var h=e[l],d=this.morphTargetsRelative,p=0,f=h.count;p<f;p++)su.fromBufferAttribute(h,p),d&&(iu.fromBufferAttribute(t,p),su.add(iu)),o=Math.max(o,n.distanceToSquared(su));this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}},computeFaceNormals:function(){},computeTangents:function(){function t(t){P.fromArray(a,3*t),O.copy(P);var e=l[t];R.copy(e),R.sub(P.multiplyScalar(P.dot(e))).normalize(),C.crossVectors(O,e);var n=C.dot(u[t]),r=n<0?-1:1;c[4*t]=R.x,c[4*t+1]=R.y,c[4*t+2]=R.z,c[4*t+3]=r}var e=this.index,n=this.attributes;if(null===e||void 0===n.position||void 0===n.normal||void 0===n.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");var r=e.array,i=n.position.array,a=n.normal.array,o=n.uv.array,s=i.length/3;void 0===n.tangent&&this.setAttribute("tangent",new _(new Float32Array(4*s),4));for(var c=n.tangent.array,l=[],u=[],h=0;h<s;h++)l[h]=new Ic,u[h]=new Ic;var d=new Ic,p=new Ic,f=new Ic,m=new Tc,v=new Tc,g=new Tc,y=new Ic,x=new Ic,b=this.groups;0===b.length&&(b=[{start:0,count:r.length}]);for(var w=0,M=b.length;w<M;++w)for(var S=b[w],T=S.start,E=S.count,A=T,L=T+E;A<L;A+=3)!function(t,e,n){d.fromArray(i,3*t),p.fromArray(i,3*e),f.fromArray(i,3*n),m.fromArray(o,2*t),v.fromArray(o,2*e),g.fromArray(o,2*n),p.sub(d),f.sub(d),v.sub(m),g.sub(m);var r=1/(v.x*g.y-g.x*v.y);isFinite(r)&&(y.copy(p).multiplyScalar(g.y).addScaledVector(f,-v.y).multiplyScalar(r),x.copy(f).multiplyScalar(v.x).addScaledVector(p,-g.x).multiplyScalar(r),l[t].add(y),l[e].add(y),l[n].add(y),u[t].add(x),u[e].add(x),u[n].add(x))}(r[A+0],r[A+1],r[A+2]);for(var R=new Ic,C=new Ic,P=new Ic,O=new Ic,I=0,D=b.length;I<D;++I)for(var N=b[I],B=N.start,z=N.count,F=B,H=B+z;F<H;F+=3)t(r[F+0]),t(r[F+1]),t(r[F+2])},computeVertexNormals:function(){var t=this.index,e=this.getAttribute("position");if(void 0!==e){var n=this.getAttribute("normal");if(void 0===n)n=new _(new Float32Array(3*e.count),3),this.setAttribute("normal",n);else for(var r=0,i=n.count;r<i;r++)n.setXYZ(r,0,0,0);var a=new Ic,o=new Ic,s=new Ic,c=new Ic,l=new Ic,u=new Ic,h=new Ic,d=new Ic;if(t)for(var p=0,f=t.count;p<f;p+=3){var m=t.getX(p+0),v=t.getX(p+1),g=t.getX(p+2);a.fromBufferAttribute(e,m),o.fromBufferAttribute(e,v),s.fromBufferAttribute(e,g),h.subVectors(s,o),d.subVectors(a,o),h.cross(d),c.fromBufferAttribute(n,m),l.fromBufferAttribute(n,v),u.fromBufferAttribute(n,g),c.add(h),l.add(h),u.add(h),n.setXYZ(m,c.x,c.y,c.z),n.setXYZ(v,l.x,l.y,l.z),n.setXYZ(g,u.x,u.y,u.z)}else for(var y=0,x=e.count;y<x;y+=3)a.fromBufferAttribute(e,y+0),o.fromBufferAttribute(e,y+1),s.fromBufferAttribute(e,y+2),h.subVectors(s,o),d.subVectors(a,o),h.cross(d),n.setXYZ(y+0,h.x,h.y,h.z),n.setXYZ(y+1,h.x,h.y,h.z),n.setXYZ(y+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}},merge:function(t,e){if(!t||!t.isBufferGeometry)return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t);void 0===e&&(e=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));var n=this.attributes;for(var r in n)if(void 0!==t.attributes[r])for(var i=n[r],a=i.array,o=t.attributes[r],s=o.array,c=o.itemSize*e,l=Math.min(s.length,a.length-c),u=0,h=c;u<l;u++,h++)a[h]=s[u];return this},normalizeNormals:function(){for(var t=this.attributes.normal,e=0,n=t.count;e<n;e++)su.fromBufferAttribute(t,e),su.normalize(),t.setXYZ(e,su.x,su.y,su.z)},toNonIndexed:function(){function t(t,e){for(var n=t.array,r=t.itemSize,i=t.normalized,a=new n.constructor(e.length*r),o=0,s=0,c=0,l=e.length;c<l;c++){o=e[c]*r;for(var u=0;u<r;u++)a[s++]=n[o++]}return new _(a,r,i)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;var e=new I,n=this.index.array,r=this.attributes;for(var i in r){var a=r[i],o=t(a,n);e.setAttribute(i,o)}var s=this.morphAttributes;for(var c in s){for(var l=[],u=s[c],h=0,d=u.length;h<d;h++){var p=u[h],f=t(p,n);l.push(f)}e.morphAttributes[c]=l}e.morphTargetsRelative=this.morphTargetsRelative;for(var m=this.groups,v=0,g=m.length;v<g;v++){var y=m[v];e.addGroup(y.start,y.count,y.materialIndex)}return e},toJSON:function(){var t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){var e=this.parameters
  135. ;for(var n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};var r=this.index;null!==r&&(t.data.index={type:r.array.constructor.name,array:Array.prototype.slice.call(r.array)});var i=this.attributes;for(var a in i){var o=i[a],s=o.toJSON(t.data);""!==o.name&&(s.name=o.name),t.data.attributes[a]=s}var c={},l=!1;for(var u in this.morphAttributes){for(var h=this.morphAttributes[u],d=[],p=0,f=h.length;p<f;p++){var m=h[p],v=m.toJSON(t.data);""!==m.name&&(v.name=m.name),d.push(v)}d.length>0&&(c[u]=d,l=!0)}l&&(t.data.morphAttributes=c,t.data.morphTargetsRelative=this.morphTargetsRelative);var g=this.groups;g.length>0&&(t.data.groups=JSON.parse(JSON.stringify(g)));var y=this.boundingSphere;return null!==y&&(t.data.boundingSphere={center:y.center.toArray(),radius:y.radius}),t},clone:function(){return(new I).copy(this)},copy:function(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;var e={};this.name=t.name;var n=t.index;null!==n&&this.setIndex(n.clone(e));var r=t.attributes;for(var i in r){var a=r[i];this.setAttribute(i,a.clone(e))}var o=t.morphAttributes;for(var s in o){for(var c=[],l=o[s],u=0,h=l.length;u<h;u++)c.push(l[u].clone(e));this.morphAttributes[s]=c}this.morphTargetsRelative=t.morphTargetsRelative;for(var d=t.groups,p=0,f=d.length;p<f;p++){var m=d[p];this.addGroup(m.start,m.count,m.materialIndex)}var v=t.boundingBox;null!==v&&(this.boundingBox=v.clone());var g=t.boundingSphere;return null!==g&&(this.boundingSphere=g.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});var cu=new ol,lu=new al,uu=new Qc,hu=new Ic,du=new Ic,pu=new Ic,fu=new Ic,mu=new Ic,vu=new Ic,gu=new Ic,yu=new Ic,xu=new Ic,_u=new Tc,bu=new Tc,wu=new Tc,Mu=new Ic,Su=new Ic;D.prototype=Object.assign(Object.create(f.prototype),{constructor:D,isMesh:!0,copy:function(t){return f.prototype.copy.call(this,t),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=t.material,this.geometry=t.geometry,this},updateMorphTargets:function(){var t=this.geometry;if(t.isBufferGeometry){var e=t.morphAttributes,n=Object.keys(e);if(n.length>0){var r=e[n[0]];if(void 0!==r){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,a=r.length;i<a;i++){var o=r[i].name||String(i);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=i}}}}else{var s=t.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(t,e){var n=this.geometry,r=this.material,i=this.matrixWorld;if(void 0!==r&&(null===n.boundingSphere&&n.computeBoundingSphere(),uu.copy(n.boundingSphere),uu.applyMatrix4(i),!1!==t.ray.intersectsSphere(uu)&&(cu.copy(i).invert(),lu.copy(t.ray).applyMatrix4(cu),null===n.boundingBox||!1!==lu.intersectsBox(n.boundingBox)))){var a;if(n.isBufferGeometry){var o=n.index,s=n.attributes.position,c=n.morphAttributes.position,l=n.morphTargetsRelative,u=n.attributes.uv,h=n.attributes.uv2,d=n.groups,p=n.drawRange;if(null!==o)if(Array.isArray(r))for(var f=0,m=d.length;f<m;f++)for(var v=d[f],g=r[v.materialIndex],y=Math.max(v.start,p.start),x=Math.min(v.start+v.count,p.start+p.count),_=y,b=x;_<b;_+=3){var w=o.getX(_),M=o.getX(_+1),S=o.getX(_+2);a=B(this,g,t,lu,s,c,l,u,h,w,M,S),a&&(a.faceIndex=Math.floor(_/3),a.face.materialIndex=v.materialIndex,e.push(a))}else for(var T=Math.max(0,p.start),E=Math.min(o.count,p.start+p.count),A=T,L=E;A<L;A+=3){var R=o.getX(A),C=o.getX(A+1),P=o.getX(A+2);a=B(this,r,t,lu,s,c,l,u,h,R,C,P),a&&(a.faceIndex=Math.floor(A/3),e.push(a))}else if(void 0!==s)if(Array.isArray(r))for(var O=0,I=d.length;O<I;O++)for(var D=d[O],N=r[D.materialIndex],z=Math.max(D.start,p.start),F=Math.min(D.start+D.count,p.start+p.count),H=z,G=F;H<G;H+=3){var U=H,k=H+1,V=H+2;a=B(this,N,t,lu,s,c,l,u,h,U,k,V),a&&(a.faceIndex=Math.floor(H/3),a.face.materialIndex=D.materialIndex,e.push(a))}else for(var W=Math.max(0,p.start),j=Math.min(s.count,p.start+p.count),q=W,X=j;q<X;q+=3){var Y=q,Z=q+1,J=q+2;a=B(this,r,t,lu,s,c,l,u,h,Y,Z,J),a&&(a.faceIndex=Math.floor(q/3),e.push(a))}}else n.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}});var Tu=function(t){function e(e,n,r,i,a,s){function c(t,e,n,r,i,a,o,s,c,l,g){for(var y=a/c,x=o/l,_=a/2,b=o/2,w=s/2,M=c+1,S=l+1,T=0,E=0,A=new Ic,L=0;L<S;L++)for(var R=L*x-b,C=0;C<M;C++){var P=C*y-_;A[t]=P*r,A[e]=R*i,A[n]=w,d.push(A.x,A.y,A.z),A[t]=0,A[e]=0,A[n]=s>0?1:-1,p.push(A.x,A.y,A.z),f.push(C/c),f.push(1-L/l),T+=1}for(var O=0;O<l;O++)for(var I=0;I<c;I++){var D=m+I+M*O,N=m+I+M*(O+1),B=m+(I+1)+M*(O+1),z=m+(I+1)+M*O;h.push(D,N,z),h.push(N,B,z),E+=6}u.addGroup(v,E,g),v+=E,m+=T}var l;void 0===e&&(e=1),void 0===n&&(n=1),void 0===r&&(r=1),void 0===i&&(i=1),void 0===a&&(a=1),void 0===s&&(s=1),l=t.call(this)||this,l.type="BoxGeometry",l.parameters={width:e,height:n,depth:r,widthSegments:i,heightSegments:a,depthSegments:s};var u=o(l);i=Math.floor(i),a=Math.floor(a),s=Math.floor(s);var h=[],d=[],p=[],f=[],m=0,v=0;return c("z","y","x",-1,-1,r,n,e,s,a,0),c("z","y","x",1,-1,r,n,-e,s,a,1),c("x","z","y",1,1,e,r,n,i,s,2),c("x","z","y",1,-1,e,r,-n,i,s,3),c("x","y","z",1,-1,e,n,r,i,a,4),c("x","y","z",-1,-1,e,n,-r,i,a,5),l.setIndex(h),l.setAttribute("position",new R(d,3)),l.setAttribute("normal",new R(p,3)),l.setAttribute("uv",new R(f,2)),l}return a(e,t),e}(I),Eu={clone:z,merge:F},Au="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",Lu="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}";H.prototype=Object.create(y.prototype),H.prototype.constructor=H,H.prototype.isShaderMaterial=!0,H.prototype.copy=function(t){return y.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=z(t.uniforms),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this},H.prototype.toJSON=function(t){var e=y.prototype.toJSON.call(this,t);e.glslVersion=this.glslVersion,e.uniforms={};for(var n in this.uniforms){var r=this.uniforms[n],i=r.value;i&&i.isTexture?e.uniforms[n]={type:"t",value:i.toJSON(t).uuid}:i&&i.isColor?e.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?e.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?e.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?e.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?e.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?e.uniforms[n]={type:"m4",value:i.toArray()}:e.uniforms[n]={value:i}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;var a={};for(var o in this.extensions)!0===this.extensions[o]&&(a[o]=!0);return Object.keys(a).length>0&&(e.extensions=a),e},G.prototype=Object.assign(Object.create(f.prototype),{constructor:G,isCamera:!0,copy:function(t,e){return f.prototype.copy.call(this,t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this},getWorldDirection:function(t){void 0===t&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),t=new Ic),this.updateWorldMatrix(!0,!1);var e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()},updateMatrixWorld:function(t){f.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()},updateWorldMatrix:function(t,e){f.prototype.updateWorldMatrix.call(this,t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()},clone:function(){return(new this.constructor).copy(this)}}),U.prototype=Object.assign(Object.create(G.prototype),{constructor:U,isPerspectiveCamera:!0,copy:function(t,e){return G.prototype.copy.call(this,t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){var e=.5*this.getFilmHeight()/t;this.fov=2*Sc.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){var t=Math.tan(.5*Sc.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*Sc.RAD2DEG*Math.atan(Math.tan(.5*Sc.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,n,r,i,a){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=this.near,e=t*Math.tan(.5*Sc.DEG2RAD*this.fov)/this.zoom,n=2*e,r=this.aspect*n,i=-.5*r,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;i+=a.offsetX*r/o,e-=a.offsetY*n/s,r*=a.width/o,n*=a.height/s}var c=this.filmOffset;0!==c&&(i+=t*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,e,e-n,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()},toJSON:function(t){var e=f.prototype.toJSON.call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}});var Ru=90,Cu=1;k.prototype=Object.create(f.prototype),k.prototype.constructor=k,V.prototype=Object.create(h.prototype),V.prototype.constructor=V,V.prototype.isCubeTexture=!0,Object.defineProperty(V.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}});var Pu=function(t){function e(e,n,r){var i;return Number.isInteger(n)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),n=r),i=t.call(this,e,e,n)||this,Object.defineProperty(o(i),"isWebGLCubeRenderTarget",{value:!0}),n=n||{},i.texture=new V(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),i.texture._needsFlipEnvMap=!1,i}a(e,t);var n=e.prototype;return n.fromEquirectangularTexture=function(t,e){this.texture.type=e.type,this.texture.format=ns,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;var n={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},r=new Tu(5,5,5),i=new H({name:"CubemapFromEquirect",uniforms:z(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Ha,blending:Ua});i.uniforms.tEquirect.value=e;var a=new D(r,i),o=e.minFilter;return e.minFilter===Uo&&(e.minFilter=Ho),new k(1,10,this).update(t,a),e.minFilter=o,a.geometry.dispose(),a.material.dispose(),this},n.clear=function(t,e,n,r){for(var i=t.getRenderTarget(),a=0;a<6;a++)t.setRenderTarget(this,a),t.clear(e,n,r);t.setRenderTarget(i)},e}(Cc);W.prototype=Object.create(h.prototype),W.prototype.constructor=W,W.prototype.isDataTexture=!0;var Ou=new Qc,Iu=new Ic,Du=function(){function t(t,e,n,r,i,a){this.planes=[void 0!==t?t:new Dl,void 0!==e?e:new Dl,void 0!==n?n:new Dl,void 0!==r?r:new Dl,void 0!==i?i:new Dl,void 0!==a?a:new Dl]}var e=t.prototype;return e.set=function(t,e,n,r,i,a){var o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this},e.clone=function(){return(new this.constructor).copy(this)},e.copy=function(t){for(var e=this.planes,n=0;n<6;n++)e[n].copy(t.planes[n]);return this},e.setFromProjectionMatrix=function(t){var e=this.planes,n=t.elements,r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],c=n[5],l=n[6],u=n[7],h=n[8],d=n[9],p=n[10],f=n[11],m=n[12],v=n[13],g=n[14],y=n[15];return e[0].setComponents(o-r,u-s,f-h,y-m).normalize(),e[1].setComponents(o+r,u+s,f+h,y+m).normalize(),e[2].setComponents(o+i,u+c,f+d,y+v).normalize(),e[3].setComponents(o-i,u-c,f-d,y-v).normalize(),e[4].setComponents(o-a,u-l,f-p,y-g).normalize(),e[5].setComponents(o+a,u+l,f+p,y+g).normalize(),this},e.intersectsObject=function(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Ou.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Ou)},e.intersectsSprite=function(t){return Ou.center.set(0,0,0),Ou.radius=.7071067811865476,Ou.applyMatrix4(t.matrixWorld),this.intersectsSphere(Ou)},e.intersectsSphere=function(t){for(var e=this.planes,n=t.center,r=-t.radius,i=0;i<6;i++){if(e[i].distanceToPoint(n)<r)return!1}return!0},e.intersectsBox=function(t){for(var e=this.planes,n=0;n<6;n++){var r=e[n];if(Iu.x=r.normal.x>0?t.max.x:t.min.x,Iu.y=r.normal.y>0?t.max.y:t.min.y,Iu.z=r.normal.z>0?t.max.z:t.min.z,r.distanceToPoint(Iu)<0)return!1}return!0},e.containsPoint=function(t){for(var e=this.planes,n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0},t}(),Nu=function(t){function e(e,n,r,i){var a;void 0===e&&(e=1),void 0===n&&(n=1),void 0===r&&(r=1),void 0===i&&(i=1),a=t.call(this)||this,a.type="PlaneGeometry",a.parameters={width:e,height:n,widthSegments:r,heightSegments:i};for(var o=e/2,s=n/2,c=Math.floor(r),l=Math.floor(i),u=c+1,h=l+1,d=e/c,p=n/l,f=[],m=[],v=[],g=[],y=0;y<h;y++)for(var x=y*p-s,_=0;_<u;_++){var b=_*d-o;m.push(b,-x,0),v.push(0,0,1),g.push(_/c),g.push(1-y/l)}for(var w=0;w<l;w++)for(var M=0;M<c;M++){var S=M+u*w,T=M+u*(w+1),E=M+1+u*(w+1),A=M+1+u*w;f.push(S,T,A),f.push(T,E,A)}return a.setIndex(f),a.setAttribute("position",new R(m,3)),a.setAttribute("normal",new R(v,3)),a.setAttribute("uv",new R(g,2)),a}return a(e,t),e}(I),Bu={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor.xyz *= color.xyz;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",
  136. cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x += texelSize;\n\t\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.y += texelSize;\n\t\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x -= texelSize;\n\t\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn 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 );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tfogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat specularRoughness;\n\tvec3 specularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3(\t\t0, 1,\t\t0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid 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) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",
  137. lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\t\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\t\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N = normalize( surf_norm );\n\t\tmat3 tsn = mat3( S, T, N );\n\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t\tf.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t\tf.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3(\t1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108,\t1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605,\t1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmissionmap_fragment:"#ifdef USE_TRANSMISSIONMAP\n\ttotalTransmission *= texture2D( transmissionMap, vUv ).r;\n#endif",transmissionmap_pars_fragment:"#ifdef USE_TRANSMISSIONMAP\n\tuniform sampler2D transmissionMap;\n#endif",
  138. uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",cube_frag:"#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSMISSION\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSMISSION\n\tuniform float transmission;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <transmissionmap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#ifdef TRANSMISSION\n\t\tfloat totalTransmission = transmission;\n\t#endif\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <transmissionmap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#ifdef TRANSMISSION\n\t\tdiffuseColor.a *= mix( saturate( 1. - totalTransmission + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) ), 1.0, metalness );\n\t#endif\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",
  139. sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}"},zu={common:{diffuse:{value:new Zl(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new Ec},uv2Transform:{value:new Ec},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},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 Tc(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 Zl(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 Zl(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Ec}},sprite:{diffuse:{value:new Zl(15658734)},opacity:{value:1},center:{value:new Tc(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Ec}}},Fu={basic:{uniforms:F([zu.common,zu.specularmap,zu.envmap,zu.aomap,zu.lightmap,zu.fog]),vertexShader:Bu.meshbasic_vert,fragmentShader:Bu.meshbasic_frag},lambert:{uniforms:F([zu.common,zu.specularmap,zu.envmap,zu.aomap,zu.lightmap,zu.emissivemap,zu.fog,zu.lights,{emissive:{value:new Zl(0)}}]),vertexShader:Bu.meshlambert_vert,fragmentShader:Bu.meshlambert_frag},phong:{uniforms:F([zu.common,zu.specularmap,zu.envmap,zu.aomap,zu.lightmap,zu.emissivemap,zu.bumpmap,zu.normalmap,zu.displacementmap,zu.fog,zu.lights,{emissive:{value:new Zl(0)},specular:{value:new Zl(1118481)},shininess:{value:30}}]),vertexShader:Bu.meshphong_vert,fragmentShader:Bu.meshphong_frag},standard:{uniforms:F([zu.common,zu.envmap,zu.aomap,zu.lightmap,zu.emissivemap,zu.bumpmap,zu.normalmap,zu.displacementmap,zu.roughnessmap,zu.metalnessmap,zu.fog,zu.lights,{emissive:{value:new Zl(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Bu.meshphysical_vert,fragmentShader:Bu.meshphysical_frag},toon:{uniforms:F([zu.common,zu.aomap,zu.lightmap,zu.emissivemap,zu.bumpmap,zu.normalmap,zu.displacementmap,zu.gradientmap,zu.fog,zu.lights,{emissive:{value:new Zl(0)}}]),vertexShader:Bu.meshtoon_vert,fragmentShader:Bu.meshtoon_frag},matcap:{uniforms:F([zu.common,zu.bumpmap,zu.normalmap,zu.displacementmap,zu.fog,{matcap:{value:null}}]),vertexShader:Bu.meshmatcap_vert,fragmentShader:Bu.meshmatcap_frag},points:{uniforms:F([zu.points,zu.fog]),vertexShader:Bu.points_vert,fragmentShader:Bu.points_frag},dashed:{uniforms:F([zu.common,zu.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Bu.linedashed_vert,fragmentShader:Bu.linedashed_frag},depth:{uniforms:F([zu.common,zu.displacementmap]),vertexShader:Bu.depth_vert,fragmentShader:Bu.depth_frag},normal:{uniforms:F([zu.common,zu.bumpmap,zu.normalmap,zu.displacementmap,{opacity:{value:1}}]),vertexShader:Bu.normal_vert,fragmentShader:Bu.normal_frag},sprite:{uniforms:F([zu.sprite,zu.fog]),vertexShader:Bu.sprite_vert,fragmentShader:Bu.sprite_frag},background:{uniforms:{uvTransform:{value:new Ec},t2D:{value:null}},vertexShader:Bu.background_vert,fragmentShader:Bu.background_frag},cube:{uniforms:F([zu.envmap,{opacity:{value:1}}]),vertexShader:Bu.cube_vert,fragmentShader:Bu.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Bu.equirect_vert,fragmentShader:Bu.equirect_frag},distanceRGBA:{uniforms:F([zu.common,zu.displacementmap,{referencePosition:{value:new Ic},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Bu.distanceRGBA_vert,fragmentShader:Bu.distanceRGBA_frag},shadow:{uniforms:F([zu.lights,zu.fog,{color:{value:new Zl(0)},opacity:{value:1}}]),vertexShader:Bu.shadow_vert,fragmentShader:Bu.shadow_frag}};Fu.physical={uniforms:F([Fu.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Tc(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new Zl(0)},transmission:{value:0},transmissionMap:{value:null}}]),vertexShader:Bu.meshphysical_vert,fragmentShader:Bu.meshphysical_frag},st.prototype=Object.create(h.prototype),st.prototype.constructor=st,st.prototype.isDataTexture2DArray=!0,ct.prototype=Object.create(h.prototype),ct.prototype.constructor=ct,ct.prototype.isDataTexture3D=!0;var Hu=new h,Gu=new st,Uu=new ct,ku=new V,Vu=[],Wu=[],ju=new Float32Array(16),qu=new Float32Array(9),Xu=new Float32Array(4);jt.prototype.updateCache=function(t){var e=this.cache;t instanceof Float32Array&&e.length!==t.length&&(this.cache=new Float32Array(t.length)),ht(e,t)},qt.prototype.setValue=function(t,e,n){for(var r=this.seq,i=0,a=r.length;i!==a;++i){var o=r[i];o.setValue(t,e[o.id],n)}};var Yu=/(\w+)(\])?(\[|\.)?/g;Zt.prototype.setValue=function(t,e,n,r){var i=this.map[e];void 0!==i&&i.setValue(t,n,r)},Zt.prototype.setOptional=function(t,e,n){var r=e[n];void 0!==r&&this.setValue(t,n,r)},Zt.upload=function(t,e,n,r){for(var i=0,a=e.length;i!==a;++i){var o=e[i],s=n[o.id];!1!==s.needsUpdate&&o.setValue(t,s.value,r)}},Zt.seqWithValue=function(t,e){for(var n=[],r=0,i=t.length;r!==i;++r){var a=t[r];a.id in e&&n.push(a)}return n};var Zu=0,Ju=/^[ \t]*#include +<([\w\d.\/]+)>/gm,Qu=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Ku=/#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,$u=0;Oe.prototype=Object.create(y.prototype),Oe.prototype.constructor=Oe,Oe.prototype.isMeshDepthMaterial=!0,Oe.prototype.copy=function(t){return y.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},Ie.prototype=Object.create(y.prototype),Ie.prototype.constructor=Ie,Ie.prototype.isMeshDistanceMaterial=!0,Ie.prototype.copy=function(t){return y.prototype.copy.call(this,t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this};var th="uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n\tfor ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean * HALF_SAMPLE_RATE;\n\tsquared_mean = squared_mean * HALF_SAMPLE_RATE;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}",eh="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}";Fe.prototype=Object.assign(Object.create(f.prototype),{constructor:Fe,isGroup:!0}),He.prototype=Object.assign(Object.create(U.prototype),{constructor:He,isArrayCamera:!0});var nh=new Ic,rh=new Ic;Object.assign(Ue.prototype,u.prototype),Object.assign(ke.prototype,{constructor:ke,getHandSpace:function(){return null===this._hand&&(this._hand=new Fe,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},getTargetRaySpace:function(){return null===this._targetRay&&(this._targetRay=new Fe,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return null===this._grip&&(this._grip=new Fe,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this},disconnect:function(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this},update:function(t,e,n){var r=null,i=null,a=null,o=this._targetRay,s=this._grip,c=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(c&&t.hand){a=!0;for(var u,h=l(t.hand.values());!(u=h()).done;){var d=u.value,p=e.getJointPose(d,n);if(void 0===c.joints[d.jointName]){var f=new Fe;f.matrixAutoUpdate=!1,f.visible=!1,c.joints[d.jointName]=f,c.add(f)}var m=c.joints[d.jointName];null!==p&&(m.matrix.fromArray(p.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.jointRadius=p.radius),m.visible=null!==p}var v=c.joints["index-finger-tip"],g=c.joints["thumb-tip"],y=v.position.distanceTo(g.position);c.inputState.pinching&&y>.025?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!c.inputState.pinching&&y<=.015&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&null!==(r=e.getPose(t.targetRaySpace,n))&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale)),null!==s&&t.gripSpace&&null!==(i=e.getPose(t.gripSpace,n))&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale));return null!==o&&(o.visible=null!==r),null!==s&&(s.visible=null!==i),null!==c&&(c.visible=null!==a),this}}),Object.assign(Ve.prototype,u.prototype),Xe.prototype=Object.assign(Object.create(qe.prototype),{constructor:Xe,isWebGL1Renderer:!0});var ih=function(){function t(t,e){Object.defineProperty(this,"isFogExp2",{value:!0}),this.name="",this.color=new Zl(t),this.density=void 0!==e?e:25e-5}var e=t.prototype;return e.clone=function(){return new t(this.color,this.density)},e.toJSON=function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}},t}(),ah=function(){function t(t,e,n){Object.defineProperty(this,"isFog",{value:!0}),this.name="",this.color=new Zl(t),this.near=void 0!==e?e:1,this.far=void 0!==n?n:1e3}var e=t.prototype;return e.clone=function(){return new t(this.color,this.near,this.far)},e.toJSON=function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}},t}(),oh=function(t){function e(){var e;return e=t.call(this)||this,Object.defineProperty(o(e),"isScene",{value:!0}),e.type="Scene",e.background=null,e.environment=null,e.fog=null,e.overrideMaterial=null,e.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:o(e)})),e}a(e,t);var n=e.prototype;return n.copy=function(e,n){return t.prototype.copy.call(this,e,n),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},n.toJSON=function(e){var n=t.prototype.toJSON.call(this,e);return null!==this.background&&(n.object.background=this.background.toJSON(e)),null!==this.environment&&(n.object.environment=this.environment.toJSON(e)),null!==this.fog&&(n.object.fog=this.fog.toJSON()),n},e}(f);Object.defineProperty(Ye.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(Ye.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this},copyAt:function(t,e,n){t*=this.stride,n*=e.stride;for(var r=0,i=this.stride;r<i;r++)this.array[t+r]=e.array[n+r];return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},clone:function(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Sc.generateUUID()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);var e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),n=new Ye(e,this.stride);return n.setUsage(this.usage),n},onUpload:function(t){return this.onUploadCallback=t,this},toJSON:function(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Sc.generateUUID()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.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}}});var sh=new Ic;Object.defineProperties(Ze.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}},needsUpdate:{set:function(t){this.data.needsUpdate=t}}}),Object.assign(Ze.prototype,{isInterleavedBufferAttribute:!0,applyMatrix4:function(t){for(var e=0,n=this.data.count;e<n;e++)sh.x=this.getX(e),sh.y=this.getY(e),sh.z=this.getZ(e),sh.applyMatrix4(t),this.setXYZ(e,sh.x,sh.y,sh.z);return this},setX:function(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this},setY:function(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this},setZ:function(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this},setW:function(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this},getX:function(t){return this.data.array[t*this.data.stride+this.offset]},getY:function(t){return this.data.array[t*this.data.stride+this.offset+1]},getZ:function(t){return this.data.array[t*this.data.stride+this.offset+2]},getW:function(t){return this.data.array[t*this.data.stride+this.offset+3]},setXY:function(t,e,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this},setXYZ:function(t,e,n,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=r,this},setXYZW:function(t,e,n,r,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=r,this.data.array[t+3]=i,this},clone:function(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");for(var e=[],n=0;n<this.count;n++)for(var r=n*this.data.stride+this.offset,i=0;i<this.itemSize;i++)e.push(this.data.array[r+i]);return new _(new this.array.constructor(e),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new Ze(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)},toJSON:function(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");for(var e=[],n=0;n<this.count;n++)for(var r=n*this.data.stride+this.offset,i=0;i<this.itemSize;i++)e.push(this.data.array[r+i]);return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}),Je.prototype=Object.create(y.prototype),Je.prototype.constructor=Je,Je.prototype.isSpriteMaterial=!0,Je.prototype.copy=function(t){return y.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this};var ch,lh=new Ic,uh=new Ic,hh=new Ic,dh=new Tc,ph=new Tc,fh=new ol,mh=new Ic,vh=new Ic,gh=new Ic,yh=new Tc,xh=new Tc,_h=new Tc;Qe.prototype=Object.assign(Object.create(f.prototype),{constructor:Qe,isSprite:!0,raycast:function(t,e){null===t.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),uh.setFromMatrixScale(this.matrixWorld),fh.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),hh.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&uh.multiplyScalar(-hh.z);var n,r,i=this.material.rotation;0!==i&&(r=Math.cos(i),n=Math.sin(i));var a=this.center;Ke(mh.set(-.5,-.5,0),hh,a,uh,n,r),Ke(vh.set(.5,-.5,0),hh,a,uh,n,r),Ke(gh.set(.5,.5,0),hh,a,uh,n,r),yh.set(0,0),xh.set(1,0),_h.set(1,1);var o=t.ray.intersectTriangle(mh,vh,gh,!1,lh);if(null!==o||(Ke(vh.set(-.5,.5,0),hh,a,uh,n,r),xh.set(0,1),null!==(o=t.ray.intersectTriangle(mh,gh,vh,!1,lh)))){var s=t.ray.origin.distanceTo(lh);s<t.near||s>t.far||e.push({distance:s,point:lh.clone(),uv:jl.getUV(lh,mh,vh,gh,yh,xh,_h,new Tc),face:null,object:this})}},copy:function(t){return f.prototype.copy.call(this,t),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}});var bh=new Ic,wh=new Ic;$e.prototype=Object.assign(Object.create(f.prototype),{constructor:$e,isLOD:!0,copy:function(t){f.prototype.copy.call(this,t,!1);for(var e=t.levels,n=0,r=e.length;n<r;n++){var i=e[n];this.addLevel(i.object.clone(),i.distance)}return this.autoUpdate=t.autoUpdate,this},addLevel:function(t,e){void 0===e&&(e=0),e=Math.abs(e);var n,r=this.levels;for(n=0;n<r.length&&!(e<r[n].distance);n++);return r.splice(n,0,{distance:e,object:t}),this.add(t),this},getCurrentLevel:function(){return this._currentLevel},getObjectForDistance:function(t){var e=this.levels;if(e.length>0){var n,r;for(n=1,r=e.length;n<r&&!(t<e[n].distance);n++);return e[n-1].object}return null},raycast:function(t,e){if(this.levels.length>0){bh.setFromMatrixPosition(this.matrixWorld);var n=t.ray.origin.distanceTo(bh);this.getObjectForDistance(n).raycast(t,e)}},update:function(t){var e=this.levels;if(e.length>1){bh.setFromMatrixPosition(t.matrixWorld),wh.setFromMatrixPosition(this.matrixWorld);var n=bh.distanceTo(wh)/t.zoom;e[0].object.visible=!0;var r,i;for(r=1,i=e.length;r<i&&n>=e[r].distance;r++)e[r-1].object.visible=!1,e[r].object.visible=!0;for(this._currentLevel=r-1;r<i;r++)e[r].object.visible=!1}},toJSON:function(t){var e=f.prototype.toJSON.call(this,t);!1===this.autoUpdate&&(e.object.autoUpdate=!1),e.object.levels=[];for(var n=this.levels,r=0,i=n.length;r<i;r++){var a=n[r];e.object.levels.push({object:a.object.uuid,distance:a.distance})}return e}});var Mh=new Ic,Sh=new Rc,Th=new Rc,Eh=new Ic,Ah=new ol;tn.prototype=Object.assign(Object.create(D.prototype),{constructor:tn,isSkinnedMesh:!0,copy:function(t){return D.prototype.copy.call(this,t),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,this},bind:function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){for(var t=new Rc,e=this.geometry.attributes.skinWeight,n=0,r=e.count;n<r;n++){t.x=e.getX(n),t.y=e.getY(n),t.z=e.getZ(n),t.w=e.getW(n);var i=1/t.manhattanLength();i!==1/0?t.multiplyScalar(i):t.set(1,0,0,0),e.setXYZW(n,t.x,t.y,t.z,t.w)}},updateMatrixWorld:function(t){D.prototype.updateMatrixWorld.call(this,t),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},boneTransform:function(t,e){var n=this.skeleton,r=this.geometry;Sh.fromBufferAttribute(r.attributes.skinIndex,t),Th.fromBufferAttribute(r.attributes.skinWeight,t),Mh.fromBufferAttribute(r.attributes.position,t).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(var i=0;i<4;i++){var a=Th.getComponent(i);if(0!==a){var o=Sh.getComponent(i);Ah.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),e.addScaledVector(Eh.copy(Mh).applyMatrix4(Ah),a)}}return e.applyMatrix4(this.bindMatrixInverse)}}),en.prototype=Object.assign(Object.create(f.prototype),{constructor:en,isBone:!0});var Lh=new ol,Rh=new ol;Object.assign(nn.prototype,{init:function(){var t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),0===e.length)this.calculateInverses();else if(t.length!==e.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(var n=0,r=this.bones.length;n<r;n++)this.boneInverses.push(new ol)}},calculateInverses:function(){this.boneInverses.length=0;for(var t=0,e=this.bones.length;t<e;t++){var n=new ol;this.bones[t]&&n.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(n)}},pose:function(){for(var t=0,e=this.bones.length;t<e;t++){var n=this.bones[t];n&&n.matrixWorld.copy(this.boneInverses[t]).invert()}for(var r=0,i=this.bones.length;r<i;r++){var a=this.bones[r];a&&(a.parent&&a.parent.isBone?(a.matrix.copy(a.parent.matrixWorld).invert(),a.matrix.multiply(a.matrixWorld)):a.matrix.copy(a.matrixWorld),a.matrix.decompose(a.position,a.quaternion,a.scale))}},update:function(){for(var t=this.bones,e=this.boneInverses,n=this.boneMatrices,r=this.boneTexture,i=0,a=t.length;i<a;i++){var o=t[i]?t[i].matrixWorld:Rh;Lh.multiplyMatrices(o,e[i]),Lh.toArray(n,16*i)}null!==r&&(r.needsUpdate=!0)},clone:function(){return new nn(this.bones,this.boneInverses)},getBoneByName:function(t){for(var e=0,n=this.bones.length;e<n;e++){var r=this.bones[e];if(r.name===t)return r}},dispose:function(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)},fromJSON:function(t,e){this.uuid=t.uuid;for(var n=0,r=t.bones.length;n<r;n++){var i=t.bones[n],a=e[i];void 0===a&&(console.warn("THREE.Skeleton: No bone found with UUID:",i),a=new en),this.bones.push(a),this.boneInverses.push((new ol).fromArray(t.boneInverses[n]))}return this.init(),this},toJSON:function(){var t={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;for(var e=this.bones,n=this.boneInverses,r=0,i=e.length;r<i;r++){var a=e[r];t.bones.push(a.uuid);var o=n[r];t.boneInverses.push(o.toArray())}return t}});var Ch=new ol,Ph=new ol,Oh=[],Ih=new D;rn.prototype=Object.assign(Object.create(D.prototype),{constructor:rn,isInstancedMesh:!0,copy:function(t){return D.prototype.copy.call(this,t),this.instanceMatrix.copy(t.instanceMatrix),null!==t.instanceColor&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,this},getColorAt:function(t,e){e.fromArray(this.instanceColor.array,3*t)},getMatrixAt:function(t,e){e.fromArray(this.instanceMatrix.array,16*t)},raycast:function(t,e){var n=this.matrixWorld,r=this.count;if(Ih.geometry=this.geometry,Ih.material=this.material,void 0!==Ih.material)for(var i=0;i<r;i++){this.getMatrixAt(i,Ch),Ph.multiplyMatrices(n,Ch),Ih.matrixWorld=Ph,Ih.raycast(t,Oh);for(var a=0,o=Oh.length;a<o;a++){var s=Oh[a];s.instanceId=i,s.object=this,e.push(s)}Oh.length=0}},setColorAt:function(t,e){null===this.instanceColor&&(this.instanceColor=new _(new Float32Array(3*this.count),3)),e.toArray(this.instanceColor.array,3*t)},setMatrixAt:function(t,e){e.toArray(this.instanceMatrix.array,16*t)},updateMorphTargets:function(){},dispose:function(){this.dispatchEvent({type:"dispose"})}}),an.prototype=Object.create(y.prototype),an.prototype.constructor=an,an.prototype.isLineBasicMaterial=!0,an.prototype.copy=function(t){return y.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.morphTargets=t.morphTargets,this};var Dh=new Ic,Nh=new Ic,Bh=new ol,zh=new al,Fh=new Qc;on.prototype=Object.assign(Object.create(f.prototype),{constructor:on,isLine:!0,copy:function(t){return f.prototype.copy.call(this,t),this.material=t.material,this.geometry=t.geometry,this},computeLineDistances:function(){var t=this.geometry;if(t.isBufferGeometry)if(null===t.index){for(var e=t.attributes.position,n=[0],r=1,i=e.count;r<i;r++)Dh.fromBufferAttribute(e,r-1),Nh.fromBufferAttribute(e,r),n[r]=n[r-1],n[r]+=Dh.distanceTo(Nh);t.setAttribute("lineDistance",new R(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this},raycast:function(t,e){var n=this.geometry,r=this.matrixWorld,i=t.params.Line.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),Fh.copy(n.boundingSphere),Fh.applyMatrix4(r),Fh.radius+=i,!1!==t.ray.intersectsSphere(Fh)){Bh.copy(r).invert(),zh.copy(t.ray).applyMatrix4(Bh);var a=i/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,s=new Ic,c=new Ic,l=new Ic,u=new Ic,h=this.isLineSegments?2:1;if(n.isBufferGeometry){var d=n.index,p=n.attributes,f=p.position;if(null!==d)for(var m=d.array,v=0,g=m.length-1;v<g;v+=h){var y=m[v],x=m[v+1];s.fromBufferAttribute(f,y),c.fromBufferAttribute(f,x);var _=zh.distanceSqToSegment(s,c,u,l);if(!(_>o)){u.applyMatrix4(this.matrixWorld);var b=t.ray.origin.distanceTo(u);b<t.near||b>t.far||e.push({distance:b,point:l.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}else for(var w=0,M=f.count-1;w<M;w+=h){s.fromBufferAttribute(f,w),c.fromBufferAttribute(f,w+1);var S=zh.distanceSqToSegment(s,c,u,l);if(!(S>o)){u.applyMatrix4(this.matrixWorld);var T=t.ray.origin.distanceTo(u);T<t.near||T>t.far||e.push({distance:T,point:l.clone().applyMatrix4(this.matrixWorld),index:w,face:null,faceIndex:null,object:this})}}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},updateMorphTargets:function(){var t=this.geometry;if(t.isBufferGeometry){var e=t.morphAttributes,n=Object.keys(e);if(n.length>0){var r=e[n[0]];if(void 0!==r){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,a=r.length;i<a;i++){var o=r[i].name||String(i);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=i}}}}else{var s=t.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}});var Hh=new Ic,Gh=new Ic;sn.prototype=Object.assign(Object.create(on.prototype),{constructor:sn,isLineSegments:!0,computeLineDistances:function(){var t=this.geometry;if(t.isBufferGeometry)if(null===t.index){for(var e=t.attributes.position,n=[],r=0,i=e.count;r<i;r+=2)Hh.fromBufferAttribute(e,r),Gh.fromBufferAttribute(e,r+1),n[r]=0===r?0:n[r-1],n[r+1]=n[r]+Hh.distanceTo(Gh);t.setAttribute("lineDistance",new R(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}),cn.prototype=Object.assign(Object.create(on.prototype),{constructor:cn,isLineLoop:!0}),ln.prototype=Object.create(y.prototype),ln.prototype.constructor=ln,ln.prototype.isPointsMaterial=!0,ln.prototype.copy=function(t){return y.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.morphTargets=t.morphTargets,this};var Uh=new ol,kh=new al,Vh=new Qc,Wh=new Ic;un.prototype=Object.assign(Object.create(f.prototype),{constructor:un,isPoints:!0,copy:function(t){return f.prototype.copy.call(this,t),this.material=t.material,this.geometry=t.geometry,this},raycast:function(t,e){var n=this.geometry,r=this.matrixWorld,i=t.params.Points.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),Vh.copy(n.boundingSphere),Vh.applyMatrix4(r),Vh.radius+=i,!1!==t.ray.intersectsSphere(Vh)){Uh.copy(r).invert(),kh.copy(t.ray).applyMatrix4(Uh);var a=i/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a;if(n.isBufferGeometry){var s=n.index,c=n.attributes,l=c.position;if(null!==s)for(var u=s.array,h=0,d=u.length;h<d;h++){var p=u[h];Wh.fromBufferAttribute(l,p),hn(Wh,p,o,r,t,e,this)}else for(var f=0,m=l.count;f<m;f++)Wh.fromBufferAttribute(l,f),hn(Wh,f,o,r,t,e,this)}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},updateMorphTargets:function(){var t=this.geometry;if(t.isBufferGeometry){var e=t.morphAttributes,n=Object.keys(e);if(n.length>0){var r=e[n[0]];if(void 0!==r){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,a=r.length;i<a;i++){var o=r[i].name||String(i);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=i}}}}else{var s=t.morphTargets
  140. ;void 0!==s&&s.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}),dn.prototype=Object.assign(Object.create(h.prototype),{constructor:dn,clone:function(){return new this.constructor(this.image).copy(this)},isVideoTexture:!0,update:function(){var t=this.image;!1=="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),pn.prototype=Object.create(h.prototype),pn.prototype.constructor=pn,pn.prototype.isCompressedTexture=!0,fn.prototype=Object.create(h.prototype),fn.prototype.constructor=fn,fn.prototype.isCanvasTexture=!0,mn.prototype=Object.create(h.prototype),mn.prototype.constructor=mn,mn.prototype.isDepthTexture=!0;var jh=function(t){function e(e,n,r,i){var a;void 0===e&&(e=1),void 0===n&&(n=8),void 0===r&&(r=0),void 0===i&&(i=2*Math.PI),a=t.call(this)||this,a.type="CircleGeometry",a.parameters={radius:e,segments:n,thetaStart:r,thetaLength:i},n=Math.max(3,n);var o=[],s=[],c=[],l=[],u=new Ic,h=new Tc;s.push(0,0,0),c.push(0,0,1),l.push(.5,.5);for(var d=0,p=3;d<=n;d++,p+=3){var f=r+d/n*i;u.x=e*Math.cos(f),u.y=e*Math.sin(f),s.push(u.x,u.y,u.z),c.push(0,0,1),h.x=(s[p]/e+1)/2,h.y=(s[p+1]/e+1)/2,l.push(h.x,h.y)}for(var m=1;m<=n;m++)o.push(m,m+1,0);return a.setIndex(o),a.setAttribute("position",new R(s,3)),a.setAttribute("normal",new R(c,3)),a.setAttribute("uv",new R(l,2)),a}return a(e,t),e}(I),qh=function(t){function e(e,n,r,i,a,s,c,l){function u(t){for(var r=g,a=new Tc,o=new Ic,s=0,u=!0===t?e:n,h=!0===t?1:-1,y=1;y<=i;y++)f.push(0,x*h,0),m.push(0,h,0),v.push(.5,.5),g++;for(var b=g,w=0;w<=i;w++){var M=w/i,S=M*l+c,T=Math.cos(S),E=Math.sin(S);o.x=u*E,o.y=x*h,o.z=u*T,f.push(o.x,o.y,o.z),m.push(0,h,0),a.x=.5*T+.5,a.y=.5*E*h+.5,v.push(a.x,a.y),g++}for(var A=0;A<i;A++){var L=r+A,R=b+A;!0===t?p.push(R,R+1,L):p.push(R+1,R,L),s+=3}d.addGroup(_,s,!0===t?1:2),_+=s}var h;void 0===e&&(e=1),void 0===n&&(n=1),void 0===r&&(r=1),void 0===i&&(i=8),void 0===a&&(a=1),void 0===s&&(s=!1),void 0===c&&(c=0),void 0===l&&(l=2*Math.PI),h=t.call(this)||this,h.type="CylinderGeometry",h.parameters={radiusTop:e,radiusBottom:n,height:r,radialSegments:i,heightSegments:a,openEnded:s,thetaStart:c,thetaLength:l};var d=o(h);i=Math.floor(i),a=Math.floor(a);var p=[],f=[],m=[],v=[],g=0,y=[],x=r/2,_=0;return function(){for(var t=new Ic,o=new Ic,s=0,u=(n-e)/r,h=0;h<=a;h++){for(var b=[],w=h/a,M=w*(n-e)+e,S=0;S<=i;S++){var T=S/i,E=T*l+c,A=Math.sin(E),L=Math.cos(E);o.x=M*A,o.y=-w*r+x,o.z=M*L,f.push(o.x,o.y,o.z),t.set(A,u,L).normalize(),m.push(t.x,t.y,t.z),v.push(T,1-w),b.push(g++)}y.push(b)}for(var R=0;R<i;R++)for(var C=0;C<a;C++){var P=y[C][R],O=y[C+1][R],I=y[C+1][R+1],D=y[C][R+1];p.push(P,O,D),p.push(O,I,D),s+=6}d.addGroup(_,s,0),_+=s}(),!1===s&&(e>0&&u(!0),n>0&&u(!1)),h.setIndex(p),h.setAttribute("position",new R(f,3)),h.setAttribute("normal",new R(m,3)),h.setAttribute("uv",new R(v,2)),h}return a(e,t),e}(I),Xh=function(t){function e(e,n,r,i,a,o,s){var c;return void 0===e&&(e=1),void 0===n&&(n=1),void 0===r&&(r=8),void 0===i&&(i=1),void 0===a&&(a=!1),void 0===o&&(o=0),void 0===s&&(s=2*Math.PI),c=t.call(this,0,e,n,r,i,a,o,s)||this,c.type="ConeGeometry",c.parameters={radius:e,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s},c}return a(e,t),e}(qh),Yh=function(t){function e(e,n,r,i){function a(t,e,n,r){for(var i=r+1,a=[],o=0;o<=i;o++){a[o]=[];for(var c=t.clone().lerp(n,o/i),l=e.clone().lerp(n,o/i),u=i-o,h=0;h<=u;h++)a[o][h]=0===h&&o===i?c:c.clone().lerp(l,h/u)}for(var d=0;d<i;d++)for(var p=0;p<2*(i-d)-1;p++){var f=Math.floor(p/2);p%2==0?(s(a[d][f+1]),s(a[d+1][f]),s(a[d][f])):(s(a[d][f+1]),s(a[d+1][f+1]),s(a[d+1][f]))}}function o(){for(var t=0;t<m.length;t+=6){var e=m[t+0],n=m[t+2],r=m[t+4],i=Math.max(e,n,r),a=Math.min(e,n,r);i>.9&&a<.1&&(e<.2&&(m[t+0]+=1),n<.2&&(m[t+2]+=1),r<.2&&(m[t+4]+=1))}}function s(t){f.push(t.x,t.y,t.z)}function c(t,n){var r=3*t;n.x=e[r+0],n.y=e[r+1],n.z=e[r+2]}function l(){for(var t=new Ic,e=new Ic,n=new Ic,r=new Ic,i=new Tc,a=new Tc,o=new Tc,s=0,c=0;s<f.length;s+=9,c+=6){t.set(f[s+0],f[s+1],f[s+2]),e.set(f[s+3],f[s+4],f[s+5]),n.set(f[s+6],f[s+7],f[s+8]),i.set(m[c+0],m[c+1]),a.set(m[c+2],m[c+3]),o.set(m[c+4],m[c+5]),r.copy(t).add(e).add(n).divideScalar(3);var l=h(r);u(i,c+0,t,l),u(a,c+2,e,l),u(o,c+4,n,l)}}function u(t,e,n,r){r<0&&1===t.x&&(m[e]=t.x-1),0===n.x&&0===n.z&&(m[e]=r/2/Math.PI+.5)}function h(t){return Math.atan2(t.z,-t.x)}function d(t){return Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))}var p;void 0===r&&(r=1),void 0===i&&(i=0),p=t.call(this)||this,p.type="PolyhedronGeometry",p.parameters={vertices:e,indices:n,radius:r,detail:i};var f=[],m=[];return function(t){for(var e=new Ic,r=new Ic,i=new Ic,o=0;o<n.length;o+=3)c(n[o+0],e),c(n[o+1],r),c(n[o+2],i),a(e,r,i,t)}(i),function(t){for(var e=new Ic,n=0;n<f.length;n+=3)e.x=f[n+0],e.y=f[n+1],e.z=f[n+2],e.normalize().multiplyScalar(t),f[n+0]=e.x,f[n+1]=e.y,f[n+2]=e.z}(r),function(){for(var t=new Ic,e=0;e<f.length;e+=3){t.x=f[e+0],t.y=f[e+1],t.z=f[e+2];var n=h(t)/2/Math.PI+.5,r=d(t)/Math.PI+.5;m.push(n,1-r)}l(),o()}(),p.setAttribute("position",new R(f,3)),p.setAttribute("normal",new R(f.slice(),3)),p.setAttribute("uv",new R(m,2)),0===i?p.computeVertexNormals():p.normalizeNormals(),p}return a(e,t),e}(I),Zh=function(t){function e(e,n){var r;void 0===e&&(e=1),void 0===n&&(n=0);var i=(1+Math.sqrt(5))/2,a=1/i,o=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-a,-i,0,-a,i,0,a,-i,0,a,i,-a,-i,0,-a,i,0,a,-i,0,a,i,0,-i,0,-a,i,0,-a,-i,0,a,i,0,a],s=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];return r=t.call(this,o,s,e,n)||this,r.type="DodecahedronGeometry",r.parameters={radius:e,detail:n},r}return a(e,t),e}(Yh),Jh=new Ic,Qh=new Ic,Kh=new Ic,$h=new jl,td=function(t){function e(e,n){var r;if(r=t.call(this)||this,r.type="EdgesGeometry",r.parameters={thresholdAngle:n},n=void 0!==n?n:1,!0===e.isGeometry)return console.error("THREE.EdgesGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),o(r);for(var i=Math.pow(10,4),a=Math.cos(Sc.DEG2RAD*n),s=e.getIndex(),c=e.getAttribute("position"),l=s?s.count:c.count,u=[0,0,0],h=["a","b","c"],d=new Array(3),p={},f=[],m=0;m<l;m+=3){s?(u[0]=s.getX(m),u[1]=s.getX(m+1),u[2]=s.getX(m+2)):(u[0]=m,u[1]=m+1,u[2]=m+2);var v=$h.a,g=$h.b,y=$h.c;if(v.fromBufferAttribute(c,u[0]),g.fromBufferAttribute(c,u[1]),y.fromBufferAttribute(c,u[2]),$h.getNormal(Kh),d[0]=Math.round(v.x*i)+","+Math.round(v.y*i)+","+Math.round(v.z*i),d[1]=Math.round(g.x*i)+","+Math.round(g.y*i)+","+Math.round(g.z*i),d[2]=Math.round(y.x*i)+","+Math.round(y.y*i)+","+Math.round(y.z*i),d[0]!==d[1]&&d[1]!==d[2]&&d[2]!==d[0])for(var x=0;x<3;x++){var _=(x+1)%3,b=d[x],w=d[_],M=$h[h[x]],S=$h[h[_]],T=b+"_"+w,E=w+"_"+b;E in p&&p[E]?(Kh.dot(p[E].normal)<=a&&(f.push(M.x,M.y,M.z),f.push(S.x,S.y,S.z)),p[E]=null):T in p||(p[T]={index0:u[x],index1:u[_],normal:Kh.clone()})}}for(var A in p)if(p[A]){var L=p[A],C=L.index0,P=L.index1;Jh.fromBufferAttribute(c,C),Qh.fromBufferAttribute(c,P),f.push(Jh.x,Jh.y,Jh.z),f.push(Qh.x,Qh.y,Qh.z)}return r.setAttribute("position",new R(f,3)),r}return a(e,t),e}(I),ed={triangulate:function(t,e,n){n=n||2;var r=e&&e.length,i=r?e[0]*n:t.length,a=vn(t,0,i,n,!0),o=[];if(!a||a.next===a.prev)return o;var s,c,l,u,h,d,p;if(r&&(a=Mn(t,e,a,n)),t.length>80*n){s=l=t[0],c=u=t[1];for(var f=n;f<i;f+=n)h=t[f],d=t[f+1],h<s&&(s=h),d<c&&(c=d),h>l&&(l=h),d>u&&(u=d);p=Math.max(l-s,u-c),p=0!==p?1/p:0}return yn(a,o,n,s,c,p),o}},nd={area:function(t){for(var e=t.length,n=0,r=e-1,i=0;i<e;r=i++)n+=t[r].x*t[i].y-t[i].x*t[r].y;return.5*n},isClockWise:function(t){return nd.area(t)<0},triangulateShape:function(t,e){var n=[],r=[],i=[];Xn(t),Yn(n,t);var a=t.length;e.forEach(Xn);for(var o=0;o<e.length;o++)r.push(a),a+=e[o].length,Yn(n,e[o]);for(var s=ed.triangulate(n,r),c=0;c<s.length;c+=3)i.push(s.slice(c,c+3));return i}},rd=function(t){function e(e,n){var r;r=t.call(this)||this,r.type="ExtrudeGeometry",r.parameters={shapes:e,options:n},e=Array.isArray(e)?e:[e];for(var i=o(r),a=[],s=[],c=0,l=e.length;c<l;c++){var u=e[c];!function(t){function e(t,e,n){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(n).add(t)}function r(t,e,n){var r,i,a,o=t.x-e.x,s=t.y-e.y,c=n.x-t.x,l=n.y-t.y,u=o*o+s*s,h=o*l-s*c;if(Math.abs(h)>Number.EPSILON){var d=Math.sqrt(u),p=Math.sqrt(c*c+l*l),f=e.x-s/d,m=e.y+o/d,v=n.x-l/p,g=n.y+c/p,y=((v-f)*l-(g-m)*c)/(o*l-s*c);r=f+o*y-t.x,i=m+s*y-t.y;var x=r*r+i*i;if(x<=2)return new Tc(r,i);a=Math.sqrt(x/2)}else{var _=!1;o>Number.EPSILON?c>Number.EPSILON&&(_=!0):o<-Number.EPSILON?c<-Number.EPSILON&&(_=!0):Math.sign(s)===Math.sign(l)&&(_=!0),_?(r=-s,i=o,a=Math.sqrt(u)):(r=o,i=s,a=Math.sqrt(u/2))}return new Tc(r/a,i/a)}function o(t,e){for(var n=t.length;--n>=0;){var r=n,i=n-1;i<0&&(i=t.length-1);for(var a=0,o=m+2*b;a<o;a++){var s=U*a,c=U*(a+1);u(e+r+s,e+i+s,e+i+c,e+r+c)}}}function c(t,e,n){p.push(t),p.push(e),p.push(n)}function l(t,e,n){h(t),h(e),h(n);var r=a.length/3,o=M.generateTopUV(i,a,r-3,r-2,r-1);d(o[0]),d(o[1]),d(o[2])}function u(t,e,n,r){h(t),h(e),h(r),h(e),h(n),h(r);var o=a.length/3,s=M.generateSideWallUV(i,a,o-6,o-3,o-2,o-1);d(s[0]),d(s[1]),d(s[3]),d(s[1]),d(s[2]),d(s[3])}function h(t){a.push(p[3*t+0]),a.push(p[3*t+1]),a.push(p[3*t+2])}function d(t){s.push(t.x),s.push(t.y)}var p=[],f=void 0!==n.curveSegments?n.curveSegments:12,m=void 0!==n.steps?n.steps:1,v=void 0!==n.depth?n.depth:100,g=void 0===n.bevelEnabled||n.bevelEnabled,y=void 0!==n.bevelThickness?n.bevelThickness:6,x=void 0!==n.bevelSize?n.bevelSize:y-2,_=void 0!==n.bevelOffset?n.bevelOffset:0,b=void 0!==n.bevelSegments?n.bevelSegments:3,w=n.extrudePath,M=void 0!==n.UVGenerator?n.UVGenerator:id;void 0!==n.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),v=n.amount);var S,T,E,A,L,R=!1;w&&(S=w.getSpacedPoints(m),R=!0,g=!1,T=w.computeFrenetFrames(m,!1),E=new Ic,A=new Ic,L=new Ic),g||(b=0,y=0,x=0,_=0);var C=t.extractPoints(f),P=C.shape,O=C.holes;if(!nd.isClockWise(P)){P=P.reverse();for(var I=0,D=O.length;I<D;I++){var N=O[I];nd.isClockWise(N)&&(O[I]=N.reverse())}}for(var B=nd.triangulateShape(P,O),z=P,F=0,H=O.length;F<H;F++){var G=O[F];P=P.concat(G)}for(var U=P.length,k=B.length,V=[],W=0,j=z.length,q=j-1,X=W+1;W<j;W++,q++,X++)q===j&&(q=0),X===j&&(X=0),V[W]=r(z[W],z[q],z[X]);for(var Y,Z=[],J=V.concat(),Q=0,K=O.length;Q<K;Q++){var $=O[Q];Y=[];for(var tt=0,et=$.length,nt=et-1,rt=tt+1;tt<et;tt++,nt++,rt++)nt===et&&(nt=0),rt===et&&(rt=0),Y[tt]=r($[tt],$[nt],$[rt]);Z.push(Y),J=J.concat(Y)}for(var it=0;it<b;it++){for(var at=it/b,ot=y*Math.cos(at*Math.PI/2),st=x*Math.sin(at*Math.PI/2)+_,ct=0,lt=z.length;ct<lt;ct++){var ut=e(z[ct],V[ct],st);c(ut.x,ut.y,-ot)}for(var ht=0,dt=O.length;ht<dt;ht++){var pt=O[ht];Y=Z[ht];for(var ft=0,mt=pt.length;ft<mt;ft++){var vt=e(pt[ft],Y[ft],st);c(vt.x,vt.y,-ot)}}}for(var gt=x+_,yt=0;yt<U;yt++){var xt=g?e(P[yt],J[yt],gt):P[yt];R?(A.copy(T.normals[0]).multiplyScalar(xt.x),E.copy(T.binormals[0]).multiplyScalar(xt.y),L.copy(S[0]).add(A).add(E),c(L.x,L.y,L.z)):c(xt.x,xt.y,0)}for(var _t=1;_t<=m;_t++)for(var bt=0;bt<U;bt++){var wt=g?e(P[bt],J[bt],gt):P[bt];R?(A.copy(T.normals[_t]).multiplyScalar(wt.x),E.copy(T.binormals[_t]).multiplyScalar(wt.y),L.copy(S[_t]).add(A).add(E),c(L.x,L.y,L.z)):c(wt.x,wt.y,v/m*_t)}for(var Mt=b-1;Mt>=0;Mt--){for(var St=Mt/b,Tt=y*Math.cos(St*Math.PI/2),Et=x*Math.sin(St*Math.PI/2)+_,At=0,Lt=z.length;At<Lt;At++){var Rt=e(z[At],V[At],Et);c(Rt.x,Rt.y,v+Tt)}for(var Ct=0,Pt=O.length;Ct<Pt;Ct++){var Ot=O[Ct];Y=Z[Ct];for(var It=0,Dt=Ot.length;It<Dt;It++){var Nt=e(Ot[It],Y[It],Et);R?c(Nt.x,Nt.y+S[m-1].y,S[m-1].x+Tt):c(Nt.x,Nt.y,v+Tt)}}}!function(){var t=a.length/3;if(g){for(var e=0,n=U*e,r=0;r<k;r++){var o=B[r];l(o[2]+n,o[1]+n,o[0]+n)}e=m+2*b,n=U*e;for(var s=0;s<k;s++){var c=B[s];l(c[0]+n,c[1]+n,c[2]+n)}}else{for(var u=0;u<k;u++){var h=B[u];l(h[2],h[1],h[0])}for(var d=0;d<k;d++){var p=B[d];l(p[0]+U*m,p[1]+U*m,p[2]+U*m)}}i.addGroup(t,a.length/3-t,0)}(),function(){var t=a.length/3,e=0;o(z,e),e+=z.length;for(var n=0,r=O.length;n<r;n++){var s=O[n];o(s,e),e+=s.length}i.addGroup(t,a.length/3-t,1)}()}(u)}return r.setAttribute("position",new R(a,3)),r.setAttribute("uv",new R(s,2)),r.computeVertexNormals(),r}return a(e,t),e.prototype.toJSON=function(){var t=I.prototype.toJSON.call(this);return Zn(this.parameters.shapes,this.parameters.options,t)},e}(I),id={generateTopUV:function(t,e,n,r,i){var a=e[3*n],o=e[3*n+1],s=e[3*r],c=e[3*r+1],l=e[3*i],u=e[3*i+1];return[new Tc(a,o),new Tc(s,c),new Tc(l,u)]},generateSideWallUV:function(t,e,n,r,i,a){var o=e[3*n],s=e[3*n+1],c=e[3*n+2],l=e[3*r],u=e[3*r+1],h=e[3*r+2],d=e[3*i],p=e[3*i+1],f=e[3*i+2],m=e[3*a],v=e[3*a+1],g=e[3*a+2];return Math.abs(s-u)<.01?[new Tc(o,1-c),new Tc(l,1-h),new Tc(d,1-f),new Tc(m,1-g)]:[new Tc(s,1-c),new Tc(u,1-h),new Tc(p,1-f),new Tc(v,1-g)]}},ad=function(t){function e(e,n){var r;void 0===e&&(e=1),void 0===n&&(n=0);var i=(1+Math.sqrt(5))/2,a=[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1],o=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];return r=t.call(this,a,o,e,n)||this,r.type="IcosahedronGeometry",r.parameters={radius:e,detail:n},r}return a(e,t),e}(Yh),od=function(t){function e(e,n,r,i){var a;void 0===n&&(n=12),void 0===r&&(r=0),void 0===i&&(i=2*Math.PI),a=t.call(this)||this,a.type="LatheGeometry",a.parameters={points:e,segments:n,phiStart:r,phiLength:i},n=Math.floor(n),i=Sc.clamp(i,0,2*Math.PI);for(var o=[],s=[],c=[],l=1/n,u=new Ic,h=new Tc,d=0;d<=n;d++)for(var p=r+d*l*i,f=Math.sin(p),m=Math.cos(p),v=0;v<=e.length-1;v++)u.x=e[v].x*f,u.y=e[v].y,u.z=e[v].x*m,s.push(u.x,u.y,u.z),h.x=d/n,h.y=v/(e.length-1),c.push(h.x,h.y);for(var g=0;g<n;g++)for(var y=0;y<e.length-1;y++){var x=y+g*e.length,_=x,b=x+e.length,w=x+e.length+1,M=x+1;o.push(_,b,M),o.push(b,w,M)}if(a.setIndex(o),a.setAttribute("position",new R(s,3)),a.setAttribute("uv",new R(c,2)),a.computeVertexNormals(),i===2*Math.PI)for(var S=a.attributes.normal.array,T=new Ic,E=new Ic,A=new Ic,L=n*e.length*3,C=0,P=0;C<e.length;C++,P+=3)T.x=S[P+0],T.y=S[P+1],T.z=S[P+2],E.x=S[L+P+0],E.y=S[L+P+1],E.z=S[L+P+2],A.addVectors(T,E).normalize(),S[P+0]=S[L+P+0]=A.x,S[P+1]=S[L+P+1]=A.y,S[P+2]=S[L+P+2]=A.z;return a}return a(e,t),e}(I),sd=function(t){function e(e,n){var r;void 0===e&&(e=1),void 0===n&&(n=0);var i=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],a=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];return r=t.call(this,i,a,e,n)||this,r.type="OctahedronGeometry",r.parameters={radius:e,detail:n},r}return a(e,t),e}(Yh);Jn.prototype=Object.create(I.prototype),Jn.prototype.constructor=Jn;var cd=function(t){function e(e,n,r,i,a,o){var s;void 0===e&&(e=.5),void 0===n&&(n=1),void 0===r&&(r=8),void 0===i&&(i=1),void 0===a&&(a=0),void 0===o&&(o=2*Math.PI),s=t.call(this)||this,s.type="RingGeometry",s.parameters={innerRadius:e,outerRadius:n,thetaSegments:r,phiSegments:i,thetaStart:a,thetaLength:o},r=Math.max(3,r),i=Math.max(1,i);for(var c=[],l=[],u=[],h=[],d=e,p=(n-e)/i,f=new Ic,m=new Tc,v=0;v<=i;v++){for(var g=0;g<=r;g++){var y=a+g/r*o;f.x=d*Math.cos(y),f.y=d*Math.sin(y),l.push(f.x,f.y,f.z),u.push(0,0,1),m.x=(f.x/n+1)/2,m.y=(f.y/n+1)/2,h.push(m.x,m.y)}d+=p}for(var x=0;x<i;x++)for(var _=x*(r+1),b=0;b<r;b++){var w=b+_,M=w,S=w+r+1,T=w+r+2,E=w+1;c.push(M,S,E),c.push(S,T,E)}return s.setIndex(c),s.setAttribute("position",new R(l,3)),s.setAttribute("normal",new R(u,3)),s.setAttribute("uv",new R(h,2)),s}return a(e,t),e}(I),ld=function(t){function e(e,n){function r(t){var e=o.length/3,r=t.extractPoints(n),i=r.shape,l=r.holes;!1===nd.isClockWise(i)&&(i=i.reverse());for(var h=0,d=l.length;h<d;h++){var p=l[h];!0===nd.isClockWise(p)&&(l[h]=p.reverse())}for(var f=nd.triangulateShape(i,l),m=0,v=l.length;m<v;m++){var g=l[m];i=i.concat(g)}for(var y=0,x=i.length;y<x;y++){var _=i[y];o.push(_.x,_.y,0),s.push(0,0,1),c.push(_.x,_.y)}for(var b=0,w=f.length;b<w;b++){var M=f[b],S=M[0]+e,T=M[1]+e,E=M[2]+e;a.push(S,T,E),u+=3}}var i;void 0===n&&(n=12),i=t.call(this)||this,i.type="ShapeGeometry",i.parameters={shapes:e,curveSegments:n};var a=[],o=[],s=[],c=[],l=0,u=0;if(!1===Array.isArray(e))r(e);else for(var h=0;h<e.length;h++)r(e[h]),i.addGroup(l,u,h),l+=u,u=0;return i.setIndex(a),i.setAttribute("position",new R(o,3)),i.setAttribute("normal",new R(s,3)),i.setAttribute("uv",new R(c,2)),i}return a(e,t),e.prototype.toJSON=function(){var t=I.prototype.toJSON.call(this);return Qn(this.parameters.shapes,t)},e}(I),ud=function(t){function e(e,n,r,i,a,o,s){var c;void 0===e&&(e=1),void 0===n&&(n=8),void 0===r&&(r=6),void 0===i&&(i=0),void 0===a&&(a=2*Math.PI),void 0===o&&(o=0),void 0===s&&(s=Math.PI),c=t.call(this)||this,c.type="SphereGeometry",c.parameters={radius:e,widthSegments:n,heightSegments:r,phiStart:i,phiLength:a,thetaStart:o,thetaLength:s},n=Math.max(3,Math.floor(n)),r=Math.max(2,Math.floor(r));for(var l=Math.min(o+s,Math.PI),u=0,h=[],d=new Ic,p=new Ic,f=[],m=[],v=[],g=[],y=0;y<=r;y++){var x=[],_=y/r,b=0;0==y&&0==o?b=.5/n:y==r&&l==Math.PI&&(b=-.5/n);for(var w=0;w<=n;w++){var M=w/n;d.x=-e*Math.cos(i+M*a)*Math.sin(o+_*s),d.y=e*Math.cos(o+_*s),d.z=e*Math.sin(i+M*a)*Math.sin(o+_*s),m.push(d.x,d.y,d.z),p.copy(d).normalize(),v.push(p.x,p.y,p.z),g.push(M+b,1-_),x.push(u++)}h.push(x)}for(var S=0;S<r;S++)for(var T=0;T<n;T++){var E=h[S][T+1],A=h[S][T],L=h[S+1][T],C=h[S+1][T+1];(0!==S||o>0)&&f.push(E,A,C),(S!==r-1||l<Math.PI)&&f.push(A,L,C)}return c.setIndex(f),c.setAttribute("position",new R(m,3)),c.setAttribute("normal",new R(v,3)),c.setAttribute("uv",new R(g,2)),c}return a(e,t),e}(I),hd=function(t){function e(e,n){var r;void 0===e&&(e=1),void 0===n&&(n=0);var i=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],a=[2,1,0,0,3,2,1,3,0,2,3,1];return r=t.call(this,i,a,e,n)||this,r.type="TetrahedronGeometry",r.parameters={radius:e,detail:n},r}return a(e,t),e}(Yh),dd=function(t){function e(e,n){var r;void 0===n&&(n={});var i=n.font;if(!i||!i.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new I||o(r);var a=i.generateShapes(e,n.size);return n.depth=void 0!==n.height?n.height:50,void 0===n.bevelThickness&&(n.bevelThickness=10),void 0===n.bevelSize&&(n.bevelSize=8),void 0===n.bevelEnabled&&(n.bevelEnabled=!1),r=t.call(this,a,n)||this,r.type="TextGeometry",r}return a(e,t),e}(rd),pd=function(t){function e(e,n,r,i,a){var o;void 0===e&&(e=1),void 0===n&&(n=.4),void 0===r&&(r=8),void 0===i&&(i=6),void 0===a&&(a=2*Math.PI),o=t.call(this)||this,o.type="TorusGeometry",o.parameters={radius:e,tube:n,radialSegments:r,tubularSegments:i,arc:a},r=Math.floor(r),i=Math.floor(i);for(var s=[],c=[],l=[],u=[],h=new Ic,d=new Ic,p=new Ic,f=0;f<=r;f++)for(var m=0;m<=i;m++){var v=m/i*a,g=f/r*Math.PI*2;d.x=(e+n*Math.cos(g))*Math.cos(v),d.y=(e+n*Math.cos(g))*Math.sin(v),d.z=n*Math.sin(g),c.push(d.x,d.y,d.z),h.x=e*Math.cos(v),h.y=e*Math.sin(v),p.subVectors(d,h).normalize(),l.push(p.x,p.y,p.z),u.push(m/i),u.push(f/r)}for(var y=1;y<=r;y++)for(var x=1;x<=i;x++){var _=(i+1)*y+x-1,b=(i+1)*(y-1)+x-1,w=(i+1)*(y-1)+x,M=(i+1)*y+x;s.push(_,b,M),s.push(b,w,M)}return o.setIndex(s),o.setAttribute("position",new R(c,3)),o.setAttribute("normal",new R(l,3)),o.setAttribute("uv",new R(u,2)),o}return a(e,t),e}(I),fd=function(t){function e(e,n,r,i,a,o){function s(t,e,n,r,i){var a=Math.cos(t),o=Math.sin(t),s=n/e*t,c=Math.cos(s);i.x=r*(2+c)*.5*a,i.y=r*(2+c)*o*.5,i.z=r*Math.sin(s)*.5}var c;void 0===e&&(e=1),void 0===n&&(n=.4),void 0===r&&(r=64),void 0===i&&(i=8),void 0===a&&(a=2),void 0===o&&(o=3),c=t.call(this)||this,c.type="TorusKnotGeometry",c.parameters={radius:e,tube:n,tubularSegments:r,radialSegments:i,p:a,q:o},r=Math.floor(r),i=Math.floor(i);for(var l=[],u=[],h=[],d=[],p=new Ic,f=new Ic,m=new Ic,v=new Ic,g=new Ic,y=new Ic,x=new Ic,_=0;_<=r;++_){var b=_/r*a*Math.PI*2;s(b,a,o,e,m),s(b+.01,a,o,e,v),y.subVectors(v,m),x.addVectors(v,m),g.crossVectors(y,x),x.crossVectors(g,y),g.normalize(),x.normalize();for(var w=0;w<=i;++w){var M=w/i*Math.PI*2,S=-n*Math.cos(M),T=n*Math.sin(M);p.x=m.x+(S*x.x+T*g.x),p.y=m.y+(S*x.y+T*g.y),p.z=m.z+(S*x.z+T*g.z),u.push(p.x,p.y,p.z),f.subVectors(p,m).normalize(),h.push(f.x,f.y,f.z),d.push(_/r),d.push(w/i)}}for(var E=1;E<=r;E++)for(var A=1;A<=i;A++){var L=(i+1)*(E-1)+(A-1),C=(i+1)*E+(A-1),P=(i+1)*E+A,O=(i+1)*(E-1)+A;l.push(L,C,O),l.push(C,P,O)}return c.setIndex(l),c.setAttribute("position",new R(u,3)),c.setAttribute("normal",new R(h,3)),c.setAttribute("uv",new R(d,2)),c}return a(e,t),e}(I),md=function(t){function e(e,n,r,i,a){function o(t){f=e.getPointAt(t/n,f);for(var a=u.normals[t],o=u.binormals[t],s=0;s<=i;s++){var c=s/i*Math.PI*2,l=Math.sin(c),p=-Math.cos(c);d.x=p*a.x+l*o.x,d.y=p*a.y+l*o.y,d.z=p*a.z+l*o.z,d.normalize(),v.push(d.x,d.y,d.z),h.x=f.x+r*d.x,h.y=f.y+r*d.y,h.z=f.z+r*d.z,m.push(h.x,h.y,h.z)}}function s(){for(var t=1;t<=n;t++)for(var e=1;e<=i;e++){var r=(i+1)*(t-1)+(e-1),a=(i+1)*t+(e-1),o=(i+1)*t+e,s=(i+1)*(t-1)+e;y.push(r,a,s),y.push(a,o,s)}}function c(){for(var t=0;t<=n;t++)for(var e=0;e<=i;e++)p.x=t/n,p.y=e/i,g.push(p.x,p.y)}var l;void 0===n&&(n=64),void 0===r&&(r=1),void 0===i&&(i=8),void 0===a&&(a=!1),l=t.call(this)||this,l.type="TubeGeometry",l.parameters={path:e,tubularSegments:n,radius:r,radialSegments:i,closed:a};var u=e.computeFrenetFrames(n,a);l.tangents=u.tangents,l.normals=u.normals,l.binormals=u.binormals;var h=new Ic,d=new Ic,p=new Tc,f=new Ic,m=[],v=[],g=[],y=[];return function(){for(var t=0;t<n;t++)o(t);o(!1===a?n:0),c(),s()}(),l.setIndex(y),l.setAttribute("position",new R(m,3)),l.setAttribute("normal",new R(v,3)),l.setAttribute("uv",new R(g,2)),l}return a(e,t),e.prototype.toJSON=function(){var t=I.prototype.toJSON.call(this);return t.path=this.parameters.path.toJSON(),t},e}(I),vd=function(t){function e(e){var n;if(n=t.call(this)||this,n.type="WireframeGeometry",!0===e.isGeometry)return console.error("THREE.WireframeGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),o(n);var r=[],i=[0,0],a={},s=new Ic;if(null!==e.index){var c=e.attributes.position,l=e.index,u=e.groups;0===u.length&&(u=[{start:0,count:l.count,materialIndex:0}]);for(var h=0,d=u.length;h<d;++h)for(var p=u[h],f=p.start,m=p.count,v=f,g=f+m;v<g;v+=3)for(var y=0;y<3;y++){var x=l.getX(v+y),_=l.getX(v+(y+1)%3);i[0]=Math.min(x,_),i[1]=Math.max(x,_);var b=i[0]+","+i[1];void 0===a[b]&&(a[b]={index1:i[0],index2:i[1]})}for(var w in a){var M=a[w];s.fromBufferAttribute(c,M.index1),r.push(s.x,s.y,s.z),s.fromBufferAttribute(c,M.index2),r.push(s.x,s.y,s.z)}}else for(var S=e.attributes.position,T=0,E=S.count/3;T<E;T++)for(var A=0;A<3;A++){var L=3*T+A;s.fromBufferAttribute(S,L),r.push(s.x,s.y,s.z);var C=3*T+(A+1)%3;s.fromBufferAttribute(S,C),r.push(s.x,s.y,s.z)}return n.setAttribute("position",new R(r,3)),n}return a(e,t),e}(I),gd=Object.freeze({__proto__:null,BoxGeometry:Tu,BoxBufferGeometry:Tu,CircleGeometry:jh,CircleBufferGeometry:jh,ConeGeometry:Xh,ConeBufferGeometry:Xh,CylinderGeometry:qh,CylinderBufferGeometry:qh,DodecahedronGeometry:Zh,DodecahedronBufferGeometry:Zh,EdgesGeometry:td,ExtrudeGeometry:rd,ExtrudeBufferGeometry:rd,IcosahedronGeometry:ad,IcosahedronBufferGeometry:ad,LatheGeometry:od,LatheBufferGeometry:od,OctahedronGeometry:sd,OctahedronBufferGeometry:sd,ParametricGeometry:Jn,ParametricBufferGeometry:Jn,PlaneGeometry:Nu,PlaneBufferGeometry:Nu,PolyhedronGeometry:Yh,PolyhedronBufferGeometry:Yh,RingGeometry:cd,RingBufferGeometry:cd,ShapeGeometry:ld,ShapeBufferGeometry:ld,SphereGeometry:ud,SphereBufferGeometry:ud,TetrahedronGeometry:hd,TetrahedronBufferGeometry:hd,TextGeometry:dd,TextBufferGeometry:dd,TorusGeometry:pd,TorusBufferGeometry:pd,TorusKnotGeometry:fd,TorusKnotBufferGeometry:fd,TubeGeometry:md,TubeBufferGeometry:md,WireframeGeometry:vd});Kn.prototype=Object.create(y.prototype),Kn.prototype.constructor=Kn,Kn.prototype.isShadowMaterial=!0,Kn.prototype.copy=function(t){return y.prototype.copy.call(this,t),this.color.copy(t.color),this},$n.prototype=Object.create(H.prototype),$n.prototype.constructor=$n,$n.prototype.isRawShaderMaterial=!0,tr.prototype=Object.create(y.prototype),tr.prototype.constructor=tr,tr.prototype.isMeshStandardMaterial=!0,tr.prototype.copy=function(t){return y.prototype.copy.call(this,t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.vertexTangents=t.vertexTangents,this},er.prototype=Object.create(tr.prototype),er.prototype.constructor=er,er.prototype.isMeshPhysicalMaterial=!0,er.prototype.copy=function(t){return tr.prototype.copy.call(this,t),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.reflectivity=t.reflectivity,t.sheen?this.sheen=(this.sheen||new Zl).copy(t.sheen):this.sheen=null,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this},nr.prototype=Object.create(y.prototype),nr.prototype.constructor=nr,nr.prototype.isMeshPhongMaterial=!0,nr.prototype.copy=function(t){return y.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},rr.prototype=Object.create(y.prototype),rr.prototype.constructor=rr,rr.prototype.isMeshToonMaterial=!0,rr.prototype.copy=function(t){return y.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},ir.prototype=Object.create(y.prototype),ir.prototype.constructor=ir,ir.prototype.isMeshNormalMaterial=!0,ir.prototype.copy=function(t){return y.prototype.copy.call(this,t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},ar.prototype=Object.create(y.prototype),ar.prototype.constructor=ar,ar.prototype.isMeshLambertMaterial=!0,ar.prototype.copy=function(t){return y.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},or.prototype=Object.create(y.prototype),or.prototype.constructor=or,or.prototype.isMeshMatcapMaterial=!0,or.prototype.copy=function(t){return y.prototype.copy.call(this,t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},sr.prototype=Object.create(an.prototype),sr.prototype.constructor=sr,sr.prototype.isLineDashedMaterial=!0,sr.prototype.copy=function(t){return an.prototype.copy.call(this,t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this};var yd=Object.freeze({__proto__:null,ShadowMaterial:Kn,SpriteMaterial:Je,RawShaderMaterial:$n,ShaderMaterial:H,PointsMaterial:ln,MeshPhysicalMaterial:er,MeshStandardMaterial:tr,MeshPhongMaterial:nr,MeshToonMaterial:rr,MeshNormalMaterial:ir,MeshLambertMaterial:ar,MeshDepthMaterial:Oe,MeshDistanceMaterial:Ie,MeshBasicMaterial:x,MeshMatcapMaterial:or,LineDashedMaterial:sr,LineBasicMaterial:an,Material:y}),xd={arraySlice:function(t,e,n){return xd.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==n?n:t.length)):t.slice(e,n)},convertArray:function(t,e,n){return!t||!n&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){function e(e,n){return t[e]-t[n]}for(var n=t.length,r=new Array(n),i=0;i!==n;++i)r[i]=i;return r.sort(e),r},sortedArray:function(t,e,n){for(var r=t.length,i=new t.constructor(r),a=0,o=0;o!==r;++a)for(var s=n[a]*e,c=0;c!==e;++c)i[o++]=t[s+c];return i},flattenJSON:function(t,e,n,r){for(var i=1,a=t[0];void 0!==a&&void 0===a[r];)a=t[i++];if(void 0!==a){var o=a[r];if(void 0!==o)if(Array.isArray(o))do{o=a[r],void 0!==o&&(e.push(a.time),n.push.apply(n,o)),a=t[i++]}while(void 0!==a);else if(void 0!==o.toArray)do{o=a[r],
  141. void 0!==o&&(e.push(a.time),o.toArray(n,n.length)),a=t[i++]}while(void 0!==a);else do{o=a[r],void 0!==o&&(e.push(a.time),n.push(o)),a=t[i++]}while(void 0!==a)}},subclip:function(t,e,n,r,i){void 0===i&&(i=30);var a=t.clone();a.name=e;for(var o=[],s=0;s<a.tracks.length;++s){for(var c=a.tracks[s],l=c.getValueSize(),u=[],h=[],d=0;d<c.times.length;++d){var p=c.times[d]*i;if(!(p<n||p>=r)){u.push(c.times[d]);for(var f=0;f<l;++f)h.push(c.values[d*l+f])}}0!==u.length&&(c.times=xd.convertArray(u,c.times.constructor),c.values=xd.convertArray(h,c.values.constructor),o.push(c))}a.tracks=o;for(var m=1/0,v=0;v<a.tracks.length;++v)m>a.tracks[v].times[0]&&(m=a.tracks[v].times[0]);for(var g=0;g<a.tracks.length;++g)a.tracks[g].shift(-1*m);return a.resetDuration(),a},makeClipAdditive:function(t,e,n,r){void 0===e&&(e=0),void 0===n&&(n=t),void 0===r&&(r=30),r<=0&&(r=30);for(var i=n.tracks.length,a=e/r,o=0;o<i;++o){(function(e){var r=n.tracks[e],i=r.ValueTypeName;if("bool"===i||"string"===i)return"continue";var o=t.tracks.find(function(t){return t.name===r.name&&t.ValueTypeName===i});if(void 0===o)return"continue";var s=0,c=r.getValueSize();r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(s=c/3);var l=0,u=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(l=u/3);var h=r.times.length-1,d=void 0;if(a<=r.times[0]){var p=s,f=c-s;d=xd.arraySlice(r.values,p,f)}else if(a>=r.times[h]){var m=h*c+s,v=m+c-s;d=xd.arraySlice(r.values,m,v)}else{var g=r.createInterpolant(),y=s,x=c-s;g.evaluate(a),d=xd.arraySlice(g.resultBuffer,y,x)}if("quaternion"===i){(new Oc).fromArray(d).normalize().conjugate().toArray(d)}for(var _=o.times.length,b=0;b<_;++b){var w=b*u+l;if("quaternion"===i)Oc.multiplyQuaternionsFlat(o.values,w,d,0,o.values,w);else for(var M=u-2*l,S=0;S<M;++S)o.values[w+S]-=d[S]}})(o)}return t.blendMode=2501,t}};Object.assign(cr.prototype,{evaluate:function(t){var e=this.parameterPositions,n=this._cachedIndex,r=e[n],i=e[n-1];t:{e:{var a;n:{r:if(!(t<r)){for(var o=n+2;;){if(void 0===r){if(t<i)break r;return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,t,i)}if(n===o)break;if(i=r,r=e[++n],t<r)break e}a=e.length;break n}{if(t>=i)break t;var s=e[1];t<s&&(n=2,i=s);for(var c=n-2;;){if(void 0===i)return this._cachedIndex=0,this.beforeStart_(0,t,r);if(n===c)break;if(r=i,i=e[--n-1],t>=i)break e}a=n,n=0}}for(;n<a;){var l=n+a>>>1;t<e[l]?a=l:n=l+1}if(r=e[n],void 0===(i=e[n-1]))return this._cachedIndex=0,this.beforeStart_(0,t,r);if(void 0===r)return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,i,t)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,t,r)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(t){for(var e=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=t*r,a=0;a!==r;++a)e[a]=n[i+a];return e},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(cr.prototype,{beforeStart_:cr.prototype.copySampleValue_,afterEnd_:cr.prototype.copySampleValue_}),lr.prototype=Object.assign(Object.create(cr.prototype),{constructor:lr,DefaultSettings_:{endingStart:ec,endingEnd:ec},intervalChanged_:function(t,e,n){var r=this.parameterPositions,i=t-2,a=t+1,o=r[i],s=r[a];if(void 0===o)switch(this.getSettings_().endingStart){case 2401:i=t,o=2*e-n;break;case 2402:i=r.length-2,o=e+r[i]-r[i+1];break;default:i=t,o=n}if(void 0===s)switch(this.getSettings_().endingEnd){case 2401:a=t,s=2*n-e;break;case 2402:a=1,s=n+r[1]-r[0];break;default:a=t-1,s=e}var c=.5*(n-e),l=this.valueSize;this._weightPrev=c/(e-o),this._weightNext=c/(s-n),this._offsetPrev=i*l,this._offsetNext=a*l},interpolate_:function(t,e,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,c=s-o,l=this._offsetPrev,u=this._offsetNext,h=this._weightPrev,d=this._weightNext,p=(n-e)/(r-e),f=p*p,m=f*p,v=-h*m+2*h*f-h*p,g=(1+h)*m+(-1.5-2*h)*f+(-.5+h)*p+1,y=(-1-d)*m+(1.5+d)*f+.5*p,x=d*m-d*f,_=0;_!==o;++_)i[_]=v*a[l+_]+g*a[c+_]+y*a[s+_]+x*a[u+_];return i}}),ur.prototype=Object.assign(Object.create(cr.prototype),{constructor:ur,interpolate_:function(t,e,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,c=s-o,l=(n-e)/(r-e),u=1-l,h=0;h!==o;++h)i[h]=a[c+h]*u+a[s+h]*l;return i}}),hr.prototype=Object.assign(Object.create(cr.prototype),{constructor:hr,interpolate_:function(t){return this.copySampleValue_(t-1)}}),Object.assign(dr,{toJSON:function(t){var e,n=t.constructor;if(void 0!==n.toJSON)e=n.toJSON(t);else{e={name:t.name,times:xd.convertArray(t.times,Array),values:xd.convertArray(t.values,Array)};var r=t.getInterpolation();r!==t.DefaultInterpolation&&(e.interpolation=r)}return e.type=t.ValueTypeName,e}}),Object.assign(dr.prototype,{constructor:dr,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(t){return new hr(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodLinear:function(t){return new ur(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:function(t){return new lr(this.times,this.values,this.getValueSize(),t)},setInterpolation:function(t){var e;switch(t){case 2300:e=this.InterpolantFactoryMethodDiscrete;break;case 2301:e=this.InterpolantFactoryMethodLinear;break;case 2302:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){var n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(n);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=e,this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}},getValueSize:function(){return this.values.length/this.times.length},shift:function(t){if(0!==t)for(var e=this.times,n=0,r=e.length;n!==r;++n)e[n]+=t;return this},scale:function(t){if(1!==t)for(var e=this.times,n=0,r=e.length;n!==r;++n)e[n]*=t;return this},trim:function(t,e){for(var n=this.times,r=n.length,i=0,a=r-1;i!==r&&n[i]<t;)++i;for(;-1!==a&&n[a]>e;)--a;if(++a,0!==i||a!==r){i>=a&&(a=Math.max(a,1),i=a-1);var o=this.getValueSize();this.times=xd.arraySlice(n,i,a),this.values=xd.arraySlice(this.values,i*o,a*o)}return this},validate:function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);var n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);for(var a=null,o=0;o!==i;o++){var s=n[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),t=!1;break}if(null!==a&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),t=!1;break}a=s}if(void 0!==r&&xd.isTypedArray(r))for(var c=0,l=r.length;c!==l;++c){var u=r[c];if(isNaN(u)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,c,u),t=!1;break}}return t},optimize:function(){for(var t=xd.arraySlice(this.times),e=xd.arraySlice(this.values),n=this.getValueSize(),r=2302===this.getInterpolation(),i=t.length-1,a=1,o=1;o<i;++o){var s=!1,c=t[o];if(c!==t[o+1]&&(1!==o||c!==t[0]))if(r)s=!0;else for(var l=o*n,u=l-n,h=l+n,d=0;d!==n;++d){var p=e[l+d];if(p!==e[u+d]||p!==e[h+d]){s=!0;break}}if(s){if(o!==a){t[a]=t[o];for(var f=o*n,m=a*n,v=0;v!==n;++v)e[m+v]=e[f+v]}++a}}if(i>0){t[a]=t[i];for(var g=i*n,y=a*n,x=0;x!==n;++x)e[y+x]=e[g+x];++a}return a!==t.length?(this.times=xd.arraySlice(t,0,a),this.values=xd.arraySlice(e,0,a*n)):(this.times=t,this.values=e),this},clone:function(){var t=xd.arraySlice(this.times,0),e=xd.arraySlice(this.values,0),n=this.constructor,r=new n(this.name,t,e);return r.createInterpolant=this.createInterpolant,r}}),pr.prototype=Object.assign(Object.create(dr.prototype),{constructor:pr,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),fr.prototype=Object.assign(Object.create(dr.prototype),{constructor:fr,ValueTypeName:"color"}),mr.prototype=Object.assign(Object.create(dr.prototype),{constructor:mr,ValueTypeName:"number"}),vr.prototype=Object.assign(Object.create(cr.prototype),{constructor:vr,interpolate_:function(t,e,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-e)/(r-e),c=t*o,l=c+o;c!==l;c+=4)Oc.slerpFlat(i,0,a,c-o,a,c,s);return i}}),gr.prototype=Object.assign(Object.create(dr.prototype),{constructor:gr,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(t){return new vr(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),yr.prototype=Object.assign(Object.create(dr.prototype),{constructor:yr,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),xr.prototype=Object.assign(Object.create(dr.prototype),{constructor:xr,ValueTypeName:"vector"}),Object.assign(_r,{parse:function(t){for(var e=[],n=t.tracks,r=1/(t.fps||1),i=0,a=n.length;i!==a;++i)e.push(wr(n[i]).scale(r));var o=new _r(t.name,t.duration,e,t.blendMode);return o.uuid=t.uuid,o},toJSON:function(t){for(var e=[],n=t.tracks,r={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode},i=0,a=n.length;i!==a;++i)e.push(dr.toJSON(n[i]));return r},CreateFromMorphTargetSequence:function(t,e,n,r){for(var i=e.length,a=[],o=0;o<i;o++){var s=[],c=[];s.push((o+i-1)%i,o,(o+1)%i),c.push(0,1,0);var l=xd.getKeyframeOrder(s);s=xd.sortedArray(s,1,l),c=xd.sortedArray(c,1,l),r||0!==s[0]||(s.push(i),c.push(c[0])),a.push(new mr(".morphTargetInfluences["+e[o].name+"]",s,c).scale(1/n))}return new _r(t,-1,a)},findByName:function(t,e){var n=t;if(!Array.isArray(t)){var r=t;n=r.geometry&&r.geometry.animations||r.animations}for(var i=0;i<n.length;i++)if(n[i].name===e)return n[i];return null},CreateClipsFromMorphTargetSequences:function(t,e,n){for(var r={},i=/^([\w-]*?)([\d]+)$/,a=0,o=t.length;a<o;a++){var s=t[a],c=s.name.match(i);if(c&&c.length>1){var l=c[1],u=r[l];u||(r[l]=u=[]),u.push(s)}}var h=[];for(var d in r)h.push(_r.CreateFromMorphTargetSequence(d,r[d],e,n));return h},parseAnimation:function(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(t,e,n,r,i){if(0!==n.length){var a=[],o=[];xd.flattenJSON(n,a,o,r),0!==a.length&&i.push(new t(e,a,o))}},r=[],i=t.name||"default",a=t.fps||30,o=t.blendMode,s=t.length||-1,c=t.hierarchy||[],l=0;l<c.length;l++){var u=c[l].keys;if(u&&0!==u.length)if(u[0].morphTargets){var h={},d=void 0;for(d=0;d<u.length;d++)if(u[d].morphTargets)for(var p=0;p<u[d].morphTargets.length;p++)h[u[d].morphTargets[p]]=-1;for(var f in h){for(var m=[],v=[],g=0;g!==u[d].morphTargets.length;++g){var y=u[d];m.push(y.time),v.push(y.morphTarget===f?1:0)}r.push(new mr(".morphTargetInfluence["+f+"]",m,v))}s=h.length*(a||1)}else{var x=".bones["+e[l].name+"]";n(xr,x+".position",u,"pos",r),n(gr,x+".quaternion",u,"rot",r),n(xr,x+".scale",u,"scl",r)}}return 0===r.length?null:new _r(i,s,r,o)}}),Object.assign(_r.prototype,{resetDuration:function(){for(var t=this.tracks,e=0,n=0,r=t.length;n!==r;++n){var i=this.tracks[n];e=Math.max(e,i.times[i.times.length-1])}return this.duration=e,this},trim:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this},validate:function(){for(var t=!0,e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t},optimize:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this},clone:function(){for(var t=[],e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new _r(this.name,this.duration,t,this.blendMode)},toJSON:function(){return _r.toJSON(this)}});var _d={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}},bd=new Mr;Object.assign(Sr.prototype,{load:function(){},loadAsync:function(t,e){var n=this;return new Promise(function(r,i){n.load(t,r,e,i)})},parse:function(){},setCrossOrigin:function(t){return this.crossOrigin=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setPath:function(t){return this.path=t,this},setResourcePath:function(t){return this.resourcePath=t,this},setRequestHeader:function(t){return this.requestHeader=t,this}});var wd={};Tr.prototype=Object.assign(Object.create(Sr.prototype),{constructor:Tr,load:function(t,e,n,r){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var i=this,a=_d.get(t);if(void 0!==a)return i.manager.itemStart(t),setTimeout(function(){e&&e(a),i.manager.itemEnd(t)},0),a;if(void 0!==wd[t])return void wd[t].push({onLoad:e,onProgress:n,onError:r});var o,s=/^data:(.*?)(;base64)?,(.*)$/,c=t.match(s);if(c){var l=c[1],u=!!c[2],h=c[3];h=decodeURIComponent(h),u&&(h=atob(h));try{var d,p=(this.responseType||"").toLowerCase();switch(p){case"arraybuffer":case"blob":for(var f=new Uint8Array(h.length),m=0;m<h.length;m++)f[m]=h.charCodeAt(m);d="blob"===p?new Blob([f.buffer],{type:l}):f.buffer;break;case"document":var v=new DOMParser;d=v.parseFromString(h,l);break;case"json":d=JSON.parse(h);break;default:d=h}setTimeout(function(){e&&e(d),i.manager.itemEnd(t)},0)}catch(e){setTimeout(function(){r&&r(e),i.manager.itemError(t),i.manager.itemEnd(t)},0)}}else{wd[t]=[],wd[t].push({onLoad:e,onProgress:n,onError:r}),o=new XMLHttpRequest,o.open("GET",t,!0),o.addEventListener("load",function(e){var n=this.response,r=wd[t];if(delete wd[t],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),_d.add(t,n);for(var a=0,o=r.length;a<o;a++){var s=r[a];s.onLoad&&s.onLoad(n)}i.manager.itemEnd(t)}else{for(var c=0,l=r.length;c<l;c++){var u=r[c];u.onError&&u.onError(e)}i.manager.itemError(t),i.manager.itemEnd(t)}},!1),o.addEventListener("progress",function(e){for(var n=wd[t],r=0,i=n.length;r<i;r++){var a=n[r];a.onProgress&&a.onProgress(e)}},!1),o.addEventListener("error",function(e){var n=wd[t];delete wd[t];for(var r=0,a=n.length;r<a;r++){var o=n[r];o.onError&&o.onError(e)}i.manager.itemError(t),i.manager.itemEnd(t)},!1),o.addEventListener("abort",function(e){var n=wd[t];delete wd[t];for(var r=0,a=n.length;r<a;r++){var o=n[r];o.onError&&o.onError(e)}i.manager.itemError(t),i.manager.itemEnd(t)},!1),void 0!==this.responseType&&(o.responseType=this.responseType),void 0!==this.withCredentials&&(o.withCredentials=this.withCredentials),o.overrideMimeType&&o.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain");for(var g in this.requestHeader)o.setRequestHeader(g,this.requestHeader[g]);o.send(null)}return i.manager.itemStart(t),o},setResponseType:function(t){return this.responseType=t,this},setMimeType:function(t){return this.mimeType=t,this}}),Er.prototype=Object.assign(Object.create(Sr.prototype),{constructor:Er,load:function(t,e,n,r){var i=this,a=new Tr(i.manager);a.setPath(i.path),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(t,function(n){try{e(i.parse(JSON.parse(n)))}catch(e){r?r(e):console.error(e),i.manager.itemError(t)}},n,r)},parse:function(t){for(var e=[],n=0;n<t.length;n++){var r=_r.parse(t[n]);e.push(r)}return e}}),Ar.prototype=Object.assign(Object.create(Sr.prototype),{constructor:Ar,load:function(t,e,n,r){var i=this,a=[],o=new pn,s=new Tr(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(i.withCredentials);var c=0;if(Array.isArray(t))for(var l=0,u=t.length;l<u;++l)!function(l){s.load(t[l],function(t){var n=i.parse(t,!0);a[l]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},6===(c+=1)&&(1===n.mipmapCount&&(o.minFilter=Ho),o.image=a,o.format=n.format,o.needsUpdate=!0,e&&e(o))},n,r)}(l);else s.load(t,function(t){var n=i.parse(t,!0);if(n.isCubemap){for(var r=n.mipmaps.length/n.mipmapCount,s=0;s<r;s++){a[s]={mipmaps:[]};for(var c=0;c<n.mipmapCount;c++)a[s].mipmaps.push(n.mipmaps[s*n.mipmapCount+c]),a[s].format=n.format,a[s].width=n.width,a[s].height=n.height}o.image=a}else o.image.width=n.width,o.image.height=n.height,o.mipmaps=n.mipmaps;1===n.mipmapCount&&(o.minFilter=Ho),o.format=n.format,o.needsUpdate=!0,e&&e(o)},n,r);return o}}),Lr.prototype=Object.assign(Object.create(Sr.prototype),{constructor:Lr,load:function(t,e,n,r){function i(){c.removeEventListener("load",i,!1),c.removeEventListener("error",a,!1),_d.add(t,this),e&&e(this),o.manager.itemEnd(t)}function a(e){c.removeEventListener("load",i,!1),c.removeEventListener("error",a,!1),r&&r(e),o.manager.itemError(t),o.manager.itemEnd(t)}void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var o=this,s=_d.get(t);if(void 0!==s)return o.manager.itemStart(t),setTimeout(function(){e&&e(s),o.manager.itemEnd(t)},0),s;var c=document.createElementNS("http://www.w3.org/1999/xhtml","img");return c.addEventListener("load",i,!1),c.addEventListener("error",a,!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(c.crossOrigin=this.crossOrigin),o.manager.itemStart(t),c.src=t,c}}),Rr.prototype=Object.assign(Object.create(Sr.prototype),{constructor:Rr,load:function(t,e,n,r){var i=new V,a=new Lr(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);for(var o=0,s=0;s<t.length;++s)!function(n){a.load(t[n],function(t){i.images[n]=t,6==++o&&(i.needsUpdate=!0,e&&e(i))},void 0,r)}(s);return i}}),Cr.prototype=Object.assign(Object.create(Sr.prototype),{constructor:Cr,load:function(t,e,n,r){var i=this,a=new W,o=new Tr(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(i.withCredentials),o.load(t,function(t){var n=i.parse(t);n&&(void 0!==n.image?a.image=n.image:void 0!==n.data&&(a.image.width=n.width,a.image.height=n.height,a.image.data=n.data),a.wrapS=void 0!==n.wrapS?n.wrapS:Do,a.wrapT=void 0!==n.wrapT?n.wrapT:Do,a.magFilter=void 0!==n.magFilter?n.magFilter:Ho,a.minFilter=void 0!==n.minFilter?n.minFilter:Ho,a.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.encoding&&(a.encoding=n.encoding),void 0!==n.flipY&&(a.flipY=n.flipY),void 0!==n.format&&(a.format=n.format),void 0!==n.type&&(a.type=n.type),void 0!==n.mipmaps&&(a.mipmaps=n.mipmaps,a.minFilter=Uo),1===n.mipmapCount&&(a.minFilter=Ho),a.needsUpdate=!0,e&&e(a,n))},n,r),a}}),Pr.prototype=Object.assign(Object.create(Sr.prototype),{constructor:Pr,load:function(t,e,n,r){var i=new h,a=new Lr(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(t,function(n){i.image=n;var r=t.search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/);i.format=r?es:ns,i.needsUpdate=!0,void 0!==e&&e(i)},n,r),i}}),Object.assign(Or.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t,e){var n=this.getUtoTmapping(t);return this.getPoint(n,e)},getPoints:function(t){void 0===t&&(t=5);for(var e=[],n=0;n<=t;n++)e.push(this.getPoint(n/t));return e},getSpacedPoints:function(t){void 0===t&&(t=5);for(var e=[],n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,n=[],r=this.getPoint(0),i=0;n.push(0);for(var a=1;a<=t;a++)e=this.getPoint(a/t),i+=e.distanceTo(r),n.push(i),r=e;return this.cacheArcLengths=n,n},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){var n,r=this.getLengths(),i=0,a=r.length;n=e||t*r[a-1];for(var o,s=0,c=a-1;s<=c;)if(i=Math.floor(s+(c-s)/2),(o=r[i]-n)<0)s=i+1;else{if(!(o>0)){c=i;break}c=i-1}if(i=c,r[i]===n)return i/(a-1);var l=r[i];return(i+(n-l)/(r[i+1]-l))/(a-1)},getTangent:function(t,e){var n=t-1e-4,r=t+1e-4;n<0&&(n=0),r>1&&(r=1);var i=this.getPoint(n),a=this.getPoint(r),o=e||(i.isVector2?new Tc:new Ic);return o.copy(a).sub(i).normalize(),o},getTangentAt:function(t,e){var n=this.getUtoTmapping(t);return this.getTangent(n,e)},computeFrenetFrames:function(t,e){for(var n=new Ic,r=[],i=[],a=[],o=new Ic,s=new ol,c=0;c<=t;c++){var l=c/t;r[c]=this.getTangentAt(l,new Ic),r[c].normalize()}i[0]=new Ic,a[0]=new Ic;var u=Number.MAX_VALUE,h=Math.abs(r[0].x),d=Math.abs(r[0].y),p=Math.abs(r[0].z);h<=u&&(u=h,n.set(1,0,0)),d<=u&&(u=d,n.set(0,1,0)),p<=u&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),a[0].crossVectors(r[0],i[0]);for(var f=1;f<=t;f++){if(i[f]=i[f-1].clone(),a[f]=a[f-1].clone(),o.crossVectors(r[f-1],r[f]),o.length()>Number.EPSILON){o.normalize();var m=Math.acos(Sc.clamp(r[f-1].dot(r[f]),-1,1));i[f].applyMatrix4(s.makeRotationAxis(o,m))}a[f].crossVectors(r[f],i[f])}if(!0===e){var v=Math.acos(Sc.clamp(i[0].dot(i[t]),-1,1));v/=t,r[0].dot(o.crossVectors(i[0],i[t]))>0&&(v=-v);for(var g=1;g<=t;g++)i[g].applyMatrix4(s.makeRotationAxis(r[g],v*g)),a[g].crossVectors(r[g],i[g])}return{tangents:r,normals:i,binormals:a}},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},toJSON:function(){var t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t},fromJSON:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}),Ir.prototype=Object.create(Or.prototype),Ir.prototype.constructor=Ir,Ir.prototype.isEllipseCurve=!0,Ir.prototype.getPoint=function(t,e){for(var n=e||new Tc,r=2*Math.PI,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)<Number.EPSILON;i<0;)i+=r;for(;i>r;)i-=r;i<Number.EPSILON&&(i=a?0:r),!0!==this.aClockwise||a||(i===r?i=-r:i-=r);var o=this.aStartAngle+t*i,s=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){var l=Math.cos(this.aRotation),u=Math.sin(this.aRotation),h=s-this.aX,d=c-this.aY;s=h*l-d*u+this.aX,c=h*u+d*l+this.aY}return n.set(s,c)},Ir.prototype.copy=function(t){return Or.prototype.copy.call(this,t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this},Ir.prototype.toJSON=function(){var t=Or.prototype.toJSON.call(this);return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t},Ir.prototype.fromJSON=function(t){return Or.prototype.fromJSON.call(this,t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this},Dr.prototype=Object.create(Ir.prototype),Dr.prototype.constructor=Dr,Dr.prototype.isArcCurve=!0;var Md=new Ic,Sd=new Nr,Td=new Nr,Ed=new Nr;Br.prototype=Object.create(Or.prototype),Br.prototype.constructor=Br,Br.prototype.isCatmullRomCurve3=!0,Br.prototype.getPoint=function(t,e){void 0===e&&(e=new Ic);var n=e,r=this.points,i=r.length,a=(i-(this.closed?0:1))*t,o=Math.floor(a),s=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/i)+1)*i:0===s&&o===i-1&&(o=i-2,s=1);var c,l;this.closed||o>0?c=r[(o-1)%i]:(Md.subVectors(r[0],r[1]).add(r[0]),c=Md);var u=r[o%i],h=r[(o+1)%i];if(this.closed||o+2<i?l=r[(o+2)%i]:(Md.subVectors(r[i-1],r[i-2]).add(r[i-1]),l=Md),"centripetal"===this.curveType||"chordal"===this.curveType){var d="chordal"===this.curveType?.5:.25,p=Math.pow(c.distanceToSquared(u),d),f=Math.pow(u.distanceToSquared(h),d),m=Math.pow(h.distanceToSquared(l),d);f<1e-4&&(f=1),p<1e-4&&(p=f),m<1e-4&&(m=f),Sd.initNonuniformCatmullRom(c.x,u.x,h.x,l.x,p,f,m),Td.initNonuniformCatmullRom(c.y,u.y,h.y,l.y,p,f,m),Ed.initNonuniformCatmullRom(c.z,u.z,h.z,l.z,p,f,m)}else"catmullrom"===this.curveType&&(Sd.initCatmullRom(c.x,u.x,h.x,l.x,this.tension),Td.initCatmullRom(c.y,u.y,h.y,l.y,this.tension),Ed.initCatmullRom(c.z,u.z,h.z,l.z,this.tension));return n.set(Sd.calc(s),Td.calc(s),Ed.calc(s)),n},Br.prototype.copy=function(t){Or.prototype.copy.call(this,t),this.points=[];for(var e=0,n=t.points.length;e<n;e++){var r=t.points[e];this.points.push(r.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this},Br.prototype.toJSON=function(){var t=Or.prototype.toJSON.call(this);t.points=[];for(var e=0,n=this.points.length;e<n;e++){var r=this.points[e];t.points.push(r.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t},Br.prototype.fromJSON=function(t){Or.prototype.fromJSON.call(this,t),this.points=[];for(var e=0,n=t.points.length;e<n;e++){var r=t.points[e];this.points.push((new Ic).fromArray(r))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this},Xr.prototype=Object.create(Or.prototype),Xr.prototype.constructor=Xr,Xr.prototype.isCubicBezierCurve=!0,Xr.prototype.getPoint=function(t,e){void 0===e&&(e=new Tc);var n=e,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(qr(t,r.x,i.x,a.x,o.x),qr(t,r.y,i.y,a.y,o.y)),n},Xr.prototype.copy=function(t){return Or.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this},Xr.prototype.toJSON=function(){var t=Or.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t},Xr.prototype.fromJSON=function(t){return Or.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this},Yr.prototype=Object.create(Or.prototype),Yr.prototype.constructor=Yr,Yr.prototype.isCubicBezierCurve3=!0,Yr.prototype.getPoint=function(t,e){void 0===e&&(e=new Ic);var n=e,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(qr(t,r.x,i.x,a.x,o.x),qr(t,r.y,i.y,a.y,o.y),qr(t,r.z,i.z,a.z,o.z)),n},Yr.prototype.copy=function(t){return Or.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this},Yr.prototype.toJSON=function(){var t=Or.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t},Yr.prototype.fromJSON=function(t){return Or.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this},Zr.prototype=Object.create(Or.prototype),Zr.prototype.constructor=Zr,Zr.prototype.isLineCurve=!0,Zr.prototype.getPoint=function(t,e){void 0===e&&(e=new Tc);var n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n},Zr.prototype.getPointAt=function(t,e){return this.getPoint(t,e)},Zr.prototype.getTangent=function(t,e){var n=e||new Tc;return n.copy(this.v2).sub(this.v1).normalize(),n},Zr.prototype.copy=function(t){return Or.prototype.copy.call(this,t),this.v1.copy(t.v1),this.v2.copy(t.v2),this},Zr.prototype.toJSON=function(){var t=Or.prototype.toJSON.call(this);return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},Zr.prototype.fromJSON=function(t){return Or.prototype.fromJSON.call(this,t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},Jr.prototype=Object.create(Or.prototype),Jr.prototype.constructor=Jr,Jr.prototype.isLineCurve3=!0,Jr.prototype.getPoint=function(t,e){void 0===e&&(e=new Ic);var n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n},Jr.prototype.getPointAt=function(t,e){return this.getPoint(t,e)},Jr.prototype.copy=function(t){return Or.prototype.copy.call(this,t),this.v1.copy(t.v1),this.v2.copy(t.v2),this},Jr.prototype.toJSON=function(){var t=Or.prototype.toJSON.call(this);return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},Jr.prototype.fromJSON=function(t){return Or.prototype.fromJSON.call(this,t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},Qr.prototype=Object.create(Or.prototype),Qr.prototype.constructor=Qr,Qr.prototype.isQuadraticBezierCurve=!0,Qr.prototype.getPoint=function(t,e){void 0===e&&(e=new Tc);var n=e,r=this.v0,i=this.v1,a=this.v2;return n.set(Ur(t,r.x,i.x,a.x),Ur(t,r.y,i.y,a.y)),n},Qr.prototype.copy=function(t){return Or.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this},Qr.prototype.toJSON=function(){var t=Or.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},Qr.prototype.fromJSON=function(t){return Or.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},Kr.prototype=Object.create(Or.prototype),Kr.prototype.constructor=Kr,Kr.prototype.isQuadraticBezierCurve3=!0,Kr.prototype.getPoint=function(t,e){void 0===e&&(e=new Ic);var n=e,r=this.v0,i=this.v1,a=this.v2;return n.set(Ur(t,r.x,i.x,a.x),Ur(t,r.y,i.y,a.y),Ur(t,r.z,i.z,a.z)),n},Kr.prototype.copy=function(t){return Or.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this},Kr.prototype.toJSON=function(){var t=Or.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},Kr.prototype.fromJSON=function(t){return Or.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},$r.prototype=Object.create(Or.prototype),$r.prototype.constructor=$r,$r.prototype.isSplineCurve=!0,$r.prototype.getPoint=function(t,e){void 0===e&&(e=new Tc);var n=e,r=this.points,i=(r.length-1)*t,a=Math.floor(i),o=i-a,s=r[0===a?a:a-1],c=r[a],l=r[a>r.length-2?r.length-1:a+1],u=r[a>r.length-3?r.length-1:a+2];return n.set(zr(o,s.x,c.x,l.x,u.x),zr(o,s.y,c.y,l.y,u.y)),n},$r.prototype.copy=function(t){Or.prototype.copy.call(this,t),this.points=[];for(var e=0,n=t.points.length;e<n;e++){var r=t.points[e];this.points.push(r.clone())}return this},$r.prototype.toJSON=function(){var t=Or.prototype.toJSON.call(this);t.points=[];for(var e=0,n=this.points.length;e<n;e++){var r=this.points[e];t.points.push(r.toArray())}return t},$r.prototype.fromJSON=function(t){Or.prototype.fromJSON.call(this,t),this.points=[];for(var e=0,n=t.points.length;e<n;e++){var r=t.points[e];this.points.push((new Tc).fromArray(r))}return this};var Ad=Object.freeze({__proto__:null,ArcCurve:Dr,CatmullRomCurve3:Br,CubicBezierCurve:Xr,CubicBezierCurve3:Yr,EllipseCurve:Ir,LineCurve:Zr,LineCurve3:Jr,QuadraticBezierCurve:Qr,QuadraticBezierCurve3:Kr,SplineCurve:$r});ti.prototype=Object.assign(Object.create(Or.prototype),{constructor:ti,add:function(t){this.curves.push(t)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new Zr(e,t))},getPoint:function(t){for(var e=t*this.getLength(),n=this.getCurveLengths(),r=0;r<n.length;){if(n[r]>=e){var i=n[r]-e,a=this.curves[r],o=a.getLength(),s=0===o?0:1-i/o;return a.getPointAt(s)}r++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,n=0,r=this.curves.length;n<r;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t},getSpacedPoints:function(t){void 0===t&&(t=40);for(var e=[],n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e},getPoints:function(t){void 0===t&&(t=12);for(var e,n=[],r=0,i=this.curves;r<i.length;r++)for(var a=i[r],o=a&&a.isEllipseCurve?2*t:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?t*a.points.length:t,s=a.getPoints(o),c=0;c<s.length;c++){
  142. var l=s[c];e&&e.equals(l)||(n.push(l),e=l)}return this.autoClose&&n.length>1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},copy:function(t){Or.prototype.copy.call(this,t),this.curves=[];for(var e=0,n=t.curves.length;e<n;e++){var r=t.curves[e];this.curves.push(r.clone())}return this.autoClose=t.autoClose,this},toJSON:function(){var t=Or.prototype.toJSON.call(this);t.autoClose=this.autoClose,t.curves=[];for(var e=0,n=this.curves.length;e<n;e++){var r=this.curves[e];t.curves.push(r.toJSON())}return t},fromJSON:function(t){Or.prototype.fromJSON.call(this,t),this.autoClose=t.autoClose,this.curves=[];for(var e=0,n=t.curves.length;e<n;e++){var r=t.curves[e];this.curves.push((new Ad[r.type]).fromJSON(r))}return this}}),ei.prototype=Object.assign(Object.create(ti.prototype),{constructor:ei,setFromPoints:function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this},moveTo:function(t,e){return this.currentPoint.set(t,e),this},lineTo:function(t,e){var n=new Zr(this.currentPoint.clone(),new Tc(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this},quadraticCurveTo:function(t,e,n,r){var i=new Qr(this.currentPoint.clone(),new Tc(t,e),new Tc(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this},bezierCurveTo:function(t,e,n,r,i,a){var o=new Xr(this.currentPoint.clone(),new Tc(t,e),new Tc(n,r),new Tc(i,a));return this.curves.push(o),this.currentPoint.set(i,a),this},splineThru:function(t){var e=[this.currentPoint.clone()].concat(t),n=new $r(e);return this.curves.push(n),this.currentPoint.copy(t[t.length-1]),this},arc:function(t,e,n,r,i,a){var o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(t+o,e+s,n,r,i,a),this},absarc:function(t,e,n,r,i,a){return this.absellipse(t,e,n,n,r,i,a),this},ellipse:function(t,e,n,r,i,a,o,s){var c=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(t+c,e+l,n,r,i,a,o,s),this},absellipse:function(t,e,n,r,i,a,o,s){var c=new Ir(t,e,n,r,i,a,o,s);if(this.curves.length>0){var l=c.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(c);var u=c.getPoint(1);return this.currentPoint.copy(u),this},copy:function(t){return ti.prototype.copy.call(this,t),this.currentPoint.copy(t.currentPoint),this},toJSON:function(){var t=ti.prototype.toJSON.call(this);return t.currentPoint=this.currentPoint.toArray(),t},fromJSON:function(t){return ti.prototype.fromJSON.call(this,t),this.currentPoint.fromArray(t.currentPoint),this}}),ni.prototype=Object.assign(Object.create(ei.prototype),{constructor:ni,getPointsHoles:function(t){for(var e=[],n=0,r=this.holes.length;n<r;n++)e[n]=this.holes[n].getPoints(t);return e},extractPoints:function(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}},copy:function(t){ei.prototype.copy.call(this,t),this.holes=[];for(var e=0,n=t.holes.length;e<n;e++){var r=t.holes[e];this.holes.push(r.clone())}return this},toJSON:function(){var t=ei.prototype.toJSON.call(this);t.uuid=this.uuid,t.holes=[];for(var e=0,n=this.holes.length;e<n;e++){var r=this.holes[e];t.holes.push(r.toJSON())}return t},fromJSON:function(t){ei.prototype.fromJSON.call(this,t),this.uuid=t.uuid,this.holes=[];for(var e=0,n=t.holes.length;e<n;e++){var r=t.holes[e];this.holes.push((new ei).fromJSON(r))}return this}}),ri.prototype=Object.assign(Object.create(f.prototype),{constructor:ri,isLight:!0,copy:function(t){return f.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){var e=f.prototype.toJSON.call(this,t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}),ii.prototype=Object.assign(Object.create(ri.prototype),{constructor:ii,isHemisphereLight:!0,copy:function(t){return ri.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}),Object.assign(ai.prototype,{_projScreenMatrix:new ol,_lightPositionWorld:new Ic,_lookTarget:new Ic,getViewportCount:function(){return this._viewportCount},getFrustum:function(){return this._frustum},updateMatrices:function(t){var e=this.camera,n=this.matrix,r=this._projScreenMatrix,i=this._lookTarget,a=this._lightPositionWorld;a.setFromMatrixPosition(t.matrixWorld),e.position.copy(a),i.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(i),e.updateMatrixWorld(),r.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(r),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(e.projectionMatrix),n.multiply(e.matrixWorldInverse)},getViewport:function(t){return this._viewports[t]},getFrameExtents:function(){return this._frameExtents},copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var t={};return 0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}),oi.prototype=Object.assign(Object.create(ai.prototype),{constructor:oi,isSpotLightShadow:!0,updateMatrices:function(t){var e=this.camera,n=2*Sc.RAD2DEG*t.angle*this.focus,r=this.mapSize.width/this.mapSize.height,i=t.distance||e.far;n===e.fov&&r===e.aspect&&i===e.far||(e.fov=n,e.aspect=r,e.far=i,e.updateProjectionMatrix()),ai.prototype.updateMatrices.call(this,t)}}),si.prototype=Object.assign(Object.create(ri.prototype),{constructor:si,isSpotLight:!0,copy:function(t){return ri.prototype.copy.call(this,t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),ci.prototype=Object.assign(Object.create(ai.prototype),{constructor:ci,isPointLightShadow:!0,updateMatrices:function(t,e){void 0===e&&(e=0);var n=this.camera,r=this.matrix,i=this._lightPositionWorld,a=this._lookTarget,o=this._projScreenMatrix;i.setFromMatrixPosition(t.matrixWorld),n.position.copy(i),a.copy(n.position),a.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(a),n.updateMatrixWorld(),r.makeTranslation(-i.x,-i.y,-i.z),o.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(o)}}),li.prototype=Object.assign(Object.create(ri.prototype),{constructor:li,isPointLight:!0,copy:function(t){return ri.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}),ui.prototype=Object.assign(Object.create(G.prototype),{constructor:ui,isOrthographicCamera:!0,copy:function(t,e){return G.prototype.copy.call(this,t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this},setViewOffset:function(t,e,n,r,i,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-t,a=n+t,o=r+e,s=r-e;if(null!==this.view&&this.view.enabled){var c=(this.right-this.left)/this.view.fullWidth/this.zoom,l=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=c*this.view.offsetX,a=i+c*this.view.width,o-=l*this.view.offsetY,s=o-l*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()},toJSON:function(t){var e=f.prototype.toJSON.call(this,t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}),hi.prototype=Object.assign(Object.create(ai.prototype),{constructor:hi,isDirectionalLightShadow:!0,updateMatrices:function(t){ai.prototype.updateMatrices.call(this,t)}}),di.prototype=Object.assign(Object.create(ri.prototype),{constructor:di,isDirectionalLight:!0,copy:function(t){return ri.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),pi.prototype=Object.assign(Object.create(ri.prototype),{constructor:pi,isAmbientLight:!0}),fi.prototype=Object.assign(Object.create(ri.prototype),{constructor:fi,isRectAreaLight:!0,copy:function(t){return ri.prototype.copy.call(this,t),this.width=t.width,this.height=t.height,this},toJSON:function(t){var e=ri.prototype.toJSON.call(this,t);return e.object.width=this.width,e.object.height=this.height,e}});var Ld=function(){function t(){Object.defineProperty(this,"isSphericalHarmonics3",{value:!0}),this.coefficients=[];for(var t=0;t<9;t++)this.coefficients.push(new Ic)}var e=t.prototype;return e.set=function(t){for(var e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this},e.zero=function(){for(var t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this},e.getAt=function(t,e){var n=t.x,r=t.y,i=t.z,a=this.coefficients;return e.copy(a[0]).multiplyScalar(.282095),e.addScaledVector(a[1],.488603*r),e.addScaledVector(a[2],.488603*i),e.addScaledVector(a[3],.488603*n),e.addScaledVector(a[4],n*r*1.092548),e.addScaledVector(a[5],r*i*1.092548),e.addScaledVector(a[6],.315392*(3*i*i-1)),e.addScaledVector(a[7],n*i*1.092548),e.addScaledVector(a[8],.546274*(n*n-r*r)),e},e.getIrradianceAt=function(t,e){var n=t.x,r=t.y,i=t.z,a=this.coefficients;return e.copy(a[0]).multiplyScalar(.886227),e.addScaledVector(a[1],1.023328*r),e.addScaledVector(a[2],1.023328*i),e.addScaledVector(a[3],1.023328*n),e.addScaledVector(a[4],.858086*n*r),e.addScaledVector(a[5],.858086*r*i),e.addScaledVector(a[6],.743125*i*i-.247708),e.addScaledVector(a[7],.858086*n*i),e.addScaledVector(a[8],.429043*(n*n-r*r)),e},e.add=function(t){for(var e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this},e.addScaledSH=function(t,e){for(var n=0;n<9;n++)this.coefficients[n].addScaledVector(t.coefficients[n],e);return this},e.scale=function(t){for(var e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this},e.lerp=function(t,e){for(var n=0;n<9;n++)this.coefficients[n].lerp(t.coefficients[n],e);return this},e.equals=function(t){for(var e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0},e.copy=function(t){return this.set(t.coefficients)},e.clone=function(){return(new this.constructor).copy(this)},e.fromArray=function(t,e){void 0===e&&(e=0);for(var n=this.coefficients,r=0;r<9;r++)n[r].fromArray(t,e+3*r);return this},e.toArray=function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);for(var n=this.coefficients,r=0;r<9;r++)n[r].toArray(t,e+3*r);return t},t.getBasisAt=function(t,e){var n=t.x,r=t.y,i=t.z;e[0]=.282095,e[1]=.488603*r,e[2]=.488603*i,e[3]=.488603*n,e[4]=1.092548*n*r,e[5]=1.092548*r*i,e[6]=.315392*(3*i*i-1),e[7]=1.092548*n*i,e[8]=.546274*(n*n-r*r)},t}();mi.prototype=Object.assign(Object.create(ri.prototype),{constructor:mi,isLightProbe:!0,copy:function(t){return ri.prototype.copy.call(this,t),this.sh.copy(t.sh),this},fromJSON:function(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this},toJSON:function(t){var e=ri.prototype.toJSON.call(this,t);return e.object.sh=this.sh.toArray(),e}}),vi.prototype=Object.assign(Object.create(Sr.prototype),{constructor:vi,load:function(t,e,n,r){var i=this,a=new Tr(i.manager);a.setPath(i.path),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(t,function(n){try{e(i.parse(JSON.parse(n)))}catch(e){r?r(e):console.error(e),i.manager.itemError(t)}},n,r)},parse:function(t){function e(t){return void 0===n[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),n[t]}var n=this.textures,r=new yd[t.type];if(void 0!==t.uuid&&(r.uuid=t.uuid),void 0!==t.name&&(r.name=t.name),void 0!==t.color&&void 0!==r.color&&r.color.setHex(t.color),void 0!==t.roughness&&(r.roughness=t.roughness),void 0!==t.metalness&&(r.metalness=t.metalness),void 0!==t.sheen&&(r.sheen=(new Zl).setHex(t.sheen)),void 0!==t.emissive&&void 0!==r.emissive&&r.emissive.setHex(t.emissive),void 0!==t.specular&&void 0!==r.specular&&r.specular.setHex(t.specular),void 0!==t.shininess&&(r.shininess=t.shininess),void 0!==t.clearcoat&&(r.clearcoat=t.clearcoat),void 0!==t.clearcoatRoughness&&(r.clearcoatRoughness=t.clearcoatRoughness),void 0!==t.fog&&(r.fog=t.fog),void 0!==t.flatShading&&(r.flatShading=t.flatShading),void 0!==t.blending&&(r.blending=t.blending),void 0!==t.combine&&(r.combine=t.combine),void 0!==t.side&&(r.side=t.side),void 0!==t.opacity&&(r.opacity=t.opacity),void 0!==t.transparent&&(r.transparent=t.transparent),void 0!==t.alphaTest&&(r.alphaTest=t.alphaTest),void 0!==t.depthTest&&(r.depthTest=t.depthTest),void 0!==t.depthWrite&&(r.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(r.colorWrite=t.colorWrite),void 0!==t.stencilWrite&&(r.stencilWrite=t.stencilWrite),void 0!==t.stencilWriteMask&&(r.stencilWriteMask=t.stencilWriteMask),void 0!==t.stencilFunc&&(r.stencilFunc=t.stencilFunc),void 0!==t.stencilRef&&(r.stencilRef=t.stencilRef),void 0!==t.stencilFuncMask&&(r.stencilFuncMask=t.stencilFuncMask),void 0!==t.stencilFail&&(r.stencilFail=t.stencilFail),void 0!==t.stencilZFail&&(r.stencilZFail=t.stencilZFail),void 0!==t.stencilZPass&&(r.stencilZPass=t.stencilZPass),void 0!==t.wireframe&&(r.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(r.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(r.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(r.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.rotation&&(r.rotation=t.rotation),1!==t.linewidth&&(r.linewidth=t.linewidth),void 0!==t.dashSize&&(r.dashSize=t.dashSize),void 0!==t.gapSize&&(r.gapSize=t.gapSize),void 0!==t.scale&&(r.scale=t.scale),void 0!==t.polygonOffset&&(r.polygonOffset=t.polygonOffset),void 0!==t.polygonOffsetFactor&&(r.polygonOffsetFactor=t.polygonOffsetFactor),void 0!==t.polygonOffsetUnits&&(r.polygonOffsetUnits=t.polygonOffsetUnits),void 0!==t.skinning&&(r.skinning=t.skinning),void 0!==t.morphTargets&&(r.morphTargets=t.morphTargets),void 0!==t.morphNormals&&(r.morphNormals=t.morphNormals),void 0!==t.dithering&&(r.dithering=t.dithering),void 0!==t.vertexTangents&&(r.vertexTangents=t.vertexTangents),void 0!==t.visible&&(r.visible=t.visible),void 0!==t.toneMapped&&(r.toneMapped=t.toneMapped),void 0!==t.userData&&(r.userData=t.userData),void 0!==t.vertexColors&&("number"==typeof t.vertexColors?r.vertexColors=t.vertexColors>0:r.vertexColors=t.vertexColors),void 0!==t.uniforms)for(var i in t.uniforms){var a=t.uniforms[i];switch(r.uniforms[i]={},a.type){case"t":r.uniforms[i].value=e(a.value);break;case"c":r.uniforms[i].value=(new Zl).setHex(a.value);break;case"v2":r.uniforms[i].value=(new Tc).fromArray(a.value);break;case"v3":r.uniforms[i].value=(new Ic).fromArray(a.value);break;case"v4":r.uniforms[i].value=(new Rc).fromArray(a.value);break;case"m3":r.uniforms[i].value=(new Ec).fromArray(a.value);break;case"m4":r.uniforms[i].value=(new ol).fromArray(a.value);break;default:r.uniforms[i].value=a.value}}if(void 0!==t.defines&&(r.defines=t.defines),void 0!==t.vertexShader&&(r.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(r.fragmentShader=t.fragmentShader),void 0!==t.extensions)for(var o in t.extensions)r.extensions[o]=t.extensions[o];if(void 0!==t.shading&&(r.flatShading=1===t.shading),void 0!==t.size&&(r.size=t.size),void 0!==t.sizeAttenuation&&(r.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(r.map=e(t.map)),void 0!==t.matcap&&(r.matcap=e(t.matcap)),void 0!==t.alphaMap&&(r.alphaMap=e(t.alphaMap)),void 0!==t.bumpMap&&(r.bumpMap=e(t.bumpMap)),void 0!==t.bumpScale&&(r.bumpScale=t.bumpScale),void 0!==t.normalMap&&(r.normalMap=e(t.normalMap)),void 0!==t.normalMapType&&(r.normalMapType=t.normalMapType),void 0!==t.normalScale){var s=t.normalScale;!1===Array.isArray(s)&&(s=[s,s]),r.normalScale=(new Tc).fromArray(s)}return void 0!==t.displacementMap&&(r.displacementMap=e(t.displacementMap)),void 0!==t.displacementScale&&(r.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(r.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(r.roughnessMap=e(t.roughnessMap)),void 0!==t.metalnessMap&&(r.metalnessMap=e(t.metalnessMap)),void 0!==t.emissiveMap&&(r.emissiveMap=e(t.emissiveMap)),void 0!==t.emissiveIntensity&&(r.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(r.specularMap=e(t.specularMap)),void 0!==t.envMap&&(r.envMap=e(t.envMap)),void 0!==t.envMapIntensity&&(r.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(r.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(r.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(r.lightMap=e(t.lightMap)),void 0!==t.lightMapIntensity&&(r.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(r.aoMap=e(t.aoMap)),void 0!==t.aoMapIntensity&&(r.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(r.gradientMap=e(t.gradientMap)),void 0!==t.clearcoatMap&&(r.clearcoatMap=e(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(r.clearcoatRoughnessMap=e(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(r.clearcoatNormalMap=e(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(r.clearcoatNormalScale=(new Tc).fromArray(t.clearcoatNormalScale)),void 0!==t.transmission&&(r.transmission=t.transmission),void 0!==t.transmissionMap&&(r.transmissionMap=e(t.transmissionMap)),r},setTextures:function(t){return this.textures=t,this}});var Rd={decodeText:function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);for(var e="",n=0,r=t.length;n<r;n++)e+=String.fromCharCode(t[n]);try{return decodeURIComponent(escape(e))}catch(t){return e}},extractUrlBase:function(t){var e=t.lastIndexOf("/");return-1===e?"./":t.substr(0,e+1)}};gi.prototype=Object.assign(Object.create(I.prototype),{constructor:gi,isInstancedBufferGeometry:!0,copy:function(t){return I.prototype.copy.call(this,t),this.instanceCount=t.instanceCount,this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var t=I.prototype.toJSON.call(this);return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}),yi.prototype=Object.assign(Object.create(_.prototype),{constructor:yi,isInstancedBufferAttribute:!0,copy:function(t){return _.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},toJSON:function(){var t=_.prototype.toJSON.call(this);return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}),xi.prototype=Object.assign(Object.create(Sr.prototype),{constructor:xi,load:function(t,e,n,r){var i=this,a=new Tr(i.manager);a.setPath(i.path),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(t,function(n){try{e(i.parse(JSON.parse(n)))}catch(e){r?r(e):console.error(e),i.manager.itemError(t)}},n,r)},parse:function(t){function e(t,e){if(void 0!==r[e])return r[e];var i=t.interleavedBuffers,a=i[e],o=n(t,a.buffer),s=O(a.type,o),c=new Ye(s,a.stride);return c.uuid=a.uuid,r[e]=c,c}function n(t,e){if(void 0!==i[e])return i[e];var n=t.arrayBuffers,r=n[e],a=new Uint32Array(r).buffer;return i[e]=a,a}var r={},i={},a=t.isInstancedBufferGeometry?new gi:new I,o=t.data.index;if(void 0!==o){var s=O(o.type,o.array);a.setIndex(new _(s,1))}var c=t.data.attributes;for(var l in c){var u=c[l],h=void 0;if(u.isInterleavedBufferAttribute){h=new Ze(e(t.data,u.data),u.itemSize,u.offset,u.normalized)}else{var d=O(u.type,u.array);h=new(u.isInstancedBufferAttribute?yi:_)(d,u.itemSize,u.normalized)}void 0!==u.name&&(h.name=u.name),a.setAttribute(l,h)}var p=t.data.morphAttributes;if(p)for(var f in p){for(var m=p[f],v=[],g=0,y=m.length;g<y;g++){var x=m[g],b=void 0;if(x.isInterleavedBufferAttribute){var w=e(t.data,x.data);b=new Ze(w,x.itemSize,x.offset,x.normalized)}else{var M=O(x.type,x.array);b=new _(M,x.itemSize,x.normalized)}void 0!==x.name&&(b.name=x.name),v.push(b)}a.morphAttributes[f]=v}t.data.morphTargetsRelative&&(a.morphTargetsRelative=!0);var S=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==S)for(var T=0,E=S.length;T!==E;++T){var A=S[T];a.addGroup(A.start,A.count,A.materialIndex)}var L=t.data.boundingSphere;if(void 0!==L){var R=new Ic;void 0!==L.center&&R.fromArray(L.center),a.boundingSphere=new Qc(R,L.radius)}return t.name&&(a.name=t.name),t.userData&&(a.userData=t.userData),a}});var Cd=function(t){function e(e){return t.call(this,e)||this}a(e,t);var n=e.prototype;return n.load=function(t,e,n,r){var i=this,a=""===this.path?Rd.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||a;var o=new Tr(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,function(n){var a=null;try{a=JSON.parse(n)}catch(e){return void 0!==r&&r(e),void console.error("THREE:ObjectLoader: Can't parse "+t+".",e.message)}var o=a.metadata;if(void 0===o||void 0===o.type||"geometry"===o.type.toLowerCase())return void console.error("THREE.ObjectLoader: Can't load "+t);i.parse(a,e)},n,r)},n.parse=function(t,e){var n=this.parseAnimations(t.animations),r=this.parseShapes(t.shapes),i=this.parseGeometries(t.geometries,r),a=this.parseImages(t.images,function(){void 0!==e&&e(c)}),o=this.parseTextures(t.textures,a),s=this.parseMaterials(t.materials,o),c=this.parseObject(t.object,i,s,n),l=this.parseSkeletons(t.skeletons,c);if(this.bindSkeletons(c,l),void 0!==e){var u=!1;for(var h in a)if(a[h]instanceof HTMLImageElement){u=!0;break}!1===u&&e(c)}return c},n.parseShapes=function(t){var e={};if(void 0!==t)for(var n=0,r=t.length;n<r;n++){var i=(new ni).fromJSON(t[n]);e[i.uuid]=i}return e},n.parseSkeletons=function(t,e){var n={},r={};if(e.traverse(function(t){t.isBone&&(r[t.uuid]=t)}),void 0!==t)for(var i=0,a=t.length;i<a;i++){var o=(new nn).fromJSON(t[i],r);n[o.uuid]=o}return n},n.parseGeometries=function(t,e){var n,r={};if(void 0!==t)for(var i=new xi,a=0,o=t.length;a<o;a++){var s=void 0,c=t[a];switch(c.type){case"PlaneGeometry":case"PlaneBufferGeometry":s=new gd[c.type](c.width,c.height,c.widthSegments,c.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":s=new gd[c.type](c.width,c.height,c.depth,c.widthSegments,c.heightSegments,c.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":s=new gd[c.type](c.radius,c.segments,c.thetaStart,c.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":s=new gd[c.type](c.radiusTop,c.radiusBottom,c.height,c.radialSegments,c.heightSegments,c.openEnded,c.thetaStart,c.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":s=new gd[c.type](c.radius,c.height,c.radialSegments,c.heightSegments,c.openEnded,c.thetaStart,c.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":s=new gd[c.type](c.radius,c.widthSegments,c.heightSegments,c.phiStart,c.phiLength,c.thetaStart,c.thetaLength);break;case"DodecahedronGeometry":case"DodecahedronBufferGeometry":case"IcosahedronGeometry":case"IcosahedronBufferGeometry":case"OctahedronGeometry":case"OctahedronBufferGeometry":case"TetrahedronGeometry":case"TetrahedronBufferGeometry":s=new gd[c.type](c.radius,c.detail);break;case"RingGeometry":case"RingBufferGeometry":s=new gd[c.type](c.innerRadius,c.outerRadius,c.thetaSegments,c.phiSegments,c.thetaStart,c.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":s=new gd[c.type](c.radius,c.tube,c.radialSegments,c.tubularSegments,c.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":s=new gd[c.type](c.radius,c.tube,c.tubularSegments,c.radialSegments,c.p,c.q);break;case"TubeGeometry":case"TubeBufferGeometry":s=new gd[c.type]((new Ad[c.path.type]).fromJSON(c.path),c.tubularSegments,c.radius,c.radialSegments,c.closed);break;case"LatheGeometry":case"LatheBufferGeometry":s=new gd[c.type](c.points,c.segments,c.phiStart,c.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":s=new gd[c.type](c.vertices,c.indices,c.radius,c.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":n=[];for(var l=0,u=c.shapes.length;l<u;l++){var h=e[c.shapes[l]];n.push(h)}s=new gd[c.type](n,c.curveSegments);break;case"ExtrudeGeometry":case"ExtrudeBufferGeometry":n=[];for(var d=0,p=c.shapes.length;d<p;d++){var f=e[c.shapes[d]];n.push(f)}var m=c.options.extrudePath;void 0!==m&&(c.options.extrudePath=(new Ad[m.type]).fromJSON(m)),s=new gd[c.type](n,c.options);break;case"BufferGeometry":case"InstancedBufferGeometry":s=i.parse(c);break;case"Geometry":if("THREE"in window&&"LegacyJSONLoader"in THREE){var v=new THREE.LegacyJSONLoader;s=v.parse(c,this.resourcePath).geometry}else console.error('THREE.ObjectLoader: You have to import LegacyJSONLoader in order load geometry data of type "Geometry".');break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+c.type+'"');continue}s.uuid=c.uuid,void 0!==c.name&&(s.name=c.name),!0===s.isBufferGeometry&&void 0!==c.userData&&(s.userData=c.userData),r[c.uuid]=s}return r},n.parseMaterials=function(t,e){var n={},r={};if(void 0!==t){var i=new vi;i.setTextures(e);for(var a=0,o=t.length;a<o;a++){var s=t[a];if("MultiMaterial"===s.type){for(var c=[],l=0;l<s.materials.length;l++){var u=s.materials[l];void 0===n[u.uuid]&&(n[u.uuid]=i.parse(u)),c.push(n[u.uuid])}r[s.uuid]=c}else void 0===n[s.uuid]&&(n[s.uuid]=i.parse(s)),r[s.uuid]=n[s.uuid]}}return r},n.parseAnimations=function(t){var e={};if(void 0!==t)for(var n=0;n<t.length;n++){var r=t[n],i=_r.parse(r);e[i.uuid]=i}return e},n.parseImages=function(t,e){function n(t){return a.manager.itemStart(t),i.load(t,function(){a.manager.itemEnd(t)},void 0,function(){a.manager.itemError(t),a.manager.itemEnd(t)})}function r(t){if("string"==typeof t){var e=t;return n(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(e)?e:a.resourcePath+e)}return t.data?{data:O(t.type,t.data),width:t.width,height:t.height}:null}var i,a=this,o={};if(void 0!==t&&t.length>0){var s=new Mr(e);i=new Lr(s),i.setCrossOrigin(this.crossOrigin);for(var c=0,l=t.length;c<l;c++){var u=t[c],h=u.url;if(Array.isArray(h)){o[u.uuid]=[];for(var d=0,p=h.length;d<p;d++){var f=h[d],m=r(f);null!==m&&(m instanceof HTMLImageElement?o[u.uuid].push(m):o[u.uuid].push(new W(m.data,m.width,m.height)))}}else{var v=r(u.url);null!==v&&(o[u.uuid]=v)}}}return o},n.parseTextures=function(t,e){function n(t,e){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),e[t])}var r={};if(void 0!==t)for(var i=0,a=t.length;i<a;i++){var o=t[i];void 0===o.image&&console.warn('THREE.ObjectLoader: No "image" specified for',o.uuid),void 0===e[o.image]&&console.warn("THREE.ObjectLoader: Undefined image",o.image);var s=void 0,c=e[o.image];Array.isArray(c)?(s=new V(c),6===c.length&&(s.needsUpdate=!0)):(s=c&&c.data?new W(c.data,c.width,c.height):new h(c),c&&(s.needsUpdate=!0)),s.uuid=o.uuid,void 0!==o.name&&(s.name=o.name),void 0!==o.mapping&&(s.mapping=n(o.mapping,Pd)),void 0!==o.offset&&s.offset.fromArray(o.offset),void 0!==o.repeat&&s.repeat.fromArray(o.repeat),void 0!==o.center&&s.center.fromArray(o.center),void 0!==o.rotation&&(s.rotation=o.rotation),void 0!==o.wrap&&(s.wrapS=n(o.wrap[0],Od),s.wrapT=n(o.wrap[1],Od)),void 0!==o.format&&(s.format=o.format),void 0!==o.type&&(s.type=o.type),void 0!==o.encoding&&(s.encoding=o.encoding),void 0!==o.minFilter&&(s.minFilter=n(o.minFilter,Id)),void 0!==o.magFilter&&(s.magFilter=n(o.magFilter,Id)),void 0!==o.anisotropy&&(s.anisotropy=o.anisotropy),void 0!==o.flipY&&(s.flipY=o.flipY),void 0!==o.premultiplyAlpha&&(s.premultiplyAlpha=o.premultiplyAlpha),void 0!==o.unpackAlignment&&(s.unpackAlignment=o.unpackAlignment),r[o.uuid]=s}return r},n.parseObject=function(t,e,n,r){function i(t){return void 0===e[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),e[t]}function a(t){if(void 0!==t){if(Array.isArray(t)){for(var e=[],r=0,i=t.length;r<i;r++){var a=t[r];void 0===n[a]&&console.warn("THREE.ObjectLoader: Undefined material",a),e.push(n[a])}return e}return void 0===n[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),n[t]}}var o,s,c;switch(t.type){case"Scene":o=new oh,void 0!==t.background&&Number.isInteger(t.background)&&(o.background=new Zl(t.background)),void 0!==t.fog&&("Fog"===t.fog.type?o.fog=new ah(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(o.fog=new ih(t.fog.color,t.fog.density)));break;case"PerspectiveCamera":o=new U(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(o.focus=t.focus),void 0!==t.zoom&&(o.zoom=t.zoom),void 0!==t.filmGauge&&(o.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(o.filmOffset=t.filmOffset),void 0!==t.view&&(o.view=Object.assign({},t.view));break;case"OrthographicCamera":o=new ui(t.left,t.right,t.top,t.bottom,t.near,t.far),void 0!==t.zoom&&(o.zoom=t.zoom),void 0!==t.view&&(o.view=Object.assign({},t.view));break;case"AmbientLight":o=new pi(t.color,t.intensity);break;case"DirectionalLight":o=new di(t.color,t.intensity);break;case"PointLight":o=new li(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":o=new fi(t.color,t.intensity,t.width,t.height);break;case"SpotLight":o=new si(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":o=new ii(t.color,t.groundColor,t.intensity);break;case"LightProbe":o=(new mi).fromJSON(t);break;case"SkinnedMesh":s=i(t.geometry),c=a(t.material),o=new tn(s,c),void 0!==t.bindMode&&(o.bindMode=t.bindMode),void 0!==t.bindMatrix&&o.bindMatrix.fromArray(t.bindMatrix),void 0!==t.skeleton&&(o.skeleton=t.skeleton);break;case"Mesh":s=i(t.geometry),c=a(t.material),o=new D(s,c);break;case"InstancedMesh":s=i(t.geometry),c=a(t.material);var l=t.count,u=t.instanceMatrix;o=new rn(s,c,l),o.instanceMatrix=new _(new Float32Array(u.array),16);break;case"LOD":o=new $e;break;case"Line":o=new on(i(t.geometry),a(t.material));break;case"LineLoop":o=new cn(i(t.geometry),a(t.material));break;case"LineSegments":o=new sn(i(t.geometry),a(t.material));break;case"PointCloud":case"Points":o=new un(i(t.geometry),a(t.material));break;case"Sprite":o=new Qe(a(t.material));break;case"Group":o=new Fe;break;case"Bone":o=new en;break;default:o=new f}if(o.uuid=t.uuid,void 0!==t.name&&(o.name=t.name),void 0!==t.matrix?(o.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(o.matrixAutoUpdate=t.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(void 0!==t.position&&o.position.fromArray(t.position),void 0!==t.rotation&&o.rotation.fromArray(t.rotation),void 0!==t.quaternion&&o.quaternion.fromArray(t.quaternion),void 0!==t.scale&&o.scale.fromArray(t.scale)),void 0!==t.castShadow&&(o.castShadow=t.castShadow),void 0!==t.receiveShadow&&(o.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(o.shadow.bias=t.shadow.bias),void 0!==t.shadow.normalBias&&(o.shadow.normalBias=t.shadow.normalBias),void 0!==t.shadow.radius&&(o.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&o.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(o.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(o.visible=t.visible),void 0!==t.frustumCulled&&(o.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(o.renderOrder=t.renderOrder),void 0!==t.userData&&(o.userData=t.userData),void 0!==t.layers&&(o.layers.mask=t.layers),void 0!==t.children)for(var h=t.children,d=0;d<h.length;d++)o.add(this.parseObject(h[d],e,n,r));if(void 0!==t.animations)for(var p=t.animations,m=0;m<p.length;m++){var v=p[m];o.animations.push(r[v])}
  143. if("LOD"===t.type){void 0!==t.autoUpdate&&(o.autoUpdate=t.autoUpdate);for(var g=t.levels,y=0;y<g.length;y++){var x=g[y],b=o.getObjectByProperty("uuid",x.object);void 0!==b&&o.addLevel(b,x.distance)}}return o},n.bindSkeletons=function(t,e){0!==Object.keys(e).length&&t.traverse(function(t){if(!0===t.isSkinnedMesh&&void 0!==t.skeleton){var n=e[t.skeleton];void 0===n?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",t.skeleton):t.bind(n,t.bindMatrix)}})},n.setTexturePath=function(t){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(t)},e}(Sr),Pd={UVMapping:300,CubeReflectionMapping:Ao,CubeRefractionMapping:Lo,EquirectangularReflectionMapping:Ro,EquirectangularRefractionMapping:Co,CubeUVReflectionMapping:Po,CubeUVRefractionMapping:Oo},Od={RepeatWrapping:Io,ClampToEdgeWrapping:Do,MirroredRepeatWrapping:No},Id={NearestFilter:Bo,NearestMipmapNearestFilter:zo,NearestMipmapLinearFilter:Fo,LinearFilter:Ho,LinearMipmapNearestFilter:Go,LinearMipmapLinearFilter:Uo};_i.prototype=Object.assign(Object.create(Sr.prototype),{constructor:_i,isImageBitmapLoader:!0,setOptions:function(t){return this.options=t,this},load:function(t,e,n,r){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var i=this,a=_d.get(t);if(void 0!==a)return i.manager.itemStart(t),setTimeout(function(){e&&e(a),i.manager.itemEnd(t)},0),a;var o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",fetch(t,o).then(function(t){return t.blob()}).then(function(t){return createImageBitmap(t,i.options)}).then(function(n){_d.add(t,n),e&&e(n),i.manager.itemEnd(t)}).catch(function(e){r&&r(e),i.manager.itemError(t),i.manager.itemEnd(t)}),i.manager.itemStart(t)}}),Object.assign(bi.prototype,{moveTo:function(t,e){return this.currentPath=new ei,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this},lineTo:function(t,e){return this.currentPath.lineTo(t,e),this},quadraticCurveTo:function(t,e,n,r){return this.currentPath.quadraticCurveTo(t,e,n,r),this},bezierCurveTo:function(t,e,n,r,i,a){return this.currentPath.bezierCurveTo(t,e,n,r,i,a),this},splineThru:function(t){return this.currentPath.splineThru(t),this},toShapes:function(t,e){function n(t){for(var e=[],n=0,r=t.length;n<r;n++){var i=t[n],a=new ni;a.curves=i.curves,e.push(a)}return e}var r=nd.isClockWise,i=this.subPaths;if(0===i.length)return[];if(!0===e)return n(i);var a,o,s,c=[];if(1===i.length)return o=i[0],s=new ni,s.curves=o.curves,c.push(s),c;var l=!r(i[0].getPoints());l=t?!l:l;var u,h=[],d=[],p=[],f=0;d[f]=void 0,p[f]=[];for(var m=0,v=i.length;m<v;m++)o=i[m],u=o.getPoints(),a=r(u),a=t?!a:a,a?(!l&&d[f]&&f++,d[f]={s:new ni,p:u},d[f].s.curves=o.curves,l&&f++,p[f]=[]):p[f].push({h:o,p:u[0]});if(!d[0])return n(i);if(d.length>1){for(var g=!1,y=[],x=0,_=d.length;x<_;x++)h[x]=[];for(var b=0,w=d.length;b<w;b++)for(var M=p[b],S=0;S<M.length;S++){for(var T=M[S],E=!0,A=0;A<d.length;A++)(function(t,e){for(var n=e.length,r=!1,i=n-1,a=0;a<n;i=a++){var o=e[i],s=e[a],c=s.x-o.x,l=s.y-o.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(o=e[a],c=-c,s=e[i],l=-l),t.y<o.y||t.y>s.y)continue;if(t.y===o.y){if(t.x===o.x)return!0}else{var u=l*(t.x-o.x)-c*(t.y-o.y);if(0===u)return!0;if(u<0)continue;r=!r}}else{if(t.y!==o.y)continue;if(s.x<=t.x&&t.x<=o.x||o.x<=t.x&&t.x<=s.x)return!0}}return r})(T.p,d[A].p)&&(b!==A&&y.push({froms:b,tos:A,hole:S}),E?(E=!1,h[A].push(T)):g=!0);E&&h[b].push(T)}y.length>0&&(g||(p=h))}for(var L,R=0,C=d.length;R<C;R++){s=d[R].s,c.push(s),L=p[R];for(var P=0,O=L.length;P<O;P++)s.holes.push(L[P].h)}return c}});var Dd=function(){function t(t){Object.defineProperty(this,"isFont",{value:!0}),this.type="Font",this.data=t}return t.prototype.generateShapes=function(t,e){void 0===e&&(e=100);for(var n=[],r=wi(t,e,this.data),i=0,a=r.length;i<a;i++)Array.prototype.push.apply(n,r[i].toShapes());return n},t}();Si.prototype=Object.assign(Object.create(Sr.prototype),{constructor:Si,load:function(t,e,n,r){var i=this,a=new Tr(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(i.withCredentials),a.load(t,function(t){var n;try{n=JSON.parse(t)}catch(e){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),n=JSON.parse(t.substring(65,t.length-2))}var r=i.parse(n);e&&e(r)},n,r)},parse:function(t){return new Dd(t)}});var Nd,Bd={getContext:function(){return void 0===Nd&&(Nd=new(window.AudioContext||window.webkitAudioContext)),Nd},setContext:function(t){Nd=t}};Ti.prototype=Object.assign(Object.create(Sr.prototype),{constructor:Ti,load:function(t,e,n,r){var i=this,a=new Tr(i.manager);a.setResponseType("arraybuffer"),a.setPath(i.path),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(t,function(n){try{var a=n.slice(0);Bd.getContext().decodeAudioData(a,function(t){e(t)})}catch(e){r?r(e):console.error(e),i.manager.itemError(t)}},n,r)}}),Ei.prototype=Object.assign(Object.create(mi.prototype),{constructor:Ei,isHemisphereLightProbe:!0,copy:function(t){return mi.prototype.copy.call(this,t),this},toJSON:function(t){return mi.prototype.toJSON.call(this,t)}}),Ai.prototype=Object.assign(Object.create(mi.prototype),{constructor:Ai,isAmbientLightProbe:!0,copy:function(t){return mi.prototype.copy.call(this,t),this},toJSON:function(t){return mi.prototype.toJSON.call(this,t)}});var zd=new ol,Fd=new ol;Object.assign(Li.prototype,{update:function(t){var e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep;var n,r,i=t.projectionMatrix.clone(),a=e.eyeSep/2,o=a*e.near/e.focus,s=e.near*Math.tan(Sc.DEG2RAD*e.fov*.5)/e.zoom;Fd.elements[12]=-a,zd.elements[12]=a,n=-s*e.aspect+o,r=s*e.aspect+o,i.elements[0]=2*e.near/(r-n),i.elements[8]=(r+n)/(r-n),this.cameraL.projectionMatrix.copy(i),n=-s*e.aspect-o,r=s*e.aspect-o,i.elements[0]=2*e.near/(r-n),i.elements[8]=(r+n)/(r-n),this.cameraR.projectionMatrix.copy(i)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(Fd),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(zd)}});var Hd=function(){function t(t){this.autoStart=void 0===t||t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}var e=t.prototype;return e.start=function(){this.startTime=Ri(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},e.stop=function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},e.getElapsedTime=function(){return this.getDelta(),this.elapsedTime},e.getDelta=function(){var t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var e=Ri();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t},t}(),Gd=new Ic,Ud=new Oc,kd=new Ic,Vd=new Ic,Wd=function(t){function e(){var e;return e=t.call(this)||this,e.type="AudioListener",e.context=Bd.getContext(),e.gain=e.context.createGain(),e.gain.connect(e.context.destination),e.filter=null,e.timeDelta=0,e._clock=new Hd,e}a(e,t);var n=e.prototype;return n.getInput=function(){return this.gain},n.removeFilter=function(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this},n.getFilter=function(){return this.filter},n.setFilter=function(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this},n.getMasterVolume=function(){return this.gain.gain.value},n.setMasterVolume=function(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this},n.updateMatrixWorld=function(e){t.prototype.updateMatrixWorld.call(this,e);var n=this.context.listener,r=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Gd,Ud,kd),Vd.set(0,0,-1).applyQuaternion(Ud),n.positionX){var i=this.context.currentTime+this.timeDelta;n.positionX.linearRampToValueAtTime(Gd.x,i),n.positionY.linearRampToValueAtTime(Gd.y,i),n.positionZ.linearRampToValueAtTime(Gd.z,i),n.forwardX.linearRampToValueAtTime(Vd.x,i),n.forwardY.linearRampToValueAtTime(Vd.y,i),n.forwardZ.linearRampToValueAtTime(Vd.z,i),n.upX.linearRampToValueAtTime(r.x,i),n.upY.linearRampToValueAtTime(r.y,i),n.upZ.linearRampToValueAtTime(r.z,i)}else n.setPosition(Gd.x,Gd.y,Gd.z),n.setOrientation(Vd.x,Vd.y,Vd.z,r.x,r.y,r.z)},e}(f),jd=function(t){function e(e){var n;return n=t.call(this)||this,n.type="Audio",n.listener=e,n.context=e.context,n.gain=n.context.createGain(),n.gain.connect(e.getInput()),n.autoplay=!1,n.buffer=null,n.detune=0,n.loop=!1,n.loopStart=0,n.loopEnd=0,n.offset=0,n.duration=void 0,n.playbackRate=1,n.isPlaying=!1,n.hasPlaybackControl=!0,n.source=null,n.sourceType="empty",n._startedAt=0,n._progress=0,n._connected=!1,n.filters=[],n}a(e,t);var n=e.prototype;return n.getOutput=function(){return this.gain},n.setNodeSource=function(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this},n.setMediaElementSource=function(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this},n.setMediaStreamSource=function(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this},n.setBuffer=function(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this},n.play=function(t){if(void 0===t&&(t=0),!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+t;var e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()},n.pause=function(){return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this)},n.stop=function(){return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this)},n.connect=function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this},n.disconnect=function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this},n.getFilters=function(){return this.filters},n.setFilters=function(t){return t||(t=[]),!0===this._connected?(this.disconnect(),this.filters=t.slice(),this.connect()):this.filters=t.slice(),this},n.setDetune=function(t){if(this.detune=t,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this},n.getDetune=function(){return this.detune},n.getFilter=function(){return this.getFilters()[0]},n.setFilter=function(t){return this.setFilters(t?[t]:[])},n.setPlaybackRate=function(t){return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this)},n.getPlaybackRate=function(){return this.playbackRate},n.onEnded=function(){this.isPlaying=!1},n.getLoop=function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop},n.setLoop=function(t){return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this)},n.setLoopStart=function(t){return this.loopStart=t,this},n.setLoopEnd=function(t){return this.loopEnd=t,this},n.getVolume=function(){return this.gain.gain.value},n.setVolume=function(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this},e}(f),qd=new Ic,Xd=new Oc,Yd=new Ic,Zd=new Ic,Jd=function(t){function e(e){var n;return n=t.call(this,e)||this,n.panner=n.context.createPanner(),n.panner.panningModel="HRTF",n.panner.connect(n.gain),n}a(e,t);var n=e.prototype;return n.getOutput=function(){return this.panner},n.getRefDistance=function(){return this.panner.refDistance},n.setRefDistance=function(t){return this.panner.refDistance=t,this},n.getRolloffFactor=function(){return this.panner.rolloffFactor},n.setRolloffFactor=function(t){return this.panner.rolloffFactor=t,this},n.getDistanceModel=function(){return this.panner.distanceModel},n.setDistanceModel=function(t){return this.panner.distanceModel=t,this},n.getMaxDistance=function(){return this.panner.maxDistance},n.setMaxDistance=function(t){return this.panner.maxDistance=t,this},n.setDirectionalCone=function(t,e,n){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=n,this},n.updateMatrixWorld=function(e){if(t.prototype.updateMatrixWorld.call(this,e),!0!==this.hasPlaybackControl||!1!==this.isPlaying){this.matrixWorld.decompose(qd,Xd,Yd),Zd.set(0,0,1).applyQuaternion(Xd);var n=this.panner;if(n.positionX){var r=this.context.currentTime+this.listener.timeDelta;n.positionX.linearRampToValueAtTime(qd.x,r),n.positionY.linearRampToValueAtTime(qd.y,r),n.positionZ.linearRampToValueAtTime(qd.z,r),n.orientationX.linearRampToValueAtTime(Zd.x,r),n.orientationY.linearRampToValueAtTime(Zd.y,r),n.orientationZ.linearRampToValueAtTime(Zd.z,r)}else n.setPosition(qd.x,qd.y,qd.z),n.setOrientation(Zd.x,Zd.y,Zd.z)}},e}(jd),Qd=function(){function t(t,e){void 0===e&&(e=2048),this.analyser=t.context.createAnalyser(),this.analyser.fftSize=e,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}var e=t.prototype;return e.getFrequencyData=function(){return this.analyser.getByteFrequencyData(this.data),this.data},e.getAverageFrequency=function(){for(var t=0,e=this.getFrequencyData(),n=0;n<e.length;n++)t+=e[n];return t/e.length},t}();Object.assign(Ci.prototype,{accumulate:function(t,e){var n=this.buffer,r=this.valueSize,i=t*r+r,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==r;++o)n[i+o]=n[o];a=e}else{a+=e;var s=e/a;this._mixBufferRegion(n,i,0,s,r)}this.cumulativeWeight=a},accumulateAdditive:function(t){var e=this.buffer,n=this.valueSize,r=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,r,0,t,n),this.cumulativeWeightAdditive+=t},apply:function(t){var e=this.valueSize,n=this.buffer,r=t*e+e,i=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,i<1){var s=e*this._origIndex;this._mixBufferRegion(n,r,s,1-i,e)}a>0&&this._mixBufferRegionAdditive(n,r,this._addIndex*e,1,e);for(var c=e,l=e+e;c!==l;++c)if(n[c]!==n[c+e]){o.setValue(n,r);break}},saveOriginalState:function(){var t=this.binding,e=this.buffer,n=this.valueSize,r=n*this._origIndex;t.getValue(e,r);for(var i=n,a=r;i!==a;++i)e[i]=e[r+i%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0},restoreOriginalState:function(){var t=3*this.valueSize;this.binding.setValue(this.buffer,t)},_setAdditiveIdentityNumeric:function(){for(var t=this._addIndex*this.valueSize,e=t+this.valueSize,n=t;n<e;n++)this.buffer[n]=0},_setAdditiveIdentityQuaternion:function(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1},_setAdditiveIdentityOther:function(){for(var t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize,n=0;n<this.valueSize;n++)this.buffer[e+n]=this.buffer[t+n]},_select:function(t,e,n,r,i){if(r>=.5)for(var a=0;a!==i;++a)t[e+a]=t[n+a]},_slerp:function(t,e,n,r){Oc.slerpFlat(t,e,t,e,t,n,r)},_slerpAdditive:function(t,e,n,r,i){var a=this._workIndex*i;Oc.multiplyQuaternionsFlat(t,a,t,e,t,n),Oc.slerpFlat(t,e,t,e,t,a,r)},_lerp:function(t,e,n,r,i){for(var a=1-r,o=0;o!==i;++o){var s=e+o;t[s]=t[s]*a+t[n+o]*r}},_lerpAdditive:function(t,e,n,r,i){for(var a=0;a!==i;++a){var o=e+a;t[o]=t[o]+t[n+a]*r}}});var Kd="\\[\\]\\.:\\/",$d=new RegExp("["+Kd+"]","g"),tp="[^"+Kd+"]",ep="[^"+Kd.replace("\\.","")+"]",np=/((?:WC+[\/:])*)/.source.replace("WC",tp),rp=/(WCOD+)?/.source.replace("WCOD",ep),ip=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",tp),ap=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",tp),op=new RegExp("^"+np+rp+ip+ap+"$"),sp=["material","materials","bones"];Object.assign(Pi.prototype,{getValue:function(t,e){this.bind();var n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(t,e)},setValue:function(t,e){for(var n=this._bindings,r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(t,e)},bind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()},unbind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}}),Object.assign(Oi,{Composite:Pi,create:function(t,e,n){return t&&t.isAnimationObjectGroup?new Oi.Composite(t,e,n):new Oi(t,e,n)},sanitizeNodeName:function(t){return t.replace(/\s/g,"_").replace($d,"")},parseTrackName:function(t){var e=op.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);var n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){var i=n.nodeName.substring(r+1);-1!==sp.indexOf(i)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=i)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n},findNode:function(t,e){if(!e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){var n=t.skeleton.getBoneByName(e);if(void 0!==n)return n}if(t.children){var r=function t(n){for(var r=0;r<n.length;r++){var i=n[r];if(i.name===e||i.uuid===e)return i;var a=t(i.children);if(a)return a}return null}(t.children);if(r)return r}return null}}),Object.assign(Oi.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(t,e){t[e]=this.node[this.propertyName]},function(t,e){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)t[e++]=n[r]},function(t,e){t[e]=this.resolvedProperty[this.propertyIndex]},function(t,e){this.resolvedProperty.toArray(t,e)}],SetterByBindingTypeAndVersioning:[[function(t,e){this.targetObject[this.propertyName]=t[e]},function(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=t[e++]},function(t,e){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=t[e++];this.targetObject.needsUpdate=!0},function(t,e){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty[this.propertyIndex]=t[e]},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty.fromArray(t,e)},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){var t=this.node,e=this.parsedPath,n=e.objectName,r=e.propertyName,i=e.propertyIndex;if(t||(t=Oi.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");if(n){var a=e.objectIndex;switch(n){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(var o=0;o<t.length;o++)if(t[o].name===a){a=o;break}break;default:if(void 0===t[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[n]}if(void 0!==a){if(void 0===t[a])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[a]}}var s=t[r];if(void 0===s){var c=e.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",t)}var l=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?l=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(l=this.Versioning.MatrixWorldNeedsUpdate);var u=this.BindingType.Direct;if(void 0!==i){if("morphTargetInfluences"===r){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[i]&&(i=t.morphTargetDictionary[i])}u=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=i}else void 0!==s.fromArray&&void 0!==s.toArray?(u=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(u=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=r;this.getValue=this.GetterByBindingType[u],this.setValue=this.SetterByBindingTypeAndVersioning[u][l]},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(Oi.prototype,{_getValue_unbound:Oi.prototype.getValue,_setValue_unbound:Oi.prototype.setValue}),Object.assign(Ii.prototype,{isAnimationObjectGroup:!0,add:function(){for(var t=this._objects,e=this._indicesByUUID,n=this._paths,r=this._parsedPaths,i=this._bindings,a=i.length,o=void 0,s=t.length,c=this.nCachedObjects_,l=0,u=arguments.length;l!==u;++l){var h=arguments[l],d=h.uuid,p=e[d];if(void 0===p){p=s++,e[d]=p,t.push(h);for(var f=0,m=a;f!==m;++f)i[f].push(new Oi(h,n[f],r[f]))}else if(p<c){o=t[p];var v=--c,g=t[v];e[g.uuid]=p,t[p]=g,e[d]=v,t[v]=h;for(var y=0,x=a;y!==x;++y){var _=i[y],b=_[v],w=_[p];_[p]=b,void 0===w&&(w=new Oi(h,n[y],r[y])),_[v]=w}}else t[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_=c},remove:function(){for(var t=this._objects,e=this._indicesByUUID,n=this._bindings,r=n.length,i=this.nCachedObjects_,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],c=s.uuid,l=e[c];if(void 0!==l&&l>=i){var u=i++,h=t[u];e[h.uuid]=l,t[l]=h,e[c]=u,t[u]=s;for(var d=0,p=r;d!==p;++d){var f=n[d],m=f[u],v=f[l];f[l]=m,f[u]=v}}}this.nCachedObjects_=i},uncache:function(){for(var t=this._objects,e=this._indicesByUUID,n=this._bindings,r=n.length,i=this.nCachedObjects_,a=t.length,o=0,s=arguments.length;o!==s;++o){var c=arguments[o],l=c.uuid,u=e[l];if(void 0!==u)if(delete e[l],u<i){var h=--i,d=t[h],p=--a,f=t[p];e[d.uuid]=u,t[u]=d,e[f.uuid]=h,t[h]=f,t.pop();for(var m=0,v=r;m!==v;++m){var g=n[m],y=g[h],x=g[p];g[u]=y,g[h]=x,g.pop()}}else{var _=--a,b=t[_];_>0&&(e[b.uuid]=u),t[u]=b,t.pop();for(var w=0,M=r;w!==M;++w){var S=n[w];S[u]=S[_],S.pop()}}}this.nCachedObjects_=i},subscribe_:function(t,e){var n=this._bindingsIndicesByPath,r=n[t],i=this._bindings;if(void 0!==r)return i[r];var a=this._paths,o=this._parsedPaths,s=this._objects,c=s.length,l=this.nCachedObjects_,u=new Array(c);r=i.length,n[t]=r,a.push(t),o.push(e),i.push(u);for(var h=l,d=s.length;h!==d;++h){var p=s[h];u[h]=new Oi(p,t,e)}return u},unsubscribe_:function(t){var e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){var r=this._paths,i=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o];e[t[o]]=n,a[n]=s,a.pop(),i[n]=i[o],i.pop(),r[n]=r[o],r.pop()}}});var cp=function(){function t(t,e,n,r){void 0===n&&(n=null),void 0===r&&(r=e.blendMode),this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=r;for(var i=e.tracks,a=i.length,o=new Array(a),s={endingStart:ec,endingEnd:ec},c=0;c!==a;++c){var l=i[c].createInterpolant(null);o[c]=l,l.settings=s}this._interpolantSettings=s,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=tc,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}var e=t.prototype;return e.play=function(){return this._mixer._activateAction(this),this},e.stop=function(){return this._mixer._deactivateAction(this),this.reset()},e.reset=function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},e.isRunning=function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},e.isScheduled=function(){return this._mixer._isActiveAction(this)},e.startAt=function(t){return this._startTime=t,this},e.setLoop=function(t,e){return this.loop=t,this.repetitions=e,this},e.setEffectiveWeight=function(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()},e.getEffectiveWeight=function(){return this._effectiveWeight},e.fadeIn=function(t){return this._scheduleFading(t,0,1)},e.fadeOut=function(t){return this._scheduleFading(t,1,0)},e.crossFadeFrom=function(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){var r=this._clip.duration,i=t._clip.duration,a=i/r,o=r/i;t.warp(1,a,e),this.warp(o,1,e)}return this},e.crossFadeTo=function(t,e,n){return t.crossFadeFrom(this,e,n)},e.stopFading=function(){var t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},e.setEffectiveTimeScale=function(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()},e.getEffectiveTimeScale=function(){return this._effectiveTimeScale},e.setDuration=function(t){return this.timeScale=this._clip.duration/t,this.stopWarping()},e.syncWith=function(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()},e.halt=function(t){return this.warp(this._effectiveTimeScale,0,t)},e.warp=function(t,e,n){var r=this._mixer,i=r.time,a=this.timeScale,o=this._timeScaleInterpolant;null===o&&(o=r._lendControlInterpolant(),this._timeScaleInterpolant=o);var s=o.parameterPositions,c=o.sampleValues;return s[0]=i,s[1]=i+n,c[0]=t/a,c[1]=e/a,this},e.stopWarping=function(){var t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},e.getMixer=function(){return this._mixer},e.getClip=function(){return this._clip},e.getRoot=function(){return this._localRoot||this._mixer._root},e._update=function(t,e,n,r){if(!this.enabled)return void this._updateWeight(t);var i=this._startTime;if(null!==i){var a=(t-i)*n;if(a<0||0===n)return;this._startTime=null,e=n*a}e*=this._updateTimeScale(t);var o=this._updateTime(e),s=this._updateWeight(t);if(s>0){var c=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case 2501:for(var u=0,h=c.length;u!==h;++u)c[u].evaluate(o),l[u].accumulateAdditive(s);break;case nc:default:for(var d=0,p=c.length;d!==p;++d)c[d].evaluate(o),l[d].accumulate(r,s)}}},e._updateWeight=function(t){var e=0;if(this.enabled){e=this.weight;var n=this._weightInterpolant;if(null!==n){var r=n.evaluate(t)[0];e*=r,t>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=e,e},e._updateTimeScale=function(t){var e=0;if(!this.paused){e=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n){e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e},e._updateTime=function(t){var e=this._clip.duration,n=this.loop,r=this.time+t,i=this._loopCount,a=2202===n;if(0===t)return-1===i?r:a&&1==(1&i)?e-r:r;if(2200===n){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(r>=e)r=e;else{if(!(r<0)){this.time=r;break t}r=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===i&&(t>=0?(i=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),r>=e||r<0){var o=Math.floor(r/e);r-=e*o,i+=Math.abs(o);var s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=t>0?e:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===s){var c=t<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=r;if(a&&1==(1&i))return e-r}return r},e._setEndings=function(t,e,n){var r=this._interpolantSettings;n?(r.endingStart=2401,r.endingEnd=2401):(r.endingStart=t?this.zeroSlopeAtStart?2401:ec:2402,r.endingEnd=e?this.zeroSlopeAtEnd?2401:ec:2402)},e._scheduleFading=function(t,e,n){var r=this._mixer,i=r.time,a=this._weightInterpolant;null===a&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=i,s[0]=e,o[1]=i+t,s[1]=n,this},t}();Di.prototype=Object.assign(Object.create(u.prototype),{constructor:Di,_bindAction:function(t,e){var n=t._localRoot||this._root,r=t._clip.tracks,i=r.length,a=t._propertyBindings,o=t._interpolants,s=n.uuid,c=this._bindingsByRootAndName,l=c[s];void 0===l&&(l={},c[s]=l);for(var u=0;u!==i;++u){var h=r[u],d=h.name,p=l[d];if(void 0!==p)a[u]=p;else{if(void 0!==(p=a[u])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,d));continue}var f=e&&e._propertyBindings[u].binding.parsedPath;p=new Ci(Oi.create(n,d,f),h.ValueTypeName,h.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,s,d),a[u]=p}
  144. o[u].resultBuffer=p.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,n=t._clip.uuid,r=this._actionsByClip[n];this._bindAction(t,r&&r.knownActions[0]),this._addInactiveAction(t,n,e)}for(var i=t._propertyBindings,a=0,o=i.length;a!==o;++a){var s=i[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,n=0,r=e.length;n!==r;++n){var i=e[n];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){var e=t._cacheIndex;return null!==e&&e<this._nActiveActions},_addInactiveAction:function(t,e,n){var r=this._actions,i=this._actionsByClip,a=i[e];if(void 0===a)a={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,i[e]=a;else{var o=a.knownActions;t._byClipCacheIndex=o.length,o.push(t)}t._cacheIndex=r.length,r.push(t),a.actionByRoot[n]=t},_removeInactiveAction:function(t){var e=this._actions,n=e[e.length-1],r=t._cacheIndex;n._cacheIndex=r,e[r]=n,e.pop(),t._cacheIndex=null;var i=t._clip.uuid,a=this._actionsByClip,o=a[i],s=o.knownActions,c=s[s.length-1],l=t._byClipCacheIndex;c._byClipCacheIndex=l,s[l]=c,s.pop(),t._byClipCacheIndex=null,delete o.actionByRoot[(t._localRoot||this._root).uuid],0===s.length&&delete a[i],this._removeInactiveBindingsForAction(t)},_removeInactiveBindingsForAction:function(t){for(var e=t._propertyBindings,n=0,r=e.length;n!==r;++n){var i=e[n];0==--i.referenceCount&&this._removeInactiveBinding(i)}},_lendAction:function(t){var e=this._actions,n=t._cacheIndex,r=this._nActiveActions++,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i},_takeBackAction:function(t){var e=this._actions,n=t._cacheIndex,r=--this._nActiveActions,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i},_addInactiveBinding:function(t,e,n){var r=this._bindingsByRootAndName,i=this._bindings,a=r[e];void 0===a&&(a={},r[e]=a),a[n]=t,t._cacheIndex=i.length,i.push(t)},_removeInactiveBinding:function(t){var e=this._bindings,n=t.binding,r=n.rootNode.uuid,i=n.path,a=this._bindingsByRootAndName,o=a[r],s=e[e.length-1],c=t._cacheIndex;s._cacheIndex=c,e[c]=s,e.pop(),delete o[i],0===Object.keys(o).length&&delete a[r]},_lendBinding:function(t){var e=this._bindings,n=t._cacheIndex,r=this._nActiveBindings++,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i},_takeBackBinding:function(t){var e=this._bindings,n=t._cacheIndex,r=--this._nActiveBindings,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i},_lendControlInterpolant:function(){var t=this._controlInterpolants,e=this._nActiveControlInterpolants++,n=t[e];return void 0===n&&(n=new ur(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),n.__cacheIndex=e,t[e]=n),n},_takeBackControlInterpolant:function(t){var e=this._controlInterpolants,n=t.__cacheIndex,r=--this._nActiveControlInterpolants,i=e[r];t.__cacheIndex=r,e[r]=t,i.__cacheIndex=n,e[n]=i},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(t,e,n){var r=e||this._root,i=r.uuid,a="string"==typeof t?_r.findByName(r,t):t,o=null!==a?a.uuid:t,s=this._actionsByClip[o],c=null;if(void 0===n&&(n=null!==a?a.blendMode:nc),void 0!==s){var l=s.actionByRoot[i];if(void 0!==l&&l.blendMode===n)return l;c=s.knownActions[0],null===a&&(a=c._clip)}if(null===a)return null;var u=new cp(this,a,e,n);return this._bindAction(u,c),this._addInactiveAction(u,o,i),u},existingAction:function(t,e){var n=e||this._root,r=n.uuid,i="string"==typeof t?_r.findByName(n,t):t,a=i?i.uuid:t,o=this._actionsByClip[a];return void 0!==o?o.actionByRoot[r]||null:null},stopAllAction:function(){for(var t=this._actions,e=this._nActiveActions,n=e-1;n>=0;--n)t[n].stop();return this},update:function(t){t*=this.timeScale;for(var e=this._actions,n=this._nActiveActions,r=this.time+=t,i=Math.sign(t),a=this._accuIndex^=1,o=0;o!==n;++o){e[o]._update(r,t,i,a)}for(var s=this._bindings,c=this._nActiveBindings,l=0;l!==c;++l)s[l].apply(a);return this},setTime:function(t){this.time=0;for(var e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(t)},getRoot:function(){return this._root},uncacheClip:function(t){var e=this._actions,n=t.uuid,r=this._actionsByClip,i=r[n];if(void 0!==i){for(var a=i.knownActions,o=0,s=a.length;o!==s;++o){var c=a[o];this._deactivateAction(c);var l=c._cacheIndex,u=e[e.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,u._cacheIndex=l,e[l]=u,e.pop(),this._removeInactiveBindingsForAction(c)}delete r[n]}},uncacheRoot:function(t){var e=t.uuid,n=this._actionsByClip;for(var r in n){var i=n[r].actionByRoot,a=i[e];void 0!==a&&(this._deactivateAction(a),this._removeInactiveAction(a))}var o=this._bindingsByRootAndName,s=o[e];if(void 0!==s)for(var c in s){var l=s[c];l.restoreOriginalState(),this._removeInactiveBinding(l)}},uncacheAction:function(t,e){var n=this.existingAction(t,e);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}});var lp=function(){function t(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}return t.prototype.clone=function(){return new t(void 0===this.value.clone?this.value:this.value.clone())},t}();Ni.prototype=Object.assign(Object.create(Ye.prototype),{constructor:Ni,isInstancedInterleavedBuffer:!0,copy:function(t){return Ye.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},clone:function(t){var e=Ye.prototype.clone.call(this,t);return e.meshPerAttribute=this.meshPerAttribute,e},toJSON:function(t){var e=Ye.prototype.toJSON.call(this,t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}}),Object.defineProperty(Bi.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(Bi.prototype,{isGLBufferAttribute:!0,setBuffer:function(t){return this.buffer=t,this},setType:function(t,e){return this.type=t,this.elementSize=e,this},setItemSize:function(t){return this.itemSize=t,this},setCount:function(t){return this.count=t,this}}),Object.assign(zi.prototype,{set:function(t,e){this.ray.set(t,e)},setFromCamera:function(t,e){e&&e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e&&e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster: Unsupported camera type: "+e.type)},intersectObject:function(t,e,n){var r=n||[];return Hi(t,this,r,e),r.sort(Fi),r},intersectObjects:function(t,e,n){var r=n||[];if(!1===Array.isArray(t))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),r;for(var i=0,a=t.length;i<a;i++)Hi(t[i],this,r,e);return r.sort(Fi),r}});var up=function(){function t(t,e,n){return void 0===t&&(t=1),void 0===e&&(e=0),void 0===n&&(n=0),this.radius=t,this.phi=e,this.theta=n,this}var e=t.prototype;return e.set=function(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this},e.clone=function(){return(new this.constructor).copy(this)},e.copy=function(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this},e.makeSafe=function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this},e.setFromVector3=function(t){return this.setFromCartesianCoords(t.x,t.y,t.z)},e.setFromCartesianCoords=function(t,e,n){return this.radius=Math.sqrt(t*t+e*e+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,n),this.phi=Math.acos(Sc.clamp(e/this.radius,-1,1))),this},t}(),hp=function(){function t(t,e,n){return this.radius=void 0!==t?t:1,this.theta=void 0!==e?e:0,this.y=void 0!==n?n:0,this}var e=t.prototype;return e.set=function(t,e,n){return this.radius=t,this.theta=e,this.y=n,this},e.clone=function(){return(new this.constructor).copy(this)},e.copy=function(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this},e.setFromVector3=function(t){return this.setFromCartesianCoords(t.x,t.y,t.z)},e.setFromCartesianCoords=function(t,e,n){return this.radius=Math.sqrt(t*t+n*n),this.theta=Math.atan2(t,n),this.y=e,this},t}(),dp=new Tc,pp=function(){function t(t,e){Object.defineProperty(this,"isBox2",{value:!0}),this.min=void 0!==t?t:new Tc(1/0,1/0),this.max=void 0!==e?e:new Tc(-1/0,-1/0)}var e=t.prototype;return e.set=function(t,e){return this.min.copy(t),this.max.copy(e),this},e.setFromPoints=function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this},e.setFromCenterAndSize=function(t,e){var n=dp.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this},e.clone=function(){return(new this.constructor).copy(this)},e.copy=function(t){return this.min.copy(t.min),this.max.copy(t.max),this},e.makeEmpty=function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},e.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y},e.getCenter=function(t){return void 0===t&&(console.warn("THREE.Box2: .getCenter() target is now required"),t=new Tc),this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},e.getSize=function(t){return void 0===t&&(console.warn("THREE.Box2: .getSize() target is now required"),t=new Tc),this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)},e.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},e.expandByVector=function(t){return this.min.sub(t),this.max.add(t),this},e.expandByScalar=function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},e.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)},e.containsBox=function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},e.getParameter=function(t,e){return void 0===e&&(console.warn("THREE.Box2: .getParameter() target is now required"),e=new Tc),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},e.intersectsBox=function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)},e.clampPoint=function(t,e){return void 0===e&&(console.warn("THREE.Box2: .clampPoint() target is now required"),e=new Tc),e.copy(t).clamp(this.min,this.max)},e.distanceToPoint=function(t){return dp.copy(t).clamp(this.min,this.max).sub(t).length()},e.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this},e.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.translate=function(t){return this.min.add(t),this.max.add(t),this},e.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},t}(),fp=new Ic,mp=new Ic,vp=function(){function t(t,e){this.start=void 0!==t?t:new Ic,this.end=void 0!==e?e:new Ic}var e=t.prototype;return e.set=function(t,e){return this.start.copy(t),this.end.copy(e),this},e.clone=function(){return(new this.constructor).copy(this)},e.copy=function(t){return this.start.copy(t.start),this.end.copy(t.end),this},e.getCenter=function(t){return void 0===t&&(console.warn("THREE.Line3: .getCenter() target is now required"),t=new Ic),t.addVectors(this.start,this.end).multiplyScalar(.5)},e.delta=function(t){return void 0===t&&(console.warn("THREE.Line3: .delta() target is now required"),t=new Ic),t.subVectors(this.end,this.start)},e.distanceSq=function(){return this.start.distanceToSquared(this.end)},e.distance=function(){return this.start.distanceTo(this.end)},e.at=function(t,e){return void 0===e&&(console.warn("THREE.Line3: .at() target is now required"),e=new Ic),this.delta(e).multiplyScalar(t).add(this.start)},e.closestPointToPointParameter=function(t,e){fp.subVectors(t,this.start),mp.subVectors(this.end,this.start);var n=mp.dot(mp),r=mp.dot(fp),i=r/n;return e&&(i=Sc.clamp(i,0,1)),i},e.closestPointToPoint=function(t,e,n){var r=this.closestPointToPointParameter(t,e);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new Ic),this.delta(n).multiplyScalar(r).add(this.start)},e.applyMatrix4=function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},e.equals=function(t){return t.start.equals(this.start)&&t.end.equals(this.end)},t}();Gi.prototype=Object.create(f.prototype),Gi.prototype.constructor=Gi,Gi.prototype.isImmediateRenderObject=!0;var gp,yp,xp,_p=new Ic,bp=function(t){function e(e,n){var r;r=t.call(this)||this,r.light=e,r.light.updateMatrixWorld(),r.matrix=e.matrixWorld,r.matrixAutoUpdate=!1,r.color=n;for(var i=new I,a=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],o=0,s=1;o<32;o++,s++){var c=o/32*Math.PI*2,l=s/32*Math.PI*2;a.push(Math.cos(c),Math.sin(c),1,Math.cos(l),Math.sin(l),1)}i.setAttribute("position",new R(a,3));var u=new an({fog:!1,toneMapped:!1});return r.cone=new sn(i,u),r.add(r.cone),r.update(),r}a(e,t);var n=e.prototype;return n.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},n.update=function(){this.light.updateMatrixWorld();var t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),_p.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(_p),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)},e}(f),wp=new Ic,Mp=new ol,Sp=new ol,Tp=function(t){function e(e){for(var n,r=Ui(e),i=new I,a=[],o=[],s=new Zl(0,0,1),c=new Zl(0,1,0),l=0;l<r.length;l++){var u=r[l];u.parent&&u.parent.isBone&&(a.push(0,0,0),a.push(0,0,0),o.push(s.r,s.g,s.b),o.push(c.r,c.g,c.b))}i.setAttribute("position",new R(a,3)),i.setAttribute("color",new R(o,3));var h=new an({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});return n=t.call(this,i,h)||this,n.type="SkeletonHelper",n.isSkeletonHelper=!0,n.root=e,n.bones=r,n.matrix=e.matrixWorld,n.matrixAutoUpdate=!1,n}return a(e,t),e.prototype.updateMatrixWorld=function(e){var n=this.bones,r=this.geometry,i=r.getAttribute("position");Sp.copy(this.root.matrixWorld).invert();for(var a=0,o=0;a<n.length;a++){var s=n[a];s.parent&&s.parent.isBone&&(Mp.multiplyMatrices(Sp,s.matrixWorld),wp.setFromMatrixPosition(Mp),i.setXYZ(o,wp.x,wp.y,wp.z),Mp.multiplyMatrices(Sp,s.parent.matrixWorld),wp.setFromMatrixPosition(Mp),i.setXYZ(o+1,wp.x,wp.y,wp.z),o+=2)}r.getAttribute("position").needsUpdate=!0,t.prototype.updateMatrixWorld.call(this,e)},e}(sn),Ep=function(t){function e(e,n,r){var i,a=new ud(n,4,2),o=new x({wireframe:!0,fog:!1,toneMapped:!1});return i=t.call(this,a,o)||this,i.light=e,i.light.updateMatrixWorld(),i.color=r,i.type="PointLightHelper",i.matrix=i.light.matrixWorld,i.matrixAutoUpdate=!1,i.update(),i}a(e,t);var n=e.prototype;return n.dispose=function(){this.geometry.dispose(),this.material.dispose()},n.update=function(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)},e}(D),Ap=new Ic,Lp=new Zl,Rp=new Zl,Cp=function(t){function e(e,n,r){var i;i=t.call(this)||this,i.light=e,i.light.updateMatrixWorld(),i.matrix=e.matrixWorld,i.matrixAutoUpdate=!1,i.color=r;var a=new sd(n);a.rotateY(.5*Math.PI),i.material=new x({wireframe:!0,fog:!1,toneMapped:!1}),void 0===i.color&&(i.material.vertexColors=!0);var o=a.getAttribute("position"),s=new Float32Array(3*o.count);return a.setAttribute("color",new _(s,3)),i.add(new D(a,i.material)),i.update(),i}a(e,t);var n=e.prototype;return n.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},n.update=function(){var t=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var e=t.geometry.getAttribute("color");Lp.copy(this.light.color),Rp.copy(this.light.groundColor);for(var n=0,r=e.count;n<r;n++){var i=n<r/2?Lp:Rp;e.setXYZ(n,i.r,i.g,i.b)}e.needsUpdate=!0}t.lookAt(Ap.setFromMatrixPosition(this.light.matrixWorld).negate())},e}(f),Pp=function(t){function e(e,n,r,i){var a;void 0===e&&(e=10),void 0===n&&(n=10),void 0===r&&(r=4473924),void 0===i&&(i=8947848),r=new Zl(r),i=new Zl(i);for(var o=n/2,s=e/n,c=e/2,l=[],u=[],h=0,d=0,p=-c;h<=n;h++,p+=s){l.push(-c,0,p,c,0,p),l.push(p,0,-c,p,0,c);var f=h===o?r:i;f.toArray(u,d),d+=3,f.toArray(u,d),d+=3,f.toArray(u,d),d+=3,f.toArray(u,d),d+=3}var m=new I;m.setAttribute("position",new R(l,3)),m.setAttribute("color",new R(u,3));var v=new an({vertexColors:!0,toneMapped:!1});return a=t.call(this,m,v)||this,a.type="GridHelper",a}return a(e,t),e}(sn),Op=function(t){function e(e,n,r,i,a,o){var s;void 0===e&&(e=10),void 0===n&&(n=16),void 0===r&&(r=8),void 0===i&&(i=64),void 0===a&&(a=4473924),void 0===o&&(o=8947848),a=new Zl(a),o=new Zl(o);for(var c=[],l=[],u=0;u<=n;u++){var h=u/n*(2*Math.PI),d=Math.sin(h)*e,p=Math.cos(h)*e;c.push(0,0,0),c.push(d,0,p);var f=1&u?a:o;l.push(f.r,f.g,f.b),l.push(f.r,f.g,f.b)}for(var m=0;m<=r;m++)for(var v=1&m?a:o,g=e-e/r*m,y=0;y<i;y++){var x=y/i*(2*Math.PI),_=Math.sin(x)*g,b=Math.cos(x)*g;c.push(_,0,b),l.push(v.r,v.g,v.b),x=(y+1)/i*(2*Math.PI),_=Math.sin(x)*g,b=Math.cos(x)*g,c.push(_,0,b),l.push(v.r,v.g,v.b)}var w=new I;w.setAttribute("position",new R(c,3)),w.setAttribute("color",new R(l,3));var M=new an({vertexColors:!0,toneMapped:!1});return s=t.call(this,w,M)||this,s.type="PolarGridHelper",s}return a(e,t),e}(sn),Ip=new Ic,Dp=new Ic,Np=new Ic,Bp=function(t){function e(e,n,r){var i;i=t.call(this)||this,i.light=e,i.light.updateMatrixWorld(),i.matrix=e.matrixWorld,i.matrixAutoUpdate=!1,i.color=r,void 0===n&&(n=1);var a=new I;a.setAttribute("position",new R([-n,n,0,n,n,0,n,-n,0,-n,-n,0,-n,n,0],3));var o=new an({fog:!1,toneMapped:!1});return i.lightPlane=new on(a,o),i.add(i.lightPlane),a=new I,a.setAttribute("position",new R([0,0,0,0,0,1],3)),i.targetLine=new on(a,o),i.add(i.targetLine),i.update(),i}a(e,t);var n=e.prototype;return n.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},n.update=function(){Ip.setFromMatrixPosition(this.light.matrixWorld),Dp.setFromMatrixPosition(this.light.target.matrixWorld),Np.subVectors(Dp,Ip),this.lightPlane.lookAt(Dp),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Dp),this.targetLine.scale.z=Np.length()},e}(f),zp=new Ic,Fp=new G,Hp=function(t){function e(e){function n(t,e,n){r(t,n),r(e,n)}function r(t,e){s.push(0,0,0),c.push(e.r,e.g,e.b),void 0===l[t]&&(l[t]=[]),l[t].push(s.length/3-1)}var i,a=new I,o=new an({color:16777215,vertexColors:!0,toneMapped:!1}),s=[],c=[],l={},u=new Zl(16755200),h=new Zl(16711680),d=new Zl(43775),p=new Zl(16777215),f=new Zl(3355443);return n("n1","n2",u),n("n2","n4",u),n("n4","n3",u),n("n3","n1",u),n("f1","f2",u),n("f2","f4",u),n("f4","f3",u),n("f3","f1",u),n("n1","f1",u),n("n2","f2",u),n("n3","f3",u),n("n4","f4",u),n("p","n1",h),n("p","n2",h),n("p","n3",h),n("p","n4",h),n("u1","u2",d),n("u2","u3",d),n("u3","u1",d),n("c","t",p),n("p","c",f),n("cn1","cn2",f),n("cn3","cn4",f),n("cf1","cf2",f),n("cf3","cf4",f),a.setAttribute("position",new R(s,3)),a.setAttribute("color",new R(c,3)),i=t.call(this,a,o)||this,i.type="CameraHelper",i.camera=e,i.camera.updateProjectionMatrix&&i.camera.updateProjectionMatrix(),i.matrix=e.matrixWorld,i.matrixAutoUpdate=!1,i.pointMap=l,i.update(),i}return a(e,t),e.prototype.update=function(){var t=this.geometry,e=this.pointMap;Fp.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),ki("c",e,t,Fp,0,0,-1),ki("t",e,t,Fp,0,0,1),ki("n1",e,t,Fp,-1,-1,-1),ki("n2",e,t,Fp,1,-1,-1),ki("n3",e,t,Fp,-1,1,-1),ki("n4",e,t,Fp,1,1,-1),ki("f1",e,t,Fp,-1,-1,1),ki("f2",e,t,Fp,1,-1,1),ki("f3",e,t,Fp,-1,1,1),ki("f4",e,t,Fp,1,1,1),ki("u1",e,t,Fp,.7,1.1,-1),ki("u2",e,t,Fp,-.7,1.1,-1),ki("u3",e,t,Fp,0,2,-1),ki("cf1",e,t,Fp,-1,0,1),ki("cf2",e,t,Fp,1,0,1),ki("cf3",e,t,Fp,0,-1,1),ki("cf4",e,t,Fp,0,1,1),ki("cn1",e,t,Fp,-1,0,-1),ki("cn2",e,t,Fp,1,0,-1),ki("cn3",e,t,Fp,0,-1,-1),ki("cn4",e,t,Fp,0,1,-1),t.getAttribute("position").needsUpdate=!0},e}(sn),Gp=new Bc,Up=function(t){function e(e,n){var r;void 0===n&&(n=16776960);var i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),a=new Float32Array(24),o=new I;return o.setIndex(new _(i,1)),o.setAttribute("position",new _(a,3)),r=t.call(this,o,new an({color:n,toneMapped:!1}))||this,r.object=e,r.type="BoxHelper",r.matrixAutoUpdate=!1,r.update(),r}a(e,t);var n=e.prototype;return n.update=function(t){if(void 0!==t&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&Gp.setFromObject(this.object),!Gp.isEmpty()){var e=Gp.min,n=Gp.max,r=this.geometry.attributes.position,i=r.array;i[0]=n.x,i[1]=n.y,i[2]=n.z,i[3]=e.x,i[4]=n.y,i[5]=n.z,i[6]=e.x,i[7]=e.y,i[8]=n.z,i[9]=n.x,i[10]=e.y,i[11]=n.z,i[12]=n.x,i[13]=n.y,i[14]=e.z,i[15]=e.x,i[16]=n.y,i[17]=e.z,i[18]=e.x,i[19]=e.y,i[20]=e.z,i[21]=n.x,i[22]=e.y,i[23]=e.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}},n.setFromObject=function(t){return this.object=t,this.update(),this},n.copy=function(t){return sn.prototype.copy.call(this,t),this.object=t.object,this},e}(sn),kp=function(t){function e(e,n){var r;void 0===n&&(n=16776960);var i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),a=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],o=new I;return o.setIndex(new _(i,1)),o.setAttribute("position",new R(a,3)),r=t.call(this,o,new an({color:n,toneMapped:!1}))||this,r.box=e,r.type="Box3Helper",r.geometry.computeBoundingSphere(),r}return a(e,t),e.prototype.updateMatrixWorld=function(e){var n=this.box;n.isEmpty()||(n.getCenter(this.position),n.getSize(this.scale),this.scale.multiplyScalar(.5),t.prototype.updateMatrixWorld.call(this,e))},e}(sn),Vp=function(t){function e(e,n,r){var i;void 0===n&&(n=1),void 0===r&&(r=16776960);var a=r,o=[1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],s=new I;s.setAttribute("position",new R(o,3)),s.computeBoundingSphere(),i=t.call(this,s,new an({color:a,toneMapped:!1}))||this,i.type="PlaneHelper",i.plane=e,i.size=n;var c=[1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],l=new I;return l.setAttribute("position",new R(c,3)),l.computeBoundingSphere(),i.add(new D(l,new x({color:a,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1}))),i}return a(e,t),e.prototype.updateMatrixWorld=function(e){var n=-this.plane.constant;Math.abs(n)<1e-8&&(n=1e-8),this.scale.set(.5*this.size,.5*this.size,n),this.children[0].material.side=n<0?Ha:Fa,this.lookAt(this.plane.normal),t.prototype.updateMatrixWorld.call(this,e)},e}(on),Wp=new Ic,jp=function(t){function e(e,n,r,i,a,o){var s;return s=t.call(this)||this,s.type="ArrowHelper",void 0===e&&(e=new Ic(0,0,1)),void 0===n&&(n=new Ic(0,0,0)),void 0===r&&(r=1),void 0===i&&(i=16776960),void 0===a&&(a=.2*r),void 0===o&&(o=.2*a),void 0===gp&&(gp=new I,gp.setAttribute("position",new R([0,0,0,0,1,0],3)),yp=new qh(0,.5,1,5,1),yp.translate(0,-.5,0)),s.position.copy(n),s.line=new on(gp,new an({color:i,toneMapped:!1})),s.line.matrixAutoUpdate=!1,s.add(s.line),s.cone=new D(yp,new x({color:i,toneMapped:!1})),s.cone.matrixAutoUpdate=!1,s.add(s.cone),s.setDirection(e),s.setLength(r,a,o),s}a(e,t);var n=e.prototype;return n.setDirection=function(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{Wp.set(t.z,0,-t.x).normalize();var e=Math.acos(t.y);this.quaternion.setFromAxisAngle(Wp,e)}},n.setLength=function(t,e,n){void 0===e&&(e=.2*t),void 0===n&&(n=.2*e),this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()},n.setColor=function(t){this.line.material.color.set(t),this.cone.material.color.set(t)},n.copy=function(e){return t.prototype.copy.call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this},e}(f),qp=function(t){function e(e){var n;void 0===e&&(e=1);var r=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],a=new I;a.setAttribute("position",new R(r,3)),a.setAttribute("color",new R(i,3));var o=new an({vertexColors:!0,toneMapped:!1});return n=t.call(this,a,o)||this,n.type="AxesHelper",n}return a(e,t),e}(sn),Xp=new Float32Array(1),Yp=new Int32Array(Xp.buffer),Zp={toHalfFloat:function(t){Xp[0]=t;var e=Yp[0],n=e>>16&32768,r=e>>12&2047,i=e>>23&255;return i<103?n:i>142?(n|=31744,n|=(255==i?0:1)&&8388607&e):i<113?(r|=2048,n|=(r>>114-i)+(r>>113-i&1)):(n|=i-112<<10|r>>1,n+=1&r)}},Jp=4,Qp=8,Kp=Math.pow(2,Qp),$p=[.125,.215,.35,.446,.526,.582],tf=Qp-Jp+1+$p.length,ef=20,nf=(xp={},xp[rc]=0,xp[ic]=1,xp[oc]=2,xp[cc]=3,xp[lc]=4,xp[uc]=5,xp[ac]=6,xp),rf=new x({side:Ha,depthWrite:!1,depthTest:!1}),af=new D(new Tu,rf),of=new ui,sf=function(){for(var t=[],e=[],n=[],r=Qp,i=0;i<tf;i++){var a=Math.pow(2,r);e.push(a);var o=1/a;i>Qp-Jp?o=$p[i-Qp+Jp-1]:0==i&&(o=0),n.push(o);for(var s=1/(a-1),c=-s/2,l=1+s/2,u=[c,c,l,c,l,l,c,c,l,l,c,l],h=new Float32Array(108),d=new Float32Array(72),p=new Float32Array(36),f=0;f<6;f++){var m=f%3*2/3-1,v=f>2?0:-1,g=[m,v,0,m+2/3,v,0,m+2/3,v+1,0,m,v,0,m+2/3,v+1,0,m,v+1,0];h.set(g,18*f),d.set(u,12*f);var y=[f,f,f,f,f,f];p.set(y,6*f)}var x=new I;x.setAttribute("position",new _(h,3)),x.setAttribute("uv",new _(d,2)),x.setAttribute("faceIndex",new _(p,1)),t.push(x),r>Jp&&r--}return{_lodPlanes:t,_sizeLods:e,_sigmas:n}}(),cf=sf._lodPlanes,lf=sf._sizeLods,uf=sf._sigmas,hf=new Zl,df=null,pf=(1+Math.sqrt(5))/2,ff=1/pf,mf=[new Ic(1,1,1),new Ic(-1,1,1),new Ic(1,1,-1),new Ic(-1,1,-1),new Ic(0,pf,ff),new Ic(0,pf,-ff),new Ic(ff,0,pf),new Ic(-ff,0,pf),new Ic(pf,ff,0),new Ic(-pf,ff,0)],vf=function(){function t(t){this._renderer=t,this._pingPongRenderTarget=null,this._blurMaterial=Xi(ef),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}var e=t.prototype;return e.fromScene=function(t,e,n,r){void 0===e&&(e=0),void 0===n&&(n=.1),void 0===r&&(r=100),df=this._renderer.getRenderTarget();var i=this._allocateTargets();return this._sceneToCubeUV(t,n,r,i),e>0&&this._blur(i,0,0,e),this._applyPMREM(i),this._cleanup(i),i},e.fromEquirectangular=function(t){return this._fromTexture(t)},e.fromCubemap=function(t){return this._fromTexture(t)},e.compileCubemapShader=function(){null===this._cubemapShader&&(this._cubemapShader=Zi(),this._compileMaterial(this._cubemapShader))},e.compileEquirectangularShader=function(){null===this._equirectShader&&(this._equirectShader=Yi(),this._compileMaterial(this._equirectShader))},e.dispose=function(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(var t=0;t<cf.length;t++)cf[t].dispose()},e._cleanup=function(t){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(df),t.scissorTest=!1,qi(t,0,0,t.width,t.height)},e._fromTexture=function(t){df=this._renderer.getRenderTarget();var e=this._allocateTargets(t);return this._textureToCubeUV(t,e),this._applyPMREM(e),this._cleanup(e),e},e._allocateTargets=function(t){var e={magFilter:Bo,minFilter:Bo,generateMipmaps:!1,type:ko,format:as,encoding:Wi(t)?t.encoding:oc,depthBuffer:!1},n=ji(e);return n.depthBuffer=!t,this._pingPongRenderTarget=ji(e),n},e._compileMaterial=function(t){var e=new D(cf[0],t);this._renderer.compile(e,of)},e._sceneToCubeUV=function(t,e,n,r){var i=new U(90,1,e,n),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],s=this._renderer,c=s.autoClear,l=s.outputEncoding,u=s.toneMapping;s.getClearColor(hf),s.toneMapping=bo,s.outputEncoding=rc,s.autoClear=!1;var h=!1,d=t.background;if(d){if(d.isColor){rf.color.copy(d).convertSRGBToLinear(),t.background=null;var p=Vi(rf.color);rf.opacity=p,h=!0}}else{rf.color.copy(hf).convertSRGBToLinear();var f=Vi(rf.color);rf.opacity=f,h=!0}for(var m=0;m<6;m++){var v=m%3;0==v?(i.up.set(0,a[m],0),i.lookAt(o[m],0,0)):1==v?(i.up.set(0,0,a[m]),i.lookAt(0,o[m],0)):(i.up.set(0,a[m],0),i.lookAt(0,0,o[m])),qi(r,v*Kp,m>2?Kp:0,Kp,Kp),s.setRenderTarget(r),h&&s.render(af,i),s.render(t,i)}s.toneMapping=u,s.outputEncoding=l,s.autoClear=c},e._textureToCubeUV=function(t,e){var n=this._renderer;t.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=Zi()):null==this._equirectShader&&(this._equirectShader=Yi());var r=t.isCubeTexture?this._cubemapShader:this._equirectShader,i=new D(cf[0],r),a=r.uniforms;a.envMap.value=t,t.isCubeTexture||a.texelSize.value.set(1/t.image.width,1/t.image.height),a.inputEncoding.value=nf[t.encoding],a.outputEncoding.value=nf[e.texture.encoding],qi(e,0,0,3*Kp,2*Kp),n.setRenderTarget(e),n.render(i,of)},e._applyPMREM=function(t){var e=this._renderer,n=e.autoClear;e.autoClear=!1;for(var r=1;r<tf;r++){var i=Math.sqrt(uf[r]*uf[r]-uf[r-1]*uf[r-1]),a=mf[(r-1)%mf.length];this._blur(t,r-1,r,i,a)}e.autoClear=n},e._blur=function(t,e,n,r,i){var a=this._pingPongRenderTarget;this._halfBlur(t,a,e,n,r,"latitudinal",i),this._halfBlur(a,t,n,n,r,"longitudinal",i)},e._halfBlur=function(t,e,n,r,i,a,o){var s=this._renderer,c=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");var l=new D(cf[r],c),u=c.uniforms,h=lf[n]-1,d=isFinite(i)?Math.PI/(2*h):2*Math.PI/(2*ef-1),p=i/d,f=isFinite(i)?1+Math.floor(3*p):ef;f>ef&&console.warn("sigmaRadians, "+i+", is too large and will clip, as it requested "+f+" samples when the maximum is set to "+ef);for(var m=[],v=0,g=0;g<ef;++g){var y=g/p,x=Math.exp(-y*y/2);m.push(x),0==g?v+=x:g<f&&(v+=2*x)}for(var _=0;_<m.length;_++)m[_]=m[_]/v;u.envMap.value=t.texture,u.samples.value=f,u.weights.value=m,u.latitudinal.value="latitudinal"===a,o&&(u.poleAxis.value=o),u.dTheta.value=d,u.mipInt.value=Qp-n,u.inputEncoding.value=nf[t.texture.encoding],u.outputEncoding.value=nf[t.texture.encoding];var b=lf[r];qi(e,3*Math.max(0,Kp-2*b),(0===r?0:2*Kp)+2*b*(r>Qp-Jp?r-Qp+Jp:0),3*b,2*b),s.setRenderTarget(e),s.render(l,of)},t}();Or.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(Or.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},Object.assign(ei.prototype,{fromPoints:function(t){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)}}),va.prototype=Object.create(Br.prototype),ga.prototype=Object.create(Br.prototype),ya.prototype=Object.create(Br.prototype),Object.assign(ya.prototype,{initFromArray:function(){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}}),Pp.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Tp.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Object.assign(Sr.prototype,{extractUrlBase:function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Rd.extractUrlBase(t)}}),Sr.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.")}},Object.assign(pp.prototype,{
  145. center:function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},size:function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)}}),Object.assign(Bc.prototype,{center:function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionSphere:function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},size:function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)}}),Object.assign(Qc.prototype,{empty:function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()}}),Du.prototype.setFromMatrix=function(t){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(t)},vp.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},Object.assign(Sc,{random16:function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},nearestPowerOfTwo:function(t){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),Sc.floorPowerOfTwo(t)},nextPowerOfTwo:function(t){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),Sc.ceilPowerOfTwo(t)}}),Object.assign(Ec.prototype,{flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},multiplyVector3:function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBufferAttribute:function(t){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},getInverse:function(t){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()}}),Object.assign(ol.prototype,{extractPosition:function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},getPosition:function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new Ic).setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector4:function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},crossVector:function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBufferAttribute:function(t){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(t,e,n,r,i,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,r,n,i,a)},getInverse:function(t){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()}}),Dl.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},Object.assign(Oc.prototype,{multiplyVector3:function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},inverse:function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()}}),Object.assign(al.prototype,{isIntersectionBox:function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionPlane:function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},isIntersectionSphere:function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)}}),Object.assign(jl.prototype,{area:function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},barycoordFromPoint:function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},midpoint:function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},normal:function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},plane:function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)}}),Object.assign(jl,{barycoordFromPoint:function(t,e,n,r,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),jl.getBarycoord(t,e,n,r,i)},normal:function(t,e,n,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),jl.getNormal(t,e,n,r)}}),Object.assign(ni.prototype,{extractAllPoints:function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},extrude:function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new rd(this,t)},makeGeometry:function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new ld(this,t)}}),Object.assign(Tc.prototype,{fromAttribute:function(t,e,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},distanceToManhattan:function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},lengthManhattan:function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Ic.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},getScaleFromMatrix:function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},getColumnFromMatrix:function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},applyProjection:function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},fromAttribute:function(t,e,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},distanceToManhattan:function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},lengthManhattan:function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Rc.prototype,{fromAttribute:function(t,e,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},lengthManhattan:function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(f.prototype,{getChildByName:function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},getWorldRotation:function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},applyMatrix:function(t){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)}}),Object.defineProperties(f.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},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.")}}}),Object.assign(D.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(D.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),0},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.")}}}),Object.defineProperties($e.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(nn.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),tn.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(Or.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(t){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=t}}),U.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(ri.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(_.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===yc},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(yc)}}}),Object.assign(_.prototype,{setDynamic:function(t){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?yc:gc),this},copyIndicesArray:function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},setArray:function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),Object.assign(I.prototype,{addIndex:function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},addAttribute:function(t,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(t,e):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(t,new _(arguments[1],arguments[2])))},addDrawCall:function(t,e,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},removeAttribute:function(t){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(t)},applyMatrix:function(t){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)}}),Object.defineProperties(I.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}}}),Object.defineProperties(gi.prototype,{maxInstancedCount:{get:function(){return console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount},set:function(t){console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount=t}}}),Object.defineProperties(zi.prototype,{linePrecision:{get:function(){return console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold},set:function(t){console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold=t}}}),Object.defineProperties(Ye.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.usage===yc},set:function(t){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(t)}}}),Object.assign(Ye.prototype,{setDynamic:function(t){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?yc:gc),this},setArray:function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),Object.assign(rd.prototype,{getArrays:function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},addShapeList:function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},addShape:function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")}}),Object.assign(oh.prototype,{dispose:function(){console.error("THREE.Scene: .dispose() has been removed.")}}),Object.defineProperties(lp.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(y.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 Zl}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===t}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(t){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=t}}}),Object.defineProperties(nr.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(er.prototype,{transparency:{get:function(){return console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission},set:function(t){console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission=t}}}),Object.defineProperties(H.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),Object.assign(qe.prototype,{clearTarget:function(t,e,n,r){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(t),this.clear(e,n,r)},animate:function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},resetGLState:function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},setFaceCulling:function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},allocTextureUnit:function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},setTexture:function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},setTextureCube:function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},getActiveMipMapLevel:function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()}}),Object.defineProperties(qe.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},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(t){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===t?ic:rc}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}}),Object.defineProperties(De.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(Cc.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),Object.defineProperties(jd.prototype,{load:{value:function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var e=this;return(new Ti).load(t,function(t){e.setBuffer(t)}),this}},startTime:{set:function(){console.warn("THREE.Audio: .startTime is now .play( delay ).")}}}),Qd.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},k.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)},k.prototype.clear=function(t,e,n,r){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(t,e,n,r)};var gf={merge:function(t,e,n){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var r;e.isMesh&&(e.matrixAutoUpdate&&e.updateMatrix(),r=e.matrix,e=e.geometry),t.merge(e,r,n)},center:function(t){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),t.center()}};Ac.crossOrigin=void 0,Ac.loadTexture=function(t,e,n,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var i=new Pr;i.setCrossOrigin(this.crossOrigin);var a=i.load(t,n,void 0,r);return e&&(a.mapping=e),a},Ac.loadTextureCube=function(t,e,n,r){
  146. console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var i=new Rr;i.setCrossOrigin(this.crossOrigin);var a=i.load(t,n,void 0,r);return e&&(a.mapping=e),a},Ac.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},Ac.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};var yf={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"125"}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="125"),t.ACESFilmicToneMapping=To,t.AddEquation=Xa,t.AddOperation=_o,t.AdditiveAnimationBlendMode=2501,t.AdditiveBlending=Va,t.AlphaFormat=ts,t.AlwaysDepth=uo,t.AlwaysStencilFunc=vc,t.AmbientLight=pi,t.AmbientLightProbe=Ai,t.AnimationClip=_r,t.AnimationLoader=Er,t.AnimationMixer=Di,t.AnimationObjectGroup=Ii,t.AnimationUtils=xd,t.ArcCurve=Dr,t.ArrayCamera=He,t.ArrowHelper=jp,t.Audio=jd,t.AudioAnalyser=Qd,t.AudioContext=Bd,t.AudioListener=Wd,t.AudioLoader=Ti,t.AxesHelper=qp,t.AxisHelper=xa,t.BackSide=Ha,t.BasicDepthPacking=hc,t.BasicShadowMap=0,t.BinaryTextureLoader=Sa,t.Bone=en,t.BooleanKeyframeTrack=pr,t.BoundingBoxHelper=_a,t.Box2=pp,t.Box3=Bc,t.Box3Helper=kp,t.BoxBufferGeometry=Tu,t.BoxGeometry=Tu,t.BoxHelper=Up,t.BufferAttribute=_,t.BufferGeometry=I,t.BufferGeometryLoader=xi,t.ByteType=Vo,t.Cache=_d,t.Camera=G,t.CameraHelper=Hp,t.CanvasRenderer=Ea,t.CanvasTexture=fn,t.CatmullRomCurve3=Br,t.CineonToneMapping=So,t.CircleBufferGeometry=jh,t.CircleGeometry=jh,t.ClampToEdgeWrapping=Do,t.Clock=Hd,t.ClosedSplineCurve3=va,t.Color=Zl,t.ColorKeyframeTrack=fr,t.CompressedTexture=pn,t.CompressedTextureLoader=Ar,t.ConeBufferGeometry=Xh,t.ConeGeometry=Xh,t.CubeCamera=k,t.CubeReflectionMapping=Ao,t.CubeRefractionMapping=Lo,t.CubeTexture=V,t.CubeTextureLoader=Rr,t.CubeUVReflectionMapping=Po,t.CubeUVRefractionMapping=Oo,t.CubicBezierCurve=Xr,t.CubicBezierCurve3=Yr,t.CubicInterpolant=lr,t.CullFaceBack=Ia,t.CullFaceFront=Da,t.CullFaceFrontBack=3,t.CullFaceNone=Oa,t.Curve=Or,t.CurvePath=ti,t.CustomBlending=qa,t.CustomToneMapping=Eo,t.CylinderBufferGeometry=qh,t.CylinderGeometry=qh,t.Cylindrical=hp,t.DataTexture=W,t.DataTexture2DArray=st,t.DataTexture3D=ct,t.DataTextureLoader=Cr,t.DataUtils=Zp,t.DecrementStencilOp=7683,t.DecrementWrapStencilOp=34056,t.DefaultLoadingManager=bd,t.DepthFormat=os,t.DepthStencilFormat=ss,t.DepthTexture=mn,t.DirectionalLight=di,t.DirectionalLightHelper=Bp,t.DiscreteInterpolant=hr,t.DodecahedronBufferGeometry=Zh,t.DodecahedronGeometry=Zh,t.DoubleSide=Ga,t.DstAlphaFactor=io,t.DstColorFactor=oo,t.DynamicBufferAttribute=oa,t.DynamicCopyUsage=35050,t.DynamicDrawUsage=yc,t.DynamicReadUsage=35049,t.EdgesGeometry=td,t.EdgesHelper=ba,t.EllipseCurve=Ir,t.EqualDepth=fo,t.EqualStencilFunc=514,t.EquirectangularReflectionMapping=Ro,t.EquirectangularRefractionMapping=Co,t.Euler=fl,t.EventDispatcher=u,t.ExtrudeBufferGeometry=rd,t.ExtrudeGeometry=rd,t.Face3=Jl,t.Face4=Ji,t.FaceColors=1,t.FileLoader=Tr,t.FlatShading=1,t.Float16BufferAttribute=L,t.Float32Attribute=fa,t.Float32BufferAttribute=R,t.Float64Attribute=ma,t.Float64BufferAttribute=C,t.FloatType=Yo,t.Fog=ah,t.FogExp2=ih,t.Font=Dd,t.FontLoader=Si,t.FrontSide=Fa,t.Frustum=Du,t.GLBufferAttribute=Bi,t.GLSL1="100",t.GLSL3=xc,t.GammaEncoding=ac,t.GeometryUtils=gf,t.GreaterDepth=vo,t.GreaterEqualDepth=mo,t.GreaterEqualStencilFunc=518,t.GreaterStencilFunc=516,t.GridHelper=Pp,t.Group=Fe,t.HalfFloatType=Zo,t.HemisphereLight=ii,t.HemisphereLightHelper=Cp,t.HemisphereLightProbe=Ei,t.IcosahedronBufferGeometry=ad,t.IcosahedronGeometry=ad,t.ImageBitmapLoader=_i,t.ImageLoader=Lr,t.ImageUtils=Ac,t.ImmediateRenderObject=Gi,t.IncrementStencilOp=7682,t.IncrementWrapStencilOp=34055,t.InstancedBufferAttribute=yi,t.InstancedBufferGeometry=gi,t.InstancedInterleavedBuffer=Ni,t.InstancedMesh=rn,t.Int16Attribute=ua,t.Int16BufferAttribute=S,t.Int32Attribute=da,t.Int32BufferAttribute=E,t.Int8Attribute=sa,t.Int8BufferAttribute=b,t.IntType=qo,t.InterleavedBuffer=Ye,t.InterleavedBufferAttribute=Ze,t.Interpolant=cr,t.InterpolateDiscrete=2300,t.InterpolateLinear=2301,t.InterpolateSmooth=2302,t.InvertStencilOp=5386,t.JSONLoader=Aa,t.KeepStencilOp=mc,t.KeyframeTrack=dr,t.LOD=$e,t.LatheBufferGeometry=od,t.LatheGeometry=od,t.Layers=gl,t.LensFlare=La,t.LessDepth=ho,t.LessEqualDepth=po,t.LessEqualStencilFunc=515,t.LessStencilFunc=513,t.Light=ri,t.LightProbe=mi,t.Line=on,t.Line3=vp,t.LineBasicMaterial=an,t.LineCurve=Zr,t.LineCurve3=Jr,t.LineDashedMaterial=sr,t.LineLoop=cn,t.LinePieces=1,t.LineSegments=sn,t.LineStrip=0,t.LinearEncoding=rc;t.LinearFilter=Ho,t.LinearInterpolant=ur,t.LinearMipMapLinearFilter=1008,t.LinearMipMapNearestFilter=1007,t.LinearMipmapLinearFilter=Uo,t.LinearMipmapNearestFilter=Go,t.LinearToneMapping=wo,t.Loader=Sr,t.LoaderUtils=Rd,t.LoadingManager=Mr,t.LogLuvEncoding=sc,t.LoopOnce=2200,t.LoopPingPong=2202,t.LoopRepeat=tc,t.LuminanceAlphaFormat=is,t.LuminanceFormat=rs,t.MOUSE=Ca,t.Material=y,t.MaterialLoader=vi,t.Math=Sc,t.MathUtils=Sc,t.Matrix3=Ec,t.Matrix4=ol,t.MaxEquation=Qa,t.Mesh=D,t.MeshBasicMaterial=x,t.MeshDepthMaterial=Oe,t.MeshDistanceMaterial=Ie,t.MeshFaceMaterial=Qi,t.MeshLambertMaterial=ar,t.MeshMatcapMaterial=or,t.MeshNormalMaterial=ir,t.MeshPhongMaterial=nr,t.MeshPhysicalMaterial=er,t.MeshStandardMaterial=tr,t.MeshToonMaterial=rr,t.MinEquation=Ja,t.MirroredRepeatWrapping=No,t.MixOperation=xo,t.MultiMaterial=Ki,t.MultiplyBlending=ja,t.MultiplyOperation=yo,t.NearestFilter=Bo,t.NearestMipMapLinearFilter=1005,t.NearestMipMapNearestFilter=1004,t.NearestMipmapLinearFilter=Fo,t.NearestMipmapNearestFilter=zo,t.NeverDepth=lo,t.NeverStencilFunc=512,t.NoBlending=Ua,t.NoColors=0,t.NoToneMapping=bo,t.NormalAnimationBlendMode=nc,t.NormalBlending=ka,t.NotEqualDepth=go,t.NotEqualStencilFunc=517,t.NumberKeyframeTrack=mr,t.Object3D=f,t.ObjectLoader=Cd,t.ObjectSpaceNormalMap=fc,t.OctahedronBufferGeometry=sd,t.OctahedronGeometry=sd,t.OneFactor=$a,t.OneMinusDstAlphaFactor=ao,t.OneMinusDstColorFactor=so,t.OneMinusSrcAlphaFactor=ro,t.OneMinusSrcColorFactor=eo,t.OrthographicCamera=ui,t.PCFShadowMap=Na,t.PCFSoftShadowMap=Ba,t.PMREMGenerator=vf,t.ParametricBufferGeometry=Jn,t.ParametricGeometry=Jn,t.Particle=ta,t.ParticleBasicMaterial=ra,t.ParticleSystem=ea,t.ParticleSystemMaterial=ia,t.Path=ei,t.PerspectiveCamera=U,t.Plane=Dl,t.PlaneBufferGeometry=Nu,t.PlaneGeometry=Nu,t.PlaneHelper=Vp,t.PointCloud=$i,t.PointCloudMaterial=na,t.PointLight=li,t.PointLightHelper=Ep,t.Points=un,t.PointsMaterial=ln,t.PolarGridHelper=Op,t.PolyhedronBufferGeometry=Yh,t.PolyhedronGeometry=Yh,t.PositionalAudio=Jd,t.PropertyBinding=Oi,t.PropertyMixer=Ci,t.QuadraticBezierCurve=Qr,t.QuadraticBezierCurve3=Kr,t.Quaternion=Oc,t.QuaternionKeyframeTrack=gr,t.QuaternionLinearInterpolant=vr,t.REVISION="125",t.RGBADepthPacking=dc,t.RGBAFormat=ns,t.RGBAIntegerFormat=ps,t.RGBA_ASTC_10x10_Format=Bs,t.RGBA_ASTC_10x5_Format=Is,t.RGBA_ASTC_10x6_Format=Ds,t.RGBA_ASTC_10x8_Format=Ns,t.RGBA_ASTC_12x10_Format=zs,t.RGBA_ASTC_12x12_Format=Fs,t.RGBA_ASTC_4x4_Format=Ts,t.RGBA_ASTC_5x4_Format=Es,t.RGBA_ASTC_5x5_Format=As,t.RGBA_ASTC_6x5_Format=Ls,t.RGBA_ASTC_6x6_Format=Rs,t.RGBA_ASTC_8x5_Format=Cs,t.RGBA_ASTC_8x6_Format=Ps,t.RGBA_ASTC_8x8_Format=Os,t.RGBA_BPTC_Format=Hs,t.RGBA_ETC2_EAC_Format=Ss,t.RGBA_PVRTC_2BPPV1_Format=bs,t.RGBA_PVRTC_4BPPV1_Format=_s,t.RGBA_S3TC_DXT1_Format=ms,t.RGBA_S3TC_DXT3_Format=vs,t.RGBA_S3TC_DXT5_Format=gs,t.RGBDEncoding=uc,t.RGBEEncoding=oc,t.RGBEFormat=as,t.RGBFormat=es,t.RGBIntegerFormat=ds,t.RGBM16Encoding=lc,t.RGBM7Encoding=cc,t.RGB_ETC1_Format=ws,t.RGB_ETC2_Format=Ms,t.RGB_PVRTC_2BPPV1_Format=xs,t.RGB_PVRTC_4BPPV1_Format=ys,t.RGB_S3TC_DXT1_Format=fs,t.RGFormat=us,t.RGIntegerFormat=hs,t.RawShaderMaterial=$n,t.Ray=al,t.Raycaster=zi,t.RectAreaLight=fi,t.RedFormat=cs,t.RedIntegerFormat=ls,t.ReinhardToneMapping=Mo,t.RepeatWrapping=Io,t.ReplaceStencilOp=7681,t.ReverseSubtractEquation=Za,t.RingBufferGeometry=cd,t.RingGeometry=cd,t.SRGB8_ALPHA8_ASTC_10x10_Format=Qs,t.SRGB8_ALPHA8_ASTC_10x5_Format=Ys,t.SRGB8_ALPHA8_ASTC_10x6_Format=Zs,t.SRGB8_ALPHA8_ASTC_10x8_Format=Js,t.SRGB8_ALPHA8_ASTC_12x10_Format=Ks,t.SRGB8_ALPHA8_ASTC_12x12_Format=$s,t.SRGB8_ALPHA8_ASTC_4x4_Format=Gs,t.SRGB8_ALPHA8_ASTC_5x4_Format=Us,t.SRGB8_ALPHA8_ASTC_5x5_Format=ks,t.SRGB8_ALPHA8_ASTC_6x5_Format=Vs,t.SRGB8_ALPHA8_ASTC_6x6_Format=Ws,t.SRGB8_ALPHA8_ASTC_8x5_Format=js,t.SRGB8_ALPHA8_ASTC_8x6_Format=qs,t.SRGB8_ALPHA8_ASTC_8x8_Format=Xs,t.Scene=oh,t.SceneUtils=yf,t.ShaderChunk=Bu,t.ShaderLib=Fu,t.ShaderMaterial=H,t.ShadowMaterial=Kn,t.Shape=ni,t.ShapeBufferGeometry=ld,t.ShapeGeometry=ld,t.ShapePath=bi,t.ShapeUtils=nd,t.ShortType=Wo,t.Skeleton=nn,t.SkeletonHelper=Tp,t.SkinnedMesh=tn,t.SmoothShading=2,t.Sphere=Qc,t.SphereBufferGeometry=ud,t.SphereGeometry=ud,t.Spherical=up,t.SphericalHarmonics3=Ld,t.Spline=ya,t.SplineCurve=$r,t.SplineCurve3=ga,t.SpotLight=si,t.SpotLightHelper=bp,t.Sprite=Qe,t.SpriteMaterial=Je,t.SrcAlphaFactor=no,t.SrcAlphaSaturateFactor=co,t.SrcColorFactor=to,t.StaticCopyUsage=35046,t.StaticDrawUsage=gc,t.StaticReadUsage=35045,t.StereoCamera=Li;t.StreamCopyUsage=35042,t.StreamDrawUsage=35040,t.StreamReadUsage=35041,t.StringKeyframeTrack=yr,t.SubtractEquation=Ya,t.SubtractiveBlending=Wa,t.TOUCH=Pa,t.TangentSpaceNormalMap=pc,t.TetrahedronBufferGeometry=hd,t.TetrahedronGeometry=hd,t.TextBufferGeometry=dd,t.TextGeometry=dd,t.Texture=h,t.TextureLoader=Pr,t.TorusBufferGeometry=pd,t.TorusGeometry=pd,t.TorusKnotBufferGeometry=fd,t.TorusKnotGeometry=fd,t.Triangle=jl,t.TriangleFanDrawMode=2,t.TriangleStripDrawMode=1,t.TrianglesDrawMode=0,t.TubeBufferGeometry=md,t.TubeGeometry=md,t.UVMapping=300,t.Uint16Attribute=ha,t.Uint16BufferAttribute=T,t.Uint32Attribute=pa,t.Uint32BufferAttribute=A,t.Uint8Attribute=ca,t.Uint8BufferAttribute=w,t.Uint8ClampedAttribute=la,t.Uint8ClampedBufferAttribute=M,t.Uniform=lp,t.UniformsLib=zu,t.UniformsUtils=Eu,t.UnsignedByteType=ko,t.UnsignedInt248Type=$o,t.UnsignedIntType=Xo,t.UnsignedShort4444Type=Jo,t.UnsignedShort5551Type=Qo,t.UnsignedShort565Type=Ko,t.UnsignedShortType=jo,t.VSMShadowMap=za,t.Vector2=Tc,t.Vector3=Ic,t.Vector4=Rc,t.VectorKeyframeTrack=xr,t.Vertex=aa,t.VertexColors=2,t.VideoTexture=dn,t.WebGL1Renderer=Xe,t.WebGLCubeRenderTarget=Pu,t.WebGLMultisampleRenderTarget=Pc,t.WebGLRenderTarget=Cc,t.WebGLRenderTargetCube=Ta,t.WebGLRenderer=qe,t.WebGLUtils=ze,t.WireframeGeometry=vd,t.WireframeHelper=wa,t.WrapAroundEnding=2402,t.XHRLoader=Ma,t.ZeroCurvatureEnding=ec,t.ZeroFactor=Ka,t.ZeroSlopeEnding=2401,t.ZeroStencilOp=0,t.sRGBEncoding=ic,Object.defineProperty(t,"__esModule",{value:!0})});
  147. },{}],58:[function(_dereq_,module,exports){
  148. THREE.DRACOLoader = function ( manager ) {
  149. THREE.Loader.call( this, manager );
  150. this.decoderPath = '';
  151. this.decoderConfig = {};
  152. this.decoderBinary = null;
  153. this.decoderPending = null;
  154. this.workerLimit = 4;
  155. this.workerPool = [];
  156. this.workerNextTaskID = 1;
  157. this.workerSourceURL = '';
  158. this.defaultAttributeIDs = {
  159. position: 'POSITION',
  160. normal: 'NORMAL',
  161. color: 'COLOR',
  162. uv: 'TEX_COORD'
  163. };
  164. this.defaultAttributeTypes = {
  165. position: 'Float32Array',
  166. normal: 'Float32Array',
  167. color: 'Float32Array',
  168. uv: 'Float32Array'
  169. };
  170. };
  171. THREE.DRACOLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), {
  172. constructor: THREE.DRACOLoader,
  173. setDecoderPath: function ( path ) {
  174. this.decoderPath = path;
  175. return this;
  176. },
  177. setDecoderConfig: function ( config ) {
  178. this.decoderConfig = config;
  179. return this;
  180. },
  181. setWorkerLimit: function ( workerLimit ) {
  182. this.workerLimit = workerLimit;
  183. return this;
  184. },
  185. /** @deprecated */
  186. setVerbosity: function () {
  187. console.warn( 'THREE.DRACOLoader: The .setVerbosity() method has been removed.' );
  188. },
  189. /** @deprecated */
  190. setDrawMode: function () {
  191. console.warn( 'THREE.DRACOLoader: The .setDrawMode() method has been removed.' );
  192. },
  193. /** @deprecated */
  194. setSkipDequantization: function () {
  195. console.warn( 'THREE.DRACOLoader: The .setSkipDequantization() method has been removed.' );
  196. },
  197. load: function ( url, onLoad, onProgress, onError ) {
  198. var loader = new THREE.FileLoader( this.manager );
  199. loader.setPath( this.path );
  200. loader.setResponseType( 'arraybuffer' );
  201. loader.setRequestHeader( this.requestHeader );
  202. loader.setWithCredentials( this.withCredentials );
  203. loader.load( url, ( buffer ) => {
  204. var taskConfig = {
  205. attributeIDs: this.defaultAttributeIDs,
  206. attributeTypes: this.defaultAttributeTypes,
  207. useUniqueIDs: false
  208. };
  209. this.decodeGeometry( buffer, taskConfig )
  210. .then( onLoad )
  211. .catch( onError );
  212. }, onProgress, onError );
  213. },
  214. /** @deprecated Kept for backward-compatibility with previous DRACOLoader versions. */
  215. decodeDracoFile: function ( buffer, callback, attributeIDs, attributeTypes ) {
  216. var taskConfig = {
  217. attributeIDs: attributeIDs || this.defaultAttributeIDs,
  218. attributeTypes: attributeTypes || this.defaultAttributeTypes,
  219. useUniqueIDs: !! attributeIDs
  220. };
  221. this.decodeGeometry( buffer, taskConfig ).then( callback );
  222. },
  223. decodeGeometry: function ( buffer, taskConfig ) {
  224. // TODO: For backward-compatibility, support 'attributeTypes' objects containing
  225. // references (rather than names) to typed array constructors. These must be
  226. // serialized before sending them to the worker.
  227. for ( var attribute in taskConfig.attributeTypes ) {
  228. var type = taskConfig.attributeTypes[ attribute ];
  229. if ( type.BYTES_PER_ELEMENT !== undefined ) {
  230. taskConfig.attributeTypes[ attribute ] = type.name;
  231. }
  232. }
  233. //
  234. var taskKey = JSON.stringify( taskConfig );
  235. // Check for an existing task using this buffer. A transferred buffer cannot be transferred
  236. // again from this thread.
  237. if ( THREE.DRACOLoader.taskCache.has( buffer ) ) {
  238. var cachedTask = THREE.DRACOLoader.taskCache.get( buffer );
  239. if ( cachedTask.key === taskKey ) {
  240. return cachedTask.promise;
  241. } else if ( buffer.byteLength === 0 ) {
  242. // Technically, it would be possible to wait for the previous task to complete,
  243. // transfer the buffer back, and decode again with the second configuration. That
  244. // is complex, and I don't know of any reason to decode a Draco buffer twice in
  245. // different ways, so this is left unimplemented.
  246. throw new Error(
  247. 'THREE.DRACOLoader: Unable to re-decode a buffer with different ' +
  248. 'settings. Buffer has already been transferred.'
  249. );
  250. }
  251. }
  252. //
  253. var worker;
  254. var taskID = this.workerNextTaskID ++;
  255. var taskCost = buffer.byteLength;
  256. // Obtain a worker and assign a task, and construct a geometry instance
  257. // when the task completes.
  258. var geometryPending = this._getWorker( taskID, taskCost )
  259. .then( ( _worker ) => {
  260. worker = _worker;
  261. return new Promise( ( resolve, reject ) => {
  262. worker._callbacks[ taskID ] = { resolve, reject };
  263. worker.postMessage( { type: 'decode', id: taskID, taskConfig, buffer }, [ buffer ] );
  264. // this.debug();
  265. } );
  266. } )
  267. .then( ( message ) => this._createGeometry( message.geometry ) );
  268. // Remove task from the task list.
  269. // Note: replaced '.finally()' with '.catch().then()' block - iOS 11 support (#19416)
  270. geometryPending
  271. .catch( () => true )
  272. .then( () => {
  273. if ( worker && taskID ) {
  274. this._releaseTask( worker, taskID );
  275. // this.debug();
  276. }
  277. } );
  278. // Cache the task result.
  279. THREE.DRACOLoader.taskCache.set( buffer, {
  280. key: taskKey,
  281. promise: geometryPending
  282. } );
  283. return geometryPending;
  284. },
  285. _createGeometry: function ( geometryData ) {
  286. var geometry = new THREE.BufferGeometry();
  287. if ( geometryData.index ) {
  288. geometry.setIndex( new THREE.BufferAttribute( geometryData.index.array, 1 ) );
  289. }
  290. for ( var i = 0; i < geometryData.attributes.length; i ++ ) {
  291. var attribute = geometryData.attributes[ i ];
  292. var name = attribute.name;
  293. var array = attribute.array;
  294. var itemSize = attribute.itemSize;
  295. geometry.setAttribute( name, new THREE.BufferAttribute( array, itemSize ) );
  296. }
  297. return geometry;
  298. },
  299. _loadLibrary: function ( url, responseType ) {
  300. var loader = new THREE.FileLoader( this.manager );
  301. loader.setPath( this.decoderPath );
  302. loader.setResponseType( responseType );
  303. loader.setWithCredentials( this.withCredentials );
  304. return new Promise( ( resolve, reject ) => {
  305. loader.load( url, resolve, undefined, reject );
  306. } );
  307. },
  308. preload: function () {
  309. this._initDecoder();
  310. return this;
  311. },
  312. _initDecoder: function () {
  313. if ( this.decoderPending ) return this.decoderPending;
  314. var useJS = typeof WebAssembly !== 'object' || this.decoderConfig.type === 'js';
  315. var librariesPending = [];
  316. if ( useJS ) {
  317. librariesPending.push( this._loadLibrary( 'draco_decoder.js', 'text' ) );
  318. } else {
  319. librariesPending.push( this._loadLibrary( 'draco_wasm_wrapper.js', 'text' ) );
  320. librariesPending.push( this._loadLibrary( 'draco_decoder.wasm', 'arraybuffer' ) );
  321. }
  322. this.decoderPending = Promise.all( librariesPending )
  323. .then( ( libraries ) => {
  324. var jsContent = libraries[ 0 ];
  325. if ( ! useJS ) {
  326. this.decoderConfig.wasmBinary = libraries[ 1 ];
  327. }
  328. var fn = THREE.DRACOLoader.DRACOWorker.toString();
  329. var body = [
  330. '/* draco decoder */',
  331. jsContent,
  332. '',
  333. '/* worker */',
  334. fn.substring( fn.indexOf( '{' ) + 1, fn.lastIndexOf( '}' ) )
  335. ].join( '\n' );
  336. this.workerSourceURL = URL.createObjectURL( new Blob( [ body ] ) );
  337. } );
  338. return this.decoderPending;
  339. },
  340. _getWorker: function ( taskID, taskCost ) {
  341. return this._initDecoder().then( () => {
  342. if ( this.workerPool.length < this.workerLimit ) {
  343. var worker = new Worker( this.workerSourceURL );
  344. worker._callbacks = {};
  345. worker._taskCosts = {};
  346. worker._taskLoad = 0;
  347. worker.postMessage( { type: 'init', decoderConfig: this.decoderConfig } );
  348. worker.onmessage = function ( e ) {
  349. var message = e.data;
  350. switch ( message.type ) {
  351. case 'decode':
  352. worker._callbacks[ message.id ].resolve( message );
  353. break;
  354. case 'error':
  355. worker._callbacks[ message.id ].reject( message );
  356. break;
  357. default:
  358. console.error( 'THREE.DRACOLoader: Unexpected message, "' + message.type + '"' );
  359. }
  360. };
  361. this.workerPool.push( worker );
  362. } else {
  363. this.workerPool.sort( function ( a, b ) {
  364. return a._taskLoad > b._taskLoad ? - 1 : 1;
  365. } );
  366. }
  367. var worker = this.workerPool[ this.workerPool.length - 1 ];
  368. worker._taskCosts[ taskID ] = taskCost;
  369. worker._taskLoad += taskCost;
  370. return worker;
  371. } );
  372. },
  373. _releaseTask: function ( worker, taskID ) {
  374. worker._taskLoad -= worker._taskCosts[ taskID ];
  375. delete worker._callbacks[ taskID ];
  376. delete worker._taskCosts[ taskID ];
  377. },
  378. debug: function () {
  379. console.log( 'Task load: ', this.workerPool.map( ( worker ) => worker._taskLoad ) );
  380. },
  381. dispose: function () {
  382. for ( var i = 0; i < this.workerPool.length; ++ i ) {
  383. this.workerPool[ i ].terminate();
  384. }
  385. this.workerPool.length = 0;
  386. return this;
  387. }
  388. } );
  389. /* WEB WORKER */
  390. THREE.DRACOLoader.DRACOWorker = function () {
  391. var decoderConfig;
  392. var decoderPending;
  393. onmessage = function ( e ) {
  394. var message = e.data;
  395. switch ( message.type ) {
  396. case 'init':
  397. decoderConfig = message.decoderConfig;
  398. decoderPending = new Promise( function ( resolve/*, reject*/ ) {
  399. decoderConfig.onModuleLoaded = function ( draco ) {
  400. // Module is Promise-like. Wrap before resolving to avoid loop.
  401. resolve( { draco: draco } );
  402. };
  403. DracoDecoderModule( decoderConfig ); // eslint-disable-line no-undef
  404. } );
  405. break;
  406. case 'decode':
  407. var buffer = message.buffer;
  408. var taskConfig = message.taskConfig;
  409. decoderPending.then( ( module ) => {
  410. var draco = module.draco;
  411. var decoder = new draco.Decoder();
  412. var decoderBuffer = new draco.DecoderBuffer();
  413. decoderBuffer.Init( new Int8Array( buffer ), buffer.byteLength );
  414. try {
  415. var geometry = decodeGeometry( draco, decoder, decoderBuffer, taskConfig );
  416. var buffers = geometry.attributes.map( ( attr ) => attr.array.buffer );
  417. if ( geometry.index ) buffers.push( geometry.index.array.buffer );
  418. self.postMessage( { type: 'decode', id: message.id, geometry }, buffers );
  419. } catch ( error ) {
  420. console.error( error );
  421. self.postMessage( { type: 'error', id: message.id, error: error.message } );
  422. } finally {
  423. draco.destroy( decoderBuffer );
  424. draco.destroy( decoder );
  425. }
  426. } );
  427. break;
  428. }
  429. };
  430. function decodeGeometry( draco, decoder, decoderBuffer, taskConfig ) {
  431. var attributeIDs = taskConfig.attributeIDs;
  432. var attributeTypes = taskConfig.attributeTypes;
  433. var dracoGeometry;
  434. var decodingStatus;
  435. var geometryType = decoder.GetEncodedGeometryType( decoderBuffer );
  436. if ( geometryType === draco.TRIANGULAR_MESH ) {
  437. dracoGeometry = new draco.Mesh();
  438. decodingStatus = decoder.DecodeBufferToMesh( decoderBuffer, dracoGeometry );
  439. } else if ( geometryType === draco.POINT_CLOUD ) {
  440. dracoGeometry = new draco.PointCloud();
  441. decodingStatus = decoder.DecodeBufferToPointCloud( decoderBuffer, dracoGeometry );
  442. } else {
  443. throw new Error( 'THREE.DRACOLoader: Unexpected geometry type.' );
  444. }
  445. if ( ! decodingStatus.ok() || dracoGeometry.ptr === 0 ) {
  446. throw new Error( 'THREE.DRACOLoader: Decoding failed: ' + decodingStatus.error_msg() );
  447. }
  448. var geometry = { index: null, attributes: [] };
  449. // Gather all vertex attributes.
  450. for ( var attributeName in attributeIDs ) {
  451. var attributeType = self[ attributeTypes[ attributeName ] ];
  452. var attribute;
  453. var attributeID;
  454. // A Draco file may be created with default vertex attributes, whose attribute IDs
  455. // are mapped 1:1 from their semantic name (POSITION, NORMAL, ...). Alternatively,
  456. // a Draco file may contain a custom set of attributes, identified by known unique
  457. // IDs. glTF files always do the latter, and `.drc` files typically do the former.
  458. if ( taskConfig.useUniqueIDs ) {
  459. attributeID = attributeIDs[ attributeName ];
  460. attribute = decoder.GetAttributeByUniqueId( dracoGeometry, attributeID );
  461. } else {
  462. attributeID = decoder.GetAttributeId( dracoGeometry, draco[ attributeIDs[ attributeName ] ] );
  463. if ( attributeID === - 1 ) continue;
  464. attribute = decoder.GetAttribute( dracoGeometry, attributeID );
  465. }
  466. geometry.attributes.push( decodeAttribute( draco, decoder, dracoGeometry, attributeName, attributeType, attribute ) );
  467. }
  468. // Add index.
  469. if ( geometryType === draco.TRIANGULAR_MESH ) {
  470. geometry.index = decodeIndex( draco, decoder, dracoGeometry );
  471. }
  472. draco.destroy( dracoGeometry );
  473. return geometry;
  474. }
  475. function decodeIndex( draco, decoder, dracoGeometry ) {
  476. var numFaces = dracoGeometry.num_faces();
  477. var numIndices = numFaces * 3;
  478. var byteLength = numIndices * 4;
  479. var ptr = draco._malloc( byteLength );
  480. decoder.GetTrianglesUInt32Array( dracoGeometry, byteLength, ptr );
  481. var index = new Uint32Array( draco.HEAPF32.buffer, ptr, numIndices ).slice();
  482. draco._free( ptr );
  483. return { array: index, itemSize: 1 };
  484. }
  485. function decodeAttribute( draco, decoder, dracoGeometry, attributeName, attributeType, attribute ) {
  486. var numComponents = attribute.num_components();
  487. var numPoints = dracoGeometry.num_points();
  488. var numValues = numPoints * numComponents;
  489. var byteLength = numValues * attributeType.BYTES_PER_ELEMENT;
  490. var dataType = getDracoDataType( draco, attributeType );
  491. var ptr = draco._malloc( byteLength );
  492. decoder.GetAttributeDataArrayForAllPoints( dracoGeometry, attribute, dataType, byteLength, ptr );
  493. var array = new attributeType( draco.HEAPF32.buffer, ptr, numValues ).slice();
  494. draco._free( ptr );
  495. return {
  496. name: attributeName,
  497. array: array,
  498. itemSize: numComponents
  499. };
  500. }
  501. function getDracoDataType( draco, attributeType ) {
  502. switch ( attributeType ) {
  503. case Float32Array: return draco.DT_FLOAT32;
  504. case Int8Array: return draco.DT_INT8;
  505. case Int16Array: return draco.DT_INT16;
  506. case Int32Array: return draco.DT_INT32;
  507. case Uint8Array: return draco.DT_UINT8;
  508. case Uint16Array: return draco.DT_UINT16;
  509. case Uint32Array: return draco.DT_UINT32;
  510. }
  511. }
  512. };
  513. THREE.DRACOLoader.taskCache = new WeakMap();
  514. /** Deprecated static methods */
  515. /** @deprecated */
  516. THREE.DRACOLoader.setDecoderPath = function () {
  517. console.warn( 'THREE.DRACOLoader: The .setDecoderPath() method has been removed. Use instance methods.' );
  518. };
  519. /** @deprecated */
  520. THREE.DRACOLoader.setDecoderConfig = function () {
  521. console.warn( 'THREE.DRACOLoader: The .setDecoderConfig() method has been removed. Use instance methods.' );
  522. };
  523. /** @deprecated */
  524. THREE.DRACOLoader.releaseDecoderModule = function () {
  525. console.warn( 'THREE.DRACOLoader: The .releaseDecoderModule() method has been removed. Use instance methods.' );
  526. };
  527. /** @deprecated */
  528. THREE.DRACOLoader.getDecoderModule = function () {
  529. console.warn( 'THREE.DRACOLoader: The .getDecoderModule() method has been removed. Use instance methods.' );
  530. };
  531. },{}],59:[function(_dereq_,module,exports){
  532. THREE.GLTFLoader=function(){function e(e){THREE.Loader.call(this,e),this.dracoLoader=null,this.ddsLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new a(e)}),this.register(function(e){return new o(e)}),this.register(function(e){return new l(e)}),this.register(function(e){return new i(e)}),this.register(function(e){return new s(e)}),this.register(function(e){return new u(e)})}function t(){var e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}function r(e){if(!e)throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing THREE.DDSLoader");this.name=w.MSFT_TEXTURE_DDS,this.ddsLoader=e}function s(e){this.parser=e,this.name=w.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}function n(){this.name=w.KHR_MATERIALS_UNLIT}function a(e){this.parser=e,this.name=w.KHR_MATERIALS_CLEARCOAT}function i(e){this.parser=e,this.name=w.KHR_MATERIALS_TRANSMISSION}function o(e){this.parser=e,this.name=w.KHR_TEXTURE_BASISU}function l(e){this.parser=e,this.name=w.EXT_TEXTURE_WEBP,this.isSupported=null}function u(e){this.name=w.EXT_MESHOPT_COMPRESSION,this.parser=e}function c(e){this.name=w.KHR_BINARY_GLTF,this.content=null,this.body=null;var t=new DataView(e,0,I);if(this.header={magic:THREE.LoaderUtils.decodeText(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==b)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var r=this.header.length-I,s=new DataView(e,I),n=0;n<r;){var a=s.getUint32(n,!0);n+=4;var i=s.getUint32(n,!0);if(n+=4,i===N.JSON){var o=new Uint8Array(e,I+n,a);this.content=THREE.LoaderUtils.decodeText(o)}else if(i===N.BIN){var l=I+n;this.body=e.slice(l,l+a)}n+=a}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}function p(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=w.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}function h(){this.name=w.KHR_TEXTURE_TRANSFORM}function d(e){THREE.MeshStandardMaterial.call(this),this.isGLTFSpecularGlossinessMaterial=!0;var t=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),r=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),s=["vec3 specularFactor = specular;","#ifdef USE_SPECULARMAP","\tvec4 texelSpecular = texture2D( specularMap, vUv );","\ttexelSpecular = sRGBToLinear( texelSpecular );","\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture","\tspecularFactor *= texelSpecular.rgb;","#endif"].join("\n"),n=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP","\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );","\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture","\tglossinessFactor *= texelGlossiness.a;","#endif"].join("\n"),a=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );","vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );","material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.","material.specularRoughness += geometryRoughness;","material.specularRoughness = min( material.specularRoughness, 1.0 );","material.specularColor = specularFactor;"].join("\n"),i={specular:{value:(new THREE.Color).setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=i,this.onBeforeCompile=function(e){for(var o in i)e.uniforms[o]=i[o];e.fragmentShader=e.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;").replace("uniform float metalness;","uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>",t).replace("#include <metalnessmap_pars_fragment>",r).replace("#include <roughnessmap_fragment>",s).replace("#include <metalnessmap_fragment>",n).replace("#include <lights_physical_fragment>",a)},Object.defineProperties(this,{specular:{get:function(){return i.specular.value},set:function(e){i.specular.value=e}},specularMap:{get:function(){return i.specularMap.value},set:function(e){i.specularMap.value=e,e?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return i.glossiness.value},set:function(e){i.glossiness.value=e}},glossinessMap:{get:function(){return i.glossinessMap.value},set:function(e){i.glossinessMap.value=e,e?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(e)}function f(){return{name:w.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,specularGlossinessParams:["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"],getMaterialType:function(){return d},extendParams:function(e,t,r){var s=t.extensions[this.name];e.color=new THREE.Color(1,1,1),e.opacity=1;var n=[];if(Array.isArray(s.diffuseFactor)){var a=s.diffuseFactor;e.color.fromArray(a),e.opacity=a[3]}if(void 0!==s.diffuseTexture&&n.push(r.assignTexture(e,"map",s.diffuseTexture)),e.emissive=new THREE.Color(0,0,0),e.glossiness=void 0!==s.glossinessFactor?s.glossinessFactor:1,e.specular=new THREE.Color(1,1,1),Array.isArray(s.specularFactor)&&e.specular.fromArray(s.specularFactor),void 0!==s.specularGlossinessTexture){var i=s.specularGlossinessTexture;n.push(r.assignTexture(e,"glossinessMap",i)),n.push(r.assignTexture(e,"specularMap",i))}return Promise.all(n)},createMaterial:function(e){var t=new d(e);return t.fog=!0,t.color=e.color,t.map=void 0===e.map?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=void 0===e.aoMap?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,t.bumpMap=void 0===e.bumpMap?null:e.bumpMap,t.bumpScale=1,t.normalMap=void 0===e.normalMap?null:e.normalMap,t.normalMapType=THREE.TangentSpaceNormalMap,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=void 0===e.specularMap?null:e.specularMap,t.specular=e.specular,t.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=void 0===e.envMap?null:e.envMap,t.envMapIntensity=1,t.refractionRatio=.98,t}}}function m(){this.name=w.KHR_MESH_QUANTIZATION}function E(e,t,r,s){THREE.Interpolant.call(this,e,t,r,s)}function T(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)?e:/^data:.*,.*$/i.test(e)?e:/^blob:.*$/i.test(e)?e:t+e)}function g(e){return void 0===e.DefaultMaterial&&(e.DefaultMaterial=new THREE.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:THREE.FrontSide})),e.DefaultMaterial}function v(e,t,r){for(var s in r.extensions)void 0===e[s]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[s]=r.extensions[s])}function R(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function M(e,t,r){for(var s=!1,n=!1,a=0,i=t.length;a<i;a++){var o=t[a];if(void 0!==o.POSITION&&(s=!0),void 0!==o.NORMAL&&(n=!0),s&&n)break}if(!s&&!n)return Promise.resolve(e);for(var l=[],u=[],a=0,i=t.length;a<i;a++){var o=t[a];if(s){var c=void 0!==o.POSITION?r.getDependency("accessor",o.POSITION):e.attributes.position;l.push(c)}if(n){var c=void 0!==o.NORMAL?r.getDependency("accessor",o.NORMAL):e.attributes.normal;u.push(c)}}return Promise.all([Promise.all(l),Promise.all(u)]).then(function(t){var r=t[0],a=t[1];return s&&(e.morphAttributes.position=r),n&&(e.morphAttributes.normal=a),e.morphTargetsRelative=!0,e})}function y(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(var r=0,s=t.weights.length;r<s;r++)e.morphTargetInfluences[r]=t.weights[r];if(t.extras&&Array.isArray(t.extras.targetNames)){var n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(var r=0,s=n.length;r<s;r++)e.morphTargetDictionary[n[r]]=r}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function x(e){var t=e.extensions&&e.extensions[w.KHR_DRACO_MESH_COMPRESSION];return t?"draco:"+t.bufferView+":"+t.indices+":"+S(t.attributes):e.indices+":"+S(e.attributes)+":"+e.mode}function S(e){for(var t="",r=Object.keys(e).sort(),s=0,n=r.length;s<n;s++)t+=r[s]+":"+e[r[s]]+";";return t}function A(e,r){this.json=e||{},this.extensions={},this.plugins={},this.options=r||{},this.cache=new t,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.nodeNamesUsed={},"undefined"!=typeof createImageBitmap&&!1===/Firefox/.test(navigator.userAgent)?this.textureLoader=new THREE.ImageBitmapLoader(this.options.manager):this.textureLoader=new THREE.TextureLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.fileLoader=new THREE.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}function _(e,t,r){var s=t.attributes,n=new THREE.Box3;if(void 0!==s.POSITION){var a=r.json.accessors[s.POSITION],i=a.min,o=a.max;if(void 0===i||void 0===o)return void console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");n.set(new THREE.Vector3(i[0],i[1],i[2]),new THREE.Vector3(o[0],o[1],o[2]));var l=t.targets;if(void 0!==l){for(var u=new THREE.Vector3,c=new THREE.Vector3,p=0,h=l.length;p<h;p++){var d=l[p];if(void 0!==d.POSITION){var a=r.json.accessors[d.POSITION],i=a.min,o=a.max;void 0!==i&&void 0!==o?(c.setX(Math.max(Math.abs(i[0]),Math.abs(o[0]))),c.setY(Math.max(Math.abs(i[1]),Math.abs(o[1]))),c.setZ(Math.max(Math.abs(i[2]),Math.abs(o[2]))),u.max(c)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}n.expandByVector(u)}e.boundingBox=n;var f=new THREE.Sphere;n.getCenter(f.center),f.radius=n.min.distanceTo(n.max)/2,e.boundingSphere=f}}function L(e,t,r){var s=t.attributes,n=[];for(var a in s){var i=D[a]||a.toLowerCase();i in e.attributes||n.push(function(t,s){return r.getDependency("accessor",t).then(function(t){e.setAttribute(s,t)})}(s[a],i))}if(void 0!==t.indices&&!e.index){var o=r.getDependency("accessor",t.indices).then(function(t){e.setIndex(t)});n.push(o)}return R(e,t),_(e,t,r),Promise.all(n).then(function(){return void 0!==t.targets?M(e,t.targets,r):e})}function H(e,t){var r=e.getIndex();if(null===r){var s=[],n=e.getAttribute("position");if(void 0===n)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var a=0;a<n.count;a++)s.push(a);e.setIndex(s),r=e.getIndex()}var i=r.count-2,o=[];if(t===THREE.TriangleFanDrawMode)for(var a=1;a<=i;a++)o.push(r.getX(0)),o.push(r.getX(a)),o.push(r.getX(a+1));else for(var a=0;a<i;a++)a%2==0?(o.push(r.getX(a)),o.push(r.getX(a+1)),o.push(r.getX(a+2))):(o.push(r.getX(a+2)),o.push(r.getX(a+1)),o.push(r.getX(a)));o.length/3!==i&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var l=e.clone();return l.setIndex(o),l}e.prototype=Object.assign(Object.create(THREE.Loader.prototype),{constructor:e,load:function(e,t,r,s){var n,a=this;n=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:THREE.LoaderUtils.extractUrlBase(e),this.manager.itemStart(e);var i=function(t){s?s(t):console.error(t),a.manager.itemError(e),a.manager.itemEnd(e)},o=new THREE.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(r){try{a.parse(r,n,function(r){t(r),a.manager.itemEnd(e)},i)}catch(e){i(e)}},r,i)},setDRACOLoader:function(e){return this.dracoLoader=e,this},setDDSLoader:function(e){return this.ddsLoader=e,this},setKTX2Loader:function(e){return this.ktx2Loader=e,this},setMeshoptDecoder:function(e){return this.meshoptDecoder=e,this},register:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this},unregister:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this},parse:function(e,t,s,a){var i,o={},l={};if("string"==typeof e)i=e;else{if(THREE.LoaderUtils.decodeText(new Uint8Array(e,0,4))===b){try{o[w.KHR_BINARY_GLTF]=new c(e)}catch(e){return void(a&&a(e))}i=o[w.KHR_BINARY_GLTF].content}else i=THREE.LoaderUtils.decodeText(new Uint8Array(e))}var u=JSON.parse(i);if(void 0===u.asset||u.asset.version[0]<2)return void(a&&a(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));var d=new A(u,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});d.fileLoader.setRequestHeader(this.requestHeader);for(var E=0;E<this.pluginCallbacks.length;E++){var T=this.pluginCallbacks[E](d);l[T.name]=T,o[T.name]=!0}if(u.extensionsUsed)for(var E=0;E<u.extensionsUsed.length;++E){var g=u.extensionsUsed[E],v=u.extensionsRequired||[];switch(g){case w.KHR_MATERIALS_UNLIT:o[g]=new n;break;case w.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:o[g]=new f;break;case w.KHR_DRACO_MESH_COMPRESSION:o[g]=new p(u,this.dracoLoader);break;case w.MSFT_TEXTURE_DDS:o[g]=new r(this.ddsLoader);break;case w.KHR_TEXTURE_TRANSFORM:o[g]=new h;break;case w.KHR_MESH_QUANTIZATION:o[g]=new m;break;default:v.indexOf(g)>=0&&void 0===l[g]&&console.warn('THREE.GLTFLoader: Unknown extension "'+g+'".')}}d.setExtensions(o),d.setPlugins(l),d.parse(s,a)}});var w={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",MSFT_TEXTURE_DDS:"MSFT_texture_dds"};s.prototype._markDefs=function(){for(var e=this.parser,t=this.parser.json.nodes||[],r=0,s=t.length;r<s;r++){var n=t[r];n.extensions&&n.extensions[this.name]&&void 0!==n.extensions[this.name].light&&e._addNodeRef(this.cache,n.extensions[this.name].light)}},s.prototype._loadLight=function(e){var t=this.parser,r="light:"+e,s=t.cache.get(r);if(s)return s;var n,a=t.json,i=a.extensions&&a.extensions[this.name]||{},o=i.lights||[],l=o[e],u=new THREE.Color(16777215);void 0!==l.color&&u.fromArray(l.color);var c=void 0!==l.range?l.range:0;switch(l.type){case"directional":n=new THREE.DirectionalLight(u),n.target.position.set(0,0,-1),n.add(n.target);break;case"point":n=new THREE.PointLight(u),n.distance=c;break;case"spot":n=new THREE.SpotLight(u),n.distance=c,l.spot=l.spot||{},l.spot.innerConeAngle=void 0!==l.spot.innerConeAngle?l.spot.innerConeAngle:0,l.spot.outerConeAngle=void 0!==l.spot.outerConeAngle?l.spot.outerConeAngle:Math.PI/4,n.angle=l.spot.outerConeAngle,n.penumbra=1-l.spot.innerConeAngle/l.spot.outerConeAngle,n.target.position.set(0,0,-1),n.add(n.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+l.type)}return n.position.set(0,0,0),n.decay=2,void 0!==l.intensity&&(n.intensity=l.intensity),n.name=t.createUniqueName(l.name||"light_"+e),s=Promise.resolve(n),t.cache.add(r,s),s},s.prototype.createNodeAttachment=function(e){var t=this,r=this.parser,s=r.json,n=s.nodes[e],a=n.extensions&&n.extensions[this.name]||{},i=a.light;return void 0===i?null:this._loadLight(i).then(function(e){return r._getNodeRef(t.cache,i,e)})},n.prototype.getMaterialType=function(){return THREE.MeshBasicMaterial},n.prototype.extendParams=function(e,t,r){var s=[];e.color=new THREE.Color(1,1,1),e.opacity=1;var n=t.pbrMetallicRoughness;if(n){if(Array.isArray(n.baseColorFactor)){var a=n.baseColorFactor;e.color.fromArray(a),e.opacity=a[3]}void 0!==n.baseColorTexture&&s.push(r.assignTexture(e,"map",n.baseColorTexture))}return Promise.all(s)},a.prototype.getMaterialType=function(e){var t=this.parser,r=t.json.materials[e];return r.extensions&&r.extensions[this.name]?THREE.MeshPhysicalMaterial:null},a.prototype.extendMaterialParams=function(e,t){var r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();var n=[],a=s.extensions[this.name];if(void 0!==a.clearcoatFactor&&(t.clearcoat=a.clearcoatFactor),void 0!==a.clearcoatTexture&&n.push(r.assignTexture(t,"clearcoatMap",a.clearcoatTexture)),void 0!==a.clearcoatRoughnessFactor&&(t.clearcoatRoughness=a.clearcoatRoughnessFactor),void 0!==a.clearcoatRoughnessTexture&&n.push(r.assignTexture(t,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),void 0!==a.clearcoatNormalTexture&&(n.push(r.assignTexture(t,"clearcoatNormalMap",a.clearcoatNormalTexture)),void 0!==a.clearcoatNormalTexture.scale)){var i=a.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new THREE.Vector2(i,-i)}return Promise.all(n)},i.prototype.getMaterialType=function(e){var t=this.parser,r=t.json.materials[e];return r.extensions&&r.extensions[this.name]?THREE.MeshPhysicalMaterial:null},i.prototype.extendMaterialParams=function(e,t){var r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();var n=[],a=s.extensions[this.name];return void 0!==a.transmissionFactor&&(t.transmission=a.transmissionFactor),void 0!==a.transmissionTexture&&n.push(r.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(n)},o.prototype.loadTexture=function(e){var t=this.parser,r=t.json,s=r.textures[e];if(!s.extensions||!s.extensions[this.name])return null;var n=s.extensions[this.name],a=r.images[n.source],i=t.options.ktx2Loader;if(!i){if(r.extensionsRequired&&r.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,a,i)},l.prototype.loadTexture=function(e){var t=this.name,r=this.parser,s=r.json,n=s.textures[e];if(!n.extensions||!n.extensions[t])return null;var a=n.extensions[t],i=s.images[a.source],o=i.uri?r.options.manager.getHandler(i.uri):r.textureLoader;return this.detectSupport().then(function(n){if(n)return r.loadTextureImage(e,i,o);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})},l.prototype.detectSupport=function(){return this.isSupported||(this.isSupported=new Promise(function(e){var t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported},u.prototype.loadBufferView=function(e){var t=this.parser.json,r=t.bufferViews[e];if(r.extensions&&r.extensions[this.name]){var s=r.extensions[this.name],n=this.parser.getDependency("buffer",s.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return Promise.all([n,a.ready]).then(function(e){var t=s.byteOffset||0,r=s.byteLength||0,n=s.count,i=s.byteStride,o=new ArrayBuffer(n*i),l=new Uint8Array(e[0],t,r);return a.decodeGltfBuffer(new Uint8Array(o),n,i,l,s.mode,s.filter),o})}return null};var b="glTF",I=12,N={JSON:1313821514,BIN:5130562};p.prototype.decodePrimitive=function(e,t){var r=this.json,s=this.dracoLoader,n=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,i={},o={},l={};for(var u in a){var c=D[u]||u.toLowerCase();i[c]=a[u]}for(u in e.attributes){var c=D[u]||u.toLowerCase();if(void 0!==a[u]){var p=r.accessors[e.attributes[u]],h=P[p.componentType];l[c]=h,o[c]=!0===p.normalized}}return t.getDependency("bufferView",n).then(function(e){return new Promise(function(t){s.decodeDracoFile(e,function(e){for(var r in e.attributes){var s=e.attributes[r],n=o[r];void 0!==n&&(s.normalized=n)}t(e)},i,l)})})},h.prototype.extendTexture=function(e,t){return e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),e.needsUpdate=!0,e},d.prototype=Object.create(THREE.MeshStandardMaterial.prototype),d.prototype.constructor=d,d.prototype.copy=function(e){return THREE.MeshStandardMaterial.prototype.copy.call(this,e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this},E.prototype=Object.create(THREE.Interpolant.prototype),E.prototype.constructor=E,E.prototype.copySampleValue_=function(e){for(var t=this.resultBuffer,r=this.sampleValues,s=this.valueSize,n=e*s*3+s,a=0;a!==s;a++)t[a]=r[n+a];return t},E.prototype.beforeStart_=E.prototype.copySampleValue_,E.prototype.afterEnd_=E.prototype.copySampleValue_,E.prototype.interpolate_=function(e,t,r,s){for(var n=this.resultBuffer,a=this.sampleValues,i=this.valueSize,o=2*i,l=3*i,u=s-t,c=(r-t)/u,p=c*c,h=p*c,d=e*l,f=d-l,m=-2*h+3*p,E=h-p,T=1-m,g=E-p+c,v=0;v!==i;v++){var R=a[f+v+i],M=a[f+v+o]*u,y=a[d+v+i],x=a[d+v]*u;n[v]=T*R+g*M+m*y+E*x}return n};var O={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},P={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},F={9728:THREE.NearestFilter,9729:THREE.LinearFilter,9984:THREE.NearestMipmapNearestFilter,9985:THREE.LinearMipmapNearestFilter,9986:THREE.NearestMipmapLinearFilter,9987:THREE.LinearMipmapLinearFilter},C={33071:THREE.ClampToEdgeWrapping,33648:THREE.MirroredRepeatWrapping,10497:THREE.RepeatWrapping},U={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},D={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},G={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},k={CUBICSPLINE:void 0,LINEAR:THREE.InterpolateLinear,STEP:THREE.InterpolateDiscrete},B={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};return A.prototype.setExtensions=function(e){this.extensions=e},A.prototype.setPlugins=function(e){this.plugins=e},A.prototype.parse=function(e,t){var r=this,s=this.json,n=this.extensions;this.cache.removeAll(),this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all([this.getDependencies("scene"),this.getDependencies("animation"),this.getDependencies("camera")]).then(function(t){var a={scene:t[0][s.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:s.asset,parser:r,userData:{}};v(n,a,s),R(a,s),e(a)}).catch(t)},A.prototype._markDefs=function(){for(var e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[],s=0,n=t.length;s<n;s++)for(var a=t[s].joints,i=0,o=a.length;i<o;i++)e[a[i]].isBone=!0;for(var l=0,u=e.length;l<u;l++){var c=e[l];void 0!==c.mesh&&(this._addNodeRef(this.meshCache,c.mesh),void 0!==c.skin&&(r[c.mesh].isSkinnedMesh=!0)),void 0!==c.camera&&this._addNodeRef(this.cameraCache,c.camera)}},A.prototype._addNodeRef=function(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)},A.prototype._getNodeRef=function(e,t,r){if(e.refs[t]<=1)return r;var s=r.clone();return s.name+="_instance_"+e.uses[t]++,s},A.prototype._invokeOne=function(e){var t=Object.values(this.plugins);t.push(this);for(var r=0;r<t.length;r++){var s=e(t[r]);if(s)return s}},A.prototype._invokeAll=function(e){var t=Object.values(this.plugins);t.unshift(this);for(var r=[],s=0;s<t.length;s++){var n=e(t[s]);n&&r.push(n)}return r},A.prototype.getDependency=function(e,t){var r=e+":"+t,s=this.cache.get(r);if(!s){switch(e){case"scene":s=this.loadScene(t);break;case"node":s=this.loadNode(t);break;case"mesh":s=this._invokeOne(function(e){return e.loadMesh&&e.loadMesh(t)});break;case"accessor":s=this.loadAccessor(t);break;case"bufferView":s=this._invokeOne(function(e){return e.loadBufferView&&e.loadBufferView(t)});break;case"buffer":s=this.loadBuffer(t);break;case"material":s=this._invokeOne(function(e){return e.loadMaterial&&e.loadMaterial(t)});break;case"texture":s=this._invokeOne(function(e){return e.loadTexture&&e.loadTexture(t)});break;case"skin":s=this.loadSkin(t);break;case"animation":s=this.loadAnimation(t);break;case"camera":s=this.loadCamera(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(r,s)}return s},A.prototype.getDependencies=function(e){var t=this.cache.get(e);if(!t){var r=this,s=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(s.map(function(t,s){return r.getDependency(e,s)})),this.cache.add(e,t)}return t},A.prototype.loadBuffer=function(e){var t=this.json.buffers[e],r=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[w.KHR_BINARY_GLTF].body);var s=this.options;return new Promise(function(e,n){r.load(T(t.uri,s.path),e,void 0,function(){n(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})},A.prototype.loadBufferView=function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(e){var r=t.byteLength||0,s=t.byteOffset||0;return e.slice(s,s+r)})},A.prototype.loadAccessor=function(e){var t=this,r=this.json,s=this.json.accessors[e];if(void 0===s.bufferView&&void 0===s.sparse)return Promise.resolve(null);var n=[];return void 0!==s.bufferView?n.push(this.getDependency("bufferView",s.bufferView)):n.push(null),void 0!==s.sparse&&(n.push(this.getDependency("bufferView",s.sparse.indices.bufferView)),n.push(this.getDependency("bufferView",s.sparse.values.bufferView))),Promise.all(n).then(function(e){var n,a,i=e[0],o=U[s.type],l=P[s.componentType],u=l.BYTES_PER_ELEMENT,c=u*o,p=s.byteOffset||0,h=void 0!==s.bufferView?r.bufferViews[s.bufferView].byteStride:void 0,d=!0===s.normalized;if(h&&h!==c){var f=Math.floor(p/h),m="InterleavedBuffer:"+s.bufferView+":"+s.componentType+":"+f+":"+s.count,E=t.cache.get(m);E||(n=new l(i,f*h,s.count*h/u),E=new THREE.InterleavedBuffer(n,h/u),t.cache.add(m,E)),a=new THREE.InterleavedBufferAttribute(E,o,p%h/u,d)}else n=null===i?new l(s.count*o):new l(i,p,s.count*o),a=new THREE.BufferAttribute(n,o,d);if(void 0!==s.sparse){var T=U.SCALAR,g=P[s.sparse.indices.componentType],v=s.sparse.indices.byteOffset||0,R=s.sparse.values.byteOffset||0,M=new g(e[1],v,s.sparse.count*T),y=new l(e[2],R,s.sparse.count*o);null!==i&&(a=new THREE.BufferAttribute(a.array.slice(),a.itemSize,a.normalized));for(var x=0,S=M.length;x<S;x++){var A=M[x];if(a.setX(A,y[x*o]),o>=2&&a.setY(A,y[x*o+1]),o>=3&&a.setZ(A,y[x*o+2]),o>=4&&a.setW(A,y[x*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return a})},A.prototype.loadTexture=function(e){var t,r=this,s=this.json,n=this.options,a=s.textures[e],i=a.extensions||{};t=i[w.MSFT_TEXTURE_DDS]?s.images[i[w.MSFT_TEXTURE_DDS].source]:s.images[a.source];var o;return t.uri&&(o=n.manager.getHandler(t.uri)),o||(o=i[w.MSFT_TEXTURE_DDS]?r.extensions[w.MSFT_TEXTURE_DDS].ddsLoader:this.textureLoader),this.loadTextureImage(e,t,o)},A.prototype.loadTextureImage=function(e,t,r){var s=this,n=this.json,a=this.options,i=n.textures[e],o=self.URL||self.webkitURL,l=t.uri,u=!1,c=!0;return"image/jpeg"===t.mimeType&&(c=!1),void 0!==t.bufferView&&(l=s.getDependency("bufferView",t.bufferView).then(function(e){if("image/png"===t.mimeType){var r=new DataView(e,25,1).getUint8(0,!1);c=6===r||4===r||3===r}u=!0;var s=new Blob([e],{type:t.mimeType});return l=o.createObjectURL(s)})),Promise.resolve(l).then(function(e){return new Promise(function(t,s){var n=t;!0===r.isImageBitmapLoader&&(n=function(e){t(new THREE.CanvasTexture(e))}),r.load(T(e,a.path),n,void 0,s)})}).then(function(t){!0===u&&o.revokeObjectURL(l),t.flipY=!1,i.name&&(t.name=i.name),c||(t.format=THREE.RGBFormat);var r=n.samplers||{},a=r[i.sampler]||{};return t.magFilter=F[a.magFilter]||THREE.LinearFilter,t.minFilter=F[a.minFilter]||THREE.LinearMipmapLinearFilter,t.wrapS=C[a.wrapS]||THREE.RepeatWrapping,t.wrapT=C[a.wrapT]||THREE.RepeatWrapping,s.associations.set(t,{type:"textures",index:e}),t})},A.prototype.assignTexture=function(e,t,r){var s=this;return this.getDependency("texture",r.index).then(function(n){if(void 0===r.texCoord||0==r.texCoord||"aoMap"===t&&1==r.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+r.texCoord+" for texture "+t+" not yet supported."),s.extensions[w.KHR_TEXTURE_TRANSFORM]){var a=void 0!==r.extensions?r.extensions[w.KHR_TEXTURE_TRANSFORM]:void 0;if(a){var i=s.associations.get(n);n=s.extensions[w.KHR_TEXTURE_TRANSFORM].extendTexture(n,a),s.associations.set(n,i)}}e[t]=n})},A.prototype.assignFinalMaterial=function(e){var t=e.geometry,r=e.material,s=void 0!==t.attributes.tangent,n=void 0!==t.attributes.color,a=void 0===t.attributes.normal,i=!0===e.isSkinnedMesh,o=Object.keys(t.morphAttributes).length>0,l=o&&void 0!==t.morphAttributes.normal;if(e.isPoints){var u="PointsMaterial:"+r.uuid,c=this.cache.get(u);c||(c=new THREE.PointsMaterial,THREE.Material.prototype.copy.call(c,r),c.color.copy(r.color),c.map=r.map,c.sizeAttenuation=!1,this.cache.add(u,c)),r=c}else if(e.isLine){var u="LineBasicMaterial:"+r.uuid,p=this.cache.get(u);p||(p=new THREE.LineBasicMaterial,THREE.Material.prototype.copy.call(p,r),p.color.copy(r.color),this.cache.add(u,p)),r=p}if(s||n||a||i||o){var u="ClonedMaterial:"+r.uuid+":";r.isGLTFSpecularGlossinessMaterial&&(u+="specular-glossiness:"),i&&(u+="skinning:"),s&&(u+="vertex-tangents:"),n&&(u+="vertex-colors:"),a&&(u+="flat-shading:"),o&&(u+="morph-targets:"),l&&(u+="morph-normals:");var h=this.cache.get(u);h||(h=r.clone(),i&&(h.skinning=!0),n&&(h.vertexColors=!0),a&&(h.flatShading=!0),o&&(h.morphTargets=!0),l&&(h.morphNormals=!0),s&&(h.vertexTangents=!0,r.normalScale&&(r.normalScale.y*=-1),r.clearcoatNormalScale&&(r.clearcoatNormalScale.y*=-1)),this.cache.add(u,h),this.associations.set(h,this.associations.get(r))),r=h}r.aoMap&&void 0===t.attributes.uv2&&void 0!==t.attributes.uv&&t.setAttribute("uv2",t.attributes.uv),e.material=r},A.prototype.getMaterialType=function(){return THREE.MeshStandardMaterial},A.prototype.loadMaterial=function(e){var t,r=this,s=this.json,n=this.extensions,a=s.materials[e],i={},o=a.extensions||{},l=[];if(o[w.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var u=n[w.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];t=u.getMaterialType(),l.push(u.extendParams(i,a,r))}else if(o[w.KHR_MATERIALS_UNLIT]){var c=n[w.KHR_MATERIALS_UNLIT];t=c.getMaterialType(),
  533. l.push(c.extendParams(i,a,r))}else{var p=a.pbrMetallicRoughness||{};if(i.color=new THREE.Color(1,1,1),i.opacity=1,Array.isArray(p.baseColorFactor)){var h=p.baseColorFactor;i.color.fromArray(h),i.opacity=h[3]}void 0!==p.baseColorTexture&&l.push(r.assignTexture(i,"map",p.baseColorTexture)),i.metalness=void 0!==p.metallicFactor?p.metallicFactor:1,i.roughness=void 0!==p.roughnessFactor?p.roughnessFactor:1,void 0!==p.metallicRoughnessTexture&&(l.push(r.assignTexture(i,"metalnessMap",p.metallicRoughnessTexture)),l.push(r.assignTexture(i,"roughnessMap",p.metallicRoughnessTexture))),t=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),l.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,i)})))}!0===a.doubleSided&&(i.side=THREE.DoubleSide);var f=a.alphaMode||B.OPAQUE;return f===B.BLEND?(i.transparent=!0,i.depthWrite=!1):(i.transparent=!1,f===B.MASK&&(i.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&t!==THREE.MeshBasicMaterial&&(l.push(r.assignTexture(i,"normalMap",a.normalTexture)),i.normalScale=new THREE.Vector2(1,-1),void 0!==a.normalTexture.scale&&i.normalScale.set(a.normalTexture.scale,-a.normalTexture.scale)),void 0!==a.occlusionTexture&&t!==THREE.MeshBasicMaterial&&(l.push(r.assignTexture(i,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(i.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&t!==THREE.MeshBasicMaterial&&(i.emissive=(new THREE.Color).fromArray(a.emissiveFactor)),void 0!==a.emissiveTexture&&t!==THREE.MeshBasicMaterial&&l.push(r.assignTexture(i,"emissiveMap",a.emissiveTexture)),Promise.all(l).then(function(){var s;return s=t===d?n[w.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(i):new t(i),a.name&&(s.name=a.name),s.map&&(s.map.encoding=THREE.sRGBEncoding),s.emissiveMap&&(s.emissiveMap.encoding=THREE.sRGBEncoding),R(s,a),r.associations.set(s,{type:"materials",index:e}),a.extensions&&v(n,s,a),s})},A.prototype.createUniqueName=function(e){for(var t=THREE.PropertyBinding.sanitizeNodeName(e||""),r=t,s=1;this.nodeNamesUsed[r];++s)r=t+"_"+s;return this.nodeNamesUsed[r]=!0,r},A.prototype.loadGeometries=function(e){for(var t=this,r=this.extensions,s=this.primitiveCache,n=[],a=0,i=e.length;a<i;a++){var o=e[a],l=x(o),u=s[l];if(u)n.push(u.promise);else{var c;c=o.extensions&&o.extensions[w.KHR_DRACO_MESH_COMPRESSION]?function(e){return r[w.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(r){return L(r,e,t)})}(o):L(new THREE.BufferGeometry,o,t),s[l]={primitive:o,promise:c},n.push(c)}}return Promise.all(n)},A.prototype.loadMesh=function(e){for(var t=this,r=this.json,s=this.extensions,n=r.meshes[e],a=n.primitives,i=[],o=0,l=a.length;o<l;o++){var u=void 0===a[o].material?g(this.cache):this.getDependency("material",a[o].material);i.push(u)}return i.push(t.loadGeometries(a)),Promise.all(i).then(function(r){for(var i=r.slice(0,r.length-1),o=r[r.length-1],l=[],u=0,c=o.length;u<c;u++){var p,h=o[u],d=a[u],f=i[u];if(d.mode===O.TRIANGLES||d.mode===O.TRIANGLE_STRIP||d.mode===O.TRIANGLE_FAN||void 0===d.mode)p=!0===n.isSkinnedMesh?new THREE.SkinnedMesh(h,f):new THREE.Mesh(h,f),!0===f.isMeshStandardMaterial&&f.side===THREE.DoubleSide&&null!==h.getIndex()&&!0===h.hasAttribute("position")&&!0===h.hasAttribute("normal")&&!0===h.hasAttribute("uv")&&!1===h.hasAttribute("tangent")&&(h.computeTangents(),f.vertexTangents=!0),!0!==p.isSkinnedMesh||p.geometry.attributes.skinWeight.normalized||p.normalizeSkinWeights(),d.mode===O.TRIANGLE_STRIP?p.geometry=H(p.geometry,THREE.TriangleStripDrawMode):d.mode===O.TRIANGLE_FAN&&(p.geometry=H(p.geometry,THREE.TriangleFanDrawMode));else if(d.mode===O.LINES)p=new THREE.LineSegments(h,f);else if(d.mode===O.LINE_STRIP)p=new THREE.Line(h,f);else if(d.mode===O.LINE_LOOP)p=new THREE.LineLoop(h,f);else{if(d.mode!==O.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+d.mode);p=new THREE.Points(h,f)}Object.keys(p.geometry.morphAttributes).length>0&&y(p,n),p.name=t.createUniqueName(n.name||"mesh_"+e),R(p,n),d.extensions&&v(s,p,d),t.assignFinalMaterial(p),l.push(p)}if(1===l.length)return l[0];for(var m=new THREE.Group,u=0,c=l.length;u<c;u++)m.add(l[u]);return m})},A.prototype.loadCamera=function(e){var t,r=this.json.cameras[e],s=r[r.type];return s?("perspective"===r.type?t=new THREE.PerspectiveCamera(THREE.MathUtils.radToDeg(s.yfov),s.aspectRatio||1,s.znear||1,s.zfar||2e6):"orthographic"===r.type&&(t=new THREE.OrthographicCamera(-s.xmag,s.xmag,s.ymag,-s.ymag,s.znear,s.zfar)),r.name&&(t.name=this.createUniqueName(r.name)),R(t,r),Promise.resolve(t)):void console.warn("THREE.GLTFLoader: Missing camera parameters.")},A.prototype.loadSkin=function(e){var t=this.json.skins[e],r={joints:t.joints};return void 0===t.inverseBindMatrices?Promise.resolve(r):this.getDependency("accessor",t.inverseBindMatrices).then(function(e){return r.inverseBindMatrices=e,r})},A.prototype.loadAnimation=function(e){for(var t=this.json,r=t.animations[e],s=[],n=[],a=[],i=[],o=[],l=0,u=r.channels.length;l<u;l++){var c=r.channels[l],p=r.samplers[c.sampler],h=c.target,d=void 0!==h.node?h.node:h.id,f=void 0!==r.parameters?r.parameters[p.input]:p.input,m=void 0!==r.parameters?r.parameters[p.output]:p.output;s.push(this.getDependency("node",d)),n.push(this.getDependency("accessor",f)),a.push(this.getDependency("accessor",m)),i.push(p),o.push(h)}return Promise.all([Promise.all(s),Promise.all(n),Promise.all(a),Promise.all(i),Promise.all(o)]).then(function(t){for(var s=t[0],n=t[1],a=t[2],i=t[3],o=t[4],l=[],u=0,c=s.length;u<c;u++){var p=s[u],h=n[u],d=a[u],f=i[u],m=o[u];if(void 0!==p){p.updateMatrix(),p.matrixAutoUpdate=!0;var T;switch(G[m.path]){case G.weights:T=THREE.NumberKeyframeTrack;break;case G.rotation:T=THREE.QuaternionKeyframeTrack;break;case G.position:case G.scale:default:T=THREE.VectorKeyframeTrack}var g=p.name?p.name:p.uuid,v=void 0!==f.interpolation?k[f.interpolation]:THREE.InterpolateLinear,R=[];G[m.path]===G.weights?p.traverse(function(e){!0===e.isMesh&&e.morphTargetInfluences&&R.push(e.name?e.name:e.uuid)}):R.push(g);var M=d.array;if(d.normalized){var y;if(M.constructor===Int8Array)y=1/127;else if(M.constructor===Uint8Array)y=1/255;else if(M.constructor==Int16Array)y=1/32767;else{if(M.constructor!==Uint16Array)throw new Error("THREE.GLTFLoader: Unsupported output accessor component type.");y=1/65535}for(var x=new Float32Array(M.length),S=0,A=M.length;S<A;S++)x[S]=M[S]*y;M=x}for(var S=0,A=R.length;S<A;S++){var _=new T(R[S]+"."+G[m.path],h.array,M,v);"CUBICSPLINE"===f.interpolation&&(_.createInterpolant=function(e){return new E(this.times,this.values,this.getValueSize()/3,e)},_.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),l.push(_)}}}var L=r.name?r.name:"animation_"+e;return new THREE.AnimationClip(L,void 0,l)})},A.prototype.loadNode=function(e){var t=this.json,r=this.extensions,s=this,n=t.nodes[e],a=n.name?s.createUniqueName(n.name):"";return function(){var t=[];return void 0!==n.mesh&&t.push(s.getDependency("mesh",n.mesh).then(function(e){var t=s._getNodeRef(s.meshCache,n.mesh,e);return void 0!==n.weights&&t.traverse(function(e){if(e.isMesh)for(var t=0,r=n.weights.length;t<r;t++)e.morphTargetInfluences[t]=n.weights[t]}),t})),void 0!==n.camera&&t.push(s.getDependency("camera",n.camera).then(function(e){return s._getNodeRef(s.cameraCache,n.camera,e)})),s._invokeAll(function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)}).forEach(function(e){t.push(e)}),Promise.all(t)}().then(function(t){var i;if((i=!0===n.isBone?new THREE.Bone:t.length>1?new THREE.Group:1===t.length?t[0]:new THREE.Object3D)!==t[0])for(var o=0,l=t.length;o<l;o++)i.add(t[o]);if(n.name&&(i.userData.name=n.name,i.name=a),R(i,n),n.extensions&&v(r,i,n),void 0!==n.matrix){var u=new THREE.Matrix4;u.fromArray(n.matrix),i.applyMatrix4(u)}else void 0!==n.translation&&i.position.fromArray(n.translation),void 0!==n.rotation&&i.quaternion.fromArray(n.rotation),void 0!==n.scale&&i.scale.fromArray(n.scale);return s.associations.set(i,{type:"nodes",index:e}),i})},A.prototype.loadScene=function(){function e(t,r,s,n){var a=s.nodes[t];return n.getDependency("node",t).then(function(e){if(void 0===a.skin)return e;var t;return n.getDependency("skin",a.skin).then(function(e){t=e;for(var r=[],s=0,a=t.joints.length;s<a;s++)r.push(n.getDependency("node",t.joints[s]));return Promise.all(r)}).then(function(r){return e.traverse(function(e){if(e.isMesh){for(var s=[],n=[],a=0,i=r.length;a<i;a++){var o=r[a];if(o){s.push(o);var l=new THREE.Matrix4;void 0!==t.inverseBindMatrices&&l.fromArray(t.inverseBindMatrices.array,16*a),n.push(l)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[a])}e.bind(new THREE.Skeleton(s,n),e.matrixWorld)}}),e})}).then(function(t){r.add(t);var i=[];if(a.children)for(var o=a.children,l=0,u=o.length;l<u;l++){var c=o[l];i.push(e(c,t,s,n))}return Promise.all(i)})}return function(t){var r=this.json,s=this.extensions,n=this.json.scenes[t],a=this,i=new THREE.Group;n.name&&(i.name=a.createUniqueName(n.name)),R(i,n),n.extensions&&v(s,i,n);for(var o=n.nodes||[],l=[],u=0,c=o.length;u<c;u++)l.push(e(o[u],i,r,a));return Promise.all(l).then(function(){return i})}}(),e}();
  534. },{}],60:[function(_dereq_,module,exports){
  535. THREE.MTLLoader=function(t){THREE.Loader.call(this,t)},THREE.MTLLoader.prototype=Object.assign(Object.create(THREE.Loader.prototype),{constructor:THREE.MTLLoader,load:function(t,a,e,r){var s=this,i=""===this.path?THREE.LoaderUtils.extractUrlBase(t):this.path,o=new THREE.FileLoader(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,function(e){try{a(s.parse(e,i))}catch(a){r?r(a):console.error(a),s.manager.itemError(t)}},e,r)},setMaterialOptions:function(t){return this.materialOptions=t,this},parse:function(t,a){for(var e=t.split("\n"),r={},s=/\s+/,i={},o=0;o<e.length;o++){var n=e[o];if(n=n.trim(),0!==n.length&&"#"!==n.charAt(0)){var p=n.indexOf(" "),l=p>=0?n.substring(0,p):n;l=l.toLowerCase();var h=p>=0?n.substring(p+1):"";if(h=h.trim(),"newmtl"===l)r={name:h},i[h]=r;else if("ka"===l||"kd"===l||"ks"===l||"ke"===l){var c=h.split(s,3);r[l]=[parseFloat(c[0]),parseFloat(c[1]),parseFloat(c[2])]}else r[l]=h}}var u=new THREE.MTLLoader.MaterialCreator(this.resourcePath||a,this.materialOptions);return u.setCrossOrigin(this.crossOrigin),u.setManager(this.manager),u.setMaterials(i),u}}),THREE.MTLLoader.MaterialCreator=function(t,a){this.baseUrl=t||"",this.options=a,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.side=this.options&&this.options.side?this.options.side:THREE.FrontSide,this.wrap=this.options&&this.options.wrap?this.options.wrap:THREE.RepeatWrapping},THREE.MTLLoader.MaterialCreator.prototype={constructor:THREE.MTLLoader.MaterialCreator,crossOrigin:"anonymous",setCrossOrigin:function(t){return this.crossOrigin=t,this},setManager:function(t){this.manager=t},setMaterials:function(t){this.materialsInfo=this.convert(t),this.materials={},this.materialsArray=[],this.nameLookup={}},convert:function(t){if(!this.options)return t;var a={};for(var e in t){var r=t[e],s={};a[e]=s;for(var i in r){var o=!0,n=r[i],p=i.toLowerCase();switch(p){case"kd":case"ka":case"ks":this.options&&this.options.normalizeRGB&&(n=[n[0]/255,n[1]/255,n[2]/255]),this.options&&this.options.ignoreZeroRGBs&&0===n[0]&&0===n[1]&&0===n[2]&&(o=!1)}o&&(s[p]=n)}}return a},preload:function(){for(var t in this.materialsInfo)this.create(t)},getIndex:function(t){return this.nameLookup[t]},getAsArray:function(){var t=0;for(var a in this.materialsInfo)this.materialsArray[t]=this.create(a),this.nameLookup[a]=t,t++;return this.materialsArray},create:function(t){return void 0===this.materials[t]&&this.createMaterial_(t),this.materials[t]},createMaterial_:function(t){function a(t,a){return"string"!=typeof a||""===a?"":/^https?:\/\//i.test(a)?a:t+a}function e(t,e){if(!i[t]){var s=r.getTextureParams(e,i),o=r.loadTexture(a(r.baseUrl,s.url));o.repeat.copy(s.scale),o.offset.copy(s.offset),o.wrapS=r.wrap,o.wrapT=r.wrap,i[t]=o}}var r=this,s=this.materialsInfo[t],i={name:t,side:this.side};for(var o in s){var n,p=s[o];if(""!==p)switch(o.toLowerCase()){case"kd":i.color=(new THREE.Color).fromArray(p);break;case"ks":i.specular=(new THREE.Color).fromArray(p);break;case"ke":i.emissive=(new THREE.Color).fromArray(p);break;case"map_kd":e("map",p);break;case"map_ks":e("specularMap",p);break;case"map_ke":e("emissiveMap",p);break;case"norm":e("normalMap",p);break;case"map_bump":case"bump":e("bumpMap",p);break;case"map_d":e("alphaMap",p),i.transparent=!0;break;case"ns":i.shininess=parseFloat(p);break;case"d":n=parseFloat(p),n<1&&(i.opacity=n,i.transparent=!0);break;case"tr":n=parseFloat(p),this.options&&this.options.invertTrProperty&&(n=1-n),n>0&&(i.opacity=1-n,i.transparent=!0)}}return this.materials[t]=new THREE.MeshPhongMaterial(i),this.materials[t]},getTextureParams:function(t,a){var e,r={scale:new THREE.Vector2(1,1),offset:new THREE.Vector2(0,0)},s=t.split(/\s+/);return e=s.indexOf("-bm"),e>=0&&(a.bumpScale=parseFloat(s[e+1]),s.splice(e,2)),e=s.indexOf("-s"),e>=0&&(r.scale.set(parseFloat(s[e+1]),parseFloat(s[e+2])),s.splice(e,4)),e=s.indexOf("-o"),e>=0&&(r.offset.set(parseFloat(s[e+1]),parseFloat(s[e+2])),s.splice(e,4)),r.url=s.join(" ").trim(),r},loadTexture:function(t,a,e,r,s){var i,o=void 0!==this.manager?this.manager:THREE.DefaultLoadingManager,n=o.getHandler(t);return null===n&&(n=new THREE.TextureLoader(o)),n.setCrossOrigin&&n.setCrossOrigin(this.crossOrigin),i=n.load(t,e,r,s),void 0!==a&&(i.mapping=a),i}};
  536. },{}],61:[function(_dereq_,module,exports){
  537. THREE.OBJLoader=function(){function e(){var e={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=e,void(this.object.fromDeclaration=!1!==t);var r=this.object&&"function"==typeof this.object.currentMaterial?this.object.currentMaterial():void 0;if(this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:!1!==t,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(e,t){var r=this._finalize(!1);r&&(r.inherited||r.groupCount<=0)&&this.materials.splice(r.index,1);var i={index:this.materials.length,name:e||"",mtllib:Array.isArray(t)&&t.length>0?t[t.length-1]:"",smooth:void 0!==r?r.smooth:this.smooth,groupStart:void 0!==r?r.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){var t={index:"number"==typeof e?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return t.clone=this.clone.bind(t),t}};return this.materials.push(i),i},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(e){var t=this.currentMaterial();if(t&&-1===t.groupEnd&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&this.materials.length>1)for(var r=this.materials.length-1;r>=0;r--)this.materials[r].groupCount<=0&&this.materials.splice(r,1);return e&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),t}},r&&r.name&&"function"==typeof r.clone){var i=r.clone(0);i.inherited=!0,this.object.materials.push(i)}this.objects.push(this.object)},finalize:function(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(e,t){var r=parseInt(e,10);return 3*(r>=0?r-1:r+t/3)},parseNormalIndex:function(e,t){var r=parseInt(e,10);return 3*(r>=0?r-1:r+t/3)},parseUVIndex:function(e,t){var r=parseInt(e,10);return 2*(r>=0?r-1:r+t/2)},addVertex:function(e,t,r){var i=this.vertices,s=this.object.geometry.vertices;s.push(i[e+0],i[e+1],i[e+2]),s.push(i[t+0],i[t+1],i[t+2]),s.push(i[r+0],i[r+1],i[r+2])},addVertexPoint:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,r){var i=this.normals,s=this.object.geometry.normals;s.push(i[e+0],i[e+1],i[e+2]),s.push(i[t+0],i[t+1],i[t+2]),s.push(i[r+0],i[r+1],i[r+2])},addFaceNormal:function(e,t,r){var i=this.vertices,s=this.object.geometry.normals;o.fromArray(i,e),n.fromArray(i,t),l.fromArray(i,r),c.subVectors(l,n),h.subVectors(o,n),c.cross(h),c.normalize(),s.push(c.x,c.y,c.z),s.push(c.x,c.y,c.z),s.push(c.x,c.y,c.z)},addColor:function(e,t,r){var i=this.colors,s=this.object.geometry.colors;void 0!==i[e]&&s.push(i[e+0],i[e+1],i[e+2]),void 0!==i[t]&&s.push(i[t+0],i[t+1],i[t+2]),void 0!==i[r]&&s.push(i[r+0],i[r+1],i[r+2])},addUV:function(e,t,r){var i=this.uvs,s=this.object.geometry.uvs;s.push(i[e+0],i[e+1]),s.push(i[t+0],i[t+1]),s.push(i[r+0],i[r+1])},addDefaultUV:function(){var e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){var t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,r,i,s,a,o,n,l){var h=this.vertices.length,c=this.parseVertexIndex(e,h),u=this.parseVertexIndex(t,h),p=this.parseVertexIndex(r,h);if(this.addVertex(c,u,p),this.addColor(c,u,p),void 0!==o&&""!==o){var m=this.normals.length;c=this.parseNormalIndex(o,m),u=this.parseNormalIndex(n,m),p=this.parseNormalIndex(l,m),this.addNormal(c,u,p)}else this.addFaceNormal(c,u,p);if(void 0!==i&&""!==i){var d=this.uvs.length;c=this.parseUVIndex(i,d),u=this.parseUVIndex(s,d),p=this.parseUVIndex(a,d),this.addUV(c,u,p),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";for(var t=this.vertices.length,r=0,i=e.length;r<i;r++){var s=this.parseVertexIndex(e[r],t);this.addVertexPoint(s),this.addColor(s)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";for(var r=this.vertices.length,i=this.uvs.length,s=0,a=e.length;s<a;s++)this.addVertexLine(this.parseVertexIndex(e[s],r));for(var o=0,a=t.length;o<a;o++)this.addUVLine(this.parseUVIndex(t[o],i))}};return e.startObject("",!1),e}function t(e){THREE.Loader.call(this,e),this.materials=null}var r=/^[og]\s*(.+)?/,i=/^mtllib /,s=/^usemtl /,a=/^usemap /,o=new THREE.Vector3,n=new THREE.Vector3,l=new THREE.Vector3,h=new THREE.Vector3,c=new THREE.Vector3;return t.prototype=Object.assign(Object.create(THREE.Loader.prototype),{constructor:t,load:function(e,t,r,i){var s=this,a=new THREE.FileLoader(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(r){try{t(s.parse(r))}catch(t){i?i(t):console.error(t),s.manager.itemError(e)}},r,i)},setMaterials:function(e){return this.materials=e,this},parse:function(t){var o=new e;-1!==t.indexOf("\r\n")&&(t=t.replace(/\r\n/g,"\n")),-1!==t.indexOf("\\\n")&&(t=t.replace(/\\\n/g,""));for(var n=t.split("\n"),l="",h="",c=[],u="function"==typeof"".trimLeft,p=0,m=n.length;p<m;p++)if(l=n[p],l=u?l.trimLeft():l.trim(),0!==l.length&&"#"!==(h=l.charAt(0)))if("v"===h){var d=l.split(/\s+/);switch(d[0]){case"v":o.vertices.push(parseFloat(d[1]),parseFloat(d[2]),parseFloat(d[3])),d.length>=7?o.colors.push(parseFloat(d[4]),parseFloat(d[5]),parseFloat(d[6])):o.colors.push(void 0,void 0,void 0);break;case"vn":o.normals.push(parseFloat(d[1]),parseFloat(d[2]),parseFloat(d[3]));break;case"vt":o.uvs.push(parseFloat(d[1]),parseFloat(d[2]))}}else if("f"===h){for(var f=l.substr(1).trim(),v=f.split(/\s+/),g=[],E=0,b=v.length;E<b;E++){var y=v[E];if(y.length>0){var j=y.split("/");g.push(j)}}for(var x=g[0],E=1,b=g.length-1;E<b;E++){var H=g[E],R=g[E+1];o.addFace(x[0],H[0],R[0],x[1],H[1],R[1],x[2],H[2],R[2])}}else if("l"===h){var T=l.substring(1).trim().split(" "),w=[],V=[];if(-1===l.indexOf("/"))w=T;else for(var L=0,F=T.length;L<F;L++){var M=T[L].split("/");""!==M[0]&&w.push(M[0]),""!==M[1]&&V.push(M[1])}o.addLineGeometry(w,V)}else if("p"===h){var f=l.substr(1).trim(),A=f.split(" ");o.addPointGeometry(A)}else if(null!==(c=r.exec(l))){var I=(" "+c[0].substr(1).trim()).substr(1);o.startObject(I)}else if(s.test(l))o.object.startMaterial(l.substring(7).trim(),o.materialLibraries);else if(i.test(l))o.materialLibraries.push(l.substring(7).trim());else if(a.test(l))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if("s"===h){if(c=l.split(" "),c.length>1){var z=c[1].trim().toLowerCase();o.object.smooth="0"!==z&&"off"!==z}else o.object.smooth=!0;var P=o.object.currentMaterial();P&&(P.smooth=o.object.smooth)}else{if("\0"===l)continue;console.warn('THREE.OBJLoader: Unexpected line: "'+l+'"')}o.finalize();var U=new THREE.Group;if(U.materialLibraries=[].concat(o.materialLibraries),!0==!(1===o.objects.length&&0===o.objects[0].geometry.vertices.length))for(var p=0,m=o.objects.length;p<m;p++){var B=o.objects[p],C=B.geometry,O=B.materials,G="Line"===C.type,N="Points"===C.type,_=!1;if(0!==C.vertices.length){var S=new THREE.BufferGeometry;S.setAttribute("position",new THREE.Float32BufferAttribute(C.vertices,3)),C.normals.length>0&&S.setAttribute("normal",new THREE.Float32BufferAttribute(C.normals,3)),C.colors.length>0&&(_=!0,S.setAttribute("color",new THREE.Float32BufferAttribute(C.colors,3))),!0===C.hasUVIndices&&S.setAttribute("uv",new THREE.Float32BufferAttribute(C.uvs,2));for(var D=[],J=0,k=O.length;J<k;J++){var q=O[J],W=q.name+"_"+q.smooth+"_"+_,P=o.materials[W];if(null!==this.materials)if(P=this.materials.create(q.name),!G||!P||P instanceof THREE.LineBasicMaterial){if(N&&P&&!(P instanceof THREE.PointsMaterial)){var K=new THREE.PointsMaterial({size:10,sizeAttenuation:!1});THREE.Material.prototype.copy.call(K,P),K.color.copy(P.color),K.map=P.map,P=K}}else{var Q=new THREE.LineBasicMaterial;THREE.Material.prototype.copy.call(Q,P),Q.color.copy(P.color),P=Q}void 0===P&&(P=G?new THREE.LineBasicMaterial:N?new THREE.PointsMaterial({size:1,sizeAttenuation:!1}):new THREE.MeshPhongMaterial,P.name=q.name,P.flatShading=!q.smooth,P.vertexColors=_,o.materials[W]=P),D.push(P)}var X;if(D.length>1){for(var J=0,k=O.length;J<k;J++){var q=O[J];S.addGroup(q.groupStart,q.groupCount,J)}X=G?new THREE.LineSegments(S,D):N?new THREE.Points(S,D):new THREE.Mesh(S,D)}else X=G?new THREE.LineSegments(S,D[0]):N?new THREE.Points(S,D[0]):new THREE.Mesh(S,D[0]);X.name=B.name,U.add(X)}}else if(o.vertices.length>0){var P=new THREE.PointsMaterial({size:1,sizeAttenuation:!1}),S=new THREE.BufferGeometry;S.setAttribute("position",new THREE.Float32BufferAttribute(o.vertices,3)),o.colors.length>0&&void 0!==o.colors[0]&&(S.setAttribute("color",new THREE.Float32BufferAttribute(o.colors,3)),P.vertexColors=!0);var Y=new THREE.Points(S,P);U.add(Y)}return U}}),t}();
  538. },{}],62:[function(_dereq_,module,exports){
  539. THREE.BufferGeometryUtils = {
  540. computeTangents: function ( geometry ) {
  541. geometry.computeTangents();
  542. console.warn( 'THREE.BufferGeometryUtils: .computeTangents() has been removed. Use BufferGeometry.computeTangents() instead.' );
  543. },
  544. /**
  545. * @param {Array<THREE.BufferGeometry>} geometries
  546. * @param {Boolean} useGroups
  547. * @return {THREE.BufferGeometry}
  548. */
  549. mergeBufferGeometries: function ( geometries, useGroups ) {
  550. var isIndexed = geometries[ 0 ].index !== null;
  551. var attributesUsed = new Set( Object.keys( geometries[ 0 ].attributes ) );
  552. var morphAttributesUsed = new Set( Object.keys( geometries[ 0 ].morphAttributes ) );
  553. var attributes = {};
  554. var morphAttributes = {};
  555. var morphTargetsRelative = geometries[ 0 ].morphTargetsRelative;
  556. var mergedGeometry = new THREE.BufferGeometry();
  557. var offset = 0;
  558. for ( var i = 0; i < geometries.length; ++ i ) {
  559. var geometry = geometries[ i ];
  560. var attributesCount = 0;
  561. // ensure that all geometries are indexed, or none
  562. if ( isIndexed !== ( geometry.index !== null ) ) {
  563. console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' + i + '. All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them.' );
  564. return null;
  565. }
  566. // gather attributes, exit early if they're different
  567. for ( var name in geometry.attributes ) {
  568. if ( ! attributesUsed.has( name ) ) {
  569. console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' + i + '. All geometries must have compatible attributes; make sure "' + name + '" attribute exists among all geometries, or in none of them.' );
  570. return null;
  571. }
  572. if ( attributes[ name ] === undefined ) attributes[ name ] = [];
  573. attributes[ name ].push( geometry.attributes[ name ] );
  574. attributesCount ++;
  575. }
  576. // ensure geometries have the same number of attributes
  577. if ( attributesCount !== attributesUsed.size ) {
  578. console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' + i + '. Make sure all geometries have the same number of attributes.' );
  579. return null;
  580. }
  581. // gather morph attributes, exit early if they're different
  582. if ( morphTargetsRelative !== geometry.morphTargetsRelative ) {
  583. console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' + i + '. .morphTargetsRelative must be consistent throughout all geometries.' );
  584. return null;
  585. }
  586. for ( var name in geometry.morphAttributes ) {
  587. if ( ! morphAttributesUsed.has( name ) ) {
  588. console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' + i + '. .morphAttributes must be consistent throughout all geometries.' );
  589. return null;
  590. }
  591. if ( morphAttributes[ name ] === undefined ) morphAttributes[ name ] = [];
  592. morphAttributes[ name ].push( geometry.morphAttributes[ name ] );
  593. }
  594. // gather .userData
  595. mergedGeometry.userData.mergedUserData = mergedGeometry.userData.mergedUserData || [];
  596. mergedGeometry.userData.mergedUserData.push( geometry.userData );
  597. if ( useGroups ) {
  598. var count;
  599. if ( isIndexed ) {
  600. count = geometry.index.count;
  601. } else if ( geometry.attributes.position !== undefined ) {
  602. count = geometry.attributes.position.count;
  603. } else {
  604. console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' + i + '. The geometry must have either an index or a position attribute' );
  605. return null;
  606. }
  607. mergedGeometry.addGroup( offset, count, i );
  608. offset += count;
  609. }
  610. }
  611. // merge indices
  612. if ( isIndexed ) {
  613. var indexOffset = 0;
  614. var mergedIndex = [];
  615. for ( var i = 0; i < geometries.length; ++ i ) {
  616. var index = geometries[ i ].index;
  617. for ( var j = 0; j < index.count; ++ j ) {
  618. mergedIndex.push( index.getX( j ) + indexOffset );
  619. }
  620. indexOffset += geometries[ i ].attributes.position.count;
  621. }
  622. mergedGeometry.setIndex( mergedIndex );
  623. }
  624. // merge attributes
  625. for ( var name in attributes ) {
  626. var mergedAttribute = this.mergeBufferAttributes( attributes[ name ] );
  627. if ( ! mergedAttribute ) {
  628. console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the ' + name + ' attribute.' );
  629. return null;
  630. }
  631. mergedGeometry.setAttribute( name, mergedAttribute );
  632. }
  633. // merge morph attributes
  634. for ( var name in morphAttributes ) {
  635. var numMorphTargets = morphAttributes[ name ][ 0 ].length;
  636. if ( numMorphTargets === 0 ) break;
  637. mergedGeometry.morphAttributes = mergedGeometry.morphAttributes || {};
  638. mergedGeometry.morphAttributes[ name ] = [];
  639. for ( var i = 0; i < numMorphTargets; ++ i ) {
  640. var morphAttributesToMerge = [];
  641. for ( var j = 0; j < morphAttributes[ name ].length; ++ j ) {
  642. morphAttributesToMerge.push( morphAttributes[ name ][ j ][ i ] );
  643. }
  644. var mergedMorphAttribute = this.mergeBufferAttributes( morphAttributesToMerge );
  645. if ( ! mergedMorphAttribute ) {
  646. console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the ' + name + ' morphAttribute.' );
  647. return null;
  648. }
  649. mergedGeometry.morphAttributes[ name ].push( mergedMorphAttribute );
  650. }
  651. }
  652. return mergedGeometry;
  653. },
  654. /**
  655. * @param {Array<THREE.BufferAttribute>} attributes
  656. * @return {THREE.BufferAttribute}
  657. */
  658. mergeBufferAttributes: function ( attributes ) {
  659. var TypedArray;
  660. var itemSize;
  661. var normalized;
  662. var arrayLength = 0;
  663. for ( var i = 0; i < attributes.length; ++ i ) {
  664. var attribute = attributes[ i ];
  665. if ( attribute.isInterleavedBufferAttribute ) {
  666. console.error( 'THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported.' );
  667. return null;
  668. }
  669. if ( TypedArray === undefined ) TypedArray = attribute.array.constructor;
  670. if ( TypedArray !== attribute.array.constructor ) {
  671. console.error( 'THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes.' );
  672. return null;
  673. }
  674. if ( itemSize === undefined ) itemSize = attribute.itemSize;
  675. if ( itemSize !== attribute.itemSize ) {
  676. console.error( 'THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes.' );
  677. return null;
  678. }
  679. if ( normalized === undefined ) normalized = attribute.normalized;
  680. if ( normalized !== attribute.normalized ) {
  681. console.error( 'THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes.' );
  682. return null;
  683. }
  684. arrayLength += attribute.array.length;
  685. }
  686. var array = new TypedArray( arrayLength );
  687. var offset = 0;
  688. for ( var i = 0; i < attributes.length; ++ i ) {
  689. array.set( attributes[ i ].array, offset );
  690. offset += attributes[ i ].array.length;
  691. }
  692. return new THREE.BufferAttribute( array, itemSize, normalized );
  693. },
  694. /**
  695. * @param {Array<THREE.BufferAttribute>} attributes
  696. * @return {Array<THREE.InterleavedBufferAttribute>}
  697. */
  698. interleaveAttributes: function ( attributes ) {
  699. // Interleaves the provided attributes into an InterleavedBuffer and returns
  700. // a set of InterleavedBufferAttributes for each attribute
  701. var TypedArray;
  702. var arrayLength = 0;
  703. var stride = 0;
  704. // calculate the the length and type of the interleavedBuffer
  705. for ( var i = 0, l = attributes.length; i < l; ++ i ) {
  706. var attribute = attributes[ i ];
  707. if ( TypedArray === undefined ) TypedArray = attribute.array.constructor;
  708. if ( TypedArray !== attribute.array.constructor ) {
  709. console.error( 'AttributeBuffers of different types cannot be interleaved' );
  710. return null;
  711. }
  712. arrayLength += attribute.array.length;
  713. stride += attribute.itemSize;
  714. }
  715. // Create the set of buffer attributes
  716. var interleavedBuffer = new THREE.InterleavedBuffer( new TypedArray( arrayLength ), stride );
  717. var offset = 0;
  718. var res = [];
  719. var getters = [ 'getX', 'getY', 'getZ', 'getW' ];
  720. var setters = [ 'setX', 'setY', 'setZ', 'setW' ];
  721. for ( var j = 0, l = attributes.length; j < l; j ++ ) {
  722. var attribute = attributes[ j ];
  723. var itemSize = attribute.itemSize;
  724. var count = attribute.count;
  725. var iba = new THREE.InterleavedBufferAttribute( interleavedBuffer, itemSize, offset, attribute.normalized );
  726. res.push( iba );
  727. offset += itemSize;
  728. // Move the data for each attribute into the new interleavedBuffer
  729. // at the appropriate offset
  730. for ( var c = 0; c < count; c ++ ) {
  731. for ( var k = 0; k < itemSize; k ++ ) {
  732. iba[ setters[ k ] ]( c, attribute[ getters[ k ] ]( c ) );
  733. }
  734. }
  735. }
  736. return res;
  737. },
  738. /**
  739. * @param {Array<THREE.BufferGeometry>} geometry
  740. * @return {number}
  741. */
  742. estimateBytesUsed: function ( geometry ) {
  743. // Return the estimated memory used by this geometry in bytes
  744. // Calculate using itemSize, count, and BYTES_PER_ELEMENT to account
  745. // for InterleavedBufferAttributes.
  746. var mem = 0;
  747. for ( var name in geometry.attributes ) {
  748. var attr = geometry.getAttribute( name );
  749. mem += attr.count * attr.itemSize * attr.array.BYTES_PER_ELEMENT;
  750. }
  751. var indices = geometry.getIndex();
  752. mem += indices ? indices.count * indices.itemSize * indices.array.BYTES_PER_ELEMENT : 0;
  753. return mem;
  754. },
  755. /**
  756. * @param {THREE.BufferGeometry} geometry
  757. * @param {number} tolerance
  758. * @return {THREE.BufferGeometry>}
  759. */
  760. mergeVertices: function ( geometry, tolerance = 1e-4 ) {
  761. tolerance = Math.max( tolerance, Number.EPSILON );
  762. // Generate an index buffer if the geometry doesn't have one, or optimize it
  763. // if it's already available.
  764. var hashToIndex = {};
  765. var indices = geometry.getIndex();
  766. var positions = geometry.getAttribute( 'position' );
  767. var vertexCount = indices ? indices.count : positions.count;
  768. // next value for triangle indices
  769. var nextIndex = 0;
  770. // attributes and new attribute arrays
  771. var attributeNames = Object.keys( geometry.attributes );
  772. var attrArrays = {};
  773. var morphAttrsArrays = {};
  774. var newIndices = [];
  775. var getters = [ 'getX', 'getY', 'getZ', 'getW' ];
  776. // initialize the arrays
  777. for ( var i = 0, l = attributeNames.length; i < l; i ++ ) {
  778. var name = attributeNames[ i ];
  779. attrArrays[ name ] = [];
  780. var morphAttr = geometry.morphAttributes[ name ];
  781. if ( morphAttr ) {
  782. morphAttrsArrays[ name ] = new Array( morphAttr.length ).fill().map( () => [] );
  783. }
  784. }
  785. // convert the error tolerance to an amount of decimal places to truncate to
  786. var decimalShift = Math.log10( 1 / tolerance );
  787. var shiftMultiplier = Math.pow( 10, decimalShift );
  788. for ( var i = 0; i < vertexCount; i ++ ) {
  789. var index = indices ? indices.getX( i ) : i;
  790. // Generate a hash for the vertex attributes at the current index 'i'
  791. var hash = '';
  792. for ( var j = 0, l = attributeNames.length; j < l; j ++ ) {
  793. var name = attributeNames[ j ];
  794. var attribute = geometry.getAttribute( name );
  795. var itemSize = attribute.itemSize;
  796. for ( var k = 0; k < itemSize; k ++ ) {
  797. // double tilde truncates the decimal value
  798. hash += `${ ~ ~ ( attribute[ getters[ k ] ]( index ) * shiftMultiplier ) },`;
  799. }
  800. }
  801. // Add another reference to the vertex if it's already
  802. // used by another index
  803. if ( hash in hashToIndex ) {
  804. newIndices.push( hashToIndex[ hash ] );
  805. } else {
  806. // copy data to the new index in the attribute arrays
  807. for ( var j = 0, l = attributeNames.length; j < l; j ++ ) {
  808. var name = attributeNames[ j ];
  809. var attribute = geometry.getAttribute( name );
  810. var morphAttr = geometry.morphAttributes[ name ];
  811. var itemSize = attribute.itemSize;
  812. var newarray = attrArrays[ name ];
  813. var newMorphArrays = morphAttrsArrays[ name ];
  814. for ( var k = 0; k < itemSize; k ++ ) {
  815. var getterFunc = getters[ k ];
  816. newarray.push( attribute[ getterFunc ]( index ) );
  817. if ( morphAttr ) {
  818. for ( var m = 0, ml = morphAttr.length; m < ml; m ++ ) {
  819. newMorphArrays[ m ].push( morphAttr[ m ][ getterFunc ]( index ) );
  820. }
  821. }
  822. }
  823. }
  824. hashToIndex[ hash ] = nextIndex;
  825. newIndices.push( nextIndex );
  826. nextIndex ++;
  827. }
  828. }
  829. // Generate typed arrays from new attribute arrays and update
  830. // the attributeBuffers
  831. const result = geometry.clone();
  832. for ( var i = 0, l = attributeNames.length; i < l; i ++ ) {
  833. var name = attributeNames[ i ];
  834. var oldAttribute = geometry.getAttribute( name );
  835. var buffer = new oldAttribute.array.constructor( attrArrays[ name ] );
  836. var attribute = new THREE.BufferAttribute( buffer, oldAttribute.itemSize, oldAttribute.normalized );
  837. result.setAttribute( name, attribute );
  838. // Update the attribute arrays
  839. if ( name in morphAttrsArrays ) {
  840. for ( var j = 0; j < morphAttrsArrays[ name ].length; j ++ ) {
  841. var oldMorphAttribute = geometry.morphAttributes[ name ][ j ];
  842. var buffer = new oldMorphAttribute.array.constructor( morphAttrsArrays[ name ][ j ] );
  843. var morphAttribute = new THREE.BufferAttribute( buffer, oldMorphAttribute.itemSize, oldMorphAttribute.normalized );
  844. result.morphAttributes[ name ][ j ] = morphAttribute;
  845. }
  846. }
  847. }
  848. // indices
  849. result.setIndex( newIndices );
  850. return result;
  851. },
  852. /**
  853. * @param {THREE.BufferGeometry} geometry
  854. * @param {number} drawMode
  855. * @return {THREE.BufferGeometry>}
  856. */
  857. toTrianglesDrawMode: function ( geometry, drawMode ) {
  858. if ( drawMode === THREE.TrianglesDrawMode ) {
  859. console.warn( 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles.' );
  860. return geometry;
  861. }
  862. if ( drawMode === THREE.TriangleFanDrawMode || drawMode === THREE.TriangleStripDrawMode ) {
  863. var index = geometry.getIndex();
  864. // generate index if not present
  865. if ( index === null ) {
  866. var indices = [];
  867. var position = geometry.getAttribute( 'position' );
  868. if ( position !== undefined ) {
  869. for ( var i = 0; i < position.count; i ++ ) {
  870. indices.push( i );
  871. }
  872. geometry.setIndex( indices );
  873. index = geometry.getIndex();
  874. } else {
  875. console.error( 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible.' );
  876. return geometry;
  877. }
  878. }
  879. //
  880. var numberOfTriangles = index.count - 2;
  881. var newIndices = [];
  882. if ( drawMode === THREE.TriangleFanDrawMode ) {
  883. // gl.TRIANGLE_FAN
  884. for ( var i = 1; i <= numberOfTriangles; i ++ ) {
  885. newIndices.push( index.getX( 0 ) );
  886. newIndices.push( index.getX( i ) );
  887. newIndices.push( index.getX( i + 1 ) );
  888. }
  889. } else {
  890. // gl.TRIANGLE_STRIP
  891. for ( var i = 0; i < numberOfTriangles; i ++ ) {
  892. if ( i % 2 === 0 ) {
  893. newIndices.push( index.getX( i ) );
  894. newIndices.push( index.getX( i + 1 ) );
  895. newIndices.push( index.getX( i + 2 ) );
  896. } else {
  897. newIndices.push( index.getX( i + 2 ) );
  898. newIndices.push( index.getX( i + 1 ) );
  899. newIndices.push( index.getX( i ) );
  900. }
  901. }
  902. }
  903. if ( ( newIndices.length / 3 ) !== numberOfTriangles ) {
  904. console.error( 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.' );
  905. }
  906. // build final geometry
  907. var newGeometry = geometry.clone();
  908. newGeometry.setIndex( newIndices );
  909. newGeometry.clearGroups();
  910. return newGeometry;
  911. } else {
  912. console.error( 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:', drawMode );
  913. return geometry;
  914. }
  915. },
  916. /**
  917. * Calculates the morphed attributes of a morphed/skinned BufferGeometry.
  918. * Helpful for Raytracing or Decals.
  919. * @param {Mesh | Line | Points} object An instance of Mesh, Line or Points.
  920. * @return {Object} An Object with original position/normal attributes and morphed ones.
  921. */
  922. computeMorphedAttributes: function ( object ) {
  923. if ( object.geometry.isBufferGeometry !== true ) {
  924. console.error( 'THREE.BufferGeometryUtils: Geometry is not of type THREE.BufferGeometry.' );
  925. return null;
  926. }
  927. var _vA = new THREE.Vector3();
  928. var _vB = new THREE.Vector3();
  929. var _vC = new THREE.Vector3();
  930. var _tempA = new THREE.Vector3();
  931. var _tempB = new THREE.Vector3();
  932. var _tempC = new THREE.Vector3();
  933. var _morphA = new THREE.Vector3();
  934. var _morphB = new THREE.Vector3();
  935. var _morphC = new THREE.Vector3();
  936. function _calculateMorphedAttributeData(
  937. object,
  938. material,
  939. attribute,
  940. morphAttribute,
  941. morphTargetsRelative,
  942. a,
  943. b,
  944. c,
  945. modifiedAttributeArray
  946. ) {
  947. _vA.fromBufferAttribute( attribute, a );
  948. _vB.fromBufferAttribute( attribute, b );
  949. _vC.fromBufferAttribute( attribute, c );
  950. var morphInfluences = object.morphTargetInfluences;
  951. if ( material.morphTargets && morphAttribute && morphInfluences ) {
  952. _morphA.set( 0, 0, 0 );
  953. _morphB.set( 0, 0, 0 );
  954. _morphC.set( 0, 0, 0 );
  955. for ( var i = 0, il = morphAttribute.length; i < il; i ++ ) {
  956. var influence = morphInfluences[ i ];
  957. var morphAttribute = morphAttribute[ i ];
  958. if ( influence === 0 ) continue;
  959. _tempA.fromBufferAttribute( morphAttribute, a );
  960. _tempB.fromBufferAttribute( morphAttribute, b );
  961. _tempC.fromBufferAttribute( morphAttribute, c );
  962. if ( morphTargetsRelative ) {
  963. _morphA.addScaledVector( _tempA, influence );
  964. _morphB.addScaledVector( _tempB, influence );
  965. _morphC.addScaledVector( _tempC, influence );
  966. } else {
  967. _morphA.addScaledVector( _tempA.sub( _vA ), influence );
  968. _morphB.addScaledVector( _tempB.sub( _vB ), influence );
  969. _morphC.addScaledVector( _tempC.sub( _vC ), influence );
  970. }
  971. }
  972. _vA.add( _morphA );
  973. _vB.add( _morphB );
  974. _vC.add( _morphC );
  975. }
  976. if ( object.isSkinnedMesh ) {
  977. object.boneTransform( a, _vA );
  978. object.boneTransform( b, _vB );
  979. object.boneTransform( c, _vC );
  980. }
  981. modifiedAttributeArray[ a * 3 + 0 ] = _vA.x;
  982. modifiedAttributeArray[ a * 3 + 1 ] = _vA.y;
  983. modifiedAttributeArray[ a * 3 + 2 ] = _vA.z;
  984. modifiedAttributeArray[ b * 3 + 0 ] = _vB.x;
  985. modifiedAttributeArray[ b * 3 + 1 ] = _vB.y;
  986. modifiedAttributeArray[ b * 3 + 2 ] = _vB.z;
  987. modifiedAttributeArray[ c * 3 + 0 ] = _vC.x;
  988. modifiedAttributeArray[ c * 3 + 1 ] = _vC.y;
  989. modifiedAttributeArray[ c * 3 + 2 ] = _vC.z;
  990. }
  991. var geometry = object.geometry;
  992. var material = object.material;
  993. var a, b, c;
  994. var index = geometry.index;
  995. var positionAttribute = geometry.attributes.position;
  996. var morphPosition = geometry.morphAttributes.position;
  997. var morphTargetsRelative = geometry.morphTargetsRelative;
  998. var normalAttribute = geometry.attributes.normal;
  999. var morphNormal = geometry.morphAttributes.position;
  1000. var groups = geometry.groups;
  1001. var drawRange = geometry.drawRange;
  1002. var i, j, il, jl;
  1003. var group, groupMaterial;
  1004. var start, end;
  1005. var modifiedPosition = new Float32Array( positionAttribute.count * positionAttribute.itemSize );
  1006. var modifiedNormal = new Float32Array( normalAttribute.count * normalAttribute.itemSize );
  1007. if ( index !== null ) {
  1008. // indexed buffer geometry
  1009. if ( Array.isArray( material ) ) {
  1010. for ( i = 0, il = groups.length; i < il; i ++ ) {
  1011. group = groups[ i ];
  1012. groupMaterial = material[ group.materialIndex ];
  1013. start = Math.max( group.start, drawRange.start );
  1014. end = Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) );
  1015. for ( j = start, jl = end; j < jl; j += 3 ) {
  1016. a = index.getX( j );
  1017. b = index.getX( j + 1 );
  1018. c = index.getX( j + 2 );
  1019. _calculateMorphedAttributeData(
  1020. object,
  1021. groupMaterial,
  1022. positionAttribute,
  1023. morphPosition,
  1024. morphTargetsRelative,
  1025. a, b, c,
  1026. modifiedPosition
  1027. );
  1028. _calculateMorphedAttributeData(
  1029. object,
  1030. groupMaterial,
  1031. normalAttribute,
  1032. morphNormal,
  1033. morphTargetsRelative,
  1034. a, b, c,
  1035. modifiedNormal
  1036. );
  1037. }
  1038. }
  1039. } else {
  1040. start = Math.max( 0, drawRange.start );
  1041. end = Math.min( index.count, ( drawRange.start + drawRange.count ) );
  1042. for ( i = start, il = end; i < il; i += 3 ) {
  1043. a = index.getX( i );
  1044. b = index.getX( i + 1 );
  1045. c = index.getX( i + 2 );
  1046. _calculateMorphedAttributeData(
  1047. object,
  1048. material,
  1049. positionAttribute,
  1050. morphPosition,
  1051. morphTargetsRelative,
  1052. a, b, c,
  1053. modifiedPosition
  1054. );
  1055. _calculateMorphedAttributeData(
  1056. object,
  1057. material,
  1058. normalAttribute,
  1059. morphNormal,
  1060. morphTargetsRelative,
  1061. a, b, c,
  1062. modifiedNormal
  1063. );
  1064. }
  1065. }
  1066. } else if ( positionAttribute !== undefined ) {
  1067. // non-indexed buffer geometry
  1068. if ( Array.isArray( material ) ) {
  1069. for ( i = 0, il = groups.length; i < il; i ++ ) {
  1070. group = groups[ i ];
  1071. groupMaterial = material[ group.materialIndex ];
  1072. start = Math.max( group.start, drawRange.start );
  1073. end = Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) );
  1074. for ( j = start, jl = end; j < jl; j += 3 ) {
  1075. a = j;
  1076. b = j + 1;
  1077. c = j + 2;
  1078. _calculateMorphedAttributeData(
  1079. object,
  1080. groupMaterial,
  1081. positionAttribute,
  1082. morphPosition,
  1083. morphTargetsRelative,
  1084. a, b, c,
  1085. modifiedPosition
  1086. );
  1087. _calculateMorphedAttributeData(
  1088. object,
  1089. groupMaterial,
  1090. normalAttribute,
  1091. morphNormal,
  1092. morphTargetsRelative,
  1093. a, b, c,
  1094. modifiedNormal
  1095. );
  1096. }
  1097. }
  1098. } else {
  1099. start = Math.max( 0, drawRange.start );
  1100. end = Math.min( positionAttribute.count, ( drawRange.start + drawRange.count ) );
  1101. for ( i = start, il = end; i < il; i += 3 ) {
  1102. a = i;
  1103. b = i + 1;
  1104. c = i + 2;
  1105. _calculateMorphedAttributeData(
  1106. object,
  1107. material,
  1108. positionAttribute,
  1109. morphPosition,
  1110. morphTargetsRelative,
  1111. a, b, c,
  1112. modifiedPosition
  1113. );
  1114. _calculateMorphedAttributeData(
  1115. object,
  1116. material,
  1117. normalAttribute,
  1118. morphNormal,
  1119. morphTargetsRelative,
  1120. a, b, c,
  1121. modifiedNormal
  1122. );
  1123. }
  1124. }
  1125. }
  1126. var morphedPositionAttribute = new THREE.Float32BufferAttribute( modifiedPosition, 3 );
  1127. var morphedNormalAttribute = new THREE.Float32BufferAttribute( modifiedNormal, 3 );
  1128. return {
  1129. positionAttribute: positionAttribute,
  1130. normalAttribute: normalAttribute,
  1131. morphedPositionAttribute: morphedPositionAttribute,
  1132. morphedNormalAttribute: morphedNormalAttribute
  1133. };
  1134. }
  1135. };
  1136. },{}],63:[function(_dereq_,module,exports){
  1137. function TextGeometry(e){Base.call(this),"string"==typeof e&&(e={text:e}),this._opt=assign({},e),e&&this.update(e)}var createLayout=_dereq_("layout-bmfont-text"),inherits=_dereq_("inherits"),createIndices=_dereq_("quad-indices"),buffer=_dereq_("three-buffer-vertex-data"),assign=_dereq_("object-assign"),vertices=_dereq_("./lib/vertices"),utils=_dereq_("./lib/utils"),Base=THREE.BufferGeometry;module.exports=function(e){return new TextGeometry(e)},inherits(TextGeometry,Base),TextGeometry.prototype.update=function(e){if("string"==typeof e&&(e={text:e}),e=assign({},this._opt,e),!e.font)throw new TypeError("must specify a { font } in options");this.layout=createLayout(e);var t=!1!==e.flipY,i=e.font,r=i.common.scaleW,o=i.common.scaleH,s=this.layout.glyphs.filter(function(e){var t=e.data;return t.width*t.height>0});this.visibleGlyphs=s;var n=vertices.positions(s),u=vertices.uvs(s,r,o,t),a=createIndices({clockwise:!0,type:"uint16",count:s.length});if(buffer.index(this,a,1,"uint16"),buffer.attr(this,"position",n,2),buffer.attr(this,"uv",u,2),!e.multipage&&"page"in this.attributes)this.removeAttribute("page");else if(e.multipage){var h=vertices.pages(s);buffer.attr(this,"page",h,1)}},TextGeometry.prototype.computeBoundingSphere=function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var e=this.attributes.position.array,t=this.attributes.position.itemSize;if(!e||!t||e.length<2)return this.boundingSphere.radius=0,void this.boundingSphere.center.set(0,0,0);utils.computeSphere(e,this.boundingSphere),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.')},TextGeometry.prototype.computeBoundingBox=function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);var e=this.boundingBox,t=this.attributes.position.array,i=this.attributes.position.itemSize;if(!t||!i||t.length<2)return void e.makeEmpty();utils.computeBox(t,e)};
  1138. },{"./lib/utils":64,"./lib/vertices":65,"inherits":30,"layout-bmfont-text":36,"object-assign":39,"quad-indices":51,"three-buffer-vertex-data":66}],64:[function(_dereq_,module,exports){
  1139. function bounds(x){var m=x.length/itemSize;box.min[0]=x[0],box.min[1]=x[1],box.max[0]=x[0],box.max[1]=x[1];for(var o=0;o<m;o++){var i=x[o*itemSize+0],a=x[o*itemSize+1];box.min[0]=Math.min(i,box.min[0]),box.min[1]=Math.min(a,box.min[1]),box.max[0]=Math.max(i,box.max[0]),box.max[1]=Math.max(a,box.max[1])}}var itemSize=2,box={min:[0,0],max:[0,0]};module.exports.computeBox=function(x,m){bounds(x),m.min.set(box.min[0],box.min[1],0),m.max.set(box.max[0],box.max[1],0)},module.exports.computeSphere=function(x,m){bounds(x);var o=box.min[0],i=box.min[1],a=box.max[0],n=box.max[1],b=a-o,e=n-i,t=Math.sqrt(b*b+e*e);m.center.set(o+b/2,i+e/2,0),m.radius=t/2};
  1140. },{}],65:[function(_dereq_,module,exports){
  1141. module.exports.pages=function(t){var o=new Float32Array(4*t.length*1),n=0;return t.forEach(function(t){var r=t.data.page||0;o[n++]=r,o[n++]=r,o[n++]=r,o[n++]=r}),o},module.exports.uvs=function(t,o,n,r){var a=new Float32Array(4*t.length*2),e=0;return t.forEach(function(t){var i=t.data,f=i.x+i.width,u=i.y+i.height,h=i.x/o,s=i.y/n,c=f/o,l=u/n;r&&(s=(n-i.y)/n,l=(n-u)/n),a[e++]=h,a[e++]=s,a[e++]=h,a[e++]=l,a[e++]=c,a[e++]=l,a[e++]=c,a[e++]=s}),a},module.exports.positions=function(t){var o=new Float32Array(4*t.length*2),n=0;return t.forEach(function(t){var r=t.data,a=t.position[0]+r.xoffset,e=t.position[1]+r.yoffset,i=r.width,f=r.height;o[n++]=a,o[n++]=e,o[n++]=a,o[n++]=e+f,o[n++]=a+i,o[n++]=e+f,o[n++]=a+i,o[n++]=e}),o};
  1142. },{}],66:[function(_dereq_,module,exports){
  1143. function setIndex(t,e,r,n){"number"!=typeof r&&(r=1),"string"!=typeof n&&(n="uint16");var i=!t.index&&"function"!=typeof t.setIndex,u=i?t.getAttribute("index"):t.index,a=updateAttribute(u,e,r,n);a&&(i?t.addAttribute("index",a):t.index=a)}function setAttribute(t,e,r,n,i){if("number"!=typeof n&&(n=3),"string"!=typeof i&&(i="float32"),Array.isArray(r)&&Array.isArray(r[0])&&r[0].length!==n)throw new Error("Nested vertex array has unexpected size; expected "+n+" but found "+r[0].length);var u=t.getAttribute(e),a=updateAttribute(u,r,n,i);t.setAttribute(e,a)}function updateAttribute(t,e,r,n){return e=e||[],e=flatten(e,n),t=new THREE.BufferAttribute(e,r),t.itemSize=r,t.needsUpdate=!0,t}function rebuildAttribute(t,e,r){if(t.itemSize!==r)return!0;if(!t.array)return!0;var n=t.array.length;return Array.isArray(e)&&Array.isArray(e[0])?n!==e.length*r:n!==e.length}var flatten=_dereq_("flatten-vertex-data"),warned=!1;module.exports.attr=setAttribute,module.exports.index=setIndex;
  1144. },{"flatten-vertex-data":23}],67:[function(_dereq_,module,exports){
  1145. (function (setImmediate,clearImmediate){
  1146. function Timeout(e,t){this._id=e,this._clearFn=t}var nextTick=_dereq_("process/browser.js").nextTick,apply=Function.prototype.apply,slice=Array.prototype.slice,immediateIds={},nextImmediateId=0;exports.setTimeout=function(){return new Timeout(apply.call(setTimeout,window,arguments),clearTimeout)},exports.setInterval=function(){return new Timeout(apply.call(setInterval,window,arguments),clearInterval)},exports.clearTimeout=exports.clearInterval=function(e){e.close()},Timeout.prototype.unref=Timeout.prototype.ref=function(){},Timeout.prototype.close=function(){this._clearFn.call(window,this._id)},exports.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},exports.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},exports._unrefActive=exports.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},exports.setImmediate="function"==typeof setImmediate?setImmediate:function(e){var t=nextImmediateId++,i=!(arguments.length<2)&&slice.call(arguments,1);return immediateIds[t]=!0,nextTick(function(){immediateIds[t]&&(i?e.apply(null,i):e.call(null),exports.clearImmediate(t))}),t},exports.clearImmediate="function"==typeof clearImmediate?clearImmediate:function(e){delete immediateIds[e]};
  1147. }).call(this,_dereq_("timers").setImmediate,_dereq_("timers").clearImmediate)
  1148. },{"process/browser.js":49,"timers":67}],68:[function(_dereq_,module,exports){
  1149. (function (global){
  1150. !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.WebVRPolyfill=t()}(this,function(){"use strict";function e(e){this.config=n(n({},A),e),this.polyfillDisplays=[],this.enabled=!1,this.hasNative="getVRDisplays"in navigator,this.native={},this.native.getVRDisplays=navigator.getVRDisplays,this.native.VRFrameData=window.VRFrameData,this.native.VRDisplay=window.VRDisplay,(!this.hasNative||this.config.PROVIDE_MOBILE_VRDISPLAY&&i())&&(this.enable(),this.getVRDisplays().then(function(e){e&&e[0]&&e[0].fireVRDisplayConnect_&&e[0].fireVRDisplayConnect_()}))}var t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},i=function(){return/Android/i.test(navigator.userAgent)||/iPhone|iPad|iPod/i.test(navigator.userAgent)},r=function(e,t){for(var i=0,r=e.length;i<r;i++)t[i]=e[i]},n=function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e},a=function(e,t){return t={exports:{}},e(t,t.exports),t.exports}(function(e,i){!function(i,r){e.exports=function(){function e(e,t,i){if(!t)return void i(e);for(var r=[],n=null,a=0;a<t.length;++a){var s=t[a];switch(s){case e.TEXTURE_BINDING_2D:case e.TEXTURE_BINDING_CUBE_MAP:var A=t[++a];if(A<e.TEXTURE0||A>e.TEXTURE31){console.error("TEXTURE_BINDING_2D or TEXTURE_BINDING_CUBE_MAP must be followed by a valid texture unit"),r.push(null,null);break}n||(n=e.getParameter(e.ACTIVE_TEXTURE)),e.activeTexture(A),r.push(e.getParameter(s),null);break;case e.ACTIVE_TEXTURE:n=e.getParameter(e.ACTIVE_TEXTURE),r.push(null);break;default:r.push(e.getParameter(s))}}i(e);for(var a=0;a<t.length;++a){var s=t[a],o=r[a];switch(s){case e.ACTIVE_TEXTURE:break;case e.ARRAY_BUFFER_BINDING:e.bindBuffer(e.ARRAY_BUFFER,o);break;case e.COLOR_CLEAR_VALUE:e.clearColor(o[0],o[1],o[2],o[3]);break;case e.COLOR_WRITEMASK:e.colorMask(o[0],o[1],o[2],o[3]);break;case e.CURRENT_PROGRAM:e.useProgram(o);break;case e.ELEMENT_ARRAY_BUFFER_BINDING:e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,o);break;case e.FRAMEBUFFER_BINDING:e.bindFramebuffer(e.FRAMEBUFFER,o);break;case e.RENDERBUFFER_BINDING:e.bindRenderbuffer(e.RENDERBUFFER,o);break;case e.TEXTURE_BINDING_2D:var A=t[++a];if(A<e.TEXTURE0||A>e.TEXTURE31)break;e.activeTexture(A),e.bindTexture(e.TEXTURE_2D,o);break;case e.TEXTURE_BINDING_CUBE_MAP:var A=t[++a];if(A<e.TEXTURE0||A>e.TEXTURE31)break;e.activeTexture(A),e.bindTexture(e.TEXTURE_CUBE_MAP,o);break;case e.VIEWPORT:e.viewport(o[0],o[1],o[2],o[3]);break;case e.BLEND:case e.CULL_FACE:case e.DEPTH_TEST:case e.SCISSOR_TEST:case e.STENCIL_TEST:o?e.enable(s):e.disable(s);break;default:console.log("No GL restore behavior for 0x"+s.toString(16))}n&&e.activeTexture(n)}}function i(e,t,i,r){this.gl=e,this.cardboardUI=t,this.bufferScale=i,this.dirtySubmitFrameBindings=r,this.ctxAttribs=e.getContextAttributes(),this.instanceExt=e.getExtension("ANGLE_instanced_arrays"),this.meshWidth=20,this.meshHeight=20,this.bufferWidth=e.drawingBufferWidth,this.bufferHeight=e.drawingBufferHeight,this.realBindFramebuffer=e.bindFramebuffer,this.realEnable=e.enable,this.realDisable=e.disable,this.realColorMask=e.colorMask,this.realClearColor=e.clearColor,this.realViewport=e.viewport,M()||(this.realCanvasWidth=Object.getOwnPropertyDescriptor(e.canvas.__proto__,"width"),this.realCanvasHeight=Object.getOwnPropertyDescriptor(e.canvas.__proto__,"height")),this.isPatched=!1,this.lastBoundFramebuffer=null,this.cullFace=!1,this.depthTest=!1,this.blend=!1,this.scissorTest=!1,this.stencilTest=!1,this.viewport=[0,0,0,0],this.colorMask=[!0,!0,!0,!0],this.clearColor=[0,0,0,0],this.attribs={position:0,texCoord:1},this.program=U(e,$,ee,this.attribs),this.uniforms=k(e,this.program),this.viewportOffsetScale=new Float32Array(8),this.setTextureBounds(),this.vertexBuffer=e.createBuffer(),this.indexBuffer=e.createBuffer(),this.indexCount=0,this.renderTarget=e.createTexture(),this.framebuffer=e.createFramebuffer(),this.depthStencilBuffer=null,this.depthBuffer=null,this.stencilBuffer=null,this.ctxAttribs.depth&&this.ctxAttribs.stencil?this.depthStencilBuffer=e.createRenderbuffer():this.ctxAttribs.depth?this.depthBuffer=e.createRenderbuffer():this.ctxAttribs.stencil&&(this.stencilBuffer=e.createRenderbuffer()),this.patch(),this.onResize()}function r(e){this.gl=e,this.attribs={position:0},this.program=U(e,te,ie,this.attribs),this.uniforms=k(e,this.program),this.vertexBuffer=e.createBuffer(),this.gearOffset=0,this.gearVertexCount=0,this.arrowOffset=0,this.arrowVertexCount=0,this.projMat=new Float32Array(16),this.listener=null,this.onResize()}function n(e){this.coefficients=e}function a(e){this.width=e.width||P(),this.height=e.height||N(),this.widthMeters=e.widthMeters,this.heightMeters=e.heightMeters,this.bevelMeters=e.bevelMeters}function s(e,t){this.viewer=he.CardboardV2,this.updateDeviceParams(e),this.distortion=new n(this.viewer.distortionCoefficients);for(var i=0;i<t.length;i++){var r=t[i];he[r.id]=new A(r)}}function A(e){this.id=e.id,this.label=e.label,this.fov=e.fov,this.interLensDistance=e.interLensDistance,this.baselineLensDistance=e.baselineLensDistance,this.screenLensDistance=e.screenLensDistance,this.distortionCoefficients=e.distortionCoefficients,this.inverseCoefficients=e.inverseCoefficients}function o(e,t){if(this.dpdb=ue,this.recalculateDeviceParams_(),e){this.onDeviceParamsUpdated=t;var i=new XMLHttpRequest,r=this;i.open("GET",e,!0),i.addEventListener("load",function(){r.loading=!1,i.status>=200&&i.status<=299?(r.dpdb=JSON.parse(i.response),r.recalculateDeviceParams_()):console.error("Error loading online DPDB!")}),i.send()}}function l(e){this.xdpi=e.xdpi,this.ydpi=e.ydpi,this.bevelMm=e.bevelMm}function c(e,t){this.set(e,t)}function h(e,t){this.kFilter=e,this.isDebug=t,this.currentAccelMeasurement=new c,this.currentGyroMeasurement=new c,this.previousGyroMeasurement=new c,M()?this.filterQ=new oe(-1,0,0,1):this.filterQ=new oe(1,0,0,1),this.previousFilterQ=new oe,this.previousFilterQ.copy(this.filterQ),this.accelQ=new oe,this.isOrientationInitialized=!1,this.estimatedGravity=new Ae,this.measuredGravity=new Ae,this.gyroIntegralQ=new oe}function d(e,t){this.predictionTimeS=e,this.isDebug=t,this.previousQ=new oe,this.previousTimestampS=null,this.deltaQ=new oe,this.outQ=new oe}function u(e,t,i,r){this.yawOnly=i,this.accelerometer=new Ae,this.gyroscope=new Ae,this.filter=new h(e,r),this.posePredictor=new d(t,r),this.isFirefoxAndroid=B(),this.isIOS=M();var n=R();this.isDeviceMotionInRadians=!this.isIOS&&n&&n<66,this.isWithoutDeviceMotion=C()||S(),this.filterToWorldQ=new oe,M()?this.filterToWorldQ.setFromAxisAngle(new Ae(1,0,0),Math.PI/2):this.filterToWorldQ.setFromAxisAngle(new Ae(1,0,0),-Math.PI/2),this.inverseWorldToScreenQ=new oe,this.worldToScreenQ=new oe,this.originalPoseAdjustQ=new oe,this.originalPoseAdjustQ.setFromAxisAngle(new Ae(0,0,1),-window.orientation*Math.PI/180),this.setScreenTransform_(),x()&&this.filterToWorldQ.multiply(this.inverseWorldToScreenQ),this.resetQ=new oe,this.orientationOut_=new Float32Array(4),this.start()}function p(){this.loadIcon_();var e=document.createElement("div"),t=e.style;t.position="fixed",t.top=0,t.right=0,t.bottom=0,t.left=0,t.backgroundColor="gray",t.fontFamily="sans-serif",t.zIndex=1e6;var i=document.createElement("img");i.src=this.icon;var t=i.style;t.marginLeft="25%",t.marginTop="25%",t.width="50%",e.appendChild(i);var r=document.createElement("div"),t=r.style;t.textAlign="center",t.fontSize="16px",t.lineHeight="24px",t.margin="24px 25%",t.width="50%",r.innerHTML="Place your phone into your Cardboard viewer.",e.appendChild(r);var n=document.createElement("div"),t=n.style;t.backgroundColor="#CFD8DC",t.position="fixed",t.bottom=0,t.width="100%",t.height="48px",t.padding="14px 24px",t.boxSizing="border-box",t.color="#656A6B",e.appendChild(n);var a=document.createElement("div");a.style.float="left",a.innerHTML="No Cardboard viewer?";var s=document.createElement("a");s.href="https://www.google.com/get/cardboard/get-cardboard/",s.innerHTML="get one",s.target="_blank";var t=s.style;t.float="right",t.fontWeight=600,t.textTransform="uppercase",t.borderLeft="1px solid gray",t.paddingLeft="24px",t.textDecoration="none",t.color="#656A6B",n.appendChild(a),n.appendChild(s),this.overlay=e,this.text=r,this.hide()}function f(e){try{this.selectedKey=localStorage.getItem(we)}catch(e){console.error("Failed to load viewer profile: %s",e)}this.selectedKey||(this.selectedKey=e||ve),this.dialog=this.createDialog_(s.Viewers),this.root=null,this.onChangeCallbacks_=[]}function m(){this.leftProjectionMatrix=new Float32Array(16),this.leftViewMatrix=new Float32Array(16),this.rightProjectionMatrix=new Float32Array(16),this.rightViewMatrix=new Float32Array(16),this.pose=null}function g(e){Object.defineProperties(this,{hasPosition:{writable:!1,enumerable:!0,value:e.hasPosition},hasExternalDisplay:{writable:!1,enumerable:!0,value:e.hasExternalDisplay},canPresent:{writable:!1,enumerable:!0,value:e.canPresent},maxLayers:{writable:!1,enumerable:!0,value:e.maxLayers},hasOrientation:{enumerable:!0,get:function(){return J("VRDisplayCapabilities.prototype.hasOrientation","VRDisplay.prototype.getFrameData"),e.hasOrientation}}})}function v(e){e=e||{};var t=!("wakelock"in e)||e.wakelock;this.isPolyfilled=!0,this.displayId=be++,this.displayName="",this.depthNear=.01,this.depthFar=1e4,this.isPresenting=!1,Object.defineProperty(this,"isConnected",{get:function(){return J("VRDisplay.prototype.isConnected","VRDisplayCapabilities.prototype.hasExternalDisplay"),!1}}),this.capabilities=new g({hasPosition:!1,hasOrientation:!1,hasExternalDisplay:!1,canPresent:!1,maxLayers:1}),this.stageParameters=null,this.waitingForPresent_=!1,this.layer_=null,this.originalParent_=null,this.fullscreenElement_=null,this.fullscreenWrapper_=null,this.fullscreenElementCachedStyle_=null,this.fullscreenEventTarget_=null,this.fullscreenChangeHandler_=null,this.fullscreenErrorHandler_=null,t&&z()&&(this.wakelock_=new Ee)}function w(e){var t=H({},Te);e=H(t,e||{}),v.call(this,{wakelock:e.MOBILE_WAKE_LOCK}),this.config=e,this.displayName="Cardboard VRDisplay",this.capabilities=new g({hasPosition:!1,hasOrientation:!0,hasExternalDisplay:!1,canPresent:!0,maxLayers:1}),this.stageParameters=null,this.bufferScale_=this.config.BUFFER_SCALE,this.poseSensor_=new ge(this.config),this.distorter_=null,this.cardboardUI_=null,this.dpdb_=new o(this.config.DPDB_URL,this.onDeviceParamsUpdated_.bind(this)),this.deviceInfo_=new s(this.dpdb_.getDeviceParams(),e.ADDITIONAL_VIEWERS),this.viewerSelector_=new f(e.DEFAULT_VIEWER),this.viewerSelector_.onChange(this.onViewerChanged_.bind(this)),this.deviceInfo_.setViewer(this.viewerSelector_.getCurrentViewer()),this.config.ROTATE_INSTRUCTIONS_DISABLED||(this.rotateInstructions_=new p),M()&&window.addEventListener("resize",this.onResize_.bind(this))}var y=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},E=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),b=function(){function e(e,t){var i=[],r=!0,n=!1,a=void 0;try{for(var s,A=e[Symbol.iterator]();!(r=(s=A.next()).done)&&(i.push(s.value),!t||i.length!==t);r=!0);}catch(e){n=!0,a=e}finally{try{!r&&A.return&&A.return()}finally{if(n)throw a}}return i}return function(t,i){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),_=function(e,t){return"data:"+e+","+encodeURIComponent(t)},D=function(e,t,i){return e+(t-e)*i},M=function(){var e=/iPad|iPhone|iPod/.test(navigator.platform);return function(){return e}}(),F=function(){var e=-1!==navigator.userAgent.indexOf("Version")&&-1!==navigator.userAgent.indexOf("Android")&&-1!==navigator.userAgent.indexOf("Chrome");return function(){return e}}(),T=function(){var e=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);return function(){return e}}(),B=function(){var e=-1!==navigator.userAgent.indexOf("Firefox")&&-1!==navigator.userAgent.indexOf("Android");return function(){return e}}(),R=function(){var e=navigator.userAgent.match(/.*Chrome\/([0-9]+)/),t=e?parseInt(e[1],10):null;return function(){return t}}(),S=function(){var e=!1;return e=M()&&T()&&-1!==navigator.userAgent.indexOf("13_4"),function(){return e}}(),C=function(){var e=!1;if(65===R()){var t=navigator.userAgent.match(/.*Chrome\/([0-9\.]*)/);if(t){var i=t[1].split("."),r=b(i,4),n=(r[0],r[1],r[2]),a=r[3];e=3325===parseInt(n,10)&&parseInt(a,10)<148}}return function(){return e}}(),I=function(){var e=-1!==navigator.userAgent.indexOf("R7 Build");return function(){return e}}(),x=function(){var e=90==window.orientation||-90==window.orientation;return I()?!e:e},L=function(e){return!isNaN(e)&&(!(e<=.001)&&!(e>1))},P=function(){return Math.max(window.screen.width,window.screen.height)*window.devicePixelRatio},N=function(){return Math.min(window.screen.width,window.screen.height)*window.devicePixelRatio},G=function(e){if(F())return!1;if(e.requestFullscreen)e.requestFullscreen();else if(e.webkitRequestFullscreen)e.webkitRequestFullscreen();else if(e.mozRequestFullScreen)e.mozRequestFullScreen();else{if(!e.msRequestFullscreen)return!1;e.msRequestFullscreen()}return!0},O=function(){if(document.exitFullscreen)document.exitFullscreen();else if(document.webkitExitFullscreen)document.webkitExitFullscreen();else if(document.mozCancelFullScreen)document.mozCancelFullScreen();else{if(!document.msExitFullscreen)return!1;document.msExitFullscreen()}return!0},Q=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement},U=function(e,t,i,r){var n=e.createShader(e.VERTEX_SHADER);e.shaderSource(n,t),e.compileShader(n);var a=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(a,i),e.compileShader(a);var s=e.createProgram();e.attachShader(s,n),e.attachShader(s,a);for(var A in r)e.bindAttribLocation(s,r[A],A);return e.linkProgram(s),e.deleteShader(n),e.deleteShader(a),s},k=function(e,t){for(var i={},r=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),n="",a=0;a<r;a++){n=e.getActiveUniform(t,a).name.replace("[0]",""),i[n]=e.getUniformLocation(t,n)}return i},V=function(e,t,i,r,n,a,s){var A=1/(t-i),o=1/(r-n),l=1/(a-s);return e[0]=-2*A,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+i)*A,e[13]=(n+r)*o,e[14]=(s+a)*l,e[15]=1,e},z=function(){var e=!1;return function(t){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))&&(e=!0)}(navigator.userAgent||navigator.vendor||window.opera),e},H=function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e},W=function(e){if(M()){var t=e.style.width,i=e.style.height;e.style.width=parseInt(t)+1+"px",e.style.height=parseInt(i)+"px",setTimeout(function(){e.style.width=t,e.style.height=i},100)}window.canvas=e},X=function(){function e(e,t,i,r){var n=Math.tan(t?t.upDegrees*a:s),A=Math.tan(t?t.downDegrees*a:s),o=Math.tan(t?t.leftDegrees*a:s),l=Math.tan(t?t.rightDegrees*a:s),c=2/(o+l),h=2/(n+A);return e[0]=c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=h,e[6]=0,e[7]=0,e[8]=-(o-l)*c*.5,e[9]=(n-A)*h*.5,e[10]=r/(i-r),e[11]=-1,e[12]=0,e[13]=0,e[14]=r*i/(i-r),e[15]=0,e}function t(e,t,i){var r=t[0],n=t[1],a=t[2],s=t[3],A=r+r,o=n+n,l=a+a,c=r*A,h=r*o,d=r*l,u=n*o,p=n*l,f=a*l,m=s*A,g=s*o,v=s*l;return e[0]=1-(u+f),e[1]=h+v,e[2]=d-g,e[3]=0,e[4]=h-v,e[5]=1-(c+f),e[6]=p+m,e[7]=0,e[8]=d+g,e[9]=p-m,e[10]=1-(c+u),e[11]=0,e[12]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1,e}function i(e,t,i){var r,n,a,s,A,o,l,c,h,d,u,p,f=i[0],m=i[1],g=i[2];return t===e?(e[12]=t[0]*f+t[4]*m+t[8]*g+t[12],e[13]=t[1]*f+t[5]*m+t[9]*g+t[13],e[14]=t[2]*f+t[6]*m+t[10]*g+t[14],e[15]=t[3]*f+t[7]*m+t[11]*g+t[15]):(r=t[0],n=t[1],a=t[2],s=t[3],A=t[4],o=t[5],l=t[6],c=t[7],h=t[8],d=t[9],u=t[10],p=t[11],e[0]=r,e[1]=n,e[2]=a,e[3]=s,e[4]=A,e[5]=o,e[6]=l,e[7]=c,e[8]=h,e[9]=d,e[10]=u,e[11]=p,e[12]=r*f+A*m+h*g+t[12],e[13]=n*f+o*m+d*g+t[13],e[14]=a*f+l*m+u*g+t[14],e[15]=s*f+c*m+p*g+t[15]),e}function r(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],s=t[4],A=t[5],o=t[6],l=t[7],c=t[8],h=t[9],d=t[10],u=t[11],p=t[12],f=t[13],m=t[14],g=t[15],v=i*A-r*s,w=i*o-n*s,y=i*l-a*s,E=r*o-n*A,b=r*l-a*A,_=n*l-a*o,D=c*f-h*p,M=c*m-d*p,F=c*g-u*p,T=h*m-d*f,B=h*g-u*f,R=d*g-u*m,S=v*R-w*B+y*T+E*F-b*M+_*D;return S?(S=1/S,e[0]=(A*R-o*B+l*T)*S,e[1]=(n*B-r*R-a*T)*S,e[2]=(f*_-m*b+g*E)*S,e[3]=(d*b-h*_-u*E)*S,e[4]=(o*F-s*R-l*M)*S,e[5]=(i*R-n*F+a*M)*S,e[6]=(m*y-p*_-g*w)*S,e[7]=(c*_-d*y+u*w)*S,e[8]=(s*B-A*F+l*D)*S,e[9]=(r*F-i*B-a*D)*S,e[10]=(p*b-f*y+g*v)*S,e[11]=(h*y-c*b-u*v)*S,e[12]=(A*M-s*T-o*D)*S,e[13]=(i*T-r*M+n*D)*S,e[14]=(f*w-p*E-m*v)*S,e[15]=(c*E-h*w+d*v)*S,e):null}function n(n,a,s,l,c,h){e(n,l||null,h.depthNear,h.depthFar),t(a,s.orientation||A,s.position||o),c&&i(a,a,c),r(a,a)}var a=Math.PI/180,s=.25*Math.PI,A=new Float32Array([0,0,0,1]),o=new Float32Array([0,0,0]);return function(e,t,i){return!(!e||!t)&&(e.pose=t,e.timestamp=t.timestamp,n(e.leftProjectionMatrix,e.leftViewMatrix,t,i._getFieldOfView("left"),i._getEyeOffset("left"),i),n(e.rightProjectionMatrix,e.rightViewMatrix,t,i._getFieldOfView("right"),i._getEyeOffset("right"),i),!0)}}(),Y=function(){var e=window.self!==window.top,t=Z(document.referrer),i=Z(window.location.href);return e&&t!==i},Z=function(e){var t,i=e.indexOf("://");t=-1!==i?i+3:0;var r=e.indexOf("/",t);return-1===r&&(r=e.length),e.substring(0,r)},j=function(e){return e.w>1?(console.warn("getQuaternionAngle: w > 1"),0):2*Math.acos(e.w)},K=function(){var e={};return function(t,i){void 0===e[t]&&(console.warn("webvr-polyfill: "+i),e[t]=!0)}}(),J=function(e,t){K(e,e+" has been deprecated. This may not work on native WebVR displays. "+(t?"Please use "+t+" instead.":""))},q=e,$=["attribute vec2 position;","attribute vec3 texCoord;","varying vec2 vTexCoord;","uniform vec4 viewportOffsetScale[2];","void main() {"," vec4 viewport = viewportOffsetScale[int(texCoord.z)];"," vTexCoord = (texCoord.xy * viewport.zw) + viewport.xy;"," gl_Position = vec4( position, 1.0, 1.0 );","}"].join("\n"),ee=["precision mediump float;","uniform sampler2D diffuse;","varying vec2 vTexCoord;","void main() {"," gl_FragColor = texture2D(diffuse, vTexCoord);","}"].join("\n");i.prototype.destroy=function(){var e=this.gl;this.unpatch(),e.deleteProgram(this.program),e.deleteBuffer(this.vertexBuffer),e.deleteBuffer(this.indexBuffer),e.deleteTexture(this.renderTarget),e.deleteFramebuffer(this.framebuffer),this.depthStencilBuffer&&e.deleteRenderbuffer(this.depthStencilBuffer),this.depthBuffer&&e.deleteRenderbuffer(this.depthBuffer),this.stencilBuffer&&e.deleteRenderbuffer(this.stencilBuffer),this.cardboardUI&&this.cardboardUI.destroy()},i.prototype.onResize=function(){var e=this.gl,t=this,i=[e.RENDERBUFFER_BINDING,e.TEXTURE_BINDING_2D,e.TEXTURE0];q(e,i,function(e){t.realBindFramebuffer.call(e,e.FRAMEBUFFER,null),t.scissorTest&&t.realDisable.call(e,e.SCISSOR_TEST),t.realColorMask.call(e,!0,!0,!0,!0),t.realViewport.call(e,0,0,e.drawingBufferWidth,e.drawingBufferHeight),t.realClearColor.call(e,0,0,0,1),e.clear(e.COLOR_BUFFER_BIT),t.realBindFramebuffer.call(e,e.FRAMEBUFFER,t.framebuffer),e.bindTexture(e.TEXTURE_2D,t.renderTarget),e.texImage2D(e.TEXTURE_2D,0,t.ctxAttribs.alpha?e.RGBA:e.RGB,t.bufferWidth,t.bufferHeight,0,t.ctxAttribs.alpha?e.RGBA:e.RGB,e.UNSIGNED_BYTE,null),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t.renderTarget,0),t.ctxAttribs.depth&&t.ctxAttribs.stencil?(e.bindRenderbuffer(e.RENDERBUFFER,t.depthStencilBuffer),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,t.bufferWidth,t.bufferHeight),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t.depthStencilBuffer)):t.ctxAttribs.depth?(e.bindRenderbuffer(e.RENDERBUFFER,t.depthBuffer),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,t.bufferWidth,t.bufferHeight),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t.depthBuffer)):t.ctxAttribs.stencil&&(e.bindRenderbuffer(e.RENDERBUFFER,t.stencilBuffer),e.renderbufferStorage(e.RENDERBUFFER,e.STENCIL_INDEX8,t.bufferWidth,t.bufferHeight),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.STENCIL_ATTACHMENT,e.RENDERBUFFER,t.stencilBuffer)),!e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer incomplete!"),t.realBindFramebuffer.call(e,e.FRAMEBUFFER,t.lastBoundFramebuffer),t.scissorTest&&t.realEnable.call(e,e.SCISSOR_TEST),t.realColorMask.apply(e,t.colorMask),t.realViewport.apply(e,t.viewport),t.realClearColor.apply(e,t.clearColor)}),this.cardboardUI&&this.cardboardUI.onResize()},i.prototype.patch=function(){if(!this.isPatched){var e=this,t=this.gl.canvas,i=this.gl;M()||(t.width=P()*this.bufferScale,t.height=N()*this.bufferScale,Object.defineProperty(t,"width",{configurable:!0,enumerable:!0,get:function(){return e.bufferWidth},set:function(i){e.bufferWidth=i,e.realCanvasWidth.set.call(t,i),e.onResize()}}),Object.defineProperty(t,"height",{configurable:!0,enumerable:!0,get:function(){return e.bufferHeight},set:function(i){e.bufferHeight=i,e.realCanvasHeight.set.call(t,i),e.onResize()}})),this.lastBoundFramebuffer=i.getParameter(i.FRAMEBUFFER_BINDING),null==this.lastBoundFramebuffer&&(this.lastBoundFramebuffer=this.framebuffer,this.gl.bindFramebuffer(i.FRAMEBUFFER,this.framebuffer)),this.gl.bindFramebuffer=function(t,r){e.lastBoundFramebuffer=r||e.framebuffer,e.realBindFramebuffer.call(i,t,e.lastBoundFramebuffer)},this.cullFace=i.getParameter(i.CULL_FACE),this.depthTest=i.getParameter(i.DEPTH_TEST),this.blend=i.getParameter(i.BLEND),this.scissorTest=i.getParameter(i.SCISSOR_TEST),this.stencilTest=i.getParameter(i.STENCIL_TEST),i.enable=function(t){switch(t){case i.CULL_FACE:e.cullFace=!0;break;case i.DEPTH_TEST:e.depthTest=!0;break;case i.BLEND:e.blend=!0;break;case i.SCISSOR_TEST:e.scissorTest=!0;break;case i.STENCIL_TEST:e.stencilTest=!0}e.realEnable.call(i,t)},i.disable=function(t){switch(t){case i.CULL_FACE:e.cullFace=!1;break;case i.DEPTH_TEST:e.depthTest=!1;break;case i.BLEND:e.blend=!1;break;case i.SCISSOR_TEST:e.scissorTest=!1;break;case i.STENCIL_TEST:e.stencilTest=!1}e.realDisable.call(i,t)},this.colorMask=i.getParameter(i.COLOR_WRITEMASK),i.colorMask=function(t,r,n,a){e.colorMask[0]=t,e.colorMask[1]=r,e.colorMask[2]=n,e.colorMask[3]=a,e.realColorMask.call(i,t,r,n,a)},this.clearColor=i.getParameter(i.COLOR_CLEAR_VALUE),i.clearColor=function(t,r,n,a){e.clearColor[0]=t,e.clearColor[1]=r,e.clearColor[2]=n,e.clearColor[3]=a,e.realClearColor.call(i,t,r,n,a)},this.viewport=i.getParameter(i.VIEWPORT),i.viewport=function(t,r,n,a){e.viewport[0]=t,e.viewport[1]=r,e.viewport[2]=n,e.viewport[3]=a,e.realViewport.call(i,t,r,n,a)},this.isPatched=!0,W(t)}},i.prototype.unpatch=function(){if(this.isPatched){var e=this.gl,t=this.gl.canvas;M()||(Object.defineProperty(t,"width",this.realCanvasWidth),Object.defineProperty(t,"height",this.realCanvasHeight)),t.width=this.bufferWidth,t.height=this.bufferHeight,e.bindFramebuffer=this.realBindFramebuffer,e.enable=this.realEnable,e.disable=this.realDisable,e.colorMask=this.realColorMask,e.clearColor=this.realClearColor,e.viewport=this.realViewport,this.lastBoundFramebuffer==this.framebuffer&&e.bindFramebuffer(e.FRAMEBUFFER,null),this.isPatched=!1,setTimeout(function(){W(t)},1)}},i.prototype.setTextureBounds=function(e,t){e||(e=[0,0,.5,1]),t||(t=[.5,0,.5,1]),this.viewportOffsetScale[0]=e[0],this.viewportOffsetScale[1]=e[1],this.viewportOffsetScale[2]=e[2],this.viewportOffsetScale[3]=e[3],this.viewportOffsetScale[4]=t[0],this.viewportOffsetScale[5]=t[1],this.viewportOffsetScale[6]=t[2],this.viewportOffsetScale[7]=t[3]},i.prototype.submitFrame=function(){var e=this.gl,t=this,i=[];if(this.dirtySubmitFrameBindings||i.push(e.CURRENT_PROGRAM,e.ARRAY_BUFFER_BINDING,e.ELEMENT_ARRAY_BUFFER_BINDING,e.TEXTURE_BINDING_2D,e.TEXTURE0),q(e,i,function(e){t.realBindFramebuffer.call(e,e.FRAMEBUFFER,null);var i=0,r=0;t.instanceExt&&(i=e.getVertexAttrib(t.attribs.position,t.instanceExt.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE),r=e.getVertexAttrib(t.attribs.texCoord,t.instanceExt.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE)),t.cullFace&&t.realDisable.call(e,e.CULL_FACE),t.depthTest&&t.realDisable.call(e,e.DEPTH_TEST),t.blend&&t.realDisable.call(e,e.BLEND),t.scissorTest&&t.realDisable.call(e,e.SCISSOR_TEST),t.stencilTest&&t.realDisable.call(e,e.STENCIL_TEST),t.realColorMask.call(e,!0,!0,!0,!0),t.realViewport.call(e,0,0,e.drawingBufferWidth,e.drawingBufferHeight),(t.ctxAttribs.alpha||M())&&(t.realClearColor.call(e,0,0,0,1),e.clear(e.COLOR_BUFFER_BIT)),e.useProgram(t.program),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.indexBuffer),e.bindBuffer(e.ARRAY_BUFFER,t.vertexBuffer),e.enableVertexAttribArray(t.attribs.position),e.enableVertexAttribArray(t.attribs.texCoord),e.vertexAttribPointer(t.attribs.position,2,e.FLOAT,!1,20,0),e.vertexAttribPointer(t.attribs.texCoord,3,e.FLOAT,!1,20,8),t.instanceExt&&(0!=i&&t.instanceExt.vertexAttribDivisorANGLE(t.attribs.position,0),0!=r&&t.instanceExt.vertexAttribDivisorANGLE(t.attribs.texCoord,0)),e.activeTexture(e.TEXTURE0),e.uniform1i(t.uniforms.diffuse,0),e.bindTexture(e.TEXTURE_2D,t.renderTarget),e.uniform4fv(t.uniforms.viewportOffsetScale,t.viewportOffsetScale),e.drawElements(e.TRIANGLES,t.indexCount,e.UNSIGNED_SHORT,0),t.cardboardUI&&t.cardboardUI.renderNoState(),t.realBindFramebuffer.call(t.gl,e.FRAMEBUFFER,t.framebuffer),t.ctxAttribs.preserveDrawingBuffer||(t.realClearColor.call(e,0,0,0,0),e.clear(e.COLOR_BUFFER_BIT)),t.dirtySubmitFrameBindings||t.realBindFramebuffer.call(e,e.FRAMEBUFFER,t.lastBoundFramebuffer),t.cullFace&&t.realEnable.call(e,e.CULL_FACE),t.depthTest&&t.realEnable.call(e,e.DEPTH_TEST),t.blend&&t.realEnable.call(e,e.BLEND),t.scissorTest&&t.realEnable.call(e,e.SCISSOR_TEST),t.stencilTest&&t.realEnable.call(e,e.STENCIL_TEST),t.realColorMask.apply(e,t.colorMask),t.realViewport.apply(e,t.viewport),!t.ctxAttribs.alpha&&t.ctxAttribs.preserveDrawingBuffer||t.realClearColor.apply(e,t.clearColor),t.instanceExt&&(0!=i&&t.instanceExt.vertexAttribDivisorANGLE(t.attribs.position,i),0!=r&&t.instanceExt.vertexAttribDivisorANGLE(t.attribs.texCoord,r))}),M()){var r=e.canvas;r.width==t.bufferWidth&&r.height==t.bufferHeight||(t.bufferWidth=r.width,t.bufferHeight=r.height,t.onResize())}},i.prototype.updateDeviceInfo=function(e){var t=this.gl,i=this,r=[t.ARRAY_BUFFER_BINDING,t.ELEMENT_ARRAY_BUFFER_BINDING];q(t,r,function(t){var r=i.computeMeshVertices_(i.meshWidth,i.meshHeight,e);if(t.bindBuffer(t.ARRAY_BUFFER,i.vertexBuffer),t.bufferData(t.ARRAY_BUFFER,r,t.STATIC_DRAW),!i.indexCount){var n=i.computeMeshIndices_(i.meshWidth,i.meshHeight);t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,i.indexBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,n,t.STATIC_DRAW),i.indexCount=n.length}})},i.prototype.computeMeshVertices_=function(e,t,i){for(var r=new Float32Array(2*e*t*5),n=i.getLeftEyeVisibleTanAngles(),a=i.getLeftEyeNoLensTanAngles(),s=i.getLeftEyeVisibleScreenRect(a),A=0,o=0;o<2;o++){for(var l=0;l<t;l++)for(var c=0;c<e;c++,A++){var h=c/(e-1),d=l/(t-1),u=h,p=d,f=D(n[0],n[2],h),m=D(n[3],n[1],d),g=Math.sqrt(f*f+m*m),v=i.distortion.distortInverse(g),w=f*v/g,y=m*v/g;h=(w-a[0])/(a[2]-a[0]),d=(y-a[3])/(a[1]-a[3]),h=2*(s.x+h*s.width-.5),d=2*(s.y+d*s.height-.5),r[5*A+0]=h,r[5*A+1]=d,r[5*A+2]=u,r[5*A+3]=p,r[5*A+4]=o}var E=n[2]-n[0];n[0]=-(E+n[0]),n[2]=E-n[2],E=a[2]-a[0],a[0]=-(E+a[0]),a[2]=E-a[2],s.x=1-(s.x+s.width)}return r},i.prototype.computeMeshIndices_=function(e,t){for(var i=new Uint16Array(2*(e-1)*(t-1)*6),r=e/2,n=t/2,a=0,s=0,A=0;A<2;A++)for(var o=0;o<t;o++)for(var l=0;l<e;l++,a++)0!=l&&0!=o&&(l<=r==o<=n?(i[s++]=a,i[s++]=a-e-1,i[s++]=a-e,i[s++]=a-e-1,i[s++]=a,i[s++]=a-1):(i[s++]=a-1,i[s++]=a-e,i[s++]=a,i[s++]=a-e,i[s++]=a-1,i[s++]=a-e-1));return i},i.prototype.getOwnPropertyDescriptor_=function(e,t){var i=Object.getOwnPropertyDescriptor(e,t);return void 0!==i.get&&void 0!==i.set||(i.configurable=!0,i.enumerable=!0,i.get=function(){return this.getAttribute(t)},i.set=function(e){this.setAttribute(t,e)}),i};var te=["attribute vec2 position;","uniform mat4 projectionMat;","void main() {"," gl_Position = projectionMat * vec4( position, -1.0, 1.0 );","}"].join("\n"),ie=["precision mediump float;","uniform vec4 color;","void main() {"," gl_FragColor = color;","}"].join("\n"),re=Math.PI/180,ne=.3125;r.prototype.destroy=function(){var e=this.gl;this.listener&&e.canvas.removeEventListener("click",this.listener,!1),e.deleteProgram(this.program),e.deleteBuffer(this.vertexBuffer)},r.prototype.listen=function(e,t){var i=this.gl.canvas;this.listener=function(r){var n=i.clientWidth/2;r.clientX>n-42&&r.clientX<n+42&&r.clientY>i.clientHeight-42?e(r):r.clientX<42&&r.clientY<42&&t(r)},i.addEventListener("click",this.listener,!1)},r.prototype.onResize=function(){var e=this.gl,t=this,i=[e.ARRAY_BUFFER_BINDING];q(e,i,function(e){function i(e,t){var i=(90-e)*re,r=Math.cos(i),s=Math.sin(i);n.push(ne*r*h+a,ne*s*h+h),n.push(t*r*h+a,t*s*h+h)}function r(t,i){n.push(d+t,e.drawingBufferHeight-d-i)}var n=[],a=e.drawingBufferWidth/2,s=Math.max(screen.width,screen.height)*window.devicePixelRatio,A=e.drawingBufferWidth/s,o=A*window.devicePixelRatio,l=4*o/2,c=42*o,h=28*o/2,d=14*o;n.push(a-l,c),n.push(a-l,e.drawingBufferHeight),n.push(a+l,c),n.push(a+l,e.drawingBufferHeight),t.gearOffset=n.length/2;for(var u=0;u<=6;u++){var p=60*u;i(p,1),i(p+12,1),i(p+20,.75),i(p+40,.75),i(p+48,1)}t.gearVertexCount=n.length/2-t.gearOffset,t.arrowOffset=n.length/2;var f=l/Math.sin(45*re);r(0,h),r(h,0),r(h+f,f),r(f,h+f),r(f,h-f),r(0,h),r(h,2*h),r(h+f,2*h-f),r(f,h-f),r(0,h),r(f,h-l),r(28*o,h-l),r(f,h+l),r(28*o,h+l),t.arrowVertexCount=n.length/2-t.arrowOffset,e.bindBuffer(e.ARRAY_BUFFER,t.vertexBuffer),e.bufferData(e.ARRAY_BUFFER,new Float32Array(n),e.STATIC_DRAW)})},r.prototype.render=function(){
  1151. var e=this.gl,t=this,i=[e.CULL_FACE,e.DEPTH_TEST,e.BLEND,e.SCISSOR_TEST,e.STENCIL_TEST,e.COLOR_WRITEMASK,e.VIEWPORT,e.CURRENT_PROGRAM,e.ARRAY_BUFFER_BINDING];q(e,i,function(e){e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.BLEND),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.colorMask(!0,!0,!0,!0),e.viewport(0,0,e.drawingBufferWidth,e.drawingBufferHeight),t.renderNoState()})},r.prototype.renderNoState=function(){var e=this.gl;e.useProgram(this.program),e.bindBuffer(e.ARRAY_BUFFER,this.vertexBuffer),e.enableVertexAttribArray(this.attribs.position),e.vertexAttribPointer(this.attribs.position,2,e.FLOAT,!1,8,0),e.uniform4f(this.uniforms.color,1,1,1,1),V(this.projMat,0,e.drawingBufferWidth,0,e.drawingBufferHeight,.1,1024),e.uniformMatrix4fv(this.uniforms.projectionMat,!1,this.projMat),e.drawArrays(e.TRIANGLE_STRIP,0,4),e.drawArrays(e.TRIANGLE_STRIP,this.gearOffset,this.gearVertexCount),e.drawArrays(e.TRIANGLE_STRIP,this.arrowOffset,this.arrowVertexCount)},n.prototype.distortInverse=function(e){for(var t=0,i=1,r=e-this.distort(t);Math.abs(i-t)>1e-4;){var n=e-this.distort(i),a=i-n*((i-t)/(n-r));t=i,i=a,r=n}return i},n.prototype.distort=function(e){for(var t=e*e,i=0,r=0;r<this.coefficients.length;r++)i=t*(i+this.coefficients[r]);return(i+1)*e};var ae=Math.PI/180,se=180/Math.PI,Ae=function(e,t,i){this.x=e||0,this.y=t||0,this.z=i||0};Ae.prototype={constructor:Ae,set:function(e,t,i){return this.x=e,this.y=t,this.z=i,this},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},normalize:function(){var e=this.length();if(0!==e){var t=1/e;this.multiplyScalar(t)}else this.x=0,this.y=0,this.z=0;return this},multiplyScalar:function(e){this.x*=e,this.y*=e,this.z*=e},applyQuaternion:function(e){var t=this.x,i=this.y,r=this.z,n=e.x,a=e.y,s=e.z,A=e.w,o=A*t+a*r-s*i,l=A*i+s*t-n*r,c=A*r+n*i-a*t,h=-n*t-a*i-s*r;return this.x=o*A+h*-n+l*-s-c*-a,this.y=l*A+h*-a+c*-n-o*-s,this.z=c*A+h*-s+o*-a-l*-n,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},crossVectors:function(e,t){var i=e.x,r=e.y,n=e.z,a=t.x,s=t.y,A=t.z;return this.x=r*A-n*s,this.y=n*a-i*A,this.z=i*s-r*a,this}};var oe=function(e,t,i,r){this.x=e||0,this.y=t||0,this.z=i||0,this.w=void 0!==r?r:1};oe.prototype={constructor:oe,set:function(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this},setFromEulerXYZ:function(e,t,i){var r=Math.cos(e/2),n=Math.cos(t/2),a=Math.cos(i/2),s=Math.sin(e/2),A=Math.sin(t/2),o=Math.sin(i/2);return this.x=s*n*a+r*A*o,this.y=r*A*a-s*n*o,this.z=r*n*o+s*A*a,this.w=r*n*a-s*A*o,this},setFromEulerYXZ:function(e,t,i){var r=Math.cos(e/2),n=Math.cos(t/2),a=Math.cos(i/2),s=Math.sin(e/2),A=Math.sin(t/2),o=Math.sin(i/2);return this.x=s*n*a+r*A*o,this.y=r*A*a-s*n*o,this.z=r*n*o-s*A*a,this.w=r*n*a+s*A*o,this},setFromAxisAngle:function(e,t){var i=t/2,r=Math.sin(i);return this.x=e.x*r,this.y=e.y*r,this.z=e.z*r,this.w=Math.cos(i),this},multiply:function(e){return this.multiplyQuaternions(this,e)},multiplyQuaternions:function(e,t){var i=e.x,r=e.y,n=e.z,a=e.w,s=t.x,A=t.y,o=t.z,l=t.w;return this.x=i*l+a*s+r*o-n*A,this.y=r*l+a*A+n*s-i*o,this.z=n*l+a*o+i*A-r*s,this.w=a*l-i*s-r*A-n*o,this},inverse:function(){return this.x*=-1,this.y*=-1,this.z*=-1,this.normalize(),this},normalize:function(){var e=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);return 0===e?(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},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var i=this.x,r=this.y,n=this.z,a=this.w,s=a*e.w+i*e.x+r*e.y+n*e.z;if(s<0?(this.w=-e.w,this.x=-e.x,this.y=-e.y,this.z=-e.z,s=-s):this.copy(e),s>=1)return this.w=a,this.x=i,this.y=r,this.z=n,this;var A=Math.acos(s),o=Math.sqrt(1-s*s);if(Math.abs(o)<.001)return this.w=.5*(a+this.w),this.x=.5*(i+this.x),this.y=.5*(r+this.y),this.z=.5*(n+this.z),this;var l=Math.sin((1-t)*A)/o,c=Math.sin(t*A)/o;return this.w=a*l+this.w*c,this.x=i*l+this.x*c,this.y=r*l+this.y*c,this.z=n*l+this.z*c,this},setFromUnitVectors:function(){var e,t;return function(i,r){return void 0===e&&(e=new Ae),t=i.dot(r)+1,t<1e-6?(t=0,Math.abs(i.x)>Math.abs(i.z)?e.set(-i.y,i.x,0):e.set(0,-i.z,i.y)):e.crossVectors(i,r),this.x=e.x,this.y=e.y,this.z=e.z,this.w=t,this.normalize(),this}}()};var le=new a({widthMeters:.11,heightMeters:.062,bevelMeters:.004}),ce=new a({widthMeters:.1038,heightMeters:.0584,bevelMeters:.004}),he={CardboardV1:new A({id:"CardboardV1",label:"Cardboard I/O 2014",fov:40,interLensDistance:.06,baselineLensDistance:.035,screenLensDistance:.042,distortionCoefficients:[.441,.156],inverseCoefficients:[-.4410035,.42756155,-.4804439,.5460139,-.58821183,.5733938,-.48303202,.33299083,-.17573841,.0651772,-.01488963,.001559834]}),CardboardV2:new A({id:"CardboardV2",label:"Cardboard I/O 2015",fov:60,interLensDistance:.064,baselineLensDistance:.035,screenLensDistance:.039,distortionCoefficients:[.34,.55],inverseCoefficients:[-.33836704,-.18162185,.862655,-1.2462051,1.0560602,-.58208317,.21609078,-.05444823,.009177956,-.0009904169,6183535e-11,-16981803e-13]})};s.prototype.updateDeviceParams=function(e){this.device=this.determineDevice_(e)||this.device},s.prototype.getDevice=function(){return this.device},s.prototype.setViewer=function(e){this.viewer=e,this.distortion=new n(this.viewer.distortionCoefficients)},s.prototype.determineDevice_=function(e){if(!e)return M()?(console.warn("Using fallback iOS device measurements."),ce):(console.warn("Using fallback Android device measurements."),le);var t=.0254/e.xdpi,i=.0254/e.ydpi;return new a({widthMeters:t*P(),heightMeters:i*N(),bevelMeters:.001*e.bevelMm})},s.prototype.getDistortedFieldOfViewLeftEye=function(){var e=this.viewer,t=this.device,i=this.distortion,r=e.screenLensDistance,n=(t.widthMeters-e.interLensDistance)/2,a=e.interLensDistance/2,s=e.baselineLensDistance-t.bevelMeters,A=t.heightMeters-s,o=se*Math.atan(i.distort(n/r)),l=se*Math.atan(i.distort(a/r)),c=se*Math.atan(i.distort(s/r)),h=se*Math.atan(i.distort(A/r));return{leftDegrees:Math.min(o,e.fov),rightDegrees:Math.min(l,e.fov),downDegrees:Math.min(c,e.fov),upDegrees:Math.min(h,e.fov)}},s.prototype.getLeftEyeVisibleTanAngles=function(){var e=this.viewer,t=this.device,i=this.distortion,r=Math.tan(-ae*e.fov),n=Math.tan(ae*e.fov),a=Math.tan(ae*e.fov),s=Math.tan(-ae*e.fov),A=t.widthMeters/4,o=t.heightMeters/2,l=e.baselineLensDistance-t.bevelMeters-o,c=e.interLensDistance/2-A,h=-l,d=e.screenLensDistance,u=i.distort((c-A)/d),p=i.distort((h+o)/d),f=i.distort((c+A)/d),m=i.distort((h-o)/d),g=new Float32Array(4);return g[0]=Math.max(r,u),g[1]=Math.min(n,p),g[2]=Math.min(a,f),g[3]=Math.max(s,m),g},s.prototype.getLeftEyeNoLensTanAngles=function(){var e=this.viewer,t=this.device,i=this.distortion,r=new Float32Array(4),n=i.distortInverse(Math.tan(-ae*e.fov)),a=i.distortInverse(Math.tan(ae*e.fov)),s=i.distortInverse(Math.tan(ae*e.fov)),A=i.distortInverse(Math.tan(-ae*e.fov)),o=t.widthMeters/4,l=t.heightMeters/2,c=e.baselineLensDistance-t.bevelMeters-l,h=e.interLensDistance/2-o,d=-c,u=e.screenLensDistance,p=(h-o)/u,f=(d+l)/u,m=(h+o)/u,g=(d-l)/u;return r[0]=Math.max(n,p),r[1]=Math.min(a,f),r[2]=Math.min(s,m),r[3]=Math.max(A,g),r},s.prototype.getLeftEyeVisibleScreenRect=function(e){var t=this.viewer,i=this.device,r=t.screenLensDistance,n=(i.widthMeters-t.interLensDistance)/2,a=t.baselineLensDistance-i.bevelMeters,s=(e[0]*r+n)/i.widthMeters,A=(e[1]*r+a)/i.heightMeters,o=(e[2]*r+n)/i.widthMeters,l=(e[3]*r+a)/i.heightMeters;return{x:s,y:l,width:o-s,height:A-l}},s.prototype.getFieldOfViewLeftEye=function(e){return e?this.getUndistortedFieldOfViewLeftEye():this.getDistortedFieldOfViewLeftEye()},s.prototype.getFieldOfViewRightEye=function(e){var t=this.getFieldOfViewLeftEye(e);return{leftDegrees:t.rightDegrees,rightDegrees:t.leftDegrees,upDegrees:t.upDegrees,downDegrees:t.downDegrees}},s.prototype.getUndistortedFieldOfViewLeftEye=function(){var e=this.getUndistortedParams_();return{leftDegrees:se*Math.atan(e.outerDist),rightDegrees:se*Math.atan(e.innerDist),downDegrees:se*Math.atan(e.bottomDist),upDegrees:se*Math.atan(e.topDist)}},s.prototype.getUndistortedViewportLeftEye=function(){var e=this.getUndistortedParams_(),t=this.viewer,i=this.device,r=t.screenLensDistance,n=i.widthMeters/r,a=i.heightMeters/r,s=i.width/n,A=i.height/a,o=Math.round((e.eyePosX-e.outerDist)*s),l=Math.round((e.eyePosY-e.bottomDist)*A);return{x:o,y:l,width:Math.round((e.eyePosX+e.innerDist)*s)-o,height:Math.round((e.eyePosY+e.topDist)*A)-l}},s.prototype.getUndistortedParams_=function(){var e=this.viewer,t=this.device,i=this.distortion,r=e.screenLensDistance,n=e.interLensDistance/2/r,a=t.widthMeters/r,s=t.heightMeters/r,A=a/2-n,o=(e.baselineLensDistance-t.bevelMeters)/r,l=e.fov,c=i.distortInverse(Math.tan(ae*l)),h=Math.min(A,c),d=Math.min(n,c),u=Math.min(o,c);return{outerDist:h,innerDist:d,topDist:Math.min(s-o,c),bottomDist:u,eyePosX:A,eyePosY:o}},s.Viewers=he;var de=[{type:"android",rules:[{mdmh:"asus/*/Nexus 7/*"},{ua:"Nexus 7"}],dpi:[320.8,323],bw:3,ac:500},{type:"android",rules:[{mdmh:"asus/*/ASUS_X00PD/*"},{ua:"ASUS_X00PD"}],dpi:245,bw:3,ac:500},{type:"android",rules:[{mdmh:"asus/*/ASUS_X008D/*"},{ua:"ASUS_X008D"}],dpi:282,bw:3,ac:500},{type:"android",rules:[{mdmh:"asus/*/ASUS_Z00AD/*"},{ua:"ASUS_Z00AD"}],dpi:[403,404.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Google/*/Pixel 2 XL/*"},{ua:"Pixel 2 XL"}],dpi:537.9,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Google/*/Pixel 3 XL/*"},{ua:"Pixel 3 XL"}],dpi:[558.5,553.8],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Google/*/Pixel XL/*"},{ua:"Pixel XL"}],dpi:[537.9,533],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Google/*/Pixel 3/*"},{ua:"Pixel 3"}],dpi:442.4,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Google/*/Pixel 2/*"},{ua:"Pixel 2"}],dpi:441,bw:3,ac:500},{type:"android",rules:[{mdmh:"Google/*/Pixel/*"},{ua:"Pixel"}],dpi:[432.6,436.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"HTC/*/HTC6435LVW/*"},{ua:"HTC6435LVW"}],dpi:[449.7,443.3],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"HTC/*/HTC One XL/*"},{ua:"HTC One XL"}],dpi:[315.3,314.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"htc/*/Nexus 9/*"},{ua:"Nexus 9"}],dpi:289,bw:3,ac:500},{type:"android",rules:[{mdmh:"HTC/*/HTC One M9/*"},{ua:"HTC One M9"}],dpi:[442.5,443.3],bw:3,ac:500},{type:"android",rules:[{mdmh:"HTC/*/HTC One_M8/*"},{ua:"HTC One_M8"}],dpi:[449.7,447.4],bw:3,ac:500},{type:"android",rules:[{mdmh:"HTC/*/HTC One/*"},{ua:"HTC One"}],dpi:472.8,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Huawei/*/Nexus 6P/*"},{ua:"Nexus 6P"}],dpi:[515.1,518],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Huawei/*/BLN-L24/*"},{ua:"HONORBLN-L24"}],dpi:480,bw:4,ac:500},{type:"android",rules:[{mdmh:"Huawei/*/BKL-L09/*"},{ua:"BKL-L09"}],dpi:403,bw:3.47,ac:500},{type:"android",rules:[{mdmh:"LENOVO/*/Lenovo PB2-690Y/*"},{ua:"Lenovo PB2-690Y"}],dpi:[457.2,454.713],bw:3,ac:500},{type:"android",rules:[{mdmh:"LGE/*/Nexus 5X/*"},{ua:"Nexus 5X"}],dpi:[422,419.9],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/LGMS345/*"},{ua:"LGMS345"}],dpi:[221.7,219.1],bw:3,ac:500},{type:"android",rules:[{mdmh:"LGE/*/LG-D800/*"},{ua:"LG-D800"}],dpi:[422,424.1],bw:3,ac:500},{type:"android",rules:[{mdmh:"LGE/*/LG-D850/*"},{ua:"LG-D850"}],dpi:[537.9,541.9],bw:3,ac:500},{type:"android",rules:[{mdmh:"LGE/*/VS985 4G/*"},{ua:"VS985 4G"}],dpi:[537.9,535.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/Nexus 5/*"},{ua:"Nexus 5 B"}],dpi:[442.4,444.8],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/Nexus 4/*"},{ua:"Nexus 4"}],dpi:[319.8,318.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/LG-P769/*"},{ua:"LG-P769"}],dpi:[240.6,247.5],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/LGMS323/*"},{ua:"LGMS323"}],dpi:[206.6,204.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/LGLS996/*"},{ua:"LGLS996"}],dpi:[403.4,401.5],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Micromax/*/4560MMX/*"},{ua:"4560MMX"}],dpi:[240,219.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Micromax/*/A250/*"},{ua:"Micromax A250"}],dpi:[480,446.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Micromax/*/Micromax AQ4501/*"},{ua:"Micromax AQ4501"}],dpi:240,bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/G5/*"},{ua:"Moto G (5) Plus"}],dpi:[403.4,403],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/DROID RAZR/*"},{ua:"DROID RAZR"}],dpi:[368.1,256.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT830C/*"},{ua:"XT830C"}],dpi:[254,255.9],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT1021/*"},{ua:"XT1021"}],dpi:[254,256.7],bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/XT1023/*"},{ua:"XT1023"}],dpi:[254,256.7],bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/XT1028/*"},{ua:"XT1028"}],dpi:[326.6,327.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT1034/*"},{ua:"XT1034"}],dpi:[326.6,328.4],bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/XT1053/*"},{ua:"XT1053"}],dpi:[315.3,316.1],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT1562/*"},{ua:"XT1562"}],dpi:[403.4,402.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/Nexus 6/*"},{ua:"Nexus 6 B"}],dpi:[494.3,489.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT1063/*"},{ua:"XT1063"}],dpi:[295,296.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT1064/*"},{ua:"XT1064"}],dpi:[295,295.6],bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/XT1092/*"},{ua:"XT1092"}],dpi:[422,424.1],bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/XT1095/*"},{ua:"XT1095"}],dpi:[422,423.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/G4/*"},{ua:"Moto G (4)"}],dpi:401,bw:4,ac:1e3},{type:"android",rules:[{mdmh:"OnePlus/*/A0001/*"},{ua:"A0001"}],dpi:[403.4,401],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"OnePlus/*/ONE E1001/*"},{ua:"ONE E1001"}],dpi:[442.4,441.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"OnePlus/*/ONE E1003/*"},{ua:"ONE E1003"}],dpi:[442.4,441.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"OnePlus/*/ONE E1005/*"},{ua:"ONE E1005"}],dpi:[442.4,441.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"OnePlus/*/ONE A2001/*"},{ua:"ONE A2001"}],dpi:[391.9,405.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"OnePlus/*/ONE A2003/*"},{ua:"ONE A2003"}],dpi:[391.9,405.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"OnePlus/*/ONE A2005/*"},{ua:"ONE A2005"}],dpi:[391.9,405.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"OnePlus/*/ONEPLUS A3000/*"},{ua:"ONEPLUS A3000"}],dpi:401,bw:3,ac:500},{type:"android",rules:[{mdmh:"OnePlus/*/ONEPLUS A3003/*"},{ua:"ONEPLUS A3003"}],dpi:401,bw:3,ac:500},{type:"android",rules:[{mdmh:"OnePlus/*/ONEPLUS A3010/*"},{ua:"ONEPLUS A3010"}],dpi:401,bw:3,ac:500},{type:"android",rules:[{mdmh:"OnePlus/*/ONEPLUS A5000/*"},{ua:"ONEPLUS A5000 "}],dpi:[403.411,399.737],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"OnePlus/*/ONE A5010/*"},{ua:"ONEPLUS A5010"}],dpi:[403,400],bw:2,ac:1e3},{type:"android",rules:[{mdmh:"OnePlus/*/ONEPLUS A6000/*"},{ua:"ONEPLUS A6000"}],dpi:401,bw:3,ac:500},{type:"android",rules:[{mdmh:"OnePlus/*/ONEPLUS A6003/*"},{ua:"ONEPLUS A6003"}],dpi:401,bw:3,ac:500},{type:"android",rules:[{mdmh:"OnePlus/*/ONEPLUS A6010/*"},{ua:"ONEPLUS A6010"}],dpi:401,bw:2,ac:500},{type:"android",rules:[{mdmh:"OnePlus/*/ONEPLUS A6013/*"},{ua:"ONEPLUS A6013"}],dpi:401,bw:2,ac:500},{type:"android",rules:[{mdmh:"OPPO/*/X909/*"},{ua:"X909"}],dpi:[442.4,444.1],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-I9082/*"},{ua:"GT-I9082"}],dpi:[184.7,185.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G360P/*"},{ua:"SM-G360P"}],dpi:[196.7,205.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/Nexus S/*"},{ua:"Nexus S"}],dpi:[234.5,229.8],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-I9300/*"},{ua:"GT-I9300"}],dpi:[304.8,303.9],bw:5,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-T230NU/*"},{ua:"SM-T230NU"}],dpi:216,bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SGH-T399/*"},{ua:"SGH-T399"}],dpi:[217.7,231.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SGH-M919/*"},{ua:"SGH-M919"}],dpi:[440.8,437.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-N9005/*"},{ua:"SM-N9005"}],dpi:[386.4,387],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SAMSUNG-SM-N900A/*"},{ua:"SAMSUNG-SM-N900A"}],dpi:[386.4,387.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-I9500/*"},{ua:"GT-I9500"}],dpi:[442.5,443.3],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/GT-I9505/*"},{ua:"GT-I9505"}],dpi:439.4,bw:4,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G900F/*"},{ua:"SM-G900F"}],dpi:[415.6,431.6],bw:5,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G900M/*"},{ua:"SM-G900M"}],dpi:[415.6,431.6],bw:5,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G800F/*"},{ua:"SM-G800F"}],dpi:326.8,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G906S/*"},{ua:"SM-G906S"}],dpi:[562.7,572.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-I9300/*"},{ua:"GT-I9300"}],dpi:[306.7,304.8],bw:5,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-T535/*"},{ua:"SM-T535"}],dpi:[142.6,136.4],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-N920C/*"},{ua:"SM-N920C"}],dpi:[515.1,518.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-N920P/*"},{ua:"SM-N920P"}],dpi:[386.3655,390.144],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-N920W8/*"},{ua:"SM-N920W8"}],dpi:[515.1,518.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-I9300I/*"},{ua:"GT-I9300I"}],dpi:[304.8,305.8],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-I9195/*"},{ua:"GT-I9195"}],dpi:[249.4,256.7],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SPH-L520/*"},{ua:"SPH-L520"}],dpi:[249.4,255.9],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SAMSUNG-SGH-I717/*"},{ua:"SAMSUNG-SGH-I717"}],dpi:285.8,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SPH-D710/*"},{ua:"SPH-D710"}],dpi:[217.7,204.2],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-N7100/*"},{ua:"GT-N7100"}],dpi:265.1,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SCH-I605/*"},{ua:"SCH-I605"}],dpi:265.1,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/Galaxy Nexus/*"},{ua:"Galaxy Nexus"}],dpi:[315.3,314.2],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-N910H/*"},{ua:"SM-N910H"}],dpi:[515.1,518],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-N910C/*"},{ua:"SM-N910C"}],dpi:[515.2,520.2],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G130M/*"},{ua:"SM-G130M"}],dpi:[165.9,164.8],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G928I/*"},{ua:"SM-G928I"}],dpi:[515.1,518.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G920F/*"},{ua:"SM-G920F"}],dpi:580.6,bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G920P/*"},{ua:"SM-G920P"}],dpi:[522.5,577],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G925F/*"},{ua:"SM-G925F"}],dpi:580.6,bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G925V/*"},{ua:"SM-G925V"}],dpi:[522.5,576.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G930F/*"},{ua:"SM-G930F"}],dpi:576.6,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G935F/*"},{ua:"SM-G935F"}],dpi:533,bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G950F/*"},{ua:"SM-G950F"}],dpi:[562.707,565.293],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G955U/*"},{ua:"SM-G955U"}],dpi:[522.514,525.762],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G955F/*"},{ua:"SM-G955F"}],dpi:[522.514,525.762],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G960F/*"},{ua:"SM-G960F"}],dpi:[569.575,571.5],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G9600/*"},{ua:"SM-G9600"}],dpi:[569.575,571.5],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G960T/*"},{ua:"SM-G960T"}],dpi:[569.575,571.5],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G960N/*"},{ua:"SM-G960N"}],dpi:[569.575,571.5],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G960U/*"},{ua:"SM-G960U"}],dpi:[569.575,571.5],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G9608/*"},{ua:"SM-G9608"}],dpi:[569.575,571.5],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G960FD/*"},{ua:"SM-G960FD"}],dpi:[569.575,571.5],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G960W/*"},{ua:"SM-G960W"}],dpi:[569.575,571.5],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G965F/*"},{ua:"SM-G965F"}],dpi:529,bw:2,ac:1e3},{type:"android",rules:[{mdmh:"Sony/*/C6903/*"},{ua:"C6903"}],dpi:[442.5,443.3],bw:3,ac:500},{type:"android",rules:[{mdmh:"Sony/*/D6653/*"},{ua:"D6653"}],dpi:[428.6,427.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Sony/*/E6653/*"},{ua:"E6653"}],dpi:[428.6,425.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Sony/*/E6853/*"},{ua:"E6853"}],dpi:[403.4,401.9],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Sony/*/SGP321/*"},{ua:"SGP321"}],dpi:[224.7,224.1],bw:3,ac:500},{type:"android",rules:[{mdmh:"TCT/*/ALCATEL ONE TOUCH Fierce/*"},{ua:"ALCATEL ONE TOUCH Fierce"}],dpi:[240,247.5],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"THL/*/thl 5000/*"},{ua:"thl 5000"}],dpi:[480,443.3],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Fly/*/IQ4412/*"},{ua:"IQ4412"}],dpi:307.9,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"ZTE/*/ZTE Blade L2/*"},{ua:"ZTE Blade L2"}],dpi:240,bw:3,ac:500},{type:"android",rules:[{mdmh:"BENEVE/*/VR518/*"},{ua:"VR518"}],dpi:480,bw:3,ac:500},{type:"ios",rules:[{res:[640,960]}],dpi:[325.1,328.4],bw:4,ac:1e3},{type:"ios",rules:[{res:[640,1136]}],dpi:[317.1,320.2],bw:3,ac:1e3},{type:"ios",rules:[{res:[750,1334]}],dpi:326.4,bw:4,ac:1e3},{type:"ios",rules:[{res:[1242,2208]}],dpi:[453.6,458.4],bw:4,ac:1e3},{type:"ios",rules:[{res:[1125,2001]}],dpi:[410.9,415.4],bw:4,ac:1e3},{type:"ios",rules:[{res:[1125,2436]}],dpi:458,bw:4,ac:1e3},{type:"android",rules:[{mdmh:"Huawei/*/EML-L29/*"},{ua:"EML-L29"}],dpi:428,bw:3.45,ac:500},{type:"android",rules:[{mdmh:"Nokia/*/Nokia 7.1/*"},{ua:"Nokia 7.1"}],dpi:[432,431.9],bw:3,ac:500},{type:"ios",rules:[{res:[1242,2688]}],dpi:458,bw:4,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G570M/*"},{ua:"SM-G570M"}],dpi:320,bw:3.684,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G970F/*"},{ua:"SM-G970F"}],dpi:438,bw:2.281,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G973F/*"},{ua:"SM-G973F"}],dpi:550,bw:2.002,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G975F/*"},{ua:"SM-G975F"}],dpi:522,bw:2.054,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G977F/*"},{ua:"SM-G977F"}],dpi:505,bw:2.334,ac:500},{type:"ios",rules:[{res:[828,1792]}],dpi:326,bw:5,ac:500}],ue={format:1,last_updated:"2019-11-09T17:36:14Z",devices:de};o.prototype.getDeviceParams=function(){return this.deviceParams},o.prototype.recalculateDeviceParams_=function(){var e=this.calcDeviceParams_();e?(this.deviceParams=e,this.onDeviceParamsUpdated&&this.onDeviceParamsUpdated(this.deviceParams)):console.error("Failed to recalculate device parameters.")},o.prototype.calcDeviceParams_=function(){var e=this.dpdb;if(!e)return console.error("DPDB not available."),null;if(1!=e.format)return console.error("DPDB has unexpected format version."),null;if(!e.devices||!e.devices.length)return console.error("DPDB does not have a devices section."),null;var t=navigator.userAgent||navigator.vendor||window.opera,i=P(),r=N();if(!e.devices)return console.error("DPDB has no devices section."),null;for(var n=0;n<e.devices.length;n++){var a=e.devices[n];if(a.rules)if("ios"==a.type||"android"==a.type){if(M()==("ios"==a.type)){for(var s=!1,A=0;A<a.rules.length;A++){var o=a.rules[A];if(this.ruleMatches_(o,t,i,r)){s=!0;break}}if(s){var c=a.dpi[0]||a.dpi,h=a.dpi[1]||a.dpi;return new l({xdpi:c,ydpi:h,bevelMm:a.bw})}}}else console.warn("Device["+n+"] has invalid type.");else console.warn("Device["+n+"] has no rules section.")}return console.warn("No DPDB device match."),null},o.prototype.ruleMatches_=function(e,t,i,r){if(!e.ua&&!e.res)return!1;if(e.ua&&"SM"===e.ua.substring(0,2)&&(e.ua=e.ua.substring(0,7)),e.ua&&t.indexOf(e.ua)<0)return!1;if(e.res){if(!e.res[0]||!e.res[1])return!1;var n=e.res[0],a=e.res[1];if(Math.min(i,r)!=Math.min(n,a)||Math.max(i,r)!=Math.max(n,a))return!1}return!0},c.prototype.set=function(e,t){this.sample=e,this.timestampS=t},c.prototype.copy=function(e){this.set(e.sample,e.timestampS)},h.prototype.addAccelMeasurement=function(e,t){this.currentAccelMeasurement.set(e,t)},h.prototype.addGyroMeasurement=function(e,t){this.currentGyroMeasurement.set(e,t);var i=t-this.previousGyroMeasurement.timestampS;L(i)&&this.run_(),this.previousGyroMeasurement.copy(this.currentGyroMeasurement)},h.prototype.run_=function(){if(!this.isOrientationInitialized)return this.accelQ=this.accelToQuaternion_(this.currentAccelMeasurement.sample),this.previousFilterQ.copy(this.accelQ),void(this.isOrientationInitialized=!0);var e=this.currentGyroMeasurement.timestampS-this.previousGyroMeasurement.timestampS,t=this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample,e);this.gyroIntegralQ.multiply(t),this.filterQ.copy(this.previousFilterQ),this.filterQ.multiply(t);var i=new oe;i.copy(this.filterQ),i.inverse(),this.estimatedGravity.set(0,0,-1),this.estimatedGravity.applyQuaternion(i),this.estimatedGravity.normalize(),this.measuredGravity.copy(this.currentAccelMeasurement.sample),this.measuredGravity.normalize();var r=new oe;r.setFromUnitVectors(this.estimatedGravity,this.measuredGravity),r.inverse(),this.isDebug&&console.log("Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)",se*j(r),this.estimatedGravity.x.toFixed(1),this.estimatedGravity.y.toFixed(1),this.estimatedGravity.z.toFixed(1),this.measuredGravity.x.toFixed(1),this.measuredGravity.y.toFixed(1),this.measuredGravity.z.toFixed(1));var n=new oe;n.copy(this.filterQ),n.multiply(r),this.filterQ.slerp(n,1-this.kFilter),this.previousFilterQ.copy(this.filterQ)},h.prototype.getOrientation=function(){return this.filterQ},h.prototype.accelToQuaternion_=function(e){var t=new Ae;t.copy(e),t.normalize();var i=new oe;return i.setFromUnitVectors(new Ae(0,0,-1),t),i.inverse(),i},h.prototype.gyroToQuaternionDelta_=function(e,t){var i=new oe,r=new Ae;return r.copy(e),r.normalize(),i.setFromAxisAngle(r,e.length()*t),i},d.prototype.getPrediction=function(e,t,i){if(!this.previousTimestampS)return this.previousQ.copy(e),this.previousTimestampS=i,e;var r=new Ae;r.copy(t),r.normalize();var n=t.length();if(n<20*ae)return this.isDebug&&console.log("Moving slowly, at %s deg/s: no prediction",(se*n).toFixed(1)),this.outQ.copy(e),this.previousQ.copy(e),this.outQ;var a=n*this.predictionTimeS;return this.deltaQ.setFromAxisAngle(r,a),this.outQ.copy(this.previousQ),this.outQ.multiply(this.deltaQ),this.previousQ.copy(e),this.previousTimestampS=i,this.outQ},u.prototype.getPosition=function(){return null},u.prototype.getOrientation=function(){var e=void 0;if(this.isWithoutDeviceMotion&&this._deviceOrientationQ){this.deviceOrientationFixQ=this.deviceOrientationFixQ||function(){var e=(new oe).setFromAxisAngle(new Ae(0,0,-1),0),t=new oe;return-90===window.orientation?t.setFromAxisAngle(new Ae(0,1,0),Math.PI/-2):t.setFromAxisAngle(new Ae(0,1,0),Math.PI/2),e.multiply(t)}(),this.deviceOrientationFilterToWorldQ=this.deviceOrientationFilterToWorldQ||function(){var e=new oe;return e.setFromAxisAngle(new Ae(1,0,0),-Math.PI/2),e}(),e=this._deviceOrientationQ;var t=new oe;return t.copy(e),t.multiply(this.deviceOrientationFilterToWorldQ),t.multiply(this.resetQ),t.multiply(this.worldToScreenQ),t.multiplyQuaternions(this.deviceOrientationFixQ,t),this.yawOnly&&(t.x=0,t.z=0,t.normalize()),this.orientationOut_[0]=t.x,this.orientationOut_[1]=t.y,this.orientationOut_[2]=t.z,this.orientationOut_[3]=t.w,this.orientationOut_}var i=this.filter.getOrientation();e=this.posePredictor.getPrediction(i,this.gyroscope,this.previousTimestampS);var t=new oe;return t.copy(this.filterToWorldQ),t.multiply(this.resetQ),t.multiply(e),t.multiply(this.worldToScreenQ),this.yawOnly&&(t.x=0,t.z=0,t.normalize()),this.orientationOut_[0]=t.x,this.orientationOut_[1]=t.y,this.orientationOut_[2]=t.z,this.orientationOut_[3]=t.w,this.orientationOut_},u.prototype.resetPose=function(){this.resetQ.copy(this.filter.getOrientation()),this.resetQ.x=0,this.resetQ.y=0,this.resetQ.z*=-1,this.resetQ.normalize(),x()&&this.resetQ.multiply(this.inverseWorldToScreenQ),this.resetQ.multiply(this.originalPoseAdjustQ)},u.prototype.onDeviceOrientation_=function(e){this._deviceOrientationQ=this._deviceOrientationQ||new oe;var t=e.alpha,i=e.beta,r=e.gamma;t=(t||0)*Math.PI/180,i=(i||0)*Math.PI/180,r=(r||0)*Math.PI/180,this._deviceOrientationQ.setFromEulerYXZ(i,t,-r)},u.prototype.onDeviceMotion_=function(e){this.updateDeviceMotion_(e)},u.prototype.updateDeviceMotion_=function(e){var t=e.accelerationIncludingGravity,i=e.rotationRate,r=e.timeStamp/1e3,n=r-this.previousTimestampS;return n<0?(K("fusion-pose-sensor:invalid:non-monotonic","Invalid timestamps detected: non-monotonic timestamp from devicemotion"),void(this.previousTimestampS=r)):n<=.001||n>1?(K("fusion-pose-sensor:invalid:outside-threshold","Invalid timestamps detected: Timestamp from devicemotion outside expected range."),void(this.previousTimestampS=r)):(this.accelerometer.set(-t.x,-t.y,-t.z),i&&(I()?this.gyroscope.set(-i.beta,i.alpha,i.gamma):this.gyroscope.set(i.alpha,i.beta,i.gamma),this.isDeviceMotionInRadians||this.gyroscope.multiplyScalar(Math.PI/180),this.filter.addGyroMeasurement(this.gyroscope,r)),this.filter.addAccelMeasurement(this.accelerometer,r),void(this.previousTimestampS=r))},u.prototype.onOrientationChange_=function(e){this.setScreenTransform_()},u.prototype.onMessage_=function(e){var t=e.data;if(t&&t.type){"devicemotion"===t.type.toLowerCase()&&this.updateDeviceMotion_(t.deviceMotionEvent)}},u.prototype.setScreenTransform_=function(){switch(this.worldToScreenQ.set(0,0,0,1),window.orientation){case 0:break;case 90:this.worldToScreenQ.setFromAxisAngle(new Ae(0,0,1),-Math.PI/2);break;case-90:this.worldToScreenQ.setFromAxisAngle(new Ae(0,0,1),Math.PI/2)}this.inverseWorldToScreenQ.copy(this.worldToScreenQ),this.inverseWorldToScreenQ.inverse()},u.prototype.start=function(){this.onDeviceMotionCallback_=this.onDeviceMotion_.bind(this),this.onOrientationChangeCallback_=this.onOrientationChange_.bind(this),this.onMessageCallback_=this.onMessage_.bind(this),this.onDeviceOrientationCallback_=this.onDeviceOrientation_.bind(this),M()&&Y()&&window.addEventListener("message",this.onMessageCallback_),window.addEventListener("orientationchange",this.onOrientationChangeCallback_),this.isWithoutDeviceMotion?window.addEventListener("deviceorientation",this.onDeviceOrientationCallback_):window.addEventListener("devicemotion",this.onDeviceMotionCallback_)},u.prototype.stop=function(){window.removeEventListener("devicemotion",this.onDeviceMotionCallback_),window.removeEventListener("deviceorientation",this.onDeviceOrientationCallback_),window.removeEventListener("orientationchange",this.onOrientationChangeCallback_),window.removeEventListener("message",this.onMessageCallback_)};var pe=new Ae(1,0,0),fe=new Ae(0,0,1),me=new oe;me.setFromAxisAngle(pe,-Math.PI/2),me.multiply((new oe).setFromAxisAngle(fe,Math.PI/2));var ge=function(){function e(t){y(this,e),this.config=t,this.sensor=null,this.fusionSensor=null,this._out=new Float32Array(4),this.api=null,this.errors=[],this._sensorQ=new oe,this._outQ=new oe,this._onSensorRead=this._onSensorRead.bind(this),this._onSensorError=this._onSensorError.bind(this),this.init()}return E(e,[{key:"init",value:function(){var e=null;try{e=new RelativeOrientationSensor({frequency:60,referenceFrame:"screen"}),e.addEventListener("error",this._onSensorError)}catch(e){this.errors.push(e),"SecurityError"===e.name?(console.error("Cannot construct sensors due to the Feature Policy"),console.warn('Attempting to fall back using "devicemotion"; however this will fail in the future without correct permissions.'),this.useDeviceMotion()):"ReferenceError"===e.name?this.useDeviceMotion():console.error(e)}e&&(this.api="sensor",this.sensor=e,
  1152. this.sensor.addEventListener("reading",this._onSensorRead),this.sensor.start())}},{key:"useDeviceMotion",value:function(){this.api="devicemotion",this.fusionSensor=new u(this.config.K_FILTER,this.config.PREDICTION_TIME_S,this.config.YAW_ONLY,this.config.DEBUG),this.sensor&&(this.sensor.removeEventListener("reading",this._onSensorRead),this.sensor.removeEventListener("error",this._onSensorError),this.sensor=null)}},{key:"getOrientation",value:function(){if(this.fusionSensor)return this.fusionSensor.getOrientation();if(!this.sensor||!this.sensor.quaternion)return this._out[0]=this._out[1]=this._out[2]=0,this._out[3]=1,this._out;var e=this.sensor.quaternion;this._sensorQ.set(e[0],e[1],e[2],e[3]);var t=this._outQ;return t.copy(me),t.multiply(this._sensorQ),this.config.YAW_ONLY&&(t.x=t.z=0,t.normalize()),this._out[0]=t.x,this._out[1]=t.y,this._out[2]=t.z,this._out[3]=t.w,this._out}},{key:"_onSensorError",value:function(e){this.errors.push(e.error),"NotAllowedError"===e.error.name?console.error("Permission to access sensor was denied"):"NotReadableError"===e.error.name?console.error("Sensor could not be read"):console.error(e.error),this.useDeviceMotion()}},{key:"_onSensorRead",value:function(){}}]),e}();p.prototype.show=function(e){e||this.overlay.parentElement?e&&(this.overlay.parentElement&&this.overlay.parentElement!=e&&this.overlay.parentElement.removeChild(this.overlay),e.appendChild(this.overlay)):document.body.appendChild(this.overlay),this.overlay.style.display="block";var t=this.overlay.querySelector("img"),i=t.style;x()?(i.width="20%",i.marginLeft="40%",i.marginTop="3%"):(i.width="50%",i.marginLeft="25%",i.marginTop="25%")},p.prototype.hide=function(){this.overlay.style.display="none"},p.prototype.showTemporarily=function(e,t){this.show(t),this.timer=setTimeout(this.hide.bind(this),e)},p.prototype.disableShowTemporarily=function(){clearTimeout(this.timer)},p.prototype.update=function(){this.disableShowTemporarily(),!x()&&z()?this.show():this.hide()},p.prototype.loadIcon_=function(){this.icon=_("image/svg+xml","<svg width='198' height='240' viewBox='0 0 198 240' xmlns='http://www.w3.org/2000/svg'><g fill='none' fill-rule='evenodd'><path d='M149.625 109.527l6.737 3.891v.886c0 .177.013.36.038.549.01.081.02.162.027.242.14 1.415.974 2.998 2.105 3.999l5.72 5.062.081-.09s4.382-2.53 5.235-3.024l25.97 14.993v54.001c0 .771-.386 1.217-.948 1.217-.233 0-.495-.076-.772-.236l-23.967-13.838-.014.024-27.322 15.775-.85-1.323c-4.731-1.529-9.748-2.74-14.951-3.61a.27.27 0 0 0-.007.024l-5.067 16.961-7.891 4.556-.037-.063v27.59c0 .772-.386 1.217-.948 1.217-.232 0-.495-.076-.772-.236l-42.473-24.522c-.95-.549-1.72-1.877-1.72-2.967v-1.035l-.021.047a5.111 5.111 0 0 0-1.816-.399 5.682 5.682 0 0 0-.546.001 13.724 13.724 0 0 1-1.918-.041c-1.655-.153-3.2-.6-4.404-1.296l-46.576-26.89.005.012-10.278-18.75c-1.001-1.827-.241-4.216 1.698-5.336l56.011-32.345a4.194 4.194 0 0 1 2.099-.572c1.326 0 2.572.659 3.227 1.853l.005-.003.227.413-.006.004a9.63 9.63 0 0 0 1.477 2.018l.277.27c1.914 1.85 4.468 2.801 7.113 2.801 1.949 0 3.948-.517 5.775-1.572.013 0 7.319-4.219 7.319-4.219a4.194 4.194 0 0 1 2.099-.572c1.326 0 2.572.658 3.226 1.853l3.25 5.928.022-.018 6.785 3.917-.105-.182 46.881-26.965m0-1.635c-.282 0-.563.073-.815.218l-46.169 26.556-5.41-3.124-3.005-5.481c-.913-1.667-2.699-2.702-4.66-2.703-1.011 0-2.02.274-2.917.792a3825 3825 0 0 1-7.275 4.195l-.044.024a9.937 9.937 0 0 1-4.957 1.353c-2.292 0-4.414-.832-5.976-2.342l-.252-.245a7.992 7.992 0 0 1-1.139-1.534 1.379 1.379 0 0 0-.06-.122l-.227-.414a1.718 1.718 0 0 0-.095-.154c-.938-1.574-2.673-2.545-4.571-2.545-1.011 0-2.02.274-2.917.792L3.125 155.502c-2.699 1.559-3.738 4.94-2.314 7.538l10.278 18.75c.177.323.448.563.761.704l46.426 26.804c1.403.81 3.157 1.332 5.072 1.508a15.661 15.661 0 0 0 2.146.046 4.766 4.766 0 0 1 .396 0c.096.004.19.011.283.022.109 1.593 1.159 3.323 2.529 4.114l42.472 24.522c.524.302 1.058.455 1.59.455 1.497 0 2.583-1.2 2.583-2.852v-26.562l7.111-4.105a1.64 1.64 0 0 0 .749-.948l4.658-15.593c4.414.797 8.692 1.848 12.742 3.128l.533.829a1.634 1.634 0 0 0 2.193.531l26.532-15.317L193 192.433c.523.302 1.058.455 1.59.455 1.497 0 2.583-1.199 2.583-2.852v-54.001c0-.584-.312-1.124-.818-1.416l-25.97-14.993a1.633 1.633 0 0 0-1.636.001c-.606.351-2.993 1.73-4.325 2.498l-4.809-4.255c-.819-.725-1.461-1.933-1.561-2.936a7.776 7.776 0 0 0-.033-.294 2.487 2.487 0 0 1-.023-.336v-.886c0-.584-.312-1.123-.817-1.416l-6.739-3.891a1.633 1.633 0 0 0-.817-.219' fill='#455A64'/><path d='M96.027 132.636l46.576 26.891c1.204.695 1.979 1.587 2.242 2.541l-.01.007-81.374 46.982h-.001c-1.654-.152-3.199-.6-4.403-1.295l-46.576-26.891 83.546-48.235' fill='#FAFAFA'/><path d='M63.461 209.174c-.008 0-.015 0-.022-.002-1.693-.156-3.228-.609-4.441-1.309l-46.576-26.89a.118.118 0 0 1 0-.203l83.546-48.235a.117.117 0 0 1 .117 0l46.576 26.891c1.227.708 2.021 1.612 2.296 2.611a.116.116 0 0 1-.042.124l-.021.016-81.375 46.981a.11.11 0 0 1-.058.016zm-50.747-28.303l46.401 26.79c1.178.68 2.671 1.121 4.32 1.276l81.272-46.922c-.279-.907-1.025-1.73-2.163-2.387l-46.517-26.857-83.313 48.1z' fill='#607D8B'/><path d='M148.327 165.471a5.85 5.85 0 0 1-.546.001c-1.894-.083-3.302-1.038-3.145-2.132a2.693 2.693 0 0 0-.072-1.105l-81.103 46.822c.628.058 1.272.073 1.918.042.182-.009.364-.009.546-.001 1.894.083 3.302 1.038 3.145 2.132l79.257-45.759' fill='#FFF'/><path d='M69.07 211.347a.118.118 0 0 1-.115-.134c.045-.317-.057-.637-.297-.925-.505-.61-1.555-1.022-2.738-1.074a5.966 5.966 0 0 0-.535.001 14.03 14.03 0 0 1-1.935-.041.117.117 0 0 1-.103-.092.116.116 0 0 1 .055-.126l81.104-46.822a.117.117 0 0 1 .171.07c.104.381.129.768.074 1.153-.045.316.057.637.296.925.506.61 1.555 1.021 2.739 1.073.178.008.357.008.535-.001a.117.117 0 0 1 .064.218l-79.256 45.759a.114.114 0 0 1-.059.016zm-3.405-2.372c.089 0 .177.002.265.006 1.266.056 2.353.488 2.908 1.158.227.274.35.575.36.882l78.685-45.429c-.036 0-.072-.001-.107-.003-1.267-.056-2.354-.489-2.909-1.158-.282-.34-.402-.724-.347-1.107a2.604 2.604 0 0 0-.032-.91L63.846 208.97a13.91 13.91 0 0 0 1.528.012c.097-.005.194-.007.291-.007z' fill='#607D8B'/><path d='M2.208 162.134c-1.001-1.827-.241-4.217 1.698-5.337l56.011-32.344c1.939-1.12 4.324-.546 5.326 1.281l.232.41a9.344 9.344 0 0 0 1.47 2.021l.278.27c3.325 3.214 8.583 3.716 12.888 1.23l7.319-4.22c1.94-1.119 4.324-.546 5.325 1.282l3.25 5.928-83.519 48.229-10.278-18.75z' fill='#FAFAFA'/><path d='M12.486 181.001a.112.112 0 0 1-.031-.005.114.114 0 0 1-.071-.056L2.106 162.19c-1.031-1.88-.249-4.345 1.742-5.494l56.01-32.344a4.328 4.328 0 0 1 2.158-.588c1.415 0 2.65.702 3.311 1.882.01.008.018.017.024.028l.227.414a.122.122 0 0 1 .013.038 9.508 9.508 0 0 0 1.439 1.959l.275.266c1.846 1.786 4.344 2.769 7.031 2.769 1.977 0 3.954-.538 5.717-1.557a.148.148 0 0 1 .035-.013l7.284-4.206a4.321 4.321 0 0 1 2.157-.588c1.427 0 2.672.716 3.329 1.914l3.249 5.929a.116.116 0 0 1-.044.157l-83.518 48.229a.116.116 0 0 1-.059.016zm49.53-57.004c-.704 0-1.41.193-2.041.557l-56.01 32.345c-1.882 1.086-2.624 3.409-1.655 5.179l10.221 18.645 83.317-48.112-3.195-5.829c-.615-1.122-1.783-1.792-3.124-1.792a4.08 4.08 0 0 0-2.04.557l-7.317 4.225a.148.148 0 0 1-.035.013 11.7 11.7 0 0 1-5.801 1.569c-2.748 0-5.303-1.007-7.194-2.835l-.278-.27a9.716 9.716 0 0 1-1.497-2.046.096.096 0 0 1-.013-.037l-.191-.347a.11.11 0 0 1-.023-.029c-.615-1.123-1.783-1.793-3.124-1.793z' fill='#607D8B'/><path d='M42.434 155.808c-2.51-.001-4.697-1.258-5.852-3.365-1.811-3.304-.438-7.634 3.059-9.654l12.291-7.098a7.599 7.599 0 0 1 3.789-1.033c2.51 0 4.697 1.258 5.852 3.365 1.811 3.304.439 7.634-3.059 9.654l-12.291 7.098a7.606 7.606 0 0 1-3.789 1.033zm13.287-20.683a7.128 7.128 0 0 0-3.555.971l-12.291 7.098c-3.279 1.893-4.573 5.942-2.883 9.024 1.071 1.955 3.106 3.122 5.442 3.122a7.13 7.13 0 0 0 3.556-.97l12.291-7.098c3.279-1.893 4.572-5.942 2.883-9.024-1.072-1.955-3.106-3.123-5.443-3.123z' fill='#607D8B'/><path d='M149.588 109.407l6.737 3.89v.887c0 .176.013.36.037.549.011.081.02.161.028.242.14 1.415.973 2.998 2.105 3.999l7.396 6.545c.177.156.358.295.541.415 1.579 1.04 2.95.466 3.062-1.282.049-.784.057-1.595.023-2.429l-.003-.16v-1.151l25.987 15.003v54c0 1.09-.77 1.53-1.72.982l-42.473-24.523c-.95-.548-1.72-1.877-1.72-2.966v-34.033' fill='#FAFAFA'/><path d='M194.553 191.25c-.257 0-.54-.085-.831-.253l-42.472-24.521c-.981-.567-1.779-1.943-1.779-3.068v-34.033h.234v34.033c0 1.051.745 2.336 1.661 2.866l42.473 24.521c.424.245.816.288 1.103.122.285-.164.442-.52.442-1.002v-53.933l-25.753-14.868.003 1.106c.034.832.026 1.654-.024 2.439-.054.844-.396 1.464-.963 1.746-.619.309-1.45.173-2.28-.373a5.023 5.023 0 0 1-.553-.426l-7.397-6.544c-1.158-1.026-1.999-2.625-2.143-4.076a9.624 9.624 0 0 0-.027-.238 4.241 4.241 0 0 1-.038-.564v-.82l-6.68-3.856.117-.202 6.738 3.89.058.034v.954c0 .171.012.351.036.533.011.083.021.165.029.246.138 1.395.948 2.935 2.065 3.923l7.397 6.545c.173.153.35.289.527.406.758.499 1.504.63 2.047.359.49-.243.786-.795.834-1.551.05-.778.057-1.591.024-2.417l-.004-.163v-1.355l.175.1 25.987 15.004.059.033v54.068c0 .569-.198.996-.559 1.204a1.002 1.002 0 0 1-.506.131' fill='#607D8B'/><path d='M145.685 163.161l24.115 13.922-25.978 14.998-1.462-.307c-6.534-2.17-13.628-3.728-21.019-4.616-4.365-.524-8.663 1.096-9.598 3.62a2.746 2.746 0 0 0-.011 1.928c1.538 4.267 4.236 8.363 7.995 12.135l.532.845-25.977 14.997-24.115-13.922 75.518-43.6' fill='#FFF'/><path d='M94.282 220.818l-.059-.033-24.29-14.024.175-.101 75.577-43.634.058.033 24.29 14.024-26.191 15.122-.045-.01-1.461-.307c-6.549-2.174-13.613-3.725-21.009-4.614a13.744 13.744 0 0 0-1.638-.097c-3.758 0-7.054 1.531-7.837 3.642a2.62 2.62 0 0 0-.01 1.848c1.535 4.258 4.216 8.326 7.968 12.091l.016.021.526.835.006.01.064.102-.105.061-25.977 14.998-.058.033zm-23.881-14.057l23.881 13.788 24.802-14.32c.546-.315.846-.489 1.017-.575l-.466-.74c-3.771-3.787-6.467-7.881-8.013-12.168a2.851 2.851 0 0 1 .011-2.008c.815-2.199 4.203-3.795 8.056-3.795.557 0 1.117.033 1.666.099 7.412.891 14.491 2.445 21.041 4.621.836.175 1.215.254 1.39.304l25.78-14.884-23.881-13.788-75.284 43.466z' fill='#607D8B'/><path d='M167.23 125.979v50.871l-27.321 15.773-6.461-14.167c-.91-1.996-3.428-1.738-5.624.574a10.238 10.238 0 0 0-2.33 4.018l-6.46 21.628-27.322 15.774v-50.871l75.518-43.6' fill='#FFF'/><path d='M91.712 220.567a.127.127 0 0 1-.059-.016.118.118 0 0 1-.058-.101v-50.871c0-.042.023-.08.058-.101l75.519-43.6a.117.117 0 0 1 .175.101v50.871c0 .041-.023.08-.059.1l-27.321 15.775a.118.118 0 0 1-.094.01.12.12 0 0 1-.071-.063l-6.46-14.168c-.375-.822-1.062-1.275-1.934-1.275-1.089 0-2.364.686-3.5 1.881a10.206 10.206 0 0 0-2.302 3.972l-6.46 21.627a.118.118 0 0 1-.054.068L91.77 220.551a.12.12 0 0 1-.058.016zm.117-50.92v50.601l27.106-15.65 6.447-21.583a10.286 10.286 0 0 1 2.357-4.065c1.18-1.242 2.517-1.954 3.669-1.954.969 0 1.731.501 2.146 1.411l6.407 14.051 27.152-15.676v-50.601l-75.284 43.466z' fill='#607D8B'/><path d='M168.543 126.213v50.87l-27.322 15.774-6.46-14.168c-.91-1.995-3.428-1.738-5.624.574a10.248 10.248 0 0 0-2.33 4.019l-6.461 21.627-27.321 15.774v-50.87l75.518-43.6' fill='#FFF'/><path d='M93.025 220.8a.123.123 0 0 1-.059-.015.12.12 0 0 1-.058-.101v-50.871c0-.042.023-.08.058-.101l75.518-43.6a.112.112 0 0 1 .117 0c.036.02.059.059.059.1v50.871a.116.116 0 0 1-.059.101l-27.321 15.774a.111.111 0 0 1-.094.01.115.115 0 0 1-.071-.062l-6.46-14.168c-.375-.823-1.062-1.275-1.935-1.275-1.088 0-2.363.685-3.499 1.881a10.19 10.19 0 0 0-2.302 3.971l-6.461 21.628a.108.108 0 0 1-.053.067l-27.322 15.775a.12.12 0 0 1-.058.015zm.117-50.919v50.6l27.106-15.649 6.447-21.584a10.293 10.293 0 0 1 2.357-4.065c1.179-1.241 2.516-1.954 3.668-1.954.969 0 1.732.502 2.147 1.412l6.407 14.051 27.152-15.676v-50.601l-75.284 43.466z' fill='#607D8B'/><path d='M169.8 177.083l-27.322 15.774-6.46-14.168c-.91-1.995-3.428-1.738-5.625.574a10.246 10.246 0 0 0-2.329 4.019l-6.461 21.627-27.321 15.774v-50.87l75.518-43.6v50.87z' fill='#FAFAFA'/><path d='M94.282 220.917a.234.234 0 0 1-.234-.233v-50.871c0-.083.045-.161.117-.202l75.518-43.601a.234.234 0 1 1 .35.202v50.871a.233.233 0 0 1-.116.202l-27.322 15.775a.232.232 0 0 1-.329-.106l-6.461-14.168c-.36-.789-.992-1.206-1.828-1.206-1.056 0-2.301.672-3.415 1.844a10.099 10.099 0 0 0-2.275 3.924l-6.46 21.628a.235.235 0 0 1-.107.136l-27.322 15.774a.23.23 0 0 1-.116.031zm.233-50.969v50.331l26.891-15.525 6.434-21.539a10.41 10.41 0 0 1 2.384-4.112c1.201-1.265 2.569-1.991 3.753-1.991 1.018 0 1.818.526 2.253 1.48l6.354 13.934 26.982-15.578v-50.331l-75.051 43.331z' fill='#607D8B'/><path d='M109.894 199.943c-1.774 0-3.241-.725-4.244-2.12a.224.224 0 0 1 .023-.294.233.233 0 0 1 .301-.023c.78.547 1.705.827 2.75.827 1.323 0 2.754-.439 4.256-1.306 5.311-3.067 9.631-10.518 9.631-16.611 0-1.927-.442-3.56-1.278-4.724a.232.232 0 0 1 .323-.327c1.671 1.172 2.591 3.381 2.591 6.219 0 6.242-4.426 13.863-9.865 17.003-1.574.908-3.084 1.356-4.488 1.356zm-2.969-1.542c.813.651 1.82.877 2.968.877h.001c1.321 0 2.753-.327 4.254-1.194 5.311-3.067 9.632-10.463 9.632-16.556 0-1.979-.463-3.599-1.326-4.761.411 1.035.625 2.275.625 3.635 0 6.243-4.426 13.883-9.865 17.023-1.574.909-3.084 1.317-4.49 1.317-.641 0-1.243-.149-1.799-.341z' fill='#607D8B'/><path d='M113.097 197.23c5.384-3.108 9.748-10.636 9.748-16.814 0-2.051-.483-3.692-1.323-4.86-1.784-1.252-4.374-1.194-7.257.47-5.384 3.108-9.748 10.636-9.748 16.814 0 2.051.483 3.692 1.323 4.86 1.784 1.252 4.374 1.194 7.257-.47' fill='#FAFAFA'/><path d='M108.724 198.614c-1.142 0-2.158-.213-3.019-.817-.021-.014-.04.014-.055-.007-.894-1.244-1.367-2.948-1.367-4.973 0-6.242 4.426-13.864 9.865-17.005 1.574-.908 3.084-1.363 4.49-1.363 1.142 0 2.158.309 3.018.913a.23.23 0 0 1 .056.056c.894 1.244 1.367 2.972 1.367 4.997 0 6.243-4.426 13.783-9.865 16.923-1.574.909-3.084 1.276-4.49 1.276zm-2.718-1.109c.774.532 1.688.776 2.718.776 1.323 0 2.754-.413 4.256-1.28 5.311-3.066 9.631-10.505 9.631-16.598 0-1.909-.434-3.523-1.255-4.685-.774-.533-1.688-.799-2.718-.799-1.323 0-2.755.441-4.256 1.308-5.311 3.066-9.631 10.506-9.631 16.599 0 1.909.434 3.517 1.255 4.679z' fill='#607D8B'/><path d='M149.318 114.262l-9.984 8.878 15.893 11.031 5.589-6.112-11.498-13.797' fill='#FAFAFA'/><path d='M169.676 120.84l-9.748 5.627c-3.642 2.103-9.528 2.113-13.147.024-3.62-2.089-3.601-5.488.041-7.591l9.495-5.608-6.729-3.885-81.836 47.071 45.923 26.514 3.081-1.779c.631-.365.869-.898.618-1.39-2.357-4.632-2.593-9.546-.683-14.262 5.638-13.92 24.509-24.815 48.618-28.07 8.169-1.103 16.68-.967 24.704.394.852.145 1.776.008 2.407-.357l3.081-1.778-25.825-14.91' fill='#FAFAFA'/><path d='M113.675 183.459a.47.47 0 0 1-.233-.062l-45.924-26.515a.468.468 0 0 1 .001-.809l81.836-47.071a.467.467 0 0 1 .466 0l6.729 3.885a.467.467 0 0 1-.467.809l-6.496-3.75-80.9 46.533 44.988 25.973 2.848-1.644c.192-.111.62-.409.435-.773-2.416-4.748-2.658-9.814-.7-14.65 2.806-6.927 8.885-13.242 17.582-18.263 8.657-4.998 19.518-8.489 31.407-10.094 8.198-1.107 16.79-.97 24.844.397.739.125 1.561.007 2.095-.301l2.381-1.374-25.125-14.506a.467.467 0 0 1 .467-.809l25.825 14.91a.467.467 0 0 1 0 .809l-3.081 1.779c-.721.417-1.763.575-2.718.413-7.963-1.351-16.457-1.486-24.563-.392-11.77 1.589-22.512 5.039-31.065 9.977-8.514 4.916-14.456 11.073-17.183 17.805-1.854 4.578-1.623 9.376.666 13.875.37.725.055 1.513-.8 2.006l-3.081 1.78a.476.476 0 0 1-.234.062' fill='#455A64'/><path d='M153.316 128.279c-2.413 0-4.821-.528-6.652-1.586-1.818-1.049-2.82-2.461-2.82-3.975 0-1.527 1.016-2.955 2.861-4.02l9.493-5.607a.233.233 0 1 1 .238.402l-9.496 5.609c-1.696.979-2.628 2.263-2.628 3.616 0 1.34.918 2.608 2.585 3.571 3.549 2.049 9.343 2.038 12.914-.024l9.748-5.628a.234.234 0 0 1 .234.405l-9.748 5.628c-1.858 1.072-4.296 1.609-6.729 1.609' fill='#607D8B'/><path d='M113.675 182.992l-45.913-26.508M113.675 183.342a.346.346 0 0 1-.175-.047l-45.913-26.508a.35.35 0 1 1 .35-.607l45.913 26.508a.35.35 0 0 1-.175.654' fill='#455A64'/><path d='M67.762 156.484v54.001c0 1.09.77 2.418 1.72 2.967l42.473 24.521c.95.549 1.72.11 1.72-.98v-54.001' fill='#FAFAFA'/><path d='M112.727 238.561c-.297 0-.62-.095-.947-.285l-42.473-24.521c-1.063-.613-1.895-2.05-1.895-3.27v-54.001a.35.35 0 1 1 .701 0v54.001c0 .96.707 2.18 1.544 2.663l42.473 24.522c.344.198.661.243.87.122.206-.119.325-.411.325-.799v-54.001a.35.35 0 1 1 .7 0v54.001c0 .655-.239 1.154-.675 1.406a1.235 1.235 0 0 1-.623.162' fill='#455A64'/><path d='M112.86 147.512h-.001c-2.318 0-4.499-.522-6.142-1.471-1.705-.984-2.643-2.315-2.643-3.749 0-1.445.952-2.791 2.68-3.788l12.041-6.953c1.668-.962 3.874-1.493 6.212-1.493 2.318 0 4.499.523 6.143 1.472 1.704.984 2.643 2.315 2.643 3.748 0 1.446-.952 2.791-2.68 3.789l-12.042 6.952c-1.668.963-3.874 1.493-6.211 1.493zm12.147-16.753c-2.217 0-4.298.497-5.861 1.399l-12.042 6.952c-1.502.868-2.33 1.998-2.33 3.182 0 1.173.815 2.289 2.293 3.142 1.538.889 3.596 1.378 5.792 1.378h.001c2.216 0 4.298-.497 5.861-1.399l12.041-6.953c1.502-.867 2.33-1.997 2.33-3.182 0-1.172-.814-2.288-2.292-3.142-1.539-.888-3.596-1.377-5.793-1.377z' fill='#607D8B'/><path d='M165.63 123.219l-5.734 3.311c-3.167 1.828-8.286 1.837-11.433.02-3.147-1.817-3.131-4.772.036-6.601l5.734-3.31 11.397 6.58' fill='#FAFAFA'/><path d='M154.233 117.448l9.995 5.771-4.682 2.704c-1.434.827-3.352 1.283-5.399 1.283-2.029 0-3.923-.449-5.333-1.263-1.29-.744-2-1.694-2-2.674 0-.991.723-1.955 2.036-2.713l5.383-3.108m0-.809l-5.734 3.31c-3.167 1.829-3.183 4.784-.036 6.601 1.568.905 3.623 1.357 5.684 1.357 2.077 0 4.159-.46 5.749-1.377l5.734-3.311-11.397-6.58M145.445 179.667c-1.773 0-3.241-.85-4.243-2.245-.067-.092-.057-.275.023-.356.08-.081.207-.12.3-.055.781.548 1.706.812 2.751.811 1.322 0 2.754-.446 4.256-1.313 5.31-3.066 9.631-10.522 9.631-16.615 0-1.927-.442-3.562-1.279-4.726a.235.235 0 0 1 .024-.301.232.232 0 0 1 .3-.027c1.67 1.172 2.59 3.38 2.59 6.219 0 6.242-4.425 13.987-9.865 17.127-1.573.908-3.083 1.481-4.488 1.481zM142.476 178c.814.651 1.82 1.002 2.969 1.002 1.322 0 2.753-.452 4.255-1.32 5.31-3.065 9.631-10.523 9.631-16.617 0-1.98-.463-3.63-1.325-4.793.411 1.035.624 2.26.624 3.62 0 6.242-4.425 13.875-9.865 17.015-1.573.909-3.084 1.376-4.489 1.376a5.49 5.49 0 0 1-1.8-.283z' fill='#607D8B'/><path d='M148.648 176.704c5.384-3.108 9.748-10.636 9.748-16.813 0-2.052-.483-3.693-1.322-4.861-1.785-1.252-4.375-1.194-7.258.471-5.383 3.108-9.748 10.636-9.748 16.813 0 2.051.484 3.692 1.323 4.86 1.785 1.253 4.374 1.195 7.257-.47' fill='#FAFAFA'/><path d='M144.276 178.276c-1.143 0-2.158-.307-3.019-.911a.217.217 0 0 1-.055-.054c-.895-1.244-1.367-2.972-1.367-4.997 0-6.241 4.425-13.875 9.865-17.016 1.573-.908 3.084-1.369 4.489-1.369 1.143 0 2.158.307 3.019.91a.24.24 0 0 1 .055.055c.894 1.244 1.367 2.971 1.367 4.997 0 6.241-4.425 13.875-9.865 17.016-1.573.908-3.084 1.369-4.489 1.369zm-2.718-1.172c.773.533 1.687.901 2.718.901 1.322 0 2.754-.538 4.256-1.405 5.31-3.066 9.631-10.567 9.631-16.661 0-1.908-.434-3.554-1.256-4.716-.774-.532-1.688-.814-2.718-.814-1.322 0-2.754.433-4.256 1.3-5.31 3.066-9.631 10.564-9.631 16.657 0 1.91.434 3.576 1.256 4.738z' fill='#607D8B'/><path d='M150.72 172.361l-.363-.295a24.105 24.105 0 0 0 2.148-3.128 24.05 24.05 0 0 0 1.977-4.375l.443.149a24.54 24.54 0 0 1-2.015 4.46 24.61 24.61 0 0 1-2.19 3.189M115.917 191.514l-.363-.294a24.174 24.174 0 0 0 2.148-3.128 24.038 24.038 0 0 0 1.976-4.375l.443.148a24.48 24.48 0 0 1-2.015 4.461 24.662 24.662 0 0 1-2.189 3.188M114 237.476V182.584 237.476' fill='#607D8B'/><g><path d='M81.822 37.474c.017-.135-.075-.28-.267-.392-.327-.188-.826-.21-1.109-.045l-6.012 3.471c-.131.076-.194.178-.191.285.002.132.002.461.002.578v.043l-.007.128-6.591 3.779c-.001 0-2.077 1.046-2.787 5.192 0 0-.912 6.961-.898 19.745.015 12.57.606 17.07 1.167 21.351.22 1.684 3.001 2.125 3.001 2.125.331.04.698-.027 1.08-.248l75.273-43.551c1.808-1.069 2.667-3.719 3.056-6.284 1.213-7.99 1.675-32.978-.275-39.878-.196-.693-.51-1.083-.868-1.282l-2.086-.79c-.727.028-1.416.467-1.534.535L82.032 37.072l-.21.402' fill='#FFF'/><path d='M144.311 1.701l2.085.79c.358.199.672.589.868 1.282 1.949 6.9 1.487 31.887.275 39.878-.39 2.565-1.249 5.215-3.056 6.284L69.21 93.486a1.78 1.78 0 0 1-.896.258l-.183-.011c0 .001-2.782-.44-3.003-2.124-.56-4.282-1.151-8.781-1.165-21.351-.015-12.784.897-19.745.897-19.745.71-4.146 2.787-5.192 2.787-5.192l6.591-3.779.007-.128v-.043c0-.117 0-.446-.002-.578-.003-.107.059-.21.191-.285l6.012-3.472a.98.98 0 0 1 .481-.11c.218 0 .449.053.627.156.193.112.285.258.268.392l.211-.402 60.744-34.836c.117-.068.806-.507 1.534-.535m0-.997l-.039.001c-.618.023-1.283.244-1.974.656l-.021.012-60.519 34.706a2.358 2.358 0 0 0-.831-.15c-.365 0-.704.084-.98.244l-6.012 3.471c-.442.255-.699.69-.689 1.166l.001.15-6.08 3.487c-.373.199-2.542 1.531-3.29 5.898l-.006.039c-.009.07-.92 7.173-.906 19.875.014 12.62.603 17.116 1.172 21.465l.002.015c.308 2.355 3.475 2.923 3.836 2.98l.034.004c.101.013.204.019.305.019a2.77 2.77 0 0 0 1.396-.392l75.273-43.552c1.811-1.071 2.999-3.423 3.542-6.997 1.186-7.814 1.734-33.096-.301-40.299-.253-.893-.704-1.527-1.343-1.882l-.132-.062-2.085-.789a.973.973 0 0 0-.353-.065' fill='#455A64'/><path d='M128.267 11.565l1.495.434-56.339 32.326' fill='#FFF'/><path d='M74.202 90.545a.5.5 0 0 1-.25-.931l18.437-10.645a.499.499 0 1 1 .499.864L74.451 90.478l-.249.067M75.764 42.654l-.108-.062.046-.171 5.135-2.964.17.045-.045.171-5.135 2.964-.063.017M70.52 90.375V46.421l.063-.036L137.84 7.554v43.954l-.062.036L70.52 90.375zm.25-43.811v43.38l66.821-38.579V7.985L70.77 46.564z' fill='#607D8B'/><path d='M86.986 83.182c-.23.149-.612.384-.849.523l-11.505 6.701c-.237.139-.206.252.068.252h.565c.275 0 .693-.113.93-.252L87.7 83.705c.237-.139.428-.253.425-.256a11.29 11.29 0 0 1-.006-.503c0-.274-.188-.377-.418-.227l-.715.463' fill='#607D8B'/><path d='M75.266 90.782H74.7c-.2 0-.316-.056-.346-.166-.03-.11.043-.217.215-.317l11.505-6.702c.236-.138.615-.371.844-.519l.715-.464a.488.488 0 0 1 .266-.089c.172 0 .345.13.345.421 0 .214.001.363.003.437l.006.004-.004.069c-.003.075-.003.075-.486.356l-11.505 6.702a2.282 2.282 0 0 1-.992.268zm-.6-.25l.034.001h.566c.252 0 .649-.108.866-.234l11.505-6.702c.168-.098.294-.173.361-.214-.004-.084-.004-.218-.004-.437l-.095-.171-.131.049-.714.463c-.232.15-.616.386-.854.525l-11.505 6.702-.029.018z' fill='#607D8B'/><path d='M75.266 89.871H74.7c-.2 0-.316-.056-.346-.166-.03-.11.043-.217.215-.317l11.505-6.702c.258-.151.694-.268.993-.268h.565c.2 0 .316.056.346.166.03.11-.043.217-.215.317l-11.505 6.702a2.282 2.282 0 0 1-.992.268zm-.6-.25l.034.001h.566c.252 0 .649-.107.866-.234l11.505-6.702.03-.018-.035-.001h-.565c-.252 0-.649.108-.867.234l-11.505 6.702-.029.018zM74.37 90.801v-1.247 1.247' fill='#607D8B'/><path d='M68.13 93.901c-.751-.093-1.314-.737-1.439-1.376-.831-4.238-1.151-8.782-1.165-21.352-.015-12.784.897-19.745.897-19.745.711-4.146 2.787-5.192 2.787-5.192l74.859-43.219c.223-.129 2.487-1.584 3.195.923 1.95 6.9 1.488 31.887.275 39.878-.389 2.565-1.248 5.215-3.056 6.283L69.21 93.653c-.382.221-.749.288-1.08.248 0 0-2.781-.441-3.001-2.125-.561-4.281-1.152-8.781-1.167-21.351-.014-12.784.898-19.745.898-19.745.71-4.146 2.787-5.191 2.787-5.191l6.598-3.81.871-.119 6.599-3.83.046-.461L68.13 93.901' fill='#FAFAFA'/><path d='M68.317 94.161l-.215-.013h-.001l-.244-.047c-.719-.156-2.772-.736-2.976-2.292-.568-4.34-1.154-8.813-1.168-21.384-.014-12.654.891-19.707.9-19.777.725-4.231 2.832-5.338 2.922-5.382l6.628-3.827.87-.119 6.446-3.742.034-.334a.248.248 0 0 1 .273-.223.248.248 0 0 1 .223.272l-.059.589-6.752 3.919-.87.118-6.556 3.785c-.031.016-1.99 1.068-2.666 5.018-.007.06-.908 7.086-.894 19.702.014 12.539.597 16.996 1.161 21.305.091.691.689 1.154 1.309 1.452a1.95 1.95 0 0 1-.236-.609c-.781-3.984-1.155-8.202-1.17-21.399-.014-12.653.891-19.707.9-19.777.725-4.231 2.832-5.337 2.922-5.382-.004.001 74.444-42.98 74.846-43.212l.028-.017c.904-.538 1.72-.688 2.36-.433.555.221.949.733 1.172 1.52 2.014 7.128 1.46 32.219.281 39.983-.507 3.341-1.575 5.515-3.175 6.462L69.335 93.869a2.023 2.023 0 0 1-1.018.292zm-.147-.507c.293.036.604-.037.915-.217l75.273-43.551c1.823-1.078 2.602-3.915 2.934-6.106 1.174-7.731 1.731-32.695-.268-39.772-.178-.631-.473-1.032-.876-1.192-.484-.193-1.166-.052-1.921.397l-.034.021-74.858 43.218c-.031.017-1.989 1.069-2.666 5.019-.007.059-.908 7.085-.894 19.702.015 13.155.386 17.351 1.161 21.303.09.461.476.983 1.037 1.139.114.025.185.037.196.039h.001z' fill='#455A64'/><path d='M69.317 68.982c.489-.281.885-.056.885.505 0 .56-.396 1.243-.885 1.525-.488.282-.884.057-.884-.504 0-.56.396-1.243.884-1.526' fill='#FFF'/><path d='M68.92 71.133c-.289 0-.487-.228-.487-.625 0-.56.396-1.243.884-1.526a.812.812 0 0 1 .397-.121c.289 0 .488.229.488.626 0 .56-.396 1.243-.885 1.525a.812.812 0 0 1-.397.121m.794-2.459a.976.976 0 0 0-.49.147c-.548.317-.978 1.058-.978 1.687 0 .486.271.812.674.812a.985.985 0 0 0 .491-.146c.548-.317.978-1.057.978-1.687 0-.486-.272-.813-.675-.813' fill='#8097A2'/><path d='M68.92 70.947c-.271 0-.299-.307-.299-.439 0-.491.361-1.116.79-1.363a.632.632 0 0 1 .303-.096c.272 0 .301.306.301.438 0 .491-.363 1.116-.791 1.364a.629.629 0 0 1-.304.096m.794-2.086a.812.812 0 0 0-.397.121c-.488.283-.884.966-.884 1.526 0 .397.198.625.487.625a.812.812 0 0 0 .397-.121c.489-.282.885-.965.885-1.525 0-.397-.199-.626-.488-.626' fill='#8097A2'/><path d='M69.444 85.35c.264-.152.477-.031.477.272 0 .303-.213.67-.477.822-.263.153-.477.031-.477-.271 0-.302.214-.671.477-.823' fill='#FFF'/><path d='M69.23 86.51c-.156 0-.263-.123-.263-.337 0-.302.214-.671.477-.823a.431.431 0 0 1 .214-.066c.156 0 .263.124.263.338 0 .303-.213.67-.477.822a.431.431 0 0 1-.214.066m.428-1.412c-.1 0-.203.029-.307.09-.32.185-.57.618-.57.985 0 .309.185.524.449.524a.63.63 0 0 0 .308-.09c.32-.185.57-.618.57-.985 0-.309-.185-.524-.45-.524' fill='#8097A2'/><path d='M69.23 86.322l-.076-.149c0-.235.179-.544.384-.661l.12-.041.076.151c0 .234-.179.542-.383.66l-.121.04m.428-1.038a.431.431 0 0 0-.214.066c-.263.152-.477.521-.477.823 0 .214.107.337.263.337a.431.431 0 0 0 .214-.066c.264-.152.477-.519.477-.822 0-.214-.107-.338-.263-.338' fill='#8097A2'/><path d='M139.278 7.769v43.667L72.208 90.16V46.493l67.07-38.724' fill='#455A64'/><path d='M72.083 90.375V46.421l.063-.036 67.257-38.831v43.954l-.062.036-67.258 38.831zm.25-43.811v43.38l66.821-38.579V7.985L72.333 46.564z' fill='#607D8B'/></g><path d='M125.737 88.647l-7.639 3.334V84l-11.459 4.713v8.269L99 100.315l13.369 3.646 13.368-15.314' fill='#455A64'/></g></svg>")};var ve="CardboardV1",we="WEBVR_CARDBOARD_VIEWER";f.prototype.show=function(e){this.root=e,e.appendChild(this.dialog),this.dialog.querySelector("#"+this.selectedKey).checked=!0,this.dialog.style.display="block"},f.prototype.hide=function(){this.root&&this.root.contains(this.dialog)&&this.root.removeChild(this.dialog),this.dialog.style.display="none"},f.prototype.getCurrentViewer=function(){return s.Viewers[this.selectedKey]},f.prototype.getSelectedKey_=function(){var e=this.dialog.querySelector("input[name=field]:checked");return e?e.id:null},f.prototype.onChange=function(e){this.onChangeCallbacks_.push(e)},f.prototype.fireOnChange_=function(e){for(var t=0;t<this.onChangeCallbacks_.length;t++)this.onChangeCallbacks_[t](e)},f.prototype.onSave_=function(){if(this.selectedKey=this.getSelectedKey_(),!this.selectedKey||!s.Viewers[this.selectedKey])return void console.error("ViewerSelector.onSave_: this should never happen!");this.fireOnChange_(s.Viewers[this.selectedKey]);try{localStorage.setItem(we,this.selectedKey)}catch(e){console.error("Failed to save viewer profile: %s",e)}this.hide()},f.prototype.createDialog_=function(e){var t=document.createElement("div");t.classList.add("webvr-polyfill-viewer-selector"),t.style.display="none";var i=document.createElement("div"),r=i.style;r.position="fixed",r.left=0,r.top=0,r.width="100%",r.height="100%",r.background="rgba(0, 0, 0, 0.3)",i.addEventListener("click",this.hide.bind(this));var n=document.createElement("div"),r=n.style;r.boxSizing="border-box",r.position="fixed",r.top="24px",r.left="50%",r.marginLeft="-140px",r.width="280px",r.padding="24px",r.overflow="hidden",r.background="#fafafa",r.fontFamily="'Roboto', sans-serif",r.boxShadow="0px 5px 20px #666",n.appendChild(this.createH1_("Select your viewer"));for(var a in e)n.appendChild(this.createChoice_(a,e[a].label));return n.appendChild(this.createButton_("Save",this.onSave_.bind(this))),t.appendChild(i),t.appendChild(n),t},f.prototype.createH1_=function(e){var t=document.createElement("h1"),i=t.style;return i.color="black",i.fontSize="20px",i.fontWeight="bold",i.marginTop=0,i.marginBottom="24px",t.innerHTML=e,t},f.prototype.createChoice_=function(e,t){var i=document.createElement("div");i.style.marginTop="8px",i.style.color="black";var r=document.createElement("input");r.style.fontSize="30px",r.setAttribute("id",e),r.setAttribute("type","radio"),r.setAttribute("value",e),r.setAttribute("name","field");var n=document.createElement("label");return n.style.marginLeft="4px",n.setAttribute("for",e),n.innerHTML=t,i.appendChild(r),i.appendChild(n),i},f.prototype.createButton_=function(e,t){var i=document.createElement("button");i.innerHTML=e;var r=i.style;return r.float="right",r.textTransform="uppercase",r.color="#1094f7",r.fontSize="14px",r.letterSpacing=0,r.border=0,r.background="none",r.marginTop="16px",i.addEventListener("click",t),i};var ye=("undefined"!=typeof window?window:void 0!==t||"undefined"!=typeof self&&self,function(e,t){return t={exports:{}},e(t,t.exports),t.exports}(function(e,t){!function(t,i){e.exports=i()}(0,function(){return function(e){function t(r){if(i[r])return i[r].exports;var n=i[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var i={};return t.m=e,t.c=i,t.d=function(e,i,r){t.o(e,i)||Object.defineProperty(e,i,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,i){function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),a=i(1),s="undefined"!=typeof navigator&&parseFloat((""+(/CPU.*OS ([0-9_]{3,4})[0-9_]{0,1}|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))<10&&!window.MSStream,A=function(){function e(){r(this,e),s?this.noSleepTimer=null:(this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("playsinline",""),this.noSleepVideo.setAttribute("src",a),this.noSleepVideo.addEventListener("timeupdate",function(e){this.noSleepVideo.currentTime>.5&&(this.noSleepVideo.currentTime=Math.random())}.bind(this)))}return n(e,[{key:"enable",value:function(){s?(this.disable(),this.noSleepTimer=window.setInterval(function(){window.location.href="/",window.setTimeout(window.stop,0)},15e3)):this.noSleepVideo.play()}},{key:"disable",value:function(){s?this.noSleepTimer&&(window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause()}}]),e}();e.exports=A},function(e,t,i){
  1153. e.exports="data:video/mp4;base64,AAAAIGZ0eXBtcDQyAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACKBtZGF0AAAC8wYF///v3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE0MiByMjQ3OSBkZDc5YTYxIC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDMtMjAxNCAtIGh0dHA6Ly93d3cudmlkZW9sYW4ub3JnL3gyNjQuaHRtbCAtIG9wdGlvbnM6IGNhYmFjPTEgcmVmPTEgZGVibG9jaz0xOjA6MCBhbmFseXNlPTB4MToweDExMSBtZT1oZXggc3VibWU9MiBwc3k9MSBwc3lfcmQ9MS4wMDowLjAwIG1peGVkX3JlZj0wIG1lX3JhbmdlPTE2IGNocm9tYV9tZT0xIHRyZWxsaXM9MCA4eDhkY3Q9MCBjcW09MCBkZWFkem9uZT0yMSwxMSBmYXN0X3Bza2lwPTEgY2hyb21hX3FwX29mZnNldD0wIHRocmVhZHM9NiBsb29rYWhlYWRfdGhyZWFkcz0xIHNsaWNlZF90aHJlYWRzPTAgbnI9MCBkZWNpbWF0ZT0xIGludGVybGFjZWQ9MCBibHVyYXlfY29tcGF0PTAgY29uc3RyYWluZWRfaW50cmE9MCBiZnJhbWVzPTMgYl9weXJhbWlkPTIgYl9hZGFwdD0xIGJfYmlhcz0wIGRpcmVjdD0xIHdlaWdodGI9MSBvcGVuX2dvcD0wIHdlaWdodHA9MSBrZXlpbnQ9MzAwIGtleWludF9taW49MzAgc2NlbmVjdXQ9NDAgaW50cmFfcmVmcmVzaD0wIHJjX2xvb2thaGVhZD0xMCByYz1jcmYgbWJ0cmVlPTEgY3JmPTIwLjAgcWNvbXA9MC42MCBxcG1pbj0wIHFwbWF4PTY5IHFwc3RlcD00IHZidl9tYXhyYXRlPTIwMDAwIHZidl9idWZzaXplPTI1MDAwIGNyZl9tYXg9MC4wIG5hbF9ocmQ9bm9uZSBmaWxsZXI9MCBpcF9yYXRpbz0xLjQwIGFxPTE6MS4wMACAAAAAOWWIhAA3//p+C7v8tDDSTjf97w55i3SbRPO4ZY+hkjD5hbkAkL3zpJ6h/LR1CAABzgB1kqqzUorlhQAAAAxBmiQYhn/+qZYADLgAAAAJQZ5CQhX/AAj5IQADQGgcIQADQGgcAAAACQGeYUQn/wALKCEAA0BoHAAAAAkBnmNEJ/8ACykhAANAaBwhAANAaBwAAAANQZpoNExDP/6plgAMuSEAA0BoHAAAAAtBnoZFESwr/wAI+SEAA0BoHCEAA0BoHAAAAAkBnqVEJ/8ACykhAANAaBwAAAAJAZ6nRCf/AAsoIQADQGgcIQADQGgcAAAADUGarDRMQz/+qZYADLghAANAaBwAAAALQZ7KRRUsK/8ACPkhAANAaBwAAAAJAZ7pRCf/AAsoIQADQGgcIQADQGgcAAAACQGe60Qn/wALKCEAA0BoHAAAAA1BmvA0TEM//qmWAAy5IQADQGgcIQADQGgcAAAAC0GfDkUVLCv/AAj5IQADQGgcAAAACQGfLUQn/wALKSEAA0BoHCEAA0BoHAAAAAkBny9EJ/8ACyghAANAaBwAAAANQZs0NExDP/6plgAMuCEAA0BoHAAAAAtBn1JFFSwr/wAI+SEAA0BoHCEAA0BoHAAAAAkBn3FEJ/8ACyghAANAaBwAAAAJAZ9zRCf/AAsoIQADQGgcIQADQGgcAAAADUGbeDRMQz/+qZYADLkhAANAaBwAAAALQZ+WRRUsK/8ACPghAANAaBwhAANAaBwAAAAJAZ+1RCf/AAspIQADQGgcAAAACQGft0Qn/wALKSEAA0BoHCEAA0BoHAAAAA1Bm7w0TEM//qmWAAy4IQADQGgcAAAAC0Gf2kUVLCv/AAj5IQADQGgcAAAACQGf+UQn/wALKCEAA0BoHCEAA0BoHAAAAAkBn/tEJ/8ACykhAANAaBwAAAANQZvgNExDP/6plgAMuSEAA0BoHCEAA0BoHAAAAAtBnh5FFSwr/wAI+CEAA0BoHAAAAAkBnj1EJ/8ACyghAANAaBwhAANAaBwAAAAJAZ4/RCf/AAspIQADQGgcAAAADUGaJDRMQz/+qZYADLghAANAaBwAAAALQZ5CRRUsK/8ACPkhAANAaBwhAANAaBwAAAAJAZ5hRCf/AAsoIQADQGgcAAAACQGeY0Qn/wALKSEAA0BoHCEAA0BoHAAAAA1Bmmg0TEM//qmWAAy5IQADQGgcAAAAC0GehkUVLCv/AAj5IQADQGgcIQADQGgcAAAACQGepUQn/wALKSEAA0BoHAAAAAkBnqdEJ/8ACyghAANAaBwAAAANQZqsNExDP/6plgAMuCEAA0BoHCEAA0BoHAAAAAtBnspFFSwr/wAI+SEAA0BoHAAAAAkBnulEJ/8ACyghAANAaBwhAANAaBwAAAAJAZ7rRCf/AAsoIQADQGgcAAAADUGa8DRMQz/+qZYADLkhAANAaBwhAANAaBwAAAALQZ8ORRUsK/8ACPkhAANAaBwAAAAJAZ8tRCf/AAspIQADQGgcIQADQGgcAAAACQGfL0Qn/wALKCEAA0BoHAAAAA1BmzQ0TEM//qmWAAy4IQADQGgcAAAAC0GfUkUVLCv/AAj5IQADQGgcIQADQGgcAAAACQGfcUQn/wALKCEAA0BoHAAAAAkBn3NEJ/8ACyghAANAaBwhAANAaBwAAAANQZt4NExC//6plgAMuSEAA0BoHAAAAAtBn5ZFFSwr/wAI+CEAA0BoHCEAA0BoHAAAAAkBn7VEJ/8ACykhAANAaBwAAAAJAZ+3RCf/AAspIQADQGgcAAAADUGbuzRMQn/+nhAAYsAhAANAaBwhAANAaBwAAAAJQZ/aQhP/AAspIQADQGgcAAAACQGf+UQn/wALKCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHAAACiFtb292AAAAbG12aGQAAAAA1YCCX9WAgl8AAAPoAAAH/AABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAGGlvZHMAAAAAEICAgAcAT////v7/AAAF+XRyYWsAAABcdGtoZAAAAAPVgIJf1YCCXwAAAAEAAAAAAAAH0AAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAygAAAMoAAAAAACRlZHRzAAAAHGVsc3QAAAAAAAAAAQAAB9AAABdwAAEAAAAABXFtZGlhAAAAIG1kaGQAAAAA1YCCX9WAgl8AAV+QAAK/IFXEAAAAAAAtaGRscgAAAAAAAAAAdmlkZQAAAAAAAAAAAAAAAFZpZGVvSGFuZGxlcgAAAAUcbWluZgAAABR2bWhkAAAAAQAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAAE3HN0YmwAAACYc3RzZAAAAAAAAAABAAAAiGF2YzEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAygDKAEgAAABIAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY//8AAAAyYXZjQwFNQCj/4QAbZ01AKOyho3ySTUBAQFAAAAMAEAAr8gDxgxlgAQAEaO+G8gAAABhzdHRzAAAAAAAAAAEAAAA8AAALuAAAABRzdHNzAAAAAAAAAAEAAAABAAAB8GN0dHMAAAAAAAAAPAAAAAEAABdwAAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAAC7gAAAAAQAAF3AAAAABAAAAAAAAABxzdHNjAAAAAAAAAAEAAAABAAAAAQAAAAEAAAEEc3RzegAAAAAAAAAAAAAAPAAAAzQAAAAQAAAADQAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAANAAAADQAAAQBzdGNvAAAAAAAAADwAAAAwAAADZAAAA3QAAAONAAADoAAAA7kAAAPQAAAD6wAAA/4AAAQXAAAELgAABEMAAARcAAAEbwAABIwAAAShAAAEugAABM0AAATkAAAE/wAABRIAAAUrAAAFQgAABV0AAAVwAAAFiQAABaAAAAW1AAAFzgAABeEAAAX+AAAGEwAABiwAAAY/AAAGVgAABnEAAAaEAAAGnQAABrQAAAbPAAAG4gAABvUAAAcSAAAHJwAAB0AAAAdTAAAHcAAAB4UAAAeeAAAHsQAAB8gAAAfjAAAH9gAACA8AAAgmAAAIQQAACFQAAAhnAAAIhAAACJcAAAMsdHJhawAAAFx0a2hkAAAAA9WAgl/VgIJfAAAAAgAAAAAAAAf8AAAAAAAAAAAAAAABAQAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAACsm1kaWEAAAAgbWRoZAAAAADVgIJf1YCCXwAArEQAAWAAVcQAAAAAACdoZGxyAAAAAAAAAABzb3VuAAAAAAAAAAAAAAAAU3RlcmVvAAAAAmNtaW5mAAAAEHNtaGQAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAidzdGJsAAAAZ3N0c2QAAAAAAAAAAQAAAFdtcDRhAAAAAAAAAAEAAAAAAAAAAAACABAAAAAArEQAAAAAADNlc2RzAAAAAAOAgIAiAAIABICAgBRAFQAAAAADDUAAAAAABYCAgAISEAaAgIABAgAAABhzdHRzAAAAAAAAAAEAAABYAAAEAAAAABxzdHNjAAAAAAAAAAEAAAABAAAAAQAAAAEAAAAUc3RzegAAAAAAAAAGAAAAWAAAAXBzdGNvAAAAAAAAAFgAAAOBAAADhwAAA5oAAAOtAAADswAAA8oAAAPfAAAD5QAAA/gAAAQLAAAEEQAABCgAAAQ9AAAEUAAABFYAAARpAAAEgAAABIYAAASbAAAErgAABLQAAATHAAAE3gAABPMAAAT5AAAFDAAABR8AAAUlAAAFPAAABVEAAAVXAAAFagAABX0AAAWDAAAFmgAABa8AAAXCAAAFyAAABdsAAAXyAAAF+AAABg0AAAYgAAAGJgAABjkAAAZQAAAGZQAABmsAAAZ+AAAGkQAABpcAAAauAAAGwwAABskAAAbcAAAG7wAABwYAAAcMAAAHIQAABzQAAAc6AAAHTQAAB2QAAAdqAAAHfwAAB5IAAAeYAAAHqwAAB8IAAAfXAAAH3QAAB/AAAAgDAAAICQAACCAAAAg1AAAIOwAACE4AAAhhAAAIeAAACH4AAAiRAAAIpAAACKoAAAiwAAAItgAACLwAAAjCAAAAFnVkdGEAAAAObmFtZVN0ZXJlbwAAAHB1ZHRhAAAAaG1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAAO2lsc3QAAAAzqXRvbwAAACtkYXRhAAAAAQAAAABIYW5kQnJha2UgMC4xMC4yIDIwMTUwNjExMDA="}])})})),Ee=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}(ye),be=1e3,_e=[0,0,.5,1],De=[.5,0,.5,1],Me=window.requestAnimationFrame,Fe=window.cancelAnimationFrame;v.prototype.getFrameData=function(e){return X(e,this._getPose(),this)},v.prototype.getPose=function(){return J("VRDisplay.prototype.getPose","VRDisplay.prototype.getFrameData"),this._getPose()},v.prototype.resetPose=function(){return J("VRDisplay.prototype.resetPose"),this._resetPose()},v.prototype.getImmediatePose=function(){return J("VRDisplay.prototype.getImmediatePose","VRDisplay.prototype.getFrameData"),this._getPose()},v.prototype.requestAnimationFrame=function(e){return Me(e)},v.prototype.cancelAnimationFrame=function(e){return Fe(e)},v.prototype.wrapForFullscreen=function(e){if(M())return e;if(!this.fullscreenWrapper_){this.fullscreenWrapper_=document.createElement("div");var t=["height: "+Math.min(screen.height,screen.width)+"px !important","top: 0 !important","left: 0 !important","right: 0 !important","border: 0","margin: 0","padding: 0","z-index: 999999 !important","position: fixed"];this.fullscreenWrapper_.setAttribute("style",t.join("; ")+";"),this.fullscreenWrapper_.classList.add("webvr-polyfill-fullscreen-wrapper")}if(this.fullscreenElement_==e)return this.fullscreenWrapper_;if(this.fullscreenElement_&&(this.originalParent_?this.originalParent_.appendChild(this.fullscreenElement_):this.fullscreenElement_.parentElement.removeChild(this.fullscreenElement_)),this.fullscreenElement_=e,this.originalParent_=e.parentElement,this.originalParent_||document.body.appendChild(e),!this.fullscreenWrapper_.parentElement){var i=this.fullscreenElement_.parentElement;i.insertBefore(this.fullscreenWrapper_,this.fullscreenElement_),i.removeChild(this.fullscreenElement_)}this.fullscreenWrapper_.insertBefore(this.fullscreenElement_,this.fullscreenWrapper_.firstChild),this.fullscreenElementCachedStyle_=this.fullscreenElement_.getAttribute("style");var r=this;return function(){if(r.fullscreenElement_){var e=["position: absolute","top: 0","left: 0","width: "+Math.max(screen.width,screen.height)+"px","height: "+Math.min(screen.height,screen.width)+"px","border: 0","margin: 0","padding: 0"];r.fullscreenElement_.setAttribute("style",e.join("; ")+";")}}(),this.fullscreenWrapper_},v.prototype.removeFullscreenWrapper=function(){if(this.fullscreenElement_){var e=this.fullscreenElement_;this.fullscreenElementCachedStyle_?e.setAttribute("style",this.fullscreenElementCachedStyle_):e.removeAttribute("style"),this.fullscreenElement_=null,this.fullscreenElementCachedStyle_=null;var t=this.fullscreenWrapper_.parentElement;return this.fullscreenWrapper_.removeChild(e),this.originalParent_===t?t.insertBefore(e,this.fullscreenWrapper_):this.originalParent_&&this.originalParent_.appendChild(e),t.removeChild(this.fullscreenWrapper_),e}},v.prototype.requestPresent=function(e){var t=this.isPresenting,i=this;return e instanceof Array||(J("VRDisplay.prototype.requestPresent with non-array argument","an array of VRLayers as the first argument"),e=[e]),new Promise(function(r,n){if(!i.capabilities.canPresent)return void n(new Error("VRDisplay is not capable of presenting."));if(0==e.length||e.length>i.capabilities.maxLayers)return void n(new Error("Invalid number of layers."));var a=e[0];if(!a.source)return void r();var s=a.leftBounds||_e,A=a.rightBounds||De;if(t){var o=i.layer_;o.source!==a.source&&(o.source=a.source);for(var l=0;l<4;l++)o.leftBounds[l]=s[l],o.rightBounds[l]=A[l];return i.wrapForFullscreen(i.layer_.source),i.updatePresent_(),void r()}if(i.layer_={predistorted:a.predistorted,source:a.source,leftBounds:s.slice(0),rightBounds:A.slice(0)},i.waitingForPresent_=!1,i.layer_&&i.layer_.source){var c=i.wrapForFullscreen(i.layer_.source),h=function(){var e=Q();i.isPresenting=c===e,i.isPresenting?(screen.orientation&&screen.orientation.lock&&screen.orientation.lock("landscape-primary").catch(function(e){console.error("screen.orientation.lock() failed due to",e.message)}),i.waitingForPresent_=!1,i.beginPresent_(),r()):(screen.orientation&&screen.orientation.unlock&&screen.orientation.unlock(),i.removeFullscreenWrapper(),i.disableWakeLock(),i.endPresent_(),i.removeFullscreenListeners_()),i.fireVRDisplayPresentChange_()},d=function(){i.waitingForPresent_&&(i.removeFullscreenWrapper(),i.removeFullscreenListeners_(),i.disableWakeLock(),i.waitingForPresent_=!1,i.isPresenting=!1,n(new Error("Unable to present.")))};i.addFullscreenListeners_(c,h,d),G(c)?(i.enableWakeLock(),i.waitingForPresent_=!0):(M()||F())&&(i.enableWakeLock(),i.isPresenting=!0,i.beginPresent_(),i.fireVRDisplayPresentChange_(),r())}i.waitingForPresent_||M()||(O(),n(new Error("Unable to present.")))})},v.prototype.exitPresent=function(){var e=this.isPresenting,t=this;return this.isPresenting=!1,this.layer_=null,this.disableWakeLock(),new Promise(function(i,r){e?(!O()&&M()&&(t.endPresent_(),t.fireVRDisplayPresentChange_()),F()&&(t.removeFullscreenWrapper(),t.removeFullscreenListeners_(),t.endPresent_(),t.fireVRDisplayPresentChange_()),i()):r(new Error("Was not presenting to VRDisplay."))})},v.prototype.getLayers=function(){return this.layer_?[this.layer_]:[]},v.prototype.fireVRDisplayPresentChange_=function(){var e=new CustomEvent("vrdisplaypresentchange",{detail:{display:this}});window.dispatchEvent(e)},v.prototype.fireVRDisplayConnect_=function(){var e=new CustomEvent("vrdisplayconnect",{detail:{display:this}});window.dispatchEvent(e)},v.prototype.addFullscreenListeners_=function(e,t,i){this.removeFullscreenListeners_(),this.fullscreenEventTarget_=e,this.fullscreenChangeHandler_=t,this.fullscreenErrorHandler_=i,t&&(document.fullscreenEnabled?e.addEventListener("fullscreenchange",t,!1):document.webkitFullscreenEnabled?e.addEventListener("webkitfullscreenchange",t,!1):document.mozFullScreenEnabled?document.addEventListener("mozfullscreenchange",t,!1):document.msFullscreenEnabled&&e.addEventListener("msfullscreenchange",t,!1)),i&&(document.fullscreenEnabled?e.addEventListener("fullscreenerror",i,!1):document.webkitFullscreenEnabled?e.addEventListener("webkitfullscreenerror",i,!1):document.mozFullScreenEnabled?document.addEventListener("mozfullscreenerror",i,!1):document.msFullscreenEnabled&&e.addEventListener("msfullscreenerror",i,!1))},v.prototype.removeFullscreenListeners_=function(){if(this.fullscreenEventTarget_){var e=this.fullscreenEventTarget_;if(this.fullscreenChangeHandler_){var t=this.fullscreenChangeHandler_;e.removeEventListener("fullscreenchange",t,!1),e.removeEventListener("webkitfullscreenchange",t,!1),document.removeEventListener("mozfullscreenchange",t,!1),e.removeEventListener("msfullscreenchange",t,!1)}if(this.fullscreenErrorHandler_){var i=this.fullscreenErrorHandler_;e.removeEventListener("fullscreenerror",i,!1),e.removeEventListener("webkitfullscreenerror",i,!1),document.removeEventListener("mozfullscreenerror",i,!1),e.removeEventListener("msfullscreenerror",i,!1)}this.fullscreenEventTarget_=null,this.fullscreenChangeHandler_=null,this.fullscreenErrorHandler_=null}},v.prototype.enableWakeLock=function(){this.wakelock_&&this.wakelock_.enable()},v.prototype.disableWakeLock=function(){this.wakelock_&&this.wakelock_.disable()},v.prototype.beginPresent_=function(){},v.prototype.endPresent_=function(){},v.prototype.submitFrame=function(e){},v.prototype.getEyeParameters=function(e){return null};var Te={ADDITIONAL_VIEWERS:[],DEFAULT_VIEWER:"",MOBILE_WAKE_LOCK:!0,DEBUG:!1,DPDB_URL:"https://dpdb.webvr.rocks/dpdb.json",K_FILTER:.98,PREDICTION_TIME_S:.04,CARDBOARD_UI_DISABLED:!1,ROTATE_INSTRUCTIONS_DISABLED:!1,YAW_ONLY:!1,BUFFER_SCALE:.5,DIRTY_SUBMIT_FRAME_BINDINGS:!1},Be={LEFT:"left",RIGHT:"right"};return w.prototype=Object.create(v.prototype),w.prototype._getPose=function(){return{position:null,orientation:this.poseSensor_.getOrientation(),linearVelocity:null,linearAcceleration:null,angularVelocity:null,angularAcceleration:null}},w.prototype._resetPose=function(){this.poseSensor_.resetPose&&this.poseSensor_.resetPose()},w.prototype._getFieldOfView=function(e){var t;if(e==Be.LEFT)t=this.deviceInfo_.getFieldOfViewLeftEye();else{if(e!=Be.RIGHT)return console.error("Invalid eye provided: %s",e),null;t=this.deviceInfo_.getFieldOfViewRightEye()}return t},w.prototype._getEyeOffset=function(e){var t;if(e==Be.LEFT)t=[.5*-this.deviceInfo_.viewer.interLensDistance,0,0];else{if(e!=Be.RIGHT)return console.error("Invalid eye provided: %s",e),null;t=[.5*this.deviceInfo_.viewer.interLensDistance,0,0]}return t},w.prototype.getEyeParameters=function(e){var t=this._getEyeOffset(e),i=this._getFieldOfView(e),r={offset:t,renderWidth:.5*this.deviceInfo_.device.width*this.bufferScale_,renderHeight:this.deviceInfo_.device.height*this.bufferScale_};return Object.defineProperty(r,"fieldOfView",{enumerable:!0,get:function(){return J("VRFieldOfView","VRFrameData's projection matrices"),i}}),r},w.prototype.onDeviceParamsUpdated_=function(e){this.config.DEBUG&&console.log("DPDB reported that device params were updated."),this.deviceInfo_.updateDeviceParams(e),this.distorter_&&this.distorter_.updateDeviceInfo(this.deviceInfo_)},w.prototype.updateBounds_=function(){this.layer_&&this.distorter_&&(this.layer_.leftBounds||this.layer_.rightBounds)&&this.distorter_.setTextureBounds(this.layer_.leftBounds,this.layer_.rightBounds)},w.prototype.beginPresent_=function(){var e=this.layer_.source.getContext("webgl");e||(e=this.layer_.source.getContext("experimental-webgl")),e||(e=this.layer_.source.getContext("webgl2")),e&&(this.layer_.predistorted?this.config.CARDBOARD_UI_DISABLED||(e.canvas.width=P()*this.bufferScale_,e.canvas.height=N()*this.bufferScale_,this.cardboardUI_=new r(e)):(this.config.CARDBOARD_UI_DISABLED||(this.cardboardUI_=new r(e)),this.distorter_=new i(e,this.cardboardUI_,this.config.BUFFER_SCALE,this.config.DIRTY_SUBMIT_FRAME_BINDINGS),this.distorter_.updateDeviceInfo(this.deviceInfo_)),this.cardboardUI_&&this.cardboardUI_.listen(function(e){this.viewerSelector_.show(this.layer_.source.parentElement),e.stopPropagation(),e.preventDefault()}.bind(this),function(e){this.exitPresent(),e.stopPropagation(),e.preventDefault()}.bind(this)),this.rotateInstructions_&&(x()&&z()?this.rotateInstructions_.showTemporarily(3e3,this.layer_.source.parentElement):this.rotateInstructions_.update()),this.orientationHandler=this.onOrientationChange_.bind(this),window.addEventListener("orientationchange",this.orientationHandler),this.vrdisplaypresentchangeHandler=this.updateBounds_.bind(this),window.addEventListener("vrdisplaypresentchange",this.vrdisplaypresentchangeHandler),this.fireVRDisplayDeviceParamsChange_())},w.prototype.endPresent_=function(){this.distorter_&&(this.distorter_.destroy(),this.distorter_=null),this.cardboardUI_&&(this.cardboardUI_.destroy(),this.cardboardUI_=null),this.rotateInstructions_&&this.rotateInstructions_.hide(),this.viewerSelector_.hide(),window.removeEventListener("orientationchange",this.orientationHandler),window.removeEventListener("vrdisplaypresentchange",this.vrdisplaypresentchangeHandler)},w.prototype.updatePresent_=function(){this.endPresent_(),this.beginPresent_()},w.prototype.submitFrame=function(e){if(this.distorter_)this.updateBounds_(),this.distorter_.submitFrame();else if(this.cardboardUI_&&this.layer_){var t=this.layer_.source.getContext("webgl");t||(t=this.layer_.source.getContext("experimental-webgl")),t||(t=this.layer_.source.getContext("webgl2"));var i=t.canvas;i.width==this.lastWidth&&i.height==this.lastHeight||this.cardboardUI_.onResize(),this.lastWidth=i.width,this.lastHeight=i.height,this.cardboardUI_.render()}},w.prototype.onOrientationChange_=function(e){this.viewerSelector_.hide(),this.rotateInstructions_&&this.rotateInstructions_.update(),this.onResize_()},w.prototype.onResize_=function(e){if(this.layer_){var t=this.layer_.source.getContext("webgl");t||(t=this.layer_.source.getContext("experimental-webgl")),t||(t=this.layer_.source.getContext("webgl2"));var i=["position: absolute","top: 0","left: 0","width: 100vw","height: 100vh","border: 0","margin: 0","padding: 0px","box-sizing: content-box"];t.canvas.setAttribute("style",i.join("; ")+";"),W(t.canvas)}},w.prototype.onViewerChanged_=function(e){this.deviceInfo_.setViewer(e),this.distorter_&&this.distorter_.updateDeviceInfo(this.deviceInfo_),this.fireVRDisplayDeviceParamsChange_()},w.prototype.fireVRDisplayDeviceParamsChange_=function(){var e=new CustomEvent("vrdisplaydeviceparamschange",{detail:{vrdisplay:this,deviceInfo:this.deviceInfo_}});window.dispatchEvent(e)},w.VRFrameData=m,w.VRDisplay=v,w}()}()}),s=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}(a),A={ADDITIONAL_VIEWERS:[],DEFAULT_VIEWER:"",PROVIDE_MOBILE_VRDISPLAY:!0,MOBILE_WAKE_LOCK:!0,DEBUG:!1,DPDB_URL:"https://dpdb.webvr.rocks/dpdb.json",K_FILTER:.98,PREDICTION_TIME_S:.04,CARDBOARD_UI_DISABLED:!1,ROTATE_INSTRUCTIONS_DISABLED:!1,YAW_ONLY:!1,BUFFER_SCALE:.5,DIRTY_SUBMIT_FRAME_BINDINGS:!1};e.prototype.getPolyfillDisplays=function(){if(this._polyfillDisplaysPopulated)return this.polyfillDisplays;if(i()){var e=new s({ADDITIONAL_VIEWERS:this.config.ADDITIONAL_VIEWERS,DEFAULT_VIEWER:this.config.DEFAULT_VIEWER,MOBILE_WAKE_LOCK:this.config.MOBILE_WAKE_LOCK,DEBUG:this.config.DEBUG,DPDB_URL:this.config.DPDB_URL,CARDBOARD_UI_DISABLED:this.config.CARDBOARD_UI_DISABLED,K_FILTER:this.config.K_FILTER,PREDICTION_TIME_S:this.config.PREDICTION_TIME_S,ROTATE_INSTRUCTIONS_DISABLED:this.config.ROTATE_INSTRUCTIONS_DISABLED,YAW_ONLY:this.config.YAW_ONLY,BUFFER_SCALE:this.config.BUFFER_SCALE,DIRTY_SUBMIT_FRAME_BINDINGS:this.config.DIRTY_SUBMIT_FRAME_BINDINGS});this.polyfillDisplays.push(e)}return this._polyfillDisplaysPopulated=!0,this.polyfillDisplays},e.prototype.enable=function(){if(this.enabled=!0,this.hasNative&&this.native.VRFrameData){var e=this.native.VRFrameData,t=new this.native.VRFrameData,i=this.native.VRDisplay.prototype.getFrameData;window.VRDisplay.prototype.getFrameData=function(n){if(n instanceof e)return void i.call(this,n);i.call(this,t),n.pose=t.pose,r(t.leftProjectionMatrix,n.leftProjectionMatrix),r(t.rightProjectionMatrix,n.rightProjectionMatrix),r(t.leftViewMatrix,n.leftViewMatrix),r(t.rightViewMatrix,n.rightViewMatrix)}}navigator.getVRDisplays=this.getVRDisplays.bind(this),window.VRDisplay=s.VRDisplay,window.VRFrameData=s.VRFrameData},e.prototype.getVRDisplays=function(){var e=this;this.config;return this.hasNative?this.native.getVRDisplays.call(navigator).then(function(t){return t.length>0?t:e.getPolyfillDisplays()}):Promise.resolve(this.getPolyfillDisplays())},e.version="0.10.12",e.VRFrameData=s.VRFrameData,e.VRDisplay=s.VRDisplay;var o=Object.freeze({default:e}),l=o&&e||o;return void 0!==t&&t.window&&(t.document||(t.document=t.window.document),t.navigator||(t.navigator=t.window.navigator)),l});
  1154. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  1155. },{}],69:[function(_dereq_,module,exports){
  1156. function idxOf(e,n,r,t){var i=e.indexOf(n,r);return-1===i||i>t?t:i}function isWhitespace(e){return whitespace.test(e)}function pre(e,n,r,t,i){for(var a=[],o=r,s=r;s<t&&s<n.length;s++){var h=n.charAt(s),u=newline.test(h);if(u||s===t-1){var f=u?s:s+1,p=e(n,o,f,i);a.push(p),o=s+1}}return a}function greedy(e,n,r,t,i,a){var o=[],s=i;for("nowrap"===a&&(s=Number.MAX_VALUE);r<t&&r<n.length;){for(var h=idxOf(n,newlineChar,r,t);r<h&&isWhitespace(n.charAt(r));)r++;var u=e(n,r,h,s),f=r+(u.end-u.start),p=f+newlineChar.length;if(f<h){for(;f>r&&!isWhitespace(n.charAt(f));)f--;if(f===r)p>r+newlineChar.length&&p--,f=p;else for(p=f;f>r&&isWhitespace(n.charAt(f-newlineChar.length));)f--}if(f>=r){var c=e(n,r,f,s);o.push(c)}r=p}return o}function monospace(e,n,r,t){return{start:n,end:n+Math.min(t,r-n)}}var newline=/\n/,newlineChar="\n",whitespace=/\s/;module.exports=function(e,n){return module.exports.lines(e,n).map(function(n){return e.substring(n.start,n.end)}).join("\n")},module.exports.lines=function(e,n){if(n=n||{},0===n.width&&"nowrap"!==n.mode)return[];e=e||"";var r="number"==typeof n.width?n.width:Number.MAX_VALUE,t=Math.max(0,n.start||0),i="number"==typeof n.end?n.end:e.length,a=n.mode,o=n.measure||monospace;return"pre"===a?pre(o,e,t,i,r):greedy(o,e,t,i,r,a)};
  1157. },{}],70:[function(_dereq_,module,exports){
  1158. "use strict";function forEachArray(e,t){for(var r=0;r<e.length;r++)t(e[r])}function isEmpty(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}function initParams(e,t,r){var n=e;return isFunction(t)?(r=t,"string"==typeof e&&(n={uri:e})):n=xtend(t,{uri:e}),n.callback=r,n}function createXHR(e,t,r){return t=initParams(e,t,r),_createXHR(t)}function _createXHR(e){function t(){4===i.readyState&&setTimeout(o,0)}function r(){var e=void 0;if(e=i.response?i.response:i.responseText||getXml(i),X)try{e=JSON.parse(e)}catch(e){}return e}function n(e){return clearTimeout(d),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,a(e,h)}function o(){if(!c){var t;clearTimeout(d),t=e.useXDR&&void 0===i.status?200:1223===i.status?204:i.status;var n=h,o=null;return 0!==t?(n={body:r(),statusCode:t,method:l,headers:{},url:p,rawRequest:i},i.getAllResponseHeaders&&(n.headers=parseHeaders(i.getAllResponseHeaders()))):o=new Error("Internal XMLHttpRequest Error"),a(o,n,n.body)}}if(void 0===e.callback)throw new Error("callback argument missing");var s=!1,a=function(t,r,n){s||(s=!0,e.callback(t,r,n))},i=e.xhr||null;i||(i=e.cors||e.useXDR?new createXHR.XDomainRequest:new createXHR.XMLHttpRequest);var u,c,d,p=i.url=e.uri||e.url,l=i.method=e.method||"GET",f=e.body||e.data,m=i.headers=e.headers||{},R=!!e.sync,X=!1,h={body:void 0,headers:{},statusCode:0,method:l,url:p,rawRequest:i};if("json"in e&&!1!==e.json&&(X=!0,m.accept||m.Accept||(m.Accept="application/json"),"GET"!==l&&"HEAD"!==l&&(m["content-type"]||m["Content-Type"]||(m["Content-Type"]="application/json"),f=JSON.stringify(!0===e.json?f:e.json))),i.onreadystatechange=t,i.onload=o,i.onerror=n,i.onprogress=function(){},i.onabort=function(){c=!0},i.ontimeout=n,i.open(l,p,!R,e.username,e.password),R||(i.withCredentials=!!e.withCredentials),!R&&e.timeout>0&&(d=setTimeout(function(){if(!c){c=!0,i.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",n(e)}},e.timeout)),i.setRequestHeader)for(u in m)m.hasOwnProperty(u)&&i.setRequestHeader(u,m[u]);else if(e.headers&&!isEmpty(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(i.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(i),i.send(f||null),i}function getXml(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(e){}return null}function noop(){}var window=_dereq_("global/window"),isFunction=_dereq_("is-function"),parseHeaders=_dereq_("parse-headers"),xtend=_dereq_("xtend");module.exports=createXHR,module.exports.default=createXHR,createXHR.XMLHttpRequest=window.XMLHttpRequest||noop,createXHR.XDomainRequest="withCredentials"in new createXHR.XMLHttpRequest?createXHR.XMLHttpRequest:window.XDomainRequest,forEachArray(["get","put","post","patch","head","delete"],function(e){createXHR["delete"===e?"del":e]=function(t,r,n){return r=initParams(t,r,n),r.method=e.toUpperCase(),_createXHR(r)}});
  1159. },{"global/window":27,"is-function":33,"parse-headers":47,"xtend":72}],71:[function(_dereq_,module,exports){
  1160. module.exports=function(){return void 0!==self.DOMParser?function(e){return(new self.DOMParser).parseFromString(e,"application/xml")}:void 0!==self.ActiveXObject&&new self.ActiveXObject("Microsoft.XMLDOM")?function(e){var n=new self.ActiveXObject("Microsoft.XMLDOM");return n.async="false",n.loadXML(e),n}:function(e){var n=document.createElement("div");return n.innerHTML=e,n}}();
  1161. },{}],72:[function(_dereq_,module,exports){
  1162. function extend(){for(var r={},e=0;e<arguments.length;e++){var t=arguments[e];for(var n in t)hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r}module.exports=extend;var hasOwnProperty=Object.prototype.hasOwnProperty;
  1163. },{}],73:[function(_dereq_,module,exports){
  1164. module.exports={"name":"aframe","version":"1.2.0","description":"A web framework for building virtual reality experiences.","homepage":"https://aframe.io/","main":"dist/aframe-master.js","scripts":{"browserify":"browserify src/index.js -s 'AFRAME' -p browserify-derequire","build":"shx mkdir -p build/ && npm run browserify -- --debug -t [ envify --INSPECTOR_VERSION dev ] -o build/aframe.js","codecov":"codecov","dev":"npm run build && cross-env INSPECTOR_VERSION=dev node ./scripts/budo -t envify","dist":"node scripts/updateVersionLog.js && npm run dist:min && npm run dist:max","dist:max":"npm run browserify -s -- --debug | exorcist dist/aframe-master.js.map > dist/aframe-master.js","dist:min":"npm run browserify -s -- --debug -p [ minifyify --map aframe-master.min.js.map --output dist/aframe-master.min.js.map ] -o dist/aframe-master.min.js","docs":"markserv --dir docs --port 9001","preghpages":"node ./scripts/preghpages.js","ghpages":"ghpages -p gh-pages/","lint":"semistandard -v | snazzy","lint:fix":"semistandard --fix","precommit":"npm run lint","prepush":"node scripts/testOnlyCheck.js","prerelease":"node scripts/release.js 1.1.0 1.2.0","start":"npm run dev","start:https":"cross-env SSL=true npm run dev","test":"karma start ./tests/karma.conf.js","test:docs":"node scripts/docsLint.js","test:firefox":"npm test -- --browsers Firefox","test:chrome":"npm test -- --browsers Chrome","test:nobrowser":"NO_BROWSER=true npm test","test:node":"mocha --ui tdd tests/node"},"repository":"aframevr/aframe","license":"MIT","files":["dist/*","docs/**/*","src/**/*","vendor/**/*"],"dependencies":{"custom-event-polyfill":"^1.0.6","debug":"ngokevin/debug#noTimestamp","deep-assign":"^2.0.0","document-register-element":"dmarcos/document-register-element#8ccc532b7f3744be954574caf3072a5fd260ca90","load-bmfont":"^1.2.3","object-assign":"^4.0.1","present":"0.0.6","promise-polyfill":"^3.1.0","super-animejs":"^3.1.0","super-three":"^0.125.1","three-bmfont-text":"dmarcos/three-bmfont-text#1babdf8507c731a18f8af3b807292e2b9740955e","webvr-polyfill":"^0.10.12"},"devDependencies":{"browserify":"^13.1.0","browserify-css":"^0.8.4","browserify-derequire":"^0.9.4","browserify-istanbul":"^2.0.0","budo":"^9.2.0","chai":"^3.5.0","chai-shallow-deep-equal":"^1.4.0","chalk":"^1.1.3","codecov":"^1.0.1","cross-env":"^5.0.1","envify":"^3.4.1","exorcist":"^0.4.0","ghpages":"0.0.8","git-rev":"^0.2.1","glob":"^7.1.1","husky":"^0.11.7","istanbul":"^0.4.5","jsdom":"^9.11.0","karma":"1.4.1","karma-browserify":"^5.1.0","karma-chai-shallow-deep-equal":"0.0.4","karma-chrome-launcher":"^2.0.0","karma-coverage":"^1.1.1","karma-env-preprocessor":"^0.1.1","karma-firefox-launcher":"^1.2.0","karma-mocha":"^1.1.1","karma-mocha-reporter":"^2.1.0","karma-sinon-chai":"1.2.4","lolex":"^1.5.1","markserv":"github:sukima/markserv#feature/fix-broken-websoketio-link","minifyify":"^7.3.3","mocha":"^3.0.2","mozilla-download":"^1.1.1","replace-in-file":"^2.5.3","semistandard":"^9.0.0","shelljs":"^0.7.7","shx":"^0.2.2","sinon":"^1.17.5","sinon-chai":"2.8.0","snazzy":"^5.0.0","too-wordy":"ngokevin/too-wordy","uglifyjs":"^2.4.10","write-good":"^0.9.1"},"link":true,"browserify":{"transform":["browserify-css","envify"]},"semistandard":{"ignore":["build/**","dist/**","examples/**/shaders/*.js","**/vendor/**"]},"keywords":["3d","aframe","cardboard","components","oculus","three","three.js","rift","vive","vr","web-components","webvr"],"browserify-css":{"minify":true},"engines":{"node":">= 4.6.0","npm":"^2.15.9"}}
  1165. },{}],74:[function(_dereq_,module,exports){
  1166. function getPropertyType(t,e){var i,n,o,a;return o=e.split("."),n=o[0],a=o[1],i=t.components[n]||components[n],i?a&&!i.schema[a]?null:a?i.schema[a].type:i.schema.type:null}function toRadians(t){t.x=THREE.Math.degToRad(t.x),t.y=THREE.Math.degToRad(t.y),t.z=THREE.Math.degToRad(t.z)}function addEventListeners(t,e,i){var n;for(n=0;n<e.length;n++)t.addEventListener(e[n],i)}function removeEventListeners(t,e,i){var n;for(n=0;n<e.length;n++)t.removeEventListener(e[n],i)}function getRawProperty(t,e){var i,n,o;for(n=splitDot(e),o=t,i=0;i<n.length;i++)o=o[n[i]];if(void 0===o)throw console.log(t),new Error("[animation] property ("+e+") could not be found");return o}function setRawProperty(t,e,i,n){var o,a,r,s;for(e.startsWith("object3D.rotation")&&(i=THREE.Math.degToRad(i)),a=splitDot(e),s=t,o=0;o<a.length-1;o++)s=s[a[o]];if(r=a[a.length-1],n===TYPE_COLOR)return void("r"in s[r]?(s[r].r=i.r,s[r].g=i.g,s[r].b=i.b):(s[r].x=i.r,s[r].y=i.g,s[r].z=i.b));s[r]=i}function splitDot(t){return t in splitCache?splitCache[t]:(splitCache[t]=t.split("."),splitCache[t])}function isRawProperty(t){return t.isRawProperty||t.property.startsWith(STRING_COMPONENTS)||t.property.startsWith(STRING_OBJECT3D)}var anime=_dereq_("super-animejs"),components=_dereq_("../core/component").components,registerComponent=_dereq_("../core/component").registerComponent,THREE=_dereq_("../lib/three"),utils=_dereq_("../utils"),colorHelperFrom=new THREE.Color,colorHelperTo=new THREE.Color,getComponentProperty=utils.entity.getComponentProperty,setComponentProperty=utils.entity.setComponentProperty,splitCache={},TYPE_COLOR="color",PROP_POSITION="position",PROP_ROTATION="rotation",PROP_SCALE="scale",STRING_COMPONENTS="components",STRING_OBJECT3D="object3D";module.exports.Component=registerComponent("animation",{schema:{autoplay:{default:!0},delay:{default:0},dir:{default:""},dur:{default:1e3},easing:{default:"easeInQuad"},elasticity:{default:400},enabled:{default:!0},from:{default:""},loop:{default:0,parse:function(t){return!0===t||"true"===t||!1!==t&&"false"!==t&&parseInt(t,10)}},property:{default:""},startEvents:{type:"array"},pauseEvents:{type:"array"},resumeEvents:{type:"array"},round:{default:!1},to:{default:""},type:{default:""},isRawProperty:{default:!1}},multiple:!0,init:function(){var t=this;this.eventDetail={name:this.attrName},this.time=0,this.animation=null,this.animationIsPlaying=!1,this.onStartEvent=this.onStartEvent.bind(this),this.beginAnimation=this.beginAnimation.bind(this),this.pauseAnimation=this.pauseAnimation.bind(this),this.resumeAnimation=this.resumeAnimation.bind(this),this.fromColor={},this.toColor={},this.targets={},this.targetsArray=[],this.updateConfigForDefault=this.updateConfigForDefault.bind(this),this.updateConfigForRawColor=this.updateConfigForRawColor.bind(this),this.config={complete:function(){t.animationIsPlaying=!1,t.el.emit("animationcomplete",t.eventDetail,!1),t.id&&t.el.emit("animationcomplete__"+t.id,t.eventDetail,!1)}}},update:function(t){var e=this.config,i=this.data;this.animationIsPlaying=!1,this.data.enabled&&i.property&&(e.autoplay=!1,e.direction=i.dir,e.duration=i.dur,e.easing=i.easing,e.elasticity=i.elasticity,e.loop=i.loop,e.round=i.round,this.createAndStartAnimation())},tick:function(t,e){this.animationIsPlaying&&(this.time+=e,this.animation.tick(this.time))},remove:function(){this.pauseAnimation(),this.removeEventListeners()},pause:function(){this.paused=!0,this.pausedWasPlaying=this.animationIsPlaying,this.pauseAnimation(),this.removeEventListeners()},play:function(){this.paused&&(this.paused=!1,this.addEventListeners(),this.pausedWasPlaying&&(this.resumeAnimation(),this.pausedWasPlaying=!1))},createAndStartAnimation:function(){var t=this.data;if(this.updateConfig(),this.animationIsPlaying=!1,this.animation=anime(this.config),this.animation.began=!0,this.removeEventListeners(),this.addEventListeners(),!(!t.autoplay||t.startEvents&&t.startEvents.length))return t.delay?void setTimeout(this.beginAnimation,t.delay):void this.beginAnimation()},beginAnimation:function(){this.updateConfig(),this.animation.began=!0,this.time=0,this.animationIsPlaying=!0,this.stopRelatedAnimations(),this.el.emit("animationbegin",this.eventDetail,!1)},pauseAnimation:function(){this.animationIsPlaying=!1},resumeAnimation:function(){this.animationIsPlaying=!0},onStartEvent:function(){if(this.data.enabled){if(this.updateConfig(),this.animation&&this.animation.pause(),this.animation=anime(this.config),this.data.delay)return void setTimeout(this.beginAnimation,this.data.delay);this.beginAnimation()}},updateConfigForRawColor:function(){var t,e,i,n=this.config,o=this.data,a=this.el;if(!this.waitComponentInitRawProperty(this.updateConfigForRawColor)){t=""===o.from?getRawProperty(a,o.property):o.from,i=o.to,this.setColorConfig(t,i),t=this.fromColor,i=this.toColor,this.targetsArray.length=0,this.targetsArray.push(t),n.targets=this.targetsArray;for(e in i)n[e]=i[e];n.update=function(){var t={};return function(e){var i;i=e.animatables[0].target,i.r===t.r&&i.g===t.g&&i.b===t.b||setRawProperty(a,o.property,i,o.type)}}()}},updateConfigForDefault:function(){var t,e,i,n,o=this.config,a=this.data,r=this.el;this.waitComponentInitRawProperty(this.updateConfigForDefault)||(t=""===a.from?isRawProperty(a)?getRawProperty(r,a.property):getComponentProperty(r,a.property):a.from,n=a.to,i=!isNaN(t||n),i?(t=parseFloat(t),n=parseFloat(n)):(t=t?t.toString():t,n=n?n.toString():n),e="true"===a.to||"false"===a.to||!0===a.to||!1===a.to,e&&(t="true"===a.from||!0===a.from?1:0,n="true"===a.to||!0===a.to?1:0),this.targets.aframeProperty=t,o.targets=this.targets,o.aframeProperty=n,o.update=function(){var t;return function(i){var n;(n=i.animatables[0].target.aframeProperty)!==t&&(t=n,e&&(n=n>=1),isRawProperty(a)?setRawProperty(r,a.property,n,a.type):setComponentProperty(r,a.property,n))}}())},updateConfigForVector:function(){var t,e,i,n=this.config,o=this.data,a=this.el;e=""!==o.from?utils.coordinates.parse(o.from):getComponentProperty(a,o.property),i=utils.coordinates.parse(o.to),o.property===PROP_ROTATION&&(toRadians(e),toRadians(i)),this.targetsArray.length=0,this.targetsArray.push(e),n.targets=this.targetsArray;for(t in i)n[t]=i[t];if(o.property===PROP_POSITION||o.property===PROP_ROTATION||o.property===PROP_SCALE)return void(n.update=function(){var t={};return function(e){var i=e.animatables[0].target;o.property===PROP_SCALE&&(i.x=Math.max(1e-4,i.x),i.y=Math.max(1e-4,i.y),i.z=Math.max(1e-4,i.z)),i.x===t.x&&i.y===t.y&&i.z===t.z||(t.x=i.x,t.y=i.y,t.z=i.z,a.object3D[o.property].set(i.x,i.y,i.z))}}());n.update=function(){var t={};return function(e){var i=e.animatables[0].target;i.x===t.x&&i.y===t.y&&i.z===t.z||(t.x=i.x,t.y=i.y,t.z=i.z,setComponentProperty(a,o.property,i))}}()},updateConfig:function(){var t;t=getPropertyType(this.el,this.data.property),isRawProperty(this.data)&&this.data.type===TYPE_COLOR?this.updateConfigForRawColor():"vec2"===t||"vec3"===t||"vec4"===t?this.updateConfigForVector():this.updateConfigForDefault()},waitComponentInitRawProperty:function(t){var e,i=this.data,n=this.el,o=this;return""===i.from&&(!!i.property.startsWith(STRING_COMPONENTS)&&(e=splitDot(i.property)[1],!n.components[e]&&(n.addEventListener("componentinitialized",function i(a){a.detail.name===e&&(t(),o.animation=anime(o.config),n.removeEventListener("componentinitialized",i))}),!0)))},stopRelatedAnimations:function(){var t,e;for(e in this.el.components)t=this.el.components[e],e!==this.attrName&&"animation"===t.name&&t.animationIsPlaying&&t.data.property===this.data.property&&(t.animationIsPlaying=!1)},addEventListeners:function(){var t=this.data,e=this.el;addEventListeners(e,t.startEvents,this.onStartEvent),addEventListeners(e,t.pauseEvents,this.pauseAnimation),addEventListeners(e,t.resumeEvents,this.resumeAnimation)},removeEventListeners:function(){var t=this.data,e=this.el;removeEventListeners(e,t.startEvents,this.onStartEvent),removeEventListeners(e,t.pauseEvents,this.pauseAnimation),removeEventListeners(e,t.resumeEvents,this.resumeAnimation)},setColorConfig:function(t,e){colorHelperFrom.set(t),colorHelperTo.set(e),t=this.fromColor,e=this.toColor,t.r=colorHelperFrom.r,t.g=colorHelperFrom.g,t.b=colorHelperFrom.b,e.r=colorHelperTo.r,e.g=colorHelperTo.g,e.b=colorHelperTo.b}});
  1167. },{"../core/component":131,"../lib/three":179,"../utils":205,"super-animejs":56}],75:[function(_dereq_,module,exports){
  1168. var registerComponent=_dereq_("../core/component").registerComponent,THREE=_dereq_("../lib/three");module.exports.Component=registerComponent("camera",{schema:{active:{default:!0},far:{default:1e4},fov:{default:80,min:0},near:{default:.005,min:0},spectator:{default:!1},zoom:{default:1,min:0}},init:function(){var e,t=this.el;e=this.camera=new THREE.PerspectiveCamera,t.setObject3D("camera",e)},update:function(e){var t=this.data,a=this.camera;a.aspect=t.aspect||window.innerWidth/window.innerHeight,a.far=t.far,a.fov=t.fov,a.near=t.near,a.zoom=t.zoom,a.updateProjectionMatrix(),this.updateActiveCamera(e),this.updateSpectatorCamera(e)},updateActiveCamera:function(e){var t=this.data,a=this.el,r=this.system;e&&e.active===t.active||t.spectator||(t.active&&r.activeCameraEl!==a?r.setActiveCamera(a):t.active||r.activeCameraEl!==a||r.disableActiveCamera())},updateSpectatorCamera:function(e){var t=this.data,a=this.el,r=this.system;e&&e.spectator===t.spectator||(t.spectator&&r.spectatorCameraEl!==a?r.setSpectatorCamera(a):t.spectator||r.spectatorCameraEl!==a||r.disableSpectatorCamera())},remove:function(){this.el.removeObject3D("camera")}});
  1169. },{"../core/component":131,"../lib/three":179}],76:[function(_dereq_,module,exports){
  1170. var registerComponent=_dereq_("../core/component").registerComponent,utils=_dereq_("../utils/"),bind=utils.bind,EVENTS={CLICK:"click",FUSING:"fusing",MOUSEENTER:"mouseenter",MOUSEDOWN:"mousedown",MOUSELEAVE:"mouseleave",MOUSEUP:"mouseup"},STATES={FUSING:"cursor-fusing",HOVERING:"cursor-hovering",HOVERED:"cursor-hovered"},CANVAS_EVENTS={DOWN:["mousedown","touchstart"],UP:["mouseup","touchend"]},WEBXR_EVENTS={DOWN:["selectstart"],UP:["selectend"]},CANVAS_HOVER_CLASS="a-mouse-cursor-hover";module.exports.Component=registerComponent("cursor",{dependencies:["raycaster"],schema:{downEvents:{default:[]},fuse:{default:utils.device.isMobile()},fuseTimeout:{default:1500,min:0},mouseCursorStylesEnabled:{default:!0},upEvents:{default:[]},rayOrigin:{default:"entity",oneOf:["mouse","entity"]}},init:function(){var e=this;this.fuseTimeout=void 0,this.cursorDownEl=null,this.intersectedEl=null,this.canvasBounds=document.body.getBoundingClientRect(),this.isCursorDown=!1,this.updateCanvasBounds=utils.debounce(function(){e.canvasBounds=e.el.sceneEl.canvas.getBoundingClientRect()},500),this.eventDetail={},this.intersectedEventDetail={cursorEl:this.el},this.onCursorDown=bind(this.onCursorDown,this),this.onCursorUp=bind(this.onCursorUp,this),this.onIntersection=bind(this.onIntersection,this),this.onIntersectionCleared=bind(this.onIntersectionCleared,this),this.onMouseMove=bind(this.onMouseMove,this),this.onEnterVR=bind(this.onEnterVR,this)},update:function(e){this.data.rayOrigin!==e.rayOrigin&&this.updateMouseEventListeners()},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},remove:function(){var e=this.el;e.removeState(STATES.HOVERING),e.removeState(STATES.FUSING),clearTimeout(this.fuseTimeout),this.intersectedEl&&this.intersectedEl.removeState(STATES.HOVERED),this.removeEventListeners()},addEventListeners:function(){function e(){t=s.sceneEl.canvas,n.downEvents.length||n.upEvents.length||(CANVAS_EVENTS.DOWN.forEach(function(e){t.addEventListener(e,i.onCursorDown)}),CANVAS_EVENTS.UP.forEach(function(e){t.addEventListener(e,i.onCursorUp)}))}var t,n=this.data,s=this.el,i=this;t=s.sceneEl.canvas,t?e():s.sceneEl.addEventListener("render-target-loaded",e),n.downEvents.forEach(function(e){s.addEventListener(e,i.onCursorDown)}),n.upEvents.forEach(function(e){s.addEventListener(e,i.onCursorUp)}),s.addEventListener("raycaster-intersection",this.onIntersection),s.addEventListener("raycaster-intersection-cleared",this.onIntersectionCleared),s.sceneEl.addEventListener("rendererresize",this.updateCanvasBounds),s.sceneEl.addEventListener("enter-vr",this.onEnterVR),window.addEventListener("resize",this.updateCanvasBounds),window.addEventListener("scroll",this.updateCanvasBounds),this.updateMouseEventListeners()},removeEventListeners:function(){var e,t=this.data,n=this.el,s=this;e=n.sceneEl.canvas,!e||t.downEvents.length||t.upEvents.length||(CANVAS_EVENTS.DOWN.forEach(function(t){e.removeEventListener(t,s.onCursorDown)}),CANVAS_EVENTS.UP.forEach(function(t){e.removeEventListener(t,s.onCursorUp)})),t.downEvents.forEach(function(e){n.removeEventListener(e,s.onCursorDown)}),t.upEvents.forEach(function(e){n.removeEventListener(e,s.onCursorUp)}),n.removeEventListener("raycaster-intersection",this.onIntersection),n.removeEventListener("raycaster-intersection-cleared",this.onIntersectionCleared),e.removeEventListener("mousemove",this.onMouseMove),e.removeEventListener("touchstart",this.onMouseMove),e.removeEventListener("touchmove",this.onMouseMove),n.sceneEl.removeEventListener("rendererresize",this.updateCanvasBounds),n.sceneEl.removeEventListener("enter-vr",this.onEnterVR),window.removeEventListener("resize",this.updateCanvasBounds),window.removeEventListener("scroll",this.updateCanvasBounds)},updateMouseEventListeners:function(){var e,t=this.el;e=t.sceneEl.canvas,e.removeEventListener("mousemove",this.onMouseMove),e.removeEventListener("touchmove",this.onMouseMove),t.setAttribute("raycaster","useWorldCoordinates",!1),"mouse"===this.data.rayOrigin&&(e.addEventListener("mousemove",this.onMouseMove,!1),e.addEventListener("touchmove",this.onMouseMove,!1),t.setAttribute("raycaster","useWorldCoordinates",!0),this.updateCanvasBounds())},onMouseMove:function(){var e=new THREE.Vector3,t=new THREE.Vector2,n=new THREE.Vector3,s={origin:n,direction:e};return function(i){var o,r,a,E=this.canvasBounds,u=this.el.sceneEl.camera;u.parent.updateMatrixWorld(),r="touchmove"===i.type||"touchstart"===i.type?i.touches.item(0):i,o=r.clientX-E.left,a=r.clientY-E.top,t.x=o/E.width*2-1,t.y=-a/E.height*2+1,n.setFromMatrixPosition(u.matrixWorld),e.set(t.x,t.y,.5).unproject(u).sub(n).normalize(),this.el.setAttribute("raycaster",s),"touchmove"===i.type&&i.preventDefault()}}(),onCursorDown:function(e){this.isCursorDown=!0,"mouse"===this.data.rayOrigin&&"touchstart"===e.type&&(this.onMouseMove(e),this.el.components.raycaster.checkIntersections(),e.preventDefault()),this.twoWayEmit(EVENTS.MOUSEDOWN),this.cursorDownEl=this.intersectedEl},onCursorUp:function(e){if(this.isCursorDown){this.isCursorDown=!1;var t=this.data;this.twoWayEmit(EVENTS.MOUSEUP),this.cursorDownEl&&this.cursorDownEl!==this.intersectedEl&&(this.intersectedEventDetail.intersection=null,this.cursorDownEl.emit(EVENTS.MOUSEUP,this.intersectedEventDetail)),t.fuse&&"mouse"!==t.rayOrigin||!this.intersectedEl||this.cursorDownEl!==this.intersectedEl||this.twoWayEmit(EVENTS.CLICK),this.cursorDownEl=null,"touchend"===e.type&&e.preventDefault()}},onIntersection:function(e){var t,n,s,i,o=this.el;n=e.detail.els[0]===o?1:0,i=e.detail.intersections[n],(s=e.detail.els[n])&&this.intersectedEl!==s&&(this.intersectedEl&&(t=this.el.components.raycaster.getIntersection(this.intersectedEl))&&t.distance<=i.distance||(this.clearCurrentIntersection(!0),this.setIntersection(s,i)))},onIntersectionCleared:function(e){-1!==e.detail.clearedEls.indexOf(this.intersectedEl)&&this.clearCurrentIntersection()},onEnterVR:function(){this.clearCurrentIntersection(!0);var e=this.el.sceneEl.xrSession,t=this;e&&"mouse"!==this.data.rayOrigin&&(WEBXR_EVENTS.DOWN.forEach(function(n){e.addEventListener(n,t.onCursorDown)}),WEBXR_EVENTS.UP.forEach(function(n){e.addEventListener(n,t.onCursorUp)}))},setIntersection:function(e,t){var n=this.el,s=this.data,i=this;this.intersectedEl!==e&&(this.intersectedEl=e,n.addState(STATES.HOVERING),e.addState(STATES.HOVERED),this.twoWayEmit(EVENTS.MOUSEENTER),this.data.mouseCursorStylesEnabled&&"mouse"===this.data.rayOrigin&&this.el.sceneEl.canvas.classList.add(CANVAS_HOVER_CLASS),0!==s.fuseTimeout&&s.fuse&&(n.addState(STATES.FUSING),this.twoWayEmit(EVENTS.FUSING),this.fuseTimeout=setTimeout(function(){n.removeState(STATES.FUSING),i.twoWayEmit(EVENTS.CLICK)},s.fuseTimeout)))},clearCurrentIntersection:function(e){var t,n,s,i=this.el;this.intersectedEl&&(this.intersectedEl.removeState(STATES.HOVERED),i.removeState(STATES.HOVERING),i.removeState(STATES.FUSING),this.twoWayEmit(EVENTS.MOUSELEAVE),this.data.mouseCursorStylesEnabled&&"mouse"===this.data.rayOrigin&&this.el.sceneEl.canvas.classList.remove(CANVAS_HOVER_CLASS),this.intersectedEl=null,clearTimeout(this.fuseTimeout),!0!==e&&(s=this.el.components.raycaster.intersections,0!==s.length&&(t=s[0].object.el===i?1:0,(n=s[t])&&this.setIntersection(n.object.el,n))))},twoWayEmit:function(e){var t,n=this.el,s=this.intersectedEl;t=this.el.components.raycaster.getIntersection(s),this.eventDetail.intersectedEl=s,this.eventDetail.intersection=t,n.emit(e,this.eventDetail),s&&(this.intersectedEventDetail.intersection=t,s.emit(e,this.intersectedEventDetail))}});
  1171. },{"../core/component":131,"../utils/":205}],77:[function(_dereq_,module,exports){
  1172. var registerComponent=_dereq_("../core/component").registerComponent,bind=_dereq_("../utils/bind"),trackedControlsUtils=_dereq_("../utils/tracked-controls"),checkControllerPresentAndSetup=trackedControlsUtils.checkControllerPresentAndSetup,emitIfAxesChanged=trackedControlsUtils.emitIfAxesChanged,onButtonEvent=trackedControlsUtils.onButtonEvent,DAYDREAM_CONTROLLER_MODEL_BASE_URL="https://cdn.aframe.io/controllers/google/",DAYDREAM_CONTROLLER_MODEL_OBJ_URL=DAYDREAM_CONTROLLER_MODEL_BASE_URL+"vr_controller_daydream.obj",DAYDREAM_CONTROLLER_MODEL_OBJ_MTL=DAYDREAM_CONTROLLER_MODEL_BASE_URL+"vr_controller_daydream.mtl",isWebXRAvailable=_dereq_("../utils/").device.isWebXRAvailable,GAMEPAD_ID_WEBXR="google-daydream",GAMEPAD_ID_WEBVR="Daydream Controller",GAMEPAD_ID_PREFIX=isWebXRAvailable?GAMEPAD_ID_WEBXR:GAMEPAD_ID_WEBVR,INPUT_MAPPING_WEBVR={axes:{trackpad:[0,1]},buttons:["trackpad","menu","system"]},INPUT_MAPPING_WEBXR={axes:{touchpad:[0,1]},buttons:["none","none","touchpad","menu","system"]},INPUT_MAPPING=isWebXRAvailable?INPUT_MAPPING_WEBXR:INPUT_MAPPING_WEBVR;module.exports.Component=registerComponent("daydream-controls",{schema:{hand:{default:""},buttonColor:{type:"color",default:"#000000"},buttonTouchedColor:{type:"color",default:"#777777"},buttonHighlightColor:{type:"color",default:"#FFFFFF"},model:{default:!0},orientationOffset:{type:"vec3"},armModel:{default:!0}},mapping:INPUT_MAPPING,bindMethods:function(){this.onModelLoaded=bind(this.onModelLoaded,this),this.onControllersUpdate=bind(this.onControllersUpdate,this),this.checkIfControllerPresent=bind(this.checkIfControllerPresent,this),this.removeControllersUpdateListener=bind(this.removeControllersUpdateListener,this),this.onAxisMoved=bind(this.onAxisMoved,this)},init:function(){var t=this;this.onButtonChanged=bind(this.onButtonChanged,this),this.onButtonDown=function(e){onButtonEvent(e.detail.id,"down",t)},this.onButtonUp=function(e){onButtonEvent(e.detail.id,"up",t)},this.onButtonTouchStart=function(e){onButtonEvent(e.detail.id,"touchstart",t)},this.onButtonTouchEnd=function(e){onButtonEvent(e.detail.id,"touchend",t)},this.controllerPresent=!1,this.lastControllerCheck=0,this.bindMethods()},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("model-loaded",this.onModelLoaded),t.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("model-loaded",this.onModelLoaded),t.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){checkControllerPresentAndSetup(this,GAMEPAD_ID_PREFIX,this.data.hand?{hand:this.data.hand}:{})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{armModel:e.armModel,hand:e.hand,idPrefix:GAMEPAD_ID_PREFIX,id:GAMEPAD_ID_PREFIX,orientationOffset:e.orientationOffset}),this.data.model&&this.el.setAttribute("obj-model",{obj:DAYDREAM_CONTROLLER_MODEL_OBJ_URL,mtl:DAYDREAM_CONTROLLER_MODEL_OBJ_MTL})},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelLoaded:function(t){var e,o=t.detail.model;this.data.model&&(e=this.buttonMeshes={},e.menu=o.getObjectByName("AppButton_AppButton_Cylinder.004"),e.system=o.getObjectByName("HomeButton_HomeButton_Cylinder.005"),e.trackpad=o.getObjectByName("TouchPad_TouchPad_Cylinder.003"),e.touchpad=o.getObjectByName("TouchPad_TouchPad_Cylinder.003"),o.position.set(0,0,-.04))},onAxisMoved:function(t){emitIfAxesChanged(this,this.mapping.axes,t)},onButtonChanged:function(t){var e=this.mapping.buttons[t.detail.id];e&&this.el.emit(e+"changed",t.detail.state)},updateModel:function(t,e){this.data.model&&this.updateButtonModel(t,e)},updateButtonModel:function(t,e){var o=this.buttonMeshes;if(o&&o[t]){var n;switch(e){case"down":n=this.data.buttonHighlightColor;break;case"touchstart":n=this.data.buttonTouchedColor;break;default:n=this.data.buttonColor}o[t].material.color.set(n)}}});
  1173. },{"../core/component":131,"../utils/":205,"../utils/bind":199,"../utils/tracked-controls":214}],78:[function(_dereq_,module,exports){
  1174. var registerComponent=_dereq_("../core/component").registerComponent,bind=_dereq_("../utils/bind"),trackedControlsUtils=_dereq_("../utils/tracked-controls"),checkControllerPresentAndSetup=trackedControlsUtils.checkControllerPresentAndSetup,emitIfAxesChanged=trackedControlsUtils.emitIfAxesChanged,onButtonEvent=trackedControlsUtils.onButtonEvent,isWebXRAvailable=_dereq_("../utils/").device.isWebXRAvailable,GEARVR_CONTROLLER_MODEL_BASE_URL="https://cdn.aframe.io/controllers/samsung/",GEARVR_CONTROLLER_MODEL_OBJ_URL=GEARVR_CONTROLLER_MODEL_BASE_URL+"gear_vr_controller.obj",GEARVR_CONTROLLER_MODEL_OBJ_MTL=GEARVR_CONTROLLER_MODEL_BASE_URL+"gear_vr_controller.mtl",GAMEPAD_ID_WEBXR="samsung-gearvr",GAMEPAD_ID_WEBVR="Gear VR",GAMEPAD_ID_PREFIX=isWebXRAvailable?GAMEPAD_ID_WEBXR:GAMEPAD_ID_WEBVR,INPUT_MAPPING_WEBVR={axes:{trackpad:[0,1]},buttons:["trackpad","trigger"]},INPUT_MAPPING_WEBXR={axes:{touchpad:[0,1]},buttons:["trigger","none","touchpad","none","menu"]},INPUT_MAPPING=isWebXRAvailable?INPUT_MAPPING_WEBXR:INPUT_MAPPING_WEBVR;module.exports.Component=registerComponent("gearvr-controls",{schema:{hand:{default:""},buttonColor:{type:"color",default:"#000000"},buttonTouchedColor:{type:"color",default:"#777777"},buttonHighlightColor:{type:"color",default:"#FFFFFF"},model:{default:!0},orientationOffset:{type:"vec3"},armModel:{default:!0}},mapping:INPUT_MAPPING,bindMethods:function(){this.onModelLoaded=bind(this.onModelLoaded,this),this.onControllersUpdate=bind(this.onControllersUpdate,this),this.checkIfControllerPresent=bind(this.checkIfControllerPresent,this),this.removeControllersUpdateListener=bind(this.removeControllersUpdateListener,this),this.onAxisMoved=bind(this.onAxisMoved,this)},init:function(){var t=this;this.onButtonChanged=bind(this.onButtonChanged,this),this.onButtonDown=function(e){onButtonEvent(e.detail.id,"down",t)},this.onButtonUp=function(e){onButtonEvent(e.detail.id,"up",t)},this.onButtonTouchStart=function(e){onButtonEvent(e.detail.id,"touchstart",t)},this.onButtonTouchEnd=function(e){onButtonEvent(e.detail.id,"touchend",t)},this.controllerPresent=!1,this.lastControllerCheck=0,this.bindMethods()},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("model-loaded",this.onModelLoaded),t.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("model-loaded",this.onModelLoaded),t.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){checkControllerPresentAndSetup(this,GAMEPAD_ID_PREFIX,this.data.hand?{hand:this.data.hand}:{})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{armModel:e.armModel,hand:e.hand,idPrefix:GAMEPAD_ID_PREFIX,id:GAMEPAD_ID_PREFIX,orientationOffset:e.orientationOffset}),this.data.model&&this.el.setAttribute("obj-model",{obj:GEARVR_CONTROLLER_MODEL_OBJ_URL,mtl:GEARVR_CONTROLLER_MODEL_OBJ_MTL})},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelLoaded:function(t){var e,n=t.detail.model;this.data.model&&(e=this.buttonMeshes={},e.trigger=n.children[2],e.trackpad=n.children[1],e.touchpad=n.children[1])},onButtonChanged:function(t){var e=this.mapping.buttons[t.detail.id];e&&this.el.emit(e+"changed",t.detail.state)},onAxisMoved:function(t){emitIfAxesChanged(this,this.mapping.axes,t)},updateModel:function(t,e){this.data.model&&this.updateButtonModel(t,e)},updateButtonModel:function(t,e){var n=this.buttonMeshes;if(n&&n[t]){var o;switch(e){case"down":o=this.data.buttonHighlightColor;break;case"touchstart":o=this.data.buttonTouchedColor;break;default:o=this.data.buttonColor}n[t].material.color.set(o)}}});
  1175. },{"../core/component":131,"../utils/":205,"../utils/bind":199,"../utils/tracked-controls":214}],79:[function(_dereq_,module,exports){
  1176. var registerComponent=_dereq_("../core/component").registerComponent,bind=_dereq_("../utils/bind"),trackedControlsUtils=_dereq_("../utils/tracked-controls"),checkControllerPresentAndSetup=trackedControlsUtils.checkControllerPresentAndSetup,emitIfAxesChanged=trackedControlsUtils.emitIfAxesChanged,onButtonEvent=trackedControlsUtils.onButtonEvent,GAMEPAD_ID_PREFIX="generic",INPUT_MAPPING={axes:{touchpad:[0,1],thumbstick:[2,3]},buttons:["trigger","squeeze","touchpad","thumbstick"]};module.exports.Component=registerComponent("generic-tracked-controller-controls",{schema:{hand:{default:""},defaultModel:{default:!0},defaultModelColor:{default:"gray"},orientationOffset:{type:"vec3"},disabled:{default:!1}},mapping:INPUT_MAPPING,bindMethods:function(){this.onControllersUpdate=bind(this.onControllersUpdate,this),this.checkIfControllerPresent=bind(this.checkIfControllerPresent,this),this.removeControllersUpdateListener=bind(this.removeControllersUpdateListener,this),this.onAxisMoved=bind(this.onAxisMoved,this)},init:function(){var t=this;this.onButtonChanged=bind(this.onButtonChanged,this),this.onButtonDown=function(e){onButtonEvent(e.detail.id,"down",t)},this.onButtonUp=function(e){onButtonEvent(e.detail.id,"up",t)},this.onButtonTouchStart=function(e){onButtonEvent(e.detail.id,"touchstart",t)},this.onButtonTouchEnd=function(e){onButtonEvent(e.detail.id,"touchend",t)},this.controllerPresent=!1,this.wasControllerConnected=!1,this.lastControllerCheck=0,this.rendererSystem=this.el.sceneEl.systems.renderer,this.bindMethods(),this.el.addEventListener("controllerconnected",function(e){e.detail.name!==t.name&&(t.wasControllerConnected=!0,t.removeEventListeners(),t.removeControllersUpdateListener())})},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var t=this.data,e=t.hand?t.hand:void 0;checkControllerPresentAndSetup(this,GAMEPAD_ID_PREFIX,{hand:e,iterateControllerProfiles:!0})},play:function(){this.wasControllerConnected||(this.checkIfControllerPresent(),this.addControllersUpdateListener())},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var t=this.el,e=this.data;if(this.el.components["tracked-controls"])return void this.removeEventListeners();t.setAttribute("tracked-controls",{hand:e.hand,idPrefix:GAMEPAD_ID_PREFIX,orientationOffset:e.orientationOffset,iterateControllerProfiles:!0}),this.data.defaultModel&&this.initDefaultModel()},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(t){var e=this.mapping.buttons[t.detail.id];e&&this.el.emit(e+"changed",t.detail.state)},onAxisMoved:function(t){emitIfAxesChanged(this,this.mapping.axes,t)},initDefaultModel:function(){var t=this.modelEl=document.createElement("a-entity");t.setAttribute("geometry",{primitive:"sphere",radius:.03}),t.setAttribute("material",{color:this.data.color}),this.el.appendChild(t)}});
  1177. },{"../core/component":131,"../utils/bind":199,"../utils/tracked-controls":214}],80:[function(_dereq_,module,exports){
  1178. var geometries=_dereq_("../core/geometry").geometries,geometryNames=_dereq_("../core/geometry").geometryNames,registerComponent=_dereq_("../core/component").registerComponent,THREE=_dereq_("../lib/three"),dummyGeometry=new THREE.BufferGeometry;module.exports.Component=registerComponent("geometry",{schema:{buffer:{default:!0},primitive:{default:"box",oneOf:geometryNames,schemaChange:!0},skipCache:{default:!1}},init:function(){this.geometry=null},update:function(e){var t,r=this.data,m=this.el,o=this.system;this.geometry&&(o.unuseGeometry(e),this.geometry=null),this.geometry=o.getOrCreateGeometry(r),t=m.getObject3D("mesh"),t?t.geometry=this.geometry:(t=new THREE.Mesh,t.geometry=this.geometry,this.el.getAttribute("material")||(t.material=new THREE.MeshStandardMaterial({color:16777215*Math.random(),metalness:0,roughness:.5})),m.setObject3D("mesh",t))},remove:function(){this.system.unuseGeometry(this.data),this.el.getObject3D("mesh").geometry=dummyGeometry,this.geometry=null},updateSchema:function(e){var t=this.oldData&&this.oldData.primitive,r=e.primitive,m=geometries[r]&&geometries[r].schema;if(!m)throw new Error("Unknown geometry schema `"+r+"`");t&&t===r||this.extendSchema(m)}});
  1179. },{"../core/component":131,"../core/geometry":132,"../lib/three":179}],81:[function(_dereq_,module,exports){
  1180. var registerComponent=_dereq_("../core/component").registerComponent,THREE=_dereq_("../lib/three"),utils=_dereq_("../utils/"),warn=utils.debug("components:gltf-model:warn");module.exports.Component=registerComponent("gltf-model",{schema:{type:"model"},init:function(){var e=this.system.getDRACOLoader();this.model=null,this.loader=new THREE.GLTFLoader,e&&this.loader.setDRACOLoader(e)},update:function(){var e=this,o=this.el,t=this.data;t&&(this.remove(),this.loader.load(t,function(t){e.model=t.scene||t.scenes[0],e.model.animations=t.animations,o.setObject3D("mesh",e.model),o.emit("model-loaded",{format:"gltf",model:e.model})},void 0,function(e){var r=e&&e.message?e.message:"Failed to load glTF model";warn(r),o.emit("model-error",{format:"gltf",src:t})}))},remove:function(){this.model&&this.el.removeObject3D("mesh")}});
  1181. },{"../core/component":131,"../lib/three":179,"../utils/":205}],82:[function(_dereq_,module,exports){
  1182. function getGestureEventName(t,e){var n;if(t)return n=EVENTS[t],"grip"===n?n+(e?"close":"open"):"point"===n?n+(e?"up":"down"):"pointing"===n||"pistol"===n?n+(e?"start":"end"):void 0}function isViveController(t){var e=t&&t.controller;return e&&(e.id&&0===e.id.indexOf("OpenVR ")||e.profiles&&e.profiles[0]&&"htc-vive-controller-mv"===e.profiles[0])}var registerComponent=_dereq_("../core/component").registerComponent,MODEL_URLS={toonLeft:"https://cdn.aframe.io/controllers/hands/leftHand.glb",toonRight:"https://cdn.aframe.io/controllers/hands/rightHand.glb",lowPolyLeft:"https://cdn.aframe.io/controllers/hands/leftHandLow.glb",lowPolyRight:"https://cdn.aframe.io/controllers/hands/rightHandLow.glb",highPolyLeft:"https://cdn.aframe.io/controllers/hands/leftHandHigh.glb",highPolyRight:"https://cdn.aframe.io/controllers/hands/rightHandHigh.glb"},ANIMATIONS={open:"Open",point:"Point",pointThumb:"Point + Thumb",fist:"Fist",hold:"Hold",thumbUp:"Thumb Up"},EVENTS={};EVENTS[ANIMATIONS.fist]="grip",EVENTS[ANIMATIONS.thumbUp]="pistol",EVENTS[ANIMATIONS.point]="pointing",module.exports.Component=registerComponent("hand-controls",{schema:{color:{default:"white",type:"color"},hand:{default:"left"},handModelStyle:{default:"lowPoly",oneOf:["lowPoly","highPoly","toon"]}},init:function(){var t=this,e=this.el;this.gesture=ANIMATIONS.open,this.pressedButtons={},this.touchedButtons={},this.loader=new THREE.GLTFLoader,this.loader.setCrossOrigin("anonymous"),this.onGripDown=function(){t.handleButton("grip","down")},this.onGripUp=function(){t.handleButton("grip","up")},this.onTrackpadDown=function(){t.handleButton("trackpad","down")},this.onTrackpadUp=function(){t.handleButton("trackpad","up")},this.onTrackpadTouchStart=function(){t.handleButton("trackpad","touchstart")},this.onTrackpadTouchEnd=function(){t.handleButton("trackpad","touchend")},this.onTriggerDown=function(){t.handleButton("trigger","down")},this.onTriggerUp=function(){t.handleButton("trigger","up")},this.onTriggerTouchStart=function(){t.handleButton("trigger","touchstart")},this.onTriggerTouchEnd=function(){t.handleButton("trigger","touchend")},this.onGripTouchStart=function(){t.handleButton("grip","touchstart")},this.onGripTouchEnd=function(){t.handleButton("grip","touchend")},this.onThumbstickDown=function(){t.handleButton("thumbstick","down")},this.onThumbstickUp=function(){t.handleButton("thumbstick","up")},this.onAorXTouchStart=function(){t.handleButton("AorX","touchstart")},this.onAorXTouchEnd=function(){t.handleButton("AorX","touchend")},this.onBorYTouchStart=function(){t.handleButton("BorY","touchstart")},this.onBorYTouchEnd=function(){t.handleButton("BorY","touchend")},this.onSurfaceTouchStart=function(){t.handleButton("surface","touchstart")},this.onSurfaceTouchEnd=function(){t.handleButton("surface","touchend")},this.onControllerConnected=this.onControllerConnected.bind(this),this.onControllerDisconnected=this.onControllerDisconnected.bind(this),e.addEventListener("controllerconnected",this.onControllerConnected),e.addEventListener("controllerdisconnected",this.onControllerDisconnected),e.object3D.visible=!1},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},tick:function(t,e){var n=this.el.getObject3D("mesh");n&&n.mixer&&n.mixer.update(e/1e3)},onControllerConnected:function(){this.el.object3D.visible=!0},onControllerDisconnected:function(){this.el.object3D.visible=!1},addEventListeners:function(){var t=this.el;t.addEventListener("gripdown",this.onGripDown),t.addEventListener("gripup",this.onGripUp),t.addEventListener("trackpaddown",this.onTrackpadDown),t.addEventListener("trackpadup",this.onTrackpadUp),t.addEventListener("trackpadtouchstart",this.onTrackpadTouchStart),t.addEventListener("trackpadtouchend",this.onTrackpadTouchEnd),t.addEventListener("triggerdown",this.onTriggerDown),t.addEventListener("triggerup",this.onTriggerUp),t.addEventListener("triggertouchstart",this.onTriggerTouchStart),t.addEventListener("triggertouchend",this.onTriggerTouchEnd),t.addEventListener("griptouchstart",this.onGripTouchStart),t.addEventListener("griptouchend",this.onGripTouchEnd),t.addEventListener("thumbstickdown",this.onThumbstickDown),t.addEventListener("thumbstickup",this.onThumbstickUp),t.addEventListener("abuttontouchstart",this.onAorXTouchStart),t.addEventListener("abuttontouchend",this.onAorXTouchEnd),t.addEventListener("bbuttontouchstart",this.onBorYTouchStart),t.addEventListener("bbuttontouchend",this.onBorYTouchEnd),t.addEventListener("xbuttontouchstart",this.onAorXTouchStart),t.addEventListener("xbuttontouchend",this.onAorXTouchEnd),t.addEventListener("ybuttontouchstart",this.onBorYTouchStart),t.addEventListener("ybuttontouchend",this.onBorYTouchEnd),t.addEventListener("surfacetouchstart",this.onSurfaceTouchStart),t.addEventListener("surfacetouchend",this.onSurfaceTouchEnd)},removeEventListeners:function(){var t=this.el;t.removeEventListener("gripdown",this.onGripDown),t.removeEventListener("gripup",this.onGripUp),t.removeEventListener("trackpaddown",this.onTrackpadDown),t.removeEventListener("trackpadup",this.onTrackpadUp),t.removeEventListener("trackpadtouchstart",this.onTrackpadTouchStart),t.removeEventListener("trackpadtouchend",this.onTrackpadTouchEnd),t.removeEventListener("triggerdown",this.onTriggerDown),t.removeEventListener("triggerup",this.onTriggerUp),t.removeEventListener("triggertouchstart",this.onTriggerTouchStart),t.removeEventListener("triggertouchend",this.onTriggerTouchEnd),t.removeEventListener("griptouchstart",this.onGripTouchStart),t.removeEventListener("griptouchend",this.onGripTouchEnd),t.removeEventListener("thumbstickdown",this.onThumbstickDown),t.removeEventListener("thumbstickup",this.onThumbstickUp),t.removeEventListener("abuttontouchstart",this.onAorXTouchStart),t.removeEventListener("abuttontouchend",this.onAorXTouchEnd),t.removeEventListener("bbuttontouchstart",this.onBorYTouchStart),t.removeEventListener("bbuttontouchend",this.onBorYTouchEnd),t.removeEventListener("xbuttontouchstart",this.onAorXTouchStart),t.removeEventListener("xbuttontouchend",this.onAorXTouchEnd),t.removeEventListener("ybuttontouchstart",this.onBorYTouchStart),t.removeEventListener("ybuttontouchend",this.onBorYTouchEnd),t.removeEventListener("surfacetouchstart",this.onSurfaceTouchStart),t.removeEventListener("surfacetouchend",this.onSurfaceTouchEnd)},update:function(t){var e,n=this.el,o=this.data.hand,i=this.data.handModelStyle,r=this.data.color,s=this;if(e={hand:o,model:!1},o!==t){var h=MODEL_URLS[i+o.charAt(0).toUpperCase()+o.slice(1)];this.loader.load(h,function(t){var i=t.scene.children[0],h="left"===o?Math.PI/2:-Math.PI/2;i.mixer=new THREE.AnimationMixer(i),s.clips=t.animations,n.setObject3D("mesh",i),i.children[1].material.color=new THREE.Color(r),i.position.set(0,0,0),i.rotation.set(0,0,h),n.setAttribute("magicleap-controls",e),n.setAttribute("vive-controls",e),n.setAttribute("oculus-touch-controls",e),n.setAttribute("windows-motion-controls",e)})}},remove:function(){this.el.removeObject3D("mesh")},handleButton:function(t,e){var n,o="down"===e,i="touchstart"===e;if(0===e.indexOf("touch")){if(i===this.touchedButtons[t])return;this.touchedButtons[t]=i}else{if(o===this.pressedButtons[t])return;this.pressedButtons[t]=o}n=this.gesture,this.gesture=this.determineGesture(),this.gesture!==n&&(this.animateGesture(this.gesture,n),this.emitGestureEvents(this.gesture,n))},determineGesture:function(){var t,e=this.pressedButtons.grip,n=this.pressedButtons.surface||this.touchedButtons.surface,o=this.pressedButtons.trackpad||this.touchedButtons.trackpad,i=this.pressedButtons.trigger||this.touchedButtons.trigger,r=this.touchedButtons.AorX||this.touchedButtons.BorY;return isViveController(this.el.components["tracked-controls"])?e||i?t=ANIMATIONS.fist:o&&(t=ANIMATIONS.point):e?t=n||r||o?i?ANIMATIONS.fist:ANIMATIONS.point:i?ANIMATIONS.thumbUp:ANIMATIONS.pointThumb:i&&(t=ANIMATIONS.hold),t},getClip:function(t){var e,n;for(n=0;n<this.clips.length;n++)if(e=this.clips[n],e.name===t)return e},animateGesture:function(t,e){if(t)return void this.playAnimation(t||ANIMATIONS.open,e,!1);this.playAnimation(e,e,!0)},emitGestureEvents:function(t,e){var n,o=this.el;e!==t&&(n=getGestureEventName(e,!1),n&&o.emit(n),(n=getGestureEventName(t,!0))&&o.emit(n))},playAnimation:function(t,e,n){var o,i,r,s=this.el.getObject3D("mesh");if(s){if(s.mixer.stopAllAction(),o=this.getClip(t),r=s.mixer.clipAction(o),r.clampWhenFinished=!0,r.loop=THREE.LoopRepeat,r.repetitions=0,r.timeScale=n?-1:1,r.time=n?o.duration:0,r.weight=1,!e||t===e)return s.mixer.stopAllAction(),void r.play();o=this.getClip(e),i=s.mixer.clipAction(o),i.weight=.15,i.play(),r.play(),i.crossFadeTo(r,.15,!0)}}});
  1183. },{"../core/component":131}],83:[function(_dereq_,module,exports){
  1184. /* global THREE, XRRigidTransform */
  1185. var registerComponent = _dereq_('../core/component').registerComponent;
  1186. var bind = _dereq_('../utils/bind');
  1187. var trackedControlsUtils = _dereq_('../utils/tracked-controls');
  1188. var checkControllerPresentAndSetup = trackedControlsUtils.checkControllerPresentAndSetup;
  1189. var LEFT_HAND_MODEL_URL = 'https://cdn.aframe.io/controllers/oculus-hands/unity/left.glb';
  1190. var RIGHT_HAND_MODEL_URL = 'https://cdn.aframe.io/controllers/oculus-hands/unity/right.glb';
  1191. var BONE_PREFIX = {
  1192. left: 'b_l_',
  1193. right: 'b_r_'
  1194. };
  1195. var JOINTS = [
  1196. 'wrist',
  1197. 'thumb-metacarpal',
  1198. 'thumb-phalanx-proximal',
  1199. 'thumb-phalanx-distal',
  1200. 'thumb-tip',
  1201. 'index-finger-metacarpal',
  1202. 'index-finger-phalanx-proximal',
  1203. 'index-finger-phalanx-intermediate',
  1204. 'index-finger-phalanx-distal',
  1205. 'index-finger-tip',
  1206. 'middle-finger-metacarpal',
  1207. 'middle-finger-phalanx-proximal',
  1208. 'middle-finger-phalanx-intermediate',
  1209. 'middle-finger-phalanx-distal',
  1210. 'middle-finger-tip',
  1211. 'ring-finger-metacarpal',
  1212. 'ring-finger-phalanx-proximal',
  1213. 'ring-finger-phalanx-intermediate',
  1214. 'ring-finger-phalanx-distal',
  1215. 'ring-finger-tip',
  1216. 'pinky-finger-metacarpal',
  1217. 'pinky-finger-phalanx-proximal',
  1218. 'pinky-finger-phalanx-intermediate',
  1219. 'pinky-finger-phalanx-distal',
  1220. 'pinky-finger-tip'
  1221. ];
  1222. var BONE_MAPPING = {
  1223. 'wrist': 'wrist',
  1224. 'thumb-metacarpal': 'thumb1',
  1225. 'thumb-phalanx-proximal': 'thumb2',
  1226. 'thumb-phalanx-distal': 'thumb3',
  1227. 'thumb-tip': 'thumb_null',
  1228. 'index-finger-phalanx-proximal': 'index1',
  1229. 'index-finger-phalanx-intermediate': 'index2',
  1230. 'index-finger-phalanx-distal': 'index3',
  1231. 'index-finger-tip': 'index_null',
  1232. 'middle-finger-phalanx-proximal': 'middle1',
  1233. 'middle-finger-phalanx-intermediate': 'middle2',
  1234. 'middle-finger-phalanx-distal': 'middle3',
  1235. 'middle-finger-tip': 'middle_null',
  1236. 'ring-finger-phalanx-proximal': 'ring1',
  1237. 'ring-finger-phalanx-intermediate': 'ring2',
  1238. 'ring-finger-phalanx-distal': 'ring3',
  1239. 'ring-finger-tip': 'ring_null',
  1240. 'pinky-finger-metacarpal': 'pinky0',
  1241. 'pinky-finger-phalanx-proximal': 'pinky1',
  1242. 'pinky-finger-phalanx-intermediate': 'pinky2',
  1243. 'pinky-finger-phalanx-distal': 'pinky3',
  1244. 'pinky-finger-tip': 'pinky_null'
  1245. };
  1246. var PINCH_START_DISTANCE = 0.015;
  1247. var PINCH_END_DISTANCE = 0.03;
  1248. var PINCH_POSITION_INTERPOLATION = 0.5;
  1249. /**
  1250. * Controls for hand tracking
  1251. */
  1252. module.exports.Component = registerComponent('hand-tracking-controls', {
  1253. schema: {
  1254. hand: {default: 'right', oneOf: ['left', 'right']},
  1255. modelStyle: {default: 'mesh', oneOf: ['dots', 'mesh']},
  1256. modelColor: {default: 'white'}
  1257. },
  1258. bindMethods: function () {
  1259. this.onControllersUpdate = bind(this.onControllersUpdate, this);
  1260. this.checkIfControllerPresent = bind(this.checkIfControllerPresent, this);
  1261. this.removeControllersUpdateListener = bind(this.removeControllersUpdateListener, this);
  1262. },
  1263. addEventListeners: function () {
  1264. this.el.addEventListener('model-loaded', this.onModelLoaded);
  1265. for (var i = 0; i < this.jointEls.length; ++i) {
  1266. this.jointEls[i].object3D.visible = true;
  1267. }
  1268. },
  1269. removeEventListeners: function () {
  1270. this.el.removeEventListener('model-loaded', this.onModelLoaded);
  1271. for (var i = 0; i < this.jointEls.length; ++i) {
  1272. this.jointEls[i].object3D.visible = false;
  1273. }
  1274. },
  1275. init: function () {
  1276. var sceneEl = this.el.sceneEl;
  1277. var webXROptionalAttributes = sceneEl.getAttribute('webxr').optionalFeatures;
  1278. webXROptionalAttributes.push('hand-tracking');
  1279. sceneEl.setAttribute('webxr', {optionalFeatures: webXROptionalAttributes});
  1280. this.onModelLoaded = this.onModelLoaded.bind(this);
  1281. this.jointEls = [];
  1282. this.controllerPresent = false;
  1283. this.isPinched = false;
  1284. this.pinchEventDetail = {position: new THREE.Vector3()};
  1285. this.indexTipPosition = new THREE.Vector3();
  1286. this.bindMethods();
  1287. this.updateReferenceSpace = this.updateReferenceSpace.bind(this);
  1288. this.el.sceneEl.addEventListener('enter-vr', this.updateReferenceSpace);
  1289. this.el.sceneEl.addEventListener('exit-vr', this.updateReferenceSpace);
  1290. },
  1291. updateReferenceSpace: function () {
  1292. var self = this;
  1293. var xrSession = this.el.sceneEl.xrSession;
  1294. this.referenceSpace = undefined;
  1295. if (!xrSession) { return; }
  1296. var referenceSpaceType = self.el.sceneEl.systems.webxr.sessionReferenceSpaceType;
  1297. xrSession.requestReferenceSpace(referenceSpaceType).then(function (referenceSpace) {
  1298. self.referenceSpace = referenceSpace.getOffsetReferenceSpace(new XRRigidTransform({x: 0, y: 1.5, z: 0}));
  1299. }).catch(function (error) {
  1300. self.el.sceneEl.systems.webxr.warnIfFeatureNotRequested(referenceSpaceType, 'tracked-controls-webxr uses reference space ' + referenceSpaceType);
  1301. throw error;
  1302. });
  1303. },
  1304. checkIfControllerPresent: function () {
  1305. var data = this.data;
  1306. var hand = data.hand ? data.hand : undefined;
  1307. checkControllerPresentAndSetup(
  1308. this, '',
  1309. {hand: hand, iterateControllerProfiles: true, handTracking: true});
  1310. },
  1311. play: function () {
  1312. this.checkIfControllerPresent();
  1313. this.addControllersUpdateListener();
  1314. },
  1315. tick: function () {
  1316. var sceneEl = this.el.sceneEl;
  1317. var controller = this.el.components['tracked-controls'] && this.el.components['tracked-controls'].controller;
  1318. var frame = sceneEl.frame;
  1319. var trackedControlsWebXR = this.el.components['tracked-controls-webxr'];
  1320. if (!controller || !frame || !trackedControlsWebXR) { return; }
  1321. if (controller.hand) {
  1322. this.el.object3D.position.set(0, 0, 0);
  1323. this.el.object3D.rotation.set(0, 0, 0);
  1324. if (frame.getJointPose) { this.updateHandModel(); }
  1325. this.detectGesture();
  1326. }
  1327. },
  1328. updateHandModel: function () {
  1329. if (this.data.modelStyle === 'dots') {
  1330. this.updateHandDotsModel();
  1331. }
  1332. if (this.data.modelStyle === 'mesh') {
  1333. this.updateHandMeshModel();
  1334. }
  1335. },
  1336. getBone: function (name) {
  1337. var bones = this.bones;
  1338. for (var i = 0; i < bones.length; i++) {
  1339. if (bones[i].name === name) { return bones[i]; }
  1340. }
  1341. return null;
  1342. },
  1343. updateHandMeshModel: function () {
  1344. var frame = this.el.sceneEl.frame;
  1345. var controller = this.el.components['tracked-controls'] && this.el.components['tracked-controls'].controller;
  1346. var referenceSpace = this.referenceSpace;
  1347. if (!controller || !this.mesh || !referenceSpace) { return; }
  1348. this.mesh.visible = false;
  1349. for (var inputjoint of controller.hand.values()) {
  1350. var bone;
  1351. var jointPose;
  1352. var jointTransform;
  1353. jointPose = frame.getJointPose(inputjoint, referenceSpace);
  1354. if (!BONE_MAPPING[inputjoint.jointName]) { continue; }
  1355. bone = this.getBone(BONE_PREFIX[this.data.hand] + BONE_MAPPING[inputjoint.jointName]);
  1356. if (bone != null && jointPose) {
  1357. jointTransform = jointPose.transform;
  1358. this.mesh.visible = true;
  1359. bone.position.copy(jointTransform.position).multiplyScalar(100);
  1360. bone.quaternion.set(jointTransform.orientation.x, jointTransform.orientation.y, jointTransform.orientation.z, jointTransform.orientation.w);
  1361. }
  1362. }
  1363. },
  1364. updateHandDotsModel: function () {
  1365. var frame = this.el.sceneEl.frame;
  1366. var controller = this.el.components['tracked-controls'] && this.el.components['tracked-controls'].controller;
  1367. var trackedControlsWebXR = this.el.components['tracked-controls-webxr'];
  1368. var referenceSpace = trackedControlsWebXR.system.referenceSpace;
  1369. var jointEl;
  1370. var object3D;
  1371. var jointPose;
  1372. var i = 0;
  1373. for (var inputjoint of controller.hand.values()) {
  1374. jointEl = this.jointEls[i++];
  1375. object3D = jointEl.object3D;
  1376. jointPose = frame.getJointPose(inputjoint, referenceSpace);
  1377. jointEl.object3D.visible = !!jointPose;
  1378. if (!jointPose) { continue; }
  1379. object3D.matrix.elements = jointPose.transform.matrix;
  1380. object3D.matrix.decompose(object3D.position, object3D.rotation, object3D.scale);
  1381. jointEl.setAttribute('scale', {x: jointPose.radius, y: jointPose.radius, z: jointPose.radius});
  1382. }
  1383. },
  1384. detectGesture: function () {
  1385. this.detectPinch();
  1386. },
  1387. detectPinch: (function () {
  1388. var thumbTipPosition = new THREE.Vector3();
  1389. return function () {
  1390. var frame = this.el.sceneEl.frame;
  1391. var indexTipPosition = this.indexTipPosition;
  1392. var controller = this.el.components['tracked-controls'] && this.el.components['tracked-controls'].controller;
  1393. var trackedControlsWebXR = this.el.components['tracked-controls-webxr'];
  1394. var referenceSpace = this.referenceSpace || trackedControlsWebXR.system.referenceSpace;
  1395. var indexTip = controller.hand.get('index-finger-tip');
  1396. var thumbTip = controller.hand.get('thumb-tip');
  1397. if (!indexTip ||
  1398. !thumbTip) { return; }
  1399. var indexTipPose = frame.getJointPose(indexTip, referenceSpace);
  1400. var thumbTipPose = frame.getJointPose(thumbTip, referenceSpace);
  1401. if (!indexTipPose || !thumbTipPose) { return; }
  1402. thumbTipPosition.copy(thumbTipPose.transform.position);
  1403. indexTipPosition.copy(indexTipPose.transform.position);
  1404. var distance = indexTipPosition.distanceTo(thumbTipPosition);
  1405. if (distance < PINCH_START_DISTANCE && this.isPinched === false) {
  1406. this.isPinched = true;
  1407. this.pinchEventDetail.position.copy(indexTipPosition).lerp(thumbTipPosition, PINCH_POSITION_INTERPOLATION);
  1408. this.pinchEventDetail.position.y += 1.5;
  1409. this.el.emit('pinchstarted', this.pinchEventDetail);
  1410. }
  1411. if (distance > PINCH_END_DISTANCE && this.isPinched === true) {
  1412. this.isPinched = false;
  1413. this.pinchEventDetail.position.copy(indexTipPosition).lerp(thumbTipPosition, PINCH_POSITION_INTERPOLATION);
  1414. this.pinchEventDetail.position.y += 1.5;
  1415. this.el.emit('pinchended', this.pinchEventDetail);
  1416. }
  1417. if (this.isPinched) {
  1418. this.pinchEventDetail.position.copy(indexTipPosition).lerp(thumbTipPosition, PINCH_POSITION_INTERPOLATION);
  1419. this.pinchEventDetail.position.y += 1.5;
  1420. this.el.emit('pinchmoved', this.pinchEventDetail);
  1421. }
  1422. indexTipPosition.y += 1.5;
  1423. };
  1424. })(),
  1425. pause: function () {
  1426. this.removeEventListeners();
  1427. this.removeControllersUpdateListener();
  1428. },
  1429. injectTrackedControls: function () {
  1430. var el = this.el;
  1431. var data = this.data;
  1432. el.setAttribute('tracked-controls', {
  1433. hand: data.hand,
  1434. iterateControllerProfiles: true,
  1435. handTrackingEnabled: true
  1436. });
  1437. this.initDefaultModel();
  1438. },
  1439. addControllersUpdateListener: function () {
  1440. this.el.sceneEl.addEventListener('controllersupdated', this.onControllersUpdate, false);
  1441. },
  1442. removeControllersUpdateListener: function () {
  1443. this.el.sceneEl.removeEventListener('controllersupdated', this.onControllersUpdate, false);
  1444. },
  1445. onControllersUpdate: function () {
  1446. var controller;
  1447. this.checkIfControllerPresent();
  1448. controller = this.el.components['tracked-controls'] && this.el.components['tracked-controls'].controller;
  1449. if (!this.el.getObject3D('mesh')) { return; }
  1450. if (!controller || !controller.hand || !controller.hand[0]) {
  1451. this.el.getObject3D('mesh').visible = false;
  1452. }
  1453. },
  1454. initDefaultModel: function () {
  1455. if (this.el.getObject3D('mesh')) { return; }
  1456. if (this.data.modelStyle === 'dots') {
  1457. this.initDotsModel();
  1458. }
  1459. if (this.data.modelStyle === 'mesh') {
  1460. this.initMeshHandModel();
  1461. }
  1462. },
  1463. initDotsModel: function () {
  1464. // Add models just once.
  1465. if (this.jointEls.length !== 0) { return; }
  1466. for (var i = 0; i < JOINTS.length; ++i) {
  1467. var jointEl = this.jointEl = document.createElement('a-entity');
  1468. jointEl.setAttribute('geometry', {
  1469. primitive: 'sphere',
  1470. radius: 1.0
  1471. });
  1472. jointEl.setAttribute('material', {color: this.data.modelColor});
  1473. jointEl.object3D.visible = false;
  1474. this.el.appendChild(jointEl);
  1475. this.jointEls.push(jointEl);
  1476. }
  1477. },
  1478. initMeshHandModel: function () {
  1479. var modelURL = this.data.hand === 'left' ? LEFT_HAND_MODEL_URL : RIGHT_HAND_MODEL_URL;
  1480. this.el.setAttribute('gltf-model', modelURL);
  1481. },
  1482. onModelLoaded: function () {
  1483. var mesh = this.mesh = this.el.getObject3D('mesh').children[0];
  1484. var skinnedMesh = this.skinnedMesh = mesh.children[24];
  1485. if (!this.skinnedMesh) { return; }
  1486. this.bones = skinnedMesh.skeleton.bones;
  1487. this.el.removeObject3D('mesh');
  1488. mesh.position.set(0, 1.5, 0);
  1489. mesh.rotation.set(0, 0, 0);
  1490. skinnedMesh.frustumCulled = false;
  1491. skinnedMesh.material = new THREE.MeshStandardMaterial({skinning: true, color: this.data.modelColor});
  1492. this.el.setObject3D('mesh', mesh);
  1493. }
  1494. });
  1495. },{"../core/component":131,"../utils/bind":199,"../utils/tracked-controls":214}],84:[function(_dereq_,module,exports){
  1496. _dereq_("./animation"),_dereq_("./camera"),_dereq_("./cursor"),_dereq_("./daydream-controls"),_dereq_("./gearvr-controls"),_dereq_("./geometry"),_dereq_("./generic-tracked-controller-controls"),_dereq_("./gltf-model"),_dereq_("./hand-tracking-controls"),_dereq_("./hand-controls"),_dereq_("./layer"),_dereq_("./laser-controls"),_dereq_("./light"),_dereq_("./line"),_dereq_("./link"),_dereq_("./look-controls"),_dereq_("./magicleap-controls"),_dereq_("./material"),_dereq_("./obj-model"),_dereq_("./oculus-go-controls"),_dereq_("./oculus-touch-controls"),_dereq_("./position"),_dereq_("./raycaster"),_dereq_("./rotation"),_dereq_("./scale"),_dereq_("./shadow"),_dereq_("./sound"),_dereq_("./text"),_dereq_("./tracked-controls"),_dereq_("./tracked-controls-webvr"),_dereq_("./tracked-controls-webxr"),_dereq_("./visible"),_dereq_("./valve-index-controls"),_dereq_("./vive-controls"),_dereq_("./vive-focus-controls"),_dereq_("./wasd-controls"),_dereq_("./windows-motion-controls"),_dereq_("./scene/background"),_dereq_("./scene/debug"),_dereq_("./scene/device-orientation-permission-ui"),_dereq_("./scene/embedded"),_dereq_("./scene/inspector"),_dereq_("./scene/fog"),_dereq_("./scene/keyboard-shortcuts"),_dereq_("./scene/pool"),_dereq_("./scene/screenshot"),_dereq_("./scene/stats"),_dereq_("./scene/vr-mode-ui");
  1497. },{"./animation":74,"./camera":75,"./cursor":76,"./daydream-controls":77,"./gearvr-controls":78,"./generic-tracked-controller-controls":79,"./geometry":80,"./gltf-model":81,"./hand-controls":82,"./hand-tracking-controls":83,"./laser-controls":85,"./layer":86,"./light":87,"./line":88,"./link":89,"./look-controls":90,"./magicleap-controls":91,"./material":92,"./obj-model":93,"./oculus-go-controls":94,"./oculus-touch-controls":95,"./position":96,"./raycaster":97,"./rotation":98,"./scale":99,"./scene/background":100,"./scene/debug":101,"./scene/device-orientation-permission-ui":102,"./scene/embedded":103,"./scene/fog":104,"./scene/inspector":105,"./scene/keyboard-shortcuts":106,"./scene/pool":107,"./scene/screenshot":108,"./scene/stats":109,"./scene/vr-mode-ui":110,"./shadow":111,"./sound":112,"./text":113,"./tracked-controls":116,"./tracked-controls-webvr":114,"./tracked-controls-webxr":115,"./valve-index-controls":117,"./visible":118,"./vive-controls":119,"./vive-focus-controls":120,"./wasd-controls":121,"./windows-motion-controls":122}],85:[function(_dereq_,module,exports){
  1498. var registerComponent=_dereq_("../core/component").registerComponent,utils=_dereq_("../utils/");registerComponent("laser-controls",{schema:{hand:{default:"right"},model:{default:!0},defaultModelColor:{type:"color",default:"grey"}},init:function(){function t(t){var r=e[t.detail.name];if(r){var o=utils.extend({showLine:!0},r.raycaster||{});t.detail.rayOrigin&&(o.origin=t.detail.rayOrigin.origin,o.direction=t.detail.rayOrigin.direction,o.showLine=!0),t.detail.rayOrigin||!i.modelReady?n.setAttribute("raycaster",o):n.setAttribute("raycaster","showLine",!0),n.setAttribute("cursor",utils.extend({fuse:!1},r.cursor))}}function r(){n.setAttribute("raycaster","showLine",!1)}var e=this.config,o=this.data,n=this.el,i=this,s={hand:o.hand,model:o.model};n.setAttribute("daydream-controls",s),n.setAttribute("gearvr-controls",s),n.setAttribute("magicleap-controls",s),n.setAttribute("oculus-go-controls",s),n.setAttribute("oculus-touch-controls",s),n.setAttribute("valve-index-controls",s),n.setAttribute("vive-controls",s),n.setAttribute("vive-focus-controls",s),n.setAttribute("windows-motion-controls",s),n.setAttribute("generic-tracked-controller-controls",s),n.addEventListener("controllerconnected",t),n.addEventListener("controllerdisconnected",r),n.addEventListener("controllermodelready",function(r){t(r),i.modelReady=!0})},config:{"daydream-controls":{cursor:{downEvents:["trackpaddown","triggerdown"],upEvents:["trackpadup","triggerup"]}},"gearvr-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{origin:{x:0,y:.001,z:0}}},"generic-tracked-controller-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"magicleap-controls":{cursor:{downEvents:["trackpaddown","triggerdown"],upEvents:["trackpadup","triggerup"]}},"oculus-go-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{origin:{x:0,y:5e-4,z:0}}},"oculus-touch-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{origin:{x:0,y:0,z:0}}},"valve-index-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"vive-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"vive-focus-controls":{cursor:{downEvents:["trackpaddown","triggerdown"],upEvents:["trackpadup","triggerup"]}},"windows-motion-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{showLine:!1}}}});
  1499. },{"../core/component":131,"../utils/":205}],86:[function(_dereq_,module,exports){
  1500. /* global THREE, XRRigidTransform, XRWebGLBinding */
  1501. var registerComponent = _dereq_('../core/component').registerComponent;
  1502. var utils = _dereq_('../utils/');
  1503. var warn = utils.debug('components:layer:warn');
  1504. module.exports.Component = registerComponent('layer', {
  1505. schema: {
  1506. type: {default: 'quad', oneOf: ['quad', 'monocubemap', 'stereocubemap']},
  1507. src: {type: 'map'},
  1508. rotateCubemap: {default: false},
  1509. width: {default: 0},
  1510. height: {default: 0}
  1511. },
  1512. init: function () {
  1513. var gl = this.el.sceneEl.renderer.getContext();
  1514. this.quaternion = new THREE.Quaternion();
  1515. this.position = new THREE.Vector3();
  1516. this.bindMethods();
  1517. this.needsRedraw = false;
  1518. this.frameBuffer = gl.createFramebuffer();
  1519. var requiredFeatures = this.el.sceneEl.getAttribute('webxr').requiredFeatures;
  1520. requiredFeatures.push('layers');
  1521. this.el.sceneEl.getAttribute('webxr', 'requiredFeatures', requiredFeatures);
  1522. this.el.sceneEl.addEventListener('enter-vr', this.onEnterVR);
  1523. this.el.sceneEl.addEventListener('exit-vr', this.onExitVR);
  1524. },
  1525. bindMethods: function () {
  1526. this.onRequestedReferenceSpace = this.onRequestedReferenceSpace.bind(this);
  1527. this.onEnterVR = this.onEnterVR.bind(this);
  1528. this.onExitVR = this.onExitVR.bind(this);
  1529. },
  1530. update: function (oldData) {
  1531. if (this.data.src !== oldData.src) { this.updateSrc(); }
  1532. },
  1533. updateSrc: function () {
  1534. var type = this.data.type;
  1535. this.texture = undefined;
  1536. if (type === 'quad') {
  1537. this.loadQuadImage();
  1538. return;
  1539. }
  1540. if (type === 'monocubemap' || type === 'stereocubemap') {
  1541. this.loadCubeMapImages();
  1542. return;
  1543. }
  1544. },
  1545. loadCubeMapImages: function () {
  1546. var type = this.data.type;
  1547. var glayer;
  1548. var xrGLFactory = this.xrGLFactory;
  1549. var frame = this.el.sceneEl.frame;
  1550. var src = this.data.src;
  1551. this.visibilityChanged = false;
  1552. if (!this.layer) { return; }
  1553. if (!src.complete) {
  1554. this.pendingCubeMapUpdate = true;
  1555. } else {
  1556. this.pendingCubeMapUpdate = false;
  1557. }
  1558. if (!this.loadingScreen) {
  1559. this.loadingScreen = true;
  1560. } else {
  1561. this.loadingScreen = false;
  1562. }
  1563. if (type === 'monocubemap') {
  1564. glayer = xrGLFactory.getSubImage(this.layer, frame);
  1565. this.loadCubeMapImage(glayer.colorTexture, src, 0);
  1566. } else {
  1567. glayer = xrGLFactory.getSubImage(this.layer, frame, 'left');
  1568. this.loadCubeMapImage(glayer.colorTexture, src, 0);
  1569. glayer = xrGLFactory.getSubImage(this.layer, frame, 'right');
  1570. this.loadCubeMapImage(glayer.colorTexture, src, 6);
  1571. }
  1572. },
  1573. loadQuadImage: function () {
  1574. var src = this.data.src;
  1575. var self = this;
  1576. this.el.sceneEl.systems.material.loadTexture(src, {src: src}, function textureLoaded (texture) {
  1577. self.el.sceneEl.renderer.initTexture(texture);
  1578. self.texture = texture;
  1579. if (src.tagName === 'VIDEO') { setTimeout(function () { self.textureIsVideo = true; }, 1000); }
  1580. if (self.layer) {
  1581. self.layer.height = self.data.height / 2 || self.texture.image.height / 1000;
  1582. self.layer.width = self.data.width / 2 || self.texture.image.width / 1000;
  1583. self.needsRedraw = true;
  1584. }
  1585. self.updateQuadPanel();
  1586. });
  1587. },
  1588. preGenerateCubeMapTextures: function (src, callback) {
  1589. if (this.data.type === 'monocubemap') {
  1590. this.generateCubeMapTextures(src, 0, callback);
  1591. } else {
  1592. this.generateCubeMapTextures(src, 0, callback);
  1593. this.generateCubeMapTextures(src, 6, callback);
  1594. }
  1595. },
  1596. generateCubeMapTextures: function (src, faceOffset, callback) {
  1597. var data = this.data;
  1598. var cubeFaceSize = this.cubeFaceSize;
  1599. var textureSourceCubeFaceSize = Math.min(src.width, src.height);
  1600. var cubefaceTextures = [];
  1601. var imgTmp0;
  1602. var imgTmp2;
  1603. for (var i = 0; i < 6; i++) {
  1604. var tempCanvas = document.createElement('CANVAS');
  1605. tempCanvas.width = tempCanvas.height = cubeFaceSize;
  1606. var tempCanvasContext = tempCanvas.getContext('2d');
  1607. if (data.rotateCubemap) {
  1608. if (i === 2 || i === 3) {
  1609. tempCanvasContext.save();
  1610. tempCanvasContext.translate(cubeFaceSize, cubeFaceSize);
  1611. tempCanvasContext.rotate(Math.PI);
  1612. }
  1613. }
  1614. // Note that this call to drawImage will not only copy the bytes to the
  1615. // canvas but also could resized the image if our cube face size is
  1616. // smaller than the source image due to GL max texture size.
  1617. tempCanvasContext.drawImage(
  1618. src,
  1619. (i + faceOffset) * textureSourceCubeFaceSize, // top left x coord in source
  1620. 0, // top left y coord in source
  1621. textureSourceCubeFaceSize, // x pixel count from source
  1622. textureSourceCubeFaceSize, // y pixel count from source
  1623. 0, // dest x offset in the canvas
  1624. 0, // dest y offset in the canvas
  1625. cubeFaceSize, // x pixel count in dest
  1626. cubeFaceSize // y pixel count in dest
  1627. );
  1628. tempCanvasContext.restore();
  1629. if (callback) { callback(); }
  1630. cubefaceTextures.push(tempCanvas);
  1631. }
  1632. if (data.rotateCubemap) {
  1633. imgTmp0 = cubefaceTextures[0];
  1634. imgTmp2 = cubefaceTextures[1];
  1635. cubefaceTextures[0] = imgTmp2;
  1636. cubefaceTextures[1] = imgTmp0;
  1637. imgTmp0 = cubefaceTextures[4];
  1638. imgTmp2 = cubefaceTextures[5];
  1639. cubefaceTextures[4] = imgTmp2;
  1640. cubefaceTextures[5] = imgTmp0;
  1641. }
  1642. if (callback) { callback(); }
  1643. return cubefaceTextures;
  1644. },
  1645. loadCubeMapImage: function (layerColorTexture, src, faceOffset) {
  1646. var gl = this.el.sceneEl.renderer.getContext();
  1647. var cubefaceTextures;
  1648. // dont flip the pixels as we load them into the texture buffer.
  1649. // TEXTURE_CUBE_MAP expects the Y to be flipped for the faces and it already
  1650. // is flipped in our texture image.
  1651. gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
  1652. gl.bindTexture(gl.TEXTURE_CUBE_MAP, layerColorTexture);
  1653. if (!src.complete || this.loadingScreen) {
  1654. cubefaceTextures = this.loadingScreenImages;
  1655. } else {
  1656. cubefaceTextures = this.generateCubeMapTextures(src, faceOffset);
  1657. }
  1658. var errorCode = 0;
  1659. cubefaceTextures.forEach(function (canvas, i) {
  1660. gl.texSubImage2D(
  1661. gl.TEXTURE_CUBE_MAP_POSITIVE_X + i,
  1662. 0,
  1663. 0, 0,
  1664. gl.RGBA,
  1665. gl.UNSIGNED_BYTE,
  1666. canvas
  1667. );
  1668. errorCode = gl.getError();
  1669. });
  1670. if (errorCode !== 0) {
  1671. console.log('renderingError, WebGL Error Code: ' + errorCode);
  1672. }
  1673. gl.bindTexture(gl.TEXTURE_CUBE_MAP, null);
  1674. },
  1675. tick: function () {
  1676. if (!this.el.sceneEl.xrSession) { return; }
  1677. if (!this.layer && this.el.sceneEl.is('vr-mode')) { this.initLayer(); }
  1678. this.updateTransform();
  1679. if (this.data.src.complete && (this.pendingCubeMapUpdate || this.loadingScreen || this.visibilityChanged)) { this.loadCubeMapImages(); }
  1680. if (!this.needsRedraw && !this.layer.needsRedraw && !this.textureIsVideo) { return; }
  1681. if (this.data.type === 'quad') { this.draw(); }
  1682. this.needsRedraw = false;
  1683. },
  1684. initLayer: function () {
  1685. var self = this;
  1686. var type = this.data.type;
  1687. this.el.sceneEl.xrSession.onvisibilitychange = function (evt) {
  1688. self.visibilityChanged = evt.session.visibilityState !== 'hidden';
  1689. };
  1690. if (type === 'quad') {
  1691. this.initQuadLayer();
  1692. return;
  1693. }
  1694. if (type === 'monocubemap' || type === 'stereocubemap') {
  1695. this.initCubeMapLayer();
  1696. return;
  1697. }
  1698. },
  1699. initQuadLayer: function () {
  1700. var sceneEl = this.el.sceneEl;
  1701. var gl = sceneEl.renderer.getContext();
  1702. var xrGLFactory = this.xrGLFactory = new XRWebGLBinding(sceneEl.xrSession, gl);
  1703. if (!this.texture) { return; }
  1704. this.layer = xrGLFactory.createQuadLayer({
  1705. space: this.referenceSpace,
  1706. viewPixelHeight: 2048,
  1707. viewPixelWidth: 2048,
  1708. height: this.data.height / 2 || this.texture.image.height / 1000,
  1709. width: this.data.width / 2 || this.texture.image.width / 1000
  1710. });
  1711. sceneEl.renderer.xr.addLayer(this.layer);
  1712. },
  1713. initCubeMapLayer: function () {
  1714. var src = this.data.src;
  1715. var sceneEl = this.el.sceneEl;
  1716. var gl = sceneEl.renderer.getContext();
  1717. var glSizeLimit = gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE);
  1718. var cubeFaceSize = this.cubeFaceSize = Math.min(glSizeLimit, Math.min(src.width, src.height));
  1719. var xrGLFactory = this.xrGLFactory = new XRWebGLBinding(sceneEl.xrSession, gl);
  1720. this.layer = xrGLFactory.createCubeLayer({
  1721. space: this.referenceSpace,
  1722. viewPixelWidth: cubeFaceSize,
  1723. viewPixelHeight: cubeFaceSize,
  1724. layout: this.data.type === 'monocubemap' ? 'mono' : 'stereo',
  1725. isStatic: false
  1726. });
  1727. this.initLoadingScreenImages();
  1728. this.loadCubeMapImages();
  1729. sceneEl.renderer.xr.addLayer(this.layer);
  1730. },
  1731. initLoadingScreenImages: function () {
  1732. var cubeFaceSize = this.cubeFaceSize;
  1733. var loadingScreenImages = this.loadingScreenImages = [];
  1734. for (var i = 0; i < 6; i++) {
  1735. var tempCanvas = document.createElement('CANVAS');
  1736. tempCanvas.width = tempCanvas.height = cubeFaceSize;
  1737. var tempCanvasContext = tempCanvas.getContext('2d');
  1738. tempCanvas.width = tempCanvas.height = cubeFaceSize;
  1739. tempCanvasContext.fillStyle = 'black';
  1740. tempCanvasContext.fillRect(0, 0, cubeFaceSize, cubeFaceSize);
  1741. if (i !== 2 && i !== 3) {
  1742. tempCanvasContext.translate(cubeFaceSize, 0);
  1743. tempCanvasContext.scale(-1, 1);
  1744. tempCanvasContext.fillStyle = 'white';
  1745. tempCanvasContext.font = '30px Arial';
  1746. tempCanvasContext.fillText('Loading', cubeFaceSize / 2, cubeFaceSize / 2);
  1747. }
  1748. loadingScreenImages.push(tempCanvas);
  1749. }
  1750. },
  1751. destroyLayer: function () {
  1752. if (!this.layer) { return; }
  1753. this.el.sceneEl.renderer.xr.removeLayer(this.layer);
  1754. this.layer.destroy();
  1755. this.layer = undefined;
  1756. },
  1757. toggleCompositorLayer: function () {
  1758. this.enableCompositorLayer(!this.layerEnabled);
  1759. },
  1760. enableCompositorLayer: function (enable) {
  1761. this.layerEnabled = enable;
  1762. this.quadPanelEl.object3D.visible = !this.layerEnabled;
  1763. },
  1764. updateQuadPanel: function () {
  1765. var quadPanelEl = this.quadPanelEl;
  1766. if (!this.quadPanelEl) {
  1767. quadPanelEl = this.quadPanelEl = document.createElement('a-entity');
  1768. this.el.appendChild(quadPanelEl);
  1769. }
  1770. quadPanelEl.setAttribute('material', {
  1771. shader: 'flat',
  1772. src: this.data.src,
  1773. transparent: true
  1774. });
  1775. quadPanelEl.setAttribute('geometry', {
  1776. primitive: 'plane',
  1777. height: this.data.height || this.texture.image.height / 1000,
  1778. width: this.data.width || this.texture.image.height / 1000
  1779. });
  1780. },
  1781. draw: function () {
  1782. var sceneEl = this.el.sceneEl;
  1783. var gl = this.el.sceneEl.renderer.getContext();
  1784. var glayer = this.xrGLFactory.getSubImage(this.layer, sceneEl.frame);
  1785. var texture = sceneEl.renderer.properties.get(this.texture).__webglTexture;
  1786. var previousFrameBuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING);
  1787. gl.viewport(glayer.viewport.x, glayer.viewport.y, glayer.viewport.width, glayer.viewport.height);
  1788. gl.bindFramebuffer(gl.FRAMEBUFFER, this.frameBuffer);
  1789. gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, glayer.colorTexture, 0);
  1790. blitTexture(gl, texture, glayer, this.data.src);
  1791. gl.bindFramebuffer(gl.FRAMEBUFFER, previousFrameBuffer);
  1792. },
  1793. updateTransform: function () {
  1794. var el = this.el;
  1795. var position = this.position;
  1796. var quaternion = this.quaternion;
  1797. el.object3D.updateMatrixWorld();
  1798. position.setFromMatrixPosition(el.object3D.matrixWorld);
  1799. quaternion.setFromRotationMatrix(el.object3D.matrixWorld);
  1800. if (!this.layerEnabled) { position.set(0, 0, 100000000); }
  1801. this.layer.transform = new XRRigidTransform(position, quaternion);
  1802. },
  1803. onEnterVR: function () {
  1804. var sceneEl = this.el.sceneEl;
  1805. var xrSession = sceneEl.xrSession;
  1806. if (!sceneEl.hasWebXR || !XRWebGLBinding || !xrSession) {
  1807. warn('The layer component requires WebXR and the layers API enabled');
  1808. return;
  1809. }
  1810. xrSession.requestReferenceSpace('local').then(this.onRequestedReferenceSpace);
  1811. this.needsRedraw = true;
  1812. this.layerEnabled = true;
  1813. if (this.quadPanelEl) {
  1814. this.quadPanelEl.object3D.visible = false;
  1815. }
  1816. if (this.data.src.play) { this.data.src.play(); }
  1817. },
  1818. onExitVR: function () {
  1819. if (this.quadPanelEl) {
  1820. this.quadPanelEl.object3D.visible = true;
  1821. }
  1822. this.destroyLayer();
  1823. },
  1824. onRequestedReferenceSpace: function (referenceSpace) {
  1825. this.referenceSpace = referenceSpace;
  1826. }
  1827. });
  1828. function blitTexture (gl, texture, subImage, textureEl) {
  1829. var xrReadFramebuffer = gl.createFramebuffer();
  1830. let x1offset = subImage.viewport.x;
  1831. let y1offset = subImage.viewport.y;
  1832. let x2offset = subImage.viewport.x + subImage.viewport.width;
  1833. let y2offset = subImage.viewport.y + subImage.viewport.height;
  1834. // Update video texture.
  1835. if (textureEl.tagName === 'VIDEO') {
  1836. gl.bindTexture(gl.TEXTURE_2D, texture);
  1837. gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, textureEl.width, textureEl.height, gl.RGB, gl.UNSIGNED_BYTE, textureEl);
  1838. }
  1839. // Bind texture to read framebuffer.
  1840. gl.bindFramebuffer(gl.READ_FRAMEBUFFER, xrReadFramebuffer);
  1841. gl.framebufferTexture2D(gl.READ_FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);
  1842. // Blit into layer buffer.
  1843. gl.readBuffer(gl.COLOR_ATTACHMENT0);
  1844. gl.blitFramebuffer(0, 0, textureEl.width, textureEl.height, x1offset, y1offset, x2offset, y2offset, gl.COLOR_BUFFER_BIT, gl.NEAREST);
  1845. gl.bindFramebuffer(gl.READ_FRAMEBUFFER, null);
  1846. gl.deleteFramebuffer(xrReadFramebuffer);
  1847. }
  1848. },{"../core/component":131,"../utils/":205}],87:[function(_dereq_,module,exports){
  1849. var bind=_dereq_("../utils/bind"),diff=_dereq_("../utils").diff,debug=_dereq_("../utils/debug"),registerComponent=_dereq_("../core/component").registerComponent,THREE=_dereq_("../lib/three"),degToRad=THREE.Math.degToRad,warn=debug("components:light:warn");module.exports.Component=registerComponent("light",{schema:{angle:{default:60,if:{type:["spot"]}},color:{type:"color"},groundColor:{type:"color",if:{type:["hemisphere"]}},decay:{default:1,if:{type:["point","spot"]}},distance:{default:0,min:0,if:{type:["point","spot"]}},intensity:{default:1,min:0,if:{type:["ambient","directional","hemisphere","point","spot"]}},penumbra:{default:0,min:0,max:1,if:{type:["spot"]}},type:{default:"directional",oneOf:["ambient","directional","hemisphere","point","spot"],schemaChange:!0},target:{type:"selector",if:{type:["spot","directional"]}},castShadow:{default:!1,if:{type:["point","spot","directional"]}},shadowBias:{default:0,if:{castShadow:!0}},shadowCameraFar:{default:500,if:{castShadow:!0}},shadowCameraFov:{default:90,if:{castShadow:!0}},shadowCameraNear:{default:.5,if:{castShadow:!0}},shadowCameraTop:{default:5,if:{castShadow:!0}},shadowCameraRight:{default:5,if:{castShadow:!0}},shadowCameraBottom:{default:-5,if:{castShadow:!0}},shadowCameraLeft:{default:-5,if:{castShadow:!0}},shadowCameraVisible:{default:!1,if:{castShadow:!0}},shadowMapHeight:{default:512,if:{castShadow:!0}},shadowMapWidth:{default:512,if:{castShadow:!0}},shadowRadius:{default:1,if:{castShadow:!0}}},init:function(){var e=this.el;this.light=null,this.defaultTarget=null,this.rendererSystem=this.el.sceneEl.systems.renderer,this.system.registerLight(e)},update:function(e){var a=this.data,t=diff(a,e),o=this.light,r=this.rendererSystem,i=this;if(o&&!("type"in t)){var s=!1;return void Object.keys(t).forEach(function(e){var t=a[e];switch(e){case"color":o.color.set(t),r.applyColorCorrection(o.color);break;case"groundColor":o.groundColor.set(t),r.applyColorCorrection(o.groundColor);break;case"angle":o.angle=degToRad(t);break;case"target":null===t?"spot"!==a.type&&"directional"!==a.type||(o.target=i.defaultTarget):t.hasLoaded?i.onSetTarget(t,o):t.addEventListener("loaded",bind(i.onSetTarget,i,t,o));break;case"castShadow":case"shadowBias":case"shadowCameraFar":case"shadowCameraFov":case"shadowCameraNear":case"shadowCameraTop":case"shadowCameraRight":case"shadowCameraBottom":case"shadowCameraLeft":case"shadowCameraVisible":case"shadowMapHeight":case"shadowMapWidth":case"shadowRadius":s||(i.updateShadow(),s=!0);break;default:o[e]=t}})}this.setLight(this.data),this.updateShadow()},setLight:function(e){var a=this.el,t=this.getLight(e);t&&(this.light&&a.removeObject3D("light"),this.light=t,this.light.el=a,a.setObject3D("light",this.light),"spot"!==e.type&&"directional"!==e.type&&"hemisphere"!==e.type||a.getObject3D("light").translateY(-1),"spot"===e.type&&(a.setObject3D("light-target",this.defaultTarget),a.getObject3D("light-target").position.set(0,0,-1)))},updateShadow:function(){var e=this.el,a=this.data,t=this.light;t.castShadow=a.castShadow;var o=e.getObject3D("cameraHelper");if(a.shadowCameraVisible&&!o?e.setObject3D("cameraHelper",new THREE.CameraHelper(t.shadow.camera)):!a.shadowCameraVisible&&o&&e.removeObject3D("cameraHelper"),!a.castShadow)return t;t.shadow.bias=a.shadowBias,t.shadow.radius=a.shadowRadius,t.shadow.mapSize.height=a.shadowMapHeight,t.shadow.mapSize.width=a.shadowMapWidth,t.shadow.camera.near=a.shadowCameraNear,t.shadow.camera.far=a.shadowCameraFar,t.shadow.camera instanceof THREE.OrthographicCamera?(t.shadow.camera.top=a.shadowCameraTop,t.shadow.camera.right=a.shadowCameraRight,t.shadow.camera.bottom=a.shadowCameraBottom,t.shadow.camera.left=a.shadowCameraLeft):t.shadow.camera.fov=a.shadowCameraFov,t.shadow.camera.updateProjectionMatrix(),o&&o.update()},getLight:function(e){var a=e.angle,t=new THREE.Color(e.color);this.rendererSystem.applyColorCorrection(t),t=t.getHex();var o=e.decay,r=e.distance,i=new THREE.Color(e.groundColor);this.rendererSystem.applyColorCorrection(i),i=i.getHex();var s=e.intensity,d=e.type,h=e.target,n=null;switch(d.toLowerCase()){case"ambient":return new THREE.AmbientLight(t,s);case"directional":return n=new THREE.DirectionalLight(t,s),this.defaultTarget=n.target,h&&(h.hasLoaded?this.onSetTarget(h,n):h.addEventListener("loaded",bind(this.onSetTarget,this,h,n))),n;case"hemisphere":return new THREE.HemisphereLight(t,i,s);case"point":return new THREE.PointLight(t,s,r,o);case"spot":return n=new THREE.SpotLight(t,s,r,degToRad(a),e.penumbra,o),this.defaultTarget=n.target,h&&(h.hasLoaded?this.onSetTarget(h,n):h.addEventListener("loaded",bind(this.onSetTarget,this,h,n))),n;default:warn("%s is not a valid light type. Choose from ambient, directional, hemisphere, point, spot.",d)}},onSetTarget:function(e,a){a.target=e.object3D},remove:function(){var e=this.el;e.removeObject3D("light"),e.getObject3D("cameraHelper")&&e.removeObject3D("cameraHelper")}});
  1850. },{"../core/component":131,"../lib/three":179,"../utils":205,"../utils/bind":199,"../utils/debug":201}],88:[function(_dereq_,module,exports){
  1851. function isEqualVec3(e,t){return!(!e||!t)&&(e.x===t.x&&e.y===t.y&&e.z===t.z)}var registerComponent=_dereq_("../core/component").registerComponent;module.exports.Component=registerComponent("line",{schema:{start:{type:"vec3",default:{x:0,y:0,z:0}},end:{type:"vec3",default:{x:0,y:0,z:0}},color:{type:"color",default:"#74BEC1"},opacity:{type:"number",default:1},visible:{default:!0}},multiple:!0,init:function(){var e,t,r=this.data;this.rendererSystem=this.el.sceneEl.systems.renderer,t=this.material=new THREE.LineBasicMaterial({color:r.color,opacity:r.opacity,transparent:r.opacity<1,visible:r.visible}),e=this.geometry=new THREE.BufferGeometry,e.setAttribute("position",new THREE.BufferAttribute(new Float32Array(6),3)),this.rendererSystem.applyColorCorrection(t.color),this.line=new THREE.Line(e,t),this.el.setObject3D(this.attrName,this.line)},update:function(e){var t=this.data,r=this.geometry,i=!1,o=this.material,n=r.attributes.position.array;isEqualVec3(t.start,e.start)||(n[0]=t.start.x,n[1]=t.start.y,n[2]=t.start.z,i=!0),isEqualVec3(t.end,e.end)||(n[3]=t.end.x,n[4]=t.end.y,n[5]=t.end.z,i=!0),i&&(r.attributes.position.needsUpdate=!0,r.computeBoundingSphere()),o.color.setStyle(t.color),this.rendererSystem.applyColorCorrection(o.color),o.opacity=t.opacity,o.transparent=t.opacity<1,o.visible=t.visible},remove:function(){this.el.removeObject3D("line",this.line)}});
  1852. },{"../core/component":131}],89:[function(_dereq_,module,exports){
  1853. var registerComponent=_dereq_("../core/component").registerComponent,registerShader=_dereq_("../core/shader").registerShader,THREE=_dereq_("../lib/three");module.exports.Component=registerComponent("link",{schema:{backgroundColor:{default:"red",type:"color"},borderColor:{default:"white",type:"color"},highlighted:{default:!1},highlightedColor:{default:"#24CAFF",type:"color"},href:{default:""},image:{type:"asset"},on:{default:"click"},peekMode:{default:!1},title:{default:""},titleColor:{default:"white",type:"color"},visualAspectEnabled:{default:!1}},init:function(){this.navigate=this.navigate.bind(this),this.previousQuaternion=void 0,this.quaternionClone=new THREE.Quaternion,this.hiddenEls=[]},update:function(e){var t,i,r=this.data,o=this.el;r.visualAspectEnabled&&(this.initVisualAspect(),t=r.highlighted?r.highlightedColor:r.backgroundColor,i=r.highlighted?r.highlightedColor:r.borderColor,o.setAttribute("material","backgroundColor",t),o.setAttribute("material","strokeColor",i),r.on!==e.on&&this.updateEventListener(),void 0!==e.peekMode&&r.peekMode!==e.peekMode&&this.updatePeekMode(),r.image&&e.image!==r.image&&o.setAttribute("material","pano","string"==typeof r.image?r.image:r.image.src))},updatePeekMode:function(){var e=this.el,t=this.sphereEl;this.data.peekMode?(this.hideAll(),e.getObject3D("mesh").visible=!1,t.setAttribute("visible",!0)):(this.showAll(),e.getObject3D("mesh").visible=!0,t.setAttribute("visible",!1))},play:function(){this.updateEventListener()},pause:function(){this.removeEventListener()},updateEventListener:function(){var e=this.el;e.isPlaying&&(this.removeEventListener(),e.addEventListener(this.data.on,this.navigate))},removeEventListener:function(){var e=this.data.on;e&&this.el.removeEventListener(e,this.navigate)},initVisualAspect:function(){var e,t,i,r=this.el;this.data.visualAspectEnabled&&!this.visualAspectInitialized&&(i=this.textEl=this.textEl||document.createElement("a-entity"),t=this.sphereEl=this.sphereEl||document.createElement("a-entity"),e=this.semiSphereEl=this.semiSphereEl||document.createElement("a-entity"),r.setAttribute("geometry",{primitive:"circle",radius:1,segments:64}),r.setAttribute("material",{shader:"portal",pano:this.data.image,side:"double"}),i.setAttribute("text",{color:this.data.titleColor,align:"center",font:"kelsonsans",value:this.data.title||this.data.href,width:4}),i.setAttribute("position","0 1.5 0"),r.appendChild(i),e.setAttribute("geometry",{primitive:"sphere",radius:1,phiStart:0,segmentsWidth:64,segmentsHeight:64,phiLength:180,thetaStart:0,thetaLength:360}),e.setAttribute("material",{shader:"portal",borderEnabled:0,pano:this.data.image,side:"back"}),e.setAttribute("rotation","0 180 0"),e.setAttribute("position","0 0 0"),e.setAttribute("visible",!1),r.appendChild(e),t.setAttribute("geometry",{primitive:"sphere",radius:10,segmentsWidth:64,segmentsHeight:64}),t.setAttribute("material",{shader:"portal",borderEnabled:0,pano:this.data.image,side:"back"}),t.setAttribute("visible",!1),r.appendChild(t),this.visualAspectInitialized=!0)},navigate:function(){window.location=this.data.href},tick:function(){var e=new THREE.Vector3,t=new THREE.Vector3,i=new THREE.Quaternion,r=new THREE.Vector3;return function(){var o,a,n=this.el,s=n.object3D,l=n.sceneEl.camera,d=this.textEl;if(this.data.visualAspectEnabled)if(s.updateMatrixWorld(),l.parent.updateMatrixWorld(),l.updateMatrixWorld(),s.matrix.decompose(t,i,r),t.setFromMatrixPosition(s.matrixWorld),e.setFromMatrixPosition(l.matrixWorld),(a=t.distanceTo(e))>20)this.previousQuaternion||(this.quaternionClone.copy(i),this.previousQuaternion=this.quaternionClone),s.lookAt(e);else{if(o=this.calculateCameraPortalOrientation(),a<.5){if(!0===this.semiSphereEl.getAttribute("visible"))return;d.setAttribute("text","width",1.5),o<=0?(d.setAttribute("position","0 0 0.75"),d.setAttribute("rotation","0 180 0"),this.semiSphereEl.setAttribute("rotation","0 0 0")):(d.setAttribute("position","0 0 -0.75"),d.setAttribute("rotation","0 0 0"),this.semiSphereEl.setAttribute("rotation","0 180 0")),n.getObject3D("mesh").visible=!1,this.semiSphereEl.setAttribute("visible",!0),this.peekCameraPortalOrientation=o}else o<=0?d.setAttribute("rotation","0 180 0"):d.setAttribute("rotation","0 0 0"),d.setAttribute("text","width",5),d.setAttribute("position","0 1.5 0"),n.getObject3D("mesh").visible=!0,this.semiSphereEl.setAttribute("visible",!1),this.peekCameraPortalOrientation=void 0;this.previousQuaternion&&(s.quaternion.copy(this.previousQuaternion),this.previousQuaternion=void 0)}}}(),hideAll:function(){var e=this.el,t=this.hiddenEls,i=this;t.length>0||e.sceneEl.object3D.traverse(function(r){r&&r.el&&r.el.hasAttribute("link-controls")||r.el&&r!==e.sceneEl.object3D&&r.el!==e&&r.el!==i.sphereEl&&r.el!==e.sceneEl.cameraEl&&!1!==r.el.getAttribute("visible")&&r.el!==i.textEl&&r.el!==i.semiSphereEl&&(r.el.setAttribute("visible",!1),t.push(r.el))})},showAll:function(){this.hiddenEls.forEach(function(e){e.setAttribute("visible",!0)}),this.hiddenEls=[]},calculateCameraPortalOrientation:function(){var e=new THREE.Matrix4,t=new THREE.Vector3,i=new THREE.Vector3(0,0,1),r=new THREE.Vector3(0,0,0);return function(){var o=this.el,a=o.sceneEl.camera;return t.set(0,0,0),i.set(0,0,1),r.set(0,0,0),o.object3D.matrixWorld.extractRotation(e),i.applyMatrix4(e),o.object3D.updateMatrixWorld(),o.object3D.localToWorld(r),a.parent.parent.updateMatrixWorld(),a.parent.updateMatrixWorld(),a.updateMatrixWorld(),a.localToWorld(t),t.sub(r).normalize(),i.normalize(),Math.sign(i.dot(t))}}(),remove:function(){this.removeEventListener()}}),registerShader("portal",{schema:{borderEnabled:{default:1,type:"int",is:"uniform"},backgroundColor:{default:"red",type:"color",is:"uniform"},pano:{type:"map",is:"uniform"},strokeColor:{default:"white",type:"color",is:"uniform"}},vertexShader:["vec3 portalPosition;","varying vec3 vWorldPosition;","varying float vDistanceToCenter;","varying float vDistance;","void main() {","vDistanceToCenter = clamp(length(position - vec3(0.0, 0.0, 0.0)), 0.0, 1.0);","portalPosition = (modelMatrix * vec4(0.0, 0.0, 0.0, 1.0)).xyz;","vDistance = length(portalPosition - cameraPosition);","vWorldPosition = (modelMatrix * vec4(position, 1.0)).xyz;","gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);","}"].join("\n"),fragmentShader:["#define RECIPROCAL_PI2 0.15915494","uniform sampler2D pano;","uniform vec3 strokeColor;","uniform vec3 backgroundColor;","uniform float borderEnabled;","varying float vDistanceToCenter;","varying float vDistance;","varying vec3 vWorldPosition;","void main() {","vec3 direction = normalize(vWorldPosition - cameraPosition);","vec2 sampleUV;","float borderThickness = clamp(exp(-vDistance / 50.0), 0.6, 0.95);","sampleUV.y = clamp(direction.y * 0.5 + 0.5, 0.0, 1.0);","sampleUV.x = atan(direction.z, -direction.x) * -RECIPROCAL_PI2 + 0.5;","if (vDistanceToCenter > borderThickness && borderEnabled == 1.0) {","gl_FragColor = vec4(strokeColor, 1.0);","} else {","gl_FragColor = mix(texture2D(pano, sampleUV), vec4(backgroundColor, 1.0), clamp(pow((vDistance / 15.0), 2.0), 0.0, 1.0));","}","}"].join("\n")});
  1854. },{"../core/component":131,"../core/shader":141,"../lib/three":179}],90:[function(_dereq_,module,exports){
  1855. var registerComponent=_dereq_("../core/component").registerComponent,THREE=_dereq_("../lib/three"),utils=_dereq_("../utils/"),bind=utils.bind,PI_2=Math.PI/2;module.exports.Component=registerComponent("look-controls",{dependencies:["position","rotation"],schema:{enabled:{default:!0},magicWindowTrackingEnabled:{default:!0},pointerLockEnabled:{default:!1},reverseMouseDrag:{default:!1},reverseTouchDrag:{default:!1},touchEnabled:{default:!0},mouseEnabled:{default:!0}},init:function(){this.deltaYaw=0,this.previousHMDPosition=new THREE.Vector3,this.hmdQuaternion=new THREE.Quaternion,this.magicWindowAbsoluteEuler=new THREE.Euler,this.magicWindowDeltaEuler=new THREE.Euler,this.position=new THREE.Vector3,this.magicWindowObject=new THREE.Object3D,this.rotation={},this.deltaRotation={},this.savedPose=null,this.pointerLocked=!1,this.setupMouseControls(),this.bindMethods(),this.previousMouseEvent={},this.setupMagicWindowControls(),this.savedPose={position:new THREE.Vector3,rotation:new THREE.Euler},this.el.sceneEl.is("vr-mode")&&this.onEnterVR()},setupMagicWindowControls:function(){var e,t=this.data;utils.device.isMobile()&&(e=this.magicWindowControls=new THREE.DeviceOrientationControls(this.magicWindowObject),"undefined"!=typeof DeviceOrientationEvent&&DeviceOrientationEvent.requestPermission&&(e.enabled=!1,this.el.sceneEl.components["device-orientation-permission-ui"].permissionGranted?e.enabled=t.magicWindowTrackingEnabled:this.el.sceneEl.addEventListener("deviceorientationpermissiongranted",function(){e.enabled=t.magicWindowTrackingEnabled})))},update:function(e){var t=this.data;t.enabled!==e.enabled&&this.updateGrabCursor(t.enabled),e&&!t.magicWindowTrackingEnabled&&e.magicWindowTrackingEnabled&&(this.magicWindowAbsoluteEuler.set(0,0,0),this.magicWindowDeltaEuler.set(0,0,0)),this.magicWindowControls&&(this.magicWindowControls.enabled=t.magicWindowTrackingEnabled),e&&!t.pointerLockEnabled!==e.pointerLockEnabled&&(this.removeEventListeners(),this.addEventListeners(),this.pointerLocked&&this.exitPointerLock())},tick:function(e){this.data.enabled&&this.updateOrientation()},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners(),this.pointerLocked&&this.exitPointerLock()},remove:function(){this.removeEventListeners(),this.pointerLocked&&this.exitPointerLock()},bindMethods:function(){this.onMouseDown=bind(this.onMouseDown,this),this.onMouseMove=bind(this.onMouseMove,this),this.onMouseUp=bind(this.onMouseUp,this),this.onTouchStart=bind(this.onTouchStart,this),this.onTouchMove=bind(this.onTouchMove,this),this.onTouchEnd=bind(this.onTouchEnd,this),this.onEnterVR=bind(this.onEnterVR,this),this.onExitVR=bind(this.onExitVR,this),this.onPointerLockChange=bind(this.onPointerLockChange,this),this.onPointerLockError=bind(this.onPointerLockError,this)},setupMouseControls:function(){this.mouseDown=!1,this.pitchObject=new THREE.Object3D,this.yawObject=new THREE.Object3D,this.yawObject.position.y=10,this.yawObject.add(this.pitchObject)},addEventListeners:function(){var e=this.el.sceneEl,t=e.canvas;if(!t)return void e.addEventListener("render-target-loaded",bind(this.addEventListeners,this));t.addEventListener("mousedown",this.onMouseDown,!1),window.addEventListener("mousemove",this.onMouseMove,!1),window.addEventListener("mouseup",this.onMouseUp,!1),t.addEventListener("touchstart",this.onTouchStart),window.addEventListener("touchmove",this.onTouchMove),window.addEventListener("touchend",this.onTouchEnd),e.addEventListener("enter-vr",this.onEnterVR),e.addEventListener("exit-vr",this.onExitVR),this.data.pointerLockEnabled&&(document.addEventListener("pointerlockchange",this.onPointerLockChange,!1),document.addEventListener("mozpointerlockchange",this.onPointerLockChange,!1),document.addEventListener("pointerlockerror",this.onPointerLockError,!1))},removeEventListeners:function(){var e=this.el.sceneEl,t=e&&e.canvas;t&&(t.removeEventListener("mousedown",this.onMouseDown),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onMouseUp),t.removeEventListener("touchstart",this.onTouchStart),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd),e.removeEventListener("enter-vr",this.onEnterVR),e.removeEventListener("exit-vr",this.onExitVR),document.removeEventListener("pointerlockchange",this.onPointerLockChange,!1),document.removeEventListener("mozpointerlockchange",this.onPointerLockChange,!1),document.removeEventListener("pointerlockerror",this.onPointerLockError,!1))},updateOrientation:function(){var e=new THREE.Matrix4;return function(){var t,o=this.el.object3D,n=this.pitchObject,i=this.yawObject,s=this.el.sceneEl;if(s.is("vr-mode")&&s.checkHeadsetConnected())return void(s.hasWebXR&&(t=s.renderer.xr.getCameraPose())&&(e.elements=t.transform.matrix,e.decompose(o.position,o.rotation,o.scale)));this.updateMagicWindowOrientation(),o.rotation.x=this.magicWindowDeltaEuler.x+n.rotation.x,o.rotation.y=this.magicWindowDeltaEuler.y+i.rotation.y,o.rotation.z=this.magicWindowDeltaEuler.z}}(),updateMagicWindowOrientation:function(){var e=this.magicWindowAbsoluteEuler,t=this.magicWindowDeltaEuler;this.magicWindowControls&&this.magicWindowControls.enabled&&(this.magicWindowControls.update(),e.setFromQuaternion(this.magicWindowObject.quaternion,"YXZ"),this.previousMagicWindowYaw||0===e.y||(this.previousMagicWindowYaw=e.y),this.previousMagicWindowYaw&&(t.x=e.x,t.y+=e.y-this.previousMagicWindowYaw,t.z=e.z,this.previousMagicWindowYaw=e.y))},onMouseMove:function(e){var t,o,n,i=this.pitchObject,s=this.previousMouseEvent,r=this.yawObject;this.data.enabled&&(this.mouseDown||this.pointerLocked)&&(this.pointerLocked?(o=e.movementX||e.mozMovementX||0,n=e.movementY||e.mozMovementY||0):(o=e.screenX-s.screenX,n=e.screenY-s.screenY),this.previousMouseEvent.screenX=e.screenX,this.previousMouseEvent.screenY=e.screenY,t=this.data.reverseMouseDrag?1:-1,r.rotation.y+=.002*o*t,i.rotation.x+=.002*n*t,i.rotation.x=Math.max(-PI_2,Math.min(PI_2,i.rotation.x)))},onMouseDown:function(e){var t=this.el.sceneEl;if(this.data.enabled&&this.data.mouseEnabled&&(!t.is("vr-mode")||!t.checkHeadsetConnected())&&0===e.button){var o=t&&t.canvas;this.mouseDown=!0,this.previousMouseEvent.screenX=e.screenX,this.previousMouseEvent.screenY=e.screenY,this.showGrabbingCursor(),this.data.pointerLockEnabled&&!this.pointerLocked&&(o.requestPointerLock?o.requestPointerLock():o.mozRequestPointerLock&&o.mozRequestPointerLock())}},showGrabbingCursor:function(){this.el.sceneEl.canvas.style.cursor="grabbing"},hideGrabbingCursor:function(){this.el.sceneEl.canvas.style.cursor=""},onMouseUp:function(){this.mouseDown=!1,this.hideGrabbingCursor()},onTouchStart:function(e){1===e.touches.length&&this.data.touchEnabled&&!this.el.sceneEl.is("vr-mode")&&(this.touchStart={x:e.touches[0].pageX,y:e.touches[0].pageY},this.touchStarted=!0)},onTouchMove:function(e){var t,o,n=this.el.sceneEl.canvas,i=this.yawObject;this.touchStarted&&this.data.touchEnabled&&(o=2*Math.PI*(e.touches[0].pageX-this.touchStart.x)/n.clientWidth,t=this.data.reverseTouchDrag?1:-1,i.rotation.y-=.5*o*t,this.touchStart={x:e.touches[0].pageX,y:e.touches[0].pageY})},onTouchEnd:function(){this.touchStarted=!1},onEnterVR:function(){var e=this.el.sceneEl;e.checkHeadsetConnected()&&(this.saveCameraPose(),this.el.object3D.position.set(0,0,0),this.el.object3D.rotation.set(0,0,0),e.hasWebXR&&(this.el.object3D.matrixAutoUpdate=!1,this.el.object3D.updateMatrix()))},onExitVR:function(){this.el.sceneEl.checkHeadsetConnected()&&(this.restoreCameraPose(),this.previousHMDPosition.set(0,0,0),this.el.object3D.matrixAutoUpdate=!0)},onPointerLockChange:function(){this.pointerLocked=!(!document.pointerLockElement&&!document.mozPointerLockElement)},onPointerLockError:function(){this.pointerLocked=!1},exitPointerLock:function(){document.exitPointerLock(),this.pointerLocked=!1},updateGrabCursor:function(e){function t(){n.canvas.classList.add("a-grab-cursor")}function o(){n.canvas.classList.remove("a-grab-cursor")}var n=this.el.sceneEl;return n.canvas?e?void t():void o():void(e?n.addEventListener("render-target-loaded",t):n.addEventListener("render-target-loaded",o))},saveCameraPose:function(){var e=this.el;this.savedPose.position.copy(e.object3D.position),this.savedPose.rotation.copy(e.object3D.rotation),this.hasSavedPose=!0},restoreCameraPose:function(){var e=this.el,t=this.savedPose;this.hasSavedPose&&(e.object3D.position.copy(t.position),e.object3D.rotation.copy(t.rotation),this.hasSavedPose=!1)}});
  1856. },{"../core/component":131,"../lib/three":179,"../utils/":205}],91:[function(_dereq_,module,exports){
  1857. var bind=_dereq_("../utils/bind"),registerComponent=_dereq_("../core/component").registerComponent,trackedControlsUtils=_dereq_("../utils/tracked-controls"),checkControllerPresentAndSetup=trackedControlsUtils.checkControllerPresentAndSetup,emitIfAxesChanged=trackedControlsUtils.emitIfAxesChanged,onButtonEvent=trackedControlsUtils.onButtonEvent,GAMEPAD_ID_PREFIX="magicleap",GAMEPAD_ID_SUFFIX="-one",GAMEPAD_ID_COMPOSITE=GAMEPAD_ID_PREFIX+GAMEPAD_ID_SUFFIX,MAGICLEAP_CONTROLLER_MODEL_GLB_URL="https://cdn.aframe.io/controllers/magicleap/magicleap-one-controller.glb",INPUT_MAPPING_WEBXR={axes:{touchpad:[0,1]},buttons:["trigger","grip","touchpad","menu"]};module.exports.Component=registerComponent("magicleap-controls",{schema:{hand:{default:"none"},model:{default:!0},orientationOffset:{type:"vec3"}},mapping:INPUT_MAPPING_WEBXR,init:function(){var t=this;this.controllerPresent=!1,this.lastControllerCheck=0,this.onButtonChanged=bind(this.onButtonChanged,this),this.onButtonDown=function(e){onButtonEvent(e.detail.id,"down",t)},this.onButtonUp=function(e){onButtonEvent(e.detail.id,"up",t)},this.onButtonTouchEnd=function(e){onButtonEvent(e.detail.id,"touchend",t)},this.onButtonTouchStart=function(e){onButtonEvent(e.detail.id,"touchstart",t)},this.previousButtonValues={},this.rendererSystem=this.el.sceneEl.systems.renderer,this.bindMethods()},update:function(){var t=this.data;this.controllerIndex="right"===t.hand?0:"left"===t.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=bind(this.onModelLoaded,this),this.onControllersUpdate=bind(this.onControllersUpdate,this),this.checkIfControllerPresent=bind(this.checkIfControllerPresent,this),this.removeControllersUpdateListener=bind(this.removeControllersUpdateListener,this),this.onAxisMoved=bind(this.onAxisMoved,this)},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("axismove",this.onAxisMoved),t.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("axismove",this.onAxisMoved),t.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var t=this.data;checkControllerPresentAndSetup(this,GAMEPAD_ID_COMPOSITE,{index:this.controllerIndex,hand:t.hand})},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{idPrefix:GAMEPAD_ID_COMPOSITE,hand:e.hand,controller:this.controllerIndex,orientationOffset:e.orientationOffset}),this.data.model&&this.el.setAttribute("gltf-model",MAGICLEAP_CONTROLLER_MODEL_GLB_URL)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(t){var e,n=this.mapping.buttons[t.detail.id];n&&("trigger"===n&&(e=t.detail.state.value,console.log("analog value of trigger press: "+e)),this.el.emit(n+"changed",t.detail.state))},onModelLoaded:function(t){t.detail.model.scale.set(.01,.01,.01)},onAxisMoved:function(t){emitIfAxesChanged(this,this.mapping.axes,t)},updateModel:function(t,e){},setButtonColor:function(t,e){}});
  1858. },{"../core/component":131,"../utils/bind":199,"../utils/tracked-controls":214}],92:[function(_dereq_,module,exports){
  1859. function parseSide(e){switch(e){case"back":return THREE.BackSide;case"double":return THREE.DoubleSide;default:return THREE.FrontSide}}function parseVertexColors(e){switch(e){case"face":return THREE.FaceColors;case"vertex":return THREE.VertexColors;default:return THREE.NoColors}}function parseBlending(e){switch(e){case"none":return THREE.NoBlending;case"additive":return THREE.AdditiveBlending;case"subtractive":return THREE.SubtractiveBlending;case"multiply":return THREE.MultiplyBlending;default:return THREE.NormalBlending}}function disposeMaterial(e,t){e.dispose(),t.unregisterMaterial(e)}var utils=_dereq_("../utils/"),component=_dereq_("../core/component"),THREE=_dereq_("../lib/three"),shader=_dereq_("../core/shader"),error=utils.debug("components:material:error"),registerComponent=component.registerComponent,shaders=shader.shaders,shaderNames=shader.shaderNames;module.exports.Component=registerComponent("material",{schema:{alphaTest:{default:0,min:0,max:1},depthTest:{default:!0},depthWrite:{default:!0},flatShading:{default:!1},npot:{default:!1},offset:{type:"vec2",default:{x:0,y:0}},opacity:{default:1,min:0,max:1},repeat:{type:"vec2",default:{x:1,y:1}},shader:{default:"standard",oneOf:shaderNames,schemaChange:!0},side:{default:"front",oneOf:["front","back","double"]},transparent:{default:!1},vertexColors:{type:"string",default:"none",oneOf:["face","vertex"]},visible:{default:!0},blending:{default:"normal",oneOf:["none","normal","additive","subtractive","multiply"]},dithering:{default:!0}},init:function(){this.material=null},update:function(e){var t=this.data;this.shader&&t.shader===e.shader||this.updateShader(t.shader),this.shader.update(this.data),this.updateMaterial(e)},updateSchema:function(e){var t,a,r,i;a=e&&e.shader,t=this.oldData&&this.oldData.shader,i=a||t,r=shaders[i]&&shaders[i].schema,r||error("Unknown shader schema "+i),t&&a===t||(this.extendSchema(r),this.updateBehavior())},updateBehavior:function(){function e(e,t){var r;for(r in a)a[r]=e;s.shader.update(a)}var t,a,r=this.el.sceneEl,i=this.schema,s=this;this.tick=void 0,a={};for(t in i)"time"===i[t].type&&(this.tick=e,a[t]=!0);r&&(this.tick?r.addBehavior(this):r.removeBehavior(this))},updateShader:function(e){var t,a=this.data,r=shaders[e]&&shaders[e].Shader;if(!r)throw new Error("Unknown shader "+e);t=this.shader=new r,t.el=this.el,t.init(a),this.setMaterial(t.material),this.updateSchema(a)},updateMaterial:function(e){var t,a=this.data,r=this.material;r.alphaTest=a.alphaTest,r.depthTest=!1!==a.depthTest,r.depthWrite=!1!==a.depthWrite,r.opacity=a.opacity,r.flatShading=a.flatShading,r.side=parseSide(a.side),r.transparent=!1!==a.transparent||a.opacity<1,r.vertexColors=parseVertexColors(a.vertexColors),r.visible=a.visible,r.blending=parseBlending(a.blending),r.dithering=a.dithering;for(t in e)break;!t||e.alphaTest===a.alphaTest&&e.side===a.side&&e.vertexColors===a.vertexColors||(r.needsUpdate=!0)},remove:function(){var e=new THREE.MeshBasicMaterial,t=this.material,a=this.el.getObject3D("mesh");a&&(a.material=e),disposeMaterial(t,this.system)},setMaterial:function(e){var t,a=this.el,r=this.system;this.material&&disposeMaterial(this.material,r),this.material=e,r.registerMaterial(e),t=a.getObject3D("mesh"),t?t.material=e:a.addEventListener("object3dset",function t(r){"mesh"===r.detail.type&&r.target===a&&(a.getObject3D("mesh").material=e,a.removeEventListener("object3dset",t))})}});
  1860. },{"../core/component":131,"../core/shader":141,"../lib/three":179,"../utils/":205}],93:[function(_dereq_,module,exports){
  1861. var debug=_dereq_("../utils/debug"),registerComponent=_dereq_("../core/component").registerComponent,THREE=_dereq_("../lib/three"),warn=debug("components:obj-model:warn");module.exports.Component=registerComponent("obj-model",{schema:{mtl:{type:"model"},obj:{type:"model"}},init:function(){var e=this;this.model=null,this.objLoader=new THREE.OBJLoader,this.mtlLoader=new THREE.MTLLoader(this.objLoader.manager),this.mtlLoader.crossOrigin="",this.el.addEventListener("componentinitialized",function(o){e.model&&"material"===o.detail.name&&e.applyMaterial()})},update:function(){var e=this.data;e.obj&&(this.resetMesh(),this.loadObj(e.obj,e.mtl))},remove:function(){this.model&&this.resetMesh()},resetMesh:function(){this.el.removeObject3D("mesh")},loadObj:function(e,o){var t=this,r=this.el,i=this.mtlLoader,a=this.objLoader,s=this.el.sceneEl.systems.renderer,n=o.substr(0,o.lastIndexOf("/")+1);if(o)return r.hasAttribute("material")&&warn("Material component properties are ignored when a .MTL is provided"),i.setResourcePath(n),void i.load(o,function(o){o.preload(),a.setMaterials(o),a.load(e,function(e){t.model=e,t.model.traverse(function(e){if(e.isMesh){var o=e.material;o.color&&s.applyColorCorrection(o.color),o.map&&s.applyColorCorrection(o.map),o.emissive&&s.applyColorCorrection(o.emissive),o.emissiveMap&&s.applyColorCorrection(o.emissiveMap)}}),r.setObject3D("mesh",e),r.emit("model-loaded",{format:"obj",model:e})})});a.load(e,function(e){t.model=e,t.applyMaterial(),r.setObject3D("mesh",e),r.emit("model-loaded",{format:"obj",model:e})})},applyMaterial:function(){var e=this.el.components.material;e&&this.model.traverse(function(o){o instanceof THREE.Mesh&&(o.material=e.material)})}});
  1862. },{"../core/component":131,"../lib/three":179,"../utils/debug":201}],94:[function(_dereq_,module,exports){
  1863. var registerComponent=_dereq_("../core/component").registerComponent,bind=_dereq_("../utils/bind"),trackedControlsUtils=_dereq_("../utils/tracked-controls"),checkControllerPresentAndSetup=trackedControlsUtils.checkControllerPresentAndSetup,emitIfAxesChanged=trackedControlsUtils.emitIfAxesChanged,onButtonEvent=trackedControlsUtils.onButtonEvent,isWebXRAvailable=_dereq_("../utils/").device.isWebXRAvailable,GAMEPAD_ID_WEBXR="oculus-go",GAMEPAD_ID_WEBVR="Oculus Go",OCULUS_GO_CONTROLLER_MODEL_URL="https://cdn.aframe.io/controllers/oculus/go/oculus-go-controller.gltf",GAMEPAD_ID_PREFIX=isWebXRAvailable?GAMEPAD_ID_WEBXR:GAMEPAD_ID_WEBVR,INPUT_MAPPING_WEBVR={axes:{trackpad:[0,1]},buttons:["trackpad","trigger"]},INPUT_MAPPING_WEBXR={axes:{touchpad:[0,1]},buttons:["trigger","none","touchpad"]},INPUT_MAPPING=isWebXRAvailable?INPUT_MAPPING_WEBXR:INPUT_MAPPING_WEBVR;module.exports.Component=registerComponent("oculus-go-controls",{schema:{hand:{default:""},buttonColor:{type:"color",default:"#FFFFFF"},buttonTouchedColor:{type:"color",default:"#BBBBBB"},buttonHighlightColor:{type:"color",default:"#7A7A7A"},model:{default:!0},orientationOffset:{type:"vec3"},armModel:{default:!0}},mapping:INPUT_MAPPING,bindMethods:function(){this.onModelLoaded=bind(this.onModelLoaded,this),this.onControllersUpdate=bind(this.onControllersUpdate,this),this.checkIfControllerPresent=bind(this.checkIfControllerPresent,this),this.removeControllersUpdateListener=bind(this.removeControllersUpdateListener,this),this.onAxisMoved=bind(this.onAxisMoved,this)},init:function(){var t=this;this.onButtonChanged=bind(this.onButtonChanged,this),this.onButtonDown=function(e){onButtonEvent(e.detail.id,"down",t)},this.onButtonUp=function(e){onButtonEvent(e.detail.id,"up",t)},this.onButtonTouchStart=function(e){onButtonEvent(e.detail.id,"touchstart",t)},this.onButtonTouchEnd=function(e){onButtonEvent(e.detail.id,"touchend",t)},this.controllerPresent=!1,this.lastControllerCheck=0,this.rendererSystem=this.el.sceneEl.systems.renderer,this.bindMethods()},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("model-loaded",this.onModelLoaded),t.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("model-loaded",this.onModelLoaded),t.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){checkControllerPresentAndSetup(this,GAMEPAD_ID_PREFIX,this.data.hand?{hand:this.data.hand}:{})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{armModel:e.armModel,hand:e.hand,idPrefix:GAMEPAD_ID_PREFIX,orientationOffset:e.orientationOffset}),this.data.model&&this.el.setAttribute("gltf-model",OCULUS_GO_CONTROLLER_MODEL_URL)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelLoaded:function(t){var e,o=t.detail.model;this.data.model&&(e=this.buttonMeshes={},e.trigger=o.getObjectByName("oculus_go_button_trigger"),e.trackpad=o.getObjectByName("oculus_go_touchpad"),e.touchpad=o.getObjectByName("oculus_go_touchpad"))},onButtonChanged:function(t){var e=this.mapping.buttons[t.detail.id];e&&this.el.emit(e+"changed",t.detail.state)},onAxisMoved:function(t){emitIfAxesChanged(this,this.mapping.axes,t)},updateModel:function(t,e){this.data.model&&this.updateButtonModel(t,e)},updateButtonModel:function(t,e){var o=this.buttonMeshes;if(o&&o[t]){var n,i;switch(e){case"down":n=this.data.buttonHighlightColor;break;case"touchstart":n=this.data.buttonTouchedColor;break;default:n=this.data.buttonColor}i=o[t],i.material.color.set(n),this.rendererSystem.applyColorCorrection(i.material.color)}}});
  1864. },{"../core/component":131,"../utils/":205,"../utils/bind":199,"../utils/tracked-controls":214}],95:[function(_dereq_,module,exports){
  1865. var bind=_dereq_("../utils/bind"),registerComponent=_dereq_("../core/component").registerComponent,THREE=_dereq_("../lib/three"),trackedControlsUtils=_dereq_("../utils/tracked-controls"),checkControllerPresentAndSetup=trackedControlsUtils.checkControllerPresentAndSetup,emitIfAxesChanged=trackedControlsUtils.emitIfAxesChanged,onButtonEvent=trackedControlsUtils.onButtonEvent,isWebXRAvailable=_dereq_("../utils/").device.isWebXRAvailable,GAMEPAD_ID_WEBXR="oculus-touch",GAMEPAD_ID_WEBVR="Oculus Touch",GAMEPAD_ID_PREFIX=isWebXRAvailable?GAMEPAD_ID_WEBXR:GAMEPAD_ID_WEBVR,TOUCH_CONTROLLER_MODEL_BASE_URL="https://cdn.aframe.io/controllers/oculus/oculus-touch-controller-",OCULUS_TOUCH_WEBVR={left:{modelUrl:TOUCH_CONTROLLER_MODEL_BASE_URL+"left.gltf",rayOrigin:{origin:{x:.008,y:-.01,z:0},direction:{x:0,y:-.8,z:-1}},modelPivotOffset:new THREE.Vector3(-.005,.003,-.055),modelPivotRotation:new THREE.Euler(0,0,0)},right:{modelUrl:TOUCH_CONTROLLER_MODEL_BASE_URL+"right.gltf",rayOrigin:{origin:{x:-.008,y:-.01,z:0},direction:{x:0,y:-.8,z:-1}},modelPivotOffset:new THREE.Vector3(.005,.003,-.055),modelPivotRotation:new THREE.Euler(0,0,0)}},OCULUS_TOUCH_WEBXR={left:{modelUrl:TOUCH_CONTROLLER_MODEL_BASE_URL+"left.gltf",rayOrigin:{origin:{x:.002,y:-.005,z:-.03},direction:{x:0,y:-.8,z:-1}},modelPivotOffset:new THREE.Vector3(-.005,.036,-.037),modelPivotRotation:new THREE.Euler(Math.PI/4.5,0,0)},right:{modelUrl:TOUCH_CONTROLLER_MODEL_BASE_URL+"right.gltf",rayOrigin:{origin:{x:-.002,y:-.005,z:-.03},direction:{x:0,y:-.8,z:-1}},modelPivotOffset:new THREE.Vector3(.005,.036,-.037),modelPivotRotation:new THREE.Euler(Math.PI/4.5,0,0)}},OCULUS_TOUCH_CONFIG=isWebXRAvailable?OCULUS_TOUCH_WEBXR:OCULUS_TOUCH_WEBVR,CONTROLLER_DEFAULT="oculus-touch",CONTROLLER_PROPERTIES={"oculus-touch":OCULUS_TOUCH_CONFIG,"oculus-touch-v2":{left:{modelUrl:TOUCH_CONTROLLER_MODEL_BASE_URL+"gen2-left.gltf",rayOrigin:{origin:{x:-.01,y:0,z:-.02},direction:{x:0,y:-.5,z:-1}},modelPivotOffset:new THREE.Vector3(0,0,0),modelPivotRotation:new THREE.Euler(0,0,0)},right:{modelUrl:TOUCH_CONTROLLER_MODEL_BASE_URL+"gen2-right.gltf",rayOrigin:{origin:{x:.01,y:0,z:-.02},direction:{x:0,y:-.5,z:-1}},modelPivotOffset:new THREE.Vector3(0,0,0),modelPivotRotation:new THREE.Euler(0,0,0)}},"oculus-touch-v3":{left:{modelUrl:TOUCH_CONTROLLER_MODEL_BASE_URL+"v3-left.glb",rayOrigin:{origin:{x:.015,y:.005,z:0},direction:{x:0,y:0,z:-1}},modelPivotOffset:new THREE.Vector3(.01,-.01,.05),modelPivotRotation:new THREE.Euler(Math.PI/4,0,0)},right:{modelUrl:TOUCH_CONTROLLER_MODEL_BASE_URL+"v3-right.glb",rayOrigin:{origin:{x:-.015,y:.005,z:0},direction:{x:0,y:0,z:-1}},modelPivotOffset:new THREE.Vector3(-.01,-.01,.05),modelPivotRotation:new THREE.Euler(Math.PI/4,0,0)}}},INPUT_MAPPING_WEBVR={left:{axes:{thumbstick:[0,1]},buttons:["thumbstick","trigger","grip","xbutton","ybutton","surface"]},right:{axes:{thumbstick:[0,1]},buttons:["thumbstick","trigger","grip","abutton","bbutton","surface"]}},INPUT_MAPPING_WEBXR={left:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","xbutton","ybutton","surface"]},right:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","abutton","bbutton","surface"]}},INPUT_MAPPING=isWebXRAvailable?INPUT_MAPPING_WEBXR:INPUT_MAPPING_WEBVR;module.exports.Component=registerComponent("oculus-touch-controls",{schema:{hand:{default:"left"},buttonColor:{type:"color",default:"#999"},buttonTouchColor:{type:"color",default:"#8AB"},buttonHighlightColor:{type:"color",default:"#2DF"},model:{default:!0},controllerType:{default:"auto",oneOf:["auto","oculus-touch","oculus-touch-v2","oculus-touch-v3"]},orientationOffset:{type:"vec3",default:{x:43,y:0,z:0}}},mapping:INPUT_MAPPING,bindMethods:function(){this.onModelLoaded=bind(this.onModelLoaded,this),this.onControllersUpdate=bind(this.onControllersUpdate,this),this.checkIfControllerPresent=bind(this.checkIfControllerPresent,this),this.onAxisMoved=bind(this.onAxisMoved,this)},init:function(){var t=this;this.onButtonChanged=bind(this.onButtonChanged,this),this.onButtonDown=function(e){onButtonEvent(e.detail.id,"down",t,t.data.hand)},this.onButtonUp=function(e){onButtonEvent(e.detail.id,"up",t,t.data.hand)},this.onButtonTouchStart=function(e){onButtonEvent(e.detail.id,"touchstart",t,t.data.hand)},this.onButtonTouchEnd=function(e){onButtonEvent(e.detail.id,"touchend",t,t.data.hand)},this.controllerPresent=!1,this.lastControllerCheck=0,this.previousButtonValues={},this.rendererSystem=this.el.sceneEl.systems.renderer,this.bindMethods()},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("axismove",this.onAxisMoved),t.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("axismove",this.onAxisMoved),t.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){checkControllerPresentAndSetup(this,GAMEPAD_ID_PREFIX,{hand:this.data.hand})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},loadModel:function(t){var e,o=this.data;if(o.model){if(this.displayModel=CONTROLLER_PROPERTIES[o.controllerType]||CONTROLLER_PROPERTIES[CONTROLLER_DEFAULT],"auto"===o.controllerType){var n=this.el.sceneEl.systems["tracked-controls-webvr"];if(n&&n.vrDisplay){/^Oculus Quest$/.test(n.vrDisplay.displayName)&&(this.displayModel=CONTROLLER_PROPERTIES["oculus-touch-v2"])}else e=CONTROLLER_DEFAULT,e=-1!==t.profiles.indexOf("oculus-touch-v2")?"oculus-touch-v2":e,e=-1!==t.profiles.indexOf("oculus-touch-v3")?"oculus-touch-v3":e,this.displayModel=CONTROLLER_PROPERTIES[e]}var i=this.displayModel[o.hand].modelUrl;this.el.setAttribute("gltf-model",i)}},injectTrackedControls:function(t){var e=this.data,o=GAMEPAD_ID_WEBXR,n="right"===e.hand?"Oculus Touch (Right)":"Oculus Touch (Left)",i=isWebXRAvailable?o:n;this.el.setAttribute("tracked-controls",{id:i,hand:e.hand,orientationOffset:e.orientationOffset,handTrackingEnabled:!1}),this.loadModel(t)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(t){var e,o=this.mapping[this.data.hand].buttons[t.detail.id],n=this.buttonMeshes;o&&("trigger"!==o&&"grip"!==o||(e=t.detail.state.value),n&&("trigger"===o&&n.trigger&&(n.trigger.rotation.x=this.originalXRotationTrigger-e*(Math.PI/26)),"grip"===o&&n.grip&&(n.grip.position.x=this.originalXPositionGrip+("left"===this.data.hand?-1:1)*e*.004)),this.el.emit(o+"changed",t.detail.state))},onModelLoaded:function(t){var e,o=this.controllerObject3D=t.detail.model;this.data.model&&(e=this.buttonMeshes={},e.grip=o.getObjectByName("buttonHand"),this.originalXPositionGrip=e.grip&&e.grip.position.x,e.thumbstick=o.getObjectByName("stick"),e.trigger=o.getObjectByName("buttonTrigger"),this.originalXRotationTrigger=e.trigger&&e.trigger.rotation.x,e.xbutton=o.getObjectByName("buttonX"),e.abutton=o.getObjectByName("buttonA"),e.ybutton=o.getObjectByName("buttonY"),e.bbutton=o.getObjectByName("buttonB"),o.position.copy(this.displayModel[this.data.hand].modelPivotOffset),o.rotation.copy(this.displayModel[this.data.hand].modelPivotRotation),this.el.emit("controllermodelready",{name:"oculus-touch-controls",model:this.data.model,rayOrigin:this.displayModel[this.data.hand].rayOrigin}))},onAxisMoved:function(t){emitIfAxesChanged(this,this.mapping[this.data.hand].axes,t)},updateModel:function(t,e){this.data.model&&this.updateButtonModel(t,e)},updateButtonModel:function(t,e){var o,n="up"===e||"touchend"===e?this.data.buttonColor:"touchstart"===e?this.data.buttonTouchColor:this.data.buttonHighlightColor,i=this.buttonMeshes;this.data.model&&i&&i[t]&&(o=i[t],o.material.color.set(n),this.rendererSystem.applyColorCorrection(o.material.color))}});
  1866. },{"../core/component":131,"../lib/three":179,"../utils/":205,"../utils/bind":199,"../utils/tracked-controls":214}],96:[function(_dereq_,module,exports){
  1867. var registerComponent=_dereq_("../core/component").registerComponent;module.exports.Component=registerComponent("position",{schema:{type:"vec3"},update:function(){var e=this.el.object3D,o=this.data;e.position.set(o.x,o.y,o.z)},remove:function(){this.el.object3D.position.set(0,0,0)}});
  1868. },{"../core/component":131}],97:[function(_dereq_,module,exports){
  1869. function copyArray(e,t){var i;for(e.length=t.length,i=0;i<t.length;i++)e[i]=t[i]}var registerComponent=_dereq_("../core/component").registerComponent,THREE=_dereq_("../lib/three"),utils=_dereq_("../utils/"),warn=utils.debug("components:raycaster:warn"),OBSERVER_SELECTOR_RE=/^[\w\s-.,[\]#]*$/,OBSERVER_CONFIG={childList:!0,attributes:!0,subtree:!0},EVENTS={INTERSECT:"raycaster-intersected",INTERSECTION:"raycaster-intersection",INTERSECT_CLEAR:"raycaster-intersected-cleared",INTERSECTION_CLEAR:"raycaster-intersection-cleared"};module.exports.Component=registerComponent("raycaster",{schema:{autoRefresh:{default:!0},direction:{type:"vec3",default:{x:0,y:0,z:-1}},enabled:{default:!0},far:{default:1e3},interval:{default:0},near:{default:0},objects:{default:""},origin:{type:"vec3"},showLine:{default:!1},lineColor:{default:"white"},lineOpacity:{default:1},useWorldCoordinates:{default:!1}},multiple:!0,init:function(){this.clearedIntersectedEls=[],this.unitLineEndVec3=new THREE.Vector3,this.intersectedEls=[],this.intersections=[],this.newIntersectedEls=[],this.newIntersections=[],this.objects=[],this.prevCheckTime=void 0,this.prevIntersectedEls=[],this.rawIntersections=[],this.raycaster=new THREE.Raycaster,this.updateOriginDirection(),this.setDirty=this.setDirty.bind(this),this.updateLine=this.updateLine.bind(this),this.observer=new MutationObserver(this.setDirty),this.dirty=!0,this.lineEndVec3=new THREE.Vector3,this.otherLineEndVec3=new THREE.Vector3,this.lineData={end:this.lineEndVec3},this.getIntersection=this.getIntersection.bind(this),this.intersectedDetail={el:this.el,getIntersection:this.getIntersection},this.intersectedClearedDetail={el:this.el},this.intersectionClearedDetail={clearedEls:this.clearedIntersectedEls},this.intersectionDetail={}},update:function(e){var t=this.data,i=this.el,s=this.raycaster;s.far=t.far,s.near=t.near,!t.showLine||t.far===e.far&&t.origin===e.origin&&t.direction===e.direction&&e.showLine||(this.unitLineEndVec3.copy(t.origin).add(t.direction).normalize(),this.drawLine()),!t.showLine&&e.showLine&&i.removeAttribute("line"),t.objects===e.objects||OBSERVER_SELECTOR_RE.test(t.objects)||warn('[raycaster] Selector "'+t.objects+'" may not update automatically with DOM changes.'),t.objects||warn('[raycaster] For performance, please define raycaster.objects when using raycaster or cursor components to whitelist which entities to intersect with. e.g., raycaster="objects: [data-raycastable]".'),t.autoRefresh!==e.autoRefresh&&i.isPlaying&&(t.autoRefresh?this.addEventListeners():this.removeEventListeners()),e.enabled&&!t.enabled&&this.clearAllIntersections(),this.setDirty()},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},remove:function(){this.data.showLine&&this.el.removeAttribute("line"),this.clearAllIntersections()},addEventListeners:function(){this.data.autoRefresh&&(this.observer.observe(this.el.sceneEl,OBSERVER_CONFIG),this.el.sceneEl.addEventListener("object3dset",this.setDirty),this.el.sceneEl.addEventListener("object3dremove",this.setDirty))},removeEventListeners:function(){this.observer.disconnect(),this.el.sceneEl.removeEventListener("object3dset",this.setDirty),this.el.sceneEl.removeEventListener("object3dremove",this.setDirty)},setDirty:function(){this.dirty=!0},refreshObjects:function(){var e,t=this.data;e=t.objects?this.el.sceneEl.querySelectorAll(t.objects):this.el.sceneEl.querySelectorAll("*"),this.objects=this.flattenObject3DMaps(e),this.dirty=!1},tock:function(e){var t=this.data,i=this.prevCheckTime;t.enabled&&(i&&e-i<t.interval||(this.prevCheckTime=e,this.checkIntersections()))},checkIntersections:function(){var e,t,i=this.clearedIntersectedEls,s=this.el,n=this.data,r=this.intersectedEls,c=this.intersections,o=this.newIntersectedEls,a=this.newIntersections,h=this.prevIntersectedEls,l=this.rawIntersections;for(this.dirty&&this.refreshObjects(),copyArray(this.prevIntersectedEls,this.intersectedEls),this.updateOriginDirection(),l.length=0,this.raycaster.intersectObjects(this.objects,!0,l),c.length=0,r.length=0,e=0;e<l.length;e++)t=l[e],n.showLine&&t.object===s.getObject3D("line")||t.object.el&&(c.push(t),r.push(t.object.el));for(a.length=0,o.length=0,e=0;e<c.length;e++)-1===h.indexOf(c[e].object.el)&&(a.push(c[e]),o.push(c[e].object.el));for(i.length=0,e=0;e<h.length;e++)-1===r.indexOf(h[e])&&(h[e].emit(EVENTS.INTERSECT_CLEAR,this.intersectedClearedDetail),i.push(h[e]));for(i.length&&s.emit(EVENTS.INTERSECTION_CLEAR,this.intersectionClearedDetail),e=0;e<o.length;e++)o[e].emit(EVENTS.INTERSECT,this.intersectedDetail);a.length&&(this.intersectionDetail.els=o,this.intersectionDetail.intersections=a,s.emit(EVENTS.INTERSECTION,this.intersectionDetail)),n.showLine&&setTimeout(this.updateLine)},updateLine:function(){var e,t=this.el,i=this.intersections;i.length&&(e=i[0].object.el===t&&i[1]?i[1].distance:i[0].distance),this.drawLine(e)},getIntersection:function(e){var t,i;for(t=0;t<this.intersections.length;t++)if(i=this.intersections[t],i.object.el===e)return i;return null},updateOriginDirection:function(){var e=new THREE.Vector3,t=new THREE.Vector3;return function(){var i=this.el,s=this.data;if(s.useWorldCoordinates)return void this.raycaster.set(s.origin,s.direction);i.object3D.updateMatrixWorld(),t.setFromMatrixPosition(i.object3D.matrixWorld),0===s.origin.x&&0===s.origin.y&&0===s.origin.z||(t=i.object3D.localToWorld(t.copy(s.origin))),e.copy(s.direction).transformDirection(i.object3D.matrixWorld).normalize(),this.raycaster.set(t,e)}}(),drawLine:function(e){var t,i=this.data,s=this.el;t=this.lineData.end===this.lineEndVec3?this.otherLineEndVec3:this.lineEndVec3,void 0===e&&(e=i.far===1/0?1e3:i.far),this.lineData.start=i.origin,this.lineData.end=t.copy(this.unitLineEndVec3).multiplyScalar(e),this.lineData.color=i.lineColor,this.lineData.opacity=i.lineOpacity,s.setAttribute("line",this.lineData)},flattenObject3DMaps:function(e){var t,i,s=this.objects;for(s.length=0,i=0;i<e.length;i++)if(e[i].isEntity&&e[i].object3D)for(t in e[i].object3DMap)s.push(e[i].getObject3D(t));return s},clearAllIntersections:function(){var e;for(e=0;e<this.intersectedEls.length;e++)this.intersectedEls[e].emit(EVENTS.INTERSECT_CLEAR,this.intersectedClearedDetail);copyArray(this.clearedIntersectedEls,this.intersectedEls),this.intersectedEls.length=0,this.intersections.length=0,this.el.emit(EVENTS.INTERSECTION_CLEAR,this.intersectionClearedDetail)}});
  1870. },{"../core/component":131,"../lib/three":179,"../utils/":205}],98:[function(_dereq_,module,exports){
  1871. var degToRad=_dereq_("../lib/three").Math.degToRad,registerComponent=_dereq_("../core/component").registerComponent;module.exports.Component=registerComponent("rotation",{schema:{type:"vec3"},update:function(){var e=this.data,o=this.el.object3D;o.rotation.set(degToRad(e.x),degToRad(e.y),degToRad(e.z)),o.rotation.order="YXZ"},remove:function(){this.el.object3D.rotation.set(0,0,0)}});
  1872. },{"../core/component":131,"../lib/three":179}],99:[function(_dereq_,module,exports){
  1873. var registerComponent=_dereq_("../core/component").registerComponent,zeroScale=1e-5;module.exports.Component=registerComponent("scale",{schema:{type:"vec3",default:{x:1,y:1,z:1}},update:function(){var e=this.data,o=this.el.object3D,t=0===e.x?zeroScale:e.x,r=0===e.y?zeroScale:e.y,c=0===e.z?zeroScale:e.z;o.scale.set(t,r,c)},remove:function(){this.el.object3D.scale.set(1,1,1)}});
  1874. },{"../core/component":131}],100:[function(_dereq_,module,exports){
  1875. var register=_dereq_("../../core/component").registerComponent,COMPONENTS=_dereq_("../../core/component").components;module.exports.Component=register("background",{schema:{color:{type:"color",default:"black"},transparent:{default:!1},generateEnvironment:{default:!0}},init:function(){this.cubeRenderTarget=new THREE.WebGLCubeRenderTarget(128,{format:THREE.RGBFormat,generateMipmaps:!0,minFilter:THREE.LinearMipmapLinearFilter}),this.cubeCamera=new THREE.CubeCamera(1,1e5,this.cubeRenderTarget),this.needsEnvironmentUpdate=!0},update:function(){var e=this.el.sceneEl.object3D,n=this.data,t=this.el.object3D;if(n.transparent?t.background=null:t.background=new THREE.Color(n.color),e.environment&&e.environment!==this.cubeRenderTarget.texture)return void console.warn("Background will not overide predefined environment maps");n.generateEnvironment?e.environment=this.cubeRenderTarget.texture:e.environment=null},tick:function(){if(this.needsEnvironmentUpdate){var e=this.el.object3D,n=this.el.renderer,t=this.el.camera;this.el.object3D.add(this.cubeCamera),this.cubeCamera.position.copy(t.position),this.cubeCamera.update(n,e),this.needsEnvironmentUpdate=!1}},remove:function(){var e=this.data,n=this.el.object3D;if(e.transparent)return void(n.background=null);n.environment===this.cubeRenderTarget.texture&&(n.environment=null),n.background=COMPONENTS[this.name].schema.color.default}});
  1876. },{"../../core/component":131}],101:[function(_dereq_,module,exports){
  1877. var register=_dereq_("../../core/component").registerComponent;module.exports.Component=register("debug",{schema:{default:!0}});
  1878. },{"../../core/component":131}],102:[function(_dereq_,module,exports){
  1879. function createPermissionDialog(e,t,i,o,n){var a,s,l;return a=document.createElement("div"),a.classList.add(DIALOG_BUTTONS_CONTAINER_CLASS),s=document.createElement("button"),s.classList.add(DIALOG_BUTTON_CLASS,DIALOG_DENY_BUTTON_CLASS),s.setAttribute(constants.AFRAME_INJECTED,""),s.innerHTML=e,a.appendChild(s),l=document.createElement("button"),l.classList.add(DIALOG_BUTTON_CLASS,DIALOG_ALLOW_BUTTON_CLASS),l.setAttribute(constants.AFRAME_INJECTED,""),l.innerHTML=t,a.appendChild(l),l.addEventListener("click",function(e){e.stopPropagation(),o()}),s.addEventListener("click",function(e){e.stopPropagation(),n()}),createDialog(i,a)}function createAlertDialog(e,t,i){var o,n;return o=document.createElement("div"),o.classList.add(DIALOG_BUTTONS_CONTAINER_CLASS),n=document.createElement("button"),n.classList.add(DIALOG_BUTTON_CLASS,DIALOG_OK_BUTTON_CLASS),n.setAttribute(constants.AFRAME_INJECTED,""),n.innerHTML=e,o.appendChild(n),n.addEventListener("click",function(e){e.stopPropagation(),i()}),createDialog(t,o)}function createDialog(e,t){var i,o,n,a;return i=document.createElement("div"),i.classList.add(MODAL_CLASS),i.setAttribute(constants.AFRAME_INJECTED,""),o=document.createElement("div"),o.className=DIALOG_CLASS,o.setAttribute(constants.AFRAME_INJECTED,""),i.appendChild(o),n=document.createElement("div"),n.classList.add(DIALOG_TEXT_CONTAINER_CLASS),o.appendChild(n),a=document.createElement("div"),a.classList.add(DIALOG_TEXT_CLASS),a.innerHTML=e,n.appendChild(a),o.appendChild(t),i}var registerComponent=_dereq_("../../core/component").registerComponent,utils=_dereq_("../../utils/"),bind=utils.bind,constants=_dereq_("../../constants/"),MODAL_CLASS="a-modal",DIALOG_CLASS="a-dialog",DIALOG_TEXT_CLASS="a-dialog-text",DIALOG_TEXT_CONTAINER_CLASS="a-dialog-text-container",DIALOG_BUTTONS_CONTAINER_CLASS="a-dialog-buttons-container",DIALOG_BUTTON_CLASS="a-dialog-button",DIALOG_ALLOW_BUTTON_CLASS="a-dialog-allow-button",DIALOG_DENY_BUTTON_CLASS="a-dialog-deny-button",DIALOG_OK_BUTTON_CLASS="a-dialog-ok-button";module.exports.Component=registerComponent("device-orientation-permission-ui",{schema:{enabled:{default:!0},deviceMotionMessage:{default:"This immersive website requires access to your device motion sensors."},mobileDesktopMessage:{default:"Set your browser to request the mobile version of the site and reload the page to enjoy immersive mode."},httpsMessage:{default:"Access this site over HTTPS to enter VR mode and grant access to the device sensors."},denyButtonText:{default:"Deny"},allowButtonText:{default:"Allow"},cancelButtonText:{default:"Cancel"}},init:function(){var e=this;if(this.data.enabled){if("localhost"!==location.hostname&&"127.0.0.1"!==location.hostname&&"http:"===location.protocol&&this.showHTTPAlert(),utils.device.isMobileDeviceRequestingDesktopSite())return void this.showMobileDesktopModeAlert();if("undefined"==typeof DeviceOrientationEvent||!DeviceOrientationEvent.requestPermission)return void(this.permissionGranted=!0);this.onDeviceMotionDialogAllowClicked=bind(this.onDeviceMotionDialogAllowClicked,this),this.onDeviceMotionDialogDenyClicked=bind(this.onDeviceMotionDialogDenyClicked,this),DeviceOrientationEvent.requestPermission().catch(function(){e.devicePermissionDialogEl=createPermissionDialog(e.data.denyButtonText,e.data.allowButtonText,e.data.deviceMotionMessage,e.onDeviceMotionDialogAllowClicked,e.onDeviceMotionDialogDenyClicked),e.el.appendChild(e.devicePermissionDialogEl)}).then(function(){e.el.emit("deviceorientationpermissiongranted"),e.permissionGranted=!0})}},remove:function(){this.devicePermissionDialogEl&&this.el.removeChild(this.devicePermissionDialogEl)},onDeviceMotionDialogDenyClicked:function(){this.remove()},showMobileDesktopModeAlert:function(){var e=this,t=createAlertDialog(e.data.cancelButtonText,e.data.mobileDesktopMessage,function(){e.el.removeChild(t)});this.el.appendChild(t)},showHTTPAlert:function(){var e=this,t=createAlertDialog(e.data.cancelButtonText,e.data.httpsMessage,function(){e.el.removeChild(t)});this.el.appendChild(t)},onDeviceMotionDialogAllowClicked:function(){var e=this;this.el.emit("deviceorientationpermissionrequested"),DeviceOrientationEvent.requestPermission().then(function(t){"granted"===t?(e.el.emit("deviceorientationpermissiongranted"),e.permissionGranted=!0):e.el.emit("deviceorientationpermissionrejected"),e.remove()}).catch(console.error)}});
  1880. },{"../../constants/":123,"../../core/component":131,"../../utils/":205}],103:[function(_dereq_,module,exports){
  1881. var registerComponent=_dereq_("../../core/component").registerComponent;module.exports.Component=registerComponent("embedded",{dependencies:["vr-mode-ui"],schema:{default:!0},update:function(){var e=this.el,r=e.querySelector(".a-enter-vr");!0===this.data?(r&&r.classList.add("embedded"),e.removeFullScreenStyles()):(r&&r.classList.remove("embedded"),e.addFullScreenStyles())}});
  1882. },{"../../core/component":131}],104:[function(_dereq_,module,exports){
  1883. function getFog(e){var o;return o="exponential"===e.type?new THREE.FogExp2(e.color,e.density):new THREE.Fog(e.color,e.near,e.far),o.name=e.type,o}var register=_dereq_("../../core/component").registerComponent,THREE=_dereq_("../../lib/three"),debug=_dereq_("../../utils/debug"),warn=debug("components:fog:warn");module.exports.Component=register("fog",{schema:{color:{type:"color",default:"#000"},density:{default:25e-5},far:{default:1e3,min:0},near:{default:1,min:0},type:{default:"linear",oneOf:["linear","exponential"]}},update:function(){var e=this.data,o=this.el,t=this.el.object3D.fog;return o.isScene?t&&e.type===t.name?void Object.keys(this.schema).forEach(function(o){var n=e[o];"color"===o&&(n=new THREE.Color(n)),t[o]=n}):(o.object3D.fog=getFog(e),void o.systems.material.updateMaterials()):void warn("Fog component can only be applied to <a-scene>")},remove:function(){var e=this.el.object3D.fog;e&&(e.far=0,e.near=.1)}});
  1884. },{"../../core/component":131,"../../lib/three":179,"../../utils/debug":201}],105:[function(_dereq_,module,exports){
  1885. (function (process){
  1886. function getFuzzyPatchVersion(e){var n=e.split(".");return n[2]="x",n.join(".")}var AFRAME_INJECTED=_dereq_("../../constants").AFRAME_INJECTED,pkg=_dereq_("../../../package"),registerComponent=_dereq_("../../core/component").registerComponent,utils=_dereq_("../../utils/"),INSPECTOR_DEV_URL="https://aframe.io/aframe-inspector/dist/aframe-inspector.js",INSPECTOR_RELEASE_URL="https://unpkg.com/aframe-inspector@"+getFuzzyPatchVersion(pkg.version)+"/dist/aframe-inspector.min.js",INSPECTOR_URL="dev"===process.env.INSPECTOR_VERSION?INSPECTOR_DEV_URL:INSPECTOR_RELEASE_URL,LOADING_MESSAGE="Loading Inspector",LOADING_ERROR_MESSAGE="Error loading Inspector";module.exports.Component=registerComponent("inspector",{schema:{url:{default:INSPECTOR_URL}},init:function(){this.firstPlay=!0,this.onKeydown=this.onKeydown.bind(this),this.onMessage=this.onMessage.bind(this),this.initOverlay(),window.addEventListener("keydown",this.onKeydown),window.addEventListener("message",this.onMessage)},play:function(){var e;this.firstPlay&&"false"!==(e=utils.getUrlParameter("inspector"))&&e&&(this.openInspector(),this.firstPlay=!1)},initOverlay:function(){this.loadingMessageEl=document.createElement("div"),this.loadingMessageEl.classList.add("a-inspector-loader"),this.loadingMessageEl.innerHTML=LOADING_MESSAGE+'<span class="dots"><span>.</span><span>.</span><span>.</span></span>'},remove:function(){this.removeEventListeners()},onKeydown:function(e){73===e.keyCode&&(e.ctrlKey&&e.altKey||e.getModifierState("AltGraph"))&&this.openInspector()},showLoader:function(){document.body.appendChild(this.loadingMessageEl)},hideLoader:function(){document.body.removeChild(this.loadingMessageEl)},onMessage:function(e){"INJECT_AFRAME_INSPECTOR"===e.data&&this.openInspector()},openInspector:function(e){var n,t=this;if(AFRAME.INSPECTOR||AFRAME.inspectorInjected)return void AFRAME.INSPECTOR.open(e);this.showLoader(),n=document.createElement("script"),n.src=this.data.url,n.setAttribute("data-name","aframe-inspector"),n.setAttribute(AFRAME_INJECTED,""),n.onload=function(){AFRAME.INSPECTOR.open(e),t.hideLoader(),t.removeEventListeners()},n.onerror=function(){t.loadingMessageEl.innerHTML=LOADING_ERROR_MESSAGE},document.head.appendChild(n),AFRAME.inspectorInjected=!0},removeEventListeners:function(){window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("message",this.onMessage)}});
  1887. }).call(this,_dereq_('_process'))
  1888. },{"../../../package":73,"../../constants":123,"../../core/component":131,"../../utils/":205,"_process":49}],106:[function(_dereq_,module,exports){
  1889. var registerComponent=_dereq_("../../core/component").registerComponent,shouldCaptureKeyEvent=_dereq_("../../utils/").shouldCaptureKeyEvent;module.exports.Component=registerComponent("keyboard-shortcuts",{schema:{enterVR:{default:!0},exitVR:{default:!0}},init:function(){this.onKeyup=this.onKeyup.bind(this)},update:function(e){var t=this.data;this.enterVREnabled=t.enterVR},play:function(){window.addEventListener("keyup",this.onKeyup,!1)},pause:function(){window.removeEventListener("keyup",this.onKeyup)},onKeyup:function(e){var t=this.el;shouldCaptureKeyEvent(e)&&(this.enterVREnabled&&70===e.keyCode&&t.enterVR(),this.enterVREnabled&&27===e.keyCode&&t.exitVR())}});
  1890. },{"../../core/component":131,"../../utils/":205}],107:[function(_dereq_,module,exports){
  1891. var debug=_dereq_("../../utils/debug"),registerComponent=_dereq_("../../core/component").registerComponent,warn=debug("components:pool:warn");module.exports.Component=registerComponent("pool",{schema:{container:{default:""},mixin:{default:""},size:{default:0},dynamic:{default:!1}},multiple:!0,initPool:function(){var t;for(this.availableEls=[],this.usedEls=[],this.data.mixin||warn("No mixin provided for pool component."),this.data.container&&(this.container=document.querySelector(this.data.container),this.container||warn("Container "+this.data.container+" not found.")),this.container=this.container||this.el,t=0;t<this.data.size;++t)this.createEntity()},update:function(t){var i=this.data;t.mixin===i.mixin&&t.size===i.size||this.initPool()},createEntity:function(){var t;t=document.createElement("a-entity"),t.play=this.wrapPlay(t.play),t.setAttribute("mixin",this.data.mixin),t.object3D.visible=!1,t.pause(),this.container.appendChild(t),this.availableEls.push(t)},wrapPlay:function(t){var i=this.usedEls;return function(){-1!==i.indexOf(this)&&t.call(this)}},requestEntity:function(){var t;if(0===this.availableEls.length){if(!1===this.data.dynamic)return void warn("Requested entity from empty pool: "+this.attrName);warn("Requested entity from empty pool. This pool is dynamic and will resize automatically. You might want to increase its initial size: "+this.attrName),this.createEntity()}return t=this.availableEls.shift(),this.usedEls.push(t),t.object3D.visible=!0,t},returnEntity:function(t){var i=this.usedEls.indexOf(t);return-1===i?void warn("The returned entity was not previously pooled from "+this.attrName):(this.usedEls.splice(i,1),this.availableEls.push(t),t.object3D.visible=!1,t.pause(),t)}});
  1892. },{"../../core/component":131,"../../utils/debug":201}],108:[function(_dereq_,module,exports){
  1893. var registerComponent=_dereq_("../../core/component").registerComponent,THREE=_dereq_("../../lib/three"),VERTEX_SHADER=["attribute vec3 position;","attribute vec2 uv;","uniform mat4 projectionMatrix;","uniform mat4 modelViewMatrix;","varying vec2 vUv;","void main() {"," vUv = vec2( 1.- uv.x, uv.y );"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),FRAGMENT_SHADER=["precision mediump float;","uniform samplerCube map;","varying vec2 vUv;","#define M_PI 3.141592653589793238462643383279","void main() {"," vec2 uv = vUv;"," float longitude = uv.x * 2. * M_PI - M_PI + M_PI / 2.;"," float latitude = uv.y * M_PI;"," vec3 dir = vec3("," - sin( longitude ) * sin( latitude ),"," cos( latitude ),"," - cos( longitude ) * sin( latitude )"," );"," normalize( dir );"," gl_FragColor = vec4( textureCube( map, dir ).rgb, 1.0 );","}"].join("\n");module.exports.Component=registerComponent("screenshot",{schema:{width:{default:4096},height:{default:2048},camera:{type:"selector"}},init:function(){function e(){var e=t.renderer.getContext();e&&(a.cubeMapSize=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),a.material=new THREE.RawShaderMaterial({uniforms:{map:{type:"t",value:null}},vertexShader:VERTEX_SHADER,fragmentShader:FRAGMENT_SHADER,side:THREE.DoubleSide}),a.quad=new THREE.Mesh(new THREE.PlaneBufferGeometry(1,1),a.material),a.quad.visible=!1,a.camera=new THREE.OrthographicCamera(-.5,.5,.5,-.5,-1e4,1e4),a.canvas=document.createElement("canvas"),a.ctx=a.canvas.getContext("2d"),t.object3D.add(a.quad),a.onKeyDown=a.onKeyDown.bind(a))}var t=this.el,a=this;t.renderer?e():t.addEventListener("render-target-loaded",e)},getRenderTarget:function(e,t){return new THREE.WebGLRenderTarget(e,t,{encoding:THREE.sRGBEncoding,minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,wrapS:THREE.ClampToEdgeWrapping,wrapT:THREE.ClampToEdgeWrapping,format:THREE.RGBAFormat,type:THREE.UnsignedByteType})},resize:function(e,t){this.quad.scale.set(e,t,1),this.camera.left=-1*e/2,this.camera.right=e/2,this.camera.top=t/2,this.camera.bottom=-1*t/2,this.camera.updateProjectionMatrix(),this.canvas.width=e,this.canvas.height=t},play:function(){window.addEventListener("keydown",this.onKeyDown)},onKeyDown:function(e){var t=83===e.keyCode&&e.ctrlKey&&e.altKey;if(this.data&&t){var a=e.shiftKey?"equirectangular":"perspective";this.capture(a)}},setCapture:function(e){var t,a,r,i,n=this.el;return"perspective"===e?(this.quad.visible=!1,a=this.data.camera&&this.data.camera.components.camera.camera||n.camera,t={width:this.data.width,height:this.data.height}):(a=this.camera,i=new THREE.WebGLCubeRenderTarget(Math.min(this.cubeMapSize,2048),{format:THREE.RGBFormat,generateMipmaps:!0,minFilter:THREE.LinearMipmapLinearFilter,encoding:THREE.sRGBEncoding}),r=new THREE.CubeCamera(n.camera.near,n.camera.far,i),n.camera.getWorldPosition(r.position),n.camera.getWorldQuaternion(r.quaternion),r.update(n.renderer,n.object3D),this.quad.material.uniforms.map.value=r.renderTarget.texture,t={width:this.data.width,height:this.data.height},this.quad.visible=!0),{camera:a,size:t,projection:e}},capture:function(e){var t,a=this.el.renderer.xr.enabled,r=this.el.renderer;r.xr.enabled=!1,t=this.setCapture(e),this.renderCapture(t.camera,t.size,t.projection),this.saveCapture(),r.xr.enabled=a},getCanvas:function(e){var t=this.el.renderer.xr.enabled,a=this.el.renderer,r=this.setCapture(e);return a.xr.enabled=!1,this.renderCapture(r.camera,r.size,r.projection),a.xr.enabled=t,this.canvas},renderCapture:function(e,t,a){var r,i,n,o=this.el.renderer.autoClear,d=this.el,s=d.renderer;i=this.getRenderTarget(t.width,t.height),n=new Uint8Array(4*t.width*t.height),this.resize(t.width,t.height),s.autoClear=!0,s.clear(),s.setRenderTarget(i),s.render(d.object3D,e),s.autoClear=o,s.readRenderTargetPixels(i,0,0,t.width,t.height,n),s.setRenderTarget(null),"perspective"===a&&(n=this.flipPixelsVertically(n,t.width,t.height)),r=new ImageData(new Uint8ClampedArray(n),t.width,t.height),this.quad.visible=!1,this.ctx.putImageData(r,0,0)},flipPixelsVertically:function(e,t,a){for(var r=e.slice(0),i=0;i<t;++i)for(var n=0;n<a;++n)r[4*i+n*t*4]=e[4*i+(a-n)*t*4],r[4*i+1+n*t*4]=e[4*i+1+(a-n)*t*4],r[4*i+2+n*t*4]=e[4*i+2+(a-n)*t*4],r[4*i+3+n*t*4]=e[4*i+3+(a-n)*t*4];return r},saveCapture:function(){this.canvas.toBlob(function(e){var t="screenshot-"+document.title.toLowerCase()+"-"+Date.now()+".png",a=document.createElement("a"),r=URL.createObjectURL(e);a.href=r,a.setAttribute("download",t),a.innerHTML="downloading...",a.style.display="none",document.body.appendChild(a),setTimeout(function(){a.click(),document.body.removeChild(a)},1)},"image/png")}});
  1894. },{"../../core/component":131,"../../lib/three":179}],109:[function(_dereq_,module,exports){
  1895. function createStats(t){var e=new ThreeStats(t.renderer),s=new AFrameStats(t),i=t.isMobile?[]:[e,s];return new RStats({css:[],values:{fps:{caption:"fps",below:30}},groups:[{caption:"Framerate",values:["fps","raf"]}],plugins:i})}var registerComponent=_dereq_("../../core/component").registerComponent,RStats=_dereq_("../../../vendor/rStats"),utils=_dereq_("../../utils");_dereq_("../../../vendor/rStats.extras"),_dereq_("../../lib/rStatsAframe");var AFrameStats=window.aframeStats,bind=utils.bind,HIDDEN_CLASS="a-hidden",ThreeStats=window.threeStats;module.exports.Component=registerComponent("stats",{schema:{default:!0},init:function(){var t=this.el;"false"!==utils.getUrlParameter("stats")&&(this.stats=createStats(t),this.statsEl=document.querySelector(".rs-base"),this.hideBound=bind(this.hide,this),this.showBound=bind(this.show,this),t.addEventListener("enter-vr",this.hideBound),t.addEventListener("exit-vr",this.showBound))},update:function(){if(this.stats)return this.data?this.show():this.hide()},remove:function(){this.el.removeEventListener("enter-vr",this.hideBound),this.el.removeEventListener("exit-vr",this.showBound),this.statsEl&&this.statsEl.parentNode.removeChild(this.statsEl)},tick:function(){var t=this.stats;t&&(t("rAF").tick(),t("FPS").frame(),t().update())},hide:function(){this.statsEl.classList.add(HIDDEN_CLASS)},show:function(){this.statsEl.classList.remove(HIDDEN_CLASS)}});
  1896. },{"../../../vendor/rStats":217,"../../../vendor/rStats.extras":216,"../../core/component":131,"../../lib/rStatsAframe":178,"../../utils":205}],110:[function(_dereq_,module,exports){
  1897. function createEnterVRButton(t){var e,n;return n=document.createElement("div"),n.classList.add(ENTER_VR_CLASS),n.setAttribute(constants.AFRAME_INJECTED,""),e=document.createElement("button"),e.className=ENTER_VR_BTN_CLASS,e.setAttribute("title","Enter VR mode with a headset or fullscreen mode on a desktop. Visit https://webvr.rocks or https://webvr.info for more information."),e.setAttribute(constants.AFRAME_INJECTED,""),utils.device.isMobile()&&applyStickyHoverFix(e),n.appendChild(e),e.addEventListener("click",function(e){t(),e.stopPropagation()}),n}function createEnterARButton(t){var e,n;return n=document.createElement("div"),n.classList.add(ENTER_AR_CLASS),n.setAttribute(constants.AFRAME_INJECTED,""),e=document.createElement("button"),e.className=ENTER_AR_BTN_CLASS,e.setAttribute("title","Enter AR mode with a headset or handheld device. Visit https://webvr.rocks or https://webvr.info for more information."),e.setAttribute(constants.AFRAME_INJECTED,""),utils.device.isMobile()&&applyStickyHoverFix(e),n.appendChild(e),e.addEventListener("click",function(e){t(),e.stopPropagation()}),n}function createOrientationModal(t){var e=document.createElement("div");e.className=ORIENTATION_MODAL_CLASS,e.classList.add(HIDDEN_CLASS),e.setAttribute(constants.AFRAME_INJECTED,"");var n=document.createElement("button");return n.setAttribute(constants.AFRAME_INJECTED,""),n.innerHTML="Exit VR",n.addEventListener("click",t),e.appendChild(n),e}function applyStickyHoverFix(t){t.addEventListener("touchstart",function(){t.classList.remove("resethover")}),t.addEventListener("touchend",function(){t.classList.add("resethover")})}var registerComponent=_dereq_("../../core/component").registerComponent,constants=_dereq_("../../constants/"),utils=_dereq_("../../utils/"),bind=utils.bind,ENTER_VR_CLASS="a-enter-vr",ENTER_AR_CLASS="a-enter-ar",ENTER_VR_BTN_CLASS="a-enter-vr-button",ENTER_AR_BTN_CLASS="a-enter-ar-button",HIDDEN_CLASS="a-hidden",ORIENTATION_MODAL_CLASS="a-orientation-modal";module.exports.Component=registerComponent("vr-mode-ui",{dependencies:["canvas"],schema:{enabled:{default:!0},enterVRButton:{default:""},enterARButton:{default:""}},init:function(){var t=this,e=this.el;"false"!==utils.getUrlParameter("ui")&&(this.insideLoader=!1,this.enterVREl=null,this.enterAREl=null,this.orientationModalEl=null,this.bindMethods(),e.addEventListener("enter-vr",this.updateEnterInterfaces),e.addEventListener("exit-vr",this.updateEnterInterfaces),e.addEventListener("update-vr-devices",this.updateEnterInterfaces),window.addEventListener("message",function(e){"loaderReady"===e.data.type&&(t.insideLoader=!0,t.remove())}),window.addEventListener("orientationchange",this.toggleOrientationModalIfNeeded))},bindMethods:function(){this.onEnterVRButtonClick=bind(this.onEnterVRButtonClick,this),this.onEnterARButtonClick=bind(this.onEnterARButtonClick,this),this.onModalClick=bind(this.onModalClick,this),this.toggleOrientationModalIfNeeded=bind(this.toggleOrientationModalIfNeeded,this),this.updateEnterInterfaces=bind(this.updateEnterInterfaces,this)},onModalClick:function(){this.el.exitVR()},onEnterVRButtonClick:function(){this.el.enterVR()},onEnterARButtonClick:function(){this.el.enterAR()},update:function(){var t=this.data,e=this.el;if(!t.enabled||this.insideLoader||"false"===utils.getUrlParameter("ui"))return this.remove();this.enterVREl||this.enterAREl||this.orientationModalEl||(t.enterVRButton?(this.enterVREl=document.querySelector(t.enterVRButton),this.enterVREl.addEventListener("click",this.onEnterVRButtonClick)):(this.enterVREl=createEnterVRButton(this.onEnterVRButtonClick),e.appendChild(this.enterVREl)),t.enterARButton?(this.enterAREl=document.querySelector(t.enterARButton),this.enterAREl.addEventListener("click",this.onEnterARButtonClick)):(this.enterAREl=createEnterARButton(this.onEnterARButtonClick),e.appendChild(this.enterAREl)),this.orientationModalEl=createOrientationModal(this.onModalClick),e.appendChild(this.orientationModalEl),this.updateEnterInterfaces())},remove:function(){[this.enterVREl,this.enterAREl,this.orientationModalEl].forEach(function(t){t&&t.parentNode&&t.parentNode.removeChild(t)}),this.enterVREl=void 0,this.enterAREl=void 0,this.orientationModalEl=void 0},updateEnterInterfaces:function(){this.toggleEnterVRButtonIfNeeded(),this.toggleEnterARButtonIfNeeded(),this.toggleOrientationModalIfNeeded()},toggleEnterVRButtonIfNeeded:function(){var t=this.el;this.enterVREl&&(t.is("vr-mode")?this.enterVREl.classList.add(HIDDEN_CLASS):this.enterVREl.classList.remove(HIDDEN_CLASS))},toggleEnterARButtonIfNeeded:function(){var t=this.el;this.enterAREl&&(t.is("vr-mode")||!utils.device.checkARSupport()?this.enterAREl.classList.add(HIDDEN_CLASS):this.enterAREl.classList.remove(HIDDEN_CLASS))},toggleOrientationModalIfNeeded:function(){var t=this.el,e=this.orientationModalEl;e&&t.isMobile&&(!utils.device.isLandscape()&&t.is("vr-mode")?e.classList.remove(HIDDEN_CLASS):e.classList.add(HIDDEN_CLASS))}});
  1898. },{"../../constants/":123,"../../core/component":131,"../../utils/":205}],111:[function(_dereq_,module,exports){
  1899. var component=_dereq_("../core/component"),THREE=_dereq_("../lib/three"),bind=_dereq_("../utils/bind"),registerComponent=component.registerComponent;module.exports.Component=registerComponent("shadow",{schema:{cast:{default:!0},receive:{default:!0}},init:function(){this.onMeshChanged=bind(this.update,this),this.el.addEventListener("object3dset",this.onMeshChanged),this.system.setShadowMapEnabled(!0)},update:function(){var e=this.data;this.updateDescendants(e.cast,e.receive)},remove:function(){this.el.removeEventListener("object3dset",this.onMeshChanged),this.updateDescendants(!1,!1)},updateDescendants:function(e,t){var n=this.el.sceneEl;this.el.object3D.traverse(function(s){if(s instanceof THREE.Mesh&&(s.castShadow=e,s.receiveShadow=t,n.hasLoaded&&s.material))for(var a=Array.isArray(s.material)?s.material:[s.material],i=0;i<a.length;i++)a[i].needsUpdate=!0})}});
  1900. },{"../core/component":131,"../lib/three":179,"../utils/bind":199}],112:[function(_dereq_,module,exports){
  1901. var registerComponent=_dereq_("../core/component").registerComponent,debug=_dereq_("../utils/debug"),THREE=_dereq_("../lib/three"),warn=debug("components:sound:warn");module.exports.Component=registerComponent("sound",{schema:{autoplay:{default:!1},distanceModel:{default:"inverse",oneOf:["linear","inverse","exponential"]},loop:{default:!1},maxDistance:{default:1e4},on:{default:""},poolSize:{default:1},positional:{default:!0},refDistance:{default:1},rolloffFactor:{default:1},src:{type:"audio"},volume:{default:1}},multiple:!0,init:function(){var e=this;this.listener=null,this.audioLoader=new THREE.AudioLoader,this.pool=new THREE.Group,this.loaded=!1,this.mustPlay=!1,this.playSoundBound=function(){e.playSound()}},update:function(e){var t,o,i=this.data,n=i.src!==e.src;if(n){if(!i.src)return;this.setupSound()}for(t=0;t<this.pool.children.length;t++)o=this.pool.children[t],i.positional&&(o.setDistanceModel(i.distanceModel),o.setMaxDistance(i.maxDistance),o.setRefDistance(i.refDistance),o.setRolloffFactor(i.rolloffFactor)),o.setLoop(i.loop),o.setVolume(i.volume),o.isPaused=!1;if(i.on!==e.on&&this.updateEventListener(e.on),n){var s=this;this.loaded=!1,this.audioLoader.load(i.src,function(e){for(t=0;t<s.pool.children.length;t++)o=s.pool.children[t],o.setBuffer(e);s.loaded=!0,THREE.Cache.remove(i.src),(s.data.autoplay||s.mustPlay)&&s.playSound(),s.el.emit("sound-loaded",s.evtDetail,!1)})}},pause:function(){this.stopSound(),this.removeEventListener()},play:function(){this.data.autoplay&&this.playSound(),this.updateEventListener()},remove:function(){var e,t;this.removeEventListener(),this.el.getObject3D(this.attrName)&&this.el.removeObject3D(this.attrName);try{for(e=0;e<this.pool.children.length;e++)t=this.pool.children[e],t.disconnect()}catch(e){warn("Audio source not properly disconnected")}},updateEventListener:function(e){var t=this.el;e&&t.removeEventListener(e,this.playSoundBound),t.addEventListener(this.data.on,this.playSoundBound)},removeEventListener:function(){this.el.removeEventListener(this.data.on,this.playSoundBound)},setupSound:function(){var e,t,o=this.el,i=o.sceneEl,n=this;this.pool.children.length>0&&(this.stopSound(),o.removeObject3D("sound"));var s=this.listener=i.audioListener||new THREE.AudioListener;for(i.audioListener=s,i.camera&&i.camera.add(s),i.addEventListener("camera-set-active",function(e){e.detail.cameraEl.getObject3D("camera").add(s)}),this.pool=new THREE.Group,e=0;e<this.data.poolSize;e++)t=this.data.positional?new THREE.PositionalAudio(s):new THREE.Audio(s),this.pool.add(t);for(o.setObject3D(this.attrName,this.pool),e=0;e<this.pool.children.length;e++)t=this.pool.children[e],t.onEnded=function(){this.isPlaying=!1,n.el.emit("sound-ended",n.evtDetail,!1)}},pauseSound:function(){var e,t;for(this.isPlaying=!1,e=0;e<this.pool.children.length;e++)t=this.pool.children[e],t.source&&t.source.buffer&&t.isPlaying&&!t.isPaused&&(t.isPaused=!0,t.pause())},playSound:function(e){var t,o,i;if(!this.loaded)return warn("Sound not loaded yet. It will be played once it finished loading"),void(this.mustPlay=!0);for(t=!1,this.isPlaying=!0,o=0;o<this.pool.children.length;o++)i=this.pool.children[o],i.isPlaying||!i.buffer||t||(e&&e(i),i.play(),i.isPaused=!1,t=!0);if(!t)return void warn("All the sounds are playing. If you need to play more sounds simultaneously consider increasing the size of pool with the `poolSize` attribute.",this.el);this.mustPlay=!1},stopSound:function(){var e,t;for(this.isPlaying=!1,e=0;e<this.pool.children.length;e++){if(t=this.pool.children[e],!t.source||!t.source.buffer)return;t.stop()}}});
  1902. },{"../core/component":131,"../lib/three":179,"../utils/debug":201}],113:[function(_dereq_,module,exports){
  1903. function parseSide(t){switch(t){case"back":return THREE.FrontSide;case"double":return THREE.DoubleSide;default:return THREE.BackSide}}function loadFont(t,e){return new Promise(function(r,n){loadBMFont(t,function(o,i){if(o)return error("Error loading font",t),void n(o);t.indexOf("/Roboto-msdf.json")>=0&&(e=30),e&&i.chars.map(function(t){t.yoffset+=e}),r(i)})})}function loadTexture(t){return new Promise(function(e,r){(new THREE.ImageLoader).load(t,function(t){e(t)},void 0,function(){error("Error loading font image",t),r(null)})})}function createShader(t,e,r){var n,o;return o=new shaders[e].Shader,o.el=t,o.init(r),o.update(r),n=o.material,n.transparent=r.transparent,{material:n,shader:o}}function computeWidth(t,e,r){return t||(.5+e)*r}function computeFontWidthFactor(t){var e=0,r=0,n=0;return t.chars.map(function(t){e+=t.xadvance,t.id>=48&&t.id<=57&&(n++,r+=t.xadvance)}),n?r/n:e/t.chars.length}function PromiseCache(){var t=this.cache={};this.get=function(e,r){return e in t?t[e]:(t[e]=r(),t[e])}}var createTextGeometry=_dereq_("three-bmfont-text"),loadBMFont=_dereq_("load-bmfont"),registerComponent=_dereq_("../core/component").registerComponent,coreShader=_dereq_("../core/shader"),THREE=_dereq_("../lib/three"),utils=_dereq_("../utils/"),error=utils.debug("components:text:error"),shaders=coreShader.shaders,warn=utils.debug("components:text:warn"),DEFAULT_WIDTH=1,MAX_ANISOTROPY=16,FONT_BASE_URL="https://cdn.aframe.io/fonts/",FONTS={aileronsemibold:FONT_BASE_URL+"Aileron-Semibold.fnt",dejavu:FONT_BASE_URL+"DejaVu-sdf.fnt",exo2bold:FONT_BASE_URL+"Exo2Bold.fnt",exo2semibold:FONT_BASE_URL+"Exo2SemiBold.fnt",kelsonsans:FONT_BASE_URL+"KelsonSans.fnt",monoid:FONT_BASE_URL+"Monoid.fnt",mozillavr:FONT_BASE_URL+"mozillavr.fnt",roboto:FONT_BASE_URL+"Roboto-msdf.json",sourcecodepro:FONT_BASE_URL+"SourceCodePro.fnt"},MSDF_FONTS=["roboto"],DEFAULT_FONT="roboto";module.exports.FONTS=FONTS;var cache=new PromiseCache,fontWidthFactors={},textures={},protocolRe=/^\w+:/;module.exports.Component=registerComponent("text",{multiple:!0,schema:{align:{type:"string",default:"left",oneOf:["left","right","center"]},alphaTest:{default:.5},anchor:{default:"center",oneOf:["left","right","center","align"]},baseline:{default:"center",oneOf:["top","center","bottom"]},color:{type:"color",default:"#FFF"},font:{type:"string",default:DEFAULT_FONT},fontImage:{type:"string"},height:{type:"number"},letterSpacing:{type:"number",default:0},lineHeight:{type:"number"},negate:{type:"boolean",default:!0},opacity:{type:"number",default:1},shader:{default:"sdf",oneOf:shaders},side:{default:"front",oneOf:["front","back","double"]},tabSize:{default:4},transparent:{default:!0},value:{type:"string"},whiteSpace:{default:"normal",oneOf:["normal","pre","nowrap"]},width:{type:"number"},wrapCount:{type:"number",default:40},wrapPixels:{type:"number"},xOffset:{type:"number",default:0},yOffset:{type:"number",default:0},zOffset:{type:"number",default:.001}},init:function(){this.shaderData={},this.geometry=createTextGeometry(),this.createOrUpdateMaterial()},update:function(t){var e=this.data,r=this.currentFont;if(textures[e.font]?this.texture=textures[e.font]:(this.texture=textures[e.font]=new THREE.Texture,this.texture.anisotropy=MAX_ANISOTROPY),this.createOrUpdateMaterial(),t.font!==e.font)return void this.updateFont();r&&(this.updateGeometry(this.geometry,r),this.updateLayout())},remove:function(){this.geometry.dispose(),this.geometry=null,this.el.removeObject3D(this.attrName),this.material.dispose(),this.material=null,this.texture.dispose(),this.texture=null,this.shaderObject&&delete this.shaderObject},createOrUpdateMaterial:function(){var t,e,r,n=this.data,o=this.material,i=this.shaderData;if(r=n.shader,-1!==MSDF_FONTS.indexOf(n.font)||n.font.indexOf("-msdf.")>=0?r="msdf":n.font in FONTS&&-1===MSDF_FONTS.indexOf(n.font)&&(r="sdf"),t=(this.shaderObject&&this.shaderObject.name)!==r,i.alphaTest=n.alphaTest,i.color=n.color,i.map=this.texture,i.opacity=n.opacity,i.side=parseSide(n.side),i.transparent=n.transparent,i.negate=n.negate,!t)return this.shaderObject.update(i),o.transparent=i.transparent,void(o.side=i.side);e=createShader(this.el,r,i),this.material=e.material,this.shaderObject=e.shader,this.material.side=i.side,this.mesh&&(this.mesh.material=this.material)},updateFont:function(){var t,e=this.data,r=this.el,n=this.geometry,o=this;e.font||warn("No font specified. Using the default font."),this.mesh&&(this.mesh.visible=!1),t=this.lookupFont(e.font||DEFAULT_FONT)||e.font,cache.get(t,function(){return loadFont(t,e.yOffset)}).then(function(i){var a;if(1!==i.pages.length)throw new Error("Currently only single-page bitmap fonts are supported.");fontWidthFactors[t]||(i.widthFactor=fontWidthFactors[i]=computeFontWidthFactor(i)),o.currentFont=i,a=o.getFontImageSrc(),cache.get(a,function(){return loadTexture(a)}).then(function(t){var a=o.texture;a.image=t,a.needsUpdate=!0,textures[e.font]=a,o.texture=a,o.initMesh(),o.currentFont=i,o.updateGeometry(n,i),o.updateLayout(),o.mesh.visible=!0,r.emit("textfontset",{font:e.font,fontObj:i})}).catch(function(t){error(t.message),error(t.stack)})}).catch(function(t){error(t.message),error(t.stack)})},initMesh:function(){this.mesh||(this.mesh=new THREE.Mesh(this.geometry,this.material),this.el.setObject3D(this.attrName,this.mesh))},getFontImageSrc:function(){if(this.data.fontImage)return this.data.fontImage;var t=this.lookupFont(this.data.font||DEFAULT_FONT)||this.data.font,e=this.currentFont.pages[0];return e.match(protocolRe)&&0!==e.indexOf("http")?t.replace(/(\.fnt)|(\.json)/,".png"):THREE.LoaderUtils.extractUrlBase(t)+e},updateLayout:function(){var t,e,r,n,o,i,a,s,h,u,d=this.el,f=this.data,l=this.geometry,c=this.mesh;if(c&&l.layout){if(r=d.getAttribute("geometry"),s=f.width||r&&r.width||DEFAULT_WIDTH,i=computeWidth(f.wrapPixels,f.wrapCount,this.currentFont.widthFactor),a=s/i,o=l.layout,n=a*(o.height+o.descender),r&&"plane"===r.primitive&&(r.width||d.setAttribute("geometry","width",s),r.height||d.setAttribute("geometry","height",n)),"left"===(t="align"===f.anchor?f.align:f.anchor))h=0;else if("right"===t)h=-1*o.width;else{if("center"!==t)throw new TypeError("Invalid text.anchor property value",t);h=-1*o.width/2}if("bottom"===(e=f.baseline))u=0;else if("top"===e)u=-1*o.height+o.ascender;else{if("center"!==e)throw new TypeError("Invalid text.baseline property value",e);u=-1*o.height/2}c.position.x=h*a+f.xOffset,c.position.y=u*a,c.position.z=f.zOffset,c.scale.set(a,-1*a,a)}},lookupFont:function(t){return FONTS[t]},updateGeometry:function(){var t={},e={},r=/\\n/g,n=/\\t/g;return function(o,i){var a=this.data;e.font=i,e.lineHeight=a.lineHeight&&isFinite(a.lineHeight)?a.lineHeight:i.common.lineHeight,e.text=a.value.toString().replace(r,"\n").replace(n,"\t"),e.width=computeWidth(a.wrapPixels,a.wrapCount,i.widthFactor),o.update(utils.extend(t,a,e))}}()});
  1904. },{"../core/component":131,"../core/shader":141,"../lib/three":179,"../utils/":205,"load-bmfont":37,"three-bmfont-text":63}],114:[function(_dereq_,module,exports){
  1905. var registerComponent=_dereq_("../core/component").registerComponent,controllerUtils=_dereq_("../utils/tracked-controls"),DEFAULT_CAMERA_HEIGHT=_dereq_("../constants").DEFAULT_CAMERA_HEIGHT,THREE=_dereq_("../lib/three"),DEFAULT_HANDEDNESS=_dereq_("../constants").DEFAULT_HANDEDNESS,EYES_TO_ELBOW={x:.175,y:-.3,z:-.03},FOREARM={x:0,y:0,z:-.175},EMPTY_DAYDREAM_TOUCHES={touches:[]},EVENTS={AXISMOVE:"axismove",BUTTONCHANGED:"buttonchanged",BUTTONDOWN:"buttondown",BUTTONUP:"buttonup",TOUCHSTART:"touchstart",TOUCHEND:"touchend"};module.exports.Component=registerComponent("tracked-controls-webvr",{schema:{autoHide:{default:!0},controller:{default:0},id:{type:"string",default:""},hand:{type:"string",default:""},idPrefix:{type:"string",default:""},orientationOffset:{type:"vec3"},armModel:{default:!1},headElement:{type:"selector"}},init:function(){this.axis=this.el.components["tracked-controls"].axis=[0,0,0],this.buttonStates=this.el.components["tracked-controls"].buttonStates={},this.changedAxes=[],this.targetControllerNumber=this.data.controller,this.axisMoveEventDetail={axis:this.axis,changed:this.changedAxes},this.deltaControllerPosition=new THREE.Vector3,this.controllerQuaternion=new THREE.Quaternion,this.controllerEuler=new THREE.Euler,this.updateGamepad(),this.buttonEventDetails={}},tick:function(t,e){var i=this.el.getObject3D("mesh");i&&i.update&&i.update(e/1e3),this.updateGamepad(),this.updatePose(),this.updateButtons()},defaultUserHeight:function(){return DEFAULT_CAMERA_HEIGHT},getHeadElement:function(){return this.data.headElement||this.el.sceneEl.camera.el},updateGamepad:function(){var t=this.data,e=controllerUtils.findMatchingControllerWebVR(this.system.controllers,t.id,t.idPrefix,t.hand,t.controller);this.controller=e,this.el.components["tracked-controls"].controller=e,this.data.autoHide&&(this.el.object3D.visible=!!this.controller)},applyArmModel:function(t){var e,i,o,n,s,a=this.controller,r=this.controllerEuler,l=this.controllerQuaternion,h=this.deltaControllerPosition;i=this.getHeadElement(),o=i.object3D,s=this.defaultUserHeight(),n=a.pose,e=(a?a.hand:void 0)||DEFAULT_HANDEDNESS,t.copy(o.position),h.set(EYES_TO_ELBOW.x*("left"===e?-1:"right"===e?1:0),EYES_TO_ELBOW.y,EYES_TO_ELBOW.z),h.multiplyScalar(s),h.applyAxisAngle(o.up,o.rotation.y),t.add(h),h.set(FOREARM.x,FOREARM.y,FOREARM.z),h.multiplyScalar(s),n.orientation?l.fromArray(n.orientation):l.copy(o.quaternion),r.setFromQuaternion(l),r.set(r.x,r.y,0),h.applyEuler(r),t.add(h)},updatePose:function(){var t,e,i=this.controller,o=this.data,n=this.el.object3D,s=this.system.vrDisplay;i&&(t=i.pose,t.position?n.position.fromArray(t.position):o.armModel&&this.applyArmModel(n.position),t.orientation&&n.quaternion.fromArray(t.orientation),s&&t.position&&(e=this.el.sceneEl.renderer.xr.getStandingMatrix(),n.matrix.compose(n.position,n.quaternion,n.scale),n.matrix.multiplyMatrices(e,n.matrix),n.matrix.decompose(n.position,n.quaternion,n.scale)),n.rotateX(this.data.orientationOffset.x*THREE.Math.DEG2RAD),n.rotateY(this.data.orientationOffset.y*THREE.Math.DEG2RAD),n.rotateZ(this.data.orientationOffset.z*THREE.Math.DEG2RAD))},updateButtons:function(){var t,e,i=this.controller;if(i){for(e=0;e<i.buttons.length;++e)this.buttonStates[e]||(this.buttonStates[e]={pressed:!1,touched:!1,value:0}),this.buttonEventDetails[e]||(this.buttonEventDetails[e]={id:e,state:this.buttonStates[e]}),t=i.buttons[e],this.handleButton(e,t);this.handleAxes()}},handleButton:function(t,e){return!!(this.handlePress(t,e)|this.handleTouch(t,e)|this.handleValue(t,e))&&(this.el.emit(EVENTS.BUTTONCHANGED,this.buttonEventDetails[t],!1),!0)},handleAxes:function(){var t,e=!1,i=this.controller.axes,o=this.axis,n=this.changedAxes;for(this.changedAxes.splice(0,this.changedAxes.length),t=0;t<i.length;++t)n.push(o[t]!==i[t]),n[t]&&(e=!0);if(!e)return!1;for(this.axis.splice(0,this.axis.length),t=0;t<i.length;t++)this.axis.push(i[t]);return this.el.emit(EVENTS.AXISMOVE,this.axisMoveEventDetail,!1),!0},handlePress:function(t,e){var i,o=this.buttonStates[t];return e.pressed!==o.pressed&&(i=e.pressed?EVENTS.BUTTONDOWN:EVENTS.BUTTONUP,this.el.emit(i,this.buttonEventDetails[t],!1),o.pressed=e.pressed,!0)},handleTouch:function(t,e){var i,o=this.buttonStates[t];return e.touched!==o.touched&&(i=e.touched?EVENTS.TOUCHSTART:EVENTS.TOUCHEND,this.el.emit(i,this.buttonEventDetails[t],!1,EMPTY_DAYDREAM_TOUCHES),o.touched=e.touched,!0)},handleValue:function(t,e){var i=this.buttonStates[t];return e.value!==i.value&&(i.value=e.value,!0)}});
  1906. },{"../constants":123,"../core/component":131,"../lib/three":179,"../utils/tracked-controls":214}],115:[function(_dereq_,module,exports){
  1907. var controllerUtils=_dereq_("../utils/tracked-controls"),registerComponent=_dereq_("../core/component").registerComponent,EVENTS={AXISMOVE:"axismove",BUTTONCHANGED:"buttonchanged",BUTTONDOWN:"buttondown",BUTTONUP:"buttonup",TOUCHSTART:"touchstart",TOUCHEND:"touchend"};module.exports.Component=registerComponent("tracked-controls-webxr",{schema:{id:{type:"string",default:""},hand:{type:"string",default:""},handTrackingEnabled:{default:!1},index:{type:"int",default:-1},iterateControllerProfiles:{default:!1}},init:function(){this.updateController=this.updateController.bind(this),this.buttonEventDetails={},this.buttonStates=this.el.components["tracked-controls"].buttonStates={},this.axis=this.el.components["tracked-controls"].axis=[0,0,0],this.changedAxes=[],this.axisMoveEventDetail={axis:this.axis,changed:this.changedAxes}},update:function(){this.updateController()},play:function(){var t=this.el.sceneEl;this.updateController(),t.addEventListener("controllersupdated",this.updateController)},pause:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.updateController)},isControllerPresent:function(t){return!(!this.controller||this.controller.gamepad)&&("none"===t.inputSource.handedness||t.inputSource.handedness===this.data.hand)},updateController:function(){this.controller=controllerUtils.findMatchingControllerWebXR(this.system.controllers,this.data.id,this.data.hand,this.data.index,this.data.iterateControllerProfiles,this.data.handTrackingEnabled),this.el.components["tracked-controls"].controller=this.controller,this.data.autoHide&&(this.el.object3D.visible=!!this.controller)},tick:function(){var t=this.el.sceneEl,e=this.controller,s=t.frame;e&&t.frame&&this.system.referenceSpace&&(e.hand||(this.pose=s.getPose(e.targetRaySpace,this.system.referenceSpace),this.updatePose(),this.updateButtons()))},updatePose:function(){var t=this.el.object3D,e=this.pose;e&&(t.matrix.elements=e.transform.matrix,t.matrix.decompose(t.position,t.rotation,t.scale))},updateButtons:function(){var t,e,s,n=this.controller;if(n&&n.gamepad){for(s=n.gamepad,e=0;e<s.buttons.length;++e)this.buttonStates[e]||(this.buttonStates[e]={pressed:!1,touched:!1,value:0}),this.buttonEventDetails[e]||(this.buttonEventDetails[e]={id:e,state:this.buttonStates[e]}),t=s.buttons[e],this.handleButton(e,t);this.handleAxes()}},handleButton:function(t,e){return!!(this.handlePress(t,e)|this.handleTouch(t,e)|this.handleValue(t,e))&&(this.el.emit(EVENTS.BUTTONCHANGED,this.buttonEventDetails[t],!1),!0)},handleAxes:function(){var t,e=!1,s=this.controller.gamepad.axes,n=this.axis,i=this.changedAxes;for(this.changedAxes.splice(0,this.changedAxes.length),t=0;t<s.length;++t)i.push(n[t]!==s[t]),i[t]&&(e=!0);if(!e)return!1;for(this.axis.splice(0,this.axis.length),t=0;t<s.length;t++)this.axis.push(s[t]);return this.el.emit(EVENTS.AXISMOVE,this.axisMoveEventDetail,!1),!0},handlePress:function(t,e){var s,n=this.buttonStates[t];return e.pressed!==n.pressed&&(s=e.pressed?EVENTS.BUTTONDOWN:EVENTS.BUTTONUP,this.el.emit(s,this.buttonEventDetails[t],!1),n.pressed=e.pressed,!0)},handleTouch:function(t,e){var s,n=this.buttonStates[t];return e.touched!==n.touched&&(s=e.touched?EVENTS.TOUCHSTART:EVENTS.TOUCHEND,this.el.emit(s,this.buttonEventDetails[t],!1),n.touched=e.touched,!0)},handleValue:function(t,e){var s=this.buttonStates[t];return e.value!==s.value&&(s.value=e.value,!0)}});
  1908. },{"../core/component":131,"../utils/tracked-controls":214}],116:[function(_dereq_,module,exports){
  1909. var registerComponent=_dereq_("../core/component").registerComponent;module.exports.Component=registerComponent("tracked-controls",{schema:{autoHide:{default:!0},controller:{default:-1},id:{type:"string",default:""},hand:{type:"string",default:""},idPrefix:{type:"string",default:""},handTrackingEnabled:{default:!1},orientationOffset:{type:"vec3"},armModel:{default:!1},headElement:{type:"selector"},iterateControllerProfiles:{default:!1}},update:function(){var e=this.data,t=this.el;t.sceneEl.hasWebXR?t.setAttribute("tracked-controls-webxr",{id:e.id,hand:e.hand,index:e.controller,iterateControllerProfiles:e.iterateControllerProfiles,handTrackingEnabled:e.handTrackingEnabled}):t.setAttribute("tracked-controls-webvr",e)}});
  1910. },{"../core/component":131}],117:[function(_dereq_,module,exports){
  1911. var registerComponent=_dereq_("../core/component").registerComponent,bind=_dereq_("../utils/bind"),THREE=_dereq_("../lib/three"),trackedControlsUtils=_dereq_("../utils/tracked-controls"),checkControllerPresentAndSetup=trackedControlsUtils.checkControllerPresentAndSetup,emitIfAxesChanged=trackedControlsUtils.emitIfAxesChanged,onButtonEvent=trackedControlsUtils.onButtonEvent,INDEX_CONTROLLER_MODEL_BASE_URL="https://cdn.aframe.io/controllers/valve/index/valve-index-",INDEX_CONTROLLER_MODEL_URL={left:INDEX_CONTROLLER_MODEL_BASE_URL+"left.glb",right:INDEX_CONTROLLER_MODEL_BASE_URL+"right.glb"},GAMEPAD_ID_PREFIX="valve",isWebXRAvailable=_dereq_("../utils/").device.isWebXRAvailable,INDEX_CONTROLLER_POSITION_OFFSET_WEBVR={left:{x:-.00023692678902063457,y:.04724540367838371,z:-.061959880395271096},right:{x:.002471558599671131,y:.055765208987076195,z:-.061068168708348844}},INDEX_CONTROLLER_POSITION_OFFSET_WEBXR={left:{x:0,y:-.05,z:.06},right:{x:0,y:-.05,z:.06}},INDEX_CONTROLLER_ROTATION_OFFSET_WEBVR={left:{_x:.692295102620542,_y:-.0627618864318427,_z:-.06265893149611756,_order:"XYZ"},right:{_x:.6484021229942998,_y:-.032563619881892894,_z:-.1327973171917482,_order:"XYZ"}},INDEX_CONTROLLER_ROTATION_OFFSET_WEBXR={left:{_x:Math.PI/3,_y:0,_z:0,_order:"XYZ"},right:{_x:Math.PI/3,_y:0,_z:0,_order:"XYZ"}},INDEX_CONTROLLER_ROTATION_OFFSET=isWebXRAvailable?INDEX_CONTROLLER_ROTATION_OFFSET_WEBXR:INDEX_CONTROLLER_ROTATION_OFFSET_WEBVR,INDEX_CONTROLLER_POSITION_OFFSET=isWebXRAvailable?INDEX_CONTROLLER_POSITION_OFFSET_WEBXR:INDEX_CONTROLLER_POSITION_OFFSET_WEBVR;module.exports.Component=registerComponent("valve-index-controls",{schema:{hand:{default:"left"},buttonColor:{type:"color",default:"#FAFAFA"},buttonHighlightColor:{type:"color",default:"#22D1EE"},model:{default:!0},orientationOffset:{type:"vec3"}},mapping:{axes:{trackpad:[0,1],thumbstick:[2,3]},buttons:["trigger","grip","trackpad","thumbstick","abutton"]},init:function(){var t=this;this.controllerPresent=!1,this.lastControllerCheck=0,this.onButtonChanged=bind(this.onButtonChanged,this),this.onButtonDown=function(e){onButtonEvent(e.detail.id,"down",t)},this.onButtonUp=function(e){onButtonEvent(e.detail.id,"up",t)},this.onButtonTouchEnd=function(e){onButtonEvent(e.detail.id,"touchend",t)},this.onButtonTouchStart=function(e){onButtonEvent(e.detail.id,"touchstart",t)},this.previousButtonValues={},this.rendererSystem=this.el.sceneEl.systems.renderer,this.bindMethods()},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=bind(this.onModelLoaded,this),this.onControllersUpdate=bind(this.onControllersUpdate,this),this.checkIfControllerPresent=bind(this.checkIfControllerPresent,this),this.removeControllersUpdateListener=bind(this.removeControllersUpdateListener,this),this.onAxisMoved=bind(this.onAxisMoved,this)},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("model-loaded",this.onModelLoaded),t.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("model-loaded",this.onModelLoaded),t.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var t=this.data,e="right"===t.hand?0:"left"===t.hand?1:2;checkControllerPresentAndSetup(this,GAMEPAD_ID_PREFIX,{index:e,iterateControllerProfiles:!0,hand:t.hand})},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{idPrefix:GAMEPAD_ID_PREFIX,controller:"right"===e.hand?1:"left"===e.hand?0:2,hand:e.hand,orientationOffset:e.orientationOffset}),this.loadModel()},loadModel:function(){var t=this.data;t.model&&this.el.setAttribute("gltf-model",""+INDEX_CONTROLLER_MODEL_URL[t.hand])},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(t){var e,n=this.mapping.buttons[t.detail.id],o=this.buttonMeshes;n&&("trigger"===n&&(e=t.detail.state.value,o&&o.trigger&&(o.trigger.rotation.x=this.triggerOriginalRotationX-e*(Math.PI/40))),this.el.emit(n+"changed",t.detail.state))},onModelLoaded:function(t){var e,n=t.detail.model,o=this;this.data.model&&(e=this.buttonMeshes={},e.grip={left:n.getObjectByName("leftgrip"),right:n.getObjectByName("rightgrip")},e.menu=n.getObjectByName("menubutton"),e.system=n.getObjectByName("systembutton"),e.trackpad=n.getObjectByName("touchpad"),e.trigger=n.getObjectByName("trigger"),this.triggerOriginalRotationX=e.trigger.rotation.x,Object.keys(e).forEach(function(t){o.setButtonColor(t,o.data.buttonColor)}),n.position.copy(INDEX_CONTROLLER_POSITION_OFFSET[this.data.hand]),n.rotation.copy(INDEX_CONTROLLER_ROTATION_OFFSET[this.data.hand]),this.el.emit("controllermodelready",{name:"valve-index-controlls",model:this.data.model,rayOrigin:new THREE.Vector3(0,0,0)}))},onAxisMoved:function(t){emitIfAxesChanged(this,this.mapping.axes,t)},updateModel:function(t,e){var n;this.data.model&&(-1!==e.indexOf("touch")||(n="up"===e?this.data.buttonColor:this.data.buttonHighlightColor,this.setButtonColor(t,n)))},setButtonColor:function(t,e){}});
  1912. },{"../core/component":131,"../lib/three":179,"../utils/":205,"../utils/bind":199,"../utils/tracked-controls":214}],118:[function(_dereq_,module,exports){
  1913. var registerComponent=_dereq_("../core/component").registerComponent;module.exports.Component=registerComponent("visible",{schema:{default:!0},update:function(){this.el.object3D.visible=this.data}});
  1914. },{"../core/component":131}],119:[function(_dereq_,module,exports){
  1915. var registerComponent=_dereq_("../core/component").registerComponent,bind=_dereq_("../utils/bind"),trackedControlsUtils=_dereq_("../utils/tracked-controls"),checkControllerPresentAndSetup=trackedControlsUtils.checkControllerPresentAndSetup,emitIfAxesChanged=trackedControlsUtils.emitIfAxesChanged,onButtonEvent=trackedControlsUtils.onButtonEvent,VIVE_CONTROLLER_MODEL_OBJ_URL="https://cdn.aframe.io/controllers/vive/vr_controller_vive.obj",VIVE_CONTROLLER_MODEL_OBJ_MTL="https://cdn.aframe.io/controllers/vive/vr_controller_vive.mtl",isWebXRAvailable=_dereq_("../utils/").device.isWebXRAvailable,GAMEPAD_ID_WEBXR="htc-vive-controller-mv",GAMEPAD_ID_WEBVR="OpenVR ",GAMEPAD_ID_PREFIX=isWebXRAvailable?GAMEPAD_ID_WEBXR:GAMEPAD_ID_WEBVR,INPUT_MAPPING_WEBVR={axes:{trackpad:[0,1]},buttons:["trackpad","trigger","grip","menu","system"]},INPUT_MAPPING_WEBXR={axes:{thumbstick:[0,1]},buttons:["trigger","grip","trackpad","none","menu"]},INPUT_MAPPING=isWebXRAvailable?INPUT_MAPPING_WEBXR:INPUT_MAPPING_WEBVR;module.exports.Component=registerComponent("vive-controls",{schema:{hand:{default:"left"},buttonColor:{type:"color",default:"#FAFAFA"},buttonHighlightColor:{type:"color",default:"#22D1EE"},model:{default:!0},orientationOffset:{type:"vec3"}},mapping:INPUT_MAPPING,init:function(){var t=this;this.controllerPresent=!1,this.lastControllerCheck=0,this.onButtonChanged=bind(this.onButtonChanged,this),this.onButtonDown=function(e){onButtonEvent(e.detail.id,"down",t)},this.onButtonUp=function(e){onButtonEvent(e.detail.id,"up",t)},this.onButtonTouchEnd=function(e){onButtonEvent(e.detail.id,"touchend",t)},this.onButtonTouchStart=function(e){onButtonEvent(e.detail.id,"touchstart",t)},this.previousButtonValues={},this.rendererSystem=this.el.sceneEl.systems.renderer,this.bindMethods()},update:function(){var t=this.data;this.controllerIndex="right"===t.hand?0:"left"===t.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=bind(this.onModelLoaded,this),this.onControllersUpdate=bind(this.onControllersUpdate,this),this.checkIfControllerPresent=bind(this.checkIfControllerPresent,this),this.removeControllersUpdateListener=bind(this.removeControllersUpdateListener,this),this.onAxisMoved=bind(this.onAxisMoved,this)},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("model-loaded",this.onModelLoaded),t.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("model-loaded",this.onModelLoaded),t.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var t=this.data;checkControllerPresentAndSetup(this,GAMEPAD_ID_PREFIX,{index:this.controllerIndex,hand:t.hand})},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{idPrefix:GAMEPAD_ID_PREFIX,hand:e.hand,controller:this.controllerIndex,orientationOffset:e.orientationOffset}),this.data.model&&this.el.setAttribute("obj-model",{obj:VIVE_CONTROLLER_MODEL_OBJ_URL,mtl:VIVE_CONTROLLER_MODEL_OBJ_MTL})},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(t){var e,o=this.mapping.buttons[t.detail.id],n=this.buttonMeshes;o&&("trigger"===o&&(e=t.detail.state.value,n&&n.trigger&&(n.trigger.rotation.x=-e*(Math.PI/12))),this.el.emit(o+"changed",t.detail.state))},onModelLoaded:function(t){var e,o=t.detail.model,n=this;this.data.model&&(e=this.buttonMeshes={},e.grip={left:o.getObjectByName("leftgrip"),right:o.getObjectByName("rightgrip")},e.menu=o.getObjectByName("menubutton"),e.system=o.getObjectByName("systembutton"),e.trackpad=o.getObjectByName("touchpad"),e.trigger=o.getObjectByName("trigger"),Object.keys(e).forEach(function(t){n.setButtonColor(t,n.data.buttonColor)}),o.position.set(0,-.015,.04))},onAxisMoved:function(t){emitIfAxesChanged(this,this.mapping.axes,t)},updateModel:function(t,e){var o;this.data.model&&(-1!==e.indexOf("touch")||(o="up"===e?this.data.buttonColor:this.data.buttonHighlightColor,this.setButtonColor(t,o)))},setButtonColor:function(t,e){var o=this.buttonMeshes,n=this.rendererSystem;if(o){if("grip"===t)return o.grip.left.material.color.set(e),o.grip.right.material.color.set(e),n.applyColorCorrection(o.grip.left.material.color),void n.applyColorCorrection(o.grip.right.material.color);o[t].material.color.set(e),n.applyColorCorrection(o[t].material.color)}}});
  1916. },{"../core/component":131,"../utils/":205,"../utils/bind":199,"../utils/tracked-controls":214}],120:[function(_dereq_,module,exports){
  1917. var registerComponent=_dereq_("../core/component").registerComponent,bind=_dereq_("../utils/bind"),trackedControlsUtils=_dereq_("../utils/tracked-controls"),checkControllerPresentAndSetup=trackedControlsUtils.checkControllerPresentAndSetup,emitIfAxesChanged=trackedControlsUtils.emitIfAxesChanged,onButtonEvent=trackedControlsUtils.onButtonEvent,GAMEPAD_ID_PREFIX="HTC Vive Focus",VIVE_FOCUS_CONTROLLER_MODEL_URL="https://cdn.aframe.io/controllers/vive/focus-controller/focus-controller.gltf";module.exports.Component=registerComponent("vive-focus-controls",{schema:{hand:{default:""},buttonTouchedColor:{type:"color",default:"#BBBBBB"},buttonHighlightColor:{type:"color",default:"#7A7A7A"},model:{default:!0},orientationOffset:{type:"vec3"},armModel:{default:!0}},mapping:{axes:{trackpad:[0,1]},buttons:["trackpad","trigger"]},bindMethods:function(){this.onModelLoaded=bind(this.onModelLoaded,this),this.onControllersUpdate=bind(this.onControllersUpdate,this),this.checkIfControllerPresent=bind(this.checkIfControllerPresent,this),this.removeControllersUpdateListener=bind(this.removeControllersUpdateListener,this),this.onAxisMoved=bind(this.onAxisMoved,this)},init:function(){var t=this;this.onButtonChanged=bind(this.onButtonChanged,this),this.onButtonDown=function(e){onButtonEvent(e.detail.id,"down",t)},this.onButtonUp=function(e){onButtonEvent(e.detail.id,"up",t)},this.onButtonTouchStart=function(e){onButtonEvent(e.detail.id,"touchstart",t)},this.onButtonTouchEnd=function(e){onButtonEvent(e.detail.id,"touchend",t)},this.controllerPresent=!1,this.lastControllerCheck=0,this.bindMethods()},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("model-loaded",this.onModelLoaded),t.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0,this.addControllersUpdateListener()},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("model-loaded",this.onModelLoaded),t.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1,this.removeControllersUpdateListener()},checkIfControllerPresent:function(){checkControllerPresentAndSetup(this,GAMEPAD_ID_PREFIX,this.data.hand?{hand:this.data.hand}:{})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{armModel:e.armModel,idPrefix:GAMEPAD_ID_PREFIX,orientationOffset:e.orientationOffset}),this.data.model&&this.el.setAttribute("gltf-model",VIVE_FOCUS_CONTROLLER_MODEL_URL)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelLoaded:function(t){var e,o=t.detail.model;this.data.model&&(e=this.buttonMeshes={},e.trigger=o.getObjectByName("BumperKey"),e.triggerPressed=o.getObjectByName("BumperKey_Press"),e.triggerPressed&&(e.triggerPressed.visible=!1),e.trackpad=o.getObjectByName("TouchPad"),e.trackpadPressed=o.getObjectByName("TouchPad_Press"),e.trackpadPressed&&(e.trackpadPressed.visible=!1))},onButtonChanged:function(t){var e=this.mapping.buttons[t.detail.id];e&&this.el.emit(e+"changed",t.detail.state)},onAxisMoved:function(t){emitIfAxesChanged(this,this.mapping.axes,t)},updateModel:function(t,e){this.data.model&&this.updateButtonModel(t,e)},updateButtonModel:function(t,e){var o=this.buttonMeshes,n=t+"Pressed";if(o&&o[t]&&o[n]){var s;switch(e){case"down":s=this.data.buttonHighlightColor;break;case"touchstart":s=this.data.buttonTouchedColor}s&&o[n].material.color.set(s),o[n].visible=!!s,o[t].visible=!s}}});
  1918. },{"../core/component":131,"../utils/bind":199,"../utils/tracked-controls":214}],121:[function(_dereq_,module,exports){
  1919. function isEmptyObject(e){var t;for(t in e)return!1;return!0}var KEYCODE_TO_CODE=_dereq_("../constants").keyboardevent.KEYCODE_TO_CODE,registerComponent=_dereq_("../core/component").registerComponent,THREE=_dereq_("../lib/three"),utils=_dereq_("../utils/"),bind=utils.bind,shouldCaptureKeyEvent=utils.shouldCaptureKeyEvent,CLAMP_VELOCITY=1e-5,MAX_DELTA=.2,KEYS=["KeyW","KeyA","KeyS","KeyD","ArrowUp","ArrowLeft","ArrowRight","ArrowDown"];module.exports.Component=registerComponent("wasd-controls",{schema:{acceleration:{default:65},adAxis:{default:"x",oneOf:["x","y","z"]},adEnabled:{default:!0},adInverted:{default:!1},enabled:{default:!0},fly:{default:!1},wsAxis:{default:"z",oneOf:["x","y","z"]},wsEnabled:{default:!0},wsInverted:{default:!1}},init:function(){this.keys={},this.easing=1.1,this.velocity=new THREE.Vector3,this.onBlur=bind(this.onBlur,this),this.onContextMenu=bind(this.onContextMenu,this),this.onFocus=bind(this.onFocus,this),this.onKeyDown=bind(this.onKeyDown,this),this.onKeyUp=bind(this.onKeyUp,this),this.onVisibilityChange=bind(this.onVisibilityChange,this),this.attachVisibilityEventListeners()},tick:function(e,t){var i=this.data,n=this.el,s=this.velocity;(s[i.adAxis]||s[i.wsAxis]||!isEmptyObject(this.keys))&&(t/=1e3,this.updateVelocity(t),(s[i.adAxis]||s[i.wsAxis])&&n.object3D.position.add(this.getMovementVector(t)))},remove:function(){this.removeKeyEventListeners(),this.removeVisibilityEventListeners()},play:function(){this.attachKeyEventListeners()},pause:function(){this.keys={},this.removeKeyEventListeners()},updateVelocity:function(e){var t,i,n,s,o,r=this.data,a=this.keys,d=this.velocity;if(i=r.adAxis,s=r.wsAxis,e>MAX_DELTA)return d[i]=0,void(d[s]=0);var h=Math.pow(1/this.easing,60*e);0!==d[i]&&(d[i]=d[i]*h),0!==d[s]&&(d[s]=d[s]*h),Math.abs(d[i])<CLAMP_VELOCITY&&(d[i]=0),Math.abs(d[s])<CLAMP_VELOCITY&&(d[s]=0),r.enabled&&(t=r.acceleration,r.adEnabled&&(n=r.adInverted?-1:1,(a.KeyA||a.ArrowLeft)&&(d[i]-=n*t*e),(a.KeyD||a.ArrowRight)&&(d[i]+=n*t*e)),r.wsEnabled&&(o=r.wsInverted?-1:1,(a.KeyW||a.ArrowUp)&&(d[s]-=o*t*e),(a.KeyS||a.ArrowDown)&&(d[s]+=o*t*e)))},getMovementVector:function(){var e=new THREE.Vector3(0,0,0),t=new THREE.Euler(0,0,0,"YXZ");return function(i){var n,s=this.el.getAttribute("rotation"),o=this.velocity;return e.copy(o),e.multiplyScalar(i),s?(n=this.data.fly?s.x:0,t.set(THREE.Math.degToRad(n),THREE.Math.degToRad(s.y),0),e.applyEuler(t),e):e}}(),attachVisibilityEventListeners:function(){window.oncontextmenu=this.onContextMenu,window.addEventListener("blur",this.onBlur),window.addEventListener("focus",this.onFocus),document.addEventListener("visibilitychange",this.onVisibilityChange)},removeVisibilityEventListeners:function(){window.removeEventListener("blur",this.onBlur),window.removeEventListener("focus",this.onFocus),document.removeEventListener("visibilitychange",this.onVisibilityChange)},attachKeyEventListeners:function(){window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp)},removeKeyEventListeners:function(){window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp)},onContextMenu:function(){for(var e=Object.keys(this.keys),t=0;t<e.length;t++)delete this.keys[e[t]]},onBlur:function(){this.pause()},onFocus:function(){this.play()},onVisibilityChange:function(){document.hidden?this.onBlur():this.onFocus()},onKeyDown:function(e){var t;shouldCaptureKeyEvent(e)&&(t=e.code||KEYCODE_TO_CODE[e.keyCode],-1!==KEYS.indexOf(t)&&(this.keys[t]=!0))},onKeyUp:function(e){var t;t=e.code||KEYCODE_TO_CODE[e.keyCode],delete this.keys[t]}});
  1920. },{"../constants":123,"../core/component":131,"../lib/three":179,"../utils/":205}],122:[function(_dereq_,module,exports){
  1921. var registerComponent=_dereq_("../core/component").registerComponent,bind=_dereq_("../utils/bind"),trackedControlsUtils=_dereq_("../utils/tracked-controls"),checkControllerPresentAndSetup=trackedControlsUtils.checkControllerPresentAndSetup,emitIfAxesChanged=trackedControlsUtils.emitIfAxesChanged,onButtonEvent=trackedControlsUtils.onButtonEvent,utils=_dereq_("../utils/"),debug=utils.debug("components:windows-motion-controls:debug"),warn=utils.debug("components:windows-motion-controls:warn"),DEFAULT_HANDEDNESS=_dereq_("../constants").DEFAULT_HANDEDNESS,MODEL_BASE_URL="https://cdn.aframe.io/controllers/microsoft/",MODEL_FILENAMES={left:"left.glb",right:"right.glb",default:"universal.glb"},isWebXRAvailable=_dereq_("../utils/").device.isWebXRAvailable,GAMEPAD_ID_WEBXR="windows-mixed-reality",GAMEPAD_ID_WEBVR="Spatial Controller (Spatial Interaction Source) ",GAMEPAD_ID_PATTERN=/([0-9a-zA-Z]+-[0-9a-zA-Z]+)$/,GAMEPAD_ID_PREFIX=isWebXRAvailable?GAMEPAD_ID_WEBXR:GAMEPAD_ID_WEBVR,INPUT_MAPPING_WEBVR={axes:{thumbstick:[0,1],trackpad:[2,3]},buttons:["thumbstick","trigger","grip","menu","trackpad"],axisMeshNames:["THUMBSTICK_X","THUMBSTICK_Y","TOUCHPAD_TOUCH_X","TOUCHPAD_TOUCH_Y"],buttonMeshNames:{trigger:"SELECT",menu:"MENU",grip:"GRASP",thumbstick:"THUMBSTICK_PRESS",trackpad:"TOUCHPAD_PRESS"},pointingPoseMeshName:"POINTING_POSE"},INPUT_MAPPING_WEBXR={axes:{touchpad:[0,1],thumbstick:[2,3]},buttons:["trigger","squeeze","touchpad","thumbstick","menu"],axisMeshNames:["TOUCHPAD_TOUCH_X","TOUCHPAD_TOUCH_X","THUMBSTICK_X","THUMBSTICK_Y"],buttonMeshNames:{trigger:"SELECT",menu:"MENU",squeeze:"GRASP",thumbstick:"THUMBSTICK_PRESS",touchpad:"TOUCHPAD_PRESS"},pointingPoseMeshName:"POINTING_POSE"},INPUT_MAPPING=isWebXRAvailable?INPUT_MAPPING_WEBXR:INPUT_MAPPING_WEBVR;module.exports.Component=registerComponent("windows-motion-controls",{schema:{hand:{default:DEFAULT_HANDEDNESS},pair:{default:0},model:{default:!0},hideDisconnected:{default:!0}},mapping:INPUT_MAPPING,bindMethods:function(){this.onModelError=bind(this.onModelError,this),this.onModelLoaded=bind(this.onModelLoaded,this),this.onControllersUpdate=bind(this.onControllersUpdate,this),this.checkIfControllerPresent=bind(this.checkIfControllerPresent,this),this.onAxisMoved=bind(this.onAxisMoved,this)},init:function(){var e=this,t=this.el;this.onButtonChanged=bind(this.onButtonChanged,this),this.onButtonDown=function(t){onButtonEvent(t.detail.id,"down",e)},this.onButtonUp=function(t){onButtonEvent(t.detail.id,"up",e)},this.onButtonTouchStart=function(t){onButtonEvent(t.detail.id,"touchstart",e)},this.onButtonTouchEnd=function(t){onButtonEvent(t.detail.id,"touchend",e)},this.onControllerConnected=function(){e.setModelVisibility(!0)},this.onControllerDisconnected=function(){e.setModelVisibility(!1)},this.controllerPresent=!1,this.lastControllerCheck=0,this.previousButtonValues={},this.bindMethods(),this.loadedMeshInfo={buttonMeshes:null,axisMeshes:null},this.rayOrigin={origin:new THREE.Vector3,direction:new THREE.Vector3(0,0,-1),createdFromMesh:!1},t.addEventListener("controllerconnected",this.onControllerConnected),t.addEventListener("controllerdisconnected",this.onControllerDisconnected)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),e.addEventListener("model-error",this.onModelError),e.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),e.removeEventListener("model-error",this.onModelError),e.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){checkControllerPresentAndSetup(this,GAMEPAD_ID_PREFIX,{hand:this.data.hand,index:this.data.pair,iterateControllerProfiles:!0})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},updateControllerModel:function(){if(!this.data.model||this.rayOrigin.createdFromMesh)return void this.modelReady();var e=this.createControllerModelUrl();this.loadModel(e)},createControllerModelUrl:function(e){var t,n=this.el.components["tracked-controls"],o=n?n.controller:null,i="default",s=this.data.hand;if(o&&!window.hasNativeWebXRImplementation&&(s=o.hand,!e)){var r=o.id.match(GAMEPAD_ID_PATTERN);i=r&&r[0]||i}return t=MODEL_FILENAMES[s]||MODEL_FILENAMES.default,MODEL_BASE_URL+i+"/"+t},injectTrackedControls:function(){var e=this.data;this.el.setAttribute("tracked-controls",{idPrefix:GAMEPAD_ID_PREFIX,controller:e.pair,hand:e.hand,armModel:!1}),this.updateControllerModel()},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelError:function(e){var t=this.createControllerModelUrl(!0);e.detail.src!==t?(warn("Failed to load controller model for device, attempting to load default."),this.loadModel(t)):warn("Failed to load default controller model.")},loadModel:function(e){this.el.setAttribute("gltf-model","url("+e+")")},onModelLoaded:function(e){function t(e,t){for(var n=0,o=e.children.length;n<o;n++){var i=e.children[n];if(i&&i.name===t)return i}}var n,o,i,s,r=this.controllerModel=e.detail.model,a=this.loadedMeshInfo;if(debug("Processing model"),a.buttonMeshes={},a.axisMeshes={},r){for(n=0;n<this.mapping.buttons.length;n++)o=this.mapping.buttonMeshNames[this.mapping.buttons[n]],o?(i=r.getObjectByName(o),i?(s={index:n,value:t(i,"VALUE"),pressed:t(i,"PRESSED"),unpressed:t(i,"UNPRESSED")},s.value&&s.pressed&&s.unpressed?a.buttonMeshes[this.mapping.buttons[n]]=s:warn("Missing button submesh under mesh with name: "+o+"(VALUE: "+!!s.value+", PRESSED: "+!!s.pressed+", UNPRESSED:"+!!s.unpressed+")")):warn("Missing button mesh with name: "+o)):debug("Skipping unknown button at index: "+n+" with mapped name: "+this.mapping.buttons[n]);for(n=0;n<this.mapping.axisMeshNames.length;n++)o=this.mapping.axisMeshNames[n],o?(i=r.getObjectByName(o),i?(s={index:n,value:t(i,"VALUE"),min:t(i,"MIN"),max:t(i,"MAX")},s.value&&s.min&&s.max?a.axisMeshes[n]=s:warn("Missing axis submesh under mesh with name: "+o+"(VALUE: "+!!s.value+", MIN: "+!!s.min+", MAX:"+!!s.max+")")):warn("Missing axis mesh with name: "+o)):debug("Skipping unknown axis at index: "+n);this.calculateRayOriginFromMesh(r),this.setModelVisibility()}debug("Model load complete.")},calculateRayOriginFromMesh:function(){var e=new THREE.Quaternion;return function(t){var n;if(this.rayOrigin.origin.set(0,0,0),this.rayOrigin.direction.set(0,0,-1),this.rayOrigin.createdFromMesh=!0,n=t.getObjectByName(this.mapping.pointingPoseMeshName)){var o=t.parent;o&&(t.parent=null,t.updateMatrixWorld(!0),t.parent=o),n.getWorldPosition(this.rayOrigin.origin),n.getWorldQuaternion(e),this.rayOrigin.direction.applyQuaternion(e),o&&t.updateMatrixWorld(!0)}else debug("Mesh does not contain pointing origin data, defaulting to none.");this.modelReady()}}(),lerpAxisTransform:function(){var e=new THREE.Quaternion;return function(t,n){var o=this.loadedMeshInfo.axisMeshes[t];if(o){var i=o.min,s=o.max,r=o.value,a=.5*n+.5;r.setRotationFromQuaternion(e.copy(i.quaternion).slerp(s.quaternion,a)),r.position.lerpVectors(i.position,s.position,a)}}}(),lerpButtonTransform:function(){var e=new THREE.Quaternion;return function(t,n){var o=this.loadedMeshInfo.buttonMeshes[t];if(o){var i=o.unpressed,s=o.pressed,r=o.value;r.setRotationFromQuaternion(e.copy(i.quaternion).slerp(s.quaternion,n)),r.position.lerpVectors(i.position,s.position,n)}}}(),modelReady:function(){this.el.emit("controllermodelready",{name:"windows-motion-controls",model:this.data.model,rayOrigin:this.rayOrigin})},onButtonChanged:function(e){var t=this.mapping.buttons[e.detail.id];t&&(this.loadedMeshInfo&&this.loadedMeshInfo.buttonMeshes&&this.lerpButtonTransform(t,e.detail.state.value),this.el.emit(t+"changed",e.detail.state))},onAxisMoved:function(e){var t=this.mapping.axisMeshNames.length;if(this.loadedMeshInfo&&this.loadedMeshInfo.axisMeshes)for(var n=0;n<t;n++)this.lerpAxisTransform(n,e.detail.axis[n]||0);emitIfAxesChanged(this,this.mapping.axes,e)},setModelVisibility:function(e){var t=this.el.getObject3D("mesh");e=void 0!==e?e:this.modelVisible,this.modelVisible=e,t&&(t.visible=e)}});
  1922. },{"../constants":123,"../core/component":131,"../utils/":205,"../utils/bind":199,"../utils/tracked-controls":214}],123:[function(_dereq_,module,exports){
  1923. module.exports={AFRAME_INJECTED:"aframe-injected",DEFAULT_CAMERA_HEIGHT:1.6,DEFAULT_HANDEDNESS:"right",keyboardevent:_dereq_("./keyboardevent")};
  1924. },{"./keyboardevent":124}],124:[function(_dereq_,module,exports){
  1925. module.exports={KEYCODE_TO_CODE:{38:"ArrowUp",37:"ArrowLeft",40:"ArrowDown",39:"ArrowRight",87:"KeyW",65:"KeyA",83:"KeyS",68:"KeyD"}};
  1926. },{}],125:[function(_dereq_,module,exports){
  1927. function mediaElementLoaded(e){if(e.hasAttribute("autoplay")||"auto"===e.getAttribute("preload"))return new Promise(function(t,r){function i(){for(var r=0,i=0;i<e.buffered.length;i++)r+=e.buffered.end(i)-e.buffered.start(i);r>=e.duration&&("VIDEO"===e.tagName&&(THREE.Cache.files[e.getAttribute("src")]=e),t())}return 4===e.readyState?t():e.error?r():(e.addEventListener("loadeddata",i,!1),e.addEventListener("progress",i,!1),void e.addEventListener("error",r,!1))})}function fixUpMediaElement(e){var t=setCrossOrigin(e);return t.tagName&&"video"===t.tagName.toLowerCase()&&(t.setAttribute("playsinline",""),t.setAttribute("webkit-playsinline","")),t!==e&&(e.parentNode.appendChild(t),e.parentNode.removeChild(e)),t}function setCrossOrigin(e){var t;if(e.hasAttribute("crossorigin"))return e;if(null!==(t=e.getAttribute("src"))){if(-1===t.indexOf("://"))return e;if(extractDomain(t)===window.location.host)return e}return warn('Cross-origin element (e.g., <img>) was requested without `crossorigin` set. A-Frame will re-request the asset with `crossorigin` attribute set. Please set `crossorigin` on the element (e.g., <img crossorigin="anonymous">)',t),e.crossOrigin="anonymous",e.cloneNode(!0)}function extractDomain(e){var t=e.indexOf("://")>-1?e.split("/")[2]:e.split("/")[0];return t.substring(0,t.indexOf(":"))}function inferResponseType(e){var t=getFileNameFromURL(e),r=t.lastIndexOf(".");if(r>=0){if(".glb"===t.slice(r,e.search(/\?|#|$/)))return"arraybuffer"}return"text"}function getFileNameFromURL(e){var t=document.createElement("a");t.href=e;var r=t.search.replace(/^\?/,""),i=e.replace(r,"").replace("?","");return i.substring(i.lastIndexOf("/")+1)}var ANode=_dereq_("./a-node"),bind=_dereq_("../utils/bind"),debug=_dereq_("../utils/debug"),registerElement=_dereq_("./a-register-element").registerElement,THREE=_dereq_("../lib/three"),fileLoader=new THREE.FileLoader,warn=debug("core:a-assets:warn");module.exports=registerElement("a-assets",{prototype:Object.create(ANode.prototype,{createdCallback:{value:function(){this.isAssets=!0,this.fileLoader=fileLoader,this.timeout=null}},attachedCallback:{value:function(){var e,t,r,i,o,s,a=this,n=[];if(!this.parentNode.isScene)throw new Error("<a-assets> must be a child of a <a-scene>.");for(o=this.querySelectorAll("img"),e=0;e<o.length;e++)i=fixUpMediaElement(o[e]),n.push(new Promise(function(t,r){THREE.Cache.files[o[e].getAttribute("src")]=i,i.onload=t,i.onerror=r}));for(r=this.querySelectorAll("audio, video"),e=0;e<r.length;e++)t=fixUpMediaElement(r[e]),t.src||t.srcObject||warn("Audio/video asset has neither `src` nor `srcObject` attributes."),n.push(mediaElementLoaded(t));Promise.all(n).then(bind(this.load,this)),s=parseInt(this.getAttribute("timeout"),10)||3e3,this.timeout=setTimeout(function(){a.hasLoaded||(warn("Asset loading timed out in ",s,"ms"),a.emit("timeout"),a.load())},s)}},detachedCallback:{value:function(){this.timeout&&clearTimeout(this.timeout)}},load:{value:function(){ANode.prototype.load.call(this,null,function(e){return e.isAssetItem&&e.hasAttribute("src")})}}})}),registerElement("a-asset-item",{prototype:Object.create(ANode.prototype,{createdCallback:{value:function(){this.data=null,this.isAssetItem=!0}},attachedCallback:{value:function(){var e=this,t=this.getAttribute("src");fileLoader.setResponseType(this.getAttribute("response-type")||inferResponseType(t)),fileLoader.load(t,function(t){e.data=t,setTimeout(function(){ANode.prototype.load.call(e)})},function(t){e.emit("progress",{loadedBytes:t.loaded,totalBytes:t.total,xhr:t})},function(t){e.emit("error",{xhr:t})})}}})}),module.exports.inferResponseType=inferResponseType,module.exports.getFileNameFromURL=getFileNameFromURL;
  1928. },{"../lib/three":179,"../utils/bind":199,"../utils/debug":201,"./a-node":129,"./a-register-element":130}],126:[function(_dereq_,module,exports){
  1929. var debug=_dereq_("../utils/debug"),registerElement=_dereq_("./a-register-element").registerElement,warn=debug("core:cubemap:warn");module.exports=registerElement("a-cubemap",{prototype:Object.create(window.HTMLElement.prototype,{attachedCallback:{value:function(){this.srcs=this.validate()},writable:window.debug},validate:{value:function(){var e,t=this.querySelectorAll("[src]"),r=[];if(6===t.length){for(e=0;e<t.length;e++)r.push(t[e].getAttribute("src"));return r}warn("<a-cubemap> did not contain exactly six elements each with a `src` attribute.")},writable:window.debug}})});
  1930. },{"../utils/debug":201,"./a-register-element":130}],127:[function(_dereq_,module,exports){
  1931. function checkComponentDefined(t,e){return!(!t.components[e]||!t.components[e].attrValue)||isComponentMixedIn(e,t.mixinEls)}function isComponentMixedIn(t,e){var i,n=!1;for(i=0;i<e.length&&!(n=e[i].hasAttribute(t));++i);return n}function mergeComponentData(t,e){return e?e.constructor===Object?utils.extend(e,utils.styleParser.parse(t||{})):t||e:t}function isComponent(t){return-1!==t.indexOf(MULTIPLE_COMPONENT_DELIMITER)&&(t=utils.split(t,MULTIPLE_COMPONENT_DELIMITER)[0]),!!COMPONENTS[t]}function getRotation(t){var e=THREE.Math.radToDeg,i=t.object3D.rotation,n=t.rotationObj;return n.x=e(i.x),n.y=e(i.y),n.z=e(i.z),n}var ANode=_dereq_("./a-node"),COMPONENTS=_dereq_("./component").components,registerElement=_dereq_("./a-register-element").registerElement,THREE=_dereq_("../lib/three"),utils=_dereq_("../utils/"),AEntity,debug=utils.debug("core:a-entity:debug"),warn=utils.debug("core:a-entity:warn"),MULTIPLE_COMPONENT_DELIMITER="__",OBJECT3D_COMPONENTS=["position","rotation","scale","visible"],ONCE={once:!0},proto=Object.create(ANode.prototype,{createdCallback:{value:function(){this.components={},this.initializingComponents={},this.componentsToUpdate={},this.isEntity=!0,this.isPlaying=!1,this.object3D=new THREE.Group,this.object3D.el=this,this.object3DMap={},this.parentEl=null,this.rotationObj={},this.states=[]}},attributeChangedCallback:{value:function(t,e,i){var n=this.components[t];if(n&&n.justInitialized&&""===i)return void delete n.justInitialized;(n||null!==i)&&this.setEntityAttribute(t,e,i)}},attachedCallback:{value:function(){var t,e=this.sceneEl,i=this;if(this.addToParent(),!this.isScene){if(!e)return void this.load();if((t=e.querySelector("a-assets"))&&!t.hasLoaded)return void t.addEventListener("loaded",function(){i.load()});this.load()}}},detachedCallback:{value:function(){var t;if(this.parentEl){for(t in this.components)this.removeComponent(t,!1);this.isScene||(this.removeFromParent(),ANode.prototype.detachedCallback.call(this),this.object3D.el=null)}}},getObject3D:{value:function(t){return this.object3DMap[t]}},setObject3D:{value:function(t,e){var i,n=this;if(!(e instanceof THREE.Object3D))throw new Error("`Entity.setObject3D` was called with an object that was not an instance of THREE.Object3D.");i=this.getObject3D(t),i&&this.object3D.remove(i),e.el=this,e.children.length&&e.traverse(function(t){t.el=n}),this.object3D.add(e),this.object3DMap[t]=e,this.emit("object3dset",{object:e,type:t})}},removeObject3D:{value:function(t){var e=this.getObject3D(t);if(!e)return void warn("Tried to remove `Object3D` of type:",t,"which was not defined.");this.object3D.remove(e),delete this.object3DMap[t],this.emit("object3dremove",{type:t})}},getOrCreateObject3D:{value:function(t,e){var i=this.getObject3D(t);return!i&&e&&(i=new e,this.setObject3D(t,i)),warn("`getOrCreateObject3D` has been deprecated. Use `setObject3D()` and `object3dset` event instead."),i}},add:{value:function(t){if(!t.object3D)throw new Error("Trying to add an element that doesn't have an `object3D`");this.object3D.add(t.object3D),this.emit("child-attached",{el:t})}},addToParent:{value:function(){var t=this.parentEl=this.parentNode;t&&t.add&&!this.attachedToParent&&(t.add(this),this.attachedToParent=!0)}},removeFromParent:{value:function(){var t=this.parentEl;this.parentEl.remove(this),this.attachedToParent=!1,this.parentEl=null,t.emit("child-detached",{el:this})}},load:{value:function(){var t=this;!this.hasLoaded&&this.parentEl&&ANode.prototype.load.call(this,function(){t.parentEl&&(t.updateComponents(),(t.isScene||t.parentEl.isPlaying)&&t.play())})},writable:window.debug},remove:{value:function(t){t?this.object3D.remove(t.object3D):this.parentNode.removeChild(this)}},getChildEntities:{value:function(){for(var t=this.children,e=[],i=0;i<t.length;i++){var n=t[i];n instanceof AEntity&&e.push(n)}return e}},initComponent:{value:function(t,e,i){var n,o,s,a;if(s=utils.split(t,MULTIPLE_COMPONENT_DELIMITER),a=s[0],o=s.length>2?s.slice(1).join("__"):s[1],COMPONENTS[a]&&(checkComponentDefined(this,t)||void 0!==e||i)&&!(t in this.components)){if(this.initComponentDependencies(a),o&&!COMPONENTS[a].multiple)throw new Error("Trying to initialize multiple components of type `"+a+"`. There can only be one component of this type per entity.");n=new COMPONENTS[a].Component(this,e,o),this.isPlaying&&n.play(),this.hasAttribute(t)||(n.justInitialized=!0,window.HTMLElement.prototype.setAttribute.call(this,t,"")),debug("Component initialized: %s",t)}},writable:window.debug},initComponentDependencies:{value:function(t){var e,i,n=this,o=COMPONENTS[t];if(o&&(e=COMPONENTS[t].dependencies))for(i=0;i<e.length;i++)n.initComponent(e[i],window.HTMLElement.prototype.getAttribute.call(n,e[i])||void 0,!0)}},removeComponent:{value:function(t,e){var i;if(i=this.components[t]){if(!i.initialized)return void this.addEventListener("componentinitialized",function i(n){n.detail.name===t&&(this.removeComponent(t,e),this.removeEventListener("componentinitialized",i))});i.pause(),i.remove(),e&&(i.destroy(),delete this.components[t]),this.emit("componentremoved",i.evtDetail,!1)}},writable:window.debug},updateComponents:{value:function(){var t,e,i,n,o=this.componentsToUpdate;if(this.hasLoaded){for(i=0;i<this.mixinEls.length;i++)for(n in this.mixinEls[i].componentCache)isComponent(n)&&(o[n]=!0);if(this.getExtraComponents){e=this.getExtraComponents();for(n in e)isComponent(n)&&(o[n]=!0)}for(i=0;i<this.attributes.length;++i)n=this.attributes[i].name,-1===OBJECT3D_COMPONENTS.indexOf(n)&&isComponent(n)&&(o[n]=!0);for(i=0;i<OBJECT3D_COMPONENTS.length;i++)n=OBJECT3D_COMPONENTS[i],this.hasAttribute(n)&&this.updateComponent(n,this.getDOMAttribute(n));for(n in o)t=mergeComponentData(this.getDOMAttribute(n),e&&e[n]),this.updateComponent(n,t),delete o[n]}},writable:window.debug},updateComponent:{value:function(t,e,i){var n=this.components[t];if(n)return null!==e||checkComponentDefined(this,t)?void n.updateProperties(e,i):void this.removeComponent(t,!0);this.initComponent(t,e,!1)}},removeAttribute:{value:function(t,e){var i=this.components[t];if(i&&void 0===e&&this.removeComponent(t,!0),i&&void 0!==e)return void i.resetProperty(e);"mixin"===t&&this.mixinUpdate(""),window.HTMLElement.prototype.removeAttribute.call(this,t)}},play:{value:function(){var t,e,i;if(!this.isPlaying&&this.hasLoaded){this.isPlaying=!0;for(i in this.components)this.components[i].play();for(t=this.getChildEntities(),e=0;e<t.length;e++)t[e].play();this.emit("play")}},writable:!0},pause:{value:function(){var t,e,i;if(this.isPlaying){this.isPlaying=!1;for(i in this.components)this.components[i].pause();for(t=this.getChildEntities(),e=0;e<t.length;e++)t[e].pause();this.emit("pause")}},writable:!0},setEntityAttribute:{value:function(t,e,i){if(COMPONENTS[t]||this.components[t])return void this.updateComponent(t,i);if("mixin"===t){if(i===this.computedMixinStr)return;this.mixinUpdate(i,e)}}},mixinUpdate:{value:function(){var t=[];return function(e,i){var n,o,s,a,r=this;if(!this.hasLoaded)return void this.addEventListener("loaded",function(){r.mixinUpdate(e,i)},ONCE);for(i=i||this.getAttribute("mixin"),s=this.updateMixins(e,i),t.length=0,a=0;a<this.mixinEls.length;a++)for(n in this.mixinEls[a].componentCache)-1===t.indexOf(n)&&(this.components[n]?this.components[n].handleMixinUpdate():this.initComponent(n,null),t.push(n));for(a=0;a<s.oldMixinIds.length;a++)if(o=document.getElementById(s.oldMixinIds[a]))for(n in o.componentCache)-1===t.indexOf(n)&&this.components[n]&&(this.getDOMAttribute(n)?this.components[n].handleMixinUpdate():this.removeComponent(n,!0))}}()},setAttribute:{value:function(){var t={};return function(e,i,n){var o,s,a,r,h,l;if(r=e.indexOf(MULTIPLE_COMPONENT_DELIMITER),a=r>0?e.substring(0,r):e,!COMPONENTS[a])return"mixin"===e&&this.mixinUpdate(i),void ANode.prototype.setAttribute.call(this,e,i);if(!this.components[e]&&this.hasAttribute(e)&&this.updateComponent(e,window.HTMLElement.prototype.getAttribute.call(this,e)),void 0!==n&&"string"==typeof i&&i.length>0&&"string"==typeof utils.styleParser.parse(i)){for(l in t)delete t[l];o=t,o[i]=n,s=!1}else o=i,s=!0===n;this.updateComponent(e,o,s),(h=this.sceneEl&&this.sceneEl.getAttribute("debug"))&&this.components[e].flushToDOM()}}(),writable:window.debug},flushToDOM:{value:function(t){var e,i,n,o=this.components,s=this.children;for(n in o)o[n].flushToDOM();if(t)for(i=0;i<s.length;++i)e=s[i],e.flushToDOM&&e.flushToDOM(t)}},getAttribute:{value:function(t){var e;return"position"===t?this.object3D.position:"rotation"===t?getRotation(this):"scale"===t?this.object3D.scale:"visible"===t?this.object3D.visible:(e=this.components[t],e?e.data:window.HTMLElement.prototype.getAttribute.call(this,t))},writable:window.debug},getDOMAttribute:{value:function(t){var e=this.components[t];return e?e.attrValue:window.HTMLElement.prototype.getAttribute.call(this,t)},writable:window.debug},addState:{value:function(t){this.is(t)||(this.states.push(t),this.emit("stateadded",t))}},removeState:{value:function(t){var e=this.states.indexOf(t);-1!==e&&(this.states.splice(e,1),this.emit("stateremoved",t))}},is:{value:function(t){return-1!==this.states.indexOf(t)}},inspect:{value:function(){this.sceneEl.components.inspector.openInspector(this)}},destroy:{value:function(){var t;if(this.parentNode)return void warn("Entity can only be destroyed if detached from scenegraph.");for(t in this.components)this.components[t].destroy()}}});AEntity=registerElement("a-entity",{prototype:proto}),module.exports=AEntity;
  1932. },{"../lib/three":179,"../utils/":205,"./a-node":129,"./a-register-element":130,"./component":131}],128:[function(_dereq_,module,exports){
  1933. var ANode=_dereq_("./a-node"),registerElement=_dereq_("./a-register-element").registerElement,components=_dereq_("./component").components,utils=_dereq_("../utils"),MULTIPLE_COMPONENT_DELIMITER="__";module.exports=registerElement("a-mixin",{prototype:Object.create(ANode.prototype,{createdCallback:{value:function(){this.componentCache={},this.id=this.getAttribute("id"),this.isMixin=!0}},attributeChangedCallback:{value:function(t,e,i){this.cacheAttribute(t,i),this.updateEntities()}},attachedCallback:{value:function(){this.sceneEl=this.closestScene(),this.cacheAttributes(),this.updateEntities(),this.load()}},setAttribute:{value:function(t,e){window.HTMLElement.prototype.setAttribute.call(this,t,e),this.cacheAttribute(t,e)}},cacheAttribute:{value:function(t,e){var i,n;n=utils.split(t,MULTIPLE_COMPONENT_DELIMITER)[0],(i=components[n])&&(void 0===e&&(e=window.HTMLElement.prototype.getAttribute.call(this,t)),this.componentCache[t]=i.parseAttrValueForCache(e))}},getAttribute:{value:function(t){return this.componentCache[t]||window.HTMLElement.prototype.getAttribute.call(this,t)}},cacheAttributes:{value:function(){var t,e,i=this.attributes;for(e=0;e<i.length;e++)t=i[e].name,this.cacheAttribute(t)}},updateEntities:{value:function(){var t,e,i;if(this.sceneEl)for(e=this.sceneEl.querySelectorAll("[mixin~="+this.id+"]"),i=0;i<e.length;i++)t=e[i],t.hasLoaded&&!t.isMixin&&t.mixinUpdate(this.id)}}})});
  1934. },{"../utils":205,"./a-node":129,"./a-register-element":130,"./component":131}],129:[function(_dereq_,module,exports){
  1935. var registerElement=_dereq_("./a-register-element").registerElement,isNode=_dereq_("./a-register-element").isNode,utils=_dereq_("../utils/"),warn=utils.debug("core:a-node:warn"),error=utils.debug("core:a-node:error");module.exports=registerElement("a-node",{prototype:Object.create(window.HTMLElement.prototype,{createdCallback:{value:function(){this.computedMixinStr="",this.hasLoaded=!1,this.isNode=!0,this.mixinEls=[]},writable:window.debug},attachedCallback:{value:function(){var t;this.sceneEl=this.closestScene(),this.sceneEl||warn("You are attempting to attach <"+this.tagName+"> outside of an A-Frame scene. Append this element to `<a-scene>` instead."),this.hasLoaded=!1,this.emit("nodeready",void 0,!1),this.isMixin||(t=this.getAttribute("mixin"))&&this.updateMixins(t)},writable:window.debug},attributeChangedCallback:{value:function(t,e,i){i!==this.computedMixinStr&&("mixin"!==t||this.isMixin||this.updateMixins(i,e))}},closestScene:{value:function(){for(var t=this;t&&!t.isScene;)t=t.parentElement;return t}},closest:{value:function(t){for(var e=this.matches||this.mozMatchesSelector||this.msMatchesSelector||this.oMatchesSelector||this.webkitMatchesSelector,i=this;i&&!e.call(i,t);)i=i.parentElement;return i}},detachedCallback:{value:function(){this.hasLoaded=!1}},load:{value:function(t,e){var i,n,s=this;this.hasLoaded||(e=e||isNode,i=this.getChildren(),n=i.filter(e).map(function(t){return new Promise(function(e){if(t.hasLoaded)return e();t.addEventListener("loaded",e)})}),Promise.all(n).then(function(){s.hasLoaded=!0,t&&t(),s.emit("loaded",void 0,!1)}).catch(function(t){error("Failure loading node: ",t)}))},writable:!0},getChildren:{value:function(){return Array.prototype.slice.call(this.children,0)}},updateMixins:{value:function(){var t=[],e=[],i={};return function(n,s){var r,a,o;for(t.length=0,e.length=0,a=n?utils.split(n.trim(),/\s+/):t,o=s?utils.split(s.trim(),/\s+/):e,i.newMixinIds=a,i.oldMixinIds=o,r=0;r<o.length;r++)-1===a.indexOf(o[r])&&this.unregisterMixin(o[r]);for(this.computedMixinStr="",this.mixinEls.length=0,r=0;r<a.length;r++)this.registerMixin(document.getElementById(a[r]));return this.computedMixinStr&&(this.computedMixinStr=this.computedMixinStr.trim(),window.HTMLElement.prototype.setAttribute.call(this,"mixin",this.computedMixinStr)),i}}()},registerMixin:{value:function(t){var e,i,n;if(t){if(n=t.getAttribute("mixin"))for(e=utils.split(n.trim(),/\s+/),i=0;i<e.length;i++)this.registerMixin(document.getElementById(e[i]));this.computedMixinStr=this.computedMixinStr+" "+t.id,this.mixinEls.push(t)}}},setAttribute:{value:function(t,e){"mixin"===t&&this.updateMixins(e),window.HTMLElement.prototype.setAttribute.call(this,t,e)}},unregisterMixin:{value:function(t){var e,i,n=this.mixinEls;for(e=0;e<n.length;++e)if(i=n[e],t===i.id){n.splice(e,1);break}}},emit:{value:function(){var t={};return function(e,i,n,s){void 0===n&&(n=!0),t.bubbles=!!n,t.detail=i,s&&(t=utils.extend({},s,t)),this.dispatchEvent(new CustomEvent(e,t))}}(),writable:window.debug}})});
  1936. },{"../utils/":205,"./a-register-element":130}],130:[function(_dereq_,module,exports){
  1937. function addTagName(e){knownTags[e.toLowerCase()]=!0}function wrapANodeMethods(e){var t={};return wrapMethods(t,["attachedCallback","attributeChangedCallback","createdCallback","detachedCallback"],e,ANode.prototype),copyProperties(e,t),t}function wrapAEntityMethods(e){var t={},o=["attachedCallback","attributeChangedCallback","createdCallback","detachedCallback"],a=["attachedCallback","attributeChangedCallback","createdCallback","detachedCallback"];return wrapMethods(t,o,e,ANode.prototype),wrapMethods(t,a,e,AEntity.prototype),copyProperties(e,t),t}function wrapMethods(e,t,o,a){t.forEach(function(t){wrapMethod(e,t,o,a)})}function wrapMethod(e,t,o,a){var r=o[t],n=a[t];r&&n&&r!==n&&(e[t]={value:function(){return n.apply(this,arguments),r.apply(this,arguments)},writable:window.debug})}function copyProperties(e,t){Object.getOwnPropertyNames(e).forEach(function(o){var a;t[o]||(a=Object.getOwnPropertyDescriptor(e,o),t[o]={value:e[o],writable:a.writable})})}_dereq_("document-register-element");var ANode,AEntity,knownTags=module.exports.knownTags={};module.exports.isNode=function(e){return e.tagName.toLowerCase()in knownTags||e.isNode},module.exports.registerElement=function(e,t){var o=Object.getPrototypeOf(t.prototype),a=t,r=ANode&&o===ANode.prototype,n=AEntity&&o===AEntity.prototype;return(r||n)&&addTagName(e),r&&(a=wrapANodeMethods(t.prototype),a={prototype:Object.create(o,a)}),n&&(a=wrapAEntityMethods(t.prototype),a={prototype:Object.create(o,a)}),Object.getOwnPropertyNames(a.prototype).forEach(function(e){var t=a.prototype[e];"function"==typeof t&&(t.displayName=e)}),document.registerElement(e,a)},module.exports.wrapMethods=wrapMethods,ANode=_dereq_("./a-node"),AEntity=_dereq_("./a-entity");
  1938. },{"./a-entity":127,"./a-node":129,"document-register-element":12}],131:[function(_dereq_,module,exports){
  1939. function eventsBind(t,e){var i;for(i in e)t.events[i]=e[i].bind(t)}function copyData(t,e){var i,s;for(s in e)void 0!==e[s]&&(i=e[s],t[s]=isObjectOrArray(i)?utils.clone(i):i);return t}function extendProperties(t,e,i){var s;if(i&&e.constructor===Object){for(s in e)void 0!==e[s]&&(e[s]&&e[s].constructor===Object?t[s]=utils.clone(e[s]):t[s]=e[s]);return t}return e}function hasBehavior(t){return t.tick||t.tock}function wrapPause(t){return function(){var e=this.el.sceneEl;this.isPlaying&&(t.call(this),this.isPlaying=!1,this.eventsDetach(),hasBehavior(this)&&e.removeBehavior(this))}}function wrapPlay(t){return function(){var e=this.el.sceneEl,i=this.el.isPlaying&&!this.isPlaying;this.initialized&&i&&(t.call(this),this.isPlaying=!0,this.eventsAttach(),hasBehavior(this)&&e.addBehavior(this))}}function isObject(t){return t&&t.constructor===Object&&!(t instanceof window.HTMLElement)}function isObjectOrArray(t){return t&&(t.constructor===Object||t.constructor===Array)&&!(t instanceof window.HTMLElement)}var schema=_dereq_("./schema"),scenes=_dereq_("./scene/scenes"),systems=_dereq_("./system"),utils=_dereq_("../utils/"),components=module.exports.components={},parseProperties=schema.parseProperties,parseProperty=schema.parseProperty,processSchema=schema.process,isSingleProp=schema.isSingleProperty,stringifyProperties=schema.stringifyProperties,stringifyProperty=schema.stringifyProperty,styleParser=utils.styleParser,warn=utils.debug("core:component:warn"),aframeScript=document.currentScript,upperCaseRegExp=new RegExp("[A-Z]+"),objectPools={},Component=module.exports.Component=function(t,e,i){var s=this;this.el=t,this.id=i,this.attrName=this.name+(i?"__"+i:""),this.evtDetail={id:this.id,name:this.name},this.initialized=!1,this.isSingleProperty=isSingleProp(this.schema),this.isSinglePropertyObject=this.isSingleProperty&&isObject(parseProperty(void 0,this.schema))&&!(this.schema.default instanceof window.HTMLElement),this.isObjectBased=!this.isSingleProperty||this.isSinglePropertyObject,this.el.components[this.attrName]=this,this.objectPool=objectPools[this.name];const a=this.events;this.events={},eventsBind(this,a),this.attrValue=void 0,this.isObjectBased?(this.nextData=this.objectPool.use(),utils.objectPool.removeUnusedKeys(this.nextData,this.schema),this.oldData=this.objectPool.use(),utils.objectPool.removeUnusedKeys(this.oldData,this.schema),this.previousOldData=this.objectPool.use(),utils.objectPool.removeUnusedKeys(this.previousOldData,this.schema),this.parsingAttrValue=this.objectPool.use(),utils.objectPool.removeUnusedKeys(this.parsingAttrValue,this.schema)):(this.nextData=void 0,this.oldData=void 0,this.previousOldData=void 0,this.parsingAttrValue=void 0),this.throttledEmitComponentChanged=utils.throttle(function(){t.emit("componentchanged",s.evtDetail,!1)},200),this.updateProperties(e)};if(Component.prototype={schema:{},init:function(){},events:{},update:function(t){},updateSchema:void 0,tick:void 0,tock:void 0,play:function(){},pause:function(){},remove:function(){},parse:function(t,e){var i=this.schema;return this.isSingleProperty?parseProperty(t,i):parseProperties(styleParser.parse(t),i,!0,this.name,e)},stringify:function(t){var e=this.schema;return"string"==typeof t?t:this.isSingleProperty?stringifyProperty(t,e):(t=stringifyProperties(t,e),styleParser.stringify(t))},updateCachedAttrValue:function(t,e){var i,s,a;if(void 0!==t){if(null===t)return this.isObjectBased&&this.attrValue&&this.objectPool.recycle(this.attrValue),void(this.attrValue=void 0);if(t instanceof Object&&!(t instanceof window.HTMLElement)?(s=this.objectPool.use(),i=utils.extend(s,t)):i=this.parseAttrValueForCache(t),this.isObjectBased&&!e&&this.attrValue)for(a in this.attrValue)void 0===i[a]&&(i[a]=this.attrValue[a]);this.isObjectBased&&!this.attrValue&&(this.attrValue=this.objectPool.use()),utils.objectPool.clearObject(this.attrValue),this.attrValue=extendProperties(this.attrValue,i,this.isObjectBased),utils.objectPool.clearObject(s)}},parseAttrValueForCache:function(t){var e;return"string"!=typeof t?t:(this.isSingleProperty?"string"==typeof(e=this.schema.parse(t))&&(e=t):(utils.objectPool.clearObject(this.parsingAttrValue),e=styleParser.parse(t,this.parsingAttrValue)),e)},flushToDOM:function(t){var e=t?this.data:this.attrValue;null!==e&&void 0!==e&&window.HTMLElement.prototype.setAttribute.call(this.el,this.attrName,this.stringify(e))},updateProperties:function(t,e){if(!this.el.hasLoaded)return void this.updateCachedAttrValue(t);null!==t&&(t=this.parseAttrValueForCache(t)),this.updateCachedAttrValue(t,e),this.initialized?(this.updateComponent(t,e),this.callUpdateHandler()):this.initComponent()},initComponent:function(){var t,e=this.el;this.updateSchema&&this.updateSchema(this.buildData(this.attrValue,!1,!0)),this.data=this.buildData(this.attrValue),e.initializingComponents[this.name]||(e.initializingComponents[this.name]=!0,this.init(),this.initialized=!0,delete e.initializingComponents[this.name],this.oldData=extendProperties(this.oldData,this.data,this.isObjectBased),t=this.isObjectBased?this.objectPool.use():void 0,this.update(t),this.isObjectBased&&this.objectPool.recycle(t),e.isPlaying&&this.play(),e.emit("componentinitialized",this.evtDetail,!1))},updateComponent:function(t,e){var i,s;if(e)return this.updateSchema&&this.updateSchema(this.buildData(this.attrValue,!0,!0)),void(this.data=this.buildData(this.attrValue,!0,!1));if(this.isSingleProperty)return this.isObjectBased&&parseProperty(t,this.schema),void(this.data=t);if(parseProperties(t,this.schema,!0,this.name),this.schemaChangeKeys.length)for(i in t)if(this.schema[i].schemaChange){s=!0;break}if(s)return this.updateSchema&&this.updateSchema(this.buildData(this.attrValue,!0,!0)),void(this.data=this.buildData(this.attrValue,!0,!1));for(i in t)void 0!==t[i]&&(this.data[i]=t[i])},callUpdateHandler:function(){var t;this.previousOldData instanceof Object&&utils.objectPool.clearObject(this.previousOldData),this.isObjectBased?copyData(this.previousOldData,this.oldData):this.previousOldData=this.oldData,t=!utils.deepEqual(this.oldData,this.data),(this.isPositionRotationScale||t)&&(this.oldData instanceof Object&&utils.objectPool.clearObject(this.oldData),this.oldData=extendProperties(this.oldData,this.data,this.isObjectBased),this.update(this.previousOldData),this.throttledEmitComponentChanged())},handleMixinUpdate:function(){this.data=this.buildData(this.attrValue),this.callUpdateHandler()},resetProperty:function(t){if(this.isObjectBased){if(!(t in this.attrValue))return;delete this.attrValue[t],this.data[t]=this.schema[t].default}else this.attrValue=this.schema.default,this.data=this.schema.default;this.updateProperties(this.attrValue)},extendSchema:function(t){var e;e=utils.extend({},components[this.name].schema),utils.extend(e,t),this.schema=processSchema(e),this.el.emit("schemachanged",this.evtDetail)},buildData:function(t,e,i){var s,a,o,r,n,h,c,l=this.nextData,p=this.schema,u=this.el.mixinEls;if(s=t&&t.constructor===Array?t.length:void 0!==t&&null!==t,this.isObjectBased&&utils.objectPool.clearObject(l),this.isSingleProperty)a=this.isObjectBased?copyData(l,p.default):isObjectOrArray(p.default)?utils.clone(p.default):p.default;else{c=!e&&this.attrValue,a=c instanceof Object?copyData(l,c):l;for(r in p)o=p[r].default,void 0===a[r]&&(a[r]=isObjectOrArray(o)?utils.clone(o):o)}for(h=0;h<u.length;h++)(n=u[h].getAttribute(this.attrName))&&(a=extendProperties(a,n,this.isObjectBased));if(s){if(this.isSingleProperty)return isObject(t)?(copyData(this.parsingAttrValue,t),parseProperty(this.parsingAttrValue,p)):parseProperty(t,p);a=extendProperties(a,t,this.isObjectBased)}else if(this.isSingleProperty)return parseProperty(a,p);return parseProperties(a,p,void 0,this.name,i)},eventsAttach:function(){var t;this.eventsDetach();for(t in this.events)this.el.addEventListener(t,this.events[t])},eventsDetach:function(){var t;for(t in this.events)this.el.removeEventListener(t,this.events[t])},destroy:function(){this.objectPool.recycle(this.attrValue),this.objectPool.recycle(this.oldData),this.objectPool.recycle(this.parsingAttrValue),this.attrValue=this.oldData=this.parsingAttrValue=void 0}},window.debug)var registrationOrderWarnings=module.exports.registrationOrderWarnings={};module.exports.registerComponent=function(t,e){var i,s,a,o,r={};if(document.currentScript&&document.currentScript!==aframeScript&&scenes.forEach(function(e){e.hasLoaded||document.currentScript.compareDocumentPosition(e)!==Node.DOCUMENT_POSITION_FOLLOWING&&(warn("The component `"+t+"` was registered in a <script> tag after the scene. Component <script> tags in an HTML file should be declared *before* the scene such that the component is available to entities during scene initialization."),window.debug&&(registrationOrderWarnings[t]=!0))}),!0===upperCaseRegExp.test(t)&&warn("The component name `"+t+"` contains uppercase characters, but HTML will ignore the capitalization of attribute names. Change the name to be lowercase: `"+t.toLowerCase()+"`"),-1!==t.indexOf("__"))throw new Error("The component name `"+t+"` is not allowed. The sequence __ (double underscore) is reserved to specify an id for multiple components of the same type");if(Object.keys(e).forEach(function(t){r[t]={value:e[t],writable:!0}}),components[t])throw new Error("The component `"+t+"` has been already registered. Check that you are not loading two versions of the same component or two different components of the same name.");if(i=function(t,e,i){Component.call(this,t,e,i)},i.prototype=Object.create(Component.prototype,r),i.prototype.name=t,i.prototype.isPositionRotationScale="position"===t||"rotation"===t||"scale"===t,i.prototype.constructor=i,i.prototype.system=systems&&systems.systems[t],i.prototype.play=wrapPlay(i.prototype.play),i.prototype.pause=wrapPause(i.prototype.pause),a=utils.extend(processSchema(i.prototype.schema,i.prototype.name)),!(o=isSingleProp(i.prototype.schema))){i.prototype.schemaChangeKeys=[];for(s in a)a[s].schemaChange&&i.prototype.schemaChangeKeys.push(s)}return objectPools[t]=utils.objectPool.createPool(),components[t]={Component:i,dependencies:i.prototype.dependencies,isSingleProp:o,multiple:i.prototype.multiple,name:t,parse:i.prototype.parse,parseAttrValueForCache:i.prototype.parseAttrValueForCache,schema:a,stringify:i.prototype.stringify,type:i.prototype.type},i};
  1940. },{"../utils/":205,"./scene/scenes":138,"./schema":140,"./system":142}],132:[function(_dereq_,module,exports){
  1941. var schema=_dereq_("./schema"),processSchema=schema.process,geometries=module.exports.geometries={},geometryNames=module.exports.geometryNames=[],THREE=_dereq_("../lib/three"),Geometry=module.exports.Geometry=function(){};Geometry.prototype={schema:{},init:function(e){return this.geometry=new THREE.BufferGeometry,this.geometry},update:function(e){}},module.exports.registerGeometry=function(e,r){var t,o={};if(Object.keys(r).forEach(function(e){o[e]={value:r[e],writable:!0}}),geometries[e])throw new Error("The geometry `"+e+"` has been already registered");return t=function(){Geometry.call(this)},t.prototype=Object.create(Geometry.prototype,o),t.prototype.name=e,t.prototype.constructor=t,geometries[e]={Geometry:t,schema:processSchema(t.prototype.schema)},geometryNames.push(e),t};
  1942. },{"../lib/three":179,"./schema":140}],133:[function(_dereq_,module,exports){
  1943. function registerPropertyType(e,r,t,n){if("type"in propertyTypes)return void error("Property type "+e+" is already registered.");propertyTypes[e]={default:r,parse:t||defaultParse,stringify:n||defaultStringify}}function arrayParse(e){function r(e){return e.trim()}return Array.isArray(e)?e:e&&"string"==typeof e?e.split(",").map(r):[]}function arrayStringify(e){return e.join(", ")}function assetParse(e){var r,t;return"string"!=typeof e?e:(t=e.match(urlRegex),t?t[1]:"#"===e.charAt(0)?(r=document.getElementById(e.substring(1)))?"CANVAS"===r.tagName||"VIDEO"===r.tagName||"IMG"===r.tagName?r:r.getAttribute("src"):void warn('"'+e+'" asset not found.'):e)}function defaultParse(e){return e}function defaultStringify(e){return null===e?"null":e.toString()}function boolParse(e){return"false"!==e&&!1!==e}function intParse(e){return parseInt(e,10)}function numberParse(e){return parseFloat(e,10)}function selectorParse(e){return e?"string"!=typeof e?e:"#"!==e[0]||nonCharRegex.test(e)?document.querySelector(e):document.getElementById(e.substring(1)):null}function selectorAllParse(e){return e?"string"!=typeof e?e:Array.prototype.slice.call(document.querySelectorAll(e),0):null}function selectorStringify(e){return e.getAttribute?"#"+e.getAttribute("id"):defaultStringify(e)}function selectorAllStringify(e){return e instanceof Array?e.map(function(e){return"#"+e.getAttribute("id")}).join(", "):defaultStringify(e)}function srcParse(e){return warn("`src` property type is deprecated. Use `asset` instead."),assetParse(e)}function vecParse(e){return coordinates.parse(e,this.default)}function isValidDefaultValue(e,r){return("audio"!==e||"string"==typeof r)&&(!("array"===e&&!Array.isArray(r))&&(("asset"!==e||"string"==typeof r)&&(("boolean"!==e||"boolean"==typeof r)&&(("color"!==e||"string"==typeof r)&&(("int"!==e||"number"==typeof r)&&(("number"!==e||"number"==typeof r)&&(("map"!==e||"string"==typeof r)&&(("model"!==e||"string"==typeof r)&&(("selector"!==e||"string"==typeof r||null===r)&&(("selectorAll"!==e||"string"==typeof r||null===r)&&(("src"!==e||"string"==typeof r)&&(("string"!==e||"string"==typeof r)&&(("time"!==e||"number"==typeof r)&&("vec2"===e?isValidDefaultCoordinate(r,2):"vec3"===e?isValidDefaultCoordinate(r,3):"vec4"!==e||isValidDefaultCoordinate(r,4)))))))))))))))}function isValidDefaultCoordinate(e,r){if(null===e)return!0;if("object"!=typeof e)return!1;if(Object.keys(e).length!==r)return!1;var t=e.x,n=e.y,i=e.z,o=e.w;return"number"==typeof t&&"number"==typeof n&&(!(r>2&&"number"!=typeof i)&&!(r>3&&"number"!=typeof o))}var coordinates=_dereq_("../utils/coordinates"),debug=_dereq_("debug"),error=debug("core:propertyTypes:warn"),warn=debug("core:propertyTypes:warn"),propertyTypes=module.exports.propertyTypes={},nonCharRegex=/[,> .[\]:]/,urlRegex=/\url\((.+)\)/;registerPropertyType("audio","",assetParse),registerPropertyType("array",[],arrayParse,arrayStringify),registerPropertyType("asset","",assetParse),registerPropertyType("boolean",!1,boolParse),registerPropertyType("color","#FFF",defaultParse,defaultStringify),registerPropertyType("int",0,intParse),registerPropertyType("number",0,numberParse),registerPropertyType("map","",assetParse),registerPropertyType("model","",assetParse),registerPropertyType("selector",null,selectorParse,selectorStringify),registerPropertyType("selectorAll",null,selectorAllParse,selectorAllStringify),registerPropertyType("src","",srcParse),registerPropertyType("string","",defaultParse,defaultStringify),registerPropertyType("time",0,intParse),registerPropertyType("vec2",{x:0,y:0},vecParse,coordinates.stringify),registerPropertyType("vec3",{x:0,y:0,z:0},vecParse,coordinates.stringify),registerPropertyType("vec4",{x:0,y:0,z:0,w:1},vecParse,coordinates.stringify),module.exports.registerPropertyType=registerPropertyType,module.exports.isValidDefaultValue=isValidDefaultValue,module.exports.isValidDefaultCoordinate=isValidDefaultCoordinate;
  1944. },{"../utils/coordinates":200,"debug":8}],134:[function(_dereq_,module,exports){
  1945. function getCanvasSize(e,t,i,s){return e.parentElement?t?{height:e.parentElement.offsetHeight,width:e.parentElement.offsetWidth}:getMaxSize(i,s):{height:0,width:0}}function getMaxSize(e,t){var i,s,n=window.devicePixelRatio;return s={height:document.body.offsetHeight,width:document.body.offsetWidth},!e||t||-1===e.width&&-1===e.height?s:s.width*n<e.width&&s.height*n<e.height?s:(i=s.width/s.height,s.width*n>e.width&&-1!==e.width&&(s.width=Math.round(e.width/n),s.height=Math.round(e.width/i/n)),s.height*n>e.height&&-1!==e.height&&(s.height=Math.round(e.height/n),s.width=Math.round(e.height*i/n)),s)}function requestFullscreen(e){(e.requestFullscreen||e.webkitRequestFullscreen||e.mozRequestFullScreen||e.msRequestFullscreen).apply(e,[{navigationUI:"hide"}])}function exitFullscreen(){(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement)&&(document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen())}function setupCanvas(e){function t(){document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||e.exitVR(),document.activeElement.blur(),document.body.focus()}var i;i=document.createElement("canvas"),i.classList.add("a-canvas"),i.dataset.aframeCanvas=!0,e.appendChild(i),document.addEventListener("fullscreenchange",t),document.addEventListener("mozfullscreenchange",t),document.addEventListener("webkitfullscreenchange",t),document.addEventListener("MSFullscreenChange",t),i.addEventListener("touchmove",function(e){e.preventDefault()}),e.canvas=i,e.emit("render-target-loaded",{target:i}),setTimeout(bind(e.resize,e),0)}var initMetaTags=_dereq_("./metaTags").inject,initWakelock=_dereq_("./wakelock"),loadingScreen=_dereq_("./loadingScreen"),re=_dereq_("../a-register-element"),scenes=_dereq_("./scenes"),systems=_dereq_("../system").systems,THREE=_dereq_("../../lib/three"),utils=_dereq_("../../utils/"),AEntity=_dereq_("../a-entity"),ANode=_dereq_("../a-node"),initPostMessageAPI=_dereq_("./postMessage"),bind=utils.bind,isIOS=utils.device.isIOS(),isMobile=utils.device.isMobile(),isWebXRAvailable=utils.device.isWebXRAvailable,registerElement=re.registerElement,warn=utils.debug("core:a-scene:warn");isIOS&&_dereq_("../../utils/ios-orientationchange-blank-bug"),module.exports.AScene=registerElement("a-scene",{prototype:Object.create(AEntity.prototype,{createdCallback:{value:function(){this.clock=new THREE.Clock,this.isIOS=isIOS,this.isMobile=isMobile,this.hasWebXR=isWebXRAvailable,this.isAR=!1,this.isScene=!0,this.object3D=new THREE.Scene;var e=this;this.object3D.onAfterRender=function(t,i,s){e.isPlaying&&e.tock(e.time,e.delta,s)},this.resize=bind(this.resize,this),this.render=bind(this.render,this),this.systems={},this.systemNames=[],this.time=this.delta=0,this.behaviors={tick:[],tock:[]},this.hasLoaded=!1,this.isPlaying=!1,this.originalHTML=this.innerHTML,this.setAttribute("inspector",""),this.setAttribute("keyboard-shortcuts",""),this.setAttribute("screenshot",""),this.setAttribute("vr-mode-ui",""),this.setAttribute("device-orientation-permission-ui","")}},addFullScreenStyles:{value:function(){document.documentElement.classList.add("a-fullscreen")}},removeFullScreenStyles:{value:function(){document.documentElement.classList.remove("a-fullscreen")}},attachedCallback:{value:function(){var e=this,t=this.hasAttribute("embedded");setupCanvas(this),this.setupRenderer(),loadingScreen.setup(this,getCanvasSize),this.resize(),t||this.addFullScreenStyles(),initPostMessageAPI(this),initMetaTags(this),initWakelock(this),this.onVRPresentChangeBound=bind(this.onVRPresentChange,this),window.addEventListener("vrdisplaypresentchange",this.onVRPresentChangeBound),this.enterVRBound=function(){e.enterVR()},this.exitVRBound=function(){e.exitVR()},this.exitVRTrueBound=function(){e.exitVR(!0)},this.pointerRestrictedBound=function(){e.pointerRestricted()},this.pointerUnrestrictedBound=function(){e.pointerUnrestricted()},isWebXRAvailable||(window.addEventListener("vrdisplaydeactivate",this.exitVRBound),window.addEventListener("vrdisplaydisconnect",this.exitVRTrueBound),window.addEventListener("vrdisplaypointerrestricted",this.pointerRestrictedBound),window.addEventListener("vrdisplaypointerunrestricted",this.pointerUnrestrictedBound)),window.addEventListener("sessionend",this.resize),this.addEventListener("cameraready",function(){e.attachedCallbackPostCamera()}),this.initSystems(),this.hasWebXR&&navigator.xr&&navigator.xr.addEventListener&&navigator.xr.addEventListener("sessiongranted",function(){e.enterVR()})}},attachedCallbackPostCamera:{value:function(){var e=this;window.addEventListener("load",void 0),window.addEventListener("resize",function(){e.isIOS?setTimeout(e.resize,100):e.resize()}),this.play(),scenes.push(this)},writable:window.debug},initSystems:{value:function(){var e;this.initSystem("camera");for(e in systems)"camera"!==e&&this.initSystem(e)}},initSystem:{value:function(e){this.systems[e]||(this.systems[e]=new systems[e](this),this.systemNames.push(e))}},detachedCallback:{value:function(){var e=scenes.indexOf(this);scenes.splice(e,1),window.removeEventListener("vrdisplaypresentchange",this.onVRPresentChangeBound),window.removeEventListener("vrdisplayactivate",this.enterVRBound),window.removeEventListener("vrdisplaydeactivate",this.exitVRBound),window.removeEventListener("vrdisplayconnect",this.enterVRBound),window.removeEventListener("vrdisplaydisconnect",this.exitVRTrueBound),window.removeEventListener("vrdisplaypointerrestricted",this.pointerRestrictedBound),window.removeEventListener("vrdisplaypointerunrestricted",this.pointerUnrestrictedBound),window.removeEventListener("sessionend",this.resize),this.renderer.xr.dispose()}},addBehavior:{value:function(e){var t,i,s=this.behaviors;for(i in s)e[i]&&(t=this.behaviors[i],-1===t.indexOf(e)&&t.push(e))}},getPointerLockElement:{value:function(){return document.pointerLockElement},writable:window.debug},checkHeadsetConnected:{value:utils.device.checkHeadsetConnected,writable:window.debug},enterAR:{value:function(){var e;if(!this.hasWebXR)throw e="Failed to enter AR mode, WebXR not supported.",new Error(e);if(!utils.device.checkARSupport())throw e="Failed to enter AR, WebXR immersive-ar mode not supported in your browser or device.",new Error(e);return this.enterVR(!0)}},enterVR:{value:function(e){function t(t){var i;window.hasNativeWebVRImplementation&&!window.hasNativeWebXRImplementation&&(i=new CustomEvent("vrdisplaypresentchange",{detail:{display:utils.device.getVRDisplay()}}),window.dispatchEvent(i)),e?r.addState("ar-mode"):r.addState("vr-mode"),r.emit("enter-vr",{target:r}),!isWebXRAvailable&&r.isMobile&&screen.orientation&&screen.orientation.lock&&screen.orientation.lock("landscape"),r.addFullScreenStyles(),r.isMobile||r.checkHeadsetConnected()||requestFullscreen(r.canvas),r.renderer.setAnimationLoop(r.render),r.resize(),t&&t()}function i(e){throw r.removeState("vr-mode"),e&&e.message?new Error("Failed to enter VR mode (`requestPresent`): "+e.message):new Error("Failed to enter VR mode (`requestPresent`).")}var s,n,r=this,a=r.renderer.xr;if(this.is("vr-mode"))return Promise.resolve("Already in VR.");if(this.checkHeadsetConnected()||this.isMobile){if(a.enabled=!0,this.hasWebXR){this.xrSession&&this.xrSession.removeEventListener("end",this.exitVRBound);var o=this.sceneEl.systems.webxr.sessionReferenceSpaceType;a.setReferenceSpaceType(o);var d=e?"immersive-ar":"immersive-vr";return n=this.sceneEl.systems.webxr.sessionConfiguration,new Promise(function(e,i){navigator.xr.requestSession(d,n).then(function(i){r.xrSession=i,a.layersEnabled=-1!==n.requiredFeatures.indexOf("layers"),a.setSession(i),i.addEventListener("end",r.exitVRBound),t(e)},function(e){var t="immersive-ar"===d,i=t?"AR":"VR";throw new Error("Failed to enter "+i+" mode (`requestSession`) "+e)})})}if(s=utils.device.getVRDisplay(),a.setDevice(s),s.isPresenting&&!window.hasNativeWebVRImplementation)return t(),Promise.resolve();var h=this.getAttribute("renderer"),c={highRefreshRate:h.highRefreshRate,foveationLevel:h.foveationLevel};return s.requestPresent([{source:this.canvas,attributes:c}]).then(t,i)}return t(),Promise.resolve()},writable:!0},exitVR:{value:function(){function e(){s.removeState("vr-mode"),s.removeState("ar-mode"),s.isMobile&&screen.orientation&&screen.orientation.unlock&&screen.orientation.unlock(),s.hasAttribute("embedded")&&s.removeFullScreenStyles(),s.resize(),s.isIOS&&utils.forceCanvasResizeSafariMobile(s.canvas),s.renderer.setPixelRatio(window.devicePixelRatio),s.emit("exit-vr",{target:s})}function t(e){throw e&&e.message?new Error("Failed to exit VR mode (`exitPresent`): "+e.message):new Error("Failed to exit VR mode (`exitPresent`).")}var i,s=this,n=this.renderer.xr;if(!this.is("vr-mode")&&!this.is("ar-mode"))return Promise.resolve("Not in immersive mode.");if(this.checkHeadsetConnected()||this.isMobile){if(n.enabled=!1,i=utils.device.getVRDisplay(),this.hasWebXR)this.xrSession.removeEventListener("end",this.exitVRBound),this.xrSession.end().then(function(){},function(){}),this.xrSession=void 0,n.setSession(null);else if(i.isPresenting)return i.exitPresent().then(e,t)}else exitFullscreen();return e(),Promise.resolve()},writable:!0},pointerRestricted:{value:function(){if(this.canvas){var e=this.getPointerLockElement();e&&e!==this.canvas&&document.exitPointerLock&&document.exitPointerLock(),this.canvas.requestPointerLock&&this.canvas.requestPointerLock()}}},pointerUnrestricted:{value:function(){var e=this.getPointerLockElement();e&&e===this.canvas&&document.exitPointerLock&&document.exitPointerLock()}},onVRPresentChange:{value:function(e){var t=e.display||e.detail.display;if(t&&t.isPresenting)return void this.enterVR();this.exitVR()}},getAttribute:{value:function(e){var t=this.systems[e];return t?t.data:AEntity.prototype.getAttribute.call(this,e)}},getComputedAttribute:{value:function(e){warn("`getComputedAttribute` is deprecated. Use `getAttribute` instead."),this.getAttribute(e)}},getDOMAttribute:{value:function(e){var t=this.systems[e];return t?t.data:AEntity.prototype.getDOMAttribute.call(this,e)}},setAttribute:{value:function(e,t,i){var s=this.systems[e];if(s)return ANode.prototype.setAttribute.call(this,e,t),void s.updateProperties(t);AEntity.prototype.setAttribute.call(this,e,t,i)}},removeBehavior:{value:function(e){var t,i,s,n=this.behaviors;for(i in n)e[i]&&(t=this.behaviors[i],-1!==(s=t.indexOf(e))&&t.splice(s,1))}},resize:{value:function(){var e,t,i,s=this.camera,n=this.canvas,r=this.renderer.xr.isPresenting;t=this.renderer.xr.enabled&&r,!s||!n||this.is("vr-mode")&&(this.isMobile||t)||(e=this.getAttribute("embedded")&&!this.is("vr-mode"),i=getCanvasSize(n,e,this.maxCanvasSize,this.is("vr-mode")),s.aspect=i.width/i.height,s.updateProjectionMatrix(),this.renderer.setSize(i.width,i.height,!1),this.emit("rendererresize",null,!1))},writable:!0},setupRenderer:{value:function(){var e,t,i,s,n=this;s={alpha:!0,antialias:!isMobile,canvas:this.canvas,logarithmicDepthBuffer:!1,powerPreference:"high-performance"},this.maxCanvasSize={height:1920,width:1920},this.hasAttribute("renderer")&&(i=this.getAttribute("renderer"),t=utils.styleParser.parse(i),t.precision&&(s.precision=t.precision+"p"),t.antialias&&"auto"!==t.antialias&&(s.antialias="true"===t.antialias),t.logarithmicDepthBuffer&&"auto"!==t.logarithmicDepthBuffer&&(s.logarithmicDepthBuffer="true"===t.logarithmicDepthBuffer),t.alpha&&(s.alpha="true"===t.alpha),this.maxCanvasSize={width:t.maxCanvasWidth?parseInt(t.maxCanvasWidth):this.maxCanvasSize.width,height:t.maxCanvasHeight?parseInt(t.maxCanvasHeight):this.maxCanvasSize.height}),e=this.renderer=new THREE.WebGLRenderer(s),e.setPixelRatio(window.devicePixelRatio),e.sortObjects=!1,this.camera&&e.xr.setPoseTarget(this.camera.el.object3D),this.addEventListener("camera-set-active",function(){e.xr.setPoseTarget(n.camera.el.object3D)})},writable:window.debug},play:{value:function(){var e=this,t=this;if(this.renderStarted)return void AEntity.prototype.play.call(this);this.addEventListener("loaded",function(){var e,i=this.renderer,s=this.renderer.xr;AEntity.prototype.play.call(this),t.renderStarted||(t.resize(),t.renderer&&(window.performance&&window.performance.mark("render-started"),loadingScreen.remove(),e=utils.device.getVRDisplay(),e&&e.isPresenting&&(s.setDevice(e),s.enabled=!0,t.enterVR()),i.setAnimationLoop(this.render),t.renderStarted=!0,t.emit("renderstart")))}),setTimeout(function(){AEntity.prototype.load.call(e)})}},updateComponent:{value:function(e){e in systems||AEntity.prototype.updateComponent.apply(this,arguments)}},tick:{value:function(e,t){var i,s=this.systems;for(i=0;i<this.behaviors.tick.length;i++)this.behaviors.tick[i].el.isPlaying&&this.behaviors.tick[i].tick(e,t);for(i=0;i<this.systemNames.length;i++)s[this.systemNames[i]].tick&&s[this.systemNames[i]].tick(e,t)}},tock:{value:function(e,t,i){var s,n=this.systems;for(s=0;s<this.behaviors.tock.length;s++)this.behaviors.tock[s].el.isPlaying&&this.behaviors.tock[s].tock(e,t,i);for(s=0;s<this.systemNames.length;s++)n[this.systemNames[s]].tock&&n[this.systemNames[s]].tock(e,t,i)}},render:{value:function(e,t){var i=this.renderer;this.frame=t,this.delta=1e3*this.clock.getDelta(),this.time=1e3*this.clock.elapsedTime,this.isPlaying&&this.tick(this.time,this.delta);var s=null;this.is("ar-mode")&&(s=this.object3D.background,this.object3D.background=null),i.render(this.object3D,this.camera),s&&(this.object3D.background=s)},writable:!0}})}),module.exports.setupCanvas=setupCanvas;
  1946. },{"../../lib/three":179,"../../utils/":205,"../../utils/ios-orientationchange-blank-bug":206,"../a-entity":127,"../a-node":129,"../a-register-element":130,"../system":142,"./loadingScreen":135,"./metaTags":136,"./postMessage":137,"./scenes":138,"./wakelock":139}],135:[function(_dereq_,module,exports){
  1947. function resize(e){var t=sceneEl.hasAttribute("embedded"),i=getSceneCanvasSize(sceneEl.canvas,t,sceneEl.maxCanvasSize,sceneEl.is("vr-mode"));e.aspect=i.width/i.height,e.updateProjectionMatrix(),sceneEl.renderer.setSize(i.width,i.height,!1)}function setupTitle(){titleEl=document.createElement("div"),titleEl.className=LOADER_TITLE_CLASS,titleEl.innerHTML=document.title,titleEl.style.display="none",sceneEl.appendChild(titleEl)}var utils=_dereq_("../../utils/"),styleParser=utils.styleParser,sceneEl,titleEl,getSceneCanvasSize,ATTR_NAME="loading-screen",LOADER_TITLE_CLASS="a-loader-title";module.exports.setup=function(e,t){sceneEl=e,getSceneCanvasSize=t;var i,n,s,l,r,o,a,d,E,c,u=sceneEl.hasAttribute(ATTR_NAME)?styleParser.parse(sceneEl.getAttribute(ATTR_NAME)):void 0,T=u&&u.dotsColor||"white",v=u&&u.backgroundColor||"#24CAFF",p=void 0===u||"true"===u.enabled||void 0===u.enabled;p&&(i=new THREE.Scene,n=new THREE.SphereGeometry(.2,36,18,0,2*Math.PI,0,Math.PI),s=new THREE.MeshBasicMaterial({color:T}),l=new THREE.Mesh(n,s),r=l.clone(),o=l.clone(),a=new THREE.PerspectiveCamera(80,window.innerWidth/window.innerHeight,5e-4,1e4),d=new THREE.Clock,E=0,c=function(){sceneEl.renderer.render(i,a),E=d.getElapsedTime()%4,l.visible=E>=1,r.visible=E>=2,o.visible=E>=3},i.background=new THREE.Color(v),i.add(a),l.position.set(-1,0,-15),r.position.set(0,0,-15),o.position.set(1,0,-15),a.add(l),a.add(r),a.add(o),setupTitle(),setTimeout(function(){sceneEl.hasLoaded||(resize(a),titleEl.style.display="block",window.addEventListener("resize",function(){resize(a)}),sceneEl.renderer.setAnimationLoop(c))},200))},module.exports.remove=function(){window.removeEventListener("resize",resize),titleEl&&(titleEl.style.display="none")};
  1948. },{"../../utils/":205}],136:[function(_dereq_,module,exports){
  1949. function Meta(e){return{tagName:"meta",attributes:e,exists:function(){return document.querySelector('meta[name="'+e.name+'"]')}}}function Link(e){return{tagName:"link",attributes:e,exists:function(){return document.querySelector('link[rel="'+e.rel+'"]')}}}function createTag(e){if(e&&e.tagName){var t=document.createElement(e.tagName);return t.setAttribute(constants.AFRAME_INJECTED,""),extend(t,e.attributes)}}var constants=_dereq_("../../constants/"),extend=_dereq_("../../utils").extend,MOBILE_HEAD_TAGS=module.exports.MOBILE_HEAD_TAGS=[Meta({name:"viewport",content:"width=device-width,initial-scale=1,maximum-scale=1,shrink-to-fit=no,user-scalable=no,minimal-ui,viewport-fit=cover"}),Meta({name:"mobile-web-app-capable",content:"yes"}),Meta({name:"theme-color",content:"black"})],MOBILE_IOS_HEAD_TAGS=[Meta({name:"apple-mobile-web-app-capable",content:"yes"}),Meta({name:"apple-mobile-web-app-status-bar-style",content:"black"}),Link({rel:"apple-touch-icon",href:"https://aframe.io/images/aframe-logo-152.png"})];module.exports.inject=function(e){function t(e){e&&!e.exists()&&(a=createTag(e))&&(r?r.parentNode.insertBefore(a,r):n.appendChild(a),i.push(a))}var a,n=document.head,r=n.querySelector("script"),i=[];return MOBILE_HEAD_TAGS.forEach(t),e.isIOS&&MOBILE_IOS_HEAD_TAGS.forEach(t),i};
  1950. },{"../../constants/":123,"../../utils":205}],137:[function(_dereq_,module,exports){
  1951. function postMessageAPIHandler(e){var a=this;if(e.data)switch(e.data.type){case"vr":switch(e.data.data){case"enter":a.enterVR();break;case"exit":a.exitVR()}}}var bind=_dereq_("../../utils/bind"),isIframed=_dereq_("../../utils/").isIframed;module.exports=function(e){isIframed()&&window.addEventListener("message",bind(postMessageAPIHandler,e))};
  1952. },{"../../utils/":205,"../../utils/bind":199}],138:[function(_dereq_,module,exports){
  1953. module.exports=[];
  1954. },{}],139:[function(_dereq_,module,exports){
  1955. var Wakelock=_dereq_("../../../vendor/wakelock/wakelock");module.exports=function(e){if(e.isMobile){var n=e.wakelock=new Wakelock;e.addEventListener("enter-vr",function(){n.request()}),e.addEventListener("exit-vr",function(){n.release()})}};
  1956. },{"../../../vendor/wakelock/wakelock":220}],140:[function(_dereq_,module,exports){
  1957. function isSingleProperty(r){return"type"in r?"string"==typeof r.type:"default"in r}function processPropertyDefinition(r,e){var t,o,n=r.default,p=r.type;return r.type?"bool"===r.type?p="boolean":"float"===r.type&&(p="number"):p=void 0===n||"boolean"!=typeof n&&"number"!=typeof n?Array.isArray(n)?"array":"string":typeof n,o=propertyTypes[p],o||warn("Unknown property type for component `"+e+"`: "+p),t=!!r.parse,r.parse=r.parse||o.parse,r.stringify=r.stringify||o.stringify,r.type=p,"default"in r?t||isValidDefaultValue(p,n)||warn("Default value `"+n+"` does not match type `"+p+"` in component `"+e+"`"):r.default=o.default,r}function parseProperty(r,e){return void 0!==r&&null!==r&&""!==r||(r=e.default,Array.isArray(r)&&(r=r.slice())),e.parse(r,e.default)}function stringifyProperty(r,e){return"object"!=typeof r?r:e&&null!==r?e.stringify(r):JSON.stringify(r)}var utils=_dereq_("../utils/"),PropertyTypes=_dereq_("./propertyTypes"),debug=utils.debug,isValidDefaultValue=PropertyTypes.isValidDefaultValue,propertyTypes=PropertyTypes.propertyTypes,warn=debug("core:schema:warn");module.exports.isSingleProperty=isSingleProperty,module.exports.process=function(r,e){var t;if(isSingleProperty(r))return processPropertyDefinition(r,e);for(t in r)r[t]=processPropertyDefinition(r[t],e);return r},module.exports.processPropertyDefinition=processPropertyDefinition,module.exports.parseProperties=function(){var r=[];return function(e,t,o,n,p){var i,s,y,u;r.length=0;for(s in o?e:t)o&&void 0===e[s]||r.push(s);if(null===e||"object"!=typeof e)return e;for(s in e)void 0===e[s]||t[s]||p||warn("Unknown property `"+s+"` for component/system `"+n+"`.");for(i=0;i<r.length;i++){if(s=r[i],y=t[s],u=e[s],!t[s])return;e[s]=parseProperty(u,y)}return e}}(),module.exports.parseProperty=parseProperty,module.exports.stringifyProperties=function(r,e){var t,o,n,p,i={};for(t in r)o=e[t],n=r[t],p=n,"object"==typeof p&&(p=stringifyProperty(n,o),o||warn("Unknown component property: "+t)),i[t]=p;return i},module.exports.stringifyProperty=stringifyProperty;
  1958. },{"../utils/":205,"./propertyTypes":133}],141:[function(_dereq_,module,exports){
  1959. var schema=_dereq_("./schema"),processSchema=schema.process,shaders=module.exports.shaders={},shaderNames=module.exports.shaderNames=[],THREE=_dereq_("../lib/three"),utils=_dereq_("../utils"),propertyToThreeMapping={array:"v3",color:"v3",int:"i",number:"f",map:"t",time:"f",vec2:"v2",vec3:"v3",vec4:"v4"},Shader=module.exports.Shader=function(){};Shader.prototype={schema:{},vertexShader:"void main() {gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);}",fragmentShader:"void main() {gl_FragColor = vec4(1.0, 0.0, 1.0, 1.0);}",init:function(e){return this.attributes=this.initVariables(e,"attribute"),this.uniforms=this.initVariables(e,"uniform"),this.material=new(this.raw?THREE.RawShaderMaterial:THREE.ShaderMaterial)({uniforms:this.uniforms,vertexShader:this.vertexShader,fragmentShader:this.fragmentShader}),this.material},initVariables:function(e,r){var t,a,i=this.schema,s={};for(t in i)i[t].is===r&&(a=propertyToThreeMapping[i[t].type],s[t]={type:a,value:void 0});return s},update:function(e){this.updateVariables(e,"attribute"),this.updateVariables(e,"uniform")},updateVariables:function(e,r){var t,a,i,s=this.schema;i="uniform"===r?this.uniforms:this.attributes;for(t in e)if(s[t]&&s[t].is===r)if("map"!==s[t].type)i[t].value=this.parseValue(s[t].type,e[t]),i[t].needsUpdate=!0;else{if(!i[t]||i[t].value===e[t])continue;a="_texture_"+t,this.setMapOnTextureLoad(i,t,a),utils.material.updateMapMaterialFromData(a,t,this,e)}},parseValue:function(e,r){var t;switch(e){case"vec2":return new THREE.Vector2(r.x,r.y);case"vec3":return new THREE.Vector3(r.x,r.y,r.z);case"vec4":return new THREE.Vector4(r.x,r.y,r.z,r.w);case"color":return t=new THREE.Color(r),new THREE.Vector3(t.r,t.g,t.b);case"map":return THREE.ImageUtils.loadTexture(r);default:return r}},setMapOnTextureLoad:function(e,r,t){var a=this;this.el.addEventListener("materialtextureloaded",function(){e[r].value=a.material[t],e[r].needsUpdate=!0})}},module.exports.registerShader=function(e,r){var t,a={};if(Object.keys(r).forEach(function(e){a[e]={value:r[e],writable:!0}}),shaders[e])throw new Error("The shader "+e+" has been already registered");return t=function(){Shader.call(this)},t.prototype=Object.create(Shader.prototype,a),t.prototype.name=e,t.prototype.constructor=t,shaders[e]={Shader:t,schema:processSchema(t.prototype.schema)},shaderNames.push(e),t};
  1960. },{"../lib/three":179,"../utils":205,"./schema":140}],142:[function(_dereq_,module,exports){
  1961. var components=_dereq_("./component"),schema=_dereq_("./schema"),utils=_dereq_("../utils/"),parseProperties=schema.parseProperties,parseProperty=schema.parseProperty,processSchema=schema.process,isSingleProp=schema.isSingleProperty,styleParser=utils.styleParser,systems=module.exports.systems={},System=module.exports.System=function(e){var t=components&&components.components[this.name];this.el=e,this.sceneEl=e,t&&(t.Component.prototype.system=this),this.buildData(),this.init(),this.update({})};System.prototype={schema:{},init:function(){},update:function(e){},updateProperties:function(e){var t=this.data;Object.keys(schema).length&&(this.buildData(e),this.update(t))},buildData:function(e){var t=this.schema;Object.keys(t).length&&(e=e||window.HTMLElement.prototype.getAttribute.call(this.sceneEl,this.name),isSingleProp(t)?this.data=parseProperty(e,t):this.data=parseProperties(styleParser.parse(e)||{},t))},tick:void 0,tock:void 0,play:function(){},pause:function(){}},module.exports.registerSystem=function(e,t){var s,o,r={},i=utils.findAllScenes(document);if(Object.keys(t).forEach(function(e){r[e]={value:t[e],writable:!0}}),systems[e])throw new Error("The system `"+e+"` has been already registered. Check that you are not loading two versions of the same system or two different systems of the same name.");for(o=function(e){System.call(this,e)},o.prototype=Object.create(System.prototype,r),o.prototype.name=e,o.prototype.constructor=o,o.prototype.schema=utils.extend(processSchema(o.prototype.schema)),systems[e]=o,s=0;s<i.length;s++)i[s].initSystem(e)};
  1962. },{"../utils/":205,"./component":131,"./schema":140}],143:[function(_dereq_,module,exports){
  1963. _dereq_("./pivot");
  1964. },{"./pivot":144}],144:[function(_dereq_,module,exports){
  1965. var registerComponent=_dereq_("../../core/component").registerComponent,THREE=_dereq_("../../lib/three"),originalPosition=new THREE.Vector3,originalRotation=new THREE.Vector3;registerComponent("pivot",{dependencies:["position"],schema:{type:"vec3"},init:function(){var o=this.data,i=this.el,t=i.object3D.parent,e=i.object3D,n=new THREE.Group;originalPosition.copy(e.position),originalRotation.copy(e.rotation),t.remove(e),n.add(e),t.add(n),i.object3D=n,e.position.set(-1*o.x,-1*o.y,-1*o.z),n.position.set(o.x+originalPosition.x,o.y+originalPosition.y,o.z+originalPosition.z),n.rotation.copy(e.rotation),e.rotation.set(0,0,0)}});
  1966. },{"../../core/component":131,"../../lib/three":179}],145:[function(_dereq_,module,exports){
  1967. function addMapping(e){var a=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();"fog"===e&&(a="material-fog"),"visible"===e&&(a="material-visible"),materialMappings[a]="material."+e}var components=_dereq_("../../core/component").components,shaders=_dereq_("../../core/shader").shaders,utils=_dereq_("../../utils/"),materialMappings={};Object.keys(components.material.schema).forEach(addMapping),Object.keys(shaders.standard.schema).forEach(addMapping),module.exports=function(){return{defaultComponents:{material:{}},mappings:utils.extend({},materialMappings)}};
  1968. },{"../../core/component":131,"../../core/shader":141,"../../utils/":205}],146:[function(_dereq_,module,exports){
  1969. _dereq_("./primitives/a-camera"),_dereq_("./primitives/a-cursor"),_dereq_("./primitives/a-curvedimage"),_dereq_("./primitives/a-gltf-model"),_dereq_("./primitives/a-image"),_dereq_("./primitives/a-light"),_dereq_("./primitives/a-link"),_dereq_("./primitives/a-obj-model"),_dereq_("./primitives/a-sky"),_dereq_("./primitives/a-sound"),_dereq_("./primitives/a-text"),_dereq_("./primitives/a-video"),_dereq_("./primitives/a-videosphere"),_dereq_("./primitives/meshPrimitives");
  1970. },{"./primitives/a-camera":148,"./primitives/a-cursor":149,"./primitives/a-curvedimage":150,"./primitives/a-gltf-model":151,"./primitives/a-image":152,"./primitives/a-light":153,"./primitives/a-link":154,"./primitives/a-obj-model":155,"./primitives/a-sky":156,"./primitives/a-sound":157,"./primitives/a-text":158,"./primitives/a-video":159,"./primitives/a-videosphere":160,"./primitives/meshPrimitives":161}],147:[function(_dereq_,module,exports){
  1971. function addComponentMapping(e,t){var i=components[e].schema;Object.keys(i).map(function(i){var n=i.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();void 0!==t[n]&&(n=e+"-"+i),t[n]=e+"."+i})}function definePrimitive(e,t,i){i=i||{},Object.keys(t).map(function(e){addComponentMapping(e,i)}),module.exports.registerPrimitive(e,utils.extendDeep({},null,{defaultComponents:t,mappings:i}))}var AEntity=_dereq_("../../core/a-entity"),components=_dereq_("../../core/component").components,registerElement=_dereq_("../../core/a-register-element").registerElement,utils=_dereq_("../../utils/"),debug=utils.debug,setComponentProperty=utils.entity.setComponentProperty,log=debug("extras:primitives:debug"),warn=debug("extras:primitives:warn"),primitives=module.exports.primitives={};module.exports.registerPrimitive=function(e,t){e=e.toLowerCase(),log("Registering <%s>",e),t.defaultAttributes&&warn("The 'defaultAttributes' object is deprecated. Use 'defaultComponents' instead.");var i=registerElement(e,{prototype:Object.create(AEntity.prototype,{defaultComponentsFromPrimitive:{value:t.defaultComponents||t.defaultAttributes||{}},deprecated:{value:t.deprecated||null},deprecatedMappings:{value:t.deprecatedMappings||{}},mappings:{value:t.mappings||{}},createdCallback:{value:function(){t.deprecated&&console.warn(t.deprecated),this.resolveMappingCollisions()}},resolveMappingCollisions:{value:function(){var e=this.mappings,t=this;Object.keys(e).forEach(function(i){var n;i!==i.toLowerCase()&&warn("Mapping keys should be specified in lower case. The mapping key "+i+" may not be recognized"),components[i]&&(n=e[i].replace(".","-"),e[n]=e[i],delete e[i],console.warn("The primitive "+t.tagName.toLowerCase()+" has a mapping collision. The attribute "+i+" has the same name as a registered component and has been renamed to "+n))})}},getExtraComponents:{value:function(){function e(e,r){return t(e)?i(r):t(r)?i(e):n(e)&&n(r)?utils.extendDeep(e,r):i(r)}function t(e){return void 0===e}function i(e){return n(e)?utils.extendDeep({},e):e}function n(e){return null!==e&&e.constructor===Object}var r,o,a,s,p,u,l=this;for(o=utils.clone(this.defaultComponentsFromPrimitive),p=this.getAttribute("mixin"),p&&(p=p.trim().split(" "),p.forEach(function(t){var i=l.sceneEl.querySelector("#"+t).componentCache;Object.keys(i).forEach(function(t){o[t]=e(o[t],i[t])})})),a=0;a<this.attributes.length;a++)r=this.attributes[a],(s=this.mappings[r.name])&&(u=utils.entity.getComponentPropertyPath(s),u.constructor===Array?(o[u[0]]=o[u[0]]||{},o[u[0]][u[1]]=r.value.trim()):o[u]=r.value.trim());return o}},attributeChangedCallback:{value:function(e,t,i){var n=this.mappings[e];e in this.deprecatedMappings&&console.warn(this.deprecatedMappings[e]),e&&n&&setComponentProperty(this,n,i)}}})});return primitives[e]=i,i},module.exports.definePrimitive=definePrimitive;
  1972. },{"../../core/a-entity":127,"../../core/a-register-element":130,"../../core/component":131,"../../utils/":205}],148:[function(_dereq_,module,exports){
  1973. var registerPrimitive=_dereq_("../primitives").registerPrimitive;registerPrimitive("a-camera",{defaultComponents:{camera:{},"look-controls":{},"wasd-controls":{},position:{x:0,y:1.6,z:0}},mappings:{active:"camera.active",far:"camera.far",fov:"camera.fov","look-controls-enabled":"look-controls.enabled",near:"camera.near","pointer-lock-enabled":"look-controls.pointerLockEnabled","wasd-controls-enabled":"wasd-controls.enabled","reverse-mouse-drag":"look-controls.reverseMouseDrag",zoom:"camera.zoom"}});
  1974. },{"../primitives":147}],149:[function(_dereq_,module,exports){
  1975. var getMeshMixin=_dereq_("../getMeshMixin"),registerPrimitive=_dereq_("../primitives").registerPrimitive,utils=_dereq_("../../../utils/");registerPrimitive("a-cursor",utils.extendDeep({},getMeshMixin(),{defaultComponents:{cursor:{},geometry:{primitive:"ring",radiusOuter:.016,radiusInner:.01,segmentsTheta:32},material:{color:"#000",shader:"flat",opacity:.8},position:{x:0,y:0,z:-1}},mappings:{far:"raycaster.far",fuse:"cursor.fuse","fuse-timeout":"cursor.fuseTimeout",interval:"raycaster.interval",objects:"raycaster.objects"}}));
  1976. },{"../../../utils/":205,"../getMeshMixin":145,"../primitives":147}],150:[function(_dereq_,module,exports){
  1977. var getMeshMixin=_dereq_("../getMeshMixin"),registerPrimitive=_dereq_("../primitives").registerPrimitive,utils=_dereq_("../../../utils/");registerPrimitive("a-curvedimage",utils.extendDeep({},getMeshMixin(),{defaultComponents:{geometry:{height:1,primitive:"cylinder",radius:2,segmentsRadial:48,thetaLength:270,openEnded:!0,thetaStart:0},material:{color:"#FFF",shader:"flat",side:"double",transparent:!0,repeat:"-1 1"}},mappings:{height:"geometry.height","open-ended":"geometry.openEnded",radius:"geometry.radius",segments:"geometry.segmentsRadial",start:"geometry.thetaStart","theta-length":"geometry.thetaLength","theta-start":"geometry.thetaStart",width:"geometry.thetaLength"}}));
  1978. },{"../../../utils/":205,"../getMeshMixin":145,"../primitives":147}],151:[function(_dereq_,module,exports){
  1979. var registerPrimitive=_dereq_("../primitives").registerPrimitive;registerPrimitive("a-gltf-model",{mappings:{src:"gltf-model"}});
  1980. },{"../primitives":147}],152:[function(_dereq_,module,exports){
  1981. var getMeshMixin=_dereq_("../getMeshMixin"),registerPrimitive=_dereq_("../primitives").registerPrimitive,utils=_dereq_("../../../utils/");registerPrimitive("a-image",utils.extendDeep({},getMeshMixin(),{defaultComponents:{geometry:{primitive:"plane"},material:{color:"#FFF",shader:"flat",side:"double",transparent:!0}},mappings:{height:"geometry.height",width:"geometry.width"}}));
  1982. },{"../../../utils/":205,"../getMeshMixin":145,"../primitives":147}],153:[function(_dereq_,module,exports){
  1983. var registerPrimitive=_dereq_("../primitives").registerPrimitive;registerPrimitive("a-light",{defaultComponents:{light:{}},mappings:{angle:"light.angle",color:"light.color","ground-color":"light.groundColor",decay:"light.decay",distance:"light.distance",intensity:"light.intensity",penumbra:"light.penumbra",type:"light.type",target:"light.target"}});
  1984. },{"../primitives":147}],154:[function(_dereq_,module,exports){
  1985. var registerPrimitive=_dereq_("../primitives").registerPrimitive;registerPrimitive("a-link",{defaultComponents:{link:{visualAspectEnabled:!0}},mappings:{href:"link.href",image:"link.image",title:"link.title"}});
  1986. },{"../primitives":147}],155:[function(_dereq_,module,exports){
  1987. var meshMixin=_dereq_("../getMeshMixin")(),registerPrimitive=_dereq_("../primitives").registerPrimitive,utils=_dereq_("../../../utils/");registerPrimitive("a-obj-model",utils.extendDeep({},meshMixin,{defaultComponents:{"obj-model":{}},mappings:{src:"obj-model.obj",mtl:"obj-model.mtl"}}));
  1988. },{"../../../utils/":205,"../getMeshMixin":145,"../primitives":147}],156:[function(_dereq_,module,exports){
  1989. var getMeshMixin=_dereq_("../getMeshMixin"),registerPrimitive=_dereq_("../primitives").registerPrimitive,utils=_dereq_("../../../utils/"),meshPrimitives=_dereq_("./meshPrimitives");registerPrimitive("a-sky",utils.extendDeep({},getMeshMixin(),{defaultComponents:{geometry:{primitive:"sphere",radius:500,segmentsWidth:64,segmentsHeight:32},material:{color:"#FFF",side:"back",shader:"flat",npot:!0},scale:"-1 1 1"},mappings:utils.extendDeep({},meshPrimitives["a-sphere"].prototype.mappings)}));
  1990. },{"../../../utils/":205,"../getMeshMixin":145,"../primitives":147,"./meshPrimitives":161}],157:[function(_dereq_,module,exports){
  1991. var registerPrimitive=_dereq_("../primitives").registerPrimitive;registerPrimitive("a-sound",{defaultComponents:{sound:{}},mappings:{src:"sound.src",on:"sound.on",autoplay:"sound.autoplay",loop:"sound.loop",volume:"sound.volume"}});
  1992. },{"../primitives":147}],158:[function(_dereq_,module,exports){
  1993. var definePrimitive=_dereq_("../primitives").definePrimitive;definePrimitive("a-text",{text:{anchor:"align",width:5}});
  1994. },{"../primitives":147}],159:[function(_dereq_,module,exports){
  1995. var getMeshMixin=_dereq_("../getMeshMixin"),registerPrimitive=_dereq_("../primitives").registerPrimitive,utils=_dereq_("../../../utils/");registerPrimitive("a-video",utils.extendDeep({},getMeshMixin(),{defaultComponents:{geometry:{primitive:"plane"},material:{color:"#FFF",shader:"flat",side:"double",transparent:!0}},mappings:{height:"geometry.height",width:"geometry.width"}}));
  1996. },{"../../../utils/":205,"../getMeshMixin":145,"../primitives":147}],160:[function(_dereq_,module,exports){
  1997. var getMeshMixin=_dereq_("../getMeshMixin"),registerPrimitive=_dereq_("../primitives").registerPrimitive,utils=_dereq_("../../../utils/");registerPrimitive("a-videosphere",utils.extendDeep({},getMeshMixin(),{defaultComponents:{geometry:{primitive:"sphere",radius:500,segmentsWidth:64,segmentsHeight:32},material:{color:"#FFF",shader:"flat",side:"back",npot:!0},scale:"-1 1 1"},mappings:{radius:"geometry.radius","segments-height":"geometry.segmentsHeight","segments-width":"geometry.segmentsWidth"}}));
  1998. },{"../../../utils/":205,"../getMeshMixin":145,"../primitives":147}],161:[function(_dereq_,module,exports){
  1999. function unCamelCase(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}var getMeshMixin=_dereq_("../getMeshMixin"),geometries=_dereq_("../../../core/geometry").geometries,geometryNames=_dereq_("../../../core/geometry").geometryNames,registerPrimitive=_dereq_("../primitives").registerPrimitive,utils=_dereq_("../../../utils/"),meshPrimitives=module.exports={};geometryNames.forEach(function(e){var i=geometries[e],r=unCamelCase(e),t={};Object.keys(i.schema).forEach(function(e){t[unCamelCase(e)]="geometry."+e});var m="a-"+r,s=registerPrimitive(m,utils.extendDeep({},getMeshMixin(),{defaultComponents:{geometry:{primitive:e}},mappings:t}));meshPrimitives[m]=s});
  2000. },{"../../../core/geometry":132,"../../../utils/":205,"../getMeshMixin":145,"../primitives":147}],162:[function(_dereq_,module,exports){
  2001. var registerGeometry=_dereq_("../core/geometry").registerGeometry,THREE=_dereq_("../lib/three");registerGeometry("box",{schema:{depth:{default:1,min:0},height:{default:1,min:0},width:{default:1,min:0},segmentsHeight:{default:1,min:1,max:20,type:"int"},segmentsWidth:{default:1,min:1,max:20,type:"int"},segmentsDepth:{default:1,min:1,max:20,type:"int"}},init:function(e){this.geometry=new THREE.BoxGeometry(e.width,e.height,e.depth,e.segmentsWidth,e.segmentsHeight,e.segmentsDepth)}});
  2002. },{"../core/geometry":132,"../lib/three":179}],163:[function(_dereq_,module,exports){
  2003. var registerGeometry=_dereq_("../core/geometry").registerGeometry,THREE=_dereq_("../lib/three"),degToRad=THREE.Math.degToRad;registerGeometry("circle",{schema:{radius:{default:1,min:0},segments:{default:32,min:3,type:"int"},thetaLength:{default:360,min:0},thetaStart:{default:0}},init:function(e){this.geometry=new THREE.CircleGeometry(e.radius,e.segments,degToRad(e.thetaStart),degToRad(e.thetaLength))}});
  2004. },{"../core/geometry":132,"../lib/three":179}],164:[function(_dereq_,module,exports){
  2005. var registerGeometry=_dereq_("../core/geometry").registerGeometry,THREE=_dereq_("../lib/three"),degToRad=THREE.Math.degToRad;registerGeometry("cone",{schema:{height:{default:1,min:0},openEnded:{default:!1},radiusBottom:{default:1,min:0},radiusTop:{default:.01,min:0},segmentsHeight:{default:18,min:1,type:"int"},segmentsRadial:{default:36,min:3,type:"int"},thetaLength:{default:360,min:0},thetaStart:{default:0}},init:function(e){this.geometry=new THREE.CylinderGeometry(e.radiusTop,e.radiusBottom,e.height,e.segmentsRadial,e.segmentsHeight,e.openEnded,degToRad(e.thetaStart),degToRad(e.thetaLength))}});
  2006. },{"../core/geometry":132,"../lib/three":179}],165:[function(_dereq_,module,exports){
  2007. var registerGeometry=_dereq_("../core/geometry").registerGeometry,THREE=_dereq_("../lib/three"),degToRad=THREE.Math.degToRad;registerGeometry("cylinder",{schema:{height:{default:1,min:0},openEnded:{default:!1},radius:{default:1,min:0},segmentsHeight:{default:18,min:1,type:"int"},segmentsRadial:{default:36,min:3,type:"int"},thetaLength:{default:360,min:0},thetaStart:{default:0}},init:function(e){this.geometry=new THREE.CylinderGeometry(e.radius,e.radius,e.height,e.segmentsRadial,e.segmentsHeight,e.openEnded,degToRad(e.thetaStart),degToRad(e.thetaLength))}});
  2008. },{"../core/geometry":132,"../lib/three":179}],166:[function(_dereq_,module,exports){
  2009. var registerGeometry=_dereq_("../core/geometry").registerGeometry,THREE=_dereq_("../lib/three");registerGeometry("dodecahedron",{schema:{detail:{default:0,min:0,max:5,type:"int"},radius:{default:1,min:0}},init:function(e){this.geometry=new THREE.DodecahedronGeometry(e.radius,e.detail)}});
  2010. },{"../core/geometry":132,"../lib/three":179}],167:[function(_dereq_,module,exports){
  2011. var registerGeometry=_dereq_("../core/geometry").registerGeometry,THREE=_dereq_("../lib/three");registerGeometry("icosahedron",{schema:{detail:{default:0,min:0,max:5,type:"int"},radius:{default:1,min:0}},init:function(e){this.geometry=new THREE.IcosahedronGeometry(e.radius,e.detail)}});
  2012. },{"../core/geometry":132,"../lib/three":179}],168:[function(_dereq_,module,exports){
  2013. _dereq_("./box.js"),_dereq_("./circle.js"),_dereq_("./cone.js"),_dereq_("./cylinder.js"),_dereq_("./dodecahedron.js"),_dereq_("./icosahedron.js"),_dereq_("./octahedron.js"),_dereq_("./plane.js"),_dereq_("./ring.js"),_dereq_("./sphere.js"),_dereq_("./tetrahedron.js"),_dereq_("./torus.js"),_dereq_("./torusKnot.js"),_dereq_("./triangle.js");
  2014. },{"./box.js":162,"./circle.js":163,"./cone.js":164,"./cylinder.js":165,"./dodecahedron.js":166,"./icosahedron.js":167,"./octahedron.js":169,"./plane.js":170,"./ring.js":171,"./sphere.js":172,"./tetrahedron.js":173,"./torus.js":174,"./torusKnot.js":175,"./triangle.js":176}],169:[function(_dereq_,module,exports){
  2015. var registerGeometry=_dereq_("../core/geometry").registerGeometry,THREE=_dereq_("../lib/three");registerGeometry("octahedron",{schema:{detail:{default:0,min:0,max:5,type:"int"},radius:{default:1,min:0}},init:function(e){this.geometry=new THREE.OctahedronGeometry(e.radius,e.detail)}});
  2016. },{"../core/geometry":132,"../lib/three":179}],170:[function(_dereq_,module,exports){
  2017. var registerGeometry=_dereq_("../core/geometry").registerGeometry,THREE=_dereq_("../lib/three");registerGeometry("plane",{schema:{height:{default:1,min:0},width:{default:1,min:0},segmentsHeight:{default:1,min:1,max:20,type:"int"},segmentsWidth:{default:1,min:1,max:20,type:"int"}},init:function(e){this.geometry=new THREE.PlaneGeometry(e.width,e.height,e.segmentsWidth,e.segmentsHeight)}});
  2018. },{"../core/geometry":132,"../lib/three":179}],171:[function(_dereq_,module,exports){
  2019. var registerGeometry=_dereq_("../core/geometry").registerGeometry,THREE=_dereq_("../lib/three"),degToRad=THREE.Math.degToRad;registerGeometry("ring",{schema:{radiusInner:{default:.8,min:0},radiusOuter:{default:1.2,min:0},segmentsPhi:{default:10,min:1,type:"int"},segmentsTheta:{default:32,min:3,type:"int"},thetaLength:{default:360,min:0},thetaStart:{default:0}},init:function(e){this.geometry=new THREE.RingGeometry(e.radiusInner,e.radiusOuter,e.segmentsTheta,e.segmentsPhi,degToRad(e.thetaStart),degToRad(e.thetaLength))}});
  2020. },{"../core/geometry":132,"../lib/three":179}],172:[function(_dereq_,module,exports){
  2021. var registerGeometry=_dereq_("../core/geometry").registerGeometry,THREE=_dereq_("../lib/three"),degToRad=THREE.Math.degToRad;registerGeometry("sphere",{schema:{radius:{default:1,min:0},phiLength:{default:360},phiStart:{default:0,min:0},thetaLength:{default:180,min:0},thetaStart:{default:0},segmentsHeight:{default:18,min:2,type:"int"},segmentsWidth:{default:36,min:3,type:"int"}},init:function(e){this.geometry=new THREE.SphereGeometry(e.radius,e.segmentsWidth,e.segmentsHeight,degToRad(e.phiStart),degToRad(e.phiLength),degToRad(e.thetaStart),degToRad(e.thetaLength))}});
  2022. },{"../core/geometry":132,"../lib/three":179}],173:[function(_dereq_,module,exports){
  2023. var registerGeometry=_dereq_("../core/geometry").registerGeometry,THREE=_dereq_("../lib/three");registerGeometry("tetrahedron",{schema:{detail:{default:0,min:0,max:5,type:"int"},radius:{default:1,min:0}},init:function(e){this.geometry=new THREE.TetrahedronGeometry(e.radius,e.detail)}});
  2024. },{"../core/geometry":132,"../lib/three":179}],174:[function(_dereq_,module,exports){
  2025. var registerGeometry=_dereq_("../core/geometry").registerGeometry,THREE=_dereq_("../lib/three"),degToRad=THREE.Math.degToRad;registerGeometry("torus",{schema:{arc:{default:360},radius:{default:1,min:0},radiusTubular:{default:.2,min:0},segmentsRadial:{default:36,min:2,type:"int"},segmentsTubular:{default:32,min:3,type:"int"}},init:function(e){this.geometry=new THREE.TorusGeometry(e.radius,2*e.radiusTubular,e.segmentsRadial,e.segmentsTubular,degToRad(e.arc))}});
  2026. },{"../core/geometry":132,"../lib/three":179}],175:[function(_dereq_,module,exports){
  2027. var registerGeometry=_dereq_("../core/geometry").registerGeometry,THREE=_dereq_("../lib/three");registerGeometry("torusKnot",{schema:{p:{default:2,min:1},q:{default:3,min:1},radius:{default:1,min:0},radiusTubular:{default:.2,min:0},segmentsRadial:{default:8,min:3,type:"int"},segmentsTubular:{default:100,min:3,type:"int"}},init:function(e){this.geometry=new THREE.TorusKnotGeometry(e.radius,2*e.radiusTubular,e.segmentsTubular,e.segmentsRadial,e.p,e.q)}});
  2028. },{"../core/geometry":132,"../lib/three":179}],176:[function(_dereq_,module,exports){
  2029. var registerGeometry=_dereq_("../core/geometry").registerGeometry,THREE=_dereq_("../lib/three"),quaternion=new THREE.Quaternion,rotateVector=new THREE.Vector3(0,0,1),uvMinVector=new THREE.Vector2,uvMaxVector=new THREE.Vector2,uvScaleVector=new THREE.Vector2;registerGeometry("triangle",{schema:{vertexA:{type:"vec3",default:{x:0,y:.5,z:0}},vertexB:{type:"vec3",default:{x:-.5,y:-.5,z:0}},vertexC:{type:"vec3",default:{x:.5,y:-.5,z:0}}},init:function(e){var t,r,o,n,c,a,i,u,x;o=new THREE.Triangle,o.a.set(e.vertexA.x,e.vertexA.y,e.vertexA.z),o.b.set(e.vertexB.x,e.vertexB.y,e.vertexB.z),o.c.set(e.vertexC.x,e.vertexC.y,e.vertexC.z),r=o.getNormal(new THREE.Vector3),quaternion.setFromUnitVectors(r,rotateVector),n=o.a.clone().applyQuaternion(quaternion),c=o.b.clone().applyQuaternion(quaternion),a=o.c.clone().applyQuaternion(quaternion),uvMinVector.set(Math.min(n.x,c.x,a.x),Math.min(n.y,c.y,a.y)),uvMaxVector.set(Math.max(n.x,c.x,a.x),Math.max(n.y,c.y,a.y)),uvScaleVector.set(0,0).subVectors(uvMaxVector,uvMinVector),n=(new THREE.Vector2).subVectors(n,uvMinVector).divide(uvScaleVector),c=(new THREE.Vector2).subVectors(c,uvMinVector).divide(uvScaleVector),a=(new THREE.Vector2).subVectors(a,uvMinVector).divide(uvScaleVector),t=this.geometry=new THREE.BufferGeometry,i=[o.a.x,o.a.y,o.a.z,o.b.x,o.b.y,o.b.z,o.c.x,o.c.y,o.c.z],u=[r.x,r.y,r.z,r.x,r.y,r.z,r.x,r.y,r.z],x=[n.x,n.y,c.x,c.y,a.x,a.y],t.setAttribute("position",new THREE.Float32BufferAttribute(i,3)),t.setAttribute("normal",new THREE.Float32BufferAttribute(u,3)),t.setAttribute("uv",new THREE.Float32BufferAttribute(x,2))}});
  2030. },{"../core/geometry":132,"../lib/three":179}],177:[function(_dereq_,module,exports){
  2031. if(window.Promise=window.Promise||_dereq_("promise-polyfill"),window.hasNativeWebVRImplementation=!!window.navigator.getVRDisplays||!!window.navigator.getVRDevices,window.hasNativeWebXRImplementation=void 0!==navigator.xr,!window.hasNativeWebXRImplementation&&!window.hasNativeWebVRImplementation){var isIOSOlderThan10=_dereq_("./utils/isIOSOlderThan10"),bufferScale=isIOSOlderThan10(window.navigator.userAgent)?1/window.devicePixelRatio:1,WebVRPolyfill=_dereq_("webvr-polyfill"),polyfillConfig={BUFFER_SCALE:bufferScale,CARDBOARD_UI_DISABLED:!0,ROTATE_INSTRUCTIONS_DISABLED:!0,MOBILE_WAKE_LOCK:!!window.cordova};window.webvrpolyfill=new WebVRPolyfill(polyfillConfig)}var utils=_dereq_("./utils/"),debug=utils.debug;utils.isIE11&&(_dereq_("custom-event-polyfill"),_dereq_("../vendor/starts-with-polyfill"));var error=debug("A-Frame:error"),warn=debug("A-Frame:warn");window.document.currentScript&&window.document.currentScript.parentNode!==window.document.head&&!window.debug&&warn("Put the A-Frame <script> tag in the <head> of the HTML *before* the scene to ensure everything for A-Frame is properly registered before they are used from HTML."),window.cordova||"file:"!==window.location.protocol||error("This HTML file is currently being served via the file:// protocol. Assets, textures, and models WILL NOT WORK due to cross-origin policy! Please use a local or hosted server: https://aframe.io/docs/0.5.0/introduction/getting-started.html#using-a-local-server."),_dereq_("present"),utils.device.isBrowserEnvironment&&(_dereq_("./style/aframe.css"),_dereq_("./style/rStats.css"));var AScene=_dereq_("./core/scene/a-scene").AScene,components=_dereq_("./core/component").components,registerComponent=_dereq_("./core/component").registerComponent,registerGeometry=_dereq_("./core/geometry").registerGeometry,registerPrimitive=_dereq_("./extras/primitives/primitives").registerPrimitive,registerShader=_dereq_("./core/shader").registerShader,registerSystem=_dereq_("./core/system").registerSystem,shaders=_dereq_("./core/shader").shaders,systems=_dereq_("./core/system").systems,THREE=window.THREE=_dereq_("./lib/three"),pkg=_dereq_("../package");_dereq_("./components/index"),_dereq_("./geometries/index"),_dereq_("./shaders/index"),_dereq_("./systems/index");var ANode=_dereq_("./core/a-node"),AEntity=_dereq_("./core/a-entity");_dereq_("./core/a-assets"),_dereq_("./core/a-cubemap"),_dereq_("./core/a-mixin"),_dereq_("./extras/components/"),_dereq_("./extras/primitives/"),console.log("A-Frame Version: 1.2.0 (Date 2021-03-16, Commit #ccdc1065)"),console.log("THREE Version (https://github.com/supermedium/three.js):",pkg.dependencies["super-three"]),console.log("WebVR Polyfill Version:",pkg.dependencies["webvr-polyfill"]),module.exports=window.AFRAME={AComponent:_dereq_("./core/component").Component,AEntity:AEntity,ANode:ANode,ANIME:_dereq_("super-animejs"),AScene:AScene,components:components,coreComponents:Object.keys(components),geometries:_dereq_("./core/geometry").geometries,registerComponent:registerComponent,registerElement:_dereq_("./core/a-register-element").registerElement,registerGeometry:registerGeometry,registerPrimitive:registerPrimitive,registerShader:registerShader,registerSystem:registerSystem,primitives:{getMeshMixin:_dereq_("./extras/primitives/getMeshMixin"),primitives:_dereq_("./extras/primitives/primitives").primitives},scenes:_dereq_("./core/scene/scenes"),schema:_dereq_("./core/schema"),shaders:shaders,systems:systems,THREE:THREE,utils:utils,version:pkg.version};
  2032. },{"../package":73,"../vendor/starts-with-polyfill":218,"./components/index":84,"./core/a-assets":125,"./core/a-cubemap":126,"./core/a-entity":127,"./core/a-mixin":128,"./core/a-node":129,"./core/a-register-element":130,"./core/component":131,"./core/geometry":132,"./core/scene/a-scene":134,"./core/scene/scenes":138,"./core/schema":140,"./core/shader":141,"./core/system":142,"./extras/components/":143,"./extras/primitives/":146,"./extras/primitives/getMeshMixin":145,"./extras/primitives/primitives":147,"./geometries/index":168,"./lib/three":179,"./shaders/index":181,"./style/aframe.css":186,"./style/rStats.css":187,"./systems/index":191,"./utils/":205,"./utils/isIOSOlderThan10":208,"custom-event-polyfill":7,"present":48,"promise-polyfill":50,"super-animejs":56,"webvr-polyfill":68}],178:[function(_dereq_,module,exports){
  2033. window.aframeStats=function(t){function e(){i("te").set(n()),window.performance.getEntriesByName&&i("lt").set(window.performance.getEntriesByName("render-started")[0].startTime.toFixed(0))}function n(){var t=c.querySelectorAll("*");return Array.prototype.slice.call(t).filter(function(t){return t.isEntity}),t.length}function r(){}function a(){}function o(t){i=t}var i=null,c=t;return{update:e,start:r,end:a,attach:o,values:{te:{caption:"Entities"},lt:{caption:"Load Time"}},groups:[{caption:"A-Frame",values:["te","lt"]}],fractions:[]}},"object"==typeof module&&(module.exports={aframeStats:window.aframeStats});
  2034. },{}],179:[function(_dereq_,module,exports){
  2035. (function (global){
  2036. var THREE=global.THREE=_dereq_("super-three");THREE.TextureLoader&&(THREE.TextureLoader.prototype.crossOrigin="anonymous"),THREE.ImageLoader&&(THREE.ImageLoader.prototype.crossOrigin="anonymous"),THREE.Cache&&(THREE.Cache.enabled=!0),_dereq_("../../vendor/DeviceOrientationControls"),_dereq_("super-three/examples/js/loaders/DRACOLoader"),_dereq_("super-three/examples/js/loaders/GLTFLoader"),_dereq_("super-three/examples/js/loaders/OBJLoader"),_dereq_("super-three/examples/js/loaders/MTLLoader"),_dereq_("super-three/examples/js/utils/BufferGeometryUtils"),THREE.DRACOLoader.prototype.crossOrigin="anonymous",THREE.GLTFLoader.prototype.crossOrigin="anonymous",THREE.MTLLoader.prototype.crossOrigin="anonymous",THREE.OBJLoader.prototype.crossOrigin="anonymous",module.exports=THREE;
  2037. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  2038. },{"../../vendor/DeviceOrientationControls":215,"super-three":57,"super-three/examples/js/loaders/DRACOLoader":58,"super-three/examples/js/loaders/GLTFLoader":59,"super-three/examples/js/loaders/MTLLoader":60,"super-three/examples/js/loaders/OBJLoader":61,"super-three/examples/js/utils/BufferGeometryUtils":62}],180:[function(_dereq_,module,exports){
  2039. function getMaterialData(e,t){return t.color.set(e.color),t.fog=e.fog,t.wireframe=e.wireframe,t.wireframeLinewidth=e.wireframeLinewidth,t}var registerShader=_dereq_("../core/shader").registerShader,THREE=_dereq_("../lib/three"),utils=_dereq_("../utils/");module.exports.Shader=registerShader("flat",{schema:{color:{type:"color"},fog:{default:!0},height:{default:256},offset:{type:"vec2",default:{x:0,y:0}},repeat:{type:"vec2",default:{x:1,y:1}},src:{type:"map"},width:{default:512},wireframe:{default:!1},wireframeLinewidth:{default:2}},init:function(e){this.rendererSystem=this.el.sceneEl.systems.renderer,this.materialData={color:new THREE.Color},this.textureSrc=null,getMaterialData(e,this.materialData),this.rendererSystem.applyColorCorrection(this.materialData.color),this.material=new THREE.MeshBasicMaterial(this.materialData),utils.material.updateMap(this,e)},update:function(e){this.updateMaterial(e),utils.material.updateMap(this,e)},updateMaterial:function(e){var t;getMaterialData(e,this.materialData),this.rendererSystem.applyColorCorrection(this.materialData.color);for(t in this.materialData)this.material[t]=this.materialData[t]}});
  2040. },{"../core/shader":141,"../lib/three":179,"../utils/":205}],181:[function(_dereq_,module,exports){
  2041. _dereq_("./flat"),_dereq_("./standard"),_dereq_("./sdf"),_dereq_("./msdf"),_dereq_("./ios10hls");
  2042. },{"./flat":180,"./ios10hls":182,"./msdf":183,"./sdf":184,"./standard":185}],182:[function(_dereq_,module,exports){
  2043. var registerShader=_dereq_("../core/shader").registerShader;module.exports.Shader=registerShader("ios10hls",{schema:{src:{type:"map",is:"uniform"},opacity:{type:"number",is:"uniform",default:1}},vertexShader:["varying vec2 vUV;","void main(void) {"," gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);"," vUV = uv;","}"].join("\n"),fragmentShader:["uniform sampler2D src;","uniform float opacity;","varying vec2 vUV;","void main() {"," vec2 offset = vec2(0, 0);"," vec2 repeat = vec2(1, 1);"," vec4 color = texture2D(src, vec2(vUV.x / repeat.x + offset.x, (1.0 - vUV.y) / repeat.y + offset.y)).bgra;"," gl_FragColor = vec4(color.rgb, opacity);","}"].join("\n")});
  2044. },{"../core/shader":141}],183:[function(_dereq_,module,exports){
  2045. var registerShader=_dereq_("../core/shader").registerShader,isWebGL2AVailable=!!document.createElement("canvas").getContext("webgl2"),VERTEX_SHADER_WEBGL1=["attribute vec2 uv;","attribute vec3 position;","uniform mat4 projectionMatrix;","uniform mat4 modelViewMatrix;","varying vec2 vUV;","void main(void) {"," gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);"," vUV = uv;","}"].join("\n"),VERTEX_SHADER_WEBGL2=["#version 300 es","in vec2 uv;","in vec3 position;","uniform mat4 projectionMatrix;","uniform mat4 modelViewMatrix;","out vec2 vUV;","void main(void) {"," gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);"," vUV = uv;","}"].join("\n"),VERTEX_SHADER=isWebGL2AVailable?VERTEX_SHADER_WEBGL2:VERTEX_SHADER_WEBGL1,FRAGMENT_SHADER_WEBGL1=["#ifdef GL_OES_standard_derivatives","#extension GL_OES_standard_derivatives: enable","#endif","precision highp float;","uniform bool negate;","uniform float alphaTest;","uniform float opacity;","uniform sampler2D map;","uniform vec3 color;","varying vec2 vUV;","float median(float r, float g, float b) {"," return max(min(r, g), min(max(r, g), b));","}","#define BIG_ENOUGH 0.001","#define MODIFIED_ALPHATEST (0.02 * isBigEnough / BIG_ENOUGH)","void main() {"," vec3 sampleColor = texture2D(map, vUV).rgb;"," if (negate) { sampleColor = 1.0 - sampleColor; }"," float sigDist = median(sampleColor.r, sampleColor.g, sampleColor.b) - 0.5;"," float alpha = clamp(sigDist / fwidth(sigDist) + 0.5, 0.0, 1.0);"," float dscale = 0.353505;"," vec2 duv = dscale * (dFdx(vUV) + dFdy(vUV));"," float isBigEnough = max(abs(duv.x), abs(duv.y));"," // Do modified alpha test."," if (isBigEnough > BIG_ENOUGH) {"," float ratio = BIG_ENOUGH / isBigEnough;"," alpha = ratio * alpha + (1.0 - ratio) * (sigDist + 0.5);"," }"," // Do modified alpha test."," if (alpha < alphaTest * MODIFIED_ALPHATEST) { discard; return; }"," gl_FragColor = vec4(color.xyz, alpha * opacity);","}"].join("\n"),FRAGMENT_SHADER_WEBGL2=["#version 300 es","precision highp float;","uniform bool negate;","uniform float alphaTest;","uniform float opacity;","uniform sampler2D map;","uniform vec3 color;","in vec2 vUV;","out vec4 fragColor;","float median(float r, float g, float b) {"," return max(min(r, g), min(max(r, g), b));","}","#define BIG_ENOUGH 0.001","#define MODIFIED_ALPHATEST (0.02 * isBigEnough / BIG_ENOUGH)","void main() {"," vec3 sampleColor = texture(map, vUV).rgb;"," if (negate) { sampleColor = 1.0 - sampleColor; }"," float sigDist = median(sampleColor.r, sampleColor.g, sampleColor.b) - 0.5;"," float alpha = clamp(sigDist / fwidth(sigDist) + 0.5, 0.0, 1.0);"," float dscale = 0.353505;"," vec2 duv = dscale * (dFdx(vUV) + dFdy(vUV));"," float isBigEnough = max(abs(duv.x), abs(duv.y));"," // Do modified alpha test."," if (isBigEnough > BIG_ENOUGH) {"," float ratio = BIG_ENOUGH / isBigEnough;"," alpha = ratio * alpha + (1.0 - ratio) * (sigDist + 0.5);"," }"," // Do modified alpha test."," if (alpha < alphaTest * MODIFIED_ALPHATEST) { discard; return; }"," fragColor = vec4(color.xyz, alpha * opacity);","}"].join("\n"),FRAGMENT_SHADER=isWebGL2AVailable?FRAGMENT_SHADER_WEBGL2:FRAGMENT_SHADER_WEBGL1;module.exports.Shader=registerShader("msdf",{schema:{alphaTest:{type:"number",is:"uniform",default:.5},color:{type:"color",is:"uniform",default:"white"},map:{type:"map",is:"uniform"},negate:{type:"boolean",is:"uniform",default:!0},opacity:{type:"number",is:"uniform",default:1}},raw:!0,vertexShader:VERTEX_SHADER,fragmentShader:FRAGMENT_SHADER});
  2046. },{"../core/shader":141}],184:[function(_dereq_,module,exports){
  2047. var registerShader=_dereq_("../core/shader").registerShader,isWebGL2AVailable=!!document.createElement("canvas").getContext("webgl2"),VERTEX_SHADER_WEBGL1=["attribute vec2 uv;","attribute vec3 position;","uniform mat4 projectionMatrix;","uniform mat4 modelViewMatrix;","varying vec2 vUV;","void main(void) {"," gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);"," vUV = uv;","}"].join("\n"),VERTEX_SHADER_WEBGL2=["#version 300 es","in vec2 uv;","in vec3 position;","uniform mat4 projectionMatrix;","uniform mat4 modelViewMatrix;","out vec2 vUV;","void main(void) {"," gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);"," vUV = uv;","}"].join("\n"),VERTEX_SHADER=isWebGL2AVailable?VERTEX_SHADER_WEBGL2:VERTEX_SHADER_WEBGL1,FRAGMENT_SHADER_WEBGL1=["#ifdef GL_OES_standard_derivatives","#extension GL_OES_standard_derivatives: enable","#endif","precision highp float;","uniform float alphaTest;","uniform float opacity;","uniform sampler2D map;","uniform vec3 color;","varying vec2 vUV;","#ifdef GL_OES_standard_derivatives"," float contour(float width, float value) {"," return smoothstep(0.5 - value, 0.5 + value, width);"," }","#else"," float aastep(float value, float afwidth) {"," return smoothstep(0.5 - afwidth, 0.5 + afwidth, value);"," }","#endif","#define BIG_ENOUGH 0.001","#define MODIFIED_ALPHATEST (0.02 * isBigEnough / BIG_ENOUGH)","#define ALL_SMOOTH 0.4","#define ALL_ROUGH 0.02","#define DISCARD_ALPHA (alphaTest / (2.2 - 1.2 * ratio))","void main() {"," #ifdef GL_OES_standard_derivatives"," vec2 uv = vUV;"," vec4 texColor = texture2D(map, uv);"," float dist = texColor.a;"," float width = fwidth(dist);"," float alpha = contour(dist, width);"," float dscale = 0.353505;"," vec2 duv = dscale * (dFdx(uv) + dFdy(uv));"," float isBigEnough = max(abs(duv.x), abs(duv.y));"," if (isBigEnough > BIG_ENOUGH) {"," float ratio = BIG_ENOUGH / isBigEnough;"," alpha = ratio * alpha + (1.0 - ratio) * dist;"," }"," if (isBigEnough <= BIG_ENOUGH) {"," vec4 box = vec4 (uv - duv, uv + duv);"," alpha = (alpha + 0.5 * ("," contour(texture2D(map, box.xy).a, width)"," + contour(texture2D(map, box.zw).a, width)"," + contour(texture2D(map, box.xw).a, width)"," + contour(texture2D(map, box.zy).a, width)"," )) / 3.0;"," }"," if (alpha < alphaTest * MODIFIED_ALPHATEST) { discard; return; }"," #else"," vec4 texColor = texture2D(map, vUV);"," float value = texColor.a;"," float afwidth = (1.0 / 32.0) * (1.4142135623730951 / (2.0 * gl_FragCoord.w));"," float alpha = aastep(value, afwidth);"," float ratio = (gl_FragCoord.w >= ALL_SMOOTH) ? 1.0 : (gl_FragCoord.w < ALL_ROUGH) ? 0.0 : (gl_FragCoord.w - ALL_ROUGH) / (ALL_SMOOTH - ALL_ROUGH);"," if (alpha < alphaTest) { if (ratio >= 1.0) { discard; return; } alpha = 0.0; }"," alpha = alpha * ratio + (1.0 - ratio) * value;"," if (ratio < 1.0 && alpha <= DISCARD_ALPHA) { discard; return; }"," #endif"," gl_FragColor = vec4(color, opacity * alpha);","}"].join("\n"),FRAGMENT_SHADER_WEBGL2=["#version 300 es","precision highp float;","uniform float alphaTest;","uniform float opacity;","uniform sampler2D map;","uniform vec3 color;","in vec2 vUV;","out vec4 fragColor;","#ifdef GL_OES_standard_derivatives"," float contour(float width, float value) {"," return smoothstep(0.5 - value, 0.5 + value, width);"," }","#else"," float aastep(float value, float afwidth) {"," return smoothstep(0.5 - afwidth, 0.5 + afwidth, value);"," }","#endif","#define BIG_ENOUGH 0.001","#define MODIFIED_ALPHATEST (0.02 * isBigEnough / BIG_ENOUGH)","#define ALL_SMOOTH 0.4","#define ALL_ROUGH 0.02","#define DISCARD_ALPHA (alphaTest / (2.2 - 1.2 * ratio))","void main() {"," #ifdef GL_OES_standard_derivatives"," vec2 uv = vUV;"," vec4 texColor = texture(map, uv);"," float dist = texColor.a;"," float width = fwidth(dist);"," float alpha = contour(dist, width);"," float dscale = 0.353505;"," vec2 duv = dscale * (dFdx(uv) + dFdy(uv));"," float isBigEnough = max(abs(duv.x), abs(duv.y));"," if (isBigEnough > BIG_ENOUGH) {"," float ratio = BIG_ENOUGH / isBigEnough;"," alpha = ratio * alpha + (1.0 - ratio) * dist;"," }"," if (isBigEnough <= BIG_ENOUGH) {"," vec4 box = vec4 (uv - duv, uv + duv);"," alpha = (alpha + 0.5 * ("," contour(texture(map, box.xy).a, width)"," + contour(texture(map, box.zw).a, width)"," + contour(texture(map, box.xw).a, width)"," + contour(texture(map, box.zy).a, width)"," )) / 3.0;"," }"," if (alpha < alphaTest * MODIFIED_ALPHATEST) { discard; return; }"," #else"," vec4 texColor = texture(map, vUV);"," float value = texColor.a;"," float afwidth = (1.0 / 32.0) * (1.4142135623730951 / (2.0 * gl_FragCoord.w));"," float alpha = aastep(value, afwidth);"," float ratio = (gl_FragCoord.w >= ALL_SMOOTH) ? 1.0 : (gl_FragCoord.w < ALL_ROUGH) ? 0.0 : (gl_FragCoord.w - ALL_ROUGH) / (ALL_SMOOTH - ALL_ROUGH);"," if (alpha < alphaTest) { if (ratio >= 1.0) { discard; return; } alpha = 0.0; }"," alpha = alpha * ratio + (1.0 - ratio) * value;"," if (ratio < 1.0 && alpha <= DISCARD_ALPHA) { discard; return; }"," #endif"," fragColor = vec4(color, opacity * alpha);","}"].join("\n"),FRAGMENT_SHADER=isWebGL2AVailable?FRAGMENT_SHADER_WEBGL2:FRAGMENT_SHADER_WEBGL1;module.exports.Shader=registerShader("sdf",{schema:{alphaTest:{type:"number",is:"uniform",default:.5},color:{type:"color",is:"uniform",default:"white"},map:{type:"map",is:"uniform"},opacity:{type:"number",is:"uniform",default:1}},raw:!0,vertexShader:VERTEX_SHADER,fragmentShader:FRAGMENT_SHADER});
  2048. },{"../core/shader":141}],185:[function(_dereq_,module,exports){
  2049. function getMaterialData(e,t){return t.color.set(e.color),t.emissive.set(e.emissive),t.emissiveIntensity=e.emissiveIntensity,t.fog=e.fog,t.metalness=e.metalness,t.roughness=e.roughness,t.wireframe=e.wireframe,t.wireframeLinewidth=e.wireframeLinewidth,e.normalMap&&(t.normalScale=e.normalScale),e.ambientOcclusionMap&&(t.aoMapIntensity=e.ambientOcclusionMapIntensity),e.displacementMap&&(t.displacementScale=e.displacementScale,t.displacementBias=e.displacementBias),t}var registerShader=_dereq_("../core/shader").registerShader,THREE=_dereq_("../lib/three"),utils=_dereq_("../utils/"),CubeLoader=new THREE.CubeTextureLoader,texturePromises={};module.exports.Shader=registerShader("standard",{schema:{ambientOcclusionMap:{type:"map"},ambientOcclusionMapIntensity:{default:1},ambientOcclusionTextureOffset:{type:"vec2"},ambientOcclusionTextureRepeat:{type:"vec2",default:{x:1,y:1}},color:{type:"color"},displacementMap:{type:"map"},displacementScale:{default:1},displacementBias:{default:.5},displacementTextureOffset:{type:"vec2"},displacementTextureRepeat:{type:"vec2",default:{x:1,y:1}},emissive:{type:"color",default:"#000"},emissiveIntensity:{default:1},envMap:{default:""},fog:{default:!0},height:{default:256},metalness:{default:0,min:0,max:1},metalnessMap:{type:"map"},metalnessTextureOffset:{type:"vec2"},metalnessTextureRepeat:{type:"vec2",default:{x:1,y:1}},normalMap:{type:"map"},normalScale:{type:"vec2",default:{x:1,y:1}},normalTextureOffset:{type:"vec2"},normalTextureRepeat:{type:"vec2",default:{x:1,y:1}},offset:{type:"vec2",default:{x:0,y:0}},repeat:{type:"vec2",default:{x:1,y:1}},roughness:{default:.5,min:0,max:1},roughnessMap:{type:"map"},roughnessTextureOffset:{type:"vec2"},roughnessTextureRepeat:{type:"vec2",default:{x:1,y:1}},sphericalEnvMap:{type:"map"},src:{type:"map"},width:{default:512},wireframe:{default:!1},wireframeLinewidth:{default:2}},init:function(e){this.rendererSystem=this.el.sceneEl.systems.renderer,this.materialData={color:new THREE.Color,emissive:new THREE.Color},getMaterialData(e,this.materialData),this.rendererSystem.applyColorCorrection(this.materialData.color),this.rendererSystem.applyColorCorrection(this.materialData.emissive),this.material=new THREE.MeshStandardMaterial(this.materialData),utils.material.updateMap(this,e),e.normalMap&&utils.material.updateDistortionMap("normal",this,e),e.displacementMap&&utils.material.updateDistortionMap("displacement",this,e),e.ambientOcclusionMap&&utils.material.updateDistortionMap("ambientOcclusion",this,e),e.metalnessMap&&utils.material.updateDistortionMap("metalness",this,e),e.roughnessMap&&utils.material.updateDistortionMap("roughness",this,e),this.updateEnvMap(e)},update:function(e){this.updateMaterial(e),utils.material.updateMap(this,e),e.normalMap&&utils.material.updateDistortionMap("normal",this,e),e.displacementMap&&utils.material.updateDistortionMap("displacement",this,e),e.ambientOcclusionMap&&utils.material.updateDistortionMap("ambientOcclusion",this,e),e.metalnessMap&&utils.material.updateDistortionMap("metalness",this,e),e.roughnessMap&&utils.material.updateDistortionMap("roughness",this,e),this.updateEnvMap(e)},updateMaterial:function(e){var t,a=this.material;getMaterialData(e,this.materialData),this.rendererSystem.applyColorCorrection(this.materialData.color),this.rendererSystem.applyColorCorrection(this.materialData.emissive);for(t in this.materialData)a[t]=this.materialData[t]},updateEnvMap:function(e){var t=this,a=this.material,i=e.envMap,s=e.sphericalEnvMap;return!i&&!s||this.isLoadingEnvMap?(a.envMap=null,void(a.needsUpdate=!0)):(this.isLoadingEnvMap=!0,s?void this.el.sceneEl.systems.material.loadTexture(s,{src:s},function(e){t.isLoadingEnvMap=!1,e.mapping=THREE.EquirectangularReflectionMapping,a.envMap=e,utils.material.handleTextureEvents(t.el,e),a.needsUpdate=!0}):texturePromises[i]?void texturePromises[i].then(function(e){t.isLoadingEnvMap=!1,a.envMap=e,utils.material.handleTextureEvents(t.el,e),a.needsUpdate=!0}):void(texturePromises[i]=new Promise(function(e){utils.srcLoader.validateCubemapSrc(i,function(i){CubeLoader.load(i,function(i){t.isLoadingEnvMap=!1,a.envMap=i,utils.material.handleTextureEvents(t.el,i),e(i)})})})))}});
  2050. },{"../core/shader":141,"../lib/three":179,"../utils/":205}],186:[function(_dereq_,module,exports){
  2051. var css = "html.a-fullscreen{bottom:0;left:0;position:fixed;right:0;top:0}html.a-fullscreen body{height:100%;margin:0;overflow:hidden;padding:0;width:100%}html.a-fullscreen .a-canvas{width:100%!important;height:100%!important;top:0!important;left:0!important;right:0!important;bottom:0!important;position:fixed!important}html:not(.a-fullscreen) .a-enter-ar,html:not(.a-fullscreen) .a-enter-vr{right:5px;bottom:5px}:-webkit-full-screen{background-color:transparent}.a-hidden{display:none!important}.a-canvas{height:100%;left:0;position:absolute;top:0;width:100%}.a-canvas.a-grab-cursor:hover{cursor:grab;cursor:-moz-grab;cursor:-webkit-grab}canvas.a-canvas.a-mouse-cursor-hover:hover{cursor:pointer}.a-inspector-loader{background-color:#ed3160;position:fixed;left:3px;top:3px;padding:6px 10px;color:#fff;text-decoration:none;font-size:12px;font-family:Roboto,sans-serif;text-align:center;z-index:99999;width:204px}@keyframes dots-1{from{opacity:0}25%{opacity:1}}@keyframes dots-2{from{opacity:0}50%{opacity:1}}@keyframes dots-3{from{opacity:0}75%{opacity:1}}@-webkit-keyframes dots-1{from{opacity:0}25%{opacity:1}}@-webkit-keyframes dots-2{from{opacity:0}50%{opacity:1}}@-webkit-keyframes dots-3{from{opacity:0}75%{opacity:1}}.a-inspector-loader .dots span{animation:dots-1 2s infinite steps(1);-webkit-animation:dots-1 2s infinite steps(1)}.a-inspector-loader .dots span:first-child+span{animation-name:dots-2;-webkit-animation-name:dots-2}.a-inspector-loader .dots span:first-child+span+span{animation-name:dots-3;-webkit-animation-name:dots-3}a-scene{display:block;position:relative;height:100%;width:100%}a-assets,a-scene audio,a-scene img,a-scene video{display:none}.a-enter-vr-modal,.a-orientation-modal{font-family:Consolas,Andale Mono,Courier New,monospace}.a-enter-vr-modal a{border-bottom:1px solid #fff;padding:2px 0;text-decoration:none;transition:.1s color ease-in}.a-enter-vr-modal a:hover{background-color:#fff;color:#111;padding:2px 4px;position:relative;left:-4px}.a-enter-ar,.a-enter-vr{font-family:sans-serif,monospace;font-size:13px;width:100%;font-weight:200;line-height:16px;position:absolute;right:20px;bottom:20px}.a-enter-ar{right:80px}.a-enter-vr-button,.a-enter-vr-modal,.a-enter-vr-modal a{color:#fff;user-select:none;outline:0}.a-enter-vr-button{background:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='108' height='62' viewBox='0 0 108 62'%3E%3Ctitle%3Eaframe-vrmode-noborder-reduced-tracking%3C/title%3E%3Cpath d='M68.81,21.56H64.23v8.27h4.58a4.13,4.13,0,0,0,3.1-1.09,4.2,4.2,0,0,0,1-3,4.24,4.24,0,0,0-1-3A4.05,4.05,0,0,0,68.81,21.56Z' fill='%23fff'/%3E%3Cpath d='M96,0H12A12,12,0,0,0,0,12V50A12,12,0,0,0,12,62H96a12,12,0,0,0,12-12V12A12,12,0,0,0,96,0ZM41.9,46H34L24,16h8l6,21.84,6-21.84H52Zm39.29,0H73.44L68.15,35.39H64.23V46H57V16H68.81q5.32,0,8.34,2.37a8,8,0,0,1,3,6.69,9.68,9.68,0,0,1-1.27,5.18,8.9,8.9,0,0,1-4,3.34l6.26,12.11Z' fill='%23fff'/%3E%3C/svg%3E\") 50% 50% no-repeat rgba(0,0,0,.35)}.a-enter-ar-button{background:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='108' height='62' viewBox='0 0 108 62'%3E%3Ctitle%3Eaframe-armode-noborder-reduced-tracking%3C/title%3E%3Cpath d='M96,0H12A12,12,0,0,0,0,12V50A12,12,0,0,0,12,62H96a12,12,0,0,0,12-12V12A12,12,0,0,0,96,0Zm8,50a8,8,0,0,1-8,8H12a8,8,0,0,1-8-8V12a8,8,0,0,1,8-8H96a8,8,0,0,1,8,8Z' fill='%23fff'/%3E%3Cpath d='M43.35,39.82H32.51L30.45,46H23.88L35,16h5.73L52,46H45.43Zm-9.17-5h7.5L37.91,23.58Z' fill='%23fff'/%3E%3Cpath d='M68.11,35H63.18V46H57V16H68.15q5.31,0,8.2,2.37a8.18,8.18,0,0,1,2.88,6.7,9.22,9.22,0,0,1-1.33,5.12,9.09,9.09,0,0,1-4,3.26l6.49,12.26V46H73.73Zm-4.93-5h5a5.09,5.09,0,0,0,3.6-1.18,4.21,4.21,0,0,0,1.28-3.27,4.56,4.56,0,0,0-1.2-3.34A5,5,0,0,0,68.15,21h-5Z' fill='%23fff'/%3E%3C/svg%3E\") 50% 50% no-repeat rgba(0,0,0,.2)}.a-enter-ar-button,.a-enter-vr-button{background-size:90% 90%;border:0;bottom:0;cursor:pointer;min-width:58px;min-height:34px;padding-right:0;padding-top:0;position:absolute;right:0;transition:background-color .05s ease;-webkit-transition:background-color .05s ease;z-index:9999;border-radius:8px;touch-action:manipulation}.a-enter-ar-button{background-size:100% 90%;margin-right:10px;border-radius:7px}.a-enter-ar-button:active,.a-enter-ar-button:hover,.a-enter-vr-button:active,.a-enter-vr-button:hover{background-color:#ef2d5e}.a-enter-vr-button.resethover{background-color:rgba(0,0,0,.35)}[data-a-enter-vr-no-webvr] .a-enter-vr-button{border-color:#666;opacity:.65}[data-a-enter-vr-no-webvr] .a-enter-vr-button:active,[data-a-enter-vr-no-webvr] .a-enter-vr-button:hover{background-color:rgba(0,0,0,.35);cursor:not-allowed}.a-enter-vr-modal{background-color:#666;border-radius:0;display:none;min-height:32px;margin-right:70px;padding:9px;width:280px;right:2%;position:absolute}.a-enter-vr-modal:after{border-bottom:10px solid transparent;border-left:10px solid #666;border-top:10px solid transparent;display:inline-block;content:'';position:absolute;right:-5px;top:5px;width:0;height:0}.a-enter-vr-modal a,.a-enter-vr-modal p{display:inline}.a-enter-vr-modal p{margin:0}.a-enter-vr-modal p:after{content:' '}[data-a-enter-vr-no-headset].a-enter-vr:hover .a-enter-vr-modal,[data-a-enter-vr-no-webvr].a-enter-vr:hover .a-enter-vr-modal{display:block}.a-orientation-modal{background:url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20version%3D%221.1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%2090%2090%22%20enable-background%3D%22new%200%200%2090%2090%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpolygon%20points%3D%220%2C0%200%2C0%200%2C0%20%22%3E%3C/polygon%3E%3Cg%3E%3Cpath%20d%3D%22M71.545%2C48.145h-31.98V20.743c0-2.627-2.138-4.765-4.765-4.765H18.456c-2.628%2C0-4.767%2C2.138-4.767%2C4.765v42.789%20%20%20c0%2C2.628%2C2.138%2C4.766%2C4.767%2C4.766h5.535v0.959c0%2C2.628%2C2.138%2C4.765%2C4.766%2C4.765h42.788c2.628%2C0%2C4.766-2.137%2C4.766-4.765V52.914%20%20%20C76.311%2C50.284%2C74.173%2C48.145%2C71.545%2C48.145z%20M18.455%2C16.935h16.344c2.1%2C0%2C3.808%2C1.708%2C3.808%2C3.808v27.401H37.25V22.636%20%20%20c0-0.264-0.215-0.478-0.479-0.478H16.482c-0.264%2C0-0.479%2C0.214-0.479%2C0.478v36.585c0%2C0.264%2C0.215%2C0.478%2C0.479%2C0.478h7.507v7.644%20%20%20h-5.534c-2.101%2C0-3.81-1.709-3.81-3.81V20.743C14.645%2C18.643%2C16.354%2C16.935%2C18.455%2C16.935z%20M16.96%2C23.116h19.331v25.031h-7.535%20%20%20c-2.628%2C0-4.766%2C2.139-4.766%2C4.768v5.828h-7.03V23.116z%20M71.545%2C73.064H28.757c-2.101%2C0-3.81-1.708-3.81-3.808V52.914%20%20%20c0-2.102%2C1.709-3.812%2C3.81-3.812h42.788c2.1%2C0%2C3.809%2C1.71%2C3.809%2C3.812v16.343C75.354%2C71.356%2C73.645%2C73.064%2C71.545%2C73.064z%22%3E%3C/path%3E%3Cpath%20d%3D%22M28.919%2C58.424c-1.466%2C0-2.659%2C1.193-2.659%2C2.66c0%2C1.466%2C1.193%2C2.658%2C2.659%2C2.658c1.468%2C0%2C2.662-1.192%2C2.662-2.658%20%20%20C31.581%2C59.617%2C30.387%2C58.424%2C28.919%2C58.424z%20M28.919%2C62.786c-0.939%2C0-1.703-0.764-1.703-1.702c0-0.939%2C0.764-1.704%2C1.703-1.704%20%20%20c0.94%2C0%2C1.705%2C0.765%2C1.705%2C1.704C30.623%2C62.022%2C29.858%2C62.786%2C28.919%2C62.786z%22%3E%3C/path%3E%3Cpath%20d%3D%22M69.654%2C50.461H33.069c-0.264%2C0-0.479%2C0.215-0.479%2C0.479v20.288c0%2C0.264%2C0.215%2C0.478%2C0.479%2C0.478h36.585%20%20%20c0.263%2C0%2C0.477-0.214%2C0.477-0.478V50.939C70.131%2C50.676%2C69.917%2C50.461%2C69.654%2C50.461z%20M69.174%2C51.417V70.75H33.548V51.417H69.174z%22%3E%3C/path%3E%3Cpath%20d%3D%22M45.201%2C30.296c6.651%2C0%2C12.233%2C5.351%2C12.551%2C11.977l-3.033-2.638c-0.193-0.165-0.507-0.142-0.675%2C0.048%20%20%20c-0.174%2C0.198-0.153%2C0.501%2C0.045%2C0.676l3.883%2C3.375c0.09%2C0.075%2C0.198%2C0.115%2C0.312%2C0.115c0.141%2C0%2C0.273-0.061%2C0.362-0.166%20%20%20l3.371-3.877c0.173-0.2%2C0.151-0.502-0.047-0.675c-0.194-0.166-0.508-0.144-0.676%2C0.048l-2.592%2C2.979%20%20%20c-0.18-3.417-1.629-6.605-4.099-9.001c-2.538-2.461-5.877-3.817-9.404-3.817c-0.264%2C0-0.479%2C0.215-0.479%2C0.479%20%20%20C44.72%2C30.083%2C44.936%2C30.296%2C45.201%2C30.296z%22%3E%3C/path%3E%3C/g%3E%3C/svg%3E) center/50% 50% no-repeat rgba(244,244,244,1);bottom:0;font-size:14px;font-weight:600;left:0;line-height:20px;right:0;position:fixed;top:0;z-index:9999999}.a-orientation-modal:after{color:#666;content:\"Insert phone into Cardboard holder.\";display:block;position:absolute;text-align:center;top:70%;transform:translateY(-70%);width:100%}.a-orientation-modal button{background:url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20version%3D%221.1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%20100%20100%22%20enable-background%3D%22new%200%200%20100%20100%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpath%20fill%3D%22%23000000%22%20d%3D%22M55.209%2C50l17.803-17.803c1.416-1.416%2C1.416-3.713%2C0-5.129c-1.416-1.417-3.713-1.417-5.129%2C0L50.08%2C44.872%20%20L32.278%2C27.069c-1.416-1.417-3.714-1.417-5.129%2C0c-1.417%2C1.416-1.417%2C3.713%2C0%2C5.129L44.951%2C50L27.149%2C67.803%20%20c-1.417%2C1.416-1.417%2C3.713%2C0%2C5.129c0.708%2C0.708%2C1.636%2C1.062%2C2.564%2C1.062c0.928%2C0%2C1.856-0.354%2C2.564-1.062L50.08%2C55.13l17.803%2C17.802%20%20c0.708%2C0.708%2C1.637%2C1.062%2C2.564%2C1.062s1.856-0.354%2C2.564-1.062c1.416-1.416%2C1.416-3.713%2C0-5.129L55.209%2C50z%22%3E%3C/path%3E%3C/svg%3E) no-repeat;border:none;height:50px;text-indent:-9999px;width:50px}.a-loader-title{background-color:rgba(0,0,0,.6);font-family:sans-serif,monospace;text-align:center;font-size:20px;height:50px;font-weight:300;line-height:50px;position:absolute;right:0;left:0;top:0;color:#fff}.a-modal{background:0 0/50% 50% rgba(0,0,0,.6);bottom:0;font-size:14px;font-weight:600;left:0;line-height:20px;right:0;position:fixed;top:0;z-index:9999999}.a-dialog{position:relative;left:50%;top:50%;transform:translate(-50%,-50%);z-index:199995;width:300px;height:200px;background-size:contain;background-color:#fff;font-family:sans-serif,monospace;font-size:20px;border-radius:3px;padding:6px}.a-dialog-text-container{width:100%;height:70%;align-self:flex-start;display:flex;justify-content:center;align-content:center;flex-direction:column}.a-dialog-text{display:inline-block;font-weight:400;font-size:14pt;margin:8px}.a-dialog-buttons-container{display:inline-flex;align-self:flex-end;width:100%;height:30%}.a-dialog-button{cursor:pointer;align-self:center;opacity:.9;height:80%;width:50%;font-size:12pt;margin:4px;border-radius:2px;text-align:center;border:none;display:inline-block;-webkit-transition:all .25s ease-in-out;transition:all .25s ease-in-out;box-shadow:0 1px 3px rgba(0,0,0,.1),0 1px 2px rgba(0,0,0,.2);user-select:none}.a-dialog-permission-button:hover{box-shadow:0 7px 14px rgba(0,0,0,.2),0 2px 2px rgba(0,0,0,.2)}.a-dialog-allow-button{background-color:#00ceff}.a-dialog-deny-button{background-color:#ff005b}.a-dialog-ok-button{background-color:#00ceff;width:100%}"; (_dereq_("browserify-css").createStyle(css, { "href": "src/style/aframe.css"})); module.exports = css;
  2052. },{"browserify-css":4}],187:[function(_dereq_,module,exports){
  2053. var css = ".rs-base{background-color:#333;color:#fafafa;border-radius:0;font:10px monospace;left:5px;line-height:1em;opacity:.85;overflow:hidden;padding:10px;position:fixed;top:5px;width:300px;z-index:10000}.rs-base div.hidden{display:none}.rs-base h1{color:#fff;cursor:pointer;font-size:1.4em;font-weight:300;margin:0 0 5px;padding:0}.rs-group{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-flex-direction:column-reverse;flex-direction:column-reverse;margin-bottom:5px}.rs-group:last-child{margin-bottom:0}.rs-counter-base{align-items:center;display:-webkit-box;display:-webkit-flex;display:flex;height:10px;-webkit-justify-content:space-between;justify-content:space-between;margin:2px 0}.rs-counter-base.alarm{color:#b70000;text-shadow:0 0 0 #b70000,0 0 1px #fff,0 0 1px #fff,0 0 2px #fff,0 0 2px #fff,0 0 3px #fff,0 0 3px #fff,0 0 4px #fff,0 0 4px #fff}.rs-counter-id{font-weight:300;-webkit-box-ordinal-group:0;-webkit-order:0;order:0;width:54px}.rs-counter-value{font-weight:300;-webkit-box-ordinal-group:1;-webkit-order:1;order:1;text-align:right;width:35px}.rs-canvas{-webkit-box-ordinal-group:2;-webkit-order:2;order:2}@media (min-width:480px){.rs-base{left:20px;top:20px}}"; (_dereq_("browserify-css").createStyle(css, { "href": "src/style/rStats.css"})); module.exports = css;
  2054. },{"browserify-css":4}],188:[function(_dereq_,module,exports){
  2055. function removeDefaultCamera(e){var t;e.camera&&(t=e.querySelector("["+DEFAULT_CAMERA_ATTR+"]"))&&e.removeChild(t)}var constants=_dereq_("../constants/"),registerSystem=_dereq_("../core/system").registerSystem,DEFAULT_CAMERA_ATTR="data-aframe-default-camera";module.exports.System=registerSystem("camera",{init:function(){this.activeCameraEl=null,this.render=this.render.bind(this),this.unwrapRender=this.unwrapRender.bind(this),this.wrapRender=this.wrapRender.bind(this),this.initialCameraFound=!1,this.numUserCameras=0,this.numUserCamerasChecked=0,this.setupInitialCamera()},setupInitialCamera:function(){var e,t,a=this.sceneEl,r=this;if(a.camera&&!a.camera.el.getAttribute("camera").spectator)return void a.emit("cameraready",{cameraEl:a.camera.el});if(e=a.querySelectorAll("a-camera, [camera]"),!e.length)return void this.createDefaultCamera();for(this.numUserCameras=e.length,t=0;t<e.length;t++)e[t].addEventListener("object3dset",function(e){"camera"===e.detail.type&&r.checkUserCamera(this)}),e[t].isNode?e[t].load():e[t].addEventListener("nodeready",function(){this.load()})},checkUserCamera:function(e){var t,a=this.el.sceneEl;if(this.numUserCamerasChecked++,!this.initialCameraFound){if(t=e.getAttribute("camera"),!t.active||t.spectator)return void(this.numUserCamerasChecked===this.numUserCameras&&this.createDefaultCamera());this.initialCameraFound=!0,a.camera=e.getObject3D("camera"),a.emit("cameraready",{cameraEl:e})}},createDefaultCamera:function(){var e,t=this.sceneEl;e=document.createElement("a-entity"),e.setAttribute("camera",{active:!0}),e.setAttribute("position",{x:0,y:constants.DEFAULT_CAMERA_HEIGHT,z:0}),e.setAttribute("wasd-controls",""),e.setAttribute("look-controls",""),e.setAttribute(constants.AFRAME_INJECTED,""),e.addEventListener("object3dset",function(a){"camera"===a.detail.type&&(t.camera=a.detail.object,t.emit("cameraready",{cameraEl:e}))}),t.appendChild(e)},disableActiveCamera:function(){var e,t;e=this.sceneEl.querySelectorAll("[camera]"),t=e[e.length-1],t.setAttribute("camera","active",!0)},setActiveCamera:function(e){var t,a,r,i,s=this.activeCameraEl,n=this.sceneEl;if((i=e.getObject3D("camera"))&&e!==this.activeCameraEl){var c=n.querySelector("["+DEFAULT_CAMERA_ATTR+"]"),m=c&&c.querySelector("[camera]");for(e!==m&&removeDefaultCamera(n),this.activeCameraEl=e,this.activeCameraEl.play(),n.camera=i,s&&s.setAttribute("camera","active",!1),a=n.querySelectorAll("[camera]"),r=0;r<a.length;r++)t=a[r],t.isEntity&&e!==t&&(t.setAttribute("camera","active",!1),t.pause());n.emit("camera-set-active",{cameraEl:e})}},setSpectatorCamera:function(e){var t,a,r=this.spectatorCameraEl,i=this.sceneEl;(t=e.getObject3D("camera"))&&e!==this.spectatorCameraEl&&(r&&r.setAttribute("camera","spectator",!1),a=this.spectatorCameraEl=e,i.addEventListener("enter-vr",this.wrapRender),i.addEventListener("exit-vr",this.unwrapRender),a.setAttribute("camera","active",!1),a.play(),i.emit("camera-set-spectator",{cameraEl:e}))},disableSpectatorCamera:function(){this.spectatorCameraEl=void 0},wrapRender:function(){this.spectatorCameraEl&&!this.originalRender&&(this.originalRender=this.sceneEl.renderer.render,this.sceneEl.renderer.render=this.render)},unwrapRender:function(){this.originalRender&&(this.sceneEl.renderer.render=this.originalRender,this.originalRender=void 0)},render:function(e,t){var a,r,i=this.sceneEl;a=i.renderer.xr.enabled,this.originalRender.call(i.renderer,e,t),this.spectatorCameraEl&&!i.isMobile&&a&&(r=this.spectatorCameraEl.components.camera.camera,i.renderer.xr.enabled=!1,this.originalRender.call(i.renderer,e,r),i.renderer.xr.enabled=a)}});
  2056. },{"../constants/":123,"../core/system":142}],189:[function(_dereq_,module,exports){
  2057. function createGeometry(e){var t=e.primitive,r=geometries[t]&&geometries[t].Geometry,i=new r;if(!r)throw new Error("Unknown geometry `"+t+"`");return i.init(e),i.geometry}function decrementCacheCount(e,t){e[t]--}function incrementCacheCount(e,t){e[t]=void 0===e[t]?1:e[t]+1}var geometries=_dereq_("../core/geometry").geometries,registerSystem=_dereq_("../core/system").registerSystem;module.exports.System=registerSystem("geometry",{init:function(){this.cache={},this.cacheCount={}},clearCache:function(){this.cache={},this.cacheCount={}},getOrCreateGeometry:function(e){var t,r,i=this.cache;return e.skipCache?createGeometry(e):(r=this.hash(e),t=i[r],incrementCacheCount(this.cacheCount,r),t||(t=createGeometry(e),i[r]=t,t))},unuseGeometry:function(e){var t,r,i=this.cache,n=this.cacheCount;e.skipCache||(r=this.hash(e),i[r]&&(decrementCacheCount(n,r),n[r]>0||(t=i[r],t.dispose(),delete i[r],delete n[r])))},hash:function(e){return JSON.stringify(e)}});
  2058. },{"../core/geometry":132,"../core/system":142}],190:[function(_dereq_,module,exports){
  2059. var registerSystem=_dereq_("../core/system").registerSystem,THREE=_dereq_("../lib/three");module.exports.System=registerSystem("gltf-model",{schema:{dracoDecoderPath:{default:""}},init:function(){var e=this.data.dracoDecoderPath;this.dracoLoader=new THREE.DRACOLoader,this.dracoLoader.setDecoderPath(e)},update:function(){var e;this.dracoLoader||(e=this.data.dracoDecoderPath,this.dracoLoader=new THREE.DRACOLoader,this.dracoLoader.setDecoderPath(e))},getDRACOLoader:function(){return this.dracoLoader}});
  2060. },{"../core/system":142,"../lib/three":179}],191:[function(_dereq_,module,exports){
  2061. _dereq_("./camera"),_dereq_("./geometry"),_dereq_("./gltf-model"),_dereq_("./light"),_dereq_("./material"),_dereq_("./renderer"),_dereq_("./shadow"),_dereq_("./tracked-controls-webvr"),_dereq_("./tracked-controls-webxr"),_dereq_("./webxr");
  2062. },{"./camera":188,"./geometry":189,"./gltf-model":190,"./light":192,"./material":193,"./renderer":194,"./shadow":195,"./tracked-controls-webvr":196,"./tracked-controls-webxr":197,"./webxr":198}],192:[function(_dereq_,module,exports){
  2063. var registerSystem=_dereq_("../core/system").registerSystem,bind=_dereq_("../utils/bind"),constants=_dereq_("../constants/"),DEFAULT_LIGHT_ATTR="data-aframe-default-light";module.exports.System=registerSystem("light",{schema:{defaultLightsEnabled:{default:!0}},init:function(){this.defaultLights=!1,this.userDefinedLights=!1,this.sceneEl.addEventListener("loaded",bind(this.setupDefaultLights,this))},registerLight:function(t){t.hasAttribute(DEFAULT_LIGHT_ATTR)||(this.removeDefaultLights(),this.userDefinedLights=!0)},removeDefaultLights:function(){var t,e=this.sceneEl;if(this.defaultLights){t=document.querySelectorAll("["+DEFAULT_LIGHT_ATTR+"]");for(var i=0;i<t.length;i++)e.removeChild(t[i]);this.defaultLights=!1}},setupDefaultLights:function(){var t,e,i=this.sceneEl;this.userDefinedLights||this.defaultLights||!this.data.defaultLightsEnabled||(t=document.createElement("a-entity"),t.setAttribute("light",{color:"#BBB",type:"ambient"}),t.setAttribute(DEFAULT_LIGHT_ATTR,""),t.setAttribute(constants.AFRAME_INJECTED,""),i.appendChild(t),e=document.createElement("a-entity"),e.setAttribute("light",{color:"#FFF",intensity:.6,castShadow:!0}),e.setAttribute("position",{x:-.5,y:1,z:1}),e.setAttribute(DEFAULT_LIGHT_ATTR,""),e.setAttribute(constants.AFRAME_INJECTED,""),i.appendChild(e),this.defaultLights=!0)}});
  2064. },{"../constants/":123,"../core/system":142,"../utils/bind":199}],193:[function(_dereq_,module,exports){
  2065. function calculateVideoCacheHash(e,t){var r,i,n,a=t.getAttribute("id");if(a)return a;for(i="",n=e||{},r=0;r<t.attributes.length;r++)n[t.attributes[r].name]=t.attributes[r].value;return Object.keys(n).sort().forEach(function(e){i+=e+":"+n[e]+";"}),i}function loadImageTexture(e,t){function r(r,i){function n(e){setTextureProperties(e,t),e.needsUpdate=!0,r(e)}if("string"!=typeof e)return void n(new THREE.Texture(e));TextureLoader.load(e,n,function(){},function(e){error("`$s` could not be fetched (Error code: %s; Response: %s)",e.status,e.statusText)})}return new Promise(r)}function setTextureProperties(e,t){var r=t.offset||{x:0,y:0},i=t.repeat||{x:1,y:1};(t.npot||!1)&&(e.wrapS=THREE.ClampToEdgeWrapping,e.wrapT=THREE.ClampToEdgeWrapping,e.magFilter=THREE.LinearFilter,e.minFilter=THREE.LinearFilter),1===i.x&&1===i.y||(e.wrapS=THREE.RepeatWrapping,e.wrapT=THREE.RepeatWrapping,e.repeat.set(i.x,i.y)),0===r.x&&0===r.y||e.offset.set(r.x,r.y)}function createVideoEl(e,t,r){var i=document.createElement("video");return i.width=t,i.height=r,i.setAttribute("playsinline",""),i.setAttribute("webkit-playsinline",""),i.autoplay=!0,i.loop=!0,i.crossOrigin="anonymous",i.addEventListener("error",function(){warn("`$s` is not a valid video",e)},!0),i.src=e,i}function fixVideoAttributes(e){return e.autoplay=e.hasAttribute("autoplay")&&"false"!==e.getAttribute("autoplay"),e.controls=e.hasAttribute("controls")&&"false"!==e.getAttribute("controls"),"false"===e.getAttribute("loop")&&e.removeAttribute("loop"),"false"===e.getAttribute("preload")&&(e.preload="none"),e.crossOrigin=e.crossOrigin||"anonymous",e.setAttribute("playsinline",""),e.setAttribute("webkit-playsinline",""),e}var registerSystem=_dereq_("../core/system").registerSystem,THREE=_dereq_("../lib/three"),utils=_dereq_("../utils/"),isHLS=_dereq_("../utils/material").isHLS,bind=utils.bind,debug=utils.debug,error=debug("components:texture:error"),TextureLoader=new THREE.TextureLoader,warn=debug("components:texture:warn");TextureLoader.setCrossOrigin("anonymous"),module.exports.System=registerSystem("material",{init:function(){this.materials={},this.textureCounts={},this.textureCache={},this.sceneEl.addEventListener("materialtextureloaded",bind(this.onMaterialTextureLoaded,this))},clearTextureCache:function(){this.textureCache={}},loadTexture:function(e,t,r){function i(e){a.loadImage(e,t,r)}function n(e){a.loadVideo(e,t,r)}var a=this;return"CANVAS"===e.tagName?void this.loadCanvas(e,t,r):"VIDEO"===e.tagName?(e.src||e.srcObject||e.childElementCount||warn("Video element was defined with neither `source` elements nor `src` / `srcObject` attributes."),void this.loadVideo(e,t,r)):void utils.srcLoader.validateSrc(e,i,n)},loadImage:function(e,t,r){var i=this.hash(t),n=this.textureCache;if(n[i])return void n[i].then(r);n[i]=loadImageTexture(e,t),n[i].then(r)},loadCanvas:function(e,t,r){var i;i=new THREE.CanvasTexture(e),setTextureProperties(i,t),r(i)},loadVideo:function(e,t,r){function i(e){e.texture.needsUpdate=!0,r(e.texture,e.videoEl)}var n,a,s,o,u=this.textureCache;if("string"!=typeof e){if(s=e,n=this.hashVideo(t,s),u[n])return void u[n].then(i);fixVideoAttributes(s)}if(s=s||createVideoEl(e,t.width,t.height),n=this.hashVideo(t,s),u[n])return void u[n].then(i);a=new THREE.VideoTexture(s),a.minFilter=THREE.LinearFilter,setTextureProperties(a,t),this.sceneEl.isIOS&&isHLS(s.src||s.getAttribute("src"),s.type||s.getAttribute("type"))&&(a.format=THREE.RGBAFormat,a.needsCorrectionBGRA=!0,a.flipY=!1,a.needsCorrectionFlipY=!0),o={texture:a,videoEl:s},u[n]=Promise.resolve(o),i(o)},hash:function(e){return e.src.tagName&&(e=utils.extendDeep({},e),e.src=e.src.src),JSON.stringify(e)},hashVideo:function(e,t){return calculateVideoCacheHash(e,t)},registerMaterial:function(e){this.materials[e.uuid]=e},unregisterMaterial:function(e){delete this.materials[e.uuid];var t=this.textureCounts;Object.keys(e).filter(function(t){return e[t]&&e[t].isTexture}).forEach(function(r){--t[e[r].uuid]<=0&&e[r].dispose()})},updateMaterials:function(e){var t=this.materials;Object.keys(t).forEach(function(e){t[e].needsUpdate=!0})},onMaterialTextureLoaded:function(e){this.textureCounts[e.detail.texture.uuid]||(this.textureCounts[e.detail.texture.uuid]=0),this.textureCounts[e.detail.texture.uuid]++}});
  2066. },{"../core/system":142,"../lib/three":179,"../utils/":205,"../utils/material":209}],194:[function(_dereq_,module,exports){
  2067. var registerSystem=_dereq_("../core/system").registerSystem,utils=_dereq_("../utils/"),THREE=_dereq_("../lib/three"),debug=utils.debug,warn=debug("components:renderer:warn");module.exports.System=registerSystem("renderer",{schema:{antialias:{default:"auto",oneOf:["true","false","auto"]},highRefreshRate:{default:utils.device.isOculusBrowser()},logarithmicDepthBuffer:{default:"auto",oneOf:["true","false","auto"]},maxCanvasWidth:{default:1920},maxCanvasHeight:{default:1920},physicallyCorrectLights:{default:!1},precision:{default:"high",oneOf:["high","medium","low"]},sortObjects:{default:!1},colorManagement:{default:!1},gammaOutput:{default:!1},alpha:{default:!0},foveationLevel:{default:0}},init:function(){var e=this.data,t=this.el,a=t.renderer;a.sortObjects=e.sortObjects,a.physicallyCorrectLights=e.physicallyCorrectLights,(e.colorManagement||e.gammaOutput)&&(a.outputEncoding=THREE.sRGBEncoding,e.gammaOutput&&warn('Property `gammaOutput` is deprecated. Use `renderer="colorManagement: true;"` instead.')),t.hasAttribute("antialias")&&warn('Component `antialias` is deprecated. Use `renderer="antialias: true"` instead.'),t.hasAttribute("logarithmicDepthBuffer")&&warn('Component `logarithmicDepthBuffer` is deprecated. Use `renderer="logarithmicDepthBuffer: true"` instead.')},applyColorCorrection:function(e){this.data.colorManagement&&e&&(e.isColor?e.convertSRGBToLinear():e.isTexture&&(e.encoding=THREE.sRGBEncoding))}});
  2068. },{"../core/system":142,"../lib/three":179,"../utils/":205}],195:[function(_dereq_,module,exports){
  2069. var registerSystem=_dereq_("../core/system").registerSystem,THREE=_dereq_("../lib/three"),SHADOW_MAP_TYPE_MAP={basic:THREE.BasicShadowMap,pcf:THREE.PCFShadowMap,pcfsoft:THREE.PCFSoftShadowMap};module.exports.System=registerSystem("shadow",{schema:{enabled:{default:!0},autoUpdate:{default:!0},type:{default:"pcf",oneOf:["basic","pcf","pcfsoft"]}},init:function(){var e=this.sceneEl,a=this.data;this.shadowMapEnabled=!1,e.renderer&&(e.renderer.shadowMap.type=SHADOW_MAP_TYPE_MAP[a.type],e.renderer.shadowMap.autoUpdate=a.autoUpdate,this.setShadowMapEnabled(this.shadowMapEnabled))},update:function(e){e.enabled!==this.data.enabled&&this.setShadowMapEnabled(this.data.enabled)},setShadowMapEnabled:function(e){var a=this.sceneEl.renderer;this.shadowMapEnabled=this.data.enabled&&e,a&&(a.shadowMap.enabled=this.shadowMapEnabled)}});
  2070. },{"../core/system":142,"../lib/three":179}],196:[function(_dereq_,module,exports){
  2071. var registerSystem=_dereq_("../core/system").registerSystem,utils=_dereq_("../utils"),isWebXRAvailable=utils.device.isWebXRAvailable;module.exports.System=registerSystem("tracked-controls-webvr",{init:function(){var t=this;this.controllers=[],this.isChrome=-1!==navigator.userAgent.indexOf("Chrome"),this.updateControllerList(),this.throttledUpdateControllerList=utils.throttle(this.updateControllerList,500,this),isWebXRAvailable||navigator.getVRDisplays&&this.sceneEl.addEventListener("enter-vr",function(){navigator.getVRDisplays().then(function(e){e.length&&(t.vrDisplay=e[0])})})},tick:function(){this.isChrome?this.updateControllerList():this.throttledUpdateControllerList()},updateControllerList:function(){var t,e,i,s,r=this.controllers;if(e=navigator.getGamepads&&navigator.getGamepads()){for(s=r.length,r.length=0,i=0;i<e.length;++i)(t=e[i])&&t.pose&&r.push(t);r.length!==s&&this.el.emit("controllersupdated",void 0,!1)}}});
  2072. },{"../core/system":142,"../utils":205}],197:[function(_dereq_,module,exports){
  2073. var registerSystem=_dereq_("../core/system").registerSystem,utils=_dereq_("../utils");module.exports.System=registerSystem("tracked-controls-webxr",{init:function(){this.controllers=[],this.oldControllers=[],this.oldControllersLength=0,this.throttledUpdateControllerList=utils.throttle(this.updateControllerList,500,this),this.updateReferenceSpace=this.updateReferenceSpace.bind(this),this.el.addEventListener("enter-vr",this.updateReferenceSpace),this.el.addEventListener("exit-vr",this.updateReferenceSpace)},tick:function(){this.throttledUpdateControllerList()},updateReferenceSpace:function(){var e=this,t=this.el.xrSession;if(!t)return this.referenceSpace=void 0,this.controllers=[],void(this.oldControllersLength>0&&(this.oldControllersLength=0,this.el.emit("controllersupdated",void 0,!1)));var r=e.el.sceneEl.systems.webxr.sessionReferenceSpaceType;t.requestReferenceSpace(r).then(function(t){e.referenceSpace=t}).catch(function(t){throw e.el.sceneEl.systems.webxr.warnIfFeatureNotRequested(r,'tracked-controls-webxr uses reference space "'+r+'".'),t})},updateControllerList:function(){var e,t=this.el.xrSession,r=this.oldControllers;if(!t){if(0===this.oldControllersLength)return;return this.oldControllersLength=0,this.controllers=[],void this.el.emit("controllersupdated",void 0,!1)}if(t.inputSources){if(this.controllers=t.inputSources,this.oldControllersLength===this.controllers.length){var s=!0;for(e=0;e<this.controllers.length;++e)if(this.controllers[e]!==r[e]||this.controllers[e].gamepad!==r[e].gamepad){s=!1;break}if(s)return}for(r.length=0,e=0;e<this.controllers.length;e++)r.push(this.controllers[e]);this.oldControllersLength=this.controllers.length,this.el.emit("controllersupdated",void 0,!1)}}});
  2074. },{"../core/system":142,"../utils":205}],198:[function(_dereq_,module,exports){
  2075. var registerSystem=_dereq_("../core/system").registerSystem,utils=_dereq_("../utils/"),warn=utils.debug("systems:webxr:warn");module.exports.System=registerSystem("webxr",{schema:{referenceSpaceType:{type:"string",default:"local-floor"},requiredFeatures:{type:"array",default:["local-floor"]},optionalFeatures:{type:"array",default:["bounded-floor"]},overlayElement:{type:"selector"}},update:function(){var e=this.data;this.sessionConfiguration={requiredFeatures:e.requiredFeatures,optionalFeatures:e.optionalFeatures},this.sessionReferenceSpaceType=e.referenceSpaceType,e.overlayElement&&(this.warnIfFeatureNotRequested("dom-overlay"),this.sessionConfiguration.domOverlay={root:e.overlayElement})},wasFeatureRequested:function(e){return"viewer"===e||"local"===e||!(!this.sessionConfiguration.requiredFeatures.includes(e)&&!this.sessionConfiguration.optionalFeatures.includes(e))},warnIfFeatureNotRequested:function(e,r){if(!this.wasFeatureRequested(e)){var t='Please add the feature "'+e+"\" to a-scene's webxr system options in requiredFeatures/optionalFeatures.";warn((r?r+" ":"")+t)}}});
  2076. },{"../core/system":142,"../utils/":205}],199:[function(_dereq_,module,exports){
  2077. module.exports=function(r,t){return function(n){return function(){var o=n.concat(Array.prototype.slice.call(arguments,0));return r.apply(t,o)}}(Array.prototype.slice.call(arguments,2))};
  2078. },{}],200:[function(_dereq_,module,exports){
  2079. function parse(e,r){var t,i,n,o,s,u,d,a,l;if(e&&e instanceof Object)return u=void 0===e.x?r&&r.x:e.x,d=void 0===e.y?r&&r.y:e.y,a=void 0===e.z?r&&r.z:e.z,l=void 0===e.w?r&&r.w:e.w,void 0!==u&&null!==u&&(e.x=parseIfString(u)),void 0!==d&&null!==d&&(e.y=parseIfString(d)),void 0!==a&&null!==a&&(e.z=parseIfString(a)),void 0!==l&&null!==l&&(e.w=parseIfString(l)),e;if(null===e||void 0===e)return typeof r===OBJECT?extend({},r):r;for(t=e.trim().split(whitespaceRegex),s={},o=0;o<COORDINATE_KEYS.length;o++)if(n=COORDINATE_KEYS[o],t[o])s[n]=parseFloat(t[o],10);else{if(void 0===(i=r&&r[n]))continue;s[n]=parseIfString(i)}return s}function stringify(e){var r;return typeof e!==OBJECT?e:(r=e.x+" "+e.y,null!=e.z&&(r+=" "+e.z),null!=e.w&&(r+=" "+e.w),r)}function isCoordinates(e){return regex.test(e)}function parseIfString(e){return null!==e&&void 0!==e&&e.constructor===String?parseFloat(e,10):e}var debug=_dereq_("./debug"),extend=_dereq_("object-assign"),warn=debug("utils:coordinates:warn"),COORDINATE_KEYS=["x","y","z","w"],regex=/^\s*((-?\d*\.{0,1}\d+(e-?\d+)?)\s+){2,3}(-?\d*\.{0,1}\d+(e-?\d+)?)\s*$/;module.exports.regex=regex;var OBJECT="object",whitespaceRegex=/\s+/g;module.exports.parse=parse,module.exports.stringify=stringify,module.exports.isCoordinates=isCoordinates,module.exports.isCoordinate=function(e){return warn("`AFRAME.utils.isCoordinate` has been renamed to `AFRAME.utils.isCoordinates`"),isCoordinates(e)},module.exports.toVector3=function(e){return new THREE.Vector3(e.x,e.y,e.z)};
  2080. },{"./debug":201,"object-assign":39}],201:[function(_dereq_,module,exports){
  2081. (function (process){
  2082. function getDebugNamespaceType(e){var r=e.split(":");return r[r.length-1]}function getDebugNamespaceColor(e){var r=getDebugNamespaceType(e);return settings.colors&&settings.colors[r]||null}function storage(){try{return window.localStorage}catch(e){}}var debugLib=_dereq_("debug"),extend=_dereq_("object-assign"),settings={colors:{debug:"gray",error:"red",info:"gray",warn:"orange"}},debug=function(e){var r=debugLib(e);return r.color=getDebugNamespaceColor(e),r};extend(debug,debugLib);var ls=storage();ls&&(parseInt(ls.logs,10)||"true"===ls.logs)?debug.enable("*"):debug.enable("*:error,*:info,*:warn"),process.browser&&(window.logs=debug),module.exports=debug;
  2083. }).call(this,_dereq_('_process'))
  2084. },{"_process":49,"debug":8,"object-assign":39}],202:[function(_dereq_,module,exports){
  2085. (function (process){
  2086. function getVRDisplay(){return vrDisplay}function checkHeadsetConnected(){return supportsVRSession||supportsARSession||!!getVRDisplay()}function checkARSupport(){return supportsARSession}function isTablet(e){return/ipad|Nexus (7|9)|xoom|sch-i800|playbook|tablet|kindle/i.test(e||window.navigator.userAgent)}function isIOS(){return/iPad|iPhone|iPod/.test(window.navigator.platform)}function isMobileDeviceRequestingDesktopSite(){return!isMobile()&&!isMobileVR()&&void 0!==window.orientation}function isOculusBrowser(){return/(OculusBrowser)/i.test(window.navigator.userAgent)}function isFirefoxReality(){return/(Mobile VR)/i.test(window.navigator.userAgent)}function isMobileVR(){return isOculusBrowser()||isFirefoxReality()}function isR7(){return/R7 Build/.test(window.navigator.userAgent)}var error=_dereq_("debug")("device:error"),vrDisplay,supportsVRSession=!1,supportsARSession=!1,isWebXRAvailable=module.exports.isWebXRAvailable=!window.debug&&void 0!==navigator.xr;if(window.addEventListener("vrdisplayactivate",function(e){var i;isWebXRAvailable||(i=document.createElement("canvas"),vrDisplay=e.display,i.getContext("webgl",{}),vrDisplay.requestPresent([{source:i}]).then(function(){},function(){}))}),isWebXRAvailable){var updateEnterInterfaces=function(){var e=document.querySelector("a-scene");if(!e)return void window.addEventListener("DOMContentLoaded",updateEnterInterfaces);e.hasLoaded?e.components["vr-mode-ui"].updateEnterInterfaces():e.addEventListener("loaded",updateEnterInterfaces)},errorHandler=function(e){error("WebXR session support error: "+e.message)};navigator.xr.isSessionSupported?(navigator.xr.isSessionSupported("immersive-vr").then(function(e){supportsVRSession=e,updateEnterInterfaces()}).catch(errorHandler),navigator.xr.isSessionSupported("immersive-ar").then(function(e){supportsARSession=e,updateEnterInterfaces()}).catch(function(){})):navigator.xr.supportsSession?(navigator.xr.supportsSession("immersive-vr").then(function(){supportsVRSession=!0,updateEnterInterfaces()}).catch(errorHandler),navigator.xr.supportsSession("immersive-ar").then(function(){supportsARSession=!0,updateEnterInterfaces()}).catch(function(){})):error("WebXR has neither isSessionSupported or supportsSession?!")}else navigator.getVRDisplays&&navigator.getVRDisplays().then(function(e){var i=document.querySelector("a-scene");vrDisplay=e.length&&e[0],i&&i.emit("displayconnected",{vrDisplay:vrDisplay})});module.exports.getVRDisplay=getVRDisplay,module.exports.checkHeadsetConnected=checkHeadsetConnected,module.exports.checkARSupport=checkARSupport;var isMobile=function(){var e=!1;return function(i){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(i)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(i.substr(0,4)))&&(e=!0),(isIOS()||isTablet()||isR7())&&(e=!0),isMobileVR()&&(e=!1)}(window.navigator.userAgent||window.navigator.vendor||window.opera),function(){return e}}();module.exports.isMobile=isMobile,module.exports.isTablet=isTablet,module.exports.isIOS=isIOS,module.exports.isMobileDeviceRequestingDesktopSite=isMobileDeviceRequestingDesktopSite,module.exports.isOculusBrowser=isOculusBrowser,module.exports.isFirefoxReality=isFirefoxReality,module.exports.isMobileVR=isMobileVR,module.exports.isR7=isR7,module.exports.isLandscape=function(){var e=window.orientation;return isR7()&&(e+=90),90===e||-90===e},module.exports.isBrowserEnvironment=!(process&&!process.browser),module.exports.isNodeEnvironment=!module.exports.isBrowserEnvironment;
  2087. }).call(this,_dereq_('_process'))
  2088. },{"_process":49,"debug":8}],203:[function(_dereq_,module,exports){
  2089. function getComponentPropertyPath(t,e){return e=e||".",propertyPathCache[e]||(propertyPathCache[e]={}),-1!==t.indexOf(e)?propertyPathCache[e][t]=t.split(e):propertyPathCache[e][t]=t,propertyPathCache[e][t]}var propertyPathCache={};module.exports.getComponentPropertyPath=getComponentPropertyPath,module.exports.propertyPathCache=propertyPathCache,module.exports.getComponentProperty=function(t,e,r){var o;return r=r||".",-1!==e.indexOf(r)?(o=getComponentPropertyPath(e,r),o.constructor===String?t.getAttribute(o):t.getAttribute(o[0])[o[1]]):t.getAttribute(e)},module.exports.setComponentProperty=function(t,e,r,o){var p;if(o=o||".",-1!==e.indexOf(o))return p=getComponentPropertyPath(e,o),void(p.constructor===String?t.setAttribute(p,r):t.setAttribute(p[0],p[1],r));t.setAttribute(e,r)};
  2090. },{}],204:[function(_dereq_,module,exports){
  2091. module.exports=function(t){var e=t.style.width,s=t.style.height;t.style.width=parseInt(e,10)+1+"px",t.style.height=parseInt(s,10)+1+"px",setTimeout(function(){t.style.width=e,t.style.height=s},200)};
  2092. },{}],205:[function(_dereq_,module,exports){
  2093. var debug=_dereq_("./debug"),deepAssign=_dereq_("deep-assign"),device=_dereq_("./device"),objectAssign=_dereq_("object-assign"),objectPool=_dereq_("./object-pool"),warn=debug("utils:warn");module.exports.bind=_dereq_("./bind"),module.exports.coordinates=_dereq_("./coordinates"),module.exports.debug=debug,module.exports.device=device,module.exports.entity=_dereq_("./entity"),module.exports.forceCanvasResizeSafariMobile=_dereq_("./forceCanvasResizeSafariMobile"),module.exports.isIE11=_dereq_("./is-ie11"),module.exports.material=_dereq_("./material"),module.exports.objectPool=objectPool,module.exports.split=_dereq_("./split").split,module.exports.styleParser=_dereq_("./styleParser"),module.exports.trackedControls=_dereq_("./tracked-controls"),module.exports.checkHeadsetConnected=function(){return warn("`utils.checkHeadsetConnected` has moved to `utils.device.checkHeadsetConnected`"),device.checkHeadsetConnected(arguments)},module.exports.isGearVR=module.exports.device.isGearVR=function(){warn("`utils.isGearVR` has been deprecated, use `utils.device.isMobileVR`")},module.exports.isIOS=function(){return warn("`utils.isIOS` has moved to `utils.device.isIOS`"),device.isIOS(arguments)},module.exports.isOculusGo=module.exports.device.isOculusGo=function(){warn("`utils.isOculusGo` has been deprecated, use `utils.device.isMobileVR`")},module.exports.isMobile=function(){return warn("`utils.isMobile has moved to `utils.device.isMobile`"),device.isMobile(arguments)},module.exports.throttle=function(e,r,t){var o;return t&&(e=module.exports.bind(e,t)),function(){var t=Date.now(),i=void 0===o?r:t-o;(void 0===o||i>=r)&&(o=t,e.apply(null,arguments))}},module.exports.throttleTick=function(e,r,t){var o;return t&&(e=module.exports.bind(e,t)),function(t,i){var n=void 0===o?i:t-o;(void 0===o||n>=r)&&(o=t,e(t,n))}},module.exports.debounce=function(e,r,t){var o;return function(){var i=this,n=arguments,u=function(){o=null,t||e.apply(i,n)},s=t&&!o;clearTimeout(o),o=setTimeout(u,r),s&&e.apply(i,n)}},module.exports.extend=objectAssign,module.exports.extendDeep=deepAssign,module.exports.clone=function(e){return JSON.parse(JSON.stringify(e))};var deepEqual=function(){var e=objectPool.createPool(function(){return[]});return function(r,t){var o,i,n,u,s,c;if(void 0===r||void 0===t||null===r||null===t||!(r&&t&&r.constructor===Object&&t.constructor===Object||r.constructor===Array&&t.constructor===Array))return r===t;i=e.use(),n=e.use(),i.length=0,n.length=0;for(o in r)i.push(o);for(o in t)n.push(o);if(i.length!==n.length)return e.recycle(i),e.recycle(n),!1;for(u=0;u<i.length;++u)if(s=r[i[u]],c=t[i[u]],"object"==typeof s||"object"==typeof c||Array.isArray(s)&&Array.isArray(c)){if(s===c)continue;if(!deepEqual(s,c))return e.recycle(i),e.recycle(n),!1}else if(s!==c)return e.recycle(i),e.recycle(n),!1;return e.recycle(i),e.recycle(n),!0}}();module.exports.deepEqual=deepEqual,module.exports.diff=function(){var e=[];return function(r,t,o){var i,n,u,s,c,l,d;s=o||{},e.length=0;for(c in r)e.push(c);if(!t)return s;for(u in t)-1===e.indexOf(u)&&e.push(u);for(l=0;l<e.length;l++)c=e[l],i=r[c],n=t[c],((d=i&&n&&i.constructor===Object&&n.constructor===Object)&&!deepEqual(i,n)||!d&&i!==n)&&(s[c]=n);return s}}(),module.exports.shouldCaptureKeyEvent=function(e){return!e.metaKey&&document.activeElement===document.body},module.exports.splitString=function(e,r){void 0===r&&(r=" ");var t=new RegExp(r,"g");return e=(e||"").replace(t,r),e.split(r)},module.exports.getElData=function(e,r){function t(r){e.hasAttribute(r)&&(o[r]=e.getAttribute(r))}r=r||{};var o={};return Object.keys(r).forEach(t),o},module.exports.getUrlParameter=function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var r=new RegExp("[\\?&]"+e+"=([^&#]*)"),t=r.exec(location.search);return null===t?"":decodeURIComponent(t[1].replace(/\+/g," "))},module.exports.isIframed=function(){return window.top!==window.self},module.exports.findAllScenes=function(e){for(var r=[],t=e.getElementsByTagName("*"),o=0,i=t.length;o<i;o++)t[o].isScene&&r.push(t[o]);return r},module.exports.srcLoader=_dereq_("./src-loader");
  2094. },{"./bind":199,"./coordinates":200,"./debug":201,"./device":202,"./entity":203,"./forceCanvasResizeSafariMobile":204,"./is-ie11":207,"./material":209,"./object-pool":210,"./split":211,"./src-loader":212,"./styleParser":213,"./tracked-controls":214,"deep-assign":10,"object-assign":39}],206:[function(_dereq_,module,exports){
  2095. // Safari regression introduced in iOS 12 and remains in iOS 13.
  2096. // https://stackoverflow.com/questions/62717621/white-space-at-page-bottom-after-device-rotation-in-ios-safari
  2097. window.addEventListener('orientationchange', function () {
  2098. document.documentElement.style.height = `initial`;
  2099. setTimeout(function () {
  2100. document.documentElement.style.height = `100%`;
  2101. setTimeout(function () {
  2102. // this line prevents the content
  2103. // from hiding behind the address bar
  2104. window.scrollTo(0, 1);
  2105. }, 500);
  2106. }, 500);
  2107. });
  2108. },{}],207:[function(_dereq_,module,exports){
  2109. function getInternetExplorerVersion(){var e,r=-1,n=navigator.userAgent;return"Microsoft Internet Explorer"===navigator.appName?(e=new RegExp("MSIE ([0-9]{1,}[\\.0-9]{0,})"),null!=e.exec(n)&&(r=parseFloat(RegExp.$1))):"Netscape"===navigator.appName&&(e=new RegExp("Trident/.*rv:([0-9]{1,}[\\.0-9]{0,})"),null!=e.exec(n)&&(r=parseFloat(RegExp.$1))),r}module.exports=11===getInternetExplorerVersion();
  2110. },{}],208:[function(_dereq_,module,exports){
  2111. module.exports=function(o){return/(iphone|ipod|ipad).*os.(7_|8_|9_)/i.test(o)};
  2112. },{}],209:[function(_dereq_,module,exports){
  2113. function handleTextureEvents(e,t){t&&(e.emit("materialtextureloaded",{src:t.image,texture:t}),t.image&&"VIDEO"===t.image.tagName&&(t.image.addEventListener("loadeddata",function(){e.components&&e.components.material&&(t.needsCorrectionBGRA&&t.needsCorrectionFlipY&&-1!==["standard","flat"].indexOf(e.components.material.data.shader)&&e.setAttribute("material","shader","ios10hls"),e.emit("materialvideoloadeddata",{src:t.image,texture:t}))}),t.image.addEventListener("ended",function(){e.emit("materialvideoended",{src:t.image,texture:t})})))}var THREE=_dereq_("../lib/three"),HLS_MIMETYPES=["application/x-mpegurl","application/vnd.apple.mpegurl"],COLOR_MAPS=new Set(["emissiveMap","envMap","map","specularMap"]);module.exports.updateMapMaterialFromData=function(e,t,a,r){function n(t){a.materialSrcs[e]===d&&i(t)}function i(t){o[e]=t,t&&COLOR_MAPS.has(e)&&l.applyColorCorrection(t),o.needsUpdate=!0,handleTextureEvents(s,t)}var s=a.el,o=a.material,l=s.sceneEl.systems.renderer,d=r[t];if(a.materialSrcs||(a.materialSrcs={}),!d)return delete a.materialSrcs[e],void i(null);d!==a.materialSrcs[e]&&(a.materialSrcs[e]=d,d instanceof THREE.Texture?i(d):s.sceneEl.systems.material.loadTexture(d,{src:d,repeat:r.repeat,offset:r.offset,npot:r.npot},n))},module.exports.updateMap=function(e,t){return module.exports.updateMapMaterialFromData("map","src",e,t)},module.exports.updateDistortionMap=function(e,t,a){function r(e){var t=n+"Map";s[t]=e,e&&COLOR_MAPS.has(t)&&o.applyColorCorrection(e),s.needsUpdate=!0,handleTextureEvents(i,e)}var n=e;"ambientOcclusion"===e&&(n="ao");var i=t.el,s=t.material,o=i.sceneEl.systems.renderer,l=a[e+"Map"],d={};if(d.src=l,d.offset=a[e+"TextureOffset"],d.repeat=a[e+"TextureRepeat"],d.wrap=a[e+"TextureWrap"],l){if(l===t[e+"TextureSrc"])return;return t[e+"TextureSrc"]=l,void i.sceneEl.systems.material.loadTexture(l,d,r)}s.map&&r(null)},module.exports.handleTextureEvents=handleTextureEvents,module.exports.isHLS=function(e,t){return!(!t||!HLS_MIMETYPES.includes(t.toLowerCase()))||!!(e&&e.toLowerCase().indexOf(".m3u8")>0)};
  2114. },{"../lib/three":179}],210:[function(_dereq_,module,exports){
  2115. function defaultObjectFactory(){return{}}function clearObject(e){var t;if(e&&e.constructor===Object)for(t in e)e[t]=void 0}function removeUnusedKeys(e,t){var n;if(e&&e.constructor===Object)for(n in e)n in t||delete e[n]}var EMPTY_SLOT=Object.freeze(Object.create(null));module.exports.createPool=function(e){function t(){var e;return null!==l&&l!==c.length||r(c.length||5),e=c[l],c[l++]=EMPTY_SLOT,clearObject(e),e}function n(e){if(e instanceof Object)return null===l||-1===l?void(c[c.length]=e):void(c[--l]=e)}function r(t){var n,r;if(t=void 0===t?c.length:t,t>0&&null==l&&(l=0),t>0)for(n=c.length,c.length+=Number(t),r=n;r<c.length;r++)c[r]=e();return c.length}function o(){return c.length}var c=[],l=null;return e=e||defaultObjectFactory,{grow:r,pool:c,recycle:n,size:o,use:t}},module.exports.clearObject=clearObject,module.exports.removeUnusedKeys=removeUnusedKeys;
  2116. },{}],211:[function(_dereq_,module,exports){
  2117. module.exports.split=function(){var n={};return function(t,i){return i in n||(n[i]={}),t in n[i]?n[i][t]:(n[i][t]=t.split(i),n[i][t])}}();
  2118. },{}],212:[function(_dereq_,module,exports){
  2119. function validateSrc(e,a,t){checkIsImage(e,function(r){if(r)return void a(e);t(e)})}function validateCubemapSrc(e,a){function t(e){o.push(e),6===o.length&&a(o)}var r,n,c,s="",o=[];for(n=0;n<5;n++)s+="(url\\((?:[^\\)]+)\\),\\s*)";if(s+="(url\\((?:[^\\)]+)\\)\\s*)",c=e.match(new RegExp(s)))for(n=1;n<7;n++)validateSrc(parseUrl(c[n]),t);else if(r=validateAndGetQuerySelector(e))return"A-CUBEMAP"===r.tagName&&r.srcs?a(r.srcs):void warn('Selector "%s" does not point to <a-cubemap>',e)}function parseUrl(e){var a=e.match(/\url\((.+)\)/);if(a)return a[1]}function checkIsImage(e,a){var t;if(e.tagName)return void a("IMG"===e.tagName);t=new XMLHttpRequest,t.open("HEAD",e),t.addEventListener("load",function(r){var n;t.status>=200&&t.status<300?(n=t.getResponseHeader("Content-Type"),null==n?checkIsImageFallback(e,a):a(n.startsWith("image")?!0:!1)):checkIsImageFallback(e,a),t.abort()}),t.send()}function checkIsImageFallback(e,a){function t(){a(!0)}function r(){a(!1)}var n=new Image;n.addEventListener("load",t),n.addEventListener("error",r),n.src=e}function validateAndGetQuerySelector(e){try{var a=document.querySelector(e);return a||warn('No element was found matching the selector: "%s"',e),a}catch(a){return void warn('"%s" is not a valid selector',e)}}var debug=_dereq_("./debug"),warn=debug("utils:src-loader:warn");module.exports={parseUrl:parseUrl,validateSrc:validateSrc,validateCubemapSrc:validateCubemapSrc};
  2120. },{"./debug":201}],213:[function(_dereq_,module,exports){
  2121. function toCamelCase(e){return e.replace(DASH_REGEX,upperCase)}function transformKeysToCamelCase(e){var r,t;for(t in e)r=toCamelCase(t),t!==r&&(e[r]=e[t],delete e[t]);return e}function styleParse(e,r){var t,n,s,a,o,u;for(r=r||{},t=getKeyValueChunks(e),n=0;n<t.length;n++)(s=t[n])&&(a=s.indexOf(":"),o=s.substr(0,a).trim(),u=s.substr(a+1).trim(),r[o]=u);return r}function styleStringify(e){var r,t=0,n=0,s="";for(r in e)t++;for(r in e)s+=r+": "+e[r],n<t-1&&(s+="; "),n++;return s}function upperCase(e){return e[1].toUpperCase()}var DASH_REGEX=/-([a-z])/g;module.exports.parse=function(e,r){var t;return"string"!=typeof e?e:(t=styleParse(e,r),t[""]?e:transformKeysToCamelCase(t))},module.exports.stringify=function(e){return"string"==typeof e?e:styleStringify(e)},module.exports.toCamelCase=toCamelCase,module.exports.transformKeysToCamelCase=transformKeysToCamelCase;var getKeyValueChunks=function(){var e=[],r=/url\([^)]+$/;return function(t){var n,s="",a=0;for(e.length=0;a<t.length;)n=t.indexOf(";",a),-1===n&&(n=t.length),s+=t.substring(a,n),r.test(s)?(s+=";",a=n+1):(e.push(s.trim()),s="",a=n+1);return e}}();
  2122. },{}],214:[function(_dereq_,module,exports){
  2123. function isControllerPresentWebVR(e,n,t){var r,o,l=e.el.sceneEl,i=t.index||0;return!!n&&(!!(o=l&&l.systems["tracked-controls-webvr"])&&(r=o.controllers,!!r.length&&!!findMatchingControllerWebVR(r,null,n,t.hand,i)))}function isControllerPresentWebXR(e,n,t){var r,o=e.el.sceneEl,l=o&&o.systems["tracked-controls-webxr"];return!!l&&(!(!(r=l.controllers)||!r.length)&&findMatchingControllerWebXR(r,n,t.hand,t.index,t.iterateControllerProfiles,t.handTracking))}function findMatchingControllerWebVR(e,n,t,r,o){var l,i,s=0,d=o>=0?o:0;for(i=0;i<e.length;i++)if(l=e[i],(!t||l.id.startsWith(t))&&(t||l.id===n)&&(!r||!l.hand||r===l.hand)){if(!r||l.hand)return l;if(d=NUM_HANDS*o+(r===DEFAULT_HANDEDNESS?0:1),s===d)return l;++s}}function findMatchingControllerWebXR(e,n,t,r,o,l){var i,s,d,a,c=!1;for(i=0;i<e.length;i++){if(d=e[i],a=d.profiles,l)c=d.hand;else if(o)for(s=0;s<a.length&&!(c=a[s].startsWith(n));s++);else c=a.length>0&&a[0].startsWith(n);if(c)if("right"===d.handedness||"left"===d.handedness){if(d.handedness===t)return e[i]}else if(i===r)return e[i]}}var DEFAULT_HANDEDNESS=_dereq_("../constants").DEFAULT_HANDEDNESS,AXIS_LABELS=["x","y","z","w"],NUM_HANDS=2;module.exports.checkControllerPresentAndSetup=function(e,n,t){var r,o,l=e.el,i=l.sceneEl.hasWebXR,s=i?isControllerPresentWebXR:isControllerPresentWebVR;if(r=s(e,n,t),o=!!r,!e.controllerPresent||e.controllerEventsActive||i||e.addEventListeners(),o===e.controllerPresent)return o;e.controllerPresent=o,o?(e.addEventListeners(),e.injectTrackedControls(r),l.emit("controllerconnected",{name:e.name,component:e})):(e.removeEventListeners(),l.emit("controllerdisconnected",{name:e.name,component:e}))},module.exports.isControllerPresentWebVR=isControllerPresentWebVR,module.exports.isControllerPresentWebXR=isControllerPresentWebXR,module.exports.findMatchingControllerWebVR=findMatchingControllerWebVR,module.exports.findMatchingControllerWebXR=findMatchingControllerWebXR,module.exports.emitIfAxesChanged=function(e,n,t){var r,o,l,i,s;for(o in n){for(r=n[o],l=!1,s=0;s<r.length;s++)t.detail.changed[r[s]]&&(l=!0);if(l){for(i={},s=0;s<r.length;s++)i[AXIS_LABELS[s]]=t.detail.axis[r[s]];e.el.emit(o+"moved",i)}}},module.exports.onButtonEvent=function(e,n,t,r){var o=r?t.mapping[r]:t.mapping,l=o.buttons[e];t.el.emit(l+n),t.updateModel&&t.updateModel(l,n)};
  2124. },{"../constants":123}],215:[function(_dereq_,module,exports){
  2125. THREE.DeviceOrientationControls=function(e){var n=this;this.object=e,this.object.rotation.reorder("YXZ"),this.enabled=!0,this.deviceOrientation={},this.screenOrientation=0,this.alphaOffset=0;var t=function(e){n.deviceOrientation=e},i=function(){n.screenOrientation=window.orientation||0},o=function(){var e=new THREE.Vector3(0,0,1),n=new THREE.Euler,t=new THREE.Quaternion,i=new THREE.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5));return function(o,a,r,c,s){n.set(r,a,-c,"YXZ"),o.setFromEuler(n),o.multiply(i),o.multiply(t.setFromAxisAngle(e,-s))}}();this.connect=function(){i(),window.addEventListener("orientationchange",i,!1),window.addEventListener("deviceorientation",t,!1),n.enabled=!0},this.disconnect=function(){window.removeEventListener("orientationchange",i,!1),window.removeEventListener("deviceorientation",t,!1),n.enabled=!1},this.update=function(){if(!1!==n.enabled){var e=n.deviceOrientation;if(e){var t=e.alpha?THREE.Math.degToRad(e.alpha)+n.alphaOffset:0,i=e.beta?THREE.Math.degToRad(e.beta):0,a=e.gamma?THREE.Math.degToRad(e.gamma):0,r=n.screenOrientation?THREE.Math.degToRad(n.screenOrientation):0;o(n.object.quaternion,t,i,a,r)}}},this.dispose=function(){n.disconnect()},this.connect()};
  2126. },{}],216:[function(_dereq_,module,exports){
  2127. window.glStats=function(){function e(e,r){return function(){r.apply(this,arguments),e.apply(this,arguments)}}function r(){a("allcalls").set(s+i),a("drawElements").set(i),a("drawArrays").set(s),a("bindTexture").set(c),a("useProgram").set(l),a("glfaces").set(d),a("glvertices").set(m),a("glpoints").set(p)}function t(){s=0,i=0,l=0,d=0,m=0,p=0,c=0}function n(){}function o(e){a=e}var a=null,s=0,i=0,l=0,d=0,m=0,p=0,c=0;return WebGLRenderingContext.prototype.drawArrays=e(WebGLRenderingContext.prototype.drawArrays,function(){s++,arguments[0]==this.POINTS?p+=arguments[2]:m+=arguments[2]}),WebGLRenderingContext.prototype.drawElements=e(WebGLRenderingContext.prototype.drawElements,function(){i++,d+=arguments[1]/3,m+=arguments[1]}),WebGLRenderingContext.prototype.useProgram=e(WebGLRenderingContext.prototype.useProgram,function(){l++}),WebGLRenderingContext.prototype.bindTexture=e(WebGLRenderingContext.prototype.bindTexture,function(){c++}),{update:r,start:t,end:n,attach:o,values:{allcalls:{over:3e3,caption:"Calls (hook)"},drawelements:{caption:"drawElements (hook)"},drawarrays:{caption:"drawArrays (hook)"}},groups:[{caption:"WebGL",values:["allcalls","drawelements","drawarrays","useprogram","bindtexture","glfaces","glvertices","glpoints"]}],fractions:[{base:"allcalls",steps:["drawelements","drawarrays"]}]}},window.threeStats=function(e){function r(){a("renderer.info.memory.geometries").set(e.info.memory.geometries),a("renderer.info.programs").set(e.info.programs.length),a("renderer.info.memory.textures").set(e.info.memory.textures),a("renderer.info.render.calls").set(e.info.render.calls),a("renderer.info.render.triangles").set(e.info.render.triangles),a("renderer.info.render.points").set(e.info.render.points)}function t(){}function n(){}function o(e){a=e}var a=null;return{update:r,start:t,end:n,attach:o,values:{"renderer.info.memory.geometries":{caption:"Geometries"},"renderer.info.memory.textures":{caption:"Textures"},"renderer.info.programs":{caption:"Programs"},"renderer.info.render.calls":{caption:"Calls"},"renderer.info.render.triangles":{caption:"Triangles",over:1e3},"renderer.info.render.points":{caption:"Points"}},groups:[{caption:"Three.js - Memory",values:["renderer.info.memory.geometries","renderer.info.programs","renderer.info.memory.textures"]},{caption:"Three.js - Render",values:["renderer.info.render.calls","renderer.info.render.triangles","renderer.info.render.points"]}],fractions:[]}},window.BrowserStats=function(){function e(e){var r=Math.floor(Math.log(e)/p);return Math.round(100*e/Math.pow(1024,r))/100}function r(){s=e(performance.memory.usedJSHeapSize),i=e(performance.memory.totalJSHeapSize),a("memory").set(s),a("total").set(i)}function t(){s=0}function n(){}function o(e){a=e}var a=null,s=0,i=0;window.performance&&!performance.memory&&(performance.memory={usedJSHeapSize:0,totalJSHeapSize:0}),0===performance.memory.totalJSHeapSize&&console.warn("totalJSHeapSize === 0... performance.memory is only available in Chrome .");var l={memory:{caption:"Used Memory",average:!0,avgMs:1e3,over:22},total:{caption:"Total Memory"}},d=[{caption:"Browser",values:["memory","total"]}],m=[{base:"total",steps:["memory"]}],p=Math.log(1024);return{update:r,start:t,end:n,attach:o,values:l,groups:d,fractions:m}},"object"==typeof module&&(module.exports={glStats:window.glStats,threeStats:window.threeStats,BrowserStats:window.BrowserStats});
  2128. },{}],217:[function(_dereq_,module,exports){
  2129. "use strict";!function(){"performance"in window==0&&(window.performance={});var e=window.performance;if("now"in e==0){var t=Date.now();e.timing&&e.timing.navigationStart&&(t=e.timing.navigationStart),e.now=function(){return Date.now()-t}}e.mark||(e.mark=function(){}),e.measure||(e.measure=function(){})}(),window.rStats=function(e){function t(e,t){for(var n=Object.keys(e),a=0,r=n.length;a<r;a++)t(n[a])}function n(e){var t=document.createElement("link");t.href=e,t.rel="stylesheet",t.type="text/css",document.getElementsByTagName("head")[0].appendChild(t)}function a(e,t,n){function a(e,t){l+=.1*(e-l),c*=.99,l>c&&(c=l),o.drawImage(i,1,0,i.width-1,i.height,0,0,i.width-1,i.height),t?o.drawImage(f,i.width-1,i.height-l*i.height/c-p):o.drawImage(u,i.width-1,i.height-l*i.height/c-p)}var r=n||{},i=document.createElement("canvas"),o=i.getContext("2d"),c=0,l=0,s=r.color?r.color:"#666666",u=document.createElement("canvas"),d=u.getContext("2d");u.width=1,u.height=2*p,d.fillStyle="#444444",d.fillRect(0,0,1,2*p),d.fillStyle=s,d.fillRect(0,p,1,p),d.fillStyle="#ffffff",d.globalAlpha=.5,d.fillRect(0,p,1,1),d.globalAlpha=1;var f=document.createElement("canvas"),m=f.getContext("2d");return f.width=1,f.height=2*p,m.fillStyle="#444444",m.fillRect(0,0,1,2*p),m.fillStyle="#b70000",m.fillRect(0,p,1,p),m.globalAlpha=.5,m.fillStyle="#ffffff",m.fillRect(0,p,1,1),m.globalAlpha=1,function(){i.width=h,i.height=p,i.style.width=i.width+"px",i.style.height=i.height+"px",i.className="rs-canvas",e.appendChild(i),o.fillStyle="#444444",o.fillRect(0,0,i.width,i.height)}(),{draw:a}}function r(e,n){function a(e){i.drawImage(r,1,0,r.width-1,r.height,0,0,r.width-1,r.height);var n=0;t(e,function(t){var a=e[t]*r.height;i.fillStyle=s[t],i.fillRect(r.width-1,n,1,a),n+=a})}var r=document.createElement("canvas"),i=r.getContext("2d");return function(){r.width=h,r.height=p*n,r.style.width=r.width+"px",r.style.height=r.height+"px",r.className="rs-canvas",e.appendChild(r),i.fillStyle="#444444",i.fillRect(0,0,r.width,r.height)}(),{draw:a}}function i(e,t){function n(e){if(x&&x.average){v+=e,C++;var t=performance.now();t-w>=(x.avgMs||1e3)&&(g=v/C,v=0,w=t,C=0)}}function r(){d=performance.now(),l.userTimingAPI&&performance.mark(p+"-start"),I=!0}function i(){h=performance.now()-d,l.userTimingAPI&&(performance.mark(p+"-end"),I&&performance.measure(p,p+"-start",p+"-end")),n(h)}function o(){i(),r()}function c(){var e=x&&x.average?g:h;b.nodeValue=Math.round(100*e)/100;var t=x&&(x.below&&h<x.below||x.over&&h>x.over);N.draw(h,t),y.className=t?"rs-counter-base alarm":"rs-counter-base"}function s(){var e=performance.now(),t=e-d;m++,t>1e3&&(h=x&&!1===x.interpolate?m:1e3*m/t,m=0,d=e,n(h))}function u(e){h=e,n(h)}var d,p=e,h=0,m=0,g=0,v=0,w=performance.now(),C=0,y=document.createElement("div"),E=document.createElement("span"),S=document.createElement("div"),b=document.createTextNode(""),x=l?l.values[p.toLowerCase()]:null,N=new a(y,p,x),I=!1;return E.className="rs-counter-id",E.textContent=x&&x.caption?x.caption:p,S.className="rs-counter-value",S.appendChild(b),y.appendChild(E),y.appendChild(S),t?t.div.appendChild(y):f.appendChild(y),d=performance.now(),{set:u,start:r,tick:o,end:i,frame:s,value:function(){return h},draw:c}}function o(e){var n=e.toLowerCase();if(void 0===n&&(n="default"),m[n])return m[n];var a=null;l&&l.groups&&t(l.groups,function(e){var t=l.groups[parseInt(e,10)];a||-1===t.values.indexOf(n.toLowerCase())||(a=t)});var r=new i(n,a);return m[n]=r,r}function c(){t(l.plugins,function(e){l.plugins[e].update()}),t(m,function(e){m[e].draw()}),l&&l.fractions&&t(l.fractions,function(e){var n=l.fractions[parseInt(e,10)],a=[],r=m[n.base.toLowerCase()];r&&(r=r.value(),t(l.fractions[e].steps,function(t){var n=l.fractions[e].steps[parseInt(t,10)].toLowerCase(),i=m[n];i&&a.push(i.value()/r)})),n.graph.draw(a)})}var l=e||{},s=l.colours||["#850700","#c74900","#fcb300","#284280","#4c7c0c"],u=(l.CSSPath?l.CSSPath:"")+"rStats.css";(l.css||["https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700,300",u]).forEach(function(e){n(e)}),l.values||(l.values={});var d,f,p=10,h=200,m={};return function(){if(l.plugins){l.values||(l.values={}),l.groups||(l.groups=[]),l.fractions||(l.fractions=[]);for(var e=0;e<l.plugins.length;e++)l.plugins[e].attach(o),t(l.plugins[e].values,function(t){l.values[t]=l.plugins[e].values[t]}),l.groups=l.groups.concat(l.plugins[e].groups),l.fractions=l.fractions.concat(l.plugins[e].fractions)}else l.plugins={};d=document.createElement("div"),d.className="rs-base",f=document.createElement("div"),f.className="rs-container",f.style.height="auto",d.appendChild(f),document.body.appendChild(d),l&&(l.groups&&t(l.groups,function(e){var t=l.groups[parseInt(e,10)],n=document.createElement("div");n.className="rs-group",t.div=n;var a=document.createElement("h1");a.textContent=t.caption,a.addEventListener("click",function(e){this.classList.toggle("hidden"),e.preventDefault()}.bind(n)),f.appendChild(a),f.appendChild(n)}),l.fractions&&t(l.fractions,function(e){var n=l.fractions[parseInt(e,10)],a=document.createElement("div");a.className="rs-fraction";var i=document.createElement("div");i.className="rs-legend";var o=0;t(l.fractions[e].steps,function(t){var n=document.createElement("p");n.textContent=l.fractions[e].steps[t],n.style.color=s[o],i.appendChild(n),o++}),a.appendChild(i),a.style.height=o*p+"px",n.div=a;var c=new r(a,o);n.graph=c,f.appendChild(a)}))}(),function(e){return e?o(e):{element:d,update:c}}},"object"==typeof module&&(module.exports=window.rStats);
  2130. },{}],218:[function(_dereq_,module,exports){
  2131. String.prototype.startsWith||(String.prototype.startsWith=function(t,r){return r=r||0,this.substr(r,t.length)===t});
  2132. },{}],219:[function(_dereq_,module,exports){
  2133. var Util={};Util.base64=function(e,i){return"data:"+e+";base64,"+i},Util.isMobile=function(){var e=!1;return function(i){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(i)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(i.substr(0,4)))&&(e=!0)}(navigator.userAgent||navigator.vendor||window.opera),e},Util.isIOS=function(){return/(iPad|iPhone|iPod)/g.test(navigator.userAgent)},Util.isIFrame=function(){try{return window.self!==window.top}catch(e){return!0}},Util.appendQueryParameter=function(e,i,t){return e+=(e.indexOf("?")<0?"?":"&")+i+"="+t},Util.getQueryParameter=function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var i=new RegExp("[\\?&]"+e+"=([^&#]*)"),t=i.exec(location.search);return null===t?"":decodeURIComponent(t[1].replace(/\+/g," "))},Util.isLandscapeMode=function(){return 90==window.orientation||-90==window.orientation},module.exports=Util;
  2134. },{}],220:[function(_dereq_,module,exports){
  2135. function AndroidWakeLock(){var A=document.createElement("video");A.addEventListener("ended",function(){A.play()}),this.request=function(){A.paused&&(A.src=Util.base64("video/webm","GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4ECQoWBAhhTgGcBAAAAAAAH4xFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsggfG7AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU2LjQwLjEwMVdBjUxhdmY1Ni40MC4xMDFzpJAGSJTMbsLpDt/ySkipgX1fRImIQO1MAAAAAAAWVK5rAQAAAAAAADuuAQAAAAAAADLXgQFzxYEBnIEAIrWcg3VuZIaFVl9WUDmDgQEj44OEO5rKAOABAAAAAAAABrCBsLqBkB9DtnUBAAAAAAAAo+eBAKOmgQAAgKJJg0IAAV4BHsAHBIODCoAACmH2MAAAZxgz4dPSTFi5JACjloED6ACmAECSnABMQAADYAAAWi0quoCjloEH0ACmAECSnABNwAADYAAAWi0quoCjloELuACmAECSnABNgAADYAAAWi0quoCjloEPoACmAECSnABNYAADYAAAWi0quoCjloETiACmAECSnABNIAADYAAAWi0quoAfQ7Z1AQAAAAAAAJTnghdwo5aBAAAApgBAkpwATOAAA2AAAFotKrqAo5aBA+gApgBAkpwATMAAA2AAAFotKrqAo5aBB9AApgBAkpwATIAAA2AAAFotKrqAo5aBC7gApgBAkpwATEAAA2AAAFotKrqAo5aBD6AApgDAkpwAQ2AAA2AAAFotKrqAo5aBE4gApgBAkpwATCAAA2AAAFotKrqAH0O2dQEAAAAAAACU54Iu4KOWgQAAAKYAQJKcAEvAAANgAABaLSq6gKOWgQPoAKYAQJKcAEtgAANgAABaLSq6gKOWgQfQAKYAQJKcAEsAAANgAABaLSq6gKOWgQu4AKYAQJKcAEqAAANgAABaLSq6gKOWgQ+gAKYAQJKcAEogAANgAABaLSq6gKOWgROIAKYAQJKcAEnAAANgAABaLSq6gB9DtnUBAAAAAAAAlOeCRlCjloEAAACmAECSnABJgAADYAAAWi0quoCjloED6ACmAECSnABJIAADYAAAWi0quoCjloEH0ACmAMCSnABDYAADYAAAWi0quoCjloELuACmAECSnABI4AADYAAAWi0quoCjloEPoACmAECSnABIoAADYAAAWi0quoCjloETiACmAECSnABIYAADYAAAWi0quoAfQ7Z1AQAAAAAAAJTngl3Ao5aBAAAApgBAkpwASCAAA2AAAFotKrqAo5aBA+gApgBAkpwASAAAA2AAAFotKrqAo5aBB9AApgBAkpwAR8AAA2AAAFotKrqAo5aBC7gApgBAkpwAR4AAA2AAAFotKrqAo5aBD6AApgBAkpwAR2AAA2AAAFotKrqAo5aBE4gApgBAkpwARyAAA2AAAFotKrqAH0O2dQEAAAAAAACU54J1MKOWgQAAAKYAwJKcAENgAANgAABaLSq6gKOWgQPoAKYAQJKcAEbgAANgAABaLSq6gKOWgQfQAKYAQJKcAEagAANgAABaLSq6gKOWgQu4AKYAQJKcAEaAAANgAABaLSq6gKOWgQ+gAKYAQJKcAEZAAANgAABaLSq6gKOWgROIAKYAQJKcAEYAAANgAABaLSq6gB9DtnUBAAAAAAAAlOeCjKCjloEAAACmAECSnABF4AADYAAAWi0quoCjloED6ACmAECSnABFwAADYAAAWi0quoCjloEH0ACmAECSnABFoAADYAAAWi0quoCjloELuACmAECSnABFgAADYAAAWi0quoCjloEPoACmAMCSnABDYAADYAAAWi0quoCjloETiACmAECSnABFYAADYAAAWi0quoAfQ7Z1AQAAAAAAAJTngqQQo5aBAAAApgBAkpwARUAAA2AAAFotKrqAo5aBA+gApgBAkpwARSAAA2AAAFotKrqAo5aBB9AApgBAkpwARQAAA2AAAFotKrqAo5aBC7gApgBAkpwARQAAA2AAAFotKrqAo5aBD6AApgBAkpwAROAAA2AAAFotKrqAo5aBE4gApgBAkpwARMAAA2AAAFotKrqAH0O2dQEAAAAAAACU54K7gKOWgQAAAKYAQJKcAESgAANgAABaLSq6gKOWgQPoAKYAQJKcAESAAANgAABaLSq6gKOWgQfQAKYAwJKcAENgAANgAABaLSq6gKOWgQu4AKYAQJKcAERgAANgAABaLSq6gKOWgQ+gAKYAQJKcAERAAANgAABaLSq6gKOWgROIAKYAQJKcAEQgAANgAABaLSq6gB9DtnUBAAAAAAAAlOeC0vCjloEAAACmAECSnABEIAADYAAAWi0quoCjloED6ACmAECSnABEAAADYAAAWi0quoCjloEH0ACmAECSnABD4AADYAAAWi0quoCjloELuACmAECSnABDwAADYAAAWi0quoCjloEPoACmAECSnABDoAADYAAAWi0quoCjloETiACmAECSnABDgAADYAAAWi0quoAcU7trAQAAAAAAABG7j7OBALeK94EB8YIBd/CBAw=="),A.play())},this.release=function(){A.pause(),A.src=""}}function iOSWakeLock(){var A=null;this.request=function(){A||(A=setInterval(function(){window.location.href="/",setTimeout(window.stop,0)},15e3))},this.release=function(){A&&(clearInterval(A),A=null)}}function getWakeLock(){var A=navigator.userAgent||navigator.vendor||window.opera;return A.match(/iPhone/i)||A.match(/iPod/i)?iOSWakeLock:AndroidWakeLock}var Util=_dereq_("./util.js");module.exports=getWakeLock();
  2136. },{"./util.js":219}]},{},[177])(177)
  2137. });
  2138. //# sourceMappingURL=aframe-master.min.js.map