text: !function(a){"use strict";a.module("humanUI",["humanUI.config","humanUI.utilities","humanUI.background","humanUI.load","humanUI.camera","humanUI.timeline","humanUI.crossSection","humanUI.annotations","humanUI.hotspots","humanUI.actions","humanUI.parser","humanUI.dissect","humanUI.modes","humanUI.info","humanUI.media","humanUI.scene","humanUI.bookmark","humanUI.fullscreen","humanUI.snapshot","humanUI.rpc","humanUI.templates"]).constant("MIN_HUMAN_VERSION","10.0.0").run(["$rootScope","Human","RpcDefinitions","ConfigCreator",function(a,b,c,d){b.properties.subscribe({propId:"locale",callback:function(b){a.$broadcast("human.locale",b)}}),d.init(),c.init()}]).factory("currentModule",["Human",function(a){var b={id:null,data:null};return a.events.on("modules.activate.start",function(c){a.modules.activeModules[c.moduleId]||a.assets.server.getModuleDefinition(c.moduleId,function(a){b.id=c.moduleId,b.data=a})}),b}]).factory("Human",["$window","MIN_HUMAN_VERSION",function(b,c){var d,e,f,g=[];a.forEach([Human.VERSION,c],function(a){a.replace(/^(\d+)\.(\d+)\.(\d+)-?(\w+)?$/,function(a,b,c,d,e){g.push({major:b,minor:c,patch:d,client:e||null})})});var h=["Human",Human.VERSION,"is not reliably supported! Use",c,"or higher."].join(" "),i=function(a){0!==a.length&&(f=a.shift(),d=Number(g[0][f]),e=Number(g[1][f]),e>d?b.console.warn(h):d===e&&i(a))};return 2===g.length?i(["major","minor","patch"]):b.console.warn(h),Human}]).factory("humanLoaded",["$q","Human",function(a,b){var c=a.defer();return b.events.on("loaded",function(){c.resolve()}),c.promise}]),a.module("humanUI.utilities",[]).factory("isBaseAnatomy",function(){return function(b){var c=a.isObject(b)?b.moduleId:b;return c?Human.modules.isBaseModule(c):!1}}).factory("touchTarget",["$document",function(a){return function(b,c){b.addEventListener("touchmove",function(b){var d=b.changedTouches[0],e=a[0].elementFromPoint(d.pageX,d.pageY);c(e)})}}]).factory("destroyInterval",["$interval",function(b){return function(c){a.isDefined(c)&&(b.cancel(c),c=void 0)}}]).factory("checkModule",function(){return function(b){try{a.module(b)}catch(c){return!1}return!0}}).factory("ElementDisplay",["OutsideListen",function(a){return{create:function(b){if(b.trigger&&b.target){var c,d=b.action||"toggle",e=d[0].toUpperCase()+d.slice(1),f=b.eventName||"element"+e,g="show"===d?"removeClass":"hide"===d?"addClass":"toggleClass";b.globalClose&&(c=a.create(b.target),c.excludedEls=[b.trigger[0],b.target[0]]);var h=function(a){b.target[a]("ng-hide");var d=!b.target.hasClass("ng-hide");c&&(d?c.add(h.bind(null,"addClass")):c.remove()),b.trigger.triggerHandler(f,d),b.target.triggerHandler(f,d)};b.trigger.on("click",h.bind(null,g))}}}}]).factory("OutsideListen",["$document",function(b){var c=function(c,d){d=d||{},this.element=c,this.excludedEls=[this.element[0]],a.isArray(d.exclude)&&a.forEach(d.exclude,function(a){var c=b[0].querySelectorAll(a);c=Array.prototype.slice.call(c),this.excludedEls=this.excludedEls.concat(c)},this)};return c.prototype._checkContainment=function(a){for(var b=0;b<this.excludedEls.length;b++)if(this.excludedEls[b].contains(a))return!0;return!1},c.prototype.add=function(a){var c=function(b){this._checkContainment(b.target)||(a(),this.remove())};this.checkOutside=c.bind(this),b[0].addEventListener("touchstart",this.checkOutside,!0),b[0].addEventListener("mousedown",this.checkOutside,!0)},c.prototype.remove=function(){b[0].removeEventListener("touchstart",this.checkOutside,!0),b[0].removeEventListener("mousedown",this.checkOutside,!0),this.checkOutside=null},{create:function(a,b){return new c(a,b)}}}]).filter("parseActions",["$sce","Human",function(b,c){return function(d){return a.isString(d)?b.trustAsHtml(c.actions.parse(d)):""}}]).filter("translate",function(){return function(a,b,c){var d=a[b];return c&&a.translations&&a.translations[c]&&(d=a.translations[c][b]||d),d}}).filter("excludeBaseAnatomy",["isBaseAnatomy",function(a){return function(b){return a(b)?null:b}}]).filter("escapeHtml",function(){var b={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},c=[];a.forEach(b,function(a,b){c.push(b)});var d=new RegExp("(?:"+c.join("|")+")","g"),e=function(a){return b[a]};return function(a){return a.replace(d,e)}}).filter("dashNormalize",function(){return function(a){return/^[a-z]+([_[A-Z])[a-z]+/.test(a)?a.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/([a-zA-Z])_/g,"$1-").toLowerCase():a}}).filter("camelCaseNormalize",function(){return function(b){return a.isString(b)&&(b=b.replace(/[-_]([a-z])/g,function(a){return a[1].toUpperCase()})),b}}).filter("formatPosition",function(){return function(a,b){var c,d="array"===b?[]:{},e=["x","y","z"];switch(b){case"array":if(a.hasOwnProperty("length"))d=a;else for(c=0;c<e.length;c++)a.hasOwnProperty(e[c])&&d.push(a[e[c]]);break;case"object":if(a.hasOwnProperty("length"))for(c=0;c<a.length;c++)d[e[c]]=a[c];else d=a;break;default:d=a}return d}}).directive("toggleButton",function(){return{restrict:"A",scope:{config:"=toggleButton"},link:function(b,c,d){var e,f="on"===d.toggleDefault,g=function(b){a.isDefined(b)&&(f=!!b,c[f?"addClass":"removeClass"]("on"))};f&&c.addClass("on"),c.on("click",function(){f=!f,e=f?"on":"off",a.isFunction(b.config[e])&&b.config[e](),b.$apply()}),b.$watch("config.model",function(a,b){a!==b&&g(a)})}}}),a.module("humanUI.utilities").factory("HumanCollection",["$interpolate",function(b){var c,d,e,f=function(a,b){b=b||{},this.element=a,this.lis={},this.collapseTemplate=b.collapseTemplate||"<span collapse></span>",this.element.data("humanCollection",this)},g=f;return g.create=function(a){return new g(a)},g.compare=function(a,b,c){var d,e,f,g=[],h=[],i={},j={};if(b){for(d=0;d<a.length;d++)i[a[d][c]]=a[d];for(d=0;d<b.length;d++)j[b[d][c]]=b[d];for(e in i)i.hasOwnProperty(e)&&!j.hasOwnProperty(e)&&g.push(i[e]);for(e in j)j.hasOwnProperty(e)&&!i.hasOwnProperty(e)&&h.push(j[e]);f={toAdd:g,toRemove:h}}else f={toAdd:a,toRemove:h};return f},g.sort=function(a){return function(b,c){var d=b[a].toLowerCase(),e=c[a].toLowerCase();return e>d?-1:d>e?1:0}},g.prototype.buildClasses=function(a,b,c){var f;d=[],e=c?c(a):{},b&&(e["tree-leaf"]=!0);for(f in e)e.hasOwnProperty(f)&&e[f]&&d.push(f);return d.join(" ")},g.prototype._buildObjectGroups=function(b){var c,d,e,f={},h="abcdefghijklmnopqrstuvwxyz".split("");a.forEach(h,function(a){f[a]=[]});for(e in b)b.hasOwnProperty(e)&&(d=b[e],c=d.displayName[0].toLowerCase(),f[c].push(d));var i=g.sort("displayName");for(e in f)f.hasOwnProperty(e)&&f[e].sort(i);return f},g.prototype.buildDOMString=function(a,d,e){var f,g,h,i,j,k,l,m=this._buildObjectGroups(d),n="<ul>";f=e.itemId?' id="{{'+e.itemId+' | escapeHtml }}"':"";var o="<li"+f+' class="{{ classes }}">';for(i in m)if(m.hasOwnProperty(i)){for(l=m[i],l.length>0&&(f='id="letter-group-'+i+'"',j='<h1 class="letter-header">',j+=i.toUpperCase()+"</h1>",n+="<li "+f+' class="letter-group">'+j+"<ul>"),k=0;k<l.length;k++)c=l[k],g=e.itemClasses,c.classes=this.buildClasses(c,!1,g),h=o+a,h=b(h)(c),delete c.classes,n+=h+"</li>";l.length>0&&(n+="</ul></li>")}return n+="</ul>"},g.prototype._buildTreeDOMString=function(a,d,e,f){var g,h,i,j,k,l=f?"<ul>":"";i=e.itemId?' id="{{'+e.itemId+' | escapeHtml }}"':"";var m="<li"+i+' class="{{ classes }}">';for(k=0;k<d.length;k++)c=d[k],g=e.isLeaf?e.isLeaf(c):!1,j=e.itemClasses,c.classes=this.buildClasses(c,g,j),h=m+(g?"":this.collapseTemplate)+a,h=b(h)(c),delete c.classes,g||(h+=this._buildTreeDOMString(a,c.objects,e,!0)),l+="</li>"+h;return l+=f?"</ul>":""},g.prototype.buildTreeDOMString=function(a,b,c,d){return this._buildTreeDOMString(a,b,c,d)},g.prototype.buildLis=function(a){if(a&&a.length)for(var b=0;b<a.length;b++)this.lis[a[b].id]=a[b];this.element.triggerHandler("humanCollection.built")},g.prototype.emptyLis=function(){for(var a in this.lis)this.lis.hasOwnProperty(a)&&delete this.lis[a];this.element.triggerHandler("humanCollection.emptied")},g.prototype.getLi=function(b){return this.lis[b]?a.element(this.lis[b]):void 0},g.prototype.removeLi=function(a){this.lis[a]&&(this.lis[a].remove(),delete this.lis[a])},g}]).factory("TreeCollapse",["$timeout",function(b){var c={animate:!0};return{show:function(d,e){if(!d.data("transitioning")){var f=d.parent();e=a.extend({},c,e);var g=e.animate;f.removeClass("collapsed").addClass("opening"),g&&d.addClass("transitioning"),d.css("height",0),d.data("transitioning",!0),f.data("collapsed",!1);var h=function(){g&&d.removeClass("transitioning"),f.addClass("open").removeClass("opening"),d.css("height","auto"),d.data("transitioning",!1)};g?b(h,350):b(h),d.css("height",d[0].scrollHeight+"px")}},hide:function(d,e){var f;if(!d.data("transitioning")){var g=d.parent();e=a.extend({},c,e);var h=e.animate;f=d.css("height",d[0].offsetHeight+"px")[0].offsetHeight,h&&d.addClass("transitioning"),g.removeClass("open").addClass("collapsing"),d.data("transitioning",!0);var i=function(){d.data("transitioning",!1),h&&d.removeClass("transitioning"),g.addClass("collapsed").removeClass("collapsing"),g.data("collapsed",!0)};d.css("height",0),h?b(i,350):b(i)}},toggle:function(a){this[a.parent().data("collapsed")?"show":"hide"](a)},getTarget:function(b){if(b)for(var c=b.children(),d=0;d<c.length;d++)if("ul"===c[d].tagName.toLowerCase())return a.element(c[d])},globalBind:function(b){var c=this;b.off("click.collapseToggle"),b.on("click.collapseToggle",function(b){if(b.target.hasAttribute("collapse")){b.stopPropagation();var d=a.element(b.target),e=d.parent();c.toggle(c.getTarget(e))}})},init:function(a){a.find("li").addClass("collapsed").data("collapsed",!0),a.children().find("ul").css("height","0px")}}}]).directive("collapse",["TreeCollapse",function(a){return{restrict:"A",link:function(b,c){c.off("click.collapseToggle"),c.on("click.collapseToggle",function(b){b.stopPropagation();var d=c.parent();a.toggle(a.getTarget(d))})}}}]).directive("humanList",["HumanCollection",function(a){return{restrict:"E",scope:{listData:"=",listConfig:"="},compile:function(b){var c=b[0].innerHTML;b.addClass("human-collection").empty();var d=function(b,d){var e=a.create(d),f=function(a){var f=b.listConfig||{},g=e.buildDOMString(c,a,f);d.empty().append(g),f.letterHeaders&&d.addClass("letter-headers"),e.emptyLis(),e.buildLis(d.find("li"))};b.$watch("listData",function(a){a&&f(a)})};return d}}}]).directive("humanTree",["$compile","HumanCollection","TreeCollapse",function(b,c,d){return{restrict:"E",scope:{treeData:"=",treeConfig:"="},compile:function(e){var f=e[0].innerHTML;e.addClass("human-collection").empty();var g=function(e,g){var h=c.create(g),i=function(i,j){var k,l=e.treeConfig||{};if(l.compare&&l.itemId){for(var m,n,o,p=c.compare(i,j,l.itemId),q=0;q<p.toRemove.length;q++)h.removeLi(p.toRemove[q][l.itemId]);m=g[0].firstChild,n=m&&"ul"===m.tagName.toLowerCase(),o=n?a.element(m):g,k=h.buildTreeDOMString(f,p.toAdd,l,!n),o.append(k)}else k=h.buildTreeDOMString(f,i,l,!0),g.empty().append(k);l.compile===!1?d.globalBind(g):b(g.contents())(e),d.init(g),h.emptyLis(),h.buildLis(g.find("li"))};e.$watch("treeData",function(a,b){a&&i(a,b)})};return g}}}]),a.module("humanUI.utilities").factory("Draggable",["$window","$document",function(b,c){var d,e,f,g,h,i="touchstart mousedown",j="touchmove mousemove",k="touchend touchcancel mouseup",l=[],m=function(c,d){var e={element:b,axis:!1,elementBounds:!1};if(a.isString(c.element)){var f=c.element.split(".");"parent"===f[0]&&(e.element=d.parent()[0]),("width"===f[1]||"height"===f[1])&&(e.elementBounds=f[1])}else"boolean"==typeof c.element&&(c.element||(e.element=!1));return("x"===c.axis||"y"===c.axis)&&(e.axis=c.axis),e},n=function(b){this.element=b.element,this.handle=b.handle||b.element,this.constraints=m(b.constraints||{},this.element),this.callbacks={onStart:b.onStart||a.noop,onMove:b.onMove||a.noop,onEnd:b.onEnd||a.noop},a.forEach(i.split(" "),function(a){this.handle.on(a+".draggable",this.onStart.bind(this))},this)};return n.prototype.setElCoords=function(){this.width=this.element[0].offsetWidth,this.height=this.element[0].offsetHeight,f=b.parseInt(this.element.css("margin-left")),g=b.parseInt(this.element.css("margin-top")),this.x=this.element[0].offsetLeft-f,this.y=this.element[0].offsetTop-g,this.parentX=this.element[0].offsetParent.offsetLeft,this.parentY=this.element[0].offsetParent.offsetTop},n.prototype.setEventCoords=function(a){a=a.originalEvent||a,a=a.changedTouches?a.changedTouches[0]:a,this.deltaX=a.clientX-this.eventX||0,this.deltaY=a.clientY-this.eventY||0,this.eventX=a.clientX,this.eventY=a.clientY},n.prototype.constrainX=function(a){return this.constraints.element&&(this.constraints.element===b?(d=0-this.parentX,e=b.innerWidth-this.parentX):(d=0,e=this.constraints.element.offsetWidth),d>a&&(a=d),h="width"===this.constraints.elementBounds?0:this.width,a+h>e&&(a=e-h)),"y"===this.constraints.axis&&(a=this.x),a},n.prototype.constrainY=function(a){return this.constraints.element&&(this.constraints.element===b?(d=0-this.parentY,e=b.innerHeight-this.parentY):(d=0,e=this.constraints.element.offsetHeight),d>a&&(a=d),h="height"===this.constraints.elementBounds?0:this.height,a+h>e&&(a=e-h)),"x"===this.constraints.axis&&(a=this.y),a},n.prototype.onStart=function(b){b.stopPropagation(),b.preventDefault(),this.setElCoords(),this.setEventCoords(b),a.forEach(j.split(" "),function(a){c.on(a+".draggable",this.onMove.bind(this))},this),a.forEach(k.split(" "),function(a){c.on(a+".draggable",this.onEnd.bind(this))},this),this.callbacks.onStart(this.x,this.y)},n.prototype.onMove=function(a){a.stopPropagation(),a.preventDefault(),this.setEventCoords(a),this.x=this.constrainX(this.x+this.deltaX),this.y=this.constrainY(this.y+this.deltaY),this.element.css({left:this.x+"px",top:this.y+"px"}),this.callbacks.onMove(this.x,this.y)},n.prototype.onEnd=function(){a.forEach(j.split(" "),function(a){c.off(a+".draggable")},this),a.forEach(k.split(" "),function(a){c.off(a+".draggable")},this),this.callbacks.onEnd()},{create:function(a){var b=new n(a);return l.push(b),b}}}]).directive("draggable",["Draggable",function(a){return{restrict:"A",link:function(b,c,d){var e,f,g=c.find("drag-handle");e="false"===d.constrainElement?!1:/^parent/.test(d.constrainElement)?d.constrainElement:"window",("x"===d.constrainAxis||"y"===d.constrainAxis)&&(f=d.constrainAxis),a.create({element:c,handle:g.length?g:c,constraints:{element:e,axis:f}})}}}]),a.module("humanUI.utilities").factory("HumanKeySelect",["$window",function(b){var c=function(a){return"ArrowUp"===a.key||38===a.keyCode||38===a.which},d=function(a){return"ArrowDown"===a.key||40===a.keyCode||40===a.which},e=function(a){return"Enter"===a.key||13===a.keyCode||13===a.which},f=function(a){return a.clientHeight>0&&a.clientWidth>0},g=function(a){for(var c=a.getBoundingClientRect().height,d=b.getComputedStyle(a),e=["marginTop","marginBottom"],f=0;f<e.length;f++)d[e[f]]&&/px$/.test(d[e[f]])&&(c+=b.parseInt(d[e[f]]));return c},h=function(b,c,d){this.$selectedItem=null,this.enabled=!1,this.$element=b,this.items=this.setItems(c),this.config=a.extend({cycle:!0,selectedClass:"user-selected",onSelected:a.noop},d),this.bindHandlers()};return h.create=function(a,b,c){return new h(a,b,c)},h.prototype._findScrollParent=function(){for(var a=this.items[0],b=null;!b&&a&&a!==this.$element[0];)a=a.parentNode,a&&a.scrollHeight>a.clientHeight&&(b=a);return b},h.prototype._selectItem=function(b){var c=this.config.selectedClass;return this._clearSelectedItem(),b&&(this.$selectedItem=a.element(b),this.$selectedItem.addClass(c)),this.$selectedItem},h.prototype._clearSelectedItem=function(){var a=this.config.selectedClass;this.$selectedItem&&(this.$selectedItem.removeClass(a),this.$selectedItem=null)},h.prototype._isFirstVisibleItem=function(a){for(var b=this.items.indexOf(a),c=b-1;c>=0;c--)if(f(this.items[c]))return!1;return!0},h.prototype._isLastVisibleItem=function(a){for(var b=this.items.indexOf(a),c=b+1;c<this.items.length;c++)if(f(this.items[c]))return!1;return!0},h.prototype._selectNextItem=function(a){var b;for(b=a+1;b<this.items.length;b++)if(f(this.items[b]))return this._selectItem(this.items[b]);if(this.config.cycle)for(b=0;a>b;b++)if(f(this.items[b]))return this._selectItem(this.items[b])},h.prototype._selectPreviousItem=function(a){var b;for(b=a-1;b>=0;b--)if(f(this.items[b]))return this._selectItem(this.items[b]);if(this.config.cycle)for(b=this.items.length-1;b>a;b--)if(f(this.items[b]))return this._selectItem(this.items[b])},h.prototype._handleScroll=function(b,c){var d,e,f,h,i=this.$selectedItem[0],j=g(i),k=2;if(d=i.offsetTop-j*k,e=this._scrollParent.scrollTop,f=i.offsetTop+j*(k+1),h=this._scrollParent.scrollTop+this._scrollParent.clientHeight,this._scrollParent.scrollHeight>this._scrollParent.clientHeight&&(1===b&&f>h||-1===b&&e>d)){a.element(this._scrollParent).one("scroll",c);var l=this._scrollParent.scrollTop,m=j*k*b;if(this._scrollParent.scrollTop=l+m,l===this._scrollParent.scrollTop){var n=this.config.cycle;n&&1===b&&this._isLastVisibleItem(i)?this._scrollParent.scrollTop=0:n&&-1===b&&this._isFirstVisibleItem(i)?this._scrollParent.scrollTop=this._scrollParent.scrollHeight:(a.element(this._scrollParent).off("scroll",c),c())}}else c()},h.prototype.selectItem=function(a){if(a=a||{},a.hasOwnProperty("index")&&this._selectNextItem(a.index-1),a.hasOwnProperty("dir")){if(!this.$selectedItem)return;var b=a.dir,c=this.items.indexOf(this.$selectedItem[0]),d=this[1===b?"_selectNextItem":"_selectPreviousItem"];d=d.bind(this,c),this._scrollParent||(this._scrollParent=this._findScrollParent()),this._scrollParent?this._handleScroll(b,d):d()}},h.prototype.setItems=function(b){this.items=b||[],a.isArray(this.items)||(this.items=Array.prototype.slice.call(this.items))},h.prototype.bindHandlers=function(){var a=this;a.$element.on("focus",function(){a.enabled=!0}),a.$element.on("blur",function(){a.enabled=!1,a._clearSelectedItem()}),a.$element[0].addEventListener("click",function(b){a.enabled&&a.items.length&&a.items.indexOf(b.target)>=0&&a._selectItem(b.target)},!0),b.addEventListener("keydown",function(b){a.enabled&&a.items.length&&(b.stopImmediatePropagation(),c(b)||d(b)?a.selectItem(a.$selectedItem?{dir:d(b)?1:-1}:{index:0}):e(b)&&a.$selectedItem&&a.config.onSelected(a.$selectedItem))},!0)},h}]),a.module("humanUI.utilities").directive("humanSlider",["Draggable",function(b){return{restrict:"E",scope:{config:"="},templateUrl:"templates/utilities/slider.html",link:function(c,d){var e,f,g,h,i,j,k,l=0,m={min:0,max:1,range:1,axis:"x"},n={},o=d.children(),p=o.children(),q=p.eq(0),r=p.eq(1),s=o[0],t=function(){f=100*e+"%",r.css("x"===m.axis?"left":"top",f),q.css("x"===m.axis?"width":"height",f),c.config.label&&(c.label=c.config.label())},u=function(b,c){a.isNumber(c)&&(m[b]=c,m.range=m.max-m.min),"axis"===b&&c&&(m[b]=c,d.attr("axis",c),g.constraints.axis=c,h="x"===m.axis?"width":"height",g.constraints.elementBounds=h,r[0].style.top=null,r[0].style.left=null)},v=function(a,b){l="x"===m.axis?a:b,h="x"===m.axis?"offsetWidth":"offsetHeight",e=l/s[h],c.config.value=e*m.range+m.min,n.position=n[m.axis]=l,n.fraction=e,"x"===m.axis?delete n.y:delete n.x,c.config.change&&c.config.change(n),c.$apply()};o.on("mousedown",function(a){i=a.target.getBoundingClientRect(),j=a.clientX-i.left,k=a.clientY-i.top,v(j,k)}),g=b.create({element:r,constraints:{element:"parent.width",axis:m.axis},onMove:v}),c.$watch("config.min",function(a){u("min",a)}),c.$watch("config.max",function(a){u("max",a)}),c.$watch("config.axis",function(a){u("axis",a)}),c.$watch("config.value",function(b){a.isNumber(b)&&(e=(b-m.min)/m.range,h="x"===m.axis?"offsetWidth":"offsetHeight",l=e*s[h],t())})}}}]),a.module("humanUI.hotspots",[]).directive("humanHotspots",["$compile","HumanActions","HotspotData","Hotspot",function(b,c,d,e){return{restrict:"E",scope:!0,link:function(b,c){e.parentElement=c[0];var f=function(b){a.forEach(b,function(a){var b=e.create(a);b.template&&b.render()})},g=function(b){a.forEach(b,function(a){e.destroy(a)})},h=!1;Human.events.on("modules.deactivate.finish",function(){g(e.hotspots.slice(0)),h=!1}),Human.events.on("modules.destroy.finish",function(){g(e.hotspots.slice(0)),h=!1}),Human.events.on("timeline.chapters.activated",function(a){h||(f(d.global),h=!0);var b=e.hotspots.filter(function(a){return!d.global[a.id]});g(b);var c=a.newChapterIndex.toString(),i=d.byChapter;i.hasOwnProperty(c)&&f(i[c])})}}}]),a.module("humanUI.hotspots").factory("HotspotData",["$timeout","Human","currentModule",function(b,c,d){var e={all:{},global:{},byChapter:{},byName:{}},f=Object.keys(e),g=1;e.getCurrentId=function(){return g},e.add=function(b,c){a.isDefined(b.id)&&(b.name=b.id,delete b.id),b.id=g,this.all[b.id.toString()]=b,a.isDefined(c)&&(b.chapterScope=c),a.isDefined(b.chapterScope)?(c=b.chapterScope.toString(),this.byChapter[c]||(this.byChapter[c]=[]),this.byChapter[c].push(b)):this.global[b.id.toString()]=b,a.isDefined(b.name)&&(this.byName[b.name]=b),g++},e.update=function(b,c){var d=this.all[b.toString()];if(c.hasOwnProperty("chapterScope")){var e=d.chapterScope,f=c.chapterScope;if(d.hasOwnProperty("chapterScope")){var g=this.byChapter[e].indexOf(d);this.byChapter[e].splice(g,1)}else delete this.global[d.id];a.isDefined(f)?(this.byChapter[f]||(this.byChapter[f]=[]),this.byChapter[f].push(d)):(delete c.chapterScope,delete d.chapterScope,this.global[d.id]=d)}if(c.hasOwnProperty("name")){var h=d.name,i=c.name;d.hasOwnProperty("name")&&delete this.byName[h],a.isDefined(i)?this.byName[i]=d:(delete c.name,delete d.name)}a.extend(d,c)},e.remove=function(b){delete this.all[b],this.global[b]&&delete this.global[b];var c,d,e;for(c in this.byChapter)if(this.byChapter.hasOwnProperty(c)){var f=this.byChapter[c];for(d=0;d<f.length;d++)if(b===f[d].id){e=d;break}if(a.isDefined(e)){f.splice(e,1);break}}for(c in this.byName)if(this.byName.hasOwnProperty(c)&&b===this.byName[c].id){delete this.byName[c];break}},e.removeAll=function(){for(var a,b,c=0;c<f.length;c++){b=this[f[c]];for(a in b)b.hasOwnProperty(a)&&(b[a]=void 0,delete b[a])}};var h=function(){var b=d.data;b.hotspots&&b.hotspots.length&&a.forEach(b.hotspots,function(a){e.add(a)}),b.chapters&&b.chapters.length&&a.forEach(b.chapters,function(b,c){b.hotspots&&b.hotspots.length&&a.forEach(b.hotspots,function(a){e.add(a,c)})})};return c.events.on("modules.activate.start",function(a){c.modules.activeModules[a.moduleId]||(e.removeAll(),h())}),e}]),a.module("humanUI.hotspots").constant("HOTSPOT_TEMPLATES",{circle:'<div class="outer"><div class="inner"></div></div>',label:"<h1>{{ title }}</h1>"}).constant("HOTSPOT_CLASSES",{circle:"circle",plus:"plus",minus:"minus",label:"label",left:"left",singleLine:"single-line",pulse:"pulse",pulseHover:"pulse-hover",showHover:"show-hover"}).factory("HOTSPOT_TYPES",["HOTSPOT_TEMPLATES","HOTSPOT_CLASSES",function(a,b){return{circle:{template:a.circle,classes:[b.circle],variations:[b.pulse,b.pulseHover]},circlePlus:{template:a.circle,classes:[b.circle,b.plus],variations:[b.pulse,b.pulseHover]},circleMinus:{template:a.circle,classes:[b.circle,b.minus],variations:[b.pulse,b.pulseHover]},label:{template:a.label,classes:[b.label],variations:[b.left,b.singleLine]},circleLabel:{template:a.circle+a.label,classes:[b.circle,b.label],variations:[b.plus,b.minus,b.pulse,b.pulseHover,b.showHover,b.left,b.singleLine]}}}]),a.module("humanUI.hotspots").factory("Hotspot",["$window","$filter","$interpolate","HOTSPOT_TYPES","HotspotData","Human","HumanActions",function(b,c,d,e,f,g,h){var i,j,k,l,m,n,o=.9,p=80,q=100,r=[],s=[],t=[],u=b.document.getElementById(g.CANVAS_ID),v=function(c){var d=a.copy(c);for(var e in d)d.hasOwnProperty(e)&&(this[e]=d[e]);if(a.isDefined(this.shown)||(this.shown=!0),!this.pos&&this.objectId){var f=g.scene.objects[this.objectId];f&&(this.pos=g.scene.objects[this.objectId].getCenter())}a.isArray(this.dir)&&b.vec3.normalize(this.dir,this.dir),this._buildType(),this.createElement(),this.bindEngineHandlers(),this._displayUpdate={id:this.id},this._positionUpdate={id:this.id},this._userUpdate={id:this.id},this.setObjectShown(),this.setCanvasPos()};v.TAG_NAME="human-hotspot",v.parentElement=null,v.hotspots=[],v.create=function(a){var b=new v(a);return v.hotspots.push(b),b},v.get=function(a){for(var b=0;b<v.hotspots.length;b++)if(v.hotspots[b].id===a)return v.hotspots[b];return null},v.destroy=function(a){var b=v.hotspots.indexOf(a);v.hotspots.splice(b,1),a.unRender(),a.unbindEngineHandlers(),a=void 0},v.prototype._buildType=function(){var a=c("camelCaseNormalize")(this.type);if(a&&e[a]){var b=e[a],d=b.classes.join(" ");this.className=this.className?[d,this.className].join(" "):d,this.template=b.template,b.title&&(this.title=b.title)}},v.prototype._setCanvasDims=function(){k=u.getBoundingClientRect(),this._canvasWidth=k.width,this._canvasHeight=k.height};var w,x,y;v.prototype._getViewAngle=function(){return this.dir?(w=g.view.camera.eye,t[0]=w.x,t[1]=w.y,t[2]=w.z,b.vec3.subtract(t,t,this.pos),b.vec3.normalize(t,t),x=b.Math.min(b.vec3.dot(t,this.dir),1),y=b.Math.acos(x)*(180/b.Math.PI)):0},v.prototype._getViewPos=function(){return i=g.renderer.getViewMat(),r=b.vec3?b.vec3.transformMat4(r,this.pos,i):g.math.transformPoint3(i,this.pos),r[3]=1,r},v.prototype._getCanvasPos=function(a){return j=g.renderer.getProjMat(),s=b.vec4?b.vec4.transformMat4(s,a,j):g.math.transformPoint4(j,a),l=s[0],m=s[1],n=s[3],this._setCanvasDims(),[(1+l/n)*this._canvasWidth/2,(1-m/n)*this._canvasHeight/2]},v.prototype.getContext=function(){var b=f.byName,c={self:f.all[this.id]||{}};return a.extend({},b,c)},v.prototype.doActions=function(){this.actions&&h.parse(this.actions,this.getContext())},v.prototype.createElement=function(){var e=b.document.createElement(v.TAG_NAME);if(this.name&&e.setAttribute("name",this.name),this.className&&(e.className=this.className),this.template&&(e.innerHTML=d(this.template)(this)),this.actions){var f=h.JOIN_CHARACTER;e.setAttribute("actions",this.actions.join(f))}if(this.pos&&e.setAttribute("pos",this.pos.join(",")),this.objectId&&e.setAttribute("object-id",this.objectId),a.isObject(this.data)){var g,i;a.forEach(this.data,function(b,d){g=c("dashNormalize")(d),i=a.isObject(b)?a.toJson(b):b,e.setAttribute("data-"+g,i)})}return a.element(e).data("hotspot",this),this.element=e,e},v.prototype.render=function(){this._rendered||(v.parentElement.appendChild(this.element),this.setCanvasPos(),this.unbindDOMHandlers(),this.bindDOMHandlers(),this._rendered=!0)},v.prototype.unRender=function(){this._rendered&&(this.unbindDOMHandlers(),v.parentElement.removeChild(this.element),this._rendered=!1)};var z,A,B,C;v.prototype._setOpacity=function(){this.dir&&(this._viewAngle>=p?(A=this._viewAngle-p,B=q-p,C=A/B*o,z=b.Math.max(1-C,0)):z=o,this.element.style.opacity=z)},v.prototype._setTranslation=function(){this.element.style.transform="translate("+this.canvasPos[0]+"px,"+this.canvasPos[1]+"px)"};var D,E,F;return v.prototype.setDisplay=function(){D=this.objectShown||!a.isDefined(this.objectShown),E=this.shown&&this.inView&&D,this.element&&(this.element.style.display=E?"block":"none"),this._displayUpdate.inView=this.inView,this._displayUpdate.shown=this.shown,a.isDefined(this.objectShown)&&(this._displayUpdate.objectShown=this.objectShown),g.events.fire("hotspots.displayUpdated",this._displayUpdate)},v.prototype._getInView=function(a){return this._viewAngle<q&&this.canvasPos[0]>0&&this.canvasPos[0]<this._canvasWidth&&this.canvasPos[1]>0&&this.canvasPos[1]<this._canvasHeight&&a[2]<=0},v.prototype.setCanvasPos=function(){this.pos&&(r=this._getViewPos(),this.canvasPos=this._getCanvasPos(r),this._viewAngle=this._getViewAngle(),F=this._getInView(r),F!==this.inView&&(this.inView=F,this.setDisplay()),this.element&&(this._setOpacity(),this._setTranslation()),this._positionUpdate.canvasPos=this.canvasPos,g.events.fire("hotspots.positionUpdated",this._positionUpdate))},v.prototype.setObjectShown=function(){var b=g.scene.objects[this.objectId];if(this.objectId&&b){var c=arguments[0];if(a.isObject(c)&&c.enabledObjectsUpdate){var d=c.enabledObjectsUpdate;if(!d.hasOwnProperty(this.objectId))return;D=d[this.objectId]}else D=b.shown;D!==this.objectShown&&(this.objectShown=D,this.setDisplay())}},v.prototype.setShown=function(a){a!==this.shown&&(this.shown=a,this.setDisplay())},v.prototype.bindEngineHandlers=function(){this._boundSetPos=this.setCanvasPos.bind(this),g.events.on("camera.updated",this._boundSetPos),g.events.on("canvas.resized",this._boundSetPos),this._boundSetObjectShown=this.setObjectShown.bind(this),g.events.on("scene.objectsShown",this._boundSetObjectShown)},v.prototype.unbindEngineHandlers=function(){a.isFunction(this._boundSetPos)&&(g.events.off("camera.updated",this._boundSetPos),g.events.off("canvas.resized",this._boundSetPos),this._boundSetPos=void 0),a.isFunction(this._boundSetObjectShown)&&(g.events.off("scene.objectsShown",this._boundSetObjectShown),this._boundSetObjectShown=void 0)},v.prototype._onClick=function(){this.doActions(),g.events.fire("hotspots.picked",this._userUpdate)},v.prototype._onEnter=function(){g.events.fire("hotspots.entered",this._userUpdate)},v.prototype._onLeave=function(){g.events.fire("hotspots.left",this._userUpdate)},v.prototype.bindDOMHandlers=function(){this._boundOnClick=this._onClick.bind(this),this._boundOnEnter=this._onEnter.bind(this),this._boundOnLeave=this._onLeave.bind(this),this.element.addEventListener("click",this._boundOnClick),this.element.addEventListener("mouseenter",this._boundOnEnter),this.element.addEventListener("mouseleave",this._boundOnLeave)},v.prototype.unbindDOMHandlers=function(){a.isFunction(this._boundOnClick)&&(this.element.removeEventListener("click",this._boundOnClick),this._boundOnClick=void 0),a.isFunction(this._boundOnEnter)&&(this.element.removeEventListener("mouseenter",this._boundOnEnter),this._boundOnEnter=void 0),a.isFunction(this._boundOnLeave)&&(this.element.removeEventListener("mouseleave",this._boundOnLeave),this._boundOnLeave=void 0)},v}]),a.module("humanUI.actions",[]).factory("HumanActions",["$timeout","HumanParser",function(b,c){var d={},e=/Async$/,f=function(g,h,i){if(0===g.length)return void b(i);var j=g.shift().split(":"),k=j.shift(),l=j,m=f.bind(null,g,h,i);m=b.bind(null,m,0);var n=!1;if(e.test(k)&&(k=k.replace(e,""),n=!0),d.hasOwnProperty(k)){for(var o=d[k],p=a.extend({},o.context,h),q=0;q<l.length;q++)l[q]=c.parse(l[q])(p);var r=n?a.noop:m;l=[k].concat(l,r),o.fn.apply(null,l),n&&m()}else m()},g={JOIN_CHARACTER:"|",get:function(){return Object.keys(d)},getContext:function(a){var b=d[a];return b?b.context:void 0},getMetaData:function(a){var b=d[a];return b?b.metaData:void 0},define:function(b,c,e,f){var g={fn:c||a.noop,context:e||{},metaData:f||{}};a.isArray(b)||(b=[b]);for(var h=0;h<b.length;h++)d[b[h]]=g},parse:function(){var b,c,d=arguments[0];1===arguments.length?(b={},c=a.noop):2===arguments.length?a.isFunction(arguments[1])?(b={},c=arguments[1]):(b=arguments[1],c=a.noop):3===arguments.length&&(b=arguments[1],c=arguments[2]),a.isString(d)&&(d=d.split(this.JOIN_CHARACTER)),f(d.slice(0),b,c)}};return g}]).run(["$window","$timeout","Human","currentModule","HumanBackground","HumanActions","Hotspot",function(b,c,d,e,f,g,h){var i,j={},k={currentTime:function(){return d.timeline.time}},l=function(){var a;for(a in j)j.hasOwnProperty(a)&&delete j[a];for(a in e.data)e.data.hasOwnProperty(a)&&(j[a]=e.data[a]);for(a in k)k.hasOwnProperty(a)&&(j[a]=k[a])};d.events.on("modules.activate.start",function(a){d.modules.activeModules[a.moduleId]||l()}),d.events.on("timeline.chapters.activated",function(a){j.currentChapter=j.chapters?j.chapters[a.newChapterIndex]:null});var m=function(a){var b=j.chapters.indexOf(a),c=d.timeline.activeRoot._chapters[b];return c},n=function(a,b){var c=j.chapters[a].annotations.indexOf(b),e=new RegExp(a+"\\."+c+"$"),f=d.view.annotations.annotations;for(var g in f)if(f.hasOwnProperty(g)&&e.test(g))return f[g]},o=function(c,d,e,f,g){a.isArray(c)||(c=[c]),a.isArray(d)||(d=[d]);var h,i=[],j=[];for(h=0;h<c.length;h++)j.push(c[h]),i.push((d[h]-c[h])/e);var k,l,m=0,n=function(a){for(l||(l=a),k=a-l,m+=k,l=a,h=0;h<i.length;h++)j[h]+=k*i[h];e>m?(f(j),b.requestAnimationFrame(n)):(f(d),
  g(),b.cancelAnimationFrame(o))},o=b.requestAnimationFrame(n)},p=function(a,c,e,f,g){var i=b.document.getElementById(d.CONTAINER_ID),j=function(a){i.style.opacity=a[0],h.parentElement.style.opacity=a[0]};o(c,e,1e3*f,j,g)};i={arity:3},g.define(["tweenOpacity"],p,j,i);var q=function(a,b,c,d,e){var g=[function(a){f.setColors(a)},function(a){f.setColorStops(a)}],h=g[r.indexOf(a)];o(b,c,1e3*d,h,e)},r=["tweenBackgroundColors","tweenBackgroundColorStops"];i={arity:3},g.define(r,q,j,i);var s=function(a,c,d){var e,f,g=1e3*c,h=function(a){e||(e=a),f=a-e,b.Math.round(f)<g?b.requestAnimationFrame(h):d()};b.requestAnimationFrame(h)};i={arity:1},g.define(["wait"],s,j,i);var t=function(b,c,e){var f="showObjects"===b,g={};a.isArray(c)||(c=[c]);for(var h=0;h<c.length;h++)g[c[h]]=f;d.scene.setEnabledObjects({objects:g}),e()};i={arity:1},g.define(["hideObjects","showObjects"],t,j,i);var u=function(a,b,c){d.view.camera.fly[a](b,c)};i={arity:1},g.define(["flyTo","jumpTo"],u,j,i);var v=function(){var b=Array.prototype.slice.call(arguments),c=b.shift(),e=b.pop(),f=b[0],g=b[1],h={},i=!0,j=!a.isDefined(f)&&!a.isDefined(g),k=a.isDefined(f)&&!a.isDefined(g),l=a.isDefined(f)&&a.isDefined(g);if(j)h.startTime=d.timeline.time;else if(k){if(a.isFunction(f))h.startTime=f();else if(a.isNumber(f))h.startTime=f;else if(a.isObject(f)){h.startChapterId=m(f).id,h.numChapters=1;var n=m(f).animation;n&&n.loop&&(i=!1)}}else l&&(a.isFunction(f)?h.startTime=f():a.isNumber(f)?h.startTime=f:a.isObject(f)&&(h.startChapterId=m(f).id),a.isFunction(g)?h.finishTime=g():a.isNumber(g)?h.finishTime=g:a.isObject(g)&&(h.finishChapterId=m(g).id),(a.isNumber(f)||a.isNumber(g))&&(h.align=!1));i&&d.events.once("timeline.stopped",e),d.timeline[c](h),i||e()};i={arity:[0,2]},g.define(["play"],v,j,i);var w=function(b,c,e){var f={};a.isNumber(c)?f.time=c:a.isObject(c)&&(f.chapterId=m(c).id),d.timeline.scrub(f),e()};i={arity:1},g.define(["scrub"],w,j,i);var x=function(a,b,c){d.timeline.stop(),c()};i={arity:0},g.define(["stop"],x,j,i);var y=function(){for(var a=Array.prototype.slice.call(arguments),b=a.shift(),c=a.pop(),e=d.timeline.activeRoot._nowBranch,f=d.timeline.activeRoot._chapters.indexOf(e),g=0;g<a.length;g++){var h=n(f,a[g]);h&&h.setShown("showAnnotations"===b)}c()};i={arity:[1,1/0]},g.define(["hideAnnotations","showAnnotations"],y,j,i);var z=function(){for(var a=Array.prototype.slice.call(arguments),b=a.shift(),c=a.pop(),d=0;d<a.length;d++){var e=h.get(a[d].id);e&&e.setShown("showHotspots"===b)}c()};i={arity:[1,1/0]},g.define(["hideHotspots","showHotspots"],z,j,i)}]),a.module("humanUI.parser",[]).factory("HumanParser",function(){function b(a){var b=c[a];if(b)return b;var d=a.split("."),e="";d.forEach(function(a){e+="if(s == null) return undefined;\ns=s."+a+";\n"}),e+="return s;";var f=new Function("s",e);return f.toString=function(){return e},b=f,c[a]=b,b}var c={},d={},e=function(a){this.lexer=a};e.prototype={parse:function(b){this.text=b,this.tokens=this.lexer.lex(b);var c=a.noop;if(this.tokens.length>0&&(c=this.primary()),0!==this.tokens.length)throw new Error("Unexpected token");return c},primary:function(){var a;if(this.peek().identifier)a=this.identifier();else{if(!this.peek().constant)throw new Error("Not a valid expression");a=this.constant()}for(var b;b=this.expect("[",".");)"["===b.text?a=this.objectIndex(a):"."===b.text&&(a=this.fieldAccess(a));return a},fieldAccess:function(a){var b=this.identifier();return function(c){var d=a(c);return null==d?void 0:b(d)}},objectIndex:function(a){var b=this.primary();return this.consume("]"),function(c){var d=a(c),e=b(c);return d?d[e]:void 0}},identifier:function(){for(var a=this.consume().text;this.peek(".")&&this.peekAhead(1).identifier;)a+=this.consume().text+this.consume().text;return b(a)},constant:function(){function a(){return b}var b=this.consume().value;return a.constant=!0,a.literal=!0,a},consume:function(a){if(0===this.tokens.length)throw new Error("Unexpected end of expression");var b=this.expect(a);if(!b)throw new Error("Unexpected token");return b},expect:function(a,b,c,d){var e=this.peek(a,b,c,d);return e?(this.tokens.shift(),e):!1},peek:function(a,b,c,d){return this.peekAhead(0,a,b,c,d)},peekAhead:function(a,b,c,d,e){if(this.tokens.length>a){var f=this.tokens[a],g=f.text;if(g===b||g===c||g===d||g===e||!b&&!c&&!d&&!e)return f}return!1}};var f=function(){};return f.prototype={lex:function(a){for(this.text=a,this.index=0,this.tokens=[];this.index<this.text.length;){var b=this.text.charAt(this.index);this.isNumber(b)||"."===b&&this.isNumber(this.peek())?this.readNumber():this.isValidIdentifierStart(this.peekMultichar())?this.readIdentifier():this.is(b,"[].")?(this.tokens.push({index:this.index,text:b}),this.index++):this.index++}return this.tokens},is:function(a,b){return-1!==b.indexOf(a)},peek:function(a){var b=a||1;return this.index+b<this.text.length?this.text.charAt(this.index+b):!1},peekMultichar:function(){var a=this.text.charAt(this.index),b=this.peek();if(!b)return a;var c=a.charCodeAt(0),d=b.charCodeAt(0);return c>=55296&&56319>=c&&d>=56320&&57343>=d?a+b:a},isNumber:function(a){return a>="0"&&"9">=a&&"string"==typeof a},isValidIdentifierStart:function(a){return a>="a"&&"z">=a||a>="A"&&"Z">=a||"_"===a||"$"===a},isValidIdentifierContinue:function(a){return this.isValidIdentifierStart(a)||this.isNumber(a)},readNumber:function(){for(var a="",b=this.index;this.index<this.text.length;){var c=this.text.charAt(this.index).toLowerCase();if("."!==c&&!this.isNumber(c))break;a+=c,this.index++}this.tokens.push({index:b,text:a,constant:!0,value:Number(a)})},readIdentifier:function(){var a=this.index;for(this.index+=this.peekMultichar().length;this.index<this.text.length;){var b=this.peekMultichar();if(!this.isValidIdentifierContinue(b))break;this.index+=b.length}this.tokens.push({index:a,text:this.text.slice(a,this.index),identifier:!0})}},{Lexer:f,parse:function(a){var b,c=a=a.trim();if(b=d[c],!b){var g=new f,h=new e(g);b=h.parse(a),d[c]=b}return b}}}),a.module("humanUI.annotations",[]).directive("humanAnnotations",["Human",function(a){return{restrict:"E",scope:!0,templateUrl:"templates/annotations/panel.html",link:function(b){var c=a.view.annotations;b.info="Toggle Annotations",b.toggleAnnotations={on:c.setShown.bind(c,!0),off:c.setShown.bind(c,!1)},a.events.on("annotations.shown",function(a){b.toggleAnnotations.model=a.shown,b.$apply()}),a.events.on("timeline.chapters.activated",function(){b.toggleAnnotations.model=c.shown,b.$apply()}),b.$watch("uiComponents.config.annotations",function(a){b.show=!!a})}}}]),a.module("humanUI.background",[]).factory("HumanBackground",["$window",function(a){return a.HumanBackground||a.console.warn("HumanBackground not found."),a.HumanBackground||{}}]),a.module("humanUI.bookmark",[]).constant("THUMBNAIL_URL","thumbnails/bookmarks?eid").filter("BookmarkTour",["THUMBNAIL_URL",function(b){return function(c){var d=c.tour;return delete c.tour,d.unshift(c),a.forEach(d,function(a){a.tourMember=!0,a.thumbnailSrc=[b,a.eid].join("=")}),d}}]).constant("BOOKMARK_TOUR_BASE_STATE",{isTour:!1,isTourMember:!1,restoring:!1,captures:[],curCapture:null,curCaptureIndex:null}).provider("BookmarkTour",["BOOKMARK_TOUR_BASE_STATE",function(b){var c={compare:!1},d=a.extend({},b),e={newModules:null,oldModules:null},f=function(f,g,h,i,j){var k,l,m,n={},o=function(b){a.forEach(b,function(a){j.modules.isBaseModule(a)&&(l=a.split("/"),m=l[l.length-1].replace(/\.json$/,""),n[m]||j.assets.server.cacheStateIndex(m))})},p=function(b){k=[],a.forEach(b,function(b){o(b.modules.activeModules),k.push(a.copy(b.modules.activeModules))})},q=function(a){d.curCapture=d.captures[a]||null,d.curCaptureIndex=d.curCapture?a:null},r=function(){var b=Object.keys(j.modules.activeModules);a.forEach(b,function(a){j.modules.deactivate(a,{},function(){if(!j.modules.isBaseModule(a)){var b=j.modules.modules[a].rootObjects,c=["tweens","reflections","audio","videos","lights","skyBoxes","geometries","materials","transforms","morph"];j.modules.unload(a,b,c,function(){j.modules.destroy(a)})}})})},s=function(){a.equals(e.oldModules,e.newModules)||j.modules.deactivateModules()},t=function(a){e.oldModules=e.newModules,e.newModules=k[a],c.compare?s():r()};return d.reset=function(){a.extend(d,b)},d.restore=function(b,c){var e=d.captures[b];e&&(d.restoring=!0,q(b),h(function(){t(b),j.bookmarks.restore(e,function(){a.isFunction(c)&&c()})}))},d.onRestored=function(){d.isTour||d.isTourMember||(d.captures=[])},j.events.on("bookmarks.restored",function(b){d.restoring=!1,d.isTour=!(!b.tour||!b.tour.length),d.isTourMember=!!b.tourMember,d.isTour&&(d.captures=g("BookmarkTour")(b),p(d.captures),q(0));var c=a.isArray(d.captures)&&!!d.captures.length;d.bookmarkTour=(d.isTour||d.isTourMember)&&c,d.onRestored(b),f.$broadcast("bookmarkTour.state",d)}),{state:d}};return f.$inject=["$rootScope","$filter","$timeout","$q","Human"],{$get:f,config:function(b){a.extend(c,b)},extend:function(b){a.extend(d,b)}}}]).directive("updateScroll",["$timeout",function(a){return{restrict:"A",link:function(b,c,d){var e,f,g,h,i=d.updateScroll,j=function(b){a(function(){e=c[0].offsetWidth,f=c[0].scrollWidth,f>e&&(g=f/c.children().length,h=f-e,c[0].scrollLeft=g*(b+1)-h)})};b.$watch(i,j)}}}]).directive("prevNextBookmark",["Human","BookmarkTour",function(a,b){return{restrict:"A",link:function(a,c,d){var e,f="next"===d.prevNextBookmark?1:-1;a.state=b.state,c.on("click",function(){e||b.state.restore(a.state.curCaptureIndex+f)});var g={expressions:["state.curCaptureIndex","state.captures.length"],callback:function(a){e=!!(1===f&&a[0]===a[1]-1||-1===f&&0===a[0]),c[e?"addClass":"removeClass"]("disabled")}};a.$watchGroup(g.expressions,g.callback)}}}]).directive("humanBookmarkTour",["$timeout","$document","Human","BookmarkTour",function(a,b,c,d){return{restrict:"E",templateUrl:"templates/bookmark/tour.html",scope:!0,link:function(a){a.show=!1;var b,c,e=function(){a.show=b&&c};a.restore=function(a){d.state.restore(a)},a.reset=function(){d.state.reset()},a.$on("bookmarkTour.state",function(a,b){c=b.bookmarkTour,e()}),a.$watch("uiComponents.config.bookmarkTour",function(a){b=!!a,e()})}}}]),a.module("humanUI.camera",[]).factory("HumanCamera",["$window","Human",function(a,b){var c,d=new Float64Array(3),e=new Float64Array(3),f=new Float64Array(3),g=function(a,b){b[0]=a.x,b[1]=a.y,b[2]=a.z},h=null,i=null,j=!1;b.events.on("bookmarks.restored",function(a){a.camera&&(i=a.camera),j=!0});var k=function(){j&&(i=null,j=!1)};return b.events.on("modules.deactivate.finish",k),b.events.on("modules.destroy.finish",k),{getCenterCamera:function(){return h||i},setCenterCamera:function(a){h=a},getPanRate:function(){return g(b.view.camera.getEye(),d),g(b.view.camera.getLook(),e),a.vec3?(a.vec3.sub(f,d,e),c=a.vec3.length(f)):(b.math.subVec3(d,e,f),c=b.math.lenVec3(f)),.12*c}}}]).directive("centerCamera",["Human","HumanCamera",function(a,b){return{restrict:"A",link:function(c,d){d.on("click",function(){var c=b.getCenterCamera();c?a.view.camera.fly.flyTo(c):a.init.resetCamera()})}}}]).directive("humanCameraCenter",function(){return{restrict:"E",scope:!0,templateUrl:"templates/camera/center.html",link:function(a){a.$watch("uiComponents.config.center",function(b){a.show=!!b})}}}).directive("panCamera",["$interval","Human","HumanCamera","touchTarget","destroyInterval",function(b,c,d,e,f){var g={interval:10},h="touchstart mousedown",i="touchend touchcancel mouseleave mouseup";return{restrict:"A",link:function(j,k,l){var m,n,o,p,q,r=l.panCamera||"up",s=function(){p=g.interval/1e3*d.getPanRate(),q=b(function(){switch(m=0,n=0,o=0,r){case"up":n=-p;break;case"down":n=p;break;case"left":m=-p;break;case"right":m=p}c.view.camera.pan({x:m,y:n,z:o})},g.interval)};e(k[0],function(a){k[0]!==a&&f(q)}),a.forEach(h.split(" "),function(a){k.on(a,function(a){a.preventDefault(),s()})}),a.forEach(i.split(" "),function(a){k.on(a,function(){f(q)})})}}}]).directive("humanCameraPan",function(){var a={up:"W",down:"S",left:"D",right:"A"};return{restrict:"E",scope:!0,templateUrl:"templates/camera/pan.html",link:function(b){b.keys=a,b.$watch("uiComponents.config.pan",function(a){b.show=!!a})}}}).directive("zoomCamera",["Human","touchTarget",function(b,c){var d,e="touchstart mousedown",f="touchend touchcancel mouseleave mouseup",g=.3,h=.001,i=0,j=!1;return b.events.on("tick",function(){return 0!==i?(j&&(i=g*d),i*=b.input.cameraFriction||.85,Math.abs(i)<h?void(i=0):void b.view.camera.zoom(i)):void 0}),{restrict:"A",link:function(b,h,k){var l="out"===k.zoomCamera?1:-1;c(h[0],function(a){h[0]!==a&&(j=!1)}),a.forEach(e.split(" "),function(a){h.on(a,function(a){a.preventDefault(),d=l,i=g*d,j=!0})}),a.forEach(f.split(" "),function(a){h.on(a,function(){j=!1})})}}}]).directive("humanCameraZoomIn",function(){return{restrict:"E",scope:!0,templateUrl:"templates/camera/zoom-in.html",link:function(a){a.$watch("uiComponents.config.zoomIn",function(b){a.show=!!b})}}}).directive("humanCameraZoomOut",function(){return{restrict:"E",scope:!0,templateUrl:"templates/camera/zoom-out.html",link:function(a){a.$watch("uiComponents.config.zoomOut",function(b){a.show=!!b})}}}).directive("humanCameraZoom",function(){return{restrict:"E",scope:!0,templateUrl:"templates/camera/zoom.html",link:function(a){var b=["uiComponents.config.zoomOut","uiComponents.config.zoomIn"];a.$watchGroup(b,function(b){a.show=!!b[0]&&!!b[1]})}}}).directive("humanCameraMode",["$timeout","Human",function(a,b){return{restrict:"E",scope:!0,templateUrl:"templates/camera/mode.html",link:function(c,d){var e=b.properties,f="input.mouseOrbitPan",g={};c.cameraMode={on:function(){g[f]="orbit",e.set(g)},off:function(){g[f]="pan",e.set(g)}};var h=e.subscribe({propId:f,callback:function(b){a(function(){d.attr("mode",b),c.cameraMode.model="orbit"===b,c.mode=b,c.$apply()})}});e.resubscribe(h,f),c.$watch("uiComponents.config.cameraMode",function(a){c.show=!!a})}}}]),a.module("humanUI.config",[]).constant("BASE_CONFIG",{bookmarkTour:!1,annotations:!1,audio:!1,info:!1,loadProgress:!0,fullscreen:!0,pan:!0,zoomIn:!0,zoomOut:!0,center:!0,cameraMode:!0,objectTree:!1,objectSlider:!1,playPause:!1,scrubber:!1,tour:!1,crossSection:!1,dissect:!1,isolate:!1,xray:!1}).constant("CONFIG_GROUPS",{nav:["pan","zoomIn","zoomOut","center","cameraMode"],zoom:["zoomIn","zoomOut"],scene:["objectTree","objectSlider"],tools:["crossSection","dissect","isolate","xray"],modes:["isolate","xray"]}).constant("CONFIG_ALIASES",{loader:"loadProgress",panel:"info",tree:"objectTree",fs:"fullscreen",slider:"objectSlider"}).constant("EXPANDABLE_UI_COMPONENTS",{components:{scrubber:{chapters:!1,tour:!1},tour:{chapters:!1},playPause:{tour:!1},objectSlider:{objects:!1}},notes:{"scrubber.chapters":"Display chapters for scrubber","scrubber.tour":"Play one chapter at a time","tour.chapters":"Display chapters for tours","playPause.tour":"Play one chapter at a time","objectSlider.objects":"Display objects for objectSlider"}}).filter("convertDotKeys",function(){return function(b){for(var c in b)if(b.hasOwnProperty(c)&&/\./.test(c)){var d=c.split(".");a.isObject(b[d[0]])||(b[d[0]]={}),b[d[0]][d[1]]=b[c],delete b[c]}return b}}).filter("convertTags",function(){return function(b,c){return a.isArray(c)&&c.length>0&&(c.has=function(a){return this.indexOf(a)>-1},c.has("scrubber")||c.has("scrubber-chapters")?(b.scrubber=!0,c.has("scrubber-chapters")&&(b.scrubber={chapters:!0},c.has("tour")&&(b.scrubber.tour=!0))):(c.has("play-controls")&&(b.playPause=!0),c.has("tour")&&(b.tour=!0)),delete c.has),b}}).filter("extendConfig",["BASE_CONFIG","CONFIG_ALIASES","CONFIG_GROUPS",function(b,c,d){return function(e,f){return f.hasOwnProperty("all")?a.forEach(b,function(a,b){e[b]=f.all}):(a.forEach(d,function(b,c){f.hasOwnProperty(c)&&a.forEach(b,function(a){e[a]=f[c]})}),a.extend(e,f),a.forEach(d,function(a,b){e.hasOwnProperty(b)&&delete e[b]}),a.forEach(c,function(a,b){e.hasOwnProperty(b)&&(e[a]=e[b],delete e[b])})),e}}]).filter("convertUiParams",["CONFIG_ALIASES","convertDotKeysFilter",function(b,c){var d=/^ui-/,e=function(a){return"true"===a?!0:"false"===a||""===a?!1:a};return function(f){var g={};return a.forEach(f,function(a,c){(d.test(c)||b.hasOwnProperty(c))&&(c=c.replace(d,"").replace(/-([a-z])/g,function(a){return a[1].toUpperCase()}),g[c]=e(a))}),c(g),g}}]).provider("ConfigCreator",function(){var b=function(b,c,d,e,f){var g=d("extendConfig"),h=d("convertTags"),i=d("convertUiParams"),j=d("convertDotKeys"),k=function(){var a={},c=b.location.search.slice(1);c=c.replace(/&amp;/g,"&");for(var d,e=c.split("&"),f=0;f<e.length;f++)d=e[f].split("="),a[d[0]]=d[1];return a};return{config:{},urlConfig:i(k()),bookmarkConfig:{},contentConfig:{},applicationConfig:{},init:function(){var a=this;c.uiComponents={config:this.config},f.events.on("modules.activate.start",function(b){if(!f.modules.activeModules[b.moduleId]){var c=f.modules.modules[b.moduleId];a._buildContentConfig(c),a._extend(),a._apply()}});var b=!1;c.$on("bookmarkTour.state",function(c,d){d.bookmarkTour!==b&&(b=d.bookmarkTour,a.bookmarkConfig.bookmarkTour=d.bookmarkTour,a._extend(),a._apply())})},_buildContentConfig:function(a){var b=h({},a.tags);g(b,a.ui||{}),this.contentConfig=b},_buildApplicationConfig:function(a){a=j(a||{}),g(this.applicationConfig,a)},_extend:function(){for(var b=a.extend({},e),c=[this.contentConfig,this.bookmarkConfig],d=0;d<c.length;d++)g(b,c[d]);return g(b,this.urlConfig),g(b,this.applicationConfig),this.config=b,this.config},_apply:function(a){c.uiComponents.config=this.config,c[a?"$applyAsync":"$apply"]()}}};return b.$inject=["$window","$rootScope","$filter","BASE_CONFIG","Human"],{$get:b}}),a.module("humanUI.crossSection",[]).factory("Clip",["Human",function(b){return{MAP:[{view:"Anterior",clip:b.view.clip.FRONT},{view:"Posterior",clip:b.view.clip.BACK},{view:"Left",clip:b.view.clip.LEFT},{view:"Right",clip:b.view.clip.RIGHT},{view:"Superior",clip:b.view.clip.TOP},{view:"Inferior",clip:b.view.clip.BOTTOM}],state:{current:null},show:function(a){b.view.clip.setClip({state:"clipping"}),b.view.clip.selectClip(a),b.view.clip.setClip({state:"visible"})},reset:function(){a.forEach(b.view.clip.clips,function(a){a.progress=0}),b.view.clip.reset(),this.state.current=this.MAP[0],this.show(this.state.current.clip)}}}]).directive("humanCameraClip",["$window","Human",function(a,b){var c,d=a.vec3&&a.vec3.create||b.math.vec3,e=d(),f=d(),g=d(),h=b.view.camera,i=h.near,j=function(){return e[0]=h.eye.x,e[1]=h.eye.y,e[2]=h.eye.z,f[0]=h.look.x,f[1]=h.look.y,f[2]=h.look.z,a.vec3?(a.vec3.sub(g,e,f),c=a.vec3.length(g)):(b.math.subVec3(e,f,g),c=b.math.lenVec3(g)),a.Math.abs(c)},k=function(){b.properties.set({"camera.optics.near":.75*j()})};return{restrict:"E",scope:!0,templateUrl:"templates/cross-section/camera-clip.html",link:function(a){var c=function(b){a.toggleCameraClip.model=b,a.$apply()};a.toggleCameraClip={on:function(){b.events.on("camera.updated",k),k(),c(!0)},off:function(){b.events.off("camera.updated",k),b.properties.set({"camera.optics.near":i}),c(!1)}}}}}]).directive("cycleSectionPlane",["Clip",function(a){return{restrict:"A",link:function(b,c){c.on("click",function(){var c=a.state.current?a.MAP.indexOf(a.state.current):0;c=c===a.MAP.length-1?0:c+1,a.state.current=a.MAP[c],a.show(a.state.current.clip),b.$apply()})}}}]).directive("resetSectionPlane",["Clip",function(a){return{restrict:"A",link:function(b,c){c.on("click",function(){a.reset(),b.$apply()})}}}]).directive("humanCrossSectionSlider",["Human",function(a){return{restrict:"E",scope:!0,templateUrl:"templates/cross-section/slider.html",link:function(b){b.config={value:0,change:function(b){a.view.clip.setClip({state:"visible",progress:b.fraction}),0===b.fraction&&a.view.clip.selectedClip._setProgress(0)}},a.events.on("clip.updated",function(a){b.config.value=a.progress||0,b.$apply()})}}}]).directive("humanCrossSection",["$parse","$timeout","Clip",function(b,c,d){return{restrict:"E",scope:!0,templateUrl:"templates/cross-section/controls.html",link:function(e,f,g){var h=function(a){c(function(){Human.view.clip.setClip({clipId:d.state.current.clipId,state:a?"visible":"clipping"})})};d.state.current=d.MAP[0],e.state=d.state,e.tooltipText={select:"Select Plane",reset:"Reset"},g.tooltipText&&a.extend(e.tooltipText,b(g.tooltipText)({})),f.on("crossSectionToggle",function(a,b){h(b)})}}}]).directive("humanCrossSectionToggle",["$document","Clip","ElementDisplay",function(b,c,d){return{restrict:"E",scope:!0,templateUrl:"templates/cross-section/toggle.html",link:function(c,e,f){var g;g=f.hasOwnProperty("target")?a.element(b[0].querySelector(f.target)):e.next(),d.create({trigger:e,target:g,eventName:"crossSectionToggle",globalClose:f.hasOwnProperty("globalClose")}),e.on("crossSectionToggle",function(a,b){c.callbacks.model=b,c.$apply()}),c.info="Cross Section",c.callbacks={on:a.noop,off:a.noop},c.$watch("uiComponents.config.crossSection",function(a){c.show=!!a})}}}]),a.module("humanUI.dissect",[]).directive("undoDissect",["Human",function(a){return{restrict:"A",scope:!0,link:function(b,c){var d=!0;c.addClass("disabled"),c.on("click",function(){d||a.view.dissect.undo()}),a.events.on("dissect.toggled",function(a){d=!a.enabled,c[d?"addClass":"removeClass"]("disabled")})}}}]).directive("humanDissectUndo",function(){return{restrict:"E",scope:!0,templateUrl:"templates/dissect/undo.html",link:function(a){a.info="Undo Dissect [Ctrl + Z]",a.$watch("uiComponents.config.dissect",function(b){a.show=!!b})}}}).directive("humanDissect",["$parse","Human",function(a,b){return{restrict:"E",scope:!0,templateUrl:"templates/dissect/dissect.html",link:function(a){var c=function(a){b.rpc.call(null,"dissect.setEnabled",{enabled:a})};a.info="Dissect [Ctrl + X]",a.toggleDissect={on:c.bind(null,!0),off:c.bind(null,!1)},b.events.on("dissect.toggled",function(b){a.toggleDissect.model=b.enabled,a.$apply()}),a.$watch("uiComponents.config.dissect",function(b){a.show=!!b})}}}]),a.module("humanUI.fullscreen",[]).factory("Fullscreen",["$document","$rootScope",function(b,c){var d,e=b[0],f=e.documentElement,g={request:[f.requestFullscreen,f.webkitRequestFullscreen,f.mozRequestFullScreen,f.msRequestFullscreen],exit:[e.exitFullscreen,e.webkitExitFullscreen,e.mozCancelFullScreen,e.msExitFullscreen]};return{VENDOR_PREFIXES:["","webkit","moz","ms"],setMethods:function(){var b,c={};for(var d in g)if(g.hasOwnProperty(d)){b=g[d];for(var h=0;h<b.length;h++)if(a.isFunction(b[h])){c[d]=b[h];break}if(!c[d])return!1}return this.request=c.request.bind(f),this.exit=c.exit.bind(e),!0},isActive:function(){return d=e.fullscreenElement||e.webkitFullscreenElement||e.mozFullScreenElement||e.msFullscreenElement||void 0,!!d},bindHandlers:function(){var d,f=this;b.on("keypress",function(a){var b=a.target.nodeName.toLowerCase();"input"!==b&&"textarea"!==b&&70===a.which&&a.shiftKey&&f.toggle()}),a.forEach(this.VENDOR_PREFIXES,function(a){var b=a+"fullscreenchange";e.addEventListener(b,function(){d=f.isActive(),c.$broadcast("fullscreen.change",{active:d,fromUI:f._fromUI}),f._fromUI=!1},!1)})},_fromUI:!1,toggle:function(){this._fromUI=!0,this[this.isActive()?"exit":"request"]()}}}]).directive("humanFullscreen",["$window","Fullscreen",function(a,b){var c=a===a.top;return{restrict:"E",scope:!0,templateUrl:"templates/fullscreen/panel.html",link:function(a){a.toggleFullscreen={on:b.toggle.bind(b),off:b.toggle.bind(b)},a.$on("fullscreen.change",function(b,c){a.toggleFullscreen.model=c.active,a.mode=c.active?"fullscreen":"normalscreen",a.$digest()}),a.$watch("uiComponents.config.fullscreen",function(b){a.show=c&&!!b})}}}]).directive("windowLink",["$window",function(a){return{restrict:"A",link:function(b,c){c.attr("href",a.location.href)}}}]).directive("humanWindowLink",["$window",function(a){var b=a===a.top;return{restrict:"E",scope:!0,templateUrl:"templates/fullscreen/window-link.html",link:function(a){a.$watch("uiComponents.config.fullscreen",function(c){a.show=!b&&!!c})}}}]).run(["Fullscreen",function(a){var b=a.setMethods();b&&a.bindHandlers()}]),a.module("humanUI.info",[]).run(["Info",function(a){a._instantiated=!0}]).provider("Info",function(){var b={baseAnatomy:!1,modifyLinks:!0,props:["title","displayName","description"],precedence:["bookmark","chapter","module"]},c={info:{bookmark:null,chapter:null,module:null},bookmarkRestoring:!1,current:null,precedence:a.copy(b.precedence)},d=function(d,e){var f=function(){for(var d,e=0;e<b.precedence.length;e++)if(d=c.info[b.precedence[e]],a.isObject(d)&&(d.title||d.description))return void(c.current=b.precedence[e]);c.current=null},g=function(d){b.precedence=a.copy(d),c.precedence=d,f()},h=function(a,e){if(!c.info.hasOwnProperty(a)||!e)return null;"chapter"===a&&e.info&&(e=e.info);for(var g={},h=0;h<b.props.length;h++){var i=b.props[h];if(e.hasOwnProperty(i)){var j=e[i];"displayName"===i&&(i="title"),b.modifyLinks&&(j=d("modifyLinks")(j)),g[i]=j}}c.info[a]=g,f()},i=function(){for(var a in c.info)c.info.hasOwnProperty(a)&&(c.info[a]=null)};return e.events.on("bookmarks.restoring",function(){c.bookmarkRestoring=!0}),e.events.on("bookmarks.restored",function(a){c.bookmarkRestoring=!1,h("bookmark",a)}),e.events.on("timeline.chapters.activated",function(a){h("chapter",e.timeline.activeRoot._chapters[a.newChapterIndex])}),e.events.on("modules.activate.finish",function(a){var c=e.modules.activeModules[a.moduleId];b.baseAnatomy||(c=d("excludeBaseAnatomy")(c)),h("module",c)}),e.events.on("modules.deactivate.finish",i),{state:c,setPrecedence:g,setInfo:h}};return d.$inject=["$filter","Human"],{$get:d,config:function(c){a.extend(b,c)}}}).filter("modifyLinks",["$document",function(b){var c=b[0];return function(b){var d=c.createElement("div");d.innerHTML=b;var e=d.querySelectorAll("a");return a.forEach(e,function(a){/^(http)|(\/\/)/.test(a.href)&&a.setAttribute("target","_blank")}),d.innerHTML}}]).directive("humanInfo",["$filter","Info",function(b,c){return{restrict:"A",scope:!0,link:function(d){var e=function(){var e=c.state.current;if(e&&!c.state.bookmarkRestoring){var f=a.copy(c.state.info[e]);f.description&&(f.description=b("parseActions")(f.description)),d.info=f}else d.info=null};d.state=c.state,d.info=null,d.show=!1,d.$watch("state.current",e),d.$watchCollection("state.info",e),d.$watch("info",function(a){d.show=!!a})}}}]),a.module("humanUI.load",[]).directive("humanLoadProgress",["Human","$timeout",function(b,c){var d="geometry material transform morph";return{restrict:"E",scope:!0,templateUrl:"templates/load/progress.html",link:function(e,f,g){var h,i=g.showAssetTypes||d,j=!1;e.statusText="Loading...",e.progressPercent="0%",b.events.on("modules.activate.start",function(a){j=!1;var c=b.modules.modules[a.moduleId];e.statusText="Loading "+c.displayName+"..."}),b.events.on("assets.load.start",function(){e.show=h&&!j,e.$digest()}),b.events.on("assets.load.progress",function(a){if(!j){var b=a.receivedAssets/a.requestedAssets;e.curAssetType=a.assetType,e.progressPercent=Math.floor(100*b)+"%",e.show=h&&i.indexOf(a.assetType)>=0,f[0].style.width=e.progressPercent,e.$digest()}}),b.events.on("assets.load.finish",function(){c(function(){e.progressPercent="0%",e.statusText="",e.show=!1,e.$digest()})}),b.events.on("module.interactive",function(){j=!0}),e.$watch("uiComponents.config.loadProgress",function(b){a.isString(b)&&!f.hasClass(b)&&f.addClass(b),h=!!b})}}}]),a.module("humanUI.media",[]).constant("AUDIO_TYPES",{ogg:'audio/ogg;codecs="vorbis"',mp3:"audio/mpeg;"}).constant("AUDIO_PATH","/content/states/{{ fullUrl }}").factory("Media",["$document","$interpolate","AUDIO_TYPES","AUDIO_PATH",function(a,b,c,d){var e={},f={};return{supportTest:function(b){if(e.hasOwnProperty(b))return e[b];if(!b&&e.hasOwnProperty("audio"))return e.audio;var d=a[0].createElement("audio"),f=!!d.canPlayType;return b?(f=f&&!!d.canPlayType(c[b]||b),e[b]=f):e.audio=f,f},getSupportedSrc:function(a){if(f[a.clipId])return f[a.clipId];var c=b(d)({fullUrl:a.fullUrl}),e=c.match(/\.(\w+)$/);e=e&&e[1];for(var g=[e].concat(a.alternatives||[]),h=0;h<g.length;h++)if(this.supportTest(g[h]))return f[a.clipId]=c.replace(/\.\w+$/,"."+g[h]),f[a.clipId];return!1}}}]).directive("muteReplayAudio",function(){return{restrict:"A",scope:!0,link:function(b,c){c.on("click",function(){b[b.states.ended?"replay":"toggleMute"](),b.$apply()}),b.$watch("states",function(b){a.forEach(["ended","muted"],function(a){c[b[a]?"addClass":"removeClass"](a)})},!0)}}}).directive("humanAudio",["$q","Human","Media",function(a,b,c){return{restrict:"E",scope:!0,templateUrl:"templates/media/audio.html",link:function(a,d){var e=d.find("audio")[0],f=!1,g=!1,h=function(){a.show=f&&g};a.states={ended:!1,muted:!1},a.replay=function(){e.currentTime=0,e.play(),a.states.ended=!1},a.toggleMute=function(){e.muted=!e.muted,a.states.muted=e.muted},e.addEventListener("ended",function(){a.states.ended=!0,a.$apply()}),e.addEventListener("playing",function(){a.states.ended=!1,a.$apply()}),b.events.on("audio.suggestedClipInfo",function(b){e.src=c.getSupportedSrc(b),g=!!e.src,h(),a.$apply()}),a.$watch("uiComponents.config.audio",function(a){f=!!a,h()})}}}]),a.module("humanUI.modes",[]).directive("humanXray",["Human",function(a){return{restrict:"E",scope:!0,templateUrl:"templates/modes/xray.html",link:function(b){b.info="X-Ray Mode [T]",b.toggleXray={on:a.view.setModeEnabled.bind(a.view,"xray"),off:a.view.setModeEnabled.bind(a.view,"highlight")},a.events.on("xray.toggled",function(a){b.toggleXray.model=a.enabled,b.$apply()}),b.$watch("uiComponents.config.xray",function(a){b.show=!!a})}}}]).directive("humanIsolate",["Human",function(a){return{restrict:"E",scope:!0,templateUrl:"templates/modes/isolate.html",link:function(b){b.info="Isolate Mode [I]",b.toggleIsolate={on:a.view.setModeEnabled.bind(a.view,"isolate"),off:a.view.setModeEnabled.bind(a.view,"highlight")},a.events.on("isolate.toggled",function(a){b.toggleIsolate.model=a.enabled,b.$apply()}),b.$watch("uiComponents.config.isolate",function(a){b.show=!!a})}}}]),a.module("humanUI.rpc",[]).factory("RpcDefinitions",["$document","$filter","ConfigCreator","Human","HumanSnapshot","HumanBackground","HotspotData","Hotspot","HOTSPOT_TYPES",function(b,c,d,e,f,g,h,i,j){return{init:function(){var k=b[0].querySelector("[rpc-styles]");e.rpc.define("injectStyles",function(a){k&&(k.styleSheet?k.styleSheet.cssText=a:k.appendChild(b[0].createTextNode(a)),e.view.annotations.updateDimensions(),e.view.annotations.layouts.redrawLayout())},{hidden:!0});var l=["bookmarkTour","loadProgress"];e.rpc.define("ui.getDisplay",function(){var b={};a.forEach(d.config,function(a,c){-1===l.indexOf(c)&&(b[c]=a)}),this.setResult(b)}),e.rpc.define("ui.setDisplay",function(a){d._buildApplicationConfig(a),d._extend(),d._apply()});var m=function(a){var b=this;f.get(a,function(a){b.setResult(a.src)})};e.rpc.define("snapshot.get",m,{hidden:!0}),e.rpc.define("scene.snapshot",m,{hidden:!0}),e.rpc.define("ui.snapshot",m),e.rpc.define("ui.getBackground",function(){var a=g.getBackgroundData(),b={colors:[a.colors[0][255],a.colors[1][255]],colorStops:[a.colors[0].stop,a.colors[1].stop],gradientType:a.gradientType};this.setResult(b)}),e.rpc.define("ui.setBackground",function(a){a.hasOwnProperty("colors")&&g.setColors(a.colors),a.hasOwnProperty("colorStops")&&g.setColorStops(a.colorStops),a.hasOwnProperty("gradientType")&&g.setGradientType(a.gradientType)}),e.rpc.define("ui.getWorldPosition",function(a){var b=a.x,c=a.y,d=e.renderer.pick(b,c,!0);if(d){var f=Array.prototype.slice.call(d.worldPos);d=n(f,"object")}else d=null;this.setResult(d)});var n=c("formatPosition"),o={position:function(a,b){a.pos=n(b,"array")},direction:function(a,b){a.dir=n(b,"array")},chapterScope:function(a,b){a.chapterScope=b},shown:function(a,b){a.shown=b},type:function(a,b){a.type=b},title:function(a,b){a.title=b},objectId:function(a,b){a.objectId=b},data:function(a,b){a.data=b}},p={id:function(a,b){a.id=b},pos:function(a,b){a.position=n(b,"object")},dir:function(a,b){a.direction=n(b,"object")},canvasPos:function(a,b){a.canvasPosition=n(b,"object")},chapterScope:function(a,b){a.chapterScope=b},shown:function(a,b){a.shown=b},type:function(a,b){a.type=b},title:function(a,b){a.title=b},objectId:function(a,b){
  a.objectId=b},data:function(a,b){a.data=b}},q=function(a,b){var c={};for(var d in b)b.hasOwnProperty(d)&&a.hasOwnProperty(d)&&b[d](c,a[d]);return c};e.rpc.define("hotspots.create",function(b){b=q(b,o),h.add(b);var c=h.getCurrentId()-1,d=e.timeline.activeRoot._chapters,f=e.timeline.activeRoot._nowBranch,g=d.indexOf(f);if(!a.isDefined(b.chapterScope)||b.chapterScope===g){var j=i.create(h.all[c]);j.template&&j.render()}this.setResult(c)}),e.rpc.define("hotspots.info",function(b){a.isObject(b)&&(b=void 0);var c=null;if(b)c=q(i.get(b),p);else{c=[];for(var d=0;d<i.hotspots.length;d++)c.push(q(i.hotspots[d],p))}this.setResult(c)}),e.rpc.define("hotspots.update",function(a){var b=a.id,c=h.all[b];if(c){a=q(a,o),h.update(b,a);var d=i.get(b);d&&(i.destroy(d),d=i.create(c),d.template&&d.render())}}),e.rpc.define("hotspots.destroy",function(a){var b=i.get(a);b&&i.destroy(b),h.remove(a)});var r=function(a,b){if(a)i.get(a).setShown(b);else for(var c=0;c<i.hotspots.length;c++)i.hotspots[c].setShown(b)};e.rpc.define("hotspots.show",function(b){a.isObject(b)&&(b=void 0),r(b,!0)}),e.rpc.define("hotspots.hide",function(b){a.isObject(b)&&(b=void 0),r(b,!1)}),e.rpc.define("hotspots.types",function(){var a=Object.keys(j).map(function(a){return c("dashNormalize")(a)});this.setResult(a)});var s={};e.rpc.defineEvent("hotspots.positionUpdated",{events:["hotspots.positionUpdated"],map:function(a){return p.id(s,a.id),p.canvasPos(s,a.canvasPos),s}}),e.rpc.defineEvent("hotspots.displayUpdated"),e.rpc.defineEvent("hotspots.picked"),e.rpc.defineEvent("hotspots.entered"),e.rpc.defineEvent("hotspots.left")}}}]),a.module("humanUI.scene",[]).provider("ObjectOpacities",function(){var b,c,d,e,f,g,h,i,j=[],k=0,l={},m={initIndex:0,minOpacity:0,layerHandlers:{}},n=function(b){a.extend(m,b)},o=function(o,p){var q=function(a){for(var b=[],c=0;c<a.length;c++)b.push({name:a[c],objectIds:[a[c]]});return b},r=function(a){for(var b=[],c=0;c<a.length;c++){var d=o.scene.objects[a[c]];if(d){var e=d.getLeafObjects();b=b.concat(e)}}return b},s=function(a,b){b=b*(1-m.minOpacity)+m.minOpacity,a.setOpacity(b)};return{data:{layers:[],threshold:1,minOpacity:m.minOpacity,initIndex:m.initIndex},newObjectsEvent:"objectSlider.layers",config:function(b){n(b),a.extend(this.data,b)},init:function(i,n,s){this.resetScene(),i||(i=p.getFromRoots().map(function(a){return a.objectId})),a.isNumber(n)&&(m.initIndex=this.data.initIndex=n),a.isNumber(s)&&(m.minOpacity=s),this.data.layers=a.isString(i[0])?q(i):i,k=this.data.threshold=1/i.length,l={},e=m.initIndex,f=0,b=c=d=g=void 0;var t=this.data.layers[e];j=t?r(t.objectIds):[],this.data.layers.forEach(function(a){var b=r(a.objectIds);for(g=0;g<b.length;g++)l[b[g].objectId]={opacity:b[g].opacity};for(g=0;g<a.objectIds.length;g++){var c=a.objectIds[g],d=o.scene.enabledObjects.hasOwnProperty(c);l[c]?l[c].enabled=d:l[c]={enabled:d}}}),this.set(m.initIndex*k),h.triggerHandler(this.newObjectsEvent)},resetScene:function(){var a,b,c={};for(var d in l)l.hasOwnProperty(d)&&(a=l[d],b=o.scene.objects[d],a.hasOwnProperty("enabled")&&(c[d]=a.enabled),a.hasOwnProperty("opacity")&&b.setOpacity(a.opacity));o.scene.setEnabledObjects({objects:c})},set:function(a){if(e=Math.floor(a/k),e!==e&&(e=m.initIndex),b=e!==f,c=this.data.layers[e],b){var h,l,n=Math.abs(e-f),p=(e-f)/n,q=[],t=-1===p?1:0;for(g=f;g!==e;){if(h=this.data.layers[g])for(i=m.layerHandlers[h.name]||s,q=r(h.objectIds),l=0;l<q.length;l++)i(q[l],t);g+=p}if(0===m.minOpacity){var u={};for(g=0;g<this.data.layers.length;g++)if(h=this.data.layers[g],!m.layerHandlers[h.name])for(l=0;l<h.objectIds.length;l++)u[h.objectIds[l]]=g>=e;o.scene.setEnabledObjects({objects:u})}j=c?r(c.objectIds):[]}if(j.length)for(i=m.layerHandlers[c.name]||s,d=(a-k*e)/k,l=0;l<j.length;l++)i(j[l],1-d);f=e},setElement:function(a){h=a}}};return o.$inject=["Human","SceneObjects"],{$get:o,config:n}}).directive("humanObjectSlider",["Human","ObjectOpacities","HumanParser","currentModule",function(b,c,d,e){return{restrict:"E",templateUrl:"templates/scene/object-slider.html",scope:!0,link:function(f,g,h){var i=g.find("object-slider-layers")[0],j=h.axis||"y",k=!1,l=!1,m=null,n=function(){for(var a=c.data.threshold,b="x"===j?"left":"top",d=0;d<i.children.length;d++){var e=i.children[d];e.style[b]=d*a*100+"%"}},o=function(b){for(var c="x"===j?"left":"top",d=0;d<i.children.length;d++){var e=a.element(i.children[d]),f=parseInt(e[0].style[c])/100,g=b>=f?"addClass":"removeClass";e[g]("on")}},p=function(){f.show=l&&k};f.config={axis:j,change:function(a){c.set(a.fraction),o(a.fraction)}},f.setOpacity=function(a){var b=c.data.threshold,d=a*b;c.set(d),f.config.value=d,o(d)},c.setElement(g),g.on(c.newObjectsEvent,function(){f.layers=c.data.layers;var a=c.data.threshold,b=c.data.initIndex,d=b*a;f.config.value=d,f.$digest(),n(),o(d)}),b.events.on("timeline.chapters.activated",function(){k||(k=!0,p(),f.$apply(),f.show&&c.init(m))}),f.$watch("uiComponents.config.objectSlider",function(c){var f=a.isObject(c)&&c.objects;g[f?"addClass":"removeClass"]("layers");var h=a.isObject(c)&&c.data;h&&(m=c.data,a.isString(m)&&(m=m.split(",")));var i=a.isObject(c)&&c.dataSrc;if(i){var j=b.modules.modules[e.id];m=d.parse(c.dataSrc)(j)}l=!!c,p()},!0)}}}]).factory("ObjectRendered",["$timeout","Human",function(a,b){var c=function(a,b){this.collection=a,this.element=b,this.flagged={},this.liQueue=[],this.assetCount=0,this.maxQueueLength=1,this.boundLoadProgress=this.onAssetLoadProgress.bind(this),this.boundObjectRenderable=this.onObjectRenderable.bind(this),this.boundAssetAttachFinish=this.onAssetAttachFinish.bind(this),this.addHandlers(),this.element.data("objectRendered",this)};return c.create=function(a){var b=a.data("humanCollection");if(b){var d=a.data("objectRendered");return d||new c(b,a)}},c.prototype.setMaxQueueLength=function(){this.maxQueueLength=Math.floor(this.assetCount/100),this.maxQueueLength<1&&(this.maxQueueLength=1),this.maxQueueLength>20&&(this.maxQueueLength=20)},c.prototype.paintAndReset=function(){for(var a=0;a<this.liQueue.length;a++)this.liQueue[a].addClass("anatomy-rendered");this.liQueue.length=0},c.prototype._updateRendered=function(a,c){var d=b.scene.objects[a];if(d&&d.isRenderable())for(;d&&!this.flagged[d.objectId];){var e=this.collection.getLi(d.objectId);e&&(c?(this.liQueue.push(e),this.liQueue.length===this.maxQueueLength&&this.paintAndReset()):e.addClass("anatomy-rendered"),this.flagged[d.objectId]=!0),d=d.parent}},c.prototype.updateRendered=function(){for(var a in this.collection.lis)this.collection.lis.hasOwnProperty(a)&&this._updateRendered(a,!1);this.flagged={}},c.prototype.addHandlers=function(){b.events.off("assets.load.progress",this.boundLoadProgress),b.events.on("assets.load.progress",this.boundLoadProgress),b.events.off("scene.objectRenderable",this.boundObjectRenderable),b.events.on("scene.objectRenderable",this.boundObjectRenderable),b.events.off("graph.assetAttach.finish",this.boundAssetAttachFinish),b.events.on("graph.assetAttach.finish",this.boundAssetAttachFinish)},c.prototype.removeHandlers=function(){b.events.off("assets.load.progress",this.boundLoadProgress),b.events.off("scene.objectRenderable",this.boundObjectRenderable),b.events.off("graph.assetAttach.finish",this.boundAssetAttachFinish)},c.prototype.onAssetLoadProgress=function(a){0===this.assetCount&&(this.assetCount=a.requestedAssets,this.setMaxQueueLength())},c.prototype.onObjectRenderable=function(b){var c=this;a(function(){c._updateRendered(b.objectId,!0)})},c.prototype.onAssetAttachFinish=function(){var b=this;a(function(){b.paintAndReset(),b.flagged={},b.assetCount=0})},c}]).factory("ObjectEnabled",["$timeout","Human",function(b,c){var d=function(a,b){this.collection=a,this.element=b;var d=this.onObjectShow.bind(this),e=this.onObjectsShown.bind(this);this.element.off("click.objectShow",d),this.element.on("click.objectShow",d),c.events.off("scene.objectsShown",e),c.events.on("scene.objectsShown",e),this.element.data("objectEnabled",this)};return d.create=function(a){var b=a.data("humanCollection");if(b){var c=a.data("objectEnabled");return c||new d(b,a)}},d.toggleEnabledAnatomy=function(a,b){var d={};d[b]=a,c.scene.setEnabledObjects({objects:d})},d.prototype.update=function(a,b){var c=this.collection.getLi(b);c&&c[a?"addClass":"removeClass"]("anatomy-enabled")},d.prototype.onObjectShow=function(a,b){var c=b&&b.target||a.target;if(c.hasAttribute("object-enabled")){a.stopPropagation();var e=c.getAttribute("object-enabled"),f=this.collection.getLi(e);f.toggleClass("anatomy-enabled");var g=f.hasClass("anatomy-enabled");d.toggleEnabledAnatomy(g,e)}},d.prototype.onObjectsShown=function(c){var d=this,e=c.enabledObjectsUpdate;b(function(){a.forEach(e,d.update,d)})},d}]).provider("ObjectSelected",function(){var b={selectOpen:!0,deselectClose:!0},c=function(c,d,e){var f=function(c,e){this.collection=c,this.element=e,this.config=a.copy(b),this.throttle=!1;var f=this.onObjectSelect.bind(this),g=this.onObjectsSelected.bind(this);this.element.off("click.objectSelect",f),this.element.on("click.objectSelect",f),d.events.off("scene.objectsSelected",g),d.events.on("scene.objectsSelected",g),this.element.data("objectSelected",this)};return f.create=function(a){var b=a.data("humanCollection");if(b){var c=a.data("objectSelected");return c||new f(b,a)}},f.prototype.selectAnatomy=function(a){var b=this,c=d.view.pick.getMultiPickEnabled();d.view.focus.focusObject({objectId:a,replace:!c,flyTo:c?"none":"newSelected"},function(){b.throttle=!1})},f.prototype.onObjectSelect=function(a,b){var c=b&&b.target||a.target;if(c.hasAttribute("object-selected")){a.stopPropagation();var d=c.getAttribute("object-selected"),f=this.collection.getLi(d);this.throttle=!0,this.selectAnatomy(d);var g=e.getTarget(f);g&&e.show(g)}},f.prototype.update=function(a,b){var c=this.collection.getLi(b),d=e.getTarget(c);c&&(c[a?"addClass":"removeClass"]("anatomy-selected"),d&&(this.config.selectOpen&&a&&!this.throttle&&e.show(d,{animate:!1}),this.config.deselectClose&&!a&&e.hide(d,{animate:!1})))},f.prototype.onObjectsSelected=function(b){var d=this,e=b.selectedObjectsUpdate;c(function(){a.forEach(e,d.update,d)})},f};return c.$inject=["$timeout","Human","TreeCollapse"],{$get:c,config:function(c){a.extend(b,c)}}}).factory("SceneObjects",["Human","ObjectEnabled","ObjectSelected","ObjectRendered",function(b,c,d,e){var f=function(a){return/export_ID$/.test(a)};return{getFromRoots:function(){var c=[];return a.forEach(b.scene.rootObjects,function(b){a.forEach(b.objects,function(a){f(a.objectId)?c=c.concat(a.objects):c.push(a)})}),c},getFromList:function(){var c={};return a.forEach(b.scene.objects,function(a,b){a.parent&&!f(b)&&(c[b]=a)}),c},init:function(a){e.create(a),c.create(a),d.create(a)}}}]).directive("humanObjectTree",["$timeout","Human","SceneObjects","HumanKeySelect",function(b,c,d,e){return{restrict:"E",templateUrl:"templates/scene/object-tree.html",scope:!0,transclude:!0,link:function(f,g,h){var i=g.find("human-tree"),j=function(a){f.show=k()&&a},k=function(){var b=f.rootObjects;return a.isArray(b)&&b.length>0};f.objectTreeConfig={compile:!1,compare:!0,itemId:"objectId",itemClasses:function(a){return{"anatomy-enabled":a.shown,"anatomy-selected":a.selected}},isLeaf:function(a){return a.isLeaf()}},f.rootObjects=c.scene.rootObjects,f.$watchCollection("rootObjects",function(){var c;k()&&b(function(){f.sceneObjects=d.getFromRoots(),d.init(i)}),c=a.isObject(f.uiComponents.config)?!!f.uiComponents.config.objectTree:!1,j(c)});var l=e.create(g,null,{cycle:!h.hasOwnProperty("noCycle"),onSelected:function(a){i.triggerHandler("click.objectSelect",{target:a[0]})}});f.$on("humanObjectTree.selectItem",function(a,b){l.selectItem(b)}),i.on("humanCollection.built",function(){l.setItems(i.find("a"))}),f.$watch("uiComponents.config.objectTree",function(a){j(!!a)})}}}]).directive("humanObjectListSearch",["$document","$timeout","SceneObjects",function(b,c,d){return{restrict:"E",scope:!0,templateUrl:"templates/scene/object-list-search.html",link:function(e,f,g){var h,i,j={};h=g.hasOwnProperty("target")?a.element(b[0].querySelector(g.target)):f.next();var k=function(){var b=h.find("human-list"),c=b.data("humanCollection");a.forEach(e.sceneObjects,function(a,b){i=a.displayName.toLowerCase(),j[i]||(j[i]=[]),j[i].push(c.getLi(b)[0])})},l="Search Current 3D Model";g.searchPlaceholder?g.$observe("searchPlaceholder",function(a){e.searchPlaceholder=a}):e.searchPlaceholder=l,e.clearSearch=function(){var a=f.find("input");a.val(""),a.triggerHandler("change")},e.searchList=function(){var a,b,c,d,f,g=function(a,b){for(d=0;d<a.length;d++)a[d].style.display=b},i=e.searchText.toLowerCase(),k=0;a=new RegExp("^"+i+"|\\s"+i);for(f in j)j.hasOwnProperty(f)&&(c=a.test(f),b=c?"inherit":"none",g(j[f],b),c&&k++);e.noResults=0===k,e.searching=e.searchText.length>0,h.triggerHandler("objectListSearching",e.searching)},e._sceneObjects=Human.scene.objects,e.$watchCollection("_sceneObjects",function(a){Object.keys(a).length>0&&h[0]&&c(function(){e.sceneObjects=d.getFromList(),c(function(){k()})})})}}}]).directive("humanObjectList",["$timeout","$window","HumanKeySelect","SceneObjects",function(a,b,c,d){return{restrict:"E",templateUrl:"templates/scene/object-list.html",scope:!0,transclude:!0,link:function(b,e,f){var g,h=e.find("human-list"),i=h[0],j=!1,k=function(){for(var a=0;a<m.length;a++)m[a].element.style.display="inherit";g.style["margin-top"]="0px",g.style["margin-bottom"]="0px"},l=function(a){b.searching&&a||(a?(n(),o(),h.off("scroll",o),h.on("scroll",o)):(k(),h.off("scroll",o)),j=a)},m=[],n=function(){var a=h.find("li.letter-group");k(),m=[];for(var b=0;b<a.length;b++)m.push({element:a[b],top:a[b].offsetTop,bottom:a[b].offsetTop+a[b].offsetHeight})},o=function(){if(g&&0!==m.length){var a,b,c=0,d=m.length;for(a=0;a<m.length;a++)b=m[a],b.bottom<i.scrollTop?c=a+1:b.top>i.scrollTop+i.clientHeight&&d===m.length&&(d=a);for(a=0;c>a;a++)m[a].element.style.display="none";for(a=c;d>a;a++)m[a].element.style.display="inherit";var e=0;for(a=d;a<m.length;a++)e+=m[a].bottom-m[a].top,m[a].element.style.display="none";g.style["margin-top"]=m[c].top+"px",g.style["margin-bottom"]=e+"px"}};b.objectListConfig={itemId:"objectId",itemClasses:function(a){return{"anatomy-rendered":a.isRenderable(),"anatomy-enabled":a.shown,"anatomy-selected":a.selected}},letterHeaders:!0},b._sceneObjects=Human.scene.objects,b.$watchCollection("_sceneObjects",function(c){Object.keys(c).length>0&&a(function(){b.sceneObjects=d.getFromList(),d.init(h),a(function(){g=h.children()[0]})})}),e.on("objectListSearching",function(a,c){b.searching=c,e[c?"addClass":"removeClass"]("searching"),l(!c),i.scrollTop=0}),b.$on("objectListRanges.setCropping",function(a,b){l(b)}),b.$on("objectListRanges.setRanges",n),b.$on("objectListRanges.crop",o),Human.events.on("graph.assetAttach.finish",function(){l(!0)});var p=c.create(e,null,{cycle:!f.hasOwnProperty("noCycle"),onSelected:function(a){h.triggerHandler("click.objectSelect",{target:a[0]})}});b.$on("humanObjectList.selectItem",function(a,b){p.selectItem(b)}),h.on("humanCollection.built",function(){p.setItems(h.find("a"))})}}}]),a.module("humanUI.snapshot",[]).provider("HumanSnapshot",function(){var b={copyrightImagePath:null,copyrightText:{font:"12px Arial",fillStyle:"#666666",textAlign:"center"}},c=function(c){c.copyrightImagePath&&(b.copyrightImagePath=c.copyrightImagePath),a.isObject(c.copyrightText)&&a.extend(b.copyrightText,c.copyrightText)},d=function(d,e,f,g,h){var i,j=!1,k=function(){i=new d.Image,i.onload=function(){j=!0},i.src=b.copyrightImagePath},l=function(c,d,e){var f,g;a.forEach(b.copyrightText,function(a,b){c[b]=a});var h=[(new Date).getFullYear(),String.fromCharCode(169)].join(" "),k=c.measureText(h);f=d/2-k.width/2,g=e-10,c.fillText(h,f,g),j&&(f=d/2-i.width/2,g=e-20-i.height,c.drawImage(i,f,g))},m=function(a,b,c,d){var e,f=function(a,c){for(var d=0;d<b.colors.length;d++){var e=b.colors[d][255];e="rgb("+e[0]+", "+e[1]+", "+e[2]+")",a.addColorStop(c[d],e)}};if("radial"===b.gradientType){var g=c/2,h=d/2,i=Math.max(g,h),j=[g,h,i,g,h,0];e=a.createRadialGradient.apply(a,j),f(e,[1,0])}else e=a.createLinearGradient(0,0,0,d),f(e,[0,1]);a.fillStyle=e,a.fillRect(0,0,c,d)},n=function(a,b){a=a||{};var c=h.renderer.canvas.getCanvas()[0],f=c.getBoundingClientRect(),g=f.width,i=f.height,j=a.width||g,k=a.height||i;j>=k?k=d.Math.floor(i/g*j):k>j&&(j=d.Math.floor(g/i*k));var n=!1;h.timeline.playing&&(n=!0,h.timeline.pause()),h.renderer.forceRenderFrame();var o=e[0].createElement("canvas"),p=o.getContext("2d");o.width=j,o.height=k;var q,r;"HumanBackground"in d&&(q=d.HumanBackground.getBackgroundData(),r=[p,q,j,k],m.apply(null,r)),r=[c,0,0,j,k],p.drawImage.apply(p,r);var s=a.copyright===!1?!1:!0;s&&l(p,j,k);var t=h.view.annotations.layouts,u=t.getLayout(t.activeLayout);if(u&&u.snapshot){var v;v=q?q.averageGray[1]>.5?"white":"black":"white",u.snapshot(o,p,v)}h.renderer.forceRenderFrame(),n&&h.timeline.unpause();var w=new d.Image;w.width=j,w.height=k,w.onload=b.bind(null,w),w.src=o.toDataURL("image/jpeg")};return b.copyrightImagePath&&k(),{get:function(b,c){n(b,function(e){b.openInTab&&d.open(e.src,"_blank"),a.isFunction(c)&&c(e)})},loadCopyrightImage:k,config:c}};return d.$inject=["$window","$document","$q","$timeout","Human"],{$get:d,config:c}}),a.module("humanUI.timeline",[]).factory("HumanTimeline",["Human",function(b){var c=function(){var c=b.timeline.activeRoot;if(c)for(var d,e,f,g,h=0;h<c._chapters.length;h++){if(d=c._chapters[h].maps,!Object.keys(d).length)return!1;for(g in d)if(d.hasOwnProperty(g)&&(e=d[g].data.timeline,f=a.isObject(e)?e.id:e,"dummy"!==f))return!0}return!1};return{isPlayable:function(a){if(c())return!0;var d=b.timeline.activeRoot;if(!d)return!1;var e=Object.keys(d._chapters).length>1,f=a&&a.lastTime>a.firstTime;return e&&f},playChapter:function(a){b.timeline.play({startChapterId:a.id,loop:!!a.animation.loop,numChapters:1})},handleChapter:function(a){var c=b.timeline.activeRoot;if(c){var d=c._chapters.indexOf(c._nowBranch),e=c._chapters.indexOf(a),f=e-d;1===Math.abs(f)?b.timeline[1===f?"next":"prev"]():a.animation.loop?this.playChapter(a):b.timeline.scrub({chapterId:a.id})}}}}]).factory("assetAttachClass",function(){return function(a){Human.events.on("graph.assetAttach.start",function(){a.addClass("asset-attach")}),Human.events.on("graph.assetAttach.finish",function(){a.removeClass("asset-attach")})}}).directive("playPauseTimeline",["Human",function(b){return{restrict:"A",scope:{config:"="},link:function(c,d){var e,f,g,h=function(){e={startTime:b.timeline.time},g=!!b.timeline.activeRoot._nowBranch.animation.loop,(f||g)&&(e.loop=!0);var d=a.isObject(c.config)&&c.config.tour;(d||g)&&(e.numChapters=1),b.timeline.play(e)};d.on("click",function(){b.timeline.playing?b.timeline.stop():h()});var i={played:!0,stopped:!1,scrubbed:!1};a.forEach(i,function(a,c){b.events.on("timeline."+c,function(){d[a?"addClass":"removeClass"]("playing")})}),b.events.on("modules.activate.start",function(a){var c=b.modules.modules[a.moduleId];c&&(f=!(!c.animation||!c.animation.loop))})}}}]).directive("humanPlayPause",["$timeout","HumanTimeline",function(b,c){return{restrict:"E",scope:!0,templateUrl:"templates/timeline/play-pause.html",link:function(d,e){var f,g,h=function(){d.show=!!f&&!!g};Human.events.on("modules.activate.finish",function(){e.addClass("asset-attach"),b(function(){var a=Human.timeline.getTimeFrame();g=c.isPlayable(a),h(),d.$apply()})}),Human.events.on("module.ready",function(){e.removeClass("asset-attach")}),Human.events.on("modules.deactivate.finish",function(){d.show=!1,d.$apply()}),d.$watch("uiComponents.config.playPause",function(b){var c=d.uiComponents.config;f=!c.scrubber&&!c.tour&&!!b,h(),a.isObject(b)&&(d.config=b)},!0)}}}]).directive("humanChapters",["$window","$sce","$timeout","Human","HumanTimeline","checkModule","translateFilter",function(b,c,d,e,f,g,h){var i=a.element(b);return{restrict:"E",scope:{config:"=?"},templateUrl:"templates/timeline/chapters.html",link:function(b,j,k){var l,m,n,o=k.chaptersMode||"scrubber",p=function(){n=j[0].scrollWidth>j[0].clientWidth,j[n?"addClass":"removeClass"]("overflow")},q=function(){var a=j[0].children[b.curIndex];"tour"===o&&a&&a.scrollIntoView&&a.scrollIntoView(!1)},r=function(a){if(!b.titles.hasOwnProperty(a.id)){var d=h(a.info,"displayName",m);b.titles[a.id]=c.trustAsHtml(d)}return b.titles[a.id]};b.titles={},b.chapters=[],b.getOffset=function(a){if(e.timeline.activeRoot){var b=e.timeline.activeRoot._times[a];return"scrubber"===o?b/l.lastTime*100+"%":"auto"}};var s=function(){if(e.timeline.activeRoot){var c=e.timeline.activeRoot._chapters;c.length>1&&(l=e.timeline.getTimeFrame(),b.chapters=c,b.titleDisplay=a.isObject(b.config)&&b.config.titleDisplay?b.config.titleDisplay:r,d(p),b.showTitles=!g("ui.bootstrap"),b.toolTipPos="scrubber"===o?"left":"top")}};j.on("click",function(a){if(/chapter/.test(a.target.className)){var b=e.timeline.branchTimelines[a.target.id];"scrubber"===o?f.playChapter(b):f.handleChapter(b)}}),i.on("resize",function(){d(p)}),b.$on("human.locale",function(a,b){m=b}),e.events.on("timeline.chapters.updated",function(){d(s)}),e.events.on("timeline.timeFrame.updated",function(a){l=a}),e.events.on("timeline.chapters.activated",function(a){b.curIndex=a.newChapterIndex,b.$apply(),q()})}}}]).directive("humanScrubber",["$filter","$timeout","Human","HumanTimeline",function(b,c,d,e){return{restrict:"E",scope:!0,templateUrl:"templates/timeline/scrubber.html",link:function(f,g){var h,i,j,k,l,m=!1,n=function(){f.show=!!k&&!!l},o=function(b){f.uiConfig=b;var c=a.isObject(f.uiConfig)&&f.uiConfig.chapters;g[c?"addClass":"removeClass"]("chapters")},p=function(){return i=b("date")(1e3*d.timeline.time,"mm:ss"),j=b("date")(1e3*h.lastTime,"mm:ss"),i+" / "+j},q=function(a){return h.firstTime+(h.lastTime-h.firstTime)*a},r=function(a){h=a,f.config.value=d.timeline.time,f.config.max=h.lastTime,m||(m=!0,d.events.on("timeline.playing",function(a){f.config.value=a.time,f.$digest()}))};f.config={change:function(a){d.timeline.scrub({time:q(a.fraction)})},label:p},d.events.on("timeline.timeFrame.updated",function(a){c(function(){l=e.isPlayable(a),l&&r(a),n(),f.$apply()})}),d.events.on("modules.activate.finish",function(){g.addClass("asset-attach");var a=f.uiComponents.config;a.scrubber&&a.tour&&(k=1===d.timeline.activeRoot._chapters.length,n(),f.$apply())}),d.events.on("module.ready",function(){g.removeClass("asset-attach")}),d.events.on("modules.deactivate.finish",function(){f.show=!1,f.$apply()}),f.$watch("uiComponents.config.scrubber",function(a){(!a||a&&!f.uiComponents.config.tour)&&(k=!!a,n()),o(a)},!0)}}}]).directive("prevNextChapter",["Human","HumanTimeline",function(a,b){return{restrict:"A",link:function(c,d,e){var f=e.prevNextChapter||"next";f="next"===f?1:-1;var g,h,i,j=function(){i=1===f&&g===h.length-1||-1===f&&0===g,d[i?"addClass":"removeClass"]("disabled")};d.on("click",function(){if(!i){var c=a.timeline.activeRoot._chapters;b.handleChapter(c[g+f])}}),a.events.on("timeline.chapters.updated",function(a){h=a}),a.events.on("timeline.chapters.activated",function(a){g=a.newChapterIndex,j()})}}}]).directive("humanTour",["$q","$timeout","Human",function(b,c,d){return{restrict:"E",scope:!0,templateUrl:"templates/timeline/tour.html",link:function(b,c){var e,f,g=function(){b.show=!!e&&!!f},h=function(d){b.uiConfig=d;var e=a.isObject(b.uiConfig)&&b.uiConfig.chapters;c[e?"addClass":"removeClass"]("chapters")};d.events.on("timeline.timeFrame.updated",function(){if(d.timeline.activeRoot){var a=b.uiComponents.config;f=d.timeline.activeRoot._chapters.length>1,a.scrubber&&a.tour&&(e=f),g(),b.$apply()}}),d.events.on("modules.activate.finish",function(){if(c.addClass("asset-attach"),d.timeline.activeRoot){var a=b.uiComponents.config;f=d.timeline.activeRoot._chapters.length>1,a.scrubber&&a.tour&&(e=f),g(),b.$apply()}}),d.events.on("module.ready",function(){c.removeClass("asset-attach")}),d.events.on("modules.deactivate.finish",function(){b.show=!1,b.$apply()}),b.$watch("uiComponents.config.tour",function(a){(!a||a&&!b.uiComponents.config.scrubber)&&(e=!!a,g()),h(a)},!0)}}}]),a.module("humanUI.templates",["templates/annotations/panel.html","templates/bookmark/tour.html","templates/camera/center.html","templates/camera/mode.html","templates/camera/pan.html","templates/camera/zoom-in.html","templates/camera/zoom-out.html","templates/camera/zoom.html","templates/cross-section/camera-clip.html","templates/cross-section/controls.html","templates/cross-section/slider.html","templates/cross-section/toggle.html","templates/dissect/dissect.html","templates/dissect/undo.html","templates/fullscreen/panel.html","templates/fullscreen/window-link.html","templates/info/panel.html","templates/load/progress.html","templates/media/audio.html","templates/modes/isolate.html","templates/modes/xray.html","templates/scene/object-list-search.html","templates/scene/object-list.html","templates/scene/object-slider.html","templates/scene/object-tree.html","templates/timeline/chapters.html","templates/timeline/play-pause.html","templates/timeline/scrubber.html","templates/timeline/tour.html","templates/utilities/slider.html"]),a.module("templates/annotations/panel.html",[]).run(["$templateCache",function(a){a.put("templates/annotations/panel.html",'<button\n  class="tool annotations"\n  toggle-button="toggleAnnotations">\n</button>')}]),a.module("templates/bookmark/tour.html",[]).run(["$templateCache",function(a){a.put("templates/bookmark/tour.html",'<div>\n  <button prev-next-bookmark="prev"></button>\n\n  <div id=\'bookmark-tour-captures\' update-scroll="state.curCaptureIndex">\n    <div class="bookmark-tour-capture"\n      ng-repeat="capture in state.captures"\n      ng-class="{ on: $index === state.curCaptureIndex }"\n      ng-click="restore($index)">\n\n      <img ng-src="/{{ capture.thumbnailSrc }}">\n    </div>\n  </div>\n\n  <button prev-next-bookmark="next"></button>\n</div>')}]),a.module("templates/camera/center.html",[]).run(["$templateCache",function(a){a.put("templates/camera/center.html","<div center-camera></div>")}]),a.module("templates/camera/mode.html",[]).run(["$templateCache",function(a){a.put("templates/camera/mode.html",'<div toggle-button="cameraMode"></div>')}]),a.module("templates/camera/pan.html",[]).run(["$templateCache",function(a){a.put("templates/camera/pan.html",'<div pan-camera="up" title="Pan Up [{{ keys.up }}]"></div>\n<div pan-camera="right" title="Pan Right [{{ keys.right }}]"></div>\n<div pan-camera="down" title="Pan Down [{{ keys.down }}]"></div>\n<div pan-camera="left" title="Pan Left [{{ keys.left }}]"></div>\n\n<div center-camera title="Center"></div>')}]),a.module("templates/camera/zoom-in.html",[]).run(["$templateCache",function(a){a.put("templates/camera/zoom-in.html",'<div zoom-camera="in">+</div>')}]),a.module("templates/camera/zoom-out.html",[]).run(["$templateCache",function(a){a.put("templates/camera/zoom-out.html",'<div zoom-camera="out">-</div>')}]),a.module("templates/camera/zoom.html",[]).run(["$templateCache",function(a){a.put("templates/camera/zoom.html",'<div zoom-camera="out">-</div>\n<div zoom-camera="in">+</div>')}]),a.module("templates/cross-section/camera-clip.html",[]).run(["$templateCache",function(a){a.put("templates/cross-section/camera-clip.html",'<button\n  class="tool camera-clip"\n  toggle-button="toggleCameraClip"></button>')}]),a.module("templates/cross-section/controls.html",[]).run(["$templateCache",function(a){a.put("templates/cross-section/controls.html",'<button\n  class="tool"\n  cycle-section-plane\n  uib-tooltip="{{ tooltipText.select }}"></button>\n\n<human-cross-section-slider></human-cross-section-slider>\n<span class="view">{{ state.current.view }}</span>\n\n<button\n  class="tool"\n  reset-section-plane\n  plane="curPlane"\n  uib-tooltip="{{ tooltipText.reset }}"></button>')}]),a.module("templates/cross-section/slider.html",[]).run(["$templateCache",function(a){a.put("templates/cross-section/slider.html",'<human-slider config="config"></human-slider>')}]),a.module("templates/cross-section/toggle.html",[]).run(["$templateCache",function(a){a.put("templates/cross-section/toggle.html",'<button class="cross-section tool" toggle-button="callbacks"></button>')}]),a.module("templates/dissect/dissect.html",[]).run(["$templateCache",function(a){a.put("templates/dissect/dissect.html",'<button\n  class="tool dissect"\n  toggle-button="toggleDissect"\n  toggle-model="shown"></button>')}]),a.module("templates/dissect/undo.html",[]).run(["$templateCache",function(a){a.put("templates/dissect/undo.html",'<button class="tool dissect-undo" undo-dissect></button>')}]),a.module("templates/fullscreen/panel.html",[]).run(["$templateCache",function(a){a.put("templates/fullscreen/panel.html",'<div toggle-button="toggleFullscreen"></div>')}]),a.module("templates/fullscreen/window-link.html",[]).run(["$templateCache",function(a){a.put("templates/fullscreen/window-link.html",'<a window-link target="_blank"></a>')}]),a.module("templates/info/panel.html",[]).run(["$templateCache",function(a){a.put("templates/info/panel.html",'<h1 class="title">{{ infoTitle }}</h1>\n<div class="description" ng-bind-html="infoDescription | parseActions"></div>\n<ng-transclude class="custom-content"></ng-transclude>')}]),a.module("templates/load/progress.html",[]).run(["$templateCache",function(a){a.put("templates/load/progress.html",'<div class="progress-indicator">\n  <span>{{ progressPercent }}</span>\n</div>\n\n<div class="status-text">\n  <span>{{ statusText }}</span>\n</div>')}]),a.module("templates/media/audio.html",[]).run(["$templateCache",function(a){a.put("templates/media/audio.html",'<audio autoplay></audio>\n<button mute-replay-audio class="tool"></button>')}]),a.module("templates/modes/isolate.html",[]).run(["$templateCache",function(a){a.put("templates/modes/isolate.html",'<button class="tool isolate" toggle-button="toggleIsolate"></button>')}]),a.module("templates/modes/xray.html",[]).run(["$templateCache",function(a){a.put("templates/modes/xray.html",'<button class="tool xray" toggle-button="toggleXray"></button>')}]),a.module("templates/scene/object-list-search.html",[]).run(["$templateCache",function(a){a.put("templates/scene/object-list-search.html",'<input\n  type="text"\n  placeholder="{{ searchPlaceholder }}"\n  ng-change="searchList()"\n  ng-model="searchText">\n\n<button ng-show="searching" ng-click="clearSearch()">&times;</button>')}]),a.module("templates/scene/object-list.html",[]).run(["$templateCache",function(a){a.put("templates/scene/object-list.html",'<ng-transclude></ng-transclude>\n\n<span class="no-results" ng-show="searching && noResults">No Results</span>\n\n<human-list\n  list-data="sceneObjects"\n  list-config="objectListConfig">\n    <a\n      object-selected="{{ objectId | escapeHtml }}"\n      title="{{ displayName | escapeHtml }}"\n      class="collection-item">\n      <span\n        object-enabled="{{ objectId | escapeHtml }}"\n        class="anatomy-check-icon"></span>{{ displayName | escapeHtml }}\n    </a>\n</human-list>')}]),a.module("templates/scene/object-slider.html",[]).run(["$templateCache",function(a){a.put("templates/scene/object-slider.html",'<object-slider-layers>\n  <button\n    ng-repeat="layer in layers"\n    ng-click="setOpacity($index)"\n    class="object-slider-layer"></button>\n\n  <!-- One at the end to hide the entire scene -->\n  <button\n    class="object-slider-layer"\n    ng-click="setOpacity(layers.length)"></button>\n</object-slider-layers>\n\n<human-slider config="config"></human-slider>')}]),a.module("templates/scene/object-tree.html",[]).run(["$templateCache",function(a){a.put("templates/scene/object-tree.html",'<ng-transclude></ng-transclude>\n<human-tree\n  tree-data="sceneObjects"\n  tree-config="objectTreeConfig">\n    <a\n      object-selected="{{ objectId | escapeHtml }}"\n      title="{{ displayName | escapeHtml }}"\n      class="collection-item">\n      <span\n        object-enabled="{{ objectId | escapeHtml }}"\n        class="anatomy-check-icon"></span>{{ displayName | escapeHtml }}\n    </a>\n</human-tree>');
  
  }]),a.module("templates/timeline/chapters.html",[]).run(["$templateCache",function(a){a.put("templates/timeline/chapters.html",'<button\n  ng-repeat="chapter in chapters"\n  id="{{ chapter.id }}"\n  class="chapter"\n  ng-class="{ on: $index === curIndex }"\n  uib-tooltip-html="titleDisplay(chapter)"\n  tooltip-placement="{{ toolTipPos }}"\n  title="{{ (showTitles && titleDisplay(chapter)) || \'\' }}"\n  ng-style="{ left: getOffset($index) }">{{ $index + 1 }}</button>\n')}]),a.module("templates/timeline/play-pause.html",[]).run(["$templateCache",function(a){a.put("templates/timeline/play-pause.html",'<button play-pause-timeline config="config"></button>')}]),a.module("templates/timeline/scrubber.html",[]).run(["$templateCache",function(a){a.put("templates/timeline/scrubber.html",'<button play-pause-timeline config="uiConfig"></button>\n\n<human-chapters chapters-mode="scrubber" config="uiConfig"></human-chapters>\n<human-slider config="config"></human-slider>')}]),a.module("templates/timeline/tour.html",[]).run(["$templateCache",function(a){a.put("templates/timeline/tour.html",'<div><button prev-next-chapter="prev"></button><human-chapters chapters-mode="tour" config="uiConfig"></human-chapters><button prev-next-chapter="next"></button></div>')}]),a.module("templates/utilities/slider.html",[]).run(["$templateCache",function(a){a.put("templates/utilities/slider.html",'<div class="track">\n  <div class="progress"></div>\n  <div class="handle"\n    ng-mouseover="showLabel = !!config.label"\n    ng-mouseleave="showLabel = false">\n    <div class="progress-label" ng-show="showLabel">{{ label }}</div>\n  </div>\n</div>')}])}(angular);