text: !function(a,b){"use strict";b.module("humanWidget",["ngTouch","oc.lazyLoad","humanWidget.webgl","humanWidget.pass","humanWidget.fail","humanWidget.files","humanWidget.user","humanWidget.backgroundColor","humanWidget.backgroundImage"]).constant("EMBEDDED",a.top!==a).run(["$rootScope","WebGLTest","WindowDimensions","iosPatch",function(a,b,c,d){c.init(),d(),b.run().then(function(b){a.$broadcast("human.result",b)})}]).factory("widgetParams",["$window","dashNormalizeFilter",function(a,b){var c={},d=/[?&]+([^=&]+)=([^&]*)/gi;return a.location.href.replace(d,function(d,e,f){c[b(e)]=a.decodeURIComponent(f)}),c}]).factory("WindowDimensions",["$window","$document","$rootScope","$timeout",function(a,c,d,e){for(var f=[480,768,991,a.Infinity],g=b.element(c[0].body),h=[],i=0;i<f.length;i++)h.push(["lte",f[i]].join("-"));var j=null,k=function(a,b){j=a,g.removeClass(h.join(" ")),g.addClass(b),d.$broadcast("window.breakpoint",j),d.$apply()},l=function(){for(var b=0;b<f.length;b++)if(a.innerWidth<=f[b])return void(j!==f[b]&&k(f[b],h[b]))};return{init:function(){b.element(a).on("resize",l),e(l)}}}]).filter("versionObject",["$window",function(a){var c=["major","minor","patch"];return function(d){var e=d.split("."),f={};return 1===e.length&&(f.custom=!0,f.name=e[0]),b.forEach(c,function(b,c){f[b]=f.custom?null:a.parseInt(e[c],10),"patch"===b&&e[c]&&2===e[c].split("-").length&&(f.custom=!0)}),f.compareTo=function(a,b,c){return"master"===f.name||"qa"===f.name?1:f.major>a?1:f.major<a?-1:f.minor>b?1:f.minor<b?-1:f.patch>c?1:f.patch<c?-1:0},f}}]).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}}).controller("MainController",["$scope","EMBEDDED","widgetParams",function(a,b,c){a.widgetParams=c,a.backgroundImage={},a.$on("human.result",function(c,d){a.embedded=b,a.pass=d.pass,a.result=d.fullResult}),a.$on("human.moduleData",function(b,c){a.moduleData=c}),a.$on("human.fallbackTour",function(b,c){a.fallbackTour=c,a.noFallbackTour=!c}),a.$on("backgroundImage.show",function(){a.backgroundImage.show=!0}),a.$on("backgroundImage.remove",function(){a.backgroundImage.remove=!0}),a.$on("backgroundImage.image",function(b,c){a.backgroundImage.load=!!c,a.backgroundImage.image=c||null})}]).factory("iosPatch",["$window","$timeout","WebGLTest",function(a,c,d){var e=b.element(a),f=a.document.body;return function(){var b=function(){f.style.position="absolute",f.style.top="0px",f.style.left="0px",f.style.right="0px",f.style.bottom="0px",f.style.height=a.innerHeight+"px"},g=d.getDevice(a.navigator.userAgent);("iPhone"===g||"iPad"===g)&&(e.on("resize",b),c(b))}}]).directive("moduleError",function(){return{restrict:"E",template:'<div class="logo-image"></div><p>Sorry, it looks like the module you\'re looking for was not found.</p>',scope:!0,link:function(a){var b=function(){Human.events.on("net.error",function(){a.show=!0,a.$apply()})};a.$on("human.loaded",b)}}}).directive("broadcastUserInteraction",["$document","$rootScope","$timeout",function(a,c,d){var e="touchstart mousedown",f="touchmove mousemove",g="touchend touchcancel mouseup mouseleave",h=b.element(a[0].body);return{restrict:"A",link:function(i,j){var k,l=!1,m=!1,n=function(a){m=a,h[m?"addClass":"removeClass"]("user-interacting");var b="userInteracting.";b+=m?"start":"finish",c.$broadcast(b)},o=function(){l||(l=!0,d.cancel(k),k=void 0,k=d(function(){n(!0)},500)),j.css("cursor","default")},p=function(){l&&(l=!1,d.cancel(k),k=void 0,m&&(k=d(function(){n(!1)},500))),j.css("cursor","auto"),b.forEach(f.split(" "),function(b){a[0].removeEventListener(b,o,!0)}),b.forEach(g.split(" "),function(b){a[0].removeEventListener(b,p,!0)})};b.forEach(e.split(" "),function(c){j[0].addEventListener(c,function(){b.forEach(f.split(" "),function(b){a[0].addEventListener(b,o,!0)}),b.forEach(g.split(" "),function(b){a[0].addEventListener(b,p,!0)})},!0)})}}}]).directive("toggleElement",["$document","$timeout",function(a,c){return{restrict:"A",link:function(d,e,f){var g=a[0].querySelector(f.toggleElement),h=b.element(g),i=function(b){g.contains(b.target)||(e[0].contains(b.target)||h.addClass("ng-hide"),a[0].removeEventListener("touchstart",i,!0),a[0].removeEventListener("click",i,!0))},j=function(){c(function(){h.hasClass("ng-hide")?(a[0].removeEventListener("touchstart",i,!0),a[0].removeEventListener("click",i,!0)):(a[0].addEventListener("touchstart",i,!0),a[0].addEventListener("click",i,!0))})};e.on("click",function(){h.toggleClass("ng-hide"),f.hasOwnProperty("globalClose")&&j()})}}}]).directive("openFrameModal",["$window",function(a){var c=b.element(a);return{restrict:"A",link:function(a,b,d){b.on("click",function(){c.triggerHandler("frameModal.open",{src:d.openFrameModal,className:d.frameModalClass})})}}}]).directive("frameModal",["$window","$sce",function(a,c){var d=b.element(a),e=['<div id="frame-container" ng-class="setFrameClasses()">','  <button class="close" ng-click="closeFrame()">&times;</button>','  <iframe ng-if="src" ng-src="{{ src }}"></iframe>',"</div>"].join("\n");return{restrict:"E",scope:!0,template:e,link:function(e,f){var g,h=a.document.getElementById("frame-container"),i=b.element(h),j=function(){var b=h.getBoundingClientRect(),c=a.innerHeight-b.top-70;h.style["max-height"]=c+"px",g&&(g.style["max-height"]=c+"px")};e.closeFrame=function(){d.off("click",e.closeFrame),f.removeClass("open"),i.removeClass(),e.src=null,e.$applyAsync()},e.$watch("src",function(a){a?(g=h.querySelector("iframe"),j()):g=null}),d.on("frameModal.open",function(d,g){e.$applyAsync(function(){f.addClass("open"),g.className&&i.addClass(g.className),e.src=c.trustAsResourceUrl(g.src),b.element(a).one("click",e.closeFrame)})}),d.on("frameModal.close",e.closeFrame),d.on("resize",function(){e.src&&j()})}}}]).directive("windowBreakpoint",["$parse",function(a){return{restrict:"A",scope:!0,link:function(b,c,d){b.$on("window.breakpoint",function(c,e){b.breakpoint=e,a(d.windowBreakpoint)(b)})}}}]),function(){var a=["uibTooltip","tooltipPlacement","tooltipTrigger"];b.forEach(a,function(a){var c=["proxy",a[0].toUpperCase()+a.slice(1)].join("");b.module("humanWidget").directive(c,["$timeout","dashNormalizeFilter",function(b,d){var e=[],f=d(c);return{restrict:"A",compile:function(g,h){if(!(e.indexOf(g[0])>-1)){var i=h[c];return b(function(){g.removeAttr(f)}),e.push(g[0]),function(b){b.$on("human.loaded",function(){g.attr(d(a),i)})}}}}}])})}(),b.module("humanWidget.backgroundColor",[]).run(["$window","$rootScope",function(a,b){a.HumanBackground&&b.$on("human.loaded",function(){a.HumanBackground.input.enableContentConfig(),a.HumanBackground.synchEngine()})}]),b.module("humanWidget.backgroundImage",[]).constant("IMAGE_PARAMS",{large:{threshold:800,"default":{width:1200,height:800}},medium:{threshold:600,"default":{width:800,height:600}},small:{"default":{width:400,height:400}}}).constant("SCREENSHOT_SERVICE","/i").constant("BOOKMARK_SERVICE","/thumbnails/bookmarks").run(["$rootScope","widgetParams","BackgroundImage",function(a,b,c){"fallback"===b["image-display"]?a.$on("human.result",function(a,b){b.pass||c.init()}):c.init()}]).factory("BackgroundImage",["$window","$timeout","$rootScope","widgetParams",function(a,c,d,e){return{_store:{container:null,image:null},get:function(a){return this._store[a]},set:function(a,b){this._store[a]=b,d.$broadcast(["backgroundImage",a].join("."),b)},show:function(a){d.$broadcast("backgroundImage.show",a)},hide:function(){d.$broadcast("backgroundImage.hide")},remove:function(){d.$broadcast("backgroundImage.remove")},init:function(){var a=this,f=e.s||"male",g=e.m||e.a,h=e.be||e.b,i=e["image-src"];c(function(){var j;if(g||h){if(j={s:f},g)j.src=/\//.test(g)?g.replace(/\.json$/,""):["production",f+"Adult",g].join("/");else{var k=e.be?"eid":"id";j[k]=h}i||(i=b.copy(j))}d.$broadcast("backgroundImage.init",{src:i,base:j}),c(function(){i?a.show(i):a.remove()})})}}}]).directive("sizeBackgroundImage",["IMAGE_PARAMS","BackgroundImage",function(a,b){return{restrict:"A",scope:!0,link:function(c){var d,e,f=function(a){if(d||e)if(c.landscape=a.width>a.height,c.portrait=a.width<a.height,c.square=a.width===a.height,"initial"===c.widgetParams["image-size"]){var b="large"===a.size&&(a.width>d[e]||a.height>d[e]);c.cover=!b}else c.cover=!0},g=function(c){if(c){var g=b.get("container"),h=a[g.size||"small"]["default"];d={width:c.width||h.width,height:c.height||h.height},e=d.width>=d.height?"width":"height",f(g)}else d=null,e=null};c.$watch("backgroundImage.image",g),c.$on("backgroundImage.container",function(a,b){f(b),c.$apply()})}}}]).directive("backgroundImage",["$document","$timeout","BackgroundImage","backgroundImageUrlFilter",function(a,b,c,d){return{restrict:"A",scope:!0,link:function(a,e){var f,g;a.show=!1;var h=function(b){var c,d,f;return b?(d="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+b.src+"', sizingMethod='scale')",c="url("+b.src+")"):c=d="none",f={"background-image":c,"-ms-filter":d,filter:d},a.hasContent=!!b,e.css(f),f},i=function(){h(null),c.set("image",{})},j=function(e){var i=$(new Image),j=!1,k=!1;a.loading=!0,i.load(function(){this.src.indexOf(f)>=0&&!k&&(k=!0,c.set("image",{css:h(this),src:this.src,width:this.width,height:this.height}),a.loading=!1,a.$apply())}),i.error(function(){this.src.indexOf(f)>=0&&(j=!0,h(null),c.set("image",null),a.show=!1,a.loading=!1,a.$apply())});var l=c.get("container").size;f=d(e,l),i[0].src=f,i[0].complete&&b(function(){k||i.trigger("load")}),g&&b.cancel(g),g=b(function(){k||j||i.trigger("load")},3e3)};a.$on("backgroundImage.show",function(b,c){j(c),a.show=!0}),a.$on("backgroundImage.hide",function(){i(),a.show=!1}),a.$on("backgroundImage.remove",function(){e.remove()})}}}]).directive("captureSize",["$window","IMAGE_PARAMS","BackgroundImage",function(a,c,d){return{restrict:"A",link:function(e,f){var g=b.element(a),h=function(){var a={width:f.outerWidth(),height:f.outerHeight()};for(var b in c)if(c.hasOwnProperty(b)){var e=c[b].threshold;if(a.width>=e||a.height>=e){a.size=b;break}}d.set("container",a)};e.$on("backgroundImage.init",h),e.$watch("backgroundImage.load",function(a){a&&(g.off("resize.backgroundImage"),g.on("resize.backgroundImage",h))}),e.$watch("backgroundImage.remove",function(a){a&&g.off("resize.backgroundImage")})}}}]).filter("backgroundImageUrl",["_moduleUrlFilter","_bookmarkUrlFilter","_customUrlFilter",function(a,b,c){return function(d,e){var f;if(d.s){var g=d.src?a:b;f=g(d,e)}else f=c(d);return f}}]).filter("_moduleUrl",["SCREENSHOT_SERVICE",function(a){return function(b){return a+"/"+b.src+".jpg"}}]).filter("_bookmarkUrl",["BOOKMARK_SERVICE",function(a){return function(b,c){var d=c?"&size="+c:"",e=b.eid?"eid":"id",f="s="+b.s+"&"+e+"="+b[e]+d;return[a,f].join("?")}}]).filter("_customUrl",["$document","SCREENSHOT_SERVICE",function(a,b){var c=function(){var b=a[0],c=b.createElement("a");return c.href=b.referrer,c.hostname}();return function(a){var d;return"!"===a[0]?(d="//"+c,a=a.slice(1)):d=b,/^(http(s)?:)?\/\//.test(a)?a:[d,a].join("/")}}]),b.module("humanWidget.fail",[]).run(["$rootScope","Module",function(a,b){var c=function(b){a.$broadcast("human.moduleData",b?b.data:null)};a.$on("human.result",function(a,d){d.pass||b.get().then(c,c.bind(null,null))})}]).factory("Module",["$http","widgetParams",function(a,b){return{get:function(){var c=b.s||"male",d=b.m||b.a,e=/\//.test(d)?d:"production/"+c+"Adult/"+d+".json";return a.get("/content/modules/"+e)}}}]).factory("cacheAssets",["backgroundImageUrlFilter","$timeout",function(a,c){return function(){var d=[],e=[],f=arguments[0],g=arguments[1];if(b.isObject(f)&&b.isDefined(g))for(var h=a(f),i=1;g>i;i++)d.push(h.replace(/(\.(\w{3}))$/,["_",".$2"].join(i)));else b.isArray(f)&&(d=f);b.forEach(d,function(a){if(b.isString(a)||b.isObject(a)&&"image"===a.type){var c=b.isString(a)?a:a.url;e.push((new Image).src=c)}}),c(function(){e=void 0})}}]).factory("FallbackVideo",["$rootScope",function(a){return{show:function(b){a.$broadcast("fallbackVideo.show",b)},hide:function(){a.$broadcast("fallbackVideo.hide")}}}]).directive("fallbackVideo",function(){return{restrict:"A",scope:!0,link:function(a,b){a.show=!1;var c,d=function(){c&&c.remove(),c=null};a.$on("fallbackVideo.show",function(e,f){d(),b.append("<iframe></iframe>"),c=b.children("iframe")[0],c.contentWindow.location.replace(f),a.show=!0}),a.$on("fallbackVideo.hide",function(){d(),a.show=!1})}}}).directive("defaultBackground",function(){return{restrict:"A",link:function(a,b){var c=function(a){return"boolean"==typeof a&&!a},d=function(){b.css({"background-image":'url("img/tiles_layer_50.jpg")',"background-size":"cover"})};a.$watch("backgroundImage.load",function(b){c(b)&&c(a.pass)&&d()}),a.$watch("pass",function(b){c(b)&&c(a.backgroundImage.load)&&d()})}}}).directive("fallbackTour",["$rootScope","BackgroundImage","FallbackVideo","cacheAssets",function(a,c,d,e){return{restrict:"E",scope:!0,template:"<fallback-tour-controls></fallback-tour-controls>",link:function(f){var g,h,i,j,k,l=function(a){a.hasOwnProperty("length")?(f.length=a.length,g&&e(g,a.length)):b.isArray(a.assets)&&(i=a.assets,f.length=i.length,e(i),f.showAsset(f.getAsset(0))),f.length>1&&(f.show=!0)};f.show=!1,f.getAsset=function(a){return k="image",i?(j=i[a],b.isObject(j)?(h=j.url,k=j.type||k):h=i[a]):(h=b.copy(g),a>0&&(h.src=[h.src,a].join("_"))),{src:h,type:k}},f.showAsset=function(a){"image"===a.type?(c.show(a.src),d.hide()):(d.show(a.src),c.hide()),f.curAsset=a},f.$on("human.moduleData",function(c,d){var e=d&&b.isObject(d.fallback);e&&l(d.fallback),a.$broadcast("human.fallbackTour",e)}),f.$on("backgroundImage.init",function(a,b){g=b.base})}}}]).directive("fallbackTourControls",function(){return{restrict:"E",template:'      <div class="arrow arrow-left"        ng-class="{ disabled: checkLimits(-1) === \'start\' }"        ng-click="step(-1)">      </div>      <div class="arrow arrow-right"        ng-class="{ disabled: checkLimits(1) === \'finish\' }"        ng-click="step(1)">      </div>    ',link:function(a){var b=0;a.checkLimits=function(c){return 0===b&&-1===c?"start":b===a.length-1&&1===c?"finish":!1},a.step=function(c){a.checkLimits(c)||(b+=c,a.showAsset(a.getAsset(b)))}}}}).directive("failModuleInfo",["$sce",function(a){return{restrict:"E",scope:!0,template:'      <button ng-show="!!description" ng-click="toggleInfo()"></button>      <h1>{{ displayName }}</h1>      <p ng-bind-html="description"></p>    ',link:function(b,c){b.toggleInfo=function(){c.toggleClass("open")},b.$watch("moduleData",function(c){c&&(b.displayName=c.displayName,b.description=a.trustAsHtml(c.description))})}}}]).directive("failMessage",function(){return{restrict:"E",scope:!0,templateUrl:"templates/fail_message.html",link:function(a){var b=function(b){if(b){var c=/android/i.test(b)?"android":"ios";a.deviceName="android"===c?"Android":b,a.deviceLink="android"===c?"https://play.google.com/store/apps/details?id=com.biodigitalhuman.humanAndroid":"https://itunes.apple.com/us/app/biodigital-human-anatomy-health/id771825569",a.imgSrc="android"===c?"Android_App_Store_Get_Badge.png":"Download_on_the_App_Store_Badge_US-UK_135x40.png"}};a.$watch("result.device",b)}}}),b.module("humanWidget.files",[]).provider("HumanFiles",function(){var a,c,d,e,f={},g={min:!1,allowParams:!1,basePath:"scripts"},h=function(a){b.extend(g,a)},i=["$filter","DEPENDENCIES","widgetParams"],j=function(h,i,j){var k=g.min?".min":"",l=b.copy(i);if(g.allowParams){var m={humanEngine:j["engine-version"]||l.humanEngine,humanUI:j["ui-version"]||l.humanUI};b.extend(l,m)}b.forEach(l,function(b,i){a=i.replace("human","").toLowerCase(),c=i.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),d=[g.basePath,a,b].join("/"),e={js:[d,c+"-"+b+k+".js"].join("/"),css:h("cssPath")({mode:k,lib:c,libPath:d,version:b})},f[a]={lib:d,files:e}});var n=h("versionObject")(l.humanEngine),o=[];if(n.compareTo(5,2,0)<0&&o.push([f.engine.lib,"lib","scenejs"+k+".js"].join("/")),o.push(f.engine.files.js),j.plugins){var p=[g.basePath,"plugins"].join("/"),q=j.plugins.split(",");b.forEach(q,function(a,b){a=[p].concat(a.split(".")).join("/")+".js",q[b]=a}),o=o.concat(q)}o.push([g.basePath,"user","human-user.js"].join("/"),f.ui.files.js);var r=[f.engine.files.css,f.ui.files.css];return{scripts:g.humanScripts||o,styles:g.humanStyles||r}};return i.push(j),{config:h,$get:i}}).filter("cssPath",["versionObjectFilter",function(a){var b,c,d,e="css/engine-default.css";return function(f){return/engine/.test(f.lib)?(d=a(f.version),b=d.custom||d.major>4||4===d.major&&(d.minor>0||d.patch>=1),c=b?[f.libPath,"css","engine.css"].join("/"):e):c=[f.libPath,"css",f.lib+"-"+f.version+f.mode+".css"].join("/"),c}}]),b.module("humanWidget.pass",[]).run(["$rootScope","HumanBootstrap",function(a,b){a.$on("human.result",function(c,d){d.pass&&b.load().then(function(){a.$broadcast("human.ready")})})}]).provider("HumanBootstrap",function(){var a={initFile:"scripts/init/init.js"},c=["$document","$q","$rootScope","$ocLazyLoad","BackgroundImage","HumanFiles","widgetParams","HumanScene","WebGLError"],d=function(c,d,e,f,g,h,i,j,k){var l=d.defer(),m=function(a,b){for(var d=a.pop(),e=a.length,g=function(){f.load(d).then(function(){b()})},h=function(){0===--e&&g()},i=function(a){var b=c[0].createElement("script");b.async=!1,b.src=a,b.onload=h,b.onerror=h,c[0].head.appendChild(b)},j=0;j<a.length;j++)i(a[j])};return{init:function(){e.$broadcast("human.loaded"),"false"===i.pre&&Human.events.on("modules.activated",g.remove),k.init();var c={};b.forEach(a,function(a,b){Human.properties.properties.hasOwnProperty(b)&&(c[b]=a)}),Human.properties.set(c),Human.init.step(j.load.bind(j)),Human.init.start(a.initFile,function(){l.resolve()})},load:function(){return m(h.scripts,this.init),l.promise}}};return c.push(d),{$get:c,config:function(c){b.extend(a,c)}}}).factory("extendUIConfig",["$rootScope","$injector",function(a,c){return function(d,e){a.$on("human.loaded",function(){if(d){var a=c.get("BASE_CONFIG");b.extend(a,d)}if(e){var f=c.get("CONFIG_ALIASES");b.extend(f,e)}})}}]).factory("ObjectTreeDisplay",["$document","$rootScope",function(a,c){for(var d,e=["human-object-tree","object-tree"],f=0;f<e.length&&!(d=a[0].querySelector(e[f]));f++);var g=b.element(d),h=!1,i=function(a){h="boolean"==typeof a?a:!h,g[h?"removeClass":"addClass"]("ng-hide")};return c.$on("window.breakpoint",function(a,b){480>=b&&i(!1)}),{setDisplay:i}}]).directive("uiComponent",["$compile",function(a){return{restrict:"A",link:function(b,c,d){var e=d.uiComponent||"ready";b.$on(["human",e].join("."),function(){a(c)(b)})}}}]).directive("linkHumanCss",["$document","HumanFiles",function(a,b){return{restrict:"A",link:function(c,d){var e,f=function(b){var f=a[0].createElement("link");f.onload=function(){e-=1,0===e&&c.$broadcast("human.cssLinked")},f.href=b,f.rel="stylesheet",f.type="text/css",d.after(f)},g=function(){var a=b.styles;e=a.length;for(var c=a.length-1;c>=0;c--)f(a[c])};c.$on("human.result",function(a,b){b.pass&&g()})}}}]).directive("ieRelinkCss",["$window",function(a){return{restrict:"A",link:function(b,c){var d=function(){var a=c[0],b=a.href;a.href="",a.href=b};b.$on("human.cssLinked",function(){"ActiveXObject"in a&&d()})}}}]).directive("clickContainer",["widgetParams","BackgroundImage",function(a,b){return{restrict:"E",scope:!0,template:"<button>Click to Interact</button>",link:function(c,d){var e=function(){"false"!==a.pre&&(c.show=!0,d.one("click",function(){d.remove(),b.remove()}))};c.$watch("backgroundImage.load",function(a){a&&c.pass&&e()}),c.$watch("pass",function(a){a&&c.backgroundImage.load&&e()})}}}]).directive("globalInfo",["$injector","EMBEDDED","widgetParams",function(a,b,c){var d=null;return{restrict:"A",scope:!1,link:function(e){var f,g=!1,h=!1,i=function(a){g=b?a:"false"!==c["ui-info"]&&"false"!==c["ui-panel"]&&"false"!==c["ui-all"]},j=function(a){d&&(f=d.state.current,h=a&&f&&a[f])};e.$on("human.loaded",function(){d=a.get("Info"),e.sceneInfo=d.state.info}),e.$watchCollection("sceneInfo",function(a){j(a),e.infoEnabled=!(!h||!g)}),e.$watch("uiComponents.config.info",function(a){i(a),e.infoEnabled=!(!h||!g)})}}}]).directive("expandInfo",["$document",function(a){var c=[],d=!1,e=b.element(a[0].body),f=b.element(a[0].querySelector("[human-info]"));return{restrict:"A",scope:!1,link:function(a,b){if(!(c.indexOf(b[0])>=0)){c.push(b[0]);var g=function(b){(f.hasClass("has-description")||d)&&(b.stopPropagation(),d=!d,e[d?"addClass":"removeClass"]("info-expanded"),a.$apply())};b.on("mouseup",g)}}}}]).directive("objectTreeDisplay",["ObjectTreeDisplay",function(a){return{restrict:"A",link:function(b,c,d){var e=d.objectTreeDisplay||"toggle";e="on"===e?!0:"off"===e?!1:void 0,c.on("click",function(){a.setDisplay(e)})}}}]).directive("timelineTouch",["$timeout",function(a){var b=!1;return{restrict:"A",scope:!0,link:function(c){b||(c.step=function(b){a(function(){Human.timeline[1===b?"next":"prev"]()})},b=!0)}}}]),b.module("humanWidget.user",[]).factory("WidgetActivity",["$window","$parse",function(a,c){var d=b.noop,e=function(d,e){var f=b.fromJson(d.responseText),g=f.error.code,h={401:{error:"INVALID_CLIENTID",message:(e.is_devleoper?"Client id":e.is_user_shared?"Uaid":"Client/ua id is")+" missing or invalid"},403:{error:"DOMAIN_UNREGISTERED",message:"Domain unregistered or not allowed"}},i=b.isObject(f.error)&&f.error.message||null;i=c(i)({}),b.isArray(i)&&(i=i.join(","));var j=function(b,c){var d="/widget-auth-error.html",e="error="+b+"&message="+a.encodeURIComponent(c);return[d,e].join("?")};switch(g){case 401:case 403:if(!e.fullscreen){h=h[g];var k=j(h.error,i||h.message);a.location.replace(k)}}};return{record:function(b){a.hasOwnProperty("Human_widget_activity")&&a.Human_widget_activity.record_widget_activity(b)},logError:function(a){this.record({status:"error",message:a})},logModuleError:function(){this.logError("loadScene - Human.init.step - module = undefined")},verify:function(a){var c={success:d,failure:e};this.record(b.extend(c,a||{}))}}}]),b.module("humanWidget.webgl",[]).provider("WebGLError",function(){var a={post:!0,log:!1,redirect:!1},c=function(c,d,e){var f=function(a){var d=[];return b.forEach(a,function(a,b){d.push([c.encodeURIComponent(b),c.encodeURIComponent(a)].join("="))}),d.join("&")};return{init:function(){"true"===e["no-error-redirect"]&&(a.log=!0,a.post=!1,a.redirect=!1),Human.events.once("error",function(b){a.log&&c.console.log(b);var e={log:b.log,stack:b.stack,webglInfo:b.webglInfo};if(a.post){var g={category:b.name,log:JSON.stringify(e),message:b.message};d({method:"POST",url:"/ws/human-error",data:g,transformRequest:f,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}})}if(a.redirect){var h="webgl-error.html?error="+b.name+"&message=["+b.type+"] "+b.message;c.location.replace(h)}})}}},d=["$window","$http","widgetParams",c];return{$get:d,config:function(c){b.extend(a,c)}}}).provider("WebGLTest",function(){var a={ios:!1,android:!1},c=["$window","$document","$q","widgetParams"],d=function(b,c,d,e){return{evaluateResult:function(b){var c=function(c,d){return("true"===e["_"+c]||a[c])&&new RegExp("^"+d,"i").test(b.device)},d=c("ios","iP"),f=c("android","Android"),g=b.html5&&b.webgl&&b.human&&(!b.device||d||f);return{pass:g,fullResult:b}},getDevice:function(a){var b=["iPad","iPhone","iPod","Android"],c=a.match(new RegExp(b.join("|"),"i"));return c&&c[0]},supportsHTML5:function(){return Modernizr.applicationcache&&Modernizr.canvas&&Modernizr.hashchange&&Modernizr.postmessage},supportsWebGL:function(){for(var a='webgl experimental-webgl webkit-3d moz-webgl "moz-glweb20',b=a.split(" "),d=c[0].createElement("canvas"),e=0;e<b.length;e++)try{if(d.getContext(b[e]))return!0}catch(f){}return!1},run:function(){var a=d.defer(),c=this.supportsHTML5(),e=c&&this.supportsWebGL(),f=c&&e;return a.resolve({html5:c,webgl:e,human:f,device:this.getDevice(b.navigator.userAgent)}),a.promise.then(this.evaluateResult)}}};return c.push(d),{$get:c,config:function(c){b.extend(a,c)}}}),b.module("humanWidget.templates",["templates/fail_message.html","templates/keypress_modal.html"]),b.module("templates/fail_message.html",[]).run(["$templateCache",function(a){a.put("templates/fail_message.html",'<a ng-if="!!result.device" href="{{ deviceLink }}">\n  <p>Now freely available on {{ deviceName }}</p>\n  <img ng-src="{{ \'/img/\' + imgSrc }}">\n</a>\n\n<div ng-if="!result.device">\n  <div class="logo-image"></div>\n  <p class="error-generic">Sorry, it looks like your browser does not currently support the Human. Give us a try on Chrome or Firefox for your desktop.</p>\n  <div class="error-details" ng-show="!!result">\n      <h5><b>Details</b></h5>\n      <p id="support-webgl"><b>WebGL: {{ result.webgl }}</b><span></span></p>\n      <p id="support-html5"><b>HTML5: {{ result.html5 }}</b><span></span></p>\n      <p id="support-human"><b>Human: {{ result.human }}</b><span></span></p>\n  </div>\n</div>')}]),b.module("templates/keypress_modal.html",[]).run(["$templateCache",function(a){a.put("templates/keypress_modal.html",'<div class="content">\n  <div class="header">\n   <h1>Human Keypresses</h1>\n     <button>\n       <img\n         src="img/shim.gif"\n         alt="Close"\n         title="Close"\n         class="icon-close"\n         ng-click="in = false">\n     </button>\n  </div>\n  <iframe\n   id="keypress-frame"\n   class="modal-frame normal-scroll"\n   frameborder="0"\n   scrolling="auto">\n  </iframe>\n</div>')}])}(window,angular);