text: /*
   * Human Engine v4.0.0
   *
   * (c) 2015 BioDigital, Inc.
   */
  !function(){"use strict";var a=window.Human={};a.deployed="localhost"===window.location.hostname||/192\.168\.11\.\d{1,3}/.test(window.location.hostname)||"file:"===window.location.protocol?!1:!0,a.CANVAS_ID="theCanvas",a.CONTAINER_ID="container",a.SCENE_ROOT_ID="bds-human",a.CONTENT_ROOT_ID="outline",a.MATERIAL_ROOT_ID="human.outline",a.NULL_OBJECT_ID="null-object",a.NULL_OBJECT_ID2="null-object-2",a.CLIP_INDICATORS_ATTACH_ID="clip-indicators",a.CLIP_ATTACH_ID="clips",a.LOOKAT_ID="theLookat",a.CAMERA_ID="theCamera",a.VIEW_SPACE_ID="viewSpace";var b=[];a.onError=function(a){b.push(a)},a.error=function(b,c){return"string"==typeof b&&(c=b,b="ERROR"),a._error("ERROR",b,c,!1)},a._error=function(c,d,e,f){for(var g={errorName:c,code:d,exception:e,fatal:f},h=0,i=b.length;i>h;h++)b[h](g);return a.events.fire("error",{name:c,code:d,message:e,fatal:f}),e},a.fatalError=function(b,c){return"string"==typeof b&&(c=b,b="ERROR"),a._error("ERROR",b,c,!0)},a._shallowClone=function(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b},a._applyIf=function(a,b){for(var c in a)a.hasOwnProperty(c)&&(void 0===b[c]||null===b[c])&&(b[c]=a[c]);return b},a._applyIf2=function(a,b){a=a||{};var c={};for(var d in b)b.hasOwnProperty(d)&&(c[d]=void 0!==a[d]?a[d]:b[d]);return c},a._apply=function(a,b){for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b},a._isArray=function(a){return a&&!a.propertyIsEnumerable("length")&&"object"==typeof a&&"number"==typeof a.length},a._isEmpty=function(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0},a._getDir=function(a){var b=a.lastIndexOf("/");return b>-1?a.substring(0,b>0?b+1:0):""},a._noop=function(){},a._getKeys=function(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(c);return b},a._createUUID=function(){for(var a=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"],b=["8","9","A","B"],c=[],d=0;38>d;d++)switch(d){case 8:c.push("-");break;case 13:c.push("-");break;case 18:c.push("-");break;case 14:c.push("4");break;case 19:c.push(b[Math.round(3*Math.random())]);break;default:c.push(a[Math.round(15*Math.random())])}return c.join("")}}(),Human.VERSION="3.1.0",function(){"use strict";Human.Component=function(){},Human.Component.prototype={_init:function(a){this._ctx=a,this._handleMap=new Human.utils.Map,this._topicSubs={},this._handleTopics={},this._topicPubs={}},publish:function(a,b,c){c||(this._topicPubs[a]=b);var d=this._topicSubs[a];if(d)for(var e in d)d.hasOwnProperty(e)&&d[e].call(this,b)},on:function(a,b){var c=this._topicSubs[a];c||(c={},this._topicSubs[a]=c);var d=this._handleMap.addItem();c[d]=b,this._handleTopics[d]=a;var e=this._topicPubs[a];return e&&b.call(this,e),d},off:function(a){var b=this._handleTopics[a];if(b){delete this._handleTopics[a];var c=this._topicSubs[b];c&&delete c[a],this._handleMap.removeItem(a)}},once:function(a,b){var c=this,d=this.on(a,function(a){c.off(d),b(a)})}}}(),function(){"use strict";Human.utils=Human.utils||{},Human.utils.isArray=function(a){return a&&!a.propertyIsEnumerable("length")&&"object"==typeof a&&"number"==typeof a.length},Human.utils.extend=function(a,b){var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a},Human.utils.apply=function(a,b){for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b},Human.utils.applyIf=function(a,b){for(var c in a)a.hasOwnProperty(c)&&(void 0===b[c]||null===b[c])&&(b[c]=a[c]);return b}}(),function(){"use strict";Human.math={},Human.math.clamp=function(a,b,c){return b>a?b:a>c?c:a},Human.math.divVec3=function(a,b){return[a[0]/b[0],a[1]/b[1],a[2]/b[2]]},Human.math.negateVector4=function(a){return[-a[0],-a[1],-a[2],-a[3]]},Human.math.addVec4=function(a,b){return[a[0]+b[0],a[1]+b[1],a[2]+b[2],a[3]+b[3]]},Human.math.addVec4s=function(a,b){return[a[0]+b,a[1]+b,a[2]+b,a[3]+b]},Human.math.addScalarVec4=function(a,b){return Human.math.addVec4s(b,a)},Human.math.addVec3=function(a,b){return[a[0]+b[0],a[1]+b[1],a[2]+b[2]]},Human.math.addVec3s=function(a,b){return[a[0]+b,a[1]+b,a[2]+b]},Human.math.subVec4=function(a,b){return[a[0]-b[0],a[1]-b[1],a[2]-b[2],a[3]-b[3]]},Human.math.subVec3=function(a,b){return[a[0]-b[0],a[1]-b[1],a[2]-b[2]]},Human.math.lerpVec3=function(a,b,c,d,e){var f=(a-b)/(c-b);return[d[0]+f*(e[0]-d[0]),d[1]+f*(e[1]-d[1]),d[2]+f*(e[2]-d[2])]},Human.math.lerpVec2=function(a,b,c,d,e){var f=(a-b)/(c-b);return[d[0]+f*(e[0]-d[0]),d[1]+f*(e[1]-d[1])]},Human.math.negateVector3=function(a){return[-a[0],-a[1],-a[2]]},Human.math.subVec2=function(a,b){return[a[0]-b[0],a[1]-b[1]]},Human.math.subVec4Scalar=function(a,b){return[a[0]-b,a[1]-b,a[2]-b,a[3]-b]},Human.math.subScalarVec4=function(a,b){return[b-a[0],b-a[1],b-a[2],b-a[3]]},Human.math.mulVec4=function(a,b){return[a[0]*b[0],a[1]*b[1],a[2]*b[2],a[3]*b[3]]},Human.math.mulVec4Scalar=function(a,b){return[a[0]*b,a[1]*b,a[2]*b,a[3]*b]},Human.math.mulVec3Scalar=function(a,b){return[a[0]*b,a[1]*b,a[2]*b]},Human.math.mulVec2Scalar=function(a,b){return[a[0]*b,a[1]*b]},Human.math.divVec4=function(a,b){return[a[0]/b[0],a[1]/b[1],a[2]/b[2],a[3]/b[3]]},Human.math.divScalarVec3=function(a,b){return[a/b[0],a/b[1],a/b[2]]},Human.math.divVec3s=function(a,b){return[a[0]/b,a[1]/b,a[2]/b]},Human.math.divVec4s=function(a,b){return[a[0]/b,a[1]/b,a[2]/b,a[3]/b]},Human.math.divScalarVec4=function(a,b){return[a/b[0],a/b[1],a/b[2],a/b[3]]},Human.math.dotVector4=function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]},Human.math.cross3Vec4=function(a,b){return[a[1]*b[2]-a[2]*b[1],a[2]*b[0]-a[0]*b[2],a[0]*b[1]-a[1]*b[0],0]},Human.math.cross3Vec3=function(a,b){return[a[1]*b[2]-a[2]*b[1],a[2]*b[0]-a[0]*b[2],a[0]*b[1]-a[1]*b[0]]},Human.math.sqLenVec4=function(a){return Human.math.dotVector4(a,a)},Human.math.lenVec4=function(a){return Math.sqrt(Human.math.sqLenVec4(a))},Human.math.dotVector3=function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]},Human.math.dotVector2=function(a,b){return a[0]*b[0]+a[1]*b[1]},Human.math.sqLenVec3=function(a){return Human.math.dotVector3(a,a)},Human.math.sqLenVec2=function(a){return Human.math.dotVector2(a,a)},Human.math.lenVec3=function(a){return Math.sqrt(Human.math.sqLenVec3(a))},Human.math.lenVec2=function(a){return Math.sqrt(Human.math.sqLenVec2(a))},Human.math.rcpVec3=function(a){return Human.math.divScalarVec3(1,a)},Human.math.vec3ObjToArray=function(a){return[a.x,a.y,a.z]},Human.math.vec3ArrayToObj=function(a){return{x:a[0],y:a[1],z:a[2]}},Human.math.normalizeVec4=function(a){var b=1/Human.math.lenVec4(a);return Human.math.mulVec4Scalar(a,b)},Human.math.normalizeVec3=function(a){var b=1/Human.math.lenVec3(a);return Human.math.mulVec3Scalar(a,b)},Human.math.normalizeVec2=function(a){var b=1/Human.math.lenVec2(a);return Human.math.mulVec2Scalar(a,b)},Human.math.mat4=function(){return new Array(16)},Human.math.dupMat4=function(a){return a.slice(0,16)},Human.math.getCellMat4=function(a,b,c){return a[b+4*c]},Human.math.setCellMat4=function(a,b,c,d){a[b+4*c]=d},Human.math.getRowMat4=function(a,b){return[a[b+0],a[b+4],a[b+8],a[b+12]]},Human.math.setRowMat4=function(a,b,c){a[b+0]=c[0],a[b+4]=c[1],a[b+8]=c[2],a[b+12]=c[3]},Human.math.setRowMat4c=function(a,b,c,d,e,f){Human.math.setRowMat4(a,b,[c,d,e,f])},Human.math.setRowMat4s=function(a,b,c){Human.math.setRowMat4c(a,b,c,c,c,c)},Human.math.getColMat4=function(a,b){var c=4*b;return[a[c+0],a[c+1],a[c+2],a[c+3]]},Human.math.setColMat4v=function(a,b,c){var d=4*b;a[d+0]=c[0],a[d+1]=c[1],a[d+2]=c[2],a[d+3]=c[3]},Human.math.setColMat4c=function(a,b,c,d,e,f){Human.math.setColMat4v(a,b,[c,d,e,f])},Human.math.setColMat4Scalar=function(a,b,c){Human.math.setColMat4c(a,b,c,c,c,c)},Human.math.mat4To3=function(a){return[a[0],a[1],a[2],a[4],a[5],a[6],a[8],a[9],a[10]]},Human.math.m4s=function(a){return[a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a]},Human.math.setMat4ToZeroes=function(){return Human.math.m4s(0)},Human.math.setMat4ToOnes=function(){return Human.math.m4s(1)},Human.math.diagonalMat4v=function(a){return[a[0],0,0,0,0,a[1],0,0,0,0,a[2],0,0,0,0,a[3]]},Human.math.diagonalMat4c=function(a,b,c,d){return Human.math.diagonalMat4v([a,b,c,d])},Human.math.diagonalMat4s=function(a){return Human.math.diagonalMat4c(a,a,a,a)},Human.math.identityMat4=function(){return Human.math.diagonalMat4s(1)},Human.math.isIdentityMat4=function(a){var b=0,c=0,d=0;for(b=0;4>b;++b)for(c=0;4>c;++c)if(d=a[b+4*c],b===c){if(1!==d)return!1}else if(0!==d)return!1;return!0},Human.math.negateMat4=function(a){for(var b=Human.math.mat4(),c=0;16>c;++c)b[c]=-a[c];return b},Human.math.addMat4=function(a,b){for(var c=Human.math.mat4(),d=0;16>d;++d)c[d]=a[d]+b[d];return c},Human.math.addMat4Scalar=function(a,b){for(var c=Human.math.mat4(),d=0;16>d;++d)c[d]=a[d]+b;return c},Human.math.addScalarMat4=function(a,b){return Human.math.addMat4Scalar(b,a)},Human.math.subMat4=function(a,b){for(var c=Human.math.mat4(),d=0;16>d;++d)c[d]=a[d]-b[d];return c},Human.math.subMat4Scalar=function(a,b){for(var c=Human.math.mat4(),d=0;16>d;++d)c[d]=a[d]-b;return c},Human.math.subScalarMat4=function(a,b){for(var c=Human.math.mat4(),d=0;16>d;++d)c[d]=a-b[d];return c},Human.math.mulMat4=function(a,b,c){c||(c=a);var d=a[0],e=a[1],f=a[2],g=a[3],h=a[4],i=a[5],j=a[6],k=a[7],l=a[8],m=a[9],n=a[10],o=a[11],p=a[12],q=a[13],r=a[14],s=a[15],t=b[0],u=b[1],v=b[2],w=b[3],x=b[4],y=b[5],z=b[6],A=b[7],B=b[8],C=b[9],D=b[10],E=b[11],F=b[12],G=b[13],H=b[14],I=b[15];return c[0]=t*d+u*h+v*l+w*p,c[1]=t*e+u*i+v*m+w*q,c[2]=t*f+u*j+v*n+w*r,c[3]=t*g+u*k+v*o+w*s,c[4]=x*d+y*h+z*l+A*p,c[5]=x*e+y*i+z*m+A*q,c[6]=x*f+y*j+z*n+A*r,c[7]=x*g+y*k+z*o+A*s,c[8]=B*d+C*h+D*l+E*p,c[9]=B*e+C*i+D*m+E*q,c[10]=B*f+C*j+D*n+E*r,c[11]=B*g+C*k+D*o+E*s,c[12]=F*d+G*h+H*l+I*p,c[13]=F*e+G*i+H*m+I*q,c[14]=F*f+G*j+H*n+I*r,c[15]=F*g+G*k+H*o+I*s,c},Human.math.mulMat4s=function(a,b){for(var c=Human.math.mat4(),d=0;16>d;++d)c[d]=a[d]*b;return c},Human.math.mulMat4v4=function(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]]},Human.math.transposeMat4=function(a){var b=Human.math.mat4(),c=0,d=0;for(c=0;4>c;++c)for(d=0;4>d;++d)b[c+4*d]=a[4*c+d];return b},Human.math.determinantMat4=function(a){var b=Human.math.getCellMat4;return b(a,0,3)*b(a,1,2)*b(a,2,1)*b(a,3,0)-b(a,0,2)*b(a,1,3)*b(a,2,1)*b(a,3,0)-b(a,0,3)*b(a,1,1)*b(a,2,2)*b(a,3,0)+b(a,0,1)*b(a,1,3)*b(a,2,2)*b(a,3,0)+b(a,0,2)*b(a,1,1)*b(a,2,3)*b(a,3,0)-b(a,0,1)*b(a,1,2)*b(a,2,3)*b(a,3,0)-b(a,0,3)*b(a,1,2)*b(a,2,0)*b(a,3,1)+b(a,0,2)*b(a,1,3)*b(a,2,0)*b(a,3,1)+b(a,0,3)*b(a,1,0)*b(a,2,2)*b(a,3,1)-b(a,0,0)*b(a,1,3)*b(a,2,2)*b(a,3,1)-b(a,0,2)*b(a,1,0)*b(a,2,3)*b(a,3,1)+b(a,0,0)*b(a,1,2)*b(a,2,3)*b(a,3,1)+b(a,0,3)*b(a,1,1)*b(a,2,0)*b(a,3,2)-b(a,0,1)*b(a,1,3)*b(a,2,0)*b(a,3,2)-b(a,0,3)*b(a,1,0)*b(a,2,1)*b(a,3,2)+b(a,0,0)*b(a,1,3)*b(a,2,1)*b(a,3,2)+b(a,0,1)*b(a,1,0)*b(a,2,3)*b(a,3,2)-b(a,0,0)*b(a,1,1)*b(a,2,3)*b(a,3,2)-b(a,0,2)*b(a,1,1)*b(a,2,0)*b(a,3,3)+b(a,0,1)*b(a,1,2)*b(a,2,0)*b(a,3,3)+b(a,0,2)*b(a,1,0)*b(a,2,1)*b(a,3,3)-b(a,0,0)*b(a,1,2)*b(a,2,1)*b(a,3,3)-b(a,0,1)*b(a,1,0)*b(a,2,2)*b(a,3,3)+b(a,0,0)*b(a,1,1)*b(a,2,2)*b(a,3,3)},Human.math.inverseMat4=function(a){var b=a[0],c=a[1],d=a[2],e=a[3],f=a[4],g=a[5],h=a[6],i=a[7],j=a[8],k=a[9],l=a[10],m=a[11],n=a[12],o=a[13],p=a[14],q=a[15],r=Human.math.identityMat4();r[0]=k*p*i-o*l*i+o*h*m-g*p*m-k*h*q+g*l*q,r[1]=o*l*e-k*p*e-o*d*m+c*p*m+k*d*q-c*l*q,r[2]=g*p*e-o*h*e+o*d*i-c*p*i-g*d*q+c*h*q,r[3]=k*h*e-g*l*e-k*d*i+c*l*i+g*d*m-c*h*m,r[4]=n*l*i-j*p*i-n*h*m+f*p*m+j*h*q-f*l*q,r[5]=j*p*e-n*l*e+n*d*m-b*p*m-j*d*q+b*l*q,r[6]=n*h*e-f*p*e-n*d*i+b*p*i+f*d*q-b*h*q,r[7]=f*l*e-j*h*e+j*d*i-b*l*i-f*d*m+b*h*m,r[8]=j*o*i-n*k*i+n*g*m-f*o*m-j*g*q+f*k*q,r[9]=n*k*e-j*o*e-n*c*m+b*o*m+j*c*q-b*k*q,r[10]=f*o*e-n*g*e+n*c*i-b*o*i-f*c*q+b*g*q,r[11]=j*g*e-f*k*e-j*c*i+b*k*i+f*c*m-b*g*m,r[12]=n*k*h-j*o*h-n*g*l+f*o*l+j*g*p-f*k*p,r[13]=j*o*d-n*k*d+n*c*l-b*o*l-j*c*p+b*k*p,r[14]=n*g*d-f*o*d-n*c*h+b*o*h+f*c*p-b*g*p,r[15]=f*k*d-j*g*d+j*c*h-b*k*h-f*c*l+b*g*l;for(var s=1/(n*k*h*e-j*o*h*e-n*g*l*e+f*o*l*e+j*g*p*e-f*k*p*e-n*k*d*i+j*o*d*i+n*c*l*i-b*o*l*i-j*c*p*i+b*k*p*i+n*g*d*m-f*o*d*m-n*c*h*m+b*o*h*m+f*c*p*m-b*g*p*m-j*g*d*q+f*k*d*q+j*c*h*q-b*k*h*q-f*c*l*q+b*g*l*q),t=0;16>t;++t)r[t]*=s;return r},Human.math.traceMat4=function(a){return a[0]+a[5]+a[10]+a[15]},Human.math.translationMat4v=function(a){var b=Human.math.identityMat4();return b[12]=a[0],b[13]=a[1],b[14]=a[2],b},Human.math.translationMat4c=function(a,b,c){return Human.math.translationMat4v([a,b,c])},Human.math.translationMat4s=function(a){return Human.math.translationMat4c(a,a,a)},Human.math.rotationMat4v=function(a,b){var c,d,e,f,g,h,i,j,k,l=Human.math.normalizeVec4([b[0],b[1],b[2],0]),m=Math.sin(a),n=Math.cos(a),o=1-n,p=l[0],q=l[1],r=l[2];c=p*p,d=q*q,e=r*r,f=p*q,g=q*r,h=r*p,i=p*m,j=q*m,k=r*m;var s=Human.math.mat4();return s[0]=o*c+n,s[1]=o*f+k,s[2]=o*h-j,s[3]=0,s[4]=o*f-k,s[5]=o*d+n,s[6]=o*g+i,s[7]=0,s[8]=o*h+j,s[9]=o*g-i,s[10]=o*e+n,s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,s},Human.math.rotationEulerMat4v=function(a,b,c){var d=Math.cos(-b),e=Math.sin(-b),f=Math.cos(-c),g=Math.sin(-c),h=Math.cos(-a),i=Math.sin(-a);return[d*f,e*i-d*g*h,d*g*i+e*h,0,g,f*h,-f*i,0,-e*f,e*g*h+d*i,-e*g*i+d*h,0,0,0,0,1]},Human.math.rotationMat4c=function(a,b,c,d){return Human.math.rotationMat4v(a,[b,c,d])},Human.math.scalingMat4v=function(a){var b=Human.math.identityMat4();return b[0]=a[0],b[5]=a[1],b[10]=a[2],b},Human.math.scalingMat4c=function(a,b,c){return Human.math.scalingMat4v([a,b,c])},Human.math.scalingMat4s=function(a){return Human.math.scalingMat4c(a,a,a)},Human.math.lookAtMat4v=function(a,b,c){var d=[a[0],a[1],a[2],0],e=[b[0],b[1],b[2],0],f=[c[0],c[1],c[2],0],g=Human.math.normalizeVec4(Human.math.subVec4(e,d)),h=Human.math.normalizeVec4(f),i=Human.math.normalizeVec4(Human.math.cross3Vec4(g,h));h=Human.math.normalizeVec4(Human.math.cross3Vec4(i,g));var j=Human.math.mat4();return j[0]=i[0],j[1]=h[0],j[2]=-g[0],j[3]=0,j[4]=i[1],j[5]=h[1],j[6]=-g[1],j[7]=0,j[8]=i[2],j[9]=h[2],j[10]=-g[2],j[11]=0,j[12]=0,j[13]=0,j[14]=0,j[15]=1,j=Human.math.mulMat4(j,Human.math.translationMat4v(Human.math.negateVector4(d)))},Human.math.lookAtMat4c=function(a,b,c,d,e,f,g,h,i){return Human.math.lookAtMat4v([a,b,c],[d,e,f],[g,h,i])},Human.math.orthoMat4v=function(a,b){var c=[a[0],a[1],a[2],0],d=[b[0],b[1],b[2],0],e=Human.math.addVec4(d,c),f=Human.math.subVec4(d,c),g=Human.math.mat4();return g[0]=2/f[0],g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=2/f[1],g[6]=0,g[7]=0,g[8]=0,g[9]=0,g[10]=-2/f[2],g[11]=0,g[12]=-e[0]/f[0],g[13]=-e[1]/f[1],g[14]=-e[2]/f[2],g[15]=1,g},Human.math.orthoMat4c=function(a,b,c,d,e,f){return Human.math.orthoMat4v([a,c,e],[b,d,f])},Human.math.frustumMat4v=function(a,b){var c=[a[0],a[1],a[2],0],d=[b[0],b[1],b[2],0],e=Human.math.addVec4(d,c),f=Human.math.subVec4(d,c),g=2*c[2],h=Human.math.mat4();return h[0]=g/f[0],h[1]=0,h[2]=0,h[3]=0,h[4]=0,h[5]=g/f[1],h[6]=0,h[7]=0,h[8]=e[0]/f[0],h[9]=e[1]/f[1],h[10]=-e[2]/f[2],h[11]=-1,h[12]=0,h[13]=0,h[14]=-g*d[2]/f[2],h[15]=0,h},Human.math.frustumMatrix4=function(a,b,c,d,e,f){return Human.math.frustumMat4v([a,c,e],[b,d,f])},Human.math.perspectiveMatrix4=function(a,b,c,d){var e=new Array(4),f=new Array(4);return e[2]=c,f[2]=d,f[1]=e[2]*Math.tan(a/2),e[1]=-f[1],f[0]=f[1]*b,e[0]=-f[0],Human.math.frustumMat4v(e,f)},Human.math.transformPoint3=function(a,b){return[a[0]*b[0]+a[4]*b[1]+a[8]*b[2]+a[12],a[1]*b[0]+a[5]*b[1]+a[9]*b[2]+a[13],a[2]*b[0]+a[6]*b[1]+a[10]*b[2]+a[14],a[3]*b[0]+a[7]*b[1]+a[11]*b[2]+a[15]]},Human.math.transformPoint4=function(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]]},Human.math.transformPoints3=function(a,b){for(var c=new Array(b.length),d=b.length,e=0;d>e;e++)c[e]=Human.math.transformPoint3(a,b[e]);return c},Human.math.transformVector3=function(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]]},Human.math.projectVec4=function(a){var b=1/a[3];return[a[0]*b,a[1]*b,a[2]*b,1]},Human.math.Plane3=function(a,b,c){if(this.normal=[0,0,1],this.offset=0,a&&b&&(this.normal[0]=a[0],this.normal[1]=a[1],this.normal[2]=a[2],this.offset=b,c)){var d=Math.sqrt(this.normal[0]*this.normal[0]+this.normal[1]*this.normal[1]+this.normal[2]*this.normal[2]);d>0&&(d=1/d,this.normal[0]*=d,this.normal[1]*=d,this.normal[2]*=d,this.offset*=d)}},Human.math.MAX_DOUBLE=Number.POSITIVE_INFINITY,Human.math.MIN_DOUBLE=Number.NEGATIVE_INFINITY,Human.math.MAX_NUMBER=Number.POSITIVE_INFINITY,Human.math.MIN_NUMBER=Number.NEGATIVE_INFINITY,Human.math.Box3=function(a,b){this.min=a||[Human.math.MAX_DOUBLE,Human.math.MAX_DOUBLE,Human.math.MAX_DOUBLE],this.max=b||[Human.math.MIN_DOUBLE,Human.math.MIN_DOUBLE,Human.math.MIN_DOUBLE],this.init=function(a,b){for(var c=0;3>c;++c)this.min[c]=a[c],this.max[c]=b[c];return this},this.fromPoints=function(a){for(var b=[],c=0;c<a.length;c++)b.push([a[c][0]/a[c][3],a[c][1]/a[c][3],a[c][2]/a[c][3]]);for(a=b,c=0;c<a.length;c++)for(var d=a[c],e=0;3>e;e++)d[e]<this.min[e]&&(this.min[e]=d[e]),d[e]>this.max[e]&&(this.max[e]=d[e]);return this},this.isEmpty=function(){return this.min[0]>=this.max[0]&&this.min[1]>=this.max[1]&&this.min[2]>=this.max[2]},this.getCenter=function(){return[(this.max[0]+this.min[0])/2,(this.max[1]+this.min[1])/2,(this.max[2]+this.min[2])/2]},this.getSize=function(){return[this.max[0]-this.min[0],this.max[1]-this.min[1],this.max[2]-this.min[2]]},this.getFacesAreas=function(){var a=this.size;return[a[1]*a[2],a[0]*a[2],a[0]*a[1]]},this.getSurfaceArea=function(){var a=this.getFacesAreas();return 2*(a[0]+a[1]+a[2])},this.getVolume=function(){var a=this.size;return a[0]*a[1]*a[2]},this.getOffset=function(a){for(var b=0;3>b;++b)this.min[b]-=a,this.max[b]+=a;return this}},Human.math.AxisBox3=function(a,b){this.verts=[[a[0],a[1],a[2]],[b[0],a[1],a[2]],[b[0],b[1],a[2]],[a[0],b[1],a[2]],[a[0],a[1],b[2]],[b[0],a[1],b[2]],[b[0],b[1],b[2]],[a[0],b[1],b[2]]],this.toBox3=function(){for(var a=new Human.math.Box3,b=0;8>b;b++)for(var c=this.verts[b],d=0;3>d;d++)c[d]<a.min[d]&&(a.min[d]=c[d]),c[d]>a.max[d]&&(a.max[d]=c[d])},this.toBoundary=function(){for(var a=new Human.math.Box3,b=0;8>b;b++)for(var c=this.verts[b],d=0;3>d;d++)c[d]<a.min[d]&&(a.min[d]=c[d]),c[d]>a.max[d]&&(a.max[d]=c[d])}},Human.math.Sphere3=function(a,b){this.center=[a[0],a[1],a[2]],this.radius=b,this.isEmpty=function(){return 0===this.radius},this.surfaceArea=function(){return 4*Math.PI*this.radius*this.radius},this.getVolume=function(){return 4/3*Math.PI*this.radius*this.radius*this.radius}},Human.math.billboardMat=function(a){var b=[Human.math.getColMat4(a,0),Human.math.getColMat4(a,1),Human.math.getColMat4(a,2)],c=[Human.math.lenVec4(b[0]),Human.math.lenVec4(b[1]),Human.math.lenVec4(b[2])],d=Human.math.rcpVec3(c),e=Human.math.scalingMat4v(c);b[0]=Human.math.mulVec4Scalar(b[0],d[0]),b[1]=Human.math.mulVec4Scalar(b[1],d[1]),b[2]=Human.math.mulVec4Scalar(b[2],d[2]);var f=Human.math.identityMat4();return Human.math.setRowMat4(f,0,b[0]),Human.math.setRowMat4(f,1,b[1]),Human.math.setRowMat4(f,2,b[2]),Human.math.mulMat4(f,e)},Human.math.identityQuaternion=function(){return[0,0,0,1]},Human.math.angleAxisQuaternion=function(a,b){var c=b/2,d=Math.sin(c);return[d*a[0],d*a[1],d*a[2],Math.cos(c)]},Human.math.mulQuaternions=function(a,b){return[a[3]*b[0]+a[0]*b[3]+a[1]*b[2]-a[2]*b[1],a[3]*b[1]+a[1]*b[3]+a[2]*b[0]-a[0]*b[2],a[3]*b[2]+a[2]*b[3]+a[0]*b[1]-a[1]*b[0],a[3]*b[3]-a[0]*b[0]-a[1]*b[1]-a[2]*b[2]]},Human.math.newMat4FromQuaternion=function(a){var b=2*a[0],c=2*a[1],d=2*a[2],e=b*a[3],f=c*a[3],g=d*a[3],h=b*a[0],i=c*a[0],j=d*a[0],k=c*a[1],l=d*a[1],m=d*a[2],n=Human.math.identityMat4();return Human.math.setCellMat4(n,0,0,1-(k+m)),Human.math.setCellMat4(n,0,1,i-g),Human.math.setCellMat4(n,0,2,j+f),Human.math.setCellMat4(n,1,0,i+g),Human.math.setCellMat4(n,1,1,1-(h+m)),Human.math.setCellMat4(n,1,2,l-e),Human.math.setCellMat4(n,2,0,j-f),Human.math.setCellMat4(n,2,1,l+e),Human.math.setCellMat4(n,2,2,1-(h+k)),n},Human.math.slerp=function(a,b,c){var d=.0174532925*b[3],e=.0174532925*c[3],f=d*e+b[0]*c[0]+b[1]*c[1]+b[2]*c[2];if(Math.abs(f)>=1)return[b[0],b[1],b[2],b[3]];var g=Math.acos(f),h=Math.sqrt(1-f*f);if(Math.abs(h)<.001)return[.5*b[0]+.5*c[0],.5*b[1]+.5*c[1],.5*b[2]+.5*c[2],.5*b[3]+.5*c[3]];var i=Math.sin((1-a)*g)/h,j=Math.sin(a*g)/h;return[b[0]*i+c[0]*j,b[1]*i+c[1]*j,b[2]*i+c[2]*j,57.295779579*(d*i+e*j)]},Human.math.normalizeQuaternion=function(a){var b=Human.math.lenVec3([a[0],a[1],a[2]]);return[a[0]/b,a[1]/b,a[2]/b,a[3]/b]},Human.math.conjugateQuaternion=function(a){return[-a[0],-a[1],-a[2],a[3]]},Human.math.angleAxisFromQuaternion=function(a){a=Human.math.normalizeQuaternion(a);var b=2*Math.acos(a[3]),c=Math.sqrt(1-a[3]*a[3]);return.001>c?{x:a[0],y:a[1],z:a[2],angle:b}:{x:a[0]/c,y:a[1]/c,z:a[2]/c,angle:b}},Human.math.getBoundaryCenter=function(a){return[.5*(a.xmax+a.xmin),.5*(a.ymax+a.ymin),.5*(a.zmax+a.zmin)]},Human.math.getBoundaryDiag=function(a){return Math.abs(Human.math.lenVec3(Human.math.subVec3([a.xmax,a.ymax,a.zmax],[a.xmin,a.ymin,a.zmin])))}}(),Human.utils.concurrentMapIterate=function(a,b,c,d,e){"use strict";function f(){++k>=j&&!l&&d()}function g(a){l||(l=!0,e(a))}var h=[];for(var i in a)a.hasOwnProperty(i)&&h.push(i);var j=h.length;if(0===j)return void d();var k=0,l=!1;if(b)for(var m=0,n=h.length;n>m;m++)c.call(b,h[m],a[h[m]],f,g);else for(m=0,n=h.length;n>m;m++)c(h[m],a[h[m]],f,g)},Human.utils.ConcurrentTasks=function(){"use strict";function a(){--f<=0&&!g&&c()}function b(a){g||(g=!0,d(a))}var c,d,e=[],f=0,g=!1;this.add=function(a){e[f++]=a},this.go=function(h,i){if(c=h,d=i,g=!1,f>0)for(var j=0,k=f;k>j;j++)e[j](a,b);else h()}},Human.utils.ArrayIteration=function(a,b,c,d){"use strict";function e(){0===a.length?c&&c():window.setTimeout(g,1)}function f(a){h||(h=!0,d?d(a):c&&c())}function g(){a.length>0&&b(a.shift(),e,f)}this.push=function(b){a.push(b),window.setTimeout(g,1)};var h=!1;return 0===a.length?void(c&&c()):void window.setTimeout(g,1)},Human.utils.TagMap=function(){"use strict";var a,b={},c={},d={};this.addItem=function(e,f,g){for(var h,i,j,k=0,l=f.length;l>k;k++)h=f[k],i=b[h],i||(i=b[h]={}),i[e]=g,j=c[h],j?c[h]++:c[h]=1;d[e]=g,a&&(a=null)},this.findItems=function(b){b=b||{};var c=b.tags||[],d=c.join("."),e=b.matching||"any";a||(a={});var f=a[e];f||(f=a[e]={});var g=f[d];if(!g){switch(e){case"most":g=this._findHitsMost(c);break;case"atLeast":g=this._findHitsAtLeast(c);break;case"any":g=this._findHitsAny(c)}f[d]=g}return g},this._findHitsMost=function(a){for(var c,d,e,f={},g=0,h=a.length;h>g;g++)if(c=a[g],d=b[c])for(var i in d)if(d.hasOwnProperty(i)){var j=f[i];j=j?++f[i]:f[i]=1,(!e||j>f[e])&&(e=i)}var k={};return e&&(k[e]=d[e]),k},this._findHitsAtLeast=function(a){for(var c,d,e={},f=a.length,g={},h=0,i=a.length;i>h;h++)if(c=a[h],d=b[c])for(var j in d)if(d.hasOwnProperty(j)){var k=e[j];k=k?++e[j]:e[j]=1,k===f&&(g[j]=d[j])}return g},this._findHitsAny=function(a){for(var c,d,e={},f=0,g=a.length;g>f;f++)if(c=a[f],d=b[c])for(var h in d)d.hasOwnProperty(h)&&(e[h]=d[h]);return e},this.removeItem=function(e){var f,g;for(var h in b)b.hasOwnProperty(h)&&(f=b[h],g=f[e],g&&(delete f[e],0===--c[h]&&(delete b[h],delete c[h])));delete d[e],a&&(a=null)}},Human.utils.TagMapList=function(){"use strict";var a,b={},c={},d={};this.addItem=function(e,f,g){for(var h,i,j,k=0,l=f.length;l>k;k++)h=f[k],i=b[h],i||(i=b[h]={}),i[e]=g,j=c[h],j?c[h]++:c[h]=1;d[e]=g,a&&(a=null)},this.findItems=function(b){b=b||{};var c=b.tags||[],d=c.join("."),e=b.matching||"any";a||(a={});var f=a[e];f||(f=a[e]={});var g=f[d];if(!g){switch(e){case"most":g=this._findHitsMost(c);break;case"atLeast":g=this._findHitsAtLeast(c);break;case"any":g=this._findHitsAny(c);break;case"except":g=this._findHitsExcept(c)}f[d]=g}return g},this._findHitsMost=function(a){for(var c,d,e,f={},g=0,h=a.length;h>g;g++)if(c=a[g],d=b[c])for(var i in d)if(d.hasOwnProperty(i)){var j=f[i];j=j?++f[i]:f[i]=1,(!e||j>f[e])&&(e=i)}var k=[];return e&&k.push(d[e]),k},this._findHitsAtLeast=function(a){for(var c,d,e={},f=a.length,g={},h=[],i=0,j=a.length;j>i;i++)if(c=a[i],d=b[c])for(var k in d)if(d.hasOwnProperty(k)&&!g[k]){var l=e[k];l=l?++e[k]:e[k]=1,l===f&&(h.push(d[k]),g[k]=!0)}return h},this._findHitsAny=function(a){for(var c,d,e={},f=[],g=0,h=a.length;h>g;g++)if(c=a[g],d=b[c])for(var i in d)d.hasOwnProperty(i)&&(e[i]||(f.push(d[i]),e[i]=!0));return f},this._findHitsExcept=function(a){var c=[],d={};for(var e in b)if(b.hasOwnProperty(e))for(var f=0,g=a.length;g>f;f++)e!==a[f]&&d[e]!==!0&&(c.push(b[e]),d[e]=!0);return c},this.removeItem=function(e){var f,g;for(var h in b)b.hasOwnProperty(h)&&(f=b[h],g=f[e],g&&(delete f[e],0===--c[h]&&(delete b[h],delete c[h])));delete d[e],a&&(a=null)}},Human.utils.Map=function(a,b){"use strict";this.items=a||[];var c=b||0,d=c+1;this.addItem=function(){var a;if(2===arguments.length){var b=arguments[0];if(a=arguments[1],this.items[b])throw"ID clash: '"+b+"'";return this.items[b]=a,b}for(;;){a=arguments[0];var c=d++;if(!this.items[c])return this.items[c]=a,c}},this.removeItem=function(a){var b=this.items[a];return delete this.items[a],b}},Human.utils.IDPool=function(a){"use strict";a=a||{};var b=a.prefix||"id",c=b.length,d=[],e={},f={};this.getId=function(a){if(a){if(e[a]||f[a])throw"ID already in use: "+a;return e[a]=!0,a}for(var c,g=0,h=d.length;h>g;g++)if(!d[g]&&(c=b+g,!e[c]))return d[g]=!0,f[c]=!0,c;return d.push(!0),c=b+(d.length-1),f[c]=!0,c},this.containsId=function(a){return void 0!==e[a]||void 0!==f[a]},this.putId=function(a){e[a]?delete e[a]:(d[parseInt(a.substr(c))]=!1,delete f[a])}},Human.utils.Loader=function(){"use strict";this._loadedModelLibs={},this.configure=function(){},this.load=function(a,b,c,d,e,f){if(this._loadedModelLibs[b]=this._loadedModelLibs[b]||{},this._loadedModelLibs[b][c])return Human.log.warn("Human.utils.Loader.load","Library '"+c+"' already loaded for model '"+b+"' - not reloading"),void e();var g=this,h=function(){g._loadedModelLibs[b][c]=!0,e()};this._load(a,b,c,d,h,f)},this._load=function(a,b,c,d,e){Human.log.error("Human.utils.Loader._load not implemented"),e()},this.unload=function(a){var b=this._loadedModelLibs[a];if(b){for(var c in b)b.hasOwnProperty(c)&&this._unload(a+"."+c);delete this._loadedModelLibs[a]}},this._unload=function(){Human.log.error("Human.utils.Loader._unload","This method needs to be implemented")}},function(){"use strict";function a(a,b){this.procName=a,this.callId=b}var b=Human.rpc={};b._procedures={};var c=[];a.prototype.setResult=function(a){for(var b=0,d=c.length;d>b;b++)c[b](this.callId,a)},a.prototype.info=function(a){Human.log.info(this.procName,a)},a.prototype.warn=function(a){Human.log.warn(this.procName,a)},a.prototype.error=function(a){Human.log.error(this.procName,a)},b.define=function(c,d){b._procedures[c]&&Human.log.warn("Human.rpc.define","Redefining procedure: "+c),b._procedures[c]=function(b,e){d.call(new a(c,b),e||{})}},b.onResult=function(a){c.push(a)},b.call=function(a,c,d){var e=b._procedures[c];return e?void e(a,d):void Human.log.warn("Human.rpc.call","Target procedure not found: "+name)}}(),function(){"use strict";var a=Human.events={},b={},c=0,d=[{}],e={},f={};a.addBinder=function(a,c){(b[a]||(b[a]=[])).push(c)},a.createChannel=function(b){var c=d.length;return d.push({}),b&&b.enabled&&a.enableEventChannel(c,b.enabled),c},a.enableChannel=function(a,b){e[a]=b},a.onEvent=a.on=function(){var a,g,h,i;if("number"==typeof arguments[0]){if(a>d.length-1)return void Human.log.error("Human_event.onEvent","Channel not created: "+a+" - should be created first with Human.events.createChannel");a=arguments[0],g=arguments[1],h=arguments[2],i=arguments[3]}else if("object"==typeof arguments[0]){var j=arguments[0];g=j.type,h=j.fn;var k=b[g];if(k)for(var l=j.mask||{},m=0,n=k.length;n>m;m++)k[m](l,h);a=void 0!==j.channel&&null!==j.channel?j.channel:c,i=j.options}else a=c,g=arguments[0],h=arguments[1],i=arguments[2];e[a]=i&&void 0!==i.enable&&null!==i.enable?i.enable:!0,i=i||{};var o=d[a];o||(o=d[a]={});var p=o[g];p||(p=[],o[g]=p);var q={fn:h,priority:void 0===i.priority?p.length:i.priority,once:i.once};for(m=0;m<p.length;m++)if(p[m].priority>q.priority)return void p.splice(m,0,q);p.push(q),f[g]&&q.fn(f[g])},a.once=function(b,c){var d=function(e){a.off(b,d),c(e)};a.on(b,d)},a.fireEvent=a.fire=function(a,b,c){for(var g,h,i=0,j=d.length;j>i;i++)if(e[i]&&(g=d[i],h=g[a])){b||(b={});for(var k,l,m=0,n=h.length;n>m;m++){l=h[m];try{l.fn(b),l.once&&(k||(k=[]),k.push(m))}catch(o){Human.log.error(o)}}if(k)for(m=k.length-1;m>=0;m--)h.splice(k[m])}c&&(f[a]=b)},a.unEvent=a.off=function(){var a=c,b=arguments[0],e=arguments[1],f=d[a];f||(f=d[a]={});var g=f[b];g||(g=[],f[b]=g);for(var h=g.length;h--;)g[h].fn===e&&g.splice(h,1)}}(),function(){"use strict";function a(a){var c=b[a];if(c){var d=c[0],e=c[1];Human.unEvent(d,e),delete b[a]}}var b={};Human.rpc.define("events.on",function(a){var c=this,d=this.id;if(d&&b[d])return void this.error("an event is already bound to this ID: '"+d+"'");var e=a.type;if(!e)return void this.error("parameter expected: 'type'");var f=function(a){c.setResult(a)};a.mask?(a.fn=f,Human.events.on(a)):Human.events.on(a.type,f),d&&(b[d]=[e,f])}),Human.rpc.define("events.once",function(a){var b=this,c=a.type;return c?void Human.events.once(c,function(a){b.setResult(a)}):void this.error("parameter expected: 'type'")}),Human.rpc.define("events.fire",function(a){Human.events.fire(a.eventName,a.params)}),Human.rpc.define("events.off",function(c){if(c.id)a(c.id);else if(c.ids)for(var d=c.ids,e=0,f=d.length;f>e;e++)a(d[e]);else for(var g in b)b.hasOwnProperty(g)&&a(g)})}(),function(){"use strict";function a(a){return a.length<45?a+"                                                           ".substr(0,45-a.length):a}var b=Human.log={};b.LOG_NONE=0,b.LOG_DEBUG=1,b.LOG_INFO=2,b.LOG_WARN=3,b.LOG_ERROR=4;var c,d=["none","debug","info","warn","error"],e=[],f=200,g={};b.setLevel=function(a){c=a},b.getLevel=function(){return c},b.setLevel(b.LOG_INFO),b.log=function(a,h){switch(h=void 0===h||null===h?b.INFO:h){case b.LOG_DEBUG:c<=b.LOG_DEBUG&&window.console&&window.console.debug&&window.console.debug(a);break;case b.LOG_ERROR:c<=b.LOG_ERROR&&window.console&&window.console.error&&window.console.error(a);break;case b.LOG_INFO:c<=b.LOG_INFO&&window.console&&window.console.info&&window.console.info(a);break;case b.LOG_WARN:c<=b.LOG_WARN&&window.console&&window.console.warn&&window.console.warn(a)}var i={message:a,level:d[h]};for(var j in g)g.hasOwnProperty(j)&&Human.events.fire(j,i);e.length>f&&(e.length=0,e.push({message:"Logging buffer exceeded max length of "+f+" - messages to this point were flushed",level:d[b.LOG_WARN]})),e.push(i)},b.debug=function(){b.log(1===arguments.length?arguments[0]:"["+a(arguments[0])+"] "+arguments[1],b.LOG_DEBUG)},b.error=function(){b.log(1===arguments.length?arguments[0]:"["+a(arguments[0])+"] "+arguments[1],b.LOG_ERROR)},b.info=function(){b.log(1===arguments.length?arguments[0]:"["+a(arguments[0])+"] "+arguments[1],b.LOG_INFO)},b.warn=function(){b.log(1===arguments.length?arguments[0]:"["+a(arguments[0])+"] "+arguments[1],b.LOG_WARN)},Human.events.on("error",function(a){b.error(a.message)}),Human.rpc.define("log.createReporter",function(a){if(!a.id)return void b.error("param expected: id");var c="log.reporters."+a.id;if(!g[c]){g[c]={};for(var d=0,f=e.length;f>d;d++)Human.events.fire(c,e[d])}}),Human.rpc.define("log.destroyReporter",function(a){if(!a.id)return void b.error("param expected: id");var c="log.reporters."+a.id;delete g[c]})}(),function(){"use strict";var a=Human.properties={},b=new Human.utils.IDPool;a.properties={};var c={},d={},e={};a.subscribe=function(f){f=f||{};var g=f.propId;if(!g)return Human.log.error("Human.properties.subscribe","Param expected: propId"),null;var h=f.callback;if(!h)return Human.log.error("Human.properties.subscribe","Param expected: callback"),null;if(f.subId&&b.containsId(f.subId))return Human.log.error("Human.properties.subscribe","Subscription already exists with this ID: "+f.subId),null;var i=f.value,j=b.getId(f.subId),k=a.properties[g];if(k)return i&&(a.properties[g]=i),c[j]=h,e[j]=g,h(i),j;
  var l=d[g]||(d[g]={});return l[j]=h,(void 0===i||null===i)&&(i={}),a.properties[g]=i,c[j]=h,e[j]=g,h(i),j},a.resubscribe=function(b,f){var g=c[b];if(!g)return void Human.log.warn("Human.properties.resubscribe","Subscription not found: '"+b+"'");var h=e[b],i=a.properties[f];h&&i&&(d[h]&&delete d[h][b],(d[f]||(d[f]={}))[b]=g,e[b]=f,g(i))},a.set=function(b){var c,e;for(var f in b)if(b.hasOwnProperty(f)&&(c=b[f],a.properties[f]=c,e=d[f]))for(var g in e)e.hasOwnProperty(g)&&e[g](c)},a.unsubscribe=function(a){var b=e[a];b&&(delete e[a],delete d[b][a])},a.query=function(b){if(!b)return a.properties;var c;if(b){var d=new RegExp(b);c={};for(var e in a.properties)a.properties.hasOwnProperty(e)&&d.test(e)&&(c[e]=a.properties[e])}return c}}(),function(){"use strict";Human.rpc.define("properties.set",function(a){var b=a.props||a;Human.properties.set(b||{})}),Human.rpc.define("properties.subscribe",function(a){var b=this;Human.properties.subscribe({subId:a.subId,propId:"myProperty",callback:function(a){b.setResult(a)}})}),Human.rpc.define("properties.resubscribe",function(a){Human.properties.resubscribe(a.subId,a.propId)}),Human.rpc.define("properties.unsubscribe",function(a){Human.properties.unsubscribe(a.subId)}),Human.rpc.define("properties.query",function(a){this.setResult(Human.properties.query(a.regex))})}(),function(){"use strict";var a=Human.cookies={};a.setCookie=function(a,b,c){var d;if(c){var e=new Date;e.setTime(e.getTime()+24*c*60*60*1e3),d="; expires="+e.toGMTString()}else d="";document.cookie=a+"="+b+d+"; path=/"},a.getCookie=function(a){for(var b=a+"=",c=document.cookie.split(";"),d=0;d<c.length;d++){for(var e=c[d];" "===e.charAt(0);)e=e.substring(1,e.length);if(0===e.indexOf(b))return e.substring(b.length,e.length)}return null},a.eraseCookie=function(b){a.setCookie(b,"",-1)}}(),function(){"use strict";var a,b,c,d=Human.request={};d.getHashStr=function(){return window.location.hash},d.getHashParams=function(){if(!b||a!==window.location.hash){b={};for(var c,d=window.location.hash.slice(1),e=d.split(","),f=0,g=e.length;g>f;f++)c=e[f].split("="),b[c[0]]=c[1];a=window.location.hash}return b},d.getHashParam=function(c){return b&&a===window.location.hash||d.getHashParams(),b[c]},d.getSearchStr=function(){return window.location.search},d.getSearchParams=function(){if(!c){c={};for(var a,b=window.location.search.slice(1),d=b.split("&"),e=0,f=d.length;f>e;e++)a=d[e].split("="),c[a[0]]=a[1]}return c},d.getSearchParam=function(a){return c||d.getSearchParams(),c[a]}}(),function(){"use strict";Human.rpc.define("request.getParams",function(){this.setResult({hashParams:Human.request.getHashParams(),hashStr:Human.request.getHashStr(),searchParams:Human.request.getSearchParams(),searchStr:Human.request.getSearchStr()})})}(),function(){"use strict";function a(b,c,d,e,f){function g(a,b){e.unshift({path:a,params:b||{}})}function h(){if(0===e.length)j=g,f();else{var b=e.pop();if(b.path){var c=b.path,d=b.params;Human.log.info("Human.init","Loading init script: "+c),require([c],function(b){a(c,b,d,[],h)})}else b.callback&&b.callback(h)}}j=g,c?c.call(new Human.init.ModuleScope(b),d,function(){h()},function(a){Human.log.error("Error in init module: "+b+" : "+a),h()}):h()}var b=Human.init={},c=[],d=!1;b.bookmark={},b.cameraBookmark={};var e=Human.request.getHashParams(),f=location.origin+location.pathname.substring(0,location.pathname.lastIndexOf("/"))+"/lib/scenejs/plugins",g="true"===e.validateShaders,h="false"!==e.enableVAO,i="false"!==e.enableInterleaving;SceneJS.setConfigs({texturing:{waitForLoad:!0},pluginPath:f,statusPopups:!1,validateShaders:g,enableVAO:h,enableInterleaving:i}),function(){function a(a,f){d||(d=!0,"true"===e.noErrorRedirect?b():(c(a.errorName||"ERROR",a.exception||a.message),-1===document.URL.indexOf("embedded.html")&&window.location.replace("webgl-error.html?error="+(a.errorName||"ERROR")+"&message=["+f+"] "+(a.exception||a.message))))}function b(){alert("An error has occurred; 'noErrorRedirect=true' is specified on URL, so logging debug info to console without redirecting to recovery page")}function c(a,b){jQuery.post("/ws/human-error",{category:a,log:(Human.log.messages||[]).join(),message:b})}var d;SceneJS.bind("error",function(b){a(b,"WEBGL")}),Human.onError(function(b){a(b,"HUMAN")}),window.__testError=function(){a({errorName:"A mock error",message:"A mock error has occurred for testing purposes"},"WEBGL")}}(),require.config({waitSeconds:30}),b.saveReset=function(){var a=Human.bookmarks.capture(),c=a.modules;if(c){var d=c.active;d&&d.length>1&&(c.active=[c.active[0]])}b.bookmark=a,b.bookmarkCamera=Human.bookmarks.capture({camera:!0})};var j;b.require=function(a,b){return d?(Human.log.error("Human.init.require","Engine already started, ignoring script: "+a),this):(j?j(a,b||{}):c.unshift({path:a,params:b||{}}),this)},b.step=function(a){return d?(Human.log.error("Human.init.stage","Engine already started, ignoring"),this):(c.unshift({callback:a}),this)},b.reset=function(a){return b.bookmark?void Human.bookmarks.restore(b.bookmark,function(){Human.events.fire("init.reset"),a&&a()},function(b){Human.log.error("Human.init.reset","Reset failed: "+b),a&&a()}):(Human.log.error("Human.init.reset","Bookmark for reset was not captured"),void(a&&a()))},b.resetCamera=function(a){var c,d,e=0,f=Human.modules.activeModules;for(var g in f)f.hasOwnProperty(g)&&(d=f[g],d.camera&&d.timeActivated>e&&(c=d));return c?void Human.view.camera.fly.flyTo(c.camera,a):b.bookmark?void Human.view.camera.fly.flyTo(b.bookmark.camera,a):(Human.log.error("Human.init.resetCamera","Bookmark for reset was not captured"),void(a&&a()))},b.reload=function(){window.location.reload()},b.ModuleScope=function(a){var c="[Init script "+a+"] ";b.log={info:function(a){Human.log.info(c,a)},warn:function(a){Human.log.warn(c,a)},error:function(a){Human.log.error(c,a)}}},b.start=function(e,f){b.require(e),Human.renderer.init(function(){Human.events.fire("loaded"),a(null,null,null,c,function(){d=!0,b.saveReset(),Human.events.fire("started"),f&&f()})})}}(),function(){"use strict";Human.rpc.define("reset",function(){var a=this;Human.init.reset(function(){a.setResult(!0)})}),Human.rpc.define("reload",function(){Human.init.reload()}),Human.rpc.define("alert",function(a){window.alert(a.message||"")})}(),function(){"use strict";var a=Human.processes={};a.processes={},a.numProcesses=0,a.startProcess=function(b){var c=b.processId;return c?a.processes[c]?void Human.log.warn("Human.processes.startProcess","Process already exists: '"+c+"'"):(b.scaleProgress=b.scaleProgress||1,a.processes[c]=b,b.numProcesses=++a.numProcesses,void Human.events.fire("processes.started",b)):void Human.log.error("Human.processes.startProcess","Param expected: processId")},a.updateProcess=function(b){var c=b.processId;return c?void(a.processes[c]&&(b.scaleProgress=b.scaleProgress||1,b.numProcesses=a.numProcesses,Human.events.fire("processes.updated",b))):void Human.log.error("Human.processes.updateProcess","Param expected: processId")},a.finishProcess=function(b){var c=b.processId;return c?a.processes[c]?(delete a.processes[c],b.numProcesses=--a.numProcesses,void Human.events.fire("processes.finished",b)):void Human.log.warn("Human.processes.finishProcess","Process not found: '"+c+"'"):void Human.log.error("Human.processes.finishProcess","Param expected: processId")},a.failProcess=function(b){var c=b.processId;return c?a.processes[c]?(delete a.processes[c],b.numProcesses=--a.numProcesses,void Human.events.fire("processes.failed",b)):void Human.log.warn("Human.processes.failProcess","Process not found: '"+c+"'"):void Human.log.error("Human.processes.failProcess","Param expected: processId")}}(),function(){"use strict";function a(a,b,c,d,e){console.log("Human.net#loadArrayBuffer","Loading from: "+a);var f=null;$.ajax({url:a,dataType:"json",type:"HEAD",success:function(a,b,c){f=c.getResponseHeader("Content-Length")}});var g,h=new XMLHttpRequest;h.addEventListener("progress",function(a){a.lengthComputable?(void 0===g&&(g=!0),d&&d(100*(a.loaded/a.total))):(void 0===g&&(g=!1,console.log("Human.net","XHR load progress supported == NO; is server compressing this data?")),d&&d(null!==f&&void 0!==f?100*a.position/f:-1))},!1);var i=!1;h.onreadystatechange=function(){var a=null;4===h.readyState&&(h.status&&200!==h.status?c("Failed to load - status: "+h.status):(h.response?a=h.response:h.mozResponseArrayBuffer&&(a=h.mozResponseArrayBuffer),a?i||(i=!0,b(a)):c("Failed to load - status: "+h.status)))},e?(h.open("POST",a,!0),h.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),h.responseType="arraybuffer",h.send(e)):(h.open("GET",a,!0),h.responseType="arraybuffer",h.send(null))}function b(a){return m?o+a:o+a+"?v="+Human.VERSION}function c(a,b,c){m?d(a,function(a){b(e(k+a[0],a[1]))},c):$.ajax({dataType:"json",url:a,success:b}).fail(function(a,b){c("Request failed: "+b)})}function d(a,b,c){var d=l[a];d?b(d):c("Could not find data in stream at key '"+a+"'")}function e(a,b){var c=new Uint8Array(j,a,b),d=new TextDecoder("utf-8").decode(c);return JSON.parse(d)}function f(b,c,e){m?d(b,function(a){try{var b=k+a[0],d=b+a[1];c(new Int32Array(j.slice(b,d)))}catch(f){e(f)}},e):a(b,function(a){c(new Int32Array(a))},e)}function g(b,c,e){m?d(b,function(a){try{var b=k+a[0],d=b+a[1];c(new Float32Array(j.slice(b,d)))}catch(f){e(f)}},e):a(b,function(a){c(new Float32Array(a))},e)}var h=Human.net={},i="content";h.mode="stream";var j,k,l,m=!0,n="",o="",p="";h.getModuleDb=function(a,b,c){$.ajax({dataType:"json",url:i+"/modules/db/"+a,success:b,error:function(a,b,d){c(d)}})},h.getModuleManifest=function(a,b,c){$.ajax({dataType:"json",url:i+"/modules/"+a,success:b,error:function(a,b,d){c(d)}})},h.getModuleDefinition=function(a,b,c){$.ajax({dataType:"json",url:i+"/modules/"+a,success:b,error:function(a,b,d){c(d)}})},h.setMode=function(a){switch(a){case"stream":m=!0,n="";break;case"file":m=!1,n="./"+i+"/";break;default:return void Human.log.error("Human.net.setMode","Mode not supported: '"+a+"'")}h.mode=a,Human.log.info("Human.net.setMode","Mode set to: "+a)},Human.properties.subscribe({propId:"modules.contentSource",value:"stream",callback:function(a){h.setMode(a)}}),h.openModel=function(b,c,d,f){if(!m)return o="./"+i+"/states/"+b+"/",p="./"+i+"/states/"+b+"/",void d();var g="./"+i+"/streams/"+b+".bin",h=null;c&&(h=$.param(c)),a(g,function(a){j=a;var c=new Uint32Array(a,0,1),f=c[0];k=4+f,l=e(4,f),p="./"+i+"/states/"+b+"/",o=i+"/states/"+b+"/",Human.processes.finishProcess({processId:g}),d()},function(a){f(a)},function(a){Human.processes.updateProcess({processId:"modules.activate",progress:a})},h)},h.getOffset=function(){return 0},h.getAnatomyManifest=function(a,d,e){c(b("anatomy/"+a+"/manifest"),d,e)},h.getAnatomyToMedline=function(a,c,d){var e=b("anatomy/"+a+"/anatomy_to_medline");$.ajax({dataType:"json",url:e,success:c,error:function(){d&&d()}})},h.getAnimationManifest=function(a,d,e){c(b("animations/"+a+"/manifest"),d,e)},h.getGeometryManifest=function(a,d,e){c(b("geometry/"+a+"/manifest"),d,e)},h.getChapterSetManifest=function(a,d,e){c(b("chapters/"+a+"/manifest"),d,e)},h.getMaterialDir=function(a){return p+"materials/"+a+"/images/"},h.getMaterialLibrary=function(a,d,e){c(b("materials/"+a+"/outline"),d,e)},h.getAudioDir=function(a){return p+"audio/"+a+"/clips/"},h.getAudioLibrary=function(a,d,e){c(b("audio/"+a+"/manifest"),d,e)},h.getVideosLibrary=function(a,d,e){c(b("videos/"+a+"/manifest"),d,e)},h.getReflectionsDir=function(a){return p+"reflections/"+a+"/images/"},h.getReflectionsLibrary=function(a,d,e){c(b("reflections/"+a+"/outline"),d,e)},h.getLightsLibrary=function(a,d,e){c(b("lights/"+a+"/outline"),d,e)},h.getTransformsLibrary=function(a,d,e){c(b("transforms/"+a+"/outline"),d,e)},h.getAnatomyIndex=function(a,d,e,f){c(b("anatomy/"+a+"/b/"+d+"/idx.json"),e,f)},h.getAnatomyPositions=function(a,c,d,e){g(b("anatomy/"+a+"/b/"+c+"/positions.bds"),d,e)},h.getAnatomyNormals=function(a,c,d,e){g(b("anatomy/"+a+"/b/"+c+"/normals.bds"),d,e)},h.getAnatomyUVs=function(a,c,d,e){g(b("anatomy/"+a+"/b/"+c+"/uv.bds"),d,e)},h.getAnatomyIndices=function(a,c,d,e){f(b("anatomy/"+a+"/b/"+c+"/indices.bds"),d,e)},h.getStateIndex=function(a,d){c(b("index"),a,d)},h.getGeometryIndices=function(a,c,d){f(b("geometry/"+a+"/indices.bds"),c,d)},h.getGeometryUVs=function(a,c,d){g(b("geometry/"+a+"/uv.bds"),c,d)},h.getGeometryPositions=function(a,c,d){g(b("geometry/"+a+"/positions.bds"),c,d)},h.getGeometryNormals=function(a,c,d){g(b("geometry/"+a+"/normals.bds"),c,d)},h.getGeometryMesh=function(a,d,e,f){c(b("geometry/"+a+"/"+d+"/geo"),e,f)},h.getMorphIndices=function(a,c,d){f(b("animations/"+a+"/indices.bds"),c,d)},h.getMorphUVs=function(a,c,d){g(b("animations/"+a+"/uv.bds"),c,d)},h.getMorphPositions=function(a,c,d){g(b("animations/"+a+"/positions.bds"),c,d)},h.getMorphNormals=function(a,c,d){g(b("animations/"+a+"/normals.bds"),c,d)}}(),function(){"use strict";function a(a,b){var c=$("#container"),d=["-webkit-","-moz-","-ms-","-o-",""],e="linear-gradient(top, "+a+" 0%, "+b+" 100%)";c.css("background-image","-webkit-gradient(linear, left top, left bottom, color-stop(0, "+a+"), color-stop(1, "+b+")");for(var f=0;f<d.length;f++){var g=d[f]+e;c.css("background-image",g)}}function b(a){var b=document.body.className;document.body.className=b=b.replace(/bg-([^\s]*)/,"");var c="bg-"+a;document.body.className=(b+" "+c).trim()}function c(a,b){var c=[];b="boolean"==typeof b?b:!0;for(var d=0;d<a.length;d++)c.push(Math.round(a[d]*(b?255:1)));return"rgb("+c.join(",")+")"}var d=Human.renderer={};d.bgColors={black:[0,0,0,0,0,0,0,0,0,0,0,0],white:[1,1,1,1,1,1,1,1,1,1,1,1],standard:[.13,.15,.17,.13,.15,.17,.54,.58,.64,.54,.58,.64],quiz:[1,1,1,1,1,1,1,1,1,1,1,1]},Human.properties.subscribe({propId:"backgrounds",subId:"background",value:d.bgColors,callback:function(a){d.bgColors=a}});var e=function(){var a=Human.request.getSearchParam("bgstd");return a||(a=Human.cookies.getCookie("background")||"standard"),a}();d.NULL_OBJECT_ID="null-object";var f,g=!0;d.bgColor=e,d.canvas=null,d.init=function(a){d.setBGColor(d.bgColor),d.resize();var b={type:"scene",id:Human.SCENE_ROOT_ID,canvasId:Human.CANVAS_ID,transparent:!0,contextAttr:{preserveDrawingBuffer:!1,antialias:!0},nodes:[{type:"library",id:"assetLibraryRoot"},{type:"camera",id:Human.CAMERA_ID,optics:{type:"perspective",fovy:60,near:.01,far:400},pan:{x:0,y:0,z:0},nodes:[{type:"lookAt",eye:{x:0,y:0,z:.05},look:{x:0,y:0,z:0},up:{y:1},nodes:[{type:"lights",lights:[{mode:"dir",color:{r:1,g:1,b:1},dir:{x:0,y:0,z:-1},diffuse:!0,specular:!0,space:"view"}],nodes:[{type:"node",id:"annotation-labels"}]}]},{type:"lookAt",id:Human.LOOKAT_ID,eye:{x:0,y:0,z:55},look:{x:0,y:0,z:0},up:{y:1},nodes:[{id:"lights",nodes:[{id:"lights.subtree",nodes:[{id:"effect",nodes:[{id:"effect.subtree",nodes:[{type:"layer",priority:1e4,nodes:[{type:"flags",id:Human.CLIP_INDICATORS_ATTACH_ID,flags:{picking:!1}}]},{type:"clips",id:"clips-node",clips:[{mode:"disabled",space:"world"},{mode:"disabled",space:"world"},{mode:"disabled",space:"world"},{mode:"disabled",space:"world"},{mode:"disabled",space:"world"},{mode:"disabled",space:"world"}],nodes:[{type:"material",id:Human.MATERIAL_ROOT_ID,emit:0,baseColor:{r:.9,g:.9,b:.9},specularColor:{r:.9,g:.9,b:.9},specular:.9,shine:100,nodes:[{type:"node",id:d.NULL_OBJECT_ID,nodes:[{type:"geometry",positions:[0,0,0,.1,.1,.1,.2,.2,.2],indices:[0,1,2],uv:[0,0,1,0,1,1],normals:[0,1,0,0,1,0,0,1,0],primitive:"triangles"}]},{type:"shader",id:"xray",coreId:"xray",shaders:[{stage:"fragment",code:["uniform bool   transparent;","uniform bool   xray;","uniform float  glassFactor;","uniform float  murkiness;","uniform float  xrayGlassFactor;","uniform float  xrayMurkiness;","uniform float  opacity;","uniform bool   highlight;","uniform bool   desaturate;","uniform vec3   xrayBGColor;","vec3 _std_viewNormal = vec3(0.0, 0.0,  -1.0);","vec3 _std_viewEyeVec = vec3(0.0, 0.0, -1.0);","void _std_ViewNormalFunc(vec3 vec) {","   _std_viewNormal = vec;","}","float _std_MaterialAlphaFunc(float alpha) {","   if (xray) {","       alpha = (xrayGlassFactor  * (xrayMurkiness - abs(dot(_std_viewNormal, _std_viewEyeVec))));","   }","   else if (transparent) {","       if (opacity < alpha) {","           alpha = opacity;","       }","       float gf = (glassFactor  * (murkiness - abs(dot(_std_viewNormal, _std_viewEyeVec))));","       if (gf > alpha) {","           alpha = gf;","       }","   }","   return alpha;","}","vec4 _std_PixelColorFunc(vec4 color) {","   if (highlight) {","       float intensity = 0.3 * color.r + 0.59 * color.g + 0.11 * color.b;","       color = vec4((intensity * -0.1) + color.rgb * (1.0 + 0.1), color.a);","       color.r = clamp(color.r * 1.5, 0.3, 1.0);","       color.g = clamp(color.g * 1.5, 0.3, 1.0);","       color.b = color.b * 0.5;","   } else if (desaturate) {","       color.rgb = xrayBGColor;","   } ","   return color;","}"],hooks:{viewNormal:"_std_ViewNormalFunc",materialAlpha:"_std_MaterialAlphaFunc",pixelColor:"_std_PixelColorFunc"}}],params:{transparent:!1,xray:!1,glassFactor:1,murkiness:.8,xrayGlassFactor:1,xrayMurkiness:.8,highlight:!1,opacity:1,desaturate:!1,xrayBGColor:[0,0,.1]},nodes:[{type:"flags",id:Human.CONTENT_ROOT_ID,flags:{picking:!0,enabled:!0,specular:!0,backfaceLighting:!0,backfaceTexturing:!0,backfaces:!0,reflection:!1}}]}]},{type:"flags",id:"object-boundary-flags",flags:{enabled:!1,transparent:!0,clipping:!1},nodes:[{type:"material",baseColor:{r:0,g:1,b:0},specularColor:{r:0,g:1,b:0},emit:1,alpha:.4,nodes:[{type:"geometry",id:"object-boundary-geo",positions:[1,1,1,1,-1,1,-1,-1,1,-1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,-1],primitive:"lines",indices:[0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]}]}]}]}]}]}]}]}]}]}]},c=!1;f=SceneJS.createScene(b,{simulateWebGLContextLost:c}),c&&window.setInterval(function(){f.loseWebGLContext()},15e3);var e=function(){d.resize()};$(window).resize(e),e();var h=.4;Human.properties.subscribe({subId:"glassFactor",propId:"xray.glassFactor",value:h,callback:function(a){h=a;var b=d.getNode("xray");b&&b.setParams({glassFactor:a})}});var i=.8;Human.properties.subscribe({subId:"murkiness",propId:"xray.murkiness",value:i,callback:function(a){i=a;var b=d.getNode("xray");b&&b.setParams({murkiness:a})}}),Human.events.on("highlight.toggled",function(a){if(a.enabled===!0){var b=Human.cookies.getCookie("background")||"standard";Human.properties.resubscribe("background","background."+b)}}),Human.events.on("xray.toggled",function(a){a.enabled===!0});var j=(new Date).getTime(),k=j,l=0;d._listenersBound||(d._listenersBound=!0,f.on("tick",function(){g&&d._updateXRayShaderParams();var a=(new Date).getTime();Human.events.fire("tick",{timeStarted:j,timeLast:k,timeNow:a,tick:l}),k=a,l++}),f.on("sleep",function(){Human.events.fire("Scene.Sleep")})),f.start(),a&&a()},d.pushPause=function(){d._pauses=d._pauses?d._pauses+1:1,1===d._pauses&&f.pause(!0)},d.popPause=function(){d._pauses&&0===--d._pauses&&(f.pause(!1),f.renderFrame())},d.onTasksComplete=function(a){void 0!==d._pauses&&null!==d._pauses&&d._pauses>0&&Human.log.error("Human.renderer.onTaskComplete","Renderer deadlock: Human.renderer.pushPause has paused renderer. Renderer needs to be unpaused in order to complete pending tasks.");var b=Human.renderer.getScene().getStatus().numTasks;if(!b||0===b)return void a();if(d.__checkLoaded)throw"Human.renderer.onTasksComplete: already blocking";d.__checkLoaded=window.setInterval(function(){var b=Human.renderer.getScene().getStatus().numTasks;b&&0!==b||(window.clearInterval(d.__checkLoaded),d.__checkLoaded=null,a())},200)},d.forceRenderFrame=function(){f.renderFrame({force:!0})};var h=!1;d.enableRayPick=function(a){h=a},d.pick=function(a,b,c){return f?f.pick(a,b,{rayPick:c}):(Human.log.error("Human.renderer.pick","Engine not started, ignoring pick"),null)},d._fitCanvasToScreen=function(){var a=$("#"+Human.CANVAS_ID),b=a.parent(),c=b.width(),d=b.height();a.width=c,a.height=d,a.attr({width:c,height:d});var e=$("#annotationCanvas");return e.width=c,e.height=d,e.attr({width:c,height:d}),{canvas:a,width:c,height:d}},d.resize=function(a){var b=d._fitCanvasToScreen();Human.events.fire("canvas.resized",{canvasWidth:b.width,canvasHeight:b.height}),a&&a(b.width,b.height)},d.getCanvas=function(){return d.canvas||(d.canvas=$("#"+Human.CANVAS_ID))},d.getScene=function(){return SceneJS.scene(Human.SCENE_ROOT_ID)},d.getContentRootNode=function(){return d.getNode(Human.CONTENT_ROOT_ID)},d.getNode=function(a){return f.findNode(a)},d.getLookAt=function(){return d.getNode(Human.LOOKAT_ID)},d.nodeExists=function(a){var b=f.findNode(a);return null!==b&&void 0!==b},d.setBGColor=function(f){var h,i,j=/^([\d\.]+,){2,15}[\d\.]+$/.test(f),k=function(a){for(var b=0;b<a.length;b++)if(parseFloat(a[b])>1)return!0;return!1};if(f||(f=e),"string"==typeof f){if(j){var l=f.split(","),m=l.length,n=!k(l);switch(m){case 16:h=c(l.slice(0,3)),i=c(l.slice(12,15));break;case 12:h=c(l.slice(0,3)),i=c(l.slice(9,12));break;case 6:h=c(l.slice(0,3),n),i=c(l.slice(3,6),n);break;case 3:h=i=c(l,!1);break;default:return}f="custom"}else"standard"===f?(h=c(d.bgColors[f].slice(0,3)),i=c(d.bgColors[f].slice(9,12))):h=i=f;d.bgColor=f,b(/rgb\([\d,]+\)/.test(f)?"custom":f),a(h,i),g=!0}};var i={white:[0,0,.1],black:[.8,.8,.9],standard:[.8,.8,.9],"default":[.8,.8,.9]};Human.properties.subscribe({subId:"colorsForBackgrounds",propId:"xray.colorsForBackgrounds",value:i,callback:function(a){i=a,g=!0}});var j={white:1,black:1,standard:1,"default":1};Human.properties.subscribe({subId:"glassFactorsForBackgrounds",propId:"xray.glassFactorsForBackgrounds",value:j,callback:function(a){j=a,g=!0}});var k={white:.8,black:.8,standard:.8,"default":.8};Human.properties.subscribe({subId:"murkinessForBackgrounds",propId:"xray.murkinessForBackgrounds",value:k,callback:function(a){k=a,g=!0}}),d._updateXRayShaderParams=function(){var a=d.getNode("xray");if(a){var b=i[d.bgColor]||i["default"]||[.8,.8,1],c=j[d.bgColor];(void 0===c||null===c)&&(c=j["default"]),(void 0===c||null===c)&&(c=1);var e=k[d.bgColor];(void 0===e||null===e)&&(e=k["default"]),(void 0===e||null===e)&&(e=.8),a.setParams({xrayBGColor:b,xrayGlassFactor:c,xrayMurkiness:e})}g=!1},d.getViewMat=function(){return d.getNode(Human.LOOKAT_ID).getMatrix()},d.getProjMat=function(){return d.getNode(Human.CAMERA_ID).getMatrix()}}(),function(){"use strict";Human.rpc.define("renderer.getBGColor",function(){this.setResult(Human.renderer.bgColor)}),Human.rpc.define("renderer.setBGColor",function(a){Human.renderer.setBGColor(a.color)})}(),function(){"use strict";var a=Human.view={},b=["Highlight","Xray","Isolate"];a.currentMode=b[0],a.setModeEnabled=function(a){if(a=a.toLowerCase(),"isolate"===a&&!Human.scene.anySelected())return void alert("Please select an object before Isolating.");var c=b.map(function(a){return a.toLowerCase()}),d=c.indexOf(a);d>=0&&c.forEach(function(a,b){var c=d===b;Human.view[a].setEnabled(c)})}}(),function(){"use strict";function a(a,b){a&&Human.view.annotations.unsavedAnnotation?alert("Please save or cancel annotation first"):b()}Human.rpc.define("dissect.setEnabled",function(b){var c=b.enable;(void 0===c||null===c)&&(c=!Human.view.dissect.enabled),a(c,function(){Human.view.dissect.setEnabled(c),c&&(Human.view.pick.setMultiPickEnabled(!1),Human.view.pick.setSinglePickEnabled(!1),Human.view.annotations.setEnabled(!1))})}),Human.rpc.define("highlight.setEnabled",function(a){var b=a.enable;(void 0===b||null===b)&&(b=!Human.view.highlight.enabled),Human.view.highlight.setEnabled(b),b&&(Human.view.isolate.setEnabled(!1),Human.view.xray.setEnabled(!1))}),Human.rpc.define("isolate.setEnabled",function(a){var b=a.enable;if((void 0===b||null===b)&&(b=!Human.view.isolate.enabled),b){var c=Human.scene.anySelected();if(!c)return void alert("Please select an object before Isolating.")}Human.view.isolate.setEnabled(b),b&&(Human.view.highlight.setEnabled(!1),Human.view.xray.setEnabled(!1),Human.view.pick.setSinglePickEnabled(!0),Human.view.pick.setMultiPickEnabled(!1))}),Human.rpc.define("labels.setEnabled",function(a){var b=a.enable;(void 0===b||null===b)&&(b=!Human.view.labels.enabled),Human.view.labels.setEnabled(b),Human.view.tooltips.setEnabled(b)}),Human.rpc.define("pick.single.setEnabled",function(b){var c=b.enable;(void 0===c||null===c)&&(c=!Human.view.pick.getSinglePickEnabled()),a(c,function(){Human.view.pick.setSinglePickEnabled(c),c&&(Human.view.pick.setMultiPickEnabled(!1),Human.view.dissect.setEnabled(!1),Human.view.annotations.setEnabled(!1))})}),Human.rpc.define("pick.multi.setEnabled",function(b){var c=b.enable;(void 0===c||null===c)&&(c=!Human.view.pick.getMultiPickEnabled()),a(c,function(){Human.view.pick.setMultiPickEnabled(c),c&&(Human.view.pick.setSinglePickEnabled(!1),Human.view.dissect.setEnabled(!1),Human.view.annotations.setEnabled(!1))})}),Human.rpc.define("pick.pick",function(a){Human.view.pick.pick({canvasX:a.canvasX,canvasY:a.canvasY})}),Human.rpc.define("pick.doublePick",function(a){Human.view.pick.doublePick({canvasX:a.canvasX,canvasY:a.canvasY})}),Human.rpc.define("pick.hoverPick",function(a){Human.view.pick.hoverPick({canvasX:a.canvasX,canvasY:a.canvasY})}),Human.rpc.define("pick.queryPick",function(a){this.setResult(Human.view.pick.queryPick({canvasX:a.canvasX,canvasY:a.canvasY,rayPick:a.rayPick})||{})}),Human.rpc.define("annotations.setEnabled",function(b){var c=b.enable;(void 0===c||null===c)&&(c=!Human.view.annotations.enabled),a(!c,function(){Human.view.annotations.setEnabled(c),c&&(Human.view.pick.setSinglePickEnabled(!1),Human.view.pick.setMultiPickEnabled(!1),Human.view.dissect.setEnabled(!1))})}),Human.rpc.define("xray.setEnabled",function(a){var b=a.enable;(void 0===b||null===b)&&(b=!Human.view.xray.enabled),Human.view.xray.setEnabled(b),b&&(Human.view.highlight.setEnabled(!1),Human.view.isolate.setEnabled(!1))}),Human.rpc.define("queryModes",function(){var a={xray:Human.view.xray.enabled,highlight:Human.view.highlight.enabled,annotation:Human.view.annotations.enabled,singlePick:Human.view.pick.singleEnabled,multipick:Human.view.pick.multiEnabled,dissect:Human.view.dissect.enabled};this.setResult(a)}),Human.rpc.define("jquery",function(a){"document"===a.selector&&(a.selector=document),$.fn[a.method].apply($(a.selector),a.args)}),Human.rpc.define("navigation.setEnabled",function(a){b("navigator_container",a.enable)}),Human.rpc.define("fullscreen.setEnabled",function(a){b("embed-full-screen",a.enable)}),Human.rpc.define("injectStyles",function(a){if(window!==top){var b=a.styles,c=document.head||document.getElementsByTagName("head")[0],d=document.getElementsByTagName("link"),e=d[d.length-1],f=document.createElement("style");f.type="text/css",f.styleSheet?f.styleSheet.cssText=b:f.appendChild(document.createTextNode(b)),c.insertBefore(f,e),Human.view.annotations.updateDimensions(),Human.view.annotations.layouts.redrawLayout()}});var b=function(a,b){var c="undefined"==typeof b?!0:b,d=document.getElementById(a);d.style.display=c?"block":"none"}}(),function(){"use strict";var a=Human.view.mouseCursor={},b={DEFAULT:0,PAN:1,PROGRESS:2,ROTATE:3,ZOOM_IN:4,ZOOM_OUT:5},c=b.PROGRESS,d="pointer",e=0;Human.events.on("processes.started",function(){1===++e&&a.gotoProgress()}),Human.events.on("processes.finished",function(){--e<=0&&(e=0,a.gotoDefault())}),Human.events.on("processes.failed",function(){--e<=0&&(e=0,a.gotoDefault())}),Human.events.on("dissect.toggled",function(){a.gotoDefault()}),a.setDefault=function(a){return"pointer"!==a&&"crosshair"!==a?void Human.log.error("Human.view.mouseCursor","Unsupported default cursor type: "+a):(d=a,void(c===b.DEFAULT&&$("body").css("cursor",a)))},a.gotoDefault=function(){$("body").css("cursor",Human.view.dissect.getEnabled()?"crosshair":d),c=b.DEFAULT},a.gotoPan=function(){c!==b.PROGRESS&&($("body").css("cursor","move"),c=b.PAN)},a.gotoProgress=function(){(c===b.DEFAULT||c===b.PROGRESS)&&($("body").css("cursor","progress"),c=b.PROGRESS)},a.gotoRotate=function(){c!==b.PROGRESS&&($("body").css("cursor","n-resize"),c=b.ROTATE)},a.gotoZoomIn=function(){c!==b.PROGRESS&&($("body").css("cursor","url(Images/zoom-in.png), auto"),c=b.ZOOM_IN)},a.gotoZoomOut=function(){c!==b.PROGRESS&&($("body").css("cursor","url(Images/zoom-out.png), auto"),c=b.ZOOM_OUT)}}(),function(){"use strict";var a=Human.view.camera={},b=null,c=null;a.eye={x:0,y:0,z:-80},a.look={x:0,y:0,z:0},a.up={x:0,y:1,z:0},a._screenPan={x:0,y:0,z:0};var d=!1,e=!1,f=!1,g=[];a.lock=!1,a.aspect=1,Human.properties.subscribe({propId:"camera.optics.aspect",value:a.aspect,callback:function(b){a.aspect=b,e=!0}}),a.fovy=55,Human.properties.subscribe({propId:"camera.optics.fov",value:a.fovy,callback:function(b){a.fovy=b,e=!0}}),a.near=.1,Human.properties.subscribe({propId:"camera.optics.near",value:.1,callback:function(b){a.near=b,e=!0}}),a.minZoom=.01,a.maxZoom=150,Human.properties.subscribe({propId:"camera.zoomLimits",value:{min:.01,max:150},callback:function(b){return b.min<.01?void Human.log.error("Human.view.camera","Property 'camera.zoomLimits.min' too small - should be >= 0.01"):b.min>=b.max?void Human.log.error("Human.view.camera","Property 'camera.zoomLimits.min' should be less than camera.zoomLimits.max"):(a.minZoom=b.min,a.maxZoom=b.max,void(d=!0))}});var h=!0;Human.properties.subscribe({propId:"camera.gimbalLockY",value:h,callback:function(a){h=a}});var i=!1;Human.properties.subscribe({propId:"camera.constrainRotateX",value:i,callback:function(a){i=a}});var j=!1;Human.properties.subscribe({propId:"camera.firstPerson",value:j,callback:function(a){j=a}}),Human.events.on("loaded",function(){b=Human.renderer.getNode(Human.LOOKAT_ID),c=Human.renderer.getNode(Human.CAMERA_ID);var g=c.get("optics");a.aspect=g.aspect,a.fovy=g.fovy,d=!0,e=!0,f=!1}),Human.events.on("canvas.resized",function(b){a.setAspect(b.canvasWidth/b.canvasHeight)}),Human.events.on("tick",function(){d?(b.setEye(a.eye),b.setLook(a.look),b.setUp(a.up),Human.events.fire("camera.updated",{eye:a.eye,look:a.look,up:a.up,dist:Math.abs(Human.math.lenVec3(Human.math.subVec3(Human.math.vec3ObjToArray(a.eye),Human.math.vec3ObjToArray(a.look),[])))}),f=!1,d=!1):f||(f=!0,Human.events.fire("camera.rested",{eye:a.eye,look:a.look,up:a.up,dist:Math.abs(Human.math.lenVec3(Human.math.subVec3(Human.math.vec3ObjToArray(a.eye),Human.math.vec3ObjToArray(a.look),[])))})),e&&(c.set({optics:{type:"perspective",fovy:a.fovy,near:a.near,far:a.far,aspect:a.aspect},pan:a._screenPan}),e=!1)}),a.addConstraint=function(a){g.push(a)},a.removeConstraint=function(a){for(var b=0,c=g.length;c>b;b++)if(g[b]===a)return void g.splice(b,1)},a.setLookAt=function(b){a._setConstrainedLookat(b.eye,b.look,b.up)},a._setConstrainedLookat=function(b,c,e){b=b||a.eye,c=c||a.look,e=e||a.up;for(var f=0,h=g.length;h>f;f++)if(!g[f](b,c,e))return Human.events.fire("camera.constrained"),!1;a.eye=b,a.look=c,a.up=e,d=!0},a._clampEye=function(b){var c,d,e=[a.look.x,a.look.y,a.look.z],f=Human.math.subVec3([b.x,b.y,b.z],e),g=Human.math.normalizeVec3(f),h=Math.abs(Human.math.lenVec3(f));if(h<a.minZoom)d=Human.math.mulVec3Scalar(g,a.minZoom),c=Human.math.addVec3(e,d);else{if(!(h>a.maxZoom))return b;d=Human.math.mulVec3Scalar(g,a.maxZoom),c=Human.math.addVec3(e,d)}return{x:c[0],y:c[1],z:c[2]}},a.getLookAt=function(){return{eye:a.eye,look:a.look,up:a.up}},a.getEye=function(){return a.eye},a.getLook=function(){return a.look},a.getUp=function(){return a.up},a.setScreenPan=function(b){a._screenPan.x=b.x||0,a._screenPan.y=b.y||0,a._screenPan.z=b.z||0,e=!0},a.getScreenPan=function(){return a._screenPan},a._reset={eye:{x:a.eye.x,y:a.eye.y,z:a.eye.z},look:{x:a.look.x,y:a.look.y,z:a.look.z},up:{x:a.up.x,y:a.up.y,z:a.up.z}},a.reset=function(){a.yaw=0,a.pitch=90,a._eye={x:a._reset.eye.x,y:a._reset.eye.y,z:a._reset.eye.z},a._look={x:a._reset.look.x,y:a._reset.look.y,z:a._reset.look.z},a._up={x:a._reset.up.x,y:a._reset.up.y,z:a._reset.up.z},d=!0},a.rotateX=function(b){a.lock||(j?a.rotateLookX(-b):a.rotateEyeX(b))},a.rotateY=function(b){a.lock||(j?a.rotateLookY(-b):a.rotateEyeY(b))},a.rotateEyeY=function(b){if(!a.lock){var c=Human.math.vec3ObjToArray(a.eye),d=Human.math.vec3ObjToArray(a.look),e=Human.math.vec3ObjToArray(a.up),f=Human.math.subVec3(c,d,[]),g=Human.math.rotationMat4v(.0174532925*b,h?[0,1,0]:e);
  f=Human.math.transformVector3(g,f,[]),f=Human.math.addVec3(f,d,[]),h&&(e=Human.math.transformVector3(g,e,[])),a.setLookAt({eye:{x:f[0],y:f[1],z:f[2]},up:{x:e[0],y:e[1],z:e[2]}})}},a.rotateEyeX=function(b){if(!a.lock){var c=Human.math.vec3ObjToArray(a.eye),d=Human.math.vec3ObjToArray(a.look),e=Human.math.vec3ObjToArray(a.up),f=Human.math.subVec3(c,d,[]),g=Human.math.cross3Vec3(Human.math.normalizeVec3(f,[]),Human.math.normalizeVec3(e,[])),h=Human.math.rotationMat4v(.0174532925*b,g);f=Human.math.transformVector3(h,f,[]),f=Human.math.addVec3(f,d,[]);var i=Human.math.transformVector3(h,e,[]);a.setLookAt({eye:{x:f[0],y:f[1],z:f[2]},up:{x:i[0],y:i[1],z:i[2]}})}},a.rotateLookY=function(b){if(!a.lock){var c=Human.math.vec3ObjToArray(a.eye),d=Human.math.vec3ObjToArray(a.look),e=Human.math.vec3ObjToArray(a.up),f=Human.math.subVec3(d,c,[]),g=Human.math.rotationMat4v(.0174532925*b,h?[0,1,0]:e);f=Human.math.transformVector3(g,f,[]),f=Human.math.addVec3(f,c,[]),a.setLookAt({look:{x:f[0],y:f[1],z:f[2]},up:{x:e[0],y:e[1],z:e[2]}})}},a.rotateLookX=function(b){if(!a.lock){var c=Human.math.vec3ObjToArray(a.eye),d=Human.math.vec3ObjToArray(a.look),e=Human.math.vec3ObjToArray(a.up),f=Human.math.subVec3(d,c,[]),g=Human.math.cross3Vec3(Human.math.normalizeVec3(f,[]),Human.math.normalizeVec3(e,[])),h=Human.math.rotationMat4v(.0174532925*b,g);f=Human.math.transformVector3(h,f,[]),f=Human.math.addVec3(f,c,[]);var i=Human.math.transformVector3(h,e,[]);a.setLookAt({look:{x:f[0],y:f[1],z:f[2]},up:{x:i[0],y:i[1],z:i[2]}})}},a.pan=function(b){if(!a.lock){var c,d=Human.math.vec3ObjToArray(a.eye),e=Human.math.vec3ObjToArray(a.look),f=Human.math.vec3ObjToArray(a.up),g=Human.math.subVec3(d,e,[]),h=[0,0,0];if(void 0!==b.x&&null!==b.x){var i=Human.math.cross3Vec3(Human.math.normalizeVec3(g,[]),Human.math.normalizeVec3(f,[]));c=Human.math.mulVec3Scalar(i,b.x),h[0]+=c[0],h[1]+=c[1],h[2]+=c[2]}void 0!==b.y&&null!==b.y&&(c=Human.math.mulVec3Scalar(Human.math.normalizeVec3(f,[]),b.y),h[0]+=c[0],h[1]+=c[1],h[2]+=c[2]),void 0!==b.z&&null!==b.z&&(c=Human.math.mulVec3Scalar(Human.math.normalizeVec3(d,[]),b.z),h[0]+=c[0],h[1]+=c[1],h[2]+=c[2]),d=Human.math.addVec3(d,h,[]),e=Human.math.addVec3(e,h,[]),a.setLookAt({eye:{x:d[0],y:d[1],z:d[2]},look:{x:e[0],y:e[1],z:e[2]}})}},a.setAspect=function(b){a.aspect=b,e=!0},a.viewRight=function(){if(!a.lock){var b=Human.init.bookmark.camera.eye,c=b.z,d=b.y;a.setLookAt({look:{x:0,y:d,z:0},eye:{x:-c,y:d,z:0},up:{x:0,y:1,z:0}})}},a.viewLeft=function(){if(!a.lock){var b=Human.init.bookmark.camera.eye,c=b.z,d=b.y;a.setLookAt({look:{x:0,y:d,z:0},eye:{x:c,y:d,z:0},up:{x:0,y:1,z:0}})}},a.viewPosterior=function(){if(!a.lock){var b=Human.init.bookmark.camera.eye,c=b.z,d=b.y;a.setLookAt({look:{x:0,y:d,z:0},eye:{x:0,y:d,z:-c},up:{x:0,y:1,z:0}})}},a.viewAnterior=function(){if(!a.lock){var b=Human.init.bookmark.camera.eye,c=b.z,d=b.y;a.setLookAt({look:{x:0,y:d,z:0},eye:{x:0,y:d,z:c},up:{x:0,y:1,z:0}})}},a.viewSuperior=function(){if(!a.lock){var b=Human.init.bookmark.camera.eye,c=b.z,d=b.y;a.setLookAt({look:{x:0,y:d,z:0},eye:{x:0,y:-c+d,z:0},up:{x:0,y:0,z:1}})}},a.viewInferior=function(){if(!a.lock){var b=Human.init.bookmark.camera.eye,c=b.z,d=b.y;a.setLookAt({look:{x:0,y:d,z:0},eye:{x:0,y:c+d,z:0},up:{x:0,y:0,z:-1}})}},a.zoom=function(b){if(!a.lock){var c=Human.math.vec3ObjToArray(a.eye),d=Human.math.vec3ObjToArray(a.look),e=Human.math.subVec3(c,d),f=Math.abs(Human.math.lenVec3(e)),g=Math.abs(f+b);if(a.minZoom&&a.maxZoom){var h=f/a.maxZoom*.6;b=40*b*h,g=Math.abs(f+b),g<a.minZoom?g=a.minZoom:g>a.maxZoom&&(g=a.maxZoom)}var i=Human.math.normalizeVec3(e),j=Human.math.addVec3(d,Human.math.mulVec3Scalar(i,g));a.setLookAt({eye:{x:j[0],y:j[1],z:j[2]}})}},a.setZoom=function(b){if(!a.lock){var c=Human.math.vec3ObjToArray(a.eye),d=Human.math.vec3ObjToArray(a.look),e=Human.math.subVec3(c,d),f=Human.math.normalizeVec3(e),g=Human.math.addVec3(d,Human.math.mulVec3Scalar(f,a.minZoom+(1-b)*(a.maxZoom-a.minZoom)));a.setLookAt({eye:{x:g[0],y:g[1],z:g[2]}})}},a.getZoom=function(){var b=Human.math.vec3ObjToArray(a.eye),c=Human.math.vec3ObjToArray(a.look),d=Human.math.subVec3(b,c),e=Math.abs(Human.math.lenVec3(d));return 1-(e-a.minZoom)/a.maxZoom},a.setZoomPercent=function(b){if(!a.lock){var c=Human.math.vec3ObjToArray(a.eye),d=Human.math.vec3ObjToArray(a.look),e=Human.math.subVec3(c,d),f=Human.math.normalizeVec3(e),g=Human.math.addVec3(d,Human.math.mulVec3Scalar(f,a.minZoom+.01*(100-b)*(a.maxZoom-a.minZoom)));a.setLookAt({eye:{x:g[0],y:g[1],z:g[2]}})}},a.getZoomPercent=function(){var b=Human.math.vec3ObjToArray(a.eye),c=Human.math.vec3ObjToArray(a.look),d=Human.math.subVec3(b,c),e=Math.abs(Human.math.lenVec3(d));return 100-(e-a.minZoom)/a.maxZoom*100}}(),function(){"use strict";Human.rpc.define("camera.flyTo",function(a){var b=this;Human.view.camera.fly.flyTo(a,function(){b.setResult(!0)})}),Human.rpc.define("camera.jumpTo",function(a){var b=this;Human.view.camera.fly.jumpTo(a,function(){b.setResult(!0)})}),Human.rpc.define("camera.orbit",function(a){var b=a.yaw,c=a.pitch;void 0!==b&&null!==b&&0!==b&&Human.view.camera.rotateY(b),void 0!==c&&null!==c&&0!==c&&Human.view.camera.rotateX(c)}),Human.rpc.define("camera.pan",function(a){Human.view.camera.pan({x:a.x||0,y:a.y||0,z:a.z||0})}),Human.rpc.define("camera.zoom",function(a){Human.view.camera.setZoom(a.factor||0)}),Human.rpc.define("camera.getZoom",function(){this.setResult(Human.view.camera.getZoom())}),Human.rpc.define("camera.query",function(){this.setResult(Human.view.camera.getLookAt())}),Human.rpc.define("camera.reset",function(){var a=this;Human.init.resetCamera(function(){a.setResult(!0)})})}(),function(){"use strict";function a(a,c){Human.view.camera.lock=!0,c&&e.push(c),a=a||{},f=new Human.view.camera.fly.Animation({target:a.target,arc:a.arc,backOff:a.backOff,velocity:a.velocity,onComplete:b})}function b(){for(f=null;e.length>0;)e.pop()();Human.view.camera.lock=!1}var c,d=Human.view.camera.fly={};Human.properties.subscribe({propId:"camera.flyTo",value:{stopFOV:55},callback:function(a){c=a.stopFOV}});var e=[],f=null;Human.events.on("tick",function(){f&&f.update((new Date).getTime())}),Human.events.on("camera.constrained",function(){b()}),d.flyTo=function(b,c,d){var e,f,g;if(c=c||function(){},d=d||function(a){Human.log.error("Human.view.camera.fly",a),c()},b.objectId){if(g=b.objectId,e=Human.scene.objects[g],!e)return void d("No scene object found for the given ID: '"+g+"'");f=Human.scene.getBoundary(g),f?(Human.view.boundary.setBoundary(f,!0),a({target:{boundary:f},arc:b.arc,backOff:b.backOff,velocity:b.velocity},function(){Human.view.boundary.setBoundary(f,!1),c()})):c()}else if(b.fmaId){var h=b.fmaId;if(e=Human.scene.objectsByFMAID[h],!e)return void d("no object found for the given FMA ID: '"+h+"'");f=Human.scene.getBoundary(e.objectId),f?(Human.view.boundary.setBoundary(f,!0),a({target:{boundary:f},arc:b.arc,backOff:b.backOff,velocity:b.velocity},function(){Human.view.boundary.setBoundary(f,!1),c()})):c()}else if(b.boundary)f=b.boundary,Human.view.boundary.setBoundary(f,!0),a({target:{boundary:f},arc:b.arc,backOff:b.backOff,velocity:b.velocity},function(){Human.view.boundary.setBoundary(f,!1),c()});else if(b.lookVec){var i=b.lookVec,j=Human.view.camera.eye,k=Human.view.camera.look,l=Human.math.lenVec3(Human.math.subVec3([k.x,k.y,k.z],[j.x,j.y,j.z])),m=Human.math.lenVec3(Human.math.subVec3([i.x,i.y,i.z],[j.x,j.y,j.z])),n=l/m,o=Human.math.lerpVec3(n,0,1,[k.x,k.y,k.z],[i.x,i.y,i.z]);a({target:{look:{x:o[0],y:o[1],z:o[2]}},arc:b.arc,velocity:b.velocity},c)}else if(b.eye||b.look)a({target:{eye:b.eye,look:b.look,up:b.up},arc:b.arc,backOff:b.backOff,velocity:b.velocity},c);else if(b.selectedObjects)f=Human.scene.getBoundary(Human.scene.selectedObjects),Human.view.boundary.setBoundary(f,!0),a({target:{boundary:f},arc:b.arc,backOff:b.backOff,velocity:b.velocity},function(){Human.view.boundary.setBoundary(f,!1),c()});else if(b.selectedLeafObjects){var p=[],q=Human.scene.selectedObjects;for(g in q)q.hasOwnProperty(g)&&(e=q[g],0===e.objects.length&&p.push(g));f=Human.scene.getBoundary(p),Human.view.boundary.setBoundary(f,!0),a({target:{boundary:f},arc:b.arc,backOff:b.backOff,velocity:b.velocity},function(){Human.view.boundary.setBoundary(f,!1),c()})}else b.enabledObjects?(f=Human.scene.getBoundary(Human.scene.enabledObjects),a({target:{boundary:f},arc:b.arc,backOff:b.backOff,velocity:b.velocity},function(){Human.view.boundary.setBoundary(f,!1),c()})):b.objects?(f=Human.scene.getBoundary(b.objects),a({target:{boundary:f},arc:b.arc,backOff:b.backOff,velocity:b.velocity},function(){Human.view.boundary.setBoundary(f,!1),c()})):a({target:{eye:{x:0,y:6,z:-70},look:{x:0,y:0,z:0},up:{x:0,y:1,z:0}},arc:b.arc,backOff:b.backOff,velocity:b.velocity},function(){c()})},d.jumpTo=function(a,d,e){var f,g,h;d=d||function(){},e=e||function(a){Human.log.error("Human.view.camera.fly",a),d()};var i;if(a.objectId){if(h=a.objectId,f=Human.scene.objects[h],!f)return void e("No scene object found for the given ID: '"+h+"'");g=Human.scene.getBoundary(h),g&&(i={target:{boundary:g},backOff:a.backOff})}else if(a.fmaId){var j=a.fmaId;if(f=Human.scene.objectsByFMAID[j],!f)return void e("no object found for the given FMA ID: '"+j+"'");g=Human.scene.getBoundary(f.objectId),g&&(i={target:{boundary:g},backOff:a.backOff})}else if(a.boundary)i={target:{boundary:a.boundary}};else if(a.eye||a.look){if(!a.eye&&!a.look)return void e("incomplete parameter configuration: both 'eye' and 'look' expected");i={target:{eye:a.eye,look:a.look,up:a.up}}}else if(a.selectedObjects)g=Human.scene.getBoundary(Human.scene.selectedObjects),Human.view.boundary.setBoundary(g,!0),i={target:{boundary:g},backOff:a.backOff};else if(a.enabledObjects)g=Human.scene.getBoundary(Human.scene.enabledObjects),i={target:{boundary:g},backOff:a.backOff};else if(a.lookVec){var k=a.lookVec,l=Human.view.camera.eye,m=Human.view.camera.look,n=Human.math.lenVec3(Human.math.subVec3([m.x,m.y,m.z],[l.x,l.y,l.z])),o=Human.math.lenVec3(Human.math.subVec3([k.x,k.y,k.z],[l.x,l.y,l.z])),p=n/o,q=Human.math.lerpVec3(p,0,1,[m.x,m.y,m.z],[k.x,k.y,k.z]);i={target:{look:{x:q[0],y:q[1],z:q[2]}}}}else i={target:{eye:{x:0,y:6,z:-70},look:{x:0,y:0,z:0},up:{x:0,y:1,z:0}},backOff:a.backOff};i&&(b(),i.target.boundary?(i.target.stopFOV=c||i.target.stopFOV,Human.view.camera.fly.jumpTo(i.target)):Human.view.camera.setLookAt(i.target)),d()}}(),function(){"use strict";var a,b;Human.properties.subscribe({propId:"camera.flyTo",value:{velocity:1,stopFOV:55},callback:function(c){a=c.velocity||1,b=c.stopFOV||55}}),Human.view.camera.fly.Animation=function(c){var d=c.target;if(this.arc=void 0===c.arc?0:c.arc,this.easing=void 0===c.easing?!0:c.easing,!d)return Human.log.error("Human.view.camera.fly.Animation config missing: target"),void(c.onComplete&&c.onComplete());var e=Human.view.camera;this._look1=Human.math.vec3ObjToArray(e.look),this._eye1=Human.math.vec3ObjToArray(e.eye),this._up1=Human.math.vec3ObjToArray(e.up),this._vec=Human.math.normalizeVec3(Human.math.subVec3(this._eye1,this._look1));var f=c.backOff||0;if(0>f?f=0:f>1&&(f=1),f=1-f,d.boundary){var g=d.boundary,h=d.dist||2.5,i=Math.abs(Human.math.lenVec3(this._vec)),j=Human.math.getBoundaryDiag(g),k=Math.abs(j/(1+.8*f)/Math.tan(b/2)),l=k/i*h;this._look2=Human.math.getBoundaryCenter(g),d.offset&&(this._look2[0]+=d.offset[0],this._look2[1]+=d.offset[1],this._look2[2]+=d.offset[2]),this._eye2=Human.math.addVec3(this._look2,Human.math.mulVec3Scalar(this._vec,l)),this._up2=[0,1,0]}else{var m=d.look,n=d.eye,o=d.up,p=Human.view.camera.eye,q=Human.view.camera.look,r=Human.view.camera.up;this._look2=m?[m.x||0,m.y||0,m.z||0]:[q.x,q.y,q.z],this._eye2=n?[n.x||0,n.y||0,n.z||0]:[p.x,p.y,p.z],this._up2=o?[o.x||0,o.y||0,o.z||0]:[r.x,r.y,r.z]}var s=Math.abs(Human.math.lenVec3(Human.math.subVec3(this._look2,this._look1))),t=Math.abs(Human.math.lenVec3(Human.math.subVec3(this._eye2,this._eye1)));this._dist=s>t?s:t,this._duration=1e3*(this._dist/(200*(c.velocity||a))+1),this._onComplete=c.onComplete},Human.view.camera.fly.Animation.prototype.update=function(a){if((void 0===this._time1||null===this._time1)&&(this._time1=a,this._time2=this._time1+this._duration),this._done||a>this._time2)return this._done=!0,void this._onComplete(this);var b,c=(a-this._time1)/this._duration,d=this.easing?this._easeOut(c,0,1,1):c,e=Human.math.lerpVec3(d,0,1,this._eye1,this._eye2);if(this.arc>0){var f=1+Math.sin(2*Math.PI*d-.75*Math.PI);b=this._dist*f*.1*this.arc,e=Human.math.addVec3(e,Human.math.mulVec3Scalar(this._vec,b))}Human.view.camera.setLookAt({look:Human.math.vec3ArrayToObj(Human.math.lerpVec3(d,0,1,this._look1,this._look2)),eye:Human.math.vec3ArrayToObj(e)})},Human.view.camera.fly.Animation.prototype._easeOut=function(a,b,c,d){var e=(a/=d)*a,f=e*a;return b+c*(-1*e*e+4*f+-6*e+4*a)},Human.view.camera.fly.Animation.prototype._easeIn=function(a,b,c,d){var e=(a/=d)*a,f=e*a;return b+c*f*e},Human.view.camera.fly.Animation.prototype.stop=function(){}}(),function(){"use strict";function a(){Human.events.on("modules.activated",b),Human.events.on("modules.deactivated",b),Human.view.camera.addConstraint(c)}function b(){var a=Human.scene.getBoundary();f[0]=[a.xmin+(a.xmax-a.xmin)/2,a.ymin+(a.ymax-a.ymin)/2,a.zmin+(a.zmax-a.zmin)/2]}function c(a,b,c){for(var d=Human.math.lookAtMat4c(a.x,a.y,a.z,b.x,b.y,b.z,c.x,c.y,c.z),g=Human.renderer.getProjMat(),h=0,i=f.length;i>h;h++){var j=Human.math.transformPoint3(d,f[h]);j[3]=1,j[2]>-.1||j[2]<-1e4;var k=Human.math.transformPoint4(g,j),l=k[0],m=k[1],n=k[3],o=(1+l/n)*e.width/2;if(!(0>o||o>e.width)){var p=(1-m/n)*e.height/2;if(!(0>p||p>e.height))return!0}}return!1}function d(){Human.view.camera.removeConstraint(c),Human.events.off("modules.activated",b),Human.events.off("modules.deactivated",b)}var e,f=[[0,0,0]];Human.events.on("loaded",function(){e=document.getElementById(Human.CANVAS_ID)}),Human.properties.subscribe({propId:"camera.constrainSceneToCanvas",value:!1,callback:function(b){b?a():d()}})}(),function(){"use strict";var a,b,c=Human.view.boundary={},d=!1,e=!1;Human.events.on("loaded",function(){a=Human.renderer.getNode("object-boundary-flags"),b=Human.renderer.getNode("object-boundary-geo"),d=!0}),c.setBoundary=function(){if(d){if(0===arguments.length)return void c.reset();var a,b;1===arguments.length?"boolean"==typeof arguments[0]?(b=!!arguments[1],c._showBoundary(b)):(a=arguments[0],c._setBoundaryExtents(a)):(a=arguments[0],b=arguments[1],c._setBoundaryExtents(a),c._showBoundary(b))}},c._setBoundaryExtents=function(c){a.setEnabled(e);var d=c.xmin,f=c.ymin,g=c.zmin,h=c.xmax,i=c.ymax,j=c.zmax;b.setPositions({positions:[h,i,j,h,f,j,d,f,j,d,i,j,h,i,g,h,f,g,d,f,g,d,i,g]})},c._showBoundary=function(b){e!==b&&(a.setEnabled(b),e=b)},c.reset=function(){c._setBoundaryExtents({xmin:0,ymin:0,zmin:0,xmax:0,ymax:0,zmax:0}),c._showBoundary(!1)}}(),function(){"use strict";var a,b=Human.view.tooltips={},c=!0,d=null,e={};Human.properties.subscribe({propId:"tooltips.enabled",value:!0,callback:function(a){c=!!a}}),Human.events.on("loaded",function(){var c="#"+Human.CONTAINER_ID;$(c).append('<div id="objectToolTip" style="display: none;" class="objectTooltip">XXXX</div>'),a=$("#objectToolTip"),b._hide()}),Human.events.on("scene.objectDestroyed",function(c){a&&d&&c.objectId===d&&b._hide()}),Human.events.on("scene.objectsShown",function(c){a&&d&&c.enabledObjectsUpdate[d]===!1&&b._hide()}),Human.events.on("labels.updated",function(a){e=a.enabledLabels,d&&e[d]&&b._hide()}),Human.events.on("camera.updated",function(){a&&d&&b._hide()}),b.setTooltip=function(c){var d=c.objectId;d&&a&&(e[d]||Human.scene.checkTestStarted?b._hide():b._show(c))},b.clearTooltip=function(){a&&d&&b._hide()},b._show=function(f){if(c){var g;if(f.objectId){if(d=f.objectId,e[d])return void b._hide();var h=Human.scene.objects[f.objectId];g=h.name}a.css({left:f.canvasX+10,top:f.canvasY+0}),a.text(g),a.show()}},b._hide=function(){d&&a&&(a.hide(),d=null)},b.getEnabled=function(){return c},b.setEnabled=function(a){c!==a&&(a||b._hide(),c=a),Human.events.fire("tooltips.toggled",{enabled:c})}}(),function(){"use strict";Human.rpc.define("tooltips.setEnabled",function(a){var b=a.enable;(void 0===b||null===b)&&(b=!Human.view.tooltips.getEnabled()),Human.view.tooltips.setEnabled(b)})}(),function(){"use strict";var a=Human.view.labels={};a.enabled=!0;var b={},c=0;Human.properties.subscribe({propId:"labels.enabled",value:!0,callback:function(b){a.enabled=!!b}}),Human.events.on("loaded",function(){a.clearLabels()}),Human.events.on("scene.objectDestroyed",function(d){if(a.enabled&&c>0){var e=d.objectId;if(b[e]){a._destroyLabel(e);var f={};f[e]=!1,Human.events.fire("labels.updated",{enabledLabels:b})}}}),Human.events.on("scene.objectsSelected",function(d){if(a.enabled&&c>0){var e=d.selectedObjectsUpdate,f=Human.scene.objects;for(var g in e)e.hasOwnProperty(g)&&0===f[g].objects.length&&e[g]===!1&&b[g]&&a._destroyLabel(g);Human.events.fire("labels.updated",{enabledLabels:b})}}),Human.events.on("scene.objectsShown",function(d){if(a.enabled&&c>0){var e=d.enabledObjectsUpdate;for(var f in e)e.hasOwnProperty(f)&&e[f]===!1&&b[f]&&a._destroyLabel(f);Human.events.fire("labels.updated",{shownLabels:b})}}),a._destroyLabel=function(a){var d=b[a];d&&(d.destroy(),delete b[a],c--)},a.createLabel=function(d){var e=d.objectId,f=Human.scene.objects[e];if(!f)return void Human.log.warn("Human.view.labels.createLabel","Scene object not found: '"+e+"'");if(d.replace&&a.clearLabels(),!f.displayName)return void Human.log.warn("Human.view.labels.createLabel","Scene object has no displayName: '"+e+"'");var g=d.offset||f.getCenter();b[e]=new Human.view.labels.Label({labelId:e,text:f.displayName,style:null,offset:g,nodeId:e,objectId:e,enabled:a.enabled,onHide:function(){a._destroyLabel(e)}}),Human.events.fire("labels.updated",{enabledLabels:b}),c++},a.clearLabels=function(){c>0&&(a._clearLabels(),Human.events.fire("labels.updated",{enabledLabels:b}))},a._clearLabels=function(){for(var d in b)b.hasOwnProperty(d)&&a._destroyLabel(d);c=0},a.setEnabled=function(b){a.enabled!==b&&(a.enabled=b,b||a._clearLabels(),Human.events.fire("labels.toggled",{enabled:b}))},a.getEnabled=function(){return a.enabled}}(),function(){"use strict";function a(){var a="___labelNarration",b=document.getElementsByTagName("body")[0],c=document.createElement("div");c.innerHTML+=' <audio id="'+a+'" src=""></audio>',b.appendChild(c);var d=document.getElementById(a);return d?"probably"!==d.canPlayType('audio/ogg;codecs="vorbis"')?(Human.log.error("Scene.view.labels","Label audio init failed: Codec not supported"),null):d:(Human.log.error("Scene.view.labels","Label audio init failed: Failed to create audio element in DOM"),null)}function b(a,b){var c=new XMLHttpRequest;c.open("HEAD",a),c.onreadystatechange=function(){this.readyState===this.DONE&&b(404!==this.status)},c.send()}var c,d,e,f,g={};Human.events.on("loaded",function(){c=$("#container"),d=a()}),Human.events.on("loaded",function(){Human.renderer.getNode(Human.renderer.NULL_OBJECT_ID).on("rendered",function(a){for(var b in g)g.hasOwnProperty(b)&&g[b]._onRender(a)})}),Human.events.on("canvas.resized",function(a){e=a.canvasWidth,f=a.canvasHeight}),Human.view.labels.Label=function(a){this.nodeId=a.nodeId,this.objectId=a.objectId,this.animationId=a.animationId,this.offset=a.offset,this.shown=a.shown,this.enabled=a.enabled,this.audioText=a.text,this.audioText&&(this.audioText=this.audioText.toLowerCase().replace(/\s/g,"_")),this._style=a.style||"labelStyleDefault",this.labelId=a.labelId?a.labelId:this.animationId?"a."+this.objectId:this.objectId?"o."+this.objectId:"n."+this.nodeId,this._labelElement=jQuery(['<div id="',this.labelId,'" class="label-container right hidden">','<div class="label-container-header ',this.style,'">',"<span>",a.text,"</span>",'<img src="img/shim.gif" alt="Play" class="icon-speaker icon-inverse" />','<img src="img/shim.gif" alt="Close" class="icon-close icon-inverse" />','<div class="label-toggle-secondary icon-expand"></div>','<ul class="options"></ul>',"</div>","</div>"].join("")),c.append(this._labelElement),this._elementWidth=this._labelElement.width(),this._elementHeight=this._labelElement.height();var e=this;this._onRender=function(a){e.updatePos({canvasPos:a.getCanvasPos(e.offset)})},g[this.labelId]=this,this._labelElement.find(".icon-close").click(function(){a.onHide()});var f=[],h=this._labelElement.find(".options");h.hide();var i=this._labelElement.find(".label-toggle-secondary");i.hide();var j=Human.view.annotations.getAnnotations({objectId:this.objectId,type:"secondary"}),k=Object.keys(j).length>0;if(k){var l=$("<li />");l.text("Show Labels"),l.data("shown",!1),l.click(function(){l.data("shown",!l.data("shown"));var a=l.data("shown"),b={};b[e.objectId]=a,Human.view.annotations.setLabelsShown({objects:b,type:"secondary",replace:!0}),l.text(a?"Hide Labels":"Show Labels")}),f.push(l)}if(f.length>0){for(var m in f)f.hasOwnProperty(m)&&h.append(f[m]);i.click(function(){h.is(":visible")?(h.hide(),i.attr("class","icon-expand")):(h.show(),i.attr("class","icon-collapse"))}),i.show()}var n=this._labelElement.find(".icon-speaker");if(n.hide(),this.objectId&&d){var o="content/sounds/labels/"+e.audioText+".ogg";b(o,function(a){a&&(n.click(function(){d.setAttribute("src",o),d.currentTime?d.ended&&(d.pause(),d.src="",d.setAttribute("src",o),d.play()):d.play()}),e._hasAudioFile=!0,n.show())})}},Human.view.labels.Label.prototype.updatePos=function(a){var b=a.canvasPos.x,c=a.canvasPos.y;0>=b||0>=c||b>e-this._elementWidth||c>f-this._elementHeight?this.shown&&this.setShown(!1):(this._labelElement.css({left:b,top:c+40}),this.shown||this.setShown(!0))},Human.view.labels.Label.prototype.update=function(a){var b=a.canvasPos.x,c=a.canvasPos.y;0>=c?this.shown&&this.setShown(!1):(this._labelElement.css({left:b,top:c+40}),a.style&&(this._style&&this._labelElement.removeClass(this._style),this._labelElement.addClass(a.style),this._style=a.style),this.shown||this.setShown(!0))},Human.view.labels.Label.prototype.setShown=function(a){this.shown!==a&&(a&&this.enabled?this._labelElement.show():this._labelElement.hide(),this.shown=a)},Human.view.labels.Label.prototype.setEnabled=function(a){this.enabled!==a&&(this.shown&&a?this._labelElement.show():this._labelElement.hide(),this.enabled=a)},Human.view.labels.Label.prototype.destroy=function(){delete g[this.labelId],d&&this._hasAudioFile&&(d.pause(),d.src=""),this.shown&&this.setShown(!1),this._labelElement&&(this._labelElement.remove(),this._labelElement=null)}}(),function(){"use strict";Human.rpc.define("labels.setEnabled",function(a){var b=a.enable;(void 0===b||null===b)&&(b=!Human.view.labels.getEnabled()),Human.view.labels.setEnabled(b)}),Human.rpc.define("labels.create",function(a){return a.objectId?(a.replace&&Human.view.labels.clearLabels(),void Human.view.labels.createLabel(a)):void this.error("parameter expected: 'objectId'")}),Human.rpc.define("labels.clear",function(){Human.view.labels.clearLabels()})}(),function(){"use strict";function a(a){var b,c;if(a)for(c in Human.scene.objects)Human.scene.objects.hasOwnProperty(c)&&(b=Human.scene.objects[c],b&&(Human.scene.selectedObjects.hasOwnProperty(c)?b.highlight||b.setHighlight(!0):b.highlight&&b.setHighlight(!1)));else for(c in Human.scene.objects)Human.scene.objects.hasOwnProperty(c)&&(b=Human.scene.objects[c],b.highlight&&b.setHighlight(!1))}var b=Human.view.highlight={};b.enabled=!0;var c=!1;Human.events.on("loaded",function(){b.setEnabled(!0)}),Human.events.on("scene.objectsSelected",function(){b.enabled&&(c=!0)}),Human.events.on("tick",function(){c&&(a(b.enabled),c=!1)}),b.setEnabled=function(a){b.enabled!==a&&(b.enabled=a,c=!0),Human.events.fire("highlight.toggled",{enabled:b.enabled}),b.enabled&&(Human.view.currentMode="Highlight")},b.getEnabled=function(){return b.enabled}}(),function(){"use strict";var a=Human.view.isolate={};a.enabled=!1;var b=!0;Human.events.on("loaded",function(){a.enabled=!1,b=!1}),Human.events.on("tick",function(){b&&(Human.scene.setShowSelectedObjects(a.enabled),b=!1)}),Human.events.on("scene.objectsSelected",function(){a.enabled&&(b=!0)}),a.setEnabled=function(c){a.enabled!==c&&(a.enabled=c,b=!0),Human.events.fire("isolate.toggled",{enabled:a.enabled}),a.enabled&&(Human.view.currentMode="Isolate",Human.view.pick.setSinglePickEnabled(!0),Human.view.pick.setMultiPickEnabled(!1))},a.getEnabled=function(){return a.enabled}}(),function(){"use strict";var a=Human.view.dissect={};a.enabled=!1;var b=[],c=[];Human.events.on("loaded",function(){a.enabled=!1}),a.setEnabled=function(b){a.enabled!==b&&(a.enabled=b,Human.events.fire("dissect.toggled",{enabled:a.enabled}))},a.getEnabled=function(){return a.enabled},a.dissect=function(d){if(a.enabled){c.length=0,b.push(d);var e={};e[d]=!1,Human.scene.setEnabledObjects({objectIds:e})}},a.undo=function(){if(!a.enabled,b.length){var d=b.pop(),e={};e[d]=!0,Human.scene.setEnabledObjects({objectIds:e}),c.unshift(d)}},a.redo=function(){if(a.enabled){var d,e;c.length&&(d=c.shift(),e={},e[d]=!1,Human.scene.setEnabledObjects({objects:e}),b.push(d))}},a.reset=function(){c.length=0,b.length=0}}(),function(){"use strict";function a(a){if(a.object){var b=a.object,c=d.objectAnnotations[b.objectId];c||(c=d.objectAnnotations[b.objectId]={annotations:{},numAnnotations:0}),c.annotations[a.annotationId]=a,c.numAnnotations++}}function b(a){if(a.object){var b=a.object,c=d.objectAnnotations[b.objectId];if(c){var e=c.annotations[a.annotationId];e&&(delete c.annotations[a.annotationId],0===--c.numAnnotations&&delete d.objectAnnotations[b.objectId])}}}function c(a,b){Human.events.fire(a,{annotationId:b.id||b.annotationId,type:b.type,styleId:b.styleId,objectId:b.object?b.object.objectId:null,title:b.label.title,description:b.label.description,pos:b.pin.pos,pinVec:b.pin.dir})}var d=Human.view.annotations={},e=new Human.utils.IDPool({prefix:"__a"});d.enabled=!1,d.shown=!0,d.annotations={},d.objectAnnotations={},d.unsavedAnnotation=null,function(){var a=0;Human.events.on("processes.started",function(){a||d.setShown(!1),a++}),Human.events.on("processes.finished",function(){--a||d.setShown(!0)}),Human.events.on("processes.failed",function(){--a||d.setShown(!0)})}(),d.setEnabled=function(a){d.enabled!==a&&(d.enabled=a,Human.events.fire("annotations.toggled",{enabled:a}))},d.createAnnotation=function(f){function g(a,b){a.setHighlight(b);for(var c=0,d=a.objects.length;d>c;c++)g(a.objects[c],b)}var h;if(f.objectId&&(h=Human.scene.objects[f.objectId],h||Human.log.warn("Human.view.annotations.createAnnotation","Scene object not found: '"+f.objectId+"'")),d.unsavedAnnotation&&(f.title=d.unsavedAnnotation.label.$titleField.val(),f.description=d.unsavedAnnotation.label.$descriptionField.val(),f.objectId=d.unsavedAnnotation.object?d.unsavedAnnotation.object.objectId:null,d.unsavedAnnotation.destroy(),d.unsavedAnnotation=null),f.annotationId){if(d.annotations[f.annotationId])return Human.log.error("Human.view.annotations.createAnnotation","Annotation with this ID already exists: '"+f.annotationId+"'"),null}else f.annotationId=e.getId();var i=new Human.view.annotations.Annotation(h,f);return d.annotations[f.annotationId]=i,a(i),d.unsavedAnnotation=f.saved?null:i,i.setAnnotationsShown(d.shown),i.on("picked",function(){Human.events.fire("annotations.picked",{annotationId:i.annotationId})}),i.label.on("mouseClick",function(){Human.events.fire("annotations.mouseClick",{annotationId:i.annotationId})}),i.label.on("mouseEnter",function(){i.object&&g(i.object,!0),Human.events.fire("annotations.mouseEnter",{annotationId:i.annotationId})}),i.label.on("mouseLeave",function(){i.object&&g(i.object,!1),Human.events.fire("annotations.mouseLeave",{annotationId:i.annotationId})}),i.on("saved",function(){d.unsavedAnnotation&&d.unsavedAnnotation.annotationId===i.annotationId?c("annotations.created",i):c("annotations.updated",i),d.unsavedAnnotation=null}),i.on("destroyed",function(){d.unsavedAnnotation=null,delete d.annotations[i.annotationId],b(i),Human.events.fire("annotations.destroyed",{annotationId:i.annotationId})}),f.saved?(c("annotations.created",i),d.unsavedAnnotation=null):Human.events.fire("annotations.creating",{annotationId:i.annotationId}),i},d.updateDimensions=function(){for(var a in d.annotations)d.annotations.hasOwnProperty(a)&&d.annotations[a].label.updateWidth()},d.setShown=function(a){if(d.shown!==a){for(var b in d.annotations)d.annotations.hasOwnProperty(b)&&d.annotations[b].setAnnotationsShown(a);d.shown=a,Human.events.fire("annotations.shown",{shown:a})}},d.clearAnnotations=function(){d.unsavedAnnotation=null;for(var a in d.annotations)d.annotations.hasOwnProperty(a)&&d.annotations[a].destroy()},d.getAnnotations=function(a){var b={},c=d.annotations;a.objectId&&(c=d.objectAnnotations.hasOwnProperty(a.objectId)?d.objectAnnotations[a.objectId].annotations:{});var e=a.type;for(var f in c)if(c.hasOwnProperty(f)){var g=c[f];e&&e!==g.type||(b[f]=g)}return b},d.setLabelsShown=function(a){var b,c,e,f,g={},h=a.type;if(a.annotations){c=a.annotations;for(e in c)c.hasOwnProperty(e)&&(b=d.annotations[e],b&&(h&&h!==b.type||(g[e]=c[e])))}else if(a.objects){c=a.objects;for(var i in c)if(c.hasOwnProperty(i)){var j=Human.scene.objects[i];if(j){var k=d.objectAnnotations[i];if(k){f=c[i];for(e in k.annotations)k.annotations.hasOwnProperty(e)&&(b=k.annotations[e],h&&h!==b.type||(g[e]=f))}}}}else if(a.type){f=a.shown!==!1;for(e in d.annotations)d.annotations.hasOwnProperty(e)&&(b=d.annotations[e],b&&(h&&h!==b.type||(g[e]=f)))}if(a.replace)for(e in d.annotations)d.annotations.hasOwnProperty(e)&&(g[e]||(b=d.annotations[e],h&&h!==b.type||(b.pin.setShown(!1),b.label.setShown(!1))));for(e in g)if(g.hasOwnProperty(e)){var l=g[e];b=d.annotations[e],b.pin.setShown(l),b.label.setShown(l)}},d.updateAnnotation=function(a,b){var e=d.annotations[a];if(e){var f=e.label;b.title&&b.title!==f.title&&f.setTitle(b.title),b.description&&b.description!==f.description&&f.setDescription(b.description),c("annotations.updated",e)}}}(),function(){"use strict";Human.view.annotations.Annotation=function(a,b){var c=this;this._init(),this.type=b.type||"default",this.annotationId=b.annotationId,this.annotationsShown=Human.view.annotations.shown,this.label=new Human.view.annotations.Label(this,{enabled:b.enabled,shown:b.labelShown,title:b.title,description:b.description,saved:b.saved,isOwner:b.isOwner,embed:b.embed}),this.wire=$('<div class="annotationWire"></div>').appendTo("#container"),this.pin=new Human.view.annotations.Pin(this,b.annotationId,{enabled:b.enabled,shown:b.shown,pos:b.pos,dir:b.dir}),this.saved=void 0!==b.saved&&null!==b.saved?b.saved:!1,this.pin.on("picked",function(){return c.label.saved?(c.label.setShown(!c.label.shown),void c.publish("picked",!0,!0)):void alert("Please save or cancel annotation before hiding label")}),this.label.on("saved",function(){c.publish("saved",c.saved=!0)}),this.label.on("delete",function(){c.destroy()});var d=function(a){a?c.wire.show():c.wire.hide()};if(this.pin.on("enabled",function(a){d(c.annotationsShown&&a&&!c.label.culled&&c.label.shown&&c.pin.shown)}),this.label.on("shown",function(a){d(c.annotationsShown&&c.pin.enabled&&!c.label.culled&&a&&c.pin.shown)}),this.label.on("culled",function(a){d(c.annotationsShown&&c.pin.enabled&&!a&&c.label.shown&&c.pin.shown)}),this.label.on("annotationsShown",function(){d(c.annotationsShown&&c.pin.enabled&&!c.label.culled&&c.label.shown&&c.pin.shown)}),this.pin.on("occluded",function(a){a&&c.wire.css("opacity","0")}),this.object=null,a&&(this.setObject(a),b.pos||this.pin.setPos(a.getCenter())),b.on){var e=b.on;e.mouseClick&&this.label.on("mouseClick",function(){Human.rpc.call(null,e.mouseClick.call,e.mouseClick)})}},Human.utils.extend(Human.view.annotations.Annotation,Human.Component),Human.view.annotations.Annotation.prototype.setObject=function(a){this._objectShown&&this.object.off(this._objectShown);var b=this;this._objectShown=a.on("shown",function(a){b.pin.setEnabled(a),b.label.setEnabled(a)}),this._objectDestroyed=a.on("destroyed",function(){b.destroy()}),this.publish("object",this.object=a)},Human.view.annotations.Annotation.prototype.setAnnotationsShown=function(a){this.annotationsShown=a,this.pin.setAnnotationsShown(a),this.label.setAnnotationsShown(a)
  },Human.view.annotations.Annotation.prototype.setShown=function(a){this.pin.setShown(a),this.label.setShown(a)},Human.view.annotations.Annotation.prototype.destroy=function(){this.pin.destroy(),this.label.destroy(),this.wire.remove(),this._objectShown&&this.object.off(this._objectShown),this._objectDestroyed&&this.object.off(this._objectDestroyed),this.publish("destroyed",!0)}}(),function(){"use strict";Human.view.annotations.Pin=function(a,b,c){var d=$("#container");this._init(),this._id=b,this.annotation=a,this.annotationsShown=Human.view.annotations.shown,this.enabled=c.enabled!==!1,this.shown=c.shown!==!1,this.culled=!1,this.pos=c.pos||[0,0,0],this.occluded=!1,this.dir=c.dir||[0,0,-1],this._element=$('<div class="annotationPin"></div>'),this.setPos(c.pos||[0,0,0]),this.setDir(c.dir||[0,0,0]),this.setAnnotationsShown(Human.view.annotations.shown),this.setEnabled(void 0!==c.enabled&&null!==c.enabled?c.enabled:!0),this.setShown(void 0!==c.shown&&null!==c.shown?c.shown:!0),this.setCulled(!!c.culled),this.setOpacity(1),d.append(this._element),this._element.click(this.pick.bind(this))},Human.utils.extend(Human.view.annotations.Pin,Human.Component),Human.view.annotations.Pin.prototype.setAnnotationsShown=function(a){this._showElement(a&&this.enabled&&this.shown&&!this.culled&&!this.occluded),this.publish("enabled",this.annotationsShown=a)},Human.view.annotations.Pin.prototype.setEnabled=function(a){this._showElement(this.annotationsShown&&a&&this.shown&&!this.culled&&!this.occluded),this.publish("enabled",this.enabled=a)},Human.view.annotations.Pin.prototype.setShown=function(a){this._showElement(this.annotationsShown&&this.enabled&&a&&!this.culled&&!this.occluded),this.publish("shown",this.shown=a)},Human.view.annotations.Pin.prototype._showElement=function(a){a?this._element.show():this._element.hide()},Human.view.annotations.Pin.prototype.cullToRectangle=function(a,b,c,d){var e=this.canvasPos;if(e)return this.setCulled(e[0]<a||e[0]>c||e[1]<b||e[1]>d),this.culled},Human.view.annotations.Pin.prototype.setCulled=function(a){this._showElement(this.annotationsShown&&this.enabled&&this.shown&&!a&&!this.occluded),this.publish("culled",this.culled=a)},Human.view.annotations.Pin.prototype.transform=function(a,b,c){this.worldPos=this.pos,this.viewPos=Human.math.transformPoint3(a,this.worldPos),this.viewPos[3]=1;var d=Human.math.transformPoint4(b,this.viewPos),e=d[0],f=d[1],g=d[3];this.canvasPos=[(1+e/g)*c.width/2,(1-f/g)*c.height/2],this._element.css({left:this.canvasPos[0],top:this.canvasPos[1]})},Human.view.annotations.Pin.prototype.setOccluded=function(a){this._showElement(this.annotationsShown&&this.enabled&&this.shown&&!this.culled&&!a),this.publish("occluded",this.occluded=a)},Human.view.annotations.Pin.prototype.setViewAngle=function(a){this.publish("angle",this.viewAngle=a)},Human.view.annotations.Pin.prototype.setOpacity=function(a){this._element.css({opacity:this.opacity=a}),this.publish("opacity",a)},Human.view.annotations.Pin.prototype.setPos=function(a){this.publish("pos",this.pos=a)},Human.view.annotations.Pin.prototype.setDir=function(a){this.publish("dir",this.dir=a)},Human.view.annotations.Pin.prototype.pick=function(){this.publish("picked",!0,!0)},Human.view.annotations.Pin.prototype.destroy=function(){Human.renderer.getNode(Human.NULL_OBJECT_ID).off(this._rendered),this._element.remove(),this.publish("destroyed",!0)}}(),function(a,b){"use strict";var c=a.view.annotations.Label=function(c,e){this._init(),this.annotation=c,this.saved=!!e.saved;var f=!e.saved||e.saved&&e.isOwner,g=this.editing=f&&!this.saved,h=this.saved?"":"new",i=f?"editable":"",j=g?"editing":"",k=[h,i,j].join(" "),l=b("#container");this.$element=b(['<div class="annotationContainer">','<div class="annotationTitle clearfix">','<input type="text" placeholder="Title">',"<h1></h1>",'<button class="annotationDelete"></button>',"</div>",'<div class="annotationDescription">','<textarea placeholder="Description"></textarea>',"<p></p>","</div>",'<div class="embedContainer"></div>',"</div>"].join("")),this.$titleContainer=this.$element.find(".annotationTitle"),this.$title=this.$element.find("h1"),this.$description=this.$element.find("p"),this.$titleField=this.$element.find("input"),this.$descriptionField=this.$element.find("textarea"),d(this.$titleField,100),d(this.$descriptionField,300),this.setTitle(e.title||""),this.setDescription(e.description||""),this.$element.addClass(k).appendTo(l),this.bindHandlers(f),this.setAnnotationsShown(a.view.annotations.shown),this.setEnabled(e.enabled!==!1),this.setShown(e.shown!==!1),this.setCulled(!!e.culled),this.setOccluded(!!e.occluded),e.embed&&this.setEmbed(e.embed),this.updateWidth()};a.utils.extend(a.view.annotations.Label,a.Component),c.prototype.bindHandlers=function(a){var c=this,d=b(document),e=function(a){var e=b(a.target),f=0===e.closest(".annotationContainer").length;f&&(c.$titleField.val()||c.$descriptionField.val()?c.save():c.$element.find(".annotationDelete").trigger("click"),d.off("click.set-annotation"))};a&&this.editing&&d.on("click.set-annotation",function(a){e(a)}),this.$element.click(function(){a&&!c.editing&&(c.editing=!0,c.$descriptionField.height(c.$description[0].offsetHeight),c.$element.addClass("editing"),c.publish("edit",!0,!0),c.publish("updateWidth",!0,!0),d.on("click.set-annotation",function(a){e(a)})),c.publish("mouseClick",!0,!0)}),this.$descriptionField.blur(this.save.bind(this)),this.$element.find(".annotationDelete").click(function(a){a.preventDefault(),c.publish("delete",!0,!0)}),this.$element.mouseenter(function(){c.publish("mouseEnter",!0,!0)}),this.$element.mouseleave(function(){c.publish("mouseLeave",!0,!0)}),this.on("updateWidth",this._redrawWireConnection.bind(this))},c.prototype.save=function(){this.editing=!1,this.setTitle(this.$titleField.val()),this.setDescription(this.$descriptionField.val()),this.$element.removeClass("new editing"),this.publish("saved",this.saved=!0),this.publish("updateWidth",!0,!0)},c.prototype.setAnnotationsShown=function(a){this._showElement(a&&this.enabled&&this.shown&&!this.culled&&!this.occluded),this.publish("annotationsShown",this.annotationsShown=a)},c.prototype.setEnabled=function(a){this._showElement(this.annotationsShown&&a&&this.shown&&!this.culled&&!this.occluded),this.publish("enabled",this.enabled=a)},c.prototype.setShown=function(a){this._showElement(this.annotationsShown&&this.enabled&&a&&!this.culled&&!this.occluded),this.publish("shown",this.shown=a)},c.prototype.setCulled=function(a){this._showElement(this.annotationsShown&&this.enabled&&this.shown&&!a&&!this.occluded),this.publish("culled",this.culled=a)},c.prototype.setOccluded=function(a){this._showElement(this.annotationsShown&&this.enabled&&this.shown&&!this.culled&&!a),this.publish("occluded",this.occluded=a)},c.prototype.setOpacity=function(a){this.$element.css({opacity:this.opacity=a}),this.publish("opacity",a)},c.prototype._showElement=function(a){a?this.$element.css("display","inline-block"):this.$element.hide()},c.prototype.setTitle=function(a){this.$titleField.val(a),this.$title.html(a),this.publish("title",this.title=a)},c.prototype.setDescription=function(a){this.$descriptionField.val(a),this.$description.html(a),this.publish("description",this.description=a)},c.prototype.setEmbed=function(a){var b=["ui-all=false"];for(var c in a)a.hasOwnProperty(c)&&b.push(c+"="+a[c]);var d="/embedded.html?"+b.join("&"),e='<iframe src="'+d+'" width="150" height="150" border="0"></iframe>';this.$element.addClass("annotationEmbed"),this.$element.find(".embedContainer").append(e).show(),this.publish("embed",this.embed=a)},c.prototype.setPos=function(a,b){b&&(a[1]=a[1]-this.$titleContainer[0].offsetHeight),this.$element.css({left:a[0]+"px",top:a[1]+"px"}),this.publish("pos",this.pos=a)},c.prototype.setSide=function(a){this.side=a,this.$element.removeClass("left right").addClass(a),this.connectionPoint=[this.pos[0]+("left"===a?this.getWidth():0),this.pos[1]+this.$titleContainer[0].offsetHeight]},c.prototype.getTop=function(){return this.$element[0].offsetTop},c.prototype.getBottom=function(){return this.$element[0].offsetTop+this.getHeight()},c.prototype.getHeight=function(){return this.$element[0].offsetHeight},c.prototype.getWidth=function(){return this.$element[0].offsetWidth},c.prototype.updateWidth=function(){this.width=this.getWidth()},c.prototype._redrawWireConnection=function(){this.updateWidth(),a.view.annotations.layouts.redrawLayout()},c.prototype.destroy=function(){this.$element.remove(),this.publish("destroyed",!0)};var d=function(a,b){b&&b>0&&(a.attr("maxlength",b),a.keyup(function(c){13!==c.keyCode&&a.val().length>=b&&alert("Maximum characters allowed ("+b+")")}))}}(Human,jQuery),function(){"use strict";var a=Human.view.annotations.placer={};a.placeAnnotation=function(a){var b=Human.view.camera.eye,c=Human.math.subVec3([b.x,b.y,b.z],a.pos);Human.view.annotations.createAnnotation({objectId:a.objectId,title:a.title||"",description:a.description||"",pos:a.pos,dir:c,enabled:!0,shown:!0,labelShown:!0,saved:void 0!==a.saved&&null!==a.saved?a.saved:!1})}}(),function(){"use strict";function a(){b&&b.setDirty()}var b,c=Human.view.annotations.layouts={},d={};c.activeLayout=null,Human.events.on("loaded",function(){var a=document.getElementById("annotationCanvas");if(!a)return void Human.log.error("Human.view.annotations.layouts","DOM element not found: 'annotationCanvas'");var d=a.getContext("2d");return d?(Human.properties.subscribe({propId:"annotations.layout.type",value:"columns",callback:function(a){c._selectLayout(a)}}),void Human.events.on("tick",function(){b&&a&&d&&b.layout(a,d)})):void Human.log.error("Human.view.annotations.layouts","Failed to get 2D canvas context")}),Human.events.on("camera.updated",function(){a()}),Human.events.on("canvas.resized",function(){a()}),Human.events.on("annotations.creating",function(a){e(a)}),Human.events.on("annotations.created",function(a){e(a)});var e=function(b){Human.events.onEvent("annotations.shown",a);var c=Human.view.annotations.annotations[b.annotationId];c.on("object",a),c.pin.on("enabled",a),c.pin.on("shown",a),c.label.on("shown",a),c.label.on("edit",a),c.label.on("saved",a),c.label.on("cancel",a),c.label.on("destroyed",a),a()};Human.events.on("snapshot.rendering",function(a){b&&b.snapshot&&b.snapshot(a.canvas,a.context,a.bgColor)}),c.addLayoutType=function(a,e){return d[a]?void Human.log.error("Human.view.annotations.layouts.addLayoutType","Layout already added: '"+a+"'"):e.setEnabled?e.setDirty?e.layout?(d[a]=e,void(b||c._selectLayout(a))):void Human.log.error("Human.view.annotations.layouts.addLayoutType","Layout strategy does not have a 'layout' method"):void Human.log.error("Human.view.annotations.layouts.addLayoutType","Layout strategy does not have a 'setDirty' method"):void Human.log.error("Human.view.annotations.layouts.addLayoutType","Layout strategy does not have a 'setEnabled' method")},c._selectLayout=function(a){return Human.log.info("Human.view.annotations.layouts._selectLayout","Selecting label type: '"+a+"'"),d[a]?(b&&b.setEnabled(!1),b=d[a],b.setEnabled(!0),b.setDirty(),void(c.activeLayout=a)):void Human.log.error("Human.view.annotations.layouts._selectLayout","Layout not found: '"+a+"'")},c.redrawLayout=a}(),Human.view.annotations.layouts.addLayoutType("columns",function(){"use strict";function a(a,b,c,d){var e,f,g,h,i,j,k,l,m=Human.scene.enabledObjects,n={xmin:Human.math.MAX_DOUBLE,ymin:Human.math.MAX_DOUBLE,xmax:Human.math.MIN_DOUBLE,ymax:Human.math.MIN_DOUBLE};for(var o in m)if(m.hasOwnProperty(o)){var p=m[o];if(0===p.numSubObjects){e=p.getBoundary(),f=[[e.xmin,e.ymin,e.zmin],[e.xmax,e.ymin,e.zmin],[e.xmax,e.ymax,e.zmin],[e.xmin,e.ymax,e.zmin],[e.xmin,e.ymin,e.zmax],[e.xmax,e.ymin,e.zmax],[e.xmax,e.ymax,e.zmax],[e.xmin,e.ymax,e.zmax]];for(var q=0;8>q;q++)g=f[q],h=Human.math.transformPoint3(c,f[q]),h[2]>.1||(h[3]=1,i=Human.math.transformPoint4(d,h),j=i[0],k=i[1],l=i[3],j=(1+j/l)*a.width/2,k=(1-k/l)*a.height/2,0>j||0>k||j>a.width||k>a.height||(n.xmin>j&&(n.xmin=j),n.ymin>k&&(n.ymin=k),n.xmax<j&&(n.xmax=j),n.ymax<k&&(n.ymax=k)))}}return n}function b(a){var b=Human.view.camera.eye,c=Human.math.subVec3([b.x,b.y,b.z],a.pos),d=Human.math.dotVector3(c,a.dir),e=Human.math.lenVec3(c),f=Human.math.lenVec3(a.dir),g=57.2957795*Math.acos(d/(e*f));return g}function c(a,b){for(var c,d,e=0;b-1>e;e++){d=e;for(var f=e;b>f;f++)a[f].pin.canvasPos[1]<a[d].pin.canvasPos[1]&&(d=f);c=a[e],a[e]=a[d],a[d]=c}}function d(a,b,c,d,e,f){for(var h,k,l,m,n=0>f?Math.max(g.left,c.xmin-i-50):Math.min(a.width-g.right-i,c.xmax),o=Math.max(g.top,c.ymin),p=Math.min(g.bottom,c.ymax),q=o,r=a.height-o-p,s=r/e,t=0;e>t;t++){h=d[t],k=h.pin,l=h.label,m=h.wire;var u=k.canvasPos[0],v=k.canvasPos[1];l.setPos([n,j?v:q],j),l.setSide(0>f?"left":"right");var w,x=l.connectionPoint,y=Math.sqrt(Math.pow(x[0]-u,2)+Math.pow(x[1]-v,2));w=j?0>f?0:180:180*Math.atan2(v-x[1],u-x[0])/Math.PI,m.css({width:y+"px",left:x[0]+"px",top:x[1]+"px",opacity:k.opacity,"-webkit-transform":"rotate("+w+"deg)","-moz-transform":"rotate("+w+"deg)","-ms-transform":"rotate("+w+"deg)","-o-transform":"rotate("+w+"deg)",transform:"rotate("+w+"deg)"}),q+=s}}function e(a,b,c){var d=a.label,e=a.pin,g=d.pos[0]*b.scaleX,h=d.connectionPoint[0]*b.scaleX,i=d.connectionPoint[1]*b.scaleY,j=b.context,k=Math.min(b.width-g-10,d.width*b.scaleX),l=function(a,b,c){var d=1.25*b;j.font=b+"px Arial";for(var e=f(j,a||"",k),h=i+c(e,d),l=0;l<e.length;l++)j.fillText(e[l],g,h+d*l)};j.fillStyle="white"===c?"rgb(0, 0, 0)":"rgb(255, 255, 255)",l(d.title,24,function(a,b){return-(a.length-1)*b-20}),l(d.description,24,function(a,b){return b+10});var m=e.opacity;j.strokeStyle="rgba(204, 204, 204, "+m+")",j.beginPath(),j.moveTo(e.canvasPos[0]*b.scaleX,e.canvasPos[1]*b.scaleY),j.lineTo(h,i);var n="left"===d.side?-k:k;j.lineTo(h+n,i),j.stroke();var o=function(a,c,d){j.fillStyle=c,j.beginPath(),j.arc(e.canvasPos[0]*b.scaleX,e.canvasPos[1]*b.scaleY,a,0,2*Math.PI),j.fill(),d&&d()};o(8,"rgb(255, 255, 255)",function(){j.lineWidth=1,j.strokeStyle="rgb(204, 204, 204)",j.stroke()}),o(4,"rgb(153,0,0)")}function f(a,b,c){for(var d=b.split(" "),e="",f=[],g=0;g<d.length;g++){var h=e+d[g],i=a.measureText(h);i.width>c&&g>0?(f.push(e),e=d[g]+" "):e=h+" "}return f.push(e),f}var g,h={};Human.properties.subscribe({propId:"annotations.margins",value:{top:50,left:50,right:50,bottom:50},callback:function(a){g=a}});var i;Human.properties.subscribe({propId:"annotations.labelWidth",value:150,callback:function(a){i=a}});var j=!1;Human.properties.subscribe({propId:"annotations.horizontalLines",value:j,callback:function(a){j=a,p=!0}});var k=100;Human.properties.subscribe({propId:"annotations.occludedAngle",value:k,callback:function(a){k=a,p=!0}});var l=80;Human.properties.subscribe({propId:"annotations.fadeoutAngle",value:l,callback:function(a){l=a,p=!0}});var m,n,o=!1,p=!0,q=[],r=0,s=[],t=0;return h.setEnabled=function(a){o=a,p=!0},h.setDirty=function(){p=!0},h.layout=function(e,f){if(p){if(f.clearRect(0,0,e.width,e.height),!Human.view.annotations.shown)return void(p=!1);r=0,t=0;var h,j,o,u,v=Human.view.annotations.annotations,w=Human.renderer.getViewMat(),x=Human.renderer.getProjMat(),y=a(e,f,w,x);Human.request.getSearchParam("showBoundary")&&(f.beginPath(),f.rect(y.xmin,y.ymin,y.xmax-y.xmin,y.ymax-y.ymin),f.lineWidth=2,f.strokeStyle="black",f.stroke());for(var z in v)if(v.hasOwnProperty(z)){if(h=v[z],j=h.pin,o=h.label,!j.shown||!j.enabled)continue;if(!o.shown&&!j.shown)continue;j.transform(w,x,e);var A=b(j);j.setViewAngle(A);var B=-k>A||A>k;j.setOccluded(B);var C;A>=l?(C=1-(A-l)/(k-l),0>C&&(C=0)):C=1,j.setOpacity(C),o.setOpacity(C),j.cullToRectangle(g.left,0,e.width-g.right-i,e.height),j.culled!==o.culled&&o.setCulled(j.culled),j.occluded!==o.occluded&&o.setOccluded(j.occluded),j.enabled&&j.shown&&!j.culled&&!j.occluded&&o.shown&&(u=h.pin.viewPos[0]<0,u?q[r++]=h:s[t++]=h)}c(q,r),c(s,t),d(e,f,y,q,r,-1),d(e,f,y,s,t,1),m=e.width,n=e.height,p=!1}},h.snapshot=function(a,b,c){if(Human.view.annotations.shown){var d,f,g=a.width,h=a.height,i=g/m,j=h/n,k=Human.view.annotations.annotations,l={context:b,width:g,height:h,halfWidth:g/2,scaleX:i,scaleY:j};for(var o in k)k.hasOwnProperty(o)&&(d=k[o],d.pin.enabled&&!d.pin.occluded&&(f=d.label,f.shown&&e(d,l,c)))}},h}()),Human.view.annotations.layouts.addLayoutType("columns-v2",function(){"use strict";function a(a,b,c){var d,e,f,g,h,i,j,k,l=Human.scene.enabledObjects,m={xmin:Human.math.MAX_DOUBLE,ymin:Human.math.MAX_DOUBLE,xmax:Human.math.MIN_DOUBLE,ymax:Human.math.MIN_DOUBLE};for(var n in l)if(l.hasOwnProperty(n)){var o=l[n];if(0===o.numSubObjects){d=o.getBoundary(),e=[[d.xmin,d.ymin,d.zmin],[d.xmax,d.ymin,d.zmin],[d.xmax,d.ymax,d.zmin],[d.xmin,d.ymax,d.zmin],[d.xmin,d.ymin,d.zmax],[d.xmax,d.ymin,d.zmax],[d.xmax,d.ymax,d.zmax],[d.xmin,d.ymax,d.zmax]];for(var p=0;8>p;p++)f=e[p],g=Human.math.transformPoint3(b,e[p]),g[2]>.1||(g[3]=1,h=Human.math.transformPoint4(c,g),i=h[0],j=h[1],k=h[3],i=(1+i/k)*a.width/2,j=(1-j/k)*a.height/2,0>i||0>j||i>a.width||j>a.height||(m.xmin>i&&(m.xmin=i),m.ymin>j&&(m.ymin=j),m.xmax<i&&(m.xmax=i),m.ymax<j&&(m.ymax=j)))}}return m}function b(a){var b=Human.view.camera.eye,c=Human.math.subVec3([b.x,b.y,b.z],a.pos),d=Human.math.dotVector3(c,a.dir),e=Human.math.lenVec3(c),f=Human.math.lenVec3(a.dir),g=57.2957795*Math.acos(d/(e*f));return g}function c(a,b){for(var c,d,e=0;b-1>e;e++){d=e;for(var f=e;b>f;f++)a[f].pin.canvasPos[1]<a[d].pin.canvasPos[1]&&(d=f);c=a[e],a[e]=a[d],a[d]=c}}function d(a,b,c,d,j,k){if(0!==j){var m,n,o,p=e(d,j),q=0>k?Math.max(l.left,c.xmin-p):Math.min(a.width-l.right-p,c.xmax);if(1===j)return n=d[0],void h(n,k,q,n.pin.canvasPos[1]);if(2===j){n=d[0],o=d[1];var r=!1;return h(n,k,q,n.pin.canvasPos[1]),m=i(n,o,r),void h(o,k,q,m)}var s=f(d,j),t=s/2,u=g(d,j),v=0;0>u-t&&(v=0-(u-t)),u+t>a.height&&(v=a.height-(u+t));var w=Math.round(j/2)-1;h(d[w],k,q,u+v);for(var x,y,z=1,A=!0,B=w,C=w;j>z;){if(A){if(0===B){A=!A;continue}x=d[B],y=d[--B],m=i(x,y,A)}else{if(C===j-1){A=!A;continue}x=d[C],y=d[++C],m=i(x,y,A)}h(y,k,q,m),z++,A=!A}}}function e(a,b){for(var c,d=0,e=0;b>e;e++)c=a[e].label.getWidth(),c>d&&(d=c,d=c);return d}function f(a,b){for(var c=0,d=0;b>d;d++)c+=a[d].label.getHeight();return c+60*(b-0)}function g(a,b){for(var c,d=1e5,e=-1e5,f=0;b>f;f++)c=a[f].pin.canvasPos[1],d>c&&(d=c),c>e&&(e=c);return.5*(d+e)}function h(a,b,c,d){var e=a.pin,f=a.label,g=a.wire,h=e.canvasPos[0],i=e.canvasPos[1];f.setPos([c,d]),f.setSide(0>b?"left":"right");var j,k=f.connectionPoint,l=Math.sqrt(Math.pow(k[0]-h,2)+Math.pow(k[1]-i,2));j=180*Math.atan2(i-k[1],h-k[0])/Math.PI,g.css({width:l+"px",left:k[0]+"px",top:k[1]+"px",opacity:e.opacity,"-webkit-transform":"rotate("+j+"deg)","-moz-transform":"rotate("+j+"deg)","-ms-transform":"rotate("+j+"deg)","-o-transform":"rotate("+j+"deg)",transform:"rotate("+j+"deg)"})}function i(a,b,c){{var d=a.label,e=b.label,f=d.getTop(),g=d.getBottom(),h=e.getHeight();b.pin.canvasPos[1]}return c?f-30-h:g+30}function j(a,b,c){var d=a.label,e=a.pin,f=d.pos[0]*b.scaleX,g=d.connectionPoint[0]*b.scaleX,h=d.connectionPoint[1]*b.scaleY,i=b.context,j=Math.min(b.width-f-10,d.width*b.scaleX),l=function(a,b,c){var d=1.25*b;i.font=b+"px Arial";for(var e=k(i,a||"",j),g=h+c(e,d),l=0;l<e.length;l++)i.fillText(e[l],f,g+d*l)};i.fillStyle="white"===c?"rgb(0, 0, 0)":"rgb(255, 255, 255)",l(d.title,24,function(a,b){return-(a.length-1)*b-20}),l(d.description,24,function(a,b){return b+10});var m=e.opacity;i.strokeStyle="rgba(204, 204, 204, "+m+")",i.beginPath(),i.moveTo(e.canvasPos[0]*b.scaleX,e.canvasPos[1]*b.scaleY),i.lineTo(g,h);var n="left"===d.side?-j:j;i.lineTo(g+n,h),i.stroke();var o=function(a,c,d){i.fillStyle=c,i.beginPath(),i.arc(e.canvasPos[0]*b.scaleX,e.canvasPos[1]*b.scaleY,a,0,2*Math.PI),i.fill(),d&&d()};o(8,"rgb(255, 255, 255)",function(){i.lineWidth=1,i.strokeStyle="rgb(204, 204, 204)",i.stroke()}),o(4,"rgb(153,0,0)")}function k(a,b,c){for(var d=b.split(" "),e="",f=[],g=0;g<d.length;g++){var h=e+d[g],i=a.measureText(h);i.width>c&&g>0?(f.push(e),e=d[g]+" "):e=h+" "}return f.push(e),f}var l,m={};Human.properties.subscribe({propId:"annotations.margins",value:{top:50,left:50,right:50,bottom:50},callback:function(a){l=a}});var n=100;Human.properties.subscribe({propId:"annotations.occludedAngle",value:n,callback:function(a){n=a,s=!0}});var o=80;Human.properties.subscribe({propId:"annotations.fadeoutAngle",value:o,callback:function(a){o=a,s=!0}});var p,q,r=!1,s=!0,t=[],u=0,v=[],w=0,x=Human.request.getSearchParam("showBoundary");return m.setEnabled=function(a){r=a,s=!0},m.setDirty=function(){s=!0},m.layout=function(e,f){if(s){if(f.clearRect(0,0,e.width,e.height),!Human.view.annotations.shown)return void(s=!1);u=0,w=0;var g=Human.renderer.getViewMat(),h=Human.renderer.getProjMat(),i=a(e,g,h);x&&(f.beginPath(),f.rect(i.xmin,i.ymin,i.xmax-i.xmin,i.ymax-i.ymin),f.lineWidth=2,f.strokeStyle="black",f.stroke());var j,k,m,r,y=Human.view.annotations.annotations,z=e.height,A=e.width,B=i.xmin+.5*(i.xmax-i.xmin);for(var C in y)if(y.hasOwnProperty(C)){if(j=y[C],k=j.pin,m=j.label,!k.shown||!k.enabled)continue;if(!m.shown&&!k.shown)continue;k.transform(g,h,e);var D=b(k);k.setViewAngle(D);var E=-n>D||D>n;k.setOccluded(E);var F;D>=o?(F=1-(D-o)/(n-o),0>F&&(F=0)):F=1,k.setOpacity(F),m.setOpacity(F),k.cullToRectangle(l.left,0,A-l.right-m.getWidth(),z),k.culled!==m.culled&&m.setCulled(k.culled),k.occluded!==m.occluded&&m.setOccluded(k.occluded),k.enabled&&k.shown&&!k.culled&&!k.occluded&&m.shown&&(r=j.pin.canvasPos[0]<B,r?t[u++]=j:v[w++]=j)}u&&(c(t,u),d(e,f,i,t,u,-1)),w&&(c(v,w),d(e,f,i,v,w,1)),p=e.width,q=e.height,s=!1}},m.snapshot=function(a,b,c){if(Human.view.annotations.shown){var d,e,f=a.width,g=a.height,h=f/p,i=g/q,k=Human.view.annotations.annotations,l={context:b,width:f,height:g,halfWidth:f/2,scaleX:h,scaleY:i};for(var m in k)k.hasOwnProperty(m)&&(d=k[m],d.pin.enabled&&!d.pin.occluded&&(e=d.label,e.shown&&j(d,l,c)))}},m}()),Human.view.annotations.layouts.addLayoutType("radial",function(){"use strict";function a(a,b){for(var c,d,e=0;b-1>e;e++){d=e;for(var f=e;b>f;f++)a[f].pin.pos[1]>a[d].pin.pos[1]&&(d=f);c=a[e],a[e]=a[d],a[d]=c}}function b(a,b,c,d,e){for(var f,g,h,i=a.width/2,j=a.height,k=j/d,l=50,m=0;d>m;m++)f=c[m],g=f.pin,h=f.label,h.setPos([e,l]),b.strokeStyle="rgb(0, 0, 100)",b.beginPath(),b.moveTo(g.canvasPos[0],g.canvasPos[1]),i>e?b.lineTo(e+h.getWidth(),l):b.lineTo(e,l),b.closePath(),b.stroke(),l+=k}function c(a,b){var c=a.label,e=a.pin,f=c.pos[0]*b.scaleX,g=c.pos[1]*b.scaleY,h=120,i=20,j=b.context,k=Math.min(b.width-f-10,h),l=d(j,c.description||"",k);j.font="12pt Arial",j.fillStyle="rgb(34, 168, 221)",j.fillText(c.title||"",f,g+10),j.font="10pt Arial",j.fillStyle="rgb(255, 255, 255)";for(var m=0;m<l.length;m++)j.fillText(l[m],f,g+30+i*m);j.strokeStyle="rgb(0, 0, 100)",j.beginPath(),j.moveTo(e.canvasPos[0],e.canvasPos[1]),f<b.halfWidth?j.lineTo(f+k,g-7):j.lineTo(f-7,g-7),j.closePath(),j.stroke()}function d(a,b,c){for(var d=b.split(" "),e="",f=[],g=0;g<d.length;g++){var h=e+d[g],i=a.measureText(h);i.width>c&&g>0?(f.push(e),e=d[g]+" "):e=h+" "}return f.push(e),f}var e={},f=!0;Human.properties.subscribe({propId:"annotation.layout.wires",value:!0,callback:function(a){f=a}});var g=100;Human.properties.subscribe({propId:"annotation.layout.labelMargins",value:100,callback:function(a){g=a}});var h=200;Human.properties.subscribe({propId:"annotation.layout.labelWidth",value:100,callback:function(a){h=a}});var i,j,k=!1,l=!0,m=[],n=0,o=[],p=0;return e.setEnabled=function(a){k=a,l=!0},e.setDirty=function(){l=!0},e.layout=function(c,d){if(l){n=0,p=0;var e,f,k,q,r=Human.view.annotations.annotations;for(var s in r)r.hasOwnProperty(s)&&(e=r[s],f=e.pin,k=e.label,f.cullToRectangle(0,0,c.width,c.height),f.culled!==k.culled&&k.setCulled(f.culled),f.enabled&&f.shown&&!f.culled&&k.shown&&e.pin.viewPos&&(q=e.pin.viewPos[0]<0,q?m[n++]=e:o[p++]=e));a(m,n),a(o,p),d.clearRect(0,0,c.width,c.height),b(c,d,m,n,g),b(c,d,o,p,c.width-g-h),i=c.width,j=c.height,l=!1}},e.snapshot=function(a,b){var d,e,f=a.width,g=a.height,h=f/i,k=g/j,l=Human.view.annotations.annotations,m={context:b,width:f,height:g,halfWidth:f/2,scaleX:h,scaleY:k};for(var n in l)l.hasOwnProperty(n)&&(d=l[n],d.pin.enabled&&(e=d.label,e.shown&&c(d,m)))},e}()),Human.view.annotations.layouts.addLayoutType("floating",function(){"use strict";function a(a){var b=Human.view.camera.eye,c=Human.math.subVec3([b.x,b.y,b.z],a.pos),d=Human.math.dotVector3(c,a.dir),e=Human.math.lenVec3(c),f=Human.math.lenVec3(a.dir),g=57.2957795*Math.acos(d/(e*f));return g}function b(a,b){var f=a.label,g=a.pin,h=f.pos[0]*b.scaleX,i=f.pos[1]*b.scaleY,j=20,k=b.context,l=Math.min(b.width-h-10,e),m=c(k,f.description||"",l),n=10,o=10,p=l+10+2*o,q=j*m.length+35;k.strokeStyle="rgb(50, 50, 50)",k.fillStyle="rgba(30, 30, 30, 0.7)",d(k,h-0,i-n,p,q,6,!0),k.font="12pt Arial",k.fillStyle="rgb(255, 255, 255)",k.fillText(f.title||"",h+o,i+n),k.font="10pt Arial",k.fillStyle="rgb(255, 255, 255)";for(var r=0;r<m.length;r++)k.fillText(m[r],h+o,i+n+j+j*r);var s=g.opacity,t=s+.4;k.strokeStyle="rgba(102, 102, 102, "+t+")",k.beginPath(),k.moveTo(g.canvasPos[0]*b.scaleX,g.canvasPos[1]*b.scaleY),h<b.halfWidth?k.lineTo(h+p,i):k.lineTo(h,i),k.closePath(),k.stroke();var u=k.createRadialGradient(g.canvasPos[0]*b.scaleX-2,g.canvasPos[1]*b.scaleY-2,1,g.canvasPos[0]*b.scaleX,g.canvasPos[1]*b.scaleY,4);u.addColorStop(0,"rgba(252,207,204,"+s+")"),u.addColorStop(.4,"rgba(197,0,0,"+s+")"),u.addColorStop(.6,"rgba(245,0,0,"+s+")"),u.addColorStop(1,"rgba(153,0,0,"+s+")"),k.fillStyle=u,k.beginPath(),k.arc(g.canvasPos[0]*b.scaleX,g.canvasPos[1]*b.scaleY,4,0,2*Math.PI),k.fill()}function c(a,b,c){for(var d,e=b.split(" "),f=[],g=0;g<e.length;g++){var h=e[g];if(d=a.measureText(h),d.width<=c)f.push(h);else for(var i=h.length%2===0?0:1,j=2;j<h.length;){for(var k=h.split(""),l=[],m=!0;k.length>0;){var n=h.length/j+i,o=k.splice(0,n),p=o.join("");if(d=a.measureText(p),!(d.width<=c)){j++,m=!1;break}l.push(p)}if(m===!0){f=f.concat(l);break}}}for(var q="",r=[],s=0;s<f.length;s++){var t=q+f[s];d=a.measureText(t),d.width>c&&s>0?(r.push(q),q=f[s]+" "):q=t+" "}return r.push(q),r}function d(a,b,c,d,e,f,g,h){"undefined"==typeof h&&(h=!0),"undefined"==typeof f&&(f=5),a.beginPath(),a.moveTo(b+f,c),a.lineTo(b+d-f,c),a.quadraticCurveTo(b+d,c,b+d,c+f),a.lineTo(b+d,c+e-f),a.quadraticCurveTo(b+d,c+e,b+d-f,c+e),a.lineTo(b+f,c+e),a.quadraticCurveTo(b,c+e,b,c+e-f),a.lineTo(b,c+f),a.quadraticCurveTo(b,c,b+f,c),a.closePath(),h&&a.stroke(),g&&a.fill()}var e,f={};Human.properties.subscribe({propId:"annotations.labelWidth",value:120,callback:function(a){e=a}});var g,h,i=!1,j=!0,k=90;return f.setEnabled=function(a){i=a,j=!0},f.setDirty=function(){j=!0},f.layout=function(b,c){if(j){c.clearRect(0,0,b.width,b.height);var d,e,f,i=Human.view.annotations.annotations,l=Human.renderer.getViewMat(),m=Human.renderer.getProjMat();for(var n in i)if(i.hasOwnProperty(n)){d=i[n],e=d.pin,f=d.label,e.transform(l,m,b);var o=a(e);e.setViewAngle(o);var p=-90>o||o>90;e.setOccluded(p);var q=-1*(o-0)/(k-0)+1;0>q&&(q=0),e.setOpacity(q),f.setOpacity(q+.5),e.cullToRectangle(0,0,b.width,b.height),e.culled!==f.culled&&f.setCulled(e.culled),e.occluded!==f.occluded&&f.setOccluded(e.occluded),e.enabled&&e.shown&&!e.culled&&!e.occluded&&f.shown&&f.setPos(e.canvasPos)}g=b.width,h=b.height,j=!1}},f.snapshot=function(a,c){var d,e,f=a.width,i=a.height,j=f/g,k=i/h,l=Human.view.annotations.annotations,m={context:c,width:f,height:i,halfWidth:f/2,scaleX:j,scaleY:k};for(var n in l)l.hasOwnProperty(n)&&(d=l[n],d.pin.enabled&&!d.pin.occluded&&(e=d.label,e.shown&&b(d,m)))},f}()),function(){"use strict";var a,b=!1,c=!1;Human.properties.subscribe({propId:"annotations.hideWhileCameraMoving",value:b,callback:function(a){b=a}}),Human.events.on("camera.updated",function(){c=!0}),Human.events.on("tick",function(){b&&(c?(a&&(clearTimeout(a),a=null),Human.view.annotations.setShown(!1),c=!1):a||(a=setTimeout(function(){clearTimeout(a),Human.view.annotations.setShown(!0)},200)))})}(),function(){"use strict";Human.rpc.define("annotations.getAnnotations",function(){var a,b=Human.view.annotations.annotations,c={};for(var d in b)b.hasOwnProperty(d)&&(a=b[d],c[d]={annotationId:a.id||a.annotationId,type:a.type,styleId:a.styleId,objectId:a.object&&a.object.objectId,title:a.label.title,description:a.label.description,pos:a.pin.pos,pinVec:a.pin.dir});this.setResult(c)}),Human.rpc.define("annotations.create",function(a){var b=Human.view.annotations.createAnnotation(a),c={annotationId:b.annotationId,type:b.type,objectId:b.object?b.object.objectId:"",title:b.label.title,description:b.label.description,pos:b.pin.pos,pinVec:b.pin.dir};this.setResult(c)}),Human.rpc.define("annotations.setTitle",function(a){var b=Human.view.annotations.annotations[a.annotationId];b&&b.label.setTitle(a.title),this.setResult(!0)}),Human.rpc.define("annotations.setDescription",function(a){var b=Human.view.annotations.annotations[a.annotationId];b&&b.label.setDescription(a.description),this.setResult(!0)}),Human.rpc.define("annotations.update",function(a){Human.view.annotations.updateAnnotation(a.annotationId,a),this.setResult(!0)}),Human.rpc.define("annotations.flyTo",function(){this.setResult(!0)}),Human.rpc.define("annotations.setLabelsShown",function(a){Human.view.annotations.setLabelsShown(a),this.setResult(!0)}),Human.rpc.define("annotations.setShown",function(a){Human.view.annotations.setShown(a.shown),this.setResult(!0)}),Human.rpc.define("annotations.destroy",function(a){var b=Human.view.annotations.annotations[a.annotationId];b&&b.destroy(),this.setResult(!0)}),Human.rpc.define("annotations.setLabelStyles",function(a){a.label&&$(".annotationContainer").css(a.label),a.title&&$(".annotationContainer > .title").css(a.title),a.description&&$(".annotationContainer > .description").css(a.description),Human.view.annotations.updateDimensions(),Human.view.annotations.layouts.redrawLayout(),this.setResult(!0)}),Human.rpc.define("annotations.setPinStyles",function(a){a.hasOwnProperty("pin")?($(".annotationPin").css(a.pin),a.hasOwnProperty("after")&&($(".annotationPin").html('<div class="after"></div>'),$(".annotationPin > .after").css(a.after))):$(".annotationPin").css(a),this.setResult(!0)}),Human.rpc.define("annotations.setWireStyles",function(a){$(".annotationWire").css(a),this.setResult(!0)})}(),function(){"use strict";function a(a){Human.view.labels.createLabel({objectId:a.objectId,afterDelay:!0})}function b(a,b){var c=Human.scene.objects[a];c&&Human.events.fire("focus.objectFocused",{objectId:a,description:c.description,flyTo:b})}var c=Human.view.focus={},d=!0;Human.properties.subscribe({propId:"data.medline.enabled",value:!0,callback:function(a){d=a}});var e=!0;Human.properties.subscribe({propId:"data.wikipedia.enabled",value:!0,callback:function(a){e=a}}),c.focusObject=function(c,d){d=d||Human._noop;var e=c.fmaId,f=c.objectId;if(!f&&!e)return Human.log.error("Human.view.focusObject","Parameter expected: either 'objectId' or 'fmaId'"),void d();var g,h=Human.scene;if(f){if(g=h.objects[f],!g)return Human.log.error("Human.view.focusObject","Scene object not found: '"+f+"'"),void d()}else if(e){if(g=h.objectsByFMAID[e],!g)return Human.log.error("Human.view.focusObject","Scene object not found for this FMAID: '"+e+"'"),void d();f=g.objectId}c.xray===!0?Human.rpc.call(null,"xray.setEnabled",{enable:!0}):c.xray===!1&&Human.rpc.call(null,"xray.setEnabled",{enable:!1});var i=c.select;i=void 0===i||null===i?c.replace||!h.selectedObjects[f]:c.select;var j,k=c.flyTo;if(c.replace)h.setSelectedObjects({objectId:f,select:i,replace:c.replace});else if(i){var l={};l[f]=i,h.setSelectedObjects({objects:l,replace:c.replace})}(c.showLabel||!i)&&Human.view.labels._clearLabels(),c.showLabel&&a(c),i&&"newSelected"===k?(j=g.getBoundary(),j&&(Human.view.boundary.setBoundary(j,!0),Human.view.camera.fly.flyTo({boundary:j,backOff:c.backOff,arc:0,easing:!0},function(){Human.view.boundary.setBoundary(!1),b(f,k),d()}))):k&&"allSelected"!==k?"selectedLeafObjects"===k?Human.view.camera.fly.flyTo({selectedLeafObjects:!0,backOff:c.backOff,arc:0,easing:!0},function(){Human.view.boundary.setBoundary(!1),i&&b(f,k),d()
  }):"object"===k?(j=g.getBoundary(),Human.view.boundary.setBoundary(j,!0),Human.view.camera.fly.flyTo({boundary:j,backOff:c.backOff,arc:0,easing:!0},function(){Human.view.boundary.setBoundary(!1),i&&b(f,k),d()})):(c.showLabel&&(a(c),Human.renderer.forceRenderFrame()),b(f,k),d()):(j=h.getBoundary(h.selectedObjects),j?(Human.view.boundary.setBoundary(j,!0),Human.view.camera.fly.flyTo({boundary:j,backOff:c.backOff,arc:0,easing:!0},function(){Human.view.boundary.setBoundary(!1),i&&b(f,k),d()})):(Human.view.boundary.setBoundary(!1),i&&(c.showLabel&&a(c),b(f,k)),d()))}}(),function(){"use strict";Human.rpc.define("focus.focusObject",function(a){var b=this;Human.view.focus.focusObject(a,function(){b.setResult(!0)})})}(),function(){"use strict";function a(a){var b,c=Human.scene,d=c.objects;for(var e in d)d.hasOwnProperty(e)&&(b=d[e],a?Human.scene.selectedObjects[b.objectId]?(b.setXRay(!1),b.setHighlight(!1)):b.setXRay(!0):b.setXRay(!1))}var b=Human.view.xray={};b.enabled=!1;var c=!0;Human.events.on("loaded",function(){b.enabled=!1,c=!1}),Human.events.on("scene.objectsSelected",function(){b.enabled&&(c=!0)}),Human.events.on("tick",function(){c&&(a(b.enabled),c=!1)}),b.setEnabled=function(a){b.enabled!==a&&(b.enabled=a,c=!0),Human.events.fire("xray.toggled",{enabled:a}),b.enabled&&(Human.view.currentMode="Xray")},b.getEnabled=function(){return b.enabled}}(),function(){"use strict";function a(a){for(var b=Human.scene.objects[a];b&&b.anonymous;)b=b.parent;return b}var b=Human.view.pick={};b.singleEnabled=!0,b.multiEnabled=!1;var c=!1;Human.properties.subscribe({propId:"pick.alwaysRayPick",value:c,callback:function(a){c=a}}),Human.events.on("loaded",function(){b.setSinglePickEnabled(!0),b.setMultiPickEnabled(!1)}),b.setSinglePickEnabled=function(a){b.singleEnabled!==a&&(b.singleEnabled=a),a&&(b.multiEnabled&&(b.multiEnabled=!1),Human.events.fire("pick.multi.toggled",{enabled:b.multiEnabled})),Human.events.fire("pick.single.toggled",{enabled:b.singleEnabled})},b.getSinglePickEnabled=function(){return b.singleEnabled},b.setMultiPickEnabled=function(a){b.multiEnabled!==a&&(b.multiEnabled=a),a&&(b.singleEnabled&&(b.singleEnabled=!1),Human.events.fire("pick.single.toggled",{enabled:b.singleEnabled})),Human.events.fire("pick.multi.toggled",{enabled:b.multiEnabled})},b.getMultiPickEnabled=function(){return b.multiEnabled},b.hoverPick=function(a){return b._pick(a,!0,!1,!1,c)},b.hoverOff=function(){Human.view.tooltips.clearTooltip()},b.pick=function(a){return b._pick(a,!1,!1,!1,c)},b.doublePick=function(a){return b._pick(a,!1,!0,!1,c)},b.queryPick=function(a){return b._pick(a,!1,!1,!0,a.rayPick||c)};var d=null;b._pick=function(c,e,f,g,h){var i,j,k,l,m=c.canvasX,n=c.canvasY,o=c.mouseDownLeft,p=c.mouseDownRight,q=c.spaceDown,r=c.ctrlDown;if(g){if(i=Human.renderer.pick(m,n,h)){if(j=a(i.name)){var s=Human._apply(i,{mode:"query",objectId:j.objectId,mouseDownLeft:o,mouseDownRight:p});return Human.events.fire("pick.picked",s),s}return}}else if((b.singleEnabled||b.multiEnabled||Human.view.dissect.enabled||Human.view.annotations.enabled||Human.view.highlight.enabled)&&!Human.scene.checkTestStarted)if(e){if(i=Human.renderer.pick(m,n,h),i&&(j=a(i.name))){Human.view.tooltips.setTooltip({objectId:j.objectId,canvasX:m,canvasY:n});var t=Human._apply(i,{mode:"hover",objectId:j.objectId});Human.events.fire("pick.hoverPicked",t),Human.events.fire("pick.picked",t)}}else{if((Human.view.highlight.enabled||Human.view.xray.enabled)&&!Human.view.dissect.enabled&&!Human.view.annotations.enabled){if(f&&d)return Human.view.focus.focusObject({objectId:d.objectId,replace:b.singleEnabled,showLabel:!0,select:!0,flyTo:"selectedLeafObjects"}),void(d=null);if(i=Human.renderer.pick(m,n,h))if(j=a(i.name)){if(Human.view.annotations.setLabelsShown({objects:{},type:"secondary",replace:!0}),q)return k={},k[j.objectId]=!0,void Human.view.annotations.setLabelsShown({objects:k,type:"secondary"});if(r)return k={},k[j.objectId]=!1,void Human.view.annotations.setLabelsShown({objects:k,type:"secondary"});Human.scene.selectedObjects[j.objectId]?Human.scene.setSelectedObjects({objectId:j.objectId,select:!Human.scene.selectedObjects[j.objectId],replace:!b.multiEnabled}):(Human.view.focus.focusObject({objectId:j.objectId,showLabel:!0,replace:!b.multiEnabled,flyTo:"none"}),Human.view.tooltips.setTooltip({objectId:j.objectId,canvasX:m,canvasY:n})),d=j,Human.events.fire("pick.picked",Human._apply(i,{mode:Human.view.highlight.enabled?"highlight":"xray",objectId:j.objectId,mouseDownLeft:o,mouseDownRight:p}))}else l=Human.view.annotations.annotations[i.name],l&&l.pin.pick();else Human.view.xray.enabled||Human.scene.setSelectedObjects({select:!1,replace:!0})}if(Human.view.isolate.enabled&&!Human.view.dissect.enabled&&!Human.view.annotations.enabled){if(f&&d)return Human.view.focus.focusObject({objectId:d.objectId,showLabel:!0,select:!1,flyTo:"object"}),void(d=null);i=Human.renderer.pick(m,n,h),i&&(j=a(i.name),j&&(Human.view.focus.focusObject({objectId:j.objectId,showLabel:!0,select:!1,flyTo:"none"}),Human.view.tooltips.setTooltip({objectId:j.objectId,canvasX:m,canvasY:n}),d=j,Human.events.fire("pick.picked",Human._apply(i,{mode:"isolate",objectId:j.objectId}))))}if(Human.view.dissect.enabled&&!Human.view.annotations.enabled){if(f)return;return i=Human.renderer.pick(m,n,h),void(i&&(j=a(i.name),j&&(Human.view.dissect.dissect(j.objectId),Human.events.fire("pick.picked",Human._apply(i,{mode:"dissect",objectId:j.objectId})))))}if(Human.view.annotations.enabled){if(f)return;return h=!0,i=Human.renderer.pick(m,n,h),void(i&&(j=a(i.name),j?(Human.view.annotations.placer.placeAnnotation({objectId:j.objectId,pos:i.worldPos}),Human.events.fire("pick.picked",Human._apply(i,{mode:"annotation",objectId:j.objectId}))):(l=Human.view.annotations.annotations[i.name],l&&l.pin.pick())))}}}}(),function(){"use strict";function a(){if(0!==k.length){var c=k.pop(),d=c.params,e=c.ok;b(d,function(b){e&&e(b),a()})}}function b(a,b){Human.events.fire("snapshot.started"),a=a||{};var f=document.getElementById(g),h=void 0!==a.copyright&&null!==a.copyright?a.copyright:!0,k=a.scale!==!1,l=d(f),m=l.width,n=l.height,o=a.width||m,p=a.height||n;o>=p?p=Math.floor(n/m*o):p>o&&(o=Math.floor(m/n*p));var q=!k&&o>m||p>n,r=a.color||Human.renderer.bgColor,s=Human.renderer.bgColor;q&&(f.width=o,f.height=p),r&&Human.renderer.setBGColor(r),Human.timeline.pause(),Human.renderer.forceRenderFrame();var t=document.createElement("canvas"),u=t.getContext("2d");t.width=o,t.height=p;var v=d(f),w=v.width,x=v.height,y=Human.renderer.bgColors[Human.renderer.bgColor],z=y.slice(0,3),A=y.slice(9,12),B=u.createLinearGradient(0,0,0,t.height);if(B.addColorStop(0,c(z)),B.addColorStop(1,c(A)),u.fillStyle=B,u.fillRect(0,0,t.width,t.height),u.drawImage(f,0,0,w,x,0,0,o,p),h){var C=Math.max(15,o/2-j.width/2),D=Math.max(15,p-20-j.height);u.drawImage(i,C,D),u.font="12pt Arial";var E=(new Date).getFullYear(),F=String.fromCharCode(169),G=F+" "+E,H=o/2,I=D+j.height+10;u.fillStyle="#666666",u.textAlign="center",u.fillText(G,H,I)}Human.events.fire("snapshot.rendering",{canvas:t,context:u,bgColor:r}),q&&(f.width=m,f.height=n),r&&Human.renderer.setBGColor(s),Human.renderer.forceRenderFrame(),Human.timeline.unpause(),Human.events.fire("snapshot.finished");var J=new Image;J.width=o,J.height=p,J.onload=function(){b(J)},J.src=t.toDataURL(e)}function c(a){var b="rgb("+Math.round(255*a[0])+", "+Math.round(255*a[1])+", "+Math.round(255*a[2])+")";return b}function d(a){var b=10;return{width:parseInt(a.getAttribute("width"),b),height:parseInt(a.getAttribute("height"),b)}}var e,f=Human.view.snapshot={};Human.properties.subscribe({propId:"snapshot.mime",value:"image/jpeg",callback:function(a){e=a}});var g="theCanvas",h="img/bhuman-logo-powered.png",i=new Image,j={width:0,height:0};i.onload=function(){j.width=i.width,j.height=i.height};var k=[];i.src=h,f.getSnapshot=function(b,c,d){if(!(void 0===b.width&&void 0===b.height||void 0!==b.width&&void 0!==b.height)){var e="Snapshot failed: incomplete params: both 'width' and 'height' expected";d&&d(e)}k.unshift({params:b,ok:c}),a()}}(),function(){"use strict";Human.rpc.define("snapshot.get",function(a){var b=this;Human.view.snapshot.getSnapshot(a,function(a){b.setResult(a.src)})})}(),function(){"use strict";var a=Human.view.clip={};a.LEFT="left",a.RIGHT="right",a.TOP="top",a.BOTTOM="bottom",a.FRONT="front",a.BACK="back";var b,c,d=!1,e=!1;a.clips={},a.selectedClip=null,Human.events.on("loaded",function(){d||(d=!0,e=!1,a._clipsNode=Human.renderer.getNode("clips-node"),a._clipsNode.set("clips",[{mode:"disabled",x:-1,y:0,z:0},{mode:"disabled",x:1,y:0,z:0},{mode:"disabled",x:0,y:-1,z:0},{mode:"disabled",x:0,y:1,z:0},{mode:"disabled",x:0,y:0,z:-1},{mode:"disabled",x:0,y:0,z:1}]),a.clips={},a._createClip({index:0,type:a.LEFT,clipId:a.LEFT,state:"dormant",progress:0,color:{r:.3,g:.3,b:.8}}),a._createClip({index:1,type:a.RIGHT,clipId:a.RIGHT,state:"dormant",progress:0,color:{r:.3,g:.3,b:.8}}),a._createClip({index:2,type:a.TOP,clipId:a.TOP,state:"dormant",progress:0,color:{r:.3,g:.3,b:.8}}),a._createClip({index:3,type:a.BOTTOM,clipId:a.BOTTOM,state:"dormant",progress:0,color:{r:.3,g:.3,b:.8}}),a._createClip({index:4,type:a.FRONT,clipId:a.FRONT,state:"dormant",progress:0,color:{r:.3,g:.3,b:.8}}),a._createClip({index:5,type:a.BACK,clipId:a.BACK,state:"dormant",progress:0,color:{r:.3,g:.3,b:.8}}),a.selectClip("front"))}),Human.events.on("tick",function(){c&&(a._updateClipForIsolatedObjects(),c=!1)}),a._updateClipForIsolatedObjects=function(){var a=Human.scene.objects,b=Human.scene.selectedObjects;for(var c in a)a.hasOwnProperty(c)&&a[c].setClippable(b[c]?!1:!0)},Human.events.on("Scene.Sleep",function(){var b;for(var c in a.clips)a.clips.hasOwnProperty(c)&&(b=a.clips[c],b.state===Human.view.clip.Plane.STATE_VISIBLE&&(b.framesUntilHide>0?b.framesUntilHide--:Human.view.clip.setClip({clipId:b.clipId,state:Human.view.clip.Plane.STATE_CLIPPING})))}),Human.events.on("scene.objectsSelected",function(){c=!0}),Human.events.on("isolate.toggled",function(a){b=a.enabled,c=!0}),a._createClip=function(b){a.clips[b.clipId]&&a.clips[b.clipId]._destroy(),b.onUpdate=function(b){a._onUpdate(b)};var c=a.clips[b.clipId]=new Human.view.clip.Plane(b);b.state&&b.state!==Human.view.clip.Plane.STATE_DORMANT&&a.setClip(b),b.progress&&c._setProgress(b.progress)},a._onUpdate=function(b){var c={};c[""+b.index]={x:b.x,y:b.y,z:b.z,dist:b.dist,mode:b.clipping?"inside":"disabled"},a._clipsNode.setClips(c)},a._isReservedClip=function(b){return b===a.LEFT||b===a.RIGHT||b===a.TOP||b===a.BOTTOM||b===a.FRONT||b===a.BACK},a.setClip=function(b){var c;if(b.clipId){if(c=a.clips[b.clipId],!c)return void Human.log.error("Human.view.clip.setClip","Clip plane not found: '"+b.clipId+"'")}else{if(!a.selectedClip)return void Human.log.error("Human.view.clip.setClip","Parameter expected: 'clipId'");c=a.selectedClip}if(b.state&&b.state!==Human.view.clip.Plane.STATE_DORMANT&&b.state!==Human.view.clip.Plane.STATE_ACTIVE&&b.state!==Human.view.clip.Plane.STATE_CLIPPING&&b.state!==Human.view.clip.Plane.STATE_VISIBLE)return void Human.log.error("Human.view.clip.setClip","State not recognized: '"+b.state+"'");var d=c.state,e=b.state||d;switch(e){case Human.view.clip.Plane.STATE_DORMANT:c._setClipping(!1),c._setVisible(!1);break;case Human.view.clip.Plane.STATE_ACTIVE:a._configureClip(c,b),c._setClipping(!1),c._setVisible(!1);break;case Human.view.clip.Plane.STATE_CLIPPING:switch(c._setClipping(!0),c._setVisible(!1),d){case Human.view.clip.Plane.STATE_DORMANT:a._configureClip(c,b);break;default:b.progress&&c._setProgress(b.progress),b.color&&c._setColor(b.color)}break;case Human.view.clip.Plane.STATE_VISIBLE:switch(c._setClipping(!0),c._setVisible(!0),d){case Human.view.clip.Plane.STATE_DORMANT:a._configureClip(c,b);break;default:b.progress&&c._setProgress(b.progress),b.color&&c._setColor(b.color)}}c.state=e,Human.events.fire("clip.updated",{clipId:c.clipId,state:c.state,progress:c.progress})},a._configureClip=function(b,c){var d;c=c||{},c.pos||(d=Human.scene.getBoundary());var e,f,g,h,i=.5*(d.xmin+d.xmax),j=.5*(d.ymin+d.ymax),k=.5*(d.zmin+d.zmax);switch(b.type){case a.LEFT:e={x:d.xmax,y:j,z:k},f={y:1,angle:-90},g={x:d.zmax-d.zmin,y:d.ymax-d.ymin},h={min:d.xmin,max:d.xmax};break;case a.RIGHT:e={x:d.xmin,y:j,z:k},f={y:1,angle:90},g={x:d.zmax-d.zmin,y:d.ymax-d.ymin},h={min:d.xmin,max:d.xmax};break;case a.FRONT:e={x:-i,y:j,z:d.zmin},f={y:1,angle:0},g={x:d.xmax-d.xmin,y:d.ymax-d.ymin},h={min:d.zmin,max:d.zmax};break;case a.BACK:e={x:i,y:j,z:d.zmax},f={y:1,angle:180},g={x:d.xmax-d.xmin,y:d.ymax-d.ymin},h={min:d.zmin,max:d.zmax};break;case a.TOP:e={x:i,y:d.ymax,z:k},f={x:1,angle:90},g={x:d.xmax-d.xmin,y:d.zmax-d.zmin},h={min:d.ymin,max:d.ymax};break;case a.BOTTOM:e={x:i,y:d.ymin,z:k},f={x:1,angle:-90},g={x:d.xmax-d.xmin,y:d.zmax-d.zmin},h={min:d.ymin,max:d.ymax};break;default:e=c.pos,f=c.dir,g=c.size,h=c.range}b._setPos(e),b._setDir(f),b._setRange(h),b._setProgress(c.progress||0),b._setSize(g),c.color&&b._setColor(c.color)},a._getBoundaryOfObjects=function(b){var c,d={xmin:1e5,ymin:1e5,zmin:1e5,xmax:-1e5,ymax:-1e5,zmax:-1e5};for(var e in b)b.hasOwnProperty(e)&&(c=b[e],a._expandBoundaryByBoundary(d,c.boundary));return d},a._expandBoundaryByBoundary=function(a,b){return b.xmin<a.xmin&&(a.xmin=b.xmin),b.ymin<a.ymin&&(a.ymin=b.ymin),b.zmin<a.zmin&&(a.zmin=b.zmin),b.xmax>a.xmax&&(a.xmax=b.xmax),b.ymax>a.ymax&&(a.ymax=b.ymax),b.zmax>a.zmax&&(a.zmax=b.zmax),a},a.selectClip=function(b){var c;return b&&(c=a.clips[b],!c)?void Human.log.error("Human.view.clip.selectClip","Clip plane not found: '"+b+"'"):void(a.selectedClip=c)},a.destroyClip=function(b){return a._isReservedClip(b)?void Human.log.error("Human.view.clip.destroyClip","Not allowed to destroy built-in plane with clipId: '"+b+"'"):(a.clips[b]._destroy(),delete a.clips[b],void(a.selectedClip===b&&(a.selectedClip=null)))},a.reset=function(){var b;for(var c in a.clips)a.clips.hasOwnProperty(c)&&(a._isReservedClip(c)?(b=a.clips[c],Human.view.clip.setClip({clipId:b.clipId,state:Human.view.clip.Plane.STATE_DORMANT}),a._configureClip(b)):a.destroyClip(c));d&&a.selectClip("front"),Human.events.fire("CrossSections.Reset")}}(),function(){"use strict";Human.view.clip.Plane=function(a){this.index=a.index,this.clipId=a.clipId,this.type=a.type,this.state=Human.view.clip.Plane.STATE_DORMANT,this.framesUntilHide=1;var b=a.pos||{};this.pos={x:b.x||0,y:b.y||0,z:b.z||0};var c=a.dir||{};this.dir={x:c.x||0,y:c.y||0,z:c.z||0,angle:c.angle||0};var d=a.size||{};this.size={x:d.x||10,y:d.y||10};var e=a.range||{};this.range={min:e.min||0,max:e.max||0};var f=a.color||{};this.color={r:void 0!==f.r?f.r:.3,g:void 0!==f.g?f.g:.3,b:void 0!==f.b?f.b:.3},this.progress=a.progress||0;var g=a.clipId+".indicator.flags",h=a.clipId+".indicator.xf",i=a.clipId+".indicator.color";this.visible=a.visible||!1,this.clipping=a.clipping||!1,this._onUpdate=a.onUpdate,Human.renderer.getNode(Human.CLIP_INDICATORS_ATTACH_ID).addNode({type:"flags",id:g,flags:{enabled:this.visible,transparent:!0,backfaces:!1},nodes:[{type:"xform",id:h,nodes:[{type:"material",emit:.9,id:i,baseColor:{r:.3,g:.3,b:.8},specularColor:{r:.3,g:.3,b:.8},specular:0,shine:100,alpha:.2,nodes:[{type:"geometry",source:{type:"box",xSize:1,ySize:1,zSize:1e-4}}]},{type:"material",emit:.9,baseColor:this.color,specularColor:this.color,specular:0,shine:100,alpha:.9,nodes:[{type:"geometry",primitive:"lines",positions:[1,1,1,1,-1,1,-1,-1,1,-1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,-1],indices:[0,1,1,2,2,3,3,0]}]}]}]}),this.indicatorXFormNode=Human.renderer.getNode(h),this.indicatorFlagsNode=Human.renderer.getNode(g),this.indicatorColorNode=Human.renderer.getNode(i),this._updatePosition()},Human.view.clip.Plane.prototype._updatePosition=function(){var a=Human.math.identityMat4();Human.math.mulMat4(a,Human.math.translationMat4v([this.pos.x,this.pos.y,this.pos.z]),a),Human.math.mulMat4(a,Human.math.rotationMat4v(this.dir.angle*Math.PI/180,[this.dir.x,this.dir.y,this.dir.z]),a),Human.math.mulMat4(a,Human.math.translationMat4v([0,0,this.range.min+2*this.progress*(this.range.max-this.range.min)]),a),Human.math.mulMat4(a,Human.math.scalingMat4v([.5*this.size.x,.5*this.size.y,0]),a),this.indicatorXFormNode.setElements(a);var b=Human.math.identityMat4();Human.math.mulMat4(b,Human.math.translationMat4v([this.pos.x,this.pos.y,this.pos.z]),b),Human.math.mulMat4(b,Human.math.rotationMat4v(this.dir.angle*Math.PI/180,[this.dir.x,this.dir.y,this.dir.z]),b),Human.math.mulMat4(b,Human.math.translationMat4v([0,0,this.range.min+2*this.progress*(this.range.max-this.range.min)]),b),Human.math.mulMat4(b,Human.math.scalingMat4v([.5*this.size.x,.5*this.size.y,0]),b);var c=SceneJS_math_transformPoint3(b,[-1,-1,0]),d=SceneJS_math_transformPoint3(b,[1,-1,0]),e=SceneJS_math_transformPoint3(b,[1,1,0]),f=SceneJS_math_normalizeVec3(SceneJS_math_cross3Vec4(SceneJS_math_normalizeVec3(SceneJS_math_subVec3(d,c,[0,0,0]),[0,0,0]),SceneJS_math_normalizeVec3(SceneJS_math_subVec3(d,e,[0,0,0]),[0,0,0]))),g=SceneJS_math_dotVector3(f,c);this.x=f[0],this.y=f[1],this.z=f[2],this.dist=g,this._onUpdate(this)},Human.view.clip.Plane.STATE_DORMANT="dormant",Human.view.clip.Plane.STATE_ACTIVE="active",Human.view.clip.Plane.STATE_CLIPPING="clipping",Human.view.clip.Plane.STATE_VISIBLE="visible",Human.view.clip.Plane.prototype._setPos=function(a){a=a||{},this.pos={x:a.x||0,y:a.y||0,z:a.z||0},this._updatePosition()},Human.view.clip.Plane.prototype._setDir=function(a){a=a||{},this.dir={x:a.x||0,y:a.y||0,z:a.z||0,angle:a.angle||0},this._updatePosition()},Human.view.clip.Plane.prototype._setRange=function(a){a=a||{},this.range={min:a.min||0,max:a.max||0},this._setProgress(0),this._updatePosition()},Human.view.clip.Plane.prototype._setProgress=function(a){this.progress!==a&&(0>a?(a=0,this._setClipping(!1)):a>1?(a=1,this._setClipping(!1)):this._setClipping(!0),this.progress=a,this._updatePosition())},Human.view.clip.Plane.prototype._setSize=function(a){a=a||{},this.size={x:a.x||10,y:a.y||10},this._updatePosition()},Human.view.clip.Plane.prototype._setColor=function(a){a=a||{},this.color={r:void 0!==a.r?a.r:.3,g:void 0!==a.g?a.g:.3,b:void 0!==a.b?a.b:.3},this.indicatorColorNode.setBaseColor(this.color).setSpecularColor(this.color)},Human.view.clip.Plane.prototype._setVisible=function(a){if(this.framesUntilHide=a?1:0,this.visible!==a){this.persist=!1;var b=this.indicatorFlagsNode.get("flags");b.enabled=a,this.indicatorFlagsNode.set("flags",b),this.visible=a}},Human.view.clip.Plane.prototype._setMode=function(a){this.mode!==a&&(this.mode=a,this._onUpdate(this))},Human.view.clip.Plane.prototype._setClipping=function(a){this.clipping!==a&&(this.clipping=a,this._onUpdate(this))},Human.view.clip.Plane.prototype._destroy=function(){this.clipPosNode.destroy(),this.indicatorPosNode.destroy()}}(),function(){"use strict";Human.rpc.define("clip.set",function(a){if(a.clips){var b,c=a.clips;for(var d in c)c.hasOwnProperty(d)&&(b=c[d],b.clipId=d,Human.view.clip.setClip(b))}else a.clip&&Human.view.clip.setClip(a.clip)}),Human.rpc.define("clip.reset",function(){Human.view.clip.reset()})}(),function(){"use strict";var a,b=Human.view.spinner={};b.shown=!1,Human.events.on("loaded",function(){var b="human-embed-progress",c="Images/large-loader.gif";if(a=document.getElementById(b),null===a||void 0===a){a=new Image,a.id=b,a.src=c,a.alt="Loading...";var d={display:"none",position:"absolute",top:"50%",left:"50%",zIndex:"1001",width:"64px",height:"64px",marginLeft:"-32px",marginTop:"-32px"};for(var e in d)d.hasOwnProperty(e)&&(a.style[e]=d[e]);document.body.appendChild(a)}}),b.setShown=function(c){b.shown!==c&&a&&(a.style.display=c?"inline-block":"none")}}(),function(){"use strict";function a(){var a=Human.renderer.getScene();a.getNode("lights",function(c){a.getNode("lights.subtree",function(d){d.disconnect(),c.removeNodes();var e,f,g=[],h=0,i=4,j=!1;for(f in b.lights)if(b.lights.hasOwnProperty(f)&&(e=b.lights[f],e.enabled&&e.params)){if("ambient"!==e.mode&&++h>i){j||(Human.log.warn("Human.view.lights.rebuildScene","Tried to activate too many lights - max allowed is "+i+" - only enabling that many"),j=!0);continue}g.push(e.params||{})}var k=c.addNode({type:"lights",lights:g.slice(0),nodes:[{id:"lightsSubTree"}]});h=0;for(f in b.lights)b.lights.hasOwnProperty(f)&&(h++<i?(e=b.lights[f],e.node=k,e.index=h):(e.node=null,e.index=-1));a.getNode("lightsSubTree",function(a){a.addNode(d),Human.renderer.forceRenderFrame()})})}),c=!1}var b=Human.view.lights={};b.lights={};var c=!1;Human.events.on("loaded",function(){b.addLight({lightId:"light0",enabled:!0,displayName:"Default ambient",description:"Default ambient light source",params:{mode:"ambient",color:{r:.15,g:.15,b:.15},diffuse:!0}}),b.addLight({lightId:"light2",enabled:!0,displayName:"Default directional",description:"Default directional light source",params:{mode:"dir",color:{r:1.3,g:1.3,b:1.2},dir:{x:-1,y:0,z:1},diffuse:!0,specular:!0,space:"view"}}),b.addLight({lightId:"light3",enabled:!0,displayName:"Default directional",description:"Default directional light source",params:{mode:"dir",color:{r:.5,g:.5,b:.5},dir:{x:1.1,y:0,z:1},diffuse:!0,specular:!0,space:"view"}}),b.addLight({lightId:"light4",enabled:!0,displayName:"Default directional",description:"Default directional light source",params:{mode:"dir",color:{r:1.1,g:1.1,b:1.05},dir:{x:-.05,y:0,z:-1},diffuse:!0,specular:!0,space:"view"}})}),Human.events.on("tick",function(){c&&a()}),b.addLight=function(a){var d=new Human.view.lights.Light(a);b.lights[a.lightId]=d,d.on("enabled",function(){c=!0}),c=!0},b.removeLight=function(a){b.lights[a]&&(delete b.lights[a],c=!0)},b.removeAllLights=function(){b.lights={},c=!0},b.setEnabled=function(a){a.replace&&b.clearEnabled();var d,e;if(a.lightId){if(d=a.lightId,e=b.lights[d],!e)return void Human.log.error("Human.view.lights.setEnabled","Light not found: "+d);e.enabled=!!a.enable}else if(a.lights){var f,g=a.lights;for(d in g)if(g.hasOwnProperty(d)){if(e=b.lights[d],!e){Human.log.error("Human.view.lights.setEnabled","Light not found: "+d);continue}f=g[d],e.enabled=!!f,f&&"boolean"!=typeof f&&e.setParams(f)}}c=!0},b.clearEnabled=function(){for(var a in b.lights)b.lights.hasOwnProperty(a)&&b.lights[a].setEnabled(!1);c=!0},b.setParams=function(a){var c;for(var d in a)if(a.hasOwnProperty(d)){if(c=b.lights[d],!c){Human.log.error("Human.view.lights.setParams","Light not found: "+d);continue}c.setParams(a[d])}}}(),function(){"use strict";Human.view.lights.Light=function(a){this._init(),this.displayName=a.displayName,this.description=a.description,this.lightId=a.lightId,this.enabled=!!a.enabled,this.params=a.params||{},this.node=null,this.index=0},Human.utils.extend(Human.view.lights.Light,Human.Component),Human.view.lights.Light.prototype.setEnabled=function(a){this.publish("enabled",this.enabled=a)},Human.view.lights.Light.prototype.setParams=function(a){if(Human._apply(a,this.params),this.node){var b={};b[""+this.index]=a,this.node.setLights(b)}}}(),function(){"use strict";Human.view.lights.loader=new Human.utils.Loader,Human.view.lights.loader._loadedStack=[],Human.view.lights.loader.load=function(a,b,c,d,e,f){var g,h=c,i=b+"."+c,j=this;Human.net.getLightsLibrary(h,function(a){var c=a.lights;if(!c)return Human.log.error("Human.view.lights.loader.load","'lights' section expected in lights library"),void e();Human.view.lights.clearEnabled();for(var d={modelId:b,lights:[]},f=0,h=c.length;h>f;f++)g=c[f],g.lightId?(g.lightId=i+"."+g.lightId,g.enabled=!0,d.lights.push(g),Human.view.lights.addLight(g)):Human.log.error("Human.view.lights.loader.load","'lightId' missing on light");j._loadedStack.push(d),e()},function(a){f("failed to load manifest file for lights module '"+h+"': "+a.errorText+" - status: "+a.request.status)})},Human.view.lights.loader.unload=function(a){var b,c,d,e,f;for(e=0,f=this._loadedStack.length;f>e;e++)this._loadedStack[e].modelId===a&&(b=this._loadedStack[e].lights,this._loadedStack.splice(e));if(!b)return void Human.log.warn("Human.view.lights.loader.unload","Failed to unload lights for model: "+a+" - not found");for(e=0,f=b.length;f>e;e++)Human.view.lights.removeLight(b[e].lightId);if(this._loadedStack.length>0){for(c=this._loadedStack[this._loadedStack.length-1].lights,d={},e=0,f=c.length;f>e;e++)d[c[e].lightId]=!0;Human.view.lights.setEnabled({lights:d,replace:!0})}else{c=Human.view.lights.lights,d={};for(var g in c)c.hasOwnProperty(g)&&(d[g]=!0);Human.view.lights.setEnabled({lights:d,replace:!0})}}}(),function(){"use strict";Human.rpc.define("lights.getLights",function(){var a,b=[],c=Human.view.lights.lights;for(var d in c)c.hasOwnProperty(d)&&(a=c[d],b.push({lightId:d,displayName:a.displayName,description:a.description,enabled:a.enabled,params:a.params}));this.setResult(b)}),Human.rpc.define("lights.setEnabled",function(a){Human.view.lights.setEnabled(a)}),Human.rpc.define("lights.setParams",function(a){Human.view.lights.setParams(a)})}(),function(){"use strict";function a(){var a=Human.renderer.getScene();a.getNode("effect",function(d){a.getNode("effect.subtree",function(e){e.disconnect(),d.removeNodes();for(var f,g={nodes:[]},h=g,i=0,j=c.pipeline.length;j>i;i++)if(f=c.pipeline[i],f.enabled){var k=Human._applyIf(f.params,{type:f.type,id:"__effects."+f.effectId,nodes:[]});h.nodes.push(k),h=k,a.getNode("__effects."+f.effectId,b(f))}else f.node=null;h.nodes.push({id:"effectsSubTree"}),d.addNode(g),a.getNode("effectsSubTree",function(a){a.addNode(e),Human.renderer.forceRenderFrame()})})}),d=!1}function b(a){return function(b){a.node=b}}var c=Human.view.effects={};c.pipeline=[],c.effects={};var d=!1;Human.events.on("loaded",function(){c.addEffect({effectId:"dof",type:"postprocess/dof",displayName:"Depth-of-field",description:"Simulates photographic depth-of-field",params:{texelSize:22e-5,blurCoeff:.0084,ppm:1e4,autofocus:!0}}),c.addEffect({effectId:"sepia",type:"postprocess/sepia",displayName:"Sepia",description:"Sepia color filter"}),c.addEffect({effectId:"scanlines",type:"postprocess/scanlines",displayName:"Scanlines",description:"Scan lines pattern"}),c.addEffect({effectId:"filmGrain",type:"postprocess/filmGrain",displayName:"Film Grain",description:"Film grain noise"}),c.addEffect({effectId:"technicolor",type:"postprocess/technicolor",displayName:"Technicolor",description:"Technicolor color filter"}),c.addEffect({effectId:"oculusRift",type:"effects/oculusRift",displayName:"Oculus Rift",description:"View using Oculus Rift",params:{eyeSep:20.6,focalLength:27}}),c.addEffect({effectId:"stereo",type:"effects/stereo",displayName:"Stereo",description:"View in stereo"}),c.addEffect({effectId:"anaglyph",type:"effects/anaglyph",displayName:"Anaglyph 3D",description:"View in Anaglyph 3D"})}),Human.events.on("tick",function(){d&&a()}),c.addEffect=function(a){var b=new Human.view.effects.Effect(a);c.effects[a.effectId]=b,c.pipeline.unshift(b),b.on("enabled",function(){d=!0}),d=!0},c.setEnabled=function(a){var b;if(a.replace)for(var e=0,f=c.pipeline.length;f>e;e++)c.pipeline[e].enabled=!1;var g;if(a.effectId){if(b=a.effectId,g=c.effects[b],!g)return void Human.log.error("Human.view.effects.setEnabled","Effect not found: "+b);g.enabled=!!a.enable}else if(a.effectIds){var h,i=a.effectIds;for(b in i)if(i.hasOwnProperty(b)){if(g=c.effects[b],!g){Human.log.error("Human.view.effects.setEnabled","Effect not found: "+b);continue}h=i[b],g.enabled=!!h,h&&"boolean"!=typeof h&&g.setParams(h)}}d=!0},c.clearEnabled=function(){for(var a=0,b=c.pipeline.length;b>a;a++)c.pipeline[a].enabled=!1;d=!0},c.setParams=function(a){var b;for(var d in a)if(a.hasOwnProperty(d)){if(b=c.effects[d],!b){Human.log.error("Human.view.effects.setParams","Effect not found: "+d);continue}b.setParams(a[d])}}}(),function(){"use strict";Human.view.effects.Effect=function(a){this._init(),this.effectId=a.effectId,this.type=a.type,this.displayName=a.displayName,this.description=a.description,this.enabled=!1,this.params=a.params||{},this.node=null},Human.utils.extend(Human.view.effects.Effect,Human.Component),Human.view.effects.Effect.prototype.setEnabled=function(a){this.publish("enabled",this.enabled=a)},Human.view.effects.Effect.prototype.setParams=function(a){Human._apply(a,this.params),this.node&&this.node.set(a)}}(),function(){"use strict";Human.rpc.define("effects.getEffects",function(){var a,b=[],c=Human.view.effects.effects;for(var d in c)c.hasOwnProperty(d)&&(a=c[d],b.push({effectId:d,displayName:a.displayName,description:a.description,enabled:a.enabled,params:a.params}));this.setResult(b)}),Human.rpc.define("effects.setEnabled",function(a){Human.view.effects.setEnabled(a)}),Human.rpc.define("effects.setParams",function(a){Human.view.effects.setParams(a)})}(),function(){"use strict";function a(a){var b={x:0,y:0};if(a){for(var c=a.target,d=0,e=0;c.offsetParent;)d+=c.offsetLeft,e+=c.offsetTop,c=c.offsetParent;b.x=a.pageX-d,b.y=a.pageY-e}else a=window.event,b.x=a.x,b.y=a.y;return b}function b(a){for(var b=[],c=0,d=a.length;d>c;c++){var e=a[c];b.push({x:e.pageX,y:e.pageY})}return b}function c(a){a.preventDefault(),a.stopPropagation();var c,d=[],e=!1,f=!1,g=0,h=0,i=0,j=0,k=0,l=a.touches,m=b(l);switch(a.type){case"touchstart":E=(new Date).getTime(),H.length=0,H=H.concat(m),J=m[0],L=2===m.length,L?M=m:(d.push(q),M=[]),Q=!1;break;case"touchmove":if(L=2===m.length&&2===M.length){var n=Math.abs(M[0].x-M[1].x),o=Math.abs(M[0].y-M[1].y),p=Math.abs(m[0].x-m[1].x),A=Math.abs(m[0].y-m[1].y);g=m[0].x-M[0].x,h=m[0].y-M[0].y,N=Math.abs(m[0].x-m[1].x),O=Math.abs(m[0].y-m[1].y);var B=180*Math.atan2(A,p)/Math.PI;Q=F>=B||B>G,Q?d.push(u):n>p&&o>A?d.push(s):p>n&&A>o&&d.push(t),M=m.concat([])}else d.push(r),M=[];K=m[0];break;case"touchend":var C=(new Date).getTime();e=y>C-E&&M.length<=1,i=C-E,M.length<=1&&d.push(v),e?null===I?I=C:(f=1===H.length&&z>C-I,I=null):(f=!1,I=null),2!==M.length?(g=K.x-J.x,h=K.y-J.y,j=Math.abs(g)/i,k=Math.abs(h)/i):P=0,J=null,L=!1}for(c=0;c<d.length;c++){for(var D=d[c],R=0;R<D.length;R++)D[R]({touches:m,xDelta:g,yDelta:h,distanceX:N,distanceY:O,elapse:i,xSpeed:j,ySpeed:k});if(e){for(c=0;c<w.length;c++)w[c]({touches:H});e=!1}if(f){for(c=0;c<w.length;c++)x[c]({touches:H});f=!1}}}var d=Human.input={},e=$("#annotationCanvas"),f=[],g=[],h={},i={},j=[],k=[],l=[],m=[],n=[],o=[],p=!0,q=[],r=[],s=[],t=[],u=[],v=[],w=[],x=[],y=250,z=250;jQuery(document).ready(function(){jQuery("body").bind((jQuery.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){"input"!==a.target.tagName.toLowerCase()&&"email"!==a.target.tagName.toLowerCase()&&"text"!==a.target.tagName.toLowerCase()&&"textarea"!==a.target.tagName.toLowerCase()&&a.preventDefault()}),jQuery(document).bind("contextmenu",function(a){return"snapshotPanelImage"!==a.target.id&&"input"!==a.target.type&&"email"!==a.target.type&&"text"!==a.target.type&&"textarea"!==a.target.type?!1:void 0})});var A={altDown:!1,ctrlDown:!1,keyDown:[],onTick:function(a){g.push(a)},onKeyDown:function(a,b){for(var c,d=0,e=a.length;e>d;d++)c=a[d],(h[c]||(h[c]=[])).push(b)},onKeyUp:function(a,b){for(var c,d=0,e=a.length;e>d;d++)c=a[d],(i[c]||(i[c]=[])).push(b)},onMouseDown:function(a){j.push(a)},onMouseUp:function(a){k.push(a)},onMouseDoubleClick:function(a){l.push(a)},onMouseMove:function(a){m.push(a)},onMouseWheel:function(a){n.push(a)},onReset:function(a){o.push(a)},onTouchStart:function(a){q.push(a)},onTouchMove:function(a){r.push(a)},onTouchEnd:function(a){v.push(a)},onTouchTap:function(a){w.push(a)},onTouchDoubleTap:function(a){x.push(a)},onTouchPinch:function(a){s.push(a)},onTouchZoom:function(a){t.push(a)},onTouchPan:function(a){u.push(a)}},B=null;Human.events.on("tick",function(){if(!p)return void(B=null);var a=(new Date).getTime()/1e3;if(null!==B)for(var b=a-B,c=0,d=g.length;d>c;c++)g[c](a,b);B=a});var C=0;Human.events.on("processes.started",function(){1===++C&&d.setEnabled(!1)}),Human.events.on("processes.finished",function(){0===--C&&d.setEnabled(!0)}),Human.events.on("processes.failed",function(){0===--C&&d.setEnabled(!0)}),document.addEventListener("keydown",function(a){if(p&&"INPUT"!==a.target.tagName&&"TEXTAREA"!==a.target.tagName){A.ctrlDown=a.ctrlKey||17===a.keyCode||a.metaKey,A.altDown=a.altKey||18===a.keyCode,A.keyDown[a.keyCode]=!0;
  var b=a.keyCode,c=h[b];if(c)for(var d=0,e=c.length;e>d;d++)c[d](b)}},!0),document.addEventListener("keyup",function(a){if(p&&"INPUT"!==a.target.tagName&&"TEXTAREA"!==a.target.tagName){(a.ctrlKey||17===a.keyCode)&&(A.ctrlDown=!1),(a.altKey||18===a.keyCode)&&(A.altDown=!1),A.keyDown[a.keyCode]=!1;var b=a.keyCode,c=i[b];if(c)for(var d=0,e=c.length;e>d;d++)c[d](b)}}),e.mousedown(function(b){switch(b.which){case 1:A.mouseDownLeft=!0;break;case 2:A.mouseDownMiddle=!0;break;case 3:A.mouseDownRight=!0}var c=a(b);A.mouseDownX=c.x,A.mouseDownY=c.y;for(var d=c.x,e=c.y,f=0,g=j.length;g>f;f++)j[f](d,e)}),e.mouseup(function(b){switch(b.which){case 1:A.mouseDownLeft=!1;break;case 2:A.mouseDownMiddle=!1;break;case 3:A.mouseDownRight=!1}for(var c=a(b),d=c.x,e=c.y,f=0,g=k.length;g>f;f++)k[f](d,e)}),e.dblclick(function(b){switch(b.which){case 1:A.mouseDownLeft=!1,A.mouseDownRight=!1;break;case 2:A.mouseDownMiddle=!1;break;case 3:A.mouseDownLeft=!1,A.mouseDownRight=!1}for(var c=a(b),d=c.x,e=c.y,f=0,g=l.length;g>f;f++)l[f](d,e)}),e.mousemove(function(b){for(var c=a(b),d=c.x,e=c.y,f=0,g=m.length;g>f;f++)m[f](d,e)}),e.bind("mousewheel",function(a,b){for(var c=0,d=n.length;d>c;c++)n[c](a,b)});var D=!!("ontouchstart"in window);if(D){var E,F=15,G=75,H=[],I=null,J=null,K=null,L=!1,M=[],N=0,O=0,P=0,Q=!1,R=document.getElementById("container");R.addEventListener("touchstart",c,!1),R.addEventListener("touchmove",c,!1),R.addEventListener("touchend",c,!1)}d.addHandler=function(a){f.push(new a(A))},d.setEnabled=function(a){p!==a&&(a?$.unblockUI():$.blockUI({overlayCSS:{opacity:0},message:""}),p=a,Human.events.fire(a?"inputEnabled":"inputDisabled",{}))},d.KEY_BACKSPACE=8,d.KEY_TAB=9,d.KEY_ENTER=13,d.KEY_SHIFT=16,d.KEY_CTRL=17,d.KEY_ALT=18,d.KEY_PAUSE_BREAK=19,d.KEY_CAPS_LOCK=20,d.KEY_ESCAPE=27,d.KEY_PAGE_UP=33,d.KEY_PAGE_DOWN=34,d.KEY_END=35,d.KEY_HOME=36,d.KEY_LEFT_ARROW=37,d.KEY_UP_ARROW=38,d.KEY_RIGHT_ARROW=39,d.KEY_DOWN_ARROW=40,d.KEY_INSERT=45,d.KEY_DELETE=46,d.KEY_NUM_0=48,d.KEY_NUM_1=49,d.KEY_NUM_2=50,d.KEY_NUM_3=51,d.KEY_NUM_4=52,d.KEY_NUM_5=53,d.KEY_NUM_6=54,d.KEY_NUM_7=55,d.KEY_NUM_8=56,d.KEY_NUM_9=57,d.KEY_A=65,d.KEY_B=66,d.KEY_C=67,d.KEY_D=68,d.KEY_E=69,d.KEY_F=70,d.KEY_G=71,d.KEY_H=72,d.KEY_I=73,d.KEY_J=74,d.KEY_K=75,d.KEY_L=76,d.KEY_M=77,d.KEY_N=78,d.KEY_O=79,d.KEY_P=80,d.KEY_Q=81,d.KEY_R=82,d.KEY_S=83,d.KEY_T=84,d.KEY_U=85,d.KEY_V=86,d.KEY_W=87,d.KEY_X=88,d.KEY_Y=89,d.KEY_Z=90,d.KEY_LEFT_WINDOW=91,d.KEY_RIGHT_WINDOW=92,d.KEY_SELECT_KEY=93,d.KEY_NUMPAD_0=96,d.KEY_NUMPAD_1=97,d.KEY_NUMPAD_2=98,d.KEY_NUMPAD_3=99,d.KEY_NUMPAD_4=100,d.KEY_NUMPAD_5=101,d.KEY_NUMPAD_6=102,d.KEY_NUMPAD_7=103,d.KEY_NUMPAD_8=104,d.KEY_NUMPAD_9=105,d.KEY_MULTIPLY=106,d.KEY_ADD=107,d.KEY_SUBTRACT=109,d.KEY_DECIMAL_POINT=110,d.KEY_DIVIDE=111,d.KEY_F1=112,d.KEY_F2=113,d.KEY_F3=114,d.KEY_F4=115,d.KEY_F5=116,d.KEY_F6=117,d.KEY_F7=118,d.KEY_F8=119,d.KEY_F9=120,d.KEY_F10=121,d.KEY_F11=122,d.KEY_F12=123,d.KEY_NUM_LOCK=144,d.KEY_SCROLL_LOCK=145,d.KEY_SEMI_COLON=186,d.KEY_EQUAL_SIGN=187,d.KEY_COMMA=188,d.KEY_DASH=189,d.KEY_PERIOD=190,d.KEY_FORWARD_SLASH=191,d.KEY_GRAVE_ACCENT=192,d.KEY_OPEN_BRACKET=219,d.KEY_BACK_SLASH=220,d.KEY_CLOSE_BRAKET=221,d.KEY_SINGLE_QUOTE=222,d.KEY_SPACE=32}(),function(){"use strict";Human.rpc.define("input.disable",function(){Human.input.setEnabled()}),Human.rpc.define("input.enable",function(){Human.input.setEnabled(!0)})}(),Human.input.addHandler(function(a){"use strict";var b=50,c=50;a.onTick(function(d,e){if(!a.ctrlDown&&!a.altDown){var f=a.keyDown[Human.input.KEY_LEFT_ARROW],g=a.keyDown[Human.input.KEY_RIGHT_ARROW],h=a.keyDown[Human.input.KEY_UP_ARROW],i=a.keyDown[Human.input.KEY_DOWN_ARROW];if(f||g||h||i){var j=0,k=0;g?j=-e*b:f&&(j=e*b),i?k=-(e*c):h&&(k=e*c),Math.abs(j)>Math.abs(k)?k=null:j=null,Human.view.camera.rotateY(j),Human.view.camera.rotateX(k),Human.view.mouseCursor.gotoRotate()}}}),a.onKeyUp([Human.input.KEY_UP_ARROW,Human.input.KEY_RIGHT_ARROW,Human.input.KEY_DOWN_ARROW,Human.input.KEY_LEFT_ARROW],function(){a.ctrlDown||a.altDown||Human.view.mouseCursor.gotoDefault()})}),Human.input.addHandler(function(a){"use strict";a.onKeyDown([Human.input.KEY_NUM_1,Human.input.KEY_NUM_2,Human.input.KEY_NUM_3,Human.input.KEY_NUM_4,Human.input.KEY_NUM_5,Human.input.KEY_NUM_6],function(b){if(!a.ctrlDown&&!a.altDown){var c=Human.view.camera;b===Human.input.KEY_NUM_1?c.viewAnterior():b===Human.input.KEY_NUM_2?c.viewPosterior():b===Human.input.KEY_NUM_3?c.viewRight():b===Human.input.KEY_NUM_4?c.viewLeft():b===Human.input.KEY_NUM_5?c.viewSuperior():b===Human.input.KEY_NUM_6&&c.viewInferior()}})}),Human.input.addHandler(function(a){"use strict";var b=10;a.onTick(function(c,d){if(!a.ctrlDown&&!a.altDown){var e=a.keyDown[Human.input.KEY_W],f=a.keyDown[Human.input.KEY_S],g=a.keyDown[Human.input.KEY_A],h=a.keyDown[Human.input.KEY_D];if(e||f||g||h){var i=0,j=0,k=0;f?j=d*b:e&&(j=-d*b),h?i=d*b:g&&(i=-d*b),Human.view.camera.pan({x:i,y:j,z:k})}}})}),Human.input.addHandler(function(a){"use strict";var b=3;a.onTick(function(c,d){if(!a.ctrlDown&&!a.altDown){var e=a.keyDown[Human.input.KEY_Z],f=a.keyDown[Human.input.KEY_X];if(e||f){var g=e?-(d*b):d*b;Human.view.camera.zoom(g)}}})}),function(){"use strict";var a=!0;Human.properties.subscribe({propId:"ui.zoom.mouseWheel.enabled",value:a,callback:function(b){a=!!b}}),Human.input.addHandler(function(b){var c,d=0,e=0,f=!1,g=!1,h=0,i=.2;b.onMouseWheel(function(b,c){a&&(d=-c,0===d?(g=!1,f=!1):f=!0)}),b.onTick(function(b){if(a){var j=Human.view.camera,k=j.eye,l=j.look;k=[k.x,k.y,k.z],l=[l.x,l.y,l.z];var m=Math.abs(Human.math.lenVec3(Human.math.subVec3(k,l))),n=j.maxZoom-j.minZoom,o=i*(2+m/n);f&&(e=d*o,h=0,f=!1,g=!0),g&&(d>0?(h+=.2*o,h>e&&(g=!1)):0>d&&(h-=.2*o,e>h&&(g=!1)),g&&Human.view.camera.zoom(h)),c=b}})})}(),Human.input.addHandler(function(a){"use strict";var b,c,d=.2,e=0,f=0,g=!1;a.onMouseDown(function(d,e){!a.mouseDownLeft||a.mouseDownRight||a.keyDown[Human.input.KEY_SHIFT]?g=!1:(g=!0,b=d,c=e)}),a.onMouseUp(function(){g=a.mouseDownLeft&&!a.mouseDownRight}),a.onMouseMove(function(a,h){g&&(e+=(a-b)*d,f+=(h-c)*d,b=a,c=h)}),a.onTick(function(){if(Math.abs(e)>0||Math.abs(f)>0){var a=Human.view.camera,b=a.eye,c=a.look;b=[b.x,b.y,b.z],c=[c.x,c.y,c.z];var d=Math.abs(Human.math.lenVec3(Human.math.subVec3(b,c))),g=a.maxZoom-a.minZoom,h=1+d/g;Human.view.camera.rotateY(-e*h),Human.view.camera.rotateX(f*h),e=0,f=0}})}),Human.input.addHandler(function(a){"use strict";var b;Human.properties.subscribe({propId:"camera.zoomLimits",value:{min:.01,max:150},callback:function(a){b=a}});var c,d,e=.16,f=1,g=0,h=0,i=!1;a.onMouseDown(function(b,e){a.mouseDownLeft&&a.mouseDownRight||a.mouseDownLeft&&a.keyDown[Human.input.KEY_SHIFT]||a.mouseDownMiddle?(i=!0,c=b,d=e):i=!1}),a.onMouseUp(function(){i=!1}),a.onMouseMove(function(a,b){if(i){var f=Human.view.camera,j=f.eye,k=f.look;j=[j.x,j.y,j.z],k=[k.x,k.y,k.z];var l=Math.abs(Human.math.lenVec3(Human.math.subVec3(j,k))),m=f.maxZoom-f.minZoom,n=e*(l/m);g+=(a-c)*n,h+=(b-d)*n,c=a,d=b}}),a.onTick(function(){(Math.abs(g)>0||Math.abs(h)>0)&&(Human.view.camera.pan({x:g*f,y:h*f}),g=0,h=0)})}),Human.input.addHandler(function(a){"use strict";function b(){g&&(clearTimeout(g),g=null),c=null,d=null,Human.view.pick.hoverOff()}var c=null,d=null,e=4,f=.5,g=null,h=!1;a.onReset(function(){b()}),a.onMouseMove(function(a,i){h||(null!==c&&(Math.abs(a-c)>e||Math.abs(i-d)>e?b():(g&&(clearTimeout(g),g=null),Human.view.pick.hoverOff(),g=setTimeout(function(){Human.view.pick.hoverPick({canvasX:a,canvasY:i}),clearTimeout(g),g=null,c=null,d=null},1e3*f))),c=a,d=i)}),a.onMouseDown(function(){b(),h=!0}),a.onMouseUp(function(a,b){c=a,d=b,h=!1})}),Human.input.addHandler(function(a){"use strict";var b,c,d=null,e=null,f=4,g=!1,h=!1,i=!1,j=!1,k=!1,l=!1;a.onKeyDown([Human.input.KEY_SHIFT],function(b){if(!a.ctrlDown&&!a.CTRL)switch(b){case Human.input.KEY_SHIFT:Human.view.pick.setMultiPickEnabled(!0)}}),a.onKeyUp([Human.input.KEY_SHIFT],function(b){if(!a.ctrlDown&&!a.CTRL)switch(b){case Human.input.KEY_SHIFT:Human.view.pick.setSinglePickEnabled(!0)}}),a.onKeyDown([Human.input.KEY_SPACE],function(){k=!0}),a.onKeyUp([Human.input.KEY_SPACE],function(){k=!1}),a.onKeyDown([Human.input.KEY_CTRL],function(){l=!0}),a.onKeyUp([Human.input.KEY_CTRL],function(){l=!1}),a.onMouseDown(function(b,c){d=b,e=c,i=a.mouseDownLeft,j=a.mouseDownRight}),a.onMouseUp(function(a,h){Math.abs(d-a)<f&&Math.abs(e-h)<f&&(b=a,c=h,g=!0)}),a.onMouseDoubleClick(function(k,l){Math.abs(d-k)<f&&Math.abs(e-l)<f&&(b=k,c=l,g=!0,h=!0,i=a.mouseDownLeft,j=a.mouseDownRight)}),a.onTick(function(){if(g){var a={canvasX:b,canvasY:c,mouseDownLeft:i,mouseDownRight:j,spaceDown:k,ctrlDown:l};h?Human.view.pick.doublePick(a):Human.view.pick.pick(a),g=!1,h=!1,d=null,e=null}})}),Human.input.addHandler(function(a){"use strict";a.onKeyDown([Human.input.KEY_R,Human.input.KEY_T,Human.input.KEY_I,Human.input.KEY_Y,Human.input.KEY_Z,Human.input.KEY_C],function(b){if(!a.ctrlDown&&!a.altDown)switch(b){case Human.input.KEY_R:Human.rpc.call(null,"highlight.setEnabled",{enable:!0});break;case Human.input.KEY_T:Human.rpc.call(null,"xray.setEnabled",{enable:!0});break;case Human.input.KEY_I:Human.rpc.call(null,"isolate.setEnabled",{enable:!0})}if(a.ctrlDown&&!a.altDown)switch(b){case Human.input.KEY_Y:Human.view.dissect.redo();break;case Human.input.KEY_Z:Human.view.dissect.undo();break;case Human.input.KEY_R:Human.init.reset();break;case Human.input.KEY_C:Human.rpc.call(null,"dissect.setEnabled",{enable:!0})}})}),Human.input.addHandler(function(a){"use strict";var b,c=10,d=null;a.onTick(function(e){if(!a.ctrlDown&&!a.altDown){var f=a.keyDown[Human.input.KEY_M],g=a.keyDown[Human.input.KEY_N];if(f||g){if(!Human.view.clip.selectedClip)return;if(b){var h,i=(e-b)/1e3;g?h=i*c:f&&(h=-i*c);var j=Human.view.clip.selectedClip;return j.shown||(d=j.clipId),Human.view.clip.setClip({state:Human.view.clip.Plane.STATE_VISIBLE,progress:j.progress+h}),!0}b=e}else b=null,d&&(Human.view.clip.setClip({clipId:d,state:Human.view.clip.Plane.STATE_CLIPPING}),d=null)}})}),Human.input.addHandler(function(a){"use strict";var b=!1;a.onKeyDown([Human.input.KEY_X],function(){!a.ctrlDown||a.altDown||b||(Human.view.dissect.setEnabled(!0),b=!0)}),a.onKeyUp([Human.input.KEY_X],function(){b&&(Human.view.dissect.setEnabled(!1),b=!1)})}),Human.input.addHandler(function(a){"use strict";a.onKeyDown([Human.input.KEY_R],function(){if(a.keyDown[Human.input.KEY_SHIFT]){var b="This will reset to the initial view. Are you sure you want to continue?";confirm(b)&&Human.init.reset()}})}),function(){"use strict";var a=Human.scene={};a.checkTestStarted=!1,a.rootObjects=[],a.modelObjects={},a.objects={},a.objectsByFMAID={},a.objectsForTags={},a.numObjects=0,a._boundary=null,a.center=[0,0,0],a.enabledObjects={},a.selectedObjects={},a.transparentObjects={},a.pickThroughObjects={},a.desaturatedObjects={},a.backfaceObjects={},a.showSelectedObjects=!1,a.alwaysEnabledObjects={},a._leavesCache={},a.__createObject=function(b){if(!b.moduleId)return void Human.log.error("Scene.__createObject","Param expected: moduleId");if(!b.objectId)return void Human.log.error("Scene.__createObject","Param expected: objectId");var c=b.parentObjectId?a.objects[b.parentObjectId]:null,d=b.modelId;b.tags=b.tags||[];var e=c?a._inheritTags(b.tags,c):b.tags,f=new Human.scene.Object({moduleId:b.moduleId,modelId:d,parent:c,attachNodeId:Human.CONTENT_ROOT_ID,displayName:b.displayName,objectId:b.objectId,anonymous:b.anonymous,localObjectId:b.localObjectId,fmaId:b.fmaId,objectName:b.objectName,description:b.description,reflectInstance:b.reflectInstance,material:b.material,shader:b.shader,pickable:b.pickable,layer:b.layer,level:c?c.level+1:0,geometry:b.geometry,morph:b.morph,transform:b.transform,pivot:b.pivot,translate:b.translate,scale:b.scale,rotate:b.rotate,flip:b.flip,desaturate:b.desaturate,glassFactor:b.glassFactor,murkiness:b.murkiness,tags:e});return a.objects[b.objectId]=f,f.fmaId&&(a.objectsByFMAID[f.fmaId]=f),c?c.__addObject(f):a.rootObjects.push(f),(a.modelObjects[d]=a.modelObjects[d]||{})[b.objectId]=f,a._registerObjectForTags(f),a.numObjects++,a._boundary=null,Human.events.fire("scene.objectCreated",{moduleId:b.moduleId,modelId:d,objectId:f.objectId,name:f.displayName,description:f.description,displayName:f.displayName,fmaId:f.fmaId,tags:f.tags,parentObjectId:c?c.objectId:null}),f},a._inheritTags=function(a,b){var c,d,e=a||[],f=b.tags,g=[];if(e){for(var h=0,i=f.length;i>h;h++){d=f[h];for(var j=!0,k=0,l=e.length;l>k;k++)c=e[k],c===f[k]&&(j=!1);j&&g.push(d)}return e.concat(g)}return e},a._registerObjectForTags=function(b){for(var c,d,e=b.tags,f=0,g=e.length;g>f;f++)c=e[f],d=a.objectsForTags[c],d||(d=a.objectsForTags[c]={}),d[b.objectId]=b},a._deregisterObjectForTags=function(b){for(var c,d,e=b.tags,f=0,g=e.length;g>f;f++)c=e[f],d=a.objectsForTags[c],d&&delete d[b.objectId]},a.getObject=function(b){var c=a.objects[b];return c||Human.log.error("Human.scene.getObject","Scene object not found: '"+b+"'"),c},a.setEnabledObjects=function(b){var c,d=b.objects||b.objectIds,e={},f={};if(b.replace)for(c in a.enabledObjects)a.enabledObjects.hasOwnProperty(c)&&(a.enabledObjects[c]._enabledSubObjects=0,delete a.enabledObjects[c],e[c]=!1,a.selectedObjects.hasOwnProperty(c)&&(a.selectedObjects[c]._selectedSubObjects=0,delete a.selectedObjects[c],f[c]=!1),a._updateObjectVisibility(c));a._getEnabledFlagsinSubtreeForObjectMap(d,e);for(c in e)e.hasOwnProperty(c)&&(e[c]?a.enabledObjects[c]||(a.enabledObjects[c]=a.objects[c],a._updateObjectVisibility(c),e[c]=!0):a.enabledObjects[c]&&(delete a.enabledObjects[c],a.selectedObjects[c]&&(f||(f={}),delete a.selectedObjects[c],f[c]=!1),a._updateObjectVisibility(c),e[c]=!1));Human.events.fire("scene.objectsShown",{enabledObjectsUpdate:e,showSelectedObjects:a.showSelectedObjects}),f&&Human.events.fire("scene.objectsSelected",{selectedObjectsUpdate:f,showSelectedObjects:a.showSelectedObjects})},a._getEnabledFlagsinSubtreeForObjectMap=function(b,c){for(var d,e,f=a._sortObjectIDsIntoLevelBuckets(b),g=0,h=f.length;h>g;g++)if(d=f[g])for(var i=0,j=d.length;j>i;i++)e=d[i],a._getEnabledFlagsInSubtreeForObject(e,!!b[e],c)},a._sortObjectIDsIntoLevelBuckets=function(b){var c,d,e,f,g=[];for(c in b)b.hasOwnProperty(c)&&(e=a.objects[c],e&&(f=e.level,d=g[f]||(g[f]=[]),d.push(c)));return g},a._getEnabledFlagsInSubtreeForObject=function(b,c,d){d=d||{};var e=a.objects[b];if(!e||e._destroyed)return d;d[b]=c;var f=a.enabledObjects[b];if(e.parent)for(var g=e.parent;g;g=g.parent)(void 0===g._enabledSubObjects||null===g._enabledSubObjects)&&(g._enabledSubObjects=0),c?f||1===++g._enabledSubObjects&&(d[g.objectId]=!0):f&&0===--g._enabledSubObjects&&(d[g.objectId]=!1);for(var h=e.objects,i=0,j=h.length;j>i;i++)a._getEnabledFlagsInSubtreeForObject(h[i].objectId,c,d);return d},a.setSelectedObjects=function(b){var c,d,e=b.objects||b.objectIds||{},f={};if(b.objectId){if(d=a.objects[b.objectId],!d)return void Human.log.error("Human.scene.setSelectedObjects","Scene object not found: '"+b.objectId+"'");var g=!!b.select;if(b.replace)for(c in a.selectedObjects)a.selectedObjects.hasOwnProperty(c)&&(d=a.selectedObjects[c],d._selectedSubObjects=0,delete a.selectedObjects[c],a.showSelectedObjects&&d.shown&&d.show(!1),f[c]=!1);a._getObjectSelectedFlagsInSubtree(b.objectId,g,f)}else{if(b.replace)for(c in a.selectedObjects)a.selectedObjects.hasOwnProperty(c)&&(a.selectedObjects[c]._selectedSubObjects=0,delete a.selectedObjects[c],f[c]=!1,a._updateObjectVisibility(c));a._getSelectedFlagsInSubtreeForObjectMap(e,f)}var h;for(c in f)if(f.hasOwnProperty(c))if(d=a.objects[c],f[c]){if(!a.selectedObjects[c]){a.selectedObjects[c]=d,a.enabledObjects[c]||(h||(h={}),h[c]=!0,a.enabledObjects[c]=d);var i=!!(a.showSelectedObjects?a.selectedObjects[c]:a.enabledObjects[c]);d.shown!==i&&d.show(i),d.selected||d.select(!0),f[c]=!0}}else a.selectedObjects[c]&&(delete a.selectedObjects[c],a._updateObjectVisibility(c),d.selected&&d.select(!1),f[c]=!1);h&&Human.events.fire("scene.objectsShown",{enabledObjectsUpdate:h,showSelectedObjects:a.showSelectedObjects}),Human.events.fire("scene.objectsSelected",{selectedObjectsUpdate:f,showSelectedObjects:a.showSelectedObjects})},a._getSelectedFlagsInSubtreeForObjectMap=function(b,c){for(var d,e,f=a._sortObjectIDsIntoLevelBuckets(b),g=0,h=f.length;h>g;g++)if(d=f[g])for(var i=0,j=d.length;j>i;i++)e=d[i],a._getObjectSelectedFlagsInSubtree(e,!!b[e],c)},a._getObjectSelectedFlagsInSubtree=function(b,c,d){d=d||{};var e=a.objects[b];if(!e||e._destroyed)return d;d[b]=c;var f=a.selectedObjects[b],g=a.enabledObjects[b];if(e.parent)for(var h=e.parent;h;h=h.parent)(void 0===h._enabledSubObjects||null===h._enabledSubObjects)&&(h._enabledSubObjects=0),(void 0===h._selectedSubObjects||null===h._selectedSubObjects)&&(h._selectedSubObjects=0),c?(f||1===++h._selectedSubObjects&&(d[h.objectId]=!0),g||h._enabledSubObjects++):f&&--h._selectedSubObjects<=0&&(h._selectedSubObjects=0,d[h.objectId]=!1);for(var i=e.objects,j=0,k=i.length;k>j;j++)a._getObjectSelectedFlagsInSubtree(i[j].objectId,c,d);return d},a.anySelected=function(b){var c;for(var d in a.selectedObjects)if(a.selectedObjects.hasOwnProperty(d)){if(c=a.selectedObjects[d],!b)return!0;if(0===c.numSubObjects)return!0}return!1},a.setShowSelectedObjects=function(b){a.showSelectedObjects=b;var c,d;for(var e in a.objects)a.objects.hasOwnProperty(e)&&(c=a.objects[e],d=!!(a.showSelectedObjects?a.selectedObjects[e]:a.enabledObjects[e]),c.shown!==d&&c.show(d))},a._updateObjectVisibility=function(b){var c=a.objects[b],d=!!(a.showSelectedObjects?a.selectedObjects[b]:a.enabledObjects[b]);c.shown!==d&&c.show(d)},a.setPickThroughObjects=function(b){var c,d=b.objects||b.objectIds||{};if(b.replace)for(c in a.pickThroughObjects)a.pickThroughObjects.hasOwnProperty(c)&&a.pickThroughObjects[c]&&(a.objects[c].setPickable(!0),delete a.pickThroughObjects[c]);for(c in d)d.hasOwnProperty(c)&&d[c]===!0&&a.objects[c]&&a._setPickThroughObjects(a.objects[c],d[c])},a._setPickThroughObjects=function(b,c){a.pickThroughObjects[b.objectId]=c,b.setPickable(!c);for(var d=b.objects,e=0,f=d.length;f>e;e++)a._setPickThroughObjects(d[e],c)},a.setTransparentObjects=function(b){var c,d=b.objectIds||{};if(b.replace)for(c in a.transparentObjects)a.transparentObjects.hasOwnProperty(c)&&a.transparentObjects[c]&&(a.objects[c].setTransparent(!1,!0,!0),delete a.transparentObjects[c]);for(c in d)d.hasOwnProperty(c)&&d[c]===!0&&a.objects[c]&&a._setTransparentObjects(a.objects[c],d[c])},a._setTransparentObjects=function(b,c){a.transparentObjects[b.objectId]=c,b.setTransparent(c,!0);for(var d=b.objects,e=0,f=d.length;f>e;e++)a._setTransparentObjects(d[e],c)},a.setDesaturatedObjects=function(b){var c,d=b.objects||b.objectIds||{};if(b.replace)for(c in a.desaturatedObjects)a.desaturatedObjects.hasOwnProperty(c)&&a.desaturatedObjects[c]&&(a.objects[c].setDesaturate(!1),delete a.desaturatedObjects[c]);for(c in d)d.hasOwnProperty(c)&&d[c]===!0&&a.objects[c]&&a._setDesaturatedObjects(a.objects[c],d[c])},a._setDesaturatedObjects=function(b,c){a.desaturatedObjects[b.objectId]=c,b.setDesaturate(c);for(var d=b.objects,e=0,f=d.length;f>e;e++)a._setDesaturatedObjects(d[e],c)},a.setBackfaceObjects=function(b){var c,d=b.objects||b.objectIds||{};if(b.replace)for(c in a.backfaceObjects)a.backfaceObjects.hasOwnProperty(c)&&a.backfaceObjects[c]&&(a.objects[c].setBackfaces(!1),delete a.backfaceObjects[c]);for(c in d)d.hasOwnProperty(c)&&d[c]===!0&&a.objects[c]&&a._setBackfaceObjects(a.objects[c],d[c])},a._setBackfaceObjects=function(b,c){a.backfaceObjects[b.objectId]=c,b.setTransparentBackfaces(c);for(var d=b.objects,e=0,f=d.length;f>e;e++)a._setBackfaceObjects(d[e],c)},a.setObjectGlassFactors=function(b){var c,d=b.objectIds||{};for(c in d)d.hasOwnProperty(c)&&a.objects[c]&&a._setObjectGlassFactors(a.objects[c],d[c])},a._setObjectGlassFactors=function(b,c){b.setGlassFactor(c,!0);for(var d=b.objects,e=0,f=d.length;f>e;e++)a._setObjectGlassFactors(d[e],c)},a.setObjectMurkiness=function(b){var c,d=b.objectIds||{};for(c in d)d.hasOwnProperty(c)&&a.objects[c]&&a._setObjectMurkiness(a.objects[c],d[c])},a._setObjectMurkiness=function(b,c){b.setMurkiness(c,!0);for(var d=b.objects,e=0,f=d.length;f>e;e++)a._setObjectMurkiness(d[e],c)},a.setObjectOpacities=function(b){var c,d=b.objectIds||{};for(c in d)d.hasOwnProperty(c)&&a.objects[c]&&a._setObjectOpacities(a.objects[c],d[c])},a._setObjectOpacities=function(b,c){b.setOpacity(c,!0);for(var d=b.objects,e=0,f=d.length;f>e;e++)a._setObjectOpacities(d[e],c)},a.getLeaves=function(b){var c=a._leavesCache[b];if(!c){c=[];var d=a.objects[b];d&&a._getLeaves([d],c),a._leavesCache[b]=c}return c},a._getLeaves=function(b,c){for(var d,e=0,f=b.length;f>e;e++)d=b[e],0===d.objects.length?c.push(d.objectId):a._getLeaves(d.objects,c)},a.getEnabledLeaves=function(b){var c=[],d=a.objects[b];return d&&a._getEnabledLeaves([d],c),c},a._getEnabledLeaves=function(b,c){for(var d,e=0,f=b.length;f>e;e++)d=b[e],0===d.objects.length?a.enabledObjects.hasOwnProperty(d.objectId)&&c.push(d.objectId):a._getEnabledLeaves(d.objects,c)},a._getKeys=function(a,b){var c={};for(var d in a)a.hasOwnProperty(d)&&(d[d]=b);return c},a._destroyObject=function(b){var c=a.objects[b];if(c&&!c._destroyed){var d,e,f;for(e=0,f=a.rootObjects.length;f>e;e++)if(a.rootObjects[e].objectId===b){a.rootObjects.splice(e,1);break}if(delete a.objects[b],c.fmaId&&delete a.objectsByFMAID[c.fmaId],a.enabledObjects[b])for(d=c.parent;d;d=d.parent)void 0!==d._enabledSubObjects&&null!==d._enabledSubObjects&&d._enabledSubObjects--;if(a.selectedObjects[b])for(d=c.parent;d;d=d.parent)void 0!==d._selectedSubObjects&&null!==d._selectedSubObjects&&d._selectedSubObjects--;delete a.selectedObjects[b],delete a.enabledObjects[b],delete a.transparentObjects[b],delete a.pickThroughObjects[b],delete a.desaturatedObjects[b],delete a.backfaceObjects[b],a.numObjects--,c.parent&&c.parent._removeObject(b);var g=c.objects.slice(0);for(e=0,f=g.length;f>e;e++)a._destroyObject(g[e].objectId);c._destroy(),c._destroyed=!0,delete a.modelObjects[c.modelId][c.objectId],a._deregisterObjectForTags(c),a._leavesCache={},a._boundary=null,Human.events.fire("scene.objectDestroyed",{objectId:b})}},a.getBoundary=function(b){var c,d;if(!b){if(!a._boundary){a._boundary={xmin:1e5,ymin:1e5,zmin:1e5,xmax:-1e5,ymax:-1e5,zmax:-1e5};for(d in a.objects)if(a.objects.hasOwnProperty(d)&&(c=a.objects[d],0===c.objects.length)){var e=c.getBoundary();e.xmin<a._boundary.xmin&&(a._boundary.xmin=e.xmin),e.ymin<a._boundary.ymin&&(a._boundary.ymin=e.ymin),e.zmin<a._boundary.zmin&&(a._boundary.zmin=e.zmin),e.xmax>a._boundary.xmax&&(a._boundary.xmax=e.xmax),e.ymax>a._boundary.ymax&&(a._boundary.ymax=e.ymax),e.zmax>a._boundary.zmax&&(a._boundary.zmax=e.zmax)}}return a._boundary}if("string"==typeof b)return c=Human.scene.objects[b],c?c.getBoundary():(Human.log.warn("Human.scene.getBoundary","Scene object not found: '"+b+"'"),null);var f,g=1e5,h=1e5,i=1e5,j=-1e5,k=-1e5,l=-1e5,m=!1;if(Human._isArray(b))for(var n=0;n<b.length;n++)c=a.objects[b[n]],c&&(f=c.getBoundary(),f.xmin<g&&(g=f.xmin),f.ymin<h&&(h=f.ymin),f.zmin<i&&(i=f.zmin),f.xmax>j&&(j=f.xmax),f.ymax>k&&(k=f.ymax),f.zmax>l&&(l=f.zmax),m=!0);else for(d in b)b[d]!==!1&&(c=a.objects[d],c&&(f=c.getBoundary(),f.xmin<g&&(g=f.xmin),f.ymin<h&&(h=f.ymin),f.zmin<i&&(i=f.zmin),f.xmax>j&&(j=f.xmax),f.ymax>k&&(k=f.ymax),f.zmax>l&&(l=f.zmax),m=!0));return m?{xmin:g,ymin:h,zmin:i,xmax:j,ymax:k,zmax:l}:{xmin:-100,ymin:-100,zmin:-100,xmax:100,ymax:100,zmax:100}}}(),function(){"use strict";function a(){var a={},b=Human.renderer.getContentRootNode().addNode({type:"flags",flags:{enabled:!1}}),c=b.addNode({type:"material",color:{r:0,g:0,b:1},emit:1}),d=c.addNode({type:"geometry",source:{type:"boundary"}});return a.setShown=function(a){b.setEnabled(a)},a.setBoundary=function(a){d.setSource(a)},a.destroy=function(){b.destroy()},a}var b,c;Human.properties.subscribe({propId:"hacks.neverBackfaces",value:!1,callback:function(a){b=a}}),Human.properties.subscribe({propId:"hacks.alwaysBackfaces",value:!1,callback:function(a){c=a}}),Human.scene.Object=function(d){function e(){f.pivot=k.pivot,f.translate=k.translate,f.scale=k.scale,f.rotate=k.rotate,f._buildMatrix()}var f=this;this._hackAlwaysBackfaces=c,this._hackNeverBackfaces=b,this._init(),this.moduleId=d.moduleId,this.modelId=d.modelId,this.objectId=d.objectId,this.anonymous=d.anonymous,this.fmaId=d.fmaId,this.layer=d.layer,this.displayName=d.displayName,this.name=d.displayName,this.description=d.description,this.parent=d.parent,this.shown=!1,this.selected=!1,this.level=d.level,this.pickable=!0,this.clippable=!0,this.transparent=!1,this.xray=!1,this.glassFactor=void 0!==d.glassFactor?d.glassFactor:1,this.murkiness=void 0!==d.murkiness?d.murkiness:1,this.desaturate=!!d.desaturate,this.highlight=!1,this.transparentBackfaces=!1,this.flip=d.flip!==!1,this.tags=d.tags,this.numSubObjects=0,this.numSubObjectsLoaded=0,this.objects=[],this._boundedAssets=[],this._boundaryDirty=!0;var g,h,i;if(this._rootNode=g=d.parent?d.parent._childNodeContainer.addNode():Human.renderer.getNode(d.attachNodeId).addNode(),this._transformNode=g=g.addNode({type:"xform"}),this._childNodeContainer=this._transformNode,d.geometry||d.morph){d.material&&(h=d.material,h.texture&&(g=g.addNode({type:"_texture",coreId:h.texture.getCoreId()})),h.material&&(g=g.addNode({type:"material",coreId:h.material.getCoreId()}),this.glassFactor=h.glassFactor,this.murkiness=h.murkiness),h.reflection&&(g=g.addNode({type:"reflect",coreId:h.reflection.getCoreId()}))),i={picking:this.pickable,enabled:!1,specular:!0,backfaceLighting:!0,backfaceTexturing:!0,backfaces:this._hackNeverBackfaces===!0?!1:this._hackAlwaysBackfaces===!0?!0:!0,reflection:!0},this._xrayBackfaces=!1,h&&h.flags&&(i=Human._apply(h.flags.get("flags"),i)),i.enabled=!1,i.pickable=!0,this._flagsNode=g=g.addNode({type:"flags",flags:i}),this._nameNode=g=g.addNode({type:"name",name:d.objectId||"noname"});var j=0;d.layer&&(j=d.layer),this._layerNode=g=g.addNode({type:"layer",priority:j}),this._shaderNode=g=g.addNode({type:"shader",coreId:"standard-shaders-xray"}),this._shaderParamsNode=g=g.addNode({type:"shaderParams",params:{transparent:!1,xray:!1,highlight:!1,desaturate:this.desaturate,opacity:1,glassFactor:this.glassFactor,murkiness:this.murkiness}}),d.morph&&(g=g.addNode({type:"morphGeometry",coreId:d.morph.morphGeometry.getCoreId()}),this._boundedAssets.push(d.morph)),d.geometry&&(g.addNode({type:"geometry",coreId:d.geometry.geometry.getCoreId()}),this._boundedAssets.push(d.geometry))}if(this._bbox=a(),this.parent&&this.parent._subObjectReady(this),d.transform){var k=d.transform;this._transform=k,e(),k.on("updated",e)}else this.pivot=d.pivot?Human._apply(d.pivot,{x:0,y:0,z:0}):{x:0,y:0,z:0},this.translate=d.translate?Human._apply(d.translate,{x:0,y:0,z:0}):{x:0,y:0,z:0},this.scale=d.scale?Human._apply(d.scale,{x:1,y:1,z:1}):{x:1,y:1,z:1},this.rotate=d.rotate?Human._apply(d.rotate,{x:0,y:0,z:0}):{x:0,y:0,z:0},this._buildMatrix();d.material&&(h=d.material.material,i=d.material.flags,h&&i&&i.getTransparent()&&(this.setOpacity(h.getAlpha()),this.setTransparent(!0)))},Human.utils.extend(Human.scene.Object,Human.Component),Human.scene.Object.prototype._subObjectReady=function(a){this.numSubObjectsLoaded++,this._boundaryDirty=!0,this.numSubObjects>0&&this.numSubObjects===this.numSubObjectsLoaded&&this.parent&&this.parent._subObjectReady(this),this.parent&&this.parent._subObjectReady(a)},Human.scene.Object.prototype.setTransform=function(a){return this._transform?void this._transform.set(a):(a.pivot&&(void 0!==a.pivot.x&&null!==a.pivot.x&&(this.pivot.x=a.pivot.x),void 0!==a.pivot.y&&null!==a.pivot.y&&(this.pivot.y=a.pivot.y),void 0!==a.pivot.z&&null!==a.pivot.z&&(this.pivot.z=a.pivot.z)),a.translate&&(void 0!==a.translate.x&&null!==a.translate.x&&(this.translate.x=a.translate.x),void 0!==a.translate.y&&null!==a.translate.y&&(this.translate.y=a.translate.y),void 0!==a.translate.z&&null!==a.translate.z&&(this.translate.z=a.translate.z)),a.scale&&(void 0!==a.scale.x&&null!==a.scale.x&&(this.scale.x=a.scale.x),void 0!==a.scale.y&&null!==a.scale.y&&(this.scale.y=a.scale.y),void 0!==a.scale.z&&null!==a.scale.z&&(this.scale.z=a.scale.z)),a.rotate&&(void 0!==a.rotate.x&&null!==a.rotate.x&&(this.rotate.x=a.rotate.x),void 0!==a.rotate.y&&null!==a.rotate.y&&(this.rotate.y=a.rotate.y),void 0!==a.rotate.z&&null!==a.rotate.z&&(this.rotate.z=a.rotate.z)),void this._buildMatrix())},Human.scene.Object.prototype._buildMatrix=function(){var a=this.pivot,b=this.translate,c=Human.math.translationMat4v([-a.x,-a.y,-a.z]),d=this.scale,e=Human.math.scalingMat4v([d.x,d.y,d.z]),f=Human.math.translationMat4v([b.x+a.x,b.y+a.y,b.z+a.z]),g=this.rotate,h=Human.math.rotationMat4v(g.z*Math.PI/180,[0,0,1]),i=Human.math.rotationMat4v(g.y*Math.PI/180,[0,1,0]),j=Human.math.rotationMat4v(g.x*Math.PI/180,[1,0,0]),k=Human.math.identityMat4();Human.math.mulMat4(c,k,k),Human.math.mulMat4(e,k,k),Human.math.mulMat4(j,k,k),Human.math.mulMat4(i,k,k),Human.math.mulMat4(h,k,k),Human.math.mulMat4(f,k,k),this.matrix=k,this._transformNode.setElements(this.matrix),this._setSubBoundaryDirty(),this._setBoundaryDirty(),this.flip&&this._setFrontFaceWinding(this.scale.x<0||this.scale.y<0||this.scale.z<0?"cw":"ccw")},Human.scene.Object.prototype._setBoundaryDirty=function(){if(!this._boundaryDirty){this._boundaryDirty=!0;for(var a=this.parent;a&&!a._boundaryDirty;a=a.parent)a._boundaryDirty=!0}},Human.scene.Object.prototype._setSubBoundaryDirty=function(){this._boundaryDirty=!0;for(var a=0,b=this.objects.length;b>a;a++)this.objects[a]._setSubBoundaryDirty()},Human.scene.Object.prototype._setFrontFaceWinding=function(a){this._flagsNode&&this._flagsNode.setFrontface(a);for(var b=0,c=this.objects.length;c>b;b++)this.objects[b]._setFrontFaceWinding(a)},Human.scene.Object.prototype.getBoundary=function(){return this._boundaryDirty&&this._rebuildBoundary(),this._boundary},Human.scene.Object.prototype.getCenter=function(){return this._boundaryDirty&&this._rebuildBoundary(),this._center},Human.scene.Object.prototype._rebuildBoundary=function(){if(this._boundaryDirty){var a,b;if(this._boundary={xmin:1e6,ymin:1e6,zmin:1e6,xmax:-1e6,ymax:-1e6,zmax:-1e6},this._boundedAssets){var c,d,e=this._transformNode.getWorldMatrix();for(a=0,b=this._boundedAssets.length;b>a;a++)c=this._boundedAssets[a].axisBoundary,c&&(d=this._getBoundary(Human.math.transformPoints3(e,c.verts)),this._expandBoundary(this._boundary,d))}var f;for(a=0,b=this.objects.length;b>a;a++)f=this.objects[a],f._boundaryDirty&&f._rebuildBoundary(),this._expandBoundary(this._boundary,f._boundary);this._center=[.5*(this._boundary.xmax+this._boundary.xmin),.5*(this._boundary.ymax+this._boundary.ymin),.5*(this._boundary.zmax+this._boundary.zmin)],this._boundaryDirty=!1,this._bbox.setBoundary(this._boundary)}},Human.scene.Object.prototype._getBoundary=function(a){for(var b,c,d,e=1e5,f=1e5,g=1e5,h=-1e5,i=-1e5,j=-1e5,k=0,l=a.length;l>k;k++)b=a[k][0],c=a[k][1],d=a[k][2],void 0!==b&&null!==b&&void 0!==c&&null!==c&&void 0!==d&&null!==d&&(e>b&&(e=b),f>c&&(f=c),g>d&&(g=d),b>h&&(h=b),c>i&&(i=c),d>j&&(j=d));return{xmin:e,ymin:f,zmin:g,xmax:h,ymax:i,zmax:j}},Human.scene.Object.prototype._expandBoundary=function(a,b){a.xmin>b.xmin&&(a.xmin=b.xmin),a.ymin>b.ymin&&(a.ymin=b.ymin),a.zmin>b.zmin&&(a.zmin=b.zmin),a.xmax<b.xmax&&(a.xmax=b.xmax),a.ymax<b.ymax&&(a.ymax=b.ymax),a.zmax<b.zmax&&(a.zmax=b.zmax)},Human.scene.Object.prototype.__addObject=function(a){this.objects.push(a),this._subObjectAdded(a)},Human.scene.Object.prototype._subObjectAdded=function(a){this.numSubObjects++,this._boundaryDirty=!0,this.parent&&this.parent._subObjectAdded(a)},Human.scene.Object.prototype.show=function(a){this.shown!==a&&(this._flagsNode&&this._flagsNode.setEnabled(a),this.shown=a,this.publish("shown",this.shown))},Human.scene.Object.prototype.select=function(a){this.selected=a},Human.scene.Object.prototype.setOpacity=function(a){this._shaderParamsNode&&this._shaderParamsNode.setParams({opacity:a})},Human.scene.Object.prototype.setTransparent=function(a){if(this.transparent!==a){if(this._shaderParamsNode){this._shaderParamsNode.setParams({transparent:a});
  var b=a||this.xray;this._flagsNode.setTransparent(b),this._flagsNode.setBackfaces(this._hackNeverBackfaces===!0?!1:this._hackAlwaysBackfaces===!0||!b)}this.transparent=a}},Human.scene.Object.prototype.setXRay=function(a){if(this.xray!==a){if(this._shaderParamsNode){this._shaderParamsNode.setParams({xray:a});var b=a||this.transparent;this._flagsNode.setTransparent(b),this._flagsNode.setBackfaces(this._hackNeverBackfaces===!0?!1:this._hackAlwaysBackfaces===!0||!b),this._shaderParamsNode.setParams({desaturate:a||this.desaturate})}this.xray=a}},Human.scene.Object.prototype.setDesaturate=function(a){this.desaturate!==a&&(this._shaderParamsNode&&this._shaderParamsNode.setParams({desaturate:a||this.xray}),this.desaturate=a)},Human.scene.Object.prototype.setGlassFactor=function(a){this.glassFactor=a,this._shaderParamsNode&&this._shaderParamsNode.setParams({glassFactor:a})},Human.scene.Object.prototype.setMurkiness=function(a){this.murkiness=a,this._shaderParamsNode&&this._shaderParamsNode.setParams({murkiness:a})},Human.scene.Object.prototype.setPickable=function(a){this.pickable!==a&&(this._flagsNode&&this._flagsNode.setPicking(a),this.pickable=a)},Human.scene.Object.prototype.setClippable=function(a){this.clippable!==a&&(this._flagsNode&&this._flagsNode.setClipping(a),this.clippable=a)},Human.scene.Object.prototype.setHighlight=function(a){this.highlight!==a&&(this._shaderParamsNode&&this._shaderParamsNode.setParams({highlight:a}),this.highlight=a)},Human.scene.Object.prototype.setTransparentBackfaces=function(){},Human.scene.Object.prototype._destroy=function(){this._destroyed||(this._rootNode&&this._rootNode.destroy(),this._bbox&&this._bbox.destroy(),this.publish("destroyed"))},Human.scene.Object.prototype._removeObject=function(a){for(var b=0,c=this.objects.length;c>b;b++){if(this.objects[b].objectId===a)return this.objects.splice(b,1),void this.numSubObjects--;this._setBoundaryDirty()}}}(),function(){"use strict";function a(a,c,d,e){var f=l.objects,h=[];for(var i in f)f.hasOwnProperty(i)&&h.push(i);m=h.length,Human.utils.ArrayIteration.call({},h,function(a,d,e){var h=f[a],i=h.displayname,j=null,l={systemId:a};p=0,b(a,i,function(){var a=g(c,h,j,l);q[c][k].objects.push(a.objectId),d()},e)},function(){d()},e)}function b(a,b,e,f){Human.net.getAnatomyIndex(j,a,function(g){c(a,b,g,function(b){d(a,g,b),e()},f)},f)}function c(a,b,c,d,e){function f(){h||d(i)}function g(a){h||(h=!0,e(a))}var h=!1,i={},k=4,l=0;Human.net.getAnatomyPositions(j,a,function(a){i.positions=a,++l===k&&f()},g),Human.net.getAnatomyNormals(j,a,function(a){i.normals=a,++l===k&&f()},g),Human.net.getAnatomyUVs(j,a,function(a){i.uv=a,++l===k&&f()},g),Human.net.getAnatomyIndices(j,a,function(a){i.indices=a,++l===k&&f()},g)}function d(a,b,c){for(var d in b)if(b.hasOwnProperty(d)){var g=b[d],h=new Float32Array(e(c.positions,g.positions,Human.net.getOffset(a,d,"positions"))),i=f(h);Human.assets.geometries.createGeometry(k,k+"."+d,{geometry:{primitive:"triangles",positions:h,normals:new Float32Array(e(c.normals,g.normals,Human.net.getOffset(a,d,"normals"))),uv:new Float32Array(e(c.uv,g.uv,Human.net.getOffset(a,d,"uv"))),indices:new Uint16Array(e(c.indices,g.indices,Human.net.getOffset(a,d,"indices")))},boundary:i})}}function e(a,b,c){var d=b[0]-c,e=d+b[1]-c;return a.subarray?a.subarray(d,e):a.slice(d,e)}function f(a){for(var b,c,d,e=1e5,f=1e5,g=1e5,h=-1e5,i=-1e5,j=-1e5,k=0,l=a.length-2;l>k;k+=3)b=a[k],c=a[k+1],d=a[k+2],void 0!==b&&null!==b&&void 0!==c&&null!==c&&void 0!==d&&null!==d&&(e>b&&(e=b),f>c&&(f=c),g>d&&(g=d),b>h&&(h=b),c>i&&(i=c),d>j&&(j=d));return{xmin:e,ymin:f,zmin:g,xmax:h,ymax:i,zmax:j}}function g(a,b,c,d){var e=p>=0?o[p-1]:null,f=b.priority,i=b.subLayer;void 0!==i&&null!==i?p>0&&(e=o[p-1],f=.001*i*(1+p)):(void 0===f||null===f)&&(f=p>0?o[p-1]:0),o[p++]=f;var j,l=b.nodeId,m=a+"-"+l,n=b.fmaid||b.fmaId?a+"-"+(b.fmaId||b.fmaid):null,q=c?a+"-"+c.nodeId:null;if(b.materialId){var r=a+"."+b.materialId;r?j=Human.assets.materials.materials[r]:Human.log.error("Human.scene.loader","Material not found: '"+b.materialId+"'")}var s;b.transformId&&(s=Human.assets.transforms.transforms[b.transformId],s||(s=Human.assets.transforms.transforms[a+"."+b.transformId]),s||Human.log.error("Human.scene.loader","Transform asset not found: "+b.transformId));var t,u=Human.assets.geometries.geometries[k+"."+l],v=Human.scene.__createObject({moduleId:h,modelId:a,objectId:m,localObjectId:l,objectName:b.nodeId,fmaId:n,displayName:b.displayname,parentObjectId:q,layer:f,geometry:u,material:j,transform:s,flip:b.flip,desaturate:b.desaturate,glassFactor:b.glassFactor,tags:b.tags||[]});if(b.objects)for(var w in b.objects)b.objects.hasOwnProperty(w)&&(t=b.objects[w],g(a,t,b,d));return p--,v}var h,i,j,k,l,m,n=Human.scene.loader={},o=[],p=0,q={};n.load=function(b,c,d,e,f,g){if(h=b,i=c,j=d,k=i+"."+j,q[i]=q[i]||{},q[i][k])return Human.log.warn("Human.scene.Loader.load","Library '"+d+"' already loaded for model '"+i+"' - not reloading"),void f();var m=g;g=function(a){Human.log.error("Human.scene.loader","Load failed: '"+k+"': "+a),delete q[i][k],m(a)},Human.assets.geometries.createLibrary(k),q[i][k]={geometryLibId:k,objects:[]},Human.net.getAnatomyManifest(j,function(b){l=b.manifest,a(h,i,f,g)},function(a){a("Human.scene.loader: failed to load anatomy manifest '"+j+"': "+a.errorText+" - status: "+a.request.status)})},n.unload=function(a){var b=q[a];if(b){delete q[a];var c;for(k in b)if(b.hasOwnProperty(k)){c=b[k],Human.assets.geometries.destroyLibrary(c.geometryLibId);for(var d,e=0,f=c.objects.length;f>e;e++)d=c.objects[e],Human.scene._destroyObject(d)}}}}(),function(){"use strict";Human.scene.objectLoader={_countAnonObjects:0,_loaded:{}},Human.scene.objectLoader.load=function(a,b,c){if(!c)return this;for(var d,e,f,g=0,h=c.length;h>g;g++){d=c[g];var i={};if(f=null,e=d.objects)for(var j,k=0,l=e.length;l>k;k++)j=e[k],j.objectId?(this._attachObject(a,b,f,j),i[j.objectId]=!0):Human.log.error("Human.scene.objectLoader","Param expected on object: objectId")}this._loaded[b]={createObjects:c}},Human.scene.objectLoader._attachObject=function(a,b,c,d){d.objectId||(d.objectId="___"+this._countAnonObjects++,d.anonymous=!0),c=this._createObject(a,b,c,d);var e=d.objects;if(e)for(var f=0,g=e.length;g>f;f++)this._attachObject(a,b,c,e[f])},Human.scene.objectLoader._createObject=function(a,b,c,d){var e,f=d.objectId,g=b+"-"+f,h=d.fmaid||d.fmaId?b+"-"+(d.fmaid||d.fmaId):null,i=c?c.systemId:null;e=c?void 0!==d.layer&&null!==d.layer?c.layer+.001*d.layer:c.layer:d.layer||0;var j,k,l,m,n;if(d.assets)for(var o,p=0,q=d.assets.length;q>p;p++){o=d.assets[p];var r,s=b+"."+o;r=Human.assets.geometries.geometries[s],r?(l=r,r.materialId&&(r=Human.assets.materials.findMaterial(r.materialId),r&&(j=r))):(r=Human.assets.materials.materials[s],r?j=r:(r=Human.assets.morphs.morphs[s],r?(m=r,r.materialId&&(r=Human.assets.materials.findMaterial(r.materialId),r&&(j=r))):Human.log.error("Human.scene.objectLoader","Error in createObjects for '"+b+"' object '"+f+"': asset '"+o+"' not found")))}d.geometryId&&(l=Human.assets.geometries.geometries[d.geometryId],l||(l=Human.assets.geometries.geometries[b+"."+d.geometryId]),l||Human.log.error("Human.scene.objectLoader","Geometry asset not found: "+d.geometryId)),d.morphId&&(m=Human.assets.morphs.morphs[d.morphId],m||(m=Human.assets.morphs.morphs[b+"."+d.morphId]),m||Human.log.error("Human.scene.objectLoader","Morph asset not found: "+d.morphId)),d.materialId&&(j=Human.assets.materials.materials[d.materialId],j||(j=Human.assets.materials.materials[b+"."+d.materialId]),j||Human.log.error("Human.scene.objectLoader","Material asset not found: "+d.materialId)),d.transformId&&(n=Human.assets.transforms.transforms[d.transformId],n||(n=Human.assets.transforms.transforms[b+"."+d.transformId]),n||Human.log.error("Human.scene.objectLoader","Transform asset not found: "+d.transformId)),l||m||j||k||d.assets&&0!==d.assets.length||d.objects&&0!==d.objects.length||Human.log.warn("Human.scene.objectLoader","Scene object with neither assets nor child objects: "+f);var t=Human.scene.__createObject({moduleId:a,modelId:b,objectId:g,anonymous:!!d.anonymous,localObjectId:f,objectName:f,fmaId:h,systemId:i,displayName:d.displayName,description:d.description,parentObjectId:c?c.objectId:null,layer:e,shown:!0,material:j,geometry:l,morph:m,transform:n,translate:d.translate,scale:d.scale,rotate:d.rotate,pivot:d.pivot,flip:d.flip,desaturate:d.desaturate,glassFactor:d.glassFactor,tags:d.tags||[]});return t},Human.scene.objectLoader.unload=function(a){var b=this._loaded[a];if(b){var c=b.createObjects;delete this._loaded[a];for(var d,e,f,g,h=0,i=c.length;i>h;h++){d=c[h],e=d.objects;for(var j=0,k=e.length;k>j;j++)f=a+"-"+e[j].objectId,f&&(g=Human.scene.objects[f],g?Human.scene._destroyObject(g.objectId):Human.log.error("Human.scene.objectLoader.unload","Scene object not found: '"+f+"'"))}}}}(),function(){"use strict";function a(a){var b,c={},d=Human.scene.objectsByFMAID;for(var e in a)if(a.hasOwnProperty(e)){if(b=d[e],!b){Human.log.error("Object not found for FMA ID: '"+e+"'");continue}c[b.objectId]=a[e]}return c}Human.rpc.define("scene.queryBoundary",function(a){var b,c,d;if(a.objectId)b=Human.scene.getBoundary(a.objectId);else if(a.fmaId){if(d=a.fmaId,c=Human.scene.objectsByFMAID[d],!c)return void this.error("No scene object found for the given FMA ID: '"+d+"'");b=Human.scene.getBoundary(c.objectId)}else if(a.objectIds)b=Human.scene.getBoundary(a.objectIds);else if(a.fmaIds){for(var e=a.fmaIds,f=[],g=0,h=e.length;h>g;g++){if(d=e[g],c=Human.scene.objectsByFMAID[d],!c)return void this.error("No scene object found for the given FMA ID: '"+d+"'");f.push(c.objectId)}b=Human.scene.getBoundary(f)}else b=a.selectedObjects?Human.scene.getBoundary(Human.scene.selectedObjects):a.enabledObjects?Human.scene.getBoundary(Human.scene.enabledObjects):Human.scene.getBoundary();this.setResult(b)}),Human.rpc.define("scene.setTransparentObjects",function(b){var c;if(b.fmaIds)c=a(b.fmaIds);else if(Human._isArray(b.objectIds)){c={};for(var d=0,e=b.objectIds.length;e>d;d++)c[b.objectIds[d]]=!0}else c=b.objectIds;Human.scene.setTransparentObjects({objectIds:c,replace:b.replace})}),Human.rpc.define("scene.setEnabledObjects",function(b){var c;if(b.fmaIds)c=a(b.fmaIds);else if(Human._isArray(b.objectIds)){c={};for(var d=0,e=b.objectIds.length;e>d;d++)c[b.objectIds[d]]=!0}else c=b.objectIds;Human.scene.setEnabledObjects({objects:c,replace:b.replace})}),Human.rpc.define("scene.setSelectedObjects",function(b){var c;if(b.fmaIds)c=a(b.fmaIds);else if(Human._isArray(b.objectIds)){c={};for(var d=0,e=b.objectIds.length;e>d;d++)c[b.objectIds[d]]=!0}else c=b.objectIds;Human.scene.setSelectedObjects({objects:c,replace:b.replace})}),function(){function a(b,c){if(b){c.push({objectId:b.objectId,displayName:b.displayName,fmaId:b.fmaId,parentObjectId:b.parent?b.parent.objectId:null,shown:!!Human.scene.enabledObjects[b.objectId],selected:!!Human.scene.selectedObjects[b.objectId]});for(var d=0,e=b.objects.length;e>d;d++)a(b.objects[d],c)}}Human.rpc.define("scene.getObjects",function(b){var c,d=[];if(b.objectId){var e=b.objectId;c=Human.scene.objects[e],c&&d.push({objectId:e,displayName:c.displayName,fmaId:c.fmaId,parentObjectId:c.parent?c.parent.objectId:null,shown:!!Human.scene.enabledObjects[e],selected:!!Human.scene.selectedObjects[e]})}else for(var f=0,g=Human.scene.rootObjects.length;g>f;f++)a(Human.scene.rootObjects[f],d);this.setResult(d)})}(),Human.rpc.define("scene.showBoundary",function(a){var b;a.objectId?(b=Human.scene.getBoundary(a.objectId),b&&Human.view.boundary.setBoundary(b,!0)):Human.view.boundary.setBoundary(!1)}),Human.rpc.define("scene.setObjectTransform",function(a){var b,c=a.objectId,d=a.fmaId;if(c){if(b=Human.scene.objects[c],!b)return void this.error("Scene object not found: '"+c+"'")}else if(d&&(b=Human.scene.objectsByFMAID[d],!b))return void this.error("scene object not found for the given FMA ID: '"+d+"'");b.setTransform(a)}),function(){var a=document.getElementById("theCanvas"),b=function(b,c){c&&(b=Human.math.addVec3(b,c));var d=Human.renderer.getViewMat(),e=Human.renderer.getProjMat(),f=Human.math.transformPoint3(d,b);f[3]=1;var g=Human.math.transformPoint4(e,f),h=g[0],i=g[1],j=g[3];return[Math.round((1+h/j)*a.width/2),Math.round((1-i/j)*a.height/2)]};Human.rpc.define("scene.getCanvasPos",function(a){this.setResult(b(a.worldPos,a.offset))}),Human.rpc.define("scene.getObjectCanvasPos",function(a){var c=Human.scene.objects[a.objectId];if(c){var d=c.getCenter();this.setResult(b(d,a.offset))}})}()}(),function(){"use strict";function a(a){if(a.annotations)for(var b,c,d=a.annotations,e=0,f=d.length;f>e;e++)b="___"+a.chapterId+"."+e,c=Human.view.annotations.annotations[b],c&&c.destroy()}var b=Human.timeline={};b.animations={},b.timelineAnimations={},b.freeAnimations={},b._lastTime=null,b._lastActiveChapter=null,b._lastCameraChapter=null,b.chapterSets={},b.chapters={},b.FRAME_LENGTH=.033,b.chapterList=[],b.playQueue=[],b.showObjects={},b.playing=!1,b.paused=!1,b.time=0,b.direction=1,b.animationCtx={cameraEnabled:!0};var c=!0;Human.properties.subscribe({propId:"timeline.cameraAnimationEnabled",value:c,callback:function(a){c=!!a,b.animationCtx.cameraEnabled=c}}),b._time1=null,b._time2=null,b._scrubbing=!1,b._scrubCamera=!0,Human.events.on("tick",function(){if(b._updateFreeAnimations(),b._timeFrame||b.getTimeFrame(),b._scrubbing)b._updateTimelineAnimations(b._scrubCamera),b._scrubCamera=!0,b._scrubbing=!1,b._lastTime=null;else if(b.playing&&!b.paused){if(b._time1===b._time2)return;var a=(new Date).getTime();if(b._lastTime&&(b.time+=b.direction*((a-b._lastTime)/1e3)),b.direction>0&&b.time>b._time2||b.direction<0&&b.time<b._time2){if(!b._loop){var c=b._time1<b._time2?b._time1:b._time2,d=b._time1>b._time2?b._time1:b._time2;if(b.time=b.time<c?c:b.time>d?d:b.time,b.playQueue.length>0)b._play(b.playQueue.pop());else{var e=b._findChapter(b.time);e&&b._activateChapter(e),b._updateTimelineAnimations(),b.stop()}return}b.time=b._time1+b._fmod(b.time,b._time2-b._time1)}Human.events.fire("timeline.playing",{time:b.time}),b._updateTimelineAnimations(),b._lastTime=a}}),Human.events.on("snapshot.started",function(){b.pause()}),Human.events.on("snapshot.finished",function(){b.unpause()});var d=!0;Human.properties.subscribe({propId:"timeline.prevNextMode",value:d?"scrub":"play",callback:function(a){d="scrub"===a}}),b._fmod=function(a,b){if(b>a)return Human.log.error("Human.timeline._fmod","Attempting to find modulus within negative range - would be infinite loop - ignoring"),a;for(;a>=b;)a-=b;return a},b._updateTimelineAnimations=function(a){var c={cameraEnabled:a===!1?a:b.animationCtx.cameraEnabled};for(var d in b.timelineAnimations)b.timelineAnimations.hasOwnProperty(d)&&b.timelineAnimations[d].update(c,b.time);var e=b._findChapter(b.time);e&&b._activateChapter(e)},b._updateFreeAnimations=function(){var a=(new Date).getTime()/1e3;for(var c in b.freeAnimations)b.freeAnimations.hasOwnProperty(c)&&b.freeAnimations[c].update(b.animationCtx,a)},b.scrub=function(a){var c=function(c,d){b.time=c,b._scrubbing=!0,b.playing=!1,b._looping=!1,b._lastTime=null,b._nextChapter=null,b.playQueue=[],b._scrubParams=a,b._playParams=null,b._scrubCamera=d!==!1,Human.events.fire("timeline.scrubbed",{time:b.time})};b._timeFrame||b.getTimeFrame(),a=a||{};var d=a.time;if(void 0!==d&&null!==d)a.clamp&&(d<b._timeFrame.firstTime?d=b._timeFrame.firstTime:d>b._timeFrame.lastTime&&(d=b._timeFrame.lastTime)),c.call(this,d);else if(a.chapterId){var e=a.chapterId,f=b.chapters[e];if(!f)return void Human.log.error("Human.timeline.scrub","Chapter not found: '"+e+"'");f.flyTo?(Human.view.camera.fly.flyTo(f.flyTo),c.call(this,f.time,!0)):c.call(this,f.time)}else c.call(this,b._timeFrame.firstTime)},b._findChapter=function(a){for(var c,d=b.chapterList.length-1;d>=0;d--)if(c=b.chapterList[d],c.time<=a)return c},b._activateChapter=function(a){b._lastActiveChapter&&a.chapterId===b._lastActiveChapter.chapterId||(Human.events.fire("timeline.chapters.activating",{chapterId:a.chapterId}),a.showObjects?(b.showObjects=a.showObjects,Human.scene.setEnabledObjects({objects:a.showObjects,replace:!0})):(b.showObjects={},Human.scene.setEnabledObjects({replace:!0})),Human.scene.setSelectedObjects(a.selectObjects?{objects:a.selectObjects,replace:!0}:{replace:!0}),a.xray===!0?Human.rpc.call(null,"xray.setEnabled",{enable:!0}):Human.rpc.call(null,"highlight.setEnabled",{enable:!0}),a.screenPan&&Human.view.camera.setScreenPan(a.screenPan),b._activateAnnotations(a),b._lastCameraChapter&&a.chapterId===b._lastCameraChapter.chapterId||(c&&a.flyTo?b._lastCameraChapter=a:c&&a.jumpTo?b._lastCameraChapter=a:b.animationCtx.cameraEnabled=c),Human.events.fire("timeline.chapters.activated",{oldChapterIndex:b._lastActiveChapter?b._lastActiveChapter.index:null,newChapterIndex:a.index,time:b.time,loop:b._loop}),b._lastActiveChapter=a)},b._activateAnnotations=function(a){var c,d,e,f,g;if(b._lastLabelsChapter&&b._lastLabelsChapter.annotations&&b._lastLabelsChapter.chapterId!==a.chapterId)for(c=b._lastLabelsChapter.annotations,f=0,g=c.length;g>f;f++)d="___"+b._lastLabelsChapter.chapterId+"."+f,e=Human.view.annotations.annotations[d],e&&e.destroy();if(a.annotations&&(!b._lastLabelsChapter||b._lastLabelsChapter.chapterId!==a.chapterId))for(c=a.annotations,f=0,g=c.length;g>f;f++){d="___"+a.chapterId+"."+f;var h=Human.view.annotations.annotations[d];if(h)h.pin.setEnabled(!0);else{e=c[f];var i;if(!e.pos&&e.objectId){var j=Human.scene.objects[e.objectId];i=j.getCenter()}Human.view.annotations.createAnnotation({annotationId:d,objectId:e.objectId,title:e.title||"",description:e.description||"",pos:e.pos||i,dir:e.pinVec||e.dir,enabled:!0,shown:!0,labelShown:!0,saved:!0})}}b._lastLabelsChapter=a},b.play=function(a){a=a||{},a.queue&&b.playing?b.playQueue.unshift(a):(b.playQueue=[],b._play(a))},b._play=function(a){if(b._timeFrame||b.getTimeFrame(),!b.paused||(b.paused=!1,void 0!==a.startTime&&null!==a.startTime||a.startChapterId||void 0!==a.finishTime&&null!==a.finishTime||a.finishChapterId||a.numChapters)){var c,d,e,f=b._timeFrame.firstTime,g=b._timeFrame.lastTime;if(a.prevChapter){if(0===b.chapterList.length)return;e=0,b._lastActiveChapter&&(e=0===b._lastActiveChapter.index?b.chapterList.length-1:b._lastActiveChapter.index-1),d=b.chapterList[e],f=d.time,e<b.chapterList.length-1&&(g=b.chapterList[e+1].time),(d.flyTo||d.jumpTo||d.showObjects||d.selectObjects)&&b._activateChapter(d)}else if(a.nextChapter){if(0===b.chapterList.length)return;e=0,e=b._lastActiveChapter?b._lastActiveChapter.index+1>=b.chapterList.length?0:b._lastActiveChapter.index+1:0,d=b.chapterList[e],f=d.time,e<b.chapterList.length-1&&(g=b.chapterList[e+1].time),(d.flyTo||d.jumpTo||d.showObjects||d.selectObjects)&&b._activateChapter(d)}else if(void 0!==a.startTime&&null!==a.startTime){f=a.startTime<b._timeFrame.firstTime?b._timeFrame.firstTime:a.startTime>b._timeFrame.lastTime?b._timeFrame.lastTime:a.startTime;var h=b._findChapter(f);if(h){var i=b.chapterList[h.index+1];if(i){var j=Math.round(1e3*(i.time-f))/1e3;j<=b.FRAME_LENGTH&&(f=i.time)}}}else if(a.startChapterId){if(c=a.startChapterId,d=b.chapters[c],!d)return void Human.log.error("Human.timeline.play","Param 'startChapterId' does not match any chapters: '"+c+"'");f=d.time,(d.flyTo||d.jumpTo||d.showObjects||d.selectObjects)&&b._activateChapter(d)}else b._lastCameraChapter=null;if(void 0!==a.finishTime&&null!==a.finishTime)g=a.finishTime<b._timeFrame.firstTime?b._timeFrame.firstTime:a.finishTime>b._timeFrame.lastTime?b._timeFrame.lastTime:a.finishTime;else if(a.finishChapterId){if(c=a.finishChapterId,d=b.chapters[c],!d)return void Human.log.error("Human.timeline.play","Param 'finishChapterId' does not match any chapters: '"+c+"'");g=d.time-b.FRAME_LENGTH}else if(a.numChapters){for(var k,l=-1,m=b.chapterList.length-1;m>=0;m--)if(b.chapterList[m].time<=f){k=b.chapterList[m],l=m;break}var n=l+a.numChapters;n<b.chapterList.length?g=b.chapterList[n].time-b.FRAME_LENGTH:void 0===k.duration||null===k.duration?Human.log.error("Human.timeline.play","Last chapter in chapters sequence does not have a 'duration'"):g=k.time+k.duration}b.playing=!0,b._time1=f,b._time2=g,b.direction=b._time1<b._time2?1:-1,b._lastTime=null,b._loop=a.loop,b.time=void 0!==a.time&&null!==a.time?a.time:f,b._playParams=a,b._scrubParams=null,Human.events.fire("timeline.played",{time:b.time})}},b.prev=function(){if(b._lastActiveChapter&&0!==b._lastActiveChapter.index)if(d)b.scrub({chapterId:b.chapterList[b._lastActiveChapter.index-1].chapterId});else{var a=b.chapterList[b._lastActiveChapter.index],c=b._lastActiveChapter.index>0?b.chapterList[b._lastActiveChapter.index-1]:null;if(c&&c.loop)b.play({startTime:c.time,finishTime:a.time,loop:!0});else if(b.time-a.time>.1)b.play({startTime:b.time,finishTime:a.time,direction:-1});else{var e=b.chapterList[b._lastActiveChapter.index-1].chapterId,f=b.chapters[e];b.play({startTime:b.time,finishTime:f.time,direction:-1})}}},b.next=function(){if(!b._lastActiveChapter)return void b.scrub({time:0});if(!(b._lastActiveChapter.index+1>=b.chapterList.length)){var a=b.chapterList[b._lastActiveChapter.index+1].chapterId;if(d)b.scrub({chapterId:a});else{var c=b.chapters[a];c&&b.play(c.loop?{startTime:c.time,numChapters:1,loop:c.loop}:{startTime:b.time,finishTime:c.time})}}},b.mute=function(){},b.pause=function(){return b.playing?(b.paused=!0,Human.events.fire("timeline.paused",{time:b.time}),!0):void 0},b.unpause=function(){b.paused&&(b.paused=!1,b._lastTime=(new Date).getTime(),Human.events.fire("timeline.unpaused",{time:b.time}))},b.stop=function(){var a;for(var c in b.timelineAnimations)b.timelineAnimations.hasOwnProperty(c)&&(a=b.timelineAnimations[c],a.stop&&a.stop());b._scrubbing=!1,b.playing=!1,b._loop=!1,b._lastTime=null,b.playQueue=[],Human.events.fire("timeline.stopped",{time:b.time})},b.addAnimation=function(a,c){return c.update?(b.animations[a]&&b.removeAnimation(a),b.animations[a]=c,c.timeline===!1?b.freeAnimations[a]=c:(b.timelineAnimations[a]=c,b._timeFrame=null),void Human.events.fire("Timeline.Loaded")):void Human.log.error("Human.timeline.addAnimation","Param expected: update")},b.removeAnimation=function(a){var c=b.animations[a];return c?(delete b.animations[a],c.timeline===!1?(delete b.freeAnimations[a],b._timeFrame=null):delete b.timelineAnimations[a],c.destroy&&c.destroy(),void Human.events.fire("Timeline.Empty")):void Human.log.warn("Human.timeline.removeAnimation","Animation not found: "+a)},b.addChapterSet=function(a,c){for(var d,e,f,g=0,h=c.length;h>g;g++)if(e=c[g],d=e.chapterId)if(b.chapters[d])Human.log.error("Human.timeline.addChapterSet","Chapter '"+d+"' already defined");else if(e.displayName||(Human.log.warn("Human.timeline.addChapterSet","Chapter '"+d+"' attribute missing: 'displayName' - substituting empty string"),e.displayName=""),void 0!==e.time&&null!==e.time)if(b.chapters[d]=e,0===b.chapterList.length)b.chapterList.push(e),e.index=0;else{var i,j,k=!1;for(i=b.chapterList.length-1;i>=0;i--)if(f=b.chapterList[i],f.time<e.time){b.chapterList.splice(i+1,0,e),k=!0;break}for(k||b.chapterList.splice(0,0,e),i=0,j=b.chapterList.length;j>i;i++)b.chapterList[i].index=i}else Human.log.error("Human.timeline.addChapterSet","Chapter '"+d+"' attribute missing: 'time'");else Human.log.error("Human.timeline.addChapterSet","Chapter property missing: chapterId");b.chapterSets[a]=c,b._lastActiveChapter=null,b._lastCameraChapter=null,b._timeFrame=null,Human.events.fire("timeline.chapters.updated",b.chapterList)},b.destroyChapterSet=function(c){var d,e;if(c){var f=b.chapterSets[c];if(!f)return void Human.log.warn("Human.timeline.destroyChapterSet"," Chapter set not found: "+c);for(d=0,e=f.length;e>d;d++){var g=f[d].chapterId;delete b.chapters[g];for(var h,i=b.chapterList.length-1;i>=0;i--){if(h=b.chapterList[i],h.chapterId===g){b.chapterList.splice(i,1);break}h.annotations&&a(h)}}delete b.chapterSets[c]}else b.chapterSets={},b.chapters={},b.chapterList=[];for(d=0,e=b.chapterList.length;e>d;d++)b.chapterList[d].index=d;b._lastActiveChapter=null,b._lastCameraChapter=null,b._timeFrame=null,Human.events.fire("timeline.chapters.updated",b.chapterList)},b.getTimeFrame=function(){if(b._timeFrame)return b._timeFrame;var a,c=!1,d=0,e=0;for(var f in b.timelineAnimations)b.timelineAnimations.hasOwnProperty(f)&&(c=!0,a=b.timelineAnimations[f].getTimeFrame(),a.firstTime<d&&(d=a.firstTime),a.lastTime>e&&(e=a.lastTime));for(var g,h=0,i=b.chapterList.length;i>h;h++)g=b.chapterList[h],g.time<d&&(d=g.time),g.time>e&&(e=g.time),void 0!==g.duration&&null!==g.duration&&(g.duration<d&&(d=g.duration),g.duration>e&&(e=g.duration));return b._timeFrame={firstTime:d,lastTime:e},Human.events.fire("timeline.timeFrame.updated",b._timeFrame),b._timeFrame},b.getBookmark=function(){return b._scrubParams?{scrub:Human._shallowClone(b._scrubParams)}:b._playParams?{play:Human._apply(b._playParams,{time:b.time})}:b.time?{scrub:{time:b.time}}:{}},b.setBookmark=function(a){a.scrub?b.scrub(a.scrub):a.play&&b.play(a.play)},b.query=function(){for(var a,c=[],d=0,e=b.chapterList.length;e>d;d++)a=b.chapterList[d],c.push({chapterId:a.chapterId,type:a.type,displayName:a.displayName,description:a.description,tags:a.tags,annotations:a.annotations||null,hotspots:a.hotspots||null,flyTo:a.flyTo,active:a.active,time:a.time,sounds:a.sounds,translations:a.translations});return{chapters:c,time:b.time,timeFrame:b._timeFrame,playing:b.playing,paused:b.paused}}}(),function(){"use strict";Human.timeline.animationLoader=new Human.utils.Loader,Human.timeline.animationLoader.configure=function(a){return this._embedded=a.embedded,this},Human.timeline.animationLoader._animations={},Human.timeline.animationLoader._load=function(a,b,c,d,e,f){var g=c,h=b+"."+c,i=this;Human.net.getAnimationManifest(g,function(a){var c;if(!a.format)return c="'format' attribute expected in manifest for animation library '"+g+"'",Human.log.error("Human.timeline.animationLoader",c),void f(c);var j;switch(a.format){case"binary":j=Human.assets.morphs.loader;break;case"tween":j=Human.timeline.Tween.loader;break;default:return c="Unsupported value '"+a.format+"' for 'format' in manifest for animation library '"+g+"' - supported values are 'binary' and 'tween'",Human.log.error("Human.timeline.animationLoader",c),void f(c)}j.load(b,g,h,a,d,function(){i._animations[h]={loader:j},e()},f)},function(a){var b="Failed to load animation library '"+g+"': "+a;Human.log.error("Human.timeline.animationLoader",b),f(b)})},Human.timeline.animationLoader._unload=function(a){var b=this._animations[a];b&&(b.loader.unload(a),delete this._animations[a])}}(),function(){"use strict";Human.timeline.chapterLoader=new Human.utils.Loader,Human.timeline.chapterLoader._load=function(a,b,c,d,e,f){var g=c,h=b+"."+g,i=this;Human.net.getChapterSetManifest(g,function(a){i._preprocessManifest(b,h,a),Human._isArray(a.chapters)&&Human.timeline.addChapterSet(h,a.chapters),e()},function(a){f("failed to load chapters module '"+g+"': "+a.errorText+" - status: "+a.request.status)})},Human.timeline.chapterLoader._preprocessManifest=function(a,b,c){var d,e,f,g=c.chapters;if(Human._isArray(g))for(e=0,f=g.length;f>e;e++)d=g[e],d.chapterId=b+e,this._preprocessChapter(a,d);else{e=0;for(var h in g)g.hasOwnProperty(h)&&(d=g[h],d.chapterId=b+e++,this._preprocessChapter(a,d))}},Human.timeline.chapterLoader._preprocessChapter=function(a,b){var c,d,e=b.sounds;if(e)for(c=0,d=e.length;d>c;c++){var f=e[c];f.soundId=a+"."+f.soundId}var g,h,i=b.showObjects;if(i)for(h in i)i.hasOwnProperty(h)&&h.indexOf("-")<0&&(g=a+"-"+h,i[g]=i[h],delete i[h]);var j=b.selectObjects;if(j)for(h in j)j.hasOwnProperty(h)&&h.indexOf("-")<0&&(g=a+"-"+h,j[g]=j[h],delete j[h]);var k=b.annotations;if(k){var l;for(c=0,d=k.length;d>c;c++)l=k[c],l.objectId&&l.objectId.indexOf("-")<0&&(l.objectId=a+"-"+l.objectId)}return{sounds:e,i:c,len:d,sound:f}},Human.timeline.chapterLoader._unload=function(a){Human.timeline.destroyChapterSet(a)}}(),function(){"use strict";Human.timeline.Tween=function(a,b){if(!b.tweens)throw"Human.timeline.Tween config missing: tweens";this.name=b.displayName,this.options=b.options||{},this.tweens=[],this._onComplete=b.onComplete,this.timeline=b.timeline;var c,d=b.tweens||{};for(var e in d)if(d.hasOwnProperty(e)){c=d[e],c.options=Human._applyIf(this.options,c.options||{}),c.modelId=a.modelId;var f=Human.timeline.Tween.tweenFactory.createTween(c);f&&this.tweens.push(f)}},Human.timeline.Tween.prototype.getTimeFrame=function(){if(this._timeFrame)return this._timeFrame;for(var a,b=1e6,c=-1e6,d=this.tweens,e=0,f=d.length;f>e;e++)a=d[e],a.firstTime<b&&(b=a.firstTime),a.lastTime>c&&(c=a.lastTime);return this._timeFrame={firstTime:b,lastTime:c},this._timeFrame},Human.timeline.Tween.prototype.update=function(a,b){for(var c=0,d=this.tweens.length;d>c;c++)this.tweens[c].update(a,b)},Human.timeline.Tween.prototype.stop=function(){for(var a,b=0,c=this.tweens.length;c>b;b++)a=this.tweens[b],a.stop&&a.stop()},Human.timeline.Tween.prototype.destroy=function(){for(var a,b=0,c=this.tweens.length;c>b;b++)a=this.tweens[b],a.destroy&&a.destroy()}}(),function(){"use strict";var a=Human.timeline.Tween.loader={};a.load=function(a,b,c,d,e,f,g){try{Human.timeline.addAnimation(c,new Human.timeline.Tween({modelId:a},d)),f()}catch(h){g(h)}},a.unload=function(a){Human.timeline.removeAnimation(a)}}(),function(){"use strict";var a=Human.timeline.Tween.tweenFactory={},b={};a.createTweenType=function(a,c){b[a]=c},a.createTween=function(a){var c=a.type;if(!c)throw"'type' expected";var d=c.split(":"),e=d[0],f=d[1];if(!e||!f)return Human.log.error("Human.timeline.Tween.tweenFactory.createTween","Tween 'type' attribute should be of form <tween type>:<target type>"),null;var g=b[e];return g?new g(a):(Human.log.error("Human.timeline.Tween.tweenFactory.createTween","Tween type not supported: '"+e+"'"),null)}}(),function(){"use strict";var a=Human.timeline.Tween.manipulatorFactory={},b={};a.createManipulatorType=function(a,c){b[a]=c},a.getManipulator=function(a){if(!a.type)throw"param expected: 'type'";var c,d=b[a.type];if(!d)throw"type not supported: '"+a.type+"'";try{c=new d(a)}catch(e){throw e}return c},a.putManipulator=function(a){a.destroy&&a.destroy()}}(),function(){"use strict";function a(a,b){this.attr=a||{},this.options=b||{},this.keys=[],this.attrTargetLists={},this._key1=0,this._key2=1,this._loop=!!b.loop,this._timeOffset=b.timeOffset||0,this.addTarget=function(a,b){a+=this._timeOffset;var c;if(0===this.keys.length)for(c in this.attr)if(this.attr.hasOwnProperty(c)&&!b.hasOwnProperty(c))throw"Attribute expected on first target: '"+c+"'";this.keys.push(a);var d;for(c in this.attr)if(this.attr.hasOwnProperty(c)){if(d=this.attrTargetLists[c],!d){if(this.keys.length>1)throw"First target in tween must contain a value for each animated attribute on target";d=this.attrTargetLists[c]=[]}var e=b[c];d.push(void 0!==e&&null!==e?e:d.length>0?d[d.length-1]:this.attr[c])}(void 0===this._firstKey||null===a._firstKey||this._firstKey>a)&&(this._firstKey=a,this._keyDiff=this._lastKey-this._firstKey),(void 0===this._lastKey||null===a._lastKey||this._lastKey<a)&&(this._lastKey=a,this._keyDiff=this._lastKey-this._firstKey)},this.update=function(a,b){this._loop&&(b=this._firstKey+b%this._keyDiff);var c=this._findEnclosingFrame(b);if(!this._loop)switch(c){case this.STATE_BEFORE:return this._clampToFrame(0),!0;case this.STATE_AFTER:return this._clampToFrame(this.keys.length-1),!0}var d,e,f,g,h,i,j=!1;for(var k in this.attr)this.attr.hasOwnProperty(k)&&(d=this.attrTargetLists[k],e=this.keys[this._key2]-this.keys[this._key1],f=b-this.keys[this._key1],g=d[this._key2]-d[this._key1],h=f/e*g,i=d[this._key1]+h,this.attr[k]!==i&&(this.attr[k]=i,j=!0));return j},this._clampToFrame=function(a){for(var b in this.attr)this.attr.hasOwnProperty(b)&&(this.attr[b]=this.attrTargetLists[b][a])},this._findEnclosingFrame=function(a){if(a<this.keys[0])return this._key1=0,this._key2=1,this.STATE_BEFORE;if(a>this.keys[this.keys.length-1])return this._key1=this.keys.length-2,this._key2=this._key1+1,this.STATE_AFTER;for(;this.keys[this._key1]>a;)this._key1--,this._key2--;
  for(;this.keys[this._key2]<a;)this._key1++,this._key2++;return this.STATE_RUNNING}}Human.timeline.Tween.tweenFactory.createTweenType("lerp",function(b){if(!b.type)throw"'type' expected";if(!b.keys)throw"'keys' expected";if(!b.targets)throw"'targets' expected";if(b.keys.length<2||b.targets.length<2)throw"tween '"+b.name+"' has insufficient keys or targets - minimum of two required";if(b.keys.length!==b.targets.length)throw"tween '"+b.name+"' has mismatching numbers of keys and targets";this.keys=b.keys,this.targets=b.targets,this.firstTime=b.keys[0],this.lastTime=b.keys[b.keys.length-1],this._manipulator=Human.timeline.Tween.manipulatorFactory.getManipulator(b),this.name=b.name,this.type=b.type,this.tweenMap={},this.tweenList=[];for(var c,d,e,f,g=0,h=this.targets.length;h>g;g++){c=this.targets[g],d=this.keys[g];var i=c;for(var j in i)if(i.hasOwnProperty(j)){if(e=i[j],f=this.tweenMap[j],!f){var k=this._manipulator.attr[j];f=new a(k,b.options),this.tweenMap[j]=f,this.tweenList.push(f)}f.addTarget(d,e)}}this.update=function(a,b){(void 0===b||null===b)&&(b=this.firstTime);for(var c=0,d=0,e=this.tweenList.length;e>d;d++)this.tweenList[d].update(a,b)&&c++;c>0&&this._manipulator.update(a)},this.stop=function(){this._manipulator.stop&&this._manipulator.stop()},this.destroy=function(){Human.timeline.Tween.manipulatorFactory.putManipulator(this._manipulator)}}),a.prototype.STATE_OUTSIDE=0,a.prototype.STATE_BEFORE=1,a.prototype.STATE_AFTER=2,a.prototype.STATE_RUNNING=3}(),function(){"use strict";var a=1,b=2,c=3,d=4;Human.timeline.Tween.tweenFactory.createTweenType("switch",function(e){if(!e.type)throw"'type' expected";if(!e.keys)throw"'keys' expected";if(!e.targets)throw"'targets' expected";if(e.keys.length<2||e.targets.length<2)return void Human.log.warn("Human.timeline.Tween","tween '"+e.name+"' has insufficient keys or targets - minimum of two required");if(e.keys.length!==e.targets.length)return void Human.log.warn("Human.timeline.Tween","tween '"+e.name+"' has mismatching numbers of keys and targets");if(e.options&&e.options.timeOffset)for(var f=e.options.timeOffset,g=this.keys=e.keys.slice(0),h=0,i=g.length;i>h;h++)g[h]+=f;else this.keys=e.keys;this.targets=e.targets,this.firstTime=e.keys[0],this.lastTime=e.keys[e.keys.length-1],this._manipulator=Human.timeline.Tween.manipulatorFactory.getManipulator(e),this.type=e.type,this._options=e.options||{},this._key=0,this._lastKey=null,this.update=function(d,e){(void 0===e||null===e)&&(e=this.firstTime);var f=this._findTarget(e);switch(f){case a:return this._options.wait?!1:!0;case b:break;case c:}return this._lastKey!==this._key&&(this._manipulator.attr=this.targets[this._key],this._manipulator.update(d),this._lastKey=this._key),!0},this._findTarget=function(e){if(e<this.keys[0])return this._key=0,a;if(e===this.keys[0])return this._key=0,b;if(e>this.keys[this.keys.length-1])return this._key=this.keys.length-1,c;for(;this.keys[this._key]>e;)this._key--;for(;void 0!==this.keys[this._key+1]&&null!==this.keys[this._key+1]&&this.keys[this._key+1]<e;)this._key++;return d},this.stop=function(){this._manipulator.stop&&this._manipulator.stop()},this.destroy=function(){Human.timeline.Tween.manipulatorFactory.putManipulator(this._manipulator)}})}(),function(){"use strict";Human.timeline.Tween.manipulatorFactory.createManipulatorType("lerp:camera",function(a){var b=a.initial||{};this.attr={up:Human._applyIf2(b.up,{x:0,y:1,z:0}),eye:Human._applyIf2(b.eye,{x:0,y:0,z:0}),look:Human._applyIf2(b.look,{x:0,y:0,z:0})},this.update=function(a){a.cameraEnabled!==!1&&Human.view.camera.setLookAt(this.attr)}})}(),Human.timeline.Tween.manipulatorFactory.createManipulatorType("lerp:material",function(a){"use strict";if(!a.modelId)throw"attribute expected: 'modelId'";var b=a.targetId||a.materialId;return b?(this.materialId=a.modelId+"."+b,this.attr={baseColor:{r:0,g:0,b:0,a:0},specularColor:{r:1,g:1,b:1}},void(this.update=function(){if(this.materialId){var a=Human.assets.materials.materials[this.materialId];return a||this._targetMissing?void(a.material&&a.material.set(this.attr)):(Human.log.error("Human.timeline.Tween","'material' tween can't find material: "+this.materialId),void(this._targetMissing=!0))}})):void Human.log.error("Human.timeline.Tween","'material' tween attribute expected: 'materialId'")}),function(){"use strict";function a(b,c){if(void 0!==c.opacity&&null!==c.opacity&&b.setOpacity(c.opacity),b.objects.length>0)for(var d=b.objects,e=0,f=d.length;f>e;e++)a(d[e],c)}Human.timeline.Tween.manipulatorFactory.createManipulatorType("lerp:objectAttr",function(b){if(!b.modelId)throw"attribute expected: 'modelId'";if(!b.objectId)throw"attribute expected: 'objectId'";var c=b.initial||{};this.attr={attr:{opacity:void 0!==c.opacity&&null!==c.opacity?c.opacity:.2}};var d=b.objectId;d.indexOf(".")<0&&(d=b.modelId+"-"+b.objectId),this.update=function(){var b=Human.scene.objects[d];if(!b)return void Human.log.warn("Human.timeline.Tween","'lerp:objectAttr' tween can't find object: "+d);var c=Human.timeline.showObjects[d];if(void 0===c||null===c||c===!0){var e=this.attr.attr;void 0!==e.opacity&&null!==e.opacity&&a(b,e)}}})}(),Human.timeline.Tween.manipulatorFactory.createManipulatorType("lerp:objectXForm",function(a){"use strict";if(!a.modelId)throw"attribute expected: 'modelId'";if(!a.objectId)throw"attribute expected: 'objectId'";var b=a.initial||{};this.attr={translate:Human._applyIf2(b.translate,{x:0,y:0,z:0}),rotate:Human._applyIf2(b.rotate,{x:0,y:0,z:0}),scale:Human._applyIf2(b.scale,{x:1,y:1,z:1}),pivot:Human._applyIf2(b.pivot,{x:0,y:0,z:0})};var c=a.objectId;c.indexOf(".")<0&&(c=a.modelId+"-"+a.objectId),this.update=function(){var a=Human.scene.objects[c];if(!a)return void Human.log.warn("Human.timeline.Tween","'lerp:objectXForm' tween can't find object: "+c);var b=Human.timeline.showObjects[c];(void 0===b||null===b||b===!0)&&a.setTransform(this.attr)}}),Human.timeline.Tween.manipulatorFactory.createManipulatorType("lerp:texture",function(a){"use strict";if(!a.modelId)throw"attribute expected: 'modelId'";var b=a.targetId||a.materialId;return b?(this.materialId=a.modelId+"."+b,void 0===a.targetLayer||null===a.targetLayer?void Human.log.error("Human.timeline.Tween","'texture' tween attribute expected: 'targetLayer'"):(this.targetLayer=a.targetLayer,this.attr={rotate:{z:0},translate:{x:0,y:0},scale:{x:1,y:1},blend:{factor:1}},void(this.update=function(){if(this.materialId&&void 0!==this.targetLayer&&null!==this.targetLayer){var a=Human.assets.materials.materials[this.materialId];if(!a)return void(this._targetMissing||(Human.log.error("Human.timeline.Tween","'material' tween can't find material: "+this.materialId),this._targetMissing=!0));var b=a.texture;if(b){var c={};c[""+this.targetLayer]={scale:this.attr.scale,translate:this.attr.translate,rotate:this.attr.rotate,blendFactor:this.attr.blend.factor},b.setLayers(c)}}}))):void Human.log.error("Human.timeline.Tween","'texture' tween attribute expected: 'materialId'")}),Human.timeline.Tween.manipulatorFactory.createManipulatorType("lerp:transform",function(a){"use strict";if(!a.modelId)throw"attribute expected: 'modelId'";var b=a.transformId;if(!b)return void Human.log.error("Human.timeline.Tween","'transform' tween attribute expected: 'transformId'");this.transformId=a.modelId+"."+b;var c=a.initial||{};this.attr={translate:Human._applyIf2(c.translate,{x:0,y:0,z:0}),rotate:Human._applyIf2(c.rotate,{x:0,y:0,z:0}),scale:Human._applyIf2(c.scale,{x:1,y:1,z:1}),pivot:Human._applyIf2(c.pivot,{x:0,y:0,z:0})},this.update=function(){if(this.transformId){var a=Human.assets.transforms.transforms[this.transformId];return a?void a.set(this.attr):void(this._targetMissing||(Human.log.error("Human.timeline.Tween","'lerp:transform' tween can't find transform: "+b),this._targetMissing=!0))}}}),function(){"use strict";function a(b,c){if(void 0!==c.pickable&&null!==c.pickable&&b.setPickable(c.pickable),void 0!==c.shown&&null!==c.shown&&b.show(c.shown),void 0!==c.transparent&&null!==c.transparent&&b.setTransparent(c.transparent),b.objects.length>0)for(var d=b.objects,e=0,f=d.length;f>e;e++)a(d[e],c)}Human.timeline.Tween.manipulatorFactory.createManipulatorType("switch:objectAttr",function(b){if(!b.modelId)throw"attribute expected: 'modelId'";if(!b.objectId)throw"attribute expected: 'objectId'";var c=b.initial||{};this.attr={attr:{pickable:void 0!==c.pickable&&null!==c.pickable?c.pickable:!0,shown:void 0!==c.shown&&null!==c.shown?c.shown:!0,transparent:void 0!==c.transparent&&null!==c.transparent?c.transparent:!0}};var d=b.objectId;d.indexOf(".")<0&&(d=b.modelId+"-"+b.objectId),this.update=function(){var b=Human.scene.objects[d];if(!b)return void Human.log.warn("Human.timeline.Tween","'switch:objectAttr' tween can't find object: "+d);var c=Human.timeline.showObjects[d];if(void 0===c||null===c||c===!0){var e=this.attr.attr;(void 0!==e.pickable&&null!==e.pickable||void 0!==e.shown&&null!==e.shown||void 0!==e.transparent&&null!==e.transparent)&&a(b,e)}}})}(),function(){"use strict";function a(){j=[],k=[],l=0}function b(a){0===j.length&&(l=0),k.push(a.time),j.push(a)}function c(a){l=a,e()}function d(){return k.length>0?k[k.length-1]:0}function e(){if(0!==j.length){if(l<=k[0])return void Human.view.camera.setLookAt(j[0]);if(l>=d()||1===j.length)return void Human.view.camera.setLookAt(j[j.length-1]);for(var a=0;k[a]<l;)++a;f(l,a-1)}}function f(a,b){var c=k[b],d=k[b+1],e=j[b],f=j[b+1];Human.view.camera.setLookAt({eye:g(a,c,d,e.eye,f.eye),look:g(a,c,d,e.look,f.look),up:g(a,c,d,e.up,f.up)})}function g(a,b,c,d,e){var f=(a-b)/(c-b),g=1-f;return{x:d.x*g+e.x*f,y:d.y*g+e.y*f,z:d.z*g+e.z*f}}var h=Human.timeline.chapterCameras={};h.pathMode=!1;var i=[],j=[],k=[],l=0,m=!0;Human.properties.subscribe({propId:"timeline.chapterCamerasEnabled",value:m,callback:function(a){m=!!a}}),Human.events.on("timeline.chapters.updated",function(c){a();for(var d,e,f=0,g=c.length;g>f;f++)d=c[f],e=d.flyTo||d.jumpTo,e&&(e.time=d.time,b(e));i=c}),Human.events.on("timeline.playing",function(a){m&&h.pathMode&&c(a.time)}),Human.events.on("timeline.scrubbed",function(a){m&&h.pathMode&&c(a.time)}),Human.events.on("timeline.chapters.activated",function(a){if(m&&!h.pathMode){var b=i[a.newChapterIndex];b&&(b.flyTo?Human.view.camera.fly.flyTo(b.flyTo):b.jumpTo&&Human.view.camera.fly.jumpTo(b.jumpTo))}})}(),function(){"use strict";function a(a){$(document).bind(a,i[a]=function(){e=!1,b()})}function b(){c&&(clearTimeout(c),c=null),d&&(c=setTimeout(function(){if(d&&!Human.timeline.playing&&!e){e=!0;var a=h[g]||h.play;a()}},1e3*f))}var c=null,d=!1,e=!1;Human.properties.subscribe({propId:"timeline.autoPlay.enabled",value:d,callback:function(a){d=!!a,d?b():e=!1}});var f=10;Human.properties.subscribe({propId:"timeline.autoPlay.timeoutSecs",value:f,callback:function(a){f=a}});var g="play",h={play:function(){Human.timeline.play({startTime:Human.timeline.time})},"chapter-rotate":function(){var a=5e3,b=function(){if(e)var b=Human.view.camera.eye.x,d=0,f=20,g=setInterval(function(){e||clearInterval(g),Human.view.camera.rotateY(.5);var h=Math.abs(b-Human.view.camera.eye.x);(.005>=h&&d>5*f||d>40*f)&&(clearInterval(g),setTimeout(c,a)),d++},f)},c=function(){e&&(Human.timeline.time===Human.timeline.getTimeFrame().lastTime?(Human.timeline.scrub({time:0}),setTimeout(b,a)):Human.timeline.next(),Human.events.once("timeline.stopped",function(){setTimeout(b,a)}))};c()}};Human.properties.subscribe({propId:"timeline.autoPlay.type",value:g,callback:function(a){g=a}}),Human.events.on("started",function(){b()}),Human.events.on("timeline.stopped",function(){b()});var i={};a("mousedown"),a("keydown"),a("mousewheel")}(),function(){"use strict";Human.rpc.define("timeline.query",function(){this.setResult(Human.timeline.query())}),Human.rpc.define("timeline.scrub",function(a){Human.timeline.scrub(a)}),Human.rpc.define("timeline.play",function(a){Human.timeline.play(a)}),Human.rpc.define("timeline.stop",function(){Human.timeline.stop()}),Human.rpc.define("timeline.prev",function(){Human.timeline.prev()}),Human.rpc.define("timeline.next",function(){Human.timeline.next()}),Human.rpc.define("timeline.pause",function(){Human.timeline.pause()}),Human.rpc.define("timeline.unpause",function(){Human.timeline.unpause()}),Human.rpc.define("timeline.getBookmark",function(){this.setResult(Human.timeline.getBookmark())}),Human.rpc.define("timeline.setBookmark",function(a){Human.timeline.setBookmark(a)})}(),Human.assets=Human.assets||{},function(){"use strict";var a=Human.assets.geometries={};a.geometries={},a.libraries={};var b;Human.events.on("loaded",function(){b=Human.renderer.getNode("assetLibraryRoot").addNode({type:"library",data:"Geometry library"})}),a.createLibrary=function(c){return a.libraries[c]?void Human.log.error("Human.assets.geometries.createLibrary","Geometry library already loaded: "+c):void(a.libraries[c]={node:b.addNode({type:"library",data:"libraryId = "+c}),libraryId:c,geometries:{}})},a.createGeometry=function(b,c,d){var e=a.libraries[b];if(!e)return void Human.log.error("Human.assets.geometries.createGeometry","Geometry library not found: "+b);if(a.geometries[c])return void Human.log.error("Human.assets.geometries.createGeometry","Geometry already loaded: "+c);if(!d.geometry)return void Human.log.error("Human.assets.geometries.createGeometry","Mandatory attribute 'geometryId' expected on geometry: "+c);d.geometry.type="geometry";var f={geometry:e.node.addNode(d.geometry),type:"geometry"};if(d.boundary){var g=d.boundary;f.boundary=g,f.center=[.5*(g.xmax+g.xmin),.5*(g.ymax+g.ymin),.5*(g.zmax+g.zmin)],f.axisBoundary=new Human.math.AxisBox3([g.xmin,g.ymin,g.zmin],[g.xmax,g.ymax,g.zmax])}a.geometries[c]=f,e.geometries[c]=f},a.destroyLibrary=function(b){if(b){var c=a.libraries[b];if(!c)return void Human.log.warn("Human.assets.geometries.destroyLibrary","Geometry library not found: "+b);c.node.destroy();for(var d in c.geometries)c.geometries.hasOwnProperty(d)&&delete a.geometries[d];delete a.libraries[b]}else a.reset()},a.reset=function(){for(var b in a.libraries)a.libraries.hasOwnProperty(b)&&a.destroyLibrary(b)}}(),function(){"use strict";function a(a){var b,c,d={numGeos:0,numArrays:0,positions:!1,indices:!1,uv:!1,normals:!1};for(var e in a)a.hasOwnProperty(e)&&a[e]&&(d.numGeos++,b=a[e],b.geometry&&(c=b.geometry,c.positions&&!d.positions&&(d.positions=!0,d.numArrays++),c.indices&&!d.indices&&(d.indices=!0,d.numArrays++),c.normals&&!d.normals&&(d.normals=!0,d.numArrays++),c.uv&&!d.uv&&(d.uv=!0,d.numArrays++),c.tangents&&(d.tangents=c.tangents)));return d}function b(a,b,c,d){function e(){g||c(h)}function f(a){g||(g=!0,d(a))}var g=!1,h={},i=b.numArrays,j=0;b.positions&&Human.net.getGeometryPositions(a,function(a){h.positions=a,++j===i&&e()},f),b.normals&&Human.net.getGeometryNormals(a,function(a){h.normals=a,++j===i&&e()},f),b.uv&&Human.net.getGeometryUVs(a,function(a){h.uv=a,++j===i&&e()},f),b.indices&&Human.net.getGeometryIndices(a,function(a){h.indices=a,++j===i&&e()},f)}function c(a,b,c){c=c||0;var d=b[0]-c,e=d+b[1]-c;return a.subarray?a.subarray(d,e):a.slice(d,e)}function d(a){for(var b,c,d,e=1e5,f=1e5,g=1e5,h=-1e5,i=-1e5,j=-1e5,k=0,l=a.length-2;l>k;k+=3)b=a[k],c=a[k+1],d=a[k+2],void 0!==b&&null!==b&&void 0!==c&&null!==c&&void 0!==d&&null!==d&&(e>b&&(e=b),f>c&&(f=c),g>d&&(g=d),b>h&&(h=b),c>i&&(i=c),d>j&&(j=d));return{xmin:e,ymin:f,zmin:g,xmax:h,ymax:i,zmax:j}}var e=window.HumanGeometryLoaderBinary={};e.load=function(e,f,g,h,i){var j=a(g.geo);b(e,j,function(a){var b,e,i,k,l;Human.assets.geometries.createLibrary(f);for(var m in g.geo)g.geo.hasOwnProperty(m)&&(b=g.geo[m],e=b.geometry,i=f+"."+m,k=j.positions?c(a.positions,e.positions):null,l=j.indices?c(a.indices,e.indices):null,Human.assets.geometries.createGeometry(f,i,{materialId:b.materialId,geometry:{primitive:"triangles",positions:j.positions?k:null,normals:j.normals?c(a.normals,e.normals):null,uv:j.uv?c(a.uv,e.uv):null,indices:l,tangents:j.tangents},boundary:j.positions?d(k):null}));h()},i)}}(),function(){"use strict";function a(a,d,e,f,g){function h(){l||(k++,k>=j&&f())}Human.assets.geometries.createLibrary(d);var i=e.meshes;if(!i)return void g("Geometry manifest 'meshes' property expected");var j,k=0;j="number"==typeof i.length?i.length:b(i);var l=!1,m=g;if(g=function(a){l||(l=!0,m&&m(a))},Human._isArray(i))for(var n=0;j>n;n++)c(d,a,i[n],h,g)}function b(a){var b=0;for(var c in a)a.hasOwnProperty(c)&&a[c]&&b++;return b}function c(a,b,c,e,f){var g,h="string"!=typeof c;if(h){if(!c.geo)return void f("failed to load 'geo' file for geometry module '"+b+"' a mesh is missing a 'geo' element");g=c.geo}else g=c;Human.net.getGeometryMesh(b,g,function(b){var c=a+"."+g;b.boundary=d(b.positions),Human.assets.geometries.createGeometry(a,c,{materialId:b.materialId,geometry:b}),e()},function(a){f("failed to load 'geo' file for geometry module '"+b+"' mesh '"+g+"': "+a.errorText+" - status: "+a.request.status)})}function d(a){for(var b,c,d,e=1e5,f=1e5,g=1e5,h=-1e5,i=-1e5,j=-1e5,k=0,l=a.length-2;l>k;k+=3)b=a[k],c=a[k+1],d=a[k+2],void 0!==b&&null!==b&&void 0!==c&&null!==c&&void 0!==d&&null!==d&&(e>b&&(e=b),f>c&&(f=c),g>d&&(g=d),b>h&&(h=b),c>i&&(i=c),d>j&&(j=d));return{xmin:e,ymin:f,zmin:g,xmax:h,ymax:i,zmax:j}}var e=window.HumanGeometryLoaderJSON={};e.load=function(b,c,d,e,f){a(b,c,d,e,function(){var a=!1;return function(b){a||(a=!0,f(b))}})}}(),function(){"use strict";Human.assets.geometries.loader=new Human.utils.Loader,Human.assets.geometries.loader.configure=function(a){return this._embedded=a.embedded,this},Human.assets.geometries.loader._load=function(a,b,c,d,e,f){var g=c,h=b+"."+c;Human.net.getGeometryManifest(g,function(a){if(!a.format)return void f("'format' expected in manifest for geometry module '"+g+"'");switch(a.format){case"json":HumanGeometryLoaderJSON.load(g,h,a,e,f);break;case"binary":HumanGeometryLoaderBinary.load(g,h,a,e,f);break;default:var b="Human.assets.geometries.loader - Unsupported value '"+a.format+"' for 'format' in manifest for geometry module '"+g+"' - supported values are 'json', 'binary' and 'tween'";Human.log.error(b),f(b)}},function(a){f("failed to load 'manifest' file for geometry module '"+g+"': "+a)})},Human.assets.geometries.loader._unload=function(a){Human.assets.geometries.destroyLibrary(a)}}(),function(){"use strict";var a=Human.assets.materials={};a.materials={},a.libraries={};var b;Human.events.on("loaded",function(){b=Human.renderer.getNode("assetLibraryRoot").addNode({type:"library",data:"Materials library"})}),a.findMaterial=function(b){var c;for(var d in a.libraries)if(a.libraries.hasOwnProperty(d)&&(c=a.materials[d+"."+b]))return c;return null},a.createLibrary=function(c){return a.libraries[c]?void Human.log.warn("Human.assets.materials.createLibrary","Material library already loaded: "+c):void(a.libraries[c]={node:b.addNode({type:"library",data:"libraryId = "+c}),libraryId:c,materials:{}})},a.createMaterial=function(b,c,d){var e=a.libraries[b];if(!e)return void Human.log.error("Human.assets.materials.createMaterial","Material library not found: "+b);if(a.materials[c])return void Human.log.warn("Human.assets.materials.createMaterial","Material already loaded: "+c);var f={};d.material?(f.material=e.node.addNode(d.material),f.glassFactor=void 0!==d.material.glassFactor&&null!==d.material.glassFactor?d.material.glassFactor:1,f.murkiness=void 0!==d.material.murkiness&&null!==d.material.murkiness?d.material.murkiness:1):(f.glassFactor=1,f.murkiness=1),d.reflection&&(f.reflection=e.node.addNode({type:"reflect",coreId:d.reflection.getCoreId()})),d.texture&&(d.texture.type="_texture",f.texture=e.node.addNode(d.texture)),d.flags&&(f.flags=e.node.addNode(d.flags)),a.materials[c]=f,e.materials[c]=f},a.destroyLibrary=function(b){if(b){var c=a.libraries[b];if(!c)return void Human.log.warn("Human.assets.materials.destroyLibrary","Material library not found: "+b);c.node.destroy();for(var d in c.materials)c.materials.hasOwnProperty(d)&&delete a.materials[d];delete a.libraries[b]}else a.reset()},a.reset=function(){for(var b in a.libraries)a.libraries.hasOwnProperty(b)&&a.destroyLibrary(b)}}(),function(){"use strict";Human.assets.materials.loader=new Human.utils.Loader,Human.assets.materials.loader.configure=function(a){return this._embedded=a.embedded,this},Human.assets.materials.loader._load=function(a,b,c,d,e,f){var g=c,h=b+"."+c,i=this;if(d&&d.manifest){var j=i._parseManifest(b,d.manifest,Human.net.getMaterialDir(g),null,null);Human.assets.materials.createLibrary(h);for(var k in j)j.hasOwnProperty(k)&&Human.assets.materials.createMaterial(h,h+"."+k,j[k]);e()}else Human.net.getMaterialLibrary(g,function(a){var c=i._parseManifest(b,a,Human.net.getMaterialDir(g),null,null);Human.assets.materials.createLibrary(h);for(var d in c)c.hasOwnProperty(d)&&Human.assets.materials.createMaterial(h,h+"."+d,c[d]);e()},function(a){f("failed to load manifest file for material module '"+g+"': "+a)})},Human.assets.materials.loader._parseManifest=function(a,b,c,d,e){d=d||{};var f,g;switch(b.id&&(e={},d[b.id]=e,b.id=null),b.type){case"texture":var h;for(f=0,g=b.layers.length;g>f;f++)h=b.layers[f],h.uri=h.uri||h.src,h.uri?this._embedded?h.uri+="?v="+Human.VERSION:h.uri=c+h.uri.substring(h.uri.lastIndexOf("/")+1)+"?v="+Human.VERSION:(h.uri=".",Human.log.error("Human.assets.materials.loader._parseManifest","Texture layer with no 'uri' or 'src' property")),h.blendMode=h.blendMode||"add";e&&(e.texture=b);break;case"material":if(e&&(e.material=b,b.reflectionId)){var i=b.reflectionId,j=Human.assets.reflections.findReflection(i);j?e.reflection=j.reflection:Human.log.error("Human.assets.materials.loader._parseManifest","Reflection not found: "+i)}break;case"flags":e&&(e.flags=b)}if(b.nodes)for(f=0,g=b.nodes.length;g>f;f++)this._parseManifest(a,b.nodes[f],c,d,e);return d},Human.assets.materials.loader._unload=function(a){Human.assets.materials.destroyLibrary(a)}}(),function(){"use strict";var a=Human.assets.transforms={};a.transforms={},a.libraries={},a.findTransform=function(b){var c;for(var d in a.libraries)if(a.libraries.hasOwnProperty(d)&&(c=a.transforms[d+"."+b]))return c;return null},a.createLibrary=function(b){return a.libraries[b]?void Human.log.warn("Human.assets.transforms.createLibrary","Transform library already loaded: "+b):void(a.libraries[b]={libraryId:b,transforms:{}})},a.createTransform=function(b,c,d){var e=a.libraries[b];if(!e)return void Human.log.error("Human.assets.transforms.createTransform","Transform library not found: "+b+", wont create transform");if(a.transforms[c])return void Human.log.warn("Human.assets.transforms.createTransform","Transform already loaded, not reloading: "+c);var f=new Human.assets.transforms.Transform(d);a.transforms[c]=f,e.transforms[c]=f},a.destroyLibrary=function(b){if(b){var c=a.libraries[b];if(!c)return void Human.log.warn("Human.assets.transforms.destroyLibrary","Transform library not found: "+b);for(var d in c.transforms)c.transforms.hasOwnProperty(d)&&delete a.transforms[d];delete a.libraries[b]}else a.reset()},a.reset=function(){for(var b in a.libraries)a.libraries.hasOwnProperty(b)&&a.destroyLibrary(b)}}(),function(){"use strict";Human.assets.transforms.Transform=function(a){this._init(),this.pivot={x:0,y:0,z:0},this.translate={x:0,y:0,z:0},this.scale={x:1,y:1,z:1},this.rotate={x:0,y:0,z:0},this.set(a)},Human.utils.extend(Human.assets.transforms.Transform,Human.Component),Human.assets.transforms.Transform.prototype.set=function(a){a.pivot&&(void 0!==a.pivot.x&&null!==a.pivot.x&&(this.pivot.x=a.pivot.x),void 0!==a.pivot.y&&null!==a.pivot.y&&(this.pivot.y=a.pivot.y),void 0!==a.pivot.z&&null!==a.pivot.z&&(this.pivot.z=a.pivot.z)),a.translate&&(void 0!==a.translate.x&&null!==a.translate.x&&(this.translate.x=a.translate.x),void 0!==a.translate.y&&null!==a.translate.y&&(this.translate.y=a.translate.y),void 0!==a.translate.z&&null!==a.translate.z&&(this.translate.z=a.translate.z)),a.scale&&(void 0!==a.scale.x&&null!==a.scale.x&&(this.scale.x=a.scale.x),void 0!==a.scale.y&&null!==a.scale.y&&(this.scale.y=a.scale.y),void 0!==a.scale.z&&null!==a.scale.z&&(this.scale.z=a.scale.z)),a.rotate&&(void 0!==a.rotate.x&&null!==a.rotate.x&&(this.rotate.x=a.rotate.x),void 0!==a.rotate.y&&null!==a.rotate.y&&(this.rotate.y=a.rotate.y),void 0!==a.rotate.z&&null!==a.rotate.z&&(this.rotate.z=a.rotate.z)),this.publish("updated")}}(),function(){"use strict";Human.assets.transforms.loader=new Human.utils.Loader,Human.assets.transforms.loader._load=function(a,b,c,d,e,f){var g=c,h=b+"."+c;Human.net.getTransformsLibrary(g,function(a){var b=a.transforms;if(!b)return void f("failed to load manifest file for transform module '"+g+"': 'transforms' element missing in manifest");Human.assets.transforms.createLibrary(h);for(var c in b)b.hasOwnProperty(c)&&Human.assets.transforms.createTransform(h,h+"."+c,b[c]);e()},function(a){f("failed to load manifest file for transform module '"+g+"': "+a)})},Human.assets.transforms.loader._unload=function(a){Human.assets.transforms.destroyLibrary(a)}}(),Human.media=Human.media||{},Human.media.Clips=function(a){"use strict";var b=this;this._streamType=a,this.clips={},this.clipsList=[],this.libraries={},this.suggestedClips=[],Human.events.fire(this._streamType+".clips",b.clipsList,!0),Human.events.fire(this._streamType+".suggestedClips",b.suggestedClips,!0);var c=function(a){var c,d,e=a.time,f=!1;b.suggestedClips.length=0;for(var g=0,h=b.clipsList.length;h>g;g++)d=b.clipsList[g],c=void 0!==d.time1&&null!==d.time1&&void 0!==d.time2&&null!==d.time2&&d.time1<=e&&e<=d.time2,f=f||c!==d.suggested,d.suggested=c,c&&b.suggestedClips.push(d.clipId);f&&Human.events.fire(b._streamType+".suggestedClips",b.suggestedClips,!0)};Human.events.on("timeline.scrubbed",c),Human.events.on("timeline.played",c),Human.events.on("timeline.stopped",c);var d=0;Human.events.on("timeline.playing",function(a){d%30===0&&(c(a),d=0),d+=1}),this.createLibrary=function(a,b){if(this.libraries[a])return void Human.log.warn("Human.media."+this._streamType+".createLibrary","Library already loaded: "+a);for(var c,d,e=this.libraries[a]={libraryId:a,clips:{}},f=0,g=b.length;g>f;f++)c=b[f],c.clipId?c.displayName?c.type?c.src?((void 0===c.time1||null===c.time1)&&(Human.log.error("Human.media."+this._streamType+".createLibrary","Clip property missing: time1 - defaulting to 0 seconds"),c.time1=0),(void 0===c.time2||null===c.time2)&&(Human.log.error("Human.media."+this._streamType+".createLibrary","Clip property missing: time2 - defaulting to 0 seconds"),c.time2=0),this.clips[c.clipId]&&Human.log.error("Human.media."+this._streamType+".createLibrary","Clip 'clipId' clashes with another clip: '"+c.clipId+"' - replacing existing clip"),d={clipId:c.clipId,displayName:c.displayName,description:c.description||"",time1:c.time1,time2:c.time2,type:c.type||"",src:c.src,alternatives:c.alternatives||[],length:c.length||0,suggested:!1,status:"closed"},e.clips[c.clipId]=d,this.clips[c.clipId]=d):Human.log.error("Human.media."+this._streamType+".createLibrary","Clip property missing: src"):Human.log.error("Human.media."+this._streamType+".createLibrary","Clip property missing: type"):Human.log.error("Human.media."+this._streamType+".createLibrary","Clip property missing: displayName"):Human.log.error("Human.media."+this._streamType+".createLibrary","Clip property missing: clipId");this._rebuildClipList()},this._rebuildClipList=function(){this.clipsList=[];for(var a in this.clips)this.clips.hasOwnProperty(a)&&this._insertClipIntoList(this.clipsList,this.clips[a]);Human.events.fire(this._streamType+".clips",this.clipsList,!0)},this._insertClipIntoList=function(a,b){if(0===a.length)a.push(b);else{for(var c,d=a.length-1;d>=0;d--)if(c=a[d],c.time1<b.time1)return void a.splice(d+1,0,b);a.splice(0,0,b)}},this.destroyLibrary=function(a){var b=this.libraries[a];if(!b)return void Human.log.warn("Human.media."+this._streamType+".destroyLibrary","Library not found: "+a);for(var c in b.clips)b.clips.hasOwnProperty(c)&&(delete this.clips[c],Human.events.fire(this._streamType+".status",{clipId:c,status:"destroyed"}));delete this.libraries[a],this._rebuildClipList()},this.open=function(a,b){Human.events.fire(this._streamType+".status",{clipId:a,status:"open"},!0),b()},this.play=function(a){Human.events.fire(this._streamType+".status",{clipId:a,status:"playing"},!0)},this.scrub=function(a,b){Human.events.fire(this._streamType+".scrubbed",{clipId:a,time:b})},this.pause=function(a){Human.events.fire(this._streamType+".status",{clipId:a,status:"paused"},!0)},this.stop=function(a){Human.events.fire(this._streamType+".status",{clipId:a,status:"stopped"},!0)},this.close=function(a){Human.events.fire(this._streamType+".status",{clipId:a,status:"closed"},!0)},this.reset=function(){for(var a in this.libraries)this.libraries.hasOwnProperty(a)&&this.destroyLibrary(a)}},Human.media.audio=new Human.media.Clips("audio"),function(){"use strict";Human.media.audio.loader=new Human.utils.Loader,Human.media.audio.loader._load=function(a,b,c,d,e,f){var g=c,h=b+"."+c,i=this;Human.net.getAudioLibrary(g,function(a){return i._preprocessManifest(g,a,Human.net.getAudioDir(g))?(Human.media.audio.createLibrary(h,a),void e()):void e()},function(a){f("failed to load manifest file for audio library '"+g+"': "+a)})},Human.media.audio.loader._preprocessManifest=function(){return!0},Human.media.audio.loader._unload=function(a){Human.media.audio.destroyLibrary(a)}}(),function(){"use strict";Human.rpc.define("audio.getClips",function(){this.setResult(Human.media.audio.clipsList)}),Human.rpc.define("audio.open",function(a){var b=this;Human.media.audio.open(a.clipId,function(){b.setResult(!0)})}),Human.rpc.define("audio.play",function(a){Human.media.audio.play(a.clipId)}),Human.rpc.define("audio.scrub",function(a){Human.media.audio.scrub(a.clipId,a.time)}),Human.rpc.define("audio.pause",function(a){Human.media.audio.pause(a.clipId)}),Human.rpc.define("audio.stop",function(a){Human.media.audio.stop(a.clipId)}),Human.rpc.define("audio.close",function(a){Human.media.videos.close(a.clipId)})}(),Human.media.videos=new Human.media.Clips("videos"),function(){"use strict";Human.media.videos.loader=new Human.utils.Loader,Human.media.videos.loader._load=function(a,b,c,d,e,f){var g=c,h=b+"."+c;Human.net.getVideosLibrary(g,function(a){Human.media.videos.createLibrary(h,a),e()},function(a){f("failed to load manifest file for video library '"+g+"': "+a)})},Human.media.videos.loader._unload=function(a){Human.media.videos.destroyLibrary(a)}}(),function(){"use strict";Human.rpc.define("videos.getClips",function(){this.setResult(Human.media.videos.clipsList)}),Human.rpc.define("videos.open",function(a){var b=this;Human.media.videos.open(a.clipId,function(){b.setResult(!0)})}),Human.rpc.define("videos.play",function(a){Human.media.videos.play(a.clipId)}),Human.rpc.define("videos.scrub",function(a){Human.media.videos.scrub(a.clipId,a.time)}),Human.rpc.define("videos.pause",function(a){Human.media.videos.pause(a.clipId)}),Human.rpc.define("videos.stop",function(a){Human.media.videos.stop(a.clipId)}),Human.rpc.define("videos.close",function(a){Human.media.videos.close(a.clipId)})}(),function(){"use strict";var a=Human.assets.morphs={};a.morphs={},a.libraries={};var b;Human.events.on("loaded",function(){b=Human.renderer.getNode("assetLibraryRoot").addNode({type:"library",data:"Morphs library"})}),a.findMorph=function(b){var c;for(var d in a.libraries)if(a.libraries.hasOwnProperty(d)&&(c=a.morphs[d+"."+b]))return c;return null},a.createLibrary=function(c){return a.libraries[c]?void Human.log.warn("Human.assets.morphs","Morph library already loaded: "+c):(a.libraries[c]={node:b.addNode({type:"library",data:"libraryId = "+c}),libraryId:c,morphs:{}},a.libraries[c])},a.createMorph=function(b,c,d){var e=a.libraries[b];if(!e)return void Human.log.error("morph library not found: "+b);var f=a.morphs[c];if(f)return Human.log.warn("Human.assets.morphs.createMorph","Morph already loaded: "+c),f;var g=d.boundary;return f={boundary:g,center:[.5*(g.xmax+g.xmin),.5*(g.ymax+g.ymin),.5*(g.zmax+g.zmin)],axisBoundary:new Human.math.AxisBox3([g.xmin,g.ymin,g.zmin],[g.xmax,g.ymax,g.zmax])},d.morphGeometry&&(d.morphGeometry.type="morphGeometry",f.morphGeometry=e.node.addNode(d.morphGeometry)),a.morphs[c]=f,e.morphs[c]=f,f
  },a.destroyLibrary=function(b){if(b){var c=a.libraries[b];if(!c)return void Human.log.warn("Human.assets.morphs.destroyLibrary","Morph library not found: "+b);c.node.destroy();for(var d in c.morphs)c.morphs.hasOwnProperty(d)&&delete a.morphs[d];delete a.libraries[b]}else a.reset()},a.reset=function(){for(var b in a.libraries)a.libraries.hasOwnProperty(b)&&a.destroyLibrary(b)}}(),function(){"use strict";Human.assets.morphs.Animation=function(a){this.type="morph-animation",this._loop=a.loop!==!1,this._morphList=[],this.timeline=a.timeline},Human.assets.morphs.Animation.prototype.addMorph=function(a,b,c){this._morphList.push({firstTime:a,lastTime:b,update:c}),this._timeFrame=null},Human.assets.morphs.Animation.prototype.getTimeFrame=function(){if(this._timeFrame)return this._timeFrame;for(var a,b=1e6,c=-1e6,d=this._morphList,e=0,f=this._morphList.length;f>e;e++)a=d[e],a.firstTime<b&&(b=a.firstTime),a.lastTime>c&&(c=a.lastTime);return this._timeFrame={firstTime:b,lastTime:c},this._timeFrame},Human.assets.morphs.Animation.prototype.update=function(a,b){for(var c,d,e=0,f=this._morphList.length;f>e;e++)c=this._morphList[e],this._loop?d=b===c.lastTime?b:c.firstTime+b%(c.lastTime-c.firstTime):(d<c.firstTime&&(d=c.firstTime),d>c.lastTime&&(d=c.lastTime)),c.update(d)},Human.assets.morphs.Animation.prototype.destroy=function(){this.destroyed=!0}}(),function(){"use strict";function a(a){var b,c,d={numMorphs:0,numArrays:0,positions:!1,uv:!1,normals:!1};for(var e in a)a.hasOwnProperty(e)&&a[e]&&(d.numMorphs++,b=a[e],b.targets&&(c=b.targets,c.positions&&!d.positions&&(d.positions=!0,d.numArrays++),c.normals&&!d.normals&&(d.normals=!0,d.numArrays++),c.uv&&d.uv&&(d.uv=!0,d.numArrays++)));return d}function b(a,b,c,d){function e(){g||c(h)}function f(a){g||(g=!0,d(a))}var g=!1,h={},i=b.numArrays,j=0;b.positions&&Human.net.getMorphPositions(a,function(a){h.positions=a,++j===i&&e()},f),b.normals&&Human.net.getMorphNormals(a,function(a){h.normals=a,++j===i&&e()},f),b.uv&&Human.net.getMorphUVs(a,function(a){h.uv=a,++j===i&&e()},f)}function c(a,b){var c=b[0],d=c+b[1];return a.subarray?a.subarray(c,d):a.slice(c,d)}function d(a,b){b||(b={xmin:1e5,ymin:1e5,zmin:1e5,xmax:-1e5,ymax:-1e5,zmax:-1e5});for(var c,d,e,f=0,g=a.length-2;g>f;f+=3)c=a[f],d=a[f+1],e=a[f+2],void 0!==c&&null!==c&&void 0!==d&&null!==d&&void 0!==e&&null!==e&&(c<b.xmin&&(b.xmin=c),d<b.ymin&&(b.ymin=d),e<b.zmin&&(b.zmin=e),c>b.xmax&&(b.xmax=c),d>b.ymax&&(b.ymax=d),e>b.zmax&&(b.zmax=e));return b}function e(a,b,c){var d=b.morphGeometry;a.addMorph(c[0],c[c.length-1],function(a){d.setFactor(a)})}var f=Human.assets.morphs.loader={};f.load=function(f,g,h,i,j,k,l){var m=a(i.morphs);b(g,m,function(a){Human.assets.morphs.createLibrary(h),j.timeline=void 0!==j.timeline&&null!==j.timeline?j.timeline:i.timeline;var b,f,g,l,m,n,o,p,q=new Human.assets.morphs.Animation(j);for(var r in i.morphs)if(i.morphs.hasOwnProperty(r)){f=i.morphs[r],b=h+"."+r,g=f.targets,l=f.keys.length,m=g.positions[1]/l,n=g.normals[1]/l;var s=f.keys,t=[];o=g.positions[0],p=g.normals[0];for(var u=0,v=null;l>u;u++){var w=new Float32Array(c(a.positions,[o,m]));t.push({positions:w,normals:new Float32Array(c(a.normals,[p,n]))}),v=d(w,v),o+=m,p+=n}var x=Human.assets.morphs.createMorph(h,b,{morphGeometry:{targets:t,keys:s},boundary:v});e(q,x,s)}Human.timeline.addAnimation(h,q),k()},l)},f.unload=function(a){Human.assets.morphs.destroyLibrary(a),Human.timeline.removeAnimation(a)}}(),function(){"use strict";var a=Human.assets.reflections={};a.reflections={},a.libraries={},a.active={};var b;Human.events.on("loaded",function(){b=Human.renderer.getNode("assetLibraryRoot").addNode({type:"library",data:"Reflections library"})}),a.activateReflections=function(b){a.active=b||{}},a.findReflection=function(b){var c=a.active[b];return c?a.reflections[c]:null},a.createLibrary=function(c){return a.libraries[c]?void Human.log.warn("Human.assets.reflections.createLibrary","Reflection library already loaded: "+c):void(a.libraries[c]={node:b.addNode({type:"library",data:"libraryId = "+c}),libraryId:c,reflections:{}})},a.createReflection=function(b,c,d){var e=a.libraries[b];if(!e)return void Human.log.error("Human.assets.reflections.createReflection","Reflection library not found: "+b);if(a.reflections[c])return void Human.log.warn("Human.assets.reflections.createReflection","Reflection already loaded: "+c);d.type="reflect",d.blendMode=d.blendMode||"add";var f={reflection:e.node.addNode(d)};a.reflections[c]=f,e.reflections[c]=f},a.destroyLibrary=function(b){if(b){var c=a.libraries[b];if(!c)return void Human.log.warn("Human.assets.reflections.destroyLibrary","Reflection library not found: "+b);c.node.destroy();for(var d in c.reflections)c.reflections.hasOwnProperty(d)&&delete a.reflections[d];delete a.libraries[b]}else a.reset()},a.reset=function(){for(var b in a.libraries)a.libraries.hasOwnProperty(b)&&a.destroyLibrary(b)}}(),function(){"use strict";Human.assets.reflections.loader=new Human.utils.Loader,Human.assets.reflections.loader._load=function(a,b,c,d,e,f){var g=c,h=b+"."+c;Human.net.getReflectionsLibrary(g,function(a){Human.assets.reflections.createLibrary(h);var b,c,d=Human.net.getReflectionsDir(g);for(var f in a)if(a.hasOwnProperty(f)){if(b=a[f],c=b.src,!c){Human.log.error("Human.assets.reflections.loader","Reflection property missing: src");continue}if(!Human._isArray(c)){Human.log.error("Human.assets.reflections.loader","Reflection property should be array: src");continue}for(var i=0,j=c.length;j>i;i++){var k=c[i];c[i]=d+k.substring(k.lastIndexOf("/")+1)+"?v="+Human.VERSION}Human.assets.reflections.createReflection(h,h+"."+f,b)}Human.renderer.forceRenderFrame(),e()},function(a){f("failed to load manifest file for reflections library '"+g+"': "+a)})},Human.assets.reflections.loader._unload=function(a){Human.assets.reflections.destroyLibrary(a)}}(),function(){"use strict";function a(a,b){var c=Human.net.mode;Human.net.setMode("file"),Human.net.openModel(a,null,function(){Human.net.getStateIndex(function(a){function d(){0===--i&&(Human.net.setMode(c),b())}var e=a.data||{},f=e.material||e.materials,h=[],i=0;for(var j in f)f.hasOwnProperty(j)&&(h.push(g(j,d)),i++);if(0===i)return Human.net.setMode(c),void b();for(;h.length;)h.pop()()},function(a){Human.net.setMode(c),Human.log.error("Human.models.loadModel","Texture images preload failed: "+a),b()})},function(a){Human.net.setMode(c),Human.log.error("Human.models.loadModel","Texture images preload failed: "+a),b()})}function b(a,b){Human.net.getMaterialLibrary(a,function(d){var e=Human.net.getMaterialDir(a);c(d,e),b()})}function c(a,b){var d,e;switch(a.type){case"texture":var f,g;for(d=0,e=a.layers.length;e>d;d++)if(f=a.layers[d],g=f.uri||f.src){var h;h=i._embedded?g+"?v="+Human.VERSION:b+g.substring(g.lastIndexOf("/")+1)+"?v="+Human.VERSION;var j=new Image;j.src=h}}if(a.nodes)for(d=0,e=a.nodes.length;e>d;d++)c(a.nodes[d],b)}function d(a,b,c,d){var g=c.data||{};Human.view.dissect.reset();var h=[];g.reflections&&e(a,b,h,g.reflections,Human.assets.reflections.loader),(g.material||g.materials)&&e(a,b,h,g.material||g.materials,Human.assets.materials.loader),g.transforms&&e(a,b,h,g.transforms,Human.assets.transforms.loader),g.sounds&&e(a,b,h,g.sounds,Human.media.audio.loader),g.videos&&e(a,b,h,g.sounds,Human.media.videos.loader),g.geometries&&e(a,b,h,g.geometries,Human.assets.geometries.loader),g.animations&&e(a,b,h,g.animations,Human.timeline.animationLoader),g.chapters&&e(a,b,h,g.chapters,Human.timeline.chapterLoader),g.anatomies&&e(a,b,h,g.anatomies,Human.scene.loader),g.lights&&e(a,b,h,g.lights,Human.view.lights.loader),g.videos&&e(a,b,h,g.videos,Human.media.videos.loader),g.audio&&e(a,b,h,g.audio,Human.media.audio.loader),f(h,function(){Human.scene.objectLoader.load(a,b,g.createObjects),b&&i.models.push({modelId:b}),d()})}function e(a,b,c,d,e){for(var f in d)d.hasOwnProperty(f)&&c.unshift(h(f,a,b,c,d,e))}function f(a,b){return 0===a.length?void b():void a.pop()(function(){f(a,b)})}function g(a,c){var d=a;return function(){b(d,c)}}function h(a,b,c,d,e,f){var g=a,h=e[a];return function(a){try{f.load(b,c,g,h,function(){a()},function(b){Human.log.error("Human.models.loadModel","Failed to load model '"+c+"' library '"+g+"': "+b),a()})}catch(d){Human.log.error("Human.models.loadModel","Failed to load model '"+c+"' library '"+g+"': "+d),a()}}}var i=Human.models={};i.models=[],i.loadModel=function(b,c,e){var f=b.moduleId;if(!f)return void e("[Human.models.loadModel] Param missing: 'moduleId'");var g=b.modelId;return g?(Human.renderer.pushPause(),void a(g,function(){Human.net.openModel(g,b.streamObjects,function(){Human.net.getStateIndex(function(a){d(f,g,a,function(){Human.renderer.popPause(),Human.renderer.onTasksComplete(function(){c()})})},function(a){Human.renderer.popPause(),e("[Human.models.loadModel] Failed to load index for model '"+g+"': "+a)})},function(a){Human.renderer.popPause(),e("[Human.models.loadModel] Failed to open source stream/directory for model '"+g+"': "+a)})})):void e("[Human.models.loadModel] Param missing: 'modelId'")},i.unloadAllModels=function(){for(;i.models.length;)i.unloadModel(i.models.pop().modelId)},i.unloadModel=function(a){for(var b,c=0,d=i.models.length;d>c;c++)if(b=i.models[c],b.modelId===a)return Human.assets.materials.loader.unload(a),Human.assets.geometries.loader.unload(a),Human.assets.transforms.loader.unload(a),Human.assets.reflections.loader.unload(a),Human.timeline.animationLoader.unload(a),Human.timeline.chapterLoader.unload(a),Human.scene.loader.unload(a),Human.scene.objectLoader.unload(a),Human.view.lights.loader.unload(a),Human.media.videos.loader.unload(a),Human.media.audio.loader.unload(a),i.models.splice(c,1),void Human.renderer.forceRenderFrame()}}(),function(){"use strict";function a(a,b){return a?a[b]===!0?!0:a[b]===!1?!1:!1:!0}function b(){var a=Human.modules.db.moduleLibs,b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(c);return b}function c(){var a=[];if(Human.modules.numActiveModules>0){var b=Human.modules.activeModules;for(var c in b)b.hasOwnProperty(c)&&a.push(c)}return a}function d(){return Human.view.camera.getLookAt()}function e(){return{dissect:Human.view.dissect.getEnabled(),highlight:Human.view.highlight.getEnabled(),isolate:Human.view.isolate.getEnabled(),labels:Human.view.labels.getEnabled(),xray:Human.view.xray.getEnabled(),singlePick:Human.view.pick.getSinglePickEnabled(),multiPick:Human.view.pick.getMultiPickEnabled()}}function f(){var a,b=Human.view.clip.clips,c={};for(var d in b)b.hasOwnProperty(d)&&(a=b[d],c[d]={clipId:a.clipId,type:a.type,progress:a.progress,state:a.state});return c}function g(){var a,b={},c=Human.scene,d=c.objects,e=c.enabledObjects,f=c.selectedObjects;for(var g in d)d.hasOwnProperty(g)&&(a=d[g],0===a.objects.length&&(b[g]={enabled:!!e[g],selected:!!f[g]}));return b}function h(){var a,b,c=[],d=Human.view.annotations.annotations;for(var e in d)d.hasOwnProperty(e)&&(a=d[e],a.saved&&(b={annotationId:e,title:a.label.title,description:a.label.description,pos:a.pin.pos,pinVec:a.pin.dir,shown:a.pin.shown,labelShown:a.label.shown},a.object&&(b.objectId=a.object.objectId),c.push(b)));return c}function i(a){var b;if(a.params||a.states){var c,d=[],e=!1,f=!1;if(a.params&&(c=a.params.stateId,"maleAdult"===c?(c="production/maleAdult/maleAdult.json",e=!0):"femaleAdult"===c&&(c="production/femaleAdult/femaleAdult.json",f=!0),d.push(c),b=!0),a.states){for(var g=0,h=a.states.length;h>g;g++)c=a.states[g].stateId,"maleAdult"===c?(c="production/maleAdult/maleAdult.json",e=!0):"femaleAdult"===c?(c="production/femaleAdult/femaleAdult.json",f=!0):e?c="production/maleAdult/"+c+".json":f&&(c="production/femaleAdult/"+c+".json"),d.push(c);b=!0}a.modules={moduleLibs:["anatomies.json","production.json"],activeModules:d}}return b}function j(a){for(var b={},c=0,d=a.length;d>c;c++)b[a[c]]=!0;for(var e in Human.modules.activeModules)Human.modules.activeModules.hasOwnProperty(e)&&(b[e]||Human.modules.deactivateModules({moduleId:e}))}function k(a){for(var b,c=[],d=0,e=a.length;e>d;d++)b=a[d],Human.modules.activeModules[b]||c.push(b);return c}function l(a,b){Human.modules.db.loadModuleLibs(a,b)}function m(a,b){if(a.length>0){var c=a.shift();Human.modules.activeModules[c]?m(a,b):Human.modules.activateModules({moduleId:c},function(){m(a,b)})}else b()}function n(a,b){a.annotations&&v(a.annotations,a.is_owner),a.clips&&q(a.clips),a.objects&&r(a.objects,b),a.modes&&p(a.modes),a.camera&&o(a.camera),a.timeline?Human.timeline.setBookmark(a.timeline):Human.timeline.stop()}function o(a){a=a||{},Human.view.camera.fly.jumpTo({up:Human._apply(a.up,{x:0,y:1,z:0}),eye:Human._apply(a.eye,{x:0,y:0,z:-100}),look:Human._apply(a.look,{x:0,y:0,z:0})})}function p(a){void 0!==a.dissect&&null!==a.dissect,void 0!==a.highlight&&null!==a.highlight&&Human.rpc.call(null,"highlight.setEnabled",{enable:a.highlight}),Human.scene.anySelected()&&a.isolate?void 0!==a.isolate&&null!==a.isolate&&Human.rpc.call(null,"isolate.setEnabled",{enable:a.isolate}):void 0!==a.isolate&&null!==a.isolate&&Human.rpc.call(null,"isolate.setEnabled",{enable:!1}),void 0!==a.labels&&null!==a.labels&&Human.rpc.call(null,"labels.setEnabled",{enable:a.labels}),void 0!==a.singlePick&&null!==a.singlePick&&Human.rpc.call(null,"pick.single.setEnabled",{enable:a.singlePick}),void 0!==a.multiPick&&null!==a.multiPick&&Human.rpc.call(null,"pick.multi.setEnabled",{enable:a.multiPick}),void 0!==a.xray&&null!==a.xray&&Human.rpc.call(null,"xray.setEnabled",{enable:a.xray})}function q(a){Human.view.clip.reset();for(var b in a)a.hasOwnProperty(b)&&Human.view.clip.setClip(a[b])}function r(a,b){s(a,b),t(a,b)}function s(a,b){Human.scene.setEnabledObjects({objectIds:u(a,"enabled"),replace:!b})}function t(a,b){Human.scene.setSelectedObjects({objectIds:u(a,"selected"),replace:!b})}function u(a,b){var c,d={};a=a||{};var e;for(var f in a)if(a.hasOwnProperty(f)){if(e=Human.scene.objects[f],!e)continue;c=a[f][b],(c===!0||c===!1)&&(d[f]=c)}return d}function v(a,b){var c;b="undefined"==typeof b?!1:b;for(var d=0,e=a.length;e>d;d++)c=a[d],Human.view.annotations.createAnnotation({annotationId:c.annotationId,objectId:c.objectId,title:c.title||"",description:c.description||"",pos:c.offset||c.pos,dir:c.pinVec,shown:c.shown,type:c.type,labelShown:c.labelShown,saved:!0,isOwner:b})}var w=Human.bookmarks={};w.capture=function(i){var j={};return a(i,"modules")&&(j.modules={moduleLibs:b(),activeModules:c()}),a(i,"camera")&&(j.camera=d()),a(i,"modes")&&(j.modes=e()),a(i,"clips")&&(j.clips=f()),a(i,"objects")&&(j.objects=g()),a(i,"annotations")&&(j.annotations=h()),a(i,"timeline")&&(j.timeline=Human.timeline.getBookmark()),j},w.restore=function(a,b,c){b=b||function(){},Human.events.fire("bookmarks.restoring");var d;if(c||(d=i(a)),a.modules){var e=a.modules.activeModules;e&&(j(e),e=k(e)),Human.view.annotations.clearAnnotations(),Human.rpc.call(null,"highlight.setEnabled",{enable:!0}),Human.rpc.call(null,"pick.single.setEnabled",{enable:!0}),Human.view.camera.fly.jumpTo({up:{x:0,y:1,z:0},eye:{x:0,y:0,z:-100},look:{x:0,y:0,z:0}});var f=a.modules.moduleLibs||[];l(f.slice(0),function(){e?m(e.slice(0),function(){n(a,d),Human.events.fire("bookmarks.restored",a),b()}):(n(a,d),Human.events.fire("bookmarks.restored",a),b())})}else n(a,d),Human.events.fire("bookmarks.restored",a),b()}}(),function(){"use strict";var a=Human.bookmarks.db={},b={enterprise:{catalog:{path:"/ws/user/bookmark/enterprise"},bookmarks:{path:"/ws/user/bookmark/enterprise"}},featured:{catalog:{path:"/ws/user/bookmark/public",data:{featured:1}},bookmarks:{path:"/ws/user/bookmark/public",data:{featured:1}}},"private":{catalog:{path:"/ws/user/bookmark/private"},bookmarks:{path:"/ws/user/bookmark/private"}},"public":{catalog:{path:"/ws/user/bookmark/public"},bookmarks:{path:"/ws/user/bookmark/public"}},static_conditions:{catalog:{path:"/ws/user/bookmark/public",data:{static_conditions:1}},bookmarks:{path:"/ws/user/bookmark/public",data:{static_conditions:1}}},shared:{catalog:{path:"/ws/user/bookmark/shared"},bookmarks:{path:"/ws/user/bookmark/shared"}},test:{catalog:{path:"content/testData/bookmarking/catalog.json"},bookmarks:{path:"content/testData/bookmarking/bookmarks"}}};a.getCategories=function(){return Object.keys(b)},a.loadBookmark=function(b,c,d,e){var f={category:b,id:c};Human.events.fire("bookmarks.db.loading",f);var g=function(a){e&&(Human.events.fire("bookmarks.db.loadFailed",Human._apply({error:a},f)),e(a))};a.getBookmark(b,c,function(a){Human.bookmarks.restore(a,function(a){d&&(Human.events.fire("bookmarks.db.loaded",f),d(a))},g)},g)},a.getBookmark=function(a,c,d,e){var f=b[a];if(!f)return void e("Unsupported bookmark category: "+a);var g={eid:c},h="test"===a?f.bookmarks.path+"/"+c:f.bookmarks.path;jQuery.ajax({dataType:"json",url:h,data:g,success:function(a){d(a)},error:e})},a._testLoadBookmark=function(a){jQuery.ajax({dataType:"json",url:"https://dev.biodigitalhuman.com/search/bookmarks/data",data:{b:a},success:function(a){Human.bookmarks.restore(a.bookmark,function(){console.log("Done!")})},error:function(a){console.log(a)}})},a.saveBookmark=function(a,c,d,e,f,g,h,i){var j=b[a];if(!j)return void h("Unsupported bookmark category: "+a);var k={name:d||"",description:e||"",tags:JSON.stringify(f),index:JSON.stringify(Human.bookmarks.capture())};c&&(k.eid=c),jQuery.post(j.bookmarks.path,k,g).error(h).complete(i)},a.deleteBookmark=function(a,c,d,e){var f=b[a];if(!f)return void e("Unsupported bookmark category: "+a);var g={eid:c};jQuery.ajax({url:f.bookmarks.path,type:"DELETE",data:g,success:d,error:e})},a.listBookmarks=function(c,d,e,f){var g=b[c];if(!g)return void f("Unsupported bookmark category: '"+c+"' - supported values are "+JSON.stringify(a.getCategories()));var h={tags:d};jQuery.ajax({dataType:"json",url:g.catalog.path,data:h,success:e,error:f})},a.searchBookmarks=function(a,b,c,d){var e={term:a||"",tags:(b||[]).join(",")};jQuery.ajax({dataType:"json",url:"/ws/user/bookmark/search",data:e,success:c,error:d})}}(),function(){"use strict";function a(){var a;for(var b in Human.modules.activeModules)if(Human.modules.activeModules.hasOwnProperty(b)&&(a=Human.modules.activeModules[b],a.tags.indexOf("base")))return a;return null}var b=Human.bookmarks.medline={};b.load=function(b,c){var d=a();return d&&0!==d.modelIds.length?void Human.bookmarks.db.getBookmark("public",b,function(a){var b,e,f={},g=[],h="Integumentary_System",i=d.modelIds[0];for(var j in a.objects)a.objects.hasOwnProperty(j)&&-1===j.indexOf("maleAdult")&&-1===j.indexOf("femaleAdult")&&(b=a.objects[j],e=i+"-"+j,f[e]=b,b.enabled&&-1===j.indexOf(h,j.length-h.length)&&g.push(e));Human.modules.deactivateModules({tags:["condition","expo","bookmark","tour"]}),Human.bookmarks.restore({objects:f,modes:a.modes},function(){Human.view.camera.fly.flyTo({objects:g},function(){c&&c()})})}):(Human.log.error("Human.bookmarks.medline","Failed to load medline bookmark - no base anatomy module is active"),void c())}}(),function(){"use strict";Human.rpc.define("bookmarks.capture",function(){this.setResult(Human.bookmarks.capture())}),Human.rpc.define("bookmarks.restore",function(a){var b=this;Human.bookmarks.restore(a,function(){b.setResult(!0)})}),Human.rpc.define("bookmarks.db.load",function(a){var b=this;Human.bookmarks.db.loadBookmark(a.category,a.id,function(){b.setResult(!0)},function(c){b.error("Failed to load bookmark (category='"+a.category+"', id='"+a.id+"') : "+c)})}),Human.rpc.define("bookmarks.db.get",function(a){var b=this;Human.bookmarks.db.getBookmark(a.category,a.id,function(a){b.setResult(a)},function(c){b.error("Failed to get bookmark (category='"+a.category+"', id='"+a.id+"') : "+c)})}),Human.rpc.define("bookmarks.db.save",function(a){var b=this;Human.bookmarks.db.saveBookmark(a.category,a.id,a.name,a.description,a.tags,function(){b.setResult(!0)},function(c){b.error("Failed to save bookmark (category='"+a.category+"', id='"+a.id+"') : "+c)})}),Human.rpc.define("bookmarks.db.delete",function(a){var b=this;Human.bookmarks.db.deleteBookmark(a.category,a.id,function(){b.setResult(!0)},function(c){b.error("Failed to delete bookmark (category='"+a.category+"', id='"+a.id+"') : "+c)})}),Human.rpc.define("bookmarks.db.list",function(a){var b=this;Human.bookmarks.db.listBookmarks(a.category,a.tags,function(a){b.setResult(a)},function(c){b.error("Failed to list bookmarks (category='"+a.category+"') : "+c)})}),Human.rpc.define("bookmarks.db.search",function(a){var b=this;Human.bookmarks.db.searchBookmarks(a.term,a.tags,function(a){b.setResult(a)},function(c){b.error("Failed to search bookmarks (term='"+a.term+"') : "+c)})})}(),function(){"use strict";function a(a,c,e){return r?void p.unshift({moduleId:a,options:c,ok:e}):void b(a,c,function(){e&&e(),d()})}function b(a,b,d){var e=m.modules[a];return e?(c(e),r=!0,Human.events.fire("modules.activating",{moduleId:a}),Human.processes.startProcess({processId:"modules.activate",statusText:"Loading "+e.displayName}),void e.activate(b,function(){e.active=!0,e.timeActivated=(new Date).getTime(),m.activeModules[a]=e,m.numActiveModules++,Human.processes.finishProcess({processId:"modules.activate"}),Human.events.fire("modules.activated",{moduleId:a,timeActivated:e.timeActivated}),r=!1,d()})):(Human.log.error("Human.modules.activateModules","Module not found: "+a),void d())}function c(a){for(var b,c,d,e=a.tags,f={},g=0,j=e.length;j>g;g++)if(b=e[g],c=q[b])if(c.replaces){d=c.replaces;for(var k=0,l=d.length;l>k;k++)f[d[k]]=!0}else if(c.replacesAll)return void i();var m=[];for(b in f)f.hasOwnProperty(b)&&m.push(b);h({tags:m,matching:"any"})}function d(){if(p.length>0){var a=p.pop();b(a.moduleId,a.options,function(){a.ok(),d()})}}function e(a,b,c){f(a.slice(0),a.length,b,function(){c()})}function f(b,c,d,e){if(0===b.length)return void e();var g=b.shift();a(g,d,function(){b.length>0,f(b,c,d,e)})}function g(b,c,d){for(var e=o.findItems({matching:"atLeast",tags:b}),f=0,g=e.length;g>f;f++)return void a(e[f].moduleId,c,d);Human.log.warn("Human.modules.activateModules","Failed to activate module - no module found with these tags: "+JSON.stringify(b)),d()}function h(a){for(var b=o.findItems({matching:a.matching||"atLeast",tags:a.tags}),c=0,d=b.length;d>c;c++)i(b[c].moduleId)}function i(a){if(!r)if(a){var b=m.activeModules[a];b&&(Human.events.fire("modules.deactivating",{moduleId:a}),b.deactivate(b),b.active=!1,b.timeActivated=-1,delete m.activeModules[a],m.numActiveModules--,Human.events.fire("modules.deactivated",a))}else for(a in m.modules)m.modules.hasOwnProperty(a)&&m.activeModules[a]&&i(a)}function j(a){for(var b=o.findItems({matching:"atLeast",tags:a}),c=0,d=b.length;d>c;c++)k(b[c].moduleId)}function k(a){if(a){var b=m.modules[a];if(!b)return void Human.log.warn("Human.modules.destroyModules","Failed to destroy module - module not found: + "+a);if(i(a),delete m.modules[a],o.removeItem(a),m.namesToModuleIds.hasOwnProperty(b.displayName)){var c=m.namesToModuleIds[b.displayName].indexOf(a);c&&m.namesToModuleIds[b.displayName].splice(c,1)}return n.putId(a),void Human.events.fire("modules.destroyed",a)}for(a in m.modules)m.modules.hasOwnProperty(a)&&k(a)}var l,m=Human.modules={},n=new Human.utils.IDPool;m.modules={};var o=new Human.utils.TagMapList;m.activeModules={},m.numActiveModules=0;var p=[];m.namesToModuleIds={};var q,r=!1;Human.properties.subscribe({propId:"modules.activationRules",value:{base:{replacesAll:!0},standalone:{replaces:["standalone"]},condition:{replaces:["condition","expo","bookmark","medline","tour"]},tour:{replaces:["condition","expo","bookmark","medline","tour"]},bookmark:{replaces:["condition","expo","bookmark","medline"]},medline:{replaces:["condition","expo","bookmark","medline"]},expo:{replaces:["expo"]}},callback:function(a){q=a}});var s={};m.addModuleType=function(a,b){s[a]=b},Human.events.on("loaded",function(){l=!0}),m.createModule=function(a){if(!a.type)return void Human.log.error("Human.modules.createModule","Parameter expected: type");var b=s[a.type];if(!b)return void Human.log.error("Human.modules.createModel","Unsupported module type: '"+a.type+"'");var c;if(a.moduleId){if(c=a.moduleId,m.modules[c])return void Human.log.warn("Human.modules.createModule","Module already created, won't create again: + "+c)}else c=n.getId();a.moduleId=c,a.displayName=a.displayName||"",a.description=a.description||"",a.translations=a.translations,a.tags=a.tags||[],a.active=!1,a.timeActivated=-1;var d=new b(a);return m.modules[c]=d,o.addItem(c,a.tags||["untagged"],d),m.namesToModuleIds[a.displayName]=m.namesToModuleIds[a.displayName]||[],m.namesToModuleIds[a.displayName].push(c),Human.events.fire("modules.created",a),c},m.activateModules=function(b,c){if(!l)return Human.log.error("Human.modules.activateModules","Human not loaded - modules can only be activated when Human loaded"),void(c&&c());var d=c;c=function(){d&&d()};var f=b;if(b.moduleId){var h=b.moduleId;if(!m.modules[h])return Human.log.info("Human.modules.activateModules","Module not found: '"+h+"' - attempting to load definition"),void Human.net.getModuleDefinition(h,function(b){b.type=b.type||"content",b.moduleId=h,m.createModule(b),a(h,f,c)},function(a){Human.log.info("Human.modules.activateModules","Failed to activate module: '"+h+"' - "+a),c()});a(h,f,c)}else b.moduleIds?e(b.moduleIds.slice(0),f,c):b.tags&&g(b.tags,f,c)},m.deactivateModules=function(a){a=a||{},a.tags?h(a):a.moduleId?i(a.moduleId):i(),Human.renderer.forceRenderFrame()},m.destroyModules=function(a){a.tags?j(a.tags):k(a.moduleId)},m.query=function(a){var b,c,d;if(a){if(a.tags)return o.findItems(a);if(a.moduleId)return b=m.modules[a.moduleId],b?[b.module]:[];if(a.names){var e=[];for(var f in a.names)if(a.names.hasOwnProperty(f)){var g=a.names[f];if(m.namesToModuleIds.hasOwnProperty(g)){var h=m.namesToModuleIds[g];for(var i in h)h.hasOwnProperty(i)&&(c=h[i],m.modules.hasOwnProperty(c)&&(b=m.modules[c],e.push({moduleId:c,type:b.type,displayName:b.displayName,description:b.description,translations:b.translations,tags:b.tags,animation:b.animation,active:b.active,timeActivated:b.timeActivated})))}}return e}if(a.active){d=[];for(c in m.activeModules)m.activeModules.hasOwnProperty(c)&&(b=m.activeModules[c],d.push({moduleId:c,type:b.type,displayName:b.displayName,description:b.description,translations:b.translations,tags:b.tags,animation:b.animation,active:b.active,timeActivated:b.timeActivated}));return d}}d=[];for(c in m.modules)m.modules.hasOwnProperty(c)&&(b=m.modules[c],d.push({moduleId:c,type:b.type,displayName:b.displayName,description:b.description,translations:b.translations,tags:b.tags,animation:b.animation,active:b.active,timeActivated:b.timeActivated}));return d}}(),function(){"use strict";function a(b,d){if(b.length>0){var e=b.shift();c.loadModuleDb(e,function(){a(b,d)})}else d()}function b(a,d){if(a.length>0){var e=a.shift();c.loadModuleLib(e,function(){b(a,d)},function(c){Human.log.error("Human.modules.db.loadModuleLibs","Failed to load module lib '"+e+"': "+c),b(a,d)})}else d()}var c=Human.modules.db={};c.moduleLibs={},c.loadModuleDbs=function(b,c){return c=c||Human._noop,0===b.length?void c():void a(b.slice(0),c)},c.loadModuleDb=function(a,b){return b=b||Human._noop,Human.log.info("Human.modules.db.loadModuleDb","Loading module db: "+a+"..."),c.moduleLibs[a]?(Human.log.warn("Human.modules.db.loadModuleDb","Module db already loaded - won't reload: "+a+"..."),void b()):void Human.net.getModuleDb(a,function(d){if(!d.modules||0===d.modules.length)return void b();for(var e=[],f=0;f<d.modules.length;f++){var g=d.modules[f],h=g.id,i=g.module;i.type=i.type||"content",i.moduleId=h,Human.modules.createModule(i),e.push(h)}c.moduleLibs[a]=e,b()},function(c){Human.log.error("Human.modules.db.loadModuleDb","Failed to load module db '"+a+"': "+c),b()})},c.loadModuleLibs=function(a,c){return c=c||Human._noop,0===a.length?void c():void b(a.slice(0),c)},c.loadModuleLib=function(a,b){return b=b||Human._noop,Human.log.info("Human.modules.db.loadModuleLib","Loading module library: "+a+"..."),c.moduleLibs[a]?(Human.log.warn("Human.modules.db.loadModuleLib","Module library already loaded - won't reload: "+a+"..."),void b()):void Human.net.getModuleManifest(a,function(d){return d.modules&&0!==d.modules.length?void c.loadModuleDefinitions(a,d.modules.slice(0),function(){c.moduleLibs[a]=d.modules,b()}):void b()},function(c){Human.log.error("Human.modules.db.loadModuleLib","Failed to load module library manifest: "+a+"': "+c),b()})},c.loadModuleDefinitions=function(a,b,d){if(d=d||Human._noop,0===b.length)d();else{var e=b.shift();Human.log.info("Human.modules.db.loadModuleLib","Loading module definition: "+e+"..."),Human.net.getModuleDefinition(e,function(f){f.type=f.type||"content",f.moduleId=e,Human.modules.createModule(f),c.loadModuleDefinitions(a,b,d)},function(f){Human.log.error("Human.modules.db.loadModuleLib","Failed to load module definition: "+e+"':"+f),c.loadModuleDefinitions(a,b,d)})}},c.destroyModuleLib=function(a){var b=c.moduleLibs[a];if(b){for(var d=b.modules,e=0,f=d.length;f>e;e++)Human.modules.destroyModulesModule(d[e]);delete c.moduleLibs[a]}}}(),function(){"use strict";function a(a,b){for(var c,d=0,e=b.length,f=0,g=a.length;g>f;f++){c=a[f];for(var h=0,i=b.length;i>h;h++)if(c===b[h]&&++d===e)return!0}return!1}function b(a,b){Human.events.fire("modules.gender.activating",{moduleId:a,gender:b})}function c(a,b){Human.events.fire("modules.gender.activated",{moduleId:a,gender:b})}var d=Human.modules.gender={},e=[],f=[];Human.properties.subscribe({propId:"modules.genderTags",value:{male:["anatomy","male","base"],female:["anatomy","female","base"]},callback:function(a){e=a.male||[],f=a.female||[]}}),Human.events.on("modules.activating",function(c){var d=c.moduleId,g=Human.modules.modules[d];a(g.tags,e)?b(d,"male"):a(g.tags,f)&&b(d,"female")}),Human.events.on("modules.activated",function(b){var d=b.moduleId,g=Human.modules.modules[d];a(g.tags,e)?c(d,"male"):a(g.tags,f)&&c(d,"female")}),d.selectGender=function(a,b){return 0===e.length||0===f.length?(Human.log.error("Human.modules.selectGender","No tags configured to identify male/female gender modules"),void(b&&b())):void 0!==a&&null!==a&&"male"!==a&&"female"!==a?(Human.log.error("Human.modules.gender.selectGender","Unsupported value for 'gender' - supported values are 'male' and 'female'"),void b()):(a||(a=Human.cookies.getCookie("gender")||"male"),void Human.modules.activateModules({tags:"male"===a?e:f},function(){Human.cookies.setCookie("gender",a),b()}))}}(),function(){"use strict";var a=!0,b={},c={},d=0;Human.events.on("modules.activating",function(){a=!1}),Human.events.on("modules.activated",function(e){for(var f=e.moduleId,g=Human.modules.modules[f],h=g.tags,i=0,j=h.length;j>i;i++)if("standalone"===h[i])return b[f]=g,void d++;c[f]=g,a=!0}),Human.events.on("modules.deactivated",function(a){b[a]?(delete b[a],d--):delete c[a]}),Human.events.on("bookmarks.restoring",function(){a=!1}),Human.events.on("bookmarks.restored",function(){a=!0}),Human.events.on("timeline.chapters.activating",function(){a=!1}),Human.events.on("timeline.chapters.activated",function(){a=!0}),Human.events.on("scene.objectsShown",function(b){if(a&&Human.modules.numActiveModules>0){var e,f,g=b.enabledObjectsUpdate;for(var h in g)if(g[h]===!0&&(e=Human.scene.objects[h],f=c[e.moduleId],f&&d>0))return Human.log.info("Human.modules.standalone","Module "+e.moduleId+" object focused: "+b.objectId+" - deactivating all standalone modules"),void Human.modules.deactivateModules({tags:["standalone"]})}})}(),function(){"use strict";function a(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function b(){var a,b=Human.view.effects.effects,c={};for(var d in b)b.hasOwnProperty(d)&&(a=b[d],c[d]=a.enabled?Human._apply(a.params,{}):!1);return c}function c(a){for(var b,c=0,d=a.length;d>c;c++)b=a[c],Human.view.annotations.createAnnotation({annotationId:b.annotationId,type:b.type,objectId:b.objectId,title:b.title||"",description:b.description||"",pos:b.offset||b.pos,dir:b.pinVec||b.dir,shown:"secondary"===b.type?!1:b.shown,labelShown:"secondary"===b.type?!1:b.labelShown!==!1,saved:!0,on:b.on,embed:b.embed})
  }function d(a){for(var b,c,d=0,e=a.length;e>d;d++)b=a[d],c=Human.view.annotations.annotations[b.annotationId],c&&c.destroy()}var e=function(a){this.moduleId=a.moduleId,this.displayName=a.displayName||"",this.description=a.description||"",this.translations=a.translations||{},this.tags=a.tags||[],this.active=!1,this.hacks=a.hacks,this.animation=a.animation,this.camera=a.camera;var b=a.modelIds||a.stateId;this.modelIds=b?Human._isArray(b)?b:[b]:[],this.showObjects=a.showObjects,this.selectObjects=a.selectObjects,this.pickThroughObjects=a.pickThroughObjects,this.transparentObjects=a.transparentObjects,this.desaturatedObjects=a.desaturatedObjects,this.backfaceObjects=a.backfaceObjects,this.objectGlassFactors=a.objectGlassFactors,this.objectOpacities=a.objectOpacities,this.animation=a.animation,this.xray=a.xray,this.annotations=a.annotations,this.annotationsLayout=a.annotationsLayout,this.environment=a.environment,this.chapterCameraPath=!!a.chapterCameraPath,this.effects=a.effects,this.properties=a.properties,this.reflections=a.reflections,this.swapped=!1,this.swappedObjectId=null,this.restoreReflections=null,this.restoreProperties=null,this.restoreEffects=null,this.restorePickThroughObjects=null,this.restoreObjectGlassFactors=null,this.restoreObjectOpacities=null,this.restoreCamera=null};e.prototype.activate=function(d,e){var f=this,g=!!d.swap;this.swapped=g,g&&(this.swappedObjectId=d.objectId),f.hacks&&(Human.properties.set({"hacks.neverBackfaces":!!f.hacks.neverBackfaces}),Human.properties.set({"hacks.alwaysBackfaces":!!f.hacks.alwaysBackfaces})),this.reflections&&(this.restoreReflections=Human.assets.reflections.active,Human.assets.reflections.activateReflections(this.reflections)),this._loadModels(this.modelIds.slice(0),function(){var h,i,j;if(Human.properties.set({"hacks.neverBackfaces":!1}),Human.properties.set({"hacks.alwaysBackfaces":!1}),f.properties&&(f.restoreProperties=a(f.properties),Human.properties.set(f.properties)),f.effects&&(f.restoreEffects=b(),Human.view.effects.clearEnabled(),Human.view.effects.setEnabled({effectIds:f.effects})),f.showObjects&&Human.scene.setEnabledObjects({objectIds:f._parseObjectIds(f.showObjects,g),replace:d.swap!==!0}),f.selectObjects&&Human.scene.setSelectedObjects({objects:f._parseObjectIds(f.selectObjects,g),replace:d.swap!==!0}),f.pickThroughObjects){f.restorePickThroughObjects={},h=f._parseObjectIds(f.pickThroughObjects,g);for(j in h)h.hasOwnProperty(j)&&(i=Human.scene.objects[j],i&&(f.restorePickThroughObjects[j]=i.pickable));Human.scene.setPickThroughObjects({objectIds:h,replace:!1})}if(f.transparentObjects&&Human.scene.setTransparentObjects({objectIds:f._parseObjectIds(f.transparentObjects,g)}),f.desaturatedObjects&&Human.scene.setDesaturatedObjects({objectIds:f._parseObjectIds(f.desaturatedObjects,g)}),f.backfaceObjects&&Human.scene.setBackfaceObjects({objectIds:f._parseObjectIds(f.backfaceObjects,g)}),f.objectGlassFactors){f.restoreObjectGlassFactors={},h=f._parseObjectIds(f.objectGlassFactors,g);for(j in h)h.hasOwnProperty(j)&&(i=Human.scene.objects[j],i&&(f.restoreObjectGlassFactors[j]=i.glassFactor));Human.scene.setObjectGlassFactors({objectIds:h})}if(f.objectMurkiness){f.restoreObjectMurkiness={},h=f._parseObjectIds(f.objectMurkiness,g);for(j in h)h.hasOwnProperty(j)&&(i=Human.scene.objects[j],i&&(f.restoreObjectMurkiness[j]=i.murkiness));Human.scene.setObjectMurkiness({objectIds:h})}if(f.objectOpacities){f.restoreObjectOpacities={},h=f._parseObjectIds(f.objectOpacities,g);for(j in h)h.hasOwnProperty(j)&&(i=Human.scene.objects[j],i&&(f.restoreObjectOpacities[j]=i.glassFactor));Human.scene.setObjectOpacities({objectIds:h})}if(f.annotations&&c(f.annotations),Human.view.clip.reset(),f.xray===!0?Human.rpc.call(null,"xray.setEnabled",{enable:!0}):Human.rpc.call(null,"highlight.setEnabled",{enable:!0}),Human.timeline.chapterCameras.pathMode=f.chapterCameraPath,f.animation?Human.timeline.play(f.animation):g||Human.timeline.scrub({time:0}),f.annotationsLayout&&Human.properties.set({"annotations.layout.type":f.annotationsLayout}),g)e();else{if(f.camera||f.flyTo||f.jumpTo){var k=Human.view.camera;f.restoreCamera={lookat:k.getLookAt(),screenPan:k.getScreenPan()}}f.camera?(Human.view.camera.fly.flyTo({eye:f.camera.eye,look:f.camera.look,up:f.camera.up,arc:0},e),f.camera.screenPan&&Human.view.camera.setScreenPan(f.camera.screenPan)):f.flyTo?Human.view.camera.fly.flyTo({eye:f.flyTo.eye,look:f.flyTo.look,up:f.flyTo.up,arc:0},e):f.jumpTo?(Human.view.camera.fly.jumpTo({eye:f.jumpTo.eye,look:f.jumpTo.look,up:f.jumpTo.up}),e()):(Human.renderer.forceRenderFrame(),e())}})},e.prototype.deactivate=function(){if(Human.timeline.stop(),this.annotations&&d(this.annotations),this.modelIds)for(var a=this.modelIds,b=0,c=a.length;c>b;b++)Human.models.unloadModel(a[b]);if(this.restoreReflections&&(Human.assets.reflections.activateReflections(this.restoreReflections),this.restoreReflections=null),this.restoreProperties&&(Human.properties.set(this.restoreProperties),this.restoreProperties=null),this.restoreEffects&&(Human.view.effects.clearEnabled(),Human.view.effects.setEnabled(this.restoreEffects),this.restoreEffects=null),this.restorePickThroughObjects&&(Human.scene.setPickThroughObjects({objectIds:this.restorePickThroughObjects,replace:!1}),this.restorePickThroughObjects=null),this.restoreObjectGlassFactors&&(Human.scene.setObjectGlassFactors({objectIds:this.restoreObjectGlassFactors}),this.restoreObjectGlassFactors=null),this.restoreObjectOpacities&&(Human.scene.setObjectOpacities({objectIds:this.restoreObjectOpacities}),this.restoreObjectOpacities=null),this.restoreCamera){var e=Human.view.camera;e.setLookAt(this.restoreCamera.lookat),e.setScreenPan(this.restoreCamera.screenPan),this.restoreCamera=null}},e.prototype._loadModels=function(a,b){if(a.length>0){var c=a.shift(),d={moduleId:this.moduleId,modelId:c};this.streamObjects&&(d.streamObjects=this.streamObjects);var e=this;Human.models.loadModel(d,function(){e._loadModels(a,b)},function(d){Human.log.error("Human.modules.activate","Failed to activate module: Failed to load model '"+c+"': "+d),e._loadModels(a,b)})}else b()},e.prototype._parseObjectIds=function(a,b){var c;if(!a)return{};if(b){var d={};for(c in a)a.hasOwnProperty(c)&&this._hasObject(c)&&(d[c]=a[c]);void 0!==a["*"]&&null!==a["*"]&&(d["*"]=a["*"]),a=d}var e=a["*"];if(void 0===e||null===e)return a;var f=this.modelIds;if(f)for(var g=0,h=f.length;h>g;g++){var i=Human.scene.modelObjects[f[g]];for(c in i)i.hasOwnProperty(c)&&(a[c]=e)}return a},e.prototype._hasObject=function(a){var b=this.modelIds;if(!b)return!1;for(var c=0,d=this.modelIds.length;d>c;c++)if(0===a.indexOf(this.modelIds[c]))return!0;return!1},Human.modules.addModuleType("content",e)}(),function(){"use strict";function a(a){this.moduleId=a.moduleId,this.displayName=a.displayName||"",this.description=a.description||"",this.tags=a.tags||[],this.active=!1,this.spinRate=a.spinRate||.02,this.delay=a.delay||5,this.mode=a.mode||"visible",this.objects=a.objects,this.active=!1}a.prototype.activate=function(a,b){var c,d,e,f=1e3*this.delay,g=[];switch(this.mode){case"visible":d=Human.scene.enabledObjects;for(e in d)d.hasOwnProperty(e)&&(c=d[e],0===c.objects.length&&g.push(c));break;case"objects":d=Human.scene.rootObjects;for(e in d)d.hasOwnProperty(e)&&this._listObjects(d[e],g);break;default:Human.log.error("ObjectExpo","Mode not supported: "+this.mode)}Human.rpc.call(null,"xray.setEnabled",{enable:!0});var h,i,j=this;Human.events.on("tick",this._tick=function(){var a=(new Date).getTime(),b=a-(void 0===h||null===h?a:h),c=a-(void 0===i||null===i?a:i);if(Human.view.camera.rotateY(b*j.spinRate),void 0===i||null===i||c>f){var d=g[Math.round(Math.random()*g.length)];d&&(Human.view.focus.focusObject({objectId:d.objectId,showLabel:!0,replace:!0}),i=a)}h=a}),b()},a.prototype._listObjects=function(a,b){for(var c,d=a.objects,e=0,f=d.length;f>e;e++)c=d[e],this.objects?this._selectedObject(this.objects,c)&&b.push(c):b.push(c),this._listObjects(c,b)},a.prototype._selectedObject=function(a,b){for(var c,d=b;void 0!==d&&null!==d;d=d.parent){if(c=a[d.objectId],c===!0)return!0;if(c===!1)return!1}return!1},a.prototype.deactivate=function(){Human.events.off("tick",this._tick),this.active=!1},Human.modules.addModuleType("objectExpo",a)}(),function(){"use strict";function a(a){this.moduleId=a.moduleId,this.displayName=a.displayName||"",this.description=a.description||"",this.tags=a.tags||[],this.active=!1,this.delay=a.delay||1e4,this.expoModules=a.expoModules}a.prototype.activate=function(a,b){function c(){var a=d[e++%d.length];Human.modules.activateModules({moduleId:a.moduleId},function(){f.active&&setTimeout(c,f.delay)})}var d=Human.modules.query(this.expoModules),e=0,f=this;d.length>0?c():Human.log.warn("moduleExpo","No modules found"),b()},a.prototype.deactivate=function(){},Human.modules.addModuleType("moduleExpo",a)}(),function(){"use strict";function a(a){this.moduleId=a.moduleId,this.displayName=a.displayName||"",this.description=a.description||"",this.tags=a.tags||[],this.active=!1,this.category=a.category,this.bookmarkId=a.bookmarkId}a.prototype.activate=function(a,b,c){Human.log.info("Human.modules","Activating bookmark: "+this.bookmarkId),Human.bookmarks.db.loadBookmark(this.category,this.bookmarkId,a,function(a){c("[Human.modules] Failed to load bookmark: "+a)}),a()},a.prototype.deactivate=function(){Human.log.info("Human.modules","Deactivating bookmark: "+this.bookmarkId)},Human.modules.addModuleType("bookmark",a)}(),function(){"use strict";function a(a){this.moduleId=a.moduleId,this.displayName=a.displayName||"Exploded view",this.description=a.description||"Exploded view",this.tags=a.tags||[],this.active=!1,this.distance=a.distance||20,this.objects=a.objects,this.factor=0,this.dir=1}a.prototype.activate=function(a,b){var c,d,e=[],f=Human.scene.enabledObjects,g=[0,0,0];for(var h in f)f.hasOwnProperty(h)&&(c=f[h],0===c.objects.length&&(d=c.getCenter(),e.push({pos:d,pos2:null,dir:[0,0,0],object:c}),g[0]+=d[0],g[1]+=d[1],g[2]+=d[2]));g[0]/=e.length,g[1]/=e.length,g[2]/=e.length;for(var i=0,j=e.length;j>i;i++){var k=e[i],l=k.pos;k.dir=Human.math.subVec3(l,g)}var m,n=this;Human.events.on("tick",this._tick=function(){if(n.factor>1)return n.factor=1,void(n.dir=0);if(n.factor<0)return n.factor=0,void(n.dir=0);for(var a=(new Date).getTime(),b=0,c=e.length;c>b;b++){var d=e[b],f=Human.math.addVec3(d.pos,Human.math.mulVec3Scalar(d.dir,n.factor));d.object.setTransform({translate:{x:f[0],y:f[1],z:f[2]}})}n.factor+=.01*n.dir,m=a}),this.factor=0,this.dir=1,b()},a.prototype.deactivate=function(){Human.events.off("tick",this._tick),this.active=!1},Human.modules.addModuleType("explode",a)}(),function(){"use strict";Human.rpc.define("modules.getModules",function(a){this.setResult(Human.modules.query(a))}),Human.rpc.define("modules.activate",function(a){var b=this;Human.modules.activateModules(a,function(){b.setResult(!0)})}),Human.rpc.define("modules.deactivate",function(a){Human.modules.deactivateModules(a)})}(),function(){"use strict";var a=Human.clients={};a.numConnections=0,a.addClient=function(b){b({connected:function(){a.numConnections++,Human.events.fire("clients.connected",{})},disconnected:function(){a.numConnections--,Human.events.fire("clients.disconnected",{})}})}}(),function(){"use strict";function a(a){var b=g+":"+h+"/socket.io/socket.io.js";Human.log.info("[Socket] Loading Socket.IO library from "+b),require([b],function(b){a(b)})}function b(a){try{j.emit("sendreply",i,a)}catch(b){Human.log.error("Human.clients.webSocketClient#sendResponse","Error sending response: "+b)}}function c(a){var b=a.call;return"camera.pan"===b||"camera.orbit"===b||"camera.flyTo"===b||"camera.jumpTo"===b||"camera.zoom"===b||"camera.getZoom"===b||a.params&&a.params.connected?void d(a):void(0===k?d(a):(l.push(a),f||(f=setInterval(function(){l.length>0&&0===k&&d(l.shift()),0===l.length&&(clearInterval(f),f=null)},20))))}function d(a){try{Human.rpc.call(a.id,a.call,a.params)}catch(b){Human.log.error("Human.clients.webSocketClient","Error executing RPC call [callId: "+a.id+", procedure: "+a.call+"]: "+b)}}var e="true"===Human.request.getSearchParam("socketEnabled");if(!e)return void Human.log.info("Human.clients.webSocketClient","WebSocket enabled: NO - socketEnabled=true was not found on URL.");Human.log.info("Human.clients.webSocketClient","WebSocket enabled: YES - socketEnabled=true was found on URL.");var f,g=Human.request.getSearchParam("socketURL")||"https://api.biodigitalhuman.com",h=Human.request.getSearchParam("socketPort")||443,i=Human.request.getSearchParam("socketChannel")||"human",j=null,k=0,l=[],m=!1,n=null,o=!1;Human.onError(function(a){m&&b({error:a}),n=a}),Human.events.on("started",function(){m&&b({message:"ready"}),o=!0}),Human.events.on("loaded",function(){Human.clients.numConnections++,Human.events.fire("clients.connected",{}),Human.log.info("Human.clients.webSocketClient","WebSocket server enabled."),Human.log.info("Human.clients.webSocketClient","Loading Socket.IO Library..."),a(function(a){Human.log.info("Human.clients.webSocketClient","Socket.IO library loaded."),Human.events.on("processes.started",function(){k++}),Human.events.on("processes.finished",function(){k>0&&k--}),Human.events.on("processes.failed",function(){k--}),Human.rpc.onResult(function(a,c){var d={};d[a]=c,b({results:d})});try{j=a.connect(g+":"+h);var d=!1;j.on("connect",function(){d||(d=!0,Human.log.info("Human.clients.webSocketClient","Connected."),Human.log.info("Human.clients.webSocketClient","Subscribing"),j.emit("subscribe",i))}),j.on("status",function(a){Human.log.info("[client "+g+"] received status:"+a)}),j.on("message",function(a){Human.log.info("Human.clients.webSocketClient",JSON.stringify(a)),"connect"===a.action?(Human.log.info("Human.clients.webSocketClient","Client connected"),j.emit("sendreply",i,{message:"connected"}),n?j.emit("sendreply",i,{message:"error",error:n}):o&&j.emit("sendreply",i,{message:"ready"})):a.call&&c(a)})}catch(e){Human.log.error("Human.clients.webSocketClient#start","Error initializing socket: "+e)}})})}(),Human.clients.addClient(function(a){"use strict";function b(a){var b=JSON.stringify(a);return f?void f.postMessage(b,g):void i.push(b)}function c(){for(;i.length>0;)f.postMessage(i.pop(),g)}function d(a){var b=a.call;return"camera.pan"===b||"camera.orbit"===b||"camera.flyTo"===b||"camera.jumpTo"===b||"camera.zoom"===b||a.params&&a.params.connected?void e(a):void(0===k?e(a):(j.push(a),h||(h=setInterval(function(){j.length>0&&0===k&&e(j.shift()),0===j.length&&clearInterval(h)},20))))}function e(a){try{Human.rpc.call(a.id,a.call,a.params)}catch(b){Human.log.error("Human.clients.windowClient","Error executing RPC call [callId: "+a.id+", procedure: "+a.call+"]: "+b)}}var f,g,h,i=[],j=[],k=0;Human.events.on("started",function(){b({message:"status",status:"ready"})}),Human.events.on("processes.started",function(){k++}),Human.events.on("processes.finished",function(){k--,0>k&&(k=0,Human.log.warn("Human.clients.windowClient","Extra Process.Finished event caught"))}),Human.events.on("processes.failed",function(){k--}),window.addEventListener?(Human.onError(function(a){b({error:a})}),Human.rpc.onResult(function(a,c){var d={};d[a]=c,b({results:d})}),addEventListener("message",function(e){var h;try{h=JSON.parse(e.data)}catch(i){return void Human.log.error("Human.clients.windowClient","JSON parse failed on an incoming Web message: "+i.message||i)}"connect"===h.action?f||(Human.log.info("Human.clients.windowClient","Client connected"),a.connected(),f=e.source,g=e.origin,b({message:"connected"}),c()):h.call&&d(h)},!1)):Human.log.error("Human.clients.windowClient","Browser does not support cross-window messaging")}),function(){"use strict";var a=Human.actions={};a._actions={},Human.events.on("loaded",function(){$(document).on("click","[data-human-action]",function(){var b=$(this),c=b.attr("data-human-action"),d=b.attr("data-arguments");c&&a._doAction([c,d])})}),a.addAction=function(b,c){a._actions[b]=c},a._doAction=function(b){var c;if("string"==typeof b){if(c=b.split("?"),0===c.length)return void Human.log.error("Human.actions._parse","Parsed invalid action link: "+b+"(ignoring)")}else c=b;var d=c[0],e=a._actions[d];if(!e)return void Human.log.error("Human.actions._doAction","Parsed invalid action link - action not found: "+d+" (ignoring)");var f={},g=c[1];if(g)for(var h,i=g.split("&"),j=0,k=i.length;k>j;j++)h=i[j].split("="),f[h[0]]=h[1];try{e(f)}catch(l){Human.log.error("Human.actions._doAction","Action '"+d+"' threw an exception: "+l)}},a.parse=function(a){return a.replace(/\[\[([^|]*?)\|(.*?)\]\]/g,"<a href=\"javascript:Human.actions._doAction('$1')\">$2</a>")}}(),function(){"use strict";Human.rpc.define("actions.doAction",function(a){Human.actions._doAction([a.action,a.arguments])})}();