artproject/libs.core.min.js

6 lines
81 KiB
JavaScript
Raw Normal View History

2018-02-12 11:51:32 +00:00
/*empire.studio - Design & Strategy*/
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n=e();for(var a in n)("object"==typeof exports?exports:t)[a]=n[a]}}(this,function(){return function(t){function e(a){if(n[a])return n[a].exports;var o=n[a]={exports:{},id:a,loaded:!1};return t[a].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){e.glMatrix=n(1),e.mat2=n(2),e.mat2d=n(3),e.mat3=n(4),e.mat4=n(5),e.quat=n(6),e.vec2=n(9),e.vec3=n(7),e.vec4=n(8)},function(t,e){var n={};n.EPSILON=1e-6,n.ARRAY_TYPE="undefined"!=typeof Float32Array?Float32Array:Array,n.RANDOM=Math.random,n.ENABLE_SIMD=!1,n.SIMD_AVAILABLE=n.ARRAY_TYPE===this.Float32Array&&"SIMD"in this,n.USE_SIMD=n.ENABLE_SIMD&&n.SIMD_AVAILABLE,n.setMatrixArrayType=function(t){n.ARRAY_TYPE=t};var a=Math.PI/180;n.toRadian=function(t){return t*a},n.equals=function(t,e){return Math.abs(t-e)<=n.EPSILON*Math.max(1,Math.abs(t),Math.abs(e))},t.exports=n},function(t,e,n){var a=n(1),o={};o.create=function(){var t=new a.ARRAY_TYPE(4);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},o.clone=function(t){var e=new a.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},o.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},o.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},o.fromValues=function(t,e,n,o){var r=new a.ARRAY_TYPE(4);return r[0]=t,r[1]=e,r[2]=n,r[3]=o,r},o.set=function(t,e,n,a,o){return t[0]=e,t[1]=n,t[2]=a,t[3]=o,t},o.transpose=function(t,e){if(t===e){var n=e[1];t[1]=e[2],t[2]=n}else t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3];return t},o.invert=function(t,e){var n=e[0],a=e[1],o=e[2],r=e[3],s=n*r-o*a;return s?(s=1/s,t[0]=r*s,t[1]=-a*s,t[2]=-o*s,t[3]=n*s,t):null},o.adjoint=function(t,e){var n=e[0];return t[0]=e[3],t[1]=-e[1],t[2]=-e[2],t[3]=n,t},o.determinant=function(t){return t[0]*t[3]-t[2]*t[1]},o.multiply=function(t,e,n){var a=e[0],o=e[1],r=e[2],s=e[3],i=n[0],u=n[1],c=n[2],l=n[3];return t[0]=a*i+r*u,t[1]=o*i+s*u,t[2]=a*c+r*l,t[3]=o*c+s*l,t},o.mul=o.multiply,o.rotate=function(t,e,n){var a=e[0],o=e[1],r=e[2],s=e[3],i=Math.sin(n),u=Math.cos(n);return t[0]=a*u+r*i,t[1]=o*u+s*i,t[2]=a*-i+r*u,t[3]=o*-i+s*u,t},o.scale=function(t,e,n){var a=e[0],o=e[1],r=e[2],s=e[3],i=n[0],u=n[1];return t[0]=a*i,t[1]=o*i,t[2]=r*u,t[3]=s*u,t},o.fromRotation=function(t,e){var n=Math.sin(e),a=Math.cos(e);return t[0]=a,t[1]=n,t[2]=-n,t[3]=a,t},o.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t},o.str=function(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},o.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2))},o.LDU=function(t,e,n,a){return t[2]=a[2]/a[0],n[0]=a[0],n[1]=a[1],n[3]=a[3]-t[2]*n[1],[t,e,n]},o.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t},o.subtract=function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t},o.sub=o.subtract,o.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},o.equals=function(t,e){var n=t[0],o=t[1],r=t[2],s=t[3],i=e[0],u=e[1],c=e[2],l=e[3];return Math.abs(n-i)<=a.EPSILON*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(o-u)<=a.EPSILON*Math.max(1,Math.abs(o),Math.abs(u))&&Math.abs(r-c)<=a.EPSILON*Math.max(1,Math.abs(r),Math.abs(c))&&Math.abs(s-l)<=a.EPSILON*Math.max(1,Math.abs(s),Math.abs(l))},o.multiplyScalar=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t},o.multiplyScalarAndAdd=function(t,e,n,a){return t[0]=e[0]+n[0]*a,t[1]=e[1]+n[1]*a,t[2]=e[2]+n[2]*a,t[3]=e[3]+n[3]*a,t},t.exports=o},function(t,e,n){var a=n(1),o={};o.create=function(){var t=new a.ARRAY_TYPE(6);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},o.clone=function(t){var e=new a.ARRAY_TYPE(6);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e},o.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t},o.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},o.fromValues=function(t,e,n,o,r,s)
var r=e[0],s=e[1],i=e[2],u=e[3],c=r+r,l=s+s,h=i+i,M=r*c,f=r*l,d=r*h,I=s*l,S=s*h,m=i*h,p=u*c,g=u*l,D=u*h,x=a[0],_=a[1],v=a[2],b=o[0],F=o[1],E=o[2];return t[0]=(1-(I+m))*x,t[1]=(f+D)*x,t[2]=(d-g)*x,t[3]=0,t[4]=(f-D)*_,t[5]=(1-(M+m))*_,t[6]=(S+p)*_,t[7]=0,t[8]=(d+g)*v,t[9]=(S-p)*v,t[10]=(1-(M+I))*v,t[11]=0,t[12]=n[0]+b-(t[0]*b+t[4]*F+t[8]*E),t[13]=n[1]+F-(t[1]*b+t[5]*F+t[9]*E),t[14]=n[2]+E-(t[2]*b+t[6]*F+t[10]*E),t[15]=1,t},o.fromQuat=function(t,e){var n=e[0],a=e[1],o=e[2],r=e[3],s=n+n,i=a+a,u=o+o,c=n*s,l=a*s,h=a*i,M=o*s,f=o*i,d=o*u,I=r*s,S=r*i,m=r*u;return t[0]=1-h-d,t[1]=l+m,t[2]=M-S,t[3]=0,t[4]=l-m,t[5]=1-c-d,t[6]=f+I,t[7]=0,t[8]=M+S,t[9]=f-I,t[10]=1-c-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},o.frustum=function(t,e,n,a,o,r,s){var i=1/(n-e),u=1/(o-a),c=1/(r-s);return t[0]=2*r*i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*r*u,t[6]=0,t[7]=0,t[8]=(n+e)*i,t[9]=(o+a)*u,t[10]=(s+r)*c,t[11]=-1,t[12]=0,t[13]=0,t[14]=s*r*2*c,t[15]=0,t},o.perspective=function(t,e,n,a,o){var r=1/Math.tan(e/2),s=1/(a-o);return t[0]=r/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=r,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(o+a)*s,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*o*a*s,t[15]=0,t},o.perspectiveFromFieldOfView=function(t,e,n,a){var o=Math.tan(e.upDegrees*Math.PI/180),r=Math.tan(e.downDegrees*Math.PI/180),s=Math.tan(e.leftDegrees*Math.PI/180),i=Math.tan(e.rightDegrees*Math.PI/180),u=2/(s+i),c=2/(o+r);return t[0]=u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=c,t[6]=0,t[7]=0,t[8]=-((s-i)*u*.5),t[9]=(o-r)*c*.5,t[10]=a/(n-a),t[11]=-1,t[12]=0,t[13]=0,t[14]=a*n/(n-a),t[15]=0,t},o.ortho=function(t,e,n,a,o,r,s){var i=1/(e-n),u=1/(a-o),c=1/(r-s);return t[0]=-2*i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+n)*i,t[13]=(o+a)*u,t[14]=(s+r)*c,t[15]=1,t},o.lookAt=function(t,e,n,r){var s,i,u,c,l,h,M,f,d,I,S=e[0],m=e[1],p=e[2],g=r[0],D=r[1],x=r[2],_=n[0],v=n[1],b=n[2];return Math.abs(S-_)<a.EPSILON&&Math.abs(m-v)<a.EPSILON&&Math.abs(p-b)<a.EPSILON?o.identity(t):(M=S-_,f=m-v,d=p-b,I=1/Math.sqrt(M*M+f*f+d*d),M*=I,f*=I,d*=I,s=D*d-x*f,i=x*M-g*d,u=g*f-D*M,I=Math.sqrt(s*s+i*i+u*u),I?(I=1/I,s*=I,i*=I,u*=I):(s=0,i=0,u=0),c=f*u-d*i,l=d*s-M*u,h=M*i-f*s,I=Math.sqrt(c*c+l*l+h*h),I?(I=1/I,c*=I,l*=I,h*=I):(c=0,l=0,h=0),t[0]=s,t[1]=c,t[2]=M,t[3]=0,t[4]=i,t[5]=l,t[6]=f,t[7]=0,t[8]=u,t[9]=h,t[10]=d,t[11]=0,t[12]=-(s*S+i*m+u*p),t[13]=-(c*S+l*m+h*p),t[14]=-(M*S+f*m+d*p),t[15]=1,t)},o.str=function(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"},o.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2)+Math.pow(t[9],2)+Math.pow(t[10],2)+Math.pow(t[11],2)+Math.pow(t[12],2)+Math.pow(t[13],2)+Math.pow(t[14],2)+Math.pow(t[15],2))},o.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t[9]=e[9]+n[9],t[10]=e[10]+n[10],t[11]=e[11]+n[11],t[12]=e[12]+n[12],t[13]=e[13]+n[13],t[14]=e[14]+n[14],t[15]=e[15]+n[15],t},o.subtract=function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t[9]=e[9]-n[9],t[10]=e[10]-n[10],t[11]=e[11]-n[11],t[12]=e[12]-n[12],t[13]=e[13]-n[13],t[14]=e[14]-n[14],t[15]=e[15]-n[15],t},o.sub=o.subtract,o.multiplyScalar=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,t[11]=e[11]*n,t[12]=e[12]*n,t[13]=e[13]*n,t[14]=e[14]*n,t[15]=e[15]*n,t},o.multiplyScalarAndAdd=function(t,e,n,a){return t[0]=e[0]+n[0]*a,t[1]=e[1]+n[1]*a,t[2]=e[2]+n[2]*a,t[3]=e[3]+n[3]*a,t[4]=e[4]+n[4]*a,t[5]=e[5]+n[5]*a,t[6]=e[6]+n[6]*a,t[7]=e[7]+n[7]*a,t[8]=e[8]+n[8]*a,t[9]=e[9]+n[9]*a,t[10]=e[10]+n[10]*a,t[11]=e[11]+n[11]*a,t[12]=e[12]+n[12]*a,t[13]=e[13]+n[13]*a,t[14]=e[14]+n[14]*a,t[15]=e[15]+n[15]*a,t},o.exactEquals=function
this._trace("Client.getTraceLog",new Date),this._trace("Client.getTraceLog in flight messages",this._sentMessages.length);for(var t in this._sentMessages)this._trace("_sentMessages ",t,this._sentMessages[t]);for(t in this._receivedMessages)this._trace("_receivedMessages ",t,this._receivedMessages[t]);return this._traceBuffer}},S.prototype.startTrace=function(){null===this._traceBuffer&&(this._traceBuffer=[]),this._trace("Client.startTrace",new Date,"1.0.2")},S.prototype.stopTrace=function(){delete this._traceBuffer},S.prototype._doConnect=function(t){this.connectOptions.useSSL&&(t=t.split(":"),t[0]="wss",t=t.join(":")),this.connected=!1,this.socket=4>this.connectOptions.mqttVersion?new WebSocket(t,["mqttv3.1"]):new WebSocket(t,["mqtt"]),this.socket.binaryType="arraybuffer",this.socket.onopen=i(this._on_socket_open,this),this.socket.onmessage=i(this._on_socket_message,this),this.socket.onerror=i(this._on_socket_error,this),this.socket.onclose=i(this._on_socket_close,this),this.sendPinger=new d(this,window,this.connectOptions.keepAliveInterval),this.receivePinger=new d(this,window,this.connectOptions.keepAliveInterval),this._connectTimeout=new I(this,window,this.connectOptions.timeout,this._disconnected,[u.CONNECT_TIMEOUT.code,l(u.CONNECT_TIMEOUT)])},S.prototype._schedule_message=function(t){this._msg_queue.push(t),this.connected&&this._process_queue()},S.prototype.store=function(t,e){var n={type:e.type,messageIdentifier:e.messageIdentifier,version:1};switch(e.type){case 3:e.pubRecReceived&&(n.pubRecReceived=!0),n.payloadMessage={};for(var a="",o=e.payloadMessage.payloadBytes,r=0;r<o.length;r++)a=15>=o[r]?a+"0"+o[r].toString(16):a+o[r].toString(16);n.payloadMessage.payloadHex=a,n.payloadMessage.qos=e.payloadMessage.qos,n.payloadMessage.destinationName=e.payloadMessage.destinationName,e.payloadMessage.duplicate&&(n.payloadMessage.duplicate=!0),e.payloadMessage.retained&&(n.payloadMessage.retained=!0),0==t.indexOf("Sent:")&&(void 0===e.sequence&&(e.sequence=++this._sequence),n.sequence=e.sequence);break;default:throw Error(l(u.INVALID_STORED_DATA,[key,n]))}localStorage.setItem(t+this._localKey+e.messageIdentifier,JSON.stringify(n))},S.prototype.restore=function(t){var e=localStorage.getItem(t),n=JSON.parse(e),a=new f(n.type,n);switch(n.type){case 3:for(var e=n.payloadMessage.payloadHex,o=new ArrayBuffer(e.length/2),o=new Uint8Array(o),r=0;2<=e.length;){var s=parseInt(e.substring(0,2),16),e=e.substring(2,e.length);o[r++]=s}e=new Paho.MQTT.Message(o),e.qos=n.payloadMessage.qos,e.destinationName=n.payloadMessage.destinationName,n.payloadMessage.duplicate&&(e.duplicate=!0),n.payloadMessage.retained&&(e.retained=!0),a.payloadMessage=e;break;default:throw Error(l(u.INVALID_STORED_DATA,[t,e]))}0==t.indexOf("Sent:"+this._localKey)?(a.payloadMessage.duplicate=!0,this._sentMessages[a.messageIdentifier]=a):0==t.indexOf("Received:"+this._localKey)&&(this._receivedMessages[a.messageIdentifier]=a)},S.prototype._process_queue=function(){for(var t=null,e=this._msg_queue.reverse();t=e.pop();)this._socket_send(t),this._notify_msg_sent[t]&&(this._notify_msg_sent[t](),delete this._notify_msg_sent[t])},S.prototype._requires_ack=function(t){var e=Object.keys(this._sentMessages).length;if(e>this.maxMessageIdentifier)throw Error("Too many messages:"+e);for(;void 0!==this._sentMessages[this._message_identifier];)this._message_identifier++;t.messageIdentifier=this._message_identifier,this._sentMessages[t.messageIdentifier]=t,3===t.type&&this.store("Sent:",t),this._message_identifier===this.maxMessageIdentifier&&(this._message_identifier=1)},S.prototype._on_socket_open=function(){var t=new f(1,this.connectOptions);t.clientId=this.clientId,this._socket_send(t)},S.prototype._on_socket_message=function(t){this._trace("Client._on_socket_message",t.data),t=this._deframeMessages(t.data);for(var e=0;e<t.length;e+=1)this._handleMessage(t[e])},S.prototype._deframeMessages=function(t){if(t=new Uint8Array(t),this.receiveBuffer){var e=new Uint8Array(this.receiveBuffer.length+t.length);e.set(this.receiveBuffer),e.set(t,this.receiveBuffer.length),t=e,delete this.r
//# sourceMappingURL=libs.core.min.js.map