From 1fedf41e7984a508b252c4088a43124b84e51a03 Mon Sep 17 00:00:00 2001 From: altspaceautobot Date: Fri, 19 Jan 2018 17:53:12 -0800 Subject: [PATCH] Version bump 2.7.3 --- README.md | 4 ++-- dist/altspace.js | 8 ++++---- dist/altspace.min.js | 4 ++-- doc/aframe/index.html | 2 +- doc/aframe/module-altspace_components.altspace.html | 2 +- doc/aframe/module-altspace_components.html | 2 +- doc/index.html | 4 ++-- doc/js/index.html | 2 +- package.json | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index acb614a1..c83f6667 100644 --- a/README.md +++ b/README.md @@ -34,11 +34,11 @@ Many APIs are present in the client without loading `altspace.js`, but please st The version baked into the altspace.js script will determine which version of the entire SDK the client will provide your app. This means that if we make any breaking internal changes to things like rendering or cursor events, and you are using an older version of `altspace.js`, we will try to return legacy behavior appropriate to your version of `altspace.js`. Versioning will follow [SEMVER](http://semver.org/) as closely as possible. Details for each version can be found in the [Release Notes](https://github.com/AltspaceVR/AltspaceSDK/releases). -**Latest Version: v2.7.2 -- [See Changes](https://github.com/AltspaceVR/AltspaceSDK/releases/tag/v2.7.2)** +**Latest Version: v2.7.3 -- [See Changes](https://github.com/AltspaceVR/AltspaceSDK/releases/tag/v2.7.3)** Include the latest version of the SDK in your app with: -`` +`` If you use npm, you can install altspace.js with: diff --git a/dist/altspace.js b/dist/altspace.js index 4a1648cb..757815a5 100644 --- a/dist/altspace.js +++ b/dist/altspace.js @@ -501,7 +501,7 @@ var AltspaceTrackedControls = (function (AFrameComponent$$1) { * * My A-Frame Scene * -* +* * * * @@ -1388,7 +1388,7 @@ var SyncTransform = (function (AFrameComponent$$1) { { this.sync = this.el.components.sync; if(this.sync.isConnected) - { start(); } + { this.start(); } else { this.el.addEventListener('connected', this.start.bind(this)); } }; @@ -3078,7 +3078,7 @@ var Visible = (function (AFrameComponent$$1) { * * My A-Frame Scene * -* +* * * * @@ -6344,7 +6344,7 @@ var utilities_lib = Object.freeze({ if(!Object.isFrozen(window.altspace)) { Object.assign(window.altspace, {components: {}, utilities: {}, inClient: false}); } -var version = '2.7.2'; +var version = '2.7.3'; if (window.altspace.requestVersion) { window.altspace.requestVersion(version); } diff --git a/dist/altspace.min.js b/dist/altspace.min.js index 3f6195fa..42255be7 100644 --- a/dist/altspace.min.js +++ b/dist/altspace.min.js @@ -3,5 +3,5 @@ n.contains(a)?(a=O(n,a),i=Ve(i,a,o.children)):a.contains(n)&&(a=O(a,n),a.e()?i=V null!=e&&"object"==typeof e||null!=n&&"object"==typeof n)throw Error("Query: First argument passed to startAt(), endAt(), or equalTo() cannot be an object.")}function li(t){if(t.ma&&t.pa&&t.ja&&(!t.ja||""===t.Nb))throw Error("Query: Can't combine startAt(), endAt(), and limit(). Use limitToFirst() or limitToLast() instead.")}function mi(t,e){if(!0===t.kc)throw Error(e+": You can't combine multiple orderBy calls.")}function ni(t,e,n){var i={cancel:null,Ma:null};if(e&&n)i.cancel=e,A(t,3,i.cancel,!0),i.Ma=n,mb(t,4,i.Ma);else if(e)if("object"==typeof e&&null!==e)i.Ma=e;else{if("function"!=typeof e)throw Error(z(t,3,!0)+" must either be a cancel callback or a context object.");i.cancel=e}return i}function U(t,e){var n,i,r;if(t instanceof Qh)n=t,i=e;else{x("new Firebase",1,2,arguments.length),i=Qc(arguments[0]),n=i.Rg,"firebase"===i.domain&&Pc(i.host+" is no longer supported. Please use .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},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?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.2";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 +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.3";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 diff --git a/doc/aframe/index.html b/doc/aframe/index.html index 1611eaa5..3fb72460 100644 --- a/doc/aframe/index.html +++ b/doc/aframe/index.html @@ -73,7 +73,7 @@

Quick Start

This is a fully functional example of what A-Frame code l

<!DOCTYPE html>
 <html><head>
 <script src="https://aframe.io/releases/0.7.0/aframe.min.js"></script>
-<script src="https://sdk.altvr.com/libs/altspace.js/2.7.2/altspace.min.js"></script>
+<script src="https://sdk.altvr.com/libs/altspace.js/2.7.3/altspace.min.js"></script>
 <script>
 
 // an example custom component, that will change the color when clicked
diff --git a/doc/aframe/module-altspace_components.altspace.html b/doc/aframe/module-altspace_components.altspace.html
index 95f1443a..703436b6 100644
--- a/doc/aframe/module-altspace_components.altspace.html
+++ b/doc/aframe/module-altspace_components.altspace.html
@@ -134,7 +134,7 @@ 

Example
-
<head>
  <title>My A-Frame Scene</title>
  <script src="https://aframe.io/releases/0.7.0/aframe.min.js"></script>
  <script src="https://cdn.rawgit.com/AltspaceVR/AltspaceSDK/v2.7.2/dist/altspace.min.js"></script>
</head>
<body>
  <a-scene altspace>
    <a-entity geometry="primitive: box" material="color: #C03546"></a-entity>
  </a-scene>
</body>
+
<head>
  <title>My A-Frame Scene</title>
  <script src="https://aframe.io/releases/0.7.0/aframe.min.js"></script>
  <script src="https://cdn.rawgit.com/AltspaceVR/AltspaceSDK/v2.7.3/dist/altspace.min.js"></script>
</head>
<body>
  <a-scene altspace>
    <a-entity geometry="primitive: box" material="color: #C03546"></a-entity>
  </a-scene>
</body>
diff --git a/doc/aframe/module-altspace_components.html b/doc/aframe/module-altspace_components.html index 3c5efb2a..2bb84424 100644 --- a/doc/aframe/module-altspace_components.html +++ b/doc/aframe/module-altspace_components.html @@ -136,7 +136,7 @@

altspace/components

Example
-
<html>
  <head>
    <title>My A-Frame Scene</title>
    <script src="https://aframe.io/releases/0.7.0/aframe.min.js"></script>
    <script src="https://cdn.rawgit.com/AltspaceVR/AltspaceSDK/v2.7.2/dist/altspace.min.js"></script>
  </head>
  <body>
    <a-scene altspace>
      <a-entity geometry="primitive: box" material="color: #C03546"></a-entity>
    </a-scene>
  </body>
</html>
+
<html>
  <head>
    <title>My A-Frame Scene</title>
    <script src="https://aframe.io/releases/0.7.0/aframe.min.js"></script>
    <script src="https://cdn.rawgit.com/AltspaceVR/AltspaceSDK/v2.7.3/dist/altspace.min.js"></script>
  </head>
  <body>
    <a-scene altspace>
      <a-entity geometry="primitive: box" material="color: #C03546"></a-entity>
    </a-scene>
  </body>
</html>
diff --git a/doc/index.html b/doc/index.html index 42bd67a9..e5c9c47e 100644 --- a/doc/index.html +++ b/doc/index.html @@ -23,9 +23,9 @@

altspace.js

altspace.js should be included whenever you use the SDK. It contains core utilities and APIs, and is useful both inside and outside of the client.

Many APIs are present in the client without loading altspace.js, but please still include it, as this may change in the future.

The version baked into the altspace.js script will determine which version of the entire SDK the client will provide your app. This means that if we make any breaking internal changes to things like rendering or cursor events, and you are using an older version of altspace.js, we will try to return legacy behavior appropriate to your version of altspace.js. Versioning will follow SEMVER as closely as possible. Details for each version can be found in the Release Notes.

-

Latest Version: v2.7.2 -- See Changes

+

Latest Version: v2.7.3 -- See Changes

Include the latest version of the SDK in your app with:

-

<script src="https://sdk.altvr.com/libs/altspace.js/2.7.2/altspace.min.js"></script>

+

<script src="https://sdk.altvr.com/libs/altspace.js/2.7.3/altspace.min.js"></script>

If you use npm, you can install altspace.js with:

npm install altspace

SDK Feature Overview

diff --git a/doc/js/index.html b/doc/js/index.html index 3fe95612..36cc5766 100644 --- a/doc/js/index.html +++ b/doc/js/index.html @@ -85,7 +85,7 @@

Quick Start

This is a fully functional example of what Three.js code <html lang=en> <head> <script src="https://cdn.rawgit.com/mrdoob/three.js/r84/build/three.js"></script> - <script src="https://sdk.altvr.com/libs/altspace.js/2.7.2/altspace.min.js"></script> + <script src="https://sdk.altvr.com/libs/altspace.js/2.7.3/altspace.min.js"></script> </head> <body> <script> diff --git a/package.json b/package.json index 44097e96..a2a246fe 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "altspace", "author": "AltspaceVR", - "version": "2.7.2", + "version": "2.7.3", "repository": { "type": "git", "url": "git+https://github.com/AltspaceVR/AltspaceSDK.git"