var requirejs,require,define;!function(global){function commentReplace(e,t,i,n){return n||""}function isFunction(e){return"[object Function]"===ostring.call(e)}function isArray(e){return"[object Array]"===ostring.call(e)}function each(e,t){if(e){var i;for(i=0;i<e.length&&(!e[i]||!t(e[i],i,e));i+=1);}}function eachReverse(e,t){if(e){var i;for(i=e.length-1;i>-1&&(!e[i]||!t(e[i],i,e));i-=1);}}function hasProp(e,t){return hasOwn.call(e,t)}function getOwn(e,t){return hasProp(e,t)&&e[t]}function eachProp(e,t){var i;for(i in e)if(hasProp(e,i)&&t(e[i],i))break}function mixin(e,t,i,n){return t&&eachProp(t,function(t,o){(i||!hasProp(e,o))&&(!n||"object"!=typeof t||!t||isArray(t)||isFunction(t)||t instanceof RegExp?e[o]=t:(e[o]||(e[o]={}),mixin(e[o],t,i,n)))}),e}function bind(e,t){return function(){return t.apply(e,arguments)}}function scripts(){return document.getElementsByTagName("script")}function defaultOnError(e){throw e}function getGlobal(e){if(!e)return e;var t=global;return each(e.split("."),function(e){t=t[e]}),t}function makeError(e,t,i,n){var o=new Error(t+"\nhttp://requirejs.org/docs/errors.html#"+e);return o.requireType=e,o.requireModules=n,i&&(o.originalError=i),o}function newContext(e){function t(e){var t,i;for(t=0;t<e.length;t++)if(i=e[t],"."===i)e.splice(t,1),t-=1;else if(".."===i){if(0===t||1===t&&".."===e[2]||".."===e[t-1])continue;t>0&&(e.splice(t-1,2),t-=2)}}function i(e,i,n){var o,s,r,a,l,h,c,u,p,d,g,f,m=i&&i.split("/"),v=x.map,$=v&&v["*"];if(e&&(e=e.split("/"),c=e.length-1,x.nodeIdCompat&&jsSuffixRegExp.test(e[c])&&(e[c]=e[c].replace(jsSuffixRegExp,"")),"."===e[0].charAt(0)&&m&&(f=m.slice(0,m.length-1),e=f.concat(e)),t(e),e=e.join("/")),n&&v&&(m||$)){r=e.split("/");e:for(a=r.length;a>0;a-=1){if(h=r.slice(0,a).join("/"),m)for(l=m.length;l>0;l-=1)if(s=getOwn(v,m.slice(0,l).join("/")),s&&(s=getOwn(s,h))){u=s,p=a;break e}!d&&$&&getOwn($,h)&&(d=getOwn($,h),g=a)}!u&&d&&(u=d,p=g),u&&(r.splice(0,p,u),e=r.join("/"))}return o=getOwn(x.pkgs,e),o?o:e}function n(e){isBrowser&&each(scripts(),function(t){return t.getAttribute("data-requiremodule")===e&&t.getAttribute("data-requirecontext")===E.contextName?(t.parentNode.removeChild(t),!0):void 0})}function o(e){var t=getOwn(x.paths,e);return t&&isArray(t)&&t.length>1?(t.shift(),E.require.undef(e),E.makeRequire(null,{skipMap:!0})([e]),!0):void 0}function s(e){var t,i=e?e.indexOf("!"):-1;return i>-1&&(t=e.substring(0,i),e=e.substring(i+1,e.length)),[t,e]}function r(e,t,n,o){var r,a,l,h,c=null,u=t?t.name:null,p=e,d=!0,g="";return e||(d=!1,e="_@r"+(D+=1)),h=s(e),c=h[0],e=h[1],c&&(c=i(c,u,o),a=getOwn(I,c)),e&&(c?g=a&&a.normalize?a.normalize(e,function(e){return i(e,u,o)}):-1===e.indexOf("!")?i(e,u,o):e:(g=i(e,u,o),h=s(g),c=h[0],g=h[1],n=!0,r=E.nameToUrl(g))),l=!c||a||n?"":"_unnormalized"+(A+=1),{prefix:c,name:g,parentMap:t,unnormalized:!!l,url:r,originalName:p,isDefine:d,id:(c?c+"!"+g:g)+l}}function a(e){var t=e.id,i=getOwn(w,t);return i||(i=w[t]=new E.Module(e)),i}function l(e,t,i){var n=e.id,o=getOwn(w,n);!hasProp(I,n)||o&&!o.defineEmitComplete?(o=a(e),o.error&&"error"===t?i(o.error):o.on(t,i)):"defined"===t&&i(I[n])}function h(e,t){var i=e.requireModules,n=!1;t?t(e):(each(i,function(t){var i=getOwn(w,t);i&&(i.error=e,i.events.error&&(n=!0,i.emit("error",e)))}),n||req.onError(e))}function c(){globalDefQueue.length&&(each(globalDefQueue,function(e){var t=e[0];"string"==typeof t&&(E.defQueueMap[t]=!0),R.push(e)}),globalDefQueue=[])}function u(e){delete w[e],delete S[e]}function p(e,t,i){var n=e.map.id;e.error?e.emit("error",e.error):(t[n]=!0,each(e.depMaps,function(n,o){var s=n.id,r=getOwn(w,s);!r||e.depMatched[o]||i[s]||(getOwn(t,s)?(e.defineDep(o,I[s]),e.check()):p(r,t,i))}),i[n]=!0)}function d(){var e,t,i=1e3*x.waitSeconds,s=i&&E.startTime+i<(new Date).getTime(),r=[],a=[],l=!1,c=!0;if(!$){if($=!0,eachProp(S,function(e){var i=e.map,h=i.id;if(e.enabled&&(i.isDefine||a.push(e),!e.error))if(!e.inited&&s)o(h)?(t=!0,l=!0):(r.push(h),n(h));else if(!e.inited&&e.fetched&&i.isDefine&&(l=!0,!i.prefix))return c=!1}),s&&r.length)return e=makeError("timeout","Load timeout for modules: "+r,null,r),e.contextName=E.contextName,h(e);c&&each(a,function(e){p(e,{},{})}),s&&!t||!l||!isBrowser&&!isWebWorker||y||(y=setTimeout(function(){y=0,d()},50)),$=!1}}function g(e){hasProp(I,e[0])||a(r(e[0],null,!0)).init(e[1],e[2])}function f(e,t,i,n){e.detachEvent&&!isOpera?n&&e.detachEvent(n,t):e.removeEventListener(i,t,!1)}function m(e){var t=e.currentTarget||e.srcElement;return f(t,E.onScriptLoad,"load","onreadystatechange"),f(t,E.onScriptError,"error"),{node:t,id:t&&t.getAttribute("data-requiremodule")}}function v(){var e;for(c();R.length;){if(e=R.shift(),null===e[0])return h(makeError("mismatch","Mismatched anonymous define() module: "+e[e.length-1]));g(e)}E.defQueueMap={}}var $,b,E,_,y,x={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},w={},S={},C={},R=[],I={},T={},O={},D=1,A=1;return _={require:function(e){return e.require?e.require:e.require=E.makeRequire(e.map)},exports:function(e){return e.usingExports=!0,e.map.isDefine?e.exports?I[e.map.id]=e.exports:e.exports=I[e.map.id]={}:void 0},module:function(e){return e.module?e.module:e.module={id:e.map.id,uri:e.map.url,config:function(){return getOwn(x.config,e.map.id)||{}},exports:e.exports||(e.exports={})}}},b=function(e){this.events=getOwn(C,e.id)||{},this.map=e,this.shim=getOwn(x.shim,e.id),this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0},b.prototype={init:function(e,t,i,n){n=n||{},this.inited||(this.factory=t,i?this.on("error",i):this.events.error&&(i=bind(this,function(e){this.emit("error",e)})),this.depMaps=e&&e.slice(0),this.errback=i,this.inited=!0,this.ignore=n.ignore,n.enabled||this.enabled?this.enable():this.check())},defineDep:function(e,t){this.depMatched[e]||(this.depMatched[e]=!0,this.depCount-=1,this.depExports[e]=t)},fetch:function(){if(!this.fetched){this.fetched=!0,E.startTime=(new Date).getTime();var e=this.map;return this.shim?void E.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],bind(this,function(){return e.prefix?this.callPlugin():this.load()})):e.prefix?this.callPlugin():this.load()}},load:function(){var e=this.map.url;T[e]||(T[e]=!0,E.load(this.map.id,e))},check:function(){if(this.enabled&&!this.enabling){var e,t,i=this.map.id,n=this.depExports,o=this.exports,s=this.factory;if(this.inited){if(this.error)this.emit("error",this.error);else if(!this.defining){if(this.defining=!0,this.depCount<1&&!this.defined){if(isFunction(s)){if(this.events.error&&this.map.isDefine||req.onError!==defaultOnError)try{o=E.execCb(i,s,n,o)}catch(r){e=r}else o=E.execCb(i,s,n,o);if(this.map.isDefine&&void 0===o&&(t=this.module,t?o=t.exports:this.usingExports&&(o=this.exports)),e)return e.requireMap=this.map,e.requireModules=this.map.isDefine?[this.map.id]:null,e.requireType=this.map.isDefine?"define":"require",h(this.error=e)}else o=s;if(this.exports=o,this.map.isDefine&&!this.ignore&&(I[i]=o,req.onResourceLoad)){var a=[];each(this.depMaps,function(e){a.push(e.normalizedMap||e)}),req.onResourceLoad(E,this.map,a)}u(i),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else hasProp(E.defQueueMap,i)||this.fetch()}},callPlugin:function(){var e=this.map,t=e.id,n=r(e.prefix);this.depMaps.push(n),l(n,"defined",bind(this,function(n){var o,s,c,p=getOwn(O,this.map.id),d=this.map.name,g=this.map.parentMap?this.map.parentMap.name:null,f=E.makeRequire(e.parentMap,{enableBuildCallback:!0});return this.map.unnormalized?(n.normalize&&(d=n.normalize(d,function(e){return i(e,g,!0)})||""),s=r(e.prefix+"!"+d,this.map.parentMap),l(s,"defined",bind(this,function(e){this.map.normalizedMap=s,this.init([],function(){return e},null,{enabled:!0,ignore:!0})})),c=getOwn(w,s.id),void(c&&(this.depMaps.push(s),this.events.error&&c.on("error",bind(this,function(e){this.emit("error",e)})),c.enable()))):p?(this.map.url=E.nameToUrl(p),void this.load()):(o=bind(this,function(e){this.init([],function(){return e},null,{enabled:!0})}),o.error=bind(this,function(e){this.inited=!0,this.error=e,e.requireModules=[t],eachProp(w,function(e){0===e.map.id.indexOf(t+"_unnormalized")&&u(e.map.id)}),h(e)}),o.fromText=bind(this,function(i,n){var s=e.name,l=r(s),c=useInteractive;n&&(i=n),c&&(useInteractive=!1),a(l),hasProp(x.config,t)&&(x.config[s]=x.config[t]);try{req.exec(i)}catch(u){return h(makeError("fromtexteval","fromText eval for "+t+" failed: "+u,u,[t]))}c&&(useInteractive=!0),this.depMaps.push(l),E.completeLoad(s),f([s],o)}),void n.load(e.name,f,o,x))})),E.enable(n,this),this.pluginMaps[n.id]=n},enable:function(){S[this.map.id]=this,this.enabled=!0,this.enabling=!0,each(this.depMaps,bind(this,function(e,t){var i,n,o;if("string"==typeof e){if(e=r(e,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[t]=e,o=getOwn(_,e.id))return void(this.depExports[t]=o(this));this.depCount+=1,l(e,"defined",bind(this,function(e){this.undefed||(this.defineDep(t,e),this.check())})),this.errback?l(e,"error",bind(this,this.errback)):this.events.error&&l(e,"error",bind(this,function(e){this.emit("error",e)}))}i=e.id,n=w[i],hasProp(_,i)||!n||n.enabled||E.enable(e,this)})),eachProp(this.pluginMaps,bind(this,function(e){var t=getOwn(w,e.id);t&&!t.enabled&&E.enable(e,this)})),this.enabling=!1,this.check()},on:function(e,t){var i=this.events[e];i||(i=this.events[e]=[]),i.push(t)},emit:function(e,t){each(this.events[e],function(e){e(t)}),"error"===e&&delete this.events[e]}},E={config:x,contextName:e,registry:w,defined:I,urlFetched:T,defQueue:R,defQueueMap:{},Module:b,makeModuleMap:r,nextTick:req.nextTick,onError:h,configure:function(e){if(e.baseUrl&&"/"!==e.baseUrl.charAt(e.baseUrl.length-1)&&(e.baseUrl+="/"),"string"==typeof e.urlArgs){var t=e.urlArgs;e.urlArgs=function(e,i){return(-1===i.indexOf("?")?"?":"&")+t}}var i=x.shim,n={paths:!0,bundles:!0,config:!0,map:!0};eachProp(e,function(e,t){n[t]?(x[t]||(x[t]={}),mixin(x[t],e,!0,!0)):x[t]=e}),e.bundles&&eachProp(e.bundles,function(e,t){each(e,function(e){e!==t&&(O[e]=t)})}),e.shim&&(eachProp(e.shim,function(e,t){isArray(e)&&(e={deps:e}),!e.exports&&!e.init||e.exportsFn||(e.exportsFn=E.makeShimExports(e)),i[t]=e}),x.shim=i),e.packages&&each(e.packages,function(e){var t,i;e="string"==typeof e?{name:e}:e,i=e.name,t=e.location,t&&(x.paths[i]=e.location),x.pkgs[i]=e.name+"/"+(e.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}),eachProp(w,function(e,t){e.inited||e.map.unnormalized||(e.map=r(t,null,!0))}),(e.deps||e.callback)&&E.require(e.deps||[],e.callback)},makeShimExports:function(e){function t(){var t;return e.init&&(t=e.init.apply(global,arguments)),t||e.exports&&getGlobal(e.exports)}return t},makeRequire:function(t,o){function s(i,n,l){var c,u,p;return o.enableBuildCallback&&n&&isFunction(n)&&(n.__requireJsBuild=!0),"string"==typeof i?isFunction(n)?h(makeError("requireargs","Invalid require call"),l):t&&hasProp(_,i)?_[i](w[t.id]):req.get?req.get(E,i,t,s):(u=r(i,t,!1,!0),c=u.id,hasProp(I,c)?I[c]:h(makeError("notloaded",'Module name "'+c+'" has not been loaded yet for context: '+e+(t?"":". Use require([])")))):(v(),E.nextTick(function(){v(),p=a(r(null,t)),p.skipMap=o.skipMap,p.init(i,n,l,{enabled:!0}),d()}),s)}return o=o||{},mixin(s,{isBrowser:isBrowser,toUrl:function(e){var n,o=e.lastIndexOf("."),s=e.split("/")[0],r="."===s||".."===s;return-1!==o&&(!r||o>1)&&(n=e.substring(o,e.length),e=e.substring(0,o)),E.nameToUrl(i(e,t&&t.id,!0),n,!0)},defined:function(e){return hasProp(I,r(e,t,!1,!0).id)},specified:function(e){return e=r(e,t,!1,!0).id,hasProp(I,e)||hasProp(w,e)}}),t||(s.undef=function(e){c();var i=r(e,t,!0),o=getOwn(w,e);o.undefed=!0,n(e),delete I[e],delete T[i.url],delete C[e],eachReverse(R,function(t,i){t[0]===e&&R.splice(i,1)}),delete E.defQueueMap[e],o&&(o.events.defined&&(C[e]=o.events),u(e))}),s},enable:function(e){var t=getOwn(w,e.id);t&&a(e).enable()},completeLoad:function(e){var t,i,n,s=getOwn(x.shim,e)||{},r=s.exports;for(c();R.length;){if(i=R.shift(),null===i[0]){if(i[0]=e,t)break;t=!0}else i[0]===e&&(t=!0);g(i)}if(E.defQueueMap={},n=getOwn(w,e),!t&&!hasProp(I,e)&&n&&!n.inited){if(!(!x.enforceDefine||r&&getGlobal(r)))return o(e)?void 0:h(makeError("nodefine","No define call for "+e,null,[e]));g([e,s.deps||[],s.exportsFn])}d()},nameToUrl:function(e,t,i){var n,o,s,r,a,l,h,c=getOwn(x.pkgs,e);if(c&&(e=c),h=getOwn(O,e))return E.nameToUrl(h,t,i);if(req.jsExtRegExp.test(e))a=e+(t||"");else{for(n=x.paths,o=e.split("/"),s=o.length;s>0;s-=1)if(r=o.slice(0,s).join("/"),l=getOwn(n,r)){isArray(l)&&(l=l[0]),o.splice(0,s,l);break}a=o.join("/"),a+=t||(/^data\:|^blob\:|\?/.test(a)||i?"":".js"),a=("/"===a.charAt(0)||a.match(/^[\w\+\.\-]+:/)?"":x.baseUrl)+a}return x.urlArgs&&!/^blob\:/.test(a)?a+x.urlArgs(e,a):a},load:function(e,t){req.load(E,e,t)},execCb:function(e,t,i,n){return t.apply(n,i)},onScriptLoad:function(e){if("load"===e.type||readyRegExp.test((e.currentTarget||e.srcElement).readyState)){interactiveScript=null;var t=m(e);E.completeLoad(t.id)}},onScriptError:function(e){var t=m(e);if(!o(t.id)){var i=[];return eachProp(w,function(e,n){0!==n.indexOf("_@r")&&each(e.depMaps,function(e){return e.id===t.id?(i.push(n),!0):void 0})}),h(makeError("scripterror",'Script error for "'+t.id+(i.length?'", needed by: '+i.join(", "):'"'),e,[t.id]))}}},E.require=E.makeRequire(),E}function getInteractiveScript(){return interactiveScript&&"interactive"===interactiveScript.readyState?interactiveScript:(eachReverse(scripts(),function(e){return"interactive"===e.readyState?interactiveScript=e:void 0}),interactiveScript)}var req,s,head,baseElement,dataMain,src,interactiveScript,currentlyAddingScript,mainScript,subPath,version="2.2.0",commentRegExp=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/gm,cjsRequireRegExp=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,jsSuffixRegExp=/\.js$/,currDirRegExp=/^\.\//,op=Object.prototype,ostring=op.toString,hasOwn=op.hasOwnProperty,isBrowser=!("undefined"==typeof window||"undefined"==typeof navigator||!window.document),isWebWorker=!isBrowser&&"undefined"!=typeof importScripts,readyRegExp=isBrowser&&"PLAYSTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/,defContextName="_",isOpera="undefined"!=typeof opera&&"[object Opera]"===opera.toString(),contexts={},cfg={},globalDefQueue=[],useInteractive=!1;if("undefined"==typeof define){if("undefined"!=typeof requirejs){if(isFunction(requirejs))return;cfg=requirejs,requirejs=void 0}"undefined"==typeof require||isFunction(require)||(cfg=require,require=void 0),req=requirejs=function(e,t,i,n){var o,s,r=defContextName;return isArray(e)||"string"==typeof e||(s=e,isArray(t)?(e=t,t=i,i=n):e=[]),s&&s.context&&(r=s.context),o=getOwn(contexts,r),o||(o=contexts[r]=req.s.newContext(r)),s&&o.configure(s),o.require(e,t,i)},req.config=function(e){return req(e)},req.nextTick="undefined"!=typeof setTimeout?function(e){setTimeout(e,4)}:function(e){e()},require||(require=req),req.version=version,req.jsExtRegExp=/^\/|:|\?|\.js$/,req.isBrowser=isBrowser,s=req.s={contexts:contexts,newContext:newContext},req({}),each(["toUrl","undef","defined","specified"],function(e){req[e]=function(){var t=contexts[defContextName];return t.require[e].apply(t,arguments)}}),isBrowser&&(head=s.head=document.getElementsByTagName("head")[0],baseElement=document.getElementsByTagName("base")[0],baseElement&&(head=s.head=baseElement.parentNode)),req.onError=defaultOnError,req.createNode=function(e,t,i){var n=e.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");return n.type=e.scriptType||"text/javascript",n.charset="utf-8",n.async=!0,n},req.load=function(e,t,i){var n,o=e&&e.config||{};if(isBrowser)return n=req.createNode(o,t,i),n.setAttribute("data-requirecontext",e.contextName),n.setAttribute("data-requiremodule",t),!n.attachEvent||n.attachEvent.toString&&n.attachEvent.toString().indexOf("[native code")<0||isOpera?(n.addEventListener("load",e.onScriptLoad,!1),n.addEventListener("error",e.onScriptError,!1)):(useInteractive=!0,n.attachEvent("onreadystatechange",e.onScriptLoad)),n.src=i,o.onNodeCreated&&o.onNodeCreated(n,o,t,i),currentlyAddingScript=n,baseElement?head.insertBefore(n,baseElement):head.appendChild(n),currentlyAddingScript=null,n;if(isWebWorker)try{setTimeout(function(){},0),importScripts(i),e.completeLoad(t)}catch(s){e.onError(makeError("importscripts","importScripts failed for "+t+" at "+i,s,[t]))}},isBrowser&&!cfg.skipDataMain&&eachReverse(scripts(),function(e){return head||(head=e.parentNode),dataMain=e.getAttribute("data-main"),dataMain?(mainScript=dataMain,cfg.baseUrl||-1!==mainScript.indexOf("!")||(src=mainScript.split("/"),mainScript=src.pop(),subPath=src.length?src.join("/")+"/":"./",cfg.baseUrl=subPath),mainScript=mainScript.replace(jsSuffixRegExp,""),req.jsExtRegExp.test(mainScript)&&(mainScript=dataMain),cfg.deps=cfg.deps?cfg.deps.concat(mainScript):[mainScript],!0):void 0}),define=function(e,t,i){var n,o;"string"!=typeof e&&(i=t,t=e,e=null),isArray(t)||(i=t,t=null),!t&&isFunction(i)&&(t=[],i.length&&(i.toString().replace(commentRegExp,commentReplace).replace(cjsRequireRegExp,function(e,i){t.push(i)}),t=(1===i.length?["require"]:["require","exports","module"]).concat(t))),useInteractive&&(n=currentlyAddingScript||getInteractiveScript(),n&&(e||(e=n.getAttribute("data-requiremodule")),o=contexts[n.getAttribute("data-requirecontext")])),o?(o.defQueue.push([e,t,i]),o.defQueueMap[e]=!0):globalDefQueue.push([e,t,i])},define.amd={jQuery:!0},req.exec=function(text){return eval(text)},req(cfg)}}(this),define("requireLib",function(){}),define("modules/uv-shared-module/BaseCommands",["require","exports"],function(e,t){"use strict";var i=function(){function e(){}return e}();return i.namespace="uv.",i.ACCEPT_TERMS=i.namespace+"onAcceptTerms",i.BOOKMARK=i.namespace+"onBookmark",i.CANVAS_INDEX_CHANGE_FAILED=i.namespace+"onCanvasIndexChangeFailed",i.CANVAS_INDEX_CHANGED=i.namespace+"onCanvasIndexChanged",i.CLICKTHROUGH=i.namespace+"onClickthrough",i.CLOSE_ACTIVE_DIALOGUE=i.namespace+"onCloseActiveDialogue",i.CLOSE_LEFT_PANEL=i.namespace+"onCloseLeftPanel",i.CLOSE_RIGHT_PANEL=i.namespace+"onCloseRightPanel",i.CREATED=i.namespace+"onCreated",i.DOWN_ARROW=i.namespace+"onDownArrow",i.DOWNLOAD=i.namespace+"onDownload",i.DROP=i.namespace+"onDrop",i.END=i.namespace+"onEnd",i.ESCAPE=i.namespace+"onEscape",i.EXTERNAL_LINK_CLICKED=i.namespace+"onExternalLinkClicked",i.FEEDBACK=i.namespace+"onFeedback",i.FORBIDDEN=i.namespace+"onForbidden",i.HIDE_CLICKTHROUGH_DIALOGUE=i.namespace+"onHideClickthroughDialogue",i.HIDE_DOWNLOAD_DIALOGUE=i.namespace+"onHideDownloadDialogue",i.HIDE_EMBED_DIALOGUE=i.namespace+"onHideEmbedDialogue",i.HIDE_EXTERNALCONTENT_DIALOGUE=i.namespace+"onHideExternalContentDialogue",i.HIDE_GENERIC_DIALOGUE=i.namespace+"onHideGenericDialogue",i.HIDE_HELP_DIALOGUE=i.namespace+"onHideHelpDialogue",i.HIDE_INFORMATION=i.namespace+"onHideInformation",i.HIDE_LOGIN_DIALOGUE=i.namespace+"onHideLoginDialogue",i.HIDE_MOREINFO_DIALOGUE=i.namespace+"onHideMoreInfoDialogue",i.HIDE_OVERLAY=i.namespace+"onHideOverlay",i.HIDE_RESTRICTED_DIALOGUE=i.namespace+"onHideRestrictedDialogue",i.HIDE_SETTINGS_DIALOGUE=i.namespace+"onHideSettingsDialogue",i.HIDE_SHARE_DIALOGUE=i.namespace+"onHideShareDialogue",i.HOME=i.namespace+"onHome",i.LEFT_ARROW=i.namespace+"onLeftArrow",i.LEFTPANEL_COLLAPSE_FULL_FINISH=i.namespace+"onLeftPanelCollapseFullFinish",i.LEFTPANEL_COLLAPSE_FULL_START=i.namespace+"onLeftPanelCollapseFullStart",i.LEFTPANEL_EXPAND_FULL_FINISH=i.namespace+"onLeftPanelExpandFullFinish",i.LEFTPANEL_EXPAND_FULL_START=i.namespace+"onLeftPanelExpandFullStart",i.LOAD_FAILED=i.namespace+"onLoadFailed",i.LOAD=i.namespace+"onLoad",i.LOGIN_FAILED=i.namespace+"onLoginFailed",i.LOGIN=i.namespace+"onLogin",i.LOGOUT=i.namespace+"onLogout",i.METRIC_CHANGED=i.namespace+"onMetricChanged",i.MINUS=i.namespace+"onMinus",i.NOT_FOUND=i.namespace+"onNotFound",i.OPEN_EXTERNAL_RESOURCE=i.namespace+"onOpenExternalResource",i.OPEN_LEFT_PANEL=i.namespace+"onOpenLeftPanel",i.OPEN_RIGHT_PANEL=i.namespace+"onOpenRightPanel",i.OPEN=i.namespace+"onOpen",i.PAGE_DOWN=i.namespace+"onPageDown",i.PAGE_UP=i.namespace+"onPageUp",i.PARENT_EXIT_FULLSCREEN=i.namespace+"onParentExitFullScreen",i.PLUS=i.namespace+"onPlus",i.REDIRECT=i.namespace+"onRedirect",i.REFRESH=i.namespace+"onRefresh",i.RESIZE=i.namespace+"onResize",i.RESOURCE_DEGRADED=i.namespace+"onResourceDegraded",i.RETRY=i.namespace+"onRetry",i.RETURN=i.namespace+"onReturn",i.RIGHT_ARROW=i.namespace+"onRightArrow",i.RIGHTPANEL_COLLAPSE_FULL_FINISH=i.namespace+"onRightPanelCollapseFullFinish",i.RIGHTPANEL_COLLAPSE_FULL_START=i.namespace+"onRightPanelCollapseFullStart",i.RIGHTPANEL_EXPAND_FULL_FINISH=i.namespace+"onRightPanelExpandFullFinish",i.RIGHTPANEL_EXPAND_FULL_START=i.namespace+"onRightPanelExpandFullStart",i.SEQUENCE_INDEX_CHANGED=i.namespace+"onSequenceIndexChanged",i.SETTINGS_CHANGED=i.namespace+"onSettingsChanged",i.SHOW_CLICKTHROUGH_DIALOGUE=i.namespace+"onShowClickThroughDialogue",i.SHOW_DOWNLOAD_DIALOGUE=i.namespace+"onShowDownloadDialogue",i.SHOW_EMBED_DIALOGUE=i.namespace+"onShowEmbedDialogue",i.SHOW_EXTERNALCONTENT_DIALOGUE=i.namespace+"onShowExternalContentDialogue",i.SHOW_GENERIC_DIALOGUE=i.namespace+"onShowGenericDialogue",i.SHOW_HELP_DIALOGUE=i.namespace+"onShowHelpDialogue",i.SHOW_INFORMATION=i.namespace+"onShowInformation",i.SHOW_LOGIN_DIALOGUE=i.namespace+"onShowLoginDialogue",i.SHOW_MOREINFO_DIALOGUE=i.namespace+"onShowMoreInfoDialogue",i.SHOW_OVERLAY=i.namespace+"onShowOverlay",i.SHOW_RESTRICTED_DIALOGUE=i.namespace+"onShowRestrictedDialogue",i.SHOW_SETTINGS_DIALOGUE=i.namespace+"onShowSettingsDialogue",i.SHOW_SHARE_DIALOGUE=i.namespace+"onShowShareDialogue",i.SHOW_TERMS_OF_USE=i.namespace+"onShowTermsOfUse",i.THUMB_SELECTED=i.namespace+"onThumbSelected",i.TOGGLE_EXPAND_LEFT_PANEL=i.namespace+"onToggleExpandLeftPanel",i.TOGGLE_EXPAND_RIGHT_PANEL=i.namespace+"onToggleExpandRightPanel",i.TOGGLE_FULLSCREEN=i.namespace+"onToggleFullScreen",i.UP_ARROW=i.namespace+"onUpArrow",i.UPDATE_SETTINGS=i.namespace+"onUpdateSettings",i.VIEW_FULL_TERMS=i.namespace+"onViewFullTerms",i.WINDOW_UNLOAD=i.namespace+"onWindowUnload",i}),define("Params",["require","exports"],function(e,t){"use strict";var i;return function(e){e[e.collectionIndex=0]="collectionIndex",e[e.manifestIndex=1]="manifestIndex",e[e.sequenceIndex=2]="sequenceIndex",e[e.canvasIndex=3]="canvasIndex",e[e.xywh=4]="xywh",e[e.rotation=5]="rotation",e[e.highlight=6]="highlight",e[e.anchor=7]="anchor"}(i||(i={})),i}),define("BootstrapParams",["require","exports","./Params"],function(e,t,i){"use strict";var n=function(){function e(){this.paramMap=["c","m","s","cv","xywh","r","h","a"],this.config=Utils.Urls.getQuerystringParameter("config"),this.domain=Utils.Urls.getQuerystringParameter("domain"),this.embedDomain=Utils.Urls.getQuerystringParameter("embedDomain"),this.embedScriptUri=Utils.Urls.getQuerystringParameter("embedScriptUri"),this.isHomeDomain="true"===Utils.Urls.getQuerystringParameter("isHomeDomain"),this.isLightbox="true"===Utils.Urls.getQuerystringParameter("isLightbox"),this.isOnlyInstance="true"===Utils.Urls.getQuerystringParameter("isOnlyInstance"),this.isReload="true"===Utils.Urls.getQuerystringParameter("isReload");var e=Utils.Urls.getQuerystringParameter("jsonp");this.jsonp=null===e?null:!("false"===e||"0"===e),this.manifestUri=Utils.Urls.getQuerystringParameter("manifestUri");var t=Utils.Urls.getQuerystringParameter("locale")||"en-GB";this.setLocale(t),this.collectionIndex=this.getParam(i.collectionIndex),this.manifestIndex=this.getParam(i.manifestIndex),this.sequenceIndex=this.getParam(i.sequenceIndex),this.canvasIndex=this.getParam(i.canvasIndex)}return e.prototype.getLocaleName=function(){return this.localeName},e.prototype.getParam=function(e){if(this.hashParamsAvailable()){var t=parseInt(Utils.Urls.getHashParameter(this.paramMap[e],parent.document));if(t||0===t)return t}return parseInt(Utils.Urls.getQuerystringParameter(this.paramMap[e]))||0},e.prototype.hashParamsAvailable=function(){return this.isHomeDomain&&!this.isReload&&this.isOnlyInstance},e.prototype.setLocale=function(e){this.locale=e,this.locales=[];for(var t=this.locale.split(","),i=0;i<t.length;i++){var n=t[i].split(":");this.locales.push({name:n[0].trim(),label:n[1]?n[1].trim():""})}this.localeName=this.locales[0].name},e}();t.BootstrapParams=n}),define("Bootstrapper",["require","exports","./modules/uv-shared-module/BaseCommands","./BootstrapParams"],function(e,t,i,n){"use strict";var o=function(){function e(e){this.isFullScreen=!1,this.extensions=e}return e.prototype.bootstrap=function(e){var t=this;this.params=new n.BootstrapParams,e&&(this.params=$.extend(!0,this.params,e)),this.params.manifestUri&&($("#app").empty(),$("#app").addClass("loading"),$('link[type*="text/css"]').remove(),jQuery.support.cors=!0,Manifold.loadManifest({iiifResourceUri:this.params.manifestUri,collectionIndex:this.params.collectionIndex,manifestIndex:this.params.manifestIndex,sequenceIndex:this.params.sequenceIndex,canvasIndex:this.params.canvasIndex,locale:this.params.localeName}).then(function(e){var i=e.getTrackingLabel();i+=", URI: "+t.params.embedDomain,window.trackingLabel=i;var n=e.getSequenceByIndex(t.params.sequenceIndex);if(!n)return void t.notFound();var o=e.getCanvasByIndex(t.params.canvasIndex);if(!o)return void t.notFound();var s=o.getType(),r=t.extensions[s.toString()];if(!r){var a=o.getProperty("format");r=t.extensions[a]}return r?(r.helper=e,void t.featureDetect(function(){t.configure(r,function(e){t.injectCss(r,e,function(){t.createExtension(r,e)})})})):void alert("No matching UV extension found.")})["catch"](function(){this.notFound()}))},e.prototype.isCORSEnabled=function(){return null===this.params.jsonp?Modernizr.cors:!this.params.jsonp},e.prototype.notFound=function(){try{return void parent.$(parent.document).trigger(i.NOT_FOUND)}catch(e){}},e.prototype.featureDetect=function(e){yepnope({test:window.btoa&&window.atob,nope:"lib/base64.min.js",complete:function(){e()}})},e.prototype.configure=function(e,t){var i=this,n=this;this.getConfigExtension(e,function(o){var s=window.DEBUG?"extensions/"+e.name+"/build/"+n.params.getLocaleName()+".config.json":"lib/"+e.name+"."+n.params.getLocaleName()+".config.json";$.getJSON(s,function(n){i.extendConfig(e,n,o,t)})})},e.prototype.extendConfig=function(e,t,i,n){t.name=e.name,i&&(t.uri=this.params.config,$.extend(!0,t,i)),n(t)},e.prototype.getConfigExtension=function(e,t){var i=sessionStorage.getItem(e.name+"."+this.params.localeName);if(i)t(JSON.parse(i));else if(this.params.config)if(this.isCORSEnabled())$.getJSON(this.params.config,function(e){t(e)});else{var n={url:this.params.config,type:"GET",dataType:"jsonp",jsonp:"callback",jsonpCallback:"configExtensionCallback"};$.ajax(n),window.configExtensionCallback=function(e){t(e)}}else t(null)},e.prototype.injectCss=function(e,t,i){var n=window.DEBUG?"extensions/"+e.name+"/build/"+t.options.theme+".css":"themes/"+t.options.theme+"/css/"+e.name+"/theme.css";yepnope.injectCss(n,function(){i()})},e.prototype.createExtension=function(e,t){this.config=t;var i=e.helper;this.extension=new e.type(this),this.extension.helper=i,this.extension.name=e.name,this.extension.create()},e}();return o}),define("modules/uv-shared-module/Panel",["require","exports","./BaseCommands"],function(e,t,i){"use strict";var n=function(){function e(e,t,i){this.isResized=!1,this.$element=e,this.fitToParentWidth=t||!1,this.fitToParentHeight=i||!1,this.create()}return e.prototype.create=function(){var e=this;$.subscribe(i.RESIZE,function(){e.resize()})},e.prototype.resize=function(){var e=this.$element.parent();this.fitToParentWidth&&this.$element.width(e.width()),this.fitToParentHeight&&this.$element.height(e.height()),this.isResized=!0},e}();return n});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-shared-module/BaseView",["require","exports","./Panel"],function(e,t,i){"use strict";var n=function(e){function t(t,i,n){return e.call(this,t,i,n)||this}return __extends(t,e),t.prototype.create=function(){this.bootstrapper=$("body > #app").data("bootstrapper"),e.prototype.create.call(this),this.extension=this.bootstrapper.extension,this.config={},this.config.content={},this.config.options={},this.content=this.config.content,this.options=this.config.options;var t=this;t.modules&&t.modules.length&&(t.modules=t.modules.reverse(),$.each(t.modules,function(e,i){t.config=$.extend(!0,t.config,t.extension.config.modules[i])}))},t.prototype.init=function(){},t.prototype.setConfig=function(e){this.modules||(this.modules=[]),this.modules.push(e)},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(i);return n});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-shared-module/Dialogue",["require","exports","./BaseView","./BaseCommands"],function(e,t,i,n){"use strict";var o=function(e){function t(t){var i=e.call(this,t,!1,!1)||this;return i.allowClose=!0,i.isActive=!1,i.isUnopened=!0,i}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("dialogue"),e.prototype.create.call(this),$.subscribe(n.CLOSE_ACTIVE_DIALOGUE,function(){t.isActive&&t.allowClose&&t.close()}),$.subscribe(n.ESCAPE,function(){t.isActive&&t.allowClose&&t.close()}),this.$top=$('<div class="top"></div>'),this.$element.append(this.$top),this.$closeButton=$('<a href="#" class="close" tabindex="0">'+this.content.close+"</a>"),this.$top.append(this.$closeButton),this.$middle=$('<div class="middle"></div>'),this.$element.append(this.$middle),this.$content=$('<div class="content"></div>'),this.$middle.append(this.$content),this.$bottom=$('<div class="bottom"></div>'),this.$element.append(this.$bottom),this.$closeButton.on("click",function(e){e.preventDefault(),t.close()}),this.returnFunc=this.close},t.prototype.enableClose=function(){this.allowClose=!0,this.$closeButton.show()},t.prototype.disableClose=function(){this.allowClose=!1,this.$closeButton.hide()},t.prototype.setDockedPosition=function(){var e=Math.floor(this.extension.height()-this.$element.outerHeight(!0)),t=0,i=0;if(this.$triggerButton){var n=Math.normalise(this.$triggerButton.offset().left,0,this.extension.width());t=Math.floor(this.extension.width()*n-this.$element.width()*n),i=this.$element.width()*n}this.$bottom.css("backgroundPosition",i+"px 0px"),this.$element.css({top:e,left:t})},t.prototype.open=function(e){var t=this;this.$element.show(),e&&e.length?(this.$triggerButton=e,this.$bottom.show()):this.$bottom.hide(),this.isActive=!0,setTimeout(function(){var e=t.$element.find(".default");if(e.length)e.focus();else{var i=t.$element.find("input:visible").first();i.length?i.focus():t.$closeButton.focus()}},1),$.publish(n.SHOW_OVERLAY),this.isUnopened&&(this.isUnopened=!1,this.afterFirstOpen()),this.resize()},t.prototype.afterFirstOpen=function(){},t.prototype.close=function(){this.isActive&&(this.$element.hide(),this.isActive=!1,$.publish(this.closeCommand),$.publish(n.HIDE_OVERLAY))},t.prototype.resize=function(){e.prototype.resize.call(this),this.$element.css({top:Math.floor(this.extension.height()/2-this.$element.height()/2),left:Math.floor(this.extension.width()/2-this.$element.width()/2)})},t}(i);return o});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);
};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-dialogues-module/ClickThroughDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue"],function(e,t,i,n){"use strict";var o=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("clickThroughDialogue"),e.prototype.create.call(this),this.openCommand=i.SHOW_CLICKTHROUGH_DIALOGUE,this.closeCommand=i.HIDE_CLICKTHROUGH_DIALOGUE,$.subscribe(this.openCommand,function(e,i){t.acceptCallback=i.acceptCallback,t.resource=i.resource,t.open()}),$.subscribe(this.closeCommand,function(e){t.close()}),this.$title=$("<h1></h1>"),this.$content.append(this.$title),this.$content.append('            <div>                <p class="message scroll"></p>                <div class="buttons">                    <a class="acceptTerms btn btn-primary" href="#" target="_parent"></a>                </div>            </div>'),this.$message=this.$content.find(".message"),this.$acceptTermsButton=this.$content.find(".acceptTerms"),this.$acceptTermsButton.text("Accept Terms and Open"),this.$element.hide(),this.$acceptTermsButton.on("click",function(e){e.preventDefault(),t.close(),$.publish(i.ACCEPT_TERMS),t.acceptCallback&&t.acceptCallback()})},t.prototype.open=function(){e.prototype.open.call(this),this.$title.text(this.resource.clickThroughService.getProperty("label")),this.$message.html(this.resource.clickThroughService.getProperty("description")),this.$message.targetBlank(),this.$message.find("a").on("click",function(){var e=$(this).attr("href");$.publish(i.EXTERNAL_LINK_CLICKED,[e])}),this.resize()},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(n);return o}),define("modules/uv-shared-module/InformationArgs",["require","exports"],function(e,t){"use strict";var i=function(){function e(e,t){this.informationType=e,this.param=t}return e}();return i}),define("modules/uv-shared-module/InformationType",["require","exports"],function(e,t){"use strict";var i;return function(e){e[e.AUTH_CORS_ERROR=0]="AUTH_CORS_ERROR",e[e.DEGRADED_RESOURCE=1]="DEGRADED_RESOURCE"}(i||(i={})),i});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-dialogues-module/LoginDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue"],function(e,t,i,n){"use strict";var o=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("loginDialogue"),e.prototype.create.call(this),this.openCommand=i.SHOW_LOGIN_DIALOGUE,this.closeCommand=i.HIDE_LOGIN_DIALOGUE,$.subscribe(this.openCommand,function(e,i){t.loginCallback=i.loginCallback,t.logoutCallback=i.logoutCallback,t.options=i.options,t.resource=i.resource,t.open()}),$.subscribe(this.closeCommand,function(e){t.close()}),this.$title=$("<h1></h1>"),this.$content.append(this.$title),this.$content.append('            <div>                <p class="message scroll"></p>                <div class="buttons">                    <a class="logout btn btn-primary" href="#" target="_parent"></a>                    <a class="login btn btn-primary" href="#" target="_parent"></a>                    <a class="cancel btn btn-primary" href="#"></a>                </div>            </div>'),this.$message=this.$content.find(".message"),this.$loginButton=this.$content.find(".login"),this.$loginButton.text(this.content.login),this.$logoutButton=this.$content.find(".logout"),this.$logoutButton.text(this.content.logout),this.$cancelButton=this.$content.find(".cancel"),this.$cancelButton.text(this.content.cancel),this.$element.hide(),this.$loginButton.on("click",function(e){e.preventDefault(),t.close(),t.loginCallback&&t.loginCallback()}),this.$logoutButton.on("click",function(e){e.preventDefault(),t.close(),t.logoutCallback&&t.logoutCallback()}),this.$cancelButton.on("click",function(e){e.preventDefault(),t.close()}),this.updateLogoutButton()},t.prototype.open=function(){e.prototype.open.call(this),this.$title.text(this.resource.loginService.getProperty("label"));var t=this.resource.loginService.getProperty("description");this.options.warningMessage&&(t='<span class="warning">'+this.extension.config.content[this.options.warningMessage]+'</span><span class="description">'+t+"</span>"),this.updateLogoutButton(),this.$message.html(t),this.$message.targetBlank(),this.$message.find("a").on("click",function(){var e=$(this).attr("href");$.publish(i.EXTERNAL_LINK_CLICKED,[e])}),this.options.showCancelButton?this.$cancelButton.show():this.$cancelButton.hide(),this.resize()},t.prototype.updateLogoutButton=function(){this.extension.isLoggedIn?this.$logoutButton.show():this.$logoutButton.hide()},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(n);return o}),define("modules/uv-shared-module/LoginWarningMessages",["require","exports"],function(e,t){"use strict";var i=function(){function e(){}return e}();return i.FORBIDDEN="forbiddenResourceMessage",i}),define("modules/uv-shared-module/Metric",["require","exports"],function(e,t){"use strict";var i=function(){function e(e,t){this.minWidth=e,this.maxWidth=t}return e}();return i}),define("modules/uv-shared-module/Metrics",["require","exports","./Metric"],function(e,t,i){"use strict";var n=function(){function e(){}return e}();return n.MOBILE_LANDSCAPE=new i(0,640),n.LAPTOP=new i(640,1/0),n});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-dialogues-module/RestrictedDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue"],function(e,t,i,n){"use strict";var o=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("restrictedDialogue"),e.prototype.create.call(this),this.openCommand=i.SHOW_RESTRICTED_DIALOGUE,this.closeCommand=i.HIDE_RESTRICTED_DIALOGUE,$.subscribe(this.openCommand,function(e,i){t.acceptCallback=i.acceptCallback,t.options=i.options,t.resource=i.resource,t.open()}),$.subscribe(this.closeCommand,function(e){t.close()}),this.$title=$("<h1></h1>"),this.$content.append(this.$title),this.$content.append('            <div>                <p class="message scroll"></p>                <div class="buttons">                    <a class="cancel btn btn-primary" href="#" target="_parent"></a>                </div>            </div>'),this.$message=this.$content.find(".message"),this.$message.targetBlank(),this.$cancelButton=this.$content.find(".cancel"),this.$cancelButton.text(this.content.cancel),this.$element.hide(),this.$cancelButton.on("click",function(e){e.preventDefault(),t.close()})},t.prototype.open=function(){e.prototype.open.call(this),this.isAccepted=!1,this.$title.text(this.resource.restrictedService.getProperty("label"));var t=this.resource.restrictedService.getProperty("description");this.$message.html(t),this.$message.targetBlank(),this.$message.find("a").on("click",function(){var e=$(this).attr("href");$.publish(i.EXTERNAL_LINK_CLICKED,[e])}),this.resize()},t.prototype.close=function(){e.prototype.close.call(this),!this.isAccepted&&this.acceptCallback&&(this.isAccepted=!0,this.acceptCallback())},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(n);return o});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-shared-module/GenericDialogue",["require","exports","./BaseCommands","./Dialogue"],function(e,t,i,n){"use strict";var o=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("genericDialogue"),e.prototype.create.call(this),this.openCommand=i.SHOW_GENERIC_DIALOGUE,this.closeCommand=i.HIDE_GENERIC_DIALOGUE,$.subscribe(this.openCommand,function(e,i){t.acceptCallback=i.acceptCallback,t.showMessage(i)}),$.subscribe(this.closeCommand,function(e){t.close()}),this.$message=$("<p></p>"),this.$content.append(this.$message),this.$acceptButton=$('<a href="#" class="btn btn-primary accept default"></a>'),this.$content.append(this.$acceptButton),this.$acceptButton.text(this.content.ok),this.$acceptButton.onPressed(function(){t.accept()}),this.returnFunc=function(){t.isActive&&t.accept()},this.$element.hide()},t.prototype.accept=function(){$.publish(i.CLOSE_ACTIVE_DIALOGUE),this.acceptCallback&&this.acceptCallback()},t.prototype.showMessage=function(e){this.$message.html(e.message),e.buttonText?this.$acceptButton.text(e.buttonText):this.$acceptButton.text(this.content.ok),e.allowClose===!1&&this.disableClose(),this.open()},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(n);return o});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-shared-module/Shell",["require","exports","./BaseCommands","./BaseView","./GenericDialogue"],function(e,t,i,n,o){"use strict";var s=function(e){function t(i){var n=this;return t.$element=i,n=e.call(this,t.$element,!0,!0)||this}return __extends(t,e),t.prototype.create=function(){e.prototype.create.call(this),$.subscribe(i.SHOW_OVERLAY,function(){t.$overlays.show()}),$.subscribe(i.HIDE_OVERLAY,function(){t.$overlays.hide()}),t.$headerPanel=$('<div class="headerPanel"></div>'),t.$element.append(t.$headerPanel),t.$mainPanel=$('<div class="mainPanel"></div>'),t.$element.append(t.$mainPanel),t.$centerPanel=$('<div class="centerPanel"></div>'),t.$mainPanel.append(t.$centerPanel),t.$leftPanel=$('<div class="leftPanel"></div>'),t.$mainPanel.append(t.$leftPanel),t.$rightPanel=$('<div class="rightPanel"></div>'),t.$mainPanel.append(t.$rightPanel),t.$footerPanel=$('<div class="footerPanel"></div>'),t.$element.append(t.$footerPanel),t.$mobileFooterPanel=$('<div class="footerPanel mobile"></div>'),t.$element.append(t.$mobileFooterPanel),t.$overlays=$('<div class="overlays"></div>'),t.$element.append(t.$overlays),t.$genericDialogue=$('<div class="overlay genericDialogue"></div>'),t.$overlays.append(t.$genericDialogue),t.$overlays.on("click",function(e){$(e.target).hasClass("overlays")&&(e.preventDefault(),$.publish(i.CLOSE_ACTIVE_DIALOGUE))}),new o(t.$genericDialogue)},t.prototype.resize=function(){e.prototype.resize.call(this),t.$overlays.width(this.extension.width()),t.$overlays.height(this.extension.height());var i=this.$element.height()-parseInt(t.$mainPanel.css("marginTop"))-(t.$headerPanel.is(":visible")?t.$headerPanel.height():0)-(t.$footerPanel.is(":visible")?t.$footerPanel.height():0)-(t.$mobileFooterPanel.is(":visible")?t.$mobileFooterPanel.height():0);t.$mainPanel.height(i)},t}(n);return s}),define("modules/uv-shared-module/BaseExtension",["require","exports","./BaseCommands","../../BootstrapParams","../../modules/uv-dialogues-module/ClickThroughDialogue","./InformationArgs","./InformationType","../../modules/uv-dialogues-module/LoginDialogue","./LoginWarningMessages","../../modules/uv-shared-module/Metrics","../../Params","../../modules/uv-dialogues-module/RestrictedDialogue","./Shell"],function(e,t,i,n,o,s,r,a,l,h,c,u,p){"use strict";var d=function(){function t(e){this.isCreated=!1,this.isLoggedIn=!1,this.shifted=!1,this.tabbing=!1,this.bootstrapper=e,this.config=this.bootstrapper.config,this.jsonp=this.bootstrapper.params.jsonp,this.locale=this.bootstrapper.params.getLocaleName(),this.isHomeDomain=this.bootstrapper.params.isHomeDomain,this.isReload=this.bootstrapper.params.isReload,this.embedDomain=this.bootstrapper.params.embedDomain,this.isOnlyInstance=this.bootstrapper.params.isOnlyInstance,this.embedScriptUri=this.bootstrapper.params.embedScriptUri,this.domain=this.bootstrapper.params.domain,this.isLightbox=this.bootstrapper.params.isLightbox}return t.prototype.create=function(e){var t=this,o=this;this.$element=$("#app"),this.$element.data("bootstrapper",this.bootstrapper);var s=$(window);if(this.embedWidth=s.width(),this.embedHeight=s.height(),this.$element.width(this.embedWidth),this.$element.height(this.embedHeight),!this.isReload&&Utils.Documents.isInIFrame()&&(this.bootstrapper.socket=new easyXDM.Socket({onMessage:function(e,i){e=$.parseJSON(e),t.handleParentFrameEvent(e)}})),this.triggerSocket(i.LOAD,{bootstrapper:{config:this.bootstrapper.config,params:this.bootstrapper.params},settings:this.getSettings(),preview:this.getSharePreview()}),this.$element.empty(),this.$element.removeClass(),this.$element.addClass("browser-"+window.browserDetect.browser),this.$element.addClass("browser-version-"+window.browserDetect.version),this.isHomeDomain||this.$element.addClass("embedded"),this.isLightbox&&this.$element.addClass("lightbox"),$(document).on("mousemove",function(e){t.mouseX=e.pageX,t.mouseY=e.pageY}),!this.isReload){window.onresize=function(){var e=$(window);$("body").height(e.height()),t.resize()};var r=Utils.Documents.getHiddenProp();if(r){var a=r.replace(/[H|h]idden/,"")+"visibilitychange";document.addEventListener(a,function(){Utils.Documents.isHidden()||t.resize()})}Utils.Bools.getBool(this.config.options.dropEnabled,!0)&&this.$element.on("drop",function(e){e.preventDefault();var o=e.originalEvent.dataTransfer.getData("URL"),s=Utils.Urls.getUrlParts(o),r=Utils.Urls.getQuerystringParameterFromString("manifest",s.search);if(r){t.triggerSocket(i.DROP,r);var a=new n.BootstrapParams;a.manifestUri=r,t.reload(a)}}),this.$element.on("dragover",function(e){e.preventDefault()}),$(document).on("keyup keydown",function(e){t.shifted=e.shiftKey,t.tabbing=e.keyCode===KeyCodes.KeyDown.Tab}),$(document).keydown(function(e){var t=null,n=!0;e.ctrlKey||e.altKey||e.shiftKey||(e.keyCode===KeyCodes.KeyDown.Enter&&(t=i.RETURN,n=!1),e.keyCode===KeyCodes.KeyDown.Escape&&(t=i.ESCAPE),e.keyCode===KeyCodes.KeyDown.PageUp&&(t=i.PAGE_UP),e.keyCode===KeyCodes.KeyDown.PageDown&&(t=i.PAGE_DOWN),e.keyCode===KeyCodes.KeyDown.End&&(t=i.END),e.keyCode===KeyCodes.KeyDown.Home&&(t=i.HOME),(e.keyCode===KeyCodes.KeyDown.NumpadPlus||171===e.keyCode||e.keyCode===KeyCodes.KeyDown.Equals)&&(t=i.PLUS,n=!1),(e.keyCode===KeyCodes.KeyDown.NumpadMinus||173===e.keyCode||e.keyCode===KeyCodes.KeyDown.Dash)&&(t=i.MINUS,n=!1),o.useArrowKeysToNavigate()&&(e.keyCode===KeyCodes.KeyDown.LeftArrow&&(t=i.LEFT_ARROW),e.keyCode===KeyCodes.KeyDown.UpArrow&&(t=i.UP_ARROW),e.keyCode===KeyCodes.KeyDown.RightArrow&&(t=i.RIGHT_ARROW),e.keyCode===KeyCodes.KeyDown.DownArrow&&(t=i.DOWN_ARROW))),t&&(n&&e.preventDefault(),$.publish(t))}),this.bootstrapper.params.isHomeDomain&&Utils.Documents.isInIFrame()&&$.subscribe(i.PARENT_EXIT_FULLSCREEN,function(){t.isOverlayActive()&&$.publish(i.ESCAPE),$.publish(i.ESCAPE),$.publish(i.RESIZE)})}this.$element.append('<a href="/" id="top"></a>'),this.$element.append('<iframe id="commsFrame" style="display:none"></iframe>'),$.subscribe(i.ACCEPT_TERMS,function(){t.triggerSocket(i.ACCEPT_TERMS)}),$.subscribe(i.LOGIN_FAILED,function(){t.triggerSocket(i.LOGIN_FAILED),t.showMessage(t.config.content.authorisationFailedMessage)}),$.subscribe(i.LOGIN,function(){t.isLoggedIn=!0,t.triggerSocket(i.LOGIN)}),$.subscribe(i.LOGOUT,function(){t.isLoggedIn=!1,t.triggerSocket(i.LOGOUT)}),$.subscribe(i.BOOKMARK,function(){t.bookmark(),t.triggerSocket(i.BOOKMARK)}),$.subscribe(i.CANVAS_INDEX_CHANGE_FAILED,function(){t.triggerSocket(i.CANVAS_INDEX_CHANGE_FAILED)}),$.subscribe(i.CANVAS_INDEX_CHANGED,function(e,n){t.triggerSocket(i.CANVAS_INDEX_CHANGED,n)}),$.subscribe(i.CLICKTHROUGH,function(){t.triggerSocket(i.CLICKTHROUGH)}),$.subscribe(i.CLOSE_ACTIVE_DIALOGUE,function(){t.triggerSocket(i.CLOSE_ACTIVE_DIALOGUE)}),$.subscribe(i.CLOSE_LEFT_PANEL,function(){t.triggerSocket(i.CLOSE_LEFT_PANEL),t.resize()}),$.subscribe(i.CLOSE_RIGHT_PANEL,function(){t.triggerSocket(i.CLOSE_RIGHT_PANEL),t.resize()}),$.subscribe(i.CREATED,function(){t.isCreated=!0,t.triggerSocket(i.CREATED)}),$.subscribe(i.DOWN_ARROW,function(){t.triggerSocket(i.DOWN_ARROW)}),$.subscribe(i.DOWNLOAD,function(e,n){t.triggerSocket(i.DOWNLOAD,n)}),$.subscribe(i.END,function(){t.triggerSocket(i.END)}),$.subscribe(i.ESCAPE,function(){t.triggerSocket(i.ESCAPE),t.isFullScreen()&&!t.isOverlayActive()&&$.publish(i.TOGGLE_FULLSCREEN)}),$.subscribe(i.EXTERNAL_LINK_CLICKED,function(e,n){t.triggerSocket(i.EXTERNAL_LINK_CLICKED,n)}),$.subscribe(i.FEEDBACK,function(){t.feedback()}),$.subscribe(i.FORBIDDEN,function(){t.triggerSocket(i.FORBIDDEN),$.publish(i.OPEN_EXTERNAL_RESOURCE)}),$.subscribe(i.HIDE_DOWNLOAD_DIALOGUE,function(){t.triggerSocket(i.HIDE_DOWNLOAD_DIALOGUE)}),$.subscribe(i.HIDE_EMBED_DIALOGUE,function(){t.triggerSocket(i.HIDE_EMBED_DIALOGUE)}),$.subscribe(i.HIDE_EXTERNALCONTENT_DIALOGUE,function(){t.triggerSocket(i.HIDE_EXTERNALCONTENT_DIALOGUE)}),$.subscribe(i.HIDE_GENERIC_DIALOGUE,function(){t.triggerSocket(i.HIDE_GENERIC_DIALOGUE)}),$.subscribe(i.HIDE_HELP_DIALOGUE,function(){t.triggerSocket(i.HIDE_HELP_DIALOGUE)}),$.subscribe(i.HIDE_INFORMATION,function(){t.triggerSocket(i.HIDE_INFORMATION)}),$.subscribe(i.HIDE_LOGIN_DIALOGUE,function(){t.triggerSocket(i.HIDE_LOGIN_DIALOGUE)}),$.subscribe(i.HIDE_OVERLAY,function(){t.triggerSocket(i.HIDE_OVERLAY)}),$.subscribe(i.HIDE_RESTRICTED_DIALOGUE,function(){t.triggerSocket(i.HIDE_RESTRICTED_DIALOGUE)}),$.subscribe(i.HIDE_SETTINGS_DIALOGUE,function(){t.triggerSocket(i.HIDE_SETTINGS_DIALOGUE)}),$.subscribe(i.HOME,function(){t.triggerSocket(i.HOME)}),$.subscribe(i.LEFT_ARROW,function(){t.triggerSocket(i.LEFT_ARROW)}),$.subscribe(i.LEFTPANEL_COLLAPSE_FULL_FINISH,function(){t.triggerSocket(i.LEFTPANEL_COLLAPSE_FULL_FINISH)}),$.subscribe(i.LEFTPANEL_COLLAPSE_FULL_START,function(){t.triggerSocket(i.LEFTPANEL_COLLAPSE_FULL_START)}),$.subscribe(i.LEFTPANEL_EXPAND_FULL_FINISH,function(){t.triggerSocket(i.LEFTPANEL_EXPAND_FULL_FINISH)}),$.subscribe(i.LEFTPANEL_EXPAND_FULL_START,function(){t.triggerSocket(i.LEFTPANEL_EXPAND_FULL_START)}),$.subscribe(i.LOAD_FAILED,function(){t.triggerSocket(i.LOAD_FAILED),_.isNull(o.lastCanvasIndex)||o.lastCanvasIndex===o.helper.canvasIndex||t.viewCanvas(o.lastCanvasIndex)}),$.subscribe(i.NOT_FOUND,function(){t.triggerSocket(i.NOT_FOUND)}),$.subscribe(i.OPEN,function(){t.triggerSocket(i.OPEN);var e=String.format(t.config.options.openTemplate,t.helper.iiifResourceUri);window.open(e)}),$.subscribe(i.OPEN_LEFT_PANEL,function(){t.triggerSocket(i.OPEN_LEFT_PANEL),t.resize()}),$.subscribe(i.OPEN_EXTERNAL_RESOURCE,function(){t.triggerSocket(i.OPEN_EXTERNAL_RESOURCE)}),$.subscribe(i.OPEN_RIGHT_PANEL,function(){t.triggerSocket(i.OPEN_RIGHT_PANEL),t.resize()}),$.subscribe(i.PAGE_DOWN,function(){t.triggerSocket(i.PAGE_DOWN)}),$.subscribe(i.PAGE_UP,function(){t.triggerSocket(i.PAGE_UP)}),$.subscribe(i.RESOURCE_DEGRADED,function(e,n){t.triggerSocket(i.RESOURCE_DEGRADED),t.handleDegraded(n)}),$.subscribe(i.RETURN,function(){t.triggerSocket(i.RETURN)}),$.subscribe(i.RIGHT_ARROW,function(){t.triggerSocket(i.RIGHT_ARROW)}),$.subscribe(i.RIGHTPANEL_COLLAPSE_FULL_FINISH,function(){t.triggerSocket(i.RIGHTPANEL_COLLAPSE_FULL_FINISH)}),$.subscribe(i.RIGHTPANEL_COLLAPSE_FULL_START,function(){t.triggerSocket(i.RIGHTPANEL_COLLAPSE_FULL_START)}),$.subscribe(i.RIGHTPANEL_EXPAND_FULL_FINISH,function(){t.triggerSocket(i.RIGHTPANEL_EXPAND_FULL_FINISH)}),$.subscribe(i.RIGHTPANEL_EXPAND_FULL_START,function(){t.triggerSocket(i.RIGHTPANEL_EXPAND_FULL_START)}),$.subscribe(i.SEQUENCE_INDEX_CHANGED,function(){t.triggerSocket(i.SEQUENCE_INDEX_CHANGED)}),$.subscribe(i.SETTINGS_CHANGED,function(e,n){t.triggerSocket(i.SETTINGS_CHANGED,n)}),$.subscribe(i.SHOW_DOWNLOAD_DIALOGUE,function(){t.triggerSocket(i.SHOW_DOWNLOAD_DIALOGUE)}),$.subscribe(i.SHOW_EMBED_DIALOGUE,function(){t.triggerSocket(i.SHOW_EMBED_DIALOGUE)}),$.subscribe(i.SHOW_EXTERNALCONTENT_DIALOGUE,function(){t.triggerSocket(i.SHOW_EXTERNALCONTENT_DIALOGUE)}),$.subscribe(i.SHOW_GENERIC_DIALOGUE,function(){t.triggerSocket(i.SHOW_GENERIC_DIALOGUE)}),$.subscribe(i.SHOW_HELP_DIALOGUE,function(){t.triggerSocket(i.SHOW_HELP_DIALOGUE)}),$.subscribe(i.SHOW_INFORMATION,function(){t.triggerSocket(i.SHOW_INFORMATION)}),$.subscribe(i.SHOW_LOGIN_DIALOGUE,function(){t.triggerSocket(i.SHOW_LOGIN_DIALOGUE)}),$.subscribe(i.SHOW_CLICKTHROUGH_DIALOGUE,function(){t.triggerSocket(i.SHOW_CLICKTHROUGH_DIALOGUE)}),$.subscribe(i.SHOW_RESTRICTED_DIALOGUE,function(){t.triggerSocket(i.SHOW_RESTRICTED_DIALOGUE)}),$.subscribe(i.SHOW_OVERLAY,function(){t.triggerSocket(i.SHOW_OVERLAY)}),$.subscribe(i.SHOW_SETTINGS_DIALOGUE,function(){t.triggerSocket(i.SHOW_SETTINGS_DIALOGUE)}),$.subscribe(i.SHOW_TERMS_OF_USE,function(){t.triggerSocket(i.SHOW_TERMS_OF_USE);var e=t.helper.getAttribution();t.showMessage(e)}),$.subscribe(i.THUMB_SELECTED,function(e,n){t.triggerSocket(i.THUMB_SELECTED,n.index)}),$.subscribe(i.TOGGLE_FULLSCREEN,function(){$("#top").focus(),t.bootstrapper.isFullScreen=!t.bootstrapper.isFullScreen,t.triggerSocket(i.TOGGLE_FULLSCREEN,{isFullScreen:t.bootstrapper.isFullScreen,overrideFullScreen:t.config.options.overrideFullScreen})}),$.subscribe(i.UP_ARROW,function(){t.triggerSocket(i.UP_ARROW)}),$.subscribe(i.UPDATE_SETTINGS,function(){t.triggerSocket(i.UPDATE_SETTINGS)}),$.subscribe(i.VIEW_FULL_TERMS,function(){t.triggerSocket(i.VIEW_FULL_TERMS)}),$.subscribe(i.WINDOW_UNLOAD,function(){t.triggerSocket(i.WINDOW_UNLOAD)}),this.shell=new p(this.$element),e?this.loadDependencies(e):this.getDependencies(function(e){t.loadDependencies(e)})},t.prototype.createModules=function(){this.$clickThroughDialogue=$('<div class="overlay clickthrough"></div>'),p.$overlays.append(this.$clickThroughDialogue),this.clickThroughDialogue=new o(this.$clickThroughDialogue),this.$restrictedDialogue=$('<div class="overlay login"></div>'),p.$overlays.append(this.$restrictedDialogue),this.restrictedDialogue=new u(this.$restrictedDialogue),this.$loginDialogue=$('<div class="overlay login"></div>'),p.$overlays.append(this.$loginDialogue),this.loginDialogue=new a(this.$loginDialogue)},t.prototype.modulesCreated=function(){},t.prototype.getDependencies=function(t){var i=this,n=window.DEBUG?"../../extensions/"+this.name+"/dependencies":this.name+"-dependencies",o=$("script[data-requiremodule]").filter(function(){var e=$(this).attr("data-requiremodule");return-1!=e.indexOf(i.name)&&-1!=e.indexOf("dependencies")});o.length?t(null):e([n],function(e){for(var n=window.DEBUG?"../../extensions/"+i.name+"/lib/":"",o=0;o<e.dependencies.length;o++)e.dependencies[o]=n+e.dependencies[o];t(e)})},t.prototype.loadDependencies=function(t){var i=this;t?e(t.dependencies,function(){i.dependenciesLoaded()}):i.dependenciesLoaded()},t.prototype.dependenciesLoaded=function(){this.createModules(),this.modulesCreated(),$.publish(i.RESIZE),$.publish(i.CREATED),this.setParams(),this.setDefaultFocus(),this.viewCanvas(this.getCanvasIndexParam())},t.prototype.setParams=function(){this.isHomeDomain&&(this.setParam(c.collectionIndex,this.helper.collectionIndex),this.setParam(c.manifestIndex,this.helper.manifestIndex),this.setParam(c.sequenceIndex,this.helper.sequenceIndex),this.setParam(c.canvasIndex,this.helper.canvasIndex))},t.prototype.setDefaultFocus=function(){var e=this;setTimeout(function(){e.config.options.allowStealFocus&&$("[tabindex=0]").focus()},1)},t.prototype.width=function(){return $(window).width()},t.prototype.height=function(){return $(window).height()},t.prototype.triggerSocket=function(e,t){jQuery(document).trigger(e,[t]),this.bootstrapper.socket&&this.bootstrapper.socket.postMessage(JSON.stringify({eventName:e,eventObject:t}))},t.prototype.redirect=function(e){this.triggerSocket(i.REDIRECT,e)},t.prototype.refresh=function(){this.triggerSocket(i.REFRESH,null)},t.prototype._updateMetric=function(){for(var e=Object.keys(h),t=0;t<e.length;t++){var n=h[e[t]];this.width()>n.minWidth&&this.width()<=n.maxWidth&&this.metric!==n&&(this.metric=n,$.publish(i.METRIC_CHANGED))}},t.prototype.resize=function(){this._updateMetric(),$.publish(i.RESIZE)},t.prototype.handleParentFrameEvent=function(e){var t=this;Utils.Async.waitFor(function(){return t.isCreated},function(){switch(e.eventName){case i.TOGGLE_FULLSCREEN:$.publish(i.TOGGLE_FULLSCREEN,e.eventObject);break;case i.PARENT_EXIT_FULLSCREEN:$.publish(i.PARENT_EXIT_FULLSCREEN)}})},t.prototype.reload=function(e){var t=new n.BootstrapParams;e&&(t=$.extend(t,e)),t.isReload=!0,$.disposePubSub(),this.bootstrapper.bootstrap(t)},t.prototype.getCanvasIndexParam=function(){return this.bootstrapper.params.getParam(c.canvasIndex)},t.prototype.getSequenceIndexParam=function(){return this.bootstrapper.params.getParam(c.sequenceIndex)},t.prototype.isSeeAlsoEnabled=function(){return this.config.options.seeAlsoEnabled!==!1},t.prototype.getShareUrl=function(){if(this.isDeepLinkingEnabled())return Utils.Documents.isInIFrame()?parent.document.location.href:document.location.href;if(this.helper.hasRelatedPage()){var e=this.helper.getRelated();return e&&e.length&&(e=e[0]),e["@id"]}return null},t.prototype.getIIIFShareUrl=function(){return this.helper.iiifResourceUri+"?manifest="+this.helper.iiifResourceUri},t.prototype.addTimestamp=function(e){return e+"?t="+Utils.Dates.getTimeStamp()},t.prototype.isDeepLinkingEnabled=function(){return this.isHomeDomain&&this.isOnlyInstance},t.prototype.isOnHomeDomain=function(){return this.isDeepLinkingEnabled()},t.prototype.getDomain=function(){var e=Utils.Urls.getUrlParts(this.helper.iiifResourceUri);return e.host},t.prototype.getEmbedDomain=function(){return this.embedDomain},t.prototype.getSettings=function(){if(Utils.Bools.getBool(this.config.options.saveUserSettings,!1)){var e=Utils.Storage.get("uv.settings",Utils.StorageType.local);if(e)return $.extend(this.config.options,e.value)}return this.config.options},t.prototype.updateSettings=function(e){if(Utils.Bools.getBool(this.config.options.saveUserSettings,!1)){var t=Utils.Storage.get("uv.settings",Utils.StorageType.local);t&&(e=$.extend(t.value,e)),Utils.Storage.set("uv.settings",e,31536e4,Utils.StorageType.local)}this.config.options=$.extend(this.config.options,e)},t.prototype.sanitize=function(e){var t=document.createElement("div"),i=$(t);i.html(e);var n=new Sanitize({elements:["a","b","br","img","p","i","span"],attributes:{a:["href"],img:["src","alt"]},protocols:{a:{href:["http","https"]}}});return i.html(n.clean_node(t)),i.html()},t.prototype.getLocales=function(){if(this.locales)return this.locales;var e=this.config.localisation.locales.clone(),t=this.bootstrapper.params.locales,i=[];$.each(t,function(t,n){var o=_.filter(e,function(e){return e.name===n.name});if(o.length){var s=o[0];n.label&&(s.label=n.label),s.added=!0,i.push(s)}});var n=Utils.Bools.getBool(this.config.options.limitLocales,!1);return n||$.each(e,function(e,t){t.added||i.push(t),delete t.added}),this.locales=i},t.prototype.getAlternateLocale=function(){for(var e,t=this.getLocales(),i=0;i<t.length;i++){var n=t[i];n.name!==this.locale&&(e=n)}return n},t.prototype.changeLocale=function(e){var t=this.locales.clone(),i=t.indexOfTest(function(t){return t.name===e});t.move(i,0);var o=this.serializeLocales(t),s=new n.BootstrapParams;s.setLocale(o),this.reload(s)},t.prototype.serializeLocales=function(e){for(var t="",i=0;i<e.length;i++){var n=e[i];i>0&&(t+=","),t+=n.name,n.label&&(t+=":"+n.label)}return t},t.prototype.getSerializedLocales=function(){return this.serializeLocales(this.locales)},t.prototype.getSharePreview=function(){var e={};e.title=this.helper.getLabel();var t=this.helper.getCurrentCanvas(),i=t.getProperty("thumbnail");return i&&_.isString(i)||(i=t.getCanonicalImageUri(this.config.options.bookmarkThumbWidth)),e.image=i,e},t.prototype.getPagedIndices=function(e){return"undefined"==typeof e&&(e=this.helper.canvasIndex),[e]},t.prototype.getCurrentCanvases=function(){for(var e=this.getPagedIndices(this.helper.canvasIndex),t=[],i=0;i<e.length;i++){var n=e[i],o=this.helper.getCanvasByIndex(n);t.push(o)}return t},t.prototype.getCanvasLabels=function(e){var t=this.getPagedIndices(),i="";if(1===t.length)i=e;else for(var n=1;n<=t.length;n++)i.length&&(i+=","),i+=e+" "+n;return i},t.prototype.getCurrentCanvasRange=function(){var e=this.helper.getCanvasRange(this.helper.getCurrentCanvas());return e},t.prototype.getExternalResources=function(e){var t=this,n=this.getPagedIndices(),o=[];_.each(n,function(i){var n=t.helper.getCanvasByIndex(i),s=new Manifold.ExternalResource(n,t.helper.getInfoUri);if(s.index=i,e){var r=_.find(e,function(e){return e.dataUri===s.dataUri});r?o.push(r):o.push(s)}else o.push(s)});var s=this.config.options.tokenStorage;return new Promise(function(e){manifesto.Utils.loadExternalResources(o,s,t.clickThrough,t.restricted,t.login,t.getAccessToken,t.storeAccessToken,t.getStoredAccessToken,t.handleExternalResourceResponse).then(function(i){t.resources=$.map(i,function(e){return e.data.index=e.index,_.toPlainObject(e.data)}),e(t.resources)})["catch"](function(e){switch(e.name){case manifesto.StatusCodes.AUTHORIZATION_FAILED.toString():$.publish(i.LOGIN_FAILED);break;case manifesto.StatusCodes.FORBIDDEN.toString():$.publish(i.FORBIDDEN);break;case manifesto.StatusCodes.RESTRICTED.toString():break;default:t.showMessage(e.message||e)}})})},t.prototype.getParam=function(e){var t;return this.isDeepLinkingEnabled()&&(t=Utils.Urls.getHashParameter(this.bootstrapper.params.paramMap[e],parent.document)),t||(t=Utils.Urls.getQuerystringParameter(this.bootstrapper.params.paramMap[e])),t},t.prototype.setParam=function(e,t){this.isDeepLinkingEnabled()&&Utils.Urls.setHashParameter(this.bootstrapper.params.paramMap[e],t,parent.document)},t.prototype.viewCanvas=function(e){this.helper.isCanvasIndexOutOfRange(e)&&(this.showMessage(this.config.content.canvasIndexOutOfRange),e=0),this.lastCanvasIndex=this.helper.canvasIndex,this.helper.canvasIndex=e,$.publish(i.CANVAS_INDEX_CHANGED,[e]),$.publish(i.OPEN_EXTERNAL_RESOURCE),this.setParam(c.canvasIndex,e)},t.prototype.showMessage=function(e,t,n,o){this.closeActiveDialogue(),$.publish(i.SHOW_GENERIC_DIALOGUE,[{message:e,acceptCallback:t,buttonText:n,allowClose:o}])},t.prototype.closeActiveDialogue=function(){$.publish(i.CLOSE_ACTIVE_DIALOGUE)},t.prototype.isOverlayActive=function(){return p.$overlays.is(":visible")},t.prototype.viewManifest=function(e){var t=new n.BootstrapParams;t.manifestUri=this.helper.iiifResourceUri,t.collectionIndex=this.helper.getCollectionIndex(e),t.manifestIndex=e.index,t.sequenceIndex=0,t.canvasIndex=0,this.reload(t)},t.prototype.viewCollection=function(e){var t=new n.BootstrapParams;t.manifestUri=this.helper.iiifResourceUri,t.collectionIndex=e.index,t.manifestIndex=0,t.sequenceIndex=0,t.canvasIndex=0,this.reload(t)},t.prototype.isFullScreen=function(){return this.bootstrapper.isFullScreen},t.prototype.isHeaderPanelEnabled=function(){return Utils.Bools.getBool(this.config.options.headerPanelEnabled,!0)},t.prototype.isLeftPanelEnabled=function(){if(Utils.Bools.getBool(this.config.options.leftPanelEnabled,!0)){if(this.helper.hasParentCollection())return!0;if(this.helper.isMultiCanvas()&&this.helper.getViewingHint().toString()!==manifesto.ViewingHint.continuous().toString())return!0;
}return!1},t.prototype.isRightPanelEnabled=function(){return Utils.Bools.getBool(this.config.options.rightPanelEnabled,!0)},t.prototype.isFooterPanelEnabled=function(){return Utils.Bools.getBool(this.config.options.footerPanelEnabled,!0)},t.prototype.useArrowKeysToNavigate=function(){return Utils.Bools.getBool(this.config.options.useArrowKeysToNavigate,!0)},t.prototype.bookmark=function(){},t.prototype.feedback=function(){this.triggerSocket(i.FEEDBACK,new n.BootstrapParams)},t.prototype.getBookmarkUri=function(){var e=parent.document.URL,t=Utils.Urls.getUrlParts(e),i=t.pathname+t.search+parent.document.location.hash;return i.startsWith("/")||(i="/"+i),i},t.prototype.clickThrough=function(e){return new Promise(function(t){$.publish(i.SHOW_CLICKTHROUGH_DIALOGUE,[{resource:e,acceptCallback:function(){var n=window.open(e.clickThroughService.id),o=window.setInterval(function(){n.closed&&(window.clearInterval(o),$.publish(i.CLICKTHROUGH),t())},500)}}])})},t.prototype.restricted=function(e){return new Promise(function(t,n){$.publish(i.SHOW_RESTRICTED_DIALOGUE,[{resource:e,acceptCallback:function(){$.publish(i.LOAD_FAILED),n(e)}}])})},t.prototype.login=function(e){return new Promise(function(t){var n={};e.status===HTTPStatusCode.FORBIDDEN&&(n.warningMessage=l.FORBIDDEN,n.showCancelButton=!0),$.publish(i.SHOW_LOGIN_DIALOGUE,[{resource:e,loginCallback:function(){var n=window.open(e.loginService.id+"?t="+(new Date).getTime()),o=window.setInterval(function(){n.closed&&(window.clearInterval(o),$.publish(i.LOGIN),t())},500)},logoutCallback:function(){var n=window.open(e.logoutService.id+"?t="+(new Date).getTime()),o=window.setInterval(function(){n.closed&&(window.clearInterval(o),$.publish(i.LOGOUT),t())},500)},options:n}])})},t.prototype.getAccessToken=function(e,t){return new Promise(function(i,n){var o=e.tokenService.id,s=o+"|"+(new Date).getTime(),r=function(e){window.removeEventListener("message",r);var o=e.data;o.error?t?n(o.errorDescription):i(null):i(o)};window.addEventListener("message",r,!1);var a=o+"?messageId="+s;$("#commsFrame").prop("src",a)})},t.prototype.storeAccessToken=function(e,t,i){return new Promise(function(n,o){Utils.Storage.set(e.tokenService.id,t,t.expiresIn,new Utils.StorageType(i)),n()})},t.prototype.getStoredAccessToken=function(e,t){return new Promise(function(i,n){var o,s=[];if(e.tokenService&&(o=Utils.Storage.get(e.tokenService.id,new Utils.StorageType(t))),o)s.push(o);else for(var r=Utils.Urls.getUrlParts(e.dataUri).hostname,a=Utils.Storage.getItems(new Utils.StorageType(t)),l=0;l<a.length;l++)o=a[l],o.key.contains(r)&&s.push(o);s=_.sortBy(s,function(e){return e.expiresAt});var h;s.length&&(h=s.last().value),i(h)})},t.prototype.handleExternalResourceResponse=function(e){return new Promise(function(t,n){if(e.isResponseHandled=!0,e.status===HTTPStatusCode.OK)t(e);else if(e.status===HTTPStatusCode.MOVED_TEMPORARILY)t(e),$.publish(i.RESOURCE_DEGRADED,[e]);else if(e.error.status===HTTPStatusCode.UNAUTHORIZED||e.error.status===HTTPStatusCode.INTERNAL_SERVER_ERROR)if(Modernizr.cors)n(e.error.statusText);else{var o=new s(r.AUTH_CORS_ERROR,null);$.publish(i.SHOW_INFORMATION,[o]),t(e)}else if(e.error.status===HTTPStatusCode.FORBIDDEN){var a=new Error;a.message="Forbidden",a.name=manifesto.StatusCodes.FORBIDDEN.toString(),n(a)}else n(e.error.statusText)})},t.prototype.handleDegraded=function(e){var t=new s(r.DEGRADED_RESOURCE,e);$.publish(i.SHOW_INFORMATION,[t])},t}();return d}),define("modules/uv-shared-module/Bookmark",["require","exports"],function(e,t){"use strict";var i=function(){function e(){}return e}();return i}),define("extensions/uv-mediaelement-extension/Commands",["require","exports"],function(e,t){"use strict";var i=function(){function e(){}return e}();return i.namespace="mediaelementExtension.",i.MEDIA_ENDED=i.namespace+"onMediaEnded",i.MEDIA_PAUSED=i.namespace+"onMediaPaused",i.MEDIA_PLAYED=i.namespace+"onMediaPlayed",i}),define("modules/uv-shared-module/DownloadOption",["require","exports"],function(e,t){"use strict";var i=function(){function e(e){this.value=e}return e.prototype.toString=function(){return this.value},e}();return i.currentViewAsJpg=new i("currentViewAsJpg"),i.dynamicCanvasRenderings=new i("dynamicCanvasRenderings"),i.dynamicImageRenderings=new i("dynamicImageRenderings"),i.dynamicSequenceRenderings=new i("dynamicSequenceRenderings"),i.entireFileAsOriginal=new i("entireFileAsOriginal"),i.selection=new i("selection"),i.wholeImageHighRes=new i("wholeImageHighRes"),i.wholeImagesHighRes=new i("wholeImagesHighRes"),i.wholeImageLowResAsJpg=new i("wholeImageLowResAsJpg"),i});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-dialogues-module/DownloadDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue","../uv-shared-module/DownloadOption"],function(e,t,i,n,o){"use strict";var s=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("downloadDialogue"),e.prototype.create.call(this),this.openCommand=i.SHOW_DOWNLOAD_DIALOGUE,this.closeCommand=i.HIDE_DOWNLOAD_DIALOGUE,$.subscribe(this.openCommand,function(e,i){t.open(i)}),$.subscribe(this.closeCommand,function(e){t.close()}),this.$title=$("<h1>"+this.content.title+"</h1>"),this.$content.append(this.$title),this.$noneAvailable=$('<div class="noneAvailable">'+this.content.noneAvailable+"</div>"),this.$content.append(this.$noneAvailable),this.$downloadOptions=$('<ol class="options"></ol>'),this.$content.append(this.$downloadOptions),this.$footer=$('<div class="footer"></div>'),this.$content.append(this.$footer),this.$termsOfUseButton=$('<a href="#">'+this.extension.config.content.termsOfUse+"</a>"),this.$footer.append(this.$termsOfUseButton),this.$termsOfUseButton.onPressed(function(){$.publish(i.SHOW_TERMS_OF_USE)}),this.$element.hide(),this.updateTermsOfUseButton()},t.prototype.addEntireFileDownloadOptions=function(){var e=this;if(this.isDownloadOptionAvailable(o.entireFileAsOriginal)){this.$downloadOptions.empty();var t=this.extension.helper.getCurrentCanvas(),i=!1;$.each(t.getRenderings(),function(t,n){var o=n.getFormat(),s="";o&&(s=o.toString()),e.addEntireFileDownloadOption(n.id,Manifesto.TranslationCollection.getValue(n.getLabel()),s),i=!0}),i||this.addEntireFileDownloadOption(t.id,null,null)}},t.prototype.addEntireFileDownloadOption=function(e,t,i){t?t+=" ({0})":t=this.content.entireFileAsOriginal;var n;n=i?Utils.Files.simplifyMimeType(i):this.getFileExtension(e),this.$downloadOptions.append('<li><a href="'+e+'" target="_blank" download tabindex="0">'+String.format(t,n)+"</li>")},t.prototype.updateNoneAvailable=function(){this.$downloadOptions.find("li:visible").length?this.$noneAvailable.hide():this.$noneAvailable.show()},t.prototype.updateTermsOfUseButton=function(){var e=this.extension.helper.getAttribution();Utils.Bools.getBool(this.extension.config.options.termsOfUseEnabled,!1)&&e?this.$termsOfUseButton.show():this.$termsOfUseButton.hide()},t.prototype.getFileExtension=function(e){return e.split(".").pop()},t.prototype.isDownloadOptionAvailable=function(e){switch(e){case o.entireFileAsOriginal:this.extension.helper.manifest.getService(manifesto.ServiceProfile.uiExtensions());if(!this.extension.helper.isUIEnabled("mediaDownload"))return!1}return!0},t.prototype.close=function(){e.prototype.close.call(this)},t.prototype.resize=function(){this.setDockedPosition()},t}(n);return s});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("extensions/uv-mediaelement-extension/DownloadDialogue",["require","exports","../../modules/uv-dialogues-module/DownloadDialogue"],function(e,t,i){"use strict";var n=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){this.setConfig("downloadDialogue"),e.prototype.create.call(this)},t.prototype.open=function(t){e.prototype.open.call(this,t),this.addEntireFileDownloadOptions(),this.updateNoneAvailable(),this.resize()},t.prototype.isDownloadOptionAvailable=function(t){return e.prototype.isDownloadOptionAvailable.call(this,t)},t}(i);return n});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-dialogues-module/ShareDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue"],function(e,t,i,n){"use strict";var o=function(e){function t(t){var i=e.call(this,t)||this;return i.aspectRatio=.75,i.isEmbedViewVisible=!1,i.isShareViewVisible=!1,i.maxHeight=i.maxWidth*i.aspectRatio,i.maxWidth=8e3,i.minHeight=i.minWidth*i.aspectRatio,i.minWidth=200,i}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("shareDialogue"),e.prototype.create.call(this),this.openCommand=i.SHOW_SHARE_DIALOGUE,this.closeCommand=i.HIDE_SHARE_DIALOGUE,$.subscribe(this.openCommand,function(e,i){t.open(i),t.isShareAvailable()?t.openShareView():t.openEmbedView()}),$.subscribe(this.closeCommand,function(e){t.close()}),$.subscribe(i.SHOW_EMBED_DIALOGUE,function(e,i){t.open(i),t.openEmbedView()}),this.$tabs=$('<div class="tabs"></div>'),this.$content.append(this.$tabs),this.$shareButton=$('<a class="share tab default" tabindex="0">'+this.content.share+"</a>"),this.$shareButton.prop("title",this.content.share),this.$tabs.append(this.$shareButton),this.$embedButton=$('<a class="embed tab" tabindex="0">'+this.content.embed+"</a>"),this.$embedButton.prop("title",this.content.embed),this.$tabs.append(this.$embedButton),this.$tabsContent=$('<div class="tabsContent"></div>'),this.$content.append(this.$tabsContent),this.$footer=$('<div class="footer"></div>'),this.$content.append(this.$footer),this.$shareView=$('<div class="shareView view"></div>'),this.$tabsContent.append(this.$shareView),this.$shareHeader=$('<div class="header"></div>'),this.$shareView.append(this.$shareHeader),this.$shareLink=$('<a class="shareLink" onclick="return false;"></a>'),this.$shareView.append(this.$shareLink),this.$shareInput=$('<input class="shareInput" type="text" readonly="true" />'),this.$shareView.append(this.$shareInput),this.$shareFrame=$('<iframe class="shareFrame"></iframe>'),this.$shareView.append(this.$shareFrame),this.$embedView=$('<div class="embedView view"></div>'),this.$tabsContent.append(this.$embedView),this.$embedHeader=$('<div class="header"></div>'),this.$embedView.append(this.$embedHeader),this.$code=$('<input class="code" type="text" readonly="true" />'),this.$embedView.append(this.$code),this.$customSize=$('<div class="customSize"></div>'),this.$embedView.append(this.$customSize),this.$size=$('<span class="size">'+this.content.size+"</span>"),this.$customSize.append(this.$size),this.$customSizeDropDown=$('<select id="size"></select>'),this.$customSize.append(this.$customSizeDropDown),this.$customSizeDropDown.append('<option value="small" data-width="560" data-height="420">560 x 420</option>'),this.$customSizeDropDown.append('<option value="medium" data-width="640" data-height="480">640 x 480</option>'),this.$customSizeDropDown.append('<option value="large" data-width="800" data-height="600">800 x 600</option>'),this.$customSizeDropDown.append('<option value="custom">'+this.content.customSize+"</option>"),this.$widthInput=$('<input class="width" type="text" maxlength="10" />'),this.$customSize.append(this.$widthInput),this.$x=$('<span class="x">x</span>'),this.$customSize.append(this.$x),this.$heightInput=$('<input class="height" type="text" maxlength="10" />'),this.$customSize.append(this.$heightInput);var n=this.extension.getIIIFShareUrl();this.$iiifButton=$('<a class="imageBtn iiif" href="'+n+'" title="'+this.content.iiif+'" target="_blank"></a>'),this.$footer.append(this.$iiifButton),this.$termsOfUseButton=$('<a href="#">'+this.extension.config.content.termsOfUse+"</a>"),this.$footer.append(this.$termsOfUseButton),this.$widthInput.on("keydown",function(e){return Utils.Numbers.numericalInput(e)}),this.$heightInput.on("keydown",function(e){return Utils.Numbers.numericalInput(e)}),this.$shareInput.focus(function(){$(this).select()}),this.$code.focus(function(){$(this).select()}),this.$shareButton.onPressed(function(){t.openShareView()}),this.$embedButton.onPressed(function(){t.openEmbedView()}),this.$customSizeDropDown.change(function(){t.update()}),this.$widthInput.change(function(){t.updateHeightRatio(),t.update()}),this.$heightInput.change(function(){t.updateWidthRatio(),t.update()}),this.$termsOfUseButton.onPressed(function(){$.publish(i.SHOW_TERMS_OF_USE)}),this.$element.hide(),this.update()},t.prototype.open=function(t){e.prototype.open.call(this,t),this.update()},t.prototype.getShareUrl=function(){return this.extension.getShareUrl()},t.prototype.isShareAvailable=function(){return!!this.getShareUrl()},t.prototype.update=function(){this.isShareAvailable()?this.$shareButton.show():this.$shareButton.hide();var e=this.getSelectedSize();"custom"===e.val()?(this.$widthInput.show(),this.$x.show(),this.$heightInput.show()):(this.$widthInput.hide(),this.$x.hide(),this.$heightInput.hide(),this.currentWidth=Number(e.data("width")),this.currentHeight=Number(e.data("height")),this.$widthInput.val(String(this.currentWidth)),this.$heightInput.val(String(this.currentHeight))),this.updateInstructions(),this.updateShareOptions(),this.updateShareFrame(),this.updateTermsOfUseButton()},t.prototype.updateShareOptions=function(){this.$shareInput.val(this.getShareUrl()),this.$shareLink.prop("href",this.getShareUrl()),this.$shareLink.text(this.getShareUrl()),$.browser.mobile?(this.$shareInput.hide(),this.$shareLink.show()):(this.$shareInput.show(),this.$shareLink.hide())},t.prototype.updateInstructions=function(){Utils.Bools.getBool(this.options.instructionsEnabled,!1)?(this.$shareHeader.show(),this.$embedHeader.show(),this.$shareHeader.text(this.content.shareInstructions),this.$embedHeader.text(this.content.embedInstructions)):(this.$shareHeader.hide(),this.$embedHeader.hide())},t.prototype.getSelectedSize=function(){return this.$customSizeDropDown.find(":selected")},t.prototype.updateWidthRatio=function(){this.currentHeight=Number(this.$heightInput.val()),this.currentHeight<this.minHeight?(this.currentHeight=this.minHeight,this.$heightInput.val(String(this.currentHeight))):this.currentHeight>this.maxHeight&&(this.currentHeight=this.maxHeight,this.$heightInput.val(String(this.currentHeight))),this.currentWidth=Math.floor(this.currentHeight/this.aspectRatio),this.$widthInput.val(String(this.currentWidth))},t.prototype.updateHeightRatio=function(){this.currentWidth=Number(this.$widthInput.val()),this.currentWidth<this.minWidth?(this.currentWidth=this.minWidth,this.$widthInput.val(String(this.currentWidth))):this.currentWidth>this.maxWidth&&(this.currentWidth=this.maxWidth,this.$widthInput.val(String(this.currentWidth))),this.currentHeight=Math.floor(this.currentWidth*this.aspectRatio),this.$heightInput.val(String(this.currentHeight))},t.prototype.updateShareFrame=function(){var e=this.extension.helper.getShareServiceUrl();Utils.Bools.getBool(this.config.options.shareFrameEnabled,!0)&&e?(this.$shareFrame.prop("src",e),this.$shareFrame.show()):this.$shareFrame.hide()},t.prototype.updateTermsOfUseButton=function(){var e=this.extension.helper.getAttribution();Utils.Bools.getBool(this.extension.config.options.termsOfUseEnabled,!1)&&e?this.$termsOfUseButton.show():this.$termsOfUseButton.hide()},t.prototype.openShareView=function(){this.isShareViewVisible=!0,this.isEmbedViewVisible=!1,this.$embedView.hide(),this.$shareView.show(),this.$shareButton.addClass("on default"),this.$embedButton.removeClass("on default"),this.resize()},t.prototype.openEmbedView=function(){this.isShareViewVisible=!1,this.isEmbedViewVisible=!0,this.$embedView.show(),this.$shareView.hide(),this.$shareButton.removeClass("on default"),this.$embedButton.addClass("on default"),this.resize()},t.prototype.close=function(){e.prototype.close.call(this)},t.prototype.getViews=function(){return this.$tabsContent.find(".view")},t.prototype.equaliseViewHeights=function(){this.getViews().equaliseHeight(!0)},t.prototype.resize=function(){this.equaliseViewHeights(),this.setDockedPosition()},t}(n);return o});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("extensions/uv-mediaelement-extension/ShareDialogue",["require","exports","../../modules/uv-dialogues-module/ShareDialogue"],function(e,t,i){"use strict";var n=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){this.setConfig("shareDialogue"),e.prototype.create.call(this)},t.prototype.update=function(){e.prototype.update.call(this),this.code=this.extension.getEmbedScript(this.options.embedTemplate,this.currentWidth,this.currentHeight),this.$code.val(this.code)},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(i);return n});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-shared-module/FooterPanel",["require","exports","./BaseCommands","./BaseView","./Metrics"],function(e,t,i,n,o){"use strict";var s=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("footerPanel"),e.prototype.create.call(this),$.subscribe(i.TOGGLE_FULLSCREEN,function(){t.updateFullScreenButton()}),$.subscribe(i.METRIC_CHANGED,function(){t.updateMinimisedButtons(),t.updateMoreInfoButton()}),$.subscribe(i.SETTINGS_CHANGED,function(){t.updateDownloadButton()}),this.$options=$('<div class="options"></div>'),this.$element.append(this.$options),this.$feedbackButton=$('<a class="feedback" title="'+this.content.feedback+'" tabindex="0">'+this.content.feedback+"</a>"),this.$options.prepend(this.$feedbackButton),this.$openButton=$('<a class="open" title="'+this.content.open+'" tabindex="0">'+this.content.open+"</a>"),this.$options.prepend(this.$openButton),this.$bookmarkButton=$('<a class="bookmark" title="'+this.content.bookmark+'" tabindex="0">'+this.content.bookmark+"</a>"),this.$options.prepend(this.$bookmarkButton),this.$shareButton=$('<a href="#" class="share" title="'+this.content.share+'" tabindex="0">'+this.content.share+"</a>"),this.$options.append(this.$shareButton),this.$embedButton=$('<a href="#" class="embed" title="'+this.content.embed+'" tabindex="0">'+this.content.embed+"</a>"),this.$options.append(this.$embedButton),this.$downloadButton=$('<a class="download" title="'+this.content.download+'" tabindex="0">'+this.content.download+"</a>"),this.$options.prepend(this.$downloadButton),this.$moreInfoButton=$('<a href="#" class="moreInfo" title="'+this.content.moreInfo+'" tabindex="0">'+this.content.moreInfo+"</a>"),this.$options.prepend(this.$moreInfoButton),this.$fullScreenBtn=$('<a href="#" class="fullScreen" title="'+this.content.fullScreen+'" tabindex="0">'+this.content.fullScreen+"</a>"),this.$options.append(this.$fullScreenBtn),this.$openButton.onPressed(function(){$.publish(i.OPEN)}),this.$feedbackButton.onPressed(function(){$.publish(i.FEEDBACK)}),this.$bookmarkButton.onPressed(function(){$.publish(i.BOOKMARK)}),this.$shareButton.onPressed(function(){$.publish(i.SHOW_SHARE_DIALOGUE,[t.$shareButton])}),this.$embedButton.onPressed(function(){$.publish(i.SHOW_EMBED_DIALOGUE,[t.$embedButton])}),this.$downloadButton.onPressed(function(){$.publish(i.SHOW_DOWNLOAD_DIALOGUE,[t.$downloadButton])}),this.$moreInfoButton.onPressed(function(){$.publish(i.SHOW_MOREINFO_DIALOGUE,[t.$moreInfoButton])}),this.$fullScreenBtn.on("click",function(e){e.preventDefault(),$.publish(i.TOGGLE_FULLSCREEN)}),Utils.Bools.getBool(this.options.embedEnabled,!0)||this.$embedButton.hide(),this.updateMoreInfoButton(),this.updateOpenButton(),this.updateFeedbackButton(),this.updateBookmarkButton(),this.updateEmbedButton(),this.updateDownloadButton(),this.updateFullScreenButton(),this.updateShareButton(),this.updateMinimisedButtons()},t.prototype.updateMinimisedButtons=function(){return Utils.Bools.getBool(this.options.minimiseButtons,!1)?void this.$options.addClass("minimiseButtons"):void(this.extension.metric===o.MOBILE_LANDSCAPE?this.$options.addClass("minimiseButtons"):this.$options.removeClass("minimiseButtons"))},t.prototype.updateMoreInfoButton=function(){var e=Utils.Bools.getBool(this.options.moreInfoEnabled,!1);e&&this.extension.metric===o.MOBILE_LANDSCAPE?this.$moreInfoButton.show():this.$moreInfoButton.hide()},t.prototype.updateOpenButton=function(){var e=Utils.Bools.getBool(this.options.openEnabled,!1);e&&!this.extension.isHomeDomain?this.$openButton.show():this.$openButton.hide()},t.prototype.updateFullScreenButton=function(){Utils.Bools.getBool(this.options.fullscreenEnabled,!0)||this.$fullScreenBtn.hide(),this.extension.isLightbox&&this.$fullScreenBtn.addClass("lightbox"),this.extension.isFullScreen()?(this.$fullScreenBtn.swapClass("fullScreen","exitFullscreen"),this.$fullScreenBtn.text(this.content.exitFullScreen),this.$fullScreenBtn.attr("title",this.content.exitFullScreen)):(this.$fullScreenBtn.swapClass("exitFullscreen","fullScreen"),this.$fullScreenBtn.text(this.content.fullScreen),this.$fullScreenBtn.attr("title",this.content.fullScreen))},t.prototype.updateEmbedButton=function(){this.extension.helper.isUIEnabled("embed")&&Utils.Bools.getBool(this.options.embedEnabled,!1)?$.browser.mobile||this.$embedButton.show():this.$embedButton.hide()},t.prototype.updateShareButton=function(){this.extension.helper.isUIEnabled("share")&&Utils.Bools.getBool(this.options.shareEnabled,!0)?this.$shareButton.show():this.$shareButton.hide()},t.prototype.updateDownloadButton=function(){var e=Utils.Bools.getBool(this.options.downloadEnabled,!0);e?this.$downloadButton.show():this.$downloadButton.hide()},t.prototype.updateFeedbackButton=function(){var e=Utils.Bools.getBool(this.options.feedbackEnabled,!1);e?this.$feedbackButton.show():this.$feedbackButton.hide()},t.prototype.updateBookmarkButton=function(){var e=Utils.Bools.getBool(this.options.bookmarkEnabled,!1);e?this.$bookmarkButton.show():this.$bookmarkButton.hide()},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(n);return s}),define("modules/uv-shared-module/Information",["require","exports"],function(e,t){"use strict";var i=function(){function e(e,t){this.message=e,this.actions=t}return e}();return i}),define("modules/uv-shared-module/InformationAction",["require","exports"],function(e,t){"use strict";var i=function(){function e(){}return e}();return i}),define("modules/uv-shared-module/InformationFactory",["require","exports","./BaseCommands","./Information","./InformationAction","./InformationType"],function(e,t,i,n,o,s){"use strict";var r=function(){function e(e){this.extension=e}return e.prototype.Get=function(e){switch(e.informationType){case s.AUTH_CORS_ERROR:return new n(this.extension.config.content.authCORSError,[]);case s.DEGRADED_RESOURCE:var t=[],r=new o;return r.label=this.extension.config.content.degradedResourceLogin,r.action=function(){$.publish(i.HIDE_INFORMATION),$.publish(i.OPEN_EXTERNAL_RESOURCE,[[e.param]])},t.push(r),new n(this.extension.config.content.degradedResourceMessage,t)}},e}();return r});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-shared-module/HeaderPanel",["require","exports","./BaseCommands","./BaseView","../uv-shared-module/InformationFactory"],function(e,t,i,n,o){"use strict";var s=function(e){function t(t){return e.call(this,t,!1,!1)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("headerPanel"),e.prototype.create.call(this),$.subscribe(i.SHOW_INFORMATION,function(e,i){t.showInformation(i)}),$.subscribe(i.HIDE_INFORMATION,function(){t.hideInformation()}),this.$options=$('<div class="options"></div>'),this.$element.append(this.$options),this.$centerOptions=$('<div class="centerOptions"></div>'),this.$options.append(this.$centerOptions),this.$rightOptions=$('<div class="rightOptions"></div>'),this.$options.append(this.$rightOptions),this.$localeToggleButton=$('<a class="localeToggle" tabindex="0"></a>'),this.$rightOptions.append(this.$localeToggleButton),this.$settingsButton=$('<a class="imageBtn settings" tabindex="0"></a>'),this.$settingsButton.attr("title",this.content.settings),this.$rightOptions.append(this.$settingsButton),this.$informationBox=$('<div class="informationBox">                                     <div class="message"></div>                                     <div class="actions"></div>                                     <div class="close"></div>                                   </div>'),this.$element.append(this.$informationBox),this.$informationBox.hide(),this.$informationBox.find(".close").attr("title",this.content.close),this.$informationBox.find(".close").on("click",function(e){e.preventDefault(),$.publish(i.HIDE_INFORMATION)}),this.$localeToggleButton.on("click",function(){t.extension.changeLocale(String(t.$localeToggleButton.data("locale")))}),this.$settingsButton.onPressed(function(){$.publish(i.SHOW_SETTINGS_DIALOGUE)}),this.updateLocaleToggle(),this.updateSettingsButton()},t.prototype.updateLocaleToggle=function(){if(!this.localeToggleIsVisible())return void this.$localeToggleButton.hide();var e=this.extension.getAlternateLocale(),t=e.name.split("-")[0].toUpperCase();this.$localeToggleButton.data("locale",e.name),this.$localeToggleButton.attr("title",e.label),this.$localeToggleButton.text(t)},t.prototype.updateSettingsButton=function(){var e=Utils.Bools.getBool(this.options.settingsButtonEnabled,!0);e?this.$settingsButton.show():this.$settingsButton.hide()},t.prototype.localeToggleIsVisible=function(){return this.extension.getLocales().length>1&&Utils.Bools.getBool(this.options.localeToggleEnabled,!1)},t.prototype.showInformation=function(e){var t=new o(this.extension);this.information=t.Get(e);var i=this.$informationBox.find(".message");i.html(this.information.message).find("a").attr("target","_top");var n=this.$informationBox.find(".actions");n.empty();for(var s=0;s<this.information.actions.length;s++){var r=this.information.actions[s],a=$('<a href="#" class="btn btn-default">'+r.label+"</a>");a.on("click",r.action),n.append(a)}this.$informationBox.show(),this.$element.addClass("showInformation"),this.extension.resize()},t.prototype.hideInformation=function(){this.$element.removeClass("showInformation"),this.$informationBox.hide(),this.extension.resize()},t.prototype.getSettings=function(){return this.extension.getSettings()},t.prototype.updateSettings=function(e){this.extension.updateSettings(e),$.publish(i.UPDATE_SETTINGS,[e])},t.prototype.resize=function(){e.prototype.resize.call(this);var t=this.$element.width(),i=t/2,n=this.$centerOptions.outerWidth(),o=i-n/2;if(this.$centerOptions.css({left:o}),this.$informationBox.is(":visible")){var s=this.$informationBox.find(".actions"),r=this.$informationBox.find(".message");r.width(this.$element.width()-r.horizontalMargins()-s.outerWidth(!0)-this.$informationBox.find(".close").outerWidth(!0)-1),r.ellipsisFill(this.information.message)}this.extension.width()<this.extension.config.options.minWidthBreakPoint?this.localeToggleIsVisible()&&this.$localeToggleButton.hide():this.localeToggleIsVisible()&&this.$localeToggleButton.show()},t}(n);return s});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-dialogues-module/HelpDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue"],function(e,t,i,n){"use strict";var o=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("helpDialogue"),e.prototype.create.call(this),this.openCommand=i.SHOW_HELP_DIALOGUE,this.closeCommand=i.HIDE_HELP_DIALOGUE,$.subscribe(this.openCommand,function(e,i){t.open()}),$.subscribe(this.closeCommand,function(e){t.close()}),this.$title=$("<h1></h1>"),this.$content.append(this.$title),this.$scroll=$('<div class="scroll"></div>'),this.$content.append(this.$scroll),this.$message=$("<p></p>"),this.$scroll.append(this.$message),this.$title.text(this.content.title),this.$message.html(this.content.text),this.$message.targetBlank(),this.$element.hide()},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(n);return o});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-shared-module/CenterPanel",["require","exports","./Shell","./BaseView"],function(e,t,i,n){"use strict";var o=function(e){function t(t){return e.call(this,t,!1,!0)||this}return __extends(t,e),t.prototype.create=function(){var t=this;e.prototype.create.call(this),this.$title=$('<div class="title"></div>'),this.$element.append(this.$title),this.$content=$('<div id="content" class="content"></div>'),this.$element.append(this.$content),this.$attribution=$('<div class="attribution">                                   <div class="header">                                       <div class="title"></div>                                       <div class="close"></div>                                   </div>                                   <div class="main">                                       <div class="attribution-text"></div>                                       <div class="license"></div>                                       <div class="logo"></div>                                   </div>                              </div>'),this.$attribution.find(".header .title").text(this.content.attribution),this.$content.append(this.$attribution),this.$attribution.hide(),this.$closeAttributionButton=this.$attribution.find(".header .close"),this.$closeAttributionButton.on("click",function(e){e.preventDefault(),t.$attribution.hide()}),Utils.Bools.getBool(this.options.titleEnabled,!0)||this.$title.hide()},t.prototype.updateAttribution=function(){var e=this,t=this.extension.helper.getAttribution(),i=Utils.Bools.getBool(this.options.attributionEnabled,!0);if(t&&i){this.$attribution.show();var n=this.$attribution.find(".attribution-text"),o=this.$attribution.find(".license"),s=this.$attribution.find(".logo");
n.html(this.extension.sanitize(t)),n.find("img").one("load",function(){e.resize()}).each(function(){this.complete&&$(this).load()}),n.targetBlank(),n.toggleExpandText(this.options.trimAttributionCount,function(){e.resize()}),o.hide(),s.hide()}},t.prototype.resize=function(){e.prototype.resize.call(this);var t=i.$leftPanel.is(":visible")?Math.floor(i.$leftPanel.width()):0,n=i.$rightPanel.is(":visible")?Math.floor(i.$rightPanel.width()):0,o=Math.floor(this.$element.parent().width()-t-n);this.$element.css({left:t,width:o});var s;s=this.options&&this.options.titleEnabled===!1?0:this.$title.height(),this.$content.height(this.$element.height()-s),this.$content.width(this.$element.width()),this.$attribution&&this.$attribution.is(":visible")&&this.$attribution.css("top",this.$content.height()-this.$attribution.outerHeight()-this.$attribution.verticalMargins())},t}(n);return o});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-mediaelementcenterpanel-module/MediaElementCenterPanel",["require","exports","../uv-shared-module/BaseCommands","../../extensions/uv-mediaelement-extension/Commands","../uv-shared-module/CenterPanel"],function(e,t,i,n,o){"use strict";var s=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){this.setConfig("mediaelementCenterPanel"),e.prototype.create.call(this);var t=this;this.extension.isVideo()&&$.subscribe(i.TOGGLE_FULLSCREEN,function(e){t.bootstrapper.isFullScreen?(t.$container.css("backgroundColor","#000"),t.player.enterFullScreen(!1)):(t.$container.css("backgroundColor","transparent"),t.player.exitFullScreen(!1))}),$.subscribe(i.OPEN_EXTERNAL_RESOURCE,function(e,i){t.openMedia(i)}),this.$container=$('<div class="container"></div>'),this.$content.append(this.$container),this.title=this.extension.helper.getLabel()},t.prototype.openMedia=function(e){var t=this,i=this;this.extension.getExternalResources(e).then(function(){t.$container.empty();var e=t.extension.helper.getCurrentCanvas();t.mediaHeight=t.config.defaultHeight,t.mediaWidth=t.config.defaultWidth,t.$container.height(t.mediaHeight),t.$container.width(t.mediaWidth);var o=Utils.Dates.getTimeStamp(),s=t.extension.getPosterImageUri(),r=s?' poster="'+s+'"':"",a=[];if($.each(e.getRenderings(),function(e,t){a.push({type:t.getFormat().toString(),src:t.id})}),t.extension.isVideo())t.media=t.$container.append('<video id="'+o+'" type="video/mp4" class="mejs-uv" controls="controls" preload="none"'+r+"></video>"),t.player=new MediaElementPlayer("#"+o,{type:["video/mp4","video/webm","video/flv"],plugins:["flash"],alwaysShowControls:!1,autosizeProgress:!1,success:function(e){e.addEventListener("canplay",function(e){i.resize()}),e.addEventListener("play",function(e){$.publish(n.MEDIA_PLAYED,[Math.floor(i.player.media.currentTime)])}),e.addEventListener("pause",function(e){Math.floor(i.player.media.currentTime)!=Math.floor(i.player.media.duration)&&$.publish(n.MEDIA_PAUSED,[Math.floor(i.player.media.currentTime)])}),e.addEventListener("ended",function(e){$.publish(n.MEDIA_ENDED,[Math.floor(i.player.media.duration)])}),e.setSrc(a);try{e.load()}catch(t){}}});else{var l=0;for(var h in a)if("audio/mp3"===a[h].type){l=h;break}t.media=t.$container.append('<audio id="'+o+'" type="'+a[l].type+'" src="'+a[l].src+'" class="mejs-uv" controls="controls" preload="none"'+r+"></audio>"),t.player=new MediaElementPlayer("#"+o,{plugins:["flash"],alwaysShowControls:!1,autosizeProgress:!1,defaultVideoWidth:i.mediaWidth,defaultVideoHeight:i.mediaHeight,success:function(e){e.addEventListener("canplay",function(e){i.resize()}),e.addEventListener("play",function(e){$.publish(n.MEDIA_PLAYED,[Math.floor(i.player.media.currentTime)])}),e.addEventListener("pause",function(e){Math.floor(i.player.media.currentTime)!=Math.floor(i.player.media.duration)&&$.publish(n.MEDIA_PAUSED,[Math.floor(i.player.media.currentTime)])}),e.addEventListener("ended",function(e){$.publish(n.MEDIA_ENDED,[Math.floor(i.player.media.duration)])});try{e.load()}catch(t){}}})}t.resize()})},t.prototype.resize=function(){if(e.prototype.resize.call(this),"Firefox"===window.browserDetect.browser&&window.browserDetect.version<13)this.$container.width(this.mediaWidth),this.$container.height(this.mediaHeight);else{var t=Utils.Measurements.Dimensions.fitRect(this.mediaWidth,this.mediaHeight,this.$content.width(),this.$content.height());this.$container.height(t.height),this.$container.width(t.width)}this.player&&!this.extension.isFullScreen()&&this.player.resize();var i=Math.floor((this.$content.width()-this.$container.width())/2),n=Math.floor((this.$content.height()-this.$container.height())/2);this.$container.css({left:i,top:n}),this.$title.ellipsisFill(this.title)},t}(o);return s});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-shared-module/BaseExpandPanel",["require","exports","./BaseView"],function(e,t,i){"use strict";var n=function(e){function t(t){var i=e.call(this,t,!1,!0)||this;return i.isExpanded=!1,i.isFullyExpanded=!1,i.isUnopened=!0,i.autoToggled=!1,i.expandFullEnabled=!0,i}return __extends(t,e),t.prototype.create=function(){var t=this;e.prototype.create.call(this),this.$top=$('<div class="top"></div>'),this.$element.append(this.$top),this.$title=$('<div class="title"></div>'),this.$title.prop("title",this.content.title),this.$top.append(this.$title),this.$expandFullButton=$('<a class="expandFullButton" tabindex="0"></a>'),this.$expandFullButton.prop("title",this.content.expandFull),this.$top.append(this.$expandFullButton),Utils.Bools.getBool(this.config.options.expandFullEnabled,!0)||this.$expandFullButton.hide(),this.$collapseButton=$('<div class="collapseButton" tabindex="0"></div>'),this.$collapseButton.prop("title",this.content.collapse),this.$top.append(this.$collapseButton),this.$closed=$('<div class="closed"></div>'),this.$element.append(this.$closed),this.$expandButton=$('<a class="expandButton" tabindex="0"></a>'),this.$expandButton.prop("title",this.content.expand),this.$closed.append(this.$expandButton),this.$closedTitle=$('<a class="title"></a>'),this.$closedTitle.prop("title",this.content.title),this.$closed.append(this.$closedTitle),this.$main=$('<div class="main"></div>'),this.$element.append(this.$main),this.$expandButton.onPressed(function(){t.toggle()}),this.$expandFullButton.onPressed(function(){t.expandFull()}),this.$closedTitle.onPressed(function(){t.toggle()}),this.$title.onPressed(function(){t.isFullyExpanded?t.collapseFull():t.toggle()}),this.$collapseButton.onPressed(function(){t.isFullyExpanded?t.collapseFull():t.toggle()}),this.$top.hide(),this.$main.hide()},t.prototype.init=function(){e.prototype.init.call(this)},t.prototype.setTitle=function(e){this.$title.text(e),this.$closedTitle.text(e)},t.prototype.toggle=function(e){var t=this;e?this.autoToggled=!0:this.autoToggled=!1,this.isExpanded&&(this.$top.hide(),this.$main.hide(),this.$closed.show()),this.$element.stop().animate({width:this.getTargetWidth(),left:this.getTargetLeft()},this.options.panelAnimationDuration,function(){t.toggled()})},t.prototype.toggled=function(){this.toggleStart(),this.isExpanded=!this.isExpanded,this.isExpanded&&(this.$closed.hide(),this.$top.show(),this.$main.show()),this.toggleFinish(),this.isUnopened=!1},t.prototype.expandFull=function(){var e=this;this.isExpanded||this.toggled();var t=this.getFullTargetWidth(),i=this.getFullTargetLeft();this.expandFullStart(),this.$element.stop().animate({width:t,left:i},this.options.panelAnimationDuration,function(){e.expandFullFinish()})},t.prototype.collapseFull=function(){var e=this,t=this.getTargetWidth(),i=this.getTargetLeft();this.collapseFullStart(),this.$element.stop().animate({width:t,left:i},this.options.panelAnimationDuration,function(){e.collapseFullFinish()})},t.prototype.getTargetWidth=function(){return 0},t.prototype.getTargetLeft=function(){return 0},t.prototype.getFullTargetWidth=function(){return 0},t.prototype.getFullTargetLeft=function(){return 0},t.prototype.toggleStart=function(){},t.prototype.toggleFinish=function(){this.isExpanded&&!this.autoToggled?this.focusCollapseButton():this.focusExpandButton()},t.prototype.expandFullStart=function(){},t.prototype.expandFullFinish=function(){this.isFullyExpanded=!0,this.$expandFullButton.hide(),this.focusCollapseButton()},t.prototype.collapseFullStart=function(){},t.prototype.collapseFullFinish=function(){this.isFullyExpanded=!1,this.expandFullEnabled&&this.$expandFullButton.show(),this.focusExpandFullButton()},t.prototype.focusExpandButton=function(){var e=this;setTimeout(function(){e.$expandButton.focus()},1)},t.prototype.focusExpandFullButton=function(){var e=this;setTimeout(function(){e.$expandFullButton.focus()},1)},t.prototype.focusCollapseButton=function(){var e=this;setTimeout(function(){e.$collapseButton.focus()},1)},t.prototype.resize=function(){e.prototype.resize.call(this),this.$main.height(this.$element.parent().height()-this.$top.outerHeight(!0))},t}(i);return n});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-shared-module/RightPanel",["require","exports","./BaseCommands","./BaseExpandPanel"],function(e,t,i,n){"use strict";var o=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){e.prototype.create.call(this),this.$element.width(this.options.panelCollapsedWidth)},t.prototype.init=function(){var t=this;e.prototype.init.call(this);var n=Utils.Bools.getBool(this.extension.getSettings().rightPanelOpen,this.options.panelOpen);n&&this.toggle(!0),$.subscribe(i.TOGGLE_EXPAND_RIGHT_PANEL,function(){t.isFullyExpanded?t.collapseFull():t.expandFull()})},t.prototype.getTargetWidth=function(){return this.isExpanded?this.options.panelCollapsedWidth:this.options.panelExpandedWidth},t.prototype.getTargetLeft=function(){return this.isExpanded?this.$element.parent().width()-this.options.panelCollapsedWidth:this.$element.parent().width()-this.options.panelExpandedWidth},t.prototype.toggleFinish=function(){e.prototype.toggleFinish.call(this),this.isExpanded?$.publish(i.OPEN_RIGHT_PANEL):$.publish(i.CLOSE_RIGHT_PANEL),this.extension.updateSettings({rightPanelOpen:this.isExpanded})},t.prototype.resize=function(){e.prototype.resize.call(this),this.$element.css({left:Math.floor(this.$element.parent().width()-this.$element.outerWidth())})},t}(n);return o});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-moreinforightpanel-module/MoreInfoRightPanel",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/RightPanel"],function(e,t,i,n){"use strict";var o=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("moreInfoRightPanel"),e.prototype.create.call(this),$.subscribe(i.CANVAS_INDEX_CHANGED,function(e,i){t.databind()}),this.setTitle(this.config.content.title),this.$metadata=$('<div class="iiif-metadata-component"></div>'),this.$main.append(this.$metadata),this.component=new IIIFComponents.MetadataComponent({target:this.$metadata[0],data:this._getData()})},t.prototype.toggleFinish=function(){e.prototype.toggleFinish.call(this),this.databind()},t.prototype.databind=function(){this.component.options.data=this._getData(),this.component.set(null)},t.prototype._getData=function(){var e=this;return{canvasDisplayOrder:this.config.options.canvasDisplayOrder,canvases:this.extension.getCurrentCanvases(),canvasExclude:this.config.options.canvasExclude,canvasLabels:this.extension.getCanvasLabels(this.content.page),content:this.config.content,copiedMessageDuration:2e3,copyToClipboardEnabled:Utils.Bools.getBool(this.config.options.copyToClipboardEnabled,!1),helper:this.extension.helper,licenseFormatter:null,limit:this.config.options.textLimit||4,limitType:IIIFComponents.MetadataComponentOptions.LimitType.LINES,manifestDisplayOrder:this.config.options.manifestDisplayOrder,manifestExclude:this.config.options.manifestExclude,range:this.extension.getCurrentCanvasRange(),rtlLanguageCodes:this.config.options.rtlLanguageCodes,sanitizer:function(t){return e.extension.sanitize(t)},showAllLanguages:this.config.options.showAllLanguages}},t.prototype.resize=function(){e.prototype.resize.call(this),this.$main.height(this.$element.height()-this.$top.height()-this.$main.verticalMargins())},t}(n);return o});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-shared-module/LeftPanel",["require","exports","./BaseCommands","./BaseExpandPanel"],function(e,t,i,n){"use strict";var o=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){var t=this;e.prototype.create.call(this),this.$element.width(this.options.panelCollapsedWidth),$.subscribe(i.TOGGLE_EXPAND_LEFT_PANEL,function(){t.isFullyExpanded?t.collapseFull():t.expandFull()})},t.prototype.init=function(){e.prototype.init.call(this);var t=Utils.Bools.getBool(this.extension.getSettings().leftPanelOpen,this.options.panelOpen);t&&this.toggle(!0)},t.prototype.getTargetWidth=function(){return this.isFullyExpanded||!this.isExpanded?this.options.panelExpandedWidth:this.options.panelCollapsedWidth},t.prototype.getFullTargetWidth=function(){return this.$element.parent().width()},t.prototype.toggleFinish=function(){e.prototype.toggleFinish.call(this),this.isExpanded?$.publish(i.OPEN_LEFT_PANEL):$.publish(i.CLOSE_LEFT_PANEL),this.extension.updateSettings({leftPanelOpen:this.isExpanded})},t.prototype.resize=function(){e.prototype.resize.call(this),this.isFullyExpanded&&this.$element.width(this.$element.parent().width())},t}(n);return o});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-shared-module/ThumbsView",["require","exports","./BaseCommands","./BaseView"],function(e,t,i,n){"use strict";var o=function(e){function t(t){var i=e.call(this,t,!0,!0)||this;return i.isCreated=!1,i.isOpen=!1,i}return __extends(t,e),t.prototype.create=function(){var t=this;e.prototype.create.call(this),$.subscribe(i.CANVAS_INDEX_CHANGED,function(e,i){t.selectIndex(parseInt(i))}),$.subscribe(i.LOGIN,function(){t.loadThumbs()}),$.subscribe(i.CLICKTHROUGH,function(){t.loadThumbs()}),this.$thumbs=$('<div class="thumbs"></div>'),this.$element.append(this.$thumbs),this.$thumbs.addClass(this.extension.helper.getViewingDirection().toString());var n=this;$.templates({thumbsTemplate:'<div id="thumb{{>index}}" class="{{:~className()}}" data-src="{{>uri}}" data-visible="{{>visible}}" data-index="{{>index}}">                                <div class="wrap" style="height:{{>height + ~extraHeight()}}px"></div>                                <div class="info">                                    <span class="index">{{:#index + 1}}</span>                                    <span class="label" title="{{>label}}">{{>label}}&nbsp;</span>                                    <span class="searchResults" title="{{:~searchResultsTitle()}}">{{>data.searchResults}}</span>                                </div>                             </div>                             {{if ~separator()}}                                  <div class="separator"></div>                              {{/if}}'});var o=this.options.thumbsExtraHeight;$.views.helpers({separator:function(){return!1},extraHeight:function(){return o},className:function(){var e="thumb";0===this.data.index&&(e+=" first"),this.data.uri||(e+=" placeholder");var t=n.extension.helper.getViewingDirection().toString();return e+=t===manifesto.ViewingDirection.topToBottom().toString()||t===manifesto.ViewingDirection.bottomToTop().toString()?" oneCol":" twoCol"},searchResultsTitle:function(){var e=Number(this.data.data.searchResults);return e?e>1?String.format(n.content.searchResults,e):String.format(n.content.searchResult,e):void 0}}),this.$element.on("scroll",function(){t.scrollStop()},100),this.resize()},t.prototype.databind=function(){this.thumbs&&(this._thumbsCache=null,this.createThumbs(),this.loadThumbs(0),this.selectIndex(this.extension.helper.canvasIndex))},t.prototype.createThumbs=function(){var e=this;if(this.thumbs){for(var t=[],n=0;n<this.thumbs.length;n++){var o=this.thumbs[n];t.push(o.height)}for(var s=Math.median(t),n=0;n<this.thumbs.length;n++){var o=this.thumbs[n];o.height=s}this.$thumbs.link($.templates.thumbsTemplate,this.thumbs),this.$thumbs.undelegate(".thumb","click"),this.$thumbs.delegate(".thumb","click",function(t){t.preventDefault();var n=$.view(this).data;e.lastThumbClickedIndex=n.index,$.publish(i.THUMB_SELECTED,[n])}),this.setLabel(),this.isCreated=!0}},t.prototype.selectAll=function(e){},t.prototype.scrollStop=function(){var e=1/((this.$thumbs.height()-this.$element.height())/this.$element.scrollTop());e>1&&(e=1);var t=Math.floor((this.thumbs.length-1)*e);this.loadThumbs(t)},t.prototype.loadThumbs=function(e){if(this.thumbs&&this.thumbs.length){_.isUndefined(e)&&(e=this.extension.helper.canvasIndex);for(var t=e,i=this.options.thumbsLoadRange,n={start:t>i?t-i:0,end:t<this.thumbs.length-1-i?t+i:this.thumbs.length-1},o=this.options.thumbsImageFadeInDuration,s=n.start;s<=n.end;s++){var r=this.getThumbByIndex(s),a=r.find(".wrap");if(!a.hasClass("loading")&&!a.hasClass("loaded")){var l=r.attr("data-visible");if("false"!==l){a.removeClass("loadingFailed"),a.addClass("loading");var h=r.attr("data-src");h+="?t="+Utils.Dates.getTimeStamp();var c=$('<img src="'+h+'" />');$(c).hide().load(function(){$(this).fadeIn(o,function(){$(this).parent().swapClass("loading","loaded")})}).error(function(){$(this).parent().swapClass("loading","loadingFailed")}),a.append(c)}else a.addClass("hidden")}}}},t.prototype.show=function(){var e=this;this.isOpen=!0,this.$element.show(),setTimeout(function(){e.selectIndex(e.extension.helper.canvasIndex)},1)},t.prototype.hide=function(){this.isOpen=!1,this.$element.hide()},t.prototype.isPDF=function(){return this.extension.helper.getElementType().toString().contains("pdf")},t.prototype.setLabel=function(){$(this.$thumbs).find("span.index").hide(),$(this.$thumbs).find("span.label").show()},t.prototype.addSelectedClassToThumbs=function(e){this.getThumbByIndex(e).addClass("selected")},t.prototype.selectIndex=function(e){if(-1!==e&&this.thumbs&&this.thumbs.length){this.getAllThumbs().removeClass("selected"),this.$selectedThumb=this.getThumbByIndex(e),this.addSelectedClassToThumbs(e);var t=this.extension.getPagedIndices(e);~t.indexOf(this.lastThumbClickedIndex)||this.$element.scrollTop(this.$selectedThumb.position().top),this.loadThumbs(e)}},t.prototype.getAllThumbs=function(){return this._thumbsCache||(this._thumbsCache=this.$thumbs.find(".thumb")),this._thumbsCache},t.prototype.getThumbByIndex=function(e){return this.$thumbs.find('[data-index="'+e+'"]')},t.prototype.scrollToThumb=function(e){var t=this.getThumbByIndex(e);this.$element.scrollTop(t.position().top)},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(n);return o});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-resourcesleftpanel-module/ThumbsView",["require","exports","../uv-shared-module/ThumbsView"],function(e,t,i){"use strict";var n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.create=function(){this.setConfig("resourcesLeftPanel"),e.prototype.create.call(this)},t}(i);return n});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-resourcesleftpanel-module/ResourcesLeftPanel",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/LeftPanel","./ThumbsView"],function(e,t,i,n,o){"use strict";var s=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){this.setConfig("resourcesLeftPanel"),e.prototype.create.call(this),this.setTitle(this.content.title),this.$tabsContent=$('<div class="tabsContent"></div>'),this.$main.append(this.$tabsContent),this.$views=$('<div class="views"></div>'),this.$tabsContent.append(this.$views),this.$thumbsView=$('<div class="thumbsView"></div>'),this.$views.append(this.$thumbsView),this.$resourcesView=$('<div class="resourcesView"></div>'),this.$resources=$("<ul></ul>"),this.$resourcesView.append(this.$resources),this.$views.append(this.$resourcesView),this.thumbsView=new o(this.$thumbsView),this.dataBind()},t.prototype.dataBind=function(){this.dataBindThumbsView();var e=this.extension.helper.getResources();0===e.length&&this.$resourcesView.hide();for(var t=0;t<e.length;t++){var i=e[t],n=i.getResource(),o=$('<li><a href="'+n.id+'" target="_blank">'+Manifesto.TranslationCollection.getValue(n.getLabel())+" ("+Utils.Files.simplifyMimeType(n.getFormat().toString())+")</li>");this.$resources.append(o)}},t.prototype.dataBindThumbsView=function(){if(this.thumbsView){var e,t,i=this.extension.helper.getViewingDirection().toString();i===manifesto.ViewingDirection.topToBottom().toString()||i===manifesto.ViewingDirection.bottomToTop().toString()?(e=this.config.options.oneColThumbWidth,t=this.config.options.oneColThumbHeight):(e=this.config.options.twoColThumbWidth,t=this.config.options.twoColThumbHeight),"undefined"==typeof e&&(e=100),"undefined"==typeof t&&(t=100),this.thumbsView.thumbs=this.extension.helper.getThumbs(e,t),this.thumbsView.thumbs.length<2&&this.$thumbsView.hide(),this.thumbsView.databind()}},t.prototype.expandFullStart=function(){e.prototype.expandFullStart.call(this),$.publish(i.LEFTPANEL_EXPAND_FULL_START)},t.prototype.expandFullFinish=function(){e.prototype.expandFullFinish.call(this),$.publish(i.LEFTPANEL_EXPAND_FULL_FINISH)},t.prototype.collapseFullStart=function(){e.prototype.collapseFullStart.call(this),$.publish(i.LEFTPANEL_COLLAPSE_FULL_START)},t.prototype.collapseFullFinish=function(){e.prototype.collapseFullFinish.call(this),$.publish(i.LEFTPANEL_COLLAPSE_FULL_FINISH)},t.prototype.resize=function(){e.prototype.resize.call(this),this.$views.height(this.$main.height()),this.$resources.height(this.$main.height())},t}(n);return s});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-dialogues-module/SettingsDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue"],function(e,t,i,n,o){"use strict";var s=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("settingsDialogue"),e.prototype.create.call(this),this.openCommand=i.SHOW_SETTINGS_DIALOGUE,this.closeCommand=i.HIDE_SETTINGS_DIALOGUE,$.subscribe(this.openCommand,function(e,i){t.open()}),$.subscribe(this.closeCommand,function(e){t.close()}),this.$title=$("<h1></h1>"),this.$content.append(this.$title),this.$scroll=$('<div class="scroll"></div>'),this.$content.append(this.$scroll),this.$version=$('<div class="version"></div>'),this.$content.append(this.$version),this.$website=$('<div class="website"></div>'),this.$content.append(this.$website),this.$locale=$('<div class="setting locale"></div>'),this.$scroll.append(this.$locale),this.$localeLabel=$('<label for="locale">'+this.content.locale+"</label>"),this.$locale.append(this.$localeLabel),this.$localeDropDown=$('<select id="locale"></select>'),this.$locale.append(this.$localeDropDown),this.$title.text(this.content.title),this.$website.html(this.content.website),this.$website.targetBlank();for(var n=this.extension.getLocales(),o=0;o<n.length;o++){var s=n[o];this.$localeDropDown.append('<option value="'+s.name+'">'+s.label+"</option>")}this.$localeDropDown.val(this.extension.locale),this.$localeDropDown.change(function(){t.extension.changeLocale(t.$localeDropDown.val())}),this.extension.getLocales().length<2&&this.$locale.hide(),this.$element.hide()},t.prototype.getSettings=function(){return this.extension.getSettings()},t.prototype.updateSettings=function(e){this.extension.updateSettings(e),$.publish(n.UPDATE_SETTINGS,[e])},t.prototype.open=function(){var t=this;e.prototype.open.call(this),window.DEBUG||$.getJSON("package.json",function(e){t.$version.text("v"+e.version)})},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(o);return s});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("extensions/uv-mediaelement-extension/SettingsDialogue",["require","exports","../../modules/uv-dialogues-module/SettingsDialogue"],function(e,t,i){"use strict";var n=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){this.setConfig("settingsDialogue"),e.prototype.create.call(this)},t}(i);return n});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("extensions/uv-mediaelement-extension/Extension",["require","exports","../../modules/uv-shared-module/BaseCommands","../../modules/uv-shared-module/BaseExtension","../../modules/uv-shared-module/Bookmark","./Commands","./DownloadDialogue","./ShareDialogue","../../modules/uv-shared-module/FooterPanel","../../modules/uv-shared-module/HeaderPanel","../../modules/uv-dialogues-module/HelpDialogue","../../modules/uv-mediaelementcenterpanel-module/MediaElementCenterPanel","../../modules/uv-moreinforightpanel-module/MoreInfoRightPanel","../../modules/uv-resourcesleftpanel-module/ResourcesLeftPanel","./SettingsDialogue","../../modules/uv-shared-module/Shell"],function(e,t,i,n,o,s,r,a,l,h,c,u,p,d,g,f){"use strict";var m=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(t){var n=this;e.prototype.create.call(this,t),$(window).bind("enterfullscreen",function(){$.publish(i.TOGGLE_FULLSCREEN)}),$(window).bind("exitfullscreen",function(){$.publish(i.TOGGLE_FULLSCREEN)}),$.subscribe(i.THUMB_SELECTED,function(e,t){n.viewCanvas(t)}),$.subscribe(i.LEFTPANEL_EXPAND_FULL_START,function(e){f.$centerPanel.hide(),f.$rightPanel.hide()}),$.subscribe(i.LEFTPANEL_COLLAPSE_FULL_FINISH,function(e){f.$centerPanel.show(),f.$rightPanel.show(),n.resize()}),$.subscribe(s.MEDIA_ENDED,function(e){n.triggerSocket(s.MEDIA_ENDED)}),$.subscribe(s.MEDIA_PAUSED,function(e){n.triggerSocket(s.MEDIA_PAUSED)}),$.subscribe(s.MEDIA_PLAYED,function(e){n.triggerSocket(s.MEDIA_PLAYED)})},t.prototype.createModules=function(){e.prototype.createModules.call(this),this.isHeaderPanelEnabled()?this.headerPanel=new h(f.$headerPanel):f.$headerPanel.hide(),this.isLeftPanelEnabled()&&(this.leftPanel=new d(f.$leftPanel)),this.centerPanel=new u(f.$centerPanel),this.isRightPanelEnabled()&&(this.rightPanel=new p(f.$rightPanel)),this.isFooterPanelEnabled()?this.footerPanel=new l(f.$footerPanel):f.$footerPanel.hide(),this.$helpDialogue=$('<div class="overlay help"></div>'),f.$overlays.append(this.$helpDialogue),this.helpDialogue=new c(this.$helpDialogue),this.$downloadDialogue=$('<div class="overlay download"></div>'),f.$overlays.append(this.$downloadDialogue),this.downloadDialogue=new r(this.$downloadDialogue),this.$shareDialogue=$('<div class="overlay share"></div>'),f.$overlays.append(this.$shareDialogue),this.shareDialogue=new a(this.$shareDialogue),this.$settingsDialogue=$('<div class="overlay settings"></div>'),f.$overlays.append(this.$settingsDialogue),this.settingsDialogue=new g(this.$settingsDialogue),this.isLeftPanelEnabled()&&this.leftPanel.init(),this.isRightPanelEnabled()&&this.rightPanel.init()},t.prototype.isLeftPanelEnabled=function(){return Utils.Bools.getBool(this.config.options.leftPanelEnabled,!0)&&(this.helper.isMultiCanvas()||this.helper.isMultiSequence()||this.helper.hasResources())},t.prototype.bookmark=function(){e.prototype.bookmark.call(this);var t=this.extensions.helper.getCurrentCanvas(),n=new o;n.index=this.helper.canvasIndex,n.label=Manifesto.TranslationCollection.getValue(t.getLabel()),n.path=this.getBookmarkUri(),n.thumb=t.getProperty("thumbnail"),n.title=this.helper.getLabel(),n.trackingLabel=window.trackingLabel,this.isVideo()?n.type=manifesto.ElementType.movingimage().toString():n.type=manifesto.ElementType.sound().toString(),this.triggerSocket(i.BOOKMARK,n)},t.prototype.getEmbedScript=function(e,t,i){var n=this.config.uri||"",o=String.format(e,this.getSerializedLocales(),n,this.helper.iiifResourceUri,this.helper.collectionIndex,this.helper.manifestIndex,this.helper.sequenceIndex,this.helper.canvasIndex,t,i,this.embedScriptUri);return o},t.prototype.getPosterImageUri=function(){return this.helper.getCurrentCanvas().getProperty("thumbnail")},t.prototype.isVideo=function(){var e=this.helper.getElementType();return e.toString()===manifesto.ElementType.movingimage().toString()},t}(n);return m});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("extensions/uv-pdf-extension/DownloadDialogue",["require","exports","../../modules/uv-dialogues-module/DownloadDialogue"],function(e,t,i){"use strict";var n=function(e){function t(t){return e.call(this,t)||this;
}return __extends(t,e),t.prototype.create=function(){this.setConfig("downloadDialogue"),e.prototype.create.call(this)},t.prototype.open=function(t){e.prototype.open.call(this,t),this.addEntireFileDownloadOptions(),this.$downloadOptions.find("li:visible").length?this.$noneAvailable.hide():this.$noneAvailable.show(),this.resize()},t.prototype.isDownloadOptionAvailable=function(t){return e.prototype.isDownloadOptionAvailable.call(this,t)},t}(i);return n});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("extensions/uv-pdf-extension/ShareDialogue",["require","exports","../../modules/uv-dialogues-module/ShareDialogue"],function(e,t,i){"use strict";var n=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){this.setConfig("shareDialogue"),e.prototype.create.call(this)},t.prototype.update=function(){e.prototype.update.call(this),this.code=this.extension.getEmbedScript(this.options.embedTemplate,this.currentWidth,this.currentHeight),this.$code.val(this.code)},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(i);return n});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-pdfcenterpanel-module/PDFCenterPanel",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/CenterPanel","../../Params"],function(e,t,i,n,o){"use strict";var s=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("pdfCenterPanel"),e.prototype.create.call(this),$.subscribe(i.OPEN_EXTERNAL_RESOURCE,function(e,i){t.openMedia(i)})},t.prototype.openMedia=function(e){var t=this,i=this;this.extension.getExternalResources(e).then(function(){var e=t.extension.helper.getCurrentCanvas(),n=e.id,s=window.browserDetect.browser,r=window.browserDetect.version;if("Explorer"===s&&10>r||!t.config.options.usePdfJs)new PDFObject({url:n,id:"PDF"}).embed("content");else{var a;a=window.DEBUG?"modules/uv-pdfcenterpanel-module/html/viewer.html":"html/uv-pdfcenterpanel-module/viewer.html",t.$content.load(a,function(){window.DEBUG?PDFJS.workerSrc="extensions/uv-pdf-extension/lib/pdf.worker.min.js":PDFJS.workerSrc="lib/pdf.worker.min.js",PDFJS.DEFAULT_URL=n;var e=1+parseInt(i.extension.getParam(o.anchor))||0;PDFView.initialBookmark="page="+e,window.webViewerLoad(),t.resize()})}})},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(n);return s});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("extensions/uv-pdf-extension/SettingsDialogue",["require","exports","../../modules/uv-dialogues-module/SettingsDialogue"],function(e,t,i){"use strict";var n=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){this.setConfig("settingsDialogue"),e.prototype.create.call(this)},t}(i);return n});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("extensions/uv-pdf-extension/Extension",["require","exports","../../modules/uv-shared-module/BaseCommands","../../modules/uv-shared-module/BaseExtension","../../modules/uv-shared-module/Bookmark","./DownloadDialogue","./ShareDialogue","../../modules/uv-shared-module/FooterPanel","../../modules/uv-shared-module/HeaderPanel","../../modules/uv-moreinforightpanel-module/MoreInfoRightPanel","../../modules/uv-pdfcenterpanel-module/PDFCenterPanel","../../modules/uv-resourcesleftpanel-module/ResourcesLeftPanel","./SettingsDialogue","../../modules/uv-shared-module/Shell"],function(e,t,i,n,o,s,r,a,l,h,c,u,p,d){"use strict";var g=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(t){var n=this;e.prototype.create.call(this),$.subscribe(i.THUMB_SELECTED,function(e,t){n.viewCanvas(t.index)}),$.subscribe(i.LEFTPANEL_EXPAND_FULL_START,function(e){d.$centerPanel.hide(),d.$rightPanel.hide()}),$.subscribe(i.LEFTPANEL_COLLAPSE_FULL_FINISH,function(e){d.$centerPanel.show(),d.$rightPanel.show(),n.resize()}),$.subscribe(i.SHOW_OVERLAY,function(e,t){n.IsOldIE()&&n.centerPanel.$element.hide()}),$.subscribe(i.HIDE_OVERLAY,function(e,t){n.IsOldIE()&&n.centerPanel.$element.show()})},t.prototype.IsOldIE=function(){var e=window.browserDetect.browser,t=window.browserDetect.version;return"Explorer"===e&&9>=t?!0:!1},t.prototype.createModules=function(){e.prototype.createModules.call(this),this.isHeaderPanelEnabled()?this.headerPanel=new l(d.$headerPanel):d.$headerPanel.hide(),this.isLeftPanelEnabled()&&(this.leftPanel=new u(d.$leftPanel)),this.centerPanel=new c(d.$centerPanel),this.isRightPanelEnabled()&&(this.rightPanel=new h(d.$rightPanel)),this.isFooterPanelEnabled()?this.footerPanel=new a(d.$footerPanel):d.$footerPanel.hide(),this.$downloadDialogue=$('<div class="overlay download"></div>'),d.$overlays.append(this.$downloadDialogue),this.downloadDialogue=new s(this.$downloadDialogue),this.$shareDialogue=$('<div class="overlay share"></div>'),d.$overlays.append(this.$shareDialogue),this.shareDialogue=new r(this.$shareDialogue),this.$settingsDialogue=$('<div class="overlay settings"></div>'),d.$overlays.append(this.$settingsDialogue),this.settingsDialogue=new p(this.$settingsDialogue),this.isLeftPanelEnabled()&&this.leftPanel.init(),this.isRightPanelEnabled()&&this.rightPanel.init()},t.prototype.bookmark=function(){e.prototype.bookmark.call(this);var t=this.helper.getCurrentCanvas(),n=new o;n.index=this.helper.canvasIndex,n.label=Manifesto.TranslationCollection.getValue(t.getLabel()),n.path=this.getBookmarkUri(),n.thumb=t.getProperty("thumbnail"),n.title=this.helper.getLabel(),n.trackingLabel=window.trackingLabel,n.type=manifesto.ElementType.document().toString(),this.triggerSocket(i.BOOKMARK,n)},t.prototype.getEmbedScript=function(e,t,i){var n=this.config.uri||"",o=String.format(e,this.getSerializedLocales(),n,this.helper.iiifResourceUri,this.helper.collectionIndex,this.helper.manifestIndex,this.helper.sequenceIndex,this.helper.canvasIndex,t,i,this.embedScriptUri);return o},t}(n);return g}),define("extensions/uv-seadragon-extension/Commands",["require","exports"],function(e,t){"use strict";var i=function(){function e(){}return e}();return i.namespace="seadragonExtension.",i.CLEAR_SEARCH=i.namespace+"onClearSearch",i.CURRENT_VIEW_URI=i.namespace+"onCurrentViewUri",i.FIRST=i.namespace+"onFirst",i.GALLERY_DECREASE_SIZE=i.namespace+"onGalleryDecreaseSize",i.GALLERY_INCREASE_SIZE=i.namespace+"onGalleryIncreaseSize",i.GALLERY_THUMB_SELECTED=i.namespace+"onGalleryThumbSelected",i.HIDE_MULTISELECT_DIALOGUE=i.namespace+"onHideMultiSelectDialogue",i.IMAGE_SEARCH=i.namespace+"onImageSearch",i.LAST=i.namespace+"onLast",i.MODE_CHANGED=i.namespace+"onModeChanged",i.MULTISELECT_CHANGE=i.namespace+"onMultiSelectChange",i.MULTISELECTION_MADE=i.namespace+"onMultiSelectionMade",i.NEXT_SEARCH_RESULT=i.namespace+"onNextSearchResult",i.NEXT=i.namespace+"onNext",i.NEXT_IMAGES_SEARCH_RESULT_UNAVAILABLE=i.namespace+"onNextImagesSearchResultUnavailable",i.PREV_IMAGES_SEARCH_RESULT_UNAVAILABLE=i.namespace+"onPrevImagesSearchResultUnavailable",i.OPEN_THUMBS_VIEW=i.namespace+"onOpenThumbsView",i.OPEN_TREE_VIEW=i.namespace+"onOpenTreeView",i.PAGE_SEARCH=i.namespace+"onPageSearch",i.PAGING_TOGGLED=i.namespace+"onPagingToggled",i.PREV_SEARCH_RESULT=i.namespace+"onPrevSearchResult",i.PREV=i.namespace+"onPrev",i.PRINT=i.namespace+"onPrint",i.ROTATE=i.namespace+"onRotate",i.SEADRAGON_ANIMATION_FINISH=i.namespace+"onAnimationfinish",i.SEADRAGON_ANIMATION_START=i.namespace+"onAnimationStart",i.SEADRAGON_ANIMATION=i.namespace+"onAnimation",i.SEADRAGON_OPEN=i.namespace+"onOpen",i.SEADRAGON_RESIZE=i.namespace+"onResize",i.SEADRAGON_ROTATION=i.namespace+"onRotation",i.SEARCH_PREVIEW_FINISH=i.namespace+"onSearchPreviewFinish",i.SEARCH_PREVIEW_START=i.namespace+"onSearchPreviewStart",i.SEARCH_RESULT_CANVAS_CHANGED=i.namespace+"onSearchResultCanvasChanged",i.SEARCH_RESULT_RECT_CHANGED=i.namespace+"onSearchResultRectChanged",i.SEARCH_RESULTS_EMPTY=i.namespace+"onSearchResultsEmpty",i.SEARCH_RESULTS=i.namespace+"onSearchResults",i.SEARCH_RESULTS_CLEARED=i.namespace+"onSearchResultsCleared",i.SEARCH=i.namespace+"onSearch",i.SHOW_MULTISELECT_DIALOGUE=i.namespace+"onShowMultiSelectDialogue",i.THUMB_MULTISELECTED=i.namespace+"onThumbMultiSelected",i.TREE_NODE_MULTISELECTED=i.namespace+"onTreeNodeMultiSelected",i.TREE_NODE_SELECTED=i.namespace+"onTreeNodeSelected",i.VIEW_PAGE=i.namespace+"onViewPage",i.ZOOM_IN=i.namespace+"onZoomIn",i.ZOOM_OUT=i.namespace+"onZoomOut",i});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-contentleftpanel-module/GalleryView",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/BaseView","../../extensions/uv-seadragon-extension/Commands"],function(e,t,i,n,o){"use strict";var s=function(e){function t(t){var i=e.call(this,t,!0,!0)||this;return i.isOpen=!1,i}return __extends(t,e),t.prototype.create=function(){this.setConfig("contentLeftPanel"),e.prototype.create.call(this),this.$gallery=$('<div class="iiif-gallery-component"></div>'),this.$element.append(this.$gallery)},t.prototype.setup=function(){this.component=new IIIFComponents.GalleryComponent({target:this.$gallery[0],data:this.galleryData}),this.component.on("thumbSelected",function(e){var t=e[0];$.publish(o.GALLERY_THUMB_SELECTED,[t]),$.publish(i.THUMB_SELECTED,[t])}),this.component.on("decreaseSize",function(){$.publish(o.GALLERY_DECREASE_SIZE)}),this.component.on("increaseSize",function(){$.publish(o.GALLERY_INCREASE_SIZE)})},t.prototype.databind=function(){this.component.options.data=this.galleryData,this.component.set(null),this.resize()},t.prototype.show=function(){var e=this;this.isOpen=!0,this.$element.show(),setTimeout(function(){e.component.selectIndex(e.extension.helper.canvasIndex)},10)},t.prototype.hide=function(){this.isOpen=!1,this.$element.hide()},t.prototype.resize=function(){e.prototype.resize.call(this);var t=this.$gallery.find(".main"),i=this.$gallery.find(".header");t.height(this.$element.height()-i.height())},t}(n);return s}),define("extensions/uv-seadragon-extension/Mode",["require","exports"],function(e,t){"use strict";var i=function(){function e(e){this.value=e}return e.prototype.toString=function(){return this.value},e}();return i.image=new i("image"),i.page=new i("page"),i});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-contentleftpanel-module/ThumbsView",["require","exports","../uv-shared-module/ThumbsView","../../extensions/uv-seadragon-extension/Commands","../../extensions/uv-seadragon-extension/Mode"],function(e,t,i,n,o){"use strict";var s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("contentLeftPanel"),e.prototype.create.call(this),$.subscribe(n.MODE_CHANGED,function(e,i){t.setLabel()}),$.subscribe(n.SEARCH_PREVIEW_START,function(e,i){t.searchPreviewStart(i)}),$.subscribe(n.SEARCH_PREVIEW_FINISH,function(){t.searchPreviewFinish()}),this.extension.helper.isPaged()&&this.$thumbs.addClass("paged");var i=this;$.views.helpers({separator:function(){return i.extension.helper.isVerticallyAligned()?!0:i.extension.helper.isPaged()?(this.data.index-1)%2==0?!1:!0:!1}})},t.prototype.addSelectedClassToThumbs=function(e){if(this.extension.isPagingSettingEnabled())for(var t=this.extension.getPagedIndices(e),i=0;i<t.length;i++)this.getThumbByIndex(t[i]).addClass("selected");else this.getThumbByIndex(e).addClass("selected")},t.prototype.isPageModeEnabled=function(){return"function"==typeof this.extension.getMode?this.config.options.pageModeEnabled&&this.extension.getMode().toString()===o.page.toString():this.config.options.pageModeEnabled},t.prototype.searchPreviewStart=function(e){this.scrollToThumb(e);var t=this.getThumbByIndex(e);t.addClass("searchpreview")},t.prototype.searchPreviewFinish=function(){this.scrollToThumb(this.extension.helper.canvasIndex),this.getAllThumbs().removeClass("searchpreview")},t.prototype.setLabel=function(){this.isPDF()?($(this.$thumbs).find("span.index").hide(),$(this.$thumbs).find("span.label").hide()):this.isPageModeEnabled()?($(this.$thumbs).find("span.index").hide(),$(this.$thumbs).find("span.label").show()):($(this.$thumbs).find("span.index").show(),$(this.$thumbs).find("span.label").hide())},t}(i);return s});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-contentleftpanel-module/TreeView",["require","exports","../uv-shared-module/BaseView","../../extensions/uv-seadragon-extension/Commands"],function(e,t,i,n){"use strict";var o=function(e){function t(t){var i=e.call(this,t,!0,!0)||this;return i.isOpen=!1,i}return __extends(t,e),t.prototype.create=function(){this.setConfig("contentLeftPanel"),e.prototype.create.call(this),this.$tree=$('<div class="iiif-tree-component"></div>'),this.$element.append(this.$tree)},t.prototype.setup=function(){this.component=new IIIFComponents.TreeComponent({target:this.$tree[0],data:this.treeData}),this.component.on("treeNodeSelected",function(e){var t=e[0];$.publish(n.TREE_NODE_SELECTED,[t])}),this.component.on("treeNodeMultiSelected",function(e){var t=e[0];$.publish(n.TREE_NODE_MULTISELECTED,[t])})},t.prototype.databind=function(){this.component.options.data=this.treeData,this.component.set(null),this.resize()},t.prototype.show=function(){this.isOpen=!0,this.$element.show()},t.prototype.hide=function(){this.isOpen=!1,this.$element.hide()},t.prototype.selectNode=function(e){this.component.selectNode(e)},t.prototype.deselectCurrentNode=function(){this.component.deselectCurrentNode()},t.prototype.getNodeById=function(e){return this.component.getNodeById(e)},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(i);return o});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-contentleftpanel-module/ContentLeftPanel",["require","exports","../uv-shared-module/BaseCommands","../../extensions/uv-seadragon-extension/Commands","./GalleryView","../uv-shared-module/LeftPanel","../uv-shared-module/Metrics","../../extensions/uv-seadragon-extension/Mode","./ThumbsView","./TreeView"],function(e,t,i,n,o,s,r,a,l,h){"use strict";var c=function(e){function t(t){var i=e.call(this,t)||this;return i.expandFullEnabled=!1,i.isThumbsViewOpen=!1,i.isTreeViewOpen=!1,i.treeSortType=Manifold.TreeSortType.NONE,i}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("contentLeftPanel"),e.prototype.create.call(this);$.subscribe(i.SETTINGS_CHANGED,function(){t.databind()}),$.subscribe(n.GALLERY_THUMB_SELECTED,function(){t.collapseFull()}),$.subscribe(i.METRIC_CHANGED,function(){t.extension.metric===r.MOBILE_LANDSCAPE&&t.isFullyExpanded&&t.collapseFull()}),$.subscribe(n.SEARCH_RESULTS,function(){t.databindThumbsView(),t.databindGalleryView()}),$.subscribe(n.SEARCH_RESULTS_CLEARED,function(){t.databindThumbsView(),t.databindGalleryView()}),$.subscribe(n.SEARCH_RESULTS_EMPTY,function(){t.databindThumbsView(),t.databindGalleryView()}),$.subscribe(i.CANVAS_INDEX_CHANGED,function(e,i){t.isFullyExpanded&&t.collapseFull(),t.selectCurrentTreeNode(),t.updateTreeTabBySelection()}),this.$tabs=$('<div class="tabs"></div>'),this.$main.append(this.$tabs),this.$treeButton=$('<a class="index tab" tabindex="0">'+this.content.index+"</a>"),this.$tabs.append(this.$treeButton),this.$thumbsButton=$('<a class="thumbs tab" tabindex="0">'+this.content.thumbnails+"</a>"),this.$thumbsButton.prop("title",this.content.thumbnails),this.$tabs.append(this.$thumbsButton),this.$tabsContent=$('<div class="tabsContent"></div>'),this.$main.append(this.$tabsContent),this.$options=$('<div class="options"></div>'),this.$tabsContent.append(this.$options),this.$topOptions=$('<div class="top"></div>'),this.$options.append(this.$topOptions),this.$treeSelect=$("<select></select>"),this.$topOptions.append(this.$treeSelect),this.$bottomOptions=$('<div class="bottom"></div>'),this.$options.append(this.$bottomOptions),this.$leftOptions=$('<div class="left"></div>'),this.$bottomOptions.append(this.$leftOptions),this.$rightOptions=$('<div class="right"></div>'),this.$bottomOptions.append(this.$rightOptions),this.$treeViewOptions=$('<div class="treeView"></div>'),this.$leftOptions.append(this.$treeViewOptions),this.$sortByLabel=$('<span class="sort">'+this.content.sortBy+"</span>"),this.$treeViewOptions.append(this.$sortByLabel),this.$sortButtonGroup=$('<div class="btn-group"></div>'),this.$treeViewOptions.append(this.$sortButtonGroup),this.$sortByDateButton=$('<button class="btn tabindex="0"">'+this.content.date+"</button>"),this.$sortButtonGroup.append(this.$sortByDateButton),this.$sortByVolumeButton=$('<button class="btn" tabindex="0">'+this.content.volume+"</button>"),this.$sortButtonGroup.append(this.$sortByVolumeButton),this.$views=$('<div class="views"></div>'),this.$tabsContent.append(this.$views),this.$treeView=$('<div class="treeView"></div>'),this.$views.append(this.$treeView),this.$thumbsView=$('<div class="thumbsView" tabindex="0"></div>'),this.$views.append(this.$thumbsView),this.$galleryView=$('<div class="galleryView"></div>'),this.$views.append(this.$galleryView),this.$treeSelect.hide(),this.$treeSelect.change(function(){t.databindTreeView(),t.selectCurrentTreeNode(),t.updateTreeTabBySelection()}),this.$sortByDateButton.on("click",function(){t.sortByDate()}),this.$sortByVolumeButton.on("click",function(){t.sortByVolume()}),this.$treeViewOptions.hide(),this.$treeButton.onPressed(function(){t.openTreeView(),$.publish(n.OPEN_TREE_VIEW)}),this.$thumbsButton.onPressed(function(){t.openThumbsView(),$.publish(n.OPEN_THUMBS_VIEW)}),this.setTitle(this.content.title),this.$sortByVolumeButton.addClass("on");var o=this.options.tabOrder;if(o){o=o.toLowerCase(),o=o.replace(/ /g,"");var s=o.split(",");"thumbs"===s[0]?(this.$treeButton.before(this.$thumbsButton),this.$thumbsButton.addClass("first")):this.$treeButton.addClass("first")}},t.prototype.createTreeView=function(){this.treeView=new h(this.$treeView),this.treeView.treeData=this.getTreeData(),this.treeView.setup(),this.databindTreeView();var e=this.extension.helper.getTopRanges();if(e.length>1)for(var t=0;t<e.length;t++){var i=e[t];this.$treeSelect.append('<option value="'+i.id+'">'+Manifesto.TranslationCollection.getValue(i.getLabel())+"</option>")}this.updateTreeViewOptions()},t.prototype.databind=function(){this.databindThumbsView(),this.databindTreeView(),this.databindGalleryView()},t.prototype.updateTreeViewOptions=function(){var e=this.getTree();this.isCollection()&&this.extension.helper.treeHasNavDates(e)?this.$treeViewOptions.show():this.$treeViewOptions.hide(),this.$treeSelect.find("option").length?this.$treeSelect.show():this.$treeSelect.hide()},t.prototype.sortByDate=function(){this.treeSortType=Manifold.TreeSortType.DATE,this.treeView.treeData=this.getTreeData(),this.treeView.databind(),this.selectCurrentTreeNode(),this.$sortByDateButton.addClass("on"),this.$sortByVolumeButton.removeClass("on"),this.resize()},t.prototype.sortByVolume=function(){this.treeSortType=Manifold.TreeSortType.NONE,this.treeView.treeData=this.getTreeData(),this.treeView.databind(),this.selectCurrentTreeNode(),this.$sortByDateButton.removeClass("on"),this.$sortByVolumeButton.addClass("on"),this.resize()},t.prototype.isCollection=function(){var e=this.getTree();return e.data.type===manifesto.TreeNodeType.collection().toString()},t.prototype.databindTreeView=function(){this.treeView&&(this.treeView.treeData=this.getTreeData(),this.treeView.databind(),this.selectCurrentTreeNode())},t.prototype.getTreeData=function(){return{branchNodesSelectable:!1,helper:this.extension.helper,topRangeIndex:this.getSelectedTopRangeIndex(),treeSortType:this.treeSortType}},t.prototype.updateTreeTabByCanvasIndex=function(){var e=this.extension.helper.getTopRanges();if(e.length>1){var t=this.getCurrentCanvasTopRangeIndex(),i=e[t];this.setTreeTabTitle(Manifesto.TranslationCollection.getValue(i.getLabel()))}else this.setTreeTabTitle(this.content.index)},t.prototype.setTreeTabTitle=function(e){this.$treeButton.text(e),this.$treeButton.prop("title",e)},t.prototype.updateTreeTabBySelection=function(){var e,t=this.extension.helper.getTopRanges();t.length>1&&(e=this.treeView?this.getSelectedTree().text():Manifesto.TranslationCollection.getValue(t[0].getLabel())),e?this.setTreeTabTitle(e):this.setTreeTabTitle(this.content.index)},t.prototype.getViewingDirection=function(){return this.extension.helper.getViewingDirection()},t.prototype.createThumbsView=function(){this.thumbsView=new l(this.$thumbsView),this.databindThumbsView()},t.prototype.databindThumbsView=function(){if(this.thumbsView){var e,t,i=this.getViewingDirection().toString();i===manifesto.ViewingDirection.topToBottom().toString()||i===manifesto.ViewingDirection.bottomToTop().toString()?(e=this.config.options.oneColThumbWidth,t=this.config.options.oneColThumbHeight):(e=this.config.options.twoColThumbWidth,t=this.config.options.twoColThumbHeight);var n=this.extension.helper.getThumbs(e,t);i===manifesto.ViewingDirection.bottomToTop().toString()&&n.reverse();var o=this.extension.searchResults;if(o&&o.length)for(var s=0;s<o.length;s++){var r=o[s],a=n.en().where(function(e){return e.index===r.canvasIndex}).first(),l=$.extend(!0,{},a.data);l.searchResults=r.rects.length,a.data=l}this.thumbsView.thumbs=n,this.thumbsView.databind()}},t.prototype.createGalleryView=function(){this.galleryView=new o(this.$galleryView),this.galleryView.galleryData=this.getGalleryData(),this.galleryView.setup(),this.databindGalleryView()},t.prototype.databindGalleryView=function(){this.galleryView&&(this.galleryView.galleryData=this.getGalleryData(),this.galleryView.databind())},t.prototype.getGalleryData=function(){return{helper:this.extension.helper,chunkedResizingThreshold:this.config.options.galleryThumbChunkedResizingThreshold,content:this.config.content,debug:!1,imageFadeInDuration:300,initialZoom:6,minLabelWidth:20,pageModeEnabled:this.isPageModeEnabled(),scrollStopDuration:100,searchResults:this.extension.searchResults,sizingEnabled:Modernizr.inputtypes.range,thumbHeight:this.config.options.galleryThumbHeight,thumbLoadPadding:this.config.options.galleryThumbLoadPadding,thumbWidth:this.config.options.galleryThumbWidth,viewingDirection:this.getViewingDirection()}},t.prototype.isPageModeEnabled=function(){return"function"==typeof this.extension.getMode?Utils.Bools.getBool(this.config.options.pageModeEnabled,!0)&&this.extension.getMode().toString()===a.page.toString():Utils.Bools.getBool(this.config.options.pageModeEnabled,!0)},t.prototype.getSelectedTree=function(){return this.$treeSelect.find(":selected")},t.prototype.getSelectedTopRangeIndex=function(){var e=this.getSelectedTree().index();return-1===e&&(e=0),e},t.prototype.getTree=function(){var e=this.getSelectedTopRangeIndex();return this.extension.helper.getTree(e,Manifold.TreeSortType.NONE)},t.prototype.toggleFinish=function(){if(e.prototype.toggleFinish.call(this),this.isUnopened){var t=Utils.Bools.getBool(this.config.options.treeEnabled,!0),i=Utils.Bools.getBool(this.config.options.thumbsEnabled,!0),n=this.getTree();n&&n.nodes.length||(t=!1),t&&i||this.$tabs.hide(),i&&this.defaultToThumbsView()?this.openThumbsView():t&&this.openTreeView()}},t.prototype.defaultToThumbsView=function(){var e=Utils.Bools.getBool(this.config.options.defaultToTreeEnabled,!1),t=this.config.options.defaultToTreeIfGreaterThan||0,i=this.getTree();return e&&i.nodes.length>t?!1:!0},t.prototype.expandFullStart=function(){e.prototype.expandFullStart.call(this),$.publish(i.LEFTPANEL_EXPAND_FULL_START)},t.prototype.expandFullFinish=function(){e.prototype.expandFullFinish.call(this),this.$treeButton.hasClass("on")?this.openTreeView():this.$thumbsButton.hasClass("on")&&this.openThumbsView(),$.publish(i.LEFTPANEL_EXPAND_FULL_FINISH)},t.prototype.collapseFullStart=function(){e.prototype.collapseFullStart.call(this),$.publish(i.LEFTPANEL_COLLAPSE_FULL_START)},t.prototype.collapseFullFinish=function(){e.prototype.collapseFullFinish.call(this),this.$thumbsButton.hasClass("on")&&this.openThumbsView(),$.publish(i.LEFTPANEL_COLLAPSE_FULL_FINISH)},t.prototype.openTreeView=function(){this.isTreeViewOpen=!0,this.isThumbsViewOpen=!1,this.treeView||this.createTreeView(),this.$treeButton.addClass("on"),this.$thumbsButton.removeClass("on"),this.treeView.show(),this.thumbsView&&this.thumbsView.hide(),this.galleryView&&this.galleryView.hide(),this.updateTreeViewOptions(),this.selectCurrentTreeNode(),this.resize(),this.treeView.resize()},t.prototype.openThumbsView=function(){this.isTreeViewOpen=!1,this.isThumbsViewOpen=!0,this.thumbsView||this.createThumbsView(),this.isFullyExpanded&&!this.galleryView&&this.createGalleryView(),this.$treeButton.removeClass("on"),this.$thumbsButton.addClass("on"),this.treeView&&this.treeView.hide(),this.$treeSelect.hide(),this.$treeViewOptions.hide(),this.resize(),this.isFullyExpanded?(this.thumbsView.hide(),this.galleryView&&this.galleryView.show(),this.galleryView&&this.galleryView.resize()):(this.galleryView&&this.galleryView.hide(),this.thumbsView.show(),this.thumbsView.resize())},t.prototype.selectTopRangeIndex=function(e){this.$treeSelect.prop("selectedIndex",e)},t.prototype.getCurrentCanvasTopRangeIndex=function(){var e=-1,t=this.extension.getCurrentCanvasRange();return t&&(e=Number(t.path.split("/")[0])),e},t.prototype.selectCurrentTreeNode=function(){if(this.treeView){var e,t=this.getCurrentCanvasTopRangeIndex(),i=this.getSelectedTopRangeIndex(),n=t===i;if(-1!=t){var o=this.extension.getCurrentCanvasRange();o&&o.treeNode&&(e=this.treeView.getNodeById(o.treeNode.id))}e&&n?this.treeView.selectNode(e):this.treeView.deselectCurrentNode()}},t.prototype.resize=function(){e.prototype.resize.call(this),this.$tabsContent.height(this.$main.height()-(this.$tabs.is(":visible")?this.$tabs.height():0)-this.$tabsContent.verticalPadding()),this.$views.height(this.$tabsContent.height()-this.$options.outerHeight())},t}(s);return c}),define("modules/uv-shared-module/Point",["require","exports"],function(e,t){"use strict";var i=function(){function e(e,t){this.x=e,this.y=t}return e}();return i}),define("extensions/uv-seadragon-extension/CroppedImageDimensions",["require","exports","../../modules/uv-shared-module/Point"],function(e,t,i){"use strict";var n=Utils.Measurements.Size,o=function(){function e(){this.region=new n(0,0),this.regionPos=new i(0,0),this.size=new n(0,0)}return e}();return o}),define("extensions/uv-seadragon-extension/DownloadType",["require","exports"],function(e,t){"use strict";var i=function(){function e(){}return e}();return i.CURRENTVIEW="currentView",i.ENTIREDOCUMENTASPDF="entireDocumentAsPdf",i.ENTIREDOCUMENTASTEXT="entireDocumentAsText",i.WHOLEIMAGEHIGHRES="wholeImageHighRes",i.WHOLEIMAGESHIGHRES="wholeImageHighRes",i.WHOLEIMAGELOWRES="wholeImageLowRes",i.UNKNOWN="unknown",i});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("extensions/uv-seadragon-extension/DownloadDialogue",["require","exports","../../modules/uv-shared-module/BaseCommands","../../modules/uv-dialogues-module/DownloadDialogue","./Commands","../../modules/uv-shared-module/DownloadOption","./DownloadType"],function(e,t,i,n,o,s,r){"use strict";var a=Utils.Measurements.Size,l=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("downloadDialogue"),e.prototype.create.call(this),this.$imageOptionsContainer=$('<li class="group image"></li>'),this.$downloadOptions.append(this.$imageOptionsContainer),this.$imageOptions=$("<ul></ul>"),this.$imageOptionsContainer.append(this.$imageOptions),this.$currentViewAsJpgButton=$('<li class="option single"><input id="'+s.currentViewAsJpg.toString()+'" type="radio" name="downloadOptions" tabindex="0" /><label for="'+s.currentViewAsJpg.toString()+'"></label></li>'),this.$imageOptions.append(this.$currentViewAsJpgButton),this.$currentViewAsJpgButton.hide(),this.$wholeImageHighResButton=$('<li class="option single"><input id="'+s.wholeImageHighRes.toString()+'" type="radio" name="downloadOptions" tabindex="0" /><label id="'+s.wholeImageHighRes.toString()+'label" for="'+s.wholeImageHighRes.toString()+'"></label></li>'),this.$imageOptions.append(this.$wholeImageHighResButton),this.$wholeImageHighResButton.hide(),this.$wholeImagesHighResButton=$('<li class="option multiple"><input id="'+s.wholeImagesHighRes.toString()+'" type="radio" name="downloadOptions" tabindex="0" /><label id="'+s.wholeImagesHighRes.toString()+'label" for="'+s.wholeImagesHighRes.toString()+'"></label></li>'),this.$imageOptions.append(this.$wholeImagesHighResButton),this.$wholeImageHighResButton.hide(),this.$wholeImageLowResAsJpgButton=$('<li class="option single"><input id="'+s.wholeImageLowResAsJpg.toString()+'" type="radio" name="downloadOptions" tabindex="0" /><label for="'+s.wholeImageLowResAsJpg.toString()+'">'+this.content.wholeImageLowResAsJpg+"</label></li>"),this.$imageOptions.append(this.$wholeImageLowResAsJpgButton),this.$wholeImageLowResAsJpgButton.hide(),this.$canvasOptionsContainer=$('<li class="group canvas"></li>'),this.$downloadOptions.append(this.$canvasOptionsContainer),this.$canvasOptions=$("<ul></ul>"),this.$canvasOptionsContainer.append(this.$canvasOptions),this.$sequenceOptionsContainer=$('<li class="group sequence"></li>'),this.$downloadOptions.append(this.$sequenceOptionsContainer),this.$sequenceOptions=$("<ul></ul>"),this.$sequenceOptionsContainer.append(this.$sequenceOptions),this.$selectionButton=$('<li class="option"><input id="'+s.selection.toString()+'" type="radio" name="downloadOptions" tabindex="0" /><label id="'+s.selection.toString()+'label" for="'+s.selection.toString()+'"></label></li>'),
this.$sequenceOptions.append(this.$selectionButton),this.$selectionButton.hide(),this.$buttonsContainer=$('<div class="buttons"></div>'),this.$content.append(this.$buttonsContainer),this.$downloadButton=$('<a class="btn btn-primary" href="#" tabindex="0">'+this.content.download+"</a>"),this.$buttonsContainer.append(this.$downloadButton),this.$explanatoryTextTemplate=$('<span class="explanatory"></span>');var n=this;this.$downloadButton.on("click",function(e){e.preventDefault();var a=n.getSelectedOption(),l=a.attr("id"),h=a.attr("title"),c=a.data("mime"),u=r.UNKNOWN,p=t.extension.helper.getCurrentCanvas();if(t.renderingUrls[l])c&&(-1!==c.toLowerCase().indexOf("pdf")?u=r.ENTIREDOCUMENTASPDF:-1!==c.toLowerCase().indexOf("txt")&&(u=r.ENTIREDOCUMENTASTEXT)),(u=r.ENTIREDOCUMENTASPDF)&&window.open(t.renderingUrls[l]);else switch(l){case s.currentViewAsJpg.toString():var d=n.extension.getViewer();window.open(n.extension.getCroppedImageUri(p,d)),u=r.CURRENTVIEW;break;case s.selection.toString():Utils.Async.waitFor(function(){return!t.isActive},function(){$.publish(o.SHOW_MULTISELECT_DIALOGUE)});break;case s.wholeImageHighRes.toString():window.open(t.getCanvasHighResImageUri(t.extension.helper.getCurrentCanvas())),u=r.WHOLEIMAGEHIGHRES;break;case s.wholeImagesHighRes.toString():for(var g=t.extension.getPagedIndices(),f=0;f<g.length;f++)window.open(t.getCanvasHighResImageUri(t.extension.helper.getCanvasByIndex(g[f])));u=r.WHOLEIMAGESHIGHRES;break;case s.wholeImageLowResAsJpg.toString():window.open(n.extension.getConfinedImageUri(p,n.options.confinedImageSize)),u=r.WHOLEIMAGELOWRES}$.publish(i.DOWNLOAD,[{type:u,label:h}]),t.close()})},t.prototype.open=function(t){e.prototype.open.call(this,t);var i=this.extension.helper.getCurrentCanvas(),n=this.extension.getViewerRotation(),o=n%180==0;if(this.isDownloadOptionAvailable(s.currentViewAsJpg)){var r=this.$currentViewAsJpgButton.find("input"),a=this.$currentViewAsJpgButton.find("label"),l=this.content.currentViewAsJpg,h=this.extension.getViewer(),c=this.extension.getCroppedImageDimensions(i,h);if(c?(l=o?String.format(l,c.size.width,c.size.height):String.format(l,c.size.height,c.size.width),a.text(l),r.prop("title",l),this.$currentViewAsJpgButton.data("width",c.size.width),this.$currentViewAsJpgButton.data("height",c.size.height),this.$currentViewAsJpgButton.show()):this.$currentViewAsJpgButton.hide(),Utils.Bools.getBool(this.options.optionsExplanatoryTextEnabled,!1)){var u=this.content.currentViewAsJpgExplanation;if(u){var p=this.$explanatoryTextTemplate.clone();p.text(u),a.append(p)}}}else this.$currentViewAsJpgButton.hide();if(this.isDownloadOptionAvailable(s.wholeImageHighRes)){var r=this.$wholeImageHighResButton.find("input"),a=this.$wholeImageHighResButton.find("label"),d=this.getCanvasMimeType(this.extension.helper.getCurrentCanvas());d=d?Utils.Files.simplifyMimeType(d):"?";var g=this.getCanvasComputedDimensions(this.extension.helper.getCurrentCanvas());if(g){var l=o?String.format(this.content.wholeImageHighRes,g.width,g.height,d):String.format(this.content.wholeImageHighRes,g.height,g.width,d);a.text(l),r.prop("title",l),this.$wholeImageHighResButton.data("width",g.width),this.$wholeImageHighResButton.data("height",g.height),this.$wholeImageHighResButton.show()}else this.$wholeImageHighResButton.hide();if(Utils.Bools.getBool(this.options.optionsExplanatoryTextEnabled,!1)){var u=this.content.wholeImageHighResExplanation;if(u){var p=this.$explanatoryTextTemplate.clone();p.text(u),a.append(p)}}}else this.$wholeImageHighResButton.hide();if(this.isDownloadOptionAvailable(s.wholeImagesHighRes)){var r=this.$wholeImagesHighResButton.find("input"),a=this.$wholeImagesHighResButton.find("label"),d=this.getCanvasMimeType(this.extension.helper.getCurrentCanvas());d=d?Utils.Files.simplifyMimeType(d):"?";var l=String.format(this.content.wholeImagesHighRes,d);if(a.text(l),r.prop("title",l),this.$wholeImagesHighResButton.show(),Utils.Bools.getBool(this.options.optionsExplanatoryTextEnabled,!1)){var u=this.content.wholeImagesHighResExplanation;if(u){var p=this.$explanatoryTextTemplate.clone();p.text(u),a.append(p)}}}else this.$wholeImagesHighResButton.hide();if(this.isDownloadOptionAvailable(s.wholeImageLowResAsJpg)){var r=this.$wholeImageLowResAsJpgButton.find("input"),a=this.$wholeImageLowResAsJpgButton.find("label"),g=this.extension.getConfinedImageDimensions(i,this.options.confinedImageSize),l=o?String.format(this.content.wholeImageLowResAsJpg,g.width,g.height):String.format(this.content.wholeImageLowResAsJpg,g.height,g.width);if(a.text(l),r.prop("title",l),this.$wholeImageLowResAsJpgButton.data("width",g.width),this.$wholeImageLowResAsJpgButton.data("height",g.height),this.$wholeImageLowResAsJpgButton.show(),Utils.Bools.getBool(this.options.optionsExplanatoryTextEnabled,!1)){var u=this.content.wholeImageLowResAsJpgExplanation;if(u){var p=this.$explanatoryTextTemplate.clone();p.text(u),a.append(p)}}}else this.$wholeImageLowResAsJpgButton.hide();if(this.isDownloadOptionAvailable(s.selection)){var r=this.$selectionButton.find("input"),a=this.$selectionButton.find("label");if(a.text(this.content.downloadSelection),r.prop("title",this.content.downloadSelection),this.$selectionButton.show(),Utils.Bools.getBool(this.options.optionsExplanatoryTextEnabled,!1)){var u=this.content.selectionExplanation;if(u){var p=this.$explanatoryTextTemplate.clone();p.text(u),a.append(p)}}}else this.$selectionButton.hide();if(this.resetDynamicDownloadOptions(),this.isDownloadOptionAvailable(s.dynamicImageRenderings))for(var f=i.getImages(),m=0;m<f.length;m++)this.addDownloadOptionsForRenderings(f[m].getResource(),this.content.entireFileAsOriginal,s.dynamicImageRenderings);if(this.isDownloadOptionAvailable(s.dynamicCanvasRenderings)&&this.addDownloadOptionsForRenderings(i,this.content.entireFileAsOriginal,s.dynamicCanvasRenderings),this.isDownloadOptionAvailable(s.dynamicSequenceRenderings)&&this.addDownloadOptionsForRenderings(this.extension.helper.getCurrentSequence(),this.content.entireDocument,s.dynamicSequenceRenderings),this.isDownloadOptionAvailable(s.currentViewAsJpg)){var v=parseInt(this.$currentViewAsJpgButton.data("width").toString()),b=parseInt(this.$currentViewAsJpgButton.data("height").toString()),E=parseInt(this.$wholeImageHighResButton.data("width").toString()),_=parseInt(this.$wholeImageHighResButton.data("height").toString()),y=v/E*100,x=b/_*100,w=this.options.currentViewDisabledPercentage;y>=w&&x>=w?this.$currentViewAsJpgButton.hide():this.$currentViewAsJpgButton.show()}var S=this.$imageOptions.find("li.single");S=S.sort(function(e,t){var i=$(e).data("width");i?i=parseInt(i.toString()):0;var n=$(e).data("height");n?n=parseInt(n.toString()):0;var o=$(t).data("width");o?o=parseInt(o.toString()):0;var s=$(t).data("height");s?s=parseInt(s.toString()):0;var r=i*n,a=o*s;return a>r?-1:r>a?1:0}),S.detach().appendTo(this.$imageOptions);var C=this.$downloadOptions.find("li.group");C.each(function(e,t){var i=$(t);i.show(),i.find("li.option:hidden").length===i.find("li.option").length&&i.hide()}),this.$downloadOptions.find("li.group:visible").last().addClass("lastVisible"),this.$downloadOptions.find("li.option:visible").length?(this.$downloadOptions.find("li.option input:visible:first").prop("checked",!0),this.$noneAvailable.hide(),this.$downloadButton.show()):(this.$noneAvailable.show(),this.$downloadButton.hide()),this.resize()},t.prototype.resetDynamicDownloadOptions=function(){this.renderingUrls=[],this.renderingUrlsCount=0,this.$downloadOptions.find("li.dynamic").remove()},t.prototype.addDownloadOptionsForRenderings=function(e,t,i){for(var n=e.getRenderings(),o=0;o<n.length;o++){var r=n[o];if(r){var a=Manifesto.TranslationCollection.getValue(r.getLabel()),l="downloadOption"+ ++this.renderingUrlsCount;a?a+=" ({0})":a=t;var h=Utils.Files.simplifyMimeType(r.getFormat().toString());a=String.format(a,h),this.renderingUrls[l]=r.id;var c=$('<li class="option dynamic"><input id="'+l+'" data-mime="'+h+'" title="'+a+'" type="radio" name="downloadOptions" tabindex="0" /><label for="'+l+'">'+a+"</label></li>");switch(i){case s.dynamicImageRenderings:this.$imageOptions.append(c);break;case s.dynamicCanvasRenderings:this.$canvasOptions.append(c);break;case s.dynamicSequenceRenderings:this.$sequenceOptions.append(c)}}}},t.prototype.getSelectedOption=function(){return this.$downloadOptions.find("li.option input:checked")},t.prototype.getCanvasImageResource=function(e){var t=e.getImages();return t[0]?t[0].getResource():null},t.prototype.getCanvasHighResImageUri=function(e){var t=this.getCanvasComputedDimensions(e);if(t){var i=t.width,n=e.getCanonicalImageUri(i),o=n.split("/"),s=this.extension.getViewerRotation();return o[o.length-2]=String(s),n=o.join("/")}return""},t.prototype.getCanvasMimeType=function(e){var t=this.getCanvasImageResource(e),i=t.getFormat();return i?i.toString():null},t.prototype.getCanvasDimensions=function(e){return e.externalResource.data?new a(e.externalResource.data.width,e.externalResource.data.height):new a(0,0)},t.prototype.getCanvasMaxDimensions=function(e){return e.externalResource.data&&e.externalResource.data.profile[1]?new a(e.externalResource.data.profile[1].maxWidth,e.externalResource.data.profile[1].maxHeight):null},t.prototype.getCanvasComputedDimensions=function(e){var t=this.getCanvasDimensions(e),i=this.getCanvasMaxDimensions(e);if(!i)return null;var n=t.width,o=t.height;if(!_.isUndefined(i.width)&&i.width<t.width)if(n=i.width,_.isUndefined(i.height)){var s=Math.normalise(i.width,0,t.width);o=Math.floor(t.height*s)}else o=i.height;return new a(n,o)},t.prototype.isDownloadOptionAvailable=function(t){switch(t){case s.currentViewAsJpg:case s.dynamicCanvasRenderings:case s.dynamicImageRenderings:case s.wholeImageHighRes:if(!this.extension.isPagingSettingEnabled()||this.extension.isPagingSettingEnabled()&&this.extension.resources&&1===this.extension.resources.length){var i=this.getCanvasMaxDimensions(this.extension.helper.getCurrentCanvas());if(i){if(_.isUndefined(i.width))return!0;if(i.width<=this.options.maxImageWidth)return!0}}return!1;case s.wholeImagesHighRes:return this.extension.isPagingSettingEnabled()&&this.extension.resources&&this.extension.resources.length>1?!0:!1;case s.wholeImageLowResAsJpg:var n=this.getCanvasComputedDimensions(this.extension.helper.getCurrentCanvas());return n?!this.extension.isPagingSettingEnabled()&&n.width>this.options.confinedImageSize:!1;case s.selection:return this.options.selectionEnabled;default:return e.prototype.isDownloadOptionAvailable.call(this,t)}},t}(n);return l});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-dialogues-module/ExternalContentDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue"],function(e,t,i,n){"use strict";var o=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("externalContentDialogue"),e.prototype.create.call(this),this.openCommand=i.SHOW_EXTERNALCONTENT_DIALOGUE,this.closeCommand=i.HIDE_EXTERNALCONTENT_DIALOGUE,$.subscribe(this.openCommand,function(e,i){t.open(),t.$iframe.prop("src",i.uri)}),$.subscribe(this.closeCommand,function(e){t.close()}),this.$iframe=$("<iframe></iframe>"),this.$content.append(this.$iframe),this.$element.hide()},t.prototype.resize=function(){e.prototype.resize.call(this),this.$iframe.width(this.$content.width()),this.$iframe.height(this.$content.height())},t}(n);return o}),define("modules/uv-shared-module/AutoComplete",["require","exports"],function(e,t){"use strict";var i=function(){function e(e,t,i,n,o,s,r){void 0===o&&(o=300),void 0===s&&(s=2),void 0===r&&(r=!1);var a=this;this._validKeyDownCodes=[KeyCodes.KeyDown.Backspace,KeyCodes.KeyDown.Spacebar,KeyCodes.KeyDown.Tab,KeyCodes.KeyDown.LeftArrow,KeyCodes.KeyDown.RightArrow,KeyCodes.KeyDown.Delete],this._validKeyPressCodes=[KeyCodes.KeyPress.GraveAccent,KeyCodes.KeyPress.DoubleQuote],this._lastKeyDownWasValid=!1,this._$element=e,this._autoCompleteFunc=t,this._delay=o,this._minChars=s,this._onSelect=n,this._parseResultsFunc=i,this._positionAbove=r,this._$searchResultsList=$('<ul class="autocomplete"></ul>'),this._positionAbove?this._$element.parent().prepend(this._$searchResultsList):this._$element.parent().append(this._$searchResultsList),this._$searchResultTemplate=$('<li class="result"><a href="#" tabindex="-1"></a></li>');var l=function(){var e=0;return function(t,i){clearTimeout(e),e=setTimeout(t,i)}}(),h=this;this._$element.on("keydown",function(e){var t=e.originalEvent;h._lastKeyDownWasValid=h._isValidKeyDown(t);var i=Utils.Keyboard.getCharCode(t),n=!1;i===KeyCodes.KeyDown.LeftArrow?n=!0:i===KeyCodes.KeyDown.RightArrow&&(n=!0),n&&(t.cancelBubble=!0,t.stopPropagation&&t.stopPropagation())}),this._$element.on("keypress",function(e){var t=h._isValidKeyPress(e.originalEvent);return h._lastKeyDownWasValid||t?!0:(e.preventDefault(),!1)}),this._$element.on("keyup",function(e){if(!h._getSelectedListItem().length&&e.keyCode===KeyCodes.KeyDown.Enter)return void h._onSelect(h._getTerms());if(h._$searchResultsList.is(":visible")&&h._results.length)if(e.keyCode===KeyCodes.KeyDown.Enter)h._searchForItem(h._getSelectedListItem());else{if(e.keyCode===KeyCodes.KeyDown.DownArrow)return void h._setSelectedResultIndex(1);if(e.keyCode===KeyCodes.KeyDown.UpArrow)return void h._setSelectedResultIndex(-1)}e.keyCode!==KeyCodes.KeyDown.Enter&&l(function(){var e=h._getTerms();e&&e.length>h._minChars&&!e.contains(" ")?h._search(e):(h._clearResults(),h._hideResults())},h._delay)}),$(document).on("mouseup",function(e){0===a._$searchResultsList.parent().has($(e.target)[0]).length&&(a._clearResults(),a._hideResults())}),this._hideResults()}return e.prototype._isValidKeyDown=function(e){var t=this._validKeyDownCodes.contains(Utils.Keyboard.getCharCode(e));return t},e.prototype._isValidKeyPress=function(e){var t=Utils.Keyboard.getCharCode(e),i=String.fromCharCode(t),n=i.isAlphanumeric()||this._validKeyPressCodes.contains(t);return n},e.prototype._getTerms=function(){return this._$element.val().trim()},e.prototype._setSelectedResultIndex=function(e){var t;t=1===e?this._selectedResultIndex+1:this._selectedResultIndex-1;var i=this._$searchResultsList.find("li");0>t?t=i.length-1:t>i.length-1&&(t=0),this._selectedResultIndex=t,i.removeClass("selected");var n=i.eq(this._selectedResultIndex);n.addClass("selected");var o=n.outerHeight(!0)*this._selectedResultIndex;this._$searchResultsList.scrollTop(o)},e.prototype._search=function(e){this._results=[],this._clearResults(),this._showResults(),this._$searchResultsList.append('<li class="loading"></li>'),this._updateListPosition();var t=this;this._autoCompleteFunc(e,function(e){t._listResults(e)})},e.prototype._clearResults=function(){this._$searchResultsList.empty()},e.prototype._hideResults=function(){this._$searchResultsList.hide()},e.prototype._showResults=function(){this._selectedResultIndex=-1,this._$searchResultsList.show()},e.prototype._updateListPosition=function(){this._positionAbove?this._$searchResultsList.css({top:-1*this._$searchResultsList.outerHeight(!0)}):this._$searchResultsList.css({top:this._$element.outerHeight(!0)})},e.prototype._listResults=function(e){if(this._results=this._parseResultsFunc(e),this._clearResults(),!this._results.length)return void this._hideResults();for(var t=0;t<this._results.length;t++){var i=this._results[t],n=this._$searchResultTemplate.clone(),o=n.find("a");o.text(i),this._$searchResultsList.append(n)}this._updateListPosition();var s=this;this._$searchResultsList.find("li").on("click",function(e){e.preventDefault(),s._searchForItem($(this))})},e.prototype._searchForItem=function(e){var t=e.find("a").text();this._$element.val(t),this._hideResults(),this._onSelect(t),this._clearResults(),this._hideResults()},e.prototype._getSelectedListItem=function(){return this._$searchResultsList.find("li.selected")},e}();return i});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-searchfooterpanel-module/FooterPanel",["require","exports","../uv-shared-module/AutoComplete","../uv-shared-module/BaseCommands","../uv-shared-module/FooterPanel","../../extensions/uv-seadragon-extension/Commands","../../extensions/uv-seadragon-extension/Mode"],function(e,t,i,n,o,s,r){"use strict";var a=function(e){function t(t){var i=e.call(this,t)||this;return i.placemarkerTouched=!1,i}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("searchFooterPanel"),e.prototype.create.call(this),$.subscribe(n.CANVAS_INDEX_CHANGED,function(e,i){t.canvasIndexChanged(),t.setCurrentSearchResultPlacemarker(),t.updatePrevButton(),t.updateNextButton()}),$.subscribe(s.MODE_CHANGED,function(e,i){t.settingsChanged()}),$.subscribe(s.SEARCH,function(e,i){t.terms=i}),$.subscribe(s.SEARCH_RESULTS,function(e,i){t.displaySearchResults(i.terms,i.results),t.setCurrentSearchResultPlacemarker()}),$.subscribe(s.SEARCH_RESULTS_EMPTY,function(){t.hideSearchSpinner()}),$.subscribe(s.SEARCH_RESULT_RECT_CHANGED,function(){t.updatePrevButton(),t.updateNextButton()}),this.$printButton=$('<a class="print" title="'+this.content.print+'" tabindex="0">'+this.content.print+"</a>"),this.$options.prepend(this.$printButton),this.$searchContainer=$('<div class="search"></div>'),this.$element.prepend(this.$searchContainer),this.$searchOptions=$('<div class="searchOptions"></div>'),this.$searchContainer.append(this.$searchOptions),this.$searchLabel=$('<span class="label">'+this.content.searchWithin+"</span>"),this.$searchOptions.append(this.$searchLabel),this.$searchTextContainer=$('<div class="searchTextContainer"></div>'),this.$searchOptions.append(this.$searchTextContainer),this.$searchText=$('<input class="searchText" type="text" maxlength="100" value="'+this.content.enterKeyword+'" />'),this.$searchTextContainer.append(this.$searchText),this.$searchButton=$('<a class="imageButton searchButton" tabindex="0"></a>'),this.$searchTextContainer.append(this.$searchButton),this.$searchPagerContainer=$('<div class="searchPager"></div>'),this.$element.prepend(this.$searchPagerContainer),this.$searchPagerControls=$('<div class="controls"></div>'),this.$searchPagerContainer.prepend(this.$searchPagerControls),this.$previousResultButton=$('<a class="previousResult" title="'+this.content.previousResult+'">'+this.content.previousResult+"</a>"),this.$searchPagerControls.append(this.$previousResultButton),this.$searchResultsInfo=$('<div class="searchResultsInfo"><span class="number">x</span> <span class="foundFor"></span> \'<span class="terms">y</span>\'</div>'),this.$searchPagerControls.append(this.$searchResultsInfo),this.$clearSearchResultsButton=$('<a class="clearSearch" title="'+this.content.clearSearch+'">'+this.content.clearSearch+"</a>"),this.$searchResultsInfo.append(this.$clearSearchResultsButton),this.$nextResultButton=$('<a class="nextResult" title="'+this.content.nextResult+'">'+this.content.nextResult+"</a>"),this.$searchPagerControls.append(this.$nextResultButton),this.$searchResultsContainer=$('<div class="searchResults"></div>'),this.$element.prepend(this.$searchResultsContainer),this.$line=$('<div class="line"></div>'),this.$searchResultsContainer.append(this.$line),this.$pagePositionMarker=$('<div class="positionPlacemarker"></div>'),this.$searchResultsContainer.append(this.$pagePositionMarker),this.$pagePositionLabel=$('<div class="label"></div>'),this.$searchResultsContainer.append(this.$pagePositionLabel),this.$placemarkerDetails=$('<div class="placeMarkerDetails"></div>'),this.$searchResultsContainer.append(this.$placemarkerDetails),this.$placemarkerDetailsTop=$("<h1></h1>"),this.$placemarkerDetails.append(this.$placemarkerDetailsTop),this.$placemarkerDetailsBottom=$("<p></p>"),this.$placemarkerDetails.append(this.$placemarkerDetailsBottom),this.$searchPagerContainer.hide(),this.$placemarkerDetails.hide();var o=this;this.$searchButton.on("click",function(e){e.preventDefault(),t.search(t.$searchText.val())}),this.$searchText.on("focus",function(){t.$searchText.val()===t.content.enterKeyword&&t.$searchText.val("")}),this.$placemarkerDetails.on("mouseover",function(){$.publish(s.SEARCH_PREVIEW_START,[t.currentPlacemarkerIndex])}),this.$placemarkerDetails.on("mouseleave",function(){$(this).hide(),$.publish(s.SEARCH_PREVIEW_FINISH);var e=o.getSearchResultPlacemarkers();e.removeClass("hover")}),this.$placemarkerDetails.on("click",function(e){$.publish(s.VIEW_PAGE,[t.currentPlacemarkerIndex])}),this.$previousResultButton.on("click",function(e){e.preventDefault(),$.publish(s.PREV_SEARCH_RESULT)}),this.$nextResultButton.on("click",function(e){e.preventDefault(),$.publish(s.NEXT_SEARCH_RESULT)}),this.$clearSearchResultsButton.on("click",function(e){e.preventDefault(),$.publish(s.CLEAR_SEARCH),t.clearSearchResults()}),this.extension.isSearchWithinEnabled()||(this.$searchContainer.hide(),this.$searchPagerContainer.hide(),this.$searchResultsContainer.hide(),this.$element.addClass("min")),1===this.extension.helper.getTotalCanvases()&&this.$searchResultsContainer.hide();var r=this.extension.getAutoCompleteUri();r?new i(this.$searchText,function(e,t){$.getJSON(String.format(r,e),function(e){t(e)})},function(e){return $.map(e.terms,function(e){return e.match})},function(e){t.search(e)},300,2,!0):this.$searchText.on("keyup",function(e){e.keyCode===KeyCodes.KeyDown.Enter&&o.search(o.$searchText.val())}),this.$printButton.onPressed(function(){$.publish(s.PRINT)}),this.updatePrintButton();var a=Utils.Bools.getBool(this.config.options.positionMarkerEnabled,!0);a||(this.$pagePositionMarker.hide(),this.$pagePositionLabel.hide())},t.prototype.isZoomToSearchResultEnabled=function(){return Utils.Bools.getBool(this.extension.config.options.zoomToSearchResultEnabled,!0)},t.prototype.isPreviousButtonEnabled=function(){var e=this.extension.helper.canvasIndex,t=this.getFirstSearchResultCanvasIndex(),i=this.getCurrentSearchResultRectIndex();return this.isZoomToSearchResultEnabled()&&this.extension.currentSearchResultRect?t>e?!1:e===t&&0===i?!1:!0:e>t},t.prototype.isCanvasIndexLessThanFirstSearchResultIndex=function(){var e=this.extension.searchResults;return this.extension.helper.canvasIndex<=e[0].canvasIndex},t.prototype.isNextButtonEnabled=function(){var e=this.extension.helper.canvasIndex,t=this.getLastSearchResultCanvasIndex(),i=this.getCurrentSearchResultRectIndex();return this.isZoomToSearchResultEnabled()&&this.extension.currentSearchResultRect?e>t?!1:e===t&&i===this.getLastSearchResultRectIndex()?!1:!0:t>e},t.prototype.getSearchResults=function(){return this.extension.searchResults},t.prototype.getCurrentSearchResultRectIndex=function(){return this.extension.getCurrentSearchResultRectIndex()},t.prototype.getFirstSearchResultCanvasIndex=function(){var e=this.getSearchResults(),t=e[0].canvasIndex;return t},t.prototype.getLastSearchResultCanvasIndex=function(){var e=this.getSearchResults(),t=e[e.length-1].canvasIndex;return t},t.prototype.getLastSearchResultRectIndex=function(){return this.extension.getLastSearchResultRectIndex()},t.prototype.updateNextButton=function(){var e=this.extension.searchResults;e&&e.length&&(this.isNextButtonEnabled()?this.$nextResultButton.removeClass("disabled"):this.$nextResultButton.addClass("disabled"))},t.prototype.updatePrevButton=function(){var e=this.extension.searchResults;e&&e.length&&(this.isPreviousButtonEnabled()?this.$previousResultButton.removeClass("disabled"):this.$previousResultButton.addClass("disabled"))},t.prototype.updatePrintButton=function(){var e=Utils.Bools.getBool(this.options.printEnabled,!1);e?this.$printButton.show():this.$printButton.hide()},t.prototype.search=function(e){return this.terms=e,""===this.terms||this.terms===this.content.enterKeyword?void this.extension.showMessage(this.config.modules.genericDialogue.content.emptyValue,function(){this.$searchText.focus()}):(this.$searchText.blur(),this.showSearchSpinner(),void $.publish(s.SEARCH,[this.terms]))},t.prototype.getSearchResultPlacemarkers=function(){return this.$searchResultsContainer.find(".searchResultPlacemarker")},t.prototype.setCurrentSearchResultPlacemarker=function(){var e=this.getSearchResultPlacemarkers();e.parent().find(".current").removeClass("current");var t=$('.searchResultPlacemarker[data-index="'+this.extension.helper.canvasIndex+'"]');t.addClass("current")},t.prototype.positionSearchResultPlacemarkers=function(){var e=this.extension.searchResults;if(e.length){var t=this.getSearchResultPlacemarkers();t.remove();for(var i=this.getPageLineRatio(),n=this.$line.position().top,o=this.$line.position().left,s=this,r=0;r<e.length;r++){var a=e[r],l=a.canvasIndex*i,h=$('<div class="searchResultPlacemarker" data-index="'+a.canvasIndex+'"></div>');h[0].ontouchstart=function(e){s.onPlacemarkerTouchStart.call(this,s)},h.click(function(e){s.onPlacemarkerClick.call(this,s)}),h.mouseenter(function(e){s.onPlacemarkerMouseEnter.call(this,s)}),h.mouseleave(function(e){s.onPlacemarkerMouseLeave.call(this,e,s)}),this.$searchResultsContainer.append(h);var c=n-h.height(),u=o+l-h.width()/2;h.css({top:c,left:u})}}},t.prototype.onPlacemarkerTouchStart=function(e){e.placemarkerTouched=!0;var t=$(this),i=parseInt(t.attr("data-index"));$.publish(s.VIEW_PAGE,[i])},t.prototype.onPlacemarkerClick=function(e){if(!e.placemarkerTouched){e.placemarkerTouched=!1;var t=$(this),i=parseInt(t.attr("data-index"));$.publish(s.VIEW_PAGE,[i])}},t.prototype.onPlacemarkerMouseEnter=function(e){if(!e.placemarkerTouched){var t=$(this);t.addClass("hover");var i=parseInt(t.attr("data-index"));$.publish(s.SEARCH_PREVIEW_START,[i]);var n=e.getSearchResultPlacemarkers(),o=n.index(t[0]);e.currentPlacemarkerIndex=i,e.$placemarkerDetails.show();var a="{0} {1}",l=e.extension.getMode();if(l.toString()===r.page.toString()){var h=e.extension.helper.getCanvasByIndex(i),c=Manifesto.TranslationCollection.getValue(h.getLabel());""===c&&(c=this.extension.helper.manifest.options.defaultLabel),a=String.format(a,e.content.pageCaps,c)}else a=String.format(a,e.content.imageCaps,i+1);e.$placemarkerDetailsTop.html(a);var u,p=e.extension.searchResults[o],d=Utils.Strings.ellipsis(e.terms,e.options.elideDetailsTermsCount);1===p.rects.length?(u=e.content.instanceFound,u=String.format(u,d)):(u=e.content.instancesFound,u=String.format(u,p.rects.length,d)),e.$placemarkerDetailsBottom.html(u);var g=t.position(),f=g.top-e.$placemarkerDetails.height(),m=g.left;m<e.$placemarkerDetails.width()/2?m=0-t.width()/2:m>e.$line.width()-e.$placemarkerDetails.width()/2?m=e.$line.width()-e.$placemarkerDetails.width()+t.width()/2:m-=e.$placemarkerDetails.width()/2,e.$placemarkerDetails.css({top:f,left:m})}},t.prototype.onPlacemarkerMouseLeave=function(e,t){$.publish(s.SEARCH_PREVIEW_FINISH);var i=$(this),n=e.toElement||e.relatedTarget,o=$(n).closest(t.$placemarkerDetails).length;n!=t.$placemarkerDetails.get(0)&&0===o&&(t.$placemarkerDetails.hide(),i.removeClass("hover"))},t.prototype.setPageMarkerPosition=function(){if(null!=this.extension.helper.canvasIndex){var e=this.getPageLineRatio(),t=this.$line.position().top,i=this.$line.position().left,n=this.extension.helper.canvasIndex*e,o=t,s=i+n;this.$pagePositionMarker.css({top:o,left:s});var r=this.$line.width();s+this.$pagePositionLabel.outerWidth(!0)>r?(s-=this.$pagePositionLabel.outerWidth(!0),this.$pagePositionLabel.removeClass("right"),this.$pagePositionLabel.addClass("left")):(this.$pagePositionLabel.removeClass("left"),this.$pagePositionLabel.addClass("right")),this.$pagePositionLabel.css({top:o,left:s})}},t.prototype.clearSearchResults=function(){this.extension.searchResults=[];var e=this.getSearchResultPlacemarkers();e.remove(),this.$searchText.val(this.content.enterKeyword),this.$searchContainer.show(),this.$searchPagerContainer.hide(),this.$searchText.focus()},t.prototype.getPageLineRatio=function(){var e=this.$line.width();return 1===this.extension.helper.getTotalCanvases()?0:e/(this.extension.helper.getTotalCanvases()-1)},t.prototype.canvasIndexChanged=function(){this.setPageMarkerPosition(),this.setPlacemarkerLabel()},t.prototype.settingsChanged=function(){this.setPlacemarkerLabel()},t.prototype.setPlacemarkerLabel=function(){var e=this.content.displaying,t=this.extension.helper.canvasIndex;if(this.isPageModeEnabled()){var i=this.extension.helper.getCanvasByIndex(t),n=Manifesto.TranslationCollection.getValue(i.getLabel());""===n&&(n=this.content.defaultLabel);var o=this.extension.helper.getLastCanvasLabel(!0);this.$pagePositionLabel.html(String.format(e,this.content.page,this.extension.sanitize(n),this.extension.sanitize(o)))}else this.$pagePositionLabel.html(String.format(e,this.content.image,t+1,this.extension.helper.getTotalCanvases()))},t.prototype.isPageModeEnabled=function(){return this.config.options.pageModeEnabled&&this.extension.getMode().toString()===r.page.toString()},t.prototype.showSearchSpinner=function(){this.$searchText.addClass("searching")},t.prototype.hideSearchSpinner=function(){this.$searchText.removeClass("searching")},t.prototype.displaySearchResults=function(e,t){if(t){this.hideSearchSpinner(),this.positionSearchResultPlacemarkers(),this.$searchContainer.hide(),this.$searchPagerControls.css({left:0});var i=this.$searchPagerContainer.find(".number");i.text(this.extension.getTotalSearchResultRects());var n=this.$searchResultsInfo.find(".foundFor");1===t.length?n.html(this.content.resultFoundFor):n.html(this.content.resultsFoundFor);var o=this.$searchPagerContainer.find(".terms");o.html(Utils.Strings.ellipsis(e,this.options.elideResultsTermsCount)),o.prop("title",e),this.$searchPagerContainer.show(),this.resize()}},t.prototype.resize=function(){e.prototype.resize.call(this);var t=this.extension.searchResults;t&&t.length&&this.positionSearchResultPlacemarkers(),this.setPageMarkerPosition(),this.$searchPagerContainer.width(this.$element.width());var i=this.$element.width()/2;this.$searchPagerControls.css({left:i-this.$searchPagerControls.width()/2}),this.$searchOptions.css({left:i-this.$searchOptions.outerWidth()/2})},t}(o);return a});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-osdmobilefooterpanel-module/MobileFooter",["require","exports","../uv-shared-module/FooterPanel","../../extensions/uv-seadragon-extension/Commands"],function(e,t,i,n){"use strict";var o=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){this.setConfig("mobileFooterPanel"),e.prototype.create.call(this),this.$spacer=$('<div class="spacer"></div>'),this.$options.prepend(this.$spacer),this.$rotateButton=$('<a class="rotate" title="'+this.content.rotateRight+'" tabindex="0">'+this.content.rotateRight+"</a>"),this.$options.prepend(this.$rotateButton),this.$zoomOutButton=$('<a class="zoomOut" title="'+this.content.zoomOut+'" tabindex="0">'+this.content.zoomOut+"</a>"),this.$options.prepend(this.$zoomOutButton),this.$zoomInButton=$('<a class="zoomIn" title="'+this.content.zoomIn+'" tabindex="0">'+this.content.zoomIn+"</a>"),this.$options.prepend(this.$zoomInButton),this.$zoomInButton.onPressed(function(){$.publish(n.ZOOM_IN)}),this.$zoomOutButton.onPressed(function(){$.publish(n.ZOOM_OUT)}),this.$rotateButton.onPressed(function(){$.publish(n.ROTATE)})},t.prototype.resize=function(){
e.prototype.resize.call(this),this.$options.css("left",Math.floor(this.$element.width()/2-this.$options.width()/2))},t}(i);return o});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-dialogues-module/MoreInfoDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue"],function(e,t,i,n){"use strict";var o=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("moreInfoDialogue"),e.prototype.create.call(this),this.openCommand=i.SHOW_MOREINFO_DIALOGUE,this.closeCommand=i.HIDE_MOREINFO_DIALOGUE,$.subscribe(this.openCommand,function(e,i){t.open(i)}),$.subscribe(this.closeCommand,function(e){t.close()}),this.config.content=this.extension.config.modules.moreInfoRightPanel.content,this.config.options=this.extension.config.modules.moreInfoRightPanel.options,this.$title=$("<h1>"+this.config.content.title+"</h1>"),this.$content.append(this.$title),this.$metadata=$('<div class="iiif-metadata-component"></div>'),this.$content.append(this.$metadata),this.component=new IIIFComponents.MetadataComponent({target:this.$metadata[0],data:this._getData()}),this.$element.hide()},t.prototype.open=function(t){e.prototype.open.call(this,t),this.component.set(null)},t.prototype._getData=function(){var e=this;return{canvasDisplayOrder:this.config.options.canvasDisplayOrder,canvases:this.extension.getCurrentCanvases(),canvasExclude:this.config.options.canvasExclude,canvasLabels:this.extension.getCanvasLabels(this.content.page),content:this.config.content,copiedMessageDuration:2e3,copyToClipboardEnabled:Utils.Bools.getBool(this.config.options.copyToClipboardEnabled,!1),helper:this.extension.helper,licenseFormatter:null,limit:this.config.options.textLimit||4,limitType:IIIFComponents.MetadataComponentOptions.LimitType.LINES,manifestDisplayOrder:this.config.options.manifestDisplayOrder,manifestExclude:this.config.options.manifestExclude,range:this.extension.getCurrentCanvasRange(),rtlLanguageCodes:this.config.options.rtlLanguageCodes,sanitizer:function(t){return e.extension.sanitize(t)},showAllLanguages:this.config.options.showAllLanguages}},t.prototype.close=function(){e.prototype.close.call(this)},t.prototype.resize=function(){this.setDockedPosition()},t}(n);return o});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-multiselectdialogue-module/MultiSelectDialogue",["require","exports","../../extensions/uv-seadragon-extension/Commands","../../modules/uv-shared-module/Dialogue","../../extensions/uv-seadragon-extension/Mode"],function(e,t,i,n,o){"use strict";var s=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("multiSelectDialogue"),e.prototype.create.call(this);var n=this;this.openCommand=i.SHOW_MULTISELECT_DIALOGUE,this.closeCommand=i.HIDE_MULTISELECT_DIALOGUE,$.subscribe(this.openCommand,function(e,i){t.open();var n=t.extension.helper.getMultiSelectState();n.setEnabled(!0),t.component.set(null)}),$.subscribe(this.closeCommand,function(e){t.close();var i=t.extension.helper.getMultiSelectState();i.setEnabled(!1)}),this.$title=$("<h1></h1>"),this.$content.append(this.$title),this.$title.text(this.content.title),this.$gallery=$('<div class="iiif-gallery-component"></div>'),this.$content.append(this.$gallery),this.data={helper:this.extension.helper,chunkedResizingThreshold:this.config.options.galleryThumbChunkedResizingThreshold,content:this.config.content,debug:!1,imageFadeInDuration:300,initialZoom:4,minLabelWidth:20,pageModeEnabled:this.isPageModeEnabled(),searchResults:[],scrollStopDuration:100,sizingEnabled:!0,thumbHeight:this.config.options.galleryThumbHeight,thumbLoadPadding:this.config.options.galleryThumbLoadPadding,thumbWidth:this.config.options.galleryThumbWidth,viewingDirection:this.extension.helper.getViewingDirection()},this.component=new IIIFComponents.GalleryComponent({target:this.$gallery[0],data:this.data});var o=this.$gallery.find("a.select");o.addClass("btn btn-primary"),this.component.on("multiSelectionMade",function(e){var t=e[0];$.publish(i.MULTISELECTION_MADE,[t]),n.close()}),this.$element.hide()},t.prototype.isPageModeEnabled=function(){return Utils.Bools.getBool(this.config.options.pageModeEnabled,!0)&&this.extension.getMode().toString()===o.page.toString()},t.prototype.open=function(){e.prototype.open.call(this)},t.prototype.close=function(){e.prototype.close.call(this)},t.prototype.resize=function(){e.prototype.resize.call(this);var t=this.$gallery.find(".main"),i=this.$gallery.find(".header");t.height(this.$content.height()-this.$title.outerHeight()-this.$title.verticalMargins()-i.height())},t}(n);return s}),define("extensions/uv-seadragon-extension/MultiSelectionArgs",["require","exports"],function(e,t){"use strict";var i=function(){function e(){}return e}();return i});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-pagingheaderpanel-module/PagingHeaderPanel",["require","exports","../uv-shared-module/AutoComplete","../uv-shared-module/BaseCommands","../../extensions/uv-seadragon-extension/Commands","../uv-shared-module/HeaderPanel","../../extensions/uv-seadragon-extension/Mode"],function(e,t,i,n,o,s,r){"use strict";var a=function(e){function t(t){var i=e.call(this,t)||this;return i.firstButtonEnabled=!1,i.lastButtonEnabled=!1,i.nextButtonEnabled=!1,i.prevButtonEnabled=!1,i}return __extends(t,e),t.prototype.create=function(){var t=this;if(this.setConfig("pagingHeaderPanel"),e.prototype.create.call(this),$.subscribe(n.CANVAS_INDEX_CHANGED,function(e,i){t.canvasIndexChanged(i)}),$.subscribe(n.SETTINGS_CHANGED,function(e){t.modeChanged(),t.updatePagingToggle()}),$.subscribe(n.CANVAS_INDEX_CHANGE_FAILED,function(e){t.setSearchFieldValue(t.extension.helper.canvasIndex)}),$.subscribe(n.LEFTPANEL_EXPAND_FULL_START,function(e){t.openGallery()}),$.subscribe(n.LEFTPANEL_COLLAPSE_FULL_START,function(e){t.closeGallery()}),this.$prevOptions=$('<div class="prevOptions"></div>'),this.$centerOptions.append(this.$prevOptions),this.$firstButton=$('<a class="imageBtn first" tabindex="0"></a>'),this.$prevOptions.append(this.$firstButton),this.$prevButton=$('<a class="imageBtn prev" tabindex="0"></a>'),this.$prevOptions.append(this.$prevButton),this.$modeOptions=$('<div class="mode"></div>'),this.$centerOptions.append(this.$modeOptions),this.$imageModeLabel=$('<label for="image">'+this.content.image+"</label>"),this.$modeOptions.append(this.$imageModeLabel),this.$imageModeOption=$('<input type="radio" id="image" name="mode" tabindex="0"/>'),this.$modeOptions.append(this.$imageModeOption),this.$pageModeLabel=$('<label for="page"></label>'),this.$modeOptions.append(this.$pageModeLabel),this.$pageModeOption=$('<input type="radio" id="page" name="mode" tabindex="0"/>'),this.$modeOptions.append(this.$pageModeOption),this.$search=$('<div class="search"></div>'),this.$centerOptions.append(this.$search),this.$searchText=$('<input class="searchText" maxlength="50" type="text" tabindex="0"/>'),this.$search.append(this.$searchText),Utils.Bools.getBool(this.options.autoCompleteBoxEnabled,!0))this.$searchText.hide(),this.$autoCompleteBox=$('<input class="autocompleteText" type="text" maxlength="100" />'),this.$search.append(this.$autoCompleteBox),new i(this.$autoCompleteBox,function(e,i){var n=[],o=t.extension.helper.getCanvases();if(t.isPageModeEnabled())for(var s=0;s<o.length;s++){var r=o[s],a=Manifesto.TranslationCollection.getValue(r.getLabel());a.startsWith(e)&&n.push(a)}else for(var s=0;s<o.length;s++){var r=o[s];r.index.toString().startsWith(e)&&n.push(r.index.toString())}i(n)},function(e){return e},function(e){t.search(e)},300,0);else if(Utils.Bools.getBool(this.options.imageSelectionBoxEnabled,!0)){this.$selectionBoxOptions=$('<div class="image-selectionbox-options"></div>'),this.$centerOptions.append(this.$selectionBoxOptions),this.$imageSelectionBox=$('<select class="image-selectionbox" name="image-select" tabindex="0" ></select>'),this.$selectionBoxOptions.append(this.$imageSelectionBox);for(var s=0;s<this.extension.helper.getTotalCanvases();s++){var a=this.extension.helper.getCanvasByIndex(s),l=this.extension.sanitize(Manifesto.TranslationCollection.getValue(a.getLabel()));this.$imageSelectionBox.append("<option value="+s+">"+l+"</option>")}this.$imageSelectionBox.change(function(){var e=parseInt(t.$imageSelectionBox.val());$.publish(o.IMAGE_SEARCH,[e])})}this.$total=$('<span class="total"></span>'),this.$search.append(this.$total),this.$searchButton=$('<a class="go btn btn-primary" tabindex="0">'+this.content.go+"</a>"),this.$search.append(this.$searchButton),this.$nextOptions=$('<div class="nextOptions"></div>'),this.$centerOptions.append(this.$nextOptions),this.$nextButton=$('<a class="imageBtn next" tabindex="0"></a>'),this.$nextOptions.append(this.$nextButton),this.$lastButton=$('<a class="imageBtn last" tabindex="0"></a>'),this.$nextOptions.append(this.$lastButton),this.isPageModeEnabled()?(this.$pageModeOption.attr("checked","checked"),this.$pageModeOption.removeAttr("disabled"),this.$pageModeLabel.removeClass("disabled")):(this.$imageModeOption.attr("checked","checked"),this.$pageModeOption.attr("disabled","disabled"),this.$pageModeLabel.addClass("disabled")),this.extension.helper.getManifestType().toString()===manifesto.ManifestType.manuscript().toString()?this.$pageModeLabel.text(this.content.folio):this.$pageModeLabel.text(this.content.page),this.$galleryButton=$('<a class="imageBtn gallery" title="'+this.content.gallery+'" tabindex="0"></a>'),this.$rightOptions.prepend(this.$galleryButton),this.$pagingToggleButtons=$('<div class="pagingToggleButtons"></div>'),this.$rightOptions.prepend(this.$pagingToggleButtons),this.$oneUpButton=$('<a class="imageBtn one-up" title="'+this.content.oneUp+'" tabindex="0"></a>'),this.$pagingToggleButtons.append(this.$oneUpButton),this.$twoUpButton=$('<a class="imageBtn two-up" title="'+this.content.twoUp+'" tabindex="0"></a>'),this.$pagingToggleButtons.append(this.$twoUpButton),this.updatePagingToggle(),this.updateGalleryButton(),this.$oneUpButton.onPressed(function(){var e=!1;t.updateSettings({pagingEnabled:e}),$.publish(o.PAGING_TOGGLED,[e])}),this.$twoUpButton.onPressed(function(){var e=!0;t.updateSettings({pagingEnabled:e}),$.publish(o.PAGING_TOGGLED,[e])}),this.$galleryButton.onPressed(function(){$.publish(n.TOGGLE_EXPAND_LEFT_PANEL)}),this.setTitles(),this.setTotal();var h=this.extension.helper.getViewingDirection();1===this.extension.helper.getTotalCanvases()&&this.$centerOptions.hide(),this.$firstButton.onPressed(function(){switch(h.toString()){case manifesto.ViewingDirection.leftToRight().toString():case manifesto.ViewingDirection.topToBottom().toString():case manifesto.ViewingDirection.bottomToTop().toString():$.publish(o.FIRST);break;case manifesto.ViewingDirection.rightToLeft().toString():$.publish(o.LAST)}}),this.$prevButton.onPressed(function(){switch(h.toString()){case manifesto.ViewingDirection.leftToRight().toString():case manifesto.ViewingDirection.bottomToTop().toString():case manifesto.ViewingDirection.topToBottom().toString():$.publish(o.PREV);break;case manifesto.ViewingDirection.rightToLeft().toString():$.publish(o.NEXT)}}),this.$nextButton.onPressed(function(){switch(h.toString()){case manifesto.ViewingDirection.leftToRight().toString():case manifesto.ViewingDirection.bottomToTop().toString():case manifesto.ViewingDirection.topToBottom().toString():$.publish(o.NEXT);break;case manifesto.ViewingDirection.rightToLeft().toString():$.publish(o.PREV)}}),this.$lastButton.onPressed(function(){switch(h.toString()){case manifesto.ViewingDirection.leftToRight().toString():case manifesto.ViewingDirection.topToBottom().toString():case manifesto.ViewingDirection.bottomToTop().toString():$.publish(o.LAST);break;case manifesto.ViewingDirection.rightToLeft().toString():$.publish(o.FIRST)}}),this.config.options.pageModeEnabled?(this.$imageModeOption.on("click",function(e){$.publish(o.MODE_CHANGED,[r.image.toString()])}),this.$pageModeOption.on("click",function(e){$.publish(o.MODE_CHANGED,[r.page.toString()])})):(this.$imageModeOption.hide(),this.$pageModeLabel.hide(),this.$pageModeOption.hide()),this.$searchText.onEnter(function(){t.$searchText.blur(),t.search(t.$searchText.val())}),this.$searchText.click(function(){$(this).select()}),this.$searchButton.onPressed(function(){t.options.autoCompleteBoxEnabled?t.search(t.$autoCompleteBox.val()):t.search(t.$searchText.val())}),this.options.modeOptionsEnabled===!1&&(this.$modeOptions.hide(),this.$centerOptions.addClass("modeOptionsDisabled")),this.options.imageSelectionBoxEnabled===!0&&this.options.autoCompleteBoxEnabled!==!0&&this.$search.hide(),this.options.helpEnabled===!1&&this.$helpButton.hide(),Utils.Bools.getBool(this.options.pagingToggleEnabled,!0)||this.$pagingToggleButtons.hide()},t.prototype.openGallery=function(){this.$oneUpButton.removeClass("on"),this.$twoUpButton.removeClass("on"),this.$galleryButton.addClass("on")},t.prototype.closeGallery=function(){this.updatePagingToggle(),this.$galleryButton.removeClass("on")},t.prototype.isPageModeEnabled=function(){return this.config.options.pageModeEnabled&&this.extension.getMode().toString()===r.page.toString()},t.prototype.setTitles=function(){this.isPageModeEnabled()?(this.$firstButton.prop("title",this.content.firstPage),this.$prevButton.prop("title",this.content.previousPage),this.$nextButton.prop("title",this.content.nextPage),this.$lastButton.prop("title",this.content.lastPage)):(this.$firstButton.prop("title",this.content.firstImage),this.$prevButton.prop("title",this.content.previousImage),this.$nextButton.prop("title",this.content.nextImage),this.$lastButton.prop("title",this.content.lastImage)),this.$searchButton.prop("title",this.content.go)},t.prototype.updatePagingToggle=function(){return this.pagingToggleIsVisible()?void(this.extension.isPagingSettingEnabled()?(this.$oneUpButton.removeClass("on"),this.$twoUpButton.addClass("on")):(this.$twoUpButton.removeClass("on"),this.$oneUpButton.addClass("on"))):void this.$pagingToggleButtons.hide()},t.prototype.pagingToggleIsVisible=function(){return Utils.Bools.getBool(this.options.pagingToggleEnabled,!0)&&this.extension.helper.isPagingAvailable()},t.prototype.updateGalleryButton=function(){this.galleryIsVisible()||this.$galleryButton.hide()},t.prototype.galleryIsVisible=function(){return Utils.Bools.getBool(this.options.galleryButtonEnabled,!0)&&this.extension.isLeftPanelEnabled()},t.prototype.setTotal=function(){var e=this.content.of;this.isPageModeEnabled()?this.$total.html(String.format(e,this.extension.helper.getLastCanvasLabel(!0))):this.$total.html(String.format(e,this.extension.helper.getTotalCanvases()))},t.prototype.setSearchFieldValue=function(e){var t,i=this.extension.helper.getCanvasByIndex(e);if(this.isPageModeEnabled()){var n=Manifesto.TranslationCollection.getValue(i.getLabel());t="-"===n?"":n}else e+=1,t=e;this.options.autoCompleteBoxEnabled?this.$autoCompleteBox.val(t):this.$searchText.val(t)},t.prototype.search=function(e){if(!e)return this.extension.showMessage(this.content.emptyValue),void $.publish(n.CANVAS_INDEX_CHANGE_FAILED);if(this.isPageModeEnabled())$.publish(o.PAGE_SEARCH,[e]);else{var t;if(t=this.options.autoCompleteBoxEnabled?parseInt(this.$autoCompleteBox.val(),10):parseInt(this.$searchText.val(),10),t-=1,isNaN(t))return this.extension.showMessage(this.extension.config.modules.genericDialogue.content.invalidNumber),void $.publish(n.CANVAS_INDEX_CHANGE_FAILED);var i=this.extension.helper.getCanvasByIndex(t);if(!i)return this.extension.showMessage(this.extension.config.modules.genericDialogue.content.pageNotFound),void $.publish(n.CANVAS_INDEX_CHANGE_FAILED);$.publish(o.IMAGE_SEARCH,[t])}},t.prototype.canvasIndexChanged=function(e){this.setSearchFieldValue(e),this.options.imageSelectionBoxEnabled===!0&&this.options.autoCompleteBoxEnabled!==!0&&this.$imageSelectionBox.val(e);var t=this.extension.helper.getViewingDirection();t.toString()===manifesto.ViewingDirection.rightToLeft().toString()?(this.extension.helper.isFirstCanvas()?(this.disableLastButton(),this.disableNextButton()):(this.enableLastButton(),this.enableNextButton()),this.extension.helper.isLastCanvas()?(this.disableFirstButton(),this.disablePrevButton()):(this.enableFirstButton(),this.enablePrevButton())):(this.extension.helper.isFirstCanvas()?(this.disableFirstButton(),this.disablePrevButton()):(this.enableFirstButton(),this.enablePrevButton()),this.extension.helper.isLastCanvas()?(this.disableLastButton(),this.disableNextButton()):(this.enableLastButton(),this.enableNextButton()))},t.prototype.disableFirstButton=function(){this.firstButtonEnabled=!1,this.$firstButton.disable()},t.prototype.enableFirstButton=function(){this.firstButtonEnabled=!0,this.$firstButton.enable()},t.prototype.disableLastButton=function(){this.lastButtonEnabled=!1,this.$lastButton.disable()},t.prototype.enableLastButton=function(){this.lastButtonEnabled=!0,this.$lastButton.enable()},t.prototype.disablePrevButton=function(){this.prevButtonEnabled=!1,this.$prevButton.disable()},t.prototype.enablePrevButton=function(){this.prevButtonEnabled=!0,this.$prevButton.enable()},t.prototype.disableNextButton=function(){this.nextButtonEnabled=!1,this.$nextButton.disable()},t.prototype.enableNextButton=function(){this.nextButtonEnabled=!0,this.$nextButton.enable()},t.prototype.modeChanged=function(){this.setSearchFieldValue(this.extension.helper.canvasIndex),this.setTitles(),this.setTotal()},t.prototype.resize=function(){e.prototype.resize.call(this),this.extension.width()<this.extension.config.options.minWidthBreakPoint?(this.pagingToggleIsVisible()&&this.$pagingToggleButtons.hide(),this.galleryIsVisible()&&this.$galleryButton.hide()):(this.pagingToggleIsVisible()&&this.$pagingToggleButtons.show(),this.galleryIsVisible()&&this.$galleryButton.show())},t}(s);return a}),define("extensions/uv-seadragon-extension/Bounds",["require","exports"],function(e,t){"use strict";var i=function(){function e(e,t,i,n){this.x=e,this.y=t,this.w=i,this.h=n}return e.prototype.toString=function(){return this.x+","+this.y+","+this.w+","+this.h},e.fromString=function(t){var i=t.split(",");return new e(Number(i[0]),Number(i[1]),Number(i[2]),Number(i[3]))},e}();return i});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-seadragoncenterpanel-module/SeadragonCenterPanel",["require","exports","../uv-shared-module/BaseCommands","../../extensions/uv-seadragon-extension/Bounds","../uv-shared-module/CenterPanel","../../extensions/uv-seadragon-extension/Commands","../uv-shared-module/Metrics","../../Params"],function(e,t,i,n,o,s,r,a){"use strict";var l=function(e){function t(t){var i=e.call(this,t)||this;return i.controlsVisible=!1,i.isCreated=!1,i.isFirstLoad=!0,i.nextButtonEnabled=!1,i.prevButtonEnabled=!1,i}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("seadragonCenterPanel"),e.prototype.create.call(this),this.$viewer=$('<div id="viewer"></div>'),this.$content.prepend(this.$viewer),$.subscribe(i.SETTINGS_CHANGED,function(e,i){t.viewer.gestureSettingsMouse.clickToZoom=i.clickToZoomEnabled}),$.subscribe(i.OPEN_EXTERNAL_RESOURCE,function(e,i){t.whenResized(function(){t.isCreated||t.createUI(),t.openMedia(i)})}),$.subscribe(s.CLEAR_SEARCH,function(){t.whenCreated(function(){t.extension.currentSearchResultRect=null,t.clearSearchResults()})}),$.subscribe(s.VIEW_PAGE,function(){t.extension.previousSearchResultRect=null,t.extension.currentSearchResultRect=null}),$.subscribe(s.NEXT_SEARCH_RESULT,function(){t.whenCreated(function(){t.nextSearchResult()})}),$.subscribe(s.PREV_SEARCH_RESULT,function(){t.whenCreated(function(){t.prevSearchResult()})}),$.subscribe(s.ZOOM_IN,function(){t.whenCreated(function(){t.zoomIn()})}),$.subscribe(s.ZOOM_OUT,function(){t.whenCreated(function(){t.zoomOut()})}),$.subscribe(s.ROTATE,function(){t.whenCreated(function(){t.rotateRight()})}),$.subscribe(i.METRIC_CHANGED,function(){t.whenCreated(function(){t.updateResponsiveView()})})},t.prototype.whenResized=function(e){var t=this;Utils.Async.waitFor(function(){return t.isResized},e)},t.prototype.whenCreated=function(e){var t=this;Utils.Async.waitFor(function(){return t.isCreated},e)},t.prototype.zoomIn=function(){this.viewer.viewport.zoomTo(2*this.viewer.viewport.getZoom(!0))},t.prototype.zoomOut=function(){this.viewer.viewport.zoomTo(.5*this.viewer.viewport.getZoom(!0))},t.prototype.rotateRight=function(){this.viewer.viewport.setRotation(this.viewer.viewport.getRotation()+90)},t.prototype.updateResponsiveView=function(){this.setNavigatorVisible(),this.extension.metric===r.MOBILE_LANDSCAPE?(this.viewer.autoHideControls=!1,this.$viewportNavButtons.hide()):(this.viewer.autoHideControls=!0,this.$viewportNavButtons.show())},t.prototype.createUI=function(){var e=this;this.$spinner=$('<div class="spinner"></div>'),this.$content.append(this.$spinner),this.updateAttribution();var t=window.DEBUG?"modules/uv-seadragoncenterpanel-module/img/":"themes/"+this.extension.config.options.theme+"/img/uv-seadragoncenterpanel-module/";window.openSeadragonViewer=this.viewer=OpenSeadragon({id:"viewer",ajaxWithCredentials:!1,showNavigationControl:!0,showNavigator:!0,showRotationControl:!0,showHomeControl:Utils.Bools.getBool(this.config.options.showHomeControl,!1),showFullPageControl:!1,defaultZoomLevel:this.config.options.defaultZoomLevel||0,maxZoomPixelRatio:this.config.options.maxZoomPixelRatio||2,controlsFadeDelay:this.config.options.controlsFadeDelay||250,controlsFadeLength:this.config.options.controlsFadeLength||250,navigatorPosition:this.config.options.navigatorPosition||"BOTTOM_RIGHT",animationTime:this.config.options.animationTime||1.2,visibilityRatio:this.config.options.visibilityRatio||.5,constrainDuringPan:Utils.Bools.getBool(this.config.options.constrainDuringPan,!1),immediateRender:Utils.Bools.getBool(this.config.options.immediateRender,!1),blendTime:this.config.options.blendTime||0,autoHideControls:Utils.Bools.getBool(this.config.options.autoHideControls,!0),prefixUrl:t,gestureSettingsMouse:{clickToZoom:!!this.extension.config.options.clickToZoomEnabled},navImages:{zoomIn:{REST:"zoom_in.png",GROUP:"zoom_in.png",HOVER:"zoom_in.png",DOWN:"zoom_in.png"},zoomOut:{REST:"zoom_out.png",GROUP:"zoom_out.png",HOVER:"zoom_out.png",DOWN:"zoom_out.png"},home:{REST:"home.png",GROUP:"home.png",HOVER:"home.png",DOWN:"home.png"},rotateright:{REST:"rotate_right.png",GROUP:"rotate_right.png",HOVER:"rotate_right.png",DOWN:"rotate_right.png"},rotateleft:{REST:"pixel.gif",GROUP:"pixel.gif",HOVER:"pixel.gif",DOWN:"pixel.gif"},next:{REST:"pixel.gif",GROUP:"pixel.gif",HOVER:"pixel.gif",DOWN:"pixel.gif"},previous:{REST:"pixel.gif",GROUP:"pixel.gif",HOVER:"pixel.gif",DOWN:"pixel.gif"}}}),this.$zoomInButton=this.$viewer.find('div[title="Zoom in"]'),this.$zoomInButton.attr("tabindex",0),this.$zoomInButton.prop("title",this.content.zoomIn),this.$zoomInButton.addClass("zoomIn viewportNavButton"),this.$zoomOutButton=this.$viewer.find('div[title="Zoom out"]'),this.$zoomOutButton.attr("tabindex",0),this.$zoomOutButton.prop("title",this.content.zoomOut),this.$zoomOutButton.addClass("zoomOut viewportNavButton"),this.$goHomeButton=this.$viewer.find('div[title="Go home"]'),this.$goHomeButton.attr("tabindex",0),this.$goHomeButton.prop("title",this.content.goHome),this.$goHomeButton.addClass("goHome viewportNavButton"),this.$rotateButton=this.$viewer.find('div[title="Rotate right"]'),this.$rotateButton.attr("tabindex",0),this.$rotateButton.prop("title",this.content.rotateRight),this.$rotateButton.addClass("rotate viewportNavButton"),this.$viewportNavButtonsContainer=this.$viewer.find(".openseadragon-container > div:not(.openseadragon-canvas):first"),this.$viewportNavButtons=this.$viewportNavButtonsContainer.find(".viewportNavButton"),this.$canvas=$(this.viewer.canvas),window.DEBUG||this.$canvas.on("contextmenu",function(e){return!1}),this.$navigator=this.$viewer.find(".navigator"),this.setNavigatorVisible(),this.$element.on("mousemove",function(t){e.controlsVisible||(e.controlsVisible=!0,e.viewer.setControlsEnabled(!0))}),this.$element.on("mouseleave",function(t){e.controlsVisible&&(e.controlsVisible=!1,e.viewer.setControlsEnabled(!1))}),this.$element.on("mousemove",function(t){if(!e.$viewer.find(".navigator").ismouseover()){if(!e.controlsVisible)return;e.controlsVisible=!1,e.viewer.setControlsEnabled(!1)}},this.config.options.controlsFadeAfterInactive),this.viewer.addHandler("tile-drawn",function(){e.$spinner.hide()}),this.viewer.addHandler("resize",function(t){$.publish(s.SEADRAGON_RESIZE,[t]),e.viewerResize(t)}),this.viewer.addHandler("animation-start",function(e){$.publish(s.SEADRAGON_ANIMATION_START,[e])}),this.viewer.addHandler("animation",function(e){$.publish(s.SEADRAGON_ANIMATION,[e])}),this.viewer.addHandler("animation-finish",function(t){e.currentBounds=e.getViewportBounds(),e.updateVisibleSearchResultRects(),$.publish(s.SEADRAGON_ANIMATION_FINISH,[t])}),this.viewer.addHandler("rotate",function(e){$.publish(s.SEADRAGON_ROTATION,[e.degrees])}),this.title=this.extension.helper.getLabel(),this.createNavigationButtons(),this.hidePrevButton(),this.hideNextButton(),this.isCreated=!0,this.resize()},t.prototype.createNavigationButtons=function(){var e=this.extension.helper.getViewingDirection();switch(this.$prevButton=$('<div class="paging btn prev" tabindex="0"></div>'),this.$prevButton.prop("title",this.content.previous),this.$nextButton=$('<div class="paging btn next" tabindex="0"></div>'),this.$nextButton.prop("title",this.content.next),this.viewer.addControl(this.$prevButton[0],{anchor:OpenSeadragon.ControlAnchor.TOP_LEFT}),this.viewer.addControl(this.$nextButton[0],{anchor:OpenSeadragon.ControlAnchor.TOP_RIGHT}),e.toString()){case manifesto.ViewingDirection.bottomToTop().toString():case manifesto.ViewingDirection.topToBottom().toString():this.$prevButton.addClass("vertical"),this.$nextButton.addClass("vertical")}var t=this;this.$prevButton.onPressed(function(i){if(i.preventDefault(),OpenSeadragon.cancelEvent(i),t.prevButtonEnabled)switch(e.toString()){case manifesto.ViewingDirection.leftToRight().toString():case manifesto.ViewingDirection.bottomToTop().toString():case manifesto.ViewingDirection.topToBottom().toString():$.publish(s.PREV);break;case manifesto.ViewingDirection.rightToLeft().toString():$.publish(s.NEXT)}}),this.$nextButton.onPressed(function(i){if(i.preventDefault(),OpenSeadragon.cancelEvent(i),t.nextButtonEnabled)switch(e.toString()){case manifesto.ViewingDirection.leftToRight().toString():case manifesto.ViewingDirection.bottomToTop().toString():case manifesto.ViewingDirection.topToBottom().toString():$.publish(s.NEXT);break;case manifesto.ViewingDirection.rightToLeft().toString():$.publish(s.PREV)}})},t.prototype.openMedia=function(e){var t=this;this.$spinner.show(),this.items=[],this.extension.getExternalResources(e).then(function(e){t.viewer.close(),e=t.getPagePositions(e);for(var i=0;i<e.length;i++){var n=e[i];t.viewer.addTiledImage({tileSource:n,x:n.x,y:n.y,width:n.width,success:function(i){t.items.push(i),t.items.length===e.length&&t.openPagesHandler(),t.resize()}})}})},t.prototype.getPagePositions=function(e){var t,i,n,o,s,r;if(e.length>1)if(2===e.length)this.extension.helper.isVerticallyAligned()?(n=e[0],n.y=0,o=e[1],o.y=n.height+this.config.options.pageGap):(t=e[0],t.x=0,i=e[1],i.x=t.width+this.config.options.pageGap);else if(this.extension.helper.isVerticallyAligned())if(this.extension.helper.isTopToBottom())for(var a=0;a<e.length-1;a++)s=e[a],r=e[a+1],r.y=(s.y||0)+s.height;else for(var a=e.length;a>0;a--)s=e[a],r=e[a-1],r.y=(s.y||0)-s.height;else if(this.extension.helper.isLeftToRight())for(var a=0;a<e.length-1;a++)s=e[a],r=e[a+1],r.x=(s.x||0)+s.width;else for(var a=e.length-1;a>0;a--)s=e[a],r=e[a-1],r.x=(s.x||0)-s.width;return e},t.prototype.openPagesHandler=function(){if($.publish(s.SEADRAGON_OPEN),this.extension.helper.isMultiCanvas()&&!this.extension.helper.isContinuous()){this.showPrevButton(),this.showNextButton(),$(".navigator").addClass("extraMargin");var e=this.extension.helper.getViewingDirection();e.toString()===manifesto.ViewingDirection.rightToLeft().toString()?(this.extension.helper.isFirstCanvas()?this.disableNextButton():this.enableNextButton(),this.extension.helper.isLastCanvas()?this.disablePrevButton():this.enablePrevButton()):(this.extension.helper.isFirstCanvas()?this.disablePrevButton():this.enablePrevButton(),this.extension.helper.isLastCanvas()?this.disableNextButton():this.enableNextButton())}this.setNavigatorVisible(),this.overlaySearchResults(),this.updateBounds();var t=this.getInitialSearchResultRect();this.extension.previousSearchResultRect=null,this.extension.currentSearchResultRect=null,t&&this.isZoomToSearchResultEnabled()&&this.zoomToSearchResult(t),this.isFirstLoad=!1},t.prototype.updateBounds=function(){var e=this.extension.getSettings();this.isFirstLoad?(this.initialRotation=this.extension.getParam(a.rotation),this.initialRotation&&this.viewer.viewport.setRotation(parseInt(this.initialRotation)),this.initialBounds=this.extension.getParam(a.xywh),this.initialBounds&&(this.initialBounds=n.fromString(this.initialBounds),this.currentBounds=this.initialBounds,this.fitToBounds(this.currentBounds))):e.preserveViewport?this.fitToBounds(this.currentBounds):this.goHome()},t.prototype.goHome=function(){this.viewer.viewport.goHome(!0)},t.prototype.disablePrevButton=function(){this.prevButtonEnabled=!1,this.$prevButton.addClass("disabled")},t.prototype.enablePrevButton=function(){this.prevButtonEnabled=!0,this.$prevButton.removeClass("disabled")},t.prototype.hidePrevButton=function(){this.disablePrevButton(),this.$prevButton.hide()},t.prototype.showPrevButton=function(){this.enablePrevButton(),this.$prevButton.show()},t.prototype.disableNextButton=function(){this.nextButtonEnabled=!1,this.$nextButton.addClass("disabled")},t.prototype.enableNextButton=function(){this.nextButtonEnabled=!0,this.$nextButton.removeClass("disabled")},t.prototype.hideNextButton=function(){this.disableNextButton(),this.$nextButton.hide()},t.prototype.showNextButton=function(){this.enableNextButton(),this.$nextButton.show()},t.prototype.serialiseBounds=function(e){return e.x+","+e.y+","+e.width+","+e.height},t.prototype.fitToBounds=function(e,t){void 0===t&&(t=!0);var i=new OpenSeadragon.Rect;i.x=Number(e.x),i.y=Number(e.y),i.width=Number(e.w),i.height=Number(e.h),this.viewer.viewport.fitBoundsWithConstraints(i,t)},t.prototype.getCroppedImageBounds=function(){if(!this.viewer||!this.viewer.viewport)return null;var e=this.extension.helper.getCurrentCanvas(),t=this.extension.getCroppedImageDimensions(e,this.viewer),i=new n(t.regionPos.x,t.regionPos.y,t.region.width,t.region.height);return i.toString()},t.prototype.getViewportBounds=function(){if(!this.viewer||!this.viewer.viewport)return null;var e=this.viewer.viewport.getBounds(!0),t=new n(Math.floor(e.x),Math.floor(e.y),Math.floor(e.width),Math.floor(e.height));
return t},t.prototype.viewerResize=function(e){if(e.viewport){var t=e.viewport.getCenter(!0);t&&setTimeout(function(){e.viewport.panTo(t,!0)},1)}},t.prototype.clearSearchResults=function(){this.$canvas.find(".searchOverlay").hide()},t.prototype.overlaySearchResults=function(){for(var e=this.getSearchResultsForCurrentImages(),t=0;t<e.length;t++)for(var i=e[t],n=this.getSearchOverlayRects(i),o=0;o<n.length;o++){var s=n[o],r=document.createElement("div");r.id="searchResult-"+s.canvasIndex+"-"+s.resultIndex,r.className="searchOverlay",r.title=this.extension.sanitize(s.chars),this.viewer.addOverlay(r,s)}},t.prototype.getSearchResultsForCurrentImages=function(){var e=[],t=this.extension.searchResults;if(!t.length)return e;for(var i=this.extension.getPagedIndices(),n=0;n<i.length;n++)for(var o=i[n],s=0;s<t.length;s++)if(t[s].canvasIndex===o){e.push(t[s]);break}return e},t.prototype.getSearchResultRectsForCurrentImages=function(){var e=this.getSearchResultsForCurrentImages();return e.en().selectMany(function(e){return e.rects}).toArray()},t.prototype.updateVisibleSearchResultRects=function(){for(var e=this.getSearchResultRectsForCurrentImages(),t=0;t<e.length;t++){var i=e[t],n=this.viewer.viewport.getBounds();i.isVisible=Utils.Measurements.Dimensions.hitRect(n.x,n.y,n.width,n.height,i.viewportX,i.viewportY)}},t.prototype.getSearchResultRectIndex=function(e){var t=this.getSearchResultRectsForCurrentImages();return t.indexOf(e)},t.prototype.isZoomToSearchResultEnabled=function(){return Utils.Bools.getBool(this.extension.config.options.zoomToSearchResultEnabled,!0)},t.prototype.nextSearchResult=function(){for(var e,t=this.getSearchResultRectsForCurrentImages(),i=this.getSearchResultRectIndex(this.extension.currentSearchResultRect),n=i+1;n<t.length;n++){var o=t[n];e=o;break}e&&this.isZoomToSearchResultEnabled()?o.canvasIndex>this.extension.helper.canvasIndex?(this.extension.currentSearchResultRect=o,$.publish(s.SEARCH_RESULT_CANVAS_CHANGED,[o])):this.zoomToSearchResult(o):$.publish(s.NEXT_IMAGES_SEARCH_RESULT_UNAVAILABLE)},t.prototype.prevSearchResult=function(){for(var e,t=this.getSearchResultRectsForCurrentImages(),i=this.getSearchResultRectIndex(this.extension.currentSearchResultRect),n=i-1;n>=0;n--){var o=t[n];e=o;break}e&&this.isZoomToSearchResultEnabled()?o.canvasIndex<this.extension.helper.canvasIndex?(this.extension.currentSearchResultRect=o,$.publish(s.SEARCH_RESULT_CANVAS_CHANGED,[o])):this.zoomToSearchResult(o):$.publish(s.PREV_IMAGES_SEARCH_RESULT_UNAVAILABLE)},t.prototype.getSearchResultRectByIndex=function(e){var t=this.getSearchResultRectsForCurrentImages();return t.length?t[e]:null},t.prototype.getInitialSearchResultRect=function(){var e=this,t=this.getSearchResultRectsForCurrentImages();return t.length?this.extension.previousSearchResultRect&&this.extension.previousSearchResultRect.canvasIndex>this.extension.helper.canvasIndex?t.en().where(function(t){return t.canvasIndex===e.extension.helper.canvasIndex}).last():t.en().where(function(t){return t.canvasIndex===e.extension.helper.canvasIndex}).first():null},t.prototype.zoomToSearchResult=function(e){this.extension.previousSearchResultRect=this.extension.currentSearchResultRect||e,this.extension.currentSearchResultRect=e,this.fitToBounds(new n(e.viewportX,e.viewportY,e.width,e.height),!1),this.highlightSearchResultRect(e),$.publish(s.SEARCH_RESULT_RECT_CHANGED)},t.prototype.highlightSearchResultRect=function(e){var t=$("#searchResult-"+e.canvasIndex+"-"+e.index);t.addClass("current"),$(".searchOverlay").not(t).removeClass("current")},t.prototype.getSearchOverlayRects=function(e){var t=[],i=this.extension.resources.en().where(function(t){return t.index===e.canvasIndex}).first(),n=this.extension.resources.indexOf(i),o=(this.extension.resources[n].width,0);n>0&&(o=this.extension.resources[n-1].width);for(var s=0;s<e.rects.length;s++){var r=e.rects[s],a=r.x+o+(n>0?this.config.options.pageGap:0),l=r.y,h=r.width,c=r.height,u=new OpenSeadragon.Rect(a,l,h,c);r.viewportX=a,r.viewportY=l,u.canvasIndex=r.canvasIndex,u.resultIndex=r.index,u.chars=r.chars,t.push(u)}return t},t.prototype.resize=function(){var t=this;if(e.prototype.resize.call(this),this.$viewer.height(this.$content.height()-this.$viewer.verticalMargins()),this.$viewer.width(this.$content.width()-this.$viewer.horizontalMargins()),this.isCreated){this.$title.ellipsisFill(this.extension.sanitize(this.title)),this.$spinner.css("top",this.$content.height()/2-this.$spinner.height()/2),this.$spinner.css("left",this.$content.width()/2-this.$spinner.width()/2);var i=this.extension.helper.getViewingDirection();if(this.extension.helper.isMultiCanvas()&&this.$prevButton&&this.$nextButton){var n=Math.floor(this.$content.width()/2);switch(i.toString()){case manifesto.ViewingDirection.bottomToTop().toString():this.$prevButton.addClass("down"),this.$nextButton.addClass("up"),this.$prevButton.css("left",n-this.$prevButton.outerWidth()/2),this.$prevButton.css("top",this.$content.height()-this.$prevButton.height()),this.$nextButton.css("left",-1*n-this.$nextButton.outerWidth()/2);break;case manifesto.ViewingDirection.topToBottom().toString():this.$prevButton.css("left",n-this.$prevButton.outerWidth()/2),this.$nextButton.css("left",-1*n-this.$nextButton.outerWidth()/2),this.$nextButton.css("top",this.$content.height()-this.$nextButton.height());break;default:this.$prevButton.css("top",(this.$content.height()-this.$prevButton.height())/2),this.$nextButton.css("top",(this.$content.height()-this.$nextButton.height())/2)}}setTimeout(function(){if(t.extension.helper.isContinuous())if(t.extension.helper.isHorizontallyAligned()){var e=t.$viewer.width()-t.$viewer.rightMargin();t.$navigator.width(e)}else t.$navigator.height(t.$viewer.height())},100)}},t.prototype.setFocus=function(){this.$canvas.is(":focus")||this.extension.config.options.allowStealFocus&&this.$canvas.focus()},t.prototype.setNavigatorVisible=function(){var e=Utils.Bools.getBool(this.extension.getSettings().navigatorEnabled,!0)&&this.extension.metric!==r.MOBILE_LANDSCAPE;this.viewer.navigator.setVisible(e),e?this.$navigator.show():this.$navigator.hide()},t}(o);return l});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("extensions/uv-seadragon-extension/SettingsDialogue",["require","exports","../../modules/uv-dialogues-module/SettingsDialogue"],function(e,t,i){"use strict";var n=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("settingsDialogue"),e.prototype.create.call(this),this.$navigatorEnabled=$('<div class="setting navigatorEnabled"></div>'),this.$scroll.append(this.$navigatorEnabled),this.$navigatorEnabledCheckbox=$('<input id="navigatorEnabled" type="checkbox" tabindex="0" />'),this.$navigatorEnabled.append(this.$navigatorEnabledCheckbox),this.$navigatorEnabledLabel=$('<label for="navigatorEnabled">'+this.content.navigatorEnabled+"</label>"),this.$navigatorEnabled.append(this.$navigatorEnabledLabel),this.$pagingEnabled=$('<div class="setting pagingEnabled"></div>'),this.$scroll.append(this.$pagingEnabled),this.$pagingEnabledCheckbox=$('<input id="pagingEnabled" type="checkbox" tabindex="0" />'),this.$pagingEnabled.append(this.$pagingEnabledCheckbox),this.$pagingEnabledLabel=$('<label for="pagingEnabled">'+this.content.pagingEnabled+"</label>"),this.$pagingEnabled.append(this.$pagingEnabledLabel),this.$clickToZoomEnabled=$('<div class="setting clickToZoom"></div>'),this.$scroll.append(this.$clickToZoomEnabled),this.$clickToZoomEnabledCheckbox=$('<input id="clickToZoomEnabled" type="checkbox" />'),this.$clickToZoomEnabled.append(this.$clickToZoomEnabledCheckbox),this.$clickToZoomEnabledLabel=$('<label for="clickToZoomEnabled">'+this.content.clickToZoomEnabled+"</label>"),this.$clickToZoomEnabled.append(this.$clickToZoomEnabledLabel),this.$preserveViewport=$('<div class="setting preserveViewport"></div>'),this.$scroll.append(this.$preserveViewport),this.$preserveViewportCheckbox=$('<input id="preserveViewport" type="checkbox" tabindex="0" />'),this.$preserveViewport.append(this.$preserveViewportCheckbox),this.$preserveViewportLabel=$('<label for="preserveViewport">'+this.content.preserveViewport+"</label>"),this.$preserveViewport.append(this.$preserveViewportLabel),this.$navigatorEnabledCheckbox.change(function(){var e={};t.$navigatorEnabledCheckbox.is(":checked")?e.navigatorEnabled=!0:e.navigatorEnabled=!1,t.updateSettings(e)}),this.$clickToZoomEnabledCheckbox.change(function(){var e={};t.$clickToZoomEnabledCheckbox.is(":checked")?e.clickToZoomEnabled=!0:e.clickToZoomEnabled=!1,t.updateSettings(e)}),this.$pagingEnabledCheckbox.change(function(){var e={};t.$pagingEnabledCheckbox.is(":checked")?e.pagingEnabled=!0:e.pagingEnabled=!1,t.updateSettings(e)}),this.$preserveViewportCheckbox.change(function(){var e={};t.$preserveViewportCheckbox.is(":checked")?e.preserveViewport=!0:e.preserveViewport=!1,t.updateSettings(e)})},t.prototype.open=function(){e.prototype.open.call(this);var t=this.getSettings();t.navigatorEnabled?this.$navigatorEnabledCheckbox.prop("checked",!0):this.$navigatorEnabledCheckbox.removeAttr("checked"),t.clickToZoomEnabled?this.$clickToZoomEnabledCheckbox.prop("checked",!0):this.$clickToZoomEnabledCheckbox.removeAttr("checked"),this.extension.helper.isPagingAvailable()?t.pagingEnabled?this.$pagingEnabledCheckbox.prop("checked",!0):this.$pagingEnabledCheckbox.removeAttr("checked"):this.$pagingEnabled.hide(),t.preserveViewport?this.$preserveViewportCheckbox.prop("checked",!0):this.$preserveViewportCheckbox.removeAttr("checked")},t}(i);return n});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("extensions/uv-seadragon-extension/ShareDialogue",["require","exports","../../modules/uv-dialogues-module/ShareDialogue","./Commands"],function(e,t,i,n){"use strict";var o=function(e){function t(t){var i=e.call(this,t)||this;return $.subscribe(n.SEADRAGON_OPEN,function(){i.update()}),$.subscribe(n.SEADRAGON_ANIMATION_FINISH,function(){i.update()}),i}return __extends(t,e),t.prototype.create=function(){this.setConfig("shareDialogue"),e.prototype.create.call(this)},t.prototype.update=function(){e.prototype.update.call(this);var t=this.extension.getViewportBounds(),i=this.extension.getViewerRotation();this.code=this.extension.getEmbedScript(this.options.embedTemplate,this.currentWidth,this.currentHeight,t,i),this.$code.val(this.code)},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(i);return o});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("extensions/uv-seadragon-extension/Extension",["require","exports","../../modules/uv-shared-module/BaseCommands","../../modules/uv-shared-module/BaseExtension","../../modules/uv-shared-module/Bookmark","./Commands","../../modules/uv-contentleftpanel-module/ContentLeftPanel","./CroppedImageDimensions","./DownloadDialogue","../../modules/uv-dialogues-module/ExternalContentDialogue","../../modules/uv-searchfooterpanel-module/FooterPanel","../../modules/uv-dialogues-module/HelpDialogue","../../modules/uv-shared-module/Metrics","../../modules/uv-osdmobilefooterpanel-module/MobileFooter","./Mode","../../modules/uv-dialogues-module/MoreInfoDialogue","../../modules/uv-moreinforightpanel-module/MoreInfoRightPanel","../../modules/uv-multiselectdialogue-module/MultiSelectDialogue","./MultiSelectionArgs","../../modules/uv-pagingheaderpanel-module/PagingHeaderPanel","../../Params","../../modules/uv-shared-module/Point","../../modules/uv-seadragoncenterpanel-module/SeadragonCenterPanel","./SettingsDialogue","./ShareDialogue","../../modules/uv-shared-module/Shell"],function(e,t,i,n,o,s,r,a,l,h,c,u,p,d,g,f,m,v,b,E,y,x,w,S,C,R){"use strict";var I=Manifold.SearchResult,T=Utils.Measurements.Size,O=function(e){function t(t){var i=e.call(this,t)||this;return i.currentRotation=0,i.isSearching=!1,i.searchResults=[],i}return __extends(t,e),t.prototype.create=function(t){var n=this;e.prototype.create.call(this,t);$.subscribe(i.METRIC_CHANGED,function(){if(n.metric===p.MOBILE_LANDSCAPE){var e={};e.pagingEnabled=!1,n.updateSettings(e),$.publish(i.UPDATE_SETTINGS),R.$rightPanel.hide()}else R.$rightPanel.show()}),$.subscribe(s.CLEAR_SEARCH,function(e){n.searchResults=null,$.publish(s.SEARCH_RESULTS_CLEARED),n.triggerSocket(s.CLEAR_SEARCH)}),$.subscribe(i.DOWN_ARROW,function(e){n.useArrowKeysToNavigate()||n.centerPanel.setFocus()}),$.subscribe(i.END,function(e){n.viewPage(n.helper.getLastPageIndex())}),$.subscribe(s.FIRST,function(e){n.triggerSocket(s.FIRST),n.viewPage(n.helper.getFirstPageIndex())}),$.subscribe(s.GALLERY_DECREASE_SIZE,function(e){n.triggerSocket(s.GALLERY_DECREASE_SIZE)}),$.subscribe(s.GALLERY_INCREASE_SIZE,function(e){n.triggerSocket(s.GALLERY_INCREASE_SIZE)}),$.subscribe(s.GALLERY_THUMB_SELECTED,function(e){n.triggerSocket(s.GALLERY_THUMB_SELECTED)}),$.subscribe(i.HOME,function(e){n.viewPage(n.helper.getFirstPageIndex())}),$.subscribe(s.IMAGE_SEARCH,function(e,t){n.triggerSocket(s.IMAGE_SEARCH,t),n.viewPage(t)}),$.subscribe(s.LAST,function(e){n.triggerSocket(s.LAST),n.viewPage(n.helper.getLastPageIndex())}),$.subscribe(i.LEFT_ARROW,function(e){n.useArrowKeysToNavigate()?n.viewPage(n.getPrevPageIndex()):n.centerPanel.setFocus()}),$.subscribe(i.LEFTPANEL_COLLAPSE_FULL_START,function(e){n.metric!==p.MOBILE_LANDSCAPE&&R.$rightPanel.show()}),$.subscribe(i.LEFTPANEL_COLLAPSE_FULL_FINISH,function(e){R.$centerPanel.show(),n.resize()}),$.subscribe(i.LEFTPANEL_EXPAND_FULL_START,function(e){R.$centerPanel.hide(),R.$rightPanel.hide()}),$.subscribe(i.MINUS,function(e){n.centerPanel.setFocus()}),$.subscribe(s.MODE_CHANGED,function(e,t){n.triggerSocket(s.MODE_CHANGED,t),n.mode=new g(t);var o=n.getSettings();$.publish(i.SETTINGS_CHANGED,[o])}),$.subscribe(s.MULTISELECTION_MADE,function(e,t){var i=new b;i.manifestUri=n.helper.iiifResourceUri,i.allCanvases=t.length===n.helper.getCanvases().length,i.canvases=t,i.format=n.config.options.multiSelectionMimeType,i.sequence=n.helper.getCurrentSequence().id,n.triggerSocket(s.MULTISELECTION_MADE,i)}),$.subscribe(s.NEXT,function(e){n.triggerSocket(s.NEXT),n.viewPage(n.getNextPageIndex())}),$.subscribe(s.NEXT_SEARCH_RESULT,function(){n.triggerSocket(s.NEXT_SEARCH_RESULT)}),$.subscribe(s.NEXT_IMAGES_SEARCH_RESULT_UNAVAILABLE,function(){n.triggerSocket(s.NEXT_IMAGES_SEARCH_RESULT_UNAVAILABLE),n.nextSearchResult()}),$.subscribe(s.PREV_IMAGES_SEARCH_RESULT_UNAVAILABLE,function(){n.triggerSocket(s.PREV_IMAGES_SEARCH_RESULT_UNAVAILABLE),n.prevSearchResult()}),$.subscribe(s.OPEN_THUMBS_VIEW,function(e){n.triggerSocket(s.OPEN_THUMBS_VIEW)}),$.subscribe(s.OPEN_TREE_VIEW,function(e){n.triggerSocket(s.OPEN_TREE_VIEW)}),$.subscribe(i.PAGE_DOWN,function(e){n.viewPage(n.getNextPageIndex())}),$.subscribe(s.PAGE_SEARCH,function(e,t){n.triggerSocket(s.PAGE_SEARCH,t),n.viewLabel(t)}),$.subscribe(i.PAGE_UP,function(e){n.viewPage(n.getPrevPageIndex())}),$.subscribe(s.PAGING_TOGGLED,function(e,t){n.triggerSocket(s.PAGING_TOGGLED,t)}),$.subscribe(i.PLUS,function(e){n.centerPanel.setFocus()}),$.subscribe(s.PREV,function(e){n.triggerSocket(s.PREV),n.viewPage(n.getPrevPageIndex())}),$.subscribe(s.PREV_SEARCH_RESULT,function(){n.triggerSocket(s.PREV_SEARCH_RESULT)}),$.subscribe(s.PRINT,function(){n.print()}),$.subscribe(i.RIGHT_ARROW,function(e){n.useArrowKeysToNavigate()?n.viewPage(n.getNextPageIndex()):n.centerPanel.setFocus()}),$.subscribe(s.SEADRAGON_ANIMATION,function(){n.triggerSocket(s.SEADRAGON_ANIMATION)}),$.subscribe(s.SEADRAGON_ANIMATION_FINISH,function(e,t){n.centerPanel&&n.centerPanel.currentBounds&&n.setParam(y.xywh,n.centerPanel.getViewportBounds().toString());var i=n.helper.getCurrentCanvas();n.triggerSocket(s.CURRENT_VIEW_URI,{cropUri:n.getCroppedImageUri(i,n.getViewer()),fullUri:n.getConfinedImageUri(i,i.getWidth())})}),$.subscribe(s.SEADRAGON_ANIMATION_START,function(){n.triggerSocket(s.SEADRAGON_ANIMATION_START)}),$.subscribe(s.SEADRAGON_OPEN,function(){n.useArrowKeysToNavigate()||n.centerPanel.setFocus()}),$.subscribe(s.SEADRAGON_RESIZE,function(){n.triggerSocket(s.SEADRAGON_RESIZE)}),$.subscribe(s.SEADRAGON_ROTATION,function(e,t){n.triggerSocket(s.SEADRAGON_ROTATION),n.currentRotation=t,n.setParam(y.rotation,t)}),$.subscribe(s.SEARCH,function(e,t){n.triggerSocket(s.SEARCH,t),n.searchWithin(t)}),$.subscribe(s.SEARCH_PREVIEW_FINISH,function(e){n.triggerSocket(s.SEARCH_PREVIEW_FINISH)}),$.subscribe(s.SEARCH_PREVIEW_START,function(e){n.triggerSocket(s.SEARCH_PREVIEW_START)}),$.subscribe(s.SEARCH_RESULTS,function(e,t){n.triggerSocket(s.SEARCH_RESULTS,t)}),$.subscribe(s.SEARCH_RESULT_CANVAS_CHANGED,function(e,t){n.viewPage(t.canvasIndex)}),$.subscribe(s.SEARCH_RESULTS_EMPTY,function(e){n.triggerSocket(s.SEARCH_RESULTS_EMPTY)}),$.subscribe(i.THUMB_SELECTED,function(e,t){n.viewPage(t.index)}),$.subscribe(s.TREE_NODE_SELECTED,function(e,t){n.triggerSocket(s.TREE_NODE_SELECTED,t.data.path),n.treeNodeSelected(t)}),$.subscribe(i.UP_ARROW,function(e){n.useArrowKeysToNavigate()||n.centerPanel.setFocus()}),$.subscribe(i.UPDATE_SETTINGS,function(e){n.viewPage(n.helper.canvasIndex,!0);var t=n.getSettings();$.publish(i.SETTINGS_CHANGED,[t])}),$.subscribe(s.VIEW_PAGE,function(e,t){n.triggerSocket(s.VIEW_PAGE,t),n.viewPage(t)}),Utils.Async.waitFor(function(){return n.centerPanel&&n.centerPanel.isCreated},function(){n.checkForSearchParam(),n.checkForRotationParam()})},t.prototype.createModules=function(){e.prototype.createModules.call(this),this.isHeaderPanelEnabled()?this.headerPanel=new E(R.$headerPanel):R.$headerPanel.hide(),this.isLeftPanelEnabled()?this.leftPanel=new r(R.$leftPanel):R.$leftPanel.hide(),this.centerPanel=new w(R.$centerPanel),this.isRightPanelEnabled()?this.rightPanel=new m(R.$rightPanel):R.$rightPanel.hide(),this.isFooterPanelEnabled()?(this.footerPanel=new c(R.$footerPanel),this.mobileFooterPanel=new d(R.$mobileFooterPanel)):R.$footerPanel.hide(),this.$helpDialogue=$('<div class="overlay help"></div>'),R.$overlays.append(this.$helpDialogue),this.helpDialogue=new u(this.$helpDialogue),this.$moreInfoDialogue=$('<div class="overlay moreInfo"></div>'),R.$overlays.append(this.$moreInfoDialogue),this.moreInfoDialogue=new f(this.$moreInfoDialogue),this.$multiSelectDialogue=$('<div class="overlay multiSelect"></div>'),R.$overlays.append(this.$multiSelectDialogue),this.multiSelectDialogue=new v(this.$multiSelectDialogue),this.$shareDialogue=$('<div class="overlay share"></div>'),R.$overlays.append(this.$shareDialogue),this.shareDialogue=new C(this.$shareDialogue),this.$downloadDialogue=$('<div class="overlay download"></div>'),R.$overlays.append(this.$downloadDialogue),this.downloadDialogue=new l(this.$downloadDialogue),this.$settingsDialogue=$('<div class="overlay settings"></div>'),R.$overlays.append(this.$settingsDialogue),this.settingsDialogue=new S(this.$settingsDialogue),this.$externalContentDialogue=$('<div class="overlay externalContent"></div>'),R.$overlays.append(this.$externalContentDialogue),this.externalContentDialogue=new h(this.$externalContentDialogue),this.isHeaderPanelEnabled()&&this.headerPanel.init(),this.isLeftPanelEnabled()&&this.leftPanel.init(),this.isRightPanelEnabled()&&this.rightPanel.init(),this.isFooterPanelEnabled()&&this.footerPanel.init()},t.prototype.checkForSearchParam=function(){if(this.isDeepLinkingEnabled()){var e=this.getParam(y.highlight);e&&(e.replace(/\+/g," ").replace(/"/g,""),$.publish(s.SEARCH,[e]))}},t.prototype.checkForRotationParam=function(){if(this.isDeepLinkingEnabled()){var e=Number(this.getParam(y.rotation));e&&$.publish(s.SEADRAGON_ROTATION,[e])}},t.prototype.viewPage=function(e,t){if(-1!==e){if(this.helper.isCanvasIndexOutOfRange(e)&&(this.showMessage(this.config.content.canvasIndexOutOfRange),e=0),this.isPagingSettingEnabled()&&!t){var i=this.getPagedIndices(e);if(i.contains(this.helper.canvasIndex))return void this.viewCanvas(e)}this.viewCanvas(e)}},t.prototype.getViewer=function(){return this.centerPanel.viewer},t.prototype.getMode=function(){if(this.mode)return this.mode;switch(this.helper.getManifestType().toString()){case manifesto.ManifestType.monograph().toString():return g.page;case manifesto.ManifestType.manuscript().toString():return g.page;default:return g.image}},t.prototype.getViewportBounds=function(){if(!this.centerPanel)return null;var e=this.centerPanel.getViewportBounds();return e?e.toString():null},t.prototype.getViewerRotation=function(){return this.centerPanel?this.currentRotation:null},t.prototype.viewRange=function(e){var t=this.helper.getRangeByPath(e);if(t){var i=t.getCanvasIds()[0],n=this.helper.getCanvasIndexById(i);this.viewPage(n)}},t.prototype.viewLabel=function(e){if(!e)return this.showMessage(this.config.modules.genericDialogue.content.emptyValue),void $.publish(i.CANVAS_INDEX_CHANGE_FAILED);var t=this.helper.getCanvasIndexByLabel(e);-1!=t?this.viewPage(t):(this.showMessage(this.config.modules.genericDialogue.content.pageNotFound),$.publish(i.CANVAS_INDEX_CHANGE_FAILED))},t.prototype.treeNodeSelected=function(e){var t=e.data;if(t.type)switch(t.type){case manifesto.IIIFResourceType.manifest().toString():this.viewManifest(t);break;case manifesto.IIIFResourceType.collection().toString():this.viewCollection(t);break;default:this.viewRange(t.path)}},t.prototype.clearSearch=function(){this.searchResults=[],this.viewPage(this.helper.canvasIndex)},t.prototype.prevSearchResult=function(){for(var e,t=this.searchResults.length-1;t>=0;t--){var i=this.searchResults[t];if(i.canvasIndex<=this.getPrevPageIndex()){e=i,this.viewPage(e.canvasIndex);break}}},t.prototype.nextSearchResult=function(){for(var e,t=0;t<this.searchResults.length;t++){var i=this.searchResults[t];if(i.canvasIndex>=this.getNextPageIndex()){e=i,this.viewPage(i.canvasIndex);break}}},t.prototype.bookmark=function(){e.prototype.bookmark.call(this);var t=this.helper.getCurrentCanvas(),n=new o;n.index=this.helper.canvasIndex,n.label=Manifesto.TranslationCollection.getValue(t.getLabel()),n.path=this.getCroppedImageUri(t,this.getViewer()),n.thumb=t.getCanonicalImageUri(this.config.options.bookmarkThumbWidth),n.title=this.helper.getLabel(),n.trackingLabel=window.trackingLabel,n.type=manifesto.ElementType.image().toString(),this.triggerSocket(i.BOOKMARK,n)},t.prototype.print=function(){window.print(),this.triggerSocket(s.PRINT)},t.prototype.getCroppedImageDimensions=function(e,t){if(!t)return null;if(!t.viewport)return null;if(!e.getHeight()||!e.getWidth())return null;var i=t.viewport.getBounds(!0),n=new a,o=Math.floor(i.width),s=Math.floor(i.height),r=Math.floor(i.x),l=Math.floor(i.y);r+o>e.getWidth()?o=e.getWidth()-r:0>r&&(o+=r,r=0),l+s>e.getHeight()?s=e.getHeight()-l:0>l&&(s+=l,l=0),o=Math.min(o,e.getWidth()),s=Math.min(s,e.getHeight());var h=o,c=s;if(e.externalResource.data&&e.externalResource.data.profile&&e.externalResource.data.profile[1]){var u=new T(e.externalResource.data.profile[1].maxWidth,e.externalResource.data.profile[1].maxHeight);if(!_.isUndefined(u.width)&&!_.isUndefined(u.height)){if(o>u.width){var p=u.width;s=Math.round(p*(s/o)),o=p}if(s>u.height){var d=u.height;o=Math.round(o/s*d),s=d}}}return n.region=new T(h,c),n.regionPos=new x(r,l),n.size=new T(o,s),n},t.prototype.getCroppedImageUri=function(e,t){if(!t)return null;if(!t.viewport)return null;var i=this.getCroppedImageDimensions(e,t),n=this.getImageBaseUri(e),o=this.getImageId(e),s=i.regionPos.x+","+i.regionPos.y+","+i.region.width+","+i.region.height,r=i.size.width+","+i.size.height,a=this.getViewerRotation(),l="default";return n+"/"+o+"/"+s+"/"+r+"/"+a+"/"+l+".jpg"},t.prototype.getConfinedImageDimensions=function(e,t){var i=new T(0,0);i.width=t;var n=Math.normalise(t,0,e.getWidth());return i.height=Math.floor(e.getHeight()*n),i},t.prototype.getConfinedImageUri=function(e,t){var i=this.getImageBaseUri(e),n=this.getImageId(e),o="full",s=this.getConfinedImageDimensions(e,t),r=s.width+","+s.height,a=this.getViewerRotation(),l="default";return i+"/"+n+"/"+o+"/"+r+"/"+a+"/"+l+".jpg"},t.prototype.getImageId=function(e){var t=this.getInfoUri(e);return t=t.substr(0,t.lastIndexOf("/")),t.substr(t.lastIndexOf("/")+1)},t.prototype.getImageBaseUri=function(e){var t=this.getInfoUri(e);return t=t.substr(0,t.lastIndexOf("/")),t.substr(0,t.lastIndexOf("/"))},t.prototype.getInfoUri=function(e){var t,i=e.getImages();if(i&&i.length)for(var n=i[0],o=n.getResource(),s=o.getServices(),r=0;r<s.length;r++){var a=s[r],l=a.id;_.endsWith(l,"/")||(l+="/"),manifesto.Utils.isImageProfile(a.getProfile())&&(t=l+"info.json")}return t||(t=window.DEBUG?"/src/extensions/uv-seadragon-extension/lib/imageunavailable.json":"lib/imageunavailable.json"),t},t.prototype.getEmbedScript=function(e,t,i,n,o){var s=this.config.uri||"",r=String.format(e,this.getSerializedLocales(),s,this.helper.iiifResourceUri,this.helper.collectionIndex,this.helper.manifestIndex,this.helper.sequenceIndex,this.helper.canvasIndex,n,o,t,i,this.embedScriptUri);return r},t.prototype.getPrevPageIndex=function(e){_.isUndefined(e)&&(e=this.helper.canvasIndex);var t;if(this.isPagingSettingEnabled()){var i=this.getPagedIndices(e);t=this.helper.isRightToLeft()?i.last()-1:i[0]-1}else t=e-1;return t},t.prototype.isSearchWithinEnabled=function(){return Utils.Bools.getBool(this.config.options.searchWithinEnabled,!1)&&this.helper.getSearchWithinService()?!0:!1},t.prototype.isPagingSettingEnabled=function(){return this.helper.isPagingAvailable()?this.getSettings().pagingEnabled:!1},t.prototype.getNextPageIndex=function(e){_.isUndefined(e)&&(e=this.helper.canvasIndex);var t;if(this.isPagingSettingEnabled()){var i=this.getPagedIndices(e);t=this.helper.isRightToLeft()?i[0]+1:i.last()+1}else t=e+1;return t>this.helper.getTotalCanvases()-1?-1:t},t.prototype.getAutoCompleteService=function(){var e=this.helper.getSearchWithinService();return e?e.getService(manifesto.ServiceProfile.autoComplete()):null},t.prototype.getAutoCompleteUri=function(){var e=this.getAutoCompleteService();return e?e.id+"?q={0}":null},t.prototype.getSearchWithinServiceUri=function(){var e=this.helper.getSearchWithinService();if(!e)return null;var t=e.id;return t+="?q={0}"},t.prototype.searchWithin=function(e){var t=this;if(!this.isSearching){this.isSearching=!0,this.searchResults=[];var i=this,n=this.getSearchWithinServiceUri();n=String.format(n,e),this.getSearchResults(n,e,this.searchResults,function(n){t.isSearching=!1,n.length?(t.searchResults=n.sort(function(e,t){return e.canvasIndex-t.canvasIndex}),$.publish(s.SEARCH_RESULTS,[{terms:e,results:n}]),i.viewPage(i.helper.canvasIndex,!0)):i.showMessage(i.config.modules.genericDialogue.content.noMatches,function(){$.publish(s.SEARCH_RESULTS_EMPTY)})})}},t.prototype.getSearchResults=function(e,t,i,n){var o=this;$.getJSON(e,function(e){e.resources&&e.resources.length&&(i=i.concat(o.parseSearchJson(e,i))),e.next?o.getSearchResults(e.next,t,i,n):n(i)})},t.prototype.parseSearchJson=function(e,t){for(var i=[],n=0;n<e.resources.length;n++){var o=e.resources[n],s=this.helper.getCanvasIndexById(o.on.match(/(.*)#/)[1]),r=new I(o,s),a=i.en().where(function(e){return e.canvasIndex===r.canvasIndex}).first();a?a.addRect(o):i.push(r)}return i.sort(function(e,t){return e.canvasIndex-t.canvasIndex}),i},t.prototype.getSearchResultRects=function(){return this.searchResults.en().selectMany(function(e){return e.rects}).toArray()},t.prototype.getCurrentSearchResultRectIndex=function(){var e=this.getSearchResultRects();return e.indexOf(this.currentSearchResultRect)},t.prototype.getTotalSearchResultRects=function(){var e=this.getSearchResultRects();return e.length},t.prototype.isFirstSearchResultRect=function(){return 0===this.getCurrentSearchResultRectIndex()},t.prototype.getLastSearchResultRectIndex=function(){return this.getTotalSearchResultRects()-1},t.prototype.getPagedIndices=function(e){_.isUndefined(e)&&(e=this.helper.canvasIndex);var t=[];return this.helper.isContinuous()?t=$.map(this.helper.getCanvases(),function(e,t){return t}):this.isPagingSettingEnabled()?(t=this.helper.isFirstCanvas(e)||this.helper.isLastCanvas(e)&&this.helper.isTotalCanvasesEven()?[e]:e%2?[e,e+1]:[e-1,e],this.helper.isRightToLeft()&&(t=t.reverse())):t.push(this.helper.canvasIndex),t},t}(n);return O});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("extensions/uv-virtex-extension/DownloadDialogue",["require","exports","../../modules/uv-dialogues-module/DownloadDialogue"],function(e,t,i){"use strict";var n=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){this.setConfig("downloadDialogue"),e.prototype.create.call(this)},t.prototype.open=function(t){e.prototype.open.call(this,t),this.addEntireFileDownloadOptions(),this.updateNoneAvailable(),this.resize()},t.prototype.isDownloadOptionAvailable=function(t){return e.prototype.isDownloadOptionAvailable.call(this,t)},t}(i);return n});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("extensions/uv-virtex-extension/ShareDialogue",["require","exports","../../modules/uv-dialogues-module/ShareDialogue"],function(e,t,i){"use strict";var n=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){this.setConfig("shareDialogue"),e.prototype.create.call(this)},t.prototype.update=function(){e.prototype.update.call(this),this.code=this.extension.getEmbedScript(this.options.embedTemplate,this.currentWidth,this.currentHeight),this.$code.val(this.code)},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(i);return n});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("extensions/uv-virtex-extension/SettingsDialogue",["require","exports","../../modules/uv-dialogues-module/SettingsDialogue"],function(e,t,i){"use strict";var n=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){this.setConfig("settingsDialogue"),e.prototype.create.call(this)},t}(i);return n});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-virtexcenterpanel-module/VirtexCenterPanel",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/CenterPanel"],function(e,t,i,n){"use strict";var o=function(e){
function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("virtexCenterPanel"),e.prototype.create.call(this);var n=this;$.subscribe(i.OPEN_EXTERNAL_RESOURCE,function(e,t){n.openMedia(t)}),this.$navigation=$('<div class="navigation"></div>'),this.$content.prepend(this.$navigation),this.$zoomInButton=$('<a class="imageBtn zoomIn" title="'+this.content.zoomIn+'"></a>'),this.$navigation.append(this.$zoomInButton),this.$zoomOutButton=$('<a class="imageBtn zoomOut" title="'+this.content.zoomOut+'"></a>'),this.$navigation.append(this.$zoomOutButton),this.$viewport=$('<div class="virtex"></div>'),this.$content.prepend(this.$viewport),this.title=this.extension.helper.getLabel(),this.updateAttribution(),this.$zoomInButton.on("click",function(e){e.preventDefault(),t.viewport.zoomIn()}),this.$zoomOutButton.on("click",function(e){e.preventDefault(),t.viewport.zoomOut()})},t.prototype.openMedia=function(e){var t=this;this.extension.getExternalResources(e).then(function(){t.$viewport.empty();var e=t.extension.helper.getCurrentCanvas();t.viewport=virtex.create({element:"#content .virtex",object:e.id,showStats:t.options.showStats}),t.resize()})},t.prototype.resize=function(){e.prototype.resize.call(this),this.$title.ellipsisFill(this.title),this.$viewport.width(this.$content.width()),this.$viewport.height(this.$content.height())},t}(n);return o});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("extensions/uv-virtex-extension/Extension",["require","exports","../../modules/uv-shared-module/BaseCommands","../../modules/uv-shared-module/BaseExtension","../../modules/uv-shared-module/Bookmark","../../modules/uv-contentleftpanel-module/ContentLeftPanel","./DownloadDialogue","./ShareDialogue","../../modules/uv-shared-module/FooterPanel","../../modules/uv-shared-module/HeaderPanel","../../modules/uv-moreinforightpanel-module/MoreInfoRightPanel","./SettingsDialogue","../../modules/uv-shared-module/Shell","../../modules/uv-virtexcenterpanel-module/VirtexCenterPanel"],function(e,t,i,n,o,s,r,a,l,h,c,u,p,d){"use strict";var g=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(t){var n=this;e.prototype.create.call(this,t),$.subscribe(i.THUMB_SELECTED,function(e,t){n.viewCanvas(t)})},t.prototype.createModules=function(){e.prototype.createModules.call(this),this.isHeaderPanelEnabled()?this.headerPanel=new h(p.$headerPanel):p.$headerPanel.hide(),this.isLeftPanelEnabled()&&(this.leftPanel=new s(p.$leftPanel)),this.centerPanel=new d(p.$centerPanel),this.isRightPanelEnabled()&&(this.rightPanel=new c(p.$rightPanel)),this.isFooterPanelEnabled()?this.footerPanel=new l(p.$footerPanel):p.$footerPanel.hide(),this.$downloadDialogue=$('<div class="overlay download"></div>'),p.$overlays.append(this.$downloadDialogue),this.downloadDialogue=new r(this.$downloadDialogue),this.$shareDialogue=$('<div class="overlay share"></div>'),p.$overlays.append(this.$shareDialogue),this.shareDialogue=new a(this.$shareDialogue),this.$settingsDialogue=$('<div class="overlay settings"></div>'),p.$overlays.append(this.$settingsDialogue),this.settingsDialogue=new u(this.$settingsDialogue),this.isLeftPanelEnabled()?this.leftPanel.init():p.$leftPanel.hide(),this.isRightPanelEnabled()?this.rightPanel.init():p.$rightPanel.hide()},t.prototype.isLeftPanelEnabled=function(){return Utils.Bools.getBool(this.config.options.leftPanelEnabled,!0)&&(this.helper.isMultiCanvas()||this.helper.isMultiSequence())},t.prototype.bookmark=function(){e.prototype.bookmark.call(this);var t=this.helper.getCurrentCanvas(),n=new o;n.index=this.helper.canvasIndex,n.label=Manifesto.TranslationCollection.getValue(t.getLabel()),n.path=this.getBookmarkUri(),n.thumb=t.getProperty("thumbnail"),n.title=this.helper.getLabel(),n.trackingLabel=window.trackingLabel,n.type=manifesto.ElementType.physicalobject().toString(),this.triggerSocket(i.BOOKMARK,n)},t.prototype.getEmbedScript=function(e,t,i){var n=this.config.uri||"",o=String.format(e,this.getSerializedLocales(),n,this.helper.iiifResourceUri,this.helper.collectionIndex,this.helper.manifestIndex,this.helper.sequenceIndex,this.helper.canvasIndex,t,i,this.embedScriptUri);return o},t}(n);return g}),"function"==typeof jQuery&&define("jquery",[],function(){return jQuery}),require(["Bootstrapper","extensions/uv-mediaelement-extension/Extension","extensions/uv-pdf-extension/Extension","extensions/uv-seadragon-extension/Extension","extensions/uv-virtex-extension/Extension"],function(e,t,i,n,o){var s={};s[manifesto.ElementType.canvas().toString()]={type:n,name:"uv-seadragon-extension"},s[manifesto.ElementType.movingimage().toString()]={type:t,name:"uv-mediaelement-extension"},s[manifesto.ElementType.physicalobject().toString()]={type:o,name:"uv-virtex-extension"},s[manifesto.ElementType.sound().toString()]={type:t,name:"uv-mediaelement-extension"},s[manifesto.RenderingFormat.pdf().toString()]={type:i,name:"uv-pdf-extension"};var r=new e(s);r.bootstrap()}),define("app",function(){});