diff --git a/dist/altspace.js b/dist/altspace.js index 9bce848d..04cb5302 100644 --- a/dist/altspace.js +++ b/dist/altspace.js @@ -266,11 +266,11 @@ U.prototype.We=function(a,b){x("Firebase.resetPassword",2,2,arguments.length);fg /*!Please JS v0.4.2, Jordan Checkman 2014, Checkman.io, MIT License, Have fun.*/ !function(e,r,a){"function"==typeof define&&define.amd?define([],a):"object"==typeof exports?module.exports=a():r[e]=a()}("Please",this,function(){"use strict";function e(){function e(e,r,a){var o=Math.random;return a instanceof l&&(o=a.random),Math.floor(o()*(r-e+1))+e}function r(e,r,a){var o=Math.random;return a instanceof l&&(o=a.random),o()*(r-e)+e}function a(e,r,a){return Math.max(r,Math.min(e,a))}function o(e,r){var a;switch(e){case"hex":for(a=0;a=128?"dark":"light"}function t(e){var r={};for(var a in e)e.hasOwnProperty(a)&&(r[a]=e[a]);return r}function l(e){function r(){o=(o+1)%256,n=(n+a[o])%256;var e=a[o];return a[o]=a[n],a[n]=e,a[(a[o]+a[n])%256]}for(var a=[],o=0,n=0,t=0;256>t;t++)a[t]=t;for(var l=0,F=0;256>l;l++){F=(F+a[l]+e.charCodeAt(l%e.length))%256;var s=a[l];a[l]=a[F],a[F]=s}this.random=function(){for(var e=0,a=0,o=1;8>e;e++)a+=r()*o,o*=256;return a/0x10000000000000000}}var F={},s={aliceblue:"F0F8FF",antiquewhite:"FAEBD7",aqua:"00FFFF",aquamarine:"7FFFD4",azure:"F0FFFF",beige:"F5F5DC",bisque:"FFE4C4",black:"000000",blanchedalmond:"FFEBCD",blue:"0000FF",blueviolet:"8A2BE2",brown:"A52A2A",burlywood:"DEB887",cadetblue:"5F9EA0",chartreuse:"7FFF00",chocolate:"D2691E",coral:"FF7F50",cornflowerblue:"6495ED",cornsilk:"FFF8DC",crimson:"DC143C",cyan:"00FFFF",darkblue:"00008B",darkcyan:"008B8B",darkgoldenrod:"B8860B",darkgray:"A9A9A9",darkgrey:"A9A9A9",darkgreen:"006400",darkkhaki:"BDB76B",darkmagenta:"8B008B",darkolivegreen:"556B2F",darkorange:"FF8C00",darkorchid:"9932CC",darkred:"8B0000",darksalmon:"E9967A",darkseagreen:"8FBC8F",darkslateblue:"483D8B",darkslategray:"2F4F4F",darkslategrey:"2F4F4F",darkturquoise:"00CED1",darkviolet:"9400D3",deeppink:"FF1493",deepskyblue:"00BFFF",dimgray:"696969",dimgrey:"696969",dodgerblue:"1E90FF",firebrick:"B22222",floralwhite:"FFFAF0",forestgreen:"228B22",fuchsia:"FF00FF",gainsboro:"DCDCDC",ghostwhite:"F8F8FF",gold:"FFD700",goldenrod:"DAA520",gray:"808080",grey:"808080",green:"008000",greenyellow:"ADFF2F",honeydew:"F0FFF0",hotpink:"FF69B4",indianred:"CD5C5C",indigo:"4B0082",ivory:"FFFFF0",khaki:"F0E68C",lavender:"E6E6FA",lavenderblush:"FFF0F5",lawngreen:"7CFC00",lemonchiffon:"FFFACD",lightblue:"ADD8E6",lightcoral:"F08080",lightcyan:"E0FFFF",lightgoldenrodyellow:"FAFAD2",lightgray:"D3D3D3",lightgrey:"D3D3D3",lightgreen:"90EE90",lightpink:"FFB6C1",lightsalmon:"FFA07A",lightseagreen:"20B2AA",lightskyblue:"87CEFA",lightslategray:"778899",lightslategrey:"778899",lightsteelblue:"B0C4DE",lightyellow:"FFFFE0",lime:"00FF00",limegreen:"32CD32",linen:"FAF0E6",magenta:"FF00FF",maroon:"800000",mediumaquamarine:"66CDAA",mediumblue:"0000CD",mediumorchid:"BA55D3",mediumpurple:"9370D8",mediumseagreen:"3CB371",mediumslateblue:"7B68EE",mediumspringgreen:"00FA9A",mediumturquoise:"48D1CC",mediumvioletred:"C71585",midnightblue:"191970",mintcream:"F5FFFA",mistyrose:"FFE4E1",moccasin:"FFE4B5",navajowhite:"FFDEAD",navy:"000080",oldlace:"FDF5E6",olive:"808000",olivedrab:"6B8E23",orange:"FFA500",orangered:"FF4500",orchid:"DA70D6",palegoldenrod:"EEE8AA",palegreen:"98FB98",paleturquoise:"AFEEEE",palevioletred:"D87093",papayawhip:"FFEFD5",peachpuff:"FFDAB9",peru:"CD853F",pink:"FFC0CB",plum:"DDA0DD",powderblue:"B0E0E6",purple:"800080",rebeccapurple:"663399",red:"FF0000",rosybrown:"BC8F8F",royalblue:"4169E1",saddlebrown:"8B4513",salmon:"FA8072",sandybrown:"F4A460",seagreen:"2E8B57",seashell:"FFF5EE",sienna:"A0522D",silver:"C0C0C0",skyblue:"87CEEB",slateblue:"6A5ACD",slategray:"708090",slategrey:"708090",snow:"FFFAFA",springgreen:"00FF7F",steelblue:"4682B4",tan:"D2B48C",teal:"008080",thistle:"D8BFD8",tomato:"FF6347",turquoise:"40E0D0",violet:"EE82EE",wheat:"F5DEB3",white:"FFFFFF",whitesmoke:"F5F5F5",yellow:"FFFF00",yellowgreen:"9ACD32"},i=.618033988749895,u={hue:null,saturation:null,value:null,base_color:"",greyscale:!1,grayscale:!1,golden:!0,full_random:!1,colors_returned:1,format:"hex",seed:null},c={scheme_type:"analogous",format:"hex"},h={golden:!1,format:"hex"};return F.NAME_to_HEX=function(e){return e=e.toLowerCase(),e in s?s[e]:(console.error("Color name not recognized."),void 0)},F.NAME_to_RGB=function(e){return F.HEX_to_RGB(F.NAME_to_HEX(e))},F.NAME_to_HSV=function(e){return F.HEX_to_HSV(F.NAME_to_HEX(e))},F.HEX_to_RGB=function(e){var r=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;e=e.replace(r,function(e,r,a,o){return r+r+a+a+o+o});var a=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return a?{r:parseInt(a[1],16),g:parseInt(a[2],16),b:parseInt(a[3],16)}:null},F.RGB_to_HEX=function(e){return"#"+((1<<24)+(e.r<<16)+(e.g<<8)+e.b).toString(16).slice(1)},F.HSV_to_RGB=function(e){var r,a,o,n,t,l,F,s,i=e.h,u=e.s,c=e.v;if(0===u)return{r:c,g:c,b:c};switch(i/=60,n=Math.floor(i),t=i-n,l=c*(1-u),F=c*(1-u*t),s=c*(1-u*(1-t)),n){case 0:r=c,a=s,o=l;break;case 1:r=F,a=c,o=l;break;case 2:r=l,a=c,o=s;break;case 3:r=l,a=F,o=c;break;case 4:r=s,a=l,o=c;break;case 5:r=c,a=l,o=F}return{r:Math.floor(255*r),g:Math.floor(255*a),b:Math.floor(255*o)}},F.RGB_to_HSV=function(e){var r=e.r/255,a=e.g/255,o=e.b/255,n=0,t=0,l=0,F=Math.min(r,Math.min(a,o)),s=Math.max(r,Math.max(a,o));if(F===s)return l=F,{h:0,s:0,v:l};var i=r===F?a-o:o===F?r-a:o-r,u=r===F?3:o===F?1:5;return n=60*(u-i/(s-F)),t=(s-F)/s,l=s,{h:n,s:t,v:l}},F.HSV_to_HEX=function(e){return F.RGB_to_HEX(F.HSV_to_RGB(e))},F.HEX_to_HSV=function(e){return F.RGB_to_HSV(F.HEX_to_RGB(e))},F.make_scheme=function(e,r){function n(e){return{h:e.h,s:e.s,v:e.v}}var l,F,s,i,u,h=t(c);if(null!==r)for(var d in r)r.hasOwnProperty(d)&&(h[d]=r[d]);var g=[e];switch(h.scheme_type.toLowerCase()){case"monochromatic":case"mono":for(u=1;2>=u;u++)l=n(e),s=l.s+.1*u,s=a(s,0,1),i=l.v+.1*u,i=a(i,0,1),l.s=s,l.v=i,g.push(l);for(u=1;2>=u;u++)l=n(e),s=l.s-.1*u,s=a(s,0,1),i=l.v-.1*u,i=a(i,0,1),l.s=s,l.v=i,g.push(l);break;case"complementary":case"complement":case"comp":l=n(e),l.h=(l.h+180)%360,g.push(l);break;case"split-complementary":case"split-complement":case"split":l=n(e),l.h=(l.h+165)%360,g.push(l),l=n(e),l.h=Math.abs((l.h-165)%360),g.push(l);break;case"double-complementary":case"double-complement":case"double":l=n(e),l.h=(l.h+180)%360,g.push(l),l.h=(l.h+30)%360,F=n(l),g.push(l),l.h=(l.h+180)%360,g.push(F);break;case"analogous":case"ana":for(u=1;5>=u;u++)l=n(e),l.h=(l.h+20*u)%360,g.push(l);break;case"triadic":case"triad":case"tri":for(u=1;3>u;u++)l=n(e),l.h=(l.h+120*u)%360,g.push(l);break;default:console.error("Color scheme not recognized.")}return o(h.format.toLowerCase(),g),g},F.make_color=function(n){var s=[],c=t(u),h=null;if(null!==n)for(var d in n)n.hasOwnProperty(d)&&(c[d]=n[d]);var g=null;"string"==typeof c.seed&&(g=new l(c.seed)),c.base_color.length>0&&(h=c.base_color.match(/^#?([0-9a-f]{3})([0-9a-f]{3})?$/i)?F.HEX_to_HSV(c.base_color):F.NAME_to_HSV(c.base_color));for(var m=0;m65535?t:String.fromCharCode(n)}),t=t.replace(/%([cd][0-9a-f])%([89ab][0-9a-f])/gi,function(t,r,o){var e=parseInt(r,16)-192;if(e<2)return t;var s=parseInt(o,16)-128;return String.fromCharCode((e<<6)+s)}),t=t.replace(/%([0-7][0-9a-f])/gi,function(t,r){return String.fromCharCode(parseInt(r,16))})},s=function(t){var r=t.query;t.query=new function(t){for(var r,o=/([^=&]+)(=([^&]*))?/g;r=o.exec(t);){var s=decodeURIComponent(r[1].replace(/\+/g," ")),a=r[3]?e(r[3]):"";null!=this[s]?(this[s]instanceof Array||(this[s]=[this[s]]),this[s].push(a)):this[s]=a}this.clear=function(){for(s in this)this[s]instanceof Function||delete this[s]},this.toString=function(){var t="",r=encodeURIComponent;for(var o in this)if(!(this[o]instanceof Function))if(this[o]instanceof Array){var e=this[o].length;if(e)for(var s=0;sa.Mc,"Stacking an older write on top of newer ones"),n(s)||(s=!0),a.na.push({path:e,Ga:i,kd:r,visible:s}),s&&(a.T=Ue(a.T,e,i)),a.Mc=r,o?mf(t,new Wb(Pe,e,i)):[]}function nf(t,e,n,i){var r=t.jb;return K(i>r.Mc,"Stacking an older merge on top of newer ones"),r.na.push({path:e,children:n,kd:i,visible:!0}),r.T=Ve(r.T,e,n),r.Mc=i,n=De(n),mf(t,new xe(Pe,e,n))}function of(t,e,n){n=n||!1;var i=af(t.jb,e);if(t.jb.Rd(e)){var r=Nd;return null!=i.Ga?r=r.set(G,!0):ib(i.children,function(t,e){r=r.set(new L(t),e)}),mf(t,new Oe(i.path,r,n))}return[]}function pf(t,e,n){return n=De(n),mf(t,new xe(Re,e,n))}function qf(t,e,n,i){if(i=rf(t,i),null!=i){var r=sf(i);return i=r.path,r=r.Ib,e=O(i,e),n=new Wb(new Qe(!1,!0,r,!0),e,n),tf(t,i,n)}return[]}function uf(t,e,n,i){if(i=rf(t,i)){var r=sf(i);return i=r.path,r=r.Ib,e=O(i,e),n=De(n),n=new xe(new Qe(!1,!0,r,!0),e,n),tf(t,i,n)}return[]}function yf(t){return Ge(t,function(t,e,n){if(e&&null!=gf(e))return[gf(e)];var i=[];return e&&(i=hf(e)),r(n,function(t){i=i.concat(t)}),i})}function Bf(t,e){for(var n=0;n10485760/3&&10485760=t}else if(-1=t;return!1}function tg(){var t,e=window.opener.frames;for(t=e.length-1;t>=0;t--)try{if(e[t].location.protocol===window.location.protocol&&e[t].location.host===window.location.host&&"__winchan_relay_frame"===e[t].name)return e[t]}catch(n){}return null}function ug(t,e,n){t.attachEvent?t.attachEvent("on"+e,n):t.addEventListener&&t.addEventListener(e,n,!1)}function vg(t,e,n){t.detachEvent?t.detachEvent("on"+e,n):t.removeEventListener&&t.removeEventListener(e,n,!1)}function wg(t){/^https?:\/\//.test(t)||(t=window.location.href);var e=/^(https?:\/\/[\-_a-zA-Z\.0-9:]+)/.exec(t);return e?e[1]:t}function xg(t){var e="";try{t=t.replace("#","");var n=lb(t);n&&v(n,"__firebase_request_key")&&(e=w(n,"__firebase_request_key"))}catch(i){}return e}function yg(){var t=Qc(kg);return t.scheme+"://"+t.host+"/v2"}function zg(t){return yg()+"/"+t+"/auth/channel"}function Ag(t){var e=this;if(this.Ac=t,this.de="*",sg(8)?this.Rc=this.zd=tg():(this.Rc=window.opener,this.zd=window),!e.Rc)throw"Unable to find relay frame";ug(this.zd,"message",q(this.ic,this)),ug(this.zd,"message",q(this.Bf,this));try{Bg(this,{a:"ready"})}catch(n){ug(this.Rc,"load",function(){Bg(e,{a:"ready"})})}ug(window,"unload",q(this.zg,this))}function Bg(t,e){e=B(e),sg(8)?t.Rc.doPost(e,t.de):t.Rc.postMessage(e,t.de)}function Cg(t){this.pc=Ga()+Ga()+Ga(),this.Ef=t}function Eg(t){var e=Error(w(Dg,t),t);return e.code=t,e}function Fg(t){var e;(e=!t.window_features)||(e=pg(),e=-1!==e.indexOf("Fennec/")||-1!==e.indexOf("Firefox/")&&-1!==e.indexOf("Android")),e&&(t.window_features=void 0),t.window_name||(t.window_name="_blank"),this.options=t}function Gg(t){t.method||(t.method="GET"),t.headers||(t.headers={}),t.headers.content_type||(t.headers.content_type="application/json"),t.headers.content_type=t.headers.content_type.toLowerCase(),this.options=t}function Hg(t){this.pc=Ga()+Ga()+Ga(),this.Ef=t}function Ig(t){t.callback_parameter||(t.callback_parameter="callback"),this.options=t,window.__firebase_auth_jsonp=window.__firebase_auth_jsonp||{}}function Jg(t,e,n){setTimeout(function(){try{var i=document.createElement("script");i.type="text/javascript",i.id=t,i.async=!0,i.src=e,i.onerror=function(){var e=document.getElementById(t);null!==e&&e.parentNode.removeChild(e),n&&n(Eg("NETWORK_ERROR"))};var r=document.getElementsByTagName("head");(r&&0!=r.length?r[0]:document.documentElement).appendChild(i)}catch(o){n&&n(Eg("NETWORK_ERROR"))}},0)}function Kg(t,e,n,i){Lf.call(this,["auth_status"]),this.F=t,this.ef=e,this.Tg=n,this.Me=i,this.sc=new og(t,[Cc,P]),this.nb=null,this.Te=!1,Lg(this)}function Lg(t){P.get("redirect_request_id")&&Mg(t);var e=t.sc.get();e&&e.token?(Ng(t,e),t.ef(e.token,function(n,i){Og(t,n,i,!1,e.token,e)},function(e,n){Pg(t,"resumeSession()",e,n)})):Ng(t,null)}function Qg(t,e,n,i,r,o){"firebaseio-demo.com"===t.F.domain&&Q("Firebase authentication is not supported on demo Firebases (*.firebaseio-demo.com). To secure your Firebase, create a production Firebase at https://www.firebase.com."),t.ef(e,function(o,a){Og(t,o,a,!0,e,n,i||{},r)},function(e,n){Pg(t,"auth()",e,n,o)})}function Rg(t,e){t.sc.clear(),Ng(t,null),t.Tg(function(t,n){if("ok"===t)R(e,null);else{var i=(t||"error").toUpperCase(),r=i;n&&(r+=": "+n),r=Error(r),r.code=i,R(e,r)}})}function Og(t,e,n,i,r,o,a,s){"ok"===e?(i&&(e=n.auth,o.auth=e,o.expires=n.expires,o.token=bd(r)?r:"",n=null,e&&v(e,"uid")?n=w(e,"uid"):v(o,"uid")&&(n=w(o,"uid")),o.uid=n,n="custom",e&&v(e,"provider")?n=w(e,"provider"):v(o,"provider")&&(n=w(o,"provider")),o.provider=n,t.sc.clear(),bd(r)&&(a=a||{},n=Cc,"sessionOnly"===a.remember&&(n=P),"none"!==a.remember&&t.sc.set(o,n)),Ng(t,o)),R(s,null,o)):(t.sc.clear(),Ng(t,null),o=t=(e||"error").toUpperCase(),n&&(o+=": "+n),o=Error(o),o.code=t,R(s,o))}function Pg(t,e,n,i,r){Q(e+" was canceled: "+i),t.sc.clear(),Ng(t,null),t=Error(i),t.code=n.toUpperCase(),R(r,t)}function Sg(t,e,n,i,r){Tg(t),n=new lg(i||{},{},n||{}),Ug(t,[Gg,Ig],"/auth/"+e,n,r)}function Vg(t,e,n,i){Tg(t);var r=[Fg,Hg];n=ng(n),"anonymous"===e||"password"===e?setTimeout(function(){R(i,Eg("TRANSPORT_UNAVAILABLE"))},0):(n.fe.window_features="menubar=yes,modal=yes,alwaysRaised=yeslocation=yes,resizable=yes,scrollbars=yes,status=yes,height=625,width=625,top="+("object"==typeof screen?.5*(screen.height-625):0)+",left="+("object"==typeof screen?.5*(screen.width-625):0),n.fe.relay_url=zg(t.F.Db),n.fe.requestWithCredential=q(t.qc,t),Ug(t,r,"/auth/"+e,n,i))}function Mg(t){var e=P.get("redirect_request_id");if(e){var n=P.get("redirect_client_options");P.remove("redirect_request_id"),P.remove("redirect_client_options");var i=[Gg,Ig],e={requestId:e,requestKey:xg(document.location.hash)},n=new lg(n,{},e);t.Te=!0;try{document.location.hash=document.location.hash.replace(/&__firebase_request_key=([a-zA-z0-9]*)/,"")}catch(r){}Ug(t,i,"/auth/session",n,function(){this.Te=!1}.bind(t))}}function Ug(t,e,n,i,r){Wg(t,e,n,i,function(e,n){!e&&n&&n.token&&n.uid?Qg(t,n.token,n,i.od,function(t,e){t?R(r,t):R(r,null,e)}):R(r,e||Eg("UNKNOWN_ERROR"))})}function Wg(t,e,n,i,r){e=Pa(e,function(t){return"function"==typeof t.isAvailable&&t.isAvailable()}),0===e.length?setTimeout(function(){R(r,Eg("TRANSPORT_UNAVAILABLE"))},0):(e=new(e.shift())(i.fe),i=jb(i.$a),i.v="js-"+hb,i.transport=e.Cc(),i.suppress_status_codes=!0,t=yg()+"/"+t.F.Db+n,e.open(t,i,function(t,e){if(t)R(r,t);else if(e&&e.error){var n=Error(e.error.message);n.code=e.error.code,n.details=e.error.details,R(r,n)}else R(r,null,e)}))}function Ng(t,e){var n=null!==t.nb||null!==e;t.nb=e,n&&t.ge("auth_status",e),t.Me(null!==e)}function Tg(t){var e=t.F;if("firebaseio.com"!==e.domain&&"firebaseio-demo.com"!==e.domain&&"auth.firebase.com"===kg)throw Error("This custom Firebase server ('"+t.F.domain+"') does not support delegated login.")}function Xg(t){this.ic=t,this.Nd=[],this.Sb=0,this.re=-1,this.Gb=null}function Yg(t,e,n){t.re=e,t.Gb=n,t.redocument.domain="'+document.domain+'";'),t=""+t+"";try{this.Ea.fb.open(),this.Ea.fb.write(t),this.Ea.fb.close()}catch(o){Cb("frame writing exception"),o.stack&&Cb(o.stack),Cb(o)}}function fh(t){if(t.me&&t.Xd&&t.Qe.count()<(0=t.ad[0].kf.length+30+n.length;){var r=t.ad.shift(),n=n+"&seg"+i+"="+r.Kg+"&ts"+i+"="+r.Sg+"&d"+i+"="+r.kf;i++}return gh(t,e+n,t.ue),!0}return!1}function gh(t,e,n){function i(){t.Qe.remove(n),fh(t)}t.Qe.add(n,1);var r=setTimeout(i,Math.floor(25e3));eh(t,e,function(){clearTimeout(r),i()})}function eh(t,e,n){setTimeout(function(){try{if(t.Xd){var i=t.Ea.fb.createElement("script");i.type="text/javascript",i.async=!0,i.src=e,i.onload=i.onreadystatechange=function(){var t=i.readyState;t&&"loaded"!==t&&"complete"!==t||(i.onload=i.onreadystatechange=null,i.parentNode&&i.parentNode.removeChild(i),n())},i.onerror=function(){Cb("Long-poll script failed to load: "+e),t.Xd=!1,t.close()},t.Ea.fb.body.appendChild(i)}}catch(r){}},Math.floor(1))}function ih(t,e,n){this.se=t,this.f=Nc(this.se),this.frames=this.Kc=null,this.ob=this.pb=this.cf=0,this.Va=Qb(e),this.eb=(e.lb?"wss://":"ws://")+e.Pa+"/.ws?v=5","undefined"!=typeof location&&location.href&&-1!==location.href.indexOf("firebaseio.com")&&(this.eb+="&r=f"),e.host!==e.Pa&&(this.eb=this.eb+"&ns="+e.Db),n&&(this.eb=this.eb+"&s="+n)}function lh(t,e){if(t.frames.push(e),t.frames.length==t.cf){var n=t.frames.join("");t.frames=null,n=nb(n),t.xg(n)}}function kh(t){clearInterval(t.Kc),t.Kc=setInterval(function(){t.ua&&t.ua.send("0"),kh(t)},Math.floor(45e3))}function mh(t){nh(this,t)}function nh(t,e){var n=ih&&ih.isAvailable(),i=n&&!(Cc.wf||!0===Cc.get("previous_websocket_failure"));if(e.Ug&&(n||Q("wss:// URL used, but browser isn't known to support websockets. Trying anyway."),i=!0),i)t.gd=[ih];else{var r=t.gd=[];Xc(oh,function(t,e){e&&e.isAvailable()&&r.push(e)})}}function ph(t){if(00&&(t.yd=setTimeout(function(){t.yd=null,t.Bb||(t.I&&102400=t.Mf?(t.f("Secondary connection is healthy."),t.Bb=!0,t.D.Ed(),t.D.start(),t.f("sending client ack on secondary"),t.D.send({t:"c",d:{t:"a",d:{}}}),t.f("Ending transmission on primary"),t.I.send({t:"c",d:{t:"n",d:{}}}),t.hd=t.D,wh(t)):(t.f("sending ping on secondary."),t.D.send({t:"c",d:{t:"p",d:{}}}))}function yh(t){t.Bb||(t.Se--,0>=t.Se&&(t.f("Primary connection is healthy."),t.Bb=!0,t.I.Ed()))}function vh(t,e){t.D=new e("c:"+t.id+":"+t.ff++,t.F,t.Zd),t.Mf=e.responsesRequiredToBeHealthy||0,t.D.open(sh(t,t.D),th(t,t.D)),setTimeout(function(){t.D&&(t.f("Timed out trying to upgrade."),t.D.close())},Math.floor(6e4))}function uh(t,e,n){t.f("Realtime connection established."),t.I=e,t.Ua=1,t.Wc&&(t.Wc(n),t.Wc=null),0===t.Se?(t.f("Primary connection is healthy."),t.Bb=!0):setTimeout(function(){zh(t)},Math.floor(5e3))}function zh(t){t.Bb||1!==t.Ua||(t.f("sending ping on primary."),Bh(t,{t:"c",d:{t:"p",d:{}}}))}function Bh(t,e){if(1!==t.Ua)throw"Connection is not connected";t.hd.send(e)}function xh(t){t.f("Shutting down all connections"),t.I&&(t.I.close(),t.I=null),t.D&&(t.D.close(),t.D=null),t.yd&&(clearTimeout(t.yd),t.yd=null)}function Ch(t,e,n,i){this.id=Dh++,this.f=Nc("p:"+this.id+":"),this.xf=this.Fe=!1,this.$={},this.qa=[],this.Yc=0,this.Vc=[],this.oa=!1,this.Za=1e3,this.Fd=3e5,this.Hb=e,this.Uc=n,this.Pe=i,this.F=t,this.tb=this.Aa=this.Ia=this.Xe=null,this.Ob=!1,this.Td={},this.Jg=0,this.nf=!0,this.Lc=this.He=null,Eh(this,0),Pf.vb().Fb("visible",this.Ag,this),-1===t.host.indexOf("fblocal")&&Of.vb().Fb("online",this.yg,this)}function Gh(t,e){var n=e.Gg,i=n.path.toString(),r=n.va();t.f("Listen on "+i+" for "+r);var o={p:i};e.tag&&(o.q=ce(n.o),o.t=e.tag),o.h=e.xd(),t.Fa("q",o,function(o){var a=o.d,s=o.s;if(a&&"object"==typeof a&&v(a,"w")){var c=w(a,"w");ea(c)&&0<=Na(c,"no_index")&&Q("Using an unspecified index. Consider adding "+('".indexOn": "'+n.o.g.toString()+'"')+" at "+n.path.toString()+" to your security rules for better performance")}(t.$[i]&&t.$[i][r])===e&&(t.f("listen response",o),"ok"!==s&&Hh(t,i,r),e.G&&e.G(s,a))})}function Ih(t){var e=t.Aa;t.oa&&e&&t.Fa("auth",{cred:e.gg},function(n){var i=n.s;n=n.d||"error","ok"!==i&&t.Aa===e&&delete t.Aa,e.of?"ok"!==i&&e.md&&e.md(i,n):(e.of=!0,e.zc&&e.zc(i,n))})}function Jh(t,e,n,i,r){n={p:n,d:i},t.f("onDisconnect "+e,n),t.Fa(e,n,function(t){r&&setTimeout(function(){r(t.s,t.d)},Math.floor(0))})}function Kh(t,e,i,r,o,a){r={p:i,d:r},n(a)&&(r.h=a),t.qa.push({action:e,Jf:r,G:o}),t.Yc++,e=t.qa.length-1,t.oa?Lh(t,e):t.f("Buffering put: "+i)}function Lh(t,e){var n=t.qa[e].action,i=t.qa[e].Jf,r=t.qa[e].G;t.qa[e].Hg=t.oa,t.Fa(n,i,function(i){t.f(n+" response",i),delete t.qa[e],t.Yc--,0===t.Yc&&(t.qa=[]),r&&r(i.s,i.d)})}function Eh(t,e){K(!t.Ia,"Scheduling a connect when we're already connected/ing?"),t.tb&&clearTimeout(t.tb),t.tb=setTimeout(function(){t.tb=null,Oh(t)},Math.floor(e))}function Oh(t){if(Ph(t)){t.f("Making a connection attempt"),t.He=(new Date).getTime(),t.Lc=null;var e=q(t.Id,t),n=q(t.Wc,t),i=q(t.Df,t),r=t.id+":"+Fh++;t.Ia=new qh(r,t.F,e,n,i,function(e){Q(e+" ("+t.F.toString()+")"),t.xf=!0})}}function Mh(t,e,n){n=n?Qa(n,function(t){return Vc(t)}).join("$"):"default",(t=Hh(t,e,n))&&t.G&&t.G("permission_denied")}function Hh(t,e,i){e=new L(e).toString();var r;return n(t.$[e])?(r=t.$[e][i],delete t.$[e][i],0===pa(t.$[e])&&delete t.$[e]):r=void 0,r}function Nh(t){Ih(t),r(t.$,function(e){r(e,function(e){Gh(t,e)})});for(var e=0;e.firebaseio.com instead"),n&&"undefined"!=n||Pc("Cannot parse Firebase url. Please use https://.firebaseio.com"),i.lb||"undefined"!=typeof window&&window.location&&window.location.protocol&&-1!==window.location.protocol.indexOf("https:")&&Q("Insecure Firebase access from a secure page. Please use https in calls to new Firebase()."),n=new Dc(i.host,i.lb,n,"ws"===i.scheme||"wss"===i.scheme),i=new L(i.$c),r=i.toString();var o;if(!(o=!p(n.host)||0===n.host.length||!Tf(n.Db))&&(o=0!==r.length)&&(r&&(r=r.replace(/^\/*\.info(\/|$)/,"/")),o=!(p(r)&&0!==r.length&&!Rf.test(r))),o)throw Error(z("new Firebase",1,!1)+'must be a valid firebase URL and the path can\'t contain ".", "#", "$", "[", or "]".');if(e)if(e instanceof W)r=e;else{if(!p(e))throw Error("Expected a valid Firebase.Context for second argument to new Firebase()");r=W.vb(),n.Od=e}else r=W.vb();o=n.toString();var a=w(r.oc,o);a||(a=new Qh(n,r.Qf),r.oc[o]=a),n=a}Y.call(this,n,i,$d,!1)}function Mc(t,e){K(!e||!0===t||!1===t,"Can't turn on custom loggers persistently."),!0===t?("undefined"!=typeof console&&("function"==typeof console.log?Bb=q(console.log,console):"object"==typeof console.log&&(Bb=function(t){console.log(t)})),e&&P.set("logging_enabled",!0)):t?Bb=t:(Bb=null,P.remove("logging_enabled"))}var g,aa=this,la=Date.now||function(){return+new Date},ya="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),Ea={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"," ":"\\u000b"},Fa=/\uffff/.test("￿")?/[\\\"\x00-\x1f\x7f-\uffff]/g:/[\\\"\x00-\x1f\x7f-\xff]/g,Ha;t:{var Ia=aa.navigator;if(Ia){var Ja=Ia.userAgent;if(Ja){Ha=Ja;break t}}Ha=""}ma(La,Ka),La.prototype.reset=function(){this.P[0]=1732584193,this.P[1]=4023233417,this.P[2]=2562383102,this.P[3]=271733878,this.P[4]=3285377520,this.ee=this.ac=0},La.prototype.update=function(t,e){if(null!=t){n(e)||(e=t.length);for(var i=e-this.Wa,r=0,o=this.ne,a=this.ac;e>r;){if(0==a)for(;i>=r;)Ma(this,t,r),r+=this.Wa;if(p(t)){for(;e>r;)if(o[a]=t.charCodeAt(r),++a,++r,a==this.Wa){Ma(this,o),a=0;break}}else for(;e>r;)if(o[a]=t[r],++a,++r,a==this.Wa){Ma(this,o),a=0;break}}this.ac=a,this.ee+=e}};var u=Array.prototype,Na=u.indexOf?function(t,e,n){return u.indexOf.call(t,e,n)}:function(t,e,n){if(n=null==n?0:0>n?Math.max(0,t.length+n):n,p(t))return p(e)&&1==e.length?t.indexOf(e,n):-1;for(;no;o++)o in r&&e.call(n,r[o],o,t)},Pa=u.filter?function(t,e,n){return u.filter.call(t,e,n)}:function(t,e,n){for(var i=t.length,r=[],o=0,a=p(t)?t.split(""):t,s=0;i>s;s++)if(s in a){var c=a[s];e.call(n,c,s,t)&&(r[o++]=c)}return r},Qa=u.map?function(t,e,n){return u.map.call(t,e,n)}:function(t,e,n){for(var i=t.length,r=Array(i),o=p(t)?t.split(""):t,a=0;i>a;a++)a in o&&(r[a]=e.call(n,o[a],a,t));return r},Ra=u.reduce?function(t,e,n,i){for(var r=[],o=1,a=arguments.length;a>o;o++)r.push(arguments[o]);return i&&(r[0]=q(e,i)),u.reduce.apply(t,r)}:function(t,e,n,i){var r=n;return Oa(t,function(n,o){r=e.call(i,r,n,o,t)}),r},Sa=u.every?function(t,e,n){return u.every.call(t,e,n)}:function(t,e,n){for(var i=t.length,r=p(t)?t.split(""):t,o=0;i>o;o++)if(o in r&&!e.call(n,r[o],o,t))return!1;return!0},Za=-1!=Ha.indexOf("Opera")||-1!=Ha.indexOf("OPR"),$a=-1!=Ha.indexOf("Trident")||-1!=Ha.indexOf("MSIE"),ab=-1!=Ha.indexOf("Gecko")&&-1==Ha.toLowerCase().indexOf("webkit")&&!(-1!=Ha.indexOf("Trident")||-1!=Ha.indexOf("MSIE")),bb=-1!=Ha.toLowerCase().indexOf("webkit");!function(){var t,e="";return Za&&aa.opera?(e=aa.opera.version,ha(e)?e():e):(ab?t=/rv\:([^\);]+)(\)|;)/:$a?t=/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/:bb&&(t=/WebKit\/(\S+)/),t&&(e=(e=t.exec(Ha))?e[1]:""),$a&&(t=(t=aa.document)?t.documentMode:void 0,t>parseFloat(e))?String(t):e)}();var cb=null,db=null,eb=null,hb=hb||"2.2.9";ob.prototype.j=function(t){return this.Wd.Y(t)},ob.prototype.toString=function(){return this.Wd.toString()},pb.prototype.qf=function(){return null},pb.prototype.ze=function(){return null};var qb=new pb;rb.prototype.qf=function(t){var e=this.Ka.Q;return sb(e,t)?e.j().J(t):(e=null!=this.Kd?new tb(this.Kd,!0,!1):this.Ka.C(),this.Rf.xc(t,e))},rb.prototype.ze=function(t,e,n){var i=null!=this.Kd?this.Kd:ub(this.Ka);return t=this.Rf.oe(i,e,1,n,t),0===t.length?null:t[0]},xb.prototype.add=function(t){this.vd.push(t)},xb.prototype.Zb=function(){return this.ra};var Fb="value";Gb.prototype.Zb=function(){var t=this.$d.mc();return"value"===this.ud?t.path:t.parent().path},Gb.prototype.Ae=function(){return this.ud},Gb.prototype.Vb=function(){return this.ve.Vb(this)},Gb.prototype.toString=function(){return this.Zb().toString()+":"+this.ud+":"+B(this.$d.mf())},Hb.prototype.Zb=function(){return this.path},Hb.prototype.Ae=function(){return"cancel"},Hb.prototype.Vb=function(){return this.ve.Vb(this)},Hb.prototype.toString=function(){return this.path.toString()+":cancel"},tb.prototype.j=function(){return this.w},Kb.prototype.get=function(){var t=this.eg.get(),e=xa(t);if(this.Dd)for(var n in this.Dd)e[n]-=this.Dd[n];return this.Dd=t,e},Lb.prototype.If=function(){var t,e=this.fd.get(),n={},i=!1;for(t in e)0e?n=n.left:e>0&&(n=n.right)}return null},g.e=function(){return this.wa.e()},g.count=function(){return this.wa.count()},g.Sc=function(){return this.wa.Sc()},g.fc=function(){return this.wa.fc()},g.ia=function(t){return this.wa.ia(t)},g.Xb=function(t){return new cc(this.wa,null,this.La,!1,t)},g.Yb=function(t,e){return new cc(this.wa,t,this.La,!1,e)},g.$b=function(t,e){return new cc(this.wa,t,this.La,!0,e)},g.sf=function(t){return new cc(this.wa,null,this.La,!0,t)},g=ec.prototype,g.X=function(t,e,n,i,r){return new ec(null!=t?t:this.key,null!=e?e:this.value,null!=n?n:this.color,null!=i?i:this.left,null!=r?r:this.right)},g.count=function(){return this.left.count()+1+this.right.count()},g.e=function(){return!1},g.ia=function(t){return this.left.ia(t)||t(this.key,this.value)||this.right.ia(t)},g.Sc=function(){return fc(this).key},g.fc=function(){return this.right.e()?this.key:this.right.fc()},g.Oa=function(t,e,n){var i,r;return r=this,i=n(t,r.key),r=0>i?r.X(null,null,null,r.left.Oa(t,e,n),null):0===i?r.X(null,e,null,null,null):r.X(null,null,null,null,r.right.Oa(t,e,n)),gc(r)},g.remove=function(t,e){var n,i;if(n=this,0>e(t,n.key))n.left.e()||n.left.fa()||n.left.left.fa()||(n=ic(n)),n=n.X(null,null,null,n.left.remove(t,e),null);else{if(n.left.fa()&&(n=jc(n)),n.right.e()||n.right.fa()||n.right.left.fa()||(n=kc(n),n.left.left.fa()&&(n=jc(n),n=kc(n))),0===e(t,n.key)){if(n.right.e())return ac;i=fc(n.right),n=n.X(i.key,i.value,null,null,hc(n.right))}n=n.X(null,null,null,null,n.right.remove(t,e))}return gc(n)},g.fa=function(){return this.color},g=mc.prototype,g.X=function(){return this},g.Oa=function(t,e){return new ec(t,e,null)},g.remove=function(){return this},g.count=function(){return 0},g.e=function(){return!0},g.ia=function(){return!1},g.Sc=function(){return null},g.fc=function(){return null},g.fa=function(){return!1};var ac=new mc;g=L.prototype,g.toString=function(){for(var t="",e=this.Z;e=this.n.length)return null;for(var t=[],e=this.Z;e=this.n.length},g.ca=function(t){if(tc(this)!==tc(t))return!1;for(var e=this.Z,n=t.Z;e<=this.n.length;e++,n++)if(this.n[e]!==t.n[n])return!1;return!0},g.contains=function(t){var e=this.Z,n=t.Z;if(tc(this)>tc(t))return!1;for(;e"),t};var Fc=function(){var t=1;return function(){return t++}}(),Bb=null,Lc=!0,Zc=/^-?\d{1,10}$/;cd.prototype.fg=function(t,e){if(null==t.Xa||null==e.Xa)throw Gc("Should only compare child_ events.");return this.g.compare(new F(t.Xa,t.Ja),new F(e.Xa,e.Ja))},g=id.prototype,g.Kf=function(t){return"value"===t},g.createEvent=function(t,e){var n=e.o.g;return new Gb("value",this,new S(t.Ja,e.mc(),n))},g.Vb=function(t){var e=this.sb;if("cancel"===t.Ae()){K(this.qb,"Raising a cancel event on a listener with no cancel callback");var n=this.qb;return function(){n.call(e,t.error)}}var i=this.Rb;return function(){i.call(e,t.$d)}},g.gf=function(t,e){return this.qb?new Hb(this,t,e):null},g.matches=function(t){return t instanceof id?t.Rb&&this.Rb?t.Rb===this.Rb&&t.sb===this.sb:!0:!1},g.tf=function(){return null!==this.Rb},g=jd.prototype,g.Kf=function(t){return t="children_added"===t?"child_added":t,("children_removed"===t?"child_removed":t)in this.ha},g.gf=function(t,e){return this.qb?new Hb(this,t,e):null},g.createEvent=function(t,e){K(null!=t.Xa,"Child events should have a childName.");var n=e.mc().u(t.Xa);return new Gb(t.type,this,new S(t.Ja,n,e.o.g),t.Qd)},g.Vb=function(t){var e=this.sb;if("cancel"===t.Ae()){K(this.qb,"Raising a cancel event on a listener with no cancel callback");var n=this.qb;return function(){n.call(e,t.error)}}var i=this.ha[t.ud];return function(){i.call(e,t.$d,t.Qd)}},g.matches=function(t){if(t instanceof jd){if(!this.ha||!t.ha)return!0;if(this.sb===t.sb){var e=pa(t.ha);if(e===pa(this.ha)){if(1===e){var e=qa(t.ha),n=qa(this.ha);return!(n!==e||t.ha[e]&&this.ha[n]&&t.ha[e]!==this.ha[n])}return oa(this.ha,function(e,n){return t.ha[n]===e})}}}return!1},g.tf=function(){return null!==this.ha},g=kd.prototype,g.K=function(t,e,n,i,r,o){return K(t.Jc(this.g),"A node must be indexed if only a child is updated"),r=t.J(e),r.Y(i).ca(n.Y(i))&&r.e()==n.e()?t:(null!=o&&(n.e()?t.Da(e)?hd(o,new D("child_removed",r,e)):K(t.L(),"A child remove without an old child only makes sense on a leaf node"):r.e()?hd(o,new D("child_added",n,e)):hd(o,new D("child_changed",n,e,r))),t.L()&&n.e()?t:t.O(e,n).mb(this.g))},g.xa=function(t,e,n){return null!=n&&(t.L()||t.R(N,function(t,i){e.Da(t)||hd(n,new D("child_removed",i,t))}),e.L()||e.R(N,function(e,i){if(t.Da(e)){var r=t.J(e);r.ca(i)||hd(n,new D("child_changed",i,e,r))}else hd(n,new D("child_added",i,e))})),e.mb(this.g)},g.ga=function(t,e){return t.e()?C:t.ga(e)},g.Na=function(){return!1},g.Wb=function(){return this},g=ld.prototype,g.matches=function(t){return 0>=this.g.compare(this.ed,t)&&0>=this.g.compare(t,this.Gc)},g.K=function(t,e,n,i,r,o){return this.matches(new F(e,n))||(n=C),this.Ce.K(t,e,n,i,r,o)},g.xa=function(t,e,n){e.L()&&(e=C);var i=e.mb(this.g),i=i.ga(C),r=this;return e.R(N,function(t,e){r.matches(new F(t,e))||(i=i.O(t,C))}),this.Ce.xa(t,i,n)},g.ga=function(t){return t},g.Na=function(){return!0},g.Wb=function(){return this.Ce},g=qd.prototype,g.K=function(t,e,n,i,r,o){return this.sa.matches(new F(e,n))||(n=C),t.J(e).ca(n)?t:t.Eb()=this.g.compare(this.sa.ed,a):0>=this.g.compare(a,this.sa.Gc)))break;i=i.O(a.name,a.S),r++}}else{i=e.mb(this.g),i=i.ga(C);var s,c,u;if(this.Jb){e=i.sf(this.g),s=this.sa.Gc,c=this.sa.ed;var h=td(this.g);u=function(t,e){return h(e,t)}}else e=i.Xb(this.g),s=this.sa.ed,c=this.sa.Gc,u=td(this.g);for(var r=0,l=!1;0=u(s,a)&&(l=!0),(o=l&&r=u(a,c))?r++:i=i.O(a.name,C)}return this.sa.Wb().xa(t,i,n)},g.ga=function(t){return t},g.Na=function(){return!0},g.Wb=function(){return this.sa.Wb()},yd.prototype.ab=function(t,e,n,i){var r,o=new gd;if(e.type===Xb)e.source.xe?n=zd(this,t,e.path,e.Ga,n,i,o):(K(e.source.pf,"Unknown source."),r=e.source.bf,n=Ad(this,t,e.path,e.Ga,n,i,r,o));else if(e.type===Bd)e.source.xe?n=Cd(this,t,e.path,e.children,n,i,o):(K(e.source.pf,"Unknown source."),r=e.source.bf,n=Dd(this,t,e.path,e.children,n,i,r,o));else if(e.type===Ed)if(e.Vd)if(e=e.path,null!=n.tc(e))n=t;else{if(r=new rb(n,t,i),i=t.Q.j(),e.e()||".priority"===E(e))Ib(t.C())?e=n.za(ub(t)):(e=t.C().j(),K(e instanceof T,"serverChildren would be complete if leaf node"),e=n.yc(e)),e=this.U.xa(i,e,o);else{var a=E(e),s=n.xc(a,t.C());null==s&&sb(t.C(),a)&&(s=i.J(a)),e=null!=s?this.U.K(i,a,s,H(e),r,o):t.Q.j().Da(a)?this.U.K(i,a,C,H(e),r,o):i,e.e()&&Ib(t.C())&&(i=n.za(ub(t)),i.L()&&(e=this.U.xa(e,i,o)))}i=Ib(t.C())||null!=n.tc(G),n=Fd(t,e,i,this.U.Na())}else n=Gd(this,t,e.path,e.Qb,n,i,o);else{if(e.type!==Zb)throw Gc("Unknown operation type: "+e.type);i=e.path,e=t.C(),r=e.j(),a=e.ea||i.e(),n=Hd(this,new Id(t.Q,new tb(r,a,e.Ub)),i,n,qb,o)}return o=ra(o.bb),i=n,e=i.Q,e.ea&&(r=e.j().L()||e.j().e(),a=Jd(t),(0=0,"Unknown leaf type: "+e),K(r>=0,"Unknown leaf type: "+n),i===r?"object"===n?0:this.Ai){var o,a=[];for(o in e)a[o]=e[o];return a}return t&&!this.B().e()&&(e[".priority"]=this.B().H()),e},g.hash=function(){if(null===this.Cb){var t="";this.B().e()||(t+="priority:"+me(this.B().H())+":"),this.R(N,function(e,n){var i=n.hash();""!==i&&(t+=":"+e+":"+i)}),this.Cb=""===t?"":Ic(t)}return this.Cb},g.rf=function(t,e,n){return(n=oe(this,n))?(t=bc(n,new F(t,e)))?t.name:null:bc(this.m,t)},g.R=function(t,e){var n=oe(this,t);return n?n.ia(function(t){return e(t.name,t.S)}):this.m.ia(e)},g.Xb=function(t){return this.Yb(t.Tc(),t)},g.Yb=function(t,e){var n=oe(this,e);if(n)return n.Yb(t,function(t){return t});for(var n=this.m.Yb(t.name,Sb),i=dc(n);null!=i&&0>e.compare(i,t);)J(n),i=dc(n);return n},g.sf=function(t){return this.$b(t.Qc(),t)},g.$b=function(t,e){var n=oe(this,e);if(n)return n.$b(t,function(t){return t});for(var n=this.m.$b(t.name,Sb),i=dc(n);null!=i&&0t?-1:1});g=Be.prototype,g.e=function(){return null===this.value&&this.children.e()},g.subtree=function(t){if(t.e())return this;var e=this.children.get(E(t));return null!==e?e.subtree(H(t)):Nd},g.set=function(t,e){if(t.e())return new Be(e,this.children);var n=E(t),i=(this.children.get(n)||Nd).set(H(t),e),n=this.children.Oa(n,i);return new Be(this.value,n)},g.remove=function(t){if(t.e())return this.children.e()?Nd:new Be(null,this.children);var e=E(t),n=this.children.get(e);return n?(t=n.remove(H(t)),e=t.e()?this.children.remove(e):this.children.Oa(e,t),null===this.value&&e.e()?Nd:new Be(this.value,e)):this},g.get=function(t){if(t.e())return this.value;var e=this.children.get(E(t));return e?e.get(H(t)):null};var Nd=new Be(null);Be.prototype.toString=function(){var t={};return Kd(this,function(e,n){t[e.toString()]=n.toString()}),B(t)},Oe.prototype.Xc=function(t){return this.path.e()?null!=this.Qb.value?(K(this.Qb.children.e(),"affectedTree should not have overlapping affected paths."),this):(t=this.Qb.subtree(new L(t)),new Oe(G,t,this.Vd)):(K(E(this.path)===t,"operationForChild called for unrelated child."),new Oe(H(this.path),this.Qb,this.Vd))},Oe.prototype.toString=function(){return"Operation("+this.path+": "+this.source.toString()+" ack write revert="+this.Vd+" affectedTree="+this.Qb+")"};var Xb=0,Bd=1,Ed=2,Zb=3,Pe=new Qe(!0,!1,null,!1),Re=new Qe(!1,!0,null,!1);Qe.prototype.toString=function(){return this.xe?"user":this.bf?"server(queryID="+this.Ib+")":"server"};var Te=new Se(new Be(null));Se.prototype.Rd=function(t){return t.e()?Te:(t=Md(this.W,t,Nd),new Se(t))},Se.prototype.e=function(){return this.W.e()},Se.prototype.apply=function(t){return Ze(G,this.W,t)},g=$e.prototype,g.Rd=function(t){var e=Ua(this.na,function(e){return e.kd===t});K(e>=0,"removeWrite called with nonexistent writeId.");var n=this.na[e];this.na.splice(e,1);for(var i=n.visible,o=!1,a=this.na.length-1;i&&a>=0;){var s=this.na[a];s.visible&&(a>=e&&bf(s,n.path)?i=!1:n.path.contains(s.path)&&(o=!0)),a--}if(i){if(o)this.T=cf(this.na,df,G),this.Mc=0=0;o--)r[o]="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".charAt(n%64),n=Math.floor(n/64);if(K(0===n,"Cannot push at time == 0"),n=r.join(""),i){for(o=11;o>=0&&63===e[o];o--)e[o]=0;e[o]++}else for(o=0;12>o;o++)e[o]=Math.floor(64*Math.random());for(o=0;12>o;o++)n+="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".charAt(e[o]);return K(20===n.length,"nextPushId: Length should be 20."), n}}();ma(Of,Lf),Of.prototype.Be=function(t){return K("online"===t,"Unknown event type: "+t),[this.jc]},ca(Of),ma(Pf,Lf),Pf.prototype.Be=function(t){return K("visible"===t,"Unknown event type: "+t),[this.Ob]},ca(Pf);var Qf=/[\[\].#$\/\u0000-\u001F\u007F]/,Rf=/[\[\].#$\u0000-\u001F\u007F]/,Sf=/^[a-zA-Z][a-zA-Z._\-+]+$/;g=hg.prototype,g.add=function(t,e){this.set[t]=null!==e?e:!0},g.contains=function(t){return v(this.set,t)},g.get=function(t){return this.contains(t)?this.set[t]:void 0},g.remove=function(t){delete this.set[t]},g.clear=function(){this.set={}},g.e=function(){return wa(this.set)},g.count=function(){return pa(this.set)},g.keys=function(){var t=[];return r(this.set,function(e,n){t.push(n)}),t},pc.prototype.find=function(t){if(null!=this.A)return this.A.Y(t);if(t.e()||null==this.m)return null;var e=E(t);return t=H(t),this.m.contains(e)?this.m.get(e).find(t):null},pc.prototype.nc=function(t,e){if(t.e())this.A=e,this.m=null;else if(null!==this.A)this.A=this.A.K(t,e);else{null==this.m&&(this.m=new hg);var n=E(t);this.m.contains(n)||this.m.add(n,new pc),n=this.m.get(n),t=H(t),n.nc(t,e)}},pc.prototype.R=function(t){null!==this.m&&ig(this.m,function(e,n){t(e,n)})};var kg="auth.firebase.com",mg=["remember","redirectTo"];og.prototype.set=function(t,e){if(!e){if(!this.ce.length)throw Error("fb.login.SessionManager : No storage options available!");e=this.ce[0]}e.set(this.Re,t)},og.prototype.get=function(){var t=Qa(this.ce,q(this.og,this)),t=Pa(t,function(t){return null!==t});return Xa(t,function(t,e){return ad(e.token)-ad(t.token)}),0o.status){try{t=nb(o.responseText)}catch(e){}n(null,t)}else n(500<=o.status&&600>o.status?Eg("SERVER_ERROR"):Eg("NETWORK_ERROR"));n=null,vg(window,"beforeunload",i)}},"GET"===a)t+=(/\?/.test(t)?"":"?")+kb(e),r=null;else{var s=this.options.headers.content_type;"application/json"===s&&(r=B(e)),"application/x-www-form-urlencoded"===s&&(r=kb(e))}o.open(a,t,!0),t={"X-Requested-With":"XMLHttpRequest",Accept:"application/json;text/plain"},za(t,this.options.headers);for(var c in t)o.setRequestHeader(c,t[c]);o.send(r)},Gg.isAvailable=function(){var t;return(t=!!window.XMLHttpRequest)&&(t=pg(),t=!(t.match(/MSIE/)||t.match(/Trident/))||sg(10)),t},Gg.prototype.Cc=function(){return"json"},Hg.prototype.open=function(t,e,n){function i(){n&&(n(Eg("USER_CANCELLED")),n=null)}var r,o=this,a=Qc(kg);e.requestId=this.pc,e.redirectTo=a.scheme+"://"+a.host+"/blank/page.html",t+=/\?/.test(t)?"":"?",t+=kb(e),(r=window.open(t,"_blank","location=no"))&&ha(r.addEventListener)?(r.addEventListener("loadstart",function(t){var e;if(e=t&&t.url)t:{try{var s=document.createElement("a");s.href=t.url,e=s.host===a.host&&"/blank/page.html"===s.pathname;break t}catch(c){}e=!1}e&&(t=xg(t.url),r.removeEventListener("exit",i),r.close(),t=new lg(null,null,{requestId:o.pc,requestKey:t}),o.Ef.requestWithCredential("/auth/session",t,n),n=null)}),r.addEventListener("exit",i)):n(Eg("TRANSPORT_UNAVAILABLE"))},Hg.isAvailable=function(){return qg()},Hg.prototype.Cc=function(){return"redirect"},Ig.prototype.open=function(t,e,n){function i(){n&&(n(Eg("REQUEST_INTERRUPTED")),n=null)}function r(){setTimeout(function(){window.__firebase_auth_jsonp[o]=void 0,wa(window.__firebase_auth_jsonp)&&(window.__firebase_auth_jsonp=void 0);try{var t=document.getElementById(o);t&&t.parentNode.removeChild(t)}catch(e){}},1),vg(window,"beforeunload",i)}var o="fn"+(new Date).getTime()+Math.floor(99999*Math.random());e[this.options.callback_parameter]="__firebase_auth_jsonp."+o,t+=(/\?/.test(t)?"":"?")+kb(e),ug(window,"beforeunload",i),window.__firebase_auth_jsonp[o]=function(t){n&&(n(null,t),n=null),r()},Jg(o,t,n)},Ig.isAvailable=function(){return"undefined"!=typeof document&&null!=document.createElement},Ig.prototype.Cc=function(){return"json"},ma(Kg,Lf),g=Kg.prototype,g.ye=function(){return this.nb||null},g.te=function(t,e){Tg(this);var n=ng(t);n.$a._method="POST",this.qc("/users",n,function(t,n){t?R(e,t):R(e,t,n)})},g.Ue=function(t,e){var n=this;Tg(this);var i="/users/"+encodeURIComponent(t.email),r=ng(t);r.$a._method="DELETE",this.qc(i,r,function(t,i){!t&&i&&i.uid&&n.nb&&n.nb.uid&&n.nb.uid===i.uid&&Rg(n),R(e,t)})},g.qe=function(t,e){Tg(this);var n="/users/"+encodeURIComponent(t.email)+"/password",i=ng(t);i.$a._method="PUT",i.$a.password=t.newPassword,this.qc(n,i,function(t){R(e,t)})},g.pe=function(t,e){Tg(this);var n="/users/"+encodeURIComponent(t.oldEmail)+"/email",i=ng(t);i.$a._method="PUT",i.$a.email=t.newEmail,i.$a.password=t.password,this.qc(n,i,function(t){R(e,t)})},g.We=function(t,e){Tg(this);var n="/users/"+encodeURIComponent(t.email)+"/password",i=ng(t);i.$a._method="POST",this.qc(n,i,function(t){R(e,t)})},g.qc=function(t,e,n){Wg(this,[Gg,Ig],t,e,n)},g.Be=function(t){return K("auth_status"===t,'initial event must be of type "auth_status"'),this.Te?null:[this.nb]};var ah,bh;$g.prototype.open=function(t,e){this.hf=0,this.la=e,this.Af=new Xg(t),this.Ab=!1;var n=this;this.rb=setTimeout(function(){n.f("Timed out trying to connect."),n.hb(),n.rb=null},Math.floor(3e4)),Sc(function(){if(!n.Ab){n.Ta=new ch(function(t,e,i,r,o){if(dh(n,arguments),n.Ta)if(n.rb&&(clearTimeout(n.rb),n.rb=null),n.Hc=!0,"start"==t)n.id=e,n.Gf=i;else{if("close"!==t)throw Error("Unrecognized command received: "+t);e?(n.Ta.Xd=!1,Yg(n.Af,e,function(){n.hb()})):n.hb()}},function(t,e){dh(n,arguments),Zg(n.Af,t,e)},function(){n.hb()},n.jd);var t={start:"t"};t.ser=Math.floor(1e8*Math.random()),n.Ta.ie&&(t.cb=n.Ta.ie),t.v="5",n.Zd&&(t.s=n.Zd),"undefined"!=typeof location&&location.href&&-1!==location.href.indexOf("firebaseio.com")&&(t.r="f"),t=n.jd(t),n.f("Connecting via long-poll to "+t),eh(n.Ta,t,function(){})}})},$g.prototype.start=function(){var t=this.Ta,e=this.Gf;for(t.sg=this.id,t.tg=e,t.me=!0;fh(t););t=this.id,e=this.Gf,this.gc=document.createElement("iframe");var n={dframe:"t"};n.id=t,n.pw=e,this.gc.src=this.jd(n),this.gc.style.display="none",document.body.appendChild(this.gc)},$g.isAvailable=function(){return ah||!bh&&"undefined"!=typeof document&&null!=document.createElement&&!("object"==typeof window&&window.chrome&&window.chrome.extension&&!/^chrome/.test(window.location.href))&&!("object"==typeof Windows&&"object"==typeof Windows.Vg)&&!0},g=$g.prototype,g.Ed=function(){},g.dd=function(){this.Ab=!0,this.Ta&&(this.Ta.close(),this.Ta=null),this.gc&&(document.body.removeChild(this.gc),this.gc=null),this.rb&&(clearTimeout(this.rb),this.rb=null)},g.hb=function(){this.Ab||(this.f("Longpoll is closing itself"),this.dd(),this.la&&(this.la(this.Hc),this.la=null))},g.close=function(){this.Ab||(this.f("Longpoll is being closed."),this.dd())},g.send=function(t){t=B(t),this.pb+=t.length,Nb(this.Va,"bytes_sent",t.length),t=Jc(t),t=fb(t,!0),t=Wc(t,1840);for(var e=0;e=t.length){var e=Number(t);if(!isNaN(e)){r.cf=e,r.frames=[],t=null;break t}}r.cf=1,r.frames=[]}null!==t&&lh(r,t)}},this.ua.onerror=function(t){r.f("WebSocket error. Closing connection."),(t=t.message||t.data)&&r.f(t),r.hb()}},ih.prototype.start=function(){},ih.isAvailable=function(){var t=!1;if("undefined"!=typeof navigator&&navigator.userAgent){var e=navigator.userAgent.match(/Android ([0-9]{0,}\.[0-9]{0,})/);e&&1parseFloat(e[1])&&(t=!0)}return!t&&null!==hh&&!jh},ih.responsesRequiredToBeHealthy=2,ih.healthyTimeout=3e4,g=ih.prototype,g.Ed=function(){Cc.remove("previous_websocket_failure")},g.send=function(t){kh(this),t=B(t),this.pb+=t.length,Nb(this.Va,"bytes_sent",t.length),t=Wc(t,16384),1r;r++)e+=" ";console.log(e+i)}}},g.$e=function(t){Nb(this.Va,t),this.Qg.Nf[t]=!0},g.f=function(t){var e="";this.Sa&&(e=this.Sa.id+":"),Cb(e,arguments)},W.prototype.zb=function(){for(var t in this.oc)this.oc[t].zb()},W.prototype.rc=function(){for(var t in this.oc)this.oc[t].rc()},W.prototype.we=function(){this.Qf=!0},ca(W),W.prototype.interrupt=W.prototype.zb,W.prototype.resume=W.prototype.rc,X.prototype.cancel=function(t){x("Firebase.onDisconnect().cancel",0,1,arguments.length),A("Firebase.onDisconnect().cancel",1,t,!0),this.bd.Jd(this.ra,t||null)},X.prototype.cancel=X.prototype.cancel,X.prototype.remove=function(t){x("Firebase.onDisconnect().remove",0,1,arguments.length),bg("Firebase.onDisconnect().remove",this.ra),A("Firebase.onDisconnect().remove",1,t,!0),Yh(this.bd,this.ra,null,t)},X.prototype.remove=X.prototype.remove,X.prototype.set=function(t,e){x("Firebase.onDisconnect().set",1,2,arguments.length),bg("Firebase.onDisconnect().set",this.ra),Vf("Firebase.onDisconnect().set",t,this.ra,!1),A("Firebase.onDisconnect().set",2,e,!0),Yh(this.bd,this.ra,t,e)},X.prototype.set=X.prototype.set,X.prototype.Kb=function(t,e,n){x("Firebase.onDisconnect().setWithPriority",2,3,arguments.length),bg("Firebase.onDisconnect().setWithPriority",this.ra),Vf("Firebase.onDisconnect().setWithPriority",t,this.ra,!1),Yf("Firebase.onDisconnect().setWithPriority",2,e),A("Firebase.onDisconnect().setWithPriority",3,n,!0),Zh(this.bd,this.ra,t,e,n)},X.prototype.setWithPriority=X.prototype.Kb,X.prototype.update=function(t,e){if(x("Firebase.onDisconnect().update",1,2,arguments.length),bg("Firebase.onDisconnect().update",this.ra),ea(t)){for(var n={},i=0;i=t)throw Error("Query.limit: First argument must be a positive integer.");if(this.o.ja)throw Error("Query.limit: Limit was already set (by another call to limit, limitToFirst, orlimitToLast.");var e=this.o.Ie(t);return li(e),new Y(this.k,this.path,e,this.kc)},g.Je=function(t){if(x("Query.limitToFirst",1,1,arguments.length),!ga(t)||Math.floor(t)!==t||0>=t)throw Error("Query.limitToFirst: First argument must be a positive integer.");if(this.o.ja)throw Error("Query.limitToFirst: Limit was already set (by another call to limit, limitToFirst, or limitToLast).");return new Y(this.k,this.path,this.o.Je(t),this.kc)},g.Ke=function(t){if(x("Query.limitToLast",1,1,arguments.length),!ga(t)||Math.floor(t)!==t||0>=t)throw Error("Query.limitToLast: First argument must be a positive integer.");if(this.o.ja)throw Error("Query.limitToLast: Limit was already set (by another call to limit, limitToFirst, or limitToLast).");return new Y(this.k,this.path,this.o.Ke(t),this.kc)},g.Cg=function(t){if(x("Query.orderByChild",1,1,arguments.length),"$key"===t)throw Error('Query.orderByChild: "$key" is invalid. Use Query.orderByKey() instead.');if("$priority"===t)throw Error('Query.orderByChild: "$priority" is invalid. Use Query.orderByPriority() instead.');if("$value"===t)throw Error('Query.orderByChild: "$value" is invalid. Use Query.orderByValue() instead.');$f("Query.orderByChild",1,t,!1),mi(this,"Query.orderByChild");var e=be(this.o,new Sd(t));return ki(e),new Y(this.k,this.path,e,!0)},g.Dg=function(){x("Query.orderByKey",0,0,arguments.length),mi(this,"Query.orderByKey");var t=be(this.o,Od);return ki(t),new Y(this.k,this.path,t,!0)},g.Eg=function(){x("Query.orderByPriority",0,0,arguments.length),mi(this,"Query.orderByPriority");var t=be(this.o,N);return ki(t),new Y(this.k,this.path,t,!0)},g.Fg=function(){x("Query.orderByValue",0,0,arguments.length),mi(this,"Query.orderByValue");var t=be(this.o,Yd);return ki(t),new Y(this.k,this.path,t,!0)},g.ae=function(t,e){x("Query.startAt",0,2,arguments.length),Vf("Query.startAt",t,this.path,!0),$f("Query.startAt",2,e,!0);var i=this.o.ae(t,e);if(li(i),ki(i),this.o.ma)throw Error("Query.startAt: Starting point was already set (by another call to startAt or equalTo).");return n(t)||(e=t=null),new Y(this.k,this.path,i,this.kc)},g.td=function(t,e){x("Query.endAt",0,2,arguments.length),Vf("Query.endAt",t,this.path,!0),$f("Query.endAt",2,e,!0);var n=this.o.td(t,e);if(li(n),ki(n),this.o.pa)throw Error("Query.endAt: Ending point was already set (by another call to endAt or equalTo).");return new Y(this.k,this.path,n,this.kc)},g.ig=function(t,e){if(x("Query.equalTo",1,2,arguments.length),Vf("Query.equalTo",t,this.path,!1),$f("Query.equalTo",2,e,!0),this.o.ma)throw Error("Query.equalTo: Starting point was already set (by another call to endAt or equalTo).");if(this.o.pa)throw Error("Query.equalTo: Ending point was already set (by another call to endAt or equalTo).");return this.ae(t,e).td(t,e)},g.toString=function(){x("Query.toString",0,0,arguments.length);for(var t=this.path,e="",n=t.Z;n=128?"dark":"light"}function o(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function a(t){function e(){i=(i+1)%256,r=(r+n[i])%256;var t=n[i];return n[i]=n[r],n[r]=t,n[(n[i]+n[r])%256]}for(var n=[],i=0,r=0,o=0;256>o;o++)n[o]=o;for(var a=0,s=0;256>a;a++){s=(s+n[a]+t.charCodeAt(a%t.length))%256;var c=n[a];n[a]=n[s],n[s]=c}this.random=function(){for(var t=0,n=0,i=1;8>t;t++)n+=e()*i,i*=256;return n/0x10000000000000000}}var s={},c={aliceblue:"F0F8FF",antiquewhite:"FAEBD7",aqua:"00FFFF",aquamarine:"7FFFD4",azure:"F0FFFF",beige:"F5F5DC",bisque:"FFE4C4",black:"000000",blanchedalmond:"FFEBCD",blue:"0000FF",blueviolet:"8A2BE2",brown:"A52A2A",burlywood:"DEB887",cadetblue:"5F9EA0",chartreuse:"7FFF00",chocolate:"D2691E",coral:"FF7F50",cornflowerblue:"6495ED",cornsilk:"FFF8DC",crimson:"DC143C",cyan:"00FFFF",darkblue:"00008B",darkcyan:"008B8B",darkgoldenrod:"B8860B",darkgray:"A9A9A9",darkgrey:"A9A9A9",darkgreen:"006400",darkkhaki:"BDB76B",darkmagenta:"8B008B",darkolivegreen:"556B2F",darkorange:"FF8C00",darkorchid:"9932CC",darkred:"8B0000",darksalmon:"E9967A",darkseagreen:"8FBC8F",darkslateblue:"483D8B",darkslategray:"2F4F4F",darkslategrey:"2F4F4F",darkturquoise:"00CED1",darkviolet:"9400D3",deeppink:"FF1493",deepskyblue:"00BFFF",dimgray:"696969",dimgrey:"696969",dodgerblue:"1E90FF",firebrick:"B22222",floralwhite:"FFFAF0",forestgreen:"228B22",fuchsia:"FF00FF",gainsboro:"DCDCDC",ghostwhite:"F8F8FF",gold:"FFD700",goldenrod:"DAA520",gray:"808080",grey:"808080",green:"008000",greenyellow:"ADFF2F",honeydew:"F0FFF0",hotpink:"FF69B4",indianred:"CD5C5C",indigo:"4B0082",ivory:"FFFFF0",khaki:"F0E68C",lavender:"E6E6FA",lavenderblush:"FFF0F5",lawngreen:"7CFC00",lemonchiffon:"FFFACD",lightblue:"ADD8E6",lightcoral:"F08080",lightcyan:"E0FFFF",lightgoldenrodyellow:"FAFAD2",lightgray:"D3D3D3",lightgrey:"D3D3D3",lightgreen:"90EE90",lightpink:"FFB6C1",lightsalmon:"FFA07A",lightseagreen:"20B2AA",lightskyblue:"87CEFA",lightslategray:"778899",lightslategrey:"778899",lightsteelblue:"B0C4DE",lightyellow:"FFFFE0",lime:"00FF00",limegreen:"32CD32",linen:"FAF0E6",magenta:"FF00FF",maroon:"800000",mediumaquamarine:"66CDAA",mediumblue:"0000CD",mediumorchid:"BA55D3",mediumpurple:"9370D8",mediumseagreen:"3CB371",mediumslateblue:"7B68EE",mediumspringgreen:"00FA9A",mediumturquoise:"48D1CC",mediumvioletred:"C71585",midnightblue:"191970",mintcream:"F5FFFA",mistyrose:"FFE4E1",moccasin:"FFE4B5",navajowhite:"FFDEAD",navy:"000080",oldlace:"FDF5E6",olive:"808000",olivedrab:"6B8E23",orange:"FFA500",orangered:"FF4500",orchid:"DA70D6",palegoldenrod:"EEE8AA",palegreen:"98FB98",paleturquoise:"AFEEEE",palevioletred:"D87093",papayawhip:"FFEFD5",peachpuff:"FFDAB9",peru:"CD853F",pink:"FFC0CB",plum:"DDA0DD",powderblue:"B0E0E6",purple:"800080",rebeccapurple:"663399",red:"FF0000",rosybrown:"BC8F8F",royalblue:"4169E1",saddlebrown:"8B4513",salmon:"FA8072",sandybrown:"F4A460",seagreen:"2E8B57",seashell:"FFF5EE",sienna:"A0522D",silver:"C0C0C0",skyblue:"87CEEB",slateblue:"6A5ACD",slategray:"708090",slategrey:"708090",snow:"FFFAFA",springgreen:"00FF7F",steelblue:"4682B4",tan:"D2B48C",teal:"008080",thistle:"D8BFD8",tomato:"FF6347",turquoise:"40E0D0",violet:"EE82EE",wheat:"F5DEB3",white:"FFFFFF",whitesmoke:"F5F5F5",yellow:"FFFF00",yellowgreen:"9ACD32"},u=.618033988749895,h={hue:null,saturation:null,value:null,base_color:"",greyscale:!1,grayscale:!1,golden:!0,full_random:!1,colors_returned:1,format:"hex",seed:null},l={scheme_type:"analogous",format:"hex"},f={golden:!1,format:"hex"};return s.NAME_to_HEX=function(t){return t=t.toLowerCase(),t in c?c[t]:void console.error("Color name not recognized.")},s.NAME_to_RGB=function(t){return s.HEX_to_RGB(s.NAME_to_HEX(t))},s.NAME_to_HSV=function(t){return s.HEX_to_HSV(s.NAME_to_HEX(t))},s.HEX_to_RGB=function(t){var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;t=t.replace(e,function(t,e,n,i){return e+e+n+n+i+i});var n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return n?{r:parseInt(n[1],16),g:parseInt(n[2],16),b:parseInt(n[3],16)}:null},s.RGB_to_HEX=function(t){return"#"+((1<<24)+(t.r<<16)+(t.g<<8)+t.b).toString(16).slice(1)},s.HSV_to_RGB=function(t){var e,n,i,r,o,a,s,c,u=t.h,h=t.s,l=t.v;if(0===h)return{r:l,g:l,b:l};switch(u/=60,r=Math.floor(u),o=u-r,a=l*(1-h),s=l*(1-h*o),c=l*(1-h*(1-o)),r){case 0:e=l,n=c,i=a;break;case 1:e=s,n=l,i=a;break;case 2:e=a,n=l,i=c;break;case 3:e=a,n=s,i=l;break;case 4:e=c,n=a,i=l;break;case 5:e=l,n=a,i=s}return{r:Math.floor(255*e),g:Math.floor(255*n),b:Math.floor(255*i)}},s.RGB_to_HSV=function(t){var e=t.r/255,n=t.g/255,i=t.b/255,r=0,o=0,a=0,s=Math.min(e,Math.min(n,i)),c=Math.max(e,Math.max(n,i));if(s===c)return a=s,{h:0,s:0,v:a};var u=e===s?n-i:i===s?e-n:i-e,h=e===s?3:i===s?1:5;return r=60*(h-u/(c-s)),o=(c-s)/c,a=c,{h:r,s:o,v:a}},s.HSV_to_HEX=function(t){return s.RGB_to_HEX(s.HSV_to_RGB(t))},s.HEX_to_HSV=function(t){return s.RGB_to_HSV(s.HEX_to_RGB(t))},s.make_scheme=function(t,e){function r(t){return{h:t.h,s:t.s,v:t.v}}var a,s,c,u,h,f=o(l);if(null!==e)for(var p in e)e.hasOwnProperty(p)&&(f[p]=e[p]);var d=[t];switch(f.scheme_type.toLowerCase()){case"monochromatic":case"mono":for(h=1;2>=h;h++)a=r(t),c=a.s+.1*h,c=n(c,0,1),u=a.v+.1*h,u=n(u,0,1),a.s=c,a.v=u,d.push(a);for(h=1;2>=h;h++)a=r(t),c=a.s-.1*h,c=n(c,0,1),u=a.v-.1*h,u=n(u,0,1),a.s=c,a.v=u,d.push(a);break;case"complementary":case"complement":case"comp":a=r(t),a.h=(a.h+180)%360,d.push(a);break;case"split-complementary":case"split-complement":case"split":a=r(t),a.h=(a.h+165)%360,d.push(a),a=r(t),a.h=Math.abs((a.h-165)%360),d.push(a);break;case"double-complementary":case"double-complement":case"double":a=r(t),a.h=(a.h+180)%360,d.push(a),a.h=(a.h+30)%360,s=r(a),d.push(a),a.h=(a.h+180)%360,d.push(s);break;case"analogous":case"ana":for(h=1;5>=h;h++)a=r(t),a.h=(a.h+20*h)%360,d.push(a);break;case"triadic":case"triad":case"tri":for(h=1;3>h;h++)a=r(t),a.h=(a.h+120*h)%360,d.push(a);break;default:console.error("Color scheme not recognized.")}return i(f.format.toLowerCase(),d),d},s.make_color=function(r){var c=[],l=o(h),f=null;if(null!==r)for(var p in r)r.hasOwnProperty(p)&&(l[p]=r[p]);var d=null;"string"==typeof l.seed&&(d=new a(l.seed)),l.base_color.length>0&&(f=l.base_color.match(/^#?([0-9a-f]{3})([0-9a-f]{3})?$/i)?s.HEX_to_HSV(l.base_color):s.NAME_to_HSV(l.base_color));for(var g=0;gc;c++)n[f[c]]=u[f[c]];for(;".."==l[0];)h.pop(),l.shift();n.path=("/"!=i.substring(0,1)?h.join("/"):"")+"/"+l.join("/")}r(n)},i=function(t){return t=t.replace(/\+/g," "),t=t.replace(/%([ef][0-9a-f])%([89ab][0-9a-f])%([89ab][0-9a-f])/gi,function(t,e,n,i){var r=parseInt(e,16)-224,o=parseInt(n,16)-128;if(0==r&&32>o)return t;var a=parseInt(i,16)-128,s=(r<<12)+(o<<6)+a;return s>65535?t:String.fromCharCode(s)}),t=t.replace(/%([cd][0-9a-f])%([89ab][0-9a-f])/gi,function(t,e,n){var i=parseInt(e,16)-192;if(2>i)return t;var r=parseInt(n,16)-128;return String.fromCharCode((i<<6)+r)}),t=t.replace(/%([0-7][0-9a-f])/gi,function(t,e){return String.fromCharCode(parseInt(e,16))})},r=function(t){var e=t.query;t.query=new function(t){for(var e,n=/([^=&]+)(=([^&]*))?/g;e=n.exec(t);){var r=decodeURIComponent(e[1].replace(/\+/g," ")),o=e[3]?i(e[3]):"";null!=this[r]?(this[r]instanceof Array||(this[r]=[this[r]]),this[r].push(o)):this[r]=o}this.clear=function(){for(r in this)this[r]instanceof Function||delete this[r]},this.toString=function(){var t="",e=encodeURIComponent;for(var n in this)if(!(this[n]instanceof Function))if(this[n]instanceof Array){var i=this[n].length;if(i)for(var r=0;i>r;r++)t+=t?"&":"",t+=e(n)+"="+e(this[n][r]);else t+=(t?"&":"")+e(n)+"="}else t+=t?"&":"",t+=e(n)+"="+e(this[n]);return t}}(e)};return function(t){this.toString=function(){return(this.protocol&&this.protocol+"://")+(this.user&&this.user+(this.pass&&":"+this.pass)+"@")+(this.host&&this.host)+(this.port&&":"+this.port)+(this.path&&this.path)+(this.query.toString()&&"?"+this.query)+(this.hash&&"#"+this.hash)},n(this,t)}}();!function(t,e,n){"use strict";function i(t){var e={};return e=t.__proto__?Object.assign(i(t.__proto__),t):Object.assign({schema:{},dependencies:[]},t),t.schema&&Object.assign(e.schema,t.schema),t.dependencies&&(n=e.dependencies).push.apply(n,t.dependencies),e;var n}function r(t,e){AFRAME.registerComponent(t,i(new e))}function o(t,e){AFRAME.registerSystem(t,i(new e))}function a(t,e,n){return 0===e.length?n:(t[e[0]]=a(t[e[0]]||{},e.slice(1),n),t)}function s(t,e,n){var i,r,o,a,s=0;n||(n={});var c=function(){s=n.leading===!1?0:Date.now(),i=null,a=t.apply(r,o),i||(r=o=null)},u=function(){var u=Date.now();s||n.leading!==!1||(s=u);var h=e-(u-s);return r=this,o=arguments,0>=h||h>e?(i&&(clearTimeout(i),i=null),s=u,a=t.apply(r,o),i||(r=o=null)):i||n.trailing===!1||(i=setTimeout(c,h)),a};return u.cancel=function(){clearTimeout(i),s=0,i=r=o=null},u}function c(t){return t?encodeURIComponent(t).replace(/\./g,"%2E").replace(/%[A-Z0-9]{2}/g,"-"):null}function u(){var t=document.querySelector("link[rel=canonical]");return t?t.href:window.location.href}function h(t,e,n){return c(e||n)+":"+c(t||"")}function l(n){n=n||{};var i=new e,r=n.baseRefUrl||"https://altspace-apps.firebaseio.com/apps/examples/",o=new t(r),a=n.instanceId||i.query["altspace-sync-instance"],s=n.spaceId||i.query["altspace-sync-space"],u=n.userId||i.query["altspace-sync-user"];if(!n.appId||!n.authorId)throw new Error("Both the appId and authorId must be provided to connect.");var l=[];Et&&(s||l.unshift(altspace.getSpace()),u||l.unshift(altspace.getUser()));var f={},p=h(n.appId,n.authorId,_t);f.app=o.child(p).child("app");var d=f.app.child("instances");return a?(f.instance=d.child(a),Promise.all(l).then(function(t){Et&&(s||(s=t.pop().sid),u||(u=t.pop().userId)),s=c(s),u=c(u),a=c(a),f.space=s?f.app.child("spaces").child(s):null,f.user=u?f.app.child("users").child(u):null;var e=f;return e})):(f.instance=d.push(),a=f.instance.key(),i.query["altspace-sync-instance"]=a,window.location.href=i.toString(),Promise.reject(new Error("Sync instance id not found. Reloading app with new sync id.")))}function f(t,e,n){if(!(t&&t instanceof THREE.Scene))throw new TypeError("Requires THREE.Scene argument");if(!(e&&e instanceof THREE.Camera))throw new TypeError("Requires THREE.Camera argument");bt=t,yt=e;var i=n||{};vt=i.renderer&&i.renderer.domElement||window,vt.addEventListener("mousedown",p,!1),vt.addEventListener("mouseup",d,!1),vt.addEventListener("mousemove",g,!1)}function p(t){var e=y(t);if(e&&e.point){var n=b("cursordown",e);e.object.dispatchEvent(n)}}function d(t){var e=y(t),n=b("cursorup",e);e?e.object.dispatchEvent(n):bt.dispatchEvent(n)}function g(t){var e=y(t),n=b("cursormove",e);bt.dispatchEvent(n);var i=e?e.object:null;mt!=i&&(mt&&(n=b("cursorleave",e),mt.dispatchEvent(n)),i&&(n=b("cursorenter",e),i.dispatchEvent(n)),mt=i)}function b(t,e){return{type:t,bubbles:!0,target:e?e.object:null,ray:{origin:St.ray.origin.clone(),direction:St.ray.direction.clone()},point:e?e.point.clone():null}}function y(t){var e=new THREE.Vector2;e.x=t.offsetX/(vt.width||vt.innerWidth)*2-1,e.y=2*-(t.offsetY/(vt.height||vt.innerHeight))+1,St.setFromCamera(e,yt);var n=St.intersectObjects(bt.children,!0);return n.find(function(t){return!t.object.userData||!t.object.userData.altspace||!t.object.userData.altspace.collider||t.object.userData.altspace.collider.enabled!==!1})||null}function v(t){var e=t||{};kt=e.TRACE||!1,e.crossOrigin&&(Rt=e.crossOrigin),e.baseUrl&&(Tt=e.baseUrl),"/"!==Tt.slice(-1)&&(Tt+="/"),Ct=new altspace.utilities.shims.OBJMTLLoader,Ct.crossOrigin=Rt,kt&&console.log("MultiLoader initialized with params",t)}function m(t,e){var n=t,i=Date.now();if(!(n&&n instanceof xt))throw new Error("MultiLoader.load expects first arg of type LoadRequest");if(!e||"function"!=typeof e)throw new Error("MultiLoader.load expects second arg of type function");if(!n.objUrls||!n.mtlUrls||n.objUrls.length!==n.mtlUrls.length)throw new Error("MultiLoader.load called with bad LoadRequest");var r=n.objUrls.length;kt&&console.log("Loading models...");for(var o=0;r>o;o++){var a=function(t,n){var o=Tt+t.objUrls[n],a=Tt+t.mtlUrls[n];kt&&console.log("Loading obj:"+o+", mtl:"+a),Ct.load(o,a,function(o){if(t.objects[n]=o,t.objectsLoaded++,t.objectsLoaded===r){var a=((Date.now()-i)/1e3).toFixed(2);kt&&console.log("Loaded "+r+" models in "+a+" seconds"),e()}},w,function(){var e=xhr.target.responseURL||"";t.error="Error loading file "+e})};a(n,o)}}function w(t){if(t.lengthComputable&&t.target.responseURL){var e=t.loaded/t.total*100,n=t.target.responseURL.split("/").pop();kt&&console.log("..."+n+" "+Math.round(e,2)+"% downloaded")}}function E(){console.log("In a tile: "+Mt),console.log("In VR: "+Dt)}function _(){if(!Mt&&Dt);else{var t=document.createElement("style");t.type="text/css",t.innerHTML="@import url(https://fonts.googleapis.com/css?family=Open+Sans:800);.altspace-info{text-align:center;font-family:'Open Sans',sans-serif;line-height:.5}.altspace-vr-notice{color:rgba(0,0,0,.7);font-size:5vw}.altspace-pen-name{font-size:7vw}",document.head.appendChild(t),document.body.style.background=n.make_color({seed:F()});var e=document.createElement("div");e.className="altspace-info",document.body.appendChild(e);var i=document.createElement("span");if(i.className="altspace-pen-name",i.innerHTML="

"+It.toUpperCase()+"

",e.appendChild(i),Mt){var r="VR mode does not support preview tiles. Stopping code execution.";throw console.log("ERROR: "+r),new Error(r)}if(!Dt){var o=document.createElement("span");o.className="altspace-vr-notice",o.innerHTML="

View

",e.insertBefore(o,i);var a=document.createElement("span");a.className="altspace-vr-notice",a.innerHTML='

in AltspaceVR

',e.appendChild(a);var r="Not in VR mode. Stopping code execution.";throw Mt&&console.log("ERROR: "+r),new Error(r)}}}function j(t){It=t}function S(){var t=document.querySelector("link[rel=canonical]"),n=t?t.href:window.location.href;return new e(n)}function F(){var t=S(),e=t.path.split("/"),n=e[e.length-1];return n}function A(){var t=S(),e=t.path.split("/"),n="team"==e[1],i=n?"team-"+e[2]:e[1];return i}function O(t){var e,n,i=this;if(t.bubbles&&(t.currentTarget=this,t.stopPropagation=function(){e=!0},t.stopImmediatePropagation=function(){n=!0}),this._listeners){var r=this._listeners,o=r[t.type];if(o){t.target=t.target||this;for(var a=[],s=o.length,c=0;s>c;c++)a[c]=o[c];for(var c=0;s>c;c++)if(a[c].call(i,t),n)return}}t.bubbles&&this.parent&&this.parent.dispatchEvent&&!e&&O.call(this.parent,t)}function C(t){t.updateMatrixWorld();var e=new THREE.Vector3;return e.setFromMatrixPosition(t.matrixWorld),e}function k(t){return new Promise(function(e,n){var i=null;return t.traverse(function(t){return"TrackingSkeleton"===t.type?void(i=t):void 0}),i?e(i):void altspace.getThreeJSTrackingSkeleton().then(function(n){return i=n,t.add(i),e(i)})})}function T(t,e){if(t===e)return!0;if(Array.isArray(t)&&Array.isArray(e)&&t.length===e.length)return t.every(function(n,i){return T(t[i],e[i])});if(t instanceof Object&&e instanceof Object&&T(Object.keys(t).sort(),Object.keys(e).sort())){for(var n in t)if(!T(t[n],e[n]))return!1;return!0}return!1}function R(){fe.forEach(function(t){return t.autoSend()})}function x(t,e){var n=function(i,r){var o=altspace.getGamepads().find(function(e){return"steamvr"===e.mapping&&e.hand===t});o?(e.logging&&console.log("SteamVR input device found",o),i(o)):(e.logging&&console.log("SteamVR input device not found trying again in 500ms..."),setTimeout(n,500,i,r))};return new Promise(n)}t=t&&t.hasOwnProperty("default")?t["default"]:t,e=e&&e.hasOwnProperty("default")?e["default"]:e,n=n&&n.hasOwnProperty("default")?n["default"]:n;var L=function(){},I={schema:{}};I.schema.get=function(){return null},L.prototype.init=function(){},L.prototype.tick=function(t,e){},L.prototype.pause=function(){},L.prototype.play=function(){},Object.defineProperties(L.prototype,I);var M=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.update=function(t){},e.prototype.remove=function(){},e.prototype.updateSchema=function(t){},e}(L),D=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{enabled:{type:"boolean","default":!0}}},e.prototype.init=function(){var t=this;this.setColliderFlag(this.data.enabled),this.el.addEventListener("model-loaded",function(){t.setColliderFlag(t.data.enabled)}.bind(this))},e.prototype.update=function(){this.setColliderFlag(this.data.enabled)},e.prototype.setColliderFlag=function(t){var e=this.el.object3D;e&&(a(e.userData,["altspace","collider","enabled"],t),e.traverse(function(e){e instanceof THREE.Mesh&&a(e.userData,["altspace","collider","enabled"],t)}))},Object.defineProperties(e.prototype,n),e}(M),P=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(){this.gamepadIndex=null,this.trackedControlsSystem=document.querySelector("a-scene").systems["tracked-controls"],this.systemGamepads=0,altspace.getGamepads()},e.prototype.tick=function(){if(this.trackedControlsSystem&&this.systemGamepads!==this.trackedControlsSystem.controllers.length&&window.altspace&&altspace.getGamepads&&altspace.getGamepads().length){var t=this.el.components;t["paint-controls"]&&(this.gamepadIndex="left"===t["paint-controls"].data.hand?2:1),null===this.gamepadIndex&&t["hand-controls"]&&(this.gamepadIndex="left"===t["hand-controls"].data?2:1),null===this.gamepadIndex&&t["vive-controls"]&&(this.gamepadIndex="left"===t["vive-controls"].data.hand?2:1),null===this.gamepadIndex&&t["tracked-controls"]&&(this.gamepadIndex=t["tracked-controls"].data.controller),this.el.setAttribute("tracked-controls","id",altspace.getGamepads()[this.gamepadIndex].id),this.el.setAttribute("tracked-controls","controller",0),this.systemGamepads=this.trackedControlsSystem.controllers.length}},e}(M),U=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{usePixelScale:{type:"boolean","default":!1},verticalAlign:{type:"string","default":"middle"},enclosuresOnly:{type:"boolean","default":!0},fullspace:{type:"boolean","default":!1}}},e.prototype.init=function(){return this.version="AFRAME_ALTSPACE_VERSION",this.el.object3D instanceof THREE.Scene?void(window.altspace&&window.altspace.inClient?(this.el.setAttribute("vr-mode-ui",{enabled:!1}),this.initRenderer(),this.initCursorEvents(),this.initCollisionEvents()):console.warn("aframe-altspace-component only works inside of AltspaceVR")):void console.warn("aframe-altspace-component can only be attached to a-scene")},e.prototype.tick=function(t,e){this.el.object3D.updateAllBehaviors&&this.el.object3D.updateAllBehaviors()},e.prototype.initRenderer=function(){var t=this,e=this.el.object3D,n=this.el.sceneEl,i=n.getAttribute("scale")||{x:1,y:1,z:1};altspace.getEnclosure().then(function(n){switch(t.data.fullspace&&(n.fullspace&&a(e.userData,["altspace","initialized"],!0),n.requestFullspace(),n.addEventListener("fullspacechange",function(){e.scale.copy(i).multiplyScalar(n.pixelsPerMeter),a(e.userData,["altspace","initialized"],!0)})),(!t.data.usePixelScale||t.data.fullspace)&&e.scale.copy(i).multiplyScalar(n.pixelsPerMeter),t.data.verticalAlign){case"bottom":e.position.y-=n.innerHeight/2;break;case"top":e.position.y+=n.innerHeight/2;break;case"middle":break;default:console.warn("Unexpected value for verticalAlign: ",t.data.verticalAlign)}t.data.enclosuresOnly&&1===n.innerDepth&&(t.el.renderer.render(new THREE.Scene),t.el.renderer=t.el.effect=r),t.data.fullspace||a(e.userData,["altspace","initialized"],!0)}.bind(this));var r=this.el.renderer,o=this.el.renderer=this.el.effect=altspace.getThreeJSRenderer({aframeComponentVersion:this.version}),s=function(){};o.setSize=s,o.setPixelRatio=s,o.setClearColor=s,o.clear=s,o.enableScissorTest=s,o.setScissor=s,o.setViewport=s,o.getPixelRatio=s,o.getMaxAnisotropy=s,o.setFaceCulling=s,o.submitFrame=s,o.context={canvas:{}},o.shadowMap={},o.requestAnimationFrame=window.requestAnimationFrame.bind(window)},e.prototype.initCursorEvents=function(){function t(t,e){var i=e.target.el;n&&n.emit(t,{target:i,ray:e.ray,point:e.point}),i&&i.emit(t,{target:i,ray:e.ray,point:e.point})}var e=this.el.object3D,n=document.querySelector("a-cursor")||document.querySelector("a-entity[cursor]");n&&(n.setAttribute("material","transparent",!0),n.setAttribute("material","opacity",0));var i=null;e.addEventListener("cursordown",function(e){i=e.target,t("mousedown",e)}),e.addEventListener("cursorup",function(e){t("mouseup",e),e.target.uuid===i.uuid&&t("click",e),i=null}),e.addEventListener("cursorenter",function(e){e.target.el&&(e.target.el.addState("hovered"),n&&n.addState("hovering"),t("mouseenter",e))}),e.addEventListener("cursorleave",function(e){e.target.el&&(e.target.el.removeState("hovered"),n&&n.removeState("hovering"),t("mouseleave",e))})},e.prototype.initCollisionEvents=function(){function t(t,e){var n=e.target.el;n&&(e.target=n,e.other&&e.other.el&&(e.other=e.other.el),n.emit(t,e))}var e=this.el.object3D;e.addEventListener("collisionenter",function(e){t("collisionenter",e)}),e.addEventListener("collisionexit",function(e){t("collisionexit",e)}),e.addEventListener("triggerenter",function(e){t("triggerenter",e)}),e.addEventListener("triggerexit",function(e){t("triggerexit",e)})},Object.defineProperties(e.prototype,n),e}(M),N=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={dependencies:{}};return n.dependencies.get=function(){return["sync"]},e.prototype.init=function(){this.sync=this.el.components.sync,this.lastValue=null,this.sync.isConnected?start():this.el.addEventListener("connected",this.start.bind(this))},e.prototype.start=function(){var t=this,e=this.sync.dataRef.child("material/color"),n=!1,i=!0,r=this;this.el.addEventListener("componentchanged",function(i){var o=i.detail.name;if("material"===o){var a=r.el.getAttribute("material").color;!n&&t.lastValue!==a&&r.sync.isMine&&(r.lastValue=a,setTimeout(function(){return e.set(a)},0))}}),e.on("value",function(t){if(!r.sync.isMine||i){var e=t.val();n=!0,r.el.setAttribute("material","color",e),n=!1,i=!1}})},Object.defineProperties(e.prototype,n),e}(M),B=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{mode:{"default":"link"},ownOn:{type:"string"}}},e.prototype.init=function(){var t=this;if(this.isMine=!1,this.scene=this.el.sceneEl,this.syncSys=this.scene.systems["sync-system"],this.isConnected=!1,this.syncSys.isConnected?this.start():this.scene.addEventListener("connected",this.start.bind(this)),this.data.ownOn){var e=this.data.ownOn.split(/[ ,]+/);e.forEach(function(e){t.el.addEventListener(e,function(){t.isConnected&&t.takeOwnership()}.bind(t))}.bind(this))}},e.prototype.takeOwnership=function(){this.ownerRef.set(this.syncSys.clientId),this.ownerRef.onDisconnect().set(null)},e.prototype.start=function(){var t=this;if(this.scene.addEventListener("clientleft",function(e){var n=(!t.ownerId||t.ownerId===e.detail.id)&&t.syncSys.isMasterClient;n&&t.takeOwnership()}.bind(this)),"link"!==this.data.mode)return void console.error("Unsupported sync mode: "+this.data.mode);var e=this.el.id;return e?(this.link(this.syncSys.sceneRef.child(e)),this.setupReceive(),this.isConnected=!0,void this.el.emit("connected",null,!1)):void console.error("Entities cannot be synced using link mode without an id.")},e.prototype.link=function(t){this.ref=t,this.key=this.ref.key(),this.dataRef=this.ref.child("data"),this.ownerRef=this.ref.child("owner")},e.prototype.setupReceive=function(){function t(t){var e=t.val(),n=e===this.syncSys.clientId&&!this.isMine;n&&this.el.emit("ownershipgained",null,!1);var i=e!==this.syncSys.clientId;i&&(this.el.emit("ownershiplost",null,!1),this.ownerRef.onDisconnect().cancel()),this.ownerId=e,this.isMine=e===this.syncSys.clientId}var e=this;this.ownerRef.transaction(function(t){return t?void 0:e.syncSys.clientId}.bind(this),function(n,i){i&&e.ownerRef.onDisconnect().set(null),e.ownerRef.on("value",t.bind(e))}.bind(this))},Object.defineProperties(e.prototype,n),e}(M),H=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{author:{type:"string"},app:{type:"string"},instance:{type:"string"},refUrl:{type:"string"}}},e.prototype.init=function(){return this.data&&this.data.app?(console.log(this.data),this.clientId=this.sceneEl.object3D.uuid,this.masterClientId=null,this.queuedInstantiations=[],this.isConnected=!1,void Promise.all([altspace.utilities.sync.connect({authorId:this.data.author,appId:this.data.app,instanceId:this.data.instance, -baseRefUrl:this.data.refUrl}),altspace.getUser()]).then(this.connected.bind(this))):void console.warn("The sync-system must be present on the scene and configured with required data.")},e.prototype.connected=function(t){this.connection=t.shift(),this.userInfo=t.shift(),this.sceneRef=this.connection.instance.child("scene"),this.clientsRef=this.connection.instance.child("clients"),this.instantiatedElementsRef=this.connection.instance.child("instantiatedElements"),this.instantiatedElementsRef.on("child_added",this.listenToInstantiationGroup.bind(this)),this.instantiatedElementsRef.on("child_removed",this.stopListeningToInstantiationGroup.bind(this));var e=this;this.clientsRef.on("value",function(t){var n=t.val(),i=Object.keys(n)[0];e.masterClientId=n[i]}),this.clientsRef.on("child_added",function(t){var n=t.val();setTimeout(function(){e.sceneEl.emit("clientjoined",{id:n},!1)},0)}),this.clientsRef.on("child_removed",function(t){var n=t.val();setTimeout(function(){e.sceneEl.emit("clientleft",{id:n},!1)},0)}),this.clientsRef.push(this.clientId).onDisconnect().remove(),this.connection.instance.child("initialized").once("value",function(t){var n=!t.val();t.ref().set(!0),e.processQueuedInstantiations(),e.sceneEl.emit("connected",{shouldInitialize:n},!1),e.isConnected=!0})},e.prototype.isMasterClient=function(){return this.masterClientId===this.clientId},e.prototype.listenToInstantiationGroup=function(t){t.ref().on("child_added",this.createElement.bind(this)),t.ref().on("child_removed",this.removeElement.bind(this))},e.prototype.stopListeningToInstantiationGroup=function(t){t.ref().off("child_added"),t.ref().off("child_removed")},e.prototype.processQueuedInstantiations=function(){var t=this;this.queuedInstantiations.forEach(function(e){e.creatorUserId=t.userInfo.userId,e.clientId=t.clientId,t.instantiatedElementsRef.child(e.groupName).push(e).onDisconnect().remove()}.bind(this)),this.queuedInstantiations.length=0},e.prototype.instantiate=function(t,e,n,i,r){if(!t)return void console.error("AltspaceVR: Instantiation requires a mixin value.",n);var o=e&&e.id,a="A-SCENE"===e.nodeName;if(!o&&!a)return void console.error("AltspaceVR: Instantiation requires a parent with an id.",n);var s=o?"#"+e.id:"a-scene",c={instantiatorId:r||"",groupName:i||"main",mixin:t,parent:s};this.queuedInstantiations.push(c),this.isConnected&&this.processQueuedInstantiations()},e.prototype.removeLast=function(t){var e=this;return new Promise(function(n){e.instantiatedElementsRef.child(t).orderByKey().limitToLast(1).once("value",function(t){if(!t.hasChildren())return void n();var e=t.val(),i=Object.keys(e)[0];n(e[i].instantiatorId),t.ref().child(i).remove()})}.bind(this))},e.prototype.createElement=function(t){var e=t.val(),n=t.key(),i=document.createElement("a-entity");i.id=e.groupName+"-instance-"+n,document.querySelector(e.parent).appendChild(i),i.setAttribute("mixin",e.mixin),i.dataset.creatorUserId=e.creatorUserId,this.userInfo.userId===e.creatorUserId&&i.classList.add("mine")},e.prototype.removeElement=function(t){var e=t.val(),n=t.key(),i=e.groupName+"-instance-"+n,r=document.querySelector("#"+i);r.parentNode.removeChild(r)},Object.defineProperties(e.prototype,n),e}(L),q=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={dependencies:{}};return n.dependencies.get=function(){return["sync"]},e.prototype.init=function(){this.sync=this.el.components.sync,this.sync.isConnected?this.start():this.el.addEventListener("connected",this.start.bind(this))},e.prototype.start=function(){function t(t,e){if(!n.isMine){var r=t.val();r&&i.el.setAttribute(e,r)}}function e(t){if(n.isMine){var e=t.detail.name,r=i.el.getAttribute(e);"position"===e?u(r):"rotation"===e?h(r):"scale"===e&&l(r)}}var n=this.sync,i=this,r=n.dataRef.child("position"),o=n.dataRef.child("rotation"),a=n.dataRef.child("scale");i.updateRate=100;var c=[];i.el.addEventListener("ownershiplost",function(){Array.from(i.el.children).forEach(function(t){var e=t.tagName.toLowerCase();"a-animation"===e&&(c.push(t),t.stop())})}),i.el.addEventListener("ownershipgained",function(){c.forEach(function(t){return t.start()}),c=[]}),r.on("value",function(e){return t(e,"position")}),o.on("value",function(e){return t(e,"rotation")}),a.on("value",function(e){return t(e,"scale")});var u=s(function(t){r.set(t)},i.updateRate),h=s(function(t){o.set(t)},i.updateRate),l=s(function(t){a.set(t)},i.updateRate);i.el.addEventListener("componentchanged",e)},Object.defineProperties(e.prototype,n),e}(M),W=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={dependencies:{}};return n.dependencies.get=function(){return["sync"]},e.prototype.init=function(){this.sync=this.el.components.sync,this.scene=this.el.sceneEl,this.syncSys=this.scene.systems["sync-system"],this.soundStateRef=null,this.soundEventRef=null,this.sync.isConnected?this.start():this.el.addEventListener("connected",this.start.bind(this))},e.prototype.remove=function(){this.soundStateRef.off("value"),this.soundEventRef.off("value")},e.prototype.start=function(){function t(t){if(this.sync.isMine){var t={type:t.type,sender:this.syncSys.clientId,el:this.el.id,time:Firebase.ServerValue.TIMESTAMP};this.soundEventRef.set(t)}}var e=this;this.soundStateRef=this.sync.dataRef.child("sound/state"),this.soundEventRef=this.sync.dataRef.child("sound/event"),this.el.addEventListener("sound-played",t.bind(this)),this.el.addEventListener("sound-paused",t.bind(this)),this.soundEventRef.once("value",function(t){var n=t.val();e.soundEventRef.on("value",function(t){var i=t.val();if(!(!i||n&&i.time===n.time||e.sync.isMine)&&i.el===e.el.id){var r=e.el.components["n-sound"];"sound-played"===i.type?r.playSound():r.pauseSound()}})}),this.el.addEventListener("componentchanged",function(t){if(e.sync.isMine){var n=t.detail.name;"n-sound"===n&&e.soundStateRef.set(e.el.getAttribute(n))}}),this.soundStateRef.on("value",function(t){if(!e.sync.isMine){var n=t.val();n&&e.el.setAttribute("n-sound",n)}})},Object.defineProperties(e.prototype,n),e}(M),V=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={dependencies:{}};return n.dependencies.get=function(){return["sync"]},e.prototype.init=function(){var t=this.el.sceneEl;this.syncSys=t.systems["sync-system"],this.sync=this.el.components.sync,this.syncSys.isConnected?this._start():t.addEventListener("connected",this._start.bind(this))},e.prototype.getDataRef=function(t){return this.sync.dataRef.child("n-skeleton-parent/"+t)},e.prototype._start=function(){this.attributeRef=this.sync.dataRef.child("n-skeleton-parent"),this.attributeRef.on("value",function(t){var e=t.val();e&&this.el.setAttribute("n-skeleton-parent",e)}.bind(this)),this.el.dataset.creatorUserId&&this.attributeRef.set(Object.assign({},this.el.components["n-skeleton-parent"].data,{userId:this.el.dataset.creatorUserId})),this.el.addEventListener("componentchanged",function(t){if(this.sync.isMine){var e=t.detail.name;"n-skeleton-parent"===e&&this.attributeRef.set(this.el.getAttribute(e))}}.bind(this))},Object.defineProperties(e.prototype,n),e}(M),G=function(t){function e(){t.call(this),this.multiple=!0}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{on:{type:"string"},emit:{type:"string"},gained:{type:"string"},lost:{type:"string"},gain:{type:"string"},lose:{type:"string"},targets:{type:"selectorAll"},target:{type:"selector"}}},e.prototype.init=function(){this.actOnTargets=function(){function t(t){this.data.emit&&t.emit(this.data.emit),this.data.gain&&t.addState(this.data.gain),this.data.lose&&t.removeState(this.data.lose)}this.updateProperties(this.attrValue),this.data.targets&&this.data.targets.forEach(t.bind(this)),this.data.target&&t.call(this,this.data.target),this.data.targets||this.data.target||t.call(this,this.el)}.bind(this),this.actOnTargetsIfStateMatches=function(t){var e=t.detail.state;(e===this.data.gained||e===this.data.lost)&&this.actOnTargets()}.bind(this)},e.prototype.update=function(t){t.on&&this.el.removeEventListener(t.on,this.actOnTargets),t.gained&&this.el.removeEventListener("stateadded",this.actOnTargetsIfStateMatches),t.lost&&this.el.removeEventListener("stateremoved",this.actOnTargetsIfStateMatches),this.data.on&&this.el.addEventListener(this.data.on,this.actOnTargets),this.data.gained&&this.el.addEventListener("stateadded",this.actOnTargetsIfStateMatches),this.data.lost&&this.el.addEventListener("stateremoved",this.actOnTargetsIfStateMatches)},e.prototype.remove=function(){this.el.removeEventListener(this.data.on,this.actOnTargets),this.el.removeEventListener("stateadded",this.actOnTargetsIfStateMatches),this.el.removeEventListener("stateremoved",this.actOnTargetsIfStateMatches)},Object.defineProperties(e.prototype,n),e}(M),K=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{mixin:{type:"string"},parent:{type:"selector"}}},e.prototype.init=function(){var t=this.el.sceneEl;this.syncSys=t.systems["sync-system"],this.syncSys.instantiate(this.data.mixin,this.data.parent||this.el.parentNode,this.el)},Object.defineProperties(e.prototype,n),e}(M),Q=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{on:{type:"string"},mixin:{type:"string"},parent:{type:"selector","default":"a-scene"},group:{type:"string","default":"main"},removeLast:{type:"boolean","default":!0}}},e.prototype.init=function(){this.onHandler=this.instantiateOrToggle.bind(this),this.el.addEventListener(this.data.on,this.onHandler),this.syncSys=this.el.sceneEl.systems["sync-system"]},e.prototype.instantiateOrToggle=function(){var t=this.data.group+"-"+this.syncSys.userInfo.userId;this.data.removeLast?this.syncSys.removeLast(t).then(function(e){e!==this.el.id&&this.syncSys.instantiate(this.data.mixin,this.data.parent,this.el,t,this.el.id)}.bind(this)):this.syncSys.instantiate(this.el.id,t,this.data.mixin,this.data.parent)},e.prototype.remove=function(){this.el.removeEventListener(this.data.on,this.onHandler)},Object.defineProperties(e.prototype,n),e}(M);if(!window.altspace||!altspace.inClient){var z=function(){};a(window,["altspace","addNativeComponent"],z),a(window,["altspace","updateNativeComponent"],z),a(window,["altspace","removeNativeComponent"],z)}var Y=new THREE.BoxGeometry(.001,.001,.001),X=new THREE.MeshBasicMaterial({color:0});X.visible=!1;var J=function(t){function e(){t.call(this,Y,X)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(THREE.Mesh),$=function(t){function e(e,n){void 0===n&&(n=!0),t.call(this),Object.assign(this,{name:e,sendUpdates:n})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(){var t=this,e=this.mesh||this.el.getOrCreateObject3D("mesh",J);this.currentMesh=e,a(e.userData,["altspace","collider","enabled"],!1),altspace.addNativeComponent(e,this.name),this.update(),this.mesh||this._dontRebind||this.el.addEventListener("object3dset",function(e){"mesh"===e.detail.type&&(altspace.removeNativeComponent(t.currentMesh,t.name),t._dontRebind=!0,t.init())}.bind(this))},e.prototype.update=function(){var t=this.mesh||this.el.object3DMap.mesh;this.sendUpdates&&altspace.updateNativeComponent(t,this.name,this.data)},e.prototype.remove=function(){var t=this.mesh||this.el.object3DMap.mesh;altspace.removeNativeComponent(t,this.name)},e.prototype.callComponent=function(t){for(var e=[],n=arguments.length-1;n-->0;)e[n]=arguments[n+1];var i=this.mesh||this.el.object3DMap.mesh;altspace.callNativeComponent(i,this.name,t,e)},e}(M),Z=function(t){function e(){t.call(this,"n-object")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{res:{type:"string"}}},Object.defineProperties(e.prototype,n),e}($),tt=function(t){function e(){t.call(this,"n-spawner")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{res:{type:"string"}}},Object.defineProperties(e.prototype,n),e}($),et=function(t){function e(){t.call(this,"n-billboard",!1)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}($),nt=function(t){function e(){t.call(this,"n-skeleton-parent")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{part:{type:"string"},side:{type:"string","default":"center"},index:{type:"int","default":0},userId:{type:"string"}}},Object.defineProperties(e.prototype,n),e}($),it=function(t){function e(){t.call(this,"n-cockpit-parent",!1)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}($),rt=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{center:{type:"vec3"},type:{type:"string","default":"object"},isTrigger:{"default":!1,type:"boolean"}}},Object.defineProperties(e.prototype,n),e}($),ot=function(t){function e(){t.call(this,"n-sphere-collider")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{radius:{"default":1,type:"number"}}},Object.defineProperties(e.prototype,n),e}(rt),at=function(t){function e(){t.call(this,"n-box-collider")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{size:{type:"vec3","default":{x:1,y:1,z:1}}}},Object.defineProperties(e.prototype,n),e}(rt),st=function(t){function e(){t.call(this,"n-capsule-collider")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{radius:{"default":0,type:"number"},height:{"default":0,type:"number"},direction:{"default":"y"}}},Object.defineProperties(e.prototype,n),e}(rt),ct=function(t){function e(e,n){void 0===e&&(e=null),t.call(this,"n-mesh-collider"),this.mesh=e,this.subcomponents=[]}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{convex:{type:"boolean","default":!0}}},e.prototype.init=function(){var n=this;if(this.mesh)t.prototype.init.call(this);else{this.subcomponents=[];var i=this.el.object3D;i.traverse(function(t){if(t instanceof THREE.Mesh){var i=new e(t);n.subcomponents.push(i),i.data=n.data,i.init()}}.bind(this)),this.el.addEventListener("model-loaded",this.init.bind(this))}},e.prototype.update=function(e){var n=this;this.mesh?t.prototype.update.call(this,e):this.subcomponents.forEach(function(t){t.data=n.data,t.update(e)}.bind(this))},e.prototype.remove=function(){this.mesh?t.prototype.remove.call(this):this.subcomponents.forEach(function(t){t.remove()}.bind(this))},Object.defineProperties(e.prototype,n),e}(rt),ut=function(t){function e(){t.call(this,"n-container")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{capacity:{"default":4,type:"number"}}},e.prototype.init=function(){t.prototype.init.call(this);var e=this.el,n=this;e.addEventListener("stateadded",function(t){"container-full"===t.detail.state&&e.emit("container-full"),"container-empty"===t.detail.state&&e.emit("container-empty")}),e.addEventListener("container-count-changed",function(t){n.count=t.detail.count})},Object.defineProperties(e.prototype,n),e}($),ht=function(t){function e(){t.call(this,"n-portal")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{targetSpace:{type:"string"},targetEvent:{type:"string"},targetEntity:{type:"selector"}}},e.prototype.update=function(){var t,e,n=this.el.object3DMap.mesh;if(this.data.targetEntity){this.el.sceneEl.object3D.updateMatrixWorld(!0),t=this.data.targetEntity.object3D.getWorldPosition();var i=this.data.targetEntity.object3D.getWorldQuaternion();e={x:i.x,y:i.y,z:i.z,w:i.w}}var r={targetSpace:this.data.targetSpace,targetEvent:this.data.targetEvent,targetPosition:t,targetQuaternion:e};altspace.updateNativeComponent(n,this.name,r)},Object.defineProperties(e.prototype,n),e}($);!function(){String.prototype.codePointAt||!function(){var t=function(){try{var t={},e=Object.defineProperty,n=e(t,t,t)&&e}catch(t){}return n}(),e=function(t){if(null==this)throw TypeError();var e=this+"",n=e.length,i=t?+t:0;if(i!=i&&(i=0),!(0>i||i>=n)){var r,o=e.charCodeAt(i);return o>=55296&&56319>=o&&n>i+1&&(r=e.charCodeAt(i+1),r>=56320&&57343>=r)?1024*(o-55296)+r-56320+65536:o}};t?t(String.prototype,"codePointAt",{value:e,configurable:!0,writable:!0}):String.prototype.codePointAt=e}(),String.prototype.repeat||!function(){var t=function(){try{var t={},e=Object.defineProperty,n=e(t,t,t)&&e}catch(t){}return n}(),e=function(t){if(null==this)throw TypeError();var e=this+"",n=t?+t:0;if(n!=n&&(n=0),0>n||n==1/0)throw RangeError();for(var i="";n;)n%2==1&&(i+=e),n>1&&(e+=e),n>>=1;return i};t?t(String.prototype,"repeat",{value:e,configurable:!0,writable:!0}):String.prototype.repeat=e}(),String.prototype.includes||!function(){var t={}.toString,e=function(){try{var t={},e=Object.defineProperty,n=e(t,t,t)&&e}catch(t){}return n}(),n="".indexOf,i=function(e){if(null==this)throw TypeError();var i=this+"";if(e&&"[object RegExp]"==t.call(e))throw TypeError();var r=i.length,o=e+"",a=o.length,s=arguments.length>1?arguments[1]:void 0,c=s?+s:0;return c!=c&&(c=0),!(a+Math.min(Math.max(c,0),r)>r)&&-1!=n.call(i,o,c)};e?e(String.prototype,"includes",{value:i,configurable:!0,writable:!0}):String.prototype.includes=i}(),String.prototype.startsWith||!function(){var t=function(){try{var t={},e=Object.defineProperty,n=e(t,t,t)&&e}catch(t){}return n}(),e={}.toString,n=function(t){if(null==this)throw TypeError();var n=this+"";if(t&&"[object RegExp]"==e.call(t))throw TypeError();var i=n.length,r=t+"",o=r.length,a=arguments.length>1?arguments[1]:void 0,s=a?+a:0;s!=s&&(s=0);var c=Math.min(Math.max(s,0),i);if(o+c>i)return!1;for(var u=-1;++u1){var s=arguments[1];void 0!==s&&(a=s?+s:0,a!=a&&(a=0))}var c=Math.min(Math.max(a,0),i),u=c-o;if(0>u)return!1;for(var h=-1;++hl||l>1114111||n(l)!=l)throw RangeError("Invalid code point: "+l);65535>=l?s.push(l):(l-=65536,i=(l>>10)+55296,r=l%1024+56320,s.push(i,r)),(c+1==u||s.length>a)&&(h+=e.apply(null,s),s.length=0)}return h};t?t(String,"fromCodePoint",{value:i,configurable:!0,writable:!0}):String.fromCodePoint=i}(),Object.defineProperty(String,"raw",{configurable:!0,enumerable:!1,writable:!0,value:function(t,e){var n;t=null!=t?t:{},e=arguments.length>1?i(arguments).slice(1):[];try{n=i(t.raw)}catch(i){throw new TypeError("Cannot convert undefined or null to object")}return n.map(function(n,i){return t.raw.length<=i?n:null!=e[i-1]?e[i-1]+n:n}).join("")}})}();var lt=function(t){function e(){t.call(this,"n-sound")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{res:{type:"string"},src:{type:"string"},on:{type:"string"},loop:{type:"boolean"},volume:{type:"number","default":1},autoplay:{type:"boolean"},oneshot:{type:"boolean"},spatialBlend:{type:"float","default":1},pitch:{type:"float","default":1},minDistance:{type:"float","default":1},maxDistance:{type:"float","default":12},rolloff:{type:"string","default":"logarithmic"}}},e.prototype.init=function(){var e=this.data.src;if(e&&!e.startsWith("http"))if(e.startsWith("/"))this.data.src=location.origin+e;else{var n=location.pathname;n.endsWith("/")||(n=location.pathname.split("/").slice(0,-1).join("/")+"/"),this.data.src=location.origin+n+e}t.prototype.init.call(this)},e.prototype.update=function(e){t.prototype.update.call(this,e),this.playHandler&&this.el.removeEventListener(e.on,this.playHandler),this.data.on&&(this.playHandler=this.playSound.bind(this),this.el.addEventListener(this.data.on,this.playHandler))},e.prototype.remove=function(){t.prototype.remove.call(this),this.playHandler&&this.el.removeEventListener(this.data.on,this.playHandler)},e.prototype.pauseSound=function(){this.callComponent("pause"),this.el.emit("sound-paused")},e.prototype.playSound=function(){this.callComponent("play"),this.el.emit("sound-played")},e.prototype.seek=function(t){this.callComponent("seek",{time:t})},Object.defineProperties(e.prototype,n),e}($),ft=function(t){function e(){t.call(this,"n-layout-browser")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{url:{"default":"about:blank"},isEnclosure:{"default":!1}}},Object.defineProperties(e.prototype,n),e}($),pt=function(t){function e(){t.call(this,"n-text")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{text:{"default":"",type:"string"},fontSize:{"default":10,type:"int"},width:{"default":10,type:"number"},height:{"default":1,type:"number"},horizontalAlign:{"default":"middle"},verticalAlign:{"default":"middle"}}},Object.defineProperties(e.prototype,n),e}($),dt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(){function t(e){return e.isMesh?e:0===e.children.length?null:e.children.reduce(function(e,n){return e||t(n)},null)}var e=this;this.el.addEventListener("model-loaded",function(){e.el.setObject3D("mesh",t(e.el.object3DMap.mesh))})},e}(M);window.AFRAME&&delete AFRAME.components.visible;var gt=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{"default":!0}},e.prototype.init=function(){this.el.addEventListener("model-loaded",this.update.bind(this))},e.prototype.update=function(){var t=this;this.el.object3D.traverse(function(e){return e.visible=t.data})},Object.defineProperties(e.prototype,n),e}(M);window.AFRAME&&(r("altspace-cursor-collider",D),r("altspace-tracked-controls",P),r("altspace",U),o("sync-system",H),r("sync-color",N),r("sync-transform",q),r("sync",B),r("sync-n-sound",W),r("sync-n-skeleton-parent",V),r("wire",G),r("one-per-user",K),r("instantiator",Q),r("n-object",Z),r("n-portal",ht),r("n-spawner",tt),r("n-text",pt),r("n-billboard",et),r("n-skeleton-parent",nt),r("n-cockpit-parent",it),r("n-container",ut),r("n-sound",lt),r("n-sphere-collider",ot),r("n-box-collider",at),r("n-capsule-collider",st),r("n-mesh-collider",ct),r("n-layout-browser",ft),r("collapse-model",dt),r("visible",gt));var bt,yt,vt,mt,wt=Object.freeze({AltspaceComponent:U,AltspaceCursorCollider:D,AltspaceTrackedControls:P,SyncSystem:H,SyncComponent:B,SyncColor:N,SyncTransform:q,SyncNSound:W,Wire:G,OnePerUser:K,Instantiator:Q,SyncNSkeletonParent:V,NObject:Z,NPortal:ht,NSpawner:tt,NText:pt,NBillboard:et,NSkeletonParent:nt,NCockpitParent:it,NContainer:ut,NSound:lt,NSphereCollider:ot,NBoxCollider:at,NCapsuleCollider:st,NMeshCollider:ct,NLayoutBrowser:ft,CollapseModel:dt}),Et=altspace&&altspace.inClient,_t=u(),jt=Object.freeze({connect:l}),St=new THREE.Raycaster,Ft=Object.freeze({init:f}),At=function(t){void 0===t&&(t={auto:!0}),this._scene=null,this._renderer=null,this._camera=null;var e=window.AFRAME&&document.querySelector("a-scene");if(e){var n=document.querySelector("a-scene");this._scene=n.object3D,this._renderer=n.renderer;var i=document.querySelector("a-camera");i&&(this._camera=i.object3D)}else window.altspace&&altspace.inClient?(this._scene=new THREE.Scene,this._renderer=altspace.getThreeJSRenderer(),this._camera=new THREE.PerspectiveCamera):this._setupWebGL();t.auto&&!e&&this.loop()},Ot={scene:{},renderer:{},camera:{}};At.prototype._setupWebGL=function(){function t(){i.aspect=window.innerWidth/window.innerHeight,i.updateProjectionMatrix(),n.setSize(window.innerWidth,window.innerHeight)}var e=this._scene=new THREE.Scene,n=this._renderer=new THREE.WebGLRenderer({antialias:!0}),i=this._camera=new THREE.PerspectiveCamera;document.addEventListener("DOMContentLoaded",function(t){document.body.style.margin="0px",document.body.style.overflow="hidden",n.setClearColor("#035F72");var e=document.createElement("div");document.body.appendChild(e),e.appendChild(n.domElement)}),window.addEventListener("resize",t),t(),i.position.z=500,i.fov=45,i.near=1,i.far=2e3,e.add(i),e.add(new THREE.AmbientLight("white")),this.cursor=f(e,i)},At.prototype.loop=function(){window.requestAnimationFrame(this.loop.bind(this)),this.scene.updateAllBehaviors&&this.scene.updateAllBehaviors(),this.renderer.render(this.scene,this.camera)},Ot.scene.get=function(){return this._scene},Ot.renderer.get=function(){return this._renderer},Ot.camera.get=function(){return this._camera},Object.defineProperties(At.prototype,Ot);var Ct,kt,Tt="",Rt="",xt=function(){this.objUrls=[],this.mtlUrls=[],this.objects=[],this.error=null,this.objectsLoaded=0},Lt=Object.freeze({init:v,load:m,LoadRequest:xt}),It="VR CodePen",Mt=window.name&&"pen-"===window.name.slice(0,4),Dt=!!window.altspace.inClient,Pt=!!location.href.match("codepen.io/"),Ut=Object.freeze({inTile:Mt,inVR:Dt,inCodePen:Pt,ensureInVR:_,setName:j,getPenId:F,getAuthorId:A,printDebugInfo:E}),Nt=function(){};Nt.prototype.load=function(t,e,n){var i=new THREE.MTLLoader,r=e.split("/").slice(0,-1).join("/");i.setTexturePath(r+"/"),i.setCrossOrigin(this.crossOrigin),i.load(e,function(e){var i=new THREE.OBJLoader;i.setMaterials(e),i.load(t,n)})},THREE&&!altspace.inClient&&(THREE.EventDispatcher.prototype.dispatchEvent=O,THREE.Object3D.prototype.dispatchEvent=O),THREE.Scene.prototype.updateAllBehaviors=function(){var t=performance.now(),e=this.__lastNow||t,n=t-e,i=this,r=[];this.traverse(function(t){t.__behaviorList&&r.push(t)});for(var o=0,a=r.length;a>o;o++){var s=r[o];s.updateBehaviors(n,i)}this.__lastNow=t},THREE.Object3D.prototype.addBehavior=function(t){this.addBehaviors(t)},THREE.Object3D.prototype.addBehaviors=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];this.__behaviorList=this.__behaviorList||[],(n=this.__behaviorList).push.apply(n,t);var n},THREE.Object3D.prototype.removeBehavior=function(t){if(!this.__behaviorList||0===this.__behaviorList.length)return null;var e=this.__behaviorList.indexOf(t);if(-1!==e){this.__behaviorList.splice(e,1);try{t.dispose&&t.dispose.call(t,this)}catch(n){console.group(),(console.error||console.log).call(console,n.stack||n),console.log("[Behavior]"),console.log(t),console.log("[Object3D]"),console.log(this),console.groupEnd()}}},THREE.Object3D.prototype.removeAllBehaviors=function(){var t=this;if(!this.__behaviorList||0===this.__behaviorList.length)return null;for(var e=0,n=this.__behaviorList.length;n>e;e++){var i=t.__behaviorList[e];try{i.dispose&&i.dispose.call(i,t)}catch(r){console.group(),(console.error||console.log).call(console,r.stack||r),console.log("[Behavior]"),console.log(i),console.log("[Object3D]"),console.log(t),console.groupEnd()}}this.__behaviorList.length=0},THREE.Object3D.prototype.getBehaviorByType=function(t){var e=this;if(!this.__behaviorList||0===this.__behaviorList.length)return null;for(var n=0,i=this.__behaviorList.length;i>n;n++)if(e.__behaviorList[n].type===t)return e.__behaviorList[n]},THREE.Object3D.prototype.updateBehaviors=function(t,e){var n=this;if(this.__behaviorList&&0!==this.__behaviorList.length){for(var i=[],r=this.__behaviorList.slice(),o=0,a=this.__behaviorList.length;a>o;o++){var s=n.__behaviorList[o];s.__isInitialized||i.push(s)}for(var o=0,a=i.length;a>o;o++){var s=i[o];try{s.awake&&s.awake.call(s,n,e)}catch(c){console.group(),(console.error||console.log).call(console,c.stack||c),console.log("[Behavior]"),console.log(s),console.log("[Object3D]"),console.log(n),console.groupEnd()}}for(var o=0,a=i.length;a>o;o++){var s=i[o];try{s.start&&s.start.call(s)}catch(c){console.group(),(console.error||console.log).call(console,c.stack||c),console.log("[Behavior]"),console.log(s),console.log("[Object3D]"),console.log(n),console.groupEnd()}s.__isInitialized=!0}for(var o=0,a=r.length;a>o;o++){var s=r[o];try{s.update&&s.update.call(s,t)}catch(c){console.group(),(console.error||console.log).call(console,c.stack||c),console.log("[Behavior]"),console.log(s),console.log("[Object3D]"),console.log(n),console.groupEnd()}}}};var Bt=Object.freeze({OBJMTLLoader:Nt,cursor:Ft}),Ht=function(){},qt={type:{}};qt.type.get=function(){return this._typeWarning||(console.warn("Behavior",this,"does not expose type information!","It will not be queryable by getBehaviorByType, which will break","some built-in behaviors."),this._typeWarning=!0),null},Ht.prototype.awake=function(t,e){},Ht.prototype.start=function(){},Ht.prototype.update=function(t){},Ht.prototype.dispose=function(t){},Object.defineProperties(Ht.prototype,qt);var Wt=function(t){function e(e){t.call(this),this.config=Object.assign({x:3,y:5,shouldRotate:!0,shouldMove:!0},e),this.object3d=null,this.offsetPosition=null,this.lastBobPosition=new THREE.Vector3,this.nowOffset=1e4*Math.random()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"Bob"},e.prototype.awake=function(t){this.object3d=t,this.offsetPosition=this.object3d.position.clone()},e.prototype.update=function(t){var e=Math.floor(performance.now())+this.nowOffset;this.config.shouldMove&&(this.lastBobPosition.equals(this.object3d.position)||this.offsetPosition.copy(this.object3d.position),this.object3d.position.y=this.offsetPosition.y+Math.sin(e/800)*this.config.x,this.object3d.position.x=this.offsetPosition.x+Math.sin(e/500)*this.config.y,this.lastBobPosition.copy(this.object3d.position)),this.config.shouldRotate&&(this.object3d.rotation.x=Math.sin(e/500)/15)},Object.defineProperties(e.prototype,n),e}(Ht),Vt=function(t){function e(e){t.call(this),this.config=Object.assign({overBrightness:1.5,downBrightness:.5},e),this.object3d=null,this.scene=null,this.originalColor=null,this.modifiedColor=new THREE.Color,this._cbs={cursorenter:this.cursorEnter.bind(this),cursordown:this.cursorDown.bind(this),cursorup:this.cursorUp.bind(this),cursorleave:this.cursorLeave.bind(this)}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"ButtonStateStyle"},e.prototype.awake=function(t,e){this.object3d=t,this.scene=e,this.originalColor=this.config.originalColor||this.object3d.material.color, -this.object3d.addEventListener("cursorenter",this._cbs.cursorenter),this.object3d.addEventListener("cursordown",this._cbs.cursordown)},e.prototype.dispose=function(){this.object3d.removeEventListener("cursorenter",this._cbs.cursorenter),this.object3d.removeEventListener("cursorleave",this._cbs.cursorleave),this.object3d.removeEventListener("cursorup",this._cbs.cursorup),this.object3d.removeEventListener("cursordown",this._cbs.cursordown)},e.prototype.changeBrightness=function(t){this.modifiedColor.set(this.originalColor),this.modifiedColor.multiplyScalar(t),this.modifiedColor.r=THREE.Math.clamp(this.modifiedColor.r,0,1),this.modifiedColor.g=THREE.Math.clamp(this.modifiedColor.g,0,1),this.modifiedColor.b=THREE.Math.clamp(this.modifiedColor.b,0,1),this.object3d.material.color=this.modifiedColor},e.prototype.cursorLeave=function(){this.object3d.removeEventListener("cursorleave",this._cbs.cursorleave),this.changeBrightness(1)},e.prototype.cursorEnter=function(){this.changeBrightness(this.config.overBrightness),this.object3d.addEventListener("cursorleave",this._cbs.cursorleave)},e.prototype.cursorUp=function(t){this.scene.removeEventListener("cursorup",this._cbs.cursorup),this.object3d.addEventListener("cursorenter",this._cbs.cursorenter),t.target===this.object3d?(this.changeBrightness(this.config.overBrightness),this.object3d.addEventListener("cursorleave",this._cbs.cursorleave)):this.changeBrightness(1)},e.prototype.cursorDown=function(){this.scene.addEventListener("cursorup",this._cbs.cursorup),this.object3d.removeEventListener("cursorleave",this._cbs.cursorleave),this.object3d.removeEventListener("cursorenter",this._cbs.cursorenter),this.changeBrightness(this.config.downBrightness)},Object.defineProperties(e.prototype,n),e}(Ht),Gt=function(t){function e(e){t.call(this),this.config=e=Object.assign({space:"world",x:!1,y:!1,z:!1,cursorSnap:!0},e),this.min=new THREE.Vector3(void 0!==e.x.min?e.x.min:Number.NEGATIVE_INFINITY,void 0!==e.y.min?e.y.min:Number.NEGATIVE_INFINITY,void 0!==e.z.min?e.z.min:Number.NEGATIVE_INFINITY),this.max=new THREE.Vector3(void 0!==e.x.max?e.x.max:Number.POSITIVE_INFINITY,void 0!==e.y.max?e.y.max:Number.POSITIVE_INFINITY,void 0!==e.z.max?e.z.max:Number.POSITIVE_INFINITY),this.object3d=null,this.scene=null,this.sync=null,this.intersector=null,this.dragOffset=new THREE.Vector3,this.raycaster=new THREE.Raycaster,this.raycaster.linePrecision=3,this._cbs={startDrag:this.startDrag.bind(this),moveDrag:this.moveDrag.bind(this),stopDrag:this.stopDrag.bind(this)}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"Drag"},e.prototype.awake=function(t,e){this.object3d=t,this.scene=e,this.sync=t.getBehaviorByType("Object3DSync"),this.makeIntersector(),this.scene.add(this.intersector)},e.prototype.start=function(){this.object3d.addEventListener("cursordown",this._cbs.startDrag)},e.prototype.dispose=function(){this.object3d.removeEventListener("cursordown",this._cbs.startDrag)},e.prototype.makeIntersector=function(){function t(){r.rotateY(Math.PI)}function e(){r.rotateX(Math.PI/2)}function n(){r.rotateY(Math.PI/2)}var i=1e4,r=new THREE.PlaneGeometry(i,i),o=!!this.config.x,a=!!this.config.y,s=!!this.config.z,c=o+a+s;if(3===c)throw new Error("Arbitrary dragging currently unsupported. Please lock at least one axis.");if(2!==c)throw 1===c?new Error("Single axis dragging currently unsupported."):new Error("Invalid axis configuration");o&&a?t():o&&s?e():a&&s&&n();var u=new THREE.MeshBasicMaterial({color:"purple"});u.side=THREE.DoubleSide,this.intersector=new THREE.Mesh(r,u),this.intersector.visible=!1,this.intersector.material.visible=!1},e.prototype.startDrag=function(t){this.scene.addEventListener("cursorup",this._cbs.stopDrag),this.scene.addEventListener("cursormove",this._cbs.moveDrag),this.raycaster.set(t.ray.origin,t.ray.direction);var e=this.raycaster.intersectObject(this.object3d,!0)[0];if(e){var n=e.point.clone(),i=C(this.object3d).clone();this.dragOffset.copy(n).sub(i),this.intersector.position.copy(this.intersector.parent.worldToLocal(n)),this.intersector.quaternion.copy(this.object3d.parent.quaternion),this.intersector.updateMatrixWorld();var r=this.createDragEvent("dragstart");this.object3d.dispatchEvent(r)}},e.prototype.moveDrag=function(t){this.sync&&!this.sync.isMine&&this.sync.takeOwnership(),this.intersector.visible=!0,this.raycaster.set(t.ray.origin,t.ray.direction);var e=this.raycaster.intersectObject(this.intersector,!0)[0];if(this.intersector.visible=!1,e){var n=new THREE.Vector3;n.copy(e.point).sub(this.dragOffset);var i=this,r=C(this.object3d);["x","y","z"].filter(function(t){return!i.config[t]}).forEach(function(t){n[t]=r[t]}),n.clamp(this.min,this.max),this.object3d.parent.updateMatrixWorld();var o=this.object3d.parent.worldToLocal(n);this.object3d.position.set(this.config.x?o.x:this.object3d.position.x,this.config.y?o.y:this.object3d.position.y,this.config.z?o.z:this.object3d.position.z)}},e.prototype.stopDrag=function(){this.scene.removeEventListener("cursorup",this._cbs.stopDrag),this.scene.removeEventListener("cursormove",this._cbs.moveDrag);var t=this.createDragEvent("dragstop");this.object3d.dispatchEvent(t)},e.prototype.createDragEvent=function(t){return{type:t,bubbles:!0,target:this.object3d,ray:this.raycaster.ray.clone()}},Object.defineProperties(e.prototype,n),e}(Ht),Kt=.2,Qt=function(t){function e(e){t.call(this),this.config=Object.assign({position:!0,rotation:!0,scale:!0},e),this.object3d=null,this.gamepad=null,this.scene=null,this.sync=null,this.isAltModeR=!1,this.isAltModeL=!1,this.prevAltButtonR=!1,this.prevAltButtonL=!1,this.isInitialized=!1,this.originalObj=null}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"GamepadControls"},e.prototype.awake=function(t,e){var n=this;if(this.object3d=t,this.scene=e,this.sync=this.object3d.getBehaviorByType("Object3DSync"),this.originalObj=this.object3d.clone(),this.gamepad=this.getGamepad(),this.gamepad)console.log("Gamepad detected: "+this.gamepad.id);else var i=setInterval(function(){n.gamepad=n.getGamepad(),n.gamepad&&(console.log("Gamepad connected: "+n.gamepad.id),clearInterval(i))}.bind(this),500);this.scene.addEventListener("cursordown",function(t){n.gamepad&&!n.isInitialized&&(n.preventDefault(n.gamepad),n.isInitialized=!0)}.bind(this))},e.prototype.getGamepad=function(){var t=this,e=[];if(e=altspace&&altspace.inClient?altspace.getGamepads():navigator.getGamepads(),e.length>0)for(var n=0;nKt||Math.abs(r)>Kt;o&&!this.sync.isMine&&this.sync.takeOwnership();var a=200*(t/1e3);Math.abs(i)>Kt&&(this.object3d.position.x+=a*i),Math.abs(r)>Kt&&(this.isAltModeL?this.object3d.position.y+=a*-r:this.object3d.position.z+=a*r)}if(this.config.rotation){var s=this.gamepad.buttons[11].pressed;this.prevAltButtonR&&!s&&(this.isAltModeR=!this.isAltModeR),this.prevAltButtonR=s;var c=this.gamepad.axes[2],u=this.gamepad.axes[3],h=Math.abs(c)>Kt||Math.abs(u)>Kt;h&&!this.sync.isMine&&this.sync.takeOwnership();var l=Math.PI*(t/1e3);!this.isAltModeR&&Math.abs(u)>Kt&&(this.object3d.rotation.x+=l*u),Math.abs(c)>Kt&&(this.isAltModeR?this.object3d.rotation.z+=l*-c:this.object3d.rotation.y+=l*c)}if(this.config.scale){var f=10*(t/1e3),p=this.gamepad.buttons[12].pressed,d=this.gamepad.buttons[13].pressed,g=this.gamepad.buttons[12].pressed||this.gamepad.buttons[13].pressed;g&&!this.sync.isMine&&this.sync.takeOwnership();var b=this.object3d.scale,y=new THREE.Vector3(1,1,1);y.multiplyScalar(f),p&&this.object3d.scale.add(y),d&&b.x>y.x&&b.y>y.y&&b.z>y.z&&this.object3d.scale.sub(y)}}},Object.defineProperties(e.prototype,n),e}(Ht),zt=function(t){function e(e){var n=this;if(t.call(this),this.config=Object.assign({event:"cursorenter",color:new THREE.Color("yellow")},e),"cursorenter"!==this.config.event&&"cursordown"!==this.config.event)throw Error('Expected config.event "cursorenter" or "cursordown"');this.object3d=null,this.cursordownObject=null,this.cursorenterObject=null,this.scene=null,this.cursordown=function(t){n.cursordownObject=n.object3d,"cursordown"===n.config.event&&n.setColor(n.cursordownObject)}.bind(this),this.cursorenter=function(t){n.cursordownObject&&n.cursordownObject!==n.object3d||(n.cursorenterObject&&n.unsetColor(n.cursorenterObject),n.cursorenterObject=n.object3d,n.setColor(n.object3d))}.bind(this),this.cursorleave=function(t){n.cursorenterObject===n.object3d&&(n.cursorenterObject=null,n.unsetColor(n.object3d))}.bind(this),this.cursorupScene=function(t){"cursordown"===n.config.event&&n.cursordownObject&&n.unsetColor(n.cursordownObject),n.cursordownObject=null}.bind(this)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"HoverColor"},e.prototype.awake=function(t,e){this.object3d=t,this.scene=e,this.object3d.addEventListener("cursordown",this.cursordown),this.scene.addEventListener("cursorup",this.cursorupScene),"cursorenter"===this.config.event&&(this.object3d.addEventListener("cursorenter",this.cursorenter),this.object3d.addEventListener("cursorleave",this.cursorleave))},e.prototype.dispose=function(){this.object3d.removeEventListener("cursordown",this.cursordown),this.scene.removeEventListener("cursorup",this.cursorupScene),this.object3d.removeEventListener("cursorenter",this.cursorenter),this.object3d.removeEventListener("cursorleave",this.cursorleave)},e.prototype.setColor=function(t){t.material&&t.material.color&&(t.userData.origColor=t.material.color,t.material.color=this.config.color,t.material&&(t.material.needsUpdate=!0)),t.children.forEach(this.setColor.bind(this))},e.prototype.unsetColor=function(t){if(t.material&&t.material.color){if(!t.userData.origColor)return void console.error("Cannot unsetColor, no userData.origColor for object",t);t.material.color=t.userData.origColor,t.material&&(t.material.needsUpdate=!0)}t.children.forEach(this.unsetColor.bind(this))},Object.defineProperties(e.prototype,n),e}(Ht),Yt=function(t){function e(e){var n=this;t.call(this),this.config=Object.assign({scale:1.15,duration:75,revertOnDispose:!0},e),this.object3d=null,this.originalScale=null,this.elapsedTime=this.config.duration,this.progress=1,this.srcScale=null,this.destScale=null,this.onHoverStateChange=function(){var t;t=[n.destScale,n.srcScale],n.srcScale=t[0],n.destScale=t[1],n.progress=1-n.progress,n.elapsedTime=n.config.duration-n.elapsedTime}.bind(this)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"HoverScale"},e.prototype.awake=function(t,e){this.object3d=t,this.originalScale=this.object3d.scale.clone(),this.srcScale=this.object3d.scale.clone(),this.srcScale.multiplyScalar(this.config.scale),this.destScale=new THREE.Vector3,this.destScale.copy(this.originalScale),this.progress=1,this.elapsedTime=this.config.duration,this.object3d.addEventListener("cursorenter",this.onHoverStateChange),this.object3d.addEventListener("cursorleave",this.onHoverStateChange)},e.prototype.update=function(t){this.progress<1&&(this.elapsedTime=THREE.Math.clamp(this.elapsedTime+t,0,this.config.duration),this.progress=THREE.Math.clamp(this.elapsedTime/this.config.duration,0,1),this.object3d.scale.lerpVectors(this.srcScale,this.destScale,this.progress))},e.prototype.dispose=function(){this.object3d.removeEventListener("cursorenter",this.onHoverStateChange),this.object3d.removeEventListener("cursorleave",this.onHoverStateChange),this.config.revertOnDispose&&this.object3d.scale.copy(this.originalScale),this.originalScale=null,this.srcScale=null,this.destScale=null,this.object3d=null},Object.defineProperties(e.prototype,n),e}(Ht),Xt=function(t){function e(n){t.call(this),this.config=Object.assign({jointCubeSize:15,joints:e.HAND_JOINTS},n),this.object3d=null,this.skeleton=null,this.jointCube=null,this.hasCollided=!1,this.collidedJoints=[],this.jointIntersectUnion=null}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"JointCollisionEvents"},e.prototype.awake=function(t,e){this.object3d=t;var n=this;k(e).then(function(t){n.skeleton=t,n.jointCube=new THREE.Vector3(n.config.jointCubeSize,n.config.jointCubeSize,n.config.jointCubeSize)})["catch"](function(t){console.log("Failed to get tracking skeleton",t)})},e.prototype.update=function(t){var e=this;if(this.skeleton){for(var n=[],i=0;iNumber.EPSILON&&this.object3d.scale.y>Number.EPSILON&&this.object3d.scale.z>Number.EPSILON)for(var c=0;c0){if(T(t,this.lastTransform))return;this.transformRef.set(t),this.lastTransform=t}}},e.prototype.takeOwnership=function(){this.ownerRef.set(this.sceneSync.clientId)},Object.defineProperties(e.prototype,n),e}(Ht),fe=[],pe={},de={},ge=function(t){function e(e,n){t.call(this),this.config=Object.assign({instantiators:{},destroyers:{},ready:null,autoSendRateMS:100},n),this.instanceRef=e,this.sceneRef=e.child("scene"),this.clientsRef=e.child("clients"),this.clientId=null,this.masterClientId=null}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{},isMasterClient:{}};return n.type.get=function(){return"SceneSync"},e.prototype.awake=function(t,e){var n=this;setInterval(R,this.config.autoSendRateMS);var i=e;this.clientId=i.uuid,this.clientsRef.on("value",function(t){var e=t.val();if(e){var i=Object.keys(e)[0];n.masterClientId=e[i]}}.bind(this)),this.clientsRef.push(this.clientId).onDisconnect().remove(),this.instanceRef.child("initialized").once("value",function(t){var e=!t.val();t.ref().set(!0),n.config.ready&&n.config.ready(e)}.bind(this)),this.sceneRef.on("child_added",this.onInstantiate.bind(this)),this.sceneRef.on("child_removed",this.onDestroy.bind(this))},e.prototype.instantiate=function(t,e,n){void 0===e&&(e={});var i=this.sceneRef.push({syncType:t,initData:e},function(t){if(t)throw Error("Failed to save to Firebase",t)});n&&i.onDisconnect().remove();var r=pe[i.key()];return r.getBehaviorByType("Object3DSync").takeOwnership(),r},e.prototype.onInstantiate=function(t){var e=t.val(),n=t.key(),i=this.config.instantiators[e.syncType];if(!i)return void console.warn("No instantiator found for syncType: "+e.syncType);var r=i(e.initData,e.syncType);if(!r)return void console.error(e.syncType+".create must return an Object3D");pe[n]=r,de[r.uuid]=n;var o=r.getBehaviorByType("Object3DSync");return o?(fe.push(o),void o.link(t.ref(),this)):void console.error(e.syncType+" instantiator must return an Object3D with an Object3DSync behavior")},e.prototype.destroy=function(t){var e=de[t.uuid];return e?(this.sceneRef.child(e).remove(function(t){t&&console.warn("Failed to remove from Firebase",t)}),void this.sceneRef.child(e).off()):void console.warn("Failed to find key for object3d to be destroyed",t)},e.prototype.onDestroy=function(t){function e(t){t.removeAllBehaviors(),t.parent&&t.parent.remove(t),t.geometry&&t.geometry.dispose(),t.material&&(t.material.map&&t.material.map.dispose(),t.material.dispose())}var n=t.val(),i=t.key(),r=pe[i];if(!r)return void console.warn("Failed to find object matching deleted key",i);var o=n.syncType;if(!o)return void console.warn("No syncType found for object being destroyed",r);var a=this.config.destroyers[o],s=!a;a&&(s=a(r)),s&&e(r),delete pe[i],delete de[r.uuid]},n.isMasterClient.get=function(){return this.masterClientId===this.clientId},Object.defineProperties(e.prototype,n),e}(Ht),be=function(t){function e(e){t.call(this),this.config=Object.assign({speed:1e-4,axis:new THREE.Vector3(0,1,0)},e),this.config.axis.normalize(),this.object3d=null}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"Spin"},e.prototype.awake=function(t){this.object3d=t},e.prototype.update=function(t){this.object3d.rotateOnAxis(this.config.axis,this.config.speed*t)},Object.defineProperties(e.prototype,n),e}(Ht),ye=function(t){function e(e){t.call(this),this.config=Object.assign({logging:!1},e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"SteamVRInput"},e.prototype.awake=function(){var t=this;this.leftControllerPromise=x(e.LEFT_CONTROLLER,this.config),this.rightControllerPromise=x(e.RIGHT_CONTROLLER,this.config),this.firstControllerPromise=Promise.race([this.leftControllerPromise,this.rightControllerPromise]),this.leftControllerPromise.then(function(e){t.leftController=e}),this.rightControllerPromise.then(function(e){t.rightController=e}),this.firstControllerPromise.then(function(n){t.firstController=n;var i=n.axes.map(function(){return!1}),r=n.buttons.map(function(){return!1});r[e.BUTTON_TRIGGER]=!0,r[e.BUTTON_TOUCHPAD]=!0,n.preventDefault(i,r)})},Object.defineProperties(e.prototype,n),e}(Ht);Object.assign(ye,{BUTTON_TRIGGER:0,BUTTON_GRIP:1,BUTTON_TOUCHPAD:2,BUTTON_DPAD_UP:3,BUTTON_DPAD_RIGHT:4,BUTTON_DPAD_DOWN:5,BUTTON_DPAD_LEFT:6,AXIS_TOUCHPAD_X:0,AXIS_TOUCHPAD_Y:1,FIRST_CONTROLLER:"first",LEFT_CONTROLLER:"left",RIGHT_CONTROLLER:"right"});var ve=function(t){function e(e){var n=e.hand;void 0===n&&(n="first"),t.call(this),this._hand=n}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"SteamVRTrackedObject"},e.prototype.awake=function(t,e){this._object3d=t,this._scene=e,this._steamVRInput=this._scene.getBehaviorByType("SteamVRInput")},e.prototype.update=function(){var t=this._steamVRInput[this._hand+"Controller"],e=this._object3d;if(t){var n=t.position,i=n.x,r=n.y,o=n.z;e.position.set(i,r,o);var a=t.rotation,i=a.x,r=a.y,o=a.z,s=a.w;e.quaternion.set(i,r,o,s)}},Object.defineProperties(e.prototype,n),e}(Ht),me=function(t){function e(e){void 0===e&&(e={}),t.call(this),this.object3d=null,this.scene=null,this.startingRotation=null,this.activelyRotating=!1,this.lastDisplacementX=0,this.runningCount=5,this.runningAverageVelocityX=0}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"TouchpadRotate"},e.prototype.awake=function(t,e){this.object3d=t,this.scene=e,altspace.addEventListener("touchpadup",this.onTouchpadUp.bind(this)),altspace.addEventListener("touchpaddown",this.onTouchpadDown.bind(this)),altspace.addEventListener("touchpadmove",this.onTouchpadMove.bind(this))},e.prototype.update=function(t){!this.activelyRotating&&Math.abs(this.runningAverageVelocityX)>.01&&(this.object3d.rotation.y+=this.runningAverageVelocityX,this.runningAverageVelocityX*=.97)},e.prototype.onTouchpadUp=function(t){this.activelyRotating=!1},e.prototype.onTouchpadDown=function(t){this.activelyRotating=!0,this.startingRotation=this.object3d.rotation.clone()},e.prototype.onTouchpadMove=function(t){var e=t.displacementX-this.lastDisplacementX;this.object3d.rotation.set(this.startingRotation.x,this.startingRotation.y+t.displacementX/300,this.startingRotation.z),this.runningAverageVelocityX=(this.runningAverageVelocityX*this.runningCount+e/300)/(this.runningCount+1),this.lastDisplacementX=t.displacementX},Object.defineProperties(e.prototype,n),e}(Ht),we=Object.freeze({Behavior:Ht,Bob:Wt,ButtonStateStyle:Vt,Drag:Gt,GamepadControls:Qt,HoverColor:zt,HoverScale:Yt,JointCollisionEvents:Xt,Layout:he,Object3DSync:le,SceneSync:ge,Spin:be,SteamVRInput:ye,SteamVRTrackedObject:ve,TouchpadRotate:me}),Ee=Object.freeze({sync:jt,Simulation:At,multiloader:Lt,codePen:Ut,shims:Bt,behaviors:we});Object.isFrozen(window.altspace)||Object.assign(window.altspace,{components:{},utilities:{},inClient:!1});var _e="2.7.4";window.altspace.requestVersion&&window.altspace.requestVersion(_e),window.AFRAME&&!window.THREE&&(window.THREE=window.AFRAME.THREE),Object.assign(window.altspace.components||{},wt),Object.assign(window.altspace.utilities||{},Ee)}(Firebase,Url,Please); \ No newline at end of file +new X(this.k,this.path)},U.prototype.onDisconnect=U.prototype.ib,U.prototype.N=function(t,e,n){Q("FirebaseRef.auth() being deprecated. Please use FirebaseRef.authWithCustomToken() instead."),x("Firebase.auth",1,3,arguments.length),cg("Firebase.auth",t),A("Firebase.auth",2,e,!0),A("Firebase.auth",3,e,!0),Qg(this.k.N,t,{},{remember:"none"},e,n)},U.prototype.auth=U.prototype.N,U.prototype.he=function(t){x("Firebase.unauth",0,1,arguments.length),A("Firebase.unauth",1,t,!0),Rg(this.k.N,t)},U.prototype.unauth=U.prototype.he,U.prototype.ye=function(){return x("Firebase.getAuth",0,0,arguments.length),this.k.N.ye()},U.prototype.getAuth=U.prototype.ye,U.prototype.vg=function(t,e){x("Firebase.onAuth",1,2,arguments.length),A("Firebase.onAuth",1,t,!1),mb("Firebase.onAuth",2,e),this.k.N.Fb("auth_status",t,e)},U.prototype.onAuth=U.prototype.vg,U.prototype.ug=function(t,e){x("Firebase.offAuth",1,2,arguments.length),A("Firebase.offAuth",1,t,!1),mb("Firebase.offAuth",2,e),this.k.N.hc("auth_status",t,e)},U.prototype.offAuth=U.prototype.ug,U.prototype.Xf=function(t,e,n){x("Firebase.authWithCustomToken",2,3,arguments.length),cg("Firebase.authWithCustomToken",t),A("Firebase.authWithCustomToken",2,e,!1),fg("Firebase.authWithCustomToken",3,n,!0),Qg(this.k.N,t,{},n||{},e)},U.prototype.authWithCustomToken=U.prototype.Xf,U.prototype.Yf=function(t,e,n){x("Firebase.authWithOAuthPopup",2,3,arguments.length),eg("Firebase.authWithOAuthPopup",t),A("Firebase.authWithOAuthPopup",2,e,!1),fg("Firebase.authWithOAuthPopup",3,n,!0),Vg(this.k.N,t,n,e)},U.prototype.authWithOAuthPopup=U.prototype.Yf,U.prototype.Zf=function(t,e,n){x("Firebase.authWithOAuthRedirect",2,3,arguments.length),eg("Firebase.authWithOAuthRedirect",t),A("Firebase.authWithOAuthRedirect",2,e,!1),fg("Firebase.authWithOAuthRedirect",3,n,!0);var i=this.k.N;Tg(i);var r=[Cg],o=ng(n);"anonymous"===t||"firebase"===t?R(e,Eg("TRANSPORT_UNAVAILABLE")):(P.set("redirect_client_options",o.od),Ug(i,r,"/auth/"+t,o,e))},U.prototype.authWithOAuthRedirect=U.prototype.Zf,U.prototype.$f=function(t,e,n,i){x("Firebase.authWithOAuthToken",3,4,arguments.length),eg("Firebase.authWithOAuthToken",t),A("Firebase.authWithOAuthToken",3,n,!1),fg("Firebase.authWithOAuthToken",4,i,!0),p(e)?(dg("Firebase.authWithOAuthToken",2,e),Sg(this.k.N,t+"/token",{access_token:e},i,n)):(fg("Firebase.authWithOAuthToken",2,e,!1),Sg(this.k.N,t+"/token",e,i,n))},U.prototype.authWithOAuthToken=U.prototype.$f,U.prototype.Wf=function(t,e){x("Firebase.authAnonymously",1,2,arguments.length),A("Firebase.authAnonymously",1,t,!1),fg("Firebase.authAnonymously",2,e,!0),Sg(this.k.N,"anonymous",{},e,t)},U.prototype.authAnonymously=U.prototype.Wf,U.prototype.ag=function(t,e,n){x("Firebase.authWithPassword",2,3,arguments.length),fg("Firebase.authWithPassword",1,t,!1),gg("Firebase.authWithPassword",t,"email"),gg("Firebase.authWithPassword",t,"password"),A("Firebase.authWithPassword",2,e,!1),fg("Firebase.authWithPassword",3,n,!0),Sg(this.k.N,"password",t,n,e)},U.prototype.authWithPassword=U.prototype.ag,U.prototype.te=function(t,e){x("Firebase.createUser",2,2,arguments.length),fg("Firebase.createUser",1,t,!1),gg("Firebase.createUser",t,"email"),gg("Firebase.createUser",t,"password"),A("Firebase.createUser",2,e,!1),this.k.N.te(t,e)},U.prototype.createUser=U.prototype.te,U.prototype.Ue=function(t,e){x("Firebase.removeUser",2,2,arguments.length),fg("Firebase.removeUser",1,t,!1),gg("Firebase.removeUser",t,"email"),gg("Firebase.removeUser",t,"password"),A("Firebase.removeUser",2,e,!1),this.k.N.Ue(t,e)},U.prototype.removeUser=U.prototype.Ue,U.prototype.qe=function(t,e){x("Firebase.changePassword",2,2,arguments.length),fg("Firebase.changePassword",1,t,!1),gg("Firebase.changePassword",t,"email"),gg("Firebase.changePassword",t,"oldPassword"),gg("Firebase.changePassword",t,"newPassword"),A("Firebase.changePassword",2,e,!1),this.k.N.qe(t,e)},U.prototype.changePassword=U.prototype.qe,U.prototype.pe=function(t,e){x("Firebase.changeEmail",2,2,arguments.length),fg("Firebase.changeEmail",1,t,!1),gg("Firebase.changeEmail",t,"oldEmail"),gg("Firebase.changeEmail",t,"newEmail"),gg("Firebase.changeEmail",t,"password"),A("Firebase.changeEmail",2,e,!1),this.k.N.pe(t,e)},U.prototype.changeEmail=U.prototype.pe,U.prototype.We=function(t,e){x("Firebase.resetPassword",2,2,arguments.length),fg("Firebase.resetPassword",1,t,!1),gg("Firebase.resetPassword",t,"email"),A("Firebase.resetPassword",2,e,!1),this.k.N.We(t,e)},U.prototype.resetPassword=U.prototype.We}(),!function(t,e,n){"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?module.exports=n():e[t]=n()}("Please",this,function(){"use strict";function t(){function t(t,e,n){var i=Math.random;return n instanceof a&&(i=n.random),Math.floor(i()*(e-t+1))+t}function e(t,e,n){var i=Math.random;return n instanceof a&&(i=n.random),i()*(e-t)+t}function n(t,e,n){return Math.max(e,Math.min(t,n))}function i(t,e){var n;switch(t){case"hex":for(n=0;n=128?"dark":"light"}function o(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function a(t){function e(){i=(i+1)%256,r=(r+n[i])%256;var t=n[i];return n[i]=n[r],n[r]=t,n[(n[i]+n[r])%256]}for(var n=[],i=0,r=0,o=0;256>o;o++)n[o]=o;for(var a=0,s=0;256>a;a++){s=(s+n[a]+t.charCodeAt(a%t.length))%256;var c=n[a];n[a]=n[s],n[s]=c}this.random=function(){for(var t=0,n=0,i=1;8>t;t++)n+=e()*i,i*=256;return n/0x10000000000000000}}var s={},c={aliceblue:"F0F8FF",antiquewhite:"FAEBD7",aqua:"00FFFF",aquamarine:"7FFFD4",azure:"F0FFFF",beige:"F5F5DC",bisque:"FFE4C4",black:"000000",blanchedalmond:"FFEBCD",blue:"0000FF",blueviolet:"8A2BE2",brown:"A52A2A",burlywood:"DEB887",cadetblue:"5F9EA0",chartreuse:"7FFF00",chocolate:"D2691E",coral:"FF7F50",cornflowerblue:"6495ED",cornsilk:"FFF8DC",crimson:"DC143C",cyan:"00FFFF",darkblue:"00008B",darkcyan:"008B8B",darkgoldenrod:"B8860B",darkgray:"A9A9A9",darkgrey:"A9A9A9",darkgreen:"006400",darkkhaki:"BDB76B",darkmagenta:"8B008B",darkolivegreen:"556B2F",darkorange:"FF8C00",darkorchid:"9932CC",darkred:"8B0000",darksalmon:"E9967A",darkseagreen:"8FBC8F",darkslateblue:"483D8B",darkslategray:"2F4F4F",darkslategrey:"2F4F4F",darkturquoise:"00CED1",darkviolet:"9400D3",deeppink:"FF1493",deepskyblue:"00BFFF",dimgray:"696969",dimgrey:"696969",dodgerblue:"1E90FF",firebrick:"B22222",floralwhite:"FFFAF0",forestgreen:"228B22",fuchsia:"FF00FF",gainsboro:"DCDCDC",ghostwhite:"F8F8FF",gold:"FFD700",goldenrod:"DAA520",gray:"808080",grey:"808080",green:"008000",greenyellow:"ADFF2F",honeydew:"F0FFF0",hotpink:"FF69B4",indianred:"CD5C5C",indigo:"4B0082",ivory:"FFFFF0",khaki:"F0E68C",lavender:"E6E6FA",lavenderblush:"FFF0F5",lawngreen:"7CFC00",lemonchiffon:"FFFACD",lightblue:"ADD8E6",lightcoral:"F08080",lightcyan:"E0FFFF",lightgoldenrodyellow:"FAFAD2",lightgray:"D3D3D3",lightgrey:"D3D3D3",lightgreen:"90EE90",lightpink:"FFB6C1",lightsalmon:"FFA07A",lightseagreen:"20B2AA",lightskyblue:"87CEFA",lightslategray:"778899",lightslategrey:"778899",lightsteelblue:"B0C4DE",lightyellow:"FFFFE0",lime:"00FF00",limegreen:"32CD32",linen:"FAF0E6",magenta:"FF00FF",maroon:"800000",mediumaquamarine:"66CDAA",mediumblue:"0000CD",mediumorchid:"BA55D3",mediumpurple:"9370D8",mediumseagreen:"3CB371",mediumslateblue:"7B68EE",mediumspringgreen:"00FA9A",mediumturquoise:"48D1CC",mediumvioletred:"C71585",midnightblue:"191970",mintcream:"F5FFFA",mistyrose:"FFE4E1",moccasin:"FFE4B5",navajowhite:"FFDEAD",navy:"000080",oldlace:"FDF5E6",olive:"808000",olivedrab:"6B8E23",orange:"FFA500",orangered:"FF4500",orchid:"DA70D6",palegoldenrod:"EEE8AA",palegreen:"98FB98",paleturquoise:"AFEEEE",palevioletred:"D87093",papayawhip:"FFEFD5",peachpuff:"FFDAB9",peru:"CD853F",pink:"FFC0CB",plum:"DDA0DD",powderblue:"B0E0E6",purple:"800080",rebeccapurple:"663399",red:"FF0000",rosybrown:"BC8F8F",royalblue:"4169E1",saddlebrown:"8B4513",salmon:"FA8072",sandybrown:"F4A460",seagreen:"2E8B57",seashell:"FFF5EE",sienna:"A0522D",silver:"C0C0C0",skyblue:"87CEEB",slateblue:"6A5ACD",slategray:"708090",slategrey:"708090",snow:"FFFAFA",springgreen:"00FF7F",steelblue:"4682B4",tan:"D2B48C",teal:"008080",thistle:"D8BFD8",tomato:"FF6347",turquoise:"40E0D0",violet:"EE82EE",wheat:"F5DEB3",white:"FFFFFF",whitesmoke:"F5F5F5",yellow:"FFFF00",yellowgreen:"9ACD32"},u=.618033988749895,h={hue:null,saturation:null,value:null,base_color:"",greyscale:!1,grayscale:!1,golden:!0,full_random:!1,colors_returned:1,format:"hex",seed:null},l={scheme_type:"analogous",format:"hex"},f={golden:!1,format:"hex"};return s.NAME_to_HEX=function(t){return t=t.toLowerCase(),t in c?c[t]:void console.error("Color name not recognized.")},s.NAME_to_RGB=function(t){return s.HEX_to_RGB(s.NAME_to_HEX(t))},s.NAME_to_HSV=function(t){return s.HEX_to_HSV(s.NAME_to_HEX(t))},s.HEX_to_RGB=function(t){var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;t=t.replace(e,function(t,e,n,i){return e+e+n+n+i+i});var n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return n?{r:parseInt(n[1],16),g:parseInt(n[2],16),b:parseInt(n[3],16)}:null},s.RGB_to_HEX=function(t){return"#"+((1<<24)+(t.r<<16)+(t.g<<8)+t.b).toString(16).slice(1)},s.HSV_to_RGB=function(t){var e,n,i,r,o,a,s,c,u=t.h,h=t.s,l=t.v;if(0===h)return{r:l,g:l,b:l};switch(u/=60,r=Math.floor(u),o=u-r,a=l*(1-h),s=l*(1-h*o),c=l*(1-h*(1-o)),r){case 0:e=l,n=c,i=a;break;case 1:e=s,n=l,i=a;break;case 2:e=a,n=l,i=c;break;case 3:e=a,n=s,i=l;break;case 4:e=c,n=a,i=l;break;case 5:e=l,n=a,i=s}return{r:Math.floor(255*e),g:Math.floor(255*n),b:Math.floor(255*i)}},s.RGB_to_HSV=function(t){var e=t.r/255,n=t.g/255,i=t.b/255,r=0,o=0,a=0,s=Math.min(e,Math.min(n,i)),c=Math.max(e,Math.max(n,i));if(s===c)return a=s,{h:0,s:0,v:a};var u=e===s?n-i:i===s?e-n:i-e,h=e===s?3:i===s?1:5;return r=60*(h-u/(c-s)),o=(c-s)/c,a=c,{h:r,s:o,v:a}},s.HSV_to_HEX=function(t){return s.RGB_to_HEX(s.HSV_to_RGB(t))},s.HEX_to_HSV=function(t){return s.RGB_to_HSV(s.HEX_to_RGB(t))},s.make_scheme=function(t,e){function r(t){return{h:t.h,s:t.s,v:t.v}}var a,s,c,u,h,f=o(l);if(null!==e)for(var p in e)e.hasOwnProperty(p)&&(f[p]=e[p]);var d=[t];switch(f.scheme_type.toLowerCase()){case"monochromatic":case"mono":for(h=1;2>=h;h++)a=r(t),c=a.s+.1*h,c=n(c,0,1),u=a.v+.1*h,u=n(u,0,1),a.s=c,a.v=u,d.push(a);for(h=1;2>=h;h++)a=r(t),c=a.s-.1*h,c=n(c,0,1),u=a.v-.1*h,u=n(u,0,1),a.s=c,a.v=u,d.push(a);break;case"complementary":case"complement":case"comp":a=r(t),a.h=(a.h+180)%360,d.push(a);break;case"split-complementary":case"split-complement":case"split":a=r(t),a.h=(a.h+165)%360,d.push(a),a=r(t),a.h=Math.abs((a.h-165)%360),d.push(a);break;case"double-complementary":case"double-complement":case"double":a=r(t),a.h=(a.h+180)%360,d.push(a),a.h=(a.h+30)%360,s=r(a),d.push(a),a.h=(a.h+180)%360,d.push(s);break;case"analogous":case"ana":for(h=1;5>=h;h++)a=r(t),a.h=(a.h+20*h)%360,d.push(a);break;case"triadic":case"triad":case"tri":for(h=1;3>h;h++)a=r(t),a.h=(a.h+120*h)%360,d.push(a);break;default:console.error("Color scheme not recognized.")}return i(f.format.toLowerCase(),d),d},s.make_color=function(r){var c=[],l=o(h),f=null;if(null!==r)for(var p in r)r.hasOwnProperty(p)&&(l[p]=r[p]);var d=null;"string"==typeof l.seed&&(d=new a(l.seed)),l.base_color.length>0&&(f=l.base_color.match(/^#?([0-9a-f]{3})([0-9a-f]{3})?$/i)?s.HEX_to_HSV(l.base_color):s.NAME_to_HSV(l.base_color));for(var g=0;gc;c++)n[f[c]]=u[f[c]];for(;".."==l[0];)h.pop(),l.shift();n.path=("/"!=i.substring(0,1)?h.join("/"):"")+"/"+l.join("/")}r(n)},i=function(t){return t=t.replace(/\+/g," "),t=t.replace(/%([ef][0-9a-f])%([89ab][0-9a-f])%([89ab][0-9a-f])/gi,function(t,e,n,i){var r=parseInt(e,16)-224,o=parseInt(n,16)-128;if(0==r&&32>o)return t;var a=parseInt(i,16)-128,s=(r<<12)+(o<<6)+a;return s>65535?t:String.fromCharCode(s)}),t=t.replace(/%([cd][0-9a-f])%([89ab][0-9a-f])/gi,function(t,e,n){var i=parseInt(e,16)-192;if(2>i)return t;var r=parseInt(n,16)-128;return String.fromCharCode((i<<6)+r)}),t=t.replace(/%([0-7][0-9a-f])/gi,function(t,e){return String.fromCharCode(parseInt(e,16))})},r=function(t){var e=t.query;t.query=new function(t){for(var e,n=/([^=&]+)(=([^&]*))?/g;e=n.exec(t);){var r=decodeURIComponent(e[1].replace(/\+/g," ")),o=e[3]?i(e[3]):"";null!=this[r]?(this[r]instanceof Array||(this[r]=[this[r]]),this[r].push(o)):this[r]=o}this.clear=function(){for(r in this)this[r]instanceof Function||delete this[r]},this.toString=function(){var t="",e=encodeURIComponent;for(var n in this)if(!(this[n]instanceof Function))if(this[n]instanceof Array){var i=this[n].length;if(i)for(var r=0;i>r;r++)t+=t?"&":"",t+=e(n)+"="+e(this[n][r]);else t+=(t?"&":"")+e(n)+"="}else t+=t?"&":"",t+=e(n)+"="+e(this[n]);return t}}(e)};return function(t){this.toString=function(){return(this.protocol&&this.protocol+"://")+(this.user&&this.user+(this.pass&&":"+this.pass)+"@")+(this.host&&this.host)+(this.port&&":"+this.port)+(this.path&&this.path)+(this.query.toString()&&"?"+this.query)+(this.hash&&"#"+this.hash)},n(this,t)}}();!function(t,e,n){"use strict";function i(t){var e={};return e=t.__proto__?Object.assign(i(t.__proto__),t):Object.assign({schema:{},dependencies:[]},t),t.schema&&Object.assign(e.schema,t.schema),t.dependencies&&(n=e.dependencies).push.apply(n,t.dependencies),e;var n}function r(t,e){AFRAME.registerComponent(t,i(new e))}function o(t,e){AFRAME.registerSystem(t,i(new e))}function a(t,e,n){return 0===e.length?n:(t[e[0]]=a(t[e[0]]||{},e.slice(1),n),t)}function s(t,e,n){var i,r,o,a,s=0;n||(n={});var c=function(){s=n.leading===!1?0:Date.now(),i=null,a=t.apply(r,o),i||(r=o=null)},u=function(){var u=Date.now();s||n.leading!==!1||(s=u);var h=e-(u-s);return r=this,o=arguments,0>=h||h>e?(i&&(clearTimeout(i),i=null),s=u,a=t.apply(r,o),i||(r=o=null)):i||n.trailing===!1||(i=setTimeout(c,h)),a};return u.cancel=function(){clearTimeout(i),s=0,i=r=o=null},u}function c(t){return t?encodeURIComponent(t).replace(/\./g,"%2E").replace(/%[A-Z0-9]{2}/g,"-"):null}function u(){var t=document.querySelector("link[rel=canonical]");return t?t.href:window.location.href}function h(t,e,n){return c(e||n)+":"+c(t||"")}function l(n){n=n||{};var i=new t,r=n.baseRefUrl||"https://altspace-apps.firebaseio.com/apps/examples/",o=new e(r),a=n.instanceId||i.query["altspace-sync-instance"],s=n.spaceId||i.query["altspace-sync-space"],u=n.userId||i.query["altspace-sync-user"];if(!n.appId||!n.authorId)throw new Error("Both the appId and authorId must be provided to connect.");var l=[];_t&&(s||l.unshift(altspace.getSpace()),u||l.unshift(altspace.getUser()));var f={},p=h(n.appId,n.authorId,jt);f.app=o.child(p).child("app");var d=f.app.child("instances");return a?(f.instance=d.child(a),Promise.all(l).then(function(t){_t&&(s||(s=t.pop().sid),u||(u=t.pop().userId)),s=c(s),u=c(u),a=c(a),f.space=s?f.app.child("spaces").child(s):null,f.user=u?f.app.child("users").child(u):null;var e=f;return e})):(f.instance=d.push(),a=f.instance.key(),i.query["altspace-sync-instance"]=a,window.location.href=i.toString(),Promise.reject(new Error("Sync instance id not found. Reloading app with new sync id.")))}function f(t,e,n){if(!(t&&t instanceof THREE.Scene))throw new TypeError("Requires THREE.Scene argument");if(!(e&&e instanceof THREE.Camera))throw new TypeError("Requires THREE.Camera argument");yt=t,vt=e;var i=n||{};mt=i.renderer&&i.renderer.domElement||window,mt.addEventListener("mousedown",p,!1),mt.addEventListener("mouseup",d,!1),mt.addEventListener("mousemove",g,!1)}function p(t){var e=y(t);if(e&&e.point){var n=b("cursordown",e);e.object.dispatchEvent(n)}}function d(t){var e=y(t),n=b("cursorup",e);e?e.object.dispatchEvent(n):yt.dispatchEvent(n)}function g(t){var e=y(t),n=b("cursormove",e);yt.dispatchEvent(n);var i=e?e.object:null;wt!=i&&(wt&&(n=b("cursorleave",e),wt.dispatchEvent(n)),i&&(n=b("cursorenter",e),i.dispatchEvent(n)),wt=i)}function b(t,e){return{type:t,bubbles:!0,target:e?e.object:null,ray:{origin:Ft.ray.origin.clone(),direction:Ft.ray.direction.clone()},point:e?e.point.clone():null}}function y(t){var e=new THREE.Vector2;e.x=t.offsetX/(mt.width||mt.innerWidth)*2-1,e.y=2*-(t.offsetY/(mt.height||mt.innerHeight))+1,Ft.setFromCamera(e,vt);var n=Ft.intersectObjects(yt.children,!0);return n.find(function(t){return!t.object.userData||!t.object.userData.altspace||!t.object.userData.altspace.collider||t.object.userData.altspace.collider.enabled!==!1})||null}function v(t){var e=t||{};Tt=e.TRACE||!1,e.crossOrigin&&(xt=e.crossOrigin),e.baseUrl&&(Rt=e.baseUrl),"/"!==Rt.slice(-1)&&(Rt+="/"),kt=new altspace.utilities.shims.OBJMTLLoader,kt.crossOrigin=xt,Tt&&console.log("MultiLoader initialized with params",t)}function m(t,e){var n=t,i=Date.now();if(!(n&&n instanceof Lt))throw new Error("MultiLoader.load expects first arg of type LoadRequest");if(!e||"function"!=typeof e)throw new Error("MultiLoader.load expects second arg of type function");if(!n.objUrls||!n.mtlUrls||n.objUrls.length!==n.mtlUrls.length)throw new Error("MultiLoader.load called with bad LoadRequest");var r=n.objUrls.length;Tt&&console.log("Loading models...");for(var o=0;r>o;o++){var a=function(t,n){var o=Rt+t.objUrls[n],a=Rt+t.mtlUrls[n];Tt&&console.log("Loading obj:"+o+", mtl:"+a),kt.load(o,a,function(o){if(t.objects[n]=o,t.objectsLoaded++,t.objectsLoaded===r){var a=((Date.now()-i)/1e3).toFixed(2);Tt&&console.log("Loaded "+r+" models in "+a+" seconds"),e()}},w,function(){var e=xhr.target.responseURL||"";t.error="Error loading file "+e})};a(n,o)}}function w(t){if(t.lengthComputable&&t.target.responseURL){var e=t.loaded/t.total*100,n=t.target.responseURL.split("/").pop();Tt&&console.log("..."+n+" "+Math.round(e,2)+"% downloaded")}}function E(){console.log("In a tile: "+Dt),console.log("In VR: "+Pt)}function _(){if(!Dt&&Pt);else{var t=document.createElement("style");t.type="text/css",t.innerHTML="@import url(https://fonts.googleapis.com/css?family=Open+Sans:800);.altspace-info{text-align:center;font-family:'Open Sans',sans-serif;line-height:.5}.altspace-vr-notice{color:rgba(0,0,0,.7);font-size:5vw}.altspace-pen-name{font-size:7vw}",document.head.appendChild(t),document.body.style.background=n.make_color({seed:F()});var e=document.createElement("div");e.className="altspace-info",document.body.appendChild(e);var i=document.createElement("span");if(i.className="altspace-pen-name",i.innerHTML="

"+Mt.toUpperCase()+"

",e.appendChild(i),Dt){var r="VR mode does not support preview tiles. Stopping code execution.";throw console.log("ERROR: "+r),new Error(r)}if(!Pt){var o=document.createElement("span");o.className="altspace-vr-notice",o.innerHTML="

View

",e.insertBefore(o,i);var a=document.createElement("span");a.className="altspace-vr-notice",a.innerHTML='

in AltspaceVR

',e.appendChild(a);var r="Not in VR mode. Stopping code execution.";throw Dt&&console.log("ERROR: "+r),new Error(r)}}}function j(t){Mt=t}function S(){var e=document.querySelector("link[rel=canonical]"),n=e?e.href:window.location.href;return new t(n)}function F(){var t=S(),e=t.path.split("/"),n=e[e.length-1];return n}function O(){var t=S(),e=t.path.split("/"),n="team"==e[1],i=n?"team-"+e[2]:e[1];return i}function A(t){var e,n,i=this;if(t.bubbles&&(t.currentTarget=this,t.stopPropagation=function(){e=!0},t.stopImmediatePropagation=function(){n=!0}),this._listeners){var r=this._listeners,o=r[t.type];if(o){t.target=t.target||this;for(var a=[],s=o.length,c=0;s>c;c++)a[c]=o[c];for(var c=0;s>c;c++)if(a[c].call(i,t),n)return}}t.bubbles&&this.parent&&this.parent.dispatchEvent&&!e&&A.call(this.parent,t)}function C(t){t.updateMatrixWorld();var e=new THREE.Vector3;return e.setFromMatrixPosition(t.matrixWorld),e}function k(t){return new Promise(function(e,n){var i=null;return t.traverse(function(t){return"TrackingSkeleton"===t.type?void(i=t):void 0}),i?e(i):void altspace.getThreeJSTrackingSkeleton().then(function(n){return i=n,t.add(i),e(i)})})}function T(t,e){if(t===e)return!0;if(Array.isArray(t)&&Array.isArray(e)&&t.length===e.length)return t.every(function(n,i){return T(t[i],e[i])});if(t instanceof Object&&e instanceof Object&&T(Object.keys(t).sort(),Object.keys(e).sort())){for(var n in t)if(!T(t[n],e[n]))return!1;return!0}return!1}function R(){pe.forEach(function(t){return t.autoSend()})}function x(t,e){var n=function(i,r){var o=altspace.getGamepads().find(function(e){return"steamvr"===e.mapping&&e.hand===t});o?(e.logging&&console.log("SteamVR input device found",o),i(o)):(e.logging&&console.log("SteamVR input device not found trying again in 500ms..."),setTimeout(n,500,i,r))};return new Promise(n)}t=t&&t.hasOwnProperty("default")?t["default"]:t,e=e&&e.hasOwnProperty("default")?e["default"]:e,n=n&&n.hasOwnProperty("default")?n["default"]:n;var L=function(){},I={schema:{}};I.schema.get=function(){return null},L.prototype.init=function(){},L.prototype.tick=function(t,e){},L.prototype.pause=function(){},L.prototype.play=function(){},Object.defineProperties(L.prototype,I);var M=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.update=function(t){},e.prototype.remove=function(){},e.prototype.updateSchema=function(t){},e}(L),D=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{enabled:{type:"boolean","default":!0}}},e.prototype.init=function(){var t=this;this.setColliderFlag(this.data.enabled),this.el.addEventListener("model-loaded",function(){t.setColliderFlag(t.data.enabled)}.bind(this))},e.prototype.update=function(){this.setColliderFlag(this.data.enabled)},e.prototype.setColliderFlag=function(t){var e=this.el.object3D;e&&(a(e.userData,["altspace","collider","enabled"],t),e.traverse(function(e){e instanceof THREE.Mesh&&a(e.userData,["altspace","collider","enabled"],t)}))},Object.defineProperties(e.prototype,n),e}(M),P=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(){this.gamepadIndex=null,this.trackedControlsSystem=document.querySelector("a-scene").systems["tracked-controls"],this.systemGamepads=0,altspace.getGamepads()},e.prototype.tick=function(){if(this.trackedControlsSystem&&this.systemGamepads!==this.trackedControlsSystem.controllers.length&&window.altspace&&altspace.getGamepads&&altspace.getGamepads().length){var t=this.el.components;t["paint-controls"]&&(this.gamepadIndex="left"===t["paint-controls"].data.hand?2:1),null===this.gamepadIndex&&t["hand-controls"]&&(this.gamepadIndex="left"===t["hand-controls"].data?2:1),null===this.gamepadIndex&&t["vive-controls"]&&(this.gamepadIndex="left"===t["vive-controls"].data.hand?2:1),null===this.gamepadIndex&&t["tracked-controls"]&&(this.gamepadIndex=t["tracked-controls"].data.controller),this.el.setAttribute("tracked-controls","id",altspace.getGamepads()[this.gamepadIndex].id),this.el.setAttribute("tracked-controls","controller",0),this.systemGamepads=this.trackedControlsSystem.controllers.length}},e}(M),U=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{usePixelScale:{type:"boolean","default":!1},verticalAlign:{type:"string","default":"middle"},enclosuresOnly:{type:"boolean","default":!0},fullspace:{type:"boolean","default":!1}}},e.prototype.init=function(){return this.version="AFRAME_ALTSPACE_VERSION",this.el.object3D instanceof THREE.Scene?void(window.altspace&&window.altspace.inClient?(this.el.setAttribute("vr-mode-ui",{enabled:!1}),this.initRenderer(),this.initCursorEvents(),this.initCollisionEvents()):console.warn("aframe-altspace-component only works inside of AltspaceVR")):void console.warn("aframe-altspace-component can only be attached to a-scene")},e.prototype.tick=function(t,e){this.el.object3D.updateAllBehaviors&&this.el.object3D.updateAllBehaviors()},e.prototype.initRenderer=function(){var t=this,e=this.el.object3D,n=this.el.sceneEl,i=n.getAttribute("scale")||{x:1,y:1,z:1};altspace.getEnclosure().then(function(n){switch(t.data.fullspace&&(n.fullspace&&a(e.userData,["altspace","initialized"],!0),n.requestFullspace(),n.addEventListener("fullspacechange",function(){e.scale.copy(i).multiplyScalar(n.pixelsPerMeter),a(e.userData,["altspace","initialized"],!0)})),(!t.data.usePixelScale||t.data.fullspace)&&e.scale.copy(i).multiplyScalar(n.pixelsPerMeter),t.data.verticalAlign){case"bottom":e.position.y-=n.innerHeight/2;break;case"top":e.position.y+=n.innerHeight/2;break;case"middle":break;default:console.warn("Unexpected value for verticalAlign: ",t.data.verticalAlign)}t.data.enclosuresOnly&&1===n.innerDepth&&(t.el.renderer.render(new THREE.Scene),t.el.renderer=t.el.effect=r),t.data.fullspace||a(e.userData,["altspace","initialized"],!0)}.bind(this));var r=this.el.renderer,o=this.el.renderer=this.el.effect=altspace.getThreeJSRenderer({aframeComponentVersion:this.version}),s=function(){};o.setSize=s,o.setPixelRatio=s,o.setClearColor=s,o.clear=s,o.enableScissorTest=s,o.setScissor=s,o.setViewport=s,o.getPixelRatio=s,o.getMaxAnisotropy=s,o.setFaceCulling=s,o.submitFrame=s,o.context={canvas:{}},o.shadowMap={},o.requestAnimationFrame=window.requestAnimationFrame.bind(window)},e.prototype.initCursorEvents=function(){function t(t,e){var i=e.target.el;n&&n.emit(t,{target:i,ray:e.ray,point:e.point}),i&&i.emit(t,{target:i,ray:e.ray,point:e.point})}var e=this.el.object3D,n=document.querySelector("a-cursor")||document.querySelector("a-entity[cursor]");n&&(n.setAttribute("material","transparent",!0),n.setAttribute("material","opacity",0));var i=null;e.addEventListener("cursordown",function(e){i=e.target,t("mousedown",e)}),e.addEventListener("cursorup",function(e){t("mouseup",e),e.target.uuid===i.uuid&&t("click",e),i=null}),e.addEventListener("cursorenter",function(e){e.target.el&&(e.target.el.addState("hovered"),n&&n.addState("hovering"),t("mouseenter",e))}),e.addEventListener("cursorleave",function(e){e.target.el&&(e.target.el.removeState("hovered"),n&&n.removeState("hovering"),t("mouseleave",e))})},e.prototype.initCollisionEvents=function(){function t(t,e){var n=e.target.el;n&&(e.target=n,e.other&&e.other.el&&(e.other=e.other.el),n.emit(t,e))}var e=this.el.object3D;e.addEventListener("collisionenter",function(e){t("collisionenter",e)}),e.addEventListener("collisionexit",function(e){t("collisionexit",e)}),e.addEventListener("triggerenter",function(e){t("triggerenter",e)}),e.addEventListener("triggerexit",function(e){t("triggerexit",e)})},Object.defineProperties(e.prototype,n),e}(M),N=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={dependencies:{}};return n.dependencies.get=function(){return["sync"]},e.prototype.init=function(){this.sync=this.el.components.sync,this.lastValue=null,this.sync.isConnected?start():this.el.addEventListener("connected",this.start.bind(this))},e.prototype.start=function(){var t=this,e=this.sync.dataRef.child("material/color"),n=!1,i=!0,r=this;this.el.addEventListener("componentchanged",function(i){var o=i.detail.name;if("material"===o){var a=r.el.getAttribute("material").color;!n&&t.lastValue!==a&&r.sync.isMine&&(r.lastValue=a,setTimeout(function(){return e.set(a)},0))}}),e.on("value",function(t){if(!r.sync.isMine||i){var e=t.val();n=!0,r.el.setAttribute("material","color",e),n=!1,i=!1}})},Object.defineProperties(e.prototype,n),e}(M),B=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{mode:{"default":"link"},ownOn:{type:"string"}}},e.prototype.init=function(){var t=this;if(this.isMine=!1,this.scene=this.el.sceneEl,this.syncSys=this.scene.systems["sync-system"],this.isConnected=!1,this.syncSys.isConnected?this.start():this.scene.addEventListener("connected",this.start.bind(this)),this.data.ownOn){var e=this.data.ownOn.split(/[ ,]+/);e.forEach(function(e){t.el.addEventListener(e,function(){t.isConnected&&t.takeOwnership()}.bind(t))}.bind(this))}},e.prototype.takeOwnership=function(){this.ownerRef.set(this.syncSys.clientId),this.ownerRef.onDisconnect().set(null)},e.prototype.start=function(){var t=this;if(this.scene.addEventListener("clientleft",function(e){var n=(!t.ownerId||t.ownerId===e.detail.id)&&t.syncSys.isMasterClient;n&&t.takeOwnership()}.bind(this)),"link"!==this.data.mode)return void console.error("Unsupported sync mode: "+this.data.mode);var e=this.el.id;return e?(this.link(this.syncSys.sceneRef.child(e)),this.setupReceive(),this.isConnected=!0,void this.el.emit("connected",null,!1)):void console.error("Entities cannot be synced using link mode without an id.")},e.prototype.link=function(t){this.ref=t,this.key=this.ref.key(),this.dataRef=this.ref.child("data"),this.ownerRef=this.ref.child("owner")},e.prototype.setupReceive=function(){function t(t){var e=t.val(),n=e===this.syncSys.clientId&&!this.isMine;n&&this.el.emit("ownershipgained",null,!1);var i=e!==this.syncSys.clientId;i&&(this.el.emit("ownershiplost",null,!1),this.ownerRef.onDisconnect().cancel()),this.ownerId=e,this.isMine=e===this.syncSys.clientId}var e=this;this.ownerRef.transaction(function(t){return t?void 0:e.syncSys.clientId}.bind(this),function(n,i){i&&e.ownerRef.onDisconnect().set(null),e.ownerRef.on("value",t.bind(e))}.bind(this))},Object.defineProperties(e.prototype,n),e}(M),H=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{author:{type:"string"},app:{type:"string"},instance:{type:"string"},refUrl:{type:"string"}}},e.prototype.init=function(){return this.data&&this.data.app?(console.log(this.data),this.clientId=this.sceneEl.object3D.uuid,this.masterClientId=null,this.queuedInstantiations=[],this.isConnected=!1,void Promise.all([altspace.utilities.sync.connect({authorId:this.data.author,appId:this.data.app,instanceId:this.data.instance, +baseRefUrl:this.data.refUrl}),altspace.getUser()]).then(this.connected.bind(this))):void console.warn("The sync-system must be present on the scene and configured with required data.")},e.prototype.connected=function(t){this.connection=t.shift(),this.userInfo=t.shift(),this.sceneRef=this.connection.instance.child("scene"),this.clientsRef=this.connection.instance.child("clients"),this.instantiatedElementsRef=this.connection.instance.child("instantiatedElements"),this.instantiatedElementsRef.on("child_added",this.listenToInstantiationGroup.bind(this)),this.instantiatedElementsRef.on("child_removed",this.stopListeningToInstantiationGroup.bind(this));var e=this;this.clientsRef.on("value",function(t){var n=t.val(),i=Object.keys(n)[0];e.masterClientId=n[i]}),this.clientsRef.on("child_added",function(t){var n=t.val();setTimeout(function(){e.sceneEl.emit("clientjoined",{id:n},!1)},0)}),this.clientsRef.on("child_removed",function(t){var n=t.val();setTimeout(function(){e.sceneEl.emit("clientleft",{id:n},!1)},0)}),this.clientsRef.push(this.clientId).onDisconnect().remove(),this.connection.instance.child("initialized").once("value",function(t){var n=!t.val();t.ref().set(!0),e.processQueuedInstantiations(),e.sceneEl.emit("connected",{shouldInitialize:n},!1),e.isConnected=!0})},e.prototype.isMasterClient=function(){return this.masterClientId===this.clientId},e.prototype.listenToInstantiationGroup=function(t){t.ref().on("child_added",this.createElement.bind(this)),t.ref().on("child_removed",this.removeElement.bind(this))},e.prototype.stopListeningToInstantiationGroup=function(t){t.ref().off("child_added"),t.ref().off("child_removed")},e.prototype.processQueuedInstantiations=function(){var t=this;this.queuedInstantiations.forEach(function(e){e.creatorUserId=t.userInfo.userId,e.clientId=t.clientId,t.instantiatedElementsRef.child(e.groupName).push(e).onDisconnect().remove()}.bind(this)),this.queuedInstantiations.length=0},e.prototype.instantiate=function(t,e,n,i,r){if(!t)return void console.error("AltspaceVR: Instantiation requires a mixin value.",n);var o=e&&e.id,a="A-SCENE"===e.nodeName;if(!o&&!a)return void console.error("AltspaceVR: Instantiation requires a parent with an id.",n);var s=o?"#"+e.id:"a-scene",c={instantiatorId:r||"",groupName:i||"main",mixin:t,parent:s};this.queuedInstantiations.push(c),this.isConnected&&this.processQueuedInstantiations()},e.prototype.removeLast=function(t){var e=this;return new Promise(function(n){e.instantiatedElementsRef.child(t).orderByKey().limitToLast(1).once("value",function(t){if(!t.hasChildren())return void n();var e=t.val(),i=Object.keys(e)[0];n(e[i].instantiatorId),t.ref().child(i).remove()})}.bind(this))},e.prototype.createElement=function(t){var e=t.val(),n=t.key(),i=document.createElement("a-entity");i.id=e.groupName+"-instance-"+n,document.querySelector(e.parent).appendChild(i),i.setAttribute("mixin",e.mixin),i.dataset.creatorUserId=e.creatorUserId,this.userInfo.userId===e.creatorUserId&&i.classList.add("mine")},e.prototype.removeElement=function(t){var e=t.val(),n=t.key(),i=e.groupName+"-instance-"+n,r=document.querySelector("#"+i);r.parentNode.removeChild(r)},Object.defineProperties(e.prototype,n),e}(L),q=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={dependencies:{}};return n.dependencies.get=function(){return["sync"]},e.prototype.init=function(){this.sync=this.el.components.sync,this.sync.isConnected?this.start():this.el.addEventListener("connected",this.start.bind(this))},e.prototype.start=function(){function t(t,e){if(!n.isMine){var r=t.val();r&&i.el.setAttribute(e,r)}}function e(t){if(n.isMine){var e=t.detail.name,r=i.el.getAttribute(e);"position"===e?u(r):"rotation"===e?h(r):"scale"===e&&l(r)}}var n=this.sync,i=this,r=n.dataRef.child("position"),o=n.dataRef.child("rotation"),a=n.dataRef.child("scale");i.updateRate=100;var c=[];i.el.addEventListener("ownershiplost",function(){Array.from(i.el.children).forEach(function(t){var e=t.tagName.toLowerCase();"a-animation"===e&&(c.push(t),t.stop())})}),i.el.addEventListener("ownershipgained",function(){c.forEach(function(t){return t.start()}),c=[]}),r.on("value",function(e){return t(e,"position")}),o.on("value",function(e){return t(e,"rotation")}),a.on("value",function(e){return t(e,"scale")});var u=s(function(t){r.set(t)},i.updateRate),h=s(function(t){o.set(t)},i.updateRate),l=s(function(t){a.set(t)},i.updateRate);i.el.addEventListener("componentchanged",e)},Object.defineProperties(e.prototype,n),e}(M),W=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={dependencies:{}};return n.dependencies.get=function(){return["sync"]},e.prototype.init=function(){this.sync=this.el.components.sync,this.scene=this.el.sceneEl,this.syncSys=this.scene.systems["sync-system"],this.soundStateRef=null,this.soundEventRef=null,this.sync.isConnected?this.start():this.el.addEventListener("connected",this.start.bind(this))},e.prototype.remove=function(){this.soundStateRef.off("value"),this.soundEventRef.off("value")},e.prototype.start=function(){function t(t){if(this.sync.isMine){var t={type:t.type,sender:this.syncSys.clientId,el:this.el.id,time:Firebase.ServerValue.TIMESTAMP};this.soundEventRef.set(t)}}var e=this;this.soundStateRef=this.sync.dataRef.child("sound/state"),this.soundEventRef=this.sync.dataRef.child("sound/event"),this.el.addEventListener("sound-played",t.bind(this)),this.el.addEventListener("sound-paused",t.bind(this)),this.soundEventRef.once("value",function(t){var n=t.val();e.soundEventRef.on("value",function(t){var i=t.val();if(!(!i||n&&i.time===n.time||e.sync.isMine)&&i.el===e.el.id){var r=e.el.components["n-sound"];"sound-played"===i.type?r.playSound():r.pauseSound()}})}),this.el.addEventListener("componentchanged",function(t){if(e.sync.isMine){var n=t.detail.name;"n-sound"===n&&e.soundStateRef.set(e.el.getAttribute(n))}}),this.soundStateRef.on("value",function(t){if(!e.sync.isMine){var n=t.val();n&&e.el.setAttribute("n-sound",n)}})},Object.defineProperties(e.prototype,n),e}(M),V=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={dependencies:{}};return n.dependencies.get=function(){return["sync"]},e.prototype.init=function(){var t=this.el.sceneEl;this.syncSys=t.systems["sync-system"],this.sync=this.el.components.sync,this.syncSys.isConnected?this._start():t.addEventListener("connected",this._start.bind(this))},e.prototype.getDataRef=function(t){return this.sync.dataRef.child("n-skeleton-parent/"+t)},e.prototype._start=function(){this.attributeRef=this.sync.dataRef.child("n-skeleton-parent"),this.attributeRef.on("value",function(t){var e=t.val();e&&this.el.setAttribute("n-skeleton-parent",e)}.bind(this)),this.el.dataset.creatorUserId&&this.attributeRef.set(Object.assign({},this.el.components["n-skeleton-parent"].data,{userId:this.el.dataset.creatorUserId})),this.el.addEventListener("componentchanged",function(t){if(this.sync.isMine){var e=t.detail.name;"n-skeleton-parent"===e&&this.attributeRef.set(this.el.getAttribute(e))}}.bind(this))},Object.defineProperties(e.prototype,n),e}(M),G=function(t){function e(){t.call(this),this.multiple=!0}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{on:{type:"string"},emit:{type:"string"},gained:{type:"string"},lost:{type:"string"},gain:{type:"string"},lose:{type:"string"},targets:{type:"selectorAll"},target:{type:"selector"}}},e.prototype.init=function(){this.actOnTargets=function(){function t(t){this.data.emit&&t.emit(this.data.emit),this.data.gain&&t.addState(this.data.gain),this.data.lose&&t.removeState(this.data.lose)}this.updateProperties(this.attrValue),this.data.targets&&this.data.targets.forEach(t.bind(this)),this.data.target&&t.call(this,this.data.target),this.data.targets||this.data.target||t.call(this,this.el)}.bind(this),this.actOnTargetsIfStateMatches=function(t){var e=t.detail.state;(e===this.data.gained||e===this.data.lost)&&this.actOnTargets()}.bind(this)},e.prototype.update=function(t){t.on&&this.el.removeEventListener(t.on,this.actOnTargets),t.gained&&this.el.removeEventListener("stateadded",this.actOnTargetsIfStateMatches),t.lost&&this.el.removeEventListener("stateremoved",this.actOnTargetsIfStateMatches),this.data.on&&this.el.addEventListener(this.data.on,this.actOnTargets),this.data.gained&&this.el.addEventListener("stateadded",this.actOnTargetsIfStateMatches),this.data.lost&&this.el.addEventListener("stateremoved",this.actOnTargetsIfStateMatches)},e.prototype.remove=function(){this.el.removeEventListener(this.data.on,this.actOnTargets),this.el.removeEventListener("stateadded",this.actOnTargetsIfStateMatches),this.el.removeEventListener("stateremoved",this.actOnTargetsIfStateMatches)},Object.defineProperties(e.prototype,n),e}(M),K=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{mixin:{type:"string"},parent:{type:"selector"}}},e.prototype.init=function(){var t=this.el.sceneEl;this.syncSys=t.systems["sync-system"],this.syncSys.instantiate(this.data.mixin,this.data.parent||this.el.parentNode,this.el)},Object.defineProperties(e.prototype,n),e}(M),Q=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{on:{type:"string"},mixin:{type:"string"},parent:{type:"selector","default":"a-scene"},group:{type:"string","default":"main"},removeLast:{type:"boolean","default":!0}}},e.prototype.init=function(){this.onHandler=this.instantiateOrToggle.bind(this),this.el.addEventListener(this.data.on,this.onHandler),this.syncSys=this.el.sceneEl.systems["sync-system"]},e.prototype.instantiateOrToggle=function(){var t=this.data.group+"-"+this.syncSys.userInfo.userId;this.data.removeLast?this.syncSys.removeLast(t).then(function(e){e!==this.el.id&&this.syncSys.instantiate(this.data.mixin,this.data.parent,this.el,t,this.el.id)}.bind(this)):this.syncSys.instantiate(this.el.id,t,this.data.mixin,this.data.parent)},e.prototype.remove=function(){this.el.removeEventListener(this.data.on,this.onHandler)},Object.defineProperties(e.prototype,n),e}(M);if(!window.altspace||!altspace.inClient){var z=function(){};a(window,["altspace","addNativeComponent"],z),a(window,["altspace","updateNativeComponent"],z),a(window,["altspace","removeNativeComponent"],z)}var Y=new THREE.BoxGeometry(.001,.001,.001),X=new THREE.MeshBasicMaterial({color:0});X.visible=!1;var J=function(t){function e(){t.call(this,Y,X)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(THREE.Mesh),$=function(t){function e(e,n){void 0===n&&(n=!0),t.call(this),Object.assign(this,{name:e,sendUpdates:n})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(){var t=this,e=this.mesh||this.el.getOrCreateObject3D("mesh",J);this.currentMesh=e,a(e.userData,["altspace","collider","enabled"],!1),altspace.addNativeComponent(e,this.name),this.update(),this.mesh||this._dontRebind||this.el.addEventListener("object3dset",function(e){"mesh"===e.detail.type&&(altspace.removeNativeComponent(t.currentMesh,t.name),t._dontRebind=!0,t.init())}.bind(this))},e.prototype.update=function(){var t=this.mesh||this.el.object3DMap.mesh;this.sendUpdates&&altspace.updateNativeComponent(t,this.name,this.data)},e.prototype.remove=function(){var t=this.mesh||this.el.object3DMap.mesh;altspace.removeNativeComponent(t,this.name)},e.prototype.callComponent=function(t){for(var e=[],n=arguments.length-1;n-->0;)e[n]=arguments[n+1];var i=this.mesh||this.el.object3DMap.mesh;altspace.callNativeComponent(i,this.name,t,e)},e}(M),Z=function(t){function e(){t.call(this,"n-object")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{res:{type:"string"}}},Object.defineProperties(e.prototype,n),e}($),tt=function(t){function e(){t.call(this,"n-spawner")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{res:{type:"string"}}},Object.defineProperties(e.prototype,n),e}($),et=function(t){function e(){t.call(this,"n-billboard",!1)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}($),nt=function(t){function e(){t.call(this,"n-skeleton-parent")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{part:{type:"string"},side:{type:"string","default":"center"},index:{type:"int","default":0},userId:{type:"string"}}},Object.defineProperties(e.prototype,n),e}($),it=function(t){function e(){t.call(this,"n-cockpit-parent",!1)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}($),rt=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{center:{type:"vec3"},type:{type:"string","default":"object"},isTrigger:{"default":!1,type:"boolean"}}},Object.defineProperties(e.prototype,n),e}($),ot=function(t){function e(){t.call(this,"n-sphere-collider")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{radius:{"default":1,type:"number"}}},Object.defineProperties(e.prototype,n),e}(rt),at=function(t){function e(){t.call(this,"n-box-collider")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{size:{type:"vec3","default":{x:1,y:1,z:1}}}},Object.defineProperties(e.prototype,n),e}(rt),st=function(t){function e(){t.call(this,"n-capsule-collider")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{radius:{"default":0,type:"number"},height:{"default":0,type:"number"},direction:{"default":"y"}}},Object.defineProperties(e.prototype,n),e}(rt),ct=function(t){function e(e,n){void 0===e&&(e=null),t.call(this,"n-mesh-collider"),this.mesh=e,this.subcomponents=[]}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{convex:{type:"boolean","default":!0}}},e.prototype.init=function(){var n=this;if(this.mesh)t.prototype.init.call(this);else{this.subcomponents=[];var i=this.el.object3D;i.traverse(function(t){if(t instanceof THREE.Mesh){var i=new e(t);n.subcomponents.push(i),i.data=n.data,i.init()}}.bind(this)),this.el.addEventListener("model-loaded",this.init.bind(this))}},e.prototype.update=function(e){var n=this;this.mesh?t.prototype.update.call(this,e):this.subcomponents.forEach(function(t){t.data=n.data,t.update(e)}.bind(this))},e.prototype.remove=function(){this.mesh?t.prototype.remove.call(this):this.subcomponents.forEach(function(t){t.remove()}.bind(this))},Object.defineProperties(e.prototype,n),e}(rt),ut=function(t){function e(){t.call(this,"n-container")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{capacity:{"default":4,type:"number"}}},e.prototype.init=function(){t.prototype.init.call(this);var e=this.el,n=this;e.addEventListener("stateadded",function(t){"container-full"===t.detail.state&&e.emit("container-full"),"container-empty"===t.detail.state&&e.emit("container-empty")}),e.addEventListener("container-count-changed",function(t){n.count=t.detail.count})},Object.defineProperties(e.prototype,n),e}($),ht=function(t){function e(){t.call(this,"n-portal")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{targetSpace:{type:"string"},targetEvent:{type:"string"},targetEntity:{type:"selector"}}},e.prototype.update=function(){var t,e,n=this.el.object3DMap.mesh;if(this.data.targetEntity){this.el.sceneEl.object3D.updateMatrixWorld(!0),t=this.data.targetEntity.object3D.getWorldPosition();var i=this.data.targetEntity.object3D.getWorldQuaternion();e={x:i.x,y:i.y,z:i.z,w:i.w}}var r={targetSpace:this.data.targetSpace,targetEvent:this.data.targetEvent,targetPosition:t,targetQuaternion:e};altspace.updateNativeComponent(n,this.name,r)},Object.defineProperties(e.prototype,n),e}($);!function(){String.prototype.codePointAt||!function(){var t=function(){try{var t={},e=Object.defineProperty,n=e(t,t,t)&&e}catch(t){}return n}(),e=function(t){if(null==this)throw TypeError();var e=this+"",n=e.length,i=t?+t:0;if(i!=i&&(i=0),!(0>i||i>=n)){var r,o=e.charCodeAt(i);return o>=55296&&56319>=o&&n>i+1&&(r=e.charCodeAt(i+1),r>=56320&&57343>=r)?1024*(o-55296)+r-56320+65536:o}};t?t(String.prototype,"codePointAt",{value:e,configurable:!0,writable:!0}):String.prototype.codePointAt=e}(),String.prototype.repeat||!function(){var t=function(){try{var t={},e=Object.defineProperty,n=e(t,t,t)&&e}catch(t){}return n}(),e=function(t){if(null==this)throw TypeError();var e=this+"",n=t?+t:0;if(n!=n&&(n=0),0>n||n==1/0)throw RangeError();for(var i="";n;)n%2==1&&(i+=e),n>1&&(e+=e),n>>=1;return i};t?t(String.prototype,"repeat",{value:e,configurable:!0,writable:!0}):String.prototype.repeat=e}(),String.prototype.includes||!function(){var t={}.toString,e=function(){try{var t={},e=Object.defineProperty,n=e(t,t,t)&&e}catch(t){}return n}(),n="".indexOf,i=function(e){if(null==this)throw TypeError();var i=this+"";if(e&&"[object RegExp]"==t.call(e))throw TypeError();var r=i.length,o=e+"",a=o.length,s=arguments.length>1?arguments[1]:void 0,c=s?+s:0;return c!=c&&(c=0),!(a+Math.min(Math.max(c,0),r)>r)&&-1!=n.call(i,o,c)};e?e(String.prototype,"includes",{value:i,configurable:!0,writable:!0}):String.prototype.includes=i}(),String.prototype.startsWith||!function(){var t=function(){try{var t={},e=Object.defineProperty,n=e(t,t,t)&&e}catch(t){}return n}(),e={}.toString,n=function(t){if(null==this)throw TypeError();var n=this+"";if(t&&"[object RegExp]"==e.call(t))throw TypeError();var i=n.length,r=t+"",o=r.length,a=arguments.length>1?arguments[1]:void 0,s=a?+a:0;s!=s&&(s=0);var c=Math.min(Math.max(s,0),i);if(o+c>i)return!1;for(var u=-1;++u1){var s=arguments[1];void 0!==s&&(a=s?+s:0,a!=a&&(a=0))}var c=Math.min(Math.max(a,0),i),u=c-o;if(0>u)return!1;for(var h=-1;++hl||l>1114111||n(l)!=l)throw RangeError("Invalid code point: "+l);65535>=l?s.push(l):(l-=65536,i=(l>>10)+55296,r=l%1024+56320,s.push(i,r)),(c+1==u||s.length>a)&&(h+=e.apply(null,s),s.length=0)}return h};t?t(String,"fromCodePoint",{value:i,configurable:!0,writable:!0}):String.fromCodePoint=i}(),Object.defineProperty(String,"raw",{configurable:!0,enumerable:!1,writable:!0,value:function(t,e){var n;t=null!=t?t:{},e=arguments.length>1?i(arguments).slice(1):[];try{n=i(t.raw)}catch(i){throw new TypeError("Cannot convert undefined or null to object")}return n.map(function(n,i){return t.raw.length<=i?n:null!=e[i-1]?e[i-1]+n:n}).join("")}})}();var lt=function(t){function e(){t.call(this,"n-sound")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{res:{type:"string"},src:{type:"string"},on:{type:"string"},loop:{type:"boolean"},volume:{type:"number","default":1},autoplay:{type:"boolean"},oneshot:{type:"boolean"},spatialBlend:{type:"float","default":1},pitch:{type:"float","default":1},minDistance:{type:"float","default":1},maxDistance:{type:"float","default":12},rolloff:{type:"string","default":"logarithmic"}}},e.prototype.init=function(){var e=this.data.src;if(e&&!e.startsWith("http"))if(e.startsWith("/"))this.data.src=location.origin+e;else{var n=location.pathname;n.endsWith("/")||(n=location.pathname.split("/").slice(0,-1).join("/")+"/"),this.data.src=location.origin+n+e}t.prototype.init.call(this)},e.prototype.update=function(e){t.prototype.update.call(this,e),this.playHandler&&this.el.removeEventListener(e.on,this.playHandler),this.data.on&&(this.playHandler=this.playSound.bind(this),this.el.addEventListener(this.data.on,this.playHandler))},e.prototype.remove=function(){t.prototype.remove.call(this),this.playHandler&&this.el.removeEventListener(this.data.on,this.playHandler)},e.prototype.pauseSound=function(){this.callComponent("pause"),this.el.emit("sound-paused")},e.prototype.playSound=function(){this.callComponent("play"),this.el.emit("sound-played")},e.prototype.seek=function(t){this.callComponent("seek",{time:t})},Object.defineProperties(e.prototype,n),e}($),ft=function(t){function e(){t.call(this,"n-layout-browser")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{url:{"default":"about:blank"},isEnclosure:{"default":!1}}},Object.defineProperties(e.prototype,n),e}($),pt=function(e){function n(){e.call(this,"n-gltf")}e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n;var i={schema:{}};return i.schema.get=function(){return{url:{type:"string"},sceneIndex:{type:"int"}}},n.prototype.update=function(){var e=this.mesh||this.el.object3DMap.mesh,n=Object.assign({},this.data);n.url=new t(n.url).toString(),this.sendUpdates&&altspace.updateNativeComponent(e,this.name,n)},Object.defineProperties(n.prototype,i),n}($),dt=function(t){function e(){t.call(this,"n-text")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{text:{"default":"",type:"string"},fontSize:{"default":10,type:"int"},width:{"default":10,type:"number"},height:{"default":1,type:"number"},horizontalAlign:{"default":"middle"},verticalAlign:{"default":"middle"}}},Object.defineProperties(e.prototype,n),e}($),gt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(){function t(e){return e.isMesh?e:0===e.children.length?null:e.children.reduce(function(e,n){return e||t(n)},null)}var e=this;this.el.addEventListener("model-loaded",function(){e.el.setObject3D("mesh",t(e.el.object3DMap.mesh))})},e}(M);window.AFRAME&&delete AFRAME.components.visible;var bt=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={schema:{}};return n.schema.get=function(){return{"default":!0}},e.prototype.init=function(){this.el.addEventListener("model-loaded",this.update.bind(this))},e.prototype.update=function(){var t=this;this.el.object3D.traverse(function(e){return e.visible=t.data})},Object.defineProperties(e.prototype,n),e}(M);window.AFRAME&&(r("altspace-cursor-collider",D),r("altspace-tracked-controls",P),r("altspace",U),o("sync-system",H),r("sync-color",N),r("sync-transform",q),r("sync",B),r("sync-n-sound",W),r("sync-n-skeleton-parent",V),r("wire",G),r("one-per-user",K),r("instantiator",Q),r("n-object",Z),r("n-portal",ht),r("n-spawner",tt),r("n-text",dt),r("n-billboard",et),r("n-skeleton-parent",nt),r("n-cockpit-parent",it),r("n-container",ut),r("n-sound",lt),r("n-sphere-collider",ot),r("n-box-collider",at),r("n-capsule-collider",st),r("n-mesh-collider",ct),r("n-layout-browser",ft),r("n-gltf",pt),r("collapse-model",gt),r("visible",bt));var yt,vt,mt,wt,Et=Object.freeze({AltspaceComponent:U,AltspaceCursorCollider:D,AltspaceTrackedControls:P,SyncSystem:H,SyncComponent:B,SyncColor:N,SyncTransform:q,SyncNSound:W,Wire:G,OnePerUser:K,Instantiator:Q,SyncNSkeletonParent:V,NObject:Z,NPortal:ht,NSpawner:tt,NText:dt,NBillboard:et,NSkeletonParent:nt,NCockpitParent:it,NContainer:ut,NSound:lt,NSphereCollider:ot,NBoxCollider:at,NCapsuleCollider:st,NMeshCollider:ct,NLayoutBrowser:ft,CollapseModel:gt,NGLTF:pt}),_t=altspace&&altspace.inClient,jt=u(),St=Object.freeze({connect:l}),Ft=new THREE.Raycaster,Ot=Object.freeze({init:f}),At=function(t){void 0===t&&(t={auto:!0}),this._scene=null,this._renderer=null,this._camera=null;var e=window.AFRAME&&document.querySelector("a-scene");if(e){var n=document.querySelector("a-scene");this._scene=n.object3D,this._renderer=n.renderer;var i=document.querySelector("a-camera");i&&(this._camera=i.object3D)}else window.altspace&&altspace.inClient?(this._scene=new THREE.Scene,this._renderer=altspace.getThreeJSRenderer(),this._camera=new THREE.PerspectiveCamera):this._setupWebGL();t.auto&&!e&&this.loop()},Ct={scene:{},renderer:{},camera:{}};At.prototype._setupWebGL=function(){function t(){i.aspect=window.innerWidth/window.innerHeight,i.updateProjectionMatrix(),n.setSize(window.innerWidth,window.innerHeight)}var e=this._scene=new THREE.Scene,n=this._renderer=new THREE.WebGLRenderer({antialias:!0}),i=this._camera=new THREE.PerspectiveCamera;document.addEventListener("DOMContentLoaded",function(t){document.body.style.margin="0px",document.body.style.overflow="hidden",n.setClearColor("#035F72");var e=document.createElement("div");document.body.appendChild(e),e.appendChild(n.domElement)}),window.addEventListener("resize",t),t(),i.position.z=500,i.fov=45,i.near=1,i.far=2e3,e.add(i),e.add(new THREE.AmbientLight("white")),this.cursor=f(e,i)},At.prototype.loop=function(){window.requestAnimationFrame(this.loop.bind(this)),this.scene.updateAllBehaviors&&this.scene.updateAllBehaviors(),this.renderer.render(this.scene,this.camera)},Ct.scene.get=function(){return this._scene},Ct.renderer.get=function(){return this._renderer},Ct.camera.get=function(){return this._camera},Object.defineProperties(At.prototype,Ct);var kt,Tt,Rt="",xt="",Lt=function(){this.objUrls=[],this.mtlUrls=[],this.objects=[],this.error=null,this.objectsLoaded=0},It=Object.freeze({init:v,load:m,LoadRequest:Lt}),Mt="VR CodePen",Dt=window.name&&"pen-"===window.name.slice(0,4),Pt=!!window.altspace.inClient,Ut=!!location.href.match("codepen.io/"),Nt=Object.freeze({inTile:Dt,inVR:Pt,inCodePen:Ut,ensureInVR:_,setName:j,getPenId:F,getAuthorId:O,printDebugInfo:E}),Bt=function(){};Bt.prototype.load=function(t,e,n){var i=new THREE.MTLLoader,r=e.split("/").slice(0,-1).join("/");i.setTexturePath(r+"/"),i.setCrossOrigin(this.crossOrigin),i.load(e,function(e){var i=new THREE.OBJLoader;i.setMaterials(e),i.load(t,n)})},THREE&&!altspace.inClient&&(THREE.EventDispatcher.prototype.dispatchEvent=A,THREE.Object3D.prototype.dispatchEvent=A),THREE.Scene.prototype.updateAllBehaviors=function(){var t=performance.now(),e=this.__lastNow||t,n=t-e,i=this,r=[];this.traverse(function(t){t.__behaviorList&&r.push(t)});for(var o=0,a=r.length;a>o;o++){var s=r[o];s.updateBehaviors(n,i)}this.__lastNow=t},THREE.Object3D.prototype.addBehavior=function(t){this.addBehaviors(t)},THREE.Object3D.prototype.addBehaviors=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];this.__behaviorList=this.__behaviorList||[],(n=this.__behaviorList).push.apply(n,t);var n},THREE.Object3D.prototype.removeBehavior=function(t){if(!this.__behaviorList||0===this.__behaviorList.length)return null;var e=this.__behaviorList.indexOf(t);if(-1!==e){this.__behaviorList.splice(e,1);try{t.dispose&&t.dispose.call(t,this)}catch(n){console.group(),(console.error||console.log).call(console,n.stack||n),console.log("[Behavior]"),console.log(t),console.log("[Object3D]"),console.log(this),console.groupEnd()}}},THREE.Object3D.prototype.removeAllBehaviors=function(){var t=this;if(!this.__behaviorList||0===this.__behaviorList.length)return null;for(var e=0,n=this.__behaviorList.length;n>e;e++){var i=t.__behaviorList[e];try{i.dispose&&i.dispose.call(i,t)}catch(r){console.group(),(console.error||console.log).call(console,r.stack||r),console.log("[Behavior]"),console.log(i),console.log("[Object3D]"),console.log(t),console.groupEnd()}}this.__behaviorList.length=0},THREE.Object3D.prototype.getBehaviorByType=function(t){var e=this;if(!this.__behaviorList||0===this.__behaviorList.length)return null;for(var n=0,i=this.__behaviorList.length;i>n;n++)if(e.__behaviorList[n].type===t)return e.__behaviorList[n]},THREE.Object3D.prototype.updateBehaviors=function(t,e){var n=this;if(this.__behaviorList&&0!==this.__behaviorList.length){for(var i=[],r=this.__behaviorList.slice(),o=0,a=this.__behaviorList.length;a>o;o++){var s=n.__behaviorList[o];s.__isInitialized||i.push(s)}for(var o=0,a=i.length;a>o;o++){var s=i[o];try{s.awake&&s.awake.call(s,n,e)}catch(c){console.group(),(console.error||console.log).call(console,c.stack||c),console.log("[Behavior]"),console.log(s),console.log("[Object3D]"),console.log(n),console.groupEnd()}}for(var o=0,a=i.length;a>o;o++){var s=i[o];try{s.start&&s.start.call(s)}catch(c){console.group(),(console.error||console.log).call(console,c.stack||c),console.log("[Behavior]"),console.log(s),console.log("[Object3D]"),console.log(n),console.groupEnd()}s.__isInitialized=!0}for(var o=0,a=r.length;a>o;o++){var s=r[o];try{s.update&&s.update.call(s,t)}catch(c){console.group(),(console.error||console.log).call(console,c.stack||c),console.log("[Behavior]"),console.log(s),console.log("[Object3D]"),console.log(n),console.groupEnd()}}}};var Ht=Object.freeze({OBJMTLLoader:Bt,cursor:Ot}),qt=function(){},Wt={type:{}};Wt.type.get=function(){return this._typeWarning||(console.warn("Behavior",this,"does not expose type information!","It will not be queryable by getBehaviorByType, which will break","some built-in behaviors."),this._typeWarning=!0),null},qt.prototype.awake=function(t,e){},qt.prototype.start=function(){},qt.prototype.update=function(t){},qt.prototype.dispose=function(t){},Object.defineProperties(qt.prototype,Wt);var Vt=function(t){function e(e){t.call(this),this.config=Object.assign({x:3,y:5,shouldRotate:!0,shouldMove:!0},e),this.object3d=null,this.offsetPosition=null,this.lastBobPosition=new THREE.Vector3,this.nowOffset=1e4*Math.random()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"Bob"},e.prototype.awake=function(t){this.object3d=t,this.offsetPosition=this.object3d.position.clone()},e.prototype.update=function(t){var e=Math.floor(performance.now())+this.nowOffset;this.config.shouldMove&&(this.lastBobPosition.equals(this.object3d.position)||this.offsetPosition.copy(this.object3d.position),this.object3d.position.y=this.offsetPosition.y+Math.sin(e/800)*this.config.x,this.object3d.position.x=this.offsetPosition.x+Math.sin(e/500)*this.config.y,this.lastBobPosition.copy(this.object3d.position)),this.config.shouldRotate&&(this.object3d.rotation.x=Math.sin(e/500)/15)},Object.defineProperties(e.prototype,n),e}(qt),Gt=function(t){function e(e){t.call(this),this.config=Object.assign({overBrightness:1.5,downBrightness:.5 +},e),this.object3d=null,this.scene=null,this.originalColor=null,this.modifiedColor=new THREE.Color,this._cbs={cursorenter:this.cursorEnter.bind(this),cursordown:this.cursorDown.bind(this),cursorup:this.cursorUp.bind(this),cursorleave:this.cursorLeave.bind(this)}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"ButtonStateStyle"},e.prototype.awake=function(t,e){this.object3d=t,this.scene=e,this.originalColor=this.config.originalColor||this.object3d.material.color,this.object3d.addEventListener("cursorenter",this._cbs.cursorenter),this.object3d.addEventListener("cursordown",this._cbs.cursordown)},e.prototype.dispose=function(){this.object3d.removeEventListener("cursorenter",this._cbs.cursorenter),this.object3d.removeEventListener("cursorleave",this._cbs.cursorleave),this.object3d.removeEventListener("cursorup",this._cbs.cursorup),this.object3d.removeEventListener("cursordown",this._cbs.cursordown)},e.prototype.changeBrightness=function(t){this.modifiedColor.set(this.originalColor),this.modifiedColor.multiplyScalar(t),this.modifiedColor.r=THREE.Math.clamp(this.modifiedColor.r,0,1),this.modifiedColor.g=THREE.Math.clamp(this.modifiedColor.g,0,1),this.modifiedColor.b=THREE.Math.clamp(this.modifiedColor.b,0,1),this.object3d.material.color=this.modifiedColor},e.prototype.cursorLeave=function(){this.object3d.removeEventListener("cursorleave",this._cbs.cursorleave),this.changeBrightness(1)},e.prototype.cursorEnter=function(){this.changeBrightness(this.config.overBrightness),this.object3d.addEventListener("cursorleave",this._cbs.cursorleave)},e.prototype.cursorUp=function(t){this.scene.removeEventListener("cursorup",this._cbs.cursorup),this.object3d.addEventListener("cursorenter",this._cbs.cursorenter),t.target===this.object3d?(this.changeBrightness(this.config.overBrightness),this.object3d.addEventListener("cursorleave",this._cbs.cursorleave)):this.changeBrightness(1)},e.prototype.cursorDown=function(){this.scene.addEventListener("cursorup",this._cbs.cursorup),this.object3d.removeEventListener("cursorleave",this._cbs.cursorleave),this.object3d.removeEventListener("cursorenter",this._cbs.cursorenter),this.changeBrightness(this.config.downBrightness)},Object.defineProperties(e.prototype,n),e}(qt),Kt=function(t){function e(e){t.call(this),this.config=e=Object.assign({space:"world",x:!1,y:!1,z:!1,cursorSnap:!0},e),this.min=new THREE.Vector3(void 0!==e.x.min?e.x.min:Number.NEGATIVE_INFINITY,void 0!==e.y.min?e.y.min:Number.NEGATIVE_INFINITY,void 0!==e.z.min?e.z.min:Number.NEGATIVE_INFINITY),this.max=new THREE.Vector3(void 0!==e.x.max?e.x.max:Number.POSITIVE_INFINITY,void 0!==e.y.max?e.y.max:Number.POSITIVE_INFINITY,void 0!==e.z.max?e.z.max:Number.POSITIVE_INFINITY),this.object3d=null,this.scene=null,this.sync=null,this.intersector=null,this.dragOffset=new THREE.Vector3,this.raycaster=new THREE.Raycaster,this.raycaster.linePrecision=3,this._cbs={startDrag:this.startDrag.bind(this),moveDrag:this.moveDrag.bind(this),stopDrag:this.stopDrag.bind(this)}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"Drag"},e.prototype.awake=function(t,e){this.object3d=t,this.scene=e,this.sync=t.getBehaviorByType("Object3DSync"),this.makeIntersector(),this.scene.add(this.intersector)},e.prototype.start=function(){this.object3d.addEventListener("cursordown",this._cbs.startDrag)},e.prototype.dispose=function(){this.object3d.removeEventListener("cursordown",this._cbs.startDrag)},e.prototype.makeIntersector=function(){function t(){r.rotateY(Math.PI)}function e(){r.rotateX(Math.PI/2)}function n(){r.rotateY(Math.PI/2)}var i=1e4,r=new THREE.PlaneGeometry(i,i),o=!!this.config.x,a=!!this.config.y,s=!!this.config.z,c=o+a+s;if(3===c)throw new Error("Arbitrary dragging currently unsupported. Please lock at least one axis.");if(2!==c)throw 1===c?new Error("Single axis dragging currently unsupported."):new Error("Invalid axis configuration");o&&a?t():o&&s?e():a&&s&&n();var u=new THREE.MeshBasicMaterial({color:"purple"});u.side=THREE.DoubleSide,this.intersector=new THREE.Mesh(r,u),this.intersector.visible=!1,this.intersector.material.visible=!1},e.prototype.startDrag=function(t){this.scene.addEventListener("cursorup",this._cbs.stopDrag),this.scene.addEventListener("cursormove",this._cbs.moveDrag),this.raycaster.set(t.ray.origin,t.ray.direction);var e=this.raycaster.intersectObject(this.object3d,!0)[0];if(e){var n=e.point.clone(),i=C(this.object3d).clone();this.dragOffset.copy(n).sub(i),this.intersector.position.copy(this.intersector.parent.worldToLocal(n)),this.intersector.quaternion.copy(this.object3d.parent.quaternion),this.intersector.updateMatrixWorld();var r=this.createDragEvent("dragstart");this.object3d.dispatchEvent(r)}},e.prototype.moveDrag=function(t){this.sync&&!this.sync.isMine&&this.sync.takeOwnership(),this.intersector.visible=!0,this.raycaster.set(t.ray.origin,t.ray.direction);var e=this.raycaster.intersectObject(this.intersector,!0)[0];if(this.intersector.visible=!1,e){var n=new THREE.Vector3;n.copy(e.point).sub(this.dragOffset);var i=this,r=C(this.object3d);["x","y","z"].filter(function(t){return!i.config[t]}).forEach(function(t){n[t]=r[t]}),n.clamp(this.min,this.max),this.object3d.parent.updateMatrixWorld();var o=this.object3d.parent.worldToLocal(n);this.object3d.position.set(this.config.x?o.x:this.object3d.position.x,this.config.y?o.y:this.object3d.position.y,this.config.z?o.z:this.object3d.position.z)}},e.prototype.stopDrag=function(){this.scene.removeEventListener("cursorup",this._cbs.stopDrag),this.scene.removeEventListener("cursormove",this._cbs.moveDrag);var t=this.createDragEvent("dragstop");this.object3d.dispatchEvent(t)},e.prototype.createDragEvent=function(t){return{type:t,bubbles:!0,target:this.object3d,ray:this.raycaster.ray.clone()}},Object.defineProperties(e.prototype,n),e}(qt),Qt=.2,zt=function(t){function e(e){t.call(this),this.config=Object.assign({position:!0,rotation:!0,scale:!0},e),this.object3d=null,this.gamepad=null,this.scene=null,this.sync=null,this.isAltModeR=!1,this.isAltModeL=!1,this.prevAltButtonR=!1,this.prevAltButtonL=!1,this.isInitialized=!1,this.originalObj=null}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"GamepadControls"},e.prototype.awake=function(t,e){var n=this;if(this.object3d=t,this.scene=e,this.sync=this.object3d.getBehaviorByType("Object3DSync"),this.originalObj=this.object3d.clone(),this.gamepad=this.getGamepad(),this.gamepad)console.log("Gamepad detected: "+this.gamepad.id);else var i=setInterval(function(){n.gamepad=n.getGamepad(),n.gamepad&&(console.log("Gamepad connected: "+n.gamepad.id),clearInterval(i))}.bind(this),500);this.scene.addEventListener("cursordown",function(t){n.gamepad&&!n.isInitialized&&(n.preventDefault(n.gamepad),n.isInitialized=!0)}.bind(this))},e.prototype.getGamepad=function(){var t=this,e=[];if(e=altspace&&altspace.inClient?altspace.getGamepads():navigator.getGamepads(),e.length>0)for(var n=0;nQt||Math.abs(r)>Qt;o&&!this.sync.isMine&&this.sync.takeOwnership();var a=200*(t/1e3);Math.abs(i)>Qt&&(this.object3d.position.x+=a*i),Math.abs(r)>Qt&&(this.isAltModeL?this.object3d.position.y+=a*-r:this.object3d.position.z+=a*r)}if(this.config.rotation){var s=this.gamepad.buttons[11].pressed;this.prevAltButtonR&&!s&&(this.isAltModeR=!this.isAltModeR),this.prevAltButtonR=s;var c=this.gamepad.axes[2],u=this.gamepad.axes[3],h=Math.abs(c)>Qt||Math.abs(u)>Qt;h&&!this.sync.isMine&&this.sync.takeOwnership();var l=Math.PI*(t/1e3);!this.isAltModeR&&Math.abs(u)>Qt&&(this.object3d.rotation.x+=l*u),Math.abs(c)>Qt&&(this.isAltModeR?this.object3d.rotation.z+=l*-c:this.object3d.rotation.y+=l*c)}if(this.config.scale){var f=10*(t/1e3),p=this.gamepad.buttons[12].pressed,d=this.gamepad.buttons[13].pressed,g=this.gamepad.buttons[12].pressed||this.gamepad.buttons[13].pressed;g&&!this.sync.isMine&&this.sync.takeOwnership();var b=this.object3d.scale,y=new THREE.Vector3(1,1,1);y.multiplyScalar(f),p&&this.object3d.scale.add(y),d&&b.x>y.x&&b.y>y.y&&b.z>y.z&&this.object3d.scale.sub(y)}}},Object.defineProperties(e.prototype,n),e}(qt),Yt=function(t){function e(e){var n=this;if(t.call(this),this.config=Object.assign({event:"cursorenter",color:new THREE.Color("yellow")},e),"cursorenter"!==this.config.event&&"cursordown"!==this.config.event)throw Error('Expected config.event "cursorenter" or "cursordown"');this.object3d=null,this.cursordownObject=null,this.cursorenterObject=null,this.scene=null,this.cursordown=function(t){n.cursordownObject=n.object3d,"cursordown"===n.config.event&&n.setColor(n.cursordownObject)}.bind(this),this.cursorenter=function(t){n.cursordownObject&&n.cursordownObject!==n.object3d||(n.cursorenterObject&&n.unsetColor(n.cursorenterObject),n.cursorenterObject=n.object3d,n.setColor(n.object3d))}.bind(this),this.cursorleave=function(t){n.cursorenterObject===n.object3d&&(n.cursorenterObject=null,n.unsetColor(n.object3d))}.bind(this),this.cursorupScene=function(t){"cursordown"===n.config.event&&n.cursordownObject&&n.unsetColor(n.cursordownObject),n.cursordownObject=null}.bind(this)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"HoverColor"},e.prototype.awake=function(t,e){this.object3d=t,this.scene=e,this.object3d.addEventListener("cursordown",this.cursordown),this.scene.addEventListener("cursorup",this.cursorupScene),"cursorenter"===this.config.event&&(this.object3d.addEventListener("cursorenter",this.cursorenter),this.object3d.addEventListener("cursorleave",this.cursorleave))},e.prototype.dispose=function(){this.object3d.removeEventListener("cursordown",this.cursordown),this.scene.removeEventListener("cursorup",this.cursorupScene),this.object3d.removeEventListener("cursorenter",this.cursorenter),this.object3d.removeEventListener("cursorleave",this.cursorleave)},e.prototype.setColor=function(t){t.material&&t.material.color&&(t.userData.origColor=t.material.color,t.material.color=this.config.color,t.material&&(t.material.needsUpdate=!0)),t.children.forEach(this.setColor.bind(this))},e.prototype.unsetColor=function(t){if(t.material&&t.material.color){if(!t.userData.origColor)return void console.error("Cannot unsetColor, no userData.origColor for object",t);t.material.color=t.userData.origColor,t.material&&(t.material.needsUpdate=!0)}t.children.forEach(this.unsetColor.bind(this))},Object.defineProperties(e.prototype,n),e}(qt),Xt=function(t){function e(e){var n=this;t.call(this),this.config=Object.assign({scale:1.15,duration:75,revertOnDispose:!0},e),this.object3d=null,this.originalScale=null,this.elapsedTime=this.config.duration,this.progress=1,this.srcScale=null,this.destScale=null,this.onHoverStateChange=function(){var t;t=[n.destScale,n.srcScale],n.srcScale=t[0],n.destScale=t[1],n.progress=1-n.progress,n.elapsedTime=n.config.duration-n.elapsedTime}.bind(this)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"HoverScale"},e.prototype.awake=function(t,e){this.object3d=t,this.originalScale=this.object3d.scale.clone(),this.srcScale=this.object3d.scale.clone(),this.srcScale.multiplyScalar(this.config.scale),this.destScale=new THREE.Vector3,this.destScale.copy(this.originalScale),this.progress=1,this.elapsedTime=this.config.duration,this.object3d.addEventListener("cursorenter",this.onHoverStateChange),this.object3d.addEventListener("cursorleave",this.onHoverStateChange)},e.prototype.update=function(t){this.progress<1&&(this.elapsedTime=THREE.Math.clamp(this.elapsedTime+t,0,this.config.duration),this.progress=THREE.Math.clamp(this.elapsedTime/this.config.duration,0,1),this.object3d.scale.lerpVectors(this.srcScale,this.destScale,this.progress))},e.prototype.dispose=function(){this.object3d.removeEventListener("cursorenter",this.onHoverStateChange),this.object3d.removeEventListener("cursorleave",this.onHoverStateChange),this.config.revertOnDispose&&this.object3d.scale.copy(this.originalScale),this.originalScale=null,this.srcScale=null,this.destScale=null,this.object3d=null},Object.defineProperties(e.prototype,n),e}(qt),Jt=function(t){function e(n){t.call(this),this.config=Object.assign({jointCubeSize:15,joints:e.HAND_JOINTS},n),this.object3d=null,this.skeleton=null,this.jointCube=null,this.hasCollided=!1,this.collidedJoints=[],this.jointIntersectUnion=null}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"JointCollisionEvents"},e.prototype.awake=function(t,e){this.object3d=t;var n=this;k(e).then(function(t){n.skeleton=t,n.jointCube=new THREE.Vector3(n.config.jointCubeSize,n.config.jointCubeSize,n.config.jointCubeSize)})["catch"](function(t){console.log("Failed to get tracking skeleton",t)})},e.prototype.update=function(t){var e=this;if(this.skeleton){for(var n=[],i=0;iNumber.EPSILON&&this.object3d.scale.y>Number.EPSILON&&this.object3d.scale.z>Number.EPSILON)for(var c=0;c0){if(T(t,this.lastTransform))return;this.transformRef.set(t),this.lastTransform=t}}},e.prototype.takeOwnership=function(){this.ownerRef.set(this.sceneSync.clientId)},Object.defineProperties(e.prototype,n),e}(qt),pe=[],de={},ge={},be=function(t){function e(e,n){t.call(this),this.config=Object.assign({instantiators:{},destroyers:{},ready:null,autoSendRateMS:100},n),this.instanceRef=e,this.sceneRef=e.child("scene"),this.clientsRef=e.child("clients"),this.clientId=null,this.masterClientId=null}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{},isMasterClient:{}};return n.type.get=function(){return"SceneSync"},e.prototype.awake=function(t,e){var n=this;setInterval(R,this.config.autoSendRateMS);var i=e;this.clientId=i.uuid,this.clientsRef.on("value",function(t){var e=t.val();if(e){var i=Object.keys(e)[0];n.masterClientId=e[i]}}.bind(this)),this.clientsRef.push(this.clientId).onDisconnect().remove(),this.instanceRef.child("initialized").once("value",function(t){var e=!t.val();t.ref().set(!0),n.config.ready&&n.config.ready(e)}.bind(this)),this.sceneRef.on("child_added",this.onInstantiate.bind(this)),this.sceneRef.on("child_removed",this.onDestroy.bind(this))},e.prototype.instantiate=function(t,e,n){void 0===e&&(e={});var i=this.sceneRef.push({syncType:t,initData:e},function(t){if(t)throw Error("Failed to save to Firebase",t)});n&&i.onDisconnect().remove();var r=de[i.key()];return r.getBehaviorByType("Object3DSync").takeOwnership(),r},e.prototype.onInstantiate=function(t){var e=t.val(),n=t.key(),i=this.config.instantiators[e.syncType];if(!i)return void console.warn("No instantiator found for syncType: "+e.syncType);var r=i(e.initData,e.syncType);if(!r)return void console.error(e.syncType+".create must return an Object3D");de[n]=r,ge[r.uuid]=n;var o=r.getBehaviorByType("Object3DSync");return o?(pe.push(o),void o.link(t.ref(),this)):void console.error(e.syncType+" instantiator must return an Object3D with an Object3DSync behavior")},e.prototype.destroy=function(t){var e=ge[t.uuid];return e?(this.sceneRef.child(e).remove(function(t){t&&console.warn("Failed to remove from Firebase",t)}),void this.sceneRef.child(e).off()):void console.warn("Failed to find key for object3d to be destroyed",t)},e.prototype.onDestroy=function(t){function e(t){t.removeAllBehaviors(),t.parent&&t.parent.remove(t),t.geometry&&t.geometry.dispose(),t.material&&(t.material.map&&t.material.map.dispose(),t.material.dispose())}var n=t.val(),i=t.key(),r=de[i];if(!r)return void console.warn("Failed to find object matching deleted key",i);var o=n.syncType;if(!o)return void console.warn("No syncType found for object being destroyed",r);var a=this.config.destroyers[o],s=!a;a&&(s=a(r)),s&&e(r),delete de[i],delete ge[r.uuid]},n.isMasterClient.get=function(){return this.masterClientId===this.clientId},Object.defineProperties(e.prototype,n),e}(qt),ye=function(t){function e(e){t.call(this),this.config=Object.assign({speed:1e-4,axis:new THREE.Vector3(0,1,0)},e),this.config.axis.normalize(),this.object3d=null}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"Spin"},e.prototype.awake=function(t){this.object3d=t},e.prototype.update=function(t){this.object3d.rotateOnAxis(this.config.axis,this.config.speed*t)},Object.defineProperties(e.prototype,n),e}(qt),ve=function(t){function e(e){t.call(this),this.config=Object.assign({logging:!1},e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"SteamVRInput"},e.prototype.awake=function(){var t=this;this.leftControllerPromise=x(e.LEFT_CONTROLLER,this.config),this.rightControllerPromise=x(e.RIGHT_CONTROLLER,this.config),this.firstControllerPromise=Promise.race([this.leftControllerPromise,this.rightControllerPromise]),this.leftControllerPromise.then(function(e){t.leftController=e}),this.rightControllerPromise.then(function(e){t.rightController=e}),this.firstControllerPromise.then(function(n){t.firstController=n;var i=n.axes.map(function(){return!1}),r=n.buttons.map(function(){return!1});r[e.BUTTON_TRIGGER]=!0,r[e.BUTTON_TOUCHPAD]=!0,n.preventDefault(i,r)})},Object.defineProperties(e.prototype,n),e}(qt);Object.assign(ve,{BUTTON_TRIGGER:0,BUTTON_GRIP:1,BUTTON_TOUCHPAD:2,BUTTON_DPAD_UP:3,BUTTON_DPAD_RIGHT:4,BUTTON_DPAD_DOWN:5,BUTTON_DPAD_LEFT:6,AXIS_TOUCHPAD_X:0,AXIS_TOUCHPAD_Y:1,FIRST_CONTROLLER:"first",LEFT_CONTROLLER:"left",RIGHT_CONTROLLER:"right"});var me=function(t){function e(e){var n=e.hand;void 0===n&&(n="first"),t.call(this),this._hand=n}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"SteamVRTrackedObject"},e.prototype.awake=function(t,e){this._object3d=t,this._scene=e,this._steamVRInput=this._scene.getBehaviorByType("SteamVRInput")},e.prototype.update=function(){var t=this._steamVRInput[this._hand+"Controller"],e=this._object3d;if(t){var n=t.position,i=n.x,r=n.y,o=n.z;e.position.set(i,r,o);var a=t.rotation,i=a.x,r=a.y,o=a.z,s=a.w;e.quaternion.set(i,r,o,s)}},Object.defineProperties(e.prototype,n),e}(qt),we=function(t){function e(e){void 0===e&&(e={}),t.call(this),this.object3d=null,this.scene=null,this.startingRotation=null,this.activelyRotating=!1,this.lastDisplacementX=0,this.runningCount=5,this.runningAverageVelocityX=0}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={type:{}};return n.type.get=function(){return"TouchpadRotate"},e.prototype.awake=function(t,e){this.object3d=t,this.scene=e,altspace.addEventListener("touchpadup",this.onTouchpadUp.bind(this)),altspace.addEventListener("touchpaddown",this.onTouchpadDown.bind(this)),altspace.addEventListener("touchpadmove",this.onTouchpadMove.bind(this))},e.prototype.update=function(t){!this.activelyRotating&&Math.abs(this.runningAverageVelocityX)>.01&&(this.object3d.rotation.y+=this.runningAverageVelocityX,this.runningAverageVelocityX*=.97)},e.prototype.onTouchpadUp=function(t){this.activelyRotating=!1},e.prototype.onTouchpadDown=function(t){this.activelyRotating=!0,this.startingRotation=this.object3d.rotation.clone()},e.prototype.onTouchpadMove=function(t){var e=t.displacementX-this.lastDisplacementX;this.object3d.rotation.set(this.startingRotation.x,this.startingRotation.y+t.displacementX/300,this.startingRotation.z),this.runningAverageVelocityX=(this.runningAverageVelocityX*this.runningCount+e/300)/(this.runningCount+1),this.lastDisplacementX=t.displacementX},Object.defineProperties(e.prototype,n),e}(qt),Ee=Object.freeze({Behavior:qt,Bob:Vt,ButtonStateStyle:Gt,Drag:Kt,GamepadControls:zt,HoverColor:Yt,HoverScale:Xt,JointCollisionEvents:Jt,Layout:le,Object3DSync:fe,SceneSync:be,Spin:ye,SteamVRInput:ve,SteamVRTrackedObject:me,TouchpadRotate:we}),_e=Object.freeze({sync:St,Simulation:At,multiloader:It,codePen:Nt,shims:Ht,behaviors:Ee});Object.isFrozen(window.altspace)||Object.assign(window.altspace,{components:{},utilities:{},inClient:!1});var je="2.7.4";window.altspace.requestVersion&&window.altspace.requestVersion(je),window.AFRAME&&!window.THREE&&(window.THREE=window.AFRAME.THREE),Object.assign(window.altspace.components||{},Et),Object.assign(window.altspace.utilities||{},_e)}(Url,Firebase,Please); \ No newline at end of file diff --git a/doc/aframe/index.html b/doc/aframe/index.html index feb98443..4aa4dadc 100644 --- a/doc/aframe/index.html +++ b/doc/aframe/index.html @@ -33,7 +33,7 @@ diff --git a/doc/aframe/module-altspace_components.AFrameComponent.html b/doc/aframe/module-altspace_components.AFrameComponent.html index bb044130..6b4e57fb 100644 --- a/doc/aframe/module-altspace_components.AFrameComponent.html +++ b/doc/aframe/module-altspace_components.AFrameComponent.html @@ -33,7 +33,7 @@ diff --git a/doc/aframe/module-altspace_components.AFrameSystem.html b/doc/aframe/module-altspace_components.AFrameSystem.html index 5afd8bb4..aee86252 100644 --- a/doc/aframe/module-altspace_components.AFrameSystem.html +++ b/doc/aframe/module-altspace_components.AFrameSystem.html @@ -33,7 +33,7 @@ diff --git a/doc/aframe/module-altspace_components.NativeComponent.html b/doc/aframe/module-altspace_components.NativeComponent.html index 91a7440e..128fec4f 100644 --- a/doc/aframe/module-altspace_components.NativeComponent.html +++ b/doc/aframe/module-altspace_components.NativeComponent.html @@ -33,7 +33,7 @@ diff --git a/doc/aframe/module-altspace_components.altspace-cursor-collider.html b/doc/aframe/module-altspace_components.altspace-cursor-collider.html index b92b7897..70bf731a 100644 --- a/doc/aframe/module-altspace_components.altspace-cursor-collider.html +++ b/doc/aframe/module-altspace_components.altspace-cursor-collider.html @@ -33,7 +33,7 @@ diff --git a/doc/aframe/module-altspace_components.altspace-tracked-controls.html b/doc/aframe/module-altspace_components.altspace-tracked-controls.html index f8a220bc..7c1f6174 100644 --- a/doc/aframe/module-altspace_components.altspace-tracked-controls.html +++ b/doc/aframe/module-altspace_components.altspace-tracked-controls.html @@ -33,7 +33,7 @@ diff --git a/doc/aframe/module-altspace_components.altspace.html b/doc/aframe/module-altspace_components.altspace.html index aabe4114..8ae66e6f 100644 --- a/doc/aframe/module-altspace_components.altspace.html +++ b/doc/aframe/module-altspace_components.altspace.html @@ -33,7 +33,7 @@ diff --git a/doc/aframe/module-altspace_components.collapse-model.html b/doc/aframe/module-altspace_components.collapse-model.html index 4a4820ac..4f1642b2 100644 --- a/doc/aframe/module-altspace_components.collapse-model.html +++ b/doc/aframe/module-altspace_components.collapse-model.html @@ -33,7 +33,7 @@ diff --git a/doc/aframe/module-altspace_components.html b/doc/aframe/module-altspace_components.html index 1053763b..ff014d43 100644 --- a/doc/aframe/module-altspace_components.html +++ b/doc/aframe/module-altspace_components.html @@ -33,7 +33,7 @@ @@ -191,6 +191,9 @@

Classes

n-container
+
n-gltf
+
+
n-layout-browser
diff --git a/doc/aframe/module-altspace_components.instantiator.html b/doc/aframe/module-altspace_components.instantiator.html index bec4733a..120ae8e5 100644 --- a/doc/aframe/module-altspace_components.instantiator.html +++ b/doc/aframe/module-altspace_components.instantiator.html @@ -33,7 +33,7 @@ diff --git a/doc/aframe/module-altspace_components.n-billboard.html b/doc/aframe/module-altspace_components.n-billboard.html index c6914036..e6fee2a6 100644 --- a/doc/aframe/module-altspace_components.n-billboard.html +++ b/doc/aframe/module-altspace_components.n-billboard.html @@ -33,7 +33,7 @@ diff --git a/doc/aframe/module-altspace_components.n-box-collider.html b/doc/aframe/module-altspace_components.n-box-collider.html index ebfa7d99..1253ec4f 100644 --- a/doc/aframe/module-altspace_components.n-box-collider.html +++ b/doc/aframe/module-altspace_components.n-box-collider.html @@ -33,7 +33,7 @@ diff --git a/doc/aframe/module-altspace_components.n-capsule-collider.html b/doc/aframe/module-altspace_components.n-capsule-collider.html index 79c8bb9a..2e95cf3e 100644 --- a/doc/aframe/module-altspace_components.n-capsule-collider.html +++ b/doc/aframe/module-altspace_components.n-capsule-collider.html @@ -33,7 +33,7 @@ diff --git a/doc/aframe/module-altspace_components.n-cockpit-parent.html b/doc/aframe/module-altspace_components.n-cockpit-parent.html index 831c84b9..0acd7a02 100644 --- a/doc/aframe/module-altspace_components.n-cockpit-parent.html +++ b/doc/aframe/module-altspace_components.n-cockpit-parent.html @@ -33,7 +33,7 @@ diff --git a/doc/aframe/module-altspace_components.n-collider.html b/doc/aframe/module-altspace_components.n-collider.html index 5df54a69..cf8b015d 100644 --- a/doc/aframe/module-altspace_components.n-collider.html +++ b/doc/aframe/module-altspace_components.n-collider.html @@ -33,7 +33,7 @@ diff --git a/doc/aframe/module-altspace_components.n-container.html b/doc/aframe/module-altspace_components.n-container.html index 874a8bdd..809e1c0e 100644 --- a/doc/aframe/module-altspace_components.n-container.html +++ b/doc/aframe/module-altspace_components.n-container.html @@ -33,7 +33,7 @@ diff --git a/doc/aframe/module-altspace_components.n-gltf.html b/doc/aframe/module-altspace_components.n-gltf.html new file mode 100644 index 00000000..19b89287 --- /dev/null +++ b/doc/aframe/module-altspace_components.n-gltf.html @@ -0,0 +1,306 @@ + + + + + + n-gltf - Documentation + + + + + + + + + + + + + + + + + + + +
+ +

n-gltf

+ + + + + + + +
+ +
+ +

+ altspace/components. + + n-gltf +

+ +

Load a 3D model as a native asset, and attach it to this node. +As a native asset, the model will be inaccessible from javascript, but +may have better performance, materials, and colliders than normal SDK objects. +This feature is a work in progress, with improvements going out periodically. +Because of the higher-fidelity material system, using this feature may cause +framerates to drop, so proceed with caution.

+ + +
+ +
+
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ + + +

sceneIndex :int

+ + + + +
+

If the model file describes multiple scenes, load this one instead of the default.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +

url :string

+ + + + +
+

The URL of a glTF model.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + +
+ +
+ +
+ Documentation generated by JSDoc 3.5.5 using the Minami theme. +
+ + + + + \ No newline at end of file diff --git a/doc/aframe/module-altspace_components.n-layout-browser.html b/doc/aframe/module-altspace_components.n-layout-browser.html index c6b436fd..87f500a1 100644 --- a/doc/aframe/module-altspace_components.n-layout-browser.html +++ b/doc/aframe/module-altspace_components.n-layout-browser.html @@ -33,7 +33,7 @@ diff --git a/doc/aframe/module-altspace_components.n-mesh-collider.html b/doc/aframe/module-altspace_components.n-mesh-collider.html index 450d5927..5841ab5e 100644 --- a/doc/aframe/module-altspace_components.n-mesh-collider.html +++ b/doc/aframe/module-altspace_components.n-mesh-collider.html @@ -33,7 +33,7 @@ diff --git a/doc/aframe/module-altspace_components.n-object.html b/doc/aframe/module-altspace_components.n-object.html index acdfa761..62461298 100644 --- a/doc/aframe/module-altspace_components.n-object.html +++ b/doc/aframe/module-altspace_components.n-object.html @@ -33,7 +33,7 @@ diff --git a/doc/aframe/module-altspace_components.n-portal.html b/doc/aframe/module-altspace_components.n-portal.html index 0ae1c0cf..4ec8f965 100644 --- a/doc/aframe/module-altspace_components.n-portal.html +++ b/doc/aframe/module-altspace_components.n-portal.html @@ -33,7 +33,7 @@ diff --git a/doc/aframe/module-altspace_components.n-skeleton-parent.html b/doc/aframe/module-altspace_components.n-skeleton-parent.html index b3a7cf08..fab0eb30 100644 --- a/doc/aframe/module-altspace_components.n-skeleton-parent.html +++ b/doc/aframe/module-altspace_components.n-skeleton-parent.html @@ -33,7 +33,7 @@ diff --git a/doc/aframe/module-altspace_components.n-sound.html b/doc/aframe/module-altspace_components.n-sound.html index c9c192d5..515171a1 100644 --- a/doc/aframe/module-altspace_components.n-sound.html +++ b/doc/aframe/module-altspace_components.n-sound.html @@ -33,7 +33,7 @@ diff --git a/doc/aframe/module-altspace_components.n-spawner.html b/doc/aframe/module-altspace_components.n-spawner.html index e3c5beaf..d23deab7 100644 --- a/doc/aframe/module-altspace_components.n-spawner.html +++ b/doc/aframe/module-altspace_components.n-spawner.html @@ -33,7 +33,7 @@ diff --git a/doc/aframe/module-altspace_components.n-sphere-collider.html b/doc/aframe/module-altspace_components.n-sphere-collider.html index d791bf2f..31e3834d 100644 --- a/doc/aframe/module-altspace_components.n-sphere-collider.html +++ b/doc/aframe/module-altspace_components.n-sphere-collider.html @@ -33,7 +33,7 @@ diff --git a/doc/aframe/module-altspace_components.n-text.html b/doc/aframe/module-altspace_components.n-text.html index 9c0b8cd3..ca16ef50 100644 --- a/doc/aframe/module-altspace_components.n-text.html +++ b/doc/aframe/module-altspace_components.n-text.html @@ -33,7 +33,7 @@ diff --git a/doc/aframe/module-altspace_components.one-per-user.html b/doc/aframe/module-altspace_components.one-per-user.html index 94cdbbd4..836b15be 100644 --- a/doc/aframe/module-altspace_components.one-per-user.html +++ b/doc/aframe/module-altspace_components.one-per-user.html @@ -33,7 +33,7 @@ diff --git a/doc/aframe/module-altspace_components.sync-color.html b/doc/aframe/module-altspace_components.sync-color.html index 1eb2fcfc..9bbf2b24 100644 --- a/doc/aframe/module-altspace_components.sync-color.html +++ b/doc/aframe/module-altspace_components.sync-color.html @@ -33,7 +33,7 @@ diff --git a/doc/aframe/module-altspace_components.sync-n-skeleton-parent.html b/doc/aframe/module-altspace_components.sync-n-skeleton-parent.html index 3e4e2963..01a10166 100644 --- a/doc/aframe/module-altspace_components.sync-n-skeleton-parent.html +++ b/doc/aframe/module-altspace_components.sync-n-skeleton-parent.html @@ -33,7 +33,7 @@ diff --git a/doc/aframe/module-altspace_components.sync-n-sound.html b/doc/aframe/module-altspace_components.sync-n-sound.html index 2f592769..a9115f29 100644 --- a/doc/aframe/module-altspace_components.sync-n-sound.html +++ b/doc/aframe/module-altspace_components.sync-n-sound.html @@ -33,7 +33,7 @@ diff --git a/doc/aframe/module-altspace_components.sync-system.html b/doc/aframe/module-altspace_components.sync-system.html index f6faa1bd..3f6acfbb 100644 --- a/doc/aframe/module-altspace_components.sync-system.html +++ b/doc/aframe/module-altspace_components.sync-system.html @@ -33,7 +33,7 @@ diff --git a/doc/aframe/module-altspace_components.sync-transform.html b/doc/aframe/module-altspace_components.sync-transform.html index 88afdf22..fe819d49 100644 --- a/doc/aframe/module-altspace_components.sync-transform.html +++ b/doc/aframe/module-altspace_components.sync-transform.html @@ -33,7 +33,7 @@ diff --git a/doc/aframe/module-altspace_components.sync.html b/doc/aframe/module-altspace_components.sync.html index 24978952..084f7784 100644 --- a/doc/aframe/module-altspace_components.sync.html +++ b/doc/aframe/module-altspace_components.sync.html @@ -33,7 +33,7 @@ diff --git a/doc/aframe/module-altspace_components.wire.html b/doc/aframe/module-altspace_components.wire.html index 3308e27a..462d4653 100644 --- a/doc/aframe/module-altspace_components.wire.html +++ b/doc/aframe/module-altspace_components.wire.html @@ -33,7 +33,7 @@ diff --git a/doc/aframe/module-altspace_resources.html b/doc/aframe/module-altspace_resources.html index 9e1069db..9a440748 100644 --- a/doc/aframe/module-altspace_resources.html +++ b/doc/aframe/module-altspace_resources.html @@ -33,7 +33,7 @@ diff --git a/examples/aframe/native-gltf.html b/examples/aframe/native-gltf.html new file mode 100644 index 00000000..fd97d3ac --- /dev/null +++ b/examples/aframe/native-gltf.html @@ -0,0 +1,13 @@ + + + + Native glTF + + + + + + + + + diff --git a/examples/index.html b/examples/index.html index 8b6d423a..520197de 100644 --- a/examples/index.html +++ b/examples/index.html @@ -46,6 +46,7 @@ 'aframe/fireball/index.html', 'aframe/introduction/index.html', 'aframe/moon.html', + 'aframe/native-gltf.html', 'aframe/native-layout-browsers.html', 'aframe/native-parents.html', 'aframe/native-portals.html', diff --git a/src/components/NGLTF.js b/src/components/NGLTF.js new file mode 100644 index 00000000..e0bfdab0 --- /dev/null +++ b/src/components/NGLTF.js @@ -0,0 +1,45 @@ +import NativeComponent from './NativeComponent'; +import Url from 'urllib'; + +/** +* @name module:altspace/components.n-gltf +* @class +* @extends module:altspace/components.NativeComponent +* @classdesc Load a 3D model as a native asset, and attach it to this node. +* As a native asset, the model will be inaccessible from javascript, but +* may have better performance, materials, and colliders than normal SDK objects. +* This feature is a work in progress, with improvements going out periodically. +* Because of the higher-fidelity material system, using this feature may cause +* framerates to drop, so proceed with caution. @aframe +*/ +export default class NGLTF extends NativeComponent { + constructor() {super('n-gltf'); } + get schema() { + return { + /** + * The URL of a glTF model. + * @instance + * @member {string} url + * @memberof module:altspace/components.n-gltf + */ + url: { type: 'string' }, + + /** + * If the model file describes multiple scenes, load this one instead of the default. + * @instance + * @member {int} sceneIndex + * @memberof module:altspace/components.n-gltf + */ + sceneIndex: { type: 'int' } + }; + } + update(){ + let mesh = this.mesh || this.el.object3DMap.mesh; + var data = Object.assign({}, this.data); + data.url = new Url(data.url).toString(); + + if(this.sendUpdates){ + altspace.updateNativeComponent(mesh, this.name, data); + } + } +} diff --git a/src/components/index.js b/src/components/index.js index 23553e14..5d323a33 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -44,6 +44,7 @@ import NContainer from './NContainer'; import NPortal from './NPortal'; import NSound from './NSound'; import NLayoutBrowser from './NLayoutBrowser'; +import NGLTF from './NGLTF'; import NText from './NText'; import CollapseModel from './CollapseModel'; import Visible from './visible'; @@ -76,6 +77,7 @@ if (window.AFRAME) registerComponentClass('n-capsule-collider', NCapsuleCollider); registerComponentClass('n-mesh-collider', NMeshCollider); registerComponentClass('n-layout-browser', NLayoutBrowser); + registerComponentClass('n-gltf', NGLTF); registerComponentClass('collapse-model', CollapseModel); registerComponentClass('visible', Visible); } @@ -85,5 +87,5 @@ export { SyncComponent, SyncColor, SyncTransform, SyncNSound, Wire, OnePerUser, Instantiator, SyncNSkeletonParent, NObject, NPortal, NSpawner, NText, NBillboard, NSkeletonParent, NCockpitParent, NContainer, NSound, NSphereCollider, NBoxCollider, NCapsuleCollider, - NMeshCollider, NLayoutBrowser, CollapseModel + NMeshCollider, NLayoutBrowser, CollapseModel, NGLTF };