Last active
August 30, 2017 05:06
-
-
Save trusktr/3248affba4a01a7ebf15f3cb0e68f18c to your computer and use it in GitHub Desktop.
babel/minify issue 681
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var infamous=function(t){'use strict';function r(t){return 2===t.length?t[0]*t[0]+t[1]*t[1]:t[0]*t[0]+t[1]*t[1]+t[2]*t[2]}function n(t){return st(r(t))}function o(t){return 0>t?-1:1}function a(t){this.method=t,this._instances=[],this.state=[]}function l(t){this.options=Object.create(l.DEFAULT_OPTIONS),t&&this.setOptions(t),this._startTime=0,this._startValue=0,this._updateTime=0,this._endValue=0,this._curve=void 0,this._duration=0,this._active=!1,this._callback=void 0,this.state=0,this.velocity=void 0}function s(r,n,o){return(1-o)*r+o*n}function d(t){return t instanceof Object?t instanceof Array?t.slice(0):Object.create(t):t}function p(t,r){var n={curve:r.curve};return r.duration&&(n.duration=r.duration),r.speed&&(n.speed=r.speed),t instanceof Object&&(void 0!==t.duration&&(n.duration=t.duration),t.curve&&(n.curve=t.curve),t.speed&&(n.speed=t.speed)),'string'==typeof n.curve&&(n.curve=l.getCurve(n.curve)),n}function c(r,n,o,a,l){var t=1e-7,s=(o(l)-o(l-t))/t,d;if(r instanceof Array){d=[];for(var p=0;p<r.length;p++)d[p]='number'==typeof r[p]?s*(r[p]-n[p])/a:0}else d=s*(r-n)/a;return d}function u(r,n,o){var t;if(r instanceof Array){t=[];for(var a=0;a<r.length;a++)t[a]='number'==typeof r[a]?s(r[a],n[a],o):r[a]}else t=s(r,n,o);return t}function m(t){this.currentAction=null,this.actionQueue=[],this.callbackQueue=[],this.state=0,this.velocity=void 0,this._callback=void 0,this._engineInstance=null,this._currentMethod=null,this.set(t)}function y(){if(this._callback){var t=this._callback;this._callback=void 0,t()}if(0>=this.actionQueue.length)return void this.set(this.get());this.currentAction=this.actionQueue.shift(),this._callback=this.callbackQueue.shift();var r=null,n=this.currentAction[0],o=this.currentAction[1];o instanceof Object&&o.method?(r=o.method,'string'==typeof r&&(r=vt[r])):r=ht,this._currentMethod!==r&&(this._engineInstance=!(n instanceof Object)||!0===r.SUPPORTS_MULTIPLE||n.length<=r.SUPPORTS_MULTIPLE?new r:new yt(r),this._currentMethod=r),this._engineInstance.reset(this.state,this.velocity),void 0!==this.velocity&&(o.velocity=this.velocity),this._engineInstance.set(n,o,y.bind(this))}function h(t){var r=this;this._final=ut.identity.slice(),this._finalTranslate=[0,0,0],this._finalRotate=[0,0,0],this._finalSkew=[0,0,0],this._finalScale=[1,1,1],this.translate=[],this.rotate=[],this.skew=[],this.scale=[];for(var n=0;3>n;n+=1)r.translate[n]=new bt(r._finalTranslate[n]),r.rotate[n]=new bt(r._finalRotate[n]),r.skew[n]=new bt(r._finalSkew[n]),r.scale[n]=new bt(r._finalScale[n]);t&&this.set(t)}function v(){return ut.build({translate:[this.translate[0].get(),this.translate[1].get(),this.translate[2].get()],rotate:[this.rotate[0].get(),this.rotate[1].get(),this.rotate[2].get()],skew:[this.skew[0].get(),this.skew[1].get(),this.skew[2].get()],scale:[this.scale[0].get(),this.scale[1].get(),this.scale[2].get()]})}function x(){return ut.build({translate:this._finalTranslate,rotate:this._finalRotate,skew:this._finalSkew,scale:this._finalScale})}function S(t,r){for(var n=0,o=0;o<t.length;o+=1)typeof t[o]==r+''&&(n+=1);return n}function C(t){this._transformGetter=null,this._opacityGetter=null,this._originGetter=null,this._alignGetter=null,this._sizeGetter=null,this._proportionGetter=null,this._legacyStates={},this._output={transform:ut.identity,opacity:1,origin:null,align:null,size:null,proportions:null,target:null},t&&(t.transform&&this.transformFrom(t.transform),void 0!==t.opacity&&this.opacityFrom(t.opacity),t.origin&&this.originFrom(t.origin),t.align&&this.alignFrom(t.align),t.size&&this.sizeFrom(t.size),t.proportions&&this.proportionsFrom(t.proportions))}function k(){this._transformGetter&&(this._output.transform=this._transformGetter()),this._opacityGetter&&(this._output.opacity=this._opacityGetter()),this._originGetter&&(this._output.origin=this._originGetter()),this._alignGetter&&(this._output.align=this._alignGetter()),this._sizeGetter&&(this._output.size=this._sizeGetter()),this._proportionGetter&&(this._output.proportions=this._proportionGetter())}function T(t,r){Tt[t]=r}function P(){this.result={}}function R(t,r){return[t[0]*r[0]+t[1]*r[4]+t[2]*r[8],t[0]*r[1]+t[1]*r[5]+t[2]*r[9],t[0]*r[2]+t[1]*r[6]+t[2]*r[10]]}function E(t){this._object=null,this._child=null,this._hasMultipleChildren=!1,this._isRenderable=!1,this._isModifier=!1,this._resultCache={},this._prevResults={},this._childResult=null,t&&this.set(t)}function w(t,r,n){for(var o=Et.parse(t,r),a=Object.keys(o),l=0;l<a.length;l++){var i=a[l],s=Pt.get(i),d=o[i];d.allocator=r.allocator;var p=s.commit(d);p?w(p,r,n):n[i]=d}}function A(){this.listeners={},this._owner=this}function O(){At.apply(this,arguments),this.downstream=[],this.downstreamFn=[],this.upstream=[],this.upstreamListeners={}}function M(t){t||(t=document.createDocumentFragment()),this.container=t,this.detachedNodes={},this.nodeCount=0}function L(){var t=this.container;return[t.clientWidth,t.clientHeight]}function z(t){this.container=t,this._allocator=new Mt(t),this._node=new wt,this._eventOutput=new Ot,this._size=L.call(this),this._perspectiveState=new bt(0),this._perspective=void 0,this._nodeContext={allocator:this._allocator,transform:ut.identity,opacity:1,origin:Lt,align:Lt,size:this._size},this._eventOutput.on('resize',function(){this.setSize(L.call(this))}.bind(this))}function F(t){this._value=t,this.eventOutput=null}function N(){this.eventOutput=new Ot,this.eventOutput.bindThis(this),Ot.setOutputHandler(this,this.eventOutput)}function U(){Xt.runLoop?(Ut.step(),window.requestAnimationFrame(U)):Ht=!1}function D(){for(var t=0;t<Dt.length;t++)Dt[t].emit('resize');Yt.emit('resize')}function I(){window.addEventListener('touchmove',function(t){t.preventDefault()},!0),G()}function G(){return document.body?void(document.body.classList.add('famous-root'),document.documentElement.classList.add('famous-root')):void Ut.nextTick(G)}function V(t,r){return document.body?void document.body.addEventListener(t,r):void Ut.nextTick(addEventListener.bind(this,t,r))}function B(t,r){return document.body?void(document.body.appendChild(r),t.emit('resize')):void Ut.nextTick(B.bind(this,t,r))}function j(t){for(var r=[],n=arguments.length-1;0<n--;)r[n]=arguments[n+1];r.forEach(function(r){for(var n in r)t[n]=r[n]})}function H(t){return t&&t.__esModule?t['default']:t}function W(t,r){return r={exports:{}},t(r,r.exports),r.exports}function Y(t){this._matrix=null,this._opacity=1,this._origin=null,this._size=null,this._eventOutput=new Ot,this._eventOutput.bindThis(this),this.eventForwarder=function(t){this._eventOutput.emit(t.type,t)}.bind(this),this.id=Pt.register(this),this._element=null,this._sizeDirty=!1,this._originDirty=!1,this._transformDirty=!1,this._invisible=!1,t&&this.attach(t)}function X(t){var r=this;for(var n in r._eventOutput.listeners)t.addEventListener(n,r.eventForwarder)}function q(t){var r=this;for(var n in r._eventOutput.listeners)t.removeEventListener(n,r.eventForwarder)}function Z(t){t[12]=rt(t[12]*or)/or,t[13]=rt(t[13]*or)/or;for(var r='matrix3d(',n=0;15>n;n++)r+=1e-6>t[n]&&-1e-6<t[n]?'0,':t[n]+',';return r+=t[15]+')',r}function K(t){return 100*t[0]+'% '+100*t[1]+'%'}function $(t,r){return t&&r?t[0]!==r[0]||t[1]!==r[1]:t!==r}function Q(t){sr.call(this),this.options={},this.properties={},this.attributes={},this.content='',this.classList=[],this.size=null,this._classesDirty=!0,this._stylesDirty=!0,this._attributesDirty=!0,this._sizeDirty=!0,this._contentDirty=!0,this._trueSizeCheck=!0,this._dirtyClasses=[],t&&this.setOptions(t),this._currentTarget=null}function J(t){for(var r=this,n=0;n<this._dirtyClasses.length;n++)t.classList.remove(r._dirtyClasses[n]);this._dirtyClasses=[]}function ee(t){var r=this;for(var o in r.properties)t.style[o]=r.properties[o]}function te(t){var r=this;for(var o in r.properties)t.style[o]=''}function re(t){var r=this;for(var o in r.attributes)t.setAttribute(o,r.attributes[o])}function ne(t){var r=this;for(var o in r.attributes)t.removeAttribute(o)}function oe(t,r){return t&&r?t[0]!==r[0]||t[1]!==r[1]:t!==r}function ae(t,r,n){return{x:t.clientX,y:t.clientY,identifier:t.identifier,origin:r.origin,timestamp:$r(),count:r.touches.length,history:n}}function ie(t){var r=this;if(!(t.touches.length>this.touchLimit)){this.isTouched=!0;for(var n=0;n<t.changedTouches.length;n++){var o=t.changedTouches[n],a=ae(o,t,null);r.eventOutput.emit('trackstart',a),r.selective||r.touchHistory[o.identifier]||r.track(a)}}}function le(t){var r=this;if(!(t.touches.length>this.touchLimit))for(var n=0;n<t.changedTouches.length;n++){var o=t.changedTouches[n],a=r.touchHistory[o.identifier];if(a){var i=ae(o,t,a);r.touchHistory[o.identifier].push(i),r.eventOutput.emit('trackmove',i)}}}function se(t){var r=this;if(this.isTouched){for(var n=0;n<t.changedTouches.length;n++){var o=t.changedTouches[n],a=r.touchHistory[o.identifier];if(a){var i=ae(o,t,a);r.eventOutput.emit('trackend',i),delete r.touchHistory[o.identifier]}}this.isTouched=!1}}function de(){var t=this;for(var r in t.touchHistory){var n=t.touchHistory[r];t.eventOutput.emit('trackend',{touch:n[n.length-1].touch,timestamp:Date.now(),count:0,history:n}),delete t.touchHistory[r]}}function pe(t){this.selective=t.selective,this.touchLimit=t.touchLimit||1,this.touchHistory={},this.eventInput=new Ot,this.eventOutput=new Ot,Ot.setInputHandler(this,this.eventInput),Ot.setOutputHandler(this,this.eventOutput),this.eventInput.on('touchstart',ie.bind(this)),this.eventInput.on('touchmove',le.bind(this)),this.eventInput.on('touchend',se.bind(this)),this.eventInput.on('touchcancel',se.bind(this)),this.eventInput.on('unpipe',de.bind(this)),this.isTouched=!1}function ce(t){this.options=Object.create(ce.DEFAULT_OPTIONS),this._optionsManager=new Nt(this.options),t&&this.setOptions(t),this._eventOutput=new Ot,this._touchTracker=new Qr({touchLimit:this.options.touchLimit}),Ot.setOutputHandler(this,this._eventOutput),Ot.setInputHandler(this,this._touchTracker),this._touchTracker.on('trackstart',_e.bind(this)),this._touchTracker.on('trackmove',ue.bind(this)),this._touchTracker.on('trackend',me.bind(this)),this._payload={delta:null,position:null,velocity:null,clientX:void 0,clientY:void 0,count:0,touch:void 0},this._position=null}function _e(t){var r,n;void 0===this.options.direction?(this._position=[0,0],r=[0,0],n=[0,0]):(this._position=0,r=0,n=0);var o=this._payload;o.delta=n,o.position=this._position,o.velocity=r,o.clientX=t.x,o.clientY=t.y,o.count=t.count,o.touch=t.identifier,this._eventOutput.emit('start',o)}function ue(t){var r=t.history,n=r[r.length-1],o=r[r.length-2],a=r[r.length-this.options.velocitySampleLength]?r[r.length-this.options.velocitySampleLength]:r[r.length-2],i=a.timestamp,l=n.timestamp,s=n.x-o.x,d=n.y-o.y,p=n.x-a.x,c=n.y-a.y;this.options.rails&&(it(s)>it(d)?d=0:s=0,it(p)>it(c)?c=0:p=0);var _=tt(l-i,Jr),u=p/_,m=c/_,g=this.options.scale,y,f;this.options.direction===ce.DIRECTION_X?(f=g*s,y=g*u,this._position+=f):this.options.direction===ce.DIRECTION_Y?(f=g*d,y=g*m,this._position+=f):(f=[g*s,g*d],y=[g*u,g*m],this._position[0]+=f[0],this._position[1]+=f[1]);var h=this._payload;h.delta=f,h.velocity=y,h.position=this._position,h.clientX=t.x,h.clientY=t.y,h.count=t.count,h.touch=t.identifier,this._eventOutput.emit('update',h)}function me(t){this._payload.count=t.count,this._eventOutput.emit('end',this._payload)}function ge(t,r){this._eventInput=new Ot,this._eventOutput=new Ot,Ot.setInputHandler(this,this._eventInput),Ot.setOutputHandler(this,this._eventOutput),this._syncs={},t&&this.addSync(t),r&&this.setOptions(r)}function ye(t,r){en[t]&&(this._syncs[t]=new en[t](r),this.pipeSync(t))}function fe(t,r,n){an[0]=t.m11*r.m11+t.m21*r.m12+t.m31*r.m13+t.m41*r.m14,an[4]=t.m11*r.m21+t.m21*r.m22+t.m31*r.m23+t.m41*r.m24,an[8]=t.m11*r.m31+t.m21*r.m32+t.m31*r.m33+t.m41*r.m34,an[12]=t.m11*r.m41+t.m21*r.m42+t.m31*r.m43+t.m41*r.m44,an[1]=t.m12*r.m11+t.m22*r.m12+t.m32*r.m13+t.m42*r.m14,an[5]=t.m12*r.m21+t.m22*r.m22+t.m32*r.m23+t.m42*r.m24,an[9]=t.m12*r.m31+t.m22*r.m32+t.m32*r.m33+t.m42*r.m34,an[13]=t.m12*r.m41+t.m22*r.m42+t.m32*r.m43+t.m42*r.m44,an[2]=t.m13*r.m11+t.m23*r.m12+t.m33*r.m13+t.m43*r.m14,an[6]=t.m13*r.m21+t.m23*r.m22+t.m33*r.m23+t.m43*r.m24,an[10]=t.m13*r.m31+t.m23*r.m32+t.m33*r.m33+t.m43*r.m34,an[14]=t.m13*r.m41+t.m23*r.m42+t.m33*r.m43+t.m43*r.m44,an[3]=t.m14*r.m11+t.m24*r.m12+t.m34*r.m13+t.m44*r.m14,an[7]=t.m14*r.m21+t.m24*r.m22+t.m34*r.m23+t.m44*r.m24,an[11]=t.m14*r.m31+t.m24*r.m32+t.m34*r.m33+t.m44*r.m34,an[15]=t.m14*r.m41+t.m24*r.m42+t.m34*r.m43+t.m44*r.m44,he(an,n)}function he(t,r){var n=t.length;6===n?(r.m11=t[0],r.m12=t[1],r.m21=t[2],r.m22=t[3],r.m41=t[4],r.m42=t[5]):16===n&&(r.m11=t[0],r.m12=t[1],r.m13=t[2],r.m14=t[3],r.m21=t[4],r.m22=t[5],r.m23=t[6],r.m24=t[7],r.m31=t[8],r.m32=t[9],r.m33=t[10],r.m34=t[11],r.m41=t[12],r.m42=t[13],r.m43=t[14],r.m44=t[15])}function ve(t,r,n,o){var a=pt,i=ct,l=ot,s=be(o/2);return[1-2*(r*r+n*n)*l(a(s),2),2*(t*r*l(a(s),2)+n*a(s)*i(s)),2*(t*n*l(a(s),2)-r*a(s)*i(s)),0,2*(t*r*l(a(s),2)-n*a(s)*i(s)),1-2*(t*t+n*n)*l(a(s),2),2*(r*n*l(a(s),2)+t*a(s)*i(s)),0,2*(t*n*l(a(s),2)+r*a(s)*i(s)),2*(r*n*l(a(s),2)-t*a(s)*i(s)),1-2*(t*t+r*r)*l(a(s),2),0,0,0,0,1]}function be(t){return at/180*t}function xe(){sn||(sn=function(){function t(t){if(void 0===t&&(t=[]),!(this instanceof dn))throw new TypeError('DOMMatrixReadOnly can\'t be instantiated directly. Use DOMMatrix instead.');var r=t.length;if(void 0===r||6!==r&&16!==r)throw new TypeError('DOMMatrix constructor argument "numberSequence" must be an array-like with 6 or 16 numbers.');this._matrix=new Float64Array(ln),this._isIdentity=!0,this._is2D=6===r,he(t,this)}var r={is2D:{},isIdentity:{},a:{},b:{},c:{},d:{},e:{},f:{},m11:{},m12:{},m13:{},m14:{},m21:{},m22:{},m23:{},m24:{},m31:{},m32:{},m33:{},m34:{},m41:{},m42:{},m43:{},m44:{}};return t.prototype.translate=function(t,r,n){return void 0===n&&(n=0),new dn(this).translateSelf(t,r,n)},t.prototype.scale=function(t,r,n){return void 0===r&&(r=0),void 0===n&&(n=0),new dn(this).scaleSelf(t,r,n)},t.prototype.scale3d=function(t,r,n,o){return void 0===r&&(r=0),void 0===n&&(n=0),void 0===o&&(o=0),new dn(this).scale3dSelf(t,r,n,o)},t.prototype.scaleNonUniform=function(t,r,n,o,a,i){return void 0===r&&(r=1),void 0===n&&(n=1),void 0===o&&(o=0),void 0===a&&(a=0),void 0===i&&(i=0),new dn(this).scaleNonUniformSelf(t,r,n,o,a,i)},t.prototype.rotate=function(t,r,n){return void 0===r&&(r=0),void 0===n&&(n=0),new dn(this).rotateSelf(t,r,n)},t.prototype.rotateFromVector=function(){throw new Error('rotateFromVector is not implemented yet.')},t.prototype.rotateAxisAngle=function(t,r,n,o){return new dn(this).rotateAxisAngleSelf(t,r,n,o)},t.prototype.skewX=function(){throw new Error('skewX is not implemented yet.')},t.prototype.skewY=function(){throw new Error('skewY is not implemented yet.')},t.prototype.multiply=function(t){return new dn(this).multiplySelf(t)},t.prototype.flipX=function(){throw new Error('flipX is not implemented yet.')},t.prototype.flipY=function(){throw new Error('flipY is not implemented yet.')},t.prototype.inverse=function(){throw new Error('inverse is not implemented yet.')},t.prototype.transformPoint=function(){throw new Error('transformPoint is not implemented yet.')},t.prototype.toFloat32Array=function(){return Float32Array.from(this._matrix)},t.prototype.toFloat64Array=function(){return Float64Array.from(this._matrix)},r.is2D.get=function(){return this._is2D},r.isIdentity.get=function(){for(var t=this,r=0,n=this._matrix.length;r<n;r+=1)if(t._matrix[r]!=ln[r])return t._isIdentity=!1;return this._isIdentity=!0},r.a.get=function(){return this.m11},r.b.get=function(){return this.m12},r.c.get=function(){return this.m21},r.d.get=function(){return this.m22},r.e.get=function(){return this.m41},r.f.get=function(){return this.m42},r.m11.get=function(){return this._matrix[0]},r.m12.get=function(){return this._matrix[4]},r.m13.get=function(){return this._matrix[8]},r.m14.get=function(){return this._matrix[12]},r.m21.get=function(){return this._matrix[1]},r.m22.get=function(){return this._matrix[5]},r.m23.get=function(){return this._matrix[9]},r.m24.get=function(){return this._matrix[13]},r.m31.get=function(){return this._matrix[2]},r.m32.get=function(){return this._matrix[6]},r.m33.get=function(){return this._matrix[10]},r.m34.get=function(){return this._matrix[14]},r.m41.get=function(){return this._matrix[3]},r.m42.get=function(){return this._matrix[7]},r.m43.get=function(){return this._matrix[11]},r.m44.get=function(){return this._matrix[15]},Object.defineProperties(t.prototype,r),t}())}function Se(t){return'object'==typeof t&&'x'in t&&'y'in t&&'z'in t&&'w'in t}function Ce(t){for(var r=Object.getOwnPropertyNames(t),n=r.length,o=0;o<n;o+=1){var a=r[o],i=a.toLowerCase();if(i!=a){var l=Object.getOwnPropertyDescriptor(t,a);'undefined'!=typeof l.set&&Object.defineProperty(t,i,l)}}}function ke(t,r,n){return vn||(vn=new Map),bn||(bn=Te()),vn.set(t,{onConnect:r,onDisconnect:n}),bn.observe(t,{childList:!0}),!0}function Te(){return new MutationObserver(function(t){for(var r=new Map,n=0,o=t.length,a;n<o;n+=1)if(a=t[n],'childList'==a.type){r.has(a.target)||r.set(a.target,new Map);for(var i=r.get(a.target),l=a.addedNodes,s=l.length,d=0;d<s;d+=1)i.set(l[d],(i.get(l[d])||0)+1);for(var p=a.removedNodes,c=p.length,_=0;_<c;_+=1)i.set(p[_],(i.get(p[_])||0)-1)}for(var u=0,m=r;u<m.length;u+=1)for(var g=m[u],y=g[0],f=g[1],h=vn.get(y),v=h.onConnect,x=h.onDisconnect,S=0,C=f;S<C.length;S+=1){var k=C[S],T=k[0],P=k[1];0<P&&'function'==typeof v?v.call(y,T):0>P&&'function'==typeof x&&x.call(y,T)}})}function Pe(t){for(var r=t;r&&!(r instanceof ShadowRoot);)r=r.parentNode;return r}function Re(t,r){console.log(r?'distributedNode:':'node:',t);for(var n=t.children,o=n.length,a=0;a<o;a+=1)n[a]._elementManager.element._isPossiblyDistributed||Re(n[a]);var i=t._elementManager.element._shadowChildren;if(i)for(var l=i.length,s=0;s<l;s+=1)Re(i[s].imperativeCounterpart,!0)}function Ee(t,r){var n=Ae('100%','100%'),o=ze(n,r);return o&&(_i.has(t)&&we(t),t.appendChild(n),_i.set(t,o)),o}function we(t){var r=_i.get(t);t.removeChild(r.canvas)}function Ae(t,r){var n=document.createElement('canvas');return Oe(n,t,r),n}function Oe(t,r,n){t.style.width=r,t.style.height=n}function Me(t,r,n){Le(t.canvas,r,n),t.viewport(0,0,r,n)}function Le(t,r,n){t.width=r,t.height=n}function ze(t,r){var n;if(t instanceof HTMLCanvasElement&&(n=t),n||(n=document.querySelector(t)),!(n instanceof HTMLCanvasElement))return!1;if(1==r||void 0==r)r='';else if(2==r)r='2';else throw new Error('Invalid WebGL version.');return n.getContext('webgl'+r)}function Fe(t,r,n){var o=t.createShader(r);t.shaderSource(o,n),t.compileShader(o);var a=t.getShaderParameter(o,t.COMPILE_STATUS);if(a)return o;var i=new Error('*** Error compiling shader \''+o+'\':'+t.getShaderInfoLog(o));throw t.deleteShader(o),i}function Ne(t,r,n){var o=t.createProgram();t.attachShader(o,r),t.attachShader(o,n),t.linkProgram(o);var a=t.getProgramParameter(o,t.LINK_STATUS);return a?o:void(console.log(' --- Error making program. GL Program Info Log:',t.getProgramInfoLog(o)),t.deleteProgram(o))}function Ue(t){return t*at/180}function De(){return Ti?Ti:Ti=new ki}function Ie(t){return'number'!=typeof t||Object.is(t,NaN)||Object.is(t,Infinity)?!1:!0}function Ge(t){return!!t&&(t===HTMLElement||Ge(t.prototype.__proto__?t.prototype.__proto__.constructor:null))}function Ve(t){if(t||(t=HTMLElement),!Ge(t))throw new TypeError('The argument to WebComponentMixin must be a constructor that extends from or is HTMLElement.');if(Ii.has(t))return Ii.get(t);var r=function(t){function r(){if(t.call(this),'registerElement'in document&&!('customElements'in window))throw new Error('\n You cannot instantiate this class directly without first registering it\n with `document.registerElement(...)`. See an example at http://....\n ');if(!('registerElement'in document)&&!('customElements'in window))throw new Error('\n Your browser does not support the Custom Elements API. You\'ll\n need to install a polyfill. See how at http://....\n ');this.createdCallback()}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype.createdCallback=function(){this._attached=!1,this._initialized=!1,this._initialAttributeChange=!1,this._childObserver=null,this._style=null},r.prototype.childConnectedCallback=function(){},r.prototype.childDisconnectedCallback=function(){},r.prototype.connectedCallback=function(){t.prototype.connectedCallback&&t.prototype.connectedCallback.call(this),this._attached=!0,this._initialized||(this.init(),this._initialized=!0)},r.prototype.attachedCallback=function(){this.connectedCallback()},r.prototype._createStyles=function(){var t=Kr.createRule(this.getStyles());return t.applyTo(this),t},r.prototype.disconnectedCallback=function(){var r=this;t.prototype.disconnectedCallback&&t.prototype.disconnectedCallback.call(this),this._attached=!1,Promise.resolve().then(function(){!r._attached&&r._initialized&&r.deinit()})},r.prototype.detachedCallback=function(){this.disconnectedCallback()},r.prototype.getStyles=function(){return{}},r.prototype.init=function(){var t=this;if(this._style||(this._style=this._createStyles()),!this._childObserver){var r=this.childNodes;r.length&&setTimeout(function(){for(var n=r.length,o=0;o<n;o+=1)t.childConnectedCallback(r[o])},5),this._childObserver=ke(this,this.childConnectedCallback,this.childDisconnectedCallback)}if(!this._initialAttributeChange&&this.hasAttributes())for(var n=this,o=n.attributes,a=o.length,l=0;l<a;l+=1)t.attributeChangedCallback(o[l].name,null,o[l].value)},r.prototype.attributeChangedCallback=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];t.prototype.attributeChangedCallback&&t.prototype.attributeChangedCallback.apply(this,r),this._initialAttributeChange=!0},r.prototype.deinit=function(){this._initialized=!1},r}(t);return Ii.set(t,r),r}function Be(t){He(t);var r=t.trim().split(/(?:\s*,\s*)|(?:\s+)/g),n=r.length;return 0<n&&(r[0]=window.parseFloat(r[0])),1<n&&(r[1]=window.parseFloat(r[1])),2<n&&(r[2]=window.parseFloat(r[2])),r}function je(t){We(t);var r=t.trim().toLowerCase().split(/(?:\s*,\s*)|(?:\s+)/g),n=r.length;return 0<n&&(r[0]=r[0]),1<n&&(r[1]=r[1]),2<n&&(r[2]=r[2]),r}function He(t){if(!t.match(/^\s*(((\s*(-|\+)?((\.\d+)|(\d+\.\d+)|(\d+)|(\d+(\.\d+)?e(-|\+)?(\d+)))\s*,){0,2}(\s*(-|\+)?((\.\d+)|(\d+\.\d+)|(\d+)|(\d+(\.\d+)?e(-|\+)?(\d+)))))|((\s*(-|\+)?((\.\d+)|(\d+\.\d+)|(\d+)|(\d+(\.\d+)?e(-|\+)?(\d+)))\s){0,2}(\s*(-|\+)?((\.\d+)|(\d+\.\d+)|(\d+)|(\d+(\.\d+)?e(-|\+)?(\d+))))))\s*$/g))throw new Error('Attribute must be a comma- or space-separated sequence of up to three numbers, for example "1 2.5 3". Yours was "'+t+'".')}function We(t){if(!t.match(/^\s*(((\s*([a-zA-Z]+)\s*,){0,2}(\s*([a-zA-Z]+)))|((\s*([a-zA-Z]+)\s*){1,3}))\s*$/g))throw new Error('Attribute must be a comma- or space-separated sequence of up to three strings, for example "absolute absolute". Yours was "'+t+'".')}function Ye(t){return function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var o=this.shadowRoot,a=null;try{a=t.call.apply(t,[this].concat(r))}catch(t){throw t}if(this instanceof Bi){this._hasShadowRoot=!0,o&&Ze.call(this,o);var s=ke(a,Xe.bind(this),qe.bind(this));Vi.set(a,s);for(var d=this,p=d.children,c=p.length,l=0;l<c;l+=1)p[l]instanceof Bi&&(p[l]._isPossiblyDistributed=!0)}return a}}function Xe(t){t instanceof Bi?this.imperativeCounterpart.addChild(t.imperativeCounterpart):xn&&t instanceof HTMLContentElement||Sn&&t instanceof HTMLSlotElement&&(t.addEventListener('slotchange',this),this._handleDistributedChildren(t))}function qe(t){t instanceof Bi?this.imperativeCounterpart.removeChild(t.imperativeCounterpart):xn&&t instanceof HTMLContentElement||Sn&&t instanceof HTMLSlotElement&&(t.removeEventListener('slotchange',this),this._handleDistributedChildren(t),this._slotElementsAssignedNodes.delete(t))}function Ze(t){var r=this;Vi.get(t).disconnect(),Vi.delete(t);for(var n=t.childNodes,o=n.length,a=0,i;a<o;a+=1)(i=n[a],!!(i instanceof Bi))&&r.imperativeCounterpart.removeChild(i.imperativeCounterpart,!0)}function Ke(){Bi||(Bi=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype.createdCallback=function(){var r=this;t.prototype.createdCallback.call(this),this.imperativeCounterpart=null,this._hasShadowRoot=!1,this._isPossiblyDistributed=!1,this._slotElementsAssignedNodes=new WeakMap,this._shadowParent=null,this._shadowChildren=null,this._imperativeCounterpartPromise=Promise.resolve().then(function(){return r._associateImperativeNode()}),this.mountPromise=this._imperativeCounterpartPromise.then(function(){return r.imperativeCounterpart.mountPromise})},r.prototype._associateImperativeNode=function(t){this.imperativeCounterpart||(t?this.imperativeCounterpart=t:this.imperativeCounterpart=this._makeImperativeCounterpart())},r.prototype._makeImperativeCounterpart=function(){throw new TypeError('This method should be implemented by classes extending DeclarativeBase.')},r.prototype.childConnectedCallback=function(t){if(t instanceof Gi){if(this._hasShadowRoot&&(t._isPossiblyDistributed=!0),t.imperativeCounterpart._parent)return;this.imperativeCounterpart.addChild(t.imperativeCounterpart)}else if(xn&&t instanceof HTMLContentElement&&Pe(this));else Sn&&t instanceof HTMLSlotElement&&Pe(this)&&(t.addEventListener('slotchange',this),this._handleDistributedChildren(t))},r.prototype.handleEvent=function(t){if('slotchange'==t.type){var r=t.target;this._handleDistributedChildren(r)}},r.prototype._handleDistributedChildren=function(t){for(var n=this,o=this._getDistributedChildDifference(t),a=o.added,s=a.length,l=0,i;l<s;l+=1)if(i=a[l],!!(i instanceof r)){var d=i._shadowParent;if(d&&d._shadowChildren){var p=d._shadowChildren;p.splice(p.indexOf(i),1),p.length||(d._shadowChildren=null)}i._shadowParent=n,n._shadowChildren||(n._shadowChildren=[]),n._shadowChildren.add(i)}for(var c=o.removed,_=c.length,u=0,m;u<_;u+=1)(m=c[u],!!(m instanceof r))&&(m._shadowParent=null,n._shadowChildren.delete(m),n._shadowChildren.size||(n._shadowChildren=null))},r.prototype._getDistributedChildDifference=function(t){var r=this._slotElementsAssignedNodes.has(t)?this._slotElementsAssignedNodes.get(t):[];var n=t.assignedNodes({flatten:!0});this._slotElementsAssignedNodes.set(t,n);for(var o={removed:[]},a=0,i=r.length;a<i;a+=1){var l=r[a],s=n.indexOf(l);0<=s?n.splice(a,1):o.removed.push(l)}return o.added=n,o},r.prototype.childDisconnectedCallback=function(t){if(t instanceof Gi){if(t._isPossiblyDistributed=!1,!t.imperativeCounterpart._parent)return;this.imperativeCounterpart.removeChild(t.imperativeCounterpart)}else if(xn&&t instanceof HTMLContentElement&&Pe(this));else Sn&&t instanceof HTMLSlotElement&&Pe(this)&&(t.removeEventListener('slotchange',this),this._handleDistributedChildren(t),this._slotElementsAssignedNodes.delete(t))},r.prototype.setAttribute=function(r,n){t.prototype.setAttribute.call(this,r,n)},r}(Ve(window.HTMLElement)))}function $e(t,r){for(var n=['constructor','parent','children','element','scene','addChild','addChildren','removeChild','removeChildren'],o=Object.getOwnPropertyNames(t.prototype),a=function(a,l){var i=o[l];if(!(0<=n.indexOf(i)||0==i.indexOf('_')||r.prototype.hasOwnProperty(i))){var s={},d=Object.getOwnPropertyDescriptor(t.prototype,i);d.set&&Object.assign(s,{set:function(t){this.imperativeCounterpart[i]=t}}),d.get&&Object.assign(s,{get:function(){return this.imperativeCounterpart[i]}}),Object.defineProperty(r.prototype,i,s)}},s=o.length,l=0;l<s;l+=1)a(s,l)}function Qe(){if(!$i){var t=Symbol('instanceofSymbol'),r=function(r){var n=r,o=function(t){function r(r){var n=this;void 0===r&&(r={});var o=r._motorHtmlCounterpart;t.call(this,r),this._willBeRendered=!1,this._elementManager=new Ji(o||this._makeElement()),this._elementManager.element._associateImperativeNode(this),this._mounted=!1,this._mountPromise=null,this._resolveMountPromise=null,this._rejectMountPromise=null,this._awaitingMountPromiseToRender=!1,this._waitingForMountConditions=!1,this.on('propertychange',function(t){('sizeMode'==t||'absoluteSize'==t||'proportionalSize'==t)&&n._calcSize(),n._needsToBeRendered()})}t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r;var n={mountPromise:{},element:{}};return r.prototype._makeElement=function(){throw new Error('Subclasses need to override ImperativeBase#_makeElement.')},n.mountPromise.get=function(){var t=this;return this._mountPromise||(this._mountPromise=new Promise(function(r,n){t._resolveMountPromise=r,t._rejectMountPromise=n})),this._mounted?this._mounted&&this._resolveMountPromise():this._waitForMountThenResolveMountPromise(),this._mountPromise},r.prototype._waitForMountThenResolveMountPromise=function(){},n.element.get=function(){return this._elementManager.element},r.prototype.addChild=function(n){if(n instanceof r){if(n instanceof Xi)throw new Error('\n A Scene cannot be added to another Node or Scene (at\n least for now). To place a Scene in a Node, just mount\n a new Scene onto a MotorHTMLNode with Scene.mount().\n ');return t.prototype.addChild.call(this,n),(n._scene||n.scene)&&(n._resolveScenePromise&&n._resolveScenePromise(n._scene),n._giveSceneRefToChildren()),n._calcSize(),n._needsToBeRendered(),this.on('sizechange',n._onParentSizeChange),this._elementManager.connectChildElement(n),this}},r.prototype.removeChild=function(r,n){r instanceof Qi&&(t.prototype.removeChild.call(this,r),this.off('sizechange',r._onParentSizeChange),r._resetSceneRef(),r._mountPromise&&r._rejectMountPromise('mountcancel'),r._mounted&&r._elementManager.shouldNotRender(),r._resetMountPromise(),!n&&this._elementManager.disconnectChildElement(r))},r.prototype._resetMountPromise=function(){this._mounted=!1,this._mountPromise=null,this._resolveMountPromise=null,this._rejectMountPromise=null;for(var t=this._children,r=0,n=t.length;r<n;r+=1)t[r]._resetMountPromise()},r.prototype._needsToBeRendered=function(){var t=this;if(this._awaitingMountPromiseToRender)return Promise.resolve();var r=function(){t._willBeRendered=!0,wi._setNodeToBeRendered(t)};if(!this._mounted){this._awaitingMountPromiseToRender=!0;var n;return this.mountPromise.then(r).catch(function(){'mountcancel'==e||(n=e)}).then(function(){if(t._awaitingMountPromiseToRender=!1,n)throw n})}return r(),Promise.resolve()},r.prototype._getAncestorToBeRendered=function(){for(var t=this._parent;t;){if(t._willBeRendered)return t;t=t._parent}return!1},r.prototype._render=function(){t.prototype._render.call(this),this._elementManager.applyImperativeNodeProperties(this)},Object.defineProperties(r.prototype,n),r}(n),a=Object.getOwnPropertyDescriptor(n.prototype,'properties'),i=a.set;return Object.defineProperties(o.prototype,{properties:{set:function(t){if(void 0===t&&(t={}),i.call(this,t),t.classes){(r=this._elementManager).setClasses.apply(r,t.classes);var r}},configurable:!0}}),Object.defineProperty(o,Symbol.hasInstance,{value:function(r){if(this!==o)return Object.getPrototypeOf(o)[Symbol.hasInstance].call(this,r);for(var n=r,a;n;){if(a=Object.getOwnPropertyDescriptor(n,'constructor'),a&&a.value&&a.value.hasOwnProperty(t))return!0;n=Object.getPrototypeOf(n)}return!1}}),o[t]=!0,o};$i=r(Mi),$i.mixin=r}}var Je=Math.min,et=Math.ceil,tt=Math.max,rt=Math.round,nt=Math.floor,ot=Math.pow,at=Math.PI,it=Math.abs,lt=Math.atan2,st=Math.sqrt,dt=Math.tan,pt=Math.sin,ct=Math.cos,_t={};_t.precision=1e-6,_t.identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],_t.multiply4x4=function(t,r){return[t[0]*r[0]+t[4]*r[1]+t[8]*r[2]+t[12]*r[3],t[1]*r[0]+t[5]*r[1]+t[9]*r[2]+t[13]*r[3],t[2]*r[0]+t[6]*r[1]+t[10]*r[2]+t[14]*r[3],t[3]*r[0]+t[7]*r[1]+t[11]*r[2]+t[15]*r[3],t[0]*r[4]+t[4]*r[5]+t[8]*r[6]+t[12]*r[7],t[1]*r[4]+t[5]*r[5]+t[9]*r[6]+t[13]*r[7],t[2]*r[4]+t[6]*r[5]+t[10]*r[6]+t[14]*r[7],t[3]*r[4]+t[7]*r[5]+t[11]*r[6]+t[15]*r[7],t[0]*r[8]+t[4]*r[9]+t[8]*r[10]+t[12]*r[11],t[1]*r[8]+t[5]*r[9]+t[9]*r[10]+t[13]*r[11],t[2]*r[8]+t[6]*r[9]+t[10]*r[10]+t[14]*r[11],t[3]*r[8]+t[7]*r[9]+t[11]*r[10]+t[15]*r[11],t[0]*r[12]+t[4]*r[13]+t[8]*r[14]+t[12]*r[15],t[1]*r[12]+t[5]*r[13]+t[9]*r[14]+t[13]*r[15],t[2]*r[12]+t[6]*r[13]+t[10]*r[14]+t[14]*r[15],t[3]*r[12]+t[7]*r[13]+t[11]*r[14]+t[15]*r[15]]},_t.multiply=function(t,r){return[t[0]*r[0]+t[4]*r[1]+t[8]*r[2],t[1]*r[0]+t[5]*r[1]+t[9]*r[2],t[2]*r[0]+t[6]*r[1]+t[10]*r[2],0,t[0]*r[4]+t[4]*r[5]+t[8]*r[6],t[1]*r[4]+t[5]*r[5]+t[9]*r[6],t[2]*r[4]+t[6]*r[5]+t[10]*r[6],0,t[0]*r[8]+t[4]*r[9]+t[8]*r[10],t[1]*r[8]+t[5]*r[9]+t[9]*r[10],t[2]*r[8]+t[6]*r[9]+t[10]*r[10],0,t[0]*r[12]+t[4]*r[13]+t[8]*r[14]+t[12],t[1]*r[12]+t[5]*r[13]+t[9]*r[14]+t[13],t[2]*r[12]+t[6]*r[13]+t[10]*r[14]+t[14],1]},_t.thenMove=function(r,n){return n[2]||(n[2]=0),[r[0],r[1],r[2],0,r[4],r[5],r[6],0,r[8],r[9],r[10],0,r[12]+n[0],r[13]+n[1],r[14]+n[2],1]},_t.moveThen=function(t,r){t[2]||(t[2]=0);var n=t[0]*r[0]+t[1]*r[4]+t[2]*r[8],o=t[0]*r[1]+t[1]*r[5]+t[2]*r[9],a=t[0]*r[2]+t[1]*r[6]+t[2]*r[10];return _t.thenMove(r,[n,o,a])},_t.translate=function(t,r,n){return void 0===n&&(n=0),[1,0,0,0,0,1,0,0,0,0,1,0,t,r,n,1]},_t.thenScale=function(t,r){return[r[0]*t[0],r[1]*t[1],r[2]*t[2],0,r[0]*t[4],r[1]*t[5],r[2]*t[6],0,r[0]*t[8],r[1]*t[9],r[2]*t[10],0,r[0]*t[12],r[1]*t[13],r[2]*t[14],1]},_t.scale=function(t,r,n){return void 0===n&&(n=1),void 0===r&&(r=t),[t,0,0,0,0,r,0,0,0,0,n,0,0,0,0,1]},_t.rotateX=function(t){var r=ct(t),n=pt(t);return[1,0,0,0,0,r,n,0,0,-n,r,0,0,0,0,1]},_t.rotateY=function(t){var r=ct(t),n=pt(t);return[r,0,-n,0,0,1,0,0,n,0,r,0,0,0,0,1]},_t.rotateZ=function(t){var r=ct(t),n=pt(t);return[r,n,0,0,-n,r,0,0,0,0,1,0,0,0,0,1]},_t.rotate=function(t,r,n){var o=ct(t),a=pt(t),i=ct(r),l=pt(r),s=ct(n),d=pt(n);return[i*s,o*d+a*l*s,a*d-o*l*s,0,-i*d,o*s-a*l*d,a*s+o*l*d,0,l,-a*i,o*i,0,0,0,0,1]},_t.rotateAxis=function(t,r){var n=pt(r),o=ct(r),a=1-o,i=t[0]*t[0]*a,l=t[0]*t[1]*a,s=t[0]*t[2]*a,d=t[1]*t[1]*a,p=t[1]*t[2]*a,c=t[2]*t[2]*a,_=t[0]*n,u=t[1]*n,m=t[2]*n;return[i+o,l+m,s-u,0,l-m,d+o,p+_,0,s+u,p-_,c+o,0,0,0,0,1]},_t.aboutOrigin=function(t,r){var n=t[0]-(t[0]*r[0]+t[1]*r[4]+t[2]*r[8]),o=t[1]-(t[0]*r[1]+t[1]*r[5]+t[2]*r[9]),a=t[2]-(t[0]*r[2]+t[1]*r[6]+t[2]*r[10]);return _t.thenMove(r,[n,o,a])},_t.skew=function(t,r,n){return[1,dt(r),0,0,dt(n),1,0,0,0,dt(t),1,0,0,0,0,1]},_t.skewX=function(t){return[1,0,0,0,dt(t),1,0,0,0,0,1,0,0,0,0,1]},_t.skewY=function(t){return[1,dt(t),0,0,0,1,0,0,0,0,1,0,0,0,0,1]},_t.perspective=function(t){return[1,0,0,0,0,1,0,0,0,0,1,-1/t,0,0,0,1]},_t.getTranslate=function(t){return[t[12],t[13],t[14]]},_t.inverse=function(t){var r=t[5]*t[10]-t[6]*t[9],n=t[4]*t[10]-t[6]*t[8],o=t[4]*t[9]-t[5]*t[8],a=t[1]*t[10]-t[2]*t[9],i=t[0]*t[10]-t[2]*t[8],l=t[0]*t[9]-t[1]*t[8],s=t[1]*t[6]-t[2]*t[5],d=t[0]*t[6]-t[2]*t[4],p=t[0]*t[5]-t[1]*t[4],c=t[0]*r-t[1]*n+t[2]*o,_=1/c,u=[_*r,-_*a,_*s,0,-_*n,_*i,-_*d,0,_*o,-_*l,_*p,0,0,0,0,1];return u[12]=-t[12]*u[0]-t[13]*u[4]-t[14]*u[8],u[13]=-t[12]*u[1]-t[13]*u[5]-t[14]*u[9],u[14]=-t[12]*u[2]-t[13]*u[6]-t[14]*u[10],u},_t.transpose=function(t){return[t[0],t[4],t[8],t[12],t[1],t[5],t[9],t[13],t[2],t[6],t[10],t[14],t[3],t[7],t[11],t[15]]},_t.interpret=function(t){var a=[t[0],t[1],t[2]],i=o(a[0]),l=n(a),s=[a[0]+i*l,a[1],a[2]],d=2/r(s);if(d>=Infinity)return{translate:_t.getTranslate(t),rotate:[0,0,0],scale:[0,0,0],skew:[0,0,0]};var p=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1];p[0]=1-d*s[0]*s[0],p[5]=1-d*s[1]*s[1],p[10]=1-d*s[2]*s[2],p[1]=-d*s[0]*s[1],p[2]=-d*s[0]*s[2],p[6]=-d*s[1]*s[2],p[4]=p[1],p[8]=p[2],p[9]=p[6];var c=_t.multiply(p,t),_=[c[5],c[6]],u=o(_[0]),m=n(_),g=[_[0]+u*m,_[1]],y=2/r(g),f=[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1];f[5]=1-y*g[0]*g[0],f[10]=1-y*g[1]*g[1],f[6]=-y*g[0]*g[1],f[9]=f[6];var h=_t.multiply(f,p),v=_t.multiply(h,t),x=_t.scale(0>v[0]?-1:1,0>v[5]?-1:1,0>v[10]?-1:1);v=_t.multiply(v,x),h=_t.multiply(x,h);var S={};return S.translate=_t.getTranslate(t),S.rotate=[lt(-h[6],h[10]),Math.asin(h[2]),lt(-h[1],h[0])],S.rotate[0]||(S.rotate[0]=0,S.rotate[2]=lt(h[4],h[5])),S.scale=[v[0],v[5],v[10]],S.skew=[lt(v[9],S.scale[2]),lt(v[8],S.scale[2]),lt(v[4],S.scale[0])],it(S.rotate[0])+it(S.rotate[2])>1.5*at&&(S.rotate[1]=at-S.rotate[1],S.rotate[1]>at&&(S.rotate[1]-=2*at),S.rotate[1]<-at&&(S.rotate[1]+=2*at),0>S.rotate[0]?S.rotate[0]+=at:S.rotate[0]-=at,0>S.rotate[2]?S.rotate[2]+=at:S.rotate[2]-=at),S},_t.average=function(r,n,o){o=void 0===o?0.5:o;for(var t=_t.interpret(r),a=_t.interpret(n),l={translate:[0,0,0],rotate:[0,0,0],scale:[0,0,0],skew:[0,0,0]},s=0;3>s;s++)l.translate[s]=(1-o)*t.translate[s]+o*a.translate[s],l.rotate[s]=(1-o)*t.rotate[s]+o*a.rotate[s],l.scale[s]=(1-o)*t.scale[s]+o*a.scale[s],l.skew[s]=(1-o)*t.skew[s]+o*a.skew[s];return _t.build(l)},_t.build=function(t){var r=_t.scale(t.scale[0],t.scale[1],t.scale[2]),n=_t.skew(t.skew[0],t.skew[1],t.skew[2]),o=_t.rotate(t.rotate[0],t.rotate[1],t.rotate[2]);return _t.thenMove(_t.multiply(_t.multiply(o,n),r),t.translate)},_t.equals=function(t,r){return!_t.notEquals(t,r)},_t.notEquals=function(t,r){return t!==r&&(!(t&&r)||t[12]!==r[12]||t[13]!==r[13]||t[14]!==r[14]||t[0]!==r[0]||t[1]!==r[1]||t[2]!==r[2]||t[4]!==r[4]||t[5]!==r[5]||t[6]!==r[6]||t[8]!==r[8]||t[9]!==r[9]||t[10]!==r[10])},_t.normalizeRotation=function(t){var r=t.slice(0);for((r[0]===0.5*at||r[0]===0.5*-at)&&(r[0]=-r[0],r[1]=at-r[1],r[2]-=at),r[0]>0.5*at&&(r[0]-=at,r[1]=at-r[1],r[2]-=at),r[0]<0.5*-at&&(r[0]+=at,r[1]=-at-r[1],r[2]-=at);r[1]<-at;)r[1]+=2*at;for(;r[1]>=at;)r[1]-=2*at;for(;r[2]<-at;)r[2]+=2*at;for(;r[2]>=at;)r[2]-=2*at;return r},_t.inFront=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0.001,1],_t.behind=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,-0.001,1];var ut=_t,mt={};mt.Direction={X:0,Y:1,Z:2},mt.after=function(t,r){var n=t;return function(){n--,0===n&&r.apply(this,arguments)}},mt.loadURL=function(t,r){var n=new XMLHttpRequest;n.onreadystatechange=function(){4===this.readyState&&r&&r(this.responseText)},n.open('GET',t),n.send()},mt.createDocumentFragmentFromHTML=function(t){var r=document.createElement('div');r.innerHTML=t;for(var n=document.createDocumentFragment();r.hasChildNodes();)n.appendChild(r.firstChild);return n},mt.clone=function(t){var r;if('object'==typeof t){for(var n in r=t instanceof Array?[]:{},t)if('object'!=typeof t[n]||null===t[n])r[n]=t[n];else if(t[n]instanceof Array){r[n]=Array(t[n].length);for(var o=0;o<t[n].length;o++)r[n][o]=mt.clone(t[n][o])}else r[n]=mt.clone(t[n]);}else r=t;return r};var gt=mt;a.SUPPORTS_MULTIPLE=!0,a.prototype.get=function(){for(var t=this,r=0;r<this._instances.length;r++)t.state[r]=t._instances[r].get();return this.state},a.prototype.set=function(t,r,n){for(var o=this,a=gt.after(t.length,n),l=0;l<t.length;l++)o._instances[l]||(o._instances[l]=new o.method),o._instances[l].set(t[l],r,a)},a.prototype.reset=function(t){for(var r=this,n=0;n<t.length;n++)r._instances[n]||(r._instances[n]=new r.method),r._instances[n].reset(t[n])};var yt=a;l.Curves={linear:function(r){return r},easeIn:function(r){return r*r},easeOut:function(r){return r*(2-r)},easeInOut:function(r){return 0.5>=r?2*r*r:-2*r*r+4*r-1},easeOutBounce:function(r){return r*(3-2*r)},spring:function(r){return(1-r)*pt(6*at*r)+r}},l.SUPPORTS_MULTIPLE=!0,l.DEFAULT_OPTIONS={curve:l.Curves.linear,duration:500,speed:0};var ft={};l.registerCurve=function(t,r){return!ft[t]&&(ft[t]=r,!0)},l.unregisterCurve=function(t){return!!ft[t]&&(delete ft[t],!0)},l.getCurve=function(t){var r=ft[t];if(void 0!==r)return r;throw new Error('curve not registered')},l.getCurves=function(){return ft},l.prototype.setOptions=function(t){void 0!==t.curve&&(this.options.curve=t.curve),void 0!==t.duration&&(this.options.duration=t.duration),void 0!==t.speed&&(this.options.speed=t.speed)},l.prototype.set=function(t,r,n){if(!r)return this.reset(t),void(n&&n());if(this._startValue=d(this.get()),r=p(r,this.options),r.speed){var o=this._startValue;if(o instanceof Object){var a=0;for(var l in o)a+=(t[l]-o[l])*(t[l]-o[l]);r.duration=st(a)/r.speed}else r.duration=it(t-o)/r.speed}this._startTime=Date.now(),this._endValue=d(t),this._startVelocity=d(r.velocity),this._duration=r.duration,this._curve=r.curve,this._active=!0,this._callback=n},l.prototype.reset=function(t,r){if(this._callback){var n=this._callback;this._callback=void 0,n()}this.state=d(t),this.velocity=d(r),this._startTime=0,this._duration=0,this._updateTime=0,this._startValue=this.state,this._startVelocity=this.velocity,this._endValue=this.state,this._active=!1},l.prototype.getVelocity=function(){return this.velocity},l.prototype.get=function(t){return this.update(t),this.state},l.prototype.update=function(r){if(!this._active){if(this._callback){var n=this._callback;this._callback=void 0,n()}return}if(r||(r=Date.now()),!(this._updateTime>=r)){this._updateTime=r;var o=r-this._startTime;if(o>=this._duration)this.state=this._endValue,this.velocity=c(this.state,this._startValue,this._curve,this._duration,1),this._active=!1;else if(0>o)this.state=this._startValue,this.velocity=this._startVelocity;else{var a=o/this._duration;this.state=u(this._startValue,this._endValue,this._curve(a)),this.velocity=c(this.state,this._startValue,this._curve,this._duration,a)}}},l.prototype.isActive=function(){return this._active},l.prototype.halt=function(){this.reset(this.get())},l.registerCurve('linear',l.Curves.linear),l.registerCurve('easeIn',l.Curves.easeIn),l.registerCurve('easeOut',l.Curves.easeOut),l.registerCurve('easeInOut',l.Curves.easeInOut),l.registerCurve('easeOutBounce',l.Curves.easeOutBounce),l.registerCurve('spring',l.Curves.spring),l.customCurve=function(r,n){return r=r||0,n=n||0,function(o){return r*o+(-2*r-n+3)*o*o+(r+n-2)*o*o*o}};var ht=l,vt={};m.register=function(t){var r=!0;for(var n in t)m.registerMethod(n,t[n])||(r=!1);return r},m.registerMethod=function(t,r){return!(t in vt)&&(vt[t]=r,!0)},m.unregisterMethod=function(t){return!!(t in vt)&&(delete vt[t],!0)},m.prototype.set=function(t,r,n){if(!r)return this.reset(t),n&&n(),this;return this.actionQueue.push([t,r]),this.callbackQueue.push(n),this.currentAction||y.call(this),this},m.prototype.reset=function(t,r){this._currentMethod=null,this._engineInstance=null,this._callback=void 0,this.state=t,this.velocity=r,this.currentAction=null,this.actionQueue=[],this.callbackQueue=[]},m.prototype.delay=function(t,r){var n;return n=this.actionQueue.length?this.actionQueue[this.actionQueue.length-1][0]:this.currentAction?this.currentAction[0]:this.get(),this.set(n,{duration:t,curve:function(){return 0}},r)},m.prototype.get=function(t){return this._engineInstance&&(this._engineInstance.getVelocity&&(this.velocity=this._engineInstance.getVelocity()),this.state=this._engineInstance.get(t)),this.state},m.prototype.isActive=function(){return!!this.currentAction},m.prototype.halt=function(){return this.set(this.get())};var bt=m,xt={inQuad:function(r){return r*r},outQuad:function(r){return-(r-=1)*r+1},inOutQuad:function(r){return 1>(r/=.5)?.5*r*r:-.5*(--r*(r-2)-1)},inCubic:function(r){return r*r*r},outCubic:function(r){return--r*r*r+1},inOutCubic:function(r){return 1>(r/=.5)?.5*r*r*r:.5*((r-=2)*r*r+2)},inQuart:function(r){return r*r*r*r},outQuart:function(r){return-(--r*r*r*r-1)},inOutQuart:function(r){return 1>(r/=.5)?.5*r*r*r*r:-.5*((r-=2)*r*r*r-2)},inQuint:function(r){return r*r*r*r*r},outQuint:function(r){return--r*r*r*r*r+1},inOutQuint:function(r){return 1>(r/=.5)?.5*r*r*r*r*r:.5*((r-=2)*r*r*r*r+2)},inSine:function(r){return-1*ct(r*(at/2))+1},outSine:function(r){return pt(r*(at/2))},inOutSine:function(r){return-.5*(ct(at*r)-1)},inExpo:function(r){return 0===r?0:ot(2,10*(r-1))},outExpo:function(r){return 1===r?1:-ot(2,-10*r)+1},inOutExpo:function(r){return 0===r?0:1===r?1:1>(r/=.5)?.5*ot(2,10*(r-1)):.5*(-ot(2,-10*--r)+2)},inCirc:function(r){return-(st(1-r*r)-1)},outCirc:function(r){return st(1- --r*r)},inOutCirc:function(r){return 1>(r/=.5)?-.5*(st(1-r*r)-1):.5*(st(1-(r-=2)*r)+1)},inElastic:function(r){var t=1.70158,n=0;return 0===r?0:1===r?1:(n||(n=.3),t=1.5707963267948966*(n/(2*at)),-(1*ot(2,10*(r-=1))*pt((r-t)*(2*at)/n)))},outElastic:function(r){var t=1.70158,n=0;return 0===r?0:1===r?1:(n||(n=.3),t=1.5707963267948966*(n/(2*at)),1*ot(2,-10*r)*pt((r-t)*(2*at)/n)+1)},inOutElastic:function(r){var t=1.70158,n=0,o=1;return 0===r?0:2==(r/=.5)?1:(n||(n=.3*1.5),t=1.5707963267948966*(n/(2*at)),1>r?-.5*(o*ot(2,10*(r-=1))*pt((r-t)*(2*at)/n)):.5*(o*ot(2,-10*(r-=1))*pt((r-t)*(2*at)/n))+1)},inBack:function(r,t){return void 0===t&&(t=1.70158),r*r*((t+1)*r-t)},outBack:function(r,t){return void 0===t&&(t=1.70158),--r*r*((t+1)*r+t)+1},inOutBack:function(r,t){return void 0===t&&(t=1.70158),1>(r/=.5)?.5*(r*r*(((t*=1.525)+1)*r-t)):.5*((r-=2)*r*(((t*=1.525)+1)*r+t)+2)},inBounce:function(r){return 1-xt.outBounce(1-r)},outBounce:function(r){return r<1/2.75?7.5625*r*r:r<2/2.75?7.5625*(r-=1.5/2.75)*r+.75:r<2.5/2.75?7.5625*(r-=2.25/2.75)*r+.9375:7.5625*(r-=2.625/2.75)*r+.984375},inOutBounce:function(r){return .5>r?.5*xt.inBounce(2*r):.5*xt.outBounce(2*r-1)+.5}},St=xt;h.prototype.setTranslate=function(t,r,n){for(var o=this,a=S(t,'number'),l=n?gt.after(a,n):null,s=0;s<t.length;s+=1)'number'==typeof t[s]&&(o.translate[s].set(t[s],r,l),o._finalTranslate[s]=t[s]);return this._final=x.call(this),this},h.prototype.setTranslateX=function(t,r,n){return this.translate[0].set(t,r,n),this._finalTranslate[0]=t,this._final=x.call(this),this},h.prototype.setTranslateY=function(t,r,n){return this.translate[1].set(t,r,n),this._finalTranslate[1]=t,this._final=x.call(this),this},h.prototype.setTranslateZ=function(t,r,n){return this.translate[2].set(t,r,n),this._finalTranslate[2]=t,this._final=x.call(this),this},h.prototype.setScale=function(t,r,n){for(var o=this,a=S(t,'number'),l=n?gt.after(a,n):null,s=0;s<t.length;s+=1)'number'==typeof t[s]&&(o.scale[s].set(t[s],r,l),o._finalScale[s]=t[s]);return this._final=x.call(this),this},h.prototype.setScaleX=function(t,r,n){return this.scale[0].set(t,r,n),this._finalScale[0]=t,this._final=x.call(this),this},h.prototype.setScaleY=function(t,r,n){return this.scale[1].set(t,r,n),this._finalScale[1]=t,this._final=x.call(this),this},h.prototype.setScaleZ=function(t,r,n){return this.scale[2].set(t,r,n),this._finalScale[2]=t,this._final=x.call(this),this},h.prototype.setRotate=function(t,r,n){for(var o=this,a=S(t,'number'),l=n?gt.after(a,n):null,s=0;s<t.length;s+=1)'number'==typeof t[s]&&(o.rotate[s].set(t[s],r,l),o._finalRotate[s]=t[s]);return this._final=x.call(this),this},h.prototype.setRotateX=function(t,r,n){return this.rotate[0].set(t,r,n),this._finalRotate[0]=t,this._final=x.call(this),this},h.prototype.setRotateY=function(t,r,n){return this.rotate[1].set(t,r,n),this._finalRotate[1]=t,this._final=x.call(this),this},h.prototype.setRotateZ=function(t,r,n){return this.rotate[2].set(t,r,n),this._finalRotate[2]=t,this._final=x.call(this),this},h.prototype.setSkew=function(t,r,n){for(var o=this,a=S(t,'number'),l=n?gt.after(a,n):null,s=0;s<t.length;s+=1)'number'==typeof t[s]&&(o.skew[s].set(t[s],r,l),o._finalSkew[s]=t[s]);return this._final=x.call(this),this},h.prototype.setSkewX=function(t,r,n){return this.skew[0].set(t,r,n),this._finalSkew[0]=t,this._final=x.call(this),this},h.prototype.setSkewY=function(t,r,n){return this.skew[1].set(t,r,n),this._finalSkew[1]=t,this._final=x.call(this),this},h.prototype.setSkewZ=function(t,r,n){return this.skew[2].set(t,r,n),this._finalSkew[2]=t,this._final=x.call(this),this},h.prototype.set=function(t,r,n){var o=this,a=ut.interpret(t);this._finalTranslate=a.translate,this._finalRotate=a.rotate,this._finalSkew=a.skew,this._finalScale=a.scale,this._final=t;for(var l=n?gt.after(12,n):null,s=0;3>s;s+=1)o.translate[s].set(a.translate[s],r,l),o.rotate[s].set(a.rotate[s],r,l),o.skew[s].set(a.skew[s],r,l),o.scale[s].set(a.scale[s],r,l);return this},h.prototype.setDefaultTransition=function(t){for(var r=this,n=0;3>n;n+=1)r.translate[n].setDefault(t),r.rotate[n].setDefault(t),r.skew[n].setDefault(t),r.scale[n].setDefault(t)},h.prototype.get=function(){return this.isActive()?v.call(this):this._final},h.prototype.getFinal=function(){return this._final},h.prototype.isActive=function(){for(var t=this,r=!1,n=0;3>n;n+=1)if(t.translate[n].isActive()||t.rotate[n].isActive()||t.skew[n].isActive()||t.scale[n].isActive()){r=!0;break}return r},h.prototype.halt=function(){for(var t=this,r=0;3>r;r+=1)t.translate[r].halt(),t.rotate[r].halt(),t.skew[r].halt(),t.scale[r].halt(),t._finalTranslate[r]=t.translate[r].get(),t._finalRotate[r]=t.rotate[r].get(),t._finalSkew[r]=t.skew[r].get(),t._finalScale[r]=t.scale[r].get();return this._final=this.get(),this};var Ct=h;C.prototype.transformFrom=function(t){return t instanceof Function?this._transformGetter=t:t instanceof Object&&t.get?this._transformGetter=t.get.bind(t):(this._transformGetter=null,this._output.transform=t),this},C.prototype.opacityFrom=function(t){return t instanceof Function?this._opacityGetter=t:t instanceof Object&&t.get?this._opacityGetter=t.get.bind(t):(this._opacityGetter=null,this._output.opacity=t),this},C.prototype.originFrom=function(t){return t instanceof Function?this._originGetter=t:t instanceof Object&&t.get?this._originGetter=t.get.bind(t):(this._originGetter=null,this._output.origin=t),this},C.prototype.alignFrom=function(t){return t instanceof Function?this._alignGetter=t:t instanceof Object&&t.get?this._alignGetter=t.get.bind(t):(this._alignGetter=null,this._output.align=t),this},C.prototype.sizeFrom=function(t){return t instanceof Function?this._sizeGetter=t:t instanceof Object&&t.get?this._sizeGetter=t.get.bind(t):(this._sizeGetter=null,this._output.size=t),this},C.prototype.proportionsFrom=function(t){return t instanceof Function?this._proportionGetter=t:t instanceof Object&&t.get?this._proportionGetter=t.get.bind(t):(this._proportionGetter=null,this._output.proportions=t),this},C.prototype.setTransform=function(t,r,n){return r||this._legacyStates.transform?(this._legacyStates.transform||(this._legacyStates.transform=new Ct(this._output.transform)),this._transformGetter||this.transformFrom(this._legacyStates.transform),this._legacyStates.transform.set(t,r,n),this):this.transformFrom(t)},C.prototype.setOpacity=function(t,r,n){return r||this._legacyStates.opacity?(this._legacyStates.opacity||(this._legacyStates.opacity=new bt(this._output.opacity)),this._opacityGetter||this.opacityFrom(this._legacyStates.opacity),this._legacyStates.opacity.set(t,r,n)):this.opacityFrom(t)},C.prototype.setOrigin=function(t,r,n){return r||this._legacyStates.origin?(this._legacyStates.origin||(this._legacyStates.origin=new bt(this._output.origin||[0,0])),this._originGetter||this.originFrom(this._legacyStates.origin),this._legacyStates.origin.set(t,r,n),this):this.originFrom(t)},C.prototype.setAlign=function(t,r,n){return r||this._legacyStates.align?(this._legacyStates.align||(this._legacyStates.align=new bt(this._output.align||[0,0])),this._alignGetter||this.alignFrom(this._legacyStates.align),this._legacyStates.align.set(t,r,n),this):this.alignFrom(t)},C.prototype.setSize=function(t,r,n){return t&&(r||this._legacyStates.size)?(this._legacyStates.size||(this._legacyStates.size=new bt(this._output.size||[0,0])),this._sizeGetter||this.sizeFrom(this._legacyStates.size),this._legacyStates.size.set(t,r,n),this):this.sizeFrom(t)},C.prototype.setProportions=function(t,r,n){return t&&(r||this._legacyStates.proportions)?(this._legacyStates.proportions||(this._legacyStates.proportions=new bt(this._output.proportions||[0,0])),this._proportionGetter||this.proportionsFrom(this._legacyStates.proportions),this._legacyStates.proportions.set(t,r,n),this):this.proportionsFrom(t)},C.prototype.halt=function(){this._legacyStates.transform&&this._legacyStates.transform.halt(),this._legacyStates.opacity&&this._legacyStates.opacity.halt(),this._legacyStates.origin&&this._legacyStates.origin.halt(),this._legacyStates.align&&this._legacyStates.align.halt(),this._legacyStates.size&&this._legacyStates.size.halt(),this._legacyStates.proportions&&this._legacyStates.proportions.halt(),this._transformGetter=null,this._opacityGetter=null,this._originGetter=null,this._alignGetter=null,this._sizeGetter=null,this._proportionGetter=null},C.prototype.getTransform=function(){return this._transformGetter()},C.prototype.getFinalTransform=function(){return this._legacyStates.transform?this._legacyStates.transform.getFinal():this._output.transform},C.prototype.getOpacity=function(){return this._opacityGetter()},C.prototype.getOrigin=function(){return this._originGetter()},C.prototype.getAlign=function(){return this._alignGetter()},C.prototype.getSize=function(){return this._sizeGetter?this._sizeGetter():this._output.size},C.prototype.getProportions=function(){return this._proportionGetter?this._proportionGetter():this._output.proportions},C.prototype.modify=function(t){return k.call(this),this._output.target=t,this._output};var kt=C,Tt=[],Pt={register:function(t){var r=Tt.length;return T(r,t),r},unregister:function(t){T(t,null)},get:function(t){return Tt[t]},set:T};P._instance=new P,P.parse=function(t,r){return P._instance.parse(t,r)},P.prototype.parse=function(t,r){return this.reset(),this._parseSpec(t,r,ut.identity),this.result},P.prototype.reset=function(){this.result={}};var Rt=[0,0];P.prototype._parseSpec=function(t,r,n){var o=this,a,l,s,d,p,c,_;if('number'==typeof t){if(a=t,s=r.transform,c=r.align||Rt,r.size&&c&&(c[0]||c[1])){var u=[c[0]*r.size[0],c[1]*r.size[1],0];s=ut.thenMove(s,R(u,n))}this.result[a]={transform:s,opacity:r.opacity,origin:r.origin||Rt,align:r.align||Rt,size:r.size}}else{if(!t)return;if(t instanceof Array)for(var m=0;m<t.length;m++)o._parseSpec(t[m],r,n);else{l=t.target,s=r.transform,d=r.opacity,p=r.origin,c=r.align,_=r.size;var i=n;if(void 0!==t.opacity&&(d=r.opacity*t.opacity),t.transform&&(s=ut.multiply(r.transform,t.transform)),t.origin&&(p=t.origin,i=r.transform),t.align&&(c=t.align),t.size||t.proportions){var g=_;_=[_[0],_[1]],t.size&&(void 0!==t.size[0]&&(_[0]=t.size[0]),void 0!==t.size[1]&&(_[1]=t.size[1])),t.proportions&&(void 0!==t.proportions[0]&&(_[0]*=t.proportions[0]),void 0!==t.proportions[1]&&(_[1]*=t.proportions[1])),g&&(c&&(c[0]||c[1])&&(s=ut.thenMove(s,R([c[0]*g[0],c[1]*g[1],0],n))),p&&(p[0]||p[1])&&(s=ut.moveThen([-p[0]*_[0],-p[1]*_[1],0],s))),i=r.transform,p=null,c=null}this._parseSpec(l,{transform:s,opacity:d,origin:p,align:c,size:_},i)}}};var Et=P;E.prototype.add=function(t){var r=t instanceof E?t:new E(t);return this._child instanceof Array?this._child.push(r):this._child?(this._child=[this._child,r],this._hasMultipleChildren=!0,this._childResult=[]):this._child=r,r},E.prototype.get=function(){return this._object||(this._hasMultipleChildren?null:this._child?this._child.get():null)},E.prototype.set=function(t){return this._childResult=null,this._hasMultipleChildren=!1,this._isRenderable=!!t.render,this._isModifier=!!t.modify,this._object=t,this._child=null,t instanceof E?t:this},E.prototype.getSize=function(){var t=null,r=this.get();return r&&r.getSize&&(t=r.getSize()),!t&&this._child&&this._child.getSize&&(t=this._child.getSize()),t},E.prototype.commit=function(t){for(var r=this,n=Object.keys(this._prevResults),o=0,a;o<n.length;o++)if(a=n[o],void 0===r._resultCache[a]){var i=Pt.get(a);i.cleanup&&i.cleanup(t.allocator)}this._prevResults=this._resultCache,this._resultCache={},w(this.render(),t,this._resultCache)},E.prototype.render=function(){if(this._isRenderable)return this._object.render();var t=null;if(this._hasMultipleChildren){t=this._childResult;for(var r=this._child,n=0;n<r.length;n++)t[n]=r[n].render()}else this._child&&(t=this._child.render());return this._isModifier?this._object.modify(t):t};var wt=E;A.prototype.emit=function(t,r){var n=this,o=this.listeners[t];if(o)for(var a=0;a<o.length;a++)o[a].call(n._owner,r);return this},A.prototype.on=function(t,r){t in this.listeners||(this.listeners[t]=[]);var n=this.listeners[t].indexOf(r);return 0>n&&this.listeners[t].push(r),this},A.prototype.addListener=A.prototype.on,A.prototype.removeListener=function(t,r){var n=this.listeners[t];if(void 0!==n){var o=n.indexOf(r);0<=o&&n.splice(o,1)}return this},A.prototype.bindThis=function(t){this._owner=t};var At=A;O.prototype=Object.create(At.prototype),O.prototype.constructor=O,O.setInputHandler=function(t,r){t.trigger=r.trigger.bind(r),r.subscribe&&r.unsubscribe&&(t.subscribe=r.subscribe.bind(r),t.unsubscribe=r.unsubscribe.bind(r))},O.setOutputHandler=function(t,r){r instanceof O&&r.bindThis(t),t.pipe=r.pipe.bind(r),t.unpipe=r.unpipe.bind(r),t.on=r.on.bind(r),t.addListener=t.on,t.removeListener=r.removeListener.bind(r)},O.prototype.emit=function(t,r){var n=this;At.prototype.emit.apply(this,arguments);var o=0;for(o=0;o<this.downstream.length;o++)n.downstream[o].trigger&&n.downstream[o].trigger(t,r);for(o=0;o<this.downstreamFn.length;o++)n.downstreamFn[o](t,r);return this},O.prototype.trigger=O.prototype.emit,O.prototype.pipe=function(t){if(t.subscribe instanceof Function)return t.subscribe(this);var r=t instanceof Function?this.downstreamFn:this.downstream,n=r.indexOf(t);return 0>n&&r.push(t),t instanceof Function?t('pipe',null):t.trigger&&t.trigger('pipe',null),t},O.prototype.unpipe=function(t){if(t.unsubscribe instanceof Function)return t.unsubscribe(this);var r=t instanceof Function?this.downstreamFn:this.downstream,n=r.indexOf(t);return!!(0<=n)&&(r.splice(n,1),t instanceof Function?t('unpipe',null):t.trigger&&t.trigger('unpipe',null),t)},O.prototype.on=function(t){var r=this;if(At.prototype.on.apply(this,arguments),!(t in this.upstreamListeners)){var n=this.trigger.bind(this,t);this.upstreamListeners[t]=n;for(var o=0;o<this.upstream.length;o++)r.upstream[o].on(t,n)}return this},O.prototype.addListener=O.prototype.on,O.prototype.subscribe=function(t){var r=this,n=this.upstream.indexOf(t);if(0>n)for(var o in this.upstream.push(t),r.upstreamListeners)t.on(o,r.upstreamListeners[o]);return this},O.prototype.unsubscribe=function(t){var r=this,n=this.upstream.indexOf(t);if(0<=n)for(var o in this.upstream.splice(n,1),r.upstreamListeners)t.removeListener(o,r.upstreamListeners[o]);return this};var Ot=O;M.prototype.migrate=function(t){var r=this.container;if(t!==r){if(r instanceof DocumentFragment)t.appendChild(r);else for(;r.hasChildNodes();)t.appendChild(r.firstChild);this.container=t}},M.prototype.allocate=function(t){t=t.toLowerCase(),t in this.detachedNodes||(this.detachedNodes[t]=[]);var r=this.detachedNodes[t],n;return 0<r.length?n=r.pop():(n=document.createElement(t),this.container.appendChild(n)),this.nodeCount++,n},M.prototype.deallocate=function(t){var r=t.nodeName.toLowerCase(),n=this.detachedNodes[r];n.push(t),this.nodeCount--},M.prototype.getNodeCount=function(){return this.nodeCount};var Mt=M,Lt=[0,0],zt=!('perspective'in document.documentElement.style),Ft=zt?function(t,r){t.style.webkitPerspective=r?r.toFixed()+'px':''}:function(t,r){t.style.perspective=r?r.toFixed()+'px':''};z.prototype.getAllocator=function(){return this._allocator},z.prototype.add=function(t){return this._node.add(t)},z.prototype.migrate=function(t){t===this.container||(this.container=t,this._allocator.migrate(t))},z.prototype.getSize=function(){return this._size},z.prototype.setSize=function(t){t||(t=L.call(this)),this._size[0]=t[0],this._size[1]=t[1]},z.prototype.update=function(t){t&&(t.transform&&(this._nodeContext.transform=t.transform),t.opacity&&(this._nodeContext.opacity=t.opacity),t.origin&&(this._nodeContext.origin=t.origin),t.align&&(this._nodeContext.align=t.align),t.size&&(this._nodeContext.size=t.size));var r=this._perspectiveState.get();r!==this._perspective&&(Ft(this.container,r),this._perspective=r),this._node.commit(this._nodeContext)},z.prototype.getPerspective=function(){return this._perspectiveState.get()},z.prototype.setPerspective=function(t,r,n){return this._perspectiveState.set(t,r,n)},z.prototype.emit=function(t,r){return this._eventOutput.emit(t,r)},z.prototype.on=function(t,r){return this._eventOutput.on(t,r)},z.prototype.removeListener=function(t,r){return this._eventOutput.removeListener(t,r)},z.prototype.pipe=function(t){return this._eventOutput.pipe(t)},z.prototype.unpipe=function(t){return this._eventOutput.unpipe(t)};F.patch=function(t){for(var r=arguments,n=new F(t),o=1;o<arguments.length;o++)n.patch(r[o]);return t},F.prototype.patch=function(){for(var t=arguments,r=this,n=this._value,o=0,a;o<arguments.length;o++)for(var i in a=t[o],a)i in n&&a[i]&&a[i].constructor===Object&&n[i]&&n[i].constructor===Object?(n.hasOwnProperty(i)||(n[i]=Object.create(n[i])),r.key(i).patch(a[i]),r.eventOutput&&r.eventOutput.emit('change',{id:i,value:r.key(i).value()})):r.set(i,a[i]);return this},F.prototype.setOptions=F.prototype.patch,F.prototype.key=function(t){var r=new F(this._value[t]);return(!(r._value instanceof Object)||r._value instanceof Array)&&(r._value={}),r},F.prototype.get=function(t){return t?this._value[t]:this._value},F.prototype.getOptions=F.prototype.get,F.prototype.set=function(t,r){var n=this.get(t);return this._value[t]=r,this.eventOutput&&r!==n&&this.eventOutput.emit('change',{id:t,value:r}),this},F.prototype.on=function(){return N.call(this),this.on.apply(this,arguments)},F.prototype.removeListener=function(){return N.call(this),this.removeListener.apply(this,arguments)},F.prototype.pipe=function(){return N.call(this),this.pipe.apply(this,arguments)},F.prototype.unpipe=function(){return N.call(this),this.unpipe.apply(this,arguments)};var Nt=F,Ut={},Dt=[],It=[],Gt=0,Vt=0,Bt=[],jt=Date.now(),Ht=!0,Wt={},Yt=new Ot,Xt={containerType:'div',containerClass:'famous-container',fpsCap:void 0,runLoop:!0,appMode:!0},qt=new Nt(Xt),Zt,Kt;Ut.step=function(){var t=this;Gt++,Vt=Gt;var r=Date.now();if(!(Kt&&r-jt<Kt)){var n=0;Zt=r-jt,jt=r,Yt.emit('prerender');for(var o=It.length;o--;)It.shift()(Gt);for(;Bt.length&&Date.now()-r<10;)Bt.shift().call(t);for(n=0;n<Dt.length;n++)Dt[n].update();Yt.emit('postrender')}},window.requestAnimationFrame(U),window.addEventListener('resize',D,!1),D();Ut.pipe=function(t){return t.subscribe instanceof Function?t.subscribe(Ut):Yt.pipe(t)},Ut.unpipe=function(t){return t.unsubscribe instanceof Function?t.unsubscribe(Ut):Yt.unpipe(t)},Ut.on=function(t,r){return t in Wt||(Wt[t]=Yt.emit.bind(Yt,t),V(t,Wt[t])),Yt.on(t,r)},Ut.emit=function(t,r){return Yt.emit(t,r)},Ut.removeListener=function(t,r){return Yt.removeListener(t,r)},Ut.getFPS=function(){return 1e3/Zt},Ut.setFPSCap=function(t){Kt=nt(1e3/t)},Ut.getOptions=function(t){return qt.getOptions(t)},Ut.setOptions=function(){return qt.setOptions.apply(qt,arguments)},Ut.createContext=function(t){Xt.appMode&&Ut.nextTick(I);var r=!1;t||(t=document.createElement(Xt.containerType),t.classList.add(Xt.containerClass),r=!0);var n=new z(t);return Ut.registerContext(n),r&&B(n,t),n},Ut.registerContext=function(t){return Dt.push(t),t},Ut.getContexts=function(){return Dt},Ut.deregisterContext=function(t){var r=Dt.indexOf(t);0<=r&&Dt.splice(r,1)},Ut.nextTick=function(t){It.push(t)},Ut.defer=function(t){Bt.push(t)},qt.on('change',function(t){'fpsCap'===t.id?Ut.setFPSCap(t.value):'runLoop'===t.id&&!Ht&&t.value&&(Ht=!0,window.requestAnimationFrame(U))});var $t=Object.freeze({contextWithPerspective:function(t){var r=Ut.createContext();return r.setPerspective(t),r},simpleExtend:j});(function(){}).name||Object.defineProperty(Function.prototype,'name',{get:function(){var t=this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1];return Object.defineProperty(this,'name',{value:t}),t}});var Qt=function(t){function r(r){t.call(this),this._={options:{},defaultOptions:{}},j(this._.defaultOptions,{align:[0.5,0.5],origin:[0.5,0.5],transform:new Ct,handler:new Ot}),this.options=r}t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r;var n={options:{},transform:{}};return n.options.set=function(t){this.resetOptions(),this.setOptions(t)},n.options.get=function(){return this._.options},n.transform.set=function(t){this.setOptions({transform:t})},n.transform.get=function(){return this.options.transform},r.prototype.setOptions=function(t){var r=this;for(var n in('undefined'==typeof t||'Object'!=t.constructor.name)&&(t={}),t)kt.prototype[''+n+'From']&&r.modifier[''+n+'From'](t[n]),r._.options[n]=t[n]},r.prototype.resetOptions=function(){this.modifier=new kt,this.set(this.modifier),this.setOptions(this._.defaultOptions)},r.prototype.pipe=function(){var t=Array.prototype.splice.call(arguments,0);return this.options.handler.pipe.apply(this.options.handler,t)},r.prototype.unpipe=function(){var t=Array.prototype.splice.call(arguments,0);return this.options.handler.unpipe.apply(this.options.handler,t)},r.prototype.on=function(){var t=Array.prototype.splice.call(arguments,0);return this.options.handler.on.apply(this.options.handler,t)},r.prototype.off=function(){var t=Array.prototype.splice.call(arguments,0);return this.options.handler.on.apply(this.options.handler,t)},Object.defineProperties(r.prototype,n),r}(wt),Jt='undefined'==typeof window?'undefined'==typeof global?'undefined'==typeof self?{}:self:global:window,er=W(function(t,r){function n(t,r){for(var n=0;n<t;n+=1)r(n)}r.forLength=n,r['default']=n,r.__esModule=!0}),tr=H(er),rr=function(t){function r(r,n,o){t.call(this,{size:o}),this.columns=r,this.rows=n,this.cellNodes=[],'undefined'==typeof this.options.size&&this.setOptions({size:[void 0,void 0]}),tr(this.columns*this.rows,this._createGridCell.bind(this))}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._createGridCell=function(t){var r=t%this.columns,n=nt(t/this.columns),o=null;'undefined'!=typeof this.options.size[0]&&'undefined'!=typeof this.options.size[1]&&(o=[],o[0]=this.options.size[0]/this.columns,o[1]=this.options.size[1]/this.rows);var a=new kt({align:[0,0],origin:[0,0],size:o?[o[0],o[1]]:[void 0,void 0],transform:ut.translate(r*o[0],n*o[1],0)}),i=new kt({align:[0.5,0.5],origin:[0.5,0.5]});this.cellNodes.push(this.add(a).add(i))},r.prototype.setChildren=function(t){return tr(this.columns*this.rows,function(r){this.cellNodes[r].add(t[r])}.bind(this)),this},r}(Qt),nr=!('transform'in document.documentElement.style),or=window.devicePixelRatio||1;Y.prototype.on=function(t,r){this._element&&this._element.addEventListener(t,this.eventForwarder),this._eventOutput.on(t,r)},Y.prototype.removeListener=function(t,r){this._eventOutput.removeListener(t,r)},Y.prototype.emit=function(t,r){r&&!r.origin&&(r.origin=this);var n=this._eventOutput.emit(t,r);return n&&r&&r.stopPropagation&&r.stopPropagation(),n},Y.prototype.pipe=function(t){return this._eventOutput.pipe(t)},Y.prototype.unpipe=function(t){return this._eventOutput.unpipe(t)},Y.prototype.render=function(){return this.id};var ar=nr?function(t,r){t.style.webkitTransform=Z(r)}:function(t,r){t.style.transform=Z(r)};var ir=nr?function(t,r){t.style.webkitTransformOrigin=K(r)}:function(t,r){t.style.transformOrigin=K(r)},lr=nr?function(t){t.style.webkitTransform='scale3d(0.0001,0.0001,0.0001)',t.style.opacity=0}:function(t){t.style.transform='scale3d(0.0001,0.0001,0.0001)',t.style.opacity=0};Y.prototype.commit=function(t){var r=this._element;if(r){var n=t.transform,o=t.opacity,a=t.origin,i=t.size;if(!n&&this._matrix)return this._matrix=null,this._opacity=0,void lr(r);if($(this._origin,a)&&(this._originDirty=!0),ut.notEquals(this._matrix,n)&&(this._transformDirty=!0),this._invisible&&(this._invisible=!1,this._element.style.display=''),this._opacity!==o&&(this._opacity=o,r.style.opacity=1<=o?'0.999999':o),this._transformDirty||this._originDirty||this._sizeDirty){this._sizeDirty&&(this._sizeDirty=!1),this._originDirty&&(a?(!this._origin&&(this._origin=[0,0]),this._origin[0]=a[0],this._origin[1]=a[1]):this._origin=null,ir(r,this._origin),this._originDirty=!1),n||(n=ut.identity),this._matrix=n;var l=this._size?ut.thenMove(n,[-this._size[0]*a[0],-this._size[1]*a[1],0]):n;ar(r,l),this._transformDirty=!1}}},Y.prototype.cleanup=function(){this._element&&(this._invisible=!0,this._element.style.display='none')},Y.prototype.attach=function(t){this._element=t,X.call(this,t)},Y.prototype.detach=function(){var t=this._element;return t&&(q.call(this,t),this._invisible&&(this._invisible=!1,this._element.style.display='')),this._element=null,t};var sr=Y;Q.prototype=Object.create(sr.prototype),Q.prototype.constructor=Q,Q.prototype.elementType='div',Q.prototype.elementClass='famous-surface',Q.prototype.setAttributes=function(t){var r=this;for(var o in t){if('style'==o)throw new Error('Cannot set styles via "setAttributes" as it will break Famo.us. Use "setProperties" instead.');r.attributes[o]=t[o]}this._attributesDirty=!0},Q.prototype.getAttributes=function(){return this.attributes},Q.prototype.setProperties=function(t){var r=this;for(var o in t)r.properties[o]=t[o];return this._stylesDirty=!0,this},Q.prototype.getProperties=function(){return this.properties},Q.prototype.addClass=function(t){return 0>this.classList.indexOf(t)&&(this.classList.push(t),this._classesDirty=!0),this},Q.prototype.removeClass=function(t){var r=this.classList.indexOf(t);return 0<=r&&(this._dirtyClasses.push(this.classList.splice(r,1)[0]),this._classesDirty=!0),this},Q.prototype.toggleClass=function(t){var r=this.classList.indexOf(t);return 0<=r?this.removeClass(t):this.addClass(t),this},Q.prototype.setClasses=function(t){var r=this,n=0,o=[];for(n=0;n<this.classList.length;n++)0>t.indexOf(r.classList[n])&&o.push(r.classList[n]);for(n=0;n<o.length;n++)r.removeClass(o[n]);for(n=0;n<t.length;n++)r.addClass(t[n]);return this},Q.prototype.getClassList=function(){return this.classList},Q.prototype.setContent=function(t){return this.content!==t&&(this.content=t,this._contentDirty=!0),this},Q.prototype.getContent=function(){return this.content},Q.prototype.setOptions=function(t){return t.size&&this.setSize(t.size),t.classes&&this.setClasses(t.classes),t.properties&&this.setProperties(t.properties),t.attributes&&this.setAttributes(t.attributes),t.content&&this.setContent(t.content),this},Q.prototype.setup=function(t){var r=this,n=t.allocate(this.elementType);if(this.elementClass)if(this.elementClass instanceof Array)for(var o=0;o<this.elementClass.length;o++)n.classList.add(r.elementClass[o]);else n.classList.add(this.elementClass);n.style.display='',this.attach(n),this._opacity=null,this._currentTarget=n,this._stylesDirty=!0,this._classesDirty=!0,this._attributesDirty=!0,this._sizeDirty=!0,this._contentDirty=!0,this._originDirty=!0,this._transformDirty=!0},Q.prototype.commit=function(t){this._currentTarget||this.setup(t.allocator);var r=this._currentTarget,n=t.size;if(this._classesDirty){J.call(this,r);for(var o=this.getClassList(),a=0;a<o.length;a++)r.classList.add(o[a]);this._classesDirty=!1,this._trueSizeCheck=!0}if(this._stylesDirty&&(ee.call(this,r),this._stylesDirty=!1,this._trueSizeCheck=!0),this._attributesDirty&&(re.call(this,r),this._attributesDirty=!1,this._trueSizeCheck=!0),this.size){var i=t.size;if(n=[this.size[0],this.size[1]],void 0===n[0]&&(n[0]=i[0]),void 0===n[1]&&(n[1]=i[1]),!0===n[0]||!0===n[1]){if(!0===n[0])if(this._trueSizeCheck||0===this._size[0]){var l=r.offsetWidth;this._size&&this._size[0]!==l&&(this._size[0]=l,this._sizeDirty=!0),n[0]=l}else this._size&&(n[0]=this._size[0]);if(!0===n[1])if(this._trueSizeCheck||0===this._size[1]){var s=r.offsetHeight;this._size&&this._size[1]!==s&&(this._size[1]=s,this._sizeDirty=!0),n[1]=s}else this._size&&(n[1]=this._size[1]);this._trueSizeCheck=!1}}oe(this._size,n)&&(!this._size&&(this._size=[0,0]),this._size[0]=n[0],this._size[1]=n[1],this._sizeDirty=!0),this._sizeDirty&&(this._size&&(r.style.width=this.size&&!0===this.size[0]?'':this._size[0]+'px',r.style.height=this.size&&!0===this.size[1]?'':this._size[1]+'px'),this._eventOutput.emit('resize')),this._contentDirty&&(this.deploy(r),this._eventOutput.emit('deploy'),this._contentDirty=!1,this._trueSizeCheck=!0),sr.prototype.commit.call(this,t)},Q.prototype.cleanup=function(t){var r=this,n=0,o=this._currentTarget;this._eventOutput.emit('recall'),this.recall(o),o.style.display='none',o.style.opacity='',o.style.width='',o.style.height='',te.call(this,o),ne.call(this,o);var a=this.getClassList();for(J.call(this,o),n=0;n<a.length;n++)o.classList.remove(a[n]);if(this.elementClass)if(this.elementClass instanceof Array)for(n=0;n<this.elementClass.length;n++)o.classList.remove(r.elementClass[n]);else o.classList.remove(this.elementClass);this.detach(o),this._currentTarget=null,t.deallocate(o)},Q.prototype.deploy=function(t){var r=this.getContent();if(r instanceof Node){for(;t.hasChildNodes();)t.removeChild(t.firstChild);t.appendChild(r)}else t.innerHTML=r},Q.prototype.recall=function(t){for(var r=document.createDocumentFragment();t.hasChildNodes();)r.appendChild(t.firstChild);this.setContent(r)},Q.prototype.getSize=function(){return this._size?this._size:this.size},Q.prototype.setSize=function(t){return this.size=t?[t[0],t[1]]:null,this._sizeDirty=!0,this};var dr=Q,pr=function(t){function r(r){t.call(this,r),this.surface=new dr(this.options),this.add(this.surface),this.surface.pipe(this.options.handler)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype.getContent=function(){var t=Array.prototype.splice.call(arguments,0);return this.surface.getContent.apply(this.surface,t)},r.prototype.setContent=function(){var t=Array.prototype.splice.call(arguments,0);return this.surface.setContent.apply(this.surface,t)},r}(Qt),cr=function(t){function r(r){t.call(this,r),this.children=[],this.plane1=new pr(this.options),this.plane1.transform.set(ut.rotate(0,0,0)),this.setOptions({properties:{background:'orange'}}),this.plane2=new pr(this.options),this.plane2.transform.set(ut.rotate(0,Math.PI,0)),this.children.push(this.plane1),this.children.push(this.plane2),this.add(this.plane2),this.add(this.plane1),this.plane1.pipe(this.options.handler),this.plane2.pipe(this.options.handler)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype.getContent=function(){return[this.plane1.getContent(),this.plane2.getContent()]},r.prototype.setContent=function(t){this.plane1.setContent(t[0]),this.plane2.setContent(t[1])},r}(Qt),_r=function(t){function r(r,n){t.call(this,{size:r}),this.transition=n,this.flipSide=0,this.columnsRows=[7,6],this.planes=[],this._initializeTransitions(),this._createGrid(),setTimeout(function(){this.transitions[this.transition](),setInterval(this.transitions[this.transition],2e3)}.bind(this),800)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._createGrid=function(){var t=new rr(this.columnsRows[0],this.columnsRows[1],this.options.size);tr(this.columnsRows[0]*this.columnsRows[1],function(){var t=new cr({properties:{background:'teal'}});this.planes.push(t)}.bind(this)),t.setChildren(this.planes),this.add(t)},r.prototype._initializeTransitions=function(){this.transitions={flipDiagonal:function(){function t(t,r){'undefined'==typeof t.__targetRotation&&(t.__targetRotation=new bt(0));var n=new bt(t.__targetRotation.get());t.__targetRotation.set(t.__targetRotation.get()+at),t.children[0].get().transformFrom(function(){return ut.rotateY(n.get())}),t.children[1].get().transformFrom(function(){return ut.rotateY(n.get()+at)}),setTimeout(function(){n.set(t.__targetRotation.get(),{duration:2e3,curve:St.outExpo})},0+50*r)}this.flipSide=+!this.flipSide;var r=0,n;this.columnsRows.forEach(function(t,n){t<this.columnsRows[r]&&(r=n)}.bind(this)),n=+!r,tr(this.columnsRows[0]+this.columnsRows[1]-1,function(o){tr(this.columnsRows[r],function(r){if(0<=o-r&&o-r<this.columnsRows[n]){var a=this.planes[o-r+this.columnsRows[n]*r];t(a,o)}}.bind(this))}.bind(this))}.bind(this)}},r}(Qt),ur=W(function(t,r){function n(t,r){for(var n='',o=0;o<t;o++)n+=' ';return n+r}Object.defineProperty(r,'__esModule',{value:!0}),r.clone=function(t){return a(o(t))},r.isEmptyObject=function(t){for(var r in t)return!1;return!0},r.toCSS=function(t,r){var o=2>=arguments.length||void 0===arguments[2]?{}:arguments[2],a=o.indentationLevel||0,i='';for(var l in!1!==o.selector&&(i+=n(a,t+' {'),a++),r){var s=r[l];if(Array.isArray(s))for(var d=0;d<s.length;d++)i+='\n'+n(a,l+': '+s[d]+';');else i+='\n'+n(a,l+': '+s+';')}return!1!==o.selector&&(i+='\n'+n(--a,'}')),i};var o=JSON.stringify,a=JSON.parse,i=r.uid=function(){var t='undefined'==typeof window?Jt:window,r='__JSS_VERSION_COUNTER__';null==t[r]&&(t[r]=0);var n=t[r]++,o=0;return{get:function(){return'jss-'+n+'-'+o++},reset:function(){o=0}}}(),l=r.findClassNames=function(){var t=/[.]/g,r=/[.][^ ,]+/g;return function(n){var o=n.match(r);return o?o.join(' ').replace(t,''):''}}()}),mr=W(function(t,r){function n(t,r){if(!(t instanceof r))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(r,'__esModule',{value:!0});var o='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&'function'==typeof Symbol&&t.constructor===Symbol?'symbol':typeof t},a=function(){function t(t,r){for(var n=0,o;n<r.length;n++)o=r[n],o.enumerable=o.enumerable||!1,o.configurable=!0,'value'in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}return function(r,n,o){return n&&t(r.prototype,n),o&&t(r,o),r}}(),i=function(){function t(r,o,a){n(this,t),this.id=ur.uid.get(),this.type='regular',this.options=a,this.selectorText=r||'',this.className=a.className||'',this.originalStyle=o,this.style=(0,ur.clone)(o),a.named&&(this.name=r,!this.className&&(this.className=this.name?this.name+'--'+this.id:this.id),this.selectorText='.'+this.className)}return a(t,[{key:'prop',value:function(t,r){var n=this.options.Renderer.style;return null==r?(this.renderable&&null==this.style[t]&&(this.style[t]=n(this.renderable,t)),this.style[t]):(this.style[t]=r,this.renderable&&n(this.renderable,t,r),this)}},{key:'applyTo',value:function(t){var r=this;for(var n in r.style){var o=r.style[n],a=r.options.Renderer.style;if(Array.isArray(o))for(var i=0;i<o.length;i++)a(t,n,o[i]);else a(t,n,o)}return this}},{key:'toJSON',value:function(){var t=this,r=Object.create(null);for(var n in t.style)'object'!=o(t.style[n])&&(r[n]=t.style[n]);return r}},{key:'toString',value:function(t){return(0,ur.toCSS)(this.selector,this.style,t)}},{key:'selector',set:function(){var t=0>=arguments.length||void 0===arguments[0]?'':arguments[0],r=this.options,n=r.Renderer,o=r.sheet;if(o&&o.unregisterRule(this),this.selectorText=t,this.className=(0,ur.findClassNames)(t),!this.renderable)return void(o&&o.registerRule(this));var a=n.setSelector(this.renderable,t);return a?void o.registerRule(this):void(delete this.renderable,o.registerRule(this).deploy().link())},get:function(){return this.renderable?this.options.Renderer.getSelector(this.renderable):this.selectorText}}]),t}();r.default=i}),gr=W(function(t,r){function n(t,r){if(!(t instanceof r))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(r,'__esModule',{value:!0});var o=function(){function t(t,r){for(var n=0,o;n<r.length;n++)o=r[n],o.enumerable=o.enumerable||!1,o.configurable=!0,'value'in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}return function(r,n,o){return n&&t(r.prototype,n),o&&t(r,o),r}}(),a=function(){function t(r,o,a){n(this,t),this.id=ur.uid.get(),this.type='simple',this.name=r,this.value=o,this.options=a}return o(t,[{key:'toString',value:function(){var t=this;if(Array.isArray(this.value)){for(var r='',n=0;n<this.value.length;n++)r+=t.name+' '+t.value[n]+';',t.value[n+1]&&(r+='\n');return r}return this.name+' '+this.value+';'}}]),t}();r.default=a}),yr=W(function(t,r){function n(t,r){if(!(t instanceof r))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(r,'__esModule',{value:!0});var o=Object.assign||function(t){for(var r=arguments,n=1,o;n<arguments.length;n++)for(var a in o=r[n],o)Object.prototype.hasOwnProperty.call(o,a)&&(t[a]=o[a]);return t},a=function(){function t(t,r){for(var n=0,o;n<r.length;n++)o=r[n],o.enumerable=o.enumerable||!1,o.configurable=!0,'value'in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}return function(r,n,o){return n&&t(r.prototype,n),o&&t(r,o),r}}(),i=function(){function t(r,o,a){n(this,t),this.id=ur.uid.get(),this.type='keyframe',this.selector=r,this.options=a,this.frames=this.formatFrames(o)}return a(t,[{key:'formatFrames',value:function(t){var r=this,n=Object.create(null);for(var a in t){var i=o({},r.options,{named:!1,parent:r});n[a]=r.options.jss.createRule(a,t[a],i)}return n}},{key:'toString',value:function(){var t=this,r=this.selector+' {\n',n={indentationLevel:1};for(var o in t.frames)r+=t.frames[o].toString(n)+'\n';return r+='}',r}}]),t}();r.default=i}),fr=W(function(t,r){function n(t,r){if(!(t instanceof r))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(r,'__esModule',{value:!0});var o=Object.assign||function(t){for(var r=arguments,n=1,o;n<arguments.length;n++)for(var a in o=r[n],o)Object.prototype.hasOwnProperty.call(o,a)&&(t[a]=o[a]);return t},a=function(){function t(t,r){for(var n=0,o;n<r.length;n++)o=r[n],o.enumerable=o.enumerable||!1,o.configurable=!0,'value'in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}return function(r,n,o){return n&&t(r.prototype,n),o&&t(r,o),r}}(),i=function(){function t(r,o,a){var i=this;for(var l in n(this,t),this.id=ur.uid.get(),this.type='conditional',this.selector=r,this.options=a,this.rules=Object.create(null),o)i.createRule(l,o[l])}return a(t,[{key:'createRule',value:function(t,r,n){var a=o({},this.options,{parent:this}),i=a,l=i.sheet,s=i.jss,d=l&&l.getRule(t),p=d?d.className:null;(p||n)&&(a=o({},a,{className:p},n));var c=(l||s).createRule(t,r,a);return this.rules[t]=c,c}},{key:'toString',value:function(){var t=this,r=this.selector+' {\n';for(var n in t.rules){var o=t.rules[n];if(!(o.style&&(0,ur.isEmptyObject)(o.style))){var a=o.toString({indentationLevel:1});r+=a+'\n'}}return r+='}',r}}]),t}();r.default=i}),hr=W(function(t,r){function n(t,r){if(!(t instanceof r))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(r,'__esModule',{value:!0});var o=function(){function t(t,r){for(var n=0,o;n<r.length;n++)o=r[n],o.enumerable=o.enumerable||!1,o.configurable=!0,'value'in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}return function(r,n,o){return n&&t(r.prototype,n),o&&t(r,o),r}}(),a=function(){function t(r,o,a){n(this,t),this.id=ur.uid.get(),this.type='font-face',this.options=a,this.selector=r,this.style=o}return o(t,[{key:'toString',value:function(t){var r=this;if(Array.isArray(this.style)){for(var n='',o=0;o<this.style.length;o++)n+=(0,ur.toCSS)(r.selector,r.style[o],t),r.style[o+1]&&(n+='\n');return n}return(0,ur.toCSS)(this.selector,this.style,t)}}]),t}();r.default=a}),vr=W(function(t,r){function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(r,'__esModule',{value:!0}),r.default=function(t){var r=1>=arguments.length||void 0===arguments[1]?{}:arguments[1],n=2>=arguments.length||void 0===arguments[2]?{}:arguments[2];if(t&&'@'===t[0]){var a=p.exec(t)[0],i=d[a];return new i(t,r,n)}return null==n.named&&(n.named=!0),new o.default(t,r,n)};var o=n(mr),a=n(gr),i=n(yr),l=n(fr),s=n(hr),d={"@charset":a.default,"@import":a.default,"@namespace":a.default,"@keyframes":i.default,"@media":l.default,"@supports":l.default,"@font-face":s.default},p=/^@[^ ]+/}),br=W(function(t,r){function n(t,r){if(!(t instanceof r))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(r,'__esModule',{value:!0});var o=function(){function t(t,r){for(var n=0,o;n<r.length;n++)o=r[n],o.enumerable=o.enumerable||!1,o.configurable=!0,'value'in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}return function(r,n,o){return n&&t(r.prototype,n),o&&t(r,o),r}}(),a=function(){function t(r){n(this,t),this.head=document.head||document.getElementsByTagName('head')[0],this.element=r.element||document.createElement('style'),this.element.type='text/css',r.media&&this.element.setAttribute('media',r.media),r.meta&&this.element.setAttribute('data-meta',r.meta)}return o(t,null,[{key:'style',value:function(t,r,n){try{if(null==n)return t.style[r];t.style[r]=n}catch(t){return!1}return!0}},{key:'setSelector',value:function(t,r){return t.selectorText=r,t.selectorText===r}},{key:'getSelector',value:function(t){return t.selectorText}}]),o(t,[{key:'attach',value:function(){this.element.parendNode||this.head.appendChild(this.element)}},{key:'detach',value:function(){this.element.parentNode.removeChild(this.element)}},{key:'deploy',value:function(t){var r='\n'+t.toString()+'\n';'sheet'in this.element?this.element.innerHTML=r:'styleSheet'in this.element&&(this.element.styleSheet.cssText=r)}},{key:'insertRule',value:function(t){var r=this.element.sheet||this.element.styleSheet,n=r.cssRules||r.rules,o=n.length;return r.insertRule?r.insertRule(t.toString(),o):r.addRule(t.selector,t.toString({selector:!1}),o),n[o]}},{key:'getRules',value:function(){for(var t=this.element.sheet||this.element.styleSheet,r=t.rules||t.cssRules,n=Object.create(null),o=0,a;o<r.length;o++)a=r[o],n[a.selectorText]=a;return n}}]),t}();r.default=a}),xr=W(function(t,r){function n(t,r){if(!(t instanceof r))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(r,'__esModule',{value:!0});var o=function(){function t(t,r){for(var n=0,o;n<r.length;n++)o=r[n],o.enumerable=o.enumerable||!1,o.configurable=!0,'value'in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}return function(r,n,o){return n&&t(r.prototype,n),o&&t(r,o),r}}(),a=function(){function t(){n(this,t)}return o(t,[{key:'attach',value:function(){}},{key:'detach',value:function(){}},{key:'deploy',value:function(){}},{key:'insertRule',value:function(){}},{key:'getRules',value:function(){return{}}}],[{key:'style',value:function(){}},{key:'setSelector',value:function(){}},{key:'getSelector',value:function(){}}]),t}();r.default=a}),Sr=W(function(t,r){function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(r,'__esModule',{value:!0}),r.default=function(){var t=0>=arguments.length||void 0===arguments[0]?{}:arguments[0];return t.Renderer?t.Renderer:t.virtual||'undefined'==typeof document?a.default:o.default};var o=n(br),a=n(xr)}),Cr=W(function(t,r){function n(t){return t&&t.__esModule?t:{default:t}}function o(t,r){if(!(t instanceof r))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(r,'__esModule',{value:!0});var a=Object.assign||function(t){for(var r=arguments,n=1,o;n<arguments.length;n++)for(var a in o=r[n],o)Object.prototype.hasOwnProperty.call(o,a)&&(t[a]=o[a]);return t},i=function(){function t(t,r){for(var n=0,o;n<r.length;n++)o=r[n],o.enumerable=o.enumerable||!1,o.configurable=!0,'value'in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}return function(r,n,o){return n&&t(r.prototype,n),o&&t(r,o),r}}(),l=n(vr),s=n(Sr),d=function(){function t(r,n){var i=this;o(this,t),this.options=a({},n),null==this.options.named&&(this.options.named=!0),this.rules=Object.create(null),this.classes=Object.create(null),this.attached=!1,this.deployed=!1,this.linked=!1;var l=(0,s.default)(this.options);for(var d in this.options.Renderer=l,this.renderer=new l(this.options),r)i.createRule(d,r[d])}return i(t,[{key:'attach',value:function(){return this.attached?this:(this.deployed||this.deploy(),this.renderer.attach(),!this.linked&&this.options.link&&this.link(),this.attached=!0,this)}},{key:'detach',value:function(){return this.attached?(this.renderer.detach(),this.attached=!1,this):this}},{key:'addRule',value:function(t,r){var n=this.createRule(t,r);if(this.deployed){var o=this.renderer.insertRule(n);this.options.link&&(n.renderable=o)}return n}},{key:'addRules',value:function(t){var r=this,n=[];for(var o in t)n.push(r.addRule(o,t[o]));return n}},{key:'getRule',value:function(t){return this.rules[t]}},{key:'toString',value:function(t){var r=this.rules,n=Object.create(null),o='';for(var a in r){var i=r[a];n[i.id]||i.style&&(0,ur.isEmptyObject)(i.style)||i.rules&&(0,ur.isEmptyObject)(i.rules)||(o&&(o+='\n'),o+=i.toString(t),n[i.id]=!0)}return o}},{key:'createRule',value:function(t,r,n){n=a({},n,{sheet:this,jss:this.options.jss,Renderer:this.options.Renderer}),null==n.named&&(n.named=this.options.named);var o=(0,l.default)(t,r,n);return this.registerRule(o),n.jss.plugins.run(o),o}},{key:'registerRule',value:function(t){return t.options.parent?(t.name&&t.className&&(this.classes[t.name]=t.className),this):(t.name&&(this.rules[t.name]=t,t.className&&(this.classes[t.name]=t.className)),t.selector&&(this.rules[t.selector]=t),this)}},{key:'unregisterRule',value:function(t){return t.options.parent||(delete this.rules[t.name],delete this.rules[t.selector]),delete this.classes[t.name],this}},{key:'deploy',value:function(){return this.renderer.deploy(this),this.deployed=!0,this}},{key:'link',value:function(){var t=this,r=this.renderer.getRules();for(var n in r){var o=t.rules[n];o&&(o.renderable=r[n])}return this.linked=!0,this}}]),t}();r.default=d}),kr=W(function(t,r){function n(t,r){if(!(t instanceof r))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(r,'__esModule',{value:!0});var o=function(){function t(t,r){for(var n=0,o;n<r.length;n++)o=r[n],o.enumerable=o.enumerable||!1,o.configurable=!0,'value'in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}return function(r,n,o){return n&&t(r.prototype,n),o&&t(r,o),r}}(),a=function(){function t(){n(this,t),this.registry=[]}return o(t,[{key:'use',value:function(t){this.registry.push(t)}},{key:'run',value:function(t){for(var r=this,n=0;n<this.registry.length;n++)r.registry[n](t)}}]),t}();r.default=a}),Tr=W(function(t,r){function n(t,r){if(!(t instanceof r))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(r,'__esModule',{value:!0});var o=function(){function t(t,r){for(var n=0,o;n<r.length;n++)o=r[n],o.enumerable=o.enumerable||!1,o.configurable=!0,'value'in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}return function(r,n,o){return n&&t(r.prototype,n),o&&t(r,o),r}}(),a=function(){function t(){n(this,t),this.registry=[]}return o(t,[{key:'add',value:function(t){this.registry.push(t)}},{key:'toString',value:function(t){return this.registry.map(function(r){return r.toString(t)}).join('\n')}}]),t}();r.default=a}),Pr=W(function(t,r){function n(t){return t&&t.__esModule?t:{default:t}}function o(t,r){if(!(t instanceof r))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(r,'__esModule',{value:!0});var a='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&'function'==typeof Symbol&&t.constructor===Symbol?'symbol':typeof t},i=Object.assign||function(t){for(var r=arguments,n=1,o;n<arguments.length;n++)for(var a in o=r[n],o)Object.prototype.hasOwnProperty.call(o,a)&&(t[a]=o[a]);return t},l=function(){function t(t,r){for(var n=0,o;n<r.length;n++)o=r[n],o.enumerable=o.enumerable||!1,o.configurable=!0,'value'in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}return function(r,n,o){return n&&t(r.prototype,n),o&&t(r,o),r}}(),s=n(Cr),d=n(kr),p=n(Tr),c=n(vr),_=n(Sr),u=function(){function t(){o(this,t),this.sheets=new p.default,this.plugins=new d.default,this.uid=ur.uid,this.version='3.11.1'}return l(t,[{key:'create',value:function(){return new t}},{key:'createStyleSheet',value:function(t,r){var n=new s.default(t,i({},r,{jss:this}));return this.sheets.add(n),n}},{key:'createRule',value:function(t,r,n){'object'==('undefined'==typeof t?'undefined':a(t))&&(n=r,r=t,t=null);var o=(0,c.default)(t,r,i({},n,{jss:this,Renderer:(0,_.default)(n)}));return this.plugins.run(o),o}},{key:'use',value:function(){for(var t=arguments,r=this,n=arguments.length,o=Array(n),a=0;a<n;a++)o[a]=t[a];return o.forEach(function(t){return r.plugins.use(t)}),this}}]),t}();r.default=u}),Rr=W(function(t,r){function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(r,'__esModule',{value:!0}),r.Rule=r.StyleSheet=r.Jss=void 0;var o=n(Pr),a=n(Cr),i=n(mr),l=new o.default;t.exports=r=l,r.Jss=o.default,r.StyleSheet=a.default,r.Rule=i.default,r.default=l}),Er=H(Rr),wr=W(function(t,r){Object.defineProperty(r,'__esModule',{value:!0});var n=Object.assign||function(t){for(var r=arguments,n=1,o;n<arguments.length;n++)for(var a in o=r[n],o)Object.prototype.hasOwnProperty.call(o,a)&&(t[a]=o[a]);return t};r.default=function(){return function(t){if('regular'===t.type){var r=t.options,a=r.sheet,i=r.jss,l=r.parent,s=a||i,d;for(var p in l&&'conditional'===l.type&&(s=l),t.style)if('&'===p[0]){d||(d=n({},t.options,{named:!1}));var c=p.replace(o,t.selector);s.createRule(c,t.style[p],d),delete t.style[p]}}}};var o=/&/g}),Ar=H(wr),Or=W(function(t,r){Object.defineProperty(r,'__esModule',{value:!0}),r.default=function(){function t(r,n,o){if('string'==typeof o.extend){if(r.options&&r.options.sheet){var a=r.options.sheet.getRule(o.extend);a&&t(r,n,a.originalStyle)}}else if(Array.isArray(o.extend))for(var i=0;i<o.extend.length;i++)t(r,n,o.extend[i]);else for(var l in o.extend)'extend'==l?t(r,n,o.extend.extend):n[l]=o.extend[l];for(var s in o)'extend'!=s&&(n[s]=o[s]);return n}return function(r){r.style&&r.style.extend&&(r.style=t(r,{},r.style))}}}),Mr=H(Or),Lr=W(function(t,r){r.__esModule=!0,r['default']=function(){return function(t){var r=t.style;if(r)for(var o in r)n[o]||'number'!=typeof r[o]||(r[o]+='px')}};var n={"animation-iteration-count":!0,"box-ordinal-group":!0,"column-count":!0,"fill-opacity":!0,flex:!0,"flex-grow":!0,"flex-order":!0,"flex-shrink":!0,"font-weight":!0,"line-height":!0,opacity:!0,order:!0,orphans:!0,"stop-opacity":!0,"tab-size":1,widows:!0,"z-index":!0,zoom:!0};t.exports=r['default']}),zr=H(Lr),Fr='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&'function'==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?'symbol':typeof t},Nr='object'===('undefined'==typeof window?'undefined':Fr(window))&&'object'===('undefined'==typeof document?'undefined':Fr(document))&&9===document.nodeType,Ur=Object.freeze({isBrowser:Nr,default:Nr}),Dr=Ur&&Nr||Ur,Ir=W(function(t,r){Object.defineProperty(r,'__esModule',{value:!0});var n=function(t){return t&&t.__esModule?t:{default:t}}(Dr),o='',a='';if(n['default']){var i={Moz:'-moz-',ms:'-ms-',O:'-o-',Webkit:'-webkit-'},l=document.createElement('p').style;for(var s in i)if(s+'Transform'in l){o=s,a=i[s];break}}r['default']={js:o,css:a}}),Gr=W(function(t,r){function n(t,r){return r?r.toUpperCase():''}Object.defineProperty(r,'__esModule',{value:!0}),r['default']=function(t){return t.replace(o,n)};var o=/[-\s]+(.)?/g}),Vr=W(function(t,r){function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(r,'__esModule',{value:!0}),r['default']=function(t){return s?null==l[t]?(l[t]=(0,i['default'])(t)in s.style?t:!!(a['default'].js+(0,i['default'])('-'+t)in s.style)&&a['default'].css+t,l[t]):l[t]:t};var o=n(Dr),a=n(Ir),i=n(Gr),l={},s;if(o['default']){s=document.createElement('p');var d=window.getComputedStyle(document.documentElement,'');for(var p in d)isNaN(p)||(l[d[p]]=d[p])}}),Br=W(function(t,r){function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(r,'__esModule',{value:!0}),r['default']=function(t,r){if(!l)return r;if('string'!=typeof r||!isNaN(parseInt(r,10)))return r;var n=t+r;if(null!=i[n])return i[n];try{l.style[t]=r}catch(t){return i[n]=!1,!1}return''===l.style[t]?(r=a['default'].css+r,'-ms-flex'===r&&(r='-ms-flexbox'),l.style[t]=r,''!==l.style[t]&&(i[n]=r)):i[n]=r,i[n]||(i[n]=!1),l.style[t]='',i[n]};var o=n(Dr),a=n(Ir),i={},l;o['default']&&(l=document.createElement('p'))}),jr=W(function(t,r){function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(r,'__esModule',{value:!0}),r.supportedValue=r.supportedProperty=r.prefix=void 0;var o=n(Ir),a=n(Vr),i=n(Br);r['default']={prefix:o['default'],supportedProperty:a['default'],supportedValue:i['default']},r.prefix=o['default'],r.supportedProperty=a['default'],r.supportedValue=i['default']}),Hr=W(function(t,r){r.__esModule=!0,r['default']=function(){return function(t){if('keyframe'===t.type)return void(t.selector='@'+n.prefix.css+'keyframes'+t.selector.substr(10));if('regular'===t.type)for(var r in t.style){var o=t.style[r],a=!1,i=n.supportedProperty(r);i&&i!==r&&(a=!0);var l=!1,s=n.supportedValue(i,o);s&&s!==o&&(l=!0),(a||l)&&(a&&delete t.style[r],t.style[i||r]=s||o)}}};var n=function(t){if(t&&t.__esModule)return t;var r={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r['default']=t,r}(jr);t.exports=r['default']}),Wr=H(Hr),Yr=W(function(t,r){function n(t){return'-'+t.toLowerCase()}function o(t){var r={};for(var o in t){var i=t[o];o=o.replace(a,n),r[o]=i}return r}Object.defineProperty(r,'__esModule',{value:!0});var a=/([A-Z])/g;r.default=function(){return function(t){var r=t.style;if(r)if(Array.isArray(r))for(var n=0;n<r.length;n++)r[n]=o(r[n]);else t.style=o(r)}}}),Xr=H(Yr),qr=W(function(t,r){Object.defineProperty(r,'__esModule',{value:!0}),r.default=function(){function t(t,r){return t.length>r.length}return function(r){var n=r.style,o=r.type;if(n&&'regular'===o){var a={},i=Object.keys(n).sort(t);for(var l in i)a[i[l]]=n[i[l]];r.style=a}}}}),Zr=H(qr),Kr=Er.create();Kr.use(Ar()),Kr.use(Mr()),Kr.use(zr()),Kr.use(Wr()),Kr.use(Xr()),Kr.use(Zr());var $r=Date.now;pe.prototype.track=function(t){this.touchHistory[t.identifier]=[t]};var Qr=pe;ce.DEFAULT_OPTIONS={direction:void 0,rails:!1,touchLimit:1,velocitySampleLength:10,scale:1},ce.DIRECTION_X=0,ce.DIRECTION_Y=1;var Jr=8;ce.prototype.setOptions=function(t){return this._optionsManager.setOptions(t)},ce.prototype.getOptions=function(){return this.options};ge.DIRECTION_X=0,ge.DIRECTION_Y=1,ge.DIRECTION_Z=2;var en={};ge.register=function(t){for(var r in t)if(!en[r])en[r]=t[r];else if(en[r]!==t[r])throw new Error('Conflicting sync classes for key: '+r)},ge.prototype.setOptions=function(t){var r=this;for(var n in r._syncs)r._syncs[n].setOptions(t)},ge.prototype.pipeSync=function(t){var r=this._syncs[t];this._eventInput.pipe(r),r.pipe(this._eventOutput)},ge.prototype.unpipeSync=function(t){var r=this._syncs[t];this._eventInput.unpipe(r),r.unpipe(this._eventOutput)},ge.prototype.addSync=function(t){var r=this;if(t instanceof Array)for(var n=0;n<t.length;n++)ye.call(r,t[n]);else if(t instanceof Object)for(var o in t)ye.call(r,o,t[o])};var tn=ge,rn=W(function(t,r){function n(t,r){var n=0;return function(){++n==t&&'function'==typeof r&&r.apply(this,arguments)}}r.callAfter=n,r['default']=n,r.__esModule=!0}),nn=H(rn),on=function(t){function r(r){t.call(this,r),j(this._.defaultOptions,{menuSide:'left',menuWidth:200,menuHintSize:10,pushAreaWidth:40,animationDuration:1e3,animationType:'foldDown',fade:!0,fadeStartColor:'rgba(255,255,255,0)',fadeEndColor:'rgba(255,255,255,1)',blur:!1,blurRadius:5}),this.options=r,this.contentWidth=document.body.clientWidth-this.options.menuHintSize,this.isOpen=!1,this.isOpening=!1,this.isClosing=!1,this.isAnimating=!1,this.isBeingDragged=!1,this.transitionCallback=void 0,tn.register({touch:ce}),this._createComponents(),this._initializeEvents()}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype.setOptions=function(r){t.prototype.setOptions.call(this,r)},r.prototype.resetOptions=function(){t.prototype.resetOptions.call(this)},r.prototype._createComponents=function(){var r=this;this.touchSync=new tn(['touch']),this.alignment='left'==this.options.menuSide?0:1,this.animationTransition=new bt(0),this.mainMol=new t,this.menuMol=new t({size:[this.options.menuWidth,void 0]}),this.menuMol.oldTransform=this.menuMol.transform,this.menuMol.transform=function(){var t=r.animationTransition.get();switch(r.options.animationType){case'foldDown':this.oldTransform.setTranslateX('left'==r.options.menuSide?t*(r.options.menuWidth-r.options.menuHintSize)-(r.options.menuWidth-r.options.menuHintSize):t*-(r.options.menuWidth-r.options.menuHintSize)+(r.options.menuWidth-r.options.menuHintSize));break;case'moveBack':this.oldTransform.setTranslateX('left'==r.options.menuSide?t*(r.options.menuWidth-r.options.menuHintSize)-(r.options.menuWidth-r.options.menuHintSize):t*-(r.options.menuWidth-r.options.menuHintSize)+(r.options.menuWidth-r.options.menuHintSize));}return this.oldTransform.get()}.bind(this.menuMol),this.menuContentMol=new t,this.contentMol=new t({size:[this.contentWidth,void 0]}),this.contentMol.oldTransform=this.contentMol.transform,this.contentMol.transform=function(){var t=r.animationTransition.get();switch(r.options.animationType){case'foldDown':this.oldTransform.setTranslateX('left'==r.options.menuSide?t*(r.options.menuWidth-r.options.menuHintSize)+r.options.menuHintSize:t*-(r.options.menuWidth-r.options.menuHintSize)-r.options.menuHintSize),this.oldTransform.setRotateY('left'==r.options.menuSide?t*at/8:t*-at/8);break;case'moveBack':this.oldTransform.setTranslateX('left'==r.options.menuSide?r.options.menuHintSize:-r.options.menuHintSize),this.oldTransform.setTranslateZ(t*-100);}return this.oldTransform.get()}.bind(this.contentMol),this.menuTouchPlane=new pr({size:[this.options.menuWidth+this.options.pushAreaWidth-this.options.menuHintSize,void 0],properties:{zIndex:'-1000'}}),this.mainMol.setOptions({origin:[this.alignment,0.5],align:[this.alignment,0.5]}),this.menuMol.setOptions({origin:[this.alignment,0.5],align:[this.alignment,0.5]}),this.contentMol.setOptions({origin:[this.alignment,0.5],align:[this.alignment,0.5]}),this.menuTouchPlane.setOptions({origin:[this.alignment,0.5],align:[this.alignment,0.5]}),this.menuContentMol.transform.setTranslateZ(2),this.menuTouchPlane.transform.setTranslateZ(2),this.updateStyles=function(){var t,r;switch(this.options.animationType){case'foldDown':t=this.options.fadeStartColor,r=this.options.fadeEndColor;break;case'moveBack':t=r=this.options.fadeEndColor;}var n={".infamous-fadeLeft":{background:[r,'-moz-linear-gradient(left, '+r+' 0%, '+t+' 100%)','-webkit-gradient(left top, right top, color-stop(0%, '+r+'), color-stop(100%, '+t+'))','-webkit-linear-gradient(left, '+r+' 0%, '+t+' 100%)','-o-linear-gradient(left, '+r+' 0%, '+t+' 100%)','-ms-linear-gradient(left, '+r+' 0%, '+t+' 100%)','linear-gradient(to right, '+r+' 0%, '+t+' 100%)'],filter:'progid:DXImageTransform.Microsoft.gradient( startColorstr=\'#cc000000\', endColorstr=\'#4d000000\', GradientType=1 )'},".infamous-fadeRight":{background:[t,'-moz-linear-gradient(left, '+t+' 0%, '+r+' 100%)','-webkit-gradient(left top, right top, color-stop(0%, '+t+'), color-stop(100%, '+r+'))','-webkit-linear-gradient(left, '+t+' 0%, '+r+' 100%)','-o-linear-gradient(left, '+t+' 0%, '+r+' 100%)','-ms-linear-gradient(left, '+t+' 0%, '+r+' 100%)','linear-gradient(to right, '+t+' 0%, '+r+' 100%)'],filter:'progid:DXImageTransform.Microsoft.gradient( startColorstr=\'#4d000000\', endColorstr=\'#cc000000\', GradientType=1 )'}};this.fadeStylesheet&&this.fadeStylesheet.detach(),this.fadeStylesheet=Kr.createStyleSheet(n),this.fadeStylesheet.attach()},this.options.fade&&(this.updateStyles(),this.fadePlane=new pr({size:[void 0,void 0],classes:['left'==this.options.menuSide?'infamous-fadeRight':'infamous-fadeLeft'],properties:{zIndex:'1000',pointerEvents:'none'}}),this.fadePlane.setOptions({origin:[this.alignment,0.5],align:[this.alignment,0.5]}),this.fadePlane.transform.setTranslateZ(1),this.fadePlane.setOptions({opacity:this.animationTransition}),this.contentMol.add(this.fadePlane)),this.add(this.mainMol),this.mainMol.add(this.contentMol),this.menuMol.add(this.menuTouchPlane),this.menuMol.add(this.menuContentMol),this.mainMol.add(this.menuMol)},r.prototype._initializeEvents=function(){this.options.handler.on('update',function(t){this.isBeingDragged=!0,this._haltAnimation(!0);var r=this.animationTransition.get();switch(this.options.animationType){case'foldDown':this.animationTransition.set(r+t.delta[0]/(this.options.menuWidth-this.options.menuHintSize));break;case'moveBack':this.animationTransition.set(r+t.delta[0]/(this.options.menuWidth-this.options.menuHintSize));}r=this.animationTransition.get(),1<r?this.animationTransition.set(1):0>r&&this.animationTransition.set(0)}.bind(this)),this.options.handler.on('end',function(){this.isBeingDragged=!1;var t=this.animationTransition.get();0.5>t?this.closeMenu():this.openMenu()}.bind(this)),window.addEventListener('resize',function(){this.contentWidth=document.body.clientWidth-this.options.menuHintSize,this.contentMol.setOptions({size:[this.contentWidth,void 0]})}.bind(this)),this.menuTouchPlane.pipe(this.touchSync),this.menuTouchPlane.on('mouseenter',function(){this.isOpening||this.openMenu()}.bind(this)),this.menuTouchPlane.on('mouseleave',function(){this.isClosing||this.closeMenu()}.bind(this)),this.touchSync.pipe(this.options.handler)},r.prototype.setContent=function(t){this.contentMol.add(t)},r.prototype.setMenu=function(r){this.menuContentMol.add(r),r instanceof t&&(r.pipe(this.touchSync),r.on('mouseenter',function(){this.isOpening||this.openMenu()}.bind(this)),r.on('mouseleave',function(){this.isClosing||this.closeMenu()}.bind(this)))},r.prototype.openMenu=function(t,r){this._haltAnimation(r),this.isClosing=!1,this.isOpening=!0,this._animate('open',t)},r.prototype.closeMenu=function(t,r){this._haltAnimation(r),this.isClosing=!0,this.isOpening=!1,this._animate('close',t)},r.prototype.toggleMenu=function(t,r){this.isOpen||this.isOpening?this.closeMenu(t,r):(!this.isOpen||this.isClosing)&&this.openMenu(t,r)},r.prototype._animate=function(t,r){this.isAnimating=!0,this.transitionCallback=r;var n=this,o;(function(r){o=nn(r,function(){n.isAnimating=n.isOpening=n.isClosing=!1,n.isOpen='open'==t,'function'==typeof n.transitionCallback&&n.transitionCallback(),n.transitionCallback=void 0}.bind(n))})(1),'open'==t?this.animationTransition.set(1,{duration:this.options.animationDuration,curve:St.outExpo},o):'close'==t&&this.animationTransition.set(0,{duration:this.options.animationDuration,curve:St.outExpo},o)},r.prototype._haltAnimation=function(t){this.isAnimating&&(!t&&'function'==typeof this.transitionCallback&&this.transitionCallback(),this.transitionCallback=void 0,this.animationTransition.halt())},r.prototype.render=function(){if(this.options.blur&&this.options.fade&&'moveBack'==this.options.animationType){var r=this.animationTransition.get()*this.options.blurRadius,n={"-webkit-filter":'blur('+r+'px)',"-moz-filter":'blur('+r+'px)',"-ms-filter":'blur('+r+'px)',"-o-filter":'blur('+r+'px)',filter:'blur('+r+'px)'};this.contentMol._child[1].get()instanceof dr?this.contentMol.get().setProperties(n):this.contentMol._child[1]instanceof pr&&this.contentMol._child[1].surface.setProperties(n)}return t.prototype.render.call(this)},r}(Qt),an=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],ln=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],sn=null;xe(),xe();var dn=function(t){function r(n){var o=arguments.length;if(0===o)t.call(this,[1,0,0,1,0,0]);else if(1!==o)throw new Error('Wrong number of arguments to DOMMatrix constructor.');else if('string'==typeof n)throw new Error('CSS transformList arg not yet implemented.');else n instanceof r?t.call(this,n._matrix):(n instanceof Float32Array||n instanceof Float64Array||n instanceof Array)&&t.call(this,n)}t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r;var n={a:{},b:{},c:{},d:{},e:{},f:{},m11:{},m12:{},m13:{},m14:{},m21:{},m22:{},m23:{},m24:{},m31:{},m32:{},m33:{},m34:{},m41:{},m42:{},m43:{},m44:{}};return r.prototype.multiplySelf=function(t){if(!(t instanceof r))throw new Error('The argument to multiplySelf must be an instance of DOMMatrix');return fe(this,t,this),t.is2D||(this._is2D=!1),this},r.prototype.preMultiplySelf=function(t){if(!(t instanceof r))throw new Error('The argument to multiplySelf must be an instance of DOMMatrix');return fe(t,this,this),t.is2D||(this._is2D=!1),this},r.prototype.translateSelf=function(t,n,o){if(void 0===o&&(o=0),1===arguments.length)throw new Error('The first two arguments (X and Y translation values) are required (the third, Z translation, is optional).');var a=new r([1,0,0,0,0,1,0,0,0,0,1,0,t,n,o,1]);return this.multiplySelf(a),0!=o&&(this._is2D=!1),this},r.prototype.scaleSelf=function(t,n,o){return void 0===n&&(n=0),void 0===o&&(o=0),this.translateSelf(n,o),this.multiplySelf(new r([t,0,0,t,0,0])),this.translateSelf(-n,-o),this},r.prototype.scale3dSelf=function(t,n,o,a){return void 0===n&&(n=0),void 0===o&&(o=0),void 0===a&&(a=0),this.translateSelf(n,o,a),this.multiplySelf(new r([t,0,0,0,0,t,0,0,0,0,t,0,0,0,0,1])),this.translateSelf(-n,-o,-a),this},r.prototype.scaleNonUniformSelf=function(t,n,o,a,i,l){return void 0===n&&(n=1),void 0===o&&(o=1),void 0===a&&(a=0),void 0===i&&(i=0),void 0===l&&(l=0),this.translateSelf(a,i,l),this.multiplySelf(new r([t,0,0,0,0,n,0,0,0,0,o,0,0,0,0,1])),this.translateSelf(-a,-i,-l),(1!==o||0!==l)&&(this._is2D=!1),this},r.prototype.rotateSelf=function(t,r,n){void 0===r&&(r=0),void 0===n&&(n=0),this.translateSelf(r,n);var o=[0,0,1],a=o[0],i=o[1],l=o[2];return this.rotateAxisAngleSelf(a,i,l,t),this.translateSelf(-r,-n),this},r.prototype.rotateFromVectorSelf=function(){throw new Error('rotateFromVectorSelf is not implemented yet.')},r.prototype.rotateAxisAngleSelf=function(t,n,o,a){var i=new r(ve(t,n,o,a));return this.multiplySelf(i),this},r.prototype.skewXSelf=function(){throw new Error('skewXSelf is not implemented yet.')},r.prototype.skewYSelf=function(){throw new Error('skewYSelf is not implemented yet.')},r.prototype.invertSelf=function(){throw new Error('invertSelf is not implemented yet.')},r.prototype.setMatrixValue=function(){throw new Error('setMatrixValue is not implemented yet.')},n.a.get=function(){return this.m11},n.b.get=function(){return this.m12},n.c.get=function(){return this.m21},n.d.get=function(){return this.m22},n.e.get=function(){return this.m41},n.f.get=function(){return this.m42},n.m11.get=function(){return this._matrix[0]},n.m12.get=function(){return this._matrix[4]},n.m13.get=function(){return this._matrix[8]},n.m14.get=function(){return this._matrix[12]},n.m21.get=function(){return this._matrix[1]},n.m22.get=function(){return this._matrix[5]},n.m23.get=function(){return this._matrix[9]},n.m24.get=function(){return this._matrix[13]},n.m31.get=function(){return this._matrix[2]},n.m32.get=function(){return this._matrix[6]},n.m33.get=function(){return this._matrix[10]},n.m34.get=function(){return this._matrix[14]},n.m41.get=function(){return this._matrix[3]},n.m42.get=function(){return this._matrix[7]},n.m43.get=function(){return this._matrix[11]},n.m44.get=function(){return this._matrix[15]},n.a.set=function(t){this.m11=t},n.b.set=function(t){this.m12=t},n.c.set=function(t){this.m21=t},n.d.set=function(t){this.m22=t},n.e.set=function(t){this.m41=t},n.f.set=function(t){this.m42=t},n.m11.set=function(t){this._matrix[0]=t},n.m12.set=function(t){this._matrix[4]=t},n.m13.set=function(t){this._matrix[8]=t},n.m14.set=function(t){this._matrix[12]=t},n.m21.set=function(t){this._matrix[1]=t},n.m22.set=function(t){this._matrix[5]=t},n.m23.set=function(t){this._matrix[9]=t},n.m24.set=function(t){this._matrix[13]=t},n.m31.set=function(t){this._matrix[2]=t},n.m32.set=function(t){this._matrix[6]=t},n.m33.set=function(t){this._matrix[10]=t},n.m34.set=function(t){this._matrix[14]=t},n.m41.set=function(t){this._matrix[3]=t},n.m42.set=function(t){this._matrix[7]=t},n.m43.set=function(t){this._matrix[11]=t},n.m44.set=function(t){this._matrix[15]=t},Object.defineProperties(r.prototype,n),r}(sn),pn=function(t){if(!_n){_n=new WeakMap;var r={};return _n.set(t,r),r}var n=_n.get(t);return void 0===n&&(n={},_n.set(t,n)),n},_=function(t,r,n,o){if(1===arguments.length){if(!Se(t))throw new TypeError('Expected an object with x, y, z, and w properties');pn(this).x=t.x,pn(this).y=t.y,pn(this).z=t.z,pn(this).w=t.w}else if(4===arguments.length)pn(this).x=t||0,pn(this).y=r||0,pn(this).z=n||0,pn(this).w=o||0;else throw new TypeError('Expected 1 or 4 arguments')},cn={x:{},y:{},z:{},w:{}},_n;cn.x.get=function(){return pn(this).x},cn.y.get=function(){return pn(this).y},cn.z.get=function(){return pn(this).z},cn.w.get=function(){return pn(this).w},_.prototype.matrixTransform=function(){var t=new this.constructor(this);return t},_.fromPoint=function(t){return new this(t)},Object.defineProperties(_.prototype,cn);var un=function(t){function r(){t.apply(this,arguments)}t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r;var n={x:{},y:{},z:{},w:{}};return n.x.set=function(t){pn(this).x=t},n.y.set=function(t){pn(this).y=t},n.z.set=function(t){pn(this).z=t},n.w.set=function(t){pn(this).w=t},Object.defineProperties(r.prototype,n),r}(_),mn=null;'undefined'==typeof window?'undefined'!=typeof global&&(mn=global):mn=window,mn&&(mn.DOMMatrix=dn,mn.DOMMatrixReadOnly=sn,mn.DOMPoint=un,mn.DOMPointReadOnly=_);var gn=Symbol('instanceofSymbol'),yn=function(t){var r=function(t){function r(r){void 0===r&&(r={}),t.call(this,r)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype.on=function(t,r){if(this._eventMap||(this._eventMap=new Map),this._eventMap.has(t)||this._eventMap.set(t,[]),'function'==typeof r)this._eventMap.get(t).push(r);else throw new Error('Expected a function in callback argument of Observable#on.')},r.prototype.off=function(t,r){if(this._eventMap&&this._eventMap.has(t)){var n=this._eventMap.get(t);-1===n.indexOf(r)||(n.splice(n.indexOf(r),1),0===n.length&&this._eventMap.delete(t),0===this._eventMap.size&&(this._eventMap=null))}},r.prototype.triggerEvent=function(t,r){if(this._eventMap&&this._eventMap.has(t))for(var n=this._eventMap.get(t),o=0,a=n.length;o<a;o+=1)n[o](r)},r}(t);return Object.defineProperty(r,Symbol.hasInstance,{value:function(t){if(this!==r)return Object.getPrototypeOf(r)[Symbol.hasInstance].call(this,t);for(var n=t,o;n;){if(o=Object.getOwnPropertyDescriptor(n,'constructor'),o&&o.value&&o.value.hasOwnProperty(gn))return!0;n=Object.getPrototypeOf(n)}return!1}}),r[gn]=!0,r},fn=yn(function(){return function(){}}());fn.mixin=yn;var hn=function(t){function r(r,n,o){void 0===r&&(r=0),void 0===n&&(n=0),void 0===o&&(o=0),t.call(this),this._x=r,this._y=n,this._z=o}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r}(fn);Object.defineProperties(hn.prototype,{x:{set:function(t){this._x=t,this.triggerEvent('valuechanged',{x:t})},get:function(){return this._x},configurable:!0,enumerable:!0},y:{set:function(t){this._y=t,this.triggerEvent('valuechanged',{y:t})},get:function(){return this._y},configurable:!0,enumerable:!0},z:{set:function(t){this._z=t,this.triggerEvent('valuechanged',{z:t})},get:function(){return this._z},configurable:!0,enumerable:!0}});var vn=null,bn=null,xn='function'==typeof Element.prototype.createShadowRoot&&'function'==typeof HTMLContentElement,Sn='function'==typeof Element.prototype.attachShadow&&'function'==typeof HTMLSlotElement,Cn=Object.freeze({epsilon:function(t){return 1e-6>it(t)?0:t},applyCSSLabel:function(t,r){return 0===t?'0px':'%'===r?100*t+'%':'px'===r?t+'px':void 0},animationFrame:function(){var t=null,r=new Promise(function(n){return t=n});return window.requestAnimationFrame(t),r},makeLowercaseSetterAliases:Ce,observeChildren:ke,getShadowRootVersion:function(t){if(console.log('getShadowRootVersion'),!t)return null;var r=document.createElement('slot');t.appendChild(r),r.appendChild(document.createElement('div'));var n=r.assignedNodes({flatten:!0});return r.remove(),console.log('hmm',n.length,0<n.length?'v1':'v0'),0<n.length?'v1':'v0'},hasShadowDomV0:xn,hasShadowDomV1:Sn,getAncestorShadowRoot:Pe,traverse:Re}),kn=Symbol('instanceofSymbol'),Tn=function(t){var r=function(t){function r(r){void 0===r&&(r={}),t.call(this,r),this._parent=null,this._children=[]}t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r;var n={parent:{},children:{},childCount:{}};return n.parent.get=function(){return this._parent},n.children.get=function(){return[].concat(this._children)},r.prototype.addChild=function(t){if(!(t instanceof r))throw new TypeError('TreeNode.addChild expects the childNode argument to be a TreeNode instance.');if(t._parent===this)throw new ReferenceError('childNode is already a child of this parent.');return t._parent&&t._parent.removeChild(t),t._parent=this,this._children.push(t),this},r.prototype.addChildren=function(t){var r=this;return t.forEach(function(t){return r.addChild(t)}),this},r.prototype.removeChild=function(t){if(!(t instanceof r))throw new Error('\n TreeNode.removeChild expects the childNode argument to be an\n instance of TreeNode. There should only be TreeNodes in the\n tree.\n ');if(t._parent!==this)throw new ReferenceError('childNode is not a child of this parent.');return t._parent=null,this._children.splice(this._children.indexOf(t),1),this},r.prototype.removeChildren=function(t){var r=this;return t.forEach(function(t){return r.removeChild(t)}),this},r.prototype.removeAllChildren=function(){return this.removeChildren(this._children),this},n.childCount.get=function(){return this._children.length},Object.defineProperties(r.prototype,n),r}(t);return Object.defineProperty(r,Symbol.hasInstance,{value:function(t){if(this!==r)return Object.getPrototypeOf(r)[Symbol.hasInstance].call(this,t);for(var n=t,o;n;){if(o=Object.getOwnPropertyDescriptor(n,'constructor'),o&&o.value&&o.value.hasOwnProperty(kn))return!0;n=Object.getPrototypeOf(n)}return!1}}),r[kn]=!0,r},Pn=Tn(function(){return function(){}}());Pn.mixin=Tn;var Rn=W(function(t){!function(r){function n(t,r,n,o){var i=r&&r.prototype instanceof a?r:a,l=Object.create(i.prototype),s=new m(o||[]);return l._invoke=p(t,n,s),l}function o(t,r,n){try{return{type:'normal',arg:t.call(r,n)}}catch(t){return{type:'throw',arg:t}}}function a(){}function i(){}function l(){}function s(t){['next','throw','return'].forEach(function(r){t[r]=function(t){return this._invoke(r,t)}})}function d(t){function n(r,a,i,l){var s=o(t[r],t,a);if('throw'===s.type)l(s.arg);else{var d=s.arg,p=d.value;return p&&'object'==typeof p&&h.call(p,'__await')?Promise.resolve(p.__await).then(function(t){n('next',t,i,l)},function(t){n('throw',t,i,l)}):Promise.resolve(p).then(function(t){d.value=t,i(d)},l)}}'object'==typeof r.process&&r.process.domain&&(n=r.process.domain.bind(n));var a;this._invoke=function(t,r){function o(){return new Promise(function(o,a){n(t,r,o,a)})}return a=a?a.then(o,o):o()}}function p(t,r,n){var a=T;return function(i,l){if(a==R)throw new Error('Generator is already running');if(a==E){if('throw'===i)throw l;return y()}for(n.method=i,n.arg=l;;){var s=n.delegate;if(s){var d=c(s,n);if(d){if(d===w)continue;return d}}if('next'===n.method)n.sent=n._sent=n.arg;else if('throw'===n.method){if(a==T)throw a=E,n.arg;n.dispatchException(n.arg)}else'return'===n.method&&n.abrupt('return',n.arg);a=R;var p=o(t,r,n);if('normal'===p.type){if(a=n.done?E:P,p.arg===w)continue;return{value:p.arg,done:n.done}}'throw'===p.type&&(a=E,n.method='throw',n.arg=p.arg)}}}function c(t,r){var n=t.iterator[r.method];if(void 0===n){if(r.delegate=null,'throw'===r.method){if(t.iterator.return&&(r.method='return',r.arg=void 0,c(t,r),'throw'===r.method))return w;r.method='throw',r.arg=new TypeError('The iterator does not provide a \'throw\' method')}return w}var a=o(n,t.iterator,r.arg);if('throw'===a.type)return r.method='throw',r.arg=a.arg,r.delegate=null,w;var i=a.arg;if(!i)return r.method='throw',r.arg=new TypeError('iterator result is not an object'),r.delegate=null,w;if(i.done)r[t.resultName]=i.value,r.next=t.nextLoc,'return'!==r.method&&(r.method='next',r.arg=void 0);else return i;return r.delegate=null,w}function _(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function u(t){var r=t.completion||{};r.type='normal',delete r.arg,t.completion=r}function m(t){this.tryEntries=[{tryLoc:'root'}],t.forEach(_,this),this.reset(!0)}function g(t){if(t){var r=t[x];if(r)return r.call(t);if('function'==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function r(){for(;++n<t.length;)if(h.call(t,n))return r.value=t[n],r.done=!1,r;return r.value=void 0,r.done=!0,r};return o.next=o}}return{next:y}}function y(){return{value:void 0,done:!0}}var f=Object.prototype,h=f.hasOwnProperty,v='function'==typeof Symbol?Symbol:{},x=v.iterator||'@@iterator',S=v.asyncIterator||'@@asyncIterator',C=v.toStringTag||'@@toStringTag',k=r.regeneratorRuntime;if(k)return void(t.exports=k);k=r.regeneratorRuntime=t.exports,k.wrap=n;var T='suspendedStart',P='suspendedYield',R='executing',E='completed',w={},A={};A[x]=function(){return this};var O=Object.getPrototypeOf,M=O&&O(O(g([])));M&&M!==f&&h.call(M,x)&&(A=M);var L=l.prototype=a.prototype=Object.create(A);i.prototype=L.constructor=l,l.constructor=i,l[C]=i.displayName='GeneratorFunction',k.isGeneratorFunction=function(t){var r='function'==typeof t&&t.constructor;return!!r&&(r===i||'GeneratorFunction'===(r.displayName||r.name))},k.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,!(C in t)&&(t[C]='GeneratorFunction')),t.prototype=Object.create(L),t},k.awrap=function(t){return{__await:t}},s(d.prototype),d.prototype[S]=function(){return this},k.AsyncIterator=d,k.async=function(t,r,o,a){var i=new d(n(t,r,o,a));return k.isGeneratorFunction(r)?i:i.next().then(function(t){return t.done?t.value:i.next()})},s(L),L[C]='Generator',L[x]=function(){return this},L.toString=function(){return'[object Generator]'},k.keys=function(t){var r=[];for(var n in t)r.push(n);return r.reverse(),function n(){for(;r.length;){var o=r.pop();if(o in t)return n.value=o,n.done=!1,n}return n.done=!0,n}},k.values=g,m.prototype={constructor:m,reset:function(t){var r=this;if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method='next',this.arg=void 0,this.tryEntries.forEach(u),!t)for(var n in r)'t'===n.charAt(0)&&h.call(r,n)&&!isNaN(+n.slice(1))&&(r[n]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0],r=t.completion;if('throw'===r.type)throw r.arg;return this.rval},dispatchException:function(t){function r(r,n){return l.type='throw',l.arg=t,o.next=r,n&&(o.method='next',o.arg=void 0),!!n}var n=this;if(this.done)throw t;for(var o=this,a=this.tryEntries.length-1;0<=a;--a){var i=n.tryEntries[a],l=i.completion;if('root'===i.tryLoc)return r('end');if(i.tryLoc<=n.prev){var s=h.call(i,'catchLoc'),d=h.call(i,'finallyLoc');if(s&&d){if(n.prev<i.catchLoc)return r(i.catchLoc,!0);if(n.prev<i.finallyLoc)return r(i.finallyLoc)}else if(s){if(n.prev<i.catchLoc)return r(i.catchLoc,!0);}else if(!d)throw new Error('try statement without catch or finally');else if(n.prev<i.finallyLoc)return r(i.finallyLoc)}}},abrupt:function(t,r){for(var n=this,o=this.tryEntries.length-1,a;0<=o;--o)if(a=n.tryEntries[o],a.tryLoc<=n.prev&&h.call(a,'finallyLoc')&&n.prev<a.finallyLoc){var i=a;break}i&&('break'===t||'continue'===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var l=i?i.completion:{};return l.type=t,l.arg=r,i?(this.method='next',this.next=i.finallyLoc,w):this.complete(l)},complete:function(t,r){if('throw'===t.type)throw t.arg;return'break'===t.type||'continue'===t.type?this.next=t.arg:'return'===t.type?(this.rval=this.arg=t.arg,this.method='return',this.next='end'):'normal'===t.type&&r&&(this.next=r),w},finish:function(t){for(var r=this,n=this.tryEntries.length-1,o;0<=n;--n)if(o=r.tryEntries[n],o.finallyLoc===t)return r.complete(o.completion,o.afterLoc),u(o),w},catch:function(t){for(var r=this,n=this.tryEntries.length-1,o;0<=n;--n)if(o=r.tryEntries[n],o.tryLoc===t){var a=o.completion;if('throw'===a.type){var i=a.arg;u(o)}return i}throw new Error('illegal catch attempt')},delegateYield:function(t,r,n){return this.delegate={iterator:g(t),resultName:r,nextLoc:n},'next'===this.method&&(this.arg=void 0),w}}}('object'==typeof Jt?Jt:'object'==typeof window?window:'object'==typeof self?self:Jt)}),En='object'==typeof Jt?Jt:'object'==typeof window?window:'object'==typeof self?self:Jt,g=En.regeneratorRuntime&&0<=Object.getOwnPropertyNames(En).indexOf('regeneratorRuntime'),wn=g&&En.regeneratorRuntime;En.regeneratorRuntime=void 0;if(g)En.regeneratorRuntime=wn;else try{delete En.regeneratorRuntime}catch(t){En.regeneratorRuntime=void 0}var An=function(t){return isNaN(t=+t)?0:(0<t?nt:et)(t)},On=function(t){if(void 0==t)throw TypeError('Can\'t call method on '+t);return t},Mn=!0,Ln=W(function(t){var r=t.exports='undefined'!=typeof window&&window.Math==Math?window:'undefined'!=typeof self&&self.Math==Math?self:Function('return this')();'number'==typeof __g&&(__g=r)}),zn=W(function(t){var r=t.exports={version:'2.4.0'};'number'==typeof __e&&(__e=r)}),Fn=function(t){if('function'!=typeof t)throw TypeError(t+' is not a function!');return t},Nn=function(t,r,n){return(Fn(t),void 0===r)?t:1===n?function(n){return t.call(r,n)}:2===n?function(n,o){return t.call(r,n,o)}:3===n?function(n,o,a){return t.call(r,n,o,a)}:function(){return t.apply(r,arguments)}},Un=function(t){return'object'==typeof t?null!==t:'function'==typeof t},Dn=function(t){if(!Un(t))throw TypeError(t+' is not an object!');return t},In=function(t){try{return!!t()}catch(t){return!0}},Gn=!In(function(){return 7!=Object.defineProperty({},'a',{get:function(){return 7}}).a}),Vn=Ln.document,Bn=Un(Vn)&&Un(Vn.createElement),jn=function(t){return Bn?Vn.createElement(t):{}},Hn=!Gn&&!In(function(){return 7!=Object.defineProperty(jn('div'),'a',{get:function(){return 7}}).a}),Wn=function(t,r){if(!Un(t))return t;var n,o;if(r&&'function'==typeof(n=t.toString)&&!Un(o=n.call(t)))return o;if('function'==typeof(n=t.valueOf)&&!Un(o=n.call(t)))return o;if(!r&&'function'==typeof(n=t.toString)&&!Un(o=n.call(t)))return o;throw TypeError('Can\'t convert object to primitive value')},Yn=Object.defineProperty,Xn=Gn?Object.defineProperty:function(t,r,n){if(Dn(t),r=Wn(r,!0),Dn(n),Hn)try{return Yn(t,r,n)}catch(t){}if('get'in n||'set'in n)throw TypeError('Accessors not supported!');return'value'in n&&(t[r]=n.value),t},qn={f:Xn},Zn=function(t,r){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:r}},Kn=Gn?function(t,r,n){return qn.f(t,r,Zn(1,n))}:function(t,r,n){return t[r]=n,t},$n='prototype',Qn=function(t,r,n){var o=t&Qn.F,a=t&Qn.G,i=t&Qn.S,l=t&Qn.P,s=t&Qn.B,d=t&Qn.W,p=a?zn:zn[r]||(zn[r]={}),c=p[$n],_=a?Ln:i?Ln[r]:(Ln[r]||{})[$n],u,m,g;for(u in a&&(n=r),n)(m=!o&&_&&void 0!==_[u],!(m&&u in p))&&(g=m?_[u]:n[u],p[u]=a&&'function'!=typeof _[u]?n[u]:s&&m?Nn(g,Ln):d&&_[u]==g?function(t){var r=function(r,n,o){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(r);case 2:return new t(r,n);}return new t(r,n,o)}return t.apply(this,arguments)};return r[$n]=t[$n],r}(g):l&&'function'==typeof g?Nn(Function.call,g):g,l&&((p.virtual||(p.virtual={}))[u]=g,t&Qn.R&&c&&!c[u]&&Kn(c,u,g)))};Qn.F=1,Qn.G=2,Qn.S=4,Qn.P=8,Qn.B=16,Qn.W=32,Qn.U=64,Qn.R=128;var Jn=Qn,eo={}.hasOwnProperty,to=function(t,r){return eo.call(t,r)},ro={},no={}.toString,oo=function(t){return no.call(t).slice(8,-1)},ao=Object('z').propertyIsEnumerable(0)?Object:function(t){return'String'==oo(t)?t.split(''):Object(t)},io=function(t){return ao(On(t))},lo=function(t){return 0<t?Je(An(t),9007199254740991):0},so=function(t,r){return t=An(t),0>t?tt(t+r,0):Je(t,r)},po='__core-js_shared__',co=Ln[po]||(Ln[po]={}),_o=function(t){return co[t]||(co[t]={})},uo=0,mo=Math.random(),go=function(t){return'Symbol('.concat(void 0===t?'':t,')_',(++uo+mo).toString(36))},yo=_o('keys'),fo=function(t){return yo[t]||(yo[t]=go(t))},ho=function(t){return function(r,n,o){var a=io(r),i=lo(a.length),l=so(o,i),s;if(t&&n!=n){for(;i>l;)if(s=a[l++],s!=s)return!0;}else for(;i>l;l++)if((t||l in a)&&a[l]===n)return t||l||0;return!t&&-1}}(!1),vo=fo('IE_PROTO'),bo=function(t,r){var n=io(t),o=0,a=[],i;for(i in n)i!=vo&&to(n,i)&&a.push(i);for(;r.length>o;)to(n,i=r[o++])&&(~ho(a,i)||a.push(i));return a},xo=['constructor','hasOwnProperty','isPrototypeOf','propertyIsEnumerable','toLocaleString','toString','valueOf'],So=Object.keys||function(t){return bo(t,xo)},Co=Gn?Object.defineProperties:function(t,r){Dn(t);for(var n=So(r),o=n.length,a=0,i;o>a;)qn.f(t,i=n[a++],r[i]);return t},ko=Ln.document&&document.documentElement,To=fo('IE_PROTO'),Po=function(){},Ro='prototype',Eo=function(){var t=jn('iframe'),r=xo.length,n='<',o='>',a;for(t.style.display='none',ko.appendChild(t),t.src='javascript:',a=t.contentWindow.document,a.open(),a.write(n+'script'+o+'document.F=Object'+n+'/script'+o),a.close(),Eo=a.F;r--;)delete Eo[Ro][xo[r]];return Eo()},wo=Object.create||function(t,r){var n;return null===t?n=Eo():(Po[Ro]=Dn(t),n=new Po,Po[Ro]=null,n[To]=t),void 0===r?n:Co(n,r)},Ao=W(function(t){var r=_o('wks'),n=Ln.Symbol,o='function'==typeof n,a=t.exports=function(t){return r[t]||(r[t]=o&&n[t]||(o?n:go)('Symbol.'+t))};a.store=r}),Oo=qn.f,Mo=Ao('toStringTag'),Lo=function(t,r,n){t&&!to(t=n?t:t.prototype,Mo)&&Oo(t,Mo,{configurable:!0,value:r})},zo={};Kn(zo,Ao('iterator'),function(){return this});var Fo=function(t,r,n){t.prototype=wo(zo,{next:Zn(1,n)}),Lo(t,r+' Iterator')},No=function(t){return Object(On(t))},Uo=fo('IE_PROTO'),Do=Object.prototype,Io=Object.getPrototypeOf||function(t){return t=No(t),to(t,Uo)?t[Uo]:'function'==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?Do:null},Go=Ao('iterator'),Vo=!([].keys&&'next'in[].keys()),Bo='keys',jo='values',Ho=function(){return this},Wo=function(t,r,n,o,a,i,l){Fo(n,r,o);var s=function(t){return!Vo&&t in _?_[t]:t===Bo?function(){return new n(this,t)}:t===jo?function(){return new n(this,t)}:function(){return new n(this,t)}},d=r+' Iterator',p=a==jo,c=!1,_=t.prototype,u=_[Go]||_['@@iterator']||a&&_[a],m=u||s(a),g=a?p?s('entries'):m:void 0,y='Array'==r?_.entries||u:u,f,h,v;if(y&&(v=Io(y.call(new t)),v!==Object.prototype&&(Lo(v,d,!0),!Mn)),p&&u&&u.name!==jo&&(c=!0,m=function(){return u.call(this)}),l&&(Vo||c||!_[Go])&&Kn(_,Go,m),ro[r]=m,ro[d]=Ho,a)if(f={values:p?m:s(jo),keys:i?m:s(Bo),entries:g},l)for(h in f)h in _||Kn(_,h,f[h]);else Jn(Jn.P+Jn.F*(Vo||c),r,f);return f},Yo=function(t){return function(r,n){var o=On(r)+'',s=An(n),i=o.length,l,a;return 0>s||s>=i?t?'':void 0:(l=o.charCodeAt(s),55296>l||56319<l||s+1===i||56320>(a=o.charCodeAt(s+1))||57343<a?t?o.charAt(s):l:t?o.slice(s,s+2):(l-55296<<10)+(a-56320)+65536)}}(!0);Wo(String,'String',function(t){this._t=t+'',this._i=0},function(){var t=this._t,r=this._i,n;return r>=t.length?{value:void 0,done:!0}:(n=Yo(t,r),this._i+=n.length,{value:n,done:!1})});var Xo=function(){},qo=function(t,r){return{value:r,done:!!t}},Zo=Wo(Array,'Array',function(t,r){this._t=io(t),this._i=0,this._k=r},function(){var t=this._t,r=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,qo(1)):'keys'==r?qo(0,n):'values'==r?qo(0,t[n]):qo(0,[n,t[n]])},'values');ro.Arguments=ro.Array,Xo('keys'),Xo('values'),Xo('entries');for(var Ko=Ao('toStringTag'),$o=['NodeList','DOMTokenList','MediaList','StyleSheetList','CSSRuleList'],Qo=0;5>Qo;Qo++){var i=$o[Qo],Jo=Ln[i],ea=Jo&&Jo.prototype;ea&&!ea[Ko]&&Kn(ea,Ko,i),ro[i]=ro.Array}var ta=Ao('toStringTag'),ra='Arguments'==oo(function(){return arguments}()),na=function(t,r){try{return t[r]}catch(t){}},oa=function(t){var r,n,o;return void 0===t?'Undefined':null===t?'Null':'string'==typeof(n=na(r=Object(t),ta))?n:ra?oo(r):'Object'==(o=oo(r))&&'function'==typeof r.callee?'Arguments':o},aa=function(t,r,n,o){if(!(t instanceof r)||void 0!==o&&o in t)throw TypeError(n+': incorrect invocation!');return t},ia=function(t,r,n,o){try{return o?r(Dn(n)[0],n[1]):r(n)}catch(r){var a=t['return'];throw void 0!==a&&Dn(a.call(t)),r}},la=Ao('iterator'),sa=Array.prototype,da=function(t){return void 0!==t&&(ro.Array===t||sa[la]===t)},pa=Ao('iterator'),ca=zn.getIteratorMethod=function(t){if(void 0!=t)return t[pa]||t['@@iterator']||ro[oa(t)]},_a=W(function(t){var r={},n={},o=t.exports=function(t,o,a,i,l){var s=l?function(){return t}:ca(t),d=Nn(a,i,o?2:1),p=0,c,_,u,m;if('function'!=typeof s)throw TypeError(t+' is not iterable!');if(da(s)){for(c=lo(t.length);c>p;p++)if(m=o?d(Dn(_=t[p])[0],_[1]):d(t[p]),m===r||m===n)return m;}else for(u=s.call(t);!(_=u.next()).done;)if(m=ia(u,d,_.value,o),m===r||m===n)return m};o.BREAK=r,o.RETURN=n}),ua=Ao('species'),ma=function(t,r){var n=Dn(t).constructor,o;return void 0===n||void 0==(o=Dn(n)[ua])?r:Fn(o)},ga=function(t,r,n){var o=void 0===n;switch(r.length){case 0:return o?t():t.call(n);case 1:return o?t(r[0]):t.call(n,r[0]);case 2:return o?t(r[0],r[1]):t.call(n,r[0],r[1]);case 3:return o?t(r[0],r[1],r[2]):t.call(n,r[0],r[1],r[2]);case 4:return o?t(r[0],r[1],r[2],r[3]):t.call(n,r[0],r[1],r[2],r[3]);}return t.apply(n,r)},ya=Ln.process,fa=Ln.setImmediate,ha=Ln.clearImmediate,va=Ln.MessageChannel,ba=0,xa={},Sa='onreadystatechange',Ca=function(){var t=+this;if(xa.hasOwnProperty(t)){var r=xa[t];delete xa[t],r()}},ka=function(t){Ca.call(t.data)},Ta,Pa,Ra;fa&&ha||(fa=function(t){for(var r=arguments,n=[],o=1;arguments.length>o;)n.push(r[o++]);return xa[++ba]=function(){ga('function'==typeof t?t:Function(t),n)},Ta(ba),ba},ha=function(t){delete xa[t]},'process'==oo(ya)?Ta=function(t){ya.nextTick(Nn(Ca,t,1))}:va?(Pa=new va,Ra=Pa.port2,Pa.port1.onmessage=ka,Ta=Nn(Ra.postMessage,Ra,1)):Ln.addEventListener&&'function'==typeof postMessage&&!Ln.importScripts?(Ta=function(t){Ln.postMessage(t+'','*')},Ln.addEventListener('message',ka,!1)):Sa in jn('script')?Ta=function(t){ko.appendChild(jn('script'))[Sa]=function(){ko.removeChild(this),Ca.call(t)}}:Ta=function(t){setTimeout(Nn(Ca,t,1),0)});var Ea={set:fa,clear:ha},wa=Ea.set,Aa=Ln.MutationObserver||Ln.WebKitMutationObserver,Oa=Ln.process,Ma=Ln.Promise,La='process'==oo(Oa),za=Ao('species'),Fa=Ao('iterator'),Na=!1;try{var Ua=[7][Fa]();Ua['return']=function(){Na=!0},Array.from(Ua,function(){throw 2})}catch(t){}var Da=Ea.set,Ia=function(){var t=function(){var t,a;for(La&&(t=Oa.domain)&&t.exit();r;){a=r.fn,r=r.next;try{a()}catch(t){throw r?o():n=void 0,t}}n=void 0,t&&t.enter()},r,n,o;if(La)o=function(){Oa.nextTick(t)};else if(Aa){var a=!0,i=document.createTextNode('');new Aa(t).observe(i,{characterData:!0}),o=function(){i.data=a=!a}}else if(Ma&&Ma.resolve){var l=Ma.resolve();o=function(){l.then(t)}}else o=function(){wa.call(Ln,t)};return function(t){var a={fn:t,next:void 0};n&&(n.next=a),r||(r=a,o()),n=a}}(),Ga='Promise',Va=Ln.TypeError,Ba=Ln.process,ja=Ln[Ga],Ba=Ln.process,Ha='process'==oa(Ba),Wa=function(){},Ya=!!function(){try{var t=ja.resolve(1),r=(t.constructor={})[Ao('species')]=function(t){t(Wa,Wa)};return(Ha||'function'==typeof PromiseRejectionEvent)&&t.then(Wa)instanceof r}catch(t){}}(),Xa=function(t,r){return t===r||t===ja&&r===ii},qa=function(t){var r;return Un(t)&&'function'==typeof(r=t.then)&&r},Za=function(t){return Xa(ja,t)?new Ka(t):new ai(t)},Ka=ai=function(t){var r,n;this.promise=new t(function(t,o){if(void 0!=r||void 0!=n)throw Va('Bad Promise constructor');r=t,n=o}),this.resolve=Fn(r),this.reject=Fn(n)},$a=function(t){try{t()}catch(t){return{error:t}}},Qa=function(t,r){if(!t._n){t._n=!0;var n=t._c;Ia(function(){for(var o=t._v,a=1==t._s,l=0,i=function(r){var n=a?r.ok:r.fail,i=r.resolve,l=r.reject,s=r.domain,d,p;try{n?(!a&&(2==t._h&&ti(t),t._h=1),!0===n?d=o:(s&&s.enter(),d=n(o),s&&s.exit()),d===r.promise?l(Va('Promise-chain cycle')):(p=qa(d))?p.call(d,i,l):i(d)):l(o)}catch(t){l(t)}};n.length>l;)i(n[l++]);t._c=[],t._n=!1,r&&!t._h&&Ja(t)})}},Ja=function(t){Da.call(Ln,function(){var r=t._v,n,o,a;if(ei(t)&&(n=$a(function(){Ha?Ba.emit('unhandledRejection',r,t):(o=Ln.onunhandledrejection)?o({promise:t,reason:r}):(a=Ln.console)&&a.error&&a.error('Unhandled promise rejection',r)}),t._h=Ha||ei(t)?2:1),t._a=void 0,n)throw n.error})},ei=function(t){if(1==t._h)return!1;for(var r=t._a||t._c,n=0,o;r.length>n;)if(o=r[n++],o.fail||!ei(o.promise))return!1;return!0},ti=function(t){Da.call(Ln,function(){var r;Ha?Ba.emit('rejectionHandled',t):(r=Ln.onrejectionhandled)&&r({promise:t,reason:t._v})})},ri=function(t){var r=this;r._d||(r._d=!0,r=r._w||r,r._v=t,r._s=2,!r._a&&(r._a=r._c.slice()),Qa(r,!0))},ni=function(t){var r=this,n;if(!r._d){r._d=!0,r=r._w||r;try{if(r===t)throw Va('Promise can\'t be resolved itself');(n=qa(t))?Ia(function(){var o={_w:r,_d:!1};try{n.call(t,Nn(ni,o,1),Nn(ri,o,1))}catch(t){ri.call(o,t)}}):(r._v=t,r._s=1,Qa(r,!1))}catch(t){ri.call({_w:r,_d:!1},t)}}},oi,ai,ii;Ya||(ja=function(t){aa(this,ja,Ga,'_h'),Fn(t),oi.call(this);try{t(Nn(ni,this,1),Nn(ri,this,1))}catch(t){ri.call(this,t)}},oi=function(){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},oi.prototype=function(t,r,n){for(var o in r)n&&t[o]?t[o]=r[o]:Kn(t,o,r[o]);return t}(ja.prototype,{then:function(t,r){var n=Za(ma(this,ja));return n.ok='function'!=typeof t||t,n.fail='function'==typeof r&&r,n.domain=Ha?Ba.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&Qa(this,!1),n.promise},catch:function(t){return this.then(void 0,t)}}),Ka=function(){var t=new oi;this.promise=t,this.resolve=Nn(ni,t,1),this.reject=Nn(ri,t,1)}),Jn(Jn.G+Jn.W+Jn.F*!Ya,{Promise:ja}),Lo(ja,Ga),function(t){var r='function'==typeof zn[t]?zn[t]:Ln[t];Gn&&r&&!r[za]&&qn.f(r,za,{configurable:!0,get:function(){return this}})}(Ga),ii=zn[Ga],Jn(Jn.S+Jn.F*!Ya,Ga,{reject:function(t){var r=Za(this),n=r.reject;return n(t),r.promise}}),Jn(Jn.S+Jn.F*Mn,Ga,{resolve:function(t){if(t instanceof ja&&Xa(t.constructor,this))return t;var r=Za(this),n=r.resolve;return n(t),r.promise}}),Jn(Jn.S+Jn.F*!(Ya&&function(t,r){if(!r&&!Na)return!1;var n=!1;try{var o=[7],a=o[Fa]();a.next=function(){return{done:n=!0}},o[Fa]=function(){return a},t(o)}catch(t){}return n}(function(t){ja.all(t)['catch'](Wa)})),Ga,{all:function(t){var r=this,n=Za(r),o=n.resolve,a=n.reject,i=$a(function(){var n=[],i=0,l=1;_a(t,!1,function(t){var s=i++,d=!1;n.push(void 0),l++,r.resolve(t).then(function(t){d||(d=!0,n[s]=t,--l||o(n))},a)}),--l||o(n)});return i&&a(i.error),n.promise},race:function(t){var r=this,n=Za(r),o=n.reject,a=$a(function(){_a(t,!1,function(t){r.resolve(t).then(n.resolve,o)})});return a&&o(a.error),n.promise}});var li=zn.Promise,si=W(function(t){t.exports={default:li,__esModule:!0}}),di=W(function(t,r){r.__esModule=!0;var n=function(t){return t&&t.__esModule?t:{default:t}}(si);r.default=function(t){return function(){var r=t.apply(this,arguments);return new n.default(function(t,o){function a(i,l){try{var s=r[i](l),d=s.value}catch(t){return void o(t)}return s.done?void t(d):n.default.resolve(d).then(function(t){a('next',t)},function(t){a('throw',t)})}return a('next')})}}}),pi=W(function(t,r){function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(r,'__esModule',{value:!0});var o=n(Rn),a=n(si),i=n(di);r.default=function(){var t=(0,i.default)(o.default.mark(function t(){return o.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if('loading'!==document.readyState){t.next=3;break}return t.next=3,new a.default(function(t){document.addEventListener('DOMContentLoaded',t)});case 3:case'end':return t.stop();}},t,this)}));return function(){return t.apply(this,arguments)}}()}),ci=H(pi),_i=new WeakMap,ui={cross:function(t,r){return[t[1]*r[2]-t[2]*r[1],t[2]*r[0]-t[0]*r[2],t[0]*r[1]-t[1]*r[0]]},subtract:function(t,r){return[t[0]-r[0],t[1]-r[1],t[2]-r[2]]},add:function(t,r){return[t[0]+r[0],t[1]+r[1],t[2]+r[2]]},normalize:function(t){var r=st(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);return 1e-5<r?[t[0]/r,t[1]/r,t[2]/r]:[0,0,0]}},mi=function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];(n=this)._init.apply(n,t);var n},gi={color:{}};mi.prototype._init=function(){this.verts=null,this.normals=null,this._colors=null,this._color=null,this._calcVerts(),this.color=[0.5,0.5,0.5]},gi.color.set=function(t){if(t){this._color=t;var r=null;r='string'==typeof t?t.trim().split(' ').map(function(t){return parseFloat(t)}):t;for(var n=this.verts.length,o=n+n/3,a=this._colors=new Float32Array(o),l=0;l<o;l+=4)a[l+0]=r[0],a[l+1]=r[1],a[l+2]=r[2],a[l+3]='undefined'==typeof r[3]?1:r[3]}},gi.color.get=function(){return this._color},Object.defineProperties(mi.prototype,gi);var yi=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._init=function(r,n){this.width=r,this.height=n,t.prototype._init.call(this)},r.prototype._calcVerts=function(){for(var t=this,r=t.width,n=t.height,o=this.verts=new Float32Array([-r/2,0,0,r/2,0,0,0,n,0]),a=[0,0,1],s=this.normals=new Float32Array(o.length),d=0,i=o.length;d<i;d+=3)s[d+0]=a[0],s[d+1]=a[1],s[d+2]=a[2]},r}(mi),fi=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._init=function(r,n,o){this.baseWidth=r,this.topWidth=n,this.height=o,t.prototype._init.call(this)},r.prototype._calcVerts=function(){for(var t=this,r=t.baseWidth,n=t.topWidth,o=t.height,a=this.verts=new Float32Array([-r/2,0,0,r/2,0,0,n/2,o,0,n/2,o,0,-n/2,o,0,-r/2,0,0]),s=[0,0,1],d=this.normals=new Float32Array(a.length),p=0,i=a.length;p<i;p+=3)d[p+0]=s[0],d[p+1]=s[1],d[p+2]=s[2]},r}(mi),hi=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._init=function(r,n){this.width=r,this.height=n,t.prototype._init.call(this)},r.prototype._calcVerts=function(){for(var t=this,r=t.width,n=t.height,o=this.verts=new Float32Array([-r/2,-n/2,0,r/2,-n/2,0,r/2,n/2,0,r/2,n/2,0,-r/2,n/2,0,-r/2,-n/2,0]),a=[0,0,1],s=this.normals=new Float32Array(o.length),d=0,i=o.length;d<i;d+=3)s[d+0]=a[0],s[d+1]=a[1],s[d+2]=a[2]},r}(mi),vi=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._init=function(r,n,o){this.x=r,this.y=n,this.width=o,t.prototype._init.call(this)},r.prototype._calcVerts=function(){for(var t=this,r=t.x,n=t.y,o=t.width,a=r+o,s=n+o,d=this.verts=new Float32Array([r,n,0,a,n,0,a,s,0,a,s,0,r,s,0,r,n,0,r,n,0,r,n,-o,r,s,-o,r,s,-o,r,s,0,r,n,0,a,n,0,a,n,-o,a,s,-o,a,s,-o,a,s,0,a,n,0,r,n,-o,a,n,-o,a,s,-o,a,s,-o,r,s,-o,r,n,-o,r,n,0,r,n,-o,a,n,-o,a,n,-o,a,n,0,r,n,0,r,s,0,r,s,-o,a,s,-o,a,s,-o,a,s,0,r,s,0]),p=[[0,0,1],[-1,0,0],[1,0,0],[0,0,-1],[0,-1,0],[0,1,0]],c=this.normals=new Float32Array(d.length),_=0,u=0,i=d.length;u<i;u+=18,_+=1)c[u+0]=p[_][0],c[u+1]=p[_][1],c[u+2]=p[_][2],c[u+3]=p[_][0],c[u+4]=p[_][1],c[u+5]=p[_][2],c[u+6]=p[_][0],c[u+7]=p[_][1],c[u+8]=p[_][2],c[u+9]=p[_][0],c[u+10]=p[_][1],c[u+11]=p[_][2],c[u+12]=p[_][0],c[u+13]=p[_][1],c[u+14]=p[_][2],c[u+15]=p[_][0],c[u+16]=p[_][1],c[u+17]=p[_][2]},r}(mi),bi=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._init=function(){t.prototype._init.call(this)},r.prototype._calcVerts=function(){this.verts=new Float32Array([-100,0.087303,-100,100,0.087303,-100,100,0.087303,100,-100,0.087303,100,100,0.087303,100,100,0.087303,-100,0,200.087,0,100,0.087303,-100,-100,0.087303,-100,0,200.087,0,-100,0.087303,-100,-100,0.087303,100,0,200.087,0,-100,0.087303,100,100,0.087303,100,0,200.087,0]),this.normals=new Float32Array([0,-1,0,0,-1,0,0,-1,0,0,-1,0,0.894427,0.447214,0,0.894427,0.447214,0,0.894427,0.447214,0,0,0.447214,-0.894427,0,0.447214,-0.894427,0,0.447214,-0.894427,-0.894427,0.447214,0,-0.894427,0.447214,0,-0.894427,0.447214,0,0,0.447214,0.894427,0,0.447214,0.894427,0,0.447214,0.894427])},r}(mi),xi={identity:Object.freeze([1,0,0,0,1,0,0,0,1]),translation:function(t,r){return[1,0,0,0,1,0,t,r,1]},rotation:function(t){var r=ct(t),n=pt(t);return[r,-n,0,n,r,0,0,0,1]},scaling:function(t,r){return[t,0,0,0,r,0,0,0,1]},projection:function(t,r){var n=xi.identity;return n=xi.multiply(xi.scaling(1/t,1/r),n),n=xi.multiply(xi.scaling(2,2),n),n=xi.multiply(xi.translation(-1,-1),n),n=xi.multiply(xi.scaling(1,-1),n),n},multiply:function(t,r){var n=t[0],o=t[1],a=t[2],i=t[3],l=t[4],s=t[5],d=t[6],p=t[7],c=t[8],_=r[0],u=r[1],m=r[2],g=r[3],y=r[4],f=r[5],h=r[6],v=r[7],x=r[8];return[_*n+u*i+m*d,_*o+u*l+m*p,_*a+u*s+m*c,g*n+y*i+f*d,g*o+y*l+f*p,g*a+y*s+f*c,h*n+v*i+x*d,h*o+v*l+x*p,h*a+v*s+x*c]}},Si={identity:Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),translation:function(t,r,n){return[1,0,0,0,0,1,0,0,0,0,1,0,t,r,n,1]},xRotation:function(t){var r=Ue(t),n=ct(r),o=pt(r);return[1,0,0,0,0,n,o,0,0,-o,n,0,0,0,0,1]},yRotation:function(t){var r=Ue(t),n=ct(r),o=pt(r);return[n,0,-o,0,0,1,0,0,o,0,n,0,0,0,0,1]},zRotation:function(t){var r=Ue(t),n=ct(r),o=pt(r);return[n,-o,0,0,o,n,0,0,0,0,1,0,0,0,0,1]},scaling:function(t,r,n){return[t,0,0,0,0,r,0,0,0,0,n,0,0,0,0,1]},inverse:function(t){var r=t[0],n=t[1],o=t[2],a=t[3],i=t[4],l=t[5],s=t[6],p=t[7],c=t[8],_=t[9],u=t[10],m=t[11],g=t[12],y=t[13],f=t[14],h=t[15],v=u*h,x=f*m,S=s*h,C=f*p,k=s*m,T=u*p,P=o*h,R=f*a,E=o*m,w=u*a,A=o*p,O=s*a,M=c*y,L=g*_,z=i*y,F=g*l,N=i*_,U=c*l,D=r*y,I=g*n,G=r*_,V=c*n,B=r*l,j=i*n,H=v*l+C*_+k*y-(x*l+S*_+T*y),W=x*n+P*_+w*y-(v*n+R*_+E*y),Y=S*n+R*l+A*y-(C*n+P*l+O*y),X=T*n+E*l+O*_-(k*n+w*l+A*_),q=1/(r*H+i*W+c*Y+g*X);return[q*H,q*W,q*Y,q*X,q*(x*i+S*c+T*g-(v*i+C*c+k*g)),q*(v*r+R*c+E*g-(x*r+P*c+w*g)),q*(C*r+P*i+O*g-(S*r+R*i+A*g)),q*(k*r+w*i+A*c-(T*r+E*i+O*c)),q*(M*p+F*m+N*h-(L*p+z*m+U*h)),q*(L*a+D*m+V*h-(M*a+I*m+G*h)),q*(z*a+I*p+B*h-(F*a+D*p+j*h)),q*(U*a+G*p+j*m-(N*a+V*p+B*m)),q*(z*u+U*f+L*s-(N*f+M*s+F*u)),q*(G*f+M*o+I*u-(D*u+V*f+L*o)),q*(D*s+j*f+F*o-(B*f+z*o+I*s)),q*(B*u+N*o+V*s-(G*s+j*u+U*o))]},transpose:function(t){return[t[0],t[4],t[8],t[12],t[1],t[5],t[9],t[13],t[2],t[6],t[10],t[14],t[3],t[7],t[11],t[15]]},projection:function(t,r,n){return[2/t,0,0,0,0,-2/r,0,0,0,0,2/n,0,-1,1,0,1]},orthographic:function(t,r,n,o,a,i){return[2/(r-t),0,0,0,0,2/(n-o),0,0,0,0,2/(a-i),0,(t+r)/(t-r),(o+n)/(o-n),(a+i)/(a-i),1]},perspective:function(t,r,n,o){var a=Ue(t),i=dt(0.5*at-0.5*a),l=1/(n-o);return[i/r,0,0,0,0,i,0,0,0,0,(n+o)*l,-1,0,0,2*(n*o*l),0]},lookAt:function(t,r,n){var o=ui.normalize(ui.subtract(t,r)),a=ui.cross(n,o),i=ui.cross(o,a);return[a[0],a[1],a[2],0,i[0],i[1],i[2],0,o[0],o[1],o[2],0,t[0],t[1],t[2],1]},multiply:function(t,r){var n=t[0],o=t[1],a=t[2],i=t[3],l=t[4],s=t[5],d=t[6],p=t[7],c=t[8],_=t[9],u=t[10],m=t[11],g=t[12],y=t[13],f=t[14],h=t[15],v=r[0],x=r[1],S=r[2],C=r[3],k=r[4],T=r[5],P=r[6],R=r[7],E=r[8],w=r[9],A=r[10],O=r[11],M=r[12],L=r[13],z=r[14],F=r[15];return[v*n+x*l+S*c+C*g,v*o+x*s+S*_+C*y,v*a+x*d+S*u+C*f,v*i+x*p+S*m+C*h,k*n+T*l+P*c+R*g,k*o+T*s+P*_+R*y,k*a+T*d+P*u+R*f,k*i+T*p+P*m+R*h,E*n+w*l+A*c+O*g,E*o+w*s+A*_+O*y,E*a+w*d+A*u+O*f,E*i+w*p+A*m+O*h,M*n+L*l+z*c+F*g,M*o+L*s+z*_+F*y,M*a+L*d+z*u+F*f,M*i+L*p+z*m+F*h]}},Ci=function(t){var r=[parseFloat(getComputedStyle(t.gl.canvas).width)*window.devicePixelRatio,parseFloat(getComputedStyle(t.gl.canvas).height)*window.devicePixelRatio,1e3];Me.apply(void 0,[t.gl].concat(r)),t.projectionMatrix=Si.perspective(45,r[0]/r[1],1,2e3)},ki=function(){};ki.prototype.initGl=function(t){var r=Ee(t),n=t.webGlRendererState;n.gl=r,r||console.log('You need WebGL.');var o=Fe(r,r.VERTEX_SHADER,'\n attribute vec4 a_vertexPosition;\n uniform mat4 u_worldViewProjectionMatrix;\n\n // TODO: awaiting on transpose() method for DOMMatrix\n //uniform mat4 u_worldInverseTransposeMatrix; // used for correct lighting normals\n\n attribute vec4 a_color;\n varying vec4 v_fragColor;\n\n attribute vec3 a_normal;\n varying vec3 v_vertNormal;\n\n uniform mat4 u_worldMatrix;\n\n uniform vec3 u_lightWorldPosition;\n varying vec3 v_surfaceToLightVector;\n\n uniform vec3 u_cameraWorldPosition;\n varying vec3 v_surfaceToCameraVector;\n\n attribute vec2 a_textureCoordinate;\n varying vec2 v_textureCoordinate;\n\n void main() {\n vec3 surfaceWorldPosition = (u_worldMatrix * a_vertexPosition).xyz;\n\n // compute the vector of the surface to the pointLight\n // and pass it to the fragment shader\n v_surfaceToLightVector = u_lightWorldPosition - surfaceWorldPosition;\n\n // compute the vector of the surface to the camera\n // and pass it to the fragment shader\n v_surfaceToCameraVector = u_cameraWorldPosition - surfaceWorldPosition;\n\n gl_Position = u_worldViewProjectionMatrix * a_vertexPosition;\n\n v_fragColor = a_color;\n //v_fragColor = gl_Position * 0.5 + 0.5;\n\n // orient the normals and pass to the fragment shader\n //v_vertNormal = mat3(u_worldInverseTransposeMatrix) * a_normal; // TODO waiting for transpose() method on DOMMatrix\n //alternate: v_vertNormal = (u_worldInverseTransposeMatrix * vec4(a_normal, 0)).xyz;\n v_vertNormal = mat3(u_worldMatrix) * a_normal;\n\n v_textureCoordinate = a_textureCoordinate;\n }\n'),a=Fe(r,r.FRAGMENT_SHADER,'\n // TODO: detect highp support, see\n // https://github.com/greggman/webgl-fundamentals/issues/80#issuecomment-306746556\n //precision mediump float;\n precision highp float;\n\n varying vec4 v_fragColor;\n varying vec3 v_vertNormal;\n\n varying vec3 v_surfaceToLightVector;\n\n //// TODO: use this for directional lighting (f.e. sunlight or moonlight).\n //uniform vec3 reverseLightDirection;\n\n varying vec3 v_surfaceToCameraVector;\n\n uniform float u_shininess;\n uniform vec3 u_lightColor;\n uniform vec3 u_specularColor;\n\n varying vec2 v_textureCoordinate;\n uniform sampler2D u_texture;\n uniform bool u_hasTexture;\n\n void main(void) {\n\n // because v_vertNormal is a varying it\'s interpolated\n // so it will not be a unit vector. Normalizing it\n // will make it a unit vector again.\n vec3 normal = normalize(v_vertNormal);\n\n vec3 surfaceToCameraDirection = normalize(v_surfaceToCameraVector);\n\n vec3 surfaceToLightDirection = normalize(v_surfaceToLightVector);\n\n // represents the unit vector oriented at half of the angle between\n // surfaceToLightDirection and surfaceToCameraDirection.\n vec3 halfVector = normalize(surfaceToLightDirection + surfaceToCameraDirection);\n\n float pointLight = dot(normal, surfaceToLightDirection);\n float pointLightIntensity = 1.0; // TODO make configurable\n //float directionalLight = dot(normal, reverseLightDirection); // TODO make configurable\n\n //float specular = dot(normal, halfVector);\n float specular = 0.0;\n if (pointLight > 0.0) {\n specular = pow(dot(normal, halfVector), u_shininess);\n }\n\n // TODO make configurable\n //vec3 ambientLight = vec3(0.361, 0.184, 0.737); // teal\n vec3 ambientLight = vec3(1.0, 1.0, 1.0); // white\n float ambientLightIntensity = 0.3;\n\n // TODO: user can choose color or texture, default to a color if no texture, etc.\n // TODO: blend texture on top of color, if texture has alpha.\n gl_FragColor = v_fragColor;\n if (u_hasTexture) {\n gl_FragColor = texture2D(u_texture, v_textureCoordinate);\n }\n\n // Lets multiply just the color portion (not the alpha) of\n // gl_FragColor by the pointLight + directionalLight\n //gl_FragColor.rgb *= pointLight * u_lightColor; // point light only.\n //gl_FragColor.rgb *= directionalLight; // directional light only.\n //gl_FragColor.rgb *= ambientLight; // ambient light only.\n gl_FragColor.rgb *=\n //clamp(directionalLight, 0.0, 1.0) +\n clamp(pointLight, 0.0, 1.0) * u_lightColor * pointLightIntensity +\n ambientLight * ambientLightIntensity;\n\n // Just add in the specular\n gl_FragColor.rgb += specular * u_specularColor;\n\n //gl_FragColor.a = 0.5;\n }\n'),i=Ne(r,o,a);r.useProgram(i),n.colorsBuffer=r.createBuffer(),n.colorAttributeLocation=r.getAttribLocation(i,'a_color'),r.enableVertexAttribArray(n.colorAttributeLocation),n.vertexBuffer=r.createBuffer(),n.vertexAttributeLocation=r.getAttribLocation(i,'a_vertexPosition'),r.enableVertexAttribArray(n.vertexAttributeLocation),n.normalsBuffer=r.createBuffer(),n.normalAttributeLocation=r.getAttribLocation(i,'a_normal'),r.enableVertexAttribArray(n.normalAttributeLocation),n.textureCoordinatesBuffer=r.createBuffer(),n.textureCoordinateLocation=r.getAttribLocation(i,'a_textureCoordinate'),r.enable(r.DEPTH_TEST),r.blendFunc(r.SRC_ALPHA,r.ONE),r.enable(r.BLEND),n.projectionMatrix=Si.identity,Ci(n),t.on('parentsizechange',function(){return Ci(n)}),n.worldViewProjectionMatrixLocation=r.getUniformLocation(i,'u_worldViewProjectionMatrix'),n.worldMatrixLocation=r.getUniformLocation(i,'u_worldMatrix'),n.lightWorldPositionLocation=r.getUniformLocation(i,'u_lightWorldPosition'),n.cameraWorldPositionLocation=r.getUniformLocation(i,'u_cameraWorldPosition');var l=r.getUniformLocation(i,'u_shininess'),s=r.getUniformLocation(i,'u_lightColor'),d=r.getUniformLocation(i,'u_specularColor');n.textureLocation=r.getUniformLocation(i,'u_texture'),n.hasTextureLocation=r.getUniformLocation(i,'u_hasTexture');r.uniform1f(l,200);var p=[1,1,1];r.uniform3fv(s,ui.normalize(p));r.uniform3fv(d,ui.normalize(p)),n.lightAnimParam=0,n.lightWorldPosition=[20,30,50],n.cameraAngle=0,n.cameraRadius=200},ki.prototype.drawScene=function(t){var r=this,n=t.webGlRendererState,o=n.gl;n.lightAnimParam+=0.05,n.lightWorldPosition=[300*pt(n.lightAnimParam),300*pt(2*n.lightAnimParam),it(300*ct(n.lightAnimParam))],o.uniform3fv(n.lightWorldPositionLocation,n.lightWorldPosition);var a=t.getAttribute('background');a='string'==typeof a?a.split(' ').map(function(t){return parseFloat(t)}):[0,0,0,0],o.clearColor.apply(o,a),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT);var s=Si.identity;s=Si.multiply(s,Si.yRotation(n.cameraAngle)),s=Si.multiply(s,Si.translation(0,0,1.5*n.cameraRadius));var d=Si.inverse(s);n.viewProjectionMatrix=Si.multiply(n.projectionMatrix,d);var p=[s[12],s[13],s[14]];o.uniform3fv(n.cameraWorldPositionLocation,p);for(var c=t.imperativeCounterpart._children,_=0,i=c.length;_<i;_+=1)r.drawNodeAndRecurse(n,c[_])},ki.prototype.drawNodeAndRecurse=function(t,r){var n=this,o=t.gl,a=r.element.getAttribute('mesh');if(a){var s=r._calculatedSize,d=Array.from(r.element.children).find(function(t){return t instanceof SVGSVGElement}),p=!!d;if('cube'==a)r.__shape instanceof vi||(r.__shape=new vi(0,0,s.x));else if('quad'!=a)'isotriangle'==a?r.__shape instanceof yi||(r.__shape=new yi(s.x,s.y)):'pyramid4'==a?r.__shape instanceof bi||(r.__shape=new bi(s.x,s.y)):'symtrap'==a?r.__shape instanceof fi?(r.__shape.baseWidth=s.x/2,r.__shape.topWidth=s.x,r.__shape.height=s.y,r.__shape._calcVerts()):r.__shape=new fi(s.x/2,s.x,s.y):(r.__shape instanceof hi?(r.__shape.width=s.x,r.__shape.height=s.y,r.__shape._calcVerts()):r.__shape=new hi(s.x,s.y),p&&(r.__shape.textureCoordinates=new Float32Array([0,0,1,0,1,1,1,1,0,1,0,0])));else if(r.__shape instanceof hi?(r.__shape.width=s.x,r.__shape.height=s.y,r.__shape._calcVerts()):r.__shape=new hi(s.x,s.y),p){r.__texture||(r.__shape.textureCoordinates=new Float32Array([0,0,1,0,1,1,1,1,0,1,0,0]),r.__texture=o.createTexture()),r.__two||(r.__two=new Two({type:Two.Types.webgl,fullscreen:!1,autostart:!1}),r.__two.interpret(d)),r.__two.update();var c=r.__two.renderer.domElement,_=function(t){return 0==(t&t-1)};o.bindTexture(o.TEXTURE_2D,r.__texture),o.texImage2D(o.TEXTURE_2D,0,o.RGB,o.RGB,o.UNSIGNED_BYTE,c),_(c.width)&&_(c.height)?(o.generateMipmap(o.TEXTURE_2D),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR_MIPMAP_LINEAR)):(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR))}if(r.__shape){r.__shape.color=r.element.getAttribute('color'),o.bindBuffer(o.ARRAY_BUFFER,t.colorsBuffer),o.bufferData(o.ARRAY_BUFFER,r.__shape._colors,o.STATIC_DRAW);var u=o.FLOAT;o.vertexAttribPointer(t.colorAttributeLocation,4,u,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,t.vertexBuffer),o.bufferData(o.ARRAY_BUFFER,r.__shape.verts,o.STATIC_DRAW);var m=o.FLOAT,g=0;o.vertexAttribPointer(t.vertexAttributeLocation,3,m,!1,0,g),o.bindBuffer(o.ARRAY_BUFFER,t.normalsBuffer),o.bufferData(o.ARRAY_BUFFER,r.__shape.normals,o.STATIC_DRAW);var y=o.FLOAT;if(o.vertexAttribPointer(t.normalAttributeLocation,3,y,!1,0,0),p){o.uniform1i(t.hasTextureLocation,1),o.bindBuffer(o.ARRAY_BUFFER,t.textureCoordinatesBuffer),o.bufferData(o.ARRAY_BUFFER,r.__shape.textureCoordinates,o.STATIC_DRAW);var f=o.FLOAT;o.enableVertexAttribArray(t.textureCoordinateLocation),o.vertexAttribPointer(t.textureCoordinateLocation,2,f,!1,0,0),o.uniform1i(t.textureLocation,0)}else o.uniform1i(t.hasTextureLocation,0),o.disableVertexAttribArray(t.textureCoordinateLocation);o.uniformMatrix4fv(t.worldMatrixLocation,!1,r._worldMatrix.toFloat32Array());var h=Si.multiply(t.viewProjectionMatrix,r._worldMatrix.toFloat32Array());o.uniformMatrix4fv(t.worldViewProjectionMatrixLocation,!1,h);var v=r.__shape.verts.length/3;o.drawArrays(o.TRIANGLES,g,v)}}for(var x=r._children,S=0,i=x.length;S<i;S+=1)n.drawNodeAndRecurse(t,x[S])};var Ti=null,Pi=!1,Ri=null,Ei=function(){this._inFrame=!1,this._rAF=null,this._animationLoopStarted=!1,this._allRenderTasks=[],this._taskIterationIndex=0,this._numberOfTasks=0,this._nodesToBeRendered=[],this._modifiedScenes=[],this._worldMatrixRootNodes=[]};Ei.prototype._startAnimationLoop=function(){var t=this;if(this._animationLoopStarted)return Promise.resolve();this._animationLoopStarted=!0;var r=function(){var r=function(n){t._inFrame=!0,t._runRenderTasks(n),t._renderNodes(n),t._allRenderTasks.length?t._rAF=requestAnimationFrame(r):(t._rAF=null,t._animationLoopStarted=!1),t._inFrame=!1};t._rAF=requestAnimationFrame(r)};return Pi?(r(),Promise.resolve()):ci().then(function(){Pi=!0,r()})},Ei.prototype.addRenderTask=function(t){if('function'!=typeof t)throw new Error('Render task must be a function.');return this._allRenderTasks.includes(t)?void 0:(this._allRenderTasks.push(t),this._numberOfTasks+=1,this._animationLoopStarted||this._startAnimationLoop(),t)},Ei.prototype.removeRenderTask=function(t){var r=this._allRenderTasks.indexOf(t);-1==r||(this._allRenderTasks.splice(r,1),this._numberOfTasks-=1,this._taskIterationIndex-=1)},Ei.prototype._runRenderTasks=function(t){var r=this;for(this._taskIterationIndex=0;this._taskIterationIndex<this._numberOfTasks;this._taskIterationIndex+=1){var n=r._allRenderTasks[r._taskIterationIndex];!1===n(t)&&r.removeRenderTask(n)}},Ei.prototype._setNodeToBeRendered=function(t){this._nodesToBeRendered.includes(t)||(this._nodesToBeRendered.push(t),!this._inFrame&&this._startAnimationLoop())},Ei.prototype._renderNodes=function(t){var r=this;if(this._nodesToBeRendered.length){for(var n=0,o=this._nodesToBeRendered.length,a;n<o;n+=1)a=r._nodesToBeRendered[n],a._render(t),!(a instanceof Fi)||a._getAncestorToBeRendered()instanceof Fi||r._worldMatrixRootNodes.includes(a)||r._worldMatrixRootNodes.push(a),a._scene&&!r._modifiedScenes.includes(a._scene)&&r._modifiedScenes.push(a._scene);for(var i=this._worldMatrixRootNodes,l=0,s=i.length,d;l<s;l+=1)d=i[l],d._calculateWorldMatricesInSubtree();i.length=0;for(var p=this._modifiedScenes,c=0,_=p.length,u;c<_;c+=1)u=p[c].element,u.webglEnabled&&(Ri||(Ri=De()))&&Ri.drawScene(u);p.length=0;for(var m=this._nodesToBeRendered,g=0,y=m.length;g<y;g+=1)m[g]._willBeRendered=!1;m.length=0}};var wi=new Ei;'undefined'==typeof document.createElement('div').style.transform&&Object.defineProperty(CSSStyleDeclaration.prototype,'transform',{set:function(t){this.webkitTransform=t},get:function(){return this.webkitTransform},enumerable:!0});var Ai=Symbol('instanceofSymbol'),Oi=function(t){var r=function(t){function r(r){void 0===r&&(r={}),t.call(this,r),this._propertyFunctions=null,this._calculatedSize={x:0,y:0,z:0},this._properties={},this._setDefaultProperties(),this._setPropertyObservers(),this.properties=r}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._setDefaultProperties=function(){Object.assign(this._properties,{sizeMode:new hn('absolute','absolute','absolute'),absoluteSize:new hn(0,0,0),proportionalSize:new hn(1,1,1)})},r.prototype._setPropertyObservers=function(){var t=this;this._properties.sizeMode.on('valuechanged',function(){return t.triggerEvent('propertychange','sizeMode')}),this._properties.absoluteSize.on('valuechanged',function(){return t.triggerEvent('propertychange','absoluteSize')}),this._properties.proportionalSize.on('valuechanged',function(){return t.triggerEvent('propertychange','proportionalSize')})},r.prototype._calcSize=function(){var t=this._calculatedSize,r=Object.assign({},t),n=this._properties,o=this._getParentSize();t.x='absolute'==n.sizeMode._x?n.absoluteSize._x:o.x*n.proportionalSize._x,t.y='absolute'==n.sizeMode._y?n.absoluteSize._y:o.y*n.proportionalSize._y,t.z='absolute'==n.sizeMode._z?n.absoluteSize._z:o.z*n.proportionalSize._z,(r.x!==t.x||r.y!==t.y||r.z!==t.z)&&this.triggerEvent('sizechange',Object.assign({},t))},r.prototype._getParentSize=function(){return this._parent?this._parent._calculatedSize:{x:0,y:0,z:0}},r.prototype._setPropertyXYZ=function(t,r,n){var o=this;if(!(n instanceof Object||n instanceof Array||n instanceof Function))throw new TypeError('Invalid value for '+t.name+'#'+r+'.');var a=!1;n instanceof Function?(!this._propertyFunctions&&(this._propertyFunctions=new Map),this._propertyFunctions.has(r)&&wi.removeRenderTask(this._propertyFunctions.get(r)),this._propertyFunctions.set(r,wi.addRenderTask(function(t){var a=n(o._properties[r]._x,o._properties[r]._y,o._properties[r]._z,t);return!1===a?(o._propertyFunctions.delete(r),!1):void(o[r]=a)}))):n instanceof Array?('undefined'!=typeof n[0]&&(this._properties[r]._x=n[0],a=!0),'undefined'!=typeof n[1]&&(this._properties[r]._y=n[1],a=!0),'undefined'!=typeof n[2]&&(this._properties[r]._z=n[2],a=!0)):('undefined'!=typeof n.x&&(this._properties[r]._x=n.x,a=!0),'undefined'!=typeof n.y&&(this._properties[r]._y=n.y,a=!0),'undefined'!=typeof n.z&&(this._properties[r]._z=n.z,a=!0)),a&&this.triggerEvent('propertychange',r)},r.prototype._setPropertySingle=function(t,r,n,o){var a=this;if(!(typeof n==o||n instanceof Function))throw new TypeError('Invalid value for '+t.name+'#'+r+'.');n instanceof Function?wi.addRenderTask(function(t){var o=n(a._properties[r],t);return!1!==o&&void(a[r]=o)}):(this._properties[r]=n,this.triggerEvent('propertychange',r))},r.prototype._render=function(){},r}(Pn.mixin(fn.mixin(t)));return Object.defineProperties(r.prototype,{sizeMode:{set:function(t){this._setPropertyXYZ(r,'sizeMode',t)},get:function(){return this._properties.sizeMode},configurable:!0,enumerable:!0},absoluteSize:{set:function(t){this._setPropertyXYZ(r,'absoluteSize',t)},get:function(){return this._properties.absoluteSize},configurable:!0,enumerable:!0},actualSize:{get:function(){var t=this._calculatedSize,r=t.x,n=t.y,o=t.z;return{x:r,y:n,z:o}},configurable:!0,enumerable:!0},proportionalSize:{set:function(t){this._setPropertyXYZ(r,'proportionalSize',t)},get:function(){return this._properties.proportionalSize},configurable:!0,enumerable:!0},properties:{set:function(t){void 0===t&&(t={}),t.sizeMode&&(this.sizeMode=t.sizeMode),t.absoluteSize&&(this.absoluteSize=t.absoluteSize),t.proportionalSize&&(this.proportionalSize=t.proportionalSize)},configurable:!0}}),Ce(r.prototype),Object.defineProperty(r,Symbol.hasInstance,{value:function(t){if(this!==r)return Object.getPrototypeOf(r)[Symbol.hasInstance].call(this,t);for(var n=t,o;n;){if(o=Object.getOwnPropertyDescriptor(n,'constructor'),o&&o.value&&o.value.hasOwnProperty(Ai))return!0;n=Object.getPrototypeOf(n)}return!1}}),r[Ai]=!0,r},Mi=Oi(function(){return function(){}}());Mi.mixin=Oi;var Li=Symbol('instanceofSymbol'),zi=function(t){var r=Mi.mixin(t),n=function(t){function r(r){void 0===r&&(r={}),t.call(this,r),this._worldMatrix=null}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._setDefaultProperties=function(){t.prototype._setDefaultProperties.call(this),Object.assign(this._properties,{position:new hn(0,0,0),rotation:new hn(0,0,0),scale:new hn(1,1,1),origin:new hn(0.5,0.5,0.5),align:new hn(0,0,0),mountPoint:new hn(0,0,0),opacity:1,transform:new window.DOMMatrix})},r.prototype._setPropertyObservers=function(){var r=this;t.prototype._setPropertyObservers.call(this),this._properties.position.on('valuechanged',function(){return r.triggerEvent('propertychange','position')}),this._properties.rotation.on('valuechanged',function(){return r.triggerEvent('propertychange','rotation')}),this._properties.scale.on('valuechanged',function(){return r.triggerEvent('propertychange','scale')}),this._properties.origin.on('valuechanged',function(){return r.triggerEvent('propertychange','origin')}),this._properties.align.on('valuechanged',function(){return r.triggerEvent('propertychange','align')}),this._properties.mountPoint.on('valuechanged',function(){return r.triggerEvent('propertychange','mountPoint')})},r.prototype._calculateMatrix=function(){var t=new window.DOMMatrix,r=this._properties,n=[0,0,0];if(this._parent){var o=this._parent._calculatedSize,a=r.align;n[0]=o.x*a.x,n[1]=o.y*a.y,n[2]=o.z*a.z}var i=[0,0,0],l=this._calculatedSize,s=r.mountPoint;i[0]=l.x*s.x,i[1]=l.y*s.y,i[2]=l.z*s.z;var d=[],p=r.position;d[0]=p.x+n[0]-i[0],d[1]=p.y+n[1]-i[1],d[2]=p.z+n[2]-i[2],t.translateSelf(d[0],d[1],d[2]);var c=r.rotation;return t.rotateAxisAngleSelf(1,0,0,c.x),t.rotateAxisAngleSelf(0,1,0,c.y),t.rotateAxisAngleSelf(0,0,1,c.z),t},r.prototype._calculateWorldMatricesInSubtree=function(){this._calculateWorldMatrixFromParent();for(var t=this._children,r=0,n=t.length;r<n;r+=1)t[r]._calculateWorldMatricesInSubtree()},r.prototype._calculateWorldMatrixFromParent=function(){var t=this._parent;this._worldMatrix=t instanceof r?this._properties.transform.multiply(t._worldMatrix):this._properties.transform},r.prototype._render=function(){t.prototype._render.call(this),this._properties.transform=this._calculateMatrix()},r}(r),o=Object.getOwnPropertyDescriptor(r.prototype,'properties'),a=o.set;return Object.defineProperties(n.prototype,{position:{set:function(t){this._setPropertyXYZ(n,'position',t)},get:function(){return this._properties.position},configurable:!0,enumerable:!0},rotation:{set:function(t){this._setPropertyXYZ(n,'rotation',t)},get:function(){return this._properties.rotation},configurable:!0,enumerable:!0},scale:{set:function(t){this._setPropertyXYZ(n,'scale',t)},get:function(){return this._properties.scale},configurable:!0,enumerable:!0},opacity:{set:function(t){Ie(t)||(t=void 0),this._setPropertySingle(n,'opacity',t,'number')},get:function(){return this._properties.opacity},configurable:!0,enumerable:!0},align:{set:function(t){this._setPropertyXYZ(n,'align',t)},get:function(){return this._properties.align},configurable:!0,enumerable:!0},mountPoint:{set:function(t){this._setPropertyXYZ(n,'mountPoint',t)},get:function(){return this._properties.mountPoint},configurable:!0,enumerable:!0},properties:{set:function(t){void 0===t&&(t={}),a.call(this,t),t.position&&(this.position=t.position),t.rotation&&(this.rotation=t.rotation),t.scale&&(this.scale=t.scale),t.origin&&(this.origin=t.origin),t.align&&(this.align=t.align),t.mountPoint&&(this.mountPoint=t.mountPoint),t.opacity&&(this.opacity=t.opacity)},configurable:!0}}),Ce(n.prototype),Object.defineProperty(n,Symbol.hasInstance,{value:function(t){if(this!==n)return Object.getPrototypeOf(n)[Symbol.hasInstance].call(this,t);for(var r=t,o;r;){if(o=Object.getOwnPropertyDescriptor(r,'constructor'),o&&o.value&&o.value.hasOwnProperty(Li))return!0;r=Object.getPrototypeOf(r)}return!1}}),n[Li]=!0,n},Fi=zi(function(){return function(){}}());Fi.mixin=zi;var Ni={display:'none',boxSizing:'border-box',position:'absolute',top:0,left:0,transformOrigin:'50% 50% 0',transformStyle:'preserve-3d'},Ui=Object.assign({},Ni,{position:'relative',overflow:'hidden',width:'100%',height:'100%',perspective:1e3});if('function'!=typeof window.HTMLElement){var Di=function(){};Di.prototype=window.HTMLElement.prototype,window.HTMLElement=Di}var Ii=new Map;(function(ee,te,re,t){function ne(o,a){for(var t=0,n=o.length;t<n;t++)ue(o[t],a)}function r(o){for(var a=0,t=o.length,n;a<t;a++)n=o[a],be(n,y[ae(n)])}function oe(r){return function(n){D(n)&&(ue(n,r),ne(n.querySelectorAll(fe),r))}}function ae(o){var a=j.call(o,'is'),t=o.nodeName.toUpperCase(),n=E.call(g,a?d+a.toUpperCase():h+t);return a&&-1<n&&!ie(t,a)?-1:n}function ie(r,n){return-1<fe.indexOf(r+'[is="'+n+'"]')}function le(o){var a=o.currentTarget,t=o.attrChange,n=o.attrName,r=o.target;Y&&(!r||r===a)&&a.attributeChangedCallback&&'style'!==n&&o.prevValue!==o.newValue&&a.attributeChangedCallback(n,t===o[u]?null:o.prevValue,t===o[f]?null:o.newValue)}function se(r){var n=oe(r);return function(t){Z.push(n,t.target)}}function de(t){G&&(G=!1,t.currentTarget.removeEventListener(ye,de)),ne((t.target||te).querySelectorAll(fe),t.detail===s?s:ge),N&&ce()}function n(r,o){var t=this;z.call(t,r,o),$.call(t,{target:t})}function pe(r,o){_(r,o),he?he.observe(r,W):(K&&(r.setAttribute=n,r[me]=J(r),r.addEventListener(i,$)),r.addEventListener(l,le)),r.createdCallback&&Y&&(r.created=!0,r.createdCallback(),r.created=!1)}function ce(){for(var r=0,t=B.length,n;r<t;r++)n=B[r],p.contains(n)||(t--,B.splice(r--,1),ue(n,s))}function _e(t){throw new Error('A '+t+' type is already registered')}function ue(o,a){var t=ae(o),r;-1<t&&(ve(o,y[t]),t=0,a!==ge||o[ge]?a===s&&!o[s]&&(o[ge]=!1,o[s]=!0,t=1):(o[s]=!1,o[ge]=!0,t=1,N&&0>E.call(B,o)&&B.push(o)),t&&(r=o[a+'Callback'])&&r.call(o))}if(!(t in te)){var me='__'+t+(1e5*Math.random()>>0),ge='attached',s='detached',o='extends',u='ADDITION',a='MODIFICATION',f='REMOVAL',l='DOMAttrModified',ye='DOMContentLoaded',i='DOMSubtreeModified',h='<',d='=',v=/^[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)+$/,m=['ANNOTATION-XML','COLOR-PROFILE','FONT-FACE','FONT-FACE-SRC','FONT-FACE-URI','FONT-FACE-FORMAT','FONT-FACE-NAME','MISSING-GLYPH'],g=[],y=[],fe='',p=te.documentElement,E=g.indexOf||function(r){for(var n=this.length;n--&&this[n]!==r;);return n},S=re.prototype,x=S.hasOwnProperty,c=S.isPrototypeOf,T=re.defineProperty,C=re.getOwnPropertyDescriptor,k=re.getOwnPropertyNames,w=re.getPrototypeOf,A=re.setPrototypeOf,O=!!re.__proto__,M=re.create||function t(r){return r?(t.prototype=r,new t):this},_=A||(O?function(r,n){return r.__proto__=n,r}:k&&C?function(){function r(o,a){for(var t=k(a),r=0,i=t.length,l;r<i;r++)l=t[r],x.call(o,l)||T(o,l,C(a,l))}return function(o,t){do r(o,t);while((t=w(t))&&!c.call(t,o));return o}}():function(r,o){for(var t in o)r[t]=o[t];return r}),L=ee.MutationObserver||ee.WebKitMutationObserver,P=(ee.HTMLElement||ee.Element||ee.Node).prototype,N=!c.call(P,p),D=N?function(t){return 1===t.nodeType}:function(t){return c.call(P,t)},B=N&&[],F=P.cloneNode,I=P.dispatchEvent,j=P.getAttribute,R=P.hasAttribute,U=P.removeAttribute,z=P.setAttribute,H=te.createElement,W=L&&{attributes:!0,characterData:!0,attributeOldValue:!0},V=L||function(){K=!1,p.removeEventListener(l,V)},X=ee.requestAnimationFrame||ee.webkitRequestAnimationFrame||ee.mozRequestAnimationFrame||ee.msRequestAnimationFrame||function(t){setTimeout(t,10)},q=!1,K=!0,G=!0,Y=!0,Z,$,Q,J,he,ve,be;A||O?(ve=function(r,n){c.call(n,r)||pe(r,n)},be=pe):(ve=function(r,n){r[me]||(r[me]=re(!0),pe(r,n))},be=ve),N?(K=!1,function(){var o=C(P,'addEventListener'),i=o.value,t=function(r){var n=new CustomEvent(l,{bubbles:!0});n.attrName=r,n.prevValue=j.call(this,r),n.newValue=null,n[f]=n.attrChange=2,U.call(this,r),I.call(this,n)},n=function(o,s){var t=R.call(this,o),n=t&&j.call(this,o),r=new CustomEvent(l,{bubbles:!0});z.call(this,o,s),r.attrName=o,r.prevValue=t?n:null,r.newValue=s,t?r[a]=r.attrChange=1:r[u]=r.attrChange=0,I.call(this,r)},r=function(o){var i=o.currentTarget,t=i[me],n=o.propertyName,r;t.hasOwnProperty(n)&&(t=t[n],r=new CustomEvent(l,{bubbles:!0}),r.attrName=t.name,r.prevValue=t.value||null,r.newValue=t.value=i[n]||null,null==r.prevValue?r[u]=r.attrChange=0:r[a]=r.attrChange=1,I.call(i,r))};o.value=function(a,s,o){a===l&&this.attributeChangedCallback&&this.setAttribute!==n&&(this[me]={className:{name:'class',value:this.className}},this.setAttribute=n,this.removeAttribute=t,i.call(this,'propertychange',r)),i.call(this,a,s,o)},T(P,'addEventListener',o)}()):L||(p.addEventListener(l,V),p.setAttribute(me,1),p.removeAttribute(me),K&&($=function(o){var i=this,t,n,r;if(i===o.target){for(r in t=i[me],i[me]=n=J(i),n){if(!(r in t))return Q(0,i,r,t[r],n[r],u);if(n[r]!==t[r])return Q(1,i,r,t[r],n[r],a)}for(r in t)if(!(r in n))return Q(2,i,r,t[r],n[r],f)}},Q=function(a,l,d,p,c,_){var s={attrChange:a,currentTarget:l,attrName:d,prevValue:p,newValue:c};s[_]=a,le(s)},J=function(a){for(var l={},r=a.attributes,i=0,s=r.length,o,t;i<s;i++)o=r[i],t=o.name,'setAttribute'!==t&&(l[t]=o.value);return l})),te[t]=function(t,n){if(l=t.toUpperCase(),q||(q=!0,L?(he=function(l,d){function t(o,a){for(var t=0,i=o.length;t<i;a(o[t++]));}return new L(function(n){for(var r=0,p=n.length,a,i,s;r<p;r++)a=n[r],'childList'===a.type?(t(a.addedNodes,l),t(a.removedNodes,d)):(i=a.target,Y&&i.attributeChangedCallback&&'style'!==a.attributeName&&(s=j.call(i,a.attributeName),s!==a.oldValue&&i.attributeChangedCallback(a.attributeName,a.oldValue,s)))})}(oe(ge),oe(s)),he.observe(te,{childList:!0,subtree:!0})):(Z=[],X(function t(){for(;Z.length;)Z.shift().call(null,Z.shift());X(t)}),te.addEventListener('DOMNodeInserted',se(ge)),te.addEventListener('DOMNodeRemoved',se(s))),te.addEventListener(ye,de),te.addEventListener('readystatechange',de),te.createElement=function(t,a){var l='string'==typeof a?a:'',r=l?H.call(te,t,l):H.call(te,t),i=''+t,s=E.call(g,(l?d:h)+(l||i).toUpperCase()),o=-1<s;return l&&(r.setAttribute('is',l=l.toLowerCase()),o&&(o=ie(i.toUpperCase(),l))),Y=!te.createElement.innerHTMLHelper,o&&be(r,y[s]),r},P.cloneNode=function(o){var a=F.call(this,!!o),t=ae(a);return-1<t&&be(a,y[t]),o&&r(a.querySelectorAll(fe)),a}),-2<E.call(g,d+l)+E.call(g,h+l)&&_e(t),!v.test(l)||-1<E.call(m,l))throw new Error('The type '+t+' is invalid');var _=function(){return a?te.createElement(u,l):te.createElement(u)},i=n||S,a=x.call(i,o),u=a?n[o].toUpperCase():l,l,c;return a&&-1<E.call(g,h+u)&&_e(u),c=g.push((a?d:h)+l)-1,fe=fe.concat(fe.length?',':'',a?u+'[is="'+t.toLowerCase()+'"]':u),_.prototype=y[c]=x.call(i,'prototype')?i.prototype:M(P),ne(te.querySelectorAll(fe),ge),_}}})(window,document,Object,'registerElement'),Ke();var Gi=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype.getStyles=function(){return Ni},r.prototype._makeImperativeCounterpart=function(){return new Qi({_motorHtmlCounterpart:this})},r.prototype.attributeChangedCallback=function(){for(var r=this,n=[],o=arguments.length;o--;)n[o]=arguments[o];t.prototype.attributeChangedCallback.apply(this,n),this._imperativeCounterpartPromise.then(function(){(t=r)._updateNodeProperty.apply(t,n);var t})},r.prototype._updateNodeProperty=function(t,r,n){n!==r&&(t.match(/opacity/i)?this.imperativeCounterpart[t]=window.parseFloat(n):t.match(/sizeMode/i)?this.imperativeCounterpart[t]=je(n):(t.match(/rotation/i)||t.match(/scale/i)||t.match(/position/i)||t.match(/absoluteSize/i)||t.match(/proportionalSize/i)||t.match(/align/i)||t.match(/mountPoint/i)||t.match(/origin/i)||t.match(/skew/i))&&(this.imperativeCounterpart[t]=Be(n)))},r}(Bi);$e(Fi,Gi),$e(Mi,Gi),Gi=document.registerElement('motor-node',Gi);var Vi=new WeakMap,Bi;HTMLElement.prototype.createShadowRoot instanceof Function&&(HTMLElement.prototype.createShadowRoot=Ye(HTMLElement.prototype.createShadowRoot)),HTMLElement.prototype.attachShadow instanceof Function&&(HTMLElement.prototype.attachShadow=Ye(HTMLElement.prototype.attachShadow)),Ke();var ji=W(function(t,r){Object.defineProperty(r,'__esModule',{value:!0});var n=function(t){return t&&t.__esModule?t:{default:t}}(si);r.default=function(t){var o=null,r=new n.default(function(t){return o=t});return setTimeout(o,t),r}}),Hi=W(function(t){Jt.Two=function(r){function n(){var t=document.body.getBoundingClientRect(),r=this.width=t.width,n=this.height=t.height;this.renderer.setSize(r,n,this.ratio),this.trigger(S.Events.resize,r,n)}function o(){D(o);for(var r=0,n;r<S.Instances.length;r++)n=S.Instances[r],n.playing&&n.update()}var a='undefined'==typeof window?'undefined'==typeof Jt?null:Jt:window,s={_indexAmount:0,natural:{slice:Array.prototype.slice,indexOf:Array.prototype.indexOf,keys:Object.keys,bind:Function.prototype.bind,create:Object.create},identity:function(t){return t},isArguments:function(t){return'[object Arguments]'===toString.call(t)},isFunction:function(t){return'[object Function]'===toString.call(t)},isString:function(t){return'[object String]'===toString.call(t)},isNumber:function(t){return'[object Number]'===toString.call(t)},isDate:function(t){return'[object Date]'===toString.call(t)},isRegExp:function(t){return'[object RegExp]'===toString.call(t)},isError:function(t){return'[object Error]'===toString.call(t)},isFinite:function(t){return isFinite(t)&&!isNaN(parseFloat(t))},isNaN:function(t){return s.isNumber(t)&&t!==+t},isBoolean:function(t){return!0===t||!1===t||'[object Boolean]'===toString.call(t)},isNull:function(t){return null===t},isUndefined:function(t){return void 0===t},isEmpty:function(t){return null==t||(h&&(s.isArray(t)||s.isString(t)||s.isArguments(t))?0===t.length:0===s.keys(t).length)},isElement:function(t){return!!(t&&1===t.nodeType)},isArray:Array.isArray||function(t){return'[object Array]'===toString.call(t)},isObject:function(t){var r=typeof t;return'function'==r||'object'==r&&!!t},toArray:function(t){return t?s.isArray(t)?g.call(t):h(t)?s.map(t,s.identity):s.values(t):[]},range:function(t,r,n){null==r&&(r=t||0,t=0),n=n||1;for(var o=tt(et((r-t)/n),0),a=Array(o),i=0;i<o;i++,t+=n)a[i]=t;return a},indexOf:function(t,r){if(!!s.natural.indexOf)return s.natural.indexOf.call(t,r);for(var n=0;n<t.length;n++)if(t[n]===r)return n;return-1},has:function(t,r){return null!=t&&hasOwnProperty.call(t,r)},bind:function(t,r){var n=s.natural.bind;if(n&&t.bind===n)return n.apply(t,g.call(arguments,1));var o=g.call(arguments,2);return function(){t.apply(r,o)}},extend:function(t){for(var r=g.call(arguments,1),n=0,o;n<r.length;n++)for(var a in o=r[n],o)t[a]=o[a];return t},defaults:function(t){for(var r=g.call(arguments,1),n=0,o;n<r.length;n++)for(var a in o=r[n],o)void 0===t[a]&&(t[a]=o[a]);return t},keys:function(t){if(!s.isObject(t))return[];if(s.natural.keys)return s.natural.keys(t);var r=[];for(var n in t)s.has(t,n)&&r.push(n);return r},values:function(t){for(var r=s.keys(t),n=[],o=0,a;o<r.length;o++)a=r[o],n.push(t[a]);return n},each:function(t,r,n){for(var o=n||this,a=!h(t)&&s.keys(t),l=(a||t).length,d=0,i;d<l;d++)i=a?a[d]:d,r.call(o,t[i],i,t);return t},map:function(t,r,n){for(var o=n||this,a=!h(t)&&s.keys(t),l=(a||t).length,d=[],p=0,i;p<l;p++)i=a?a[p]:p,d[p]=r.call(o,t[i],i,t);return d},once:function(t){var r=!1;return function(){return r?t:(r=!0,t.apply(this,arguments))}},after:function(t,r){return function(){for(var n=arguments,o=this;1>--t;)return r.apply(o,n)}},uniqueId:function(t){var r=++s._indexAmount+'';return t?t+r:r}},i=pt,l=ct,d=lt,p=st,_=at,u=_/2,c=ot,m=0,g=s.natural.slice,y=a.performance&&a.performance.now?a.performance:Date,f=function(t){return null==t?void 0:t.length},h=function(t){var r=f(t);return'number'==typeof r&&0<=r&&r<=9007199254740991},v={temp:a.document?a.document.createElement('div'):{},hasEventListeners:s.isFunction(a.addEventListener),bind:function(t,r,n,o){return this.hasEventListeners?t.addEventListener(r,n,!!o):t.attachEvent('on'+r,n),v},unbind:function(t,r,n,o){return v.hasEventListeners?t.removeEventListeners(r,n,!!o):t.detachEvent('on'+r,n),v},getRequestAnimationFrame:function(){var t=0,r=['ms','moz','webkit','o'],n=a.requestAnimationFrame,l;if(!n){for(var d=0;d<r.length;d++)n=a[r[d]+'RequestAnimationFrame']||n,l=a[r[d]+'CancelAnimationFrame']||a[r[d]+'CancelRequestAnimationFrame']||l;n=n||function(r){var n=new Date().getTime(),o=tt(0,16-(n-t)),i=a.setTimeout(function(){r(n+o)},o);return t=n+o,i}}return n.init=s.once(o),n}},S=a.Two=function(t){var r=s.defaults(t||{},{fullscreen:!1,width:640,height:480,type:S.Types.svg,autostart:!1});if(s.each(r,function(t,r){'fullscreen'===r||'autostart'===r||(this[r]=t)},this),s.isElement(r.domElement)){var o=r.domElement.tagName.toLowerCase();/^(CanvasRenderer-canvas|WebGLRenderer-canvas|SVGRenderer-svg)$/.test(this.type+'-'+o)||(this.type=S.Types[o])}if(this.renderer=new S[this.type](this),S.Utils.setPlaying.call(this,r.autostart),this.frameCount=0,r.fullscreen){var i=s.bind(n,this);s.extend(document.body.style,{overflow:'hidden',margin:0,padding:0,top:0,left:0,right:0,bottom:0,position:'fixed'}),s.extend(this.renderer.domElement.style,{display:'block',top:0,left:0,right:0,bottom:0,position:'fixed'}),v.bind(a,'resize',i),i()}else s.isElement(r.domElement)||(this.renderer.setSize(r.width,r.height,this.ratio),this.width=r.width,this.height=r.height);this.scene=this.renderer.scene,S.Instances.push(this),D.init()};s.extend(S,{root:a,Array:a.Float32Array||Array,Types:{webgl:'WebGLRenderer',svg:'SVGRenderer',canvas:'CanvasRenderer'},Version:'v0.7.0',Identifier:'two_',Properties:{hierarchy:'hierarchy',demotion:'demotion'},Events:{play:'play',pause:'pause',update:'update',render:'render',resize:'resize',change:'change',remove:'remove',insert:'insert',order:'order',load:'load'},Commands:{move:'M',line:'L',curve:'C',close:'Z'},Resolution:8,Instances:[],noConflict:function(){return a.Two=r,this},uniqueId:function(){var t=m;return m++,t},Utils:s.extend(s,{performance:y,defineProperty:function(t){var r=this,n='_'+t,o='_flag'+t.charAt(0).toUpperCase()+t.slice(1);Object.defineProperty(r,t,{enumerable:!0,get:function(){return this[n]},set:function(t){this[n]=t,this[o]=!0}})},release:function(t){s.isObject(t)&&(s.isFunction(t.unbind)&&t.unbind(),t.vertices&&(s.isFunction(t.vertices.unbind)&&t.vertices.unbind(),s.each(t.vertices,function(t){s.isFunction(t.unbind)&&t.unbind()})),t.children&&s.each(t.children,function(t){S.Utils.release(t)}))},xhr:function(t,r){var n=new XMLHttpRequest;return n.open('GET',t),n.onreadystatechange=function(){4===n.readyState&&200===n.status&&r(n.responseText)},n.send(),n},Curve:{CollinearityEpsilon:c(10,-30),RecursionLimit:16,CuspLimit:0,Tolerance:{distance:0.25,angle:0,epsilon:0.01},abscissas:[[0.5773502691896257],[0,0.7745966692414834],[0.33998104358485626,0.8611363115940526],[0,0.5384693101056831,0.906179845938664],[0.2386191860831969,0.6612093864662645,0.932469514203152],[0,0.4058451513773972,0.7415311855993945,0.9491079123427585],[0.1834346424956498,0.525532409916329,0.7966664774136267,0.9602898564975363],[0,0.3242534234038089,0.6133714327005904,0.8360311073266358,0.9681602395076261],[0.14887433898163122,0.4333953941292472,0.6794095682990244,0.8650633666889845,0.9739065285171717],[0,0.26954315595234496,0.5190961292068118,0.7301520055740494,0.8870625997680953,0.978228658146057],[0.1252334085114689,0.3678314989981802,0.5873179542866175,0.7699026741943047,0.9041172563704749,0.9815606342467192],[0,0.2304583159551348,0.44849275103644687,0.6423493394403402,0.8015780907333099,0.9175983992229779,0.9841830547185881],[0.10805494870734367,0.31911236892788974,0.5152486363581541,0.6872929048116855,0.827201315069765,0.9284348836635735,0.9862838086968123],[0,0.20119409399743451,0.3941513470775634,0.5709721726085388,0.7244177313601701,0.8482065834104272,0.937273392400706,0.9879925180204854],[0.09501250983763744,0.2816035507792589,0.45801677765722737,0.6178762444026438,0.755404408355003,0.8656312023878318,0.9445750230732326,0.9894009349916499]],weights:[[1],[0.8888888888888888,0.5555555555555556],[0.6521451548625461,0.34785484513745385],[0.5688888888888889,0.47862867049936647,0.23692688505618908],[0.46791393457269104,0.3607615730481386,0.17132449237917036],[0.4179591836734694,0.3818300505051189,0.27970539148927664,0.1294849661688697],[0.362683783378362,0.31370664587788727,0.22238103445337448,0.10122853629037626],[0.3302393550012598,0.31234707704000286,0.26061069640293544,0.1806481606948574,0.08127438836157441],[0.29552422471475287,0.26926671930999635,0.21908636251598204,0.1494513491505806,0.06667134430868814],[0.2729250867779006,0.26280454451024665,0.23319376459199048,0.18629021092773426,0.1255803694649046,0.05566856711617366],[0.24914704581340277,0.2334925365383548,0.20316742672306592,0.16007832854334622,0.10693932599531843,0.04717533638651183],[0.2325515532308739,0.22628318026289723,0.2078160475368885,0.17814598076194574,0.13887351021978725,0.09212149983772845,0.04048400476531588],[0.2152638534631578,0.2051984637212956,0.18553839747793782,0.15720316715819355,0.12151857068790319,0.08015808715976021,0.03511946033175186],[0.2025782419255613,0.19843148532711158,0.1861610000155622,0.16626920581699392,0.13957067792615432,0.10715922046717194,0.07036604748810812,0.03075324199611727],[0.1894506104550685,0.18260341504492358,0.16915651939500254,0.14959598881657674,0.12462897125553388,0.09515851168249279,0.062253523938647894,0.027152459411754096]]},devicePixelRatio:a.devicePixelRatio||1,getBackingStoreRatio:function(t){return t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1},getRatio:function(t){return S.Utils.devicePixelRatio/L(t)},setPlaying:function(t){return this.playing=!!t,this},getComputedMatrix:function(t,r){r=r&&r.identity()||new S.Matrix;for(var n=t,o=[];n&&n._matrix;)o.push(n._matrix),n=n.parent;return o.reverse(),s.each(o,function(t){var n=t.elements;r.multiply(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8],n[9])}),r},deltaTransformPoint:function(t,r,n){var o=r*t.a+n*t.c+0,a=r*t.b+n*t.d+0;return new S.Vector(o,a)},decomposeMatrix:function(t){var r=S.Utils.deltaTransformPoint(t,0,1),n=S.Utils.deltaTransformPoint(t,1,0),o=180/at*lt(r.y,r.x)-90,a=180/at*lt(n.y,n.x);return{translateX:t.e,translateY:t.f,scaleX:st(t.a*t.a+t.b*t.b),scaleY:st(t.c*t.c+t.d*t.d),skewX:o,skewY:a,rotation:o}},applySvgAttributes:function(t,r){var n=this,o={},a={},l,i,d,p;if(getComputedStyle){var c=getComputedStyle(t);for(l=c.length;l--;)i=c[l],d=c[i],void 0!==d&&(a[i]=d)}for(l=t.attributes.length;l--;)p=t.attributes[l],o[p.nodeName]=p.value;for(i in s.isUndefined(a.opacity)||(a['stroke-opacity']=a.opacity,a['fill-opacity']=a.opacity),s.extend(a,o),a.visible=!(s.isUndefined(a.display)&&'none'===a.display)||s.isUndefined(a.visibility)&&'hidden'===a.visibility,a)switch(d=a[i],i){case'transform':if('none'===d)break;var _=t.getCTM?t.getCTM():null;if(null===_)break;var u=S.Utils.decomposeMatrix(t.getCTM());r.translation.set(u.translateX,u.translateY),r.rotation=u.rotation,r.scale=u.scaleX;var m=parseFloat((a.x+'').replace('px')),g=parseFloat((a.y+'').replace('px'));m&&(r.translation.x=m),g&&(r.translation.y=g);break;case'visible':r.visible=d;break;case'stroke-linecap':r.cap=d;break;case'stroke-linejoin':r.join=d;break;case'stroke-miterlimit':r.miter=d;break;case'stroke-width':r.linewidth=parseFloat(d);break;case'stroke-opacity':case'fill-opacity':case'opacity':r.opacity=parseFloat(d);break;case'fill':case'stroke':r[i]=/url\(\#.*\)/i.test(d)?n.getById(d.replace(/url\(\#(.*)\)/i,'$1')):'none'===d?'transparent':d;break;case'id':r.id=d;break;case'class':r.classList=d.split(' ');}return r},read:{svg:function(){return S.Utils.read.g.apply(this,arguments)},g:function(t){var r=new S.Group;S.Utils.applySvgAttributes.call(this,t,r);for(var a=0,i=t.childNodes.length;a<i;a++){var l=t.childNodes[a],n=l.nodeName;if(!n)return;var s=n.replace(/svg\:/ig,'').toLowerCase();if(s in S.Utils.read){var d=S.Utils.read[s].call(r,l);r.add(d)}}return r},polygon:function(t,r){var n=t.getAttribute('points'),o=[];n.replace(/(-?[\d\.?]+)[,|\s](-?[\d\.?]+)/g,function(t,r,n){o.push(new S.Anchor(parseFloat(r),parseFloat(n)))});var a=new S.Path(o,!r).noStroke();return a.fill='black',S.Utils.applySvgAttributes.call(this,t,a)},polyline:function(t){return S.Utils.read.polygon.call(this,t,!0)},path:function(t){var r=t.getAttribute('d'),n=new S.Anchor,o=!1,d=!1,a=r.match(/[a-df-z][^a-df-z]*/ig),p=a.length-1,_,g;s.each(a.slice(0),function(t,r){var n=t[0],o=n.toLowerCase(),i=t.slice(1).trim().split(/[\s,]+|(?=\s?[+\-])/),s=[],d;switch(0>=r&&(a=[]),o){case'h':case'v':1<i.length&&(d=1);break;case'm':case'l':case't':2<i.length&&(d=2);break;case's':case'q':4<i.length&&(d=4);break;case'c':6<i.length&&(d=6);break;case'a':}if(d){for(var p=0,c=i.length,l=0,_;p<c;p+=d)_=n,0<l&&('m'===n?_='l':'M'===n?_='L':void 0),s.push([_].concat(i.slice(p,p+d)).join(' ')),l++;a=Array.prototype.concat.apply(a,s)}else a.push(t)});var f=[];if(s.each(a,function(t,h){var i=t[0],C=i.toLowerCase(),k,T,x;g=t.slice(1).trim(),g=g.replace(/(-?\d+(?:\.\d*)?)[eE]([+\-]?\d+)/g,function(t,r,n){return parseFloat(r)*c(10,n)}),g=g.split(/[\s,]+|(?=\s?[+\-])/),d=i===C;var y,P,R,E,w,A,O,L,z;switch(C){case'z':h>=p?o=!0:(T=n.x,x=n.y,k=new S.Anchor(T,x,void 0,void 0,void 0,void 0,S.Commands.close));break;case'm':case'l':T=parseFloat(g[0]),x=parseFloat(g[1]),k=new S.Anchor(T,x,void 0,void 0,void 0,void 0,'m'===C?S.Commands.move:S.Commands.line),d&&k.addSelf(n),n=k;break;case'h':case'v':var F='h'===C?'x':'y',a='x'==F?'y':'x';k=new S.Anchor(void 0,void 0,void 0,void 0,void 0,void 0,S.Commands.line),k[F]=parseFloat(g[0]),k[a]=n[a],d&&(k[F]+=n[F]),n=k;break;case'c':case's':y=n.x,P=n.y,_||(_=new S.Vector),'c'===C?(R=parseFloat(g[0]),E=parseFloat(g[1]),w=parseFloat(g[2]),A=parseFloat(g[3]),O=parseFloat(g[4]),L=parseFloat(g[5])):(z=U(n,_,d),R=z.x,E=z.y,w=parseFloat(g[0]),A=parseFloat(g[1]),O=parseFloat(g[2]),L=parseFloat(g[3])),d&&(R+=y,E+=P,w+=y,A+=P,O+=y,L+=P),s.isObject(n.controls)||S.Anchor.AppendCurveProperties(n),n.controls.right.set(R-n.x,E-n.y),k=new S.Anchor(O,L,w-O,A-L,void 0,void 0,S.Commands.curve),n=k,_=k.controls.left;break;case't':case'q':y=n.x,P=n.y,_||(_=new S.Vector),_.isZero()?(R=y,E=P):(R=_.x,P=_.y),'q'===C?(w=parseFloat(g[0]),A=parseFloat(g[1]),O=parseFloat(g[1]),L=parseFloat(g[2])):(z=U(n,_,d),w=z.x,A=z.y,O=parseFloat(g[0]),L=parseFloat(g[1])),d&&(R+=y,E+=P,w+=y,A+=P,O+=y,L+=P),s.isObject(n.controls)||S.Anchor.AppendCurveProperties(n),n.controls.right.set(R-n.x,E-n.y),k=new S.Anchor(O,L,w-O,A-L,void 0,void 0,S.Commands.curve),n=k,_=k.controls.left;break;case'a':y=n.x,P=n.y;var N=parseFloat(g[0]),D=parseFloat(g[1]),I=parseFloat(g[2])*at/180,G=parseFloat(g[3]),V=parseFloat(g[4]);O=parseFloat(g[5]),L=parseFloat(g[6]),d&&(O+=y,L+=P);var B=(O-y)/2,j=(L-P)/2,H=B*ct(I)+j*pt(I),W=-B*pt(I)+j*ct(I),Y=N*N,X=D*D,q=H*H,Z=W*W,K=q/Y+Z/X;1<K&&(N*=st(K),D*=st(K));var l=st((Y*X-Y*Z-X*q)/(Y*Z+X*q));s.isNaN(l)?l=0:G!=V&&0<l&&(l*=-1);var $=l*N*W/D,Q=-l*D*H/N,J=$*ct(I)-Q*pt(I)+(y+O)/2,ee=$*pt(I)+Q*ct(I)+(P+L)/2,te=function(t){return st(ot(t[0],2)+ot(t[1],2))},m=function(t,r){return(t[0]*r[0]+t[1]*r[1])/(te(t)*te(r))},F=function(t,r){return(t[0]*r[1]<t[1]*r[0]?-1:1)*Math.acos(m(t,r))},r=F([1,0],[(H-$)/N,(W-Q)/D]),re=[(H-$)/N,(W-Q)/D],u=[(-H-$)/N,(-W-Q)/D],v=F(re,u);-1>=m(re,u)&&(v=at),1<=m(re,u)&&(v=0),G&&(v=M(v,2*at)),V&&0<v&&(v-=2*at);var ne=S.Resolution,oe=new S.Matrix().translate(J,ee).rotate(I);k=s.map(s.range(ne),function(t){var n=(1-t/(ne-1))*v+r,o=N*ct(n),a=D*pt(n),i=oe.multiply(o,a,1);return new S.Anchor(i.x,i.y,!1,!1,!1,!1,S.Commands.line)}),k.push(new S.Anchor(O,L,!1,!1,!1,!1,S.Commands.line)),n=k[k.length-1],_=n.controls.left;}k&&(s.isArray(k)?f=f.concat(k):f.push(k))}),!(1>=f.length)){var r=new S.Path(f,o,void 0,!0).noStroke();r.fill='black';var i=r.getBoundingClientRect(!0);return i.centroid={x:i.left+i.width/2,y:i.top+i.height/2},s.each(r.vertices,function(t){t.subSelf(i.centroid)}),r.translation.addSelf(i.centroid),S.Utils.applySvgAttributes.call(this,t,r)}},circle:function(t){var n=parseFloat(t.getAttribute('cx')),o=parseFloat(t.getAttribute('cy')),a=parseFloat(t.getAttribute('r')),r=new S.Circle(n,o,a).noStroke();return r.fill='black',S.Utils.applySvgAttributes.call(this,t,r)},ellipse:function(t){var r=parseFloat(t.getAttribute('cx')),n=parseFloat(t.getAttribute('cy')),o=parseFloat(t.getAttribute('rx')),a=parseFloat(t.getAttribute('ry')),i=new S.Ellipse(r,n,o,a).noStroke();return i.fill='black',S.Utils.applySvgAttributes.call(this,t,i)},rect:function(t){var r=parseFloat(t.getAttribute('x'))||0,n=parseFloat(t.getAttribute('y'))||0,o=parseFloat(t.getAttribute('width')),a=parseFloat(t.getAttribute('height')),i=new S.Rectangle(r+o/2,n+a/2,o,a).noStroke();return i.fill='black',S.Utils.applySvgAttributes.call(this,t,i)},line:function(t){var r=parseFloat(t.getAttribute('x1')),n=parseFloat(t.getAttribute('y1')),o=parseFloat(t.getAttribute('x2')),a=parseFloat(t.getAttribute('y2')),i=new S.Line(r,n,o,a).noFill();return S.Utils.applySvgAttributes.call(this,t,i)},lineargradient:function(t){for(var r=parseFloat(t.getAttribute('x1')),n=parseFloat(t.getAttribute('y1')),o=parseFloat(t.getAttribute('x2')),a=parseFloat(t.getAttribute('y2')),l=(o+r)/2,d=(a+n)/2,p=[],c=0;c<t.children.length;c++){var i=t.children[c],_=parseFloat(i.getAttribute('offset')),u=i.getAttribute('stop-color'),m=i.getAttribute('stop-opacity'),g=i.getAttribute('style');if(s.isNull(u)){var y=!!g&&g.match(/stop\-color\:\s?([\#a-fA-F0-9]*)/);u=y&&1<y.length?y[1]:void 0}if(s.isNull(m)){var y=!!g&&g.match(/stop\-opacity\:\s?([0-9\.\-]*)/);m=y&&1<y.length?parseFloat(y[1]):1}p.push(new S.Gradient.Stop(_,u,m))}var f=new S.LinearGradient(r-l,n-d,o-l,a-d,p);return S.Utils.applySvgAttributes.call(this,t,f)},radialgradient:function(t){var n=parseFloat(t.getAttribute('cx'))||0,o=parseFloat(t.getAttribute('cy'))||0,a=parseFloat(t.getAttribute('r')),r=parseFloat(t.getAttribute('fx')),l=parseFloat(t.getAttribute('fy'));s.isNaN(r)&&(r=n),s.isNaN(l)&&(l=o);for(var d=it(n+r)/2,p=it(o+l)/2,c=[],_=0;_<t.children.length;_++){var i=t.children[_],u=parseFloat(i.getAttribute('offset')),m=i.getAttribute('stop-color'),g=i.getAttribute('stop-opacity'),y=i.getAttribute('style');if(s.isNull(m)){var f=!!y&&y.match(/stop\-color\:\s?([\#a-fA-F0-9]*)/);m=f&&1<f.length?f[1]:void 0}if(s.isNull(g)){var f=!!y&&y.match(/stop\-opacity\:\s?([0-9\.\-]*)/);g=f&&1<f.length?parseFloat(f[1]):1}c.push(new S.Gradient.Stop(u,m,g))}var h=new S.RadialGradient(n-d,o-p,a,c,r-d,l-p);return S.Utils.applySvgAttributes.call(this,t,h)}},subdivide:function(r,n,o,a,l,d,p,c,t){t=t||S.Utils.Curve.RecursionLimit;var _=t+1;return r===p&&n===c?[new S.Anchor(p,c)]:s.map(s.range(0,_),function(s){var i=s/_,t=z(i,r,o,l,p),u=z(i,n,a,d,c);return new S.Anchor(t,u)})},getPointOnCubicBezier:function(r,t,n,o,a){var i=1-r;return i*i*i*t+3*i*i*r*n+3*i*r*r*o+r*r*r*a},getCurveLength:function(r,n,o,a,i,l,s,d,t){if(r===o&&n===a&&i===s&&l===d){var c=s-r,_=d-n;return p(c*c+_*_)}return N(function(c){var t=((9*(o-i)+3*(s-r))*c+(6*(r+i)-12*o))*c+3*(o-r),_=((9*(a-l)+3*(d-n))*c+(6*(n+l)-12*a))*c+3*(a-n);return p(t*t+_*_)},0,1,t||S.Utils.Curve.RecursionLimit)},integrate:function(t,r,o,a){for(var n=S.Utils.Curve.abscissas[a-2],l=S.Utils.Curve.weights[a-2],s=0.5*(o-r),d=s+r,p=0,i=1&a?l[p++]*t(d):0,c;p<a+1>>1;)c=s*n[p],i+=l[p++]*(t(d+c)+t(d-c));return s*i},getCurveFromPoints:function(t,r){for(var n=t.length,o=0,i;o<n;o++){i=t[o],s.isObject(i.controls)||S.Anchor.AppendCurveProperties(i);var l=r?M(o-1,n):tt(o-1,0),d=r?M(o+1,n):Je(o+1,n-1),p=t[l],a=i,_=t[d];E(p,a,_),a._command=0===o?S.Commands.move:S.Commands.curve,a.controls.left.x=s.isNumber(a.controls.left.x)?a.controls.left.x:a.x,a.controls.left.y=s.isNumber(a.controls.left.y)?a.controls.left.y:a.y,a.controls.right.x=s.isNumber(a.controls.right.x)?a.controls.right.x:a.x,a.controls.right.y=s.isNumber(a.controls.right.y)?a.controls.right.y:a.y}},getControlPoints:function(t,r,n){var o=R(t,r),a=R(n,r),d=C(t,r),p=C(n,r),c=(o+a)/2;return(r.u=s.isObject(r.controls.left)?r.controls.left:new S.Vector(0,0),r.v=s.isObject(r.controls.right)?r.controls.right:new S.Vector(0,0),1e-4>d||1e-4>p)?(r._relative||(r.controls.left.copy(r),r.controls.right.copy(r)),r):(d*=0.33,p*=0.33,a<o?c+=u:c-=u,r.controls.left.x=l(c)*d,r.controls.left.y=i(c)*d,c-=_,r.controls.right.x=l(c)*p,r.controls.right.y=i(c)*p,r._relative||(r.controls.left.x+=r.x,r.controls.left.y+=r.y,r.controls.right.x+=r.x,r.controls.right.y+=r.y),r)},getReflection:function(t,r,n){return new S.Vector(2*t.x-(r.x+t.x)-(n?t.x:0),2*t.y-(r.y+t.y)-(n?t.y:0))},getAnchorsFromArcData:function(t,r,n,o,a,d,p){var i=new S.Matrix().translate(t.x,t.y).rotate(r),c=S.Resolution;return s.map(s.range(c),function(t){var r=(t+1)/c;!p||(r=1-r);var i=r*d+a,l=n*ct(i),s=o*pt(i),_=new S.Anchor(l,s);return S.Anchor.AppendCurveProperties(_),_.command=S.Commands.line,_})},ratioBetween:function(t,r){return(t.x*r.x+t.y*r.y)/(t.length()*r.length())},angleBetween:function(t,r){var n,o;return 4<=arguments.length?(n=arguments[0]-arguments[2],o=arguments[1]-arguments[3],d(o,n)):(n=t.x-r.x,o=t.y-r.y,d(o,n))},distanceBetweenSquared:function(t,r){var n=t.x-r.x,o=t.y-r.y;return n*n+o*o},distanceBetween:function(t,r){return p(T(t,r))},lerp:function(r,n,o){return o*(n-r)+r},toFixed:function(t){return nt(1e3*t)/1e3},mod:function(t,r){for(;0>t;)t+=r;return t%r},Collection:function(){Array.call(this),1<arguments.length?Array.prototype.push.apply(this,arguments):arguments[0]&&Array.isArray(arguments[0])&&Array.prototype.push.apply(this,arguments[0])},Error:function(t){this.name='two.js',this.message=t},Events:{on:function(t,r){this._events||(this._events={});var n=this._events[t]||(this._events[t]=[]);return n.push(r),this},off:function(t,r){var n=this;if(!this._events)return this;if(!t&&!r)return this._events={},this;for(var o=t?[t]:s.keys(this._events),a=0,i=o.length;a<i;a++){var t=o[a],l=n._events[t];if(!!l){var d=[];if(r)for(var p=0,c=l.length,_;p<c;p++)_=l[p],_=_.callback?_.callback:_,r&&r!==_&&d.push(_);n._events[t]=d}}return this},trigger:function(t){if(!this._events)return this;var r=g.call(arguments,1),n=this._events[t];return n&&x(this,n,r),this},listen:function(t,r,n){var o=this;if(t){var a=function(){n.apply(o,arguments)};a.obj=t,a.name=r,a.callback=n,t.on(r,a)}return this},ignore:function(t,r,n){return t.off(r,n),this}}})}),S.Utils.Events.bind=S.Utils.Events.on,S.Utils.Events.unbind=S.Utils.Events.off;var x=function(t,r,n){var o;switch(n.length){case 0:o=function(o){r[o].call(t,n[0])};break;case 1:o=function(o){r[o].call(t,n[0],n[1])};break;case 2:o=function(o){r[o].call(t,n[0],n[1],n[2])};break;case 3:o=function(o){r[o].call(t,n[0],n[1],n[2],n[3])};break;default:o=function(o){r[o].apply(t,n)};}for(var a=0;a<r.length;a++)o(a)};S.Utils.Error.prototype=new Error,S.Utils.Error.prototype.constructor=S.Utils.Error,S.Utils.Collection.prototype=[],S.Utils.Collection.prototype.constructor=S.Utils.Collection,s.extend(S.Utils.Collection.prototype,S.Utils.Events,{pop:function(){var t=Array.prototype.pop.apply(this,arguments);return this.trigger(S.Events.remove,[t]),t},shift:function(){var t=Array.prototype.shift.apply(this,arguments);return this.trigger(S.Events.remove,[t]),t},push:function(){var t=Array.prototype.push.apply(this,arguments);return this.trigger(S.Events.insert,arguments),t},unshift:function(){var t=Array.prototype.unshift.apply(this,arguments);return this.trigger(S.Events.insert,arguments),t},splice:function(){var t=Array.prototype.splice.apply(this,arguments),r;return this.trigger(S.Events.remove,t),2<arguments.length&&(r=this.slice(arguments[0],arguments[0]+arguments.length-2),this.trigger(S.Events.insert,r),this.trigger(S.Events.order)),t},sort:function(){return Array.prototype.sort.apply(this,arguments),this.trigger(S.Events.order),this},reverse:function(){return Array.prototype.reverse.apply(this,arguments),this.trigger(S.Events.order),this}});var C=S.Utils.distanceBetween,k=S.Utils.getAnchorsFromArcData,T=S.Utils.distanceBetweenSquared,P=S.Utils.ratioBetween,R=S.Utils.angleBetween,E=S.Utils.getControlPoints,w=S.Utils.getCurveFromPoints,A=S.Utils.solveSegmentIntersection,O=S.Utils.decoupleShapes,M=S.Utils.mod,L=S.Utils.getBackingStoreRatio,z=S.Utils.getPointOnCubicBezier,F=S.Utils.getCurveLength,N=S.Utils.integrate,U=S.Utils.getReflection;s.extend(S.prototype,S.Utils.Events,{appendTo:function(t){return t.appendChild(this.renderer.domElement),this},play:function(){return S.Utils.setPlaying.call(this,!0),this.trigger(S.Events.play)},pause:function(){return this.playing=!1,this.trigger(S.Events.pause)},update:function(){var t=!!this._lastFrame,r=y.now();this.frameCount++,t&&(this.timeDelta=parseFloat((r-this._lastFrame).toFixed(3))),this._lastFrame=r;var n=this.width,o=this.height,a=this.renderer;return(n!==a.width||o!==a.height)&&a.setSize(n,o,this.ratio),this.trigger(S.Events.update,this.frameCount,this.timeDelta),this.render()},render:function(){return this.renderer.render(),this.trigger(S.Events.render,this.frameCount)},add:function(t){var r=t;return r instanceof Array||(r=s.toArray(arguments)),this.scene.add(r),this},remove:function(t){var r=t;return r instanceof Array||(r=s.toArray(arguments)),this.scene.remove(r),this},clear:function(){return this.scene.remove(s.toArray(this.scene.children)),this},makeLine:function(t,r,n,o){var a=new S.Line(t,r,n,o);return this.scene.add(a),a},makeRectangle:function(t,r,n,o){var a=new S.Rectangle(t,r,n,o);return this.scene.add(a),a},makeRoundedRectangle:function(t,r,n,o,a){var i=new S.RoundedRectangle(t,r,n,o,a);return this.scene.add(i),i},makeCircle:function(t,n,o){var r=new S.Circle(t,n,o);return this.scene.add(r),r},makeEllipse:function(t,r,n,o){var a=new S.Ellipse(t,r,n,o);return this.scene.add(a),a},makeStar:function(t,r,n,o,a){var i=new S.Star(t,r,n,o,a);return this.scene.add(i),i},makeCurve:function(t){var r=arguments,n=arguments.length,o=t;if(!s.isArray(t)){o=[];for(var a=0,i,l;a<n&&(i=r[a],!!s.isNumber(i));a+=2)l=r[a+1],o.push(new S.Anchor(i,l))}var d=arguments[n-1],p=new S.Path(o,!s.isBoolean(d)||!d,!0),c=p.getBoundingClientRect();return p.center().translation.set(c.left+c.width/2,c.top+c.height/2),this.scene.add(p),p},makePolygon:function(t,n,o,r){var a=new S.Polygon(t,n,o,r);return this.scene.add(a),a},makeArcSegment:function(t,r,n,o,a,i,l){var s=new S.ArcSegment(t,r,n,o,a,i,l);return this.scene.add(s),s},makePath:function(t){var r=arguments,n=arguments.length,o=t;if(!s.isArray(t)){o=[];for(var a=0,i,l;a<n&&(i=r[a],!!s.isNumber(i));a+=2)l=r[a+1],o.push(new S.Anchor(i,l))}var d=arguments[n-1],p=new S.Path(o,!s.isBoolean(d)||!d),c=p.getBoundingClientRect();return p.center().translation.set(c.left+c.width/2,c.top+c.height/2),this.scene.add(p),p},makeText:function(t,r,n,o){var a=new S.Text(t,r,n,o);return this.add(a),a},makeLinearGradient:function(t,r,n,o){var a=g.call(arguments,4),i=new S.LinearGradient(t,r,n,o,a);return this.add(i),i},makeRadialGradient:function(t,n,o){var r=g.call(arguments,3),a=new S.RadialGradient(t,n,o,r);return this.add(a),a},makeSprite:function(t,r,n,o,a,i,l){var s=new S.Sprite(t,r,n,o,a,i);return!l||s.play(),this.add(s),s},makeImageSequence:function(t,r,n,o,a){var i=new S.ImageSequence(t,r,n,o);return!a||i.play(),this.add(i),i},makeTexture:function(t,r){var n=new S.Texture(t,r);return n},makeGroup:function(t){var r=t;r instanceof Array||(r=s.toArray(arguments));var n=new S.Group;return this.scene.add(n),n.add(r),n},interpret:function(t,r){var n=t.tagName.toLowerCase();if(!(n in S.Utils.read))return null;var o=S.Utils.read[n].call(this,t);return r&&o instanceof S.Group?this.add(o.children):this.add(o),o},load:function(t,r){var n=this,o=[],a,l;if(/.*\.svg/ig.test(t))return S.Utils.xhr(t,s.bind(function(t){var n=this;for(v.temp.innerHTML=t,l=0;l<v.temp.children.length;l++)a=v.temp.children[l],o.push(n.interpret(a));r(1>=o.length?o[0]:o,1>=v.temp.children.length?v.temp.children[0]:v.temp.children)},this)),this;for(v.temp.innerHTML=t,l=0;l<v.temp.children.length;l++)a=v.temp.children[l],o.push(n.interpret(a));return r(1>=o.length?o[0]:o,1>=v.temp.children.length?v.temp.children[0]:v.temp.children),this}});var D=v.getRequestAnimationFrame();return t.exports&&(t.exports=S),S}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=t.Utils,n=t.Registry=function(){this.map={}};r.extend(n,{}),r.extend(n.prototype,{add:function(t,r){return this.map[t]=r,this},remove:function(t){return delete this.map[t],this},get:function(t){return this.map[t]},contains:function(t){return t in this.map}})}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=t.Utils,n=t.Vector=function(t,r){this.x=t||0,this.y=r||0};r.extend(n,{zero:new t.Vector}),r.extend(n.prototype,t.Utils.Events,{set:function(t,r){return this.x=t,this.y=r,this},copy:function(t){return this.x=t.x,this.y=t.y,this},clear:function(){return this.x=0,this.y=0,this},clone:function(){return new n(this.x,this.y)},add:function(t,r){return this.x=t.x+r.x,this.y=t.y+r.y,this},addSelf:function(t){return this.x+=t.x,this.y+=t.y,this},sub:function(t,r){return this.x=t.x-r.x,this.y=t.y-r.y,this},subSelf:function(t){return this.x-=t.x,this.y-=t.y,this},multiplySelf:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this},divideScalar:function(t){return t?(this.x/=t,this.y/=t):this.set(0,0),this},negate:function(){return this.multiplyScalar(-1)},dot:function(t){return this.x*t.x+this.y*t.y},lengthSquared:function(){return this.x*this.x+this.y*this.y},length:function(){return st(this.lengthSquared())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(t){return st(this.distanceToSquared(t))},distanceToSquared:function(t){var r=this.x-t.x,n=this.y-t.y;return r*r+n*n},setLength:function(t){return this.normalize().multiplyScalar(t)},equals:function(t,r){return r='undefined'==typeof r?1e-4:r,this.distanceTo(t)<r},lerp:function(r,n){var t=(r.x-this.x)*n+this.x,o=(r.y-this.y)*n+this.y;return this.set(t,o)},isZero:function(t){return t='undefined'==typeof t?1e-4:t,this.length()<t},toString:function(){return this.x+', '+this.y},toObject:function(){return{x:this.x,y:this.y}},rotate:function(t){var r=ct(t),n=pt(t);return this.x=this.x*r-this.y*n,this.y=this.x*n+this.y*r,this}});var o={set:function(r,n){return this._x=r,this._y=n,this.trigger(t.Events.change)},copy:function(r){return this._x=r.x,this._y=r.y,this.trigger(t.Events.change)},clear:function(){return this._x=0,this._y=0,this.trigger(t.Events.change)},clone:function(){return new n(this._x,this._y)},add:function(r,n){return this._x=r.x+n.x,this._y=r.y+n.y,this.trigger(t.Events.change)},addSelf:function(r){return this._x+=r.x,this._y+=r.y,this.trigger(t.Events.change)},sub:function(r,n){return this._x=r.x-n.x,this._y=r.y-n.y,this.trigger(t.Events.change)},subSelf:function(r){return this._x-=r.x,this._y-=r.y,this.trigger(t.Events.change)},multiplySelf:function(r){return this._x*=r.x,this._y*=r.y,this.trigger(t.Events.change)},multiplyScalar:function(r){return this._x*=r,this._y*=r,this.trigger(t.Events.change)},divideScalar:function(r){return r?(this._x/=r,this._y/=r,this.trigger(t.Events.change)):this.clear()},negate:function(){return this.multiplyScalar(-1)},dot:function(t){return this._x*t.x+this._y*t.y},lengthSquared:function(){return this._x*this._x+this._y*this._y},length:function(){return st(this.lengthSquared())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(t){return st(this.distanceToSquared(t))},distanceToSquared:function(t){var r=this._x-t.x,n=this._y-t.y;return r*r+n*n},setLength:function(t){return this.normalize().multiplyScalar(t)},equals:function(t,r){return r='undefined'==typeof r?1e-4:r,this.distanceTo(t)<r},lerp:function(r,n){var t=(r.x-this._x)*n+this._x,o=(r.y-this._y)*n+this._y;return this.set(t,o)},isZero:function(t){return t='undefined'==typeof t?1e-4:t,this.length()<t},toString:function(){return this._x+', '+this._y},toObject:function(){return{x:this._x,y:this._y}},rotate:function(t){var r=ct(t),n=pt(t);return this._x=this._x*r-this._y*n,this._y=this._x*n+this._y*r,this}},a={enumerable:!0,get:function(){return this._x},set:function(r){this._x=r,this.trigger(t.Events.change,'x')}},i={enumerable:!0,get:function(){return this._y},set:function(r){this._y=r,this.trigger(t.Events.change,'y')}};t.Vector.prototype.bind=t.Vector.prototype.on=function(){return this._bound||(this._x=this.x,this._y=this.y,Object.defineProperty(this,'x',a),Object.defineProperty(this,'y',i),r.extend(this,o),this._bound=!0),t.Utils.Events.bind.apply(this,arguments),this}}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=t.Commands,n=t.Utils,o=t.Anchor=function(a,i,l,s,d,p,c){return t.Vector.call(this,a,i),this._broadcast=n.bind(function(){this.trigger(t.Events.change)},this),this._command=c||r.move,this._relative=!0,c?void(o.AppendCurveProperties(this),n.isNumber(l)&&(this.controls.left.x=l),n.isNumber(s)&&(this.controls.left.y=s),n.isNumber(d)&&(this.controls.right.x=d),n.isNumber(p)&&(this.controls.right.y=p)):this};n.extend(o,{AppendCurveProperties:function(r){r.controls={left:new t.Vector(0,0),right:new t.Vector(0,0)}}});var a={listen:function(){return n.isObject(this.controls)||o.AppendCurveProperties(this),this.controls.left.bind(t.Events.change,this._broadcast),this.controls.right.bind(t.Events.change,this._broadcast),this},ignore:function(){return this.controls.left.unbind(t.Events.change,this._broadcast),this.controls.right.unbind(t.Events.change,this._broadcast),this},clone:function(){var r=this.controls,n=new t.Anchor(this.x,this.y,r&&r.left.x,r&&r.left.y,r&&r.right.x,r&&r.right.y,this.command);return n.relative=this._relative,n},toObject:function(){var t={x:this.x,y:this.y};return this._command&&(t.command=this._command),this._relative&&(t.relative=this._relative),this.controls&&(t.controls={left:this.controls.left.toObject(),right:this.controls.right.toObject()}),t},toString:function(){return this.controls?[this._x,this._y,this.controls.left.x,this.controls.left.y,this.controls.right.x,this.controls.right.y].join(', '):[this._x,this._y].join(', ')}};Object.defineProperty(o.prototype,'command',{enumerable:!0,get:function(){return this._command},set:function(a){return this._command=a,this._command!==r.curve||n.isObject(this.controls)||o.AppendCurveProperties(this),this.trigger(t.Events.change)}}),Object.defineProperty(o.prototype,'relative',{enumerable:!0,get:function(){return this._relative},set:function(r){return this._relative==r?this:(this._relative=!!r,this.trigger(t.Events.change))}}),n.extend(o.prototype,t.Vector.prototype,a),t.Anchor.prototype.bind=t.Anchor.prototype.on=function(){t.Vector.prototype.bind.apply(this,arguments),n.extend(this,a)},t.Anchor.prototype.unbind=t.Anchor.prototype.off=function(){t.Vector.prototype.unbind.apply(this,arguments),n.extend(this,a)}}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=dt,n=t.Utils,o=t.Matrix=function(r){this.elements=new t.Array(9);var o=r;n.isArray(o)||(o=n.toArray(arguments)),this.identity().set(o)};n.extend(o,{Identity:[1,0,0,0,1,0,0,0,1],Multiply:function(r,n,o){if(3>=n.length){var i=r,l=n[0]||0,a=n[1]||0,s=n[2]||0,d,p,c;return d=i[0]*l+i[1]*a+i[2]*s,p=i[3]*l+i[4]*a+i[5]*s,c=i[6]*l+i[7]*a+i[8]*s,{x:d,y:p,z:c}}var _=r[0],u=r[1],m=r[2],g=r[3],f=r[4],h=r[5],v=r[6],S=r[7],C=r[8],k=n[0],T=n[1],P=n[2],R=n[3],E=n[4],w=n[5],A=n[6],O=n[7],M=n[8];return o=o||new t.Array(9),o[0]=_*k+u*R+m*A,o[1]=_*T+u*E+m*O,o[2]=_*P+u*w+m*M,o[3]=g*k+f*R+h*A,o[4]=g*T+f*E+h*O,o[5]=g*P+f*w+h*M,o[6]=v*k+S*R+C*A,o[7]=v*T+S*E+C*O,o[8]=v*P+S*w+C*M,o}}),n.extend(o.prototype,t.Utils.Events,{set:function(r){var o=r;return n.isArray(o)||(o=n.toArray(arguments)),n.extend(this.elements,o),this.trigger(t.Events.change)},identity:function(){return this.set(o.Identity),this},multiply:function(r,o,a,i,s){var d=arguments,p=d.length;if(1>=p)return n.each(this.elements,function(t,n){this.elements[n]=t*r},this),this.trigger(t.Events.change);if(3>=p){var l,c,_;return r=r||0,o=o||0,a=a||0,s=this.elements,l=s[0]*r+s[1]*o+s[2]*a,c=s[3]*r+s[4]*o+s[5]*a,_=s[6]*r+s[7]*o+s[8]*a,{x:l,y:c,z:_}}var u=this.elements,m=d,g=u[0],f=u[1],h=u[2],v=u[3],S=u[4],C=u[5],k=u[6],T=u[7],P=u[8],R=m[0],E=m[1],w=m[2],A=m[3],O=m[4],M=m[5],L=m[6],F=m[7],N=m[8];return this.elements[0]=g*R+f*A+h*L,this.elements[1]=g*E+f*O+h*F,this.elements[2]=g*w+f*M+h*N,this.elements[3]=v*R+S*A+C*L,this.elements[4]=v*E+S*O+C*F,this.elements[5]=v*w+S*M+C*N,this.elements[6]=k*R+T*A+P*L,this.elements[7]=k*E+T*O+P*F,this.elements[8]=k*w+T*M+P*N,this.trigger(t.Events.change)},inverse:function(r){var n=this.elements;r=r||new t.Matrix;var o=n[0],a=n[1],i=n[2],l=n[3],s=n[4],d=n[5],p=n[6],c=n[7],_=n[8],u=_*s-d*c,m=-_*l+d*p,g=c*l-s*p,y=o*u+a*m+i*g;return y?(y=1/y,r.elements[0]=u*y,r.elements[1]=(-_*a+i*c)*y,r.elements[2]=(d*a-i*s)*y,r.elements[3]=m*y,r.elements[4]=(_*o-i*p)*y,r.elements[5]=(-d*o+i*l)*y,r.elements[6]=g*y,r.elements[7]=(-c*o+a*p)*y,r.elements[8]=(s*o-a*l)*y,r):null},scale:function(t,r){var n=arguments.length;return 1>=n&&(r=t),this.multiply(t,0,0,0,r,0,0,0,1)},rotate:function(t){var r=ct(t),n=pt(t);return this.multiply(r,-n,0,n,r,0,0,0,1)},translate:function(t,r){return this.multiply(1,0,t,0,1,r,0,0,1)},skewX:function(t){var n=r(t);return this.multiply(1,n,0,0,1,0,0,0,1)},skewY:function(t){var n=r(t);return this.multiply(1,0,0,n,1,0,0,0,1)},toString:function(t){var r=[];return this.toArray(t,r),r.join(' ')},toArray:function(t,r){var n=this.elements,o=!!r,l=parseFloat(n[0].toFixed(3)),a=parseFloat(n[1].toFixed(3)),s=parseFloat(n[2].toFixed(3)),p=parseFloat(n[3].toFixed(3)),d=parseFloat(n[4].toFixed(3)),c=parseFloat(n[5].toFixed(3));if(!!t){var _=parseFloat(n[6].toFixed(3)),u=parseFloat(n[7].toFixed(3)),m=parseFloat(n[8].toFixed(3));return o?(r[0]=l,r[1]=p,r[2]=_,r[3]=a,r[4]=d,r[5]=u,r[6]=s,r[7]=c,void(r[8]=m)):[l,p,_,a,d,u,s,c,m]}return o?(r[0]=l,r[1]=p,r[2]=a,r[3]=d,r[4]=s,void(r[5]=c)):[l,p,a,d,s,c]},clone:function(){var r,n,o,a,l,s,d,p,c;return r=this.elements[0],n=this.elements[1],o=this.elements[2],a=this.elements[3],l=this.elements[4],s=this.elements[5],d=this.elements[6],p=this.elements[7],c=this.elements[8],new t.Matrix(r,n,o,a,l,s,d,p,c)}})}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=t.Utils.mod,n=t.Utils.toFixed,o=t.Utils,a={version:1.1,ns:'http://www.w3.org/2000/svg',xlink:'http://www.w3.org/1999/xlink',alignments:{left:'start',center:'middle',right:'end'},createElement:function(t,r){var n=t,i=document.createElementNS(this.ns,n);return'svg'===n&&(r=o.defaults(r||{},{version:this.version})),o.isEmpty(r)||a.setAttributes(i,r),i},setAttributes:function(t,r){for(var n=Object.keys(r),o=0;o<n.length;o++)t.setAttribute(n[o],r[n[o]]);return this},removeAttributes:function(t,r){for(var n in r)t.removeAttribute(n);return this},toString:function(o,s){for(var p=o.length,l=p-1,_='',u=0,i;u<p;u++){var d=o[u],m=s?r(u-1,p):tt(u-1,0),g=s?r(u+1,p):Je(u+1,l),f=o[m],a=o[g],c=n(d._x),h=n(d._y),y,v,x,S,C,k,T,P,R;switch(d._command){case t.Commands.close:y=t.Commands.close;break;case t.Commands.curve:k=f.controls&&f.controls.right||t.Vector.zero,T=d.controls&&d.controls.left||t.Vector.zero,f._relative?(v=n(k.x+f.x),x=n(k.y+f.y)):(v=n(k.x),x=n(k.y)),d._relative?(S=n(T.x+d.x),C=n(T.y+d.y)):(S=n(T.x),C=n(T.y)),y=(0===u?t.Commands.move:t.Commands.curve)+' '+v+' '+x+' '+S+' '+C+' '+c+' '+h;break;case t.Commands.move:i=d,y=t.Commands.move+' '+c+' '+h;break;default:y=d._command+' '+c+' '+h;}u>=l&&s&&(d._command===t.Commands.curve&&(a=i,P=d.controls&&d.controls.right||d,R=a.controls&&a.controls.left||a,d._relative?(v=n(P.x+d.x),x=n(P.y+d.y)):(v=n(P.x),x=n(P.y)),a._relative?(S=n(R.x+a.x),C=n(R.y+a.y)):(S=n(R.x),C=n(R.y)),c=n(a.x),h=n(a.y),y+=' C '+v+' '+x+' '+S+' '+C+' '+c+' '+h),y+=' Z'),_+=y+' '}return _},getClip:function(t){var r=t._renderer.clip;if(!r){for(var n=t;n.parent;)n=n.parent;r=t._renderer.clip=a.createElement('clipPath'),n.defs.appendChild(r)}return r},group:{appendChild:function(t){var r=t._renderer.elem;if(r){var n=r.nodeName;!n||/(radial|linear)gradient/i.test(n)||t._clip||this.elem.appendChild(r)}},removeChild:function(t){var r=t._renderer.elem;if(r&&r.parentNode==this.elem){var n=r.nodeName;!n||t._clip||this.elem.removeChild(r)}},orderChild:function(t){this.elem.appendChild(t._renderer.elem)},renderChild:function(t){a[t._renderer.type].render.call(t,this)},render:function(t){var r=this;if(this._update(),0===this._opacity&&!this._flagOpacity)return this;this._renderer.elem||(this._renderer.elem=a.createElement('g',{id:this.id}),t.appendChild(this._renderer.elem));var n=this._matrix.manual||this._flagMatrix,o={domElement:t,elem:this._renderer.elem};n&&this._renderer.elem.setAttribute('transform','matrix('+this._matrix.toString()+')');for(var l=0,i;l<this.children.length;l++)i=r.children[l],a[i._renderer.type].render.call(i,t);return this._flagOpacity&&this._renderer.elem.setAttribute('opacity',this._opacity),this._flagAdditions&&this.additions.forEach(a.group.appendChild,o),this._flagSubtractions&&this.subtractions.forEach(a.group.removeChild,o),this._flagOrder&&this.children.forEach(a.group.orderChild,o),this._flagMask&&(this._mask?this._renderer.elem.setAttribute('clip-path','url(#'+this._mask.id+')'):this._renderer.elem.removeAttribute('clip-path')),this.flagReset()}},path:{render:function(t){if(this._update(),0===this._opacity&&!this._flagOpacity)return this;var r={},n=this._matrix.manual||this._flagMatrix;if(n&&(r.transform='matrix('+this._matrix.toString()+')'),this._flagVertices){var o=a.toString(this._vertices,this._closed);r.d=o}if(this._fill&&this._fill._renderer&&(this._fill._update(),a[this._fill._renderer.type].render.call(this._fill,t,!0)),this._flagFill&&(r.fill=this._fill&&this._fill.id?'url(#'+this._fill.id+')':this._fill),this._stroke&&this._stroke._renderer&&(this._stroke._update(),a[this._stroke._renderer.type].render.call(this._stroke,t,!0)),this._flagStroke&&(r.stroke=this._stroke&&this._stroke.id?'url(#'+this._stroke.id+')':this._stroke),this._flagLinewidth&&(r['stroke-width']=this._linewidth),this._flagOpacity&&(r['stroke-opacity']=this._opacity,r['fill-opacity']=this._opacity),this._flagVisible&&(r.visibility=this._visible?'visible':'hidden'),this._flagCap&&(r['stroke-linecap']=this._cap),this._flagJoin&&(r['stroke-linejoin']=this._join),this._flagMiter&&(r['stroke-miterlimit']=this._miter),this._renderer.elem?a.setAttributes(this._renderer.elem,r):(r.id=this.id,this._renderer.elem=a.createElement('path',r),t.appendChild(this._renderer.elem)),this._flagClip){var i=a.getClip(this),l=this._renderer.elem;this._clip?(l.removeAttribute('id'),i.setAttribute('id',this.id),i.appendChild(l)):(i.removeAttribute('id'),l.setAttribute('id',this.id),this.parent._renderer.elem.appendChild(l))}return this.flagReset()}},text:{render:function(t){this._update();var r={},n=this._matrix.manual||this._flagMatrix;if(n&&(r.transform='matrix('+this._matrix.toString()+')'),this._flagFamily&&(r['font-family']=this._family),this._flagSize&&(r['font-size']=this._size),this._flagLeading&&(r['line-height']=this._leading),this._flagAlignment&&(r['text-anchor']=a.alignments[this._alignment]||this._alignment),this._flagBaseline&&(r['alignment-baseline']=r['dominant-baseline']=this._baseline),this._flagStyle&&(r['font-style']=this._style),this._flagWeight&&(r['font-weight']=this._weight),this._flagDecoration&&(r['text-decoration']=this._decoration),this._fill&&this._fill._renderer&&(this._fill._update(),a[this._fill._renderer.type].render.call(this._fill,t,!0)),this._flagFill&&(r.fill=this._fill&&this._fill.id?'url(#'+this._fill.id+')':this._fill),this._stroke&&this._stroke._renderer&&(this._stroke._update(),a[this._stroke._renderer.type].render.call(this._stroke,t,!0)),this._flagStroke&&(r.stroke=this._stroke&&this._stroke.id?'url(#'+this._stroke.id+')':this._stroke),this._flagLinewidth&&(r['stroke-width']=this._linewidth),this._flagOpacity&&(r.opacity=this._opacity),this._flagVisible&&(r.visibility=this._visible?'visible':'hidden'),this._renderer.elem?a.setAttributes(this._renderer.elem,r):(r.id=this.id,this._renderer.elem=a.createElement('text',r),t.defs.appendChild(this._renderer.elem)),this._flagClip){var o=a.getClip(this),i=this._renderer.elem;this._clip?(i.removeAttribute('id'),o.setAttribute('id',this.id),o.appendChild(i)):(o.removeAttribute('id'),i.setAttribute('id',this.id),this.parent._renderer.elem.appendChild(i))}return this._flagValue&&(this._renderer.elem.textContent=this._value),this.flagReset()}},"linear-gradient":{render:function(t,r){var n=this;r||this._update();var o={};if(this._flagEndPoints&&(o.x1=this.left._x,o.y1=this.left._y,o.x2=this.right._x,o.y2=this.right._y),this._flagSpread&&(o.spreadMethod=this._spread),this._renderer.elem?a.setAttributes(this._renderer.elem,o):(o.id=this.id,o.gradientUnits='userSpaceOnUse',this._renderer.elem=a.createElement('linearGradient',o),t.defs.appendChild(this._renderer.elem)),this._flagStops){var l=this._renderer.elem.childNodes.length!==this.stops.length;l&&(this._renderer.elem.childNodes.length=0);for(var s=0;s<this.stops.length;s++){var i=n.stops[s],d={};i._flagOffset&&(d.offset=100*i._offset+'%'),i._flagColor&&(d['stop-color']=i._color),i._flagOpacity&&(d['stop-opacity']=i._opacity),i._renderer.elem?a.setAttributes(i._renderer.elem,d):i._renderer.elem=a.createElement('stop',d),l&&n._renderer.elem.appendChild(i._renderer.elem),i.flagReset()}}return this.flagReset()}},"radial-gradient":{render:function(t,r){var n=this;r||this._update();var o={};if(this._flagCenter&&(o.cx=this.center._x,o.cy=this.center._y),this._flagFocal&&(o.fx=this.focal._x,o.fy=this.focal._y),this._flagRadius&&(o.r=this._radius),this._flagSpread&&(o.spreadMethod=this._spread),this._renderer.elem?a.setAttributes(this._renderer.elem,o):(o.id=this.id,o.gradientUnits='userSpaceOnUse',this._renderer.elem=a.createElement('radialGradient',o),t.defs.appendChild(this._renderer.elem)),this._flagStops){var l=this._renderer.elem.childNodes.length!==this.stops.length;l&&(this._renderer.elem.childNodes.length=0);for(var s=0;s<this.stops.length;s++){var i=n.stops[s],d={};i._flagOffset&&(d.offset=100*i._offset+'%'),i._flagColor&&(d['stop-color']=i._color),i._flagOpacity&&(d['stop-opacity']=i._opacity),i._renderer.elem?a.setAttributes(i._renderer.elem,d):i._renderer.elem=a.createElement('stop',d),l&&n._renderer.elem.appendChild(i._renderer.elem),i.flagReset()}}return this.flagReset()}},texture:{render:function(r,n){n||this._update();var i={},l={},s=this.image;if(this._flagLoaded&&this.loaded)switch(s.nodeName.toLowerCase()){case'canvas':l.href=s.toDataURL('image/png');break;case'img':case'image':l.href=this.src;}if((this._flagOffset||this._flagLoaded||this._flagScale)&&(i.x=this._offset.x,i.y=this._offset.y,s&&(i.x-=s.width/2,i.y-=s.height/2,this._scale instanceof t.Vector?(i.x*=this._scale.x,i.y*=this._scale.y):(i.x*=this._scale,i.y*=this._scale))),(this._flagScale||this._flagLoaded||this._flagRepeat)&&(i.width=0,i.height=0,s)){switch(l.width=i.width=s.width,l.height=i.height=s.height,this._repeat){case'no-repeat':i.width+=1,i.height+=1;}this._scale instanceof t.Vector?(i.width*=this._scale.x,i.height*=this._scale.y):(i.width*=this._scale,i.height*=this._scale)}return(this._flagScale||this._flagLoaded)&&(this._renderer.image?!o.isEmpty(l)&&a.setAttributes(this._renderer.image,l):this._renderer.image=a.createElement('image',l)),this._renderer.elem?!o.isEmpty(i)&&a.setAttributes(this._renderer.elem,i):(i.id=this.id,i.patternUnits='userSpaceOnUse',this._renderer.elem=a.createElement('pattern',i),r.defs.appendChild(this._renderer.elem)),this._renderer.elem&&this._renderer.image&&!this._renderer.appended&&(this._renderer.elem.appendChild(this._renderer.image),this._renderer.appended=!0),this.flagReset()}}},i=t[t.Types.svg]=function(r){this.domElement=r.domElement||a.createElement('svg'),this.scene=new t.Group,this.scene.parent=this,this.defs=a.createElement('defs'),this.domElement.appendChild(this.defs),this.domElement.defs=this.defs,this.domElement.style.overflow='hidden'};o.extend(i,{Utils:a}),o.extend(i.prototype,t.Utils.Events,{setSize:function(t,r){return this.width=t,this.height=r,a.setAttributes(this.domElement,{width:t,height:r}),this},render:function(){return a.group.render.call(this.scene,this.domElement),this}})}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=t.Utils.mod,n=t.Utils.toFixed,o=t.Utils.getRatio,l=t.Utils,s=function(t){return 1==t[0]&&0==t[3]&&0==t[1]&&1==t[4]&&0==t[2]&&0==t[5]},p={isHidden:/(none|transparent)/i,alignments:{left:'start',middle:'center',right:'end'},shim:function(t){return t.tagName='canvas',t.nodeType=1,t},group:{renderChild:function(t){p[t._renderer.type].render.call(t,this.ctx,!0,this.clip)},render:function(t){var r=this;this._update();var n=this._matrix.elements,o=this.parent;this._renderer.opacity=this._opacity*(o&&o._renderer?o._renderer.opacity:1);var a=s(n),l=this._mask;this._renderer.context||(this._renderer.context={}),this._renderer.context.ctx=t,a||(t.save(),t.transform(n[0],n[3],n[1],n[4],n[2],n[5])),l&&p[l._renderer.type].render.call(l,t,!0);for(var d=0,i;d<this.children.length;d++)i=r.children[d],p[i._renderer.type].render.call(i,t);return a||t.restore(),this.flagReset()}},path:{render:function(o,_,u){var m,g,f,h,v,S,C,k,T,P,R,E,w,A,O,M,a,L,c,d,z,F,N,U,D,I,G,V,x,y,B,j;if(this._update(),m=this._matrix.elements,g=this._stroke,f=this._linewidth,h=this._fill,v=this._opacity*this.parent._renderer.opacity,S=this._visible,C=this._cap,k=this._join,T=this._miter,P=this._closed,R=this._vertices,E=R.length,w=E-1,B=s(m),y=this._clip,!_&&(!S||y))return this;B||(o.save(),o.transform(m[0],m[3],m[1],m[4],m[2],m[5])),h&&(l.isString(h)?o.fillStyle=h:(p[h._renderer.type].render.call(h,o),o.fillStyle=h._renderer.effect)),g&&(l.isString(g)?o.strokeStyle=g:(p[g._renderer.type].render.call(g,o),o.strokeStyle=g._renderer.effect)),f&&(o.lineWidth=f),T&&(o.miterLimit=T),k&&(o.lineJoin=k),C&&(o.lineCap=C),l.isNumber(v)&&(o.globalAlpha=v),o.beginPath();for(var H=0;H<R.length;H++)switch(a=R[H],V=n(a._x),x=n(a._y),a._command){case t.Commands.close:o.closePath();break;case t.Commands.curve:O=P?r(H-1,E):tt(H-1,0),A=P?r(H+1,E):Je(H+1,w),M=R[O],L=R[A],U=M.controls&&M.controls.right||t.Vector.zero,D=a.controls&&a.controls.left||t.Vector.zero,M._relative?(F=U.x+n(M._x),N=U.y+n(M._y)):(F=n(U.x),N=n(U.y)),a._relative?(d=D.x+n(a._x),z=D.y+n(a._y)):(d=n(D.x),z=n(D.y)),o.bezierCurveTo(F,N,d,z,V,x),H>=w&&P&&(L=c,I=a.controls&&a.controls.right||t.Vector.zero,G=L.controls&&L.controls.left||t.Vector.zero,a._relative?(F=I.x+n(a._x),N=I.y+n(a._y)):(F=n(I.x),N=n(I.y)),L._relative?(d=G.x+n(L._x),z=G.y+n(L._y)):(d=n(G.x),z=n(G.y)),V=n(L._x),x=n(L._y),o.bezierCurveTo(F,N,d,z,V,x));break;case t.Commands.line:o.lineTo(V,x);break;case t.Commands.move:c=a,o.moveTo(V,x);}return P&&o.closePath(),y||u||(!p.isHidden.test(h)&&(j=h._renderer&&h._renderer.offset,j&&(o.save(),o.translate(-h._renderer.offset.x,-h._renderer.offset.y),o.scale(h._renderer.scale.x,h._renderer.scale.y)),o.fill(),j&&o.restore()),!p.isHidden.test(g)&&(j=g._renderer&&g._renderer.offset,j&&(o.save(),o.translate(-g._renderer.offset.x,-g._renderer.offset.y),o.scale(g._renderer.scale.x,g._renderer.scale.y),o.lineWidth=f/g._renderer.scale.x),o.stroke(),j&&o.restore())),B||o.restore(),y&&!u&&o.clip(),this.flagReset()}},text:{render:function(t,r,o){this._update();var i=this._matrix.elements,_=this._stroke,u=this._linewidth,m=this._fill,g=this._opacity*this.parent._renderer.opacity,y=this._visible,f=s(i),h=m._renderer&&m._renderer.offset&&_._renderer&&_._renderer.offset,v=this._clip,x,a,S,c,d,C,k;return r||y&&!v?(f||(t.save(),t.transform(i[0],i[3],i[1],i[4],i[2],i[5])),h||(t.font=[this._style,this._weight,this._size+'px/'+this._leading+'px',this._family].join(' ')),t.textAlign=p.alignments[this._alignment]||this._alignment,t.textBaseline=this._baseline,m&&(l.isString(m)?t.fillStyle=m:(p[m._renderer.type].render.call(m,t),t.fillStyle=m._renderer.effect)),_&&(l.isString(_)?t.strokeStyle=_:(p[_._renderer.type].render.call(_,t),t.strokeStyle=_._renderer.effect)),u&&(t.lineWidth=u),l.isNumber(g)&&(t.globalAlpha=g),v||o||(!p.isHidden.test(m)&&(m._renderer&&m._renderer.offset?(C=n(m._renderer.scale.x),k=n(m._renderer.scale.y),t.save(),t.translate(-n(m._renderer.offset.x),-n(m._renderer.offset.y)),t.scale(C,k),x=this._size/m._renderer.scale.y,a=this._leading/m._renderer.scale.y,t.font=[this._style,this._weight,n(x)+'px/',n(a)+'px',this._family].join(' '),S=m._renderer.offset.x/m._renderer.scale.x,c=m._renderer.offset.y/m._renderer.scale.y,t.fillText(this.value,n(S),n(c)),t.restore()):t.fillText(this.value,0,0)),!p.isHidden.test(_)&&(_._renderer&&_._renderer.offset?(C=n(_._renderer.scale.x),k=n(_._renderer.scale.y),t.save(),t.translate(-n(_._renderer.offset.x),-n(_._renderer.offset.y)),t.scale(C,k),x=this._size/_._renderer.scale.y,a=this._leading/_._renderer.scale.y,t.font=[this._style,this._weight,n(x)+'px/',n(a)+'px',this._family].join(' '),S=_._renderer.offset.x/_._renderer.scale.x,c=_._renderer.offset.y/_._renderer.scale.y,d=u/_._renderer.scale.x,t.lineWidth=n(d),t.strokeText(this.value,n(S),n(c)),t.restore()):t.strokeText(this.value,0,0))),f||t.restore(),v&&!o&&t.clip(),this.flagReset()):this}},"linear-gradient":{render:function(t){var r=this;if(this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops){this._renderer.effect=t.createLinearGradient(this.left._x,this.left._y,this.right._x,this.right._y);for(var n=0,o;n<this.stops.length;n++)o=r.stops[n],r._renderer.effect.addColorStop(o._offset,o._color)}return this.flagReset()}},"radial-gradient":{render:function(t){var r=this;if(this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops){this._renderer.effect=t.createRadialGradient(this.center._x,this.center._y,0,this.focal._x,this.focal._y,this._radius);for(var n=0,o;n<this.stops.length;n++)o=r.stops[n],r._renderer.effect.addColorStop(o._offset,o._color)}return this.flagReset()}},texture:{render:function(r){this._update();var n=this.image;return(!this._renderer.effect||(this._flagLoaded||this._flagImage||this._flagRepeat)&&this.loaded)&&(this._renderer.effect=r.createPattern(this.image,this._repeat)),(this._flagOffset||this._flagLoaded||this._flagScale)&&(!(this._renderer.offset instanceof t.Vector)&&(this._renderer.offset=new t.Vector),this._renderer.offset.x=this._offset.x,this._renderer.offset.y=this._offset.y,n&&(this._renderer.offset.x-=n.width/2,this._renderer.offset.y+=n.height/2,this._scale instanceof t.Vector?(this._renderer.offset.x*=this._scale.x,this._renderer.offset.y*=this._scale.y):(this._renderer.offset.x*=this._scale,this._renderer.offset.y*=this._scale))),(this._flagScale||this._flagLoaded)&&(!(this._renderer.scale instanceof t.Vector)&&(this._renderer.scale=new t.Vector),this._scale instanceof t.Vector?this._renderer.scale.copy(this._scale):this._renderer.scale.set(this._scale,this._scale)),this.flagReset()}}},a=t[t.Types.canvas]=function(r){var n=!1!==r.smoothing;this.domElement=r.domElement||document.createElement('canvas'),this.ctx=this.domElement.getContext('2d'),this.overdraw=r.overdraw||!1,l.isUndefined(this.ctx.imageSmoothingEnabled)||(this.ctx.imageSmoothingEnabled=n),this.scene=new t.Group,this.scene.parent=this};l.extend(a,{Utils:p}),l.extend(a.prototype,t.Utils.Events,{setSize:function(t,r,n){return this.width=t,this.height=r,this.ratio=l.isUndefined(n)?o(this.ctx):n,this.domElement.width=t*this.ratio,this.domElement.height=r*this.ratio,this.domElement.style&&l.extend(this.domElement.style,{width:t+'px',height:r+'px'}),this},render:function(){var t=1===this.ratio;return t||(this.ctx.save(),this.ctx.scale(this.ratio,this.ratio)),this.overdraw||this.ctx.clearRect(0,0,this.width,this.height),p.group.render.call(this.scene,this.ctx),t||this.ctx.restore(),this}})}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=t.root,n=t.Matrix.Multiply,o=t.Utils.mod,a=[1,0,0,0,1,0,0,0,1],l=new t.Array(9),i=t.Utils.getRatio,s=t.Utils.getComputedMatrix,p=t.Utils.toFixed,u=t.Utils,_={isHidden:/(none|transparent)/i,canvas:r.document?r.document.createElement('canvas'):{getContext:u.identity},alignments:{left:'start',middle:'center',right:'end'},matrix:new t.Matrix,uv:new t.Array([0,0,1,0,0,1,0,1,1,0,1,1]),group:{removeChild:function(t,r){if(t.children){for(var n=0;n<t.children.length;n++)_.group.removeChild(t.children[n],r);return}r.deleteTexture(t._renderer.texture),delete t._renderer.texture},renderChild:function(t){_[t._renderer.type].render.call(t,this.gl,this.program)},render:function(r,o){var a=this;this._update();var s=this.parent,d=s._matrix&&s._matrix.manual||s._flagMatrix,p=this._matrix.manual||this._flagMatrix;if((d||p)&&(!this._renderer.matrix&&(this._renderer.matrix=new t.Array(9)),this._matrix.toArray(!0,l),n(l,s._renderer.matrix,this._renderer.matrix),this._renderer.scale=this._scale*s._renderer.scale,d&&(this._flagMatrix=!0)),this._mask&&(r.enable(r.STENCIL_TEST),r.stencilFunc(r.ALWAYS,1,1),r.colorMask(!1,!1,!1,!0),r.stencilOp(r.KEEP,r.KEEP,r.INCR),_[this._mask._renderer.type].render.call(this._mask,r,o,this),r.colorMask(!0,!0,!0,!0),r.stencilFunc(r.NOTEQUAL,0,1),r.stencilOp(r.KEEP,r.KEEP,r.KEEP)),this._flagOpacity=s._flagOpacity||this._flagOpacity,this._renderer.opacity=this._opacity*(s&&s._renderer?s._renderer.opacity:1),this._flagSubtractions)for(var c=0;c<this.subtractions.length;c++)_.group.removeChild(a.subtractions[c],r);return this.children.forEach(_.group.renderChild,{gl:r,program:o}),this._mask&&(r.colorMask(!1,!1,!1,!1),r.stencilOp(r.KEEP,r.KEEP,r.DECR),_[this._mask._renderer.type].render.call(this._mask,r,o,this),r.colorMask(!0,!0,!0,!0),r.stencilFunc(r.NOTEQUAL,0,1),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),r.disable(r.STENCIL_TEST)),this.flagReset()}},path:{updateCanvas:function(r){var n=r._vertices,l=this.canvas,s=this.ctx,m=r._renderer.scale,g=r._stroke,f=r._linewidth,h=r._fill,v=r._renderer.opacity||r._opacity,S=r._cap,C=r._join,k=r._miter,T=r._closed,P=n.length,R=P-1,E,w,A,a,c,O,M,L,z,F,N,U,D,x,y;l.width=tt(et(r._renderer.rect.width*m),1),l.height=tt(et(r._renderer.rect.height*m),1);var I=r._renderer.rect.centroid,G=I.x,V=I.y;s.clearRect(0,0,l.width,l.height),h&&(u.isString(h)?s.fillStyle=h:(_[h._renderer.type].render.call(h,s,r),s.fillStyle=h._renderer.effect)),g&&(u.isString(g)?s.strokeStyle=g:(_[g._renderer.type].render.call(g,s,r),s.strokeStyle=g._renderer.effect)),f&&(s.lineWidth=f),k&&(s.miterLimit=k),C&&(s.lineJoin=C),S&&(s.lineCap=S),u.isNumber(v)&&(s.globalAlpha=v);var B;s.save(),s.scale(m,m),s.translate(G,V),s.beginPath();for(var d=0;d<n.length;d++)switch(b=n[d],D=p(b._x),x=p(b._y),b._command){case t.Commands.close:s.closePath();break;case t.Commands.curve:w=T?o(d-1,P):tt(d-1,0),E=T?o(d+1,P):Je(d+1,R),A=n[w],a=n[E],z=A.controls&&A.controls.right||t.Vector.zero,F=b.controls&&b.controls.left||t.Vector.zero,A._relative?(M=p(z.x+A._x),L=p(z.y+A._y)):(M=p(z.x),L=p(z.y)),b._relative?(c=p(F.x+b._x),O=p(F.y+b._y)):(c=p(F.x),O=p(F.y)),s.bezierCurveTo(M,L,c,O,D,x),d>=R&&T&&(a=B,N=b.controls&&b.controls.right||t.Vector.zero,U=a.controls&&a.controls.left||t.Vector.zero,b._relative?(M=p(N.x+b._x),L=p(N.y+b._y)):(M=p(N.x),L=p(N.y)),a._relative?(c=p(U.x+a._x),O=p(U.y+a._y)):(c=p(U.x),O=p(U.y)),D=p(a._x),x=p(a._y),s.bezierCurveTo(M,L,c,O,D,x));break;case t.Commands.line:s.lineTo(D,x);break;case t.Commands.move:B=b,s.moveTo(D,x);}T&&s.closePath(),_.isHidden.test(h)||(y=h._renderer&&h._renderer.offset,y&&(s.save(),s.translate(-h._renderer.offset.x,-h._renderer.offset.y),s.scale(h._renderer.scale.x,h._renderer.scale.y)),s.fill(),y&&s.restore()),_.isHidden.test(g)||(y=g._renderer&&g._renderer.offset,y&&(s.save(),s.translate(-g._renderer.offset.x,-g._renderer.offset.y),s.scale(g._renderer.scale.x,g._renderer.scale.y),s.lineWidth=f/g._renderer.scale.x),s.stroke(),y&&s.restore()),s.restore()},getBoundingClientRect:function(t,r,n){var o=Infinity,i=-Infinity,l=Infinity,s=-Infinity,a,d;t.forEach(function(t){var r=t.x,n=t.y,p=t.controls,_,a,u,c,d,m;(l=Je(n,l),o=Je(r,o),i=tt(r,i),s=tt(n,s),!!t.controls)&&(d=p.left,m=p.right,d&&m)&&(_=t._relative?d.x+r:d.x,a=t._relative?d.y+n:d.y,u=t._relative?m.x+r:m.x,c=t._relative?m.y+n:m.y,_&&a&&u&&c&&(l=Je(a,c,l),o=Je(_,u,o),i=tt(_,u,i),s=tt(a,c,s)))}),u.isNumber(r)&&(l-=r,o-=r,i+=r,s+=r),a=i-o,d=s-l,n.top=l,n.left=o,n.right=i,n.bottom=s,n.width=a,n.height=d,n.centroid||(n.centroid={}),n.centroid.x=-o,n.centroid.y=-l},render:function(r,o,a){if(!this._visible||!this._opacity)return this;this._update();var i=this.parent,s=i._matrix.manual||i._flagMatrix,d=this._matrix.manual||this._flagMatrix,p=this._flagVertices||this._flagFill||this._fill instanceof t.LinearGradient&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof t.RadialGradient&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof t.Texture&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof t.LinearGradient&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof t.RadialGradient&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof t.Texture&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||i._flagOpacity||this._flagVisible||this._flagCap||this._flagJoin||this._flagMiter||this._flagScale||!this._renderer.texture;if((s||d)&&(!this._renderer.matrix&&(this._renderer.matrix=new t.Array(9)),this._matrix.toArray(!0,l),n(l,i._renderer.matrix,this._renderer.matrix),this._renderer.scale=this._scale*i._renderer.scale),p&&(!this._renderer.rect&&(this._renderer.rect={}),!this._renderer.triangles&&(this._renderer.triangles=new t.Array(12)),this._renderer.opacity=this._opacity*i._renderer.opacity,_.path.getBoundingClientRect(this._vertices,this._linewidth,this._renderer.rect),_.getTriangles(this._renderer.rect,this._renderer.triangles),_.updateBuffer.call(_,r,this,o),_.updateTexture.call(_,r,this)),!this._clip||a)return r.bindBuffer(r.ARRAY_BUFFER,this._renderer.textureCoordsBuffer),r.vertexAttribPointer(o.textureCoords,2,r.FLOAT,!1,0,0),r.bindTexture(r.TEXTURE_2D,this._renderer.texture),r.uniformMatrix3fv(o.matrix,!1,this._renderer.matrix),r.bindBuffer(r.ARRAY_BUFFER,this._renderer.buffer),r.vertexAttribPointer(o.position,2,r.FLOAT,!1,0,0),r.drawArrays(r.TRIANGLES,0,6),this.flagReset()}},text:{updateCanvas:function(t){var r=this.canvas,n=this.ctx,o=t._renderer.scale,i=t._stroke,l=t._linewidth*o,s=t._fill,m=t._renderer.opacity||t._opacity;r.width=tt(et(t._renderer.rect.width*o),1),r.height=tt(et(t._renderer.rect.height*o),1);var g=t._renderer.rect.centroid,y=g.x,f=g.y,h=s._renderer&&s._renderer.offset&&i._renderer&&i._renderer.offset,v,a,x,c,d,S,C;n.clearRect(0,0,r.width,r.height),h||(n.font=[t._style,t._weight,t._size+'px/'+t._leading+'px',t._family].join(' ')),n.textAlign='center',n.textBaseline='middle',s&&(u.isString(s)?n.fillStyle=s:(_[s._renderer.type].render.call(s,n,t),n.fillStyle=s._renderer.effect)),i&&(u.isString(i)?n.strokeStyle=i:(_[i._renderer.type].render.call(i,n,t),n.strokeStyle=i._renderer.effect)),l&&(n.lineWidth=l),u.isNumber(m)&&(n.globalAlpha=m),n.save(),n.scale(o,o),n.translate(y,f),_.isHidden.test(s)||(s._renderer&&s._renderer.offset?(S=p(s._renderer.scale.x),C=p(s._renderer.scale.y),n.save(),n.translate(-p(s._renderer.offset.x),-p(s._renderer.offset.y)),n.scale(S,C),v=t._size/s._renderer.scale.y,a=t._leading/s._renderer.scale.y,n.font=[t._style,t._weight,p(v)+'px/',p(a)+'px',t._family].join(' '),x=s._renderer.offset.x/s._renderer.scale.x,c=s._renderer.offset.y/s._renderer.scale.y,n.fillText(t.value,p(x),p(c)),n.restore()):n.fillText(t.value,0,0)),_.isHidden.test(i)||(i._renderer&&i._renderer.offset?(S=p(i._renderer.scale.x),C=p(i._renderer.scale.y),n.save(),n.translate(-p(i._renderer.offset.x),-p(i._renderer.offset.y)),n.scale(S,C),v=t._size/i._renderer.scale.y,a=t._leading/i._renderer.scale.y,n.font=[t._style,t._weight,p(v)+'px/',p(a)+'px',t._family].join(' '),x=i._renderer.offset.x/i._renderer.scale.x,c=i._renderer.offset.y/i._renderer.scale.y,d=l/i._renderer.scale.x,n.lineWidth=p(d),n.strokeText(t.value,p(x),p(c)),n.restore()):n.strokeText(t.value,0,0)),n.restore()},getBoundingClientRect:function(t,r){var n=_.ctx;n.font=[t._style,t._weight,t._size+'px/'+t._leading+'px',t._family].join(' '),n.textAlign='center',n.textBaseline=t._baseline;var o=n.measureText(t._value).width,a=tt(t._size||t._leading);this._linewidth&&!_.isHidden.test(this._stroke)&&(a+=this._linewidth);var i=o/2,l=a/2;switch(_.alignments[t._alignment]||t._alignment){case _.alignments.left:r.left=0,r.right=o;break;case _.alignments.right:r.left=-o,r.right=0;break;default:r.left=-i,r.right=i;}switch(t._baseline){case'bottom':r.top=-a,r.bottom=0;break;case'top':r.top=0,r.bottom=a;break;default:r.top=-l,r.bottom=l;}r.width=o,r.height=a,r.centroid||(r.centroid={}),r.centroid.x=i,r.centroid.y=l},render:function(r,o,a){if(!this._visible||!this._opacity)return this;this._update();var i=this.parent,s=i._matrix.manual||i._flagMatrix,d=this._matrix.manual||this._flagMatrix,p=this._flagVertices||this._flagFill||this._fill instanceof t.LinearGradient&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof t.RadialGradient&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof t.Texture&&this._fill._flagLoaded&&this._fill.loaded||this._stroke instanceof t.LinearGradient&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof t.RadialGradient&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._texture instanceof t.Texture&&this._texture._flagLoaded&&this._texture.loaded||this._flagStroke||this._flagLinewidth||this._flagOpacity||i._flagOpacity||this._flagVisible||this._flagScale||this._flagValue||this._flagFamily||this._flagSize||this._flagLeading||this._flagAlignment||this._flagBaseline||this._flagStyle||this._flagWeight||this._flagDecoration||!this._renderer.texture;if((s||d)&&(!this._renderer.matrix&&(this._renderer.matrix=new t.Array(9)),this._matrix.toArray(!0,l),n(l,i._renderer.matrix,this._renderer.matrix),this._renderer.scale=this._scale*i._renderer.scale),p&&(!this._renderer.rect&&(this._renderer.rect={}),!this._renderer.triangles&&(this._renderer.triangles=new t.Array(12)),this._renderer.opacity=this._opacity*i._renderer.opacity,_.text.getBoundingClientRect(this,this._renderer.rect),_.getTriangles(this._renderer.rect,this._renderer.triangles),_.updateBuffer.call(_,r,this,o),_.updateTexture.call(_,r,this)),!this._clip||a)return r.bindBuffer(r.ARRAY_BUFFER,this._renderer.textureCoordsBuffer),r.vertexAttribPointer(o.textureCoords,2,r.FLOAT,!1,0,0),r.bindTexture(r.TEXTURE_2D,this._renderer.texture),r.uniformMatrix3fv(o.matrix,!1,this._renderer.matrix),r.bindBuffer(r.ARRAY_BUFFER,this._renderer.buffer),r.vertexAttribPointer(o.position,2,r.FLOAT,!1,0,0),r.drawArrays(r.TRIANGLES,0,6),this.flagReset()}},"linear-gradient":{render:function(t){var r=this;if(t.canvas.getContext('2d')){if(this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops){this._renderer.effect=t.createLinearGradient(this.left._x,this.left._y,this.right._x,this.right._y);for(var n=0,o;n<this.stops.length;n++)o=r.stops[n],r._renderer.effect.addColorStop(o._offset,o._color)}return this.flagReset()}}},"radial-gradient":{render:function(t){var r=this;if(t.canvas.getContext('2d')){if(this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops){this._renderer.effect=t.createRadialGradient(this.center._x,this.center._y,0,this.focal._x,this.focal._y,this._radius);for(var n=0,o;n<this.stops.length;n++)o=r.stops[n],r._renderer.effect.addColorStop(o._offset,o._color)}return this.flagReset()}}},texture:{render:function(r){if(r.canvas.getContext('2d')){this._update();var n=this.image;return(!this._renderer.effect||(this._flagLoaded||this._flagRepeat)&&this.loaded)&&(this._renderer.effect=r.createPattern(n,this._repeat)),(this._flagOffset||this._flagLoaded||this._flagScale)&&(!(this._renderer.offset instanceof t.Vector)&&(this._renderer.offset=new t.Vector),this._renderer.offset.x=this._offset.x,this._renderer.offset.y=this._offset.y,n&&(this._renderer.offset.x-=n.width/2,this._renderer.offset.y+=n.height/2,this._scale instanceof t.Vector?(this._renderer.offset.x*=this._scale.x,this._renderer.offset.y*=this._scale.y):(this._renderer.offset.x*=this._scale,this._renderer.offset.y*=this._scale))),(this._flagScale||this._flagLoaded)&&(!(this._renderer.scale instanceof t.Vector)&&(this._renderer.scale=new t.Vector),this._scale instanceof t.Vector?this._renderer.scale.copy(this._scale):this._renderer.scale.set(this._scale,this._scale)),this.flagReset()}}},getTriangles:function(t,r){var n=t.top,o=t.left,a=t.right,i=t.bottom;r[0]=o,r[1]=n,r[2]=a,r[3]=n,r[4]=o,r[5]=i,r[6]=o,r[7]=i,r[8]=a,r[9]=n,r[10]=a,r[11]=i},updateTexture:function(t,r){this[r._renderer.type].updateCanvas.call(_,r),r._renderer.texture&&t.deleteTexture(r._renderer.texture),t.bindBuffer(t.ARRAY_BUFFER,r._renderer.textureCoordsBuffer),r._renderer.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,r._renderer.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),0>=this.canvas.width||0>=this.canvas.height||t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this.canvas)},updateBuffer:function(t,r,n){u.isObject(r._renderer.buffer)&&t.deleteBuffer(r._renderer.buffer),r._renderer.buffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,r._renderer.buffer),t.enableVertexAttribArray(n.position),t.bufferData(t.ARRAY_BUFFER,r._renderer.triangles,t.STATIC_DRAW),u.isObject(r._renderer.textureCoordsBuffer)&&t.deleteBuffer(r._renderer.textureCoordsBuffer),r._renderer.textureCoordsBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,r._renderer.textureCoordsBuffer),t.enableVertexAttribArray(n.textureCoords),t.bufferData(t.ARRAY_BUFFER,this.uv,t.STATIC_DRAW)},program:{create:function(r,n){var o,a,i;if(o=r.createProgram(),u.each(n,function(t){r.attachShader(o,t)}),r.linkProgram(o),a=r.getProgramParameter(o,r.LINK_STATUS),!a)throw i=r.getProgramInfoLog(o),r.deleteProgram(o),new t.Utils.Error('unable to link program: '+i);return o}},shaders:{create:function(r,n,o){var a,i,l;if(a=r.createShader(r[o]),r.shaderSource(a,n),r.compileShader(a),i=r.getShaderParameter(a,r.COMPILE_STATUS),!i)throw l=r.getShaderInfoLog(a),r.deleteShader(a),new t.Utils.Error('unable to compile shader '+a+': '+l);return a},types:{vertex:'VERTEX_SHADER',fragment:'FRAGMENT_SHADER'},vertex:'attribute vec2 a_position;\nattribute vec2 a_textureCoords;\n\nuniform mat3 u_matrix;\nuniform vec2 u_resolution;\n\nvarying vec2 v_textureCoords;\n\nvoid main() {\n vec2 projected = (u_matrix * vec3(a_position, 1.0)).xy;\n vec2 normal = projected / u_resolution;\n vec2 clipspace = (normal * 2.0) - 1.0;\n\n gl_Position = vec4(clipspace * vec2(1.0, -1.0), 0.0, 1.0);\n v_textureCoords = a_textureCoords;\n}',fragment:'precision mediump float;\n\nuniform sampler2D u_image;\nvarying vec2 v_textureCoords;\n\nvoid main() {\n gl_FragColor = texture2D(u_image, v_textureCoords);\n}'},TextureRegistry:new t.Registry};_.ctx=_.canvas.getContext('2d');var d=t[t.Types.webgl]=function(r){var n,o,i,l;if(this.domElement=r.domElement||document.createElement('canvas'),this.scene=new t.Group,this.scene.parent=this,this._renderer={matrix:new t.Array(a),scale:1,opacity:1},this._flagMatrix=!0,n=u.defaults(r||{},{antialias:!1,alpha:!0,premultipliedAlpha:!0,stencil:!0,preserveDrawingBuffer:!0,overdraw:!1}),this.overdraw=n.overdraw,o=this.ctx=this.domElement.getContext('webgl',n)||this.domElement.getContext('experimental-webgl',n),!this.ctx)throw new t.Utils.Error('unable to create a webgl context. Try using another renderer.');i=_.shaders.create(o,_.shaders.vertex,_.shaders.types.vertex),l=_.shaders.create(o,_.shaders.fragment,_.shaders.types.fragment),this.program=_.program.create(o,[i,l]),o.useProgram(this.program),this.program.position=o.getAttribLocation(this.program,'a_position'),this.program.matrix=o.getUniformLocation(this.program,'u_matrix'),this.program.textureCoords=o.getAttribLocation(this.program,'a_textureCoords'),o.disable(o.DEPTH_TEST),o.enable(o.BLEND),o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)};u.extend(d,{Utils:_}),u.extend(d.prototype,t.Utils.Events,{setSize:function(t,r,n){this.width=t,this.height=r,this.ratio=u.isUndefined(n)?i(this.ctx):n,this.domElement.width=t*this.ratio,this.domElement.height=r*this.ratio,u.extend(this.domElement.style,{width:t+'px',height:r+'px'}),t*=this.ratio,r*=this.ratio,this._renderer.matrix[0]=this._renderer.matrix[4]=this._renderer.scale=this.ratio,this._flagMatrix=!0,this.ctx.viewport(0,0,t,r);var o=this.ctx.getUniformLocation(this.program,'u_resolution');return this.ctx.uniform2f(o,t,r),this},render:function(){var t=this.ctx;return this.overdraw||t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),_.group.render.call(this.scene,t,this.program),this._flagMatrix=!1,this}})}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=t.Utils,n=t.Shape=function(){this._renderer={},this._renderer.flagMatrix=r.bind(n.FlagMatrix,this),this.isShape=!0,this.id=t.Identifier+t.uniqueId(),this.classList=[],this._matrix=new t.Matrix,this.translation=new t.Vector,this.rotation=0,this.scale=1};r.extend(n,{FlagMatrix:function(){this._flagMatrix=!0},MakeObservable:function(r){Object.defineProperty(r,'translation',{enumerable:!0,get:function(){return this._translation},set:function(r){this._translation&&this._translation.unbind(t.Events.change,this._renderer.flagMatrix),this._translation=r,this._translation.bind(t.Events.change,this._renderer.flagMatrix),n.FlagMatrix.call(this)}}),Object.defineProperty(r,'rotation',{enumerable:!0,get:function(){return this._rotation},set:function(t){this._rotation=t,this._flagMatrix=!0}}),Object.defineProperty(r,'scale',{enumerable:!0,get:function(){return this._scale},set:function(r){this._scale instanceof t.Vector&&this._scale.unbind(t.Events.change,this._renderer.flagMatrix),this._scale=r,this._scale instanceof t.Vector&&this._scale.bind(t.Events.change,this._renderer.flagMatrix),this._flagMatrix=!0,this._flagScale=!0}})}}),r.extend(n.prototype,t.Utils.Events,{_flagMatrix:!0,_flagScale:!1,_rotation:0,_scale:1,_translation:null,addTo:function(t){return t.add(this),this},clone:function(){var t=new n;return t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,r.each(n.Properties,function(r){t[r]=this[r]},this),t._update()},_update:function(r){return!this._matrix.manual&&this._flagMatrix&&(this._matrix.identity().translate(this.translation.x,this.translation.y),this._scale instanceof t.Vector?this._matrix.scale(this._scale.x,this._scale.y):this._matrix.scale(this._scale),this._matrix.rotate(this.rotation)),r&&this.parent&&this.parent._update&&this.parent._update(),this},flagReset:function(){return this._flagMatrix=this._flagScale=!1,this}}),n.MakeObservable(n.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two),function(r){function t(t,n,o){var a=n.controls&&n.controls.right,i=t.controls&&t.controls.left,l,s,d,p,c,_,u,m;return l=n.x,c=n.y,s=(a||n).x,_=(a||n).y,d=(i||t).x,u=(i||t).y,p=t.x,m=t.y,a&&n._relative&&(s+=n.x,_+=n.y),i&&t._relative&&(d+=t.x,u+=t.y),r.Utils.getCurveLength(l,c,s,_,d,u,p,m,o)}function n(t,n,o){var a=n.controls&&n.controls.right,i=t.controls&&t.controls.left,l,s,d,p,c,_,u,m;return l=n.x,c=n.y,s=(a||n).x,_=(a||n).y,d=(i||t).x,u=(i||t).y,p=t.x,m=t.y,a&&n._relative&&(s+=n.x,_+=n.y),i&&t._relative&&(d+=t.x,u+=t.y),r.Utils.subdivide(l,c,s,_,d,u,p,m,o)}var o=Je,a=tt,s=rt,d=r.Utils.getComputedMatrix,i={},p=r.Utils;p.each(r.Commands,function(t,r){i[r]=new RegExp(t)});var l=r.Path=function(t,n,o,a){r.Shape.call(this),this._renderer.type='path',this._renderer.flagVertices=p.bind(l.FlagVertices,this),this._renderer.bindVertices=p.bind(l.BindVertices,this),this._renderer.unbindVertices=p.bind(l.UnbindVertices,this),this._renderer.flagFill=p.bind(l.FlagFill,this),this._renderer.flagStroke=p.bind(l.FlagStroke,this),this._closed=!!n,this._curved=!!o,this.beginning=0,this.ending=1,this.fill='#fff',this.stroke='#000',this.linewidth=1,this.opacity=1,this.visible=!0,this.cap='butt',this.join='miter',this.miter=4,this._vertices=[],this.vertices=t,this.automatic=!a};p.extend(l,{Properties:['fill','stroke','linewidth','opacity','visible','cap','join','miter','closed','curved','automatic','beginning','ending'],FlagVertices:function(){this._flagVertices=!0,this._flagLength=!0},BindVertices:function(t){for(var n=this,o=t.length;o--;)t[o].bind(r.Events.change,n._renderer.flagVertices);this._renderer.flagVertices()},UnbindVertices:function(t){for(var n=this,o=t.length;o--;)t[o].unbind(r.Events.change,n._renderer.flagVertices);this._renderer.flagVertices()},FlagFill:function(){this._flagFill=!0},FlagStroke:function(){this._flagStroke=!0},MakeObservable:function(t){r.Shape.MakeObservable(t),p.each(l.Properties.slice(2,8),r.Utils.defineProperty,t),Object.defineProperty(t,'fill',{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof r.Gradient||this._fill instanceof r.LinearGradient||this._fill instanceof r.RadialGradient||this._fill instanceof r.Texture)&&this._fill.unbind(r.Events.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof r.Gradient||this._fill instanceof r.LinearGradient||this._fill instanceof r.RadialGradient||this._fill instanceof r.Texture)&&this._fill.bind(r.Events.change,this._renderer.flagFill)}}),Object.defineProperty(t,'stroke',{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof r.Gradient||this._stroke instanceof r.LinearGradient||this._stroke instanceof r.RadialGradient||this._stroke instanceof r.Texture)&&this._stroke.unbind(r.Events.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof r.Gradient||this._stroke instanceof r.LinearGradient||this._stroke instanceof r.RadialGradient||this._stroke instanceof r.Texture)&&this._stroke.bind(r.Events.change,this._renderer.flagStroke)}}),Object.defineProperty(t,'length',{get:function(){return this._flagLength&&this._updateLength(),this._length}}),Object.defineProperty(t,'closed',{enumerable:!0,get:function(){return this._closed},set:function(t){this._closed=!!t,this._flagVertices=!0}}),Object.defineProperty(t,'curved',{enumerable:!0,get:function(){return this._curved},set:function(t){this._curved=!!t,this._flagVertices=!0}}),Object.defineProperty(t,'automatic',{enumerable:!0,get:function(){return this._automatic},set:function(t){if(t!==this._automatic){this._automatic=!!t;var r=this._automatic?'ignore':'listen';p.each(this.vertices,function(t){t[r]()})}}}),Object.defineProperty(t,'beginning',{enumerable:!0,get:function(){return this._beginning},set:function(t){this._beginning=t,this._flagVertices=!0}}),Object.defineProperty(t,'ending',{enumerable:!0,get:function(){return this._ending},set:function(t){this._ending=t,this._flagVertices=!0}}),Object.defineProperty(t,'vertices',{enumerable:!0,get:function(){return this._collection},set:function(t){var n=this._renderer.flagVertices,o=this._renderer.bindVertices,a=this._renderer.unbindVertices;this._collection&&this._collection.unbind(r.Events.insert,o).unbind(r.Events.remove,a),this._collection=new r.Utils.Collection((t||[]).slice(0)),this._collection.bind(r.Events.insert,o).bind(r.Events.remove,a),o(this._collection)}}),Object.defineProperty(t,'clip',{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}})}}),p.extend(l.prototype,r.Shape.prototype,{_flagVertices:!0,_flagLength:!0,_flagFill:!0,_flagStroke:!0,_flagLinewidth:!0,_flagOpacity:!0,_flagVisible:!0,_flagCap:!0,_flagJoin:!0,_flagMiter:!0,_flagClip:!1,_length:0,_fill:'#fff',_stroke:'#000',_linewidth:1,_opacity:1,_visible:!0,_cap:'round',_join:'round',_miter:4,_closed:!0,_curved:!1,_automatic:!0,_beginning:0,_ending:1,_clip:!1,clone:function(t){t=t||this.parent;var n=p.map(this.vertices,function(t){return t.clone()}),o=new l(n,this.closed,this.curved,!this.automatic);return p.each(r.Path.Properties,function(t){o[t]=this[t]},this),o.translation.copy(this.translation),o.rotation=this.rotation,o.scale=this.scale,t&&t.add(o),o},toObject:function(){var t={vertices:p.map(this.vertices,function(t){return t.toObject()})};return p.each(r.Shape.Properties,function(r){t[r]=this[r]},this),t.translation=this.translation.toObject,t.rotation=this.rotation,t.scale=this.scale,t},noFill:function(){return this.fill='transparent',this},noStroke:function(){return this.stroke='transparent',this},corner:function(){var t=this.getBoundingClientRect(!0);return t.centroid={x:t.left+t.width/2,y:t.top+t.height/2},p.each(this.vertices,function(r){r.addSelf(t.centroid)}),this},center:function(){var t=this.getBoundingClientRect(!0);return t.centroid={x:t.left+t.width/2,y:t.top+t.height/2},p.each(this.vertices,function(r){r.subSelf(t.centroid)}),this},remove:function(){return this.parent?(this.parent.remove(this),this):this},getBoundingClientRect:function(t){var r=this,n=Infinity,s=-Infinity,p=Infinity,c=-Infinity,_,u,m,l,g,y,i;if(this._update(!0),_=t?this._matrix:d(this),u=this.linewidth/2,m=this._vertices.length,0>=m)return i=_.multiply(0,0,1),{top:i.y,left:i.x,right:i.x,bottom:i.y,width:0,height:0};for(y=0;y<m;y++)i=r._vertices[y],l=i.x,g=i.y,i=_.multiply(l,g,1),p=o(i.y-u,p),n=o(i.x-u,n),s=a(i.x+u,s),c=a(i.y+u,c);return{top:p,left:n,right:s,bottom:c,width:s-n,height:c-p}},getPointAt:function(n,t){for(var o=this,s=this.length*Je(tt(n,0),1),d=this.vertices.length,c=null,a=null,_=0,i=this._lengths.length,l=0,u,m,g,f,h,v,y,x,S,C,k,T;_<i;_++){if(l+o._lengths[_]>s){c=o.vertices[o.closed?r.Utils.mod(_,d):_],a=o.vertices[Je(tt(_-1,0),d-1)],s-=l,n=s/o._lengths[_];break}l+=o._lengths[_]}return p.isNull(c)||p.isNull(a)?null:(T=a.controls&&a.controls.right,k=c.controls&&c.controls.left,m=a.x,y=a.y,g=(T||a).x,x=(T||a).y,f=(k||c).x,S=(k||c).y,h=c.x,C=c.y,T&&a._relative&&(g+=a.x,x+=a.y),k&&c._relative&&(f+=c.x,S+=c.y),u=r.Utils.getPointOnCubicBezier(n,m,g,f,h),v=r.Utils.getPointOnCubicBezier(n,y,x,S,C),p.isObject(t)?(t.x=u,t.y=v,t):new r.Vector(u,v))},plot:function(){var t=this;if(this.curved)return r.Utils.getCurveFromPoints(this._vertices,this.closed),this;for(var n=0;n<this._vertices.length;n++)t._vertices[n]._command=0===n?r.Commands.move:r.Commands.line;return this},subdivide:function(t){this._update();var o=this.vertices.length-1,l=this.vertices[o],s=this._closed||this.vertices[o]._command===r.Commands.close,d=[];return p.each(this.vertices,function(c,a){if(0>=a&&!s)return void(l=c);if(c.command===r.Commands.move)return d.push(new r.Anchor(l.x,l.y)),0<a&&(d[d.length-1].command=r.Commands.line),void(l=c);var i=n(c,l,t);d=d.concat(i),p.each(i,function(t,n){t.command=0>=n&&l.command===r.Commands.move?r.Commands.move:r.Commands.line}),a>=o&&(this._closed&&this._automatic?(l=c,i=n(c,l,t),d=d.concat(i),p.each(i,function(t,n){t.command=0>=n&&l.command===r.Commands.move?r.Commands.move:r.Commands.line})):s&&d.push(new r.Anchor(c.x,c.y)),d[d.length-1].command=s?r.Commands.close:r.Commands.line),l=c},this),this._automatic=!1,this._curved=!1,this.vertices=d,this},_updateLength:function(n){this._update();var o=this.vertices.length-1,l=this.vertices[o],s=this._closed||this.vertices[o]._command===r.Commands.close,d=0;return p.isUndefined(this._lengths)&&(this._lengths=[]),p.each(this.vertices,function(p,a){return 0>=a&&!s||p.command===r.Commands.move?(l=p,void(this._lengths[a]=0)):void(this._lengths[a]=t(p,l,n),d+=this._lengths[a],a>=o&&s&&(l=p,this._lengths[a+1]=t(p,l,n),d+=this._lengths[a+1]),l=p)},this),this._length=d,this},_update:function(){var t=this;if(this._flagVertices){var n=this.vertices.length,o=n-1,a=s(this._beginning*o),l=s(this._ending*o),d;this._vertices.length=0;for(var p=a;p<l+1;p++)d=t.vertices[p],t._vertices.push(d);this._automatic&&this.plot()}return r.Shape.prototype._update.apply(this,arguments),this},flagReset:function(){return this._flagVertices=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagCap=this._flagJoin=this._flagMiter=this._flagClip=!1,r.Shape.prototype.flagReset.call(this),this}}),l.MakeObservable(l.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=t.Path,n=t.Utils,o=t.Line=function(n,o,a,i){var l=(a-n)/2,s=(i-o)/2;r.call(this,[new t.Anchor(-l,-s),new t.Anchor(l,s)]),this.translation.set(n+l,o+s)};n.extend(o.prototype,r.prototype),r.MakeObservable(o.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=t.Path,n=t.Utils,o=t.Rectangle=function(n,o,a,i){r.call(this,[new t.Anchor,new t.Anchor,new t.Anchor,new t.Anchor],!0),this.width=a,this.height=i,this._update(),this.translation.set(n,o)};n.extend(o,{Properties:['width','height'],MakeObservable:function(a){r.MakeObservable(a),n.each(o.Properties,t.Utils.defineProperty,a)}}),n.extend(o.prototype,r.prototype,{_width:0,_height:0,_flagWidth:0,_flagHeight:0,_update:function(){if(this._flagWidth||this._flagHeight){var t=this._width/2,n=this._height/2;this.vertices[0].set(-t,-n),this.vertices[1].set(t,-n),this.vertices[2].set(t,n),this.vertices[3].set(-t,n)}return r.prototype._update.call(this),this},flagReset:function(){return this._flagWidth=this._flagHeight=!1,r.prototype.flagReset.call(this),this}}),o.MakeObservable(o.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=t.Path,n=t.Utils,o=t.Ellipse=function(o,a,i,l){n.isNumber(l)||(l=i);var s=t.Resolution,d=n.map(n.range(s),function(){return new t.Anchor},this);r.call(this,d,!0,!0),this.width=2*i,this.height=2*l,this._update(),this.translation.set(o,a)};n.extend(o,{Properties:['width','height'],MakeObservable:function(a){r.MakeObservable(a),n.each(o.Properties,t.Utils.defineProperty,a)}}),n.extend(o.prototype,r.prototype,{_width:0,_height:0,_flagWidth:!1,_flagHeight:!1,_update:function(){var t=this;if(this._flagWidth||this._flagHeight)for(var n=0,o=this.vertices.length;n<o;n++){var a=n/o,i=a*(2*at),l=t._width*ct(i)/2,s=t._height*pt(i)/2;t.vertices[n].set(l,s)}return r.prototype._update.call(this),this},flagReset:function(){return this._flagWidth=this._flagHeight=!1,r.prototype.flagReset.call(this),this}}),o.MakeObservable(o.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var n=t.Path,o=t.Utils,r=t.Circle=function(a,i,l){var r=t.Resolution,s=o.map(o.range(r),function(){return new t.Anchor},this);n.call(this,s,!0,!0),this.radius=l,this._update(),this.translation.set(a,i)};o.extend(r,{Properties:['radius'],MakeObservable:function(a){n.MakeObservable(a),o.each(r.Properties,t.Utils.defineProperty,a)}}),o.extend(r.prototype,n.prototype,{_radius:0,_flagRadius:!1,_update:function(){var t=this;if(this._flagRadius)for(var r=0,o=this.vertices.length;r<o;r++){var a=r/o,i=a*(2*at),l=t._radius*ct(i),s=t._radius*pt(i);t.vertices[r].set(l,s)}return n.prototype._update.call(this),this},flagReset:function(){return this._flagRadius=!1,n.prototype.flagReset.call(this),this}}),r.MakeObservable(r.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var n=t.Path,o=t.Utils,r=t.Polygon=function(a,i,l,r){r=tt(r||0,3);var s=o.map(o.range(r),function(){return new t.Anchor});n.call(this,s,!0),this.width=2*l,this.height=2*l,this.sides=r,this._update(),this.translation.set(a,i)};o.extend(r,{Properties:['width','height','sides'],MakeObservable:function(a){n.MakeObservable(a),o.each(r.Properties,t.Utils.defineProperty,a)}}),o.extend(r.prototype,n.prototype,{_width:0,_height:0,_sides:0,_flagWidth:!1,_flagHeight:!1,_flagSides:!1,_update:function(){var r=this;if(this._flagWidth||this._flagHeight||this._flagSides){var o=this._sides,a=this.vertices.length;a>o&&this.vertices.splice(o-1,a-o);for(var l=0;l<o;l++){var i=(l+0.5)/o,s=2*at*i+at/2,d=r._width*ct(s),p=r._height*pt(s);l>=a?r.vertices.push(new t.Anchor(d,p)):r.vertices[l].set(d,p)}}return n.prototype._update.call(this),this},flagReset:function(){return this._flagWidth=this._flagHeight=this._flagSides=!1,n.prototype.flagReset.call(this),this}}),r.MakeObservable(r.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){function r(t,r){for(;0>t;)t+=r;return t%r}var n=t.Path,o=2*at,a=at/2,i=t.Utils,l=t.ArcSegment=function(r,o,a,l,s,d,p){var c=i.map(i.range(p||3*t.Resolution),function(){return new t.Anchor});n.call(this,c,!1,!1,!0),this.innerRadius=a,this.outerRadius=l,this.startAngle=s,this.endAngle=d,this._update(),this.translation.set(r,o)};i.extend(l,{Properties:['startAngle','endAngle','innerRadius','outerRadius'],MakeObservable:function(r){n.MakeObservable(r),i.each(l.Properties,t.Utils.defineProperty,r)}}),i.extend(l.prototype,n.prototype,{_flagStartAngle:!1,_flagEndAngle:!1,_flagInnerRadius:!1,_flagOuterRadius:!1,_startAngle:0,_endAngle:o,_innerRadius:0,_outerRadius:0,_update:function(){if(this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){var l=this._startAngle,s=this._endAngle,d=this._innerRadius,p=this._outerRadius,c=r(l,o)===r(s,o),_=0<d,u=this.vertices,m=_?u.length/2:u.length,g=0,f;c?m--:!_&&(m-=2);for(var h=0,i=m-1;h<m;h++){var S=h/i,C=u[g],v=S*(s-l)+l,k=(s-l)/m,T=p*ct(v),x=p*pt(v);if(f=0===h?t.Commands.move:t.Commands.curve,C.command=f,C.x=T,C.y=x,C.controls.left.clear(),C.controls.right.clear(),C.command===t.Commands.curve){var y=p*k/at;C.controls.left.x=y*ct(v-a),C.controls.left.y=y*pt(v-a),C.controls.right.x=y*ct(v+a),C.controls.right.y=y*pt(v+a),1===h&&C.controls.left.multiplyScalar(2),h===i&&C.controls.right.multiplyScalar(2)}g++}if(_)for(c?(u[g].command=t.Commands.close,g++):(m--,i=m-1),h=0;h<m;h++)S=h/i,C=u[g],v=(1-S)*(s-l)+l,k=(s-l)/m,T=d*ct(v),x=d*pt(v),f=t.Commands.curve,0>=h&&(f=c?t.Commands.move:t.Commands.line),C.command=f,C.x=T,C.y=x,C.controls.left.clear(),C.controls.right.clear(),C.command===t.Commands.curve&&(y=d*k/at,C.controls.left.x=y*ct(v+a),C.controls.left.y=y*pt(v+a),C.controls.right.x=y*ct(v-a),C.controls.right.y=y*pt(v-a),1===h&&C.controls.left.multiplyScalar(2),h===i&&C.controls.right.multiplyScalar(2)),g++;else c||(u[g].command=t.Commands.line,u[g].x=0,u[g].y=0,g++);u[g].command=t.Commands.close}return n.prototype._update.call(this),this},flagReset:function(){return n.prototype.flagReset.call(this),this._flagStartAngle=this._flagEndAngle=this._flagInnerRadius=this._flagOuterRadius=!1,this}}),l.MakeObservable(l.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var n=t.Path,r=t.Utils,o=t.Star=function(o,a,i,l,s){r.isNumber(l)||(l=i/2),(!r.isNumber(s)||0>=s)&&(s=5);var d=2*s,p=r.map(r.range(d),function(){return new t.Anchor});n.call(this,p,!0),this.innerRadius=l,this.outerRadius=i,this.sides=s,this._update(),this.translation.set(o,a)};r.extend(o,{Properties:['innerRadius','outerRadius','sides'],MakeObservable:function(a){n.MakeObservable(a),r.each(o.Properties,t.Utils.defineProperty,a)}}),r.extend(o.prototype,n.prototype,{_innerRadius:0,_outerRadius:0,_sides:0,_flagInnerRadius:!1,_flagOuterRadius:!1,_flagSides:!1,_update:function(){var o=this;if(this._flagInnerRadius||this._flagOuterRadius||this._flagSides){var a=2*this._sides,l=this.vertices.length;l>a&&this.vertices.splice(a-1,l-a);for(var s=0;s<a;s++){var i=(s+0.5)/a,d=2*at*i,p=s%2?o._innerRadius:o._outerRadius,r=p*ct(d),c=p*pt(d);s>=l?o.vertices.push(new t.Anchor(r,c)):o.vertices[s].set(r,c)}}return n.prototype._update.call(this),this},flagReset:function(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,n.prototype.flagReset.call(this),this}}),o.MakeObservable(o.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=t.Path,n=t.Utils,o=t.RoundedRectangle=function(o,a,i,l,s){n.isNumber(s)||(s=nt(Je(i,l)/12));var d=n.map(n.range(10),function(r){return new t.Anchor(0,0,0,0,0,0,0===r?t.Commands.move:t.Commands.curve)});d[d.length-1].command=t.Commands.close,r.call(this,d,!1,!1,!0),this.width=i,this.height=l,this.radius=s,this._update(),this.translation.set(o,a)};n.extend(o,{Properties:['width','height','radius'],MakeObservable:function(a){r.MakeObservable(a),n.each(o.Properties,t.Utils.defineProperty,a)}}),n.extend(o.prototype,r.prototype,{_width:0,_height:0,_radius:0,_flagWidth:!1,_flagHeight:!1,_flagRadius:!1,_update:function(){if(this._flagWidth||this._flagHeight||this._flagRadius){var t=this._width,n=this._height,o=Je(tt(this._radius,0),Je(t,n)),a=t/2,i=n/2,l;l=this.vertices[0],l.x=-(a-o),l.y=-i,l=this.vertices[1],l.x=a-o,l.y=-i,l.controls.left.clear(),l.controls.right.x=o,l.controls.right.y=0,l=this.vertices[2],l.x=a,l.y=-(i-o),l.controls.right.clear(),l.controls.left.clear(),l=this.vertices[3],l.x=a,l.y=i-o,l.controls.left.clear(),l.controls.right.x=0,l.controls.right.y=o,l=this.vertices[4],l.x=a-o,l.y=i,l.controls.right.clear(),l.controls.left.clear(),l=this.vertices[5],l.x=-(a-o),l.y=i,l.controls.left.clear(),l.controls.right.x=-o,l.controls.right.y=0,l=this.vertices[6],l.x=-a,l.y=i-o,l.controls.left.clear(),l.controls.right.clear(),l=this.vertices[7],l.x=-a,l.y=-(i-o),l.controls.left.clear(),l.controls.right.x=0,l.controls.right.y=-o,l=this.vertices[8],l.x=-(a-o),l.y=-i,l.controls.left.clear(),l.controls.right.clear(),l=this.vertices[9],l.copy(this.vertices[8])}return r.prototype._update.call(this),this},flagReset:function(){return this._flagWidth=this._flagHeight=this._flagRadius=!1,r.prototype.flagReset.call(this),this}}),o.MakeObservable(o.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=t.root,n=t.Utils.getComputedMatrix,o=t.Utils,a=r.document?r.document.createElement('canvas'):{getContext:o.identity},i=a.getContext('2d'),l=t.Text=function(r,n,a,i){return t.Shape.call(this),this._renderer.type='text',this._renderer.flagFill=o.bind(l.FlagFill,this),this._renderer.flagStroke=o.bind(l.FlagStroke,this),this.value=r,o.isNumber(n)&&(this.translation.x=n),o.isNumber(a)&&(this.translation.y=a),o.isObject(i)?void o.each(t.Text.Properties,function(t){t in i&&(this[t]=i[t])},this):this};o.extend(t.Text,{Properties:['value','family','size','leading','alignment','linewidth','style','weight','decoration','baseline','opacity','visible','fill','stroke'],FlagFill:function(){this._flagFill=!0},FlagStroke:function(){this._flagStroke=!0},MakeObservable:function(r){t.Shape.MakeObservable(r),o.each(t.Text.Properties.slice(0,12),t.Utils.defineProperty,r),Object.defineProperty(r,'fill',{enumerable:!0,get:function(){return this._fill},set:function(r){(this._fill instanceof t.Gradient||this._fill instanceof t.LinearGradient||this._fill instanceof t.RadialGradient||this._fill instanceof t.Texture)&&this._fill.unbind(t.Events.change,this._renderer.flagFill),this._fill=r,this._flagFill=!0,(this._fill instanceof t.Gradient||this._fill instanceof t.LinearGradient||this._fill instanceof t.RadialGradient||this._fill instanceof t.Texture)&&this._fill.bind(t.Events.change,this._renderer.flagFill)}}),Object.defineProperty(r,'stroke',{enumerable:!0,get:function(){return this._stroke},set:function(r){(this._stroke instanceof t.Gradient||this._stroke instanceof t.LinearGradient||this._stroke instanceof t.RadialGradient||this._stroke instanceof t.Texture)&&this._stroke.unbind(t.Events.change,this._renderer.flagStroke),this._stroke=r,this._flagStroke=!0,(this._stroke instanceof t.Gradient||this._stroke instanceof t.LinearGradient||this._stroke instanceof t.RadialGradient||this._stroke instanceof t.Texture)&&this._stroke.bind(t.Events.change,this._renderer.flagStroke)}}),Object.defineProperty(r,'clip',{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}})}}),o.extend(t.Text.prototype,t.Shape.prototype,{_flagValue:!0,_flagFamily:!0,_flagSize:!0,_flagLeading:!0,_flagAlignment:!0,_flagBaseline:!0,_flagStyle:!0,_flagWeight:!0,_flagDecoration:!0,_flagFill:!0,_flagStroke:!0,_flagLinewidth:!0,_flagOpacity:!0,_flagVisible:!0,_flagClip:!1,_value:'',_family:'sans-serif',_size:13,_leading:17,_alignment:'center',_baseline:'middle',_style:'normal',_weight:500,_decoration:'none',_fill:'#000',_stroke:'transparent',_linewidth:1,_opacity:1,_visible:!0,_clip:!1,remove:function(){return this.parent?(this.parent.remove(this),this):this},clone:function(r){var r=r||this.parent,n=new t.Text(this.value);return n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,o.each(t.Text.Properties,function(t){n[t]=this[t]},this),r&&r.add(n),n},toObject:function(){var r={translation:this.translation.toObject(),rotation:this.rotation,scale:this.scale};return o.each(t.Text.Properties,function(t){r[t]=this[t]},this),r},noStroke:function(){return this.stroke='transparent',this},noFill:function(){return this.fill='transparent',this},getBoundingClientRect:function(t){var r=Infinity,o=-Infinity,a=Infinity,i=-Infinity,l,s;return this._update(!0),l=t?this._matrix:n(this),s=l.multiply(0,0,1),{top:s.x,left:s.y,right:s.x,bottom:s.y,width:0,height:0}},flagReset:function(){return this._flagValue=this._flagFamily=this._flagSize=this._flagLeading=this._flagAlignment=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpaicty=this._flagVisible=this._flagClip=this._flagDecoration=this._flagBaseline=!1,t.Shape.prototype.flagReset.call(this),this}}),t.Text.MakeObservable(t.Text.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=t.Utils,n=t.Stop=function(t,o,a){this._renderer={},this._renderer.type='stop',this.offset=r.isNumber(t)?t:0>=n.Index?0:1,this.opacity=r.isNumber(a)?a:1,this.color=r.isString(o)?o:0>=n.Index?'#fff':'#000',n.Index=(n.Index+1)%2};r.extend(n,{Index:0,Properties:['offset','opacity','color'],MakeObservable:function(t){r.each(n.Properties,function(t){var r=this,n='_'+t,o='_flag'+t.charAt(0).toUpperCase()+t.slice(1);Object.defineProperty(r,t,{enumerable:!0,get:function(){return this[n]},set:function(t){this[n]=t,this[o]=!0,this.parent&&(this.parent._flagStops=!0)}})},t)}}),r.extend(n.prototype,t.Utils.Events,{clone:function(){var t=new n;return r.each(n.Properties,function(r){t[r]=this[r]},this),t},toObject:function(){var t={};return r.each(n.Properties,function(r){t[r]=this[r]},this),t},flagReset:function(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,this}}),n.MakeObservable(n.prototype);var o=t.Gradient=function(n){this._renderer={},this._renderer.type='gradient',this.id=t.Identifier+t.uniqueId(),this.classList=[],this._renderer.flagStops=r.bind(o.FlagStops,this),this._renderer.bindStops=r.bind(o.BindStops,this),this._renderer.unbindStops=r.bind(o.UnbindStops,this),this.spread='pad',this.stops=n};r.extend(o,{Stop:n,Properties:['spread'],MakeObservable:function(n){r.each(o.Properties,t.Utils.defineProperty,n),Object.defineProperty(n,'stops',{enumerable:!0,get:function(){return this._stops},set:function(r){var n=this._renderer.flagStops,o=this._renderer.bindStops,a=this._renderer.unbindStops;this._stops&&this._stops.unbind(t.Events.insert,o).unbind(t.Events.remove,a),this._stops=new t.Utils.Collection((r||[]).slice(0)),this._stops.bind(t.Events.insert,o).bind(t.Events.remove,a),o(this._stops)}})},FlagStops:function(){this._flagStops=!0},BindStops:function(r){for(var n=this,o=r.length;o--;)r[o].bind(t.Events.change,n._renderer.flagStops),r[o].parent=n;this._renderer.flagStops()},UnbindStops:function(r){for(var n=this,o=r.length;o--;)r[o].unbind(t.Events.change,n._renderer.flagStops),delete r[o].parent;this._renderer.flagStops()}}),r.extend(o.prototype,t.Utils.Events,{_flagStops:!1,_flagSpread:!1,clone:function(n){n=n||this.parent;var a=r.map(this.stops,function(t){return t.clone()}),i=new o(a);return r.each(t.Gradient.Properties,function(t){i[t]=this[t]},this),n&&n.add(i),i},toObject:function(){var t={stops:r.map(this.stops,function(t){return t.toObject()})};return r.each(o.Properties,function(r){t[r]=this[r]},this),t},_update:function(){return(this._flagSpread||this._flagStops)&&this.trigger(t.Events.change),this},flagReset:function(){return this._flagSpread=this._flagStops=!1,this}}),o.MakeObservable(o.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=t.Utils,n=t.LinearGradient=function(o,a,i,l,s){t.Gradient.call(this,s),this._renderer.type='linear-gradient';var d=r.bind(n.FlagEndPoints,this);this.left=new t.Vector().bind(t.Events.change,d),this.right=new t.Vector().bind(t.Events.change,d),r.isNumber(o)&&(this.left.x=o),r.isNumber(a)&&(this.left.y=a),r.isNumber(i)&&(this.right.x=i),r.isNumber(l)&&(this.right.y=l)};r.extend(n,{Stop:t.Gradient.Stop,MakeObservable:function(r){t.Gradient.MakeObservable(r)},FlagEndPoints:function(){this._flagEndPoints=!0}}),r.extend(n.prototype,t.Gradient.prototype,{_flagEndPoints:!1,clone:function(o){o=o||this.parent;var a=r.map(this.stops,function(t){return t.clone()}),i=new n(this.left._x,this.left._y,this.right._x,this.right._y,a);return r.each(t.Gradient.Properties,function(t){i[t]=this[t]},this),o&&o.add(i),i},toObject:function(){var r=t.Gradient.prototype.toObject.call(this);return r.left=this.left.toObject(),r.right=this.right.toObject(),r},_update:function(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(t.Events.change),this},flagReset:function(){return this._flagEndPoints=!1,t.Gradient.prototype.flagReset.call(this),this}}),n.MakeObservable(n.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var n=t.Utils,r=t.RadialGradient=function(o,a,i,r,l,s){t.Gradient.call(this,r),this._renderer.type='radial-gradient',this.center=new t.Vector().bind(t.Events.change,n.bind(function(){this._flagCenter=!0},this)),this.radius=n.isNumber(i)?i:20,this.focal=new t.Vector().bind(t.Events.change,n.bind(function(){this._flagFocal=!0},this)),n.isNumber(o)&&(this.center.x=o),n.isNumber(a)&&(this.center.y=a),this.focal.copy(this.center),n.isNumber(l)&&(this.focal.x=l),n.isNumber(s)&&(this.focal.y=s)};n.extend(r,{Stop:t.Gradient.Stop,Properties:['radius'],MakeObservable:function(o){t.Gradient.MakeObservable(o),n.each(r.Properties,t.Utils.defineProperty,o)}}),n.extend(r.prototype,t.Gradient.prototype,{_flagRadius:!1,_flagCenter:!1,_flagFocal:!1,clone:function(o){o=o||this.parent;var a=n.map(this.stops,function(t){return t.clone()}),i=new r(this.center._x,this.center._y,this._radius,a,this.focal._x,this.focal._y);return n.each(t.Gradient.Properties.concat(r.Properties),function(t){i[t]=this[t]},this),o&&o.add(i),i},toObject:function(){var o=t.Gradient.prototype.toObject.call(this);return n.each(r.Properties,function(t){o[t]=this[t]},this),o.center=this.center.toObject(),o.focal=this.focal.toObject(),o},_update:function(){return(this._flagRadius||this._flatCenter||this._flagFocal||this._flagSpread||this._flagStops)&&this.trigger(t.Events.change),this},flagReset:function(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,t.Gradient.prototype.flagReset.call(this),this}}),r.MakeObservable(r.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=t.Utils,n={video:/\.(mp4|webm)$/i,image:/\.(jpe?g|png|gif|tiff)$/i},o=t.Texture=function(n,a){if(this._renderer={},this._renderer.type='texture',this._renderer.flagOffset=r.bind(o.FlagOffset,this),this._renderer.flagScale=r.bind(o.FlagScale,this),this.id=t.Identifier+t.uniqueId(),this.classList=[],this.offset=new t.Vector,r.isFunction(a)){var i=r.bind(function(){this.unbind(t.Events.load,i),r.isFunction(a)&&a()},this);this.bind(t.Events.load,i)}r.isString(n)?this.src=n:r.isElement(n)&&(this.image=n),this._update()};r.extend(o,{Properties:['src','image','loaded','repeat'],ImageRegistry:new t.Registry,getImage:function(t){if(o.ImageRegistry.contains(t))return o.ImageRegistry.get(t);var r;return r=n.video.test(t)?document.createElement('video'):document.createElement('img'),r.crossOrigin='anonymous',r},Register:{canvas:function(t,n){t._src='#'+t.id,o.ImageRegistry.add(t.src,t.image),r.isFunction(n)&&n()},img:function(n,a){if(!(n.image&&n.image.getAttribute('two-src'))){var i=function(){n.image.removeEventListener('load',i,!1),n.image.removeEventListener('error',l,!1),r.isFunction(a)&&a()},l=function(){throw n.image.removeEventListener('load',i,!1),n.image.removeEventListener('error',l,!1),new t.Utils.Error('unable to load '+n.src)};n.image.addEventListener('load',i,!1),n.image.addEventListener('error',l,!1),n.image.setAttribute('two-src',n.src),o.ImageRegistry.add(n.src,n.image),n.image.src=n.src}},video:function(n,a){if(!(n.image&&n.image.getAttribute('two-src'))){var i=function(){n.image.removeEventListener('load',i,!1),n.image.removeEventListener('error',l,!1),n.image.width=n.image.videoWidth,n.image.height=n.image.videoHeight,n.image.play(),r.isFunction(a)&&a()},l=function(){throw n.image.removeEventListener('load',i,!1),n.image.removeEventListener('error',l,!1),new t.Utils.Error('unable to load '+n.src)};n.image.addEventListener('canplaythrough',i,!1),n.image.addEventListener('error',l,!1),n.image.setAttribute('two-src',n.src),o.ImageRegistry.add(n.src,n.image),n.image.src=n.src,n.image.loop=!0,n.image.load()}}},load:function(t,r){var n=t.src,a=t.image,i=a&&a.nodeName.toLowerCase();t._flagImage&&(/canvas/i.test(i)?o.Register.canvas(t,r):(t._src=a.getAttribute('two-src')||a.src,o.Register[i](t,r))),t._flagSrc&&(!a&&(t.image=o.getImage(t.src)),i=t.image.nodeName.toLowerCase(),o.Register[i](t,r))},FlagOffset:function(){this._flagOffset=!0},FlagScale:function(){this._flagScale=!0},MakeObservable:function(n){r.each(o.Properties,t.Utils.defineProperty,n),Object.defineProperty(n,'offset',{enumerable:!0,get:function(){return this._offset},set:function(r){this._offset&&this._offset.unbind(t.Events.change,this._renderer.flagOffset),this._offset=r,this._offset.bind(t.Events.change,this._renderer.flagOffset),this._flagOffset=!0}}),Object.defineProperty(n,'scale',{enumerable:!0,get:function(){return this._scale},set:function(r){this._scale instanceof t.Vector&&this._scale.unbind(t.Events.change,this._renderer.flagScale),this._scale=r,this._scale instanceof t.Vector&&this._scale.bind(t.Events.change,this._renderer.flagScale),this._flagScale=!0}})}}),r.extend(o.prototype,t.Utils.Events,t.Shape.prototype,{_flagSrc:!1,_flagImage:!1,_flagLoaded:!1,_flagRepeat:!1,_flagOffset:!1,_flagScale:!1,_src:'',_image:null,_loaded:!1,_repeat:'no-repeat',_scale:1,_offset:null,clone:function(){return new o(this.src)},toObject:function(){return{src:this.src,image:this.image}},_update:function(){return(this._flagSrc||this._flagImage)&&(this.trigger(t.Events.change),this.loaded=!1,o.load(this,r.bind(function(){this.loaded=!0,this.trigger(t.Events.change).trigger(t.Events.load)},this))),4<=this.image.readyState&&(this._flagImage=!0),this},flagReset:function(){return this._flagSrc=this._flagImage=this._flagLoaded=this._flagScale=this._flagOffset=!1,this}}),o.MakeObservable(o.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=t.Utils,n=t.Path,o=t.Rectangle,a=t.Sprite=function(o,a,i,l,s,d){n.call(this,[new t.Anchor,new t.Anchor,new t.Anchor,new t.Anchor],!0),this.noStroke(),this.noFill(),o instanceof t.Texture?this.texture=o:r.isString(o)&&(this.texture=new t.Texture(o)),this._update(),this.translation.set(a||0,i||0),r.isNumber(l)&&(this.columns=l),r.isNumber(s)&&(this.rows=s),r.isNumber(d)&&(this.frameRate=d)};r.extend(a,{Properties:['texture','columns','rows','frameRate'],MakeObservable:function(n){o.MakeObservable(n),r.each(a.Properties,t.Utils.defineProperty,n)}}),r.extend(a.prototype,o.prototype,{_flagTexture:!1,_flagColumns:!1,_flagRows:!1,_flagFrameRate:!1,_amount:1,_duration:0,_index:0,_startTime:0,_playing:!1,_firstFrame:0,_lastFrame:0,_loop:!0,_texture:null,_columns:1,_rows:1,_frameRate:0,play:function(t,n,o){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=r.performance.now(),r.isNumber(t)&&(this._firstFrame=t),r.isNumber(n)&&(this._lastFrame=n),r.isFunction(o)?this._onLastFrame=o:delete this._onLastFrame,this},pause:function(){return this._playing=!1,this},stop:function(){return this._playing=!1,this._index=0,this},clone:function(t){t=t||this.parent;var r=new a(this.texture,this.translation.x,this.translation.y,this.columns,this.rows,this.frameRate);return this.playing&&(r.play(this._firstFrame,this._lastFrame),r._loop=this._loop),t&&t.add(r),r},_update:function(){var t=this._texture,n=this._columns,a=this._rows,i,l,s,d,p,c,_,u;if((this._flagColumns||this._flagRows)&&(this._amount=this._columns*this._rows),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._flagTexture&&(this.fill=this._texture),this._texture.loaded){_=t.image.width,u=t.image.height,i=_/n,l=u/a,d=this._amount,this.width!==i&&(this.width=i),this.height!==l&&(this.height=l),this._playing&&0<this._frameRate&&(r.isNaN(this._lastFrame)&&(this._lastFrame=d-1),s=r.performance.now()-this._startTime,p=1e3*(this._lastFrame-this._firstFrame)/this._frameRate,this._loop?s%=p:s=Je(s,p),c=r.lerp(this._firstFrame,this._lastFrame,s/p),c=nt(c),c!==this._index&&(this._index=c,c>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));var m=(_-i)/2+i*(this._index%n+1),g=l*nt(this._index/n)-(u-l)/2;m!==t.offset.x&&(t.offset.x=m),g!==t.offset.y&&(t.offset.y=g)}return o.prototype._update.call(this),this},flagReset:function(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,o.prototype.flagReset.call(this),this}}),a.MakeObservable(a.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=t.Utils,n=t.Path,o=t.Rectangle,a=t.ImageSequence=function(o,i,l,s){n.call(this,[new t.Anchor,new t.Anchor,new t.Anchor,new t.Anchor],!0),this._renderer.flagTextures=r.bind(a.FlagTextures,this),this._renderer.bindTextures=r.bind(a.BindTextures,this),this._renderer.unbindTextures=r.bind(a.UnbindTextures,this),this.noStroke(),this.noFill(),this.textures=r.map(o,a.GenerateTexture,this),this._update(),this.translation.set(i||0,l||0),this.frameRate=r.isNumber(s)?s:a.DefaultFrameRate};r.extend(a,{Properties:['frameRate'],DefaultFrameRate:30,FlagTextures:function(){this._flagTextures=!0},BindTextures:function(r){for(var n=this,o=r.length;o--;)r[o].bind(t.Events.change,n._renderer.flagTextures);this._renderer.flagTextures()},UnbindTextures:function(r){for(var n=this,o=r.length;o--;)r[o].unbind(t.Events.change,n._renderer.flagTextures);this._renderer.flagTextures()},MakeObservable:function(n){o.MakeObservable(n),r.each(a.Properties,t.Utils.defineProperty,n),Object.defineProperty(n,'textures',{enumerable:!0,get:function(){return this._textures},set:function(r){var n=this._renderer.flagTextures,o=this._renderer.bindTextures,a=this._renderer.unbindTextures;this._textures&&this._textures.unbind(t.Events.insert,o).unbind(t.Events.remove,a),this._textures=new t.Utils.Collection((r||[]).slice(0)),this._textures.bind(t.Events.insert,o).bind(t.Events.remove,a),o(this._textures)}})},GenerateTexture:function(n){return n instanceof t.Texture?n:r.isString(n)?new t.Texture(n):void 0}}),r.extend(a.prototype,o.prototype,{_flagTextures:!1,_flagFrameRate:!1,_amount:1,_duration:0,_index:0,_startTime:0,_playing:!1,_firstFrame:0,_lastFrame:0,_loop:!0,_textures:null,_frameRate:0,play:function(t,n,o){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=r.performance.now(),r.isNumber(t)&&(this._firstFrame=t),r.isNumber(n)&&(this._lastFrame=n),r.isFunction(o)?this._onLastFrame=o:delete this._onLastFrame,this},pause:function(){return this._playing=!1,this},stop:function(){return this._playing=!1,this._index=0,this},clone:function(t){t=t||this.parent;var r=new a(this.textures,this.translation.x,this.translation.y,this.frameRate);return r._loop=this._loop,this._playing&&r.play(),t&&t.add(r),r},_update:function(){var n=this._textures,a,i,l,s,d,p,c;return this._flagTextures&&(this._amount=n.length),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._playing&&0<this._frameRate?(s=this._amount,r.isNaN(this._lastFrame)&&(this._lastFrame=s-1),l=r.performance.now()-this._startTime,d=1e3*(this._lastFrame-this._firstFrame)/this._frameRate,this._loop?l%=d:l=Je(l,d),c=r.lerp(this._firstFrame,this._lastFrame,l/d),c=nt(c),c!==this._index&&(this._index=c,p=n[this._index],p.loaded&&(a=p.image.width,i=p.image.height,this.width!==a&&(this.width=a),this.height!==i&&(this.height=i),this.fill=p,c>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):!(this.fill instanceof t.Texture)&&(p=n[this._index],p.loaded&&(a=p.image.width,i=p.image.height,this.width!==a&&(this.width=a),this.height!==i&&(this.height=i),this.fill=p)),o.prototype._update.call(this),this},flagReset:function(){return this._flagTextures=this._flagFrameRate=!1,o.prototype.flagReset.call(this),this}}),a.MakeObservable(a.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){function r(t,r){var n=t.parent,o;return n===r?(this.additions.push(t),void(this._flagAdditions=!0)):(n&&n.children.ids[t.id]&&(o=a.indexOf(n.children,t),n.children.splice(o,1),o=a.indexOf(n.additions,t),0<=o?n.additions.splice(o,1):(n.subtractions.push(t),n._flagSubtractions=!0)),r?(t.parent=r,this.additions.push(t),void(this._flagAdditions=!0)):void(o=a.indexOf(this.additions,t),0<=o?this.additions.splice(o,1):(this.subtractions.push(t),this._flagSubtractions=!0),delete t.parent))}var n=Je,o=tt,a=t.Utils,i=function(){t.Utils.Collection.apply(this,arguments),Object.defineProperty(this,'_events',{value:{},enumerable:!1}),this.ids={},this.on(t.Events.insert,this.attach),this.on(t.Events.remove,this.detach),i.prototype.attach.apply(this,arguments)};i.prototype=new t.Utils.Collection,i.prototype.constructor=i,a.extend(i.prototype,{attach:function(t){for(var r=this,n=0;n<t.length;n++)r.ids[t[n].id]=t[n];return this},detach:function(t){for(var r=this,n=0;n<t.length;n++)delete r.ids[t[n].id];return this}});var l=t.Group=function(){t.Shape.call(this,!0),this._renderer.type='group',this.additions=[],this.subtractions=[],this.children=arguments};a.extend(l,{Children:i,InsertChildren:function(t){for(var n=this,o=0;o<t.length;o++)r.call(n,t[o],n)},RemoveChildren:function(t){for(var n=this,o=0;o<t.length;o++)r.call(n,t[o])},OrderChildren:function(){this._flagOrder=!0},MakeObservable:function(r){var n=t.Path.Properties.slice(0),o=a.indexOf(n,'opacity');0<=o&&(n.splice(o,1),Object.defineProperty(r,'opacity',{enumerable:!0,get:function(){return this._opacity},set:function(t){this._flagOpacity=this._opacity!=t,this._opacity=t}})),t.Shape.MakeObservable(r),l.MakeGetterSetters(r,n),Object.defineProperty(r,'children',{enumerable:!0,get:function(){return this._children},set:function(r){var n=a.bind(l.InsertChildren,this),o=a.bind(l.RemoveChildren,this),s=a.bind(l.OrderChildren,this);this._children&&this._children.unbind(),this._children=new i(r),this._children.bind(t.Events.insert,n),this._children.bind(t.Events.remove,o),this._children.bind(t.Events.order,s)}}),Object.defineProperty(r,'mask',{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,t.clip||(t.clip=!0)}})},MakeGetterSetters:function(t,r){a.isArray(r)||(r=[r]),a.each(r,function(r){l.MakeGetterSetter(t,r)})},MakeGetterSetter:function(t,r){var n='_'+r;Object.defineProperty(t,r,{enumerable:!0,get:function(){return this[n]},set:function(t){this[n]=t,a.each(this.children,function(n){n[r]=t})}})}}),a.extend(l.prototype,t.Shape.prototype,{_flagAdditions:!1,_flagSubtractions:!1,_flagOrder:!1,_flagOpacity:!0,_flagMask:!1,_fill:'#fff',_stroke:'#000',_linewidth:1,_opacity:1,_visible:!0,_cap:'round',_join:'round',_miter:4,_closed:!0,_curved:!1,_automatic:!0,_beginning:0,_ending:1,_mask:null,clone:function(t){t=t||this.parent;var r=new l,n=a.map(this.children,function(t){return t.clone(r)});return r.add(n),r.opacity=this.opacity,this.mask&&(r.mask=this.mask),r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,t&&t.add(r),r},toObject:function(){var t={children:[],translation:this.translation.toObject(),rotation:this.rotation,scale:this.scale,opacity:this.opacity,mask:this.mask?this.mask.toObject():null};return a.each(this.children,function(r,n){t.children[n]=r.toObject()},this),t},corner:function(){var t=this.getBoundingClientRect(!0),r={x:t.left,y:t.top};return this.children.forEach(function(t){t.translation.subSelf(r)}),this},center:function(){var t=this.getBoundingClientRect(!0);return t.centroid={x:t.left+t.width/2,y:t.top+t.height/2},this.children.forEach(function(r){r.isShape&&r.translation.subSelf(t.centroid)}),this},getById:function(t){var r=function(t,n){if(t.id===n)return t;if(t.children)for(var o=t.children.length,a;o--;)if(a=r(t.children[o],n),a)return a};return r(this,t)||null},getByClassName:function(t){var r=[],n=function(t,o){return-1==t.classList.indexOf(o)?t.children&&t.children.forEach(function(t){n(t,o)}):r.push(t),r};return n(this,t)},getByType:function(r){var n=[],o=function(r,a){for(var i in r.children)r.children[i]instanceof a?n.push(r.children[i]):r.children[i]instanceof t.Group&&o(r.children[i],a);return n};return o(this,r)},add:function(t){var r=this;t=t instanceof Array?t.slice():a.toArray(arguments);for(var n=0;n<t.length;n++)t[n]&&t[n].id&&r.children.push(t[n]);return this},remove:function(t){var r=this,n=arguments.length,o=this.parent;if(0>=n&&o)return o.remove(this),this;t=t instanceof Array?t.slice():a.toArray(arguments);for(var l=0;l<t.length;l++)t[l]&&r.children.ids[t[l].id]&&r.children.splice(a.indexOf(r.children,t[l]),1);return this},getBoundingClientRect:function(t){var r;this._update(!0);var i=Infinity,l=-Infinity,s=Infinity,d=-Infinity;return this.children.forEach(function(p){/(linear-gradient|radial-gradient|gradient)/.test(p._renderer.type)||(r=p.getBoundingClientRect(t),a.isNumber(r.top)&&a.isNumber(r.left)&&a.isNumber(r.right)&&a.isNumber(r.bottom)&&(s=n(r.top,s),i=n(r.left,i),l=o(r.right,l),d=o(r.bottom,d)))},this),{top:s,left:i,right:l,bottom:d,width:l-i,height:d-s}},noFill:function(){return this.children.forEach(function(t){t.noFill()}),this},noStroke:function(){return this.children.forEach(function(t){t.noStroke()}),this},subdivide:function(){var t=arguments;return this.children.forEach(function(r){r.subdivide.apply(r,t)}),this},flagReset:function(){return this._flagAdditions&&(this.additions.length=0,this._flagAdditions=!1),this._flagSubtractions&&(this.subtractions.length=0,this._flagSubtractions=!1),this._flagOrder=this._flagMask=this._flagOpacity=!1,t.Shape.prototype.flagReset.call(this),this}}),l.MakeObservable(l.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two)});Ke();var Wi=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype.createdCallback=function(){var r=this;t.prototype.createdCallback.call(this),this._sizePollTask=null,this._parentSize={x:0,y:0,z:0},this._imperativeCounterpartPromise.then(function(){r.imperativeCounterpart._mounted||r.parentNode&&r.imperativeCounterpart.mount(r.parentNode)}),this.initWebGl()},r.prototype.initWebGl=function(){var t=this;this.mountPromise.then(function(){t.webglEnabled=!!t.getAttribute('webglenabled'),t.webglEnabled&&(t.webGlRendererState={},De().initGl(t))})},r.prototype._startSizePolling=function(){this._sizePollTask||(this._sizePollTask=wi.addRenderTask(this._checkSize.bind(this)))},r.prototype._checkSize=function(){var t=this.parentNode,r=this._parentSize,n=getComputedStyle(t),o=parseFloat(n.width),a=parseFloat(n.height);(r.x!=o||r.y!=a)&&(r.x=o,r.y=a,this.triggerEvent('parentsizechange',Object.assign({},r)))},r.prototype._makeImperativeCounterpart=function(){return new Xi({_motorHtmlCounterpart:this})},r.prototype.getStyles=function(){return Ui},r.prototype.deinit=function(){t.prototype.deinit.call(this),this.imperativeCounterpart.unmount()},r.prototype._stopSizePolling=function(){wi.removeRenderTask(this._sizePollTask),this._sizePollTask=null},r}(fn.mixin(Bi));$e(Mi,Wi),Wi=document.registerElement('motor-scene',Wi),Qe();var Yi=$i.mixin(Mi),Xi=function(t){function r(r){var n=this;void 0===r&&(r={}),t.call(this,r),this._elementParentSize={x:0,y:0,z:0},this._onElementParentSizeChange=function(t){n._elementParentSize=t,n._calcSize(),n._needsToBeRendered()},this._calcSize(),this._needsToBeRendered()}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._setDefaultProperties=function(){t.prototype._setDefaultProperties.call(this),Object.assign(this._properties,{sizeMode:new hn('proportional','proportional','absolute')})},r.prototype._startOrStopSizePolling=function(){this._mounted&&('proportional'==this._properties.sizeMode.x||'proportional'==this._properties.sizeMode.y||'proportional'==this._properties.sizeMode.z)?this._startSizePolling():this._stopSizePolling()},r.prototype._startSizePolling=function(){this._elementManager&&(this._elementManager.element._startSizePolling(),this._elementManager.element.on('parentsizechange',this._onElementParentSizeChange))},r.prototype._stopSizePolling=function(){this._elementManager&&(this._elementManager.element.off('parentsizechange',this._onElementParentSizeChange),this._elementManager.element._stopSizePolling())},r.prototype._getParentSize=function(){return this._mounted?this._elementParentSize:{x:0,y:0,z:0}},r.prototype._makeElement=function(){return new Wi},r.prototype.mount=function(t){var r=this,n=function(){if(void 0===t?t=document.body:'string'==typeof t&&(t=document.querySelector(t)),!(t instanceof window.HTMLElement))throw new Error('Invalid mount point specified in Scene.mount() call. Pass a selector, an actual HTMLElement, or don\'t pass anything to mount to <body>.');r._mounted&&r.unmount(),t!==r._elementManager.element.parentNode&&t.appendChild(r._elementManager.element),r._mounted=!0,r._mountPromise&&r._resolveMountPromise(),r._elementManager.shouldRender(),r._startOrStopSizePolling()};return'loading'==document.readyState?ci().then(n):(n(),Promise.resolve())},r.prototype.unmount=function(){this._mounted&&(this._elementManager.shouldNotRender(),this._stopSizePolling(),this._elementManager.element.parentNode&&this._elementManager.element.parentNode.removeChild(this._elementManager.element),this._mountPromise&&this._rejectMountPromise('mountcancel'),this._resetMountPromise())},r}(Yi),qi=Object.getOwnPropertyDescriptor(Mi.prototype,'sizeMode'),Zi=qi.set,Ki=qi.get;Object.defineProperties(Xi.prototype,{sizeMode:{set:function(t){Zi.call(this,t),this._startOrStopSizePolling()},get:function(){return Ki.call(this)},configurable:!0,enumerable:!0}});var $i;Qe(),Qe();var Qi=function(t){function r(r){var n=this;void 0===r&&(r={}),t.call(this,r),this._scene=null,this._scenePromise=null,this._resolveScenePromise=null,this._onParentSizeChange=function(){('proportional'===n._properties.sizeMode.x||'proportional'===n._properties.sizeMode.y||'proportional'===n._properties.sizeMode.z||0!==n._properties.align.x||0!==n._properties.align.y||0!==n._properties.align.z)&&(n._calcSize(),n._needsToBeRendered())},this._calcSize(),this._needsToBeRendered()}t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r;var n={scene:{}};return r.prototype._waitForMountThenResolveMountPromise=function(){var t=this;if(this._awaitingScenePromise)return Promise.resolve();this._awaitingScenePromise=!0;var r;return this._getScenePromise().then(function(){return t._scene.mountPromise}).then(function(){t._mounted=!0,t._resolveMountPromise(),t._elementManager.shouldRender()}).catch(function(){'mountcancel'==e||(r=e)}).then(function(){if(t._awaitingScenePromise=!1,r)throw r})},r.prototype._makeElement=function(){return new Gi},r.prototype._getScenePromise=function(){var t=this;return this._scenePromise||(this._scenePromise=new Promise(function(r){t._resolveScenePromise=r})),this._scene&&this._resolveScenePromise(),this._scenePromise},n.scene.get=function(){return this._scene||!this._parent?this._scene:(this._scene=this._parent._scene?this._parent._scene:this._parent instanceof Xi?this._parent:this._parent.scene,this._scene)},r.prototype._giveSceneRefToChildren=function(){for(var t=this,r=this._children,n=0,o=r.length,a;n<o;n+=1)a=r[n],a._scene=t._scene,a._resolveScenePromise&&a._resolveScenePromise(a._scene),a._giveSceneRefToChildren()},r.prototype._resetSceneRef=function(){this._scene=null,this._scenePromise=null,this._resolveScenePromise=null;for(var t=this._children,r=0,n=t.length;r<n;r+=1)t[r]._resetSceneRef()},Object.defineProperties(r.prototype,n),r}($i.mixin(Fi)),Ji=function(t){this.element=t};Ji.prototype.setClasses=function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];return t.length&&(n=this.element.classList).add.apply(n,t),this;var n},Ji.prototype.applyStyle=function(t,r){this.element.style[t]=r},Ji.prototype.addChild=function(t){this.element.appendChild(t.element)},Ji.prototype.removeChild=function(t){t.element.parentNode===this.element&&this.element.removeChild(t.element)},Ji.prototype.connectChildElement=function(t){(!t._elementManager.element.parentNode||t._elementManager.element.parentElement&&t._elementManager.element.parentElement!==this.element)&&this.addChild(t._elementManager)},Ji.prototype.disconnectChildElement=function(t){t._elementManager.element.parentNode&&this.removeChild(t._elementManager)},Ji.prototype.applyTransform=function(t){var r='matrix3d(\n '+t.m11+',\n '+t.m12+',\n '+t.m13+',\n '+t.m14+',\n '+t.m21+',\n '+t.m22+',\n '+t.m23+',\n '+t.m24+',\n '+t.m31+',\n '+t.m32+',\n '+t.m33+',\n '+t.m34+',\n '+t.m41+',\n '+t.m42+',\n '+t.m43+',\n '+t.m44+'\n )';this.applyStyle('transform',r)},Ji.prototype.applySize=function(t){var r=t.x,n=t.y;this.applyStyle('width',r+'px'),this.applyStyle('height',n+'px')},Ji.prototype.applyOpacity=function(t){this.applyStyle('opacity',t)},Ji.prototype.applyImperativeNodeProperties=function(t){t instanceof Qi&&(this.applyOpacity(t._properties.opacity),this.applyTransform(t._properties.transform)),this.applySize(t._calculatedSize)},Ji.prototype.shouldRender=function(){var t=this,r=wi.addRenderTask(function(){t.applyStyle('display','block'),wi.removeRenderTask(r)})},Ji.prototype.shouldNotRender=function(){var t=this,r=wi.addRenderTask(function(){t.applyStyle('display','none'),wi.removeRenderTask(r)})};var el=Object.freeze({ElementManager:Ji,Motor:wi,Node:Qi,Scene:Xi,Sizeable:Mi,Transformable:Fi,TreeNode:Pn,XYZValues:hn,Utility:Cn}),tl=function(t){function r(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];console.log(' -- PushPaneLayout created'),t.apply(this,r)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r}(Qi),rl=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype.createdCallback=function(){console.log(' -- MotorHTMLPushPaneLayout created'),t.prototype.createdCallback.call(this)},r.prototype._makeImperativeCounterpart=function(){return new tl({},this)},r}(Gi),nl=Object.freeze({get MotorHTMLBase(){return Bi},get MotorHTMLNode(){return Gi},MotorHTMLPushPaneLayout:rl,get MotorHTMLScene(){return Wi},WebComponent:Ve}),ol=function(t){function r(r,n){var o=this;t.call(this,Object.assign({},{absoluteSize:[r,r,r]},n)),this.size=r,this.sides=[],tr(6,function(t){return o._createCubeSide(t)})}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._createCubeSide=function(r){var n=new t({align:[0.5,0.5],mountPoint:[0.5,0.5]}),o=new t({align:[0.5,0.5],mountPoint:[0.5,0.5],absoluteSize:[this.size,this.size]});this.sides.push(o),n.addChild(o),4>r?n.rotation.y=90*r:n.rotation.x=90*(r%2?-1:1),o.position.z=this.size/2,this.addChild(n)},r.prototype.setContent=function(t){var r=this;return tr(6,function(n){r.sides[n].addChild(t[n])}),this},r}(Qi),al=Object.freeze({Cube:ol,PushPaneLayout:tl});return t.Calendar=_r,t.DoubleSidedPlane=cr,t.Grid=rr,t.Molecule=Qt,t.Plane=pr,t.PushMenuLayout=on,t.utils=$t,t.core=el,t.html=nl,t.components=al,t.version='17.0.4',t}({}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var infamous=function(t){'use strict';function r(t){return 2===t.length?t[0]*t[0]+t[1]*t[1]:t[0]*t[0]+t[1]*t[1]+t[2]*t[2]}function n(t){return st(r(t))}function o(t){return 0>t?-1:1}function a(t){this.method=t,this._instances=[],this.state=[]}function l(t){this.options=Object.create(l.DEFAULT_OPTIONS),t&&this.setOptions(t),this._startTime=0,this._startValue=0,this._updateTime=0,this._endValue=0,this._curve=void 0,this._duration=0,this._active=!1,this._callback=void 0,this.state=0,this.velocity=void 0}function s(r,n,o){return(1-o)*r+o*n}function d(t){return t instanceof Object?t instanceof Array?t.slice(0):Object.create(t):t}function p(t,r){var n={curve:r.curve};return r.duration&&(n.duration=r.duration),r.speed&&(n.speed=r.speed),t instanceof Object&&(void 0!==t.duration&&(n.duration=t.duration),t.curve&&(n.curve=t.curve),t.speed&&(n.speed=t.speed)),'string'==typeof n.curve&&(n.curve=l.getCurve(n.curve)),n}function c(r,n,o,a,l){var t=1e-7,s=(o(l)-o(l-t))/t,d;if(r instanceof Array){d=[];for(var p=0;p<r.length;p++)d[p]='number'==typeof r[p]?s*(r[p]-n[p])/a:0}else d=s*(r-n)/a;return d}function u(r,n,o){var t;if(r instanceof Array){t=[];for(var a=0;a<r.length;a++)t[a]='number'==typeof r[a]?s(r[a],n[a],o):r[a]}else t=s(r,n,o);return t}function m(t){this.currentAction=null,this.actionQueue=[],this.callbackQueue=[],this.state=0,this.velocity=void 0,this._callback=void 0,this._engineInstance=null,this._currentMethod=null,this.set(t)}function y(){if(this._callback){var t=this._callback;this._callback=void 0,t()}if(0>=this.actionQueue.length)return void this.set(this.get());this.currentAction=this.actionQueue.shift(),this._callback=this.callbackQueue.shift();var r=null,n=this.currentAction[0],o=this.currentAction[1];o instanceof Object&&o.method?(r=o.method,'string'==typeof r&&(r=vt[r])):r=ht,this._currentMethod!==r&&(this._engineInstance=!(n instanceof Object)||!0===r.SUPPORTS_MULTIPLE||n.length<=r.SUPPORTS_MULTIPLE?new r:new yt(r),this._currentMethod=r),this._engineInstance.reset(this.state,this.velocity),void 0!==this.velocity&&(o.velocity=this.velocity),this._engineInstance.set(n,o,y.bind(this))}function h(t){var r=this;this._final=ut.identity.slice(),this._finalTranslate=[0,0,0],this._finalRotate=[0,0,0],this._finalSkew=[0,0,0],this._finalScale=[1,1,1],this.translate=[],this.rotate=[],this.skew=[],this.scale=[];for(var n=0;3>n;n+=1)r.translate[n]=new bt(r._finalTranslate[n]),r.rotate[n]=new bt(r._finalRotate[n]),r.skew[n]=new bt(r._finalSkew[n]),r.scale[n]=new bt(r._finalScale[n]);t&&this.set(t)}function v(){return ut.build({translate:[this.translate[0].get(),this.translate[1].get(),this.translate[2].get()],rotate:[this.rotate[0].get(),this.rotate[1].get(),this.rotate[2].get()],skew:[this.skew[0].get(),this.skew[1].get(),this.skew[2].get()],scale:[this.scale[0].get(),this.scale[1].get(),this.scale[2].get()]})}function x(){return ut.build({translate:this._finalTranslate,rotate:this._finalRotate,skew:this._finalSkew,scale:this._finalScale})}function S(t,r){for(var n=0,o=0;o<t.length;o+=1)typeof t[o]==r+''&&(n+=1);return n}function C(t){this._transformGetter=null,this._opacityGetter=null,this._originGetter=null,this._alignGetter=null,this._sizeGetter=null,this._proportionGetter=null,this._legacyStates={},this._output={transform:ut.identity,opacity:1,origin:null,align:null,size:null,proportions:null,target:null},t&&(t.transform&&this.transformFrom(t.transform),void 0!==t.opacity&&this.opacityFrom(t.opacity),t.origin&&this.originFrom(t.origin),t.align&&this.alignFrom(t.align),t.size&&this.sizeFrom(t.size),t.proportions&&this.proportionsFrom(t.proportions))}function k(){this._transformGetter&&(this._output.transform=this._transformGetter()),this._opacityGetter&&(this._output.opacity=this._opacityGetter()),this._originGetter&&(this._output.origin=this._originGetter()),this._alignGetter&&(this._output.align=this._alignGetter()),this._sizeGetter&&(this._output.size=this._sizeGetter()),this._proportionGetter&&(this._output.proportions=this._proportionGetter())}function T(t,r){Tt[t]=r}function P(){this.result={}}function R(t,r){return[t[0]*r[0]+t[1]*r[4]+t[2]*r[8],t[0]*r[1]+t[1]*r[5]+t[2]*r[9],t[0]*r[2]+t[1]*r[6]+t[2]*r[10]]}function E(t){this._object=null,this._child=null,this._hasMultipleChildren=!1,this._isRenderable=!1,this._isModifier=!1,this._resultCache={},this._prevResults={},this._childResult=null,t&&this.set(t)}function w(t,r,n){for(var o=Et.parse(t,r),a=Object.keys(o),l=0;l<a.length;l++){var i=a[l],s=Pt.get(i),d=o[i];d.allocator=r.allocator;var p=s.commit(d);p?w(p,r,n):n[i]=d}}function A(){this.listeners={},this._owner=this}function O(){At.apply(this,arguments),this.downstream=[],this.downstreamFn=[],this.upstream=[],this.upstreamListeners={}}function M(t){t||(t=document.createDocumentFragment()),this.container=t,this.detachedNodes={},this.nodeCount=0}function L(){var t=this.container;return[t.clientWidth,t.clientHeight]}function z(t){this.container=t,this._allocator=new Mt(t),this._node=new wt,this._eventOutput=new Ot,this._size=L.call(this),this._perspectiveState=new bt(0),this._perspective=void 0,this._nodeContext={allocator:this._allocator,transform:ut.identity,opacity:1,origin:Lt,align:Lt,size:this._size},this._eventOutput.on('resize',function(){this.setSize(L.call(this))}.bind(this))}function F(t){this._value=t,this.eventOutput=null}function N(){this.eventOutput=new Ot,this.eventOutput.bindThis(this),Ot.setOutputHandler(this,this.eventOutput)}function U(){Xt.runLoop?(Ut.step(),window.requestAnimationFrame(U)):Ht=!1}function D(){for(var t=0;t<Dt.length;t++)Dt[t].emit('resize');Yt.emit('resize')}function I(){window.addEventListener('touchmove',function(t){t.preventDefault()},!0),G()}function G(){return document.body?void(document.body.classList.add('famous-root'),document.documentElement.classList.add('famous-root')):void Ut.nextTick(G)}function V(t,r){return document.body?void document.body.addEventListener(t,r):void Ut.nextTick(addEventListener.bind(this,t,r))}function B(t,r){return document.body?void(document.body.appendChild(r),t.emit('resize')):void Ut.nextTick(B.bind(this,t,r))}function j(t){for(var r=[],n=arguments.length-1;0<n--;)r[n]=arguments[n+1];r.forEach(function(r){for(let n in r)t[n]=r[n]})}function H(t){return t&&t.__esModule?t['default']:t}function W(t,r){return r={exports:{}},t(r,r.exports),r.exports}function Y(t){this._matrix=null,this._opacity=1,this._origin=null,this._size=null,this._eventOutput=new Ot,this._eventOutput.bindThis(this),this.eventForwarder=function(t){this._eventOutput.emit(t.type,t)}.bind(this),this.id=Pt.register(this),this._element=null,this._sizeDirty=!1,this._originDirty=!1,this._transformDirty=!1,this._invisible=!1,t&&this.attach(t)}function X(t){var r=this;for(var n in r._eventOutput.listeners)t.addEventListener(n,r.eventForwarder)}function q(t){var r=this;for(var n in r._eventOutput.listeners)t.removeEventListener(n,r.eventForwarder)}function Z(t){t[12]=rt(t[12]*or)/or,t[13]=rt(t[13]*or)/or;for(var r='matrix3d(',n=0;15>n;n++)r+=1e-6>t[n]&&-1e-6<t[n]?'0,':t[n]+',';return r+=t[15]+')',r}function K(t){return 100*t[0]+'% '+100*t[1]+'%'}function Q(t,r){return t&&r?t[0]!==r[0]||t[1]!==r[1]:t!==r}function $(t){sr.call(this),this.options={},this.properties={},this.attributes={},this.content='',this.classList=[],this.size=null,this._classesDirty=!0,this._stylesDirty=!0,this._attributesDirty=!0,this._sizeDirty=!0,this._contentDirty=!0,this._trueSizeCheck=!0,this._dirtyClasses=[],t&&this.setOptions(t),this._currentTarget=null}function J(t){for(var r=this,n=0;n<this._dirtyClasses.length;n++)t.classList.remove(r._dirtyClasses[n]);this._dirtyClasses=[]}function ee(t){var r=this;for(var o in r.properties)t.style[o]=r.properties[o]}function te(t){var r=this;for(var o in r.properties)t.style[o]=''}function re(t){var r=this;for(var o in r.attributes)t.setAttribute(o,r.attributes[o])}function ne(t){var r=this;for(var o in r.attributes)t.removeAttribute(o)}function oe(t,r){return t&&r?t[0]!==r[0]||t[1]!==r[1]:t!==r}function ae(t,r,n){return{x:t.clientX,y:t.clientY,identifier:t.identifier,origin:r.origin,timestamp:Qr(),count:r.touches.length,history:n}}function ie(t){var r=this;if(!(t.touches.length>this.touchLimit)){this.isTouched=!0;for(var n=0;n<t.changedTouches.length;n++){var o=t.changedTouches[n],a=ae(o,t,null);r.eventOutput.emit('trackstart',a),r.selective||r.touchHistory[o.identifier]||r.track(a)}}}function le(t){var r=this;if(!(t.touches.length>this.touchLimit))for(var n=0;n<t.changedTouches.length;n++){var o=t.changedTouches[n],a=r.touchHistory[o.identifier];if(a){var i=ae(o,t,a);r.touchHistory[o.identifier].push(i),r.eventOutput.emit('trackmove',i)}}}function se(t){var r=this;if(this.isTouched){for(var n=0;n<t.changedTouches.length;n++){var o=t.changedTouches[n],a=r.touchHistory[o.identifier];if(a){var i=ae(o,t,a);r.eventOutput.emit('trackend',i),delete r.touchHistory[o.identifier]}}this.isTouched=!1}}function de(){var t=this;for(var r in t.touchHistory){var n=t.touchHistory[r];t.eventOutput.emit('trackend',{touch:n[n.length-1].touch,timestamp:Date.now(),count:0,history:n}),delete t.touchHistory[r]}}function pe(t){this.selective=t.selective,this.touchLimit=t.touchLimit||1,this.touchHistory={},this.eventInput=new Ot,this.eventOutput=new Ot,Ot.setInputHandler(this,this.eventInput),Ot.setOutputHandler(this,this.eventOutput),this.eventInput.on('touchstart',ie.bind(this)),this.eventInput.on('touchmove',le.bind(this)),this.eventInput.on('touchend',se.bind(this)),this.eventInput.on('touchcancel',se.bind(this)),this.eventInput.on('unpipe',de.bind(this)),this.isTouched=!1}function ce(t){this.options=Object.create(ce.DEFAULT_OPTIONS),this._optionsManager=new Nt(this.options),t&&this.setOptions(t),this._eventOutput=new Ot,this._touchTracker=new $r({touchLimit:this.options.touchLimit}),Ot.setOutputHandler(this,this._eventOutput),Ot.setInputHandler(this,this._touchTracker),this._touchTracker.on('trackstart',_e.bind(this)),this._touchTracker.on('trackmove',ue.bind(this)),this._touchTracker.on('trackend',me.bind(this)),this._payload={delta:null,position:null,velocity:null,clientX:void 0,clientY:void 0,count:0,touch:void 0},this._position=null}function _e(t){var r,n;void 0===this.options.direction?(this._position=[0,0],r=[0,0],n=[0,0]):(this._position=0,r=0,n=0);var o=this._payload;o.delta=n,o.position=this._position,o.velocity=r,o.clientX=t.x,o.clientY=t.y,o.count=t.count,o.touch=t.identifier,this._eventOutput.emit('start',o)}function ue(t){var r=t.history,n=r[r.length-1],o=r[r.length-2],a=r[r.length-this.options.velocitySampleLength]?r[r.length-this.options.velocitySampleLength]:r[r.length-2],i=a.timestamp,l=n.timestamp,s=n.x-o.x,d=n.y-o.y,p=n.x-a.x,c=n.y-a.y;this.options.rails&&(it(s)>it(d)?d=0:s=0,it(p)>it(c)?c=0:p=0);var _=tt(l-i,Jr),u=p/_,m=c/_,g=this.options.scale,y,f;this.options.direction===ce.DIRECTION_X?(f=g*s,y=g*u,this._position+=f):this.options.direction===ce.DIRECTION_Y?(f=g*d,y=g*m,this._position+=f):(f=[g*s,g*d],y=[g*u,g*m],this._position[0]+=f[0],this._position[1]+=f[1]);var h=this._payload;h.delta=f,h.velocity=y,h.position=this._position,h.clientX=t.x,h.clientY=t.y,h.count=t.count,h.touch=t.identifier,this._eventOutput.emit('update',h)}function me(t){this._payload.count=t.count,this._eventOutput.emit('end',this._payload)}function ge(t,r){this._eventInput=new Ot,this._eventOutput=new Ot,Ot.setInputHandler(this,this._eventInput),Ot.setOutputHandler(this,this._eventOutput),this._syncs={},t&&this.addSync(t),r&&this.setOptions(r)}function ye(t,r){en[t]&&(this._syncs[t]=new en[t](r),this.pipeSync(t))}function fe(t,r,n){an[0]=t.m11*r.m11+t.m21*r.m12+t.m31*r.m13+t.m41*r.m14,an[4]=t.m11*r.m21+t.m21*r.m22+t.m31*r.m23+t.m41*r.m24,an[8]=t.m11*r.m31+t.m21*r.m32+t.m31*r.m33+t.m41*r.m34,an[12]=t.m11*r.m41+t.m21*r.m42+t.m31*r.m43+t.m41*r.m44,an[1]=t.m12*r.m11+t.m22*r.m12+t.m32*r.m13+t.m42*r.m14,an[5]=t.m12*r.m21+t.m22*r.m22+t.m32*r.m23+t.m42*r.m24,an[9]=t.m12*r.m31+t.m22*r.m32+t.m32*r.m33+t.m42*r.m34,an[13]=t.m12*r.m41+t.m22*r.m42+t.m32*r.m43+t.m42*r.m44,an[2]=t.m13*r.m11+t.m23*r.m12+t.m33*r.m13+t.m43*r.m14,an[6]=t.m13*r.m21+t.m23*r.m22+t.m33*r.m23+t.m43*r.m24,an[10]=t.m13*r.m31+t.m23*r.m32+t.m33*r.m33+t.m43*r.m34,an[14]=t.m13*r.m41+t.m23*r.m42+t.m33*r.m43+t.m43*r.m44,an[3]=t.m14*r.m11+t.m24*r.m12+t.m34*r.m13+t.m44*r.m14,an[7]=t.m14*r.m21+t.m24*r.m22+t.m34*r.m23+t.m44*r.m24,an[11]=t.m14*r.m31+t.m24*r.m32+t.m34*r.m33+t.m44*r.m34,an[15]=t.m14*r.m41+t.m24*r.m42+t.m34*r.m43+t.m44*r.m44,he(an,n)}function he(t,r){const n=t.length;6===n?(r.m11=t[0],r.m12=t[1],r.m21=t[2],r.m22=t[3],r.m41=t[4],r.m42=t[5]):16===n&&(r.m11=t[0],r.m12=t[1],r.m13=t[2],r.m14=t[3],r.m21=t[4],r.m22=t[5],r.m23=t[6],r.m24=t[7],r.m31=t[8],r.m32=t[9],r.m33=t[10],r.m34=t[11],r.m41=t[12],r.m42=t[13],r.m43=t[14],r.m44=t[15])}function ve(t,r,n,o){var a=pt,i=ct,l=ot;const s=be(o/2);return[1-2*(r*r+n*n)*l(a(s),2),2*(t*r*l(a(s),2)+n*a(s)*i(s)),2*(t*n*l(a(s),2)-r*a(s)*i(s)),0,2*(t*r*l(a(s),2)-n*a(s)*i(s)),1-2*(t*t+n*n)*l(a(s),2),2*(r*n*l(a(s),2)+t*a(s)*i(s)),0,2*(t*n*l(a(s),2)+r*a(s)*i(s)),2*(r*n*l(a(s),2)-t*a(s)*i(s)),1-2*(t*t+r*r)*l(a(s),2),0,0,0,0,1]}function be(t){return at/180*t}function xe(){sn||(sn=function(){function t(t){if(void 0===t&&(t=[]),!(this instanceof dn))throw new TypeError('DOMMatrixReadOnly can\'t be instantiated directly. Use DOMMatrix instead.');var r=t.length;if(void 0===r||6!==r&&16!==r)throw new TypeError('DOMMatrix constructor argument "numberSequence" must be an array-like with 6 or 16 numbers.');this._matrix=new Float64Array(ln),this._isIdentity=!0,this._is2D=6===r,he(t,this)}var r={is2D:{},isIdentity:{},a:{},b:{},c:{},d:{},e:{},f:{},m11:{},m12:{},m13:{},m14:{},m21:{},m22:{},m23:{},m24:{},m31:{},m32:{},m33:{},m34:{},m41:{},m42:{},m43:{},m44:{}};return t.prototype.translate=function(t,r,n){return void 0===n&&(n=0),new dn(this).translateSelf(t,r,n)},t.prototype.scale=function(t,r,n){return void 0===r&&(r=0),void 0===n&&(n=0),new dn(this).scaleSelf(t,r,n)},t.prototype.scale3d=function(t,r,n,o){return void 0===r&&(r=0),void 0===n&&(n=0),void 0===o&&(o=0),new dn(this).scale3dSelf(t,r,n,o)},t.prototype.scaleNonUniform=function(t,r,n,o,a,i){return void 0===r&&(r=1),void 0===n&&(n=1),void 0===o&&(o=0),void 0===a&&(a=0),void 0===i&&(i=0),new dn(this).scaleNonUniformSelf(t,r,n,o,a,i)},t.prototype.rotate=function(t,r,n){return void 0===r&&(r=0),void 0===n&&(n=0),new dn(this).rotateSelf(t,r,n)},t.prototype.rotateFromVector=function(){throw new Error('rotateFromVector is not implemented yet.')},t.prototype.rotateAxisAngle=function(t,r,n,o){return new dn(this).rotateAxisAngleSelf(t,r,n,o)},t.prototype.skewX=function(){throw new Error('skewX is not implemented yet.')},t.prototype.skewY=function(){throw new Error('skewY is not implemented yet.')},t.prototype.multiply=function(t){return new dn(this).multiplySelf(t)},t.prototype.flipX=function(){throw new Error('flipX is not implemented yet.')},t.prototype.flipY=function(){throw new Error('flipY is not implemented yet.')},t.prototype.inverse=function(){throw new Error('inverse is not implemented yet.')},t.prototype.transformPoint=function(){throw new Error('transformPoint is not implemented yet.')},t.prototype.toFloat32Array=function(){return Float32Array.from(this._matrix)},t.prototype.toFloat64Array=function(){return Float64Array.from(this._matrix)},r.is2D.get=function(){return this._is2D},r.isIdentity.get=function(){for(var t=this,r=0,n=this._matrix.length;r<n;r+=1)if(t._matrix[r]!=ln[r])return t._isIdentity=!1;return this._isIdentity=!0},r.a.get=function(){return this.m11},r.b.get=function(){return this.m12},r.c.get=function(){return this.m21},r.d.get=function(){return this.m22},r.e.get=function(){return this.m41},r.f.get=function(){return this.m42},r.m11.get=function(){return this._matrix[0]},r.m12.get=function(){return this._matrix[4]},r.m13.get=function(){return this._matrix[8]},r.m14.get=function(){return this._matrix[12]},r.m21.get=function(){return this._matrix[1]},r.m22.get=function(){return this._matrix[5]},r.m23.get=function(){return this._matrix[9]},r.m24.get=function(){return this._matrix[13]},r.m31.get=function(){return this._matrix[2]},r.m32.get=function(){return this._matrix[6]},r.m33.get=function(){return this._matrix[10]},r.m34.get=function(){return this._matrix[14]},r.m41.get=function(){return this._matrix[3]},r.m42.get=function(){return this._matrix[7]},r.m43.get=function(){return this._matrix[11]},r.m44.get=function(){return this._matrix[15]},Object.defineProperties(t.prototype,r),t}())}function Se(t){return'object'==typeof t&&'x'in t&&'y'in t&&'z'in t&&'w'in t}function Ce(t){const r=Object.getOwnPropertyNames(t);for(let n=r.length,o=0;o<n;o+=1){const n=r[o],a=n.toLowerCase();if(a!=n){const r=Object.getOwnPropertyDescriptor(t,n);'undefined'!=typeof r.set&&Object.defineProperty(t,a,r)}}}function ke(t,r,n){return vn||(vn=new Map),bn||(bn=Te()),vn.set(t,{onConnect:r,onDisconnect:n}),bn.observe(t,{childList:!0}),!0}function Te(){return new MutationObserver(function(t){const r=new Map;for(let a=0,i=t.length;a<i;a+=1){const i=t[a];if('childList'!=i.type)continue;r.has(i.target)||r.set(i.target,new Map);const s=r.get(i.target);var n=i.addedNodes;for(let t=n.length,r=0;r<t;r+=1)s.set(n[r],(s.get(n[r])||0)+1);var o=i.removedNodes;for(let t=o.length,r=0;r<t;r+=1)s.set(o[r],(s.get(o[r])||0)-1)}for(var a=0,i=r;a<i.length;a+=1){const t=i[a];for(var l=t[0],s=t[1],d=vn.get(l),p=d.onConnect,c=d.onDisconnect,_=0,u=s;_<u.length;_+=1){const t=u[_];var m=t[0],g=t[1];0<g&&'function'==typeof p?p.call(l,m):0>g&&'function'==typeof c&&c.call(l,m)}}})}function Pe(t){let r=t;for(;r&&!(r instanceof ShadowRoot);)r=r.parentNode;return r}function Re(t,r){console.log(r?'distributedNode:':'node:',t);var n=t.children;for(let o=n.length,a=0;a<o;a+=1)n[a]._elementManager.element._isPossiblyDistributed||Re(n[a]);const o=t._elementManager.element._shadowChildren;if(o)for(let t=o.length,r=0;r<t;r+=1)Re(o[r].imperativeCounterpart,!0)}function Ee(t,r){const n=Ae('100%','100%'),o=ze(n,r);return o&&(_i.has(t)&&we(t),t.appendChild(n),_i.set(t,o)),o}function we(t){const r=_i.get(t);t.removeChild(r.canvas)}function Ae(t,r){const n=document.createElement('canvas');return Oe(n,t,r),n}function Oe(t,r,n){t.style.width=r,t.style.height=n}function Me(t,r,n){Le(t.canvas,r,n),t.viewport(0,0,r,n)}function Le(t,r,n){t.width=r,t.height=n}function ze(t,r){let n;if(t instanceof HTMLCanvasElement&&(n=t),n||(n=document.querySelector(t)),!(n instanceof HTMLCanvasElement))return!1;if(1==r||void 0==r)r='';else if(2==r)r='2';else throw new Error('Invalid WebGL version.');return n.getContext('webgl'+r)}function Fe(t,r,n){const o=t.createShader(r);t.shaderSource(o,n),t.compileShader(o);const a=t.getShaderParameter(o,t.COMPILE_STATUS);if(a)return o;const i=new Error('*** Error compiling shader \''+o+'\':'+t.getShaderInfoLog(o));throw t.deleteShader(o),i}function Ne(t,r,n){const o=t.createProgram();t.attachShader(o,r),t.attachShader(o,n),t.linkProgram(o);const a=t.getProgramParameter(o,t.LINK_STATUS);return a?o:void(console.log(' --- Error making program. GL Program Info Log:',t.getProgramInfoLog(o)),t.deleteProgram(o))}function Ue(t){return t*at/180}function De(){return Ti?Ti:Ti=new ki}function Ie(t){return'number'!=typeof t||Object.is(t,NaN)||Object.is(t,Infinity)?!1:!0}function Ge(t){return!!t&&(t===HTMLElement||Ge(t.prototype.__proto__?t.prototype.__proto__.constructor:null))}function Ve(t){if(t||(t=HTMLElement),!Ge(t))throw new TypeError('The argument to WebComponentMixin must be a constructor that extends from or is HTMLElement.');if(Di.has(t))return Di.get(t);var r=function(t){function r(){if(t.call(this),'registerElement'in document&&!('customElements'in window))throw new Error('\n You cannot instantiate this class directly without first registering it\n with `document.registerElement(...)`. See an example at http://....\n ');if(!('registerElement'in document)&&!('customElements'in window))throw new Error('\n Your browser does not support the Custom Elements API. You\'ll\n need to install a polyfill. See how at http://....\n ');this.createdCallback()}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype.createdCallback=function(){this._attached=!1,this._initialized=!1,this._initialAttributeChange=!1,this._childObserver=null,this._style=null},r.prototype.childConnectedCallback=function(){},r.prototype.childDisconnectedCallback=function(){},r.prototype.connectedCallback=function(){t.prototype.connectedCallback&&t.prototype.connectedCallback.call(this),this._attached=!0,this._initialized||(this.init(),this._initialized=!0)},r.prototype.attachedCallback=function(){this.connectedCallback()},r.prototype._createStyles=function(){const t=Kr.createRule(this.getStyles());return t.applyTo(this),t},r.prototype.disconnectedCallback=function(){var r=this;t.prototype.disconnectedCallback&&t.prototype.disconnectedCallback.call(this),this._attached=!1,Promise.resolve().then(function(){!r._attached&&r._initialized&&r.deinit()})},r.prototype.detachedCallback=function(){this.disconnectedCallback()},r.prototype.getStyles=function(){return{}},r.prototype.init=function(){var t=this;if(this._style||(this._style=this._createStyles()),!this._childObserver){const r=this.childNodes;r.length&&setTimeout(function(){for(let n=r.length,o=0;o<n;o+=1)t.childConnectedCallback(r[o])},5),this._childObserver=ke(this,this.childConnectedCallback,this.childDisconnectedCallback)}if(!this._initialAttributeChange&&this.hasAttributes()){var r=this,n=r.attributes;for(let r=n.length,o=0;o<r;o+=1)t.attributeChangedCallback(n[o].name,null,n[o].value)}},r.prototype.attributeChangedCallback=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];t.prototype.attributeChangedCallback&&t.prototype.attributeChangedCallback.apply(this,r),this._initialAttributeChange=!0},r.prototype.deinit=function(){this._initialized=!1},r}(t);return Di.set(t,r),r}function Be(t){He(t);const r=t.trim().split(/(?:\s*,\s*)|(?:\s+)/g),n=r.length;return 0<n&&(r[0]=window.parseFloat(r[0])),1<n&&(r[1]=window.parseFloat(r[1])),2<n&&(r[2]=window.parseFloat(r[2])),r}function je(t){We(t);const r=t.trim().toLowerCase().split(/(?:\s*,\s*)|(?:\s+)/g),n=r.length;return 0<n&&(r[0]=r[0]),1<n&&(r[1]=r[1]),2<n&&(r[2]=r[2]),r}function He(t){if(!t.match(/^\s*(((\s*(-|\+)?((\.\d+)|(\d+\.\d+)|(\d+)|(\d+(\.\d+)?e(-|\+)?(\d+)))\s*,){0,2}(\s*(-|\+)?((\.\d+)|(\d+\.\d+)|(\d+)|(\d+(\.\d+)?e(-|\+)?(\d+)))))|((\s*(-|\+)?((\.\d+)|(\d+\.\d+)|(\d+)|(\d+(\.\d+)?e(-|\+)?(\d+)))\s){0,2}(\s*(-|\+)?((\.\d+)|(\d+\.\d+)|(\d+)|(\d+(\.\d+)?e(-|\+)?(\d+))))))\s*$/g))throw new Error('Attribute must be a comma- or space-separated sequence of up to three numbers, for example "1 2.5 3". Yours was "'+t+'".')}function We(t){if(!t.match(/^\s*(((\s*([a-zA-Z]+)\s*,){0,2}(\s*([a-zA-Z]+)))|((\s*([a-zA-Z]+)\s*){1,3}))\s*$/g))throw new Error('Attribute must be a comma- or space-separated sequence of up to three strings, for example "absolute absolute". Yours was "'+t+'".')}function Ye(t){return function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];const o=this.shadowRoot;let a=null;try{a=t.call.apply(t,[this].concat(r))}catch(t){throw t}if(this instanceof Gi){this._hasShadowRoot=!0,o&&Ze.call(this,o);const t=ke(a,Xe.bind(this),qe.bind(this));Vi.set(a,t);var i=this,s=i.children;for(let t=s.length,r=0;r<t;r+=1)s[r]instanceof Gi&&(s[r]._isPossiblyDistributed=!0)}return a}}function Xe(t){t instanceof Gi?this.imperativeCounterpart.addChild(t.imperativeCounterpart):xn&&t instanceof HTMLContentElement||Sn&&t instanceof HTMLSlotElement&&(t.addEventListener('slotchange',this),this._handleDistributedChildren(t))}function qe(t){t instanceof Gi?this.imperativeCounterpart.removeChild(t.imperativeCounterpart):xn&&t instanceof HTMLContentElement||Sn&&t instanceof HTMLSlotElement&&(t.removeEventListener('slotchange',this),this._handleDistributedChildren(t),this._slotElementsAssignedNodes.delete(t))}function Ze(t){var r=this;Vi.get(t).disconnect(),Vi.delete(t);var n=t.childNodes;for(let o=n.length,a=0;a<o;a+=1){const t=n[a];t instanceof Gi&&r.imperativeCounterpart.removeChild(t.imperativeCounterpart,!0)}}function Ke(){Gi||(Gi=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype.createdCallback=function(){var r=this;t.prototype.createdCallback.call(this),this.imperativeCounterpart=null,this._hasShadowRoot=!1,this._isPossiblyDistributed=!1,this._slotElementsAssignedNodes=new WeakMap,this._shadowParent=null,this._shadowChildren=null,this._imperativeCounterpartPromise=Promise.resolve().then(function(){return r._associateImperativeNode()}),this.mountPromise=this._imperativeCounterpartPromise.then(function(){return r.imperativeCounterpart.mountPromise})},r.prototype._associateImperativeNode=function(t){this.imperativeCounterpart||(t?this.imperativeCounterpart=t:this.imperativeCounterpart=this._makeImperativeCounterpart())},r.prototype._makeImperativeCounterpart=function(){throw new TypeError('This method should be implemented by classes extending DeclarativeBase.')},r.prototype.childConnectedCallback=function(t){if(t instanceof Ii){if(this._hasShadowRoot&&(t._isPossiblyDistributed=!0),t.imperativeCounterpart._parent)return;this.imperativeCounterpart.addChild(t.imperativeCounterpart)}else if(xn&&t instanceof HTMLContentElement&&Pe(this));else Sn&&t instanceof HTMLSlotElement&&Pe(this)&&(t.addEventListener('slotchange',this),this._handleDistributedChildren(t))},r.prototype.handleEvent=function(t){if('slotchange'==t.type){const r=t.target;this._handleDistributedChildren(r)}},r.prototype._handleDistributedChildren=function(t){var n=this;const o=this._getDistributedChildDifference(t);var a=o.added;for(let o=a.length,l=0;l<o;l+=1){const t=a[l];if(!(t instanceof r))continue;const o=t._shadowParent;if(o&&o._shadowChildren){const r=o._shadowChildren;r.splice(r.indexOf(t),1),r.length||(o._shadowChildren=null)}t._shadowParent=n,n._shadowChildren||(n._shadowChildren=[]),n._shadowChildren.add(t)}var s=o.removed;for(let o=s.length,a=0;a<o;a+=1){const t=s[a];t instanceof r&&(t._shadowParent=null,n._shadowChildren.delete(t),n._shadowChildren.size||(n._shadowChildren=null))}},r.prototype._getDistributedChildDifference=function(t){let r=this._slotElementsAssignedNodes.has(t)?this._slotElementsAssignedNodes.get(t):[];const n=t.assignedNodes({flatten:!0});this._slotElementsAssignedNodes.set(t,n);const o={removed:[]};for(let a=0,i=r.length;a<i;a+=1){const t=r[a],i=n.indexOf(t);0<=i?n.splice(a,1):o.removed.push(t)}return o.added=n,o},r.prototype.childDisconnectedCallback=function(t){if(t instanceof Ii){if(t._isPossiblyDistributed=!1,!t.imperativeCounterpart._parent)return;this.imperativeCounterpart.removeChild(t.imperativeCounterpart)}else if(xn&&t instanceof HTMLContentElement&&Pe(this));else Sn&&t instanceof HTMLSlotElement&&Pe(this)&&(t.removeEventListener('slotchange',this),this._handleDistributedChildren(t),this._slotElementsAssignedNodes.delete(t))},r.prototype.setAttribute=function(r,n){t.prototype.setAttribute.call(this,r,n)},r}(Ve(window.HTMLElement)))}function Qe(t,r){const n=['constructor','parent','children','element','scene','addChild','addChildren','removeChild','removeChildren'],o=Object.getOwnPropertyNames(t.prototype);for(let a=o.length,l=0;l<a;l+=1){const a=o[l];if(0<=n.indexOf(a)||0==a.indexOf('_')||r.prototype.hasOwnProperty(a))continue;const i={},s=Object.getOwnPropertyDescriptor(t.prototype,a);s.set&&Object.assign(i,{set:function(t){this.imperativeCounterpart[a]=t}}),s.get&&Object.assign(i,{get:function(){return this.imperativeCounterpart[a]}}),Object.defineProperty(r.prototype,a,i)}}function $e(){if(Ki)return;const t=Symbol('instanceofSymbol'),r=function(r){const n=r;var o=function(t){function r(r){var n=this;void 0===r&&(r={});var o=r._motorHtmlCounterpart;t.call(this,r),this._willBeRendered=!1,this._elementManager=new $i(o||this._makeElement()),this._elementManager.element._associateImperativeNode(this),this._mounted=!1,this._mountPromise=null,this._resolveMountPromise=null,this._rejectMountPromise=null,this._awaitingMountPromiseToRender=!1,this._waitingForMountConditions=!1,this.on('propertychange',function(t){('sizeMode'==t||'absoluteSize'==t||'proportionalSize'==t)&&n._calcSize(),n._needsToBeRendered()})}t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r;var n={mountPromise:{},element:{}};return r.prototype._makeElement=function(){throw new Error('Subclasses need to override ImperativeBase#_makeElement.')},n.mountPromise.get=function(){var t=this;return this._mountPromise||(this._mountPromise=new Promise(function(r,n){t._resolveMountPromise=r,t._rejectMountPromise=n})),this._mounted?this._mounted&&this._resolveMountPromise():this._waitForMountThenResolveMountPromise(),this._mountPromise},r.prototype._waitForMountThenResolveMountPromise=function(){},n.element.get=function(){return this._elementManager.element},r.prototype.addChild=function(n){if(n instanceof r){if(n instanceof Yi)throw new Error('\n A Scene cannot be added to another Node or Scene (at\n least for now). To place a Scene in a Node, just mount\n a new Scene onto a MotorHTMLNode with Scene.mount().\n ');return t.prototype.addChild.call(this,n),(n._scene||n.scene)&&(n._resolveScenePromise&&n._resolveScenePromise(n._scene),n._giveSceneRefToChildren()),n._calcSize(),n._needsToBeRendered(),this.on('sizechange',n._onParentSizeChange),this._elementManager.connectChildElement(n),this}},r.prototype.removeChild=function(r,n){r instanceof Qi&&(t.prototype.removeChild.call(this,r),this.off('sizechange',r._onParentSizeChange),r._resetSceneRef(),r._mountPromise&&r._rejectMountPromise('mountcancel'),r._mounted&&r._elementManager.shouldNotRender(),r._resetMountPromise(),!n&&this._elementManager.disconnectChildElement(r))},r.prototype._resetMountPromise=function(){this._mounted=!1,this._mountPromise=null,this._resolveMountPromise=null,this._rejectMountPromise=null;const t=this._children;for(let r=0,n=t.length;r<n;r+=1)t[r]._resetMountPromise()},r.prototype._needsToBeRendered=function(){var t=this;if(this._awaitingMountPromiseToRender)return Promise.resolve();const r=function(){t._willBeRendered=!0,wi._setNodeToBeRendered(t)};if(!this._mounted){this._awaitingMountPromiseToRender=!0;let n;return this.mountPromise.then(r).catch(function(){'mountcancel'==e||(n=e)}).then(function(){if(t._awaitingMountPromiseToRender=!1,n)throw n})}return r(),Promise.resolve()},r.prototype._getAncestorToBeRendered=function(){for(let t=this._parent;t;){if(t._willBeRendered)return t;t=t._parent}return!1},r.prototype._render=function(){t.prototype._render.call(this),this._elementManager.applyImperativeNodeProperties(this)},Object.defineProperties(r.prototype,n),r}(n),a=Object.getOwnPropertyDescriptor(n.prototype,'properties'),i=a.set;return Object.defineProperties(o.prototype,{properties:{set:function(t){if(void 0===t&&(t={}),i.call(this,t),t.classes){(r=this._elementManager).setClasses.apply(r,t.classes);var r}},configurable:!0}}),Object.defineProperty(o,Symbol.hasInstance,{value:function(r){if(this!==o)return Object.getPrototypeOf(o)[Symbol.hasInstance].call(this,r);for(let n=r;n;){const r=Object.getOwnPropertyDescriptor(n,'constructor');if(r&&r.value&&r.value.hasOwnProperty(t))return!0;n=Object.getPrototypeOf(n)}return!1}}),o[t]=!0,o};Ki=r(Mi),Ki.mixin=r}var Je=Math.min,et=Math.ceil,tt=Math.max,rt=Math.round,nt=Math.floor,ot=Math.pow,at=Math.PI,it=Math.abs,lt=Math.atan2,st=Math.sqrt,dt=Math.tan,pt=Math.sin,ct=Math.cos,_t={};_t.precision=1e-6,_t.identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],_t.multiply4x4=function(t,r){return[t[0]*r[0]+t[4]*r[1]+t[8]*r[2]+t[12]*r[3],t[1]*r[0]+t[5]*r[1]+t[9]*r[2]+t[13]*r[3],t[2]*r[0]+t[6]*r[1]+t[10]*r[2]+t[14]*r[3],t[3]*r[0]+t[7]*r[1]+t[11]*r[2]+t[15]*r[3],t[0]*r[4]+t[4]*r[5]+t[8]*r[6]+t[12]*r[7],t[1]*r[4]+t[5]*r[5]+t[9]*r[6]+t[13]*r[7],t[2]*r[4]+t[6]*r[5]+t[10]*r[6]+t[14]*r[7],t[3]*r[4]+t[7]*r[5]+t[11]*r[6]+t[15]*r[7],t[0]*r[8]+t[4]*r[9]+t[8]*r[10]+t[12]*r[11],t[1]*r[8]+t[5]*r[9]+t[9]*r[10]+t[13]*r[11],t[2]*r[8]+t[6]*r[9]+t[10]*r[10]+t[14]*r[11],t[3]*r[8]+t[7]*r[9]+t[11]*r[10]+t[15]*r[11],t[0]*r[12]+t[4]*r[13]+t[8]*r[14]+t[12]*r[15],t[1]*r[12]+t[5]*r[13]+t[9]*r[14]+t[13]*r[15],t[2]*r[12]+t[6]*r[13]+t[10]*r[14]+t[14]*r[15],t[3]*r[12]+t[7]*r[13]+t[11]*r[14]+t[15]*r[15]]},_t.multiply=function(t,r){return[t[0]*r[0]+t[4]*r[1]+t[8]*r[2],t[1]*r[0]+t[5]*r[1]+t[9]*r[2],t[2]*r[0]+t[6]*r[1]+t[10]*r[2],0,t[0]*r[4]+t[4]*r[5]+t[8]*r[6],t[1]*r[4]+t[5]*r[5]+t[9]*r[6],t[2]*r[4]+t[6]*r[5]+t[10]*r[6],0,t[0]*r[8]+t[4]*r[9]+t[8]*r[10],t[1]*r[8]+t[5]*r[9]+t[9]*r[10],t[2]*r[8]+t[6]*r[9]+t[10]*r[10],0,t[0]*r[12]+t[4]*r[13]+t[8]*r[14]+t[12],t[1]*r[12]+t[5]*r[13]+t[9]*r[14]+t[13],t[2]*r[12]+t[6]*r[13]+t[10]*r[14]+t[14],1]},_t.thenMove=function(r,n){return n[2]||(n[2]=0),[r[0],r[1],r[2],0,r[4],r[5],r[6],0,r[8],r[9],r[10],0,r[12]+n[0],r[13]+n[1],r[14]+n[2],1]},_t.moveThen=function(t,r){t[2]||(t[2]=0);var n=t[0]*r[0]+t[1]*r[4]+t[2]*r[8],o=t[0]*r[1]+t[1]*r[5]+t[2]*r[9],a=t[0]*r[2]+t[1]*r[6]+t[2]*r[10];return _t.thenMove(r,[n,o,a])},_t.translate=function(t,r,n){return void 0===n&&(n=0),[1,0,0,0,0,1,0,0,0,0,1,0,t,r,n,1]},_t.thenScale=function(t,r){return[r[0]*t[0],r[1]*t[1],r[2]*t[2],0,r[0]*t[4],r[1]*t[5],r[2]*t[6],0,r[0]*t[8],r[1]*t[9],r[2]*t[10],0,r[0]*t[12],r[1]*t[13],r[2]*t[14],1]},_t.scale=function(t,r,n){return void 0===n&&(n=1),void 0===r&&(r=t),[t,0,0,0,0,r,0,0,0,0,n,0,0,0,0,1]},_t.rotateX=function(t){var r=ct(t),n=pt(t);return[1,0,0,0,0,r,n,0,0,-n,r,0,0,0,0,1]},_t.rotateY=function(t){var r=ct(t),n=pt(t);return[r,0,-n,0,0,1,0,0,n,0,r,0,0,0,0,1]},_t.rotateZ=function(t){var r=ct(t),n=pt(t);return[r,n,0,0,-n,r,0,0,0,0,1,0,0,0,0,1]},_t.rotate=function(t,r,n){var o=ct(t),a=pt(t),i=ct(r),l=pt(r),s=ct(n),d=pt(n);return[i*s,o*d+a*l*s,a*d-o*l*s,0,-i*d,o*s-a*l*d,a*s+o*l*d,0,l,-a*i,o*i,0,0,0,0,1]},_t.rotateAxis=function(t,r){var n=pt(r),o=ct(r),a=1-o,i=t[0]*t[0]*a,l=t[0]*t[1]*a,s=t[0]*t[2]*a,d=t[1]*t[1]*a,p=t[1]*t[2]*a,c=t[2]*t[2]*a,_=t[0]*n,u=t[1]*n,m=t[2]*n;return[i+o,l+m,s-u,0,l-m,d+o,p+_,0,s+u,p-_,c+o,0,0,0,0,1]},_t.aboutOrigin=function(t,r){var n=t[0]-(t[0]*r[0]+t[1]*r[4]+t[2]*r[8]),o=t[1]-(t[0]*r[1]+t[1]*r[5]+t[2]*r[9]),a=t[2]-(t[0]*r[2]+t[1]*r[6]+t[2]*r[10]);return _t.thenMove(r,[n,o,a])},_t.skew=function(t,r,n){return[1,dt(r),0,0,dt(n),1,0,0,0,dt(t),1,0,0,0,0,1]},_t.skewX=function(t){return[1,0,0,0,dt(t),1,0,0,0,0,1,0,0,0,0,1]},_t.skewY=function(t){return[1,dt(t),0,0,0,1,0,0,0,0,1,0,0,0,0,1]},_t.perspective=function(t){return[1,0,0,0,0,1,0,0,0,0,1,-1/t,0,0,0,1]},_t.getTranslate=function(t){return[t[12],t[13],t[14]]},_t.inverse=function(t){var r=t[5]*t[10]-t[6]*t[9],n=t[4]*t[10]-t[6]*t[8],o=t[4]*t[9]-t[5]*t[8],a=t[1]*t[10]-t[2]*t[9],i=t[0]*t[10]-t[2]*t[8],l=t[0]*t[9]-t[1]*t[8],s=t[1]*t[6]-t[2]*t[5],d=t[0]*t[6]-t[2]*t[4],p=t[0]*t[5]-t[1]*t[4],c=t[0]*r-t[1]*n+t[2]*o,_=1/c,u=[_*r,-_*a,_*s,0,-_*n,_*i,-_*d,0,_*o,-_*l,_*p,0,0,0,0,1];return u[12]=-t[12]*u[0]-t[13]*u[4]-t[14]*u[8],u[13]=-t[12]*u[1]-t[13]*u[5]-t[14]*u[9],u[14]=-t[12]*u[2]-t[13]*u[6]-t[14]*u[10],u},_t.transpose=function(t){return[t[0],t[4],t[8],t[12],t[1],t[5],t[9],t[13],t[2],t[6],t[10],t[14],t[3],t[7],t[11],t[15]]},_t.interpret=function(t){var a=[t[0],t[1],t[2]],i=o(a[0]),l=n(a),s=[a[0]+i*l,a[1],a[2]],d=2/r(s);if(d>=Infinity)return{translate:_t.getTranslate(t),rotate:[0,0,0],scale:[0,0,0],skew:[0,0,0]};var p=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1];p[0]=1-d*s[0]*s[0],p[5]=1-d*s[1]*s[1],p[10]=1-d*s[2]*s[2],p[1]=-d*s[0]*s[1],p[2]=-d*s[0]*s[2],p[6]=-d*s[1]*s[2],p[4]=p[1],p[8]=p[2],p[9]=p[6];var c=_t.multiply(p,t),_=[c[5],c[6]],u=o(_[0]),m=n(_),g=[_[0]+u*m,_[1]],y=2/r(g),f=[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1];f[5]=1-y*g[0]*g[0],f[10]=1-y*g[1]*g[1],f[6]=-y*g[0]*g[1],f[9]=f[6];var h=_t.multiply(f,p),v=_t.multiply(h,t),x=_t.scale(0>v[0]?-1:1,0>v[5]?-1:1,0>v[10]?-1:1);v=_t.multiply(v,x),h=_t.multiply(x,h);var S={};return S.translate=_t.getTranslate(t),S.rotate=[lt(-h[6],h[10]),Math.asin(h[2]),lt(-h[1],h[0])],S.rotate[0]||(S.rotate[0]=0,S.rotate[2]=lt(h[4],h[5])),S.scale=[v[0],v[5],v[10]],S.skew=[lt(v[9],S.scale[2]),lt(v[8],S.scale[2]),lt(v[4],S.scale[0])],it(S.rotate[0])+it(S.rotate[2])>1.5*at&&(S.rotate[1]=at-S.rotate[1],S.rotate[1]>at&&(S.rotate[1]-=2*at),S.rotate[1]<-at&&(S.rotate[1]+=2*at),0>S.rotate[0]?S.rotate[0]+=at:S.rotate[0]-=at,0>S.rotate[2]?S.rotate[2]+=at:S.rotate[2]-=at),S},_t.average=function(r,n,o){o=void 0===o?0.5:o;for(var t=_t.interpret(r),a=_t.interpret(n),l={translate:[0,0,0],rotate:[0,0,0],scale:[0,0,0],skew:[0,0,0]},s=0;3>s;s++)l.translate[s]=(1-o)*t.translate[s]+o*a.translate[s],l.rotate[s]=(1-o)*t.rotate[s]+o*a.rotate[s],l.scale[s]=(1-o)*t.scale[s]+o*a.scale[s],l.skew[s]=(1-o)*t.skew[s]+o*a.skew[s];return _t.build(l)},_t.build=function(t){var r=_t.scale(t.scale[0],t.scale[1],t.scale[2]),n=_t.skew(t.skew[0],t.skew[1],t.skew[2]),o=_t.rotate(t.rotate[0],t.rotate[1],t.rotate[2]);return _t.thenMove(_t.multiply(_t.multiply(o,n),r),t.translate)},_t.equals=function(t,r){return!_t.notEquals(t,r)},_t.notEquals=function(t,r){return t!==r&&(!(t&&r)||t[12]!==r[12]||t[13]!==r[13]||t[14]!==r[14]||t[0]!==r[0]||t[1]!==r[1]||t[2]!==r[2]||t[4]!==r[4]||t[5]!==r[5]||t[6]!==r[6]||t[8]!==r[8]||t[9]!==r[9]||t[10]!==r[10])},_t.normalizeRotation=function(t){var r=t.slice(0);for((r[0]===0.5*at||r[0]===0.5*-at)&&(r[0]=-r[0],r[1]=at-r[1],r[2]-=at),r[0]>0.5*at&&(r[0]-=at,r[1]=at-r[1],r[2]-=at),r[0]<0.5*-at&&(r[0]+=at,r[1]=-at-r[1],r[2]-=at);r[1]<-at;)r[1]+=2*at;for(;r[1]>=at;)r[1]-=2*at;for(;r[2]<-at;)r[2]+=2*at;for(;r[2]>=at;)r[2]-=2*at;return r},_t.inFront=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0.001,1],_t.behind=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,-0.001,1];var ut=_t,mt={};mt.Direction={X:0,Y:1,Z:2},mt.after=function(t,r){var n=t;return function(){n--,0===n&&r.apply(this,arguments)}},mt.loadURL=function(t,r){var n=new XMLHttpRequest;n.onreadystatechange=function(){4===this.readyState&&r&&r(this.responseText)},n.open('GET',t),n.send()},mt.createDocumentFragmentFromHTML=function(t){var r=document.createElement('div');r.innerHTML=t;for(var n=document.createDocumentFragment();r.hasChildNodes();)n.appendChild(r.firstChild);return n},mt.clone=function(t){var r;if('object'==typeof t){for(var n in r=t instanceof Array?[]:{},t)if('object'!=typeof t[n]||null===t[n])r[n]=t[n];else if(t[n]instanceof Array){r[n]=Array(t[n].length);for(var o=0;o<t[n].length;o++)r[n][o]=mt.clone(t[n][o])}else r[n]=mt.clone(t[n]);}else r=t;return r};var gt=mt;a.SUPPORTS_MULTIPLE=!0,a.prototype.get=function(){for(var t=this,r=0;r<this._instances.length;r++)t.state[r]=t._instances[r].get();return this.state},a.prototype.set=function(t,r,n){for(var o=this,a=gt.after(t.length,n),l=0;l<t.length;l++)o._instances[l]||(o._instances[l]=new o.method),o._instances[l].set(t[l],r,a)},a.prototype.reset=function(t){for(var r=this,n=0;n<t.length;n++)r._instances[n]||(r._instances[n]=new r.method),r._instances[n].reset(t[n])};var yt=a;l.Curves={linear:function(r){return r},easeIn:function(r){return r*r},easeOut:function(r){return r*(2-r)},easeInOut:function(r){return 0.5>=r?2*r*r:-2*r*r+4*r-1},easeOutBounce:function(r){return r*(3-2*r)},spring:function(r){return(1-r)*pt(6*at*r)+r}},l.SUPPORTS_MULTIPLE=!0,l.DEFAULT_OPTIONS={curve:l.Curves.linear,duration:500,speed:0};var ft={};l.registerCurve=function(t,r){return!ft[t]&&(ft[t]=r,!0)},l.unregisterCurve=function(t){return!!ft[t]&&(delete ft[t],!0)},l.getCurve=function(t){var r=ft[t];if(void 0!==r)return r;throw new Error('curve not registered')},l.getCurves=function(){return ft},l.prototype.setOptions=function(t){void 0!==t.curve&&(this.options.curve=t.curve),void 0!==t.duration&&(this.options.duration=t.duration),void 0!==t.speed&&(this.options.speed=t.speed)},l.prototype.set=function(t,r,n){if(!r)return this.reset(t),void(n&&n());if(this._startValue=d(this.get()),r=p(r,this.options),r.speed){var o=this._startValue;if(o instanceof Object){var a=0;for(var l in o)a+=(t[l]-o[l])*(t[l]-o[l]);r.duration=st(a)/r.speed}else r.duration=it(t-o)/r.speed}this._startTime=Date.now(),this._endValue=d(t),this._startVelocity=d(r.velocity),this._duration=r.duration,this._curve=r.curve,this._active=!0,this._callback=n},l.prototype.reset=function(t,r){if(this._callback){var n=this._callback;this._callback=void 0,n()}this.state=d(t),this.velocity=d(r),this._startTime=0,this._duration=0,this._updateTime=0,this._startValue=this.state,this._startVelocity=this.velocity,this._endValue=this.state,this._active=!1},l.prototype.getVelocity=function(){return this.velocity},l.prototype.get=function(t){return this.update(t),this.state},l.prototype.update=function(r){if(!this._active){if(this._callback){var n=this._callback;this._callback=void 0,n()}return}if(r||(r=Date.now()),!(this._updateTime>=r)){this._updateTime=r;var o=r-this._startTime;if(o>=this._duration)this.state=this._endValue,this.velocity=c(this.state,this._startValue,this._curve,this._duration,1),this._active=!1;else if(0>o)this.state=this._startValue,this.velocity=this._startVelocity;else{var a=o/this._duration;this.state=u(this._startValue,this._endValue,this._curve(a)),this.velocity=c(this.state,this._startValue,this._curve,this._duration,a)}}},l.prototype.isActive=function(){return this._active},l.prototype.halt=function(){this.reset(this.get())},l.registerCurve('linear',l.Curves.linear),l.registerCurve('easeIn',l.Curves.easeIn),l.registerCurve('easeOut',l.Curves.easeOut),l.registerCurve('easeInOut',l.Curves.easeInOut),l.registerCurve('easeOutBounce',l.Curves.easeOutBounce),l.registerCurve('spring',l.Curves.spring),l.customCurve=function(r,n){return r=r||0,n=n||0,function(o){return r*o+(-2*r-n+3)*o*o+(r+n-2)*o*o*o}};var ht=l,vt={};m.register=function(t){var r=!0;for(var n in t)m.registerMethod(n,t[n])||(r=!1);return r},m.registerMethod=function(t,r){return!(t in vt)&&(vt[t]=r,!0)},m.unregisterMethod=function(t){return!!(t in vt)&&(delete vt[t],!0)},m.prototype.set=function(t,r,n){if(!r)return this.reset(t),n&&n(),this;return this.actionQueue.push([t,r]),this.callbackQueue.push(n),this.currentAction||y.call(this),this},m.prototype.reset=function(t,r){this._currentMethod=null,this._engineInstance=null,this._callback=void 0,this.state=t,this.velocity=r,this.currentAction=null,this.actionQueue=[],this.callbackQueue=[]},m.prototype.delay=function(t,r){var n;return n=this.actionQueue.length?this.actionQueue[this.actionQueue.length-1][0]:this.currentAction?this.currentAction[0]:this.get(),this.set(n,{duration:t,curve:function(){return 0}},r)},m.prototype.get=function(t){return this._engineInstance&&(this._engineInstance.getVelocity&&(this.velocity=this._engineInstance.getVelocity()),this.state=this._engineInstance.get(t)),this.state},m.prototype.isActive=function(){return!!this.currentAction},m.prototype.halt=function(){return this.set(this.get())};var bt=m,xt={inQuad:function(r){return r*r},outQuad:function(r){return-(r-=1)*r+1},inOutQuad:function(r){return 1>(r/=.5)?.5*r*r:-.5*(--r*(r-2)-1)},inCubic:function(r){return r*r*r},outCubic:function(r){return--r*r*r+1},inOutCubic:function(r){return 1>(r/=.5)?.5*r*r*r:.5*((r-=2)*r*r+2)},inQuart:function(r){return r*r*r*r},outQuart:function(r){return-(--r*r*r*r-1)},inOutQuart:function(r){return 1>(r/=.5)?.5*r*r*r*r:-.5*((r-=2)*r*r*r-2)},inQuint:function(r){return r*r*r*r*r},outQuint:function(r){return--r*r*r*r*r+1},inOutQuint:function(r){return 1>(r/=.5)?.5*r*r*r*r*r:.5*((r-=2)*r*r*r*r+2)},inSine:function(r){return-1*ct(r*(at/2))+1},outSine:function(r){return pt(r*(at/2))},inOutSine:function(r){return-.5*(ct(at*r)-1)},inExpo:function(r){return 0===r?0:ot(2,10*(r-1))},outExpo:function(r){return 1===r?1:-ot(2,-10*r)+1},inOutExpo:function(r){return 0===r?0:1===r?1:1>(r/=.5)?.5*ot(2,10*(r-1)):.5*(-ot(2,-10*--r)+2)},inCirc:function(r){return-(st(1-r*r)-1)},outCirc:function(r){return st(1- --r*r)},inOutCirc:function(r){return 1>(r/=.5)?-.5*(st(1-r*r)-1):.5*(st(1-(r-=2)*r)+1)},inElastic:function(r){var t=1.70158,n=0;return 0===r?0:1===r?1:(n||(n=.3),t=1.5707963267948966*(n/(2*at)),-(1*ot(2,10*(r-=1))*pt((r-t)*(2*at)/n)))},outElastic:function(r){var t=1.70158,n=0;return 0===r?0:1===r?1:(n||(n=.3),t=1.5707963267948966*(n/(2*at)),1*ot(2,-10*r)*pt((r-t)*(2*at)/n)+1)},inOutElastic:function(r){var t=1.70158,n=0,o=1;return 0===r?0:2==(r/=.5)?1:(n||(n=.3*1.5),t=1.5707963267948966*(n/(2*at)),1>r?-.5*(o*ot(2,10*(r-=1))*pt((r-t)*(2*at)/n)):.5*(o*ot(2,-10*(r-=1))*pt((r-t)*(2*at)/n))+1)},inBack:function(r,t){return void 0===t&&(t=1.70158),r*r*((t+1)*r-t)},outBack:function(r,t){return void 0===t&&(t=1.70158),--r*r*((t+1)*r+t)+1},inOutBack:function(r,t){return void 0===t&&(t=1.70158),1>(r/=.5)?.5*(r*r*(((t*=1.525)+1)*r-t)):.5*((r-=2)*r*(((t*=1.525)+1)*r+t)+2)},inBounce:function(r){return 1-xt.outBounce(1-r)},outBounce:function(r){return r<1/2.75?7.5625*r*r:r<2/2.75?7.5625*(r-=1.5/2.75)*r+.75:r<2.5/2.75?7.5625*(r-=2.25/2.75)*r+.9375:7.5625*(r-=2.625/2.75)*r+.984375},inOutBounce:function(r){return .5>r?.5*xt.inBounce(2*r):.5*xt.outBounce(2*r-1)+.5}},St=xt;h.prototype.setTranslate=function(t,r,n){for(var o=this,a=S(t,'number'),l=n?gt.after(a,n):null,s=0;s<t.length;s+=1)'number'==typeof t[s]&&(o.translate[s].set(t[s],r,l),o._finalTranslate[s]=t[s]);return this._final=x.call(this),this},h.prototype.setTranslateX=function(t,r,n){return this.translate[0].set(t,r,n),this._finalTranslate[0]=t,this._final=x.call(this),this},h.prototype.setTranslateY=function(t,r,n){return this.translate[1].set(t,r,n),this._finalTranslate[1]=t,this._final=x.call(this),this},h.prototype.setTranslateZ=function(t,r,n){return this.translate[2].set(t,r,n),this._finalTranslate[2]=t,this._final=x.call(this),this},h.prototype.setScale=function(t,r,n){for(var o=this,a=S(t,'number'),l=n?gt.after(a,n):null,s=0;s<t.length;s+=1)'number'==typeof t[s]&&(o.scale[s].set(t[s],r,l),o._finalScale[s]=t[s]);return this._final=x.call(this),this},h.prototype.setScaleX=function(t,r,n){return this.scale[0].set(t,r,n),this._finalScale[0]=t,this._final=x.call(this),this},h.prototype.setScaleY=function(t,r,n){return this.scale[1].set(t,r,n),this._finalScale[1]=t,this._final=x.call(this),this},h.prototype.setScaleZ=function(t,r,n){return this.scale[2].set(t,r,n),this._finalScale[2]=t,this._final=x.call(this),this},h.prototype.setRotate=function(t,r,n){for(var o=this,a=S(t,'number'),l=n?gt.after(a,n):null,s=0;s<t.length;s+=1)'number'==typeof t[s]&&(o.rotate[s].set(t[s],r,l),o._finalRotate[s]=t[s]);return this._final=x.call(this),this},h.prototype.setRotateX=function(t,r,n){return this.rotate[0].set(t,r,n),this._finalRotate[0]=t,this._final=x.call(this),this},h.prototype.setRotateY=function(t,r,n){return this.rotate[1].set(t,r,n),this._finalRotate[1]=t,this._final=x.call(this),this},h.prototype.setRotateZ=function(t,r,n){return this.rotate[2].set(t,r,n),this._finalRotate[2]=t,this._final=x.call(this),this},h.prototype.setSkew=function(t,r,n){for(var o=this,a=S(t,'number'),l=n?gt.after(a,n):null,s=0;s<t.length;s+=1)'number'==typeof t[s]&&(o.skew[s].set(t[s],r,l),o._finalSkew[s]=t[s]);return this._final=x.call(this),this},h.prototype.setSkewX=function(t,r,n){return this.skew[0].set(t,r,n),this._finalSkew[0]=t,this._final=x.call(this),this},h.prototype.setSkewY=function(t,r,n){return this.skew[1].set(t,r,n),this._finalSkew[1]=t,this._final=x.call(this),this},h.prototype.setSkewZ=function(t,r,n){return this.skew[2].set(t,r,n),this._finalSkew[2]=t,this._final=x.call(this),this},h.prototype.set=function(t,r,n){var o=this,a=ut.interpret(t);this._finalTranslate=a.translate,this._finalRotate=a.rotate,this._finalSkew=a.skew,this._finalScale=a.scale,this._final=t;for(var l=n?gt.after(12,n):null,s=0;3>s;s+=1)o.translate[s].set(a.translate[s],r,l),o.rotate[s].set(a.rotate[s],r,l),o.skew[s].set(a.skew[s],r,l),o.scale[s].set(a.scale[s],r,l);return this},h.prototype.setDefaultTransition=function(t){for(var r=this,n=0;3>n;n+=1)r.translate[n].setDefault(t),r.rotate[n].setDefault(t),r.skew[n].setDefault(t),r.scale[n].setDefault(t)},h.prototype.get=function(){return this.isActive()?v.call(this):this._final},h.prototype.getFinal=function(){return this._final},h.prototype.isActive=function(){for(var t=this,r=!1,n=0;3>n;n+=1)if(t.translate[n].isActive()||t.rotate[n].isActive()||t.skew[n].isActive()||t.scale[n].isActive()){r=!0;break}return r},h.prototype.halt=function(){for(var t=this,r=0;3>r;r+=1)t.translate[r].halt(),t.rotate[r].halt(),t.skew[r].halt(),t.scale[r].halt(),t._finalTranslate[r]=t.translate[r].get(),t._finalRotate[r]=t.rotate[r].get(),t._finalSkew[r]=t.skew[r].get(),t._finalScale[r]=t.scale[r].get();return this._final=this.get(),this};var Ct=h;C.prototype.transformFrom=function(t){return t instanceof Function?this._transformGetter=t:t instanceof Object&&t.get?this._transformGetter=t.get.bind(t):(this._transformGetter=null,this._output.transform=t),this},C.prototype.opacityFrom=function(t){return t instanceof Function?this._opacityGetter=t:t instanceof Object&&t.get?this._opacityGetter=t.get.bind(t):(this._opacityGetter=null,this._output.opacity=t),this},C.prototype.originFrom=function(t){return t instanceof Function?this._originGetter=t:t instanceof Object&&t.get?this._originGetter=t.get.bind(t):(this._originGetter=null,this._output.origin=t),this},C.prototype.alignFrom=function(t){return t instanceof Function?this._alignGetter=t:t instanceof Object&&t.get?this._alignGetter=t.get.bind(t):(this._alignGetter=null,this._output.align=t),this},C.prototype.sizeFrom=function(t){return t instanceof Function?this._sizeGetter=t:t instanceof Object&&t.get?this._sizeGetter=t.get.bind(t):(this._sizeGetter=null,this._output.size=t),this},C.prototype.proportionsFrom=function(t){return t instanceof Function?this._proportionGetter=t:t instanceof Object&&t.get?this._proportionGetter=t.get.bind(t):(this._proportionGetter=null,this._output.proportions=t),this},C.prototype.setTransform=function(t,r,n){return r||this._legacyStates.transform?(this._legacyStates.transform||(this._legacyStates.transform=new Ct(this._output.transform)),this._transformGetter||this.transformFrom(this._legacyStates.transform),this._legacyStates.transform.set(t,r,n),this):this.transformFrom(t)},C.prototype.setOpacity=function(t,r,n){return r||this._legacyStates.opacity?(this._legacyStates.opacity||(this._legacyStates.opacity=new bt(this._output.opacity)),this._opacityGetter||this.opacityFrom(this._legacyStates.opacity),this._legacyStates.opacity.set(t,r,n)):this.opacityFrom(t)},C.prototype.setOrigin=function(t,r,n){return r||this._legacyStates.origin?(this._legacyStates.origin||(this._legacyStates.origin=new bt(this._output.origin||[0,0])),this._originGetter||this.originFrom(this._legacyStates.origin),this._legacyStates.origin.set(t,r,n),this):this.originFrom(t)},C.prototype.setAlign=function(t,r,n){return r||this._legacyStates.align?(this._legacyStates.align||(this._legacyStates.align=new bt(this._output.align||[0,0])),this._alignGetter||this.alignFrom(this._legacyStates.align),this._legacyStates.align.set(t,r,n),this):this.alignFrom(t)},C.prototype.setSize=function(t,r,n){return t&&(r||this._legacyStates.size)?(this._legacyStates.size||(this._legacyStates.size=new bt(this._output.size||[0,0])),this._sizeGetter||this.sizeFrom(this._legacyStates.size),this._legacyStates.size.set(t,r,n),this):this.sizeFrom(t)},C.prototype.setProportions=function(t,r,n){return t&&(r||this._legacyStates.proportions)?(this._legacyStates.proportions||(this._legacyStates.proportions=new bt(this._output.proportions||[0,0])),this._proportionGetter||this.proportionsFrom(this._legacyStates.proportions),this._legacyStates.proportions.set(t,r,n),this):this.proportionsFrom(t)},C.prototype.halt=function(){this._legacyStates.transform&&this._legacyStates.transform.halt(),this._legacyStates.opacity&&this._legacyStates.opacity.halt(),this._legacyStates.origin&&this._legacyStates.origin.halt(),this._legacyStates.align&&this._legacyStates.align.halt(),this._legacyStates.size&&this._legacyStates.size.halt(),this._legacyStates.proportions&&this._legacyStates.proportions.halt(),this._transformGetter=null,this._opacityGetter=null,this._originGetter=null,this._alignGetter=null,this._sizeGetter=null,this._proportionGetter=null},C.prototype.getTransform=function(){return this._transformGetter()},C.prototype.getFinalTransform=function(){return this._legacyStates.transform?this._legacyStates.transform.getFinal():this._output.transform},C.prototype.getOpacity=function(){return this._opacityGetter()},C.prototype.getOrigin=function(){return this._originGetter()},C.prototype.getAlign=function(){return this._alignGetter()},C.prototype.getSize=function(){return this._sizeGetter?this._sizeGetter():this._output.size},C.prototype.getProportions=function(){return this._proportionGetter?this._proportionGetter():this._output.proportions},C.prototype.modify=function(t){return k.call(this),this._output.target=t,this._output};var kt=C,Tt=[],Pt={register:function(t){var r=Tt.length;return T(r,t),r},unregister:function(t){T(t,null)},get:function(t){return Tt[t]},set:T};P._instance=new P,P.parse=function(t,r){return P._instance.parse(t,r)},P.prototype.parse=function(t,r){return this.reset(),this._parseSpec(t,r,ut.identity),this.result},P.prototype.reset=function(){this.result={}};var Rt=[0,0];P.prototype._parseSpec=function(t,r,n){var o=this,a,l,s,d,p,c,_;if('number'==typeof t){if(a=t,s=r.transform,c=r.align||Rt,r.size&&c&&(c[0]||c[1])){var u=[c[0]*r.size[0],c[1]*r.size[1],0];s=ut.thenMove(s,R(u,n))}this.result[a]={transform:s,opacity:r.opacity,origin:r.origin||Rt,align:r.align||Rt,size:r.size}}else{if(!t)return;if(t instanceof Array)for(var m=0;m<t.length;m++)o._parseSpec(t[m],r,n);else{l=t.target,s=r.transform,d=r.opacity,p=r.origin,c=r.align,_=r.size;var i=n;if(void 0!==t.opacity&&(d=r.opacity*t.opacity),t.transform&&(s=ut.multiply(r.transform,t.transform)),t.origin&&(p=t.origin,i=r.transform),t.align&&(c=t.align),t.size||t.proportions){var g=_;_=[_[0],_[1]],t.size&&(void 0!==t.size[0]&&(_[0]=t.size[0]),void 0!==t.size[1]&&(_[1]=t.size[1])),t.proportions&&(void 0!==t.proportions[0]&&(_[0]*=t.proportions[0]),void 0!==t.proportions[1]&&(_[1]*=t.proportions[1])),g&&(c&&(c[0]||c[1])&&(s=ut.thenMove(s,R([c[0]*g[0],c[1]*g[1],0],n))),p&&(p[0]||p[1])&&(s=ut.moveThen([-p[0]*_[0],-p[1]*_[1],0],s))),i=r.transform,p=null,c=null}this._parseSpec(l,{transform:s,opacity:d,origin:p,align:c,size:_},i)}}};var Et=P;E.prototype.add=function(t){var r=t instanceof E?t:new E(t);return this._child instanceof Array?this._child.push(r):this._child?(this._child=[this._child,r],this._hasMultipleChildren=!0,this._childResult=[]):this._child=r,r},E.prototype.get=function(){return this._object||(this._hasMultipleChildren?null:this._child?this._child.get():null)},E.prototype.set=function(t){return this._childResult=null,this._hasMultipleChildren=!1,this._isRenderable=!!t.render,this._isModifier=!!t.modify,this._object=t,this._child=null,t instanceof E?t:this},E.prototype.getSize=function(){var t=null,r=this.get();return r&&r.getSize&&(t=r.getSize()),!t&&this._child&&this._child.getSize&&(t=this._child.getSize()),t},E.prototype.commit=function(t){for(var r=this,n=Object.keys(this._prevResults),o=0,a;o<n.length;o++)if(a=n[o],void 0===r._resultCache[a]){var i=Pt.get(a);i.cleanup&&i.cleanup(t.allocator)}this._prevResults=this._resultCache,this._resultCache={},w(this.render(),t,this._resultCache)},E.prototype.render=function(){if(this._isRenderable)return this._object.render();var t=null;if(this._hasMultipleChildren){t=this._childResult;for(var r=this._child,n=0;n<r.length;n++)t[n]=r[n].render()}else this._child&&(t=this._child.render());return this._isModifier?this._object.modify(t):t};var wt=E;A.prototype.emit=function(t,r){var n=this,o=this.listeners[t];if(o)for(var a=0;a<o.length;a++)o[a].call(n._owner,r);return this},A.prototype.on=function(t,r){t in this.listeners||(this.listeners[t]=[]);var n=this.listeners[t].indexOf(r);return 0>n&&this.listeners[t].push(r),this},A.prototype.addListener=A.prototype.on,A.prototype.removeListener=function(t,r){var n=this.listeners[t];if(void 0!==n){var o=n.indexOf(r);0<=o&&n.splice(o,1)}return this},A.prototype.bindThis=function(t){this._owner=t};var At=A;O.prototype=Object.create(At.prototype),O.prototype.constructor=O,O.setInputHandler=function(t,r){t.trigger=r.trigger.bind(r),r.subscribe&&r.unsubscribe&&(t.subscribe=r.subscribe.bind(r),t.unsubscribe=r.unsubscribe.bind(r))},O.setOutputHandler=function(t,r){r instanceof O&&r.bindThis(t),t.pipe=r.pipe.bind(r),t.unpipe=r.unpipe.bind(r),t.on=r.on.bind(r),t.addListener=t.on,t.removeListener=r.removeListener.bind(r)},O.prototype.emit=function(t,r){var n=this;At.prototype.emit.apply(this,arguments);var o=0;for(o=0;o<this.downstream.length;o++)n.downstream[o].trigger&&n.downstream[o].trigger(t,r);for(o=0;o<this.downstreamFn.length;o++)n.downstreamFn[o](t,r);return this},O.prototype.trigger=O.prototype.emit,O.prototype.pipe=function(t){if(t.subscribe instanceof Function)return t.subscribe(this);var r=t instanceof Function?this.downstreamFn:this.downstream,n=r.indexOf(t);return 0>n&&r.push(t),t instanceof Function?t('pipe',null):t.trigger&&t.trigger('pipe',null),t},O.prototype.unpipe=function(t){if(t.unsubscribe instanceof Function)return t.unsubscribe(this);var r=t instanceof Function?this.downstreamFn:this.downstream,n=r.indexOf(t);return!!(0<=n)&&(r.splice(n,1),t instanceof Function?t('unpipe',null):t.trigger&&t.trigger('unpipe',null),t)},O.prototype.on=function(t){var r=this;if(At.prototype.on.apply(this,arguments),!(t in this.upstreamListeners)){var n=this.trigger.bind(this,t);this.upstreamListeners[t]=n;for(var o=0;o<this.upstream.length;o++)r.upstream[o].on(t,n)}return this},O.prototype.addListener=O.prototype.on,O.prototype.subscribe=function(t){var r=this,n=this.upstream.indexOf(t);if(0>n)for(var o in this.upstream.push(t),r.upstreamListeners)t.on(o,r.upstreamListeners[o]);return this},O.prototype.unsubscribe=function(t){var r=this,n=this.upstream.indexOf(t);if(0<=n)for(var o in this.upstream.splice(n,1),r.upstreamListeners)t.removeListener(o,r.upstreamListeners[o]);return this};var Ot=O;M.prototype.migrate=function(t){var r=this.container;if(t!==r){if(r instanceof DocumentFragment)t.appendChild(r);else for(;r.hasChildNodes();)t.appendChild(r.firstChild);this.container=t}},M.prototype.allocate=function(t){t=t.toLowerCase(),t in this.detachedNodes||(this.detachedNodes[t]=[]);var r=this.detachedNodes[t],n;return 0<r.length?n=r.pop():(n=document.createElement(t),this.container.appendChild(n)),this.nodeCount++,n},M.prototype.deallocate=function(t){var r=t.nodeName.toLowerCase(),n=this.detachedNodes[r];n.push(t),this.nodeCount--},M.prototype.getNodeCount=function(){return this.nodeCount};var Mt=M,Lt=[0,0],zt=!('perspective'in document.documentElement.style),Ft=zt?function(t,r){t.style.webkitPerspective=r?r.toFixed()+'px':''}:function(t,r){t.style.perspective=r?r.toFixed()+'px':''};z.prototype.getAllocator=function(){return this._allocator},z.prototype.add=function(t){return this._node.add(t)},z.prototype.migrate=function(t){t===this.container||(this.container=t,this._allocator.migrate(t))},z.prototype.getSize=function(){return this._size},z.prototype.setSize=function(t){t||(t=L.call(this)),this._size[0]=t[0],this._size[1]=t[1]},z.prototype.update=function(t){t&&(t.transform&&(this._nodeContext.transform=t.transform),t.opacity&&(this._nodeContext.opacity=t.opacity),t.origin&&(this._nodeContext.origin=t.origin),t.align&&(this._nodeContext.align=t.align),t.size&&(this._nodeContext.size=t.size));var r=this._perspectiveState.get();r!==this._perspective&&(Ft(this.container,r),this._perspective=r),this._node.commit(this._nodeContext)},z.prototype.getPerspective=function(){return this._perspectiveState.get()},z.prototype.setPerspective=function(t,r,n){return this._perspectiveState.set(t,r,n)},z.prototype.emit=function(t,r){return this._eventOutput.emit(t,r)},z.prototype.on=function(t,r){return this._eventOutput.on(t,r)},z.prototype.removeListener=function(t,r){return this._eventOutput.removeListener(t,r)},z.prototype.pipe=function(t){return this._eventOutput.pipe(t)},z.prototype.unpipe=function(t){return this._eventOutput.unpipe(t)};F.patch=function(t){for(var r=arguments,n=new F(t),o=1;o<arguments.length;o++)n.patch(r[o]);return t},F.prototype.patch=function(){for(var t=arguments,r=this,n=this._value,o=0,a;o<arguments.length;o++)for(var i in a=t[o],a)i in n&&a[i]&&a[i].constructor===Object&&n[i]&&n[i].constructor===Object?(n.hasOwnProperty(i)||(n[i]=Object.create(n[i])),r.key(i).patch(a[i]),r.eventOutput&&r.eventOutput.emit('change',{id:i,value:r.key(i).value()})):r.set(i,a[i]);return this},F.prototype.setOptions=F.prototype.patch,F.prototype.key=function(t){var r=new F(this._value[t]);return(!(r._value instanceof Object)||r._value instanceof Array)&&(r._value={}),r},F.prototype.get=function(t){return t?this._value[t]:this._value},F.prototype.getOptions=F.prototype.get,F.prototype.set=function(t,r){var n=this.get(t);return this._value[t]=r,this.eventOutput&&r!==n&&this.eventOutput.emit('change',{id:t,value:r}),this},F.prototype.on=function(){return N.call(this),this.on.apply(this,arguments)},F.prototype.removeListener=function(){return N.call(this),this.removeListener.apply(this,arguments)},F.prototype.pipe=function(){return N.call(this),this.pipe.apply(this,arguments)},F.prototype.unpipe=function(){return N.call(this),this.unpipe.apply(this,arguments)};var Nt=F,Ut={},Dt=[],It=[],Gt=0,Vt=0,Bt=[],jt=Date.now(),Ht=!0,Wt={},Yt=new Ot,Xt={containerType:'div',containerClass:'famous-container',fpsCap:void 0,runLoop:!0,appMode:!0},qt=new Nt(Xt),Zt,Kt;Ut.step=function(){var t=this;Gt++,Vt=Gt;var r=Date.now();if(!(Kt&&r-jt<Kt)){var n=0;Zt=r-jt,jt=r,Yt.emit('prerender');for(var o=It.length;o--;)It.shift()(Gt);for(;Bt.length&&Date.now()-r<10;)Bt.shift().call(t);for(n=0;n<Dt.length;n++)Dt[n].update();Yt.emit('postrender')}},window.requestAnimationFrame(U),window.addEventListener('resize',D,!1),D();Ut.pipe=function(t){return t.subscribe instanceof Function?t.subscribe(Ut):Yt.pipe(t)},Ut.unpipe=function(t){return t.unsubscribe instanceof Function?t.unsubscribe(Ut):Yt.unpipe(t)},Ut.on=function(t,r){return t in Wt||(Wt[t]=Yt.emit.bind(Yt,t),V(t,Wt[t])),Yt.on(t,r)},Ut.emit=function(t,r){return Yt.emit(t,r)},Ut.removeListener=function(t,r){return Yt.removeListener(t,r)},Ut.getFPS=function(){return 1e3/Zt},Ut.setFPSCap=function(t){Kt=nt(1e3/t)},Ut.getOptions=function(t){return qt.getOptions(t)},Ut.setOptions=function(){return qt.setOptions.apply(qt,arguments)},Ut.createContext=function(t){Xt.appMode&&Ut.nextTick(I);var r=!1;t||(t=document.createElement(Xt.containerType),t.classList.add(Xt.containerClass),r=!0);var n=new z(t);return Ut.registerContext(n),r&&B(n,t),n},Ut.registerContext=function(t){return Dt.push(t),t},Ut.getContexts=function(){return Dt},Ut.deregisterContext=function(t){var r=Dt.indexOf(t);0<=r&&Dt.splice(r,1)},Ut.nextTick=function(t){It.push(t)},Ut.defer=function(t){Bt.push(t)},qt.on('change',function(t){'fpsCap'===t.id?Ut.setFPSCap(t.value):'runLoop'===t.id&&!Ht&&t.value&&(Ht=!0,window.requestAnimationFrame(U))});var Qt=Object.freeze({contextWithPerspective:function(t){const r=Ut.createContext();return r.setPerspective(t),r},simpleExtend:j});(function(){}).name||Object.defineProperty(Function.prototype,'name',{get:function(){var t=this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1];return Object.defineProperty(this,'name',{value:t}),t}});var $t=function(t){function r(r){t.call(this),this._={options:{},defaultOptions:{}},j(this._.defaultOptions,{align:[0.5,0.5],origin:[0.5,0.5],transform:new Ct,handler:new Ot}),this.options=r}t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r;var n={options:{},transform:{}};return n.options.set=function(t){this.resetOptions(),this.setOptions(t)},n.options.get=function(){return this._.options},n.transform.set=function(t){this.setOptions({transform:t})},n.transform.get=function(){return this.options.transform},r.prototype.setOptions=function(t){var r=this;for(let n in('undefined'==typeof t||'Object'!=t.constructor.name)&&(t={}),t)kt.prototype[''+n+'From']&&r.modifier[''+n+'From'](t[n]),r._.options[n]=t[n]},r.prototype.resetOptions=function(){this.modifier=new kt,this.set(this.modifier),this.setOptions(this._.defaultOptions)},r.prototype.pipe=function(){const t=Array.prototype.splice.call(arguments,0);return this.options.handler.pipe.apply(this.options.handler,t)},r.prototype.unpipe=function(){const t=Array.prototype.splice.call(arguments,0);return this.options.handler.unpipe.apply(this.options.handler,t)},r.prototype.on=function(){const t=Array.prototype.splice.call(arguments,0);return this.options.handler.on.apply(this.options.handler,t)},r.prototype.off=function(){const t=Array.prototype.splice.call(arguments,0);return this.options.handler.on.apply(this.options.handler,t)},Object.defineProperties(r.prototype,n),r}(wt),Jt='undefined'==typeof window?'undefined'==typeof global?'undefined'==typeof self?{}:self:global:window,er=W(function(t,r){function n(t,r){for(var n=0;n<t;n+=1)r(n)}r.forLength=n,r['default']=n,r.__esModule=!0}),tr=H(er),rr=function(t){function r(r,n,o){t.call(this,{size:o}),this.columns=r,this.rows=n,this.cellNodes=[],'undefined'==typeof this.options.size&&this.setOptions({size:[void 0,void 0]}),tr(this.columns*this.rows,this._createGridCell.bind(this))}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._createGridCell=function(t){const r=t%this.columns,n=nt(t/this.columns);let o=null;'undefined'!=typeof this.options.size[0]&&'undefined'!=typeof this.options.size[1]&&(o=[],o[0]=this.options.size[0]/this.columns,o[1]=this.options.size[1]/this.rows);const a=new kt({align:[0,0],origin:[0,0],size:o?[o[0],o[1]]:[void 0,void 0],transform:ut.translate(r*o[0],n*o[1],0)}),i=new kt({align:[0.5,0.5],origin:[0.5,0.5]});this.cellNodes.push(this.add(a).add(i))},r.prototype.setChildren=function(t){return tr(this.columns*this.rows,function(r){this.cellNodes[r].add(t[r])}.bind(this)),this},r}($t),nr=!('transform'in document.documentElement.style),or=window.devicePixelRatio||1;Y.prototype.on=function(t,r){this._element&&this._element.addEventListener(t,this.eventForwarder),this._eventOutput.on(t,r)},Y.prototype.removeListener=function(t,r){this._eventOutput.removeListener(t,r)},Y.prototype.emit=function(t,r){r&&!r.origin&&(r.origin=this);var n=this._eventOutput.emit(t,r);return n&&r&&r.stopPropagation&&r.stopPropagation(),n},Y.prototype.pipe=function(t){return this._eventOutput.pipe(t)},Y.prototype.unpipe=function(t){return this._eventOutput.unpipe(t)},Y.prototype.render=function(){return this.id};var ar=nr?function(t,r){t.style.webkitTransform=Z(r)}:function(t,r){t.style.transform=Z(r)};var ir=nr?function(t,r){t.style.webkitTransformOrigin=K(r)}:function(t,r){t.style.transformOrigin=K(r)},lr=nr?function(t){t.style.webkitTransform='scale3d(0.0001,0.0001,0.0001)',t.style.opacity=0}:function(t){t.style.transform='scale3d(0.0001,0.0001,0.0001)',t.style.opacity=0};Y.prototype.commit=function(t){var r=this._element;if(r){var n=t.transform,o=t.opacity,a=t.origin,i=t.size;if(!n&&this._matrix)return this._matrix=null,this._opacity=0,void lr(r);if(Q(this._origin,a)&&(this._originDirty=!0),ut.notEquals(this._matrix,n)&&(this._transformDirty=!0),this._invisible&&(this._invisible=!1,this._element.style.display=''),this._opacity!==o&&(this._opacity=o,r.style.opacity=1<=o?'0.999999':o),this._transformDirty||this._originDirty||this._sizeDirty){this._sizeDirty&&(this._sizeDirty=!1),this._originDirty&&(a?(!this._origin&&(this._origin=[0,0]),this._origin[0]=a[0],this._origin[1]=a[1]):this._origin=null,ir(r,this._origin),this._originDirty=!1),n||(n=ut.identity),this._matrix=n;var l=this._size?ut.thenMove(n,[-this._size[0]*a[0],-this._size[1]*a[1],0]):n;ar(r,l),this._transformDirty=!1}}},Y.prototype.cleanup=function(){this._element&&(this._invisible=!0,this._element.style.display='none')},Y.prototype.attach=function(t){this._element=t,X.call(this,t)},Y.prototype.detach=function(){var t=this._element;return t&&(q.call(this,t),this._invisible&&(this._invisible=!1,this._element.style.display='')),this._element=null,t};var sr=Y;$.prototype=Object.create(sr.prototype),$.prototype.constructor=$,$.prototype.elementType='div',$.prototype.elementClass='famous-surface',$.prototype.setAttributes=function(t){var r=this;for(var o in t){if('style'==o)throw new Error('Cannot set styles via "setAttributes" as it will break Famo.us. Use "setProperties" instead.');r.attributes[o]=t[o]}this._attributesDirty=!0},$.prototype.getAttributes=function(){return this.attributes},$.prototype.setProperties=function(t){var r=this;for(var o in t)r.properties[o]=t[o];return this._stylesDirty=!0,this},$.prototype.getProperties=function(){return this.properties},$.prototype.addClass=function(t){return 0>this.classList.indexOf(t)&&(this.classList.push(t),this._classesDirty=!0),this},$.prototype.removeClass=function(t){var r=this.classList.indexOf(t);return 0<=r&&(this._dirtyClasses.push(this.classList.splice(r,1)[0]),this._classesDirty=!0),this},$.prototype.toggleClass=function(t){var r=this.classList.indexOf(t);return 0<=r?this.removeClass(t):this.addClass(t),this},$.prototype.setClasses=function(t){var r=this,n=0,o=[];for(n=0;n<this.classList.length;n++)0>t.indexOf(r.classList[n])&&o.push(r.classList[n]);for(n=0;n<o.length;n++)r.removeClass(o[n]);for(n=0;n<t.length;n++)r.addClass(t[n]);return this},$.prototype.getClassList=function(){return this.classList},$.prototype.setContent=function(t){return this.content!==t&&(this.content=t,this._contentDirty=!0),this},$.prototype.getContent=function(){return this.content},$.prototype.setOptions=function(t){return t.size&&this.setSize(t.size),t.classes&&this.setClasses(t.classes),t.properties&&this.setProperties(t.properties),t.attributes&&this.setAttributes(t.attributes),t.content&&this.setContent(t.content),this},$.prototype.setup=function(t){var r=this,n=t.allocate(this.elementType);if(this.elementClass)if(this.elementClass instanceof Array)for(var o=0;o<this.elementClass.length;o++)n.classList.add(r.elementClass[o]);else n.classList.add(this.elementClass);n.style.display='',this.attach(n),this._opacity=null,this._currentTarget=n,this._stylesDirty=!0,this._classesDirty=!0,this._attributesDirty=!0,this._sizeDirty=!0,this._contentDirty=!0,this._originDirty=!0,this._transformDirty=!0},$.prototype.commit=function(t){this._currentTarget||this.setup(t.allocator);var r=this._currentTarget,n=t.size;if(this._classesDirty){J.call(this,r);for(var o=this.getClassList(),a=0;a<o.length;a++)r.classList.add(o[a]);this._classesDirty=!1,this._trueSizeCheck=!0}if(this._stylesDirty&&(ee.call(this,r),this._stylesDirty=!1,this._trueSizeCheck=!0),this._attributesDirty&&(re.call(this,r),this._attributesDirty=!1,this._trueSizeCheck=!0),this.size){var i=t.size;if(n=[this.size[0],this.size[1]],void 0===n[0]&&(n[0]=i[0]),void 0===n[1]&&(n[1]=i[1]),!0===n[0]||!0===n[1]){if(!0===n[0])if(this._trueSizeCheck||0===this._size[0]){var l=r.offsetWidth;this._size&&this._size[0]!==l&&(this._size[0]=l,this._sizeDirty=!0),n[0]=l}else this._size&&(n[0]=this._size[0]);if(!0===n[1])if(this._trueSizeCheck||0===this._size[1]){var s=r.offsetHeight;this._size&&this._size[1]!==s&&(this._size[1]=s,this._sizeDirty=!0),n[1]=s}else this._size&&(n[1]=this._size[1]);this._trueSizeCheck=!1}}oe(this._size,n)&&(!this._size&&(this._size=[0,0]),this._size[0]=n[0],this._size[1]=n[1],this._sizeDirty=!0),this._sizeDirty&&(this._size&&(r.style.width=this.size&&!0===this.size[0]?'':this._size[0]+'px',r.style.height=this.size&&!0===this.size[1]?'':this._size[1]+'px'),this._eventOutput.emit('resize')),this._contentDirty&&(this.deploy(r),this._eventOutput.emit('deploy'),this._contentDirty=!1,this._trueSizeCheck=!0),sr.prototype.commit.call(this,t)},$.prototype.cleanup=function(t){var r=this,n=0,o=this._currentTarget;this._eventOutput.emit('recall'),this.recall(o),o.style.display='none',o.style.opacity='',o.style.width='',o.style.height='',te.call(this,o),ne.call(this,o);var a=this.getClassList();for(J.call(this,o),n=0;n<a.length;n++)o.classList.remove(a[n]);if(this.elementClass)if(this.elementClass instanceof Array)for(n=0;n<this.elementClass.length;n++)o.classList.remove(r.elementClass[n]);else o.classList.remove(this.elementClass);this.detach(o),this._currentTarget=null,t.deallocate(o)},$.prototype.deploy=function(t){var r=this.getContent();if(r instanceof Node){for(;t.hasChildNodes();)t.removeChild(t.firstChild);t.appendChild(r)}else t.innerHTML=r},$.prototype.recall=function(t){for(var r=document.createDocumentFragment();t.hasChildNodes();)r.appendChild(t.firstChild);this.setContent(r)},$.prototype.getSize=function(){return this._size?this._size:this.size},$.prototype.setSize=function(t){return this.size=t?[t[0],t[1]]:null,this._sizeDirty=!0,this};var dr=$,pr=function(t){function r(r){t.call(this,r),this.surface=new dr(this.options),this.add(this.surface),this.surface.pipe(this.options.handler)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype.getContent=function(){const t=Array.prototype.splice.call(arguments,0);return this.surface.getContent.apply(this.surface,t)},r.prototype.setContent=function(){const t=Array.prototype.splice.call(arguments,0);return this.surface.setContent.apply(this.surface,t)},r}($t),cr=function(t){function r(r){t.call(this,r),this.children=[],this.plane1=new pr(this.options),this.plane1.transform.set(ut.rotate(0,0,0)),this.setOptions({properties:{background:'orange'}}),this.plane2=new pr(this.options),this.plane2.transform.set(ut.rotate(0,Math.PI,0)),this.children.push(this.plane1),this.children.push(this.plane2),this.add(this.plane2),this.add(this.plane1),this.plane1.pipe(this.options.handler),this.plane2.pipe(this.options.handler)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype.getContent=function(){return[this.plane1.getContent(),this.plane2.getContent()]},r.prototype.setContent=function(t){this.plane1.setContent(t[0]),this.plane2.setContent(t[1])},r}($t),_r=function(t){function r(r,n){t.call(this,{size:r}),this.transition=n,this.flipSide=0,this.columnsRows=[7,6],this.planes=[],this._initializeTransitions(),this._createGrid(),setTimeout(function(){this.transitions[this.transition](),setInterval(this.transitions[this.transition],2e3)}.bind(this),800)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._createGrid=function(){const t=new rr(this.columnsRows[0],this.columnsRows[1],this.options.size);tr(this.columnsRows[0]*this.columnsRows[1],function(){const t=new cr({properties:{background:'teal'}});this.planes.push(t)}.bind(this)),t.setChildren(this.planes),this.add(t)},r.prototype._initializeTransitions=function(){this.transitions={flipDiagonal:function(){function t(t,r){'undefined'==typeof t.__targetRotation&&(t.__targetRotation=new bt(0));const n=new bt(t.__targetRotation.get());t.__targetRotation.set(t.__targetRotation.get()+at),t.children[0].get().transformFrom(function(){return ut.rotateY(n.get())}),t.children[1].get().transformFrom(function(){return ut.rotateY(n.get()+at)}),setTimeout(function(){n.set(t.__targetRotation.get(),{duration:2e3,curve:St.outExpo})},0+50*r)}this.flipSide=+!this.flipSide;let r=0,n;this.columnsRows.forEach(function(t,n){t<this.columnsRows[r]&&(r=n)}.bind(this)),n=+!r,tr(this.columnsRows[0]+this.columnsRows[1]-1,function(o){tr(this.columnsRows[r],function(r){if(0<=o-r&&o-r<this.columnsRows[n]){const a=this.planes[o-r+this.columnsRows[n]*r];t(a,o)}}.bind(this))}.bind(this))}.bind(this)}},r}($t),ur=W(function(t,r){function n(t,r){for(var n='',o=0;o<t;o++)n+=' ';return n+r}Object.defineProperty(r,'__esModule',{value:!0}),r.clone=function(t){return a(o(t))},r.isEmptyObject=function(t){for(var r in t)return!1;return!0},r.toCSS=function(t,r){var o=2>=arguments.length||void 0===arguments[2]?{}:arguments[2],a=o.indentationLevel||0,i='';for(var l in!1!==o.selector&&(i+=n(a,t+' {'),a++),r){var s=r[l];if(Array.isArray(s))for(var d=0;d<s.length;d++)i+='\n'+n(a,l+': '+s[d]+';');else i+='\n'+n(a,l+': '+s+';')}return!1!==o.selector&&(i+='\n'+n(--a,'}')),i};var o=JSON.stringify,a=JSON.parse,i=r.uid=function(){var t='undefined'==typeof window?Jt:window,r='__JSS_VERSION_COUNTER__';null==t[r]&&(t[r]=0);var n=t[r]++,o=0;return{get:function(){return'jss-'+n+'-'+o++},reset:function(){o=0}}}(),l=r.findClassNames=function(){var t=/[.]/g,r=/[.][^ ,]+/g;return function(n){var o=n.match(r);return o?o.join(' ').replace(t,''):''}}()}),mr=W(function(t,r){function n(t,r){if(!(t instanceof r))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(r,'__esModule',{value:!0});var o='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&'function'==typeof Symbol&&t.constructor===Symbol?'symbol':typeof t},a=function(){function t(t,r){for(var n=0,o;n<r.length;n++)o=r[n],o.enumerable=o.enumerable||!1,o.configurable=!0,'value'in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}return function(r,n,o){return n&&t(r.prototype,n),o&&t(r,o),r}}(),i=function(){function t(r,o,a){n(this,t),this.id=ur.uid.get(),this.type='regular',this.options=a,this.selectorText=r||'',this.className=a.className||'',this.originalStyle=o,this.style=(0,ur.clone)(o),a.named&&(this.name=r,!this.className&&(this.className=this.name?this.name+'--'+this.id:this.id),this.selectorText='.'+this.className)}return a(t,[{key:'prop',value:function(t,r){var n=this.options.Renderer.style;return null==r?(this.renderable&&null==this.style[t]&&(this.style[t]=n(this.renderable,t)),this.style[t]):(this.style[t]=r,this.renderable&&n(this.renderable,t,r),this)}},{key:'applyTo',value:function(t){var r=this;for(var n in r.style){var o=r.style[n],a=r.options.Renderer.style;if(Array.isArray(o))for(var i=0;i<o.length;i++)a(t,n,o[i]);else a(t,n,o)}return this}},{key:'toJSON',value:function(){var t=this,r=Object.create(null);for(var n in t.style)'object'!=o(t.style[n])&&(r[n]=t.style[n]);return r}},{key:'toString',value:function(t){return(0,ur.toCSS)(this.selector,this.style,t)}},{key:'selector',set:function(){var t=0>=arguments.length||void 0===arguments[0]?'':arguments[0],r=this.options,n=r.Renderer,o=r.sheet;if(o&&o.unregisterRule(this),this.selectorText=t,this.className=(0,ur.findClassNames)(t),!this.renderable)return void(o&&o.registerRule(this));var a=n.setSelector(this.renderable,t);return a?void o.registerRule(this):void(delete this.renderable,o.registerRule(this).deploy().link())},get:function(){return this.renderable?this.options.Renderer.getSelector(this.renderable):this.selectorText}}]),t}();r.default=i}),gr=W(function(t,r){function n(t,r){if(!(t instanceof r))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(r,'__esModule',{value:!0});var o=function(){function t(t,r){for(var n=0,o;n<r.length;n++)o=r[n],o.enumerable=o.enumerable||!1,o.configurable=!0,'value'in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}return function(r,n,o){return n&&t(r.prototype,n),o&&t(r,o),r}}(),a=function(){function t(r,o,a){n(this,t),this.id=ur.uid.get(),this.type='simple',this.name=r,this.value=o,this.options=a}return o(t,[{key:'toString',value:function(){var t=this;if(Array.isArray(this.value)){for(var r='',n=0;n<this.value.length;n++)r+=t.name+' '+t.value[n]+';',t.value[n+1]&&(r+='\n');return r}return this.name+' '+this.value+';'}}]),t}();r.default=a}),yr=W(function(t,r){function n(t,r){if(!(t instanceof r))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(r,'__esModule',{value:!0});var o=Object.assign||function(t){for(var r=arguments,n=1,o;n<arguments.length;n++)for(var a in o=r[n],o)Object.prototype.hasOwnProperty.call(o,a)&&(t[a]=o[a]);return t},a=function(){function t(t,r){for(var n=0,o;n<r.length;n++)o=r[n],o.enumerable=o.enumerable||!1,o.configurable=!0,'value'in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}return function(r,n,o){return n&&t(r.prototype,n),o&&t(r,o),r}}(),i=function(){function t(r,o,a){n(this,t),this.id=ur.uid.get(),this.type='keyframe',this.selector=r,this.options=a,this.frames=this.formatFrames(o)}return a(t,[{key:'formatFrames',value:function(t){var r=this,n=Object.create(null);for(var a in t){var i=o({},r.options,{named:!1,parent:r});n[a]=r.options.jss.createRule(a,t[a],i)}return n}},{key:'toString',value:function(){var t=this,r=this.selector+' {\n',n={indentationLevel:1};for(var o in t.frames)r+=t.frames[o].toString(n)+'\n';return r+='}',r}}]),t}();r.default=i}),fr=W(function(t,r){function n(t,r){if(!(t instanceof r))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(r,'__esModule',{value:!0});var o=Object.assign||function(t){for(var r=arguments,n=1,o;n<arguments.length;n++)for(var a in o=r[n],o)Object.prototype.hasOwnProperty.call(o,a)&&(t[a]=o[a]);return t},a=function(){function t(t,r){for(var n=0,o;n<r.length;n++)o=r[n],o.enumerable=o.enumerable||!1,o.configurable=!0,'value'in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}return function(r,n,o){return n&&t(r.prototype,n),o&&t(r,o),r}}(),i=function(){function t(r,o,a){var i=this;for(var l in n(this,t),this.id=ur.uid.get(),this.type='conditional',this.selector=r,this.options=a,this.rules=Object.create(null),o)i.createRule(l,o[l])}return a(t,[{key:'createRule',value:function(t,r,n){var a=o({},this.options,{parent:this}),i=a,l=i.sheet,s=i.jss,d=l&&l.getRule(t),p=d?d.className:null;(p||n)&&(a=o({},a,{className:p},n));var c=(l||s).createRule(t,r,a);return this.rules[t]=c,c}},{key:'toString',value:function(){var t=this,r=this.selector+' {\n';for(var n in t.rules){var o=t.rules[n];if(!(o.style&&(0,ur.isEmptyObject)(o.style))){var a=o.toString({indentationLevel:1});r+=a+'\n'}}return r+='}',r}}]),t}();r.default=i}),hr=W(function(t,r){function n(t,r){if(!(t instanceof r))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(r,'__esModule',{value:!0});var o=function(){function t(t,r){for(var n=0,o;n<r.length;n++)o=r[n],o.enumerable=o.enumerable||!1,o.configurable=!0,'value'in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}return function(r,n,o){return n&&t(r.prototype,n),o&&t(r,o),r}}(),a=function(){function t(r,o,a){n(this,t),this.id=ur.uid.get(),this.type='font-face',this.options=a,this.selector=r,this.style=o}return o(t,[{key:'toString',value:function(t){var r=this;if(Array.isArray(this.style)){for(var n='',o=0;o<this.style.length;o++)n+=(0,ur.toCSS)(r.selector,r.style[o],t),r.style[o+1]&&(n+='\n');return n}return(0,ur.toCSS)(this.selector,this.style,t)}}]),t}();r.default=a}),vr=W(function(t,r){function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(r,'__esModule',{value:!0}),r.default=function(t){var r=1>=arguments.length||void 0===arguments[1]?{}:arguments[1],n=2>=arguments.length||void 0===arguments[2]?{}:arguments[2];if(t&&'@'===t[0]){var a=p.exec(t)[0],i=d[a];return new i(t,r,n)}return null==n.named&&(n.named=!0),new o.default(t,r,n)};var o=n(mr),a=n(gr),i=n(yr),l=n(fr),s=n(hr),d={"@charset":a.default,"@import":a.default,"@namespace":a.default,"@keyframes":i.default,"@media":l.default,"@supports":l.default,"@font-face":s.default},p=/^@[^ ]+/}),br=W(function(t,r){function n(t,r){if(!(t instanceof r))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(r,'__esModule',{value:!0});var o=function(){function t(t,r){for(var n=0,o;n<r.length;n++)o=r[n],o.enumerable=o.enumerable||!1,o.configurable=!0,'value'in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}return function(r,n,o){return n&&t(r.prototype,n),o&&t(r,o),r}}(),a=function(){function t(r){n(this,t),this.head=document.head||document.getElementsByTagName('head')[0],this.element=r.element||document.createElement('style'),this.element.type='text/css',r.media&&this.element.setAttribute('media',r.media),r.meta&&this.element.setAttribute('data-meta',r.meta)}return o(t,null,[{key:'style',value:function(t,r,n){try{if(null==n)return t.style[r];t.style[r]=n}catch(t){return!1}return!0}},{key:'setSelector',value:function(t,r){return t.selectorText=r,t.selectorText===r}},{key:'getSelector',value:function(t){return t.selectorText}}]),o(t,[{key:'attach',value:function(){this.element.parendNode||this.head.appendChild(this.element)}},{key:'detach',value:function(){this.element.parentNode.removeChild(this.element)}},{key:'deploy',value:function(t){var r='\n'+t.toString()+'\n';'sheet'in this.element?this.element.innerHTML=r:'styleSheet'in this.element&&(this.element.styleSheet.cssText=r)}},{key:'insertRule',value:function(t){var r=this.element.sheet||this.element.styleSheet,n=r.cssRules||r.rules,o=n.length;return r.insertRule?r.insertRule(t.toString(),o):r.addRule(t.selector,t.toString({selector:!1}),o),n[o]}},{key:'getRules',value:function(){for(var t=this.element.sheet||this.element.styleSheet,r=t.rules||t.cssRules,n=Object.create(null),o=0,a;o<r.length;o++)a=r[o],n[a.selectorText]=a;return n}}]),t}();r.default=a}),xr=W(function(t,r){function n(t,r){if(!(t instanceof r))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(r,'__esModule',{value:!0});var o=function(){function t(t,r){for(var n=0,o;n<r.length;n++)o=r[n],o.enumerable=o.enumerable||!1,o.configurable=!0,'value'in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}return function(r,n,o){return n&&t(r.prototype,n),o&&t(r,o),r}}(),a=function(){function t(){n(this,t)}return o(t,[{key:'attach',value:function(){}},{key:'detach',value:function(){}},{key:'deploy',value:function(){}},{key:'insertRule',value:function(){}},{key:'getRules',value:function(){return{}}}],[{key:'style',value:function(){}},{key:'setSelector',value:function(){}},{key:'getSelector',value:function(){}}]),t}();r.default=a}),Sr=W(function(t,r){function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(r,'__esModule',{value:!0}),r.default=function(){var t=0>=arguments.length||void 0===arguments[0]?{}:arguments[0];return t.Renderer?t.Renderer:t.virtual||'undefined'==typeof document?a.default:o.default};var o=n(br),a=n(xr)}),Cr=W(function(t,r){function n(t){return t&&t.__esModule?t:{default:t}}function o(t,r){if(!(t instanceof r))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(r,'__esModule',{value:!0});var a=Object.assign||function(t){for(var r=arguments,n=1,o;n<arguments.length;n++)for(var a in o=r[n],o)Object.prototype.hasOwnProperty.call(o,a)&&(t[a]=o[a]);return t},i=function(){function t(t,r){for(var n=0,o;n<r.length;n++)o=r[n],o.enumerable=o.enumerable||!1,o.configurable=!0,'value'in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}return function(r,n,o){return n&&t(r.prototype,n),o&&t(r,o),r}}(),l=n(vr),s=n(Sr),d=function(){function t(r,n){var i=this;o(this,t),this.options=a({},n),null==this.options.named&&(this.options.named=!0),this.rules=Object.create(null),this.classes=Object.create(null),this.attached=!1,this.deployed=!1,this.linked=!1;var l=(0,s.default)(this.options);for(var d in this.options.Renderer=l,this.renderer=new l(this.options),r)i.createRule(d,r[d])}return i(t,[{key:'attach',value:function(){return this.attached?this:(this.deployed||this.deploy(),this.renderer.attach(),!this.linked&&this.options.link&&this.link(),this.attached=!0,this)}},{key:'detach',value:function(){return this.attached?(this.renderer.detach(),this.attached=!1,this):this}},{key:'addRule',value:function(t,r){var n=this.createRule(t,r);if(this.deployed){var o=this.renderer.insertRule(n);this.options.link&&(n.renderable=o)}return n}},{key:'addRules',value:function(t){var r=this,n=[];for(var o in t)n.push(r.addRule(o,t[o]));return n}},{key:'getRule',value:function(t){return this.rules[t]}},{key:'toString',value:function(t){var r=this.rules,n=Object.create(null),o='';for(var a in r){var i=r[a];n[i.id]||i.style&&(0,ur.isEmptyObject)(i.style)||i.rules&&(0,ur.isEmptyObject)(i.rules)||(o&&(o+='\n'),o+=i.toString(t),n[i.id]=!0)}return o}},{key:'createRule',value:function(t,r,n){n=a({},n,{sheet:this,jss:this.options.jss,Renderer:this.options.Renderer}),null==n.named&&(n.named=this.options.named);var o=(0,l.default)(t,r,n);return this.registerRule(o),n.jss.plugins.run(o),o}},{key:'registerRule',value:function(t){return t.options.parent?(t.name&&t.className&&(this.classes[t.name]=t.className),this):(t.name&&(this.rules[t.name]=t,t.className&&(this.classes[t.name]=t.className)),t.selector&&(this.rules[t.selector]=t),this)}},{key:'unregisterRule',value:function(t){return t.options.parent||(delete this.rules[t.name],delete this.rules[t.selector]),delete this.classes[t.name],this}},{key:'deploy',value:function(){return this.renderer.deploy(this),this.deployed=!0,this}},{key:'link',value:function(){var t=this,r=this.renderer.getRules();for(var n in r){var o=t.rules[n];o&&(o.renderable=r[n])}return this.linked=!0,this}}]),t}();r.default=d}),kr=W(function(t,r){function n(t,r){if(!(t instanceof r))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(r,'__esModule',{value:!0});var o=function(){function t(t,r){for(var n=0,o;n<r.length;n++)o=r[n],o.enumerable=o.enumerable||!1,o.configurable=!0,'value'in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}return function(r,n,o){return n&&t(r.prototype,n),o&&t(r,o),r}}(),a=function(){function t(){n(this,t),this.registry=[]}return o(t,[{key:'use',value:function(t){this.registry.push(t)}},{key:'run',value:function(t){for(var r=this,n=0;n<this.registry.length;n++)r.registry[n](t)}}]),t}();r.default=a}),Tr=W(function(t,r){function n(t,r){if(!(t instanceof r))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(r,'__esModule',{value:!0});var o=function(){function t(t,r){for(var n=0,o;n<r.length;n++)o=r[n],o.enumerable=o.enumerable||!1,o.configurable=!0,'value'in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}return function(r,n,o){return n&&t(r.prototype,n),o&&t(r,o),r}}(),a=function(){function t(){n(this,t),this.registry=[]}return o(t,[{key:'add',value:function(t){this.registry.push(t)}},{key:'toString',value:function(t){return this.registry.map(function(r){return r.toString(t)}).join('\n')}}]),t}();r.default=a}),Pr=W(function(t,r){function n(t){return t&&t.__esModule?t:{default:t}}function o(t,r){if(!(t instanceof r))throw new TypeError('Cannot call a class as a function')}Object.defineProperty(r,'__esModule',{value:!0});var a='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&'function'==typeof Symbol&&t.constructor===Symbol?'symbol':typeof t},i=Object.assign||function(t){for(var r=arguments,n=1,o;n<arguments.length;n++)for(var a in o=r[n],o)Object.prototype.hasOwnProperty.call(o,a)&&(t[a]=o[a]);return t},l=function(){function t(t,r){for(var n=0,o;n<r.length;n++)o=r[n],o.enumerable=o.enumerable||!1,o.configurable=!0,'value'in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}return function(r,n,o){return n&&t(r.prototype,n),o&&t(r,o),r}}(),s=n(Cr),d=n(kr),p=n(Tr),c=n(vr),_=n(Sr),u=function(){function t(){o(this,t),this.sheets=new p.default,this.plugins=new d.default,this.uid=ur.uid,this.version='3.11.1'}return l(t,[{key:'create',value:function(){return new t}},{key:'createStyleSheet',value:function(t,r){var n=new s.default(t,i({},r,{jss:this}));return this.sheets.add(n),n}},{key:'createRule',value:function(t,r,n){'object'==('undefined'==typeof t?'undefined':a(t))&&(n=r,r=t,t=null);var o=(0,c.default)(t,r,i({},n,{jss:this,Renderer:(0,_.default)(n)}));return this.plugins.run(o),o}},{key:'use',value:function(){for(var t=arguments,r=this,n=arguments.length,o=Array(n),a=0;a<n;a++)o[a]=t[a];return o.forEach(function(t){return r.plugins.use(t)}),this}}]),t}();r.default=u}),Rr=W(function(t,r){function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(r,'__esModule',{value:!0}),r.Rule=r.StyleSheet=r.Jss=void 0;var o=n(Pr),a=n(Cr),i=n(mr),l=new o.default;t.exports=r=l,r.Jss=o.default,r.StyleSheet=a.default,r.Rule=i.default,r.default=l}),Er=H(Rr),wr=W(function(t,r){Object.defineProperty(r,'__esModule',{value:!0});var n=Object.assign||function(t){for(var r=arguments,n=1,o;n<arguments.length;n++)for(var a in o=r[n],o)Object.prototype.hasOwnProperty.call(o,a)&&(t[a]=o[a]);return t};r.default=function(){return function(t){if('regular'===t.type){var r=t.options,a=r.sheet,i=r.jss,l=r.parent,s=a||i,d;for(var p in l&&'conditional'===l.type&&(s=l),t.style)if('&'===p[0]){d||(d=n({},t.options,{named:!1}));var c=p.replace(o,t.selector);s.createRule(c,t.style[p],d),delete t.style[p]}}}};var o=/&/g}),Ar=H(wr),Or=W(function(t,r){Object.defineProperty(r,'__esModule',{value:!0}),r.default=function(){function t(r,n,o){if('string'==typeof o.extend){if(r.options&&r.options.sheet){var a=r.options.sheet.getRule(o.extend);a&&t(r,n,a.originalStyle)}}else if(Array.isArray(o.extend))for(var i=0;i<o.extend.length;i++)t(r,n,o.extend[i]);else for(var l in o.extend)'extend'==l?t(r,n,o.extend.extend):n[l]=o.extend[l];for(var s in o)'extend'!=s&&(n[s]=o[s]);return n}return function(r){r.style&&r.style.extend&&(r.style=t(r,{},r.style))}}}),Mr=H(Or),Lr=W(function(t,r){r.__esModule=!0,r['default']=function(){return function(t){var r=t.style;if(r)for(var o in r)n[o]||'number'!=typeof r[o]||(r[o]+='px')}};var n={"animation-iteration-count":!0,"box-ordinal-group":!0,"column-count":!0,"fill-opacity":!0,flex:!0,"flex-grow":!0,"flex-order":!0,"flex-shrink":!0,"font-weight":!0,"line-height":!0,opacity:!0,order:!0,orphans:!0,"stop-opacity":!0,"tab-size":1,widows:!0,"z-index":!0,zoom:!0};t.exports=r['default']}),zr=H(Lr),Fr='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&'function'==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?'symbol':typeof t},Nr='object'===('undefined'==typeof window?'undefined':Fr(window))&&'object'===('undefined'==typeof document?'undefined':Fr(document))&&9===document.nodeType,Ur=Object.freeze({isBrowser:Nr,default:Nr}),Dr=Ur&&Nr||Ur,Ir=W(function(t,r){Object.defineProperty(r,'__esModule',{value:!0});var n=function(t){return t&&t.__esModule?t:{default:t}}(Dr),o='',a='';if(n['default']){var i={Moz:'-moz-',ms:'-ms-',O:'-o-',Webkit:'-webkit-'},l=document.createElement('p').style;for(var s in i)if(s+'Transform'in l){o=s,a=i[s];break}}r['default']={js:o,css:a}}),Gr=W(function(t,r){function n(t,r){return r?r.toUpperCase():''}Object.defineProperty(r,'__esModule',{value:!0}),r['default']=function(t){return t.replace(o,n)};var o=/[-\s]+(.)?/g}),Vr=W(function(t,r){function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(r,'__esModule',{value:!0}),r['default']=function(t){return s?null==l[t]?(l[t]=(0,i['default'])(t)in s.style?t:!!(a['default'].js+(0,i['default'])('-'+t)in s.style)&&a['default'].css+t,l[t]):l[t]:t};var o=n(Dr),a=n(Ir),i=n(Gr),l={},s;if(o['default']){s=document.createElement('p');var d=window.getComputedStyle(document.documentElement,'');for(var p in d)isNaN(p)||(l[d[p]]=d[p])}}),Br=W(function(t,r){function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(r,'__esModule',{value:!0}),r['default']=function(t,r){if(!l)return r;if('string'!=typeof r||!isNaN(parseInt(r,10)))return r;var n=t+r;if(null!=i[n])return i[n];try{l.style[t]=r}catch(t){return i[n]=!1,!1}return''===l.style[t]?(r=a['default'].css+r,'-ms-flex'===r&&(r='-ms-flexbox'),l.style[t]=r,''!==l.style[t]&&(i[n]=r)):i[n]=r,i[n]||(i[n]=!1),l.style[t]='',i[n]};var o=n(Dr),a=n(Ir),i={},l;o['default']&&(l=document.createElement('p'))}),jr=W(function(t,r){function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(r,'__esModule',{value:!0}),r.supportedValue=r.supportedProperty=r.prefix=void 0;var o=n(Ir),a=n(Vr),i=n(Br);r['default']={prefix:o['default'],supportedProperty:a['default'],supportedValue:i['default']},r.prefix=o['default'],r.supportedProperty=a['default'],r.supportedValue=i['default']}),Hr=W(function(t,r){r.__esModule=!0,r['default']=function(){return function(t){if('keyframe'===t.type)return void(t.selector='@'+n.prefix.css+'keyframes'+t.selector.substr(10));if('regular'===t.type)for(var r in t.style){var o=t.style[r],a=!1,i=n.supportedProperty(r);i&&i!==r&&(a=!0);var l=!1,s=n.supportedValue(i,o);s&&s!==o&&(l=!0),(a||l)&&(a&&delete t.style[r],t.style[i||r]=s||o)}}};var n=function(t){if(t&&t.__esModule)return t;var r={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r['default']=t,r}(jr);t.exports=r['default']}),Wr=H(Hr),Yr=W(function(t,r){function n(t){return'-'+t.toLowerCase()}function o(t){var r={};for(var o in t){var i=t[o];o=o.replace(a,n),r[o]=i}return r}Object.defineProperty(r,'__esModule',{value:!0});var a=/([A-Z])/g;r.default=function(){return function(t){var r=t.style;if(r)if(Array.isArray(r))for(var n=0;n<r.length;n++)r[n]=o(r[n]);else t.style=o(r)}}}),Xr=H(Yr),qr=W(function(t,r){Object.defineProperty(r,'__esModule',{value:!0}),r.default=function(){function t(t,r){return t.length>r.length}return function(r){var n=r.style,o=r.type;if(n&&'regular'===o){var a={},i=Object.keys(n).sort(t);for(var l in i)a[i[l]]=n[i[l]];r.style=a}}}}),Zr=H(qr);const Kr=Er.create();Kr.use(Ar()),Kr.use(Mr()),Kr.use(zr()),Kr.use(Wr()),Kr.use(Xr()),Kr.use(Zr());var Qr=Date.now;pe.prototype.track=function(t){this.touchHistory[t.identifier]=[t]};var $r=pe;ce.DEFAULT_OPTIONS={direction:void 0,rails:!1,touchLimit:1,velocitySampleLength:10,scale:1},ce.DIRECTION_X=0,ce.DIRECTION_Y=1;var Jr=8;ce.prototype.setOptions=function(t){return this._optionsManager.setOptions(t)},ce.prototype.getOptions=function(){return this.options};ge.DIRECTION_X=0,ge.DIRECTION_Y=1,ge.DIRECTION_Z=2;var en={};ge.register=function(t){for(var r in t)if(!en[r])en[r]=t[r];else if(en[r]!==t[r])throw new Error('Conflicting sync classes for key: '+r)},ge.prototype.setOptions=function(t){var r=this;for(var n in r._syncs)r._syncs[n].setOptions(t)},ge.prototype.pipeSync=function(t){var r=this._syncs[t];this._eventInput.pipe(r),r.pipe(this._eventOutput)},ge.prototype.unpipeSync=function(t){var r=this._syncs[t];this._eventInput.unpipe(r),r.unpipe(this._eventOutput)},ge.prototype.addSync=function(t){var r=this;if(t instanceof Array)for(var n=0;n<t.length;n++)ye.call(r,t[n]);else if(t instanceof Object)for(var o in t)ye.call(r,o,t[o])};var tn=ge,rn=W(function(t,r){function n(t,r){var n=0;return function(){++n==t&&'function'==typeof r&&r.apply(this,arguments)}}r.callAfter=n,r['default']=n,r.__esModule=!0}),nn=H(rn),on=function(t){function r(r){t.call(this,r),j(this._.defaultOptions,{menuSide:'left',menuWidth:200,menuHintSize:10,pushAreaWidth:40,animationDuration:1e3,animationType:'foldDown',fade:!0,fadeStartColor:'rgba(255,255,255,0)',fadeEndColor:'rgba(255,255,255,1)',blur:!1,blurRadius:5}),this.options=r,this.contentWidth=document.body.clientWidth-this.options.menuHintSize,this.isOpen=!1,this.isOpening=!1,this.isClosing=!1,this.isAnimating=!1,this.isBeingDragged=!1,this.transitionCallback=void 0,tn.register({touch:ce}),this._createComponents(),this._initializeEvents()}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype.setOptions=function(r){t.prototype.setOptions.call(this,r)},r.prototype.resetOptions=function(){t.prototype.resetOptions.call(this)},r.prototype._createComponents=function(){var r=this;this.touchSync=new tn(['touch']),this.alignment='left'==this.options.menuSide?0:1,this.animationTransition=new bt(0),this.mainMol=new t,this.menuMol=new t({size:[this.options.menuWidth,void 0]}),this.menuMol.oldTransform=this.menuMol.transform,this.menuMol.transform=function(){var t=r.animationTransition.get();switch(r.options.animationType){case'foldDown':this.oldTransform.setTranslateX('left'==r.options.menuSide?t*(r.options.menuWidth-r.options.menuHintSize)-(r.options.menuWidth-r.options.menuHintSize):t*-(r.options.menuWidth-r.options.menuHintSize)+(r.options.menuWidth-r.options.menuHintSize));break;case'moveBack':this.oldTransform.setTranslateX('left'==r.options.menuSide?t*(r.options.menuWidth-r.options.menuHintSize)-(r.options.menuWidth-r.options.menuHintSize):t*-(r.options.menuWidth-r.options.menuHintSize)+(r.options.menuWidth-r.options.menuHintSize));}return this.oldTransform.get()}.bind(this.menuMol),this.menuContentMol=new t,this.contentMol=new t({size:[this.contentWidth,void 0]}),this.contentMol.oldTransform=this.contentMol.transform,this.contentMol.transform=function(){var t=r.animationTransition.get();switch(r.options.animationType){case'foldDown':this.oldTransform.setTranslateX('left'==r.options.menuSide?t*(r.options.menuWidth-r.options.menuHintSize)+r.options.menuHintSize:t*-(r.options.menuWidth-r.options.menuHintSize)-r.options.menuHintSize),this.oldTransform.setRotateY('left'==r.options.menuSide?t*at/8:t*-at/8);break;case'moveBack':this.oldTransform.setTranslateX('left'==r.options.menuSide?r.options.menuHintSize:-r.options.menuHintSize),this.oldTransform.setTranslateZ(t*-100);}return this.oldTransform.get()}.bind(this.contentMol),this.menuTouchPlane=new pr({size:[this.options.menuWidth+this.options.pushAreaWidth-this.options.menuHintSize,void 0],properties:{zIndex:'-1000'}}),this.mainMol.setOptions({origin:[this.alignment,0.5],align:[this.alignment,0.5]}),this.menuMol.setOptions({origin:[this.alignment,0.5],align:[this.alignment,0.5]}),this.contentMol.setOptions({origin:[this.alignment,0.5],align:[this.alignment,0.5]}),this.menuTouchPlane.setOptions({origin:[this.alignment,0.5],align:[this.alignment,0.5]}),this.menuContentMol.transform.setTranslateZ(2),this.menuTouchPlane.transform.setTranslateZ(2),this.updateStyles=function(){var t,r;switch(this.options.animationType){case'foldDown':t=this.options.fadeStartColor,r=this.options.fadeEndColor;break;case'moveBack':t=r=this.options.fadeEndColor;}var n={".infamous-fadeLeft":{background:[r,'-moz-linear-gradient(left, '+r+' 0%, '+t+' 100%)','-webkit-gradient(left top, right top, color-stop(0%, '+r+'), color-stop(100%, '+t+'))','-webkit-linear-gradient(left, '+r+' 0%, '+t+' 100%)','-o-linear-gradient(left, '+r+' 0%, '+t+' 100%)','-ms-linear-gradient(left, '+r+' 0%, '+t+' 100%)','linear-gradient(to right, '+r+' 0%, '+t+' 100%)'],filter:'progid:DXImageTransform.Microsoft.gradient( startColorstr=\'#cc000000\', endColorstr=\'#4d000000\', GradientType=1 )'},".infamous-fadeRight":{background:[t,'-moz-linear-gradient(left, '+t+' 0%, '+r+' 100%)','-webkit-gradient(left top, right top, color-stop(0%, '+t+'), color-stop(100%, '+r+'))','-webkit-linear-gradient(left, '+t+' 0%, '+r+' 100%)','-o-linear-gradient(left, '+t+' 0%, '+r+' 100%)','-ms-linear-gradient(left, '+t+' 0%, '+r+' 100%)','linear-gradient(to right, '+t+' 0%, '+r+' 100%)'],filter:'progid:DXImageTransform.Microsoft.gradient( startColorstr=\'#4d000000\', endColorstr=\'#cc000000\', GradientType=1 )'}};this.fadeStylesheet&&this.fadeStylesheet.detach(),this.fadeStylesheet=Kr.createStyleSheet(n),this.fadeStylesheet.attach()},this.options.fade&&(this.updateStyles(),this.fadePlane=new pr({size:[void 0,void 0],classes:['left'==this.options.menuSide?'infamous-fadeRight':'infamous-fadeLeft'],properties:{zIndex:'1000',pointerEvents:'none'}}),this.fadePlane.setOptions({origin:[this.alignment,0.5],align:[this.alignment,0.5]}),this.fadePlane.transform.setTranslateZ(1),this.fadePlane.setOptions({opacity:this.animationTransition}),this.contentMol.add(this.fadePlane)),this.add(this.mainMol),this.mainMol.add(this.contentMol),this.menuMol.add(this.menuTouchPlane),this.menuMol.add(this.menuContentMol),this.mainMol.add(this.menuMol)},r.prototype._initializeEvents=function(){this.options.handler.on('update',function(t){this.isBeingDragged=!0,this._haltAnimation(!0);var r=this.animationTransition.get();switch(this.options.animationType){case'foldDown':this.animationTransition.set(r+t.delta[0]/(this.options.menuWidth-this.options.menuHintSize));break;case'moveBack':this.animationTransition.set(r+t.delta[0]/(this.options.menuWidth-this.options.menuHintSize));}r=this.animationTransition.get(),1<r?this.animationTransition.set(1):0>r&&this.animationTransition.set(0)}.bind(this)),this.options.handler.on('end',function(){this.isBeingDragged=!1;var t=this.animationTransition.get();0.5>t?this.closeMenu():this.openMenu()}.bind(this)),window.addEventListener('resize',function(){this.contentWidth=document.body.clientWidth-this.options.menuHintSize,this.contentMol.setOptions({size:[this.contentWidth,void 0]})}.bind(this)),this.menuTouchPlane.pipe(this.touchSync),this.menuTouchPlane.on('mouseenter',function(){this.isOpening||this.openMenu()}.bind(this)),this.menuTouchPlane.on('mouseleave',function(){this.isClosing||this.closeMenu()}.bind(this)),this.touchSync.pipe(this.options.handler)},r.prototype.setContent=function(t){this.contentMol.add(t)},r.prototype.setMenu=function(r){this.menuContentMol.add(r),r instanceof t&&(r.pipe(this.touchSync),r.on('mouseenter',function(){this.isOpening||this.openMenu()}.bind(this)),r.on('mouseleave',function(){this.isClosing||this.closeMenu()}.bind(this)))},r.prototype.openMenu=function(t,r){this._haltAnimation(r),this.isClosing=!1,this.isOpening=!0,this._animate('open',t)},r.prototype.closeMenu=function(t,r){this._haltAnimation(r),this.isClosing=!0,this.isOpening=!1,this._animate('close',t)},r.prototype.toggleMenu=function(t,r){this.isOpen||this.isOpening?this.closeMenu(t,r):(!this.isOpen||this.isClosing)&&this.openMenu(t,r)},r.prototype._animate=function(t,r){this.isAnimating=!0,this.transitionCallback=r;var n=this,o;(function(r){o=nn(r,function(){n.isAnimating=n.isOpening=n.isClosing=!1,n.isOpen='open'==t,'function'==typeof n.transitionCallback&&n.transitionCallback(),n.transitionCallback=void 0}.bind(n))})(1),'open'==t?this.animationTransition.set(1,{duration:this.options.animationDuration,curve:St.outExpo},o):'close'==t&&this.animationTransition.set(0,{duration:this.options.animationDuration,curve:St.outExpo},o)},r.prototype._haltAnimation=function(t){this.isAnimating&&(!t&&'function'==typeof this.transitionCallback&&this.transitionCallback(),this.transitionCallback=void 0,this.animationTransition.halt())},r.prototype.render=function(){if(this.options.blur&&this.options.fade&&'moveBack'==this.options.animationType){let t=this.animationTransition.get()*this.options.blurRadius,r={"-webkit-filter":'blur('+t+'px)',"-moz-filter":'blur('+t+'px)',"-ms-filter":'blur('+t+'px)',"-o-filter":'blur('+t+'px)',filter:'blur('+t+'px)'};this.contentMol._child[1].get()instanceof dr?this.contentMol.get().setProperties(r):this.contentMol._child[1]instanceof pr&&this.contentMol._child[1].surface.setProperties(r)}return t.prototype.render.call(this)},r}($t);const an=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],ln=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];var sn=null;xe(),xe();var dn=function(t){function r(n){const o=arguments.length;if(0===o)t.call(this,[1,0,0,1,0,0]);else if(1!==o)throw new Error('Wrong number of arguments to DOMMatrix constructor.');else if('string'==typeof n)throw new Error('CSS transformList arg not yet implemented.');else n instanceof r?t.call(this,n._matrix):(n instanceof Float32Array||n instanceof Float64Array||n instanceof Array)&&t.call(this,n)}t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r;var n={a:{},b:{},c:{},d:{},e:{},f:{},m11:{},m12:{},m13:{},m14:{},m21:{},m22:{},m23:{},m24:{},m31:{},m32:{},m33:{},m34:{},m41:{},m42:{},m43:{},m44:{}};return r.prototype.multiplySelf=function(t){if(!(t instanceof r))throw new Error('The argument to multiplySelf must be an instance of DOMMatrix');return fe(this,t,this),t.is2D||(this._is2D=!1),this},r.prototype.preMultiplySelf=function(t){if(!(t instanceof r))throw new Error('The argument to multiplySelf must be an instance of DOMMatrix');return fe(t,this,this),t.is2D||(this._is2D=!1),this},r.prototype.translateSelf=function(t,n,o){if(void 0===o&&(o=0),1===arguments.length)throw new Error('The first two arguments (X and Y translation values) are required (the third, Z translation, is optional).');const a=new r([1,0,0,0,0,1,0,0,0,0,1,0,t,n,o,1]);return this.multiplySelf(a),0!=o&&(this._is2D=!1),this},r.prototype.scaleSelf=function(t,n,o){return void 0===n&&(n=0),void 0===o&&(o=0),this.translateSelf(n,o),this.multiplySelf(new r([t,0,0,t,0,0])),this.translateSelf(-n,-o),this},r.prototype.scale3dSelf=function(t,n,o,a){return void 0===n&&(n=0),void 0===o&&(o=0),void 0===a&&(a=0),this.translateSelf(n,o,a),this.multiplySelf(new r([t,0,0,0,0,t,0,0,0,0,t,0,0,0,0,1])),this.translateSelf(-n,-o,-a),this},r.prototype.scaleNonUniformSelf=function(t,n,o,a,i,l){return void 0===n&&(n=1),void 0===o&&(o=1),void 0===a&&(a=0),void 0===i&&(i=0),void 0===l&&(l=0),this.translateSelf(a,i,l),this.multiplySelf(new r([t,0,0,0,0,n,0,0,0,0,o,0,0,0,0,1])),this.translateSelf(-a,-i,-l),(1!==o||0!==l)&&(this._is2D=!1),this},r.prototype.rotateSelf=function(t,r,n){void 0===r&&(r=0),void 0===n&&(n=0),this.translateSelf(r,n);var o=[0,0,1],a=o[0],i=o[1],l=o[2];return this.rotateAxisAngleSelf(a,i,l,t),this.translateSelf(-r,-n),this},r.prototype.rotateFromVectorSelf=function(){throw new Error('rotateFromVectorSelf is not implemented yet.')},r.prototype.rotateAxisAngleSelf=function(t,n,o,a){const i=new r(ve(t,n,o,a));return this.multiplySelf(i),this},r.prototype.skewXSelf=function(){throw new Error('skewXSelf is not implemented yet.')},r.prototype.skewYSelf=function(){throw new Error('skewYSelf is not implemented yet.')},r.prototype.invertSelf=function(){throw new Error('invertSelf is not implemented yet.')},r.prototype.setMatrixValue=function(){throw new Error('setMatrixValue is not implemented yet.')},n.a.get=function(){return this.m11},n.b.get=function(){return this.m12},n.c.get=function(){return this.m21},n.d.get=function(){return this.m22},n.e.get=function(){return this.m41},n.f.get=function(){return this.m42},n.m11.get=function(){return this._matrix[0]},n.m12.get=function(){return this._matrix[4]},n.m13.get=function(){return this._matrix[8]},n.m14.get=function(){return this._matrix[12]},n.m21.get=function(){return this._matrix[1]},n.m22.get=function(){return this._matrix[5]},n.m23.get=function(){return this._matrix[9]},n.m24.get=function(){return this._matrix[13]},n.m31.get=function(){return this._matrix[2]},n.m32.get=function(){return this._matrix[6]},n.m33.get=function(){return this._matrix[10]},n.m34.get=function(){return this._matrix[14]},n.m41.get=function(){return this._matrix[3]},n.m42.get=function(){return this._matrix[7]},n.m43.get=function(){return this._matrix[11]},n.m44.get=function(){return this._matrix[15]},n.a.set=function(t){this.m11=t},n.b.set=function(t){this.m12=t},n.c.set=function(t){this.m21=t},n.d.set=function(t){this.m22=t},n.e.set=function(t){this.m41=t},n.f.set=function(t){this.m42=t},n.m11.set=function(t){this._matrix[0]=t},n.m12.set=function(t){this._matrix[4]=t},n.m13.set=function(t){this._matrix[8]=t},n.m14.set=function(t){this._matrix[12]=t},n.m21.set=function(t){this._matrix[1]=t},n.m22.set=function(t){this._matrix[5]=t},n.m23.set=function(t){this._matrix[9]=t},n.m24.set=function(t){this._matrix[13]=t},n.m31.set=function(t){this._matrix[2]=t},n.m32.set=function(t){this._matrix[6]=t},n.m33.set=function(t){this._matrix[10]=t},n.m34.set=function(t){this._matrix[14]=t},n.m41.set=function(t){this._matrix[3]=t},n.m42.set=function(t){this._matrix[7]=t},n.m43.set=function(t){this._matrix[11]=t},n.m44.set=function(t){this._matrix[15]=t},Object.defineProperties(r.prototype,n),r}(sn);let pn;const cn=function(t){if(!pn){pn=new WeakMap;let r={};return pn.set(t,r),r}let r=pn.get(t);return void 0===r&&(r={},pn.set(t,r)),r};var _=function(t,r,n,o){if(1===arguments.length){if(!Se(t))throw new TypeError('Expected an object with x, y, z, and w properties');cn(this).x=t.x,cn(this).y=t.y,cn(this).z=t.z,cn(this).w=t.w}else if(4===arguments.length)cn(this).x=t||0,cn(this).y=r||0,cn(this).z=n||0,cn(this).w=o||0;else throw new TypeError('Expected 1 or 4 arguments')},_n={x:{},y:{},z:{},w:{}};_n.x.get=function(){return cn(this).x},_n.y.get=function(){return cn(this).y},_n.z.get=function(){return cn(this).z},_n.w.get=function(){return cn(this).w},_.prototype.matrixTransform=function(){let t=new this.constructor(this);return t},_.fromPoint=function(t){return new this(t)},Object.defineProperties(_.prototype,_n);var un=function(t){function r(){t.apply(this,arguments)}t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r;var n={x:{},y:{},z:{},w:{}};return n.x.set=function(t){cn(this).x=t},n.y.set=function(t){cn(this).y=t},n.z.set=function(t){cn(this).z=t},n.w.set=function(t){cn(this).w=t},Object.defineProperties(r.prototype,n),r}(_);let mn=null;'undefined'==typeof window?'undefined'!=typeof global&&(mn=global):mn=window,mn&&(mn.DOMMatrix=dn,mn.DOMMatrixReadOnly=sn,mn.DOMPoint=un,mn.DOMPointReadOnly=_);const gn=Symbol('instanceofSymbol'),yn=function(t){var r=function(t){function r(r){void 0===r&&(r={}),t.call(this,r)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype.on=function(t,r){if(this._eventMap||(this._eventMap=new Map),this._eventMap.has(t)||this._eventMap.set(t,[]),'function'==typeof r)this._eventMap.get(t).push(r);else throw new Error('Expected a function in callback argument of Observable#on.')},r.prototype.off=function(t,r){if(this._eventMap&&this._eventMap.has(t)){const n=this._eventMap.get(t);-1===n.indexOf(r)||(n.splice(n.indexOf(r),1),0===n.length&&this._eventMap.delete(t),0===this._eventMap.size&&(this._eventMap=null))}},r.prototype.triggerEvent=function(t,r){if(this._eventMap&&this._eventMap.has(t)){const n=this._eventMap.get(t);for(let t=0,o=n.length;t<o;t+=1)n[t](r)}},r}(t);return Object.defineProperty(r,Symbol.hasInstance,{value:function(t){if(this!==r)return Object.getPrototypeOf(r)[Symbol.hasInstance].call(this,t);for(let r=t;r;){const t=Object.getOwnPropertyDescriptor(r,'constructor');if(t&&t.value&&t.value.hasOwnProperty(gn))return!0;r=Object.getPrototypeOf(r)}return!1}}),r[gn]=!0,r},fn=yn(function(){return function(){}}());fn.mixin=yn;var hn=function(t){function r(r,n,o){void 0===r&&(r=0),void 0===n&&(n=0),void 0===o&&(o=0),t.call(this),this._x=r,this._y=n,this._z=o}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r}(fn);Object.defineProperties(hn.prototype,{x:{set:function(t){this._x=t,this.triggerEvent('valuechanged',{x:t})},get:function(){return this._x},configurable:!0,enumerable:!0},y:{set:function(t){this._y=t,this.triggerEvent('valuechanged',{y:t})},get:function(){return this._y},configurable:!0,enumerable:!0},z:{set:function(t){this._z=t,this.triggerEvent('valuechanged',{z:t})},get:function(){return this._z},configurable:!0,enumerable:!0}});let vn=null,bn=null;const xn='function'==typeof Element.prototype.createShadowRoot&&'function'==typeof HTMLContentElement,Sn='function'==typeof Element.prototype.attachShadow&&'function'==typeof HTMLSlotElement;var Cn=Object.freeze({epsilon:function(t){return 1e-6>it(t)?0:t},applyCSSLabel:function(t,r){return 0===t?'0px':'%'===r?100*t+'%':'px'===r?t+'px':void 0},animationFrame:function(){let t=null;const r=new Promise(function(n){return t=n});return window.requestAnimationFrame(t),r},makeLowercaseSetterAliases:Ce,observeChildren:ke,getShadowRootVersion:function(t){if(console.log('getShadowRootVersion'),!t)return null;const r=document.createElement('slot');t.appendChild(r),r.appendChild(document.createElement('div'));const n=r.assignedNodes({flatten:!0});return r.remove(),console.log('hmm',n.length,0<n.length?'v1':'v0'),0<n.length?'v1':'v0'},hasShadowDomV0:xn,hasShadowDomV1:Sn,getAncestorShadowRoot:Pe,traverse:Re});const kn=Symbol('instanceofSymbol'),Tn=function(t){var r=function(t){function r(r){void 0===r&&(r={}),t.call(this,r),this._parent=null,this._children=[]}t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r;var n={parent:{},children:{},childCount:{}};return n.parent.get=function(){return this._parent},n.children.get=function(){return[].concat(this._children)},r.prototype.addChild=function(t){if(!(t instanceof r))throw new TypeError('TreeNode.addChild expects the childNode argument to be a TreeNode instance.');if(t._parent===this)throw new ReferenceError('childNode is already a child of this parent.');return t._parent&&t._parent.removeChild(t),t._parent=this,this._children.push(t),this},r.prototype.addChildren=function(t){var r=this;return t.forEach(function(t){return r.addChild(t)}),this},r.prototype.removeChild=function(t){if(!(t instanceof r))throw new Error('\n TreeNode.removeChild expects the childNode argument to be an\n instance of TreeNode. There should only be TreeNodes in the\n tree.\n ');if(t._parent!==this)throw new ReferenceError('childNode is not a child of this parent.');return t._parent=null,this._children.splice(this._children.indexOf(t),1),this},r.prototype.removeChildren=function(t){var r=this;return t.forEach(function(t){return r.removeChild(t)}),this},r.prototype.removeAllChildren=function(){return this.removeChildren(this._children),this},n.childCount.get=function(){return this._children.length},Object.defineProperties(r.prototype,n),r}(t);return Object.defineProperty(r,Symbol.hasInstance,{value:function(t){if(this!==r)return Object.getPrototypeOf(r)[Symbol.hasInstance].call(this,t);for(let r=t;r;){const t=Object.getOwnPropertyDescriptor(r,'constructor');if(t&&t.value&&t.value.hasOwnProperty(kn))return!0;r=Object.getPrototypeOf(r)}return!1}}),r[kn]=!0,r},Pn=Tn(function(){return function(){}}());Pn.mixin=Tn;var Rn=W(function(t){!function(r){function n(t,r,n,o){var i=r&&r.prototype instanceof a?r:a,l=Object.create(i.prototype),s=new m(o||[]);return l._invoke=p(t,n,s),l}function o(t,r,n){try{return{type:'normal',arg:t.call(r,n)}}catch(t){return{type:'throw',arg:t}}}function a(){}function i(){}function l(){}function s(t){['next','throw','return'].forEach(function(r){t[r]=function(t){return this._invoke(r,t)}})}function d(t){function n(r,a,i,l){var s=o(t[r],t,a);if('throw'===s.type)l(s.arg);else{var d=s.arg,p=d.value;return p&&'object'==typeof p&&h.call(p,'__await')?Promise.resolve(p.__await).then(function(t){n('next',t,i,l)},function(t){n('throw',t,i,l)}):Promise.resolve(p).then(function(t){d.value=t,i(d)},l)}}'object'==typeof r.process&&r.process.domain&&(n=r.process.domain.bind(n));var a;this._invoke=function(t,r){function o(){return new Promise(function(o,a){n(t,r,o,a)})}return a=a?a.then(o,o):o()}}function p(t,r,n){var a=T;return function(i,l){if(a==R)throw new Error('Generator is already running');if(a==E){if('throw'===i)throw l;return y()}for(n.method=i,n.arg=l;;){var s=n.delegate;if(s){var d=c(s,n);if(d){if(d===w)continue;return d}}if('next'===n.method)n.sent=n._sent=n.arg;else if('throw'===n.method){if(a==T)throw a=E,n.arg;n.dispatchException(n.arg)}else'return'===n.method&&n.abrupt('return',n.arg);a=R;var p=o(t,r,n);if('normal'===p.type){if(a=n.done?E:P,p.arg===w)continue;return{value:p.arg,done:n.done}}'throw'===p.type&&(a=E,n.method='throw',n.arg=p.arg)}}}function c(t,r){var n=t.iterator[r.method];if(void 0===n){if(r.delegate=null,'throw'===r.method){if(t.iterator.return&&(r.method='return',r.arg=void 0,c(t,r),'throw'===r.method))return w;r.method='throw',r.arg=new TypeError('The iterator does not provide a \'throw\' method')}return w}var a=o(n,t.iterator,r.arg);if('throw'===a.type)return r.method='throw',r.arg=a.arg,r.delegate=null,w;var i=a.arg;if(!i)return r.method='throw',r.arg=new TypeError('iterator result is not an object'),r.delegate=null,w;if(i.done)r[t.resultName]=i.value,r.next=t.nextLoc,'return'!==r.method&&(r.method='next',r.arg=void 0);else return i;return r.delegate=null,w}function _(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function u(t){var r=t.completion||{};r.type='normal',delete r.arg,t.completion=r}function m(t){this.tryEntries=[{tryLoc:'root'}],t.forEach(_,this),this.reset(!0)}function g(t){if(t){var r=t[x];if(r)return r.call(t);if('function'==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function r(){for(;++n<t.length;)if(h.call(t,n))return r.value=t[n],r.done=!1,r;return r.value=void 0,r.done=!0,r};return o.next=o}}return{next:y}}function y(){return{value:void 0,done:!0}}var f=Object.prototype,h=f.hasOwnProperty,v='function'==typeof Symbol?Symbol:{},x=v.iterator||'@@iterator',S=v.asyncIterator||'@@asyncIterator',C=v.toStringTag||'@@toStringTag',k=r.regeneratorRuntime;if(k)return void(t.exports=k);k=r.regeneratorRuntime=t.exports,k.wrap=n;var T='suspendedStart',P='suspendedYield',R='executing',E='completed',w={},A={};A[x]=function(){return this};var O=Object.getPrototypeOf,M=O&&O(O(g([])));M&&M!==f&&h.call(M,x)&&(A=M);var L=l.prototype=a.prototype=Object.create(A);i.prototype=L.constructor=l,l.constructor=i,l[C]=i.displayName='GeneratorFunction',k.isGeneratorFunction=function(t){var r='function'==typeof t&&t.constructor;return!!r&&(r===i||'GeneratorFunction'===(r.displayName||r.name))},k.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,!(C in t)&&(t[C]='GeneratorFunction')),t.prototype=Object.create(L),t},k.awrap=function(t){return{__await:t}},s(d.prototype),d.prototype[S]=function(){return this},k.AsyncIterator=d,k.async=function(t,r,o,a){var i=new d(n(t,r,o,a));return k.isGeneratorFunction(r)?i:i.next().then(function(t){return t.done?t.value:i.next()})},s(L),L[C]='Generator',L[x]=function(){return this},L.toString=function(){return'[object Generator]'},k.keys=function(t){var r=[];for(var n in t)r.push(n);return r.reverse(),function n(){for(;r.length;){var o=r.pop();if(o in t)return n.value=o,n.done=!1,n}return n.done=!0,n}},k.values=g,m.prototype={constructor:m,reset:function(t){var r=this;if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method='next',this.arg=void 0,this.tryEntries.forEach(u),!t)for(var n in r)'t'===n.charAt(0)&&h.call(r,n)&&!isNaN(+n.slice(1))&&(r[n]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0],r=t.completion;if('throw'===r.type)throw r.arg;return this.rval},dispatchException:function(t){function r(r,n){return l.type='throw',l.arg=t,o.next=r,n&&(o.method='next',o.arg=void 0),!!n}var n=this;if(this.done)throw t;for(var o=this,a=this.tryEntries.length-1;0<=a;--a){var i=n.tryEntries[a],l=i.completion;if('root'===i.tryLoc)return r('end');if(i.tryLoc<=n.prev){var s=h.call(i,'catchLoc'),d=h.call(i,'finallyLoc');if(s&&d){if(n.prev<i.catchLoc)return r(i.catchLoc,!0);if(n.prev<i.finallyLoc)return r(i.finallyLoc)}else if(s){if(n.prev<i.catchLoc)return r(i.catchLoc,!0);}else if(!d)throw new Error('try statement without catch or finally');else if(n.prev<i.finallyLoc)return r(i.finallyLoc)}}},abrupt:function(t,r){for(var n=this,o=this.tryEntries.length-1,a;0<=o;--o)if(a=n.tryEntries[o],a.tryLoc<=n.prev&&h.call(a,'finallyLoc')&&n.prev<a.finallyLoc){var i=a;break}i&&('break'===t||'continue'===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var l=i?i.completion:{};return l.type=t,l.arg=r,i?(this.method='next',this.next=i.finallyLoc,w):this.complete(l)},complete:function(t,r){if('throw'===t.type)throw t.arg;return'break'===t.type||'continue'===t.type?this.next=t.arg:'return'===t.type?(this.rval=this.arg=t.arg,this.method='return',this.next='end'):'normal'===t.type&&r&&(this.next=r),w},finish:function(t){for(var r=this,n=this.tryEntries.length-1,o;0<=n;--n)if(o=r.tryEntries[n],o.finallyLoc===t)return r.complete(o.completion,o.afterLoc),u(o),w},catch:function(t){for(var r=this,n=this.tryEntries.length-1,o;0<=n;--n)if(o=r.tryEntries[n],o.tryLoc===t){var a=o.completion;if('throw'===a.type){var i=a.arg;u(o)}return i}throw new Error('illegal catch attempt')},delegateYield:function(t,r,n){return this.delegate={iterator:g(t),resultName:r,nextLoc:n},'next'===this.method&&(this.arg=void 0),w}}}('object'==typeof Jt?Jt:'object'==typeof window?window:'object'==typeof self?self:Jt)}),En='object'==typeof Jt?Jt:'object'==typeof window?window:'object'==typeof self?self:Jt,g=En.regeneratorRuntime&&0<=Object.getOwnPropertyNames(En).indexOf('regeneratorRuntime'),wn=g&&En.regeneratorRuntime;En.regeneratorRuntime=void 0;if(g)En.regeneratorRuntime=wn;else try{delete En.regeneratorRuntime}catch(t){En.regeneratorRuntime=void 0}var An=function(t){return isNaN(t=+t)?0:(0<t?nt:et)(t)},On=function(t){if(void 0==t)throw TypeError('Can\'t call method on '+t);return t},Mn=!0,Ln=W(function(t){var r=t.exports='undefined'!=typeof window&&window.Math==Math?window:'undefined'!=typeof self&&self.Math==Math?self:Function('return this')();'number'==typeof __g&&(__g=r)}),zn=W(function(t){var r=t.exports={version:'2.4.0'};'number'==typeof __e&&(__e=r)}),Fn=function(t){if('function'!=typeof t)throw TypeError(t+' is not a function!');return t},Nn=function(t,r,n){return(Fn(t),void 0===r)?t:1===n?function(n){return t.call(r,n)}:2===n?function(n,o){return t.call(r,n,o)}:3===n?function(n,o,a){return t.call(r,n,o,a)}:function(){return t.apply(r,arguments)}},Un=function(t){return'object'==typeof t?null!==t:'function'==typeof t},Dn=function(t){if(!Un(t))throw TypeError(t+' is not an object!');return t},In=function(t){try{return!!t()}catch(t){return!0}},Gn=!In(function(){return 7!=Object.defineProperty({},'a',{get:function(){return 7}}).a}),Vn=Ln.document,Bn=Un(Vn)&&Un(Vn.createElement),jn=function(t){return Bn?Vn.createElement(t):{}},Hn=!Gn&&!In(function(){return 7!=Object.defineProperty(jn('div'),'a',{get:function(){return 7}}).a}),Wn=function(t,r){if(!Un(t))return t;var n,o;if(r&&'function'==typeof(n=t.toString)&&!Un(o=n.call(t)))return o;if('function'==typeof(n=t.valueOf)&&!Un(o=n.call(t)))return o;if(!r&&'function'==typeof(n=t.toString)&&!Un(o=n.call(t)))return o;throw TypeError('Can\'t convert object to primitive value')},Yn=Object.defineProperty,Xn=Gn?Object.defineProperty:function(t,r,n){if(Dn(t),r=Wn(r,!0),Dn(n),Hn)try{return Yn(t,r,n)}catch(t){}if('get'in n||'set'in n)throw TypeError('Accessors not supported!');return'value'in n&&(t[r]=n.value),t},qn={f:Xn},Zn=function(t,r){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:r}},Kn=Gn?function(t,r,n){return qn.f(t,r,Zn(1,n))}:function(t,r,n){return t[r]=n,t},Qn='prototype',$n=function(t,r,n){var o=t&$n.F,a=t&$n.G,i=t&$n.S,l=t&$n.P,s=t&$n.B,d=t&$n.W,p=a?zn:zn[r]||(zn[r]={}),c=p[Qn],_=a?Ln:i?Ln[r]:(Ln[r]||{})[Qn],u,m,g;for(u in a&&(n=r),n)(m=!o&&_&&void 0!==_[u],!(m&&u in p))&&(g=m?_[u]:n[u],p[u]=a&&'function'!=typeof _[u]?n[u]:s&&m?Nn(g,Ln):d&&_[u]==g?function(t){var r=function(r,n,o){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(r);case 2:return new t(r,n);}return new t(r,n,o)}return t.apply(this,arguments)};return r[Qn]=t[Qn],r}(g):l&&'function'==typeof g?Nn(Function.call,g):g,l&&((p.virtual||(p.virtual={}))[u]=g,t&$n.R&&c&&!c[u]&&Kn(c,u,g)))};$n.F=1,$n.G=2,$n.S=4,$n.P=8,$n.B=16,$n.W=32,$n.U=64,$n.R=128;var Jn=$n,eo={}.hasOwnProperty,to=function(t,r){return eo.call(t,r)},ro={},no={}.toString,oo=function(t){return no.call(t).slice(8,-1)},ao=Object('z').propertyIsEnumerable(0)?Object:function(t){return'String'==oo(t)?t.split(''):Object(t)},io=function(t){return ao(On(t))},lo=function(t){return 0<t?Je(An(t),9007199254740991):0},so=function(t,r){return t=An(t),0>t?tt(t+r,0):Je(t,r)},po='__core-js_shared__',co=Ln[po]||(Ln[po]={}),_o=function(t){return co[t]||(co[t]={})},uo=0,mo=Math.random(),go=function(t){return'Symbol('.concat(void 0===t?'':t,')_',(++uo+mo).toString(36))},yo=_o('keys'),fo=function(t){return yo[t]||(yo[t]=go(t))},ho=function(t){return function(r,n,o){var a=io(r),i=lo(a.length),l=so(o,i),s;if(t&&n!=n){for(;i>l;)if(s=a[l++],s!=s)return!0;}else for(;i>l;l++)if((t||l in a)&&a[l]===n)return t||l||0;return!t&&-1}}(!1),vo=fo('IE_PROTO'),bo=function(t,r){var n=io(t),o=0,a=[],i;for(i in n)i!=vo&&to(n,i)&&a.push(i);for(;r.length>o;)to(n,i=r[o++])&&(~ho(a,i)||a.push(i));return a},xo=['constructor','hasOwnProperty','isPrototypeOf','propertyIsEnumerable','toLocaleString','toString','valueOf'],So=Object.keys||function(t){return bo(t,xo)},Co=Gn?Object.defineProperties:function(t,r){Dn(t);for(var n=So(r),o=n.length,a=0,i;o>a;)qn.f(t,i=n[a++],r[i]);return t},ko=Ln.document&&document.documentElement,To=fo('IE_PROTO'),Po=function(){},Ro='prototype',Eo=function(){var t=jn('iframe'),r=xo.length,n='<',o='>',a;for(t.style.display='none',ko.appendChild(t),t.src='javascript:',a=t.contentWindow.document,a.open(),a.write(n+'script'+o+'document.F=Object'+n+'/script'+o),a.close(),Eo=a.F;r--;)delete Eo[Ro][xo[r]];return Eo()},wo=Object.create||function(t,r){var n;return null===t?n=Eo():(Po[Ro]=Dn(t),n=new Po,Po[Ro]=null,n[To]=t),void 0===r?n:Co(n,r)},Ao=W(function(t){var r=_o('wks'),n=Ln.Symbol,o='function'==typeof n,a=t.exports=function(t){return r[t]||(r[t]=o&&n[t]||(o?n:go)('Symbol.'+t))};a.store=r}),Oo=qn.f,Mo=Ao('toStringTag'),Lo=function(t,r,n){t&&!to(t=n?t:t.prototype,Mo)&&Oo(t,Mo,{configurable:!0,value:r})},zo={};Kn(zo,Ao('iterator'),function(){return this});var Fo=function(t,r,n){t.prototype=wo(zo,{next:Zn(1,n)}),Lo(t,r+' Iterator')},No=function(t){return Object(On(t))},Uo=fo('IE_PROTO'),Do=Object.prototype,Io=Object.getPrototypeOf||function(t){return t=No(t),to(t,Uo)?t[Uo]:'function'==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?Do:null},Go=Ao('iterator'),Vo=!([].keys&&'next'in[].keys()),Bo='keys',jo='values',Ho=function(){return this},Wo=function(t,r,n,o,a,i,l){Fo(n,r,o);var s=function(t){return!Vo&&t in _?_[t]:t===Bo?function(){return new n(this,t)}:t===jo?function(){return new n(this,t)}:function(){return new n(this,t)}},d=r+' Iterator',p=a==jo,c=!1,_=t.prototype,u=_[Go]||_['@@iterator']||a&&_[a],m=u||s(a),g=a?p?s('entries'):m:void 0,y='Array'==r?_.entries||u:u,f,h,v;if(y&&(v=Io(y.call(new t)),v!==Object.prototype&&(Lo(v,d,!0),!Mn)),p&&u&&u.name!==jo&&(c=!0,m=function(){return u.call(this)}),l&&(Vo||c||!_[Go])&&Kn(_,Go,m),ro[r]=m,ro[d]=Ho,a)if(f={values:p?m:s(jo),keys:i?m:s(Bo),entries:g},l)for(h in f)h in _||Kn(_,h,f[h]);else Jn(Jn.P+Jn.F*(Vo||c),r,f);return f},Yo=function(t){return function(r,n){var o=On(r)+'',s=An(n),i=o.length,l,a;return 0>s||s>=i?t?'':void 0:(l=o.charCodeAt(s),55296>l||56319<l||s+1===i||56320>(a=o.charCodeAt(s+1))||57343<a?t?o.charAt(s):l:t?o.slice(s,s+2):(l-55296<<10)+(a-56320)+65536)}}(!0);Wo(String,'String',function(t){this._t=t+'',this._i=0},function(){var t=this._t,r=this._i,n;return r>=t.length?{value:void 0,done:!0}:(n=Yo(t,r),this._i+=n.length,{value:n,done:!1})});var Xo=function(){},qo=function(t,r){return{value:r,done:!!t}},Zo=Wo(Array,'Array',function(t,r){this._t=io(t),this._i=0,this._k=r},function(){var t=this._t,r=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,qo(1)):'keys'==r?qo(0,n):'values'==r?qo(0,t[n]):qo(0,[n,t[n]])},'values');ro.Arguments=ro.Array,Xo('keys'),Xo('values'),Xo('entries');for(var Ko=Ao('toStringTag'),Qo=['NodeList','DOMTokenList','MediaList','StyleSheetList','CSSRuleList'],$o=0;5>$o;$o++){var i=Qo[$o],Jo=Ln[i],ea=Jo&&Jo.prototype;ea&&!ea[Ko]&&Kn(ea,Ko,i),ro[i]=ro.Array}var ta=Ao('toStringTag'),ra='Arguments'==oo(function(){return arguments}()),na=function(t,r){try{return t[r]}catch(t){}},oa=function(t){var r,n,o;return void 0===t?'Undefined':null===t?'Null':'string'==typeof(n=na(r=Object(t),ta))?n:ra?oo(r):'Object'==(o=oo(r))&&'function'==typeof r.callee?'Arguments':o},aa=function(t,r,n,o){if(!(t instanceof r)||void 0!==o&&o in t)throw TypeError(n+': incorrect invocation!');return t},ia=function(t,r,n,o){try{return o?r(Dn(n)[0],n[1]):r(n)}catch(r){var a=t['return'];throw void 0!==a&&Dn(a.call(t)),r}},la=Ao('iterator'),sa=Array.prototype,da=function(t){return void 0!==t&&(ro.Array===t||sa[la]===t)},pa=Ao('iterator'),ca=zn.getIteratorMethod=function(t){if(void 0!=t)return t[pa]||t['@@iterator']||ro[oa(t)]},_a=W(function(t){var r={},n={},o=t.exports=function(t,o,a,i,l){var s=l?function(){return t}:ca(t),d=Nn(a,i,o?2:1),p=0,c,_,u,m;if('function'!=typeof s)throw TypeError(t+' is not iterable!');if(da(s)){for(c=lo(t.length);c>p;p++)if(m=o?d(Dn(_=t[p])[0],_[1]):d(t[p]),m===r||m===n)return m;}else for(u=s.call(t);!(_=u.next()).done;)if(m=ia(u,d,_.value,o),m===r||m===n)return m};o.BREAK=r,o.RETURN=n}),ua=Ao('species'),ma=function(t,r){var n=Dn(t).constructor,o;return void 0===n||void 0==(o=Dn(n)[ua])?r:Fn(o)},ga=function(t,r,n){var o=void 0===n;switch(r.length){case 0:return o?t():t.call(n);case 1:return o?t(r[0]):t.call(n,r[0]);case 2:return o?t(r[0],r[1]):t.call(n,r[0],r[1]);case 3:return o?t(r[0],r[1],r[2]):t.call(n,r[0],r[1],r[2]);case 4:return o?t(r[0],r[1],r[2],r[3]):t.call(n,r[0],r[1],r[2],r[3]);}return t.apply(n,r)},ya=Ln.process,fa=Ln.setImmediate,ha=Ln.clearImmediate,va=Ln.MessageChannel,ba=0,xa={},Sa='onreadystatechange',Ca=function(){var t=+this;if(xa.hasOwnProperty(t)){var r=xa[t];delete xa[t],r()}},ka=function(t){Ca.call(t.data)},Ta,Pa,Ra;fa&&ha||(fa=function(t){for(var r=arguments,n=[],o=1;arguments.length>o;)n.push(r[o++]);return xa[++ba]=function(){ga('function'==typeof t?t:Function(t),n)},Ta(ba),ba},ha=function(t){delete xa[t]},'process'==oo(ya)?Ta=function(t){ya.nextTick(Nn(Ca,t,1))}:va?(Pa=new va,Ra=Pa.port2,Pa.port1.onmessage=ka,Ta=Nn(Ra.postMessage,Ra,1)):Ln.addEventListener&&'function'==typeof postMessage&&!Ln.importScripts?(Ta=function(t){Ln.postMessage(t+'','*')},Ln.addEventListener('message',ka,!1)):Sa in jn('script')?Ta=function(t){ko.appendChild(jn('script'))[Sa]=function(){ko.removeChild(this),Ca.call(t)}}:Ta=function(t){setTimeout(Nn(Ca,t,1),0)});var Ea={set:fa,clear:ha},wa=Ea.set,Aa=Ln.MutationObserver||Ln.WebKitMutationObserver,Oa=Ln.process,Ma=Ln.Promise,La='process'==oo(Oa),za=Ao('species'),Fa=Ao('iterator'),Na=!1;try{var Ua=[7][Fa]();Ua['return']=function(){Na=!0},Array.from(Ua,function(){throw 2})}catch(t){}var Da=Ea.set,Ia=function(){var t=function(){var t,a;for(La&&(t=Oa.domain)&&t.exit();r;){a=r.fn,r=r.next;try{a()}catch(t){throw r?o():n=void 0,t}}n=void 0,t&&t.enter()},r,n,o;if(La)o=function(){Oa.nextTick(t)};else if(Aa){var a=!0,i=document.createTextNode('');new Aa(t).observe(i,{characterData:!0}),o=function(){i.data=a=!a}}else if(Ma&&Ma.resolve){var l=Ma.resolve();o=function(){l.then(t)}}else o=function(){wa.call(Ln,t)};return function(t){var a={fn:t,next:void 0};n&&(n.next=a),r||(r=a,o()),n=a}}(),Ga='Promise',Va=Ln.TypeError,Ba=Ln.process,ja=Ln[Ga],Ba=Ln.process,Ha='process'==oa(Ba),Wa=function(){},Ya=!!function(){try{var t=ja.resolve(1),r=(t.constructor={})[Ao('species')]=function(t){t(Wa,Wa)};return(Ha||'function'==typeof PromiseRejectionEvent)&&t.then(Wa)instanceof r}catch(t){}}(),Xa=function(t,r){return t===r||t===ja&&r===ii},qa=function(t){var r;return Un(t)&&'function'==typeof(r=t.then)&&r},Za=function(t){return Xa(ja,t)?new Ka(t):new ai(t)},Ka=ai=function(t){var r,n;this.promise=new t(function(t,o){if(void 0!=r||void 0!=n)throw Va('Bad Promise constructor');r=t,n=o}),this.resolve=Fn(r),this.reject=Fn(n)},Qa=function(t){try{t()}catch(t){return{error:t}}},$a=function(t,r){if(!t._n){t._n=!0;var n=t._c;Ia(function(){for(var o=t._v,a=1==t._s,l=0,i=function(r){var n=a?r.ok:r.fail,i=r.resolve,l=r.reject,s=r.domain,d,p;try{n?(!a&&(2==t._h&&ti(t),t._h=1),!0===n?d=o:(s&&s.enter(),d=n(o),s&&s.exit()),d===r.promise?l(Va('Promise-chain cycle')):(p=qa(d))?p.call(d,i,l):i(d)):l(o)}catch(t){l(t)}};n.length>l;)i(n[l++]);t._c=[],t._n=!1,r&&!t._h&&Ja(t)})}},Ja=function(t){Da.call(Ln,function(){var r=t._v,n,o,a;if(ei(t)&&(n=Qa(function(){Ha?Ba.emit('unhandledRejection',r,t):(o=Ln.onunhandledrejection)?o({promise:t,reason:r}):(a=Ln.console)&&a.error&&a.error('Unhandled promise rejection',r)}),t._h=Ha||ei(t)?2:1),t._a=void 0,n)throw n.error})},ei=function(t){if(1==t._h)return!1;for(var r=t._a||t._c,n=0,o;r.length>n;)if(o=r[n++],o.fail||!ei(o.promise))return!1;return!0},ti=function(t){Da.call(Ln,function(){var r;Ha?Ba.emit('rejectionHandled',t):(r=Ln.onrejectionhandled)&&r({promise:t,reason:t._v})})},ri=function(t){var r=this;r._d||(r._d=!0,r=r._w||r,r._v=t,r._s=2,!r._a&&(r._a=r._c.slice()),$a(r,!0))},ni=function(t){var r=this,n;if(!r._d){r._d=!0,r=r._w||r;try{if(r===t)throw Va('Promise can\'t be resolved itself');(n=qa(t))?Ia(function(){var o={_w:r,_d:!1};try{n.call(t,Nn(ni,o,1),Nn(ri,o,1))}catch(t){ri.call(o,t)}}):(r._v=t,r._s=1,$a(r,!1))}catch(t){ri.call({_w:r,_d:!1},t)}}},oi,ai,ii;Ya||(ja=function(t){aa(this,ja,Ga,'_h'),Fn(t),oi.call(this);try{t(Nn(ni,this,1),Nn(ri,this,1))}catch(t){ri.call(this,t)}},oi=function(){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},oi.prototype=function(t,r,n){for(var o in r)n&&t[o]?t[o]=r[o]:Kn(t,o,r[o]);return t}(ja.prototype,{then:function(t,r){var n=Za(ma(this,ja));return n.ok='function'!=typeof t||t,n.fail='function'==typeof r&&r,n.domain=Ha?Ba.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&$a(this,!1),n.promise},catch:function(t){return this.then(void 0,t)}}),Ka=function(){var t=new oi;this.promise=t,this.resolve=Nn(ni,t,1),this.reject=Nn(ri,t,1)}),Jn(Jn.G+Jn.W+Jn.F*!Ya,{Promise:ja}),Lo(ja,Ga),function(t){var r='function'==typeof zn[t]?zn[t]:Ln[t];Gn&&r&&!r[za]&&qn.f(r,za,{configurable:!0,get:function(){return this}})}(Ga),ii=zn[Ga],Jn(Jn.S+Jn.F*!Ya,Ga,{reject:function(t){var r=Za(this),n=r.reject;return n(t),r.promise}}),Jn(Jn.S+Jn.F*Mn,Ga,{resolve:function(t){if(t instanceof ja&&Xa(t.constructor,this))return t;var r=Za(this),n=r.resolve;return n(t),r.promise}}),Jn(Jn.S+Jn.F*!(Ya&&function(t,r){if(!r&&!Na)return!1;var n=!1;try{var o=[7],a=o[Fa]();a.next=function(){return{done:n=!0}},o[Fa]=function(){return a},t(o)}catch(t){}return n}(function(t){ja.all(t)['catch'](Wa)})),Ga,{all:function(t){var r=this,n=Za(r),o=n.resolve,a=n.reject,i=Qa(function(){var n=[],i=0,l=1;_a(t,!1,function(t){var s=i++,d=!1;n.push(void 0),l++,r.resolve(t).then(function(t){d||(d=!0,n[s]=t,--l||o(n))},a)}),--l||o(n)});return i&&a(i.error),n.promise},race:function(t){var r=this,n=Za(r),o=n.reject,a=Qa(function(){_a(t,!1,function(t){r.resolve(t).then(n.resolve,o)})});return a&&o(a.error),n.promise}});var li=zn.Promise,si=W(function(t){t.exports={default:li,__esModule:!0}}),di=W(function(t,r){r.__esModule=!0;var n=function(t){return t&&t.__esModule?t:{default:t}}(si);r.default=function(t){return function(){var r=t.apply(this,arguments);return new n.default(function(t,o){function a(i,l){try{var s=r[i](l),d=s.value}catch(t){return void o(t)}return s.done?void t(d):n.default.resolve(d).then(function(t){a('next',t)},function(t){a('throw',t)})}return a('next')})}}}),pi=W(function(t,r){function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(r,'__esModule',{value:!0});var o=n(Rn),a=n(si),i=n(di);r.default=function(){var t=(0,i.default)(o.default.mark(function t(){return o.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if('loading'!==document.readyState){t.next=3;break}return t.next=3,new a.default(function(t){document.addEventListener('DOMContentLoaded',t)});case 3:case'end':return t.stop();}},t,this)}));return function(){return t.apply(this,arguments)}}()}),ci=H(pi);let _i=new WeakMap;const ui={cross:function(t,r){return[t[1]*r[2]-t[2]*r[1],t[2]*r[0]-t[0]*r[2],t[0]*r[1]-t[1]*r[0]]},subtract:function(t,r){return[t[0]-r[0],t[1]-r[1],t[2]-r[2]]},add:function(t,r){return[t[0]+r[0],t[1]+r[1],t[2]+r[2]]},normalize:function(t){const r=st(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);return 1e-5<r?[t[0]/r,t[1]/r,t[2]/r]:[0,0,0]}};var mi=function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];(n=this)._init.apply(n,t);var n},gi={color:{}};mi.prototype._init=function(){this.verts=null,this.normals=null,this._colors=null,this._color=null,this._calcVerts(),this.color=[0.5,0.5,0.5]},gi.color.set=function(t){if(!t)return;this._color=t;let r=null;r='string'==typeof t?t.trim().split(' ').map(function(t){return parseFloat(t)}):t;const n=this.verts.length,o=n+n/3,a=this._colors=new Float32Array(o);for(let n=0;n<o;n+=4)a[n+0]=r[0],a[n+1]=r[1],a[n+2]=r[2],a[n+3]='undefined'==typeof r[3]?1:r[3]},gi.color.get=function(){return this._color},Object.defineProperties(mi.prototype,gi);var yi=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._init=function(r,n){this.width=r,this.height=n,t.prototype._init.call(this)},r.prototype._calcVerts=function(){var t=this,r=t.width,n=t.height;const o=this.verts=new Float32Array([-r/2,0,0,r/2,0,0,0,n,0]),a=[0,0,1],s=this.normals=new Float32Array(o.length);for(let t=0,r=o.length;t<r;t+=3)s[t+0]=a[0],s[t+1]=a[1],s[t+2]=a[2]},r}(mi),fi=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._init=function(r,n,o){this.baseWidth=r,this.topWidth=n,this.height=o,t.prototype._init.call(this)},r.prototype._calcVerts=function(){var t=this,r=t.baseWidth,n=t.topWidth,o=t.height;const a=this.verts=new Float32Array([-r/2,0,0,r/2,0,0,n/2,o,0,n/2,o,0,-n/2,o,0,-r/2,0,0]),s=[0,0,1],d=this.normals=new Float32Array(a.length);for(let t=0,r=a.length;t<r;t+=3)d[t+0]=s[0],d[t+1]=s[1],d[t+2]=s[2]},r}(mi),hi=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._init=function(r,n){this.width=r,this.height=n,t.prototype._init.call(this)},r.prototype._calcVerts=function(){var t=this,r=t.width,n=t.height;const o=this.verts=new Float32Array([-r/2,-n/2,0,r/2,-n/2,0,r/2,n/2,0,r/2,n/2,0,-r/2,n/2,0,-r/2,-n/2,0]),a=[0,0,1],s=this.normals=new Float32Array(o.length);for(let t=0,r=o.length;t<r;t+=3)s[t+0]=a[0],s[t+1]=a[1],s[t+2]=a[2]},r}(mi),vi=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._init=function(r,n,o){this.x=r,this.y=n,this.width=o,t.prototype._init.call(this)},r.prototype._calcVerts=function(){var t=this,r=t.x,n=t.y,o=t.width;const a=r+o,i=n+o,s=this.verts=new Float32Array([r,n,0,a,n,0,a,i,0,a,i,0,r,i,0,r,n,0,r,n,0,r,n,-o,r,i,-o,r,i,-o,r,i,0,r,n,0,a,n,0,a,n,-o,a,i,-o,a,i,-o,a,i,0,a,n,0,r,n,-o,a,n,-o,a,i,-o,a,i,-o,r,i,-o,r,n,-o,r,n,0,r,n,-o,a,n,-o,a,n,-o,a,n,0,r,n,0,r,i,0,r,i,-o,a,i,-o,a,i,-o,a,i,0,r,i,0]),d=[[0,0,1],[-1,0,0],[1,0,0],[0,0,-1],[0,-1,0],[0,1,0]],p=this.normals=new Float32Array(s.length);for(let t=0,r=0,n=s.length;r<n;r+=18,t+=1)p[r+0]=d[t][0],p[r+1]=d[t][1],p[r+2]=d[t][2],p[r+3]=d[t][0],p[r+4]=d[t][1],p[r+5]=d[t][2],p[r+6]=d[t][0],p[r+7]=d[t][1],p[r+8]=d[t][2],p[r+9]=d[t][0],p[r+10]=d[t][1],p[r+11]=d[t][2],p[r+12]=d[t][0],p[r+13]=d[t][1],p[r+14]=d[t][2],p[r+15]=d[t][0],p[r+16]=d[t][1],p[r+17]=d[t][2]},r}(mi),bi=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._init=function(){t.prototype._init.call(this)},r.prototype._calcVerts=function(){this.verts=new Float32Array([-100,0.087303,-100,100,0.087303,-100,100,0.087303,100,-100,0.087303,100,100,0.087303,100,100,0.087303,-100,0,200.087,0,100,0.087303,-100,-100,0.087303,-100,0,200.087,0,-100,0.087303,-100,-100,0.087303,100,0,200.087,0,-100,0.087303,100,100,0.087303,100,0,200.087,0]),this.normals=new Float32Array([0,-1,0,0,-1,0,0,-1,0,0,-1,0,0.894427,0.447214,0,0.894427,0.447214,0,0.894427,0.447214,0,0,0.447214,-0.894427,0,0.447214,-0.894427,0,0.447214,-0.894427,-0.894427,0.447214,0,-0.894427,0.447214,0,-0.894427,0.447214,0,0,0.447214,0.894427,0,0.447214,0.894427,0,0.447214,0.894427])},r}(mi);const xi={identity:Object.freeze([1,0,0,0,1,0,0,0,1]),translation:function(t,r){return[1,0,0,0,1,0,t,r,1]},rotation:function(t){const r=ct(t),n=pt(t);return[r,-n,0,n,r,0,0,0,1]},scaling:function(t,r){return[t,0,0,0,r,0,0,0,1]},projection:function(t,r){let n=xi.identity;return n=xi.multiply(xi.scaling(1/t,1/r),n),n=xi.multiply(xi.scaling(2,2),n),n=xi.multiply(xi.translation(-1,-1),n),n=xi.multiply(xi.scaling(1,-1),n),n},multiply:function(t,r){const n=t[0],o=t[1],a=t[2],i=t[3],l=t[4],s=t[5],d=t[6],p=t[7],c=t[8],_=r[0],u=r[1],m=r[2],g=r[3],y=r[4],f=r[5],h=r[6],v=r[7],x=r[8];return[_*n+u*i+m*d,_*o+u*l+m*p,_*a+u*s+m*c,g*n+y*i+f*d,g*o+y*l+f*p,g*a+y*s+f*c,h*n+v*i+x*d,h*o+v*l+x*p,h*a+v*s+x*c]}},Si={identity:Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),translation:function(t,r,n){return[1,0,0,0,0,1,0,0,0,0,1,0,t,r,n,1]},xRotation:function(t){const r=Ue(t),n=ct(r),o=pt(r);return[1,0,0,0,0,n,o,0,0,-o,n,0,0,0,0,1]},yRotation:function(t){const r=Ue(t),n=ct(r),o=pt(r);return[n,0,-o,0,0,1,0,0,o,0,n,0,0,0,0,1]},zRotation:function(t){const r=Ue(t),n=ct(r),o=pt(r);return[n,-o,0,0,o,n,0,0,0,0,1,0,0,0,0,1]},scaling:function(t,r,n){return[t,0,0,0,0,r,0,0,0,0,n,0,0,0,0,1]},inverse:function(t){const r=t[0],n=t[1],o=t[2],a=t[3],i=t[4],l=t[5],s=t[6],p=t[7],c=t[8],_=t[9],u=t[10],m=t[11],g=t[12],y=t[13],f=t[14],h=t[15],v=u*h,x=f*m,S=s*h,C=f*p,k=s*m,T=u*p,P=o*h,R=f*a,E=o*m,w=u*a,A=o*p,O=s*a,M=c*y,L=g*_,z=i*y,F=g*l,N=i*_,U=c*l,D=r*y,I=g*n,G=r*_,V=c*n,B=r*l,j=i*n,H=v*l+C*_+k*y-(x*l+S*_+T*y),W=x*n+P*_+w*y-(v*n+R*_+E*y),Y=S*n+R*l+A*y-(C*n+P*l+O*y),X=T*n+E*l+O*_-(k*n+w*l+A*_),q=1/(r*H+i*W+c*Y+g*X);return[q*H,q*W,q*Y,q*X,q*(x*i+S*c+T*g-(v*i+C*c+k*g)),q*(v*r+R*c+E*g-(x*r+P*c+w*g)),q*(C*r+P*i+O*g-(S*r+R*i+A*g)),q*(k*r+w*i+A*c-(T*r+E*i+O*c)),q*(M*p+F*m+N*h-(L*p+z*m+U*h)),q*(L*a+D*m+V*h-(M*a+I*m+G*h)),q*(z*a+I*p+B*h-(F*a+D*p+j*h)),q*(U*a+G*p+j*m-(N*a+V*p+B*m)),q*(z*u+U*f+L*s-(N*f+M*s+F*u)),q*(G*f+M*o+I*u-(D*u+V*f+L*o)),q*(D*s+j*f+F*o-(B*f+z*o+I*s)),q*(B*u+N*o+V*s-(G*s+j*u+U*o))]},transpose:function(t){return[t[0],t[4],t[8],t[12],t[1],t[5],t[9],t[13],t[2],t[6],t[10],t[14],t[3],t[7],t[11],t[15]]},projection:function(t,r,n){return[2/t,0,0,0,0,-2/r,0,0,0,0,2/n,0,-1,1,0,1]},orthographic:function(t,r,n,o,a,i){return[2/(r-t),0,0,0,0,2/(n-o),0,0,0,0,2/(a-i),0,(t+r)/(t-r),(o+n)/(o-n),(a+i)/(a-i),1]},perspective:function(t,r,n,o){const a=Ue(t),i=dt(0.5*at-0.5*a),l=1/(n-o);return[i/r,0,0,0,0,i,0,0,0,0,(n+o)*l,-1,0,0,2*(n*o*l),0]},lookAt:function(t,r,n){const o=ui.normalize(ui.subtract(t,r)),a=ui.cross(n,o),i=ui.cross(o,a);return[a[0],a[1],a[2],0,i[0],i[1],i[2],0,o[0],o[1],o[2],0,t[0],t[1],t[2],1]},multiply:function(t,r){const n=t[0],o=t[1],a=t[2],i=t[3],l=t[4],s=t[5],d=t[6],p=t[7],c=t[8],_=t[9],u=t[10],m=t[11],g=t[12],y=t[13],f=t[14],h=t[15],v=r[0],x=r[1],S=r[2],C=r[3],k=r[4],T=r[5],P=r[6],R=r[7],E=r[8],w=r[9],A=r[10],O=r[11],M=r[12],L=r[13],z=r[14],F=r[15];return[v*n+x*l+S*c+C*g,v*o+x*s+S*_+C*y,v*a+x*d+S*u+C*f,v*i+x*p+S*m+C*h,k*n+T*l+P*c+R*g,k*o+T*s+P*_+R*y,k*a+T*d+P*u+R*f,k*i+T*p+P*m+R*h,E*n+w*l+A*c+O*g,E*o+w*s+A*_+O*y,E*a+w*d+A*u+O*f,E*i+w*p+A*m+O*h,M*n+L*l+z*c+F*g,M*o+L*s+z*_+F*y,M*a+L*d+z*u+F*f,M*i+L*p+z*m+F*h]}},Ci=function(t){const r=[parseFloat(getComputedStyle(t.gl.canvas).width)*window.devicePixelRatio,parseFloat(getComputedStyle(t.gl.canvas).height)*window.devicePixelRatio,1e3];Me.apply(void 0,[t.gl].concat(r)),t.projectionMatrix=Si.perspective(45,r[0]/r[1],1,2e3)};var ki=function(){};ki.prototype.initGl=function(t){const r=Ee(t),n=t.webGlRendererState;n.gl=r,r||console.log('You need WebGL.');const o=Fe(r,r.VERTEX_SHADER,'\n attribute vec4 a_vertexPosition;\n uniform mat4 u_worldViewProjectionMatrix;\n\n // TODO: awaiting on transpose() method for DOMMatrix\n //uniform mat4 u_worldInverseTransposeMatrix; // used for correct lighting normals\n\n attribute vec4 a_color;\n varying vec4 v_fragColor;\n\n attribute vec3 a_normal;\n varying vec3 v_vertNormal;\n\n uniform mat4 u_worldMatrix;\n\n uniform vec3 u_lightWorldPosition;\n varying vec3 v_surfaceToLightVector;\n\n uniform vec3 u_cameraWorldPosition;\n varying vec3 v_surfaceToCameraVector;\n\n attribute vec2 a_textureCoordinate;\n varying vec2 v_textureCoordinate;\n\n void main() {\n vec3 surfaceWorldPosition = (u_worldMatrix * a_vertexPosition).xyz;\n\n // compute the vector of the surface to the pointLight\n // and pass it to the fragment shader\n v_surfaceToLightVector = u_lightWorldPosition - surfaceWorldPosition;\n\n // compute the vector of the surface to the camera\n // and pass it to the fragment shader\n v_surfaceToCameraVector = u_cameraWorldPosition - surfaceWorldPosition;\n\n gl_Position = u_worldViewProjectionMatrix * a_vertexPosition;\n\n v_fragColor = a_color;\n //v_fragColor = gl_Position * 0.5 + 0.5;\n\n // orient the normals and pass to the fragment shader\n //v_vertNormal = mat3(u_worldInverseTransposeMatrix) * a_normal; // TODO waiting for transpose() method on DOMMatrix\n //alternate: v_vertNormal = (u_worldInverseTransposeMatrix * vec4(a_normal, 0)).xyz;\n v_vertNormal = mat3(u_worldMatrix) * a_normal;\n\n v_textureCoordinate = a_textureCoordinate;\n }\n'),a=Fe(r,r.FRAGMENT_SHADER,'\n // TODO: detect highp support, see\n // https://github.com/greggman/webgl-fundamentals/issues/80#issuecomment-306746556\n //precision mediump float;\n precision highp float;\n\n varying vec4 v_fragColor;\n varying vec3 v_vertNormal;\n\n varying vec3 v_surfaceToLightVector;\n\n //// TODO: use this for directional lighting (f.e. sunlight or moonlight).\n //uniform vec3 reverseLightDirection;\n\n varying vec3 v_surfaceToCameraVector;\n\n uniform float u_shininess;\n uniform vec3 u_lightColor;\n uniform vec3 u_specularColor;\n\n varying vec2 v_textureCoordinate;\n uniform sampler2D u_texture;\n uniform bool u_hasTexture;\n\n void main(void) {\n\n // because v_vertNormal is a varying it\'s interpolated\n // so it will not be a unit vector. Normalizing it\n // will make it a unit vector again.\n vec3 normal = normalize(v_vertNormal);\n\n vec3 surfaceToCameraDirection = normalize(v_surfaceToCameraVector);\n\n vec3 surfaceToLightDirection = normalize(v_surfaceToLightVector);\n\n // represents the unit vector oriented at half of the angle between\n // surfaceToLightDirection and surfaceToCameraDirection.\n vec3 halfVector = normalize(surfaceToLightDirection + surfaceToCameraDirection);\n\n float pointLight = dot(normal, surfaceToLightDirection);\n float pointLightIntensity = 1.0; // TODO make configurable\n //float directionalLight = dot(normal, reverseLightDirection); // TODO make configurable\n\n //float specular = dot(normal, halfVector);\n float specular = 0.0;\n if (pointLight > 0.0) {\n specular = pow(dot(normal, halfVector), u_shininess);\n }\n\n // TODO make configurable\n //vec3 ambientLight = vec3(0.361, 0.184, 0.737); // teal\n vec3 ambientLight = vec3(1.0, 1.0, 1.0); // white\n float ambientLightIntensity = 0.3;\n\n // TODO: user can choose color or texture, default to a color if no texture, etc.\n // TODO: blend texture on top of color, if texture has alpha.\n gl_FragColor = v_fragColor;\n if (u_hasTexture) {\n gl_FragColor = texture2D(u_texture, v_textureCoordinate);\n }\n\n // Lets multiply just the color portion (not the alpha) of\n // gl_FragColor by the pointLight + directionalLight\n //gl_FragColor.rgb *= pointLight * u_lightColor; // point light only.\n //gl_FragColor.rgb *= directionalLight; // directional light only.\n //gl_FragColor.rgb *= ambientLight; // ambient light only.\n gl_FragColor.rgb *=\n //clamp(directionalLight, 0.0, 1.0) +\n clamp(pointLight, 0.0, 1.0) * u_lightColor * pointLightIntensity +\n ambientLight * ambientLightIntensity;\n\n // Just add in the specular\n gl_FragColor.rgb += specular * u_specularColor;\n\n //gl_FragColor.a = 0.5;\n }\n'),i=Ne(r,o,a);r.useProgram(i),n.colorsBuffer=r.createBuffer(),n.colorAttributeLocation=r.getAttribLocation(i,'a_color'),r.enableVertexAttribArray(n.colorAttributeLocation),n.vertexBuffer=r.createBuffer(),n.vertexAttributeLocation=r.getAttribLocation(i,'a_vertexPosition'),r.enableVertexAttribArray(n.vertexAttributeLocation),n.normalsBuffer=r.createBuffer(),n.normalAttributeLocation=r.getAttribLocation(i,'a_normal'),r.enableVertexAttribArray(n.normalAttributeLocation),n.textureCoordinatesBuffer=r.createBuffer(),n.textureCoordinateLocation=r.getAttribLocation(i,'a_textureCoordinate'),r.enable(r.DEPTH_TEST),r.blendFunc(r.SRC_ALPHA,r.ONE),r.enable(r.BLEND),n.projectionMatrix=Si.identity,Ci(n),t.on('parentsizechange',function(){return Ci(n)}),n.worldViewProjectionMatrixLocation=r.getUniformLocation(i,'u_worldViewProjectionMatrix'),n.worldMatrixLocation=r.getUniformLocation(i,'u_worldMatrix'),n.lightWorldPositionLocation=r.getUniformLocation(i,'u_lightWorldPosition'),n.cameraWorldPositionLocation=r.getUniformLocation(i,'u_cameraWorldPosition');const l=r.getUniformLocation(i,'u_shininess'),s=r.getUniformLocation(i,'u_lightColor'),d=r.getUniformLocation(i,'u_specularColor');n.textureLocation=r.getUniformLocation(i,'u_texture'),n.hasTextureLocation=r.getUniformLocation(i,'u_hasTexture');r.uniform1f(l,200);const p=[1,1,1];r.uniform3fv(s,ui.normalize(p));r.uniform3fv(d,ui.normalize(p)),n.lightAnimParam=0,n.lightWorldPosition=[20,30,50],n.cameraAngle=0,n.cameraRadius=200},ki.prototype.drawScene=function(t){var r=this;const n=t.webGlRendererState;var o=n.gl;n.lightAnimParam+=0.05,n.lightWorldPosition=[300*pt(n.lightAnimParam),300*pt(2*n.lightAnimParam),it(300*ct(n.lightAnimParam))],o.uniform3fv(n.lightWorldPositionLocation,n.lightWorldPosition);let a=t.getAttribute('background');a='string'==typeof a?a.split(' ').map(function(t){return parseFloat(t)}):[0,0,0,0],o.clearColor.apply(o,a),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT);let i=Si.identity;i=Si.multiply(i,Si.yRotation(n.cameraAngle)),i=Si.multiply(i,Si.translation(0,0,1.5*n.cameraRadius));const l=Si.inverse(i);n.viewProjectionMatrix=Si.multiply(n.projectionMatrix,l);const s=[i[12],i[13],i[14]];o.uniform3fv(n.cameraWorldPositionLocation,s);const d=t.imperativeCounterpart._children;for(let o=0,a=d.length;o<a;o+=1)r.drawNodeAndRecurse(n,d[o])},ki.prototype.drawNodeAndRecurse=function(t,r){var n=this,o=t.gl;const a=r.element.getAttribute('mesh');if(a){const n=r._calculatedSize,i=Array.from(r.element.children).find(function(t){return t instanceof SVGSVGElement}),l=!!i;if('cube'==a)r.__shape instanceof vi||(r.__shape=new vi(0,0,n.x));else if('quad'!=a)'isotriangle'==a?r.__shape instanceof yi||(r.__shape=new yi(n.x,n.y)):'pyramid4'==a?r.__shape instanceof bi||(r.__shape=new bi(n.x,n.y)):'symtrap'==a?r.__shape instanceof fi?(r.__shape.baseWidth=n.x/2,r.__shape.topWidth=n.x,r.__shape.height=n.y,r.__shape._calcVerts()):r.__shape=new fi(n.x/2,n.x,n.y):(r.__shape instanceof hi?(r.__shape.width=n.x,r.__shape.height=n.y,r.__shape._calcVerts()):r.__shape=new hi(n.x,n.y),l&&(r.__shape.textureCoordinates=new Float32Array([0,0,1,0,1,1,1,1,0,1,0,0])));else if(r.__shape instanceof hi?(r.__shape.width=n.x,r.__shape.height=n.y,r.__shape._calcVerts()):r.__shape=new hi(n.x,n.y),l){r.__texture||(r.__shape.textureCoordinates=new Float32Array([0,0,1,0,1,1,1,1,0,1,0,0]),r.__texture=o.createTexture()),r.__two||(r.__two=new Two({type:Two.Types.webgl,fullscreen:!1,autostart:!1}),r.__two.interpret(i)),r.__two.update();const t=r.__two.renderer.domElement,n=function(t){return 0==(t&t-1)};o.bindTexture(o.TEXTURE_2D,r.__texture),o.texImage2D(o.TEXTURE_2D,0,o.RGB,o.RGB,o.UNSIGNED_BYTE,t),n(t.width)&&n(t.height)?(o.generateMipmap(o.TEXTURE_2D),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR_MIPMAP_LINEAR)):(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR))}if(r.__shape){r.__shape.color=r.element.getAttribute('color'),o.bindBuffer(o.ARRAY_BUFFER,t.colorsBuffer),o.bufferData(o.ARRAY_BUFFER,r.__shape._colors,o.STATIC_DRAW);const n=o.FLOAT;o.vertexAttribPointer(t.colorAttributeLocation,4,n,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,t.vertexBuffer),o.bufferData(o.ARRAY_BUFFER,r.__shape.verts,o.STATIC_DRAW);const a=o.FLOAT,i=0;o.vertexAttribPointer(t.vertexAttributeLocation,3,a,!1,0,i),o.bindBuffer(o.ARRAY_BUFFER,t.normalsBuffer),o.bufferData(o.ARRAY_BUFFER,r.__shape.normals,o.STATIC_DRAW);const s=o.FLOAT;if(o.vertexAttribPointer(t.normalAttributeLocation,3,s,!1,0,0),l){o.uniform1i(t.hasTextureLocation,1),o.bindBuffer(o.ARRAY_BUFFER,t.textureCoordinatesBuffer),o.bufferData(o.ARRAY_BUFFER,r.__shape.textureCoordinates,o.STATIC_DRAW);const n=o.FLOAT;o.enableVertexAttribArray(t.textureCoordinateLocation),o.vertexAttribPointer(t.textureCoordinateLocation,2,n,!1,0,0),o.uniform1i(t.textureLocation,0)}else o.uniform1i(t.hasTextureLocation,0),o.disableVertexAttribArray(t.textureCoordinateLocation);o.uniformMatrix4fv(t.worldMatrixLocation,!1,r._worldMatrix.toFloat32Array());const d=Si.multiply(t.viewProjectionMatrix,r._worldMatrix.toFloat32Array());o.uniformMatrix4fv(t.worldViewProjectionMatrixLocation,!1,d);const p=r.__shape.verts.length/3;o.drawArrays(o.TRIANGLES,i,p)}}const s=r._children;for(let o=0,a=s.length;o<a;o+=1)n.drawNodeAndRecurse(t,s[o])};let Ti=null,Pi=!1,Ri=null;var Ei=function(){this._inFrame=!1,this._rAF=null,this._animationLoopStarted=!1,this._allRenderTasks=[],this._taskIterationIndex=0,this._numberOfTasks=0,this._nodesToBeRendered=[],this._modifiedScenes=[],this._worldMatrixRootNodes=[]};Ei.prototype._startAnimationLoop=function(){var t=this;if(this._animationLoopStarted)return Promise.resolve();this._animationLoopStarted=!0;const r=function(){const r=function(n){t._inFrame=!0,t._runRenderTasks(n),t._renderNodes(n),t._allRenderTasks.length?t._rAF=requestAnimationFrame(r):(t._rAF=null,t._animationLoopStarted=!1),t._inFrame=!1};t._rAF=requestAnimationFrame(r)};return Pi?(r(),Promise.resolve()):ci().then(function(){Pi=!0,r()})},Ei.prototype.addRenderTask=function(t){if('function'!=typeof t)throw new Error('Render task must be a function.');return this._allRenderTasks.includes(t)?void 0:(this._allRenderTasks.push(t),this._numberOfTasks+=1,this._animationLoopStarted||this._startAnimationLoop(),t)},Ei.prototype.removeRenderTask=function(t){const r=this._allRenderTasks.indexOf(t);-1==r||(this._allRenderTasks.splice(r,1),this._numberOfTasks-=1,this._taskIterationIndex-=1)},Ei.prototype._runRenderTasks=function(t){var r=this;for(this._taskIterationIndex=0;this._taskIterationIndex<this._numberOfTasks;this._taskIterationIndex+=1){const n=r._allRenderTasks[r._taskIterationIndex];!1===n(t)&&r.removeRenderTask(n)}},Ei.prototype._setNodeToBeRendered=function(t){this._nodesToBeRendered.includes(t)||(this._nodesToBeRendered.push(t),!this._inFrame&&this._startAnimationLoop())},Ei.prototype._renderNodes=function(t){var r=this;if(this._nodesToBeRendered.length){for(let n=0,o=this._nodesToBeRendered.length;n<o;n+=1){const o=r._nodesToBeRendered[n];o._render(t),!(o instanceof Fi)||o._getAncestorToBeRendered()instanceof Fi||r._worldMatrixRootNodes.includes(o)||r._worldMatrixRootNodes.push(o),o._scene&&!r._modifiedScenes.includes(o._scene)&&r._modifiedScenes.push(o._scene)}const n=this._worldMatrixRootNodes;for(let t=0,r=n.length;t<r;t+=1){const r=n[t];r._calculateWorldMatricesInSubtree()}n.length=0;const o=this._modifiedScenes;for(let t=0,r=o.length;t<r;t+=1){const r=o[t].element;r.webglEnabled&&(Ri||(Ri=De()))&&Ri.drawScene(r)}o.length=0;const a=this._nodesToBeRendered;for(let t=0,r=a.length;t<r;t+=1)a[t]._willBeRendered=!1;a.length=0}};var wi=new Ei;'undefined'==typeof document.createElement('div').style.transform&&Object.defineProperty(CSSStyleDeclaration.prototype,'transform',{set:function(t){this.webkitTransform=t},get:function(){return this.webkitTransform},enumerable:!0});const Ai=Symbol('instanceofSymbol'),Oi=function(t){var r=function(t){function r(r){void 0===r&&(r={}),t.call(this,r),this._propertyFunctions=null,this._calculatedSize={x:0,y:0,z:0},this._properties={},this._setDefaultProperties(),this._setPropertyObservers(),this.properties=r}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._setDefaultProperties=function(){Object.assign(this._properties,{sizeMode:new hn('absolute','absolute','absolute'),absoluteSize:new hn(0,0,0),proportionalSize:new hn(1,1,1)})},r.prototype._setPropertyObservers=function(){var t=this;this._properties.sizeMode.on('valuechanged',function(){return t.triggerEvent('propertychange','sizeMode')}),this._properties.absoluteSize.on('valuechanged',function(){return t.triggerEvent('propertychange','absoluteSize')}),this._properties.proportionalSize.on('valuechanged',function(){return t.triggerEvent('propertychange','proportionalSize')})},r.prototype._calcSize=function(){const t=this._calculatedSize,r=Object.assign({},t),n=this._properties,o=this._getParentSize();t.x='absolute'==n.sizeMode._x?n.absoluteSize._x:o.x*n.proportionalSize._x,t.y='absolute'==n.sizeMode._y?n.absoluteSize._y:o.y*n.proportionalSize._y,t.z='absolute'==n.sizeMode._z?n.absoluteSize._z:o.z*n.proportionalSize._z,(r.x!==t.x||r.y!==t.y||r.z!==t.z)&&this.triggerEvent('sizechange',Object.assign({},t))},r.prototype._getParentSize=function(){return this._parent?this._parent._calculatedSize:{x:0,y:0,z:0}},r.prototype._setPropertyXYZ=function(t,r,n){var o=this;if(!(n instanceof Object||n instanceof Array||n instanceof Function))throw new TypeError('Invalid value for '+t.name+'#'+r+'.');let a=!1;n instanceof Function?(!this._propertyFunctions&&(this._propertyFunctions=new Map),this._propertyFunctions.has(r)&&wi.removeRenderTask(this._propertyFunctions.get(r)),this._propertyFunctions.set(r,wi.addRenderTask(function(t){const a=n(o._properties[r]._x,o._properties[r]._y,o._properties[r]._z,t);return!1===a?(o._propertyFunctions.delete(r),!1):void(o[r]=a)}))):n instanceof Array?('undefined'!=typeof n[0]&&(this._properties[r]._x=n[0],a=!0),'undefined'!=typeof n[1]&&(this._properties[r]._y=n[1],a=!0),'undefined'!=typeof n[2]&&(this._properties[r]._z=n[2],a=!0)):('undefined'!=typeof n.x&&(this._properties[r]._x=n.x,a=!0),'undefined'!=typeof n.y&&(this._properties[r]._y=n.y,a=!0),'undefined'!=typeof n.z&&(this._properties[r]._z=n.z,a=!0)),a&&this.triggerEvent('propertychange',r)},r.prototype._setPropertySingle=function(t,r,n,o){var a=this;if(!(typeof n==o||n instanceof Function))throw new TypeError('Invalid value for '+t.name+'#'+r+'.');n instanceof Function?wi.addRenderTask(function(t){const o=n(a._properties[r],t);return!1!==o&&void(a[r]=o)}):(this._properties[r]=n,this.triggerEvent('propertychange',r))},r.prototype._render=function(){},r}(Pn.mixin(fn.mixin(t)));return Object.defineProperties(r.prototype,{sizeMode:{set:function(t){this._setPropertyXYZ(r,'sizeMode',t)},get:function(){return this._properties.sizeMode},configurable:!0,enumerable:!0},absoluteSize:{set:function(t){this._setPropertyXYZ(r,'absoluteSize',t)},get:function(){return this._properties.absoluteSize},configurable:!0,enumerable:!0},actualSize:{get:function(){var t=this._calculatedSize,r=t.x,n=t.y,o=t.z;return{x:r,y:n,z:o}},configurable:!0,enumerable:!0},proportionalSize:{set:function(t){this._setPropertyXYZ(r,'proportionalSize',t)},get:function(){return this._properties.proportionalSize},configurable:!0,enumerable:!0},properties:{set:function(t){void 0===t&&(t={}),t.sizeMode&&(this.sizeMode=t.sizeMode),t.absoluteSize&&(this.absoluteSize=t.absoluteSize),t.proportionalSize&&(this.proportionalSize=t.proportionalSize)},configurable:!0}}),Ce(r.prototype),Object.defineProperty(r,Symbol.hasInstance,{value:function(t){if(this!==r)return Object.getPrototypeOf(r)[Symbol.hasInstance].call(this,t);for(let r=t;r;){const t=Object.getOwnPropertyDescriptor(r,'constructor');if(t&&t.value&&t.value.hasOwnProperty(Ai))return!0;r=Object.getPrototypeOf(r)}return!1}}),r[Ai]=!0,r},Mi=Oi(function(){return function(){}}());Mi.mixin=Oi;const Li=Symbol('instanceofSymbol'),zi=function(t){const r=Mi.mixin(t);var n=function(t){function r(r){void 0===r&&(r={}),t.call(this,r),this._worldMatrix=null}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._setDefaultProperties=function(){t.prototype._setDefaultProperties.call(this),Object.assign(this._properties,{position:new hn(0,0,0),rotation:new hn(0,0,0),scale:new hn(1,1,1),origin:new hn(0.5,0.5,0.5),align:new hn(0,0,0),mountPoint:new hn(0,0,0),opacity:1,transform:new window.DOMMatrix})},r.prototype._setPropertyObservers=function(){var r=this;t.prototype._setPropertyObservers.call(this),this._properties.position.on('valuechanged',function(){return r.triggerEvent('propertychange','position')}),this._properties.rotation.on('valuechanged',function(){return r.triggerEvent('propertychange','rotation')}),this._properties.scale.on('valuechanged',function(){return r.triggerEvent('propertychange','scale')}),this._properties.origin.on('valuechanged',function(){return r.triggerEvent('propertychange','origin')}),this._properties.align.on('valuechanged',function(){return r.triggerEvent('propertychange','align')}),this._properties.mountPoint.on('valuechanged',function(){return r.triggerEvent('propertychange','mountPoint')})},r.prototype._calculateMatrix=function(){const t=new window.DOMMatrix,r=this._properties,n=[0,0,0];if(this._parent){const t=this._parent._calculatedSize;var o=r.align;n[0]=t.x*o.x,n[1]=t.y*o.y,n[2]=t.z*o.z}const a=[0,0,0],i=this._calculatedSize;var l=r.mountPoint;a[0]=i.x*l.x,a[1]=i.y*l.y,a[2]=i.z*l.z;const s=[];var d=r.position;s[0]=d.x+n[0]-a[0],s[1]=d.y+n[1]-a[1],s[2]=d.z+n[2]-a[2],t.translateSelf(s[0],s[1],s[2]);var p=r.rotation;return t.rotateAxisAngleSelf(1,0,0,p.x),t.rotateAxisAngleSelf(0,1,0,p.y),t.rotateAxisAngleSelf(0,0,1,p.z),t},r.prototype._calculateWorldMatricesInSubtree=function(){this._calculateWorldMatrixFromParent();const t=this._children;for(let r=0,n=t.length;r<n;r+=1)t[r]._calculateWorldMatricesInSubtree()},r.prototype._calculateWorldMatrixFromParent=function(){const t=this._parent;this._worldMatrix=t instanceof r?this._properties.transform.multiply(t._worldMatrix):this._properties.transform},r.prototype._render=function(){t.prototype._render.call(this),this._properties.transform=this._calculateMatrix()},r}(r),o=Object.getOwnPropertyDescriptor(r.prototype,'properties'),a=o.set;return Object.defineProperties(n.prototype,{position:{set:function(t){this._setPropertyXYZ(n,'position',t)},get:function(){return this._properties.position},configurable:!0,enumerable:!0},rotation:{set:function(t){this._setPropertyXYZ(n,'rotation',t)},get:function(){return this._properties.rotation},configurable:!0,enumerable:!0},scale:{set:function(t){this._setPropertyXYZ(n,'scale',t)},get:function(){return this._properties.scale},configurable:!0,enumerable:!0},opacity:{set:function(t){Ie(t)||(t=void 0),this._setPropertySingle(n,'opacity',t,'number')},get:function(){return this._properties.opacity},configurable:!0,enumerable:!0},align:{set:function(t){this._setPropertyXYZ(n,'align',t)},get:function(){return this._properties.align},configurable:!0,enumerable:!0},mountPoint:{set:function(t){this._setPropertyXYZ(n,'mountPoint',t)},get:function(){return this._properties.mountPoint},configurable:!0,enumerable:!0},properties:{set:function(t){void 0===t&&(t={}),a.call(this,t),t.position&&(this.position=t.position),t.rotation&&(this.rotation=t.rotation),t.scale&&(this.scale=t.scale),t.origin&&(this.origin=t.origin),t.align&&(this.align=t.align),t.mountPoint&&(this.mountPoint=t.mountPoint),t.opacity&&(this.opacity=t.opacity)},configurable:!0}}),Ce(n.prototype),Object.defineProperty(n,Symbol.hasInstance,{value:function(t){if(this!==n)return Object.getPrototypeOf(n)[Symbol.hasInstance].call(this,t);for(let r=t;r;){const t=Object.getOwnPropertyDescriptor(r,'constructor');if(t&&t.value&&t.value.hasOwnProperty(Li))return!0;r=Object.getPrototypeOf(r)}return!1}}),n[Li]=!0,n},Fi=zi(function(){return function(){}}());Fi.mixin=zi;var Ni={display:'none',boxSizing:'border-box',position:'absolute',top:0,left:0,transformOrigin:'50% 50% 0',transformStyle:'preserve-3d'},Ui=Object.assign({},Ni,{position:'relative',overflow:'hidden',width:'100%',height:'100%',perspective:1e3});if('function'!=typeof window.HTMLElement){const t=function(){};t.prototype=window.HTMLElement.prototype,window.HTMLElement=t}const Di=new Map;(function(ee,te,re,t){function ne(o,a){for(var t=0,n=o.length;t<n;t++)ue(o[t],a)}function r(o){for(var a=0,t=o.length,n;a<t;a++)n=o[a],be(n,y[ae(n)])}function oe(r){return function(n){D(n)&&(ue(n,r),ne(n.querySelectorAll(fe),r))}}function ae(o){var a=j.call(o,'is'),t=o.nodeName.toUpperCase(),n=E.call(g,a?d+a.toUpperCase():h+t);return a&&-1<n&&!ie(t,a)?-1:n}function ie(r,n){return-1<fe.indexOf(r+'[is="'+n+'"]')}function le(o){var a=o.currentTarget,t=o.attrChange,n=o.attrName,r=o.target;Y&&(!r||r===a)&&a.attributeChangedCallback&&'style'!==n&&o.prevValue!==o.newValue&&a.attributeChangedCallback(n,t===o[u]?null:o.prevValue,t===o[f]?null:o.newValue)}function se(r){var n=oe(r);return function(t){Z.push(n,t.target)}}function de(t){G&&(G=!1,t.currentTarget.removeEventListener(ye,de)),ne((t.target||te).querySelectorAll(fe),t.detail===s?s:ge),N&&ce()}function n(r,o){var t=this;z.call(t,r,o),Q.call(t,{target:t})}function pe(r,o){_(r,o),he?he.observe(r,W):(K&&(r.setAttribute=n,r[me]=J(r),r.addEventListener(i,Q)),r.addEventListener(l,le)),r.createdCallback&&Y&&(r.created=!0,r.createdCallback(),r.created=!1)}function ce(){for(var r=0,t=B.length,n;r<t;r++)n=B[r],p.contains(n)||(t--,B.splice(r--,1),ue(n,s))}function _e(t){throw new Error('A '+t+' type is already registered')}function ue(o,a){var t=ae(o),r;-1<t&&(ve(o,y[t]),t=0,a!==ge||o[ge]?a===s&&!o[s]&&(o[ge]=!1,o[s]=!0,t=1):(o[s]=!1,o[ge]=!0,t=1,N&&0>E.call(B,o)&&B.push(o)),t&&(r=o[a+'Callback'])&&r.call(o))}if(!(t in te)){var me='__'+t+(1e5*Math.random()>>0),ge='attached',s='detached',o='extends',u='ADDITION',a='MODIFICATION',f='REMOVAL',l='DOMAttrModified',ye='DOMContentLoaded',i='DOMSubtreeModified',h='<',d='=',v=/^[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)+$/,m=['ANNOTATION-XML','COLOR-PROFILE','FONT-FACE','FONT-FACE-SRC','FONT-FACE-URI','FONT-FACE-FORMAT','FONT-FACE-NAME','MISSING-GLYPH'],g=[],y=[],fe='',p=te.documentElement,E=g.indexOf||function(r){for(var n=this.length;n--&&this[n]!==r;);return n},S=re.prototype,x=S.hasOwnProperty,c=S.isPrototypeOf,T=re.defineProperty,C=re.getOwnPropertyDescriptor,k=re.getOwnPropertyNames,w=re.getPrototypeOf,A=re.setPrototypeOf,O=!!re.__proto__,M=re.create||function t(r){return r?(t.prototype=r,new t):this},_=A||(O?function(r,n){return r.__proto__=n,r}:k&&C?function(){function r(o,a){for(var t=k(a),r=0,i=t.length,l;r<i;r++)l=t[r],x.call(o,l)||T(o,l,C(a,l))}return function(o,t){do r(o,t);while((t=w(t))&&!c.call(t,o));return o}}():function(r,o){for(var t in o)r[t]=o[t];return r}),L=ee.MutationObserver||ee.WebKitMutationObserver,P=(ee.HTMLElement||ee.Element||ee.Node).prototype,N=!c.call(P,p),D=N?function(t){return 1===t.nodeType}:function(t){return c.call(P,t)},B=N&&[],F=P.cloneNode,I=P.dispatchEvent,j=P.getAttribute,R=P.hasAttribute,U=P.removeAttribute,z=P.setAttribute,H=te.createElement,W=L&&{attributes:!0,characterData:!0,attributeOldValue:!0},V=L||function(){K=!1,p.removeEventListener(l,V)},X=ee.requestAnimationFrame||ee.webkitRequestAnimationFrame||ee.mozRequestAnimationFrame||ee.msRequestAnimationFrame||function(t){setTimeout(t,10)},q=!1,K=!0,G=!0,Y=!0,Z,Q,$,J,he,ve,be;A||O?(ve=function(r,n){c.call(n,r)||pe(r,n)},be=pe):(ve=function(r,n){r[me]||(r[me]=re(!0),pe(r,n))},be=ve),N?(K=!1,function(){var o=C(P,'addEventListener'),i=o.value,t=function(r){var n=new CustomEvent(l,{bubbles:!0});n.attrName=r,n.prevValue=j.call(this,r),n.newValue=null,n[f]=n.attrChange=2,U.call(this,r),I.call(this,n)},n=function(o,s){var t=R.call(this,o),n=t&&j.call(this,o),r=new CustomEvent(l,{bubbles:!0});z.call(this,o,s),r.attrName=o,r.prevValue=t?n:null,r.newValue=s,t?r[a]=r.attrChange=1:r[u]=r.attrChange=0,I.call(this,r)},r=function(o){var i=o.currentTarget,t=i[me],n=o.propertyName,r;t.hasOwnProperty(n)&&(t=t[n],r=new CustomEvent(l,{bubbles:!0}),r.attrName=t.name,r.prevValue=t.value||null,r.newValue=t.value=i[n]||null,null==r.prevValue?r[u]=r.attrChange=0:r[a]=r.attrChange=1,I.call(i,r))};o.value=function(a,s,o){a===l&&this.attributeChangedCallback&&this.setAttribute!==n&&(this[me]={className:{name:'class',value:this.className}},this.setAttribute=n,this.removeAttribute=t,i.call(this,'propertychange',r)),i.call(this,a,s,o)},T(P,'addEventListener',o)}()):L||(p.addEventListener(l,V),p.setAttribute(me,1),p.removeAttribute(me),K&&(Q=function(o){var i=this,t,n,r;if(i===o.target){for(r in t=i[me],i[me]=n=J(i),n){if(!(r in t))return $(0,i,r,t[r],n[r],u);if(n[r]!==t[r])return $(1,i,r,t[r],n[r],a)}for(r in t)if(!(r in n))return $(2,i,r,t[r],n[r],f)}},$=function(a,l,d,p,c,_){var s={attrChange:a,currentTarget:l,attrName:d,prevValue:p,newValue:c};s[_]=a,le(s)},J=function(a){for(var l={},r=a.attributes,i=0,s=r.length,o,t;i<s;i++)o=r[i],t=o.name,'setAttribute'!==t&&(l[t]=o.value);return l})),te[t]=function(t,n){if(l=t.toUpperCase(),q||(q=!0,L?(he=function(l,d){function t(o,a){for(var t=0,i=o.length;t<i;a(o[t++]));}return new L(function(n){for(var r=0,p=n.length,a,i,s;r<p;r++)a=n[r],'childList'===a.type?(t(a.addedNodes,l),t(a.removedNodes,d)):(i=a.target,Y&&i.attributeChangedCallback&&'style'!==a.attributeName&&(s=j.call(i,a.attributeName),s!==a.oldValue&&i.attributeChangedCallback(a.attributeName,a.oldValue,s)))})}(oe(ge),oe(s)),he.observe(te,{childList:!0,subtree:!0})):(Z=[],X(function t(){for(;Z.length;)Z.shift().call(null,Z.shift());X(t)}),te.addEventListener('DOMNodeInserted',se(ge)),te.addEventListener('DOMNodeRemoved',se(s))),te.addEventListener(ye,de),te.addEventListener('readystatechange',de),te.createElement=function(t,a){var l='string'==typeof a?a:'',r=l?H.call(te,t,l):H.call(te,t),i=''+t,s=E.call(g,(l?d:h)+(l||i).toUpperCase()),o=-1<s;return l&&(r.setAttribute('is',l=l.toLowerCase()),o&&(o=ie(i.toUpperCase(),l))),Y=!te.createElement.innerHTMLHelper,o&&be(r,y[s]),r},P.cloneNode=function(o){var a=F.call(this,!!o),t=ae(a);return-1<t&&be(a,y[t]),o&&r(a.querySelectorAll(fe)),a}),-2<E.call(g,d+l)+E.call(g,h+l)&&_e(t),!v.test(l)||-1<E.call(m,l))throw new Error('The type '+t+' is invalid');var _=function(){return a?te.createElement(u,l):te.createElement(u)},i=n||S,a=x.call(i,o),u=a?n[o].toUpperCase():l,l,c;return a&&-1<E.call(g,h+u)&&_e(u),c=g.push((a?d:h)+l)-1,fe=fe.concat(fe.length?',':'',a?u+'[is="'+t.toLowerCase()+'"]':u),_.prototype=y[c]=x.call(i,'prototype')?i.prototype:M(P),ne(te.querySelectorAll(fe),ge),_}}})(window,document,Object,'registerElement'),Ke();var Ii=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype.getStyles=function(){return Ni},r.prototype._makeImperativeCounterpart=function(){return new Qi({_motorHtmlCounterpart:this})},r.prototype.attributeChangedCallback=function(){for(var r=this,n=[],o=arguments.length;o--;)n[o]=arguments[o];t.prototype.attributeChangedCallback.apply(this,n),this._imperativeCounterpartPromise.then(function(){(t=r)._updateNodeProperty.apply(t,n);var t})},r.prototype._updateNodeProperty=function(t,r,n){n!==r&&(t.match(/opacity/i)?this.imperativeCounterpart[t]=window.parseFloat(n):t.match(/sizeMode/i)?this.imperativeCounterpart[t]=je(n):(t.match(/rotation/i)||t.match(/scale/i)||t.match(/position/i)||t.match(/absoluteSize/i)||t.match(/proportionalSize/i)||t.match(/align/i)||t.match(/mountPoint/i)||t.match(/origin/i)||t.match(/skew/i))&&(this.imperativeCounterpart[t]=Be(n)))},r}(Gi);Qe(Fi,Ii),Qe(Mi,Ii),Ii=document.registerElement('motor-node',Ii);var Gi;const Vi=new WeakMap;HTMLElement.prototype.createShadowRoot instanceof Function&&(HTMLElement.prototype.createShadowRoot=Ye(HTMLElement.prototype.createShadowRoot)),HTMLElement.prototype.attachShadow instanceof Function&&(HTMLElement.prototype.attachShadow=Ye(HTMLElement.prototype.attachShadow)),Ke();var Bi=W(function(t,r){Object.defineProperty(r,'__esModule',{value:!0});var n=function(t){return t&&t.__esModule?t:{default:t}}(si);r.default=function(t){var o=null,r=new n.default(function(t){return o=t});return setTimeout(o,t),r}}),ji=W(function(t){Jt.Two=function(r){function n(){var t=document.body.getBoundingClientRect(),r=this.width=t.width,n=this.height=t.height;this.renderer.setSize(r,n,this.ratio),this.trigger(S.Events.resize,r,n)}function o(){D(o);for(var r=0,n;r<S.Instances.length;r++)n=S.Instances[r],n.playing&&n.update()}var a='undefined'==typeof window?'undefined'==typeof Jt?null:Jt:window,s={_indexAmount:0,natural:{slice:Array.prototype.slice,indexOf:Array.prototype.indexOf,keys:Object.keys,bind:Function.prototype.bind,create:Object.create},identity:function(t){return t},isArguments:function(t){return'[object Arguments]'===toString.call(t)},isFunction:function(t){return'[object Function]'===toString.call(t)},isString:function(t){return'[object String]'===toString.call(t)},isNumber:function(t){return'[object Number]'===toString.call(t)},isDate:function(t){return'[object Date]'===toString.call(t)},isRegExp:function(t){return'[object RegExp]'===toString.call(t)},isError:function(t){return'[object Error]'===toString.call(t)},isFinite:function(t){return isFinite(t)&&!isNaN(parseFloat(t))},isNaN:function(t){return s.isNumber(t)&&t!==+t},isBoolean:function(t){return!0===t||!1===t||'[object Boolean]'===toString.call(t)},isNull:function(t){return null===t},isUndefined:function(t){return void 0===t},isEmpty:function(t){return null==t||(h&&(s.isArray(t)||s.isString(t)||s.isArguments(t))?0===t.length:0===s.keys(t).length)},isElement:function(t){return!!(t&&1===t.nodeType)},isArray:Array.isArray||function(t){return'[object Array]'===toString.call(t)},isObject:function(t){var r=typeof t;return'function'==r||'object'==r&&!!t},toArray:function(t){return t?s.isArray(t)?g.call(t):h(t)?s.map(t,s.identity):s.values(t):[]},range:function(t,r,n){null==r&&(r=t||0,t=0),n=n||1;for(var o=tt(et((r-t)/n),0),a=Array(o),i=0;i<o;i++,t+=n)a[i]=t;return a},indexOf:function(t,r){if(!!s.natural.indexOf)return s.natural.indexOf.call(t,r);for(var n=0;n<t.length;n++)if(t[n]===r)return n;return-1},has:function(t,r){return null!=t&&hasOwnProperty.call(t,r)},bind:function(t,r){var n=s.natural.bind;if(n&&t.bind===n)return n.apply(t,g.call(arguments,1));var o=g.call(arguments,2);return function(){t.apply(r,o)}},extend:function(t){for(var r=g.call(arguments,1),n=0,o;n<r.length;n++)for(var a in o=r[n],o)t[a]=o[a];return t},defaults:function(t){for(var r=g.call(arguments,1),n=0,o;n<r.length;n++)for(var a in o=r[n],o)void 0===t[a]&&(t[a]=o[a]);return t},keys:function(t){if(!s.isObject(t))return[];if(s.natural.keys)return s.natural.keys(t);var r=[];for(var n in t)s.has(t,n)&&r.push(n);return r},values:function(t){for(var r=s.keys(t),n=[],o=0,a;o<r.length;o++)a=r[o],n.push(t[a]);return n},each:function(t,r,n){for(var o=n||this,a=!h(t)&&s.keys(t),l=(a||t).length,d=0,i;d<l;d++)i=a?a[d]:d,r.call(o,t[i],i,t);return t},map:function(t,r,n){for(var o=n||this,a=!h(t)&&s.keys(t),l=(a||t).length,d=[],p=0,i;p<l;p++)i=a?a[p]:p,d[p]=r.call(o,t[i],i,t);return d},once:function(t){var r=!1;return function(){return r?t:(r=!0,t.apply(this,arguments))}},after:function(t,r){return function(){for(var n=arguments,o=this;1>--t;)return r.apply(o,n)}},uniqueId:function(t){var r=++s._indexAmount+'';return t?t+r:r}},i=pt,l=ct,d=lt,p=st,_=at,u=_/2,c=ot,m=0,g=s.natural.slice,y=a.performance&&a.performance.now?a.performance:Date,f=function(t){return null==t?void 0:t.length},h=function(t){var r=f(t);return'number'==typeof r&&0<=r&&r<=9007199254740991},v={temp:a.document?a.document.createElement('div'):{},hasEventListeners:s.isFunction(a.addEventListener),bind:function(t,r,n,o){return this.hasEventListeners?t.addEventListener(r,n,!!o):t.attachEvent('on'+r,n),v},unbind:function(t,r,n,o){return v.hasEventListeners?t.removeEventListeners(r,n,!!o):t.detachEvent('on'+r,n),v},getRequestAnimationFrame:function(){var t=0,r=['ms','moz','webkit','o'],n=a.requestAnimationFrame,l;if(!n){for(var d=0;d<r.length;d++)n=a[r[d]+'RequestAnimationFrame']||n,l=a[r[d]+'CancelAnimationFrame']||a[r[d]+'CancelRequestAnimationFrame']||l;n=n||function(r){var n=new Date().getTime(),o=tt(0,16-(n-t)),i=a.setTimeout(function(){r(n+o)},o);return t=n+o,i}}return n.init=s.once(o),n}},S=a.Two=function(t){var r=s.defaults(t||{},{fullscreen:!1,width:640,height:480,type:S.Types.svg,autostart:!1});if(s.each(r,function(t,r){'fullscreen'===r||'autostart'===r||(this[r]=t)},this),s.isElement(r.domElement)){var o=r.domElement.tagName.toLowerCase();/^(CanvasRenderer-canvas|WebGLRenderer-canvas|SVGRenderer-svg)$/.test(this.type+'-'+o)||(this.type=S.Types[o])}if(this.renderer=new S[this.type](this),S.Utils.setPlaying.call(this,r.autostart),this.frameCount=0,r.fullscreen){var i=s.bind(n,this);s.extend(document.body.style,{overflow:'hidden',margin:0,padding:0,top:0,left:0,right:0,bottom:0,position:'fixed'}),s.extend(this.renderer.domElement.style,{display:'block',top:0,left:0,right:0,bottom:0,position:'fixed'}),v.bind(a,'resize',i),i()}else s.isElement(r.domElement)||(this.renderer.setSize(r.width,r.height,this.ratio),this.width=r.width,this.height=r.height);this.scene=this.renderer.scene,S.Instances.push(this),D.init()};s.extend(S,{root:a,Array:a.Float32Array||Array,Types:{webgl:'WebGLRenderer',svg:'SVGRenderer',canvas:'CanvasRenderer'},Version:'v0.7.0',Identifier:'two_',Properties:{hierarchy:'hierarchy',demotion:'demotion'},Events:{play:'play',pause:'pause',update:'update',render:'render',resize:'resize',change:'change',remove:'remove',insert:'insert',order:'order',load:'load'},Commands:{move:'M',line:'L',curve:'C',close:'Z'},Resolution:8,Instances:[],noConflict:function(){return a.Two=r,this},uniqueId:function(){var t=m;return m++,t},Utils:s.extend(s,{performance:y,defineProperty:function(t){var r=this,n='_'+t,o='_flag'+t.charAt(0).toUpperCase()+t.slice(1);Object.defineProperty(r,t,{enumerable:!0,get:function(){return this[n]},set:function(t){this[n]=t,this[o]=!0}})},release:function(t){s.isObject(t)&&(s.isFunction(t.unbind)&&t.unbind(),t.vertices&&(s.isFunction(t.vertices.unbind)&&t.vertices.unbind(),s.each(t.vertices,function(t){s.isFunction(t.unbind)&&t.unbind()})),t.children&&s.each(t.children,function(t){S.Utils.release(t)}))},xhr:function(t,r){var n=new XMLHttpRequest;return n.open('GET',t),n.onreadystatechange=function(){4===n.readyState&&200===n.status&&r(n.responseText)},n.send(),n},Curve:{CollinearityEpsilon:c(10,-30),RecursionLimit:16,CuspLimit:0,Tolerance:{distance:0.25,angle:0,epsilon:0.01},abscissas:[[0.5773502691896257],[0,0.7745966692414834],[0.33998104358485626,0.8611363115940526],[0,0.5384693101056831,0.906179845938664],[0.2386191860831969,0.6612093864662645,0.932469514203152],[0,0.4058451513773972,0.7415311855993945,0.9491079123427585],[0.1834346424956498,0.525532409916329,0.7966664774136267,0.9602898564975363],[0,0.3242534234038089,0.6133714327005904,0.8360311073266358,0.9681602395076261],[0.14887433898163122,0.4333953941292472,0.6794095682990244,0.8650633666889845,0.9739065285171717],[0,0.26954315595234496,0.5190961292068118,0.7301520055740494,0.8870625997680953,0.978228658146057],[0.1252334085114689,0.3678314989981802,0.5873179542866175,0.7699026741943047,0.9041172563704749,0.9815606342467192],[0,0.2304583159551348,0.44849275103644687,0.6423493394403402,0.8015780907333099,0.9175983992229779,0.9841830547185881],[0.10805494870734367,0.31911236892788974,0.5152486363581541,0.6872929048116855,0.827201315069765,0.9284348836635735,0.9862838086968123],[0,0.20119409399743451,0.3941513470775634,0.5709721726085388,0.7244177313601701,0.8482065834104272,0.937273392400706,0.9879925180204854],[0.09501250983763744,0.2816035507792589,0.45801677765722737,0.6178762444026438,0.755404408355003,0.8656312023878318,0.9445750230732326,0.9894009349916499]],weights:[[1],[0.8888888888888888,0.5555555555555556],[0.6521451548625461,0.34785484513745385],[0.5688888888888889,0.47862867049936647,0.23692688505618908],[0.46791393457269104,0.3607615730481386,0.17132449237917036],[0.4179591836734694,0.3818300505051189,0.27970539148927664,0.1294849661688697],[0.362683783378362,0.31370664587788727,0.22238103445337448,0.10122853629037626],[0.3302393550012598,0.31234707704000286,0.26061069640293544,0.1806481606948574,0.08127438836157441],[0.29552422471475287,0.26926671930999635,0.21908636251598204,0.1494513491505806,0.06667134430868814],[0.2729250867779006,0.26280454451024665,0.23319376459199048,0.18629021092773426,0.1255803694649046,0.05566856711617366],[0.24914704581340277,0.2334925365383548,0.20316742672306592,0.16007832854334622,0.10693932599531843,0.04717533638651183],[0.2325515532308739,0.22628318026289723,0.2078160475368885,0.17814598076194574,0.13887351021978725,0.09212149983772845,0.04048400476531588],[0.2152638534631578,0.2051984637212956,0.18553839747793782,0.15720316715819355,0.12151857068790319,0.08015808715976021,0.03511946033175186],[0.2025782419255613,0.19843148532711158,0.1861610000155622,0.16626920581699392,0.13957067792615432,0.10715922046717194,0.07036604748810812,0.03075324199611727],[0.1894506104550685,0.18260341504492358,0.16915651939500254,0.14959598881657674,0.12462897125553388,0.09515851168249279,0.062253523938647894,0.027152459411754096]]},devicePixelRatio:a.devicePixelRatio||1,getBackingStoreRatio:function(t){return t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1},getRatio:function(t){return S.Utils.devicePixelRatio/L(t)},setPlaying:function(t){return this.playing=!!t,this},getComputedMatrix:function(t,r){r=r&&r.identity()||new S.Matrix;for(var n=t,o=[];n&&n._matrix;)o.push(n._matrix),n=n.parent;return o.reverse(),s.each(o,function(t){var n=t.elements;r.multiply(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8],n[9])}),r},deltaTransformPoint:function(t,r,n){var o=r*t.a+n*t.c+0,a=r*t.b+n*t.d+0;return new S.Vector(o,a)},decomposeMatrix:function(t){var r=S.Utils.deltaTransformPoint(t,0,1),n=S.Utils.deltaTransformPoint(t,1,0),o=180/at*lt(r.y,r.x)-90,a=180/at*lt(n.y,n.x);return{translateX:t.e,translateY:t.f,scaleX:st(t.a*t.a+t.b*t.b),scaleY:st(t.c*t.c+t.d*t.d),skewX:o,skewY:a,rotation:o}},applySvgAttributes:function(t,r){var n=this,o={},a={},l,i,d,p;if(getComputedStyle){var c=getComputedStyle(t);for(l=c.length;l--;)i=c[l],d=c[i],void 0!==d&&(a[i]=d)}for(l=t.attributes.length;l--;)p=t.attributes[l],o[p.nodeName]=p.value;for(i in s.isUndefined(a.opacity)||(a['stroke-opacity']=a.opacity,a['fill-opacity']=a.opacity),s.extend(a,o),a.visible=!(s.isUndefined(a.display)&&'none'===a.display)||s.isUndefined(a.visibility)&&'hidden'===a.visibility,a)switch(d=a[i],i){case'transform':if('none'===d)break;var _=t.getCTM?t.getCTM():null;if(null===_)break;var u=S.Utils.decomposeMatrix(t.getCTM());r.translation.set(u.translateX,u.translateY),r.rotation=u.rotation,r.scale=u.scaleX;var m=parseFloat((a.x+'').replace('px')),g=parseFloat((a.y+'').replace('px'));m&&(r.translation.x=m),g&&(r.translation.y=g);break;case'visible':r.visible=d;break;case'stroke-linecap':r.cap=d;break;case'stroke-linejoin':r.join=d;break;case'stroke-miterlimit':r.miter=d;break;case'stroke-width':r.linewidth=parseFloat(d);break;case'stroke-opacity':case'fill-opacity':case'opacity':r.opacity=parseFloat(d);break;case'fill':case'stroke':r[i]=/url\(\#.*\)/i.test(d)?n.getById(d.replace(/url\(\#(.*)\)/i,'$1')):'none'===d?'transparent':d;break;case'id':r.id=d;break;case'class':r.classList=d.split(' ');}return r},read:{svg:function(){return S.Utils.read.g.apply(this,arguments)},g:function(t){var r=new S.Group;S.Utils.applySvgAttributes.call(this,t,r);for(var a=0,i=t.childNodes.length;a<i;a++){var l=t.childNodes[a],n=l.nodeName;if(!n)return;var s=n.replace(/svg\:/ig,'').toLowerCase();if(s in S.Utils.read){var d=S.Utils.read[s].call(r,l);r.add(d)}}return r},polygon:function(t,r){var n=t.getAttribute('points'),o=[];n.replace(/(-?[\d\.?]+)[,|\s](-?[\d\.?]+)/g,function(t,r,n){o.push(new S.Anchor(parseFloat(r),parseFloat(n)))});var a=new S.Path(o,!r).noStroke();return a.fill='black',S.Utils.applySvgAttributes.call(this,t,a)},polyline:function(t){return S.Utils.read.polygon.call(this,t,!0)},path:function(t){var r=t.getAttribute('d'),n=new S.Anchor,o=!1,d=!1,a=r.match(/[a-df-z][^a-df-z]*/ig),p=a.length-1,_,g;s.each(a.slice(0),function(t,r){var n=t[0],o=n.toLowerCase(),i=t.slice(1).trim().split(/[\s,]+|(?=\s?[+\-])/),s=[],d;switch(0>=r&&(a=[]),o){case'h':case'v':1<i.length&&(d=1);break;case'm':case'l':case't':2<i.length&&(d=2);break;case's':case'q':4<i.length&&(d=4);break;case'c':6<i.length&&(d=6);break;case'a':}if(d){for(var p=0,c=i.length,l=0,_;p<c;p+=d)_=n,0<l&&('m'===n?_='l':'M'===n?_='L':void 0),s.push([_].concat(i.slice(p,p+d)).join(' ')),l++;a=Array.prototype.concat.apply(a,s)}else a.push(t)});var f=[];if(s.each(a,function(t,h){var i=t[0],C=i.toLowerCase(),k,T,x;g=t.slice(1).trim(),g=g.replace(/(-?\d+(?:\.\d*)?)[eE]([+\-]?\d+)/g,function(t,r,n){return parseFloat(r)*c(10,n)}),g=g.split(/[\s,]+|(?=\s?[+\-])/),d=i===C;var y,P,R,E,w,A,O,L,z;switch(C){case'z':h>=p?o=!0:(T=n.x,x=n.y,k=new S.Anchor(T,x,void 0,void 0,void 0,void 0,S.Commands.close));break;case'm':case'l':T=parseFloat(g[0]),x=parseFloat(g[1]),k=new S.Anchor(T,x,void 0,void 0,void 0,void 0,'m'===C?S.Commands.move:S.Commands.line),d&&k.addSelf(n),n=k;break;case'h':case'v':var F='h'===C?'x':'y',a='x'==F?'y':'x';k=new S.Anchor(void 0,void 0,void 0,void 0,void 0,void 0,S.Commands.line),k[F]=parseFloat(g[0]),k[a]=n[a],d&&(k[F]+=n[F]),n=k;break;case'c':case's':y=n.x,P=n.y,_||(_=new S.Vector),'c'===C?(R=parseFloat(g[0]),E=parseFloat(g[1]),w=parseFloat(g[2]),A=parseFloat(g[3]),O=parseFloat(g[4]),L=parseFloat(g[5])):(z=U(n,_,d),R=z.x,E=z.y,w=parseFloat(g[0]),A=parseFloat(g[1]),O=parseFloat(g[2]),L=parseFloat(g[3])),d&&(R+=y,E+=P,w+=y,A+=P,O+=y,L+=P),s.isObject(n.controls)||S.Anchor.AppendCurveProperties(n),n.controls.right.set(R-n.x,E-n.y),k=new S.Anchor(O,L,w-O,A-L,void 0,void 0,S.Commands.curve),n=k,_=k.controls.left;break;case't':case'q':y=n.x,P=n.y,_||(_=new S.Vector),_.isZero()?(R=y,E=P):(R=_.x,P=_.y),'q'===C?(w=parseFloat(g[0]),A=parseFloat(g[1]),O=parseFloat(g[1]),L=parseFloat(g[2])):(z=U(n,_,d),w=z.x,A=z.y,O=parseFloat(g[0]),L=parseFloat(g[1])),d&&(R+=y,E+=P,w+=y,A+=P,O+=y,L+=P),s.isObject(n.controls)||S.Anchor.AppendCurveProperties(n),n.controls.right.set(R-n.x,E-n.y),k=new S.Anchor(O,L,w-O,A-L,void 0,void 0,S.Commands.curve),n=k,_=k.controls.left;break;case'a':y=n.x,P=n.y;var N=parseFloat(g[0]),D=parseFloat(g[1]),I=parseFloat(g[2])*at/180,G=parseFloat(g[3]),V=parseFloat(g[4]);O=parseFloat(g[5]),L=parseFloat(g[6]),d&&(O+=y,L+=P);var B=(O-y)/2,j=(L-P)/2,H=B*ct(I)+j*pt(I),W=-B*pt(I)+j*ct(I),Y=N*N,X=D*D,q=H*H,Z=W*W,K=q/Y+Z/X;1<K&&(N*=st(K),D*=st(K));var l=st((Y*X-Y*Z-X*q)/(Y*Z+X*q));s.isNaN(l)?l=0:G!=V&&0<l&&(l*=-1);var Q=l*N*W/D,$=-l*D*H/N,J=Q*ct(I)-$*pt(I)+(y+O)/2,ee=Q*pt(I)+$*ct(I)+(P+L)/2,te=function(t){return st(ot(t[0],2)+ot(t[1],2))},m=function(t,r){return(t[0]*r[0]+t[1]*r[1])/(te(t)*te(r))},F=function(t,r){return(t[0]*r[1]<t[1]*r[0]?-1:1)*Math.acos(m(t,r))},r=F([1,0],[(H-Q)/N,(W-$)/D]),re=[(H-Q)/N,(W-$)/D],u=[(-H-Q)/N,(-W-$)/D],v=F(re,u);-1>=m(re,u)&&(v=at),1<=m(re,u)&&(v=0),G&&(v=M(v,2*at)),V&&0<v&&(v-=2*at);var ne=S.Resolution,oe=new S.Matrix().translate(J,ee).rotate(I);k=s.map(s.range(ne),function(t){var n=(1-t/(ne-1))*v+r,o=N*ct(n),a=D*pt(n),i=oe.multiply(o,a,1);return new S.Anchor(i.x,i.y,!1,!1,!1,!1,S.Commands.line)}),k.push(new S.Anchor(O,L,!1,!1,!1,!1,S.Commands.line)),n=k[k.length-1],_=n.controls.left;}k&&(s.isArray(k)?f=f.concat(k):f.push(k))}),!(1>=f.length)){var r=new S.Path(f,o,void 0,!0).noStroke();r.fill='black';var i=r.getBoundingClientRect(!0);return i.centroid={x:i.left+i.width/2,y:i.top+i.height/2},s.each(r.vertices,function(t){t.subSelf(i.centroid)}),r.translation.addSelf(i.centroid),S.Utils.applySvgAttributes.call(this,t,r)}},circle:function(t){var n=parseFloat(t.getAttribute('cx')),o=parseFloat(t.getAttribute('cy')),a=parseFloat(t.getAttribute('r')),r=new S.Circle(n,o,a).noStroke();return r.fill='black',S.Utils.applySvgAttributes.call(this,t,r)},ellipse:function(t){var r=parseFloat(t.getAttribute('cx')),n=parseFloat(t.getAttribute('cy')),o=parseFloat(t.getAttribute('rx')),a=parseFloat(t.getAttribute('ry')),i=new S.Ellipse(r,n,o,a).noStroke();return i.fill='black',S.Utils.applySvgAttributes.call(this,t,i)},rect:function(t){var r=parseFloat(t.getAttribute('x'))||0,n=parseFloat(t.getAttribute('y'))||0,o=parseFloat(t.getAttribute('width')),a=parseFloat(t.getAttribute('height')),i=new S.Rectangle(r+o/2,n+a/2,o,a).noStroke();return i.fill='black',S.Utils.applySvgAttributes.call(this,t,i)},line:function(t){var r=parseFloat(t.getAttribute('x1')),n=parseFloat(t.getAttribute('y1')),o=parseFloat(t.getAttribute('x2')),a=parseFloat(t.getAttribute('y2')),i=new S.Line(r,n,o,a).noFill();return S.Utils.applySvgAttributes.call(this,t,i)},lineargradient:function(t){for(var r=parseFloat(t.getAttribute('x1')),n=parseFloat(t.getAttribute('y1')),o=parseFloat(t.getAttribute('x2')),a=parseFloat(t.getAttribute('y2')),l=(o+r)/2,d=(a+n)/2,p=[],c=0;c<t.children.length;c++){var i=t.children[c],_=parseFloat(i.getAttribute('offset')),u=i.getAttribute('stop-color'),m=i.getAttribute('stop-opacity'),g=i.getAttribute('style');if(s.isNull(u)){var y=!!g&&g.match(/stop\-color\:\s?([\#a-fA-F0-9]*)/);u=y&&1<y.length?y[1]:void 0}if(s.isNull(m)){var y=!!g&&g.match(/stop\-opacity\:\s?([0-9\.\-]*)/);m=y&&1<y.length?parseFloat(y[1]):1}p.push(new S.Gradient.Stop(_,u,m))}var f=new S.LinearGradient(r-l,n-d,o-l,a-d,p);return S.Utils.applySvgAttributes.call(this,t,f)},radialgradient:function(t){var n=parseFloat(t.getAttribute('cx'))||0,o=parseFloat(t.getAttribute('cy'))||0,a=parseFloat(t.getAttribute('r')),r=parseFloat(t.getAttribute('fx')),l=parseFloat(t.getAttribute('fy'));s.isNaN(r)&&(r=n),s.isNaN(l)&&(l=o);for(var d=it(n+r)/2,p=it(o+l)/2,c=[],_=0;_<t.children.length;_++){var i=t.children[_],u=parseFloat(i.getAttribute('offset')),m=i.getAttribute('stop-color'),g=i.getAttribute('stop-opacity'),y=i.getAttribute('style');if(s.isNull(m)){var f=!!y&&y.match(/stop\-color\:\s?([\#a-fA-F0-9]*)/);m=f&&1<f.length?f[1]:void 0}if(s.isNull(g)){var f=!!y&&y.match(/stop\-opacity\:\s?([0-9\.\-]*)/);g=f&&1<f.length?parseFloat(f[1]):1}c.push(new S.Gradient.Stop(u,m,g))}var h=new S.RadialGradient(n-d,o-p,a,c,r-d,l-p);return S.Utils.applySvgAttributes.call(this,t,h)}},subdivide:function(r,n,o,a,l,d,p,c,t){t=t||S.Utils.Curve.RecursionLimit;var _=t+1;return r===p&&n===c?[new S.Anchor(p,c)]:s.map(s.range(0,_),function(s){var i=s/_,t=z(i,r,o,l,p),u=z(i,n,a,d,c);return new S.Anchor(t,u)})},getPointOnCubicBezier:function(r,t,n,o,a){var i=1-r;return i*i*i*t+3*i*i*r*n+3*i*r*r*o+r*r*r*a},getCurveLength:function(r,n,o,a,i,l,s,d,t){if(r===o&&n===a&&i===s&&l===d){var c=s-r,_=d-n;return p(c*c+_*_)}return N(function(c){var t=((9*(o-i)+3*(s-r))*c+(6*(r+i)-12*o))*c+3*(o-r),_=((9*(a-l)+3*(d-n))*c+(6*(n+l)-12*a))*c+3*(a-n);return p(t*t+_*_)},0,1,t||S.Utils.Curve.RecursionLimit)},integrate:function(t,r,o,a){for(var n=S.Utils.Curve.abscissas[a-2],l=S.Utils.Curve.weights[a-2],s=0.5*(o-r),d=s+r,p=0,i=1&a?l[p++]*t(d):0,c;p<a+1>>1;)c=s*n[p],i+=l[p++]*(t(d+c)+t(d-c));return s*i},getCurveFromPoints:function(t,r){for(var n=t.length,o=0,i;o<n;o++){i=t[o],s.isObject(i.controls)||S.Anchor.AppendCurveProperties(i);var l=r?M(o-1,n):tt(o-1,0),d=r?M(o+1,n):Je(o+1,n-1),p=t[l],a=i,_=t[d];E(p,a,_),a._command=0===o?S.Commands.move:S.Commands.curve,a.controls.left.x=s.isNumber(a.controls.left.x)?a.controls.left.x:a.x,a.controls.left.y=s.isNumber(a.controls.left.y)?a.controls.left.y:a.y,a.controls.right.x=s.isNumber(a.controls.right.x)?a.controls.right.x:a.x,a.controls.right.y=s.isNumber(a.controls.right.y)?a.controls.right.y:a.y}},getControlPoints:function(t,r,n){var o=R(t,r),a=R(n,r),d=C(t,r),p=C(n,r),c=(o+a)/2;return(r.u=s.isObject(r.controls.left)?r.controls.left:new S.Vector(0,0),r.v=s.isObject(r.controls.right)?r.controls.right:new S.Vector(0,0),1e-4>d||1e-4>p)?(r._relative||(r.controls.left.copy(r),r.controls.right.copy(r)),r):(d*=0.33,p*=0.33,a<o?c+=u:c-=u,r.controls.left.x=l(c)*d,r.controls.left.y=i(c)*d,c-=_,r.controls.right.x=l(c)*p,r.controls.right.y=i(c)*p,r._relative||(r.controls.left.x+=r.x,r.controls.left.y+=r.y,r.controls.right.x+=r.x,r.controls.right.y+=r.y),r)},getReflection:function(t,r,n){return new S.Vector(2*t.x-(r.x+t.x)-(n?t.x:0),2*t.y-(r.y+t.y)-(n?t.y:0))},getAnchorsFromArcData:function(t,r,n,o,a,d,p){var i=new S.Matrix().translate(t.x,t.y).rotate(r),c=S.Resolution;return s.map(s.range(c),function(t){var r=(t+1)/c;!p||(r=1-r);var i=r*d+a,l=n*ct(i),s=o*pt(i),_=new S.Anchor(l,s);return S.Anchor.AppendCurveProperties(_),_.command=S.Commands.line,_})},ratioBetween:function(t,r){return(t.x*r.x+t.y*r.y)/(t.length()*r.length())},angleBetween:function(t,r){var n,o;return 4<=arguments.length?(n=arguments[0]-arguments[2],o=arguments[1]-arguments[3],d(o,n)):(n=t.x-r.x,o=t.y-r.y,d(o,n))},distanceBetweenSquared:function(t,r){var n=t.x-r.x,o=t.y-r.y;return n*n+o*o},distanceBetween:function(t,r){return p(T(t,r))},lerp:function(r,n,o){return o*(n-r)+r},toFixed:function(t){return nt(1e3*t)/1e3},mod:function(t,r){for(;0>t;)t+=r;return t%r},Collection:function(){Array.call(this),1<arguments.length?Array.prototype.push.apply(this,arguments):arguments[0]&&Array.isArray(arguments[0])&&Array.prototype.push.apply(this,arguments[0])},Error:function(t){this.name='two.js',this.message=t},Events:{on:function(t,r){this._events||(this._events={});var n=this._events[t]||(this._events[t]=[]);return n.push(r),this},off:function(t,r){var n=this;if(!this._events)return this;if(!t&&!r)return this._events={},this;for(var o=t?[t]:s.keys(this._events),a=0,i=o.length;a<i;a++){var t=o[a],l=n._events[t];if(!!l){var d=[];if(r)for(var p=0,c=l.length,_;p<c;p++)_=l[p],_=_.callback?_.callback:_,r&&r!==_&&d.push(_);n._events[t]=d}}return this},trigger:function(t){if(!this._events)return this;var r=g.call(arguments,1),n=this._events[t];return n&&x(this,n,r),this},listen:function(t,r,n){var o=this;if(t){var a=function(){n.apply(o,arguments)};a.obj=t,a.name=r,a.callback=n,t.on(r,a)}return this},ignore:function(t,r,n){return t.off(r,n),this}}})}),S.Utils.Events.bind=S.Utils.Events.on,S.Utils.Events.unbind=S.Utils.Events.off;var x=function(t,r,n){var o;switch(n.length){case 0:o=function(o){r[o].call(t,n[0])};break;case 1:o=function(o){r[o].call(t,n[0],n[1])};break;case 2:o=function(o){r[o].call(t,n[0],n[1],n[2])};break;case 3:o=function(o){r[o].call(t,n[0],n[1],n[2],n[3])};break;default:o=function(o){r[o].apply(t,n)};}for(var a=0;a<r.length;a++)o(a)};S.Utils.Error.prototype=new Error,S.Utils.Error.prototype.constructor=S.Utils.Error,S.Utils.Collection.prototype=[],S.Utils.Collection.prototype.constructor=S.Utils.Collection,s.extend(S.Utils.Collection.prototype,S.Utils.Events,{pop:function(){var t=Array.prototype.pop.apply(this,arguments);return this.trigger(S.Events.remove,[t]),t},shift:function(){var t=Array.prototype.shift.apply(this,arguments);return this.trigger(S.Events.remove,[t]),t},push:function(){var t=Array.prototype.push.apply(this,arguments);return this.trigger(S.Events.insert,arguments),t},unshift:function(){var t=Array.prototype.unshift.apply(this,arguments);return this.trigger(S.Events.insert,arguments),t},splice:function(){var t=Array.prototype.splice.apply(this,arguments),r;return this.trigger(S.Events.remove,t),2<arguments.length&&(r=this.slice(arguments[0],arguments[0]+arguments.length-2),this.trigger(S.Events.insert,r),this.trigger(S.Events.order)),t},sort:function(){return Array.prototype.sort.apply(this,arguments),this.trigger(S.Events.order),this},reverse:function(){return Array.prototype.reverse.apply(this,arguments),this.trigger(S.Events.order),this}});var C=S.Utils.distanceBetween,k=S.Utils.getAnchorsFromArcData,T=S.Utils.distanceBetweenSquared,P=S.Utils.ratioBetween,R=S.Utils.angleBetween,E=S.Utils.getControlPoints,w=S.Utils.getCurveFromPoints,A=S.Utils.solveSegmentIntersection,O=S.Utils.decoupleShapes,M=S.Utils.mod,L=S.Utils.getBackingStoreRatio,z=S.Utils.getPointOnCubicBezier,F=S.Utils.getCurveLength,N=S.Utils.integrate,U=S.Utils.getReflection;s.extend(S.prototype,S.Utils.Events,{appendTo:function(t){return t.appendChild(this.renderer.domElement),this},play:function(){return S.Utils.setPlaying.call(this,!0),this.trigger(S.Events.play)},pause:function(){return this.playing=!1,this.trigger(S.Events.pause)},update:function(){var t=!!this._lastFrame,r=y.now();this.frameCount++,t&&(this.timeDelta=parseFloat((r-this._lastFrame).toFixed(3))),this._lastFrame=r;var n=this.width,o=this.height,a=this.renderer;return(n!==a.width||o!==a.height)&&a.setSize(n,o,this.ratio),this.trigger(S.Events.update,this.frameCount,this.timeDelta),this.render()},render:function(){return this.renderer.render(),this.trigger(S.Events.render,this.frameCount)},add:function(t){var r=t;return r instanceof Array||(r=s.toArray(arguments)),this.scene.add(r),this},remove:function(t){var r=t;return r instanceof Array||(r=s.toArray(arguments)),this.scene.remove(r),this},clear:function(){return this.scene.remove(s.toArray(this.scene.children)),this},makeLine:function(t,r,n,o){var a=new S.Line(t,r,n,o);return this.scene.add(a),a},makeRectangle:function(t,r,n,o){var a=new S.Rectangle(t,r,n,o);return this.scene.add(a),a},makeRoundedRectangle:function(t,r,n,o,a){var i=new S.RoundedRectangle(t,r,n,o,a);return this.scene.add(i),i},makeCircle:function(t,n,o){var r=new S.Circle(t,n,o);return this.scene.add(r),r},makeEllipse:function(t,r,n,o){var a=new S.Ellipse(t,r,n,o);return this.scene.add(a),a},makeStar:function(t,r,n,o,a){var i=new S.Star(t,r,n,o,a);return this.scene.add(i),i},makeCurve:function(t){var r=arguments,n=arguments.length,o=t;if(!s.isArray(t)){o=[];for(var a=0,i,l;a<n&&(i=r[a],!!s.isNumber(i));a+=2)l=r[a+1],o.push(new S.Anchor(i,l))}var d=arguments[n-1],p=new S.Path(o,!s.isBoolean(d)||!d,!0),c=p.getBoundingClientRect();return p.center().translation.set(c.left+c.width/2,c.top+c.height/2),this.scene.add(p),p},makePolygon:function(t,n,o,r){var a=new S.Polygon(t,n,o,r);return this.scene.add(a),a},makeArcSegment:function(t,r,n,o,a,i,l){var s=new S.ArcSegment(t,r,n,o,a,i,l);return this.scene.add(s),s},makePath:function(t){var r=arguments,n=arguments.length,o=t;if(!s.isArray(t)){o=[];for(var a=0,i,l;a<n&&(i=r[a],!!s.isNumber(i));a+=2)l=r[a+1],o.push(new S.Anchor(i,l))}var d=arguments[n-1],p=new S.Path(o,!s.isBoolean(d)||!d),c=p.getBoundingClientRect();return p.center().translation.set(c.left+c.width/2,c.top+c.height/2),this.scene.add(p),p},makeText:function(t,r,n,o){var a=new S.Text(t,r,n,o);return this.add(a),a},makeLinearGradient:function(t,r,n,o){var a=g.call(arguments,4),i=new S.LinearGradient(t,r,n,o,a);return this.add(i),i},makeRadialGradient:function(t,n,o){var r=g.call(arguments,3),a=new S.RadialGradient(t,n,o,r);return this.add(a),a},makeSprite:function(t,r,n,o,a,i,l){var s=new S.Sprite(t,r,n,o,a,i);return!l||s.play(),this.add(s),s},makeImageSequence:function(t,r,n,o,a){var i=new S.ImageSequence(t,r,n,o);return!a||i.play(),this.add(i),i},makeTexture:function(t,r){var n=new S.Texture(t,r);return n},makeGroup:function(t){var r=t;r instanceof Array||(r=s.toArray(arguments));var n=new S.Group;return this.scene.add(n),n.add(r),n},interpret:function(t,r){var n=t.tagName.toLowerCase();if(!(n in S.Utils.read))return null;var o=S.Utils.read[n].call(this,t);return r&&o instanceof S.Group?this.add(o.children):this.add(o),o},load:function(t,r){var n=this,o=[],a,l;if(/.*\.svg/ig.test(t))return S.Utils.xhr(t,s.bind(function(t){var n=this;for(v.temp.innerHTML=t,l=0;l<v.temp.children.length;l++)a=v.temp.children[l],o.push(n.interpret(a));r(1>=o.length?o[0]:o,1>=v.temp.children.length?v.temp.children[0]:v.temp.children)},this)),this;for(v.temp.innerHTML=t,l=0;l<v.temp.children.length;l++)a=v.temp.children[l],o.push(n.interpret(a));return r(1>=o.length?o[0]:o,1>=v.temp.children.length?v.temp.children[0]:v.temp.children),this}});var D=v.getRequestAnimationFrame();return t.exports&&(t.exports=S),S}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=t.Utils,n=t.Registry=function(){this.map={}};r.extend(n,{}),r.extend(n.prototype,{add:function(t,r){return this.map[t]=r,this},remove:function(t){return delete this.map[t],this},get:function(t){return this.map[t]},contains:function(t){return t in this.map}})}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=t.Utils,n=t.Vector=function(t,r){this.x=t||0,this.y=r||0};r.extend(n,{zero:new t.Vector}),r.extend(n.prototype,t.Utils.Events,{set:function(t,r){return this.x=t,this.y=r,this},copy:function(t){return this.x=t.x,this.y=t.y,this},clear:function(){return this.x=0,this.y=0,this},clone:function(){return new n(this.x,this.y)},add:function(t,r){return this.x=t.x+r.x,this.y=t.y+r.y,this},addSelf:function(t){return this.x+=t.x,this.y+=t.y,this},sub:function(t,r){return this.x=t.x-r.x,this.y=t.y-r.y,this},subSelf:function(t){return this.x-=t.x,this.y-=t.y,this},multiplySelf:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this},divideScalar:function(t){return t?(this.x/=t,this.y/=t):this.set(0,0),this},negate:function(){return this.multiplyScalar(-1)},dot:function(t){return this.x*t.x+this.y*t.y},lengthSquared:function(){return this.x*this.x+this.y*this.y},length:function(){return st(this.lengthSquared())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(t){return st(this.distanceToSquared(t))},distanceToSquared:function(t){var r=this.x-t.x,n=this.y-t.y;return r*r+n*n},setLength:function(t){return this.normalize().multiplyScalar(t)},equals:function(t,r){return r='undefined'==typeof r?1e-4:r,this.distanceTo(t)<r},lerp:function(r,n){var t=(r.x-this.x)*n+this.x,o=(r.y-this.y)*n+this.y;return this.set(t,o)},isZero:function(t){return t='undefined'==typeof t?1e-4:t,this.length()<t},toString:function(){return this.x+', '+this.y},toObject:function(){return{x:this.x,y:this.y}},rotate:function(t){var r=ct(t),n=pt(t);return this.x=this.x*r-this.y*n,this.y=this.x*n+this.y*r,this}});var o={set:function(r,n){return this._x=r,this._y=n,this.trigger(t.Events.change)},copy:function(r){return this._x=r.x,this._y=r.y,this.trigger(t.Events.change)},clear:function(){return this._x=0,this._y=0,this.trigger(t.Events.change)},clone:function(){return new n(this._x,this._y)},add:function(r,n){return this._x=r.x+n.x,this._y=r.y+n.y,this.trigger(t.Events.change)},addSelf:function(r){return this._x+=r.x,this._y+=r.y,this.trigger(t.Events.change)},sub:function(r,n){return this._x=r.x-n.x,this._y=r.y-n.y,this.trigger(t.Events.change)},subSelf:function(r){return this._x-=r.x,this._y-=r.y,this.trigger(t.Events.change)},multiplySelf:function(r){return this._x*=r.x,this._y*=r.y,this.trigger(t.Events.change)},multiplyScalar:function(r){return this._x*=r,this._y*=r,this.trigger(t.Events.change)},divideScalar:function(r){return r?(this._x/=r,this._y/=r,this.trigger(t.Events.change)):this.clear()},negate:function(){return this.multiplyScalar(-1)},dot:function(t){return this._x*t.x+this._y*t.y},lengthSquared:function(){return this._x*this._x+this._y*this._y},length:function(){return st(this.lengthSquared())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(t){return st(this.distanceToSquared(t))},distanceToSquared:function(t){var r=this._x-t.x,n=this._y-t.y;return r*r+n*n},setLength:function(t){return this.normalize().multiplyScalar(t)},equals:function(t,r){return r='undefined'==typeof r?1e-4:r,this.distanceTo(t)<r},lerp:function(r,n){var t=(r.x-this._x)*n+this._x,o=(r.y-this._y)*n+this._y;return this.set(t,o)},isZero:function(t){return t='undefined'==typeof t?1e-4:t,this.length()<t},toString:function(){return this._x+', '+this._y},toObject:function(){return{x:this._x,y:this._y}},rotate:function(t){var r=ct(t),n=pt(t);return this._x=this._x*r-this._y*n,this._y=this._x*n+this._y*r,this}},a={enumerable:!0,get:function(){return this._x},set:function(r){this._x=r,this.trigger(t.Events.change,'x')}},i={enumerable:!0,get:function(){return this._y},set:function(r){this._y=r,this.trigger(t.Events.change,'y')}};t.Vector.prototype.bind=t.Vector.prototype.on=function(){return this._bound||(this._x=this.x,this._y=this.y,Object.defineProperty(this,'x',a),Object.defineProperty(this,'y',i),r.extend(this,o),this._bound=!0),t.Utils.Events.bind.apply(this,arguments),this}}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=t.Commands,n=t.Utils,o=t.Anchor=function(a,i,l,s,d,p,c){return t.Vector.call(this,a,i),this._broadcast=n.bind(function(){this.trigger(t.Events.change)},this),this._command=c||r.move,this._relative=!0,c?void(o.AppendCurveProperties(this),n.isNumber(l)&&(this.controls.left.x=l),n.isNumber(s)&&(this.controls.left.y=s),n.isNumber(d)&&(this.controls.right.x=d),n.isNumber(p)&&(this.controls.right.y=p)):this};n.extend(o,{AppendCurveProperties:function(r){r.controls={left:new t.Vector(0,0),right:new t.Vector(0,0)}}});var a={listen:function(){return n.isObject(this.controls)||o.AppendCurveProperties(this),this.controls.left.bind(t.Events.change,this._broadcast),this.controls.right.bind(t.Events.change,this._broadcast),this},ignore:function(){return this.controls.left.unbind(t.Events.change,this._broadcast),this.controls.right.unbind(t.Events.change,this._broadcast),this},clone:function(){var r=this.controls,n=new t.Anchor(this.x,this.y,r&&r.left.x,r&&r.left.y,r&&r.right.x,r&&r.right.y,this.command);return n.relative=this._relative,n},toObject:function(){var t={x:this.x,y:this.y};return this._command&&(t.command=this._command),this._relative&&(t.relative=this._relative),this.controls&&(t.controls={left:this.controls.left.toObject(),right:this.controls.right.toObject()}),t},toString:function(){return this.controls?[this._x,this._y,this.controls.left.x,this.controls.left.y,this.controls.right.x,this.controls.right.y].join(', '):[this._x,this._y].join(', ')}};Object.defineProperty(o.prototype,'command',{enumerable:!0,get:function(){return this._command},set:function(a){return this._command=a,this._command!==r.curve||n.isObject(this.controls)||o.AppendCurveProperties(this),this.trigger(t.Events.change)}}),Object.defineProperty(o.prototype,'relative',{enumerable:!0,get:function(){return this._relative},set:function(r){return this._relative==r?this:(this._relative=!!r,this.trigger(t.Events.change))}}),n.extend(o.prototype,t.Vector.prototype,a),t.Anchor.prototype.bind=t.Anchor.prototype.on=function(){t.Vector.prototype.bind.apply(this,arguments),n.extend(this,a)},t.Anchor.prototype.unbind=t.Anchor.prototype.off=function(){t.Vector.prototype.unbind.apply(this,arguments),n.extend(this,a)}}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=dt,n=t.Utils,o=t.Matrix=function(r){this.elements=new t.Array(9);var o=r;n.isArray(o)||(o=n.toArray(arguments)),this.identity().set(o)};n.extend(o,{Identity:[1,0,0,0,1,0,0,0,1],Multiply:function(r,n,o){if(3>=n.length){var i=r,l=n[0]||0,a=n[1]||0,s=n[2]||0,d,p,c;return d=i[0]*l+i[1]*a+i[2]*s,p=i[3]*l+i[4]*a+i[5]*s,c=i[6]*l+i[7]*a+i[8]*s,{x:d,y:p,z:c}}var _=r[0],u=r[1],m=r[2],g=r[3],f=r[4],h=r[5],v=r[6],S=r[7],C=r[8],k=n[0],T=n[1],P=n[2],R=n[3],E=n[4],w=n[5],A=n[6],O=n[7],M=n[8];return o=o||new t.Array(9),o[0]=_*k+u*R+m*A,o[1]=_*T+u*E+m*O,o[2]=_*P+u*w+m*M,o[3]=g*k+f*R+h*A,o[4]=g*T+f*E+h*O,o[5]=g*P+f*w+h*M,o[6]=v*k+S*R+C*A,o[7]=v*T+S*E+C*O,o[8]=v*P+S*w+C*M,o}}),n.extend(o.prototype,t.Utils.Events,{set:function(r){var o=r;return n.isArray(o)||(o=n.toArray(arguments)),n.extend(this.elements,o),this.trigger(t.Events.change)},identity:function(){return this.set(o.Identity),this},multiply:function(r,o,a,i,s){var d=arguments,p=d.length;if(1>=p)return n.each(this.elements,function(t,n){this.elements[n]=t*r},this),this.trigger(t.Events.change);if(3>=p){var l,c,_;return r=r||0,o=o||0,a=a||0,s=this.elements,l=s[0]*r+s[1]*o+s[2]*a,c=s[3]*r+s[4]*o+s[5]*a,_=s[6]*r+s[7]*o+s[8]*a,{x:l,y:c,z:_}}var u=this.elements,m=d,g=u[0],f=u[1],h=u[2],v=u[3],S=u[4],C=u[5],k=u[6],T=u[7],P=u[8],R=m[0],E=m[1],w=m[2],A=m[3],O=m[4],M=m[5],L=m[6],F=m[7],N=m[8];return this.elements[0]=g*R+f*A+h*L,this.elements[1]=g*E+f*O+h*F,this.elements[2]=g*w+f*M+h*N,this.elements[3]=v*R+S*A+C*L,this.elements[4]=v*E+S*O+C*F,this.elements[5]=v*w+S*M+C*N,this.elements[6]=k*R+T*A+P*L,this.elements[7]=k*E+T*O+P*F,this.elements[8]=k*w+T*M+P*N,this.trigger(t.Events.change)},inverse:function(r){var n=this.elements;r=r||new t.Matrix;var o=n[0],a=n[1],i=n[2],l=n[3],s=n[4],d=n[5],p=n[6],c=n[7],_=n[8],u=_*s-d*c,m=-_*l+d*p,g=c*l-s*p,y=o*u+a*m+i*g;return y?(y=1/y,r.elements[0]=u*y,r.elements[1]=(-_*a+i*c)*y,r.elements[2]=(d*a-i*s)*y,r.elements[3]=m*y,r.elements[4]=(_*o-i*p)*y,r.elements[5]=(-d*o+i*l)*y,r.elements[6]=g*y,r.elements[7]=(-c*o+a*p)*y,r.elements[8]=(s*o-a*l)*y,r):null},scale:function(t,r){var n=arguments.length;return 1>=n&&(r=t),this.multiply(t,0,0,0,r,0,0,0,1)},rotate:function(t){var r=ct(t),n=pt(t);return this.multiply(r,-n,0,n,r,0,0,0,1)},translate:function(t,r){return this.multiply(1,0,t,0,1,r,0,0,1)},skewX:function(t){var n=r(t);return this.multiply(1,n,0,0,1,0,0,0,1)},skewY:function(t){var n=r(t);return this.multiply(1,0,0,n,1,0,0,0,1)},toString:function(t){var r=[];return this.toArray(t,r),r.join(' ')},toArray:function(t,r){var n=this.elements,o=!!r,l=parseFloat(n[0].toFixed(3)),a=parseFloat(n[1].toFixed(3)),s=parseFloat(n[2].toFixed(3)),p=parseFloat(n[3].toFixed(3)),d=parseFloat(n[4].toFixed(3)),c=parseFloat(n[5].toFixed(3));if(!!t){var _=parseFloat(n[6].toFixed(3)),u=parseFloat(n[7].toFixed(3)),m=parseFloat(n[8].toFixed(3));return o?(r[0]=l,r[1]=p,r[2]=_,r[3]=a,r[4]=d,r[5]=u,r[6]=s,r[7]=c,void(r[8]=m)):[l,p,_,a,d,u,s,c,m]}return o?(r[0]=l,r[1]=p,r[2]=a,r[3]=d,r[4]=s,void(r[5]=c)):[l,p,a,d,s,c]},clone:function(){var r,n,o,a,l,s,d,p,c;return r=this.elements[0],n=this.elements[1],o=this.elements[2],a=this.elements[3],l=this.elements[4],s=this.elements[5],d=this.elements[6],p=this.elements[7],c=this.elements[8],new t.Matrix(r,n,o,a,l,s,d,p,c)}})}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=t.Utils.mod,n=t.Utils.toFixed,o=t.Utils,a={version:1.1,ns:'http://www.w3.org/2000/svg',xlink:'http://www.w3.org/1999/xlink',alignments:{left:'start',center:'middle',right:'end'},createElement:function(t,r){var n=t,i=document.createElementNS(this.ns,n);return'svg'===n&&(r=o.defaults(r||{},{version:this.version})),o.isEmpty(r)||a.setAttributes(i,r),i},setAttributes:function(t,r){for(var n=Object.keys(r),o=0;o<n.length;o++)t.setAttribute(n[o],r[n[o]]);return this},removeAttributes:function(t,r){for(var n in r)t.removeAttribute(n);return this},toString:function(o,s){for(var p=o.length,l=p-1,_='',u=0,i;u<p;u++){var d=o[u],m=s?r(u-1,p):tt(u-1,0),g=s?r(u+1,p):Je(u+1,l),f=o[m],a=o[g],c=n(d._x),h=n(d._y),y,v,x,S,C,k,T,P,R;switch(d._command){case t.Commands.close:y=t.Commands.close;break;case t.Commands.curve:k=f.controls&&f.controls.right||t.Vector.zero,T=d.controls&&d.controls.left||t.Vector.zero,f._relative?(v=n(k.x+f.x),x=n(k.y+f.y)):(v=n(k.x),x=n(k.y)),d._relative?(S=n(T.x+d.x),C=n(T.y+d.y)):(S=n(T.x),C=n(T.y)),y=(0===u?t.Commands.move:t.Commands.curve)+' '+v+' '+x+' '+S+' '+C+' '+c+' '+h;break;case t.Commands.move:i=d,y=t.Commands.move+' '+c+' '+h;break;default:y=d._command+' '+c+' '+h;}u>=l&&s&&(d._command===t.Commands.curve&&(a=i,P=d.controls&&d.controls.right||d,R=a.controls&&a.controls.left||a,d._relative?(v=n(P.x+d.x),x=n(P.y+d.y)):(v=n(P.x),x=n(P.y)),a._relative?(S=n(R.x+a.x),C=n(R.y+a.y)):(S=n(R.x),C=n(R.y)),c=n(a.x),h=n(a.y),y+=' C '+v+' '+x+' '+S+' '+C+' '+c+' '+h),y+=' Z'),_+=y+' '}return _},getClip:function(t){var r=t._renderer.clip;if(!r){for(var n=t;n.parent;)n=n.parent;r=t._renderer.clip=a.createElement('clipPath'),n.defs.appendChild(r)}return r},group:{appendChild:function(t){var r=t._renderer.elem;if(r){var n=r.nodeName;!n||/(radial|linear)gradient/i.test(n)||t._clip||this.elem.appendChild(r)}},removeChild:function(t){var r=t._renderer.elem;if(r&&r.parentNode==this.elem){var n=r.nodeName;!n||t._clip||this.elem.removeChild(r)}},orderChild:function(t){this.elem.appendChild(t._renderer.elem)},renderChild:function(t){a[t._renderer.type].render.call(t,this)},render:function(t){var r=this;if(this._update(),0===this._opacity&&!this._flagOpacity)return this;this._renderer.elem||(this._renderer.elem=a.createElement('g',{id:this.id}),t.appendChild(this._renderer.elem));var n=this._matrix.manual||this._flagMatrix,o={domElement:t,elem:this._renderer.elem};n&&this._renderer.elem.setAttribute('transform','matrix('+this._matrix.toString()+')');for(var l=0,i;l<this.children.length;l++)i=r.children[l],a[i._renderer.type].render.call(i,t);return this._flagOpacity&&this._renderer.elem.setAttribute('opacity',this._opacity),this._flagAdditions&&this.additions.forEach(a.group.appendChild,o),this._flagSubtractions&&this.subtractions.forEach(a.group.removeChild,o),this._flagOrder&&this.children.forEach(a.group.orderChild,o),this._flagMask&&(this._mask?this._renderer.elem.setAttribute('clip-path','url(#'+this._mask.id+')'):this._renderer.elem.removeAttribute('clip-path')),this.flagReset()}},path:{render:function(t){if(this._update(),0===this._opacity&&!this._flagOpacity)return this;var r={},n=this._matrix.manual||this._flagMatrix;if(n&&(r.transform='matrix('+this._matrix.toString()+')'),this._flagVertices){var o=a.toString(this._vertices,this._closed);r.d=o}if(this._fill&&this._fill._renderer&&(this._fill._update(),a[this._fill._renderer.type].render.call(this._fill,t,!0)),this._flagFill&&(r.fill=this._fill&&this._fill.id?'url(#'+this._fill.id+')':this._fill),this._stroke&&this._stroke._renderer&&(this._stroke._update(),a[this._stroke._renderer.type].render.call(this._stroke,t,!0)),this._flagStroke&&(r.stroke=this._stroke&&this._stroke.id?'url(#'+this._stroke.id+')':this._stroke),this._flagLinewidth&&(r['stroke-width']=this._linewidth),this._flagOpacity&&(r['stroke-opacity']=this._opacity,r['fill-opacity']=this._opacity),this._flagVisible&&(r.visibility=this._visible?'visible':'hidden'),this._flagCap&&(r['stroke-linecap']=this._cap),this._flagJoin&&(r['stroke-linejoin']=this._join),this._flagMiter&&(r['stroke-miterlimit']=this._miter),this._renderer.elem?a.setAttributes(this._renderer.elem,r):(r.id=this.id,this._renderer.elem=a.createElement('path',r),t.appendChild(this._renderer.elem)),this._flagClip){var i=a.getClip(this),l=this._renderer.elem;this._clip?(l.removeAttribute('id'),i.setAttribute('id',this.id),i.appendChild(l)):(i.removeAttribute('id'),l.setAttribute('id',this.id),this.parent._renderer.elem.appendChild(l))}return this.flagReset()}},text:{render:function(t){this._update();var r={},n=this._matrix.manual||this._flagMatrix;if(n&&(r.transform='matrix('+this._matrix.toString()+')'),this._flagFamily&&(r['font-family']=this._family),this._flagSize&&(r['font-size']=this._size),this._flagLeading&&(r['line-height']=this._leading),this._flagAlignment&&(r['text-anchor']=a.alignments[this._alignment]||this._alignment),this._flagBaseline&&(r['alignment-baseline']=r['dominant-baseline']=this._baseline),this._flagStyle&&(r['font-style']=this._style),this._flagWeight&&(r['font-weight']=this._weight),this._flagDecoration&&(r['text-decoration']=this._decoration),this._fill&&this._fill._renderer&&(this._fill._update(),a[this._fill._renderer.type].render.call(this._fill,t,!0)),this._flagFill&&(r.fill=this._fill&&this._fill.id?'url(#'+this._fill.id+')':this._fill),this._stroke&&this._stroke._renderer&&(this._stroke._update(),a[this._stroke._renderer.type].render.call(this._stroke,t,!0)),this._flagStroke&&(r.stroke=this._stroke&&this._stroke.id?'url(#'+this._stroke.id+')':this._stroke),this._flagLinewidth&&(r['stroke-width']=this._linewidth),this._flagOpacity&&(r.opacity=this._opacity),this._flagVisible&&(r.visibility=this._visible?'visible':'hidden'),this._renderer.elem?a.setAttributes(this._renderer.elem,r):(r.id=this.id,this._renderer.elem=a.createElement('text',r),t.defs.appendChild(this._renderer.elem)),this._flagClip){var o=a.getClip(this),i=this._renderer.elem;this._clip?(i.removeAttribute('id'),o.setAttribute('id',this.id),o.appendChild(i)):(o.removeAttribute('id'),i.setAttribute('id',this.id),this.parent._renderer.elem.appendChild(i))}return this._flagValue&&(this._renderer.elem.textContent=this._value),this.flagReset()}},"linear-gradient":{render:function(t,r){var n=this;r||this._update();var o={};if(this._flagEndPoints&&(o.x1=this.left._x,o.y1=this.left._y,o.x2=this.right._x,o.y2=this.right._y),this._flagSpread&&(o.spreadMethod=this._spread),this._renderer.elem?a.setAttributes(this._renderer.elem,o):(o.id=this.id,o.gradientUnits='userSpaceOnUse',this._renderer.elem=a.createElement('linearGradient',o),t.defs.appendChild(this._renderer.elem)),this._flagStops){var l=this._renderer.elem.childNodes.length!==this.stops.length;l&&(this._renderer.elem.childNodes.length=0);for(var s=0;s<this.stops.length;s++){var i=n.stops[s],d={};i._flagOffset&&(d.offset=100*i._offset+'%'),i._flagColor&&(d['stop-color']=i._color),i._flagOpacity&&(d['stop-opacity']=i._opacity),i._renderer.elem?a.setAttributes(i._renderer.elem,d):i._renderer.elem=a.createElement('stop',d),l&&n._renderer.elem.appendChild(i._renderer.elem),i.flagReset()}}return this.flagReset()}},"radial-gradient":{render:function(t,r){var n=this;r||this._update();var o={};if(this._flagCenter&&(o.cx=this.center._x,o.cy=this.center._y),this._flagFocal&&(o.fx=this.focal._x,o.fy=this.focal._y),this._flagRadius&&(o.r=this._radius),this._flagSpread&&(o.spreadMethod=this._spread),this._renderer.elem?a.setAttributes(this._renderer.elem,o):(o.id=this.id,o.gradientUnits='userSpaceOnUse',this._renderer.elem=a.createElement('radialGradient',o),t.defs.appendChild(this._renderer.elem)),this._flagStops){var l=this._renderer.elem.childNodes.length!==this.stops.length;l&&(this._renderer.elem.childNodes.length=0);for(var s=0;s<this.stops.length;s++){var i=n.stops[s],d={};i._flagOffset&&(d.offset=100*i._offset+'%'),i._flagColor&&(d['stop-color']=i._color),i._flagOpacity&&(d['stop-opacity']=i._opacity),i._renderer.elem?a.setAttributes(i._renderer.elem,d):i._renderer.elem=a.createElement('stop',d),l&&n._renderer.elem.appendChild(i._renderer.elem),i.flagReset()}}return this.flagReset()}},texture:{render:function(r,n){n||this._update();var i={},l={},s=this.image;if(this._flagLoaded&&this.loaded)switch(s.nodeName.toLowerCase()){case'canvas':l.href=s.toDataURL('image/png');break;case'img':case'image':l.href=this.src;}if((this._flagOffset||this._flagLoaded||this._flagScale)&&(i.x=this._offset.x,i.y=this._offset.y,s&&(i.x-=s.width/2,i.y-=s.height/2,this._scale instanceof t.Vector?(i.x*=this._scale.x,i.y*=this._scale.y):(i.x*=this._scale,i.y*=this._scale))),(this._flagScale||this._flagLoaded||this._flagRepeat)&&(i.width=0,i.height=0,s)){switch(l.width=i.width=s.width,l.height=i.height=s.height,this._repeat){case'no-repeat':i.width+=1,i.height+=1;}this._scale instanceof t.Vector?(i.width*=this._scale.x,i.height*=this._scale.y):(i.width*=this._scale,i.height*=this._scale)}return(this._flagScale||this._flagLoaded)&&(this._renderer.image?!o.isEmpty(l)&&a.setAttributes(this._renderer.image,l):this._renderer.image=a.createElement('image',l)),this._renderer.elem?!o.isEmpty(i)&&a.setAttributes(this._renderer.elem,i):(i.id=this.id,i.patternUnits='userSpaceOnUse',this._renderer.elem=a.createElement('pattern',i),r.defs.appendChild(this._renderer.elem)),this._renderer.elem&&this._renderer.image&&!this._renderer.appended&&(this._renderer.elem.appendChild(this._renderer.image),this._renderer.appended=!0),this.flagReset()}}},i=t[t.Types.svg]=function(r){this.domElement=r.domElement||a.createElement('svg'),this.scene=new t.Group,this.scene.parent=this,this.defs=a.createElement('defs'),this.domElement.appendChild(this.defs),this.domElement.defs=this.defs,this.domElement.style.overflow='hidden'};o.extend(i,{Utils:a}),o.extend(i.prototype,t.Utils.Events,{setSize:function(t,r){return this.width=t,this.height=r,a.setAttributes(this.domElement,{width:t,height:r}),this},render:function(){return a.group.render.call(this.scene,this.domElement),this}})}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=t.Utils.mod,n=t.Utils.toFixed,o=t.Utils.getRatio,l=t.Utils,s=function(t){return 1==t[0]&&0==t[3]&&0==t[1]&&1==t[4]&&0==t[2]&&0==t[5]},p={isHidden:/(none|transparent)/i,alignments:{left:'start',middle:'center',right:'end'},shim:function(t){return t.tagName='canvas',t.nodeType=1,t},group:{renderChild:function(t){p[t._renderer.type].render.call(t,this.ctx,!0,this.clip)},render:function(t){var r=this;this._update();var n=this._matrix.elements,o=this.parent;this._renderer.opacity=this._opacity*(o&&o._renderer?o._renderer.opacity:1);var a=s(n),l=this._mask;this._renderer.context||(this._renderer.context={}),this._renderer.context.ctx=t,a||(t.save(),t.transform(n[0],n[3],n[1],n[4],n[2],n[5])),l&&p[l._renderer.type].render.call(l,t,!0);for(var d=0,i;d<this.children.length;d++)i=r.children[d],p[i._renderer.type].render.call(i,t);return a||t.restore(),this.flagReset()}},path:{render:function(o,_,u){var m,g,f,h,v,S,C,k,T,P,R,E,w,A,O,M,a,L,c,d,z,F,N,U,D,I,G,V,x,y,B,j;if(this._update(),m=this._matrix.elements,g=this._stroke,f=this._linewidth,h=this._fill,v=this._opacity*this.parent._renderer.opacity,S=this._visible,C=this._cap,k=this._join,T=this._miter,P=this._closed,R=this._vertices,E=R.length,w=E-1,B=s(m),y=this._clip,!_&&(!S||y))return this;B||(o.save(),o.transform(m[0],m[3],m[1],m[4],m[2],m[5])),h&&(l.isString(h)?o.fillStyle=h:(p[h._renderer.type].render.call(h,o),o.fillStyle=h._renderer.effect)),g&&(l.isString(g)?o.strokeStyle=g:(p[g._renderer.type].render.call(g,o),o.strokeStyle=g._renderer.effect)),f&&(o.lineWidth=f),T&&(o.miterLimit=T),k&&(o.lineJoin=k),C&&(o.lineCap=C),l.isNumber(v)&&(o.globalAlpha=v),o.beginPath();for(var H=0;H<R.length;H++)switch(a=R[H],V=n(a._x),x=n(a._y),a._command){case t.Commands.close:o.closePath();break;case t.Commands.curve:O=P?r(H-1,E):tt(H-1,0),A=P?r(H+1,E):Je(H+1,w),M=R[O],L=R[A],U=M.controls&&M.controls.right||t.Vector.zero,D=a.controls&&a.controls.left||t.Vector.zero,M._relative?(F=U.x+n(M._x),N=U.y+n(M._y)):(F=n(U.x),N=n(U.y)),a._relative?(d=D.x+n(a._x),z=D.y+n(a._y)):(d=n(D.x),z=n(D.y)),o.bezierCurveTo(F,N,d,z,V,x),H>=w&&P&&(L=c,I=a.controls&&a.controls.right||t.Vector.zero,G=L.controls&&L.controls.left||t.Vector.zero,a._relative?(F=I.x+n(a._x),N=I.y+n(a._y)):(F=n(I.x),N=n(I.y)),L._relative?(d=G.x+n(L._x),z=G.y+n(L._y)):(d=n(G.x),z=n(G.y)),V=n(L._x),x=n(L._y),o.bezierCurveTo(F,N,d,z,V,x));break;case t.Commands.line:o.lineTo(V,x);break;case t.Commands.move:c=a,o.moveTo(V,x);}return P&&o.closePath(),y||u||(!p.isHidden.test(h)&&(j=h._renderer&&h._renderer.offset,j&&(o.save(),o.translate(-h._renderer.offset.x,-h._renderer.offset.y),o.scale(h._renderer.scale.x,h._renderer.scale.y)),o.fill(),j&&o.restore()),!p.isHidden.test(g)&&(j=g._renderer&&g._renderer.offset,j&&(o.save(),o.translate(-g._renderer.offset.x,-g._renderer.offset.y),o.scale(g._renderer.scale.x,g._renderer.scale.y),o.lineWidth=f/g._renderer.scale.x),o.stroke(),j&&o.restore())),B||o.restore(),y&&!u&&o.clip(),this.flagReset()}},text:{render:function(t,r,o){this._update();var i=this._matrix.elements,_=this._stroke,u=this._linewidth,m=this._fill,g=this._opacity*this.parent._renderer.opacity,y=this._visible,f=s(i),h=m._renderer&&m._renderer.offset&&_._renderer&&_._renderer.offset,v=this._clip,x,a,S,c,d,C,k;return r||y&&!v?(f||(t.save(),t.transform(i[0],i[3],i[1],i[4],i[2],i[5])),h||(t.font=[this._style,this._weight,this._size+'px/'+this._leading+'px',this._family].join(' ')),t.textAlign=p.alignments[this._alignment]||this._alignment,t.textBaseline=this._baseline,m&&(l.isString(m)?t.fillStyle=m:(p[m._renderer.type].render.call(m,t),t.fillStyle=m._renderer.effect)),_&&(l.isString(_)?t.strokeStyle=_:(p[_._renderer.type].render.call(_,t),t.strokeStyle=_._renderer.effect)),u&&(t.lineWidth=u),l.isNumber(g)&&(t.globalAlpha=g),v||o||(!p.isHidden.test(m)&&(m._renderer&&m._renderer.offset?(C=n(m._renderer.scale.x),k=n(m._renderer.scale.y),t.save(),t.translate(-n(m._renderer.offset.x),-n(m._renderer.offset.y)),t.scale(C,k),x=this._size/m._renderer.scale.y,a=this._leading/m._renderer.scale.y,t.font=[this._style,this._weight,n(x)+'px/',n(a)+'px',this._family].join(' '),S=m._renderer.offset.x/m._renderer.scale.x,c=m._renderer.offset.y/m._renderer.scale.y,t.fillText(this.value,n(S),n(c)),t.restore()):t.fillText(this.value,0,0)),!p.isHidden.test(_)&&(_._renderer&&_._renderer.offset?(C=n(_._renderer.scale.x),k=n(_._renderer.scale.y),t.save(),t.translate(-n(_._renderer.offset.x),-n(_._renderer.offset.y)),t.scale(C,k),x=this._size/_._renderer.scale.y,a=this._leading/_._renderer.scale.y,t.font=[this._style,this._weight,n(x)+'px/',n(a)+'px',this._family].join(' '),S=_._renderer.offset.x/_._renderer.scale.x,c=_._renderer.offset.y/_._renderer.scale.y,d=u/_._renderer.scale.x,t.lineWidth=n(d),t.strokeText(this.value,n(S),n(c)),t.restore()):t.strokeText(this.value,0,0))),f||t.restore(),v&&!o&&t.clip(),this.flagReset()):this}},"linear-gradient":{render:function(t){var r=this;if(this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops){this._renderer.effect=t.createLinearGradient(this.left._x,this.left._y,this.right._x,this.right._y);for(var n=0,o;n<this.stops.length;n++)o=r.stops[n],r._renderer.effect.addColorStop(o._offset,o._color)}return this.flagReset()}},"radial-gradient":{render:function(t){var r=this;if(this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops){this._renderer.effect=t.createRadialGradient(this.center._x,this.center._y,0,this.focal._x,this.focal._y,this._radius);for(var n=0,o;n<this.stops.length;n++)o=r.stops[n],r._renderer.effect.addColorStop(o._offset,o._color)}return this.flagReset()}},texture:{render:function(r){this._update();var n=this.image;return(!this._renderer.effect||(this._flagLoaded||this._flagImage||this._flagRepeat)&&this.loaded)&&(this._renderer.effect=r.createPattern(this.image,this._repeat)),(this._flagOffset||this._flagLoaded||this._flagScale)&&(!(this._renderer.offset instanceof t.Vector)&&(this._renderer.offset=new t.Vector),this._renderer.offset.x=this._offset.x,this._renderer.offset.y=this._offset.y,n&&(this._renderer.offset.x-=n.width/2,this._renderer.offset.y+=n.height/2,this._scale instanceof t.Vector?(this._renderer.offset.x*=this._scale.x,this._renderer.offset.y*=this._scale.y):(this._renderer.offset.x*=this._scale,this._renderer.offset.y*=this._scale))),(this._flagScale||this._flagLoaded)&&(!(this._renderer.scale instanceof t.Vector)&&(this._renderer.scale=new t.Vector),this._scale instanceof t.Vector?this._renderer.scale.copy(this._scale):this._renderer.scale.set(this._scale,this._scale)),this.flagReset()}}},a=t[t.Types.canvas]=function(r){var n=!1!==r.smoothing;this.domElement=r.domElement||document.createElement('canvas'),this.ctx=this.domElement.getContext('2d'),this.overdraw=r.overdraw||!1,l.isUndefined(this.ctx.imageSmoothingEnabled)||(this.ctx.imageSmoothingEnabled=n),this.scene=new t.Group,this.scene.parent=this};l.extend(a,{Utils:p}),l.extend(a.prototype,t.Utils.Events,{setSize:function(t,r,n){return this.width=t,this.height=r,this.ratio=l.isUndefined(n)?o(this.ctx):n,this.domElement.width=t*this.ratio,this.domElement.height=r*this.ratio,this.domElement.style&&l.extend(this.domElement.style,{width:t+'px',height:r+'px'}),this},render:function(){var t=1===this.ratio;return t||(this.ctx.save(),this.ctx.scale(this.ratio,this.ratio)),this.overdraw||this.ctx.clearRect(0,0,this.width,this.height),p.group.render.call(this.scene,this.ctx),t||this.ctx.restore(),this}})}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=t.root,n=t.Matrix.Multiply,o=t.Utils.mod,a=[1,0,0,0,1,0,0,0,1],l=new t.Array(9),i=t.Utils.getRatio,s=t.Utils.getComputedMatrix,p=t.Utils.toFixed,u=t.Utils,_={isHidden:/(none|transparent)/i,canvas:r.document?r.document.createElement('canvas'):{getContext:u.identity},alignments:{left:'start',middle:'center',right:'end'},matrix:new t.Matrix,uv:new t.Array([0,0,1,0,0,1,0,1,1,0,1,1]),group:{removeChild:function(t,r){if(t.children){for(var n=0;n<t.children.length;n++)_.group.removeChild(t.children[n],r);return}r.deleteTexture(t._renderer.texture),delete t._renderer.texture},renderChild:function(t){_[t._renderer.type].render.call(t,this.gl,this.program)},render:function(r,o){var a=this;this._update();var s=this.parent,d=s._matrix&&s._matrix.manual||s._flagMatrix,p=this._matrix.manual||this._flagMatrix;if((d||p)&&(!this._renderer.matrix&&(this._renderer.matrix=new t.Array(9)),this._matrix.toArray(!0,l),n(l,s._renderer.matrix,this._renderer.matrix),this._renderer.scale=this._scale*s._renderer.scale,d&&(this._flagMatrix=!0)),this._mask&&(r.enable(r.STENCIL_TEST),r.stencilFunc(r.ALWAYS,1,1),r.colorMask(!1,!1,!1,!0),r.stencilOp(r.KEEP,r.KEEP,r.INCR),_[this._mask._renderer.type].render.call(this._mask,r,o,this),r.colorMask(!0,!0,!0,!0),r.stencilFunc(r.NOTEQUAL,0,1),r.stencilOp(r.KEEP,r.KEEP,r.KEEP)),this._flagOpacity=s._flagOpacity||this._flagOpacity,this._renderer.opacity=this._opacity*(s&&s._renderer?s._renderer.opacity:1),this._flagSubtractions)for(var c=0;c<this.subtractions.length;c++)_.group.removeChild(a.subtractions[c],r);return this.children.forEach(_.group.renderChild,{gl:r,program:o}),this._mask&&(r.colorMask(!1,!1,!1,!1),r.stencilOp(r.KEEP,r.KEEP,r.DECR),_[this._mask._renderer.type].render.call(this._mask,r,o,this),r.colorMask(!0,!0,!0,!0),r.stencilFunc(r.NOTEQUAL,0,1),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),r.disable(r.STENCIL_TEST)),this.flagReset()}},path:{updateCanvas:function(r){var n=r._vertices,l=this.canvas,s=this.ctx,m=r._renderer.scale,g=r._stroke,f=r._linewidth,h=r._fill,v=r._renderer.opacity||r._opacity,S=r._cap,C=r._join,k=r._miter,T=r._closed,P=n.length,R=P-1,E,w,A,a,c,O,M,L,z,F,N,U,D,x,y;l.width=tt(et(r._renderer.rect.width*m),1),l.height=tt(et(r._renderer.rect.height*m),1);var I=r._renderer.rect.centroid,G=I.x,V=I.y;s.clearRect(0,0,l.width,l.height),h&&(u.isString(h)?s.fillStyle=h:(_[h._renderer.type].render.call(h,s,r),s.fillStyle=h._renderer.effect)),g&&(u.isString(g)?s.strokeStyle=g:(_[g._renderer.type].render.call(g,s,r),s.strokeStyle=g._renderer.effect)),f&&(s.lineWidth=f),k&&(s.miterLimit=k),C&&(s.lineJoin=C),S&&(s.lineCap=S),u.isNumber(v)&&(s.globalAlpha=v);var B;s.save(),s.scale(m,m),s.translate(G,V),s.beginPath();for(var d=0;d<n.length;d++)switch(b=n[d],D=p(b._x),x=p(b._y),b._command){case t.Commands.close:s.closePath();break;case t.Commands.curve:w=T?o(d-1,P):tt(d-1,0),E=T?o(d+1,P):Je(d+1,R),A=n[w],a=n[E],z=A.controls&&A.controls.right||t.Vector.zero,F=b.controls&&b.controls.left||t.Vector.zero,A._relative?(M=p(z.x+A._x),L=p(z.y+A._y)):(M=p(z.x),L=p(z.y)),b._relative?(c=p(F.x+b._x),O=p(F.y+b._y)):(c=p(F.x),O=p(F.y)),s.bezierCurveTo(M,L,c,O,D,x),d>=R&&T&&(a=B,N=b.controls&&b.controls.right||t.Vector.zero,U=a.controls&&a.controls.left||t.Vector.zero,b._relative?(M=p(N.x+b._x),L=p(N.y+b._y)):(M=p(N.x),L=p(N.y)),a._relative?(c=p(U.x+a._x),O=p(U.y+a._y)):(c=p(U.x),O=p(U.y)),D=p(a._x),x=p(a._y),s.bezierCurveTo(M,L,c,O,D,x));break;case t.Commands.line:s.lineTo(D,x);break;case t.Commands.move:B=b,s.moveTo(D,x);}T&&s.closePath(),_.isHidden.test(h)||(y=h._renderer&&h._renderer.offset,y&&(s.save(),s.translate(-h._renderer.offset.x,-h._renderer.offset.y),s.scale(h._renderer.scale.x,h._renderer.scale.y)),s.fill(),y&&s.restore()),_.isHidden.test(g)||(y=g._renderer&&g._renderer.offset,y&&(s.save(),s.translate(-g._renderer.offset.x,-g._renderer.offset.y),s.scale(g._renderer.scale.x,g._renderer.scale.y),s.lineWidth=f/g._renderer.scale.x),s.stroke(),y&&s.restore()),s.restore()},getBoundingClientRect:function(t,r,n){var o=Infinity,i=-Infinity,l=Infinity,s=-Infinity,a,d;t.forEach(function(t){var r=t.x,n=t.y,p=t.controls,_,a,u,c,d,m;(l=Je(n,l),o=Je(r,o),i=tt(r,i),s=tt(n,s),!!t.controls)&&(d=p.left,m=p.right,d&&m)&&(_=t._relative?d.x+r:d.x,a=t._relative?d.y+n:d.y,u=t._relative?m.x+r:m.x,c=t._relative?m.y+n:m.y,_&&a&&u&&c&&(l=Je(a,c,l),o=Je(_,u,o),i=tt(_,u,i),s=tt(a,c,s)))}),u.isNumber(r)&&(l-=r,o-=r,i+=r,s+=r),a=i-o,d=s-l,n.top=l,n.left=o,n.right=i,n.bottom=s,n.width=a,n.height=d,n.centroid||(n.centroid={}),n.centroid.x=-o,n.centroid.y=-l},render:function(r,o,a){if(!this._visible||!this._opacity)return this;this._update();var i=this.parent,s=i._matrix.manual||i._flagMatrix,d=this._matrix.manual||this._flagMatrix,p=this._flagVertices||this._flagFill||this._fill instanceof t.LinearGradient&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof t.RadialGradient&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof t.Texture&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof t.LinearGradient&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof t.RadialGradient&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof t.Texture&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||i._flagOpacity||this._flagVisible||this._flagCap||this._flagJoin||this._flagMiter||this._flagScale||!this._renderer.texture;if((s||d)&&(!this._renderer.matrix&&(this._renderer.matrix=new t.Array(9)),this._matrix.toArray(!0,l),n(l,i._renderer.matrix,this._renderer.matrix),this._renderer.scale=this._scale*i._renderer.scale),p&&(!this._renderer.rect&&(this._renderer.rect={}),!this._renderer.triangles&&(this._renderer.triangles=new t.Array(12)),this._renderer.opacity=this._opacity*i._renderer.opacity,_.path.getBoundingClientRect(this._vertices,this._linewidth,this._renderer.rect),_.getTriangles(this._renderer.rect,this._renderer.triangles),_.updateBuffer.call(_,r,this,o),_.updateTexture.call(_,r,this)),!this._clip||a)return r.bindBuffer(r.ARRAY_BUFFER,this._renderer.textureCoordsBuffer),r.vertexAttribPointer(o.textureCoords,2,r.FLOAT,!1,0,0),r.bindTexture(r.TEXTURE_2D,this._renderer.texture),r.uniformMatrix3fv(o.matrix,!1,this._renderer.matrix),r.bindBuffer(r.ARRAY_BUFFER,this._renderer.buffer),r.vertexAttribPointer(o.position,2,r.FLOAT,!1,0,0),r.drawArrays(r.TRIANGLES,0,6),this.flagReset()}},text:{updateCanvas:function(t){var r=this.canvas,n=this.ctx,o=t._renderer.scale,i=t._stroke,l=t._linewidth*o,s=t._fill,m=t._renderer.opacity||t._opacity;r.width=tt(et(t._renderer.rect.width*o),1),r.height=tt(et(t._renderer.rect.height*o),1);var g=t._renderer.rect.centroid,y=g.x,f=g.y,h=s._renderer&&s._renderer.offset&&i._renderer&&i._renderer.offset,v,a,x,c,d,S,C;n.clearRect(0,0,r.width,r.height),h||(n.font=[t._style,t._weight,t._size+'px/'+t._leading+'px',t._family].join(' ')),n.textAlign='center',n.textBaseline='middle',s&&(u.isString(s)?n.fillStyle=s:(_[s._renderer.type].render.call(s,n,t),n.fillStyle=s._renderer.effect)),i&&(u.isString(i)?n.strokeStyle=i:(_[i._renderer.type].render.call(i,n,t),n.strokeStyle=i._renderer.effect)),l&&(n.lineWidth=l),u.isNumber(m)&&(n.globalAlpha=m),n.save(),n.scale(o,o),n.translate(y,f),_.isHidden.test(s)||(s._renderer&&s._renderer.offset?(S=p(s._renderer.scale.x),C=p(s._renderer.scale.y),n.save(),n.translate(-p(s._renderer.offset.x),-p(s._renderer.offset.y)),n.scale(S,C),v=t._size/s._renderer.scale.y,a=t._leading/s._renderer.scale.y,n.font=[t._style,t._weight,p(v)+'px/',p(a)+'px',t._family].join(' '),x=s._renderer.offset.x/s._renderer.scale.x,c=s._renderer.offset.y/s._renderer.scale.y,n.fillText(t.value,p(x),p(c)),n.restore()):n.fillText(t.value,0,0)),_.isHidden.test(i)||(i._renderer&&i._renderer.offset?(S=p(i._renderer.scale.x),C=p(i._renderer.scale.y),n.save(),n.translate(-p(i._renderer.offset.x),-p(i._renderer.offset.y)),n.scale(S,C),v=t._size/i._renderer.scale.y,a=t._leading/i._renderer.scale.y,n.font=[t._style,t._weight,p(v)+'px/',p(a)+'px',t._family].join(' '),x=i._renderer.offset.x/i._renderer.scale.x,c=i._renderer.offset.y/i._renderer.scale.y,d=l/i._renderer.scale.x,n.lineWidth=p(d),n.strokeText(t.value,p(x),p(c)),n.restore()):n.strokeText(t.value,0,0)),n.restore()},getBoundingClientRect:function(t,r){var n=_.ctx;n.font=[t._style,t._weight,t._size+'px/'+t._leading+'px',t._family].join(' '),n.textAlign='center',n.textBaseline=t._baseline;var o=n.measureText(t._value).width,a=tt(t._size||t._leading);this._linewidth&&!_.isHidden.test(this._stroke)&&(a+=this._linewidth);var i=o/2,l=a/2;switch(_.alignments[t._alignment]||t._alignment){case _.alignments.left:r.left=0,r.right=o;break;case _.alignments.right:r.left=-o,r.right=0;break;default:r.left=-i,r.right=i;}switch(t._baseline){case'bottom':r.top=-a,r.bottom=0;break;case'top':r.top=0,r.bottom=a;break;default:r.top=-l,r.bottom=l;}r.width=o,r.height=a,r.centroid||(r.centroid={}),r.centroid.x=i,r.centroid.y=l},render:function(r,o,a){if(!this._visible||!this._opacity)return this;this._update();var i=this.parent,s=i._matrix.manual||i._flagMatrix,d=this._matrix.manual||this._flagMatrix,p=this._flagVertices||this._flagFill||this._fill instanceof t.LinearGradient&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof t.RadialGradient&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof t.Texture&&this._fill._flagLoaded&&this._fill.loaded||this._stroke instanceof t.LinearGradient&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof t.RadialGradient&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._texture instanceof t.Texture&&this._texture._flagLoaded&&this._texture.loaded||this._flagStroke||this._flagLinewidth||this._flagOpacity||i._flagOpacity||this._flagVisible||this._flagScale||this._flagValue||this._flagFamily||this._flagSize||this._flagLeading||this._flagAlignment||this._flagBaseline||this._flagStyle||this._flagWeight||this._flagDecoration||!this._renderer.texture;if((s||d)&&(!this._renderer.matrix&&(this._renderer.matrix=new t.Array(9)),this._matrix.toArray(!0,l),n(l,i._renderer.matrix,this._renderer.matrix),this._renderer.scale=this._scale*i._renderer.scale),p&&(!this._renderer.rect&&(this._renderer.rect={}),!this._renderer.triangles&&(this._renderer.triangles=new t.Array(12)),this._renderer.opacity=this._opacity*i._renderer.opacity,_.text.getBoundingClientRect(this,this._renderer.rect),_.getTriangles(this._renderer.rect,this._renderer.triangles),_.updateBuffer.call(_,r,this,o),_.updateTexture.call(_,r,this)),!this._clip||a)return r.bindBuffer(r.ARRAY_BUFFER,this._renderer.textureCoordsBuffer),r.vertexAttribPointer(o.textureCoords,2,r.FLOAT,!1,0,0),r.bindTexture(r.TEXTURE_2D,this._renderer.texture),r.uniformMatrix3fv(o.matrix,!1,this._renderer.matrix),r.bindBuffer(r.ARRAY_BUFFER,this._renderer.buffer),r.vertexAttribPointer(o.position,2,r.FLOAT,!1,0,0),r.drawArrays(r.TRIANGLES,0,6),this.flagReset()}},"linear-gradient":{render:function(t){var r=this;if(t.canvas.getContext('2d')){if(this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops){this._renderer.effect=t.createLinearGradient(this.left._x,this.left._y,this.right._x,this.right._y);for(var n=0,o;n<this.stops.length;n++)o=r.stops[n],r._renderer.effect.addColorStop(o._offset,o._color)}return this.flagReset()}}},"radial-gradient":{render:function(t){var r=this;if(t.canvas.getContext('2d')){if(this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops){this._renderer.effect=t.createRadialGradient(this.center._x,this.center._y,0,this.focal._x,this.focal._y,this._radius);for(var n=0,o;n<this.stops.length;n++)o=r.stops[n],r._renderer.effect.addColorStop(o._offset,o._color)}return this.flagReset()}}},texture:{render:function(r){if(r.canvas.getContext('2d')){this._update();var n=this.image;return(!this._renderer.effect||(this._flagLoaded||this._flagRepeat)&&this.loaded)&&(this._renderer.effect=r.createPattern(n,this._repeat)),(this._flagOffset||this._flagLoaded||this._flagScale)&&(!(this._renderer.offset instanceof t.Vector)&&(this._renderer.offset=new t.Vector),this._renderer.offset.x=this._offset.x,this._renderer.offset.y=this._offset.y,n&&(this._renderer.offset.x-=n.width/2,this._renderer.offset.y+=n.height/2,this._scale instanceof t.Vector?(this._renderer.offset.x*=this._scale.x,this._renderer.offset.y*=this._scale.y):(this._renderer.offset.x*=this._scale,this._renderer.offset.y*=this._scale))),(this._flagScale||this._flagLoaded)&&(!(this._renderer.scale instanceof t.Vector)&&(this._renderer.scale=new t.Vector),this._scale instanceof t.Vector?this._renderer.scale.copy(this._scale):this._renderer.scale.set(this._scale,this._scale)),this.flagReset()}}},getTriangles:function(t,r){var n=t.top,o=t.left,a=t.right,i=t.bottom;r[0]=o,r[1]=n,r[2]=a,r[3]=n,r[4]=o,r[5]=i,r[6]=o,r[7]=i,r[8]=a,r[9]=n,r[10]=a,r[11]=i},updateTexture:function(t,r){this[r._renderer.type].updateCanvas.call(_,r),r._renderer.texture&&t.deleteTexture(r._renderer.texture),t.bindBuffer(t.ARRAY_BUFFER,r._renderer.textureCoordsBuffer),r._renderer.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,r._renderer.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),0>=this.canvas.width||0>=this.canvas.height||t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this.canvas)},updateBuffer:function(t,r,n){u.isObject(r._renderer.buffer)&&t.deleteBuffer(r._renderer.buffer),r._renderer.buffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,r._renderer.buffer),t.enableVertexAttribArray(n.position),t.bufferData(t.ARRAY_BUFFER,r._renderer.triangles,t.STATIC_DRAW),u.isObject(r._renderer.textureCoordsBuffer)&&t.deleteBuffer(r._renderer.textureCoordsBuffer),r._renderer.textureCoordsBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,r._renderer.textureCoordsBuffer),t.enableVertexAttribArray(n.textureCoords),t.bufferData(t.ARRAY_BUFFER,this.uv,t.STATIC_DRAW)},program:{create:function(r,n){var o,a,i;if(o=r.createProgram(),u.each(n,function(t){r.attachShader(o,t)}),r.linkProgram(o),a=r.getProgramParameter(o,r.LINK_STATUS),!a)throw i=r.getProgramInfoLog(o),r.deleteProgram(o),new t.Utils.Error('unable to link program: '+i);return o}},shaders:{create:function(r,n,o){var a,i,l;if(a=r.createShader(r[o]),r.shaderSource(a,n),r.compileShader(a),i=r.getShaderParameter(a,r.COMPILE_STATUS),!i)throw l=r.getShaderInfoLog(a),r.deleteShader(a),new t.Utils.Error('unable to compile shader '+a+': '+l);return a},types:{vertex:'VERTEX_SHADER',fragment:'FRAGMENT_SHADER'},vertex:'attribute vec2 a_position;\nattribute vec2 a_textureCoords;\n\nuniform mat3 u_matrix;\nuniform vec2 u_resolution;\n\nvarying vec2 v_textureCoords;\n\nvoid main() {\n vec2 projected = (u_matrix * vec3(a_position, 1.0)).xy;\n vec2 normal = projected / u_resolution;\n vec2 clipspace = (normal * 2.0) - 1.0;\n\n gl_Position = vec4(clipspace * vec2(1.0, -1.0), 0.0, 1.0);\n v_textureCoords = a_textureCoords;\n}',fragment:'precision mediump float;\n\nuniform sampler2D u_image;\nvarying vec2 v_textureCoords;\n\nvoid main() {\n gl_FragColor = texture2D(u_image, v_textureCoords);\n}'},TextureRegistry:new t.Registry};_.ctx=_.canvas.getContext('2d');var d=t[t.Types.webgl]=function(r){var n,o,i,l;if(this.domElement=r.domElement||document.createElement('canvas'),this.scene=new t.Group,this.scene.parent=this,this._renderer={matrix:new t.Array(a),scale:1,opacity:1},this._flagMatrix=!0,n=u.defaults(r||{},{antialias:!1,alpha:!0,premultipliedAlpha:!0,stencil:!0,preserveDrawingBuffer:!0,overdraw:!1}),this.overdraw=n.overdraw,o=this.ctx=this.domElement.getContext('webgl',n)||this.domElement.getContext('experimental-webgl',n),!this.ctx)throw new t.Utils.Error('unable to create a webgl context. Try using another renderer.');i=_.shaders.create(o,_.shaders.vertex,_.shaders.types.vertex),l=_.shaders.create(o,_.shaders.fragment,_.shaders.types.fragment),this.program=_.program.create(o,[i,l]),o.useProgram(this.program),this.program.position=o.getAttribLocation(this.program,'a_position'),this.program.matrix=o.getUniformLocation(this.program,'u_matrix'),this.program.textureCoords=o.getAttribLocation(this.program,'a_textureCoords'),o.disable(o.DEPTH_TEST),o.enable(o.BLEND),o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)};u.extend(d,{Utils:_}),u.extend(d.prototype,t.Utils.Events,{setSize:function(t,r,n){this.width=t,this.height=r,this.ratio=u.isUndefined(n)?i(this.ctx):n,this.domElement.width=t*this.ratio,this.domElement.height=r*this.ratio,u.extend(this.domElement.style,{width:t+'px',height:r+'px'}),t*=this.ratio,r*=this.ratio,this._renderer.matrix[0]=this._renderer.matrix[4]=this._renderer.scale=this.ratio,this._flagMatrix=!0,this.ctx.viewport(0,0,t,r);var o=this.ctx.getUniformLocation(this.program,'u_resolution');return this.ctx.uniform2f(o,t,r),this},render:function(){var t=this.ctx;return this.overdraw||t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),_.group.render.call(this.scene,t,this.program),this._flagMatrix=!1,this}})}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=t.Utils,n=t.Shape=function(){this._renderer={},this._renderer.flagMatrix=r.bind(n.FlagMatrix,this),this.isShape=!0,this.id=t.Identifier+t.uniqueId(),this.classList=[],this._matrix=new t.Matrix,this.translation=new t.Vector,this.rotation=0,this.scale=1};r.extend(n,{FlagMatrix:function(){this._flagMatrix=!0},MakeObservable:function(r){Object.defineProperty(r,'translation',{enumerable:!0,get:function(){return this._translation},set:function(r){this._translation&&this._translation.unbind(t.Events.change,this._renderer.flagMatrix),this._translation=r,this._translation.bind(t.Events.change,this._renderer.flagMatrix),n.FlagMatrix.call(this)}}),Object.defineProperty(r,'rotation',{enumerable:!0,get:function(){return this._rotation},set:function(t){this._rotation=t,this._flagMatrix=!0}}),Object.defineProperty(r,'scale',{enumerable:!0,get:function(){return this._scale},set:function(r){this._scale instanceof t.Vector&&this._scale.unbind(t.Events.change,this._renderer.flagMatrix),this._scale=r,this._scale instanceof t.Vector&&this._scale.bind(t.Events.change,this._renderer.flagMatrix),this._flagMatrix=!0,this._flagScale=!0}})}}),r.extend(n.prototype,t.Utils.Events,{_flagMatrix:!0,_flagScale:!1,_rotation:0,_scale:1,_translation:null,addTo:function(t){return t.add(this),this},clone:function(){var t=new n;return t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,r.each(n.Properties,function(r){t[r]=this[r]},this),t._update()},_update:function(r){return!this._matrix.manual&&this._flagMatrix&&(this._matrix.identity().translate(this.translation.x,this.translation.y),this._scale instanceof t.Vector?this._matrix.scale(this._scale.x,this._scale.y):this._matrix.scale(this._scale),this._matrix.rotate(this.rotation)),r&&this.parent&&this.parent._update&&this.parent._update(),this},flagReset:function(){return this._flagMatrix=this._flagScale=!1,this}}),n.MakeObservable(n.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two),function(r){function t(t,n,o){var a=n.controls&&n.controls.right,i=t.controls&&t.controls.left,l,s,d,p,c,_,u,m;return l=n.x,c=n.y,s=(a||n).x,_=(a||n).y,d=(i||t).x,u=(i||t).y,p=t.x,m=t.y,a&&n._relative&&(s+=n.x,_+=n.y),i&&t._relative&&(d+=t.x,u+=t.y),r.Utils.getCurveLength(l,c,s,_,d,u,p,m,o)}function n(t,n,o){var a=n.controls&&n.controls.right,i=t.controls&&t.controls.left,l,s,d,p,c,_,u,m;return l=n.x,c=n.y,s=(a||n).x,_=(a||n).y,d=(i||t).x,u=(i||t).y,p=t.x,m=t.y,a&&n._relative&&(s+=n.x,_+=n.y),i&&t._relative&&(d+=t.x,u+=t.y),r.Utils.subdivide(l,c,s,_,d,u,p,m,o)}var o=Je,a=tt,s=rt,d=r.Utils.getComputedMatrix,i={},p=r.Utils;p.each(r.Commands,function(t,r){i[r]=new RegExp(t)});var l=r.Path=function(t,n,o,a){r.Shape.call(this),this._renderer.type='path',this._renderer.flagVertices=p.bind(l.FlagVertices,this),this._renderer.bindVertices=p.bind(l.BindVertices,this),this._renderer.unbindVertices=p.bind(l.UnbindVertices,this),this._renderer.flagFill=p.bind(l.FlagFill,this),this._renderer.flagStroke=p.bind(l.FlagStroke,this),this._closed=!!n,this._curved=!!o,this.beginning=0,this.ending=1,this.fill='#fff',this.stroke='#000',this.linewidth=1,this.opacity=1,this.visible=!0,this.cap='butt',this.join='miter',this.miter=4,this._vertices=[],this.vertices=t,this.automatic=!a};p.extend(l,{Properties:['fill','stroke','linewidth','opacity','visible','cap','join','miter','closed','curved','automatic','beginning','ending'],FlagVertices:function(){this._flagVertices=!0,this._flagLength=!0},BindVertices:function(t){for(var n=this,o=t.length;o--;)t[o].bind(r.Events.change,n._renderer.flagVertices);this._renderer.flagVertices()},UnbindVertices:function(t){for(var n=this,o=t.length;o--;)t[o].unbind(r.Events.change,n._renderer.flagVertices);this._renderer.flagVertices()},FlagFill:function(){this._flagFill=!0},FlagStroke:function(){this._flagStroke=!0},MakeObservable:function(t){r.Shape.MakeObservable(t),p.each(l.Properties.slice(2,8),r.Utils.defineProperty,t),Object.defineProperty(t,'fill',{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof r.Gradient||this._fill instanceof r.LinearGradient||this._fill instanceof r.RadialGradient||this._fill instanceof r.Texture)&&this._fill.unbind(r.Events.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof r.Gradient||this._fill instanceof r.LinearGradient||this._fill instanceof r.RadialGradient||this._fill instanceof r.Texture)&&this._fill.bind(r.Events.change,this._renderer.flagFill)}}),Object.defineProperty(t,'stroke',{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof r.Gradient||this._stroke instanceof r.LinearGradient||this._stroke instanceof r.RadialGradient||this._stroke instanceof r.Texture)&&this._stroke.unbind(r.Events.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof r.Gradient||this._stroke instanceof r.LinearGradient||this._stroke instanceof r.RadialGradient||this._stroke instanceof r.Texture)&&this._stroke.bind(r.Events.change,this._renderer.flagStroke)}}),Object.defineProperty(t,'length',{get:function(){return this._flagLength&&this._updateLength(),this._length}}),Object.defineProperty(t,'closed',{enumerable:!0,get:function(){return this._closed},set:function(t){this._closed=!!t,this._flagVertices=!0}}),Object.defineProperty(t,'curved',{enumerable:!0,get:function(){return this._curved},set:function(t){this._curved=!!t,this._flagVertices=!0}}),Object.defineProperty(t,'automatic',{enumerable:!0,get:function(){return this._automatic},set:function(t){if(t!==this._automatic){this._automatic=!!t;var r=this._automatic?'ignore':'listen';p.each(this.vertices,function(t){t[r]()})}}}),Object.defineProperty(t,'beginning',{enumerable:!0,get:function(){return this._beginning},set:function(t){this._beginning=t,this._flagVertices=!0}}),Object.defineProperty(t,'ending',{enumerable:!0,get:function(){return this._ending},set:function(t){this._ending=t,this._flagVertices=!0}}),Object.defineProperty(t,'vertices',{enumerable:!0,get:function(){return this._collection},set:function(t){var n=this._renderer.flagVertices,o=this._renderer.bindVertices,a=this._renderer.unbindVertices;this._collection&&this._collection.unbind(r.Events.insert,o).unbind(r.Events.remove,a),this._collection=new r.Utils.Collection((t||[]).slice(0)),this._collection.bind(r.Events.insert,o).bind(r.Events.remove,a),o(this._collection)}}),Object.defineProperty(t,'clip',{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}})}}),p.extend(l.prototype,r.Shape.prototype,{_flagVertices:!0,_flagLength:!0,_flagFill:!0,_flagStroke:!0,_flagLinewidth:!0,_flagOpacity:!0,_flagVisible:!0,_flagCap:!0,_flagJoin:!0,_flagMiter:!0,_flagClip:!1,_length:0,_fill:'#fff',_stroke:'#000',_linewidth:1,_opacity:1,_visible:!0,_cap:'round',_join:'round',_miter:4,_closed:!0,_curved:!1,_automatic:!0,_beginning:0,_ending:1,_clip:!1,clone:function(t){t=t||this.parent;var n=p.map(this.vertices,function(t){return t.clone()}),o=new l(n,this.closed,this.curved,!this.automatic);return p.each(r.Path.Properties,function(t){o[t]=this[t]},this),o.translation.copy(this.translation),o.rotation=this.rotation,o.scale=this.scale,t&&t.add(o),o},toObject:function(){var t={vertices:p.map(this.vertices,function(t){return t.toObject()})};return p.each(r.Shape.Properties,function(r){t[r]=this[r]},this),t.translation=this.translation.toObject,t.rotation=this.rotation,t.scale=this.scale,t},noFill:function(){return this.fill='transparent',this},noStroke:function(){return this.stroke='transparent',this},corner:function(){var t=this.getBoundingClientRect(!0);return t.centroid={x:t.left+t.width/2,y:t.top+t.height/2},p.each(this.vertices,function(r){r.addSelf(t.centroid)}),this},center:function(){var t=this.getBoundingClientRect(!0);return t.centroid={x:t.left+t.width/2,y:t.top+t.height/2},p.each(this.vertices,function(r){r.subSelf(t.centroid)}),this},remove:function(){return this.parent?(this.parent.remove(this),this):this},getBoundingClientRect:function(t){var r=this,n=Infinity,s=-Infinity,p=Infinity,c=-Infinity,_,u,m,l,g,y,i;if(this._update(!0),_=t?this._matrix:d(this),u=this.linewidth/2,m=this._vertices.length,0>=m)return i=_.multiply(0,0,1),{top:i.y,left:i.x,right:i.x,bottom:i.y,width:0,height:0};for(y=0;y<m;y++)i=r._vertices[y],l=i.x,g=i.y,i=_.multiply(l,g,1),p=o(i.y-u,p),n=o(i.x-u,n),s=a(i.x+u,s),c=a(i.y+u,c);return{top:p,left:n,right:s,bottom:c,width:s-n,height:c-p}},getPointAt:function(n,t){for(var o=this,s=this.length*Je(tt(n,0),1),d=this.vertices.length,c=null,a=null,_=0,i=this._lengths.length,l=0,u,m,g,f,h,v,y,x,S,C,k,T;_<i;_++){if(l+o._lengths[_]>s){c=o.vertices[o.closed?r.Utils.mod(_,d):_],a=o.vertices[Je(tt(_-1,0),d-1)],s-=l,n=s/o._lengths[_];break}l+=o._lengths[_]}return p.isNull(c)||p.isNull(a)?null:(T=a.controls&&a.controls.right,k=c.controls&&c.controls.left,m=a.x,y=a.y,g=(T||a).x,x=(T||a).y,f=(k||c).x,S=(k||c).y,h=c.x,C=c.y,T&&a._relative&&(g+=a.x,x+=a.y),k&&c._relative&&(f+=c.x,S+=c.y),u=r.Utils.getPointOnCubicBezier(n,m,g,f,h),v=r.Utils.getPointOnCubicBezier(n,y,x,S,C),p.isObject(t)?(t.x=u,t.y=v,t):new r.Vector(u,v))},plot:function(){var t=this;if(this.curved)return r.Utils.getCurveFromPoints(this._vertices,this.closed),this;for(var n=0;n<this._vertices.length;n++)t._vertices[n]._command=0===n?r.Commands.move:r.Commands.line;return this},subdivide:function(t){this._update();var o=this.vertices.length-1,l=this.vertices[o],s=this._closed||this.vertices[o]._command===r.Commands.close,d=[];return p.each(this.vertices,function(c,a){if(0>=a&&!s)return void(l=c);if(c.command===r.Commands.move)return d.push(new r.Anchor(l.x,l.y)),0<a&&(d[d.length-1].command=r.Commands.line),void(l=c);var i=n(c,l,t);d=d.concat(i),p.each(i,function(t,n){t.command=0>=n&&l.command===r.Commands.move?r.Commands.move:r.Commands.line}),a>=o&&(this._closed&&this._automatic?(l=c,i=n(c,l,t),d=d.concat(i),p.each(i,function(t,n){t.command=0>=n&&l.command===r.Commands.move?r.Commands.move:r.Commands.line})):s&&d.push(new r.Anchor(c.x,c.y)),d[d.length-1].command=s?r.Commands.close:r.Commands.line),l=c},this),this._automatic=!1,this._curved=!1,this.vertices=d,this},_updateLength:function(n){this._update();var o=this.vertices.length-1,l=this.vertices[o],s=this._closed||this.vertices[o]._command===r.Commands.close,d=0;return p.isUndefined(this._lengths)&&(this._lengths=[]),p.each(this.vertices,function(p,a){return 0>=a&&!s||p.command===r.Commands.move?(l=p,void(this._lengths[a]=0)):void(this._lengths[a]=t(p,l,n),d+=this._lengths[a],a>=o&&s&&(l=p,this._lengths[a+1]=t(p,l,n),d+=this._lengths[a+1]),l=p)},this),this._length=d,this},_update:function(){var t=this;if(this._flagVertices){var n=this.vertices.length,o=n-1,a=s(this._beginning*o),l=s(this._ending*o),d;this._vertices.length=0;for(var p=a;p<l+1;p++)d=t.vertices[p],t._vertices.push(d);this._automatic&&this.plot()}return r.Shape.prototype._update.apply(this,arguments),this},flagReset:function(){return this._flagVertices=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagCap=this._flagJoin=this._flagMiter=this._flagClip=!1,r.Shape.prototype.flagReset.call(this),this}}),l.MakeObservable(l.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=t.Path,n=t.Utils,o=t.Line=function(n,o,a,i){var l=(a-n)/2,s=(i-o)/2;r.call(this,[new t.Anchor(-l,-s),new t.Anchor(l,s)]),this.translation.set(n+l,o+s)};n.extend(o.prototype,r.prototype),r.MakeObservable(o.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=t.Path,n=t.Utils,o=t.Rectangle=function(n,o,a,i){r.call(this,[new t.Anchor,new t.Anchor,new t.Anchor,new t.Anchor],!0),this.width=a,this.height=i,this._update(),this.translation.set(n,o)};n.extend(o,{Properties:['width','height'],MakeObservable:function(a){r.MakeObservable(a),n.each(o.Properties,t.Utils.defineProperty,a)}}),n.extend(o.prototype,r.prototype,{_width:0,_height:0,_flagWidth:0,_flagHeight:0,_update:function(){if(this._flagWidth||this._flagHeight){var t=this._width/2,n=this._height/2;this.vertices[0].set(-t,-n),this.vertices[1].set(t,-n),this.vertices[2].set(t,n),this.vertices[3].set(-t,n)}return r.prototype._update.call(this),this},flagReset:function(){return this._flagWidth=this._flagHeight=!1,r.prototype.flagReset.call(this),this}}),o.MakeObservable(o.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=t.Path,n=t.Utils,o=t.Ellipse=function(o,a,i,l){n.isNumber(l)||(l=i);var s=t.Resolution,d=n.map(n.range(s),function(){return new t.Anchor},this);r.call(this,d,!0,!0),this.width=2*i,this.height=2*l,this._update(),this.translation.set(o,a)};n.extend(o,{Properties:['width','height'],MakeObservable:function(a){r.MakeObservable(a),n.each(o.Properties,t.Utils.defineProperty,a)}}),n.extend(o.prototype,r.prototype,{_width:0,_height:0,_flagWidth:!1,_flagHeight:!1,_update:function(){var t=this;if(this._flagWidth||this._flagHeight)for(var n=0,o=this.vertices.length;n<o;n++){var a=n/o,i=a*(2*at),l=t._width*ct(i)/2,s=t._height*pt(i)/2;t.vertices[n].set(l,s)}return r.prototype._update.call(this),this},flagReset:function(){return this._flagWidth=this._flagHeight=!1,r.prototype.flagReset.call(this),this}}),o.MakeObservable(o.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var n=t.Path,o=t.Utils,r=t.Circle=function(a,i,l){var r=t.Resolution,s=o.map(o.range(r),function(){return new t.Anchor},this);n.call(this,s,!0,!0),this.radius=l,this._update(),this.translation.set(a,i)};o.extend(r,{Properties:['radius'],MakeObservable:function(a){n.MakeObservable(a),o.each(r.Properties,t.Utils.defineProperty,a)}}),o.extend(r.prototype,n.prototype,{_radius:0,_flagRadius:!1,_update:function(){var t=this;if(this._flagRadius)for(var r=0,o=this.vertices.length;r<o;r++){var a=r/o,i=a*(2*at),l=t._radius*ct(i),s=t._radius*pt(i);t.vertices[r].set(l,s)}return n.prototype._update.call(this),this},flagReset:function(){return this._flagRadius=!1,n.prototype.flagReset.call(this),this}}),r.MakeObservable(r.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var n=t.Path,o=t.Utils,r=t.Polygon=function(a,i,l,r){r=tt(r||0,3);var s=o.map(o.range(r),function(){return new t.Anchor});n.call(this,s,!0),this.width=2*l,this.height=2*l,this.sides=r,this._update(),this.translation.set(a,i)};o.extend(r,{Properties:['width','height','sides'],MakeObservable:function(a){n.MakeObservable(a),o.each(r.Properties,t.Utils.defineProperty,a)}}),o.extend(r.prototype,n.prototype,{_width:0,_height:0,_sides:0,_flagWidth:!1,_flagHeight:!1,_flagSides:!1,_update:function(){var r=this;if(this._flagWidth||this._flagHeight||this._flagSides){var o=this._sides,a=this.vertices.length;a>o&&this.vertices.splice(o-1,a-o);for(var l=0;l<o;l++){var i=(l+0.5)/o,s=2*at*i+at/2,d=r._width*ct(s),p=r._height*pt(s);l>=a?r.vertices.push(new t.Anchor(d,p)):r.vertices[l].set(d,p)}}return n.prototype._update.call(this),this},flagReset:function(){return this._flagWidth=this._flagHeight=this._flagSides=!1,n.prototype.flagReset.call(this),this}}),r.MakeObservable(r.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){function r(t,r){for(;0>t;)t+=r;return t%r}var n=t.Path,o=2*at,a=at/2,i=t.Utils,l=t.ArcSegment=function(r,o,a,l,s,d,p){var c=i.map(i.range(p||3*t.Resolution),function(){return new t.Anchor});n.call(this,c,!1,!1,!0),this.innerRadius=a,this.outerRadius=l,this.startAngle=s,this.endAngle=d,this._update(),this.translation.set(r,o)};i.extend(l,{Properties:['startAngle','endAngle','innerRadius','outerRadius'],MakeObservable:function(r){n.MakeObservable(r),i.each(l.Properties,t.Utils.defineProperty,r)}}),i.extend(l.prototype,n.prototype,{_flagStartAngle:!1,_flagEndAngle:!1,_flagInnerRadius:!1,_flagOuterRadius:!1,_startAngle:0,_endAngle:o,_innerRadius:0,_outerRadius:0,_update:function(){if(this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){var l=this._startAngle,s=this._endAngle,d=this._innerRadius,p=this._outerRadius,c=r(l,o)===r(s,o),_=0<d,u=this.vertices,m=_?u.length/2:u.length,g=0,f;c?m--:!_&&(m-=2);for(var h=0,i=m-1;h<m;h++){var S=h/i,C=u[g],v=S*(s-l)+l,k=(s-l)/m,T=p*ct(v),x=p*pt(v);if(f=0===h?t.Commands.move:t.Commands.curve,C.command=f,C.x=T,C.y=x,C.controls.left.clear(),C.controls.right.clear(),C.command===t.Commands.curve){var y=p*k/at;C.controls.left.x=y*ct(v-a),C.controls.left.y=y*pt(v-a),C.controls.right.x=y*ct(v+a),C.controls.right.y=y*pt(v+a),1===h&&C.controls.left.multiplyScalar(2),h===i&&C.controls.right.multiplyScalar(2)}g++}if(_)for(c?(u[g].command=t.Commands.close,g++):(m--,i=m-1),h=0;h<m;h++)S=h/i,C=u[g],v=(1-S)*(s-l)+l,k=(s-l)/m,T=d*ct(v),x=d*pt(v),f=t.Commands.curve,0>=h&&(f=c?t.Commands.move:t.Commands.line),C.command=f,C.x=T,C.y=x,C.controls.left.clear(),C.controls.right.clear(),C.command===t.Commands.curve&&(y=d*k/at,C.controls.left.x=y*ct(v+a),C.controls.left.y=y*pt(v+a),C.controls.right.x=y*ct(v-a),C.controls.right.y=y*pt(v-a),1===h&&C.controls.left.multiplyScalar(2),h===i&&C.controls.right.multiplyScalar(2)),g++;else c||(u[g].command=t.Commands.line,u[g].x=0,u[g].y=0,g++);u[g].command=t.Commands.close}return n.prototype._update.call(this),this},flagReset:function(){return n.prototype.flagReset.call(this),this._flagStartAngle=this._flagEndAngle=this._flagInnerRadius=this._flagOuterRadius=!1,this}}),l.MakeObservable(l.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var n=t.Path,r=t.Utils,o=t.Star=function(o,a,i,l,s){r.isNumber(l)||(l=i/2),(!r.isNumber(s)||0>=s)&&(s=5);var d=2*s,p=r.map(r.range(d),function(){return new t.Anchor});n.call(this,p,!0),this.innerRadius=l,this.outerRadius=i,this.sides=s,this._update(),this.translation.set(o,a)};r.extend(o,{Properties:['innerRadius','outerRadius','sides'],MakeObservable:function(a){n.MakeObservable(a),r.each(o.Properties,t.Utils.defineProperty,a)}}),r.extend(o.prototype,n.prototype,{_innerRadius:0,_outerRadius:0,_sides:0,_flagInnerRadius:!1,_flagOuterRadius:!1,_flagSides:!1,_update:function(){var o=this;if(this._flagInnerRadius||this._flagOuterRadius||this._flagSides){var a=2*this._sides,l=this.vertices.length;l>a&&this.vertices.splice(a-1,l-a);for(var s=0;s<a;s++){var i=(s+0.5)/a,d=2*at*i,p=s%2?o._innerRadius:o._outerRadius,r=p*ct(d),c=p*pt(d);s>=l?o.vertices.push(new t.Anchor(r,c)):o.vertices[s].set(r,c)}}return n.prototype._update.call(this),this},flagReset:function(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,n.prototype.flagReset.call(this),this}}),o.MakeObservable(o.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=t.Path,n=t.Utils,o=t.RoundedRectangle=function(o,a,i,l,s){n.isNumber(s)||(s=nt(Je(i,l)/12));var d=n.map(n.range(10),function(r){return new t.Anchor(0,0,0,0,0,0,0===r?t.Commands.move:t.Commands.curve)});d[d.length-1].command=t.Commands.close,r.call(this,d,!1,!1,!0),this.width=i,this.height=l,this.radius=s,this._update(),this.translation.set(o,a)};n.extend(o,{Properties:['width','height','radius'],MakeObservable:function(a){r.MakeObservable(a),n.each(o.Properties,t.Utils.defineProperty,a)}}),n.extend(o.prototype,r.prototype,{_width:0,_height:0,_radius:0,_flagWidth:!1,_flagHeight:!1,_flagRadius:!1,_update:function(){if(this._flagWidth||this._flagHeight||this._flagRadius){var t=this._width,n=this._height,o=Je(tt(this._radius,0),Je(t,n)),a=t/2,i=n/2,l;l=this.vertices[0],l.x=-(a-o),l.y=-i,l=this.vertices[1],l.x=a-o,l.y=-i,l.controls.left.clear(),l.controls.right.x=o,l.controls.right.y=0,l=this.vertices[2],l.x=a,l.y=-(i-o),l.controls.right.clear(),l.controls.left.clear(),l=this.vertices[3],l.x=a,l.y=i-o,l.controls.left.clear(),l.controls.right.x=0,l.controls.right.y=o,l=this.vertices[4],l.x=a-o,l.y=i,l.controls.right.clear(),l.controls.left.clear(),l=this.vertices[5],l.x=-(a-o),l.y=i,l.controls.left.clear(),l.controls.right.x=-o,l.controls.right.y=0,l=this.vertices[6],l.x=-a,l.y=i-o,l.controls.left.clear(),l.controls.right.clear(),l=this.vertices[7],l.x=-a,l.y=-(i-o),l.controls.left.clear(),l.controls.right.x=0,l.controls.right.y=-o,l=this.vertices[8],l.x=-(a-o),l.y=-i,l.controls.left.clear(),l.controls.right.clear(),l=this.vertices[9],l.copy(this.vertices[8])}return r.prototype._update.call(this),this},flagReset:function(){return this._flagWidth=this._flagHeight=this._flagRadius=!1,r.prototype.flagReset.call(this),this}}),o.MakeObservable(o.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=t.root,n=t.Utils.getComputedMatrix,o=t.Utils,a=r.document?r.document.createElement('canvas'):{getContext:o.identity},i=a.getContext('2d'),l=t.Text=function(r,n,a,i){return t.Shape.call(this),this._renderer.type='text',this._renderer.flagFill=o.bind(l.FlagFill,this),this._renderer.flagStroke=o.bind(l.FlagStroke,this),this.value=r,o.isNumber(n)&&(this.translation.x=n),o.isNumber(a)&&(this.translation.y=a),o.isObject(i)?void o.each(t.Text.Properties,function(t){t in i&&(this[t]=i[t])},this):this};o.extend(t.Text,{Properties:['value','family','size','leading','alignment','linewidth','style','weight','decoration','baseline','opacity','visible','fill','stroke'],FlagFill:function(){this._flagFill=!0},FlagStroke:function(){this._flagStroke=!0},MakeObservable:function(r){t.Shape.MakeObservable(r),o.each(t.Text.Properties.slice(0,12),t.Utils.defineProperty,r),Object.defineProperty(r,'fill',{enumerable:!0,get:function(){return this._fill},set:function(r){(this._fill instanceof t.Gradient||this._fill instanceof t.LinearGradient||this._fill instanceof t.RadialGradient||this._fill instanceof t.Texture)&&this._fill.unbind(t.Events.change,this._renderer.flagFill),this._fill=r,this._flagFill=!0,(this._fill instanceof t.Gradient||this._fill instanceof t.LinearGradient||this._fill instanceof t.RadialGradient||this._fill instanceof t.Texture)&&this._fill.bind(t.Events.change,this._renderer.flagFill)}}),Object.defineProperty(r,'stroke',{enumerable:!0,get:function(){return this._stroke},set:function(r){(this._stroke instanceof t.Gradient||this._stroke instanceof t.LinearGradient||this._stroke instanceof t.RadialGradient||this._stroke instanceof t.Texture)&&this._stroke.unbind(t.Events.change,this._renderer.flagStroke),this._stroke=r,this._flagStroke=!0,(this._stroke instanceof t.Gradient||this._stroke instanceof t.LinearGradient||this._stroke instanceof t.RadialGradient||this._stroke instanceof t.Texture)&&this._stroke.bind(t.Events.change,this._renderer.flagStroke)}}),Object.defineProperty(r,'clip',{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}})}}),o.extend(t.Text.prototype,t.Shape.prototype,{_flagValue:!0,_flagFamily:!0,_flagSize:!0,_flagLeading:!0,_flagAlignment:!0,_flagBaseline:!0,_flagStyle:!0,_flagWeight:!0,_flagDecoration:!0,_flagFill:!0,_flagStroke:!0,_flagLinewidth:!0,_flagOpacity:!0,_flagVisible:!0,_flagClip:!1,_value:'',_family:'sans-serif',_size:13,_leading:17,_alignment:'center',_baseline:'middle',_style:'normal',_weight:500,_decoration:'none',_fill:'#000',_stroke:'transparent',_linewidth:1,_opacity:1,_visible:!0,_clip:!1,remove:function(){return this.parent?(this.parent.remove(this),this):this},clone:function(r){var r=r||this.parent,n=new t.Text(this.value);return n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,o.each(t.Text.Properties,function(t){n[t]=this[t]},this),r&&r.add(n),n},toObject:function(){var r={translation:this.translation.toObject(),rotation:this.rotation,scale:this.scale};return o.each(t.Text.Properties,function(t){r[t]=this[t]},this),r},noStroke:function(){return this.stroke='transparent',this},noFill:function(){return this.fill='transparent',this},getBoundingClientRect:function(t){var r=Infinity,o=-Infinity,a=Infinity,i=-Infinity,l,s;return this._update(!0),l=t?this._matrix:n(this),s=l.multiply(0,0,1),{top:s.x,left:s.y,right:s.x,bottom:s.y,width:0,height:0}},flagReset:function(){return this._flagValue=this._flagFamily=this._flagSize=this._flagLeading=this._flagAlignment=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpaicty=this._flagVisible=this._flagClip=this._flagDecoration=this._flagBaseline=!1,t.Shape.prototype.flagReset.call(this),this}}),t.Text.MakeObservable(t.Text.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=t.Utils,n=t.Stop=function(t,o,a){this._renderer={},this._renderer.type='stop',this.offset=r.isNumber(t)?t:0>=n.Index?0:1,this.opacity=r.isNumber(a)?a:1,this.color=r.isString(o)?o:0>=n.Index?'#fff':'#000',n.Index=(n.Index+1)%2};r.extend(n,{Index:0,Properties:['offset','opacity','color'],MakeObservable:function(t){r.each(n.Properties,function(t){var r=this,n='_'+t,o='_flag'+t.charAt(0).toUpperCase()+t.slice(1);Object.defineProperty(r,t,{enumerable:!0,get:function(){return this[n]},set:function(t){this[n]=t,this[o]=!0,this.parent&&(this.parent._flagStops=!0)}})},t)}}),r.extend(n.prototype,t.Utils.Events,{clone:function(){var t=new n;return r.each(n.Properties,function(r){t[r]=this[r]},this),t},toObject:function(){var t={};return r.each(n.Properties,function(r){t[r]=this[r]},this),t},flagReset:function(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,this}}),n.MakeObservable(n.prototype);var o=t.Gradient=function(n){this._renderer={},this._renderer.type='gradient',this.id=t.Identifier+t.uniqueId(),this.classList=[],this._renderer.flagStops=r.bind(o.FlagStops,this),this._renderer.bindStops=r.bind(o.BindStops,this),this._renderer.unbindStops=r.bind(o.UnbindStops,this),this.spread='pad',this.stops=n};r.extend(o,{Stop:n,Properties:['spread'],MakeObservable:function(n){r.each(o.Properties,t.Utils.defineProperty,n),Object.defineProperty(n,'stops',{enumerable:!0,get:function(){return this._stops},set:function(r){var n=this._renderer.flagStops,o=this._renderer.bindStops,a=this._renderer.unbindStops;this._stops&&this._stops.unbind(t.Events.insert,o).unbind(t.Events.remove,a),this._stops=new t.Utils.Collection((r||[]).slice(0)),this._stops.bind(t.Events.insert,o).bind(t.Events.remove,a),o(this._stops)}})},FlagStops:function(){this._flagStops=!0},BindStops:function(r){for(var n=this,o=r.length;o--;)r[o].bind(t.Events.change,n._renderer.flagStops),r[o].parent=n;this._renderer.flagStops()},UnbindStops:function(r){for(var n=this,o=r.length;o--;)r[o].unbind(t.Events.change,n._renderer.flagStops),delete r[o].parent;this._renderer.flagStops()}}),r.extend(o.prototype,t.Utils.Events,{_flagStops:!1,_flagSpread:!1,clone:function(n){n=n||this.parent;var a=r.map(this.stops,function(t){return t.clone()}),i=new o(a);return r.each(t.Gradient.Properties,function(t){i[t]=this[t]},this),n&&n.add(i),i},toObject:function(){var t={stops:r.map(this.stops,function(t){return t.toObject()})};return r.each(o.Properties,function(r){t[r]=this[r]},this),t},_update:function(){return(this._flagSpread||this._flagStops)&&this.trigger(t.Events.change),this},flagReset:function(){return this._flagSpread=this._flagStops=!1,this}}),o.MakeObservable(o.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=t.Utils,n=t.LinearGradient=function(o,a,i,l,s){t.Gradient.call(this,s),this._renderer.type='linear-gradient';var d=r.bind(n.FlagEndPoints,this);this.left=new t.Vector().bind(t.Events.change,d),this.right=new t.Vector().bind(t.Events.change,d),r.isNumber(o)&&(this.left.x=o),r.isNumber(a)&&(this.left.y=a),r.isNumber(i)&&(this.right.x=i),r.isNumber(l)&&(this.right.y=l)};r.extend(n,{Stop:t.Gradient.Stop,MakeObservable:function(r){t.Gradient.MakeObservable(r)},FlagEndPoints:function(){this._flagEndPoints=!0}}),r.extend(n.prototype,t.Gradient.prototype,{_flagEndPoints:!1,clone:function(o){o=o||this.parent;var a=r.map(this.stops,function(t){return t.clone()}),i=new n(this.left._x,this.left._y,this.right._x,this.right._y,a);return r.each(t.Gradient.Properties,function(t){i[t]=this[t]},this),o&&o.add(i),i},toObject:function(){var r=t.Gradient.prototype.toObject.call(this);return r.left=this.left.toObject(),r.right=this.right.toObject(),r},_update:function(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(t.Events.change),this},flagReset:function(){return this._flagEndPoints=!1,t.Gradient.prototype.flagReset.call(this),this}}),n.MakeObservable(n.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var n=t.Utils,r=t.RadialGradient=function(o,a,i,r,l,s){t.Gradient.call(this,r),this._renderer.type='radial-gradient',this.center=new t.Vector().bind(t.Events.change,n.bind(function(){this._flagCenter=!0},this)),this.radius=n.isNumber(i)?i:20,this.focal=new t.Vector().bind(t.Events.change,n.bind(function(){this._flagFocal=!0},this)),n.isNumber(o)&&(this.center.x=o),n.isNumber(a)&&(this.center.y=a),this.focal.copy(this.center),n.isNumber(l)&&(this.focal.x=l),n.isNumber(s)&&(this.focal.y=s)};n.extend(r,{Stop:t.Gradient.Stop,Properties:['radius'],MakeObservable:function(o){t.Gradient.MakeObservable(o),n.each(r.Properties,t.Utils.defineProperty,o)}}),n.extend(r.prototype,t.Gradient.prototype,{_flagRadius:!1,_flagCenter:!1,_flagFocal:!1,clone:function(o){o=o||this.parent;var a=n.map(this.stops,function(t){return t.clone()}),i=new r(this.center._x,this.center._y,this._radius,a,this.focal._x,this.focal._y);return n.each(t.Gradient.Properties.concat(r.Properties),function(t){i[t]=this[t]},this),o&&o.add(i),i},toObject:function(){var o=t.Gradient.prototype.toObject.call(this);return n.each(r.Properties,function(t){o[t]=this[t]},this),o.center=this.center.toObject(),o.focal=this.focal.toObject(),o},_update:function(){return(this._flagRadius||this._flatCenter||this._flagFocal||this._flagSpread||this._flagStops)&&this.trigger(t.Events.change),this},flagReset:function(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,t.Gradient.prototype.flagReset.call(this),this}}),r.MakeObservable(r.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=t.Utils,n={video:/\.(mp4|webm)$/i,image:/\.(jpe?g|png|gif|tiff)$/i},o=t.Texture=function(n,a){if(this._renderer={},this._renderer.type='texture',this._renderer.flagOffset=r.bind(o.FlagOffset,this),this._renderer.flagScale=r.bind(o.FlagScale,this),this.id=t.Identifier+t.uniqueId(),this.classList=[],this.offset=new t.Vector,r.isFunction(a)){var i=r.bind(function(){this.unbind(t.Events.load,i),r.isFunction(a)&&a()},this);this.bind(t.Events.load,i)}r.isString(n)?this.src=n:r.isElement(n)&&(this.image=n),this._update()};r.extend(o,{Properties:['src','image','loaded','repeat'],ImageRegistry:new t.Registry,getImage:function(t){if(o.ImageRegistry.contains(t))return o.ImageRegistry.get(t);var r;return r=n.video.test(t)?document.createElement('video'):document.createElement('img'),r.crossOrigin='anonymous',r},Register:{canvas:function(t,n){t._src='#'+t.id,o.ImageRegistry.add(t.src,t.image),r.isFunction(n)&&n()},img:function(n,a){if(!(n.image&&n.image.getAttribute('two-src'))){var i=function(){n.image.removeEventListener('load',i,!1),n.image.removeEventListener('error',l,!1),r.isFunction(a)&&a()},l=function(){throw n.image.removeEventListener('load',i,!1),n.image.removeEventListener('error',l,!1),new t.Utils.Error('unable to load '+n.src)};n.image.addEventListener('load',i,!1),n.image.addEventListener('error',l,!1),n.image.setAttribute('two-src',n.src),o.ImageRegistry.add(n.src,n.image),n.image.src=n.src}},video:function(n,a){if(!(n.image&&n.image.getAttribute('two-src'))){var i=function(){n.image.removeEventListener('load',i,!1),n.image.removeEventListener('error',l,!1),n.image.width=n.image.videoWidth,n.image.height=n.image.videoHeight,n.image.play(),r.isFunction(a)&&a()},l=function(){throw n.image.removeEventListener('load',i,!1),n.image.removeEventListener('error',l,!1),new t.Utils.Error('unable to load '+n.src)};n.image.addEventListener('canplaythrough',i,!1),n.image.addEventListener('error',l,!1),n.image.setAttribute('two-src',n.src),o.ImageRegistry.add(n.src,n.image),n.image.src=n.src,n.image.loop=!0,n.image.load()}}},load:function(t,r){var n=t.src,a=t.image,i=a&&a.nodeName.toLowerCase();t._flagImage&&(/canvas/i.test(i)?o.Register.canvas(t,r):(t._src=a.getAttribute('two-src')||a.src,o.Register[i](t,r))),t._flagSrc&&(!a&&(t.image=o.getImage(t.src)),i=t.image.nodeName.toLowerCase(),o.Register[i](t,r))},FlagOffset:function(){this._flagOffset=!0},FlagScale:function(){this._flagScale=!0},MakeObservable:function(n){r.each(o.Properties,t.Utils.defineProperty,n),Object.defineProperty(n,'offset',{enumerable:!0,get:function(){return this._offset},set:function(r){this._offset&&this._offset.unbind(t.Events.change,this._renderer.flagOffset),this._offset=r,this._offset.bind(t.Events.change,this._renderer.flagOffset),this._flagOffset=!0}}),Object.defineProperty(n,'scale',{enumerable:!0,get:function(){return this._scale},set:function(r){this._scale instanceof t.Vector&&this._scale.unbind(t.Events.change,this._renderer.flagScale),this._scale=r,this._scale instanceof t.Vector&&this._scale.bind(t.Events.change,this._renderer.flagScale),this._flagScale=!0}})}}),r.extend(o.prototype,t.Utils.Events,t.Shape.prototype,{_flagSrc:!1,_flagImage:!1,_flagLoaded:!1,_flagRepeat:!1,_flagOffset:!1,_flagScale:!1,_src:'',_image:null,_loaded:!1,_repeat:'no-repeat',_scale:1,_offset:null,clone:function(){return new o(this.src)},toObject:function(){return{src:this.src,image:this.image}},_update:function(){return(this._flagSrc||this._flagImage)&&(this.trigger(t.Events.change),this.loaded=!1,o.load(this,r.bind(function(){this.loaded=!0,this.trigger(t.Events.change).trigger(t.Events.load)},this))),4<=this.image.readyState&&(this._flagImage=!0),this},flagReset:function(){return this._flagSrc=this._flagImage=this._flagLoaded=this._flagScale=this._flagOffset=!1,this}}),o.MakeObservable(o.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=t.Utils,n=t.Path,o=t.Rectangle,a=t.Sprite=function(o,a,i,l,s,d){n.call(this,[new t.Anchor,new t.Anchor,new t.Anchor,new t.Anchor],!0),this.noStroke(),this.noFill(),o instanceof t.Texture?this.texture=o:r.isString(o)&&(this.texture=new t.Texture(o)),this._update(),this.translation.set(a||0,i||0),r.isNumber(l)&&(this.columns=l),r.isNumber(s)&&(this.rows=s),r.isNumber(d)&&(this.frameRate=d)};r.extend(a,{Properties:['texture','columns','rows','frameRate'],MakeObservable:function(n){o.MakeObservable(n),r.each(a.Properties,t.Utils.defineProperty,n)}}),r.extend(a.prototype,o.prototype,{_flagTexture:!1,_flagColumns:!1,_flagRows:!1,_flagFrameRate:!1,_amount:1,_duration:0,_index:0,_startTime:0,_playing:!1,_firstFrame:0,_lastFrame:0,_loop:!0,_texture:null,_columns:1,_rows:1,_frameRate:0,play:function(t,n,o){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=r.performance.now(),r.isNumber(t)&&(this._firstFrame=t),r.isNumber(n)&&(this._lastFrame=n),r.isFunction(o)?this._onLastFrame=o:delete this._onLastFrame,this},pause:function(){return this._playing=!1,this},stop:function(){return this._playing=!1,this._index=0,this},clone:function(t){t=t||this.parent;var r=new a(this.texture,this.translation.x,this.translation.y,this.columns,this.rows,this.frameRate);return this.playing&&(r.play(this._firstFrame,this._lastFrame),r._loop=this._loop),t&&t.add(r),r},_update:function(){var t=this._texture,n=this._columns,a=this._rows,i,l,s,d,p,c,_,u;if((this._flagColumns||this._flagRows)&&(this._amount=this._columns*this._rows),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._flagTexture&&(this.fill=this._texture),this._texture.loaded){_=t.image.width,u=t.image.height,i=_/n,l=u/a,d=this._amount,this.width!==i&&(this.width=i),this.height!==l&&(this.height=l),this._playing&&0<this._frameRate&&(r.isNaN(this._lastFrame)&&(this._lastFrame=d-1),s=r.performance.now()-this._startTime,p=1e3*(this._lastFrame-this._firstFrame)/this._frameRate,this._loop?s%=p:s=Je(s,p),c=r.lerp(this._firstFrame,this._lastFrame,s/p),c=nt(c),c!==this._index&&(this._index=c,c>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));var m=(_-i)/2+i*(this._index%n+1),g=l*nt(this._index/n)-(u-l)/2;m!==t.offset.x&&(t.offset.x=m),g!==t.offset.y&&(t.offset.y=g)}return o.prototype._update.call(this),this},flagReset:function(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,o.prototype.flagReset.call(this),this}}),a.MakeObservable(a.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){var r=t.Utils,n=t.Path,o=t.Rectangle,a=t.ImageSequence=function(o,i,l,s){n.call(this,[new t.Anchor,new t.Anchor,new t.Anchor,new t.Anchor],!0),this._renderer.flagTextures=r.bind(a.FlagTextures,this),this._renderer.bindTextures=r.bind(a.BindTextures,this),this._renderer.unbindTextures=r.bind(a.UnbindTextures,this),this.noStroke(),this.noFill(),this.textures=r.map(o,a.GenerateTexture,this),this._update(),this.translation.set(i||0,l||0),this.frameRate=r.isNumber(s)?s:a.DefaultFrameRate};r.extend(a,{Properties:['frameRate'],DefaultFrameRate:30,FlagTextures:function(){this._flagTextures=!0},BindTextures:function(r){for(var n=this,o=r.length;o--;)r[o].bind(t.Events.change,n._renderer.flagTextures);this._renderer.flagTextures()},UnbindTextures:function(r){for(var n=this,o=r.length;o--;)r[o].unbind(t.Events.change,n._renderer.flagTextures);this._renderer.flagTextures()},MakeObservable:function(n){o.MakeObservable(n),r.each(a.Properties,t.Utils.defineProperty,n),Object.defineProperty(n,'textures',{enumerable:!0,get:function(){return this._textures},set:function(r){var n=this._renderer.flagTextures,o=this._renderer.bindTextures,a=this._renderer.unbindTextures;this._textures&&this._textures.unbind(t.Events.insert,o).unbind(t.Events.remove,a),this._textures=new t.Utils.Collection((r||[]).slice(0)),this._textures.bind(t.Events.insert,o).bind(t.Events.remove,a),o(this._textures)}})},GenerateTexture:function(n){return n instanceof t.Texture?n:r.isString(n)?new t.Texture(n):void 0}}),r.extend(a.prototype,o.prototype,{_flagTextures:!1,_flagFrameRate:!1,_amount:1,_duration:0,_index:0,_startTime:0,_playing:!1,_firstFrame:0,_lastFrame:0,_loop:!0,_textures:null,_frameRate:0,play:function(t,n,o){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=r.performance.now(),r.isNumber(t)&&(this._firstFrame=t),r.isNumber(n)&&(this._lastFrame=n),r.isFunction(o)?this._onLastFrame=o:delete this._onLastFrame,this},pause:function(){return this._playing=!1,this},stop:function(){return this._playing=!1,this._index=0,this},clone:function(t){t=t||this.parent;var r=new a(this.textures,this.translation.x,this.translation.y,this.frameRate);return r._loop=this._loop,this._playing&&r.play(),t&&t.add(r),r},_update:function(){var n=this._textures,a,i,l,s,d,p,c;return this._flagTextures&&(this._amount=n.length),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._playing&&0<this._frameRate?(s=this._amount,r.isNaN(this._lastFrame)&&(this._lastFrame=s-1),l=r.performance.now()-this._startTime,d=1e3*(this._lastFrame-this._firstFrame)/this._frameRate,this._loop?l%=d:l=Je(l,d),c=r.lerp(this._firstFrame,this._lastFrame,l/d),c=nt(c),c!==this._index&&(this._index=c,p=n[this._index],p.loaded&&(a=p.image.width,i=p.image.height,this.width!==a&&(this.width=a),this.height!==i&&(this.height=i),this.fill=p,c>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):!(this.fill instanceof t.Texture)&&(p=n[this._index],p.loaded&&(a=p.image.width,i=p.image.height,this.width!==a&&(this.width=a),this.height!==i&&(this.height=i),this.fill=p)),o.prototype._update.call(this),this},flagReset:function(){return this._flagTextures=this._flagFrameRate=!1,o.prototype.flagReset.call(this),this}}),a.MakeObservable(a.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two),function(t){function r(t,r){var n=t.parent,o;return n===r?(this.additions.push(t),void(this._flagAdditions=!0)):(n&&n.children.ids[t.id]&&(o=a.indexOf(n.children,t),n.children.splice(o,1),o=a.indexOf(n.additions,t),0<=o?n.additions.splice(o,1):(n.subtractions.push(t),n._flagSubtractions=!0)),r?(t.parent=r,this.additions.push(t),void(this._flagAdditions=!0)):void(o=a.indexOf(this.additions,t),0<=o?this.additions.splice(o,1):(this.subtractions.push(t),this._flagSubtractions=!0),delete t.parent))}var n=Je,o=tt,a=t.Utils,i=function(){t.Utils.Collection.apply(this,arguments),Object.defineProperty(this,'_events',{value:{},enumerable:!1}),this.ids={},this.on(t.Events.insert,this.attach),this.on(t.Events.remove,this.detach),i.prototype.attach.apply(this,arguments)};i.prototype=new t.Utils.Collection,i.prototype.constructor=i,a.extend(i.prototype,{attach:function(t){for(var r=this,n=0;n<t.length;n++)r.ids[t[n].id]=t[n];return this},detach:function(t){for(var r=this,n=0;n<t.length;n++)delete r.ids[t[n].id];return this}});var l=t.Group=function(){t.Shape.call(this,!0),this._renderer.type='group',this.additions=[],this.subtractions=[],this.children=arguments};a.extend(l,{Children:i,InsertChildren:function(t){for(var n=this,o=0;o<t.length;o++)r.call(n,t[o],n)},RemoveChildren:function(t){for(var n=this,o=0;o<t.length;o++)r.call(n,t[o])},OrderChildren:function(){this._flagOrder=!0},MakeObservable:function(r){var n=t.Path.Properties.slice(0),o=a.indexOf(n,'opacity');0<=o&&(n.splice(o,1),Object.defineProperty(r,'opacity',{enumerable:!0,get:function(){return this._opacity},set:function(t){this._flagOpacity=this._opacity!=t,this._opacity=t}})),t.Shape.MakeObservable(r),l.MakeGetterSetters(r,n),Object.defineProperty(r,'children',{enumerable:!0,get:function(){return this._children},set:function(r){var n=a.bind(l.InsertChildren,this),o=a.bind(l.RemoveChildren,this),s=a.bind(l.OrderChildren,this);this._children&&this._children.unbind(),this._children=new i(r),this._children.bind(t.Events.insert,n),this._children.bind(t.Events.remove,o),this._children.bind(t.Events.order,s)}}),Object.defineProperty(r,'mask',{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,t.clip||(t.clip=!0)}})},MakeGetterSetters:function(t,r){a.isArray(r)||(r=[r]),a.each(r,function(r){l.MakeGetterSetter(t,r)})},MakeGetterSetter:function(t,r){var n='_'+r;Object.defineProperty(t,r,{enumerable:!0,get:function(){return this[n]},set:function(t){this[n]=t,a.each(this.children,function(n){n[r]=t})}})}}),a.extend(l.prototype,t.Shape.prototype,{_flagAdditions:!1,_flagSubtractions:!1,_flagOrder:!1,_flagOpacity:!0,_flagMask:!1,_fill:'#fff',_stroke:'#000',_linewidth:1,_opacity:1,_visible:!0,_cap:'round',_join:'round',_miter:4,_closed:!0,_curved:!1,_automatic:!0,_beginning:0,_ending:1,_mask:null,clone:function(t){t=t||this.parent;var r=new l,n=a.map(this.children,function(t){return t.clone(r)});return r.add(n),r.opacity=this.opacity,this.mask&&(r.mask=this.mask),r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,t&&t.add(r),r},toObject:function(){var t={children:[],translation:this.translation.toObject(),rotation:this.rotation,scale:this.scale,opacity:this.opacity,mask:this.mask?this.mask.toObject():null};return a.each(this.children,function(r,n){t.children[n]=r.toObject()},this),t},corner:function(){var t=this.getBoundingClientRect(!0),r={x:t.left,y:t.top};return this.children.forEach(function(t){t.translation.subSelf(r)}),this},center:function(){var t=this.getBoundingClientRect(!0);return t.centroid={x:t.left+t.width/2,y:t.top+t.height/2},this.children.forEach(function(r){r.isShape&&r.translation.subSelf(t.centroid)}),this},getById:function(t){var r=function(t,n){if(t.id===n)return t;if(t.children)for(var o=t.children.length,a;o--;)if(a=r(t.children[o],n),a)return a};return r(this,t)||null},getByClassName:function(t){var r=[],n=function(t,o){return-1==t.classList.indexOf(o)?t.children&&t.children.forEach(function(t){n(t,o)}):r.push(t),r};return n(this,t)},getByType:function(r){var n=[],o=function(r,a){for(var i in r.children)r.children[i]instanceof a?n.push(r.children[i]):r.children[i]instanceof t.Group&&o(r.children[i],a);return n};return o(this,r)},add:function(t){var r=this;t=t instanceof Array?t.slice():a.toArray(arguments);for(var n=0;n<t.length;n++)t[n]&&t[n].id&&r.children.push(t[n]);return this},remove:function(t){var r=this,n=arguments.length,o=this.parent;if(0>=n&&o)return o.remove(this),this;t=t instanceof Array?t.slice():a.toArray(arguments);for(var l=0;l<t.length;l++)t[l]&&r.children.ids[t[l].id]&&r.children.splice(a.indexOf(r.children,t[l]),1);return this},getBoundingClientRect:function(t){var r;this._update(!0);var i=Infinity,l=-Infinity,s=Infinity,d=-Infinity;return this.children.forEach(function(p){/(linear-gradient|radial-gradient|gradient)/.test(p._renderer.type)||(r=p.getBoundingClientRect(t),a.isNumber(r.top)&&a.isNumber(r.left)&&a.isNumber(r.right)&&a.isNumber(r.bottom)&&(s=n(r.top,s),i=n(r.left,i),l=o(r.right,l),d=o(r.bottom,d)))},this),{top:s,left:i,right:l,bottom:d,width:l-i,height:d-s}},noFill:function(){return this.children.forEach(function(t){t.noFill()}),this},noStroke:function(){return this.children.forEach(function(t){t.noStroke()}),this},subdivide:function(){var t=arguments;return this.children.forEach(function(r){r.subdivide.apply(r,t)}),this},flagReset:function(){return this._flagAdditions&&(this.additions.length=0,this._flagAdditions=!1),this._flagSubtractions&&(this.subtractions.length=0,this._flagSubtractions=!1),this._flagOrder=this._flagMask=this._flagOpacity=!1,t.Shape.prototype.flagReset.call(this),this}}),l.MakeObservable(l.prototype)}(('undefined'==typeof Jt?Jt:Jt).Two)});Ke();var Hi=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype.createdCallback=function(){var r=this;t.prototype.createdCallback.call(this),this._sizePollTask=null,this._parentSize={x:0,y:0,z:0},this._imperativeCounterpartPromise.then(function(){r.imperativeCounterpart._mounted||r.parentNode&&r.imperativeCounterpart.mount(r.parentNode)}),this.initWebGl()},r.prototype.initWebGl=function(){var t=this;this.mountPromise.then(function(){t.webglEnabled=!!t.getAttribute('webglenabled'),t.webglEnabled&&(t.webGlRendererState={},De().initGl(t))})},r.prototype._startSizePolling=function(){this._sizePollTask||(this._sizePollTask=wi.addRenderTask(this._checkSize.bind(this)))},r.prototype._checkSize=function(){const t=this.parentNode,r=this._parentSize,n=getComputedStyle(t),o=parseFloat(n.width),a=parseFloat(n.height);(r.x!=o||r.y!=a)&&(r.x=o,r.y=a,this.triggerEvent('parentsizechange',Object.assign({},r)))},r.prototype._makeImperativeCounterpart=function(){return new Yi({_motorHtmlCounterpart:this})},r.prototype.getStyles=function(){return Ui},r.prototype.deinit=function(){t.prototype.deinit.call(this),this.imperativeCounterpart.unmount()},r.prototype._stopSizePolling=function(){wi.removeRenderTask(this._sizePollTask),this._sizePollTask=null},r}(fn.mixin(Gi));Qe(Mi,Hi),Hi=document.registerElement('motor-scene',Hi),$e();const Wi=Ki.mixin(Mi);var Yi=function(t){function r(r){var n=this;void 0===r&&(r={}),t.call(this,r),this._elementParentSize={x:0,y:0,z:0},this._onElementParentSizeChange=function(t){n._elementParentSize=t,n._calcSize(),n._needsToBeRendered()},this._calcSize(),this._needsToBeRendered()}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._setDefaultProperties=function(){t.prototype._setDefaultProperties.call(this),Object.assign(this._properties,{sizeMode:new hn('proportional','proportional','absolute')})},r.prototype._startOrStopSizePolling=function(){this._mounted&&('proportional'==this._properties.sizeMode.x||'proportional'==this._properties.sizeMode.y||'proportional'==this._properties.sizeMode.z)?this._startSizePolling():this._stopSizePolling()},r.prototype._startSizePolling=function(){this._elementManager&&(this._elementManager.element._startSizePolling(),this._elementManager.element.on('parentsizechange',this._onElementParentSizeChange))},r.prototype._stopSizePolling=function(){this._elementManager&&(this._elementManager.element.off('parentsizechange',this._onElementParentSizeChange),this._elementManager.element._stopSizePolling())},r.prototype._getParentSize=function(){return this._mounted?this._elementParentSize:{x:0,y:0,z:0}},r.prototype._makeElement=function(){return new Hi},r.prototype.mount=function(t){var r=this;const n=function(){if(void 0===t?t=document.body:'string'==typeof t&&(t=document.querySelector(t)),!(t instanceof window.HTMLElement))throw new Error('Invalid mount point specified in Scene.mount() call. Pass a selector, an actual HTMLElement, or don\'t pass anything to mount to <body>.');r._mounted&&r.unmount(),t!==r._elementManager.element.parentNode&&t.appendChild(r._elementManager.element),r._mounted=!0,r._mountPromise&&r._resolveMountPromise(),r._elementManager.shouldRender(),r._startOrStopSizePolling()};return'loading'==document.readyState?ci().then(n):(n(),Promise.resolve())},r.prototype.unmount=function(){this._mounted&&(this._elementManager.shouldNotRender(),this._stopSizePolling(),this._elementManager.element.parentNode&&this._elementManager.element.parentNode.removeChild(this._elementManager.element),this._mountPromise&&this._rejectMountPromise('mountcancel'),this._resetMountPromise())},r}(Wi),Xi=Object.getOwnPropertyDescriptor(Mi.prototype,'sizeMode'),qi=Xi.set,Zi=Xi.get;Object.defineProperties(Yi.prototype,{sizeMode:{set:function(t){qi.call(this,t),this._startOrStopSizePolling()},get:function(){return Zi.call(this)},configurable:!0,enumerable:!0}});var Ki;$e(),$e();var Qi=function(t){function r(r){var n=this;void 0===r&&(r={}),t.call(this,r),this._scene=null,this._scenePromise=null,this._resolveScenePromise=null,this._onParentSizeChange=function(){('proportional'===n._properties.sizeMode.x||'proportional'===n._properties.sizeMode.y||'proportional'===n._properties.sizeMode.z||0!==n._properties.align.x||0!==n._properties.align.y||0!==n._properties.align.z)&&(n._calcSize(),n._needsToBeRendered())},this._calcSize(),this._needsToBeRendered()}t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r;var n={scene:{}};return r.prototype._waitForMountThenResolveMountPromise=function(){var t=this;if(this._awaitingScenePromise)return Promise.resolve();this._awaitingScenePromise=!0;let r;return this._getScenePromise().then(function(){return t._scene.mountPromise}).then(function(){t._mounted=!0,t._resolveMountPromise(),t._elementManager.shouldRender()}).catch(function(){'mountcancel'==e||(r=e)}).then(function(){if(t._awaitingScenePromise=!1,r)throw r})},r.prototype._makeElement=function(){return new Ii},r.prototype._getScenePromise=function(){var t=this;return this._scenePromise||(this._scenePromise=new Promise(function(r){t._resolveScenePromise=r})),this._scene&&this._resolveScenePromise(),this._scenePromise},n.scene.get=function(){return this._scene||!this._parent?this._scene:(this._scene=this._parent._scene?this._parent._scene:this._parent instanceof Yi?this._parent:this._parent.scene,this._scene)},r.prototype._giveSceneRefToChildren=function(){var t=this;const r=this._children;for(let n=0,o=r.length;n<o;n+=1){const o=r[n];o._scene=t._scene,o._resolveScenePromise&&o._resolveScenePromise(o._scene),o._giveSceneRefToChildren()}},r.prototype._resetSceneRef=function(){this._scene=null,this._scenePromise=null,this._resolveScenePromise=null;const t=this._children;for(let r=0,n=t.length;r<n;r+=1)t[r]._resetSceneRef()},Object.defineProperties(r.prototype,n),r}(Ki.mixin(Fi)),$i=function(t){this.element=t};$i.prototype.setClasses=function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];return t.length&&(n=this.element.classList).add.apply(n,t),this;var n},$i.prototype.applyStyle=function(t,r){this.element.style[t]=r},$i.prototype.addChild=function(t){this.element.appendChild(t.element)},$i.prototype.removeChild=function(t){t.element.parentNode===this.element&&this.element.removeChild(t.element)},$i.prototype.connectChildElement=function(t){(!t._elementManager.element.parentNode||t._elementManager.element.parentElement&&t._elementManager.element.parentElement!==this.element)&&this.addChild(t._elementManager)},$i.prototype.disconnectChildElement=function(t){t._elementManager.element.parentNode&&this.removeChild(t._elementManager)},$i.prototype.applyTransform=function(t){var r='matrix3d(\n '+t.m11+',\n '+t.m12+',\n '+t.m13+',\n '+t.m14+',\n '+t.m21+',\n '+t.m22+',\n '+t.m23+',\n '+t.m24+',\n '+t.m31+',\n '+t.m32+',\n '+t.m33+',\n '+t.m34+',\n '+t.m41+',\n '+t.m42+',\n '+t.m43+',\n '+t.m44+'\n )';this.applyStyle('transform',r)},$i.prototype.applySize=function(t){var r=t.x,n=t.y;this.applyStyle('width',r+'px'),this.applyStyle('height',n+'px')},$i.prototype.applyOpacity=function(t){this.applyStyle('opacity',t)},$i.prototype.applyImperativeNodeProperties=function(t){t instanceof Qi&&(this.applyOpacity(t._properties.opacity),this.applyTransform(t._properties.transform)),this.applySize(t._calculatedSize)},$i.prototype.shouldRender=function(){var t=this;const r=wi.addRenderTask(function(){t.applyStyle('display','block'),wi.removeRenderTask(r)})},$i.prototype.shouldNotRender=function(){var t=this;const r=wi.addRenderTask(function(){t.applyStyle('display','none'),wi.removeRenderTask(r)})};var Ji=Object.freeze({ElementManager:$i,Motor:wi,Node:Qi,Scene:Yi,Sizeable:Mi,Transformable:Fi,TreeNode:Pn,XYZValues:hn,Utility:Cn}),el=function(t){function r(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];console.log(' -- PushPaneLayout created'),t.apply(this,r)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r}(Qi),tl=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype.createdCallback=function(){console.log(' -- MotorHTMLPushPaneLayout created'),t.prototype.createdCallback.call(this)},r.prototype._makeImperativeCounterpart=function(){return new el({},this)},r}(Ii),rl=Object.freeze({get MotorHTMLBase(){return Gi},get MotorHTMLNode(){return Ii},MotorHTMLPushPaneLayout:tl,get MotorHTMLScene(){return Hi},WebComponent:Ve}),nl=function(t){function r(r,n){var o=this;t.call(this,Object.assign({},{absoluteSize:[r,r,r]},n)),this.size=r,this.sides=[],tr(6,function(t){return o._createCubeSide(t)})}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._createCubeSide=function(r){const n=new t({align:[0.5,0.5],mountPoint:[0.5,0.5]}),o=new t({align:[0.5,0.5],mountPoint:[0.5,0.5],absoluteSize:[this.size,this.size]});this.sides.push(o),n.addChild(o),4>r?n.rotation.y=90*r:n.rotation.x=90*(r%2?-1:1),o.position.z=this.size/2,this.addChild(n)},r.prototype.setContent=function(t){var r=this;return tr(6,function(n){r.sides[n].addChild(t[n])}),this},r}(Qi),ol=Object.freeze({Cube:nl,PushPaneLayout:el});return t.Calendar=_r,t.DoubleSidedPlane=cr,t.Grid=rr,t.Molecule=$t,t.Plane=pr,t.PushMenuLayout=on,t.utils=Qt,t.core=Ji,t.html=rl,t.components=ol,t.version='17.0.4',t}({}); |
This file has been truncated, but you can view the full file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var infamous = (function (exports) { | |
'use strict'; | |
/* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
* | |
* Owner: [email protected] | |
* @license MPL 2.0 | |
* @copyright Famous Industries, Inc. 2015 | |
*/ | |
/** | |
* A high-performance static matrix math library used to calculate | |
* affine transforms on surfaces and other renderables. | |
* Famo.us uses 4x4 matrices corresponding directly to | |
* WebKit matrices (column-major order). | |
* | |
* The internal "type" of a Matrix is a 16-long float array in | |
* row-major order, with: | |
* elements [0],[1],[2],[4],[5],[6],[8],[9],[10] forming the 3x3 | |
* transformation matrix; | |
* elements [12], [13], [14] corresponding to the t_x, t_y, t_z | |
* translation; | |
* elements [3], [7], [11] set to 0; | |
* element [15] set to 1. | |
* All methods are static. | |
* | |
* @static | |
* | |
* @class Transform | |
*/ | |
var Transform = {}; | |
// WARNING: these matrices correspond to WebKit matrices, which are | |
// transposed from their math counterparts | |
Transform.precision = 1e-6; | |
Transform.identity = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]; | |
/** | |
* Multiply two or more Transform matrix types to return a Transform matrix. | |
* | |
* @method multiply4x4 | |
* @static | |
* @param {Transform} a left Transform | |
* @param {Transform} b right Transform | |
* @return {Transform} | |
*/ | |
Transform.multiply4x4 = function multiply4x4(a, b) { | |
return [ | |
a[0] * b[0] + a[4] * b[1] + a[8] * b[2] + a[12] * b[3], | |
a[1] * b[0] + a[5] * b[1] + a[9] * b[2] + a[13] * b[3], | |
a[2] * b[0] + a[6] * b[1] + a[10] * b[2] + a[14] * b[3], | |
a[3] * b[0] + a[7] * b[1] + a[11] * b[2] + a[15] * b[3], | |
a[0] * b[4] + a[4] * b[5] + a[8] * b[6] + a[12] * b[7], | |
a[1] * b[4] + a[5] * b[5] + a[9] * b[6] + a[13] * b[7], | |
a[2] * b[4] + a[6] * b[5] + a[10] * b[6] + a[14] * b[7], | |
a[3] * b[4] + a[7] * b[5] + a[11] * b[6] + a[15] * b[7], | |
a[0] * b[8] + a[4] * b[9] + a[8] * b[10] + a[12] * b[11], | |
a[1] * b[8] + a[5] * b[9] + a[9] * b[10] + a[13] * b[11], | |
a[2] * b[8] + a[6] * b[9] + a[10] * b[10] + a[14] * b[11], | |
a[3] * b[8] + a[7] * b[9] + a[11] * b[10] + a[15] * b[11], | |
a[0] * b[12] + a[4] * b[13] + a[8] * b[14] + a[12] * b[15], | |
a[1] * b[12] + a[5] * b[13] + a[9] * b[14] + a[13] * b[15], | |
a[2] * b[12] + a[6] * b[13] + a[10] * b[14] + a[14] * b[15], | |
a[3] * b[12] + a[7] * b[13] + a[11] * b[14] + a[15] * b[15] | |
]; | |
}; | |
/** | |
* Fast-multiply two Transform matrix types to return a | |
* Matrix, assuming bottom row on each is [0 0 0 1]. | |
* | |
* @method multiply | |
* @static | |
* @param {Transform} a left Transform | |
* @param {Transform} b right Transform | |
* @return {Transform} | |
*/ | |
Transform.multiply = function multiply(a, b) { | |
return [ | |
a[0] * b[0] + a[4] * b[1] + a[8] * b[2], | |
a[1] * b[0] + a[5] * b[1] + a[9] * b[2], | |
a[2] * b[0] + a[6] * b[1] + a[10] * b[2], | |
0, | |
a[0] * b[4] + a[4] * b[5] + a[8] * b[6], | |
a[1] * b[4] + a[5] * b[5] + a[9] * b[6], | |
a[2] * b[4] + a[6] * b[5] + a[10] * b[6], | |
0, | |
a[0] * b[8] + a[4] * b[9] + a[8] * b[10], | |
a[1] * b[8] + a[5] * b[9] + a[9] * b[10], | |
a[2] * b[8] + a[6] * b[9] + a[10] * b[10], | |
0, | |
a[0] * b[12] + a[4] * b[13] + a[8] * b[14] + a[12], | |
a[1] * b[12] + a[5] * b[13] + a[9] * b[14] + a[13], | |
a[2] * b[12] + a[6] * b[13] + a[10] * b[14] + a[14], | |
1 | |
]; | |
}; | |
/** | |
* Return a Transform translated by additional amounts in each | |
* dimension. This is equivalent to the result of | |
* | |
* Transform.multiply(Matrix.translate(t[0], t[1], t[2]), m). | |
* | |
* @method thenMove | |
* @static | |
* @param {Transform} m a Transform | |
* @param {Array.Number} t floats delta vector of length 2 or 3 | |
* @return {Transform} | |
*/ | |
Transform.thenMove = function thenMove(m, t) { | |
if (!t[2]) { t[2] = 0; } | |
return [m[0], m[1], m[2], 0, m[4], m[5], m[6], 0, m[8], m[9], m[10], 0, m[12] + t[0], m[13] + t[1], m[14] + t[2], 1]; | |
}; | |
/** | |
* Return a Transform matrix which represents the result of a transform matrix | |
* applied after a move. This is faster than the equivalent multiply. | |
* This is equivalent to the result of: | |
* | |
* Transform.multiply(m, Transform.translate(t[0], t[1], t[2])). | |
* | |
* @method moveThen | |
* @static | |
* @param {Array.Number} v vector representing initial movement | |
* @param {Transform} m matrix to apply afterwards | |
* @return {Transform} the resulting matrix | |
*/ | |
Transform.moveThen = function moveThen(v, m) { | |
if (!v[2]) { v[2] = 0; } | |
var t0 = v[0] * m[0] + v[1] * m[4] + v[2] * m[8]; | |
var t1 = v[0] * m[1] + v[1] * m[5] + v[2] * m[9]; | |
var t2 = v[0] * m[2] + v[1] * m[6] + v[2] * m[10]; | |
return Transform.thenMove(m, [t0, t1, t2]); | |
}; | |
/** | |
* Return a Transform which represents a translation by specified | |
* amounts in each dimension. | |
* | |
* @method translate | |
* @static | |
* @param {Number} x x translation | |
* @param {Number} y y translation | |
* @param {Number} z z translation | |
* @return {Transform} | |
*/ | |
Transform.translate = function translate(x, y, z) { | |
if (z === undefined) { z = 0; } | |
return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, x, y, z, 1]; | |
}; | |
/** | |
* Return a Transform scaled by a vector in each | |
* dimension. This is a more performant equivalent to the result of | |
* | |
* Transform.multiply(Transform.scale(s[0], s[1], s[2]), m). | |
* | |
* @method thenScale | |
* @static | |
* @param {Transform} m a matrix | |
* @param {Array.Number} s delta vector (array of floats && | |
* array.length == 3) | |
* @return {Transform} | |
*/ | |
Transform.thenScale = function thenScale(m, s) { | |
return [ | |
s[0] * m[0], s[1] * m[1], s[2] * m[2], 0, | |
s[0] * m[4], s[1] * m[5], s[2] * m[6], 0, | |
s[0] * m[8], s[1] * m[9], s[2] * m[10], 0, | |
s[0] * m[12], s[1] * m[13], s[2] * m[14], 1 | |
]; | |
}; | |
/** | |
* Return a Transform which represents a scale by specified amounts | |
* in each dimension. | |
* | |
* @method scale | |
* @static | |
* @param {Number} x x scale factor | |
* @param {Number} y y scale factor | |
* @param {Number} z z scale factor | |
* @return {Transform} | |
*/ | |
Transform.scale = function scale(x, y, z) { | |
if (z === undefined) { z = 1; } | |
if (y === undefined) { y = x; } | |
return [x, 0, 0, 0, 0, y, 0, 0, 0, 0, z, 0, 0, 0, 0, 1]; | |
}; | |
/** | |
* Return a Transform which represents a clockwise | |
* rotation around the x axis. | |
* | |
* @method rotateX | |
* @static | |
* @param {Number} theta radians | |
* @return {Transform} | |
*/ | |
Transform.rotateX = function rotateX(theta) { | |
var cosTheta = Math.cos(theta); | |
var sinTheta = Math.sin(theta); | |
return [1, 0, 0, 0, 0, cosTheta, sinTheta, 0, 0, -sinTheta, cosTheta, 0, 0, 0, 0, 1]; | |
}; | |
/** | |
* Return a Transform which represents a clockwise | |
* rotation around the y axis. | |
* | |
* @method rotateY | |
* @static | |
* @param {Number} theta radians | |
* @return {Transform} | |
*/ | |
Transform.rotateY = function rotateY(theta) { | |
var cosTheta = Math.cos(theta); | |
var sinTheta = Math.sin(theta); | |
return [cosTheta, 0, -sinTheta, 0, 0, 1, 0, 0, sinTheta, 0, cosTheta, 0, 0, 0, 0, 1]; | |
}; | |
/** | |
* Return a Transform which represents a clockwise | |
* rotation around the z axis. | |
* | |
* @method rotateZ | |
* @static | |
* @param {Number} theta radians | |
* @return {Transform} | |
*/ | |
Transform.rotateZ = function rotateZ(theta) { | |
var cosTheta = Math.cos(theta); | |
var sinTheta = Math.sin(theta); | |
return [cosTheta, sinTheta, 0, 0, -sinTheta, cosTheta, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]; | |
}; | |
/** | |
* Return a Transform which represents composed clockwise | |
* rotations along each of the axes. Equivalent to the result of | |
* Matrix.multiply(rotateX(phi), rotateY(theta), rotateZ(psi)). | |
* | |
* @method rotate | |
* @static | |
* @param {Number} phi radians to rotate about the positive x axis | |
* @param {Number} theta radians to rotate about the positive y axis | |
* @param {Number} psi radians to rotate about the positive z axis | |
* @return {Transform} | |
*/ | |
Transform.rotate = function rotate(phi, theta, psi) { | |
var cosPhi = Math.cos(phi); | |
var sinPhi = Math.sin(phi); | |
var cosTheta = Math.cos(theta); | |
var sinTheta = Math.sin(theta); | |
var cosPsi = Math.cos(psi); | |
var sinPsi = Math.sin(psi); | |
var result = [ | |
cosTheta * cosPsi, | |
cosPhi * sinPsi + sinPhi * sinTheta * cosPsi, | |
sinPhi * sinPsi - cosPhi * sinTheta * cosPsi, | |
0, | |
-cosTheta * sinPsi, | |
cosPhi * cosPsi - sinPhi * sinTheta * sinPsi, | |
sinPhi * cosPsi + cosPhi * sinTheta * sinPsi, | |
0, | |
sinTheta, | |
-sinPhi * cosTheta, | |
cosPhi * cosTheta, | |
0, | |
0, 0, 0, 1 | |
]; | |
return result; | |
}; | |
/** | |
* Return a Transform which represents an axis-angle rotation | |
* | |
* @method rotateAxis | |
* @static | |
* @param {Array.Number} v unit vector representing the axis to rotate about | |
* @param {Number} theta radians to rotate clockwise about the axis | |
* @return {Transform} | |
*/ | |
Transform.rotateAxis = function rotateAxis(v, theta) { | |
var sinTheta = Math.sin(theta); | |
var cosTheta = Math.cos(theta); | |
var verTheta = 1 - cosTheta; // versine of theta | |
var xxV = v[0] * v[0] * verTheta; | |
var xyV = v[0] * v[1] * verTheta; | |
var xzV = v[0] * v[2] * verTheta; | |
var yyV = v[1] * v[1] * verTheta; | |
var yzV = v[1] * v[2] * verTheta; | |
var zzV = v[2] * v[2] * verTheta; | |
var xs = v[0] * sinTheta; | |
var ys = v[1] * sinTheta; | |
var zs = v[2] * sinTheta; | |
var result = [ | |
xxV + cosTheta, xyV + zs, xzV - ys, 0, | |
xyV - zs, yyV + cosTheta, yzV + xs, 0, | |
xzV + ys, yzV - xs, zzV + cosTheta, 0, | |
0, 0, 0, 1 | |
]; | |
return result; | |
}; | |
/** | |
* Return a Transform which represents a transform matrix applied about | |
* a separate origin point. | |
* | |
* @method aboutOrigin | |
* @static | |
* @param {Array.Number} v origin point to apply matrix | |
* @param {Transform} m matrix to apply | |
* @return {Transform} | |
*/ | |
Transform.aboutOrigin = function aboutOrigin(v, m) { | |
var t0 = v[0] - (v[0] * m[0] + v[1] * m[4] + v[2] * m[8]); | |
var t1 = v[1] - (v[0] * m[1] + v[1] * m[5] + v[2] * m[9]); | |
var t2 = v[2] - (v[0] * m[2] + v[1] * m[6] + v[2] * m[10]); | |
return Transform.thenMove(m, [t0, t1, t2]); | |
}; | |
/** | |
* Return a Transform representation of a skew transformation | |
* | |
* @method skew | |
* @static | |
* @param {Number} phi scale factor skew in the x axis | |
* @param {Number} theta scale factor skew in the y axis | |
* @param {Number} psi scale factor skew in the z axis | |
* @return {Transform} | |
*/ | |
Transform.skew = function skew(phi, theta, psi) { | |
return [1, Math.tan(theta), 0, 0, Math.tan(psi), 1, 0, 0, 0, Math.tan(phi), 1, 0, 0, 0, 0, 1]; | |
}; | |
/** | |
* Return a Transform representation of a skew in the x-direction | |
* | |
* @method skewX | |
* @static | |
* @param {Number} angle the angle between the top and left sides | |
* @return {Transform} | |
*/ | |
Transform.skewX = function skewX(angle) { | |
return [1, 0, 0, 0, Math.tan(angle), 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]; | |
}; | |
/** | |
* Return a Transform representation of a skew in the y-direction | |
* | |
* @method skewY | |
* @static | |
* @param {Number} angle the angle between the top and right sides | |
* @return {Transform} | |
*/ | |
Transform.skewY = function skewY(angle) { | |
return [1, Math.tan(angle), 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]; | |
}; | |
/** | |
* Returns a perspective Transform matrix | |
* | |
* @method perspective | |
* @static | |
* @param {Number} focusZ z position of focal point | |
* @return {Transform} | |
*/ | |
Transform.perspective = function perspective(focusZ) { | |
return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, -1 / focusZ, 0, 0, 0, 1]; | |
}; | |
/** | |
* Return translation vector component of given Transform | |
* | |
* @method getTranslate | |
* @static | |
* @param {Transform} m Transform | |
* @return {Array.Number} the translation vector [t_x, t_y, t_z] | |
*/ | |
Transform.getTranslate = function getTranslate(m) { | |
return [m[12], m[13], m[14]]; | |
}; | |
/** | |
* Return inverse affine transform for given Transform. | |
* Note: This assumes m[3] = m[7] = m[11] = 0, and m[15] = 1. | |
* Will provide incorrect results if not invertible or preconditions not met. | |
* | |
* @method inverse | |
* @static | |
* @param {Transform} m Transform | |
* @return {Transform} | |
*/ | |
Transform.inverse = function inverse(m) { | |
// only need to consider 3x3 section for affine | |
var c0 = m[5] * m[10] - m[6] * m[9]; | |
var c1 = m[4] * m[10] - m[6] * m[8]; | |
var c2 = m[4] * m[9] - m[5] * m[8]; | |
var c4 = m[1] * m[10] - m[2] * m[9]; | |
var c5 = m[0] * m[10] - m[2] * m[8]; | |
var c6 = m[0] * m[9] - m[1] * m[8]; | |
var c8 = m[1] * m[6] - m[2] * m[5]; | |
var c9 = m[0] * m[6] - m[2] * m[4]; | |
var c10 = m[0] * m[5] - m[1] * m[4]; | |
var detM = m[0] * c0 - m[1] * c1 + m[2] * c2; | |
var invD = 1 / detM; | |
var result = [ | |
invD * c0, -invD * c4, invD * c8, 0, | |
-invD * c1, invD * c5, -invD * c9, 0, | |
invD * c2, -invD * c6, invD * c10, 0, | |
0, 0, 0, 1 | |
]; | |
result[12] = -m[12] * result[0] - m[13] * result[4] - m[14] * result[8]; | |
result[13] = -m[12] * result[1] - m[13] * result[5] - m[14] * result[9]; | |
result[14] = -m[12] * result[2] - m[13] * result[6] - m[14] * result[10]; | |
return result; | |
}; | |
/** | |
* Returns the transpose of a 4x4 matrix | |
* | |
* @method transpose | |
* @static | |
* @param {Transform} m matrix | |
* @return {Transform} the resulting transposed matrix | |
*/ | |
Transform.transpose = function transpose(m) { | |
return [m[0], m[4], m[8], m[12], m[1], m[5], m[9], m[13], m[2], m[6], m[10], m[14], m[3], m[7], m[11], m[15]]; | |
}; | |
function _normSquared(v) { | |
return (v.length === 2) ? v[0] * v[0] + v[1] * v[1] : v[0] * v[0] + v[1] * v[1] + v[2] * v[2]; | |
} | |
function _norm(v) { | |
return Math.sqrt(_normSquared(v)); | |
} | |
function _sign(n) { | |
return (n < 0) ? -1 : 1; | |
} | |
/** | |
* Decompose Transform into separate .translate, .rotate, .scale, | |
* and .skew components. | |
* | |
* @method interpret | |
* @static | |
* @param {Transform} M transform matrix | |
* @return {Object} matrix spec object with component matrices .translate, | |
* .rotate, .scale, .skew | |
*/ | |
Transform.interpret = function interpret(M) { | |
// QR decomposition via Householder reflections | |
//FIRST ITERATION | |
//default Q1 to the identity matrix; | |
var x = [M[0], M[1], M[2]]; // first column vector | |
var sgn = _sign(x[0]); // sign of first component of x (for stability) | |
var xNorm = _norm(x); // norm of first column vector | |
var v = [x[0] + sgn * xNorm, x[1], x[2]]; // v = x + sign(x[0])|x|e1 | |
var mult = 2 / _normSquared(v); // mult = 2/v'v | |
//bail out if our Matrix is singular | |
if (mult >= Infinity) { | |
return {translate: Transform.getTranslate(M), rotate: [0, 0, 0], scale: [0, 0, 0], skew: [0, 0, 0]}; | |
} | |
//evaluate Q1 = I - 2vv'/v'v | |
var Q1 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]; | |
//diagonals | |
Q1[0] = 1 - mult * v[0] * v[0]; // 0,0 entry | |
Q1[5] = 1 - mult * v[1] * v[1]; // 1,1 entry | |
Q1[10] = 1 - mult * v[2] * v[2]; // 2,2 entry | |
//upper diagonal | |
Q1[1] = -mult * v[0] * v[1]; // 0,1 entry | |
Q1[2] = -mult * v[0] * v[2]; // 0,2 entry | |
Q1[6] = -mult * v[1] * v[2]; // 1,2 entry | |
//lower diagonal | |
Q1[4] = Q1[1]; // 1,0 entry | |
Q1[8] = Q1[2]; // 2,0 entry | |
Q1[9] = Q1[6]; // 2,1 entry | |
//reduce first column of M | |
var MQ1 = Transform.multiply(Q1, M); | |
//SECOND ITERATION on (1,1) minor | |
var x2 = [MQ1[5], MQ1[6]]; | |
var sgn2 = _sign(x2[0]); // sign of first component of x (for stability) | |
var x2Norm = _norm(x2); // norm of first column vector | |
var v2 = [x2[0] + sgn2 * x2Norm, x2[1]]; // v = x + sign(x[0])|x|e1 | |
var mult2 = 2 / _normSquared(v2); // mult = 2/v'v | |
//evaluate Q2 = I - 2vv'/v'v | |
var Q2 = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]; | |
//diagonal | |
Q2[5] = 1 - mult2 * v2[0] * v2[0]; // 1,1 entry | |
Q2[10] = 1 - mult2 * v2[1] * v2[1]; // 2,2 entry | |
//off diagonals | |
Q2[6] = -mult2 * v2[0] * v2[1]; // 2,1 entry | |
Q2[9] = Q2[6]; // 1,2 entry | |
//calc QR decomposition. Q = Q1*Q2, R = Q'*M | |
var Q = Transform.multiply(Q2, Q1); //note: really Q transpose | |
var R = Transform.multiply(Q, M); | |
//remove negative scaling | |
var remover = Transform.scale(R[0] < 0 ? -1 : 1, R[5] < 0 ? -1 : 1, R[10] < 0 ? -1 : 1); | |
R = Transform.multiply(R, remover); | |
Q = Transform.multiply(remover, Q); | |
//decompose into rotate/scale/skew matrices | |
var result = {}; | |
result.translate = Transform.getTranslate(M); | |
result.rotate = [Math.atan2(-Q[6], Q[10]), Math.asin(Q[2]), Math.atan2(-Q[1], Q[0])]; | |
if (!result.rotate[0]) { | |
result.rotate[0] = 0; | |
result.rotate[2] = Math.atan2(Q[4], Q[5]); | |
} | |
result.scale = [R[0], R[5], R[10]]; | |
result.skew = [Math.atan2(R[9], result.scale[2]), Math.atan2(R[8], result.scale[2]), Math.atan2(R[4], result.scale[0])]; | |
//double rotation workaround | |
if (Math.abs(result.rotate[0]) + Math.abs(result.rotate[2]) > 1.5 * Math.PI) { | |
result.rotate[1] = Math.PI - result.rotate[1]; | |
if (result.rotate[1] > Math.PI) { result.rotate[1] -= 2 * Math.PI; } | |
if (result.rotate[1] < -Math.PI) { result.rotate[1] += 2 * Math.PI; } | |
if (result.rotate[0] < 0) { result.rotate[0] += Math.PI; } | |
else { result.rotate[0] -= Math.PI; } | |
if (result.rotate[2] < 0) { result.rotate[2] += Math.PI; } | |
else { result.rotate[2] -= Math.PI; } | |
} | |
return result; | |
}; | |
/** | |
* Weighted average between two matrices by averaging their | |
* translation, rotation, scale, skew components. | |
* f(M1,M2,t) = (1 - t) * M1 + t * M2 | |
* | |
* @method average | |
* @static | |
* @param {Transform} M1 f(M1,M2,0) = M1 | |
* @param {Transform} M2 f(M1,M2,1) = M2 | |
* @param {Number} t | |
* @return {Transform} | |
*/ | |
Transform.average = function average(M1, M2, t) { | |
t = (t === undefined) ? 0.5 : t; | |
var specM1 = Transform.interpret(M1); | |
var specM2 = Transform.interpret(M2); | |
var specAvg = { | |
translate: [0, 0, 0], | |
rotate: [0, 0, 0], | |
scale: [0, 0, 0], | |
skew: [0, 0, 0] | |
}; | |
for (var i = 0; i < 3; i++) { | |
specAvg.translate[i] = (1 - t) * specM1.translate[i] + t * specM2.translate[i]; | |
specAvg.rotate[i] = (1 - t) * specM1.rotate[i] + t * specM2.rotate[i]; | |
specAvg.scale[i] = (1 - t) * specM1.scale[i] + t * specM2.scale[i]; | |
specAvg.skew[i] = (1 - t) * specM1.skew[i] + t * specM2.skew[i]; | |
} | |
return Transform.build(specAvg); | |
}; | |
/** | |
* Compose .translate, .rotate, .scale, .skew components into | |
* Transform matrix | |
* | |
* @method build | |
* @static | |
* @param {matrixSpec} spec object with component matrices .translate, | |
* .rotate, .scale, .skew | |
* @return {Transform} composed transform | |
*/ | |
Transform.build = function build(spec) { | |
var scaleMatrix = Transform.scale(spec.scale[0], spec.scale[1], spec.scale[2]); | |
var skewMatrix = Transform.skew(spec.skew[0], spec.skew[1], spec.skew[2]); | |
var rotateMatrix = Transform.rotate(spec.rotate[0], spec.rotate[1], spec.rotate[2]); | |
return Transform.thenMove(Transform.multiply(Transform.multiply(rotateMatrix, skewMatrix), scaleMatrix), spec.translate); | |
}; | |
/** | |
* Determine if two Transforms are component-wise equal | |
* Warning: breaks on perspective Transforms | |
* | |
* @method equals | |
* @static | |
* @param {Transform} a matrix | |
* @param {Transform} b matrix | |
* @return {boolean} | |
*/ | |
Transform.equals = function equals(a, b) { | |
return !Transform.notEquals(a, b); | |
}; | |
/** | |
* Determine if two Transforms are component-wise unequal | |
* Warning: breaks on perspective Transforms | |
* | |
* @method notEquals | |
* @static | |
* @param {Transform} a matrix | |
* @param {Transform} b matrix | |
* @return {boolean} | |
*/ | |
Transform.notEquals = function notEquals(a, b) { | |
if (a === b) { return false; } | |
// shortci | |
return !(a && b) || | |
a[12] !== b[12] || a[13] !== b[13] || a[14] !== b[14] || | |
a[0] !== b[0] || a[1] !== b[1] || a[2] !== b[2] || | |
a[4] !== b[4] || a[5] !== b[5] || a[6] !== b[6] || | |
a[8] !== b[8] || a[9] !== b[9] || a[10] !== b[10]; | |
}; | |
/** | |
* Constrain angle-trio components to range of [-pi, pi). | |
* | |
* @method normalizeRotation | |
* @static | |
* @param {Array.Number} rotation phi, theta, psi (array of floats | |
* && array.length == 3) | |
* @return {Array.Number} new phi, theta, psi triplet | |
* (array of floats && array.length == 3) | |
*/ | |
Transform.normalizeRotation = function normalizeRotation(rotation) { | |
var result = rotation.slice(0); | |
if (result[0] === Math.PI * 0.5 || result[0] === -Math.PI * 0.5) { | |
result[0] = -result[0]; | |
result[1] = Math.PI - result[1]; | |
result[2] -= Math.PI; | |
} | |
if (result[0] > Math.PI * 0.5) { | |
result[0] = result[0] - Math.PI; | |
result[1] = Math.PI - result[1]; | |
result[2] -= Math.PI; | |
} | |
if (result[0] < -Math.PI * 0.5) { | |
result[0] = result[0] + Math.PI; | |
result[1] = -Math.PI - result[1]; | |
result[2] -= Math.PI; | |
} | |
while (result[1] < -Math.PI) { result[1] += 2 * Math.PI; } | |
while (result[1] >= Math.PI) { result[1] -= 2 * Math.PI; } | |
while (result[2] < -Math.PI) { result[2] += 2 * Math.PI; } | |
while (result[2] >= Math.PI) { result[2] -= 2 * Math.PI; } | |
return result; | |
}; | |
/** | |
* (Property) Array defining a translation forward in z by 1 | |
* | |
* @property {array} inFront | |
* @static | |
* @final | |
*/ | |
Transform.inFront = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1e-3, 1]; | |
/** | |
* (Property) Array defining a translation backwards in z by 1 | |
* | |
* @property {array} behind | |
* @static | |
* @final | |
*/ | |
Transform.behind = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, -1e-3, 1]; | |
var Transform_1 = Transform; | |
/* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
* | |
* Owner: [email protected] | |
* @license MPL 2.0 | |
* @copyright Famous Industries, Inc. 2015 | |
*/ | |
/** | |
* This namespace holds standalone functionality. | |
* Currently includes name mapping for transition curves, | |
* name mapping for origin pairs, and the after() function. | |
* | |
* @class Utility | |
* @static | |
*/ | |
var Utility = {}; | |
/** | |
* Table of direction array positions | |
* | |
* @property {object} Direction | |
* @final | |
*/ | |
Utility.Direction = { | |
X: 0, | |
Y: 1, | |
Z: 2 | |
}; | |
/** | |
* Return wrapper around callback function. Once the wrapper is called N | |
* times, invoke the callback function. Arguments and scope preserved. | |
* | |
* @method after | |
* | |
* @param {number} count number of calls before callback function invoked | |
* @param {Function} callback wrapped callback function | |
* | |
* @return {function} wrapped callback with coundown feature | |
*/ | |
Utility.after = function after(count, callback) { | |
var counter = count; | |
return function() { | |
counter--; | |
if (counter === 0) { callback.apply(this, arguments); } | |
}; | |
}; | |
/** | |
* Load a URL and return its contents in a callback | |
* | |
* @method loadURL | |
* | |
* @param {string} url URL of object | |
* @param {function} callback callback to dispatch with content | |
*/ | |
Utility.loadURL = function loadURL(url, callback) { | |
var xhr = new XMLHttpRequest(); | |
xhr.onreadystatechange = function onreadystatechange() { | |
if (this.readyState === 4) { | |
if (callback) { callback(this.responseText); } | |
} | |
}; | |
xhr.open('GET', url); | |
xhr.send(); | |
}; | |
/** | |
* Create a document fragment from a string of HTML | |
* | |
* @method createDocumentFragmentFromHTML | |
* | |
* @param {string} html HTML to convert to DocumentFragment | |
* | |
* @return {DocumentFragment} DocumentFragment representing input HTML | |
*/ | |
Utility.createDocumentFragmentFromHTML = function createDocumentFragmentFromHTML(html) { | |
var element = document.createElement('div'); | |
element.innerHTML = html; | |
var result = document.createDocumentFragment(); | |
while (element.hasChildNodes()) { result.appendChild(element.firstChild); } | |
return result; | |
}; | |
/* | |
* Deep clone an object. | |
* @param b {Object} Object to clone | |
* @return a {Object} Cloned object. | |
*/ | |
Utility.clone = function clone(b) { | |
var a; | |
if (typeof b === 'object') { | |
a = (b instanceof Array) ? [] : {}; | |
for (var key in b) { | |
if (typeof b[key] === 'object' && b[key] !== null) { | |
if (b[key] instanceof Array) { | |
a[key] = new Array(b[key].length); | |
for (var i = 0; i < b[key].length; i++) { | |
a[key][i] = Utility.clone(b[key][i]); | |
} | |
} | |
else { | |
a[key] = Utility.clone(b[key]); | |
} | |
} | |
else { | |
a[key] = b[key]; | |
} | |
} | |
} | |
else { | |
a = b; | |
} | |
return a; | |
}; | |
var Utility_1 = Utility; | |
/* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
* | |
* Owner: [email protected] | |
* @license MPL 2.0 | |
* @copyright Famous Industries, Inc. 2015 | |
*/ | |
/*eslint-disable new-cap */ | |
/** | |
* Transition meta-method to support transitioning multiple | |
* values with scalar-only methods. | |
* | |
* | |
* @class MultipleTransition | |
* @constructor | |
* | |
* @param {Object} method Transionable class to multiplex | |
*/ | |
function MultipleTransition(method) { | |
this.method = method; | |
this._instances = []; | |
this.state = []; | |
} | |
MultipleTransition.SUPPORTS_MULTIPLE = true; | |
/** | |
* Get the state of each transition. | |
* | |
* @method get | |
* | |
* @return state {Number|Array} state array | |
*/ | |
MultipleTransition.prototype.get = function get() { | |
var this$1 = this; | |
for (var i = 0; i < this._instances.length; i++) { | |
this$1.state[i] = this$1._instances[i].get(); | |
} | |
return this.state; | |
}; | |
/** | |
* Set the end states with a shared transition, with optional callback. | |
* | |
* @method set | |
* | |
* @param {Number|Array} endState Final State. Use a multi-element argument for multiple transitions. | |
* @param {Object} transition Transition definition, shared among all instances | |
* @param {Function} callback called when all endStates have been reached. | |
*/ | |
MultipleTransition.prototype.set = function set(endState, transition, callback) { | |
var this$1 = this; | |
var _allCallback = Utility_1.after(endState.length, callback); | |
for (var i = 0; i < endState.length; i++) { | |
if (!this$1._instances[i]) { this$1._instances[i] = new (this$1.method)(); } | |
this$1._instances[i].set(endState[i], transition, _allCallback); | |
} | |
}; | |
/** | |
* Reset all transitions to start state. | |
* | |
* @method reset | |
* | |
* @param {Number|Array} startState Start state | |
*/ | |
MultipleTransition.prototype.reset = function reset(startState) { | |
var this$1 = this; | |
for (var i = 0; i < startState.length; i++) { | |
if (!this$1._instances[i]) { this$1._instances[i] = new (this$1.method)(); } | |
this$1._instances[i].reset(startState[i]); | |
} | |
}; | |
var MultipleTransition_1 = MultipleTransition; | |
/* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
* | |
* Owner: [email protected] | |
* @license MPL 2.0 | |
* @copyright Famous Industries, Inc. 2015 | |
*/ | |
/** | |
* | |
* A state maintainer for a smooth transition between | |
* numerically-specified states. Example numeric states include floats or | |
* Transfornm objects. | |
* | |
* An initial state is set with the constructor or set(startValue). A | |
* corresponding end state and transition are set with set(endValue, | |
* transition). Subsequent calls to set(endValue, transition) begin at | |
* the last state. Calls to get(timestamp) provide the _interpolated state | |
* along the way. | |
* | |
* Note that there is no event loop here - calls to get() are the only way | |
* to find out state projected to the current (or provided) time and are | |
* the only way to trigger callbacks. Usually this kind of object would | |
* be part of the render() path of a visible component. | |
* | |
* @class TweenTransition | |
* @constructor | |
* | |
* @param {Object} options TODO | |
* beginning state | |
*/ | |
function TweenTransition(options) { | |
this.options = Object.create(TweenTransition.DEFAULT_OPTIONS); | |
if (options) { this.setOptions(options); } | |
this._startTime = 0; | |
this._startValue = 0; | |
this._updateTime = 0; | |
this._endValue = 0; | |
this._curve = undefined; | |
this._duration = 0; | |
this._active = false; | |
this._callback = undefined; | |
this.state = 0; | |
this.velocity = undefined; | |
} | |
/** | |
* Transition curves mapping independent variable t from domain [0,1] to a | |
* range within [0,1]. Includes functions 'linear', 'easeIn', 'easeOut', | |
* 'easeInOut', 'easeOutBounce', 'spring'. | |
* | |
* @property {object} Curve | |
* @final | |
*/ | |
TweenTransition.Curves = { | |
linear: function(t) { | |
return t; | |
}, | |
easeIn: function(t) { | |
return t*t; | |
}, | |
easeOut: function(t) { | |
return t*(2-t); | |
}, | |
easeInOut: function(t) { | |
if (t <= 0.5) { return 2*t*t; } | |
else { return -2*t*t + 4*t - 1; } | |
}, | |
easeOutBounce: function(t) { | |
return t*(3 - 2*t); | |
}, | |
spring: function(t) { | |
return (1 - t) * Math.sin(6 * Math.PI * t) + t; | |
} | |
}; | |
TweenTransition.SUPPORTS_MULTIPLE = true; | |
TweenTransition.DEFAULT_OPTIONS = { | |
curve: TweenTransition.Curves.linear, | |
duration: 500, | |
speed: 0 /* considered only if positive */ | |
}; | |
var registeredCurves = {}; | |
/** | |
* Add "unit" curve to internal dictionary of registered curves. | |
* | |
* @method registerCurve | |
* | |
* @static | |
* | |
* @param {string} curveName dictionary key | |
* @param {unitCurve} curve function of one numeric variable mapping [0,1] | |
* to range inside [0,1] | |
* @return {boolean} false if key is taken, else true | |
*/ | |
TweenTransition.registerCurve = function registerCurve(curveName, curve) { | |
if (!registeredCurves[curveName]) { | |
registeredCurves[curveName] = curve; | |
return true; | |
} | |
else { | |
return false; | |
} | |
}; | |
/** | |
* Remove object with key "curveName" from internal dictionary of registered | |
* curves. | |
* | |
* @method unregisterCurve | |
* | |
* @static | |
* | |
* @param {string} curveName dictionary key | |
* @return {boolean} false if key has no dictionary value | |
*/ | |
TweenTransition.unregisterCurve = function unregisterCurve(curveName) { | |
if (registeredCurves[curveName]) { | |
delete registeredCurves[curveName]; | |
return true; | |
} | |
else { | |
return false; | |
} | |
}; | |
/** | |
* Retrieve function with key "curveName" from internal dictionary of | |
* registered curves. Default curves are defined in the | |
* TweenTransition.Curves array, where the values represent | |
* unitCurve functions. | |
* | |
* @method getCurve | |
* | |
* @static | |
* | |
* @param {string} curveName dictionary key | |
* @return {unitCurve} curve function of one numeric variable mapping [0,1] | |
* to range inside [0,1] | |
*/ | |
TweenTransition.getCurve = function getCurve(curveName) { | |
var curve = registeredCurves[curveName]; | |
if (curve !== undefined) { return curve; } | |
else { throw new Error('curve not registered'); } | |
}; | |
/** | |
* Retrieve all available curves. | |
* | |
* @method getCurves | |
* | |
* @static | |
* | |
* @return {object} curve functions of one numeric variable mapping [0,1] | |
* to range inside [0,1] | |
*/ | |
TweenTransition.getCurves = function getCurves() { | |
return registeredCurves; | |
}; | |
// Interpolate: If a linear function f(0) = a, f(1) = b, then return f(t) | |
function _interpolate(a, b, t) { | |
return ((1 - t) * a) + (t * b); | |
} | |
function _clone(obj) { | |
if (obj instanceof Object) { | |
if (obj instanceof Array) { return obj.slice(0); } | |
else { return Object.create(obj); } | |
} | |
else { return obj; } | |
} | |
// Fill in missing properties in "transition" with those in defaultTransition, and | |
// convert internal named curve to function object, returning as new | |
// object. | |
function _normalize(transition, defaultTransition) { | |
var result = {curve: defaultTransition.curve}; | |
if (defaultTransition.duration) { result.duration = defaultTransition.duration; } | |
if (defaultTransition.speed) { result.speed = defaultTransition.speed; } | |
if (transition instanceof Object) { | |
if (transition.duration !== undefined) { result.duration = transition.duration; } | |
if (transition.curve) { result.curve = transition.curve; } | |
if (transition.speed) { result.speed = transition.speed; } | |
} | |
if (typeof result.curve === 'string') { result.curve = TweenTransition.getCurve(result.curve); } | |
return result; | |
} | |
/** | |
* Set internal options, overriding any default options. | |
* | |
* @method setOptions | |
* | |
* | |
* @param {Object} options options object | |
* @param {Object} [options.curve] function mapping [0,1] to [0,1] or identifier | |
* @param {Number} [options.duration] duration in ms | |
* @param {Number} [options.speed] speed in pixels per ms | |
*/ | |
TweenTransition.prototype.setOptions = function setOptions(options) { | |
if (options.curve !== undefined) { this.options.curve = options.curve; } | |
if (options.duration !== undefined) { this.options.duration = options.duration; } | |
if (options.speed !== undefined) { this.options.speed = options.speed; } | |
}; | |
/** | |
* Add transition to end state to the queue of pending transitions. Special | |
* Use: calling without a transition resets the object to that state with | |
* no pending actions | |
* | |
* @method set | |
* | |
* | |
* @param {number|FamousMatrix|Array.Number|Object.<number, number>} endValue | |
* end state to which we _interpolate | |
* @param {transition=} transition object of type {duration: number, curve: | |
* f[0,1] -> [0,1] or name}. If transition is omitted, change will be | |
* instantaneous. | |
* @param {function()=} callback Zero-argument function to call on observed | |
* completion (t=1) | |
*/ | |
TweenTransition.prototype.set = function set(endValue, transition, callback) { | |
if (!transition) { | |
this.reset(endValue); | |
if (callback) { callback(); } | |
return; | |
} | |
this._startValue = _clone(this.get()); | |
transition = _normalize(transition, this.options); | |
if (transition.speed) { | |
var startValue = this._startValue; | |
if (startValue instanceof Object) { | |
var variance = 0; | |
for (var i in startValue) { variance += (endValue[i] - startValue[i]) * (endValue[i] - startValue[i]); } | |
transition.duration = Math.sqrt(variance) / transition.speed; | |
} | |
else { | |
transition.duration = Math.abs(endValue - startValue) / transition.speed; | |
} | |
} | |
this._startTime = Date.now(); | |
this._endValue = _clone(endValue); | |
this._startVelocity = _clone(transition.velocity); | |
this._duration = transition.duration; | |
this._curve = transition.curve; | |
this._active = true; | |
this._callback = callback; | |
}; | |
/** | |
* Cancel all transitions and reset to a stable state | |
* | |
* @method reset | |
* | |
* @param {number|Array.Number|Object.<number, number>} startValue | |
* starting state | |
* @param {number} startVelocity | |
* starting velocity | |
*/ | |
TweenTransition.prototype.reset = function reset(startValue, startVelocity) { | |
if (this._callback) { | |
var callback = this._callback; | |
this._callback = undefined; | |
callback(); | |
} | |
this.state = _clone(startValue); | |
this.velocity = _clone(startVelocity); | |
this._startTime = 0; | |
this._duration = 0; | |
this._updateTime = 0; | |
this._startValue = this.state; | |
this._startVelocity = this.velocity; | |
this._endValue = this.state; | |
this._active = false; | |
}; | |
/** | |
* Get current velocity | |
* | |
* @method getVelocity | |
* | |
* @returns {Number} velocity | |
*/ | |
TweenTransition.prototype.getVelocity = function getVelocity() { | |
return this.velocity; | |
}; | |
/** | |
* Get interpolated state of current action at provided time. If the last | |
* action has completed, invoke its callback. | |
* | |
* @method get | |
* | |
* | |
* @param {number=} timestamp Evaluate the curve at a normalized version of this | |
* time. If omitted, use current time. (Unix epoch time) | |
* @return {number|Object.<number|string, number>} beginning state | |
* _interpolated to this point in time. | |
*/ | |
TweenTransition.prototype.get = function get(timestamp) { | |
this.update(timestamp); | |
return this.state; | |
}; | |
function _calculateVelocity(current, start, curve, duration, t) { | |
var velocity; | |
var eps = 1e-7; | |
var speed = (curve(t) - curve(t - eps)) / eps; | |
if (current instanceof Array) { | |
velocity = []; | |
for (var i = 0; i < current.length; i++){ | |
if (typeof current[i] === 'number') | |
{ velocity[i] = speed * (current[i] - start[i]) / duration; } | |
else | |
{ velocity[i] = 0; } | |
} | |
} | |
else { velocity = speed * (current - start) / duration; } | |
return velocity; | |
} | |
function _calculateState(start, end, t) { | |
var state; | |
if (start instanceof Array) { | |
state = []; | |
for (var i = 0; i < start.length; i++) { | |
if (typeof start[i] === 'number') | |
{ state[i] = _interpolate(start[i], end[i], t); } | |
else | |
{ state[i] = start[i]; } | |
} | |
} | |
else { state = _interpolate(start, end, t); } | |
return state; | |
} | |
/** | |
* Update internal state to the provided timestamp. This may invoke the last | |
* callback and begin a new action. | |
* | |
* @method update | |
* | |
* | |
* @param {number=} timestamp Evaluate the curve at a normalized version of this | |
* time. If omitted, use current time. (Unix epoch time) | |
*/ | |
TweenTransition.prototype.update = function update(timestamp) { | |
if (!this._active) { | |
if (this._callback) { | |
var callback = this._callback; | |
this._callback = undefined; | |
callback(); | |
} | |
return; | |
} | |
if (!timestamp) { timestamp = Date.now(); } | |
if (this._updateTime >= timestamp) { return; } | |
this._updateTime = timestamp; | |
var timeSinceStart = timestamp - this._startTime; | |
if (timeSinceStart >= this._duration) { | |
this.state = this._endValue; | |
this.velocity = _calculateVelocity(this.state, this._startValue, this._curve, this._duration, 1); | |
this._active = false; | |
} | |
else if (timeSinceStart < 0) { | |
this.state = this._startValue; | |
this.velocity = this._startVelocity; | |
} | |
else { | |
var t = timeSinceStart / this._duration; | |
this.state = _calculateState(this._startValue, this._endValue, this._curve(t)); | |
this.velocity = _calculateVelocity(this.state, this._startValue, this._curve, this._duration, t); | |
} | |
}; | |
/** | |
* Is there at least one action pending completion? | |
* | |
* @method isActive | |
* | |
* | |
* @return {boolean} | |
*/ | |
TweenTransition.prototype.isActive = function isActive() { | |
return this._active; | |
}; | |
/** | |
* Halt transition at current state and erase all pending actions. | |
* | |
* @method halt | |
* | |
*/ | |
TweenTransition.prototype.halt = function halt() { | |
this.reset(this.get()); | |
}; | |
// Register all the default curves | |
TweenTransition.registerCurve('linear', TweenTransition.Curves.linear); | |
TweenTransition.registerCurve('easeIn', TweenTransition.Curves.easeIn); | |
TweenTransition.registerCurve('easeOut', TweenTransition.Curves.easeOut); | |
TweenTransition.registerCurve('easeInOut', TweenTransition.Curves.easeInOut); | |
TweenTransition.registerCurve('easeOutBounce', TweenTransition.Curves.easeOutBounce); | |
TweenTransition.registerCurve('spring', TweenTransition.Curves.spring); | |
TweenTransition.customCurve = function customCurve(v1, v2) { | |
v1 = v1 || 0; v2 = v2 || 0; | |
return function(t) { | |
return v1*t + (-2*v1 - v2 + 3)*t*t + (v1 + v2 - 2)*t*t*t; | |
}; | |
}; | |
var TweenTransition_1 = TweenTransition; | |
/* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
* | |
* Owner: [email protected] | |
* @license MPL 2.0 | |
* @copyright Famous Industries, Inc. 2015 | |
*/ | |
/*eslint-disable new-cap */ | |
/** | |
* A state maintainer for a smooth transition between | |
* numerically-specified states. Example numeric states include floats or | |
* Transform objects. | |
* | |
* An initial state is set with the constructor or set(startState). A | |
* corresponding end state and transition are set with set(endState, | |
* transition). Subsequent calls to set(endState, transition) begin at | |
* the last state. Calls to get(timestamp) provide the interpolated state | |
* along the way. | |
* | |
* Note that there is no event loop here - calls to get() are the only way | |
* to find state projected to the current (or provided) time and are | |
* the only way to trigger callbacks. Usually this kind of object would | |
* be part of the render() path of a visible component. | |
* | |
* @class Transitionable | |
* @constructor | |
* @param {number|Array.Number|Object.<number|string, number>} start | |
* beginning state | |
*/ | |
function Transitionable(start) { | |
this.currentAction = null; | |
this.actionQueue = []; | |
this.callbackQueue = []; | |
this.state = 0; | |
this.velocity = undefined; | |
this._callback = undefined; | |
this._engineInstance = null; | |
this._currentMethod = null; | |
this.set(start); | |
} | |
var transitionMethods = {}; | |
Transitionable.register = function register(methods) { | |
var success = true; | |
for (var method in methods) { | |
if (!Transitionable.registerMethod(method, methods[method])) | |
{ success = false; } | |
} | |
return success; | |
}; | |
Transitionable.registerMethod = function registerMethod(name, engineClass) { | |
if (!(name in transitionMethods)) { | |
transitionMethods[name] = engineClass; | |
return true; | |
} | |
else { return false; } | |
}; | |
Transitionable.unregisterMethod = function unregisterMethod(name) { | |
if (name in transitionMethods) { | |
delete transitionMethods[name]; | |
return true; | |
} | |
else { return false; } | |
}; | |
function _loadNext() { | |
if (this._callback) { | |
var callback = this._callback; | |
this._callback = undefined; | |
callback(); | |
} | |
if (this.actionQueue.length <= 0) { | |
this.set(this.get()); // no update required | |
return; | |
} | |
this.currentAction = this.actionQueue.shift(); | |
this._callback = this.callbackQueue.shift(); | |
var method = null; | |
var endValue = this.currentAction[0]; | |
var transition = this.currentAction[1]; | |
if (transition instanceof Object && transition.method) { | |
method = transition.method; | |
if (typeof method === 'string') { method = transitionMethods[method]; } | |
} | |
else { | |
method = TweenTransition_1; | |
} | |
if (this._currentMethod !== method) { | |
if (!(endValue instanceof Object) || method.SUPPORTS_MULTIPLE === true || endValue.length <= method.SUPPORTS_MULTIPLE) { | |
this._engineInstance = new method(); | |
} | |
else { | |
this._engineInstance = new MultipleTransition_1(method); | |
} | |
this._currentMethod = method; | |
} | |
this._engineInstance.reset(this.state, this.velocity); | |
if (this.velocity !== undefined) { transition.velocity = this.velocity; } | |
this._engineInstance.set(endValue, transition, _loadNext.bind(this)); | |
} | |
/** | |
* Add transition to end state to the queue of pending transitions. Special | |
* Use: calling without a transition resets the object to that state with | |
* no pending actions | |
* | |
* @method set | |
* | |
* @param {number|FamousMatrix|Array.Number|Object.<number, number>} endState | |
* end state to which we interpolate | |
* @param {transition=} transition object of type {duration: number, curve: | |
* f[0,1] -> [0,1] or name}. If transition is omitted, change will be | |
* instantaneous. | |
* @param {function()=} callback Zero-argument function to call on observed | |
* completion (t=1) | |
*/ | |
Transitionable.prototype.set = function set(endState, transition, callback) { | |
if (!transition) { | |
this.reset(endState); | |
if (callback) { callback(); } | |
return this; | |
} | |
var action = [endState, transition]; | |
this.actionQueue.push(action); | |
this.callbackQueue.push(callback); | |
if (!this.currentAction) { _loadNext.call(this); } | |
return this; | |
}; | |
/** | |
* Cancel all transitions and reset to a stable state | |
* | |
* @method reset | |
* | |
* @param {number|Array.Number|Object.<number, number>} startState | |
* stable state to set to | |
*/ | |
Transitionable.prototype.reset = function reset(startState, startVelocity) { | |
this._currentMethod = null; | |
this._engineInstance = null; | |
this._callback = undefined; | |
this.state = startState; | |
this.velocity = startVelocity; | |
this.currentAction = null; | |
this.actionQueue = []; | |
this.callbackQueue = []; | |
}; | |
/** | |
* Add delay action to the pending action queue queue. | |
* | |
* @method delay | |
* | |
* @param {number} duration delay time (ms) | |
* @param {function} callback Zero-argument function to call on observed | |
* completion (t=1) | |
*/ | |
Transitionable.prototype.delay = function delay(duration, callback) { | |
var endValue; | |
if (this.actionQueue.length) { endValue = this.actionQueue[this.actionQueue.length - 1][0]; } | |
else if (this.currentAction) { endValue = this.currentAction[0]; } | |
else { endValue = this.get(); } | |
return this.set(endValue, { duration: duration, | |
curve: function() { | |
return 0; | |
}}, | |
callback | |
); | |
}; | |
/** | |
* Get interpolated state of current action at provided time. If the last | |
* action has completed, invoke its callback. | |
* | |
* @method get | |
* | |
* @param {number=} timestamp Evaluate the curve at a normalized version of this | |
* time. If omitted, use current time. (Unix epoch time) | |
* @return {number|Object.<number|string, number>} beginning state | |
* interpolated to this point in time. | |
*/ | |
Transitionable.prototype.get = function get(timestamp) { | |
if (this._engineInstance) { | |
if (this._engineInstance.getVelocity) | |
{ this.velocity = this._engineInstance.getVelocity(); } | |
this.state = this._engineInstance.get(timestamp); | |
} | |
return this.state; | |
}; | |
/** | |
* Is there at least one action pending completion? | |
* | |
* @method isActive | |
* | |
* @return {boolean} | |
*/ | |
Transitionable.prototype.isActive = function isActive() { | |
return !!this.currentAction; | |
}; | |
/** | |
* Halt transition at current state and erase all pending actions. | |
* | |
* @method halt | |
*/ | |
Transitionable.prototype.halt = function halt() { | |
return this.set(this.get()); | |
}; | |
var Transitionable_1 = Transitionable; | |
/* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
* | |
* Owner: [email protected] | |
* @license MPL 2.0 | |
* @copyright Famous Industries, Inc. 2015 | |
*/ | |
/** | |
* A library of curves which map an animation explicitly as a function of time. | |
* | |
* @class Easing | |
*/ | |
var Easing = { | |
/** | |
* @property inQuad | |
* @static | |
*/ | |
inQuad: function(t) { | |
return t*t; | |
}, | |
/** | |
* @property outQuad | |
* @static | |
*/ | |
outQuad: function(t) { | |
return -(t-=1)*t+1; | |
}, | |
/** | |
* @property inOutQuad | |
* @static | |
*/ | |
inOutQuad: function(t) { | |
if ((t/=.5) < 1) { return .5*t*t; } | |
return -.5*((--t)*(t-2) - 1); | |
}, | |
/** | |
* @property inCubic | |
* @static | |
*/ | |
inCubic: function(t) { | |
return t*t*t; | |
}, | |
/** | |
* @property outCubic | |
* @static | |
*/ | |
outCubic: function(t) { | |
return ((--t)*t*t + 1); | |
}, | |
/** | |
* @property inOutCubic | |
* @static | |
*/ | |
inOutCubic: function(t) { | |
if ((t/=.5) < 1) { return .5*t*t*t; } | |
return .5*((t-=2)*t*t + 2); | |
}, | |
/** | |
* @property inQuart | |
* @static | |
*/ | |
inQuart: function(t) { | |
return t*t*t*t; | |
}, | |
/** | |
* @property outQuart | |
* @static | |
*/ | |
outQuart: function(t) { | |
return -((--t)*t*t*t - 1); | |
}, | |
/** | |
* @property inOutQuart | |
* @static | |
*/ | |
inOutQuart: function(t) { | |
if ((t/=.5) < 1) { return .5*t*t*t*t; } | |
return -.5 * ((t-=2)*t*t*t - 2); | |
}, | |
/** | |
* @property inQuint | |
* @static | |
*/ | |
inQuint: function(t) { | |
return t*t*t*t*t; | |
}, | |
/** | |
* @property outQuint | |
* @static | |
*/ | |
outQuint: function(t) { | |
return ((--t)*t*t*t*t + 1); | |
}, | |
/** | |
* @property inOutQuint | |
* @static | |
*/ | |
inOutQuint: function(t) { | |
if ((t/=.5) < 1) { return .5*t*t*t*t*t; } | |
return .5*((t-=2)*t*t*t*t + 2); | |
}, | |
/** | |
* @property inSine | |
* @static | |
*/ | |
inSine: function(t) { | |
return -1.0*Math.cos(t * (Math.PI/2)) + 1.0; | |
}, | |
/** | |
* @property outSine | |
* @static | |
*/ | |
outSine: function(t) { | |
return Math.sin(t * (Math.PI/2)); | |
}, | |
/** | |
* @property inOutSine | |
* @static | |
*/ | |
inOutSine: function(t) { | |
return -.5*(Math.cos(Math.PI*t) - 1); | |
}, | |
/** | |
* @property inExpo | |
* @static | |
*/ | |
inExpo: function(t) { | |
return (t===0) ? 0.0 : Math.pow(2, 10 * (t - 1)); | |
}, | |
/** | |
* @property outExpo | |
* @static | |
*/ | |
outExpo: function(t) { | |
return (t===1.0) ? 1.0 : (-Math.pow(2, -10 * t) + 1); | |
}, | |
/** | |
* @property inOutExpo | |
* @static | |
*/ | |
inOutExpo: function(t) { | |
if (t===0) { return 0.0; } | |
if (t===1.0) { return 1.0; } | |
if ((t/=.5) < 1) { return .5 * Math.pow(2, 10 * (t - 1)); } | |
return .5 * (-Math.pow(2, -10 * --t) + 2); | |
}, | |
/** | |
* @property inCirc | |
* @static | |
*/ | |
inCirc: function(t) { | |
return -(Math.sqrt(1 - t*t) - 1); | |
}, | |
/** | |
* @property outCirc | |
* @static | |
*/ | |
outCirc: function(t) { | |
return Math.sqrt(1 - (--t)*t); | |
}, | |
/** | |
* @property inOutCirc | |
* @static | |
*/ | |
inOutCirc: function(t) { | |
if ((t/=.5) < 1) { return -.5 * (Math.sqrt(1 - t*t) - 1); } | |
return .5 * (Math.sqrt(1 - (t-=2)*t) + 1); | |
}, | |
/** | |
* @property inElastic | |
* @static | |
*/ | |
inElastic: function(t) { | |
var s=1.70158;var p=0;var a=1.0; | |
if (t===0) { return 0.0; } if (t===1) { return 1.0; } if (!p) { p=.3; } | |
s = p/(2*Math.PI) * Math.asin(1.0/a); | |
return -(a*Math.pow(2,10*(t-=1)) * Math.sin((t-s)*(2*Math.PI)/ p)); | |
}, | |
/** | |
* @property outElastic | |
* @static | |
*/ | |
outElastic: function(t) { | |
var s=1.70158;var p=0;var a=1.0; | |
if (t===0) { return 0.0; } if (t===1) { return 1.0; } if (!p) { p=.3; } | |
s = p/(2*Math.PI) * Math.asin(1.0/a); | |
return a*Math.pow(2,-10*t) * Math.sin((t-s)*(2*Math.PI)/p) + 1.0; | |
}, | |
/** | |
* @property inOutElastic | |
* @static | |
*/ | |
inOutElastic: function(t) { | |
var s=1.70158;var p=0;var a=1.0; | |
if (t===0) { return 0.0; } if ((t/=.5)===2) { return 1.0; } if (!p) { p=(.3*1.5); } | |
s = p/(2*Math.PI) * Math.asin(1.0/a); | |
if (t < 1) { return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin((t-s)*(2*Math.PI)/p)); } | |
return a*Math.pow(2,-10*(t-=1)) * Math.sin((t-s)*(2*Math.PI)/p)*.5 + 1.0; | |
}, | |
/** | |
* @property inBack | |
* @static | |
*/ | |
inBack: function(t, s) { | |
if (s === undefined) { s = 1.70158; } | |
return t*t*((s+1)*t - s); | |
}, | |
/** | |
* @property outBack | |
* @static | |
*/ | |
outBack: function(t, s) { | |
if (s === undefined) { s = 1.70158; } | |
return ((--t)*t*((s+1)*t + s) + 1); | |
}, | |
/** | |
* @property inOutBack | |
* @static | |
*/ | |
inOutBack: function(t, s) { | |
if (s === undefined) { s = 1.70158; } | |
if ((t/=.5) < 1) { return .5*(t*t*(((s*=(1.525))+1)*t - s)); } | |
return .5*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2); | |
}, | |
/** | |
* @property inBounce | |
* @static | |
*/ | |
inBounce: function(t) { | |
return 1.0 - Easing.outBounce(1.0-t); | |
}, | |
/** | |
* @property outBounce | |
* @static | |
*/ | |
outBounce: function(t) { | |
if (t < (1/2.75)) { | |
return (7.5625*t*t); | |
} else if (t < (2/2.75)) { | |
return (7.5625*(t-=(1.5/2.75))*t + .75); | |
} else if (t < (2.5/2.75)) { | |
return (7.5625*(t-=(2.25/2.75))*t + .9375); | |
} else { | |
return (7.5625*(t-=(2.625/2.75))*t + .984375); | |
} | |
}, | |
/** | |
* @property inOutBounce | |
* @static | |
*/ | |
inOutBounce: function(t) { | |
if (t < .5) { return Easing.inBounce(t*2) * .5; } | |
return Easing.outBounce(t*2-1.0) * .5 + .5; | |
} | |
}; | |
var Easing_1 = Easing; | |
/* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
* | |
* Owner: [email protected] | |
* @license MPL 2.0 | |
* @copyright Famous Industries, Inc. 2015 | |
*/ | |
/** | |
* A class for transitioning the state of a Transform by transitioning the | |
* X, Y, and Z axes of it's translate, scale, skew and rotate components | |
* independently. | |
* | |
* @class TransitionableTransform | |
* @constructor | |
* | |
* @param [transform=Transform.identity] {Transform} The initial transform state | |
*/ | |
function TransitionableTransform(transform) { | |
var this$1 = this; | |
this._final = Transform_1.identity.slice(); | |
this._finalTranslate = [0, 0, 0]; | |
this._finalRotate = [0, 0, 0]; | |
this._finalSkew = [0, 0, 0]; | |
this._finalScale = [1, 1, 1]; | |
this.translate = []; | |
this.rotate = []; | |
this.skew = []; | |
this.scale = []; | |
for (var i=0; i<3; i+=1) { | |
this$1.translate[i] = new Transitionable_1(this$1._finalTranslate[i]); | |
this$1.rotate[i] = new Transitionable_1(this$1._finalRotate[i]); | |
this$1.skew[i] = new Transitionable_1(this$1._finalSkew[i]); | |
this$1.scale[i] = new Transitionable_1(this$1._finalScale[i]); | |
} | |
if (transform) { this.set(transform); } | |
} | |
function _build() { | |
return Transform_1.build({ | |
translate: [this.translate[0].get(), this.translate[1].get(), this.translate[2].get()], | |
rotate: [this.rotate[0].get(), this.rotate[1].get(), this.rotate[2].get()], | |
skew: [this.skew[0].get(), this.skew[1].get(), this.skew[2].get()], | |
scale: [this.scale[0].get(), this.scale[1].get(), this.scale[2].get()] | |
}); | |
} | |
function _buildFinal() { | |
return Transform_1.build({ | |
translate: this._finalTranslate, | |
rotate: this._finalRotate, | |
skew: this._finalSkew, | |
scale: this._finalScale | |
}); | |
} | |
function _countOfType(array, type) { | |
var count = 0; | |
for (var i=0; i<array.length; i+=1) { | |
if (typeof array[i] === type+'') { | |
count+=1; | |
} | |
} | |
return count; | |
} | |
/** | |
* An optimized way of setting only the translation component of a Transform. Axes who's values are null will not be affected. | |
* | |
* @method setTranslate | |
* @chainable | |
* | |
* @param translate {Array} New translation state | |
* @param [transition] {Object} Transition definition | |
* @param [callback] {Function} Callback | |
* @return {TransitionableTransform} | |
*/ | |
TransitionableTransform.prototype.setTranslate = function setTranslate(translate, transition, callback) { | |
var this$1 = this; | |
var numberOfAxes = _countOfType(translate, 'number'); | |
var _callback = callback ? Utility_1.after(numberOfAxes, callback) : null; | |
for (var i=0; i<translate.length; i+=1) { | |
if (typeof translate[i] === 'number') { | |
this$1.translate[i].set(translate[i], transition, _callback); | |
this$1._finalTranslate[i] = translate[i]; | |
} | |
} | |
this._final = _buildFinal.call(this); | |
return this; | |
}; | |
/** | |
* Translate only along the X axis of the translation component of a Transform. | |
* | |
* @method setTranslateX | |
* @chainable | |
* | |
* @param translate {Number} New translation state | |
* @param [transition] {Object} Transition definition | |
* @param [callback] {Function} Callback | |
* @return {TransitionableTransform} | |
*/ | |
TransitionableTransform.prototype.setTranslateX = function setTranslateX(translate, transition, callback) { | |
this.translate[0].set(translate, transition, callback); | |
this._finalTranslate[0] = translate; | |
this._final = _buildFinal.call(this); | |
return this; | |
}; | |
/** | |
* Translate only along the Y axis of the translation component of a Transform. | |
* | |
* @method setTranslateY | |
* @chainable | |
* | |
* @param translate {Number} New translation state | |
* @param [transition] {Object} Transition definition | |
* @param [callback] {Function} Callback | |
* @return {TransitionableTransform} | |
*/ | |
TransitionableTransform.prototype.setTranslateY = function setTranslateY(translate, transition, callback) { | |
this.translate[1].set(translate, transition, callback); | |
this._finalTranslate[1] = translate; | |
this._final = _buildFinal.call(this); | |
return this; | |
}; | |
/** | |
* Translate only along the Z axis of the translation component of a Transform. | |
* | |
* @method setTranslateZ | |
* @chainable | |
* | |
* @param translate {Number} New translation state | |
* @param [transition] {Object} Transition definition | |
* @param [callback] {Function} Callback | |
* @return {TransitionableTransform} | |
*/ | |
TransitionableTransform.prototype.setTranslateZ = function setTranslateZ(translate, transition, callback) { | |
this.translate[2].set(translate, transition, callback); | |
this._finalTranslate[2] = translate; | |
this._final = _buildFinal.call(this); | |
return this; | |
}; | |
/** | |
* An optimized way of setting only the scale component of a Transform. Axes who's values are null will not be affected. | |
* | |
* @method setScale | |
* @chainable | |
* | |
* @param scale {Array} New scale state | |
* @param [transition] {Object} Transition definition | |
* @param [callback] {Function} Callback | |
* @return {TransitionableTransform} | |
*/ | |
TransitionableTransform.prototype.setScale = function setScale(scale, transition, callback) { | |
var this$1 = this; | |
var numberOfAxes = _countOfType(scale, 'number'); | |
var _callback = callback ? Utility_1.after(numberOfAxes, callback) : null; | |
for (var i=0; i<scale.length; i+=1) { | |
if (typeof scale[i] === 'number') { | |
this$1.scale[i].set(scale[i], transition, _callback); | |
this$1._finalScale[i] = scale[i]; | |
} | |
} | |
this._final = _buildFinal.call(this); | |
return this; | |
}; | |
/** | |
* Scale only along the X axis of the scale component of a Transform. | |
* | |
* @method setScaleX | |
* @chainable | |
* | |
* @param scale {Number} New scale state | |
* @param [transition] {Object} Transition definition | |
* @param [callback] {Function} Callback | |
* @return {TransitionableTransform} | |
*/ | |
TransitionableTransform.prototype.setScaleX = function setScaleX(scale, transition, callback) { | |
this.scale[0].set(scale, transition, callback); | |
this._finalScale[0] = scale; | |
this._final = _buildFinal.call(this); | |
return this; | |
}; | |
/** | |
* Scale only along the Y axis of the scale component of a Transform. | |
* | |
* @method setScaleY | |
* @chainable | |
* | |
* @param scale {Number} New scale state | |
* @param [transition] {Object} Transition definition | |
* @param [callback] {Function} Callback | |
* @return {TransitionableTransform} | |
*/ | |
TransitionableTransform.prototype.setScaleY = function setScaleY(scale, transition, callback) { | |
this.scale[1].set(scale, transition, callback); | |
this._finalScale[1] = scale; | |
this._final = _buildFinal.call(this); | |
return this; | |
}; | |
/** | |
* Scale only along the Z axis of the scale component of a Transform. | |
* | |
* @method setScaleZ | |
* @chainable | |
* | |
* @param scale {Number} New scale state | |
* @param [transition] {Object} Transition definition | |
* @param [callback] {Function} Callback | |
* @return {TransitionableTransform} | |
*/ | |
TransitionableTransform.prototype.setScaleZ = function setScaleZ(scale, transition, callback) { | |
this.scale[2].set(scale, transition, callback); | |
this._finalScale[2] = scale; | |
this._final = _buildFinal.call(this); | |
return this; | |
}; | |
/** | |
* An optimized way of setting only the rotational component of a Transform. Axes who's values are null will not be affected. | |
* | |
* @method setRotate | |
* @chainable | |
* | |
* @param eulerAngles {Array} Euler angles for new rotation state | |
* @param [transition] {Object} Transition definition | |
* @param [callback] {Function} Callback | |
* @return {TransitionableTransform} | |
*/ | |
TransitionableTransform.prototype.setRotate = function setRotate(eulerAngles, transition, callback) { | |
var this$1 = this; | |
var numberOfAxes = _countOfType(eulerAngles, 'number'); | |
var _callback = callback ? Utility_1.after(numberOfAxes, callback) : null; | |
for (var i=0; i<eulerAngles.length; i+=1) { | |
if (typeof eulerAngles[i] === 'number') { | |
this$1.rotate[i].set(eulerAngles[i], transition, _callback); | |
this$1._finalRotate[i] = eulerAngles[i]; | |
} | |
} | |
this._final = _buildFinal.call(this); | |
return this; | |
}; | |
/** | |
* Rotate only about the X axis of the rotational component of a Transform. | |
* | |
* @method setScaleX | |
* @chainable | |
* | |
* @param eulerAngle {Number} New rotational state | |
* @param [transition] {Object} Transition definition | |
* @param [callback] {Function} Callback | |
* @return {TransitionableTransform} | |
*/ | |
TransitionableTransform.prototype.setRotateX = function setRotateX(eulerAngle, transition, callback) { | |
this.rotate[0].set(eulerAngle, transition, callback); | |
this._finalRotate[0] = eulerAngle; | |
this._final = _buildFinal.call(this); | |
return this; | |
}; | |
/** | |
* Rotate only about the Y axis of the rotational component of a Transform. | |
* | |
* @method setScaleY | |
* @chainable | |
* | |
* @param eulerAngle {Number} New rotational state | |
* @param [transition] {Object} Transition definition | |
* @param [callback] {Function} Callback | |
* @return {TransitionableTransform} | |
*/ | |
TransitionableTransform.prototype.setRotateY = function setRotateY(eulerAngle, transition, callback) { | |
this.rotate[1].set(eulerAngle, transition, callback); | |
this._finalRotate[1] = eulerAngle; | |
this._final = _buildFinal.call(this); | |
return this; | |
}; | |
/** | |
* Rotate only about the Z axis of the rotational component of a Transform. | |
* | |
* @method setScaleZ | |
* @chainable | |
* | |
* @param eulerAngle {Number} New rotational state | |
* @param [transition] {Object} Transition definition | |
* @param [callback] {Function} Callback | |
* @return {TransitionableTransform} | |
*/ | |
TransitionableTransform.prototype.setRotateZ = function setRotateZ(eulerAngle, transition, callback) { | |
this.rotate[2].set(eulerAngle, transition, callback); | |
this._finalRotate[2] = eulerAngle; | |
this._final = _buildFinal.call(this); | |
return this; | |
}; | |
/** | |
* An optimized way of setting only the skew component of a Transform. Axes who's values are null will not be affected. | |
* | |
* @method setSkew | |
* @chainable | |
* | |
* @param skewAngles {Array} New skew state. Axes who's values are null will not be affected. | |
* @param [transition] {Object} Transition definition | |
* @param [callback] {Function} Callback | |
* @return {TransitionableTransform} | |
*/ | |
TransitionableTransform.prototype.setSkew = function setSkew(skewAngles, transition, callback) { | |
var this$1 = this; | |
var numberOfAxes = _countOfType(skewAngles, 'number'); | |
var _callback = callback ? Utility_1.after(numberOfAxes, callback) : null; | |
for (var i=0; i<skewAngles.length; i+=1) { | |
if (typeof skewAngles[i] === 'number') { | |
this$1.skew[i].set(skewAngles[i], transition, _callback); | |
this$1._finalSkew[i] = skewAngles[i]; | |
} | |
} | |
this._final = _buildFinal.call(this); | |
return this; | |
}; | |
/** | |
* Skew only about the X axis of the skew component of a Transform. | |
* | |
* @method setSkewX | |
* @chainable | |
* | |
* @param skewAngle {Number} New skew state | |
* @param [transition] {Object} Transition definition | |
* @param [callback] {Function} Callback | |
* @return {TransitionableTransform} | |
*/ | |
TransitionableTransform.prototype.setSkewX = function setSkewX(skewAngle, transition, callback) { | |
this.skew[0].set(skewAngle, transition, callback); | |
this._finalSkew[0] = skewAngle; | |
this._final = _buildFinal.call(this); | |
return this; | |
}; | |
/** | |
* Skew only about the Y axis of the skew component of a Transform. | |
* | |
* @method setSkewY | |
* @chainable | |
* | |
* @param skewAngle {Number} New skew state | |
* @param [transition] {Object} Transition definition | |
* @param [callback] {Function} Callback | |
* @return {TransitionableTransform} | |
*/ | |
TransitionableTransform.prototype.setSkewY = function setSkewY(skewAngle, transition, callback) { | |
this.skew[1].set(skewAngle, transition, callback); | |
this._finalSkew[1] = skewAngle; | |
this._final = _buildFinal.call(this); | |
return this; | |
}; | |
/** | |
* Skew only about the Z axis of the skew component of a Transform. | |
* | |
* @method setSkewZ | |
* @chainable | |
* | |
* @param skewAngle {Number} New skew state | |
* @param [transition] {Object} Transition definition | |
* @param [callback] {Function} Callback | |
* @return {TransitionableTransform} | |
*/ | |
TransitionableTransform.prototype.setSkewZ = function setSkewZ(skewAngle, transition, callback) { | |
this.skew[2].set(skewAngle, transition, callback); | |
this._finalSkew[2] = skewAngle; | |
this._final = _buildFinal.call(this); | |
return this; | |
}; | |
/** | |
* Setter for a TransitionableTransform with optional parameters to transition | |
* between Transforms. Animates all axes of all components. | |
* | |
* @method set | |
* @chainable | |
* | |
* @param transform {Array} New transform state | |
* @param [transition] {Object} Transition definition | |
* @param [callback] {Function} Callback | |
* @return {TransitionableTransform} | |
*/ | |
TransitionableTransform.prototype.set = function set(transform, transition, callback) { | |
var this$1 = this; | |
var components = Transform_1.interpret(transform); | |
this._finalTranslate = components.translate; | |
this._finalRotate = components.rotate; | |
this._finalSkew = components.skew; | |
this._finalScale = components.scale; | |
this._final = transform; | |
var _callback = callback ? Utility_1.after(12, callback) : null; | |
for (var i=0; i<3; i+=1) { | |
this$1.translate[i].set(components.translate[i], transition, _callback); | |
this$1.rotate[i].set(components.rotate[i], transition, _callback); | |
this$1.skew[i].set(components.skew[i], transition, _callback); | |
this$1.scale[i].set(components.scale[i], transition, _callback); | |
} | |
return this; | |
}; | |
/** | |
* Sets the default transition to use for transitioning betwen Transform states | |
* | |
* @method setDefaultTransition | |
* | |
* @param transition {Object} Transition definition | |
*/ | |
TransitionableTransform.prototype.setDefaultTransition = function setDefaultTransition(transition) { | |
var this$1 = this; | |
for (var i=0; i<3; i+=1) { | |
this$1.translate[i].setDefault(transition); | |
this$1.rotate[i].setDefault(transition); | |
this$1.skew[i].setDefault(transition); | |
this$1.scale[i].setDefault(transition); | |
} | |
}; | |
/** | |
* Getter. Returns the current state of the Transform | |
* | |
* @method get | |
* | |
* @return {Transform} | |
*/ | |
TransitionableTransform.prototype.get = function get() { | |
if (this.isActive()) { | |
return _build.call(this); | |
} | |
else { return this._final; } | |
}; | |
/** | |
* Get the destination state of the Transform | |
* | |
* @method getFinal | |
* | |
* @return Transform {Transform} | |
*/ | |
TransitionableTransform.prototype.getFinal = function getFinal() { | |
return this._final; | |
}; | |
/** | |
* Determine if the TransitionableTransform is currently transitioning | |
* | |
* @method isActive | |
* | |
* @return {Boolean} | |
*/ | |
TransitionableTransform.prototype.isActive = function isActive() { | |
var this$1 = this; | |
var isActive = false; | |
for (var i=0; i<3; i+=1) { | |
if ( | |
this$1.translate[i].isActive() | |
|| this$1.rotate[i].isActive() | |
|| this$1.skew[i].isActive() | |
|| this$1.scale[i].isActive() | |
) { | |
isActive = true; break; | |
} | |
} | |
return isActive; | |
}; | |
/** | |
* Halts the transition | |
* | |
* @method halt | |
*/ | |
TransitionableTransform.prototype.halt = function halt() { | |
var this$1 = this; | |
for (var i=0; i<3; i+=1) { | |
this$1.translate[i].halt(); | |
this$1.rotate[i].halt(); | |
this$1.skew[i].halt(); | |
this$1.scale[i].halt(); | |
this$1._finalTranslate[i] = this$1.translate[i].get(); | |
this$1._finalRotate[i] = this$1.rotate[i].get(); | |
this$1._finalSkew[i] = this$1.skew[i].get(); | |
this$1._finalScale[i] = this$1.scale[i].get(); | |
} | |
this._final = this.get(); | |
return this; | |
}; | |
var TransitionableTransform_1 = TransitionableTransform; | |
/* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
* | |
* Owner: [email protected] | |
* @license MPL 2.0 | |
* @copyright Famous Industries, Inc. 2015 | |
*/ | |
/* TODO: remove these dependencies when deprecation complete */ | |
/** | |
* | |
* A collection of visual changes to be | |
* applied to another renderable component. This collection includes a | |
* transform matrix, an opacity constant, a size, an origin specifier. | |
* Modifier objects can be added to any RenderNode or object | |
* capable of displaying renderables. The Modifier's children and descendants | |
* are transformed by the amounts specified in the Modifier's properties. | |
* | |
* @class Modifier | |
* @constructor | |
* @param {Object} [options] overrides of default options | |
* @param {Transform} [options.transform] affine transformation matrix | |
* @param {Number} [options.opacity] | |
* @param {Array.Number} [options.origin] origin adjustment | |
* @param {Array.Number} [options.size] size to apply to descendants | |
*/ | |
function Modifier(options) { | |
this._transformGetter = null; | |
this._opacityGetter = null; | |
this._originGetter = null; | |
this._alignGetter = null; | |
this._sizeGetter = null; | |
this._proportionGetter = null; | |
/* TODO: remove this when deprecation complete */ | |
this._legacyStates = {}; | |
this._output = { | |
transform: Transform_1.identity, | |
opacity: 1, | |
origin: null, | |
align: null, | |
size: null, | |
proportions: null, | |
target: null | |
}; | |
if (options) { | |
if (options.transform) { this.transformFrom(options.transform); } | |
if (options.opacity !== undefined) { this.opacityFrom(options.opacity); } | |
if (options.origin) { this.originFrom(options.origin); } | |
if (options.align) { this.alignFrom(options.align); } | |
if (options.size) { this.sizeFrom(options.size); } | |
if (options.proportions) { this.proportionsFrom(options.proportions); } | |
} | |
} | |
/** | |
* Function, object, or static transform matrix which provides the transform. | |
* This is evaluated on every tick of the engine. | |
* | |
* @method transformFrom | |
* | |
* @param {Object} transform transform provider object | |
* @return {Modifier} this | |
*/ | |
Modifier.prototype.transformFrom = function transformFrom(transform) { | |
if (transform instanceof Function) { this._transformGetter = transform; } | |
else if (transform instanceof Object && transform.get) { this._transformGetter = transform.get.bind(transform); } | |
else { | |
this._transformGetter = null; | |
this._output.transform = transform; | |
} | |
return this; | |
}; | |
/** | |
* Set function, object, or number to provide opacity, in range [0,1]. | |
* | |
* @method opacityFrom | |
* | |
* @param {Object} opacity provider object | |
* @return {Modifier} this | |
*/ | |
Modifier.prototype.opacityFrom = function opacityFrom(opacity) { | |
if (opacity instanceof Function) { this._opacityGetter = opacity; } | |
else if (opacity instanceof Object && opacity.get) { this._opacityGetter = opacity.get.bind(opacity); } | |
else { | |
this._opacityGetter = null; | |
this._output.opacity = opacity; | |
} | |
return this; | |
}; | |
/** | |
* Set function, object, or numerical array to provide origin, as [x,y], | |
* where x and y are in the range [0,1]. | |
* | |
* @method originFrom | |
* | |
* @param {Object} origin provider object | |
* @return {Modifier} this | |
*/ | |
Modifier.prototype.originFrom = function originFrom(origin) { | |
if (origin instanceof Function) { this._originGetter = origin; } | |
else if (origin instanceof Object && origin.get) { this._originGetter = origin.get.bind(origin); } | |
else { | |
this._originGetter = null; | |
this._output.origin = origin; | |
} | |
return this; | |
}; | |
/** | |
* Set function, object, or numerical array to provide align, as [x,y], | |
* where x and y are in the range [0,1]. | |
* | |
* @method alignFrom | |
* | |
* @param {Object} align provider object | |
* @return {Modifier} this | |
*/ | |
Modifier.prototype.alignFrom = function alignFrom(align) { | |
if (align instanceof Function) { this._alignGetter = align; } | |
else if (align instanceof Object && align.get) { this._alignGetter = align.get.bind(align); } | |
else { | |
this._alignGetter = null; | |
this._output.align = align; | |
} | |
return this; | |
}; | |
/** | |
* Set function, object, or numerical array to provide size, as [width, height]. | |
* | |
* @method sizeFrom | |
* | |
* @param {Object} size provider object | |
* @return {Modifier} this | |
*/ | |
Modifier.prototype.sizeFrom = function sizeFrom(size) { | |
if (size instanceof Function) { this._sizeGetter = size; } | |
else if (size instanceof Object && size.get) { this._sizeGetter = size.get.bind(size); } | |
else { | |
this._sizeGetter = null; | |
this._output.size = size; | |
} | |
return this; | |
}; | |
/** | |
* Set function, object, or numerical array to provide proportions, as [percent of width, percent of height]. | |
* | |
* @method proportionsFrom | |
* | |
* @param {Object} proportions provider object | |
* @return {Modifier} this | |
*/ | |
Modifier.prototype.proportionsFrom = function proportionsFrom(proportions) { | |
if (proportions instanceof Function) { this._proportionGetter = proportions; } | |
else if (proportions instanceof Object && proportions.get) { this._proportionGetter = proportions.get.bind(proportions); } | |
else { | |
this._proportionGetter = null; | |
this._output.proportions = proportions; | |
} | |
return this; | |
}; | |
/** | |
* Deprecated: Prefer transformFrom with static Transform, or use a TransitionableTransform. | |
* @deprecated | |
* @method setTransform | |
* | |
* @param {Transform} transform Transform to transition to | |
* @param {Transitionable} transition Valid transitionable object | |
* @param {Function} callback callback to call after transition completes | |
* @return {Modifier} this | |
*/ | |
Modifier.prototype.setTransform = function setTransform(transform, transition, callback) { | |
if (transition || this._legacyStates.transform) { | |
if (!this._legacyStates.transform) { | |
this._legacyStates.transform = new TransitionableTransform_1(this._output.transform); | |
} | |
if (!this._transformGetter) { this.transformFrom(this._legacyStates.transform); } | |
this._legacyStates.transform.set(transform, transition, callback); | |
return this; | |
} | |
else { return this.transformFrom(transform); } | |
}; | |
/** | |
* Deprecated: Prefer opacityFrom with static opacity array, or use a Transitionable with that opacity. | |
* @deprecated | |
* @method setOpacity | |
* | |
* @param {Number} opacity Opacity value to transition to. | |
* @param {Transitionable} transition Valid transitionable object | |
* @param {Function} callback callback to call after transition completes | |
* @return {Modifier} this | |
*/ | |
Modifier.prototype.setOpacity = function setOpacity(opacity, transition, callback) { | |
if (transition || this._legacyStates.opacity) { | |
if (!this._legacyStates.opacity) { | |
this._legacyStates.opacity = new Transitionable_1(this._output.opacity); | |
} | |
if (!this._opacityGetter) { this.opacityFrom(this._legacyStates.opacity); } | |
return this._legacyStates.opacity.set(opacity, transition, callback); | |
} | |
else { return this.opacityFrom(opacity); } | |
}; | |
/** | |
* Deprecated: Prefer originFrom with static origin array, or use a Transitionable with that origin. | |
* @deprecated | |
* @method setOrigin | |
* | |
* @param {Array.Number} origin two element array with values between 0 and 1. | |
* @param {Transitionable} transition Valid transitionable object | |
* @param {Function} callback callback to call after transition completes | |
* @return {Modifier} this | |
*/ | |
Modifier.prototype.setOrigin = function setOrigin(origin, transition, callback) { | |
/* TODO: remove this if statement when deprecation complete */ | |
if (transition || this._legacyStates.origin) { | |
if (!this._legacyStates.origin) { | |
this._legacyStates.origin = new Transitionable_1(this._output.origin || [0, 0]); | |
} | |
if (!this._originGetter) { this.originFrom(this._legacyStates.origin); } | |
this._legacyStates.origin.set(origin, transition, callback); | |
return this; | |
} | |
else { return this.originFrom(origin); } | |
}; | |
/** | |
* Deprecated: Prefer alignFrom with static align array, or use a Transitionable with that align. | |
* @deprecated | |
* @method setAlign | |
* | |
* @param {Array.Number} align two element array with values between 0 and 1. | |
* @param {Transitionable} transition Valid transitionable object | |
* @param {Function} callback callback to call after transition completes | |
* @return {Modifier} this | |
*/ | |
Modifier.prototype.setAlign = function setAlign(align, transition, callback) { | |
/* TODO: remove this if statement when deprecation complete */ | |
if (transition || this._legacyStates.align) { | |
if (!this._legacyStates.align) { | |
this._legacyStates.align = new Transitionable_1(this._output.align || [0, 0]); | |
} | |
if (!this._alignGetter) { this.alignFrom(this._legacyStates.align); } | |
this._legacyStates.align.set(align, transition, callback); | |
return this; | |
} | |
else { return this.alignFrom(align); } | |
}; | |
/** | |
* Deprecated: Prefer sizeFrom with static origin array, or use a Transitionable with that size. | |
* @deprecated | |
* @method setSize | |
* @param {Array.Number} size two element array of [width, height] | |
* @param {Transitionable} transition Valid transitionable object | |
* @param {Function} callback callback to call after transition completes | |
* @return {Modifier} this | |
*/ | |
Modifier.prototype.setSize = function setSize(size, transition, callback) { | |
if (size && (transition || this._legacyStates.size)) { | |
if (!this._legacyStates.size) { | |
this._legacyStates.size = new Transitionable_1(this._output.size || [0, 0]); | |
} | |
if (!this._sizeGetter) { this.sizeFrom(this._legacyStates.size); } | |
this._legacyStates.size.set(size, transition, callback); | |
return this; | |
} | |
else { return this.sizeFrom(size); } | |
}; | |
/** | |
* Deprecated: Prefer proportionsFrom with static origin array, or use a Transitionable with those proportions. | |
* @deprecated | |
* @method setProportions | |
* @param {Array.Number} proportions two element array of [percent of width, percent of height] | |
* @param {Transitionable} transition Valid transitionable object | |
* @param {Function} callback callback to call after transition completes | |
* @return {Modifier} this | |
*/ | |
Modifier.prototype.setProportions = function setProportions(proportions, transition, callback) { | |
if (proportions && (transition || this._legacyStates.proportions)) { | |
if (!this._legacyStates.proportions) { | |
this._legacyStates.proportions = new Transitionable_1(this._output.proportions || [0, 0]); | |
} | |
if (!this._proportionGetter) { this.proportionsFrom(this._legacyStates.proportions); } | |
this._legacyStates.proportions.set(proportions, transition, callback); | |
return this; | |
} | |
else { return this.proportionsFrom(proportions); } | |
}; | |
/** | |
* Deprecated: Prefer to stop transform in your provider object. | |
* @deprecated | |
* @method halt | |
*/ | |
Modifier.prototype.halt = function halt() { | |
if (this._legacyStates.transform) { this._legacyStates.transform.halt(); } | |
if (this._legacyStates.opacity) { this._legacyStates.opacity.halt(); } | |
if (this._legacyStates.origin) { this._legacyStates.origin.halt(); } | |
if (this._legacyStates.align) { this._legacyStates.align.halt(); } | |
if (this._legacyStates.size) { this._legacyStates.size.halt(); } | |
if (this._legacyStates.proportions) { this._legacyStates.proportions.halt(); } | |
this._transformGetter = null; | |
this._opacityGetter = null; | |
this._originGetter = null; | |
this._alignGetter = null; | |
this._sizeGetter = null; | |
this._proportionGetter = null; | |
}; | |
/** | |
* Deprecated: Prefer to use your provided transform or output of your transform provider. | |
* @deprecated | |
* @method getTransform | |
* @return {Object} transform provider object | |
*/ | |
Modifier.prototype.getTransform = function getTransform() { | |
return this._transformGetter(); | |
}; | |
/** | |
* Deprecated: Prefer to determine the end state of your transform from your transform provider | |
* @deprecated | |
* @method getFinalTransform | |
* @return {Transform} transform matrix | |
*/ | |
Modifier.prototype.getFinalTransform = function getFinalTransform() { | |
return this._legacyStates.transform ? this._legacyStates.transform.getFinal() : this._output.transform; | |
}; | |
/** | |
* Deprecated: Prefer to use your provided opacity or output of your opacity provider. | |
* @deprecated | |
* @method getOpacity | |
* @return {Object} opacity provider object | |
*/ | |
Modifier.prototype.getOpacity = function getOpacity() { | |
return this._opacityGetter(); | |
}; | |
/** | |
* Deprecated: Prefer to use your provided origin or output of your origin provider. | |
* @deprecated | |
* @method getOrigin | |
* @return {Object} origin provider object | |
*/ | |
Modifier.prototype.getOrigin = function getOrigin() { | |
return this._originGetter(); | |
}; | |
/** | |
* Deprecated: Prefer to use your provided align or output of your align provider. | |
* @deprecated | |
* @method getAlign | |
* @return {Object} align provider object | |
*/ | |
Modifier.prototype.getAlign = function getAlign() { | |
return this._alignGetter(); | |
}; | |
/** | |
* Deprecated: Prefer to use your provided size or output of your size provider. | |
* @deprecated | |
* @method getSize | |
* @return {Object} size provider object | |
*/ | |
Modifier.prototype.getSize = function getSize() { | |
return this._sizeGetter ? this._sizeGetter() : this._output.size; | |
}; | |
/** | |
* Deprecated: Prefer to use your provided proportions or output of your proportions provider. | |
* @deprecated | |
* @method getProportions | |
* @return {Object} proportions provider object | |
*/ | |
Modifier.prototype.getProportions = function getProportions() { | |
return this._proportionGetter ? this._proportionGetter() : this._output.proportions; | |
}; | |
// call providers on tick to receive render spec elements to apply | |
function _update() { | |
if (this._transformGetter) { this._output.transform = this._transformGetter(); } | |
if (this._opacityGetter) { this._output.opacity = this._opacityGetter(); } | |
if (this._originGetter) { this._output.origin = this._originGetter(); } | |
if (this._alignGetter) { this._output.align = this._alignGetter(); } | |
if (this._sizeGetter) { this._output.size = this._sizeGetter(); } | |
if (this._proportionGetter) { this._output.proportions = this._proportionGetter(); } | |
} | |
/** | |
* Return render spec for this Modifier, applying to the provided | |
* target component. This is similar to render() for Surfaces. | |
* | |
* @private | |
* @method modify | |
* | |
* @param {Object} target (already rendered) render spec to | |
* which to apply the transform. | |
* @return {Object} render spec for this Modifier, including the | |
* provided target | |
*/ | |
Modifier.prototype.modify = function modify(target) { | |
_update.call(this); | |
this._output.target = target; | |
return this._output; | |
}; | |
var Modifier_1 = Modifier; | |
/* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
* | |
* Owner: [email protected] | |
* @license MPL 2.0 | |
* @copyright Famous Industries, Inc. 2015 | |
*/ | |
/** | |
* A singleton that maintains a global registry of Surfaces. | |
* Private. | |
* | |
* @private | |
* @static | |
* @class Entity | |
*/ | |
var entities = []; | |
/** | |
* Get entity from global index. | |
* | |
* @private | |
* @method get | |
* @param {Number} id entity registration id | |
* @return {Surface} entity in the global index | |
*/ | |
function get(id) { | |
return entities[id]; | |
} | |
/** | |
* Overwrite entity in the global index | |
* | |
* @private | |
* @method set | |
* @param {Number} id entity registration id | |
* @param {Surface} entity to add to the global index | |
*/ | |
function set(id, entity) { | |
entities[id] = entity; | |
} | |
/** | |
* Add entity to global index | |
* | |
* @private | |
* @method register | |
* @param {Surface} entity to add to global index | |
* @return {Number} new id | |
*/ | |
function register(entity) { | |
var id = entities.length; | |
set(id, entity); | |
return id; | |
} | |
/** | |
* Remove entity from global index | |
* | |
* @private | |
* @method unregister | |
* @param {Number} id entity registration id | |
*/ | |
function unregister(id) { | |
set(id, null); | |
} | |
var Entity = { | |
register: register, | |
unregister: unregister, | |
get: get, | |
set: set | |
}; | |
/* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
* | |
* Owner: [email protected] | |
* @license MPL 2.0 | |
* @copyright Famous Industries, Inc. 2015 | |
*/ | |
/** | |
* | |
* This object translates the rendering instructions ("render specs") | |
* that renderable components generate into document update | |
* instructions ("update specs"). Private. | |
* | |
* @private | |
* @class SpecParser | |
* @constructor | |
*/ | |
function SpecParser() { | |
this.result = {}; | |
} | |
SpecParser._instance = new SpecParser(); | |
/** | |
* Convert a render spec coming from the context's render chain to an | |
* update spec for the update chain. This is the only major entry point | |
* for a consumer of this class. | |
* | |
* @method parse | |
* @static | |
* @private | |
* | |
* @param {renderSpec} spec input render spec | |
* @param {Object} context context to do the parse in | |
* @return {Object} the resulting update spec (if no callback | |
* specified, else none) | |
*/ | |
SpecParser.parse = function parse(spec, context) { | |
return SpecParser._instance.parse(spec, context); | |
}; | |
/** | |
* Convert a renderSpec coming from the context's render chain to an update | |
* spec for the update chain. This is the only major entrypoint for a | |
* consumer of this class. | |
* | |
* @method parse | |
* | |
* @private | |
* @param {renderSpec} spec input render spec | |
* @param {Context} context | |
* @return {updateSpec} the resulting update spec | |
*/ | |
SpecParser.prototype.parse = function parse(spec, context) { | |
this.reset(); | |
this._parseSpec(spec, context, Transform_1.identity); | |
return this.result; | |
}; | |
/** | |
* Prepare SpecParser for re-use (or first use) by setting internal state | |
* to blank. | |
* | |
* @private | |
* @method reset | |
*/ | |
SpecParser.prototype.reset = function reset() { | |
this.result = {}; | |
}; | |
// Multiply matrix M by vector v | |
function _vecInContext(v, m) { | |
return [ | |
v[0] * m[0] + v[1] * m[4] + v[2] * m[8], | |
v[0] * m[1] + v[1] * m[5] + v[2] * m[9], | |
v[0] * m[2] + v[1] * m[6] + v[2] * m[10] | |
]; | |
} | |
var _zeroZero = [0, 0]; | |
// From the provided renderSpec tree, recursively compose opacities, | |
// origins, transforms, and sizes corresponding to each surface id from | |
// the provided renderSpec tree structure. On completion, those | |
// properties of 'this' object should be ready to use to build an | |
// updateSpec. | |
SpecParser.prototype._parseSpec = function _parseSpec(spec, parentContext, sizeContext) { | |
var this$1 = this; | |
var id; | |
var target; | |
var transform; | |
var opacity; | |
var origin; | |
var align; | |
var size; | |
if (typeof spec === 'number') { | |
id = spec; | |
transform = parentContext.transform; | |
align = parentContext.align || _zeroZero; | |
if (parentContext.size && align && (align[0] || align[1])) { | |
var alignAdjust = [align[0] * parentContext.size[0], align[1] * parentContext.size[1], 0]; | |
transform = Transform_1.thenMove(transform, _vecInContext(alignAdjust, sizeContext)); | |
} | |
this.result[id] = { | |
transform: transform, | |
opacity: parentContext.opacity, | |
origin: parentContext.origin || _zeroZero, | |
align: parentContext.align || _zeroZero, | |
size: parentContext.size | |
}; | |
} | |
else if (!spec) { // placed here so 0 will be cached earlier | |
return; | |
} | |
else if (spec instanceof Array) { | |
for (var i = 0; i < spec.length; i++) { | |
this$1._parseSpec(spec[i], parentContext, sizeContext); | |
} | |
} | |
else { | |
target = spec.target; | |
transform = parentContext.transform; | |
opacity = parentContext.opacity; | |
origin = parentContext.origin; | |
align = parentContext.align; | |
size = parentContext.size; | |
var nextSizeContext = sizeContext; | |
if (spec.opacity !== undefined) { opacity = parentContext.opacity * spec.opacity; } | |
if (spec.transform) { transform = Transform_1.multiply(parentContext.transform, spec.transform); } | |
if (spec.origin) { | |
origin = spec.origin; | |
nextSizeContext = parentContext.transform; | |
} | |
if (spec.align) { align = spec.align; } | |
if (spec.size || spec.proportions) { | |
var parentSize = size; | |
size = [size[0], size[1]]; | |
if (spec.size) { | |
if (spec.size[0] !== undefined) { size[0] = spec.size[0]; } | |
if (spec.size[1] !== undefined) { size[1] = spec.size[1]; } | |
} | |
if (spec.proportions) { | |
if (spec.proportions[0] !== undefined) { size[0] = size[0] * spec.proportions[0]; } | |
if (spec.proportions[1] !== undefined) { size[1] = size[1] * spec.proportions[1]; } | |
} | |
if (parentSize) { | |
if (align && (align[0] || align[1])) { transform = Transform_1.thenMove(transform, _vecInContext([align[0] * parentSize[0], align[1] * parentSize[1], 0], sizeContext)); } | |
if (origin && (origin[0] || origin[1])) { transform = Transform_1.moveThen([-origin[0] * size[0], -origin[1] * size[1], 0], transform); } | |
} | |
nextSizeContext = parentContext.transform; | |
origin = null; | |
align = null; | |
} | |
this._parseSpec(target, { | |
transform: transform, | |
opacity: opacity, | |
origin: origin, | |
align: align, | |
size: size | |
}, nextSizeContext); | |
} | |
}; | |
var SpecParser_1 = SpecParser; | |
/* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
* | |
* Owner: [email protected] | |
* @license MPL 2.0 | |
* @copyright Famous Industries, Inc. 2015 | |
*/ | |
/** | |
* A wrapper for inserting a renderable component (like a Modifer or | |
* Surface) into the render tree. | |
* | |
* @class RenderNode | |
* @constructor | |
* | |
* @param {Object} object Target renderable component | |
*/ | |
function RenderNode(object) { | |
this._object = null; | |
this._child = null; | |
this._hasMultipleChildren = false; | |
this._isRenderable = false; | |
this._isModifier = false; | |
this._resultCache = {}; | |
this._prevResults = {}; | |
this._childResult = null; | |
if (object) { this.set(object); } | |
} | |
/** | |
* Append a renderable to the list of this node's children. | |
* This produces a new RenderNode in the tree. | |
* Note: Does not double-wrap if child is a RenderNode already. | |
* | |
* @method add | |
* @param {Object} child renderable object | |
* @return {RenderNode} new render node wrapping child | |
*/ | |
RenderNode.prototype.add = function add(child) { | |
var childNode = (child instanceof RenderNode) ? child : new RenderNode(child); | |
if (this._child instanceof Array) { this._child.push(childNode); } | |
else if (this._child) { | |
this._child = [this._child, childNode]; | |
this._hasMultipleChildren = true; | |
this._childResult = []; // to be used later | |
} | |
else { this._child = childNode; } | |
return childNode; | |
}; | |
/** | |
* Return the single wrapped object. Returns null if this node has multiple child nodes. | |
* | |
* @method get | |
* | |
* @return {Ojbect} contained renderable object | |
*/ | |
RenderNode.prototype.get = function get() { | |
return this._object || (this._hasMultipleChildren ? null : (this._child ? this._child.get() : null)); | |
}; | |
/** | |
* Overwrite the list of children to contain the single provided object | |
* | |
* @method set | |
* @param {Object} child renderable object | |
* @return {RenderNode} this render node, or child if it is a RenderNode | |
*/ | |
RenderNode.prototype.set = function set(child) { | |
this._childResult = null; | |
this._hasMultipleChildren = false; | |
this._isRenderable = child.render ? true : false; | |
this._isModifier = child.modify ? true : false; | |
this._object = child; | |
this._child = null; | |
if (child instanceof RenderNode) { return child; } | |
else { return this; } | |
}; | |
/** | |
* Get render size of contained object. | |
* | |
* @method getSize | |
* @return {Array.Number} size of this or size of single child. | |
*/ | |
RenderNode.prototype.getSize = function getSize() { | |
var result = null; | |
var target = this.get(); | |
if (target && target.getSize) { result = target.getSize(); } | |
if (!result && this._child && this._child.getSize) { result = this._child.getSize(); } | |
return result; | |
}; | |
// apply results of rendering this subtree to the document | |
function _applyCommit(spec, context, cacheStorage) { | |
var result = SpecParser_1.parse(spec, context); | |
var keys = Object.keys(result); | |
for (var i = 0; i < keys.length; i++) { | |
var id = keys[i]; | |
var childNode = Entity.get(id); | |
var commitParams = result[id]; | |
commitParams.allocator = context.allocator; | |
var commitResult = childNode.commit(commitParams); | |
if (commitResult) { _applyCommit(commitResult, context, cacheStorage); } | |
else { cacheStorage[id] = commitParams; } | |
} | |
} | |
/** | |
* Commit the content change from this node to the document. | |
* | |
* @private | |
* @method commit | |
* @param {Context} context render context | |
*/ | |
RenderNode.prototype.commit = function commit(context) { | |
var this$1 = this; | |
// free up some divs from the last loop | |
var prevKeys = Object.keys(this._prevResults); | |
for (var i = 0; i < prevKeys.length; i++) { | |
var id = prevKeys[i]; | |
if (this$1._resultCache[id] === undefined) { | |
var object = Entity.get(id); | |
if (object.cleanup) { object.cleanup(context.allocator); } | |
} | |
} | |
this._prevResults = this._resultCache; | |
this._resultCache = {}; | |
_applyCommit(this.render(), context, this._resultCache); | |
}; | |
/** | |
* Generate a render spec from the contents of the wrapped component. | |
* | |
* @private | |
* @method render | |
* | |
* @return {Object} render specification for the component subtree | |
* only under this node. | |
*/ | |
RenderNode.prototype.render = function render() { | |
if (this._isRenderable) { return this._object.render(); } | |
var result = null; | |
if (this._hasMultipleChildren) { | |
result = this._childResult; | |
var children = this._child; | |
for (var i = 0; i < children.length; i++) { | |
result[i] = children[i].render(); | |
} | |
} | |
else if (this._child) { result = this._child.render(); } | |
return this._isModifier ? this._object.modify(result) : result; | |
}; | |
var RenderNode_1 = RenderNode; | |
/* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
* | |
* Owner: [email protected] | |
* @license MPL 2.0 | |
* @copyright Famous Industries, Inc. 2015 | |
*/ | |
/** | |
* EventEmitter represents a channel for events. | |
* | |
* @class EventEmitter | |
* @constructor | |
*/ | |
function EventEmitter() { | |
this.listeners = {}; | |
this._owner = this; | |
} | |
/** | |
* Trigger an event, sending to all downstream handlers | |
* listening for provided 'type' key. | |
* | |
* @method emit | |
* | |
* @param {string} type event type key (for example, 'click') | |
* @param {Object} event event data | |
* @return {EventHandler} this | |
*/ | |
EventEmitter.prototype.emit = function emit(type, event) { | |
var this$1 = this; | |
var handlers = this.listeners[type]; | |
if (handlers) { | |
for (var i = 0; i < handlers.length; i++) { | |
handlers[i].call(this$1._owner, event); | |
} | |
} | |
return this; | |
}; | |
/** | |
* Bind a callback function to an event type handled by this object. | |
* | |
* @method "on" | |
* | |
* @param {string} type event type key (for example, 'click') | |
* @param {function(string, Object)} handler callback | |
* @return {EventHandler} this | |
*/ | |
EventEmitter.prototype.on = function on(type, handler) { | |
if (!(type in this.listeners)) { this.listeners[type] = []; } | |
var index = this.listeners[type].indexOf(handler); | |
if (index < 0) { this.listeners[type].push(handler); } | |
return this; | |
}; | |
/** | |
* Alias for "on". | |
* @method addListener | |
*/ | |
EventEmitter.prototype.addListener = EventEmitter.prototype.on; | |
/** | |
* Unbind an event by type and handler. | |
* This undoes the work of "on". | |
* | |
* @method removeListener | |
* | |
* @param {string} type event type key (for example, 'click') | |
* @param {function} handler function object to remove | |
* @return {EventEmitter} this | |
*/ | |
EventEmitter.prototype.removeListener = function removeListener(type, handler) { | |
var listener = this.listeners[type]; | |
if (listener !== undefined) { | |
var index = listener.indexOf(handler); | |
if (index >= 0) { listener.splice(index, 1); } | |
} | |
return this; | |
}; | |
/** | |
* Call event handlers with this set to owner. | |
* | |
* @method bindThis | |
* | |
* @param {Object} owner object this EventEmitter belongs to | |
*/ | |
EventEmitter.prototype.bindThis = function bindThis(owner) { | |
this._owner = owner; | |
}; | |
var EventEmitter_1 = EventEmitter; | |
/* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
* | |
* Owner: [email protected] | |
* @license MPL 2.0 | |
* @copyright Famous Industries, Inc. 2015 | |
*/ | |
/** | |
* EventHandler forwards received events to a set of provided callback functions. | |
* It allows events to be captured, processed, and optionally piped through to other event handlers. | |
* | |
* @class EventHandler | |
* @extends EventEmitter | |
* @constructor | |
*/ | |
function EventHandler() { | |
EventEmitter_1.apply(this, arguments); | |
this.downstream = []; // downstream event handlers | |
this.downstreamFn = []; // downstream functions | |
this.upstream = []; // upstream event handlers | |
this.upstreamListeners = {}; // upstream listeners | |
} | |
EventHandler.prototype = Object.create(EventEmitter_1.prototype); | |
EventHandler.prototype.constructor = EventHandler; | |
/** | |
* Assign an event handler to receive an object's input events. | |
* | |
* @method setInputHandler | |
* @static | |
* | |
* @param {Object} object object to mix trigger, subscribe, and unsubscribe functions into | |
* @param {EventHandler} handler assigned event handler | |
*/ | |
EventHandler.setInputHandler = function setInputHandler(object, handler) { | |
object.trigger = handler.trigger.bind(handler); | |
if (handler.subscribe && handler.unsubscribe) { | |
object.subscribe = handler.subscribe.bind(handler); | |
object.unsubscribe = handler.unsubscribe.bind(handler); | |
} | |
}; | |
/** | |
* Assign an event handler to receive an object's output events. | |
* | |
* @method setOutputHandler | |
* @static | |
* | |
* @param {Object} object object to mix pipe, unpipe, on, addListener, and removeListener functions into | |
* @param {EventHandler} handler assigned event handler | |
*/ | |
EventHandler.setOutputHandler = function setOutputHandler(object, handler) { | |
if (handler instanceof EventHandler) { handler.bindThis(object); } | |
object.pipe = handler.pipe.bind(handler); | |
object.unpipe = handler.unpipe.bind(handler); | |
object.on = handler.on.bind(handler); | |
object.addListener = object.on; | |
object.removeListener = handler.removeListener.bind(handler); | |
}; | |
/** | |
* Trigger an event, sending to all downstream handlers | |
* listening for provided 'type' key. | |
* | |
* @method emit | |
* | |
* @param {string} type event type key (for example, 'click') | |
* @param {Object} event event data | |
* @return {EventHandler} this | |
*/ | |
EventHandler.prototype.emit = function emit(type, event) { | |
var this$1 = this; | |
EventEmitter_1.prototype.emit.apply(this, arguments); | |
var i = 0; | |
for (i = 0; i < this.downstream.length; i++) { | |
if (this$1.downstream[i].trigger) { this$1.downstream[i].trigger(type, event); } | |
} | |
for (i = 0; i < this.downstreamFn.length; i++) { | |
this$1.downstreamFn[i](type, event); | |
} | |
return this; | |
}; | |
/** | |
* Alias for emit | |
* @method addListener | |
*/ | |
EventHandler.prototype.trigger = EventHandler.prototype.emit; | |
/** | |
* Add event handler object to set of downstream handlers. | |
* | |
* @method pipe | |
* | |
* @param {EventHandler} target event handler target object | |
* @return {EventHandler} passed event handler | |
*/ | |
EventHandler.prototype.pipe = function pipe(target) { | |
if (target.subscribe instanceof Function) { return target.subscribe(this); } | |
var downstreamCtx = (target instanceof Function) ? this.downstreamFn : this.downstream; | |
var index = downstreamCtx.indexOf(target); | |
if (index < 0) { downstreamCtx.push(target); } | |
if (target instanceof Function) { target('pipe', null); } | |
else if (target.trigger) { target.trigger('pipe', null); } | |
return target; | |
}; | |
/** | |
* Remove handler object from set of downstream handlers. | |
* Undoes work of "pipe". | |
* | |
* @method unpipe | |
* | |
* @param {EventHandler} target target handler object | |
* @return {EventHandler} provided target | |
*/ | |
EventHandler.prototype.unpipe = function unpipe(target) { | |
if (target.unsubscribe instanceof Function) { return target.unsubscribe(this); } | |
var downstreamCtx = (target instanceof Function) ? this.downstreamFn : this.downstream; | |
var index = downstreamCtx.indexOf(target); | |
if (index >= 0) { | |
downstreamCtx.splice(index, 1); | |
if (target instanceof Function) { target('unpipe', null); } | |
else if (target.trigger) { target.trigger('unpipe', null); } | |
return target; | |
} | |
else { return false; } | |
}; | |
/** | |
* Bind a callback function to an event type handled by this object. | |
* | |
* @method "on" | |
* | |
* @param {string} type event type key (for example, 'click') | |
* @param {function(string, Object)} handler callback | |
* @return {EventHandler} this | |
*/ | |
EventHandler.prototype.on = function on(type, handler) { | |
var this$1 = this; | |
EventEmitter_1.prototype.on.apply(this, arguments); | |
if (!(type in this.upstreamListeners)) { | |
var upstreamListener = this.trigger.bind(this, type); | |
this.upstreamListeners[type] = upstreamListener; | |
for (var i = 0; i < this.upstream.length; i++) { | |
this$1.upstream[i].on(type, upstreamListener); | |
} | |
} | |
return this; | |
}; | |
/** | |
* Alias for "on" | |
* @method addListener | |
*/ | |
EventHandler.prototype.addListener = EventHandler.prototype.on; | |
/** | |
* Listen for events from an upstream event handler. | |
* | |
* @method subscribe | |
* | |
* @param {EventEmitter} source source emitter object | |
* @return {EventHandler} this | |
*/ | |
EventHandler.prototype.subscribe = function subscribe(source) { | |
var this$1 = this; | |
var index = this.upstream.indexOf(source); | |
if (index < 0) { | |
this.upstream.push(source); | |
for (var type in this$1.upstreamListeners) { | |
source.on(type, this$1.upstreamListeners[type]); | |
} | |
} | |
return this; | |
}; | |
/** | |
* Stop listening to events from an upstream event handler. | |
* | |
* @method unsubscribe | |
* | |
* @param {EventEmitter} source source emitter object | |
* @return {EventHandler} this | |
*/ | |
EventHandler.prototype.unsubscribe = function unsubscribe(source) { | |
var this$1 = this; | |
var index = this.upstream.indexOf(source); | |
if (index >= 0) { | |
this.upstream.splice(index, 1); | |
for (var type in this$1.upstreamListeners) { | |
source.removeListener(type, this$1.upstreamListeners[type]); | |
} | |
} | |
return this; | |
}; | |
var EventHandler_1 = EventHandler; | |
/* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
* | |
* Owner: [email protected] | |
* @license MPL 2.0 | |
* @copyright Famous Industries, Inc. 2015 | |
*/ | |
/** | |
* Internal helper object to Context that handles the process of | |
* creating and allocating DOM elements within a managed div. | |
* Private. | |
* | |
* @class ElementAllocator | |
* @constructor | |
* @private | |
* @param {Node} container document element in which Famo.us content will be inserted | |
*/ | |
function ElementAllocator(container) { | |
if (!container) { container = document.createDocumentFragment(); } | |
this.container = container; | |
this.detachedNodes = {}; | |
this.nodeCount = 0; | |
} | |
/** | |
* Move the document elements from their original container to a new one. | |
* | |
* @private | |
* @method migrate | |
* | |
* @param {Node} container document element to which Famo.us content will be migrated | |
*/ | |
ElementAllocator.prototype.migrate = function migrate(container) { | |
var oldContainer = this.container; | |
if (container === oldContainer) { return; } | |
if (oldContainer instanceof DocumentFragment) { | |
container.appendChild(oldContainer); | |
} | |
else { | |
while (oldContainer.hasChildNodes()) { | |
container.appendChild(oldContainer.firstChild); | |
} | |
} | |
this.container = container; | |
}; | |
/** | |
* Allocate an element of specified type from the pool. | |
* | |
* @private | |
* @method allocate | |
* | |
* @param {string} type type of element, e.g. 'div' | |
* @return {Node} allocated document element | |
*/ | |
ElementAllocator.prototype.allocate = function allocate(type) { | |
type = type.toLowerCase(); | |
if (!(type in this.detachedNodes)) { this.detachedNodes[type] = []; } | |
var nodeStore = this.detachedNodes[type]; | |
var result; | |
if (nodeStore.length > 0) { | |
result = nodeStore.pop(); | |
} | |
else { | |
result = document.createElement(type); | |
this.container.appendChild(result); | |
} | |
this.nodeCount++; | |
return result; | |
}; | |
/** | |
* De-allocate an element of specified type to the pool. | |
* | |
* @private | |
* @method deallocate | |
* | |
* @param {Node} element document element to deallocate | |
*/ | |
ElementAllocator.prototype.deallocate = function deallocate(element) { | |
var nodeType = element.nodeName.toLowerCase(); | |
var nodeStore = this.detachedNodes[nodeType]; | |
nodeStore.push(element); | |
this.nodeCount--; | |
}; | |
/** | |
* Get count of total allocated nodes in the document. | |
* | |
* @private | |
* @method getNodeCount | |
* | |
* @return {Number} total node count | |
*/ | |
ElementAllocator.prototype.getNodeCount = function getNodeCount() { | |
return this.nodeCount; | |
}; | |
var ElementAllocator_1 = ElementAllocator; | |
/* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
* | |
* Owner: [email protected] | |
* @license MPL 2.0 | |
* @copyright Famous Industries, Inc. 2015 | |
*/ | |
var _zeroZero$1 = [0, 0]; | |
var usePrefix = !('perspective' in document.documentElement.style); | |
function _getElementSize() { | |
var element = this.container; | |
return [element.clientWidth, element.clientHeight]; | |
} | |
var _setPerspective = usePrefix ? function(element, perspective) { | |
element.style.webkitPerspective = perspective ? perspective.toFixed() + 'px' : ''; | |
} : function(element, perspective) { | |
element.style.perspective = perspective ? perspective.toFixed() + 'px' : ''; | |
}; | |
/** | |
* The top-level container for a Famous-renderable piece of the document. | |
* It is directly updated by the process-wide Engine object, and manages one | |
* render tree root, which can contain other renderables. | |
* | |
* @class Context | |
* @constructor | |
* @private | |
* @param {Node} container Element in which content will be inserted | |
*/ | |
function Context(container) { | |
this.container = container; | |
this._allocator = new ElementAllocator_1(container); | |
this._node = new RenderNode_1(); | |
this._eventOutput = new EventHandler_1(); | |
this._size = _getElementSize.call(this); | |
this._perspectiveState = new Transitionable_1(0); | |
this._perspective = undefined; | |
this._nodeContext = { | |
allocator: this._allocator, | |
transform: Transform_1.identity, | |
opacity: 1, | |
origin: _zeroZero$1, | |
align: _zeroZero$1, | |
size: this._size | |
}; | |
this._eventOutput.on('resize', function() { | |
this.setSize(_getElementSize.call(this)); | |
}.bind(this)); | |
} | |
// Note: Unused | |
Context.prototype.getAllocator = function getAllocator() { | |
return this._allocator; | |
}; | |
/** | |
* Add renderables to this Context's render tree. | |
* | |
* @method add | |
* | |
* @param {Object} obj renderable object | |
* @return {RenderNode} RenderNode wrapping this object, if not already a RenderNode | |
*/ | |
Context.prototype.add = function add(obj) { | |
return this._node.add(obj); | |
}; | |
/** | |
* Move this Context to another containing document element. | |
* | |
* @method migrate | |
* | |
* @param {Node} container Element to which content will be migrated | |
*/ | |
Context.prototype.migrate = function migrate(container) { | |
if (container === this.container) { return; } | |
this.container = container; | |
this._allocator.migrate(container); | |
}; | |
/** | |
* Gets viewport size for Context. | |
* | |
* @method getSize | |
* | |
* @return {Array.Number} viewport size as [width, height] | |
*/ | |
Context.prototype.getSize = function getSize() { | |
return this._size; | |
}; | |
/** | |
* Sets viewport size for Context. | |
* | |
* @method setSize | |
* | |
* @param {Array.Number} size [width, height]. If unspecified, use size of root document element. | |
*/ | |
Context.prototype.setSize = function setSize(size) { | |
if (!size) { size = _getElementSize.call(this); } | |
this._size[0] = size[0]; | |
this._size[1] = size[1]; | |
}; | |
/** | |
* Commit this Context's content changes to the document. | |
* | |
* @private | |
* @method update | |
* @param {Object} contextParameters engine commit specification | |
*/ | |
Context.prototype.update = function update(contextParameters) { | |
if (contextParameters) { | |
if (contextParameters.transform) { this._nodeContext.transform = contextParameters.transform; } | |
if (contextParameters.opacity) { this._nodeContext.opacity = contextParameters.opacity; } | |
if (contextParameters.origin) { this._nodeContext.origin = contextParameters.origin; } | |
if (contextParameters.align) { this._nodeContext.align = contextParameters.align; } | |
if (contextParameters.size) { this._nodeContext.size = contextParameters.size; } | |
} | |
var perspective = this._perspectiveState.get(); | |
if (perspective !== this._perspective) { | |
_setPerspective(this.container, perspective); | |
this._perspective = perspective; | |
} | |
this._node.commit(this._nodeContext); | |
}; | |
/** | |
* Get current perspective of this context in pixels. | |
* | |
* @method getPerspective | |
* @return {Number} depth perspective in pixels | |
*/ | |
Context.prototype.getPerspective = function getPerspective() { | |
return this._perspectiveState.get(); | |
}; | |
/** | |
* Set current perspective of this context in pixels. | |
* | |
* @method setPerspective | |
* @param {Number} perspective in pixels | |
* @param {Object} [transition] Transitionable object for applying the change | |
* @param {function(Object)} callback function called on completion of transition | |
*/ | |
Context.prototype.setPerspective = function setPerspective(perspective, transition, callback) { | |
return this._perspectiveState.set(perspective, transition, callback); | |
}; | |
/** | |
* Trigger an event, sending to all downstream handlers | |
* listening for provided 'type' key. | |
* | |
* @method emit | |
* | |
* @param {string} type event type key (for example, 'click') | |
* @param {Object} event event data | |
* @return {EventHandler} this | |
*/ | |
Context.prototype.emit = function emit(type, event) { | |
return this._eventOutput.emit(type, event); | |
}; | |
/** | |
* Bind a callback function to an event type handled by this object. | |
* | |
* @method "on" | |
* | |
* @param {string} type event type key (for example, 'click') | |
* @param {function(string, Object)} handler callback | |
* @return {EventHandler} this | |
*/ | |
Context.prototype.on = function on(type, handler) { | |
return this._eventOutput.on(type, handler); | |
}; | |
/** | |
* Unbind an event by type and handler. | |
* This undoes the work of "on". | |
* | |
* @method removeListener | |
* | |
* @param {string} type event type key (for example, 'click') | |
* @param {function} handler function object to remove | |
* @return {EventHandler} internal event handler object (for chaining) | |
*/ | |
Context.prototype.removeListener = function removeListener(type, handler) { | |
return this._eventOutput.removeListener(type, handler); | |
}; | |
/** | |
* Add event handler object to set of downstream handlers. | |
* | |
* @method pipe | |
* | |
* @param {EventHandler} target event handler target object | |
* @return {EventHandler} passed event handler | |
*/ | |
Context.prototype.pipe = function pipe(target) { | |
return this._eventOutput.pipe(target); | |
}; | |
/** | |
* Remove handler object from set of downstream handlers. | |
* Undoes work of "pipe". | |
* | |
* @method unpipe | |
* | |
* @param {EventHandler} target target handler object | |
* @return {EventHandler} provided target | |
*/ | |
Context.prototype.unpipe = function unpipe(target) { | |
return this._eventOutput.unpipe(target); | |
}; | |
var Context_1 = Context; | |
/* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
* | |
* Owner: [email protected] | |
* @license MPL 2.0 | |
* @copyright Famous Industries, Inc. 2015 | |
*/ | |
/** | |
* A collection of methods for setting options which can be extended | |
* onto other classes. | |
* | |
* | |
* **** WARNING **** | |
* You can only pass through objects that will compile into valid JSON. | |
* | |
* Valid options: | |
* Strings, | |
* Arrays, | |
* Objects, | |
* Numbers, | |
* Nested Objects, | |
* Nested Arrays. | |
* | |
* This excludes: | |
* Document Fragments, | |
* Functions | |
* @class OptionsManager | |
* @constructor | |
* @param {Object} value options dictionary | |
*/ | |
function OptionsManager(value) { | |
this._value = value; | |
this.eventOutput = null; | |
} | |
/** | |
* Create options manager from source dictionary with arguments overriden by patch dictionary. | |
* | |
* @static | |
* @method OptionsManager.patch | |
* | |
* @param {Object} source source arguments | |
* @param {...Object} data argument additions and overwrites | |
* @return {Object} source object | |
*/ | |
OptionsManager.patch = function patchObject(source, data) { | |
var arguments$1 = arguments; | |
var manager = new OptionsManager(source); | |
for (var i = 1; i < arguments.length; i++) { manager.patch(arguments$1[i]); } | |
return source; | |
}; | |
function _createEventOutput() { | |
this.eventOutput = new EventHandler_1(); | |
this.eventOutput.bindThis(this); | |
EventHandler_1.setOutputHandler(this, this.eventOutput); | |
} | |
/** | |
* Create OptionsManager from source with arguments overriden by patches. | |
* Triggers 'change' event on this object's event handler if the state of | |
* the OptionsManager changes as a result. | |
* | |
* @method patch | |
* | |
* @param {...Object} arguments list of patch objects | |
* @return {OptionsManager} this | |
*/ | |
OptionsManager.prototype.patch = function patch() { | |
var arguments$1 = arguments; | |
var this$1 = this; | |
var myState = this._value; | |
for (var i = 0; i < arguments.length; i++) { | |
var data = arguments$1[i]; | |
for (var k in data) { | |
if ((k in myState) && (data[k] && data[k].constructor === Object) && (myState[k] && myState[k].constructor === Object)) { | |
if (!myState.hasOwnProperty(k)) { myState[k] = Object.create(myState[k]); } | |
this$1.key(k).patch(data[k]); | |
if (this$1.eventOutput) { this$1.eventOutput.emit('change', {id: k, value: this$1.key(k).value()}); } | |
} | |
else { this$1.set(k, data[k]); } | |
} | |
} | |
return this; | |
}; | |
/** | |
* Alias for patch | |
* | |
* @method setOptions | |
* | |
*/ | |
OptionsManager.prototype.setOptions = OptionsManager.prototype.patch; | |
/** | |
* Return OptionsManager based on sub-object retrieved by key | |
* | |
* @method key | |
* | |
* @param {string} identifier key | |
* @return {OptionsManager} new options manager with the value | |
*/ | |
OptionsManager.prototype.key = function key(identifier) { | |
var result = new OptionsManager(this._value[identifier]); | |
if (!(result._value instanceof Object) || result._value instanceof Array) { result._value = {}; } | |
return result; | |
}; | |
/** | |
* Look up value by key or get the full options hash | |
* @method get | |
* | |
* @param {string} key key | |
* @return {Object} associated object or full options hash | |
*/ | |
OptionsManager.prototype.get = function get(key) { | |
return key ? this._value[key] : this._value; | |
}; | |
/** | |
* Alias for get | |
* @method getOptions | |
*/ | |
OptionsManager.prototype.getOptions = OptionsManager.prototype.get; | |
/** | |
* Set key to value. Outputs 'change' event if a value is overwritten. | |
* | |
* @method set | |
* | |
* @param {string} key key string | |
* @param {Object} value value object | |
* @return {OptionsManager} new options manager based on the value object | |
*/ | |
OptionsManager.prototype.set = function set(key, value) { | |
var originalValue = this.get(key); | |
this._value[key] = value; | |
if (this.eventOutput && value !== originalValue) { this.eventOutput.emit('change', {id: key, value: value}); } | |
return this; | |
}; | |
/** | |
* Bind a callback function to an event type handled by this object. | |
* | |
* @method "on" | |
* | |
* @param {string} type event type key (for example, 'change') | |
* @param {function(string, Object)} handler callback | |
* @return {EventHandler} this | |
*/ | |
OptionsManager.prototype.on = function on() { | |
_createEventOutput.call(this); | |
return this.on.apply(this, arguments); | |
}; | |
/** | |
* Unbind an event by type and handler. | |
* This undoes the work of "on". | |
* | |
* @method removeListener | |
* | |
* @param {string} type event type key (for example, 'change') | |
* @param {function} handler function object to remove | |
* @return {EventHandler} internal event handler object (for chaining) | |
*/ | |
OptionsManager.prototype.removeListener = function removeListener() { | |
_createEventOutput.call(this); | |
return this.removeListener.apply(this, arguments); | |
}; | |
/** | |
* Add event handler object to set of downstream handlers. | |
* | |
* @method pipe | |
* | |
* @param {EventHandler} target event handler target object | |
* @return {EventHandler} passed event handler | |
*/ | |
OptionsManager.prototype.pipe = function pipe() { | |
_createEventOutput.call(this); | |
return this.pipe.apply(this, arguments); | |
}; | |
/** | |
* Remove handler object from set of downstream handlers. | |
* Undoes work of "pipe" | |
* | |
* @method unpipe | |
* | |
* @param {EventHandler} target target handler object | |
* @return {EventHandler} provided target | |
*/ | |
OptionsManager.prototype.unpipe = function unpipe() { | |
_createEventOutput.call(this); | |
return this.unpipe.apply(this, arguments); | |
}; | |
var OptionsManager_1 = OptionsManager; | |
/* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
* | |
* Owner: [email protected] | |
* @license MPL 2.0 | |
* @copyright Famous Industries, Inc. 2015 | |
*/ | |
/** | |
* The singleton object initiated upon process | |
* startup which manages all active Context instances, runs | |
* the render dispatch loop, and acts as a listener and dispatcher | |
* for events. All methods are therefore static. | |
* | |
* On static initialization, window.requestAnimationFrame is called with | |
* the event loop function. | |
* | |
* Note: Any window in which Engine runs will prevent default | |
* scrolling behavior on the 'touchmove' event. | |
* | |
* @static | |
* @class Engine | |
*/ | |
var Engine = {}; | |
var contexts = []; | |
var nextTickQueue = []; | |
var currentFrame = 0; | |
var nextTickFrame = 0; | |
var deferQueue = []; | |
var lastTime = Date.now(); | |
var frameTime; | |
var frameTimeLimit; | |
var loopEnabled = true; | |
var eventForwarders = {}; | |
var eventHandler = new EventHandler_1(); | |
var options = { | |
containerType: 'div', | |
containerClass: 'famous-container', | |
fpsCap: undefined, | |
runLoop: true, | |
appMode: true | |
}; | |
var optionsManager = new OptionsManager_1(options); | |
/** @const */ | |
var MAX_DEFER_FRAME_TIME = 10; | |
/** | |
* Inside requestAnimationFrame loop, step() is called, which: | |
* calculates current FPS (throttling loop if it is over limit set in setFPSCap), | |
* emits dataless 'prerender' event on start of loop, | |
* calls in order any one-shot functions registered by nextTick on last loop, | |
* calls Context.update on all Context objects registered, | |
* and emits dataless 'postrender' event on end of loop. | |
* | |
* @static | |
* @private | |
* @method step | |
*/ | |
Engine.step = function step() { | |
var this$1 = this; | |
currentFrame++; | |
nextTickFrame = currentFrame; | |
var currentTime = Date.now(); | |
// skip frame if we're over our framerate cap | |
if (frameTimeLimit && currentTime - lastTime < frameTimeLimit) { return; } | |
var i = 0; | |
frameTime = currentTime - lastTime; | |
lastTime = currentTime; | |
eventHandler.emit('prerender'); | |
// empty the queue | |
var numFunctions = nextTickQueue.length; | |
while (numFunctions--) { (nextTickQueue.shift())(currentFrame); } | |
// limit total execution time for deferrable functions | |
while (deferQueue.length && (Date.now() - currentTime) < MAX_DEFER_FRAME_TIME) { | |
deferQueue.shift().call(this$1); | |
} | |
for (i = 0; i < contexts.length; i++) { contexts[i].update(); } | |
eventHandler.emit('postrender'); | |
}; | |
// engage requestAnimationFrame | |
function loop() { | |
if (options.runLoop) { | |
Engine.step(); | |
window.requestAnimationFrame(loop); | |
} | |
else { loopEnabled = false; } | |
} | |
window.requestAnimationFrame(loop); | |
// | |
// Upon main document window resize (unless on an "input" HTML element): | |
// scroll to the top left corner of the window, | |
// and for each managed Context: emit the 'resize' event and update its size. | |
// @param {Object=} event document event | |
// | |
function handleResize(event) { | |
for (var i = 0; i < contexts.length; i++) { | |
contexts[i].emit('resize'); | |
} | |
eventHandler.emit('resize'); | |
} | |
window.addEventListener('resize', handleResize, false); | |
handleResize(); | |
/** | |
* Initialize famous for app mode | |
* | |
* @static | |
* @private | |
* @method initialize | |
*/ | |
function initialize() { | |
// prevent scrolling via browser | |
window.addEventListener('touchmove', function(event) { | |
event.preventDefault(); | |
}, true); | |
addRootClasses(); | |
} | |
var initialized = false; | |
function addRootClasses() { | |
if (!document.body) { | |
Engine.nextTick(addRootClasses); | |
return; | |
} | |
document.body.classList.add('famous-root'); | |
document.documentElement.classList.add('famous-root'); | |
} | |
/** | |
* Add event handler object to set of downstream handlers. | |
* | |
* @method pipe | |
* | |
* @param {EventHandler} target event handler target object | |
* @return {EventHandler} passed event handler | |
*/ | |
Engine.pipe = function pipe(target) { | |
if (target.subscribe instanceof Function) { return target.subscribe(Engine); } | |
else { return eventHandler.pipe(target); } | |
}; | |
/** | |
* Remove handler object from set of downstream handlers. | |
* Undoes work of "pipe". | |
* | |
* @method unpipe | |
* | |
* @param {EventHandler} target target handler object | |
* @return {EventHandler} provided target | |
*/ | |
Engine.unpipe = function unpipe(target) { | |
if (target.unsubscribe instanceof Function) { return target.unsubscribe(Engine); } | |
else { return eventHandler.unpipe(target); } | |
}; | |
/** | |
* Bind a callback function to an event type handled by this object. | |
* | |
* @static | |
* @method "on" | |
* | |
* @param {string} type event type key (for example, 'click') | |
* @param {function(string, Object)} handler callback | |
* @return {EventHandler} this | |
*/ | |
Engine.on = function on(type, handler) { | |
if (!(type in eventForwarders)) { | |
eventForwarders[type] = eventHandler.emit.bind(eventHandler, type); | |
addEngineListener(type, eventForwarders[type]); | |
} | |
return eventHandler.on(type, handler); | |
}; | |
function addEngineListener(type, forwarder) { | |
if (!document.body) { | |
Engine.nextTick(addEventListener.bind(this, type, forwarder)); | |
return; | |
} | |
document.body.addEventListener(type, forwarder); | |
} | |
/** | |
* Trigger an event, sending to all downstream handlers | |
* listening for provided 'type' key. | |
* | |
* @method emit | |
* | |
* @param {string} type event type key (for example, 'click') | |
* @param {Object} event event data | |
* @return {EventHandler} this | |
*/ | |
Engine.emit = function emit(type, event) { | |
return eventHandler.emit(type, event); | |
}; | |
/** | |
* Unbind an event by type and handler. | |
* This undoes the work of "on". | |
* | |
* @static | |
* @method removeListener | |
* | |
* @param {string} type event type key (for example, 'click') | |
* @param {function} handler function object to remove | |
* @return {EventHandler} internal event handler object (for chaining) | |
*/ | |
Engine.removeListener = function removeListener(type, handler) { | |
return eventHandler.removeListener(type, handler); | |
}; | |
/** | |
* Return the current calculated frames per second of the Engine. | |
* | |
* @static | |
* @method getFPS | |
* | |
* @return {Number} calculated fps | |
*/ | |
Engine.getFPS = function getFPS() { | |
return 1000 / frameTime; | |
}; | |
/** | |
* Set the maximum fps at which the system should run. If internal render | |
* loop is called at a greater frequency than this FPSCap, Engine will | |
* throttle render and update until this rate is achieved. | |
* | |
* @static | |
* @method setFPSCap | |
* | |
* @param {Number} fps maximum frames per second | |
*/ | |
Engine.setFPSCap = function setFPSCap(fps) { | |
frameTimeLimit = Math.floor(1000 / fps); | |
}; | |
/** | |
* Return engine options. | |
* | |
* @static | |
* @method getOptions | |
* @param {string} key | |
* @return {Object} engine options | |
*/ | |
Engine.getOptions = function getOptions(key) { | |
return optionsManager.getOptions(key); | |
}; | |
/** | |
* Set engine options | |
* | |
* @static | |
* @method setOptions | |
* | |
* @param {Object} [options] overrides of default options | |
* @param {Number} [options.fpsCap] maximum fps at which the system should run | |
* @param {boolean} [options.runLoop=true] whether the run loop should continue | |
* @param {string} [options.containerType="div"] type of container element. Defaults to 'div'. | |
* @param {string} [options.containerClass="famous-container"] type of container element. Defaults to 'famous-container'. | |
*/ | |
Engine.setOptions = function setOptions(options) { | |
return optionsManager.setOptions.apply(optionsManager, arguments); | |
}; | |
/** | |
* Creates a new Context for rendering and event handling with | |
* provided document element as top of each tree. This will be tracked by the | |
* process-wide Engine. | |
* | |
* @static | |
* @method createContext | |
* | |
* @param {Node} el will be top of Famo.us document element tree | |
* @return {Context} new Context within el | |
*/ | |
Engine.createContext = function createContext(el) { | |
if (!initialized && options.appMode) { Engine.nextTick(initialize); } | |
var needMountContainer = false; | |
if (!el) { | |
el = document.createElement(options.containerType); | |
el.classList.add(options.containerClass); | |
needMountContainer = true; | |
} | |
var context = new Context_1(el); | |
Engine.registerContext(context); | |
if (needMountContainer) { mount(context, el); } | |
return context; | |
}; | |
function mount(context, el) { | |
if (!document.body) { | |
Engine.nextTick(mount.bind(this, context, el)); | |
return; | |
} | |
document.body.appendChild(el); | |
context.emit('resize'); | |
} | |
/** | |
* Registers an existing context to be updated within the run loop. | |
* | |
* @static | |
* @method registerContext | |
* | |
* @param {Context} context Context to register | |
* @return {FamousContext} provided context | |
*/ | |
Engine.registerContext = function registerContext(context) { | |
contexts.push(context); | |
return context; | |
}; | |
/** | |
* Returns a list of all contexts. | |
* | |
* @static | |
* @method getContexts | |
* @return {Array} contexts that are updated on each tick | |
*/ | |
Engine.getContexts = function getContexts() { | |
return contexts; | |
}; | |
/** | |
* Removes a context from the run loop. Note: this does not do any | |
* cleanup. | |
* | |
* @static | |
* @method deregisterContext | |
* | |
* @param {Context} context Context to deregister | |
*/ | |
Engine.deregisterContext = function deregisterContext(context) { | |
var i = contexts.indexOf(context); | |
if (i >= 0) { contexts.splice(i, 1); } | |
}; | |
/** | |
* Queue a function to be executed on the next tick of the | |
* Engine. | |
* | |
* @static | |
* @method nextTick | |
* | |
* @param {function(Object)} fn function accepting window object | |
*/ | |
Engine.nextTick = function nextTick(fn) { | |
nextTickQueue.push(fn); | |
}; | |
/** | |
* Queue a function to be executed sometime soon, at a time that is | |
* unlikely to affect frame rate. | |
* | |
* @static | |
* @method defer | |
* | |
* @param {Function} fn | |
*/ | |
Engine.defer = function defer(fn) { | |
deferQueue.push(fn); | |
}; | |
optionsManager.on('change', function(data) { | |
if (data.id === 'fpsCap') { Engine.setFPSCap(data.value); } | |
else if (data.id === 'runLoop') { | |
// kick off the loop only if it was stopped | |
if (!loopEnabled && data.value) { | |
loopEnabled = true; | |
window.requestAnimationFrame(loop); | |
} | |
} | |
}); | |
var Engine_1 = Engine; | |
/* | |
* @overview Utility functions used by infamous. | |
* | |
* LICENSE | |
* | |
* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
* | |
*/ | |
/** | |
* Creates a [famous/src/core/Context](#famous/src/core/Context) having the specified 3D perspective. | |
* | |
* @param {Number} perspective The integer amount of perspective to apply to the `Context`. | |
* @returns {module: famous/src/core/Context} The `Context` with the applied perspective. | |
*/ | |
function contextWithPerspective(perspective) { | |
const context = Engine_1.createContext(); | |
context.setPerspective(perspective); | |
return context; | |
} | |
function simpleExtend(object) { | |
var others = [], len = arguments.length - 1; | |
while ( len-- > 0 ) others[ len ] = arguments[ len + 1 ]; | |
others.forEach(function(other) { | |
for (let prop in other) { | |
object[prop] = other[prop]; | |
} | |
}); | |
} | |
var utils = Object.freeze({ | |
contextWithPerspective: contextWithPerspective, | |
simpleExtend: simpleExtend | |
}); | |
// Polyfill for Function.name on browsers that do not support it (IE): | |
// See: http://stackoverflow.com/questions/6903762/function-name-not-supported-in-ie | |
if (!(function f() {}).name) { | |
Object.defineProperty(Function.prototype, "name", { | |
get: function () { | |
var name = this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]; | |
// For better performance only parse once, and then cache the | |
// result through a new accessor for repeated access. | |
Object.defineProperty(this, "name", { value: name }); | |
return name; | |
} | |
}); | |
} | |
/* | |
* LICENSE | |
* | |
* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
* | |
*/ | |
/** | |
* Molecules are the basic building blocks of all UI components. Molecules | |
* extend [famous/src/core/RenderNode](#famous/src/core/RenderNode), so they can be | |
* added to any `RenderNode` of a famo.us render tree, and by default they will | |
* also accept anything that a normal Famo.us `RenderNode` can accept via the | |
* `add` method. Classes that extend from `Molecule` might override | |
* `RenderNode.add` in order to accept things like arrays of renderables in | |
* stead of a single renderable. | |
* | |
* Molecules encapsulate the basic things you need for a component -- a | |
* [famous/src/transitions/TransitionableTransform](#famous/src/transitions/TransitionableTransform) | |
* for positioning things in space, and a [famous/src/core/EventHandler](#famous/src/core/EventHandler) | |
* for capturing user interaction -- exposing a unified API for working with these | |
* things. For now, [famous/src/core/Modifier](#famous/src/core/Modifier) is used as the interface | |
* for applying transforms and sizing, but this will change in Mixed Mode | |
* Famo.us. | |
* | |
* All components extend Molecule, but at the same time they can also use any | |
* number of Molecules internally to do nice things like create layouts and | |
* position multiple things in space. | |
* | |
* @class Molecule | |
* @extends {module: famous/src/core/RenderNode} | |
*/ | |
var Molecule = (function (RenderNode) { | |
function Molecule(initialOptions) { | |
RenderNode.call(this); | |
// "private" stuff. Not really, but regard it like so. For example, if | |
// you see something like obj._.someVariable then you're accessing | |
// internal stuff that wasn't designed to be accessed directly, and any | |
// problem you enounter with that is your own problem. :) | |
// | |
// TODO: Use a WeakMap to store these at some point. | |
this._ = { | |
options: {}, // set and get with this.options | |
defaultOptions: {} | |
}; | |
// Add default values for this Molecule | |
// TODO: Make default options static for the class. | |
simpleExtend(this._.defaultOptions, { | |
align: [0.5,0.5], | |
origin: [0.5,0.5], | |
transform: new TransitionableTransform_1, | |
handler: new EventHandler_1 | |
}); | |
// set the user's initial options. This automatically creates | |
// this.modifier, and adds it to this (don't forget, *this* is a | |
// RenderNode, so a Molecule can add things to itself). | |
// | |
// NOTE: this.options is a setter property. This statement applies all | |
// relevant properties to this.modifier. | |
this.options = initialOptions; | |
} | |
if ( RenderNode ) Molecule.__proto__ = RenderNode; | |
Molecule.prototype = Object.create( RenderNode && RenderNode.prototype ); | |
Molecule.prototype.constructor = Molecule; | |
var prototypeAccessors = { options: {},transform: {} }; | |
/** | |
* @property {Object} options The Molecule's options, which get applied to | |
* `this.modifier`. This may change with Mixed Mode. Setting this property | |
* overrides existing options. To extend existing options with new options, | |
* use `setOptions` instead. Unspecified options will be set to their default | |
* values. | |
* | |
* Note: Anytime `this.options` is assigned a new value, `this.modifier` is set | |
* to a new [famous/src/core/Modifier](#famous/src/core/Modifier). | |
*/ | |
prototypeAccessors.options.set = function (newOptions) { | |
this.resetOptions(); | |
this.setOptions(newOptions); | |
}; | |
prototypeAccessors.options.get = function () { | |
return this._.options; | |
}; | |
/** | |
* @property {module: famous/src/transitions/TransitionableTransform} transform | |
* The transform of this `Molecule`. The default is a | |
* [famous/src/transitions/TransitionableTransform](#famous/src/transitions/TransitionableTransform). | |
* Setting this property automatically puts the new transform into effect. | |
* See [famous/src/core/Modifier.transformFrom](#famous/src/core/Modifier.transformFrom). | |
*/ | |
prototypeAccessors.transform.set = function (newTransform) { | |
this.setOptions({transform: newTransform}); | |
}; | |
prototypeAccessors.transform.get = function () { | |
return this.options.transform; | |
}; | |
/** | |
* Compounds `newOptions` into the existing options, similar to extending an | |
* object and overriding only the desired properties. To override all | |
* options with a set of new options, set `this.options` directly. | |
* | |
* An example of setting just a single option without erasing other options: | |
* | |
* ```js | |
* const myMolecule = new Molecule() | |
* myMolecule.setOptions({ | |
* align: [0.2, 0.8] | |
* }) | |
* ``` | |
* | |
* @param {Object} newOptions An object containing the new options to apply to this `Molecule`. | |
*/ | |
Molecule.prototype.setOptions = function setOptions (newOptions) { | |
var this$1 = this; | |
if (typeof newOptions == 'undefined' || newOptions.constructor.name != "Object") | |
{ newOptions = {}; } | |
for (let prop in newOptions) { | |
// Subject to change when Famo.us API changes. | |
if (Modifier_1.prototype[''+prop+'From']) { | |
this$1.modifier[''+prop+'From'](newOptions[prop]); | |
} | |
this$1._.options[prop] = newOptions[prop]; | |
} | |
}; | |
/** | |
* Sets all options back to their defaults. | |
* | |
* Note: Anytime this is called, `this.modifier` is set to a new | |
* [famous/src/core/Modifier](#famous/src/core/Modifier) having the default | |
* options. | |
*/ | |
Molecule.prototype.resetOptions = function resetOptions () { | |
this.modifier = new Modifier_1(); | |
this.set(this.modifier); | |
this.setOptions(this._.defaultOptions); | |
}; | |
/** | |
* Forwards events from this Molecule's [famous/src/core/EventHandler](#famous/src/core/EventHandler) to the given | |
* target, which can be another `EventHandler` or `Molecule`. | |
* | |
* This method is equivalent to [famous/src/core/EventHandler.pipe](#famous/src/core/EventHandler.pipe), | |
* acting upon `this.handler`. | |
* | |
* TODO v0.1.0: Let this method accept a `Molecule`, then stop doing `pipe(this._.handler)` in other places | |
*/ | |
Molecule.prototype.pipe = function pipe () { | |
const args = Array.prototype.splice.call(arguments, 0); | |
return this.options.handler.pipe.apply(this.options.handler, args); | |
}; | |
/** | |
* Stops events from this Molecule's [famous/src/core/EventHandler](#famous/src/core/EventHandler) | |
* from being sent to the given target. | |
* | |
* This method is equivalent to [famous/src/core/EventHandler.unpipe](#famous/src/core/EventHandler.unpipe), | |
* acting upon `this.handler`. | |
* | |
* TODO v0.1.0: Let this method accept a `Molecule`, then stop doing `pipe(this.options.handler)` in other places | |
*/ | |
Molecule.prototype.unpipe = function unpipe () { | |
const args = Array.prototype.splice.call(arguments, 0); | |
return this.options.handler.unpipe.apply(this.options.handler, args); | |
}; | |
/** | |
* Register an event handler for the specified event. | |
* See [famous/src/core/EventHandler.on](#famous/src/core/EventHandler.on). | |
*/ | |
Molecule.prototype.on = function on () { | |
const args = Array.prototype.splice.call(arguments, 0); | |
return this.options.handler.on.apply(this.options.handler, args); | |
}; | |
/** | |
* Unregister an event handler for the specified event. | |
* See [famous/src/core/EventHandler.off](#famous/src/core/EventHandler.off). | |
*/ | |
Molecule.prototype.off = function off () { | |
const args = Array.prototype.splice.call(arguments, 0); | |
return this.options.handler.on.apply(this.options.handler, args); | |
}; | |
Object.defineProperties( Molecule.prototype, prototypeAccessors ); | |
return Molecule; | |
}(RenderNode_1)); | |
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | |
function unwrapExports (x) { | |
return x && x.__esModule ? x['default'] : x; | |
} | |
function createCommonjsModule(fn, module) { | |
return module = { exports: {} }, fn(module, module.exports), module.exports; | |
} | |
var forLength_1 = createCommonjsModule(function (module, exports) { | |
"use strict"; | |
// loop for a given length, performing action each loop iteration. action receives the index of the loop. | |
exports.forLength = forLength; | |
function forLength(length, action) { | |
for (var i = 0; i < length; i += 1) { | |
action(i); | |
} | |
} | |
exports["default"] = forLength; | |
exports.__esModule = true; | |
}); | |
var forLength = unwrapExports(forLength_1); | |
/* | |
* LICENSE | |
* | |
* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
* | |
*/ | |
/** | |
* A scenegraph tree with a variable number of leaf node Modifiers (the grid | |
* cells) that are arranged in a grid. Add any [famous/src/core/RenderNode](#famous/src/core/RenderNode)-compatible | |
* item to each leafnode of the grid. | |
* | |
* TODO: Use Molecule instead of Modifier for the grid cells. | |
* TODO: Add an options parameter, that the Molecule constructor will handle. | |
* | |
* @class Grid | |
* @extends Molecule | |
*/ | |
var Grid = (function (Molecule$$1) { | |
function Grid(columns, rows, size) { | |
Molecule$$1.call(this, {size: size}); | |
this.columns = columns; | |
this.rows = rows; | |
this.cellNodes = []; | |
if (typeof this.options.size === 'undefined') { this.setOptions({size: [undefined, undefined]}); } | |
forLength(this.columns*this.rows, this._createGridCell.bind(this)); | |
} | |
if ( Molecule$$1 ) Grid.__proto__ = Molecule$$1; | |
Grid.prototype = Object.create( Molecule$$1 && Molecule$$1.prototype ); | |
Grid.prototype.constructor = Grid; | |
/** | |
* Creates a grid cell at the given index. | |
* | |
* @private | |
* @param {Number} index The integer index of the grid cell. | |
*/ | |
Grid.prototype._createGridCell = function _createGridCell (index) { | |
const column = index % this.columns; | |
const row = Math.floor(index / this.columns); | |
let cellSize = null; | |
if (typeof this.options.size[0] != 'undefined' && typeof this.options.size[1] != 'undefined') { | |
cellSize = []; | |
cellSize[0] = this.options.size[0]/this.columns; | |
cellSize[1] = this.options.size[1]/this.rows; | |
} | |
const mod = new Modifier_1({ | |
align: [0,0], | |
origin: [0,0], | |
size: cellSize? [cellSize[0], cellSize[1]]: [undefined, undefined], | |
transform: Transform_1.translate(column*cellSize[0],row*cellSize[1],0) | |
}); | |
const mod2 = new Modifier_1({ | |
//transform: Transform.rotateY(Math.PI/10), | |
align: [0.5,0.5], | |
origin: [0.5,0.5] | |
}); | |
// FIXME: ^^^ Why do I need an extra Modifier to align stuff in the middle of the grid cells????? | |
this.cellNodes.push(this.add(mod).add(mod2)); | |
}; | |
/** | |
* Sets the items to be layed out in the grid. | |
* | |
* @param {Array} children An array of [famous/src/core/RenderNode](#famous/src/core/RenderNode)-compatible items. | |
*/ | |
Grid.prototype.setChildren = function setChildren (children) { | |
forLength(this.columns*this.rows, function(index) { | |
//this.cellNodes[index].set(null); // TODO: how do we erase previous children? | |
this.cellNodes[index].add(children[index]); | |
}.bind(this)); | |
return this; | |
}; | |
return Grid; | |
}(Molecule)); | |
/* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
* | |
* Owner: [email protected] | |
* @license MPL 2.0 | |
* @copyright Famous Industries, Inc. 2015 | |
*/ | |
var usePrefix$1 = !('transform' in document.documentElement.style); | |
var devicePixelRatio = window.devicePixelRatio || 1; | |
/** | |
* A base class for viewable content and event | |
* targets inside a Famo.us application, containing a renderable document | |
* fragment. Like an HTML div, it can accept internal markup, | |
* properties, classes, and handle events. | |
* | |
* @class ElementOutput | |
* @constructor | |
* | |
* @param {Node} element document parent of this container | |
*/ | |
function ElementOutput(element) { | |
this._matrix = null; | |
this._opacity = 1; | |
this._origin = null; | |
this._size = null; | |
this._eventOutput = new EventHandler_1(); | |
this._eventOutput.bindThis(this); | |
/** @ignore */ | |
this.eventForwarder = function eventForwarder(event) { | |
this._eventOutput.emit(event.type, event); | |
}.bind(this); | |
this.id = Entity.register(this); | |
this._element = null; | |
this._sizeDirty = false; | |
this._originDirty = false; | |
this._transformDirty = false; | |
this._invisible = false; | |
if (element) { this.attach(element); } | |
} | |
/** | |
* Bind a callback function to an event type handled by this object. | |
* | |
* @method "on" | |
* | |
* @param {string} type event type key (for example, 'click') | |
* @param {function(string, Object)} fn handler callback | |
* @return {EventHandler} this | |
*/ | |
ElementOutput.prototype.on = function on(type, fn) { | |
if (this._element) { this._element.addEventListener(type, this.eventForwarder); } | |
this._eventOutput.on(type, fn); | |
}; | |
/** | |
* Unbind an event by type and handler. | |
* This undoes the work of "on" | |
* | |
* @method removeListener | |
* @param {string} type event type key (for example, 'click') | |
* @param {function(string, Object)} fn handler | |
*/ | |
ElementOutput.prototype.removeListener = function removeListener(type, fn) { | |
this._eventOutput.removeListener(type, fn); | |
}; | |
/** | |
* Trigger an event, sending to all downstream handlers | |
* listening for provided 'type' key. | |
* | |
* @method emit | |
* | |
* @param {string} type event type key (for example, 'click') | |
* @param {Object} [event] event data | |
* @return {EventHandler} this | |
*/ | |
ElementOutput.prototype.emit = function emit(type, event) { | |
if (event && !event.origin) { event.origin = this; } | |
var handled = this._eventOutput.emit(type, event); | |
if (handled && event && event.stopPropagation) { event.stopPropagation(); } | |
return handled; | |
}; | |
/** | |
* Add event handler object to set of downstream handlers. | |
* | |
* @method pipe | |
* | |
* @param {EventHandler} target event handler target object | |
* @return {EventHandler} passed event handler | |
*/ | |
ElementOutput.prototype.pipe = function pipe(target) { | |
return this._eventOutput.pipe(target); | |
}; | |
/** | |
* Remove handler object from set of downstream handlers. | |
* Undoes work of "pipe" | |
* | |
* @method unpipe | |
* | |
* @param {EventHandler} target target handler object | |
* @return {EventHandler} provided target | |
*/ | |
ElementOutput.prototype.unpipe = function unpipe(target) { | |
return this._eventOutput.unpipe(target); | |
}; | |
/** | |
* Return spec for this surface. Note that for a base surface, this is | |
* simply an id. | |
* | |
* @method render | |
* @private | |
* @return {Object} render spec for this surface (spec id) | |
*/ | |
ElementOutput.prototype.render = function render() { | |
return this.id; | |
}; | |
// Attach Famous event handling to document events emanating from target | |
// document element. This occurs just after attachment to the document. | |
// Calling this enables methods like #on and #pipe. | |
function _addEventListeners(target) { | |
var this$1 = this; | |
for (var i in this$1._eventOutput.listeners) { | |
target.addEventListener(i, this$1.eventForwarder); | |
} | |
} | |
// Detach Famous event handling from document events emanating from target | |
// document element. This occurs just before detach from the document. | |
function _removeEventListeners(target) { | |
var this$1 = this; | |
for (var i in this$1._eventOutput.listeners) { | |
target.removeEventListener(i, this$1.eventForwarder); | |
} | |
} | |
/** | |
* Return a Matrix's webkit css representation to be used with the | |
* CSS3 -webkit-transform style. | |
* Example: -webkit-transform: matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,716,243,0,1) | |
* | |
* @method _formatCSSTransform | |
* @private | |
* @param {FamousMatrix} m matrix | |
* @return {string} matrix3d CSS style representation of the transform | |
*/ | |
function _formatCSSTransform(m) { | |
m[12] = Math.round(m[12] * devicePixelRatio) / devicePixelRatio; | |
m[13] = Math.round(m[13] * devicePixelRatio) / devicePixelRatio; | |
var result = 'matrix3d('; | |
for (var i = 0; i < 15; i++) { | |
result += (m[i] < 0.000001 && m[i] > -0.000001) ? '0,' : m[i] + ','; | |
} | |
result += m[15] + ')'; | |
return result; | |
} | |
/** | |
* Directly apply given FamousMatrix to the document element as the | |
* appropriate webkit CSS style. | |
* | |
* @method setMatrix | |
* | |
* @static | |
* @private | |
* @param {Element} element document element | |
* @param {FamousMatrix} matrix | |
*/ | |
var _setMatrix; | |
if (usePrefix$1) { | |
_setMatrix = function(element, matrix) { | |
element.style.webkitTransform = _formatCSSTransform(matrix); | |
}; | |
} | |
else { | |
_setMatrix = function(element, matrix) { | |
element.style.transform = _formatCSSTransform(matrix); | |
}; | |
} | |
// format origin as CSS percentage string | |
function _formatCSSOrigin(origin) { | |
return (100 * origin[0]) + '% ' + (100 * origin[1]) + '%'; | |
} | |
// Directly apply given origin coordinates to the document element as the | |
// appropriate webkit CSS style. | |
var _setOrigin = usePrefix$1 ? function(element, origin) { | |
element.style.webkitTransformOrigin = _formatCSSOrigin(origin); | |
} : function(element, origin) { | |
element.style.transformOrigin = _formatCSSOrigin(origin); | |
}; | |
// Shrink given document element until it is effectively invisible. | |
var _setInvisible = usePrefix$1 ? function(element) { | |
element.style.webkitTransform = 'scale3d(0.0001,0.0001,0.0001)'; | |
element.style.opacity = 0; | |
} : function(element) { | |
element.style.transform = 'scale3d(0.0001,0.0001,0.0001)'; | |
element.style.opacity = 0; | |
}; | |
function _xyNotEquals$1(a, b) { | |
return (a && b) ? (a[0] !== b[0] || a[1] !== b[1]) : a !== b; | |
} | |
/** | |
* Apply changes from this component to the corresponding document element. | |
* This includes changes to classes, styles, size, content, opacity, origin, | |
* and matrix transforms. | |
* | |
* @private | |
* @method commit | |
* @param {Context} context commit context | |
*/ | |
ElementOutput.prototype.commit = function commit(context) { | |
var target = this._element; | |
if (!target) { return; } | |
var matrix = context.transform; | |
var opacity = context.opacity; | |
var origin = context.origin; | |
var size = context.size; | |
if (!matrix && this._matrix) { | |
this._matrix = null; | |
this._opacity = 0; | |
_setInvisible(target); | |
return; | |
} | |
if (_xyNotEquals$1(this._origin, origin)) { this._originDirty = true; } | |
if (Transform_1.notEquals(this._matrix, matrix)) { this._transformDirty = true; } | |
if (this._invisible) { | |
this._invisible = false; | |
this._element.style.display = ''; | |
} | |
if (this._opacity !== opacity) { | |
this._opacity = opacity; | |
target.style.opacity = (opacity >= 1) ? '0.999999' : opacity; | |
} | |
if (this._transformDirty || this._originDirty || this._sizeDirty) { | |
if (this._sizeDirty) { this._sizeDirty = false; } | |
if (this._originDirty) { | |
if (origin) { | |
if (!this._origin) { this._origin = [0, 0]; } | |
this._origin[0] = origin[0]; | |
this._origin[1] = origin[1]; | |
} | |
else { this._origin = null; } | |
_setOrigin(target, this._origin); | |
this._originDirty = false; | |
} | |
if (!matrix) { matrix = Transform_1.identity; } | |
this._matrix = matrix; | |
var aaMatrix = this._size ? Transform_1.thenMove(matrix, [-this._size[0]*origin[0], -this._size[1]*origin[1], 0]) : matrix; | |
_setMatrix(target, aaMatrix); | |
this._transformDirty = false; | |
} | |
}; | |
ElementOutput.prototype.cleanup = function cleanup() { | |
if (this._element) { | |
this._invisible = true; | |
this._element.style.display = 'none'; | |
} | |
}; | |
/** | |
* Place the document element that this component manages into the document. | |
* | |
* @private | |
* @method attach | |
* @param {Node} target document parent of this container | |
*/ | |
ElementOutput.prototype.attach = function attach(target) { | |
this._element = target; | |
_addEventListeners.call(this, target); | |
}; | |
/** | |
* Remove any contained document content associated with this surface | |
* from the actual document. | |
* | |
* @private | |
* @method detach | |
*/ | |
ElementOutput.prototype.detach = function detach() { | |
var target = this._element; | |
if (target) { | |
_removeEventListeners.call(this, target); | |
if (this._invisible) { | |
this._invisible = false; | |
this._element.style.display = ''; | |
} | |
} | |
this._element = null; | |
return target; | |
}; | |
var ElementOutput_1 = ElementOutput; | |
/* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
* | |
* Owner: [email protected] | |
* @license MPL 2.0 | |
* @copyright Famous Industries, Inc. 2015 | |
*/ | |
/** | |
* A base class for viewable content and event | |
* targets inside a Famo.us application, containing a renderable document | |
* fragment. Like an HTML div, it can accept internal markup, | |
* properties, classes, and handle events. | |
* | |
* @class Surface | |
* @constructor | |
* | |
* @param {Object} [options] default option overrides | |
* @param {Array.Number} [options.size] [width, height] in pixels | |
* @param {Array.string} [options.classes] CSS classes to set on target div | |
* @param {Array} [options.properties] string dictionary of CSS properties to set on target div | |
* @param {Array} [options.attributes] string dictionary of HTML attributes to set on target div | |
* @param {string} [options.content] inner (HTML) content of surface | |
*/ | |
function Surface(options) { | |
ElementOutput_1.call(this); | |
this.options = {}; | |
this.properties = {}; | |
this.attributes = {}; | |
this.content = ''; | |
this.classList = []; | |
this.size = null; | |
this._classesDirty = true; | |
this._stylesDirty = true; | |
this._attributesDirty = true; | |
this._sizeDirty = true; | |
this._contentDirty = true; | |
this._trueSizeCheck = true; | |
this._dirtyClasses = []; | |
if (options) { this.setOptions(options); } | |
this._currentTarget = null; | |
} | |
Surface.prototype = Object.create(ElementOutput_1.prototype); | |
Surface.prototype.constructor = Surface; | |
Surface.prototype.elementType = 'div'; | |
Surface.prototype.elementClass = 'famous-surface'; | |
/** | |
* Set HTML attributes on this Surface. Note that this will cause | |
* dirtying and thus re-rendering, even if values do not change. | |
* | |
* @method setAttributes | |
* @param {Object} attributes property dictionary of "key" => "value" | |
*/ | |
Surface.prototype.setAttributes = function setAttributes(attributes) { | |
var this$1 = this; | |
for (var n in attributes) { | |
if (n === 'style') { throw new Error('Cannot set styles via "setAttributes" as it will break Famo.us. Use "setProperties" instead.'); } | |
this$1.attributes[n] = attributes[n]; | |
} | |
this._attributesDirty = true; | |
}; | |
/** | |
* Get HTML attributes on this Surface. | |
* | |
* @method getAttributes | |
* | |
* @return {Object} Dictionary of this Surface's attributes. | |
*/ | |
Surface.prototype.getAttributes = function getAttributes() { | |
return this.attributes; | |
}; | |
/** | |
* Set CSS-style properties on this Surface. Note that this will cause | |
* dirtying and thus re-rendering, even if values do not change. | |
* | |
* @method setProperties | |
* @chainable | |
* @param {Object} properties property dictionary of "key" => "value" | |
*/ | |
Surface.prototype.setProperties = function setProperties(properties) { | |
var this$1 = this; | |
for (var n in properties) { | |
this$1.properties[n] = properties[n]; | |
} | |
this._stylesDirty = true; | |
return this; | |
}; | |
/** | |
* Get CSS-style properties on this Surface. | |
* | |
* @method getProperties | |
* | |
* @return {Object} Dictionary of this Surface's properties. | |
*/ | |
Surface.prototype.getProperties = function getProperties() { | |
return this.properties; | |
}; | |
/** | |
* Add CSS-style class to the list of classes on this Surface. Note | |
* this will map directly to the HTML property of the actual | |
* corresponding rendered <div>. | |
* | |
* @method addClass | |
* @chainable | |
* @param {string} className name of class to add | |
*/ | |
Surface.prototype.addClass = function addClass(className) { | |
if (this.classList.indexOf(className) < 0) { | |
this.classList.push(className); | |
this._classesDirty = true; | |
} | |
return this; | |
}; | |
/** | |
* Remove CSS-style class from the list of classes on this Surface. | |
* Note this will map directly to the HTML property of the actual | |
* corresponding rendered <div>. | |
* | |
* @method removeClass | |
* @chainable | |
* @param {string} className name of class to remove | |
*/ | |
Surface.prototype.removeClass = function removeClass(className) { | |
var i = this.classList.indexOf(className); | |
if (i >= 0) { | |
this._dirtyClasses.push(this.classList.splice(i, 1)[0]); | |
this._classesDirty = true; | |
} | |
return this; | |
}; | |
/** | |
* Toggle CSS-style class from the list of classes on this Surface. | |
* Note this will map directly to the HTML property of the actual | |
* corresponding rendered <div>. | |
* | |
* @method toggleClass | |
* @param {string} className name of class to toggle | |
*/ | |
Surface.prototype.toggleClass = function toggleClass(className) { | |
var i = this.classList.indexOf(className); | |
if (i >= 0) { | |
this.removeClass(className); | |
} else { | |
this.addClass(className); | |
} | |
return this; | |
}; | |
/** | |
* Reset class list to provided dictionary. | |
* @method setClasses | |
* @chainable | |
* @param {Array.string} classList | |
*/ | |
Surface.prototype.setClasses = function setClasses(classList) { | |
var this$1 = this; | |
var i = 0; | |
var removal = []; | |
for (i = 0; i < this.classList.length; i++) { | |
if (classList.indexOf(this$1.classList[i]) < 0) { removal.push(this$1.classList[i]); } | |
} | |
for (i = 0; i < removal.length; i++) { this$1.removeClass(removal[i]); } | |
// duplicates are already checked by addClass() | |
for (i = 0; i < classList.length; i++) { this$1.addClass(classList[i]); } | |
return this; | |
}; | |
/** | |
* Get array of CSS-style classes attached to this div. | |
* | |
* @method getClasslist | |
* @return {Array.string} array of class names | |
*/ | |
Surface.prototype.getClassList = function getClassList() { | |
return this.classList; | |
}; | |
/** | |
* Set or overwrite inner (HTML) content of this surface. Note that this | |
* causes a re-rendering if the content has changed. | |
* | |
* @method setContent | |
* @chainable | |
* @param {string|Document Fragment} content HTML content | |
*/ | |
Surface.prototype.setContent = function setContent(content) { | |
if (this.content !== content) { | |
this.content = content; | |
this._contentDirty = true; | |
} | |
return this; | |
}; | |
/** | |
* Return inner (HTML) content of this surface. | |
* | |
* @method getContent | |
* | |
* @return {string} inner (HTML) content | |
*/ | |
Surface.prototype.getContent = function getContent() { | |
return this.content; | |
}; | |
/** | |
* Set options for this surface | |
* | |
* @method setOptions | |
* @chainable | |
* @param {Object} [options] overrides for default options. See constructor. | |
*/ | |
Surface.prototype.setOptions = function setOptions(options) { | |
if (options.size) { this.setSize(options.size); } | |
if (options.classes) { this.setClasses(options.classes); } | |
if (options.properties) { this.setProperties(options.properties); } | |
if (options.attributes) { this.setAttributes(options.attributes); } | |
if (options.content) { this.setContent(options.content); } | |
return this; | |
}; | |
// Apply to document all changes from removeClass() since last setup(). | |
function _cleanupClasses(target) { | |
var this$1 = this; | |
for (var i = 0; i < this._dirtyClasses.length; i++) { target.classList.remove(this$1._dirtyClasses[i]); } | |
this._dirtyClasses = []; | |
} | |
// Apply values of all Famous-managed styles to the document element. | |
// These will be deployed to the document on call to #setup(). | |
function _applyStyles(target) { | |
var this$1 = this; | |
for (var n in this$1.properties) { | |
target.style[n] = this$1.properties[n]; | |
} | |
} | |
// Clear all Famous-managed styles from the document element. | |
// These will be deployed to the document on call to #setup(). | |
function _cleanupStyles(target) { | |
var this$1 = this; | |
for (var n in this$1.properties) { | |
target.style[n] = ''; | |
} | |
} | |
// Apply values of all Famous-managed attributes to the document element. | |
// These will be deployed to the document on call to #setup(). | |
function _applyAttributes(target) { | |
var this$1 = this; | |
for (var n in this$1.attributes) { | |
target.setAttribute(n, this$1.attributes[n]); | |
} | |
} | |
// Clear all Famous-managed attributes from the document element. | |
// These will be deployed to the document on call to #setup(). | |
function _cleanupAttributes(target) { | |
var this$1 = this; | |
for (var n in this$1.attributes) { | |
target.removeAttribute(n); | |
} | |
} | |
function _xyNotEquals(a, b) { | |
return (a && b) ? (a[0] !== b[0] || a[1] !== b[1]) : a !== b; | |
} | |
/** | |
* One-time setup for an element to be ready for commits to document. | |
* | |
* @private | |
* @method setup | |
* | |
* @param {ElementAllocator} allocator document element pool for this context | |
*/ | |
Surface.prototype.setup = function setup(allocator) { | |
var this$1 = this; | |
var target = allocator.allocate(this.elementType); | |
if (this.elementClass) { | |
if (this.elementClass instanceof Array) { | |
for (var i = 0; i < this.elementClass.length; i++) { | |
target.classList.add(this$1.elementClass[i]); | |
} | |
} | |
else { | |
target.classList.add(this.elementClass); | |
} | |
} | |
target.style.display = ''; | |
this.attach(target); | |
this._opacity = null; | |
this._currentTarget = target; | |
this._stylesDirty = true; | |
this._classesDirty = true; | |
this._attributesDirty = true; | |
this._sizeDirty = true; | |
this._contentDirty = true; | |
this._originDirty = true; | |
this._transformDirty = true; | |
}; | |
/** | |
* Apply changes from this component to the corresponding document element. | |
* This includes changes to classes, styles, size, content, opacity, origin, | |
* and matrix transforms. | |
* | |
* @private | |
* @method commit | |
* @param {Context} context commit context | |
*/ | |
Surface.prototype.commit = function commit(context) { | |
if (!this._currentTarget) { this.setup(context.allocator); } | |
var target = this._currentTarget; | |
var size = context.size; | |
if (this._classesDirty) { | |
_cleanupClasses.call(this, target); | |
var classList = this.getClassList(); | |
for (var i = 0; i < classList.length; i++) { target.classList.add(classList[i]); } | |
this._classesDirty = false; | |
this._trueSizeCheck = true; | |
} | |
if (this._stylesDirty) { | |
_applyStyles.call(this, target); | |
this._stylesDirty = false; | |
this._trueSizeCheck = true; | |
} | |
if (this._attributesDirty) { | |
_applyAttributes.call(this, target); | |
this._attributesDirty = false; | |
this._trueSizeCheck = true; | |
} | |
if (this.size) { | |
var origSize = context.size; | |
size = [this.size[0], this.size[1]]; | |
if (size[0] === undefined) { size[0] = origSize[0]; } | |
if (size[1] === undefined) { size[1] = origSize[1]; } | |
if (size[0] === true || size[1] === true) { | |
if (size[0] === true){ | |
if (this._trueSizeCheck || (this._size[0] === 0)) { | |
var width = target.offsetWidth; | |
if (this._size && this._size[0] !== width) { | |
this._size[0] = width; | |
this._sizeDirty = true; | |
} | |
size[0] = width; | |
} else { | |
if (this._size) { size[0] = this._size[0]; } | |
} | |
} | |
if (size[1] === true){ | |
if (this._trueSizeCheck || (this._size[1] === 0)) { | |
var height = target.offsetHeight; | |
if (this._size && this._size[1] !== height) { | |
this._size[1] = height; | |
this._sizeDirty = true; | |
} | |
size[1] = height; | |
} else { | |
if (this._size) { size[1] = this._size[1]; } | |
} | |
} | |
this._trueSizeCheck = false; | |
} | |
} | |
if (_xyNotEquals(this._size, size)) { | |
if (!this._size) { this._size = [0, 0]; } | |
this._size[0] = size[0]; | |
this._size[1] = size[1]; | |
this._sizeDirty = true; | |
} | |
if (this._sizeDirty) { | |
if (this._size) { | |
target.style.width = (this.size && this.size[0] === true) ? '' : this._size[0] + 'px'; | |
target.style.height = (this.size && this.size[1] === true) ? '' : this._size[1] + 'px'; | |
} | |
this._eventOutput.emit('resize'); | |
} | |
if (this._contentDirty) { | |
this.deploy(target); | |
this._eventOutput.emit('deploy'); | |
this._contentDirty = false; | |
this._trueSizeCheck = true; | |
} | |
ElementOutput_1.prototype.commit.call(this, context); | |
}; | |
/** | |
* Remove all Famous-relevant attributes from a document element. | |
* This is called by SurfaceManager's detach(). | |
* This is in some sense the reverse of .deploy(). | |
* | |
* @private | |
* @method cleanup | |
* @param {ElementAllocator} allocator | |
*/ | |
Surface.prototype.cleanup = function cleanup(allocator) { | |
var this$1 = this; | |
var i = 0; | |
var target = this._currentTarget; | |
this._eventOutput.emit('recall'); | |
this.recall(target); | |
target.style.display = 'none'; | |
target.style.opacity = ''; | |
target.style.width = ''; | |
target.style.height = ''; | |
_cleanupStyles.call(this, target); | |
_cleanupAttributes.call(this, target); | |
var classList = this.getClassList(); | |
_cleanupClasses.call(this, target); | |
for (i = 0; i < classList.length; i++) { target.classList.remove(classList[i]); } | |
if (this.elementClass) { | |
if (this.elementClass instanceof Array) { | |
for (i = 0; i < this.elementClass.length; i++) { | |
target.classList.remove(this$1.elementClass[i]); | |
} | |
} | |
else { | |
target.classList.remove(this.elementClass); | |
} | |
} | |
this.detach(target); | |
this._currentTarget = null; | |
allocator.deallocate(target); | |
}; | |
/** | |
* Place the document element that this component manages into the document. | |
* | |
* @private | |
* @method deploy | |
* @param {Node} target document parent of this container | |
*/ | |
Surface.prototype.deploy = function deploy(target) { | |
var content = this.getContent(); | |
if (content instanceof Node) { | |
while (target.hasChildNodes()) { target.removeChild(target.firstChild); } | |
target.appendChild(content); | |
} | |
else { target.innerHTML = content; } | |
}; | |
/** | |
* Remove any contained document content associated with this surface | |
* from the actual document. | |
* | |
* @private | |
* @method recall | |
*/ | |
Surface.prototype.recall = function recall(target) { | |
var df = document.createDocumentFragment(); | |
while (target.hasChildNodes()) { df.appendChild(target.firstChild); } | |
this.setContent(df); | |
}; | |
/** | |
* Get the x and y dimensions of the surface. | |
* | |
* @method getSize | |
* @return {Array.Number} [x,y] size of surface | |
*/ | |
Surface.prototype.getSize = function getSize() { | |
return this._size ? this._size : this.size; | |
}; | |
/** | |
* Set x and y dimensions of the surface. | |
* | |
* @method setSize | |
* @chainable | |
* @param {Array.Number} size as [width, height] | |
*/ | |
Surface.prototype.setSize = function setSize(size) { | |
this.size = size ? [size[0], size[1]] : null; | |
this._sizeDirty = true; | |
return this; | |
}; | |
var Surface_1 = Surface; | |
/* | |
* LICENSE | |
* | |
* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
* | |
*/ | |
/** | |
* Planes have the properties of [Molecules](#Molecule), plus they contain a | |
* [famous/src/core/Surface](#famous/src/core/Surface) so that they ultimately render | |
* onto the screen. A Surface's events are automatically piped to it's | |
* [famous/src/core/EventHandler](#famous/src/core/EventHandler), inherited from | |
* `Molecule`. | |
* | |
* @class Plane | |
* @extends Molecule | |
*/ | |
var Plane = (function (Molecule$$1) { | |
function Plane(initialOptions) { | |
Molecule$$1.call(this, initialOptions); | |
this.surface = new Surface_1(this.options); | |
this.add(this.surface); | |
this.surface.pipe(this.options.handler); | |
} | |
if ( Molecule$$1 ) Plane.__proto__ = Molecule$$1; | |
Plane.prototype = Object.create( Molecule$$1 && Molecule$$1.prototype ); | |
Plane.prototype.constructor = Plane; | |
/** | |
* Get the content of this Plane's [famous/src/core/Surface](#famous/src/core/Surface). | |
* See [famous/src/core/Surface.getContent](#famous/src/core/Surface.getContent). | |
*/ | |
Plane.prototype.getContent = function getContent () { | |
const args = Array.prototype.splice.call(arguments, 0); | |
return this.surface.getContent.apply(this.surface, args); | |
}; | |
/** | |
* Set the content of this Plane's [famous/src/core/Surface](#famous/src/core/Surface). | |
* See [famous/src/core/Surface.setContent](#famous/src/core/Surface.setContent). | |
*/ | |
Plane.prototype.setContent = function setContent () { | |
const args = Array.prototype.splice.call(arguments, 0); | |
return this.surface.setContent.apply(this.surface, args); | |
}; | |
return Plane; | |
}(Molecule)); | |
/* | |
* LICENSE | |
* | |
* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
* | |
*/ | |
/** | |
* A scenegraph tree who's two leaf nodes are [Plane](#Plane) instances facing | |
* opposite directions. For the purposes of these docs, in a brand new app with | |
* only a single `DoubleSidedPlane` added to the context, and having no | |
* rotation, "plane1" faces you and "plane2" faces away. | |
* | |
* @class DoubleSidedPlane | |
* @extends Molecule | |
*/ | |
var DoubleSidedPlane = (function (Molecule$$1) { | |
function DoubleSidedPlane(initialOptions) { | |
Molecule$$1.call(this, initialOptions); | |
this.children = []; | |
this.plane1 = new Plane(this.options); | |
this.plane1.transform.set(Transform_1.rotate(0,0,0)); | |
this.setOptions({properties: {background: 'orange'}}); | |
this.plane2 = new Plane(this.options); | |
this.plane2.transform.set(Transform_1.rotate(0,Math.PI,0)); | |
this.children.push(this.plane1); | |
this.children.push(this.plane2); | |
this.add(this.plane2); | |
this.add(this.plane1); | |
this.plane1.pipe(this.options.handler); | |
this.plane2.pipe(this.options.handler); | |
} | |
if ( Molecule$$1 ) DoubleSidedPlane.__proto__ = Molecule$$1; | |
DoubleSidedPlane.prototype = Object.create( Molecule$$1 && Molecule$$1.prototype ); | |
DoubleSidedPlane.prototype.constructor = DoubleSidedPlane; | |
/** | |
* Get the content of the [famous/src/core/Surface](#famous/src/core/Surface) of each [Plane](#Plane). | |
* | |
* @returns {Array} An array containing two items, the content of each | |
* `Plane`. The first item is from "plane1". | |
*/ | |
DoubleSidedPlane.prototype.getContent = function getContent () { | |
return [this.plane1.getContent(), this.plane2.getContent()]; | |
}; | |
/** | |
* Set the content of both [Plane](#Plane) instances. | |
* | |
* @param {Array} content An array of content, one item per `Plane`. The | |
* first item is for "plane1". | |
*/ | |
DoubleSidedPlane.prototype.setContent = function setContent (content) { | |
this.plane1.setContent(content[0]); | |
this.plane2.setContent(content[1]); | |
}; | |
return DoubleSidedPlane; | |
}(Molecule)); | |
/* | |
* LICENSE | |
* | |
* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
* | |
*/ | |
/** | |
* A calendar widget for selecting a date (WIP). | |
* | |
* @class Calendar | |
* @extends Molecule | |
*/ | |
var Calendar = (function (Molecule$$1) { | |
function Calendar(calendarSize, transition) { | |
Molecule$$1.call(this, {size: calendarSize}); | |
this.transition = transition; | |
this.flipSide = 0; // 0 means the initial front faces are showing, 1 means the initial back faces are showing. | |
this.columnsRows = [7,6]; | |
this.planes = []; | |
this._initializeTransitions(); | |
this._createGrid(); | |
setTimeout( function() { | |
this.transitions[this.transition](); | |
setInterval(this.transitions[this.transition], 2000); | |
}.bind(this) , 800); | |
} | |
if ( Molecule$$1 ) Calendar.__proto__ = Molecule$$1; | |
Calendar.prototype = Object.create( Molecule$$1 && Molecule$$1.prototype ); | |
Calendar.prototype.constructor = Calendar; | |
/** | |
* Creates the grid used for the layout of the day cells. | |
* | |
* @private | |
*/ | |
Calendar.prototype._createGrid = function _createGrid () { | |
const grid = new Grid(this.columnsRows[0], this.columnsRows[1], this.options.size); | |
forLength(this.columnsRows[0]*this.columnsRows[1], function(i) { | |
const plane = new DoubleSidedPlane({ | |
properties: { | |
background: 'teal', | |
} | |
}); | |
this.planes.push(plane); | |
}.bind(this)); | |
grid.setChildren(this.planes); | |
this.add(grid); | |
}; | |
/** | |
* Set up `this.transitions`, containing the available month-to-month | |
* transitions. | |
* | |
* @private | |
*/ | |
Calendar.prototype._initializeTransitions = function _initializeTransitions () { | |
this.transitions = { | |
flipDiagonal: function() { | |
this.flipSide = +!this.flipSide; | |
// determine which dimension of the grid is shorter and which is longer. | |
let shortest = 0; | |
let longest; | |
this.columnsRows.forEach(function(item, index) { | |
if (item < this.columnsRows[shortest]) | |
{ shortest = index; } | |
}.bind(this)); | |
longest = +!shortest; | |
// for each diagonal of the grid, flip those cells. | |
forLength(this.columnsRows[0]+this.columnsRows[1]-1, function(column) { | |
forLength(this.columnsRows[shortest], function(row) { | |
if (column-row >= 0 && column-row < this.columnsRows[longest]) { | |
const plane = this.planes[column-row + this.columnsRows[longest]*row]; | |
flipOne(plane, column); | |
} | |
}.bind(this)); | |
}.bind(this)); | |
function flipOne(item, column) { | |
if (typeof item.__targetRotation == 'undefined') { | |
item.__targetRotation = new Transitionable_1(0); | |
} | |
const rotation = new Transitionable_1(item.__targetRotation.get()); | |
item.__targetRotation.set(item.__targetRotation.get()+Math.PI); | |
//item.get().transformFrom(function() { | |
//return Transform.rotateY(rotation.get()); | |
//}); | |
item.children[0].get().transformFrom(function() { | |
return Transform_1.rotateY(rotation.get()); | |
}); | |
item.children[1].get().transformFrom(function() { | |
return Transform_1.rotateY(rotation.get()+Math.PI); | |
}); | |
setTimeout(function() { | |
rotation.set(item.__targetRotation.get(), { duration: 2000, curve: Easing_1.outExpo }); | |
}, 0+50*column); | |
} | |
}.bind(this) | |
}; | |
}; | |
return Calendar; | |
}(Molecule)); | |
var utils$1 = createCommonjsModule(function (module, exports) { | |
'use strict'; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
exports.clone = clone; | |
exports.isEmptyObject = isEmptyObject; | |
exports.toCSS = toCSS; | |
var stringify = JSON.stringify; | |
var parse = JSON.parse; | |
/** | |
* Deeply clone object using serialization. | |
* Expects object to be plain and without cyclic dependencies. | |
* | |
* http://jsperf.com/lodash-deepclone-vs-jquery-extend-deep/6 | |
* | |
* @type {Object} obj | |
* @return {Object} | |
*/ | |
function clone(obj) { | |
return parse(stringify(obj)); | |
} | |
/** | |
* Determine whether an object is empty or not. | |
* More performant than a `Object.keys(obj).length > 0` | |
* | |
* @type {Object} obj | |
* @return {Boolean} | |
*/ | |
function isEmptyObject(obj) { | |
for (var key in obj) { | |
return false; | |
} // eslint-disable-line no-unused-vars | |
return true; | |
} | |
/** | |
* Simple very fast UID generation based on a global counter. | |
*/ | |
var uid = exports.uid = function () { | |
var globalReference = typeof window == 'undefined' ? commonjsGlobal : window; | |
var namespace = '__JSS_VERSION_COUNTER__'; | |
if (globalReference[namespace] == null) { globalReference[namespace] = 0; } | |
// In case we have more than one jss version. | |
var versionCounter = globalReference[namespace]++; | |
var ruleCounter = 0; | |
/** | |
* Returns a uid. | |
* Ensures uniqueness if more than 1 jss version is used. | |
* | |
* @api public | |
* @return {String} | |
*/ | |
function get() { | |
return 'jss-' + versionCounter + '-' + ruleCounter++; | |
} | |
/** | |
* Resets the counter. | |
* | |
* @api public | |
*/ | |
function reset() { | |
ruleCounter = 0; | |
} | |
return { get: get, reset: reset }; | |
}(); | |
/** | |
* Indent a string. | |
* | |
* http://jsperf.com/array-join-vs-for | |
* | |
* @param {Number} level | |
* @param {String} str | |
* @return {String} | |
*/ | |
function indent(level, str) { | |
var indentStr = ''; | |
for (var index = 0; index < level; index++) { | |
indentStr += ' '; | |
}return indentStr + str; | |
} | |
/** | |
* Converts a Rule to CSS string. | |
* | |
* Options: | |
* - `selector` use `false` to get a rule without selector | |
* - `indentationLevel` level of indentation | |
* | |
* @param {String} selector | |
* @param {Object} style | |
* @param {Object} options | |
* @return {String} | |
*/ | |
function toCSS(selector, style) { | |
var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; | |
var indentationLevel = options.indentationLevel || 0; | |
var str = ''; | |
if (options.selector !== false) { | |
str += indent(indentationLevel, selector + ' {'); | |
indentationLevel++; | |
} | |
for (var prop in style) { | |
var value = style[prop]; | |
// We want to generate multiple style with identical property names. | |
if (Array.isArray(value)) { | |
for (var index = 0; index < value.length; index++) { | |
str += '\n' + indent(indentationLevel, prop + ': ' + value[index] + ';'); | |
} | |
} else { str += '\n' + indent(indentationLevel, prop + ': ' + value + ';'); } | |
} | |
if (options.selector !== false) { str += '\n' + indent(--indentationLevel, '}'); } | |
return str; | |
} | |
/** | |
* Get class names from a selector. | |
* | |
* @param {String} selector | |
* @return {String} | |
*/ | |
var findClassNames = exports.findClassNames = function () { | |
var dotsRegExp = /[.]/g; | |
var classesRegExp = /[.][^ ,]+/g; | |
return function (selector) { | |
var classes = selector.match(classesRegExp); | |
if (!classes) { return ''; } | |
return classes.join(' ').replace(dotsRegExp, ''); | |
}; | |
}(); | |
}); | |
var Rule_1 = createCommonjsModule(function (module, exports) { | |
'use strict'; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; | |
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) { descriptor.writable = true; } Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) { defineProperties(Constructor.prototype, protoProps); } if (staticProps) { defineProperties(Constructor, staticProps); } return Constructor; }; }(); | |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
/** | |
* Regular rules. | |
* | |
* @api public | |
*/ | |
var Rule = function () { | |
function Rule(selector, style, options) { | |
_classCallCheck(this, Rule); | |
this.id = utils$1.uid.get(); | |
this.type = 'regular'; | |
this.options = options; | |
this.selectorText = selector || ''; | |
this.className = options.className || ''; | |
this.originalStyle = style; | |
// We expect style to be plain object. | |
this.style = (0, utils$1.clone)(style); | |
if (options.named) { | |
this.name = selector; | |
if (!this.className) { | |
this.className = this.name ? this.name + '--' + this.id : this.id; | |
} | |
this.selectorText = '.' + this.className; | |
} | |
} | |
/** | |
* Set selector string. | |
* Attenition: use this with caution. Most browser didn't implement selector | |
* text setter, so this will result in rerendering of entire style sheet. | |
* | |
* @param {String} selector | |
* @api public | |
*/ | |
_createClass(Rule, [{ | |
key: 'prop', | |
/** | |
* Get or set a style property. | |
* | |
* @param {String} name | |
* @param {String|Number} [value] | |
* @return {Rule|String|Number} | |
* @api public | |
*/ | |
value: function prop(name, value) { | |
var style = this.options.Renderer.style; | |
// Its a setter. | |
if (value != null) { | |
this.style[name] = value; | |
// Only defined if option linked is true. | |
if (this.renderable) { style(this.renderable, name, value); } | |
return this; | |
} | |
// Its a getter, read the value from the DOM if its not cached. | |
if (this.renderable && this.style[name] == null) { | |
// Cache the value after we have got it from the DOM once. | |
this.style[name] = style(this.renderable, name); | |
} | |
return this.style[name]; | |
} | |
/** | |
* Apply rule to an element inline. | |
* | |
* @param {Element} renderable | |
* @return {Rule} | |
* @api public | |
*/ | |
}, { | |
key: 'applyTo', | |
value: function applyTo(renderable) { | |
var this$1 = this; | |
for (var prop in this$1.style) { | |
var value = this$1.style[prop]; | |
var style = this$1.options.Renderer.style; | |
if (Array.isArray(value)) { | |
for (var index = 0; index < value.length; index++) { | |
style(renderable, prop, value[index]); | |
} | |
} else { style(renderable, prop, value); } | |
} | |
return this; | |
} | |
/** | |
* Returns JSON representation of the rule. | |
* Array of values is not supported. | |
* | |
* @return {Object} | |
* @api public | |
*/ | |
}, { | |
key: 'toJSON', | |
value: function toJSON() { | |
var this$1 = this; | |
var style = Object.create(null); | |
for (var prop in this$1.style) { | |
if (_typeof(this$1.style[prop]) != 'object') { | |
style[prop] = this$1.style[prop]; | |
} | |
} | |
return style; | |
} | |
/** | |
* Generates a CSS string. | |
* | |
* @see toCSS | |
* @api public | |
*/ | |
}, { | |
key: 'toString', | |
value: function toString(options) { | |
return (0, utils$1.toCSS)(this.selector, this.style, options); | |
} | |
}, { | |
key: 'selector', | |
set: function set() { | |
var selector = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0]; | |
var _options = this.options; | |
var Renderer = _options.Renderer; | |
var sheet = _options.sheet; | |
// After we modify selector, ref by old selector needs to be removed. | |
if (sheet) { sheet.unregisterRule(this); } | |
this.selectorText = selector; | |
this.className = (0, utils$1.findClassNames)(selector); | |
if (!this.renderable) { | |
// Register the rule with new selector. | |
if (sheet) { sheet.registerRule(this); } | |
return; | |
} | |
var changed = Renderer.setSelector(this.renderable, selector); | |
if (changed) { | |
sheet.registerRule(this); | |
return; | |
} | |
// If selector setter is not implemented, rerender the sheet. | |
// We need to delete renderable from the rule, because when sheet.deploy() | |
// calls rule.toString, it will get the old selector. | |
delete this.renderable; | |
sheet.registerRule(this).deploy().link(); | |
} | |
/** | |
* Get selector string. | |
* | |
* @return {String} | |
* @api public | |
*/ | |
, | |
get: function get() { | |
if (this.renderable) { | |
return this.options.Renderer.getSelector(this.renderable); | |
} | |
return this.selectorText; | |
} | |
}]); | |
return Rule; | |
}(); | |
exports.default = Rule; | |
}); | |
var SimpleRule_1 = createCommonjsModule(function (module, exports) { | |
'use strict'; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) { descriptor.writable = true; } Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) { defineProperties(Constructor.prototype, protoProps); } if (staticProps) { defineProperties(Constructor, staticProps); } return Constructor; }; }(); | |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
/** | |
* Rule like @charset, @import, @namespace. | |
* | |
* @api public | |
*/ | |
var SimpleRule = function () { | |
function SimpleRule(name, value, options) { | |
_classCallCheck(this, SimpleRule); | |
this.id = utils$1.uid.get(); | |
this.type = 'simple'; | |
this.name = name; | |
this.value = value; | |
this.options = options; | |
} | |
/** | |
* Generates a CSS string. | |
* | |
* @return {String} | |
* @api public | |
*/ | |
_createClass(SimpleRule, [{ | |
key: 'toString', | |
value: function toString() { | |
var this$1 = this; | |
if (Array.isArray(this.value)) { | |
var str = ''; | |
for (var index = 0; index < this.value.length; index++) { | |
str += this$1.name + ' ' + this$1.value[index] + ';'; | |
if (this$1.value[index + 1]) { str += '\n'; } | |
} | |
return str; | |
} | |
return this.name + ' ' + this.value + ';'; | |
} | |
}]); | |
return SimpleRule; | |
}(); | |
exports.default = SimpleRule; | |
}); | |
var KeyframeRule_1 = createCommonjsModule(function (module, exports) { | |
'use strict'; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
var _extends = Object.assign || function (target) { | |
var arguments$1 = arguments; | |
for (var i = 1; i < arguments.length; i++) { var source = arguments$1[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | |
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) { descriptor.writable = true; } Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) { defineProperties(Constructor.prototype, protoProps); } if (staticProps) { defineProperties(Constructor, staticProps); } return Constructor; }; }(); | |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
/** | |
* Keyframe rule. | |
* | |
* @api private | |
*/ | |
var KeyframeRule = function () { | |
function KeyframeRule(selector, frames, options) { | |
_classCallCheck(this, KeyframeRule); | |
this.id = utils$1.uid.get(); | |
this.type = 'keyframe'; | |
this.selector = selector; | |
this.options = options; | |
this.frames = this.formatFrames(frames); | |
} | |
/** | |
* Creates formatted frames where every frame value is a rule instance. | |
* | |
* @api private | |
*/ | |
_createClass(KeyframeRule, [{ | |
key: 'formatFrames', | |
value: function formatFrames(frames) { | |
var this$1 = this; | |
var newFrames = Object.create(null); | |
for (var name in frames) { | |
var options = _extends({}, this$1.options, { named: false, parent: this$1 }); | |
newFrames[name] = this$1.options.jss.createRule(name, frames[name], options); | |
} | |
return newFrames; | |
} | |
/** | |
* Generates a CSS string. | |
* | |
* @return {String} | |
* @api private | |
*/ | |
}, { | |
key: 'toString', | |
value: function toString() { | |
var this$1 = this; | |
var str = this.selector + ' {\n'; | |
var options = { indentationLevel: 1 }; | |
for (var name in this$1.frames) { | |
str += this$1.frames[name].toString(options) + '\n'; | |
} | |
str += '}'; | |
return str; | |
} | |
}]); | |
return KeyframeRule; | |
}(); | |
exports.default = KeyframeRule; | |
}); | |
var ConditionalRule_1 = createCommonjsModule(function (module, exports) { | |
'use strict'; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
var _extends = Object.assign || function (target) { | |
var arguments$1 = arguments; | |
for (var i = 1; i < arguments.length; i++) { var source = arguments$1[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | |
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) { descriptor.writable = true; } Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) { defineProperties(Constructor.prototype, protoProps); } if (staticProps) { defineProperties(Constructor, staticProps); } return Constructor; }; }(); | |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
/** | |
* Conditional rule for @media, @supports | |
* | |
* @api public | |
*/ | |
var ConditionalRule = function () { | |
function ConditionalRule(selector, styles, options) { | |
var this$1 = this; | |
_classCallCheck(this, ConditionalRule); | |
this.id = utils$1.uid.get(); | |
this.type = 'conditional'; | |
this.selector = selector; | |
this.options = options; | |
this.rules = Object.create(null); | |
for (var name in styles) { | |
this$1.createRule(name, styles[name]); | |
} | |
} | |
/** | |
* A conditional rule always contains child rules. | |
* | |
* @param {Object} styles | |
* @return {Array} rules | |
* @api public | |
*/ | |
_createClass(ConditionalRule, [{ | |
key: 'createRule', | |
value: function createRule(name, style, options) { | |
var newOptions = _extends({}, this.options, { parent: this }); | |
var _newOptions = newOptions; | |
var sheet = _newOptions.sheet; | |
var jss = _newOptions.jss; | |
// We have already a rule in the current style sheet with this name, | |
// This new rule is supposed to overwrite the first one, for this we need | |
// to ensure it will have the same className/selector. | |
var existingRule = sheet && sheet.getRule(name); | |
var className = existingRule ? existingRule.className : null; | |
if (className || options) { | |
newOptions = _extends({}, newOptions, { className: className }, options); | |
} | |
var rule = (sheet || jss).createRule(name, style, newOptions); | |
this.rules[name] = rule; | |
return rule; | |
} | |
/** | |
* Generates a CSS string. | |
* | |
* @return {String} | |
* @api public | |
*/ | |
}, { | |
key: 'toString', | |
value: function toString() { | |
var this$1 = this; | |
var str = this.selector + ' {\n'; | |
for (var name in this$1.rules) { | |
var rule = this$1.rules[name]; | |
if (rule.style && (0, utils$1.isEmptyObject)(rule.style)) { | |
continue; | |
} | |
var ruleStr = rule.toString({ indentationLevel: 1 }); | |
str += ruleStr + '\n'; | |
} | |
str += '}'; | |
return str; | |
} | |
}]); | |
return ConditionalRule; | |
}(); | |
exports.default = ConditionalRule; | |
}); | |
var FontFaceRule = createCommonjsModule(function (module, exports) { | |
'use strict'; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) { descriptor.writable = true; } Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) { defineProperties(Constructor.prototype, protoProps); } if (staticProps) { defineProperties(Constructor, staticProps); } return Constructor; }; }(); | |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
/** | |
* Font-face rules. | |
* | |
* @api public | |
*/ | |
var Rule = function () { | |
function Rule(selector, style, options) { | |
_classCallCheck(this, Rule); | |
this.id = utils$1.uid.get(); | |
this.type = 'font-face'; | |
this.options = options; | |
this.selector = selector; | |
this.style = style; | |
} | |
/** | |
* Generates a CSS string. | |
* | |
* @see toCSS | |
* @api public | |
*/ | |
_createClass(Rule, [{ | |
key: 'toString', | |
value: function toString(options) { | |
var this$1 = this; | |
if (Array.isArray(this.style)) { | |
var str = ''; | |
for (var index = 0; index < this.style.length; index++) { | |
str += (0, utils$1.toCSS)(this$1.selector, this$1.style[index], options); | |
if (this$1.style[index + 1]) { str += '\n'; } | |
} | |
return str; | |
} | |
return (0, utils$1.toCSS)(this.selector, this.style, options); | |
} | |
}]); | |
return Rule; | |
}(); | |
exports.default = Rule; | |
}); | |
var createRule_1 = createCommonjsModule(function (module, exports) { | |
'use strict'; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
exports.default = createRule; | |
var _Rule2 = _interopRequireDefault(Rule_1); | |
var _SimpleRule2 = _interopRequireDefault(SimpleRule_1); | |
var _KeyframeRule2 = _interopRequireDefault(KeyframeRule_1); | |
var _ConditionalRule2 = _interopRequireDefault(ConditionalRule_1); | |
var _FontFaceRule2 = _interopRequireDefault(FontFaceRule); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | |
/** | |
* Map of at rules to corresponding implementation class. | |
* | |
* @type {Object} | |
*/ | |
var atRuleClassMap = { | |
'@charset': _SimpleRule2.default, | |
'@import': _SimpleRule2.default, | |
'@namespace': _SimpleRule2.default, | |
'@keyframes': _KeyframeRule2.default, | |
'@media': _ConditionalRule2.default, | |
'@supports': _ConditionalRule2.default, | |
'@font-face': _FontFaceRule2.default | |
}; | |
var atRuleNameRegExp = /^@[^ ]+/; | |
/** | |
* Create rule factory. | |
* | |
* @param {Object} [selector] if you don't pass selector - it will be generated | |
* @param {Object} [style] declarations block | |
* @param {Object} [options] rule options | |
* @return {Object} rule | |
* @api private | |
*/ | |
function createRule(selector) { | |
var style = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | |
var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; | |
// Is an at-rule. | |
if (selector && selector[0] === '@') { | |
var name = atRuleNameRegExp.exec(selector)[0]; | |
var AtRule = atRuleClassMap[name]; | |
return new AtRule(selector, style, options); | |
} | |
if (options.named == null) { options.named = true; } | |
return new _Rule2.default(selector, style, options); | |
} | |
}); | |
var DomRenderer_1 = createCommonjsModule(function (module, exports) { | |
'use strict'; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) { descriptor.writable = true; } Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) { defineProperties(Constructor.prototype, protoProps); } if (staticProps) { defineProperties(Constructor, staticProps); } return Constructor; }; }(); | |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
/** | |
* DOM rendering backend for StyleSheet. | |
* | |
* @api private | |
*/ | |
var DomRenderer = function () { | |
_createClass(DomRenderer, null, [{ | |
key: 'style', | |
value: function style(element, name, value) { | |
try { | |
if (value == null) { return element.style[name]; } | |
element.style[name] = value; | |
} catch (err) { | |
// IE8 may throw if property is unknown. | |
return false; | |
} | |
return true; | |
} | |
}, { | |
key: 'setSelector', | |
value: function setSelector(cssRule, selector) { | |
cssRule.selectorText = selector; | |
// Return false if setter was not successful. | |
// Currently works in chrome only. | |
return cssRule.selectorText === selector; | |
} | |
}, { | |
key: 'getSelector', | |
value: function getSelector(cssRule) { | |
return cssRule.selectorText; | |
} | |
}]); | |
function DomRenderer(options) { | |
_classCallCheck(this, DomRenderer); | |
this.head = document.head || document.getElementsByTagName('head')[0]; | |
this.element = options.element || document.createElement('style'); | |
// IE8 will not have `styleSheet` prop without `type and `styleSheet.cssText` | |
// is the only way to render on IE8. | |
this.element.type = 'text/css'; | |
if (options.media) { this.element.setAttribute('media', options.media); } | |
if (options.meta) { this.element.setAttribute('data-meta', options.meta); } | |
} | |
/** | |
* Insert style element into render tree. | |
* | |
* @api private | |
*/ | |
_createClass(DomRenderer, [{ | |
key: 'attach', | |
value: function attach() { | |
if (this.element.parendNode) { return; } | |
this.head.appendChild(this.element); | |
} | |
/** | |
* Remove style element from render tree. | |
* | |
* @api private | |
*/ | |
}, { | |
key: 'detach', | |
value: function detach() { | |
this.element.parentNode.removeChild(this.element); | |
} | |
/** | |
* Inject CSS string into element. | |
* | |
* @param {String} cssStr | |
* @api private | |
*/ | |
}, { | |
key: 'deploy', | |
value: function deploy(sheet) { | |
var css = '\n' + sheet.toString() + '\n'; | |
if ('sheet' in this.element) { this.element.innerHTML = css; } | |
// On IE8 the only way to render is `styleSheet.cssText`. | |
else if ('styleSheet' in this.element) { this.element.styleSheet.cssText = css; } | |
} | |
/** | |
* Insert a rule into element. | |
* | |
* @param {Rule} rule | |
* @return {CSSStyleRule} | |
* @api private | |
*/ | |
}, { | |
key: 'insertRule', | |
value: function insertRule(rule) { | |
// IE8 has only `styleSheet` and `styleSheet.rules` | |
var sheet = this.element.sheet || this.element.styleSheet; | |
var cssRules = sheet.cssRules || sheet.rules; | |
var nextIndex = cssRules.length; | |
if (sheet.insertRule) { sheet.insertRule(rule.toString(), nextIndex); }else { sheet.addRule(rule.selector, rule.toString({ selector: false }), nextIndex); } | |
return cssRules[nextIndex]; | |
} | |
/** | |
* Get all rules elements. | |
* | |
* @return {Object} rules map, where key is selector, CSSStyleRule is value. | |
* @api private | |
*/ | |
}, { | |
key: 'getRules', | |
value: function getRules() { | |
// IE8 has only `styleSheet` and `styleSheet.rules` | |
var sheet = this.element.sheet || this.element.styleSheet; | |
var cssRules = sheet.rules || sheet.cssRules; | |
var rules = Object.create(null); | |
for (var index = 0; index < cssRules.length; index++) { | |
var cssRule = cssRules[index]; | |
rules[cssRule.selectorText] = cssRule; | |
} | |
return rules; | |
} | |
}]); | |
return DomRenderer; | |
}(); | |
exports.default = DomRenderer; | |
}); | |
var VirtualRenderer_1 = createCommonjsModule(function (module, exports) { | |
"use strict"; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) { descriptor.writable = true; } Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) { defineProperties(Constructor.prototype, protoProps); } if (staticProps) { defineProperties(Constructor, staticProps); } return Constructor; }; }(); | |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
/** | |
* Rendering backend to do nothing in nodejs. | |
*/ | |
var VirtualRenderer = function () { | |
function VirtualRenderer() { | |
_classCallCheck(this, VirtualRenderer); | |
} | |
_createClass(VirtualRenderer, [{ | |
key: "attach", | |
value: function attach() {} | |
}, { | |
key: "detach", | |
value: function detach() {} | |
}, { | |
key: "deploy", | |
value: function deploy() {} | |
}, { | |
key: "insertRule", | |
value: function insertRule() {} | |
}, { | |
key: "getRules", | |
value: function getRules() { | |
return {}; | |
} | |
}], [{ | |
key: "style", | |
value: function style() {} | |
}, { | |
key: "setSelector", | |
value: function setSelector() {} | |
}, { | |
key: "getSelector", | |
value: function getSelector() {} | |
}]); | |
return VirtualRenderer; | |
}(); | |
exports.default = VirtualRenderer; | |
}); | |
var findRenderer_1 = createCommonjsModule(function (module, exports) { | |
'use strict'; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
exports.default = findRenderer; | |
var _DomRenderer2 = _interopRequireDefault(DomRenderer_1); | |
var _VirtualRenderer2 = _interopRequireDefault(VirtualRenderer_1); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | |
/** | |
* Find proper renderer. | |
* Option `virtual` is used to force use of VirtualRenderer even if DOM is | |
* detected, used for testing only. | |
* | |
* @param {Object} options | |
* @return {Renderer} | |
* @api private | |
*/ | |
function findRenderer() { | |
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | |
if (options.Renderer) { return options.Renderer; } | |
return options.virtual || typeof document == 'undefined' ? _VirtualRenderer2.default : _DomRenderer2.default; | |
} | |
}); | |
var StyleSheet_1 = createCommonjsModule(function (module, exports) { | |
'use strict'; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
var _extends = Object.assign || function (target) { | |
var arguments$1 = arguments; | |
for (var i = 1; i < arguments.length; i++) { var source = arguments$1[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | |
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) { descriptor.writable = true; } Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) { defineProperties(Constructor.prototype, protoProps); } if (staticProps) { defineProperties(Constructor, staticProps); } return Constructor; }; }(); | |
var _createRule3 = _interopRequireDefault(createRule_1); | |
var _findRenderer2 = _interopRequireDefault(findRenderer_1); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
/** | |
* StyleSheet model. | |
* | |
* Options: | |
* | |
* - `media` media query - attribute of style element. | |
* - `meta` meta information about this style - attribute of style element, for e.g. you could pass | |
* component name for easier debugging. | |
* - `named` true by default - keys are names, selectors will be generated, if false - keys are | |
* global selectors. | |
* - `link` link jss `Rule` instances with DOM `CSSRule` instances so that styles, can be modified | |
* dynamically, false by default because it has some performance cost. | |
* - `element` style element, will create one by default | |
* | |
* @param {Object} [rules] object with selectors and declarations | |
* @param {Object} [options] | |
* @api public | |
*/ | |
var StyleSheet = function () { | |
function StyleSheet(rules, options) { | |
var this$1 = this; | |
_classCallCheck(this, StyleSheet); | |
this.options = _extends({}, options); | |
if (this.options.named == null) { this.options.named = true; } | |
this.rules = Object.create(null); | |
this.classes = Object.create(null); | |
this.attached = false; | |
this.deployed = false; | |
this.linked = false; | |
var Renderer = (0, _findRenderer2.default)(this.options); | |
this.options.Renderer = Renderer; | |
this.renderer = new Renderer(this.options); | |
for (var name in rules) { | |
this$1.createRule(name, rules[name]); | |
} | |
} | |
/** | |
* Attach renderable to the render tree. | |
* | |
* @api public | |
* @return {StyleSheet} | |
*/ | |
_createClass(StyleSheet, [{ | |
key: 'attach', | |
value: function attach() { | |
if (this.attached) { return this; } | |
if (!this.deployed) { this.deploy(); } | |
this.renderer.attach(); | |
if (!this.linked && this.options.link) { this.link(); } | |
this.attached = true; | |
return this; | |
} | |
/** | |
* Remove renderable from render tree. | |
* | |
* @return {StyleSheet} | |
* @api public | |
*/ | |
}, { | |
key: 'detach', | |
value: function detach() { | |
if (!this.attached) { return this; } | |
this.renderer.detach(); | |
this.attached = false; | |
return this; | |
} | |
/** | |
* Add a rule to the current stylesheet. Will insert a rule also after the stylesheet | |
* has been rendered first time. | |
* | |
* @param {Object} [name] can be selector or name if ´options.named is true | |
* @param {Object} style property/value hash | |
* @return {Rule} | |
* @api public | |
*/ | |
}, { | |
key: 'addRule', | |
value: function addRule(name, style) { | |
var rule = this.createRule(name, style); | |
// Don't insert rule directly if there is no stringified version yet. | |
// It will be inserted all together when .attach is called. | |
if (this.deployed) { | |
var renderable = this.renderer.insertRule(rule); | |
if (this.options.link) { rule.renderable = renderable; } | |
} | |
return rule; | |
} | |
/** | |
* Create rules, will render also after stylesheet was rendered the first time. | |
* | |
* @param {Object} rules name:style hash. | |
* @return {Array} array of added rules | |
* @api public | |
*/ | |
}, { | |
key: 'addRules', | |
value: function addRules(rules) { | |
var this$1 = this; | |
var added = []; | |
for (var name in rules) { | |
added.push(this$1.addRule(name, rules[name])); | |
} | |
return added; | |
} | |
/** | |
* Get a rule. | |
* | |
* @param {String} name can be selector or name if `named` option is true. | |
* @return {Rule} | |
* @api public | |
*/ | |
}, { | |
key: 'getRule', | |
value: function getRule(name) { | |
return this.rules[name]; | |
} | |
/** | |
* Convert rules to a CSS string. | |
* | |
* @param {Object} options | |
* @return {String} | |
* @api public | |
*/ | |
}, { | |
key: 'toString', | |
value: function toString(options) { | |
var rules = this.rules; | |
var stringified = Object.create(null); | |
var str = ''; | |
for (var name in rules) { | |
var rule = rules[name]; | |
// We have the same rule referenced twice if using named rules. | |
// By name and by selector. | |
if (stringified[rule.id]) { | |
continue; | |
} | |
if (rule.style && (0, utils$1.isEmptyObject)(rule.style)) { | |
continue; | |
} | |
if (rule.rules && (0, utils$1.isEmptyObject)(rule.rules)) { | |
continue; | |
} | |
if (str) { str += '\n'; } | |
str += rule.toString(options); | |
stringified[rule.id] = true; | |
} | |
return str; | |
} | |
/** | |
* Create a rule, will not render after stylesheet was rendered the first time. | |
* Will link the rule in `this.rules`. | |
* | |
* @see createRule | |
* @api private | |
*/ | |
}, { | |
key: 'createRule', | |
value: function createRule(name, style, options) { | |
options = _extends({}, options, { | |
sheet: this, | |
jss: this.options.jss, | |
Renderer: this.options.Renderer | |
}); | |
// Scope options overwrite instance options. | |
if (options.named == null) { options.named = this.options.named; } | |
var rule = (0, _createRule3.default)(name, style, options); | |
this.registerRule(rule); | |
options.jss.plugins.run(rule); | |
return rule; | |
} | |
/** | |
* Register a rule in `sheet.rules` and `sheet.classes` maps. | |
* | |
* @param {Rule} rule | |
* @api public | |
*/ | |
}, { | |
key: 'registerRule', | |
value: function registerRule(rule) { | |
// Children of container rules should not be registered. | |
if (rule.options.parent) { | |
// We need to register child rules of conditionals in classes, otherwise | |
// user can't access generated class name if it doesn't overrides | |
// a regular rule. | |
if (rule.name && rule.className) { | |
this.classes[rule.name] = rule.className; | |
} | |
return this; | |
} | |
if (rule.name) { | |
this.rules[rule.name] = rule; | |
if (rule.className) { this.classes[rule.name] = rule.className; } | |
} | |
if (rule.selector) { | |
this.rules[rule.selector] = rule; | |
} | |
return this; | |
} | |
/** | |
* Unregister a rule. | |
* | |
* @param {Rule} rule | |
* @api public | |
*/ | |
}, { | |
key: 'unregisterRule', | |
value: function unregisterRule(rule) { | |
// Children of a conditional rule are not registered. | |
if (!rule.options.parent) { | |
delete this.rules[rule.name]; | |
delete this.rules[rule.selector]; | |
} | |
delete this.classes[rule.name]; | |
return this; | |
} | |
/** | |
* Deploy pure CSS string to a renderable. | |
* | |
* @return {StyleSheet} | |
* @api private | |
*/ | |
}, { | |
key: 'deploy', | |
value: function deploy() { | |
this.renderer.deploy(this); | |
this.deployed = true; | |
return this; | |
} | |
/** | |
* Link renderable CSS rules with their corresponding models. | |
* | |
* @return {StyleSheet} | |
* @api private | |
*/ | |
}, { | |
key: 'link', | |
value: function link() { | |
var this$1 = this; | |
var renderables = this.renderer.getRules(); | |
for (var selector in renderables) { | |
var rule = this$1.rules[selector]; | |
if (rule) { rule.renderable = renderables[selector]; } | |
} | |
this.linked = true; | |
return this; | |
} | |
}]); | |
return StyleSheet; | |
}(); | |
exports.default = StyleSheet; | |
}); | |
var PluginsRegistry_1 = createCommonjsModule(function (module, exports) { | |
"use strict"; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) { descriptor.writable = true; } Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) { defineProperties(Constructor.prototype, protoProps); } if (staticProps) { defineProperties(Constructor, staticProps); } return Constructor; }; }(); | |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
/** | |
* Register a plugin, run a plugin. | |
* | |
* @api public | |
*/ | |
var PluginsRegistry = function () { | |
function PluginsRegistry() { | |
_classCallCheck(this, PluginsRegistry); | |
this.registry = []; | |
} | |
/** | |
* Register plugin. Passed function will be invoked with a rule instance. | |
* | |
* @param {Function} fn | |
* @api public | |
*/ | |
_createClass(PluginsRegistry, [{ | |
key: "use", | |
value: function use(fn) { | |
this.registry.push(fn); | |
} | |
/** | |
* Execute all registered plugins. | |
* | |
* @param {Rule} rule | |
* @api private | |
*/ | |
}, { | |
key: "run", | |
value: function run(rule) { | |
var this$1 = this; | |
for (var index = 0; index < this.registry.length; index++) { | |
this$1.registry[index](rule); | |
} | |
} | |
}]); | |
return PluginsRegistry; | |
}(); | |
exports.default = PluginsRegistry; | |
}); | |
var SheetsRegistry_1 = createCommonjsModule(function (module, exports) { | |
'use strict'; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) { descriptor.writable = true; } Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) { defineProperties(Constructor.prototype, protoProps); } if (staticProps) { defineProperties(Constructor, staticProps); } return Constructor; }; }(); | |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
/** | |
* Sheets registry to access them all at one place. | |
* | |
* @api public | |
*/ | |
var SheetsRegistry = function () { | |
function SheetsRegistry() { | |
_classCallCheck(this, SheetsRegistry); | |
this.registry = []; | |
} | |
/** | |
* Register a style sheet. | |
* | |
* @param {StyleSheet} sheet | |
* @api public | |
*/ | |
_createClass(SheetsRegistry, [{ | |
key: 'add', | |
value: function add(sheet) { | |
this.registry.push(sheet); | |
} | |
/** | |
* Returns CSS string with all Style Sheets. | |
* | |
* @param {StyleSheet} sheet | |
* @api public | |
*/ | |
}, { | |
key: 'toString', | |
value: function toString(options) { | |
return this.registry.map(function (sheet) { | |
return sheet.toString(options); | |
}).join('\n'); | |
} | |
}]); | |
return SheetsRegistry; | |
}(); | |
exports.default = SheetsRegistry; | |
}); | |
var Jss_1 = createCommonjsModule(function (module, exports) { | |
'use strict'; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; | |
var _extends = Object.assign || function (target) { | |
var arguments$1 = arguments; | |
for (var i = 1; i < arguments.length; i++) { var source = arguments$1[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | |
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) { descriptor.writable = true; } Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) { defineProperties(Constructor.prototype, protoProps); } if (staticProps) { defineProperties(Constructor, staticProps); } return Constructor; }; }(); | |
var _StyleSheet2 = _interopRequireDefault(StyleSheet_1); | |
var _PluginsRegistry2 = _interopRequireDefault(PluginsRegistry_1); | |
var _SheetsRegistry2 = _interopRequireDefault(SheetsRegistry_1); | |
var _createRule3 = _interopRequireDefault(createRule_1); | |
var _findRenderer2 = _interopRequireDefault(findRenderer_1); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
/** | |
* Main Jss class. | |
* | |
* @api public | |
*/ | |
var Jss = function () { | |
function Jss() { | |
_classCallCheck(this, Jss); | |
this.sheets = new _SheetsRegistry2.default(); | |
this.plugins = new _PluginsRegistry2.default(); | |
this.uid = utils$1.uid; | |
this.version = '3.11.1'; | |
} | |
/** | |
* Creates a new instance of Jss. | |
* | |
* @see Jss | |
* @api public | |
*/ | |
_createClass(Jss, [{ | |
key: 'create', | |
value: function create() { | |
return new Jss(); | |
} | |
/** | |
* Create a stylesheet. | |
* | |
* @see StyleSheet | |
* @api public | |
*/ | |
}, { | |
key: 'createStyleSheet', | |
value: function createStyleSheet(rules, options) { | |
var sheet = new _StyleSheet2.default(rules, _extends({}, options, { jss: this })); | |
this.sheets.add(sheet); | |
return sheet; | |
} | |
/** | |
* Create a rule. | |
* | |
* @see createRule | |
* @api public | |
*/ | |
}, { | |
key: 'createRule', | |
value: function createRule(selector, style, options) { | |
// Enable rule without selector. | |
if ((typeof selector === 'undefined' ? 'undefined' : _typeof(selector)) == 'object') { | |
options = style; | |
style = selector; | |
selector = null; | |
} | |
var rule = (0, _createRule3.default)(selector, style, _extends({}, options, { | |
jss: this, | |
Renderer: (0, _findRenderer2.default)(options) | |
})); | |
this.plugins.run(rule); | |
return rule; | |
} | |
/** | |
* Register plugin. Passed function will be invoked with a rule instance. | |
* | |
* @param {Function} plugins | |
* @api public | |
*/ | |
}, { | |
key: 'use', | |
value: function use() { | |
var arguments$1 = arguments; | |
var _this = this; | |
for (var _len = arguments.length, plugins = Array(_len), _key = 0; _key < _len; _key++) { | |
plugins[_key] = arguments$1[_key]; | |
} | |
plugins.forEach(function (plugin) { | |
return _this.plugins.use(plugin); | |
}); | |
return this; | |
} | |
}]); | |
return Jss; | |
}(); | |
exports.default = Jss; | |
}); | |
var lib = createCommonjsModule(function (module, exports) { | |
'use strict'; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
exports.Rule = exports.StyleSheet = exports.Jss = undefined; | |
var _Jss2 = _interopRequireDefault(Jss_1); | |
var _StyleSheet2 = _interopRequireDefault(StyleSheet_1); | |
var _Rule2 = _interopRequireDefault(Rule_1); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | |
var jss = new _Jss2.default(); | |
// Hotfix for babel 5 migration, will be removed in version 4.0.0 | |
/** | |
* StyleSheets written in javascript. | |
* | |
* @copyright Oleg Slobodskoi 2014-2016 | |
* @website https://github.com/jsstyles/jss | |
* @license MIT | |
*/ | |
module.exports = exports = jss; | |
// For testing only. | |
exports.Jss = _Jss2.default; | |
exports.StyleSheet = _StyleSheet2.default; | |
exports.Rule = _Rule2.default; | |
exports.default = jss; | |
}); | |
var Jss = unwrapExports(lib); | |
var lib$1 = createCommonjsModule(function (module, exports) { | |
'use strict'; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
var _extends = Object.assign || function (target) { | |
var arguments$1 = arguments; | |
for (var i = 1; i < arguments.length; i++) { var source = arguments$1[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | |
exports.default = jssNested; | |
var regExp = /&/g; | |
/** | |
* Convert nested rules to separate, remove them from original styles. | |
* | |
* @param {Rule} rule | |
* @api public | |
*/ | |
function jssNested() { | |
return function (rule) { | |
if (rule.type !== 'regular') { return; } | |
var _rule$options = rule.options; | |
var sheet = _rule$options.sheet; | |
var jss = _rule$options.jss; | |
var parent = _rule$options.parent; | |
var container = sheet || jss; | |
var options = void 0; | |
if (parent && parent.type === 'conditional') { | |
container = parent; | |
} | |
for (var prop in rule.style) { | |
if (prop[0] === '&') { | |
if (!options) { options = _extends({}, rule.options, { named: false }); } | |
var name = prop.replace(regExp, rule.selector); | |
container.createRule(name, rule.style[prop], options); | |
delete rule.style[prop]; | |
} | |
} | |
}; | |
} | |
}); | |
var jssNested = unwrapExports(lib$1); | |
var lib$2 = createCommonjsModule(function (module, exports) { | |
'use strict'; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
exports.default = jssExtend; | |
/** | |
* Handle `extend` property. | |
* | |
* @param {Rule} rule | |
* @api public | |
*/ | |
function jssExtend() { | |
function extend(rule, newStyle, style) { | |
if (typeof style.extend == 'string') { | |
if (rule.options && rule.options.sheet) { | |
var refRule = rule.options.sheet.getRule(style.extend); | |
if (refRule) { extend(rule, newStyle, refRule.originalStyle); } | |
} | |
} else if (Array.isArray(style.extend)) { | |
for (var index = 0; index < style.extend.length; index++) { | |
extend(rule, newStyle, style.extend[index]); | |
} | |
} else { | |
for (var prop in style.extend) { | |
if (prop === 'extend') { extend(rule, newStyle, style.extend.extend); }else { newStyle[prop] = style.extend[prop]; } | |
} | |
} | |
// Copy base style. | |
for (var _prop in style) { | |
if (_prop !== 'extend') { newStyle[_prop] = style[_prop]; } | |
} | |
return newStyle; | |
} | |
return function (rule) { | |
if (!rule.style || !rule.style.extend) { return; } | |
rule.style = extend(rule, {}, rule.style); | |
}; | |
} | |
}); | |
var jssExtend = unwrapExports(lib$2); | |
var lib$3 = createCommonjsModule(function (module, exports) { | |
// Don't automatically add 'px' to these possibly-unitless properties. | |
// Borrowed from jquery. | |
'use strict'; | |
exports.__esModule = true; | |
exports['default'] = jssPx; | |
var cssNumber = { | |
'animation-iteration-count': true, | |
'box-ordinal-group': true, | |
'column-count': true, | |
'fill-opacity': true, | |
'flex': true, | |
'flex-grow': true, | |
'flex-order': true, | |
'flex-shrink': true, | |
'font-weight': true, | |
'line-height': true, | |
'opacity': true, | |
'order': true, | |
'orphans': true, | |
'stop-opacity': true, | |
'tab-size': 1, | |
'widows': true, | |
'z-index': true, | |
'zoom': true | |
}; | |
/** | |
* Add px to numeric values. | |
* | |
* @param {Rule} rule | |
* @api public | |
*/ | |
function jssPx() { | |
return function (rule) { | |
var style = rule.style; | |
if (!style) { return; } | |
for (var prop in style) { | |
if (!cssNumber[prop] && typeof style[prop] == 'number') { | |
style[prop] += 'px'; | |
} | |
} | |
}; | |
} | |
module.exports = exports['default']; | |
}); | |
var jssPx = unwrapExports(lib$3); | |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | |
var isBrowser = (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object" && (typeof document === "undefined" ? "undefined" : _typeof(document)) === 'object' && document.nodeType === 9; | |
var module$1 = Object.freeze({ | |
isBrowser: isBrowser, | |
default: isBrowser | |
}); | |
var _isInBrowser = ( module$1 && isBrowser ) || module$1; | |
var prefix = createCommonjsModule(function (module, exports) { | |
'use strict'; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
var _isInBrowser2 = _interopRequireDefault(_isInBrowser); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | |
var js = ''; /** | |
* Export javascript style and css style vendor prefixes. | |
* Based on "transform" support test. | |
*/ | |
var css = ''; | |
// We should not do anything if required serverside. | |
if (_isInBrowser2['default']) { | |
// Order matters. We need to check Webkit the last one because | |
// other vendors use to add Webkit prefixes to some properties | |
var jsCssMap = { | |
Moz: '-moz-', | |
// IE did it wrong again ... | |
ms: '-ms-', | |
O: '-o-', | |
Webkit: '-webkit-' | |
}; | |
var style = document.createElement('p').style; | |
var testProp = 'Transform'; | |
for (var key in jsCssMap) { | |
if (key + testProp in style) { | |
js = key; | |
css = jsCssMap[key]; | |
break; | |
} | |
} | |
} | |
/** | |
* Vendor prefix string for the current browser. | |
* | |
* @type {{js: String, css: String}} | |
* @api public | |
*/ | |
exports['default'] = { js: js, css: css }; | |
}); | |
var camelize_1 = createCommonjsModule(function (module, exports) { | |
'use strict'; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
exports['default'] = camelize; | |
var regExp = /[-\s]+(.)?/g; | |
/** | |
* Convert dash separated strings to camel cased. | |
* | |
* @param {String} str | |
* @return {String} | |
*/ | |
function camelize(str) { | |
return str.replace(regExp, toUpper); | |
} | |
function toUpper(match, c) { | |
return c ? c.toUpperCase() : ''; | |
} | |
}); | |
var supportedProperty_1 = createCommonjsModule(function (module, exports) { | |
'use strict'; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
exports['default'] = supportedProperty; | |
var _isInBrowser2 = _interopRequireDefault(_isInBrowser); | |
var _prefix2 = _interopRequireDefault(prefix); | |
var _camelize2 = _interopRequireDefault(camelize_1); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | |
var el = void 0; | |
var cache = {}; | |
if (_isInBrowser2['default']) { | |
el = document.createElement('p'); | |
/** | |
* We test every property on vendor prefix requirement. | |
* Once tested, result is cached. It gives us up to 70% perf boost. | |
* http://jsperf.com/element-style-object-access-vs-plain-object | |
* | |
* Prefill cache with known css properties to reduce amount of | |
* properties we need to feature test at runtime. | |
* http://davidwalsh.name/vendor-prefix | |
*/ | |
var computed = window.getComputedStyle(document.documentElement, ''); | |
for (var key in computed) { | |
if (!isNaN(key)) { cache[computed[key]] = computed[key]; } | |
} | |
} | |
/** | |
* Test if a property is supported, returns supported property with vendor | |
* prefix if required. Returns `false` if not supported. | |
* | |
* @param {String} prop dash separated | |
* @return {String|Boolean} | |
* @api public | |
*/ | |
function supportedProperty(prop) { | |
// For server-side rendering. | |
if (!el) { return prop; } | |
// We have not tested this prop yet, lets do the test. | |
if (cache[prop] != null) { return cache[prop]; } | |
// Camelization is required because we can't test using | |
// css syntax for e.g. in FF. | |
// Test if property is supported as it is. | |
if ((0, _camelize2['default'])(prop) in el.style) { | |
cache[prop] = prop; | |
} | |
// Test if property is supported with vendor prefix. | |
else if (_prefix2['default'].js + (0, _camelize2['default'])('-' + prop) in el.style) { | |
cache[prop] = _prefix2['default'].css + prop; | |
} else { | |
cache[prop] = false; | |
} | |
return cache[prop]; | |
} | |
}); | |
var supportedValue_1 = createCommonjsModule(function (module, exports) { | |
'use strict'; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
exports['default'] = supportedValue; | |
var _isInBrowser2 = _interopRequireDefault(_isInBrowser); | |
var _prefix2 = _interopRequireDefault(prefix); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | |
var cache = {}; | |
var el = void 0; | |
if (_isInBrowser2['default']) { el = document.createElement('p'); } | |
/** | |
* Returns prefixed value if needed. Returns `false` if value is not supported. | |
* | |
* @param {String} property | |
* @param {String} value | |
* @return {String|Boolean} | |
* @api public | |
*/ | |
function supportedValue(property, value) { | |
// For server-side rendering. | |
if (!el) { return value; } | |
// It is a string or a number as a string like '1'. | |
// We want only prefixable values here. | |
if (typeof value !== 'string' || !isNaN(parseInt(value, 10))) { return value; } | |
var cacheKey = property + value; | |
if (cache[cacheKey] != null) { return cache[cacheKey]; } | |
// IE can even throw an error in some cases, for e.g. style.content = 'bar' | |
try { | |
// Test value as it is. | |
el.style[property] = value; | |
} catch (err) { | |
cache[cacheKey] = false; | |
return false; | |
} | |
// Value is supported as it is. | |
if (el.style[property] !== '') { | |
cache[cacheKey] = value; | |
} else { | |
// Test value with vendor prefix. | |
value = _prefix2['default'].css + value; | |
// Hardcode test to convert "flex" to "-ms-flexbox" for IE10. | |
if (value === '-ms-flex') { value = '-ms-flexbox'; } | |
el.style[property] = value; | |
// Value is supported with vendor prefix. | |
if (el.style[property] !== '') { cache[cacheKey] = value; } | |
} | |
if (!cache[cacheKey]) { cache[cacheKey] = false; } | |
// Reset style value. | |
el.style[property] = ''; | |
return cache[cacheKey]; | |
} | |
}); | |
var lib$5 = createCommonjsModule(function (module, exports) { | |
'use strict'; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
exports.supportedValue = exports.supportedProperty = exports.prefix = undefined; | |
var _prefix2 = _interopRequireDefault(prefix); | |
var _supportedProperty2 = _interopRequireDefault(supportedProperty_1); | |
var _supportedValue2 = _interopRequireDefault(supportedValue_1); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | |
exports['default'] = { | |
prefix: _prefix2['default'], | |
supportedProperty: _supportedProperty2['default'], | |
supportedValue: _supportedValue2['default'] | |
}; /** | |
* CSS Vendor prefix detection and property feature testing. | |
* | |
* @copyright Oleg Slobodskoi 2015 | |
* @website https://github.com/jsstyles/css-vendor | |
* @license MIT | |
*/ | |
exports.prefix = _prefix2['default']; | |
exports.supportedProperty = _supportedProperty2['default']; | |
exports.supportedValue = _supportedValue2['default']; | |
}); | |
var lib$4 = createCommonjsModule(function (module, exports) { | |
'use strict'; | |
exports.__esModule = true; | |
exports['default'] = jssVendorPrefixer; | |
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj['default'] = obj; return newObj; } } | |
var vendor = _interopRequireWildcard(lib$5); | |
/** | |
* Add vendor prefix to a property name when needed. | |
* | |
* @param {Rule} rule | |
* @api public | |
*/ | |
function jssVendorPrefixer() { | |
return function (rule) { | |
if (rule.type === 'keyframe') { | |
rule.selector = '@' + vendor.prefix.css + 'keyframes' + rule.selector.substr(10); | |
return; | |
} | |
if (rule.type !== 'regular') { return; } | |
for (var prop in rule.style) { | |
var value = rule.style[prop]; | |
var changeProp = false; | |
var supportedProp = vendor.supportedProperty(prop); | |
if (supportedProp && supportedProp !== prop) { changeProp = true; } | |
var changeValue = false; | |
var supportedValue = vendor.supportedValue(supportedProp, value); | |
if (supportedValue && supportedValue !== value) { changeValue = true; } | |
if (changeProp || changeValue) { | |
if (changeProp) { delete rule.style[prop]; } | |
rule.style[supportedProp || prop] = supportedValue || value; | |
} | |
} | |
}; | |
} | |
module.exports = exports['default']; | |
}); | |
var jssVendorPrefixer = unwrapExports(lib$4); | |
var lib$6 = createCommonjsModule(function (module, exports) { | |
'use strict'; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
var regExp = /([A-Z])/g; | |
/** | |
* Replace a string passed from String#replace. | |
* @param {String} str | |
* @return {String} | |
*/ | |
function replace(str) { | |
return '-' + str.toLowerCase(); | |
} | |
/** | |
* Convert camel cased properties of a single style to dasherized. | |
* | |
* @param {Object} style | |
* @return {Object} convertedStyle | |
*/ | |
function convertCase(style) { | |
var convertedStyle = {}; | |
for (var prop in style) { | |
var value = style[prop]; | |
prop = prop.replace(regExp, replace); | |
convertedStyle[prop] = value; | |
} | |
return convertedStyle; | |
} | |
/** | |
* Allow camel cased property names by converting them back to dasherized. | |
* | |
* @param {Rule} rule | |
*/ | |
exports.default = function () { | |
return function jssCamelCase(rule) { | |
var style = rule.style; | |
if (!style) { return; } | |
if (Array.isArray(style)) { | |
// Handle rules like @font-face, which can have multiple styles in an array | |
for (var index = 0; index < style.length; index++) { | |
style[index] = convertCase(style[index]); | |
} | |
} else { | |
rule.style = convertCase(style); | |
} | |
}; | |
}; | |
}); | |
var jssCamelCase = unwrapExports(lib$6); | |
var lib$7 = createCommonjsModule(function (module, exports) { | |
'use strict'; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
exports.default = jssPropsSort; | |
/** | |
* Sort props by length. | |
* | |
* @param {Rule} rule | |
* @api public | |
*/ | |
function jssPropsSort() { | |
function sort(prop0, prop1) { | |
return prop0.length > prop1.length; | |
} | |
return function (rule) { | |
var style = rule.style; | |
var type = rule.type; | |
if (!style || type !== 'regular') { return; } | |
var newStyle = {}; | |
var props = Object.keys(style).sort(sort); | |
for (var prop in props) { | |
newStyle[props[prop]] = style[props[prop]]; | |
} | |
rule.style = newStyle; | |
}; | |
} | |
}); | |
var jssPropsSort = unwrapExports(lib$7); | |
const jss = Jss.create(); | |
jss.use(jssNested()); | |
jss.use(jssExtend()); | |
jss.use(jssPx()); | |
jss.use(jssVendorPrefixer()); | |
jss.use(jssCamelCase()); | |
jss.use(jssPropsSort()); | |
/* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
* | |
* Owner: [email protected] | |
* @license MPL 2.0 | |
* @copyright Famous Industries, Inc. 2015 | |
*/ | |
var _now = Date.now; | |
function _timestampTouch(touch, event, history) { | |
return { | |
x: touch.clientX, | |
y: touch.clientY, | |
identifier : touch.identifier, | |
origin: event.origin, | |
timestamp: _now(), | |
count: event.touches.length, | |
history: history | |
}; | |
} | |
function _handleStart$1(event) { | |
var this$1 = this; | |
if (event.touches.length > this.touchLimit) { return; } | |
this.isTouched = true; | |
for (var i = 0; i < event.changedTouches.length; i++) { | |
var touch = event.changedTouches[i]; | |
var data = _timestampTouch(touch, event, null); | |
this$1.eventOutput.emit('trackstart', data); | |
if (!this$1.selective && !this$1.touchHistory[touch.identifier]) { this$1.track(data); } | |
} | |
} | |
function _handleMove$1(event) { | |
var this$1 = this; | |
if (event.touches.length > this.touchLimit) { return; } | |
for (var i = 0; i < event.changedTouches.length; i++) { | |
var touch = event.changedTouches[i]; | |
var history = this$1.touchHistory[touch.identifier]; | |
if (history) { | |
var data = _timestampTouch(touch, event, history); | |
this$1.touchHistory[touch.identifier].push(data); | |
this$1.eventOutput.emit('trackmove', data); | |
} | |
} | |
} | |
function _handleEnd$1(event) { | |
var this$1 = this; | |
if (!this.isTouched) { return; } | |
for (var i = 0; i < event.changedTouches.length; i++) { | |
var touch = event.changedTouches[i]; | |
var history = this$1.touchHistory[touch.identifier]; | |
if (history) { | |
var data = _timestampTouch(touch, event, history); | |
this$1.eventOutput.emit('trackend', data); | |
delete this$1.touchHistory[touch.identifier]; | |
} | |
} | |
this.isTouched = false; | |
} | |
function _handleUnpipe() { | |
var this$1 = this; | |
for (var i in this$1.touchHistory) { | |
var history = this$1.touchHistory[i]; | |
this$1.eventOutput.emit('trackend', { | |
touch: history[history.length - 1].touch, | |
timestamp: Date.now(), | |
count: 0, | |
history: history | |
}); | |
delete this$1.touchHistory[i]; | |
} | |
} | |
/** | |
* Helper to TouchSync – tracks piped in touch events, organizes touch | |
* events by ID, and emits track events back to TouchSync. | |
* Emits 'trackstart', 'trackmove', and 'trackend' events upstream. | |
* | |
* @class TouchTracker | |
* @constructor | |
* @param {Object} options default options overrides | |
* @param [options.selective] {Boolean} selective if false, saves state for each touch | |
* @param [options.touchLimit] {Number} touchLimit upper bound for emitting events based on number of touches | |
*/ | |
function TouchTracker(options) { | |
this.selective = options.selective; | |
this.touchLimit = options.touchLimit || 1; | |
this.touchHistory = {}; | |
this.eventInput = new EventHandler_1(); | |
this.eventOutput = new EventHandler_1(); | |
EventHandler_1.setInputHandler(this, this.eventInput); | |
EventHandler_1.setOutputHandler(this, this.eventOutput); | |
this.eventInput.on('touchstart', _handleStart$1.bind(this)); | |
this.eventInput.on('touchmove', _handleMove$1.bind(this)); | |
this.eventInput.on('touchend', _handleEnd$1.bind(this)); | |
this.eventInput.on('touchcancel', _handleEnd$1.bind(this)); | |
this.eventInput.on('unpipe', _handleUnpipe.bind(this)); | |
this.isTouched = false; | |
} | |
/** | |
* Record touch data, if selective is false. | |
* @private | |
* @method track | |
* @param {Object} data touch data | |
*/ | |
TouchTracker.prototype.track = function track(data) { | |
this.touchHistory[data.identifier] = [data]; | |
}; | |
var TouchTracker_1 = TouchTracker; | |
/* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
* | |
* Owner: [email protected] | |
* @license MPL 2.0 | |
* @copyright Famous Industries, Inc. 2015 | |
*/ | |
/** | |
* Handles piped in touch events. Emits 'start', 'update', and 'events' | |
* events with delta, position, velocity, acceleration, clientX, clientY, count, and touch id. | |
* Useful for dealing with inputs on touch devices. Designed to be used either as standalone, or | |
* included in a GenericSync. | |
* | |
* @class TouchSync | |
* @constructor | |
* | |
* @example | |
* var Surface = require('../core/Surface'); | |
* var TouchSync = require('../inputs/TouchSync'); | |
* | |
* var surface = new Surface({ size: [100, 100] }); | |
* var touchSync = new TouchSync(); | |
* surface.pipe(touchSync); | |
* | |
* touchSync.on('start', function (e) { // react to start }); | |
* touchSync.on('update', function (e) { // react to update }); | |
* touchSync.on('end', function (e) { // react to end });* | |
* | |
* @param [options] {Object} default options overrides | |
* @param [options.direction] {Number} read from a particular axis | |
* @param [options.rails] {Boolean} read from axis with greatest differential | |
* @param [options.velocitySampleLength] {Number} Number of previous frames to check velocity against. | |
* @param [options.scale] {Number} constant factor to scale velocity output | |
* @param [options.touchLimit] {Number} touchLimit upper bound for emitting events based on number of touches | |
*/ | |
function TouchSync(options) { | |
this.options = Object.create(TouchSync.DEFAULT_OPTIONS); | |
this._optionsManager = new OptionsManager_1(this.options); | |
if (options) { this.setOptions(options); } | |
this._eventOutput = new EventHandler_1(); | |
this._touchTracker = new TouchTracker_1({ | |
touchLimit: this.options.touchLimit | |
}); | |
EventHandler_1.setOutputHandler(this, this._eventOutput); | |
EventHandler_1.setInputHandler(this, this._touchTracker); | |
this._touchTracker.on('trackstart', _handleStart.bind(this)); | |
this._touchTracker.on('trackmove', _handleMove.bind(this)); | |
this._touchTracker.on('trackend', _handleEnd.bind(this)); | |
this._payload = { | |
delta : null, | |
position : null, | |
velocity : null, | |
clientX : undefined, | |
clientY : undefined, | |
count : 0, | |
touch : undefined | |
}; | |
this._position = null; // to be deprecated | |
} | |
TouchSync.DEFAULT_OPTIONS = { | |
direction: undefined, | |
rails: false, | |
touchLimit: 1, | |
velocitySampleLength: 10, | |
scale: 1 | |
}; | |
TouchSync.DIRECTION_X = 0; | |
TouchSync.DIRECTION_Y = 1; | |
var MINIMUM_TICK_TIME = 8; | |
/** | |
* Triggered by trackstart. | |
* @method _handleStart | |
* @private | |
*/ | |
function _handleStart(data) { | |
var velocity; | |
var delta; | |
if (this.options.direction !== undefined){ | |
this._position = 0; | |
velocity = 0; | |
delta = 0; | |
} | |
else { | |
this._position = [0, 0]; | |
velocity = [0, 0]; | |
delta = [0, 0]; | |
} | |
var payload = this._payload; | |
payload.delta = delta; | |
payload.position = this._position; | |
payload.velocity = velocity; | |
payload.clientX = data.x; | |
payload.clientY = data.y; | |
payload.count = data.count; | |
payload.touch = data.identifier; | |
this._eventOutput.emit('start', payload); | |
} | |
/** | |
* Triggered by trackmove. | |
* @method _handleMove | |
* @private | |
*/ | |
function _handleMove(data) { | |
var history = data.history; | |
var currHistory = history[history.length - 1]; | |
var prevHistory = history[history.length - 2]; | |
var distantHistory = history[history.length - this.options.velocitySampleLength] ? | |
history[history.length - this.options.velocitySampleLength] : | |
history[history.length - 2]; | |
var distantTime = distantHistory.timestamp; | |
var currTime = currHistory.timestamp; | |
var diffX = currHistory.x - prevHistory.x; | |
var diffY = currHistory.y - prevHistory.y; | |
var velDiffX = currHistory.x - distantHistory.x; | |
var velDiffY = currHistory.y - distantHistory.y; | |
if (this.options.rails) { | |
if (Math.abs(diffX) > Math.abs(diffY)) { diffY = 0; } | |
else { diffX = 0; } | |
if (Math.abs(velDiffX) > Math.abs(velDiffY)) { velDiffY = 0; } | |
else { velDiffX = 0; } | |
} | |
var diffTime = Math.max(currTime - distantTime, MINIMUM_TICK_TIME); | |
var velX = velDiffX / diffTime; | |
var velY = velDiffY / diffTime; | |
var scale = this.options.scale; | |
var nextVel; | |
var nextDelta; | |
if (this.options.direction === TouchSync.DIRECTION_X) { | |
nextDelta = scale * diffX; | |
nextVel = scale * velX; | |
this._position += nextDelta; | |
} | |
else if (this.options.direction === TouchSync.DIRECTION_Y) { | |
nextDelta = scale * diffY; | |
nextVel = scale * velY; | |
this._position += nextDelta; | |
} | |
else { | |
nextDelta = [scale * diffX, scale * diffY]; | |
nextVel = [scale * velX, scale * velY]; | |
this._position[0] += nextDelta[0]; | |
this._position[1] += nextDelta[1]; | |
} | |
var payload = this._payload; | |
payload.delta = nextDelta; | |
payload.velocity = nextVel; | |
payload.position = this._position; | |
payload.clientX = data.x; | |
payload.clientY = data.y; | |
payload.count = data.count; | |
payload.touch = data.identifier; | |
this._eventOutput.emit('update', payload); | |
} | |
/** | |
* Triggered by trackend. | |
* @method _handleEnd | |
* @private | |
*/ | |
function _handleEnd(data) { | |
this._payload.count = data.count; | |
this._eventOutput.emit('end', this._payload); | |
} | |
/** | |
* Set internal options, overriding any default options | |
* | |
* @method setOptions | |
* | |
* @param [options] {Object} default options overrides | |
* @param [options.direction] {Number} read from a particular axis | |
* @param [options.rails] {Boolean} read from axis with greatest differential | |
* @param [options.scale] {Number} constant factor to scale velocity output | |
*/ | |
TouchSync.prototype.setOptions = function setOptions(options) { | |
return this._optionsManager.setOptions(options); | |
}; | |
/** | |
* Return entire options dictionary, including defaults. | |
* | |
* @method getOptions | |
* @return {Object} configuration options | |
*/ | |
TouchSync.prototype.getOptions = function getOptions() { | |
return this.options; | |
}; | |
var TouchSync_1 = TouchSync; | |
/* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
* | |
* Owner: [email protected] | |
* @license MPL 2.0 | |
* @copyright Famous Industries, Inc. 2015 | |
*/ | |
/** | |
* Combines multiple types of sync classes (e.g. mouse, touch, | |
* scrolling) into one standardized interface for inclusion in widgets. | |
* | |
* Sync classes are first registered with a key, and then can be accessed | |
* globally by key. | |
* | |
* Emits 'start', 'update' and 'end' events as a union of the sync class | |
* providers. | |
* | |
* @class GenericSync | |
* @constructor | |
* @param syncs {Object|Array} object with fields {sync key : sync options} | |
* or an array of registered sync keys | |
* @param [options] {Object|Array} options object to set on all syncs | |
*/ | |
function GenericSync(syncs, options) { | |
this._eventInput = new EventHandler_1(); | |
this._eventOutput = new EventHandler_1(); | |
EventHandler_1.setInputHandler(this, this._eventInput); | |
EventHandler_1.setOutputHandler(this, this._eventOutput); | |
this._syncs = {}; | |
if (syncs) { this.addSync(syncs); } | |
if (options) { this.setOptions(options); } | |
} | |
GenericSync.DIRECTION_X = 0; | |
GenericSync.DIRECTION_Y = 1; | |
GenericSync.DIRECTION_Z = 2; | |
// Global registry of sync classes. Append only. | |
var registry = {}; | |
/** | |
* Register a global sync class with an identifying key | |
* | |
* @static | |
* @method register | |
* | |
* @param syncObject {Object} an object of {sync key : sync options} fields | |
*/ | |
GenericSync.register = function register(syncObject) { | |
for (var key in syncObject){ | |
if (registry[key]){ // skip redundant registration | |
if (registry[key] !== syncObject[key]) // only if same registered class | |
{ throw new Error('Conflicting sync classes for key: ' + key); } | |
} | |
else { registry[key] = syncObject[key]; } | |
} | |
}; | |
/** | |
* Helper to set options on all sync instances | |
* | |
* @method setOptions | |
* @param options {Object} options object | |
*/ | |
GenericSync.prototype.setOptions = function(options) { | |
var this$1 = this; | |
for (var key in this$1._syncs){ | |
this$1._syncs[key].setOptions(options); | |
} | |
}; | |
/** | |
* Pipe events to a sync class | |
* | |
* @method pipeSync | |
* @param key {String} identifier for sync class | |
*/ | |
GenericSync.prototype.pipeSync = function pipeToSync(key) { | |
var sync = this._syncs[key]; | |
this._eventInput.pipe(sync); | |
sync.pipe(this._eventOutput); | |
}; | |
/** | |
* Unpipe events from a sync class | |
* | |
* @method unpipeSync | |
* @param key {String} identifier for sync class | |
*/ | |
GenericSync.prototype.unpipeSync = function unpipeFromSync(key) { | |
var sync = this._syncs[key]; | |
this._eventInput.unpipe(sync); | |
sync.unpipe(this._eventOutput); | |
}; | |
function _addSingleSync(key, options) { | |
if (!registry[key]) { return; } | |
this._syncs[key] = new (registry[key])(options); | |
this.pipeSync(key); | |
} | |
/** | |
* Add a sync class to from the registered classes | |
* | |
* @method addSync | |
* @param syncs {Object|Array.String} an array of registered sync keys | |
* or an object with fields {sync key : sync options} | |
*/ | |
GenericSync.prototype.addSync = function addSync(syncs) { | |
var this$1 = this; | |
if (syncs instanceof Array) | |
{ for (var i = 0; i < syncs.length; i++) | |
{ _addSingleSync.call(this$1, syncs[i]); } } | |
else if (syncs instanceof Object) | |
{ for (var key in syncs) | |
{ _addSingleSync.call(this$1, key, syncs[key]); } } | |
}; | |
var GenericSync_1 = GenericSync; | |
var callAfter_1 = createCommonjsModule(function (module, exports) { | |
"use strict"; | |
exports.callAfter = callAfter; | |
function callAfter(times, callback) { | |
var count = 0; | |
return function () { | |
if (++count == times) { | |
if (typeof callback == "function") { | |
callback.apply(this, arguments); | |
} | |
} | |
}; | |
} | |
exports["default"] = callAfter; | |
exports.__esModule = true; | |
}); | |
var callAfter = unwrapExports(callAfter_1); | |
/* | |
* LICENSE | |
* | |
* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
* | |
*/ | |
/** | |
* A scenegraph with two Molecule leafnodes: the menu area and the content | |
* area. The menu area is hidden beyond the edge of the screen while the | |
* content area is visible. Swiping in from the edge of the screen reveals the | |
* menu, putting the content area out of focus. A mouse can also be used, and | |
* hovering near the edge of the screen also reveals the menu. | |
* | |
* Note: This layout is mostly useful if it exists at the root of a context so | |
* that the menu is clipped when it is closed (off to the side), otherwise the | |
* menu will be visible beyond the boundary of the container that contains the | |
* PushMenuLayout. | |
* | |
* Note: If you've called `openMenu` or `closeMenu` with a callback, the callback | |
* will be canceled if a drag or hover on the menu happens before the animation | |
* has completed. Please open an issue on GitHub if you have any opinion | |
* against this. :) Maybe we can add a boolean option for this behavior. | |
* | |
* TODO: Embed working example here. | |
* | |
* @class PushMenuLayout | |
* @extends Molecule | |
*/ | |
var PushMenuLayout = (function (Molecule$$1) { | |
function PushMenuLayout(initialOptions) { | |
Molecule$$1.call(this, initialOptions); | |
// Add default values for this PushMenuLayout | |
// TODO: Make default options static for the class. | |
simpleExtend(this._.defaultOptions, { | |
menuSide: 'left', // left or right | |
menuWidth: 200, | |
menuHintSize: 10, // the amount of the menu that is visible before opening the menu. | |
pushAreaWidth: 40, // the area on the screen edge that the user can touch and drag to push out the menu. | |
animationDuration: 1000, | |
animationType: 'foldDown', // options: foldDown moveBack | |
// TODO: Background color for the whole layout should be the color that the fade fades to. | |
// TODO: Replace fade star/end colors with a fog color value and intensity. | |
fade: true, // when content recedes, it fades into the fog. | |
fadeStartColor: 'rgba(255,255,255,0)', | |
fadeEndColor: 'rgba(255,255,255,1)', | |
blur: false, // XXX: WIP, so false by default. | |
blurRadius: 5 | |
}); | |
// TODO: performance hit, this setter is invoked in the Molecule constructor, then here again. | |
this.options = initialOptions; | |
// TODO v0.1.0: Mark these as private. | |
// TODO v0.1.0: this.contentWidth should be the width of whatever is containing | |
// the layout, but we're just using it as a whole-page app for now. Get | |
// size from a commit? UPDATE: See the new famous/src/views/SizeAwareView | |
this.contentWidth = document.body.clientWidth - this.options.menuHintSize; | |
// Changing these values outside of an instance of PushMenuLayout might | |
// cause the layout to break. They are designed to be modified | |
// internally only. | |
this.isOpen = false; | |
this.isOpening = false; | |
this.isClosing = false; | |
this.isAnimating = false; // keep track of whether the menu is opening or closing. | |
this.isBeingDragged = false; // whether the user is dragging/pushing the menu or not. | |
this.transitionCallback = undefined; // holds the callback to the current open or close menu animation. | |
// Set the touch sync for pulling/pushing the menu open/closed. | |
GenericSync_1.register({ | |
touch: TouchSync_1 | |
}); | |
this._createComponents(); | |
this._initializeEvents(); | |
} | |
if ( Molecule$$1 ) PushMenuLayout.__proto__ = Molecule$$1; | |
PushMenuLayout.prototype = Object.create( Molecule$$1 && Molecule$$1.prototype ); | |
PushMenuLayout.prototype.constructor = PushMenuLayout; | |
/** | |
* See Molecule.setOptions | |
* | |
* @override | |
*/ | |
PushMenuLayout.prototype.setOptions = function setOptions (newOptions) { | |
Molecule$$1.prototype.setOptions.call(this, newOptions); | |
}; | |
/** | |
* See Molecule.resetOptions | |
* | |
* @override | |
*/ | |
PushMenuLayout.prototype.resetOptions = function resetOptions () { | |
Molecule$$1.prototype.resetOptions.call(this); | |
}; | |
/** | |
* Creates the menu area, content area, `Plane` for the fade effect, etc. | |
* | |
* @private | |
*/ | |
PushMenuLayout.prototype._createComponents = function _createComponents () { | |
var layout = this; | |
this.touchSync = new GenericSync_1(['touch']); | |
this.alignment = (this.options.menuSide == "left"? 0: 1); | |
this.animationTransition = new Transitionable_1(0); | |
this.mainMol = new Molecule$$1(); | |
this.menuMol = new Molecule$$1({ | |
size: [this.options.menuWidth,undefined] | |
}); | |
this.menuMol.oldTransform = this.menuMol.transform; | |
this.menuMol.transform = function() { // override | |
var currentPosition = layout.animationTransition.get(); | |
switch(layout.options.animationType) { | |
case "foldDown": | |
// XXX: this is depending on my modifications for TransitionableTransform. | |
this.oldTransform.setTranslateX( | |
layout.options.menuSide == 'left'? | |
currentPosition * (layout.options.menuWidth-layout.options.menuHintSize)/*range*/ - (layout.options.menuWidth-layout.options.menuHintSize)/*offset*/: | |
currentPosition * -(layout.options.menuWidth-layout.options.menuHintSize)/*range*/ + (layout.options.menuWidth-layout.options.menuHintSize)/*offset*/ | |
); | |
break; | |
case "moveBack": | |
// XXX: this is depending on my modifications for TransitionableTransform. | |
this.oldTransform.setTranslateX( | |
layout.options.menuSide == 'left'? | |
currentPosition * (layout.options.menuWidth-layout.options.menuHintSize)/*range*/ - (layout.options.menuWidth-layout.options.menuHintSize)/*offset*/: | |
currentPosition * -(layout.options.menuWidth-layout.options.menuHintSize)/*range*/ + (layout.options.menuWidth-layout.options.menuHintSize)/*offset*/ | |
); | |
break; | |
} | |
return this.oldTransform.get(); | |
}.bind(this.menuMol); | |
// contains the user's menu content. | |
this.menuContentMol = new Molecule$$1(); | |
this.contentMol = new Molecule$$1({ | |
size: [this.contentWidth,undefined] | |
}); | |
this.contentMol.oldTransform = this.contentMol.transform; | |
this.contentMol.transform = function() { // override | |
var currentPosition = layout.animationTransition.get(); | |
switch(layout.options.animationType) { | |
case "foldDown": | |
// XXX: this is depending on my modifications for TransitionableTransform. | |
this.oldTransform.setTranslateX( | |
layout.options.menuSide == 'left'? | |
currentPosition * (layout.options.menuWidth - layout.options.menuHintSize)/*range*/ + layout.options.menuHintSize/*offset*/: | |
currentPosition * -(layout.options.menuWidth - layout.options.menuHintSize)/*range*/ - layout.options.menuHintSize/*offset*/ | |
); | |
// XXX: this is depending on my modifications for TransitionableTransform. | |
this.oldTransform.setRotateY( | |
layout.options.menuSide == 'left'? | |
currentPosition * Math.PI/8: | |
currentPosition * -Math.PI/8 | |
); | |
break; | |
case "moveBack": | |
var depth = 100; | |
// XXX: this is depending on my modifications for TransitionableTransform. | |
this.oldTransform.setTranslateX( | |
layout.options.menuSide == 'left'? | |
layout.options.menuHintSize: | |
-layout.options.menuHintSize | |
); | |
this.oldTransform.setTranslateZ( | |
currentPosition * -depth | |
); | |
break; | |
} | |
return this.oldTransform.get(); | |
}.bind(this.contentMol); | |
this.menuTouchPlane = new Plane({ | |
size: [this.options.menuWidth + this.options.pushAreaWidth - this.options.menuHintSize, undefined], | |
properties: { | |
zIndex: '-1000' // below everything | |
} | |
}); | |
this.mainMol.setOptions({ | |
origin: [this.alignment, 0.5], | |
align: [this.alignment, 0.5] | |
}); | |
this.menuMol.setOptions({ | |
origin: [this.alignment, 0.5], | |
align: [this.alignment, 0.5] | |
}); | |
this.contentMol.setOptions({ | |
origin: [this.alignment, 0.5], | |
align: [this.alignment, 0.5] | |
}); | |
// FIXME: WHY THE EFF must I also set align and origin on menuTouchPlane | |
// when I've already set it on it's parent (this.menuMol)????? | |
this.menuTouchPlane.setOptions({ | |
origin: [this.alignment, 0.5], | |
align: [this.alignment, 0.5] | |
}); | |
// Bring the menu content molecule and touch plane forward just | |
// slightly so they're just above the content and content's fade plane, | |
// so touch and mouse interaction works. HTML, the bad parts. ;) | |
this.menuContentMol.transform.setTranslateZ(2); | |
this.menuTouchPlane.transform.setTranslateZ(2); | |
/* | |
* Styles for the fadePlane | |
*/ | |
// TODO: move this somewhere else . it's specific for each animation | |
this.updateStyles = function() { | |
var startColor; | |
var endColor; | |
switch(this.options.animationType) { | |
case "foldDown": | |
startColor = this.options.fadeStartColor; | |
endColor = this.options.fadeEndColor; | |
break; | |
case "moveBack": | |
startColor = endColor = this.options.fadeEndColor; | |
break; | |
} | |
var styles = { | |
'.infamous-fadeLeft': { | |
background: [ | |
endColor, | |
'-moz-linear-gradient(left, '+endColor+' 0%, '+startColor+' 100%)', | |
'-webkit-gradient(left top, right top, color-stop(0%, '+endColor+'), color-stop(100%, '+startColor+'))', | |
'-webkit-linear-gradient(left, '+endColor+' 0%, '+startColor+' 100%)', | |
'-o-linear-gradient(left, '+endColor+' 0%, '+startColor+' 100%)', | |
'-ms-linear-gradient(left, '+endColor+' 0%, '+startColor+' 100%)', | |
'linear-gradient(to right, '+endColor+' 0%, '+startColor+' 100%)' | |
], | |
filter: 'progid:DXImageTransform.Microsoft.gradient( startColorstr=\'#cc000000\', endColorstr=\'#4d000000\', GradientType=1 )' | |
}, | |
'.infamous-fadeRight': { | |
background: [ | |
startColor, | |
'-moz-linear-gradient(left, '+startColor+' 0%, '+endColor+' 100%)', | |
'-webkit-gradient(left top, right top, color-stop(0%, '+startColor+'), color-stop(100%, '+endColor+'))', | |
'-webkit-linear-gradient(left, '+startColor+' 0%, '+endColor+' 100%)', | |
'-o-linear-gradient(left, '+startColor+' 0%, '+endColor+' 100%)', | |
'-ms-linear-gradient(left, '+startColor+' 0%, '+endColor+' 100%)', | |
'linear-gradient(to right, '+startColor+' 0%, '+endColor+' 100%)' | |
], | |
filter: 'progid:DXImageTransform.Microsoft.gradient( startColorstr=\'#4d000000\', endColorstr=\'#cc000000\', GradientType=1 )' | |
} | |
}; | |
if (this.fadeStylesheet) { this.fadeStylesheet.detach(); } | |
this.fadeStylesheet = jss.createStyleSheet(styles); | |
this.fadeStylesheet.attach(); | |
}; | |
if (this.options.fade) { | |
this.updateStyles(); | |
this.fadePlane = new Plane({ | |
size: [undefined,undefined], | |
classes: [ | |
// TODO: switch to jss namespace. | |
(this.options.menuSide == 'left'? 'infamous-fadeRight': 'infamous-fadeLeft') | |
], | |
properties: { | |
zIndex: '1000', | |
pointerEvents: 'none' | |
} | |
}); | |
// FIXME: Why the EFF must I also set align and origin on fadePlane when | |
// I've already set it on it's parent (this.contentMol)????? | |
this.fadePlane.setOptions({ | |
origin: [this.alignment, 0.5], | |
align: [this.alignment, 0.5] | |
}); | |
// move the fadePlane forward by 1px so it doesn't glitch out. | |
// Chrome will make the fadePlane and the surface in the content | |
// area (if any) blink randomly when the two surfaces are in the | |
// same exact position together. | |
this.fadePlane.transform.setTranslateZ(1); | |
this.fadePlane.setOptions({ | |
opacity: this.animationTransition | |
}); | |
// TODO: Make fadePlane a sibling to menuMol and contentMol so that | |
// contentMol contains only the user;s content. This will affect | |
// the code in this.render(). | |
this.contentMol.add(this.fadePlane); | |
} | |
this.add(this.mainMol); | |
this.mainMol.add(this.contentMol); | |
this.menuMol.add(this.menuTouchPlane); | |
this.menuMol.add(this.menuContentMol); | |
this.mainMol.add(this.menuMol); | |
// TODO: Also create and add a background plane for the menu area so it will catch events that might fall through the menu content. | |
}; | |
/** | |
* Sets up the events for the touch and mouse interaction that opens and | |
* closes the menu. | |
* | |
* @private | |
*/ | |
PushMenuLayout.prototype._initializeEvents = function _initializeEvents () { | |
// move the menu, following the user's drag. Don't let the user drag the menu past the menu width. | |
this.options.handler.on('update', function(event) { // update == drag | |
this.isBeingDragged = true; | |
// stop the current transitions if any, along with the current callback if any. | |
this._haltAnimation(true); | |
var currentPosition = this.animationTransition.get(); | |
// TODO: handle the right-side menu. | |
switch(this.options.animationType) { | |
case "foldDown": | |
this.animationTransition.set(currentPosition + event.delta[0] / (this.options.menuWidth - this.options.menuHintSize)); | |
break; | |
case "moveBack": | |
this.animationTransition.set(currentPosition + event.delta[0] / (this.options.menuWidth - this.options.menuHintSize)); | |
break; | |
} | |
currentPosition = this.animationTransition.get(); | |
if (currentPosition > 1) { | |
this.animationTransition.set(1); | |
} | |
else if (currentPosition < 0) { | |
this.animationTransition.set(0); | |
} | |
}.bind(this)); | |
this.options.handler.on('end', function(event) { | |
this.isBeingDragged = false; | |
var currentPosition = this.animationTransition.get(); | |
if (currentPosition < 0.5) { | |
this.closeMenu(); | |
} | |
else { | |
this.openMenu(); | |
} | |
}.bind(this)); | |
// TODO v0.1.0: Use a SizeAwareView instead of relying on the body, since we | |
// might not be directly in the body. | |
window.addEventListener('resize', function(event) { | |
this.contentWidth = document.body.clientWidth - this.options.menuHintSize; | |
this.contentMol.setOptions({size: [this.contentWidth, undefined]}); | |
}.bind(this)); | |
/* | |
* Wire up events | |
* TODO: consolidate dup code here and in setMenu | |
*/ | |
this.menuTouchPlane.pipe(this.touchSync); | |
this.menuTouchPlane.on('mouseenter', function() { | |
if (!this.isOpening) { | |
this.openMenu(); | |
} | |
}.bind(this)); | |
this.menuTouchPlane.on('mouseleave', function() { | |
if (!this.isClosing) { | |
this.closeMenu(); | |
} | |
}.bind(this)); | |
this.touchSync.pipe(this.options.handler); | |
}; | |
/** | |
* Add a scenegraph to the content area of the PushMenuLayout. You can put | |
* anything you want into the content area (magical 3D things for example), | |
* just be careful not to let them cover the menu or you'll block the user | |
* from interacting with the menu. | |
* | |
* @param {module: famous/src/core/RenderNode} node A scenegraph, i.e. a | |
* RenderNode with stuff in it. | |
* | |
* TODO: Accept plain renderables, f.e. Surfaces, etc. This change requires | |
* also modifying the code in this.render() to account for renderables. | |
* | |
* TODO: Make a sibling method to reset the content area. | |
*/ | |
PushMenuLayout.prototype.setContent = function setContent (node) { | |
this.contentMol.add(node); | |
}; | |
/** | |
* Add a scenegraph to the menu area of the PushMenuLayout. If the object | |
* that you pass into setMenu is an infamous component, or a famo.us | |
* Surface, then it's events will be piped to this PushMenuLayout's input | |
* sync so that the user can open and close the menu with touch or mouse. | |
* General advice here would be to keep whatever you put into the menu | |
* contained within the boundaries of the menu or you might have touch and | |
* mouse interaction outside of the menu. | |
* | |
* @param {module: famous/src/core/RenderNode} node A scenegraph, i.e. a | |
* RenderNode with stuff in it. | |
* | |
* TODO: Accept plain renderables, f.e. Surfaces, etc. | |
* | |
* TODO: Remove old content before adding new content. | |
*/ | |
PushMenuLayout.prototype.setMenu = function setMenu (node) { | |
this.menuContentMol.add(node); | |
if (node instanceof Molecule$$1) { | |
node.pipe(this.touchSync); | |
node.on('mouseenter', function() { | |
if (!this.isOpening) { | |
this.openMenu(); | |
} | |
}.bind(this)); | |
node.on('mouseleave', function() { | |
if (!this.isClosing) { | |
this.closeMenu(); | |
} | |
}.bind(this)); | |
} | |
}; | |
// TODO: replace menu easing with physics so the user can throw the menu, | |
// using initial velocity and drag to slow it down, and stop immediately | |
// when it hits the fully-open or fully-closed positions. | |
/** | |
* Opens the menu. | |
* | |
* @param {Function} callback The function to be called when the animation finishes. | |
* @param {boolean} [cancelPreviousCallback=false] This is optional. If | |
* true, then the callback of a previous open or close animation will be | |
* canceled if that animation was still inprogress when this method is | |
* called, otherwise the callback of the previous open or close animation | |
* will be fired immediately before the animation for this animation begins. | |
*/ | |
PushMenuLayout.prototype.openMenu = function openMenu (callback, cancelPreviousCallback) { | |
this._haltAnimation(cancelPreviousCallback); | |
this.isClosing = false; | |
this.isOpening = true; | |
this._animate('open', callback); | |
}; | |
/** | |
* Closes the menu. | |
* | |
* @param {Function} callback The function to be called when the animation finishes. | |
* @param {boolean} [cancelPreviousCallback=false] This is optional. If | |
* true, then the callback of a previous open or close animation will be | |
* canceled if that animation was still inprogress when this method is | |
* called, otherwise the callback of the previous open or close animation | |
* will be fired immediately before the animation for this animation begins. | |
*/ | |
PushMenuLayout.prototype.closeMenu = function closeMenu (callback, cancelPreviousCallback) { | |
this._haltAnimation(cancelPreviousCallback); | |
this.isClosing = true; | |
this.isOpening = false; | |
this._animate('close', callback); | |
}; | |
/** | |
* Toggles the menu open or closed. If the menu is open or is opening, then it will now start | |
* closing, and vice versa. | |
* | |
* @param {Function} callback The function to be called when the animation finishes. | |
* @param {boolean} [cancelPreviousCallback=false] This is optional. If | |
* true, then the callback of a previous open or close animation will be | |
* canceled if that animation was still inprogress when this method is | |
* called, otherwise the callback of the previous open or close animation | |
* will be fired immediately before the animation for this animation begins. | |
*/ | |
PushMenuLayout.prototype.toggleMenu = function toggleMenu (callback, cancelPreviousCallback) { | |
if (this.isOpen || this.isOpening) { | |
this.closeMenu(callback, cancelPreviousCallback); | |
} | |
else if (!this.isOpen || this.isClosing) { | |
this.openMenu(callback, cancelPreviousCallback); | |
} | |
}; | |
/** | |
* Animates the menu to it's target state. | |
* | |
* @private | |
* @param {String} targetState The name of the state to animate to. | |
* @param {Function} callback The function to call after the animation completes. | |
*/ | |
PushMenuLayout.prototype._animate = function _animate (targetState, callback) { | |
this.isAnimating = true; | |
this.transitionCallback = callback; | |
var _callback; | |
var self = this; | |
function setupCallback(numberOfTransitions) { | |
// Fire callback after numberOfTransitions calls, when the 4 transitions are complete. | |
_callback = callAfter(numberOfTransitions, function() { | |
self.isAnimating = self.isOpening = self.isClosing = false; | |
self.isOpen = targetState == 'open'? true: false; | |
if (typeof self.transitionCallback == 'function') { | |
self.transitionCallback(); | |
} | |
self.transitionCallback = undefined; | |
}.bind(self)); | |
} | |
setupCallback(1); | |
if (targetState == 'open') { | |
this.animationTransition.set(1, {duration: this.options.animationDuration, curve: Easing_1.outExpo}, _callback); | |
} | |
else if (targetState == 'close') { | |
this.animationTransition.set(0, {duration: this.options.animationDuration, curve: Easing_1.outExpo}, _callback); | |
} | |
}; | |
/** | |
* Halts the current animation, if any. | |
* | |
* @private | |
* @param {boolean} [cancelCallback=false] Defaults to false. If true, the | |
* halted animation's callback won't fire, otherwise it will be fired. | |
*/ | |
PushMenuLayout.prototype._haltAnimation = function _haltAnimation (cancelCallback) { | |
if (this.isAnimating) { | |
if (!cancelCallback && typeof this.transitionCallback == 'function') { | |
this.transitionCallback(); | |
} | |
this.transitionCallback = undefined; | |
this.animationTransition.halt(); | |
} | |
}; | |
/** | |
* @override | |
*/ | |
PushMenuLayout.prototype.render = function render () { | |
// Blur the content if this.options.blur is true, and the animation is moveBack. | |
// | |
// TODO: Make the item to to be blur specifiable, perhaps with a method on | |
// this. | |
if (this.options.blur && this.options.fade && this.options.animationType == 'moveBack') { | |
let momentaryBlur = (this.animationTransition.get() * this.options.blurRadius); | |
let filter = { | |
"-webkit-filter": 'blur('+momentaryBlur+'px)', | |
"-moz-filter": 'blur('+momentaryBlur+'px)', | |
"-ms-filter": 'blur('+momentaryBlur+'px)', | |
"-o-filter": 'blur('+momentaryBlur+'px)', | |
filter: 'blur('+momentaryBlur+'px)' | |
}; | |
// TODO TODO TODO v0.1.0: Make fadePlane a sibling with menu and | |
// content molecules or the following breaks if fade is false. | |
// Then remove the check for this.options.fade in the previous if | |
// statement above. | |
if (this.contentMol._child[1].get() instanceof Surface_1) { | |
this.contentMol.get().setProperties(filter); | |
} | |
else if (this.contentMol._child[1] instanceof Plane) { | |
this.contentMol._child[1].surface.setProperties(filter); | |
} | |
} | |
return Molecule$$1.prototype.render.call(this) | |
}; | |
return PushMenuLayout; | |
}(Molecule)); | |
// A reusable array, to avoid allocating new arrays during multiplication. | |
// in column-major order: | |
const scratch = [ | |
/*m11*/0, /*m12*/0, /*m13*/0, /*m14*/0, | |
/*m21*/0, /*m22*/0, /*m23*/0, /*m24*/0, | |
/*m31*/0, /*m32*/0, /*m33*/0, /*m34*/0, | |
/*m41*/0, /*m42*/0, /*m43*/0, /*m44*/0 ]; | |
function multiplyAndApply(A, B, target) { | |
//XXX: Are the following calculations faster hard coded (current), or as a loop? | |
scratch[0] = (A.m11 * B.m11) + (A.m21 * B.m12) + (A.m31 * B.m13) + (A.m41 * B.m14); | |
scratch[4] = (A.m11 * B.m21) + (A.m21 * B.m22) + (A.m31 * B.m23) + (A.m41 * B.m24); | |
scratch[8] = (A.m11 * B.m31) + (A.m21 * B.m32) + (A.m31 * B.m33) + (A.m41 * B.m34); | |
scratch[12] = (A.m11 * B.m41) + (A.m21 * B.m42) + (A.m31 * B.m43) + (A.m41 * B.m44); | |
scratch[1] = (A.m12 * B.m11) + (A.m22 * B.m12) + (A.m32 * B.m13) + (A.m42 * B.m14); | |
scratch[5] = (A.m12 * B.m21) + (A.m22 * B.m22) + (A.m32 * B.m23) + (A.m42 * B.m24); | |
scratch[9] = (A.m12 * B.m31) + (A.m22 * B.m32) + (A.m32 * B.m33) + (A.m42 * B.m34); | |
scratch[13] = (A.m12 * B.m41) + (A.m22 * B.m42) + (A.m32 * B.m43) + (A.m42 * B.m44); | |
scratch[2] = (A.m13 * B.m11) + (A.m23 * B.m12) + (A.m33 * B.m13) + (A.m43 * B.m14); | |
scratch[6] = (A.m13 * B.m21) + (A.m23 * B.m22) + (A.m33 * B.m23) + (A.m43 * B.m24); | |
scratch[10] = (A.m13 * B.m31) + (A.m23 * B.m32) + (A.m33 * B.m33) + (A.m43 * B.m34); | |
scratch[14] = (A.m13 * B.m41) + (A.m23 * B.m42) + (A.m33 * B.m43) + (A.m43 * B.m44); | |
scratch[3] = (A.m14 * B.m11) + (A.m24 * B.m12) + (A.m34 * B.m13) + (A.m44 * B.m14); | |
scratch[7] = (A.m14 * B.m21) + (A.m24 * B.m22) + (A.m34 * B.m23) + (A.m44 * B.m24); | |
scratch[11] = (A.m14 * B.m31) + (A.m24 * B.m32) + (A.m34 * B.m33) + (A.m44 * B.m34); | |
scratch[15] = (A.m14 * B.m41) + (A.m24 * B.m42) + (A.m34 * B.m43) + (A.m44 * B.m44); | |
applyArrayValuesToDOMMatrix(scratch, target); | |
} | |
function applyArrayValuesToDOMMatrix(array, matrix) { | |
const length = array.length; | |
if (length === 6) { | |
matrix.m11 = array[0]; | |
matrix.m12 = array[1]; | |
matrix.m21 = array[2]; | |
matrix.m22 = array[3]; | |
matrix.m41 = array[4]; | |
matrix.m42 = array[5]; | |
} | |
else if (length === 16) { | |
matrix.m11 = array[0]; | |
matrix.m12 = array[1]; | |
matrix.m13 = array[2]; | |
matrix.m14 = array[3]; | |
matrix.m21 = array[4]; | |
matrix.m22 = array[5]; | |
matrix.m23 = array[6]; | |
matrix.m24 = array[7]; | |
matrix.m31 = array[8]; | |
matrix.m32 = array[9]; | |
matrix.m33 = array[10]; | |
matrix.m34 = array[11]; | |
matrix.m41 = array[12]; | |
matrix.m42 = array[13]; | |
matrix.m43 = array[14]; | |
matrix.m44 = array[15]; | |
} | |
} | |
function rotateAxisAngleArray(x, y, z, angle) { | |
var sin = Math.sin; | |
var cos = Math.cos; | |
var pow = Math.pow; | |
const halfAngle = degreesToRadians(angle/2); | |
// TODO: should we provide a 6-item array here to signify 2D when the | |
// rotation is about the Z axis (for example when calling rotateSelf)? | |
// TODO: Performance can be improved by first detecting when x, y, or z of | |
// the axis are zero or 1, and using a pre-simplified version of the | |
// folowing math based on that condition. | |
// TODO: Performance can be improved by using different equations (use trig | |
// identities to find alternate formulas). | |
return [ | |
1-2*(y*y + z*z)*pow(sin(halfAngle), 2), 2*(x*y*pow(sin(halfAngle), 2) + z*sin(halfAngle)*cos(halfAngle)), 2*(x*z*pow(sin(halfAngle), 2) - y*sin(halfAngle)*cos(halfAngle)), 0, | |
2*(x*y*pow(sin(halfAngle), 2) - z*sin(halfAngle)*cos(halfAngle)), 1-2*(x*x + z*z)*pow(sin(halfAngle), 2), 2*(y*z*pow(sin(halfAngle), 2) + x*sin(halfAngle)*cos(halfAngle)), 0, | |
2*(x*z*pow(sin(halfAngle), 2) + y*sin(halfAngle)*cos(halfAngle)), 2*(y*z*pow(sin(halfAngle), 2) - x*sin(halfAngle)*cos(halfAngle)), 1-2*(x*x + y*y)*pow(sin(halfAngle), 2), 0, | |
0, 0, 0, 1 ] | |
} | |
function degreesToRadians(degrees) { | |
return Math.PI/180 * degrees | |
} | |
// This matrix is represented internally in row-major format so that it is easy | |
// to look at visually. In a pair of coordinates (as in "m23") the first number | |
// is the column and the second is the row (so "m23" means column 2 row 3). | |
const identity = [ | |
/*m11*/1, /*m21*/0, /*m31*/0, /*m41*/0, | |
/*m12*/0, /*m22*/1, /*m32*/0, /*m42*/0, | |
/*m13*/0, /*m23*/0, /*m33*/1, /*m43*/0, | |
/*m14*/0, /*m24*/0, /*m34*/0, /*m44*/1 ]; | |
var DOMMatrixReadOnly = null; | |
function initDOMMatrixReadOnly() { | |
if (DOMMatrixReadOnly) { return } | |
DOMMatrixReadOnly = (function () { | |
function DOMMatrixReadOnly(numberSequence) { | |
if ( numberSequence === void 0 ) { numberSequence = []; } | |
if (!(this instanceof DOMMatrix)) | |
{ throw new TypeError("DOMMatrixReadOnly can't be instantiated directly. Use DOMMatrix instead.") } | |
var length = numberSequence.length; | |
if (length === undefined || !(length === 6 || length === 16)) | |
{ throw new TypeError('DOMMatrix constructor argument "numberSequence" must be an array-like with 6 or 16 numbers.') } | |
this._matrix = new Float64Array(identity); | |
this._isIdentity = true; | |
this._is2D = length === 6 ? true : false; | |
applyArrayValuesToDOMMatrix(numberSequence, this); | |
} | |
var prototypeAccessors = { is2D: {},isIdentity: {},a: {},b: {},c: {},d: {},e: {},f: {},m11: {},m12: {},m13: {},m14: {},m21: {},m22: {},m23: {},m24: {},m31: {},m32: {},m33: {},m34: {},m41: {},m42: {},m43: {},m44: {} }; | |
// Immutable transform methods ------------------------------------------- | |
DOMMatrixReadOnly.prototype.translate = function translate (tx, ty, tz) { | |
if ( tz === void 0 ) { tz = 0; } | |
return new DOMMatrix(this).translateSelf(tx, ty, tz) | |
}; | |
DOMMatrixReadOnly.prototype.scale = function scale (scale$1, originX, originY) { | |
if ( originX === void 0 ) { originX = 0; } | |
if ( originY === void 0 ) { originY = 0; } | |
return new DOMMatrix(this).scaleSelf(scale$1, originX, originY) | |
}; | |
DOMMatrixReadOnly.prototype.scale3d = function scale3d (scale, originX, originY, originZ) { | |
if ( originX === void 0 ) { originX = 0; } | |
if ( originY === void 0 ) { originY = 0; } | |
if ( originZ === void 0 ) { originZ = 0; } | |
return new DOMMatrix(this).scale3dSelf(scale, originX, originY, originZ) | |
}; | |
DOMMatrixReadOnly.prototype.scaleNonUniform = function scaleNonUniform (scaleX, scaleY, scaleZ, originX, originY, originZ) { | |
if ( scaleY === void 0 ) { scaleY = 1; } | |
if ( scaleZ === void 0 ) { scaleZ = 1; } | |
if ( originX === void 0 ) { originX = 0; } | |
if ( originY === void 0 ) { originY = 0; } | |
if ( originZ === void 0 ) { originZ = 0; } | |
return new DOMMatrix(this).scaleNonUniformSelf(scaleX, scaleY, scaleZ, originX, originY, originZ) | |
}; | |
DOMMatrixReadOnly.prototype.rotate = function rotate (angle, originX, originY) { | |
if ( originX === void 0 ) { originX = 0; } | |
if ( originY === void 0 ) { originY = 0; } | |
return new DOMMatrix(this).rotateSelf(angle, originX, originY) | |
}; | |
// TODO | |
DOMMatrixReadOnly.prototype.rotateFromVector = function rotateFromVector (x, y) { | |
throw new Error('rotateFromVector is not implemented yet.') | |
}; | |
DOMMatrixReadOnly.prototype.rotateAxisAngle = function rotateAxisAngle (x, y, z, angle) { | |
return new DOMMatrix(this).rotateAxisAngleSelf(x, y, z, angle) | |
}; | |
DOMMatrixReadOnly.prototype.skewX = function skewX (sx) { | |
throw new Error('skewX is not implemented yet.') | |
}; | |
DOMMatrixReadOnly.prototype.skewY = function skewY (sy) { | |
throw new Error('skewY is not implemented yet.') | |
}; | |
DOMMatrixReadOnly.prototype.multiply = function multiply (other) { | |
return new DOMMatrix(this).multiplySelf(other) | |
}; | |
DOMMatrixReadOnly.prototype.flipX = function flipX () { | |
throw new Error('flipX is not implemented yet.') | |
}; | |
DOMMatrixReadOnly.prototype.flipY = function flipY () { | |
throw new Error('flipY is not implemented yet.') | |
}; | |
DOMMatrixReadOnly.prototype.inverse = function inverse () { | |
throw new Error('inverse is not implemented yet.') | |
}; | |
DOMMatrixReadOnly.prototype.transformPoint = function transformPoint (/*optional DOMPointInit*/ point) { | |
throw new Error('transformPoint is not implemented yet.') | |
}; | |
DOMMatrixReadOnly.prototype.toFloat32Array = function toFloat32Array () { | |
return Float32Array.from(this._matrix) | |
}; | |
DOMMatrixReadOnly.prototype.toFloat64Array = function toFloat64Array () { | |
return Float64Array.from(this._matrix) | |
}; | |
//stringifier() {} // What's this? | |
prototypeAccessors.is2D.get = function () { | |
return this._is2D | |
}; | |
/* | |
* TODO: make sure this matches the spec. | |
* TODO: Instead of calculating here, perhaps calculate and set | |
* this._isIdentity in other operations, and simply return the internal one | |
* here. | |
*/ | |
prototypeAccessors.isIdentity.get = function () { | |
var this$1 = this; | |
for (var i = 0, len = this._matrix.length; i < len; i+=1) { | |
if (this$1._matrix[i] != identity[i]) | |
{ return (this$1._isIdentity = false) } | |
} | |
return (this._isIdentity = true) | |
}; | |
prototypeAccessors.a.get = function () { return this.m11 }; | |
prototypeAccessors.b.get = function () { return this.m12 }; | |
prototypeAccessors.c.get = function () { return this.m21 }; | |
prototypeAccessors.d.get = function () { return this.m22 }; | |
prototypeAccessors.e.get = function () { return this.m41 }; | |
prototypeAccessors.f.get = function () { return this.m42 }; | |
prototypeAccessors.m11.get = function () { return this._matrix[0] }; | |
prototypeAccessors.m12.get = function () { return this._matrix[4] }; | |
prototypeAccessors.m13.get = function () { return this._matrix[8] }; | |
prototypeAccessors.m14.get = function () { return this._matrix[12] }; | |
prototypeAccessors.m21.get = function () { return this._matrix[1] }; | |
prototypeAccessors.m22.get = function () { return this._matrix[5] }; | |
prototypeAccessors.m23.get = function () { return this._matrix[9] }; | |
prototypeAccessors.m24.get = function () { return this._matrix[13] }; | |
prototypeAccessors.m31.get = function () { return this._matrix[2] }; | |
prototypeAccessors.m32.get = function () { return this._matrix[6] }; | |
prototypeAccessors.m33.get = function () { return this._matrix[10] }; | |
prototypeAccessors.m34.get = function () { return this._matrix[14] }; | |
prototypeAccessors.m41.get = function () { return this._matrix[3] }; | |
prototypeAccessors.m42.get = function () { return this._matrix[7] }; | |
prototypeAccessors.m43.get = function () { return this._matrix[11] }; | |
prototypeAccessors.m44.get = function () { return this._matrix[15] }; | |
Object.defineProperties( DOMMatrixReadOnly.prototype, prototypeAccessors ); | |
return DOMMatrixReadOnly; | |
}()); | |
} | |
initDOMMatrixReadOnly(); | |
initDOMMatrixReadOnly(); | |
var DOMMatrix = (function (DOMMatrixReadOnly$$1) { | |
function DOMMatrix(arg) { | |
const numArgs = arguments.length; | |
if (numArgs === 0) { | |
DOMMatrixReadOnly$$1.call(this, [1, 0, 0, 1, 0, 0]); | |
} | |
else if (numArgs === 1) { | |
if (typeof arg == 'string') { | |
throw new Error('CSS transformList arg not yet implemented.') | |
// TODO validate that syntax of transformList matches transform-list (http://www.w3.org/TR/css-transforms-1/#typedef-transform-list). | |
} | |
else if (arg instanceof DOMMatrix) { | |
DOMMatrixReadOnly$$1.call(this, arg._matrix); | |
} | |
else if (arg instanceof Float32Array || arg instanceof Float64Array || arg instanceof Array) { | |
DOMMatrixReadOnly$$1.call(this, arg); | |
} | |
} | |
else { | |
throw new Error('Wrong number of arguments to DOMMatrix constructor.') | |
} | |
} | |
if ( DOMMatrixReadOnly$$1 ) { DOMMatrix.__proto__ = DOMMatrixReadOnly$$1; } | |
DOMMatrix.prototype = Object.create( DOMMatrixReadOnly$$1 && DOMMatrixReadOnly$$1.prototype ); | |
DOMMatrix.prototype.constructor = DOMMatrix; | |
var prototypeAccessors = { a: {},b: {},c: {},d: {},e: {},f: {},m11: {},m12: {},m13: {},m14: {},m21: {},m22: {},m23: {},m24: {},m31: {},m32: {},m33: {},m34: {},m41: {},m42: {},m43: {},m44: {} }; | |
// Mutable transform methods | |
DOMMatrix.prototype.multiplySelf = function multiplySelf (other) { | |
if (!(other instanceof DOMMatrix)) | |
{ throw new Error('The argument to multiplySelf must be an instance of DOMMatrix') } | |
// TODO: avoid creating a new array, just apply values directly. | |
multiplyAndApply(this, other, this); | |
if (!other.is2D) { this._is2D = false; } | |
return this | |
}; | |
DOMMatrix.prototype.preMultiplySelf = function preMultiplySelf (other) { | |
if (!(other instanceof DOMMatrix)) | |
{ throw new Error('The argument to multiplySelf must be an instance of DOMMatrix') } | |
// TODO: avoid creating a new array, just apply values directly. | |
multiplyAndApply(other, this, this); | |
if (!other.is2D) { this._is2D = false; } | |
return this | |
}; | |
DOMMatrix.prototype.translateSelf = function translateSelf (tx, ty, tz) { | |
if ( tz === void 0 ) { tz = 0; } | |
// TODO: check args are numbers | |
if (arguments.length === 1) | |
{ throw new Error('The first two arguments (X and Y translation values) are required (the third, Z translation, is optional).') } | |
// http://www.w3.org/TR/2012/WD-css3-transforms-20120911/#Translate3dDefined | |
const translationMatrix = new DOMMatrix([ | |
// column-major: | |
1, 0, 0, 0, | |
0, 1, 0, 0, | |
0, 0, 1, 0, | |
tx,ty,tz,1 ]); | |
this.multiplySelf(translationMatrix); | |
if (tz != 0) { | |
this._is2D = false; | |
} | |
return this | |
}; | |
DOMMatrix.prototype.scaleSelf = function scaleSelf (scale, originX, originY) { | |
if ( originX === void 0 ) { originX = 0; } | |
if ( originY === void 0 ) { originY = 0; } | |
this.translateSelf(originX, originY); | |
this.multiplySelf(new DOMMatrix([ | |
// 2D: | |
/*a*/scale, /*b*/0, | |
/*c*/0, /*d*/scale, | |
/*e*/0, /*f*/0 ])); | |
this.translateSelf(-originX, -originY); | |
return this | |
}; | |
DOMMatrix.prototype.scale3dSelf = function scale3dSelf (scale, originX, originY, originZ) { | |
if ( originX === void 0 ) { originX = 0; } | |
if ( originY === void 0 ) { originY = 0; } | |
if ( originZ === void 0 ) { originZ = 0; } | |
this.translateSelf(originX, originY, originZ); | |
this.multiplySelf(new DOMMatrix([ | |
// 3D | |
scale, 0, 0, 0, | |
0, scale, 0, 0, | |
0, 0, scale, 0, | |
0, 0, 0, 1 ])); | |
this.translateSelf(-originX, -originY, -originZ); | |
return this | |
}; | |
DOMMatrix.prototype.scaleNonUniformSelf = function scaleNonUniformSelf (scaleX, scaleY, scaleZ, originX, originY, originZ) { | |
if ( scaleY === void 0 ) { scaleY = 1; } | |
if ( scaleZ === void 0 ) { scaleZ = 1; } | |
if ( originX === void 0 ) { originX = 0; } | |
if ( originY === void 0 ) { originY = 0; } | |
if ( originZ === void 0 ) { originZ = 0; } | |
this.translateSelf(originX, originY, originZ); | |
this.multiplySelf(new DOMMatrix([ | |
// 3D | |
scaleX, 0, 0, 0, | |
0, scaleY, 0, 0, | |
0, 0, scaleZ, 0, | |
0, 0, 0, 1 ])); | |
this.translateSelf(-originX, -originY, -originZ); | |
if (scaleZ !== 1 || originZ !== 0) { this._is2D = false; } | |
return this | |
}; | |
DOMMatrix.prototype.rotateSelf = function rotateSelf (angle, originX, originY) { | |
if ( originX === void 0 ) { originX = 0; } | |
if ( originY === void 0 ) { originY = 0; } | |
this.translateSelf(originX, originY); | |
// axis of rotation | |
var ref = [0,0,1]; | |
var x = ref[0]; | |
var y = ref[1]; | |
var z = ref[2]; // We're rotating around the Z axis. | |
this.rotateAxisAngleSelf(x, y, z, angle); | |
this.translateSelf(-originX, -originY); | |
return this | |
}; | |
// TODO | |
DOMMatrix.prototype.rotateFromVectorSelf = function rotateFromVectorSelf (x, y) { | |
throw new Error('rotateFromVectorSelf is not implemented yet.') | |
}; | |
DOMMatrix.prototype.rotateAxisAngleSelf = function rotateAxisAngleSelf (x, y, z, angle) { | |
const rotationMatrix = new DOMMatrix(rotateAxisAngleArray(x,y,z,angle)); | |
this.multiplySelf(rotationMatrix); | |
return this | |
}; | |
DOMMatrix.prototype.skewXSelf = function skewXSelf (sx) { | |
throw new Error('skewXSelf is not implemented yet.') | |
}; | |
DOMMatrix.prototype.skewYSelf = function skewYSelf (sy) { | |
throw new Error('skewYSelf is not implemented yet.') | |
}; | |
DOMMatrix.prototype.invertSelf = function invertSelf () { | |
throw new Error('invertSelf is |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment